const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/rtk-avatar_26.entry-C8X0JZ1P.js","assets/string-068ce30a-PQfpzwAu.js","assets/index-dafb4b7f-BkZguBsO.js","assets/chat-269c61ba-B3d2geeN.js","assets/file-6114f1a9-Dp9jsYsA.js","assets/index-3f51790f-D59GKouH.js","assets/ResizeObserver.es-02979d4e-B1PUzC5B.js","assets/join-error-e87be64a-B7hKi0L8.js","assets/floating-ui.dom.esm-78a1e61c-Cp5Rajeb.js","assets/date-b1f78dea-R4f_QjVQ.js","assets/debounce-296a3316-CK1gtbQy.js","assets/rtk-ai-toggle.entry-yOUjvgPO.js","assets/rtk-audio-grid.entry-DkzpKwwc.js","assets/rtk-audio-tile.entry-D6T4pLQE.js","assets/hark-6327d91e-DuW2Bhs4.js","assets/rtk-breakout-rooms-toggle.entry-ClNLPWMY.js","assets/rtk-camera-toggle.entry-BW_2Je6S.js","assets/rtk-caption-toggle.entry-B__nNgtr.js","assets/rtk-chat-composer-ui.entry-DlP53NPE.js","assets/rtk-chat-messages-ui.entry-B2YCOyTL.js","assets/scroll-2d8e810c-igK8pKba.js","assets/rtk-chat-search-results.entry-BaMlOvub.js","assets/rtk-chat-selector-ui.entry-VIZKCZVn.js","assets/rtk-chat-toggle.entry-D_kVuiGe.js","assets/sidebar-4b23298b-Vn2Frp7V.js","assets/rtk-clock.entry-CHUh8JHL.js","assets/rtk-controlbar.entry-CyjWCwfc.js","assets/rtk-debugger-toggle.entry-Bm7oBnrT.js","assets/rtk-dialog-manager.entry-CMWsV33q.js","assets/rtk-ended-screen.entry-DHMScRMp.js","assets/rtk-file-dropzone.entry-D9kEf9nv.js","assets/rtk-grid.entry-DecmwPsE.js","assets/debounce-0169a54d-BEVxlnsK.js","assets/grid-a3ca5a3e-DTk3jwY-.js","assets/rtk-grid-pagination.entry-BwpCUt8D.js","assets/rtk-header.entry-Cg7jPACn.js","assets/rtk-idle-screen.entry-bz6lbV8l.js","assets/rtk-image-viewer.entry-BHBF04CV.js","assets/rtk-information-tooltip.entry-D7rUnbe3.js","assets/rtk-leave-button.entry-BIn7DKsJ.js","assets/rtk-livestream-toggle.entry-271Lurd9.js","assets/rtk-meeting-title.entry-B-cvw5b8.js","assets/rtk-message-list-view.entry-CSIhBgZy.js","assets/rtk-mic-toggle.entry-jTESfsHe.js","assets/rtk-mixed-grid.entry-DT8NXwEz.js","assets/rtk-more-toggle.entry-k6snwy_U.js","assets/rtk-mute-all-button.entry-DIlYteuv.js","assets/rtk-network-indicator.entry-C6w0Qd7a.js","assets/rtk-notifications.entry-CjYA0y8L.js","assets/browser-24d8ab3e-ZUGhWSWE.js","assets/rtk-participant-count.entry-Le8F1CRt.js","assets/rtk-participant-setup.entry-BjybrLlW.js","assets/rtk-participants.entry-BRCjNDSH.js","assets/rtk-participants-audio.entry-BDffpbxd.js","assets/rtk-participants-toggle.entry-DRj1FtCy.js","assets/rtk-pip-toggle.entry-BT4uzOdK.js","assets/rtk-plugins-toggle.entry-CzYQDHH3.js","assets/rtk-polls-toggle.entry-BfEEnSad.js","assets/rtk-recording-indicator.entry-D3W7RcVg.js","assets/rtk-recording-toggle.entry-C97DPNyM.js","assets/rtk-screen-share-toggle.entry-Bah-JqMR.js","assets/rtk-screenshare-view.entry-C63qsdhS.js","assets/full-screen-d36ffc68-LxcQ8Rji.js","assets/rtk-settings.entry-Ble5jhgT.js","assets/rtk-settings-toggle.entry-DNaCrmzG.js","assets/rtk-setup-screen.entry-BS5PFNe3.js","assets/rtk-sidebar.entry-B44Nt2vO.js","assets/rtk-simple-grid.entry-q6fBr6Cz.js","assets/rtk-spotlight-grid.entry-DeDOAr54.js","assets/rtk-stage.entry-CEwfxtui.js","assets/rtk-stage-toggle.entry-DshXSm2_.js","assets/rtk-transcripts.entry-DI2fu2pk.js","assets/rtk-waiting-screen.entry-Bb8kpiFU.js","assets/rtk-ai_3.entry-fplF31is.js","assets/rtk-breakout-rooms-manager_9.entry-DKlP0b1i.js","assets/rtk-chat-message.entry-DBxM8rDh.js","assets/rtk-livestream-indicator_3.entry-B7VwPRdm.js","assets/rtk-name-tag.entry-Cdaym7rm.js","assets/rtk-notification.entry-CSLUgEwU.js","assets/TextMessage-2acfc44b-DndQrMcq.js","assets/rtk-participants-stage-list_4.entry-CzAEl4gQ.js","assets/rtk-plugin-main_2.entry-BFtDcF5m.js","assets/rtk-settings-audio_2.entry-DDUoR49B.js","assets/rtk-transcript.entry-DX-gOBQQ.js","assets/rtk-ai-transcriptions.entry-T_D6R3nO.js","assets/ChatHead-148558a8-Op7-Cfu0.js","assets/rtk-audio-visualizer_4.entry-iKw-1OzZ.js","assets/rtk-breakout-room-manager_3.entry-DhjTniEy.js","assets/rtk-debugger-audio_4.entry-gYn2E3ej.js","assets/rtk-dialog.entry-CLZSy900.js","assets/rtk-file-message_3.entry-cNJFbwAr.js","assets/rtk-fullscreen-toggle.entry-F5yUmy7M.js","assets/rtk-participant_2.entry-DFy8iYXX.js","assets/rtk-camera-selector_2.entry-DCwL5vNz.js","assets/rtk-poll_2.entry-8MZbiRB1.js","assets/rtk-sidebar-ui.entry-DkKUXWjR.js","assets/rtk-spotlight-indicator.entry-CGhQpLH4.js","assets/rtk-logo.entry-C8FJMFDt.js","assets/rtk-controlbar-button.entry-CsfmkmRz.js","assets/index.esm-DkCRNU10.js","assets/index.esm-M0cSJxdH.js","assets/index.esm-BljyuevP.js"])))=>i.map(i=>d[i]);
var xFt=Object.defineProperty;var kMe=t=>{throw TypeError(t)};var wFt=(t,e,n)=>e in t?xFt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;var tn=(t,e,n)=>wFt(t,typeof e!="symbol"?e+"":e,n),Mae=(t,e,n)=>e.has(t)||kMe("Cannot "+n);var Fe=(t,e,n)=>(Mae(t,e,"read from private field"),n?n.call(t):e.get(t)),or=(t,e,n)=>e.has(t)?kMe("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,n),Cn=(t,e,n,r)=>(Mae(t,e,"write to private field"),r?r.call(t,n):e.set(t,n),n),Xr=(t,e,n)=>(Mae(t,e,"access private method"),n);var z9=(t,e,n,r)=>({set _(s){Cn(t,e,s,n)},get _(){return Fe(t,e,r)}});function kFt(t,e){for(var n=0;n<e.length;n++){const r=e[n];if(typeof r!="string"&&!Array.isArray(r)){for(const s in r)if(s!=="default"&&!(s in t)){const i=Object.getOwnPropertyDescriptor(r,s);i&&Object.defineProperty(t,s,i.get?i:{enumerable:!0,get:()=>r[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const s of document.querySelectorAll('link[rel="modulepreload"]'))r(s);new MutationObserver(s=>{for(const i of s)if(i.type==="childList")for(const o of i.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&r(o)}).observe(document,{childList:!0,subtree:!0});function n(s){const i={};return s.integrity&&(i.integrity=s.integrity),s.referrerPolicy&&(i.referrerPolicy=s.referrerPolicy),s.crossOrigin==="use-credentials"?i.credentials="include":s.crossOrigin==="anonymous"?i.credentials="omit":i.credentials="same-origin",i}function r(s){if(s.ep)return;s.ep=!0;const i=n(s);fetch(s.href,i)}})();var xf=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Fs(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ltt={exports:{}},zX={},ctt={exports:{}},Zs={};/**
 * @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 N8=Symbol.for("react.element"),SFt=Symbol.for("react.portal"),CFt=Symbol.for("react.fragment"),jFt=Symbol.for("react.strict_mode"),EFt=Symbol.for("react.profiler"),NFt=Symbol.for("react.provider"),TFt=Symbol.for("react.context"),_Ft=Symbol.for("react.forward_ref"),AFt=Symbol.for("react.suspense"),PFt=Symbol.for("react.memo"),RFt=Symbol.for("react.lazy"),SMe=Symbol.iterator;function IFt(t){return t===null||typeof t!="object"?null:(t=SMe&&t[SMe]||t["@@iterator"],typeof t=="function"?t:null)}var dtt={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},utt=Object.assign,htt={};function X5(t,e,n){this.props=t,this.context=e,this.refs=htt,this.updater=n||dtt}X5.prototype.isReactComponent={};X5.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=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,t,e,"setState")};X5.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function mtt(){}mtt.prototype=X5.prototype;function pke(t,e,n){this.props=t,this.context=e,this.refs=htt,this.updater=n||dtt}var gke=pke.prototype=new mtt;gke.constructor=pke;utt(gke,X5.prototype);gke.isPureReactComponent=!0;var CMe=Array.isArray,ftt=Object.prototype.hasOwnProperty,vke={current:null},ptt={key:!0,ref:!0,__self:!0,__source:!0};function gtt(t,e,n){var r,s={},i=null,o=null;if(e!=null)for(r in e.ref!==void 0&&(o=e.ref),e.key!==void 0&&(i=""+e.key),e)ftt.call(e,r)&&!ptt.hasOwnProperty(r)&&(s[r]=e[r]);var l=arguments.length-2;if(l===1)s.children=n;else if(1<l){for(var c=Array(l),d=0;d<l;d++)c[d]=arguments[d+2];s.children=c}if(t&&t.defaultProps)for(r in l=t.defaultProps,l)s[r]===void 0&&(s[r]=l[r]);return{$$typeof:N8,type:t,key:i,ref:o,props:s,_owner:vke.current}}function MFt(t,e){return{$$typeof:N8,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}}function yke(t){return typeof t=="object"&&t!==null&&t.$$typeof===N8}function LFt(t){var e={"=":"=0",":":"=2"};return"$"+t.replace(/[=:]/g,function(n){return e[n]})}var jMe=/\/+/g;function Lae(t,e){return typeof t=="object"&&t!==null&&t.key!=null?LFt(""+t.key):e.toString(36)}function QH(t,e,n,r,s){var i=typeof t;(i==="undefined"||i==="boolean")&&(t=null);var o=!1;if(t===null)o=!0;else switch(i){case"string":case"number":o=!0;break;case"object":switch(t.$$typeof){case N8:case SFt:o=!0}}if(o)return o=t,s=s(o),t=r===""?"."+Lae(o,0):r,CMe(s)?(n="",t!=null&&(n=t.replace(jMe,"$&/")+"/"),QH(s,e,n,"",function(d){return d})):s!=null&&(yke(s)&&(s=MFt(s,n+(!s.key||o&&o.key===s.key?"":(""+s.key).replace(jMe,"$&/")+"/")+t)),e.push(s)),1;if(o=0,r=r===""?".":r+":",CMe(t))for(var l=0;l<t.length;l++){i=t[l];var c=r+Lae(i,l);o+=QH(i,e,n,c,s)}else if(c=IFt(t),typeof c=="function")for(t=c.call(t),l=0;!(i=t.next()).done;)i=i.value,c=r+Lae(i,l++),o+=QH(i,e,n,c,s);else if(i==="object")throw e=String(t),Error("Objects are not valid as a React child (found: "+(e==="[object Object]"?"object with keys {"+Object.keys(t).join(", ")+"}":e)+"). If you meant to render a collection of children, use an array instead.");return o}function V9(t,e,n){if(t==null)return t;var r=[],s=0;return QH(t,r,"","",function(i){return e.call(n,i,s++)}),r}function DFt(t){if(t._status===-1){var e=t._result;e=e(),e.then(function(n){(t._status===0||t._status===-1)&&(t._status=1,t._result=n)},function(n){(t._status===0||t._status===-1)&&(t._status=2,t._result=n)}),t._status===-1&&(t._status=0,t._result=e)}if(t._status===1)return t._result.default;throw t._result}var $u={current:null},ZH={transition:null},$Ft={ReactCurrentDispatcher:$u,ReactCurrentBatchConfig:ZH,ReactCurrentOwner:vke};function vtt(){throw Error("act(...) is not supported in production builds of React.")}Zs.Children={map:V9,forEach:function(t,e,n){V9(t,function(){e.apply(this,arguments)},n)},count:function(t){var e=0;return V9(t,function(){e++}),e},toArray:function(t){return V9(t,function(e){return e})||[]},only:function(t){if(!yke(t))throw Error("React.Children.only expected to receive a single React element child.");return t}};Zs.Component=X5;Zs.Fragment=CFt;Zs.Profiler=EFt;Zs.PureComponent=pke;Zs.StrictMode=jFt;Zs.Suspense=AFt;Zs.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=$Ft;Zs.act=vtt;Zs.cloneElement=function(t,e,n){if(t==null)throw Error("React.cloneElement(...): The argument must be a React element, but you passed "+t+".");var r=utt({},t.props),s=t.key,i=t.ref,o=t._owner;if(e!=null){if(e.ref!==void 0&&(i=e.ref,o=vke.current),e.key!==void 0&&(s=""+e.key),t.type&&t.type.defaultProps)var l=t.type.defaultProps;for(c in e)ftt.call(e,c)&&!ptt.hasOwnProperty(c)&&(r[c]=e[c]===void 0&&l!==void 0?l[c]:e[c])}var c=arguments.length-2;if(c===1)r.children=n;else if(1<c){l=Array(c);for(var d=0;d<c;d++)l[d]=arguments[d+2];r.children=l}return{$$typeof:N8,type:t.type,key:s,ref:i,props:r,_owner:o}};Zs.createContext=function(t){return t={$$typeof:TFt,_currentValue:t,_currentValue2:t,_threadCount:0,Provider:null,Consumer:null,_defaultValue:null,_globalName:null},t.Provider={$$typeof:NFt,_context:t},t.Consumer=t};Zs.createElement=gtt;Zs.createFactory=function(t){var e=gtt.bind(null,t);return e.type=t,e};Zs.createRef=function(){return{current:null}};Zs.forwardRef=function(t){return{$$typeof:_Ft,render:t}};Zs.isValidElement=yke;Zs.lazy=function(t){return{$$typeof:RFt,_payload:{_status:-1,_result:t},_init:DFt}};Zs.memo=function(t,e){return{$$typeof:PFt,type:t,compare:e===void 0?null:e}};Zs.startTransition=function(t){var e=ZH.transition;ZH.transition={};try{t()}finally{ZH.transition=e}};Zs.unstable_act=vtt;Zs.useCallback=function(t,e){return $u.current.useCallback(t,e)};Zs.useContext=function(t){return $u.current.useContext(t)};Zs.useDebugValue=function(){};Zs.useDeferredValue=function(t){return $u.current.useDeferredValue(t)};Zs.useEffect=function(t,e){return $u.current.useEffect(t,e)};Zs.useId=function(){return $u.current.useId()};Zs.useImperativeHandle=function(t,e,n){return $u.current.useImperativeHandle(t,e,n)};Zs.useInsertionEffect=function(t,e){return $u.current.useInsertionEffect(t,e)};Zs.useLayoutEffect=function(t,e){return $u.current.useLayoutEffect(t,e)};Zs.useMemo=function(t,e){return $u.current.useMemo(t,e)};Zs.useReducer=function(t,e,n){return $u.current.useReducer(t,e,n)};Zs.useRef=function(t){return $u.current.useRef(t)};Zs.useState=function(t){return $u.current.useState(t)};Zs.useSyncExternalStore=function(t,e,n){return $u.current.useSyncExternalStore(t,e,n)};Zs.useTransition=function(){return $u.current.useTransition()};Zs.version="18.3.1";ctt.exports=Zs;var y=ctt.exports;const se=Fs(y),bke=kFt({__proto__:null,default:se},[y]);/**
 * @license React
 * react-jsx-runtime.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var OFt=y,FFt=Symbol.for("react.element"),BFt=Symbol.for("react.fragment"),UFt=Object.prototype.hasOwnProperty,zFt=OFt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,VFt={key:!0,ref:!0,__self:!0,__source:!0};function ytt(t,e,n){var r,s={},i=null,o=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(o=e.ref);for(r in e)UFt.call(e,r)&&!VFt.hasOwnProperty(r)&&(s[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)s[r]===void 0&&(s[r]=e[r]);return{$$typeof:FFt,type:t,key:i,ref:o,props:s,_owner:zFt.current}}zX.Fragment=BFt;zX.jsx=ytt;zX.jsxs=ytt;ltt.exports=zX;var a=ltt.exports;const HFt=50,GFt=2e3,WFt=4e3,qFt=1e3,YT=[];let EMe=!1;function NMe(t,e=GFt){return t.replace(/Bearer\s+[\w.~+/=-]+/gi,"Bearer [redacted]").replace(/\beyJ[\w-]+\.[\w-]+\.[\w-]+/g,"[jwt]").replace(/[\w.+-]+@[\w-]+\.[\w.-]+/g,"[email]").replace(/([?&#](?:token|access_token|otp|code|key|password|secret|signature)=)[^&#\s]+/gi,"$1[redacted]").replace(/\b((?:access_?|refresh_?|auth_?)?token|otp|password|passwd|secret|api_?key)(\s*[=:]\s*)(?!\[redacted\])[^\s&#,;"']+/gi,"$1$2[redacted]").slice(0,e)}function TMe(t){if(t instanceof Error)return`${t.name}: ${t.message}`;if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}function KFt(t){return/(chrome|moz|safari(-web)?)-extension:\/\//.test(t)}function JH(t){const e=NMe(t.msg),n=t.stack?NMe(t.stack,WFt):void 0;if(KFt(`${e}
${n??""}`))return;const r=t.t??Date.now(),s=YT[YT.length-1];s&&s.kind===t.kind&&s.msg===e&&r-s.t<qFt||(YT.push({t:r,kind:t.kind,msg:e,stack:n}),YT.length>HFt&&YT.shift())}function YFt(t,e,n,r){const s=e.split("?")[0];JH({kind:"api",msg:`${(t||"GET").toUpperCase()} ${s} → ${n||"network error"} ${r}`.trim()})}function QFt(){return YT.map(t=>({...t}))}function ZFt(){EMe||typeof window>"u"||(EMe=!0,["error","warn"].forEach(t=>{const e=console[t].bind(console);console[t]=(...n)=>{try{const r=n.find(s=>s instanceof Error);JH({kind:t,msg:n.map(TMe).join(" "),stack:r==null?void 0:r.stack})}catch{}e(...n)}}),window.addEventListener("error",t=>{JH({kind:"crash",msg:`${t.message}${t.filename?` @ ${t.filename}:${t.lineno}:${t.colno}`:""}`,stack:t.error instanceof Error?t.error.stack:void 0})}),window.addEventListener("unhandledrejection",t=>{const e=t.reason;JH({kind:"rejection",msg:e instanceof Error?`${e.name}: ${e.message}`:TMe(e),stack:e instanceof Error?e.stack:void 0})}))}function Dae(){if(typeof document>"u")return"unknown";const t=document.querySelector('script[type="module"][src*="/assets/index-"]'),e=t==null?void 0:t.src.match(/index-([\w-]+)\.js/);return e?e[1]:"unknown"}var btt={exports:{}},Im={},xtt={exports:{}},wtt={};/**
 * @license React
 * scheduler.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */(function(t){function e(P,M){var z=P.length;P.push(M);e:for(;0<z;){var G=z-1>>>1,B=P[G];if(0<s(B,M))P[G]=M,P[z]=B,z=G;else break e}}function n(P){return P.length===0?null:P[0]}function r(P){if(P.length===0)return null;var M=P[0],z=P.pop();if(z!==M){P[0]=z;e:for(var G=0,B=P.length,H=B>>>1;G<H;){var W=2*(G+1)-1,V=P[W],U=W+1,ne=P[U];if(0>s(V,z))U<B&&0>s(ne,V)?(P[G]=ne,P[U]=z,G=U):(P[G]=V,P[W]=z,G=W);else if(U<B&&0>s(ne,z))P[G]=ne,P[U]=z,G=U;else break e}}return M}function s(P,M){var z=P.sortIndex-M.sortIndex;return z!==0?z:P.id-M.id}if(typeof performance=="object"&&typeof performance.now=="function"){var i=performance;t.unstable_now=function(){return i.now()}}else{var o=Date,l=o.now();t.unstable_now=function(){return o.now()-l}}var c=[],d=[],u=1,h=null,m=3,f=!1,p=!1,g=!1,v=typeof setTimeout=="function"?setTimeout:null,b=typeof clearTimeout=="function"?clearTimeout:null,x=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function w(P){for(var M=n(d);M!==null;){if(M.callback===null)r(d);else if(M.startTime<=P)r(d),M.sortIndex=M.expirationTime,e(c,M);else break;M=n(d)}}function k(P){if(g=!1,w(P),!p)if(n(c)!==null)p=!0,D(S);else{var M=n(d);M!==null&&I(k,M.startTime-P)}}function S(P,M){p=!1,g&&(g=!1,b(E),E=-1),f=!0;var z=m;try{for(w(M),h=n(c);h!==null&&(!(h.expirationTime>M)||P&&!_());){var G=h.callback;if(typeof G=="function"){h.callback=null,m=h.priorityLevel;var B=G(h.expirationTime<=M);M=t.unstable_now(),typeof B=="function"?h.callback=B:h===n(c)&&r(c),w(M)}else r(c);h=n(c)}if(h!==null)var H=!0;else{var W=n(d);W!==null&&I(k,W.startTime-M),H=!1}return H}finally{h=null,m=z,f=!1}}var C=!1,j=null,E=-1,N=5,A=-1;function _(){return!(t.unstable_now()-A<N)}function T(){if(j!==null){var P=t.unstable_now();A=P;var M=!0;try{M=j(!0,P)}finally{M?R():(C=!1,j=null)}}else C=!1}var R;if(typeof x=="function")R=function(){x(T)};else if(typeof MessageChannel<"u"){var O=new MessageChannel,F=O.port2;O.port1.onmessage=T,R=function(){F.postMessage(null)}}else R=function(){v(T,0)};function D(P){j=P,C||(C=!0,R())}function I(P,M){E=v(function(){P(t.unstable_now())},M)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(P){P.callback=null},t.unstable_continueExecution=function(){p||f||(p=!0,D(S))},t.unstable_forceFrameRate=function(P){0>P||125<P?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):N=0<P?Math.floor(1e3/P):5},t.unstable_getCurrentPriorityLevel=function(){return m},t.unstable_getFirstCallbackNode=function(){return n(c)},t.unstable_next=function(P){switch(m){case 1:case 2:case 3:var M=3;break;default:M=m}var z=m;m=M;try{return P()}finally{m=z}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(P,M){switch(P){case 1:case 2:case 3:case 4:case 5:break;default:P=3}var z=m;m=P;try{return M()}finally{m=z}},t.unstable_scheduleCallback=function(P,M,z){var G=t.unstable_now();switch(typeof z=="object"&&z!==null?(z=z.delay,z=typeof z=="number"&&0<z?G+z:G):z=G,P){case 1:var B=-1;break;case 2:B=250;break;case 5:B=1073741823;break;case 4:B=1e4;break;default:B=5e3}return B=z+B,P={id:u++,callback:M,priorityLevel:P,startTime:z,expirationTime:B,sortIndex:-1},z>G?(P.sortIndex=z,e(d,P),n(c)===null&&P===n(d)&&(g?(b(E),E=-1):g=!0,I(k,z-G))):(P.sortIndex=B,e(c,P),p||f||(p=!0,D(S))),P},t.unstable_shouldYield=_,t.unstable_wrapCallback=function(P){var M=m;return function(){var z=m;m=M;try{return P.apply(this,arguments)}finally{m=z}}}})(wtt);xtt.exports=wtt;var JFt=xtt.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 XFt=y,jm=JFt;function cn(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}var ktt=new Set,Y$={};function xE(t,e){RP(t,e),RP(t+"Capture",e)}function RP(t,e){for(Y$[t]=e,t=0;t<e.length;t++)ktt.add(e[t])}var Dx=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),ame=Object.prototype.hasOwnProperty,e8t=/^[: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]*$/,_Me={},AMe={};function t8t(t){return ame.call(AMe,t)?!0:ame.call(_Me,t)?!1:e8t.test(t)?AMe[t]=!0:(_Me[t]=!0,!1)}function n8t(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function r8t(t,e,n,r){if(e===null||typeof e>"u"||n8t(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function Ou(t,e,n,r,s,i,o){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=s,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=o}var bd={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){bd[t]=new Ou(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];bd[e]=new Ou(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){bd[t]=new Ou(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){bd[t]=new Ou(t,2,!1,t,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(t){bd[t]=new Ou(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){bd[t]=new Ou(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){bd[t]=new Ou(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){bd[t]=new Ou(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){bd[t]=new Ou(t,5,!1,t.toLowerCase(),null,!1,!1)});var xke=/[\-:]([a-z])/g;function wke(t){return t[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(t){var e=t.replace(xke,wke);bd[e]=new Ou(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(xke,wke);bd[e]=new Ou(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(xke,wke);bd[e]=new Ou(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){bd[t]=new Ou(t,1,!1,t.toLowerCase(),null,!1,!1)});bd.xlinkHref=new Ou("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){bd[t]=new Ou(t,1,!1,t.toLowerCase(),null,!0,!0)});function kke(t,e,n,r){var s=bd.hasOwnProperty(e)?bd[e]:null;(s!==null?s.type!==0:r||!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N")&&(r8t(e,n,s,r)&&(n=null),r||s===null?t8t(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):s.mustUseProperty?t[s.propertyName]=n===null?s.type===3?!1:"":n:(e=s.attributeName,r=s.attributeNamespace,n===null?t.removeAttribute(e):(s=s.type,n=s===3||s===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var x0=XFt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,H9=Symbol.for("react.element"),V_=Symbol.for("react.portal"),H_=Symbol.for("react.fragment"),Ske=Symbol.for("react.strict_mode"),ome=Symbol.for("react.profiler"),Stt=Symbol.for("react.provider"),Ctt=Symbol.for("react.context"),Cke=Symbol.for("react.forward_ref"),lme=Symbol.for("react.suspense"),cme=Symbol.for("react.suspense_list"),jke=Symbol.for("react.memo"),zw=Symbol.for("react.lazy"),jtt=Symbol.for("react.offscreen"),PMe=Symbol.iterator;function dL(t){return t===null||typeof t!="object"?null:(t=PMe&&t[PMe]||t["@@iterator"],typeof t=="function"?t:null)}var Bo=Object.assign,$ae;function c4(t){if($ae===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);$ae=e&&e[1]||""}return`
`+$ae+t}var Oae=!1;function Fae(t,e){if(!t||Oae)return"";Oae=!0;var n=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{if(e)if(e=function(){throw Error()},Object.defineProperty(e.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(e,[])}catch(d){var r=d}Reflect.construct(t,[],e)}else{try{e.call()}catch(d){r=d}t.call(e.prototype)}else{try{throw Error()}catch(d){r=d}t()}}catch(d){if(d&&r&&typeof d.stack=="string"){for(var s=d.stack.split(`
`),i=r.stack.split(`
`),o=s.length-1,l=i.length-1;1<=o&&0<=l&&s[o]!==i[l];)l--;for(;1<=o&&0<=l;o--,l--)if(s[o]!==i[l]){if(o!==1||l!==1)do if(o--,l--,0>l||s[o]!==i[l]){var c=`
`+s[o].replace(" at new "," at ");return t.displayName&&c.includes("<anonymous>")&&(c=c.replace("<anonymous>",t.displayName)),c}while(1<=o&&0<=l);break}}}finally{Oae=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?c4(t):""}function s8t(t){switch(t.tag){case 5:return c4(t.type);case 16:return c4("Lazy");case 13:return c4("Suspense");case 19:return c4("SuspenseList");case 0:case 2:case 15:return t=Fae(t.type,!1),t;case 11:return t=Fae(t.type.render,!1),t;case 1:return t=Fae(t.type,!0),t;default:return""}}function dme(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case H_:return"Fragment";case V_:return"Portal";case ome:return"Profiler";case Ske:return"StrictMode";case lme:return"Suspense";case cme:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Ctt:return(t.displayName||"Context")+".Consumer";case Stt:return(t._context.displayName||"Context")+".Provider";case Cke:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case jke:return e=t.displayName||null,e!==null?e:dme(t.type)||"Memo";case zw:e=t._payload,t=t._init;try{return dme(t(e))}catch{}}return null}function i8t(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return dme(e);case 8:return e===Ske?"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 e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function pk(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function Ett(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function a8t(t){var e=Ett(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var s=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return s.call(this)},set:function(o){r=""+o,i.call(this,o)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(o){r=""+o},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function G9(t){t._valueTracker||(t._valueTracker=a8t(t))}function Ntt(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=Ett(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Gq(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function ume(t,e){var n=e.checked;return Bo({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function RMe(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=pk(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function Ttt(t,e){e=e.checked,e!=null&&kke(t,"checked",e,!1)}function hme(t,e){Ttt(t,e);var n=pk(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?mme(t,e.type,n):e.hasOwnProperty("defaultValue")&&mme(t,e.type,pk(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function IMe(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function mme(t,e,n){(e!=="number"||Gq(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var d4=Array.isArray;function TA(t,e,n,r){if(t=t.options,e){e={};for(var s=0;s<n.length;s++)e["$"+n[s]]=!0;for(n=0;n<t.length;n++)s=e.hasOwnProperty("$"+t[n].value),t[n].selected!==s&&(t[n].selected=s),s&&r&&(t[n].defaultSelected=!0)}else{for(n=""+pk(n),e=null,s=0;s<t.length;s++){if(t[s].value===n){t[s].selected=!0,r&&(t[s].defaultSelected=!0);return}e!==null||t[s].disabled||(e=t[s])}e!==null&&(e.selected=!0)}}function fme(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(cn(91));return Bo({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function MMe(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(cn(92));if(d4(n)){if(1<n.length)throw Error(cn(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:pk(n)}}function _tt(t,e){var n=pk(e.value),r=pk(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function LMe(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}function Att(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function pme(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Att(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var W9,Ptt=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,s){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,s)})}:t}(function(t,e){if(t.namespaceURI!=="http://www.w3.org/2000/svg"||"innerHTML"in t)t.innerHTML=e;else{for(W9=W9||document.createElement("div"),W9.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=W9.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Q$(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var dD={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},o8t=["Webkit","ms","Moz","O"];Object.keys(dD).forEach(function(t){o8t.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),dD[e]=dD[t]})});function Rtt(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||dD.hasOwnProperty(t)&&dD[t]?(""+e).trim():e+"px"}function Itt(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,s=Rtt(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,s):t[n]=s}}var l8t=Bo({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 gme(t,e){if(e){if(l8t[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(cn(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(cn(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error(cn(61))}if(e.style!=null&&typeof e.style!="object")throw Error(cn(62))}}function vme(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){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 yme=null;function Eke(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var bme=null,_A=null,AA=null;function DMe(t){if(t=A8(t)){if(typeof bme!="function")throw Error(cn(280));var e=t.stateNode;e&&(e=qX(e),bme(t.stateNode,t.type,e))}}function Mtt(t){_A?AA?AA.push(t):AA=[t]:_A=t}function Ltt(){if(_A){var t=_A,e=AA;if(AA=_A=null,DMe(t),e)for(t=0;t<e.length;t++)DMe(e[t])}}function Dtt(t,e){return t(e)}function $tt(){}var Bae=!1;function Ott(t,e,n){if(Bae)return t(e,n);Bae=!0;try{return Dtt(t,e,n)}finally{Bae=!1,(_A!==null||AA!==null)&&($tt(),Ltt())}}function Z$(t,e){var n=t.stateNode;if(n===null)return null;var r=qX(n);if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(cn(231,e,typeof n));return n}var xme=!1;if(Dx)try{var uL={};Object.defineProperty(uL,"passive",{get:function(){xme=!0}}),window.addEventListener("test",uL,uL),window.removeEventListener("test",uL,uL)}catch{xme=!1}function c8t(t,e,n,r,s,i,o,l,c){var d=Array.prototype.slice.call(arguments,3);try{e.apply(n,d)}catch(u){this.onError(u)}}var uD=!1,Wq=null,qq=!1,wme=null,d8t={onError:function(t){uD=!0,Wq=t}};function u8t(t,e,n,r,s,i,o,l,c){uD=!1,Wq=null,c8t.apply(d8t,arguments)}function h8t(t,e,n,r,s,i,o,l,c){if(u8t.apply(this,arguments),uD){if(uD){var d=Wq;uD=!1,Wq=null}else throw Error(cn(198));qq||(qq=!0,wme=d)}}function wE(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&4098&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function Ftt(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function $Me(t){if(wE(t)!==t)throw Error(cn(188))}function m8t(t){var e=t.alternate;if(!e){if(e=wE(t),e===null)throw Error(cn(188));return e!==t?null:t}for(var n=t,r=e;;){var s=n.return;if(s===null)break;var i=s.alternate;if(i===null){if(r=s.return,r!==null){n=r;continue}break}if(s.child===i.child){for(i=s.child;i;){if(i===n)return $Me(s),t;if(i===r)return $Me(s),e;i=i.sibling}throw Error(cn(188))}if(n.return!==r.return)n=s,r=i;else{for(var o=!1,l=s.child;l;){if(l===n){o=!0,n=s,r=i;break}if(l===r){o=!0,r=s,n=i;break}l=l.sibling}if(!o){for(l=i.child;l;){if(l===n){o=!0,n=i,r=s;break}if(l===r){o=!0,r=i,n=s;break}l=l.sibling}if(!o)throw Error(cn(189))}}if(n.alternate!==r)throw Error(cn(190))}if(n.tag!==3)throw Error(cn(188));return n.stateNode.current===n?t:e}function Btt(t){return t=m8t(t),t!==null?Utt(t):null}function Utt(t){if(t.tag===5||t.tag===6)return t;for(t=t.child;t!==null;){var e=Utt(t);if(e!==null)return e;t=t.sibling}return null}var ztt=jm.unstable_scheduleCallback,OMe=jm.unstable_cancelCallback,f8t=jm.unstable_shouldYield,p8t=jm.unstable_requestPaint,yl=jm.unstable_now,g8t=jm.unstable_getCurrentPriorityLevel,Nke=jm.unstable_ImmediatePriority,Vtt=jm.unstable_UserBlockingPriority,Kq=jm.unstable_NormalPriority,v8t=jm.unstable_LowPriority,Htt=jm.unstable_IdlePriority,VX=null,cy=null;function y8t(t){if(cy&&typeof cy.onCommitFiberRoot=="function")try{cy.onCommitFiberRoot(VX,t,void 0,(t.current.flags&128)===128)}catch{}}var xg=Math.clz32?Math.clz32:w8t,b8t=Math.log,x8t=Math.LN2;function w8t(t){return t>>>=0,t===0?32:31-(b8t(t)/x8t|0)|0}var q9=64,K9=4194304;function u4(t){switch(t&-t){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 t&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Yq(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,s=t.suspendedLanes,i=t.pingedLanes,o=n&268435455;if(o!==0){var l=o&~s;l!==0?r=u4(l):(i&=o,i!==0&&(r=u4(i)))}else o=n&~s,o!==0?r=u4(o):i!==0&&(r=u4(i));if(r===0)return 0;if(e!==0&&e!==r&&!(e&s)&&(s=r&-r,i=e&-e,s>=i||s===16&&(i&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-xg(e),s=1<<n,r|=t[n],e&=~s;return r}function k8t(t,e){switch(t){case 1:case 2:case 4:return e+250;case 8:case 16:case 32:case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return e+5e3;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return-1;case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function S8t(t,e){for(var n=t.suspendedLanes,r=t.pingedLanes,s=t.expirationTimes,i=t.pendingLanes;0<i;){var o=31-xg(i),l=1<<o,c=s[o];c===-1?(!(l&n)||l&r)&&(s[o]=k8t(l,e)):c<=e&&(t.expiredLanes|=l),i&=~l}}function kme(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function Gtt(){var t=q9;return q9<<=1,!(q9&4194240)&&(q9=64),t}function Uae(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function T8(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-xg(e),t[e]=n}function C8t(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0<n;){var s=31-xg(n),i=1<<s;e[s]=0,r[s]=-1,t[s]=-1,n&=~i}}function Tke(t,e){var n=t.entangledLanes|=e;for(t=t.entanglements;n;){var r=31-xg(n),s=1<<r;s&e|t[r]&e&&(t[r]|=e),n&=~s}}var zi=0;function Wtt(t){return t&=-t,1<t?4<t?t&268435455?16:536870912:4:1}var qtt,_ke,Ktt,Ytt,Qtt,Sme=!1,Y9=[],U1=null,z1=null,V1=null,J$=new Map,X$=new Map,n1=[],j8t="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function FMe(t,e){switch(t){case"focusin":case"focusout":U1=null;break;case"dragenter":case"dragleave":z1=null;break;case"mouseover":case"mouseout":V1=null;break;case"pointerover":case"pointerout":J$.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":X$.delete(e.pointerId)}}function hL(t,e,n,r,s,i){return t===null||t.nativeEvent!==i?(t={blockedOn:e,domEventName:n,eventSystemFlags:r,nativeEvent:i,targetContainers:[s]},e!==null&&(e=A8(e),e!==null&&_ke(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,s!==null&&e.indexOf(s)===-1&&e.push(s),t)}function E8t(t,e,n,r,s){switch(e){case"focusin":return U1=hL(U1,t,e,n,r,s),!0;case"dragenter":return z1=hL(z1,t,e,n,r,s),!0;case"mouseover":return V1=hL(V1,t,e,n,r,s),!0;case"pointerover":var i=s.pointerId;return J$.set(i,hL(J$.get(i)||null,t,e,n,r,s)),!0;case"gotpointercapture":return i=s.pointerId,X$.set(i,hL(X$.get(i)||null,t,e,n,r,s)),!0}return!1}function Ztt(t){var e=pj(t.target);if(e!==null){var n=wE(e);if(n!==null){if(e=n.tag,e===13){if(e=Ftt(n),e!==null){t.blockedOn=e,Qtt(t.priority,function(){Ktt(n)});return}}else if(e===3&&n.stateNode.current.memoizedState.isDehydrated){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function XH(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Cme(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n===null){n=t.nativeEvent;var r=new n.constructor(n.type,n);yme=r,n.target.dispatchEvent(r),yme=null}else return e=A8(n),e!==null&&_ke(e),t.blockedOn=n,!1;e.shift()}return!0}function BMe(t,e,n){XH(t)&&n.delete(e)}function N8t(){Sme=!1,U1!==null&&XH(U1)&&(U1=null),z1!==null&&XH(z1)&&(z1=null),V1!==null&&XH(V1)&&(V1=null),J$.forEach(BMe),X$.forEach(BMe)}function mL(t,e){t.blockedOn===e&&(t.blockedOn=null,Sme||(Sme=!0,jm.unstable_scheduleCallback(jm.unstable_NormalPriority,N8t)))}function eO(t){function e(s){return mL(s,t)}if(0<Y9.length){mL(Y9[0],t);for(var n=1;n<Y9.length;n++){var r=Y9[n];r.blockedOn===t&&(r.blockedOn=null)}}for(U1!==null&&mL(U1,t),z1!==null&&mL(z1,t),V1!==null&&mL(V1,t),J$.forEach(e),X$.forEach(e),n=0;n<n1.length;n++)r=n1[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<n1.length&&(n=n1[0],n.blockedOn===null);)Ztt(n),n.blockedOn===null&&n1.shift()}var PA=x0.ReactCurrentBatchConfig,Qq=!0;function T8t(t,e,n,r){var s=zi,i=PA.transition;PA.transition=null;try{zi=1,Ake(t,e,n,r)}finally{zi=s,PA.transition=i}}function _8t(t,e,n,r){var s=zi,i=PA.transition;PA.transition=null;try{zi=4,Ake(t,e,n,r)}finally{zi=s,PA.transition=i}}function Ake(t,e,n,r){if(Qq){var s=Cme(t,e,n,r);if(s===null)Zae(t,e,r,Zq,n),FMe(t,r);else if(E8t(s,t,e,n,r))r.stopPropagation();else if(FMe(t,r),e&4&&-1<j8t.indexOf(t)){for(;s!==null;){var i=A8(s);if(i!==null&&qtt(i),i=Cme(t,e,n,r),i===null&&Zae(t,e,r,Zq,n),i===s)break;s=i}s!==null&&r.stopPropagation()}else Zae(t,e,r,null,n)}}var Zq=null;function Cme(t,e,n,r){if(Zq=null,t=Eke(r),t=pj(t),t!==null)if(e=wE(t),e===null)t=null;else if(n=e.tag,n===13){if(t=Ftt(e),t!==null)return t;t=null}else if(n===3){if(e.stateNode.current.memoizedState.isDehydrated)return e.tag===3?e.stateNode.containerInfo:null;t=null}else e!==t&&(t=null);return Zq=t,null}function Jtt(t){switch(t){case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 1;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"toggle":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 4;case"message":switch(g8t()){case Nke:return 1;case Vtt:return 4;case Kq:case v8t:return 16;case Htt:return 536870912;default:return 16}default:return 16}}var C1=null,Pke=null,eG=null;function Xtt(){if(eG)return eG;var t,e=Pke,n=e.length,r,s="value"in C1?C1.value:C1.textContent,i=s.length;for(t=0;t<n&&e[t]===s[t];t++);var o=n-t;for(r=1;r<=o&&e[n-r]===s[i-r];r++);return eG=s.slice(t,1<r?1-r:void 0)}function tG(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Q9(){return!0}function UMe(){return!1}function Mm(t){function e(n,r,s,i,o){this._reactName=n,this._targetInst=s,this.type=r,this.nativeEvent=i,this.target=o,this.currentTarget=null;for(var l in t)t.hasOwnProperty(l)&&(n=t[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Q9:UMe,this.isPropagationStopped=UMe,this}return Bo(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Q9)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Q9)},persist:function(){},isPersistent:Q9}),e}var eI={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Rke=Mm(eI),_8=Bo({},eI,{view:0,detail:0}),A8t=Mm(_8),zae,Vae,fL,HX=Bo({},_8,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Ike,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==fL&&(fL&&t.type==="mousemove"?(zae=t.screenX-fL.screenX,Vae=t.screenY-fL.screenY):Vae=zae=0,fL=t),zae)},movementY:function(t){return"movementY"in t?t.movementY:Vae}}),zMe=Mm(HX),P8t=Bo({},HX,{dataTransfer:0}),R8t=Mm(P8t),I8t=Bo({},_8,{relatedTarget:0}),Hae=Mm(I8t),M8t=Bo({},eI,{animationName:0,elapsedTime:0,pseudoElement:0}),L8t=Mm(M8t),D8t=Bo({},eI,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),$8t=Mm(D8t),O8t=Bo({},eI,{data:0}),VMe=Mm(O8t),F8t={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},B8t={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},U8t={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function z8t(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=U8t[t])?!!e[t]:!1}function Ike(){return z8t}var V8t=Bo({},_8,{key:function(t){if(t.key){var e=F8t[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=tG(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?B8t[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Ike,charCode:function(t){return t.type==="keypress"?tG(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?tG(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),H8t=Mm(V8t),G8t=Bo({},HX,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),HMe=Mm(G8t),W8t=Bo({},_8,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Ike}),q8t=Mm(W8t),K8t=Bo({},eI,{propertyName:0,elapsedTime:0,pseudoElement:0}),Y8t=Mm(K8t),Q8t=Bo({},HX,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),Z8t=Mm(Q8t),J8t=[9,13,27,32],Mke=Dx&&"CompositionEvent"in window,hD=null;Dx&&"documentMode"in document&&(hD=document.documentMode);var X8t=Dx&&"TextEvent"in window&&!hD,ent=Dx&&(!Mke||hD&&8<hD&&11>=hD),GMe=" ",WMe=!1;function tnt(t,e){switch(t){case"keyup":return J8t.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function nnt(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var G_=!1;function e7t(t,e){switch(t){case"compositionend":return nnt(e);case"keypress":return e.which!==32?null:(WMe=!0,GMe);case"textInput":return t=e.data,t===GMe&&WMe?null:t;default:return null}}function t7t(t,e){if(G_)return t==="compositionend"||!Mke&&tnt(t,e)?(t=Xtt(),eG=Pke=C1=null,G_=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return ent&&e.locale!=="ko"?null:e.data;default:return null}}var n7t={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function qMe(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!n7t[t.type]:e==="textarea"}function rnt(t,e,n,r){Mtt(r),e=Jq(e,"onChange"),0<e.length&&(n=new Rke("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var mD=null,tO=null;function r7t(t){fnt(t,0)}function GX(t){var e=K_(t);if(Ntt(e))return t}function s7t(t,e){if(t==="change")return e}var snt=!1;if(Dx){var Gae;if(Dx){var Wae="oninput"in document;if(!Wae){var KMe=document.createElement("div");KMe.setAttribute("oninput","return;"),Wae=typeof KMe.oninput=="function"}Gae=Wae}else Gae=!1;snt=Gae&&(!document.documentMode||9<document.documentMode)}function YMe(){mD&&(mD.detachEvent("onpropertychange",int),tO=mD=null)}function int(t){if(t.propertyName==="value"&&GX(tO)){var e=[];rnt(e,tO,t,Eke(t)),Ott(r7t,e)}}function i7t(t,e,n){t==="focusin"?(YMe(),mD=e,tO=n,mD.attachEvent("onpropertychange",int)):t==="focusout"&&YMe()}function a7t(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return GX(tO)}function o7t(t,e){if(t==="click")return GX(e)}function l7t(t,e){if(t==="input"||t==="change")return GX(e)}function c7t(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var _g=typeof Object.is=="function"?Object.is:c7t;function nO(t,e){if(_g(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++){var s=n[r];if(!ame.call(e,s)||!_g(t[s],e[s]))return!1}return!0}function QMe(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function ZMe(t,e){var n=QMe(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=QMe(n)}}function ant(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?ant(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function ont(){for(var t=window,e=Gq();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Gq(t.document)}return e}function Lke(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function d7t(t){var e=ont(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&ant(n.ownerDocument.documentElement,n)){if(r!==null&&Lke(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var s=n.textContent.length,i=Math.min(r.start,s);r=r.end===void 0?i:Math.min(r.end,s),!t.extend&&i>r&&(s=r,r=i,i=s),s=ZMe(n,i);var o=ZMe(n,r);s&&o&&(t.rangeCount!==1||t.anchorNode!==s.node||t.anchorOffset!==s.offset||t.focusNode!==o.node||t.focusOffset!==o.offset)&&(e=e.createRange(),e.setStart(s.node,s.offset),t.removeAllRanges(),i>r?(t.addRange(e),t.extend(o.node,o.offset)):(e.setEnd(o.node,o.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n<e.length;n++)t=e[n],t.element.scrollLeft=t.left,t.element.scrollTop=t.top}}var u7t=Dx&&"documentMode"in document&&11>=document.documentMode,W_=null,jme=null,fD=null,Eme=!1;function JMe(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Eme||W_==null||W_!==Gq(r)||(r=W_,"selectionStart"in r&&Lke(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),fD&&nO(fD,r)||(fD=r,r=Jq(jme,"onSelect"),0<r.length&&(e=new Rke("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=W_)))}function Z9(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var q_={animationend:Z9("Animation","AnimationEnd"),animationiteration:Z9("Animation","AnimationIteration"),animationstart:Z9("Animation","AnimationStart"),transitionend:Z9("Transition","TransitionEnd")},qae={},lnt={};Dx&&(lnt=document.createElement("div").style,"AnimationEvent"in window||(delete q_.animationend.animation,delete q_.animationiteration.animation,delete q_.animationstart.animation),"TransitionEvent"in window||delete q_.transitionend.transition);function WX(t){if(qae[t])return qae[t];if(!q_[t])return t;var e=q_[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in lnt)return qae[t]=e[n];return t}var cnt=WX("animationend"),dnt=WX("animationiteration"),unt=WX("animationstart"),hnt=WX("transitionend"),mnt=new Map,XMe="abort auxClick cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");function Jk(t,e){mnt.set(t,e),xE(e,[t])}for(var Kae=0;Kae<XMe.length;Kae++){var Yae=XMe[Kae],h7t=Yae.toLowerCase(),m7t=Yae[0].toUpperCase()+Yae.slice(1);Jk(h7t,"on"+m7t)}Jk(cnt,"onAnimationEnd");Jk(dnt,"onAnimationIteration");Jk(unt,"onAnimationStart");Jk("dblclick","onDoubleClick");Jk("focusin","onFocus");Jk("focusout","onBlur");Jk(hnt,"onTransitionEnd");RP("onMouseEnter",["mouseout","mouseover"]);RP("onMouseLeave",["mouseout","mouseover"]);RP("onPointerEnter",["pointerout","pointerover"]);RP("onPointerLeave",["pointerout","pointerover"]);xE("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));xE("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));xE("onBeforeInput",["compositionend","keypress","textInput","paste"]);xE("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));xE("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));xE("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var h4="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),f7t=new Set("cancel close invalid load scroll toggle".split(" ").concat(h4));function eLe(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,h8t(r,e,void 0,t),t.currentTarget=null}function fnt(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],s=r.event;r=r.listeners;e:{var i=void 0;if(e)for(var o=r.length-1;0<=o;o--){var l=r[o],c=l.instance,d=l.currentTarget;if(l=l.listener,c!==i&&s.isPropagationStopped())break e;eLe(s,l,d),i=c}else for(o=0;o<r.length;o++){if(l=r[o],c=l.instance,d=l.currentTarget,l=l.listener,c!==i&&s.isPropagationStopped())break e;eLe(s,l,d),i=c}}}if(qq)throw t=wme,qq=!1,wme=null,t}function Ga(t,e){var n=e[Pme];n===void 0&&(n=e[Pme]=new Set);var r=t+"__bubble";n.has(r)||(pnt(e,t,2,!1),n.add(r))}function Qae(t,e,n){var r=0;e&&(r|=4),pnt(n,t,r,e)}var J9="_reactListening"+Math.random().toString(36).slice(2);function rO(t){if(!t[J9]){t[J9]=!0,ktt.forEach(function(n){n!=="selectionchange"&&(f7t.has(n)||Qae(n,!1,t),Qae(n,!0,t))});var e=t.nodeType===9?t:t.ownerDocument;e===null||e[J9]||(e[J9]=!0,Qae("selectionchange",!1,e))}}function pnt(t,e,n,r){switch(Jtt(e)){case 1:var s=T8t;break;case 4:s=_8t;break;default:s=Ake}n=s.bind(null,e,n,t),s=void 0,!xme||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(s=!0),r?s!==void 0?t.addEventListener(e,n,{capture:!0,passive:s}):t.addEventListener(e,n,!0):s!==void 0?t.addEventListener(e,n,{passive:s}):t.addEventListener(e,n,!1)}function Zae(t,e,n,r,s){var i=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var o=r.tag;if(o===3||o===4){var l=r.stateNode.containerInfo;if(l===s||l.nodeType===8&&l.parentNode===s)break;if(o===4)for(o=r.return;o!==null;){var c=o.tag;if((c===3||c===4)&&(c=o.stateNode.containerInfo,c===s||c.nodeType===8&&c.parentNode===s))return;o=o.return}for(;l!==null;){if(o=pj(l),o===null)return;if(c=o.tag,c===5||c===6){r=i=o;continue e}l=l.parentNode}}r=r.return}Ott(function(){var d=i,u=Eke(n),h=[];e:{var m=mnt.get(t);if(m!==void 0){var f=Rke,p=t;switch(t){case"keypress":if(tG(n)===0)break e;case"keydown":case"keyup":f=H8t;break;case"focusin":p="focus",f=Hae;break;case"focusout":p="blur",f=Hae;break;case"beforeblur":case"afterblur":f=Hae;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":f=zMe;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":f=R8t;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":f=q8t;break;case cnt:case dnt:case unt:f=L8t;break;case hnt:f=Y8t;break;case"scroll":f=A8t;break;case"wheel":f=Z8t;break;case"copy":case"cut":case"paste":f=$8t;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":f=HMe}var g=(e&4)!==0,v=!g&&t==="scroll",b=g?m!==null?m+"Capture":null:m;g=[];for(var x=d,w;x!==null;){w=x;var k=w.stateNode;if(w.tag===5&&k!==null&&(w=k,b!==null&&(k=Z$(x,b),k!=null&&g.push(sO(x,k,w)))),v)break;x=x.return}0<g.length&&(m=new f(m,p,null,n,u),h.push({event:m,listeners:g}))}}if(!(e&7)){e:{if(m=t==="mouseover"||t==="pointerover",f=t==="mouseout"||t==="pointerout",m&&n!==yme&&(p=n.relatedTarget||n.fromElement)&&(pj(p)||p[$x]))break e;if((f||m)&&(m=u.window===u?u:(m=u.ownerDocument)?m.defaultView||m.parentWindow:window,f?(p=n.relatedTarget||n.toElement,f=d,p=p?pj(p):null,p!==null&&(v=wE(p),p!==v||p.tag!==5&&p.tag!==6)&&(p=null)):(f=null,p=d),f!==p)){if(g=zMe,k="onMouseLeave",b="onMouseEnter",x="mouse",(t==="pointerout"||t==="pointerover")&&(g=HMe,k="onPointerLeave",b="onPointerEnter",x="pointer"),v=f==null?m:K_(f),w=p==null?m:K_(p),m=new g(k,x+"leave",f,n,u),m.target=v,m.relatedTarget=w,k=null,pj(u)===d&&(g=new g(b,x+"enter",p,n,u),g.target=w,g.relatedTarget=v,k=g),v=k,f&&p)t:{for(g=f,b=p,x=0,w=g;w;w=zN(w))x++;for(w=0,k=b;k;k=zN(k))w++;for(;0<x-w;)g=zN(g),x--;for(;0<w-x;)b=zN(b),w--;for(;x--;){if(g===b||b!==null&&g===b.alternate)break t;g=zN(g),b=zN(b)}g=null}else g=null;f!==null&&tLe(h,m,f,g,!1),p!==null&&v!==null&&tLe(h,v,p,g,!0)}}e:{if(m=d?K_(d):window,f=m.nodeName&&m.nodeName.toLowerCase(),f==="select"||f==="input"&&m.type==="file")var S=s7t;else if(qMe(m))if(snt)S=l7t;else{S=a7t;var C=i7t}else(f=m.nodeName)&&f.toLowerCase()==="input"&&(m.type==="checkbox"||m.type==="radio")&&(S=o7t);if(S&&(S=S(t,d))){rnt(h,S,n,u);break e}C&&C(t,m,d),t==="focusout"&&(C=m._wrapperState)&&C.controlled&&m.type==="number"&&mme(m,"number",m.value)}switch(C=d?K_(d):window,t){case"focusin":(qMe(C)||C.contentEditable==="true")&&(W_=C,jme=d,fD=null);break;case"focusout":fD=jme=W_=null;break;case"mousedown":Eme=!0;break;case"contextmenu":case"mouseup":case"dragend":Eme=!1,JMe(h,n,u);break;case"selectionchange":if(u7t)break;case"keydown":case"keyup":JMe(h,n,u)}var j;if(Mke)e:{switch(t){case"compositionstart":var E="onCompositionStart";break e;case"compositionend":E="onCompositionEnd";break e;case"compositionupdate":E="onCompositionUpdate";break e}E=void 0}else G_?tnt(t,n)&&(E="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(E="onCompositionStart");E&&(ent&&n.locale!=="ko"&&(G_||E!=="onCompositionStart"?E==="onCompositionEnd"&&G_&&(j=Xtt()):(C1=u,Pke="value"in C1?C1.value:C1.textContent,G_=!0)),C=Jq(d,E),0<C.length&&(E=new VMe(E,t,null,n,u),h.push({event:E,listeners:C}),j?E.data=j:(j=nnt(n),j!==null&&(E.data=j)))),(j=X8t?e7t(t,n):t7t(t,n))&&(d=Jq(d,"onBeforeInput"),0<d.length&&(u=new VMe("onBeforeInput","beforeinput",null,n,u),h.push({event:u,listeners:d}),u.data=j))}fnt(h,e)})}function sO(t,e,n){return{instance:t,listener:e,currentTarget:n}}function Jq(t,e){for(var n=e+"Capture",r=[];t!==null;){var s=t,i=s.stateNode;s.tag===5&&i!==null&&(s=i,i=Z$(t,n),i!=null&&r.unshift(sO(t,i,s)),i=Z$(t,e),i!=null&&r.push(sO(t,i,s))),t=t.return}return r}function zN(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function tLe(t,e,n,r,s){for(var i=e._reactName,o=[];n!==null&&n!==r;){var l=n,c=l.alternate,d=l.stateNode;if(c!==null&&c===r)break;l.tag===5&&d!==null&&(l=d,s?(c=Z$(n,i),c!=null&&o.unshift(sO(n,c,l))):s||(c=Z$(n,i),c!=null&&o.push(sO(n,c,l)))),n=n.return}o.length!==0&&t.push({event:e,listeners:o})}var p7t=/\r\n?/g,g7t=/\u0000|\uFFFD/g;function nLe(t){return(typeof t=="string"?t:""+t).replace(p7t,`
`).replace(g7t,"")}function X9(t,e,n){if(e=nLe(e),nLe(t)!==e&&n)throw Error(cn(425))}function Xq(){}var Nme=null,Tme=null;function _me(t,e){return t==="textarea"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var Ame=typeof setTimeout=="function"?setTimeout:void 0,v7t=typeof clearTimeout=="function"?clearTimeout:void 0,rLe=typeof Promise=="function"?Promise:void 0,y7t=typeof queueMicrotask=="function"?queueMicrotask:typeof rLe<"u"?function(t){return rLe.resolve(null).then(t).catch(b7t)}:Ame;function b7t(t){setTimeout(function(){throw t})}function Jae(t,e){var n=e,r=0;do{var s=n.nextSibling;if(t.removeChild(n),s&&s.nodeType===8)if(n=s.data,n==="/$"){if(r===0){t.removeChild(s),eO(e);return}r--}else n!=="$"&&n!=="$?"&&n!=="$!"||r++;n=s}while(n);eO(e)}function H1(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break;if(e===8){if(e=t.data,e==="$"||e==="$!"||e==="$?")break;if(e==="/$")return null}}return t}function sLe(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var tI=Math.random().toString(36).slice(2),Hv="__reactFiber$"+tI,iO="__reactProps$"+tI,$x="__reactContainer$"+tI,Pme="__reactEvents$"+tI,x7t="__reactListeners$"+tI,w7t="__reactHandles$"+tI;function pj(t){var e=t[Hv];if(e)return e;for(var n=t.parentNode;n;){if(e=n[$x]||n[Hv]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=sLe(t);t!==null;){if(n=t[Hv])return n;t=sLe(t)}return e}t=n,n=t.parentNode}return null}function A8(t){return t=t[Hv]||t[$x],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function K_(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(cn(33))}function qX(t){return t[iO]||null}var Rme=[],Y_=-1;function Xk(t){return{current:t}}function to(t){0>Y_||(t.current=Rme[Y_],Rme[Y_]=null,Y_--)}function Ma(t,e){Y_++,Rme[Y_]=t.current,t.current=e}var gk={},Yd=Xk(gk),gh=Xk(!1),f2=gk;function IP(t,e){var n=t.type.contextTypes;if(!n)return gk;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var s={},i;for(i in n)s[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=s),s}function vh(t){return t=t.childContextTypes,t!=null}function eK(){to(gh),to(Yd)}function iLe(t,e,n){if(Yd.current!==gk)throw Error(cn(168));Ma(Yd,e),Ma(gh,n)}function gnt(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var s in r)if(!(s in e))throw Error(cn(108,i8t(t)||"Unknown",s));return Bo({},n,r)}function tK(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||gk,f2=Yd.current,Ma(Yd,t),Ma(gh,gh.current),!0}function aLe(t,e,n){var r=t.stateNode;if(!r)throw Error(cn(169));n?(t=gnt(t,e,f2),r.__reactInternalMemoizedMergedChildContext=t,to(gh),to(Yd),Ma(Yd,t)):to(gh),Ma(gh,n)}var Fb=null,KX=!1,Xae=!1;function vnt(t){Fb===null?Fb=[t]:Fb.push(t)}function k7t(t){KX=!0,vnt(t)}function eS(){if(!Xae&&Fb!==null){Xae=!0;var t=0,e=zi;try{var n=Fb;for(zi=1;t<n.length;t++){var r=n[t];do r=r(!0);while(r!==null)}Fb=null,KX=!1}catch(s){throw Fb!==null&&(Fb=Fb.slice(t+1)),ztt(Nke,eS),s}finally{zi=e,Xae=!1}}return null}var Q_=[],Z_=0,nK=null,rK=0,mf=[],ff=0,p2=null,ix=1,ax="";function vC(t,e){Q_[Z_++]=rK,Q_[Z_++]=nK,nK=t,rK=e}function ynt(t,e,n){mf[ff++]=ix,mf[ff++]=ax,mf[ff++]=p2,p2=t;var r=ix;t=ax;var s=32-xg(r)-1;r&=~(1<<s),n+=1;var i=32-xg(e)+s;if(30<i){var o=s-s%5;i=(r&(1<<o)-1).toString(32),r>>=o,s-=o,ix=1<<32-xg(e)+s|n<<s|r,ax=i+t}else ix=1<<i|n<<s|r,ax=t}function Dke(t){t.return!==null&&(vC(t,1),ynt(t,1,0))}function $ke(t){for(;t===nK;)nK=Q_[--Z_],Q_[Z_]=null,rK=Q_[--Z_],Q_[Z_]=null;for(;t===p2;)p2=mf[--ff],mf[ff]=null,ax=mf[--ff],mf[ff]=null,ix=mf[--ff],mf[ff]=null}var vm=null,hm=null,go=!1,Xp=null;function bnt(t,e){var n=wf(5,null,null,0);n.elementType="DELETED",n.stateNode=e,n.return=t,e=t.deletions,e===null?(t.deletions=[n],t.flags|=16):e.push(n)}function oLe(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,vm=t,hm=H1(e.firstChild),!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,vm=t,hm=null,!0):!1;case 13:return e=e.nodeType!==8?null:e,e!==null?(n=p2!==null?{id:ix,overflow:ax}:null,t.memoizedState={dehydrated:e,treeContext:n,retryLane:1073741824},n=wf(18,null,null,0),n.stateNode=e,n.return=t,t.child=n,vm=t,hm=null,!0):!1;default:return!1}}function Ime(t){return(t.mode&1)!==0&&(t.flags&128)===0}function Mme(t){if(go){var e=hm;if(e){var n=e;if(!oLe(t,e)){if(Ime(t))throw Error(cn(418));e=H1(n.nextSibling);var r=vm;e&&oLe(t,e)?bnt(r,n):(t.flags=t.flags&-4097|2,go=!1,vm=t)}}else{if(Ime(t))throw Error(cn(418));t.flags=t.flags&-4097|2,go=!1,vm=t}}}function lLe(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;vm=t}function eU(t){if(t!==vm)return!1;if(!go)return lLe(t),go=!0,!1;var e;if((e=t.tag!==3)&&!(e=t.tag!==5)&&(e=t.type,e=e!=="head"&&e!=="body"&&!_me(t.type,t.memoizedProps)),e&&(e=hm)){if(Ime(t))throw xnt(),Error(cn(418));for(;e;)bnt(t,e),e=H1(e.nextSibling)}if(lLe(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(cn(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){hm=H1(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}hm=null}}else hm=vm?H1(t.stateNode.nextSibling):null;return!0}function xnt(){for(var t=hm;t;)t=H1(t.nextSibling)}function MP(){hm=vm=null,go=!1}function Oke(t){Xp===null?Xp=[t]:Xp.push(t)}var S7t=x0.ReactCurrentBatchConfig;function pL(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(cn(309));var r=n.stateNode}if(!r)throw Error(cn(147,t));var s=r,i=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===i?e.ref:(e=function(o){var l=s.refs;o===null?delete l[i]:l[i]=o},e._stringRef=i,e)}if(typeof t!="string")throw Error(cn(284));if(!n._owner)throw Error(cn(290,t))}return t}function tU(t,e){throw t=Object.prototype.toString.call(e),Error(cn(31,t==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":t))}function cLe(t){var e=t._init;return e(t._payload)}function wnt(t){function e(b,x){if(t){var w=b.deletions;w===null?(b.deletions=[x],b.flags|=16):w.push(x)}}function n(b,x){if(!t)return null;for(;x!==null;)e(b,x),x=x.sibling;return null}function r(b,x){for(b=new Map;x!==null;)x.key!==null?b.set(x.key,x):b.set(x.index,x),x=x.sibling;return b}function s(b,x){return b=K1(b,x),b.index=0,b.sibling=null,b}function i(b,x,w){return b.index=w,t?(w=b.alternate,w!==null?(w=w.index,w<x?(b.flags|=2,x):w):(b.flags|=2,x)):(b.flags|=1048576,x)}function o(b){return t&&b.alternate===null&&(b.flags|=2),b}function l(b,x,w,k){return x===null||x.tag!==6?(x=aoe(w,b.mode,k),x.return=b,x):(x=s(x,w),x.return=b,x)}function c(b,x,w,k){var S=w.type;return S===H_?u(b,x,w.props.children,k,w.key):x!==null&&(x.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===zw&&cLe(S)===x.type)?(k=s(x,w.props),k.ref=pL(b,x,w),k.return=b,k):(k=lG(w.type,w.key,w.props,null,b.mode,k),k.ref=pL(b,x,w),k.return=b,k)}function d(b,x,w,k){return x===null||x.tag!==4||x.stateNode.containerInfo!==w.containerInfo||x.stateNode.implementation!==w.implementation?(x=ooe(w,b.mode,k),x.return=b,x):(x=s(x,w.children||[]),x.return=b,x)}function u(b,x,w,k,S){return x===null||x.tag!==7?(x=Gj(w,b.mode,k,S),x.return=b,x):(x=s(x,w),x.return=b,x)}function h(b,x,w){if(typeof x=="string"&&x!==""||typeof x=="number")return x=aoe(""+x,b.mode,w),x.return=b,x;if(typeof x=="object"&&x!==null){switch(x.$$typeof){case H9:return w=lG(x.type,x.key,x.props,null,b.mode,w),w.ref=pL(b,null,x),w.return=b,w;case V_:return x=ooe(x,b.mode,w),x.return=b,x;case zw:var k=x._init;return h(b,k(x._payload),w)}if(d4(x)||dL(x))return x=Gj(x,b.mode,w,null),x.return=b,x;tU(b,x)}return null}function m(b,x,w,k){var S=x!==null?x.key:null;if(typeof w=="string"&&w!==""||typeof w=="number")return S!==null?null:l(b,x,""+w,k);if(typeof w=="object"&&w!==null){switch(w.$$typeof){case H9:return w.key===S?c(b,x,w,k):null;case V_:return w.key===S?d(b,x,w,k):null;case zw:return S=w._init,m(b,x,S(w._payload),k)}if(d4(w)||dL(w))return S!==null?null:u(b,x,w,k,null);tU(b,w)}return null}function f(b,x,w,k,S){if(typeof k=="string"&&k!==""||typeof k=="number")return b=b.get(w)||null,l(x,b,""+k,S);if(typeof k=="object"&&k!==null){switch(k.$$typeof){case H9:return b=b.get(k.key===null?w:k.key)||null,c(x,b,k,S);case V_:return b=b.get(k.key===null?w:k.key)||null,d(x,b,k,S);case zw:var C=k._init;return f(b,x,w,C(k._payload),S)}if(d4(k)||dL(k))return b=b.get(w)||null,u(x,b,k,S,null);tU(x,k)}return null}function p(b,x,w,k){for(var S=null,C=null,j=x,E=x=0,N=null;j!==null&&E<w.length;E++){j.index>E?(N=j,j=null):N=j.sibling;var A=m(b,j,w[E],k);if(A===null){j===null&&(j=N);break}t&&j&&A.alternate===null&&e(b,j),x=i(A,x,E),C===null?S=A:C.sibling=A,C=A,j=N}if(E===w.length)return n(b,j),go&&vC(b,E),S;if(j===null){for(;E<w.length;E++)j=h(b,w[E],k),j!==null&&(x=i(j,x,E),C===null?S=j:C.sibling=j,C=j);return go&&vC(b,E),S}for(j=r(b,j);E<w.length;E++)N=f(j,b,E,w[E],k),N!==null&&(t&&N.alternate!==null&&j.delete(N.key===null?E:N.key),x=i(N,x,E),C===null?S=N:C.sibling=N,C=N);return t&&j.forEach(function(_){return e(b,_)}),go&&vC(b,E),S}function g(b,x,w,k){var S=dL(w);if(typeof S!="function")throw Error(cn(150));if(w=S.call(w),w==null)throw Error(cn(151));for(var C=S=null,j=x,E=x=0,N=null,A=w.next();j!==null&&!A.done;E++,A=w.next()){j.index>E?(N=j,j=null):N=j.sibling;var _=m(b,j,A.value,k);if(_===null){j===null&&(j=N);break}t&&j&&_.alternate===null&&e(b,j),x=i(_,x,E),C===null?S=_:C.sibling=_,C=_,j=N}if(A.done)return n(b,j),go&&vC(b,E),S;if(j===null){for(;!A.done;E++,A=w.next())A=h(b,A.value,k),A!==null&&(x=i(A,x,E),C===null?S=A:C.sibling=A,C=A);return go&&vC(b,E),S}for(j=r(b,j);!A.done;E++,A=w.next())A=f(j,b,E,A.value,k),A!==null&&(t&&A.alternate!==null&&j.delete(A.key===null?E:A.key),x=i(A,x,E),C===null?S=A:C.sibling=A,C=A);return t&&j.forEach(function(T){return e(b,T)}),go&&vC(b,E),S}function v(b,x,w,k){if(typeof w=="object"&&w!==null&&w.type===H_&&w.key===null&&(w=w.props.children),typeof w=="object"&&w!==null){switch(w.$$typeof){case H9:e:{for(var S=w.key,C=x;C!==null;){if(C.key===S){if(S=w.type,S===H_){if(C.tag===7){n(b,C.sibling),x=s(C,w.props.children),x.return=b,b=x;break e}}else if(C.elementType===S||typeof S=="object"&&S!==null&&S.$$typeof===zw&&cLe(S)===C.type){n(b,C.sibling),x=s(C,w.props),x.ref=pL(b,C,w),x.return=b,b=x;break e}n(b,C);break}else e(b,C);C=C.sibling}w.type===H_?(x=Gj(w.props.children,b.mode,k,w.key),x.return=b,b=x):(k=lG(w.type,w.key,w.props,null,b.mode,k),k.ref=pL(b,x,w),k.return=b,b=k)}return o(b);case V_:e:{for(C=w.key;x!==null;){if(x.key===C)if(x.tag===4&&x.stateNode.containerInfo===w.containerInfo&&x.stateNode.implementation===w.implementation){n(b,x.sibling),x=s(x,w.children||[]),x.return=b,b=x;break e}else{n(b,x);break}else e(b,x);x=x.sibling}x=ooe(w,b.mode,k),x.return=b,b=x}return o(b);case zw:return C=w._init,v(b,x,C(w._payload),k)}if(d4(w))return p(b,x,w,k);if(dL(w))return g(b,x,w,k);tU(b,w)}return typeof w=="string"&&w!==""||typeof w=="number"?(w=""+w,x!==null&&x.tag===6?(n(b,x.sibling),x=s(x,w),x.return=b,b=x):(n(b,x),x=aoe(w,b.mode,k),x.return=b,b=x),o(b)):n(b,x)}return v}var LP=wnt(!0),knt=wnt(!1),sK=Xk(null),iK=null,J_=null,Fke=null;function Bke(){Fke=J_=iK=null}function Uke(t){var e=sK.current;to(sK),t._currentValue=e}function Lme(t,e,n){for(;t!==null;){var r=t.alternate;if((t.childLanes&e)!==e?(t.childLanes|=e,r!==null&&(r.childLanes|=e)):r!==null&&(r.childLanes&e)!==e&&(r.childLanes|=e),t===n)break;t=t.return}}function RA(t,e){iK=t,Fke=J_=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(uh=!0),t.firstContext=null)}function $f(t){var e=t._currentValue;if(Fke!==t)if(t={context:t,memoizedValue:e,next:null},J_===null){if(iK===null)throw Error(cn(308));J_=t,iK.dependencies={lanes:0,firstContext:t}}else J_=J_.next=t;return e}var gj=null;function zke(t){gj===null?gj=[t]:gj.push(t)}function Snt(t,e,n,r){var s=e.interleaved;return s===null?(n.next=n,zke(e)):(n.next=s.next,s.next=n),e.interleaved=n,Ox(t,r)}function Ox(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}var Vw=!1;function Vke(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,interleaved:null,lanes:0},effects:null}}function Cnt(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function yx(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function G1(t,e,n){var r=t.updateQueue;if(r===null)return null;if(r=r.shared,ui&2){var s=r.pending;return s===null?e.next=e:(e.next=s.next,s.next=e),r.pending=e,Ox(t,n)}return s=r.interleaved,s===null?(e.next=e,zke(r)):(e.next=s.next,s.next=e),r.interleaved=e,Ox(t,n)}function nG(t,e,n){if(e=e.updateQueue,e!==null&&(e=e.shared,(n&4194240)!==0)){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Tke(t,n)}}function dLe(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var s=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var o={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?s=i=o:i=i.next=o,n=n.next}while(n!==null);i===null?s=i=e:i=i.next=e}else s=i=e;n={baseState:r.baseState,firstBaseUpdate:s,lastBaseUpdate:i,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function aK(t,e,n,r){var s=t.updateQueue;Vw=!1;var i=s.firstBaseUpdate,o=s.lastBaseUpdate,l=s.shared.pending;if(l!==null){s.shared.pending=null;var c=l,d=c.next;c.next=null,o===null?i=d:o.next=d,o=c;var u=t.alternate;u!==null&&(u=u.updateQueue,l=u.lastBaseUpdate,l!==o&&(l===null?u.firstBaseUpdate=d:l.next=d,u.lastBaseUpdate=c))}if(i!==null){var h=s.baseState;o=0,u=d=c=null,l=i;do{var m=l.lane,f=l.eventTime;if((r&m)===m){u!==null&&(u=u.next={eventTime:f,lane:0,tag:l.tag,payload:l.payload,callback:l.callback,next:null});e:{var p=t,g=l;switch(m=e,f=n,g.tag){case 1:if(p=g.payload,typeof p=="function"){h=p.call(f,h,m);break e}h=p;break e;case 3:p.flags=p.flags&-65537|128;case 0:if(p=g.payload,m=typeof p=="function"?p.call(f,h,m):p,m==null)break e;h=Bo({},h,m);break e;case 2:Vw=!0}}l.callback!==null&&l.lane!==0&&(t.flags|=64,m=s.effects,m===null?s.effects=[l]:m.push(l))}else f={eventTime:f,lane:m,tag:l.tag,payload:l.payload,callback:l.callback,next:null},u===null?(d=u=f,c=h):u=u.next=f,o|=m;if(l=l.next,l===null){if(l=s.shared.pending,l===null)break;m=l,l=m.next,m.next=null,s.lastBaseUpdate=m,s.shared.pending=null}}while(!0);if(u===null&&(c=h),s.baseState=c,s.firstBaseUpdate=d,s.lastBaseUpdate=u,e=s.shared.interleaved,e!==null){s=e;do o|=s.lane,s=s.next;while(s!==e)}else i===null&&(s.shared.lanes=0);v2|=o,t.lanes=o,t.memoizedState=h}}function uLe(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],s=r.callback;if(s!==null){if(r.callback=null,r=n,typeof s!="function")throw Error(cn(191,s));s.call(r)}}}var P8={},dy=Xk(P8),aO=Xk(P8),oO=Xk(P8);function vj(t){if(t===P8)throw Error(cn(174));return t}function Hke(t,e){switch(Ma(oO,e),Ma(aO,t),Ma(dy,P8),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:pme(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=pme(e,t)}to(dy),Ma(dy,e)}function DP(){to(dy),to(aO),to(oO)}function jnt(t){vj(oO.current);var e=vj(dy.current),n=pme(e,t.type);e!==n&&(Ma(aO,t),Ma(dy,n))}function Gke(t){aO.current===t&&(to(dy),to(aO))}var Ro=Xk(0);function oK(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var eoe=[];function Wke(){for(var t=0;t<eoe.length;t++)eoe[t]._workInProgressVersionPrimary=null;eoe.length=0}var rG=x0.ReactCurrentDispatcher,toe=x0.ReactCurrentBatchConfig,g2=0,Fo=null,uc=null,Mc=null,lK=!1,pD=!1,lO=0,C7t=0;function _d(){throw Error(cn(321))}function qke(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!_g(t[n],e[n]))return!1;return!0}function Kke(t,e,n,r,s,i){if(g2=i,Fo=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,rG.current=t===null||t.memoizedState===null?T7t:_7t,t=n(r,s),pD){i=0;do{if(pD=!1,lO=0,25<=i)throw Error(cn(301));i+=1,Mc=uc=null,e.updateQueue=null,rG.current=A7t,t=n(r,s)}while(pD)}if(rG.current=cK,e=uc!==null&&uc.next!==null,g2=0,Mc=uc=Fo=null,lK=!1,e)throw Error(cn(300));return t}function Yke(){var t=lO!==0;return lO=0,t}function Tv(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Mc===null?Fo.memoizedState=Mc=t:Mc=Mc.next=t,Mc}function Of(){if(uc===null){var t=Fo.alternate;t=t!==null?t.memoizedState:null}else t=uc.next;var e=Mc===null?Fo.memoizedState:Mc.next;if(e!==null)Mc=e,uc=t;else{if(t===null)throw Error(cn(310));uc=t,t={memoizedState:uc.memoizedState,baseState:uc.baseState,baseQueue:uc.baseQueue,queue:uc.queue,next:null},Mc===null?Fo.memoizedState=Mc=t:Mc=Mc.next=t}return Mc}function cO(t,e){return typeof e=="function"?e(t):e}function noe(t){var e=Of(),n=e.queue;if(n===null)throw Error(cn(311));n.lastRenderedReducer=t;var r=uc,s=r.baseQueue,i=n.pending;if(i!==null){if(s!==null){var o=s.next;s.next=i.next,i.next=o}r.baseQueue=s=i,n.pending=null}if(s!==null){i=s.next,r=r.baseState;var l=o=null,c=null,d=i;do{var u=d.lane;if((g2&u)===u)c!==null&&(c=c.next={lane:0,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null}),r=d.hasEagerState?d.eagerState:t(r,d.action);else{var h={lane:u,action:d.action,hasEagerState:d.hasEagerState,eagerState:d.eagerState,next:null};c===null?(l=c=h,o=r):c=c.next=h,Fo.lanes|=u,v2|=u}d=d.next}while(d!==null&&d!==i);c===null?o=r:c.next=l,_g(r,e.memoizedState)||(uh=!0),e.memoizedState=r,e.baseState=o,e.baseQueue=c,n.lastRenderedState=r}if(t=n.interleaved,t!==null){s=t;do i=s.lane,Fo.lanes|=i,v2|=i,s=s.next;while(s!==t)}else s===null&&(n.lanes=0);return[e.memoizedState,n.dispatch]}function roe(t){var e=Of(),n=e.queue;if(n===null)throw Error(cn(311));n.lastRenderedReducer=t;var r=n.dispatch,s=n.pending,i=e.memoizedState;if(s!==null){n.pending=null;var o=s=s.next;do i=t(i,o.action),o=o.next;while(o!==s);_g(i,e.memoizedState)||(uh=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,r]}function Ent(){}function Nnt(t,e){var n=Fo,r=Of(),s=e(),i=!_g(r.memoizedState,s);if(i&&(r.memoizedState=s,uh=!0),r=r.queue,Qke(Ant.bind(null,n,r,t),[t]),r.getSnapshot!==e||i||Mc!==null&&Mc.memoizedState.tag&1){if(n.flags|=2048,dO(9,_nt.bind(null,n,r,s,e),void 0,null),$c===null)throw Error(cn(349));g2&30||Tnt(n,e,s)}return s}function Tnt(t,e,n){t.flags|=16384,t={getSnapshot:e,value:n},e=Fo.updateQueue,e===null?(e={lastEffect:null,stores:null},Fo.updateQueue=e,e.stores=[t]):(n=e.stores,n===null?e.stores=[t]:n.push(t))}function _nt(t,e,n,r){e.value=n,e.getSnapshot=r,Pnt(e)&&Rnt(t)}function Ant(t,e,n){return n(function(){Pnt(e)&&Rnt(t)})}function Pnt(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!_g(t,n)}catch{return!0}}function Rnt(t){var e=Ox(t,1);e!==null&&wg(e,t,1,-1)}function hLe(t){var e=Tv();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:cO,lastRenderedState:t},e.queue=t,t=t.dispatch=N7t.bind(null,Fo,t),[e.memoizedState,t]}function dO(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=Fo.updateQueue,e===null?(e={lastEffect:null,stores:null},Fo.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function Int(){return Of().memoizedState}function sG(t,e,n,r){var s=Tv();Fo.flags|=t,s.memoizedState=dO(1|e,n,void 0,r===void 0?null:r)}function YX(t,e,n,r){var s=Of();r=r===void 0?null:r;var i=void 0;if(uc!==null){var o=uc.memoizedState;if(i=o.destroy,r!==null&&qke(r,o.deps)){s.memoizedState=dO(e,n,i,r);return}}Fo.flags|=t,s.memoizedState=dO(1|e,n,i,r)}function mLe(t,e){return sG(8390656,8,t,e)}function Qke(t,e){return YX(2048,8,t,e)}function Mnt(t,e){return YX(4,2,t,e)}function Lnt(t,e){return YX(4,4,t,e)}function Dnt(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function $nt(t,e,n){return n=n!=null?n.concat([t]):null,YX(4,4,Dnt.bind(null,e,t),n)}function Zke(){}function Ont(t,e){var n=Of();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&qke(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function Fnt(t,e){var n=Of();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&qke(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function Bnt(t,e,n){return g2&21?(_g(n,e)||(n=Gtt(),Fo.lanes|=n,v2|=n,t.baseState=!0),e):(t.baseState&&(t.baseState=!1,uh=!0),t.memoizedState=n)}function j7t(t,e){var n=zi;zi=n!==0&&4>n?n:4,t(!0);var r=toe.transition;toe.transition={};try{t(!1),e()}finally{zi=n,toe.transition=r}}function Unt(){return Of().memoizedState}function E7t(t,e,n){var r=q1(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},znt(t))Vnt(e,n);else if(n=Snt(t,e,n,r),n!==null){var s=Ru();wg(n,t,r,s),Hnt(n,e,r)}}function N7t(t,e,n){var r=q1(t),s={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(znt(t))Vnt(e,s);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var o=e.lastRenderedState,l=i(o,n);if(s.hasEagerState=!0,s.eagerState=l,_g(l,o)){var c=e.interleaved;c===null?(s.next=s,zke(e)):(s.next=c.next,c.next=s),e.interleaved=s;return}}catch{}finally{}n=Snt(t,e,s,r),n!==null&&(s=Ru(),wg(n,t,r,s),Hnt(n,e,r))}}function znt(t){var e=t.alternate;return t===Fo||e!==null&&e===Fo}function Vnt(t,e){pD=lK=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function Hnt(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Tke(t,n)}}var cK={readContext:$f,useCallback:_d,useContext:_d,useEffect:_d,useImperativeHandle:_d,useInsertionEffect:_d,useLayoutEffect:_d,useMemo:_d,useReducer:_d,useRef:_d,useState:_d,useDebugValue:_d,useDeferredValue:_d,useTransition:_d,useMutableSource:_d,useSyncExternalStore:_d,useId:_d,unstable_isNewReconciler:!1},T7t={readContext:$f,useCallback:function(t,e){return Tv().memoizedState=[t,e===void 0?null:e],t},useContext:$f,useEffect:mLe,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,sG(4194308,4,Dnt.bind(null,e,t),n)},useLayoutEffect:function(t,e){return sG(4194308,4,t,e)},useInsertionEffect:function(t,e){return sG(4,2,t,e)},useMemo:function(t,e){var n=Tv();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Tv();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=E7t.bind(null,Fo,t),[r.memoizedState,t]},useRef:function(t){var e=Tv();return t={current:t},e.memoizedState=t},useState:hLe,useDebugValue:Zke,useDeferredValue:function(t){return Tv().memoizedState=t},useTransition:function(){var t=hLe(!1),e=t[0];return t=j7t.bind(null,t[1]),Tv().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=Fo,s=Tv();if(go){if(n===void 0)throw Error(cn(407));n=n()}else{if(n=e(),$c===null)throw Error(cn(349));g2&30||Tnt(r,e,n)}s.memoizedState=n;var i={value:n,getSnapshot:e};return s.queue=i,mLe(Ant.bind(null,r,i,t),[t]),r.flags|=2048,dO(9,_nt.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=Tv(),e=$c.identifierPrefix;if(go){var n=ax,r=ix;n=(r&~(1<<32-xg(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=lO++,0<n&&(e+="H"+n.toString(32)),e+=":"}else n=C7t++,e=":"+e+"r"+n.toString(32)+":";return t.memoizedState=e},unstable_isNewReconciler:!1},_7t={readContext:$f,useCallback:Ont,useContext:$f,useEffect:Qke,useImperativeHandle:$nt,useInsertionEffect:Mnt,useLayoutEffect:Lnt,useMemo:Fnt,useReducer:noe,useRef:Int,useState:function(){return noe(cO)},useDebugValue:Zke,useDeferredValue:function(t){var e=Of();return Bnt(e,uc.memoizedState,t)},useTransition:function(){var t=noe(cO)[0],e=Of().memoizedState;return[t,e]},useMutableSource:Ent,useSyncExternalStore:Nnt,useId:Unt,unstable_isNewReconciler:!1},A7t={readContext:$f,useCallback:Ont,useContext:$f,useEffect:Qke,useImperativeHandle:$nt,useInsertionEffect:Mnt,useLayoutEffect:Lnt,useMemo:Fnt,useReducer:roe,useRef:Int,useState:function(){return roe(cO)},useDebugValue:Zke,useDeferredValue:function(t){var e=Of();return uc===null?e.memoizedState=t:Bnt(e,uc.memoizedState,t)},useTransition:function(){var t=roe(cO)[0],e=Of().memoizedState;return[t,e]},useMutableSource:Ent,useSyncExternalStore:Nnt,useId:Unt,unstable_isNewReconciler:!1};function zp(t,e){if(t&&t.defaultProps){e=Bo({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}function Dme(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:Bo({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var QX={isMounted:function(t){return(t=t._reactInternals)?wE(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=Ru(),s=q1(t),i=yx(r,s);i.payload=e,n!=null&&(i.callback=n),e=G1(t,i,s),e!==null&&(wg(e,t,s,r),nG(e,t,s))},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=Ru(),s=q1(t),i=yx(r,s);i.tag=1,i.payload=e,n!=null&&(i.callback=n),e=G1(t,i,s),e!==null&&(wg(e,t,s,r),nG(e,t,s))},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=Ru(),r=q1(t),s=yx(n,r);s.tag=2,e!=null&&(s.callback=e),e=G1(t,s,r),e!==null&&(wg(e,t,r,n),nG(e,t,r))}};function fLe(t,e,n,r,s,i,o){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,i,o):e.prototype&&e.prototype.isPureReactComponent?!nO(n,r)||!nO(s,i):!0}function Gnt(t,e,n){var r=!1,s=gk,i=e.contextType;return typeof i=="object"&&i!==null?i=$f(i):(s=vh(e)?f2:Yd.current,r=e.contextTypes,i=(r=r!=null)?IP(t,s):gk),e=new e(n,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=QX,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=s,t.__reactInternalMemoizedMaskedChildContext=i),e}function pLe(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&QX.enqueueReplaceState(e,e.state,null)}function $me(t,e,n,r){var s=t.stateNode;s.props=n,s.state=t.memoizedState,s.refs={},Vke(t);var i=e.contextType;typeof i=="object"&&i!==null?s.context=$f(i):(i=vh(e)?f2:Yd.current,s.context=IP(t,i)),s.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(Dme(t,e,i,n),s.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof s.getSnapshotBeforeUpdate=="function"||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(e=s.state,typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount(),e!==s.state&&QX.enqueueReplaceState(s,s.state,null),aK(t,n,s,r),s.state=t.memoizedState),typeof s.componentDidMount=="function"&&(t.flags|=4194308)}function $P(t,e){try{var n="",r=e;do n+=s8t(r),r=r.return;while(r);var s=n}catch(i){s=`
Error generating stack: `+i.message+`
`+i.stack}return{value:t,source:e,stack:s,digest:null}}function soe(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function Ome(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var P7t=typeof WeakMap=="function"?WeakMap:Map;function Wnt(t,e,n){n=yx(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){uK||(uK=!0,Kme=r),Ome(t,e)},n}function qnt(t,e,n){n=yx(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var s=e.value;n.payload=function(){return r(s)},n.callback=function(){Ome(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){Ome(t,e),typeof r!="function"&&(W1===null?W1=new Set([this]):W1.add(this));var o=e.stack;this.componentDidCatch(e.value,{componentStack:o!==null?o:""})}),n}function gLe(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new P7t;var s=new Set;r.set(e,s)}else s=r.get(e),s===void 0&&(s=new Set,r.set(e,s));s.has(n)||(s.add(n),t=G7t.bind(null,t,e,n),e.then(t,t))}function vLe(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function yLe(t,e,n,r,s){return t.mode&1?(t.flags|=65536,t.lanes=s,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=yx(-1,1),e.tag=2,G1(n,e,1))),n.lanes|=1),t)}var R7t=x0.ReactCurrentOwner,uh=!1;function pu(t,e,n,r){e.child=t===null?knt(e,null,n,r):LP(e,t.child,n,r)}function bLe(t,e,n,r,s){n=n.render;var i=e.ref;return RA(e,s),r=Kke(t,e,n,r,i,s),n=Yke(),t!==null&&!uh?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,Fx(t,e,s)):(go&&n&&Dke(e),e.flags|=1,pu(t,e,r,s),e.child)}function xLe(t,e,n,r,s){if(t===null){var i=n.type;return typeof i=="function"&&!iSe(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=i,Knt(t,e,i,r,s)):(t=lG(n.type,null,r,e,e.mode,s),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&s)){var o=i.memoizedProps;if(n=n.compare,n=n!==null?n:nO,n(o,r)&&t.ref===e.ref)return Fx(t,e,s)}return e.flags|=1,t=K1(i,r),t.ref=e.ref,t.return=e,e.child=t}function Knt(t,e,n,r,s){if(t!==null){var i=t.memoizedProps;if(nO(i,r)&&t.ref===e.ref)if(uh=!1,e.pendingProps=r=i,(t.lanes&s)!==0)t.flags&131072&&(uh=!0);else return e.lanes=t.lanes,Fx(t,e,s)}return Fme(t,e,n,r,s)}function Ynt(t,e,n){var r=e.pendingProps,s=r.children,i=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Ma(eA,tm),tm|=n;else{if(!(n&1073741824))return t=i!==null?i.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Ma(eA,tm),tm|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Ma(eA,tm),tm|=r}else i!==null?(r=i.baseLanes|n,e.memoizedState=null):r=n,Ma(eA,tm),tm|=r;return pu(t,e,s,n),e.child}function Qnt(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function Fme(t,e,n,r,s){var i=vh(n)?f2:Yd.current;return i=IP(e,i),RA(e,s),n=Kke(t,e,n,r,i,s),r=Yke(),t!==null&&!uh?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~s,Fx(t,e,s)):(go&&r&&Dke(e),e.flags|=1,pu(t,e,n,s),e.child)}function wLe(t,e,n,r,s){if(vh(n)){var i=!0;tK(e)}else i=!1;if(RA(e,s),e.stateNode===null)iG(t,e),Gnt(e,n,r),$me(e,n,r,s),r=!0;else if(t===null){var o=e.stateNode,l=e.memoizedProps;o.props=l;var c=o.context,d=n.contextType;typeof d=="object"&&d!==null?d=$f(d):(d=vh(n)?f2:Yd.current,d=IP(e,d));var u=n.getDerivedStateFromProps,h=typeof u=="function"||typeof o.getSnapshotBeforeUpdate=="function";h||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==r||c!==d)&&pLe(e,o,r,d),Vw=!1;var m=e.memoizedState;o.state=m,aK(e,r,o,s),c=e.memoizedState,l!==r||m!==c||gh.current||Vw?(typeof u=="function"&&(Dme(e,n,u,r),c=e.memoizedState),(l=Vw||fLe(e,n,l,r,m,c,d))?(h||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount()),typeof o.componentDidMount=="function"&&(e.flags|=4194308)):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=c),o.props=r,o.state=c,o.context=d,r=l):(typeof o.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{o=e.stateNode,Cnt(t,e),l=e.memoizedProps,d=e.type===e.elementType?l:zp(e.type,l),o.props=d,h=e.pendingProps,m=o.context,c=n.contextType,typeof c=="object"&&c!==null?c=$f(c):(c=vh(n)?f2:Yd.current,c=IP(e,c));var f=n.getDerivedStateFromProps;(u=typeof f=="function"||typeof o.getSnapshotBeforeUpdate=="function")||typeof o.UNSAFE_componentWillReceiveProps!="function"&&typeof o.componentWillReceiveProps!="function"||(l!==h||m!==c)&&pLe(e,o,r,c),Vw=!1,m=e.memoizedState,o.state=m,aK(e,r,o,s);var p=e.memoizedState;l!==h||m!==p||gh.current||Vw?(typeof f=="function"&&(Dme(e,n,f,r),p=e.memoizedState),(d=Vw||fLe(e,n,d,r,m,p,c)||!1)?(u||typeof o.UNSAFE_componentWillUpdate!="function"&&typeof o.componentWillUpdate!="function"||(typeof o.componentWillUpdate=="function"&&o.componentWillUpdate(r,p,c),typeof o.UNSAFE_componentWillUpdate=="function"&&o.UNSAFE_componentWillUpdate(r,p,c)),typeof o.componentDidUpdate=="function"&&(e.flags|=4),typeof o.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&m===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&m===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=p),o.props=r,o.state=p,o.context=c,r=d):(typeof o.componentDidUpdate!="function"||l===t.memoizedProps&&m===t.memoizedState||(e.flags|=4),typeof o.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&m===t.memoizedState||(e.flags|=1024),r=!1)}return Bme(t,e,n,r,i,s)}function Bme(t,e,n,r,s,i){Qnt(t,e);var o=(e.flags&128)!==0;if(!r&&!o)return s&&aLe(e,n,!1),Fx(t,e,i);r=e.stateNode,R7t.current=e;var l=o&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&o?(e.child=LP(e,t.child,null,i),e.child=LP(e,null,l,i)):pu(t,e,l,i),e.memoizedState=r.state,s&&aLe(e,n,!0),e.child}function Znt(t){var e=t.stateNode;e.pendingContext?iLe(t,e.pendingContext,e.pendingContext!==e.context):e.context&&iLe(t,e.context,!1),Hke(t,e.containerInfo)}function kLe(t,e,n,r,s){return MP(),Oke(s),e.flags|=256,pu(t,e,n,r),e.child}var Ume={dehydrated:null,treeContext:null,retryLane:0};function zme(t){return{baseLanes:t,cachePool:null,transitions:null}}function Jnt(t,e,n){var r=e.pendingProps,s=Ro.current,i=!1,o=(e.flags&128)!==0,l;if((l=o)||(l=t!==null&&t.memoizedState===null?!1:(s&2)!==0),l?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(s|=1),Ma(Ro,s&1),t===null)return Mme(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(o=r.children,t=r.fallback,i?(r=e.mode,i=e.child,o={mode:"hidden",children:o},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=o):i=XX(o,r,0,null),t=Gj(t,r,n,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=zme(n),e.memoizedState=Ume,t):Jke(e,o));if(s=t.memoizedState,s!==null&&(l=s.dehydrated,l!==null))return I7t(t,e,o,r,l,s,n);if(i){i=r.fallback,o=e.mode,s=t.child,l=s.sibling;var c={mode:"hidden",children:r.children};return!(o&1)&&e.child!==s?(r=e.child,r.childLanes=0,r.pendingProps=c,e.deletions=null):(r=K1(s,c),r.subtreeFlags=s.subtreeFlags&14680064),l!==null?i=K1(l,i):(i=Gj(i,o,n,null),i.flags|=2),i.return=e,r.return=e,r.sibling=i,e.child=r,r=i,i=e.child,o=t.child.memoizedState,o=o===null?zme(n):{baseLanes:o.baseLanes|n,cachePool:null,transitions:o.transitions},i.memoizedState=o,i.childLanes=t.childLanes&~n,e.memoizedState=Ume,r}return i=t.child,t=i.sibling,r=K1(i,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function Jke(t,e){return e=XX({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function nU(t,e,n,r){return r!==null&&Oke(r),LP(e,t.child,null,n),t=Jke(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function I7t(t,e,n,r,s,i,o){if(n)return e.flags&256?(e.flags&=-257,r=soe(Error(cn(422))),nU(t,e,o,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=r.fallback,s=e.mode,r=XX({mode:"visible",children:r.children},s,0,null),i=Gj(i,s,o,null),i.flags|=2,r.return=e,i.return=e,r.sibling=i,e.child=r,e.mode&1&&LP(e,t.child,null,o),e.child.memoizedState=zme(o),e.memoizedState=Ume,i);if(!(e.mode&1))return nU(t,e,o,null);if(s.data==="$!"){if(r=s.nextSibling&&s.nextSibling.dataset,r)var l=r.dgst;return r=l,i=Error(cn(419)),r=soe(i,r,void 0),nU(t,e,o,r)}if(l=(o&t.childLanes)!==0,uh||l){if(r=$c,r!==null){switch(o&-o){case 4:s=2;break;case 16:s=8;break;case 64:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:s=32;break;case 536870912:s=268435456;break;default:s=0}s=s&(r.suspendedLanes|o)?0:s,s!==0&&s!==i.retryLane&&(i.retryLane=s,Ox(t,s),wg(r,t,s,-1))}return sSe(),r=soe(Error(cn(421))),nU(t,e,o,r)}return s.data==="$?"?(e.flags|=128,e.child=t.child,e=W7t.bind(null,t),s._reactRetry=e,null):(t=i.treeContext,hm=H1(s.nextSibling),vm=e,go=!0,Xp=null,t!==null&&(mf[ff++]=ix,mf[ff++]=ax,mf[ff++]=p2,ix=t.id,ax=t.overflow,p2=e),e=Jke(e,r.children),e.flags|=4096,e)}function SLe(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),Lme(t.return,e,n)}function ioe(t,e,n,r,s){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:s}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=s)}function Xnt(t,e,n){var r=e.pendingProps,s=r.revealOrder,i=r.tail;if(pu(t,e,r.children,n),r=Ro.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&SLe(t,n,e);else if(t.tag===19)SLe(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(Ma(Ro,r),!(e.mode&1))e.memoizedState=null;else switch(s){case"forwards":for(n=e.child,s=null;n!==null;)t=n.alternate,t!==null&&oK(t)===null&&(s=n),n=n.sibling;n=s,n===null?(s=e.child,e.child=null):(s=n.sibling,n.sibling=null),ioe(e,!1,s,n,i);break;case"backwards":for(n=null,s=e.child,e.child=null;s!==null;){if(t=s.alternate,t!==null&&oK(t)===null){e.child=s;break}t=s.sibling,s.sibling=n,n=s,s=t}ioe(e,!0,n,null,i);break;case"together":ioe(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function iG(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Fx(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),v2|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error(cn(153));if(e.child!==null){for(t=e.child,n=K1(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=K1(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function M7t(t,e,n){switch(e.tag){case 3:Znt(e),MP();break;case 5:jnt(e);break;case 1:vh(e.type)&&tK(e);break;case 4:Hke(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,s=e.memoizedProps.value;Ma(sK,r._currentValue),r._currentValue=s;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(Ma(Ro,Ro.current&1),e.flags|=128,null):n&e.child.childLanes?Jnt(t,e,n):(Ma(Ro,Ro.current&1),t=Fx(t,e,n),t!==null?t.sibling:null);Ma(Ro,Ro.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return Xnt(t,e,n);e.flags|=128}if(s=e.memoizedState,s!==null&&(s.rendering=null,s.tail=null,s.lastEffect=null),Ma(Ro,Ro.current),r)break;return null;case 22:case 23:return e.lanes=0,Ynt(t,e,n)}return Fx(t,e,n)}var ert,Vme,trt,nrt;ert=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};Vme=function(){};trt=function(t,e,n,r){var s=t.memoizedProps;if(s!==r){t=e.stateNode,vj(dy.current);var i=null;switch(n){case"input":s=ume(t,s),r=ume(t,r),i=[];break;case"select":s=Bo({},s,{value:void 0}),r=Bo({},r,{value:void 0}),i=[];break;case"textarea":s=fme(t,s),r=fme(t,r),i=[];break;default:typeof s.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=Xq)}gme(n,r);var o;n=null;for(d in s)if(!r.hasOwnProperty(d)&&s.hasOwnProperty(d)&&s[d]!=null)if(d==="style"){var l=s[d];for(o in l)l.hasOwnProperty(o)&&(n||(n={}),n[o]="")}else d!=="dangerouslySetInnerHTML"&&d!=="children"&&d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&d!=="autoFocus"&&(Y$.hasOwnProperty(d)?i||(i=[]):(i=i||[]).push(d,null));for(d in r){var c=r[d];if(l=s!=null?s[d]:void 0,r.hasOwnProperty(d)&&c!==l&&(c!=null||l!=null))if(d==="style")if(l){for(o in l)!l.hasOwnProperty(o)||c&&c.hasOwnProperty(o)||(n||(n={}),n[o]="");for(o in c)c.hasOwnProperty(o)&&l[o]!==c[o]&&(n||(n={}),n[o]=c[o])}else n||(i||(i=[]),i.push(d,n)),n=c;else d==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,l=l?l.__html:void 0,c!=null&&l!==c&&(i=i||[]).push(d,c)):d==="children"?typeof c!="string"&&typeof c!="number"||(i=i||[]).push(d,""+c):d!=="suppressContentEditableWarning"&&d!=="suppressHydrationWarning"&&(Y$.hasOwnProperty(d)?(c!=null&&d==="onScroll"&&Ga("scroll",t),i||l===c||(i=[])):(i=i||[]).push(d,c))}n&&(i=i||[]).push("style",n);var d=i;(e.updateQueue=d)&&(e.flags|=4)}};nrt=function(t,e,n,r){n!==r&&(e.flags|=4)};function gL(t,e){if(!go)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function Ad(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var s=t.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags&14680064,r|=s.flags&14680064,s.return=t,s=s.sibling;else for(s=t.child;s!==null;)n|=s.lanes|s.childLanes,r|=s.subtreeFlags,r|=s.flags,s.return=t,s=s.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function L7t(t,e,n){var r=e.pendingProps;switch($ke(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Ad(e),null;case 1:return vh(e.type)&&eK(),Ad(e),null;case 3:return r=e.stateNode,DP(),to(gh),to(Yd),Wke(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(eU(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Xp!==null&&(Zme(Xp),Xp=null))),Vme(t,e),Ad(e),null;case 5:Gke(e);var s=vj(oO.current);if(n=e.type,t!==null&&e.stateNode!=null)trt(t,e,n,r,s),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error(cn(166));return Ad(e),null}if(t=vj(dy.current),eU(e)){r=e.stateNode,n=e.type;var i=e.memoizedProps;switch(r[Hv]=e,r[iO]=i,t=(e.mode&1)!==0,n){case"dialog":Ga("cancel",r),Ga("close",r);break;case"iframe":case"object":case"embed":Ga("load",r);break;case"video":case"audio":for(s=0;s<h4.length;s++)Ga(h4[s],r);break;case"source":Ga("error",r);break;case"img":case"image":case"link":Ga("error",r),Ga("load",r);break;case"details":Ga("toggle",r);break;case"input":RMe(r,i),Ga("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},Ga("invalid",r);break;case"textarea":MMe(r,i),Ga("invalid",r)}gme(n,i),s=null;for(var o in i)if(i.hasOwnProperty(o)){var l=i[o];o==="children"?typeof l=="string"?r.textContent!==l&&(i.suppressHydrationWarning!==!0&&X9(r.textContent,l,t),s=["children",l]):typeof l=="number"&&r.textContent!==""+l&&(i.suppressHydrationWarning!==!0&&X9(r.textContent,l,t),s=["children",""+l]):Y$.hasOwnProperty(o)&&l!=null&&o==="onScroll"&&Ga("scroll",r)}switch(n){case"input":G9(r),IMe(r,i,!0);break;case"textarea":G9(r),LMe(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Xq)}r=s,e.updateQueue=r,r!==null&&(e.flags|=4)}else{o=s.nodeType===9?s:s.ownerDocument,t==="http://www.w3.org/1999/xhtml"&&(t=Att(n)),t==="http://www.w3.org/1999/xhtml"?n==="script"?(t=o.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=o.createElement(n,{is:r.is}):(t=o.createElement(n),n==="select"&&(o=t,r.multiple?o.multiple=!0:r.size&&(o.size=r.size))):t=o.createElementNS(t,n),t[Hv]=e,t[iO]=r,ert(t,e,!1,!1),e.stateNode=t;e:{switch(o=vme(n,r),n){case"dialog":Ga("cancel",t),Ga("close",t),s=r;break;case"iframe":case"object":case"embed":Ga("load",t),s=r;break;case"video":case"audio":for(s=0;s<h4.length;s++)Ga(h4[s],t);s=r;break;case"source":Ga("error",t),s=r;break;case"img":case"image":case"link":Ga("error",t),Ga("load",t),s=r;break;case"details":Ga("toggle",t),s=r;break;case"input":RMe(t,r),s=ume(t,r),Ga("invalid",t);break;case"option":s=r;break;case"select":t._wrapperState={wasMultiple:!!r.multiple},s=Bo({},r,{value:void 0}),Ga("invalid",t);break;case"textarea":MMe(t,r),s=fme(t,r),Ga("invalid",t);break;default:s=r}gme(n,s),l=s;for(i in l)if(l.hasOwnProperty(i)){var c=l[i];i==="style"?Itt(t,c):i==="dangerouslySetInnerHTML"?(c=c?c.__html:void 0,c!=null&&Ptt(t,c)):i==="children"?typeof c=="string"?(n!=="textarea"||c!=="")&&Q$(t,c):typeof c=="number"&&Q$(t,""+c):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Y$.hasOwnProperty(i)?c!=null&&i==="onScroll"&&Ga("scroll",t):c!=null&&kke(t,i,c,o))}switch(n){case"input":G9(t),IMe(t,r,!1);break;case"textarea":G9(t),LMe(t);break;case"option":r.value!=null&&t.setAttribute("value",""+pk(r.value));break;case"select":t.multiple=!!r.multiple,i=r.value,i!=null?TA(t,!!r.multiple,i,!1):r.defaultValue!=null&&TA(t,!!r.multiple,r.defaultValue,!0);break;default:typeof s.onClick=="function"&&(t.onclick=Xq)}switch(n){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}}r&&(e.flags|=4)}e.ref!==null&&(e.flags|=512,e.flags|=2097152)}return Ad(e),null;case 6:if(t&&e.stateNode!=null)nrt(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(cn(166));if(n=vj(oO.current),vj(dy.current),eU(e)){if(r=e.stateNode,n=e.memoizedProps,r[Hv]=e,(i=r.nodeValue!==n)&&(t=vm,t!==null))switch(t.tag){case 3:X9(r.nodeValue,n,(t.mode&1)!==0);break;case 5:t.memoizedProps.suppressHydrationWarning!==!0&&X9(r.nodeValue,n,(t.mode&1)!==0)}i&&(e.flags|=4)}else r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Hv]=e,e.stateNode=r}return Ad(e),null;case 13:if(to(Ro),r=e.memoizedState,t===null||t.memoizedState!==null&&t.memoizedState.dehydrated!==null){if(go&&hm!==null&&e.mode&1&&!(e.flags&128))xnt(),MP(),e.flags|=98560,i=!1;else if(i=eU(e),r!==null&&r.dehydrated!==null){if(t===null){if(!i)throw Error(cn(318));if(i=e.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(cn(317));i[Hv]=e}else MP(),!(e.flags&128)&&(e.memoizedState=null),e.flags|=4;Ad(e),i=!1}else Xp!==null&&(Zme(Xp),Xp=null),i=!0;if(!i)return e.flags&65536?e:null}return e.flags&128?(e.lanes=n,e):(r=r!==null,r!==(t!==null&&t.memoizedState!==null)&&r&&(e.child.flags|=8192,e.mode&1&&(t===null||Ro.current&1?pc===0&&(pc=3):sSe())),e.updateQueue!==null&&(e.flags|=4),Ad(e),null);case 4:return DP(),Vme(t,e),t===null&&rO(e.stateNode.containerInfo),Ad(e),null;case 10:return Uke(e.type._context),Ad(e),null;case 17:return vh(e.type)&&eK(),Ad(e),null;case 19:if(to(Ro),i=e.memoizedState,i===null)return Ad(e),null;if(r=(e.flags&128)!==0,o=i.rendering,o===null)if(r)gL(i,!1);else{if(pc!==0||t!==null&&t.flags&128)for(t=e.child;t!==null;){if(o=oK(t),o!==null){for(e.flags|=128,gL(i,!1),r=o.updateQueue,r!==null&&(e.updateQueue=r,e.flags|=4),e.subtreeFlags=0,r=n,n=e.child;n!==null;)i=n,t=r,i.flags&=14680066,o=i.alternate,o===null?(i.childLanes=0,i.lanes=t,i.child=null,i.subtreeFlags=0,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=o.childLanes,i.lanes=o.lanes,i.child=o.child,i.subtreeFlags=0,i.deletions=null,i.memoizedProps=o.memoizedProps,i.memoizedState=o.memoizedState,i.updateQueue=o.updateQueue,i.type=o.type,t=o.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return Ma(Ro,Ro.current&1|2),e.child}t=t.sibling}i.tail!==null&&yl()>OP&&(e.flags|=128,r=!0,gL(i,!1),e.lanes=4194304)}else{if(!r)if(t=oK(o),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),gL(i,!0),i.tail===null&&i.tailMode==="hidden"&&!o.alternate&&!go)return Ad(e),null}else 2*yl()-i.renderingStartTime>OP&&n!==1073741824&&(e.flags|=128,r=!0,gL(i,!1),e.lanes=4194304);i.isBackwards?(o.sibling=e.child,e.child=o):(n=i.last,n!==null?n.sibling=o:e.child=o,i.last=o)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=yl(),e.sibling=null,n=Ro.current,Ma(Ro,r?n&1|2:n&1),e):(Ad(e),null);case 22:case 23:return rSe(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?tm&1073741824&&(Ad(e),e.subtreeFlags&6&&(e.flags|=8192)):Ad(e),null;case 24:return null;case 25:return null}throw Error(cn(156,e.tag))}function D7t(t,e){switch($ke(e),e.tag){case 1:return vh(e.type)&&eK(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return DP(),to(gh),to(Yd),Wke(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Gke(e),null;case 13:if(to(Ro),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error(cn(340));MP()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return to(Ro),null;case 4:return DP(),null;case 10:return Uke(e.type._context),null;case 22:case 23:return rSe(),null;case 24:return null;default:return null}}var rU=!1,zd=!1,$7t=typeof WeakSet=="function"?WeakSet:Set,Xn=null;function X_(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){Qo(t,e,r)}else n.current=null}function Hme(t,e,n){try{n()}catch(r){Qo(t,e,r)}}var CLe=!1;function O7t(t,e){if(Nme=Qq,t=ont(),Lke(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var s=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var o=0,l=-1,c=-1,d=0,u=0,h=t,m=null;t:for(;;){for(var f;h!==n||s!==0&&h.nodeType!==3||(l=o+s),h!==i||r!==0&&h.nodeType!==3||(c=o+r),h.nodeType===3&&(o+=h.nodeValue.length),(f=h.firstChild)!==null;)m=h,h=f;for(;;){if(h===t)break t;if(m===n&&++d===s&&(l=o),m===i&&++u===r&&(c=o),(f=h.nextSibling)!==null)break;h=m,m=h.parentNode}h=f}n=l===-1||c===-1?null:{start:l,end:c}}else n=null}n=n||{start:0,end:0}}else n=null;for(Tme={focusedElem:t,selectionRange:n},Qq=!1,Xn=e;Xn!==null;)if(e=Xn,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,Xn=t;else for(;Xn!==null;){e=Xn;try{var p=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(p!==null){var g=p.memoizedProps,v=p.memoizedState,b=e.stateNode,x=b.getSnapshotBeforeUpdate(e.elementType===e.type?g:zp(e.type,g),v);b.__reactInternalSnapshotBeforeUpdate=x}break;case 3:var w=e.stateNode.containerInfo;w.nodeType===1?w.textContent="":w.nodeType===9&&w.documentElement&&w.removeChild(w.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(cn(163))}}catch(k){Qo(e,e.return,k)}if(t=e.sibling,t!==null){t.return=e.return,Xn=t;break}Xn=e.return}return p=CLe,CLe=!1,p}function gD(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var s=r=r.next;do{if((s.tag&t)===t){var i=s.destroy;s.destroy=void 0,i!==void 0&&Hme(e,n,i)}s=s.next}while(s!==r)}}function ZX(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Gme(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function rrt(t){var e=t.alternate;e!==null&&(t.alternate=null,rrt(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[Hv],delete e[iO],delete e[Pme],delete e[x7t],delete e[w7t])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function srt(t){return t.tag===5||t.tag===3||t.tag===4}function jLe(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||srt(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Wme(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Xq));else if(r!==4&&(t=t.child,t!==null))for(Wme(t,e,n),t=t.sibling;t!==null;)Wme(t,e,n),t=t.sibling}function qme(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(qme(t,e,n),t=t.sibling;t!==null;)qme(t,e,n),t=t.sibling}var sd=null,Wp=!1;function Z0(t,e,n){for(n=n.child;n!==null;)irt(t,e,n),n=n.sibling}function irt(t,e,n){if(cy&&typeof cy.onCommitFiberUnmount=="function")try{cy.onCommitFiberUnmount(VX,n)}catch{}switch(n.tag){case 5:zd||X_(n,e);case 6:var r=sd,s=Wp;sd=null,Z0(t,e,n),sd=r,Wp=s,sd!==null&&(Wp?(t=sd,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):sd.removeChild(n.stateNode));break;case 18:sd!==null&&(Wp?(t=sd,n=n.stateNode,t.nodeType===8?Jae(t.parentNode,n):t.nodeType===1&&Jae(t,n),eO(t)):Jae(sd,n.stateNode));break;case 4:r=sd,s=Wp,sd=n.stateNode.containerInfo,Wp=!0,Z0(t,e,n),sd=r,Wp=s;break;case 0:case 11:case 14:case 15:if(!zd&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){s=r=r.next;do{var i=s,o=i.destroy;i=i.tag,o!==void 0&&(i&2||i&4)&&Hme(n,e,o),s=s.next}while(s!==r)}Z0(t,e,n);break;case 1:if(!zd&&(X_(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(l){Qo(n,e,l)}Z0(t,e,n);break;case 21:Z0(t,e,n);break;case 22:n.mode&1?(zd=(r=zd)||n.memoizedState!==null,Z0(t,e,n),zd=r):Z0(t,e,n);break;default:Z0(t,e,n)}}function ELe(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new $7t),e.forEach(function(r){var s=q7t.bind(null,t,r);n.has(r)||(n.add(r),r.then(s,s))})}}function dp(t,e){var n=e.deletions;if(n!==null)for(var r=0;r<n.length;r++){var s=n[r];try{var i=t,o=e,l=o;e:for(;l!==null;){switch(l.tag){case 5:sd=l.stateNode,Wp=!1;break e;case 3:sd=l.stateNode.containerInfo,Wp=!0;break e;case 4:sd=l.stateNode.containerInfo,Wp=!0;break e}l=l.return}if(sd===null)throw Error(cn(160));irt(i,o,s),sd=null,Wp=!1;var c=s.alternate;c!==null&&(c.return=null),s.return=null}catch(d){Qo(s,e,d)}}if(e.subtreeFlags&12854)for(e=e.child;e!==null;)art(e,t),e=e.sibling}function art(t,e){var n=t.alternate,r=t.flags;switch(t.tag){case 0:case 11:case 14:case 15:if(dp(e,t),lv(t),r&4){try{gD(3,t,t.return),ZX(3,t)}catch(g){Qo(t,t.return,g)}try{gD(5,t,t.return)}catch(g){Qo(t,t.return,g)}}break;case 1:dp(e,t),lv(t),r&512&&n!==null&&X_(n,n.return);break;case 5:if(dp(e,t),lv(t),r&512&&n!==null&&X_(n,n.return),t.flags&32){var s=t.stateNode;try{Q$(s,"")}catch(g){Qo(t,t.return,g)}}if(r&4&&(s=t.stateNode,s!=null)){var i=t.memoizedProps,o=n!==null?n.memoizedProps:i,l=t.type,c=t.updateQueue;if(t.updateQueue=null,c!==null)try{l==="input"&&i.type==="radio"&&i.name!=null&&Ttt(s,i),vme(l,o);var d=vme(l,i);for(o=0;o<c.length;o+=2){var u=c[o],h=c[o+1];u==="style"?Itt(s,h):u==="dangerouslySetInnerHTML"?Ptt(s,h):u==="children"?Q$(s,h):kke(s,u,h,d)}switch(l){case"input":hme(s,i);break;case"textarea":_tt(s,i);break;case"select":var m=s._wrapperState.wasMultiple;s._wrapperState.wasMultiple=!!i.multiple;var f=i.value;f!=null?TA(s,!!i.multiple,f,!1):m!==!!i.multiple&&(i.defaultValue!=null?TA(s,!!i.multiple,i.defaultValue,!0):TA(s,!!i.multiple,i.multiple?[]:"",!1))}s[iO]=i}catch(g){Qo(t,t.return,g)}}break;case 6:if(dp(e,t),lv(t),r&4){if(t.stateNode===null)throw Error(cn(162));s=t.stateNode,i=t.memoizedProps;try{s.nodeValue=i}catch(g){Qo(t,t.return,g)}}break;case 3:if(dp(e,t),lv(t),r&4&&n!==null&&n.memoizedState.isDehydrated)try{eO(e.containerInfo)}catch(g){Qo(t,t.return,g)}break;case 4:dp(e,t),lv(t);break;case 13:dp(e,t),lv(t),s=t.child,s.flags&8192&&(i=s.memoizedState!==null,s.stateNode.isHidden=i,!i||s.alternate!==null&&s.alternate.memoizedState!==null||(tSe=yl())),r&4&&ELe(t);break;case 22:if(u=n!==null&&n.memoizedState!==null,t.mode&1?(zd=(d=zd)||u,dp(e,t),zd=d):dp(e,t),lv(t),r&8192){if(d=t.memoizedState!==null,(t.stateNode.isHidden=d)&&!u&&t.mode&1)for(Xn=t,u=t.child;u!==null;){for(h=Xn=u;Xn!==null;){switch(m=Xn,f=m.child,m.tag){case 0:case 11:case 14:case 15:gD(4,m,m.return);break;case 1:X_(m,m.return);var p=m.stateNode;if(typeof p.componentWillUnmount=="function"){r=m,n=m.return;try{e=r,p.props=e.memoizedProps,p.state=e.memoizedState,p.componentWillUnmount()}catch(g){Qo(r,n,g)}}break;case 5:X_(m,m.return);break;case 22:if(m.memoizedState!==null){TLe(h);continue}}f!==null?(f.return=m,Xn=f):TLe(h)}u=u.sibling}e:for(u=null,h=t;;){if(h.tag===5){if(u===null){u=h;try{s=h.stateNode,d?(i=s.style,typeof i.setProperty=="function"?i.setProperty("display","none","important"):i.display="none"):(l=h.stateNode,c=h.memoizedProps.style,o=c!=null&&c.hasOwnProperty("display")?c.display:null,l.style.display=Rtt("display",o))}catch(g){Qo(t,t.return,g)}}}else if(h.tag===6){if(u===null)try{h.stateNode.nodeValue=d?"":h.memoizedProps}catch(g){Qo(t,t.return,g)}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===t)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===t)break e;for(;h.sibling===null;){if(h.return===null||h.return===t)break e;u===h&&(u=null),h=h.return}u===h&&(u=null),h.sibling.return=h.return,h=h.sibling}}break;case 19:dp(e,t),lv(t),r&4&&ELe(t);break;case 21:break;default:dp(e,t),lv(t)}}function lv(t){var e=t.flags;if(e&2){try{e:{for(var n=t.return;n!==null;){if(srt(n)){var r=n;break e}n=n.return}throw Error(cn(160))}switch(r.tag){case 5:var s=r.stateNode;r.flags&32&&(Q$(s,""),r.flags&=-33);var i=jLe(t);qme(t,i,s);break;case 3:case 4:var o=r.stateNode.containerInfo,l=jLe(t);Wme(t,l,o);break;default:throw Error(cn(161))}}catch(c){Qo(t,t.return,c)}t.flags&=-3}e&4096&&(t.flags&=-4097)}function F7t(t,e,n){Xn=t,ort(t)}function ort(t,e,n){for(var r=(t.mode&1)!==0;Xn!==null;){var s=Xn,i=s.child;if(s.tag===22&&r){var o=s.memoizedState!==null||rU;if(!o){var l=s.alternate,c=l!==null&&l.memoizedState!==null||zd;l=rU;var d=zd;if(rU=o,(zd=c)&&!d)for(Xn=s;Xn!==null;)o=Xn,c=o.child,o.tag===22&&o.memoizedState!==null?_Le(s):c!==null?(c.return=o,Xn=c):_Le(s);for(;i!==null;)Xn=i,ort(i),i=i.sibling;Xn=s,rU=l,zd=d}NLe(t)}else s.subtreeFlags&8772&&i!==null?(i.return=s,Xn=i):NLe(t)}}function NLe(t){for(;Xn!==null;){var e=Xn;if(e.flags&8772){var n=e.alternate;try{if(e.flags&8772)switch(e.tag){case 0:case 11:case 15:zd||ZX(5,e);break;case 1:var r=e.stateNode;if(e.flags&4&&!zd)if(n===null)r.componentDidMount();else{var s=e.elementType===e.type?n.memoizedProps:zp(e.type,n.memoizedProps);r.componentDidUpdate(s,n.memoizedState,r.__reactInternalSnapshotBeforeUpdate)}var i=e.updateQueue;i!==null&&uLe(e,i,r);break;case 3:var o=e.updateQueue;if(o!==null){if(n=null,e.child!==null)switch(e.child.tag){case 5:n=e.child.stateNode;break;case 1:n=e.child.stateNode}uLe(e,o,n)}break;case 5:var l=e.stateNode;if(n===null&&e.flags&4){n=l;var c=e.memoizedProps;switch(e.type){case"button":case"input":case"select":case"textarea":c.autoFocus&&n.focus();break;case"img":c.src&&(n.src=c.src)}}break;case 6:break;case 4:break;case 12:break;case 13:if(e.memoizedState===null){var d=e.alternate;if(d!==null){var u=d.memoizedState;if(u!==null){var h=u.dehydrated;h!==null&&eO(h)}}}break;case 19:case 17:case 21:case 22:case 23:case 25:break;default:throw Error(cn(163))}zd||e.flags&512&&Gme(e)}catch(m){Qo(e,e.return,m)}}if(e===t){Xn=null;break}if(n=e.sibling,n!==null){n.return=e.return,Xn=n;break}Xn=e.return}}function TLe(t){for(;Xn!==null;){var e=Xn;if(e===t){Xn=null;break}var n=e.sibling;if(n!==null){n.return=e.return,Xn=n;break}Xn=e.return}}function _Le(t){for(;Xn!==null;){var e=Xn;try{switch(e.tag){case 0:case 11:case 15:var n=e.return;try{ZX(4,e)}catch(c){Qo(e,n,c)}break;case 1:var r=e.stateNode;if(typeof r.componentDidMount=="function"){var s=e.return;try{r.componentDidMount()}catch(c){Qo(e,s,c)}}var i=e.return;try{Gme(e)}catch(c){Qo(e,i,c)}break;case 5:var o=e.return;try{Gme(e)}catch(c){Qo(e,o,c)}}}catch(c){Qo(e,e.return,c)}if(e===t){Xn=null;break}var l=e.sibling;if(l!==null){l.return=e.return,Xn=l;break}Xn=e.return}}var B7t=Math.ceil,dK=x0.ReactCurrentDispatcher,Xke=x0.ReactCurrentOwner,_f=x0.ReactCurrentBatchConfig,ui=0,$c=null,Kl=null,yd=0,tm=0,eA=Xk(0),pc=0,uO=null,v2=0,JX=0,eSe=0,vD=null,ah=null,tSe=0,OP=1/0,Ib=null,uK=!1,Kme=null,W1=null,sU=!1,j1=null,hK=0,yD=0,Yme=null,aG=-1,oG=0;function Ru(){return ui&6?yl():aG!==-1?aG:aG=yl()}function q1(t){return t.mode&1?ui&2&&yd!==0?yd&-yd:S7t.transition!==null?(oG===0&&(oG=Gtt()),oG):(t=zi,t!==0||(t=window.event,t=t===void 0?16:Jtt(t.type)),t):1}function wg(t,e,n,r){if(50<yD)throw yD=0,Yme=null,Error(cn(185));T8(t,n,r),(!(ui&2)||t!==$c)&&(t===$c&&(!(ui&2)&&(JX|=n),pc===4&&r1(t,yd)),yh(t,r),n===1&&ui===0&&!(e.mode&1)&&(OP=yl()+500,KX&&eS()))}function yh(t,e){var n=t.callbackNode;S8t(t,e);var r=Yq(t,t===$c?yd:0);if(r===0)n!==null&&OMe(n),t.callbackNode=null,t.callbackPriority=0;else if(e=r&-r,t.callbackPriority!==e){if(n!=null&&OMe(n),e===1)t.tag===0?k7t(ALe.bind(null,t)):vnt(ALe.bind(null,t)),y7t(function(){!(ui&6)&&eS()}),n=null;else{switch(Wtt(r)){case 1:n=Nke;break;case 4:n=Vtt;break;case 16:n=Kq;break;case 536870912:n=Htt;break;default:n=Kq}n=prt(n,lrt.bind(null,t))}t.callbackPriority=e,t.callbackNode=n}}function lrt(t,e){if(aG=-1,oG=0,ui&6)throw Error(cn(327));var n=t.callbackNode;if(IA()&&t.callbackNode!==n)return null;var r=Yq(t,t===$c?yd:0);if(r===0)return null;if(r&30||r&t.expiredLanes||e)e=mK(t,r);else{e=r;var s=ui;ui|=2;var i=drt();($c!==t||yd!==e)&&(Ib=null,OP=yl()+500,Hj(t,e));do try{V7t();break}catch(l){crt(t,l)}while(!0);Bke(),dK.current=i,ui=s,Kl!==null?e=0:($c=null,yd=0,e=pc)}if(e!==0){if(e===2&&(s=kme(t),s!==0&&(r=s,e=Qme(t,s))),e===1)throw n=uO,Hj(t,0),r1(t,r),yh(t,yl()),n;if(e===6)r1(t,r);else{if(s=t.current.alternate,!(r&30)&&!U7t(s)&&(e=mK(t,r),e===2&&(i=kme(t),i!==0&&(r=i,e=Qme(t,i))),e===1))throw n=uO,Hj(t,0),r1(t,r),yh(t,yl()),n;switch(t.finishedWork=s,t.finishedLanes=r,e){case 0:case 1:throw Error(cn(345));case 2:yC(t,ah,Ib);break;case 3:if(r1(t,r),(r&130023424)===r&&(e=tSe+500-yl(),10<e)){if(Yq(t,0)!==0)break;if(s=t.suspendedLanes,(s&r)!==r){Ru(),t.pingedLanes|=t.suspendedLanes&s;break}t.timeoutHandle=Ame(yC.bind(null,t,ah,Ib),e);break}yC(t,ah,Ib);break;case 4:if(r1(t,r),(r&4194240)===r)break;for(e=t.eventTimes,s=-1;0<r;){var o=31-xg(r);i=1<<o,o=e[o],o>s&&(s=o),r&=~i}if(r=s,r=yl()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*B7t(r/1960))-r,10<r){t.timeoutHandle=Ame(yC.bind(null,t,ah,Ib),r);break}yC(t,ah,Ib);break;case 5:yC(t,ah,Ib);break;default:throw Error(cn(329))}}}return yh(t,yl()),t.callbackNode===n?lrt.bind(null,t):null}function Qme(t,e){var n=vD;return t.current.memoizedState.isDehydrated&&(Hj(t,e).flags|=256),t=mK(t,e),t!==2&&(e=ah,ah=n,e!==null&&Zme(e)),t}function Zme(t){ah===null?ah=t:ah.push.apply(ah,t)}function U7t(t){for(var e=t;;){if(e.flags&16384){var n=e.updateQueue;if(n!==null&&(n=n.stores,n!==null))for(var r=0;r<n.length;r++){var s=n[r],i=s.getSnapshot;s=s.value;try{if(!_g(i(),s))return!1}catch{return!1}}}if(n=e.child,e.subtreeFlags&16384&&n!==null)n.return=e,e=n;else{if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return!0;e=e.return}e.sibling.return=e.return,e=e.sibling}}return!0}function r1(t,e){for(e&=~eSe,e&=~JX,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-xg(e),r=1<<n;t[n]=-1,e&=~r}}function ALe(t){if(ui&6)throw Error(cn(327));IA();var e=Yq(t,0);if(!(e&1))return yh(t,yl()),null;var n=mK(t,e);if(t.tag!==0&&n===2){var r=kme(t);r!==0&&(e=r,n=Qme(t,r))}if(n===1)throw n=uO,Hj(t,0),r1(t,e),yh(t,yl()),n;if(n===6)throw Error(cn(345));return t.finishedWork=t.current.alternate,t.finishedLanes=e,yC(t,ah,Ib),yh(t,yl()),null}function nSe(t,e){var n=ui;ui|=1;try{return t(e)}finally{ui=n,ui===0&&(OP=yl()+500,KX&&eS())}}function y2(t){j1!==null&&j1.tag===0&&!(ui&6)&&IA();var e=ui;ui|=1;var n=_f.transition,r=zi;try{if(_f.transition=null,zi=1,t)return t()}finally{zi=r,_f.transition=n,ui=e,!(ui&6)&&eS()}}function rSe(){tm=eA.current,to(eA)}function Hj(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,v7t(n)),Kl!==null)for(n=Kl.return;n!==null;){var r=n;switch($ke(r),r.tag){case 1:r=r.type.childContextTypes,r!=null&&eK();break;case 3:DP(),to(gh),to(Yd),Wke();break;case 5:Gke(r);break;case 4:DP();break;case 13:to(Ro);break;case 19:to(Ro);break;case 10:Uke(r.type._context);break;case 22:case 23:rSe()}n=n.return}if($c=t,Kl=t=K1(t.current,null),yd=tm=e,pc=0,uO=null,eSe=JX=v2=0,ah=vD=null,gj!==null){for(e=0;e<gj.length;e++)if(n=gj[e],r=n.interleaved,r!==null){n.interleaved=null;var s=r.next,i=n.pending;if(i!==null){var o=i.next;i.next=s,r.next=o}n.pending=r}gj=null}return t}function crt(t,e){do{var n=Kl;try{if(Bke(),rG.current=cK,lK){for(var r=Fo.memoizedState;r!==null;){var s=r.queue;s!==null&&(s.pending=null),r=r.next}lK=!1}if(g2=0,Mc=uc=Fo=null,pD=!1,lO=0,Xke.current=null,n===null||n.return===null){pc=1,uO=e,Kl=null;break}e:{var i=t,o=n.return,l=n,c=e;if(e=yd,l.flags|=32768,c!==null&&typeof c=="object"&&typeof c.then=="function"){var d=c,u=l,h=u.tag;if(!(u.mode&1)&&(h===0||h===11||h===15)){var m=u.alternate;m?(u.updateQueue=m.updateQueue,u.memoizedState=m.memoizedState,u.lanes=m.lanes):(u.updateQueue=null,u.memoizedState=null)}var f=vLe(o);if(f!==null){f.flags&=-257,yLe(f,o,l,i,e),f.mode&1&&gLe(i,d,e),e=f,c=d;var p=e.updateQueue;if(p===null){var g=new Set;g.add(c),e.updateQueue=g}else p.add(c);break e}else{if(!(e&1)){gLe(i,d,e),sSe();break e}c=Error(cn(426))}}else if(go&&l.mode&1){var v=vLe(o);if(v!==null){!(v.flags&65536)&&(v.flags|=256),yLe(v,o,l,i,e),Oke($P(c,l));break e}}i=c=$P(c,l),pc!==4&&(pc=2),vD===null?vD=[i]:vD.push(i),i=o;do{switch(i.tag){case 3:i.flags|=65536,e&=-e,i.lanes|=e;var b=Wnt(i,c,e);dLe(i,b);break e;case 1:l=c;var x=i.type,w=i.stateNode;if(!(i.flags&128)&&(typeof x.getDerivedStateFromError=="function"||w!==null&&typeof w.componentDidCatch=="function"&&(W1===null||!W1.has(w)))){i.flags|=65536,e&=-e,i.lanes|=e;var k=qnt(i,l,e);dLe(i,k);break e}}i=i.return}while(i!==null)}hrt(n)}catch(S){e=S,Kl===n&&n!==null&&(Kl=n=n.return);continue}break}while(!0)}function drt(){var t=dK.current;return dK.current=cK,t===null?cK:t}function sSe(){(pc===0||pc===3||pc===2)&&(pc=4),$c===null||!(v2&268435455)&&!(JX&268435455)||r1($c,yd)}function mK(t,e){var n=ui;ui|=2;var r=drt();($c!==t||yd!==e)&&(Ib=null,Hj(t,e));do try{z7t();break}catch(s){crt(t,s)}while(!0);if(Bke(),ui=n,dK.current=r,Kl!==null)throw Error(cn(261));return $c=null,yd=0,pc}function z7t(){for(;Kl!==null;)urt(Kl)}function V7t(){for(;Kl!==null&&!f8t();)urt(Kl)}function urt(t){var e=frt(t.alternate,t,tm);t.memoizedProps=t.pendingProps,e===null?hrt(t):Kl=e,Xke.current=null}function hrt(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&32768){if(n=D7t(n,e),n!==null){n.flags&=32767,Kl=n;return}if(t!==null)t.flags|=32768,t.subtreeFlags=0,t.deletions=null;else{pc=6,Kl=null;return}}else if(n=L7t(n,e,tm),n!==null){Kl=n;return}if(e=e.sibling,e!==null){Kl=e;return}Kl=e=t}while(e!==null);pc===0&&(pc=5)}function yC(t,e,n){var r=zi,s=_f.transition;try{_f.transition=null,zi=1,H7t(t,e,n,r)}finally{_f.transition=s,zi=r}return null}function H7t(t,e,n,r){do IA();while(j1!==null);if(ui&6)throw Error(cn(327));n=t.finishedWork;var s=t.finishedLanes;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(cn(177));t.callbackNode=null,t.callbackPriority=0;var i=n.lanes|n.childLanes;if(C8t(t,i),t===$c&&(Kl=$c=null,yd=0),!(n.subtreeFlags&2064)&&!(n.flags&2064)||sU||(sU=!0,prt(Kq,function(){return IA(),null})),i=(n.flags&15990)!==0,n.subtreeFlags&15990||i){i=_f.transition,_f.transition=null;var o=zi;zi=1;var l=ui;ui|=4,Xke.current=null,O7t(t,n),art(n,t),d7t(Tme),Qq=!!Nme,Tme=Nme=null,t.current=n,F7t(n),p8t(),ui=l,zi=o,_f.transition=i}else t.current=n;if(sU&&(sU=!1,j1=t,hK=s),i=t.pendingLanes,i===0&&(W1=null),y8t(n.stateNode),yh(t,yl()),e!==null)for(r=t.onRecoverableError,n=0;n<e.length;n++)s=e[n],r(s.value,{componentStack:s.stack,digest:s.digest});if(uK)throw uK=!1,t=Kme,Kme=null,t;return hK&1&&t.tag!==0&&IA(),i=t.pendingLanes,i&1?t===Yme?yD++:(yD=0,Yme=t):yD=0,eS(),null}function IA(){if(j1!==null){var t=Wtt(hK),e=_f.transition,n=zi;try{if(_f.transition=null,zi=16>t?16:t,j1===null)var r=!1;else{if(t=j1,j1=null,hK=0,ui&6)throw Error(cn(331));var s=ui;for(ui|=4,Xn=t.current;Xn!==null;){var i=Xn,o=i.child;if(Xn.flags&16){var l=i.deletions;if(l!==null){for(var c=0;c<l.length;c++){var d=l[c];for(Xn=d;Xn!==null;){var u=Xn;switch(u.tag){case 0:case 11:case 15:gD(8,u,i)}var h=u.child;if(h!==null)h.return=u,Xn=h;else for(;Xn!==null;){u=Xn;var m=u.sibling,f=u.return;if(rrt(u),u===d){Xn=null;break}if(m!==null){m.return=f,Xn=m;break}Xn=f}}}var p=i.alternate;if(p!==null){var g=p.child;if(g!==null){p.child=null;do{var v=g.sibling;g.sibling=null,g=v}while(g!==null)}}Xn=i}}if(i.subtreeFlags&2064&&o!==null)o.return=i,Xn=o;else e:for(;Xn!==null;){if(i=Xn,i.flags&2048)switch(i.tag){case 0:case 11:case 15:gD(9,i,i.return)}var b=i.sibling;if(b!==null){b.return=i.return,Xn=b;break e}Xn=i.return}}var x=t.current;for(Xn=x;Xn!==null;){o=Xn;var w=o.child;if(o.subtreeFlags&2064&&w!==null)w.return=o,Xn=w;else e:for(o=x;Xn!==null;){if(l=Xn,l.flags&2048)try{switch(l.tag){case 0:case 11:case 15:ZX(9,l)}}catch(S){Qo(l,l.return,S)}if(l===o){Xn=null;break e}var k=l.sibling;if(k!==null){k.return=l.return,Xn=k;break e}Xn=l.return}}if(ui=s,eS(),cy&&typeof cy.onPostCommitFiberRoot=="function")try{cy.onPostCommitFiberRoot(VX,t)}catch{}r=!0}return r}finally{zi=n,_f.transition=e}}return!1}function PLe(t,e,n){e=$P(n,e),e=Wnt(t,e,1),t=G1(t,e,1),e=Ru(),t!==null&&(T8(t,1,e),yh(t,e))}function Qo(t,e,n){if(t.tag===3)PLe(t,t,n);else for(;e!==null;){if(e.tag===3){PLe(e,t,n);break}else if(e.tag===1){var r=e.stateNode;if(typeof e.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(W1===null||!W1.has(r))){t=$P(n,t),t=qnt(e,t,1),e=G1(e,t,1),t=Ru(),e!==null&&(T8(e,1,t),yh(e,t));break}}e=e.return}}function G7t(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=Ru(),t.pingedLanes|=t.suspendedLanes&n,$c===t&&(yd&n)===n&&(pc===4||pc===3&&(yd&130023424)===yd&&500>yl()-tSe?Hj(t,0):eSe|=n),yh(t,e)}function mrt(t,e){e===0&&(t.mode&1?(e=K9,K9<<=1,!(K9&130023424)&&(K9=4194304)):e=1);var n=Ru();t=Ox(t,e),t!==null&&(T8(t,e,n),yh(t,n))}function W7t(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),mrt(t,n)}function q7t(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,s=t.memoizedState;s!==null&&(n=s.retryLane);break;case 19:r=t.stateNode;break;default:throw Error(cn(314))}r!==null&&r.delete(e),mrt(t,n)}var frt;frt=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||gh.current)uh=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return uh=!1,M7t(t,e,n);uh=!!(t.flags&131072)}else uh=!1,go&&e.flags&1048576&&ynt(e,rK,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;iG(t,e),t=e.pendingProps;var s=IP(e,Yd.current);RA(e,n),s=Kke(null,e,r,t,s,n);var i=Yke();return e.flags|=1,typeof s=="object"&&s!==null&&typeof s.render=="function"&&s.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,vh(r)?(i=!0,tK(e)):i=!1,e.memoizedState=s.state!==null&&s.state!==void 0?s.state:null,Vke(e),s.updater=QX,e.stateNode=s,s._reactInternals=e,$me(e,r,t,n),e=Bme(null,e,r,!0,i,n)):(e.tag=0,go&&i&&Dke(e),pu(null,e,s,n),e=e.child),e;case 16:r=e.elementType;e:{switch(iG(t,e),t=e.pendingProps,s=r._init,r=s(r._payload),e.type=r,s=e.tag=Y7t(r),t=zp(r,t),s){case 0:e=Fme(null,e,r,t,n);break e;case 1:e=wLe(null,e,r,t,n);break e;case 11:e=bLe(null,e,r,t,n);break e;case 14:e=xLe(null,e,r,zp(r.type,t),n);break e}throw Error(cn(306,r,""))}return e;case 0:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:zp(r,s),Fme(t,e,r,s,n);case 1:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:zp(r,s),wLe(t,e,r,s,n);case 3:e:{if(Znt(e),t===null)throw Error(cn(387));r=e.pendingProps,i=e.memoizedState,s=i.element,Cnt(t,e),aK(e,r,null,n);var o=e.memoizedState;if(r=o.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:o.cache,pendingSuspenseBoundaries:o.pendingSuspenseBoundaries,transitions:o.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){s=$P(Error(cn(423)),e),e=kLe(t,e,r,n,s);break e}else if(r!==s){s=$P(Error(cn(424)),e),e=kLe(t,e,r,n,s);break e}else for(hm=H1(e.stateNode.containerInfo.firstChild),vm=e,go=!0,Xp=null,n=knt(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(MP(),r===s){e=Fx(t,e,n);break e}pu(t,e,r,n)}e=e.child}return e;case 5:return jnt(e),t===null&&Mme(e),r=e.type,s=e.pendingProps,i=t!==null?t.memoizedProps:null,o=s.children,_me(r,s)?o=null:i!==null&&_me(r,i)&&(e.flags|=32),Qnt(t,e),pu(t,e,o,n),e.child;case 6:return t===null&&Mme(e),null;case 13:return Jnt(t,e,n);case 4:return Hke(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=LP(e,null,r,n):pu(t,e,r,n),e.child;case 11:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:zp(r,s),bLe(t,e,r,s,n);case 7:return pu(t,e,e.pendingProps,n),e.child;case 8:return pu(t,e,e.pendingProps.children,n),e.child;case 12:return pu(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,s=e.pendingProps,i=e.memoizedProps,o=s.value,Ma(sK,r._currentValue),r._currentValue=o,i!==null)if(_g(i.value,o)){if(i.children===s.children&&!gh.current){e=Fx(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var l=i.dependencies;if(l!==null){o=i.child;for(var c=l.firstContext;c!==null;){if(c.context===r){if(i.tag===1){c=yx(-1,n&-n),c.tag=2;var d=i.updateQueue;if(d!==null){d=d.shared;var u=d.pending;u===null?c.next=c:(c.next=u.next,u.next=c),d.pending=c}}i.lanes|=n,c=i.alternate,c!==null&&(c.lanes|=n),Lme(i.return,n,e),l.lanes|=n;break}c=c.next}}else if(i.tag===10)o=i.type===e.type?null:i.child;else if(i.tag===18){if(o=i.return,o===null)throw Error(cn(341));o.lanes|=n,l=o.alternate,l!==null&&(l.lanes|=n),Lme(o,n,e),o=i.sibling}else o=i.child;if(o!==null)o.return=i;else for(o=i;o!==null;){if(o===e){o=null;break}if(i=o.sibling,i!==null){i.return=o.return,o=i;break}o=o.return}i=o}pu(t,e,s.children,n),e=e.child}return e;case 9:return s=e.type,r=e.pendingProps.children,RA(e,n),s=$f(s),r=r(s),e.flags|=1,pu(t,e,r,n),e.child;case 14:return r=e.type,s=zp(r,e.pendingProps),s=zp(r.type,s),xLe(t,e,r,s,n);case 15:return Knt(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,s=e.pendingProps,s=e.elementType===r?s:zp(r,s),iG(t,e),e.tag=1,vh(r)?(t=!0,tK(e)):t=!1,RA(e,n),Gnt(e,r,s),$me(e,r,s,n),Bme(null,e,r,!0,t,n);case 19:return Xnt(t,e,n);case 22:return Ynt(t,e,n)}throw Error(cn(156,e.tag))};function prt(t,e){return ztt(t,e)}function K7t(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function wf(t,e,n,r){return new K7t(t,e,n,r)}function iSe(t){return t=t.prototype,!(!t||!t.isReactComponent)}function Y7t(t){if(typeof t=="function")return iSe(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Cke)return 11;if(t===jke)return 14}return 2}function K1(t,e){var n=t.alternate;return n===null?(n=wf(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function lG(t,e,n,r,s,i){var o=2;if(r=t,typeof t=="function")iSe(t)&&(o=1);else if(typeof t=="string")o=5;else e:switch(t){case H_:return Gj(n.children,s,i,e);case Ske:o=8,s|=8;break;case ome:return t=wf(12,n,e,s|2),t.elementType=ome,t.lanes=i,t;case lme:return t=wf(13,n,e,s),t.elementType=lme,t.lanes=i,t;case cme:return t=wf(19,n,e,s),t.elementType=cme,t.lanes=i,t;case jtt:return XX(n,s,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Stt:o=10;break e;case Ctt:o=9;break e;case Cke:o=11;break e;case jke:o=14;break e;case zw:o=16,r=null;break e}throw Error(cn(130,t==null?t:typeof t,""))}return e=wf(o,n,e,s),e.elementType=t,e.type=r,e.lanes=i,e}function Gj(t,e,n,r){return t=wf(7,t,r,e),t.lanes=n,t}function XX(t,e,n,r){return t=wf(22,t,r,e),t.elementType=jtt,t.lanes=n,t.stateNode={isHidden:!1},t}function aoe(t,e,n){return t=wf(6,t,null,e),t.lanes=n,t}function ooe(t,e,n){return e=wf(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function Q7t(t,e,n,r,s){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=Uae(0),this.expirationTimes=Uae(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Uae(0),this.identifierPrefix=r,this.onRecoverableError=s,this.mutableSourceEagerHydrationData=null}function aSe(t,e,n,r,s,i,o,l,c){return t=new Q7t(t,e,n,l,c),e===1?(e=1,i===!0&&(e|=8)):e=0,i=wf(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Vke(i),t}function Z7t(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:V_,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function grt(t){if(!t)return gk;t=t._reactInternals;e:{if(wE(t)!==t||t.tag!==1)throw Error(cn(170));var e=t;do{switch(e.tag){case 3:e=e.stateNode.context;break e;case 1:if(vh(e.type)){e=e.stateNode.__reactInternalMemoizedMergedChildContext;break e}}e=e.return}while(e!==null);throw Error(cn(171))}if(t.tag===1){var n=t.type;if(vh(n))return gnt(t,n,e)}return e}function vrt(t,e,n,r,s,i,o,l,c){return t=aSe(n,r,!0,t,s,i,o,l,c),t.context=grt(null),n=t.current,r=Ru(),s=q1(n),i=yx(r,s),i.callback=e??null,G1(n,i,s),t.current.lanes=s,T8(t,s,r),yh(t,r),t}function eee(t,e,n,r){var s=e.current,i=Ru(),o=q1(s);return n=grt(n),e.context===null?e.context=n:e.pendingContext=n,e=yx(i,o),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),t=G1(s,e,o),t!==null&&(wg(t,s,o,i),nG(t,s,o)),o}function fK(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function RLe(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function oSe(t,e){RLe(t,e),(t=t.alternate)&&RLe(t,e)}function J7t(){return null}var yrt=typeof reportError=="function"?reportError:function(t){console.error(t)};function lSe(t){this._internalRoot=t}tee.prototype.render=lSe.prototype.render=function(t){var e=this._internalRoot;if(e===null)throw Error(cn(409));eee(t,e,null,null)};tee.prototype.unmount=lSe.prototype.unmount=function(){var t=this._internalRoot;if(t!==null){this._internalRoot=null;var e=t.containerInfo;y2(function(){eee(null,t,null,null)}),e[$x]=null}};function tee(t){this._internalRoot=t}tee.prototype.unstable_scheduleHydration=function(t){if(t){var e=Ytt();t={blockedOn:null,target:t,priority:e};for(var n=0;n<n1.length&&e!==0&&e<n1[n].priority;n++);n1.splice(n,0,t),n===0&&Ztt(t)}};function cSe(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11)}function nee(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function ILe(){}function X7t(t,e,n,r,s){if(s){if(typeof r=="function"){var i=r;r=function(){var d=fK(o);i.call(d)}}var o=vrt(e,r,t,0,null,!1,!1,"",ILe);return t._reactRootContainer=o,t[$x]=o.current,rO(t.nodeType===8?t.parentNode:t),y2(),o}for(;s=t.lastChild;)t.removeChild(s);if(typeof r=="function"){var l=r;r=function(){var d=fK(c);l.call(d)}}var c=aSe(t,0,!1,null,null,!1,!1,"",ILe);return t._reactRootContainer=c,t[$x]=c.current,rO(t.nodeType===8?t.parentNode:t),y2(function(){eee(e,c,n,r)}),c}function ree(t,e,n,r,s){var i=n._reactRootContainer;if(i){var o=i;if(typeof s=="function"){var l=s;s=function(){var c=fK(o);l.call(c)}}eee(e,o,t,s)}else o=X7t(n,e,t,s,r);return fK(o)}qtt=function(t){switch(t.tag){case 3:var e=t.stateNode;if(e.current.memoizedState.isDehydrated){var n=u4(e.pendingLanes);n!==0&&(Tke(e,n|1),yh(e,yl()),!(ui&6)&&(OP=yl()+500,eS()))}break;case 13:y2(function(){var r=Ox(t,1);if(r!==null){var s=Ru();wg(r,t,1,s)}}),oSe(t,1)}};_ke=function(t){if(t.tag===13){var e=Ox(t,134217728);if(e!==null){var n=Ru();wg(e,t,134217728,n)}oSe(t,134217728)}};Ktt=function(t){if(t.tag===13){var e=q1(t),n=Ox(t,e);if(n!==null){var r=Ru();wg(n,t,e,r)}oSe(t,e)}};Ytt=function(){return zi};Qtt=function(t,e){var n=zi;try{return zi=t,e()}finally{zi=n}};bme=function(t,e,n){switch(e){case"input":if(hme(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var s=qX(r);if(!s)throw Error(cn(90));Ntt(r),hme(r,s)}}}break;case"textarea":_tt(t,n);break;case"select":e=n.value,e!=null&&TA(t,!!n.multiple,e,!1)}};Dtt=nSe;$tt=y2;var eBt={usingClientEntryPoint:!1,Events:[A8,K_,qX,Mtt,Ltt,nSe]},vL={findFiberByHostInstance:pj,bundleType:0,version:"18.3.1",rendererPackageName:"react-dom"},tBt={bundleType:vL.bundleType,version:vL.version,rendererPackageName:vL.rendererPackageName,rendererConfig:vL.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setErrorHandler:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:x0.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Btt(t),t===null?null:t.stateNode},findFiberByHostInstance:vL.findFiberByHostInstance||J7t,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null,reconcilerVersion:"18.3.1-next-f1338f8080-20240426"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var iU=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!iU.isDisabled&&iU.supportsFiber)try{VX=iU.inject(tBt),cy=iU}catch{}}Im.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=eBt;Im.createPortal=function(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!cSe(e))throw Error(cn(200));return Z7t(t,e,null,n)};Im.createRoot=function(t,e){if(!cSe(t))throw Error(cn(299));var n=!1,r="",s=yrt;return e!=null&&(e.unstable_strictMode===!0&&(n=!0),e.identifierPrefix!==void 0&&(r=e.identifierPrefix),e.onRecoverableError!==void 0&&(s=e.onRecoverableError)),e=aSe(t,1,!1,null,null,n,!1,r,s),t[$x]=e.current,rO(t.nodeType===8?t.parentNode:t),new lSe(e)};Im.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(cn(188)):(t=Object.keys(t).join(","),Error(cn(268,t)));return t=Btt(e),t=t===null?null:t.stateNode,t};Im.flushSync=function(t){return y2(t)};Im.hydrate=function(t,e,n){if(!nee(e))throw Error(cn(200));return ree(null,t,e,!0,n)};Im.hydrateRoot=function(t,e,n){if(!cSe(t))throw Error(cn(405));var r=n!=null&&n.hydratedSources||null,s=!1,i="",o=yrt;if(n!=null&&(n.unstable_strictMode===!0&&(s=!0),n.identifierPrefix!==void 0&&(i=n.identifierPrefix),n.onRecoverableError!==void 0&&(o=n.onRecoverableError)),e=vrt(e,null,t,1,n??null,s,!1,i,o),t[$x]=e.current,rO(t),r)for(t=0;t<r.length;t++)n=r[t],s=n._getVersion,s=s(n._source),e.mutableSourceEagerHydrationData==null?e.mutableSourceEagerHydrationData=[n,s]:e.mutableSourceEagerHydrationData.push(n,s);return new tee(e)};Im.render=function(t,e,n){if(!nee(e))throw Error(cn(200));return ree(null,t,e,!1,n)};Im.unmountComponentAtNode=function(t){if(!nee(t))throw Error(cn(40));return t._reactRootContainer?(y2(function(){ree(null,null,t,!1,function(){t._reactRootContainer=null,t[$x]=null})}),!0):!1};Im.unstable_batchedUpdates=nSe;Im.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!nee(n))throw Error(cn(200));if(t==null||t._reactInternals===void 0)throw Error(cn(38));return ree(t,e,n,!1,r)};Im.version="18.3.1-next-f1338f8080-20240426";function brt(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(brt)}catch(t){console.error(t)}}brt(),btt.exports=Im;var Vg=btt.exports;const see=Fs(Vg);var xrt,MLe=Vg;xrt=MLe.createRoot,MLe.hydrateRoot;/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nBt=t=>t.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),wrt=(...t)=>t.filter((e,n,r)=>!!e&&e.trim()!==""&&r.indexOf(e)===n).join(" ").trim();/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */var rBt={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sBt=y.forwardRef(({color:t="currentColor",size:e=24,strokeWidth:n=2,absoluteStrokeWidth:r,className:s="",children:i,iconNode:o,...l},c)=>y.createElement("svg",{ref:c,...rBt,width:e,height:e,stroke:t,strokeWidth:r?Number(n)*24/Number(e):n,className:wrt("lucide",s),...l},[...o.map(([d,u])=>y.createElement(d,u)),...Array.isArray(i)?i:[i]]));/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ae=(t,e)=>{const n=y.forwardRef(({className:r,...s},i)=>y.createElement(sBt,{ref:i,iconNode:e,className:wrt(`lucide-${nBt(t)}`,r),...s}));return n.displayName=`${t}`,n};/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const iee=Ae("Activity",[["path",{d:"M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2",key:"169zse"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const iBt=Ae("AlignCenter",[["path",{d:"M17 12H7",key:"16if0g"}],["path",{d:"M19 18H5",key:"18s9l3"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dSe=Ae("AlignLeft",[["path",{d:"M15 12H3",key:"6jk70r"}],["path",{d:"M17 18H3",key:"1amg6g"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const aBt=Ae("AlignRight",[["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M21 18H7",key:"1ygte8"}],["path",{d:"M21 6H3",key:"1jwq7v"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const krt=Ae("ArchiveRestore",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h2",key:"tvwodi"}],["path",{d:"M20 8v11a2 2 0 0 1-2 2h-2",key:"1gkqxj"}],["path",{d:"m9 15 3-3 3 3",key:"1pd0qc"}],["path",{d:"M12 12v9",key:"192myk"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const uSe=Ae("Archive",[["rect",{width:"20",height:"5",x:"2",y:"3",rx:"1",key:"1wp1u1"}],["path",{d:"M4 8v11a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8",key:"1s80jp"}],["path",{d:"M10 12h4",key:"a56b0p"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Srt=Ae("ArrowDownRight",[["path",{d:"m7 7 10 10",key:"1fmybs"}],["path",{d:"M17 7v10H7",key:"6fjiku"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const oBt=Ae("ArrowDownToLine",[["path",{d:"M12 17V3",key:"1cwfxf"}],["path",{d:"m6 11 6 6 6-6",key:"12ii2o"}],["path",{d:"M19 21H5",key:"150jfl"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const w0=Ae("ArrowDown",[["path",{d:"M12 5v14",key:"s699le"}],["path",{d:"m19 12-7 7-7-7",key:"1idqje"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const LLe=Ae("ArrowLeftRight",[["path",{d:"M8 3 4 7l4 4",key:"9rb6wj"}],["path",{d:"M4 7h16",key:"6tx8e3"}],["path",{d:"m16 21 4-4-4-4",key:"siv7j2"}],["path",{d:"M20 17H4",key:"h6l3hr"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const no=Ae("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xa=Ae("ArrowRight",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"m12 5 7 7-7 7",key:"xquz4c"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const R8=Ae("ArrowUpRight",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zf=Ae("ArrowUp",[["path",{d:"m5 12 7-7 7 7",key:"hav0vg"}],["path",{d:"M12 19V5",key:"x0mq9r"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Crt=Ae("AtSign",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M16 8v5a3 3 0 0 0 6 0v-1a10 10 0 1 0-4 8",key:"7n84p3"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Bx=Ae("Award",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vk=Ae("BadgeCheck",[["path",{d:"M3.85 8.62a4 4 0 0 1 4.78-4.77 4 4 0 0 1 6.74 0 4 4 0 0 1 4.78 4.78 4 4 0 0 1 0 6.74 4 4 0 0 1-4.77 4.78 4 4 0 0 1-6.75 0 4 4 0 0 1-4.78-4.77 4 4 0 0 1 0-6.76Z",key:"3c2336"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mm=Ae("Ban",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m4.9 4.9 14.2 14.2",key:"1m5liu"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lBt=Ae("Banknote",[["rect",{width:"20",height:"12",x:"2",y:"6",rx:"2",key:"9lu3g6"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}],["path",{d:"M6 12h.01M18 12h.01",key:"113zkx"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cBt=Ae("Baseline",[["path",{d:"M4 20h16",key:"14thso"}],["path",{d:"m6 16 6-12 6 12",key:"1b4byz"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dBt=Ae("BellMinus",[["path",{d:"M18.4 12c.8 3.8 2.6 5 2.6 5H3s3-2 3-9c0-3.3 2.7-6 6-6 1.8 0 3.4.8 4.5 2",key:"eck70s"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"M15 8h6",key:"8ybuxh"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pK=Ae("BellOff",[["path",{d:"M8.7 3A6 6 0 0 1 18 8a21.3 21.3 0 0 0 .6 5",key:"o7mx20"}],["path",{d:"M17 17H3s3-2 3-9a4.67 4.67 0 0 1 .3-1.7",key:"16f1lm"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Lm=Ae("Bell",[["path",{d:"M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9",key:"1qo2s2"}],["path",{d:"M10.3 21a1.94 1.94 0 0 0 3.4 0",key:"qgo35s"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const aee=Ae("Bold",[["path",{d:"M6 12h9a4 4 0 0 1 0 8H7a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1h7a4 4 0 0 1 0 8",key:"mg9rjx"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const uBt=Ae("BookOpenCheck",[["path",{d:"M12 21V7",key:"gj6g52"}],["path",{d:"m16 12 2 2 4-4",key:"mdajum"}],["path",{d:"M22 6V4a1 1 0 0 0-1-1h-5a4 4 0 0 0-4 4 4 4 0 0 0-4-4H3a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h6a3 3 0 0 1 3 3 3 3 0 0 1 3-3h6a1 1 0 0 0 1-1v-1.3",key:"8arnkb"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Iu=Ae("BookOpen",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hBt=Ae("BookmarkPlus",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}],["line",{x1:"12",x2:"12",y1:"7",y2:"13",key:"1cppfj"}],["line",{x1:"15",x2:"9",y1:"10",y2:"10",key:"1gty7f"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hO=Ae("Bookmark",[["path",{d:"m19 21-7-4-7 4V5a2 2 0 0 1 2-2h10a2 2 0 0 1 2 2v16z",key:"1fy3hk"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const DLe=Ae("Bot",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jme=Ae("Boxes",[["path",{d:"M2.97 12.92A2 2 0 0 0 2 14.63v3.24a2 2 0 0 0 .97 1.71l3 1.8a2 2 0 0 0 2.06 0L12 19v-5.5l-5-3-4.03 2.42Z",key:"lc1i9w"}],["path",{d:"m7 16.5-4.74-2.85",key:"1o9zyk"}],["path",{d:"m7 16.5 5-3",key:"va8pkn"}],["path",{d:"M7 16.5v5.17",key:"jnp8gn"}],["path",{d:"M12 13.5V19l3.97 2.38a2 2 0 0 0 2.06 0l3-1.8a2 2 0 0 0 .97-1.71v-3.24a2 2 0 0 0-.97-1.71L17 10.5l-5 3Z",key:"8zsnat"}],["path",{d:"m17 16.5-5-3",key:"8arw3v"}],["path",{d:"m17 16.5 4.74-2.85",key:"8rfmw"}],["path",{d:"M17 16.5v5.17",key:"k6z78m"}],["path",{d:"M7.97 4.42A2 2 0 0 0 7 6.13v4.37l5 3 5-3V6.13a2 2 0 0 0-.97-1.71l-3-1.8a2 2 0 0 0-2.06 0l-3 1.8Z",key:"1xygjf"}],["path",{d:"M12 8 7.26 5.15",key:"1vbdud"}],["path",{d:"m12 8 4.74-2.85",key:"3rx089"}],["path",{d:"M12 13.5V8",key:"1io7kd"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const oee=Ae("Briefcase",[["path",{d:"M16 20V4a2 2 0 0 0-2-2h-4a2 2 0 0 0-2 2v16",key:"jecpp"}],["rect",{width:"20",height:"14",x:"2",y:"6",rx:"2",key:"i6l2r4"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mBt=Ae("Bug",[["path",{d:"m8 2 1.88 1.88",key:"fmnt4t"}],["path",{d:"M14.12 3.88 16 2",key:"qol33r"}],["path",{d:"M9 7.13v-1a3.003 3.003 0 1 1 6 0v1",key:"d7y7pr"}],["path",{d:"M12 20c-3.3 0-6-2.7-6-6v-3a4 4 0 0 1 4-4h4a4 4 0 0 1 4 4v3c0 3.3-2.7 6-6 6",key:"xs1cw7"}],["path",{d:"M12 20v-9",key:"1qisl0"}],["path",{d:"M6.53 9C4.6 8.8 3 7.1 3 5",key:"32zzws"}],["path",{d:"M6 13H2",key:"82j7cp"}],["path",{d:"M3 21c0-2.1 1.7-3.9 3.8-4",key:"4p0ekp"}],["path",{d:"M20.97 5c0 2.1-1.6 3.8-3.5 4",key:"18gb23"}],["path",{d:"M22 13h-4",key:"1jl80f"}],["path",{d:"M17.2 17c2.1.1 3.8 1.9 3.8 4",key:"k3fwyw"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fBt=Ae("Building2",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bD=Ae("CalendarCheck",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"m9 16 2 2 4-4",key:"19s6y9"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ux=Ae("CalendarClock",[["path",{d:"M21 7.5V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h3.5",key:"1osxxc"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M3 10h5",key:"r794hk"}],["path",{d:"M17.5 17.5 16 16.3V14",key:"akvzfd"}],["circle",{cx:"16",cy:"16",r:"6",key:"qoo3c4"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ym=Ae("CalendarDays",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M8 14h.01",key:"6423bh"}],["path",{d:"M12 14h.01",key:"1etili"}],["path",{d:"M16 14h.01",key:"1gbofw"}],["path",{d:"M8 18h.01",key:"lrp35t"}],["path",{d:"M12 18h.01",key:"mhygvu"}],["path",{d:"M16 18h.01",key:"kzsmim"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jrt=Ae("CalendarPlus",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["path",{d:"M21 13V6a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h8",key:"3spt84"}],["path",{d:"M3 10h18",key:"8toen8"}],["path",{d:"M16 19h6",key:"xwg31i"}],["path",{d:"M19 16v6",key:"tddt3s"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const MA=Ae("CalendarX",[["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:"m14 14-4 4",key:"rymu2i"}],["path",{d:"m10 14 4 4",key:"3sz06r"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const I8=Ae("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const FP=Ae("Camera",[["path",{d:"M14.5 4h-5L7 7H4a2 2 0 0 0-2 2v9a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-3l-2.5-3z",key:"1tc9qg"}],["circle",{cx:"12",cy:"13",r:"3",key:"1vg3eu"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Fc=Ae("ChartColumn",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lee=Ae("CheckCheck",[["path",{d:"M18 6 7 17l-5-5",key:"116fxf"}],["path",{d:"m22 10-7.5 7.5L13 16",key:"ke71qq"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qn=Ae("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const li=Ae("ChevronDown",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nl=Ae("ChevronLeft",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const io=Ae("ChevronRight",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const M8=Ae("ChevronUp",[["path",{d:"m18 15-6-6-6 6",key:"153udz"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pBt=Ae("ChevronsDown",[["path",{d:"m7 6 5 5 5-5",key:"1lc07p"}],["path",{d:"m7 13 5 5 5-5",key:"1d48rs"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gBt=Ae("ChevronsLeft",[["path",{d:"m11 17-5-5 5-5",key:"13zhaf"}],["path",{d:"m18 17-5-5 5-5",key:"h8a8et"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vBt=Ae("ChevronsRight",[["path",{d:"m6 17 5-5-5-5",key:"xnjwq"}],["path",{d:"m13 17 5-5-5-5",key:"17xmmf"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yBt=Ae("ChevronsUp",[["path",{d:"m17 11-5-5-5 5",key:"e8nh98"}],["path",{d:"m17 18-5-5-5 5",key:"2avn1x"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tS=Ae("CircleAlert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yo=Ae("CircleCheck",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ert=Ae("CircleDot",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const L8=Ae("CircleHelp",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Nrt=Ae("CircleMinus",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 12h8",key:"1wcyev"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const oh=Ae("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ag=Ae("Circle",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Trt=Ae("Clapperboard",[["path",{d:"M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z",key:"1tn4o7"}],["path",{d:"m6.2 5.3 3.1 3.9",key:"iuk76l"}],["path",{d:"m12.4 3.4 3.1 4",key:"6hsd6n"}],["path",{d:"M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z",key:"ltgou9"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mO=Ae("ClipboardList",[["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:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ja=Ae("Clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["polyline",{points:"12 6 12 12 16 14",key:"68esgv"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $Le=Ae("CodeXml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bBt=Ae("Code",[["polyline",{points:"16 18 22 12 16 6",key:"z7tu5w"}],["polyline",{points:"8 6 2 12 8 18",key:"1eg1df"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gK=Ae("Coins",[["circle",{cx:"8",cy:"8",r:"6",key:"3yglwk"}],["path",{d:"M18.09 10.37A6 6 0 1 1 10.34 18",key:"t5s6rm"}],["path",{d:"M7 6h1v4",key:"1obek4"}],["path",{d:"m16.71 13.88.7.71-2.82 2.82",key:"1rbuyh"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xBt=Ae("Columns2",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wBt=Ae("Compass",[["path",{d:"m16.24 7.76-1.804 5.411a2 2 0 0 1-1.265 1.265L7.76 16.24l1.804-5.411a2 2 0 0 1 1.265-1.265z",key:"9ktpf1"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zl=Ae("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kBt=Ae("CornerDownRight",[["polyline",{points:"15 10 20 15 15 20",key:"1q7qjw"}],["path",{d:"M4 4v7a4 4 0 0 0 4 4h12",key:"z08zvw"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Sh=Ae("CreditCard",[["rect",{width:"20",height:"14",x:"2",y:"5",rx:"2",key:"ynyp8z"}],["line",{x1:"2",x2:"22",y1:"10",y2:"10",key:"1b3vmo"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const SBt=Ae("Crop",[["path",{d:"M6 2v14a2 2 0 0 0 2 2h14",key:"ron5a4"}],["path",{d:"M18 22V8a2 2 0 0 0-2-2H2",key:"7s9ehn"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _rt=Ae("Crown",[["path",{d:"M11.562 3.266a.5.5 0 0 1 .876 0L15.39 8.87a1 1 0 0 0 1.516.294L21.183 5.5a.5.5 0 0 1 .798.519l-2.834 10.246a1 1 0 0 1-.956.734H5.81a1 1 0 0 1-.957-.734L2.02 6.02a.5.5 0 0 1 .798-.519l4.276 3.664a1 1 0 0 0 1.516-.294z",key:"1vdc57"}],["path",{d:"M5 21h14",key:"11awu3"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bc=Ae("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const CBt=Ae("EllipsisVertical",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"12",cy:"5",r:"1",key:"gxeob9"}],["circle",{cx:"12",cy:"19",r:"1",key:"lyex9k"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ys=Ae("Ellipsis",[["circle",{cx:"12",cy:"12",r:"1",key:"41hilf"}],["circle",{cx:"19",cy:"12",r:"1",key:"1wjl8i"}],["circle",{cx:"5",cy:"12",r:"1",key:"1pcz8c"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bo=Ae("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const BP=Ae("EyeOff",[["path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49",key:"ct8e1f"}],["path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242",key:"151rxh"}],["path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143",key:"13bj9a"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Oc=Ae("Eye",[["path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0",key:"1nclc0"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Art=Ae("Facebook",[["path",{d:"M18 2h-3a5 5 0 0 0-5 5v3H7v4h3v8h4v-8h3l1-4h-4V7a1 1 0 0 1 1-1h3z",key:"1jg4f8"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Prt=Ae("FileCheck",[["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:"m9 15 2 2 4-4",key:"1grp1n"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jBt=Ae("FilePlus",[["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:"M9 15h6",key:"cctwl0"}],["path",{d:"M12 18v-6",key:"17g6i2"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const EBt=Ae("FileSpreadsheet",[["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:"M8 13h2",key:"yr2amv"}],["path",{d:"M14 13h2",key:"un5t4a"}],["path",{d:"M8 17h2",key:"2yhykz"}],["path",{d:"M14 17h2",key:"10kma7"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const NBt=Ae("FileStack",[["path",{d:"M21 7h-3a2 2 0 0 1-2-2V2",key:"9rb54x"}],["path",{d:"M21 6v6.5c0 .8-.7 1.5-1.5 1.5h-7c-.8 0-1.5-.7-1.5-1.5v-9c0-.8.7-1.5 1.5-1.5H17Z",key:"1059l0"}],["path",{d:"M7 8v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H15",key:"16874u"}],["path",{d:"M3 12v8.8c0 .3.2.6.4.8.2.2.5.4.8.4H11",key:"k2ox98"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ei=Ae("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const OLe=Ae("FileUp",[["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:"M12 12v6",key:"3ahymv"}],["path",{d:"m15 15-3-3-3 3",key:"15xj92"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const TBt=Ae("FileX",[["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:"m14.5 12.5-5 5",key:"b62r18"}],["path",{d:"m9.5 12.5 5 5",key:"1rk7el"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const FLe=Ae("File",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const b2=Ae("Film",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Rrt=Ae("Filter",[["polygon",{points:"22 3 2 3 10 12.46 10 19 14 21 14 12.46 22 3",key:"1yg77f"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xd=Ae("Flag",[["path",{d:"M4 15s1-1 4-1 5 2 8 2 4-1 4-1V3s-1 1-4 1-5-2-8-2-4 1-4 1z",key:"i9b6wo"}],["line",{x1:"4",x2:"4",y1:"22",y2:"15",key:"1cm3nv"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const D8=Ae("Flame",[["path",{d:"M8.5 14.5A2.5 2.5 0 0 0 11 12c0-1.38-.5-2-1-3-1.072-2.143-.224-4.054 2-6 .5 2.5 2 4.9 4 6.5 2 1.6 3 3.5 3 5.5a7 7 0 1 1-14 0c0-1.153.433-2.294 1-3a2.5 2.5 0 0 0 2.5 2.5z",key:"96xj49"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xme=Ae("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fO=Ae("FolderInput",[["path",{d:"M2 9V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H20a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-1",key:"fm4g5t"}],["path",{d:"M2 13h10",key:"pgb2dq"}],["path",{d:"m9 16 3-3-3-3",key:"6m91ic"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _Bt=Ae("FolderOpen",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xD=Ae("FolderPlus",[["path",{d:"M12 10v6",key:"1bos4e"}],["path",{d:"M9 13h6",key:"1uhe8q"}],["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const BLe=Ae("Folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bx=Ae("Gift",[["rect",{x:"3",y:"8",width:"18",height:"4",rx:"1",key:"bkv52"}],["path",{d:"M12 8v13",key:"1c76mn"}],["path",{d:"M19 12v7a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2v-7",key:"6wjy6b"}],["path",{d:"M7.5 8a2.5 2.5 0 0 1 0-5A4.8 8 0 0 1 12 8a4.8 8 0 0 1 4.5-5 2.5 2.5 0 0 1 0 5",key:"1ihvrl"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qd=Ae("Globe",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kE=Ae("GraduationCap",[["path",{d:"M21.42 10.922a1 1 0 0 0-.019-1.838L12.83 5.18a2 2 0 0 0-1.66 0L2.6 9.08a1 1 0 0 0 0 1.832l8.57 3.908a2 2 0 0 0 1.66 0z",key:"j76jl0"}],["path",{d:"M22 10v6",key:"1lu8f3"}],["path",{d:"M6 12.5V16a6 3 0 0 0 12 0v-3.5",key:"1r8lef"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ABt=Ae("Grid3x3",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M3 9h18",key:"1pudct"}],["path",{d:"M3 15h18",key:"5xshup"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"M15 3v18",key:"14nvp0"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const PBt=Ae("GripVertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Irt=Ae("Hand",[["path",{d:"M18 11V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2",key:"1fvzgz"}],["path",{d:"M14 10V4a2 2 0 0 0-2-2a2 2 0 0 0-2 2v2",key:"1kc0my"}],["path",{d:"M10 10.5V6a2 2 0 0 0-2-2a2 2 0 0 0-2 2v8",key:"10h0bg"}],["path",{d:"M18 8a2 2 0 1 1 4 0v6a8 8 0 0 1-8 8h-2c-2.8 0-4.5-.86-5.99-2.34l-3.6-3.6a2 2 0 0 1 2.83-2.82L7 15",key:"1s1gnw"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const RBt=Ae("HardDrive",[["line",{x1:"22",x2:"2",y1:"12",y2:"12",key:"1y58io"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}],["line",{x1:"6",x2:"6.01",y1:"16",y2:"16",key:"sgf278"}],["line",{x1:"10",x2:"10.01",y1:"16",y2:"16",key:"1l4acy"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nI=Ae("Hash",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const IBt=Ae("Heading1",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"m17 12 3-2v8",key:"1hhhft"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const MBt=Ae("Heading2",[["path",{d:"M4 12h8",key:"17cfdx"}],["path",{d:"M4 18V6",key:"1rz3zl"}],["path",{d:"M12 18V6",key:"zqpxq5"}],["path",{d:"M21 18h-4c0-4 4-3 4-6 0-1.5-2-2.5-4-1",key:"9jr5yi"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const UP=Ae("Headphones",[["path",{d:"M3 14h3a2 2 0 0 1 2 2v3a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-7a9 9 0 0 1 18 0v7a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3",key:"1xhozi"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const LBt=Ae("HeartPulse",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}],["path",{d:"M3.22 12H9.5l.5-1 2 4.5 2-7 1.5 3.5h5.27",key:"1uw2ng"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xx=Ae("Heart",[["path",{d:"M19 14c1.49-1.46 3-3.21 3-5.5A5.5 5.5 0 0 0 16.5 3c-1.76 0-3 .5-4.5 2-1.5-1.5-2.74-2-4.5-2A5.5 5.5 0 0 0 2 8.5c0 2.3 1.5 4.05 3 5.5l7 7Z",key:"c3ymky"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const DBt=Ae("Highlighter",[["path",{d:"m9 11-6 6v3h9l3-3",key:"1a3l36"}],["path",{d:"m22 12-4.6 4.6a2 2 0 0 1-2.8 0l-5.2-5.2a2 2 0 0 1 0-2.8L14 4",key:"14a9rk"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $Bt=Ae("Hourglass",[["path",{d:"M5 22h14",key:"ehvnwv"}],["path",{d:"M5 2h14",key:"pdyrp9"}],["path",{d:"M17 22v-4.172a2 2 0 0 0-.586-1.414L12 12l-4.414 4.414A2 2 0 0 0 7 17.828V22",key:"1d314k"}],["path",{d:"M7 2v4.172a2 2 0 0 0 .586 1.414L12 12l4.414-4.414A2 2 0 0 0 17 6.172V2",key:"1vvvr6"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const OBt=Ae("House",[["path",{d:"M15 21v-8a1 1 0 0 0-1-1h-4a1 1 0 0 0-1 1v8",key:"5wwlr5"}],["path",{d:"M3 10a2 2 0 0 1 .709-1.528l7-5.999a2 2 0 0 1 2.582 0l7 5.999A2 2 0 0 1 21 10v9a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"1d0kgt"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const FBt=Ae("ImageOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M10.41 10.41a2 2 0 1 1-2.83-2.83",key:"1bzlo9"}],["line",{x1:"13.5",x2:"6",y1:"13.5",y2:"21",key:"1q0aeu"}],["line",{x1:"18",x2:"21",y1:"12",y2:"15",key:"5mozeu"}],["path",{d:"M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59",key:"mmje98"}],["path",{d:"M21 15V5a2 2 0 0 0-2-2H9",key:"43el77"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jy=Ae("ImagePlus",[["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}],["path",{d:"M21 11.5V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h7.5",key:"1ue2ih"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jl=Ae("Image",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["circle",{cx:"9",cy:"9",r:"2",key:"af1f0g"}],["path",{d:"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21",key:"1xmnt7"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const efe=Ae("Import",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m8 11 4 4 4-4",key:"1dohi6"}],["path",{d:"M8 5H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-4",key:"1ywtjm"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const BBt=Ae("Infinity",[["path",{d:"M12 12c-2-2.67-4-4-6-4a4 4 0 1 0 0 8c2 0 4-1.33 6-4Zm0 0c2 2.67 4 4 6 4a4 4 0 0 0 0-8c-2 0-4 1.33-6 4Z",key:"1z0uae"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nS=Ae("Info",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 16v-4",key:"1dtifu"}],["path",{d:"M12 8h.01",key:"e9boi3"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Mrt=Ae("Instagram",[["rect",{width:"20",height:"20",x:"2",y:"2",rx:"5",ry:"5",key:"2e1cvw"}],["path",{d:"M16 11.37A4 4 0 1 1 12.63 8 4 4 0 0 1 16 11.37z",key:"9exkf1"}],["line",{x1:"17.5",x2:"17.51",y1:"6.5",y2:"6.5",key:"r4j83e"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cee=Ae("Italic",[["line",{x1:"19",x2:"10",y1:"4",y2:"4",key:"15jd3p"}],["line",{x1:"14",x2:"5",y1:"20",y2:"20",key:"bu0au3"}],["line",{x1:"15",x2:"9",y1:"4",y2:"20",key:"uljnxc"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pO=Ae("KeyRound",[["path",{d:"M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z",key:"1s6t7t"}],["circle",{cx:"16.5",cy:"7.5",r:".5",fill:"currentColor",key:"w0ekpg"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const UBt=Ae("Keyboard",[["path",{d:"M10 8h.01",key:"1r9ogq"}],["path",{d:"M12 12h.01",key:"1mp3jc"}],["path",{d:"M14 8h.01",key:"1primd"}],["path",{d:"M16 12h.01",key:"1l6xoz"}],["path",{d:"M18 8h.01",key:"emo2bl"}],["path",{d:"M6 8h.01",key:"x9i8wu"}],["path",{d:"M7 16h10",key:"wp8him"}],["path",{d:"M8 12h.01",key:"czm47f"}],["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zBt=Ae("Languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vK=Ae("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Lrt=Ae("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dee=Ae("LayoutGrid",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const VBt=Ae("LayoutList",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hSe=Ae("LayoutTemplate",[["rect",{width:"18",height:"7",x:"3",y:"3",rx:"1",key:"f1a2em"}],["rect",{width:"9",height:"7",x:"3",y:"14",rx:"1",key:"jqznyg"}],["rect",{width:"5",height:"7",x:"16",y:"14",rx:"1",key:"q5h2i8"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const HBt=Ae("Library",[["path",{d:"m16 6 4 14",key:"ji33uf"}],["path",{d:"M12 6v14",key:"1n7gus"}],["path",{d:"M8 8v12",key:"1gg7y9"}],["path",{d:"M4 4v16",key:"6qkkli"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const GBt=Ae("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const eu=Ae("Link2",[["path",{d:"M9 17H7A5 5 0 0 1 7 7h2",key:"8i5ue5"}],["path",{d:"M15 7h2a5 5 0 1 1 0 10h-2",key:"1b9ql8"}],["line",{x1:"8",x2:"16",y1:"12",y2:"12",key:"1jonct"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Drt=Ae("Link",[["path",{d:"M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71",key:"1cjeqo"}],["path",{d:"M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71",key:"19qd67"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $rt=Ae("Linkedin",[["path",{d:"M16 8a6 6 0 0 1 6 6v7h-4v-7a2 2 0 0 0-2-2 2 2 0 0 0-2 2v7h-4v-7a6 6 0 0 1 6-6z",key:"c2jq9f"}],["rect",{width:"4",height:"12",x:"2",y:"9",key:"mk3on5"}],["circle",{cx:"4",cy:"4",r:"2",key:"bt5ra8"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const k0=Ae("ListChecks",[["path",{d:"m3 17 2 2 4-4",key:"1jhpwq"}],["path",{d:"m3 7 2 2 4-4",key:"1obspn"}],["path",{d:"M13 6h8",key:"15sg57"}],["path",{d:"M13 12h8",key:"h98zly"}],["path",{d:"M13 18h8",key:"oe0vm4"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const uee=Ae("ListOrdered",[["path",{d:"M10 12h11",key:"6m4ad9"}],["path",{d:"M10 18h11",key:"11hvi2"}],["path",{d:"M10 6h11",key:"c7qv1k"}],["path",{d:"M4 10h2",key:"16xx2s"}],["path",{d:"M4 6h1v4",key:"cnovpq"}],["path",{d:"M6 18H4c0-1 2-2 2-3s-1-1.5-2-1",key:"m9a95d"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const WBt=Ae("ListPlus",[["path",{d:"M11 12H3",key:"51ecnj"}],["path",{d:"M16 6H3",key:"1wxfjs"}],["path",{d:"M16 18H3",key:"12xzn7"}],["path",{d:"M18 9v6",key:"1twb98"}],["path",{d:"M21 12h-6",key:"bt1uis"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rI=Ae("List",[["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 18h.01",key:"1tta3j"}],["path",{d:"M3 6h.01",key:"1rqtza"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 18h13",key:"1lx6n3"}],["path",{d:"M8 6h13",key:"ik3vkj"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ne=Ae("LoaderCircle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ort=Ae("LocateFixed",[["line",{x1:"2",x2:"5",y1:"12",y2:"12",key:"bvdh0s"}],["line",{x1:"19",x2:"22",y1:"12",y2:"12",key:"1tbv5k"}],["line",{x1:"12",x2:"12",y1:"2",y2:"5",key:"11lu5j"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}],["circle",{cx:"12",cy:"12",r:"7",key:"fim9np"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yK=Ae("LockKeyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Frt=Ae("LockOpen",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 9.9-1",key:"1mm8w8"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wa=Ae("Lock",[["rect",{width:"18",height:"11",x:"3",y:"11",rx:"2",ry:"2",key:"1w4ew1"}],["path",{d:"M7 11V7a5 5 0 0 1 10 0v4",key:"fwvmzm"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const mSe=Ae("LogIn",[["path",{d:"M15 3h4a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2h-4",key:"u53s6r"}],["polyline",{points:"10 17 15 12 10 7",key:"1ail0h"}],["line",{x1:"15",x2:"3",y1:"12",y2:"12",key:"v6grx8"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sI=Ae("LogOut",[["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}],["polyline",{points:"16 17 21 12 16 7",key:"1gabdz"}],["line",{x1:"21",x2:"9",y1:"12",y2:"12",key:"1uyos4"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gO=Ae("MailCheck",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h8",key:"12jkf8"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m16 19 2 2 4-4",key:"1b14m6"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zx=Ae("MailOpen",[["path",{d:"M21.2 8.4c.5.38.8.97.8 1.6v10a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V10a2 2 0 0 1 .8-1.6l8-6a2 2 0 0 1 2.4 0l8 6Z",key:"1jhwl8"}],["path",{d:"m22 10-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 10",key:"1qfld7"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qBt=Ae("MailWarning",[["path",{d:"M22 10.5V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h12.5",key:"e61zoh"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"M20 14v4",key:"1hm744"}],["path",{d:"M20 22v.01",key:"12bgn6"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Brt=Ae("MailX",[["path",{d:"M22 13V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v12c0 1.1.9 2 2 2h9",key:"1j9vog"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}],["path",{d:"m17 17 4 4",key:"1b3523"}],["path",{d:"m21 17-4 4",key:"uinynz"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ii=Ae("Mail",[["rect",{width:"20",height:"16",x:"2",y:"4",rx:"2",key:"18n3k1"}],["path",{d:"m22 7-8.97 5.7a1.94 1.94 0 0 1-2.06 0L2 7",key:"1ocrg3"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jf=Ae("MapPin",[["path",{d:"M20 10c0 4.993-5.539 10.193-7.399 11.799a1 1 0 0 1-1.202 0C9.539 20.193 4 14.993 4 10a8 8 0 0 1 16 0",key:"1r0f0z"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fSe=Ae("Maximize2",[["polyline",{points:"15 3 21 3 21 9",key:"mznyad"}],["polyline",{points:"9 21 3 21 3 15",key:"1avn1i"}],["line",{x1:"21",x2:"14",y1:"3",y2:"10",key:"ota7mn"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Urt=Ae("Maximize",[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tfe=Ae("Megaphone",[["path",{d:"m3 11 18-5v12L3 14v-3z",key:"n962bs"}],["path",{d:"M11.6 16.8a3 3 0 1 1-5.8-1.6",key:"1yl0tm"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const KBt=Ae("Menu",[["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}],["line",{x1:"4",x2:"20",y1:"6",y2:"6",key:"1owob3"}],["line",{x1:"4",x2:"20",y1:"18",y2:"18",key:"yk5zj1"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wd=Ae("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const pSe=Ae("MessageSquarePlus",[["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"}],["path",{d:"M12 7v6",key:"lw1j43"}],["path",{d:"M9 10h6",key:"9gxzsh"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zrt=Ae("MessageSquareWarning",[["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"}],["path",{d:"M12 7v2",key:"stiyo7"}],["path",{d:"M12 13h.01",key:"y0uutt"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Vrt=Ae("MessageSquareX",[["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"}],["path",{d:"m14.5 7.5-5 5",key:"3lb6iw"}],["path",{d:"m9.5 7.5 5 5",key:"ko136h"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Vi=Ae("MessageSquare",[["path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z",key:"1lielz"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const x2=Ae("MessagesSquare",[["path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z",key:"p1xzt8"}],["path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1",key:"1cx29u"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yk=Ae("MicOff",[["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}],["path",{d:"M18.89 13.23A7.12 7.12 0 0 0 19 12v-2",key:"80xlxr"}],["path",{d:"M5 10v2a7 7 0 0 0 12 5",key:"p2k8kg"}],["path",{d:"M15 9.34V5a3 3 0 0 0-5.68-1.33",key:"1gzdoj"}],["path",{d:"M9 9v3a3 3 0 0 0 5.12 2.12",key:"r2i35w"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Vx=Ae("Mic",[["path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z",key:"131961"}],["path",{d:"M19 10v2a7 7 0 0 1-14 0v-2",key:"1vc78b"}],["line",{x1:"12",x2:"12",y1:"19",y2:"22",key:"x3vr5v"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Hrt=Ae("Minimize2",[["polyline",{points:"4 14 10 14 10 20",key:"11kfnr"}],["polyline",{points:"20 10 14 10 14 4",key:"rlmsce"}],["line",{x1:"14",x2:"21",y1:"10",y2:"3",key:"o5lafz"}],["line",{x1:"3",x2:"10",y1:"21",y2:"14",key:"1atl0r"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Grt=Ae("Minimize",[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const gSe=Ae("Minus",[["path",{d:"M5 12h14",key:"1ays0h"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const YBt=Ae("MonitorOff",[["path",{d:"M17 17H4a2 2 0 0 1-2-2V5c0-1.5 1-2 1-2",key:"k0q8oc"}],["path",{d:"M22 15V5a2 2 0 0 0-2-2H9",key:"cp1ac0"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const QBt=Ae("MonitorPlay",[["path",{d:"M10 7.75a.75.75 0 0 1 1.142-.638l3.664 2.249a.75.75 0 0 1 0 1.278l-3.664 2.25a.75.75 0 0 1-1.142-.64z",key:"1pctta"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["rect",{x:"2",y:"3",width:"20",height:"14",rx:"2",key:"x3v2xh"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ZBt=Ae("MonitorSmartphone",[["path",{d:"M18 8V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h8",key:"10dyio"}],["path",{d:"M10 19v-3.96 3.15",key:"1irgej"}],["path",{d:"M7 19h5",key:"qswx4l"}],["rect",{width:"6",height:"10",x:"16",y:"12",rx:"2",key:"1egngj"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const JBt=Ae("MonitorUp",[["path",{d:"m9 10 3-3 3 3",key:"11gsxs"}],["path",{d:"M12 13V7",key:"h0r20n"}],["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"M8 21h8",key:"1ev6f3"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vSe=Ae("Monitor",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Wrt=Ae("Moon",[["path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z",key:"a7tn18"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const XBt=Ae("MousePointer2",[["path",{d:"M4.037 4.688a.495.495 0 0 1 .651-.651l16 6.5a.5.5 0 0 1-.063.947l-6.124 1.58a2 2 0 0 0-1.438 1.435l-1.579 6.126a.5.5 0 0 1-.947.063z",key:"edeuup"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bk=Ae("MousePointerClick",[["path",{d:"M14 4.1 12 6",key:"ita8i4"}],["path",{d:"m5.1 8-2.9-.8",key:"1go3kf"}],["path",{d:"m6 12-1.9 2",key:"mnht97"}],["path",{d:"M7.2 2.2 8 5.1",key:"1cfko1"}],["path",{d:"M9.037 9.69a.498.498 0 0 1 .653-.653l11 4.5a.5.5 0 0 1-.074.949l-4.349 1.041a1 1 0 0 0-.74.739l-1.04 4.35a.5.5 0 0 1-.95.074z",key:"s0h3yz"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ySe=Ae("Music",[["path",{d:"M9 18V5l12-2v13",key:"1jmyc2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["circle",{cx:"18",cy:"16",r:"3",key:"1hluhg"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const vO=Ae("Newspaper",[["path",{d:"M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2",key:"7pis2x"}],["path",{d:"M18 14h-8",key:"sponae"}],["path",{d:"M15 18h-5",key:"95g1m2"}],["path",{d:"M10 6h8v4h-8V6Z",key:"smlsk5"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qrt=Ae("Notebook",[["path",{d:"M2 6h4",key:"aawbzj"}],["path",{d:"M2 10h4",key:"l0bgd4"}],["path",{d:"M2 14h4",key:"1gsvsf"}],["path",{d:"M2 18h4",key:"1bu2t1"}],["rect",{width:"16",height:"20",x:"4",y:"2",rx:"2",key:"1nb95v"}],["path",{d:"M16 2v20",key:"rotuqe"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const e9t=Ae("Orbit",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["circle",{cx:"19",cy:"5",r:"2",key:"mhkx31"}],["circle",{cx:"5",cy:"19",r:"2",key:"v8kfzx"}],["path",{d:"M10.4 21.9a10 10 0 0 0 9.941-15.416",key:"eohfx2"}],["path",{d:"M13.5 2.1a10 10 0 0 0-9.841 15.416",key:"19pvbm"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Krt=Ae("Package",[["path",{d:"M11 21.73a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73z",key:"1a0edw"}],["path",{d:"M12 22V12",key:"d0xqtd"}],["path",{d:"m3.3 7 7.703 4.734a2 2 0 0 0 1.994 0L20.7 7",key:"yx3hmr"}],["path",{d:"m7.5 4.27 9 5.15",key:"1c824w"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bSe=Ae("Palette",[["circle",{cx:"13.5",cy:"6.5",r:".5",fill:"currentColor",key:"1okk4w"}],["circle",{cx:"17.5",cy:"10.5",r:".5",fill:"currentColor",key:"f64h9f"}],["circle",{cx:"8.5",cy:"7.5",r:".5",fill:"currentColor",key:"fotxhn"}],["circle",{cx:"6.5",cy:"12.5",r:".5",fill:"currentColor",key:"qy21gx"}],["path",{d:"M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.555-2.503 5.555-5.554C21.965 6.012 17.461 2 12 2z",key:"12rzf8"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ULe=Ae("PanelLeftClose",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m16 15-3-3 3-3",key:"14y99z"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zLe=Ae("PanelLeftOpen",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M9 3v18",key:"fh3hqa"}],["path",{d:"m14 9 3 3-3 3",key:"8010ee"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ff=Ae("Paperclip",[["path",{d:"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48",key:"1u3ebp"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Yrt=Ae("PartyPopper",[["path",{d:"M5.8 11.3 2 22l10.7-3.79",key:"gwxi1d"}],["path",{d:"M4 3h.01",key:"1vcuye"}],["path",{d:"M22 8h.01",key:"1mrtc2"}],["path",{d:"M15 2h.01",key:"1cjtqr"}],["path",{d:"M22 20h.01",key:"1mrys2"}],["path",{d:"m22 2-2.24.75a2.9 2.9 0 0 0-1.96 3.12c.1.86-.57 1.63-1.45 1.63h-.38c-.86 0-1.6.6-1.76 1.44L14 10",key:"hbicv8"}],["path",{d:"m22 13-.82-.33c-.86-.34-1.82.2-1.98 1.11c-.11.7-.72 1.22-1.43 1.22H17",key:"1i94pl"}],["path",{d:"m11 2 .33.82c.34.86-.2 1.82-1.11 1.98C9.52 4.9 9 5.52 9 6.23V7",key:"1cofks"}],["path",{d:"M11 13c1.93 1.93 2.83 4.17 2 5-.83.83-3.07-.07-5-2-1.93-1.93-2.83-4.17-2-5 .83-.83 3.07.07 5 2Z",key:"4kbmks"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const t9t=Ae("Pause",[["rect",{x:"14",y:"4",width:"4",height:"16",rx:"1",key:"zuxfzm"}],["rect",{x:"6",y:"4",width:"4",height:"16",rx:"1",key:"1okwgv"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const iI=Ae("PenLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const VLe=Ae("PenTool",[["path",{d:"M15.707 21.293a1 1 0 0 1-1.414 0l-1.586-1.586a1 1 0 0 1 0-1.414l5.586-5.586a1 1 0 0 1 1.414 0l1.586 1.586a1 1 0 0 1 0 1.414z",key:"nt11vn"}],["path",{d:"m18 13-1.375-6.874a1 1 0 0 0-.746-.776L3.235 2.028a1 1 0 0 0-1.207 1.207L5.35 15.879a1 1 0 0 0 .776.746L13 18",key:"15qc1e"}],["path",{d:"m2.3 2.3 7.286 7.286",key:"1wuzzi"}],["circle",{cx:"11",cy:"11",r:"2",key:"xmgehs"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const n9t=Ae("PencilLine",[["path",{d:"M12 20h9",key:"t2du7b"}],["path",{d:"M16.376 3.622a1 1 0 0 1 3.002 3.002L7.368 18.635a2 2 0 0 1-.855.506l-2.872.838a.5.5 0 0 1-.62-.62l.838-2.872a2 2 0 0 1 .506-.854z",key:"1ykcvy"}],["path",{d:"m15 5 3 3",key:"1w25hb"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qs=Ae("Pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Qrt=Ae("PhoneIncoming",[["polyline",{points:"16 2 16 8 22 8",key:"1ygljm"}],["line",{x1:"22",x2:"16",y1:"2",y2:"8",key:"1xzwqn"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Zrt=Ae("PhoneMissed",[["line",{x1:"22",x2:"16",y1:"2",y2:"8",key:"1xzwqn"}],["line",{x1:"16",x2:"22",y1:"2",y2:"8",key:"13zxdn"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const aI=Ae("PhoneOff",[["path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7 2 2 0 0 1 1.72 2v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 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.91",key:"z86iuo"}],["line",{x1:"22",x2:"2",y1:"2",y2:"22",key:"11kh81"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Jrt=Ae("PhoneOutgoing",[["polyline",{points:"22 8 22 2 16 2",key:"1g204g"}],["line",{x1:"16",x2:"22",y1:"8",y2:"2",key:"1ggias"}],["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rS=Ae("Phone",[["path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z",key:"foiqr5"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Xrt=Ae("PictureInPicture2",[["path",{d:"M21 9V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v10c0 1.1.9 2 2 2h4",key:"daa4of"}],["rect",{width:"10",height:"7",x:"12",y:"13",rx:"2",key:"1nb8gs"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xSe=Ae("PinOff",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89",key:"znwnzq"}],["path",{d:"m2 2 20 20",key:"1ooewy"}],["path",{d:"M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11",key:"c9qhm2"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xk=Ae("Pin",[["path",{d:"M12 17v5",key:"bb1du9"}],["path",{d:"M9 10.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-.76a2 2 0 0 0-1.11-1.79l-1.78-.9A2 2 0 0 1 15 10.76V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H8a2 2 0 0 0 0 4 1 1 0 0 1 1 1z",key:"1nkz8b"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const fm=Ae("Play",[["polygon",{points:"6 3 20 12 6 21 6 3",key:"1oa8hb"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const r9t=Ae("PlugZap",[["path",{d:"M6.3 20.3a2.4 2.4 0 0 0 3.4 0L12 18l-6-6-2.3 2.3a2.4 2.4 0 0 0 0 3.4Z",key:"goz73y"}],["path",{d:"m2 22 3-3",key:"19mgm9"}],["path",{d:"M7.5 13.5 10 11",key:"7xgeeb"}],["path",{d:"M10.5 16.5 13 14",key:"10btkg"}],["path",{d:"m18 3-4 4h6l-4 4",key:"16psg9"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Dn=Ae("Plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const yO=Ae("Power",[["path",{d:"M12 2v10",key:"mnfbl"}],["path",{d:"M18.4 6.6a9 9 0 1 1-12.77.04",key:"obofu9"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const s9t=Ae("Quote",[["path",{d:"M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"rib7q0"}],["path",{d:"M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z",key:"1ymkrd"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const i9t=Ae("RadioTower",[["path",{d:"M4.9 16.1C1 12.2 1 5.8 4.9 1.9",key:"s0qx1y"}],["path",{d:"M7.8 4.7a6.14 6.14 0 0 0-.8 7.5",key:"1idnkw"}],["circle",{cx:"12",cy:"9",r:"2",key:"1092wv"}],["path",{d:"M16.2 4.8c2 2 2.26 5.11.8 7.47",key:"ojru2q"}],["path",{d:"M19.1 1.9a9.96 9.96 0 0 1 0 14.1",key:"rhi7fg"}],["path",{d:"M9.5 18h5",key:"mfy3pd"}],["path",{d:"m8 22 4-11 4 11",key:"25yftu"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wk=Ae("Radio",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nfe=Ae("Receipt",[["path",{d:"M4 2v20l2-1 2 1 2-1 2 1 2-1 2 1 2-1 2 1V2l-2 1-2-1-2 1-2-1-2 1-2-1-2 1Z",key:"q3az6g"}],["path",{d:"M16 8h-6a2 2 0 1 0 0 4h4a2 2 0 1 1 0 4H8",key:"1h4pet"}],["path",{d:"M12 17.5v-11",key:"1jc1ny"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Nl=Ae("RefreshCw",[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const est=Ae("RemoveFormatting",[["path",{d:"M4 7V4h16v3",key:"9msm58"}],["path",{d:"M5 20h6",key:"1h6pxn"}],["path",{d:"M13 4 8 20",key:"kqq6aj"}],["path",{d:"m15 15 5 5",key:"me55sn"}],["path",{d:"m20 15-5 5",key:"11p7ol"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const LA=Ae("Repeat2",[["path",{d:"m2 9 3-3 3 3",key:"1ltn5i"}],["path",{d:"M13 18H7a2 2 0 0 1-2-2V6",key:"1r6tfw"}],["path",{d:"m22 15-3 3-3-3",key:"4rnwn2"}],["path",{d:"M11 6h6a2 2 0 0 1 2 2v10",key:"2f72bc"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const a9t=Ae("Repeat",[["path",{d:"m17 2 4 4-4 4",key:"nntrym"}],["path",{d:"M3 11v-1a4 4 0 0 1 4-4h14",key:"84bu3i"}],["path",{d:"m7 22-4-4 4-4",key:"1wqhfi"}],["path",{d:"M21 13v1a4 4 0 0 1-4 4H3",key:"1rx37r"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bK=Ae("Reply",[["polyline",{points:"9 17 4 12 9 7",key:"hvgpf2"}],["path",{d:"M20 18v-2a4 4 0 0 0-4-4H4",key:"5vmcpk"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const bO=Ae("Rocket",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const zP=Ae("RotateCcw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const tst=Ae("RotateCw",[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nst=Ae("Route",[["circle",{cx:"6",cy:"19",r:"3",key:"1kj8tv"}],["path",{d:"M9 19h8.5a3.5 3.5 0 0 0 0-7h-11a3.5 3.5 0 0 1 0-7H15",key:"1d8sl"}],["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const o9t=Ae("Rss",[["path",{d:"M4 11a9 9 0 0 1 9 9",key:"pv89mb"}],["path",{d:"M4 4a16 16 0 0 1 16 16",key:"k0647b"}],["circle",{cx:"5",cy:"19",r:"1",key:"bfqh0e"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xK=Ae("Save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const l9t=Ae("Scissors",[["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M8.12 8.12 12 12",key:"1alkpv"}],["path",{d:"M20 4 8.12 15.88",key:"xgtan2"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}],["path",{d:"M14.8 14.8 20 20",key:"ptml3r"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const c9t=Ae("ScreenShareOff",[["path",{d:"M13 3H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-3",key:"i8wdob"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m22 3-5 5",key:"12jva0"}],["path",{d:"m17 3 5 5",key:"k36vhe"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rst=Ae("ScreenShare",[["path",{d:"M13 3H4a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-3",key:"i8wdob"}],["path",{d:"M8 21h8",key:"1ev6f3"}],["path",{d:"M12 17v4",key:"1riwvh"}],["path",{d:"m17 8 5-5",key:"fqif7o"}],["path",{d:"M17 3h5v5",key:"1o3tu8"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hs=Ae("Search",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["path",{d:"m21 21-4.3-4.3",key:"1qie3q"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const _s=Ae("Send",[["path",{d:"M14.536 21.686a.5.5 0 0 0 .937-.024l6.5-19a.496.496 0 0 0-.635-.635l-19 6.5a.5.5 0 0 0-.024.937l7.93 3.18a2 2 0 0 1 1.112 1.11z",key:"1ffxy3"}],["path",{d:"m21.854 2.147-10.94 10.939",key:"12cjpa"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wSe=Ae("Settings2",[["path",{d:"M20 7h-9",key:"3s1dr2"}],["path",{d:"M14 17H5",key:"gfn3mx"}],["circle",{cx:"17",cy:"17",r:"3",key:"18b49y"}],["circle",{cx:"7",cy:"7",r:"3",key:"dfmy0x"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const w2=Ae("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kk=Ae("Share2",[["circle",{cx:"18",cy:"5",r:"3",key:"gq8acd"}],["circle",{cx:"6",cy:"12",r:"3",key:"w7nqdw"}],["circle",{cx:"18",cy:"19",r:"3",key:"1xt0gg"}],["line",{x1:"8.59",x2:"15.42",y1:"13.51",y2:"17.49",key:"47mynk"}],["line",{x1:"15.41",x2:"8.59",y1:"6.51",y2:"10.49",key:"1n3mei"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const HLe=Ae("Share",[["path",{d:"M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8",key:"1b2hhj"}],["polyline",{points:"16 6 12 2 8 6",key:"m901s6"}],["line",{x1:"12",x2:"12",y1:"2",y2:"15",key:"1p0rca"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kSe=Ae("ShieldAlert",[["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:"M12 8v4",key:"1got3b"}],["path",{d:"M12 16h.01",key:"1drbdi"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Sk=Ae("ShieldCheck",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}],["path",{d:"m9 12 2 2 4-4",key:"dzmm74"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sst=Ae("ShieldMinus",[["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 12h6",key:"1c52cq"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ist=Ae("ShieldPlus",[["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 12h6",key:"1c52cq"}],["path",{d:"M12 9v6",key:"199k2o"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const d9t=Ae("Shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const u9t=Ae("Shuffle",[["path",{d:"m18 14 4 4-4 4",key:"10pe0f"}],["path",{d:"m18 2 4 4-4 4",key:"pucp1d"}],["path",{d:"M2 18h1.973a4 4 0 0 0 3.3-1.7l5.454-8.6a4 4 0 0 1 3.3-1.7H22",key:"1ailkh"}],["path",{d:"M2 6h1.972a4 4 0 0 1 3.6 2.2",key:"km57vx"}],["path",{d:"M22 18h-6.041a4 4 0 0 1-3.3-1.8l-.359-.45",key:"os18l9"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const h9t=Ae("SignalLow",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const m9t=Ae("SignalMedium",[["path",{d:"M2 20h.01",key:"4haj6o"}],["path",{d:"M7 20v-4",key:"j294jx"}],["path",{d:"M12 20v-8",key:"i3yub9"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ast=Ae("SlidersHorizontal",[["line",{x1:"21",x2:"14",y1:"4",y2:"4",key:"obuewd"}],["line",{x1:"10",x2:"3",y1:"4",y2:"4",key:"1q6298"}],["line",{x1:"21",x2:"12",y1:"12",y2:"12",key:"1iu8h1"}],["line",{x1:"8",x2:"3",y1:"12",y2:"12",key:"ntss68"}],["line",{x1:"21",x2:"16",y1:"20",y2:"20",key:"14d8ph"}],["line",{x1:"12",x2:"3",y1:"20",y2:"20",key:"m0wm8r"}],["line",{x1:"14",x2:"14",y1:"2",y2:"6",key:"14e1ph"}],["line",{x1:"8",x2:"8",y1:"10",y2:"14",key:"1i6ji0"}],["line",{x1:"16",x2:"16",y1:"18",y2:"22",key:"1lctlv"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ost=Ae("Smartphone",[["rect",{width:"14",height:"20",x:"5",y:"2",rx:"2",ry:"2",key:"1yt0o3"}],["path",{d:"M12 18h.01",key:"mhygvu"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const f9t=Ae("SmilePlus",[["path",{d:"M22 11v1a10 10 0 1 1-9-10",key:"ew0xw9"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}],["path",{d:"M16 5h6",key:"1vod17"}],["path",{d:"M19 2v6",key:"4bpg5p"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Hx=Ae("Smile",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M8 14s1.5 2 4 2 4-2 4-2",key:"1y1vjs"}],["line",{x1:"9",x2:"9.01",y1:"9",y2:"9",key:"yxxnd0"}],["line",{x1:"15",x2:"15.01",y1:"9",y2:"9",key:"1p4y9e"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const xo=Ae("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const p9t=Ae("SquareCheckBig",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const rfe=Ae("SquarePen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const g9t=Ae("SquareX",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hee=Ae("Square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const v9t=Ae("StarOff",[["path",{d:"M8.34 8.34 2 9.27l5 4.87L5.82 21 12 17.77 18.18 21l-.59-3.43",key:"16m0ql"}],["path",{d:"M18.42 12.76 22 9.27l-6.91-1L12 2l-1.44 2.91",key:"1vt8nq"}],["line",{x1:"2",x2:"22",y1:"2",y2:"22",key:"a6p6uj"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const SSe=Ae("Star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const lst=Ae("Strikethrough",[["path",{d:"M16 4H9a3 3 0 0 0-2.83 4",key:"43sutm"}],["path",{d:"M14 12a4 4 0 0 1 0 8H6",key:"nlfj13"}],["line",{x1:"4",x2:"20",y1:"12",y2:"12",key:"1e0a9i"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const y9t=Ae("Sun",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const b9t=Ae("SwitchCamera",[["path",{d:"M11 19H4a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2h5",key:"mtk2lu"}],["path",{d:"M13 5h7a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2h-5",key:"120jsl"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"m18 22-3-3 3-3",key:"kgdoj7"}],["path",{d:"m6 2 3 3-3 3",key:"1fnbkv"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ka=Ae("Tag",[["path",{d:"M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z",key:"vktsd0"}],["circle",{cx:"7.5",cy:"7.5",r:".5",fill:"currentColor",key:"kqv944"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const CSe=Ae("Tags",[["path",{d:"m15 5 6.3 6.3a2.4 2.4 0 0 1 0 3.4L17 19",key:"1cbfv1"}],["path",{d:"M9.586 5.586A2 2 0 0 0 8.172 5H3a1 1 0 0 0-1 1v5.172a2 2 0 0 0 .586 1.414L8.29 18.29a2.426 2.426 0 0 0 3.42 0l3.58-3.58a2.426 2.426 0 0 0 0-3.42z",key:"135mg7"}],["circle",{cx:"6.5",cy:"9.5",r:".5",fill:"currentColor",key:"5pm5xn"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const $8=Ae("ThumbsUp",[["path",{d:"M7 10v12",key:"1qc93n"}],["path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z",key:"emmmcr"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const sfe=Ae("TicketX",[["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:"m9.5 14.5 5-5",key:"qviqfa"}],["path",{d:"m9.5 9.5 5 5",key:"18nt4w"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const VP=Ae("Ticket",[["path",{d:"M2 9a3 3 0 0 1 0 6v2a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-2a3 3 0 0 1 0-6V7a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2Z",key:"qn84l0"}],["path",{d:"M13 5v2",key:"dyzc3o"}],["path",{d:"M13 17v2",key:"1ont0d"}],["path",{d:"M13 11v2",key:"1wjjxi"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const x9t=Ae("Timer",[["line",{x1:"10",x2:"14",y1:"2",y2:"2",key:"14vaq8"}],["line",{x1:"12",x2:"15",y1:"14",y2:"11",key:"17fdiu"}],["circle",{cx:"12",cy:"14",r:"8",key:"1e1u0o"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const qn=Ae("Trash2",[["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6",key:"4alrt4"}],["path",{d:"M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2",key:"v07s0e"}],["line",{x1:"10",x2:"10",y1:"11",y2:"17",key:"1uufr5"}],["line",{x1:"14",x2:"14",y1:"11",y2:"17",key:"xtxkd"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const HP=Ae("TrendingUp",[["polyline",{points:"22 7 13.5 15.5 8.5 10.5 2 17",key:"126l90"}],["polyline",{points:"16 7 22 7 22 13",key:"kwv8wd"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Bf=Ae("TriangleAlert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Hg=Ae("Trophy",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const cst=Ae("Truck",[["path",{d:"M14 18V6a2 2 0 0 0-2-2H4a2 2 0 0 0-2 2v11a1 1 0 0 0 1 1h2",key:"wrbu53"}],["path",{d:"M15 18H9",key:"1lyqi6"}],["path",{d:"M19 18h2a1 1 0 0 0 1-1v-3.65a1 1 0 0 0-.22-.624l-3.48-4.35A1 1 0 0 0 17.52 8H14",key:"lysw3i"}],["circle",{cx:"17",cy:"18",r:"2",key:"332jqn"}],["circle",{cx:"7",cy:"18",r:"2",key:"19iecd"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const dst=Ae("Twitter",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ust=Ae("Type",[["polyline",{points:"4 7 4 4 20 4 20 7",key:"1nosan"}],["line",{x1:"9",x2:"15",y1:"20",y2:"20",key:"swin9y"}],["line",{x1:"12",x2:"12",y1:"4",y2:"20",key:"1tx1rr"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const jSe=Ae("Underline",[["path",{d:"M6 4v6a6 6 0 0 0 12 0V4",key:"9kb039"}],["line",{x1:"4",x2:"20",y1:"20",y2:"20",key:"nun2al"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const kd=Ae("Upload",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"17 8 12 3 7 8",key:"t8dd8p"}],["line",{x1:"12",x2:"12",y1:"3",y2:"15",key:"widbto"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ESe=Ae("UserCheck",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const w9t=Ae("UserCog",[["circle",{cx:"18",cy:"15",r:"3",key:"gjjjvw"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M10 15H6a4 4 0 0 0-4 4v2",key:"1nfge6"}],["path",{d:"m21.7 16.4-.9-.3",key:"12j9ji"}],["path",{d:"m15.2 13.9-.9-.3",key:"1fdjdi"}],["path",{d:"m16.6 18.7.3-.9",key:"heedtr"}],["path",{d:"m19.1 12.2.3-.9",key:"1af3ki"}],["path",{d:"m19.6 18.7-.4-1",key:"1x9vze"}],["path",{d:"m16.8 12.3-.4-1",key:"vqeiwj"}],["path",{d:"m14.3 16.6 1-.4",key:"1qlj63"}],["path",{d:"m20.7 13.8 1-.4",key:"1v5t8k"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const O8=Ae("UserMinus",[["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:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Sa=Ae("UserPlus",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const k9t=Ae("UserRound",[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const F8=Ae("UserX",[["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"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const k2=Ae("User",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const oI=Ae("UsersRound",[["path",{d:"M18 21a8 8 0 0 0-16 0",key:"3ypg7q"}],["circle",{cx:"10",cy:"8",r:"5",key:"o932ke"}],["path",{d:"M22 20c0-3.37-2-6.5-4-8a5 5 0 0 0-.45-8.3",key:"10s06x"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const wr=Ae("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const S2=Ae("VideoOff",[["path",{d:"M10.66 6H14a2 2 0 0 1 2 2v2.5l5.248-3.062A.5.5 0 0 1 22 7.87v8.196",key:"w8jjjt"}],["path",{d:"M16 16a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h2",key:"1xawa7"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ca=Ae("Video",[["path",{d:"m16 13 5.223 3.482a.5.5 0 0 0 .777-.416V7.87a.5.5 0 0 0-.752-.432L16 10.5",key:"ftymec"}],["rect",{x:"2",y:"6",width:"14",height:"12",rx:"2",key:"158x01"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const S9t=Ae("Volume1",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const NSe=Ae("Volume2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const C9t=Ae("VolumeX",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const ife=Ae("Webhook",[["path",{d:"M18 16.98h-5.99c-1.1 0-1.95.94-2.48 1.9A4 4 0 0 1 2 17c.01-.7.2-1.4.57-2",key:"q3hayz"}],["path",{d:"m6 17 3.13-5.78c.53-.97.1-2.18-.5-3.1a4 4 0 1 1 6.89-4.06",key:"1go1hn"}],["path",{d:"m12 6 3.13 5.73C15.66 12.7 16.9 13 18 13a4 4 0 0 1 0 8",key:"qlwsc0"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const j9t=Ae("WifiOff",[["path",{d:"M12 20h.01",key:"zekei9"}],["path",{d:"M8.5 16.429a5 5 0 0 1 7 0",key:"1bycff"}],["path",{d:"M5 12.859a10 10 0 0 1 5.17-2.69",key:"1dl1wf"}],["path",{d:"M19 12.859a10 10 0 0 0-2.007-1.523",key:"4k23kn"}],["path",{d:"M2 8.82a15 15 0 0 1 4.177-2.643",key:"1grhjp"}],["path",{d:"M22 8.82a15 15 0 0 0-11.288-3.764",key:"z3jwby"}],["path",{d:"m2 2 20 20",key:"1ooewy"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Pg=Ae("Workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const nn=Ae("X",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const hst=Ae("Youtube",[["path",{d:"M2.5 17a24.12 24.12 0 0 1 0-10 2 2 0 0 1 1.4-1.4 49.56 49.56 0 0 1 16.2 0A2 2 0 0 1 21.5 7a24.12 24.12 0 0 1 0 10 2 2 0 0 1-1.4 1.4 49.55 49.55 0 0 1-16.2 0A2 2 0 0 1 2.5 17",key:"1q2vi4"}],["path",{d:"m10 15 5-3-5-3z",key:"1jp15x"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const Ey=Ae("Zap",[["path",{d:"M4 14a1 1 0 0 1-.78-1.63l9.9-10.2a.5.5 0 0 1 .86.46l-1.92 6.02A1 1 0 0 0 13 10h7a1 1 0 0 1 .78 1.63l-9.9 10.2a.5.5 0 0 1-.86-.46l1.92-6.02A1 1 0 0 0 11 14z",key:"1xq2db"}]]);/**
 * @license lucide-react v0.462.0 - ISC
 *
 * This source code is licensed under the ISC license.
 * See the LICENSE file in the root directory of this source tree.
 */const E9t=Ae("ZoomIn",[["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}],["line",{x1:"21",x2:"16.65",y1:"21",y2:"16.65",key:"13gj7c"}],["line",{x1:"11",x2:"11",y1:"8",y2:"14",key:"1vmskp"}],["line",{x1:"8",x2:"14",y1:"11",y2:"11",key:"durymu"}]]),N9t=1,T9t=400,_9t=6e3;let loe=0;function A9t(){return loe=(loe+1)%Number.MAX_SAFE_INTEGER,loe.toString()}const coe=new Map,GLe=t=>{if(coe.has(t))return;const e=setTimeout(()=>{coe.delete(t),wD({type:"REMOVE_TOAST",toastId:t})},T9t);coe.set(t,e)},P9t=(t,e)=>{switch(e.type){case"ADD_TOAST":return{...t,toasts:[e.toast,...t.toasts].slice(0,N9t)};case"UPDATE_TOAST":return{...t,toasts:t.toasts.map(n=>n.id===e.toast.id?{...n,...e.toast}:n)};case"DISMISS_TOAST":{const{toastId:n}=e;return n?GLe(n):t.toasts.forEach(r=>{GLe(r.id)}),{...t,toasts:t.toasts.map(r=>r.id===n||n===void 0?{...r,open:!1}:r)}}case"REMOVE_TOAST":return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(n=>n.id!==e.toastId)}}},cG=[];let dG={toasts:[]};function wD(t){dG=P9t(dG,t),cG.forEach(e=>{e(dG)})}function wK({...t}){const e=A9t(),n=s=>wD({type:"UPDATE_TOAST",toast:{...s,id:e}}),r=()=>wD({type:"DISMISS_TOAST",toastId:e});return wD({type:"ADD_TOAST",toast:{...t,id:e,open:!0,onOpenChange:s=>{s||r()}}}),{id:e,dismiss:r,update:n}}function yt(){const[t,e]=y.useState(dG);return y.useEffect(()=>(cG.push(e),()=>{const n=cG.indexOf(e);n>-1&&cG.splice(n,1)}),[t]),{...t,toast:wK,dismiss:n=>wD({type:"DISMISS_TOAST",toastId:n})}}function Kt(t,e,{checkForDefaultPrevented:n=!0}={}){return function(s){if(t==null||t(s),n===!1||!s.defaultPrevented)return e==null?void 0:e(s)}}function WLe(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function Gx(...t){return e=>{let n=!1;const r=t.map(s=>{const i=WLe(s,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():WLe(t[s],null)}}}}function Sr(...t){return y.useCallback(Gx(...t),t)}function R9t(t,e){const n=y.createContext(e),r=i=>{const{children:o,...l}=i,c=y.useMemo(()=>l,Object.values(l));return a.jsx(n.Provider,{value:c,children:o})};r.displayName=t+"Provider";function s(i){const o=y.useContext(n);if(o)return o;if(e!==void 0)return e;throw new Error(`\`${i}\` must be used within \`${t}\``)}return[r,s]}function il(t,e=[]){let n=[];function r(i,o){const l=y.createContext(o),c=n.length;n=[...n,o];const d=h=>{var b;const{scope:m,children:f,...p}=h,g=((b=m==null?void 0:m[t])==null?void 0:b[c])||l,v=y.useMemo(()=>p,Object.values(p));return a.jsx(g.Provider,{value:v,children:f})};d.displayName=i+"Provider";function u(h,m){var g;const f=((g=m==null?void 0:m[t])==null?void 0:g[c])||l,p=y.useContext(f);if(p)return p;if(o!==void 0)return o;throw new Error(`\`${h}\` must be used within \`${i}\``)}return[d,u]}const s=()=>{const i=n.map(o=>y.createContext(o));return function(l){const c=(l==null?void 0:l[t])||i;return y.useMemo(()=>({[`__scope${t}`]:{...l,[t]:c}}),[l,c])}};return s.scopeName=t,[r,I9t(s,...e)]}function I9t(...t){const e=t[0];if(t.length===1)return e;const n=()=>{const r=t.map(s=>({useScope:s(),scopeName:s.scopeName}));return function(i){const o=r.reduce((l,{useScope:c,scopeName:d})=>{const h=c(i)[`__scope${d}`];return{...l,...h}},{});return y.useMemo(()=>({[`__scope${e.scopeName}`]:o}),[o])}};return n.scopeName=e.scopeName,n}function Ck(t){const e=M9t(t),n=y.forwardRef((r,s)=>{const{children:i,...o}=r,l=y.Children.toArray(i),c=l.find(L9t);if(c){const d=c.props.children,u=l.map(h=>h===c?y.Children.count(d)>1?y.Children.only(null):y.isValidElement(d)?d.props.children:null:h);return a.jsx(e,{...o,ref:s,children:y.isValidElement(d)?y.cloneElement(d,void 0,u):null})}return a.jsx(e,{...o,ref:s,children:i})});return n.displayName=`${t}.Slot`,n}var TSe=Ck("Slot");function M9t(t){const e=y.forwardRef((n,r)=>{const{children:s,...i}=n;if(y.isValidElement(s)){const o=$9t(s),l=D9t(i,s.props);return s.type!==y.Fragment&&(l.ref=r?Gx(r,o):o),y.cloneElement(s,l)}return y.Children.count(s)>1?y.Children.only(null):null});return e.displayName=`${t}.SlotClone`,e}var mst=Symbol("radix.slottable");function fst(t){const e=({children:n})=>a.jsx(a.Fragment,{children:n});return e.displayName=`${t}.Slottable`,e.__radixId=mst,e}function L9t(t){return y.isValidElement(t)&&typeof t.type=="function"&&"__radixId"in t.type&&t.type.__radixId===mst}function D9t(t,e){const n={...e};for(const r in e){const s=t[r],i=e[r];/^on[A-Z]/.test(r)?s&&i?n[r]=(...l)=>{const c=i(...l);return s(...l),c}:s&&(n[r]=s):r==="style"?n[r]={...s,...i}:r==="className"&&(n[r]=[s,i].filter(Boolean).join(" "))}return{...t,...n}}function $9t(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}function lI(t){const e=t+"CollectionProvider",[n,r]=il(e),[s,i]=n(e,{collectionRef:{current:null},itemMap:new Map}),o=g=>{const{scope:v,children:b}=g,x=se.useRef(null),w=se.useRef(new Map).current;return a.jsx(s,{scope:v,itemMap:w,collectionRef:x,children:b})};o.displayName=e;const l=t+"CollectionSlot",c=Ck(l),d=se.forwardRef((g,v)=>{const{scope:b,children:x}=g,w=i(l,b),k=Sr(v,w.collectionRef);return a.jsx(c,{ref:k,children:x})});d.displayName=l;const u=t+"CollectionItemSlot",h="data-radix-collection-item",m=Ck(u),f=se.forwardRef((g,v)=>{const{scope:b,children:x,...w}=g,k=se.useRef(null),S=Sr(v,k),C=i(u,b);return se.useEffect(()=>(C.itemMap.set(k,{ref:k,...w}),()=>void C.itemMap.delete(k))),a.jsx(m,{[h]:"",ref:S,children:x})});f.displayName=u;function p(g){const v=i(t+"CollectionConsumer",g);return se.useCallback(()=>{const x=v.collectionRef.current;if(!x)return[];const w=Array.from(x.querySelectorAll(`[${h}]`));return Array.from(v.itemMap.values()).sort((C,j)=>w.indexOf(C.ref.current)-w.indexOf(j.ref.current))},[v.collectionRef,v.itemMap])}return[{Provider:o,Slot:d,ItemSlot:f},p,r]}var O9t=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],Sn=O9t.reduce((t,e)=>{const n=Ck(`Primitive.${e}`),r=y.forwardRef((s,i)=>{const{asChild:o,...l}=s,c=o?n:e;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),a.jsx(c,{...l,ref:i})});return r.displayName=`Primitive.${e}`,{...t,[e]:r}},{});function _Se(t,e){t&&Vg.flushSync(()=>t.dispatchEvent(e))}function Lo(t){const e=y.useRef(t);return y.useEffect(()=>{e.current=t}),y.useMemo(()=>(...n)=>{var r;return(r=e.current)==null?void 0:r.call(e,...n)},[])}function F9t(t,e=globalThis==null?void 0:globalThis.document){const n=Lo(t);y.useEffect(()=>{const r=s=>{s.key==="Escape"&&n(s)};return e.addEventListener("keydown",r,{capture:!0}),()=>e.removeEventListener("keydown",r,{capture:!0})},[n,e])}var B9t="DismissableLayer",afe="dismissableLayer.update",U9t="dismissableLayer.pointerDownOutside",z9t="dismissableLayer.focusOutside",qLe,pst=y.createContext({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),SE=y.forwardRef((t,e)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:s,onFocusOutside:i,onInteractOutside:o,onDismiss:l,...c}=t,d=y.useContext(pst),[u,h]=y.useState(null),m=(u==null?void 0:u.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,f]=y.useState({}),p=Sr(e,j=>h(j)),g=Array.from(d.layers),[v]=[...d.layersWithOutsidePointerEventsDisabled].slice(-1),b=g.indexOf(v),x=u?g.indexOf(u):-1,w=d.layersWithOutsidePointerEventsDisabled.size>0,k=x>=b,S=H9t(j=>{const E=j.target,N=[...d.branches].some(A=>A.contains(E));!k||N||(s==null||s(j),o==null||o(j),j.defaultPrevented||l==null||l())},m),C=G9t(j=>{const E=j.target;[...d.branches].some(A=>A.contains(E))||(i==null||i(j),o==null||o(j),j.defaultPrevented||l==null||l())},m);return F9t(j=>{x===d.layers.size-1&&(r==null||r(j),!j.defaultPrevented&&l&&(j.preventDefault(),l()))},m),y.useEffect(()=>{if(u)return n&&(d.layersWithOutsidePointerEventsDisabled.size===0&&(qLe=m.body.style.pointerEvents,m.body.style.pointerEvents="none"),d.layersWithOutsidePointerEventsDisabled.add(u)),d.layers.add(u),KLe(),()=>{n&&d.layersWithOutsidePointerEventsDisabled.size===1&&(m.body.style.pointerEvents=qLe)}},[u,m,n,d]),y.useEffect(()=>()=>{u&&(d.layers.delete(u),d.layersWithOutsidePointerEventsDisabled.delete(u),KLe())},[u,d]),y.useEffect(()=>{const j=()=>f({});return document.addEventListener(afe,j),()=>document.removeEventListener(afe,j)},[]),a.jsx(Sn.div,{...c,ref:p,style:{pointerEvents:w?k?"auto":"none":void 0,...t.style},onFocusCapture:Kt(t.onFocusCapture,C.onFocusCapture),onBlurCapture:Kt(t.onBlurCapture,C.onBlurCapture),onPointerDownCapture:Kt(t.onPointerDownCapture,S.onPointerDownCapture)})});SE.displayName=B9t;var V9t="DismissableLayerBranch",gst=y.forwardRef((t,e)=>{const n=y.useContext(pst),r=y.useRef(null),s=Sr(e,r);return y.useEffect(()=>{const i=r.current;if(i)return n.branches.add(i),()=>{n.branches.delete(i)}},[n.branches]),a.jsx(Sn.div,{...t,ref:s})});gst.displayName=V9t;function H9t(t,e=globalThis==null?void 0:globalThis.document){const n=Lo(t),r=y.useRef(!1),s=y.useRef(()=>{});return y.useEffect(()=>{const i=l=>{if(l.target&&!r.current){let c=function(){vst(U9t,n,d,{discrete:!0})};const d={originalEvent:l};l.pointerType==="touch"?(e.removeEventListener("click",s.current),s.current=c,e.addEventListener("click",s.current,{once:!0})):c()}else e.removeEventListener("click",s.current);r.current=!1},o=window.setTimeout(()=>{e.addEventListener("pointerdown",i)},0);return()=>{window.clearTimeout(o),e.removeEventListener("pointerdown",i),e.removeEventListener("click",s.current)}},[e,n]),{onPointerDownCapture:()=>r.current=!0}}function G9t(t,e=globalThis==null?void 0:globalThis.document){const n=Lo(t),r=y.useRef(!1);return y.useEffect(()=>{const s=i=>{i.target&&!r.current&&vst(z9t,n,{originalEvent:i},{discrete:!1})};return e.addEventListener("focusin",s),()=>e.removeEventListener("focusin",s)},[e,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function KLe(){const t=new CustomEvent(afe);document.dispatchEvent(t)}function vst(t,e,n,{discrete:r}){const s=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?_Se(s,i):s.dispatchEvent(i)}var W9t=SE,q9t=gst,rl=globalThis!=null&&globalThis.document?y.useLayoutEffect:()=>{},K9t="Portal",CE=y.forwardRef((t,e)=>{var l;const{container:n,...r}=t,[s,i]=y.useState(!1);rl(()=>i(!0),[]);const o=n||s&&((l=globalThis==null?void 0:globalThis.document)==null?void 0:l.body);return o?see.createPortal(a.jsx(Sn.div,{...r,ref:e}),o):null});CE.displayName=K9t;function Y9t(t,e){return y.useReducer((n,r)=>e[n][r]??n,t)}var Rl=t=>{const{present:e,children:n}=t,r=Q9t(e),s=typeof n=="function"?n({present:r.isPresent}):y.Children.only(n),i=Sr(r.ref,Z9t(s));return typeof n=="function"||r.isPresent?y.cloneElement(s,{ref:i}):null};Rl.displayName="Presence";function Q9t(t){const[e,n]=y.useState(),r=y.useRef(null),s=y.useRef(t),i=y.useRef("none"),o=t?"mounted":"unmounted",[l,c]=Y9t(o,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}});return y.useEffect(()=>{const d=aU(r.current);i.current=l==="mounted"?d:"none"},[l]),rl(()=>{const d=r.current,u=s.current;if(u!==t){const m=i.current,f=aU(d);t?c("MOUNT"):f==="none"||(d==null?void 0:d.display)==="none"?c("UNMOUNT"):c(u&&m!==f?"ANIMATION_OUT":"UNMOUNT"),s.current=t}},[t,c]),rl(()=>{if(e){let d;const u=e.ownerDocument.defaultView??window,h=f=>{const g=aU(r.current).includes(f.animationName);if(f.target===e&&g&&(c("ANIMATION_END"),!s.current)){const v=e.style.animationFillMode;e.style.animationFillMode="forwards",d=u.setTimeout(()=>{e.style.animationFillMode==="forwards"&&(e.style.animationFillMode=v)})}},m=f=>{f.target===e&&(i.current=aU(r.current))};return e.addEventListener("animationstart",m),e.addEventListener("animationcancel",h),e.addEventListener("animationend",h),()=>{u.clearTimeout(d),e.removeEventListener("animationstart",m),e.removeEventListener("animationcancel",h),e.removeEventListener("animationend",h)}}else c("ANIMATION_END")},[e,c]),{isPresent:["mounted","unmountSuspended"].includes(l),ref:y.useCallback(d=>{r.current=d?getComputedStyle(d):null,n(d)},[])}}function aU(t){return(t==null?void 0:t.animationName)||"none"}function Z9t(t){var r,s;let e=(r=Object.getOwnPropertyDescriptor(t.props,"ref"))==null?void 0:r.get,n=e&&"isReactWarning"in e&&e.isReactWarning;return n?t.ref:(e=(s=Object.getOwnPropertyDescriptor(t,"ref"))==null?void 0:s.get,n=e&&"isReactWarning"in e&&e.isReactWarning,n?t.props.ref:t.props.ref||t.ref)}var J9t=bke[" useInsertionEffect ".trim().toString()]||rl;function Sd({prop:t,defaultProp:e,onChange:n=()=>{},caller:r}){const[s,i,o]=X9t({defaultProp:e,onChange:n}),l=t!==void 0,c=l?t:s;{const u=y.useRef(t!==void 0);y.useEffect(()=>{const h=u.current;h!==l&&console.warn(`${r} is changing from ${h?"controlled":"uncontrolled"} to ${l?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),u.current=l},[l,r])}const d=y.useCallback(u=>{var h;if(l){const m=eUt(u)?u(t):u;m!==t&&((h=o.current)==null||h.call(o,m))}else i(u)},[l,t,i,o]);return[c,d]}function X9t({defaultProp:t,onChange:e}){const[n,r]=y.useState(t),s=y.useRef(n),i=y.useRef(e);return J9t(()=>{i.current=e},[e]),y.useEffect(()=>{var o;s.current!==n&&((o=i.current)==null||o.call(i,n),s.current=n)},[n,s]),[n,r,i]}function eUt(t){return typeof t=="function"}var yst=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),tUt="VisuallyHidden",mee=y.forwardRef((t,e)=>a.jsx(Sn.span,{...t,ref:e,style:{...yst,...t.style}}));mee.displayName=tUt;var nUt=mee,ASe="ToastProvider",[PSe,rUt,sUt]=lI("Toast"),[bst,Kks]=il("Toast",[sUt]),[iUt,fee]=bst(ASe),xst=t=>{const{__scopeToast:e,label:n="Notification",duration:r=5e3,swipeDirection:s="right",swipeThreshold:i=50,children:o}=t,[l,c]=y.useState(null),[d,u]=y.useState(0),h=y.useRef(!1),m=y.useRef(!1);return n.trim()||console.error(`Invalid prop \`label\` supplied to \`${ASe}\`. Expected non-empty \`string\`.`),a.jsx(PSe.Provider,{scope:e,children:a.jsx(iUt,{scope:e,label:n,duration:r,swipeDirection:s,swipeThreshold:i,toastCount:d,viewport:l,onViewportChange:c,onToastAdd:y.useCallback(()=>u(f=>f+1),[]),onToastRemove:y.useCallback(()=>u(f=>f-1),[]),isFocusedToastEscapeKeyDownRef:h,isClosePausedRef:m,children:o})})};xst.displayName=ASe;var wst="ToastViewport",aUt=["F8"],ofe="toast.viewportPause",lfe="toast.viewportResume",kst=y.forwardRef((t,e)=>{const{__scopeToast:n,hotkey:r=aUt,label:s="Notifications ({hotkey})",...i}=t,o=fee(wst,n),l=rUt(n),c=y.useRef(null),d=y.useRef(null),u=y.useRef(null),h=y.useRef(null),m=Sr(e,h,o.onViewportChange),f=r.join("+").replace(/Key/g,"").replace(/Digit/g,""),p=o.toastCount>0;y.useEffect(()=>{const v=b=>{var w;r.length!==0&&r.every(k=>b[k]||b.code===k)&&((w=h.current)==null||w.focus())};return document.addEventListener("keydown",v),()=>document.removeEventListener("keydown",v)},[r]),y.useEffect(()=>{const v=c.current,b=h.current;if(p&&v&&b){const x=()=>{if(!o.isClosePausedRef.current){const C=new CustomEvent(ofe);b.dispatchEvent(C),o.isClosePausedRef.current=!0}},w=()=>{if(o.isClosePausedRef.current){const C=new CustomEvent(lfe);b.dispatchEvent(C),o.isClosePausedRef.current=!1}},k=C=>{!v.contains(C.relatedTarget)&&w()},S=()=>{v.contains(document.activeElement)||w()};return v.addEventListener("focusin",x),v.addEventListener("focusout",k),v.addEventListener("pointermove",x),v.addEventListener("pointerleave",S),window.addEventListener("blur",x),window.addEventListener("focus",w),()=>{v.removeEventListener("focusin",x),v.removeEventListener("focusout",k),v.removeEventListener("pointermove",x),v.removeEventListener("pointerleave",S),window.removeEventListener("blur",x),window.removeEventListener("focus",w)}}},[p,o.isClosePausedRef]);const g=y.useCallback(({tabbingDirection:v})=>{const x=l().map(w=>{const k=w.ref.current,S=[k,...bUt(k)];return v==="forwards"?S:S.reverse()});return(v==="forwards"?x.reverse():x).flat()},[l]);return y.useEffect(()=>{const v=h.current;if(v){const b=x=>{var S,C,j;const w=x.altKey||x.ctrlKey||x.metaKey;if(x.key==="Tab"&&!w){const E=document.activeElement,N=x.shiftKey;if(x.target===v&&N){(S=d.current)==null||S.focus();return}const T=g({tabbingDirection:N?"backwards":"forwards"}),R=T.findIndex(O=>O===E);doe(T.slice(R+1))?x.preventDefault():N?(C=d.current)==null||C.focus():(j=u.current)==null||j.focus()}};return v.addEventListener("keydown",b),()=>v.removeEventListener("keydown",b)}},[l,g]),a.jsxs(q9t,{ref:c,role:"region","aria-label":s.replace("{hotkey}",f),tabIndex:-1,style:{pointerEvents:p?void 0:"none"},children:[p&&a.jsx(cfe,{ref:d,onFocusFromOutsideViewport:()=>{const v=g({tabbingDirection:"forwards"});doe(v)}}),a.jsx(PSe.Slot,{scope:n,children:a.jsx(Sn.ol,{tabIndex:-1,...i,ref:m})}),p&&a.jsx(cfe,{ref:u,onFocusFromOutsideViewport:()=>{const v=g({tabbingDirection:"backwards"});doe(v)}})]})});kst.displayName=wst;var Sst="ToastFocusProxy",cfe=y.forwardRef((t,e)=>{const{__scopeToast:n,onFocusFromOutsideViewport:r,...s}=t,i=fee(Sst,n);return a.jsx(mee,{"aria-hidden":!0,tabIndex:0,...s,ref:e,style:{position:"fixed"},onFocus:o=>{var d;const l=o.relatedTarget;!((d=i.viewport)!=null&&d.contains(l))&&r()}})});cfe.displayName=Sst;var B8="Toast",oUt="toast.swipeStart",lUt="toast.swipeMove",cUt="toast.swipeCancel",dUt="toast.swipeEnd",Cst=y.forwardRef((t,e)=>{const{forceMount:n,open:r,defaultOpen:s,onOpenChange:i,...o}=t,[l,c]=Sd({prop:r,defaultProp:s??!0,onChange:i,caller:B8});return a.jsx(Rl,{present:n||l,children:a.jsx(mUt,{open:l,...o,ref:e,onClose:()=>c(!1),onPause:Lo(t.onPause),onResume:Lo(t.onResume),onSwipeStart:Kt(t.onSwipeStart,d=>{d.currentTarget.setAttribute("data-swipe","start")}),onSwipeMove:Kt(t.onSwipeMove,d=>{const{x:u,y:h}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","move"),d.currentTarget.style.setProperty("--radix-toast-swipe-move-x",`${u}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-move-y",`${h}px`)}),onSwipeCancel:Kt(t.onSwipeCancel,d=>{d.currentTarget.setAttribute("data-swipe","cancel"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-end-y")}),onSwipeEnd:Kt(t.onSwipeEnd,d=>{const{x:u,y:h}=d.detail.delta;d.currentTarget.setAttribute("data-swipe","end"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-x"),d.currentTarget.style.removeProperty("--radix-toast-swipe-move-y"),d.currentTarget.style.setProperty("--radix-toast-swipe-end-x",`${u}px`),d.currentTarget.style.setProperty("--radix-toast-swipe-end-y",`${h}px`),c(!1)})})})});Cst.displayName=B8;var[uUt,hUt]=bst(B8,{onClose(){}}),mUt=y.forwardRef((t,e)=>{const{__scopeToast:n,type:r="foreground",duration:s,open:i,onClose:o,onEscapeKeyDown:l,onPause:c,onResume:d,onSwipeStart:u,onSwipeMove:h,onSwipeCancel:m,onSwipeEnd:f,...p}=t,g=fee(B8,n),[v,b]=y.useState(null),x=Sr(e,O=>b(O)),w=y.useRef(null),k=y.useRef(null),S=s||g.duration,C=y.useRef(0),j=y.useRef(S),E=y.useRef(0),{onToastAdd:N,onToastRemove:A}=g,_=Lo(()=>{var F;(v==null?void 0:v.contains(document.activeElement))&&((F=g.viewport)==null||F.focus()),o()}),T=y.useCallback(O=>{!O||O===1/0||(window.clearTimeout(E.current),C.current=new Date().getTime(),E.current=window.setTimeout(_,O))},[_]);y.useEffect(()=>{const O=g.viewport;if(O){const F=()=>{T(j.current),d==null||d()},D=()=>{const I=new Date().getTime()-C.current;j.current=j.current-I,window.clearTimeout(E.current),c==null||c()};return O.addEventListener(ofe,D),O.addEventListener(lfe,F),()=>{O.removeEventListener(ofe,D),O.removeEventListener(lfe,F)}}},[g.viewport,S,c,d,T]),y.useEffect(()=>{i&&!g.isClosePausedRef.current&&T(S)},[i,S,g.isClosePausedRef,T]),y.useEffect(()=>(N(),()=>A()),[N,A]);const R=y.useMemo(()=>v?Pst(v):null,[v]);return g.viewport?a.jsxs(a.Fragment,{children:[R&&a.jsx(fUt,{__scopeToast:n,role:"status","aria-live":r==="foreground"?"assertive":"polite","aria-atomic":!0,children:R}),a.jsx(uUt,{scope:n,onClose:_,children:Vg.createPortal(a.jsx(PSe.ItemSlot,{scope:n,children:a.jsx(W9t,{asChild:!0,onEscapeKeyDown:Kt(l,()=>{g.isFocusedToastEscapeKeyDownRef.current||_(),g.isFocusedToastEscapeKeyDownRef.current=!1}),children:a.jsx(Sn.li,{role:"status","aria-live":"off","aria-atomic":!0,tabIndex:0,"data-state":i?"open":"closed","data-swipe-direction":g.swipeDirection,...p,ref:x,style:{userSelect:"none",touchAction:"none",...t.style},onKeyDown:Kt(t.onKeyDown,O=>{O.key==="Escape"&&(l==null||l(O.nativeEvent),O.nativeEvent.defaultPrevented||(g.isFocusedToastEscapeKeyDownRef.current=!0,_()))}),onPointerDown:Kt(t.onPointerDown,O=>{O.button===0&&(w.current={x:O.clientX,y:O.clientY})}),onPointerMove:Kt(t.onPointerMove,O=>{if(!w.current)return;const F=O.clientX-w.current.x,D=O.clientY-w.current.y,I=!!k.current,P=["left","right"].includes(g.swipeDirection),M=["left","up"].includes(g.swipeDirection)?Math.min:Math.max,z=P?M(0,F):0,G=P?0:M(0,D),B=O.pointerType==="touch"?10:2,H={x:z,y:G},W={originalEvent:O,delta:H};I?(k.current=H,oU(lUt,h,W,{discrete:!1})):YLe(H,g.swipeDirection,B)?(k.current=H,oU(oUt,u,W,{discrete:!1}),O.target.setPointerCapture(O.pointerId)):(Math.abs(F)>B||Math.abs(D)>B)&&(w.current=null)}),onPointerUp:Kt(t.onPointerUp,O=>{const F=k.current,D=O.target;if(D.hasPointerCapture(O.pointerId)&&D.releasePointerCapture(O.pointerId),k.current=null,w.current=null,F){const I=O.currentTarget,P={originalEvent:O,delta:F};YLe(F,g.swipeDirection,g.swipeThreshold)?oU(dUt,f,P,{discrete:!0}):oU(cUt,m,P,{discrete:!0}),I.addEventListener("click",M=>M.preventDefault(),{once:!0})}})})})}),g.viewport)})]}):null}),fUt=t=>{const{__scopeToast:e,children:n,...r}=t,s=fee(B8,e),[i,o]=y.useState(!1),[l,c]=y.useState(!1);return vUt(()=>o(!0)),y.useEffect(()=>{const d=window.setTimeout(()=>c(!0),1e3);return()=>window.clearTimeout(d)},[]),l?null:a.jsx(CE,{asChild:!0,children:a.jsx(mee,{...r,children:i&&a.jsxs(a.Fragment,{children:[s.label," ",n]})})})},pUt="ToastTitle",jst=y.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return a.jsx(Sn.div,{...r,ref:e})});jst.displayName=pUt;var gUt="ToastDescription",Est=y.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t;return a.jsx(Sn.div,{...r,ref:e})});Est.displayName=gUt;var Nst="ToastAction",Tst=y.forwardRef((t,e)=>{const{altText:n,...r}=t;return n.trim()?a.jsx(Ast,{altText:n,asChild:!0,children:a.jsx(RSe,{...r,ref:e})}):(console.error(`Invalid prop \`altText\` supplied to \`${Nst}\`. Expected non-empty \`string\`.`),null)});Tst.displayName=Nst;var _st="ToastClose",RSe=y.forwardRef((t,e)=>{const{__scopeToast:n,...r}=t,s=hUt(_st,n);return a.jsx(Ast,{asChild:!0,children:a.jsx(Sn.button,{type:"button",...r,ref:e,onClick:Kt(t.onClick,s.onClose)})})});RSe.displayName=_st;var Ast=y.forwardRef((t,e)=>{const{__scopeToast:n,altText:r,...s}=t;return a.jsx(Sn.div,{"data-radix-toast-announce-exclude":"","data-radix-toast-announce-alt":r||void 0,...s,ref:e})});function Pst(t){const e=[];return Array.from(t.childNodes).forEach(r=>{if(r.nodeType===r.TEXT_NODE&&r.textContent&&e.push(r.textContent),yUt(r)){const s=r.ariaHidden||r.hidden||r.style.display==="none",i=r.dataset.radixToastAnnounceExclude==="";if(!s)if(i){const o=r.dataset.radixToastAnnounceAlt;o&&e.push(o)}else e.push(...Pst(r))}}),e}function oU(t,e,n,{discrete:r}){const s=n.originalEvent.currentTarget,i=new CustomEvent(t,{bubbles:!0,cancelable:!0,detail:n});e&&s.addEventListener(t,e,{once:!0}),r?_Se(s,i):s.dispatchEvent(i)}var YLe=(t,e,n=0)=>{const r=Math.abs(t.x),s=Math.abs(t.y),i=r>s;return e==="left"||e==="right"?i&&r>n:!i&&s>n};function vUt(t=()=>{}){const e=Lo(t);rl(()=>{let n=0,r=0;return n=window.requestAnimationFrame(()=>r=window.requestAnimationFrame(e)),()=>{window.cancelAnimationFrame(n),window.cancelAnimationFrame(r)}},[e])}function yUt(t){return t.nodeType===t.ELEMENT_NODE}function bUt(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function doe(t){const e=document.activeElement;return t.some(n=>n===e?!0:(n.focus(),document.activeElement!==e))}var xUt=xst,Rst=kst,Ist=Cst,Mst=jst,Lst=Est,Dst=Tst,$st=RSe;function Ost(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t)){var s=t.length;for(e=0;e<s;e++)t[e]&&(n=Ost(t[e]))&&(r&&(r+=" "),r+=n)}else for(n in t)t[n]&&(r&&(r+=" "),r+=n);return r}function Zn(){for(var t,e,n=0,r="",s=arguments.length;n<s;n++)(t=arguments[n])&&(e=Ost(t))&&(r&&(r+=" "),r+=e);return r}const QLe=t=>typeof t=="boolean"?`${t}`:t===0?"0":t,ZLe=Zn,cI=(t,e)=>n=>{var r;if((e==null?void 0:e.variants)==null)return ZLe(t,n==null?void 0:n.class,n==null?void 0:n.className);const{variants:s,defaultVariants:i}=e,o=Object.keys(s).map(d=>{const u=n==null?void 0:n[d],h=i==null?void 0:i[d];if(u===null)return null;const m=QLe(u)||QLe(h);return s[d][m]}),l=n&&Object.entries(n).reduce((d,u)=>{let[h,m]=u;return m===void 0||(d[h]=m),d},{}),c=e==null||(r=e.compoundVariants)===null||r===void 0?void 0:r.reduce((d,u)=>{let{class:h,className:m,...f}=u;return Object.entries(f).every(p=>{let[g,v]=p;return Array.isArray(v)?v.includes({...i,...l}[g]):{...i,...l}[g]===v})?[...d,h,m]:d},[]);return ZLe(t,o,c,n==null?void 0:n.class,n==null?void 0:n.className)},ISe="-",wUt=t=>{const e=SUt(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;return{getClassGroupId:o=>{const l=o.split(ISe);return l[0]===""&&l.length!==1&&l.shift(),Fst(l,e)||kUt(o)},getConflictingClassGroupIds:(o,l)=>{const c=n[o]||[];return l&&r[o]?[...c,...r[o]]:c}}},Fst=(t,e)=>{var o;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),s=r?Fst(t.slice(1),r):void 0;if(s)return s;if(e.validators.length===0)return;const i=t.join(ISe);return(o=e.validators.find(({validator:l})=>l(i)))==null?void 0:o.classGroupId},JLe=/^\[(.+)\]$/,kUt=t=>{if(JLe.test(t)){const e=JLe.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}},SUt=t=>{const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return jUt(Object.entries(t.classGroups),n).forEach(([i,o])=>{dfe(o,r,i,e)}),r},dfe=(t,e,n,r)=>{t.forEach(s=>{if(typeof s=="string"){const i=s===""?e:XLe(e,s);i.classGroupId=n;return}if(typeof s=="function"){if(CUt(s)){dfe(s(r),e,n,r);return}e.validators.push({validator:s,classGroupId:n});return}Object.entries(s).forEach(([i,o])=>{dfe(o,XLe(e,i),n,r)})})},XLe=(t,e)=>{let n=t;return e.split(ISe).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n},CUt=t=>t.isThemeGetter,jUt=(t,e)=>e?t.map(([n,r])=>{const s=r.map(i=>typeof i=="string"?e+i:typeof i=="object"?Object.fromEntries(Object.entries(i).map(([o,l])=>[e+o,l])):i);return[n,s]}):t,EUt=t=>{if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;const s=(i,o)=>{n.set(i,o),e++,e>t&&(e=0,r=n,n=new Map)};return{get(i){let o=n.get(i);if(o!==void 0)return o;if((o=r.get(i))!==void 0)return s(i,o),o},set(i,o){n.has(i)?n.set(i,o):s(i,o)}}},Bst="!",NUt=t=>{const{separator:e,experimentalParseClassName:n}=t,r=e.length===1,s=e[0],i=e.length,o=l=>{const c=[];let d=0,u=0,h;for(let v=0;v<l.length;v++){let b=l[v];if(d===0){if(b===s&&(r||l.slice(v,v+i)===e)){c.push(l.slice(u,v)),u=v+i;continue}if(b==="/"){h=v;continue}}b==="["?d++:b==="]"&&d--}const m=c.length===0?l:l.substring(u),f=m.startsWith(Bst),p=f?m.substring(1):m,g=h&&h>u?h-u:void 0;return{modifiers:c,hasImportantModifier:f,baseClassName:p,maybePostfixModifierPosition:g}};return n?l=>n({className:l,parseClassName:o}):o},TUt=t=>{if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e},_Ut=t=>({cache:EUt(t.cacheSize),parseClassName:NUt(t),...wUt(t)}),AUt=/\s+/,PUt=(t,e)=>{const{parseClassName:n,getClassGroupId:r,getConflictingClassGroupIds:s}=e,i=[],o=t.trim().split(AUt);let l="";for(let c=o.length-1;c>=0;c-=1){const d=o[c],{modifiers:u,hasImportantModifier:h,baseClassName:m,maybePostfixModifierPosition:f}=n(d);let p=!!f,g=r(p?m.substring(0,f):m);if(!g){if(!p){l=d+(l.length>0?" "+l:l);continue}if(g=r(m),!g){l=d+(l.length>0?" "+l:l);continue}p=!1}const v=TUt(u).join(":"),b=h?v+Bst:v,x=b+g;if(i.includes(x))continue;i.push(x);const w=s(g,p);for(let k=0;k<w.length;++k){const S=w[k];i.push(b+S)}l=d+(l.length>0?" "+l:l)}return l};function RUt(){let t=0,e,n,r="";for(;t<arguments.length;)(e=arguments[t++])&&(n=Ust(e))&&(r&&(r+=" "),r+=n);return r}const Ust=t=>{if(typeof t=="string")return t;let e,n="";for(let r=0;r<t.length;r++)t[r]&&(e=Ust(t[r]))&&(n&&(n+=" "),n+=e);return n};function IUt(t,...e){let n,r,s,i=o;function o(c){const d=e.reduce((u,h)=>h(u),t());return n=_Ut(d),r=n.cache.get,s=n.cache.set,i=l,l(c)}function l(c){const d=r(c);if(d)return d;const u=PUt(c,n);return s(c,u),u}return function(){return i(RUt.apply(null,arguments))}}const Ba=t=>{const e=n=>n[t]||[];return e.isThemeGetter=!0,e},zst=/^\[(?:([a-z-]+):)?(.+)\]$/i,MUt=/^\d+\/\d+$/,LUt=new Set(["px","full","screen"]),DUt=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,$Ut=/\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$/,OUt=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,FUt=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,BUt=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,ub=t=>DA(t)||LUt.has(t)||MUt.test(t),J0=t=>dI(t,"length",KUt),DA=t=>!!t&&!Number.isNaN(Number(t)),uoe=t=>dI(t,"number",DA),yL=t=>!!t&&Number.isInteger(Number(t)),UUt=t=>t.endsWith("%")&&DA(t.slice(0,-1)),Es=t=>zst.test(t),X0=t=>DUt.test(t),zUt=new Set(["length","size","percentage"]),VUt=t=>dI(t,zUt,Vst),HUt=t=>dI(t,"position",Vst),GUt=new Set(["image","url"]),WUt=t=>dI(t,GUt,QUt),qUt=t=>dI(t,"",YUt),bL=()=>!0,dI=(t,e,n)=>{const r=zst.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1},KUt=t=>$Ut.test(t)&&!OUt.test(t),Vst=()=>!1,YUt=t=>FUt.test(t),QUt=t=>BUt.test(t),ZUt=()=>{const t=Ba("colors"),e=Ba("spacing"),n=Ba("blur"),r=Ba("brightness"),s=Ba("borderColor"),i=Ba("borderRadius"),o=Ba("borderSpacing"),l=Ba("borderWidth"),c=Ba("contrast"),d=Ba("grayscale"),u=Ba("hueRotate"),h=Ba("invert"),m=Ba("gap"),f=Ba("gradientColorStops"),p=Ba("gradientColorStopPositions"),g=Ba("inset"),v=Ba("margin"),b=Ba("opacity"),x=Ba("padding"),w=Ba("saturate"),k=Ba("scale"),S=Ba("sepia"),C=Ba("skew"),j=Ba("space"),E=Ba("translate"),N=()=>["auto","contain","none"],A=()=>["auto","hidden","clip","visible","scroll"],_=()=>["auto",Es,e],T=()=>[Es,e],R=()=>["",ub,J0],O=()=>["auto",DA,Es],F=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],D=()=>["solid","dashed","dotted","double","none"],I=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],P=()=>["start","end","center","between","around","evenly","stretch"],M=()=>["","0",Es],z=()=>["auto","avoid","all","avoid-page","page","left","right","column"],G=()=>[DA,Es];return{cacheSize:500,separator:":",theme:{colors:[bL],spacing:[ub,J0],blur:["none","",X0,Es],brightness:G(),borderColor:[t],borderRadius:["none","","full",X0,Es],borderSpacing:T(),borderWidth:R(),contrast:G(),grayscale:M(),hueRotate:G(),invert:M(),gap:T(),gradientColorStops:[t],gradientColorStopPositions:[UUt,J0],inset:_(),margin:_(),opacity:G(),padding:T(),saturate:G(),scale:G(),sepia:M(),skew:G(),space:T(),translate:T()},classGroups:{aspect:[{aspect:["auto","square","video",Es]}],container:["container"],columns:[{columns:[X0]}],"break-after":[{"break-after":z()}],"break-before":[{"break-before":z()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...F(),Es]}],overflow:[{overflow:A()}],"overflow-x":[{"overflow-x":A()}],"overflow-y":[{"overflow-y":A()}],overscroll:[{overscroll:N()}],"overscroll-x":[{"overscroll-x":N()}],"overscroll-y":[{"overscroll-y":N()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",yL,Es]}],basis:[{basis:_()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",Es]}],grow:[{grow:M()}],shrink:[{shrink:M()}],order:[{order:["first","last","none",yL,Es]}],"grid-cols":[{"grid-cols":[bL]}],"col-start-end":[{col:["auto",{span:["full",yL,Es]},Es]}],"col-start":[{"col-start":O()}],"col-end":[{"col-end":O()}],"grid-rows":[{"grid-rows":[bL]}],"row-start-end":[{row:["auto",{span:[yL,Es]},Es]}],"row-start":[{"row-start":O()}],"row-end":[{"row-end":O()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",Es]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",Es]}],gap:[{gap:[m]}],"gap-x":[{"gap-x":[m]}],"gap-y":[{"gap-y":[m]}],"justify-content":[{justify:["normal",...P()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...P(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...P(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[x]}],px:[{px:[x]}],py:[{py:[x]}],ps:[{ps:[x]}],pe:[{pe:[x]}],pt:[{pt:[x]}],pr:[{pr:[x]}],pb:[{pb:[x]}],pl:[{pl:[x]}],m:[{m:[v]}],mx:[{mx:[v]}],my:[{my:[v]}],ms:[{ms:[v]}],me:[{me:[v]}],mt:[{mt:[v]}],mr:[{mr:[v]}],mb:[{mb:[v]}],ml:[{ml:[v]}],"space-x":[{"space-x":[j]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[j]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",Es,e]}],"min-w":[{"min-w":[Es,e,"min","max","fit"]}],"max-w":[{"max-w":[Es,e,"none","full","min","max","fit","prose",{screen:[X0]},X0]}],h:[{h:[Es,e,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[Es,e,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[Es,e,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[Es,e,"auto","min","max","fit"]}],"font-size":[{text:["base",X0,J0]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",uoe]}],"font-family":[{font:[bL]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",Es]}],"line-clamp":[{"line-clamp":["none",DA,uoe]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",ub,Es]}],"list-image":[{"list-image":["none",Es]}],"list-style-type":[{list:["none","disc","decimal",Es]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[b]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[b]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...D(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",ub,J0]}],"underline-offset":[{"underline-offset":["auto",ub,Es]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:T()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",Es]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",Es]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[b]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...F(),HUt]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",VUt]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},WUt]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[p]}],"gradient-via-pos":[{via:[p]}],"gradient-to-pos":[{to:[p]}],"gradient-from":[{from:[f]}],"gradient-via":[{via:[f]}],"gradient-to":[{to:[f]}],rounded:[{rounded:[i]}],"rounded-s":[{"rounded-s":[i]}],"rounded-e":[{"rounded-e":[i]}],"rounded-t":[{"rounded-t":[i]}],"rounded-r":[{"rounded-r":[i]}],"rounded-b":[{"rounded-b":[i]}],"rounded-l":[{"rounded-l":[i]}],"rounded-ss":[{"rounded-ss":[i]}],"rounded-se":[{"rounded-se":[i]}],"rounded-ee":[{"rounded-ee":[i]}],"rounded-es":[{"rounded-es":[i]}],"rounded-tl":[{"rounded-tl":[i]}],"rounded-tr":[{"rounded-tr":[i]}],"rounded-br":[{"rounded-br":[i]}],"rounded-bl":[{"rounded-bl":[i]}],"border-w":[{border:[l]}],"border-w-x":[{"border-x":[l]}],"border-w-y":[{"border-y":[l]}],"border-w-s":[{"border-s":[l]}],"border-w-e":[{"border-e":[l]}],"border-w-t":[{"border-t":[l]}],"border-w-r":[{"border-r":[l]}],"border-w-b":[{"border-b":[l]}],"border-w-l":[{"border-l":[l]}],"border-opacity":[{"border-opacity":[b]}],"border-style":[{border:[...D(),"hidden"]}],"divide-x":[{"divide-x":[l]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[l]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[b]}],"divide-style":[{divide:D()}],"border-color":[{border:[s]}],"border-color-x":[{"border-x":[s]}],"border-color-y":[{"border-y":[s]}],"border-color-s":[{"border-s":[s]}],"border-color-e":[{"border-e":[s]}],"border-color-t":[{"border-t":[s]}],"border-color-r":[{"border-r":[s]}],"border-color-b":[{"border-b":[s]}],"border-color-l":[{"border-l":[s]}],"divide-color":[{divide:[s]}],"outline-style":[{outline:["",...D()]}],"outline-offset":[{"outline-offset":[ub,Es]}],"outline-w":[{outline:[ub,J0]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:R()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[b]}],"ring-offset-w":[{"ring-offset":[ub,J0]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",X0,qUt]}],"shadow-color":[{shadow:[bL]}],opacity:[{opacity:[b]}],"mix-blend":[{"mix-blend":[...I(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":I()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",X0,Es]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[h]}],saturate:[{saturate:[w]}],sepia:[{sepia:[S]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[b]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[S]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",Es]}],duration:[{duration:G()}],ease:[{ease:["linear","in","out","in-out",Es]}],delay:[{delay:G()}],animate:[{animate:["none","spin","ping","pulse","bounce",Es]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[k]}],"scale-x":[{"scale-x":[k]}],"scale-y":[{"scale-y":[k]}],rotate:[{rotate:[yL,Es]}],"translate-x":[{"translate-x":[E]}],"translate-y":[{"translate-y":[E]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",Es]}],accent:[{accent:["auto",t]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",Es]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":T()}],"scroll-mx":[{"scroll-mx":T()}],"scroll-my":[{"scroll-my":T()}],"scroll-ms":[{"scroll-ms":T()}],"scroll-me":[{"scroll-me":T()}],"scroll-mt":[{"scroll-mt":T()}],"scroll-mr":[{"scroll-mr":T()}],"scroll-mb":[{"scroll-mb":T()}],"scroll-ml":[{"scroll-ml":T()}],"scroll-p":[{"scroll-p":T()}],"scroll-px":[{"scroll-px":T()}],"scroll-py":[{"scroll-py":T()}],"scroll-ps":[{"scroll-ps":T()}],"scroll-pe":[{"scroll-pe":T()}],"scroll-pt":[{"scroll-pt":T()}],"scroll-pr":[{"scroll-pr":T()}],"scroll-pb":[{"scroll-pb":T()}],"scroll-pl":[{"scroll-pl":T()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",Es]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[ub,J0,uoe]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}},JUt=IUt(ZUt);function ee(...t){return JUt(Zn(t))}function MSe(t){const e=new Set;return t.filter(n=>n.id?e.has(n.id)?!1:(e.add(n.id),!0):!0)}const XUt=xUt,Hst=y.forwardRef(({className:t,...e},n)=>a.jsx(Rst,{ref:n,className:ee("fixed top-0 right-0 z-[100] flex max-h-screen w-full flex-col gap-2 p-4 md:max-w-[420px]",t),...e}));Hst.displayName=Rst.displayName;const ezt=cI("group pointer-events-auto relative flex w-full items-start gap-3 overflow-hidden rounded-xl border p-4 pr-10 shadow-xl backdrop-blur-sm transition-all data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=closed]:slide-out-to-right-full data-[state=open]:slide-in-from-top-full data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95 data-[state=open]:duration-300",{variants:{variant:{default:"border-primary/15 bg-background/95 text-foreground",destructive:"destructive group border-destructive/30 bg-destructive text-destructive-foreground"}},defaultVariants:{variant:"default"}}),Gst=y.forwardRef(({className:t,variant:e,...n},r)=>a.jsx(Ist,{ref:r,className:ee(ezt({variant:e}),t),...n}));Gst.displayName=Ist.displayName;const Wst=y.forwardRef(({className:t,...e},n)=>a.jsx(Dst,{ref:n,className:ee("inline-flex h-8 shrink-0 items-center justify-center rounded-md border bg-transparent px-3 text-sm font-medium ring-offset-background transition-colors group-[.destructive]:border-muted/40 hover:bg-secondary group-[.destructive]:hover:border-destructive/30 group-[.destructive]:hover:bg-destructive group-[.destructive]:hover:text-destructive-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 group-[.destructive]:focus:ring-destructive disabled:pointer-events-none disabled:opacity-50",t),...e}));Wst.displayName=Dst.displayName;const qst=y.forwardRef(({className:t,...e},n)=>a.jsx($st,{ref:n,className:ee("absolute right-2 top-2 rounded-md p-1 text-foreground/50 opacity-0 transition-opacity group-hover:opacity-100 group-[.destructive]:text-red-300 hover:text-foreground group-[.destructive]:hover:text-red-50 focus:opacity-100 focus:outline-none focus:ring-2 group-[.destructive]:focus:ring-red-400 group-[.destructive]:focus:ring-offset-red-600",t),"toast-close":"",...e,children:a.jsx(nn,{className:"h-4 w-4"})}));qst.displayName=$st.displayName;const Kst=y.forwardRef(({className:t,...e},n)=>a.jsx(Mst,{ref:n,className:ee("text-sm font-semibold",t),...e}));Kst.displayName=Mst.displayName;const Yst=y.forwardRef(({className:t,...e},n)=>a.jsx(Lst,{ref:n,className:ee("text-sm opacity-90",t),...e}));Yst.displayName=Lst.displayName;const tzt=({duration:t,variant:e="default"})=>a.jsx("div",{className:ee("absolute bottom-0 left-0 right-0 h-1 overflow-hidden rounded-b-xl",e==="destructive"?"bg-white/20":"bg-primary/10"),children:a.jsx("div",{className:ee("h-full w-full origin-left animate-toast-progress",e==="destructive"?"bg-white/90":"bg-primary"),style:{animationDuration:`${t}ms`}})});function nzt(){const{toasts:t}=yt();return a.jsxs(XUt,{swipeDirection:"right",children:[t.map(({id:e,title:n,description:r,action:s,duration:i,showProgress:o,variant:l,...c})=>{const d=i??_9t,u=o===!0,h=l==="destructive";return a.jsxs(Gst,{duration:d,variant:l,...c,children:[a.jsx("div",{className:ee("flex h-9 w-9 shrink-0 items-center justify-center rounded-full",h?"bg-white/15":"bg-primary/10"),children:h?a.jsx(tS,{className:ee("h-4 w-4",h&&"text-destructive-foreground")}):a.jsx(Ii,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{className:"grid min-w-0 flex-1 gap-1",children:[n?a.jsx(Kst,{children:n}):null,r?a.jsx(Yst,{children:r}):null]}),s,u?a.jsx(tzt,{duration:d,variant:l??"default"}):null,a.jsx(qst,{})]},e)}),a.jsx(Hst,{})]})}var e3e=["light","dark"],rzt="(prefers-color-scheme: dark)",szt=y.createContext(void 0),izt={setTheme:t=>{},themes:[]},azt=()=>{var t;return(t=y.useContext(szt))!=null?t:izt};y.memo(({forcedTheme:t,storageKey:e,attribute:n,enableSystem:r,enableColorScheme:s,defaultTheme:i,value:o,attrs:l,nonce:c})=>{let d=i==="system",u=n==="class"?`var d=document.documentElement,c=d.classList;${`c.remove(${l.map(p=>`'${p}'`).join(",")})`};`:`var d=document.documentElement,n='${n}',s='setAttribute';`,h=s?e3e.includes(i)&&i?`if(e==='light'||e==='dark'||!e)d.style.colorScheme=e||'${i}'`:"if(e==='light'||e==='dark')d.style.colorScheme=e":"",m=(p,g=!1,v=!0)=>{let b=o?o[p]:p,x=g?p+"|| ''":`'${b}'`,w="";return s&&v&&!g&&e3e.includes(p)&&(w+=`d.style.colorScheme = '${p}';`),n==="class"?g||b?w+=`c.add(${x})`:w+="null":b&&(w+=`d[s](n,${x})`),w},f=t?`!function(){${u}${m(t)}}()`:r?`!function(){try{${u}var e=localStorage.getItem('${e}');if('system'===e||(!e&&${d})){var t='${rzt}',m=window.matchMedia(t);if(m.media!==t||m.matches){${m("dark")}}else{${m("light")}}}else if(e){${o?`var x=${JSON.stringify(o)};`:""}${m(o?"x[e]":"e",!0)}}${d?"":"else{"+m(i,!1,!1)+"}"}${h}}catch(e){}}()`:`!function(){try{${u}var e=localStorage.getItem('${e}');if(e){${o?`var x=${JSON.stringify(o)};`:""}${m(o?"x[e]":"e",!0)}}else{${m(i,!1,!1)};}${h}}catch(t){}}();`;return y.createElement("script",{nonce:c,dangerouslySetInnerHTML:{__html:f}})});var ozt=t=>{switch(t){case"success":return dzt;case"info":return hzt;case"warning":return uzt;case"error":return mzt;default:return null}},lzt=Array(12).fill(0),czt=({visible:t,className:e})=>se.createElement("div",{className:["sonner-loading-wrapper",e].filter(Boolean).join(" "),"data-visible":t},se.createElement("div",{className:"sonner-spinner"},lzt.map((n,r)=>se.createElement("div",{className:"sonner-loading-bar",key:`spinner-bar-${r}`})))),dzt=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zm3.857-9.809a.75.75 0 00-1.214-.882l-3.483 4.79-1.88-1.88a.75.75 0 10-1.06 1.061l2.5 2.5a.75.75 0 001.137-.089l4-5.5z",clipRule:"evenodd"})),uzt=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M9.401 3.003c1.155-2 4.043-2 5.197 0l7.355 12.748c1.154 2-.29 4.5-2.599 4.5H4.645c-2.309 0-3.752-2.5-2.598-4.5L9.4 3.003zM12 8.25a.75.75 0 01.75.75v3.75a.75.75 0 01-1.5 0V9a.75.75 0 01.75-.75zm0 8.25a.75.75 0 100-1.5.75.75 0 000 1.5z",clipRule:"evenodd"})),hzt=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a.75.75 0 000 1.5h.253a.25.25 0 01.244.304l-.459 2.066A1.75 1.75 0 0010.747 15H11a.75.75 0 000-1.5h-.253a.25.25 0 01-.244-.304l.459-2.066A1.75 1.75 0 009.253 9H9z",clipRule:"evenodd"})),mzt=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor",height:"20",width:"20"},se.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-5a.75.75 0 01.75.75v4.5a.75.75 0 01-1.5 0v-4.5A.75.75 0 0110 5zm0 10a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"})),fzt=se.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"},se.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),se.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})),pzt=()=>{let[t,e]=se.useState(document.hidden);return se.useEffect(()=>{let n=()=>{e(document.hidden)};return document.addEventListener("visibilitychange",n),()=>window.removeEventListener("visibilitychange",n)},[]),t},ufe=1,gzt=class{constructor(){this.subscribe=t=>(this.subscribers.push(t),()=>{let e=this.subscribers.indexOf(t);this.subscribers.splice(e,1)}),this.publish=t=>{this.subscribers.forEach(e=>e(t))},this.addToast=t=>{this.publish(t),this.toasts=[...this.toasts,t]},this.create=t=>{var e;let{message:n,...r}=t,s=typeof(t==null?void 0:t.id)=="number"||((e=t.id)==null?void 0:e.length)>0?t.id:ufe++,i=this.toasts.find(l=>l.id===s),o=t.dismissible===void 0?!0:t.dismissible;return this.dismissedToasts.has(s)&&this.dismissedToasts.delete(s),i?this.toasts=this.toasts.map(l=>l.id===s?(this.publish({...l,...t,id:s,title:n}),{...l,...t,id:s,dismissible:o,title:n}):l):this.addToast({title:n,...r,dismissible:o,id:s}),s},this.dismiss=t=>(this.dismissedToasts.add(t),t||this.toasts.forEach(e=>{this.subscribers.forEach(n=>n({id:e.id,dismiss:!0}))}),this.subscribers.forEach(e=>e({id:t,dismiss:!0})),t),this.message=(t,e)=>this.create({...e,message:t}),this.error=(t,e)=>this.create({...e,message:t,type:"error"}),this.success=(t,e)=>this.create({...e,type:"success",message:t}),this.info=(t,e)=>this.create({...e,type:"info",message:t}),this.warning=(t,e)=>this.create({...e,type:"warning",message:t}),this.loading=(t,e)=>this.create({...e,type:"loading",message:t}),this.promise=(t,e)=>{if(!e)return;let n;e.loading!==void 0&&(n=this.create({...e,promise:t,type:"loading",message:e.loading,description:typeof e.description!="function"?e.description:void 0}));let r=t instanceof Promise?t:t(),s=n!==void 0,i,o=r.then(async c=>{if(i=["resolve",c],se.isValidElement(c))s=!1,this.create({id:n,type:"default",message:c});else if(yzt(c)&&!c.ok){s=!1;let d=typeof e.error=="function"?await e.error(`HTTP error! status: ${c.status}`):e.error,u=typeof e.description=="function"?await e.description(`HTTP error! status: ${c.status}`):e.description;this.create({id:n,type:"error",message:d,description:u})}else if(e.success!==void 0){s=!1;let d=typeof e.success=="function"?await e.success(c):e.success,u=typeof e.description=="function"?await e.description(c):e.description;this.create({id:n,type:"success",message:d,description:u})}}).catch(async c=>{if(i=["reject",c],e.error!==void 0){s=!1;let d=typeof e.error=="function"?await e.error(c):e.error,u=typeof e.description=="function"?await e.description(c):e.description;this.create({id:n,type:"error",message:d,description:u})}}).finally(()=>{var c;s&&(this.dismiss(n),n=void 0),(c=e.finally)==null||c.call(e)}),l=()=>new Promise((c,d)=>o.then(()=>i[0]==="reject"?d(i[1]):c(i[1])).catch(d));return typeof n!="string"&&typeof n!="number"?{unwrap:l}:Object.assign(n,{unwrap:l})},this.custom=(t,e)=>{let n=(e==null?void 0:e.id)||ufe++;return this.create({jsx:t(n),id:n,...e}),n},this.getActiveToasts=()=>this.toasts.filter(t=>!this.dismissedToasts.has(t.id)),this.subscribers=[],this.toasts=[],this.dismissedToasts=new Set}},rh=new gzt,vzt=(t,e)=>{let n=(e==null?void 0:e.id)||ufe++;return rh.addToast({title:t,...e,id:n}),n},yzt=t=>t&&typeof t=="object"&&"ok"in t&&typeof t.ok=="boolean"&&"status"in t&&typeof t.status=="number",bzt=vzt,xzt=()=>rh.toasts,wzt=()=>rh.getActiveToasts(),He=Object.assign(bzt,{success:rh.success,info:rh.info,warning:rh.warning,error:rh.error,custom:rh.custom,message:rh.message,promise:rh.promise,dismiss:rh.dismiss,loading:rh.loading},{getHistory:xzt,getToasts:wzt});function kzt(t,{insertAt:e}={}){if(typeof document>"u")return;let n=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css",e==="top"&&n.firstChild?n.insertBefore(r,n.firstChild):n.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}kzt(`:where(html[dir="ltr"]),:where([data-sonner-toaster][dir="ltr"]){--toast-icon-margin-start: -3px;--toast-icon-margin-end: 4px;--toast-svg-margin-start: -1px;--toast-svg-margin-end: 0px;--toast-button-margin-start: auto;--toast-button-margin-end: 0;--toast-close-button-start: 0;--toast-close-button-end: unset;--toast-close-button-transform: translate(-35%, -35%)}:where(html[dir="rtl"]),:where([data-sonner-toaster][dir="rtl"]){--toast-icon-margin-start: 4px;--toast-icon-margin-end: -3px;--toast-svg-margin-start: 0px;--toast-svg-margin-end: -1px;--toast-button-margin-start: 0;--toast-button-margin-end: auto;--toast-close-button-start: unset;--toast-close-button-end: 0;--toast-close-button-transform: translate(35%, -35%)}:where([data-sonner-toaster]){position:fixed;width:var(--width);font-family:ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Arial,Noto Sans,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol,Noto Color Emoji;--gray1: hsl(0, 0%, 99%);--gray2: hsl(0, 0%, 97.3%);--gray3: hsl(0, 0%, 95.1%);--gray4: hsl(0, 0%, 93%);--gray5: hsl(0, 0%, 90.9%);--gray6: hsl(0, 0%, 88.7%);--gray7: hsl(0, 0%, 85.8%);--gray8: hsl(0, 0%, 78%);--gray9: hsl(0, 0%, 56.1%);--gray10: hsl(0, 0%, 52.3%);--gray11: hsl(0, 0%, 43.5%);--gray12: hsl(0, 0%, 9%);--border-radius: 8px;box-sizing:border-box;padding:0;margin:0;list-style:none;outline:none;z-index:999999999;transition:transform .4s ease}:where([data-sonner-toaster][data-lifted="true"]){transform:translateY(-10px)}@media (hover: none) and (pointer: coarse){:where([data-sonner-toaster][data-lifted="true"]){transform:none}}:where([data-sonner-toaster][data-x-position="right"]){right:var(--offset-right)}:where([data-sonner-toaster][data-x-position="left"]){left:var(--offset-left)}:where([data-sonner-toaster][data-x-position="center"]){left:50%;transform:translate(-50%)}:where([data-sonner-toaster][data-y-position="top"]){top:var(--offset-top)}:where([data-sonner-toaster][data-y-position="bottom"]){bottom:var(--offset-bottom)}:where([data-sonner-toast]){--y: translateY(100%);--lift-amount: calc(var(--lift) * var(--gap));z-index:var(--z-index);position:absolute;opacity:0;transform:var(--y);filter:blur(0);touch-action:none;transition:transform .4s,opacity .4s,height .4s,box-shadow .2s;box-sizing:border-box;outline:none;overflow-wrap:anywhere}:where([data-sonner-toast][data-styled="true"]){padding:16px;background:var(--normal-bg);border:1px solid var(--normal-border);color:var(--normal-text);border-radius:var(--border-radius);box-shadow:0 4px 12px #0000001a;width:var(--width);font-size:13px;display:flex;align-items:center;gap:6px}:where([data-sonner-toast]:focus-visible){box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast][data-y-position="top"]){top:0;--y: translateY(-100%);--lift: 1;--lift-amount: calc(1 * var(--gap))}:where([data-sonner-toast][data-y-position="bottom"]){bottom:0;--y: translateY(100%);--lift: -1;--lift-amount: calc(var(--lift) * var(--gap))}:where([data-sonner-toast]) :where([data-description]){font-weight:400;line-height:1.4;color:inherit}:where([data-sonner-toast]) :where([data-title]){font-weight:500;line-height:1.5;color:inherit}:where([data-sonner-toast]) :where([data-icon]){display:flex;height:16px;width:16px;position:relative;justify-content:flex-start;align-items:center;flex-shrink:0;margin-left:var(--toast-icon-margin-start);margin-right:var(--toast-icon-margin-end)}:where([data-sonner-toast][data-promise="true"]) :where([data-icon])>svg{opacity:0;transform:scale(.8);transform-origin:center;animation:sonner-fade-in .3s ease forwards}:where([data-sonner-toast]) :where([data-icon])>*{flex-shrink:0}:where([data-sonner-toast]) :where([data-icon]) svg{margin-left:var(--toast-svg-margin-start);margin-right:var(--toast-svg-margin-end)}:where([data-sonner-toast]) :where([data-content]){display:flex;flex-direction:column;gap:2px}[data-sonner-toast][data-styled=true] [data-button]{border-radius:4px;padding-left:8px;padding-right:8px;height:24px;font-size:12px;color:var(--normal-bg);background:var(--normal-text);margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end);border:none;cursor:pointer;outline:none;display:flex;align-items:center;flex-shrink:0;transition:opacity .4s,box-shadow .2s}:where([data-sonner-toast]) :where([data-button]):focus-visible{box-shadow:0 0 0 2px #0006}:where([data-sonner-toast]) :where([data-button]):first-of-type{margin-left:var(--toast-button-margin-start);margin-right:var(--toast-button-margin-end)}:where([data-sonner-toast]) :where([data-cancel]){color:var(--normal-text);background:rgba(0,0,0,.08)}:where([data-sonner-toast][data-theme="dark"]) :where([data-cancel]){background:rgba(255,255,255,.3)}:where([data-sonner-toast]) :where([data-close-button]){position:absolute;left:var(--toast-close-button-start);right:var(--toast-close-button-end);top:0;height:20px;width:20px;display:flex;justify-content:center;align-items:center;padding:0;color:var(--gray12);border:1px solid var(--gray4);transform:var(--toast-close-button-transform);border-radius:50%;cursor:pointer;z-index:1;transition:opacity .1s,background .2s,border-color .2s}[data-sonner-toast] [data-close-button]{background:var(--gray1)}:where([data-sonner-toast]) :where([data-close-button]):focus-visible{box-shadow:0 4px 12px #0000001a,0 0 0 2px #0003}:where([data-sonner-toast]) :where([data-disabled="true"]){cursor:not-allowed}:where([data-sonner-toast]):hover :where([data-close-button]):hover{background:var(--gray2);border-color:var(--gray5)}:where([data-sonner-toast][data-swiping="true"]):before{content:"";position:absolute;left:-50%;right:-50%;height:100%;z-index:-1}:where([data-sonner-toast][data-y-position="top"][data-swiping="true"]):before{bottom:50%;transform:scaleY(3) translateY(50%)}:where([data-sonner-toast][data-y-position="bottom"][data-swiping="true"]):before{top:50%;transform:scaleY(3) translateY(-50%)}:where([data-sonner-toast][data-swiping="false"][data-removed="true"]):before{content:"";position:absolute;inset:0;transform:scaleY(2)}:where([data-sonner-toast]):after{content:"";position:absolute;left:0;height:calc(var(--gap) + 1px);bottom:100%;width:100%}:where([data-sonner-toast][data-mounted="true"]){--y: translateY(0);opacity:1}:where([data-sonner-toast][data-expanded="false"][data-front="false"]){--scale: var(--toasts-before) * .05 + 1;--y: translateY(calc(var(--lift-amount) * var(--toasts-before))) scale(calc(-1 * var(--scale)));height:var(--front-toast-height)}:where([data-sonner-toast])>*{transition:opacity .4s}:where([data-sonner-toast][data-expanded="false"][data-front="false"][data-styled="true"])>*{opacity:0}:where([data-sonner-toast][data-visible="false"]){opacity:0;pointer-events:none}:where([data-sonner-toast][data-mounted="true"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset)));height:var(--initial-height)}:where([data-sonner-toast][data-removed="true"][data-front="true"][data-swipe-out="false"]){--y: translateY(calc(var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="true"]){--y: translateY(calc(var(--lift) * var(--offset) + var(--lift) * -100%));opacity:0}:where([data-sonner-toast][data-removed="true"][data-front="false"][data-swipe-out="false"][data-expanded="false"]){--y: translateY(40%);opacity:0;transition:transform .5s,opacity .2s}:where([data-sonner-toast][data-removed="true"][data-front="false"]):before{height:calc(var(--initial-height) + 20%)}[data-sonner-toast][data-swiping=true]{transform:var(--y) translateY(var(--swipe-amount-y, 0px)) translate(var(--swipe-amount-x, 0px));transition:none}[data-sonner-toast][data-swiped=true]{user-select:none}[data-sonner-toast][data-swipe-out=true][data-y-position=bottom],[data-sonner-toast][data-swipe-out=true][data-y-position=top]{animation-duration:.2s;animation-timing-function:ease-out;animation-fill-mode:forwards}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=left]{animation-name:swipe-out-left}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=right]{animation-name:swipe-out-right}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=up]{animation-name:swipe-out-up}[data-sonner-toast][data-swipe-out=true][data-swipe-direction=down]{animation-name:swipe-out-down}@keyframes swipe-out-left{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) - 100%));opacity:0}}@keyframes swipe-out-right{0%{transform:var(--y) translate(var(--swipe-amount-x));opacity:1}to{transform:var(--y) translate(calc(var(--swipe-amount-x) + 100%));opacity:0}}@keyframes swipe-out-up{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) - 100%));opacity:0}}@keyframes swipe-out-down{0%{transform:var(--y) translateY(var(--swipe-amount-y));opacity:1}to{transform:var(--y) translateY(calc(var(--swipe-amount-y) + 100%));opacity:0}}@media (max-width: 600px){[data-sonner-toaster]{position:fixed;right:var(--mobile-offset-right);left:var(--mobile-offset-left);width:100%}[data-sonner-toaster][dir=rtl]{left:calc(var(--mobile-offset-left) * -1)}[data-sonner-toaster] [data-sonner-toast]{left:0;right:0;width:calc(100% - var(--mobile-offset-left) * 2)}[data-sonner-toaster][data-x-position=left]{left:var(--mobile-offset-left)}[data-sonner-toaster][data-y-position=bottom]{bottom:var(--mobile-offset-bottom)}[data-sonner-toaster][data-y-position=top]{top:var(--mobile-offset-top)}[data-sonner-toaster][data-x-position=center]{left:var(--mobile-offset-left);right:var(--mobile-offset-right);transform:none}}[data-sonner-toaster][data-theme=light]{--normal-bg: #fff;--normal-border: var(--gray4);--normal-text: var(--gray12);--success-bg: hsl(143, 85%, 96%);--success-border: hsl(145, 92%, 91%);--success-text: hsl(140, 100%, 27%);--info-bg: hsl(208, 100%, 97%);--info-border: hsl(221, 91%, 91%);--info-text: hsl(210, 92%, 45%);--warning-bg: hsl(49, 100%, 97%);--warning-border: hsl(49, 91%, 91%);--warning-text: hsl(31, 92%, 45%);--error-bg: hsl(359, 100%, 97%);--error-border: hsl(359, 100%, 94%);--error-text: hsl(360, 100%, 45%)}[data-sonner-toaster][data-theme=light] [data-sonner-toast][data-invert=true]{--normal-bg: #000;--normal-border: hsl(0, 0%, 20%);--normal-text: var(--gray1)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast][data-invert=true]{--normal-bg: #fff;--normal-border: var(--gray3);--normal-text: var(--gray12)}[data-sonner-toaster][data-theme=dark]{--normal-bg: #000;--normal-bg-hover: hsl(0, 0%, 12%);--normal-border: hsl(0, 0%, 20%);--normal-border-hover: hsl(0, 0%, 25%);--normal-text: var(--gray1);--success-bg: hsl(150, 100%, 6%);--success-border: hsl(147, 100%, 12%);--success-text: hsl(150, 86%, 65%);--info-bg: hsl(215, 100%, 6%);--info-border: hsl(223, 100%, 12%);--info-text: hsl(216, 87%, 65%);--warning-bg: hsl(64, 100%, 6%);--warning-border: hsl(60, 100%, 12%);--warning-text: hsl(46, 87%, 65%);--error-bg: hsl(358, 76%, 10%);--error-border: hsl(357, 89%, 16%);--error-text: hsl(358, 100%, 81%)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]{background:var(--normal-bg);border-color:var(--normal-border);color:var(--normal-text)}[data-sonner-toaster][data-theme=dark] [data-sonner-toast] [data-close-button]:hover{background:var(--normal-bg-hover);border-color:var(--normal-border-hover)}[data-rich-colors=true][data-sonner-toast][data-type=success],[data-rich-colors=true][data-sonner-toast][data-type=success] [data-close-button]{background:var(--success-bg);border-color:var(--success-border);color:var(--success-text)}[data-rich-colors=true][data-sonner-toast][data-type=info],[data-rich-colors=true][data-sonner-toast][data-type=info] [data-close-button]{background:var(--info-bg);border-color:var(--info-border);color:var(--info-text)}[data-rich-colors=true][data-sonner-toast][data-type=warning],[data-rich-colors=true][data-sonner-toast][data-type=warning] [data-close-button]{background:var(--warning-bg);border-color:var(--warning-border);color:var(--warning-text)}[data-rich-colors=true][data-sonner-toast][data-type=error],[data-rich-colors=true][data-sonner-toast][data-type=error] [data-close-button]{background:var(--error-bg);border-color:var(--error-border);color:var(--error-text)}.sonner-loading-wrapper{--size: 16px;height:var(--size);width:var(--size);position:absolute;inset:0;z-index:10}.sonner-loading-wrapper[data-visible=false]{transform-origin:center;animation:sonner-fade-out .2s ease forwards}.sonner-spinner{position:relative;top:50%;left:50%;height:var(--size);width:var(--size)}.sonner-loading-bar{animation:sonner-spin 1.2s linear infinite;background:var(--gray11);border-radius:6px;height:8%;left:-10%;position:absolute;top:-3.9%;width:24%}.sonner-loading-bar:nth-child(1){animation-delay:-1.2s;transform:rotate(.0001deg) translate(146%)}.sonner-loading-bar:nth-child(2){animation-delay:-1.1s;transform:rotate(30deg) translate(146%)}.sonner-loading-bar:nth-child(3){animation-delay:-1s;transform:rotate(60deg) translate(146%)}.sonner-loading-bar:nth-child(4){animation-delay:-.9s;transform:rotate(90deg) translate(146%)}.sonner-loading-bar:nth-child(5){animation-delay:-.8s;transform:rotate(120deg) translate(146%)}.sonner-loading-bar:nth-child(6){animation-delay:-.7s;transform:rotate(150deg) translate(146%)}.sonner-loading-bar:nth-child(7){animation-delay:-.6s;transform:rotate(180deg) translate(146%)}.sonner-loading-bar:nth-child(8){animation-delay:-.5s;transform:rotate(210deg) translate(146%)}.sonner-loading-bar:nth-child(9){animation-delay:-.4s;transform:rotate(240deg) translate(146%)}.sonner-loading-bar:nth-child(10){animation-delay:-.3s;transform:rotate(270deg) translate(146%)}.sonner-loading-bar:nth-child(11){animation-delay:-.2s;transform:rotate(300deg) translate(146%)}.sonner-loading-bar:nth-child(12){animation-delay:-.1s;transform:rotate(330deg) translate(146%)}@keyframes sonner-fade-in{0%{opacity:0;transform:scale(.8)}to{opacity:1;transform:scale(1)}}@keyframes sonner-fade-out{0%{opacity:1;transform:scale(1)}to{opacity:0;transform:scale(.8)}}@keyframes sonner-spin{0%{opacity:1}to{opacity:.15}}@media (prefers-reduced-motion){[data-sonner-toast],[data-sonner-toast]>*,.sonner-loading-bar{transition:none!important;animation:none!important}}.sonner-loader{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);transform-origin:center;transition:opacity .2s,transform .2s}.sonner-loader[data-visible=false]{opacity:0;transform:scale(.8) translate(-50%,-50%)}
`);function lU(t){return t.label!==void 0}var Szt=3,Czt="32px",jzt="16px",t3e=4e3,Ezt=356,Nzt=14,Tzt=20,_zt=200;function up(...t){return t.filter(Boolean).join(" ")}function Azt(t){let[e,n]=t.split("-"),r=[];return e&&r.push(e),n&&r.push(n),r}var Pzt=t=>{var e,n,r,s,i,o,l,c,d,u,h;let{invert:m,toast:f,unstyled:p,interacting:g,setHeights:v,visibleToasts:b,heights:x,index:w,toasts:k,expanded:S,removeToast:C,defaultRichColors:j,closeButton:E,style:N,cancelButtonStyle:A,actionButtonStyle:_,className:T="",descriptionClassName:R="",duration:O,position:F,gap:D,loadingIcon:I,expandByDefault:P,classNames:M,icons:z,closeButtonAriaLabel:G="Close toast",pauseWhenPageIsHidden:B}=t,[H,W]=se.useState(null),[V,U]=se.useState(null),[ne,te]=se.useState(!1),[re,fe]=se.useState(!1),[le,q]=se.useState(!1),[Y,X]=se.useState(!1),[Q,ie]=se.useState(!1),[he,ye]=se.useState(0),[J,K]=se.useState(0),ce=se.useRef(f.duration||O||t3e),pe=se.useRef(null),Ie=se.useRef(null),Me=w===0,we=w+1<=b,Be=f.type,Ve=f.dismissible!==!1,be=f.className||"",Ze=f.descriptionClassName||"",Pe=se.useMemo(()=>x.findIndex(Yt=>Yt.toastId===f.id)||0,[x,f.id]),Ke=se.useMemo(()=>{var Yt;return(Yt=f.closeButton)!=null?Yt:E},[f.closeButton,E]),De=se.useMemo(()=>f.duration||O||t3e,[f.duration,O]),xt=se.useRef(0),Xe=se.useRef(0),tt=se.useRef(0),$e=se.useRef(null),[wt,Ee]=F.split("-"),Ge=se.useMemo(()=>x.reduce((Yt,nr,Kn)=>Kn>=Pe?Yt:Yt+nr.height,0),[x,Pe]),Pt=pzt(),vn=f.invert||m,Hn=Be==="loading";Xe.current=se.useMemo(()=>Pe*D+Ge,[Pe,Ge]),se.useEffect(()=>{ce.current=De},[De]),se.useEffect(()=>{te(!0)},[]),se.useEffect(()=>{let Yt=Ie.current;if(Yt){let nr=Yt.getBoundingClientRect().height;return K(nr),v(Kn=>[{toastId:f.id,height:nr,position:f.position},...Kn]),()=>v(Kn=>Kn.filter(ms=>ms.toastId!==f.id))}},[v,f.id]),se.useLayoutEffect(()=>{if(!ne)return;let Yt=Ie.current,nr=Yt.style.height;Yt.style.height="auto";let Kn=Yt.getBoundingClientRect().height;Yt.style.height=nr,K(Kn),v(ms=>ms.find(is=>is.toastId===f.id)?ms.map(is=>is.toastId===f.id?{...is,height:Kn}:is):[{toastId:f.id,height:Kn,position:f.position},...ms])},[ne,f.title,f.description,v,f.id]);let yr=se.useCallback(()=>{fe(!0),ye(Xe.current),v(Yt=>Yt.filter(nr=>nr.toastId!==f.id)),setTimeout(()=>{C(f)},_zt)},[f,C,v,Xe]);se.useEffect(()=>{if(f.promise&&Be==="loading"||f.duration===1/0||f.type==="loading")return;let Yt;return S||g||B&&Pt?(()=>{if(tt.current<xt.current){let nr=new Date().getTime()-xt.current;ce.current=ce.current-nr}tt.current=new Date().getTime()})():ce.current!==1/0&&(xt.current=new Date().getTime(),Yt=setTimeout(()=>{var nr;(nr=f.onAutoClose)==null||nr.call(f,f),yr()},ce.current)),()=>clearTimeout(Yt)},[S,g,f,Be,B,Pt,yr]),se.useEffect(()=>{f.delete&&yr()},[yr,f.delete]);function br(){var Yt,nr,Kn;return z!=null&&z.loading?se.createElement("div",{className:up(M==null?void 0:M.loader,(Yt=f==null?void 0:f.classNames)==null?void 0:Yt.loader,"sonner-loader"),"data-visible":Be==="loading"},z.loading):I?se.createElement("div",{className:up(M==null?void 0:M.loader,(nr=f==null?void 0:f.classNames)==null?void 0:nr.loader,"sonner-loader"),"data-visible":Be==="loading"},I):se.createElement(czt,{className:up(M==null?void 0:M.loader,(Kn=f==null?void 0:f.classNames)==null?void 0:Kn.loader),visible:Be==="loading"})}return se.createElement("li",{tabIndex:0,ref:Ie,className:up(T,be,M==null?void 0:M.toast,(e=f==null?void 0:f.classNames)==null?void 0:e.toast,M==null?void 0:M.default,M==null?void 0:M[Be],(n=f==null?void 0:f.classNames)==null?void 0:n[Be]),"data-sonner-toast":"","data-rich-colors":(r=f.richColors)!=null?r:j,"data-styled":!(f.jsx||f.unstyled||p),"data-mounted":ne,"data-promise":!!f.promise,"data-swiped":Q,"data-removed":re,"data-visible":we,"data-y-position":wt,"data-x-position":Ee,"data-index":w,"data-front":Me,"data-swiping":le,"data-dismissible":Ve,"data-type":Be,"data-invert":vn,"data-swipe-out":Y,"data-swipe-direction":V,"data-expanded":!!(S||P&&ne),style:{"--index":w,"--toasts-before":w,"--z-index":k.length-w,"--offset":`${re?he:Xe.current}px`,"--initial-height":P?"auto":`${J}px`,...N,...f.style},onDragEnd:()=>{q(!1),W(null),$e.current=null},onPointerDown:Yt=>{Hn||!Ve||(pe.current=new Date,ye(Xe.current),Yt.target.setPointerCapture(Yt.pointerId),Yt.target.tagName!=="BUTTON"&&(q(!0),$e.current={x:Yt.clientX,y:Yt.clientY}))},onPointerUp:()=>{var Yt,nr,Kn,ms;if(Y||!Ve)return;$e.current=null;let is=Number(((Yt=Ie.current)==null?void 0:Yt.style.getPropertyValue("--swipe-amount-x").replace("px",""))||0),ke=Number(((nr=Ie.current)==null?void 0:nr.style.getPropertyValue("--swipe-amount-y").replace("px",""))||0),at=new Date().getTime()-((Kn=pe.current)==null?void 0:Kn.getTime()),Tt=H==="x"?is:ke,An=Math.abs(Tt)/at;if(Math.abs(Tt)>=Tzt||An>.11){ye(Xe.current),(ms=f.onDismiss)==null||ms.call(f,f),U(H==="x"?is>0?"right":"left":ke>0?"down":"up"),yr(),X(!0),ie(!1);return}q(!1),W(null)},onPointerMove:Yt=>{var nr,Kn,ms,is;if(!$e.current||!Ve||((nr=window.getSelection())==null?void 0:nr.toString().length)>0)return;let ke=Yt.clientY-$e.current.y,at=Yt.clientX-$e.current.x,Tt=(Kn=t.swipeDirections)!=null?Kn:Azt(F);!H&&(Math.abs(at)>1||Math.abs(ke)>1)&&W(Math.abs(at)>Math.abs(ke)?"x":"y");let An={x:0,y:0};H==="y"?(Tt.includes("top")||Tt.includes("bottom"))&&(Tt.includes("top")&&ke<0||Tt.includes("bottom")&&ke>0)&&(An.y=ke):H==="x"&&(Tt.includes("left")||Tt.includes("right"))&&(Tt.includes("left")&&at<0||Tt.includes("right")&&at>0)&&(An.x=at),(Math.abs(An.x)>0||Math.abs(An.y)>0)&&ie(!0),(ms=Ie.current)==null||ms.style.setProperty("--swipe-amount-x",`${An.x}px`),(is=Ie.current)==null||is.style.setProperty("--swipe-amount-y",`${An.y}px`)}},Ke&&!f.jsx?se.createElement("button",{"aria-label":G,"data-disabled":Hn,"data-close-button":!0,onClick:Hn||!Ve?()=>{}:()=>{var Yt;yr(),(Yt=f.onDismiss)==null||Yt.call(f,f)},className:up(M==null?void 0:M.closeButton,(s=f==null?void 0:f.classNames)==null?void 0:s.closeButton)},(i=z==null?void 0:z.close)!=null?i:fzt):null,f.jsx||y.isValidElement(f.title)?f.jsx?f.jsx:typeof f.title=="function"?f.title():f.title:se.createElement(se.Fragment,null,Be||f.icon||f.promise?se.createElement("div",{"data-icon":"",className:up(M==null?void 0:M.icon,(o=f==null?void 0:f.classNames)==null?void 0:o.icon)},f.promise||f.type==="loading"&&!f.icon?f.icon||br():null,f.type!=="loading"?f.icon||(z==null?void 0:z[Be])||ozt(Be):null):null,se.createElement("div",{"data-content":"",className:up(M==null?void 0:M.content,(l=f==null?void 0:f.classNames)==null?void 0:l.content)},se.createElement("div",{"data-title":"",className:up(M==null?void 0:M.title,(c=f==null?void 0:f.classNames)==null?void 0:c.title)},typeof f.title=="function"?f.title():f.title),f.description?se.createElement("div",{"data-description":"",className:up(R,Ze,M==null?void 0:M.description,(d=f==null?void 0:f.classNames)==null?void 0:d.description)},typeof f.description=="function"?f.description():f.description):null),y.isValidElement(f.cancel)?f.cancel:f.cancel&&lU(f.cancel)?se.createElement("button",{"data-button":!0,"data-cancel":!0,style:f.cancelButtonStyle||A,onClick:Yt=>{var nr,Kn;lU(f.cancel)&&Ve&&((Kn=(nr=f.cancel).onClick)==null||Kn.call(nr,Yt),yr())},className:up(M==null?void 0:M.cancelButton,(u=f==null?void 0:f.classNames)==null?void 0:u.cancelButton)},f.cancel.label):null,y.isValidElement(f.action)?f.action:f.action&&lU(f.action)?se.createElement("button",{"data-button":!0,"data-action":!0,style:f.actionButtonStyle||_,onClick:Yt=>{var nr,Kn;lU(f.action)&&((Kn=(nr=f.action).onClick)==null||Kn.call(nr,Yt),!Yt.defaultPrevented&&yr())},className:up(M==null?void 0:M.actionButton,(h=f==null?void 0:f.classNames)==null?void 0:h.actionButton)},f.action.label):null))};function n3e(){if(typeof window>"u"||typeof document>"u")return"ltr";let t=document.documentElement.getAttribute("dir");return t==="auto"||!t?window.getComputedStyle(document.documentElement).direction:t}function Rzt(t,e){let n={};return[t,e].forEach((r,s)=>{let i=s===1,o=i?"--mobile-offset":"--offset",l=i?jzt:Czt;function c(d){["top","right","bottom","left"].forEach(u=>{n[`${o}-${u}`]=typeof d=="number"?`${d}px`:d})}typeof r=="number"||typeof r=="string"?c(r):typeof r=="object"?["top","right","bottom","left"].forEach(d=>{r[d]===void 0?n[`${o}-${d}`]=l:n[`${o}-${d}`]=typeof r[d]=="number"?`${r[d]}px`:r[d]}):c(l)}),n}var Izt=y.forwardRef(function(t,e){let{invert:n,position:r="bottom-right",hotkey:s=["altKey","KeyT"],expand:i,closeButton:o,className:l,offset:c,mobileOffset:d,theme:u="light",richColors:h,duration:m,style:f,visibleToasts:p=Szt,toastOptions:g,dir:v=n3e(),gap:b=Nzt,loadingIcon:x,icons:w,containerAriaLabel:k="Notifications",pauseWhenPageIsHidden:S}=t,[C,j]=se.useState([]),E=se.useMemo(()=>Array.from(new Set([r].concat(C.filter(B=>B.position).map(B=>B.position)))),[C,r]),[N,A]=se.useState([]),[_,T]=se.useState(!1),[R,O]=se.useState(!1),[F,D]=se.useState(u!=="system"?u:typeof window<"u"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"),I=se.useRef(null),P=s.join("+").replace(/Key/g,"").replace(/Digit/g,""),M=se.useRef(null),z=se.useRef(!1),G=se.useCallback(B=>{j(H=>{var W;return(W=H.find(V=>V.id===B.id))!=null&&W.delete||rh.dismiss(B.id),H.filter(({id:V})=>V!==B.id)})},[]);return se.useEffect(()=>rh.subscribe(B=>{if(B.dismiss){j(H=>H.map(W=>W.id===B.id?{...W,delete:!0}:W));return}setTimeout(()=>{see.flushSync(()=>{j(H=>{let W=H.findIndex(V=>V.id===B.id);return W!==-1?[...H.slice(0,W),{...H[W],...B},...H.slice(W+1)]:[B,...H]})})})}),[]),se.useEffect(()=>{if(u!=="system"){D(u);return}if(u==="system"&&(window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches?D("dark"):D("light")),typeof window>"u")return;let B=window.matchMedia("(prefers-color-scheme: dark)");try{B.addEventListener("change",({matches:H})=>{D(H?"dark":"light")})}catch{B.addListener(({matches:W})=>{try{D(W?"dark":"light")}catch(V){console.error(V)}})}},[u]),se.useEffect(()=>{C.length<=1&&T(!1)},[C]),se.useEffect(()=>{let B=H=>{var W,V;s.every(U=>H[U]||H.code===U)&&(T(!0),(W=I.current)==null||W.focus()),H.code==="Escape"&&(document.activeElement===I.current||(V=I.current)!=null&&V.contains(document.activeElement))&&T(!1)};return document.addEventListener("keydown",B),()=>document.removeEventListener("keydown",B)},[s]),se.useEffect(()=>{if(I.current)return()=>{M.current&&(M.current.focus({preventScroll:!0}),M.current=null,z.current=!1)}},[I.current]),se.createElement("section",{ref:e,"aria-label":`${k} ${P}`,tabIndex:-1,"aria-live":"polite","aria-relevant":"additions text","aria-atomic":"false",suppressHydrationWarning:!0},E.map((B,H)=>{var W;let[V,U]=B.split("-");return C.length?se.createElement("ol",{key:B,dir:v==="auto"?n3e():v,tabIndex:-1,ref:I,className:l,"data-sonner-toaster":!0,"data-theme":F,"data-y-position":V,"data-lifted":_&&C.length>1&&!i,"data-x-position":U,style:{"--front-toast-height":`${((W=N[0])==null?void 0:W.height)||0}px`,"--width":`${Ezt}px`,"--gap":`${b}px`,...f,...Rzt(c,d)},onBlur:ne=>{z.current&&!ne.currentTarget.contains(ne.relatedTarget)&&(z.current=!1,M.current&&(M.current.focus({preventScroll:!0}),M.current=null))},onFocus:ne=>{ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false"||z.current||(z.current=!0,M.current=ne.relatedTarget)},onMouseEnter:()=>T(!0),onMouseMove:()=>T(!0),onMouseLeave:()=>{R||T(!1)},onDragEnd:()=>T(!1),onPointerDown:ne=>{ne.target instanceof HTMLElement&&ne.target.dataset.dismissible==="false"||O(!0)},onPointerUp:()=>O(!1)},C.filter(ne=>!ne.position&&H===0||ne.position===B).map((ne,te)=>{var re,fe;return se.createElement(Pzt,{key:ne.id,icons:w,index:te,toast:ne,defaultRichColors:h,duration:(re=g==null?void 0:g.duration)!=null?re:m,className:g==null?void 0:g.className,descriptionClassName:g==null?void 0:g.descriptionClassName,invert:n,visibleToasts:p,closeButton:(fe=g==null?void 0:g.closeButton)!=null?fe:o,interacting:R,position:B,style:g==null?void 0:g.style,unstyled:g==null?void 0:g.unstyled,classNames:g==null?void 0:g.classNames,cancelButtonStyle:g==null?void 0:g.cancelButtonStyle,actionButtonStyle:g==null?void 0:g.actionButtonStyle,removeToast:G,toasts:C.filter(le=>le.position==ne.position),heights:N.filter(le=>le.position==ne.position),setHeights:A,expandByDefault:i,gap:b,loadingIcon:x,expanded:_,pauseWhenPageIsHidden:S,swipeDirections:t.swipeDirections})})):null}))});const Mzt=({...t})=>{const{theme:e="system"}=azt();return a.jsx(Izt,{theme:e,className:"toaster group",toastOptions:{classNames:{toast:"group toast group-[.toaster]:bg-background group-[.toaster]:text-foreground group-[.toaster]:border-border group-[.toaster]:shadow-lg",description:"group-[.toast]:text-muted-foreground",actionButton:"group-[.toast]:bg-primary group-[.toast]:text-primary-foreground",cancelButton:"group-[.toast]:bg-muted group-[.toast]:text-muted-foreground"}},...t})};var Lzt=bke[" useId ".trim().toString()]||(()=>{}),Dzt=0;function el(t){const[e,n]=y.useState(Lzt());return rl(()=>{n(r=>r??String(Dzt++))},[t]),e?`radix-${e}`:""}const $zt=["top","right","bottom","left"],jk=Math.min,om=Math.max,kK=Math.round,cU=Math.floor,uy=t=>({x:t,y:t}),Ozt={left:"right",right:"left",bottom:"top",top:"bottom"};function hfe(t,e,n){return om(t,jk(e,n))}function Wx(t,e){return typeof t=="function"?t(e):t}function qx(t){return t.split("-")[0]}function uI(t){return t.split("-")[1]}function LSe(t){return t==="x"?"y":"x"}function DSe(t){return t==="y"?"height":"width"}function Zv(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function $Se(t){return LSe(Zv(t))}function Fzt(t,e,n){n===void 0&&(n=!1);const r=uI(t),s=$Se(t),i=DSe(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=SK(o)),[o,SK(o)]}function Bzt(t){const e=SK(t);return[mfe(t),e,mfe(e)]}function mfe(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const r3e=["left","right"],s3e=["right","left"],Uzt=["top","bottom"],zzt=["bottom","top"];function Vzt(t,e,n){switch(t){case"top":case"bottom":return n?e?s3e:r3e:e?r3e:s3e;case"left":case"right":return e?Uzt:zzt;default:return[]}}function Hzt(t,e,n,r){const s=uI(t);let i=Vzt(qx(t),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),e&&(i=i.concat(i.map(mfe)))),i}function SK(t){const e=qx(t);return Ozt[e]+t.slice(e.length)}function Gzt(t){return{top:0,right:0,bottom:0,left:0,...t}}function Qst(t){return typeof t!="number"?Gzt(t):{top:t,right:t,bottom:t,left:t}}function CK(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function i3e(t,e,n){let{reference:r,floating:s}=t;const i=Zv(e),o=$Se(e),l=DSe(o),c=qx(e),d=i==="y",u=r.x+r.width/2-s.width/2,h=r.y+r.height/2-s.height/2,m=r[l]/2-s[l]/2;let f;switch(c){case"top":f={x:u,y:r.y-s.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:h};break;case"left":f={x:r.x-s.width,y:h};break;default:f={x:r.x,y:r.y}}switch(uI(e)){case"start":f[o]-=m*(n&&d?-1:1);break;case"end":f[o]+=m*(n&&d?-1:1);break}return f}async function Wzt(t,e){var n;e===void 0&&(e={});const{x:r,y:s,platform:i,rects:o,elements:l,strategy:c}=t,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:m=!1,padding:f=0}=Wx(e,t),p=Qst(f),v=l[m?h==="floating"?"reference":"floating":h],b=CK(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:d,rootBoundary:u,strategy:c})),x=h==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),k=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},S=CK(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:x,offsetParent:w,strategy:c}):x);return{top:(b.top-S.top+p.top)/k.y,bottom:(S.bottom-b.bottom+p.bottom)/k.y,left:(b.left-S.left+p.left)/k.x,right:(S.right-b.right+p.right)/k.x}}const qzt=50,Kzt=async(t,e,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:Wzt},c=await(o.isRTL==null?void 0:o.isRTL(e));let d=await o.getElementRects({reference:t,floating:e,strategy:s}),{x:u,y:h}=i3e(d,r,c),m=r,f=0;const p={};for(let g=0;g<i.length;g++){const v=i[g];if(!v)continue;const{name:b,fn:x}=v,{x:w,y:k,data:S,reset:C}=await x({x:u,y:h,initialPlacement:r,placement:m,strategy:s,middlewareData:p,rects:d,platform:l,elements:{reference:t,floating:e}});u=w??u,h=k??h,p[b]={...p[b],...S},C&&f<qzt&&(f++,typeof C=="object"&&(C.placement&&(m=C.placement),C.rects&&(d=C.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:s}):C.rects),{x:u,y:h}=i3e(d,m,c)),g=-1)}return{x:u,y:h,placement:m,strategy:s,middlewareData:p}},Yzt=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:s,rects:i,platform:o,elements:l,middlewareData:c}=e,{element:d,padding:u=0}=Wx(t,e)||{};if(d==null)return{};const h=Qst(u),m={x:n,y:r},f=$Se(s),p=DSe(f),g=await o.getDimensions(d),v=f==="y",b=v?"top":"left",x=v?"bottom":"right",w=v?"clientHeight":"clientWidth",k=i.reference[p]+i.reference[f]-m[f]-i.floating[p],S=m[f]-i.reference[f],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let j=C?C[w]:0;(!j||!await(o.isElement==null?void 0:o.isElement(C)))&&(j=l.floating[w]||i.floating[p]);const E=k/2-S/2,N=j/2-g[p]/2-1,A=jk(h[b],N),_=jk(h[x],N),T=A,R=j-g[p]-_,O=j/2-g[p]/2+E,F=hfe(T,O,R),D=!c.arrow&&uI(s)!=null&&O!==F&&i.reference[p]/2-(O<T?A:_)-g[p]/2<0,I=D?O<T?O-T:O-R:0;return{[f]:m[f]+I,data:{[f]:F,centerOffset:O-F-I,...D&&{alignmentOffset:I}},reset:D}}}),Qzt=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:l,platform:c,elements:d}=e,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...v}=Wx(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=qx(s),x=Zv(l),w=qx(l)===l,k=await(c.isRTL==null?void 0:c.isRTL(d.floating)),S=m||(w||!g?[SK(l)]:Bzt(l)),C=p!=="none";!m&&C&&S.push(...Hzt(l,g,p,k));const j=[l,...S],E=await c.detectOverflow(e,v),N=[];let A=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&N.push(E[b]),h){const O=Fzt(s,o,k);N.push(E[O[0]],E[O[1]])}if(A=[...A,{placement:s,overflows:N}],!N.every(O=>O<=0)){var _,T;const O=(((_=i.flip)==null?void 0:_.index)||0)+1,F=j[O];if(F&&(!(h==="alignment"?x!==Zv(F):!1)||A.every(P=>Zv(P.placement)===x?P.overflows[0]>0:!0)))return{data:{index:O,overflows:A},reset:{placement:F}};let D=(T=A.filter(I=>I.overflows[0]<=0).sort((I,P)=>I.overflows[1]-P.overflows[1])[0])==null?void 0:T.placement;if(!D)switch(f){case"bestFit":{var R;const I=(R=A.filter(P=>{if(C){const M=Zv(P.placement);return M===x||M==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(M=>M>0).reduce((M,z)=>M+z,0)]).sort((P,M)=>P[1]-M[1])[0])==null?void 0:R[0];I&&(D=I);break}case"initialPlacement":D=l;break}if(s!==D)return{reset:{placement:D}}}return{}}}};function a3e(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function o3e(t){return $zt.some(e=>t[e]>=0)}const Zzt=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:s="referenceHidden",...i}=Wx(t,e);switch(s){case"referenceHidden":{const o=await r.detectOverflow(e,{...i,elementContext:"reference"}),l=a3e(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:o3e(l)}}}case"escaped":{const o=await r.detectOverflow(e,{...i,altBoundary:!0}),l=a3e(o,n.floating);return{data:{escapedOffsets:l,escaped:o3e(l)}}}default:return{}}}}},Zst=new Set(["left","top"]);async function Jzt(t,e){const{placement:n,platform:r,elements:s}=t,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=qx(n),l=uI(n),c=Zv(n)==="y",d=Zst.has(o)?-1:1,u=i&&c?-1:1,h=Wx(e,t);let{mainAxis:m,crossAxis:f,alignmentAxis:p}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof p=="number"&&(f=l==="end"?p*-1:p),c?{x:f*u,y:m*d}:{x:m*d,y:f*u}}const Xzt=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:s,y:i,placement:o,middlewareData:l}=e,c=await Jzt(e,t);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:o}}}}},eVt=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:s,platform:i}=e,{mainAxis:o=!0,crossAxis:l=!1,limiter:c={fn:b=>{let{x,y:w}=b;return{x,y:w}}},...d}=Wx(t,e),u={x:n,y:r},h=await i.detectOverflow(e,d),m=Zv(qx(s)),f=LSe(m);let p=u[f],g=u[m];if(o){const b=f==="y"?"top":"left",x=f==="y"?"bottom":"right",w=p+h[b],k=p-h[x];p=hfe(w,p,k)}if(l){const b=m==="y"?"top":"left",x=m==="y"?"bottom":"right",w=g+h[b],k=g-h[x];g=hfe(w,g,k)}const v=c.fn({...e,[f]:p,[m]:g});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[f]:o,[m]:l}}}}}},tVt=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:s,rects:i,middlewareData:o}=e,{offset:l=0,mainAxis:c=!0,crossAxis:d=!0}=Wx(t,e),u={x:n,y:r},h=Zv(s),m=LSe(h);let f=u[m],p=u[h];const g=Wx(l,e),v=typeof g=="number"?{mainAxis:g,crossAxis:0}:{mainAxis:0,crossAxis:0,...g};if(c){const w=m==="y"?"height":"width",k=i.reference[m]-i.floating[w]+v.mainAxis,S=i.reference[m]+i.reference[w]-v.mainAxis;f<k?f=k:f>S&&(f=S)}if(d){var b,x;const w=m==="y"?"width":"height",k=Zst.has(qx(s)),S=i.reference[h]-i.floating[w]+(k&&((b=o.offset)==null?void 0:b[h])||0)+(k?0:v.crossAxis),C=i.reference[h]+i.reference[w]+(k?0:((x=o.offset)==null?void 0:x[h])||0)-(k?v.crossAxis:0);p<S?p=S:p>C&&(p=C)}return{[m]:f,[h]:p}}}},nVt=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:s,rects:i,platform:o,elements:l}=e,{apply:c=()=>{},...d}=Wx(t,e),u=await o.detectOverflow(e,d),h=qx(s),m=uI(s),f=Zv(s)==="y",{width:p,height:g}=i.floating;let v,b;h==="top"||h==="bottom"?(v=h,b=m===(await(o.isRTL==null?void 0:o.isRTL(l.floating))?"start":"end")?"left":"right"):(b=h,v=m==="end"?"top":"bottom");const x=g-u.top-u.bottom,w=p-u.left-u.right,k=jk(g-u[v],x),S=jk(p-u[b],w),C=!e.middlewareData.shift;let j=k,E=S;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(E=w),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(j=x),C&&!m){const A=om(u.left,0),_=om(u.right,0),T=om(u.top,0),R=om(u.bottom,0);f?E=p-2*(A!==0||_!==0?A+_:om(u.left,u.right)):j=g-2*(T!==0||R!==0?T+R:om(u.top,u.bottom))}await c({...e,availableWidth:E,availableHeight:j});const N=await o.getDimensions(l.floating);return p!==N.width||g!==N.height?{reset:{rects:!0}}:{}}}};function pee(){return typeof window<"u"}function hI(t){return Jst(t)?(t.nodeName||"").toLowerCase():"#document"}function bm(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function By(t){var e;return(e=(Jst(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function Jst(t){return pee()?t instanceof Node||t instanceof bm(t).Node:!1}function Rg(t){return pee()?t instanceof Element||t instanceof bm(t).Element:!1}function S0(t){return pee()?t instanceof HTMLElement||t instanceof bm(t).HTMLElement:!1}function l3e(t){return!pee()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof bm(t).ShadowRoot}function U8(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=Ig(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&s!=="inline"&&s!=="contents"}function rVt(t){return/^(table|td|th)$/.test(hI(t))}function gee(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const sVt=/transform|translate|scale|rotate|perspective|filter/,iVt=/paint|layout|strict|content/,GS=t=>!!t&&t!=="none";let hoe;function OSe(t){const e=Rg(t)?Ig(t):t;return GS(e.transform)||GS(e.translate)||GS(e.scale)||GS(e.rotate)||GS(e.perspective)||!FSe()&&(GS(e.backdropFilter)||GS(e.filter))||sVt.test(e.willChange||"")||iVt.test(e.contain||"")}function aVt(t){let e=Ek(t);for(;S0(e)&&!GP(e);){if(OSe(e))return e;if(gee(e))return null;e=Ek(e)}return null}function FSe(){return hoe==null&&(hoe=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),hoe}function GP(t){return/^(html|body|#document)$/.test(hI(t))}function Ig(t){return bm(t).getComputedStyle(t)}function vee(t){return Rg(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ek(t){if(hI(t)==="html")return t;const e=t.assignedSlot||t.parentNode||l3e(t)&&t.host||By(t);return l3e(e)?e.host:e}function Xst(t){const e=Ek(t);return GP(e)?t.ownerDocument?t.ownerDocument.body:t.body:S0(e)&&U8(e)?e:Xst(e)}function xO(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const s=Xst(t),i=s===((r=t.ownerDocument)==null?void 0:r.body),o=bm(s);if(i){const l=ffe(o);return e.concat(o,o.visualViewport||[],U8(s)?s:[],l&&n?xO(l):[])}else return e.concat(s,xO(s,[],n))}function ffe(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function eit(t){const e=Ig(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=S0(t),i=s?t.offsetWidth:n,o=s?t.offsetHeight:r,l=kK(n)!==i||kK(r)!==o;return l&&(n=i,r=o),{width:n,height:r,$:l}}function BSe(t){return Rg(t)?t:t.contextElement}function $A(t){const e=BSe(t);if(!S0(e))return uy(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:i}=eit(e);let o=(i?kK(n.width):n.width)/r,l=(i?kK(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const oVt=uy(0);function tit(t){const e=bm(t);return!FSe()||!e.visualViewport?oVt:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function lVt(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==bm(t)?!1:e}function C2(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=BSe(t);let o=uy(1);e&&(r?Rg(r)&&(o=$A(r)):o=$A(t));const l=lVt(i,n,r)?tit(i):uy(0);let c=(s.left+l.x)/o.x,d=(s.top+l.y)/o.y,u=s.width/o.x,h=s.height/o.y;if(i){const m=bm(i),f=r&&Rg(r)?bm(r):r;let p=m,g=ffe(p);for(;g&&r&&f!==p;){const v=$A(g),b=g.getBoundingClientRect(),x=Ig(g),w=b.left+(g.clientLeft+parseFloat(x.paddingLeft))*v.x,k=b.top+(g.clientTop+parseFloat(x.paddingTop))*v.y;c*=v.x,d*=v.y,u*=v.x,h*=v.y,c+=w,d+=k,p=bm(g),g=ffe(p)}}return CK({width:u,height:h,x:c,y:d})}function yee(t,e){const n=vee(t).scrollLeft;return e?e.left+n:C2(By(t)).left+n}function nit(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-yee(t,n),s=n.top+e.scrollTop;return{x:r,y:s}}function cVt(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const i=s==="fixed",o=By(r),l=e?gee(e.floating):!1;if(r===o||l&&i)return n;let c={scrollLeft:0,scrollTop:0},d=uy(1);const u=uy(0),h=S0(r);if((h||!h&&!i)&&((hI(r)!=="body"||U8(o))&&(c=vee(r)),h)){const f=C2(r);d=$A(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}const m=o&&!h&&!i?nit(o,c):uy(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+u.x+m.x,y:n.y*d.y-c.scrollTop*d.y+u.y+m.y}}function dVt(t){return Array.from(t.getClientRects())}function uVt(t){const e=By(t),n=vee(t),r=t.ownerDocument.body,s=om(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=om(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+yee(t);const l=-n.scrollTop;return Ig(r).direction==="rtl"&&(o+=om(e.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:l}}const c3e=25;function hVt(t,e){const n=bm(t),r=By(t),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,l=0,c=0;if(s){i=s.width,o=s.height;const u=FSe();(!u||u&&e==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const d=yee(r);if(d<=0){const u=r.ownerDocument,h=u.body,m=getComputedStyle(h),f=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,p=Math.abs(r.clientWidth-h.clientWidth-f);p<=c3e&&(i-=p)}else d<=c3e&&(i+=d);return{width:i,height:o,x:l,y:c}}function mVt(t,e){const n=C2(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,i=S0(t)?$A(t):uy(1),o=t.clientWidth*i.x,l=t.clientHeight*i.y,c=s*i.x,d=r*i.y;return{width:o,height:l,x:c,y:d}}function d3e(t,e,n){let r;if(e==="viewport")r=hVt(t,n);else if(e==="document")r=uVt(By(t));else if(Rg(e))r=mVt(e,n);else{const s=tit(t);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return CK(r)}function rit(t,e){const n=Ek(t);return n===e||!Rg(n)||GP(n)?!1:Ig(n).position==="fixed"||rit(n,e)}function fVt(t,e){const n=e.get(t);if(n)return n;let r=xO(t,[],!1).filter(l=>Rg(l)&&hI(l)!=="body"),s=null;const i=Ig(t).position==="fixed";let o=i?Ek(t):t;for(;Rg(o)&&!GP(o);){const l=Ig(o),c=OSe(o);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||U8(o)&&!c&&rit(t,o))?r=r.filter(u=>u!==o):s=l,o=Ek(o)}return e.set(t,r),r}function pVt(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const o=[...n==="clippingAncestors"?gee(e)?[]:fVt(e,this._c):[].concat(n),r],l=d3e(e,o[0],s);let c=l.top,d=l.right,u=l.bottom,h=l.left;for(let m=1;m<o.length;m++){const f=d3e(e,o[m],s);c=om(f.top,c),d=jk(f.right,d),u=jk(f.bottom,u),h=om(f.left,h)}return{width:d-h,height:u-c,x:h,y:c}}function gVt(t){const{width:e,height:n}=eit(t);return{width:e,height:n}}function vVt(t,e,n){const r=S0(e),s=By(e),i=n==="fixed",o=C2(t,!0,i,e);let l={scrollLeft:0,scrollTop:0};const c=uy(0);function d(){c.x=yee(s)}if(r||!r&&!i)if((hI(e)!=="body"||U8(s))&&(l=vee(e)),r){const f=C2(e,!0,i,e);c.x=f.x+e.clientLeft,c.y=f.y+e.clientTop}else s&&d();i&&!r&&s&&d();const u=s&&!r&&!i?nit(s,l):uy(0),h=o.left+l.scrollLeft-c.x-u.x,m=o.top+l.scrollTop-c.y-u.y;return{x:h,y:m,width:o.width,height:o.height}}function moe(t){return Ig(t).position==="static"}function u3e(t,e){if(!S0(t)||Ig(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return By(t)===n&&(n=n.ownerDocument.body),n}function sit(t,e){const n=bm(t);if(gee(t))return n;if(!S0(t)){let s=Ek(t);for(;s&&!GP(s);){if(Rg(s)&&!moe(s))return s;s=Ek(s)}return n}let r=u3e(t,e);for(;r&&rVt(r)&&moe(r);)r=u3e(r,e);return r&&GP(r)&&moe(r)&&!OSe(r)?n:r||aVt(t)||n}const yVt=async function(t){const e=this.getOffsetParent||sit,n=this.getDimensions,r=await n(t.floating);return{reference:vVt(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function bVt(t){return Ig(t).direction==="rtl"}const xVt={convertOffsetParentRelativeRectToViewportRelativeRect:cVt,getDocumentElement:By,getClippingRect:pVt,getOffsetParent:sit,getElementRects:yVt,getClientRects:dVt,getDimensions:gVt,getScale:$A,isElement:Rg,isRTL:bVt};function iit(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function wVt(t,e){let n=null,r;const s=By(t);function i(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function o(l,c){l===void 0&&(l=!1),c===void 0&&(c=1),i();const d=t.getBoundingClientRect(),{left:u,top:h,width:m,height:f}=d;if(l||e(),!m||!f)return;const p=cU(h),g=cU(s.clientWidth-(u+m)),v=cU(s.clientHeight-(h+f)),b=cU(u),w={rootMargin:-p+"px "+-g+"px "+-v+"px "+-b+"px",threshold:om(0,jk(1,c))||1};let k=!0;function S(C){const j=C[0].intersectionRatio;if(j!==c){if(!k)return o();j?o(!1,j):r=setTimeout(()=>{o(!1,1e-7)},1e3)}j===1&&!iit(d,t.getBoundingClientRect())&&o(),k=!1}try{n=new IntersectionObserver(S,{...w,root:s.ownerDocument})}catch{n=new IntersectionObserver(S,w)}n.observe(t)}return o(!0),i}function kVt(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:i=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=BSe(t),u=s||i?[...d?xO(d):[],...e?xO(e):[]]:[];u.forEach(b=>{s&&b.addEventListener("scroll",n,{passive:!0}),i&&b.addEventListener("resize",n)});const h=d&&l?wVt(d,n):null;let m=-1,f=null;o&&(f=new ResizeObserver(b=>{let[x]=b;x&&x.target===d&&f&&e&&(f.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var w;(w=f)==null||w.observe(e)})),n()}),d&&!c&&f.observe(d),e&&f.observe(e));let p,g=c?C2(t):null;c&&v();function v(){const b=C2(t);g&&!iit(g,b)&&n(),g=b,p=requestAnimationFrame(v)}return n(),()=>{var b;u.forEach(x=>{s&&x.removeEventListener("scroll",n),i&&x.removeEventListener("resize",n)}),h==null||h(),(b=f)==null||b.disconnect(),f=null,c&&cancelAnimationFrame(p)}}const SVt=Xzt,CVt=eVt,jVt=Qzt,EVt=nVt,NVt=Zzt,h3e=Yzt,TVt=tVt,_Vt=(t,e,n)=>{const r=new Map,s={platform:xVt,...n},i={...s.platform,_c:r};return Kzt(t,e,{...s,platform:i})};var AVt=typeof document<"u",PVt=function(){},uG=AVt?y.useLayoutEffect:PVt;function jK(t,e){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(typeof t=="function"&&t.toString()===e.toString())return!0;let n,r,s;if(t&&e&&typeof t=="object"){if(Array.isArray(t)){if(n=t.length,n!==e.length)return!1;for(r=n;r--!==0;)if(!jK(t[r],e[r]))return!1;return!0}if(s=Object.keys(t),n=s.length,n!==Object.keys(e).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(e,s[r]))return!1;for(r=n;r--!==0;){const i=s[r];if(!(i==="_owner"&&t.$$typeof)&&!jK(t[i],e[i]))return!1}return!0}return t!==t&&e!==e}function ait(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function m3e(t,e){const n=ait(t);return Math.round(e*n)/n}function foe(t){const e=y.useRef(t);return uG(()=>{e.current=t}),e}function RVt(t){t===void 0&&(t={});const{placement:e="bottom",strategy:n="absolute",middleware:r=[],platform:s,elements:{reference:i,floating:o}={},transform:l=!0,whileElementsMounted:c,open:d}=t,[u,h]=y.useState({x:0,y:0,strategy:n,placement:e,middlewareData:{},isPositioned:!1}),[m,f]=y.useState(r);jK(m,r)||f(r);const[p,g]=y.useState(null),[v,b]=y.useState(null),x=y.useCallback(P=>{P!==C.current&&(C.current=P,g(P))},[]),w=y.useCallback(P=>{P!==j.current&&(j.current=P,b(P))},[]),k=i||p,S=o||v,C=y.useRef(null),j=y.useRef(null),E=y.useRef(u),N=c!=null,A=foe(c),_=foe(s),T=foe(d),R=y.useCallback(()=>{if(!C.current||!j.current)return;const P={placement:e,strategy:n,middleware:m};_.current&&(P.platform=_.current),_Vt(C.current,j.current,P).then(M=>{const z={...M,isPositioned:T.current!==!1};O.current&&!jK(E.current,z)&&(E.current=z,Vg.flushSync(()=>{h(z)}))})},[m,e,n,_,T]);uG(()=>{d===!1&&E.current.isPositioned&&(E.current.isPositioned=!1,h(P=>({...P,isPositioned:!1})))},[d]);const O=y.useRef(!1);uG(()=>(O.current=!0,()=>{O.current=!1}),[]),uG(()=>{if(k&&(C.current=k),S&&(j.current=S),k&&S){if(A.current)return A.current(k,S,R);R()}},[k,S,R,A,N]);const F=y.useMemo(()=>({reference:C,floating:j,setReference:x,setFloating:w}),[x,w]),D=y.useMemo(()=>({reference:k,floating:S}),[k,S]),I=y.useMemo(()=>{const P={position:n,left:0,top:0};if(!D.floating)return P;const M=m3e(D.floating,u.x),z=m3e(D.floating,u.y);return l?{...P,transform:"translate("+M+"px, "+z+"px)",...ait(D.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:M,top:z}},[n,l,D.floating,u.x,u.y]);return y.useMemo(()=>({...u,update:R,refs:F,elements:D,floatingStyles:I}),[u,R,F,D,I])}const IVt=t=>{function e(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:t,fn(n){const{element:r,padding:s}=typeof t=="function"?t(n):t;return r&&e(r)?r.current!=null?h3e({element:r.current,padding:s}).fn(n):{}:r?h3e({element:r,padding:s}).fn(n):{}}}},MVt=(t,e)=>({...SVt(t),options:[t,e]}),LVt=(t,e)=>({...CVt(t),options:[t,e]}),DVt=(t,e)=>({...TVt(t),options:[t,e]}),$Vt=(t,e)=>({...jVt(t),options:[t,e]}),OVt=(t,e)=>({...EVt(t),options:[t,e]}),FVt=(t,e)=>({...NVt(t),options:[t,e]}),BVt=(t,e)=>({...IVt(t),options:[t,e]});var UVt="Arrow",oit=y.forwardRef((t,e)=>{const{children:n,width:r=10,height:s=5,...i}=t;return a.jsx(Sn.svg,{...i,ref:e,width:r,height:s,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:t.asChild?n:a.jsx("polygon",{points:"0,0 30,0 15,10"})})});oit.displayName=UVt;var zVt=oit;function z8(t){const[e,n]=y.useState(void 0);return rl(()=>{if(t){n({width:t.offsetWidth,height:t.offsetHeight});const r=new ResizeObserver(s=>{if(!Array.isArray(s)||!s.length)return;const i=s[0];let o,l;if("borderBoxSize"in i){const c=i.borderBoxSize,d=Array.isArray(c)?c[0]:c;o=d.inlineSize,l=d.blockSize}else o=t.offsetWidth,l=t.offsetHeight;n({width:o,height:l})});return r.observe(t,{box:"border-box"}),()=>r.unobserve(t)}else n(void 0)},[t]),e}var USe="Popper",[lit,sS]=il(USe),[VVt,cit]=lit(USe),dit=t=>{const{__scopePopper:e,children:n}=t,[r,s]=y.useState(null);return a.jsx(VVt,{scope:e,anchor:r,onAnchorChange:s,children:n})};dit.displayName=USe;var uit="PopperAnchor",hit=y.forwardRef((t,e)=>{const{__scopePopper:n,virtualRef:r,...s}=t,i=cit(uit,n),o=y.useRef(null),l=Sr(e,o);return y.useEffect(()=>{i.onAnchorChange((r==null?void 0:r.current)||o.current)}),r?null:a.jsx(Sn.div,{...s,ref:l})});hit.displayName=uit;var zSe="PopperContent",[HVt,GVt]=lit(zSe),mit=y.forwardRef((t,e)=>{var ne,te,re,fe,le,q;const{__scopePopper:n,side:r="bottom",sideOffset:s=0,align:i="center",alignOffset:o=0,arrowPadding:l=0,avoidCollisions:c=!0,collisionBoundary:d=[],collisionPadding:u=0,sticky:h="partial",hideWhenDetached:m=!1,updatePositionStrategy:f="optimized",onPlaced:p,...g}=t,v=cit(zSe,n),[b,x]=y.useState(null),w=Sr(e,Y=>x(Y)),[k,S]=y.useState(null),C=z8(k),j=(C==null?void 0:C.width)??0,E=(C==null?void 0:C.height)??0,N=r+(i!=="center"?"-"+i:""),A=typeof u=="number"?u:{top:0,right:0,bottom:0,left:0,...u},_=Array.isArray(d)?d:[d],T=_.length>0,R={padding:A,boundary:_.filter(qVt),altBoundary:T},{refs:O,floatingStyles:F,placement:D,isPositioned:I,middlewareData:P}=RVt({strategy:"fixed",placement:N,whileElementsMounted:(...Y)=>kVt(...Y,{animationFrame:f==="always"}),elements:{reference:v.anchor},middleware:[MVt({mainAxis:s+E,alignmentAxis:o}),c&&LVt({mainAxis:!0,crossAxis:!1,limiter:h==="partial"?DVt():void 0,...R}),c&&$Vt({...R}),OVt({...R,apply:({elements:Y,rects:X,availableWidth:Q,availableHeight:ie})=>{const{width:he,height:ye}=X.reference,J=Y.floating.style;J.setProperty("--radix-popper-available-width",`${Q}px`),J.setProperty("--radix-popper-available-height",`${ie}px`),J.setProperty("--radix-popper-anchor-width",`${he}px`),J.setProperty("--radix-popper-anchor-height",`${ye}px`)}}),k&&BVt({element:k,padding:l}),KVt({arrowWidth:j,arrowHeight:E}),m&&FVt({strategy:"referenceHidden",...R})]}),[M,z]=git(D),G=Lo(p);rl(()=>{I&&(G==null||G())},[I,G]);const B=(ne=P.arrow)==null?void 0:ne.x,H=(te=P.arrow)==null?void 0:te.y,W=((re=P.arrow)==null?void 0:re.centerOffset)!==0,[V,U]=y.useState();return rl(()=>{b&&U(window.getComputedStyle(b).zIndex)},[b]),a.jsx("div",{ref:O.setFloating,"data-radix-popper-content-wrapper":"",style:{...F,transform:I?F.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:V,"--radix-popper-transform-origin":[(fe=P.transformOrigin)==null?void 0:fe.x,(le=P.transformOrigin)==null?void 0:le.y].join(" "),...((q=P.hide)==null?void 0:q.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:t.dir,children:a.jsx(HVt,{scope:n,placedSide:M,onArrowChange:S,arrowX:B,arrowY:H,shouldHideArrow:W,children:a.jsx(Sn.div,{"data-side":M,"data-align":z,...g,ref:w,style:{...g.style,animation:I?void 0:"none"}})})})});mit.displayName=zSe;var fit="PopperArrow",WVt={top:"bottom",right:"left",bottom:"top",left:"right"},pit=y.forwardRef(function(e,n){const{__scopePopper:r,...s}=e,i=GVt(fit,r),o=WVt[i.placedSide];return a.jsx("span",{ref:i.onArrowChange,style:{position:"absolute",left:i.arrowX,top:i.arrowY,[o]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[i.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[i.placedSide],visibility:i.shouldHideArrow?"hidden":void 0},children:a.jsx(zVt,{...s,ref:n,style:{...s.style,display:"block"}})})});pit.displayName=fit;function qVt(t){return t!==null}var KVt=t=>({name:"transformOrigin",options:t,fn(e){var v,b,x;const{placement:n,rects:r,middlewareData:s}=e,o=((v=s.arrow)==null?void 0:v.centerOffset)!==0,l=o?0:t.arrowWidth,c=o?0:t.arrowHeight,[d,u]=git(n),h={start:"0%",center:"50%",end:"100%"}[u],m=(((b=s.arrow)==null?void 0:b.x)??0)+l/2,f=(((x=s.arrow)==null?void 0:x.y)??0)+c/2;let p="",g="";return d==="bottom"?(p=o?h:`${m}px`,g=`${-c}px`):d==="top"?(p=o?h:`${m}px`,g=`${r.floating.height+c}px`):d==="right"?(p=`${-c}px`,g=o?h:`${f}px`):d==="left"&&(p=`${r.floating.width+c}px`,g=o?h:`${f}px`),{data:{x:p,y:g}}}});function git(t){const[e,n="center"]=t.split("-");return[e,n]}var V8=dit,H8=hit,bee=mit,xee=pit,[wee,Yks]=il("Tooltip",[sS]),kee=sS(),vit="TooltipProvider",YVt=700,pfe="tooltip.open",[QVt,VSe]=wee(vit),yit=t=>{const{__scopeTooltip:e,delayDuration:n=YVt,skipDelayDuration:r=300,disableHoverableContent:s=!1,children:i}=t,o=y.useRef(!0),l=y.useRef(!1),c=y.useRef(0);return y.useEffect(()=>{const d=c.current;return()=>window.clearTimeout(d)},[]),a.jsx(QVt,{scope:e,isOpenDelayedRef:o,delayDuration:n,onOpen:y.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:y.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:l,onPointerInTransitChange:y.useCallback(d=>{l.current=d},[]),disableHoverableContent:s,children:i})};yit.displayName=vit;var wO="Tooltip",[ZVt,G8]=wee(wO),bit=t=>{const{__scopeTooltip:e,children:n,open:r,defaultOpen:s,onOpenChange:i,disableHoverableContent:o,delayDuration:l}=t,c=VSe(wO,t.__scopeTooltip),d=kee(e),[u,h]=y.useState(null),m=el(),f=y.useRef(0),p=o??c.disableHoverableContent,g=l??c.delayDuration,v=y.useRef(!1),[b,x]=Sd({prop:r,defaultProp:s??!1,onChange:j=>{j?(c.onOpen(),document.dispatchEvent(new CustomEvent(pfe))):c.onClose(),i==null||i(j)},caller:wO}),w=y.useMemo(()=>b?v.current?"delayed-open":"instant-open":"closed",[b]),k=y.useCallback(()=>{window.clearTimeout(f.current),f.current=0,v.current=!1,x(!0)},[x]),S=y.useCallback(()=>{window.clearTimeout(f.current),f.current=0,x(!1)},[x]),C=y.useCallback(()=>{window.clearTimeout(f.current),f.current=window.setTimeout(()=>{v.current=!0,x(!0),f.current=0},g)},[g,x]);return y.useEffect(()=>()=>{f.current&&(window.clearTimeout(f.current),f.current=0)},[]),a.jsx(V8,{...d,children:a.jsx(ZVt,{scope:e,contentId:m,open:b,stateAttribute:w,trigger:u,onTriggerChange:h,onTriggerEnter:y.useCallback(()=>{c.isOpenDelayedRef.current?C():k()},[c.isOpenDelayedRef,C,k]),onTriggerLeave:y.useCallback(()=>{p?S():(window.clearTimeout(f.current),f.current=0)},[S,p]),onOpen:k,onClose:S,disableHoverableContent:p,children:n})})};bit.displayName=wO;var gfe="TooltipTrigger",xit=y.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=G8(gfe,n),i=VSe(gfe,n),o=kee(n),l=y.useRef(null),c=Sr(e,l,s.onTriggerChange),d=y.useRef(!1),u=y.useRef(!1),h=y.useCallback(()=>d.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener("pointerup",h),[h]),a.jsx(H8,{asChild:!0,...o,children:a.jsx(Sn.button,{"aria-describedby":s.open?s.contentId:void 0,"data-state":s.stateAttribute,...r,ref:c,onPointerMove:Kt(t.onPointerMove,m=>{m.pointerType!=="touch"&&!u.current&&!i.isPointerInTransitRef.current&&(s.onTriggerEnter(),u.current=!0)}),onPointerLeave:Kt(t.onPointerLeave,()=>{s.onTriggerLeave(),u.current=!1}),onPointerDown:Kt(t.onPointerDown,()=>{s.open&&s.onClose(),d.current=!0,document.addEventListener("pointerup",h,{once:!0})}),onFocus:Kt(t.onFocus,()=>{d.current||s.onOpen()}),onBlur:Kt(t.onBlur,s.onClose),onClick:Kt(t.onClick,s.onClose)})})});xit.displayName=gfe;var HSe="TooltipPortal",[JVt,XVt]=wee(HSe,{forceMount:void 0}),wit=t=>{const{__scopeTooltip:e,forceMount:n,children:r,container:s}=t,i=G8(HSe,e);return a.jsx(JVt,{scope:e,forceMount:n,children:a.jsx(Rl,{present:n||i.open,children:a.jsx(CE,{asChild:!0,container:s,children:r})})})};wit.displayName=HSe;var WP="TooltipContent",kit=y.forwardRef((t,e)=>{const n=XVt(WP,t.__scopeTooltip),{forceMount:r=n.forceMount,side:s="top",...i}=t,o=G8(WP,t.__scopeTooltip);return a.jsx(Rl,{present:r||o.open,children:o.disableHoverableContent?a.jsx(Sit,{side:s,...i,ref:e}):a.jsx(eHt,{side:s,...i,ref:e})})}),eHt=y.forwardRef((t,e)=>{const n=G8(WP,t.__scopeTooltip),r=VSe(WP,t.__scopeTooltip),s=y.useRef(null),i=Sr(e,s),[o,l]=y.useState(null),{trigger:c,onClose:d}=n,u=s.current,{onPointerInTransitChange:h}=r,m=y.useCallback(()=>{l(null),h(!1)},[h]),f=y.useCallback((p,g)=>{const v=p.currentTarget,b={x:p.clientX,y:p.clientY},x=iHt(b,v.getBoundingClientRect()),w=aHt(b,x),k=oHt(g.getBoundingClientRect()),S=cHt([...w,...k]);l(S),h(!0)},[h]);return y.useEffect(()=>()=>m(),[m]),y.useEffect(()=>{if(c&&u){const p=v=>f(v,u),g=v=>f(v,c);return c.addEventListener("pointerleave",p),u.addEventListener("pointerleave",g),()=>{c.removeEventListener("pointerleave",p),u.removeEventListener("pointerleave",g)}}},[c,u,f,m]),y.useEffect(()=>{if(o){const p=g=>{const v=g.target,b={x:g.clientX,y:g.clientY},x=(c==null?void 0:c.contains(v))||(u==null?void 0:u.contains(v)),w=!lHt(b,o);x?m():w&&(m(),d())};return document.addEventListener("pointermove",p),()=>document.removeEventListener("pointermove",p)}},[c,u,o,d,m]),a.jsx(Sit,{...t,ref:i})}),[tHt,nHt]=wee(wO,{isInside:!1}),rHt=fst("TooltipContent"),Sit=y.forwardRef((t,e)=>{const{__scopeTooltip:n,children:r,"aria-label":s,onEscapeKeyDown:i,onPointerDownOutside:o,...l}=t,c=G8(WP,n),d=kee(n),{onClose:u}=c;return y.useEffect(()=>(document.addEventListener(pfe,u),()=>document.removeEventListener(pfe,u)),[u]),y.useEffect(()=>{if(c.trigger){const h=m=>{const f=m.target;f!=null&&f.contains(c.trigger)&&u()};return window.addEventListener("scroll",h,{capture:!0}),()=>window.removeEventListener("scroll",h,{capture:!0})}},[c.trigger,u]),a.jsx(SE,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:h=>h.preventDefault(),onDismiss:u,children:a.jsxs(bee,{"data-state":c.stateAttribute,...d,...l,ref:e,style:{...l.style,"--radix-tooltip-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-tooltip-content-available-width":"var(--radix-popper-available-width)","--radix-tooltip-content-available-height":"var(--radix-popper-available-height)","--radix-tooltip-trigger-width":"var(--radix-popper-anchor-width)","--radix-tooltip-trigger-height":"var(--radix-popper-anchor-height)"},children:[a.jsx(rHt,{children:r}),a.jsx(tHt,{scope:n,isInside:!0,children:a.jsx(nUt,{id:c.contentId,role:"tooltip",children:s||r})})]})})});kit.displayName=WP;var Cit="TooltipArrow",sHt=y.forwardRef((t,e)=>{const{__scopeTooltip:n,...r}=t,s=kee(n);return nHt(Cit,n).isInside?null:a.jsx(xee,{...s,...r,ref:e})});sHt.displayName=Cit;function iHt(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),s=Math.abs(e.right-t.x),i=Math.abs(e.left-t.x);switch(Math.min(n,r,s,i)){case i:return"left";case s:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function aHt(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function oHt(t){const{top:e,right:n,bottom:r,left:s}=t;return[{x:s,y:e},{x:n,y:e},{x:n,y:r},{x:s,y:r}]}function lHt(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){const l=e[i],c=e[o],d=l.x,u=l.y,h=c.x,m=c.y;u>r!=m>r&&n<(h-d)*(r-u)/(m-u)+d&&(s=!s)}return s}function cHt(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),dHt(e)}function dHt(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const s=t[r];for(;e.length>=2;){const i=e[e.length-1],o=e[e.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))e.pop();else break}e.push(s)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const s=t[r];for(;n.length>=2;){const i=n[n.length-1],o=n[n.length-2];if((i.x-o.x)*(s.y-o.y)>=(i.y-o.y)*(s.x-o.x))n.pop();else break}n.push(s)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var uHt=yit,hHt=bit,mHt=xit,jit=wit,Eit=kit;const GSe=uHt,Nit=hHt,Tit=mHt,WSe=y.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(Eit,{ref:r,sideOffset:e,className:ee("z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n}));WSe.displayName=Eit.displayName;var jE=class{constructor(){this.listeners=new Set,this.subscribe=this.subscribe.bind(this)}subscribe(t){return this.listeners.add(t),this.onSubscribe(),()=>{this.listeners.delete(t),this.onUnsubscribe()}}hasListeners(){return this.listeners.size>0}onSubscribe(){}onUnsubscribe(){}},j2=typeof window>"u"||"Deno"in globalThis;function Bd(){}function fHt(t,e){return typeof t=="function"?t(e):t}function vfe(t){return typeof t=="number"&&t>=0&&t!==1/0}function _it(t,e){return Math.max(t+(e||0)-Date.now(),0)}function Y1(t,e){return typeof t=="function"?t(e):t}function of(t,e){return typeof t=="function"?t(e):t}function f3e(t,e){const{type:n="all",exact:r,fetchStatus:s,predicate:i,queryKey:o,stale:l}=t;if(o){if(r){if(e.queryHash!==qSe(o,e.options))return!1}else if(!kO(e.queryKey,o))return!1}if(n!=="all"){const c=e.isActive();if(n==="active"&&!c||n==="inactive"&&c)return!1}return!(typeof l=="boolean"&&e.isStale()!==l||s&&s!==e.state.fetchStatus||i&&!i(e))}function p3e(t,e){const{exact:n,status:r,predicate:s,mutationKey:i}=t;if(i){if(!e.options.mutationKey)return!1;if(n){if(E2(e.options.mutationKey)!==E2(i))return!1}else if(!kO(e.options.mutationKey,i))return!1}return!(r&&e.state.status!==r||s&&!s(e))}function qSe(t,e){return((e==null?void 0:e.queryKeyHashFn)||E2)(t)}function E2(t){return JSON.stringify(t,(e,n)=>yfe(n)?Object.keys(n).sort().reduce((r,s)=>(r[s]=n[s],r),{}):n)}function kO(t,e){return t===e?!0:typeof t!=typeof e?!1:t&&e&&typeof t=="object"&&typeof e=="object"?Object.keys(e).every(n=>kO(t[n],e[n])):!1}function KSe(t,e){if(t===e)return t;const n=g3e(t)&&g3e(e);if(n||yfe(t)&&yfe(e)){const r=n?t:Object.keys(t),s=r.length,i=n?e:Object.keys(e),o=i.length,l=n?[]:{},c=new Set(r);let d=0;for(let u=0;u<o;u++){const h=n?u:i[u];(!n&&c.has(h)||n)&&t[h]===void 0&&e[h]===void 0?(l[h]=void 0,d++):(l[h]=KSe(t[h],e[h]),l[h]===t[h]&&t[h]!==void 0&&d++)}return s===o&&d===s?t:l}return e}function EK(t,e){if(!e||Object.keys(t).length!==Object.keys(e).length)return!1;for(const n in t)if(t[n]!==e[n])return!1;return!0}function g3e(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function yfe(t){if(!v3e(t))return!1;const e=t.constructor;if(e===void 0)return!0;const n=e.prototype;return!(!v3e(n)||!n.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function v3e(t){return Object.prototype.toString.call(t)==="[object Object]"}function pHt(t){return new Promise(e=>{setTimeout(e,t)})}function bfe(t,e,n){return typeof n.structuralSharing=="function"?n.structuralSharing(t,e):n.structuralSharing!==!1?KSe(t,e):e}function Uy(t){return t}function gHt(t,e,n=0){const r=[...t,e];return n&&r.length>n?r.slice(1):r}function vHt(t,e,n=0){const r=[e,...t];return n&&r.length>n?r.slice(0,-1):r}var YSe=Symbol();function Ait(t,e){return!t.queryFn&&(e!=null&&e.initialPromise)?()=>e.initialPromise:!t.queryFn||t.queryFn===YSe?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}function Pit(t,e){return typeof t=="function"?t(...e):!!t}var Lj,m1,vP,Zet,yHt=(Zet=class extends jE{constructor(){super();or(this,Lj);or(this,m1);or(this,vP);Cn(this,vP,e=>{if(!j2&&window.addEventListener){const n=()=>e();return window.addEventListener("visibilitychange",n,!1),()=>{window.removeEventListener("visibilitychange",n)}}})}onSubscribe(){Fe(this,m1)||this.setEventListener(Fe(this,vP))}onUnsubscribe(){var e;this.hasListeners()||((e=Fe(this,m1))==null||e.call(this),Cn(this,m1,void 0))}setEventListener(e){var n;Cn(this,vP,e),(n=Fe(this,m1))==null||n.call(this),Cn(this,m1,e(r=>{typeof r=="boolean"?this.setFocused(r):this.onFocus()}))}setFocused(e){Fe(this,Lj)!==e&&(Cn(this,Lj,e),this.onFocus())}onFocus(){const e=this.isFocused();this.listeners.forEach(n=>{n(e)})}isFocused(){var e;return typeof Fe(this,Lj)=="boolean"?Fe(this,Lj):((e=globalThis.document)==null?void 0:e.visibilityState)!=="hidden"}},Lj=new WeakMap,m1=new WeakMap,vP=new WeakMap,Zet),QSe=new yHt,yP,f1,bP,Jet,bHt=(Jet=class extends jE{constructor(){super();or(this,yP,!0);or(this,f1);or(this,bP);Cn(this,bP,e=>{if(!j2&&window.addEventListener){const n=()=>e(!0),r=()=>e(!1);return window.addEventListener("online",n,!1),window.addEventListener("offline",r,!1),()=>{window.removeEventListener("online",n),window.removeEventListener("offline",r)}}})}onSubscribe(){Fe(this,f1)||this.setEventListener(Fe(this,bP))}onUnsubscribe(){var e;this.hasListeners()||((e=Fe(this,f1))==null||e.call(this),Cn(this,f1,void 0))}setEventListener(e){var n;Cn(this,bP,e),(n=Fe(this,f1))==null||n.call(this),Cn(this,f1,e(this.setOnline.bind(this)))}setOnline(e){Fe(this,yP)!==e&&(Cn(this,yP,e),this.listeners.forEach(r=>{r(e)}))}isOnline(){return Fe(this,yP)}},yP=new WeakMap,f1=new WeakMap,bP=new WeakMap,Jet),NK=new bHt;function xfe(){let t,e;const n=new Promise((s,i)=>{t=s,e=i});n.status="pending",n.catch(()=>{});function r(s){Object.assign(n,s),delete n.resolve,delete n.reject}return n.resolve=s=>{r({status:"fulfilled",value:s}),t(s)},n.reject=s=>{r({status:"rejected",reason:s}),e(s)},n}function xHt(t){return Math.min(1e3*2**t,3e4)}function Rit(t){return(t??"online")==="online"?NK.isOnline():!0}var Iit=class extends Error{constructor(t){super("CancelledError"),this.revert=t==null?void 0:t.revert,this.silent=t==null?void 0:t.silent}};function poe(t){return t instanceof Iit}function Mit(t){let e=!1,n=0,r=!1,s;const i=xfe(),o=g=>{var v;r||(m(new Iit(g)),(v=t.abort)==null||v.call(t))},l=()=>{e=!0},c=()=>{e=!1},d=()=>QSe.isFocused()&&(t.networkMode==="always"||NK.isOnline())&&t.canRun(),u=()=>Rit(t.networkMode)&&t.canRun(),h=g=>{var v;r||(r=!0,(v=t.onSuccess)==null||v.call(t,g),s==null||s(),i.resolve(g))},m=g=>{var v;r||(r=!0,(v=t.onError)==null||v.call(t,g),s==null||s(),i.reject(g))},f=()=>new Promise(g=>{var v;s=b=>{(r||d())&&g(b)},(v=t.onPause)==null||v.call(t)}).then(()=>{var g;s=void 0,r||(g=t.onContinue)==null||g.call(t)}),p=()=>{if(r)return;let g;const v=n===0?t.initialPromise:void 0;try{g=v??t.fn()}catch(b){g=Promise.reject(b)}Promise.resolve(g).then(h).catch(b=>{var C;if(r)return;const x=t.retry??(j2?0:3),w=t.retryDelay??xHt,k=typeof w=="function"?w(n,b):w,S=x===!0||typeof x=="number"&&n<x||typeof x=="function"&&x(n,b);if(e||!S){m(b);return}n++,(C=t.onFail)==null||C.call(t,n,b),pHt(k).then(()=>d()?void 0:f()).then(()=>{e?m(b):p()})})};return{promise:i,cancel:o,continue:()=>(s==null||s(),i),cancelRetry:l,continueRetry:c,canStart:u,start:()=>(u()?p():f().then(p),i)}}var wHt=t=>setTimeout(t,0);function kHt(){let t=[],e=0,n=l=>{l()},r=l=>{l()},s=wHt;const i=l=>{e?t.push(l):s(()=>{n(l)})},o=()=>{const l=t;t=[],l.length&&s(()=>{r(()=>{l.forEach(c=>{n(c)})})})};return{batch:l=>{let c;e++;try{c=l()}finally{e--,e||o()}return c},batchCalls:l=>(...c)=>{i(()=>{l(...c)})},schedule:i,setNotifyFunction:l=>{n=l},setBatchNotifyFunction:l=>{r=l},setScheduler:l=>{s=l}}}var Jo=kHt(),Dj,Xet,Lit=(Xet=class{constructor(){or(this,Dj)}destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),vfe(this.gcTime)&&Cn(this,Dj,setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(j2?1/0:5*60*1e3))}clearGcTimeout(){Fe(this,Dj)&&(clearTimeout(Fe(this,Dj)),Cn(this,Dj,void 0))}},Dj=new WeakMap,Xet),xP,$j,rf,Oj,Od,x8,Fj,Hp,Nb,ett,SHt=(ett=class extends Lit{constructor(e){super();or(this,Hp);or(this,xP);or(this,$j);or(this,rf);or(this,Oj);or(this,Od);or(this,x8);or(this,Fj);Cn(this,Fj,!1),Cn(this,x8,e.defaultOptions),this.setOptions(e.options),this.observers=[],Cn(this,Oj,e.client),Cn(this,rf,Fe(this,Oj).getQueryCache()),this.queryKey=e.queryKey,this.queryHash=e.queryHash,Cn(this,xP,CHt(this.options)),this.state=e.state??Fe(this,xP),this.scheduleGc()}get meta(){return this.options.meta}get promise(){var e;return(e=Fe(this,Od))==null?void 0:e.promise}setOptions(e){this.options={...Fe(this,x8),...e},this.updateGcTime(this.options.gcTime)}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&Fe(this,rf).remove(this)}setData(e,n){const r=bfe(this.state.data,e,this.options);return Xr(this,Hp,Nb).call(this,{data:r,type:"success",dataUpdatedAt:n==null?void 0:n.updatedAt,manual:n==null?void 0:n.manual}),r}setState(e,n){Xr(this,Hp,Nb).call(this,{type:"setState",state:e,setStateOptions:n})}cancel(e){var r,s;const n=(r=Fe(this,Od))==null?void 0:r.promise;return(s=Fe(this,Od))==null||s.cancel(e),n?n.then(Bd).catch(Bd):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(Fe(this,xP))}isActive(){return this.observers.some(e=>of(e.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===YSe||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(e=>Y1(e.options.staleTime,this)==="static"):!1}isStale(){return this.getObserversCount()>0?this.observers.some(e=>e.getCurrentResult().isStale):this.state.data===void 0||this.state.isInvalidated}isStaleByTime(e=0){return this.state.data===void 0?!0:e==="static"?!1:this.state.isInvalidated?!0:!_it(this.state.dataUpdatedAt,e)}onFocus(){var n;const e=this.observers.find(r=>r.shouldFetchOnWindowFocus());e==null||e.refetch({cancelRefetch:!1}),(n=Fe(this,Od))==null||n.continue()}onOnline(){var n;const e=this.observers.find(r=>r.shouldFetchOnReconnect());e==null||e.refetch({cancelRefetch:!1}),(n=Fe(this,Od))==null||n.continue()}addObserver(e){this.observers.includes(e)||(this.observers.push(e),this.clearGcTimeout(),Fe(this,rf).notify({type:"observerAdded",query:this,observer:e}))}removeObserver(e){this.observers.includes(e)&&(this.observers=this.observers.filter(n=>n!==e),this.observers.length||(Fe(this,Od)&&(Fe(this,Fj)?Fe(this,Od).cancel({revert:!0}):Fe(this,Od).cancelRetry()),this.scheduleGc()),Fe(this,rf).notify({type:"observerRemoved",query:this,observer:e}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||Xr(this,Hp,Nb).call(this,{type:"invalidate"})}fetch(e,n){var d,u,h;if(this.state.fetchStatus!=="idle"){if(this.state.data!==void 0&&(n!=null&&n.cancelRefetch))this.cancel({silent:!0});else if(Fe(this,Od))return Fe(this,Od).continueRetry(),Fe(this,Od).promise}if(e&&this.setOptions(e),!this.options.queryFn){const m=this.observers.find(f=>f.options.queryFn);m&&this.setOptions(m.options)}const r=new AbortController,s=m=>{Object.defineProperty(m,"signal",{enumerable:!0,get:()=>(Cn(this,Fj,!0),r.signal)})},i=()=>{const m=Ait(this.options,n),p=(()=>{const g={client:Fe(this,Oj),queryKey:this.queryKey,meta:this.meta};return s(g),g})();return Cn(this,Fj,!1),this.options.persister?this.options.persister(m,p,this):m(p)},l=(()=>{const m={fetchOptions:n,options:this.options,queryKey:this.queryKey,client:Fe(this,Oj),state:this.state,fetchFn:i};return s(m),m})();(d=this.options.behavior)==null||d.onFetch(l,this),Cn(this,$j,this.state),(this.state.fetchStatus==="idle"||this.state.fetchMeta!==((u=l.fetchOptions)==null?void 0:u.meta))&&Xr(this,Hp,Nb).call(this,{type:"fetch",meta:(h=l.fetchOptions)==null?void 0:h.meta});const c=m=>{var f,p,g,v;poe(m)&&m.silent||Xr(this,Hp,Nb).call(this,{type:"error",error:m}),poe(m)||((p=(f=Fe(this,rf).config).onError)==null||p.call(f,m,this),(v=(g=Fe(this,rf).config).onSettled)==null||v.call(g,this.state.data,m,this)),this.scheduleGc()};return Cn(this,Od,Mit({initialPromise:n==null?void 0:n.initialPromise,fn:l.fetchFn,abort:r.abort.bind(r),onSuccess:m=>{var f,p,g,v;if(m===void 0){c(new Error(`${this.queryHash} data is undefined`));return}try{this.setData(m)}catch(b){c(b);return}(p=(f=Fe(this,rf).config).onSuccess)==null||p.call(f,m,this),(v=(g=Fe(this,rf).config).onSettled)==null||v.call(g,m,this.state.error,this),this.scheduleGc()},onError:c,onFail:(m,f)=>{Xr(this,Hp,Nb).call(this,{type:"failed",failureCount:m,error:f})},onPause:()=>{Xr(this,Hp,Nb).call(this,{type:"pause"})},onContinue:()=>{Xr(this,Hp,Nb).call(this,{type:"continue"})},retry:l.options.retry,retryDelay:l.options.retryDelay,networkMode:l.options.networkMode,canRun:()=>!0})),Fe(this,Od).start()}},xP=new WeakMap,$j=new WeakMap,rf=new WeakMap,Oj=new WeakMap,Od=new WeakMap,x8=new WeakMap,Fj=new WeakMap,Hp=new WeakSet,Nb=function(e){const n=r=>{switch(e.type){case"failed":return{...r,fetchFailureCount:e.failureCount,fetchFailureReason:e.error};case"pause":return{...r,fetchStatus:"paused"};case"continue":return{...r,fetchStatus:"fetching"};case"fetch":return{...r,...Dit(r.data,this.options),fetchMeta:e.meta??null};case"success":return Cn(this,$j,void 0),{...r,data:e.data,dataUpdateCount:r.dataUpdateCount+1,dataUpdatedAt:e.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!e.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};case"error":const s=e.error;return poe(s)&&s.revert&&Fe(this,$j)?{...Fe(this,$j),fetchStatus:"idle"}:{...r,error:s,errorUpdateCount:r.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:r.fetchFailureCount+1,fetchFailureReason:s,fetchStatus:"idle",status:"error"};case"invalidate":return{...r,isInvalidated:!0};case"setState":return{...r,...e.state}}};this.state=n(this.state),Jo.batch(()=>{this.observers.forEach(r=>{r.onQueryUpdate()}),Fe(this,rf).notify({query:this,type:"updated",action:e})})},ett);function Dit(t,e){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:Rit(e.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function CHt(t){const e=typeof t.initialData=="function"?t.initialData():t.initialData,n=e!==void 0,r=n?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:e,dataUpdateCount:0,dataUpdatedAt:n?r??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:n?"success":"pending",fetchStatus:"idle"}}var $v,ttt,jHt=(ttt=class extends jE{constructor(e={}){super();or(this,$v);this.config=e,Cn(this,$v,new Map)}build(e,n,r){const s=n.queryKey,i=n.queryHash??qSe(s,n);let o=this.get(i);return o||(o=new SHt({client:e,queryKey:s,queryHash:i,options:e.defaultQueryOptions(n),state:r,defaultOptions:e.getQueryDefaults(s)}),this.add(o)),o}add(e){Fe(this,$v).has(e.queryHash)||(Fe(this,$v).set(e.queryHash,e),this.notify({type:"added",query:e}))}remove(e){const n=Fe(this,$v).get(e.queryHash);n&&(e.destroy(),n===e&&Fe(this,$v).delete(e.queryHash),this.notify({type:"removed",query:e}))}clear(){Jo.batch(()=>{this.getAll().forEach(e=>{this.remove(e)})})}get(e){return Fe(this,$v).get(e)}getAll(){return[...Fe(this,$v).values()]}find(e){const n={exact:!0,...e};return this.getAll().find(r=>f3e(n,r))}findAll(e={}){const n=this.getAll();return Object.keys(e).length>0?n.filter(r=>f3e(e,r)):n}notify(e){Jo.batch(()=>{this.listeners.forEach(n=>{n(e)})})}onFocus(){Jo.batch(()=>{this.getAll().forEach(e=>{e.onFocus()})})}onOnline(){Jo.batch(()=>{this.getAll().forEach(e=>{e.onOnline()})})}},$v=new WeakMap,ttt),Ov,hu,Bj,Fv,yw,ntt,EHt=(ntt=class extends Lit{constructor(e){super();or(this,Fv);or(this,Ov);or(this,hu);or(this,Bj);this.mutationId=e.mutationId,Cn(this,hu,e.mutationCache),Cn(this,Ov,[]),this.state=e.state||$it(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){Fe(this,Ov).includes(e)||(Fe(this,Ov).push(e),this.clearGcTimeout(),Fe(this,hu).notify({type:"observerAdded",mutation:this,observer:e}))}removeObserver(e){Cn(this,Ov,Fe(this,Ov).filter(n=>n!==e)),this.scheduleGc(),Fe(this,hu).notify({type:"observerRemoved",mutation:this,observer:e})}optionalRemove(){Fe(this,Ov).length||(this.state.status==="pending"?this.scheduleGc():Fe(this,hu).remove(this))}continue(){var e;return((e=Fe(this,Bj))==null?void 0:e.continue())??this.execute(this.state.variables)}async execute(e){var i,o,l,c,d,u,h,m,f,p,g,v,b,x,w,k,S,C,j,E;const n=()=>{Xr(this,Fv,yw).call(this,{type:"continue"})};Cn(this,Bj,Mit({fn:()=>this.options.mutationFn?this.options.mutationFn(e):Promise.reject(new Error("No mutationFn found")),onFail:(N,A)=>{Xr(this,Fv,yw).call(this,{type:"failed",failureCount:N,error:A})},onPause:()=>{Xr(this,Fv,yw).call(this,{type:"pause"})},onContinue:n,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>Fe(this,hu).canRun(this)}));const r=this.state.status==="pending",s=!Fe(this,Bj).canStart();try{if(r)n();else{Xr(this,Fv,yw).call(this,{type:"pending",variables:e,isPaused:s}),await((o=(i=Fe(this,hu).config).onMutate)==null?void 0:o.call(i,e,this));const A=await((c=(l=this.options).onMutate)==null?void 0:c.call(l,e));A!==this.state.context&&Xr(this,Fv,yw).call(this,{type:"pending",context:A,variables:e,isPaused:s})}const N=await Fe(this,Bj).start();return await((u=(d=Fe(this,hu).config).onSuccess)==null?void 0:u.call(d,N,e,this.state.context,this)),await((m=(h=this.options).onSuccess)==null?void 0:m.call(h,N,e,this.state.context)),await((p=(f=Fe(this,hu).config).onSettled)==null?void 0:p.call(f,N,null,this.state.variables,this.state.context,this)),await((v=(g=this.options).onSettled)==null?void 0:v.call(g,N,null,e,this.state.context)),Xr(this,Fv,yw).call(this,{type:"success",data:N}),N}catch(N){try{throw await((x=(b=Fe(this,hu).config).onError)==null?void 0:x.call(b,N,e,this.state.context,this)),await((k=(w=this.options).onError)==null?void 0:k.call(w,N,e,this.state.context)),await((C=(S=Fe(this,hu).config).onSettled)==null?void 0:C.call(S,void 0,N,this.state.variables,this.state.context,this)),await((E=(j=this.options).onSettled)==null?void 0:E.call(j,void 0,N,e,this.state.context)),N}finally{Xr(this,Fv,yw).call(this,{type:"error",error:N})}}finally{Fe(this,hu).runNext(this)}}},Ov=new WeakMap,hu=new WeakMap,Bj=new WeakMap,Fv=new WeakSet,yw=function(e){const n=r=>{switch(e.type){case"failed":return{...r,failureCount:e.failureCount,failureReason:e.error};case"pause":return{...r,isPaused:!0};case"continue":return{...r,isPaused:!1};case"pending":return{...r,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:"pending",variables:e.variables,submittedAt:Date.now()};case"success":return{...r,data:e.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...r,data:void 0,error:e.error,failureCount:r.failureCount+1,failureReason:e.error,isPaused:!1,status:"error"}}};this.state=n(this.state),Jo.batch(()=>{Fe(this,Ov).forEach(r=>{r.onMutationUpdate(e)}),Fe(this,hu).notify({mutation:this,type:"updated",action:e})})},ntt);function $it(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var Yb,Gp,w8,rtt,NHt=(rtt=class extends jE{constructor(e={}){super();or(this,Yb);or(this,Gp);or(this,w8);this.config=e,Cn(this,Yb,new Set),Cn(this,Gp,new Map),Cn(this,w8,0)}build(e,n,r){const s=new EHt({mutationCache:this,mutationId:++z9(this,w8)._,options:e.defaultMutationOptions(n),state:r});return this.add(s),s}add(e){Fe(this,Yb).add(e);const n=dU(e);if(typeof n=="string"){const r=Fe(this,Gp).get(n);r?r.push(e):Fe(this,Gp).set(n,[e])}this.notify({type:"added",mutation:e})}remove(e){if(Fe(this,Yb).delete(e)){const n=dU(e);if(typeof n=="string"){const r=Fe(this,Gp).get(n);if(r)if(r.length>1){const s=r.indexOf(e);s!==-1&&r.splice(s,1)}else r[0]===e&&Fe(this,Gp).delete(n)}}this.notify({type:"removed",mutation:e})}canRun(e){const n=dU(e);if(typeof n=="string"){const r=Fe(this,Gp).get(n),s=r==null?void 0:r.find(i=>i.state.status==="pending");return!s||s===e}else return!0}runNext(e){var r;const n=dU(e);if(typeof n=="string"){const s=(r=Fe(this,Gp).get(n))==null?void 0:r.find(i=>i!==e&&i.state.isPaused);return(s==null?void 0:s.continue())??Promise.resolve()}else return Promise.resolve()}clear(){Jo.batch(()=>{Fe(this,Yb).forEach(e=>{this.notify({type:"removed",mutation:e})}),Fe(this,Yb).clear(),Fe(this,Gp).clear()})}getAll(){return Array.from(Fe(this,Yb))}find(e){const n={exact:!0,...e};return this.getAll().find(r=>p3e(n,r))}findAll(e={}){return this.getAll().filter(n=>p3e(e,n))}notify(e){Jo.batch(()=>{this.listeners.forEach(n=>{n(e)})})}resumePausedMutations(){const e=this.getAll().filter(n=>n.state.isPaused);return Jo.batch(()=>Promise.all(e.map(n=>n.continue().catch(Bd))))}},Yb=new WeakMap,Gp=new WeakMap,w8=new WeakMap,rtt);function dU(t){var e;return(e=t.options.scope)==null?void 0:e.id}function TK(t){return{onFetch:(e,n)=>{var u,h,m,f,p;const r=e.options,s=(m=(h=(u=e.fetchOptions)==null?void 0:u.meta)==null?void 0:h.fetchMore)==null?void 0:m.direction,i=((f=e.state.data)==null?void 0:f.pages)||[],o=((p=e.state.data)==null?void 0:p.pageParams)||[];let l={pages:[],pageParams:[]},c=0;const d=async()=>{let g=!1;const v=w=>{Object.defineProperty(w,"signal",{enumerable:!0,get:()=>(e.signal.aborted?g=!0:e.signal.addEventListener("abort",()=>{g=!0}),e.signal)})},b=Ait(e.options,e.fetchOptions),x=async(w,k,S)=>{if(g)return Promise.reject();if(k==null&&w.pages.length)return Promise.resolve(w);const j=(()=>{const _={client:e.client,queryKey:e.queryKey,pageParam:k,direction:S?"backward":"forward",meta:e.options.meta};return v(_),_})(),E=await b(j),{maxPages:N}=e.options,A=S?vHt:gHt;return{pages:A(w.pages,E,N),pageParams:A(w.pageParams,k,N)}};if(s&&i.length){const w=s==="backward",k=w?Oit:wfe,S={pages:i,pageParams:o},C=k(r,S);l=await x(S,C,w)}else{const w=t??i.length;do{const k=c===0?o[0]??r.initialPageParam:wfe(r,l);if(c>0&&k==null)break;l=await x(l,k),c++}while(c<w)}return l};e.options.persister?e.fetchFn=()=>{var g,v;return(v=(g=e.options).persister)==null?void 0:v.call(g,d,{client:e.client,queryKey:e.queryKey,meta:e.options.meta,signal:e.signal},n)}:e.fetchFn=d}}}function wfe(t,{pages:e,pageParams:n}){const r=e.length-1;return e.length>0?t.getNextPageParam(e[r],e,n[r],n):void 0}function Oit(t,{pages:e,pageParams:n}){var r;return e.length>0?(r=t.getPreviousPageParam)==null?void 0:r.call(t,e[0],e,n[0],n):void 0}function THt(t,e){return e?wfe(t,e)!=null:!1}function _Ht(t,e){return!e||!t.getPreviousPageParam?!1:Oit(t,e)!=null}var qo,p1,g1,wP,kP,v1,SP,CP,stt,AHt=(stt=class{constructor(t={}){or(this,qo);or(this,p1);or(this,g1);or(this,wP);or(this,kP);or(this,v1);or(this,SP);or(this,CP);Cn(this,qo,t.queryCache||new jHt),Cn(this,p1,t.mutationCache||new NHt),Cn(this,g1,t.defaultOptions||{}),Cn(this,wP,new Map),Cn(this,kP,new Map),Cn(this,v1,0)}mount(){z9(this,v1)._++,Fe(this,v1)===1&&(Cn(this,SP,QSe.subscribe(async t=>{t&&(await this.resumePausedMutations(),Fe(this,qo).onFocus())})),Cn(this,CP,NK.subscribe(async t=>{t&&(await this.resumePausedMutations(),Fe(this,qo).onOnline())})))}unmount(){var t,e;z9(this,v1)._--,Fe(this,v1)===0&&((t=Fe(this,SP))==null||t.call(this),Cn(this,SP,void 0),(e=Fe(this,CP))==null||e.call(this),Cn(this,CP,void 0))}isFetching(t){return Fe(this,qo).findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return Fe(this,p1).findAll({...t,status:"pending"}).length}getQueryData(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=Fe(this,qo).get(e.queryHash))==null?void 0:n.state.data}ensureQueryData(t){const e=this.defaultQueryOptions(t),n=Fe(this,qo).build(this,e),r=n.state.data;return r===void 0?this.fetchQuery(t):(t.revalidateIfStale&&n.isStaleByTime(Y1(e.staleTime,n))&&this.prefetchQuery(e),Promise.resolve(r))}getQueriesData(t){return Fe(this,qo).findAll(t).map(({queryKey:e,state:n})=>{const r=n.data;return[e,r]})}setQueryData(t,e,n){const r=this.defaultQueryOptions({queryKey:t}),s=Fe(this,qo).get(r.queryHash),i=s==null?void 0:s.state.data,o=fHt(e,i);if(o!==void 0)return Fe(this,qo).build(this,r).setData(o,{...n,manual:!0})}setQueriesData(t,e,n){return Jo.batch(()=>Fe(this,qo).findAll(t).map(({queryKey:r})=>[r,this.setQueryData(r,e,n)]))}getQueryState(t){var n;const e=this.defaultQueryOptions({queryKey:t});return(n=Fe(this,qo).get(e.queryHash))==null?void 0:n.state}removeQueries(t){const e=Fe(this,qo);Jo.batch(()=>{e.findAll(t).forEach(n=>{e.remove(n)})})}resetQueries(t,e){const n=Fe(this,qo);return Jo.batch(()=>(n.findAll(t).forEach(r=>{r.reset()}),this.refetchQueries({type:"active",...t},e)))}cancelQueries(t,e={}){const n={revert:!0,...e},r=Jo.batch(()=>Fe(this,qo).findAll(t).map(s=>s.cancel(n)));return Promise.all(r).then(Bd).catch(Bd)}invalidateQueries(t,e={}){return Jo.batch(()=>(Fe(this,qo).findAll(t).forEach(n=>{n.invalidate()}),(t==null?void 0:t.refetchType)==="none"?Promise.resolve():this.refetchQueries({...t,type:(t==null?void 0:t.refetchType)??(t==null?void 0:t.type)??"active"},e)))}refetchQueries(t,e={}){const n={...e,cancelRefetch:e.cancelRefetch??!0},r=Jo.batch(()=>Fe(this,qo).findAll(t).filter(s=>!s.isDisabled()&&!s.isStatic()).map(s=>{let i=s.fetch(void 0,n);return n.throwOnError||(i=i.catch(Bd)),s.state.fetchStatus==="paused"?Promise.resolve():i}));return Promise.all(r).then(Bd)}fetchQuery(t){const e=this.defaultQueryOptions(t);e.retry===void 0&&(e.retry=!1);const n=Fe(this,qo).build(this,e);return n.isStaleByTime(Y1(e.staleTime,n))?n.fetch(e):Promise.resolve(n.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(Bd).catch(Bd)}fetchInfiniteQuery(t){return t.behavior=TK(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(Bd).catch(Bd)}ensureInfiniteQueryData(t){return t.behavior=TK(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return NK.isOnline()?Fe(this,p1).resumePausedMutations():Promise.resolve()}getQueryCache(){return Fe(this,qo)}getMutationCache(){return Fe(this,p1)}getDefaultOptions(){return Fe(this,g1)}setDefaultOptions(t){Cn(this,g1,t)}setQueryDefaults(t,e){Fe(this,wP).set(E2(t),{queryKey:t,defaultOptions:e})}getQueryDefaults(t){const e=[...Fe(this,wP).values()],n={};return e.forEach(r=>{kO(t,r.queryKey)&&Object.assign(n,r.defaultOptions)}),n}setMutationDefaults(t,e){Fe(this,kP).set(E2(t),{mutationKey:t,defaultOptions:e})}getMutationDefaults(t){const e=[...Fe(this,kP).values()],n={};return e.forEach(r=>{kO(t,r.mutationKey)&&Object.assign(n,r.defaultOptions)}),n}defaultQueryOptions(t){if(t._defaulted)return t;const e={...Fe(this,g1).queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return e.queryHash||(e.queryHash=qSe(e.queryKey,e)),e.refetchOnReconnect===void 0&&(e.refetchOnReconnect=e.networkMode!=="always"),e.throwOnError===void 0&&(e.throwOnError=!!e.suspense),!e.networkMode&&e.persister&&(e.networkMode="offlineFirst"),e.queryFn===YSe&&(e.enabled=!1),e}defaultMutationOptions(t){return t!=null&&t._defaulted?t:{...Fe(this,g1).mutations,...(t==null?void 0:t.mutationKey)&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){Fe(this,qo).clear(),Fe(this,p1).clear()}},qo=new WeakMap,p1=new WeakMap,g1=new WeakMap,wP=new WeakMap,kP=new WeakMap,v1=new WeakMap,SP=new WeakMap,CP=new WeakMap,stt),eh,ni,k8,mu,Uj,jP,y1,b1,S8,EP,NP,zj,Vj,x1,TP,Ri,m4,kfe,Sfe,Cfe,jfe,Efe,Nfe,Tfe,Fit,itt,See=(itt=class extends jE{constructor(e,n){super();or(this,Ri);or(this,eh);or(this,ni);or(this,k8);or(this,mu);or(this,Uj);or(this,jP);or(this,y1);or(this,b1);or(this,S8);or(this,EP);or(this,NP);or(this,zj);or(this,Vj);or(this,x1);or(this,TP,new Set);this.options=n,Cn(this,eh,e),Cn(this,b1,null),Cn(this,y1,xfe()),this.options.experimental_prefetchInRender||Fe(this,y1).reject(new Error("experimental_prefetchInRender feature flag is not enabled")),this.bindMethods(),this.setOptions(n)}bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){this.listeners.size===1&&(Fe(this,ni).addObserver(this),y3e(Fe(this,ni),this.options)?Xr(this,Ri,m4).call(this):this.updateResult(),Xr(this,Ri,jfe).call(this))}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return _fe(Fe(this,ni),this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return _fe(Fe(this,ni),this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,Xr(this,Ri,Efe).call(this),Xr(this,Ri,Nfe).call(this),Fe(this,ni).removeObserver(this)}setOptions(e){const n=this.options,r=Fe(this,ni);if(this.options=Fe(this,eh).defaultQueryOptions(e),this.options.enabled!==void 0&&typeof this.options.enabled!="boolean"&&typeof this.options.enabled!="function"&&typeof of(this.options.enabled,Fe(this,ni))!="boolean")throw new Error("Expected enabled to be a boolean or a callback that returns a boolean");Xr(this,Ri,Tfe).call(this),Fe(this,ni).setOptions(this.options),n._defaulted&&!EK(this.options,n)&&Fe(this,eh).getQueryCache().notify({type:"observerOptionsUpdated",query:Fe(this,ni),observer:this});const s=this.hasListeners();s&&b3e(Fe(this,ni),r,this.options,n)&&Xr(this,Ri,m4).call(this),this.updateResult(),s&&(Fe(this,ni)!==r||of(this.options.enabled,Fe(this,ni))!==of(n.enabled,Fe(this,ni))||Y1(this.options.staleTime,Fe(this,ni))!==Y1(n.staleTime,Fe(this,ni)))&&Xr(this,Ri,kfe).call(this);const i=Xr(this,Ri,Sfe).call(this);s&&(Fe(this,ni)!==r||of(this.options.enabled,Fe(this,ni))!==of(n.enabled,Fe(this,ni))||i!==Fe(this,x1))&&Xr(this,Ri,Cfe).call(this,i)}getOptimisticResult(e){const n=Fe(this,eh).getQueryCache().build(Fe(this,eh),e),r=this.createResult(n,e);return RHt(this,r)&&(Cn(this,mu,r),Cn(this,jP,this.options),Cn(this,Uj,Fe(this,ni).state)),r}getCurrentResult(){return Fe(this,mu)}trackResult(e,n){return new Proxy(e,{get:(r,s)=>(this.trackProp(s),n==null||n(s),Reflect.get(r,s))})}trackProp(e){Fe(this,TP).add(e)}getCurrentQuery(){return Fe(this,ni)}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){const n=Fe(this,eh).defaultQueryOptions(e),r=Fe(this,eh).getQueryCache().build(Fe(this,eh),n);return r.fetch().then(()=>this.createResult(r,n))}fetch(e){return Xr(this,Ri,m4).call(this,{...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),Fe(this,mu)))}createResult(e,n){var N;const r=Fe(this,ni),s=this.options,i=Fe(this,mu),o=Fe(this,Uj),l=Fe(this,jP),d=e!==r?e.state:Fe(this,k8),{state:u}=e;let h={...u},m=!1,f;if(n._optimisticResults){const A=this.hasListeners(),_=!A&&y3e(e,n),T=A&&b3e(e,r,n,s);(_||T)&&(h={...h,...Dit(u.data,e.options)}),n._optimisticResults==="isRestoring"&&(h.fetchStatus="idle")}let{error:p,errorUpdatedAt:g,status:v}=h;f=h.data;let b=!1;if(n.placeholderData!==void 0&&f===void 0&&v==="pending"){let A;i!=null&&i.isPlaceholderData&&n.placeholderData===(l==null?void 0:l.placeholderData)?(A=i.data,b=!0):A=typeof n.placeholderData=="function"?n.placeholderData((N=Fe(this,NP))==null?void 0:N.state.data,Fe(this,NP)):n.placeholderData,A!==void 0&&(v="success",f=bfe(i==null?void 0:i.data,A,n),m=!0)}if(n.select&&f!==void 0&&!b)if(i&&f===(o==null?void 0:o.data)&&n.select===Fe(this,S8))f=Fe(this,EP);else try{Cn(this,S8,n.select),f=n.select(f),f=bfe(i==null?void 0:i.data,f,n),Cn(this,EP,f),Cn(this,b1,null)}catch(A){Cn(this,b1,A)}Fe(this,b1)&&(p=Fe(this,b1),f=Fe(this,EP),g=Date.now(),v="error");const x=h.fetchStatus==="fetching",w=v==="pending",k=v==="error",S=w&&x,C=f!==void 0,E={status:v,fetchStatus:h.fetchStatus,isPending:w,isSuccess:v==="success",isError:k,isInitialLoading:S,isLoading:S,data:f,dataUpdatedAt:h.dataUpdatedAt,error:p,errorUpdatedAt:g,failureCount:h.fetchFailureCount,failureReason:h.fetchFailureReason,errorUpdateCount:h.errorUpdateCount,isFetched:h.dataUpdateCount>0||h.errorUpdateCount>0,isFetchedAfterMount:h.dataUpdateCount>d.dataUpdateCount||h.errorUpdateCount>d.errorUpdateCount,isFetching:x,isRefetching:x&&!w,isLoadingError:k&&!C,isPaused:h.fetchStatus==="paused",isPlaceholderData:m,isRefetchError:k&&C,isStale:ZSe(e,n),refetch:this.refetch,promise:Fe(this,y1),isEnabled:of(n.enabled,e)!==!1};if(this.options.experimental_prefetchInRender){const A=R=>{E.status==="error"?R.reject(E.error):E.data!==void 0&&R.resolve(E.data)},_=()=>{const R=Cn(this,y1,E.promise=xfe());A(R)},T=Fe(this,y1);switch(T.status){case"pending":e.queryHash===r.queryHash&&A(T);break;case"fulfilled":(E.status==="error"||E.data!==T.value)&&_();break;case"rejected":(E.status!=="error"||E.error!==T.reason)&&_();break}}return E}updateResult(){const e=Fe(this,mu),n=this.createResult(Fe(this,ni),this.options);if(Cn(this,Uj,Fe(this,ni).state),Cn(this,jP,this.options),Fe(this,Uj).data!==void 0&&Cn(this,NP,Fe(this,ni)),EK(n,e))return;Cn(this,mu,n);const r=()=>{if(!e)return!0;const{notifyOnChangeProps:s}=this.options,i=typeof s=="function"?s():s;if(i==="all"||!i&&!Fe(this,TP).size)return!0;const o=new Set(i??Fe(this,TP));return this.options.throwOnError&&o.add("error"),Object.keys(Fe(this,mu)).some(l=>{const c=l;return Fe(this,mu)[c]!==e[c]&&o.has(c)})};Xr(this,Ri,Fit).call(this,{listeners:r()})}onQueryUpdate(){this.updateResult(),this.hasListeners()&&Xr(this,Ri,jfe).call(this)}},eh=new WeakMap,ni=new WeakMap,k8=new WeakMap,mu=new WeakMap,Uj=new WeakMap,jP=new WeakMap,y1=new WeakMap,b1=new WeakMap,S8=new WeakMap,EP=new WeakMap,NP=new WeakMap,zj=new WeakMap,Vj=new WeakMap,x1=new WeakMap,TP=new WeakMap,Ri=new WeakSet,m4=function(e){Xr(this,Ri,Tfe).call(this);let n=Fe(this,ni).fetch(this.options,e);return e!=null&&e.throwOnError||(n=n.catch(Bd)),n},kfe=function(){Xr(this,Ri,Efe).call(this);const e=Y1(this.options.staleTime,Fe(this,ni));if(j2||Fe(this,mu).isStale||!vfe(e))return;const r=_it(Fe(this,mu).dataUpdatedAt,e)+1;Cn(this,zj,setTimeout(()=>{Fe(this,mu).isStale||this.updateResult()},r))},Sfe=function(){return(typeof this.options.refetchInterval=="function"?this.options.refetchInterval(Fe(this,ni)):this.options.refetchInterval)??!1},Cfe=function(e){Xr(this,Ri,Nfe).call(this),Cn(this,x1,e),!(j2||of(this.options.enabled,Fe(this,ni))===!1||!vfe(Fe(this,x1))||Fe(this,x1)===0)&&Cn(this,Vj,setInterval(()=>{(this.options.refetchIntervalInBackground||QSe.isFocused())&&Xr(this,Ri,m4).call(this)},Fe(this,x1)))},jfe=function(){Xr(this,Ri,kfe).call(this),Xr(this,Ri,Cfe).call(this,Xr(this,Ri,Sfe).call(this))},Efe=function(){Fe(this,zj)&&(clearTimeout(Fe(this,zj)),Cn(this,zj,void 0))},Nfe=function(){Fe(this,Vj)&&(clearInterval(Fe(this,Vj)),Cn(this,Vj,void 0))},Tfe=function(){const e=Fe(this,eh).getQueryCache().build(Fe(this,eh),this.options);if(e===Fe(this,ni))return;const n=Fe(this,ni);Cn(this,ni,e),Cn(this,k8,e.state),this.hasListeners()&&(n==null||n.removeObserver(this),e.addObserver(this))},Fit=function(e){Jo.batch(()=>{e.listeners&&this.listeners.forEach(n=>{n(Fe(this,mu))}),Fe(this,eh).getQueryCache().notify({query:Fe(this,ni),type:"observerResultsUpdated"})})},itt);function PHt(t,e){return of(e.enabled,t)!==!1&&t.state.data===void 0&&!(t.state.status==="error"&&e.retryOnMount===!1)}function y3e(t,e){return PHt(t,e)||t.state.data!==void 0&&_fe(t,e,e.refetchOnMount)}function _fe(t,e,n){if(of(e.enabled,t)!==!1&&Y1(e.staleTime,t)!=="static"){const r=typeof n=="function"?n(t):n;return r==="always"||r!==!1&&ZSe(t,e)}return!1}function b3e(t,e,n,r){return(t!==e||of(r.enabled,t)===!1)&&(!n.suspense||t.state.status!=="error")&&ZSe(t,n)}function ZSe(t,e){return of(e.enabled,t)!==!1&&t.isStaleByTime(Y1(e.staleTime,t))}function RHt(t,e){return!EK(t.getCurrentResult(),e)}function x3e(t,e){const n=new Set(e);return t.filter(r=>!n.has(r))}function IHt(t,e,n){const r=t.slice(0);return r[e]=n,r}var _P,sf,AP,PP,af,w1,C8,j8,E8,Ed,Afe,Pfe,Rfe,Ife,Mfe,att,MHt=(att=class extends jE{constructor(e,n,r){super();or(this,Ed);or(this,_P);or(this,sf);or(this,AP);or(this,PP);or(this,af);or(this,w1);or(this,C8);or(this,j8);or(this,E8,[]);Cn(this,_P,e),Cn(this,PP,r),Cn(this,AP,[]),Cn(this,af,[]),Cn(this,sf,[]),this.setQueries(n)}onSubscribe(){this.listeners.size===1&&Fe(this,af).forEach(e=>{e.subscribe(n=>{Xr(this,Ed,Ife).call(this,e,n)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,Fe(this,af).forEach(e=>{e.destroy()})}setQueries(e,n){Cn(this,AP,e),Cn(this,PP,n),Jo.batch(()=>{const r=Fe(this,af),s=Xr(this,Ed,Rfe).call(this,Fe(this,AP));Cn(this,E8,s),s.forEach(c=>c.observer.setOptions(c.defaultedQueryOptions));const i=s.map(c=>c.observer),o=i.map(c=>c.getCurrentResult()),l=i.some((c,d)=>c!==r[d]);r.length===i.length&&!l||(Cn(this,af,i),Cn(this,sf,o),this.hasListeners()&&(x3e(r,i).forEach(c=>{c.destroy()}),x3e(i,r).forEach(c=>{c.subscribe(d=>{Xr(this,Ed,Ife).call(this,c,d)})}),Xr(this,Ed,Mfe).call(this)))})}getCurrentResult(){return Fe(this,sf)}getQueries(){return Fe(this,af).map(e=>e.getCurrentQuery())}getObservers(){return Fe(this,af)}getOptimisticResult(e,n){const r=Xr(this,Ed,Rfe).call(this,e),s=r.map(i=>i.observer.getOptimisticResult(i.defaultedQueryOptions));return[s,i=>Xr(this,Ed,Pfe).call(this,i??s,n),()=>Xr(this,Ed,Afe).call(this,s,r)]}},_P=new WeakMap,sf=new WeakMap,AP=new WeakMap,PP=new WeakMap,af=new WeakMap,w1=new WeakMap,C8=new WeakMap,j8=new WeakMap,E8=new WeakMap,Ed=new WeakSet,Afe=function(e,n){return n.map((r,s)=>{const i=e[s];return r.defaultedQueryOptions.notifyOnChangeProps?i:r.observer.trackResult(i,o=>{n.forEach(l=>{l.observer.trackProp(o)})})})},Pfe=function(e,n){return n?((!Fe(this,w1)||Fe(this,sf)!==Fe(this,j8)||n!==Fe(this,C8))&&(Cn(this,C8,n),Cn(this,j8,Fe(this,sf)),Cn(this,w1,KSe(Fe(this,w1),n(e)))),Fe(this,w1)):e},Rfe=function(e){const n=new Map(Fe(this,af).map(s=>[s.options.queryHash,s])),r=[];return e.forEach(s=>{const i=Fe(this,_P).defaultQueryOptions(s),o=n.get(i.queryHash);o?r.push({defaultedQueryOptions:i,observer:o}):r.push({defaultedQueryOptions:i,observer:new See(Fe(this,_P),i)})}),r},Ife=function(e,n){const r=Fe(this,af).indexOf(e);r!==-1&&(Cn(this,sf,IHt(Fe(this,sf),r,n)),Xr(this,Ed,Mfe).call(this))},Mfe=function(){var e;if(this.hasListeners()){const n=Fe(this,w1),r=Xr(this,Ed,Afe).call(this,Fe(this,sf),Fe(this,E8)),s=Xr(this,Ed,Pfe).call(this,r,(e=Fe(this,PP))==null?void 0:e.combine);n!==s&&Jo.batch(()=>{this.listeners.forEach(i=>{i(Fe(this,sf))})})}},att),LHt=class extends See{constructor(t,e){super(t,e)}bindMethods(){super.bindMethods(),this.fetchNextPage=this.fetchNextPage.bind(this),this.fetchPreviousPage=this.fetchPreviousPage.bind(this)}setOptions(t){super.setOptions({...t,behavior:TK()})}getOptimisticResult(t){return t.behavior=TK(),super.getOptimisticResult(t)}fetchNextPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"forward"}}})}fetchPreviousPage(t){return this.fetch({...t,meta:{fetchMore:{direction:"backward"}}})}createResult(t,e){var p,g;const{state:n}=t,r=super.createResult(t,e),{isFetching:s,isRefetching:i,isError:o,isRefetchError:l}=r,c=(g=(p=n.fetchMeta)==null?void 0:p.fetchMore)==null?void 0:g.direction,d=o&&c==="forward",u=s&&c==="forward",h=o&&c==="backward",m=s&&c==="backward";return{...r,fetchNextPage:this.fetchNextPage,fetchPreviousPage:this.fetchPreviousPage,hasNextPage:THt(e,n.data),hasPreviousPage:_Ht(e,n.data),isFetchNextPageError:d,isFetchingNextPage:u,isFetchPreviousPageError:h,isFetchingPreviousPage:m,isRefetchError:l&&!d&&!h,isRefetching:i&&!u&&!m}}},k1,S1,th,Qb,Lx,hG,Lfe,ott,DHt=(ott=class extends jE{constructor(n,r){super();or(this,Lx);or(this,k1);or(this,S1);or(this,th);or(this,Qb);Cn(this,k1,n),this.setOptions(r),this.bindMethods(),Xr(this,Lx,hG).call(this)}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(n){var s;const r=this.options;this.options=Fe(this,k1).defaultMutationOptions(n),EK(this.options,r)||Fe(this,k1).getMutationCache().notify({type:"observerOptionsUpdated",mutation:Fe(this,th),observer:this}),r!=null&&r.mutationKey&&this.options.mutationKey&&E2(r.mutationKey)!==E2(this.options.mutationKey)?this.reset():((s=Fe(this,th))==null?void 0:s.state.status)==="pending"&&Fe(this,th).setOptions(this.options)}onUnsubscribe(){var n;this.hasListeners()||(n=Fe(this,th))==null||n.removeObserver(this)}onMutationUpdate(n){Xr(this,Lx,hG).call(this),Xr(this,Lx,Lfe).call(this,n)}getCurrentResult(){return Fe(this,S1)}reset(){var n;(n=Fe(this,th))==null||n.removeObserver(this),Cn(this,th,void 0),Xr(this,Lx,hG).call(this),Xr(this,Lx,Lfe).call(this)}mutate(n,r){var s;return Cn(this,Qb,r),(s=Fe(this,th))==null||s.removeObserver(this),Cn(this,th,Fe(this,k1).getMutationCache().build(Fe(this,k1),this.options)),Fe(this,th).addObserver(this),Fe(this,th).execute(n)}},k1=new WeakMap,S1=new WeakMap,th=new WeakMap,Qb=new WeakMap,Lx=new WeakSet,hG=function(){var r;const n=((r=Fe(this,th))==null?void 0:r.state)??$it();Cn(this,S1,{...n,isPending:n.status==="pending",isSuccess:n.status==="success",isError:n.status==="error",isIdle:n.status==="idle",mutate:this.mutate,reset:this.reset})},Lfe=function(n){Jo.batch(()=>{var r,s,i,o,l,c,d,u;if(Fe(this,Qb)&&this.hasListeners()){const h=Fe(this,S1).variables,m=Fe(this,S1).context;(n==null?void 0:n.type)==="success"?((s=(r=Fe(this,Qb)).onSuccess)==null||s.call(r,n.data,h,m),(o=(i=Fe(this,Qb)).onSettled)==null||o.call(i,n.data,null,h,m)):(n==null?void 0:n.type)==="error"&&((c=(l=Fe(this,Qb)).onError)==null||c.call(l,n.error,h,m),(u=(d=Fe(this,Qb)).onSettled)==null||u.call(d,void 0,n.error,h,m))}this.listeners.forEach(h=>{h(Fe(this,S1))})})},ott),Bit=y.createContext(void 0),rn=t=>{const e=y.useContext(Bit);if(!e)throw new Error("No QueryClient set, use QueryClientProvider to set one");return e},$Ht=({client:t,children:e})=>(y.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),a.jsx(Bit.Provider,{value:t,children:e})),Uit=y.createContext(!1),zit=()=>y.useContext(Uit);Uit.Provider;function OHt(){let t=!1;return{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t}}var FHt=y.createContext(OHt()),Vit=()=>y.useContext(FHt),Hit=(t,e)=>{(t.suspense||t.throwOnError||t.experimental_prefetchInRender)&&(e.isReset()||(t.retryOnMount=!1))},Git=t=>{y.useEffect(()=>{t.clearReset()},[t])},Wit=({result:t,errorResetBoundary:e,throwOnError:n,query:r,suspense:s})=>t.isError&&!e.isReset()&&!t.isFetching&&r&&(s&&t.data===void 0||Pit(n,[t.error,r])),qit=t=>{if(t.suspense){const e=r=>r==="static"?r:Math.max(r??1e3,1e3),n=t.staleTime;t.staleTime=typeof n=="function"?(...r)=>e(n(...r)):e(n),typeof t.gcTime=="number"&&(t.gcTime=Math.max(t.gcTime,1e3))}},Kit=(t,e)=>t.isLoading&&t.isFetching&&!e,Dfe=(t,e)=>(t==null?void 0:t.suspense)&&e.isPending,_K=(t,e,n)=>e.fetchOptimistic(t).catch(()=>{n.clearReset()});function $fe({queries:t,...e},n){const r=rn(),s=zit(),i=Vit(),o=y.useMemo(()=>t.map(g=>{const v=r.defaultQueryOptions(g);return v._optimisticResults=s?"isRestoring":"optimistic",v}),[t,r,s]);o.forEach(g=>{qit(g),Hit(g,i)}),Git(i);const[l]=y.useState(()=>new MHt(r,o,e)),[c,d,u]=l.getOptimisticResult(o,e.combine),h=!s&&e.subscribed!==!1;y.useSyncExternalStore(y.useCallback(g=>h?l.subscribe(Jo.batchCalls(g)):Bd,[l,h]),()=>l.getCurrentResult(),()=>l.getCurrentResult()),y.useEffect(()=>{l.setQueries(o,e)},[o,e,l]);const f=c.some((g,v)=>Dfe(o[v],g))?c.flatMap((g,v)=>{const b=o[v];if(b){const x=new See(r,b);if(Dfe(b,g))return _K(b,x,i);Kit(g,s)&&_K(b,x,i)}return[]}):[];if(f.length>0)throw Promise.all(f);const p=c.find((g,v)=>{const b=o[v];return b&&Wit({result:g,errorResetBoundary:i,throwOnError:b.throwOnError,query:r.getQueryCache().get(b.queryHash),suspense:b.suspense})});if(p!=null&&p.error)throw p.error;return d(u())}function Yit(t,e,n){var h,m,f,p,g;const r=zit(),s=Vit(),i=rn(),o=i.defaultQueryOptions(t);(m=(h=i.getDefaultOptions().queries)==null?void 0:h._experimental_beforeQuery)==null||m.call(h,o),o._optimisticResults=r?"isRestoring":"optimistic",qit(o),Hit(o,s),Git(s);const l=!i.getQueryCache().get(o.queryHash),[c]=y.useState(()=>new e(i,o)),d=c.getOptimisticResult(o),u=!r&&t.subscribed!==!1;if(y.useSyncExternalStore(y.useCallback(v=>{const b=u?c.subscribe(Jo.batchCalls(v)):Bd;return c.updateResult(),b},[c,u]),()=>c.getCurrentResult(),()=>c.getCurrentResult()),y.useEffect(()=>{c.setOptions(o)},[o,c]),Dfe(o,d))throw _K(o,c,s);if(Wit({result:d,errorResetBoundary:s,throwOnError:o.throwOnError,query:i.getQueryCache().get(o.queryHash),suspense:o.suspense}))throw d.error;if((p=(f=i.getDefaultOptions().queries)==null?void 0:f._experimental_afterQuery)==null||p.call(f,o,d),o.experimental_prefetchInRender&&!j2&&Kit(d,r)){const v=l?_K(o,c,s):(g=i.getQueryCache().get(o.queryHash))==null?void 0:g.promise;v==null||v.catch(Bd).finally(()=>{c.updateResult()})}return o.notifyOnChangeProps?d:c.trackResult(d)}function lt(t,e){return Yit(t,See)}function jt(t,e){const n=rn(),[r]=y.useState(()=>new DHt(n,t));y.useEffect(()=>{r.setOptions(t)},[r,t]);const s=y.useSyncExternalStore(y.useCallback(o=>r.subscribe(Jo.batchCalls(o)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),i=y.useCallback((o,l)=>{r.mutate(o,l).catch(Bd)},[r]);if(s.error&&Pit(r.options.throwOnError,[s.error]))throw s.error;return{...s,mutate:i,mutateAsync:s.mutate}}function C0(t,e){return Yit(t,LHt)}/**
 * @remix-run/router v1.23.0
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */function SO(){return SO=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},SO.apply(this,arguments)}var E1;(function(t){t.Pop="POP",t.Push="PUSH",t.Replace="REPLACE"})(E1||(E1={}));const w3e="popstate";function BHt(t){t===void 0&&(t={});function e(r,s){let{pathname:i,search:o,hash:l}=r.location;return Ofe("",{pathname:i,search:o,hash:l},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function n(r,s){return typeof s=="string"?s:AK(s)}return zHt(e,n,null,t)}function tl(t,e){if(t===!1||t===null||typeof t>"u")throw new Error(e)}function Qit(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function UHt(){return Math.random().toString(36).substr(2,8)}function k3e(t,e){return{usr:t.state,key:t.key,idx:e}}function Ofe(t,e,n,r){return n===void 0&&(n=null),SO({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?mI(e):e,{state:n,key:e&&e.key||r||UHt()})}function AK(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function mI(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function zHt(t,e,n,r){r===void 0&&(r={});let{window:s=document.defaultView,v5Compat:i=!1}=r,o=s.history,l=E1.Pop,c=null,d=u();d==null&&(d=0,o.replaceState(SO({},o.state,{idx:d}),""));function u(){return(o.state||{idx:null}).idx}function h(){l=E1.Pop;let v=u(),b=v==null?null:v-d;d=v,c&&c({action:l,location:g.location,delta:b})}function m(v,b){l=E1.Push;let x=Ofe(g.location,v,b);d=u()+1;let w=k3e(x,d),k=g.createHref(x);try{o.pushState(w,"",k)}catch(S){if(S instanceof DOMException&&S.name==="DataCloneError")throw S;s.location.assign(k)}i&&c&&c({action:l,location:g.location,delta:1})}function f(v,b){l=E1.Replace;let x=Ofe(g.location,v,b);d=u();let w=k3e(x,d),k=g.createHref(x);o.replaceState(w,"",k),i&&c&&c({action:l,location:g.location,delta:0})}function p(v){let b=s.location.origin!=="null"?s.location.origin:s.location.href,x=typeof v=="string"?v:AK(v);return x=x.replace(/ $/,"%20"),tl(b,"No window.location.(origin|href) available to create URL for href: "+x),new URL(x,b)}let g={get action(){return l},get location(){return t(s,o)},listen(v){if(c)throw new Error("A history only accepts one active listener");return s.addEventListener(w3e,h),c=v,()=>{s.removeEventListener(w3e,h),c=null}},createHref(v){return e(s,v)},createURL:p,encodeLocation(v){let b=p(v);return{pathname:b.pathname,search:b.search,hash:b.hash}},push:m,replace:f,go(v){return o.go(v)}};return g}var S3e;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(S3e||(S3e={}));function VHt(t,e,n){return n===void 0&&(n="/"),HHt(t,e,n,!1)}function HHt(t,e,n,r){let s=typeof e=="string"?mI(e):e,i=JSe(s.pathname||"/",n);if(i==null)return null;let o=Zit(t);GHt(o);let l=null;for(let c=0;l==null&&c<o.length;++c){let d=Xit(i);l=eGt(o[c],d,r)}return l}function Zit(t,e,n,r){e===void 0&&(e=[]),n===void 0&&(n=[]),r===void 0&&(r="");let s=(i,o,l)=>{let c={relativePath:l===void 0?i.path||"":l,caseSensitive:i.caseSensitive===!0,childrenIndex:o,route:i};c.relativePath.startsWith("/")&&(tl(c.relativePath.startsWith(r),'Absolute route path "'+c.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),c.relativePath=c.relativePath.slice(r.length));let d=Q1([r,c.relativePath]),u=n.concat(c);i.children&&i.children.length>0&&(tl(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+d+'".')),Zit(i.children,e,u,d)),!(i.path==null&&!i.index)&&e.push({path:d,score:JHt(d,i.index),routesMeta:u})};return t.forEach((i,o)=>{var l;if(i.path===""||!((l=i.path)!=null&&l.includes("?")))s(i,o);else for(let c of Jit(i.path))s(i,o,c)}),e}function Jit(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,s=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return s?[i,""]:[i];let o=Jit(r.join("/")),l=[];return l.push(...o.map(c=>c===""?i:[i,c].join("/"))),s&&l.push(...o),l.map(c=>t.startsWith("/")&&c===""?"/":c)}function GHt(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:XHt(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}const WHt=/^:[\w-]+$/,qHt=3,KHt=2,YHt=1,QHt=10,ZHt=-2,C3e=t=>t==="*";function JHt(t,e){let n=t.split("/"),r=n.length;return n.some(C3e)&&(r+=ZHt),e&&(r+=KHt),n.filter(s=>!C3e(s)).reduce((s,i)=>s+(WHt.test(i)?qHt:i===""?YHt:QHt),r)}function XHt(t,e){return t.length===e.length&&t.slice(0,-1).every((r,s)=>r===e[s])?t[t.length-1]-e[e.length-1]:0}function eGt(t,e,n){let{routesMeta:r}=t,s={},i="/",o=[];for(let l=0;l<r.length;++l){let c=r[l],d=l===r.length-1,u=i==="/"?e:e.slice(i.length)||"/",h=PK({path:c.relativePath,caseSensitive:c.caseSensitive,end:d},u),m=c.route;if(!h&&d&&n&&!r[r.length-1].route.index&&(h=PK({path:c.relativePath,caseSensitive:c.caseSensitive,end:!1},u)),!h)return null;Object.assign(s,h.params),o.push({params:s,pathname:Q1([i,h.pathname]),pathnameBase:iGt(Q1([i,h.pathnameBase])),route:m}),h.pathnameBase!=="/"&&(i=Q1([i,h.pathnameBase]))}return o}function PK(t,e){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[n,r]=tGt(t.path,t.caseSensitive,t.end),s=e.match(n);if(!s)return null;let i=s[0],o=i.replace(/(.)\/+$/,"$1"),l=s.slice(1);return{params:r.reduce((d,u,h)=>{let{paramName:m,isOptional:f}=u;if(m==="*"){let g=l[h]||"";o=i.slice(0,i.length-g.length).replace(/(.)\/+$/,"$1")}const p=l[h];return f&&!p?d[m]=void 0:d[m]=(p||"").replace(/%2F/g,"/"),d},{}),pathname:i,pathnameBase:o,pattern:t}}function tGt(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),Qit(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],s="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(o,l,c)=>(r.push({paramName:l,isOptional:c!=null}),c?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(r.push({paramName:"*"}),s+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?s+="\\/*$":t!==""&&t!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,e?void 0:"i"),r]}function Xit(t){try{return t.split("/").map(e=>decodeURIComponent(e).replace(/\//g,"%2F")).join("/")}catch(e){return Qit(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function JSe(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}function nGt(t,e){e===void 0&&(e="/");let{pathname:n,search:r="",hash:s=""}=typeof t=="string"?mI(t):t;return{pathname:n?n.startsWith("/")?n:rGt(n,e):e,search:aGt(r),hash:oGt(s)}}function rGt(t,e){let n=e.replace(/\/+$/,"").split("/");return t.split("/").forEach(s=>{s===".."?n.length>1&&n.pop():s!=="."&&n.push(s)}),n.length>1?n.join("/"):"/"}function goe(t,e,n,r){return"Cannot include a '"+t+"' character in a manually specified "+("`to."+e+"` field ["+JSON.stringify(r)+"].  Please separate it out to the ")+("`to."+n+"` field. Alternatively you may provide the full path as ")+'a string in <Link to="..."> and the router will parse it for you.'}function sGt(t){return t.filter((e,n)=>n===0||e.route.path&&e.route.path.length>0)}function XSe(t,e){let n=sGt(t);return e?n.map((r,s)=>s===n.length-1?r.pathname:r.pathnameBase):n.map(r=>r.pathnameBase)}function eCe(t,e,n,r){r===void 0&&(r=!1);let s;typeof t=="string"?s=mI(t):(s=SO({},t),tl(!s.pathname||!s.pathname.includes("?"),goe("?","pathname","search",s)),tl(!s.pathname||!s.pathname.includes("#"),goe("#","pathname","hash",s)),tl(!s.search||!s.search.includes("#"),goe("#","search","hash",s)));let i=t===""||s.pathname==="",o=i?"/":s.pathname,l;if(o==null)l=n;else{let h=e.length-1;if(!r&&o.startsWith("..")){let m=o.split("/");for(;m[0]==="..";)m.shift(),h-=1;s.pathname=m.join("/")}l=h>=0?e[h]:"/"}let c=nGt(s,l),d=o&&o!=="/"&&o.endsWith("/"),u=(i||o===".")&&n.endsWith("/");return!c.pathname.endsWith("/")&&(d||u)&&(c.pathname+="/"),c}const Q1=t=>t.join("/").replace(/\/\/+/g,"/"),iGt=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),aGt=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,oGt=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function lGt(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}const eat=["post","put","patch","delete"];new Set(eat);const cGt=["get",...eat];new Set(cGt);/**
 * React Router v6.30.1
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */function CO(){return CO=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},CO.apply(this,arguments)}const tCe=y.createContext(null),dGt=y.createContext(null),iS=y.createContext(null),W8=y.createContext(null),zy=y.createContext({outlet:null,matches:[],isDataRoute:!1}),tat=y.createContext(null);function uGt(t,e){let{relative:n}=e===void 0?{}:e;EE()||tl(!1);let{basename:r,navigator:s}=y.useContext(iS),{hash:i,pathname:o,search:l}=sat(t,{relative:n}),c=o;return r!=="/"&&(c=o==="/"?r:Q1([r,o])),s.createHref({pathname:c,search:l,hash:i})}function EE(){return y.useContext(W8)!=null}function Di(){return EE()||tl(!1),y.useContext(W8).location}function nat(){return y.useContext(W8).navigationType}function hGt(t){EE()||tl(!1);let{pathname:e}=Di();return y.useMemo(()=>PK(t,Xit(e)),[e,t])}function rat(t){y.useContext(iS).static||y.useLayoutEffect(t)}function Nn(){let{isDataRoute:t}=y.useContext(zy);return t?NGt():mGt()}function mGt(){EE()||tl(!1);let t=y.useContext(tCe),{basename:e,future:n,navigator:r}=y.useContext(iS),{matches:s}=y.useContext(zy),{pathname:i}=Di(),o=JSON.stringify(XSe(s,n.v7_relativeSplatPath)),l=y.useRef(!1);return rat(()=>{l.current=!0}),y.useCallback(function(d,u){if(u===void 0&&(u={}),!l.current)return;if(typeof d=="number"){r.go(d);return}let h=eCe(d,JSON.parse(o),i,u.relative==="path");t==null&&e!=="/"&&(h.pathname=h.pathname==="/"?e:Q1([e,h.pathname])),(u.replace?r.replace:r.push)(h,u.state,u)},[e,r,o,i,t])}const fGt=y.createContext(null);function pGt(t){let e=y.useContext(zy).outlet;return e&&y.createElement(fGt.Provider,{value:t},e)}function So(){let{matches:t}=y.useContext(zy),e=t[t.length-1];return e?e.params:{}}function sat(t,e){let{relative:n}=e===void 0?{}:e,{future:r}=y.useContext(iS),{matches:s}=y.useContext(zy),{pathname:i}=Di(),o=JSON.stringify(XSe(s,r.v7_relativeSplatPath));return y.useMemo(()=>eCe(t,JSON.parse(o),i,n==="path"),[t,o,i,n])}function gGt(t,e){return vGt(t,e)}function vGt(t,e,n,r){EE()||tl(!1);let{navigator:s}=y.useContext(iS),{matches:i}=y.useContext(zy),o=i[i.length-1],l=o?o.params:{};o&&o.pathname;let c=o?o.pathnameBase:"/";o&&o.route;let d=Di(),u;if(e){var h;let v=typeof e=="string"?mI(e):e;c==="/"||(h=v.pathname)!=null&&h.startsWith(c)||tl(!1),u=v}else u=d;let m=u.pathname||"/",f=m;if(c!=="/"){let v=c.replace(/^\//,"").split("/");f="/"+m.replace(/^\//,"").split("/").slice(v.length).join("/")}let p=VHt(t,{pathname:f}),g=kGt(p&&p.map(v=>Object.assign({},v,{params:Object.assign({},l,v.params),pathname:Q1([c,s.encodeLocation?s.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?c:Q1([c,s.encodeLocation?s.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),i,n,r);return e&&g?y.createElement(W8.Provider,{value:{location:CO({pathname:"/",search:"",hash:"",state:null,key:"default"},u),navigationType:E1.Pop}},g):g}function yGt(){let t=EGt(),e=lGt(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,s={padding:"0.5rem",backgroundColor:"rgba(200,200,200, 0.5)"};return y.createElement(y.Fragment,null,y.createElement("h2",null,"Unexpected Application Error!"),y.createElement("h3",{style:{fontStyle:"italic"}},e),n?y.createElement("pre",{style:s},n):null,null)}const bGt=y.createElement(yGt,null);class xGt extends y.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error!==void 0?y.createElement(zy.Provider,{value:this.props.routeContext},y.createElement(tat.Provider,{value:this.state.error,children:this.props.component})):this.props.children}}function wGt(t){let{routeContext:e,match:n,children:r}=t,s=y.useContext(tCe);return s&&s.static&&s.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(s.staticContext._deepestRenderedBoundaryId=n.route.id),y.createElement(zy.Provider,{value:e},r)}function kGt(t,e,n,r){var s;if(e===void 0&&(e=[]),n===void 0&&(n=null),r===void 0&&(r=null),t==null){var i;if(!n)return null;if(n.errors)t=n.matches;else if((i=r)!=null&&i.v7_partialHydration&&e.length===0&&!n.initialized&&n.matches.length>0)t=n.matches;else return null}let o=t,l=(s=n)==null?void 0:s.errors;if(l!=null){let u=o.findIndex(h=>h.route.id&&(l==null?void 0:l[h.route.id])!==void 0);u>=0||tl(!1),o=o.slice(0,Math.min(o.length,u+1))}let c=!1,d=-1;if(n&&r&&r.v7_partialHydration)for(let u=0;u<o.length;u++){let h=o[u];if((h.route.HydrateFallback||h.route.hydrateFallbackElement)&&(d=u),h.route.id){let{loaderData:m,errors:f}=n,p=h.route.loader&&m[h.route.id]===void 0&&(!f||f[h.route.id]===void 0);if(h.route.lazy||p){c=!0,d>=0?o=o.slice(0,d+1):o=[o[0]];break}}}return o.reduceRight((u,h,m)=>{let f,p=!1,g=null,v=null;n&&(f=l&&h.route.id?l[h.route.id]:void 0,g=h.route.errorElement||bGt,c&&(d<0&&m===0?(p=!0,v=null):d===m&&(p=!0,v=h.route.hydrateFallbackElement||null)));let b=e.concat(o.slice(0,m+1)),x=()=>{let w;return f?w=g:p?w=v:h.route.Component?w=y.createElement(h.route.Component,null):h.route.element?w=h.route.element:w=u,y.createElement(wGt,{match:h,routeContext:{outlet:u,matches:b,isDataRoute:n!=null},children:w})};return n&&(h.route.ErrorBoundary||h.route.errorElement||m===0)?y.createElement(xGt,{location:n.location,revalidation:n.revalidation,component:g,error:f,children:x(),routeContext:{outlet:null,matches:b,isDataRoute:!0}}):x()},null)}var iat=function(t){return t.UseBlocker="useBlocker",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t}(iat||{}),RK=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(RK||{});function SGt(t){let e=y.useContext(tCe);return e||tl(!1),e}function CGt(t){let e=y.useContext(dGt);return e||tl(!1),e}function jGt(t){let e=y.useContext(zy);return e||tl(!1),e}function aat(t){let e=jGt(),n=e.matches[e.matches.length-1];return n.route.id||tl(!1),n.route.id}function EGt(){var t;let e=y.useContext(tat),n=CGt(RK.UseRouteError),r=aat(RK.UseRouteError);return e!==void 0?e:(t=n.errors)==null?void 0:t[r]}function NGt(){let{router:t}=SGt(iat.UseNavigateStable),e=aat(RK.UseNavigateStable),n=y.useRef(!1);return rat(()=>{n.current=!0}),y.useCallback(function(s,i){i===void 0&&(i={}),n.current&&(typeof s=="number"?t.navigate(s):t.navigate(s,CO({fromRouteId:e},i)))},[t,e])}function TGt(t,e){t==null||t.v7_startTransition,t==null||t.v7_relativeSplatPath}function Gs(t){let{to:e,replace:n,state:r,relative:s}=t;EE()||tl(!1);let{future:i,static:o}=y.useContext(iS),{matches:l}=y.useContext(zy),{pathname:c}=Di(),d=Nn(),u=eCe(e,XSe(l,i.v7_relativeSplatPath),c,s==="path"),h=JSON.stringify(u);return y.useEffect(()=>d(JSON.parse(h),{replace:n,state:r,relative:s}),[d,h,s,n,r]),null}function f4(t){return pGt(t.context)}function an(t){tl(!1)}function _Gt(t){let{basename:e="/",children:n=null,location:r,navigationType:s=E1.Pop,navigator:i,static:o=!1,future:l}=t;EE()&&tl(!1);let c=e.replace(/^\/*/,"/"),d=y.useMemo(()=>({basename:c,navigator:i,static:o,future:CO({v7_relativeSplatPath:!1},l)}),[c,l,i,o]);typeof r=="string"&&(r=mI(r));let{pathname:u="/",search:h="",hash:m="",state:f=null,key:p="default"}=r,g=y.useMemo(()=>{let v=JSe(u,c);return v==null?null:{location:{pathname:v,search:h,hash:m,state:f,key:p},navigationType:s}},[c,u,h,m,f,p,s]);return g==null?null:y.createElement(iS.Provider,{value:d},y.createElement(W8.Provider,{children:n,value:g}))}function nCe(t){let{children:e,location:n}=t;return gGt(Ffe(e),n)}new Promise(()=>{});function Ffe(t,e){e===void 0&&(e=[]);let n=[];return y.Children.forEach(t,(r,s)=>{if(!y.isValidElement(r))return;let i=[...e,s];if(r.type===y.Fragment){n.push.apply(n,Ffe(r.props.children,i));return}r.type!==an&&tl(!1),!r.props.index||!r.props.children||tl(!1);let o={id:r.props.id||i.join("-"),caseSensitive:r.props.caseSensitive,element:r.props.element,Component:r.props.Component,index:r.props.index,path:r.props.path,loader:r.props.loader,action:r.props.action,errorElement:r.props.errorElement,ErrorBoundary:r.props.ErrorBoundary,hasErrorBoundary:r.props.ErrorBoundary!=null||r.props.errorElement!=null,shouldRevalidate:r.props.shouldRevalidate,handle:r.props.handle,lazy:r.props.lazy};r.props.children&&(o.children=Ffe(r.props.children,i)),n.push(o)}),n}/**
 * React Router DOM v6.30.1
 *
 * Copyright (c) Remix Software Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE.md file in the root directory of this source tree.
 *
 * @license MIT
 */function Bfe(){return Bfe=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Bfe.apply(this,arguments)}function AGt(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}function PGt(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function RGt(t,e){return t.button===0&&(!e||e==="_self")&&!PGt(t)}function Ufe(t){return t===void 0&&(t=""),new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((e,n)=>{let r=t[n];return e.concat(Array.isArray(r)?r.map(s=>[n,s]):[[n,r]])},[]))}function IGt(t,e){let n=Ufe(t);return e&&e.forEach((r,s)=>{n.has(s)||e.getAll(s).forEach(i=>{n.append(s,i)})}),n}const MGt=["onClick","relative","reloadDocument","replace","state","target","to","preventScrollReset","viewTransition"],LGt="6";try{window.__reactRouterVersion=LGt}catch{}const DGt="startTransition",j3e=bke[DGt];function $Gt(t){let{basename:e,children:n,future:r,window:s}=t,i=y.useRef();i.current==null&&(i.current=BHt({window:s,v5Compat:!0}));let o=i.current,[l,c]=y.useState({action:o.action,location:o.location}),{v7_startTransition:d}=r||{},u=y.useCallback(h=>{d&&j3e?j3e(()=>c(h)):c(h)},[c,d]);return y.useLayoutEffect(()=>o.listen(u),[o,u]),y.useEffect(()=>TGt(r),[r]),y.createElement(_Gt,{basename:e,children:n,location:l.location,navigationType:l.action,navigator:o,future:r})}const OGt=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",FGt=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,vr=y.forwardRef(function(e,n){let{onClick:r,relative:s,reloadDocument:i,replace:o,state:l,target:c,to:d,preventScrollReset:u,viewTransition:h}=e,m=AGt(e,MGt),{basename:f}=y.useContext(iS),p,g=!1;if(typeof d=="string"&&FGt.test(d)&&(p=d,OGt))try{let w=new URL(window.location.href),k=d.startsWith("//")?new URL(w.protocol+d):new URL(d),S=JSe(k.pathname,f);k.origin===w.origin&&S!=null?d=S+k.search+k.hash:g=!0}catch{}let v=uGt(d,{relative:s}),b=BGt(d,{replace:o,state:l,target:c,preventScrollReset:u,relative:s,viewTransition:h});function x(w){r&&r(w),w.defaultPrevented||b(w)}return y.createElement("a",Bfe({},m,{href:p||v,onClick:g||i?r:x,ref:n,target:c}))});var E3e;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher",t.useViewTransitionState="useViewTransitionState"})(E3e||(E3e={}));var N3e;(function(t){t.UseFetcher="useFetcher",t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(N3e||(N3e={}));function BGt(t,e){let{target:n,replace:r,state:s,preventScrollReset:i,relative:o,viewTransition:l}=e===void 0?{}:e,c=Nn(),d=Di(),u=sat(t,{relative:o});return y.useCallback(h=>{if(RGt(h,n)){h.preventDefault();let m=r!==void 0?r:AK(d)===AK(u);c(t,{replace:m,state:s,preventScrollReset:i,relative:o,viewTransition:l})}},[d,c,u,r,s,n,t,i,o,l])}function xc(t){let e=y.useRef(Ufe(t)),n=y.useRef(!1),r=Di(),s=y.useMemo(()=>IGt(r.search,n.current?null:e.current),[r.search]),i=Nn(),o=y.useCallback((l,c)=>{const d=Ufe(typeof l=="function"?l(s):l);n.current=!0,i("?"+d,c)},[i,s]);return[s,o]}const mG="https://api.pensil.so/api/v2",T3e="/guest-event";function UGt(t,e,n){const r=/^https?:\/\//i.test(t),s=e===T3e||e.startsWith(`${T3e}/`);return r&&s&&n?n:t}const zGt=UGt(mG,typeof window<"u"?window.location.pathname:"","/api/v2");function VGt(){return"http://localhost:3001"}function HGt(){return typeof window<"u"&&window.location.origin?window.location.origin:""}function GGt(){return mG.startsWith("http")?mG.replace(/\/api(?:\/v\d+)?\/?$/,""):mG.startsWith("/")?HGt():VGt()}const WGt=13;function qGt(t){const e=t.trim().replace(/px$/i,""),n=/^\d+$/.test(e)?Number(e):NaN;return n>=10&&n<=20?n:WGt}const wo={apiBaseUrl:zGt,socketUrl:GGt(),appEnv:"production",isLocalSendTest:!1,googleClientId:"347515749020-pln6u6c46bpb4obubq0frmgd6qp0scm2.apps.googleusercontent.com",recaptchaSiteKey:"6LcyIqAsAAAAAK5fADf37D77KHTKokoJ57GExr9G",mixpanelToken:"",firebase:{apiKey:"AIzaSyC6izmHjXbXaYKnA0Jv72bB1mmhTT3Wc_s",projectId:"pensil-may-2025",messagingSenderId:"347515749020",appId:"1:347515749020:web:1abc51839b60c85e53e359",vapidKey:"BEF5vFNAnltm-DKs7OhbzWvvBoo8E3Dp5IzxrRQUyaY2I2TonAo5xipzRJGWUWCywJj5NLvHP0BykNCfWh7hlvY"},devCommunitySubdomain:void 0,communityPublicDomain:"spatial.community",communityUrlTemplate:"https://{subdomain}.spatial.community",communityQuickOverviewVideoUrl:"/spatialchat-product-tour.mp4",sidebarDesktopFontSizePx:qGt("13")},KGt=new Set(["ok","error","request failed","bad request","unauthenticated","unauthorized","forbidden","not found","conflict","payload too large","unprocessable entity","validation error","too many requests","internal server error","server error","bad gateway","service unavailable","gateway timeout","network error","something went wrong"]),oat=/failed to fetch|networkerror|network error|load failed|network request failed/i,YGt=new RegExp(["https?://[\\w.-]+","\\blocalhost\\b","\\b\\d{1,3}(\\.\\d{1,3}){3}\\b","\\bport \\d+","\\b(ECONNREFUSED|ECONNRESET|ETIMEDOUT|ENOTFOUND|EAI_AGAIN|EPIPE|ENOENT|EACCES)\\b","\\bnpm (run|install|start)\\b","node_modules","\\.(m?js|jsx|tsx?):\\d+","^\\s*at .+\\(.+\\)","\\b(Type|Reference|Syntax|Range|Mongo\\w*|Cast|Validator|Axios)Error\\b","\\bE11000\\b|duplicate key|\\bObjectId\\b|Cast to \\w+ failed|validation failed:|Path `","\\bSQL\\b|syntax error","is not a function|is not defined|is not iterable|Cannot (read|set) propert|of undefined|of null|\\bis undefined\\b","\\b[a-f0-9]{32,}\\b","Unexpected (token|end of)|\\bJSON\\b","status code \\d{3}|timeout of \\d+ms","\\bVITE_\\w+|process\\.env","<!doctype|<html"].join("|"),"i"),QGt=300;function zfe(t){const e=t.trim();return!e||e.length>QGt||KGt.has(e.replace(/[!.]+$/,"").toLowerCase())?!1:!oat.test(e)&&!YGt.test(e)}function Z1(t){return t===0?"We couldn't connect to the server. Please check your connection and try again.":t===400?"We couldn't process that request. Please check the information and try again.":t===401?"Please sign in to continue.":t===403?"You don't have permission to perform this action.":t===404?"We couldn't find what you were looking for.":t===408||t===504?"The request took too long. Please try again.":t===409?"This conflicts with a recent change. Please refresh and try again.":t===413?"That file is too large. Please choose a smaller one.":t===415?"That file type isn't supported.":t===422?"Please check the information you entered and try again.":t===429?"You're doing that too often. Please wait a moment and try again.":t===502||t===503?"The service is temporarily unavailable. Please try again in a moment.":t>=500?"Something went wrong on our side. Please try again in a moment.":"Something went wrong. Please try again."}function lat(t){if(typeof t=="string")return[t];if(Array.isArray(t))return t.flatMap(lat);if(typeof t=="object"&&t!==null){const{message:e,msg:n}=t;if(typeof e=="string")return[e];if(typeof n=="string")return[n]}return[]}function Dt(t,e){if(typeof t!="object"||t===null)return e;const{message:n,errors:r}=t;if(typeof n=="string"&&zfe(n))return n.trim();if(typeof r=="object"&&r!==null)return Dt(r,e);const s=Object.entries(t).filter(([i])=>i!=="message").flatMap(([,i])=>lat(i)).filter(zfe);return s.length>0?[...new Set(s)].join(" "):e}function dn(t,e){return t instanceof Error?oat.test(t.message)?Z1(0):zfe(t.message)?t.message:e:e}const ve={home:"/",communities:"/communities",communitiesCreate:"/communities/create",communitiesCreateOverview:"/communities/create/overview",communitiesJoin:"/communities/join",communitiesOnboarding:"/communities/onboarding",blocked:"/blocked",dashboard:"/home",gettingStarted:"/getting-started",signIn:"/signin",signUp:"/signup",onboarding:"/onboarding",welcome:"/welcome",recommendations:"/recommendations",introduce:"/introduce",newsletterSignup:t=>`/newsletter/${t}`,newsletterSignupPattern:"/newsletter/:newsletterId",newsletterConfirm:t=>`/newsletter/${t}/confirm`,newsletterConfirmPattern:"/newsletter/:newsletterId/confirm",newsletterConfirmAliasPattern:"/newsletters/:newsletterId/confirm",unsubscribe:"/unsubscribe",preferences:"/preferences",newsletterArchive:t=>`/newsletter/${t}/archive`,newsletterArchivePattern:"/newsletter/:newsletterId/archive",publicVideo:t=>`/v/${t}`,publicVideoPattern:"/v/:publicId",newsletterPostPublic:(t,e)=>`/newsletter/${t}/posts/${e}`,newsletterPostPublicPattern:"/newsletter/:newsletterId/posts/:postId",formPublic:t=>`/forms/${t}`,formPublicPattern:"/forms/:formId",community:"/community",communityMembers:"/community-members",knowledge:"/course",knowledgeHub:"/knowledge-hub",knowledgeCourse:t=>`/course/${t}`,knowledgeCoursePattern:"/course/:courseId",knowledgeLearn:(t,e,n)=>{const r=`/course/${t}/learn`;if(!e||!n)return r;const s=new URLSearchParams({section:e,lesson:n});return`${r}?${s.toString()}`},knowledgeLearnPattern:"/course/:courseId/learn",networking:"/networking",leaderboard:"/leaderboard",settings:"/settings",import:"/import",notifications:"/notifications",insights:"/insights",engagement:"/engagement",workflows:"/workflows",workflowTemplates:"/workflows/new",workflowSelectType:"/workflows/new/select-type",workflowBuilder:t=>`/workflows/builder/${t}`,workflowBuilderPattern:"/workflows/builder/:workflowId",chat:"/chat",saved:"/saved",exploreGroups:"/explore-groups",calendar:"/calendar",redemption:"/redemption",profile:"/profile",emailMarketing:"/email-marketing",emailCampaigns:"/email-marketing/campaigns",emailCampaignCreate:"/email-marketing/campaigns/new",emailCampaignReport:t=>`/email-marketing/campaigns/${t}`,emailCampaignReportPattern:"/email-marketing/campaigns/:campaignId",emailSequences:"/email-marketing/sequences",emailAutomations:"/email-marketing/automations",emailFunnels:"/email-marketing/funnels",emailForms:"/email-marketing/forms",emailTemplates:"/email-marketing/templates",emailContacts:"/email-marketing/contacts",emailAudience:"/email-marketing/audience",newsletter:"/email-marketing/newsletter",newsletterNew:"/email-marketing/newsletter/new",newsletterDetail:t=>`/email-marketing/newsletter/${t}`,newsletterDetailPattern:"/email-marketing/newsletter/:newsletterId",newsletterPost:(t,e)=>`/email-marketing/newsletter/${t}/posts/${e}`,newsletterPostPattern:"/email-marketing/newsletter/:newsletterId/posts/:postId",content:"/content",contentMedia:"/content/media",contentPosts:"/content/posts",contentSpaces:"/content/spaces",contentTopics:"/content/topics",protectedWildcard:"/*",group:t=>`/groups/${t}`,groupPattern:"/groups/:slug",eventDetail:t=>`/calendar/${t}`,eventDetailPattern:"/calendar/:eventId",meeting:t=>`/meeting/${t}`,meetingPattern:"/meeting/:meetingId",eventBySlug:t=>`/e/${t}`,eventBySlugPattern:"/e/:slug",member:t=>`/member/${t}`,memberPattern:"/member/:userId",post:t=>`/post/${t}`,postPattern:"/post/:postId",embeddedSection:t=>`/embedded-section/${t}`,embeddedSectionPattern:"/embedded-section/:slug"};function Nk(t){return t.slug?ve.eventBySlug(t.slug):ve.eventDetail(t.realId)}const ZGt=[ve.newsletterSignupPattern,ve.newsletterConfirmPattern,ve.newsletterConfirmAliasPattern,ve.unsubscribe,ve.preferences,ve.newsletterArchivePattern,ve.newsletterPostPublicPattern,ve.formPublicPattern,ve.publicVideoPattern];function _3e(t){return ZGt.some(e=>PK(e,t)!==null)}const cat="User blocked!";function JGt(t,e){return!e||typeof e!="object"?!1:e.message===cat}function XGt(){window.location.pathname!==ve.blocked&&(window.location.href=ve.blocked)}const rCe="pensil.user",Vfe={allUsers:"efc_all_users",onboardedUsers:"efc_onboarded"};function ro(){const t=localStorage.getItem(rCe);if(!t)return null;try{return JSON.parse(t)}catch{return null}}function dat(t){localStorage.setItem(rCe,JSON.stringify(t))}function Hfe(){localStorage.removeItem(rCe)}function Nd(){var t;return((t=ro())==null?void 0:t.token)??null}class ze extends Error{constructor(e,n,r){super(e),this.status=n,this.body=r,this.name="ApiError"}}let fG=null;function A3e(t){fG=t}function Cee(t){const e=wo.apiBaseUrl.replace(/\/$/,""),n=t.startsWith("/")?t:`/${t}`;return`${e}${n}`}function sCe(t){if(t)return{};const e=Nd();return e?{Authorization:`Bearer ${e}`}:{}}function uat(){try{const t=Intl.DateTimeFormat().resolvedOptions().timeZone;return t?{"X-Timezone":t}:{}}catch{return{}}}async function iCe(t){const e=await t.text();let n=null;if(e)try{n=JSON.parse(e)}catch{n=e}if(!t.ok){const r=Dt(n,Z1(t.status));throw new ze(r,t.status,n)}return n}async function aCe(t){const e=await t.text();if(!e)return null;try{return JSON.parse(e)}catch{return e}}function jee(t,e){throw JGt(401,t)?(Hfe(),XGt(),new ze(cat,401,t)):e?(Hfe(),fG==null||fG(),new ze("Session expired. Please sign in again.",401)):new ze(Dt(t,Z1(401)),401,t)}function eWt(t){const e=t==null?void 0:t.message;return typeof e=="string"?e:void 0}function Eee(t,e,n){console.error(wo.apiBaseUrl?`[api] ${t||"GET"} ${e.split("?")[0]} got no response from ${wo.apiBaseUrl}`:"[api] VITE_API_BASE_URL is not set. Copy .env.example to .env and restart the dev server.",n??"");const r=n instanceof Error&&n.name==="TimeoutError";return new ze(Z1(r?408:0),0)}async function oCe(t,e,n){try{return await n()}catch(r){throw r instanceof ze&&YFt(t,e,r.status,eWt(r.body)??r.message),r}}function xL(t,e={}){return oCe(e.method,t,()=>tWt(t,e))}async function tWt(t,e={}){const{body:n,headers:r,skipAuth:s,...i}=e,o=Cee(t);let l;try{l=await fetch(o,{...i,headers:{"Content-Type":"application/json",...sCe(s),...uat(),...r},body:n!==void 0?JSON.stringify(n):void 0})}catch(c){throw Eee(i.method,t,c)}if(l.status===401){const c=await aCe(l);jee(c,!s&&!!Nd())}return iCe(l)}const ae={get:(t,e)=>xL(t,{...e,method:"GET"}),post:(t,e,n)=>xL(t,{...n,method:"POST",body:e}),patch:(t,e,n)=>xL(t,{...n,method:"PATCH",body:e}),put:(t,e,n)=>xL(t,{...n,method:"PUT",body:e}),delete:(t,e)=>xL(t,{...e,method:"DELETE"})};function nWt(t){return oCe("GET",t,async()=>{let e;try{e=await fetch(Cee(t),{headers:{...sCe(),...uat()}})}catch(n){throw Eee("GET",t,n)}return e.status===401&&jee(await aCe(e),!!Nd()),e.ok?e.blob():iCe(e)})}function Ea(t,e){return oCe("POST",t,()=>rWt(t,e))}async function rWt(t,e){let n;try{n=await fetch(Cee(t),{method:"POST",headers:{...sCe()},body:e})}catch(r){throw Eee("POST",t,r)}if(n.status===401){const r=await aCe(n);jee(r,!!Nd())}return iCe(n)}function OA(){return new DOMException("The upload was cancelled.","AbortError")}function kg(t){return t instanceof DOMException&&t.name==="AbortError"}function j0(t,e,n,r){return new Promise((s,i)=>{if(r!=null&&r.aborted){i(OA());return}const o=new XMLHttpRequest;o.open("POST",Cee(t));const l=()=>{o.abort(),i(OA())};r==null||r.addEventListener("abort",l,{once:!0}),o.onabort=()=>i(OA()),o.onloadend=()=>r==null?void 0:r.removeEventListener("abort",l);const c=Nd();c&&o.setRequestHeader("Authorization",`Bearer ${c}`);try{const d=Intl.DateTimeFormat().resolvedOptions().timeZone;d&&o.setRequestHeader("X-Timezone",d)}catch{}o.upload.onprogress=d=>{d.lengthComputable&&n&&n(Math.round(d.loaded*100/d.total))},o.onload=()=>{const d=o.responseText;let u=null;if(d)try{u=JSON.parse(d)}catch{u=d}if(o.status===401){try{jee(u,!!c)}catch(h){i(h)}return}if(o.status<200||o.status>=300){const h=Dt(u,Z1(o.status));i(new ze(h,o.status,u));return}s(u)},o.onerror=()=>i(Eee("POST",t)),o.send(e)})}const Gfe=[{id:"u1",username:"max",firstName:"Maximilian",lastName:"Lankheit",email:"max@pensil.so",phone:"+49 170 1234567",role:"Head of Performance",club:"Bayern Munich",position:"Performance Director",country:"Germany",bio:`Head of Performance at Bayern Munich with 12+ years leading elite football performance programmes. Specialising in data-driven training periodization, load management, and integrated multi-disciplinary support. Passionate about bridging sports science research and on-field application to maximise player availability and peak match-day readiness.

Over the past decade, I have built and led high-performance departments across Bundesliga and international football, implementing cutting-edge GPS tracking, force-plate diagnostics, and wellness monitoring systems. My philosophy centres on collaborative leadership — uniting physiotherapists, nutritionists, sport psychologists, and coaching staff under a shared performance framework. I believe that sustainable success in elite football depends on marrying innovation with player-centered care, and I'm committed to mentoring the next generation of performance practitioners.`,interests:["Sport & Exercise Science","Leadership","Fitness & Exercise Physiology"]},{id:"u2",username:"chiara",firstName:"Chiara",lastName:"Delsaut",email:"chiara@pensil.so",phone:"+33 6 1234 5678",role:"Sports Nutritionist",club:"AC Milan",position:"Nutritionist",country:"Italy",bio:`Sports Nutritionist at AC Milan focused on optimising player performance through evidence-based nutrition strategies. Experienced in match-day fueling protocols, body composition management, and individualized dietary planning for elite athletes.

With a background in clinical dietetics and sports science, I design periodized nutrition plans that align with training loads and competition schedules. My work spans hydration optimisation, supplement protocols, and gut-health management for travelling squads. I collaborate closely with the medical and performance teams to ensure every player receives tailored nutritional support, from youth academy prospects to senior internationals. I'm passionate about educating athletes on the 'why' behind their nutrition, empowering them to make better choices on and off the pitch.`,interests:["Nutrition","Recovery and Regeneration","Sport & Exercise Science"]},{id:"u3",username:"jeroen",firstName:"Jeroen",lastName:"Peters",email:"jeroen@pensil.so",phone:"+31 6 12345678",role:"Lead Physiotherapist",club:"AFC Ajax",position:"Physiotherapist",country:"Netherlands",bio:`Lead Physiotherapist at AFC Ajax with expertise in injury prevention, rehabilitation, and return-to-play protocols. Combining manual therapy with cutting-edge technology to keep players performing at their peak.

My approach integrates hands-on treatment with data-driven decision-making — using isokinetic testing, force platforms, and movement screening to build individualized injury-risk profiles. Over 10 years in professional football, I have managed complex musculoskeletal injuries from acute care through competitive return, working in close partnership with surgeons, strength coaches, and sport scientists. I am deeply committed to the Ajax philosophy of developing young talent, and I take pride in creating a physiotherapy culture that prioritizes long-term athlete health alongside short-term competitive demands.`,interests:["Sports Medicine & Physiotherapy","Recovery and Regeneration","Education"]},{id:"u4",username:"emma",firstName:"Emma",lastName:"Deakin",email:"emma@pensil.so",phone:"+44 7700 900123",role:"Sport Psychologist",club:"Liverpool FC",position:"Psychologist",country:"United Kingdom",bio:`Sport Psychologist at Liverpool FC helping elite athletes develop mental resilience, focus, and performance under pressure. Specialising in cognitive behavioural techniques, mindfulness, and team dynamics in high-performance environments.

I work one-on-one with players navigating the psychological demands of elite competition — from managing performance anxiety and building confidence after injury, to developing leadership skills in senior players. My toolkit includes acceptance and commitment therapy, visualisation, and biofeedback training. Beyond individual sessions, I design team-wide mental performance programmes, facilitate squad cohesion workshops, and support coaching staff in creating psychologically safe training environments. I'm a firm believer that mental fitness is as trainable as physical fitness, and my mission is to normalise mental health conversations in professional football.`,interests:["Sport Psychology","Communication","Leadership"]},{id:"u5",username:"pauline",firstName:"Pauline",lastName:"Clavel",email:"pauline@pensil.so",phone:"+33 6 9876 5432",role:"Rehabilitation Specialist",club:"FC Porto",position:"Rehab Specialist",country:"France",bio:`Rehabilitation Specialist at FC Porto dedicated to accelerating player recovery through innovative rehab protocols. Expert in post-surgical rehabilitation, progressive loading strategies, and collaborative return-to-play pathways.

My career has been shaped by a passion for bridging the gap between the treatment room and the training pitch. I specialise in ACL, hamstring, and ankle reconstruction rehabilitation, utilising anti-gravity treadmills, blood-flow restriction training, and neuromuscular re-education to safely accelerate timelines without compromising tissue integrity. I work hand-in-hand with surgeons, physiotherapists, and performance staff to create seamless transition plans, ensuring players return not just fit, but confident and resilient. Mentoring junior rehab practitioners and contributing to return-to-play research are central to my professional identity.`,interests:["Sports Medicine & Physiotherapy","Recovery and Regeneration","Strength & Power"]},{id:"u6",username:"kasper",firstName:"Kasper",lastName:"Thornton",email:"kasper@pensil.so",phone:"+45 20 123456",role:"Strength & Conditioning Coach",club:"Chelsea FC",position:"S&C Coach",country:"Denmark",bio:`Strength & Conditioning Coach at Chelsea FC with a passion for developing athletic power, speed, and endurance in elite footballers. Experienced in periodized training, injury risk reduction, and performance testing.

I design and deliver strength, speed, and conditioning programmes tailored to the physical demands of Premier League football. My methodology blends traditional weight training with plyometrics, velocity-based training, and sport-specific movement patterns. I use GPS and accelerometer data to monitor training loads and adjust programmes in real time, ensuring players peak for match days while minimising overuse injuries. Collaboration with the medical department is central to my practice — together we build robust, resilient athletes who can sustain the intensity of a 50+ game season.`,interests:["Strength & Power","Fitness & Exercise Physiology","Coaching"]},{id:"u7",username:"teena",firstName:"Teena",lastName:"Murray",email:"teena@pensil.so",phone:"+353 87 1234567",role:"Exercise Physiologist",club:"Arsenal FC",position:"Exercise Physiologist",country:"Ireland",bio:`Exercise Physiologist at Arsenal FC specialising in cardiorespiratory fitness assessment, metabolic profiling, and heat/altitude acclimatization for professional footballers. Driven by translating lab data into practical training recommendations.

In my role I oversee VO2max testing, lactate threshold assessments, and body composition analysis to create individualized fitness benchmarks for every player in the squad. I design pre-season conditioning programmes, manage environmental preparation for international competitions, and collaborate with the nutrition team on fueling strategies that align with metabolic demands. My research background in exercise immunology also informs our illness-prevention protocols during congested fixture periods. I'm passionate about making complex physiological data accessible and actionable for coaches and players alike.`,interests:["Fitness & Exercise Physiology","Sport & Exercise Science","Education"]},{id:"u8",username:"tim",firstName:"Tim",lastName:"Zuleger",email:"tim@pensil.so",phone:"+49 151 9876543",role:"Performance Analyst",club:"Manchester City",position:"Performance Analyst",country:"Germany",bio:`Performance Analyst at Manchester City leveraging GPS tracking, video analysis, and advanced metrics to optimise team and individual performance. Building next-generation dashboards for coaching staff decision-making.

I combine Catapult/STATSports GPS data with tactical video coding to provide coaches with actionable insights before, during, and after matches. My work covers physical output analysis, pressing intensity metrics, positional heat maps, and opponent profiling. I develop custom visualisation tools and automated reporting pipelines that integrate seamlessly into the coaching workflow. Beyond the technical side, I pride myself on translating complex data into clear narratives that influence tactical decisions — because the best analysis is the kind that coaches and players can immediately understand and act upon.`,interests:["Sport & Exercise Science","Career Development","Management"]},{id:"u9",username:"michael",firstName:"Michael",lastName:"S",email:"michael@pensil.so",phone:"+44 7911 123456",role:"Sr. Head of Commercial",club:"Juventus",position:"Commercial Director",country:"United Kingdom",bio:`Sr. Head of Commercial at Juventus overseeing sponsorship strategy, brand partnerships, and revenue growth. 15+ years in sports business development with a focus on building long-term commercial value for football organisations.

Throughout my career I have negotiated and managed multi-million euro sponsorship agreements with global brands across sportswear, automotive, financial services, and technology sectors. My approach combines market analytics with relationship-driven sales to create partnerships that deliver measurable ROI for both the club and its sponsors. I also lead our hospitality and matchday experience programmes, continuously innovating to elevate fan engagement and premium revenue streams. I'm passionate about the intersection of sport and business, and I actively mentor young professionals looking to build careers in football's commercial landscape.`,interests:["Leadership","Management","Networking"]},{id:"u10",username:"michel",firstName:"Michel",lastName:"S",email:"michel@pensil.so",phone:"+32 470 123456",role:"Business Development Manager",club:"SL Benfica",position:"Business Development",country:"Belgium",bio:`Business Development Manager at SL Benfica driving strategic growth initiatives, new market expansion, and partnership development. Passionate about connecting the football industry with innovative business opportunities.

I identify and develop commercial opportunities that extend Benfica's global footprint — from international pre-season tours and licensing deals to digital content partnerships and fan engagement platforms. My background in management consulting gives me a structured approach to market analysis, competitive positioning, and stakeholder management. I work cross-functionally with marketing, legal, and football operations to ensure every new initiative aligns with the club's long-term strategic vision. Networking across the European football ecosystem is at the heart of what I do, and I thrive on building relationships that create mutual value.`,interests:["Networking","Career Development","Management"]},{id:"u11",username:"demo",firstName:"Demo",lastName:"User",email:"demo@pensil.so",phone:"+1 555 0100",role:"Community Leader",club:"Inter Milan",position:"Community Manager",country:"United States",bio:`Community Leader at SpatialChat Communities, driving engagement and collaboration across 500+ football professionals worldwide. Dedicated to fostering meaningful connections, organising impactful events, and shaping the future of football industry networking.

As the Community Manager, I design and facilitate programmes that bring together performance scientists, medical staff, coaches, and business leaders to share knowledge and best practices. From curating webinar series and in-person summits to managing our digital platform and mentorship programmes, my goal is to create an inclusive space where every member feels valued and empowered to grow. I also gather community feedback to continuously improve our offerings and ensure we're addressing the real challenges facing football professionals today. Building bridges across disciplines and cultures is what drives me every day.`,interests:["Networking","Leadership","Communication"]}],sWt=["deepankar singh","hjwbd bwdj"];function kD(t){var n;const e=Gfe.find(r=>r.id===t.id||r.email===t.email);return{...t,username:((n=t.username)==null?void 0:n.trim().toLowerCase())||(e==null?void 0:e.username)||t.email.split("@")[0].trim().toLowerCase()||t.firstName.trim().toLowerCase()}}function iWt(t){const e=`${t.firstName??""} ${t.lastName??""}`.trim().toLowerCase();return sWt.includes(e)}function aWt(){try{const t=localStorage.getItem(Vfe.allUsers);if(t){const e=JSON.parse(t),n=e.filter(s=>!iWt(s)),r=n.map(s=>{var o;const i=Gfe.find(l=>l.id===s.id||l.email===s.email);return kD(i?{...i,...s,bio:s.bio&&s.bio.length>50?s.bio:i.bio,interests:(o=s.interests)!=null&&o.length?s.interests:i.interests}:s)});return n.length!==e.length&&localStorage.setItem(Vfe.allUsers,JSON.stringify(r)),r}}catch{}return Gfe.map(kD)}function oWt(t){localStorage.setItem(Vfe.allUsers,JSON.stringify(t.map(kD)))}async function lWt(t,e=null,n=null){return ae.post("/auth/email/otp",{email:t.trim().toLowerCase(),communityId:e,captchaToken:n},{skipAuth:!0})}async function cWt(t,e,n=null){return ae.post("/verify-otp",{email:t.trim().toLowerCase(),otp:Number(e),communityId:n},{skipAuth:!0})}async function dWt(t){return ae.post("/auth/google/exchange",{code:t},{skipAuth:!0})}async function uWt(t,e=null){return ae.post("/auth/apple",e?{id_token:t,communityId:e}:{id_token:t},{skipAuth:!0})}async function P3e(){const{user:t}=await ae.get("/profile"),e=t.token??Nd()??"";return{...t,token:e}}async function lCe(){const{user:t}=await ae.get("/profile");return t}async function cCe(t){const{user:e}=await ae.post("/profile",t);return e}async function hWt(t,e){const n=new URLSearchParams({lat:t.toFixed(2),lng:e.toFixed(2)}),{location:r}=await ae.get(`/profile/location-lookup?${n.toString()}`);return r}async function mWt(t){const{user:e}=await ae.post("/profile/read-receipts",{enabled:t});return e}async function fWt(t){const e=new FormData;e.append("banner",t,t.name);const{user:n}=await Ea("/profile/banner",e);return n}async function dCe(t){const{userIdAvailable:e}=await ae.get(`/profile/username-availability/${encodeURIComponent(t)}`);return e}async function pWt(t){await ae.post("/profile/fcm-token",{fcmToken:t})}async function gWt(t){await ae.delete("/profile/fcm-token",{body:{fcmToken:t}})}async function uCe(t){const e=new FormData;e.append("picture",t,t.name);const{user:n}=await Ea("/profile/picture",e);return n}function vWt(t){const e=t.trim();if(!e)return{firstName:"User",lastName:""};const n=e.split(/\s+/);return{firstName:n[0],lastName:n.slice(1).join(" ")}}function hat(t){const{firstName:e,lastName:n}=vWt(t.name||t.email);return{id:t.id,username:t.userId||t.email.split("@")[0],firstName:e,lastName:n,email:t.email,phone:t.mobile??"",role:t.role??"Member",club:"",position:"",country:"",picture:t.picture,tags:Array.isArray(t.tags)?t.tags:[]}}let wL=null;function yWt(t){return window.grecaptcha?Promise.resolve():wL||(wL=new Promise((e,n)=>{const r=document.createElement("script");r.src=`https://www.google.com/recaptcha/api.js?render=${encodeURIComponent(t)}`,r.async=!0,r.onload=()=>e(),r.onerror=()=>{wL=null,n(new Error("Failed to load reCAPTCHA"))},document.head.appendChild(r)}),wL)}async function mat(t){const e=wo.recaptchaSiteKey;try{await yWt(e);const n=window.grecaptcha;return n?(await new Promise(r=>n.ready(r)),await n.execute(e,{action:t})):null}catch{return null}}async function fat(t){const e=await mat(t);if(!e)throw new Error("reCAPTCHA verification unavailable");return e}var qP={},Ht;if(typeof window>"u"){var R3e={hostname:""};Ht={crypto:{randomUUID:function(){throw Error("unsupported")}},navigator:{userAgent:"",onLine:!0},document:{createElement:function(){return{}},location:R3e,referrer:""},screen:{width:0,height:0},location:R3e,addEventListener:function(){},removeEventListener:function(){},dispatchEvent:function(){},CustomEvent:function(){}}}else Ht=window;var bh={DEBUG:!1,LIB_VERSION:"2.80.0"},qp="__mp_targeting",Wfe="__mp_recorder",bWt="__MP_RECORDER_FILENAME__",pat="__MP_TARGETING_FILENAME__";function I3e(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function M3e(t,e,n,r,s,i,o){try{var l=t[i](o),c=l.value}catch(d){n(d);return}l.done?e(c):Promise.resolve(c).then(r,s)}function Nee(t){return function(){var e=this,n=arguments;return new Promise(function(r,s){var i=t.apply(e,n);function o(c){M3e(i,r,s,o,l,"next",c)}function l(c){M3e(i,r,s,o,l,"throw",c)}o(void 0)})}}function pG(t,e,n){return gat()?pG=Reflect.construct:pG=function(s,i,o){var l=[null];l.push.apply(l,i);var c=Function.bind.apply(s,l),d=new c;return o&&jO(d,o.prototype),d},pG.apply(null,arguments)}function xWt(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function uo(t,e,n){return e&&xWt(t.prototype,e),t}function Ps(){return Ps=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ps.apply(this,arguments)}function qfe(t){return qfe=Object.setPrototypeOf?Object.getPrototypeOf:function(n){return n.__proto__||Object.getPrototypeOf(n)},qfe(t)}function Co(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&jO(t,e)}function Pr(t,e){return e!=null&&typeof Symbol<"u"&&e[Symbol.hasInstance]?!!e[Symbol.hasInstance](t):t instanceof e}function wWt(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function N2(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}function jO(t,e){return jO=Object.setPrototypeOf||function(r,s){return r.__proto__=s,r},jO(t,e)}function Ir(t){"@swc/helpers - typeof";return t&&typeof Symbol<"u"&&t.constructor===Symbol?"symbol":typeof t}function kWt(t,e){if(t){if(typeof t=="string")return I3e(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(n);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return I3e(t,e)}}function EO(t){var e=typeof Map=="function"?new Map:void 0;return EO=function(r){if(r===null||!wWt(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,s)}function s(){return pG(r,arguments,qfe(this).constructor)}return s.prototype=Object.create(r.prototype,{constructor:{value:s,enumerable:!1,writable:!0,configurable:!0}}),jO(s,r)},EO(t)}function gat(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(gat=function(){return!!t})()}function on(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=kWt(t))||e){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function T2(t,e){var n,r,s,i,o={label:0,sent:function(){if(s[0]&1)throw s[1];return s[1]},trys:[],ops:[]};return i={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(i[Symbol.iterator]=function(){return this}),i;function l(d){return function(u){return c([d,u])}}function c(d){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(s=d[0]&2?r.return:d[0]?r.throw||((s=r.return)&&s.call(r),0):r.next)&&!(s=s.call(r,d[1])).done)return s;switch(r=0,s&&(d=[d[0]&2,s.value]),d[0]){case 0:case 1:s=d;break;case 4:return o.label++,{value:d[1],done:!1};case 5:o.label++,r=d[1],d=[0];continue;case 7:d=o.ops.pop(),o.trys.pop();continue;default:if(s=o.trys,!(s=s.length>0&&s[s.length-1])&&(d[0]===6||d[0]===2)){o=0;continue}if(d[0]===3&&(!s||d[1]>s[0]&&d[1]<s[3])){o.label=d[1];break}if(d[0]===6&&o.label<s[1]){o.label=s[1],s=d;break}if(s&&o.label<s[2]){o.label=s[2],o.ops.push(d);break}s[2]&&o.ops.pop(),o.trys.pop();continue}d=e.call(t,o)}catch(u){d=[6,u],r=0}finally{n=s=0}if(d[0]&5)throw d[1];return{value:d[0]?d[1]:void 0,done:!0}}}function hCe(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}var SWt=Object.defineProperty,CWt=function(t,e,n){return e in t?SWt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},En=function(t,e,n){return CWt(t,(typeof e>"u"?"undefined":Ir(e))!=="symbol"?e+"":e,n)},L3e,jWt=Object.defineProperty,EWt=function(t,e,n){return e in t?jWt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},D3e=function(t,e,n){return EWt(t,(typeof e>"u"?"undefined":Ir(e))!=="symbol"?e+"":e,n)},dc=function(t){return t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t}(dc||{}),$3e={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},O3e={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},uU={},NWt=function(){return!!globalThis.Zone};function mCe(t){if(uU[t])return uU[t];var e=globalThis[t],n=e.prototype,r=t in $3e?$3e[t]:void 0,s=!!(r&&r.every(function(u){var h,m;return!!((m=(h=Object.getOwnPropertyDescriptor(n,u))==null?void 0:h.get)!=null&&m.toString().includes("[native code]"))})),i=t in O3e?O3e[t]:void 0,o=!!(i&&i.every(function(u){var h;return typeof n[u]=="function"&&((h=n[u])==null?void 0:h.toString().includes("[native code]"))}));if(s&&o&&!NWt())return uU[t]=e.prototype,e.prototype;try{var l=document.createElement("iframe");document.body.appendChild(l);var c=l.contentWindow;if(!c)return e.prototype;var d=c[t].prototype;return document.body.removeChild(l),d?uU[t]=d:n}catch{return n}}var voe={};function aS(t,e,n){var r,s=t+"."+String(n);if(voe[s])return voe[s].call(e);var i=mCe(t),o=(r=Object.getOwnPropertyDescriptor(i,n))==null?void 0:r.get;return o?(voe[s]=o,o.call(e)):e[n]}var yoe={};function vat(t,e,n){var r=t+"."+String(n);if(yoe[r])return yoe[r].bind(e);var s=mCe(t),i=s[n];return typeof i!="function"?e[n]:(yoe[r]=i,i.bind(e))}function TWt(t){return aS("Node",t,"childNodes")}function _Wt(t){return aS("Node",t,"parentNode")}function AWt(t){return aS("Node",t,"parentElement")}function PWt(t){return aS("Node",t,"textContent")}function RWt(t,e){return vat("Node",t,"contains")(e)}function IWt(t){return vat("Node",t,"getRootNode")()}function MWt(t){return!t||!("host"in t)?null:aS("ShadowRoot",t,"host")}function LWt(t){return t.styleSheets}function DWt(t){return!t||!("shadowRoot"in t)?null:aS("Element",t,"shadowRoot")}function $Wt(t,e){return aS("Element",t,"querySelector")(e)}function OWt(t,e){return aS("Element",t,"querySelectorAll")(e)}function FWt(){return mCe("MutationObserver").constructor}function BWt(t,e,n){try{if(!(e in t))return function(){};var r=t[e],s=n(r);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:r}})),t[e]=s,function(){t[e]=r}}catch{return function(){}}}var Hd={childNodes:TWt,parentNode:_Wt,parentElement:AWt,textContent:PWt,contains:RWt,getRootNode:IWt,host:MWt,styleSheets:LWt,shadowRoot:DWt,querySelector:$Wt,querySelectorAll:OWt,mutationObserver:FWt,patch:BWt};function yat(t){return t.nodeType===t.ELEMENT_NODE}function SD(t){var e=t&&"host"in t&&"mode"in t&&Hd.host(t)||null;return!!(e&&"shadowRoot"in e&&Hd.shadowRoot(e)===t)}function CD(t){return Object.prototype.toString.call(t)==="[object ShadowRoot]"}function UWt(t){return t.includes(" background-clip: text;")&&!t.includes(" -webkit-background-clip: text;")&&(t=t.replace(/\sbackground-clip:\s*text;/g," -webkit-background-clip: text; background-clip: text;")),t}function zWt(t){var e=t.cssText;if(e.split('"').length<3)return e;var n=["@import","url("+JSON.stringify(t.href)+")"];return t.layerName===""?n.push("layer"):t.layerName&&n.push("layer("+t.layerName+")"),t.supportsText&&n.push("supports("+t.supportsText+")"),t.media.length&&n.push(t.media.mediaText),n.join(" ")+";"}function Kfe(t){try{var e=t.rules||t.cssRules;if(!e)return null;var n=t.href;!n&&t.ownerNode&&t.ownerNode.ownerDocument&&(n=t.ownerNode.ownerDocument.location.href);var r=Array.from(e,function(s){return bat(s,n)}).join("");return UWt(r)}catch{return null}}function bat(t,e){if(HWt(t)){var n;try{n=Kfe(t.styleSheet)||zWt(t)}catch{n=t.cssText}return t.styleSheet.href?LK(n,t.styleSheet.href):n}else{var r=t.cssText;return GWt(t)&&t.selectorText.includes(":")&&(r=VWt(r)),e?LK(r,e):r}}function VWt(t){var e=/(\[(?:[\w-]+)[^\\])(:(?:[\w-]+)\])/gm;return t.replace(e,"$1\\$2")}function HWt(t){return"styleSheet"in t}function GWt(t){return"selectorText"in t}var xat=function(){function t(){D3e(this,"idNodeMap",new Map),D3e(this,"nodeMetaMap",new WeakMap)}var e=t.prototype;return e.getId=function(r){var s;if(!r)return-1;var i=(s=this.getMeta(r))==null?void 0:s.id;return i??-1},e.getNode=function(r){return this.idNodeMap.get(r)||null},e.getIds=function(){return Array.from(this.idNodeMap.keys())},e.getMeta=function(r){return this.nodeMetaMap.get(r)||null},e.removeNodeFromMap=function(r,s){var i=this;s===void 0&&(s=!1);var o=this.getId(r);this.idNodeMap.delete(o),s&&this.nodeMetaMap.delete(r),r.childNodes&&r.childNodes.forEach(function(l){return i.removeNodeFromMap(l,s)})},e.has=function(r){return this.idNodeMap.has(r)},e.hasNode=function(r){return this.nodeMetaMap.has(r)},e.add=function(r,s){var i=s.id;this.idNodeMap.set(i,r),this.nodeMetaMap.set(r,s)},e.replace=function(r,s){var i=this.getNode(r);if(i){var o=this.nodeMetaMap.get(i);o&&this.nodeMetaMap.set(s,o)}this.idNodeMap.set(r,s)},e.reset=function(){this.idNodeMap=new Map,this.nodeMetaMap=new WeakMap},t}();function WWt(){return new xat}function IK(t){var e=t.element,n=t.maskInputOptions,r=t.tagName,s=t.type,i=t.value,o=t.maskInputFn,l=i||"",c=s&&_2(s);return(n[r.toLowerCase()]||c&&n[c])&&(o?l=o(l,e):l="*".repeat(l.length)),l}function _2(t){return t.toLowerCase()}var F3e="__rrweb_original__";function qWt(t){var e=t.getContext("2d");if(!e)return!0;for(var n=50,r=0;r<t.width;r+=n)for(var s=0;s<t.height;s+=n){var i=e.getImageData,o=F3e in i?i[F3e]:i,l=new Uint32Array(o.call(e,r,s,Math.min(n,t.width-r),Math.min(n,t.height-s)).data.buffer);if(l.some(function(c){return c!==0}))return!1}return!0}function MK(t){var e=t.type;return t.hasAttribute("data-rr-is-password")?"password":e?_2(e):null}function wat(t,e){var n;try{n=new URL(t,e??window.location.href)}catch{return null}var r=/\.([0-9a-z]+)(?:$)/i,s=n.pathname.match(r),i;return(i=s==null?void 0:s[1])!=null?i:null}function KWt(t){var e="";return t.indexOf("//")>-1?e=t.split("/").slice(0,3).join("/"):e=t.split("/")[0],e=e.split("?")[0],e}var YWt=/url\((?:(')([^']*)'|(")(.*?)"|([^)]*))\)/gm,QWt=/^(?:[a-z+]+:)?\/\//i,ZWt=/^www\..*/i,JWt=/^(data:)([^,]*),(.*)/i;function LK(t,e){return(t||"").replace(YWt,function(n,r,s,i,o,l){var c=s||o||l,d=r||i||"";if(!c)return n;if(QWt.test(c)||ZWt.test(c)||JWt.test(c))return"url("+d+c+d+")";if(c[0]==="/")return"url("+d+(KWt(e)+c)+d+")";var u=e.split("/"),h=c.split("/");u.pop();for(var m=on(h),f;!(f=m()).done;){var p=f.value;p!=="."&&(p===".."?u.pop():u.push(p))}return"url("+d+u.join("/")+d+")"})}function hU(t,e){return e===void 0&&(e=!1),e?t.replace(/(\/\*[^*]*\*\/)|[\s;]/g,""):t.replace(/(\/\*[^*]*\*\/)|[\s;]/g,"").replace(/0px/g,"0")}function XWt(t,e,n){n===void 0&&(n=!1);var r=Array.from(e.childNodes),s=[],i=0;if(r.length>1&&t&&typeof t=="string"){for(var o=hU(t,n),l=o.length/t.length,c=1;c<r.length;c++)if(r[c].textContent&&typeof r[c].textContent=="string"){for(var d=hU(r[c].textContent,n),u=100,h=3;h<d.length&&(d[h].match(/[a-zA-Z0-9]/)||d.indexOf(d.substring(0,h),1)!==-1);h++);for(;h<d.length;h++){var m=d.substring(0,h),f=o.split(m),p=-1;if(f.length===2)p=f[0].length;else if(f.length>2&&f[0]===""&&r[c-1].textContent!=="")p=o.indexOf(m,1);else if(f.length===1){if(m=m.substring(0,m.length-1),f=o.split(m),f.length<=1)return s.push(t),s;h=u+1}else h===d.length-1&&(p=o.indexOf(m));if(f.length>=2&&h>u){var g=r[c-1].textContent;if(g&&typeof g=="string"){var v=hU(g).length;p=o.indexOf(m,v)}p===-1&&(p=f[0].length)}if(p!==-1){for(var b=Math.floor(p/l);b>0&&b<t.length;){if(i+=1,i>50*r.length)return s.push(t),s;var x=hU(t.substring(0,b),n);if(x.length===p){s.push(t.substring(0,b)),t=t.substring(b),o=o.substring(p);break}else x.length<p?b+=Math.max(1,Math.floor((p-x.length)/l)):b-=Math.max(1,Math.floor((x.length-p)*l))}break}}}}return s.push(t),s}function eqt(t,e){return XWt(t,e).join("/* rr_split */")}var tqt=1,nqt=new RegExp("[^a-z0-9-_:]"),NO=-2;function kat(){return tqt++}function rqt(t){if(Pr(t,HTMLFormElement))return"form";var e=_2(t.tagName);return nqt.test(e)?"div":e}var VN,B3e,sqt=/^[^ \t\n\r\u000c]+/,iqt=/^[, \t\n\r\u000c]+/;function aqt(t,e){if(e.trim()==="")return e;var n=0;function r(d){var u,h=d.exec(e.substring(n));return h?(u=h[0],n+=u.length,u):""}for(var s=[];r(iqt),!(n>=e.length);){var i=r(sqt);if(i.slice(-1)===",")i=tA(t,i.substring(0,i.length-1)),s.push(i);else{var o="";i=tA(t,i);for(var l=!1;;){var c=e.charAt(n);if(c===""){s.push((i+o).trim());break}else if(l)c===")"&&(l=!1);else if(c===","){n+=1,s.push((i+o).trim());break}else c==="("&&(l=!0);o+=c,n+=1}}}return s.join(", ")}var U3e=new WeakMap;function tA(t,e){return!e||e.trim()===""?e:fCe(t,e)}function oqt(t){return!!(t.tagName==="svg"||t.ownerSVGElement)}function fCe(t,e){var n=U3e.get(t);if(n||(n=t.createElement("a"),U3e.set(t,n)),!e)e="";else if(e.startsWith("blob:")||e.startsWith("data:"))return e;return n.setAttribute("href",e),n.href}function Sat(t,e,n,r){return r&&(n==="src"||n==="href"&&!(e==="use"&&r[0]==="#")||n==="xlink:href"&&r[0]!=="#"||n==="background"&&(e==="table"||e==="td"||e==="th")?tA(t,r):n==="srcset"?aqt(t,r):n==="style"?LK(r,fCe(t)):e==="object"&&n==="data"?tA(t,r):r)}function Cat(t,e,n){return(t==="video"||t==="audio")&&e==="autoplay"}function lqt(t,e,n){try{if(typeof e=="string"){if(t.classList.contains(e))return!0}else for(var r=t.classList.length;r--;){var s=t.classList[r];if(e.test(s))return!0}if(n)return t.matches(n)}catch{}return!1}function DK(t,e,n){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return n?DK(Hd.parentNode(t),e,n):!1;for(var r=t.classList.length;r--;){var s=t.classList[r];if(e.test(s))return!0}return n?DK(Hd.parentNode(t),e,n):!1}function jat(t,e,n,r){var s;if(yat(t)){if(s=t,!Hd.childNodes(s).length)return!1}else{if(Hd.parentElement(t)===null)return!1;s=Hd.parentElement(t)}try{if(typeof e=="string"){if(r){if(s.closest("."+e))return!0}else if(s.classList.contains(e))return!0}else if(DK(s,e,r))return!0;if(n){if(r){if(s.closest(n))return!0}else if(s.matches(n))return!0}}catch{}return!1}function cqt(t,e,n){var r=t.contentWindow;if(r){var s=!1,i;try{i=r.document.readyState}catch{return}if(i!=="complete"){var o=setTimeout(function(){s||(e(),s=!0)},n);t.addEventListener("load",function(){clearTimeout(o),s=!0,e()});return}var l="about:blank";if(r.location.href!==l||t.src===l||t.src==="")return setTimeout(e,0),t.addEventListener("load",e);t.addEventListener("load",e)}}function dqt(t,e,n){var r=!1,s;try{s=t.sheet}catch{return}if(!s){var i=setTimeout(function(){r||(e(),r=!0)},n);t.addEventListener("load",function(){clearTimeout(i),r=!0,e()})}}function uqt(t,e){var n=e.doc,r=e.mirror,s=e.blockClass,i=e.blockSelector,o=e.needsMask,l=e.inlineStylesheet,c=e.maskInputOptions,d=c===void 0?{}:c,u=e.maskTextFn,h=e.maskInputFn,m=e.dataURLOptions,f=m===void 0?{}:m,p=e.inlineImages,g=e.recordCanvas,v=e.keepIframeSrcFn,b=e.newlyAddedElement,x=b===void 0?!1:b,w=e.cssCaptured,k=w===void 0?!1:w,S=hqt(n,r);switch(t.nodeType){case t.DOCUMENT_NODE:return t.compatMode!=="CSS1Compat"?{type:dc.Document,childNodes:[],compatMode:t.compatMode}:{type:dc.Document,childNodes:[]};case t.DOCUMENT_TYPE_NODE:return{type:dc.DocumentType,name:t.name,publicId:t.publicId,systemId:t.systemId,rootId:S};case t.ELEMENT_NODE:return fqt(t,{doc:n,blockClass:s,blockSelector:i,inlineStylesheet:l,maskInputOptions:d,maskInputFn:h,dataURLOptions:f,inlineImages:p,recordCanvas:g,keepIframeSrcFn:v,newlyAddedElement:x,rootId:S});case t.TEXT_NODE:return mqt(t,{doc:n,needsMask:o,maskTextFn:u,rootId:S,cssCaptured:k});case t.CDATA_SECTION_NODE:return{type:dc.CDATA,textContent:"",rootId:S};case t.COMMENT_NODE:return{type:dc.Comment,textContent:Hd.textContent(t)||"",rootId:S};default:return!1}}function hqt(t,e){if(e.hasNode(t)){var n=e.getId(t);return n===1?void 0:n}}function mqt(t,e){var n=e.needsMask,r=e.maskTextFn,s=e.rootId,i=e.cssCaptured,o=Hd.parentNode(t),l=o&&o.tagName,c="",d=l==="STYLE"?!0:void 0,u=l==="SCRIPT"?!0:void 0;return u?c="SCRIPT_PLACEHOLDER":i||(c=Hd.textContent(t),d&&c&&(c=LK(c,fCe(e.doc)))),!d&&!u&&c&&n&&(c=r?r(c,Hd.parentElement(t)):c.replace(/[\S]/g,"*")),{type:dc.Text,textContent:c||"",rootId:s}}function fqt(t,e){for(var n=e.doc,r=e.blockClass,s=e.blockSelector,i=e.inlineStylesheet,o=e.maskInputOptions,l=o===void 0?{}:o,c=e.maskInputFn,d=e.dataURLOptions,u=d===void 0?{}:d,h=e.inlineImages,m=e.recordCanvas,f=e.keepIframeSrcFn,p=e.newlyAddedElement,g=p===void 0?!1:p,v=e.rootId,b=lqt(t,r,s),x=rqt(t),w={},k=t.attributes.length,S=0;S<k;S++){var C=t.attributes[S];Cat(x,C.name,C.value)||(w[C.name]=Sat(n,x,_2(C.name),C.value))}if(x==="link"&&i){var j=Array.from(n.styleSheets).find(function(W){return W.href===t.href}),E=null;j&&(E=Kfe(j)),E&&(delete w.rel,delete w.href,w._cssText=E)}if(x==="style"&&t.sheet){var N=Kfe(t.sheet);N&&(t.childNodes.length>1&&(N=eqt(N,t)),w._cssText=N)}if(x==="input"||x==="textarea"||x==="select"){var A=t.value,_=t.checked;w.type!=="radio"&&w.type!=="checkbox"&&w.type!=="submit"&&w.type!=="button"&&A?w.value=IK({element:t,type:MK(t),tagName:x,value:A,maskInputOptions:l,maskInputFn:c}):_&&(w.checked=_)}if(x==="option"&&(t.selected&&!l.select?w.selected=!0:delete w.selected),x==="dialog"&&t.open&&(w.rr_open_mode=t.matches("dialog:modal")?"modal":"non-modal"),x==="canvas"&&m){if(t.__context==="2d")qWt(t)||(w.rr_dataURL=t.toDataURL(u.type,u.quality));else if(!("__context"in t)){var T=t.toDataURL(u.type,u.quality),R=n.createElement("canvas");R.width=t.width,R.height=t.height;var O=R.toDataURL(u.type,u.quality);T!==O&&(w.rr_dataURL=T)}}if(x==="img"&&h){VN||(VN=n.createElement("canvas"),B3e=VN.getContext("2d"));var F=t,D=F.currentSrc||F.getAttribute("src")||"<unknown-src>",I=F.crossOrigin,P=function(){F.removeEventListener("load",P);try{VN.width=F.naturalWidth,VN.height=F.naturalHeight,B3e.drawImage(F,0,0),w.rr_dataURL=VN.toDataURL(u.type,u.quality)}catch(W){if(F.crossOrigin!=="anonymous"){F.crossOrigin="anonymous",F.complete&&F.naturalWidth!==0?P():F.addEventListener("load",P);return}else console.warn("Cannot inline img src="+D+"! Error: "+W)}F.crossOrigin==="anonymous"&&(I?w.crossOrigin=I:F.removeAttribute("crossorigin"))};F.complete&&F.naturalWidth!==0?P():F.addEventListener("load",P)}if(x==="audio"||x==="video"){var M=w;M.rr_mediaState=t.paused?"paused":"played",M.rr_mediaCurrentTime=t.currentTime,M.rr_mediaPlaybackRate=t.playbackRate,M.rr_mediaMuted=t.muted,M.rr_mediaLoop=t.loop,M.rr_mediaVolume=t.volume}if(g||(t.scrollLeft&&(w.rr_scrollLeft=t.scrollLeft),t.scrollTop&&(w.rr_scrollTop=t.scrollTop)),b){var z=t.getBoundingClientRect(),G=z.width,B=z.height;w={class:w.class,rr_width:""+G+"px",rr_height:""+B+"px"}}x==="iframe"&&!f(w.src)&&(t.contentDocument||(w.rr_src=w.src),delete w.src);var H;try{customElements.get(x)&&(H=!0)}catch{}return{type:dc.Element,tagName:x,attributes:w,childNodes:[],isSVG:oqt(t)||void 0,needBlock:b,rootId:v,isCustom:H}}function Na(t){return t==null?"":t.toLowerCase()}function pqt(t,e){if(e.comment&&t.type===dc.Comment)return!0;if(t.type===dc.Element){if(e.script&&(t.tagName==="script"||t.tagName==="link"&&(t.attributes.rel==="preload"&&t.attributes.as==="script"||t.attributes.rel==="modulepreload")||t.tagName==="link"&&t.attributes.rel==="prefetch"&&typeof t.attributes.href=="string"&&wat(t.attributes.href)==="js"))return!0;if(e.headFavicon&&(t.tagName==="link"&&t.attributes.rel==="shortcut icon"||t.tagName==="meta"&&(Na(t.attributes.name).match(/^msapplication-tile(image|color)$/)||Na(t.attributes.name)==="application-name"||Na(t.attributes.rel)==="icon"||Na(t.attributes.rel)==="apple-touch-icon"||Na(t.attributes.rel)==="shortcut icon")))return!0;if(t.tagName==="meta"){if(e.headMetaDescKeywords&&Na(t.attributes.name).match(/^description|keywords$/))return!0;if(e.headMetaSocial&&(Na(t.attributes.property).match(/^(og|twitter|fb):/)||Na(t.attributes.name).match(/^(og|twitter):/)||Na(t.attributes.name)==="pinterest"))return!0;if(e.headMetaRobots&&(Na(t.attributes.name)==="robots"||Na(t.attributes.name)==="googlebot"||Na(t.attributes.name)==="bingbot"))return!0;if(e.headMetaHttpEquiv&&t.attributes["http-equiv"]!==void 0)return!0;if(e.headMetaAuthorship&&(Na(t.attributes.name)==="author"||Na(t.attributes.name)==="generator"||Na(t.attributes.name)==="framework"||Na(t.attributes.name)==="publisher"||Na(t.attributes.name)==="progid"||Na(t.attributes.property).match(/^article:/)||Na(t.attributes.property).match(/^product:/)))return!0;if(e.headMetaVerification&&(Na(t.attributes.name)==="google-site-verification"||Na(t.attributes.name)==="yandex-verification"||Na(t.attributes.name)==="csrf-token"||Na(t.attributes.name)==="p:domain_verify"||Na(t.attributes.name)==="verify-v1"||Na(t.attributes.name)==="verification"||Na(t.attributes.name)==="shopify-checkout-api-token"))return!0}}return!1}function nA(t,e){var n=e.doc,r=e.mirror,s=e.blockClass,i=e.blockSelector,o=e.maskTextClass,l=e.maskTextSelector,c=e.skipChild,d=c===void 0?!1:c,u=e.inlineStylesheet,h=u===void 0?!0:u,m=e.maskInputOptions,f=m===void 0?{}:m,p=e.maskTextFn,g=e.maskInputFn,v=e.slimDOMOptions,b=e.dataURLOptions,x=b===void 0?{}:b,w=e.inlineImages,k=w===void 0?!1:w,S=e.recordCanvas,C=S===void 0?!1:S,j=e.onSerialize,E=e.onIframeLoad,N=e.iframeLoadTimeout,A=N===void 0?5e3:N,_=e.onStylesheetLoad,T=e.stylesheetLoadTimeout,R=T===void 0?5e3:T,O=e.keepIframeSrcFn,F=O===void 0?function(){return!1}:O,D=e.newlyAddedElement,I=D===void 0?!1:D,P=e.cssCaptured,M=P===void 0?!1:P,z=e.needsMask,G=e.preserveWhiteSpace,B=G===void 0?!0:G;if(!z){var H=z===void 0;z=jat(t,o,l,H)}var W=uqt(t,{doc:n,mirror:r,blockClass:s,blockSelector:i,needsMask:z,inlineStylesheet:h,maskInputOptions:f,maskTextFn:p,maskInputFn:g,dataURLOptions:x,inlineImages:k,recordCanvas:C,keepIframeSrcFn:F,newlyAddedElement:I,cssCaptured:M});if(!W)return console.warn(t,"not serialized"),null;var V;r.hasNode(t)?V=r.getId(t):pqt(W,v)||!B&&W.type===dc.Text&&!W.textContent.replace(/^\s+|\s+$/gm,"").length?V=NO:V=kat();var U=Object.assign(W,{id:V});if(r.add(t,U),V===NO)return null;j&&j(t);var ne=!d;if(U.type===dc.Element){ne=ne&&!U.needBlock,delete U.needBlock;var te=Hd.shadowRoot(t);te&&CD(te)&&(U.isShadowHost=!0)}if((U.type===dc.Document||U.type===dc.Element)&&ne){v.headWhitespace&&U.type===dc.Element&&U.tagName==="head"&&(B=!1);var re={doc:n,mirror:r,blockClass:s,blockSelector:i,needsMask:z,maskTextClass:o,maskTextSelector:l,skipChild:d,inlineStylesheet:h,maskInputOptions:f,maskTextFn:p,maskInputFn:g,slimDOMOptions:v,dataURLOptions:x,inlineImages:k,recordCanvas:C,preserveWhiteSpace:B,onSerialize:j,onIframeLoad:E,iframeLoadTimeout:A,onStylesheetLoad:_,stylesheetLoadTimeout:R,keepIframeSrcFn:F,cssCaptured:!1};if(!(U.type===dc.Element&&U.tagName==="textarea"&&U.attributes.value!==void 0)){U.type===dc.Element&&U.attributes._cssText!==void 0&&typeof U.attributes._cssText=="string"&&(re.cssCaptured=!0);for(var fe=on(Array.from(Hd.childNodes(t))),le;!(le=fe()).done;){var q=le.value,Y=nA(q,re);Y&&U.childNodes.push(Y)}}var X=null;if(yat(t)&&(X=Hd.shadowRoot(t)))for(var Q=on(Array.from(Hd.childNodes(X))),ie;!(ie=Q()).done;){var he=ie.value,ye=nA(he,re);ye&&(CD(X)&&(ye.isShadow=!0),U.childNodes.push(ye))}}var J=Hd.parentNode(t);return J&&SD(J)&&CD(J)&&(U.isShadow=!0),U.type===dc.Element&&U.tagName==="iframe"&&cqt(t,function(){var K=t.contentDocument;if(K&&E){var ce=nA(K,{doc:K,mirror:r,blockClass:s,blockSelector:i,needsMask:z,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:h,maskInputOptions:f,maskTextFn:p,maskInputFn:g,slimDOMOptions:v,dataURLOptions:x,inlineImages:k,recordCanvas:C,preserveWhiteSpace:B,onSerialize:j,onIframeLoad:E,iframeLoadTimeout:A,onStylesheetLoad:_,stylesheetLoadTimeout:R,keepIframeSrcFn:F});ce&&E(t,ce)}},A),U.type===dc.Element&&U.tagName==="link"&&typeof U.attributes.rel=="string"&&(U.attributes.rel==="stylesheet"||U.attributes.rel==="preload"&&typeof U.attributes.href=="string"&&wat(U.attributes.href)==="css")&&dqt(t,function(){if(_){var K=nA(t,{doc:n,mirror:r,blockClass:s,blockSelector:i,needsMask:z,maskTextClass:o,maskTextSelector:l,skipChild:!1,inlineStylesheet:h,maskInputOptions:f,maskTextFn:p,maskInputFn:g,slimDOMOptions:v,dataURLOptions:x,inlineImages:k,recordCanvas:C,preserveWhiteSpace:B,onSerialize:j,onIframeLoad:E,iframeLoadTimeout:A,onStylesheetLoad:_,stylesheetLoadTimeout:R,keepIframeSrcFn:F});K&&_(t,K)}},R),U}function gqt(t,e){var n=e||{},r=n.mirror,s=r===void 0?new xat:r,i=n.blockClass,o=i===void 0?"rr-block":i,l=n.blockSelector,c=l===void 0?null:l,d=n.maskTextClass,u=d===void 0?"rr-mask":d,h=n.maskTextSelector,m=h===void 0?null:h,f=n.inlineStylesheet,p=f===void 0?!0:f,g=n.inlineImages,v=g===void 0?!1:g,b=n.recordCanvas,x=b===void 0?!1:b,w=n.maskAllInputs,k=w===void 0?!1:w,S=n.maskTextFn,C=n.maskInputFn,j=n.slimDOM,E=j===void 0?!1:j,N=n.dataURLOptions,A=n.preserveWhiteSpace,_=n.onSerialize,T=n.onIframeLoad,R=n.iframeLoadTimeout,O=n.onStylesheetLoad,F=n.stylesheetLoadTimeout,D=n.keepIframeSrcFn,I=D===void 0?function(){return!1}:D,P=k===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0,hidden:!0}:k===!1?{password:!0}:k,M=E===!0||E==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaDescKeywords:E==="all",headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaAuthorship:!0,headMetaVerification:!0}:E===!1?{}:E;return nA(t,{doc:t,mirror:s,blockClass:o,blockSelector:c,maskTextClass:u,maskTextSelector:m,skipChild:!1,inlineStylesheet:p,maskInputOptions:P,maskTextFn:S,maskInputFn:C,slimDOMOptions:M,dataURLOptions:N,inlineImages:v,recordCanvas:x,preserveWhiteSpace:A,onSerialize:_,onIframeLoad:T,iframeLoadTimeout:R,onStylesheetLoad:O,stylesheetLoadTimeout:F,keepIframeSrcFn:I,newlyAddedElement:!1})}function vqt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function yqt(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return Pr(this,r)?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return t[r]}})}),n}var pCe={exports:{}},Ua=String,Eat=function(){return{isColorSupported:!1,reset:Ua,bold:Ua,dim:Ua,italic:Ua,underline:Ua,inverse:Ua,hidden:Ua,strikethrough:Ua,black:Ua,red:Ua,green:Ua,yellow:Ua,blue:Ua,magenta:Ua,cyan:Ua,white:Ua,gray:Ua,bgBlack:Ua,bgRed:Ua,bgGreen:Ua,bgYellow:Ua,bgBlue:Ua,bgMagenta:Ua,bgCyan:Ua,bgWhite:Ua}};pCe.exports=Eat();pCe.exports.createColors=Eat;var bqt=pCe.exports,xqt={},wqt=Object.freeze(Object.defineProperty({__proto__:null,default:xqt},Symbol.toStringTag,{value:"Module"})),Il=yqt(wqt),z3e=bqt,V3e=Il,Yfe=function(t){Co(e,t);function e(r,s,i,o,l,c){var d;return d=t.call(this,r)||this,d.name="CssSyntaxError",d.reason=r,l&&(d.file=l),o&&(d.source=o),c&&(d.plugin=c),typeof s<"u"&&typeof i<"u"&&(typeof s=="number"?(d.line=s,d.column=i):(d.line=s.line,d.column=s.column,d.endLine=i.line,d.endColumn=i.column)),d.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(d,e),d}var n=e.prototype;return n.setMessage=function(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason},n.showSourceCode=function(s){var i=this;if(!this.source)return"";var o=this.source;s==null&&(s=z3e.isColorSupported),V3e&&s&&(o=V3e(o));var l=o.split(/\r?\n/),c=Math.max(this.line-3,0),d=Math.min(this.line+2,l.length),u=String(d).length,h,m;if(s){var f=z3e.createColors(!0),p=f.bold,g=f.gray,v=f.red;h=function(b){return p(v(b))},m=function(b){return g(b)}}else h=m=function(b){return b};return l.slice(c,d).map(function(b,x){var w=c+1+x,k=" "+(" "+w).slice(-u)+" | ";if(w===i.line){var S=m(k.replace(/\d/g," "))+b.slice(0,i.column-1).replace(/[^\t]/g," ");return h(">")+m(k)+b+`
 `+S+h("^")}return" "+m(k)+b}).join(`
`)},n.toString=function(){var s=this.showSourceCode();return s&&(s=`

`+s+`
`),this.name+": "+this.message+s},e}(EO(Error)),gCe=Yfe;Yfe.default=Yfe;var oS={};oS.isClean=Symbol("isClean");oS.my=Symbol("my");var H3e={after:`
`,beforeClose:`
`,beforeComment:`
`,beforeDecl:`
`,beforeOpen:" ",beforeRule:`
`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:"    ",semicolon:!1};function kqt(t){return t[0].toUpperCase()+t.slice(1)}var Qfe=function(){function t(n){this.builder=n}var e=t.prototype;return e.atrule=function(r,s){var i="@"+r.name,o=r.params?this.rawValue(r,"params"):"";if(typeof r.raws.afterName<"u"?i+=r.raws.afterName:o&&(i+=" "),r.nodes)this.block(r,i+o);else{var l=(r.raws.between||"")+(s?";":"");this.builder(i+o+l,r)}},e.beforeAfter=function(r,s){var i;r.type==="decl"?i=this.raw(r,null,"beforeDecl"):r.type==="comment"?i=this.raw(r,null,"beforeComment"):s==="before"?i=this.raw(r,null,"beforeRule"):i=this.raw(r,null,"beforeClose");for(var o=r.parent,l=0;o&&o.type!=="root";)l+=1,o=o.parent;if(i.includes(`
`)){var c=this.raw(r,null,"indent");if(c.length)for(var d=0;d<l;d++)i+=c}return i},e.block=function(r,s){var i=this.raw(r,"between","beforeOpen");this.builder(s+i+"{",r,"start");var o;r.nodes&&r.nodes.length?(this.body(r),o=this.raw(r,"after")):o=this.raw(r,"after","emptyBody"),o&&this.builder(o),this.builder("}",r,"end")},e.body=function(r){for(var s=r.nodes.length-1;s>0&&r.nodes[s].type==="comment";)s-=1;for(var i=this.raw(r,"semicolon"),o=0;o<r.nodes.length;o++){var l=r.nodes[o],c=this.raw(l,"before");c&&this.builder(c),this.stringify(l,s!==o||i)}},e.comment=function(r){var s=this.raw(r,"left","commentLeft"),i=this.raw(r,"right","commentRight");this.builder("/*"+s+r.text+i+"*/",r)},e.decl=function(r,s){var i=this.raw(r,"between","colon"),o=r.prop+i+this.rawValue(r,"value");r.important&&(o+=r.raws.important||" !important"),s&&(o+=";"),this.builder(o,r)},e.document=function(r){this.body(r)},e.raw=function(r,s,i){var o;if(i||(i=s),s&&(o=r.raws[s],typeof o<"u"))return o;var l=r.parent;if(i==="before"&&(!l||l.type==="root"&&l.first===r||l&&l.type==="document"))return"";if(!l)return H3e[i];var c=r.root();if(c.rawCache||(c.rawCache={}),typeof c.rawCache[i]<"u")return c.rawCache[i];if(i==="before"||i==="after")return this.beforeAfter(r,i);var d="raw"+kqt(i);return this[d]?o=this[d](c,r):c.walk(function(u){if(o=u.raws[s],typeof o<"u")return!1}),typeof o>"u"&&(o=H3e[i]),c.rawCache[i]=o,o},e.rawBeforeClose=function(r){var s;return r.walk(function(i){if(i.nodes&&i.nodes.length>0&&typeof i.raws.after<"u")return s=i.raws.after,s.includes(`
`)&&(s=s.replace(/[^\n]+$/,"")),!1}),s&&(s=s.replace(/\S/g,"")),s},e.rawBeforeComment=function(r,s){var i;return r.walkComments(function(o){if(typeof o.raws.before<"u")return i=o.raws.before,i.includes(`
`)&&(i=i.replace(/[^\n]+$/,"")),!1}),typeof i>"u"?i=this.raw(s,null,"beforeDecl"):i&&(i=i.replace(/\S/g,"")),i},e.rawBeforeDecl=function(r,s){var i;return r.walkDecls(function(o){if(typeof o.raws.before<"u")return i=o.raws.before,i.includes(`
`)&&(i=i.replace(/[^\n]+$/,"")),!1}),typeof i>"u"?i=this.raw(s,null,"beforeRule"):i&&(i=i.replace(/\S/g,"")),i},e.rawBeforeOpen=function(r){var s;return r.walk(function(i){if(i.type!=="decl"&&(s=i.raws.between,typeof s<"u"))return!1}),s},e.rawBeforeRule=function(r){var s;return r.walk(function(i){if(i.nodes&&(i.parent!==r||r.first!==i)&&typeof i.raws.before<"u")return s=i.raws.before,s.includes(`
`)&&(s=s.replace(/[^\n]+$/,"")),!1}),s&&(s=s.replace(/\S/g,"")),s},e.rawColon=function(r){var s;return r.walkDecls(function(i){if(typeof i.raws.between<"u")return s=i.raws.between.replace(/[^\s:]/g,""),!1}),s},e.rawEmptyBody=function(r){var s;return r.walk(function(i){if(i.nodes&&i.nodes.length===0&&(s=i.raws.after,typeof s<"u"))return!1}),s},e.rawIndent=function(r){if(r.raws.indent)return r.raws.indent;var s;return r.walk(function(i){var o=i.parent;if(o&&o!==r&&o.parent&&o.parent===r&&typeof i.raws.before<"u"){var l=i.raws.before.split(`
`);return s=l[l.length-1],s=s.replace(/\S/g,""),!1}}),s},e.rawSemicolon=function(r){var s;return r.walk(function(i){if(i.nodes&&i.nodes.length&&i.last.type==="decl"&&(s=i.raws.semicolon,typeof s<"u"))return!1}),s},e.rawValue=function(r,s){var i=r[s],o=r.raws[s];return o&&o.value===i?o.raw:i},e.root=function(r){this.body(r),r.raws.after&&this.builder(r.raws.after)},e.rule=function(r){this.block(r,this.rawValue(r,"selector")),r.raws.ownSemicolon&&this.builder(r.raws.ownSemicolon,r,"end")},e.stringify=function(r,s){if(!this[r.type])throw new Error("Unknown AST node type "+r.type+". Maybe you need to change PostCSS stringifier.");this[r.type](r,s)},t}(),Nat=Qfe;Qfe.default=Qfe;var Sqt=Nat;function Zfe(t,e){var n=new Sqt(e);n.stringify(t)}var Tee=Zfe;Zfe.default=Zfe;var mU=oS.isClean,Cqt=oS.my,jqt=gCe,Eqt=Nat,Nqt=Tee;function Jfe(t,e){var n=new t.constructor;for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&r!=="proxyCache"){var s=t[r],i=typeof s>"u"?"undefined":Ir(s);r==="parent"&&i==="object"?e&&(n[r]=e):r==="source"?n[r]=s:Array.isArray(s)?n[r]=s.map(function(o){return Jfe(o,n)}):(i==="object"&&s!==null&&(s=Jfe(s)),n[r]=s)}return n}var Xfe=function(){function t(n){n===void 0&&(n={}),this.raws={},this[mU]=!1,this[Cqt]=!0;for(var r in n)if(r==="nodes"){this.nodes=[];for(var s=on(n[r]),i;!(i=s()).done;){var o=i.value;typeof o.clone=="function"?this.append(o.clone()):this.append(o)}}else this[r]=n[r]}var e=t.prototype;return e.addToError=function(r){if(r.postcssNode=this,r.stack&&this.source&&/\n\s{4}at /.test(r.stack)){var s=this.source;r.stack=r.stack.replace(/\n\s{4}at /,"$&"+s.input.from+":"+s.start.line+":"+s.start.column+"$&")}return r},e.after=function(r){return this.parent.insertAfter(this,r),this},e.assign=function(r){r===void 0&&(r={});for(var s in r)this[s]=r[s];return this},e.before=function(r){return this.parent.insertBefore(this,r),this},e.cleanRaws=function(r){delete this.raws.before,delete this.raws.after,r||delete this.raws.between},e.clone=function(r){r===void 0&&(r={});var s=Jfe(this);for(var i in r)s[i]=r[i];return s},e.cloneAfter=function(r){r===void 0&&(r={});var s=this.clone(r);return this.parent.insertAfter(this,s),s},e.cloneBefore=function(r){r===void 0&&(r={});var s=this.clone(r);return this.parent.insertBefore(this,s),s},e.error=function(r,s){if(s===void 0&&(s={}),this.source){var i=this.rangeBy(s),o=i.end,l=i.start;return this.source.input.error(r,{column:l.column,line:l.line},{column:o.column,line:o.line},s)}return new jqt(r)},e.getProxyProcessor=function(){return{get:function(s,i){return i==="proxyOf"?s:i==="root"?function(){return s.root().toProxy()}:s[i]},set:function(s,i,o){return s[i]===o||(s[i]=o,(i==="prop"||i==="value"||i==="name"||i==="params"||i==="important"||i==="text")&&s.markDirty()),!0}}},e.markDirty=function(){if(this[mU]){this[mU]=!1;for(var r=this;r=r.parent;)r[mU]=!1}},e.next=function(){if(this.parent){var r=this.parent.index(this);return this.parent.nodes[r+1]}},e.positionBy=function(r,s){var i=this.source.start;if(r.index)i=this.positionInside(r.index,s);else if(r.word){s=this.toString();var o=s.indexOf(r.word);o!==-1&&(i=this.positionInside(o,s))}return i},e.positionInside=function(r,s){for(var i=s||this.toString(),o=this.source.start.column,l=this.source.start.line,c=0;c<r;c++)i[c]===`
`?(o=1,l+=1):o+=1;return{column:o,line:l}},e.prev=function(){if(this.parent){var r=this.parent.index(this);return this.parent.nodes[r-1]}},e.rangeBy=function(r){var s={column:this.source.start.column,line:this.source.start.line},i=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:s.column+1,line:s.line};if(r.word){var o=this.toString(),l=o.indexOf(r.word);l!==-1&&(s=this.positionInside(l,o),i=this.positionInside(l+r.word.length,o))}else r.start?s={column:r.start.column,line:r.start.line}:r.index&&(s=this.positionInside(r.index)),r.end?i={column:r.end.column,line:r.end.line}:typeof r.endIndex=="number"?i=this.positionInside(r.endIndex):r.index&&(i=this.positionInside(r.index+1));return(i.line<s.line||i.line===s.line&&i.column<=s.column)&&(i={column:s.column+1,line:s.line}),{end:i,start:s}},e.raw=function(r,s){var i=new Eqt;return i.raw(this,r,s)},e.remove=function(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this},e.replaceWith=function(){for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];if(this.parent){for(var o=this,l=!1,c=on(s),d;!(d=c()).done;){var u=d.value;u===this?l=!0:l?(this.parent.insertAfter(o,u),o=u):this.parent.insertBefore(o,u)}l||this.remove()}return this},e.root=function(){for(var r=this;r.parent&&r.parent.type!=="document";)r=r.parent;return r},e.toJSON=function(r,s){var i={},o=s==null;s=s||new Map;var l=0;for(var c in this)if(Object.prototype.hasOwnProperty.call(this,c)&&!(c==="parent"||c==="proxyCache")){var d=this[c];if(Array.isArray(d))i[c]=d.map(function(h){return(typeof h>"u"?"undefined":Ir(h))==="object"&&h.toJSON?h.toJSON(null,s):h});else if((typeof d>"u"?"undefined":Ir(d))==="object"&&d.toJSON)i[c]=d.toJSON(null,s);else if(c==="source"){var u=s.get(d.input);u==null&&(u=l,s.set(d.input,l),l++),i[c]={end:d.end,inputId:u,start:d.start}}else i[c]=d}return o&&(i.inputs=[].concat(s.keys()).map(function(h){return h.toJSON()})),i},e.toProxy=function(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache},e.toString=function(r){r===void 0&&(r=Nqt),r.stringify&&(r=r.stringify);var s="";return r(this,function(i){s+=i}),s},e.warn=function(r,s,i){var o={node:this};for(var l in i)o[l]=i[l];return r.warn(s,o)},uo(t,[{key:"proxyOf",get:function(){return this}}]),t}(),_ee=Xfe;Xfe.default=Xfe;var Tqt=_ee,epe=function(t){Co(e,t);function e(n){var r;return n&&typeof n.value<"u"&&typeof n.value!="string"&&(n=Ps({},n,{value:String(n.value)})),r=t.call(this,n)||this,r.type="decl",r}return uo(e,[{key:"variable",get:function(){return this.prop.startsWith("--")||this.prop[0]==="$"}}]),e}(Tqt),Aee=epe;epe.default=epe;var _qt="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",Aqt=function(t){t===void 0&&(t=21);for(var e="",n=t;n--;)e+=_qt[Math.random()*64|0];return e},Pqt={nanoid:Aqt},G3e=Il.SourceMapConsumer,W3e=Il.SourceMapGenerator,Rqt=Il.existsSync,Iqt=Il.readFileSync,boe=Il.dirname,Mqt=Il.join;function Lqt(t){return Buffer?Buffer.from(t,"base64").toString():window.atob(t)}var tpe=function(){function t(n,r){if(r.map!==!1){this.loadAnnotation(n),this.inline=this.startWith(this.annotation,"data:");var s=r.map?r.map.prev:void 0,i=this.loadMap(r.from,s);!this.mapFile&&r.from&&(this.mapFile=r.from),this.mapFile&&(this.root=boe(this.mapFile)),i&&(this.text=i)}}var e=t.prototype;return e.consumer=function(){return this.consumerCache||(this.consumerCache=new G3e(this.text)),this.consumerCache},e.decodeInline=function(r){var s=/^data:application\/json;charset=utf-?8;base64,/,i=/^data:application\/json;base64,/,o=/^data:application\/json;charset=utf-?8,/,l=/^data:application\/json,/;if(o.test(r)||l.test(r))return decodeURIComponent(r.substr(RegExp.lastMatch.length));if(s.test(r)||i.test(r))return Lqt(r.substr(RegExp.lastMatch.length));var c=r.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+c)},e.getAnnotationURL=function(r){return r.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()},e.isMap=function(r){return(typeof r>"u"?"undefined":Ir(r))!=="object"?!1:typeof r.mappings=="string"||typeof r._mappings=="string"||Array.isArray(r.sections)},e.loadAnnotation=function(r){var s=r.match(/\/\*\s*# sourceMappingURL=/gm);if(s){var i=r.lastIndexOf(s.pop()),o=r.indexOf("*/",i);i>-1&&o>-1&&(this.annotation=this.getAnnotationURL(r.substring(i,o)))}},e.loadFile=function(r){if(this.root=boe(r),Rqt(r))return this.mapFile=r,Iqt(r,"utf-8").toString().trim()},e.loadMap=function(r,s){if(s===!1)return!1;if(s){if(typeof s=="string")return s;if(typeof s=="function"){var i=s(r);if(i){var o=this.loadFile(i);if(!o)throw new Error("Unable to load previous source map: "+i.toString());return o}}else{if(Pr(s,G3e))return W3e.fromSourceMap(s).toString();if(Pr(s,W3e))return s.toString();if(this.isMap(s))return JSON.stringify(s);throw new Error("Unsupported previous source map format: "+s.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){var l=this.annotation;return r&&(l=Mqt(boe(r),l)),this.loadFile(l)}}},e.startWith=function(r,s){return r?r.substr(0,s.length)===s:!1},e.withContent=function(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)},t}(),Tat=tpe;tpe.default=tpe;var Dqt=Il.SourceMapConsumer,$qt=Il.SourceMapGenerator,q3e=Il.fileURLToPath,fU=Il.pathToFileURL,npe=Il.isAbsolute,rpe=Il.resolve,Oqt=Pqt.nanoid,xoe=Il,K3e=gCe,Fqt=Tat,woe=Symbol("fromOffsetCache"),Bqt=!!(Dqt&&$qt),Y3e=!!(rpe&&npe),$K=function(){function t(n,r){if(r===void 0&&(r={}),n===null||typeof n>"u"||(typeof n>"u"?"undefined":Ir(n))==="object"&&!n.toString)throw new Error("PostCSS received "+n+" instead of CSS string");if(this.css=n.toString(),this.css[0]==="\uFEFF"||this.css[0]==="￾"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,r.from&&(!Y3e||/^\w+:\/\//.test(r.from)||npe(r.from)?this.file=r.from:this.file=rpe(r.from)),Y3e&&Bqt){var s=new Fqt(this.css,r);if(s.text){this.map=s;var i=s.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+Oqt(6)+">"),this.map&&(this.map.file=this.from)}var e=t.prototype;return e.error=function(r,s,i,o){o===void 0&&(o={});var l,c,d;if(s&&(typeof s>"u"?"undefined":Ir(s))==="object"){var u=s,h=i;if(typeof u.offset=="number"){var m=this.fromOffset(u.offset);s=m.line,i=m.col}else s=u.line,i=u.column;if(typeof h.offset=="number"){var f=this.fromOffset(h.offset);c=f.line,d=f.col}else c=h.line,d=h.column}else if(!i){var p=this.fromOffset(s);s=p.line,i=p.col}var g=this.origin(s,i,c,d);return g?l=new K3e(r,g.endLine===void 0?g.line:{column:g.column,line:g.line},g.endLine===void 0?g.column:{column:g.endColumn,line:g.endLine},g.source,g.file,o.plugin):l=new K3e(r,c===void 0?s:{column:i,line:s},c===void 0?i:{column:d,line:c},this.css,this.file,o.plugin),l.input={column:i,endColumn:d,endLine:c,line:s,source:this.css},this.file&&(fU&&(l.input.url=fU(this.file).toString()),l.input.file=this.file),l},e.fromOffset=function(r){var s,i;if(this[woe])i=this[woe];else{var o=this.css.split(`
`);i=new Array(o.length);for(var l=0,c=0,d=o.length;c<d;c++)i[c]=l,l+=o[c].length+1;this[woe]=i}s=i[i.length-1];var u=0;if(r>=s)u=i.length-1;else for(var h=i.length-2,m;u<h;)if(m=u+(h-u>>1),r<i[m])h=m-1;else if(r>=i[m+1])u=m+1;else{u=m;break}return{col:r-i[u]+1,line:u+1}},e.mapResolve=function(r){return/^\w+:\/\//.test(r)?r:rpe(this.map.consumer().sourceRoot||this.map.root||".",r)},e.origin=function(r,s,i,o){if(!this.map)return!1;var l=this.map.consumer(),c=l.originalPositionFor({column:s,line:r});if(!c.source)return!1;var d;typeof i=="number"&&(d=l.originalPositionFor({column:o,line:i}));var u;npe(c.source)?u=fU(c.source):u=new URL(c.source,this.map.consumer().sourceRoot||fU(this.map.mapFile));var h={column:c.column,endColumn:d&&d.column,endLine:d&&d.line,line:c.line,url:u.toString()};if(u.protocol==="file:")if(q3e)h.file=q3e(u);else throw new Error("file: protocol is not available in this PostCSS build");var m=l.sourceContentFor(c.source);return m&&(h.source=m),h},e.toJSON=function(){for(var r={},s=0,i=["hasBOM","css","file","id"];s<i.length;s++){var o=i[s];this[o]!=null&&(r[o]=this[o])}return this.map&&(r.map=Ps({},this.map),r.map.consumerCache&&(r.map.consumerCache=void 0)),r},uo(t,[{key:"from",get:function(){return this.file||this.id}}]),t}(),Pee=$K;$K.default=$K;xoe&&xoe.registerInput&&xoe.registerInput($K);var _at=Il.SourceMapConsumer,gG=Il.SourceMapGenerator,vG=Il.dirname,Aat=Il.relative,Pat=Il.resolve,Rat=Il.sep,Q3e=Il.pathToFileURL,Uqt=Pee,zqt=!!(_at&&gG),Vqt=!!(vG&&Pat&&Aat&&Rat),Hqt=function(){function t(n,r,s,i){this.stringify=n,this.mapOpts=s.map||{},this.root=r,this.opts=s,this.css=i,this.originalCSS=i,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}var e=t.prototype;return e.addAnnotation=function(){var r;this.isInline()?r="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?r=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?r=this.mapOpts.annotation(this.opts.to,this.root):r=this.outputFile()+".map";var s=`
`;this.css.includes(`\r
`)&&(s=`\r
`),this.css+=s+"/*# sourceMappingURL="+r+" */"},e.applyPrevMaps=function(){for(var r=on(this.previous()),s;!(s=r()).done;){var i=s.value,o=this.toUrl(this.path(i.file)),l=i.root||vG(i.file),c=void 0;this.mapOpts.sourcesContent===!1?(c=new _at(i.text),c.sourcesContent&&(c.sourcesContent=null)):c=i.consumer(),this.map.applySourceMap(c,o,this.toUrl(this.path(l)))}},e.clearAnnotation=function(){if(this.mapOpts.annotation!==!1)if(this.root)for(var r,s=this.root.nodes.length-1;s>=0;s--)r=this.root.nodes[s],r.type==="comment"&&r.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(s);else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))},e.generate=function(){if(this.clearAnnotation(),Vqt&&zqt&&this.isMap())return this.generateMap();var r="";return this.stringify(this.root,function(s){r+=s}),[r]},e.generateMap=function(){if(this.root)this.generateString();else if(this.previous().length===1){var r=this.previous()[0].consumer();r.file=this.outputFile(),this.map=gG.fromSourceMap(r,{ignoreInvalidMapping:!0})}else this.map=new gG({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]},e.generateString=function(){var r=this;this.css="",this.map=new gG({file:this.outputFile(),ignoreInvalidMapping:!0});var s=1,i=1,o="<no source>",l={generated:{column:0,line:0},original:{column:0,line:0},source:""},c,d;this.stringify(this.root,function(u,h,m){if(r.css+=u,h&&m!=="end"&&(l.generated.line=s,l.generated.column=i-1,h.source&&h.source.start?(l.source=r.sourcePath(h),l.original.line=h.source.start.line,l.original.column=h.source.start.column-1,r.map.addMapping(l)):(l.source=o,l.original.line=1,l.original.column=0,r.map.addMapping(l))),c=u.match(/\n/g),c?(s+=c.length,d=u.lastIndexOf(`
`),i=u.length-d):i+=u.length,h&&m!=="start"){var f=h.parent||{raws:{}},p=h.type==="decl"||h.type==="atrule"&&!h.nodes;(!p||h!==f.last||f.raws.semicolon)&&(h.source&&h.source.end?(l.source=r.sourcePath(h),l.original.line=h.source.end.line,l.original.column=h.source.end.column-1,l.generated.line=s,l.generated.column=i-2,r.map.addMapping(l)):(l.source=o,l.original.line=1,l.original.column=0,l.generated.line=s,l.generated.column=i-1,r.map.addMapping(l)))}})},e.isAnnotation=function(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(function(r){return r.annotation}):!0},e.isInline=function(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;var r=this.mapOpts.annotation;return typeof r<"u"&&r!==!0?!1:this.previous().length?this.previous().some(function(s){return s.inline}):!0},e.isMap=function(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0},e.isSourcesContent=function(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(function(r){return r.withContent()}):!0},e.outputFile=function(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"},e.path=function(r){if(this.mapOpts.absolute||r.charCodeAt(0)===60||/^\w+:\/\//.test(r))return r;var s=this.memoizedPaths.get(r);if(s)return s;var i=this.opts.to?vG(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(i=vG(Pat(i,this.mapOpts.annotation)));var o=Aat(i,r);return this.memoizedPaths.set(r,o),o},e.previous=function(){var r=this;if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(function(i){if(i.source&&i.source.input.map){var o=i.source.input.map;r.previousMaps.includes(o)||r.previousMaps.push(o)}});else{var s=new Uqt(this.originalCSS,this.opts);s.map&&this.previousMaps.push(s.map)}return this.previousMaps},e.setSourcesContent=function(){var r=this,s={};if(this.root)this.root.walk(function(o){if(o.source){var l=o.source.input.from;if(l&&!s[l]){s[l]=!0;var c=r.usesFileUrls?r.toFileUrl(l):r.toUrl(r.path(l));r.map.setSourceContent(c,o.source.input.css)}}});else if(this.css){var i=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(i,this.css)}},e.sourcePath=function(r){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(r.source.input.from):this.toUrl(this.path(r.source.input.from))},e.toBase64=function(r){return Buffer?Buffer.from(r).toString("base64"):window.btoa(unescape(encodeURIComponent(r)))},e.toFileUrl=function(r){var s=this.memoizedFileURLs.get(r);if(s)return s;if(Q3e){var i=Q3e(r).toString();return this.memoizedFileURLs.set(r,i),i}else throw new Error("`map.absolute` option is not available in this PostCSS build")},e.toUrl=function(r){var s=this.memoizedURLs.get(r);if(s)return s;Rat==="\\"&&(r=r.replace(/\\/g,"/"));var i=encodeURI(r).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(r,i),i},t}(),Iat=Hqt,Gqt=_ee,spe=function(t){Co(e,t);function e(n){var r;return r=t.call(this,n)||this,r.type="comment",r}return e}(Gqt),Ree=spe;spe.default=spe;var Mat=oS.isClean,Lat=oS.my,Dat=Aee,$at=Ree,Wqt=_ee,Oat,vCe,yCe,Fat;function Bat(t){return t.map(function(e){return e.nodes&&(e.nodes=Bat(e.nodes)),delete e.source,e})}function Uat(t){if(t[Mat]=!1,t.proxyOf.nodes)for(var e=on(t.proxyOf.nodes),n;!(n=e()).done;){var r=n.value;Uat(r)}}var Kx=function(t){Co(e,t);function e(){return t.apply(this,arguments)||this}var n=e.prototype;return n.append=function(){for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];for(var l=on(i),c;!(c=l()).done;)for(var d=c.value,u=this.normalize(d,this.last),h=on(u),m;!(m=h()).done;){var f=m.value;this.proxyOf.nodes.push(f)}return this.markDirty(),this},n.cleanRaws=function(s){if(t.prototype.cleanRaws.call(this,s),this.nodes)for(var i=on(this.nodes),o;!(o=i()).done;){var l=o.value;l.cleanRaws(s)}},n.each=function(s){if(this.proxyOf.nodes){for(var i=this.getIterator(),o,l;this.indexes[i]<this.proxyOf.nodes.length&&(o=this.indexes[i],l=s(this.proxyOf.nodes[o],o),l!==!1);)this.indexes[i]+=1;return delete this.indexes[i],l}},n.every=function(s){return this.nodes.every(s)},n.getIterator=function(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;var s=this.lastEach;return this.indexes[s]=0,s},n.getProxyProcessor=function(){return{get:function(i,o){return o==="proxyOf"?i:i[o]?o==="each"||typeof o=="string"&&o.startsWith("walk")?function(){for(var l=arguments.length,c=new Array(l),d=0;d<l;d++)c[d]=arguments[d];var u;return(u=i)[o].apply(u,[].concat(c.map(function(h){return typeof h=="function"?function(m,f){return h(m.toProxy(),f)}:h})))}:o==="every"||o==="some"?function(l){return i[o](function(c){for(var d=arguments.length,u=new Array(d>1?d-1:0),h=1;h<d;h++)u[h-1]=arguments[h];return l.apply(void 0,[].concat([c.toProxy()],u))})}:o==="root"?function(){return i.root().toProxy()}:o==="nodes"?i.nodes.map(function(l){return l.toProxy()}):o==="first"||o==="last"?i[o].toProxy():i[o]:i[o]},set:function(i,o,l){return i[o]===l||(i[o]=l,(o==="name"||o==="params"||o==="selector")&&i.markDirty()),!0}}},n.index=function(s){return typeof s=="number"?s:(s.proxyOf&&(s=s.proxyOf),this.proxyOf.nodes.indexOf(s))},n.insertAfter=function(s,i){var o=this.index(s),l=this.normalize(i,this.proxyOf.nodes[o]).reverse();o=this.index(s);for(var c=on(l),d;!(d=c()).done;){var u=d.value;this.proxyOf.nodes.splice(o+1,0,u)}var h;for(var m in this.indexes)h=this.indexes[m],o<h&&(this.indexes[m]=h+l.length);return this.markDirty(),this},n.insertBefore=function(s,i){var o=this.index(s),l=o===0?"prepend":!1,c=this.normalize(i,this.proxyOf.nodes[o],l).reverse();o=this.index(s);for(var d=on(c),u;!(u=d()).done;){var h=u.value;this.proxyOf.nodes.splice(o,0,h)}var m;for(var f in this.indexes)m=this.indexes[f],o<=m&&(this.indexes[f]=m+c.length);return this.markDirty(),this},n.normalize=function(s,i){var o=this;if(typeof s=="string")s=Bat(Oat(s).nodes);else if(typeof s>"u")s=[];else if(Array.isArray(s)){s=s.slice(0);for(var l=on(s),c;!(c=l()).done;){var d=c.value;d.parent&&d.parent.removeChild(d,"ignore")}}else if(s.type==="root"&&this.type!=="document"){s=s.nodes.slice(0);for(var u=on(s),h;!(h=u()).done;){var m=h.value;m.parent&&m.parent.removeChild(m,"ignore")}}else if(s.type)s=[s];else if(s.prop){if(typeof s.value>"u")throw new Error("Value field is missed in node creation");typeof s.value!="string"&&(s.value=String(s.value)),s=[new Dat(s)]}else if(s.selector)s=[new vCe(s)];else if(s.name)s=[new yCe(s)];else if(s.text)s=[new $at(s)];else throw new Error("Unknown node type in node creation");var f=s.map(function(p){return p[Lat]||e.rebuild(p),p=p.proxyOf,p.parent&&p.parent.removeChild(p),p[Mat]&&Uat(p),typeof p.raws.before>"u"&&i&&typeof i.raws.before<"u"&&(p.raws.before=i.raws.before.replace(/\S/g,"")),p.parent=o.proxyOf,p});return f},n.prepend=function(){for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];i=i.reverse();for(var l=on(i),c;!(c=l()).done;){for(var d=c.value,u=this.normalize(d,this.first,"prepend").reverse(),h=on(u),m;!(m=h()).done;){var f=m.value;this.proxyOf.nodes.unshift(f)}for(var p in this.indexes)this.indexes[p]=this.indexes[p]+u.length}return this.markDirty(),this},n.push=function(s){return s.parent=this,this.proxyOf.nodes.push(s),this},n.removeAll=function(){for(var s=on(this.proxyOf.nodes),i;!(i=s()).done;){var o=i.value;o.parent=void 0}return this.proxyOf.nodes=[],this.markDirty(),this},n.removeChild=function(s){s=this.index(s),this.proxyOf.nodes[s].parent=void 0,this.proxyOf.nodes.splice(s,1);var i;for(var o in this.indexes)i=this.indexes[o],i>=s&&(this.indexes[o]=i-1);return this.markDirty(),this},n.replaceValues=function(s,i,o){return o||(o=i,i={}),this.walkDecls(function(l){i.props&&!i.props.includes(l.prop)||i.fast&&!l.value.includes(i.fast)||(l.value=l.value.replace(s,o))}),this.markDirty(),this},n.some=function(s){return this.nodes.some(s)},n.walk=function(s){return this.each(function(i,o){var l;try{l=s(i,o)}catch(c){throw i.addToError(c)}return l!==!1&&i.walk&&(l=i.walk(s)),l})},n.walkAtRules=function(s,i){return i?Pr(s,RegExp)?this.walk(function(o,l){if(o.type==="atrule"&&s.test(o.name))return i(o,l)}):this.walk(function(o,l){if(o.type==="atrule"&&o.name===s)return i(o,l)}):(i=s,this.walk(function(o,l){if(o.type==="atrule")return i(o,l)}))},n.walkComments=function(s){return this.walk(function(i,o){if(i.type==="comment")return s(i,o)})},n.walkDecls=function(s,i){return i?Pr(s,RegExp)?this.walk(function(o,l){if(o.type==="decl"&&s.test(o.prop))return i(o,l)}):this.walk(function(o,l){if(o.type==="decl"&&o.prop===s)return i(o,l)}):(i=s,this.walk(function(o,l){if(o.type==="decl")return i(o,l)}))},n.walkRules=function(s,i){return i?Pr(s,RegExp)?this.walk(function(o,l){if(o.type==="rule"&&s.test(o.selector))return i(o,l)}):this.walk(function(o,l){if(o.type==="rule"&&o.selector===s)return i(o,l)}):(i=s,this.walk(function(o,l){if(o.type==="rule")return i(o,l)}))},uo(e,[{key:"first",get:function(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}},{key:"last",get:function(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}}]),e}(Wqt);Kx.registerParse=function(t){Oat=t};Kx.registerRule=function(t){vCe=t};Kx.registerAtRule=function(t){yCe=t};Kx.registerRoot=function(t){Fat=t};var NE=Kx;Kx.default=Kx;Kx.rebuild=function(t){t.type==="atrule"?Object.setPrototypeOf(t,yCe.prototype):t.type==="rule"?Object.setPrototypeOf(t,vCe.prototype):t.type==="decl"?Object.setPrototypeOf(t,Dat.prototype):t.type==="comment"?Object.setPrototypeOf(t,$at.prototype):t.type==="root"&&Object.setPrototypeOf(t,Fat.prototype),t[Lat]=!0,t.nodes&&t.nodes.forEach(function(e){Kx.rebuild(e)})};var qqt=NE,zat,Vat,TO=function(t){Co(e,t);function e(r){var s;return s=t.call(this,Ps({type:"document"},r))||this,s.nodes||(s.nodes=[]),s}var n=e.prototype;return n.toResult=function(s){s===void 0&&(s={});var i=new zat(new Vat,this,s);return i.stringify()},e}(qqt);TO.registerLazyResult=function(t){zat=t};TO.registerProcessor=function(t){Vat=t};var bCe=TO;TO.default=TO;var ipe=function(){function t(n,r){if(r===void 0&&(r={}),this.type="warning",this.text=n,r.node&&r.node.source){var s=r.node.rangeBy(r);this.line=s.start.line,this.column=s.start.column,this.endLine=s.end.line,this.endColumn=s.end.column}for(var i in r)this[i]=r[i]}var e=t.prototype;return e.toString=function(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text},t}(),Hat=ipe;ipe.default=ipe;var Kqt=Hat,ape=function(){function t(n,r,s){this.processor=n,this.messages=[],this.root=r,this.opts=s,this.css=void 0,this.map=void 0}var e=t.prototype;return e.toString=function(){return this.css},e.warn=function(r,s){s===void 0&&(s={}),s.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(s.plugin=this.lastPlugin.postcssPlugin);var i=new Kqt(r,s);return this.messages.push(i),i},e.warnings=function(){return this.messages.filter(function(r){return r.type==="warning"})},uo(t,[{key:"content",get:function(){return this.css}}]),t}(),xCe=ape;ape.default=ape;var koe=39,Z3e=34,pU=92,J3e=47,gU=10,kL=32,vU=12,yU=9,bU=13,Yqt=91,Qqt=93,Zqt=40,Jqt=41,Xqt=123,eKt=125,tKt=59,nKt=42,rKt=58,sKt=64,xU=/[\t\n\f\r "#'()/;[\\\]{}]/g,wU=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,iKt=/.[\r\n"'(/\\]/,X3e=/[\da-f]/i,aKt=function(e,n){n===void 0&&(n={});var r=e.css.valueOf(),s=n.ignoreErrors,i,o,l,c,d,u,h,m,f,p,g=r.length,v=0,b=[],x=[];function w(){return v}function k(E){throw e.error("Unclosed "+E,v)}function S(){return x.length===0&&v>=g}function C(E){if(x.length)return x.pop();if(!(v>=g)){var N=E?E.ignoreUnclosed:!1;switch(i=r.charCodeAt(v),i){case gU:case kL:case yU:case bU:case vU:{o=v;do o+=1,i=r.charCodeAt(o);while(i===kL||i===gU||i===yU||i===bU||i===vU);p=["space",r.slice(v,o)],v=o-1;break}case Yqt:case Qqt:case Xqt:case eKt:case rKt:case tKt:case Jqt:{var A=String.fromCharCode(i);p=[A,A,v];break}case Zqt:{if(m=b.length?b.pop()[1]:"",f=r.charCodeAt(v+1),m==="url"&&f!==koe&&f!==Z3e&&f!==kL&&f!==gU&&f!==yU&&f!==vU&&f!==bU){o=v;do{if(u=!1,o=r.indexOf(")",o+1),o===-1)if(s||N){o=v;break}else k("bracket");for(h=o;r.charCodeAt(h-1)===pU;)h-=1,u=!u}while(u);p=["brackets",r.slice(v,o+1),v,o],v=o}else o=r.indexOf(")",v+1),c=r.slice(v,o+1),o===-1||iKt.test(c)?p=["(","(",v]:(p=["brackets",c,v,o],v=o);break}case koe:case Z3e:{l=i===koe?"'":'"',o=v;do{if(u=!1,o=r.indexOf(l,o+1),o===-1)if(s||N){o=v+1;break}else k("string");for(h=o;r.charCodeAt(h-1)===pU;)h-=1,u=!u}while(u);p=["string",r.slice(v,o+1),v,o],v=o;break}case sKt:{xU.lastIndex=v+1,xU.test(r),xU.lastIndex===0?o=r.length-1:o=xU.lastIndex-2,p=["at-word",r.slice(v,o+1),v,o],v=o;break}case pU:{for(o=v,d=!0;r.charCodeAt(o+1)===pU;)o+=1,d=!d;if(i=r.charCodeAt(o+1),d&&i!==J3e&&i!==kL&&i!==gU&&i!==yU&&i!==bU&&i!==vU&&(o+=1,X3e.test(r.charAt(o)))){for(;X3e.test(r.charAt(o+1));)o+=1;r.charCodeAt(o+1)===kL&&(o+=1)}p=["word",r.slice(v,o+1),v,o],v=o;break}default:{i===J3e&&r.charCodeAt(v+1)===nKt?(o=r.indexOf("*/",v+2)+1,o===0&&(s||N?o=r.length:k("comment")),p=["comment",r.slice(v,o+1),v,o],v=o):(wU.lastIndex=v+1,wU.test(r),wU.lastIndex===0?o=r.length-1:o=wU.lastIndex-2,p=["word",r.slice(v,o+1),v,o],b.push(p),v=o);break}}return v++,p}}function j(E){x.push(E)}return{back:j,endOfFile:S,nextToken:C,position:w}},Gat=NE,OK=function(t){Co(e,t);function e(r){var s;return s=t.call(this,r)||this,s.type="atrule",s}var n=e.prototype;return n.append=function(){for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];var l;return this.proxyOf.nodes||(this.nodes=[]),(l=t.prototype.append).call.apply(l,[].concat([this],i))},n.prepend=function(){for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];var l;return this.proxyOf.nodes||(this.nodes=[]),(l=t.prototype.prepend).call.apply(l,[].concat([this],i))},e}(Gat),wCe=OK;OK.default=OK;Gat.registerAtRule(OK);var Wat=NE,qat,Kat,KP=function(t){Co(e,t);function e(r){var s;return s=t.call(this,r)||this,s.type="root",s.nodes||(s.nodes=[]),s}var n=e.prototype;return n.normalize=function(s,i,o){var l=t.prototype.normalize.call(this,s);if(i){if(o==="prepend")this.nodes.length>1?i.raws.before=this.nodes[1].raws.before:delete i.raws.before;else if(this.first!==i)for(var c=on(l),d;!(d=c()).done;){var u=d.value;u.raws.before=i.raws.before}}return l},n.removeChild=function(s,i){var o=this.index(s);return!i&&o===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[o].raws.before),t.prototype.removeChild.call(this,s)},n.toResult=function(s){s===void 0&&(s={});var i=new qat(new Kat,this,s);return i.stringify()},e}(Wat);KP.registerLazyResult=function(t){qat=t};KP.registerProcessor=function(t){Kat=t};var q8=KP;KP.default=KP;Wat.registerRoot(KP);var _O={comma:function(e){return _O.split(e,[","],!0)},space:function(e){var n=[" ",`
`,"	"];return _O.split(e,n)},split:function(e,n,r){for(var s=[],i="",o=!1,l=0,c=!1,d="",u=!1,h=on(e),m;!(m=h()).done;){var f=m.value;u?u=!1:f==="\\"?u=!0:c?f===d&&(c=!1):f==='"'||f==="'"?(c=!0,d=f):f==="("?l+=1:f===")"?l>0&&(l-=1):l===0&&n.includes(f)&&(o=!0),o?(i!==""&&s.push(i.trim()),i="",o=!1):i+=f}return(r||i!=="")&&s.push(i.trim()),s}},Yat=_O;_O.default=_O;var Qat=NE,oKt=Yat,FK=function(t){Co(e,t);function e(n){var r;return r=t.call(this,n)||this,r.type="rule",r.nodes||(r.nodes=[]),r}return uo(e,[{key:"selectors",get:function(){return oKt.comma(this.selector)},set:function(r){var s=this.selector?this.selector.match(/,\s*/):null,i=s?s[0]:","+this.raw("between","beforeOpen");this.selector=r.join(i)}}]),e}(Qat),kCe=FK;FK.default=FK;Qat.registerRule(FK);var lKt=Aee,cKt=aKt,dKt=Ree,uKt=wCe,hKt=q8,e4e=kCe,t4e={empty:!0,space:!0};function mKt(t){for(var e=t.length-1;e>=0;e--){var n=t[e],r=n[3]||n[2];if(r)return r}}var fKt=function(){function t(n){this.input=n,this.root=new hKt,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:n,start:{column:1,line:1,offset:0}}}var e=t.prototype;return e.atrule=function(r){var s=new uKt;s.name=r[1].slice(1),s.name===""&&this.unnamedAtrule(s,r),this.init(s,r[2]);for(var i,o,l,c=!1,d=!1,u=[],h=[];!this.tokenizer.endOfFile();){if(r=this.tokenizer.nextToken(),i=r[0],i==="("||i==="["?h.push(i==="("?")":"]"):i==="{"&&h.length>0?h.push("}"):i===h[h.length-1]&&h.pop(),h.length===0)if(i===";"){s.source.end=this.getPosition(r[2]),s.source.end.offset++,this.semicolon=!0;break}else if(i==="{"){d=!0;break}else if(i==="}"){if(u.length>0){for(l=u.length-1,o=u[l];o&&o[0]==="space";)o=u[--l];o&&(s.source.end=this.getPosition(o[3]||o[2]),s.source.end.offset++)}this.end(r);break}else u.push(r);else u.push(r);if(this.tokenizer.endOfFile()){c=!0;break}}s.raws.between=this.spacesAndCommentsFromEnd(u),u.length?(s.raws.afterName=this.spacesAndCommentsFromStart(u),this.raw(s,"params",u),c&&(r=u[u.length-1],s.source.end=this.getPosition(r[3]||r[2]),s.source.end.offset++,this.spaces=s.raws.between,s.raws.between="")):(s.raws.afterName="",s.params=""),d&&(s.nodes=[],this.current=s)},e.checkMissedSemicolon=function(r){var s=this.colon(r);if(s!==!1){for(var i=0,o,l=s-1;l>=0&&(o=r[l],!(o[0]!=="space"&&(i+=1,i===2)));l--);throw this.input.error("Missed semicolon",o[0]==="word"?o[3]+1:o[2])}},e.colon=function(r){for(var s=0,i,o,l,c=on(r.entries()),d;!(d=c()).done;){var u=d.value,h=u[0],m=u[1];if(i=m,o=i[0],o==="("&&(s+=1),o===")"&&(s-=1),s===0&&o===":")if(!l)this.doubleColon(i);else{if(l[0]==="word"&&l[1]==="progid")continue;return h}l=i}return!1},e.comment=function(r){var s=new dKt;this.init(s,r[2]),s.source.end=this.getPosition(r[3]||r[2]),s.source.end.offset++;var i=r[1].slice(2,-2);if(/^\s*$/.test(i))s.text="",s.raws.left=i,s.raws.right="";else{var o=i.match(/^(\s*)([^]*\S)(\s*)$/);s.text=o[2],s.raws.left=o[1],s.raws.right=o[3]}},e.createTokenizer=function(){this.tokenizer=cKt(this.input)},e.decl=function(r,s){var i=new lKt;this.init(i,r[0][2]);var o=r[r.length-1];for(o[0]===";"&&(this.semicolon=!0,r.pop()),i.source.end=this.getPosition(o[3]||o[2]||mKt(r)),i.source.end.offset++;r[0][0]!=="word";)r.length===1&&this.unknownWord(r),i.raws.before+=r.shift()[1];for(i.source.start=this.getPosition(r[0][2]),i.prop="";r.length;){var l=r[0][0];if(l===":"||l==="space"||l==="comment")break;i.prop+=r.shift()[1]}i.raws.between="";for(var c;r.length;)if(c=r.shift(),c[0]===":"){i.raws.between+=c[1];break}else c[0]==="word"&&/\w/.test(c[1])&&this.unknownWord([c]),i.raws.between+=c[1];(i.prop[0]==="_"||i.prop[0]==="*")&&(i.raws.before+=i.prop[0],i.prop=i.prop.slice(1));for(var d=[],u;r.length&&(u=r[0][0],!(u!=="space"&&u!=="comment"));)d.push(r.shift());this.precheckMissedSemicolon(r);for(var h=r.length-1;h>=0;h--){if(c=r[h],c[1].toLowerCase()==="!important"){i.important=!0;var m=this.stringFrom(r,h);m=this.spacesFromEnd(r)+m,m!==" !important"&&(i.raws.important=m);break}else if(c[1].toLowerCase()==="important"){for(var f=r.slice(0),p="",g=h;g>0;g--){var v=f[g][0];if(p.trim().indexOf("!")===0&&v!=="space")break;p=f.pop()[1]+p}p.trim().indexOf("!")===0&&(i.important=!0,i.raws.important=p,r=f)}if(c[0]!=="space"&&c[0]!=="comment")break}var b=r.some(function(x){return x[0]!=="space"&&x[0]!=="comment"});b&&(i.raws.between+=d.map(function(x){return x[1]}).join(""),d=[]),this.raw(i,"value",d.concat(r),s),i.value.includes(":")&&!s&&this.checkMissedSemicolon(r)},e.doubleColon=function(r){throw this.input.error("Double colon",{offset:r[2]},{offset:r[2]+r[1].length})},e.emptyRule=function(r){var s=new e4e;this.init(s,r[2]),s.selector="",s.raws.between="",this.current=s},e.end=function(r){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(r[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(r)},e.endFile=function(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())},e.freeSemicolon=function(r){if(this.spaces+=r[1],this.current.nodes){var s=this.current.nodes[this.current.nodes.length-1];s&&s.type==="rule"&&!s.raws.ownSemicolon&&(s.raws.ownSemicolon=this.spaces,this.spaces="")}},e.getPosition=function(r){var s=this.input.fromOffset(r);return{column:s.col,line:s.line,offset:r}},e.init=function(r,s){this.current.push(r),r.source={input:this.input,start:this.getPosition(s)},r.raws.before=this.spaces,this.spaces="",r.type!=="comment"&&(this.semicolon=!1)},e.other=function(r){for(var s=!1,i=null,o=!1,l=null,c=[],d=r[1].startsWith("--"),u=[],h=r;h;){if(i=h[0],u.push(h),i==="("||i==="[")l||(l=h),c.push(i==="("?")":"]");else if(d&&o&&i==="{")l||(l=h),c.push("}");else if(c.length===0)if(i===";")if(o){this.decl(u,d);return}else break;else if(i==="{"){this.rule(u);return}else if(i==="}"){this.tokenizer.back(u.pop()),s=!0;break}else i===":"&&(o=!0);else i===c[c.length-1]&&(c.pop(),c.length===0&&(l=null));h=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(s=!0),c.length>0&&this.unclosedBracket(l),s&&o){if(!d)for(;u.length&&(h=u[u.length-1][0],!(h!=="space"&&h!=="comment"));)this.tokenizer.back(u.pop());this.decl(u,d)}else this.unknownWord(u)},e.parse=function(){for(var r;!this.tokenizer.endOfFile();)switch(r=this.tokenizer.nextToken(),r[0]){case"space":this.spaces+=r[1];break;case";":this.freeSemicolon(r);break;case"}":this.end(r);break;case"comment":this.comment(r);break;case"at-word":this.atrule(r);break;case"{":this.emptyRule(r);break;default:this.other(r);break}this.endFile()},e.precheckMissedSemicolon=function(){},e.raw=function(r,s,i,o){for(var l,c,d=i.length,u="",h=!0,m,f,p=0;p<d;p+=1)l=i[p],c=l[0],c==="space"&&p===d-1&&!o?h=!1:c==="comment"?(f=i[p-1]?i[p-1][0]:"empty",m=i[p+1]?i[p+1][0]:"empty",!t4e[f]&&!t4e[m]?u.slice(-1)===","?h=!1:u+=l[1]:h=!1):u+=l[1];if(!h){var g=i.reduce(function(v,b){return v+b[1]},"");r.raws[s]={raw:g,value:u}}r[s]=u},e.rule=function(r){r.pop();var s=new e4e;this.init(s,r[0][2]),s.raws.between=this.spacesAndCommentsFromEnd(r),this.raw(s,"selector",r),this.current=s},e.spacesAndCommentsFromEnd=function(r){for(var s,i="";r.length&&(s=r[r.length-1][0],!(s!=="space"&&s!=="comment"));)i=r.pop()[1]+i;return i},e.spacesAndCommentsFromStart=function(r){for(var s,i="";r.length&&(s=r[0][0],!(s!=="space"&&s!=="comment"));)i+=r.shift()[1];return i},e.spacesFromEnd=function(r){for(var s,i="";r.length&&(s=r[r.length-1][0],s==="space");)i=r.pop()[1]+i;return i},e.stringFrom=function(r,s){for(var i="",o=s;o<r.length;o++)i+=r[o][1];return r.splice(s,r.length-s),i},e.unclosedBlock=function(){var r=this.current.source.start;throw this.input.error("Unclosed block",r.line,r.column)},e.unclosedBracket=function(r){throw this.input.error("Unclosed bracket",{offset:r[2]},{offset:r[2]+1})},e.unexpectedClose=function(r){throw this.input.error("Unexpected }",{offset:r[2]},{offset:r[2]+1})},e.unknownWord=function(r){throw this.input.error("Unknown word",{offset:r[0][2]},{offset:r[0][2]+r[0][1].length})},e.unnamedAtrule=function(r,s){throw this.input.error("At-rule without name",{offset:s[2]},{offset:s[2]+s[1].length})},t}(),pKt=fKt,gKt=NE,vKt=pKt,yKt=Pee;function BK(t,e){var n=new yKt(t,e),r=new vKt(n);try{r.parse()}catch(s){throw s}return r.root}var SCe=BK;BK.default=BK;gKt.registerParse(BK);var yv=oS.isClean,bKt=oS.my,xKt=Iat,wKt=Tee,kKt=NE,SKt=bCe,n4e=xCe,CKt=SCe,jKt=q8,EKt={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},NKt={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},TKt={Once:!0,postcssPlugin:!0,prepare:!0},YP=0;function SL(t){return(typeof t>"u"?"undefined":Ir(t))==="object"&&typeof t.then=="function"}function Zat(t){var e=!1,n=EKt[t.type];return t.type==="decl"?e=t.prop.toLowerCase():t.type==="atrule"&&(e=t.name.toLowerCase()),e&&t.append?[n,n+"-"+e,YP,n+"Exit",n+"Exit-"+e]:e?[n,n+"-"+e,n+"Exit",n+"Exit-"+e]:t.append?[n,YP,n+"Exit"]:[n,n+"Exit"]}function r4e(t){var e;return t.type==="document"?e=["Document",YP,"DocumentExit"]:t.type==="root"?e=["Root",YP,"RootExit"]:e=Zat(t),{eventIndex:0,events:e,iterator:0,node:t,visitorIndex:0,visitors:[]}}function ope(t){return t[yv]=!1,t.nodes&&t.nodes.forEach(function(e){return ope(e)}),t}var lpe={},QP=function(){function t(n,r,s){var i=this;this.stringified=!1,this.processed=!1;var o;if((typeof r>"u"?"undefined":Ir(r))==="object"&&r!==null&&(r.type==="root"||r.type==="document"))o=ope(r);else if(Pr(r,t)||Pr(r,n4e))o=ope(r.root),r.map&&(typeof s.map>"u"&&(s.map={}),s.map.inline||(s.map.inline=!1),s.map.prev=r.map);else{var l=CKt;s.syntax&&(l=s.syntax.parse),s.parser&&(l=s.parser),l.parse&&(l=l.parse);try{o=l(r,s)}catch(c){this.processed=!0,this.error=c}o&&!o[bKt]&&kKt.rebuild(o)}this.result=new n4e(n,o,s),this.helpers=Ps({},lpe,{postcss:lpe,result:this.result}),this.plugins=this.processor.plugins.map(function(c){return(typeof c>"u"?"undefined":Ir(c))==="object"&&c.prepare?Ps({},c,c.prepare(i.result)):c})}var e=t.prototype;return e.async=function(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)},e.catch=function(r){return this.async().catch(r)},e.finally=function(r){return this.async().then(r,r)},e.getAsyncError=function(){throw new Error("Use process(css).then(cb) to work with async plugins")},e.handleError=function(r,s){var i=this.result.lastPlugin;try{if(s&&s.addToError(r),this.error=r,r.name==="CssSyntaxError"&&!r.plugin)r.plugin=i.postcssPlugin,r.setMessage();else if(i.postcssVersion)var o,l,c,d,u}catch(h){console&&console.error&&console.error(h)}return r},e.prepareVisitors=function(){var r=this;this.listeners={};for(var s=function(u,h,m){r.listeners[h]||(r.listeners[h]=[]),r.listeners[h].push([u,m])},i=on(this.plugins),o;!(o=i()).done;){var l=o.value;if((typeof l>"u"?"undefined":Ir(l))==="object")for(var c in l){if(!NKt[c]&&/^[A-Z]/.test(c))throw new Error("Unknown event "+c+" in "+l.postcssPlugin+". Try to update PostCSS ("+this.processor.version+" now).");if(!TKt[c])if(Ir(l[c])==="object")for(var d in l[c])d==="*"?s(l,c,l[c][d]):s(l,c+"-"+d.toLowerCase(),l[c][d]);else typeof l[c]=="function"&&s(l,c,l[c])}}this.hasListener=Object.keys(this.listeners).length>0},e.runAsync=function(){var r=this;return Nee(function(){var s,i,o,l,c,d,u,h,m,f,p,g;return T2(this,function(v){switch(v.label){case 0:r.plugin=0,s=0,v.label=1;case 1:if(!(s<r.plugins.length))return[3,6];if(i=r.plugins[s],o=r.runOnRoot(i),!SL(o))return[3,5];v.label=2;case 2:return v.trys.push([2,4,,5]),[4,o];case 3:return v.sent(),[3,5];case 4:throw l=v.sent(),r.handleError(l);case 5:return s++,[3,1];case 6:if(r.prepareVisitors(),!r.hasListener)return[3,18];c=r.result.root,v.label=7;case 7:if(c[yv])return[3,14];c[yv]=!0,d=[r4e(c)],v.label=8;case 8:if(!(d.length>0))return[3,13];if(u=r.visitTick(d),!SL(u))return[3,12];v.label=9;case 9:return v.trys.push([9,11,,12]),[4,u];case 10:return v.sent(),[3,12];case 11:throw h=v.sent(),m=d[d.length-1].node,r.handleError(h,m);case 12:return[3,8];case 13:return[3,7];case 14:if(!r.listeners.OnceExit)return[3,18];f=function(){var b,x,w,k,S;return T2(this,function(C){switch(C.label){case 0:b=g.value,x=b[0],w=b[1],r.result.lastPlugin=x,C.label=1;case 1:return C.trys.push([1,6,,7]),c.type!=="document"?[3,3]:(k=c.nodes.map(function(j){return w(j,r.helpers)}),[4,Promise.all(k)]);case 2:return C.sent(),[3,5];case 3:return[4,w(c,r.helpers)];case 4:C.sent(),C.label=5;case 5:return[3,7];case 6:throw S=C.sent(),r.handleError(S);case 7:return[2]}})},p=on(r.listeners.OnceExit),v.label=15;case 15:return(g=p()).done?[3,18]:[5,hCe(f())];case 16:v.sent(),v.label=17;case 17:return[3,15];case 18:return r.processed=!0,[2,r.stringify()]}})})()},e.runOnRoot=function(r){var s=this;this.result.lastPlugin=r;try{if((typeof r>"u"?"undefined":Ir(r))==="object"&&r.Once){if(this.result.root.type==="document"){var i=this.result.root.nodes.map(function(o){return r.Once(o,s.helpers)});return SL(i[0])?Promise.all(i):i}return r.Once(this.result.root,this.helpers)}else if(typeof r=="function")return r(this.result.root,this.result)}catch(o){throw this.handleError(o)}},e.stringify=function(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();var r=this.result.opts,s=wKt;r.syntax&&(s=r.syntax.stringify),r.stringifier&&(s=r.stringifier),s.stringify&&(s=s.stringify);var i=new xKt(s,this.result.root,this.result.opts),o=i.generate();return this.result.css=o[0],this.result.map=o[1],this.result},e.sync=function(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(var r=on(this.plugins),s;!(s=r()).done;){var i=s.value,o=this.runOnRoot(i);if(SL(o))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){for(var l=this.result.root;!l[yv];)l[yv]=!0,this.walkSync(l);if(this.listeners.OnceExit)if(l.type==="document")for(var c=on(l.nodes),d;!(d=c()).done;){var u=d.value;this.visitSync(this.listeners.OnceExit,u)}else this.visitSync(this.listeners.OnceExit,l)}return this.result},e.then=function(r,s){return this.async().then(r,s)},e.toString=function(){return this.css},e.visitSync=function(r,s){for(var i=on(r),o;!(o=i()).done;){var l=o.value,c=l[0],d=l[1];this.result.lastPlugin=c;var u=void 0;try{u=d(s,this.helpers)}catch(h){throw this.handleError(h,s.proxyOf)}if(s.type!=="root"&&s.type!=="document"&&!s.parent)return!0;if(SL(u))throw this.getAsyncError()}},e.visitTick=function(r){var s=r[r.length-1],i=s.node,o=s.visitors;if(i.type!=="root"&&i.type!=="document"&&!i.parent){r.pop();return}if(o.length>0&&s.visitorIndex<o.length){var l=o[s.visitorIndex],c=l[0],d=l[1];s.visitorIndex+=1,s.visitorIndex===o.length&&(s.visitors=[],s.visitorIndex=0),this.result.lastPlugin=c;try{return d(i.toProxy(),this.helpers)}catch(p){throw this.handleError(p,i)}}if(s.iterator!==0){for(var u=s.iterator,h;h=i.nodes[i.indexes[u]];)if(i.indexes[u]+=1,!h[yv]){h[yv]=!0,r.push(r4e(h));return}s.iterator=0,delete i.indexes[u]}for(var m=s.events;s.eventIndex<m.length;){var f=m[s.eventIndex];if(s.eventIndex+=1,f===YP){i.nodes&&i.nodes.length&&(i[yv]=!0,s.iterator=i.getIterator());return}else if(this.listeners[f]){s.visitors=this.listeners[f];return}}r.pop()},e.walkSync=function(r){var s=this;r[yv]=!0;for(var i=Zat(r),o=on(i),l;!(l=o()).done;){var c=l.value;if(c===YP)r.nodes&&r.each(function(u){u[yv]||s.walkSync(u)});else{var d=this.listeners[c];if(d&&this.visitSync(d,r.toProxy()))return}}},e.warnings=function(){return this.sync().warnings()},uo(t,[{key:"content",get:function(){return this.stringify().content}},{key:"css",get:function(){return this.stringify().css}},{key:"map",get:function(){return this.stringify().map}},{key:"messages",get:function(){return this.sync().messages}},{key:"opts",get:function(){return this.result.opts}},{key:"processor",get:function(){return this.result.processor}},{key:"root",get:function(){return this.sync().root}},{key:Symbol.toStringTag,get:function(){return"LazyResult"}}]),t}();QP.registerPostcss=function(t){lpe=t};var Jat=QP;QP.default=QP;jKt.registerLazyResult(QP);SKt.registerLazyResult(QP);var _Kt=Iat,AKt=Tee,PKt=SCe,RKt=xCe,cpe=function(){function t(n,r,s){r=r.toString(),this.stringified=!1,this._processor=n,this._css=r,this._opts=s,this._map=void 0;var i,o=AKt;this.result=new RKt(this._processor,i,this._opts),this.result.css=r;var l=this;Object.defineProperty(this.result,"root",{get:function(){return l.root}});var c=new _Kt(o,i,this._opts,r);if(c.isMap()){var d=c.generate(),u=d[0],h=d[1];u&&(this.result.css=u),h&&(this.result.map=h)}else c.clearAnnotation(),this.result.css=c.css}var e=t.prototype;return e.async=function(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)},e.catch=function(r){return this.async().catch(r)},e.finally=function(r){return this.async().then(r,r)},e.sync=function(){if(this.error)throw this.error;return this.result},e.then=function(r,s){return this.async().then(r,s)},e.toString=function(){return this._css},e.warnings=function(){return[]},uo(t,[{key:"content",get:function(){return this.result.css}},{key:"css",get:function(){return this.result.css}},{key:"map",get:function(){return this.result.map}},{key:"messages",get:function(){return[]}},{key:"opts",get:function(){return this.result.opts}},{key:"processor",get:function(){return this.result.processor}},{key:"root",get:function(){if(this._root)return this._root;var r,s=PKt;try{r=s(this._css,this._opts)}catch(i){this.error=i}if(this.error)throw this.error;return this._root=r,r}},{key:Symbol.toStringTag,get:function(){return"NoWorkResult"}}]),t}(),IKt=cpe;cpe.default=cpe;var MKt=IKt,LKt=Jat,DKt=bCe,$Kt=q8,AO=function(){function t(n){n===void 0&&(n=[]),this.version="8.4.38",this.plugins=this.normalize(n)}var e=t.prototype;return e.normalize=function(r){for(var s=[],i=on(r),o;!(o=i()).done;){var l=o.value;if(l.postcss===!0?l=l():l.postcss&&(l=l.postcss),(typeof l>"u"?"undefined":Ir(l))==="object"&&Array.isArray(l.plugins))s=s.concat(l.plugins);else if((typeof l>"u"?"undefined":Ir(l))==="object"&&l.postcssPlugin)s.push(l);else if(typeof l=="function")s.push(l);else if(!((typeof l>"u"?"undefined":Ir(l))==="object"&&(l.parse||l.stringify)))throw new Error(l+" is not a PostCSS plugin")}return s},e.process=function(r,s){return s===void 0&&(s={}),!this.plugins.length&&!s.parser&&!s.stringifier&&!s.syntax?new MKt(this,r,s):new LKt(this,r,s)},e.use=function(r){return this.plugins=this.plugins.concat(this.normalize([r])),this},t}(),OKt=AO;AO.default=AO;$Kt.registerProcessor(AO);DKt.registerProcessor(AO);var FKt=Aee,BKt=Tat,UKt=Ree,zKt=wCe,VKt=Pee,HKt=q8,GKt=kCe;function PO(t,e){if(Array.isArray(t))return t.map(function(h){return PO(h)});var n=t.inputs,r=N2(t,["inputs"]);if(n){e=[];for(var s=on(n),i;!(i=s()).done;){var o=i.value,l=Ps({},o,{__proto__:VKt.prototype});l.map&&(l.map=Ps({},l.map,{__proto__:BKt.prototype})),e.push(l)}}if(r.nodes&&(r.nodes=t.nodes.map(function(h){return PO(h,e)})),r.source){var c=r.source,d=c.inputId,u=N2(c,["inputId"]);r.source=u,d!=null&&(r.source.input=e[d])}if(r.type==="root")return new HKt(r);if(r.type==="decl")return new FKt(r);if(r.type==="rule")return new GKt(r);if(r.type==="comment")return new UKt(r);if(r.type==="atrule")return new zKt(r);throw new Error("Unknown node type: "+t.type)}var WKt=PO;PO.default=PO;var qKt=gCe,Xat=Aee,KKt=Jat,YKt=NE,CCe=OKt,QKt=Tee,ZKt=WKt,eot=bCe,JKt=Hat,tot=Ree,not=wCe,XKt=xCe,eYt=Pee,tYt=SCe,nYt=Yat,rot=kCe,sot=q8,rYt=_ee;function Gi(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new CCe(e)}Gi.plugin=function(e,n){var r=!1;function s(){for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];console&&console.warn&&!r&&(r=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration`),qP.LANG&&qP.LANG.startsWith("cn")&&console.warn(e+`: 里面 postcss.plugin 被弃用. 迁移指南:
https://www.w3ctech.com/topic/2226`));var d=n.apply(void 0,[].concat(l));return d.postcssPlugin=e,d.postcssVersion=new CCe().version,d}var i;return Object.defineProperty(s,"postcss",{get:function(){return i||(i=s()),i}}),s.process=function(o,l,c){return Gi([s(c)]).process(o,l)},s};Gi.stringify=QKt;Gi.parse=tYt;Gi.fromJSON=ZKt;Gi.list=nYt;Gi.comment=function(t){return new tot(t)};Gi.atRule=function(t){return new not(t)};Gi.decl=function(t){return new Xat(t)};Gi.rule=function(t){return new rot(t)};Gi.root=function(t){return new sot(t)};Gi.document=function(t){return new eot(t)};Gi.CssSyntaxError=qKt;Gi.Declaration=Xat;Gi.Container=YKt;Gi.Processor=CCe;Gi.Document=eot;Gi.Comment=tot;Gi.Warning=JKt;Gi.AtRule=not;Gi.Result=XKt;Gi.Input=eYt;Gi.Rule=rot;Gi.Root=sot;Gi.Node=rYt;KKt.registerPostcss(Gi);var sYt=Gi;Gi.default=Gi;var jo=vqt(sYt);jo.stringify;jo.fromJSON;jo.plugin;jo.parse;jo.list;jo.document;jo.comment;jo.atRule;jo.rule;jo.decl;jo.root;jo.CssSyntaxError;jo.Declaration;jo.Container;jo.Processor;jo.Document;jo.Comment;jo.Warning;jo.AtRule;jo.Result;jo.Input;jo.Rule;jo.Root;jo.Node;var iYt=Object.defineProperty,aYt=function(t,e,n){return e in t?iYt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},zm=function(t,e,n){return aYt(t,(typeof e>"u"?"undefined":Ir(e))!=="symbol"?e+"":e,n)};function oYt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function lYt(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return Pr(this,r)?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return t[r]}})}),n}var jCe={exports:{}},za=String,iot=function(){return{isColorSupported:!1,reset:za,bold:za,dim:za,italic:za,underline:za,inverse:za,hidden:za,strikethrough:za,black:za,red:za,green:za,yellow:za,blue:za,magenta:za,cyan:za,white:za,gray:za,bgBlack:za,bgRed:za,bgGreen:za,bgYellow:za,bgBlue:za,bgMagenta:za,bgCyan:za,bgWhite:za}};jCe.exports=iot();jCe.exports.createColors=iot;var cYt=jCe.exports,dYt={},uYt=Object.freeze(Object.defineProperty({__proto__:null,default:dYt},Symbol.toStringTag,{value:"Module"})),Ml=lYt(uYt),s4e=cYt,i4e=Ml,dpe=function(t){Co(e,t);function e(r,s,i,o,l,c){var d;return d=t.call(this,r)||this,d.name="CssSyntaxError",d.reason=r,l&&(d.file=l),o&&(d.source=o),c&&(d.plugin=c),typeof s<"u"&&typeof i<"u"&&(typeof s=="number"?(d.line=s,d.column=i):(d.line=s.line,d.column=s.column,d.endLine=i.line,d.endColumn=i.column)),d.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(d,e),d}var n=e.prototype;return n.setMessage=function(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason},n.showSourceCode=function(s){var i=this;if(!this.source)return"";var o=this.source;s==null&&(s=s4e.isColorSupported),i4e&&s&&(o=i4e(o));var l=o.split(/\r?\n/),c=Math.max(this.line-3,0),d=Math.min(this.line+2,l.length),u=String(d).length,h,m;if(s){var f=s4e.createColors(!0),p=f.bold,g=f.gray,v=f.red;h=function(b){return p(v(b))},m=function(b){return g(b)}}else h=m=function(b){return b};return l.slice(c,d).map(function(b,x){var w=c+1+x,k=" "+(" "+w).slice(-u)+" | ";if(w===i.line){var S=m(k.replace(/\d/g," "))+b.slice(0,i.column-1).replace(/[^\t]/g," ");return h(">")+m(k)+b+`
 `+S+h("^")}return" "+m(k)+b}).join(`
`)},n.toString=function(){var s=this.showSourceCode();return s&&(s=`

`+s+`
`),this.name+": "+this.message+s},e}(EO(Error)),ECe=dpe;dpe.default=dpe;var lS={};lS.isClean=Symbol("isClean");lS.my=Symbol("my");var a4e={after:`
`,beforeClose:`
`,beforeComment:`
`,beforeDecl:`
`,beforeOpen:" ",beforeRule:`
`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:"    ",semicolon:!1};function hYt(t){return t[0].toUpperCase()+t.slice(1)}var upe=function(){function t(n){this.builder=n}var e=t.prototype;return e.atrule=function(r,s){var i="@"+r.name,o=r.params?this.rawValue(r,"params"):"";if(typeof r.raws.afterName<"u"?i+=r.raws.afterName:o&&(i+=" "),r.nodes)this.block(r,i+o);else{var l=(r.raws.between||"")+(s?";":"");this.builder(i+o+l,r)}},e.beforeAfter=function(r,s){var i;r.type==="decl"?i=this.raw(r,null,"beforeDecl"):r.type==="comment"?i=this.raw(r,null,"beforeComment"):s==="before"?i=this.raw(r,null,"beforeRule"):i=this.raw(r,null,"beforeClose");for(var o=r.parent,l=0;o&&o.type!=="root";)l+=1,o=o.parent;if(i.includes(`
`)){var c=this.raw(r,null,"indent");if(c.length)for(var d=0;d<l;d++)i+=c}return i},e.block=function(r,s){var i=this.raw(r,"between","beforeOpen");this.builder(s+i+"{",r,"start");var o;r.nodes&&r.nodes.length?(this.body(r),o=this.raw(r,"after")):o=this.raw(r,"after","emptyBody"),o&&this.builder(o),this.builder("}",r,"end")},e.body=function(r){for(var s=r.nodes.length-1;s>0&&r.nodes[s].type==="comment";)s-=1;for(var i=this.raw(r,"semicolon"),o=0;o<r.nodes.length;o++){var l=r.nodes[o],c=this.raw(l,"before");c&&this.builder(c),this.stringify(l,s!==o||i)}},e.comment=function(r){var s=this.raw(r,"left","commentLeft"),i=this.raw(r,"right","commentRight");this.builder("/*"+s+r.text+i+"*/",r)},e.decl=function(r,s){var i=this.raw(r,"between","colon"),o=r.prop+i+this.rawValue(r,"value");r.important&&(o+=r.raws.important||" !important"),s&&(o+=";"),this.builder(o,r)},e.document=function(r){this.body(r)},e.raw=function(r,s,i){var o;if(i||(i=s),s&&(o=r.raws[s],typeof o<"u"))return o;var l=r.parent;if(i==="before"&&(!l||l.type==="root"&&l.first===r||l&&l.type==="document"))return"";if(!l)return a4e[i];var c=r.root();if(c.rawCache||(c.rawCache={}),typeof c.rawCache[i]<"u")return c.rawCache[i];if(i==="before"||i==="after")return this.beforeAfter(r,i);var d="raw"+hYt(i);return this[d]?o=this[d](c,r):c.walk(function(u){if(o=u.raws[s],typeof o<"u")return!1}),typeof o>"u"&&(o=a4e[i]),c.rawCache[i]=o,o},e.rawBeforeClose=function(r){var s;return r.walk(function(i){if(i.nodes&&i.nodes.length>0&&typeof i.raws.after<"u")return s=i.raws.after,s.includes(`
`)&&(s=s.replace(/[^\n]+$/,"")),!1}),s&&(s=s.replace(/\S/g,"")),s},e.rawBeforeComment=function(r,s){var i;return r.walkComments(function(o){if(typeof o.raws.before<"u")return i=o.raws.before,i.includes(`
`)&&(i=i.replace(/[^\n]+$/,"")),!1}),typeof i>"u"?i=this.raw(s,null,"beforeDecl"):i&&(i=i.replace(/\S/g,"")),i},e.rawBeforeDecl=function(r,s){var i;return r.walkDecls(function(o){if(typeof o.raws.before<"u")return i=o.raws.before,i.includes(`
`)&&(i=i.replace(/[^\n]+$/,"")),!1}),typeof i>"u"?i=this.raw(s,null,"beforeRule"):i&&(i=i.replace(/\S/g,"")),i},e.rawBeforeOpen=function(r){var s;return r.walk(function(i){if(i.type!=="decl"&&(s=i.raws.between,typeof s<"u"))return!1}),s},e.rawBeforeRule=function(r){var s;return r.walk(function(i){if(i.nodes&&(i.parent!==r||r.first!==i)&&typeof i.raws.before<"u")return s=i.raws.before,s.includes(`
`)&&(s=s.replace(/[^\n]+$/,"")),!1}),s&&(s=s.replace(/\S/g,"")),s},e.rawColon=function(r){var s;return r.walkDecls(function(i){if(typeof i.raws.between<"u")return s=i.raws.between.replace(/[^\s:]/g,""),!1}),s},e.rawEmptyBody=function(r){var s;return r.walk(function(i){if(i.nodes&&i.nodes.length===0&&(s=i.raws.after,typeof s<"u"))return!1}),s},e.rawIndent=function(r){if(r.raws.indent)return r.raws.indent;var s;return r.walk(function(i){var o=i.parent;if(o&&o!==r&&o.parent&&o.parent===r&&typeof i.raws.before<"u"){var l=i.raws.before.split(`
`);return s=l[l.length-1],s=s.replace(/\S/g,""),!1}}),s},e.rawSemicolon=function(r){var s;return r.walk(function(i){if(i.nodes&&i.nodes.length&&i.last.type==="decl"&&(s=i.raws.semicolon,typeof s<"u"))return!1}),s},e.rawValue=function(r,s){var i=r[s],o=r.raws[s];return o&&o.value===i?o.raw:i},e.root=function(r){this.body(r),r.raws.after&&this.builder(r.raws.after)},e.rule=function(r){this.block(r,this.rawValue(r,"selector")),r.raws.ownSemicolon&&this.builder(r.raws.ownSemicolon,r,"end")},e.stringify=function(r,s){if(!this[r.type])throw new Error("Unknown AST node type "+r.type+". Maybe you need to change PostCSS stringifier.");this[r.type](r,s)},t}(),aot=upe;upe.default=upe;var mYt=aot;function hpe(t,e){var n=new mYt(e);n.stringify(t)}var Iee=hpe;hpe.default=hpe;var kU=lS.isClean,fYt=lS.my,pYt=ECe,gYt=aot,vYt=Iee;function mpe(t,e){var n=new t.constructor;for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&r!=="proxyCache"){var s=t[r],i=typeof s>"u"?"undefined":Ir(s);r==="parent"&&i==="object"?e&&(n[r]=e):r==="source"?n[r]=s:Array.isArray(s)?n[r]=s.map(function(o){return mpe(o,n)}):(i==="object"&&s!==null&&(s=mpe(s)),n[r]=s)}return n}var fpe=function(){function t(n){n===void 0&&(n={}),this.raws={},this[kU]=!1,this[fYt]=!0;for(var r in n)if(r==="nodes"){this.nodes=[];for(var s=on(n[r]),i;!(i=s()).done;){var o=i.value;typeof o.clone=="function"?this.append(o.clone()):this.append(o)}}else this[r]=n[r]}var e=t.prototype;return e.addToError=function(r){if(r.postcssNode=this,r.stack&&this.source&&/\n\s{4}at /.test(r.stack)){var s=this.source;r.stack=r.stack.replace(/\n\s{4}at /,"$&"+s.input.from+":"+s.start.line+":"+s.start.column+"$&")}return r},e.after=function(r){return this.parent.insertAfter(this,r),this},e.assign=function(r){r===void 0&&(r={});for(var s in r)this[s]=r[s];return this},e.before=function(r){return this.parent.insertBefore(this,r),this},e.cleanRaws=function(r){delete this.raws.before,delete this.raws.after,r||delete this.raws.between},e.clone=function(r){r===void 0&&(r={});var s=mpe(this);for(var i in r)s[i]=r[i];return s},e.cloneAfter=function(r){r===void 0&&(r={});var s=this.clone(r);return this.parent.insertAfter(this,s),s},e.cloneBefore=function(r){r===void 0&&(r={});var s=this.clone(r);return this.parent.insertBefore(this,s),s},e.error=function(r,s){if(s===void 0&&(s={}),this.source){var i=this.rangeBy(s),o=i.end,l=i.start;return this.source.input.error(r,{column:l.column,line:l.line},{column:o.column,line:o.line},s)}return new pYt(r)},e.getProxyProcessor=function(){return{get:function(s,i){return i==="proxyOf"?s:i==="root"?function(){return s.root().toProxy()}:s[i]},set:function(s,i,o){return s[i]===o||(s[i]=o,(i==="prop"||i==="value"||i==="name"||i==="params"||i==="important"||i==="text")&&s.markDirty()),!0}}},e.markDirty=function(){if(this[kU]){this[kU]=!1;for(var r=this;r=r.parent;)r[kU]=!1}},e.next=function(){if(this.parent){var r=this.parent.index(this);return this.parent.nodes[r+1]}},e.positionBy=function(r,s){var i=this.source.start;if(r.index)i=this.positionInside(r.index,s);else if(r.word){s=this.toString();var o=s.indexOf(r.word);o!==-1&&(i=this.positionInside(o,s))}return i},e.positionInside=function(r,s){for(var i=s||this.toString(),o=this.source.start.column,l=this.source.start.line,c=0;c<r;c++)i[c]===`
`?(o=1,l+=1):o+=1;return{column:o,line:l}},e.prev=function(){if(this.parent){var r=this.parent.index(this);return this.parent.nodes[r-1]}},e.rangeBy=function(r){var s={column:this.source.start.column,line:this.source.start.line},i=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:s.column+1,line:s.line};if(r.word){var o=this.toString(),l=o.indexOf(r.word);l!==-1&&(s=this.positionInside(l,o),i=this.positionInside(l+r.word.length,o))}else r.start?s={column:r.start.column,line:r.start.line}:r.index&&(s=this.positionInside(r.index)),r.end?i={column:r.end.column,line:r.end.line}:typeof r.endIndex=="number"?i=this.positionInside(r.endIndex):r.index&&(i=this.positionInside(r.index+1));return(i.line<s.line||i.line===s.line&&i.column<=s.column)&&(i={column:s.column+1,line:s.line}),{end:i,start:s}},e.raw=function(r,s){var i=new gYt;return i.raw(this,r,s)},e.remove=function(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this},e.replaceWith=function(){for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];if(this.parent){for(var o=this,l=!1,c=on(s),d;!(d=c()).done;){var u=d.value;u===this?l=!0:l?(this.parent.insertAfter(o,u),o=u):this.parent.insertBefore(o,u)}l||this.remove()}return this},e.root=function(){for(var r=this;r.parent&&r.parent.type!=="document";)r=r.parent;return r},e.toJSON=function(r,s){var i={},o=s==null;s=s||new Map;var l=0;for(var c in this)if(Object.prototype.hasOwnProperty.call(this,c)&&!(c==="parent"||c==="proxyCache")){var d=this[c];if(Array.isArray(d))i[c]=d.map(function(h){return(typeof h>"u"?"undefined":Ir(h))==="object"&&h.toJSON?h.toJSON(null,s):h});else if((typeof d>"u"?"undefined":Ir(d))==="object"&&d.toJSON)i[c]=d.toJSON(null,s);else if(c==="source"){var u=s.get(d.input);u==null&&(u=l,s.set(d.input,l),l++),i[c]={end:d.end,inputId:u,start:d.start}}else i[c]=d}return o&&(i.inputs=[].concat(s.keys()).map(function(h){return h.toJSON()})),i},e.toProxy=function(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache},e.toString=function(r){r===void 0&&(r=vYt),r.stringify&&(r=r.stringify);var s="";return r(this,function(i){s+=i}),s},e.warn=function(r,s,i){var o={node:this};for(var l in i)o[l]=i[l];return r.warn(s,o)},uo(t,[{key:"proxyOf",get:function(){return this}}]),t}(),Mee=fpe;fpe.default=fpe;var yYt=Mee,ppe=function(t){Co(e,t);function e(n){var r;return n&&typeof n.value<"u"&&typeof n.value!="string"&&(n=Ps({},n,{value:String(n.value)})),r=t.call(this,n)||this,r.type="decl",r}return uo(e,[{key:"variable",get:function(){return this.prop.startsWith("--")||this.prop[0]==="$"}}]),e}(yYt),Lee=ppe;ppe.default=ppe;var bYt="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",xYt=function(t){t===void 0&&(t=21);for(var e="",n=t;n--;)e+=bYt[Math.random()*64|0];return e},wYt={nanoid:xYt},o4e=Ml.SourceMapConsumer,l4e=Ml.SourceMapGenerator,kYt=Ml.existsSync,SYt=Ml.readFileSync,Soe=Ml.dirname,CYt=Ml.join;function jYt(t){return Buffer?Buffer.from(t,"base64").toString():window.atob(t)}var gpe=function(){function t(n,r){if(r.map!==!1){this.loadAnnotation(n),this.inline=this.startWith(this.annotation,"data:");var s=r.map?r.map.prev:void 0,i=this.loadMap(r.from,s);!this.mapFile&&r.from&&(this.mapFile=r.from),this.mapFile&&(this.root=Soe(this.mapFile)),i&&(this.text=i)}}var e=t.prototype;return e.consumer=function(){return this.consumerCache||(this.consumerCache=new o4e(this.text)),this.consumerCache},e.decodeInline=function(r){var s=/^data:application\/json;charset=utf-?8;base64,/,i=/^data:application\/json;base64,/,o=/^data:application\/json;charset=utf-?8,/,l=/^data:application\/json,/;if(o.test(r)||l.test(r))return decodeURIComponent(r.substr(RegExp.lastMatch.length));if(s.test(r)||i.test(r))return jYt(r.substr(RegExp.lastMatch.length));var c=r.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+c)},e.getAnnotationURL=function(r){return r.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()},e.isMap=function(r){return(typeof r>"u"?"undefined":Ir(r))!=="object"?!1:typeof r.mappings=="string"||typeof r._mappings=="string"||Array.isArray(r.sections)},e.loadAnnotation=function(r){var s=r.match(/\/\*\s*# sourceMappingURL=/gm);if(s){var i=r.lastIndexOf(s.pop()),o=r.indexOf("*/",i);i>-1&&o>-1&&(this.annotation=this.getAnnotationURL(r.substring(i,o)))}},e.loadFile=function(r){if(this.root=Soe(r),kYt(r))return this.mapFile=r,SYt(r,"utf-8").toString().trim()},e.loadMap=function(r,s){if(s===!1)return!1;if(s){if(typeof s=="string")return s;if(typeof s=="function"){var i=s(r);if(i){var o=this.loadFile(i);if(!o)throw new Error("Unable to load previous source map: "+i.toString());return o}}else{if(Pr(s,o4e))return l4e.fromSourceMap(s).toString();if(Pr(s,l4e))return s.toString();if(this.isMap(s))return JSON.stringify(s);throw new Error("Unsupported previous source map format: "+s.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){var l=this.annotation;return r&&(l=CYt(Soe(r),l)),this.loadFile(l)}}},e.startWith=function(r,s){return r?r.substr(0,s.length)===s:!1},e.withContent=function(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)},t}(),oot=gpe;gpe.default=gpe;var EYt=Ml.SourceMapConsumer,NYt=Ml.SourceMapGenerator,c4e=Ml.fileURLToPath,SU=Ml.pathToFileURL,vpe=Ml.isAbsolute,ype=Ml.resolve,TYt=wYt.nanoid,Coe=Ml,d4e=ECe,_Yt=oot,joe=Symbol("fromOffsetCache"),AYt=!!(EYt&&NYt),u4e=!!(ype&&vpe),UK=function(){function t(n,r){if(r===void 0&&(r={}),n===null||typeof n>"u"||(typeof n>"u"?"undefined":Ir(n))==="object"&&!n.toString)throw new Error("PostCSS received "+n+" instead of CSS string");if(this.css=n.toString(),this.css[0]==="\uFEFF"||this.css[0]==="￾"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,r.from&&(!u4e||/^\w+:\/\//.test(r.from)||vpe(r.from)?this.file=r.from:this.file=ype(r.from)),u4e&&AYt){var s=new _Yt(this.css,r);if(s.text){this.map=s;var i=s.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+TYt(6)+">"),this.map&&(this.map.file=this.from)}var e=t.prototype;return e.error=function(r,s,i,o){o===void 0&&(o={});var l,c,d;if(s&&(typeof s>"u"?"undefined":Ir(s))==="object"){var u=s,h=i;if(typeof u.offset=="number"){var m=this.fromOffset(u.offset);s=m.line,i=m.col}else s=u.line,i=u.column;if(typeof h.offset=="number"){var f=this.fromOffset(h.offset);c=f.line,d=f.col}else c=h.line,d=h.column}else if(!i){var p=this.fromOffset(s);s=p.line,i=p.col}var g=this.origin(s,i,c,d);return g?l=new d4e(r,g.endLine===void 0?g.line:{column:g.column,line:g.line},g.endLine===void 0?g.column:{column:g.endColumn,line:g.endLine},g.source,g.file,o.plugin):l=new d4e(r,c===void 0?s:{column:i,line:s},c===void 0?i:{column:d,line:c},this.css,this.file,o.plugin),l.input={column:i,endColumn:d,endLine:c,line:s,source:this.css},this.file&&(SU&&(l.input.url=SU(this.file).toString()),l.input.file=this.file),l},e.fromOffset=function(r){var s,i;if(this[joe])i=this[joe];else{var o=this.css.split(`
`);i=new Array(o.length);for(var l=0,c=0,d=o.length;c<d;c++)i[c]=l,l+=o[c].length+1;this[joe]=i}s=i[i.length-1];var u=0;if(r>=s)u=i.length-1;else for(var h=i.length-2,m;u<h;)if(m=u+(h-u>>1),r<i[m])h=m-1;else if(r>=i[m+1])u=m+1;else{u=m;break}return{col:r-i[u]+1,line:u+1}},e.mapResolve=function(r){return/^\w+:\/\//.test(r)?r:ype(this.map.consumer().sourceRoot||this.map.root||".",r)},e.origin=function(r,s,i,o){if(!this.map)return!1;var l=this.map.consumer(),c=l.originalPositionFor({column:s,line:r});if(!c.source)return!1;var d;typeof i=="number"&&(d=l.originalPositionFor({column:o,line:i}));var u;vpe(c.source)?u=SU(c.source):u=new URL(c.source,this.map.consumer().sourceRoot||SU(this.map.mapFile));var h={column:c.column,endColumn:d&&d.column,endLine:d&&d.line,line:c.line,url:u.toString()};if(u.protocol==="file:")if(c4e)h.file=c4e(u);else throw new Error("file: protocol is not available in this PostCSS build");var m=l.sourceContentFor(c.source);return m&&(h.source=m),h},e.toJSON=function(){for(var r={},s=0,i=["hasBOM","css","file","id"];s<i.length;s++){var o=i[s];this[o]!=null&&(r[o]=this[o])}return this.map&&(r.map=Ps({},this.map),r.map.consumerCache&&(r.map.consumerCache=void 0)),r},uo(t,[{key:"from",get:function(){return this.file||this.id}}]),t}(),Dee=UK;UK.default=UK;Coe&&Coe.registerInput&&Coe.registerInput(UK);var lot=Ml.SourceMapConsumer,yG=Ml.SourceMapGenerator,bG=Ml.dirname,cot=Ml.relative,dot=Ml.resolve,uot=Ml.sep,h4e=Ml.pathToFileURL,PYt=Dee,RYt=!!(lot&&yG),IYt=!!(bG&&dot&&cot&&uot),MYt=function(){function t(n,r,s,i){this.stringify=n,this.mapOpts=s.map||{},this.root=r,this.opts=s,this.css=i,this.originalCSS=i,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}var e=t.prototype;return e.addAnnotation=function(){var r;this.isInline()?r="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?r=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?r=this.mapOpts.annotation(this.opts.to,this.root):r=this.outputFile()+".map";var s=`
`;this.css.includes(`\r
`)&&(s=`\r
`),this.css+=s+"/*# sourceMappingURL="+r+" */"},e.applyPrevMaps=function(){for(var r=on(this.previous()),s;!(s=r()).done;){var i=s.value,o=this.toUrl(this.path(i.file)),l=i.root||bG(i.file),c=void 0;this.mapOpts.sourcesContent===!1?(c=new lot(i.text),c.sourcesContent&&(c.sourcesContent=null)):c=i.consumer(),this.map.applySourceMap(c,o,this.toUrl(this.path(l)))}},e.clearAnnotation=function(){if(this.mapOpts.annotation!==!1)if(this.root)for(var r,s=this.root.nodes.length-1;s>=0;s--)r=this.root.nodes[s],r.type==="comment"&&r.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(s);else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))},e.generate=function(){if(this.clearAnnotation(),IYt&&RYt&&this.isMap())return this.generateMap();var r="";return this.stringify(this.root,function(s){r+=s}),[r]},e.generateMap=function(){if(this.root)this.generateString();else if(this.previous().length===1){var r=this.previous()[0].consumer();r.file=this.outputFile(),this.map=yG.fromSourceMap(r,{ignoreInvalidMapping:!0})}else this.map=new yG({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]},e.generateString=function(){var r=this;this.css="",this.map=new yG({file:this.outputFile(),ignoreInvalidMapping:!0});var s=1,i=1,o="<no source>",l={generated:{column:0,line:0},original:{column:0,line:0},source:""},c,d;this.stringify(this.root,function(u,h,m){if(r.css+=u,h&&m!=="end"&&(l.generated.line=s,l.generated.column=i-1,h.source&&h.source.start?(l.source=r.sourcePath(h),l.original.line=h.source.start.line,l.original.column=h.source.start.column-1,r.map.addMapping(l)):(l.source=o,l.original.line=1,l.original.column=0,r.map.addMapping(l))),c=u.match(/\n/g),c?(s+=c.length,d=u.lastIndexOf(`
`),i=u.length-d):i+=u.length,h&&m!=="start"){var f=h.parent||{raws:{}},p=h.type==="decl"||h.type==="atrule"&&!h.nodes;(!p||h!==f.last||f.raws.semicolon)&&(h.source&&h.source.end?(l.source=r.sourcePath(h),l.original.line=h.source.end.line,l.original.column=h.source.end.column-1,l.generated.line=s,l.generated.column=i-2,r.map.addMapping(l)):(l.source=o,l.original.line=1,l.original.column=0,l.generated.line=s,l.generated.column=i-1,r.map.addMapping(l)))}})},e.isAnnotation=function(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(function(r){return r.annotation}):!0},e.isInline=function(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;var r=this.mapOpts.annotation;return typeof r<"u"&&r!==!0?!1:this.previous().length?this.previous().some(function(s){return s.inline}):!0},e.isMap=function(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0},e.isSourcesContent=function(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(function(r){return r.withContent()}):!0},e.outputFile=function(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"},e.path=function(r){if(this.mapOpts.absolute||r.charCodeAt(0)===60||/^\w+:\/\//.test(r))return r;var s=this.memoizedPaths.get(r);if(s)return s;var i=this.opts.to?bG(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(i=bG(dot(i,this.mapOpts.annotation)));var o=cot(i,r);return this.memoizedPaths.set(r,o),o},e.previous=function(){var r=this;if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(function(i){if(i.source&&i.source.input.map){var o=i.source.input.map;r.previousMaps.includes(o)||r.previousMaps.push(o)}});else{var s=new PYt(this.originalCSS,this.opts);s.map&&this.previousMaps.push(s.map)}return this.previousMaps},e.setSourcesContent=function(){var r=this,s={};if(this.root)this.root.walk(function(o){if(o.source){var l=o.source.input.from;if(l&&!s[l]){s[l]=!0;var c=r.usesFileUrls?r.toFileUrl(l):r.toUrl(r.path(l));r.map.setSourceContent(c,o.source.input.css)}}});else if(this.css){var i=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(i,this.css)}},e.sourcePath=function(r){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(r.source.input.from):this.toUrl(this.path(r.source.input.from))},e.toBase64=function(r){return Buffer?Buffer.from(r).toString("base64"):window.btoa(unescape(encodeURIComponent(r)))},e.toFileUrl=function(r){var s=this.memoizedFileURLs.get(r);if(s)return s;if(h4e){var i=h4e(r).toString();return this.memoizedFileURLs.set(r,i),i}else throw new Error("`map.absolute` option is not available in this PostCSS build")},e.toUrl=function(r){var s=this.memoizedURLs.get(r);if(s)return s;uot==="\\"&&(r=r.replace(/\\/g,"/"));var i=encodeURI(r).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(r,i),i},t}(),hot=MYt,LYt=Mee,bpe=function(t){Co(e,t);function e(n){var r;return r=t.call(this,n)||this,r.type="comment",r}return e}(LYt),$ee=bpe;bpe.default=bpe;var mot=lS.isClean,fot=lS.my,pot=Lee,got=$ee,DYt=Mee,vot,NCe,TCe,yot;function bot(t){return t.map(function(e){return e.nodes&&(e.nodes=bot(e.nodes)),delete e.source,e})}function xot(t){if(t[mot]=!1,t.proxyOf.nodes)for(var e=on(t.proxyOf.nodes),n;!(n=e()).done;){var r=n.value;xot(r)}}var Yx=function(t){Co(e,t);function e(){return t.apply(this,arguments)||this}var n=e.prototype;return n.append=function(){for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];for(var l=on(i),c;!(c=l()).done;)for(var d=c.value,u=this.normalize(d,this.last),h=on(u),m;!(m=h()).done;){var f=m.value;this.proxyOf.nodes.push(f)}return this.markDirty(),this},n.cleanRaws=function(s){if(t.prototype.cleanRaws.call(this,s),this.nodes)for(var i=on(this.nodes),o;!(o=i()).done;){var l=o.value;l.cleanRaws(s)}},n.each=function(s){if(this.proxyOf.nodes){for(var i=this.getIterator(),o,l;this.indexes[i]<this.proxyOf.nodes.length&&(o=this.indexes[i],l=s(this.proxyOf.nodes[o],o),l!==!1);)this.indexes[i]+=1;return delete this.indexes[i],l}},n.every=function(s){return this.nodes.every(s)},n.getIterator=function(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;var s=this.lastEach;return this.indexes[s]=0,s},n.getProxyProcessor=function(){return{get:function(i,o){return o==="proxyOf"?i:i[o]?o==="each"||typeof o=="string"&&o.startsWith("walk")?function(){for(var l=arguments.length,c=new Array(l),d=0;d<l;d++)c[d]=arguments[d];var u;return(u=i)[o].apply(u,[].concat(c.map(function(h){return typeof h=="function"?function(m,f){return h(m.toProxy(),f)}:h})))}:o==="every"||o==="some"?function(l){return i[o](function(c){for(var d=arguments.length,u=new Array(d>1?d-1:0),h=1;h<d;h++)u[h-1]=arguments[h];return l.apply(void 0,[].concat([c.toProxy()],u))})}:o==="root"?function(){return i.root().toProxy()}:o==="nodes"?i.nodes.map(function(l){return l.toProxy()}):o==="first"||o==="last"?i[o].toProxy():i[o]:i[o]},set:function(i,o,l){return i[o]===l||(i[o]=l,(o==="name"||o==="params"||o==="selector")&&i.markDirty()),!0}}},n.index=function(s){return typeof s=="number"?s:(s.proxyOf&&(s=s.proxyOf),this.proxyOf.nodes.indexOf(s))},n.insertAfter=function(s,i){var o=this.index(s),l=this.normalize(i,this.proxyOf.nodes[o]).reverse();o=this.index(s);for(var c=on(l),d;!(d=c()).done;){var u=d.value;this.proxyOf.nodes.splice(o+1,0,u)}var h;for(var m in this.indexes)h=this.indexes[m],o<h&&(this.indexes[m]=h+l.length);return this.markDirty(),this},n.insertBefore=function(s,i){var o=this.index(s),l=o===0?"prepend":!1,c=this.normalize(i,this.proxyOf.nodes[o],l).reverse();o=this.index(s);for(var d=on(c),u;!(u=d()).done;){var h=u.value;this.proxyOf.nodes.splice(o,0,h)}var m;for(var f in this.indexes)m=this.indexes[f],o<=m&&(this.indexes[f]=m+c.length);return this.markDirty(),this},n.normalize=function(s,i){var o=this;if(typeof s=="string")s=bot(vot(s).nodes);else if(typeof s>"u")s=[];else if(Array.isArray(s)){s=s.slice(0);for(var l=on(s),c;!(c=l()).done;){var d=c.value;d.parent&&d.parent.removeChild(d,"ignore")}}else if(s.type==="root"&&this.type!=="document"){s=s.nodes.slice(0);for(var u=on(s),h;!(h=u()).done;){var m=h.value;m.parent&&m.parent.removeChild(m,"ignore")}}else if(s.type)s=[s];else if(s.prop){if(typeof s.value>"u")throw new Error("Value field is missed in node creation");typeof s.value!="string"&&(s.value=String(s.value)),s=[new pot(s)]}else if(s.selector)s=[new NCe(s)];else if(s.name)s=[new TCe(s)];else if(s.text)s=[new got(s)];else throw new Error("Unknown node type in node creation");var f=s.map(function(p){return p[fot]||e.rebuild(p),p=p.proxyOf,p.parent&&p.parent.removeChild(p),p[mot]&&xot(p),typeof p.raws.before>"u"&&i&&typeof i.raws.before<"u"&&(p.raws.before=i.raws.before.replace(/\S/g,"")),p.parent=o.proxyOf,p});return f},n.prepend=function(){for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];i=i.reverse();for(var l=on(i),c;!(c=l()).done;){for(var d=c.value,u=this.normalize(d,this.first,"prepend").reverse(),h=on(u),m;!(m=h()).done;){var f=m.value;this.proxyOf.nodes.unshift(f)}for(var p in this.indexes)this.indexes[p]=this.indexes[p]+u.length}return this.markDirty(),this},n.push=function(s){return s.parent=this,this.proxyOf.nodes.push(s),this},n.removeAll=function(){for(var s=on(this.proxyOf.nodes),i;!(i=s()).done;){var o=i.value;o.parent=void 0}return this.proxyOf.nodes=[],this.markDirty(),this},n.removeChild=function(s){s=this.index(s),this.proxyOf.nodes[s].parent=void 0,this.proxyOf.nodes.splice(s,1);var i;for(var o in this.indexes)i=this.indexes[o],i>=s&&(this.indexes[o]=i-1);return this.markDirty(),this},n.replaceValues=function(s,i,o){return o||(o=i,i={}),this.walkDecls(function(l){i.props&&!i.props.includes(l.prop)||i.fast&&!l.value.includes(i.fast)||(l.value=l.value.replace(s,o))}),this.markDirty(),this},n.some=function(s){return this.nodes.some(s)},n.walk=function(s){return this.each(function(i,o){var l;try{l=s(i,o)}catch(c){throw i.addToError(c)}return l!==!1&&i.walk&&(l=i.walk(s)),l})},n.walkAtRules=function(s,i){return i?Pr(s,RegExp)?this.walk(function(o,l){if(o.type==="atrule"&&s.test(o.name))return i(o,l)}):this.walk(function(o,l){if(o.type==="atrule"&&o.name===s)return i(o,l)}):(i=s,this.walk(function(o,l){if(o.type==="atrule")return i(o,l)}))},n.walkComments=function(s){return this.walk(function(i,o){if(i.type==="comment")return s(i,o)})},n.walkDecls=function(s,i){return i?Pr(s,RegExp)?this.walk(function(o,l){if(o.type==="decl"&&s.test(o.prop))return i(o,l)}):this.walk(function(o,l){if(o.type==="decl"&&o.prop===s)return i(o,l)}):(i=s,this.walk(function(o,l){if(o.type==="decl")return i(o,l)}))},n.walkRules=function(s,i){return i?Pr(s,RegExp)?this.walk(function(o,l){if(o.type==="rule"&&s.test(o.selector))return i(o,l)}):this.walk(function(o,l){if(o.type==="rule"&&o.selector===s)return i(o,l)}):(i=s,this.walk(function(o,l){if(o.type==="rule")return i(o,l)}))},uo(e,[{key:"first",get:function(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}},{key:"last",get:function(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}}]),e}(DYt);Yx.registerParse=function(t){vot=t};Yx.registerRule=function(t){NCe=t};Yx.registerAtRule=function(t){TCe=t};Yx.registerRoot=function(t){yot=t};var TE=Yx;Yx.default=Yx;Yx.rebuild=function(t){t.type==="atrule"?Object.setPrototypeOf(t,TCe.prototype):t.type==="rule"?Object.setPrototypeOf(t,NCe.prototype):t.type==="decl"?Object.setPrototypeOf(t,pot.prototype):t.type==="comment"?Object.setPrototypeOf(t,got.prototype):t.type==="root"&&Object.setPrototypeOf(t,yot.prototype),t[fot]=!0,t.nodes&&t.nodes.forEach(function(e){Yx.rebuild(e)})};var $Yt=TE,wot,kot,RO=function(t){Co(e,t);function e(r){var s;return s=t.call(this,Ps({type:"document"},r))||this,s.nodes||(s.nodes=[]),s}var n=e.prototype;return n.toResult=function(s){s===void 0&&(s={});var i=new wot(new kot,this,s);return i.stringify()},e}($Yt);RO.registerLazyResult=function(t){wot=t};RO.registerProcessor=function(t){kot=t};var _Ce=RO;RO.default=RO;var xpe=function(){function t(n,r){if(r===void 0&&(r={}),this.type="warning",this.text=n,r.node&&r.node.source){var s=r.node.rangeBy(r);this.line=s.start.line,this.column=s.start.column,this.endLine=s.end.line,this.endColumn=s.end.column}for(var i in r)this[i]=r[i]}var e=t.prototype;return e.toString=function(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text},t}(),Sot=xpe;xpe.default=xpe;var OYt=Sot,wpe=function(){function t(n,r,s){this.processor=n,this.messages=[],this.root=r,this.opts=s,this.css=void 0,this.map=void 0}var e=t.prototype;return e.toString=function(){return this.css},e.warn=function(r,s){s===void 0&&(s={}),s.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(s.plugin=this.lastPlugin.postcssPlugin);var i=new OYt(r,s);return this.messages.push(i),i},e.warnings=function(){return this.messages.filter(function(r){return r.type==="warning"})},uo(t,[{key:"content",get:function(){return this.css}}]),t}(),ACe=wpe;wpe.default=wpe;var Eoe=39,m4e=34,CU=92,f4e=47,jU=10,CL=32,EU=12,NU=9,TU=13,FYt=91,BYt=93,UYt=40,zYt=41,VYt=123,HYt=125,GYt=59,WYt=42,qYt=58,KYt=64,_U=/[\t\n\f\r "#'()/;[\\\]{}]/g,AU=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,YYt=/.[\r\n"'(/\\]/,p4e=/[\da-f]/i,QYt=function(e,n){n===void 0&&(n={});var r=e.css.valueOf(),s=n.ignoreErrors,i,o,l,c,d,u,h,m,f,p,g=r.length,v=0,b=[],x=[];function w(){return v}function k(E){throw e.error("Unclosed "+E,v)}function S(){return x.length===0&&v>=g}function C(E){if(x.length)return x.pop();if(!(v>=g)){var N=E?E.ignoreUnclosed:!1;switch(i=r.charCodeAt(v),i){case jU:case CL:case NU:case TU:case EU:{o=v;do o+=1,i=r.charCodeAt(o);while(i===CL||i===jU||i===NU||i===TU||i===EU);p=["space",r.slice(v,o)],v=o-1;break}case FYt:case BYt:case VYt:case HYt:case qYt:case GYt:case zYt:{var A=String.fromCharCode(i);p=[A,A,v];break}case UYt:{if(m=b.length?b.pop()[1]:"",f=r.charCodeAt(v+1),m==="url"&&f!==Eoe&&f!==m4e&&f!==CL&&f!==jU&&f!==NU&&f!==EU&&f!==TU){o=v;do{if(u=!1,o=r.indexOf(")",o+1),o===-1)if(s||N){o=v;break}else k("bracket");for(h=o;r.charCodeAt(h-1)===CU;)h-=1,u=!u}while(u);p=["brackets",r.slice(v,o+1),v,o],v=o}else o=r.indexOf(")",v+1),c=r.slice(v,o+1),o===-1||YYt.test(c)?p=["(","(",v]:(p=["brackets",c,v,o],v=o);break}case Eoe:case m4e:{l=i===Eoe?"'":'"',o=v;do{if(u=!1,o=r.indexOf(l,o+1),o===-1)if(s||N){o=v+1;break}else k("string");for(h=o;r.charCodeAt(h-1)===CU;)h-=1,u=!u}while(u);p=["string",r.slice(v,o+1),v,o],v=o;break}case KYt:{_U.lastIndex=v+1,_U.test(r),_U.lastIndex===0?o=r.length-1:o=_U.lastIndex-2,p=["at-word",r.slice(v,o+1),v,o],v=o;break}case CU:{for(o=v,d=!0;r.charCodeAt(o+1)===CU;)o+=1,d=!d;if(i=r.charCodeAt(o+1),d&&i!==f4e&&i!==CL&&i!==jU&&i!==NU&&i!==TU&&i!==EU&&(o+=1,p4e.test(r.charAt(o)))){for(;p4e.test(r.charAt(o+1));)o+=1;r.charCodeAt(o+1)===CL&&(o+=1)}p=["word",r.slice(v,o+1),v,o],v=o;break}default:{i===f4e&&r.charCodeAt(v+1)===WYt?(o=r.indexOf("*/",v+2)+1,o===0&&(s||N?o=r.length:k("comment")),p=["comment",r.slice(v,o+1),v,o],v=o):(AU.lastIndex=v+1,AU.test(r),AU.lastIndex===0?o=r.length-1:o=AU.lastIndex-2,p=["word",r.slice(v,o+1),v,o],b.push(p),v=o);break}}return v++,p}}function j(E){x.push(E)}return{back:j,endOfFile:S,nextToken:C,position:w}},Cot=TE,zK=function(t){Co(e,t);function e(r){var s;return s=t.call(this,r)||this,s.type="atrule",s}var n=e.prototype;return n.append=function(){for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];var l;return this.proxyOf.nodes||(this.nodes=[]),(l=t.prototype.append).call.apply(l,[].concat([this],i))},n.prepend=function(){for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];var l;return this.proxyOf.nodes||(this.nodes=[]),(l=t.prototype.prepend).call.apply(l,[].concat([this],i))},e}(Cot),PCe=zK;zK.default=zK;Cot.registerAtRule(zK);var jot=TE,Eot,Not,ZP=function(t){Co(e,t);function e(r){var s;return s=t.call(this,r)||this,s.type="root",s.nodes||(s.nodes=[]),s}var n=e.prototype;return n.normalize=function(s,i,o){var l=t.prototype.normalize.call(this,s);if(i){if(o==="prepend")this.nodes.length>1?i.raws.before=this.nodes[1].raws.before:delete i.raws.before;else if(this.first!==i)for(var c=on(l),d;!(d=c()).done;){var u=d.value;u.raws.before=i.raws.before}}return l},n.removeChild=function(s,i){var o=this.index(s);return!i&&o===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[o].raws.before),t.prototype.removeChild.call(this,s)},n.toResult=function(s){s===void 0&&(s={});var i=new Eot(new Not,this,s);return i.stringify()},e}(jot);ZP.registerLazyResult=function(t){Eot=t};ZP.registerProcessor=function(t){Not=t};var K8=ZP;ZP.default=ZP;jot.registerRoot(ZP);var IO={comma:function(e){return IO.split(e,[","],!0)},space:function(e){var n=[" ",`
`,"	"];return IO.split(e,n)},split:function(e,n,r){for(var s=[],i="",o=!1,l=0,c=!1,d="",u=!1,h=on(e),m;!(m=h()).done;){var f=m.value;u?u=!1:f==="\\"?u=!0:c?f===d&&(c=!1):f==='"'||f==="'"?(c=!0,d=f):f==="("?l+=1:f===")"?l>0&&(l-=1):l===0&&n.includes(f)&&(o=!0),o?(i!==""&&s.push(i.trim()),i="",o=!1):i+=f}return(r||i!=="")&&s.push(i.trim()),s}},Tot=IO;IO.default=IO;var _ot=TE,ZYt=Tot,VK=function(t){Co(e,t);function e(n){var r;return r=t.call(this,n)||this,r.type="rule",r.nodes||(r.nodes=[]),r}return uo(e,[{key:"selectors",get:function(){return ZYt.comma(this.selector)},set:function(r){var s=this.selector?this.selector.match(/,\s*/):null,i=s?s[0]:","+this.raw("between","beforeOpen");this.selector=r.join(i)}}]),e}(_ot),RCe=VK;VK.default=VK;_ot.registerRule(VK);var JYt=Lee,XYt=QYt,eQt=$ee,tQt=PCe,nQt=K8,g4e=RCe,v4e={empty:!0,space:!0};function rQt(t){for(var e=t.length-1;e>=0;e--){var n=t[e],r=n[3]||n[2];if(r)return r}}var sQt=function(){function t(n){this.input=n,this.root=new nQt,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:n,start:{column:1,line:1,offset:0}}}var e=t.prototype;return e.atrule=function(r){var s=new tQt;s.name=r[1].slice(1),s.name===""&&this.unnamedAtrule(s,r),this.init(s,r[2]);for(var i,o,l,c=!1,d=!1,u=[],h=[];!this.tokenizer.endOfFile();){if(r=this.tokenizer.nextToken(),i=r[0],i==="("||i==="["?h.push(i==="("?")":"]"):i==="{"&&h.length>0?h.push("}"):i===h[h.length-1]&&h.pop(),h.length===0)if(i===";"){s.source.end=this.getPosition(r[2]),s.source.end.offset++,this.semicolon=!0;break}else if(i==="{"){d=!0;break}else if(i==="}"){if(u.length>0){for(l=u.length-1,o=u[l];o&&o[0]==="space";)o=u[--l];o&&(s.source.end=this.getPosition(o[3]||o[2]),s.source.end.offset++)}this.end(r);break}else u.push(r);else u.push(r);if(this.tokenizer.endOfFile()){c=!0;break}}s.raws.between=this.spacesAndCommentsFromEnd(u),u.length?(s.raws.afterName=this.spacesAndCommentsFromStart(u),this.raw(s,"params",u),c&&(r=u[u.length-1],s.source.end=this.getPosition(r[3]||r[2]),s.source.end.offset++,this.spaces=s.raws.between,s.raws.between="")):(s.raws.afterName="",s.params=""),d&&(s.nodes=[],this.current=s)},e.checkMissedSemicolon=function(r){var s=this.colon(r);if(s!==!1){for(var i=0,o,l=s-1;l>=0&&(o=r[l],!(o[0]!=="space"&&(i+=1,i===2)));l--);throw this.input.error("Missed semicolon",o[0]==="word"?o[3]+1:o[2])}},e.colon=function(r){for(var s=0,i,o,l,c=on(r.entries()),d;!(d=c()).done;){var u=d.value,h=u[0],m=u[1];if(i=m,o=i[0],o==="("&&(s+=1),o===")"&&(s-=1),s===0&&o===":")if(!l)this.doubleColon(i);else{if(l[0]==="word"&&l[1]==="progid")continue;return h}l=i}return!1},e.comment=function(r){var s=new eQt;this.init(s,r[2]),s.source.end=this.getPosition(r[3]||r[2]),s.source.end.offset++;var i=r[1].slice(2,-2);if(/^\s*$/.test(i))s.text="",s.raws.left=i,s.raws.right="";else{var o=i.match(/^(\s*)([^]*\S)(\s*)$/);s.text=o[2],s.raws.left=o[1],s.raws.right=o[3]}},e.createTokenizer=function(){this.tokenizer=XYt(this.input)},e.decl=function(r,s){var i=new JYt;this.init(i,r[0][2]);var o=r[r.length-1];for(o[0]===";"&&(this.semicolon=!0,r.pop()),i.source.end=this.getPosition(o[3]||o[2]||rQt(r)),i.source.end.offset++;r[0][0]!=="word";)r.length===1&&this.unknownWord(r),i.raws.before+=r.shift()[1];for(i.source.start=this.getPosition(r[0][2]),i.prop="";r.length;){var l=r[0][0];if(l===":"||l==="space"||l==="comment")break;i.prop+=r.shift()[1]}i.raws.between="";for(var c;r.length;)if(c=r.shift(),c[0]===":"){i.raws.between+=c[1];break}else c[0]==="word"&&/\w/.test(c[1])&&this.unknownWord([c]),i.raws.between+=c[1];(i.prop[0]==="_"||i.prop[0]==="*")&&(i.raws.before+=i.prop[0],i.prop=i.prop.slice(1));for(var d=[],u;r.length&&(u=r[0][0],!(u!=="space"&&u!=="comment"));)d.push(r.shift());this.precheckMissedSemicolon(r);for(var h=r.length-1;h>=0;h--){if(c=r[h],c[1].toLowerCase()==="!important"){i.important=!0;var m=this.stringFrom(r,h);m=this.spacesFromEnd(r)+m,m!==" !important"&&(i.raws.important=m);break}else if(c[1].toLowerCase()==="important"){for(var f=r.slice(0),p="",g=h;g>0;g--){var v=f[g][0];if(p.trim().indexOf("!")===0&&v!=="space")break;p=f.pop()[1]+p}p.trim().indexOf("!")===0&&(i.important=!0,i.raws.important=p,r=f)}if(c[0]!=="space"&&c[0]!=="comment")break}var b=r.some(function(x){return x[0]!=="space"&&x[0]!=="comment"});b&&(i.raws.between+=d.map(function(x){return x[1]}).join(""),d=[]),this.raw(i,"value",d.concat(r),s),i.value.includes(":")&&!s&&this.checkMissedSemicolon(r)},e.doubleColon=function(r){throw this.input.error("Double colon",{offset:r[2]},{offset:r[2]+r[1].length})},e.emptyRule=function(r){var s=new g4e;this.init(s,r[2]),s.selector="",s.raws.between="",this.current=s},e.end=function(r){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(r[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(r)},e.endFile=function(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())},e.freeSemicolon=function(r){if(this.spaces+=r[1],this.current.nodes){var s=this.current.nodes[this.current.nodes.length-1];s&&s.type==="rule"&&!s.raws.ownSemicolon&&(s.raws.ownSemicolon=this.spaces,this.spaces="")}},e.getPosition=function(r){var s=this.input.fromOffset(r);return{column:s.col,line:s.line,offset:r}},e.init=function(r,s){this.current.push(r),r.source={input:this.input,start:this.getPosition(s)},r.raws.before=this.spaces,this.spaces="",r.type!=="comment"&&(this.semicolon=!1)},e.other=function(r){for(var s=!1,i=null,o=!1,l=null,c=[],d=r[1].startsWith("--"),u=[],h=r;h;){if(i=h[0],u.push(h),i==="("||i==="[")l||(l=h),c.push(i==="("?")":"]");else if(d&&o&&i==="{")l||(l=h),c.push("}");else if(c.length===0)if(i===";")if(o){this.decl(u,d);return}else break;else if(i==="{"){this.rule(u);return}else if(i==="}"){this.tokenizer.back(u.pop()),s=!0;break}else i===":"&&(o=!0);else i===c[c.length-1]&&(c.pop(),c.length===0&&(l=null));h=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(s=!0),c.length>0&&this.unclosedBracket(l),s&&o){if(!d)for(;u.length&&(h=u[u.length-1][0],!(h!=="space"&&h!=="comment"));)this.tokenizer.back(u.pop());this.decl(u,d)}else this.unknownWord(u)},e.parse=function(){for(var r;!this.tokenizer.endOfFile();)switch(r=this.tokenizer.nextToken(),r[0]){case"space":this.spaces+=r[1];break;case";":this.freeSemicolon(r);break;case"}":this.end(r);break;case"comment":this.comment(r);break;case"at-word":this.atrule(r);break;case"{":this.emptyRule(r);break;default:this.other(r);break}this.endFile()},e.precheckMissedSemicolon=function(){},e.raw=function(r,s,i,o){for(var l,c,d=i.length,u="",h=!0,m,f,p=0;p<d;p+=1)l=i[p],c=l[0],c==="space"&&p===d-1&&!o?h=!1:c==="comment"?(f=i[p-1]?i[p-1][0]:"empty",m=i[p+1]?i[p+1][0]:"empty",!v4e[f]&&!v4e[m]?u.slice(-1)===","?h=!1:u+=l[1]:h=!1):u+=l[1];if(!h){var g=i.reduce(function(v,b){return v+b[1]},"");r.raws[s]={raw:g,value:u}}r[s]=u},e.rule=function(r){r.pop();var s=new g4e;this.init(s,r[0][2]),s.raws.between=this.spacesAndCommentsFromEnd(r),this.raw(s,"selector",r),this.current=s},e.spacesAndCommentsFromEnd=function(r){for(var s,i="";r.length&&(s=r[r.length-1][0],!(s!=="space"&&s!=="comment"));)i=r.pop()[1]+i;return i},e.spacesAndCommentsFromStart=function(r){for(var s,i="";r.length&&(s=r[0][0],!(s!=="space"&&s!=="comment"));)i+=r.shift()[1];return i},e.spacesFromEnd=function(r){for(var s,i="";r.length&&(s=r[r.length-1][0],s==="space");)i=r.pop()[1]+i;return i},e.stringFrom=function(r,s){for(var i="",o=s;o<r.length;o++)i+=r[o][1];return r.splice(s,r.length-s),i},e.unclosedBlock=function(){var r=this.current.source.start;throw this.input.error("Unclosed block",r.line,r.column)},e.unclosedBracket=function(r){throw this.input.error("Unclosed bracket",{offset:r[2]},{offset:r[2]+1})},e.unexpectedClose=function(r){throw this.input.error("Unexpected }",{offset:r[2]},{offset:r[2]+1})},e.unknownWord=function(r){throw this.input.error("Unknown word",{offset:r[0][2]},{offset:r[0][2]+r[0][1].length})},e.unnamedAtrule=function(r,s){throw this.input.error("At-rule without name",{offset:s[2]},{offset:s[2]+s[1].length})},t}(),iQt=sQt,aQt=TE,oQt=iQt,lQt=Dee;function HK(t,e){var n=new lQt(t,e),r=new oQt(n);try{r.parse()}catch(s){throw s}return r.root}var ICe=HK;HK.default=HK;aQt.registerParse(HK);var bv=lS.isClean,cQt=lS.my,dQt=hot,uQt=Iee,hQt=TE,mQt=_Ce,y4e=ACe,fQt=ICe,pQt=K8,gQt={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},vQt={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},yQt={Once:!0,postcssPlugin:!0,prepare:!0},JP=0;function jL(t){return(typeof t>"u"?"undefined":Ir(t))==="object"&&typeof t.then=="function"}function Aot(t){var e=!1,n=gQt[t.type];return t.type==="decl"?e=t.prop.toLowerCase():t.type==="atrule"&&(e=t.name.toLowerCase()),e&&t.append?[n,n+"-"+e,JP,n+"Exit",n+"Exit-"+e]:e?[n,n+"-"+e,n+"Exit",n+"Exit-"+e]:t.append?[n,JP,n+"Exit"]:[n,n+"Exit"]}function b4e(t){var e;return t.type==="document"?e=["Document",JP,"DocumentExit"]:t.type==="root"?e=["Root",JP,"RootExit"]:e=Aot(t),{eventIndex:0,events:e,iterator:0,node:t,visitorIndex:0,visitors:[]}}function kpe(t){return t[bv]=!1,t.nodes&&t.nodes.forEach(function(e){return kpe(e)}),t}var Spe={},XP=function(){function t(n,r,s){var i=this;this.stringified=!1,this.processed=!1;var o;if((typeof r>"u"?"undefined":Ir(r))==="object"&&r!==null&&(r.type==="root"||r.type==="document"))o=kpe(r);else if(Pr(r,t)||Pr(r,y4e))o=kpe(r.root),r.map&&(typeof s.map>"u"&&(s.map={}),s.map.inline||(s.map.inline=!1),s.map.prev=r.map);else{var l=fQt;s.syntax&&(l=s.syntax.parse),s.parser&&(l=s.parser),l.parse&&(l=l.parse);try{o=l(r,s)}catch(c){this.processed=!0,this.error=c}o&&!o[cQt]&&hQt.rebuild(o)}this.result=new y4e(n,o,s),this.helpers=Ps({},Spe,{postcss:Spe,result:this.result}),this.plugins=this.processor.plugins.map(function(c){return(typeof c>"u"?"undefined":Ir(c))==="object"&&c.prepare?Ps({},c,c.prepare(i.result)):c})}var e=t.prototype;return e.async=function(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)},e.catch=function(r){return this.async().catch(r)},e.finally=function(r){return this.async().then(r,r)},e.getAsyncError=function(){throw new Error("Use process(css).then(cb) to work with async plugins")},e.handleError=function(r,s){var i=this.result.lastPlugin;try{if(s&&s.addToError(r),this.error=r,r.name==="CssSyntaxError"&&!r.plugin)r.plugin=i.postcssPlugin,r.setMessage();else if(i.postcssVersion)var o,l,c,d,u}catch(h){console&&console.error&&console.error(h)}return r},e.prepareVisitors=function(){var r=this;this.listeners={};for(var s=function(u,h,m){r.listeners[h]||(r.listeners[h]=[]),r.listeners[h].push([u,m])},i=on(this.plugins),o;!(o=i()).done;){var l=o.value;if((typeof l>"u"?"undefined":Ir(l))==="object")for(var c in l){if(!vQt[c]&&/^[A-Z]/.test(c))throw new Error("Unknown event "+c+" in "+l.postcssPlugin+". Try to update PostCSS ("+this.processor.version+" now).");if(!yQt[c])if(Ir(l[c])==="object")for(var d in l[c])d==="*"?s(l,c,l[c][d]):s(l,c+"-"+d.toLowerCase(),l[c][d]);else typeof l[c]=="function"&&s(l,c,l[c])}}this.hasListener=Object.keys(this.listeners).length>0},e.runAsync=function(){var r=this;return Nee(function(){var s,i,o,l,c,d,u,h,m,f,p,g;return T2(this,function(v){switch(v.label){case 0:r.plugin=0,s=0,v.label=1;case 1:if(!(s<r.plugins.length))return[3,6];if(i=r.plugins[s],o=r.runOnRoot(i),!jL(o))return[3,5];v.label=2;case 2:return v.trys.push([2,4,,5]),[4,o];case 3:return v.sent(),[3,5];case 4:throw l=v.sent(),r.handleError(l);case 5:return s++,[3,1];case 6:if(r.prepareVisitors(),!r.hasListener)return[3,18];c=r.result.root,v.label=7;case 7:if(c[bv])return[3,14];c[bv]=!0,d=[b4e(c)],v.label=8;case 8:if(!(d.length>0))return[3,13];if(u=r.visitTick(d),!jL(u))return[3,12];v.label=9;case 9:return v.trys.push([9,11,,12]),[4,u];case 10:return v.sent(),[3,12];case 11:throw h=v.sent(),m=d[d.length-1].node,r.handleError(h,m);case 12:return[3,8];case 13:return[3,7];case 14:if(!r.listeners.OnceExit)return[3,18];f=function(){var b,x,w,k,S;return T2(this,function(C){switch(C.label){case 0:b=g.value,x=b[0],w=b[1],r.result.lastPlugin=x,C.label=1;case 1:return C.trys.push([1,6,,7]),c.type!=="document"?[3,3]:(k=c.nodes.map(function(j){return w(j,r.helpers)}),[4,Promise.all(k)]);case 2:return C.sent(),[3,5];case 3:return[4,w(c,r.helpers)];case 4:C.sent(),C.label=5;case 5:return[3,7];case 6:throw S=C.sent(),r.handleError(S);case 7:return[2]}})},p=on(r.listeners.OnceExit),v.label=15;case 15:return(g=p()).done?[3,18]:[5,hCe(f())];case 16:v.sent(),v.label=17;case 17:return[3,15];case 18:return r.processed=!0,[2,r.stringify()]}})})()},e.runOnRoot=function(r){var s=this;this.result.lastPlugin=r;try{if((typeof r>"u"?"undefined":Ir(r))==="object"&&r.Once){if(this.result.root.type==="document"){var i=this.result.root.nodes.map(function(o){return r.Once(o,s.helpers)});return jL(i[0])?Promise.all(i):i}return r.Once(this.result.root,this.helpers)}else if(typeof r=="function")return r(this.result.root,this.result)}catch(o){throw this.handleError(o)}},e.stringify=function(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();var r=this.result.opts,s=uQt;r.syntax&&(s=r.syntax.stringify),r.stringifier&&(s=r.stringifier),s.stringify&&(s=s.stringify);var i=new dQt(s,this.result.root,this.result.opts),o=i.generate();return this.result.css=o[0],this.result.map=o[1],this.result},e.sync=function(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(var r=on(this.plugins),s;!(s=r()).done;){var i=s.value,o=this.runOnRoot(i);if(jL(o))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){for(var l=this.result.root;!l[bv];)l[bv]=!0,this.walkSync(l);if(this.listeners.OnceExit)if(l.type==="document")for(var c=on(l.nodes),d;!(d=c()).done;){var u=d.value;this.visitSync(this.listeners.OnceExit,u)}else this.visitSync(this.listeners.OnceExit,l)}return this.result},e.then=function(r,s){return this.async().then(r,s)},e.toString=function(){return this.css},e.visitSync=function(r,s){for(var i=on(r),o;!(o=i()).done;){var l=o.value,c=l[0],d=l[1];this.result.lastPlugin=c;var u=void 0;try{u=d(s,this.helpers)}catch(h){throw this.handleError(h,s.proxyOf)}if(s.type!=="root"&&s.type!=="document"&&!s.parent)return!0;if(jL(u))throw this.getAsyncError()}},e.visitTick=function(r){var s=r[r.length-1],i=s.node,o=s.visitors;if(i.type!=="root"&&i.type!=="document"&&!i.parent){r.pop();return}if(o.length>0&&s.visitorIndex<o.length){var l=o[s.visitorIndex],c=l[0],d=l[1];s.visitorIndex+=1,s.visitorIndex===o.length&&(s.visitors=[],s.visitorIndex=0),this.result.lastPlugin=c;try{return d(i.toProxy(),this.helpers)}catch(p){throw this.handleError(p,i)}}if(s.iterator!==0){for(var u=s.iterator,h;h=i.nodes[i.indexes[u]];)if(i.indexes[u]+=1,!h[bv]){h[bv]=!0,r.push(b4e(h));return}s.iterator=0,delete i.indexes[u]}for(var m=s.events;s.eventIndex<m.length;){var f=m[s.eventIndex];if(s.eventIndex+=1,f===JP){i.nodes&&i.nodes.length&&(i[bv]=!0,s.iterator=i.getIterator());return}else if(this.listeners[f]){s.visitors=this.listeners[f];return}}r.pop()},e.walkSync=function(r){var s=this;r[bv]=!0;for(var i=Aot(r),o=on(i),l;!(l=o()).done;){var c=l.value;if(c===JP)r.nodes&&r.each(function(u){u[bv]||s.walkSync(u)});else{var d=this.listeners[c];if(d&&this.visitSync(d,r.toProxy()))return}}},e.warnings=function(){return this.sync().warnings()},uo(t,[{key:"content",get:function(){return this.stringify().content}},{key:"css",get:function(){return this.stringify().css}},{key:"map",get:function(){return this.stringify().map}},{key:"messages",get:function(){return this.sync().messages}},{key:"opts",get:function(){return this.result.opts}},{key:"processor",get:function(){return this.result.processor}},{key:"root",get:function(){return this.sync().root}},{key:Symbol.toStringTag,get:function(){return"LazyResult"}}]),t}();XP.registerPostcss=function(t){Spe=t};var Pot=XP;XP.default=XP;pQt.registerLazyResult(XP);mQt.registerLazyResult(XP);var bQt=hot,xQt=Iee,wQt=ICe,kQt=ACe,Cpe=function(){function t(n,r,s){r=r.toString(),this.stringified=!1,this._processor=n,this._css=r,this._opts=s,this._map=void 0;var i,o=xQt;this.result=new kQt(this._processor,i,this._opts),this.result.css=r;var l=this;Object.defineProperty(this.result,"root",{get:function(){return l.root}});var c=new bQt(o,i,this._opts,r);if(c.isMap()){var d=c.generate(),u=d[0],h=d[1];u&&(this.result.css=u),h&&(this.result.map=h)}else c.clearAnnotation(),this.result.css=c.css}var e=t.prototype;return e.async=function(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)},e.catch=function(r){return this.async().catch(r)},e.finally=function(r){return this.async().then(r,r)},e.sync=function(){if(this.error)throw this.error;return this.result},e.then=function(r,s){return this.async().then(r,s)},e.toString=function(){return this._css},e.warnings=function(){return[]},uo(t,[{key:"content",get:function(){return this.result.css}},{key:"css",get:function(){return this.result.css}},{key:"map",get:function(){return this.result.map}},{key:"messages",get:function(){return[]}},{key:"opts",get:function(){return this.result.opts}},{key:"processor",get:function(){return this.result.processor}},{key:"root",get:function(){if(this._root)return this._root;var r,s=wQt;try{r=s(this._css,this._opts)}catch(i){this.error=i}if(this.error)throw this.error;return this._root=r,r}},{key:Symbol.toStringTag,get:function(){return"NoWorkResult"}}]),t}(),SQt=Cpe;Cpe.default=Cpe;var CQt=SQt,jQt=Pot,EQt=_Ce,NQt=K8,MO=function(){function t(n){n===void 0&&(n=[]),this.version="8.4.38",this.plugins=this.normalize(n)}var e=t.prototype;return e.normalize=function(r){for(var s=[],i=on(r),o;!(o=i()).done;){var l=o.value;if(l.postcss===!0?l=l():l.postcss&&(l=l.postcss),(typeof l>"u"?"undefined":Ir(l))==="object"&&Array.isArray(l.plugins))s=s.concat(l.plugins);else if((typeof l>"u"?"undefined":Ir(l))==="object"&&l.postcssPlugin)s.push(l);else if(typeof l=="function")s.push(l);else if(!((typeof l>"u"?"undefined":Ir(l))==="object"&&(l.parse||l.stringify)))throw new Error(l+" is not a PostCSS plugin")}return s},e.process=function(r,s){return s===void 0&&(s={}),!this.plugins.length&&!s.parser&&!s.stringifier&&!s.syntax?new CQt(this,r,s):new jQt(this,r,s)},e.use=function(r){return this.plugins=this.plugins.concat(this.normalize([r])),this},t}(),TQt=MO;MO.default=MO;NQt.registerProcessor(MO);EQt.registerProcessor(MO);var _Qt=Lee,AQt=oot,PQt=$ee,RQt=PCe,IQt=Dee,MQt=K8,LQt=RCe;function LO(t,e){if(Array.isArray(t))return t.map(function(h){return LO(h)});var n=t.inputs,r=N2(t,["inputs"]);if(n){e=[];for(var s=on(n),i;!(i=s()).done;){var o=i.value,l=Ps({},o,{__proto__:IQt.prototype});l.map&&(l.map=Ps({},l.map,{__proto__:AQt.prototype})),e.push(l)}}if(r.nodes&&(r.nodes=t.nodes.map(function(h){return LO(h,e)})),r.source){var c=r.source,d=c.inputId,u=N2(c,["inputId"]);r.source=u,d!=null&&(r.source.input=e[d])}if(r.type==="root")return new MQt(r);if(r.type==="decl")return new _Qt(r);if(r.type==="rule")return new LQt(r);if(r.type==="comment")return new PQt(r);if(r.type==="atrule")return new RQt(r);throw new Error("Unknown node type: "+t.type)}var DQt=LO;LO.default=LO;var $Qt=ECe,Rot=Lee,OQt=Pot,FQt=TE,MCe=TQt,BQt=Iee,UQt=DQt,Iot=_Ce,zQt=Sot,Mot=$ee,Lot=PCe,VQt=ACe,HQt=Dee,GQt=ICe,WQt=Tot,Dot=RCe,$ot=K8,qQt=Mee;function Wi(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new MCe(e)}Wi.plugin=function(e,n){var r=!1;function s(){for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];console&&console.warn&&!r&&(r=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration`),qP.LANG&&qP.LANG.startsWith("cn")&&console.warn(e+`: 里面 postcss.plugin 被弃用. 迁移指南:
https://www.w3ctech.com/topic/2226`));var d=n.apply(void 0,[].concat(l));return d.postcssPlugin=e,d.postcssVersion=new MCe().version,d}var i;return Object.defineProperty(s,"postcss",{get:function(){return i||(i=s()),i}}),s.process=function(o,l,c){return Wi([s(c)]).process(o,l)},s};Wi.stringify=BQt;Wi.parse=GQt;Wi.fromJSON=UQt;Wi.list=WQt;Wi.comment=function(t){return new Mot(t)};Wi.atRule=function(t){return new Lot(t)};Wi.decl=function(t){return new Rot(t)};Wi.rule=function(t){return new Dot(t)};Wi.root=function(t){return new $ot(t)};Wi.document=function(t){return new Iot(t)};Wi.CssSyntaxError=$Qt;Wi.Declaration=Rot;Wi.Container=FQt;Wi.Processor=MCe;Wi.Document=Iot;Wi.Comment=Mot;Wi.Warning=zQt;Wi.AtRule=Lot;Wi.Result=VQt;Wi.Input=HQt;Wi.Rule=Dot;Wi.Root=$ot;Wi.Node=qQt;OQt.registerPostcss(Wi);var KQt=Wi;Wi.default=Wi;var Eo=oYt(KQt);Eo.stringify;Eo.fromJSON;Eo.plugin;Eo.parse;Eo.list;Eo.document;Eo.comment;Eo.atRule;Eo.rule;Eo.decl;Eo.root;Eo.CssSyntaxError;Eo.Declaration;Eo.Container;Eo.Processor;Eo.Document;Eo.Comment;Eo.Warning;Eo.AtRule;Eo.Result;Eo.Input;Eo.Rule;Eo.Root;Eo.Node;var YQt=function(){function t(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];zm(this,"parentElement",null),zm(this,"parentNode",null),zm(this,"ownerDocument"),zm(this,"firstChild",null),zm(this,"lastChild",null),zm(this,"previousSibling",null),zm(this,"nextSibling",null),zm(this,"ELEMENT_NODE",1),zm(this,"TEXT_NODE",3),zm(this,"nodeType"),zm(this,"nodeName"),zm(this,"RRNodeType")}var e=t.prototype;return e.contains=function(r){if(Pr(r,t)){if(r.ownerDocument!==this.ownerDocument)return!1;if(r===this)return!0}else return!1;for(;r.parentNode;){if(r.parentNode===this)return!0;r=r.parentNode}return!1},e.appendChild=function(r){throw new Error("RRDomException: Failed to execute 'appendChild' on 'RRNode': This RRNode type does not support this method.")},e.insertBefore=function(r,s){throw new Error("RRDomException: Failed to execute 'insertBefore' on 'RRNode': This RRNode type does not support this method.")},e.removeChild=function(r){throw new Error("RRDomException: Failed to execute 'removeChild' on 'RRNode': This RRNode type does not support this method.")},e.toString=function(){return"RRNode"},uo(t,[{key:"childNodes",get:function(){for(var r=[],s=this.firstChild;s;)r.push(s),s=s.nextSibling;return r}}]),t}(),x4e={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},w4e={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},PU={},QQt=function(){return!!globalThis.Zone};function LCe(t){if(PU[t])return PU[t];var e=globalThis[t],n=e.prototype,r=t in x4e?x4e[t]:void 0,s=!!(r&&r.every(function(u){var h,m;return!!((m=(h=Object.getOwnPropertyDescriptor(n,u))==null?void 0:h.get)!=null&&m.toString().includes("[native code]"))})),i=t in w4e?w4e[t]:void 0,o=!!(i&&i.every(function(u){var h;return typeof n[u]=="function"&&((h=n[u])==null?void 0:h.toString().includes("[native code]"))}));if(s&&o&&!QQt())return PU[t]=e.prototype,e.prototype;try{var l=document.createElement("iframe");document.body.appendChild(l);var c=l.contentWindow;if(!c)return e.prototype;var d=c[t].prototype;return document.body.removeChild(l),d?PU[t]=d:n}catch{return n}}var Noe={};function cS(t,e,n){var r,s=t+"."+String(n);if(Noe[s])return Noe[s].call(e);var i=LCe(t),o=(r=Object.getOwnPropertyDescriptor(i,n))==null?void 0:r.get;return o?(Noe[s]=o,o.call(e)):e[n]}var Toe={};function Oot(t,e,n){var r=t+"."+String(n);if(Toe[r])return Toe[r].bind(e);var s=LCe(t),i=s[n];return typeof i!="function"?e[n]:(Toe[r]=i,i.bind(e))}function ZQt(t){return cS("Node",t,"childNodes")}function JQt(t){return cS("Node",t,"parentNode")}function XQt(t){return cS("Node",t,"parentElement")}function eZt(t){return cS("Node",t,"textContent")}function tZt(t,e){return Oot("Node",t,"contains")(e)}function nZt(t){return Oot("Node",t,"getRootNode")()}function rZt(t){return!t||!("host"in t)?null:cS("ShadowRoot",t,"host")}function sZt(t){return t.styleSheets}function iZt(t){return!t||!("shadowRoot"in t)?null:cS("Element",t,"shadowRoot")}function aZt(t,e){return cS("Element",t,"querySelector")(e)}function oZt(t,e){return cS("Element",t,"querySelectorAll")(e)}function Fot(){return LCe("MutationObserver").constructor}function _E(t,e,n){try{if(!(e in t))return function(){};var r=t[e],s=n(r);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:r}})),t[e]=s,function(){t[e]=r}}catch{return function(){}}}var ei={childNodes:ZQt,parentNode:JQt,parentElement:XQt,textContent:eZt,contains:tZt,getRootNode:nZt,host:rZt,styleSheets:sZt,shadowRoot:iZt,querySelector:aZt,querySelectorAll:oZt,mutationObserver:Fot,patch:_E};function Su(t,e,n){n===void 0&&(n=document);var r={capture:!0,passive:!0};return n.addEventListener(t,e,r),function(){return n.removeEventListener(t,e,r)}}var QT=`Please stop import mirror directly. Instead of that,\r
now you can use replayer.getMirror() to access the mirror instance of a replayer,\r
or you can use record.mirror to access the mirror instance during recording.`,k4e={map:{},getId:function(){return console.error(QT),-1},getNode:function(){return console.error(QT),null},removeNodeFromMap:function(){console.error(QT)},has:function(){return console.error(QT),!1},reset:function(){console.error(QT)}};typeof window<"u"&&window.Proxy&&window.Reflect&&(k4e=new Proxy(k4e,{get:function(e,n,r){return n==="map"&&console.error(QT),Reflect.get(e,n,r)}}));function DO(t,e,n){n===void 0&&(n={});var r=null,s=0;return function(){for(var i=arguments.length,o=new Array(i),l=0;l<i;l++)o[l]=arguments[l];var c=Date.now();!s&&n.leading===!1&&(s=c);var d=e-(c-s),u=this;d<=0||d>e?(r&&(clearTimeout(r),r=null),s=c,t.apply(u,o)):!r&&n.trailing!==!1&&(r=setTimeout(function(){s=n.leading===!1?0:Date.now(),r=null,t.apply(u,o)},d))}}function Oee(t,e,n,r,s){s===void 0&&(s=window);var i=s.Object.getOwnPropertyDescriptor(t,e);return s.Object.defineProperty(t,e,r?n:{set:function(l){var c=this;setTimeout(function(){n.set.call(c,l)},0),i&&i.set&&i.set.call(this,l)}}),function(){return Oee(t,e,i||{},!0)}}var GK=Date.now;/[1-9][0-9]{12}/.test(Date.now().toString())||(GK=function(){return new Date().getTime()});function Bot(t){var e,n,r,s,i=t.document;return{left:i.scrollingElement?i.scrollingElement.scrollLeft:t.pageXOffset!==void 0?t.pageXOffset:i.documentElement.scrollLeft||(i==null?void 0:i.body)&&((e=ei.parentElement(i.body))==null?void 0:e.scrollLeft)||((n=i==null?void 0:i.body)==null?void 0:n.scrollLeft)||0,top:i.scrollingElement?i.scrollingElement.scrollTop:t.pageYOffset!==void 0?t.pageYOffset:(i==null?void 0:i.documentElement.scrollTop)||(i==null?void 0:i.body)&&((r=ei.parentElement(i.body))==null?void 0:r.scrollTop)||((s=i==null?void 0:i.body)==null?void 0:s.scrollTop)||0}}function Uot(){return window.innerHeight||document.documentElement&&document.documentElement.clientHeight||document.body&&document.body.clientHeight}function zot(){return window.innerWidth||document.documentElement&&document.documentElement.clientWidth||document.body&&document.body.clientWidth}function Vot(t){if(!t)return null;var e=t.nodeType===t.ELEMENT_NODE?t:ei.parentElement(t);return e}function Cu(t,e,n,r){if(!t)return!1;var s=Vot(t);if(!s)return!1;try{if(typeof e=="string"){if(s.classList.contains(e)||r&&s.closest("."+e)!==null)return!0}else if(DK(s,e,r))return!0}catch{}return!!(n&&(s.matches(n)||r&&s.closest(n)!==null))}function lZt(t,e){return e.getId(t)!==-1}function _oe(t,e,n){return t.tagName==="TITLE"&&n.headTitleMutations?!0:e.getId(t)===NO}function Hot(t,e){if(SD(t))return!1;var n=e.getId(t);if(!e.has(n))return!0;var r=ei.parentNode(t);return r&&r.nodeType===t.DOCUMENT_NODE?!1:r?Hot(r,e):!0}function jpe(t){return!!t.changedTouches}function cZt(t){t===void 0&&(t=window),"NodeList"in t&&!t.NodeList.prototype.forEach&&(t.NodeList.prototype.forEach=Array.prototype.forEach),"DOMTokenList"in t&&!t.DOMTokenList.prototype.forEach&&(t.DOMTokenList.prototype.forEach=Array.prototype.forEach)}function Got(t,e){return!!(t.nodeName==="IFRAME"&&e.getMeta(t))}function Wot(t,e){return!!(t.nodeName==="LINK"&&t.nodeType===t.ELEMENT_NODE&&t.getAttribute&&t.getAttribute("rel")==="stylesheet"&&e.getMeta(t))}function Epe(t){return t?Pr(t,YQt)&&"shadowRoot"in t?!!t.shadowRoot:!!ei.shadowRoot(t):!1}var dZt=function(){function t(){En(this,"id",1),En(this,"styleIDMap",new WeakMap),En(this,"idStyleMap",new Map)}var e=t.prototype;return e.getId=function(r){var s;return(s=this.styleIDMap.get(r))!=null?s:-1},e.has=function(r){return this.styleIDMap.has(r)},e.add=function(r,s){if(this.has(r))return this.getId(r);var i;return s===void 0?i=this.id++:i=s,this.styleIDMap.set(r,i),this.idStyleMap.set(i,r),i},e.getStyle=function(r){return this.idStyleMap.get(r)||null},e.reset=function(){this.styleIDMap=new WeakMap,this.idStyleMap=new Map,this.id=1},e.generateId=function(){return this.id++},e.remove=function(r){var s=this.styleIDMap.get(r);return s!==void 0?(this.styleIDMap.delete(r),this.idStyleMap.delete(s),!0):!1},t}();function qot(t){var e,n=null;return"getRootNode"in t&&((e=ei.getRootNode(t))==null?void 0:e.nodeType)===Node.DOCUMENT_FRAGMENT_NODE&&ei.host(ei.getRootNode(t))&&(n=ei.host(ei.getRootNode(t))),n}function uZt(t){for(var e=t,n;n=qot(e);)e=n;return e}function hZt(t){var e=t.ownerDocument;if(!e)return!1;var n=uZt(t);return ei.contains(e,n)}function Kot(t){var e=t.ownerDocument;return e?ei.contains(e,t)||hZt(t):!1}var ri=function(t){return t[t.DomContentLoaded=0]="DomContentLoaded",t[t.Load=1]="Load",t[t.FullSnapshot=2]="FullSnapshot",t[t.IncrementalSnapshot=3]="IncrementalSnapshot",t[t.Meta=4]="Meta",t[t.Custom=5]="Custom",t[t.Plugin=6]="Plugin",t}(ri||{}),ps=function(t){return t[t.Mutation=0]="Mutation",t[t.MouseMove=1]="MouseMove",t[t.MouseInteraction=2]="MouseInteraction",t[t.Scroll=3]="Scroll",t[t.ViewportResize=4]="ViewportResize",t[t.Input=5]="Input",t[t.TouchMove=6]="TouchMove",t[t.MediaInteraction=7]="MediaInteraction",t[t.StyleSheetRule=8]="StyleSheetRule",t[t.CanvasMutation=9]="CanvasMutation",t[t.Font=10]="Font",t[t.Log=11]="Log",t[t.Drag=12]="Drag",t[t.StyleDeclaration=13]="StyleDeclaration",t[t.Selection=14]="Selection",t[t.AdoptedStyleSheet=15]="AdoptedStyleSheet",t[t.CustomElement=16]="CustomElement",t}(ps||{}),Wu=function(t){return t[t.MouseUp=0]="MouseUp",t[t.MouseDown=1]="MouseDown",t[t.Click=2]="Click",t[t.ContextMenu=3]="ContextMenu",t[t.DblClick=4]="DblClick",t[t.Focus=5]="Focus",t[t.Blur=6]="Blur",t[t.TouchStart=7]="TouchStart",t[t.TouchMove_Departed=8]="TouchMove_Departed",t[t.TouchEnd=9]="TouchEnd",t[t.TouchCancel=10]="TouchCancel",t}(Wu||{}),Tb=function(t){return t[t.Mouse=0]="Mouse",t[t.Pen=1]="Pen",t[t.Touch=2]="Touch",t}(Tb||{}),eR=function(t){return t[t["2D"]=0]="2D",t[t.WebGL=1]="WebGL",t[t.WebGL2=2]="WebGL2",t}(eR||{}),ZT=function(t){return t[t.Play=0]="Play",t[t.Pause=1]="Pause",t[t.Seeked=2]="Seeked",t[t.VolumeChange=3]="VolumeChange",t[t.RateChange=4]="RateChange",t}(ZT||{}),Yot=function(t){return t[t.Document=0]="Document",t[t.DocumentType=1]="DocumentType",t[t.Element=2]="Element",t[t.Text=3]="Text",t[t.CDATA=4]="CDATA",t[t.Comment=5]="Comment",t}(Yot||{});function S4e(t){return"__ln"in t}var mZt=function(){function t(){En(this,"length",0),En(this,"head",null),En(this,"tail",null)}var e=t.prototype;return e.get=function(r){if(r>=this.length)throw new Error("Position outside of list range");for(var s=this.head,i=0;i<r;i++)s=(s==null?void 0:s.next)||null;return s},e.addNode=function(r){var s={value:r,previous:null,next:null};if(r.__ln=s,r.previousSibling&&S4e(r.previousSibling)){var i=r.previousSibling.__ln.next;s.next=i,s.previous=r.previousSibling.__ln,r.previousSibling.__ln.next=s,i&&(i.previous=s)}else if(r.nextSibling&&S4e(r.nextSibling)&&r.nextSibling.__ln.previous){var o=r.nextSibling.__ln.previous;s.previous=o,s.next=r.nextSibling.__ln,r.nextSibling.__ln.previous=s,o&&(o.next=s)}else this.head&&(this.head.previous=s),s.next=this.head,this.head=s;s.next===null&&(this.tail=s),this.length++},e.removeNode=function(r){var s=r.__ln;this.head&&(s.previous?(s.previous.next=s.next,s.next?s.next.previous=s.previous:this.tail=s.previous):(this.head=s.next,this.head?this.head.previous=null:this.tail=null),r.__ln&&delete r.__ln,this.length--)},t}(),C4e=function(t,e){return t+"@"+e},fZt=function(){function t(){var n=this;En(this,"frozen",!1),En(this,"locked",!1),En(this,"texts",[]),En(this,"attributes",[]),En(this,"attributeMap",new WeakMap),En(this,"removes",[]),En(this,"mapRemoves",[]),En(this,"movedMap",{}),En(this,"addedSet",new Set),En(this,"movedSet",new Set),En(this,"droppedSet",new Set),En(this,"removesSubTreeCache",new Set),En(this,"mutationCb"),En(this,"blockClass"),En(this,"blockSelector"),En(this,"maskTextClass"),En(this,"maskTextSelector"),En(this,"inlineStylesheet"),En(this,"maskInputOptions"),En(this,"maskTextFn"),En(this,"maskInputFn"),En(this,"keepIframeSrcFn"),En(this,"recordCanvas"),En(this,"inlineImages"),En(this,"slimDOMOptions"),En(this,"dataURLOptions"),En(this,"doc"),En(this,"mirror"),En(this,"iframeManager"),En(this,"stylesheetManager"),En(this,"shadowDomManager"),En(this,"canvasManager"),En(this,"processedNodeManager"),En(this,"unattachedDoc"),En(this,"processMutations",function(r){r.forEach(n.processMutation),n.emit()}),En(this,"emit",function(){if(!(n.frozen||n.locked)){for(var r=[],s=new Set,i=new mZt,o=function(T){for(var R=T,O=NO;O===NO;)R=R&&R.nextSibling,O=R&&n.mirror.getId(R);return O},l=function(T){var R=ei.parentNode(T);if(!(!R||!Kot(T))){var O=!1;if(T.nodeType===Node.TEXT_NODE){var F=R.tagName;if(F==="TEXTAREA")return;F==="STYLE"&&n.addedSet.has(R)&&(O=!0)}var D=SD(R)?n.mirror.getId(qot(T)):n.mirror.getId(R),I=o(T);if(D===-1||I===-1)return i.addNode(T);var P=nA(T,{doc:n.doc,mirror:n.mirror,blockClass:n.blockClass,blockSelector:n.blockSelector,maskTextClass:n.maskTextClass,maskTextSelector:n.maskTextSelector,skipChild:!0,newlyAddedElement:!0,inlineStylesheet:n.inlineStylesheet,maskInputOptions:n.maskInputOptions,maskTextFn:n.maskTextFn,maskInputFn:n.maskInputFn,slimDOMOptions:n.slimDOMOptions,dataURLOptions:n.dataURLOptions,recordCanvas:n.recordCanvas,inlineImages:n.inlineImages,onSerialize:function(M){Got(M,n.mirror)&&n.iframeManager.addIframe(M),Wot(M,n.mirror)&&n.stylesheetManager.trackLinkElement(M),Epe(T)&&n.shadowDomManager.addShadowRoot(ei.shadowRoot(T),n.doc)},onIframeLoad:function(M,z){n.iframeManager.attachIframe(M,z),n.shadowDomManager.observeAttachShadow(M)},onStylesheetLoad:function(M,z){n.stylesheetManager.attachLinkElement(M,z)},cssCaptured:O});P&&(r.push({parentId:D,nextId:I,node:P}),s.add(P.id))}};n.mapRemoves.length;){var c=n.mapRemoves.shift();n.cleanupRemovedNode(c),n.mirror.removeNodeFromMap(c)}for(var d=on(n.movedSet),u;!(u=d()).done;){var h=u.value;j4e(n.removesSubTreeCache,h,n.mirror)&&!n.movedSet.has(ei.parentNode(h))||l(h)}for(var m=on(n.addedSet),f;!(f=m()).done;){var p=f.value;!E4e(n.droppedSet,p)&&!j4e(n.removesSubTreeCache,p,n.mirror)||E4e(n.movedSet,p)?l(p):n.droppedSet.add(p)}for(var g=null;i.length;){var v=null;if(g){var b=n.mirror.getId(ei.parentNode(g.value)),x=o(g.value);b!==-1&&x!==-1&&(v=g)}if(!v)for(var w=i.tail;w;){var k=w;if(w=w.previous,k){var S=n.mirror.getId(ei.parentNode(k.value)),C=o(k.value);if(C===-1)continue;if(S!==-1){v=k;break}else{var j=k.value,E=ei.parentNode(j);if(E&&E.nodeType===Node.DOCUMENT_FRAGMENT_NODE){var N=ei.host(E),A=n.mirror.getId(N);if(A!==-1){v=k;break}}}}}if(!v){for(;i.head;)i.removeNode(i.head.value);break}g=v.previous,i.removeNode(v.value),l(v.value)}var _={texts:n.texts.map(function(T){var R=T.node,O=ei.parentNode(R);return O&&O.tagName==="TEXTAREA"&&n.genTextAreaValueMutation(O),{id:n.mirror.getId(R),value:T.value}}).filter(function(T){return!s.has(T.id)}).filter(function(T){return n.mirror.has(T.id)}),attributes:n.attributes.map(function(T){var R=T.attributes;if(typeof R.style=="string"){var O=JSON.stringify(T.styleDiff),F=JSON.stringify(T._unchangedStyles);O.length<R.style.length&&(O+F).split("var(").length===R.style.split("var(").length&&(R.style=T.styleDiff)}return{id:n.mirror.getId(T.node),attributes:R}}).filter(function(T){return!s.has(T.id)}).filter(function(T){return n.mirror.has(T.id)}),removes:n.removes,adds:r};!_.texts.length&&!_.attributes.length&&!_.removes.length&&!_.adds.length||(n.texts=[],n.attributes=[],n.attributeMap=new WeakMap,n.removes=[],n.addedSet=new Set,n.movedSet=new Set,n.droppedSet=new Set,n.removesSubTreeCache=new Set,n.movedMap={},n.mutationCb(_))}}),En(this,"genTextAreaValueMutation",function(r){var s=n.attributeMap.get(r);s||(s={node:r,attributes:{},styleDiff:{},_unchangedStyles:{}},n.attributes.push(s),n.attributeMap.set(r,s));var i=Array.from(ei.childNodes(r),function(o){return ei.textContent(o)||""}).join("");s.attributes.value=IK({element:r,maskInputOptions:n.maskInputOptions,tagName:r.tagName,type:MK(r),value:i,maskInputFn:n.maskInputFn})}),En(this,"processMutation",function(r){if(!_oe(r.target,n.mirror,n.slimDOMOptions))switch(r.type){case"characterData":{var s=ei.textContent(r.target);!Cu(r.target,n.blockClass,n.blockSelector,!1)&&s!==r.oldValue&&n.texts.push({value:jat(r.target,n.maskTextClass,n.maskTextSelector,!0)&&s?n.maskTextFn?n.maskTextFn(s,Vot(r.target)):s.replace(/[\S]/g,"*"):s,node:r.target});break}case"attributes":{var i=r.target,o=r.attributeName,l=r.target.getAttribute(o);if(o==="value"){var c=MK(i);l=IK({element:i,maskInputOptions:n.maskInputOptions,tagName:i.tagName,type:c,value:l,maskInputFn:n.maskInputFn})}if(Cu(r.target,n.blockClass,n.blockSelector,!1)||l===r.oldValue)return;var d=n.attributeMap.get(r.target);if(i.tagName==="IFRAME"&&o==="src"&&!n.keepIframeSrcFn(l))if(!i.contentDocument)o="rr_src";else return;if(d||(d={node:r.target,attributes:{},styleDiff:{},_unchangedStyles:{}},n.attributes.push(d),n.attributeMap.set(r.target,d)),o==="type"&&i.tagName==="INPUT"&&(r.oldValue||"").toLowerCase()==="password"&&i.setAttribute("data-rr-is-password","true"),!Cat(i.tagName,o))if(d.attributes[o]=Sat(n.doc,_2(i.tagName),_2(o),l),o==="style"){if(!n.unattachedDoc)try{n.unattachedDoc=document.implementation.createHTMLDocument()}catch{n.unattachedDoc=n.doc}var u=n.unattachedDoc.createElement("span");r.oldValue&&u.setAttribute("style",r.oldValue);for(var h=on(Array.from(i.style)),m;!(m=h()).done;){var f=m.value,p=i.style.getPropertyValue(f),g=i.style.getPropertyPriority(f);p!==u.style.getPropertyValue(f)||g!==u.style.getPropertyPriority(f)?g===""?d.styleDiff[f]=p:d.styleDiff[f]=[p,g]:d._unchangedStyles[f]=[p,g]}for(var v=on(Array.from(u.style)),b;!(b=v()).done;){var x=b.value;i.style.getPropertyValue(x)===""&&(d.styleDiff[x]=!1)}}else o==="open"&&i.tagName==="DIALOG"&&(i.matches("dialog:modal")?d.attributes.rr_open_mode="modal":d.attributes.rr_open_mode="non-modal");break}case"childList":{if(Cu(r.target,n.blockClass,n.blockSelector,!0))return;if(r.target.tagName==="TEXTAREA"){n.genTextAreaValueMutation(r.target);return}r.addedNodes.forEach(function(w){return n.genAdds(w,r.target)}),r.removedNodes.forEach(function(w){var k=n.mirror.getId(w),S=SD(r.target)?n.mirror.getId(ei.host(r.target)):n.mirror.getId(r.target);Cu(r.target,n.blockClass,n.blockSelector,!1)||_oe(w,n.mirror,n.slimDOMOptions)||!lZt(w,n.mirror)||(n.addedSet.has(w)?(Npe(n.addedSet,w),n.droppedSet.add(w)):n.addedSet.has(r.target)&&k===-1||Hot(r.target,n.mirror)||(n.movedSet.has(w)&&n.movedMap[C4e(k,S)]?Npe(n.movedSet,w):(n.removes.push({parentId:S,id:k,isShadow:SD(r.target)&&CD(r.target)?!0:void 0}),pZt(w,n.removesSubTreeCache))),n.mapRemoves.push(w))});break}}}),En(this,"genAdds",function(r,s){if(!n.processedNodeManager.inOtherBuffer(r,n)&&!(n.addedSet.has(r)||n.movedSet.has(r))){if(n.mirror.hasNode(r)){if(_oe(r,n.mirror,n.slimDOMOptions))return;n.movedSet.add(r);var i=null;s&&n.mirror.hasNode(s)&&(i=n.mirror.getId(s)),i&&i!==-1&&(n.movedMap[C4e(n.mirror.getId(r),i)]=!0)}else n.addedSet.add(r),n.droppedSet.delete(r);Cu(r,n.blockClass,n.blockSelector,!1)||(ei.childNodes(r).forEach(function(o){return n.genAdds(o)}),Epe(r)&&ei.childNodes(ei.shadowRoot(r)).forEach(function(o){n.processedNodeManager.add(o,n),n.genAdds(o,r)}))}}),En(this,"cleanupRemovedNode",function(r){if(r.nodeName==="IFRAME")try{n.iframeManager.removeIframe(r)}catch{}else try{n.stylesheetManager.cleanupStylesheetsForRemovedNode(r)}catch{}r.childNodes.forEach(function(s){n.cleanupRemovedNode(s)})})}var e=t.prototype;return e.init=function(r){var s=this;["mutationCb","blockClass","blockSelector","maskTextClass","maskTextSelector","inlineStylesheet","maskInputOptions","maskTextFn","maskInputFn","keepIframeSrcFn","recordCanvas","inlineImages","slimDOMOptions","dataURLOptions","doc","mirror","iframeManager","stylesheetManager","shadowDomManager","canvasManager","processedNodeManager"].forEach(function(i){s[i]=r[i]})},e.freeze=function(){this.frozen=!0,this.canvasManager.freeze()},e.unfreeze=function(){this.frozen=!1,this.canvasManager.unfreeze(),this.emit()},e.isFrozen=function(){return this.frozen},e.lock=function(){this.locked=!0,this.canvasManager.lock()},e.unlock=function(){this.locked=!1,this.canvasManager.unlock(),this.emit()},e.reset=function(){this.shadowDomManager.reset(),this.canvasManager.reset()},e.getDoc=function(){return this.doc},t}();function Npe(t,e){t.delete(e),ei.childNodes(e).forEach(function(n){return Npe(t,n)})}function pZt(t,e){for(var n=[t];n.length;){var r=n.pop();e.has(r)||(e.add(r),ei.childNodes(r).forEach(function(s){return n.push(s)}))}}function j4e(t,e,n){return t.size===0?!1:gZt(t,e)}function gZt(t,e,n){var r=ei.parentNode(e);return r?t.has(r):!1}function E4e(t,e){return t.size===0?!1:Qot(t,e)}function Qot(t,e){var n=ei.parentNode(e);return n?t.has(n)?!0:Qot(t,n):!1}var jD;function vZt(t){jD=t}function yZt(){jD=void 0}var oi=function(t){if(!jD)return t;var e=function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];try{return t.apply(void 0,[].concat(r))}catch(i){if(jD&&jD(i)===!0)return;throw i}};return e},Jv=[];function Y8(t){try{if("composedPath"in t){var e=t.composedPath();if(e.length)return e[0]}else if("path"in t&&t.path.length)return t.path[0]}catch{}return t&&t.target}function Zot(t,e){var n=new fZt;Jv.push(n),n.init(t);var r=new(Fot())(oi(n.processMutations.bind(n)));return r.observe(e,{attributes:!0,attributeOldValue:!0,characterData:!0,characterDataOldValue:!0,childList:!0,subtree:!0}),r}function bZt(t){for(var e=Jv.length-1;e>=0;e--){var n=Jv[e];n.getDoc()===t&&Jv.splice(e,1)}}function xZt(t){var e=t.mousemoveCb,n=t.sampling,r=t.doc,s=t.mirror;if(n.mousemove===!1)return function(){};var i=typeof n.mousemove=="number"?n.mousemove:50,o=typeof n.mousemoveCallback=="number"?n.mousemoveCallback:500,l=[],c,d=DO(oi(function(m){var f=Date.now()-c;e(l.map(function(p){return p.timeOffset-=f,p}),m),l=[],c=null}),o),u=oi(DO(oi(function(m){var f=Y8(m),p=jpe(m)?m.changedTouches[0]:m,g=p.clientX,v=p.clientY;c||(c=GK()),l.push({x:g,y:v,id:s.getId(f),timeOffset:GK()-c}),d(typeof DragEvent<"u"&&Pr(m,DragEvent)?ps.Drag:Pr(m,MouseEvent)?ps.MouseMove:ps.TouchMove)}),i,{trailing:!1})),h=[Su("mousemove",u,r),Su("touchmove",u,r),Su("drag",u,r)];return oi(function(){h.forEach(function(m){return m()})})}function wZt(t){var e=t.mouseInteractionCb,n=t.doc,r=t.mirror,s=t.blockClass,i=t.blockSelector,o=t.sampling;if(o.mouseInteraction===!1)return function(){};var l=o.mouseInteraction===!0||o.mouseInteraction===void 0?{}:o.mouseInteraction,c=[],d=null,u=function(h){return function(m){var f=Y8(m);if(!Cu(f,s,i,!0)){var p=null,g=h;if("pointerType"in m){switch(m.pointerType){case"mouse":p=Tb.Mouse;break;case"touch":p=Tb.Touch;break;case"pen":p=Tb.Pen;break}p===Tb.Touch?Wu[h]===Wu.MouseDown?g="TouchStart":Wu[h]===Wu.MouseUp&&(g="TouchEnd"):Tb.Pen}else jpe(m)&&(p=Tb.Touch);p!==null?(d=p,(g.startsWith("Touch")&&p===Tb.Touch||g.startsWith("Mouse")&&p===Tb.Mouse)&&(p=null)):Wu[h]===Wu.Click&&(p=d,d=null);var v=jpe(m)?m.changedTouches[0]:m;if(v){var b=r.getId(f),x=v.clientX,w=v.clientY;oi(e)(Ps({type:Wu[g],id:b,x,y:w},p!==null&&{pointerType:p}))}}}};return Object.keys(Wu).filter(function(h){return Number.isNaN(Number(h))&&!h.endsWith("_Departed")&&l[h]!==!1}).forEach(function(h){var m=_2(h),f=u(h);if(window.PointerEvent)switch(Wu[h]){case Wu.MouseDown:case Wu.MouseUp:m=m.replace("mouse","pointer");break;case Wu.TouchStart:case Wu.TouchEnd:return}c.push(Su(m,f,n))}),oi(function(){c.forEach(function(h){return h()})})}function Jot(t){var e=t.scrollCb,n=t.doc,r=t.mirror,s=t.blockClass,i=t.blockSelector,o=t.sampling,l=oi(DO(oi(function(c){var d=Y8(c);if(!(!d||Cu(d,s,i,!0))){var u=r.getId(d);if(d===n&&n.defaultView){var h=Bot(n.defaultView);e({id:u,x:h.left,y:h.top})}else e({id:u,x:d.scrollLeft,y:d.scrollTop})}}),o.scroll||100));return Su("scroll",l,n)}function kZt(t,e){var n=t.viewportResizeCb,r=e.win,s=-1,i=-1,o=oi(DO(oi(function(){var l=Uot(),c=zot();(s!==l||i!==c)&&(n({width:Number(c),height:Number(l)}),s=l,i=c)}),200));return Su("resize",o,r)}var SZt=["INPUT","TEXTAREA","SELECT"],N4e=new WeakMap;function CZt(t){var e=t.inputCb,n=t.doc,r=t.mirror,s=t.blockClass,i=t.blockSelector,o=t.ignoreClass,l=t.ignoreSelector,c=t.maskInputOptions,d=t.maskInputFn,u=t.sampling,h=t.userTriggeredOnInput;function m(k){var S=Y8(k),C=k.isTrusted,j=S&&S.tagName;if(S&&j==="OPTION"&&(S=ei.parentElement(S)),!(!S||!j||SZt.indexOf(j)<0||Cu(S,s,i,!0))&&!(S.classList.contains(o)||l&&S.matches(l))){var E=S.value,N=!1,A=MK(S)||"";A==="radio"||A==="checkbox"?N=S.checked:(c[j.toLowerCase()]||c[A])&&(E=IK({element:S,maskInputOptions:c,tagName:j,type:A,value:E,maskInputFn:d})),f(S,h?{text:E,isChecked:N,userTriggered:C}:{text:E,isChecked:N});var _=S.name;A==="radio"&&_&&N&&n.querySelectorAll('input[type="radio"][name="'+_+'"]').forEach(function(T){if(T!==S){var R=T.value;f(T,h?{text:R,isChecked:!N,userTriggered:!1}:{text:R,isChecked:!N})}})}}function f(k,S){var C=N4e.get(k);if(!C||C.text!==S.text||C.isChecked!==S.isChecked){N4e.set(k,S);var j=r.getId(k);oi(e)(Ps({},S,{id:j}))}}var p=u.input==="last"?["change"]:["input","change"],g=p.map(function(k){return Su(k,oi(m),n)}),v=n.defaultView;if(!v)return function(){g.forEach(function(k){return k()})};var b=v.Object.getOwnPropertyDescriptor(v.HTMLInputElement.prototype,"value"),x=[[v.HTMLInputElement.prototype,"value"],[v.HTMLInputElement.prototype,"checked"],[v.HTMLSelectElement.prototype,"value"],[v.HTMLTextAreaElement.prototype,"value"],[v.HTMLSelectElement.prototype,"selectedIndex"],[v.HTMLOptionElement.prototype,"selected"]];if(b&&b.set){var w;(w=g).push.apply(w,[].concat(x.map(function(k){return Oee(k[0],k[1],{set:function(){oi(m)({target:this,isTrusted:!1})}},!1,v)})))}return oi(function(){g.forEach(function(k){return k()})})}function WK(t){var e=[];function n(r,s){if(RU("CSSGroupingRule")&&Pr(r.parentRule,CSSGroupingRule)||RU("CSSMediaRule")&&Pr(r.parentRule,CSSMediaRule)||RU("CSSSupportsRule")&&Pr(r.parentRule,CSSSupportsRule)||RU("CSSConditionRule")&&Pr(r.parentRule,CSSConditionRule)){var i=Array.from(r.parentRule.cssRules),o=i.indexOf(r);s.unshift(o)}else if(r.parentStyleSheet){var l=Array.from(r.parentStyleSheet.cssRules),c=l.indexOf(r);s.unshift(c)}return s}return n(t,e)}function Hw(t,e,n){var r,s;return t?(t.ownerNode?r=e.getId(t.ownerNode):s=n.getId(t),{styleId:s,id:r}):{}}function jZt(t,e){var n=t.styleSheetRuleCb,r=t.mirror,s=t.stylesheetManager,i=e.win;if(!i.CSSStyleSheet||!i.CSSStyleSheet.prototype)return function(){};var o=i.CSSStyleSheet.prototype.insertRule;i.CSSStyleSheet.prototype.insertRule=new Proxy(o,{apply:oi(function(m,f,p){var g=p[0],v=p[1],b=Hw(f,r,s.styleMirror),x=b.id,w=b.styleId;return(x&&x!==-1||w&&w!==-1)&&n({id:x,styleId:w,adds:[{rule:g,index:v}]}),m.apply(f,p)})}),i.CSSStyleSheet.prototype.addRule=function(m,f,p){p===void 0&&(p=this.cssRules.length);var g=m+" { "+f+" }";return i.CSSStyleSheet.prototype.insertRule.apply(this,[g,p])};var l=i.CSSStyleSheet.prototype.deleteRule;i.CSSStyleSheet.prototype.deleteRule=new Proxy(l,{apply:oi(function(m,f,p){var g=p[0],v=Hw(f,r,s.styleMirror),b=v.id,x=v.styleId;return(b&&b!==-1||x&&x!==-1)&&n({id:b,styleId:x,removes:[{index:g}]}),m.apply(f,p)})}),i.CSSStyleSheet.prototype.removeRule=function(m){return i.CSSStyleSheet.prototype.deleteRule.apply(this,[m])};var c;i.CSSStyleSheet.prototype.replace&&(c=i.CSSStyleSheet.prototype.replace,i.CSSStyleSheet.prototype.replace=new Proxy(c,{apply:oi(function(m,f,p){var g=p[0],v=Hw(f,r,s.styleMirror),b=v.id,x=v.styleId;return(b&&b!==-1||x&&x!==-1)&&n({id:b,styleId:x,replace:g}),m.apply(f,p)})}));var d;i.CSSStyleSheet.prototype.replaceSync&&(d=i.CSSStyleSheet.prototype.replaceSync,i.CSSStyleSheet.prototype.replaceSync=new Proxy(d,{apply:oi(function(m,f,p){var g=p[0],v=Hw(f,r,s.styleMirror),b=v.id,x=v.styleId;return(b&&b!==-1||x&&x!==-1)&&n({id:b,styleId:x,replaceSync:g}),m.apply(f,p)})}));var u={};IU("CSSGroupingRule")?u.CSSGroupingRule=i.CSSGroupingRule:(IU("CSSMediaRule")&&(u.CSSMediaRule=i.CSSMediaRule),IU("CSSConditionRule")&&(u.CSSConditionRule=i.CSSConditionRule),IU("CSSSupportsRule")&&(u.CSSSupportsRule=i.CSSSupportsRule));var h={};return Object.entries(u).forEach(function(m){var f=m[0],p=m[1];h[f]={insertRule:p.prototype.insertRule,deleteRule:p.prototype.deleteRule},p.prototype.insertRule=new Proxy(h[f].insertRule,{apply:oi(function(g,v,b){var x=b[0],w=b[1],k=Hw(v.parentStyleSheet,r,s.styleMirror),S=k.id,C=k.styleId;return(S&&S!==-1||C&&C!==-1)&&n({id:S,styleId:C,adds:[{rule:x,index:[].concat(WK(v),[w||0])}]}),g.apply(v,b)})}),p.prototype.deleteRule=new Proxy(h[f].deleteRule,{apply:oi(function(g,v,b){var x=b[0],w=Hw(v.parentStyleSheet,r,s.styleMirror),k=w.id,S=w.styleId;return(k&&k!==-1||S&&S!==-1)&&n({id:k,styleId:S,removes:[{index:[].concat(WK(v),[x])}]}),g.apply(v,b)})})}),oi(function(){i.CSSStyleSheet.prototype.insertRule=o,i.CSSStyleSheet.prototype.deleteRule=l,c&&(i.CSSStyleSheet.prototype.replace=c),d&&(i.CSSStyleSheet.prototype.replaceSync=d),Object.entries(u).forEach(function(m){var f=m[0],p=m[1];p.prototype.insertRule=h[f].insertRule,p.prototype.deleteRule=h[f].deleteRule})})}function Xot(t,e){var n=t.mirror,r=t.stylesheetManager,s,i,o,l=null;e.nodeName==="#document"?l=n.getId(e):l=n.getId(ei.host(e));var c=e.nodeName==="#document"?(s=e.defaultView)==null?void 0:s.Document:(o=(i=e.ownerDocument)==null?void 0:i.defaultView)==null?void 0:o.ShadowRoot,d=c!=null&&c.prototype?Object.getOwnPropertyDescriptor(c==null?void 0:c.prototype,"adoptedStyleSheets"):void 0;return l===null||l===-1||!c||!d?function(){}:(Object.defineProperty(e,"adoptedStyleSheets",{configurable:d.configurable,enumerable:d.enumerable,get:function(){var h;return(h=d.get)==null?void 0:h.call(this)},set:function(h){var m,f=(m=d.set)==null?void 0:m.call(this,h);if(l!==null&&l!==-1)try{r.adoptStyleSheets(h,l)}catch{}return f}}),oi(function(){Object.defineProperty(e,"adoptedStyleSheets",{configurable:d.configurable,enumerable:d.enumerable,get:d.get,set:d.set})}))}function EZt(t,e){var n=t.styleDeclarationCb,r=t.mirror,s=t.ignoreCSSAttributes,i=t.stylesheetManager,o=e.win,l=o.CSSStyleDeclaration.prototype.setProperty;o.CSSStyleDeclaration.prototype.setProperty=new Proxy(l,{apply:oi(function(d,u,h){var m,f=h[0],p=h[1],g=h[2];if(s.has(f))return l.apply(u,[f,p,g]);var v=Hw((m=u.parentRule)==null?void 0:m.parentStyleSheet,r,i.styleMirror),b=v.id,x=v.styleId;return(b&&b!==-1||x&&x!==-1)&&n({id:b,styleId:x,set:{property:f,value:p,priority:g},index:WK(u.parentRule)}),d.apply(u,h)})});var c=o.CSSStyleDeclaration.prototype.removeProperty;return o.CSSStyleDeclaration.prototype.removeProperty=new Proxy(c,{apply:oi(function(d,u,h){var m,f=h[0];if(s.has(f))return c.apply(u,[f]);var p=Hw((m=u.parentRule)==null?void 0:m.parentStyleSheet,r,i.styleMirror),g=p.id,v=p.styleId;return(g&&g!==-1||v&&v!==-1)&&n({id:g,styleId:v,remove:{property:f},index:WK(u.parentRule)}),d.apply(u,h)})}),oi(function(){o.CSSStyleDeclaration.prototype.setProperty=l,o.CSSStyleDeclaration.prototype.removeProperty=c})}function NZt(t){var e=t.mediaInteractionCb,n=t.blockClass,r=t.blockSelector,s=t.mirror,i=t.sampling,o=t.doc,l=oi(function(d){return DO(oi(function(u){var h=Y8(u);if(!(!h||Cu(h,n,r,!0))){var m=h.currentTime,f=h.volume,p=h.muted,g=h.playbackRate,v=h.loop;e({type:d,id:s.getId(h),currentTime:m,volume:f,muted:p,playbackRate:g,loop:v})}}),i.media||500)}),c=[Su("play",l(ZT.Play),o),Su("pause",l(ZT.Pause),o),Su("seeked",l(ZT.Seeked),o),Su("volumechange",l(ZT.VolumeChange),o),Su("ratechange",l(ZT.RateChange),o)];return oi(function(){c.forEach(function(d){return d()})})}function TZt(t){var e=t.fontCb,n=t.doc,r=n.defaultView;if(!r)return function(){};var s=[],i=new WeakMap,o=r.FontFace;r.FontFace=function(d,u,h){var m=new o(d,u,h);return i.set(m,{family:d,buffer:typeof u!="string",descriptors:h,fontSource:typeof u=="string"?u:JSON.stringify(Array.from(new Uint8Array(u)))}),m};var l=_E(n.fonts,"add",function(c){return function(d){return setTimeout(oi(function(){var u=i.get(d);u&&(e(u),i.delete(d))}),0),c.apply(this,[d])}});return s.push(function(){r.FontFace=o}),s.push(l),oi(function(){s.forEach(function(c){return c()})})}function _Zt(t){var e=t.doc,n=t.mirror,r=t.blockClass,s=t.blockSelector,i=t.selectionCb,o=!0,l=oi(function(){var c=e.getSelection();if(!(!c||o&&(c!=null&&c.isCollapsed))){o=c.isCollapsed||!1;for(var d=[],u=c.rangeCount||0,h=0;h<u;h++){var m=c.getRangeAt(h),f=m.startContainer,p=m.startOffset,g=m.endContainer,v=m.endOffset,b=Cu(f,r,s,!0)||Cu(g,r,s,!0);b||d.push({start:n.getId(f),startOffset:p,end:n.getId(g),endOffset:v})}i({ranges:d})}});return l(),Su("selectionchange",l)}function AZt(t){var e=t.doc,n=t.customElementCb,r=e.defaultView;if(!r||!r.customElements)return function(){};var s=_E(r.customElements,"define",function(i){return function(o,l,c){try{n({define:{name:o}})}catch{console.warn("Custom element callback failed for "+o)}return i.apply(this,[o,l,c])}});return s}function PZt(t,e){var n=t.mutationCb,r=t.mousemoveCb,s=t.mouseInteractionCb,i=t.scrollCb,o=t.viewportResizeCb,l=t.inputCb,c=t.mediaInteractionCb,d=t.styleSheetRuleCb,u=t.styleDeclarationCb,h=t.canvasMutationCb,m=t.fontCb,f=t.selectionCb,p=t.customElementCb;t.mutationCb=function(){for(var g=arguments.length,v=new Array(g),b=0;b<g;b++)v[b]=arguments[b];if(e.mutation){var x;(x=e).mutation.apply(x,[].concat(v))}n.apply(void 0,[].concat(v))},t.mousemoveCb=function(){for(var g=arguments.length,v=new Array(g),b=0;b<g;b++)v[b]=arguments[b];if(e.mousemove){var x;(x=e).mousemove.apply(x,[].concat(v))}r.apply(void 0,[].concat(v))},t.mouseInteractionCb=function(){for(var g=arguments.length,v=new Array(g),b=0;b<g;b++)v[b]=arguments[b];if(e.mouseInteraction){var x;(x=e).mouseInteraction.apply(x,[].concat(v))}s.apply(void 0,[].concat(v))},t.scrollCb=function(){for(var g=arguments.length,v=new Array(g),b=0;b<g;b++)v[b]=arguments[b];if(e.scroll){var x;(x=e).scroll.apply(x,[].concat(v))}i.apply(void 0,[].concat(v))},t.viewportResizeCb=function(){for(var g=arguments.length,v=new Array(g),b=0;b<g;b++)v[b]=arguments[b];if(e.viewportResize){var x;(x=e).viewportResize.apply(x,[].concat(v))}o.apply(void 0,[].concat(v))},t.inputCb=function(){for(var g=arguments.length,v=new Array(g),b=0;b<g;b++)v[b]=arguments[b];if(e.input){var x;(x=e).input.apply(x,[].concat(v))}l.apply(void 0,[].concat(v))},t.mediaInteractionCb=function(){for(var g=arguments.length,v=new Array(g),b=0;b<g;b++)v[b]=arguments[b];if(e.mediaInteaction){var x;(x=e).mediaInteaction.apply(x,[].concat(v))}c.apply(void 0,[].concat(v))},t.styleSheetRuleCb=function(){for(var g=arguments.length,v=new Array(g),b=0;b<g;b++)v[b]=arguments[b];if(e.styleSheetRule){var x;(x=e).styleSheetRule.apply(x,[].concat(v))}d.apply(void 0,[].concat(v))},t.styleDeclarationCb=function(){for(var g=arguments.length,v=new Array(g),b=0;b<g;b++)v[b]=arguments[b];if(e.styleDeclaration){var x;(x=e).styleDeclaration.apply(x,[].concat(v))}u.apply(void 0,[].concat(v))},t.canvasMutationCb=function(){for(var g=arguments.length,v=new Array(g),b=0;b<g;b++)v[b]=arguments[b];if(e.canvasMutation){var x;(x=e).canvasMutation.apply(x,[].concat(v))}h.apply(void 0,[].concat(v))},t.fontCb=function(){for(var g=arguments.length,v=new Array(g),b=0;b<g;b++)v[b]=arguments[b];if(e.font){var x;(x=e).font.apply(x,[].concat(v))}m.apply(void 0,[].concat(v))},t.selectionCb=function(){for(var g=arguments.length,v=new Array(g),b=0;b<g;b++)v[b]=arguments[b];if(e.selection){var x;(x=e).selection.apply(x,[].concat(v))}f.apply(void 0,[].concat(v))},t.customElementCb=function(){for(var g=arguments.length,v=new Array(g),b=0;b<g;b++)v[b]=arguments[b];if(e.customElement){var x;(x=e).customElement.apply(x,[].concat(v))}p.apply(void 0,[].concat(v))}}function RZt(t,e){e===void 0&&(e={});var n=t.doc.defaultView;if(!n)return function(){};PZt(t,e);var r;t.recordDOM&&(r=Zot(t,t.doc));var s=xZt(t),i=wZt(t),o=Jot(t),l=kZt(t,{win:n}),c=CZt(t),d=NZt(t),u=function(){},h=function(){},m=function(){},f=function(){};t.recordDOM&&(u=jZt(t,{win:n}),h=Xot(t,t.doc),m=EZt(t,{win:n}),t.collectFonts&&(f=TZt(t)));for(var p=_Zt(t),g=AZt(t),v=[],b=on(t.plugins),x;!(x=b()).done;){var w=x.value;v.push(w.observer(w.callback,n,w.options))}return oi(function(){Jv.forEach(function(k){return k.reset()}),r==null||r.disconnect(),s(),i(),o(),l(),c(),d(),u(),h(),m(),f(),p(),g(),v.forEach(function(k){return k()})})}function RU(t){return typeof window[t]<"u"}function IU(t){return!!(typeof window[t]<"u"&&window[t].prototype&&"insertRule"in window[t].prototype&&"deleteRule"in window[t].prototype)}var T4e=function(){function t(n){En(this,"iframeIdToRemoteIdMap",new WeakMap),En(this,"iframeRemoteIdToIdMap",new WeakMap),this.generateIdFn=n}var e=t.prototype;return e.getId=function(r,s,i,o){var l=i||this.getIdToRemoteIdMap(r),c=o||this.getRemoteIdToIdMap(r),d=l.get(s);return d||(d=this.generateIdFn(),l.set(s,d),c.set(d,s)),d},e.getIds=function(r,s){var i=this,o=this.getIdToRemoteIdMap(r),l=this.getRemoteIdToIdMap(r);return s.map(function(c){return i.getId(r,c,o,l)})},e.getRemoteId=function(r,s,i){var o=i||this.getRemoteIdToIdMap(r);if(typeof s!="number")return s;var l=o.get(s);return l||-1},e.getRemoteIds=function(r,s){var i=this,o=this.getRemoteIdToIdMap(r);return s.map(function(l){return i.getRemoteId(r,l,o)})},e.reset=function(r){if(!r){this.iframeIdToRemoteIdMap=new WeakMap,this.iframeRemoteIdToIdMap=new WeakMap;return}this.iframeIdToRemoteIdMap.delete(r),this.iframeRemoteIdToIdMap.delete(r)},e.getIdToRemoteIdMap=function(r){var s=this.iframeIdToRemoteIdMap.get(r);return s||(s=new Map,this.iframeIdToRemoteIdMap.set(r,s)),s},e.getRemoteIdToIdMap=function(r){var s=this.iframeRemoteIdToIdMap.get(r);return s||(s=new Map,this.iframeRemoteIdToIdMap.set(r,s)),s},t}(),IZt=function(){function t(n){En(this,"iframes",new WeakMap),En(this,"crossOriginIframeMap",new WeakMap),En(this,"crossOriginIframeMirror",new T4e(kat)),En(this,"crossOriginIframeStyleMirror"),En(this,"crossOriginIframeRootIdMap",new WeakMap),En(this,"iframeContentDocumentMap",new WeakMap),En(this,"iframeObserverCleanupMap",new WeakMap),En(this,"mirror"),En(this,"mutationCb"),En(this,"wrappedEmit"),En(this,"loadListener"),En(this,"stylesheetManager"),En(this,"recordCrossOriginIframes"),this.mutationCb=n.mutationCb,this.wrappedEmit=n.wrappedEmit,this.stylesheetManager=n.stylesheetManager,this.recordCrossOriginIframes=n.recordCrossOriginIframes,this.crossOriginIframeStyleMirror=new T4e(this.stylesheetManager.styleMirror.generateId.bind(this.stylesheetManager.styleMirror)),this.mirror=n.mirror,this.recordCrossOriginIframes&&window.addEventListener("message",this.handleMessage.bind(this))}var e=t.prototype;return e.addIframe=function(r){this.iframes.set(r,!0),r.contentWindow&&this.crossOriginIframeMap.set(r.contentWindow,r)},e.getIframeContentDocument=function(r){return this.iframeContentDocumentMap.get(r)},e.setObserverCleanup=function(r,s){this.iframeObserverCleanupMap.set(r,s)},e.getObserverCleanup=function(r){return this.iframeObserverCleanupMap.get(r)},e.removeIframe=function(r){var s=this.iframeContentDocumentMap.get(r);s&&(this.stylesheetManager.cleanupStylesheetsForRemovedNode(s),this.mirror.removeNodeFromMap(s,!0)),this.iframes.delete(r),this.iframeContentDocumentMap.delete(r);var i=this.iframeObserverCleanupMap.get(r);if(i){try{i()}catch{}this.iframeObserverCleanupMap.delete(r)}},e.addLoadListener=function(r){this.loadListener=r},e.attachIframe=function(r,s){var i,o;this.mutationCb({adds:[{parentId:this.mirror.getId(r),nextId:null,node:s}],removes:[],texts:[],attributes:[],isAttachIframe:!0}),r.contentDocument&&this.iframeContentDocumentMap.set(r,r.contentDocument),this.recordCrossOriginIframes&&((i=r.contentWindow)==null||i.addEventListener("message",this.handleMessage.bind(this))),(o=this.loadListener)==null||o.call(this,r),r.contentDocument&&r.contentDocument.adoptedStyleSheets&&r.contentDocument.adoptedStyleSheets.length>0&&this.stylesheetManager.adoptStyleSheets(r.contentDocument.adoptedStyleSheets,this.mirror.getId(r.contentDocument))},e.handleMessage=function(r){var s=r;if(!(s.data.type!=="rrweb"||s.origin!==s.data.origin)){var i=r.source;if(i){var o=this.crossOriginIframeMap.get(r.source);if(o){var l=this.transformCrossOriginEvent(o,s.data.event);l&&this.wrappedEmit(l,s.data.isCheckout)}}}},e.transformCrossOriginEvent=function(r,s){var i=this,o;switch(s.type){case ri.FullSnapshot:{this.crossOriginIframeMirror.reset(r),this.crossOriginIframeStyleMirror.reset(r),this.replaceIdOnNode(s.data.node,r);var l=s.data.node.id;return this.crossOriginIframeRootIdMap.set(r,l),this.patchRootIdOnNode(s.data.node,l),{timestamp:s.timestamp,type:ri.IncrementalSnapshot,data:{source:ps.Mutation,adds:[{parentId:this.mirror.getId(r),nextId:null,node:s.data.node}],removes:[],texts:[],attributes:[],isAttachIframe:!0}}}case ri.Meta:case ri.Load:case ri.DomContentLoaded:return!1;case ri.Plugin:return s;case ri.Custom:return this.replaceIds(s.data.payload,r,["id","parentId","previousId","nextId"]),s;case ri.IncrementalSnapshot:switch(s.data.source){case ps.Mutation:return s.data.adds.forEach(function(c){i.replaceIds(c,r,["parentId","nextId","previousId"]),i.replaceIdOnNode(c.node,r);var d=i.crossOriginIframeRootIdMap.get(r);d&&i.patchRootIdOnNode(c.node,d)}),s.data.removes.forEach(function(c){i.replaceIds(c,r,["parentId","id"])}),s.data.attributes.forEach(function(c){i.replaceIds(c,r,["id"])}),s.data.texts.forEach(function(c){i.replaceIds(c,r,["id"])}),s;case ps.Drag:case ps.TouchMove:case ps.MouseMove:return s.data.positions.forEach(function(c){i.replaceIds(c,r,["id"])}),s;case ps.ViewportResize:return!1;case ps.MediaInteraction:case ps.MouseInteraction:case ps.Scroll:case ps.CanvasMutation:case ps.Input:return this.replaceIds(s.data,r,["id"]),s;case ps.StyleSheetRule:case ps.StyleDeclaration:return this.replaceIds(s.data,r,["id"]),this.replaceStyleIds(s.data,r,["styleId"]),s;case ps.Font:return s;case ps.Selection:return s.data.ranges.forEach(function(c){i.replaceIds(c,r,["start","end"])}),s;case ps.AdoptedStyleSheet:return this.replaceIds(s.data,r,["id"]),this.replaceStyleIds(s.data,r,["styleIds"]),(o=s.data.styles)==null||o.forEach(function(c){i.replaceStyleIds(c,r,["styleId"])}),s}}return!1},e.replace=function(r,s,i,o){for(var l=on(o),c;!(c=l()).done;){var d=c.value;!Array.isArray(s[d])&&typeof s[d]!="number"||(Array.isArray(s[d])?s[d]=r.getIds(i,s[d]):s[d]=r.getId(i,s[d]))}return s},e.replaceIds=function(r,s,i){return this.replace(this.crossOriginIframeMirror,r,s,i)},e.replaceStyleIds=function(r,s,i){return this.replace(this.crossOriginIframeStyleMirror,r,s,i)},e.replaceIdOnNode=function(r,s){var i=this;this.replaceIds(r,s,["id","rootId"]),"childNodes"in r&&r.childNodes.forEach(function(o){i.replaceIdOnNode(o,s)})},e.patchRootIdOnNode=function(r,s){var i=this;r.type!==Yot.Document&&!r.rootId&&(r.rootId=s),"childNodes"in r&&r.childNodes.forEach(function(o){i.patchRootIdOnNode(o,s)})},t}(),MZt=function(){function t(n){En(this,"shadowDoms",new WeakSet),En(this,"mutationCb"),En(this,"scrollCb"),En(this,"bypassOptions"),En(this,"mirror"),En(this,"restoreHandlers",[]),this.mutationCb=n.mutationCb,this.scrollCb=n.scrollCb,this.bypassOptions=n.bypassOptions,this.mirror=n.mirror,this.init()}var e=t.prototype;return e.init=function(){this.reset(),this.patchAttachShadow(Element,document)},e.addShadowRoot=function(r,s){var i=this;if(CD(r)&&!this.shadowDoms.has(r)){this.shadowDoms.add(r);var o=Zot(Ps({},this.bypassOptions,{doc:s,mutationCb:this.mutationCb,mirror:this.mirror,shadowDomManager:this}),r);this.restoreHandlers.push(function(){return o.disconnect()}),this.restoreHandlers.push(Jot(Ps({},this.bypassOptions,{scrollCb:this.scrollCb,doc:r,mirror:this.mirror}))),setTimeout(function(){r.adoptedStyleSheets&&r.adoptedStyleSheets.length>0&&i.bypassOptions.stylesheetManager.adoptStyleSheets(r.adoptedStyleSheets,i.mirror.getId(ei.host(r))),i.restoreHandlers.push(Xot({mirror:i.mirror,stylesheetManager:i.bypassOptions.stylesheetManager},r))},0)}},e.observeAttachShadow=function(r){!r.contentWindow||!r.contentDocument||this.patchAttachShadow(r.contentWindow.Element,r.contentDocument)},e.patchAttachShadow=function(r,s){var i=this;this.restoreHandlers.push(_E(r.prototype,"attachShadow",function(o){return function(l){var c=o.call(this,l),d=ei.shadowRoot(this);return d&&Kot(this)&&i.addShadowRoot(d,s),c}}))},e.reset=function(){this.restoreHandlers.forEach(function(r){try{r()}catch{}}),this.restoreHandlers=[],this.shadowDoms=new WeakSet},t}(),rA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",LZt=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(var MU=0;MU<rA.length;MU++)LZt[rA.charCodeAt(MU)]=MU;var DZt=function(e){var n=new Uint8Array(e),r,s=n.length,i="";for(r=0;r<s;r+=3)i+=rA[n[r]>>2],i+=rA[(n[r]&3)<<4|n[r+1]>>4],i+=rA[(n[r+1]&15)<<2|n[r+2]>>6],i+=rA[n[r+2]&63];return s%3===2?i=i.substring(0,i.length-1)+"=":s%3===1&&(i=i.substring(0,i.length-2)+"=="),i},_4e=new Map;function $Zt(t,e){var n=_4e.get(t);return n||(n=new Map,_4e.set(t,n)),n.has(e)||n.set(e,[]),n.get(e)}var elt=function(t,e,n){if(!(!t||!(nlt(t,e)||(typeof t>"u"?"undefined":Ir(t))==="object"))){var r=t.constructor.name,s=$Zt(n,r),i=s.indexOf(t);return i===-1&&(i=s.length,s.push(t)),i}};function xG(t,e,n){if(Pr(t,Array))return t.map(function(p){return xG(p,e,n)});if(t===null)return t;if(Pr(t,Float32Array)||Pr(t,Float64Array)||Pr(t,Int32Array)||Pr(t,Uint32Array)||Pr(t,Uint8Array)||Pr(t,Uint16Array)||Pr(t,Int16Array)||Pr(t,Int8Array)||Pr(t,Uint8ClampedArray)){var r=t.constructor.name;return{rr_type:r,args:[Object.values(t)]}}else if(Pr(t,ArrayBuffer)){var s=t.constructor.name,i=DZt(t);return{rr_type:s,base64:i}}else if(Pr(t,DataView)){var o=t.constructor.name;return{rr_type:o,args:[xG(t.buffer,e,n),t.byteOffset,t.byteLength]}}else if(Pr(t,HTMLImageElement)){var l=t.constructor.name,c=t.src;return{rr_type:l,src:c}}else if(Pr(t,HTMLCanvasElement)){var d="HTMLImageElement",u=t.toDataURL();return{rr_type:d,src:u}}else if(Pr(t,ImageData)){var h=t.constructor.name;return{rr_type:h,args:[xG(t.data,e,n),t.width,t.height]}}else if(nlt(t,e)||(typeof t>"u"?"undefined":Ir(t))==="object"){var m=t.constructor.name,f=elt(t,e,n);return{rr_type:m,index:f}}return t}var tlt=function(t,e,n){return t.map(function(r){return xG(r,e,n)})},nlt=function(t,e){var n=["WebGLActiveInfo","WebGLBuffer","WebGLFramebuffer","WebGLProgram","WebGLRenderbuffer","WebGLShader","WebGLShaderPrecisionFormat","WebGLTexture","WebGLUniformLocation","WebGLVertexArrayObject","WebGLVertexArrayObjectOES"],r=n.filter(function(s){return typeof e[s]=="function"});return!!r.find(function(s){return Pr(t,e[s])})};function OZt(t,e,n,r){for(var s=function(){var d=c.value;try{if(typeof e.CanvasRenderingContext2D.prototype[d]!="function")return"continue";var u=_E(e.CanvasRenderingContext2D.prototype,d,function(m){return function(){for(var f=this,p=arguments.length,g=new Array(p),v=0;v<p;v++)g[v]=arguments[v];return Cu(this.canvas,n,r,!0)||setTimeout(function(){var b=tlt(g,e,f);t(f.canvas,{type:eR["2D"],property:d,args:b})},0),m.apply(this,g)}});i.push(u)}catch{var h=Oee(e.CanvasRenderingContext2D.prototype,d,{set:function(p){t(this.canvas,{type:eR["2D"],property:d,args:[p],setter:!0})}});i.push(h)}},i=[],o=Object.getOwnPropertyNames(e.CanvasRenderingContext2D.prototype),l=on(o),c;!(c=l()).done;)s();return function(){i.forEach(function(d){return d()})}}function FZt(t){return t==="experimental-webgl"?"webgl":t}function A4e(t,e,n,r){var s=[];try{var i=_E(t.HTMLCanvasElement.prototype,"getContext",function(o){return function(l){for(var c=arguments.length,d=new Array(c>1?c-1:0),u=1;u<c;u++)d[u-1]=arguments[u];if(!Cu(this,e,n,!0)){var h=FZt(l);if("__context"in this||(this.__context=h),r&&["webgl","webgl2"].includes(h))if(d[0]&&Ir(d[0])==="object"){var m=d[0];m.preserveDrawingBuffer||(m.preserveDrawingBuffer=!0)}else d.splice(0,1,{preserveDrawingBuffer:!0})}return o.apply(this,[].concat([l],d))}});s.push(i)}catch{console.error("failed to patch HTMLCanvasElement.prototype.getContext")}return function(){s.forEach(function(o){return o()})}}function P4e(t,e,n,r,s,i){for(var o=function(){var h=u.value;if(["isContextLost","canvas","drawingBufferWidth","drawingBufferHeight"].includes(h))return"continue";try{if(typeof t[h]!="function")return"continue";var m=_E(t,h,function(p){return function(){for(var g=arguments.length,v=new Array(g),b=0;b<g;b++)v[b]=arguments[b];var x=p.apply(this,v);if(elt(x,i,this),"tagName"in this.canvas&&!Cu(this.canvas,r,s,!0)){var w=tlt(v,i,this),k={type:e,property:h,args:w};n(this.canvas,k)}return x}});l.push(m)}catch{var f=Oee(t,h,{set:function(v){n(this.canvas,{type:e,property:h,args:[v],setter:!0})}});l.push(f)}},l=[],c=Object.getOwnPropertyNames(t),d=on(c),u;!(u=d()).done;)o();return l}function BZt(t,e,n,r){var s,i=[];if((s=i).push.apply(s,[].concat(P4e(e.WebGLRenderingContext.prototype,eR.WebGL,t,n,r,e))),typeof e.WebGL2RenderingContext<"u"){var o;(o=i).push.apply(o,[].concat(P4e(e.WebGL2RenderingContext.prototype,eR.WebGL2,t,n,r,e)))}return function(){i.forEach(function(l){return l()})}}var rlt="KGZ1bmN0aW9uKCkgewogICJ1c2Ugc3RyaWN0IjsKICB2YXIgY2hhcnMgPSAiQUJDREVGR0hJSktMTU5PUFFSU1RVVldYWVphYmNkZWZnaGlqa2xtbm9wcXJzdHV2d3h5ejAxMjM0NTY3ODkrLyI7CiAgdmFyIGxvb2t1cCA9IHR5cGVvZiBVaW50OEFycmF5ID09PSAidW5kZWZpbmVkIiA/IFtdIDogbmV3IFVpbnQ4QXJyYXkoMjU2KTsKICBmb3IgKHZhciBpID0gMDsgaSA8IGNoYXJzLmxlbmd0aDsgaSsrKSB7CiAgICBsb29rdXBbY2hhcnMuY2hhckNvZGVBdChpKV0gPSBpOwogIH0KICB2YXIgZW5jb2RlID0gZnVuY3Rpb24oYXJyYXlidWZmZXIpIHsKICAgIHZhciBieXRlcyA9IG5ldyBVaW50OEFycmF5KGFycmF5YnVmZmVyKSwgaTIsIGxlbiA9IGJ5dGVzLmxlbmd0aCwgYmFzZTY0ID0gIiI7CiAgICBmb3IgKGkyID0gMDsgaTIgPCBsZW47IGkyICs9IDMpIHsKICAgICAgYmFzZTY0ICs9IGNoYXJzW2J5dGVzW2kyXSA+PiAyXTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMl0gJiAzKSA8PCA0IHwgYnl0ZXNbaTIgKyAxXSA+PiA0XTsKICAgICAgYmFzZTY0ICs9IGNoYXJzWyhieXRlc1tpMiArIDFdICYgMTUpIDw8IDIgfCBieXRlc1tpMiArIDJdID4+IDZdOwogICAgICBiYXNlNjQgKz0gY2hhcnNbYnl0ZXNbaTIgKyAyXSAmIDYzXTsKICAgIH0KICAgIGlmIChsZW4gJSAzID09PSAyKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDEpICsgIj0iOwogICAgfSBlbHNlIGlmIChsZW4gJSAzID09PSAxKSB7CiAgICAgIGJhc2U2NCA9IGJhc2U2NC5zdWJzdHJpbmcoMCwgYmFzZTY0Lmxlbmd0aCAtIDIpICsgIj09IjsKICAgIH0KICAgIHJldHVybiBiYXNlNjQ7CiAgfTsKICBjb25zdCBsYXN0QmxvYk1hcCA9IC8qIEBfX1BVUkVfXyAqLyBuZXcgTWFwKCk7CiAgY29uc3QgdHJhbnNwYXJlbnRCbG9iTWFwID0gLyogQF9fUFVSRV9fICovIG5ldyBNYXAoKTsKICBhc3luYyBmdW5jdGlvbiBnZXRUcmFuc3BhcmVudEJsb2JGb3Iod2lkdGgsIGhlaWdodCwgZGF0YVVSTE9wdGlvbnMpIHsKICAgIGNvbnN0IGlkID0gYCR7d2lkdGh9LSR7aGVpZ2h0fWA7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBpZiAodHJhbnNwYXJlbnRCbG9iTWFwLmhhcyhpZCkpIHJldHVybiB0cmFuc3BhcmVudEJsb2JNYXAuZ2V0KGlkKTsKICAgICAgY29uc3Qgb2Zmc2NyZWVuID0gbmV3IE9mZnNjcmVlbkNhbnZhcyh3aWR0aCwgaGVpZ2h0KTsKICAgICAgb2Zmc2NyZWVuLmdldENvbnRleHQoIjJkIik7CiAgICAgIGNvbnN0IGJsb2IgPSBhd2FpdCBvZmZzY3JlZW4uY29udmVydFRvQmxvYihkYXRhVVJMT3B0aW9ucyk7CiAgICAgIGNvbnN0IGFycmF5QnVmZmVyID0gYXdhaXQgYmxvYi5hcnJheUJ1ZmZlcigpOwogICAgICBjb25zdCBiYXNlNjQgPSBlbmNvZGUoYXJyYXlCdWZmZXIpOwogICAgICB0cmFuc3BhcmVudEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICByZXR1cm4gYmFzZTY0OwogICAgfSBlbHNlIHsKICAgICAgcmV0dXJuICIiOwogICAgfQogIH0KICBjb25zdCB3b3JrZXIgPSBzZWxmOwogIHdvcmtlci5vbm1lc3NhZ2UgPSBhc3luYyBmdW5jdGlvbihlKSB7CiAgICBpZiAoIk9mZnNjcmVlbkNhbnZhcyIgaW4gZ2xvYmFsVGhpcykgewogICAgICBjb25zdCB7IGlkLCBiaXRtYXAsIHdpZHRoLCBoZWlnaHQsIGRhdGFVUkxPcHRpb25zIH0gPSBlLmRhdGE7CiAgICAgIGNvbnN0IHRyYW5zcGFyZW50QmFzZTY0ID0gZ2V0VHJhbnNwYXJlbnRCbG9iRm9yKAogICAgICAgIHdpZHRoLAogICAgICAgIGhlaWdodCwKICAgICAgICBkYXRhVVJMT3B0aW9ucwogICAgICApOwogICAgICBjb25zdCBvZmZzY3JlZW4gPSBuZXcgT2Zmc2NyZWVuQ2FudmFzKHdpZHRoLCBoZWlnaHQpOwogICAgICBjb25zdCBjdHggPSBvZmZzY3JlZW4uZ2V0Q29udGV4dCgiMmQiKTsKICAgICAgY3R4LmRyYXdJbWFnZShiaXRtYXAsIDAsIDApOwogICAgICBiaXRtYXAuY2xvc2UoKTsKICAgICAgY29uc3QgYmxvYiA9IGF3YWl0IG9mZnNjcmVlbi5jb252ZXJ0VG9CbG9iKGRhdGFVUkxPcHRpb25zKTsKICAgICAgY29uc3QgdHlwZSA9IGJsb2IudHlwZTsKICAgICAgY29uc3QgYXJyYXlCdWZmZXIgPSBhd2FpdCBibG9iLmFycmF5QnVmZmVyKCk7CiAgICAgIGNvbnN0IGJhc2U2NCA9IGVuY29kZShhcnJheUJ1ZmZlcik7CiAgICAgIGlmICghbGFzdEJsb2JNYXAuaGFzKGlkKSAmJiBhd2FpdCB0cmFuc3BhcmVudEJhc2U2NCA9PT0gYmFzZTY0KSB7CiAgICAgICAgbGFzdEJsb2JNYXAuc2V0KGlkLCBiYXNlNjQpOwogICAgICAgIHJldHVybiB3b3JrZXIucG9zdE1lc3NhZ2UoeyBpZCB9KTsKICAgICAgfQogICAgICBpZiAobGFzdEJsb2JNYXAuZ2V0KGlkKSA9PT0gYmFzZTY0KSByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQgfSk7CiAgICAgIHdvcmtlci5wb3N0TWVzc2FnZSh7CiAgICAgICAgaWQsCiAgICAgICAgdHlwZSwKICAgICAgICBiYXNlNjQsCiAgICAgICAgd2lkdGgsCiAgICAgICAgaGVpZ2h0CiAgICAgIH0pOwogICAgICBsYXN0QmxvYk1hcC5zZXQoaWQsIGJhc2U2NCk7CiAgICB9IGVsc2UgewogICAgICByZXR1cm4gd29ya2VyLnBvc3RNZXNzYWdlKHsgaWQ6IGUuZGF0YS5pZCB9KTsKICAgIH0KICB9Owp9KSgpOwovLyMgc291cmNlTWFwcGluZ1VSTD1pbWFnZS1iaXRtYXAtZGF0YS11cmwtd29ya2VyLUlKcEM3Z19iLmpzLm1hcAo=",UZt=function(t){return Uint8Array.from(atob(t),function(e){return e.charCodeAt(0)})},R4e=typeof window<"u"&&window.Blob&&new Blob([UZt(rlt)],{type:"text/javascript;charset=utf-8"});function zZt(t){var e;try{if(e=R4e&&(window.URL||window.webkitURL).createObjectURL(R4e),!e)throw"";var n=new Worker(e,{name:t==null?void 0:t.name});return n.addEventListener("error",function(){(window.URL||window.webkitURL).revokeObjectURL(e)}),n}catch{return new Worker("data:text/javascript;base64,"+rlt,{name:t==null?void 0:t.name})}finally{e&&(window.URL||window.webkitURL).revokeObjectURL(e)}}var VZt=function(){function t(n){var r=this;En(this,"pendingCanvasMutations",new Map),En(this,"rafStamps",{latestId:0,invokeId:null}),En(this,"mirror"),En(this,"mutationCb"),En(this,"resetObservers"),En(this,"frozen",!1),En(this,"locked",!1),En(this,"processMutation",function(h,m){var f=r.rafStamps.invokeId&&r.rafStamps.latestId!==r.rafStamps.invokeId;(f||!r.rafStamps.invokeId)&&(r.rafStamps.invokeId=r.rafStamps.latestId),r.pendingCanvasMutations.has(h)||r.pendingCanvasMutations.set(h,[]),r.pendingCanvasMutations.get(h).push(m)});var s=n.sampling,i=s===void 0?"all":s,o=n.win,l=n.blockClass,c=n.blockSelector,d=n.recordCanvas,u=n.dataURLOptions;this.mutationCb=n.mutationCb,this.mirror=n.mirror,d&&i==="all"&&this.initCanvasMutationObserver(o,l,c),d&&typeof i=="number"&&this.initCanvasFPSObserver(i,o,l,c,{dataURLOptions:u})}var e=t.prototype;return e.reset=function(){this.pendingCanvasMutations.clear(),this.resetObservers&&this.resetObservers()},e.freeze=function(){this.frozen=!0},e.unfreeze=function(){this.frozen=!1},e.lock=function(){this.locked=!0},e.unlock=function(){this.locked=!1},e.initCanvasFPSObserver=function(r,s,i,o,l){var c=this,d=A4e(s,i,o,!0),u=new Map,h=new zZt;h.onmessage=function(b){var x=b.data.id;if(u.set(x,!1),"base64"in b.data){var w=b.data,k=w.base64,S=w.type,C=w.width,j=w.height;c.mutationCb({id:x,type:eR["2D"],commands:[{property:"clearRect",args:[0,0,C,j]},{property:"drawImage",args:[{rr_type:"ImageBitmap",args:[{rr_type:"Blob",data:[{rr_type:"ArrayBuffer",base64:k}],type:S}]},0,0]}]})}};var m=1e3/r,f=0,p,g=function(){var b=[];return s.document.querySelectorAll("canvas").forEach(function(x){Cu(x,i,o,!0)||b.push(x)}),b},v=function(b){if(f&&b-f<m){p=requestAnimationFrame(v);return}f=b;var x=c;g().forEach(Nee(function(w){var k,S,C,j;return T2(this,function(E){switch(E.label){case 0:return S=x.mirror.getId(w),u.get(S)?[2]:w.width===0||w.height===0?[2]:(u.set(S,!0),["webgl","webgl2"].includes(w.__context)&&(C=w.getContext(w.__context),((k=C==null?void 0:C.getContextAttributes())==null?void 0:k.preserveDrawingBuffer)===!1&&C.clear(C.COLOR_BUFFER_BIT)),[4,createImageBitmap(w)]);case 1:return j=E.sent(),h.postMessage({id:S,bitmap:j,width:w.width,height:w.height,dataURLOptions:l.dataURLOptions},[j]),[2]}})})),p=requestAnimationFrame(v)};p=requestAnimationFrame(v),this.resetObservers=function(){d(),cancelAnimationFrame(p)}},e.initCanvasMutationObserver=function(r,s,i){this.startRAFTimestamping(),this.startPendingCanvasMutationFlusher();var o=A4e(r,s,i,!1),l=OZt(this.processMutation.bind(this),r,s,i),c=BZt(this.processMutation.bind(this),r,s,i);this.resetObservers=function(){o(),l(),c()}},e.startPendingCanvasMutationFlusher=function(){var r=this;requestAnimationFrame(function(){return r.flushPendingCanvasMutations()})},e.startRAFTimestamping=function(){var r=this,s=function(i){r.rafStamps.latestId=i,requestAnimationFrame(s)};requestAnimationFrame(s)},e.flushPendingCanvasMutations=function(){var r=this;this.pendingCanvasMutations.forEach(function(s,i){var o=r.mirror.getId(i);r.flushPendingCanvasMutationFor(i,o)}),requestAnimationFrame(function(){return r.flushPendingCanvasMutations()})},e.flushPendingCanvasMutationFor=function(r,s){if(!(this.frozen||this.locked)){var i=this.pendingCanvasMutations.get(r);if(!(!i||s===-1)){var o=i.map(function(c){c.type;var d=N2(c,["type"]);return d}),l=i[0].type;this.mutationCb({id:s,type:l,commands:o}),this.pendingCanvasMutations.delete(r)}}},t}(),HZt=function(){function t(n){En(this,"trackedLinkElements",new WeakSet),En(this,"mutationCb"),En(this,"adoptedStyleSheetCb"),En(this,"styleMirror",new dZt),this.mutationCb=n.mutationCb,this.adoptedStyleSheetCb=n.adoptedStyleSheetCb}var e=t.prototype;return e.attachLinkElement=function(r,s){"_cssText"in s.attributes&&this.mutationCb({adds:[],removes:[],texts:[],attributes:[{id:s.id,attributes:s.attributes}]}),this.trackLinkElement(r)},e.trackLinkElement=function(r){this.trackedLinkElements.has(r)||(this.trackedLinkElements.add(r),this.trackStylesheetInLinkElement(r))},e.adoptStyleSheets=function(r,s){var i,o=function(){var h=u.value,m=void 0;i.styleMirror.has(h)?m=i.styleMirror.getId(h):(m=i.styleMirror.add(h),c.push({styleId:m,rules:Array.from(h.rules||CSSRule,function(f,p){return{rule:bat(f,h.href),index:p}})})),l.styleIds.push(m)};if(r.length!==0){for(var l={id:s,styleIds:[]},c=[],d=on(r),u;!(u=d()).done;)i=this,o();c.length>0&&(l.styles=c),this.adoptedStyleSheetCb(l)}},e.reset=function(){this.styleMirror.reset(),this.trackedLinkElements=new WeakSet},e.cleanupStylesheetsForRemovedNode=function(r){var s=this;try{if(r.nodeType===Node.DOCUMENT_NODE){var i=r;if(i.adoptedStyleSheets)for(var o=on(i.adoptedStyleSheets),l;!(l=o()).done;){var c=l.value;this.styleMirror.remove(c)}}if(r.nodeName==="STYLE"){var d=r;d.sheet&&this.styleMirror.remove(d.sheet)}if(r.nodeName==="LINK"&&r.rel==="stylesheet"){var u=r;u.sheet&&this.styleMirror.remove(u.sheet)}r.childNodes&&r.childNodes.forEach(function(h){s.cleanupStylesheetsForRemovedNode(h)})}catch{}},e.trackStylesheetInLinkElement=function(r){},t}(),GZt=function(){function t(){En(this,"nodeMap",new WeakMap),En(this,"active",!1)}var e=t.prototype;return e.inOtherBuffer=function(r,s){var i=this.nodeMap.get(r);return i&&Array.from(i).some(function(o){return o!==s})},e.add=function(r,s){var i=this;this.active||(this.active=!0,requestAnimationFrame(function(){i.nodeMap=new WeakMap,i.active=!1})),this.nodeMap.set(r,(this.nodeMap.get(r)||new Set).add(s))},e.destroy=function(){},t}();function WZt(t){try{var e=new URL(t).origin;return e!=="null"?e:null}catch{return null}}function qZt(t){if(!Array.isArray(t)||t.length===0)throw new Error("[rrweb] allowedIframeOrigins must be a non-empty array of origin strings.");for(var e=new Set,n=0;n<t.length;n++){var r=t[n];if(typeof r!="string")throw new Error("[rrweb] allowedIframeOrigins["+n+"] must be a string, got "+(typeof r>"u"?"undefined":Ir(r))+".");var s=WZt(r);s&&e.add(s)}return Object.freeze(e)}var Ho,wG,Aoe,qK=!1;try{if(Array.from([1],function(t){return t*2})[0]!==2){var Poe=document.createElement("iframe");document.body.appendChild(Poe),Array.from=((L3e=Poe.contentWindow)==null?void 0:L3e.Array.from)||Array.from,document.body.removeChild(Poe)}}catch(t){console.debug("Unable to override Array.from",t)}var jp=WWt();function dS(t){t===void 0&&(t={});var e=t.emit,n=t.checkoutEveryNms,r=t.checkoutEveryNth,s=t.blockClass,i=s===void 0?"rr-block":s,o=t.blockSelector,l=o===void 0?null:o,c=t.ignoreClass,d=c===void 0?"rr-ignore":c,u=t.ignoreSelector,h=u===void 0?null:u,m=t.maskTextClass,f=m===void 0?"rr-mask":m,p=t.maskTextSelector,g=p===void 0?null:p,v=t.inlineStylesheet,b=v===void 0?!0:v,x=t.maskAllInputs,w=t.maskInputOptions,k=t.slimDOMOptions,S=t.maskInputFn,C=t.maskTextFn,j=t.hooks,E=t.packFn,N=t.sampling,A=N===void 0?{}:N,_=t.dataURLOptions,T=_===void 0?{}:_,R=t.mousemoveWait,O=t.recordDOM,F=O===void 0?!0:O,D=t.recordCanvas,I=D===void 0?!1:D,P=t.recordCrossOriginIframes,M=P===void 0?!1:P,z=t.allowedIframeOrigins,G=t.recordAfter,B=G===void 0?t.recordAfter==="DOMContentLoaded"?t.recordAfter:"load":G,H=t.userTriggeredOnInput,W=H===void 0?!1:H,V=t.collectFonts,U=V===void 0?!1:V,ne=t.inlineImages,te=ne===void 0?!1:ne,re=t.plugins,fe=t.keepIframeSrcFn,le=fe===void 0?function(){return!1}:fe,q=t.ignoreCSSAttributes,Y=q===void 0?new Set([]):q,X=t.errorHandler;vZt(X);var Q;M&&z&&z.length>0&&(Q=qZt(z),Q.size===0&&(Q=void 0));var ie=M?window.parent===window:!0,he=!1;if(!ie)try{window.parent.document&&(he=!1)}catch{he=!0}if(ie&&!e)throw new Error("emit function is required");if(!ie&&!he)return function(){};R!==void 0&&A.mousemove===void 0&&(A.mousemove=R),jp.reset();var ye=x===!0?{color:!0,date:!0,"datetime-local":!0,email:!0,month:!0,number:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0,textarea:!0,select:!0,password:!0,hidden:!0}:w!==void 0?w:{password:!0},J=k===!0||k==="all"?{script:!0,comment:!0,headFavicon:!0,headWhitespace:!0,headMetaSocial:!0,headMetaRobots:!0,headMetaHttpEquiv:!0,headMetaVerification:!0,headMetaAuthorship:k==="all",headMetaDescKeywords:k==="all",headTitleMutations:k==="all"}:k||{};cZt();var K,ce=0,pe=function(wt){for(var Ee=on(re||[]),Ge;!(Ge=Ee()).done;){var Pt=Ge.value;Pt.eventProcessor&&(wt=Pt.eventProcessor(wt))}return E&&!he&&(wt=E(wt)),wt};Ho=function(wt,Ee){var Ge,Pt=wt;if(Pt.timestamp=GK(),(Ge=Jv[0])!=null&&Ge.isFrozen()&&Pt.type!==ri.FullSnapshot&&!(Pt.type===ri.IncrementalSnapshot&&Pt.data.source===ps.Mutation)&&Jv.forEach(function(Kn){return Kn.unfreeze()}),ie)e==null||e(pe(Pt),Ee);else if(he){var vn={type:"rrweb",event:pe(Pt),origin:window.location.origin,isCheckout:Ee};if(Q)for(var Hn=on(Q),yr;!(yr=Hn()).done;){var br=yr.value;window.parent.postMessage(vn,br)}else window.parent.postMessage(vn,"*")}if(Pt.type===ri.FullSnapshot)K=Pt,ce=0;else if(Pt.type===ri.IncrementalSnapshot){if(Pt.data.source===ps.Mutation&&Pt.data.isAttachIframe)return;ce++;var Yt=r&&ce>=r,nr=n&&Pt.timestamp-K.timestamp>n;(Yt||nr)&&wG(!0)}};for(var Ie=function(wt){Ho({type:ri.IncrementalSnapshot,data:Ps({source:ps.Mutation},wt)})},Me=function(wt){return Ho({type:ri.IncrementalSnapshot,data:Ps({source:ps.Scroll},wt)})},we=function(wt){return Ho({type:ri.IncrementalSnapshot,data:Ps({source:ps.CanvasMutation},wt)})},Be=function(wt){return Ho({type:ri.IncrementalSnapshot,data:Ps({source:ps.AdoptedStyleSheet},wt)})},Ve=new HZt({mutationCb:Ie,adoptedStyleSheetCb:Be}),be=new IZt({mirror:jp,mutationCb:Ie,stylesheetManager:Ve,recordCrossOriginIframes:M,wrappedEmit:Ho}),Ze=on(re||[]),Pe;!(Pe=Ze()).done;){var Ke=Pe.value;Ke.getMirror&&Ke.getMirror({nodeMirror:jp,crossOriginIframeMirror:be.crossOriginIframeMirror,crossOriginIframeStyleMirror:be.crossOriginIframeStyleMirror})}var De=new GZt;Aoe=new VZt({recordCanvas:I,mutationCb:we,win:window,blockClass:i,blockSelector:l,mirror:jp,sampling:A.canvas,dataURLOptions:T});var xt=new MZt({mutationCb:Ie,scrollCb:Me,bypassOptions:{blockClass:i,blockSelector:l,maskTextClass:f,maskTextSelector:g,inlineStylesheet:b,maskInputOptions:ye,dataURLOptions:T,maskTextFn:C,maskInputFn:S,recordCanvas:I,inlineImages:te,sampling:A,slimDOMOptions:J,iframeManager:be,stylesheetManager:Ve,canvasManager:Aoe,keepIframeSrcFn:le,processedNodeManager:De},mirror:jp});wG=function(wt){if(wt===void 0&&(wt=!1),!!F){Ho({type:ri.Meta,data:{href:window.location.href,width:zot(),height:Uot()}},wt),Ve.reset(),xt.init(),Jv.forEach(function(Ge){return Ge.lock()});var Ee=gqt(document,{mirror:jp,blockClass:i,blockSelector:l,maskTextClass:f,maskTextSelector:g,inlineStylesheet:b,maskAllInputs:ye,maskTextFn:C,maskInputFn:S,slimDOM:J,dataURLOptions:T,recordCanvas:I,inlineImages:te,onSerialize:function(Ge){Got(Ge,jp)&&be.addIframe(Ge),Wot(Ge,jp)&&Ve.trackLinkElement(Ge),Epe(Ge)&&xt.addShadowRoot(ei.shadowRoot(Ge),document)},onIframeLoad:function(Ge,Pt){be.attachIframe(Ge,Pt),xt.observeAttachShadow(Ge)},onStylesheetLoad:function(Ge,Pt){Ve.attachLinkElement(Ge,Pt)},keepIframeSrcFn:le});if(!Ee)return console.warn("Failed to snapshot the document");Ho({type:ri.FullSnapshot,data:{node:Ee,initialOffset:Bot(window)}},wt),Jv.forEach(function(Ge){return Ge.unlock()}),document.adoptedStyleSheets&&document.adoptedStyleSheets.length>0&&Ve.adoptStyleSheets(document.adoptedStyleSheets,jp.getId(document))}};try{var Xe=[],tt=function(wt){var Ee;return oi(RZt)({mutationCb:Ie,mousemoveCb:function(Ge,Pt){return Ho({type:ri.IncrementalSnapshot,data:{source:Pt,positions:Ge}})},mouseInteractionCb:function(Ge){return Ho({type:ri.IncrementalSnapshot,data:Ps({source:ps.MouseInteraction},Ge)})},scrollCb:Me,viewportResizeCb:function(Ge){return Ho({type:ri.IncrementalSnapshot,data:Ps({source:ps.ViewportResize},Ge)})},inputCb:function(Ge){return Ho({type:ri.IncrementalSnapshot,data:Ps({source:ps.Input},Ge)})},mediaInteractionCb:function(Ge){return Ho({type:ri.IncrementalSnapshot,data:Ps({source:ps.MediaInteraction},Ge)})},styleSheetRuleCb:function(Ge){return Ho({type:ri.IncrementalSnapshot,data:Ps({source:ps.StyleSheetRule},Ge)})},styleDeclarationCb:function(Ge){return Ho({type:ri.IncrementalSnapshot,data:Ps({source:ps.StyleDeclaration},Ge)})},canvasMutationCb:we,fontCb:function(Ge){return Ho({type:ri.IncrementalSnapshot,data:Ps({source:ps.Font},Ge)})},selectionCb:function(Ge){Ho({type:ri.IncrementalSnapshot,data:Ps({source:ps.Selection},Ge)})},customElementCb:function(Ge){Ho({type:ri.IncrementalSnapshot,data:Ps({source:ps.CustomElement},Ge)})},blockClass:i,ignoreClass:d,ignoreSelector:h,maskTextClass:f,maskTextSelector:g,maskInputOptions:ye,inlineStylesheet:b,sampling:A,recordDOM:F,recordCanvas:I,inlineImages:te,userTriggeredOnInput:W,collectFonts:U,doc:wt,maskInputFn:S,maskTextFn:C,keepIframeSrcFn:le,blockSelector:l,slimDOMOptions:J,dataURLOptions:T,mirror:jp,iframeManager:be,stylesheetManager:Ve,shadowDomManager:xt,processedNodeManager:De,canvasManager:Aoe,ignoreCSSAttributes:Y,plugins:((Ee=re==null?void 0:re.filter(function(Ge){return Ge.observer}))==null?void 0:Ee.map(function(Ge){return{observer:Ge.observer,options:Ge.options,callback:function(Pt){return Ho({type:ri.Plugin,data:{plugin:Ge.name,payload:Pt}})}}}))||[]},j)};be.addLoadListener(function(wt){try{var Ee=wt.contentDocument,Ge=tt(Ee);Xe.push(Ge);var Pt=be.getObserverCleanup(wt);be.setObserverCleanup(wt,function(){if(Pt)try{Pt()}catch{}try{Ge();var vn=Xe.indexOf(Ge);vn!==-1&&Xe.splice(vn,1),bZt(Ee)}catch{}})}catch(vn){console.warn(vn)}});var $e=function(){wG(),Xe.push(tt(document)),qK=!0};return document.readyState==="interactive"||document.readyState==="complete"?$e():(Xe.push(Su("DOMContentLoaded",function(){Ho({type:ri.DomContentLoaded,data:{}}),B==="DOMContentLoaded"&&$e()})),Xe.push(Su("load",function(){Ho({type:ri.Load,data:{}}),B==="load"&&$e()},window))),function(){Xe.forEach(function(wt){try{wt()}catch(Ge){var Ee=String(Ge).toLowerCase();Ee.includes("cross-origin")||console.warn(Ge)}}),De.destroy(),qK=!1,yZt()}}catch(wt){console.warn(wt)}}dS.addCustomEvent=function(t,e){if(!qK)throw new Error("please add custom event after start recording");Ho({type:ri.Custom,data:{tag:t,payload:e}})};dS.freezePage=function(){Jv.forEach(function(t){return t.freeze()})};dS.takeFullSnapshot=function(t){if(!qK)throw new Error("please take full snapshot after start recording");wG(t)};dS.mirror=jp;var I4e;(function(t){t[t.NotStarted=0]="NotStarted",t[t.Running=1]="Running",t[t.Stopped=2]="Stopped"})(I4e||(I4e={}));dS.addCustomEvent;dS.freezePage;dS.takeFullSnapshot;var M4e={Node:["childNodes","parentNode","parentElement","textContent"],ShadowRoot:["host","styleSheets"],Element:["shadowRoot","querySelector","querySelectorAll"],MutationObserver:[]},L4e={Node:["contains","getRootNode"],ShadowRoot:["getSelection"],Element:[],MutationObserver:["constructor"]},LU={},KZt=function(){return!!globalThis.Zone};function DCe(t){if(LU[t])return LU[t];var e=globalThis[t],n=e.prototype,r=t in M4e?M4e[t]:void 0,s=!!(r&&r.every(function(u){var h,m;return!!((m=(h=Object.getOwnPropertyDescriptor(n,u))==null?void 0:h.get)!=null&&m.toString().includes("[native code]"))})),i=t in L4e?L4e[t]:void 0,o=!!(i&&i.every(function(u){var h;return typeof n[u]=="function"&&((h=n[u])==null?void 0:h.toString().includes("[native code]"))}));if(s&&o&&!KZt())return LU[t]=e.prototype,e.prototype;try{var l=document.createElement("iframe");document.body.appendChild(l);var c=l.contentWindow;if(!c)return e.prototype;var d=c[t].prototype;return document.body.removeChild(l),d?LU[t]=d:n}catch{return n}}var Roe={};function uS(t,e,n){var r,s=t+"."+String(n);if(Roe[s])return Roe[s].call(e);var i=DCe(t),o=(r=Object.getOwnPropertyDescriptor(i,n))==null?void 0:r.get;return o?(Roe[s]=o,o.call(e)):e[n]}var Ioe={};function slt(t,e,n){var r=t+"."+String(n);if(Ioe[r])return Ioe[r].bind(e);var s=DCe(t),i=s[n];return typeof i!="function"?e[n]:(Ioe[r]=i,i.bind(e))}function YZt(t){return uS("Node",t,"childNodes")}function QZt(t){return uS("Node",t,"parentNode")}function ZZt(t){return uS("Node",t,"parentElement")}function JZt(t){return uS("Node",t,"textContent")}function XZt(t,e){return slt("Node",t,"contains")(e)}function eJt(t){return slt("Node",t,"getRootNode")()}function tJt(t){return!t||!("host"in t)?null:uS("ShadowRoot",t,"host")}function nJt(t){return t.styleSheets}function rJt(t){return!t||!("shadowRoot"in t)?null:uS("Element",t,"shadowRoot")}function sJt(t,e){return uS("Element",t,"querySelector")(e)}function iJt(t,e){return uS("Element",t,"querySelectorAll")(e)}function aJt(){return DCe("MutationObserver").constructor}function oJt(t,e,n){try{if(!(e in t))return function(){};var r=t[e],s=n(r);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:r}})),t[e]=s,function(){t[e]=r}}catch{return function(){}}}var D4e={childNodes:YZt,parentNode:QZt,parentElement:ZZt,textContent:JZt,contains:XZt,getRootNode:eJt,host:tJt,styleSheets:nJt,shadowRoot:rJt,querySelector:sJt,querySelectorAll:iJt,mutationObserver:aJt,patch:oJt};function Tpe(t,e,n){if(!t)return!1;if(t.nodeType!==t.ELEMENT_NODE)return Tpe(D4e.parentNode(t),e);for(var r=t.classList.length;r--;){var s=t.classList[r];if(e.test(s))return!0}return Tpe(D4e.parentNode(t),e)}function lJt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function cJt(t){if(t.__esModule)return t;var e=t.default;if(typeof e=="function"){var n=function r(){return Pr(this,r)?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};n.prototype=e.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(t).forEach(function(r){var s=Object.getOwnPropertyDescriptor(t,r);Object.defineProperty(n,r,s.get?s:{enumerable:!0,get:function(){return t[r]}})}),n}var $Ce={exports:{}},Va=String,ilt=function(){return{isColorSupported:!1,reset:Va,bold:Va,dim:Va,italic:Va,underline:Va,inverse:Va,hidden:Va,strikethrough:Va,black:Va,red:Va,green:Va,yellow:Va,blue:Va,magenta:Va,cyan:Va,white:Va,gray:Va,bgBlack:Va,bgRed:Va,bgGreen:Va,bgYellow:Va,bgBlue:Va,bgMagenta:Va,bgCyan:Va,bgWhite:Va}};$Ce.exports=ilt();$Ce.exports.createColors=ilt;var dJt=$Ce.exports,uJt={},hJt=Object.freeze(Object.defineProperty({__proto__:null,default:uJt},Symbol.toStringTag,{value:"Module"})),Ll=cJt(hJt),$4e=dJt,O4e=Ll,_pe=function(t){Co(e,t);function e(r,s,i,o,l,c){var d;return d=t.call(this,r)||this,d.name="CssSyntaxError",d.reason=r,l&&(d.file=l),o&&(d.source=o),c&&(d.plugin=c),typeof s<"u"&&typeof i<"u"&&(typeof s=="number"?(d.line=s,d.column=i):(d.line=s.line,d.column=s.column,d.endLine=i.line,d.endColumn=i.column)),d.setMessage(),Error.captureStackTrace&&Error.captureStackTrace(d,e),d}var n=e.prototype;return n.setMessage=function(){this.message=this.plugin?this.plugin+": ":"",this.message+=this.file?this.file:"<css input>",typeof this.line<"u"&&(this.message+=":"+this.line+":"+this.column),this.message+=": "+this.reason},n.showSourceCode=function(s){var i=this;if(!this.source)return"";var o=this.source;s==null&&(s=$4e.isColorSupported),O4e&&s&&(o=O4e(o));var l=o.split(/\r?\n/),c=Math.max(this.line-3,0),d=Math.min(this.line+2,l.length),u=String(d).length,h,m;if(s){var f=$4e.createColors(!0),p=f.bold,g=f.gray,v=f.red;h=function(b){return p(v(b))},m=function(b){return g(b)}}else h=m=function(b){return b};return l.slice(c,d).map(function(b,x){var w=c+1+x,k=" "+(" "+w).slice(-u)+" | ";if(w===i.line){var S=m(k.replace(/\d/g," "))+b.slice(0,i.column-1).replace(/[^\t]/g," ");return h(">")+m(k)+b+`
 `+S+h("^")}return" "+m(k)+b}).join(`
`)},n.toString=function(){var s=this.showSourceCode();return s&&(s=`

`+s+`
`),this.name+": "+this.message+s},e}(EO(Error)),OCe=_pe;_pe.default=_pe;var hS={};hS.isClean=Symbol("isClean");hS.my=Symbol("my");var F4e={after:`
`,beforeClose:`
`,beforeComment:`
`,beforeDecl:`
`,beforeOpen:" ",beforeRule:`
`,colon:": ",commentLeft:" ",commentRight:" ",emptyBody:"",indent:"    ",semicolon:!1};function mJt(t){return t[0].toUpperCase()+t.slice(1)}var Ape=function(){function t(n){this.builder=n}var e=t.prototype;return e.atrule=function(r,s){var i="@"+r.name,o=r.params?this.rawValue(r,"params"):"";if(typeof r.raws.afterName<"u"?i+=r.raws.afterName:o&&(i+=" "),r.nodes)this.block(r,i+o);else{var l=(r.raws.between||"")+(s?";":"");this.builder(i+o+l,r)}},e.beforeAfter=function(r,s){var i;r.type==="decl"?i=this.raw(r,null,"beforeDecl"):r.type==="comment"?i=this.raw(r,null,"beforeComment"):s==="before"?i=this.raw(r,null,"beforeRule"):i=this.raw(r,null,"beforeClose");for(var o=r.parent,l=0;o&&o.type!=="root";)l+=1,o=o.parent;if(i.includes(`
`)){var c=this.raw(r,null,"indent");if(c.length)for(var d=0;d<l;d++)i+=c}return i},e.block=function(r,s){var i=this.raw(r,"between","beforeOpen");this.builder(s+i+"{",r,"start");var o;r.nodes&&r.nodes.length?(this.body(r),o=this.raw(r,"after")):o=this.raw(r,"after","emptyBody"),o&&this.builder(o),this.builder("}",r,"end")},e.body=function(r){for(var s=r.nodes.length-1;s>0&&r.nodes[s].type==="comment";)s-=1;for(var i=this.raw(r,"semicolon"),o=0;o<r.nodes.length;o++){var l=r.nodes[o],c=this.raw(l,"before");c&&this.builder(c),this.stringify(l,s!==o||i)}},e.comment=function(r){var s=this.raw(r,"left","commentLeft"),i=this.raw(r,"right","commentRight");this.builder("/*"+s+r.text+i+"*/",r)},e.decl=function(r,s){var i=this.raw(r,"between","colon"),o=r.prop+i+this.rawValue(r,"value");r.important&&(o+=r.raws.important||" !important"),s&&(o+=";"),this.builder(o,r)},e.document=function(r){this.body(r)},e.raw=function(r,s,i){var o;if(i||(i=s),s&&(o=r.raws[s],typeof o<"u"))return o;var l=r.parent;if(i==="before"&&(!l||l.type==="root"&&l.first===r||l&&l.type==="document"))return"";if(!l)return F4e[i];var c=r.root();if(c.rawCache||(c.rawCache={}),typeof c.rawCache[i]<"u")return c.rawCache[i];if(i==="before"||i==="after")return this.beforeAfter(r,i);var d="raw"+mJt(i);return this[d]?o=this[d](c,r):c.walk(function(u){if(o=u.raws[s],typeof o<"u")return!1}),typeof o>"u"&&(o=F4e[i]),c.rawCache[i]=o,o},e.rawBeforeClose=function(r){var s;return r.walk(function(i){if(i.nodes&&i.nodes.length>0&&typeof i.raws.after<"u")return s=i.raws.after,s.includes(`
`)&&(s=s.replace(/[^\n]+$/,"")),!1}),s&&(s=s.replace(/\S/g,"")),s},e.rawBeforeComment=function(r,s){var i;return r.walkComments(function(o){if(typeof o.raws.before<"u")return i=o.raws.before,i.includes(`
`)&&(i=i.replace(/[^\n]+$/,"")),!1}),typeof i>"u"?i=this.raw(s,null,"beforeDecl"):i&&(i=i.replace(/\S/g,"")),i},e.rawBeforeDecl=function(r,s){var i;return r.walkDecls(function(o){if(typeof o.raws.before<"u")return i=o.raws.before,i.includes(`
`)&&(i=i.replace(/[^\n]+$/,"")),!1}),typeof i>"u"?i=this.raw(s,null,"beforeRule"):i&&(i=i.replace(/\S/g,"")),i},e.rawBeforeOpen=function(r){var s;return r.walk(function(i){if(i.type!=="decl"&&(s=i.raws.between,typeof s<"u"))return!1}),s},e.rawBeforeRule=function(r){var s;return r.walk(function(i){if(i.nodes&&(i.parent!==r||r.first!==i)&&typeof i.raws.before<"u")return s=i.raws.before,s.includes(`
`)&&(s=s.replace(/[^\n]+$/,"")),!1}),s&&(s=s.replace(/\S/g,"")),s},e.rawColon=function(r){var s;return r.walkDecls(function(i){if(typeof i.raws.between<"u")return s=i.raws.between.replace(/[^\s:]/g,""),!1}),s},e.rawEmptyBody=function(r){var s;return r.walk(function(i){if(i.nodes&&i.nodes.length===0&&(s=i.raws.after,typeof s<"u"))return!1}),s},e.rawIndent=function(r){if(r.raws.indent)return r.raws.indent;var s;return r.walk(function(i){var o=i.parent;if(o&&o!==r&&o.parent&&o.parent===r&&typeof i.raws.before<"u"){var l=i.raws.before.split(`
`);return s=l[l.length-1],s=s.replace(/\S/g,""),!1}}),s},e.rawSemicolon=function(r){var s;return r.walk(function(i){if(i.nodes&&i.nodes.length&&i.last.type==="decl"&&(s=i.raws.semicolon,typeof s<"u"))return!1}),s},e.rawValue=function(r,s){var i=r[s],o=r.raws[s];return o&&o.value===i?o.raw:i},e.root=function(r){this.body(r),r.raws.after&&this.builder(r.raws.after)},e.rule=function(r){this.block(r,this.rawValue(r,"selector")),r.raws.ownSemicolon&&this.builder(r.raws.ownSemicolon,r,"end")},e.stringify=function(r,s){if(!this[r.type])throw new Error("Unknown AST node type "+r.type+". Maybe you need to change PostCSS stringifier.");this[r.type](r,s)},t}(),alt=Ape;Ape.default=Ape;var fJt=alt;function Ppe(t,e){var n=new fJt(e);n.stringify(t)}var Fee=Ppe;Ppe.default=Ppe;var DU=hS.isClean,pJt=hS.my,gJt=OCe,vJt=alt,yJt=Fee;function Rpe(t,e){var n=new t.constructor;for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)&&r!=="proxyCache"){var s=t[r],i=typeof s>"u"?"undefined":Ir(s);r==="parent"&&i==="object"?e&&(n[r]=e):r==="source"?n[r]=s:Array.isArray(s)?n[r]=s.map(function(o){return Rpe(o,n)}):(i==="object"&&s!==null&&(s=Rpe(s)),n[r]=s)}return n}var Ipe=function(){function t(n){n===void 0&&(n={}),this.raws={},this[DU]=!1,this[pJt]=!0;for(var r in n)if(r==="nodes"){this.nodes=[];for(var s=on(n[r]),i;!(i=s()).done;){var o=i.value;typeof o.clone=="function"?this.append(o.clone()):this.append(o)}}else this[r]=n[r]}var e=t.prototype;return e.addToError=function(r){if(r.postcssNode=this,r.stack&&this.source&&/\n\s{4}at /.test(r.stack)){var s=this.source;r.stack=r.stack.replace(/\n\s{4}at /,"$&"+s.input.from+":"+s.start.line+":"+s.start.column+"$&")}return r},e.after=function(r){return this.parent.insertAfter(this,r),this},e.assign=function(r){r===void 0&&(r={});for(var s in r)this[s]=r[s];return this},e.before=function(r){return this.parent.insertBefore(this,r),this},e.cleanRaws=function(r){delete this.raws.before,delete this.raws.after,r||delete this.raws.between},e.clone=function(r){r===void 0&&(r={});var s=Rpe(this);for(var i in r)s[i]=r[i];return s},e.cloneAfter=function(r){r===void 0&&(r={});var s=this.clone(r);return this.parent.insertAfter(this,s),s},e.cloneBefore=function(r){r===void 0&&(r={});var s=this.clone(r);return this.parent.insertBefore(this,s),s},e.error=function(r,s){if(s===void 0&&(s={}),this.source){var i=this.rangeBy(s),o=i.end,l=i.start;return this.source.input.error(r,{column:l.column,line:l.line},{column:o.column,line:o.line},s)}return new gJt(r)},e.getProxyProcessor=function(){return{get:function(s,i){return i==="proxyOf"?s:i==="root"?function(){return s.root().toProxy()}:s[i]},set:function(s,i,o){return s[i]===o||(s[i]=o,(i==="prop"||i==="value"||i==="name"||i==="params"||i==="important"||i==="text")&&s.markDirty()),!0}}},e.markDirty=function(){if(this[DU]){this[DU]=!1;for(var r=this;r=r.parent;)r[DU]=!1}},e.next=function(){if(this.parent){var r=this.parent.index(this);return this.parent.nodes[r+1]}},e.positionBy=function(r,s){var i=this.source.start;if(r.index)i=this.positionInside(r.index,s);else if(r.word){s=this.toString();var o=s.indexOf(r.word);o!==-1&&(i=this.positionInside(o,s))}return i},e.positionInside=function(r,s){for(var i=s||this.toString(),o=this.source.start.column,l=this.source.start.line,c=0;c<r;c++)i[c]===`
`?(o=1,l+=1):o+=1;return{column:o,line:l}},e.prev=function(){if(this.parent){var r=this.parent.index(this);return this.parent.nodes[r-1]}},e.rangeBy=function(r){var s={column:this.source.start.column,line:this.source.start.line},i=this.source.end?{column:this.source.end.column+1,line:this.source.end.line}:{column:s.column+1,line:s.line};if(r.word){var o=this.toString(),l=o.indexOf(r.word);l!==-1&&(s=this.positionInside(l,o),i=this.positionInside(l+r.word.length,o))}else r.start?s={column:r.start.column,line:r.start.line}:r.index&&(s=this.positionInside(r.index)),r.end?i={column:r.end.column,line:r.end.line}:typeof r.endIndex=="number"?i=this.positionInside(r.endIndex):r.index&&(i=this.positionInside(r.index+1));return(i.line<s.line||i.line===s.line&&i.column<=s.column)&&(i={column:s.column+1,line:s.line}),{end:i,start:s}},e.raw=function(r,s){var i=new vJt;return i.raw(this,r,s)},e.remove=function(){return this.parent&&this.parent.removeChild(this),this.parent=void 0,this},e.replaceWith=function(){for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];if(this.parent){for(var o=this,l=!1,c=on(s),d;!(d=c()).done;){var u=d.value;u===this?l=!0:l?(this.parent.insertAfter(o,u),o=u):this.parent.insertBefore(o,u)}l||this.remove()}return this},e.root=function(){for(var r=this;r.parent&&r.parent.type!=="document";)r=r.parent;return r},e.toJSON=function(r,s){var i={},o=s==null;s=s||new Map;var l=0;for(var c in this)if(Object.prototype.hasOwnProperty.call(this,c)&&!(c==="parent"||c==="proxyCache")){var d=this[c];if(Array.isArray(d))i[c]=d.map(function(h){return(typeof h>"u"?"undefined":Ir(h))==="object"&&h.toJSON?h.toJSON(null,s):h});else if((typeof d>"u"?"undefined":Ir(d))==="object"&&d.toJSON)i[c]=d.toJSON(null,s);else if(c==="source"){var u=s.get(d.input);u==null&&(u=l,s.set(d.input,l),l++),i[c]={end:d.end,inputId:u,start:d.start}}else i[c]=d}return o&&(i.inputs=[].concat(s.keys()).map(function(h){return h.toJSON()})),i},e.toProxy=function(){return this.proxyCache||(this.proxyCache=new Proxy(this,this.getProxyProcessor())),this.proxyCache},e.toString=function(r){r===void 0&&(r=yJt),r.stringify&&(r=r.stringify);var s="";return r(this,function(i){s+=i}),s},e.warn=function(r,s,i){var o={node:this};for(var l in i)o[l]=i[l];return r.warn(s,o)},uo(t,[{key:"proxyOf",get:function(){return this}}]),t}(),Bee=Ipe;Ipe.default=Ipe;var bJt=Bee,Mpe=function(t){Co(e,t);function e(n){var r;return n&&typeof n.value<"u"&&typeof n.value!="string"&&(n=Ps({},n,{value:String(n.value)})),r=t.call(this,n)||this,r.type="decl",r}return uo(e,[{key:"variable",get:function(){return this.prop.startsWith("--")||this.prop[0]==="$"}}]),e}(bJt),Uee=Mpe;Mpe.default=Mpe;var xJt="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",wJt=function(t){t===void 0&&(t=21);for(var e="",n=t;n--;)e+=xJt[Math.random()*64|0];return e},kJt={nanoid:wJt},B4e=Ll.SourceMapConsumer,U4e=Ll.SourceMapGenerator,SJt=Ll.existsSync,CJt=Ll.readFileSync,Moe=Ll.dirname,jJt=Ll.join;function EJt(t){return Buffer?Buffer.from(t,"base64").toString():window.atob(t)}var Lpe=function(){function t(n,r){if(r.map!==!1){this.loadAnnotation(n),this.inline=this.startWith(this.annotation,"data:");var s=r.map?r.map.prev:void 0,i=this.loadMap(r.from,s);!this.mapFile&&r.from&&(this.mapFile=r.from),this.mapFile&&(this.root=Moe(this.mapFile)),i&&(this.text=i)}}var e=t.prototype;return e.consumer=function(){return this.consumerCache||(this.consumerCache=new B4e(this.text)),this.consumerCache},e.decodeInline=function(r){var s=/^data:application\/json;charset=utf-?8;base64,/,i=/^data:application\/json;base64,/,o=/^data:application\/json;charset=utf-?8,/,l=/^data:application\/json,/;if(o.test(r)||l.test(r))return decodeURIComponent(r.substr(RegExp.lastMatch.length));if(s.test(r)||i.test(r))return EJt(r.substr(RegExp.lastMatch.length));var c=r.match(/data:application\/json;([^,]+),/)[1];throw new Error("Unsupported source map encoding "+c)},e.getAnnotationURL=function(r){return r.replace(/^\/\*\s*# sourceMappingURL=/,"").trim()},e.isMap=function(r){return(typeof r>"u"?"undefined":Ir(r))!=="object"?!1:typeof r.mappings=="string"||typeof r._mappings=="string"||Array.isArray(r.sections)},e.loadAnnotation=function(r){var s=r.match(/\/\*\s*# sourceMappingURL=/gm);if(s){var i=r.lastIndexOf(s.pop()),o=r.indexOf("*/",i);i>-1&&o>-1&&(this.annotation=this.getAnnotationURL(r.substring(i,o)))}},e.loadFile=function(r){if(this.root=Moe(r),SJt(r))return this.mapFile=r,CJt(r,"utf-8").toString().trim()},e.loadMap=function(r,s){if(s===!1)return!1;if(s){if(typeof s=="string")return s;if(typeof s=="function"){var i=s(r);if(i){var o=this.loadFile(i);if(!o)throw new Error("Unable to load previous source map: "+i.toString());return o}}else{if(Pr(s,B4e))return U4e.fromSourceMap(s).toString();if(Pr(s,U4e))return s.toString();if(this.isMap(s))return JSON.stringify(s);throw new Error("Unsupported previous source map format: "+s.toString())}}else{if(this.inline)return this.decodeInline(this.annotation);if(this.annotation){var l=this.annotation;return r&&(l=jJt(Moe(r),l)),this.loadFile(l)}}},e.startWith=function(r,s){return r?r.substr(0,s.length)===s:!1},e.withContent=function(){return!!(this.consumer().sourcesContent&&this.consumer().sourcesContent.length>0)},t}(),olt=Lpe;Lpe.default=Lpe;var NJt=Ll.SourceMapConsumer,TJt=Ll.SourceMapGenerator,z4e=Ll.fileURLToPath,$U=Ll.pathToFileURL,Dpe=Ll.isAbsolute,$pe=Ll.resolve,_Jt=kJt.nanoid,Loe=Ll,V4e=OCe,AJt=olt,Doe=Symbol("fromOffsetCache"),PJt=!!(NJt&&TJt),H4e=!!($pe&&Dpe),KK=function(){function t(n,r){if(r===void 0&&(r={}),n===null||typeof n>"u"||(typeof n>"u"?"undefined":Ir(n))==="object"&&!n.toString)throw new Error("PostCSS received "+n+" instead of CSS string");if(this.css=n.toString(),this.css[0]==="\uFEFF"||this.css[0]==="￾"?(this.hasBOM=!0,this.css=this.css.slice(1)):this.hasBOM=!1,r.from&&(!H4e||/^\w+:\/\//.test(r.from)||Dpe(r.from)?this.file=r.from:this.file=$pe(r.from)),H4e&&PJt){var s=new AJt(this.css,r);if(s.text){this.map=s;var i=s.consumer().file;!this.file&&i&&(this.file=this.mapResolve(i))}}this.file||(this.id="<input css "+_Jt(6)+">"),this.map&&(this.map.file=this.from)}var e=t.prototype;return e.error=function(r,s,i,o){o===void 0&&(o={});var l,c,d;if(s&&(typeof s>"u"?"undefined":Ir(s))==="object"){var u=s,h=i;if(typeof u.offset=="number"){var m=this.fromOffset(u.offset);s=m.line,i=m.col}else s=u.line,i=u.column;if(typeof h.offset=="number"){var f=this.fromOffset(h.offset);c=f.line,d=f.col}else c=h.line,d=h.column}else if(!i){var p=this.fromOffset(s);s=p.line,i=p.col}var g=this.origin(s,i,c,d);return g?l=new V4e(r,g.endLine===void 0?g.line:{column:g.column,line:g.line},g.endLine===void 0?g.column:{column:g.endColumn,line:g.endLine},g.source,g.file,o.plugin):l=new V4e(r,c===void 0?s:{column:i,line:s},c===void 0?i:{column:d,line:c},this.css,this.file,o.plugin),l.input={column:i,endColumn:d,endLine:c,line:s,source:this.css},this.file&&($U&&(l.input.url=$U(this.file).toString()),l.input.file=this.file),l},e.fromOffset=function(r){var s,i;if(this[Doe])i=this[Doe];else{var o=this.css.split(`
`);i=new Array(o.length);for(var l=0,c=0,d=o.length;c<d;c++)i[c]=l,l+=o[c].length+1;this[Doe]=i}s=i[i.length-1];var u=0;if(r>=s)u=i.length-1;else for(var h=i.length-2,m;u<h;)if(m=u+(h-u>>1),r<i[m])h=m-1;else if(r>=i[m+1])u=m+1;else{u=m;break}return{col:r-i[u]+1,line:u+1}},e.mapResolve=function(r){return/^\w+:\/\//.test(r)?r:$pe(this.map.consumer().sourceRoot||this.map.root||".",r)},e.origin=function(r,s,i,o){if(!this.map)return!1;var l=this.map.consumer(),c=l.originalPositionFor({column:s,line:r});if(!c.source)return!1;var d;typeof i=="number"&&(d=l.originalPositionFor({column:o,line:i}));var u;Dpe(c.source)?u=$U(c.source):u=new URL(c.source,this.map.consumer().sourceRoot||$U(this.map.mapFile));var h={column:c.column,endColumn:d&&d.column,endLine:d&&d.line,line:c.line,url:u.toString()};if(u.protocol==="file:")if(z4e)h.file=z4e(u);else throw new Error("file: protocol is not available in this PostCSS build");var m=l.sourceContentFor(c.source);return m&&(h.source=m),h},e.toJSON=function(){for(var r={},s=0,i=["hasBOM","css","file","id"];s<i.length;s++){var o=i[s];this[o]!=null&&(r[o]=this[o])}return this.map&&(r.map=Ps({},this.map),r.map.consumerCache&&(r.map.consumerCache=void 0)),r},uo(t,[{key:"from",get:function(){return this.file||this.id}}]),t}(),zee=KK;KK.default=KK;Loe&&Loe.registerInput&&Loe.registerInput(KK);var llt=Ll.SourceMapConsumer,kG=Ll.SourceMapGenerator,SG=Ll.dirname,clt=Ll.relative,dlt=Ll.resolve,ult=Ll.sep,G4e=Ll.pathToFileURL,RJt=zee,IJt=!!(llt&&kG),MJt=!!(SG&&dlt&&clt&&ult),LJt=function(){function t(n,r,s,i){this.stringify=n,this.mapOpts=s.map||{},this.root=r,this.opts=s,this.css=i,this.originalCSS=i,this.usesFileUrls=!this.mapOpts.from&&this.mapOpts.absolute,this.memoizedFileURLs=new Map,this.memoizedPaths=new Map,this.memoizedURLs=new Map}var e=t.prototype;return e.addAnnotation=function(){var r;this.isInline()?r="data:application/json;base64,"+this.toBase64(this.map.toString()):typeof this.mapOpts.annotation=="string"?r=this.mapOpts.annotation:typeof this.mapOpts.annotation=="function"?r=this.mapOpts.annotation(this.opts.to,this.root):r=this.outputFile()+".map";var s=`
`;this.css.includes(`\r
`)&&(s=`\r
`),this.css+=s+"/*# sourceMappingURL="+r+" */"},e.applyPrevMaps=function(){for(var r=on(this.previous()),s;!(s=r()).done;){var i=s.value,o=this.toUrl(this.path(i.file)),l=i.root||SG(i.file),c=void 0;this.mapOpts.sourcesContent===!1?(c=new llt(i.text),c.sourcesContent&&(c.sourcesContent=null)):c=i.consumer(),this.map.applySourceMap(c,o,this.toUrl(this.path(l)))}},e.clearAnnotation=function(){if(this.mapOpts.annotation!==!1)if(this.root)for(var r,s=this.root.nodes.length-1;s>=0;s--)r=this.root.nodes[s],r.type==="comment"&&r.text.indexOf("# sourceMappingURL=")===0&&this.root.removeChild(s);else this.css&&(this.css=this.css.replace(/\n*?\/\*#[\S\s]*?\*\/$/gm,""))},e.generate=function(){if(this.clearAnnotation(),MJt&&IJt&&this.isMap())return this.generateMap();var r="";return this.stringify(this.root,function(s){r+=s}),[r]},e.generateMap=function(){if(this.root)this.generateString();else if(this.previous().length===1){var r=this.previous()[0].consumer();r.file=this.outputFile(),this.map=kG.fromSourceMap(r,{ignoreInvalidMapping:!0})}else this.map=new kG({file:this.outputFile(),ignoreInvalidMapping:!0}),this.map.addMapping({generated:{column:0,line:1},original:{column:0,line:1},source:this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>"});return this.isSourcesContent()&&this.setSourcesContent(),this.root&&this.previous().length>0&&this.applyPrevMaps(),this.isAnnotation()&&this.addAnnotation(),this.isInline()?[this.css]:[this.css,this.map]},e.generateString=function(){var r=this;this.css="",this.map=new kG({file:this.outputFile(),ignoreInvalidMapping:!0});var s=1,i=1,o="<no source>",l={generated:{column:0,line:0},original:{column:0,line:0},source:""},c,d;this.stringify(this.root,function(u,h,m){if(r.css+=u,h&&m!=="end"&&(l.generated.line=s,l.generated.column=i-1,h.source&&h.source.start?(l.source=r.sourcePath(h),l.original.line=h.source.start.line,l.original.column=h.source.start.column-1,r.map.addMapping(l)):(l.source=o,l.original.line=1,l.original.column=0,r.map.addMapping(l))),c=u.match(/\n/g),c?(s+=c.length,d=u.lastIndexOf(`
`),i=u.length-d):i+=u.length,h&&m!=="start"){var f=h.parent||{raws:{}},p=h.type==="decl"||h.type==="atrule"&&!h.nodes;(!p||h!==f.last||f.raws.semicolon)&&(h.source&&h.source.end?(l.source=r.sourcePath(h),l.original.line=h.source.end.line,l.original.column=h.source.end.column-1,l.generated.line=s,l.generated.column=i-2,r.map.addMapping(l)):(l.source=o,l.original.line=1,l.original.column=0,l.generated.line=s,l.generated.column=i-1,r.map.addMapping(l)))}})},e.isAnnotation=function(){return this.isInline()?!0:typeof this.mapOpts.annotation<"u"?this.mapOpts.annotation:this.previous().length?this.previous().some(function(r){return r.annotation}):!0},e.isInline=function(){if(typeof this.mapOpts.inline<"u")return this.mapOpts.inline;var r=this.mapOpts.annotation;return typeof r<"u"&&r!==!0?!1:this.previous().length?this.previous().some(function(s){return s.inline}):!0},e.isMap=function(){return typeof this.opts.map<"u"?!!this.opts.map:this.previous().length>0},e.isSourcesContent=function(){return typeof this.mapOpts.sourcesContent<"u"?this.mapOpts.sourcesContent:this.previous().length?this.previous().some(function(r){return r.withContent()}):!0},e.outputFile=function(){return this.opts.to?this.path(this.opts.to):this.opts.from?this.path(this.opts.from):"to.css"},e.path=function(r){if(this.mapOpts.absolute||r.charCodeAt(0)===60||/^\w+:\/\//.test(r))return r;var s=this.memoizedPaths.get(r);if(s)return s;var i=this.opts.to?SG(this.opts.to):".";typeof this.mapOpts.annotation=="string"&&(i=SG(dlt(i,this.mapOpts.annotation)));var o=clt(i,r);return this.memoizedPaths.set(r,o),o},e.previous=function(){var r=this;if(!this.previousMaps)if(this.previousMaps=[],this.root)this.root.walk(function(i){if(i.source&&i.source.input.map){var o=i.source.input.map;r.previousMaps.includes(o)||r.previousMaps.push(o)}});else{var s=new RJt(this.originalCSS,this.opts);s.map&&this.previousMaps.push(s.map)}return this.previousMaps},e.setSourcesContent=function(){var r=this,s={};if(this.root)this.root.walk(function(o){if(o.source){var l=o.source.input.from;if(l&&!s[l]){s[l]=!0;var c=r.usesFileUrls?r.toFileUrl(l):r.toUrl(r.path(l));r.map.setSourceContent(c,o.source.input.css)}}});else if(this.css){var i=this.opts.from?this.toUrl(this.path(this.opts.from)):"<no source>";this.map.setSourceContent(i,this.css)}},e.sourcePath=function(r){return this.mapOpts.from?this.toUrl(this.mapOpts.from):this.usesFileUrls?this.toFileUrl(r.source.input.from):this.toUrl(this.path(r.source.input.from))},e.toBase64=function(r){return Buffer?Buffer.from(r).toString("base64"):window.btoa(unescape(encodeURIComponent(r)))},e.toFileUrl=function(r){var s=this.memoizedFileURLs.get(r);if(s)return s;if(G4e){var i=G4e(r).toString();return this.memoizedFileURLs.set(r,i),i}else throw new Error("`map.absolute` option is not available in this PostCSS build")},e.toUrl=function(r){var s=this.memoizedURLs.get(r);if(s)return s;ult==="\\"&&(r=r.replace(/\\/g,"/"));var i=encodeURI(r).replace(/[#?]/g,encodeURIComponent);return this.memoizedURLs.set(r,i),i},t}(),hlt=LJt,DJt=Bee,Ope=function(t){Co(e,t);function e(n){var r;return r=t.call(this,n)||this,r.type="comment",r}return e}(DJt),Vee=Ope;Ope.default=Ope;var mlt=hS.isClean,flt=hS.my,plt=Uee,glt=Vee,$Jt=Bee,vlt,FCe,BCe,ylt;function blt(t){return t.map(function(e){return e.nodes&&(e.nodes=blt(e.nodes)),delete e.source,e})}function xlt(t){if(t[mlt]=!1,t.proxyOf.nodes)for(var e=on(t.proxyOf.nodes),n;!(n=e()).done;){var r=n.value;xlt(r)}}var Qx=function(t){Co(e,t);function e(){return t.apply(this,arguments)||this}var n=e.prototype;return n.append=function(){for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];for(var l=on(i),c;!(c=l()).done;)for(var d=c.value,u=this.normalize(d,this.last),h=on(u),m;!(m=h()).done;){var f=m.value;this.proxyOf.nodes.push(f)}return this.markDirty(),this},n.cleanRaws=function(s){if(t.prototype.cleanRaws.call(this,s),this.nodes)for(var i=on(this.nodes),o;!(o=i()).done;){var l=o.value;l.cleanRaws(s)}},n.each=function(s){if(this.proxyOf.nodes){for(var i=this.getIterator(),o,l;this.indexes[i]<this.proxyOf.nodes.length&&(o=this.indexes[i],l=s(this.proxyOf.nodes[o],o),l!==!1);)this.indexes[i]+=1;return delete this.indexes[i],l}},n.every=function(s){return this.nodes.every(s)},n.getIterator=function(){this.lastEach||(this.lastEach=0),this.indexes||(this.indexes={}),this.lastEach+=1;var s=this.lastEach;return this.indexes[s]=0,s},n.getProxyProcessor=function(){return{get:function(i,o){return o==="proxyOf"?i:i[o]?o==="each"||typeof o=="string"&&o.startsWith("walk")?function(){for(var l=arguments.length,c=new Array(l),d=0;d<l;d++)c[d]=arguments[d];var u;return(u=i)[o].apply(u,[].concat(c.map(function(h){return typeof h=="function"?function(m,f){return h(m.toProxy(),f)}:h})))}:o==="every"||o==="some"?function(l){return i[o](function(c){for(var d=arguments.length,u=new Array(d>1?d-1:0),h=1;h<d;h++)u[h-1]=arguments[h];return l.apply(void 0,[].concat([c.toProxy()],u))})}:o==="root"?function(){return i.root().toProxy()}:o==="nodes"?i.nodes.map(function(l){return l.toProxy()}):o==="first"||o==="last"?i[o].toProxy():i[o]:i[o]},set:function(i,o,l){return i[o]===l||(i[o]=l,(o==="name"||o==="params"||o==="selector")&&i.markDirty()),!0}}},n.index=function(s){return typeof s=="number"?s:(s.proxyOf&&(s=s.proxyOf),this.proxyOf.nodes.indexOf(s))},n.insertAfter=function(s,i){var o=this.index(s),l=this.normalize(i,this.proxyOf.nodes[o]).reverse();o=this.index(s);for(var c=on(l),d;!(d=c()).done;){var u=d.value;this.proxyOf.nodes.splice(o+1,0,u)}var h;for(var m in this.indexes)h=this.indexes[m],o<h&&(this.indexes[m]=h+l.length);return this.markDirty(),this},n.insertBefore=function(s,i){var o=this.index(s),l=o===0?"prepend":!1,c=this.normalize(i,this.proxyOf.nodes[o],l).reverse();o=this.index(s);for(var d=on(c),u;!(u=d()).done;){var h=u.value;this.proxyOf.nodes.splice(o,0,h)}var m;for(var f in this.indexes)m=this.indexes[f],o<=m&&(this.indexes[f]=m+c.length);return this.markDirty(),this},n.normalize=function(s,i){var o=this;if(typeof s=="string")s=blt(vlt(s).nodes);else if(typeof s>"u")s=[];else if(Array.isArray(s)){s=s.slice(0);for(var l=on(s),c;!(c=l()).done;){var d=c.value;d.parent&&d.parent.removeChild(d,"ignore")}}else if(s.type==="root"&&this.type!=="document"){s=s.nodes.slice(0);for(var u=on(s),h;!(h=u()).done;){var m=h.value;m.parent&&m.parent.removeChild(m,"ignore")}}else if(s.type)s=[s];else if(s.prop){if(typeof s.value>"u")throw new Error("Value field is missed in node creation");typeof s.value!="string"&&(s.value=String(s.value)),s=[new plt(s)]}else if(s.selector)s=[new FCe(s)];else if(s.name)s=[new BCe(s)];else if(s.text)s=[new glt(s)];else throw new Error("Unknown node type in node creation");var f=s.map(function(p){return p[flt]||e.rebuild(p),p=p.proxyOf,p.parent&&p.parent.removeChild(p),p[mlt]&&xlt(p),typeof p.raws.before>"u"&&i&&typeof i.raws.before<"u"&&(p.raws.before=i.raws.before.replace(/\S/g,"")),p.parent=o.proxyOf,p});return f},n.prepend=function(){for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];i=i.reverse();for(var l=on(i),c;!(c=l()).done;){for(var d=c.value,u=this.normalize(d,this.first,"prepend").reverse(),h=on(u),m;!(m=h()).done;){var f=m.value;this.proxyOf.nodes.unshift(f)}for(var p in this.indexes)this.indexes[p]=this.indexes[p]+u.length}return this.markDirty(),this},n.push=function(s){return s.parent=this,this.proxyOf.nodes.push(s),this},n.removeAll=function(){for(var s=on(this.proxyOf.nodes),i;!(i=s()).done;){var o=i.value;o.parent=void 0}return this.proxyOf.nodes=[],this.markDirty(),this},n.removeChild=function(s){s=this.index(s),this.proxyOf.nodes[s].parent=void 0,this.proxyOf.nodes.splice(s,1);var i;for(var o in this.indexes)i=this.indexes[o],i>=s&&(this.indexes[o]=i-1);return this.markDirty(),this},n.replaceValues=function(s,i,o){return o||(o=i,i={}),this.walkDecls(function(l){i.props&&!i.props.includes(l.prop)||i.fast&&!l.value.includes(i.fast)||(l.value=l.value.replace(s,o))}),this.markDirty(),this},n.some=function(s){return this.nodes.some(s)},n.walk=function(s){return this.each(function(i,o){var l;try{l=s(i,o)}catch(c){throw i.addToError(c)}return l!==!1&&i.walk&&(l=i.walk(s)),l})},n.walkAtRules=function(s,i){return i?Pr(s,RegExp)?this.walk(function(o,l){if(o.type==="atrule"&&s.test(o.name))return i(o,l)}):this.walk(function(o,l){if(o.type==="atrule"&&o.name===s)return i(o,l)}):(i=s,this.walk(function(o,l){if(o.type==="atrule")return i(o,l)}))},n.walkComments=function(s){return this.walk(function(i,o){if(i.type==="comment")return s(i,o)})},n.walkDecls=function(s,i){return i?Pr(s,RegExp)?this.walk(function(o,l){if(o.type==="decl"&&s.test(o.prop))return i(o,l)}):this.walk(function(o,l){if(o.type==="decl"&&o.prop===s)return i(o,l)}):(i=s,this.walk(function(o,l){if(o.type==="decl")return i(o,l)}))},n.walkRules=function(s,i){return i?Pr(s,RegExp)?this.walk(function(o,l){if(o.type==="rule"&&s.test(o.selector))return i(o,l)}):this.walk(function(o,l){if(o.type==="rule"&&o.selector===s)return i(o,l)}):(i=s,this.walk(function(o,l){if(o.type==="rule")return i(o,l)}))},uo(e,[{key:"first",get:function(){if(this.proxyOf.nodes)return this.proxyOf.nodes[0]}},{key:"last",get:function(){if(this.proxyOf.nodes)return this.proxyOf.nodes[this.proxyOf.nodes.length-1]}}]),e}($Jt);Qx.registerParse=function(t){vlt=t};Qx.registerRule=function(t){FCe=t};Qx.registerAtRule=function(t){BCe=t};Qx.registerRoot=function(t){ylt=t};var AE=Qx;Qx.default=Qx;Qx.rebuild=function(t){t.type==="atrule"?Object.setPrototypeOf(t,BCe.prototype):t.type==="rule"?Object.setPrototypeOf(t,FCe.prototype):t.type==="decl"?Object.setPrototypeOf(t,plt.prototype):t.type==="comment"?Object.setPrototypeOf(t,glt.prototype):t.type==="root"&&Object.setPrototypeOf(t,ylt.prototype),t[flt]=!0,t.nodes&&t.nodes.forEach(function(e){Qx.rebuild(e)})};var OJt=AE,wlt,klt,$O=function(t){Co(e,t);function e(r){var s;return s=t.call(this,Ps({type:"document"},r))||this,s.nodes||(s.nodes=[]),s}var n=e.prototype;return n.toResult=function(s){s===void 0&&(s={});var i=new wlt(new klt,this,s);return i.stringify()},e}(OJt);$O.registerLazyResult=function(t){wlt=t};$O.registerProcessor=function(t){klt=t};var UCe=$O;$O.default=$O;var Fpe=function(){function t(n,r){if(r===void 0&&(r={}),this.type="warning",this.text=n,r.node&&r.node.source){var s=r.node.rangeBy(r);this.line=s.start.line,this.column=s.start.column,this.endLine=s.end.line,this.endColumn=s.end.column}for(var i in r)this[i]=r[i]}var e=t.prototype;return e.toString=function(){return this.node?this.node.error(this.text,{index:this.index,plugin:this.plugin,word:this.word}).message:this.plugin?this.plugin+": "+this.text:this.text},t}(),Slt=Fpe;Fpe.default=Fpe;var FJt=Slt,Bpe=function(){function t(n,r,s){this.processor=n,this.messages=[],this.root=r,this.opts=s,this.css=void 0,this.map=void 0}var e=t.prototype;return e.toString=function(){return this.css},e.warn=function(r,s){s===void 0&&(s={}),s.plugin||this.lastPlugin&&this.lastPlugin.postcssPlugin&&(s.plugin=this.lastPlugin.postcssPlugin);var i=new FJt(r,s);return this.messages.push(i),i},e.warnings=function(){return this.messages.filter(function(r){return r.type==="warning"})},uo(t,[{key:"content",get:function(){return this.css}}]),t}(),zCe=Bpe;Bpe.default=Bpe;var $oe=39,W4e=34,OU=92,q4e=47,FU=10,EL=32,BU=12,UU=9,zU=13,BJt=91,UJt=93,zJt=40,VJt=41,HJt=123,GJt=125,WJt=59,qJt=42,KJt=58,YJt=64,VU=/[\t\n\f\r "#'()/;[\\\]{}]/g,HU=/[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g,QJt=/.[\r\n"'(/\\]/,K4e=/[\da-f]/i,ZJt=function(e,n){n===void 0&&(n={});var r=e.css.valueOf(),s=n.ignoreErrors,i,o,l,c,d,u,h,m,f,p,g=r.length,v=0,b=[],x=[];function w(){return v}function k(E){throw e.error("Unclosed "+E,v)}function S(){return x.length===0&&v>=g}function C(E){if(x.length)return x.pop();if(!(v>=g)){var N=E?E.ignoreUnclosed:!1;switch(i=r.charCodeAt(v),i){case FU:case EL:case UU:case zU:case BU:{o=v;do o+=1,i=r.charCodeAt(o);while(i===EL||i===FU||i===UU||i===zU||i===BU);p=["space",r.slice(v,o)],v=o-1;break}case BJt:case UJt:case HJt:case GJt:case KJt:case WJt:case VJt:{var A=String.fromCharCode(i);p=[A,A,v];break}case zJt:{if(m=b.length?b.pop()[1]:"",f=r.charCodeAt(v+1),m==="url"&&f!==$oe&&f!==W4e&&f!==EL&&f!==FU&&f!==UU&&f!==BU&&f!==zU){o=v;do{if(u=!1,o=r.indexOf(")",o+1),o===-1)if(s||N){o=v;break}else k("bracket");for(h=o;r.charCodeAt(h-1)===OU;)h-=1,u=!u}while(u);p=["brackets",r.slice(v,o+1),v,o],v=o}else o=r.indexOf(")",v+1),c=r.slice(v,o+1),o===-1||QJt.test(c)?p=["(","(",v]:(p=["brackets",c,v,o],v=o);break}case $oe:case W4e:{l=i===$oe?"'":'"',o=v;do{if(u=!1,o=r.indexOf(l,o+1),o===-1)if(s||N){o=v+1;break}else k("string");for(h=o;r.charCodeAt(h-1)===OU;)h-=1,u=!u}while(u);p=["string",r.slice(v,o+1),v,o],v=o;break}case YJt:{VU.lastIndex=v+1,VU.test(r),VU.lastIndex===0?o=r.length-1:o=VU.lastIndex-2,p=["at-word",r.slice(v,o+1),v,o],v=o;break}case OU:{for(o=v,d=!0;r.charCodeAt(o+1)===OU;)o+=1,d=!d;if(i=r.charCodeAt(o+1),d&&i!==q4e&&i!==EL&&i!==FU&&i!==UU&&i!==zU&&i!==BU&&(o+=1,K4e.test(r.charAt(o)))){for(;K4e.test(r.charAt(o+1));)o+=1;r.charCodeAt(o+1)===EL&&(o+=1)}p=["word",r.slice(v,o+1),v,o],v=o;break}default:{i===q4e&&r.charCodeAt(v+1)===qJt?(o=r.indexOf("*/",v+2)+1,o===0&&(s||N?o=r.length:k("comment")),p=["comment",r.slice(v,o+1),v,o],v=o):(HU.lastIndex=v+1,HU.test(r),HU.lastIndex===0?o=r.length-1:o=HU.lastIndex-2,p=["word",r.slice(v,o+1),v,o],b.push(p),v=o);break}}return v++,p}}function j(E){x.push(E)}return{back:j,endOfFile:S,nextToken:C,position:w}},Clt=AE,YK=function(t){Co(e,t);function e(r){var s;return s=t.call(this,r)||this,s.type="atrule",s}var n=e.prototype;return n.append=function(){for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];var l;return this.proxyOf.nodes||(this.nodes=[]),(l=t.prototype.append).call.apply(l,[].concat([this],i))},n.prepend=function(){for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];var l;return this.proxyOf.nodes||(this.nodes=[]),(l=t.prototype.prepend).call.apply(l,[].concat([this],i))},e}(Clt),VCe=YK;YK.default=YK;Clt.registerAtRule(YK);var jlt=AE,Elt,Nlt,tR=function(t){Co(e,t);function e(r){var s;return s=t.call(this,r)||this,s.type="root",s.nodes||(s.nodes=[]),s}var n=e.prototype;return n.normalize=function(s,i,o){var l=t.prototype.normalize.call(this,s);if(i){if(o==="prepend")this.nodes.length>1?i.raws.before=this.nodes[1].raws.before:delete i.raws.before;else if(this.first!==i)for(var c=on(l),d;!(d=c()).done;){var u=d.value;u.raws.before=i.raws.before}}return l},n.removeChild=function(s,i){var o=this.index(s);return!i&&o===0&&this.nodes.length>1&&(this.nodes[1].raws.before=this.nodes[o].raws.before),t.prototype.removeChild.call(this,s)},n.toResult=function(s){s===void 0&&(s={});var i=new Elt(new Nlt,this,s);return i.stringify()},e}(jlt);tR.registerLazyResult=function(t){Elt=t};tR.registerProcessor=function(t){Nlt=t};var Q8=tR;tR.default=tR;jlt.registerRoot(tR);var OO={comma:function(e){return OO.split(e,[","],!0)},space:function(e){var n=[" ",`
`,"	"];return OO.split(e,n)},split:function(e,n,r){for(var s=[],i="",o=!1,l=0,c=!1,d="",u=!1,h=on(e),m;!(m=h()).done;){var f=m.value;u?u=!1:f==="\\"?u=!0:c?f===d&&(c=!1):f==='"'||f==="'"?(c=!0,d=f):f==="("?l+=1:f===")"?l>0&&(l-=1):l===0&&n.includes(f)&&(o=!0),o?(i!==""&&s.push(i.trim()),i="",o=!1):i+=f}return(r||i!=="")&&s.push(i.trim()),s}},Tlt=OO;OO.default=OO;var _lt=AE,JJt=Tlt,QK=function(t){Co(e,t);function e(n){var r;return r=t.call(this,n)||this,r.type="rule",r.nodes||(r.nodes=[]),r}return uo(e,[{key:"selectors",get:function(){return JJt.comma(this.selector)},set:function(r){var s=this.selector?this.selector.match(/,\s*/):null,i=s?s[0]:","+this.raw("between","beforeOpen");this.selector=r.join(i)}}]),e}(_lt),HCe=QK;QK.default=QK;_lt.registerRule(QK);var XJt=Uee,eXt=ZJt,tXt=Vee,nXt=VCe,rXt=Q8,Y4e=HCe,Q4e={empty:!0,space:!0};function sXt(t){for(var e=t.length-1;e>=0;e--){var n=t[e],r=n[3]||n[2];if(r)return r}}var iXt=function(){function t(n){this.input=n,this.root=new rXt,this.current=this.root,this.spaces="",this.semicolon=!1,this.createTokenizer(),this.root.source={input:n,start:{column:1,line:1,offset:0}}}var e=t.prototype;return e.atrule=function(r){var s=new nXt;s.name=r[1].slice(1),s.name===""&&this.unnamedAtrule(s,r),this.init(s,r[2]);for(var i,o,l,c=!1,d=!1,u=[],h=[];!this.tokenizer.endOfFile();){if(r=this.tokenizer.nextToken(),i=r[0],i==="("||i==="["?h.push(i==="("?")":"]"):i==="{"&&h.length>0?h.push("}"):i===h[h.length-1]&&h.pop(),h.length===0)if(i===";"){s.source.end=this.getPosition(r[2]),s.source.end.offset++,this.semicolon=!0;break}else if(i==="{"){d=!0;break}else if(i==="}"){if(u.length>0){for(l=u.length-1,o=u[l];o&&o[0]==="space";)o=u[--l];o&&(s.source.end=this.getPosition(o[3]||o[2]),s.source.end.offset++)}this.end(r);break}else u.push(r);else u.push(r);if(this.tokenizer.endOfFile()){c=!0;break}}s.raws.between=this.spacesAndCommentsFromEnd(u),u.length?(s.raws.afterName=this.spacesAndCommentsFromStart(u),this.raw(s,"params",u),c&&(r=u[u.length-1],s.source.end=this.getPosition(r[3]||r[2]),s.source.end.offset++,this.spaces=s.raws.between,s.raws.between="")):(s.raws.afterName="",s.params=""),d&&(s.nodes=[],this.current=s)},e.checkMissedSemicolon=function(r){var s=this.colon(r);if(s!==!1){for(var i=0,o,l=s-1;l>=0&&(o=r[l],!(o[0]!=="space"&&(i+=1,i===2)));l--);throw this.input.error("Missed semicolon",o[0]==="word"?o[3]+1:o[2])}},e.colon=function(r){for(var s=0,i,o,l,c=on(r.entries()),d;!(d=c()).done;){var u=d.value,h=u[0],m=u[1];if(i=m,o=i[0],o==="("&&(s+=1),o===")"&&(s-=1),s===0&&o===":")if(!l)this.doubleColon(i);else{if(l[0]==="word"&&l[1]==="progid")continue;return h}l=i}return!1},e.comment=function(r){var s=new tXt;this.init(s,r[2]),s.source.end=this.getPosition(r[3]||r[2]),s.source.end.offset++;var i=r[1].slice(2,-2);if(/^\s*$/.test(i))s.text="",s.raws.left=i,s.raws.right="";else{var o=i.match(/^(\s*)([^]*\S)(\s*)$/);s.text=o[2],s.raws.left=o[1],s.raws.right=o[3]}},e.createTokenizer=function(){this.tokenizer=eXt(this.input)},e.decl=function(r,s){var i=new XJt;this.init(i,r[0][2]);var o=r[r.length-1];for(o[0]===";"&&(this.semicolon=!0,r.pop()),i.source.end=this.getPosition(o[3]||o[2]||sXt(r)),i.source.end.offset++;r[0][0]!=="word";)r.length===1&&this.unknownWord(r),i.raws.before+=r.shift()[1];for(i.source.start=this.getPosition(r[0][2]),i.prop="";r.length;){var l=r[0][0];if(l===":"||l==="space"||l==="comment")break;i.prop+=r.shift()[1]}i.raws.between="";for(var c;r.length;)if(c=r.shift(),c[0]===":"){i.raws.between+=c[1];break}else c[0]==="word"&&/\w/.test(c[1])&&this.unknownWord([c]),i.raws.between+=c[1];(i.prop[0]==="_"||i.prop[0]==="*")&&(i.raws.before+=i.prop[0],i.prop=i.prop.slice(1));for(var d=[],u;r.length&&(u=r[0][0],!(u!=="space"&&u!=="comment"));)d.push(r.shift());this.precheckMissedSemicolon(r);for(var h=r.length-1;h>=0;h--){if(c=r[h],c[1].toLowerCase()==="!important"){i.important=!0;var m=this.stringFrom(r,h);m=this.spacesFromEnd(r)+m,m!==" !important"&&(i.raws.important=m);break}else if(c[1].toLowerCase()==="important"){for(var f=r.slice(0),p="",g=h;g>0;g--){var v=f[g][0];if(p.trim().indexOf("!")===0&&v!=="space")break;p=f.pop()[1]+p}p.trim().indexOf("!")===0&&(i.important=!0,i.raws.important=p,r=f)}if(c[0]!=="space"&&c[0]!=="comment")break}var b=r.some(function(x){return x[0]!=="space"&&x[0]!=="comment"});b&&(i.raws.between+=d.map(function(x){return x[1]}).join(""),d=[]),this.raw(i,"value",d.concat(r),s),i.value.includes(":")&&!s&&this.checkMissedSemicolon(r)},e.doubleColon=function(r){throw this.input.error("Double colon",{offset:r[2]},{offset:r[2]+r[1].length})},e.emptyRule=function(r){var s=new Y4e;this.init(s,r[2]),s.selector="",s.raws.between="",this.current=s},e.end=function(r){this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.semicolon=!1,this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.spaces="",this.current.parent?(this.current.source.end=this.getPosition(r[2]),this.current.source.end.offset++,this.current=this.current.parent):this.unexpectedClose(r)},e.endFile=function(){this.current.parent&&this.unclosedBlock(),this.current.nodes&&this.current.nodes.length&&(this.current.raws.semicolon=this.semicolon),this.current.raws.after=(this.current.raws.after||"")+this.spaces,this.root.source.end=this.getPosition(this.tokenizer.position())},e.freeSemicolon=function(r){if(this.spaces+=r[1],this.current.nodes){var s=this.current.nodes[this.current.nodes.length-1];s&&s.type==="rule"&&!s.raws.ownSemicolon&&(s.raws.ownSemicolon=this.spaces,this.spaces="")}},e.getPosition=function(r){var s=this.input.fromOffset(r);return{column:s.col,line:s.line,offset:r}},e.init=function(r,s){this.current.push(r),r.source={input:this.input,start:this.getPosition(s)},r.raws.before=this.spaces,this.spaces="",r.type!=="comment"&&(this.semicolon=!1)},e.other=function(r){for(var s=!1,i=null,o=!1,l=null,c=[],d=r[1].startsWith("--"),u=[],h=r;h;){if(i=h[0],u.push(h),i==="("||i==="[")l||(l=h),c.push(i==="("?")":"]");else if(d&&o&&i==="{")l||(l=h),c.push("}");else if(c.length===0)if(i===";")if(o){this.decl(u,d);return}else break;else if(i==="{"){this.rule(u);return}else if(i==="}"){this.tokenizer.back(u.pop()),s=!0;break}else i===":"&&(o=!0);else i===c[c.length-1]&&(c.pop(),c.length===0&&(l=null));h=this.tokenizer.nextToken()}if(this.tokenizer.endOfFile()&&(s=!0),c.length>0&&this.unclosedBracket(l),s&&o){if(!d)for(;u.length&&(h=u[u.length-1][0],!(h!=="space"&&h!=="comment"));)this.tokenizer.back(u.pop());this.decl(u,d)}else this.unknownWord(u)},e.parse=function(){for(var r;!this.tokenizer.endOfFile();)switch(r=this.tokenizer.nextToken(),r[0]){case"space":this.spaces+=r[1];break;case";":this.freeSemicolon(r);break;case"}":this.end(r);break;case"comment":this.comment(r);break;case"at-word":this.atrule(r);break;case"{":this.emptyRule(r);break;default:this.other(r);break}this.endFile()},e.precheckMissedSemicolon=function(){},e.raw=function(r,s,i,o){for(var l,c,d=i.length,u="",h=!0,m,f,p=0;p<d;p+=1)l=i[p],c=l[0],c==="space"&&p===d-1&&!o?h=!1:c==="comment"?(f=i[p-1]?i[p-1][0]:"empty",m=i[p+1]?i[p+1][0]:"empty",!Q4e[f]&&!Q4e[m]?u.slice(-1)===","?h=!1:u+=l[1]:h=!1):u+=l[1];if(!h){var g=i.reduce(function(v,b){return v+b[1]},"");r.raws[s]={raw:g,value:u}}r[s]=u},e.rule=function(r){r.pop();var s=new Y4e;this.init(s,r[0][2]),s.raws.between=this.spacesAndCommentsFromEnd(r),this.raw(s,"selector",r),this.current=s},e.spacesAndCommentsFromEnd=function(r){for(var s,i="";r.length&&(s=r[r.length-1][0],!(s!=="space"&&s!=="comment"));)i=r.pop()[1]+i;return i},e.spacesAndCommentsFromStart=function(r){for(var s,i="";r.length&&(s=r[0][0],!(s!=="space"&&s!=="comment"));)i+=r.shift()[1];return i},e.spacesFromEnd=function(r){for(var s,i="";r.length&&(s=r[r.length-1][0],s==="space");)i=r.pop()[1]+i;return i},e.stringFrom=function(r,s){for(var i="",o=s;o<r.length;o++)i+=r[o][1];return r.splice(s,r.length-s),i},e.unclosedBlock=function(){var r=this.current.source.start;throw this.input.error("Unclosed block",r.line,r.column)},e.unclosedBracket=function(r){throw this.input.error("Unclosed bracket",{offset:r[2]},{offset:r[2]+1})},e.unexpectedClose=function(r){throw this.input.error("Unexpected }",{offset:r[2]},{offset:r[2]+1})},e.unknownWord=function(r){throw this.input.error("Unknown word",{offset:r[0][2]},{offset:r[0][2]+r[0][1].length})},e.unnamedAtrule=function(r,s){throw this.input.error("At-rule without name",{offset:s[2]},{offset:s[2]+s[1].length})},t}(),aXt=iXt,oXt=AE,lXt=aXt,cXt=zee;function ZK(t,e){var n=new cXt(t,e),r=new lXt(n);try{r.parse()}catch(s){throw s}return r.root}var GCe=ZK;ZK.default=ZK;oXt.registerParse(ZK);var xv=hS.isClean,dXt=hS.my,uXt=hlt,hXt=Fee,mXt=AE,fXt=UCe,Z4e=zCe,pXt=GCe,gXt=Q8,vXt={atrule:"AtRule",comment:"Comment",decl:"Declaration",document:"Document",root:"Root",rule:"Rule"},yXt={AtRule:!0,AtRuleExit:!0,Comment:!0,CommentExit:!0,Declaration:!0,DeclarationExit:!0,Document:!0,DocumentExit:!0,Once:!0,OnceExit:!0,postcssPlugin:!0,prepare:!0,Root:!0,RootExit:!0,Rule:!0,RuleExit:!0},bXt={Once:!0,postcssPlugin:!0,prepare:!0},nR=0;function NL(t){return(typeof t>"u"?"undefined":Ir(t))==="object"&&typeof t.then=="function"}function Alt(t){var e=!1,n=vXt[t.type];return t.type==="decl"?e=t.prop.toLowerCase():t.type==="atrule"&&(e=t.name.toLowerCase()),e&&t.append?[n,n+"-"+e,nR,n+"Exit",n+"Exit-"+e]:e?[n,n+"-"+e,n+"Exit",n+"Exit-"+e]:t.append?[n,nR,n+"Exit"]:[n,n+"Exit"]}function J4e(t){var e;return t.type==="document"?e=["Document",nR,"DocumentExit"]:t.type==="root"?e=["Root",nR,"RootExit"]:e=Alt(t),{eventIndex:0,events:e,iterator:0,node:t,visitorIndex:0,visitors:[]}}function Upe(t){return t[xv]=!1,t.nodes&&t.nodes.forEach(function(e){return Upe(e)}),t}var zpe={},rR=function(){function t(n,r,s){var i=this;this.stringified=!1,this.processed=!1;var o;if((typeof r>"u"?"undefined":Ir(r))==="object"&&r!==null&&(r.type==="root"||r.type==="document"))o=Upe(r);else if(Pr(r,t)||Pr(r,Z4e))o=Upe(r.root),r.map&&(typeof s.map>"u"&&(s.map={}),s.map.inline||(s.map.inline=!1),s.map.prev=r.map);else{var l=pXt;s.syntax&&(l=s.syntax.parse),s.parser&&(l=s.parser),l.parse&&(l=l.parse);try{o=l(r,s)}catch(c){this.processed=!0,this.error=c}o&&!o[dXt]&&mXt.rebuild(o)}this.result=new Z4e(n,o,s),this.helpers=Ps({},zpe,{postcss:zpe,result:this.result}),this.plugins=this.processor.plugins.map(function(c){return(typeof c>"u"?"undefined":Ir(c))==="object"&&c.prepare?Ps({},c,c.prepare(i.result)):c})}var e=t.prototype;return e.async=function(){return this.error?Promise.reject(this.error):this.processed?Promise.resolve(this.result):(this.processing||(this.processing=this.runAsync()),this.processing)},e.catch=function(r){return this.async().catch(r)},e.finally=function(r){return this.async().then(r,r)},e.getAsyncError=function(){throw new Error("Use process(css).then(cb) to work with async plugins")},e.handleError=function(r,s){var i=this.result.lastPlugin;try{if(s&&s.addToError(r),this.error=r,r.name==="CssSyntaxError"&&!r.plugin)r.plugin=i.postcssPlugin,r.setMessage();else if(i.postcssVersion)var o,l,c,d,u}catch(h){console&&console.error&&console.error(h)}return r},e.prepareVisitors=function(){var r=this;this.listeners={};for(var s=function(u,h,m){r.listeners[h]||(r.listeners[h]=[]),r.listeners[h].push([u,m])},i=on(this.plugins),o;!(o=i()).done;){var l=o.value;if((typeof l>"u"?"undefined":Ir(l))==="object")for(var c in l){if(!yXt[c]&&/^[A-Z]/.test(c))throw new Error("Unknown event "+c+" in "+l.postcssPlugin+". Try to update PostCSS ("+this.processor.version+" now).");if(!bXt[c])if(Ir(l[c])==="object")for(var d in l[c])d==="*"?s(l,c,l[c][d]):s(l,c+"-"+d.toLowerCase(),l[c][d]);else typeof l[c]=="function"&&s(l,c,l[c])}}this.hasListener=Object.keys(this.listeners).length>0},e.runAsync=function(){var r=this;return Nee(function(){var s,i,o,l,c,d,u,h,m,f,p,g;return T2(this,function(v){switch(v.label){case 0:r.plugin=0,s=0,v.label=1;case 1:if(!(s<r.plugins.length))return[3,6];if(i=r.plugins[s],o=r.runOnRoot(i),!NL(o))return[3,5];v.label=2;case 2:return v.trys.push([2,4,,5]),[4,o];case 3:return v.sent(),[3,5];case 4:throw l=v.sent(),r.handleError(l);case 5:return s++,[3,1];case 6:if(r.prepareVisitors(),!r.hasListener)return[3,18];c=r.result.root,v.label=7;case 7:if(c[xv])return[3,14];c[xv]=!0,d=[J4e(c)],v.label=8;case 8:if(!(d.length>0))return[3,13];if(u=r.visitTick(d),!NL(u))return[3,12];v.label=9;case 9:return v.trys.push([9,11,,12]),[4,u];case 10:return v.sent(),[3,12];case 11:throw h=v.sent(),m=d[d.length-1].node,r.handleError(h,m);case 12:return[3,8];case 13:return[3,7];case 14:if(!r.listeners.OnceExit)return[3,18];f=function(){var b,x,w,k,S;return T2(this,function(C){switch(C.label){case 0:b=g.value,x=b[0],w=b[1],r.result.lastPlugin=x,C.label=1;case 1:return C.trys.push([1,6,,7]),c.type!=="document"?[3,3]:(k=c.nodes.map(function(j){return w(j,r.helpers)}),[4,Promise.all(k)]);case 2:return C.sent(),[3,5];case 3:return[4,w(c,r.helpers)];case 4:C.sent(),C.label=5;case 5:return[3,7];case 6:throw S=C.sent(),r.handleError(S);case 7:return[2]}})},p=on(r.listeners.OnceExit),v.label=15;case 15:return(g=p()).done?[3,18]:[5,hCe(f())];case 16:v.sent(),v.label=17;case 17:return[3,15];case 18:return r.processed=!0,[2,r.stringify()]}})})()},e.runOnRoot=function(r){var s=this;this.result.lastPlugin=r;try{if((typeof r>"u"?"undefined":Ir(r))==="object"&&r.Once){if(this.result.root.type==="document"){var i=this.result.root.nodes.map(function(o){return r.Once(o,s.helpers)});return NL(i[0])?Promise.all(i):i}return r.Once(this.result.root,this.helpers)}else if(typeof r=="function")return r(this.result.root,this.result)}catch(o){throw this.handleError(o)}},e.stringify=function(){if(this.error)throw this.error;if(this.stringified)return this.result;this.stringified=!0,this.sync();var r=this.result.opts,s=hXt;r.syntax&&(s=r.syntax.stringify),r.stringifier&&(s=r.stringifier),s.stringify&&(s=s.stringify);var i=new uXt(s,this.result.root,this.result.opts),o=i.generate();return this.result.css=o[0],this.result.map=o[1],this.result},e.sync=function(){if(this.error)throw this.error;if(this.processed)return this.result;if(this.processed=!0,this.processing)throw this.getAsyncError();for(var r=on(this.plugins),s;!(s=r()).done;){var i=s.value,o=this.runOnRoot(i);if(NL(o))throw this.getAsyncError()}if(this.prepareVisitors(),this.hasListener){for(var l=this.result.root;!l[xv];)l[xv]=!0,this.walkSync(l);if(this.listeners.OnceExit)if(l.type==="document")for(var c=on(l.nodes),d;!(d=c()).done;){var u=d.value;this.visitSync(this.listeners.OnceExit,u)}else this.visitSync(this.listeners.OnceExit,l)}return this.result},e.then=function(r,s){return this.async().then(r,s)},e.toString=function(){return this.css},e.visitSync=function(r,s){for(var i=on(r),o;!(o=i()).done;){var l=o.value,c=l[0],d=l[1];this.result.lastPlugin=c;var u=void 0;try{u=d(s,this.helpers)}catch(h){throw this.handleError(h,s.proxyOf)}if(s.type!=="root"&&s.type!=="document"&&!s.parent)return!0;if(NL(u))throw this.getAsyncError()}},e.visitTick=function(r){var s=r[r.length-1],i=s.node,o=s.visitors;if(i.type!=="root"&&i.type!=="document"&&!i.parent){r.pop();return}if(o.length>0&&s.visitorIndex<o.length){var l=o[s.visitorIndex],c=l[0],d=l[1];s.visitorIndex+=1,s.visitorIndex===o.length&&(s.visitors=[],s.visitorIndex=0),this.result.lastPlugin=c;try{return d(i.toProxy(),this.helpers)}catch(p){throw this.handleError(p,i)}}if(s.iterator!==0){for(var u=s.iterator,h;h=i.nodes[i.indexes[u]];)if(i.indexes[u]+=1,!h[xv]){h[xv]=!0,r.push(J4e(h));return}s.iterator=0,delete i.indexes[u]}for(var m=s.events;s.eventIndex<m.length;){var f=m[s.eventIndex];if(s.eventIndex+=1,f===nR){i.nodes&&i.nodes.length&&(i[xv]=!0,s.iterator=i.getIterator());return}else if(this.listeners[f]){s.visitors=this.listeners[f];return}}r.pop()},e.walkSync=function(r){var s=this;r[xv]=!0;for(var i=Alt(r),o=on(i),l;!(l=o()).done;){var c=l.value;if(c===nR)r.nodes&&r.each(function(u){u[xv]||s.walkSync(u)});else{var d=this.listeners[c];if(d&&this.visitSync(d,r.toProxy()))return}}},e.warnings=function(){return this.sync().warnings()},uo(t,[{key:"content",get:function(){return this.stringify().content}},{key:"css",get:function(){return this.stringify().css}},{key:"map",get:function(){return this.stringify().map}},{key:"messages",get:function(){return this.sync().messages}},{key:"opts",get:function(){return this.result.opts}},{key:"processor",get:function(){return this.result.processor}},{key:"root",get:function(){return this.sync().root}},{key:Symbol.toStringTag,get:function(){return"LazyResult"}}]),t}();rR.registerPostcss=function(t){zpe=t};var Plt=rR;rR.default=rR;gXt.registerLazyResult(rR);fXt.registerLazyResult(rR);var xXt=hlt,wXt=Fee,kXt=GCe,SXt=zCe,Vpe=function(){function t(n,r,s){r=r.toString(),this.stringified=!1,this._processor=n,this._css=r,this._opts=s,this._map=void 0;var i,o=wXt;this.result=new SXt(this._processor,i,this._opts),this.result.css=r;var l=this;Object.defineProperty(this.result,"root",{get:function(){return l.root}});var c=new xXt(o,i,this._opts,r);if(c.isMap()){var d=c.generate(),u=d[0],h=d[1];u&&(this.result.css=u),h&&(this.result.map=h)}else c.clearAnnotation(),this.result.css=c.css}var e=t.prototype;return e.async=function(){return this.error?Promise.reject(this.error):Promise.resolve(this.result)},e.catch=function(r){return this.async().catch(r)},e.finally=function(r){return this.async().then(r,r)},e.sync=function(){if(this.error)throw this.error;return this.result},e.then=function(r,s){return this.async().then(r,s)},e.toString=function(){return this._css},e.warnings=function(){return[]},uo(t,[{key:"content",get:function(){return this.result.css}},{key:"css",get:function(){return this.result.css}},{key:"map",get:function(){return this.result.map}},{key:"messages",get:function(){return[]}},{key:"opts",get:function(){return this.result.opts}},{key:"processor",get:function(){return this.result.processor}},{key:"root",get:function(){if(this._root)return this._root;var r,s=kXt;try{r=s(this._css,this._opts)}catch(i){this.error=i}if(this.error)throw this.error;return this._root=r,r}},{key:Symbol.toStringTag,get:function(){return"NoWorkResult"}}]),t}(),CXt=Vpe;Vpe.default=Vpe;var jXt=CXt,EXt=Plt,NXt=UCe,TXt=Q8,FO=function(){function t(n){n===void 0&&(n=[]),this.version="8.4.38",this.plugins=this.normalize(n)}var e=t.prototype;return e.normalize=function(r){for(var s=[],i=on(r),o;!(o=i()).done;){var l=o.value;if(l.postcss===!0?l=l():l.postcss&&(l=l.postcss),(typeof l>"u"?"undefined":Ir(l))==="object"&&Array.isArray(l.plugins))s=s.concat(l.plugins);else if((typeof l>"u"?"undefined":Ir(l))==="object"&&l.postcssPlugin)s.push(l);else if(typeof l=="function")s.push(l);else if(!((typeof l>"u"?"undefined":Ir(l))==="object"&&(l.parse||l.stringify)))throw new Error(l+" is not a PostCSS plugin")}return s},e.process=function(r,s){return s===void 0&&(s={}),!this.plugins.length&&!s.parser&&!s.stringifier&&!s.syntax?new jXt(this,r,s):new EXt(this,r,s)},e.use=function(r){return this.plugins=this.plugins.concat(this.normalize([r])),this},t}(),_Xt=FO;FO.default=FO;TXt.registerProcessor(FO);NXt.registerProcessor(FO);var AXt=Uee,PXt=olt,RXt=Vee,IXt=VCe,MXt=zee,LXt=Q8,DXt=HCe;function BO(t,e){if(Array.isArray(t))return t.map(function(h){return BO(h)});var n=t.inputs,r=N2(t,["inputs"]);if(n){e=[];for(var s=on(n),i;!(i=s()).done;){var o=i.value,l=Ps({},o,{__proto__:MXt.prototype});l.map&&(l.map=Ps({},l.map,{__proto__:PXt.prototype})),e.push(l)}}if(r.nodes&&(r.nodes=t.nodes.map(function(h){return BO(h,e)})),r.source){var c=r.source,d=c.inputId,u=N2(c,["inputId"]);r.source=u,d!=null&&(r.source.input=e[d])}if(r.type==="root")return new LXt(r);if(r.type==="decl")return new AXt(r);if(r.type==="rule")return new DXt(r);if(r.type==="comment")return new RXt(r);if(r.type==="atrule")return new IXt(r);throw new Error("Unknown node type: "+t.type)}var $Xt=BO;BO.default=BO;var OXt=OCe,Rlt=Uee,FXt=Plt,BXt=AE,WCe=_Xt,UXt=Fee,zXt=$Xt,Ilt=UCe,VXt=Slt,Mlt=Vee,Llt=VCe,HXt=zCe,GXt=zee,WXt=GCe,qXt=Tlt,Dlt=HCe,$lt=Q8,KXt=Bee;function qi(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return e.length===1&&Array.isArray(e[0])&&(e=e[0]),new WCe(e)}qi.plugin=function(e,n){var r=!1;function s(){for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];console&&console.warn&&!r&&(r=!0,console.warn(e+`: postcss.plugin was deprecated. Migration guide:
https://evilmartians.com/chronicles/postcss-8-plugin-migration`),qP.LANG&&qP.LANG.startsWith("cn")&&console.warn(e+`: 里面 postcss.plugin 被弃用. 迁移指南:
https://www.w3ctech.com/topic/2226`));var d=n.apply(void 0,[].concat(l));return d.postcssPlugin=e,d.postcssVersion=new WCe().version,d}var i;return Object.defineProperty(s,"postcss",{get:function(){return i||(i=s()),i}}),s.process=function(o,l,c){return qi([s(c)]).process(o,l)},s};qi.stringify=UXt;qi.parse=WXt;qi.fromJSON=zXt;qi.list=qXt;qi.comment=function(t){return new Mlt(t)};qi.atRule=function(t){return new Llt(t)};qi.decl=function(t){return new Rlt(t)};qi.rule=function(t){return new Dlt(t)};qi.root=function(t){return new $lt(t)};qi.document=function(t){return new Ilt(t)};qi.CssSyntaxError=OXt;qi.Declaration=Rlt;qi.Container=BXt;qi.Processor=WCe;qi.Document=Ilt;qi.Comment=Mlt;qi.Warning=VXt;qi.AtRule=Llt;qi.Result=HXt;qi.Input=GXt;qi.Rule=Dlt;qi.Root=$lt;qi.Node=KXt;FXt.registerPostcss(qi);var YXt=qi;qi.default=qi;var No=lJt(YXt);No.stringify;No.fromJSON;No.plugin;No.parse;No.list;No.document;No.comment;No.atRule;No.rule;No.decl;No.root;No.CssSyntaxError;No.Declaration;No.Container;No.Processor;No.Document;No.Comment;No.Warning;No.AtRule;No.Result;No.Input;No.Rule;No.Root;No.Node;var QXt=Object.defineProperty,ZXt=function(t,e,n){return e in t?QXt(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n},GU=function(t,e,n){return ZXt(t,(typeof e>"u"?"undefined":Ir(e))!=="symbol"?e+"":e,n)};function JXt(t,e,n){try{if(!(e in t))return function(){};var r=t[e],s=n(r);return typeof s=="function"&&(s.prototype=s.prototype||{},Object.defineProperties(s,{__rrweb_original__:{enumerable:!1,value:r}})),t[e]=s,function(){t[e]=r}}catch{return function(){}}}var HN=function(){function t(n){GU(this,"fileName"),GU(this,"functionName"),GU(this,"lineNumber"),GU(this,"columnNumber"),this.fileName=n.fileName||"",this.functionName=n.functionName||"",this.lineNumber=n.lineNumber,this.columnNumber=n.columnNumber}var e=t.prototype;return e.toString=function(){var r=this.lineNumber||"",s=this.columnNumber||"";return this.functionName?this.functionName+" ("+this.fileName+":"+r+":"+s+")":this.fileName+":"+r+":"+s},t}(),XXt=/(^|@)\S+:\d+/,X4e=/^\s*at .*(\S+:\d+|\(native\))/m,een=/^(eval@)?(\[native code])?$/,Ooe={parse:function(e){return e?typeof e.stacktrace<"u"||typeof e["opera#sourceloc"]<"u"?this.parseOpera(e):e.stack&&e.stack.match(X4e)?this.parseV8OrIE(e):e.stack?this.parseFFOrSafari(e):(console.warn("[console-record-plugin]: Failed to parse error object:",e),[]):[]},extractLocation:function(e){if(e.indexOf(":")===-1)return[e];var n=/(.+?)(?::(\d+))?(?::(\d+))?$/,r=n.exec(e.replace(/[()]/g,""));if(!r)throw new Error("Cannot parse given url: "+e);return[r[1],r[2]||void 0,r[3]||void 0]},parseV8OrIE:function(e){var n=e.stack.split(`
`).filter(function(r){return!!r.match(X4e)},this);return n.map(function(r){r.indexOf("(eval ")>-1&&(r=r.replace(/eval code/g,"eval").replace(/(\(eval at [^()]*)|(\),.*$)/g,""));var s=r.replace(/^\s+/,"").replace(/\(eval code/g,"("),i=s.match(/ (\((.+):(\d+):(\d+)\)$)/);s=i?s.replace(i[0],""):s;var o=s.split(/\s+/).slice(1),l=this.extractLocation(i?i[1]:o.pop()),c=o.join(" ")||void 0,d=["eval","<anonymous>"].indexOf(l[0])>-1?void 0:l[0];return new HN({functionName:c,fileName:d,lineNumber:l[1],columnNumber:l[2]})},this)},parseFFOrSafari:function(e){var n=e.stack.split(`
`).filter(function(r){return!r.match(een)},this);return n.map(function(r){if(r.indexOf(" > eval")>-1&&(r=r.replace(/ line (\d+)(?: > eval line \d+)* > eval:\d+:\d+/g,":$1")),r.indexOf("@")===-1&&r.indexOf(":")===-1)return new HN({functionName:r});var s=/((.*".+"[^@]*)?[^@]*)(?:@)/,i=r.match(s),o=i&&i[1]?i[1]:void 0,l=this.extractLocation(r.replace(s,""));return new HN({functionName:o,fileName:l[0],lineNumber:l[1],columnNumber:l[2]})},this)},parseOpera:function(e){return!e.stacktrace||e.message.indexOf(`
`)>-1&&e.message.split(`
`).length>e.stacktrace.split(`
`).length?this.parseOpera9(e):e.stack?this.parseOpera11(e):this.parseOpera10(e)},parseOpera9:function(e){for(var n=/Line (\d+).*script (?:in )?(\S+)/i,r=e.message.split(`
`),s=[],i=2,o=r.length;i<o;i+=2){var l=n.exec(r[i]);l&&s.push(new HN({fileName:l[2],lineNumber:parseFloat(l[1])}))}return s},parseOpera10:function(e){for(var n=/Line (\d+).*script (?:in )?(\S+)(?:: In function (\S+))?$/i,r=e.stacktrace.split(`
`),s=[],i=0,o=r.length;i<o;i+=2){var l=n.exec(r[i]);l&&s.push(new HN({functionName:l[3]||void 0,fileName:l[2],lineNumber:parseFloat(l[1])}))}return s},parseOpera11:function(e){var n=e.stack.split(`
`).filter(function(r){return!!r.match(XXt)&&!r.match(/^Error created at/)},this);return n.map(function(r){var s=r.split("@"),i=this.extractLocation(s.pop()),o=s.shift()||"",l=o.replace(/<anonymous function(: (\w+))?>/,"$2").replace(/\([^)]*\)/g,"")||void 0;return new HN({functionName:l,fileName:i[0],lineNumber:i[1],columnNumber:i[2]})},this)}};function ten(t){if(!t||!t.outerHTML)return"";for(var e="";t.parentElement;){var n=t.localName;if(!n)break;n=n.toLowerCase();var r=t.parentElement,s=[];if(r.children&&r.children.length>0)for(var i=0;i<r.children.length;i++){var o=r.children[i];o.localName&&o.localName.toLowerCase&&o.localName.toLowerCase()===n&&s.push(o)}s.length>1&&(n+=":eq("+s.indexOf(t)+")"),e=n+(e?">"+e:""),t=r}return e}function Hpe(t){return Object.prototype.toString.call(t)==="[object Object]"}function Olt(t,e){if(e===0)return!0;for(var n=Object.keys(t),r=on(n),s;!(s=r()).done;){var i=s.value;if(Hpe(t[i])&&Olt(t[i],e-1))return!0}return!1}function GN(t,e){var n={numOfKeysLimit:50,depthOfLimit:4};Object.assign(n,e);var r=[],s=[];return JSON.stringify(t,function(l,c){if(r.length>0){var d=r.indexOf(this);~d?r.splice(d+1):r.push(this),~d?s.splice(d,1/0,l):s.push(l),~r.indexOf(c)&&(r[0]===c?c="[Circular ~]":c="[Circular ~."+s.slice(0,r.indexOf(c)).join(".")+"]")}else r.push(c);if(c===null)return c;if(c===void 0)return"undefined";if(i(c))return o(c);if((typeof c>"u"?"undefined":Ir(c))==="bigint")return c.toString()+"n";if(Pr(c,Event)){var u={};for(var h in c){var m=c[h];Array.isArray(m)?u[h]=ten(m.length?m[0]:null):u[h]=m}return u}else{if(Pr(c,Node))return Pr(c,HTMLElement)?c?c.outerHTML:"":c.nodeName;if(Pr(c,Error))return c.stack?c.stack+`
End of stack for Error object`:c.name+": "+c.message}return c});function i(l){return!!(Hpe(l)&&Object.keys(l).length>n.numOfKeysLimit||typeof l=="function"||Hpe(l)&&Olt(l,n.depthOfLimit))}function o(l){var c=l.toString();return n.stringLengthLimit&&c.length>n.stringLengthLimit&&(c=""+c.slice(0,n.stringLengthLimit)+"..."),c}}var eDe={level:["assert","clear","count","countReset","debug","dir","dirxml","error","group","groupCollapsed","groupEnd","info","log","table","time","timeEnd","timeLog","trace","warn"],lengthThreshold:1e3,logger:"console"};function nen(t,e,n){var r=n?Object.assign({},eDe,n):eDe,s=r.logger;if(!s)return function(){};var i;typeof s=="string"?i=e[s]:i=s;var o=0,l=!1,c=[];if(r.level.includes("error")){var d=function(g){var v=g.message,b=g.error,x=Ooe.parse(b).map(function(k){return k.toString()}),w=[GN(v,r.stringifyOptions)];t({level:"error",trace:x,payload:w})};e.addEventListener("error",d),c.push(function(){e.removeEventListener("error",d)});var u=function(g){var v,b;Pr(g.reason,Error)?(v=g.reason,b=[GN("Uncaught (in promise) "+v.name+": "+v.message,r.stringifyOptions)]):(v=new Error,b=[GN("Uncaught (in promise)",r.stringifyOptions),GN(g.reason,r.stringifyOptions)]);var x=Ooe.parse(v).map(function(w){return w.toString()});t({level:"error",trace:x,payload:b})};e.addEventListener("unhandledrejection",u),c.push(function(){e.removeEventListener("unhandledrejection",u)})}for(var h=on(r.level),m;!(m=h()).done;){var f=m.value;c.push(p(i,f))}return function(){c.forEach(function(g){return g()})};function p(g,v){var b=this;return g[v]?JXt(g,v,function(x){var w=b;return function(){for(var k=arguments.length,S=new Array(k),C=0;C<k;C++)S[C]=arguments[C];if(x.apply(w,S),!(v==="assert"&&S[0])&&!l){l=!0;try{var j=Ooe.parse(new Error).map(function(A){return A.toString()}).splice(1),E=v==="assert"?S.slice(1):S,N=E.map(function(A){return GN(A,r.stringifyOptions)});o++,o<r.lengthThreshold?t({level:v,trace:j,payload:N}):o===r.lengthThreshold&&t({level:"warn",trace:[],payload:[GN("The number of log records reached the threshold.")]})}catch(A){x.apply(void 0,[].concat(["rrweb logger error:",A],S))}finally{l=!1}}}}):function(){}}}var ren="rrweb/console@1",sen=function(t){return{name:ren,observer:nen,options:t}},tDe=Ht.setImmediate,Tk,Gpe,Wpe,Flt=Object.prototype.toString,ien=typeof tDe<"u"?function(e){return tDe(e)}:setTimeout;try{Object.defineProperty({},"x",{}),Tk=function(e,n,r,s){return Object.defineProperty(e,n,{value:r,writable:!0,configurable:s!==!1})}}catch{Tk=function(n,r,s){return n[r]=s,n}}Wpe=function(){var e,n,r;function s(i,o){this.fn=i,this.self=o,this.next=void 0}return{add:function(o,l){r=new s(o,l),n?n.next=r:e=r,n=r,r=void 0},drain:function(){var o=e;for(e=n=Gpe=void 0;o;)o.fn.call(o.self),o=o.next}}}();function JK(t,e){Wpe.add(t,e),Gpe||(Gpe=ien(Wpe.drain))}function Blt(t){var e,n=typeof t;return t!==null&&(n==="object"||n==="function")&&(e=t.then),typeof e=="function"?e:!1}function qCe(){for(var t=0;t<this.chain.length;t++)aen(this,this.state===1?this.chain[t].success:this.chain[t].failure,this.chain[t]);this.chain.length=0}function aen(t,e,n){var r,s;try{e===!1?n.reject(t.msg):(e===!0?r=t.msg:r=e.call(void 0,t.msg),r===n.promise?n.reject(TypeError("Promise-chain cycle")):(s=Blt(r))?s.call(r,n.resolve,n.reject):n.resolve(r))}catch(i){n.reject(i)}}function Ult(t){var e,n=this;if(!n.triggered){n.triggered=!0,n.def&&(n=n.def);try{(e=Blt(t))?JK(function(){var r=new nDe(n);try{e.call(t,function(){Ult.apply(r,arguments)},function(){ED.apply(r,arguments)})}catch(s){ED.call(r,s)}}):(n.msg=t,n.state=1,n.chain.length>0&&JK(qCe,n))}catch(r){ED.call(new nDe(n),r)}}}function ED(t){var e=this;e.triggered||(e.triggered=!0,e.def&&(e=e.def),e.msg=t,e.state=2,e.chain.length>0&&JK(qCe,e))}function zlt(t,e,n,r){for(var s=0;s<e.length;s++)(function(o){t.resolve(e[o]).then(function(c){n(o,c)},r)})(s)}function nDe(t){this.def=t,this.triggered=!1}function oen(t){this.promise=t,this.state=0,this.triggered=!1,this.chain=[],this.msg=void 0}function mS(t){if(typeof t!="function")throw TypeError("Not a function");if(this.__NPO__!==0)throw TypeError("Not a promise");this.__NPO__=1;var e=new oen(this);this.then=function(r,s){var i={success:typeof r=="function"?r:!0,failure:typeof s=="function"?s:!1};return i.promise=new this.constructor(function(l,c){if(typeof l!="function"||typeof c!="function")throw TypeError("Not a function");i.resolve=l,i.reject=c}),e.chain.push(i),e.state!==0&&JK(qCe,e),i.promise},this.catch=function(r){return this.then(void 0,r)};try{t.call(void 0,function(r){Ult.call(e,r)},function(r){ED.call(e,r)})}catch(n){ED.call(e,n)}}var Vlt=Tk({},"constructor",mS,!1);mS.prototype=Vlt;Tk(Vlt,"__NPO__",0,!1);Tk(mS,"resolve",function(e){var n=this;return e&&typeof e=="object"&&e.__NPO__===1?e:new n(function(s,i){if(typeof s!="function"||typeof i!="function")throw TypeError("Not a function");s(e)})});Tk(mS,"reject",function(e){return new this(function(r,s){if(typeof r!="function"||typeof s!="function")throw TypeError("Not a function");s(e)})});Tk(mS,"all",function(e){var n=this;return Flt.call(e)!=="[object Array]"?n.reject(TypeError("Not an array")):e.length===0?n.resolve([]):new n(function(s,i){if(typeof s!="function"||typeof i!="function")throw TypeError("Not a function");var o=e.length,l=Array(o),c=0;zlt(n,e,function(u,h){l[u]=h,++c===o&&s(l)},i)})});Tk(mS,"race",function(e){var n=this;return Flt.call(e)!=="[object Array]"?n.reject(TypeError("Not an array")):new n(function(s,i){if(typeof s!="function"||typeof i!="function")throw TypeError("Not a function");zlt(n,e,function(l,c){s(c)},i)})});var xs;typeof Promise<"u"&&Promise.toString().indexOf("[native code]")!==-1?xs=Promise:xs=mS;var ND=24*60*60*1e3,Foe=8*1e3,Hee=Array.prototype,len=Function.prototype,Hlt=Object.prototype,N1=Hee.slice,Z8=Hlt.toString,Gee=Hlt.hasOwnProperty,Ol=Ht.console,ox=Ht.navigator,bs=Ht.document,p4=Ht.opera,rDe=Ht.screen,Bv=ox.userAgent,Boe=len.bind,sDe=Hee.forEach,iDe=Hee.indexOf,aDe=Hee.map,cen=Array.isArray,qpe={},de={trim:function(t){return t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},ds={log:function(){if(bh.DEBUG&&!de.isUndefined(Ol)&&Ol)try{Ol.log.apply(Ol,arguments)}catch{de.each(arguments,function(e){Ol.log(e)})}},warn:function(){if(bh.DEBUG&&!de.isUndefined(Ol)&&Ol){var t=["Mixpanel warning:"].concat(de.toArray(arguments));try{Ol.warn.apply(Ol,t)}catch{de.each(t,function(n){Ol.warn(n)})}}},error:function(){if(bh.DEBUG&&!de.isUndefined(Ol)&&Ol){var t=["Mixpanel error:"].concat(de.toArray(arguments));try{Ol.error.apply(Ol,t)}catch{de.each(t,function(n){Ol.error(n)})}}},critical:function(){if(!de.isUndefined(Ol)&&Ol){var t=["Mixpanel error:"].concat(de.toArray(arguments));try{Ol.error.apply(Ol,t)}catch{de.each(t,function(n){Ol.error(n)})}}}},WU=function(t,e){return function(){return arguments[0]="["+e+"] "+arguments[0],t.apply(ds,arguments)}},Vy=function(t){return{log:WU(ds.log,t),warn:WU(ds.warn,t),error:WU(ds.error,t),critical:WU(ds.critical,t)}},A2=function(t){return function(){try{return t.apply(this,arguments)}catch(e){ds.critical("Implementation error. Please turn on debug and contact support@mixpanel.com."),bh.DEBUG&&ds.critical(e)}}},KCe=function(t){var e=t.prototype;for(var n in e)typeof e[n]=="function"&&(e[n]=A2(e[n]))};de.bind=function(t,e){var n,r;if(Boe&&t.bind===Boe)return Boe.apply(t,N1.call(arguments,1));if(!de.isFunction(t))throw new TypeError;return n=N1.call(arguments,2),r=function(){if(!(this instanceof r))return t.apply(e,n.concat(N1.call(arguments)));var s={};s.prototype=t.prototype;var i=new s;s.prototype=null;var o=t.apply(i,n.concat(N1.call(arguments)));return Object(o)===o?o:i},r};de.each=function(t,e,n){if(t!=null){if(sDe&&t.forEach===sDe)t.forEach(e,n);else if(t.length===+t.length){for(var r=0,s=t.length;r<s;r++)if(r in t&&e.call(n,t[r],r,t)===qpe)return}else for(var i in t)if(Gee.call(t,i)&&e.call(n,t[i],i,t)===qpe)return}};de.extend=function(t){return de.each(N1.call(arguments,1),function(e){for(var n in e)e[n]!==void 0&&(t[n]=e[n])}),t};de.isArray=cen||function(t){return Z8.call(t)==="[object Array]"};de.isFunction=function(t){return typeof t=="function"};de.isArguments=function(t){return!!(t&&Gee.call(t,"callee"))};de.toArray=function(t){return t?t.toArray?t.toArray():de.isArray(t)||de.isArguments(t)?N1.call(t):de.values(t):[]};de.map=function(t,e,n){if(aDe&&t.map===aDe)return t.map(e,n);var r=[];return de.each(t,function(s){r.push(e.call(n,s))}),r};de.keys=function(t){var e=[];return t===null||de.each(t,function(n,r){e[e.length]=r}),e};de.values=function(t){var e=[];return t===null||de.each(t,function(n){e[e.length]=n}),e};de.include=function(t,e){var n=!1;return t===null?n:iDe&&t.indexOf===iDe?t.indexOf(e)!=-1:(de.each(t,function(r){if(n||(n=r===e))return qpe}),n)};de.includes=function(t,e){return t.indexOf(e)!==-1};de.inherit=function(t,e){return t.prototype=new e,t.prototype.constructor=t,t.superclass=e.prototype,t};de.isObject=function(t){return t===Object(t)&&!de.isArray(t)};de.isEmptyObject=function(t){if(de.isObject(t)){for(var e in t)if(Gee.call(t,e))return!1;return!0}return!1};de.isUndefined=function(t){return t===void 0};de.isString=function(t){return Z8.call(t)=="[object String]"};de.isDate=function(t){return Z8.call(t)=="[object Date]"};de.isNumber=function(t){return Z8.call(t)=="[object Number]"};de.isElement=function(t){return!!(t&&t.nodeType===1)};de.encodeDates=function(t){return de.each(t,function(e,n){de.isDate(e)?t[n]=de.formatDate(e):de.isObject(e)&&(t[n]=de.encodeDates(e))}),t};de.timestamp=function(){return Date.now=Date.now||function(){return+new Date},Date.now()};de.formatDate=function(t){function e(n){return n<10?"0"+n:n}return t.getUTCFullYear()+"-"+e(t.getUTCMonth()+1)+"-"+e(t.getUTCDate())+"T"+e(t.getUTCHours())+":"+e(t.getUTCMinutes())+":"+e(t.getUTCSeconds())};de.strip_empty_properties=function(t){var e={};return de.each(t,function(n,r){de.isString(n)&&n.length>0&&(e[r]=n)}),e};de.truncate=function(t,e){var n;return typeof t=="string"?n=t.slice(0,e):de.isArray(t)?(n=[],de.each(t,function(r){n.push(de.truncate(r,e))})):de.isObject(t)?(n={},de.each(t,function(r,s){n[s]=de.truncate(r,e)})):n=t,n};de.JSONEncode=function(){return function(t){var e=t,n=function(s){var i=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,o={"\b":"\\b","	":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};return i.lastIndex=0,i.test(s)?'"'+s.replace(i,function(l){var c=o[l];return typeof c=="string"?c:"\\u"+("0000"+l.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+s+'"'},r=function(s,i){var o="",l="    ",c=0,d="",u="",h=0,m=o,f=[],p=i[s];switch(p&&typeof p=="object"&&typeof p.toJSON=="function"&&(p=p.toJSON(s)),typeof p){case"string":return n(p);case"number":return isFinite(p)?String(p):"null";case"boolean":case"null":return String(p);case"object":if(!p)return"null";if(o+=l,f=[],Z8.apply(p)==="[object Array]"){for(h=p.length,c=0;c<h;c+=1)f[c]=r(c,p)||"null";return u=f.length===0?"[]":o?`[
`+o+f.join(`,
`+o)+`
`+m+"]":"["+f.join(",")+"]",o=m,u}for(d in p)Gee.call(p,d)&&(u=r(d,p),u&&f.push(n(d)+(o?": ":":")+u));return u=f.length===0?"{}":o?"{"+f.join(",")+m+"}":"{"+f.join(",")+"}",o=m,u}};return r("",{"":e})}}();de.JSONDecode=function(){var t,e,n={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
`,r:"\r",t:"	"},r,s=function(f){var p=new SyntaxError(f);throw p.at=t,p.text=r,p},i=function(f){return f&&f!==e&&s("Expected '"+f+"' instead of '"+e+"'"),e=r.charAt(t),t+=1,e},o=function(){var f,p="";for(e==="-"&&(p="-",i("-"));e>="0"&&e<="9";)p+=e,i();if(e===".")for(p+=".";i()&&e>="0"&&e<="9";)p+=e;if(e==="e"||e==="E")for(p+=e,i(),(e==="-"||e==="+")&&(p+=e,i());e>="0"&&e<="9";)p+=e,i();if(f=+p,!isFinite(f))s("Bad number");else return f},l=function(){var f,p,g="",v;if(e==='"')for(;i();){if(e==='"')return i(),g;if(e==="\\")if(i(),e==="u"){for(v=0,p=0;p<4&&(f=parseInt(i(),16),!!isFinite(f));p+=1)v=v*16+f;g+=String.fromCharCode(v)}else if(typeof n[e]=="string")g+=n[e];else break;else g+=e}s("Bad string")},c=function(){for(;e&&e<=" ";)i()},d=function(){switch(e){case"t":return i("t"),i("r"),i("u"),i("e"),!0;case"f":return i("f"),i("a"),i("l"),i("s"),i("e"),!1;case"n":return i("n"),i("u"),i("l"),i("l"),null}s('Unexpected "'+e+'"')},u,h=function(){var f=[];if(e==="["){if(i("["),c(),e==="]")return i("]"),f;for(;e;){if(f.push(u()),c(),e==="]")return i("]"),f;i(","),c()}}s("Bad array")},m=function(){var f,p={};if(e==="{"){if(i("{"),c(),e==="}")return i("}"),p;for(;e;){if(f=l(),c(),i(":"),Object.hasOwnProperty.call(p,f)&&s('Duplicate key "'+f+'"'),p[f]=u(),c(),e==="}")return i("}"),p;i(","),c()}}s("Bad object")};return u=function(){switch(c(),e){case"{":return m();case"[":return h();case'"':return l();case"-":return o();default:return e>="0"&&e<="9"?o():d()}},function(f){var p;return r=f,t=0,e=" ",p=u(),c(),e&&s("Syntax error"),p}}();de.base64Encode=function(t){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",n,r,s,i,o,l,c,d,u=0,h=0,m="",f=[];if(!t)return t;t=de.utf8Encode(t);do n=t.charCodeAt(u++),r=t.charCodeAt(u++),s=t.charCodeAt(u++),d=n<<16|r<<8|s,i=d>>18&63,o=d>>12&63,l=d>>6&63,c=d&63,f[h++]=e.charAt(i)+e.charAt(o)+e.charAt(l)+e.charAt(c);while(u<t.length);switch(m=f.join(""),t.length%3){case 1:m=m.slice(0,-2)+"==";break;case 2:m=m.slice(0,-1)+"=";break}return m};de.utf8Encode=function(t){t=(t+"").replace(/\r\n/g,`
`).replace(/\r/g,`
`);var e="",n,r,s=0,i;for(n=r=0,s=t.length,i=0;i<s;i++){var o=t.charCodeAt(i),l=null;o<128?r++:o>127&&o<2048?l=String.fromCharCode(o>>6|192,o&63|128):l=String.fromCharCode(o>>12|224,o>>6&63|128,o&63|128),l!==null&&(r>n&&(e+=t.substring(n,r)),e+=l,n=r=i+1)}return r>n&&(e+=t.substring(n,t.length)),e};de.UUID=function(){try{return Ht.crypto.randomUUID()}catch{for(var t=new Array(36),e=0;e<36;e++)t[e]=Math.floor(Math.random()*16);return t[14]=4,t[19]=t[19]&=-5,t[19]=t[19]|=8,t[8]=t[13]=t[18]=t[23]="-",de.map(t,function(r){return r.toString(16)}).join("")}};var oDe=["ahrefsbot","ahrefssiteaudit","amazonbot","baiduspider","bingbot","bingpreview","chrome-lighthouse","facebookexternal","petalbot","pinterest","screaming frog","yahoo! slurp","yandex","adsbot-google","apis-google","duplexweb-google","feedfetcher-google","google favicon","google web preview","google-read-aloud","googlebot","googleweblight","mediapartners-google","storebot-google"];de.isBlockedUA=function(t){var e;for(t=t.toLowerCase(),e=0;e<oDe.length;e++)if(t.indexOf(oDe[e])!==-1)return!0;return!1};de.HTTPBuildQuery=function(t,e){var n,r,s=[];return de.isUndefined(e)&&(e="&"),de.each(t,function(i,o){n=encodeURIComponent(i.toString()),r=encodeURIComponent(o),s[s.length]=r+"="+n}),s.join(e)};de.getQueryParam=function(t,e){e=e.replace(/[[]/g,"\\[").replace(/[\]]/g,"\\]");var n="[\\?&]"+e+"=([^&#]*)",r=new RegExp(n),s=r.exec(t);if(s===null||s&&typeof s[1]!="string"&&s[1].length)return"";var i=s[1];try{i=decodeURIComponent(i)}catch{ds.error("Skipping decoding for malformed query param: "+i)}return i.replace(/\+/g," ")};de.cookie={get:function(t){for(var e=t+"=",n=bs.cookie.split(";"),r=0;r<n.length;r++){for(var s=n[r];s.charAt(0)==" ";)s=s.substring(1,s.length);if(s.indexOf(e)===0)return decodeURIComponent(s.substring(e.length,s.length))}return null},parse:function(t){var e;try{e=de.JSONDecode(de.cookie.get(t))||{}}catch{}return e},set_seconds:function(t,e,n,r,s,i,o){var l="",c="",d="";if(o)l="; domain="+o;else if(r){var u=lDe(bs.location.hostname);l=u?"; domain=."+u:""}if(n){var h=new Date;h.setTime(h.getTime()+n*1e3),c="; expires="+h.toGMTString()}i&&(s=!0,d="; SameSite=None"),s&&(d+="; secure"),bs.cookie=t+"="+encodeURIComponent(e)+c+"; path=/"+l+d},set:function(t,e,n,r,s,i,o){var l="",c="",d="";if(o)l="; domain="+o;else if(r){var u=lDe(bs.location.hostname);l=u?"; domain=."+u:""}if(n){var h=new Date;h.setTime(h.getTime()+n*24*60*60*1e3),c="; expires="+h.toGMTString()}i&&(s=!0,d="; SameSite=None"),s&&(d+="; secure");var m=t+"="+encodeURIComponent(e)+c+"; path=/"+l+d;return bs.cookie=m,m},remove:function(t,e,n){de.cookie.set(t,"",-1,e,!1,!1,n)}};var Glt=function(t){var e=!0;try{var n="__mplss_"+YCe(8),r="xyz";t.setItem(n,r),t.getItem(n)!==r&&(e=!1),t.removeItem(n)}catch{e=!1}return e},Uoe=null,UO=function(t,e){return Uoe!==null&&!e?Uoe:Uoe=Glt(t)},zoe=null,den=function(t,e){return zoe!==null&&!e?zoe:zoe=Glt(t)};function Wlt(t,e,n){var r=function(s){ds.error(e+" error: "+s)};return{is_supported:function(s){var i=n(t,s);return i||ds.error(e+" unsupported"),i},error:r,get:function(s){try{return t.getItem(s)}catch(i){r(i)}return null},parse:function(s){try{return de.JSONDecode(t.getItem(s))||{}}catch{}return null},set:function(s,i){try{t.setItem(s,i)}catch(o){r(o)}},remove:function(s){try{t.removeItem(s)}catch(i){r(i)}}}}var Wee=function(){try{return Ht.localStorage}catch{return null}},uen=function(){try{return Ht.sessionStorage}catch{return null}};de.localStorage=Wlt(Wee(),"localStorage",UO);de.sessionStorage=Wlt(uen(),"sessionStorage",den);de.register_event=function(){var t=function(r,s,i,o,l){if(!r){ds.error("No valid element provided to register_event");return}if(r.addEventListener&&!o)r.addEventListener(s,i,!!l);else{var c="on"+s,d=r[c];r[c]=e(r,i,d)}};function e(r,s,i){var o=function(l){if(l=l||n(Ht.event),!!l){var c=!0,d,u;return de.isFunction(i)&&(d=i(l)),u=s.call(r,l),(d===!1||u===!1)&&(c=!1),c}};return o}function n(r){return r&&(r.preventDefault=n.preventDefault,r.stopPropagation=n.stopPropagation),r}return n.preventDefault=function(){this.returnValue=!1},n.stopPropagation=function(){this.cancelBubble=!0},t}();var hen=new RegExp('^(\\w*)\\[(\\w+)([=~\\|\\^\\$\\*]?)=?"?([^\\]"]*)"?\\]$');de.dom_query=function(){function t(s){return s.all?s.all:s.getElementsByTagName("*")}var e=/[\t\r\n]/g;function n(s,i){var o=" "+i+" ";return(" "+s.className+" ").replace(e," ").indexOf(o)>=0}function r(s){if(!bs.getElementsByTagName)return[];var i=s.split(" "),o,l,c,d,u,h,m,f,p,g,v=[bs];for(h=0;h<i.length;h++){if(o=i[h].replace(/^\s+/,"").replace(/\s+$/,""),o.indexOf("#")>-1){l=o.split("#"),c=l[0];var b=l[1],x=bs.getElementById(b);if(!x||c&&x.nodeName.toLowerCase()!=c)return[];v=[x];continue}if(o.indexOf(".")>-1){l=o.split("."),c=l[0];var w=l[1];for(c||(c="*"),d=[],u=0,m=0;m<v.length;m++)for(c=="*"?p=t(v[m]):p=v[m].getElementsByTagName(c),f=0;f<p.length;f++)d[u++]=p[f];for(v=[],g=0,m=0;m<d.length;m++)d[m].className&&de.isString(d[m].className)&&n(d[m],w)&&(v[g++]=d[m]);continue}var k=o.match(hen);if(k){c=k[1];var S=k[2],C=k[3],j=k[4];for(c||(c="*"),d=[],u=0,m=0;m<v.length;m++)for(c=="*"?p=t(v[m]):p=v[m].getElementsByTagName(c),f=0;f<p.length;f++)d[u++]=p[f];v=[],g=0;var E;switch(C){case"=":E=function(N){return N.getAttribute(S)==j};break;case"~":E=function(N){return N.getAttribute(S).match(new RegExp("\\b"+j+"\\b"))};break;case"|":E=function(N){return N.getAttribute(S).match(new RegExp("^"+j+"-?"))};break;case"^":E=function(N){return N.getAttribute(S).indexOf(j)===0};break;case"$":E=function(N){return N.getAttribute(S).lastIndexOf(j)==N.getAttribute(S).length-j.length};break;case"*":E=function(N){return N.getAttribute(S).indexOf(j)>-1};break;default:E=function(N){return N.getAttribute(S)}}for(v=[],g=0,m=0;m<d.length;m++)E(d[m])&&(v[g++]=d[m]);continue}for(c=o,d=[],u=0,m=0;m<v.length;m++)for(p=v[m].getElementsByTagName(c),f=0;f<p.length;f++)d[u++]=p[f];v=d}return v}return function(s){return de.isElement(s)?[s]:de.isObject(s)&&!de.isUndefined(s.length)?s:r.call(this,s)}}();var men=["utm_source","utm_medium","utm_campaign","utm_content","utm_term","utm_id","utm_source_platform","utm_campaign_id","utm_creative_format","utm_marketing_tactic"],fen=["dclid","fbclid","gclid","ko_click_id","li_fat_id","msclkid","sccid","ttclid","twclid","wbraid"];de.info={campaignParams:function(t){var e="",n={};return de.each(men,function(r){e=de.getQueryParam(bs.URL,r),e.length?n[r]=e:t!==void 0&&(n[r]=t)}),n},clickParams:function(){var t="",e={};return de.each(fen,function(n){t=de.getQueryParam(bs.URL,n),t.length&&(e[n]=t)}),e},marketingParams:function(){return de.extend(de.info.campaignParams(),de.info.clickParams())},searchEngine:function(t){return t.search("https?://(.*)google.([^/?]*)")===0?"google":t.search("https?://(.*)bing.com")===0?"bing":t.search("https?://(.*)yahoo.com")===0?"yahoo":t.search("https?://(.*)duckduckgo.com")===0?"duckduckgo":null},searchInfo:function(t){var e=de.info.searchEngine(t),n=e!="yahoo"?"q":"p",r={};if(e!==null){r.$search_engine=e;var s=de.getQueryParam(t,n);s.length&&(r.mp_keyword=s)}return r},browser:function(t,e,n){return e=e||"",n||de.includes(t," OPR/")?de.includes(t,"Mini")?"Opera Mini":"Opera":/(BlackBerry|PlayBook|BB10)/i.test(t)?"BlackBerry":de.includes(t,"IEMobile")||de.includes(t,"WPDesktop")?"Internet Explorer Mobile":de.includes(t,"SamsungBrowser/")?"Samsung Internet":de.includes(t,"Edge")||de.includes(t,"Edg/")?"Microsoft Edge":de.includes(t,"FBIOS")?"Facebook Mobile":de.includes(t,"Whale/")?"Whale Browser":de.includes(t,"Chrome")?"Chrome":de.includes(t,"CriOS")?"Chrome iOS":de.includes(t,"UCWEB")||de.includes(t,"UCBrowser")?"UC Browser":de.includes(t,"FxiOS")?"Firefox iOS":de.includes(e,"Apple")?de.includes(t,"Mobile")?"Mobile Safari":"Safari":de.includes(t,"Android")?"Android Mobile":de.includes(t,"Konqueror")?"Konqueror":de.includes(t,"Firefox")?"Firefox":de.includes(t,"MSIE")||de.includes(t,"Trident/")?"Internet Explorer":de.includes(t,"Gecko")?"Mozilla":""},browserVersion:function(t,e,n){var r=de.info.browser(t,e,n),s={"Internet Explorer Mobile":/rv:(\d+(\.\d+)?)/,"Microsoft Edge":/Edge?\/(\d+(\.\d+)?)/,Chrome:/Chrome\/(\d+(\.\d+)?)/,"Chrome iOS":/CriOS\/(\d+(\.\d+)?)/,"UC Browser":/(UCBrowser|UCWEB)\/(\d+(\.\d+)?)/,Safari:/Version\/(\d+(\.\d+)?)/,"Mobile Safari":/Version\/(\d+(\.\d+)?)/,Opera:/(Opera|OPR)\/(\d+(\.\d+)?)/,Firefox:/Firefox\/(\d+(\.\d+)?)/,"Firefox iOS":/FxiOS\/(\d+(\.\d+)?)/,Konqueror:/Konqueror:(\d+(\.\d+)?)/,BlackBerry:/BlackBerry (\d+(\.\d+)?)/,"Android Mobile":/android\s(\d+(\.\d+)?)/,"Samsung Internet":/SamsungBrowser\/(\d+(\.\d+)?)/,"Internet Explorer":/(rv:|MSIE )(\d+(\.\d+)?)/,Mozilla:/rv:(\d+(\.\d+)?)/,"Whale Browser":/Whale\/(\d+(\.\d+)?)/},i=s[r];if(i===void 0)return null;var o=t.match(i);return o?parseFloat(o[o.length-2]):null},os:function(){var t=Bv;return/Windows/i.test(t)?/Phone/.test(t)||/WPDesktop/.test(t)?"Windows Phone":"Windows":/(iPhone|iPad|iPod)/.test(t)?"iOS":/Android/.test(t)?"Android":/(BlackBerry|PlayBook|BB10)/i.test(t)?"BlackBerry":/Mac/i.test(t)?"Mac OS X":/Linux/.test(t)?"Linux":/CrOS/.test(t)?"Chrome OS":""},device:function(t){return/Windows Phone/i.test(t)||/WPDesktop/.test(t)?"Windows Phone":/iPad/.test(t)?"iPad":/iPod/.test(t)?"iPod Touch":/iPhone/.test(t)?"iPhone":/(BlackBerry|PlayBook|BB10)/i.test(t)?"BlackBerry":/Android/.test(t)?"Android":""},referringDomain:function(t){var e=t.split("/");return e.length>=3?e[2]:""},currentUrl:function(){return Ht.location.href},properties:function(t){return typeof t!="object"&&(t={}),de.extend(de.strip_empty_properties({$os:de.info.os(),$browser:de.info.browser(Bv,ox.vendor,p4),$referrer:bs.referrer,$referring_domain:de.info.referringDomain(bs.referrer),$device:de.info.device(Bv)}),{$current_url:de.info.currentUrl(),$browser_version:de.info.browserVersion(Bv,ox.vendor,p4),$screen_height:rDe.height,$screen_width:rDe.width,mp_lib:"web",$lib_version:bh.LIB_VERSION,$insert_id:YCe(),time:de.timestamp()/1e3},de.strip_empty_properties(t))},people_properties:function(){return de.extend(de.strip_empty_properties({$os:de.info.os(),$browser:de.info.browser(Bv,ox.vendor,p4)}),{$browser_version:de.info.browserVersion(Bv,ox.vendor,p4)})},mpPageViewProperties:function(){return de.strip_empty_properties({current_page_title:bs.title,current_domain:Ht.location.hostname,current_url_path:Ht.location.pathname,current_url_protocol:Ht.location.protocol,current_url_search:Ht.location.search})}};var pen=function(t,e){var n=null,r=[];return function(s){var i=this;return r.push(s),n||(n=new xs(function(o){setTimeout(function(){var l=t.apply(i,[r]);n=null,r=[],o(l)},e)})),n}},YCe=function(t){var e=Math.random().toString(36).substring(2,10)+Math.random().toString(36).substring(2,10);return t?e.substring(0,t):e},qlt=function(){var t=de.UUID().replace(/-/g,""),e=de.UUID().replace(/-/g,"").substring(0,16),n="01";return"00-"+t+"-"+e+"-"+n},gen=/[a-z0-9][a-z0-9-]*\.[a-z]+$/i,ven=/[a-z0-9][a-z0-9-]+\.[a-z.]{2,6}$/i,lDe=function(t){var e=ven,n=t.split("."),r=n[n.length-1];(r.length>4||r==="com"||r==="org")&&(e=gen);var s=t.match(e);return s?s[0]:""},yen=function(){var t=Ht.navigator.onLine;return de.isUndefined(t)||t},J1=function(){},XK=function(t,e){for(var n=!1,r=0;r<e.length;r++)if(t.match(e[r])){n=!0;break}return n},sR=null,eY=null;typeof JSON<"u"&&(sR=JSON.stringify,eY=JSON.parse);sR=sR||de.JSONEncode;eY=eY||de.JSONDecode;var ben=function(t,e,n){if(!Ht.CompressionStream)return!1;var r=de.info.browser(t,e,n),s=de.info.browserVersion(t,e,n);return!((r==="Safari"||r==="Mobile Safari")&&s>=16.4&&s<16.6)};de.info=de.info;de.info.browser=de.info.browser;de.info.browserVersion=de.info.browserVersion;de.info.device=de.info.device;de.info.properties=de.info.properties;de.isBlockedUA=de.isBlockedUA;de.isEmptyObject=de.isEmptyObject;de.isObject=de.isObject;de.JSONDecode=de.JSONDecode;de.JSONEncode=de.JSONEncode;de.toArray=de.toArray;de.NPO=mS;var Xf=function(t,e,n){this.dbName=t,this.storeName=e,this.version=n.version,this.storeNamesInDb=n.storeNames,this.dbPromise=null};Xf.prototype._openDb=function(){var t=this.dbName,e=this.version,n=this.storeNamesInDb;return new xs(function(r,s){var i=Ht.indexedDB.open(t,e);i.onerror=function(){s(i.error)},i.onsuccess=function(){r(i.result)},i.onupgradeneeded=function(o){var l=o.target.result;n.forEach(function(c){l.objectStoreNames.contains(c)||l.createObjectStore(c)})}})};Xf.prototype.init=function(){return Ht.indexedDB?(this.dbPromise||(this.dbPromise=this._openDb()),this.dbPromise.then(function(t){return t instanceof Ht.IDBDatabase?xs.resolve():xs.reject(t)})):xs.reject("indexedDB is not supported in this browser")};Xf.prototype.isInitialized=function(){return!!this.dbPromise};Xf.prototype.makeTransaction=function(t,e){var n=this.storeName,r=function(s){return new xs(function(i,o){var l=s.transaction(n,t);l.oncomplete=function(){i(l)},l.onabort=l.onerror=function(){o(l.error)},e(l.objectStore(n))})};return this.dbPromise.then(r).catch((function(s){return s&&s.name==="InvalidStateError"?(this.dbPromise=this._openDb(),this.dbPromise.then(r)):xs.reject(s)}).bind(this))};Xf.prototype.setItem=function(t,e){return this.makeTransaction("readwrite",function(n){n.put(e,t)})};Xf.prototype.getItem=function(t){var e;return this.makeTransaction("readonly",function(n){e=n.get(t)}).then(function(){return e.result})};Xf.prototype.removeItem=function(t){return this.makeTransaction("readwrite",function(e){e.delete(t)})};Xf.prototype.getAll=function(){var t;return this.makeTransaction("readonly",function(e){t=e.getAll()}).then(function(){return t.result})};var QCe="mixpanelBrowserDb",Klt="mixpanelRecordingEvents",ZCe="mixpanelRecordingRegistry",JCe={version:1,storeNames:[Klt,ZCe]},xen="__mp_opt_in_out_";function wen(t,e){Zlt(!0,t,e)}function ken(t,e){Zlt(!1,t,e)}function Sen(t,e){return Qlt(t,e)==="1"}function Ylt(t,e){if(jen(e))return ds.warn('This browser has "Do Not Track" enabled. This will prevent the Mixpanel SDK from sending any data. To ignore the "Do Not Track" browser setting, initialize the Mixpanel instance with the config "ignore_dnt: true"'),!0;var n=Qlt(t,e)==="0";return n&&ds.warn("You are opted out of Mixpanel tracking. This will prevent the Mixpanel SDK from sending any data."),n}function fS(t){return tje(t,function(e){return this.get_config(e)})}function pS(t){return tje(t,function(e){return this._get_config(e)})}function fI(t){return tje(t,function(e){return this._get_config(e)})}function Cen(t,e){e=e||{},XCe(e).remove(eje(t,e),!!e.crossSubdomainCookie,e.cookieDomain)}function XCe(t){return t=t||{},t.persistenceType==="localStorage"?de.localStorage:de.cookie}function eje(t,e){return e=e||{},(e.persistencePrefix||xen)+t}function Qlt(t,e){return XCe(e).get(eje(t,e))}function jen(t){if(t&&t.ignoreDnt)return!1;var e=t&&t.window||Ht,n=e.navigator||{},r=!1;return de.each([n.doNotTrack,n.msDoNotTrack,e.doNotTrack],function(s){de.includes([!0,1,"1","yes"],s)&&(r=!0)}),r}function Zlt(t,e,n){if(!de.isString(e)||!e.length){ds.error("gdpr."+(t?"optIn":"optOut")+" called with an invalid token");return}n=n||{},XCe(n).set(eje(e,n),t?1:0,de.isNumber(n.cookieExpiration)?n.cookieExpiration:null,!!n.crossSubdomainCookie,!!n.secureCookie,!!n.crossSiteCookie,n.cookieDomain),n.track&&t&&n.track(n.trackEventName||"$opt_in",n.trackProperties,{send_immediately:!0})}function tje(t,e){return function(){var n=!1;try{var r=e.call(this,"token"),s=e.call(this,"ignore_dnt"),i=e.call(this,"opt_out_tracking_persistence_type"),o=e.call(this,"opt_out_tracking_cookie_prefix"),l=e.call(this,"window");r&&(n=Ylt(r,{ignoreDnt:s,persistenceType:i,persistencePrefix:o,window:l}))}catch(d){ds.error("Unexpected error when checking tracking opt-out status: "+d)}if(!n)return t.apply(this,arguments);var c=arguments[arguments.length-1];typeof c=="function"&&c(0)}}var Een=Vy("lock"),Jlt=function(t,e){e=e||{},this.storageKey=t,this.storage=e.storage||Wee(),this.pollIntervalMS=e.pollIntervalMS||100,this.timeoutMS=e.timeoutMS||2e3,this.promiseImpl=e.promiseImpl||xs};Jlt.prototype.withLock=function(t,e){var n=this.promiseImpl;return new n(de.bind(function(r,s){var i=e||new Date().getTime()+"|"+Math.random(),o=new Date().getTime(),l=this.storageKey,c=this.pollIntervalMS,d=this.timeoutMS,u=this.storage,h=l+":X",m=l+":Y",f=l+":Z",p=function(w){if(new Date().getTime()-o>d){Een.error("Timeout waiting for mutex on "+l+"; clearing lock. ["+i+"]"),u.removeItem(f),u.removeItem(m),b();return}setTimeout(function(){try{w()}catch(k){s(k)}},c*(Math.random()+.1))},g=function(w,k){w()?k():p(function(){g(w,k)})},v=function(){var w=u.getItem(m);return w&&w!==i?!1:(u.setItem(m,i),u.getItem(m)===i?!0:(UO(u,!0)||s(new Error("localStorage support dropped while acquiring lock")),!1))},b=function(){u.setItem(h,i),g(v,function(){if(u.getItem(h)===i){x();return}p(function(){if(u.getItem(m)!==i){b();return}g(function(){return!u.getItem(f)},x)})})},x=function(){u.setItem(f,"1");var w=function(){u.removeItem(f),u.getItem(m)===i&&u.removeItem(m),u.getItem(h)===i&&u.removeItem(h)};t().then(function(k){w(),r(k)}).catch(function(k){w(),s(k)})};try{if(UO(u,!0))b();else throw new Error("localStorage support check failed")}catch(w){s(w)}},this))};var pI=function(t){this.storage=t||Wee()};pI.prototype.init=function(){return this.storage?xs.resolve():xs.reject(new Error("localStorage is not available"))};pI.prototype.isInitialized=function(){return!0};pI.prototype.setItem=function(t,e){return new xs(de.bind(function(n,r){try{this.storage.setItem(t,sR(e))}catch(s){r(s)}n()},this))};pI.prototype.getItem=function(t){return new xs(de.bind(function(e,n){var r;try{r=eY(this.storage.getItem(t))}catch(s){n(s)}e(r)},this))};pI.prototype.removeItem=function(t){return new xs(de.bind(function(e,n){try{this.storage.removeItem(t)}catch(r){n(r)}e()},this))};var cDe=Vy("batch"),Hy=function(t,e){e=e||{},this.storageKey=t,this.usePersistence=e.usePersistence,this.usePersistence&&(this.queueStorage=e.queueStorage||new pI,this.lock=new Jlt(t,{storage:e.sharedLockStorage,timeoutMS:e.sharedLockTimeoutMS})),this.reportError=e.errorReporter||de.bind(cDe.error,cDe),this.pid=e.pid||null,this.memQueue=[],this.initialized=!1,e.enqueueThrottleMs?this.enqueuePersisted=pen(de.bind(this._enqueuePersisted,this),e.enqueueThrottleMs):this.enqueuePersisted=de.bind(function(n){return this._enqueuePersisted([n])},this)};Hy.prototype.ensureInit=function(){return this.initialized||!this.usePersistence?xs.resolve():this.queueStorage.init().then(de.bind(function(){this.initialized=!0},this)).catch(de.bind(function(t){this.reportError("Error initializing queue persistence. Disabling persistence",t),this.initialized=!0,this.usePersistence=!1},this))};Hy.prototype.enqueue=function(t,e){var n={id:YCe(),flushAfter:new Date().getTime()+e*2,payload:t};return this.usePersistence?this.enqueuePersisted(n):(this.memQueue.push(n),xs.resolve(!0))};Hy.prototype._enqueuePersisted=function(t){var e=de.bind(function(){return this.ensureInit().then(de.bind(function(){return this.readFromStorage()},this)).then(de.bind(function(n){return this.saveToStorage(n.concat(t))},this)).then(de.bind(function(n){return n&&(this.memQueue=this.memQueue.concat(t)),n},this)).catch(de.bind(function(n){return this.reportError("Error enqueueing items",n,t),!1},this))},this);return this.lock.withLock(e,this.pid).catch(de.bind(function(n){return this.reportError("Error acquiring storage lock",n),!1},this))};Hy.prototype.fillBatch=function(t){var e=this.memQueue.slice(0,t);return this.usePersistence&&e.length<t?this.ensureInit().then(de.bind(function(){return this.readFromStorage()},this)).then(de.bind(function(n){if(n.length){var r={};de.each(e,function(o){r[o.id]=!0});for(var s=0;s<n.length;s++){var i=n[s];if(new Date().getTime()>i.flushAfter&&!r[i.id]&&(i.orphaned=!0,e.push(i),e.length>=t))break}}return e},this)):xs.resolve(e)};var dDe=function(t,e){var n=[];return de.each(t,function(r){r.id&&!e[r.id]&&n.push(r)}),n};Hy.prototype.removeItemsByID=function(t){var e={};if(de.each(t,function(r){e[r]=!0}),this.memQueue=dDe(this.memQueue,e),this.usePersistence){var n=de.bind(function(){return this.ensureInit().then(de.bind(function(){return this.readFromStorage()},this)).then(de.bind(function(r){return r=dDe(r,e),this.saveToStorage(r)},this)).then(de.bind(function(){return this.readFromStorage()},this)).then(de.bind(function(r){for(var s=0;s<r.length;s++){var i=r[s];if(i.id&&e[i.id])throw new Error("Item not removed from storage")}return!0},this)).catch(de.bind(function(r){return this.reportError("Error removing items",r,t),!1},this))},this);return this.lock.withLock(n,this.pid).catch(de.bind(function(r){return this.reportError("Error acquiring storage lock",r),UO(this.lock.storage,!0)?!1:n().then(de.bind(function(s){return s||this.queueStorage.removeItem(this.storageKey).then(function(){return s})},this)).catch(de.bind(function(s){return this.reportError("Error clearing queue",s),!1},this))},this))}else return xs.resolve(!0)};var uDe=function(t,e){var n=[];return de.each(t,function(r){var s=r.id;if(s in e){var i=e[s];i!==null&&(r.payload=i,n.push(r))}else n.push(r)}),n};Hy.prototype.updatePayloads=function(t){return this.memQueue=uDe(this.memQueue,t),this.usePersistence?this.lock.withLock(de.bind(function(){return this.ensureInit().then(de.bind(function(){return this.readFromStorage()},this)).then(de.bind(function(n){return n=uDe(n,t),this.saveToStorage(n)},this)).catch(de.bind(function(n){return this.reportError("Error updating items",t,n),!1},this))},this),this.pid).catch(de.bind(function(e){return this.reportError("Error acquiring storage lock",e),!1},this)):xs.resolve(!0)};Hy.prototype.readFromStorage=function(){return this.ensureInit().then(de.bind(function(){return this.queueStorage.getItem(this.storageKey)},this)).then(de.bind(function(t){return t&&(de.isArray(t)||(this.reportError("Invalid storage entry:",t),t=null)),t||[]},this)).catch(de.bind(function(t){return this.reportError("Error retrieving queue",t),[]},this))};Hy.prototype.saveToStorage=function(t){return this.ensureInit().then(de.bind(function(){return this.queueStorage.setItem(this.storageKey,t)},this)).then(function(){return!0}).catch(de.bind(function(e){return this.reportError("Error saving queue",e),!1},this))};Hy.prototype.clear=function(){return this.memQueue=[],this.usePersistence?this.ensureInit().then(de.bind(function(){return this.queueStorage.removeItem(this.storageKey)},this)):xs.resolve()};var Nen=10*60*1e3,TD=Vy("batch"),ep=function(t,e){this.errorReporter=e.errorReporter,this.queue=new Hy(t,{errorReporter:de.bind(this.reportError,this),queueStorage:e.queueStorage,sharedLockStorage:e.sharedLockStorage,sharedLockTimeoutMS:e.sharedLockTimeoutMS,usePersistence:e.usePersistence,enqueueThrottleMs:e.enqueueThrottleMs}),this.libConfig=e.libConfig,this.sendRequest=e.sendRequestFunc,this.beforeSendHook=e.beforeSendHook,this.stopAllBatching=e.stopAllBatchingFunc,this.batchSize=this.libConfig.batch_size,this.flushInterval=this.libConfig.batch_flush_interval_ms,this.stopped=!this.libConfig.batch_autostart,this.consecutiveRemovalFailures=0,this.itemIdsSentSuccessfully={},this.flushOnlyOnInterval=e.flushOnlyOnInterval||!1,this._flushPromise=null};ep.prototype.enqueue=function(t){return this.queue.enqueue(t,this.flushInterval)};ep.prototype.start=function(){return this.stopped=!1,this.consecutiveRemovalFailures=0,this.flush()};ep.prototype.stop=function(){this.stopped=!0,this.timeoutID&&(clearTimeout(this.timeoutID),this.timeoutID=null)};ep.prototype.clear=function(){return this.queue.clear()};ep.prototype.resetBatchSize=function(){this.batchSize=this.libConfig.batch_size};ep.prototype.resetFlush=function(){this.scheduleFlush(this.libConfig.batch_flush_interval_ms)};ep.prototype.scheduleFlush=function(t){this.flushInterval=t,this.stopped||(this.timeoutID=setTimeout(de.bind(function(){this.stopped||(this._flushPromise=this.flush())},this),this.flushInterval))};ep.prototype.sendRequestPromise=function(t,e){return new xs(de.bind(function(n){this.sendRequest(t,e,n)},this))};ep.prototype.flush=function(t){if(this.requestInProgress)return TD.log("Flush: Request already in progress"),xs.resolve();this.requestInProgress=!0,t=t||{};var e=this.libConfig.batch_request_timeout_ms,n=new Date().getTime(),r=this.batchSize;return this.queue.fillBatch(r).then(de.bind(function(s){var i=s.length===r,o=[],l={};if(de.each(s,function(h){var m=h.payload;if(this.beforeSendHook&&!h.orphaned&&(m=this.beforeSendHook(m)),m){m.event&&m.properties&&(m.properties=de.extend({},m.properties,{mp_sent_by_lib_version:bh.LIB_VERSION}));var f=!0,p=h.id;p?(this.itemIdsSentSuccessfully[p]||0)>5&&(this.reportError("[dupe] item ID sent too many times, not sending",{item:h,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[p]}),f=!1):this.reportError("[dupe] found item with no ID",{item:h}),f&&o.push(m)}l[h.id]=m},this),o.length<1)return this.requestInProgress=!1,this.resetFlush(),xs.resolve();var c=de.bind(function(){return this.queue.removeItemsByID(de.map(s,function(h){return h.id})).then(de.bind(function(h){return de.each(s,de.bind(function(m){var f=m.id;f?(this.itemIdsSentSuccessfully[f]=this.itemIdsSentSuccessfully[f]||0,this.itemIdsSentSuccessfully[f]++,this.itemIdsSentSuccessfully[f]>5&&this.reportError("[dupe] item ID sent too many times",{item:m,batchSize:s.length,timesSent:this.itemIdsSentSuccessfully[f]})):this.reportError("[dupe] found item with no ID while removing",{item:m})},this)),h?(this.consecutiveRemovalFailures=0,this.flushOnlyOnInterval&&!i?(this.resetFlush(),xs.resolve()):this.flush()):(++this.consecutiveRemovalFailures>5?(this.reportError("Too many queue failures; disabling batching system."),this.stopAllBatching()):this.resetFlush(),xs.resolve())},this))},this),d=de.bind(function(h){this.requestInProgress=!1;try{if(t.unloading)return this.queue.updatePayloads(l);if(de.isObject(h)&&h.error==="timeout"&&new Date().getTime()-n>=e)return this.reportError("Network timeout; retrying"),this.flush();if(de.isObject(h)&&(h.httpStatusCode>=500||h.httpStatusCode===429||h.httpStatusCode<=0&&!yen()||h.error==="timeout")){var m=this.flushInterval*2;return h.retryAfter&&(m=parseInt(h.retryAfter,10)*1e3||m),m=Math.min(Nen,m),this.reportError("Error; retry in "+m+" ms"),this.scheduleFlush(m),xs.resolve()}else if(de.isObject(h)&&h.httpStatusCode===413)if(s.length>1){var f=Math.max(1,Math.floor(r/2));return this.batchSize=Math.min(this.batchSize,f,s.length-1),this.reportError("413 response; reducing batch size to "+this.batchSize),this.resetFlush(),xs.resolve()}else return this.reportError("Single-event request too large; dropping",s),this.resetBatchSize(),c();else return c()}catch(p){this.reportError("Error handling API response",p),this.resetFlush()}},this),u={method:"POST",verbose:!0,ignore_json_errors:!0,timeout_ms:e};return t.unloading&&(u.transport="sendBeacon"),TD.log("MIXPANEL REQUEST:",o),this.sendRequestPromise(o,u).then(d)},this)).catch(de.bind(function(s){this.reportError("Error flushing request queue",s),this.resetFlush()},this))};ep.prototype.reportError=function(t,e){if(TD.error.apply(TD.error,arguments),this.errorReporter)try{e instanceof Error||(e=new Error(t)),this.errorReporter(t,e)}catch(n){TD.error(n)}};var nje=function(t){var e=Date.now();return!t||e>t.maxExpires||e>t.idleExpires},Ten=250,Xlt=function(t,e){if(!de.isArray(t))return t&&e.critical("record_allowed_iframe_origins must be an array of origin strings, cross-origin recording will be disabled."),[];for(var n=[],r=0;r<t.length;r++)try{var s=new URL(t[r]).origin;if(s==="null"){e.critical(t[r]+" has an opaque origin. Skipping this entry.");continue}n.push(s)}catch{e.critical(t[r]+" is not a valid origin URL. Skipping this entry.")}return n},zO="change",Zx="click",Kpe="hashchange",_en="input",hDe="load",T1="mp_locationchange",mDe="popstate",qee="scrollend",rje="scroll",Aen="select",tY="submit",Pen="toggle",fDe="visibilitychange",Ren=["clientX","clientY","offsetX","offsetY","pageX","pageY","screenX","screenY","x","y"],pDe=["mp-include"],Ype=["mp-no-track"],gDe=Ype.concat(["mp-sensitive"]),Ien=["aria-label","aria-labelledby","aria-describedby","href","name","role","title","type"],Men={button:!0,checkbox:!0,combobox:!0,grid:!0,link:!0,listbox:!0,menu:!0,menubar:!0,menuitem:!0,menuitemcheckbox:!0,menuitemradio:!0,navigation:!0,option:!0,radio:!0,radiogroup:!0,searchbox:!0,slider:!0,spinbutton:!0,switch:!0,tab:!0,tablist:!0,textbox:!0,tree:!0,treegrid:!0,treeitem:!0},Len={base:!0,head:!0,html:!0,link:!0,meta:!0,script:!0,style:!0,title:!0,br:!0,hr:!0,wbr:!0,noscript:!0,picture:!0,source:!0,template:!0,track:!0},Den={article:!0,div:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,p:!0,section:!0,span:!0},vDe=["onclick","onmousedown","onmouseup","onpointerdown","onpointerup","ontouchend","ontouchstart"],$en=5,Oa=Vy("autocapture");function Qpe(t){for(var e={},n=ect(t).split(" "),r=0;r<n.length;r++){var s=n[r];s&&(e[s]=!0)}return e}function ect(t){switch(typeof t.className){case"string":return t.className;case"object":return t.className.baseVal||t.getAttribute("class")||"";default:return""}}function Oen(t){if(t.previousElementSibling)return t.previousElementSibling;do t=t.previousSibling;while(t&&!tct(t));return t}function yDe(t,e,n,r,s,i){var o={$classes:ect(t).split(" "),$tag_name:t.tagName.toLowerCase()},l=t.id;l&&(o.$id=l),sje(t,e,s,i)&&de.each(Ien.concat(r),function(h){if(t.hasAttribute(h)&&!n[h]){var m=t.getAttribute(h);nY(m)&&(o["$attr-"+h]=m)}});for(var c=1,d=1,u=t;u=Oen(u);)c++,u.tagName===t.tagName&&d++;return o.$nth_child=c,o.$nth_of_type=d,o}function Fen(t,e){var n=e.allowElementCallback,r=e.allowSelectors||[],s=e.blockAttrs||[],i=e.blockElementCallback,o=e.blockSelectors||[],l=e.captureTextContent||!1,c=e.captureExtraAttrs||[],d=e.capturedForHeatMap||!1,u={};de.each(s,function(S){u[S]=!0});var h=null,m=typeof t.target>"u"?t.srcElement:t.target;if(nct(m)&&(m=m.parentNode),Ven(m,t)&&Zpe(m,t,n,r)&&!Voe(m,t,i,o)){for(var f=[m],p=m;p.parentNode&&!Xv(p,"body");)f.push(p.parentNode),p=p.parentNode;var g=[],v,b=!1;if(de.each(f,function(S){var C=sje(S,t,n,r);!u.href&&S.tagName.toLowerCase()==="a"&&(v=S.getAttribute("href"),v=C&&nY(v)&&v),Voe(S,t,i,o)&&(b=!0),g.push(yDe(S,t,u,c,n,r))},this),!b){var x=bs.documentElement;if(h={$event_type:t.type,$host:Ht.location.host,$pathname:Ht.location.pathname,$elements:g,$el_attr__href:v,$viewportHeight:Math.max(x.clientHeight,Ht.innerHeight||0),$viewportWidth:Math.max(x.clientWidth,Ht.innerWidth||0),$pageHeight:bs.body.offsetHeight||0,$pageWidth:bs.body.offsetWidth||0},de.each(c,function(S){if(!u[S]&&m.hasAttribute(S)){var C=m.getAttribute(S);nY(C)&&(h["$el_attr__"+S]=C)}}),l&&(w=bDe(m,t,n,r),w&&w.length&&(h.$el_text=w)),t.type===Zx&&(de.each(Ren,function(S){S in t&&(h["$"+S]=t[S])}),d&&(h.$captured_for_heatmap=!0),m=Ben(t)),l){var w=bDe(m,t,n,r);w&&w.length&&(h.$el_text=w)}if(m){if(!Zpe(m,t,n,r)||Voe(m,t,i,o))return null;var k=yDe(m,t,u,c,n,r);h.$target=k,h.$el_classes=k.$classes,de.extend(h,de.strip_empty_properties({$el_id:k.$id,$el_tag_name:k.$tag_name}))}}}return h}function bDe(t,e,n,r){var s="";return sje(t,e,n,r)&&t.childNodes&&t.childNodes.length&&de.each(t.childNodes,function(i){nct(i)&&i.textContent&&(s+=de.trim(i.textContent).split(/(\s+)/).filter(nY).join("").replace(/[\r\n]/g," ").replace(/[ ]+/g," ").substring(0,255))}),de.trim(s)}function Ben(t){for(var e=t.target,n=t.composedPath(),r=0;r<n.length;r++){var s=n[r];if(Xv(s,"a")||Xv(s,"button")||Xv(s,"input")||Xv(s,"select")||s.getAttribute&&s.getAttribute("role")==="button"){e=s;break}if(s===e)break}return e}function Zpe(t,e,n,r){if(n)try{if(!n(t,e))return!1}catch(o){return Oa.critical("Error while checking element in allowElementCallback",o),!1}if(!r.length)return!0;for(var s=0;s<r.length;s++){var i=r[s];try{if(t.matches(i))return!0}catch(o){Oa.critical("Error while checking selector: "+i,o)}}return!1}function Voe(t,e,n,r){var s;if(n)try{if(n(t,e))return!0}catch(l){return Oa.critical("Error while checking element in blockElementCallback",l),!0}if(r&&r.length)for(s=0;s<r.length;s++){var i=r[s];try{if(t.matches(i))return!0}catch(l){Oa.critical("Error while checking selector: "+i,l)}}var o=Qpe(t);for(s=0;s<Ype.length;s++)if(o[Ype[s]])return!0;return!1}function tct(t){return t&&t.nodeType===1}function Xv(t,e){return t&&t.tagName&&t.tagName.toLowerCase()===e.toLowerCase()}function nct(t){return t&&t.nodeType===3}function Uen(){try{var t=bs.createElement("div");return!!t.matches}catch{return!1}}function zen(){return typeof WeakSet<"u"}function Ven(t,e){if(!t||Xv(t,"html")||!tct(t))return!1;var n=t.tagName.toLowerCase();switch(n){case"form":return e.type===tY;case"input":return["button","submit"].indexOf(t.getAttribute("type"))===-1?e.type===zO:e.type===Zx;case"select":case"textarea":return e.type===zO;default:return e.type===Zx}}function rct(t){var e=(t.name||t.id||"").toString().toLowerCase();if(typeof e=="string"){var n=/^cc|cardnum|ccnum|creditcard|csc|cvc|cvv|exp|pass|pwd|routing|seccode|securitycode|securitynum|socialsec|socsec|ssn/i;if(n.test(e.replace(/[^a-zA-Z0-9]/g,"")))return!0}return!1}function sje(t,e,n,r){var s;if(!Zpe(t,e,n,r))return!1;for(var i=t;i.parentNode&&!Xv(i,"body");i=i.parentNode){var o=Qpe(i);for(s=0;s<gDe.length;s++)if(o[gDe[s]])return!1}var l=Qpe(t);for(s=0;s<pDe.length;s++)if(l[pDe[s]])return!0;if(Xv(t,"input")||Xv(t,"select")||Xv(t,"textarea")||t.getAttribute("contenteditable")==="true")return!1;var c=t.type||"";if(typeof c=="string")switch(c.toLowerCase()){case"hidden":return!1;case"password":return!1}return!rct(t)}function nY(t){if(t===null||de.isUndefined(t))return!1;if(typeof t=="string"){t=de.trim(t);var e=/^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/;if(e.test((t||"").replace(/[- ]/g,"")))return!1;var n=/(^\d{3}-?\d{2}-?\d{4}$)/;if(n.test(t))return!1}return!0}function sct(t){var e="onscrollend"in Ht,n=A2(t),r=qee;if(!e){var s=null,i=100;n=A2(function(){clearTimeout(s),s=setTimeout(t,i)}),r=rje}return{listener:n,eventType:r}}function Hen(t){for(var e=0;e<vDe.length;e++)if(t.hasAttribute(vDe[e]))return!0;return!1}function Gen(t){var e=t.getAttribute("role");if(!e)return!1;var n=e.trim().split(/\s+/)[0].toLowerCase();return Men[n]}function Hoe(t){var e=t.tagName.toLowerCase();return!!(e==="button"||e==="input"||e==="select"||e==="textarea"||e==="details"||e==="dialog"||t.isContentEditable||t.onclick||t.onmousedown||t.onmouseup||t.ontouchstart||t.ontouchend||Hen(t)||Gen(t)||e==="a"&&t.hasAttribute("href")||t.hasAttribute("tabindex"))}function ict(t){if(!t||!t.tagName)return!0;var e=t.tagName.toLowerCase();if(Len[e])return!0;if(Hoe(t))return!1;for(var n=t.parentElement,r=0;n&&r<$en;){if(Hoe(n))return!1;if(n.getRootNode&&n.getRootNode()!==bs){var s=n.getRootNode();if(s.host&&Hoe(s.host))return!1}n=n.parentElement,r++}return!!Den[e]}function act(t){return"composedPath"in t?t.composedPath():[]}function oct(t){var e=act(t);return e&&e.length>0?e[0]:t.target||t.srcElement}var lct=".mp-mask, .fs-mask, .amp-mask, .rr-mask, .ph-mask",Wen="data-rr-is-password",qen=["password","email","tel","hidden"];function qU(t){return t?Array.isArray(t)?t:[t]:[]}function Ken(t){var e={input:{maskingSelector:"",unmaskingSelector:"",maskAll:!0},text:{maskingSelector:"",unmaskingSelector:"",maskAll:!0}},n=t.get_config("record_mask_input_selector"),r=t.get_config("record_unmask_input_selector"),s=t.get_config("record_mask_all_inputs");e.input.maskingSelector=qU(n).join(","),e.input.unmaskingSelector=qU(r).join(","),s!==void 0&&(e.input.maskAll=s);var i=t.get_config("record_mask_text_selector"),o=t.get_config("record_unmask_text_selector"),l=t.get_config("record_mask_all_text"),c=t.get_config("record_mask_text_class"),d=qU(i);if(c)if(c instanceof RegExp)e.text._legacyClassRegex=c;else{var u="."+c;d.indexOf(u)===-1&&d.push(u)}return e.text.maskingSelector=d.join(","),e.text.unmaskingSelector=qU(o).join(","),l===void 0&&i!==void 0?e.text.maskAll=!1:l!==void 0&&(e.text.maskAll=l),e}function FA(t,e){return e?!!t.closest(e):!1}function Yen(t,e){var n=(t.getAttribute("type")||"").toLowerCase();if(qen.indexOf(n)!==-1)return!0;var r=(t.getAttribute("autocomplete")||"").toLowerCase();return r&&r!==""&&r!=="off"||t.hasAttribute(Wen)||rct(t)?!0:e.input.maskAll?!FA(t,e.input.unmaskingSelector):!!(FA(t,e.input.maskingSelector)||FA(t,lct))}function Qen(t,e){return t?e.text._legacyClassRegex&&Tpe(t,e.text._legacyClassRegex)?!0:e.text.maskAll?!FA(t,e.text.unmaskingSelector):!!(FA(t,e.text.maskingSelector)||FA(t,lct)):!1}var P2=Vy("network-plugin");function rY(t){return Math.round(Date.now()-t.performance.now())}var Goe={initiatorTypes:["audio","beacon","body","css","early-hint","embed","fetch","frame","iframe","icon","image","img","input","link","navigation","object","ping","script","track","video","xmlhttprequest"],ignoreRequestFn:function(){return!1},recordHeaders:{request:[],response:[]},recordBodyUrls:{request:[],response:[]},recordInitialRequests:!1};function Zen(t){return t.entryType==="navigation"}function Jpe(t){return t.entryType==="resource"}function Jen(t,e){for(var n=t.length,r=n-1;r>=0;r-=1)if(e(t[r]))return t[r]}function cct(t,e,n){if(!(e in t)||typeof t[e]!="function")return function(){};var r=t[e],s=n(r);return t[e]=s,function(){t[e]=r}}var Woe=1024*1024;function dct(t){return!t||typeof t!="string"?t:t.length>Woe?(P2.error("Body truncated from "+t.length+" to "+Woe+" characters"),t.substring(0,Woe)+"... [truncated]"):t}function Xen(t,e,n){if(!e.PerformanceObserver)return P2.error("PerformanceObserver not supported"),function(){};if(n.recordInitialRequests){var r=e.performance.getEntries().filter(function(i){return Zen(i)||Jpe(i)&&n.initiatorTypes.includes(i.initiatorType)});t({requests:r.map(function(i){return{url:i.name,initiatorType:i.initiatorType,status:"responseStatus"in i?i.responseStatus:void 0,startTime:Math.round(i.startTime),endTime:Math.round(i.responseEnd),timeOrigin:rY(e)}}),isInitial:!0})}var s=new e.PerformanceObserver(function(i){var o=i.getEntries().filter(function(l){return Jpe(l)&&n.initiatorTypes.includes(l.initiatorType)&&l.initiatorType!=="xmlhttprequest"&&l.initiatorType!=="fetch"});t({requests:o.map(function(l){return{url:l.name,initiatorType:l.initiatorType,status:"responseStatus"in l?l.responseStatus:void 0,startTime:Math.round(l.startTime),endTime:Math.round(l.responseEnd),timeOrigin:rY(e)}})})});return s.observe({entryTypes:["navigation","resource"]}),function(){s.disconnect()}}function sY(t,e,n){return!e[t]||e[t].length===0?!1:e[t].includes(n.toLowerCase())}function iY(t,e,n){return!e[t]||e[t].length===0?!1:XK(n,e[t])}function xDe(t){if(t==null)return null;var e;if(typeof t=="string")e=t;else if(t instanceof Document)e=t.textContent;else if(t instanceof FormData)e=de.HTTPBuildQuery(t);else if(de.isObject(t))try{e=JSON.stringify(t)}catch{return"Failed to stringify response object"}else return"Cannot read body of type "+typeof t;return dct(e)}function wDe(t){return new Promise(function(e){var n=setTimeout(function(){e("Timeout while trying to read body")},500);try{t.clone().text().then(function(r){clearTimeout(n),e(dct(r))},function(r){clearTimeout(n),e("Failed to read body: "+String(r))})}catch(r){clearTimeout(n),e("Failed to read body: "+String(r))}})}function ije(t,e,n,r,s,i){if(i===void 0&&(i=0),i>10)return P2.error("Cannot find performance entry"),Promise.resolve(null);var o=t.performance.getEntriesByName(n),l=Jen(o,function(c){return Jpe(c)&&c.initiatorType===e&&(!r||c.startTime>=r)&&(!s||c.startTime<=s)});return l?Promise.resolve(l):new Promise(function(c){setTimeout(c,50*i)}).then(function(){return ije(t,e,n,r,s,i+1)})}function etn(t,e,n){if(!n.initiatorTypes.includes("xmlhttprequest"))return function(){};var r=cct(e.XMLHttpRequest.prototype,"open",function(s){return function(i,o,l,c,d){l===void 0&&(l=!0);var u=this,h=new Request(o,{method:i}),m={},f,p,g={},v=u.setRequestHeader.bind(u);u.setRequestHeader=function(x,w){return sY("request",n.recordHeaders,x)&&(g[x]=w),v(x,w)},m.requestHeaders=g;var b=u.send.bind(u);u.send=function(x){return iY("request",n.recordBodyUrls,h.url)&&(m.requestBody=xDe(x)),f=e.performance.now(),b(x)},u.addEventListener("readystatechange",function(){if(u.readyState===u.DONE){p=e.performance.now();var x={},w=u.getAllResponseHeaders();if(w){var k=w.trim().split(/[\r\n]+/);k.forEach(function(S){if(S){var C=S.indexOf(": ");if(C!==-1){var j=S.substring(0,C),E=S.substring(C+2);j&&sY("response",n.recordHeaders,j)&&(x[j]=E)}}})}m.responseHeaders=x,iY("response",n.recordBodyUrls,h.url)&&(m.responseBody=xDe(u.response)),ije(e,"xmlhttprequest",h.url,f,p).then(function(S){if(!S){P2.error("Failed to get performance entry for XHR request to "+h.url);return}var C={url:S.name,method:h.method,initiatorType:S.initiatorType,status:u.status,startTime:Math.round(S.startTime),endTime:Math.round(S.responseEnd),timeOrigin:rY(e),requestHeaders:m.requestHeaders,requestBody:m.requestBody,responseHeaders:m.responseHeaders,responseBody:m.responseBody};t({requests:[C]})}).catch(function(S){P2.error("Error recording XHR request to "+h.url+": "+String(S))})}}),s.call(u,i,o,l,c,d)}});return function(){r()}}function ttn(t,e,n){if(!n.initiatorTypes.includes("fetch"))return function(){};var r=cct(e,"fetch",function(s){return function(){var i=new Request(arguments[0],arguments[1]),o,l={},c,d,u,h=Promise.resolve(void 0),m=Promise.resolve(void 0);try{var f={};i.headers.forEach(function(p,g){sY("request",n.recordHeaders,g)&&(f[g]=p)}),l.requestHeaders=f,iY("request",n.recordBodyUrls,i.url)&&(h=wDe(i).then(function(p){l.requestBody=p})),c=e.performance.now(),u=s.apply(e,arguments).then(function(p){o=p,d=e.performance.now();var g={};return o.headers.forEach(function(v,b){sY("response",n.recordHeaders,b)&&(g[b]=v)}),l.responseHeaders=g,iY("response",n.recordBodyUrls,i.url)&&(m=wDe(o).then(function(v){l.responseBody=v})),o})}catch(p){u=Promise.reject(p)}return Promise.all([h,m,u]).then(function(){return ije(e,"fetch",i.url,c,d)}).then(function(p){if(!p){P2.error("Failed to get performance entry for fetch request to "+i.url);return}var g={url:p.name,method:i.method,initiatorType:p.initiatorType,status:o?o.status:void 0,startTime:Math.round(p.startTime),endTime:Math.round(p.responseEnd),timeOrigin:rY(e),requestHeaders:l.requestHeaders,requestBody:l.requestBody,responseHeaders:l.responseHeaders,responseBody:l.responseBody};t({requests:[g]})}).catch(function(p){P2.error("Error recording fetch request to "+i.url+": "+String(p))}),u}});return function(){r()}}function ntn(t,e,n){if(!("performance"in e))return function(){};var r=Object.assign({},Goe.recordHeaders,n.recordHeaders||{}),s=Object.assign({},Goe.recordBodyUrls,n.recordBodyUrls||{});n=Object.assign({},n,{recordHeaders:r,recordBodyUrls:s});var i=Object.assign({},Goe,n),o=function(u){var h=u.requests.filter(function(m){var f=XK(m.url,i.ignoreRequestUrls||[]);return!f&&!i.ignoreRequestFn(m)});(h.length>0||u.isInitial)&&t(Object.assign({},u,{requests:h}))},l=Xen(o,e,i),c=etn(o,e,i),d=ttn(o,e,i);return function(){l(),c(),d()}}var rtn="rrweb/network@1.mp",stn=function(t){return{name:rtn,observer:ntn,options:t}},Wj=Vy("recorder"),itn=Ht.CompressionStream,atn={batch_size:1e3,batch_flush_interval_ms:10*1e3,batch_request_timeout_ms:90*1e3,batch_autostart:!0},otn=new Set([ps.MouseMove,ps.MouseInteraction,ps.Scroll,ps.ViewportResize,ps.Input,ps.TouchMove,ps.MediaInteraction,ps.Drag,ps.Selection]);function ltn(t){return t.type===ri.IncrementalSnapshot&&otn.has(t.data.source)}var _l=function(t){this._mixpanel=t.mixpanelInstance,this._onIdleTimeout=t.onIdleTimeout||J1,this._onMaxLengthReached=t.onMaxLengthReached||J1,this._onBatchSent=t.onBatchSent||J1,this._rrwebRecord=t.rrwebRecord||null,this._stopRecording=null,this.replayId=t.replayId,this.batchStartUrl=t.batchStartUrl||null,this.replayStartUrl=t.replayStartUrl||null,this.idleExpires=t.idleExpires||null,this.maxExpires=t.maxExpires||null,this.replayStartTime=t.replayStartTime||null,this.lastEventTimestamp=t.lastEventTimestamp||null,this.seqNo=t.seqNo||0,this.idleTimeoutId=null,this.maxTimeoutId=null,this.recordMaxMs=ND,this.recordMinMs=0,this._recordMinMsCheckStart=null;var e=UO(t.sharedLockStorage||Wee(),!0)&&!this.getConfig("disable_persistence");this.batcherKey="__mprec_"+this.getConfig("name")+"_"+this.getConfig("token")+"_"+this.replayId,this.queueStorage=new Xf(QCe,Klt,JCe),this.batcher=new ep(this.batcherKey,{errorReporter:this.reportError.bind(this),flushOnlyOnInterval:!0,libConfig:atn,sendRequestFunc:this.flushEventsWithOptOut.bind(this),queueStorage:this.queueStorage,sharedLockStorage:t.sharedLockStorage,usePersistence:e,stopAllBatchingFunc:this.stopRecording.bind(this),enqueueThrottleMs:Ten,sharedLockTimeoutMS:10*1e3})};_l.prototype.getUserIdInfo=function(){if(this.finalFlushUserIdInfo)return this.finalFlushUserIdInfo;var t={distinct_id:String(this._mixpanel.get_distinct_id())},e=this._mixpanel.get_property("$device_id");e&&(t.$device_id=e);var n=this._mixpanel.get_property("$user_id");return n&&(t.$user_id=n),t};_l.prototype.unloadPersistedData=function(){return this.batcher.stop(),this.queueStorage.init().catch((function(){this.reportError("Error initializing IndexedDB storage for unloading persisted data.")}).bind(this)).then((function(){return this.getDurationMs()<this._getRecordMinMs()?this.queueStorage.removeItem(this.batcherKey):this.batcher.flush().then((function(){return this.queueStorage.removeItem(this.batcherKey)}).bind(this))}).bind(this))};_l.prototype.getConfig=function(t){return this._mixpanel.get_config(t)};_l.prototype.get_config=function(t){return this.getConfig(t)};_l.prototype.startRecording=function(t){if(this._rrwebRecord===null){this.reportError("rrweb record function not provided. ");return}if(this._stopRecording!==null){Wj.log("Recording already in progress, skipping startRecording.");return}this.recordMaxMs=this.getConfig("record_max_ms"),this.recordMaxMs>ND&&(this.recordMaxMs=ND,Wj.critical("record_max_ms cannot be greater than "+ND+"ms. Capping value.")),this.maxExpires||(this.maxExpires=new Date().getTime()+this.recordMaxMs),this.recordMinMs=this._getRecordMinMs(),this.replayStartTime||(this.replayStartTime=new Date().getTime(),this.batchStartUrl=de.info.currentUrl(),this.replayStartUrl=de.info.currentUrl()),t||this.recordMinMs>0?(this.batcher.stop(),this._recordMinMsCheckStart=null):this.batcher.start();var e=(function(){clearTimeout(this.idleTimeoutId);var d=this.getConfig("record_idle_timeout_ms");this.idleTimeoutId=setTimeout(this._onIdleTimeout,d),this.idleExpires=new Date().getTime()+d}).bind(this);e();var n=this.getConfig("record_block_selector");(n===""||n===null)&&(n=void 0);var r=Ken(this._mixpanel),s=[];if(this.getConfig("record_network")){var i=this.getConfig("record_network_options")||{},o=(i.ignoreRequestUrls||[]).slice();o.push(this._getApiRoute()),i.ignoreRequestUrls=o,s.push(stn(i))}this.getConfig("record_console")&&s.push(sen({stringifyOptions:{stringLengthLimit:1e3,numOfKeysLimit:50,depthOfLimit:2}}));var l=Xlt(this.getConfig("record_allowed_iframe_origins"),Wj);try{this._stopRecording=this._rrwebRecord({emit:(function(d){if(this.idleExpires&&this.idleExpires<d.timestamp){this._onIdleTimeout();return}this._recordMinMsCheckStart===null&&(this._recordMinMsCheckStart=d.timestamp),ltn(d)&&(this.batcher.stopped&&d.timestamp-this._recordMinMsCheckStart>=this.recordMinMs&&this.batcher.start(),e()),this.__enqueuePromise=this.batcher.enqueue(d),(this.lastEventTimestamp===null||d.timestamp>this.lastEventTimestamp)&&(this.lastEventTimestamp=d.timestamp)}).bind(this),blockClass:this.getConfig("record_block_class"),blockSelector:n,collectFonts:this.getConfig("record_collect_fonts"),dataURLOptions:{type:"image/webp",quality:.6},maskAllInputs:!0,maskTextSelector:"*",maskInputFn:this._getMaskFn(Yen,r),maskTextFn:this._getMaskFn(Qen,r),recordCrossOriginIframes:l.length>0,allowedIframeOrigins:l,recordCanvas:this.getConfig("record_canvas"),sampling:{canvas:15},plugins:s})}catch(d){this.reportError("Unexpected error when starting rrweb recording.",d)}if(typeof this._stopRecording!="function"){this.reportError("rrweb failed to start, skipping this recording."),this._stopRecording=null,this.stopRecording();return}var c=this.maxExpires-new Date().getTime();this.maxTimeoutId=setTimeout(this._onMaxLengthReached.bind(this),c)};_l.prototype.stopRecording=function(t){if(this.finalFlushUserIdInfo=this.getUserIdInfo(),!this.isRrwebStopped()){try{this._stopRecording()}catch(n){this.reportError("Error with rrweb stopRecording",n)}this._stopRecording=null}var e;return this.batcher.stopped?e=this.batcher.clear():t||(e=this.batcher.flush()),this.batcher.stop(),clearTimeout(this.idleTimeoutId),clearTimeout(this.maxTimeoutId),e};_l.prototype.isRrwebStopped=function(){return this._stopRecording===null};_l.prototype.flushEventsWithOptOut=function(t,e,n){var r=(function(s){s===0&&(this.stopRecording(),n({error:"Tracking has been opted out, stopping recording."}))}).bind(this);this._flushEvents(t,e,n,r)};_l.prototype.serialize=function(){var t;try{t=this._mixpanel.get_tab_id()}catch(e){this.reportError("Error getting tab ID for serialization ",e),t=null}return{replayId:this.replayId,seqNo:this.seqNo,replayStartTime:this.replayStartTime,batchStartUrl:this.batchStartUrl,replayStartUrl:this.replayStartUrl,lastEventTimestamp:this.lastEventTimestamp,idleExpires:this.idleExpires,maxExpires:this.maxExpires,tabId:t}};_l.deserialize=function(t,e){var n=new _l(de.extend({},e,{replayId:t.replayId,batchStartUrl:t.batchStartUrl,replayStartUrl:t.replayStartUrl,idleExpires:t.idleExpires,maxExpires:t.maxExpires,replayStartTime:t.replayStartTime,lastEventTimestamp:t.lastEventTimestamp,seqNo:t.seqNo,sharedLockStorage:e.sharedLockStorage}));return n};_l.prototype._getApiRoute=function(){return this.getConfig("api_routes").record};_l.prototype._sendRequest=function(t,e,n,r){var s=(function(o,l){o.status===200&&this.replayId===t&&(this.seqNo++,this.batchStartUrl=de.info.currentUrl()),this._onBatchSent(),r({status:0,httpStatusCode:o.status,responseBody:l,retryAfter:o.headers.get("Retry-After")})}).bind(this),i=this._mixpanel.get_api_host&&this._mixpanel.get_api_host("record")||this.getConfig("api_host");Ht.fetch(i+"/"+this._getApiRoute()+"?"+new URLSearchParams(e),{method:"POST",headers:{Authorization:"Basic "+btoa(this.getConfig("token")+":"),"Content-Type":"application/octet-stream"},body:n}).then(function(o){o.json().then(function(l){s(o,l)}).catch(function(l){r({error:l})})}).catch(function(o){r({error:o,httpStatusCode:0})})};_l.prototype._flushEvents=fS(function(t,e,n){var r=t.length;if(r>0){for(var s=this.replayId,i=1/0,o=-1/0,l=!1,c=0;c<r;c++)i=Math.min(i,t[c].timestamp),o=Math.max(o,t[c].timestamp),t[c].type===ri.FullSnapshot&&(l=!0);if(this.seqNo===0){if(!l){n({error:"First batch does not contain a full snapshot. Aborting recording."}),this.stopRecording(!0);return}this.replayStartTime=i}else this.replayStartTime||(this.reportError("Replay start time not set but seqNo is not 0. Using current batch start time as a fallback."),this.replayStartTime=i);var d=o-this.replayStartTime,u={$current_url:this.batchStartUrl,$lib_version:bh.LIB_VERSION,batch_start_time:i/1e3,mp_lib:"web",replay_id:s,replay_length_ms:d,replay_start_time:this.replayStartTime/1e3,replay_start_url:this.replayStartUrl,seq:this.seqNo},h=JSON.stringify(t);if(Object.assign(u,this.getUserIdInfo()),ben(Bv,ox.vendor,p4)){var m=new Blob([h],{type:"application/json"}).stream(),f=m.pipeThrough(new itn("gzip"));new Response(f).blob().then((function(p){u.format="gzip",this._sendRequest(s,u,p,n)}).bind(this))}else u.format="body",this._sendRequest(s,u,h,n)}});_l.prototype.reportError=function(t,e){Wj.error.apply(Wj.error,arguments);try{!e&&!(t instanceof Error)&&(t=new Error(t)),this.getConfig("error_reporter")(t,e)}catch(n){Wj.error(n)}};_l.prototype.getDurationMs=function(){return this.replayStartTime===null?0:this.lastEventTimestamp===null?new Date().getTime()-this.replayStartTime:this.lastEventTimestamp-this.replayStartTime};_l.prototype._getRecordMinMs=function(){var t=this.getConfig("record_min_ms");return t>Foe?(Wj.critical("record_min_ms cannot be greater than "+Foe+"ms. Capping value."),Foe):t};_l.prototype._getMaskFn=function(t,e){return(function(n,r){if(!n.trim().length)return"";var s=!0;try{s=t(r,e)}catch(o){this.reportError("Error checking if text should be masked, defaulting to masked",o)}if(s){var i=Math.min(n.length,1e4);return"*".repeat(i)}else return n}).bind(this)};var E0=function(t){this.idb=new Xf(QCe,ZCe,JCe),this.errorReporter=t.errorReporter,this.mixpanelInstance=t.mixpanelInstance,this.sharedLockStorage=t.sharedLockStorage};E0.prototype.isPersistenceEnabled=function(){return!this.mixpanelInstance.get_config("disable_persistence")};E0.prototype.handleError=function(t){this.errorReporter("IndexedDB error: ",t)};E0.prototype.setActiveRecording=function(t){if(!this.isPersistenceEnabled())return xs.resolve();var e=t.tabId;return e?this.idb.init().then((function(){return this.idb.setItem(e,t)}).bind(this)).catch(this.handleError.bind(this)):(console.warn("No tab ID is set, cannot persist recording metadata."),xs.resolve())};E0.prototype.getActiveRecording=function(){return this.isPersistenceEnabled()?this.idb.init().then((function(){return this.idb.getItem(this.mixpanelInstance.get_tab_id())}).bind(this)).then((function(t){return nje(t)?null:t}).bind(this)).catch(this.handleError.bind(this)):xs.resolve(null)};E0.prototype.clearActiveRecording=function(){return this.isPersistenceEnabled()?this.markActiveRecordingExpired():this.deleteActiveRecording()};E0.prototype.markActiveRecordingExpired=function(){return this.getActiveRecording().then((function(t){if(t)return t.maxExpires=0,this.setActiveRecording(t)}).bind(this)).catch(this.handleError.bind(this))};E0.prototype.deleteActiveRecording=function(){return this.idb.isInitialized()?this.idb.removeItem(this.mixpanelInstance.get_tab_id()).catch(this.handleError.bind(this)):xs.resolve()};E0.prototype.flushInactiveRecordings=function(){return this.isPersistenceEnabled()?this.idb.init().then((function(){return this.idb.getAll()}).bind(this)).then((function(t){var e=t.filter(function(n){return nje(n)}).map((function(n){var r=_l.deserialize(n,{mixpanelInstance:this.mixpanelInstance,sharedLockStorage:this.sharedLockStorage});return r.unloadPersistedData().then((function(){return this.idb.removeItem(n.tabId)}).bind(this)).catch(this.handleError.bind(this))}).bind(this));return xs.all(e)}).bind(this)).catch(this.handleError.bind(this)):xs.resolve([])};var _D=Vy("recorder"),Gy=function(t,e,n){this.mixpanelInstance=t,this.rrwebRecord=e||dS,this.sharedLockStorage=n,this.recordingRegistry=new E0({mixpanelInstance:this.mixpanelInstance,errorReporter:_D.error,sharedLockStorage:n}),this._flushInactivePromise=this.recordingRegistry.flushInactiveRecordings(),this.activeRecording=null,this.stopRecordingInProgress=!1};Gy.prototype.startRecording=function(t){if(t=t||{},this.activeRecording&&!this.activeRecording.isRrwebStopped()){_D.log("Recording already in progress, skipping startRecording.");return}var e=(function(){_D.log("Idle timeout reached, restarting recording."),this.resetRecording()}).bind(this),n=(function(){_D.log("Max recording length reached, stopping recording."),this.resetRecording()}).bind(this),r=(function(){this.recordingRegistry.setActiveRecording(this.activeRecording.serialize()),this.__flushPromise=this.activeRecording.batcher._flushPromise}).bind(this),s={mixpanelInstance:this.mixpanelInstance,onBatchSent:r,onIdleTimeout:e,onMaxLengthReached:n,replayId:de.UUID(),rrwebRecord:this.rrwebRecord,sharedLockStorage:this.sharedLockStorage};return t.activeSerializedRecording?this.activeRecording=_l.deserialize(t.activeSerializedRecording,s):this.activeRecording=new _l(s),this.activeRecording.startRecording(t.shouldStopBatcher),this.recordingRegistry.setActiveRecording(this.activeRecording.serialize())};Gy.prototype.stopRecording=function(){return this.stopRecordingInProgress=!0,this._stopCurrentRecording(!1,!0).then((function(){return this.recordingRegistry.clearActiveRecording()}).bind(this)).then((function(){this.stopRecordingInProgress=!1}).bind(this))};Gy.prototype.pauseRecording=function(){return this._stopCurrentRecording(!1)};Gy.prototype._stopCurrentRecording=function(t,e){if(this.activeRecording){var n=this.activeRecording.stopRecording(t);return e&&(this.activeRecording=null),n}return xs.resolve()};Gy.prototype.resumeRecording=function(t){return this.activeRecording&&this.activeRecording.isRrwebStopped()?(this.activeRecording.startRecording(!1),xs.resolve(null)):this.recordingRegistry.getActiveRecording().then((function(e){return e&&!this.stopRecordingInProgress?this.startRecording({activeSerializedRecording:e}):t?this.startRecording({shouldStopBatcher:!1}):(_D.log("No resumable recording found."),null)}).bind(this))};Gy.prototype.resetRecording=function(){this.stopRecording(),this.startRecording({shouldStopBatcher:!0})};Gy.prototype.isRecording=function(){return this.activeRecording&&!this.activeRecording.isRrwebStopped()};Gy.prototype.getActiveReplayId=function(){return this.isRecording()?this.activeRecording.replayId:null};Object.defineProperty(Gy.prototype,"replayId",{get:function(){return this.getActiveReplayId()}});Ht[Wfe]=Gy;function ctn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var CG={exports:{}},dtn=CG.exports,kDe;function utn(){return kDe||(kDe=1,function(t,e){(function(n,r){t.exports=r()})(dtn,function(){Array.isArray||(Array.isArray=function(i){return Object.prototype.toString.call(i)==="[object Array]"});function n(i){for(var o=[],l=0,c=i.length;l<c;l++)o.indexOf(i[l])===-1&&o.push(i[l]);return o}var r={},s={"==":function(i,o){return i==o},"===":function(i,o){return i===o},"!=":function(i,o){return i!=o},"!==":function(i,o){return i!==o},">":function(i,o){return i>o},">=":function(i,o){return i>=o},"<":function(i,o,l){return l===void 0?i<o:i<o&&o<l},"<=":function(i,o,l){return l===void 0?i<=o:i<=o&&o<=l},"!!":function(i){return r.truthy(i)},"!":function(i){return!r.truthy(i)},"%":function(i,o){return i%o},log:function(i){return console.log(i),i},in:function(i,o){return!o||typeof o.indexOf>"u"?!1:o.indexOf(i)!==-1},cat:function(){return Array.prototype.join.call(arguments,"")},substr:function(i,o,l){if(l<0){var c=String(i).substr(o);return c.substr(0,c.length+l)}return String(i).substr(o,l)},"+":function(){return Array.prototype.reduce.call(arguments,function(i,o){return parseFloat(i,10)+parseFloat(o,10)},0)},"*":function(){return Array.prototype.reduce.call(arguments,function(i,o){return parseFloat(i,10)*parseFloat(o,10)})},"-":function(i,o){return o===void 0?-i:i-o},"/":function(i,o){return i/o},min:function(){return Math.min.apply(this,arguments)},max:function(){return Math.max.apply(this,arguments)},merge:function(){return Array.prototype.reduce.call(arguments,function(i,o){return i.concat(o)},[])},var:function(i,o){var l=o===void 0?null:o,c=this;if(typeof i>"u"||i===""||i===null)return c;for(var d=String(i).split("."),u=0;u<d.length;u++)if(c==null||(c=c[d[u]],c===void 0))return l;return c},missing:function(){for(var i=[],o=Array.isArray(arguments[0])?arguments[0]:arguments,l=0;l<o.length;l++){var c=o[l],d=r.apply({var:c},this);(d===null||d==="")&&i.push(c)}return i},missing_some:function(i,o){var l=r.apply({missing:o},this);return o.length-l.length>=i?[]:l}};return r.is_logic=function(i){return typeof i=="object"&&i!==null&&!Array.isArray(i)&&Object.keys(i).length===1},r.truthy=function(i){return Array.isArray(i)&&i.length===0?!1:!!i},r.get_operator=function(i){return Object.keys(i)[0]},r.get_values=function(i){return i[r.get_operator(i)]},r.apply=function(i,o){if(Array.isArray(i))return i.map(function(v){return r.apply(v,o)});if(!r.is_logic(i))return i;var l=r.get_operator(i),c=i[l],d,u,h,m,f;if(Array.isArray(c)||(c=[c]),l==="if"||l=="?:"){for(d=0;d<c.length-1;d+=2)if(r.truthy(r.apply(c[d],o)))return r.apply(c[d+1],o);return c.length===d+1?r.apply(c[d],o):null}else if(l==="and"){for(d=0;d<c.length;d+=1)if(u=r.apply(c[d],o),!r.truthy(u))return u;return u}else if(l==="or"){for(d=0;d<c.length;d+=1)if(u=r.apply(c[d],o),r.truthy(u))return u;return u}else{if(l==="filter")return m=r.apply(c[0],o),h=c[1],Array.isArray(m)?m.filter(function(v){return r.truthy(r.apply(h,v))}):[];if(l==="map")return m=r.apply(c[0],o),h=c[1],Array.isArray(m)?m.map(function(v){return r.apply(h,v)}):[];if(l==="reduce")return m=r.apply(c[0],o),h=c[1],f=typeof c[2]<"u"?r.apply(c[2],o):null,Array.isArray(m)?m.reduce(function(v,b){return r.apply(h,{current:b,accumulator:v})},f):f;if(l==="all"){if(m=r.apply(c[0],o),h=c[1],!Array.isArray(m)||!m.length)return!1;for(d=0;d<m.length;d+=1)if(!r.truthy(r.apply(h,m[d])))return!1;return!0}else if(l==="none"){if(m=r.apply(c[0],o),h=c[1],!Array.isArray(m)||!m.length)return!0;for(d=0;d<m.length;d+=1)if(r.truthy(r.apply(h,m[d])))return!1;return!0}else if(l==="some"){if(m=r.apply(c[0],o),h=c[1],!Array.isArray(m)||!m.length)return!1;for(d=0;d<m.length;d+=1)if(r.truthy(r.apply(h,m[d])))return!0;return!1}}if(c=c.map(function(v){return r.apply(v,o)}),s.hasOwnProperty(l)&&typeof s[l]=="function")return s[l].apply(o,c);if(l.indexOf(".")>0){var p=String(l).split("."),g=s;for(d=0;d<p.length;d++){if(!g.hasOwnProperty(p[d]))throw new Error("Unrecognized operation "+l+" (failed at "+p.slice(0,d+1).join(".")+")");g=g[p[d]]}return g.apply(o,c)}throw new Error("Unrecognized operation "+l)},r.uses_data=function(i){var o=[];if(r.is_logic(i)){var l=r.get_operator(i),c=i[l];Array.isArray(c)||(c=[c]),l==="var"?o.push(c[0]):c.forEach(function(d){o.push.apply(o,r.uses_data(d))})}return n(o)},r.add_operation=function(i,o){s[i]=o},r.rm_operation=function(i){delete s[i]},r.rule_like=function(i,o){if(o===i||o==="@")return!0;if(o==="number")return typeof i=="number";if(o==="string")return typeof i=="string";if(o==="array")return Array.isArray(i)&&!r.is_logic(i);if(r.is_logic(o)){if(r.is_logic(i)){var l=r.get_operator(o),c=r.get_operator(i);if(l==="@"||l===c)return r.rule_like(r.get_values(i,!1),r.get_values(o,!1))}return!1}if(Array.isArray(o))if(Array.isArray(i)){if(o.length!==i.length)return!1;for(var d=0;d<o.length;d+=1)if(!r.rule_like(i[d],o[d]))return!1;return!0}else return!1;return!1},r})}(CG)),CG.exports}var htn=utn(),mtn=ctn(htn),ftn=function(t,e,n){if(t!==n.event_name)return{matches:!1};var r=n.property_filters,s=!0;if(r&&!de.isEmptyObject(r))try{s=mtn.apply(r,e||{})}catch(i){return{matches:!1,error:i.toString()}}return{matches:s}},uct={};uct.eventMatchesCriteria=ftn;Ht[qp]=Promise.resolve(uct);var ptn=30,gtn=1e3,vtn=4,ytn=!1;function hct(){this.clicks=[]}hct.prototype.isRageClick=function(t,e){e=e||{};var n=e.threshold_px||ptn,r=e.timeout_ms||gtn,s=e.click_count||vtn,i=e.interactive_elements_only||ytn;if(i){var o=oct(t);if(!o||ict(o))return!1}var l=Date.now(),c=t.pageX,d=t.pageY,u=this.clicks[this.clicks.length-1];if(u&&l-u.timestamp<r&&Math.sqrt(Math.pow(c-u.x,2)+Math.pow(d-u.y,2))<n){if(this.clicks.push({x:c,y:d,timestamp:l}),this.clicks.length>=s)return this.clicks=[],!0}else this.clicks=[{x:c,y:d,timestamp:l}];return!1};function gI(t,e){this.changeCallback=t||function(){},this.observerConfig=e,this.observedShadowRoots=null,this.shadowObservers=[]}gI.prototype.getEventTarget=function(t){if(this.observedShadowRoots)return oct(t)};gI.prototype.observeFromEvent=function(t){if(this.observedShadowRoots)for(var e=act(t),n=0;n<e.length;n++){var r=e[n];r&&r.shadowRoot&&this.observeShadowRoot(r.shadowRoot)}};gI.prototype.observeShadowRoot=function(t){if(!(!this.observedShadowRoots||this.observedShadowRoots.has(t))){var e=this;try{this.observedShadowRoots.add(t);var n=new window.MutationObserver(function(){e.changeCallback()});n.observe(t,this.observerConfig),this.shadowObservers.push(n)}catch(r){Oa.critical("Error while observing shadow root",r)}}};gI.prototype.start=function(){if(!this.observedShadowRoots){if(!zen()){Oa.critical("Shadow DOM observation unavailable: WeakSet not supported");return}this.observedShadowRoots=new WeakSet}};gI.prototype.stop=function(){if(this.observedShadowRoots){for(var t=0;t<this.shadowObservers.length;t++)try{this.shadowObservers[t].disconnect()}catch(e){Oa.critical("Error while disconnecting shadow DOM observer",e)}this.shadowObservers=[],this.observedShadowRoots=null}};var btn=500,xtn=[zO,_en,tY,Aen,Pen],wtn=[qee],ktn=[Kpe],SDe={characterData:!0,childList:!0,subtree:!0,attributes:!0,attributeFilter:["style","class","hidden","checked","selected","value","display","visibility"]};function Wy(t){this.eventListeners=[],this.mutationObserver=null,this.shadowDOMObserver=null,this.isTracking=!1,this.lastChangeEventTimestamp=0,this.pendingClicks=[],this.onDeadClickCallback=t,this.processingActive=!1,this.processingTimeout=null}Wy.prototype.addClick=function(t){var e=this.shadowDOMObserver&&this.shadowDOMObserver.getEventTarget(t);return e||(e=t.target||t.srcElement),!e||ict(e)?!1:(this.shadowDOMObserver&&this.shadowDOMObserver.observeFromEvent(t),this.pendingClicks.push({element:e,event:t,timestamp:Date.now()}),!0)};Wy.prototype.trackClick=function(t,e){if(!this.isTracking)return!1;var n=this.addClick(t);return n&&this.triggerProcessing(e),n};Wy.prototype.getDeadClicks=function(t){if(this.pendingClicks.length===0)return[];var e=t.timeout_ms,n=Date.now(),r=this.pendingClicks.slice();this.pendingClicks=[];for(var s=[],i=0;i<r.length;i++){var o=r[i];n-o.timestamp>=e?this.hasChangesAfter(o.timestamp)||s.push(o):this.pendingClicks.push(o)}return s};Wy.prototype.hasChangesAfter=function(t){return this.lastChangeEventTimestamp>=t-100};Wy.prototype.recordChangeEvent=function(){this.lastChangeEventTimestamp=Date.now()};Wy.prototype.triggerProcessing=function(t){this.processingActive||(this.processingActive=!0,this.processRecursively(t))};Wy.prototype.processRecursively=function(t){if(!this.isTracking||!this.onDeadClickCallback){this.processingActive=!1;return}var e=t.timeout_ms,n=this;this.processingTimeout=setTimeout(function(){if(n.processingActive){for(var r=n.getDeadClicks(t),s=0;s<r.length;s++)n.onDeadClickCallback(r[s].event);n.pendingClicks.length>0?n.processRecursively(t):n.processingActive=!1}},e)};Wy.prototype.startTracking=function(){if(!this.isTracking){this.isTracking=!0;var t=this;xtn.forEach(function(n){var r=function(){t.recordChangeEvent()};document.addEventListener(n,r,{capture:!0,passive:!0}),t.eventListeners.push({target:document,event:n,handler:r,options:{capture:!0,passive:!0}})}),ktn.forEach(function(n){var r=function(){t.recordChangeEvent()};window.addEventListener(n,r),t.eventListeners.push({target:window,event:n,handler:r})}),wtn.forEach(function(n){var r=function(){t.recordChangeEvent()};window.addEventListener(n,r,{passive:!0}),t.eventListeners.push({target:window,event:n,handler:r,options:{passive:!0}})});var e=function(){t.recordChangeEvent()};if(document.addEventListener("selectionchange",e),t.eventListeners.push({target:document,event:"selectionchange",handler:e}),window.MutationObserver)try{this.mutationObserver=new window.MutationObserver(function(){t.recordChangeEvent()}),this.mutationObserver.observe(document.body||document.documentElement,SDe)}catch(n){Oa.critical("Error while setting up mutation observer",n)}if(window.customElements)try{this.shadowDOMObserver=new gI(function(){t.recordChangeEvent()},SDe),this.shadowDOMObserver.start()}catch(n){Oa.critical("Error while setting up shadow DOM observer",n),this.shadowDOMObserver=null}}};Wy.prototype.stopTracking=function(){if(this.isTracking){this.isTracking=!1,this.pendingClicks=[],this.lastChangeEventTimestamp=0,this.processingActive=!1,this.processingTimeout&&(clearTimeout(this.processingTimeout),this.processingTimeout=null);for(var t=0;t<this.eventListeners.length;t++){var e=this.eventListeners[t];try{e.target.removeEventListener(e.event,e.handler,e.options)}catch(n){Oa.critical("Error while removing event listener",n)}}if(this.eventListeners=[],this.mutationObserver){try{this.mutationObserver.disconnect()}catch(n){Oa.critical("Error while disconnecting mutation observer",n)}this.mutationObserver=null}if(this.shadowDOMObserver){try{this.shadowDOMObserver.stop()}catch(n){Oa.critical("Error while stopping shadow DOM observer",n)}this.shadowDOMObserver=null}}};var mct="autocapture",Stn="track_pageview",Xpe="full-url",Ctn="url-with-path-and-query-string",jtn="url-with-path",Etn="allow_element_callback",fct="allow_selectors",pct="allow_url_regexes",gct="block_attrs",vct="block_element_callback",yct="block_selectors",bct="block_url_regexes",xct="capture_extra_attrs",wct="capture_text_content",kct="scroll_capture_all",Sct="scroll_depth_percent_checkpoints",aY="click",oY="dead_click",ege="input",Cct="pageview",lY="rage_click",tge="scroll",Kee="page_leave",nge="submit",Xl={};Xl[fct]=[];Xl[pct]=[];Xl[gct]=[];Xl[vct]=null;Xl[yct]=[];Xl[bct]=[];Xl[xct]=[];Xl[wct]=!1;Xl[kct]=!1;Xl[Sct]=[25,50,75,100];Xl[aY]=!0;Xl[oY]=!0;Xl[ege]=!0;Xl[Cct]=Xpe;Xl[lY]=!0;Xl[tge]=!0;Xl[Kee]=!1;Xl[nge]=!0;var VO={$mp_autocapture:!0},jct="$mp_click",Ect="$mp_dead_click",Ntn="$mp_input_change",Nct="$mp_rage_click",Ttn="$mp_scroll",_tn="$mp_submit",Atn="$mp_page_leave",Dl=function(t){this.mp=t,this.maxScrollViewDepth=0,this.hasTrackedScrollSession=!1,this.previousScrollHeight=0};Dl.prototype.init=function(){if(!Uen()){Oa.critical("Autocapture unavailable: missing required DOM APIs");return}this.initPageListeners(),this.initPageviewTracking(),this.initClickTracking(),this.initDeadClickTracking(),this.initInputTracking(),this.initScrollTracking(),this.initSubmitTracking(),this.initRageClickTracking(),this.initPageLeaveTracking()};Dl.prototype.getFullConfig=function(){var t=this.mp.get_config(mct);return t?de.isObject(t)?de.extend({},Xl,t):Xl:{}};Dl.prototype.getConfig=function(t){return this.getFullConfig()[t]};Dl.prototype.currentUrlBlocked=function(){var t=de.info.currentUrl(),e=this.getConfig(pct)||[];if(e.length)try{return!XK(t,e)}catch(r){return Oa.critical("Error while checking block URL regexes: ",r),!0}var n=this.getConfig(bct)||[];if(!n||!n.length)return!1;try{return XK(t,n)}catch(r){return Oa.critical("Error while checking block URL regexes: ",r),!0}};Dl.prototype.pageviewTrackingConfig=function(){return this.mp.get_config(mct)?this.getConfig(Cct):this.mp.get_config(Stn)};Dl.prototype.trackDomEvent=function(t,e){if(!this.currentUrlBlocked()){var n=this.mp.is_recording_heatmap_data()&&(e===jct&&!this.getConfig(aY)||e===Nct&&!this._getClickTrackingConfig(lY)||e===Ect&&!this._getClickTrackingConfig(oY)),r=Fen(t,{allowElementCallback:this.getConfig(Etn),allowSelectors:this.getConfig(fct),blockAttrs:this.getConfig(gct),blockElementCallback:this.getConfig(vct),blockSelectors:this.getConfig(yct),captureExtraAttrs:this.getConfig(xct),captureTextContent:this.getConfig(wct),capturedForHeatMap:n});r&&(de.extend(r,VO),this.mp.track(e,r))}};Dl.prototype.initPageListeners=function(){if(Ht.removeEventListener(mDe,this.listenerPopstate),Ht.removeEventListener(Kpe,this.listenerHashchange),!(!this.pageviewTrackingConfig()&&!this.getConfig(Kee)&&!this.mp.get_config("record_heatmap_data"))){this.listenerPopstate=function(){Ht.dispatchEvent(new Event(T1))},this.listenerHashchange=function(){Ht.dispatchEvent(new Event(T1))},Ht.addEventListener(mDe,this.listenerPopstate),Ht.addEventListener(Kpe,this.listenerHashchange);var t=Ht.history.pushState;typeof t=="function"&&(Ht.history.pushState=function(n,r,s){t.call(Ht.history,n,r,s),Ht.dispatchEvent(new Event(T1))});var e=Ht.history.replaceState;typeof e=="function"&&(Ht.history.replaceState=function(n,r,s){e.call(Ht.history,n,r,s),Ht.dispatchEvent(new Event(T1))})}};Dl.prototype._getClickTrackingConfig=function(t){var e=this.getConfig(t);return e?e===!0?{}:typeof e=="object"?e:{}:null};Dl.prototype._trackPageLeave=function(t,e,n){if(!this.hasTrackedScrollSession&&!(!this.getConfig(Kee)&&!this.mp.is_recording_heatmap_data())){this.hasTrackedScrollSession=!0;var r=Math.max(bs.documentElement.clientHeight,Ht.innerHeight||0),s=Math.round(Math.max(this.maxScrollViewDepth-r,0)/(n-r)*100),i=Math.round(r/n*100);n<=r&&(s=100,i=100);var o=de.extend({$max_scroll_view_depth:this.maxScrollViewDepth,$max_scroll_percentage:s,$fold_line_percentage:i,$scroll_height:n,$event_type:t.type,$current_url:e||de.info.currentUrl(),$viewportHeight:r,$viewportWidth:Math.max(bs.documentElement.clientWidth,Ht.innerWidth||0),$captured_for_heatmap:this.mp.is_recording_heatmap_data()},VO);this.mp.track(Atn,o,{transport:"sendBeacon"})}};Dl.prototype._initScrollDepthTracking=function(){if(Ht.removeEventListener(rje,this.listenerScrollDepth),Ht.removeEventListener(qee,this.listenerScrollDepth),!!this.mp.get_config("record_heatmap_data")){Oa.log("Initializing scroll depth tracking"),this.maxScrollViewDepth=Math.max(bs.documentElement.clientHeight,Ht.innerHeight||0);var t=(function(){if(!this.currentUrlBlocked()){var n=Math.max(bs.documentElement.clientHeight,Ht.innerHeight||0)+Ht.scrollY;n>this.maxScrollViewDepth&&(this.maxScrollViewDepth=n),this.previousScrollHeight=bs.body.scrollHeight}}).bind(this),e=sct(t);this.listenerScrollDepth=e.listener,Ht.addEventListener(e.eventType,this.listenerScrollDepth)}};Dl.prototype.initClickTracking=function(){Ht.removeEventListener(Zx,this.listenerClick,!0),!(!this.getConfig(aY)&&!this.mp.get_config("record_heatmap_data"))&&(Oa.log("Initializing click tracking"),this.listenerClick=(function(t){!this.getConfig(aY)&&!this.mp.is_recording_heatmap_data()||this.trackDomEvent(t,jct)}).bind(this),Ht.addEventListener(Zx,this.listenerClick,!0))};Dl.prototype.initDeadClickTracking=function(){var t=this._getClickTrackingConfig(oY);if(!t&&!this.mp.get_config("record_heatmap_data")){this.stopDeadClickTracking();return}Oa.log("Initializing dead click tracking"),this._deadClickTracker||(this._deadClickTracker=new Wy((function(e){this.trackDomEvent(e,Ect)}).bind(this)),this._deadClickTracker.startTracking()),this.listenerDeadClick||(this.listenerDeadClick=(function(e){var n=this._getClickTrackingConfig(oY);if(!(!n&&!this.mp.is_recording_heatmap_data())&&!this.currentUrlBlocked()){var r=n||{};r.timeout_ms||(r.timeout_ms=btn),this._deadClickTracker.trackClick(e,r)}}).bind(this),Ht.addEventListener(Zx,this.listenerDeadClick,!0))};Dl.prototype.initInputTracking=function(){Ht.removeEventListener(zO,this.listenerChange,!0),this.getConfig(ege)&&(Oa.log("Initializing input tracking"),this.listenerChange=(function(t){this.getConfig(ege)&&this.trackDomEvent(t,Ntn)}).bind(this),Ht.addEventListener(zO,this.listenerChange,!0))};Dl.prototype.initPageviewTracking=function(){if(Ht.removeEventListener(T1,this.listenerLocationchange),!(!this.pageviewTrackingConfig()&&!this.mp.get_config("record_heatmap_data"))){Oa.log("Initializing pageview tracking");var t="",e=!1;(this.pageviewTrackingConfig()||this.mp.is_recording_heatmap_data())&&!this.currentUrlBlocked()&&(e=this.mp.track_pageview(VO)),e&&(t=de.info.currentUrl()),this.listenerLocationchange=A2((function(){if(!this.currentUrlBlocked()){var n=de.info.currentUrl(),r=!1,s=n.split("#")[0].split("?")[0]!==t.split("#")[0].split("?")[0],i=this.pageviewTrackingConfig();if(!i&&this.mp.is_recording_heatmap_data()&&(i=Xpe),i===Xpe?r=n!==t:i===Ctn?r=n.split("#")[0]!==t.split("#")[0]:i===jtn&&(r=s),r){var o=this.mp.track_pageview(VO);o&&(t=n),s&&(this.lastScrollCheckpoint=0,Oa.log("Path change: re-initializing scroll depth checkpoints"))}}}).bind(this)),Ht.addEventListener(T1,this.listenerLocationchange)}};Dl.prototype.initRageClickTracking=function(){Ht.removeEventListener(Zx,this.listenerRageClick,!0);var t=this._getClickTrackingConfig(lY);!t&&!this.mp.get_config("record_heatmap_data")||(Oa.log("Initializing rage click tracking"),this._rageClickTracker||(this._rageClickTracker=new hct),this.listenerRageClick=(function(e){var n=this._getClickTrackingConfig(lY);!n&&!this.mp.is_recording_heatmap_data()||this.currentUrlBlocked()||this._rageClickTracker.isRageClick(e,n)&&this.trackDomEvent(e,Nct)}).bind(this),Ht.addEventListener(Zx,this.listenerRageClick,!0))};Dl.prototype.initScrollTracking=function(){if(Ht.removeEventListener(qee,this.listenerScroll),Ht.removeEventListener(rje,this.listenerScroll),!!this.getConfig(tge)){Oa.log("Initializing scroll tracking"),this.lastScrollCheckpoint=0;var t=(function(){if(this.getConfig(tge)&&!this.currentUrlBlocked()){var n=this.getConfig(kct),r=(this.getConfig(Sct)||[]).slice().sort(function(u,h){return u-h}),s=Ht.scrollY,i=de.extend({$scroll_top:s},VO);try{var o=bs.body.scrollHeight,l=Math.round(s/(o-Ht.innerHeight)*100);if(i.$scroll_height=o,i.$scroll_percentage=l,l>this.lastScrollCheckpoint)for(var c=0;c<r.length;c++){var d=r[c];l>=d&&this.lastScrollCheckpoint<d&&(i.$scroll_checkpoint=d,this.lastScrollCheckpoint=d,n=!0)}}catch(u){Oa.critical("Error while calculating scroll percentage",u)}n&&this.mp.track(Ttn,i)}}).bind(this),e=sct(t);this.listenerScroll=e.listener,Ht.addEventListener(e.eventType,this.listenerScroll)}};Dl.prototype.initSubmitTracking=function(){Ht.removeEventListener(tY,this.listenerSubmit,!0),this.getConfig(nge)&&(Oa.log("Initializing submit tracking"),this.listenerSubmit=(function(t){this.getConfig(nge)&&this.trackDomEvent(t,_tn)}).bind(this),Ht.addEventListener(tY,this.listenerSubmit,!0))};Dl.prototype.initPageLeaveTracking=function(){if(bs.removeEventListener(fDe,this.listenerPageLeaveVisibilitychange),Ht.removeEventListener(T1,this.listenerPageLeaveLocationchange),Ht.removeEventListener(hDe,this.listenerPageLoad),!(!this.getConfig(Kee)&&!this.mp.get_config("record_heatmap_data"))){Oa.log("Initializing page visibility tracking."),this._initScrollDepthTracking();var t=de.info.currentUrl();this.listenerPageLoad=(function(){this.previousScrollHeight=bs.body.scrollHeight}).bind(this),Ht.addEventListener(hDe,this.listenerPageLoad),this.listenerPageLeaveLocationchange=A2((function(e){if(!this.currentUrlBlocked()){var n=de.info.currentUrl(),r=n!==t;r&&(this._trackPageLeave(e,t,this.previousScrollHeight),t=n,this.maxScrollViewDepth=Math.max(bs.documentElement.clientHeight,Ht.innerHeight||0),this.previousScrollHeight=bs.body.scrollHeight,this.hasTrackedScrollSession=!1)}}).bind(this)),Ht.addEventListener(T1,this.listenerPageLeaveLocationchange),this.listenerPageLeaveVisibilitychange=(function(e){bs.hidden&&this._trackPageLeave(e,t,this.previousScrollHeight)}).bind(this),bs.addEventListener(fDe,this.listenerPageLeaveVisibilitychange)}};Dl.prototype.stopDeadClickTracking=function(){this.listenerDeadClick&&(Ht.removeEventListener(Zx,this.listenerDeadClick,!0),this.listenerDeadClick=null),this._deadClickTracker&&(this._deadClickTracker.stopTracking(),this._deadClickTracker=null)};KCe(Dl);var Tct=function(t,e){return Ht[qp]&&typeof Ht[qp].then=="function"||(Ht[qp]=new Promise(function(n){t(e,n)}).then(function(){var n=Ht[qp];if(n&&typeof n.then=="function")return n;throw new Error("targeting failed to load")}).catch(function(n){throw delete Ht[qp],n})),Ht[qp]},dg=Vy("flags"),Ptn="mixpanelFlagsDb",_ct="mixpanelFlags",Rtn={version:1,storeNames:[_ct]},Itn="persisted_variants_for_",CDe=24*60*60*1e3,X1=Object.freeze({NETWORK_ONLY:"networkOnly",NETWORK_FIRST:"networkFirst",PERSISTENCE_UNTIL_NETWORK_SUCCESS:"persistenceUntilNetworkSuccess"}),Mtn=[X1.NETWORK_ONLY,X1.NETWORK_FIRST,X1.PERSISTENCE_UNTIL_NETWORK_SUCCESS],PE=function(t,e,n){this.idb=new Xf(Ptn,_ct,Rtn),this.persistenceConfig=t,this.persistedVariantsKey=Itn+e,this.isGloballyDisabled=n||function(){return!1}};PE.prototype.getPolicy=function(){return this.isGloballyDisabled()||!this._isConfigValid()?X1.NETWORK_ONLY:this.persistenceConfig.variantLookupPolicy};PE.prototype.getTtlMs=function(){if(!this._isConfigValid())return CDe;var t=this.persistenceConfig.persistenceTtlMs;return t??CDe};PE.prototype._isConfigValid=function(){var t=this.persistenceConfig;return t?Mtn.indexOf(t.variantLookupPolicy)===-1?(dg.error("Invalid variantLookupPolicy:",t.variantLookupPolicy),!1):t.persistenceTtlMs!==void 0&&t.persistenceTtlMs!==null&&t.persistenceTtlMs<=0?(dg.error("If provided, persistenceTtlMs must be a positive number. Provided value:",t.persistenceTtlMs),!1):!0:!1};PE.prototype.loadFlagsFromStorage=function(t){var e=de.bind(function(){return this.clear().then(function(){return null}).catch(function(){return null})},this);if(this.getPolicy()===X1.NETWORK_ONLY)return e();var n=this.getTtlMs();return this.idb.init().then(de.bind(function(){return this.idb.getItem(this.persistedVariantsKey)},this)).then(de.bind(function(r){if(!r)return dg.log("No persisted variants found in IndexedDB"),null;if(n&&Date.now()-r.persistedAt>=n)return dg.log("Persisted variants are expiring"),null;if(!t||r.distinctId!==t.distinct_id)return dg.log("Persisted variants found, but for a different distinct_id so clearing."),e();var s=new Map;return de.each(r.flagVariants,function(i,o){s.set(o,{key:i.variant_key,value:i.variant_value,experiment_id:i.experiment_id,is_experiment_active:i.is_experiment_active,is_qa_tester:i.is_qa_tester,variant_source:"persistence",persisted_at_in_ms:r.persistedAt,ttl_in_ms:n})}),dg.log("Loaded",s.size,"variants from IndexedDB for distinct_id",r.distinctId),{flags:s,pendingFirstTimeEvents:r.pendingFirstTimeEvents||{},persistedAtMs:r.persistedAt,ttlMs:n}},this)).catch(de.bind(function(r){return dg.error("Failed to load persisted variants from IndexedDB, so clearing",r),e()},this))};PE.prototype.save=function(t,e,n){if(this.getPolicy()===X1.NETWORK_ONLY)return Promise.resolve();var r={};e.forEach(function(i,o){r[o]={variant_key:i.key,variant_value:i.value,experiment_id:i.experiment_id,is_experiment_active:i.is_experiment_active,is_qa_tester:i.is_qa_tester}});var s={persistedAt:Date.now(),distinctId:t&&t.distinct_id,context:t,flagVariants:r,pendingFirstTimeEvents:n||{}};return this.idb.init().then(de.bind(function(){return this.idb.setItem(this.persistedVariantsKey,s)},this)).then(function(){dg.log("Saved",e.size,"variants to IndexedDB for distinct_id",s.distinctId)}).catch(function(i){dg.error("Failed to persist variants to IndexedDB:",i)})};PE.prototype.clear=function(){return this.isGloballyDisabled()?Promise.resolve():this.idb.init().then(de.bind(function(){return this.idb.removeItem(this.persistedVariantsKey)},this)).then(function(){dg.log("Cleared persisted variants from IndexedDB")}).catch(function(t){dg.error("Failed to clear persisted variants from IndexedDB:",t)})};var Hi=Vy("flags"),cY="flags",dY="context",Ltn="persistence",rge={};rge[dY]={};var Dtn=function(t,e){return t+":"+e},$tn=function(t){return t.split(":")[0]},yj=function(t){return de.isObject(t)?de.extend({},t,{variant_source:"fallback"}):{value:t,variant_source:"fallback"}},fr=function(t){this.fetch=Ht.fetch,this.getFullApiRoute=t.getFullApiRoute,this.getMpConfig=t.getConfigFunc,this.setMpConfig=t.setConfigFunc,this.getMpProperty=t.getPropertyFunc,this.track=t.trackingFunc,this.loadExtraBundle=t.loadExtraBundle||function(){},this.targetingSrc=t.targetingSrc||""};fr.prototype.init=function(){if(!this.minApisSupported()){Hi.critical("Feature Flags unavailable: missing minimum required APIs");return}return this.flags=null,this.trackedFeatures=new Set,this.pendingFirstTimeEvents={},this.activatedFirstTimeEvents={},this._loadedPersistedAtMs=null,this._loadedTtlMs=null,this.persistence=new PE(this.getConfig(Ltn),this.getMpConfig("token"),de.bind(function(){return this.getMpConfig("disable_persistence")},this)),this.persistenceLoadedPromise=this.persistence.loadFlagsFromStorage(this._buildContext()).then(de.bind(function(t){t&&(this.flags=t.flags,this.pendingFirstTimeEvents=t.pendingFirstTimeEvents,this._loadedPersistedAtMs=t.persistedAtMs,this._loadedTtlMs=t.ttlMs)},this)),this.persistenceLoadedPromise.then(de.bind(function(){return this.fetchFlags()},this)).catch(function(){Hi.error("Error initializing feature flags")})};fr.prototype._buildContext=function(){return de.extend({distinct_id:this.getMpProperty("distinct_id"),device_id:this.getMpProperty("$device_id")},this.getConfig(dY))};fr.prototype.reset=function(){return this.persistence?(this.flags=null,this.pendingFirstTimeEvents={},this.activatedFirstTimeEvents={},this.trackedFeatures=new Set,this.fetchPromise=null,this._fetchInProgressStartTime=null,this._loadedPersistedAtMs=null,this._loadedTtlMs=null,this.persistence.clear().then(de.bind(function(){return this.fetchFlags()},this)).catch(function(){Hi.error("Error during flags reset")})):Promise.resolve()};fr.prototype.getFullConfig=function(){var t=this.getMpConfig(cY);return t?de.isObject(t)?de.extend({},rge,t):rge:{}};fr.prototype.getConfig=function(t){return this.getFullConfig()[t]};fr.prototype.isSystemEnabled=function(){return!!this.getMpConfig(cY)};fr.prototype.updateContext=function(t,e){if(!this.isSystemEnabled())return Hi.critical("Feature Flags not enabled, cannot update context"),Promise.resolve();var n=this.getMpConfig(cY);de.isObject(n)||(n={});var r=e&&e.replace?{}:this.getConfig(dY);n[dY]=de.extend({},r,t);var s={};return s[cY]=n,this.setMpConfig(s),this.fetchFlags().catch(function(){Hi.error("Error fetching flags during updateContext")})};fr.prototype.areFlagsReady=function(){return this.isSystemEnabled()||Hi.error("Feature Flags not enabled"),!!this.flags};fr.prototype.fetchFlags=function(){if(!this.isSystemEnabled())return Promise.resolve();var t=this._buildContext(),e=t.distinct_id,n=qlt();Hi.log("Fetching flags for distinct ID: "+e);var r=new URLSearchParams;r.set("context",JSON.stringify(t)),r.set("token",this.getMpConfig("token")),r.set("mp_lib","web"),r.set("$lib_version",bh.LIB_VERSION);var s=this.getFullApiRoute()+"?"+r.toString();return this._fetchInProgressStartTime=Date.now(),this.fetchPromise=this.fetch.call(Ht,s,{method:"GET",headers:{Authorization:"Basic "+btoa(this.getMpConfig("token")+":"),traceparent:n}}).then((function(i){return this.markFetchComplete(),i.json()}).bind(this)).then((function(i){var o=i.flags;if(!o)throw new Error("No flags in API response");var l=new Map,c={};de.each(o,function(u,h){var m=!1,f=h+":";if(de.each(this.activatedFirstTimeEvents,function(g,v){v.startsWith(f)&&(m=!0)}),m){var p=this.flags&&this.flags.get(h);p&&l.set(h,p)}else l.set(h,{key:u.variant_key,value:u.variant_value,experiment_id:u.experiment_id,is_experiment_active:u.is_experiment_active,is_qa_tester:u.is_qa_tester,variant_source:"network"})},this);var d=i.pending_first_time_events;d&&d.length>0&&de.each(d,function(u){var h=u.flag_key,m=Dtn(h,u.first_time_event_hash);this.activatedFirstTimeEvents[m]||(c[m]={flag_key:h,flag_id:u.flag_id,project_id:u.project_id,first_time_event_hash:u.first_time_event_hash,event_name:u.event_name,property_filters:u.property_filters,pending_variant:u.pending_variant})},this),this.activatedFirstTimeEvents&&de.each(this.activatedFirstTimeEvents,function(u,h){var m=$tn(h);u&&!l.has(m)&&this.flags&&this.flags.has(m)&&l.set(m,this.flags.get(m))},this),this.flags=l,this.trackedFeatures=new Set,this.pendingFirstTimeEvents=c,this._loadedPersistedAtMs=null,this._loadedTtlMs=null,this._traceparent=n,this._loadTargetingIfNeeded(),this.persistence.save(t,this.flags,this.pendingFirstTimeEvents)}).bind(this)).catch((function(i){throw this._fetchInProgressStartTime&&this.markFetchComplete(),Hi.error(i),i}).bind(this)),this.fetchPromise};fr.prototype.loadFlags=function(){return this.isSystemEnabled()?this.trackedFeatures?this._fetchInProgressStartTime?this.fetchPromise:this.fetchFlags():(Hi.error("loadFlags called before init"),Promise.resolve()):Promise.resolve()};fr.prototype.markFetchComplete=function(){if(!this._fetchInProgressStartTime){Hi.error("Fetch in progress started time not set, cannot mark fetch complete");return}this._fetchStartTime=this._fetchInProgressStartTime,this._fetchCompleteTime=Date.now(),this._fetchLatency=this._fetchCompleteTime-this._fetchStartTime,this._fetchInProgressStartTime=null};fr.prototype._loadTargetingIfNeeded=function(){var t=!1;de.each(this.pendingFirstTimeEvents,function(e){e.property_filters&&!de.isEmptyObject(e.property_filters)&&(t=!0)}),t&&this.getTargeting().then(function(){Hi.log("targeting loaded for property filter evaluation")})};fr.prototype.getTargeting=function(){return Tct(this.loadExtraBundle.bind(this),this.targetingSrc).catch((function(t){Hi.error("Failed to load targeting: "+t)}).bind(this))};fr.prototype.checkFirstTimeEvents=function(t,e){!this.pendingFirstTimeEvents||de.isEmptyObject(this.pendingFirstTimeEvents)||(Ht[qp]&&de.isFunction(Ht[qp].then)?Ht[qp].then((function(n){this._processFirstTimeEventCheck(t,e,n)}).bind(this)).catch((function(){this._processFirstTimeEventCheck(t,e,null)}).bind(this)):this._processFirstTimeEventCheck(t,e,null))};fr.prototype._processFirstTimeEventCheck=function(t,e,n){de.each(this.pendingFirstTimeEvents,function(r,s){if(!this.activatedFirstTimeEvents[s]){var i=r.flag_key,o;if(!n&&r.property_filters&&!de.isEmptyObject(r.property_filters)){Hi.warn('Skipping event check for "'+i+'" - property filters require targeting library');return}if(!n)o={matches:t===r.event_name,error:null};else{var l={event_name:r.event_name,property_filters:r.property_filters};o=n.eventMatchesCriteria(t,e,l)}if(o.error){Hi.error('Error checking first-time event for flag "'+i+'": '+o.error);return}if(o.matches){Hi.log('First-time event matched for flag "'+i+'": '+t);var c={key:r.pending_variant.variant_key,value:r.pending_variant.variant_value,experiment_id:r.pending_variant.experiment_id,is_experiment_active:r.pending_variant.is_experiment_active};this.flags.set(i,c),this.trackedFeatures.delete(i),this.activatedFirstTimeEvents[s]=!0,this.recordFirstTimeEvent(r.flag_id,r.project_id,r.first_time_event_hash)}}},this)};fr.prototype.getFirstTimeEventApiRoute=function(t){var e=this.getFullApiRoute().replace(/\/$/,"");return e+"/"+t+"/first-time-events"};fr.prototype.recordFirstTimeEvent=function(t,e,n){var r=this.getMpProperty("distinct_id"),s=qlt(),i=new URLSearchParams;i.set("mp_lib","web"),i.set("$lib_version",bh.LIB_VERSION);var o=this.getFirstTimeEventApiRoute(t)+"?"+i.toString(),l={distinct_id:r,project_id:e,first_time_event_hash:n};Hi.log("Recording first-time event for flag: "+t),this.fetch.call(Ht,o,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Basic "+btoa(this.getMpConfig("token")+":"),traceparent:s},body:JSON.stringify(l)}).catch(function(c){Hi.error("Failed to record first-time event for flag "+t+": "+c)})};fr.prototype.getVariant=function(t,e){if(!this.persistenceLoadedPromise)return new Promise(function(r){Hi.critical("Feature Flags not initialized"),r(yj(e))});var n=this.persistence.getPolicy();return this.persistenceLoadedPromise.then(de.bind(function(){if(n===X1.PERSISTENCE_UNTIL_NETWORK_SUCCESS)return this.areFlagsReady()&&!this._loadedPersistenceIsStale()?this.getVariantSync(t,e):this.fetchPromise?this.fetchPromise.then(de.bind(function(){return this.getVariantSync(t,e)},this)).catch(function(s){return Hi.error(s),yj(e)}):yj(e);var r=de.bind(function(){return this.getVariantSync(t,e)},this);return this.fetchPromise?this.fetchPromise.then(r).catch(r):yj(e)},this))};fr.prototype._loadedPersistenceIsStale=function(){return!this._loadedPersistedAtMs||!this._loadedTtlMs?!1:Date.now()-this._loadedPersistedAtMs>=this._loadedTtlMs};fr.prototype.getVariantSync=function(t,e){if(this._loadedPersistenceIsStale())return Hi.log('Loaded persisted variants are past TTL so returning fallback for "'+t+'"'),yj(e);if(!this.areFlagsReady())return Hi.log("Flags not loaded yet"),yj(e);var n=this.flags.get(t);return n?(this.trackFeatureCheck(t,n),n):(Hi.log('No flag found: "'+t+'"'),yj(e))};fr.prototype.getAllVariants=function(){if(!this.persistenceLoadedPromise)return Hi.critical("Feature Flags not initialized"),Promise.resolve(new Map);var t=this.persistence.getPolicy();return this.persistenceLoadedPromise.then(de.bind(function(){if(t===X1.PERSISTENCE_UNTIL_NETWORK_SUCCESS)return this.areFlagsReady()&&!this._loadedPersistenceIsStale()?this.getAllVariantsSync():this.fetchPromise?this.fetchPromise.then(de.bind(function(){return this.getAllVariantsSync()},this)).catch(function(n){return Hi.error(n),new Map}):new Map;var e=de.bind(this.getAllVariantsSync,this);return this.fetchPromise?this.fetchPromise.then(e).catch(e):new Map},this))};fr.prototype.getAllVariantsSync=function(){return this._loadedPersistenceIsStale()?(Hi.log("Loaded persisted variants are past TTL so returning empty Map"),new Map):this.flags||new Map};fr.prototype.getVariantValue=function(t,e){return this.getVariant(t,{value:e}).then(function(n){return n.value}).catch(function(n){return Hi.error(n),e})};fr.prototype.getFeatureData=function(t,e){return Hi.critical("mixpanel.flags.get_feature_data() is deprecated and will be removed in a future release. Use mixpanel.flags.get_variant_value() instead."),this.getVariantValue(t,e)};fr.prototype.getVariantValueSync=function(t,e){return this.getVariantSync(t,{value:e}).value};fr.prototype.isEnabled=function(t,e){return this.getVariantValue(t).then((function(){return this.isEnabledSync(t,e)}).bind(this)).catch(function(n){return Hi.error(n),e})};fr.prototype.isEnabledSync=function(t,e){e=e||!1;var n=this.getVariantValueSync(t,e);return n!==!0&&n!==!1&&(Hi.error('Feature flag "'+t+'" value: '+n+" is not a boolean; returning fallback value: "+e),n=e),n};function ew(t){return t!=null}fr.prototype.trackFeatureCheck=function(t,e){if(!this.trackedFeatures.has(t)){this.trackedFeatures.add(t);var n={"Experiment name":t,"Variant name":e.key,$experiment_type:"feature_flag","Variant fetch start time":ew(this._fetchStartTime)?new Date(this._fetchStartTime).toISOString():null,"Variant fetch complete time":ew(this._fetchCompleteTime)?new Date(this._fetchCompleteTime).toISOString():null,"Variant fetch latency (ms)":this._fetchLatency,"Variant fetch traceparent":this._traceparent};ew(e.experiment_id)&&(n.$experiment_id=e.experiment_id),ew(e.is_experiment_active)&&(n.$is_experiment_active=e.is_experiment_active),ew(e.is_qa_tester)&&(n.$is_qa_tester=e.is_qa_tester),ew(e.variant_source)&&(n.$variant_source=e.variant_source),ew(e.persisted_at_in_ms)&&(n.$persisted_at_in_ms=e.persisted_at_in_ms),ew(e.ttl_in_ms)&&(n.$ttl_in_ms=e.ttl_in_ms),this.track("$experiment_started",n)}};fr.prototype.whenReady=function(){return this.fetchPromise?this.fetchPromise:Promise.resolve()};fr.prototype.minApisSupported=function(){return!!this.fetch&&typeof Promise<"u"&&typeof Map<"u"&&typeof Set<"u"};KCe(fr);fr.prototype.are_flags_ready=fr.prototype.areFlagsReady;fr.prototype.get_variant=fr.prototype.getVariant;fr.prototype.get_variant_sync=fr.prototype.getVariantSync;fr.prototype.get_all_variants=fr.prototype.getAllVariants;fr.prototype.get_all_variants_sync=fr.prototype.getAllVariantsSync;fr.prototype.get_variant_value=fr.prototype.getVariantValue;fr.prototype.get_variant_value_sync=fr.prototype.getVariantValueSync;fr.prototype.is_enabled=fr.prototype.isEnabled;fr.prototype.is_enabled_sync=fr.prototype.isEnabledSync;fr.prototype.load_flags=fr.prototype.loadFlags;fr.prototype.update_context=fr.prototype.updateContext;fr.prototype.when_ready=fr.prototype.whenReady;fr.prototype.get_feature_data=fr.prototype.getFeatureData;fr.prototype.getTargeting=fr.prototype.getTargeting;var Otn=Vy("recorder"),Act="mp_iframe_handshake_request",Pct="mp_iframe_handshake_response",zc=function(t){this.mixpanelInstance=t.mixpanelInstance,this.getMpConfig=t.getConfigFunc,this.getTabId=t.getTabIdFunc,this.reportError=t.reportErrorFunc,this.getDistinctId=t.getDistinctIdFunc,this.loadExtraBundle=t.loadExtraBundle,this.recorderSrc=t.recorderSrc,this.targetingSrc=t.targetingSrc,this.libBasePath=t.libBasePath,this._recorder=null,this._parentReplayId=null,this._parentFrameRetryInterval=null};zc.prototype.shouldLoadRecorder=function(){if(this.getMpConfig("disable_persistence"))return ds.log("Load recorder check skipped due to disable_persistence config"),xs.resolve(!1);var t=new Xf(QCe,ZCe,JCe),e=this.getTabId();return t.init().then(function(){return t.getAll()}).then(function(n){for(var r=0;r<n.length;r++)if(nje(n[r])||n[r].tabId===e)return!0;return!1}).catch(de.bind(function(n){return this.reportError("Error checking recording registry",n),!1},this))};zc.prototype.checkAndStartSessionRecording=function(t,e){if(!Ht.MutationObserver)return ds.critical("Browser does not support MutationObserver; skipping session recording"),xs.resolve();var n=de.bind(function(l){return new xs(de.bind(function(c){var d=A2(de.bind(function(){this._recorder=this._recorder||new Ht[Wfe](this.mixpanelInstance),this._recorder.resumeRecording(l),c()},this));if(de.isUndefined(Ht[Wfe])){var u=this.recorderSrc||this.libBasePath+bWt;this.loadExtraBundle(u,d)}else d()},this))},this),r=Xlt(this.getMpConfig("record_allowed_iframe_origins"),Otn),s=r.length>0;if(s&&(this._setupParentFrameListener(r),Ht.parent!==Ht))return this._setupChildFrameListener(r,n),this._sendParentFrameRequestWithRetry(r),xs.resolve();var i=de.isUndefined(e)?this.getMpConfig("record_sessions_percent"):e,o=i>0&&Math.random()*100<=i;return t||o?n(!0):this.shouldLoadRecorder().then(de.bind(function(l){return l?n(!1):xs.resolve()},this))};zc.prototype.isRecording=function(){if(!this._recorder||!de.isFunction(this._recorder.isRecording))return!1;try{return this._recorder.isRecording()}catch(t){return this.reportError("Error checking if recording is active",t),!1}};zc.prototype.startRecordingOnEvent=function(t,e){var n=this.isRecording(),r=this.getMpConfig("recording_event_triggers");if(!n&&r){var s=r[t];if(s&&typeof s.percentage=="number"){var i=s.percentage,o=s.property_filters;if(o&&!de.isEmptyObject(o)){var l=this.targetingSrc||this.libBasePath+pat;Tct(this.loadExtraBundle,l).then((function(c){try{var d=c.eventMatchesCriteria(t,e,{event_name:t,property_filters:o});d.matches&&this.checkAndStartSessionRecording(!1,i)}catch(u){ds.critical("Could not parse recording event trigger properties logic:",u)}}).bind(this)).catch(function(c){ds.critical("Failed to load targeting library:",c)})}else this.checkAndStartSessionRecording(!1,i)}}};zc.prototype.stopSessionRecording=function(){return this._recorder?this._recorder.stopRecording():xs.resolve()};zc.prototype.pauseSessionRecording=function(){return this._recorder?this._recorder.pauseRecording():xs.resolve()};zc.prototype.resumeSessionRecording=function(){return this._recorder?this._recorder.resumeRecording():xs.resolve()};zc.prototype.isRecordingHeatmapData=function(){return this.getSessionReplayId()&&this.getMpConfig("record_heatmap_data")};zc.prototype.getSessionRecordingProperties=function(){var t={},e=this.getSessionReplayId();return e&&(t.$mp_replay_id=e),t};zc.prototype.getSessionReplayUrl=function(){var t=null,e=this.getSessionReplayId();if(e){var n=de.HTTPBuildQuery({replay_id:e,distinct_id:this.getDistinctId(),token:this.getMpConfig("token")});t="https://mixpanel.com/projects/replay-redirect?"+n}return t};zc.prototype.getSessionReplayId=function(){if(this._parentReplayId)return this._parentReplayId;var t=null;return this._recorder&&(t=this._recorder.replayId),t||null};zc.prototype.getRecorder=function(){return this._recorder};zc.prototype._setupChildFrameListener=function(t,e){if(!this._childFrameMessageHandler){var n=this;this._childFrameMessageHandler=function(r){if(t.indexOf(r.origin)!==-1){var s=r.data;s&&s.type===Pct&&s.token===n.getMpConfig("token")&&s.replayId&&(n._parentReplayId=s.replayId,s.distinctId&&n.mixpanelInstance.identify(s.distinctId),n._parentFrameRetryActive=!1,Ht.removeEventListener("message",n._childFrameMessageHandler),n._childFrameMessageHandler=null,e(!0))}},Ht.addEventListener("message",this._childFrameMessageHandler)}};zc.prototype._sendParentFrameRequest=function(t){var e={};e.type=Act,e.token=this.getMpConfig("token");for(var n=0;n<t.length;n++)try{Ht.parent.postMessage(e,t[n])}catch{}};zc.prototype._sendParentFrameRequestWithRetry=function(t){var e=this,n=10,r=0,s=50;this._parentFrameRetryActive=!0,this._sendParentFrameRequest(t);function i(){setTimeout(function(){!e._parentFrameRetryActive||e._parentReplayId||++r>=n||(e._sendParentFrameRequest(t),s*=2,i())},s)}i()};zc.prototype._setupParentFrameListener=function(t){if(!this._parentFrameMessageHandler){var e=this;this._parentFrameMessageHandler=function(n){if(t.indexOf(n.origin)!==-1){var r=n.data;if(r&&r.type===Act&&r.token===e.getMpConfig("token")){var s=e.getSessionReplayId();if(s){var i={};i.type=Pct,i.token=e.getMpConfig("token"),i.replayId=s,i.distinctId=e.getDistinctId(),n.source.postMessage(i,n.origin)}}}},Ht.addEventListener("message",this._parentFrameMessageHandler)}};KCe(zc);var N0=function(){};N0.prototype.create_properties=function(){};N0.prototype.event_handler=function(){};N0.prototype.after_track_handler=function(){};N0.prototype.init=function(t){return this.mp=t,this};N0.prototype.track=function(t,e,n,r){var s=this,i=de.dom_query(t);if(i.length===0){ds.error("The DOM query ("+t+") returned 0 elements");return}return de.each(i,function(o){de.register_event(o,this.override_event,function(l){var c={},d=s.create_properties(n,this),u=s.mp.get_config("track_links_timeout");s.event_handler(l,this,c),window.setTimeout(s.track_callback(r,d,c,!0),u),s.mp.track(e,d,s.track_callback(r,d,c))})},this),!0};N0.prototype.track_callback=function(t,e,n,r){r=r||!1;var s=this;return function(){n.callback_fired||(n.callback_fired=!0,!(t&&t(r,e)===!1)&&s.after_track_handler(e,n,r))}};N0.prototype.create_properties=function(t,e){var n;return typeof t=="function"?n=t(e):n=de.extend({},t),n};var iR=function(){this.override_event="click"};de.inherit(iR,N0);iR.prototype.create_properties=function(t,e){var n=iR.superclass.create_properties.apply(this,arguments);return e.href&&(n.url=e.href),n};iR.prototype.event_handler=function(t,e,n){n.new_tab=t.which===2||t.metaKey||t.ctrlKey||e.target==="_blank",n.href=e.href,n.new_tab||t.preventDefault()};iR.prototype.after_track_handler=function(t,e){e.new_tab||setTimeout(function(){window.location=e.href},0)};var Yee=function(){this.override_event="submit"};de.inherit(Yee,N0);Yee.prototype.event_handler=function(t,e,n){n.element=e,t.preventDefault()};Yee.prototype.after_track_handler=function(t,e){setTimeout(function(){e.element.submit()},0)};var _k="$set",aR="$set_once",eg="$unset",R2="$add",hy="$append",I2="$union",wx="$remove",Ftn="$delete",Rct={set_action:function(t,e){var n={},r={};return de.isObject(t)?de.each(t,function(s,i){this._is_reserved_property(i)||(r[i]=s)},this):r[t]=e,n[_k]=r,n},unset_action:function(t){var e={},n=[];return de.isArray(t)||(t=[t]),de.each(t,function(r){this._is_reserved_property(r)||n.push(r)},this),e[eg]=n,e},set_once_action:function(t,e){var n={},r={};return de.isObject(t)?de.each(t,function(s,i){this._is_reserved_property(i)||(r[i]=s)},this):r[t]=e,n[aR]=r,n},union_action:function(t,e){var n={},r={};return de.isObject(t)?de.each(t,function(s,i){this._is_reserved_property(i)||(r[i]=de.isArray(s)?s:[s])},this):r[t]=de.isArray(e)?e:[e],n[I2]=r,n},append_action:function(t,e){var n={},r={};return de.isObject(t)?de.each(t,function(s,i){this._is_reserved_property(i)||(r[i]=s)},this):r[t]=e,n[hy]=r,n},remove_action:function(t,e){var n={},r={};return de.isObject(t)?de.each(t,function(s,i){this._is_reserved_property(i)||(r[i]=s)},this):r[t]=e,n[wx]=r,n},delete_action:function(){var t={};return t[Ftn]="",t}},ao=function(){};de.extend(ao.prototype,Rct);ao.prototype._init=function(t,e,n){this._mixpanel=t,this._group_key=e,this._group_id=n};ao.prototype.set=fI(function(t,e,n){var r=this.set_action(t,e);return de.isObject(t)&&(n=e),this._send_request(r,n)});ao.prototype.set_once=fI(function(t,e,n){var r=this.set_once_action(t,e);return de.isObject(t)&&(n=e),this._send_request(r,n)});ao.prototype.unset=fI(function(t,e){var n=this.unset_action(t);return this._send_request(n,e)});ao.prototype.union=fI(function(t,e,n){de.isObject(t)&&(n=e);var r=this.union_action(t,e);return this._send_request(r,n)});ao.prototype.delete=fI(function(t){var e=this.delete_action();return this._send_request(e,t)});ao.prototype.remove=fI(function(t,e,n){var r=this.remove_action(t,e);return this._send_request(r,n)});ao.prototype._send_request=function(t,e){t.$group_key=this._group_key,t.$group_id=this._group_id,t.$token=this._get_config("token");var n=de.encodeDates(t);return this._mixpanel._track_or_batch({type:"groups",data:n,endpoint:this._mixpanel.get_api_host("groups")+"/"+this._get_config("api_routes").groups,batcher:this._mixpanel.request_batchers.groups},e)};ao.prototype._is_reserved_property=function(t){return t==="$group_key"||t==="$group_id"};ao.prototype._get_config=function(t){return this._mixpanel.get_config(t)};ao.prototype.toString=function(){return this._mixpanel.toString()+".group."+this._group_key+"."+this._group_id};ao.prototype.remove=ao.prototype.remove;ao.prototype.set=ao.prototype.set;ao.prototype.set_once=ao.prototype.set_once;ao.prototype.union=ao.prototype.union;ao.prototype.unset=ao.prototype.unset;ao.prototype.toString=ao.prototype.toString;var Ss=function(){};de.extend(Ss.prototype,Rct);Ss.prototype._init=function(t){this._mixpanel=t};Ss.prototype.set=pS(function(t,e,n){var r=this.set_action(t,e);return de.isObject(t)&&(n=e),this._get_config("save_referrer")&&this._mixpanel.persistence.update_referrer_info(document.referrer),r[_k]=de.extend({},de.info.people_properties(),r[_k]),this._send_request(r,n)});Ss.prototype.set_once=pS(function(t,e,n){var r=this.set_once_action(t,e);return de.isObject(t)&&(n=e),this._send_request(r,n)});Ss.prototype.unset=pS(function(t,e){var n=this.unset_action(t);return this._send_request(n,e)});Ss.prototype.increment=pS(function(t,e,n){var r={},s={};return de.isObject(t)?(de.each(t,function(i,o){if(!this._is_reserved_property(o))if(isNaN(parseFloat(i))){ds.error("Invalid increment value passed to mixpanel.people.increment - must be a number");return}else s[o]=i},this),n=e):(de.isUndefined(e)&&(e=1),s[t]=e),r[R2]=s,this._send_request(r,n)});Ss.prototype.append=pS(function(t,e,n){de.isObject(t)&&(n=e);var r=this.append_action(t,e);return this._send_request(r,n)});Ss.prototype.remove=pS(function(t,e,n){de.isObject(t)&&(n=e);var r=this.remove_action(t,e);return this._send_request(r,n)});Ss.prototype.union=pS(function(t,e,n){de.isObject(t)&&(n=e);var r=this.union_action(t,e);return this._send_request(r,n)});Ss.prototype.track_charge=pS(function(){ds.error("mixpanel.people.track_charge() is deprecated and no longer has any effect.")});Ss.prototype.clear_charges=function(t){return this.set("$transactions",[],t)};Ss.prototype.delete_user=function(){if(!this._identify_called()){ds.error("mixpanel.people.delete_user() requires you to call identify() first");return}var t={$delete:this._mixpanel.get_distinct_id()};return this._send_request(t)};Ss.prototype.toString=function(){return this._mixpanel.toString()+".people"};Ss.prototype._send_request=function(t,e){t.$token=this._get_config("token"),t.$distinct_id=this._mixpanel.get_distinct_id();var n=this._mixpanel.get_property("$device_id"),r=this._mixpanel.get_property("$user_id"),s=this._mixpanel.get_property("$had_persisted_distinct_id");n&&(t.$device_id=n),r&&(t.$user_id=r),s&&(t.$had_persisted_distinct_id=s);var i=de.encodeDates(t);return this._identify_called()?this._mixpanel._track_or_batch({type:"people",data:i,endpoint:this._mixpanel.get_api_host("people")+"/"+this._get_config("api_routes").engage,batcher:this._mixpanel.request_batchers.people},e):(this._enqueue(t),de.isUndefined(e)||(this._get_config("verbose")?e({status:-1,error:null}):e(-1)),de.truncate(i,255))};Ss.prototype._get_config=function(t){return this._mixpanel.get_config(t)};Ss.prototype._identify_called=function(){return this._mixpanel._flags.identify_called===!0};Ss.prototype._enqueue=function(t){_k in t?this._mixpanel.persistence._add_to_people_queue(_k,t):aR in t?this._mixpanel.persistence._add_to_people_queue(aR,t):eg in t?this._mixpanel.persistence._add_to_people_queue(eg,t):R2 in t?this._mixpanel.persistence._add_to_people_queue(R2,t):hy in t?this._mixpanel.persistence._add_to_people_queue(hy,t):wx in t?this._mixpanel.persistence._add_to_people_queue(wx,t):I2 in t?this._mixpanel.persistence._add_to_people_queue(I2,t):ds.error("Invalid call to _enqueue():",t)};Ss.prototype._flush_one_queue=function(t,e,n,r){var s=this,i=de.extend({},this._mixpanel.persistence.load_queue(t)),o=i;!de.isUndefined(i)&&de.isObject(i)&&!de.isEmptyObject(i)&&(s._mixpanel.persistence._pop_from_people_queue(t,i),s._mixpanel.persistence.save(),r&&(o=r(i)),e.call(s,o,function(l,c){l===0&&s._mixpanel.persistence._add_to_people_queue(t,i),de.isUndefined(n)||n(l,c)}))};Ss.prototype._flush=function(t,e,n,r,s,i,o){var l=this;this._flush_one_queue(_k,this.set,t),this._flush_one_queue(aR,this.set_once,r),this._flush_one_queue(eg,this.unset,i,function(v){return de.keys(v)}),this._flush_one_queue(R2,this.increment,e),this._flush_one_queue(I2,this.union,s);var c=this._mixpanel.persistence.load_queue(hy);if(!de.isUndefined(c)&&de.isArray(c)&&c.length)for(var d,u=function(v,b){v===0&&l._mixpanel.persistence._add_to_people_queue(hy,d),de.isUndefined(n)||n(v,b)},h=c.length-1;h>=0;h--)c=this._mixpanel.persistence.load_queue(hy),d=c.pop(),l._mixpanel.persistence.save(),de.isEmptyObject(d)||l.append(d,u);var m=this._mixpanel.persistence.load_queue(wx);if(!de.isUndefined(m)&&de.isArray(m)&&m.length)for(var f,p=function(v,b){v===0&&l._mixpanel.persistence._add_to_people_queue(wx,f),de.isUndefined(o)||o(v,b)},g=m.length-1;g>=0;g--)m=this._mixpanel.persistence.load_queue(wx),f=m.pop(),l._mixpanel.persistence.save(),de.isEmptyObject(f)||l.remove(f,p)};Ss.prototype._is_reserved_property=function(t){return t==="$distinct_id"||t==="$token"||t==="$device_id"||t==="$user_id"||t==="$had_persisted_distinct_id"};Ss.prototype.set=Ss.prototype.set;Ss.prototype.set_once=Ss.prototype.set_once;Ss.prototype.unset=Ss.prototype.unset;Ss.prototype.increment=Ss.prototype.increment;Ss.prototype.append=Ss.prototype.append;Ss.prototype.remove=Ss.prototype.remove;Ss.prototype.union=Ss.prototype.union;Ss.prototype.track_charge=Ss.prototype.track_charge;Ss.prototype.clear_charges=Ss.prototype.clear_charges;Ss.prototype.delete_user=Ss.prototype.delete_user;Ss.prototype.toString=Ss.prototype.toString;var aje="__mps",oje="__mpso",lje="__mpus",cje="__mpa",dje="__mpap",uje="__mpr",hje="__mpu",Ict="$people_distinct_id",uY="__alias",HO="__timers",Btn=[aje,oje,lje,cje,dje,uje,hje,Ict,uY,HO],qs=function(t){this.props={},this.campaign_params_saved=!1,t.persistence_name?this.name="mp_"+t.persistence_name:this.name="mp_"+t.token+"_mixpanel";var e=t.persistence;e!=="cookie"&&e!=="localStorage"&&(ds.critical("Unknown persistence type "+e+"; falling back to cookie"),e=t.persistence="cookie"),e==="localStorage"&&de.localStorage.is_supported()?this.storage=de.localStorage:this.storage=de.cookie,this.load(),this.update_config(t),this.upgrade(),this.save()};qs.prototype.properties=function(){var t={};return this.load(),de.each(this.props,function(e,n){de.include(Btn,n)||(t[n]=e)}),t};qs.prototype.load=function(){if(!this.disabled){var t=this.storage.parse(this.name);t&&(this.props=de.extend({},t))}};qs.prototype.upgrade=function(){var t,e;this.storage===de.localStorage?(t=de.cookie.parse(this.name),de.cookie.remove(this.name),de.cookie.remove(this.name,!0),t&&this.register_once(t)):this.storage===de.cookie&&(e=de.localStorage.parse(this.name),de.localStorage.remove(this.name),e&&this.register_once(e))};qs.prototype.save=function(){this.disabled||this.storage.set(this.name,sR(this.props),this.expire_days,this.cross_subdomain,this.secure,this.cross_site,this.cookie_domain)};qs.prototype.load_prop=function(t){return this.load(),this.props[t]};qs.prototype.remove=function(){this.storage.remove(this.name,!1,this.cookie_domain),this.storage.remove(this.name,!0,this.cookie_domain)};qs.prototype.clear=function(){this.remove(),this.props={}};qs.prototype.register_once=function(t,e,n){return de.isObject(t)?(typeof e>"u"&&(e="None"),this.expire_days=typeof n>"u"?this.default_expiry:n,this.load(),de.each(t,function(r,s){(!this.props.hasOwnProperty(s)||this.props[s]===e)&&(this.props[s]=r)},this),this.save(),!0):!1};qs.prototype.register=function(t,e){return de.isObject(t)?(this.expire_days=typeof e>"u"?this.default_expiry:e,this.load(),de.extend(this.props,t),this.save(),!0):!1};qs.prototype.unregister=function(t){this.load(),t in this.props&&(delete this.props[t],this.save())};qs.prototype.update_search_keyword=function(t){this.register(de.info.searchInfo(t))};qs.prototype.update_referrer_info=function(t){this.register_once({$initial_referrer:t||"$direct",$initial_referring_domain:de.info.referringDomain(t)||"$direct"},"")};qs.prototype.get_referrer_info=function(){return de.strip_empty_properties({$initial_referrer:this.props.$initial_referrer,$initial_referring_domain:this.props.$initial_referring_domain})};qs.prototype.update_config=function(t){this.default_expiry=this.expire_days=t.cookie_expiration,this.set_disabled(t.disable_persistence),this.set_cookie_domain(t.cookie_domain),this.set_cross_site(t.cross_site_cookie),this.set_cross_subdomain(t.cross_subdomain_cookie),this.set_secure(t.secure_cookie)};qs.prototype.set_disabled=function(t){this.disabled=t,this.disabled?this.remove():this.save()};qs.prototype.set_cookie_domain=function(t){t!==this.cookie_domain&&(this.remove(),this.cookie_domain=t,this.save())};qs.prototype.set_cross_site=function(t){t!==this.cross_site&&(this.cross_site=t,this.remove(),this.save())};qs.prototype.set_cross_subdomain=function(t){t!==this.cross_subdomain&&(this.cross_subdomain=t,this.remove(),this.save())};qs.prototype.get_cross_subdomain=function(){return this.cross_subdomain};qs.prototype.set_secure=function(t){t!==this.secure&&(this.secure=!!t,this.remove(),this.save())};qs.prototype._add_to_people_queue=function(t,e){var n=this._get_queue_key(t),r=e[t],s=this._get_or_create_queue(_k),i=this._get_or_create_queue(aR),o=this._get_or_create_queue(eg),l=this._get_or_create_queue(R2),c=this._get_or_create_queue(I2),d=this._get_or_create_queue(wx,[]),u=this._get_or_create_queue(hy,[]);n===aje?(de.extend(s,r),this._pop_from_people_queue(R2,r),this._pop_from_people_queue(I2,r),this._pop_from_people_queue(eg,r)):n===oje?(de.each(r,function(h,m){m in i||(i[m]=h)}),this._pop_from_people_queue(eg,r)):n===lje?de.each(r,function(h){de.each([s,i,l,c],function(m){h in m&&delete m[h]}),de.each(u,function(m){h in m&&delete m[h]}),o[h]=!0}):n===cje?(de.each(r,function(h,m){m in s?s[m]+=h:(m in l||(l[m]=0),l[m]+=h)},this),this._pop_from_people_queue(eg,r)):n===hje?(de.each(r,function(h,m){de.isArray(h)&&(m in c||(c[m]=[]),de.each(h,function(f){de.include(c[m],f)||c[m].push(f)}))}),this._pop_from_people_queue(eg,r)):n===uje?(d.push(r),this._pop_from_people_queue(hy,r)):n===dje&&(u.push(r),this._pop_from_people_queue(eg,r)),ds.log("MIXPANEL PEOPLE REQUEST (QUEUED, PENDING IDENTIFY):"),ds.log(e),this.save()};qs.prototype._pop_from_people_queue=function(t,e){var n=this.props[this._get_queue_key(t)];de.isUndefined(n)||de.each(e,function(r,s){t===hy||t===wx?de.each(n,function(i){i[s]===r&&delete i[s]}):delete n[s]},this)};qs.prototype.load_queue=function(t){return this.load_prop(this._get_queue_key(t))};qs.prototype._get_queue_key=function(t){if(t===_k)return aje;if(t===aR)return oje;if(t===eg)return lje;if(t===R2)return cje;if(t===hy)return dje;if(t===wx)return uje;if(t===I2)return hje;ds.error("Invalid queue:",t)};qs.prototype._get_or_create_queue=function(t,e){var n=this._get_queue_key(t);return e=de.isUndefined(e)?{}:e,this.props[n]||(this.props[n]=e)};qs.prototype.set_event_timer=function(t,e){var n=this.load_prop(HO)||{};n[t]=e,this.props[HO]=n,this.save()};qs.prototype.remove_event_timer=function(t){var e=this.load_prop(HO)||{},n=e[t];return de.isUndefined(n)||(delete this.props[HO][t],this.save()),n};var hY,sge=function(t,e){throw new Error(t+" not available in this build.")},Ud,ige=0,Utn=1,vf="mixpanel",Mct="base64",ztn="json",mje="$device:",Vtn="strict",Htn="fallback",Gtn="disabled",BA=Ht.XMLHttpRequest&&"withCredentials"in new XMLHttpRequest,Lct=!BA&&Bv.indexOf("MSIE")===-1&&Bv.indexOf("Mozilla")===-1,mY=null;ox.sendBeacon&&(mY=function(){return ox.sendBeacon.apply(ox,arguments)});var Dct={track:"track/",engage:"engage/",groups:"groups/",record:"record/",flags:"flags/",settings:"settings/"},age={api_host:"https://api-js.mixpanel.com",api_hosts:{},api_routes:Dct,api_extra_query_params:{},api_method:"POST",api_transport:"XHR",api_payload_format:Mct,app_host:"https://mixpanel.com",autocapture:!1,cdn:"https://cdn.mxpnl.com",cross_site_cookie:!1,cross_subdomain_cookie:!0,error_reporter:J1,flags:!1,persistence:"cookie",persistence_name:"",cookie_domain:"",cookie_name:"",loaded:J1,mp_loader:null,track_marketing:!0,track_pageview:!1,skip_first_touch_marketing:!1,store_google:!0,stop_utm_persistence:!1,save_referrer:!0,test:!1,verbose:!1,img:!1,debug:!1,track_links_timeout:300,cookie_expiration:365,upgrade:!1,disable_persistence:!1,disable_cookie:!1,secure_cookie:!1,ip:!0,opt_out_tracking_by_default:!1,opt_out_persistence_by_default:!1,opt_out_tracking_persistence_type:"localStorage",opt_out_tracking_cookie_prefix:null,property_blacklist:[],xhr_headers:{},ignore_dnt:!1,batch_requests:!0,batch_size:50,batch_flush_interval_ms:5e3,batch_request_timeout_ms:9e4,batch_autostart:!0,hooks:{},record_allowed_iframe_origins:[],record_block_class:new RegExp("^(mp-block|fs-exclude|amp-block|rr-block|ph-no-capture)$"),record_block_selector:"img, video, audio",record_canvas:!1,record_collect_fonts:!1,record_console:!0,record_heatmap_data:!1,recording_event_triggers:{},record_idle_timeout_ms:30*60*1e3,record_mask_inputs:!0,record_max_ms:ND,record_min_ms:0,record_network:!1,record_network_options:{},record_sessions_percent:0,recorder_src:null,targeting_src:null,lib_base_path:"https://cdn.mxpnl.com/libs/",remote_settings_mode:Gtn},$ct=!1,ht=function(){},oge=function(t,e,n){var r,s=n===vf?Ud:Ud[n];if(s&&hY===ige)r=s;else{if(s&&!de.isArray(s)){ds.error("You have already initialized "+n);return}r=new ht}if(r._cached_groups={},r._init(t,e,n),r.people=new Ss,r.people._init(r),!r.get_config("skip_first_touch_marketing")){var i=de.info.campaignParams(null),o={},l=!1;de.each(i,function(d,u){o["initial_"+u]=d,d&&(l=!0)}),l&&r.people.set_once(o)}bh.DEBUG=bh.DEBUG||r.get_config("debug");var c=hY===ige?"module":"snippet";return Ht.dispatchEvent(new Ht.CustomEvent("$mp_sdk_to_extension_event",{detail:{instance:r,source:c,token:t,name:n,info:de.info}})),!de.isUndefined(s)&&de.isArray(s)&&(r._execute_array.call(r.people,s.people),r._execute_array(s)),r};ht.prototype.init=function(t,e,n){if(de.isUndefined(n)){this.report_error("You must name your new library: init(token, config, name)");return}if(n===vf){this.report_error("You must initialize the main mixpanel object right after you include the Mixpanel js snippet");return}var r=oge(t,e,n);return Ud[n]=r,r._loaded(),r};ht.prototype._init=function(t,e,n){e=e||{},this.__loaded=!0,this.config={};var r={};if(!("api_payload_format"in e)){var s=e.api_host||age.api_host;s.match(/\.mixpanel\.com/)&&(r.api_payload_format=ztn)}if(this.hooks={},this.set_config(de.extend({},age,r,e,{name:n,token:t,callback_fn:(n===vf?n:vf+"."+n)+"._jsc"})),this.recorderManager=new zc({mixpanelInstance:this,getConfigFunc:de.bind(this.get_config,this),setConfigFunc:de.bind(this.set_config,this),getTabIdFunc:de.bind(this.get_tab_id,this),reportErrorFunc:de.bind(this.report_error,this),getDistinctIdFunc:de.bind(this.get_distinct_id,this),recorderSrc:this.get_config("recorder_src"),targetingSrc:this.get_config("targeting_src"),libBasePath:this.get_config("lib_base_path"),loadExtraBundle:sge}),this._jsc=J1,this.__dom_loaded_queue=[],this.__request_queue=[],this.__disabled_events=[],this._flags={disable_all_events:!1,identify_called:!1},this._remote_settings_strict_disabled=!1,this.request_batchers={},this._batch_requests=this.get_config("batch_requests"),this._batch_requests){if(!de.localStorage.is_supported(!0)||!BA)this._batch_requests=!1,ds.log("Turning off Mixpanel request-queueing; needs XHR and localStorage support"),de.each(this.get_batcher_configs(),function(c){ds.log("Clearing batch queue "+c.queue_key),de.localStorage.remove(c.queue_key)});else if(this.init_batchers(),mY&&Ht.addEventListener){var i=de.bind(function(){this.request_batchers.events.stopped||this.request_batchers.events.flush({unloading:!0})},this);Ht.addEventListener("pagehide",function(c){c.persisted&&i()}),Ht.addEventListener("visibilitychange",function(){bs.visibilityState==="hidden"&&i()})}}this.persistence=this.cookie=new qs(this.config),this.unpersisted_superprops={},this._gdpr_init();var o=de.UUID();this.get_distinct_id()||this.register_once({distinct_id:mje+o,$device_id:o},""),this.flags=new fr({getFullApiRoute:de.bind(function(){return this.get_api_host("flags")+"/"+this.get_config("api_routes").flags},this),getConfigFunc:de.bind(this.get_config,this),setConfigFunc:de.bind(this.set_config,this),getPropertyFunc:de.bind(this.get_property,this),trackingFunc:de.bind(this.track,this),loadExtraBundle:sge,targetingSrc:this.get_config("targeting_src")||this.get_config("lib_base_path")+pat}),this.flags.init(),this.flags=this.flags,this._init_tab_id();var l=this.get_config("remote_settings_mode");l===Vtn||l===Htn?this.__session_recording_init_promise=this._fetch_remote_settings(l).then(de.bind(function(){return this._check_and_start_session_recording()},this)):this.__session_recording_init_promise=this._check_and_start_session_recording(),this.autocapture=new Dl(this),this.autocapture.init()};ht.prototype._init_tab_id=function(){if(this.get_config("disable_persistence"))ds.log("Tab ID initialization skipped due to disable_persistence config");else if(de.sessionStorage.is_supported())try{var t=this.get_config("name")+"_"+this.get_config("token"),e="mp_tab_id_"+t,n="mp_gen_new_tab_id_"+t;(de.sessionStorage.get(n)||!de.sessionStorage.get(e))&&de.sessionStorage.set(e,"$tab-"+de.UUID()),de.sessionStorage.set(n,"1"),this.tab_id=de.sessionStorage.get(e),Ht.addEventListener("beforeunload",function(){de.sessionStorage.remove(n)})}catch(r){this.report_error("Error initializing tab id",r)}else this.report_error("Session storage is not supported, cannot keep track of unique tab ID.")};ht.prototype.get_tab_id=function(){return this.tab_id||null};ht.prototype._check_and_start_session_recording=fS(function(t){return this.recorderManager.checkAndStartSessionRecording(t)});ht.prototype._start_recording_on_event=A2(function(t,e){this.__session_recording_init_promise&&this.__session_recording_init_promise.then(de.bind(function(){if(!this._remote_settings_strict_disabled)return this.recorderManager.startRecordingOnEvent(t,e)},this))});ht.prototype.start_session_recording=function(){return this._check_and_start_session_recording(!0)};ht.prototype.stop_session_recording=function(){return this.recorderManager.stopSessionRecording()};ht.prototype.pause_session_recording=function(){return this.recorderManager.pauseSessionRecording()};ht.prototype.resume_session_recording=function(){return this.recorderManager.resumeSessionRecording()};ht.prototype.is_recording_heatmap_data=function(){return this.recorderManager.isRecordingHeatmapData()};ht.prototype.get_session_recording_properties=function(){return this.recorderManager.getSessionRecordingProperties()};ht.prototype.get_session_replay_url=function(){return this.recorderManager.getSessionReplayUrl()};ht.prototype.__get_recorder=function(){return this.recorderManager.getRecorder()};ht.prototype.__get_recording_init_promise=function(){return this.__session_recording_init_promise};ht.prototype._loaded=function(){if(this.get_config("loaded")(this),this._set_default_superprops(),this.people.set_once(this.persistence.get_referrer_info()),this.get_config("store_google")&&this.get_config("stop_utm_persistence")){var t=de.info.campaignParams(null);de.each(t,(function(e,n){this.unregister(n)}).bind(this))}};ht.prototype._set_default_superprops=function(){this.persistence.update_search_keyword(bs.referrer),this.get_config("store_google")&&!this.get_config("stop_utm_persistence")&&this.register(de.info.campaignParams()),this.get_config("save_referrer")&&this.persistence.update_referrer_info(bs.referrer)};ht.prototype._dom_loaded=function(){de.each(this.__dom_loaded_queue,function(t){this._track_dom.apply(this,t)},this),this.has_opted_out_tracking()||de.each(this.__request_queue,function(t){this._send_request.apply(this,t)},this),delete this.__dom_loaded_queue,delete this.__request_queue};ht.prototype._track_dom=function(t,e){if(this.get_config("img"))return this.report_error("You can't use DOM tracking functions with img = true."),!1;if(!$ct)return this.__dom_loaded_queue.push([t,e]),!1;var n=new t().init(this);return n.track.apply(n,e)};ht.prototype._prepare_callback=function(t,e){if(de.isUndefined(t))return null;if(BA){var n=function(o){t(o,e)};return n}else{var r=this._jsc,s=""+Math.floor(Math.random()*1e8),i=this.get_config("callback_fn")+"["+s+"]";return r[s]=function(o){delete r[s],t(o,e)},i}};ht.prototype._send_request=function(t,e,n,r){var s=!0;if(Lct)return this.__request_queue.push(arguments),s;var i={method:this.get_config("api_method"),transport:this.get_config("api_transport"),verbose:this.get_config("verbose")},o=null;!r&&(de.isFunction(n)||typeof n=="string")&&(r=n,n=null),n=de.extend(i,n||{}),BA||(n.method="GET");var l=n.method==="POST",c=mY&&l&&n.transport.toLowerCase()==="sendbeacon",d=n.verbose;e.verbose&&(d=!0),this.get_config("test")&&(e.test=1),d&&(e.verbose=1),this.get_config("img")&&(e.img=1),BA||(r?e.callback=r:(d||this.get_config("test"))&&(e.callback="(function(){})")),e.ip=this.get_config("ip")?1:0,e._=new Date().getTime().toString(),l&&(o="data="+encodeURIComponent(e.data),delete e.data),de.extend(e,this.get_config("api_extra_query_params")),t+="?"+de.HTTPBuildQuery(e);var u=this;if("img"in e){var h=bs.createElement("img");h.src=t,bs.body.appendChild(h)}else if(c){try{s=mY(t,o)}catch(b){u.report_error(b),s=!1}try{r&&r(s?1:0)}catch(b){u.report_error(b)}}else if(BA)try{var m=new XMLHttpRequest;m.open(n.method,t,!0);var f=this.get_config("xhr_headers");if(l&&(f["Content-Type"]="application/x-www-form-urlencoded"),de.each(f,function(b,x){m.setRequestHeader(x,b)}),n.timeout_ms&&typeof m.timeout<"u"){m.timeout=n.timeout_ms;var p=new Date().getTime()}m.withCredentials=!0,m.onreadystatechange=function(){if(m.readyState===4)if(m.status===200){if(r)if(d){var b;try{b=de.JSONDecode(m.responseText)}catch(k){if(u.report_error(k),n.ignore_json_errors)b=m.responseText;else return}r(b)}else r(Number(m.responseText))}else{var x;if(m.timeout&&!m.status&&new Date().getTime()-p>=m.timeout?x="timeout":x="Bad HTTP status: "+m.status+" "+m.statusText,u.report_error(x),r)if(d){var w=m.responseHeaders||{};r({status:0,httpStatusCode:m.status,error:x,retryAfter:w["Retry-After"]})}else r(0)}},m.send(o)}catch(b){u.report_error(b),s=!1}else{var g=bs.createElement("script");g.type="text/javascript",g.async=!0,g.defer=!0,g.src=t;var v=bs.getElementsByTagName("script")[0];v.parentNode.insertBefore(g,v)}return s};ht.prototype._fetch_remote_settings=function(t){var e=this,n=function(){t==="strict"&&(e.set_config({record_sessions_percent:0}),e._remote_settings_strict_disabled=!0)};if(!Ht.AbortController)return ds.critical("Remote settings unavailable: missing minimum required APIs"),n(),Promise.resolve();var r=this.get_api_host("settings")+"/"+this.get_config("api_routes").settings,s={$lib_version:bh.LIB_VERSION,mp_lib:"web",sdk_config:"1"},i=de.HTTPBuildQuery(s),o=r+"?"+i,l=new AbortController,c=setTimeout(function(){l.abort()},500),d={method:"GET",headers:{Authorization:"Basic "+btoa(e.get_config("token")+":")},signal:l.signal};return Ht.fetch(o,d).then(function(u){if(clearTimeout(c),!u.ok){ds.critical("Network response was not ok"),n();return}return u.json()}).then(function(u){if(u&&u.sdk_config&&u.sdk_config.config){var h=u.sdk_config.config,m={};de.each(h,function(f,p){age.hasOwnProperty(p)&&(m[p]=f)}),de.isEmptyObject(m)?(ds.critical("No valid config keys found in remote settings."),n()):e.set_config(m)}else n()}).catch(function(u){clearTimeout(c),ds.critical("Failed to fetch remote settings",u),n()})};ht.prototype._execute_array=function(t){var e,n=[],r=[],s=[];de.each(t,function(o){o&&(e=o[0],de.isArray(e)?s.push(o):typeof o=="function"?o.call(this):de.isArray(o)&&e==="alias"?n.push(o):de.isArray(o)&&e.indexOf("track")!==-1&&typeof this[e]=="function"?s.push(o):r.push(o))},this);var i=function(o,l){de.each(o,function(c){if(de.isArray(c[0])){var d=l;de.each(c,function(u){d=d[u[0]].apply(d,u.slice(1))})}else this[c[0]].apply(this,c.slice(1))},l)};i(n,this),i(r,this),i(s,this)};ht.prototype.are_batchers_initialized=function(){return!!this.request_batchers.events};ht.prototype.get_batcher_configs=function(){var t="__mpq_"+this.get_config("token");return this._batcher_configs=this._batcher_configs||{events:{type:"events",api_name:"track",queue_key:t+"_ev"},people:{type:"people",api_name:"engage",queue_key:t+"_pp"},groups:{type:"groups",api_name:"groups",queue_key:t+"_gr"}},this._batcher_configs};ht.prototype.init_batchers=function(){if(!this.are_batchers_initialized()){var t=de.bind(function(n){return new ep(n.queue_key,{libConfig:this.config,errorReporter:this.get_config("error_reporter"),sendRequestFunc:de.bind(function(r,s,i){var o=this.get_config("api_routes");this._send_request(this.get_api_host(n.api_name)+"/"+o[n.api_name],this._encode_data_for_request(r),s,this._prepare_callback(i,r))},this),beforeSendHook:de.bind(function(r){var s=this._run_hook("before_send_"+n.type,r);return s?s[0]:null},this),stopAllBatchingFunc:de.bind(this.stop_batch_senders,this),usePersistence:!0})},this),e=this.get_batcher_configs();this.request_batchers={events:t(e.events),people:t(e.people),groups:t(e.groups)}}this.get_config("batch_autostart")&&this.start_batch_senders()};ht.prototype.start_batch_senders=function(){this._batchers_were_started=!0,this.are_batchers_initialized()&&(this._batch_requests=!0,de.each(this.request_batchers,function(t){t.start()}))};ht.prototype.stop_batch_senders=function(){this._batch_requests=!1,de.each(this.request_batchers,function(t){t.stop(),t.clear()})};ht.prototype.push=function(t){this._execute_array([t])};ht.prototype.enable=function(t){var e,n,r,s;if(typeof t>"u")this._flags.disable_all_events=!1;else{for(e={},n=[],r=0;r<t.length;r++)e[t[r]]=!0;for(s=0;s<this.__disabled_events.length;s++)e[this.__disabled_events[s]]||n.push(this.__disabled_events[s]);this.__disabled_events=n}};ht.prototype.disable=function(t){typeof t>"u"?this._flags.disable_all_events=!0:this.__disabled_events=this.__disabled_events.concat(t)};ht.prototype._encode_data_for_request=function(t){var e=sR(t);return this.get_config("api_payload_format")===Mct&&(e=de.base64Encode(e)),{data:e}};ht.prototype._track_or_batch=function(t,e){var n=de.truncate(t.data,255),r=t.endpoint,s=t.batcher,i=t.should_send_immediately,o=t.send_request_options||{};e=e||J1;var l=!0,c=de.bind(function(){return o.skip_hooks||(n=this._run_hook("before_send_"+t.type,n),n&&(n=n[0])),n?(ds.log("MIXPANEL REQUEST:"),ds.log(n),this._send_request(r,this._encode_data_for_request(n),o,this._prepare_callback(e,n))):null},this);return this._batch_requests&&!i?s.enqueue(n).then(function(d){d?e(1,n):c()}):l=c(),l&&n};ht.prototype.track=fS(function(t,e,n,r){var s;if(!(n&&n.skip_hooks)){if(s=this._run_hook("before_track",t,e),s===null)return;t=s[0],e=s[1]}!r&&typeof n=="function"&&(r=n,n=null),n=n||{};var i=n.transport;i&&(n.transport=i);var o=n.send_immediately;if(typeof r!="function"&&(r=J1),de.isUndefined(t)){this.report_error("No event name provided to mixpanel.track");return}if(this._event_is_disabled(t)){r(0);return}e=de.extend({},e),e.token=this.get_config("token");var l=this.persistence.remove_event_timer(t);if(!de.isUndefined(l)){var c=new Date().getTime()-l;e.$duration=parseFloat((c/1e3).toFixed(3))}this._set_default_superprops();var d=this.get_config("track_marketing")?de.info.marketingParams():{};e=de.extend({},de.info.properties({mp_loader:this.get_config("mp_loader")}),d,this.persistence.properties(),this.unpersisted_superprops,this.get_session_recording_properties(),e);var u=this.get_config("property_blacklist");de.isArray(u)?de.each(u,function(m){delete e[m]}):this.report_error("Invalid value for property_blacklist config: "+u),this._start_recording_on_event(t,e);var h={event:t,properties:e};return s=this._track_or_batch({type:"events",data:h,endpoint:this.get_api_host("events")+"/"+this.get_config("api_routes").track,batcher:this.request_batchers.events,should_send_immediately:o,send_request_options:n},r),this.flags&&this.flags.checkFirstTimeEvents&&this.flags.checkFirstTimeEvents(t,e),s});ht.prototype.set_group=fS(function(t,e,n){de.isArray(e)||(e=[e]);var r={};return r[t]=e,this.register(r),this.people.set(t,e,n)});ht.prototype.add_group=fS(function(t,e,n){var r=this.get_property(t),s={};return r===void 0?(s[t]=[e],this.register(s)):r.indexOf(e)===-1&&(r.push(e),s[t]=r,this.register(s)),this.people.union(t,e,n)});ht.prototype.remove_group=fS(function(t,e,n){var r=this.get_property(t);if(r!==void 0){var s=r.indexOf(e);s>-1&&(r.splice(s,1),this.register({group_key:r})),r.length===0&&this.unregister(t)}return this.people.remove(t,e,n)});ht.prototype.track_with_groups=fS(function(t,e,n,r){var s=de.extend({},e||{});return de.each(n,function(i,o){i!=null&&(s[o]=i)}),this.track(t,s,r)});ht.prototype._create_map_key=function(t,e){return t+"_"+JSON.stringify(e)};ht.prototype._remove_group_from_cache=function(t,e){delete this._cached_groups[this._create_map_key(t,e)]};ht.prototype.get_group=function(t,e){var n=this._create_map_key(t,e),r=this._cached_groups[n];return(r===void 0||r._group_key!==t||r._group_id!==e)&&(r=new ao,r._init(this,t,e),this._cached_groups[n]=r),r};ht.prototype.track_pageview=fS(function(t,e){typeof t!="object"&&(t={}),e=e||{};var n=e.event_name||"$mp_web_page_view",r=de.extend(de.info.mpPageViewProperties(),de.info.campaignParams(),de.info.clickParams()),s=de.extend({},r,t);return this.is_recording_heatmap_data()&&(s.$captured_for_heatmap=!0),this.track(n,s)});ht.prototype.track_links=function(){return this._track_dom.call(this,iR,arguments)};ht.prototype.track_forms=function(){return this._track_dom.call(this,Yee,arguments)};ht.prototype.time_event=function(t){if(de.isUndefined(t)){this.report_error("No event name provided to mixpanel.time_event");return}this._event_is_disabled(t)||this.persistence.set_event_timer(t,new Date().getTime())};var Wtn={persistent:!0},fje=function(t){var e;return de.isObject(t)?e=t:de.isUndefined(t)?e={}:e={days:t},de.extend({},Wtn,e)};ht.prototype.register=function(t,e){var n=this._run_hook("before_register",t,e);if(n!==null){t=n[0],e=n[1];var r=fje(e);r.persistent?this.persistence.register(t,r.days):de.extend(this.unpersisted_superprops,t)}};ht.prototype.register_once=function(t,e,n){var r=this._run_hook("before_register_once",t,e,n);if(r!==null){t=r[0],e=r[1],n=r[2];var s=fje(n);s.persistent?this.persistence.register_once(t,e,s.days):(typeof e>"u"&&(e="None"),de.each(t,function(i,o){(!this.unpersisted_superprops.hasOwnProperty(o)||this.unpersisted_superprops[o]===e)&&(this.unpersisted_superprops[o]=i)},this))}};ht.prototype.unregister=function(t,e){var n=this._run_hook("before_unregister",t,e);n!==null&&(t=n[0],e=n[1],e=fje(e),e.persistent?this.persistence.unregister(t):delete this.unpersisted_superprops[t])};ht.prototype._register_single=function(t,e){var n={};n[t]=e,this.register(n)};ht.prototype.identify=function(t,e,n,r,s,i,o,l){var c=this._run_hook("before_identify",t);if(c===null)return-1;t=c[0];var d=this.get_distinct_id();if(t&&d!==t){if(typeof t=="string"&&t.indexOf(mje)===0)return this.report_error("distinct_id cannot have $device: prefix"),-1;this.register({$user_id:t})}if(!this.get_property("$device_id")){var u=d;this.register_once({$had_persisted_distinct_id:!0,$device_id:u},"")}t!==d&&t!==this.get_property(uY)&&(this.unregister(uY),this.register({distinct_id:t})),this._flags.identify_called=!0,this.people._flush(e,n,r,s,i,o,l),t!==d&&this.track("$identify",{distinct_id:t,$anon_distinct_id:d},{skip_hooks:!0}),t!==d&&this.flags.fetchFlags().catch(function(){ds.error("[flags] Error fetching flags during identify")})};ht.prototype.reset=function(){this.stop_session_recording(),this.persistence.clear(),this._flags.identify_called=!1;var t=de.UUID();this.register_once({distinct_id:mje+t,$device_id:t},""),this._check_and_start_session_recording(),this.flags.reset()};ht.prototype.get_distinct_id=function(){return this.get_property("distinct_id")};ht.prototype.alias=function(t,e){if(t===this.get_property(Ict))return this.report_error("Attempting to create alias for existing People user - aborting."),-2;var n=this;return de.isUndefined(e)&&(e=this.get_distinct_id()),t!==e?(this._register_single(uY,t),this.track("$create_alias",{alias:t,distinct_id:e},{skip_hooks:!0},function(){n.identify(t)})):(this.report_error("alias matches current distinct_id - skipping api call."),this.identify(t),-1)};ht.prototype.name_tag=function(t){this._register_single("mp_name_tag",t)};ht.prototype.set_config=function(t){if(de.isObject(t)){de.extend(this.config,t);var e=t.batch_size;e&&de.each(this.request_batchers,function(n){n.resetBatchSize()}),this.get_config("persistence_name")||(this.config.persistence_name=this.config.cookie_name),this.get_config("disable_persistence")||(this.config.disable_persistence=this.config.disable_cookie),this.persistence&&this.persistence.update_config(this.config),bh.DEBUG=bh.DEBUG||this.get_config("debug"),("autocapture"in t||"record_heatmap_data"in t)&&this.autocapture&&this.autocapture.init(),de.isObject(t.hooks)&&(this.hooks={},de.each(t.hooks,function(n,r){if(de.isFunction(n))this.hooks[r]=[n];else if(de.isArray(n)){this.hooks[r]=[];for(var s=0;s<n.length;s++)de.isFunction(n[s])||ds.critical("Invalid hook added. Hook is not a function"),this.hooks[r].push(n[s])}else ds.critical("Invalid hooks added. Ensure that the hook values passed into config.hooks are functions or arrays of functions.")},this))}};ht.prototype.get_config=function(t){return this.config[t]};ht.prototype._run_hook=function(t){var e=N1.call(arguments,1);return de.each(this.hooks[t],function(n){if(e===null)return null;var r=n.apply(this,e);typeof r>"u"?(this.report_error(t+" hook did not return a valid value"),e=null):(de.isArray(r)||(r=[r]),e.splice.apply(e,[0,r.length].concat(r)))},this),e};ht.prototype.get_property=function(t){return this.persistence.load_prop([t])};ht.prototype.get_api_host=function(t){return this.get_config("api_hosts")[t]||this.get_config("api_host")};ht.prototype.toString=function(){var t=this.get_config("name");return t!==vf&&(t=vf+"."+t),t};ht.prototype._event_is_disabled=function(t){return de.isBlockedUA(Bv)||this._flags.disable_all_events||de.include(this.__disabled_events,t)};ht.prototype._gdpr_init=function(){var t=this.get_config("opt_out_tracking_persistence_type")==="localStorage";t&&de.localStorage.is_supported()&&(!this.has_opted_in_tracking()&&this.has_opted_in_tracking({persistence_type:"cookie"})&&this.opt_in_tracking({enable_persistence:!1}),!this.has_opted_out_tracking()&&this.has_opted_out_tracking({persistence_type:"cookie"})&&this.opt_out_tracking({clear_persistence:!1}),this.clear_opt_in_out_tracking({persistence_type:"cookie",enable_persistence:!1})),this.has_opted_out_tracking()?this._gdpr_update_persistence({clear_persistence:!0}):!this.has_opted_in_tracking()&&(this.get_config("opt_out_tracking_by_default")||de.cookie.get("mp_optout"))&&(de.cookie.remove("mp_optout"),this.opt_out_tracking({clear_persistence:this.get_config("opt_out_persistence_by_default")}))};ht.prototype._gdpr_update_persistence=function(t){var e;if(t&&t.clear_persistence)e=!0;else if(t&&t.enable_persistence)e=!1;else return;!this.get_config("disable_persistence")&&this.persistence.disabled!==e&&this.persistence.set_disabled(e),e?(this.stop_batch_senders(),this.stop_session_recording()):this._batchers_were_started&&this.start_batch_senders()};ht.prototype._gdpr_call_func=function(t,e){return e=de.extend({track:de.bind(this.track,this),persistence_type:this.get_config("opt_out_tracking_persistence_type"),cookie_prefix:this.get_config("opt_out_tracking_cookie_prefix"),cookie_expiration:this.get_config("cookie_expiration"),cross_site_cookie:this.get_config("cross_site_cookie"),cross_subdomain_cookie:this.get_config("cross_subdomain_cookie"),cookie_domain:this.get_config("cookie_domain"),secure_cookie:this.get_config("secure_cookie"),ignore_dnt:this.get_config("ignore_dnt")},e),de.localStorage.is_supported()||(e.persistence_type="cookie"),t(this.get_config("token"),{track:e.track,trackEventName:e.track_event_name,trackProperties:e.track_properties,persistenceType:e.persistence_type,persistencePrefix:e.cookie_prefix,cookieDomain:e.cookie_domain,cookieExpiration:e.cookie_expiration,crossSiteCookie:e.cross_site_cookie,crossSubdomainCookie:e.cross_subdomain_cookie,secureCookie:e.secure_cookie,ignoreDnt:e.ignore_dnt})};ht.prototype.opt_in_tracking=function(t){t=de.extend({enable_persistence:!0},t),this._gdpr_call_func(wen,t),this._gdpr_update_persistence(t)};ht.prototype.opt_out_tracking=function(t){t=de.extend({clear_persistence:!0,delete_user:!0},t),t.delete_user&&this.people&&this.people._identify_called()&&(this.people.delete_user(),this.people.clear_charges()),this._gdpr_call_func(ken,t),this._gdpr_update_persistence(t)};ht.prototype.has_opted_in_tracking=function(t){return this._gdpr_call_func(Sen,t)};ht.prototype.has_opted_out_tracking=function(t){return this._gdpr_call_func(Ylt,t)};ht.prototype.clear_opt_in_out_tracking=function(t){t=de.extend({enable_persistence:!0},t),this._gdpr_call_func(Cen,t),this._gdpr_update_persistence(t)};ht.prototype.report_error=function(t,e){ds.error.apply(ds.error,arguments);try{!e&&!(t instanceof Error)&&(t=new Error(t)),this.get_config("error_reporter")(t,e)}catch(n){ds.error(n)}};ht.prototype.add_hook=function(t,e){this.hooks[t]||(this.hooks[t]=[]),this.hooks[t].push(e)};ht.prototype.remove_hook=function(t,e){var n;this.hooks[t]&&(n=this.hooks[t].indexOf(e),n!==-1?this.hooks[t].splice(n,1):ds.log("remove_hook failed. Matching hook was not found"))};ht.prototype.init=ht.prototype.init;ht.prototype.reset=ht.prototype.reset;ht.prototype.enable=ht.prototype.enable;ht.prototype.disable=ht.prototype.disable;ht.prototype.time_event=ht.prototype.time_event;ht.prototype.track=ht.prototype.track;ht.prototype.track_links=ht.prototype.track_links;ht.prototype.track_forms=ht.prototype.track_forms;ht.prototype.track_pageview=ht.prototype.track_pageview;ht.prototype.register=ht.prototype.register;ht.prototype.register_once=ht.prototype.register_once;ht.prototype.unregister=ht.prototype.unregister;ht.prototype.identify=ht.prototype.identify;ht.prototype.alias=ht.prototype.alias;ht.prototype.name_tag=ht.prototype.name_tag;ht.prototype.set_config=ht.prototype.set_config;ht.prototype.get_config=ht.prototype.get_config;ht.prototype.get_api_host=ht.prototype.get_api_host;ht.prototype.get_property=ht.prototype.get_property;ht.prototype.get_distinct_id=ht.prototype.get_distinct_id;ht.prototype.toString=ht.prototype.toString;ht.prototype.opt_out_tracking=ht.prototype.opt_out_tracking;ht.prototype.opt_in_tracking=ht.prototype.opt_in_tracking;ht.prototype.has_opted_out_tracking=ht.prototype.has_opted_out_tracking;ht.prototype.has_opted_in_tracking=ht.prototype.has_opted_in_tracking;ht.prototype.clear_opt_in_out_tracking=ht.prototype.clear_opt_in_out_tracking;ht.prototype.get_group=ht.prototype.get_group;ht.prototype.set_group=ht.prototype.set_group;ht.prototype.add_group=ht.prototype.add_group;ht.prototype.remove_group=ht.prototype.remove_group;ht.prototype.add_hook=ht.prototype.add_hook;ht.prototype.remove_hook=ht.prototype.remove_hook;ht.prototype.track_with_groups=ht.prototype.track_with_groups;ht.prototype.start_batch_senders=ht.prototype.start_batch_senders;ht.prototype.stop_batch_senders=ht.prototype.stop_batch_senders;ht.prototype.start_session_recording=ht.prototype.start_session_recording;ht.prototype.stop_session_recording=ht.prototype.stop_session_recording;ht.prototype.pause_session_recording=ht.prototype.pause_session_recording;ht.prototype.resume_session_recording=ht.prototype.resume_session_recording;ht.prototype.get_session_recording_properties=ht.prototype.get_session_recording_properties;ht.prototype.get_session_replay_url=ht.prototype.get_session_replay_url;ht.prototype.get_tab_id=ht.prototype.get_tab_id;ht.prototype.DEFAULT_API_ROUTES=Dct;ht.prototype.__get_recorder=ht.prototype.__get_recorder;ht.prototype.__get_recording_init_promise=ht.prototype.__get_recording_init_promise;qs.prototype.properties=qs.prototype.properties;qs.prototype.update_search_keyword=qs.prototype.update_search_keyword;qs.prototype.update_referrer_info=qs.prototype.update_referrer_info;qs.prototype.get_cross_subdomain=qs.prototype.get_cross_subdomain;qs.prototype.clear=qs.prototype.clear;var sA={},qtn=function(){de.each(sA,function(t,e){e!==vf&&(Ud[e]=t)}),Ud._=de},Ktn=function(){Ud.init=function(t,e,n){if(n)return Ud[n]||(Ud[n]=sA[n]=oge(t,e,n),Ud[n]._loaded()),Ud[n];var r=Ud;sA[vf]?r=sA[vf]:t&&(r=oge(t,e,vf),r._loaded(),sA[vf]=r),Ud=r,hY===Utn&&(Ht[vf]=Ud),qtn()}},Ytn=function(){function t(){t.done||(t.done=!0,$ct=!0,Lct=!1,de.each(sA,function(r){r._dom_loaded()}))}function e(){try{bs.documentElement.doScroll("left")}catch{setTimeout(e,1);return}t()}if(bs.addEventListener)bs.readyState==="complete"?t():bs.addEventListener("DOMContentLoaded",t,!1);else if(bs.attachEvent){bs.attachEvent("onreadystatechange",t);var n=!1;try{n=Ht.frameElement===null}catch{}bs.documentElement.doScroll&&n&&e()}de.register_event(Ht,"load",t,!0)};function Qtn(t){return sge=t,hY=ige,Ud=new ht,Ktn(),Ud.init(),Ytn(),Ud}function Ztn(t,e){e()}var fY=Qtn(Ztn);function pje(){return!1}const Jtn="WEBAPP.";function qoe(t){pje()&&(fY.identify(t.id),fY.people.set({$name:t.name,$email:t.email}))}function lh(t,e){pje()&&fY.track(Jtn+t,e)}function jDe(){pje()&&fY.reset()}function WS(t){var n;const e=t.token?t:{...t,token:((n=ro())==null?void 0:n.token)??""};if(!e.token)throw new Error("Authentication response did not include a token");return dat(e),{pensilUser:e,user:hat(e)}}const nd={getStoredSession(){const t=ro();return t!=null&&t.token?{pensilUser:t,user:hat(t)}:null},async establishSessionFromToken(t){dat({id:"",name:"",email:"",token:t});const e=await P3e();return WS(e)},async refreshSession(){const t=ro();if(!(t!=null&&t.token))throw new Error("No stored session");const e=await P3e();return WS(e)},async syncPensilUser(t){const e=ro();if(!(e!=null&&e.token))throw new Error("No stored session");return WS({...e,...t})},async updatePensilProfile(t,e){const n=await cCe(t),r=ro();let s={...r,...n,token:(r==null?void 0:r.token)??n.token};if(e){const i=await uCe(e);s={...s,...i,token:s.token}}return lh("profile-updated"),WS(s)},async requestEmailOtp(t,e=null){const n=await mat("login");await lWt(t,e,n)},async verifyEmailOtp(t,e,n=null){const{user:r}=await cWt(t,e,n);return WS(r)},async completeGoogleLogin(t){const{user:e}=await dWt(t);return WS(e)},async loginWithAppleIdToken(t,e=null){const{user:n}=await uWt(t,e);return WS(n)},logout(){Hfe(),localStorage.removeItem("efc_user"),localStorage.removeItem("efc_auth_token")},updateProfile(t,e,n){const r=kD({...e,...n}),s=t.map(i=>i.id===r.id?r:i);return oWt(s),{user:r,allUsers:s}}},pY={activeCommunity:"pensil.activeCommunity"},oR=wo.communityPublicDomain,Oct=[...new Set([oR,"spatial.community","pensil.so"])],Fct={"spatial.community":"app.spatial.community","pensil.so":"app.pensil.so"},Xtn=["localhost","127.0.0.1","spatial.community","app.spatial.community","app.pensil.so","app.pensil.in","www.pensil.in","staging.pensil.so","pensil.so","www.pensil.so","app.dev1.spatialchat.dev","dev1.spatialchat.dev"],M2=/^[A-Za-z0-9][A-Za-z0-9-]{1,62}[A-Za-z0-9]$/,enn={free:{title:"Small Group",subtitle:"Organize better, create your own space",price:"Free for 10,000 members"},paid:{title:"Big Community",subtitle:"Chat, collaborate, engage others. Embed in your website/product. With unlimited members.",price:"Try for free",footnote:"(*Free for 30 days)"}},Bct=y.createContext(null);function tnn(){const t=sessionStorage.getItem(pY.activeCommunity);if(!t)return null;try{return JSON.parse(t)}catch{return null}}function nnn({children:t}){const[e,n]=y.useState(()=>tnn()),r=y.useCallback(o=>{n(o),o?sessionStorage.setItem(pY.activeCommunity,JSON.stringify(o)):sessionStorage.removeItem(pY.activeCommunity)},[]),s=y.useCallback(()=>{r(null)},[r]),i=y.useMemo(()=>({community:e,setCommunity:r,clearCommunity:s}),[e,r,s]);return a.jsx(Bct.Provider,{value:i,children:t})}function qe(){const t=y.useContext(Bct);if(!t)throw new Error("useCommunity must be used within CommunityProvider");return t}const Qee="pensil.fcmToken";function Uct(t){try{return localStorage.getItem(t)}catch{return null}}function zct(t,e){try{localStorage.setItem(t,e)}catch{}}function Vct(t){try{localStorage.removeItem(t)}catch{}}function gje(){const t=Uct(Qee);if(!t)return null;try{const e=JSON.parse(t);return e!=null&&e.userId&&(e!=null&&e.token)?{userId:e.userId,token:e.token}:null}catch{return null}}function rnn(t){zct(Qee,JSON.stringify(t))}function snn(){const t=gje();Vct(Qee),!(!t||!Nd())&&gWt(t.token).catch(()=>{})}function inn(){Vct(Qee)}const Hct=y.createContext(null);function KU(t,e){return t.some(r=>r.id===e.id||r.email===e.email)?t.map(r=>r.id===e.id||r.email===e.email?{...r,...e}:r):[...t,e]}function ann({children:t}){const e=Nn(),{clearCommunity:n}=qe(),[r,s]=y.useState(aWt),[i,o]=y.useState(()=>{var k;return((k=nd.getStoredSession())==null?void 0:k.user)??null}),[l,c]=y.useState(!0),d=y.useCallback(()=>{snn(),nd.logout(),jDe(),n(),o(null),e(ve.signIn,{replace:!0})},[n,e]),u=y.useCallback((k=ve.signIn)=>{inn(),nd.logout(),jDe(),n(),o(null),e(k,{replace:!0})},[n,e]);y.useEffect(()=>(A3e(()=>{nd.logout(),n(),o(null),_3e(window.location.pathname)||e(ve.signIn,{replace:!0})}),()=>A3e(null)),[n,e]);const h=y.useCallback(async()=>{const S=new URLSearchParams(window.location.search).get("token");if(S)try{const C=await nd.establishSessionFromToken(S);n(),o(C.user),s(j=>KU(j,C.user)),qoe(C.user),window.history.replaceState({},"",window.location.pathname),e(ve.home,{replace:!0})}catch{nd.logout(),n(),o(null)}},[n,e]);y.useEffect(()=>{let k=!1;async function S(){if(new URLSearchParams(window.location.search).has("token")&&!_3e(window.location.pathname))await h();else if(nd.getStoredSession())try{const E=await nd.refreshSession();k||(o(E.user),s(N=>KU(N,E.user)),qoe(E.user))}catch{nd.logout(),n(),k||o(null)}k||c(!1)}return S(),()=>{k=!0}},[n,h]);const m=y.useCallback(k=>{n(),o(k),s(S=>KU(S,k)),qoe(k)},[n]),f=y.useCallback(async(k,S=null)=>{await nd.requestEmailOtp(k,S)},[]),p=y.useCallback(async(k,S,C=null)=>{const j=await nd.verifyEmailOtp(k,S,C);m(j.user)},[m]),g=y.useCallback((k=null,S="signin")=>{const C=wo.apiBaseUrl.replace(/\/$/,""),j=new URLSearchParams;k&&j.set("communityId",k),j.set("returnOrigin",window.location.origin),S==="signup"&&j.set("page",S);const E=new URLSearchParams(window.location.search).get("redirect");E&&E.startsWith("/")&&!E.startsWith("//")&&j.set("redirect",E);const N=j.toString();window.location.href=`${C}/auth/google/start${N?`?${N}`:""}`},[]),v=y.useCallback(async k=>{const S=await nd.completeGoogleLogin(k);m(S.user)},[m]),b=y.useCallback((k=null)=>{const S=wo.apiBaseUrl.replace(/\/$/,""),C=new URLSearchParams;k&&C.set("communityId",k),C.set("returnOrigin",window.location.origin),window.location.href=`${S}/auth/apple/start?${C.toString()}`},[]),x=k=>{if(!i)return;const{user:S,allUsers:C}=nd.updateProfile(r,i,k);o(S),s(C)},w=y.useCallback(k=>{o(k),s(S=>KU(S,k))},[]);return a.jsx(Hct.Provider,{value:{user:i,users:r,isAuthenticated:!!i,authLoading:l,requestEmailOtp:f,verifyEmailOtp:p,startGoogleLogin:g,completeGoogleLogin:v,startAppleLogin:b,updateProfile:x,applyPensilSessionUser:w,logout:d,forceLogout:u,completeAuthSession:h},children:t})}const jr=()=>{const t=y.useContext(Hct);if(!t)throw new Error("useAuth must be used within AuthProvider");return t},Gct="/assets/spatialchat-logo-Fvq9WF6H.png",onn="SpatialChat Communities",EDe=Gct,J8=Gct,L2="SpatialChat Communities",lnn=new Set(["Pensil Community","SpatialChat Community"]);function lge(t,e){const n=(t==null?void 0:t.trim())??"";return lnn.has(n)?L2:n||(e==null?void 0:e.trim())||L2}const Wct="linear-gradient(145deg, #2b7fff 0%, #4d94ff 35%, #6eb0ff 60%, #a8d4ff 82%, #dceeff 100%)",NDe={line1:"Where communities connect",line2:"and people belong together."};function cnn(t){var n;const e=((n=t.split("?")[0])==null?void 0:n.toLowerCase())??"";return e.endsWith(".png")?"image/png":e.endsWith(".svg")?"image/svg+xml":e.endsWith(".webp")?"image/webp":e.endsWith(".gif")?"image/gif":"image/jpeg"}function dnn(){const t=document.querySelector('link[rel="icon"]');if(t)return t;const e=document.createElement("link");return e.rel="icon",document.head.appendChild(e),e}const unn=new Set([ve.communities,ve.communitiesCreate,ve.communitiesCreateOverview,ve.communitiesJoin,ve.communitiesOnboarding,ve.blocked,ve.signIn,ve.signUp,ve.onboarding,ve.welcome,ve.recommendations,ve.introduce]);function hnn(){const{community:t}=qe(),{pathname:e}=Di(),n=!!t&&!unn.has(e);y.useEffect(()=>{var o,l;const r=n?(o=t==null?void 0:t.name)==null?void 0:o.trim():void 0;document.title=r||onn;const s=n&&((l=t==null?void 0:t.logo)==null?void 0:l.trim())||EDe,i=dnn();i.href=s,i.type=cnn(s)},[t==null?void 0:t.name,t==null?void 0:t.logo,e,n])}function mnn(){return hnn(),null}async function fnn(){return ae.get("/community/joined")}async function Zee(t){return ae.get(`/community/${encodeURIComponent(t)}`)}async function lR(t){return ae.get(`/community-by-id/${encodeURIComponent(t)}`)}async function qct(t){return ae.get(`/community/address-availability/${encodeURIComponent(t.toLowerCase())}`)}async function pnn(t){var e;return ae.post("/community",{name:t.name.trim(),address:t.address.trim().toLowerCase(),description:((e=t.description)==null?void 0:e.trim())||void 0,selectedType:t.selectedType??"free"})}function Kct(t){const e={};return t.emailOptIn&&(e.emailOptIn=!0),t.emailOptInShown&&(e.emailOptInShown=!0),e}async function gnn(t,e={}){return ae.post(`/community/join-by-address/${encodeURIComponent(t.trim().toLowerCase())}`,Kct(e))}async function vnn(t,e={}){return ae.post(`/community/join/${t}`,Kct(e))}async function cge(t,e,n="light"){const r=new FormData;return r.append("logo",e,e.name),Ea(`/community/${encodeURIComponent(t)}/update-logo/${n}`,r)}async function TDe(t,e="light"){return ae.post(`/community/${encodeURIComponent(t)}/remove-logo/${e}`,{})}async function ynn(t,e){const n=new FormData;return n.append("favicon",e,e.name),Ea(`/community/${encodeURIComponent(t)}/update-favicon`,n)}async function bnn(t){return ae.post(`/community/${encodeURIComponent(t)}/remove-favicon`,{})}async function Yct(t,e){return ae.post(`/community/${encodeURIComponent(t)}`,e)}async function xnn(t){return ae.get(`/community/${encodeURIComponent(t)}/pac`)}async function vje(t,e){return ae.post(`/community/${encodeURIComponent(t)}/banner-details`,e)}async function Qct(t,e){const n=new FormData;return n.append("banner",e,e.name),Ea(`/community/${encodeURIComponent(t)}/update-banner`,n)}async function Zct(t){return ae.post(`/community/${encodeURIComponent(t)}/remove-banner`,{})}async function wnn(t,e){return ae.put(`/community/${encodeURIComponent(t)}/welcome-messages`,{welcomeMessages:e})}async function knn(t,e){return ae.put(`/community/${encodeURIComponent(t)}/toggle-login-requirement`,{loginRequired:e})}async function Snn(t){return ae.get(`/community/${encodeURIComponent(t)}/additional-configuration`)}async function Cnn(t,e){return ae.post(`/community/${encodeURIComponent(t)}/additional-configuration/default-join-groups`,{groupIds:e})}async function jnn(t){return ae.get(`/community/${encodeURIComponent(t)}/last-post-time`)}async function qj(t,e){return ae.get(`/community/${encodeURIComponent(t)}/configurable/${encodeURIComponent(e)}`)}const Jct=(t,e)=>["my-language",t,e];function Xct(t){return ae.get(`/community/${encodeURIComponent(t)}/my-language`)}function Enn(t,e){return ae.post(`/community/${encodeURIComponent(t)}/my-language`,{language:e})}async function D2(t,e,n){return ae.post(`/community/${encodeURIComponent(t)}/configurable/${encodeURIComponent(e)}`,{configurableValue:n})}async function Jee(t,e,n){return ae.put(`/community/${encodeURIComponent(t)}/update-config/v2`,{configKey:e,configValue:n})}async function yje(t,e,n){return ae.put(`/community/${encodeURIComponent(t)}/update-config`,{configKey:e,configValue:n})}const Nnn=[{title:"Show or hide features",toggles:[{configKey:"isDirectMessageDisabled",label:"Hide direct messaging for users",legacy:!0},{configKey:"isDmCallingDisabled",label:"Turn off audio and video calls in direct messages",hint:"Members can still message each other; the call buttons are hidden.",legacy:!0},{configKey:"isEventsTabDisabled",label:"Hide events/calendar for the community"},{configKey:"isExploreCourseDisabled",label:"Hide Courses and Knowledge Hub",hint:"Hides Courses and Knowledge Hub from navigation and redirects those pages to home."},{configKey:"isMemberDirectoryDisabled",label:"Hide Member Directory page"},{configKey:"hideOnlineMembersFromUsers",label:"Hide Online Now for members",hint:"Members won't see who's online. Admins still can, and the presence API returns nothing for members."}]},{title:"Customise header",toggles:[{configKey:"hideHeaderCommunityLogo",label:"Hide community logo in the header",premium:"communityCustomization"},{configKey:"hideHeaderCommunityName",label:"Hide community name from the header",premium:"communityCustomization"},{configKey:"disableHeaderDropdown",label:"Hide profile picture in the header in web view",hint:"Also hides the logout option in the profile dropdown.",premium:"communityCustomization"},{configKey:"disableMobileViewHeaderDropdown",label:"Hide profile picture in the header in mobile view",premium:"communityCustomization"},{configKey:"showCommunityLinksInHeader",label:"Show community links as nav links",premium:"communityCustomization"}]},{title:"Customise sidebar",toggles:[{configKey:"collapseSidebarGroupLinks",label:"Show collapsed groups by default",premium:"communityCustomization"},{configKey:"hideClosedGroupWithoutJoin",label:"Hide closed groups from non-members",hint:"Closed groups aren't shown to users who aren't members of the group.",premium:"communityCustomization",legacy:!0},{configKey:"showPoweredByPensil",label:"Show powered by SpatialChat Communities",premium:"hidePoweredByPensil"},{configKey:"isCommunitySwitcherDisabled",label:"Hide community switcher",premium:"communityCustomization",legacy:!0}]},{title:"Misc",toggles:[{configKey:"useMdEditorForCreatePostDescription",label:"Use the Markdown editor to create posts",premium:"communityCustomization"},{configKey:"anyoneCanCreateEvent",label:"Anyone can create events in the community"},{configKey:"hideCommunityUnsubscribe",label:"Hide unsubscribe button from the community"},{configKey:"disableEmailNotifications",label:"Disable all email notifications from the community"}]}];function ql(t,e,n=!1){if(!t||typeof t!="object")return n;const r=t.configuration;return r&&typeof r=="object"&&e in r?!!r[e]:e in t?!!t[e]:n}const YU="COMMUNITY_POST_TIMER_LIMIT",QU="COMMUNITY_REPORT_EMAIL",Koe="COMMUNITY_PREVENT_USER_PROFILE_UPDATE",dge="COMMUNITY_DEFAULT_LANGUAGE",uge="COMMUNITY_DEFAULT_FONT_LINK",hge="COMMUNITY_DEFAULT_FONT_NAME",Tnn={"SpatialChat Communities Keyword":"Czech",Home:"Domov","Explore Groups":"Prozkoumat Skupiny",Events:"Události",Groups:"Skupiny",Links:"Odkazy","Direct Message":"Přímá zpráva","Powered by":"Provozováno na","No groups here, please use + to create a new one, or join one see them here.":"Nejsou zde žádné skupiny, použijte prosím + k vytvoření nové nebo se do nějaké přidejte, podívejte se zde.","Please join a group to see them here":"Chcete-li je zde vidět, připojte se ke skupině","Section can only be reordered within the group!":"Sekci lze doobjednat pouze v rámci skupiny!","Group Page":"Skupinová stránka","Invite Members":"Pozvat členy",Join:"Připojte se",Joined:"Připojeno","Create new section":"Vytvořit novou sekci","Group Setting drop down":"Rozbalovací nabídka Nastavení skupiny",Share:"Podíl","Edit group":"Upravit skupinu","Delete group":"Smazat skupinu",Leave:"Dovolená","Are you sure you want to delete the group?":"Opravdu chcete smazat skupinu?",Cancel:"Zrušit","Yes, Go Ahead":"Ano, pokračujte","Share via link":"Sdílejte prostřednictvím odkazu",Copy:"Kopie",Copied:"Zkopírováno","Share on social media":"Sdílejte na sociálních sítích","Add Section":"Přidat sekci","Section Header":"Záhlaví sekce",Live:"Žít","Create post":"Vytvořit příspěvek","Notificaiton Bell":"Oznamovací zvonek","All posts":"Všechny příspěvky","Admin posts only":"Pouze příspěvky administrátora",None:"Žádný","Section Setting drop down":"Rozbalovací nabídka Nastavení sekce","Edit Section":"Upravit sekci","Embed Section":"Sekce vložení","Delete Section":"Smazat sekci","Are you sure you want to delete the section?":"Opravdu chcete sekci smazat?","Section deleted!":"Sekce smazána!","Create Group Pop up / Update":"Vytvořit vyskakovací okno skupiny / aktualizovat","Create group":"Vytvořit skupinu","Basic Detail":"Základní detail",Settings:"Nastavení","Size 16:9 or 1600 by 900":"Velikost 16:9 nebo 1600 x 900","Group name":"Název skupiny","Enter group name":"Zadejte název skupiny","Suggestions: Spaces, Channels, Groups, Blog, Knowledgebase, etc":"Návrhy: Prostory, Kanály, Skupiny, Blog, Databáze znalostí atd","Group Description":"Popis skupiny","Enter description here":"Zde zadejte popis","Group Type":"Typ skupiny",Open:"OTEVŘENO","Visible to all & anyone can join":"Viditelné pro všechny a kdokoli se může připojit",Closed:"ZAVŘENO","User will have to request to join the group":"Uživatel bude muset požádat o připojení ke skupině",Paid:"Zaplaceno","Group Price":"Skupinová cena","Currency (Default: INR)":"Měna (výchozí: INR)","User will have to pay to join the group":"Uživatel bude muset za připojení ke skupině zaplatit","Make this a private group":"Udělejte z toho soukromou skupinu","Private group will only be visible to members who are part of it. Admin can add members manually from member list":"Soukromá skupina bude viditelná pouze členům, kteří jsou její součástí. Admin může přidat členy ručně ze seznamu členů","Upload from device":"Nahrát ze zařízení","Search image":"Vyhledat obrázek","Valid group name required!":"Je vyžadován platný název skupiny!","Update Group":"Aktualizovat skupinu","SEO Settings":"Nastavení SEO","Custom URL":"Vlastní adresa URL","Meta Title":"Název metadat","Maximum length of 255 characters allowed":"Maximální povolená délka 255 znaků","Meta Description":"Popis metadat","Open Graph Detail":"Otevřete Detail grafu","Open Graph Title":"Otevřete název grafu","Open Graph Description":"Otevřete popis grafu","Open Graph Image":"Otevřete obrázek grafu","Recommended dimensions: 1200px by 630px with a 1.91:1 aspect ratio.":"Doporučené rozměry: 1200 x 630 pixelů s poměrem stran 1,91:1.","If no URL is used, it will automatically picked your group thumbnail.":"Pokud není použita žádná adresa URL, automaticky vybere miniaturu vaší skupiny.","Create Section Pop up / Update":"Vytvořit vyskakovací okno sekce / Aktualizovat","Create Section":"Vytvořit sekci","Section Name":"Název sekce","Suggestions: General, Introductions, Community Guidelines":"Návrhy: Obecné, Úvody, Pokyny pro komunitu","Section Type":"Typ sekce","Post Type":"Typ příspěvku","Group Chat":"Skupinový chat","Who can post in this section?":"Kdo může přispívat do této sekce?","Only Admin":"Pouze Admin","Any user":"Jakýkoli uživatel","Sorting order for section":"Pořadí řazení pro sekci","Latest first":"Nejdříve nejnovější","Oldest post first":"Nejdříve nejstarší příspěvek","Section Appearance":"Sekce Vzhled","List View":"Zobrazení seznamu","Grid View":"Zobrazení mřížky","Make this closed section":"Udělejte tuto uzavřenou sekci","Members will have to request access to see section content":"Členové budou muset požádat o přístup, aby viděli obsah sekce","Make this a private section":"Udělejte z toho soukromou sekci","Disables requests (Make sure closed section is selected as well).":"Zakáže požadavky (ujistěte se, že je také vybrána uzavřená sekce).","Post Editor":"Editor příspěvků","Create new post in":"Vytvořit nový příspěvek v","Add Cover Picture":"Přidat titulní obrázek","Heading (Optional)":"Nadpis (volitelné)","Write here..":"Pište sem..",Picture:"Obrázek",Video:"Video",Attachment:"Příloha",Poll:"Hlasování","Embed Code":"Vložit kód",Tags:"Tagy","Toggle to question":"Přepnout na otázku","Poll expire time":"Čas vypršení platnosti ankety","Poll question":"Anketní otázka","Enter Question":"Zadejte otázku",Question:"Otázka",Option:"Volba",Options:"Možnosti","Add Option":"Přidat možnost","Poll Expiry time":"Čas vypršení platnosti ankety","12 Hours":"12 hodin","1 Day":"1 den","2 Days":"2 dny","1 Week":"1 týden","2 Weeks":"2 týdny","Always Open":"Vždy otevřeno","Write embeddable code":"Napište vložitelný kód","Click here to add embed code.":"Kliknutím sem přidáte kód pro vložení.","Paste your embed code here!":"Sem vložte svůj kód pro vložení!","Post Settings":"Nastavení příspěvku","Update Post":"Aktualizovat příspěvek",Update:"Aktualizovat","Start meeting / Video call / Live":"Zahájit schůzku / Videohovor / Živě","Meeting Name":"Název schůzky","Suggestion: Group discussion etc":"Návrh: Skupinová diskuse atd",Description:"Popis","Enter description here (optional)":"Zde zadejte popis (volitelné)","When do you want to start the session":"Kdy chcete zahájit relaci","Right now":"Právě teď","Schedule for later":"Plán na později","Group video call":"Skupinový videohovor",Webinar:"Webinář","Go Live":"Přejít na živo","Go live":"Přejít na živo","Info on the Post":"Info na Postu","Post comment":"Přidat komentář",Comment:"Komentář",Comments:"Komentáře",Reply:"Odpověď",Replies:"Odpovědi","Share via URL":"Sdílejte prostřednictvím adresy URL","Reshare in other sections":"Sdílejte dál v jiných sekcích","Post Card Drop Down":"Pohlednice Rozbalovací",Bookmark:"Záložka","Pin post":"Připnout příspěvek",Edit:"Upravit","Embed Post":"Vložit příspěvek",Delete:"Vymazat","Remove Pin":"Odebrat špendlík","Remove Bookmark":"Odebrat záložku","Just copy paste this code wherever you want it to be embedded":"Stačí zkopírovat a vložit tento kód kamkoli chcete, aby byl vložen",Height:"Výška",Preview:"Náhled","Copied to clipboard":"Zkopírováno do schránky","Select Widgets":"Vyberte Widgety","Add widgets to":"Přidejte widgety do","You can change their order by dragging & dropping the widgets over each other":"Jejich pořadí můžete změnit přetažením widgetů přes sebe","Please note: Widget wont be displayed if there is no data available,":"Poznámka: Widget se nezobrazí, pokud nejsou k dispozici žádná data,","Group Members":"Členové skupiny","Group Leaderboard":"Žebříček skupiny","Community Leaderboard":"Žebříček komunity","Trending Posts":"Populární příspěvky","Group Events":"Skupinové akce","Add Custom":"Přidat vlastní","Save Widgets":"Uložit widgety","Visible to user":"Viditelné pro uživatele","Visible to admin":"Viditelné pro správce","Add widget to":"Přidat widget do","Upload cover picture":"Nahrajte titulní obrázek","1:1 aspect ration (recommended)":"Poměr stran 1:1 (doporučeno)","Card Title":"Název karty","Enter widget name":"Zadejte název widgetu","Small Description (try to keep it under 50 words)":"Malý popis (snažte se ho udržet pod 50 slovy)","Enter description":"Zadejte popis","Button Title":"Název tlačítka","Enter button name":"Zadejte název tlačítka","Siggestion: Know more, Join, Apply, etc":"Nápis: Zjistěte více, připojte se, přihlaste se atd","URL link":"URL odkaz","Create custom widget":"Vytvořte si vlastní widget","Custom widget created successfully":"Vlastní widget byl úspěšně vytvořen",Widgets:"Widgety",Members:"členové","See All":"Zobrazit vše","Communtiy Top Contributors":"Hlavní přispěvatelé komunity","Community members":"Členové komunity","Group Top Contributors":"Hlavní přispěvatelé skupiny","Upcoming Events":"Nadcházející události","Home Page Banner":"Banner domovské stránky","Edit Banner":"Upravit banner","Home page Edit Banner Pop up":"Úvodní stránka Upravit vyskakovací banner","Update Banner":"Aktualizovat banner",Search:"Vyhledávání","Upload Image":"Nahrát obrázek",Remove:"Odstranit","Banner image (please use 16:6 ratio or 1600px by 600px image for the best view)":"Obrázek banneru (pro nejlepší zobrazení použijte poměr 16:6 nebo obrázek 1600 x 600 pixelů)","Banner Title":"Název banneru","Enter here":"Vstupte sem","Suggestion: Welcome to my community etc":"Návrh: Vítejte v mé komunitě atd","Banner Description":"Popis banneru","Enter banner description":"Zadejte popis banneru","Save Banner Info":"Uložit informace o banneru","Home Page Feed":"Zdroj domovské stránky",Recent:"Nedávné","Top posts":"Nejlepší příspěvky",Trending:"Trendy","Home Feed Groups":"Domácí skupiny zdrojů","":"#VALUE!","My profile":"Můj profil",Logout:"Odhlášení",Notification:"Oznámení",Notifications:"Oznámení","Mark all viewed":"Označit všechny prohlížené","has created a post":"Uživatel vytvořil příspěvek","wants to join":"se chce připojit","has commented on your post":"přidal komentář k vašemu příspěvku","has replied to your comment":"Uživatel odpověděl na váš komentář","Search for tags":"Hledejte značky","All groups":"Všechny skupiny","Search result":"Výsledek hledání","No post found for selected hashtag":"Pro vybraný hashtag nebyl nalezen žádný příspěvek","Start a conversation":"Zahajte konverzaci","Search by name":"Hledat podle jména",Upcoming:"Nadcházející",UPCOMING:"NADCHÁZEJÍCÍ",Past:"Minulost",PAST:"MINULOST","No upcoming events":"Žádné nadcházející události","Create event popup":"Vytvořit vyskakovací okno události","Event details":"Podrobnosti o události","16:9 aspect ratio":"Poměr stran 16:9","Event name":"Název události","Enter event name":"Zadejte název události","Host Name":"Název hostitele","You will be made host if none selected":"Pokud žádný nevyberete, stanete se hostitelem","Write here...":"Pište sem...","No. of registration for the event":"Číslo registrace na akci",Unlimited:"Neomezený","When & where":"Kdy & kde",From:"Z","Start date":"Datum zahájení",time:"čas",To:"Na","End date":"Datum ukončení","Current time zone:":"Aktuální časové pásmo:","Can be updated from the communtiy setting":"Lze aktualizovat z nastavení komunity","Online event":"Online akce","Add meeting link":"Přidat odkaz na schůzku","Meeting link will be generated once event is created":"Odkaz na schůzku bude vygenerován po vytvoření události",Venue:"Místo","Enter address":"Zadejte adresu",Create:"Vytvořit",Invite:"Pozvat","Share event via link":"Sdílejte událost prostřednictvím odkazu",Copy__1:"Kopie","Select section to post this event":"Vyberte sekci pro přidání této události","Once posted, members of that group or section will recieve an notification":"Po zveřejnění obdrží členové této skupiny nebo sekce upozornění",Post:"Zveřejnit",RSVP:"RSVP","Book Event":"Knižní akce","Yes, I'll attend":"Ano, zúčastním se","May be":"Může být","No, I won't attend":"Ne, nezúčastním se","Date & Time":"Datum a čas",Host:"Hostitel","Online meeting":"Online setkání","Meeting link will be visible once registered for the event":"Odkaz na schůzku se zobrazí po registraci na událost","User Management":"Správa uživatelů","Go bac to community":"Vraťte se do komunity","Manage Members":"Spravovat členy",Member:"Člen",Invited:"Pozvaný","Search for member":"Hledat člena","Add to group":"Přidat do skupiny","Send Direct Message":"Odeslat přímou zprávu","Change role":"Změnit roli","Kick from community":"Vyhodit z komunity","Super Admin":"Super správce","Super admin will have full access to the communtiy settings":"Superadmin bude mít plný přístup k nastavení komunity","Group Admin":"Správce skupiny","Admin of the selected group can edit the group information and create, edt or delete section under selected group":"Správce vybrané skupiny může upravovat informace o skupině a vytvářet, upravovat nebo mazat sekci pod vybranou skupinou","Group Moderator":"Moderátor skupiny","Group moderator can create or delete post, comment, reply & messages in the selected group.":"Moderátor skupiny může vytvářet nebo mazat příspěvky, komentáře, odpovědi a zprávy ve vybrané skupině.",User:"Uživatel",Save:"Uložit","User role updated successfully":"Uživatelská role byla úspěšně aktualizována",Leaderboard:"Žebříček","Click on the column header for sorting":"Pro řazení klikněte na záhlaví sloupce",Rank:"Pořadí","Karma Points":"Body karmy","Custom Points":"Vlastní body",Follow:"Následovat",Upvotes:"Hlasy pro",Posts:"Příspěvky","Add custom points":"Přidejte vlastní body","Subtract custom points":"Odečtěte vlastní body","Enter no. of points":"Zadejte č. bodů","Add points":"Přidejte body","Invite members to":"Pozvat členy do","Invite via link":"Pozvat přes odkaz","Invite via email":"Pozvat e-mailem","Add more":"Přidejte další","Upload a CSV":"Nahrajte soubor CSV","Please upload a comma-seprated CSV file, with header as name, email.":"Nahrajte prosím soubor CSV oddělený čárkami se záhlavím jako jméno, e-mail.","Here is a template CSV file":"Zde je šablona souboru CSV","Upload File":"Nahrát soubor","Send Invite":"Odeslat pozvánku","Mail Template":"Šablona pošty","Send Test Mail":"Odeslat zkušební e-mail",Hey:"Hej","A has invite you to join the B":"A vás zve, abyste se připojili k B","Switch to rich text editor":"Přepnout do editoru formátovaného textu","Add Custom Message":"Přidat vlastní zprávu","Enter message here":"Zde zadejte zprávu","Send Bulk Mail":"Poslat hromadnou poštu","Send Mail":"Odeslat poštu","Send bulk mail to all community members or select group members":"Odešlete hromadnou poštu všem členům komunity nebo vybraným členům skupiny",Date:"Datum",Subject:"Podrobit",Recipients:"Příjemci","1000 bulk emails remaining for this month. Resets on <date>":"Pro tento měsíc zbývá 1000 hromadných e-mailů. Resetuje se dne <datum>",Everyone:"Každý","Enter mail subject":"Zadejte předmět e-mailu","Write message":"Napište zprávu",Cancel__1:"Zrušit",Send:"Poslat",__1:"#VALUE!",Activity:"Aktivita",Bookmarks:"Záložky","Edit profile":"Upravit profil",Unsubscribe:"Odhlásit odběr","Settings (Account)":"Nastavení (účet)",Profile:"Profil","Set Profile Picture":"Nastavit obrázek profilu","Your name":"Vaše jméno","User ID":"ID uživatele","Short bio":"Krátký životopis","Link your social account":"Propojte svůj sociální účet","This will be displayed on your profile":"To se zobrazí na vašem profilu","Add social handle":"Přidat sociální úchyt",Verification:"Ověření","Account Verification":"Ověření účtu",Email:"E-mail","Enter email":"Zadejte email",Verified:"Ověřeno",Unverified:"Neověřeno",Change:"Přeměna",Unlink:"Odpojit",Mobile:"Mobilní","enter mobile no.":"zadejte č. mobilu","Request OTP":"Vyžádejte si OTP","Manage your personal account notification preferences":"Spravujte předvolby oznámení o svém osobním účtu",Prefrences:"Předvolby","Email notification":"Upozornění e-mailem","Notify me about comments on my posts":"Informujte mě o komentářích k mým příspěvkům","Notify me about replies on my comments":"Informujte mě o odpovědích na mé komentáře","Notify me about likes on my posts":"Upozorňovat mě na lajky u mých příspěvků","Notify me about reaction on my comments":"Informujte mě o reakci na mé komentáře","Notify me about reaction on my reply":"Informujte mě o reakci na mou odpověď","Notify me about direct message":"Informujte mě o přímé zprávě","Notify me about my mentions":"Informujte mě o mých zmínkách","Notification for new posts":"Upozornění na nové příspěvky","Only group & section available which you are part of":"K dispozici je pouze skupina a sekce, které jste součástí","Group & Section":"Skupina a sekce","All activity":"Veškerá činnost","Post by admin":"Příspěvek od admina","No Notification":"Žádné oznámení","Setting (Community)":"Nastavení (komunita)","General Settings":"Obecná nastavení","Upload community logo":"Nahrajte logo komunity","Community name":"Název komunity","Invalid field":"Neplatné pole","Your community address":"Adresa vaší komunity","Fav icon":"Oblíbená ikona","This will be visible on the browser tab (32px by 32px)":"Toto bude viditelné na kartě prohlížeče (32 x 32 pixelů)",TimeZone:"Časové pásmo","Privacy Policy on login page":"Zásady ochrany osobních údajů na přihlašovací stránce","Terms & Condition on login page":"Podmínky na přihlašovací stránce","Enter link here":"Zde zadejte odkaz","Open Group Image":"Otevřete obrázek skupiny","By default ir takes up the community banner uploaded with the communtiy":"Ve výchozím nastavení zabírá banner komunity nahraný s komunitou","Community Experience":"Zkušenosti komunity",Onboarding:"Registrace","Member Fields":"Pole členů","Make your community private":"Udělejte svou komunitu soukromou","Users will have to login or sign up to access the community":"Uživatelé se budou muset přihlásit nebo zaregistrovat pro přístup do komunity","Make account verification mandatory for both email & mobile":"Zaveďte ověření účtu jako povinné pro e-mail i mobilní zařízení","New user will have to verify both email & mobile no. to access the community":"Nový uživatel bude muset ověřit e-mail i číslo mobilního telefonu. pro přístup ke komunitě","Admin will also have to verify their mobile no. & email or else they won't be able to access the community":"Admin bude také muset ověřit své mobilní číslo. a e-mailem, jinak nebudou mít přístup ke komunitě","Gated community access":"Uzavřený komunitní přístup","Admin will have to approve or reject user's requests to join the community":"Admin bude muset schválit nebo zamítnout žádosti uživatele o připojení ke komunitě","Disable mobile login/register":"Zakázat mobilní přihlášení/registraci","Disable email login/register":"Zakázat e-mailové přihlášení/registraci","Disable google login/register":"Zakázat přihlášení/registraci Google","Disable facebook login/register":"Zakázat přihlášení/registraci na facebooku","Show & Hide features":"Zobrazit a skrýt funkce","Hide direct chat":"Skrýt přímý chat","User will not be able to send direct messages to each other":"Uživatel si nebude moci posílat přímé zprávy","Hide profile picture from top right corner for mobile responsive view":"Skryjte profilový obrázek v pravém horním rohu pro zobrazení responzivní pro mobilní zařízení","Useful when using community in an in app browser":"Užitečné při používání komunity v prohlížeči v aplikaci","Hide profile picture from top right corner in every view":"Skrýt profilový obrázek z pravého horního rohu v každém zobrazení","Disable header dropdown on profile picture":"Zakázat rozevírací seznam záhlaví na profilovém obrázku","Useful for integrated community, especially using SSO":"Užitečné pro integrovanou komunitu, zejména pomocí SSO","Hide the communtiy logo from the header":"Skryjte logo komunity v záhlaví","Hide the communtiy title from the header":"Skryjte název komunity v záhlaví","Show collpased group in the side nav bar":"Zobrazit sbalenou skupinu na bočním navigačním panelu","Show full expanded post in the home feed":"Zobrazit celý rozbalený příspěvek na domovské stránce","Hide the leaderboard score from the header":"Skryjte skóre výsledkové tabulky v záhlaví","Show powered by SpatialChat Communities":"Show powered by SpatialChat Communities","Hide closed groups if not joined":"Skryjte uzavřené skupiny, pokud nejste připojeni","Closed groups would not be shown to the user if they are not a member of the group":"Uzavřené skupiny se uživateli nezobrazí, pokud nejsou členem skupiny","Hide Community subscriber count from the users":"Skrýt před uživateli počet odběratelů komunity","This will hide the community subscriber list in the community header":"Tím se skryje seznam odběratelů komunity v záhlaví komunity","Disable Communtiy Switcher":"Deaktivujte přepínač Communtiy","Use MD editor for create post description":"Pro vytvoření popisu příspěvku použijte editor MD","Non logged in user will land on explore group page instead of post directory":"Nepřihlášený uživatel se dostane na stránku skupiny prozkoumat místo do adresáře příspěvků","Advanced configurable":"Pokročilé konfigurovatelné","Communtiy default country code":"Výchozí kód země komunity","This will show up by default on login/signup":"To se zobrazí ve výchozím nastavení při přihlášení/registraci","Onboarding/Welcome Message":"Vstupní/uvítací zpráva","Welcome Message":"Uvítací zpráva","Greet your members with personalized message":"Pozdravte své členy personalizovanou zprávou","Welcome to":"Vítejte na",Message:"Zpráva","Add message":"Přidat zprávu","Custom domain":"Vlastní doména","Add custom domain":"Přidat vlastní doménu","Create new request":"Vytvořte nový požadavek","Enter your custom domain":"Zadejte svou vlastní doménu","Setup details":"Podrobnosti o nastavení","Add a CNAME record in your domain pointing to this community's address":"Přidejte záznam CNAME ve své doméně odkazující na adresu této komunity","To configure your domain, you'll need to add a CNAME record pointing your domain to your pensil community URL":"Chcete-li nakonfigurovat svou doménu, budete muset přidat záznam CNAME, který odkazuje vaši doménu na adresu URL vaší komunity pensil","Step by Step help apge":"Nápověda krok za krokem apge","All request list":"Seznam všech požadavků","Allow admin to assign/un-assign custom points to users":"Povolit správci přiřazovat/zrušit přidělování vlastních bodů uživatelům","Base points for user to begin with":"Základní body pro uživatele pro začátek","Base points will be updated for all the users, any changes will reflect for all the users.":"Základní body budou aktualizovány pro všechny uživatele, jakékoli změny se projeví u všech uživatelů.","Allocate points for interaction":"Přidělujte body za interakci","Upvoting post":"Hlasující příspěvek","creating a comment":"vytvoření komentáře","creating a reply":"vytvoření odpovědi","Getting upvote to their post":"Získání hlasu pro jejich příspěvek","Getting comment to their post":"Získávání komentáře k jejich příspěvku","Getting reply to their comment":"Získání odpovědi na jejich komentář","Creating a post":"Vytvoření příspěvku",Visiblity:"Viditelnost","Move Up":"Posunout nahoru","Move Down":"Přesunout dolů","Create embedded section":"Vytvořte vloženou sekci","Preview area":"Oblast náhledu","Theme selector":"Volič motivu","Community Theme":"Téma komunity","Select theme":"Vyberte téma","Select brand color":"Vyberte barvu značky","Customize your button color to match your brand":"Přizpůsobte si barvu tlačítka tak, aby odpovídala vaší značce","Select on button text color":"Vyberte barvu textu tlačítka","Suggestion: Keep inverted contrast against brand color":"Návrh: Zachovejte obrácený kontrast proti barvě značky",Billing:"Fakturace","Current plan":"Aktuální plán","You are current on Free PLan":"Jste aktuální na Free Plan","Renew on: NA":"Prodloužit dne: NA",Select:"Vybrat","Email us at":"Napište nám na adresu","Compare plan":"Porovnejte plán","API Keys":"Klíče API","Create new key":"Vytvořte nový klíč","Total keys":"Celkem klíčů","Keep your API keys safe! You can use them to access specific feature & let cetain apps perfrom certain actions on your behalf on the platform.":"Udržujte své API klíče v bezpečí! Můžete je použít k přístupu ke konkrétní funkci a umožnit některým aplikacím provádět určité akce vaším jménem na platformě.","Key name":"Název klíče","Key value":"Hodnota klíče",Action:"Akce","Group updated!":"Skupina aktualizována!","Are you sure you want to":"Jste si jistý, že chcete?","Make Moderator":"Udělejte si moderátora","Remove from group":"Odebrat ze skupiny","Show All":"Zobrazit vše","Change Role":"Změnit roli",Close:"Blízko",copy:"kopie",LINKS:"ODKAZY","Email Id":"ID e-mailu",Name:"Jméno","Search for an image":"Vyhledejte obrázek","Crop Image":"Oříznout obrázek","No photos found":"Nebyly nalezeny žádné fotografie",Community:"Společenství","Banner ratio - 16:9":"Poměr bannerů - 16:9","Banner Ratio - 16:6":"Poměr bannerů – 16:6","Share on mail":"Sdílet na mail","Share on Telegram":"Sdílejte na Telegramu","Share on Whatsapp":"Sdílejte na Whatsapp","Share on Linkedin":"Sdílet na Linkedin","Share on Facebook":"Sdílejte na Facebooku","Share on Twitter":"Sdílejte na Twitteru","Pin Post":"Připnout příspěvek","Heading (optional)":"Nadpis (volitelné)","Select section":"Vyberte sekci",Gif:"Gif","Create Custom Widget":"Vytvořit vlastní widget","Are you sure you want to delete this widget?":"Opravdu chcete tento widget smazat?","Go to event":"Přejít na událost","Add Tags":"Přidat značky","Create Tag":"Vytvořit značku","Title (Optional)":"Název (volitelné)","Search Gif":"Hledat Gif","What's on your mind":"Co máš na srdci","Looks like nothing available here right now.":"Zdá se, že tu momentálně není nic k dispozici.","Try exploring other tabs":"Zkuste prozkoumat další karty","Delete Widget":"Smazat widget","Please select a section to post":"Vyberte prosím sekci, kterou chcete zveřejnit","Post added successfully!":"Příspěvek byl úspěšně přidán!","Failed to create post. Please check post content and retry again.":"Příspěvek se nepodařilo vytvořit. Zkontrolujte obsah příspěvku a zkuste to znovu.","Are you sure you want to discard current post?":"Opravdu chcete zahodit aktuální příspěvek?","By default it will take up the image uploaded with the post":"Ve výchozím nastavení zabere obrázek nahraný s příspěvkem","Quiz can be only viewed and attempted from mobile device right now!":"Kvíz lze právě teď zobrazit a vyzkoušet pouze z mobilního zařízení!","Community Banner":"Banner komunity","Change Cover":"Vyměňte kryt","Suggestions: Welcome to my community etc":"Návrhy: Vítejte v mé komunitě atd","(edited)":"(upraveno)","Aspect ratio (recommended)":"Poměr stran (doporučeno)","Banner details updated!":"Podrobnosti banneru aktualizovány!","Refresh if changes are not visible!":"Aktualizujte, pokud změny nejsou viditelné!","Banner details could not be updated!":"Podrobnosti banneru se nepodařilo aktualizovat!","Post deleted":"Příspěvek smazán","Post not available. It may have been deleted.":"Příspěvek není dostupný. Možná byla smazána.",Admin:"Admin",Moderator:"Moderátor","Bookmark added!":"Přidána záložka!","Bookmark removed":"Záložka byla odstraněna","Failed performing action!":"Neúspěšné provedení akce!","Copy this link to share on other platforms":"Zkopírujte tento odkaz pro sdílení na jiných platformách","View this event":"Zobrazit tuto událost",Event:"Událost","Join Meeting":"Připojte se ke schůzce","The live meeting has ended":"Živé setkání skončilo","read more...":"číst více...","Load more comments":"Načíst další komentáře","Post Reply":"Odeslat odpověď","Post Comment":"Přidat komentář",more:"více",upvoted:"souhlasil","1 Upvote":"1 hlas pro","1 Comment":"1 komentář","Please enter a title":"Zadejte název","Please enter a url link":"Zadejte odkaz URL","Please enter button title":"Zadejte název tlačítka","Button label must be at least 20 characters":"Popisek tlačítka musí mít alespoň 20 znaků","Please enter valid url":"Zadejte prosím platnou adresu URL","Suggestions: Know more, Join, Apply...":"Návrhy: Zjistěte více, připojte se, přihlaste se...",URL:"URL","Community Events":"Komunitní akce","Widget deleted successfully":"Widget byl úspěšně smazán","Community Top Contributors":"Hlavní přispěvatelé komunity",points:"body","Points cannot be greater than current points":"Body nemohou být větší než aktuální body","Point cannot be a negative value":"Bod nemůže být záporná hodnota","Point cannot be a decimal point":"Tečka nemůže být desetinná čárka","Please enter a valid number":"Zadejte prosím platné číslo","Karma points updated successfully":"Body karmy byly úspěšně aktualizovány","Error in updating karma points":"Chyba při aktualizaci bodů karmy","Add karma points":"Přidejte body karmy","Minus karma points":"Minus body karmy","Total Karma points:":"Celkový počet bodů karmy:","Enter no. of karma points":"Zadejte č. bodů karmy","Minus Points":"Mínusové body","Trending Post":"Trendy příspěvek","No visible description":"Žádný viditelný popis","Picture ratio: 1:1":"Poměr obrazu: 1:1","home feed":"domácí krmivo","Event name is invalid!":"Název události je neplatný!",custom:"zvyk","Custom widget updated successfully":"Vlastní widget byl úspěšně aktualizován","Name invalid!":"Jméno je neplatné!","Current timezone:":"Aktuální časové pásmo:","can be updated from community settings":"lze aktualizovat z nastavení komunity","Event created successfully":"Událost byla úspěšně vytvořena","Error in creating event":"Chyba při vytváření události",Attendees:"Účastníci","Do you wish to notify these changes to attendees?":"Přejete si oznámit tyto změny účastníkům?","users wants to attend this event":"uživatelé se chtějí této události zúčastnit","Yes, Notify them":"Ano, upozornit je","No, its okay":"Ne, to je v pořádku","Do you wish to notify that event is cancelled?":"Přejete si oznámit, že akce je zrušena?","Are you sure you want to delete the event?":"Opravdu chcete událost smazat?","Delete Event":"Smazat událost","New Event":"Nová událost","Accept Invitation":"Přijměte pozvání",Requested:"Vyžádáno",Declined:"Odmítnuto","Request Access":"Žádost o přístup","Enroll for":"Zaregistrujte se pro",Housefull:"Dům plný","Just copy paste this code wherever you want it to be embedded:":"Stačí zkopírovat a vložit tento kód kamkoli ho chcete vložit:",Ended:"Skončilo","Error getting events":"Chyba při získávání událostí","Events could not be fetched!":"Události se nepodařilo načíst!","Show Attendees":"Zobrazit účastníky",Subscribers:"Předplatitelé","Make this a closed section":"Udělejte z toho uzavřenou sekci","Update Section":"Aktualizovat sekci","Valid section name required!":"Je vyžadován platný název sekce!","Enter section name":"Zadejte název sekce","Community Admin":"Správce komunity",Embed:"Vložit","Invite to":"Pozvat na","Please enter a valid email address":"Zadejte prosím platnou e-mailovou adresu","Invitation sent successfully":"Pozvánka byla úspěšně odeslána","Error sending invitation":"Chyba při odesílání pozvánky","Email is not valid!":"Email není platný!","Data could not be loaded!":"Data se nepodařilo načíst!","Posted in":"Publikováno v","Invite Members Individually":"Pozvat členy jednotlivě","Start a discussion":"Zahájit diskuzi","Post something":"Zveřejněte něco","Invite your audience":"Pozvěte své publikum","Choose Plan":"Vyberte Plán",or:"nebo","Create a link":"Vytvořte odkaz","Add link":"Přidat odkaz","Update link":"Aktualizovat odkaz","Add shortcut to your most used tools":"Přidejte zástupce k nejpoužívanějším nástrojům","Your website, Instagram Channel, Facebook profile etc":"Váš web, instagramový kanál, facebookový profil atd","Valid link name required!":"Je vyžadován platný název odkazu!","Valid url required, and make sure you are not missing http:// or https://":"Je vyžadována platná adresa URL a ujistěte se, že vám nechybí http:// nebo https://","Invite to__1":"Pozvat na","Link Name":"Název odkazu","Link URL":"URL odkazu","Could not subscribe to":"Nelze se přihlásit k odběru","Subscribed to":"Přihlášeno k odběru","By default it will take up the community banner uploaded with the community":"Ve výchozím nastavení zabere banner komunity nahraný s komunitou","Created by":"Vytvořil","Online Event (Meeting link will be visible once registered for the event)":"Online událost (odkaz na schůzku se zobrazí po registraci na událost)","Join Call":"Připojte se k hovoru","Please login to book this event":"Pro rezervaci této akce se prosím přihlaste","Commented on":"Komentováno","Replied to":"Odpovězeno na","Looks like it's lonely here.":"Vypadá to, že je to tu osamělé.","Try exploring other sections and groups.":"Zkuste prozkoumat další sekce a skupiny.","Please proceed with the payment or contact admin to gain access to this group.":"Pokračujte prosím v platbě nebo kontaktujte administrátora, abyste získali přístup do této skupiny.","This is a closed group You'll need access to this group.":"Toto je uzavřená skupina. K této skupině budete potřebovat přístup.","You have no bookmarks right now.":"Momentálně nemáte žádné záložky.","The user hasn't posted anything yet publicly.":"Uživatel zatím nic veřejně nezveřejnil.","No activity to show.":"Žádná aktivita k zobrazení.","Are you sure you want to unsubscribe the community?":"Opravdu chcete zrušit odběr komunity?","deals left":"nabídky zbývají","Something went wrong while loading posts":"Při načítání příspěvků se něco pokazilo","Could not unsubscribe from":"Z odběru se nepodařilo odhlásit","Unsubscribed from":"Odhlášeno z odběru","Login to view this page":"Pro zobrazení této stránky se přihlaste",Login:"Přihlášení","There was some error while doing the action!":"Při provádění akce došlo k nějaké chybě!","Unable to delete section!":"Sekci nelze smazat!",__2:"",__3:"",__4:"","Home page":"Domovská stránka","Members Directory":"Adresář členů",Calendar:"Kalendář","Create Group":"Vytvořit skupinu","Start Live Session":"Spusťte živou relaci",Home__1:"Domov",Following:"Následující",__5:"","Post Card":"Pohlednice",Like:"Jako",Comment__1:"Komentář",Comment__2:"Komentář",Share__1:"Podíl",Report:"Zpráva","Follow User":"Sledovat uživatele","Report User":"Nahlásit uživatele","Report Post":"Nahlásit příspěvek",__6:"","LeaderBoard Floating pop up":"Vyskakovací plovoucí žebříček","Go to leaderboard":"Přejít na výsledkovou tabulku","Total karma points":"Celkový počet bodů karmy",Comments__1:"Komentáře",Upvotes__1:"Hlasy pro",Replies__1:"Odpovědi",Post__1:"Zveřejnit","Custom Points__1":"Vlastní body","Base Points":"Základní body",__7:"",Channel:"Kanál","This is a private channel":"Toto je soukromý kanál","You'll need access to this channel":"Budete potřebovat přístup k tomuto kanálu",__8:"","Profile Page":"Stránka profilu",Followers:"Následovníci",Activities:"Činnosti",__9:"","Settings Page":"Stránka nastavení","Go back to community":"Vraťte se do komunity",Account:"Účet","Notification Centre":"Oznamovací centrum",__10:"","Edit Profile Page":"Upravit stránku profilu","Set profile Picture":"Nastavit profilový obrázek","Your name__1":"Vaše jméno",Subtitle:"Titulky","(Max char 60)":"(Max 60 znaků)","User Id":"ID uživatele","Short Bio":"Krátký životopis","Link For Social Account":"Odkaz pro sociální účet","This will be displayed on your profile__1":"To se zobrazí na vašem profilu","Add Social handles":"Přidejte sociální úchyty",__11:"","Verification Page":"Ověřovací stránka",Email__1:"E-mail",Verified__1:"Ověřeno",__12:"","Manage your personal account notification preferences__1":"Spravujte předvolby oznámení o svém osobním účtu",Preferences:"Předvolby","Email Notification":"Upozornění e-mailem","Notify me about comment on my posts":"Informujte mě o komentářích k mým příspěvkům","Notify me about replies on my comment":"Informujte mě o odpovědích na můj komentář","Notify me about upvote on my post":"Informujte mě o kladném hlasování u mého příspěvku","Notify me about reaction to my comment":"Informujte mě o reakci na můj komentář","Notify me about reaction on my reply__1":"Informujte mě o reakci na mou odpověď","Notify me about direct message__1":"Informujte mě o přímé zprávě","Notify me about mentions":"Informujte mě o zmínkách","Notification for new posts__1":"Upozornění na nové příspěvky","Only groups and channel available which you are part of. You can also control notification":"K dispozici jsou pouze skupiny a kanál, kterých jste součástí. Můžete také ovládat oznámení","Group & Channels":"Skupina a kanály","All Activity":"Veškerá činnost","Post by admin__1":"Příspěvek od admina","No Notification__1":"Žádné oznámení",__13:"","Direct Message__1":"Přímá zpráva",Inbox:"Doručená pošta","No chats found":"Nebyly nalezeny žádné chaty",__14:"","Create Post Popup":"Vytvořit vyskakovací okno příspěvku","Create Post in":"Vytvořit příspěvek v","Select Channel":"Vyberte Kanál",__15:"","Dark mode":"Tmavý režim",Feed:"Kanál",Saved:"Uloženo",Workflows:"Pracovní postupy",Rewards:"Odměny",Networking:"Networking",Course:"Kurz","Member Directory":"Adresář členů","Email Marketing":"E-mailový marketing",Analytics:"Analytika","Log out":"Odhlásit se","Switch community":"Přepnout komunitu",Support:"Podpora","Select topic":"Vybrat téma","Featured Posts":"Doporučené příspěvky","Featured posts":"Doporučené příspěvky",Courses:"Kurzy","Explore courses and learning paths in your community.":"Prozkoumej kurzy a výukové cesty ve své komunitě.","Add course":"Přidat kurz","Search title, description, or creator…":"Hledej podle názvu, popisu nebo autora…","Search courses":"Hledat kurzy","Clear search":"Vymazat hledání","Filter courses":"Filtrovat kurzy","Sort courses":"Seřadit kurzy","Clear filters":"Zrušit filtry","{count} course":"{count} kurz","{count} courses":"{count} kurzů",Updating:"Aktualizace","Could not load courses":"Kurzy se nepodařilo načíst","Something went wrong. Please try again.":"Něco se pokazilo. Zkus to prosím znovu.",Retry:"Zkusit znovu","No courses found":"Žádné kurzy nenalezeny","Try another search term or change the filter.":"Zkus jiný hledaný výraz nebo změň filtr.","No courses available":"Žádné dostupné kurzy","Create the first course for your community.":"Vytvoř první kurz pro svou komunitu.","Check back when new courses are published.":"Vrať se, až budou zveřejněny nové kurzy.","Showing {shown} of {total} course":"Zobrazen {shown} z {total} kurzu","Showing {shown} of {total} courses":"Zobrazeno {shown} z {total} kurzů","Show less":"Zobrazit méně","Read more":"Zobrazit více","Request sent":"Žádost odeslána","An admin will review your enrollment request.":"Správce zkontroluje tvou žádost o zápis.",Enrolled:"Zapsáno","You can start learning now.":"Můžeš začít studovat.","Something went wrong.":"Něco se pokazilo.","Could not join course":"Do kurzu se nepodařilo připojit","No lessons yet":"Zatím žádné lekce","Content will appear when lessons are published.":"Obsah se zobrazí, jakmile budou lekce zveřejněny.","Course deleted":"Kurz smazán","Could not delete course":"Kurz se nepodařilo smazat","Course duplicated":"Kurz zduplikován","The copy was created as a draft.":"Kopie byla vytvořena jako koncept.","Could not duplicate course":"Kurz se nepodařilo zduplikovat","Left course":"Kurz opuštěn","Could not leave course":"Kurz se nepodařilo opustit","Continue learning":"Pokračovat ve studiu","Buy now":"Koupit teď","Send request to enroll":"Odeslat žádost o zápis","Enroll now":"Zapsat se","Course not found":"Kurz nenalezen","This course may have been removed or you lack access.":"Tento kurz mohl být odstraněn, nebo k němu nemáš přístup.","Back to Courses":"Zpět na kurz","By {name}":"Autor: {name}","{count} lesson":"{count} lekce","{count} lessons":"{count} lekcí","Total time to complete":"Celkový čas na dokončení","Attached to {group}":"Přiřazeno ke skupině {group}",Progress:"Pokrok","{done}/{total} lessons · {percent}%":"{done}/{total} lekcí · {percent} %","Edit course":"Upravit kurz","Duplicate course":"Duplikovat kurz","Delete course":"Smazat kurz","Course access is included with your active paid access":"Přístup ke kurzu je součástí tvého aktivního placeného přístupu","Leave course":"Opustit kurz",Content:"Obsah","Quiz results":"Výsledky testů","Delete course?":"Smazat kurz?","All course content and member progress will be permanently removed.":"Veškerý obsah kurzu a pokrok členů budou trvale odstraněny.","Leave course?":"Opustit kurz?","You will lose access to lessons until you enroll again.":"Dokud se znovu nezapíšeš, přijdeš o přístup k lekcím.","Not enrolled":"Nezapsáno","Course content unlocks once you are enrolled. Request access or purchase membership if required.":"Obsah kurzu se odemkne po zápisu. V případě potřeby požádej o přístup nebo si kup členství.","Add section":"Přidat sekci","No content yet":"Zatím žádný obsah","Add a section to start building this course.":"Přidej sekci a začni tvořit tento kurz.","Content will be available when the course starts.":"Obsah bude dostupný po zahájení kurzu.","{count} comment":"{count} komentář","{count} comments":"{count} komentářů","No comments on this course yet.":"Tento kurz zatím nemá žádné komentáře.","Showing {from}-{to} of {total} comments":"Zobrazeno {from}–{to} z {total} komentářů",Lesson:"Lekce","Unlocks {date}":"Odemkne se {date}","{count} day after enrollment":"{count} den po zápisu","{count} days after enrollment":"{count} dní po zápisu","Releases {date}":"Zveřejnění {date}","Section deleted":"Sekce smazána","Could not delete section":"Sekci se nepodařilo smazat","Lesson updated":"Lekce aktualizována","Lesson added":"Lekce přidána","Could not save lesson":"Lekci se nepodařilo uložit","Lesson deleted":"Lekce smazána","Could not delete lesson":"Lekci se nepodařilo smazat","Lesson duplicated as draft":"Lekce zduplikována jako koncept","Could not duplicate lesson":"Lekci se nepodařilo zduplikovat","Total time for this section":"Celkový čas této sekce","Edit section":"Upravit sekci","Delete section":"Smazat sekci","Lessons will appear here once added.":"Lekce se zde zobrazí po jejich přidání.","Not released yet":"Zatím nezveřejněno","Complete the previous lesson first":"Nejdřív dokonči předchozí lekci","Time to complete":"Čas na dokončení","Actions for {title}":"Akce pro {title}","Edit lesson":"Upravit lekci","Duplicate lesson":"Duplikovat lekci","Delete lesson":"Smazat lekci",Add:"Přidat","Add lesson":"Přidat lekci","Delete section?":"Smazat sekci?",'This removes "{name}" and all lessons inside it.':"Tím se odstraní „{name}“ a všechny lekce v ní.","Delete lesson?":"Smazat lekci?",'This removes "{title}" permanently.':"Tím se „{title}“ trvale odstraní.","Lesson title":"Název lekce",Minutes:"Minuty","Time to complete, in minutes":"Čas na dokončení v minutách","How long this lesson takes, in minutes":"Jak dlouho lekce trvá, v minutách","Joined group":"Připojeno ke skupině","You're now in {group}. Enrolling you in the course…":"Jsi ve skupině {group}. Zapisuji tě do kurzu…","An admin will review your group request. After you're accepted you can enroll in the course.":"Správce zkontroluje tvou žádost o vstup do skupiny. Po schválení se můžeš zapsat do kurzu.","Could not join group":"Do skupiny se nepodařilo připojit","This course moved to {group}":"Tento kurz byl přesunut do skupiny {group}","Join {group} first":"Nejdřív se připoj ke skupině {group}","This course is now part of “{group}”. Join its new group to continue accessing the course.":"Tento kurz je nyní součástí skupiny „{group}“. Chceš-li mít ke kurzu dál přístup, připoj se k nové skupině.","This course belongs to “{group}”. Join the group before enrolling and starting the course.":"Tento kurz patří do skupiny „{group}“. Než se zapíšeš a začneš kurz, připoj se ke skupině.","Paid group access":"Placený přístup do skupiny","Membership required":"Vyžaduje se členství","Explore the available plans for {group}, choose the one that suits you, and return here after purchase to begin learning.":"Prohlédni si dostupné plány pro skupinu {group}, vyber ten, který ti vyhovuje, a po zakoupení se sem vrať a začni studovat.","Your request to join this group is already pending. You'll be able to enroll after an admin accepts it.":"Tvoje žádost o vstup do této skupiny už čeká na vyřízení. Zapsat se budeš moct po schválení správcem.","This is a {type} group. Continue to join instantly.":"Toto je skupina typu {type}. Pokračuj a připoj se okamžitě.","This is a {type} group. Continue to send a request to the group admins.":"Toto je skupina typu {type}. Pokračuj a odešli žádost správcům skupiny.","Explore group":"Prozkoumat skupinu","Join group":"Připojit se ke skupině","Request to join group":"Požádat o vstup do skupiny","You can watch this lecture now.":"Tuto přednášku už můžeš sledovat.","Could not enroll":"Zápis se nepodařil","Want to view this lecture?":"Chceš si tuto přednášku zobrazit?","Your enrollment request is waiting for approval. You'll be able to watch this lecture after an admin accepts it.":"Tvoje žádost o zápis čeká na schválení. Po schválení správcem budeš moct tuto přednášku sledovat.","Enroll in {course} to watch this lecture and the rest of the course.":"Zapiš se do kurzu {course} a sleduj tuto přednášku i zbytek kurzu.","Back to course":"Zpět na kurz","Enroll to view lecture":"Zapsat se a zobrazit přednášku","Choose a membership plan that includes {course}.":"Vyber členský plán, který zahrnuje kurz {course}.",Subscribed:"Přihlášeno k odběru","Payment successful":"Platba proběhla úspěšně","You can now request access to this course.":"Teď můžeš požádat o přístup k tomuto kurzu.","Checkout failed":"Platba se nezdařila","Buy group access":"Koupit přístup do skupiny","No membership plans are linked to this group yet.":"K této skupině zatím nejsou přiřazeny žádné členské plány.","Membership plan":"Členský plán","Subscribe free":"Přihlásit se zdarma","{day} at {time}":"{day} v {time}","All courses":"Všechny kurzy",Published:"Zveřejněné",Drafts:"Koncepty","Default order":"Výchozí pořadí","Title A–Z":"Název A–Z","Shortest first":"Nejkratší první","Longest first":"Nejdelší první","Most lessons":"Nejvíce lekcí",Draft:"Koncept",Personal:"Osobní","Community member":"Člen komunity","Your browser does not support video playback.":"Tvůj prohlížeč nepodporuje přehrávání videa.","Audio resource":"Zvukový materiál","Listen without leaving the Knowledge Hub":"Poslouchej, aniž bys opustil Knowledge Hub","Your browser does not support audio playback.":"Tvůj prohlížeč nepodporuje přehrávání zvuku.","Attached files":"Přiložené soubory",FILE:"SOUBOR",Hide:"Skrýt",View:"Zobrazit",Download:"Stáhnout","Resource media":"Média materiálu",Audio:"Zvuk",Attachments:"Přílohy","About this resource":"O tomto materiálu","Saving your resource…":"Ukládám tvůj materiál…","Finishing the upload…":"Dokončuji nahrávání…","Uploading 1 file · {percent}%":"Nahrávám 1 soubor · {percent} %","Uploading {count} files · {percent}%":"Nahrávám {count} souborů · {percent} %","Remove {name}":"Odebrat {name}","Description cannot exceed {max} characters":"Popis nesmí přesáhnout {max} znaků","Your title":"Tvůj název","Add a cover image before publishing":"Před zveřejněním přidej úvodní obrázek","Resource updated":"Materiál aktualizován","Resource shared":"Materiál sdílen","Your changes are now live.":"Tvoje změny jsou nyní živé.","It is now available in the Knowledge Hub.":"Nyní je dostupný v Knowledge Hub.","Upload cancelled":"Nahrávání zrušeno","Nothing was saved. Your files are still in the form.":"Nic nebylo uloženo. Tvoje soubory jsou stále ve formuláři.","Could not update resource":"Materiál se nepodařilo aktualizovat","Could not share resource":"Materiál se nepodařilo sdílet","Please try again.":"Zkus to prosím znovu.","That file is not an image":"Tento soubor není obrázek","Choose a PNG, JPG or WebP for the cover.":"Jako úvodní obrázek vyber PNG, JPG nebo WebP.","Couldn't use that cover":"Tento úvodní obrázek nelze použít","Pick another one, or choose a picture of your own.":"Vyber jiný, nebo zvol vlastní obrázek.","Couldn't open the current cover":"Aktuální úvodní obrázek se nepodařilo otevřít","Choose the image again to crop it.":"Vyber obrázek znovu a ořízni ho.","Video too large":"Video je příliš velké","Videos can be up to {limit}.":"Videa mohou mít až {limit}.","That file is not audio":"Tento soubor není zvuk","Choose an MP3, M4A, WAV or other audio file.":"Vyber MP3, M4A, WAV nebo jiný zvukový soubor.","Audio too large":"Zvuk je příliš velký","Audio files can be up to {size} MB.":"Zvukové soubory mohou mít až {size} MB.","File too large":"Soubor je příliš velký","{count} files too large":"Příliš velkých souborů: {count}",'"{name}" was not added. Files can be up to {limit}.':"„{name}“ nebyl přidán. Soubory mohou mít až {limit}.","{names} were not added. Files can be up to {size} MB ({videoLimit} for a video).":"{names} nebyly přidány. Soubory mohou mít až {size} MB ({videoLimit} u videa).","Up to 5 attachments":"Maximálně 5 příloh","Only the first {count} file was added.":"Byl přidán jen první {count} soubor.","Only the first {count} files were added.":"Bylo přidáno jen prvních {count} souborů.","Remove one to add another.":"Odeber jeden, abys mohl přidat další.","Edit resource":"Upravit materiál","Share a resource":"Sdílet materiál","Update your resource. Saved changes will appear immediately.":"Uprav svůj materiál. Uložené změny se projeví okamžitě.","Add a cover and a description, then optionally a video, an audio file and files to download.":"Přidej úvodní obrázek a popis, případně video, zvukový soubor a soubory ke stažení.",Details:"Podrobnosti","Cover image file":"Soubor úvodního obrázku","Video file":"Soubor videa","Audio file":"Zvukový soubor","Attachment files":"Soubory příloh","Cover image":"Úvodní obrázek","The picture on this resource's card in the library. It is not a download. After you pick a picture you choose which part to show, in the card's 16:9 shape, so nothing is cut off in the library. A large photo is resized before it is sent, so it uploads faster; the original on your device is not changed.":"Obrázek na kartě tohoto materiálu v knihovně. Nejde o soubor ke stažení. Po výběru obrázku určíš, kterou část zobrazit, v poměru 16:9 jako má karta, aby se v knihovně nic neuřízlo. Velká fotka se před odesláním zmenší, takže se nahraje rychleji; originál ve tvém zařízení zůstane beze změny.","Cover preview":"Náhled úvodního obrázku","Choose a cover image":"Vyber úvodní obrázek","PNG, JPG or WebP · you choose the part to show next":"PNG, JPG nebo WebP · část k zobrazení vybereš dále","Replace cover":"Nahradit úvodní obrázek","Remove cover":"Odebrat úvodní obrázek","Without a cover, the card shows a plain one in the community's colour.":"Bez úvodního obrázku karta zobrazí jednoduchý obrázek v barvě komunity.","Current cover":"Aktuální úvodní obrázek","Adjust crop":"Upravit ořez","No picture to hand? Use a ready-made cover":"Nemáš po ruce obrázek? Použij hotový úvodní obrázek","Cover subjects":"Témata úvodních obrázků","All ({count})":"Vše ({count})","Earlier covers":"Dřívější úvodní obrázky","Ready-made covers":"Hotové úvodní obrázky","Use the {name} cover":"Použít úvodní obrázek {name}","More covers":"Další úvodní obrázky",Title:"Název","What will members learn?":"Co se členové naučí?","Shorten the title to {max} characters or fewer.":"Zkrať název na {max} znaků nebo méně.","Share context, key takeaways, and why this is useful…":"Podej souvislosti, hlavní poznatky a proč je to užitečné…","Formatting counts toward the limit. Shorten the description to {max} characters or fewer.":"Formátování se počítá do limitu. Zkrať popis na {max} znaků nebo méně.","Media to play":"Média k přehrání","(optional)":"(volitelné)","Members watch or listen to these inside the resource.":"Členové je sledují nebo poslouchají přímo v materiálu.","· one video, up to {limit}, or a link":"· jedno video do {limit} nebo odkaz","Current uploaded video":"Aktuálně nahrané video","Already uploaded":"Již nahráno","Upload video":"Nahrát video","YouTube or Vimeo URL":"URL z YouTube nebo Vimeo","Enter a valid YouTube or Vimeo link.":"Zadej platný odkaz na YouTube nebo Vimeo.","· one audio file":"· jeden zvukový soubor","Current audio file":"Aktuální zvukový soubor","Upload audio":"Nahrát zvuk","Files to download":"Soubory ke stažení","PDFs, Word, Excel or any other file members can download · {count}/5":"PDF, Word, Excel nebo jakékoli jiné soubory ke stažení pro členy · {count}/5","Add files":"Přidat soubory","PDF preview":"Náhled PDF","PDF attachment preview":"Náhled přílohy PDF","This is how members will see your resource. Nothing is shared until you save.":"Takto uvidí tvůj materiál členové. Dokud neuložíš, nic se nesdílí.","This is how members will see your resource. Nothing is shared until you publish.":"Takto uvidí tvůj materiál členové. Dokud nezveřejníš, nic se nesdílí.","When opened":"Po otevření","In the library":"V knihovně","{done}/{total} done":"{done}/{total} hotovo","Upload progress":"Průběh nahrávání","Keep this window open until it finishes.":"Nech toto okno otevřené, dokud se nahrávání nedokončí.","Cancel upload":"Zrušit nahrávání","Save changes":"Uložit změny","Publish resource":"Zveřejnit materiál","Choose what shows on the cover":"Vyber, co se zobrazí na úvodním obrázku","Knowledge Hub":"Knowledge Hub","You created this resource.":"Tento materiál jsi vytvořil ty.","Moderator actions":"Akce moderátora","This file can't be previewed. Use Download instead.":"Tento soubor nelze zobrazit v náhledu. Použij raději stažení.","Resource deleted":"Materiál smazán","Could not delete resource":"Materiál se nepodařilo smazat","This resource is no longer available":"Tento materiál už není dostupný","Couldn't open that resource":"Tento materiál se nepodařilo otevřít","It may have been deleted. Here is the rest of the library.":"Možná byl smazán. Tady je zbytek knihovny.","Community library":"Komunitní knihovna","Useful ideas, explainers and media shared by your community.":"Užitečné nápady, vysvětlení a média sdílené tvou komunitou.","Search title, description, or author…":"Hledej podle názvu, popisu nebo autora…","Search Knowledge Hub resources":"Hledat materiály v Knowledge Hub","All content types":"Všechny typy obsahu","Any date":"Kdykoli","Past 7 days":"Posledních 7 dní","Past 30 days":"Posledních 30 dní","Past 90 days":"Posledních 90 dní","Custom dates":"Vlastní data","Sort resources":"Seřadit materiály","Newest first":"Nejnovější první","Most liked":"Nejoblíbenější","Could not load the Knowledge Hub":"Knowledge Hub se nepodařilo načíst","Please check your connection and try again.":"Zkontroluj připojení a zkus to znovu.","Build your community library":"Vybuduj knihovnu své komunity","Share the first useful guide, talk, or audio resource with everyone.":"Sdílej s ostatními první užitečný návod, přednášku nebo zvukový materiál.","Share the first resource":"Sdílet první materiál","No resources found":"Žádné materiály nenalezeny","Try another search term or change the filters.":"Zkus jiný hledaný výraz nebo změň filtry.","Showing {shown} of {total} resource":"Zobrazen {shown} z {total} materiálu","Showing {shown} of {total} resources":"Zobrazeno {shown} z {total} materiálů","Delete this resource?":"Smazat tento materiál?","“{title}” will be permanently removed from the Knowledge Hub. This action cannot be undone.":"„{title}“ bude trvale odstraněn z Knowledge Hub. Tuto akci nelze vrátit zpět.","Delete resource":"Smazat materiál","Remove your like":"Odebrat oblíbení","Like this resource":"Oblíbit tento materiál","You like this. Click to remove your like.":"Líbí se ti to. Kliknutím oblíbení odebereš.","Link copied":"Odkaz zkopírován","It opens this resource in the Knowledge Hub.":"Otevře tento materiál v Knowledge Hub.","Couldn't copy link":"Odkaz se nepodařilo zkopírovat","Post in review":"Příspěvek čeká na schválení","An admin will review it before it appears.":"Než se zobrazí, zkontroluje ho správce.",Shared:"Sdíleno","Posted to {channel}":"Zveřejněno v kanálu {channel}","Couldn't share the resource":"Materiál se nepodařilo sdílet","Copy link":"Kopírovat odkaz","Post to a channel":"Zveřejnit v kanálu","Send in a message":"Poslat ve zprávě","Posts “{title}” with a link that opens it in the Knowledge Hub.":"Zveřejní „{title}“ s odkazem, který ho otevře v Knowledge Hub.","Select channel":"Vybrat kanál","Add a message to introduce this to your community (optional). Type @ to mention someone.":"Přidejte zprávu, kterou to komunitě představíte (volitelné). Napište @ a někoho zmiňte.","Posting…":"Zveřejňuji…","Share it in a message. The link opens the resource in the Knowledge Hub.":"Sdílej to ve zprávě. Odkaz otevře materiál v Knowledge Hub.","{count} file":"{count} soubor","{count} files":"{count} souborů","Open {title} in the Knowledge Hub":"Otevřít {title} v Knowledge Hub","Like this course":"Oblíbit tento kurz","It opens this course's page.":"Otevře stránku tohoto kurzu.","Posts “{title}” as a card members can like and open. Enrolling works as it does on the course page.":"Zveřejní „{title}“ jako kartu, kterou si členové mohou oblíbit a otevřít. Zápis funguje stejně jako na stránce kurzu.","Couldn't share the course":"Kurz se nepodařilo sdílet","Share it in a message. The link opens the course's page.":"Sdílejte ho ve zprávě. Odkaz otevře stránku kurzu.","Open the course {title}":"Otevřít kurz {title}","Paid plan":"Placený plán","Unlock {feature}":"Odemkněte {feature}","Your current plan doesn't include it. Choose a plan to start using it.":"Váš současný plán to nezahrnuje. Vyberte si plán a začněte to používat.","Included in every paid plan, from {price}.":"Součást každého placeného plánu, od {price}.","Included in every paid plan.":"Součást každého placeného plánu.","See plans":"Zobrazit plány","Maybe later":"Možná později","Reach your members in their inbox with campaigns, newsletters, sequences, funnels and forms.":"Oslovte své členy v jejich e-mailové schránce kampaněmi, newslettery, sekvencemi, funnely a formuláři.","Send campaigns and newsletters to your audience":"Posílejte kampaně a newslettery svému publiku","Automated sequences, funnels and sign-up forms":"Automatické sekvence, funnely a registrační formuláře","Audience management and delivery analytics":"Správa publika a analýza doručování","Automate your community: act when members join, post or reach a milestone, without writing code.":"Automatizujte svou komunitu: reagujte, když se členové připojí, přidají příspěvek nebo dosáhnou milníku, bez psaní kódu.","Automations triggered by joins, posts, streaks and more":"Automatizace spouštěné připojením, příspěvky, sériemi a dalším","Multi-step actions: notify, tag, award points, send email":"Vícekrokové akce: upozornit, označit, udělit body, poslat e-mail","Ready-made templates to start in minutes":"Hotové šablony, se kterými začnete během pár minut","Member Analytics":"Analytika členů","See how each member uses your community: time spent, sessions and the pages they visit.":"Zjistěte, jak jednotliví členové používají vaši komunitu: strávený čas, relace a navštívené stránky.","Time spent and sessions for every member":"Strávený čas a relace každého člena","Page journeys: where members go and for how long":"Průchody stránkami: kam členové chodí a jak dlouho","Look up any member in Insights":"Vyhledejte libovolného člena v Přehledech","Content category":"Kategorie obsahu","Content categories":"Kategorie obsahu","All categories":"Všechny kategorie","No category":"Bez kategorie","Add “{name}”":"Přidat „{name}“","Filter by content category":"Filtrovat podle kategorie obsahu","Search categories":"Hledat kategorie","Search or type a new category":"Hledejte nebo napište novou kategorii","Loading…":"Načítání…","Couldn't load categories. Try again.":"Kategorie se nepodařilo načíst. Zkuste to znovu.","No categories match.":"Žádná kategorie neodpovídá.",Author:"Autor",Authors:"Autoři","All authors":"Všichni autoři","Search authors":"Hledat autory","Filter by author":"Filtrovat podle autora","Couldn't load authors. Try again.":"Autory se nepodařilo načíst. Zkuste to znovu.","No authors match.":"Žádný autor neodpovídá.","No resources have been shared yet.":"Zatím nikdo nesdílel žádný zdroj.","No courses have been made yet.":"Zatím nikdo nevytvořil žádný kurz.","Shows only the resources one member has shared. The list has everyone who has shared a resource here, with how many each has shared; type a name to find someone. You can combine it with the other filters and the search box.":"Zobrazí jen zdroje, které sdílel jeden člen. Seznam obsahuje každého, kdo zde sdílel zdroj, i s počtem; jméno najdete psaním. Lze kombinovat s ostatními filtry a vyhledáváním.","No resource has a category yet.":"Zatím žádný materiál nemá kategorii.","Show more":"Zobrazit další","What kind of resource this is, such as a research paper or an opinion piece. Members can filter the Knowledge Hub by it. Pick one, or type your own and choose Add.":"Jaký druh materiálu to je, například výzkumná práce nebo názorový článek. Členové podle toho mohou filtrovat Knowledge Hub. Vyberte jednu, nebo napište vlastní a zvolte Přidat.",Filters:"Filtry","{count} applied":"Použito: {count}","Content type":"Typ obsahu","Date shared":"Datum sdílení","Remove filter {name}":"Odebrat filtr {name}","Research Paper":"Výzkumná práce",Article:"Článek","Lecture/Talk":"Přednáška","Opinion Piece":"Názorový článek",General:"Obecné",Football:"Fotbal",Education:"Vzdělávání",Physiotherapy:"Fyzioterapie",Coaching:"Trénování","Sports Science":"Sportovní věda","Strength & Conditioning":"Silová a kondiční příprava",Recovery:"Regenerace",Nutrition:"Výživa",Medicine:"Medicína",Health:"Zdraví",Cars:"Auta",Entertainment:"Zábava",Programming:"Programování",Technology:"Technologie",Business:"Byznys",Science:"Věda",Engineering:"Inženýrství",Sports:"Sport",Arts:"Umění",Travel:"Cestování",Food:"Jídlo",Resources:"Materiály","Could not load this course.":"Tento kurz se nepodařilo načíst.","Back to course overview":"Zpět na přehled kurzu","Preview as learner":"Zobrazit jako student","Close table of contents":"Zavřít obsah","Join {group} to continue learning.":"Připoj se ke skupině {group} a pokračuj ve studiu.","the course's current group":"aktuální skupině kurzu","Enroll in this course to watch the lecture.":"Zapiš se do tohoto kurzu a sleduj přednášku.","Next lesson":"Další lekce","Table of contents":"Obsah","Add a section to start building content.":"Přidej sekci a začni tvořit obsah.","No lessons available yet.":"Zatím nejsou dostupné žádné lekce.","Lesson completed":"Lekce dokončena","Marked incomplete":"Označeno jako nedokončené","Could not update progress":"Pokrok se nepodařilo aktualizovat","Mark incomplete":"Označit jako nedokončené","Mark complete":"Označit jako dokončené","You need to join this course before you can view its lessons.":"Než si budeš moct zobrazit lekce, musíš se do kurzu zapsat.","Go to course overview":"Přejít na přehled kurzu","No lesson selected":"Není vybrána žádná lekce","Pick a lesson from the table of contents.":"Vyber lekci z obsahu.","Lesson {current} of {total}":"Lekce {current} z {total}","This lesson has no written content yet.":"Tato lekce zatím nemá žádný textový obsah.",Block:"Blok","In this lesson":"V této lekci","Lesson content":"Obsah lekce",Completed:"Dokončeno","Completed {date}":"Dokončeno {date}","Open PDF":"Otevřít PDF","Quick check":"Rychlá kontrola",Assignment:"Úkol","Submit your work in the lesson discussion below.":"Svou práci odevzdej v diskusi k lekci níže.",Quiz:"Test","Could not save quiz.":"Test se nepodařilo uložit.","Could not submit quiz":"Test se nepodařilo odeslat","Select all answers that apply.":"Vyber všechny správné odpovědi.","This is an open-ended check — continue when you are ready.":"Toto je otevřená kontrola – pokračuj, až budeš připraven.","Submit quiz":"Odeslat test","You {status} the quiz.":"Test jsi {status}.",passed:"zvládl/a","didn't pass":"nezvládl/a","Great job!":"Skvělá práce!","Review the answers below, then try again.":"Projdi si odpovědi níže a zkus to znovu.","Retake quiz":"Opakovat test",Score:"Skóre","Correct answers":"Správné odpovědi",Correct:"Správně",Incorrect:"Špatně",You:"Ty","Could not post your comment":"Komentář se nepodařilo odeslat","Could not update the comment":"Komentář se nepodařilo upravit","Could not delete the comment":"Komentář se nepodařilo smazat",Discussion:"Diskuse","Loading comments…":"Načítám komentáře…","No comments yet — start the discussion.":"Zatím žádné komentáře – začni diskusi.","Add to the discussion…":"Přidej se do diskuse…","Redirecting now…":"Přesměrovávám…","Redirecting in {count} second":"Přesměrování za {count} sekundu","Redirecting in {count} seconds":"Přesměrování za {count} sekund","Lesson complete":"Lekce dokončena","Up next":"Další na řadě",Stay:"Zůstat",Continue:"Pokračovat","Quiz result":"Výsledek testu","Question-by-question review of this learner's quiz attempt.":"Podrobný přehled pokusu studenta o test po jednotlivých otázkách.","Attempts: {count}":"Pokusy: {count}",Submitted:"Odesláno","You received {points} karma point.":"Přibyl ti {points} bod karmy.","You received {points} karma points.":"Přibylo ti {points} bodů karmy.","Congratulations!":"Gratulujeme!","You've successfully completed {course}.":"Kurz {course} je úspěšně dokončen.","Keep reviewing":"Pokračovat v opakování",Text:"Text","Send feedback":"Odeslat zpětnou vazbu","You can attach up to {max} screenshots":"Můžeš připojit až {max} snímků obrazovky","Only the first {count} screenshot was added":"Byl přidán jen první {count} snímek obrazovky","Only the first {count} screenshots were added":"Bylo přidáno jen prvních {count} snímků obrazovky","Unsupported image type":"Nepodporovaný typ obrázku","Larger than 10 MB":"Větší než 10 MB","Upload failed":"Nahrávání se nezdařilo","Add a short title.":"Přidej krátký název","Please add a bit more detail ({min}+ characters).":"Přidej prosím trochu více podrobností (alespoň {min} znaků)","Bug report sent":"Hlášení chyby odesláno","Idea sent":"Nápad odeslán","Thanks! The SpatialChat Communities team will take a look.":"Díky! Tým SpatialChat Communities se na to podívá.","Couldn't send your feedback":"Zpětnou vazbu se nepodařilo odeslat","Report a problem or suggest an improvement to the SpatialChat Communities team.":"Nahlas týmu SpatialChat Communities problém nebo navrhni vylepšení.","Feedback type":"Typ zpětné vazby","Report a bug":"Nahlásit chybu","Suggest an idea":"Navrhnout nápad","e.g. Verify code shows “Validation error!”":"např. Ověřovací kód zobrazuje „Validation error!“","e.g. Let me schedule posts":"např. Chci plánovat příspěvky","What happened?":"Co se stalo?","What would you like?":"Co bys chtěl?","What did you do, what did you expect, and what happened instead?":"Co jsi udělal, co jsi očekával a co se stalo místo toho?","What problem are you trying to solve? How would this help you?":"Jaký problém se snažíš vyřešit? Jak by ti to pomohlo?",Screenshots:"Snímky obrazovky","(optional, up to {max})":"(volitelné, nejvýše {max})",Uploading:"Nahrávání","Add screenshot":"Přidat snímek obrazovky","or drop / paste (Ctrl/⌘+V) an image":"nebo sem přetáhni či vlož (Ctrl/⌘+V) obrázek","Screenshots that failed to upload won't be sent. Remove them or try again.":"Snímky obrazovky, které se nepodařilo nahrát, se neodešlou. Odeber je nebo to zkus znovu.","Include technical details":"Zahrnout technické údaje","(recommended)":"(doporučeno)","Page, browser, and no recent errors. Passwords, tokens and emails are removed.":"Stránka, prohlížeč a žádné nedávné chyby. Hesla, tokeny a e-maily jsou odstraněny.","Page, browser, and {count} recent error. Passwords, tokens and emails are removed.":"Stránka, prohlížeč a {count} nedávná chyba. Hesla, tokeny a e-maily jsou odstraněny.","Page, browser, and {count} recent errors. Passwords, tokens and emails are removed.":"Stránka, prohlížeč a {count} nedávných chyb. Hesla, tokeny a e-maily jsou odstraněny.","Page: {path}":"Stránka: {path}","Browser: {browser}":"Prohlížeč: {browser}","Screen: {width}x{height} · Build: {version}":"Obrazovka: {width}x{height} · Sestavení: {version}","No errors captured in this session.":"V této relaci nebyly zachyceny žádné chyby.","The SpatialChat Communities team may contact me about this":"Tým SpatialChat Communities mě může kvůli tomu kontaktovat","Uploading…":"Nahrávání…","Send report":"Odeslat hlášení","Send idea":"Odeslat nápad","{points} earned":"Získáno: {points}","{points} to spend":"K utracení: {points}","Profile picture updated":"Profilový obrázek aktualizován","Couldn't update picture":"Obrázek se nepodařilo aktualizovat","Cover photo updated":"Úvodní fotka aktualizována","Couldn't update cover":"Úvodní fotku se nepodařilo aktualizovat","Link copied!":"Odkaz zkopírován!","Profile link copied to clipboard.":"Odkaz na profil zkopírován do schránky.",Cover:"Úvodní fotka","Joined {date}":"Členem od {date}","Badges & achievements":"Odznaky a úspěchy","No badges earned yet — stay active to unlock your first one.":"Zatím jsi nezískal žádné odznaky – buď aktivní a odemkni ten první.",Badge:"Odznak","You haven't posted yet.":"Zatím jsi nic nepřidal.","No activity yet.":"Zatím žádná aktivita.","Adjust cover photo":"Upravit úvodní fotku","Add a bio and interests from":"Přidej si bio a zájmy v sekci","to fill out your About section.":"a vyplň svou sekci O mně.",Bio:"Bio",Interests:"Zájmy","No achievement badges are configured for this community yet.":"V této komunitě zatím nejsou nastaveny žádné odznaky za úspěchy.","Earned {date}":"Získáno {date}","Profile updated":"Profil aktualizován","Your changes have been saved.":"Tvoje změny byly uloženy.","Couldn't save profile":"Profil se nepodařilo uložit",Username:"Uživatelské jméno","Checking availability…":"Kontroluji dostupnost…","Username is available":"Uživatelské jméno je dostupné","Username is taken":"Uživatelské jméno je obsazené","3–64 chars: letters, numbers, _ or .":"3–64 znaků: písmena, čísla, _ nebo .",Headline:"Nadpis",Location:"Poloha","Social links":"Sociální odkazy","Saving…":"Ukládám…","Couldn't update preference":"Nastavení se nepodařilo aktualizovat","Email notifications":"E-mailová oznámení","Choose which activity on your content sends you an email.":"Vyber, které aktivity u tvého obsahu ti pošlou e-mail.","Posts created":"Vytvořené příspěvky","Comments made":"Napsané komentáře","Replies made":"Napsané odpovědi","Likes given":"Rozdané lajky","Likes on your posts":"Lajky na tvých příspěvcích","Your posts commented":"Tvé okomentované příspěvky","Your replies received":"Přijaté odpovědi","Followers gained":"Získaní sledující","Live sessions":"Živá setkání","Admin-assigned":"Přidělil správce",Other:"Ostatní","How you earned your {points}":"Jak jsi získal {points}","No points yet — post, comment and react to start earning.":"Zatím žádné body – přidávej příspěvky, komentuj a reaguj, abys je začal sbírat.","Language updated":"Jazyk aktualizován","Using the community's language":"Používá se jazyk komunity","Only you see this change.":"Tuto změnu vidíš jen ty.","Couldn't change your language":"Jazyk se nepodařilo změnit",Language:"Jazyk","Menus, buttons and labels are shown in the language you pick here, for you only. Posts, comments and messages stay in the language they were written in. Other members keep the community's language unless they pick their own.":"Nabídky, tlačítka a popisky se zobrazují v jazyce, který zde vybereš, a to jen pro tebe. Příspěvky, komentáře a zprávy zůstávají v jazyce, ve kterém byly napsány. Ostatní členové mají jazyk komunity, pokud si nevyberou vlastní.","Choose the language you read this community in.":"Vyber jazyk, ve kterém tuto komunitu čteš.","My language":"Můj jazyk","Community default":"Výchozí jazyk komunity","Console error":"Chyba konzole","Console warning":"Varování konzole",Crash:"Pád","Unhandled error":"Neošetřená chyba","Failed request":"Neúspěšný požadavek",About:"O mně",Achievements:"Úspěchy",Website:"Web",Silver:"Stříbrný",Gold:"Zlatý",Platinum:"Platinový",Diamond:"Diamantový",Elite:"Elitní","Comments on my posts":"Komentáře k mým příspěvkům","When someone comments on your post":"Když někdo okomentuje tvůj příspěvek","Replies to my comments":"Odpovědi na mé komentáře","When someone replies to your comment":"Když někdo odpoví na tvůj komentář","Likes on my posts":"Hodnocení mých příspěvků","When someone likes your post":"Když někdo dá lajk tvému příspěvku","Reactions to my comments":"Reakce na mé komentáře","When someone reacts to your comment":"Když někdo zareaguje na tvůj komentář","Reactions to my replies":"Reakce na mé odpovědi","When someone reacts to your reply":"Když někdo zareaguje na tvou odpověď","Direct messages":"Přímé zprávy","When you receive a direct message":"Když ti přijde přímá zpráva",Mentions:"Zmínky","When someone @mentions you":"Když tě někdo @zmíní","Load more {label}":"Načíst další: {label}","Loading more {label}…":"Načítám další: {label}…",courses:"kurzy",resources:"materiály",items:"položky","About {label}":"Informace: {label}","Couldn't like this course":"Kurz se nepodařilo označit jako To se mi líbí","Couldn't like this resource":"Zdroj se nepodařilo označit jako To se mi líbí","Couldn't remove your like":"Označení To se mi líbí se nepodařilo odebrat","Notify members":"Upozornit členy","Sends everyone in the community a notification about this resource, in the app and as a push notification on their phone or browser. Members who turned off notifications for this community don't get it.":"Všem v komunitě pošle upozornění na tento zdroj – v aplikaci i jako push oznámení v telefonu nebo prohlížeči. Členové, kteří mají upozornění pro tuto komunitu vypnutá, ho nedostanou.","It is now available in the Knowledge Hub, and members are being notified.":"Zdroj je nyní k dispozici v Knowledge Hubu a členové dostávají upozornění.","How posts are ordered":"Jak se řadí příspěvky","Recent: newest first. Top posts: the most likes, of all time; comments don't change the order. Trending: the most likes and comments together, within the period you pick. Following: posts by people you follow.":"Nejnovější: nejnovější nahoře. Top příspěvky: nejvíc lajků za celou dobu; komentáře pořadí nemění. Trendy: nejvíc lajků a komentářů dohromady za zvolené období. Sledovaní: příspěvky lidí, které sledujete.","Save this resource":"Uložit tento zdroj","Save this course":"Uložit tento kurz","Remove from saved":"Odebrat z uložených","Saved. Click to remove it from your saved list.":"Uloženo. Kliknutím to odeberete ze svého seznamu uložených.","Find it any time under Saved in the Knowledge Hub.":"Najdete to kdykoli v sekci Uloženo ve Znalostním centru.","Find it any time under Saved on the Courses page.":"Najdete to kdykoli v sekci Uloženo na stránce Kurzy.","Couldn't save this resource":"Zdroj se nepodařilo uložit","Couldn't save this course":"Kurz se nepodařilo uložit","Couldn't remove it from saved":"Nepodařilo se to odebrat z uložených","All resources":"Všechny zdroje",Show:"Zobrazit","Press the bookmark on anything to save it here for later. Only you can see what you saved.":"Stisknutím záložky u čehokoli si to sem uložíte na později. Co jste uložili, vidíte jen vy.","Date range":"Časové období",Today:"Dnes","Last 7 days":"Posledních 7 dní","Last 4 weeks":"Poslední 4 týdny","Last 6 months":"Posledních 6 měsíců","Last 12 months":"Posledních 12 měsíců","Month to date":"Od začátku měsíce","Quarter to date":"Od začátku čtvrtletí","Year to date":"Od začátku roku","All time":"Celé období",Start:"Začátek",End:"Konec",Clear:"Vymazat",Apply:"Použít","Couldn't download this file":"Soubor se nepodařilo stáhnout","A new category is saved with capital letters, so “fancy dress” becomes “Fancy Dress”, and one that already exists is reused rather than added twice.":"Nová kategorie se uloží s velkými písmeny, takže z „fancy dress“ bude „Fancy Dress“, a kategorie, která už existuje, se použije znovu, místo aby byla přidána podruhé.","Job title":"Pracovní pozice","Your role, such as Head of Sports Science or Team Physiotherapist. It shows under your name in the member directory and on your profile, so members know who to contact.":"Vaše role, například vedoucí sportovní vědy nebo týmový fyzioterapeut. Zobrazuje se pod vaším jménem v adresáři členů a na vašem profilu, aby členové věděli, koho kontaktovat.","e.g. Head of Sports Science":"např. vedoucí sportovní vědy","Type where you are based, or use your current location: your browser asks first, and only the town and country are filled in. Your exact position is never saved. Check it, then save your profile.":"Napište, kde působíte, nebo použijte svou aktuální polohu: prohlížeč se nejdřív zeptá a vyplní se jen město a země. Vaše přesná poloha se nikdy neukládá. Zkontrolujte ji a pak uložte profil.","e.g. Stockholm, Sweden":"např. Stockholm, Švédsko","Finding you…":"Hledám vás…","Use my location":"Použít moji polohu","Please enter your location, or use your current location.":"Zadejte svou polohu, nebo použijte aktuální polohu.","Fields marked * are required.":"Pole označená * jsou povinná.","Your details in {community}":"Vaše údaje v {community}","Your community details":"Vaše údaje v komunitě","Community details":"Údaje v komunitě","Questions this community's admins ask every member. Your answers show in its member directory, except ones marked “Only admins see this”.":"Otázky, které správci této komunity kladou všem členům. Vaše odpovědi se zobrazují v adresáři členů, kromě těch označených „Vidí jen správci“.","Couldn't save your profile":"Profil se nepodařilo uložit","Check the highlighted detail, then save again.":"Zkontrolujte zvýrazněný údaj a uložte znovu.","Location filled in":"Poloha vyplněna","Check it, then save your profile.":"Zkontrolujte ji a pak uložte profil.","Couldn't use your location":"Vaši polohu nelze použít","Please type your location.":"Napište prosím svou polohu.","Your browser can't share your location here. Please type it.":"Váš prohlížeč zde nemůže sdílet polohu. Napište ji prosím.","Location access is blocked. Allow it for this site in your browser settings, or type your location.":"Přístup k poloze je zablokovaný. Povolte ho pro tento web v nastavení prohlížeče, nebo polohu napište.","Finding your location took too long. Please try again, or type your location.":"Zjištění polohy trvalo příliš dlouho. Zkuste to znovu, nebo polohu napište.","Your location isn't available right now. Please type it.":"Vaše poloha teď není k dispozici. Napište ji prosím.","Location lookup isn't available right now. Please type your location.":"Vyhledání polohy teď není k dispozici. Napište prosím svou polohu."},_nn={"SpatialChat Communities Keyword":"Super Retaillians","Home Page Left column":"Home Page Left column",Home:"Home","Explore Groups":"Explore Hubs",Events:"Super Events",Groups:"Hubs",Links:"Links","Direct Message":"Direct Message","Powered by":"Powered by","No groups here, please use + to create a new one, or join one see them here.":"No hubs here, please use + to create a new one, or join one see them here.","Please join a group to see them here":"Please join a hub to see them here","Section can only be reordered within the group!":"Space can only be reordered within the hub!","Group Page":"Hub Page","Invite Members":"Invite Members",Join:"Join",Joined:"Joined","Create new section":"Create new Space","Group Setting drop down":"Hub Setting drop down",Share:"Share","Edit group":"Edit hub","Delete group":"Delete hub",Leave:"Leave","Are you sure you want to delete the group?":"Are you sure you want to delete the hub?",Cancel:"Cancel","Yes, Go Ahead":"Yes, Go Ahead","Share via link":"Share via link",Copy:"Copy",Copied:"Copied","Share on social media":"Share on social media","Add Section":"Add Space","Section Header":"Space Header",Live:"Live","Create post":"Create Post","Notificaiton Bell":"Notificaiton Bell","All posts":"All posts","Admin posts only":"Admin posts only",None:"None","Section Setting drop down":"Space Setting drop down","Edit Section":"Edit Space","Embed Section":"Embed Space","Delete Section":"Delete Space","Are you sure you want to delete the section?":"Are you sure you want to delete the Space?","Section deleted!":"Space deleted!","Create Group Pop up / Update":"Create hub Pop up / Update","Create group":"Create hub","Basic Detail":"Basic Detail",Settings:"Settings","Size 16:9 or 1600 by 900":"Size 16:9 or 1600 by 900","Group name":"Hub name","Enter group name":"Enter hub name","Suggestions: Spaces, Channels, Groups, Blog, Knowledgebase, etc":"Suggestions: Spaces, Channels, Hubs, Blog, Knowledgebase, etc","Group Description":"Hub Description","Enter description here":"Enter description here","Group Type":"Hub Type",Open:"Open","Visible to all & anyone can join":"Visible to all & anyone can join",Closed:"Closed","User will have to request to join the group":"User will have to request to join the hub",Paid:"Paid","Group Price":"Hub Price","Currency (Default: INR)":"Currency (Default: INR)","User will have to pay to join the group":"User will have to pay to join the hub","Make this a private group":"Make this a private hub","Private group will only be visible to members who are part of it. Admin can add members manually from member list":"Private Hub will only be visible to members who are part of it. Admin can add members manually from member list","Upload from device":"Upload from device","Search image":"Search image","Valid group name required!":"Valid Hub name required!","Update Group":"Update Hub","SEO Settings":"SEO Settings","Custom URL":"Custom URL","Meta Title":"Meta Title","Maximum length of 255 characters allowed":"Maximum length of 255 characters allowed","Meta Description":"Meta Description","Open Graph Detail":"Open Graph Detail","Open Graph Title":"Open Graph Title","Open Graph Description":"Open Graph Description","Open Graph Image":"Open Graph Image","Recommended dimensions: 1200px by 630px with a 1.91:1 aspect ratio.":"Recommended dimensions: 1200px by 630px with a 1.91:1 aspect ratio.","If no URL is used, it will automatically picked your group thumbnail.":"If no URL is used, it will automatically picked your Hub thumbnail.","Create Section Pop up / Update":"Create Space Pop up / Update","Create Section":"Create Space","Section Name":"Space Name","Suggestions: General, Introductions, Community Guidelines":"Suggestions: General, Introductions, Community Guidelines","Section Type":"Space Type","Post Type":"Post Type","Group Chat":"Hub Chat","Who can post in this section?":"Who can post in this Space?","Only Admin":"Only Admin","Any user":"Any user","Sorting order for section":"Sorting order for Space","Latest first":"Latest first","Oldest post first":"Oldest post first","Section Appearance":"Space Appearance","List View":"List View","Grid View":"Grid View","Make this closed section":"Make this closed Space","Members will have to request access to see section content":"Members will have to request access to see Space content","Make this a private section":"Make this a private Space","Disables requests (Make sure closed section is selected as well).":"Disables requests (Make sure closed Space is selected as well).","Post Editor":"Post Editor","Create new post in":"Create new post in","Add Cover Picture":"Add Cover Picture","Heading (Optional)":"Heading (Optional)","Write here..":"Write here..",Picture:"Picture",Video:"Video",Attachment:"Attachment",Poll:"Poll","Embed Code":"Embed Code",Tags:"Tags","Toggle to question":"Run a Quiz","Poll expire time":"Poll expire time","Poll question":"Poll question","Enter Question":"Type your question",Question:"Question",Option:"Option",Options:"Options","Add Option":"Add Option","Poll Expiry time":"Poll Expiry time","12 Hours":"12 Hours","1 Day":"1 Day","2 Days":"2 Days","1 Week":"1 Week","2 Weeks":"2 Weeks","Always Open":"Always Open","Write embeddable code":"Write embeddable code","Click here to add embed code.":"Click here to add embed code.","Paste your embed code here!":"Paste your embed code here!","Post Settings":"Post Settings","Update Post":"Update Post",Update:"Update","Start meeting / Video call / Live":"Start meeting / Video call / Live","Meeting Name":"Meeting Name","Suggestion: Group discussion etc":"Suggestion: Hub discussion etc",Description:"Description","Enter description here (optional)":"Enter description here (optional)","When do you want to start the session":"When do you want to start the session","Right now":"Right now","Schedule for later":"Schedule for later","Group video call":"Hub video call",Webinar:"Webinar","Go Live":"Go Live","Go live":"Go Live","Info on the Post":"Info on the Post","Post comment":"Post comment",Comment:"Comment",Comments:"Comments",Reply:"Reply",Replies:"Replies","Share via URL":"Share via URL","Reshare in other sections":"Reshare in other Spaces","Post Card Drop Down":"Post Card Drop Down",Bookmark:"Bookmark","Pin post":"Pin post",Edit:"Edit","Embed Post":"Embed Post",Delete:"Delete","Remove Pin":"Remove Pin","Remove Bookmark":"Remove Bookmark","Just copy paste this code wherever you want it to be embedded":"Just copy paste this code wherever you want it to be embedded",Height:"Height",Preview:"Preview","Copied to clipboard":"Copied to clipboard","Select Widgets":"Select Widgets","Add widgets to":"Add widgets to","You can change their order by dragging & dropping the widgets over each other":"You can change their order by dragging & dropping the widgets over each other","Please note: Widget wont be displayed if there is no data available,":"Please note: Widget wont be displayed if there is no data available,","Group Members":"Hub Members","Group Leaderboard":"Hub Leaderboard","Community Leaderboard":"Community Leaderboard","Trending Posts":"Trending Posts","Group Events":"Hub Events","Add Custom":"Add Custom","Save Widgets":"Save Widgets","Visible to user":"Visible to user","Visible to admin":"Visible to admin","Add widget to":"Add widget to","Upload cover picture":"Upload cover picture","1:1 aspect ration (recommended)":"1:1 aspect ration (recommended)","Card Title":"Card Title","Enter widget name":"Enter widget name","Small Description (try to keep it under 50 words)":"Small Description (try to keep it under 50 words)","Enter description":"Enter description","Button Title":"Button Title","Enter button name":"Enter button name","Siggestion: Know more, Join, Apply, etc":"Siggestion: Know more, Join, Apply, etc","URL link":"URL link","Create custom widget":"Create custom widget","Custom widget created successfully":"Custom widget created successfully",Widgets:"Widgets",Members:"Members","See All":"See All","Communtiy Top Contributors":"Communtiy Top Contributors","Community members":"Community Members","Group Top Contributors":"Hub Top Contributors","Upcoming Events":"Upcoming Events","Home Page Banner":"Home Page Banner","Edit Banner":"Edit Banner","Home page Edit Banner Pop up":"Home page Edit Banner Pop up","Update Banner":"Update Banner",Search:"Search","Upload Image":"Upload Image",Remove:"Remove","Banner image (please use 16:6 ratio or 1600px by 600px image for the best view)":"Banner image (please use 16:6 ratio or 1600px by 600px image for the best view)","Banner Title":"Banner Title","Enter here":"Enter here","Suggestion: Welcome to my community etc":"Suggestion: Welcome to my community etc","Banner Description":"Banner Description","Enter banner description":"Enter banner description","Save Banner Info":"Save Banner Info","Home Page Feed":"Home Page Feed",Recent:"Recent","Top posts":"Top Posts",Trending:"Trending","Home Feed Groups":"Home Feed Hubs","Header BarProfile Drop down":"Header BarProfile Drop down","My profile":"My Profile",Logout:"Logout",Notification:"Notification",Notifications:"Notifications","Mark all viewed":"Mark all viewed","has created a post":"has created a post","wants to join":"wants to join","has commented on your post":"has commented on your post","has replied to your comment":"has replied to your comment","Search for tags":"Search for tags","All groups":"All Hubs","Search result":"Search result","No post found for selected hashtag":"No post found for selected hashtag","Start a conversation":"Start a conversation","Search by name":"Search by name",Upcoming:"Upcoming",UPCOMING:"UPCOMING",Past:"Past",PAST:"PAST","No upcoming events":"No upcoming events","Create event popup":"Create event popup","Event details":"Event details","16:9 aspect ratio":"16:9 aspect ratio","Event name":"Event name","Enter event name":"Enter event name","Host Name":"Host Name","You will be made host if none selected":"You will be made host if none selected","Write here...":"Write here...","No. of registration for the event":"No. of registration for the event",Unlimited:"Unlimited","When & where":"When & where",From:"From","Start date":"Start date",time:"time",To:"To","End date":"End date","Current time zone:":"Current time zone:","Can be updated from the communtiy setting":"Can be updated from the communtiy setting","Online event":"Online event","Add meeting link":"Add meeting link","Meeting link will be generated once event is created":"Meeting link will be generated once event is created",Venue:"Venue","Enter address":"Enter address",Create:"Create",Invite:"Invite","Share event via link":"Share event via link",Copy__1:"Copy","Select section to post this event":"Select Space to post this event","Once posted, members of that group or section will recieve an notification":"Once posted, members of that Hub or Space will recieve an notification",Post:"Post",RSVP:"RSVP","Book Event":"Book Event","Yes, I'll attend":"Yes, I'll attend","May be":"May be","No, I won't attend":"No, I won't attend","Date & Time":"Date & Time",Host:"Host","Online meeting":"Online meeting","Meeting link will be visible once registered for the event":"Meeting link will be visible once registered for the event","User Management":"User Management","Go bac to community":"Go bac to community","Manage Members":"Manage Members",Member:"Member",Invited:"Invited","Search for member":"Search for member","Add to group":"Add to Hub","Send Direct Message":"Send Direct Message","Change role":"Change role","Kick from community":"Kick from community","Super Admin":"Super Admin","Super admin will have full access to the communtiy settings":"Super admin will have full access to the communtiy settings","Group Admin":"Hub Admin","Admin of the selected group can edit the group information and create, edt or delete section under selected group":"Admin of the selected Hub can edit the Hub information and create, edt or delete Space under selected Hub","Group Moderator":"Hub Moderator","Group moderator can create or delete post, comment, reply & messages in the selected group.":"Hub moderator can create or delete post, comment, reply & messages in the selected Hub.",User:"User",Save:"Save","User role updated successfully":"User role updated successfully",Leaderboard:"Super Leaderboard","Click on the column header for sorting":"Click on the column header for sorting",Rank:"Rank","Karma Points":"Super Coins","Custom Points":"Custom Points",Follow:"Follow",Upvotes:"Upvotes",Posts:"Posts","Add custom points":"Add custom points","Subtract custom points":"Subtract custom points","Enter no. of points":"Enter no. of points","Add points":"Add points","Invite members to":"Invite members to","Invite via link":"Invite via link","Invite via email":"Invite via email","Add more":"Add more","Upload a CSV":"Upload a CSV","Please upload a comma-seprated CSV file, with header as name, email.":"Please upload a comma-seprated CSV file, with header as name, email.","Here is a template CSV file":"Here is a template CSV file","Upload File":"Upload File","Send Invite":"Send Invite","Mail Template":"Mail Template","Send Test Mail":"Send Test Mail",Hey:"Hey","A has invite you to join the B":"A has invite you to join the B","Switch to rich text editor":"Switch to rich text editor","Add Custom Message":"Add Custom Message","Enter message here":"Enter message here","Send Bulk Mail":"Send Bulk Mail","Send Mail":"Send Mail","Send bulk mail to all community members or select group members":"Send bulk mail to all community members or select Hub members",Date:"Date",Subject:"Subject",Recipients:"Recipients","1000 bulk emails remaining for this month. Resets on <date>":"1000 bulk emails remaining for this month. Resets on <date>",Everyone:"Everyone","Enter mail subject":"Enter mail subject","Write message":"Write message",Cancel__1:"Cancel",Send:"Send","Profile Page":"Profile Page",Activity:"Activity",Bookmarks:"Bookmarks","Edit profile":"Edit Profile",Unsubscribe:"Unsubscribe","Settings (Account)":"Settings (Account)",Profile:"Profile","Set profile Picture":"Set profile Picture","Your name":"Your name","User ID":"User ID","Short bio":"Short bio","Link your social account, this will be displayed on your profile":"Link your social account, this will be displayed on your profile","Add social handle":"Add social handle",Verification:"Verification","Account Verification":"Account Verification",Email:"Email","Enter email":"Enter email",Verified:"Verified",Unverified:"Unverified",Change:"Change",Unlink:"Unlink",Mobile:"Mobile","enter mobile no.":"enter mobile no.","Request OTP":"Request OTP","Notification centre":"Notification centre","Manage your personal account notification preferences":"Manage your personal account notification preferences",Prefrences:"Prefrences","Email notification":"Email notification","Notify me about comments on my posts":"Notify me about comments on my posts","Notify me about replies on my comments":"Notify me about replies on my comments","Notify me about likes on my posts":"Notify me about likes on my posts","Notify me about reaction on my comments":"Notify me about reaction on my comments","Notify me about reaction on my reply":"Notify me about reaction on my reply","Notify me about direct message":"Notify me about direct message","Notify me about my mentions":"Notify me about my mentions","Notification for new posts":"Notification for new posts","Only group & section available which you are part of":"Only Hub & Space available which you are part of","Group & Section":"Hub & Space","All activity":"All activity","Post by admin":"Post by admin","No Notification":"No Notification","Setting (Community)":"Setting (Community)","General Settings":"General Settings","Upload community logo":"Upload community logo","Community name":"Community name","Invalid field":"Invalid field","Your community address":"Your community address","Fav icon":"Fav icon","This will be visible on the browser tab (32px by 32px)":"This will be visible on the browser tab (32px by 32px)",TimeZone:"TimeZone","Privacy Policy on login page":"Privacy Policy on login page","Terms & Condition on login page":"Terms & Condition on login page","Enter link here":"Enter link here","Open Group Image":"Open Hub Image","By default ir takes up the community banner uploaded with the communtiy":"By default ir takes up the community banner uploaded with the communtiy","Community Experience":"Community Experience",Onboarding:"Onboarding","Make your community private":"Make your community private","Users will have to login or sign up to access the community":"Users will have to login or sign up to access the community","Make account verification mandatory for both email & mobile":"Make account verification mandatory for both email & mobile","New user will have to verify both email & mobile no. to access the community":"New user will have to verify both email & mobile no. to access the community","Admin will also have to verify their mobile no. & email or else they won't be able to access the community":"Admin will also have to verify their mobile no. & email or else they won't be able to access the community","Gated community access":"Gated community access","Admin will have to approve or reject user's requests to join the community":"Admin will have to approve or reject user's requests to join the community","Disable mobile login/register":"Disable mobile login/register","Disable email login/register":"Disable email login/register","Disable google login/register":"Disable google login/register","Disable facebook login/register":"Disable facebook login/register","Show & Hide features":"Show & Hide features","Hide direct chat":"Hide direct chat","User will not be able to send direct messages to each other":"User will not be able to send direct messages to each other","Hide profile picture from top right corner for mobile responsive view":"Hide profile picture from top right corner for mobile responsive view","Useful when using community in an in app browser":"Useful when using community in an in app browser","Hide profile picture from top right corner in every view":"Hide profile picture from top right corner in every view","Disable header dropdown on profile picture":"Disable header dropdown on profile picture","Useful for integrated community, especially using SSO":"Useful for integrated community, especially using SSO","Hide the communtiy logo from the header":"Hide the communtiy logo from the header","Hide the communtiy title from the header":"Hide the communtiy title from the header","Show collpased group in the side nav bar":"Show collpased Hub in the side nav bar","Show full expanded post in the home feed":"Show full expanded post in the home feed","Hide the leaderboard score from the header":"Hide the leaderboard score from the header","Show powered by SpatialChat Communities":"Show powered by SpatialChat Communities","Hide closed groups if not joined":"Hide closed Hubs if not joined","Closed groups would not be shown to the user if they are not a member of the group":"Closed Hubs would not be shown to the user if they are not a member of the Hub","Hide Community subscriber count from the users":"Hide Community subscriber count from the users","This will hide the community subscriber list in the community header":"This will hide the community subscriber list in the community header","Disable Communtiy Switcher":"Disable Communtiy Switcher","Use MD editor for create post description":"Use MD editor for create post description","Non logged in user will land on explore group page instead of post directory":"Non logged in user will land on explore Hub page instead of post directory","Advanced configurable":"Advanced configurable","Communtiy default country code":"Communtiy default country code","This will show up by default on login/signup":"This will show up by default on login/signup","Onboarding/Welcome Message":"Onboarding/Welcome Message","Welcome Message":"Welcome Message","Greet your members with personalized message":"Greet your members with personalized message","Welcome to":"Welcome to",Message:"Message","Add message":"Add message","Custom domain":"Custom domain","Add custom domain":"Add custom domain","Create new request":"Create new request","Enter your custom domain":"Enter your custom domain","Setup details":"Setup details","Add a CNAME record in your domain pointing to this community's address":"Add a CNAME record in your domain pointing to this community's address","To configure your domain, you'll need to add a CNAME record pointing your domain to your pensil community URL":"To configure your domain, you'll need to add a CNAME record pointing your domain to your pensil community URL","Step by Step help apge":"Step by Step help apge","All request list":"All request list","Allow admin to assign/un-assign custom points to users":"Allow admin to assign/un-assign custom points to users","Base points for user to begin with":"Base points for user to begin with","Base points will be updated for all the users, any changes will reflect for all the users.":"Base points will be updated for all the users, any changes will reflect for all the users.","Allocate points for interaction":"Allocate points for interaction","Upvoting post":"Upvoting post","creating a comment":"creating a comment","creating a reply":"creating a reply","Getting upvote to their post":"Getting upvote to their post","Getting comment to their post":"Getting comment to their post","Getting reply to their comment":"Getting reply to their comment","Creating a post":"Creating a post",Visiblity:"Visiblity","Move Up":"Move Up","Move Down":"Move Down","Create embedded section":"Create embedded Space","Preview area":"Preview area","Theme selector":"Theme selector","Community Theme":"Community Theme","Select theme":"Select theme","Select brand color":"Select brand color","Customize your button color to match your brand":"Customize your button color to match your brand","Select on button text color":"Select on button text color","Suggestion: Keep inverted contrast against brand color":"Suggestion: Keep inverted contrast against brand color",Billing:"Billing","Current plan":"Current plan","You are current on Free PLan":"You are current on Free PLan","Renew on: NA":"Renew on: NA",Select:"Select","Email us at":"Email us at","Compare plan":"Compare plan","API Keys":"API Keys","Create new key":"Create new key","Total keys":"Total keys","Keep your API keys safe! You can use them to access specific feature & let cetain apps perfrom certain actions on your behalf on the platform.":"Keep your API keys safe! You can use them to access specific feature & let cetain apps perfrom certain actions on your behalf on the platform.","Key name":"Key name","Key value":"Key value",Action:"Action","Group updated!":"Hub updated!","Are you sure you want to":"Are you sure you want to","Make Moderator":"Make Moderator","Remove from group":"Remove from Hub","Show All":"Show All","Change Role":"Change Role",Close:"Close",copy:"copy",LINKS:"LINKS","Email Id":"Email Id",Name:"Name","Search for an image":"Search for an image","Crop Image":"Crop Image","No photos found":"No photos found",Community:"Community","Banner ratio - 16:9":"Banner ratio - 16:9","Banner Ratio - 16:6":"Banner Ratio - 16:6","Share on mail":"Share on mail","Share on Telegram":"Share on Telegram","Share on Whatsapp":"Share on Whatsapp","Share on Linkedin":"Share on Linkedin","Share on Facebook":"Share on Facebook","Share on Twitter":"Share on Twitter","Pin Post":"Pin Post","Heading (optional)":"Heading (optional)","Select section":"Select Space",Gif:"Gif","Create Custom Widget":"Create Custom Widget","Are you sure you want to delete this widget?":"Are you sure you want to delete this widget?","Go to event":"Go to event","Add Tags":"Add Tags","Create Tag":"Create Tag","Title (Optional)":"Title (Optional)","Search Gif":"Search Gif","What's on your mind":"What's on your mind","Looks like nothing available here right now.":"Looks like nothing available here right now.","Try exploring other tabs":"Try exploring other tabs","Delete Widget":"Delete Widget","Please select a section to post":"Please select a Space to post","Post added successfully!":"Superrrb! Your post is now live!","Failed to create post. Please check post content and retry again.":"Failed to create post. Please check post content and retry again.","Are you sure you want to discard current post?":"Are you sure you want to discard current post?","By default it will take up the image uploaded with the post":"By default it will take up the image uploaded with the post","Quiz can be only viewed and attempted from mobile device right now!":"Quiz can be only viewed and attempted from mobile device right now!","Community Banner":"Community Banner","Change Cover":"Change Cover","Suggestions: Welcome to my community etc":"Suggestions: Welcome to my community etc","(edited)":"(edited)","Aspect ratio (recommended)":"Aspect ratio (recommended)","Banner details updated!":"Banner details updated!","Refresh if changes are not visible!":"Refresh if changes are not visible!","Banner details could not be updated!":"Banner details could not be updated!","Post deleted":"Post deleted","Post not available. It may have been deleted.":"Post not available. It may have been deleted.",Admin:"Admin",Moderator:"Moderator","Bookmark added!":"Bookmark added!","Bookmark removed":"Bookmark removed","Failed performing action!":"Failed performing action!","Copy this link to share on other platforms":"Copy this link to share on other platforms","View this event":"View this event",Event:"Event","Join Meeting":"Join Meeting","The live meeting has ended":"The live meeting has ended","read more...":"read more...","Load more comments":"Load more comments","Post Reply":"Post Reply","Post Comment":"Post Comment",more:"more",upvoted:"upvoted","1 Upvote":"1 Upvote","1 Comment":"1 Comment","Please enter a title":"Please enter a title","Please enter a url link":"Please enter a url link","Please enter button title":"Please enter button title","Button label must be at least 20 characters":"Button label must be at least 20 characters","Please enter valid url":"Please enter valid url","Suggestions: Know more, Join, Apply...":"Suggestions: Know more, Join, Apply...",URL:"URL","Community Events":"Community Events","Widget deleted successfully":"Widget deleted successfully","Community Top Contributors":"Community Top Contributors",points:"points","Points cannot be greater than current points":"Points cannot be greater than current points","Point cannot be a negative value":"Point cannot be a negative value","Point cannot be a decimal point":"Point cannot be a decimal point","Please enter a valid number":"Please enter a valid number","Karma points updated successfully":"Super Coins updated successfully","Error in updating karma points":"Error in updating Super Coins","Add karma points":"Add Super Coins","Minus karma points":"Minus Super Coins","Total Karma points:":"Total Super Coins:","Enter no. of karma points":"Enter no. of Super Coins","Minus Points":"Minus Points","Trending Post":"Trending Post","No visible description":"No visible description","Picture ratio: 1:1":"Picture ratio: 1:1","home feed":"home feed","Event name is invalid!":"Event name is invalid!",custom:"custom","Custom widget updated successfully":"Custom widget updated successfully","Name invalid!":"Name invalid!","Current timezone:":"Current timezone:","can be updated from community settings":"can be updated from community settings","Event created successfully":"Event created successfully","Error in creating event":"Error in creating event",Attendees:"Attendees","Do you wish to notify these changes to attendees?":"Do you wish to notify these changes to attendees?","users wants to attend this event":"users wants to attend this event","Yes, Notify them":"Yes, Notify them","No, its okay":"No, its okay","Do you wish to notify that event is cancelled?":"Do you wish to notify that event is cancelled?","Are you sure you want to delete the event?":"Are you sure you want to delete the event?","Delete Event":"Delete Event","New Event":"New Event","Accept Invitation":"Accept Invitation",Requested:"Requested",Declined:"Declined","Request Access":"Request Access","Enroll for":"Enroll for",Housefull:"Housefull","Just copy paste this code wherever you want it to be embedded:":"Just copy paste this code wherever you want it to be embedded:",Ended:"Ended","Error getting events":"Error getting events","Events could not be fetched!":"Events could not be fetched!","Show Attendees":"Show Attendees",Subscribers:"Subscribers","Make this a closed section":"Make this a closed Space","Update Section":"Update Space","Valid section name required!":"Valid Space name required!","Enter section name":"Enter Space name","Community Admin":"Community Admin",Embed:"Embed","Invite to":"Invite to","Please enter a valid email address":"Please enter a valid email address","Invitation sent successfully":"Invitation sent successfully","Error sending invitation":"Error sending invitation","Email is not valid!":"Email is not valid!","Data could not be loaded!":"Data could not be loaded!","Posted in":"Posted in","Invite Members Individually":"Invite Members Individually","Start a discussion":"Start a discussion","Post something":"Post something","Invite your audience":"Invite your audience","Choose Plan":"Choose Plan",or:"or","Create a link":"Create a link","Add link":"Add link","Update link":"Update link","Add shortcut to your most used tools":"Add shortcut to your most used tools","Your website, Instagram Channel, Facebook profile etc":"Your website, Instagram Channel, Facebook profile etc","Valid link name required!":"Valid link name required!","Valid url required, and make sure you are not missing http:// or https://":"Valid url required, and make sure you are not missing http:// or https://","Invite to__1":"Invite to","Link Name":"Link Name","Link URL":"Link URL","Could not subscribe to":"Could not subscribe to","Subscribed to":"Subscribed to","By default it will take up the community banner uploaded with the community":"By default it will take up the community banner uploaded with the community","Created by":"Created by","Online Event (Meeting link will be visible once registered for the event)":"Online Event (Meeting link will be visible once registered for the event)","Join Call":"Join Call","Please login to book this event":"Please login to book this event","Commented on":"Commented on","Replied to":"Replied to","Looks like it's lonely here.":"Looks like it's lonely here.","Try exploring other sections and groups.":"Try exploring other Spaces and Hubs.","Please proceed with the payment or contact admin to gain access to this group.":"Please proceed with the payment or contact admin to gain access to this Hub.","This is a closed group You'll need access to this group.":"This is a closed Hub You'll need access to this Hub.","You have no bookmarks right now.":"You have no bookmarks right now.","The user hasn't posted anything yet publicly.":"The user hasn't posted anything yet publicly.","No activity to show.":"No activity to show.","Are you sure you want to unsubscribe the community?":"Are you sure you want to unsubscribe the community?","deals left":"deals left","Something went wrong while loading posts":"Something went wrong while loading posts","Could not unsubscribe from":"Could not unsubscribe from","Unsubscribed from":"Unsubscribed from","Login to view this page":"Login to view this page",Login:"Login","There was some error while doing the action!":"There was some error while doing the action!","Unable to delete section!":"Unable to delete Space!"},Ann={"SpatialChat Communities Keyword":"German",Home:"Home","Explore Groups":"Gruppenübersicht",Events:"Veranstaltungen",Groups:"Gruppen",Links:"Links","Direct Message":"Direktnachricht","Powered by":"Bereitgestellt von","No groups here, please use + to create a new one, or join one see them here.":'Keine Gruppen hier, bitte verwende "+" um eine neue Gruppe zu erstellen oder trete einer bestehenden Gruppe bei.',"Please join a group to see them here":"Bitte trete einer Gruppe bei, um diese hier anzuzeigen","Section can only be reordered within the group!":"Der Abschnitt kann nur innerhalb der Gruppe neu angeordnet werden!","Group Page":"Gruppenseite","Invite Members":"Mitglieder einladen",Join:"Beitreten",Joined:"Beigetreten","Create new section":"Neuen Abschnitt erstellen","Group Setting drop down":"Gruppeneinstellung Dropdown-Liste",Share:"Teilen","Edit group":"Gruppe bearbeiten","Delete group":"Gruppe löschen",Leave:"Verlassen","Are you sure you want to delete the group?":"Bist du sicher, dass du die Gruppe löschen möchtest?",Cancel:"Abbrechen","Yes, Go Ahead":"Ja, weitermachen","Share via link":"Per Link teilen",Copy:"Kopieren",Copied:"Kopiert","Share on social media":"In den sozialen Medien teilen","Add Section":"Abschnitt hinzufügen","Section Header":"Abschnittskopfzeile",Live:"Live","Create post":"Beitrag erstellen","Notificaiton Bell":"Benachrichtigungs-Glocke","All posts":"Alle Beiträge","Admin posts only":"Nur Beiträge von Admins",None:"Keiner","Section Setting drop down":"Abschnittseinstellung Dropdown","Edit Section":"Abschnitt bearbeiten","Embed Section":"Eingebundener Abschnitt","Delete Section":"Abschnitt löschen","Are you sure you want to delete the section?":"Bist du sicher, dass du den Abschnitt löschen möchtest?","Section deleted!":"Abschnitt gelöscht!","Create Group Pop up / Update":"Gruppen Popup / Update erstellen","Create group":"Gruppe erstellen","Basic Detail":"Grundlegendes Detail",Settings:"Einstellungen","Size 16:9 or 1600 by 900":"Größe 16:9 oder 1600 x 900px","Group name":"Gruppenname","Enter group name":"Gib den Gruppennamen ein","Suggestions: Spaces, Channels, Groups, Blog, Knowledgebase, etc":"Vorschläge: Leerzeichen, Kanäle, Gruppen, Blog, KnowledgeBase usw.","Group Description":"Gruppenbeschreibung","Enter description here":"Gib hier eine Beschreibung ein","Group Type":"Gruppentyp",Open:"Offen","Visible to all & anyone can join":"Für jeden sichtbar und jeder kann beitreten",Closed:"Geschlossen","User will have to request to join the group":"Um der Gruppe beizutreten, muss der Benutzer eine Anfrage stellen",Paid:"Bezahlt","Group Price":"Preis für die Gruppe","Currency (Default: INR)":"Währung (Standard: INR)","User will have to pay to join the group":"Der Beitritt zu dieser Gruppe ist kostenpflichtig","Make this a private group":"Zu einer privaten Gruppe ändern","Private group will only be visible to members who are part of it. Admin can add members manually from member list":"Eine private Gruppe ist nur für Mitglieder sichtbar, die Teil davon sind. Ein Admin kann Mitglieder manuell aus der Mitgliederliste hinzufügen","Upload from device":"Vom Gerät hochladen","Search image":"Bildsuche","Valid group name required!":"Gültiger Gruppenname erforderlich!","Update Group":"Gruppe aktualisieren","SEO Settings":"SEO Einstellungen","Custom URL":"Benutzerdefinierte URL","Meta Title":"Meta-Titel","Maximum length of 255 characters allowed":"Maximale Länge von 255 Zeichen zulässig","Meta Description":"Meta Beschreibung","Open Graph Detail":"Open Graph Detail","Open Graph Title":"Open Graph Titel","Open Graph Description":"Open Graph Beschreibung","Open Graph Image":"Open Grpah Bild","Recommended dimensions: 1200px by 630px with a 1.91:1 aspect ratio.":"Empfohlene Abmessungen: 1200 x 630px mit einem Seitenverhältnis von 1,91:1.","If no URL is used, it will automatically picked your group thumbnail.":"Wird keine URL verwendet, wird automatisch das Thumbnail der Gruppe benutzt.","Create Section Pop up / Update":"Abschnitt Popup / Update erstellen","Create Section":"Abschnitt erstellen","Section Name":"Abschnitt Name","Suggestions: General, Introductions, Community Guidelines":"Vorschläge: Allgemein, Einführung, Richtlinien","Section Type":"Abschnittstyp","Post Type":"Beitragstyp","Group Chat":"Gruppenchat","Who can post in this section?":"Wer kann in diesem Abschnitt posten?","Only Admin":"Nur Admin","Any user":"Jeder Benutzer","Sorting order for section":"Sortierreihenfolge für den Abschnitt","Latest first":"Neueste Beiträge zuerst","Oldest post first":"Älterer Beitrag zuerst","Section Appearance":"Darstellung des Abschnitts","List View":"Listenansicht","Grid View":"Rasteransicht","Make this closed section":"In einen geschlossenen Abschnitt ändern","Members will have to request access to see section content":"Mitglieder müssen Zugriff beantragen, um den Inhalt des Abschnitts anzeigen zu lassen","Make this a private section":"In einen privaten Abschnitt ändern","Disables requests (Make sure closed section is selected as well).":"Anfragen deaktivieren (stelle sicher, dass der geschlossene Abschnitt ebenfalls ausgewählt ist).","Post Editor":"Beitrags-Editor","Create new post in":"Erstelle einen neuen Beitrag in","Add Cover Picture":"Titelbild hinzufügen","Heading (Optional)":"Überschrift (optional)","Write here..":"Hier schreiben...",Picture:"Bild",Video:"Video",Attachment:"Anhang",Poll:"Umfrage","Embed Code":"Code einbetten",Tags:"Tags","Toggle to question":'Zu "Frage" ändern',"Poll expire time":"Laufzeit der Umfrage","Poll question":"Umfrage","Enter Question":"Fragen eingeben",Question:"Frage",Option:"Option",Options:"Optionen","Add Option":"Option hinzufügen","Poll Expiry time":"Ende der Umfrage","12 Hours":"12 Stunden","1 Day":"1 Tag","2 Days":"2 Tage","1 Week":"1 Woche","2 Weeks":"2 Wochen","Always Open":"ohne zeitliche Beschränkung","Write embeddable code":"Schreib einen Code, der integriert werden kann","Click here to add embed code.":"Klicke hier, um Code hinzuzufügen.","Paste your embed code here!":"Füge deinen Code hier ein!","Post Settings":"Einstellungen zu Posts (Beiträgen)","Update Post":"Beitrag aktualisieren",Update:"Aktualisieren","Start meeting / Video call / Live":"Meeting / Videoanruf / Live starten","Meeting Name":"Name des Meetings","Suggestion: Group discussion etc":"Vorschlag: Gruppendiskussion usw.",Description:"Beschreibung","Enter description here (optional)":"Gib hier eine Beschreibung ein (optional)","When do you want to start the session":"Wann möchtest du das Meeting starten?","Right now":"Jetzt","Schedule for later":"Für später planen","Group video call":"Gruppen Videanruf",Webinar:"Webinar","Go Live":"Live starten","Go live":"Live starten","Info on the Post":"Infos über den Beitrag","Post comment":"Kommentar hinzufügen",Comment:"Kommentar",Comments:"Kommentare",Reply:"Antwort",Replies:"Antworten","Share via URL":"Über URL teilen","Reshare in other sections":"In anderen Abschnitten teilen","Post Card Drop Down":"Beitrags-Karte Dropdown",Bookmark:"Lesezeichen","Pin post":"Beitrag anheften",Edit:"Bearbeiten","Embed Post":"Eingebetteter Beitrag",Delete:"Löschen","Remove Pin":"Nicht mehr anheften","Remove Bookmark":"Lesezeichen entfernen","Just copy paste this code wherever you want it to be embedded":"Kopiere einfach diesen Code, und füge ihn dort ein, wo er angezeigt werden soll.",Height:"Höhe",Preview:"Vorschau","Copied to clipboard":"In die Zwischenablage kopiert","Select Widgets":"Wähle Widgets aus","Add widgets to":"Widgets hinzufügen zu","You can change their order by dragging & dropping the widgets over each other":"Du kannst die Anordnung der Widgets ändern, indem du ein Widget über ein anderes ziehst","Please note: Widget wont be displayed if there is no data available,":"Bitte beachte: Das Widget wird nicht angezeigt, wenn keine Daten verfügbar sind.","Group Members":"Gruppenmitglieder","Group Leaderboard":"Gruppen Leaderboard","Community Leaderboard":"Community Leaderboard","Trending Posts":"Top-Beiträge","Group Events":"Gruppen Events","Add Custom":"Eigenes hinzufügen","Save Widgets":"Widgets speichern","Visible to user":"Für den Benutzer sichtbar","Visible to admin":"Sichtbar für Admins","Add widget to":"Widget hinzufügen zu","Upload cover picture":"Titelbild hochladen","1:1 aspect ration (recommended)":"Verhätlnis 1:1 (empfohlen)","Card Title":"Titel der Karte","Enter widget name":"Gib den Namen des Widgets ein","Small Description (try to keep it under 50 words)":"Kurze Beschreibung (unter 50 Wörter)","Enter description":"Beschreibung eingeben","Button Title":"Titel der Schaltfläche","Enter button name":"Name der Schaltfläche eingeben","Siggestion: Know more, Join, Apply, etc":"Vorschläge: mehr erfahren, beitreten, anfragen, usw.","URL link":"URL-Link","Create custom widget":"Ein benutzerdefiniertes Widget erstellen","Custom widget created successfully":"Benutzerdefiniertes Widget erfolgreich erstellt",Widgets:"Widgets",Members:"Mitglieder","See All":"Alles anzeigen","Communtiy Top Contributors":"Communtiy Leaderboard","Community members":"Community Mitglieder","Group Top Contributors":"Gruppen Leaderboard","Upcoming Events":"Zukünftige Veranstaltungen","Home Page Banner":"Titelbild der Startseite","Edit Banner":"Titelbild bearbeiten","Home page Edit Banner Pop up":"Homepage bearbeiten Titelbild Popup","Update Banner":"Titelbild ändern",Search:"Suchen","Upload Image":"Bild hochladen",Remove:"Entfernen","Banner image (please use 16:6 ratio or 1600px by 600px image for the best view)":"Titelbild (Bitte verwende ein 16:6 oder 1600 x 600px großes Bild für die optimale Anzeige)","Banner Title":"Titelbild Titel","Enter here":"Hier eingeben","Suggestion: Welcome to my community etc":"Vorschlag: Willkommen in meiner Community, usw.","Banner Description":"Beschreibung des Titelbildes","Enter banner description":"Gib eine Beschreibung des Titelbildes ein","Save Banner Info":"Informationen zum Titelbild speichern","Home Page Feed":"Home Feed",Recent:"Neueste Beiträge","Top posts":"Top Beiträge",Trending:"Beiträge im Trend","Home Feed Groups":"Home Feed Gruppen","":"","My profile":"Mein Profil",Logout:"Abmelden",Notification:"Benachrichtigung",Notifications:"Benachrichtigungen","Mark all viewed":"Alle als gelesen markieren","has created a post":"hat einen Beitrag erstellt","wants to join":"will beitreten","has commented on your post":"hat deinen Beitrag kommentiert","has replied to your comment":"hat auf deinen Kommentar geantwortet","Search for tags":"Suche nach Tags","All groups":"Alle Gruppen","Search result":"Suchergebnis","No post found for selected hashtag":"Kein Beitrag für gesuchten Hashtag gefunden","Start a conversation":"Einen privaten Chat starten","Search by name":"Suche nach Namen",Upcoming:"Zukünftiges",UPCOMING:"ZUKÜNFTIGES",Past:"Vergangenes",PAST:"VERGANGENES","No upcoming events":"Keine zukünftigen Events","Create event popup":"Erstelle ein Event Popup","Event details":"Details des Events","16:9 aspect ratio":"16:9 Seitenverhältnis","Event name":"Name des Events","Enter event name":"Name des Events eingeben","Host Name":"Name des Hosts","You will be made host if none selected":"Du bist der Host, wenn niemand ausgewählt wurde","Write here...":"Hier schreiben...","No. of registration for the event":"Anzahl der Anmeldungen für die Veranstaltung",Unlimited:"Unbegrenzt","When & where":"Wann & Wo",From:"Von","Start date":"Startdatum",time:"Zeit",To:"bis","End date":"Enddatum","Current time zone:":"Aktuelle Zeitzone:","Can be updated from the communtiy setting":"Kann von den Einstellungen übernommen werden","Online event":"Online Event","Add meeting link":"Meeting Link hinzufügen","Meeting link will be generated once event is created":"Der Meeting Link wird generiert, sobald das Ereignis erstellt wurde",Venue:"Veranstaltungsort","Enter address":"Adresse eingeben",Create:"Erstellen",Invite:"Einladen","Share event via link":"Event über Link teilen",Copy__1:"Kopieren","Select section to post this event":"Wähle einen Abschnitt aus, um dieses Ereignis zu veröffentlichen","Once posted, members of that group or section will recieve an notification":"Nach der Veröffentlichung erhalten Mitglieder dieser Gruppe oder des Abschnitts eine Benachrichtigung",Post:"Beitrag",RSVP:"RSVP","Book Event":"Am Event teilnehmen","Yes, I'll attend":"Ja, ich werde teilnehmen","May be":"Vielleicht","No, I won't attend":"Nein, ich werde nicht teilnehmen","Date & Time":"Datum & Uhrzeit",Host:"Host","Online meeting":"Online Meeting","Meeting link will be visible once registered for the event":"Der Besprechungslink ist sichtbar, sobald du dich für das Event angemeldet hast","User Management":"Benutzerverwaltung","Go bac to community":"Zurück zur Community","Manage Members":"Mitglieder verwalten",Member:"Mitglied",Invited:"Eingeladen","Search for member":"Suche nach Mitgliedern","Add to group":"Zur Gruppe hinzufügen","Send Direct Message":"Direktnachricht senden","Change role":"Rolle ändern","Kick from community":"Aus der Community entfernen","Super Admin":"Super Admin","Super admin will have full access to the communtiy settings":"Super Admin hat vollen Zugriff auf die Community Einstellungen","Group Admin":"Gruppenadministrator","Admin of the selected group can edit the group information and create, edt or delete section under selected group":"Der Administrator der ausgewählten Gruppe kann die Gruppeninformationen bearbeiten, einen Abschnitt erstellen, bearbeiten oder löschen.","Group Moderator":"Gruppenmoderator","Group moderator can create or delete post, comment, reply & messages in the selected group.":"Gruppenmoderator kann in der ausgewählten Gruppe Posts erstellen, löschen, kommentieren und antworten.",User:"Benutzer",Save:"Speichern","User role updated successfully":"Benutzerrolle erfolgreich aktualisiert",Leaderboard:"Leaderboard","Click on the column header for sorting":"Klicke auf die Spalten-Überschrift zum Sortieren",Rank:"Rang","Karma Points":"Karmapunkte","Custom Points":"Benutzerdefinierte Punkte",Follow:"Folgen",Upvotes:"Like",Posts:"Beiträge","Add custom points":"Füge benutzerdefinierte Punkte hinzu","Subtract custom points":"Entferne benutzerdefinierte Punkte","Enter no. of points":"Gib die Anzahl der Punkte ein","Add points":"Punkte hinzufügen","Invite members to":"Mitglieder einladen zu","Invite via link":"Über Link einladen","Invite via email":"Per E -Mail einladen","Add more":"Mehr hinzufügen","Upload a CSV":"Eine CSV Datei hochladen","Please upload a comma-seprated CSV file, with header as name, email.":"Bitte lade eine durch Komma getrennte CSV-Datei mit Überschrift als Name und E-Mail hoch.","Here is a template CSV file":"Hier ist eine Vorlage der CSV-Datei","Upload File":"Datei hochladen","Send Invite":"Einladung senden","Mail Template":"Mail-Vorlage","Send Test Mail":"Test-Mail senden",Hey:"Hey","A has invite you to join the B":"du wurdest von A eingeladen der B beizutreten","Switch to rich text editor":"Wechsle zum Rich-Texteditor","Add Custom Message":"Füge eine benutzerdefinierte Nachricht hinzu","Enter message here":"Gib hier eine Nachricht ein","Send Bulk Mail":"Massen-Mail senden","Send Mail":"Mail senden","Send bulk mail to all community members or select group members":"Als Newsletter an die ganze Community senden oder wähle Gruppenmitglieder aus",Date:"Datum",Subject:"Betreff",Recipients:"Empfänger","1000 bulk emails remaining for this month. Resets on <date>":"1000 Newsletter-Mails für diesen Monat verbleibend. Zurückgesetzt am <Date>",Everyone:"Alle","Enter mail subject":"Gib einen Betreff ein","Write message":"Nachricht schreiben",Cancel__1:"Abbrechen",Send:"Senden",__1:"",Activity:"Aktivität",Bookmarks:"Lesezeichen","Edit profile":"Profil bearbeiten",Unsubscribe:"Abmelden","Settings (Account)":"Einstellungen (Konto)",Profile:"Profil","Set Profile Picture":"Füge ein Profilbild hinzu","Your name":"Dein Name","User ID":"Benutzer-ID","Short bio":"Kurzbiografie","Link your social account":"Verknüpfe deine Social Media Konten","This will be displayed on your profile":"Diese werden in deinem Profil angezeigt","Add social handle":"Social Media hinzufügen",Verification:"Verifizierung","Account Verification":"Bestätigung des Kontos",Email:"E-Mail","Enter email":"E-Mail Adresse eingeben",Verified:"Verifiziert",Unverified:"Nicht verifiziert",Change:"Ändern",Unlink:"Trennen",Mobile:"Handy","enter mobile no.":"Handynummer eingeben","Request OTP":"Bestätigungscode anfordern","Manage your personal account notification preferences":"Verwalte deine persönlichen Konto-Benachrichtigungen",Prefrences:"Einstellungen","Email notification":"E-Mail Benachrichtigung","Notify me about comments on my posts":"Benachrichtige mich über Kommentare zu meinen Beiträgen","Notify me about replies on my comments":"Benachrichtige mich über Antworten auf meine Kommentare","Notify me about likes on my posts":"Benachrichtige mich über Likes für meine Beiträge","Notify me about reaction on my comments":"Benachrichtige mich über Reaktionen auf meine Kommentare","Notify me about reaction on my reply":"Benachrichtige mich über Reaktionen auf meine Antworten","Notify me about direct message":"Benachrichtige mich über persönliche Nachrichten","Notify me about my mentions":"Benachrichtige mich über meine Erwähnungen","Notification for new posts":"Benachrichtigung über neue Beiträge","Only group & section available which you are part of":"Es sind nur Gruppen oder Abschnitte verfügbar, in denen du Mitglied bist","Group & Section":"Gruppe & Abschnitt","All activity":"Alle Aktivitäten","Post by admin":"Beitrag eines Admins","No Notification":"Keine Benachrichtigung","Setting (Community)":"Einstellung (Community)","General Settings":"Allgemeine Einstellungen","Upload community logo":"Lade das Community-Logo hoch","Community name":"Name der Community","Invalid field":"Ungültiges Feld","Your community address":"Deine Community Adresse","Fav icon":"Favicon","This will be visible on the browser tab (32px by 32px)":"Wird im Browser-TAB angezeigt (32 x 32px)",TimeZone:"Zeitzone","Privacy Policy on login page":"Datenschutzrichtlinien auf der Login-Seite","Terms & Condition on login page":"AGB auf der Login-Seite","Enter link here":"Link hier eingeben","Open Group Image":"Gruppenbild öffnen","By default ir takes up the community banner uploaded with the communtiy":"Standardmäßig wird das Titelbild der Community verwendet","Community Experience":"Community Erfahrung",Onboarding:"Onboarding","Member Fields":"Mitgliederfelder","Make your community private":"Diese Community auf privat ändern","Users will have to login or sign up to access the community":"Benutzer müssen sich registrieren oder anmelden, um auf die Community Zugriff zu haben","Make account verification mandatory for both email & mobile":"E-Mail & Handynummer müssen angegeben werden","New user will have to verify both email & mobile no. to access the community":"Ein neues Mitglied muss sowohl seine E-Mail als auch Handynummer angeben, um Zugang zur Community zu erhalten","Admin will also have to verify their mobile no. & email or else they won't be able to access the community":"Auch Admins müssen ihre E-Mail Adresse und Handynummer angeben um Zugriff auf die Community zu haben","Gated community access":"Zugriff auf die Community über ein Portal","Admin will have to approve or reject user's requests to join the community":"Ein Admin kann die Beitritts-Anfrage des Benutzers genehmigen oder ablehnen","Disable mobile login/register":"Deaktiviere Login/Registrierung mit der Handynummer","Disable email login/register":"Deaktiviere Login/Registrierung mit der E-Mail Adresse","Disable google login/register":"Deaktiviere Login/Registrierung mit Google","Disable facebook login/register":"Deaktiviere Login/Registrierung mit Facebook","Show & Hide features":"Funktionen anzeigen & ausblenden","Hide direct chat":"Privaten Chat verbergen","User will not be able to send direct messages to each other":"Benutzer können keine privaten Nachrichten senden","Hide profile picture from top right corner for mobile responsive view":'Das Profilbild in der "responsive", angepassten mobilen Ansicht in der oberen rechten Ecke nicht anzeigen',"Useful when using community in an in app browser":"Nützlich bei der Verwendung dieser Community in einem In-App-Browser","Hide profile picture from top right corner in every view":"Das Profilbild in der oberen rechten Ecke immer ausblenden","Disable header dropdown on profile picture":"Deaktiviere die Dropdown-Funktion des Profilbildes","Useful for integrated community, especially using SSO":"Nützlich für integrierte Communities, insbesondere mit SSO","Hide the communtiy logo from the header":"Das Community Logo in der Kopfzeile ausblenden","Hide the communtiy title from the header":"Den Community Namen in der Kopfzeile ausblenden","Show collpased group in the side nav bar":"Eingeklappte Gruppe in der seitlichen Navigationsleiste anzeigen","Show full expanded post in the home feed":"Zeige den ganzen Beitrag im Home-Feed an","Hide the leaderboard score from the header":"Das Leaderboard in der Kopfzeile ausblenden","Show powered by SpatialChat Communities":'powered by SpatialChat Communities" anzeigen',"Hide closed groups if not joined":"Private Gruppen für Nicht-Mitglieder ausblenden","Closed groups would not be shown to the user if they are not a member of the group":"Private Gruppen werden Nicht-Mitgliedern nicht angezeigt","Hide Community subscriber count from the users":"Mitglieder Anzahl ausblenden","This will hide the community subscriber list in the community header":"Die Community Mitglieder Liste in der Kopfzeile wird nicht angezeigt","Disable Communtiy Switcher":"Die Community Auswahl nicht anzeigen","Use MD editor for create post description":"Verwende den MD-Editor für die Beitrags-Erstellung","Non logged in user will land on explore group page instead of post directory":'Nicht eingeloggte Benutzer landen auf der Seite "Gruppeübersicht" statt im Verzeichnis der Beiträge',"Advanced configurable":"Erweiterte Konfigurierbarkeit","Communtiy default country code":"Standard-Ländercode der Community","This will show up by default on login/signup":"Dies wird standardmäßig bei der Anmeldung/Registrierung angezeigt","Onboarding/Welcome Message":"Onboarding/Begrüßungsnachricht","Welcome Message":"Begrüßungsnachricht","Greet your members with personalized message":"Begrüße Mitglieder mit einer persönlichen Nachricht","Welcome to":"Willkommen in der",Message:"Nachricht","Add message":"Nachricht hinzufügen","Custom domain":"Benutzerdefinierte Domain","Add custom domain":"Füge eine benutzerdefinierte Domain hinzu","Create new request":"Neue Anfrage erstellen","Enter your custom domain":"Gib die benutzerdefinierte Domain ein","Setup details":"Details zur Einrichtung","Add a CNAME record in your domain pointing to this community's address":"Füge der Domain einen CNAME-Eintrag hinzu, der auf die Adresse dieser Community verweist","To configure your domain, you'll need to add a CNAME record pointing your domain to your pensil community URL":"Um die Domain zu konfigurieren, müss ein CNAME-Eintrag hinzugefügt werden, der die Domain zur SpatialChat Communities-Community-URL verweist","Step by Step help apge":"Schritt für Schritt Anleitung","All request list":"Liste aller Anfragen","Allow admin to assign/un-assign custom points to users":"Administratoren können Benutzern benutzerdefinierte Punkte zuweisen bzw. die Zuweisung aufheben","Base points for user to begin with":"Basispunkte für den Benutzer zu Beginn","Base points will be updated for all the users, any changes will reflect for all the users.":"Die Basispunkte werden für alle Benutzer aktualisiert, alle Änderungen werden für alle Benutzer übernommen.","Allocate points for interaction":"Zuteilung von Punkten für Interaktion","Upvoting post":"Einen Beitrag liken","creating a comment":"Einen Kommentar verfassen","creating a reply":"Eine Antwort verfassen","Getting upvote to their post":"Upvotes auf eigene Beiträge","Getting comment to their post":"Kommentare zu eigenen Beiträgen","Getting reply to their comment":"Antworten auf eigene Kommentare","Creating a post":"Einen Beitrag erstellen",Visiblity:"Sichtbarkeit","Move Up":"Nach oben","Move Down":"Nach unten","Create embedded section":"Erstellen von eingebetteten Abschnitten","Preview area":"Vorschau","Theme selector":"Themenauswahl","Community Theme":"Community Theme","Select theme":"Theme wählen","Select brand color":"Wähle deine Marken-Farbe (CI)","Customize your button color to match your brand":"Passe die Farben von Schaltflächen an die Marke (CI) an","Select on button text color":"Wähle die Farbe des Schaltflächen-Textes","Suggestion: Keep inverted contrast against brand color":"Empfehlung: Umgekehrten Kontrast zur Markenfarbe beibehalten",Billing:"Abrechnung","Current plan":"Derzeitiger Plan","You are current on Free PLan":"Dein aktueller Plan: kostenlos","Renew on: NA":"Erneuern am: NA",Select:"Auswählen","Email us at":"Schreibe uns an","Compare plan":"Mitgliedschaften vergleichen","API Keys":"API-Schlüssel","Create new key":"Neuen API-Schlüssel erstellen","Total keys":"Gesamtanzahl der API-Schlüssel","Keep your API keys safe! You can use them to access specific feature & let cetain apps perfrom certain actions on your behalf on the platform.":"Bewahre die API-Schlüssel sicher auf! Sie können verwendet werden, um auf bestimmte Funktionen zuzugreifen und bestimmte Aktionen in deinem Namen auf der Plattform durchführen zu lassen.","Key name":"API-Schlüssel Name","Key value":"API-Schlüssel Wert",Action:"Aktionen","Group updated!":"Gruppe aktualisiert!","Are you sure you want to":"Bist du sicher, dass du das willst","Make Moderator":"Zum Moderator machen","Remove from group":"Aus der Gruppe entfernen","Show All":"Alles anzeigen","Change Role":"Rolle ändern",Close:"Schließen",copy:"Kopieren",LINKS:"LINKS","Email Id":"E-Mail Adresse",Name:"Name","Search for an image":"Nach einem Bild suchen","Crop Image":"Bild zuschneiden","No photos found":"Keine Bilder gefunden",Community:"Community","Banner ratio - 16:9":"Bannerverhältnis - 16: 9","Banner Ratio - 16:6":"Bannerverhältnis - 16: 6","Share on mail":"Über E-Mail teilen","Share on Telegram":"Auf Telegram teilen","Share on Whatsapp":"Auf WhatsApp teilen","Share on Linkedin":"Auf Linkedin teilen","Share on Facebook":"Auf Facebook teilen","Share on Twitter":"Auf Twitter teilen","Pin Post":"Post anheften","Heading (optional)":"Überschrift (optional)","Select section":"Abschnitt auswählen",Gif:"GIF","Create Custom Widget":"Benutzerdefiniertes Widget erstellen","Are you sure you want to delete this widget?":"Bist du sicher, dass du dieses Widget löschen möchtest?","Go to event":"Zur Veranstaltung","Add Tags":"Tags hinzufügen","Create Tag":"Tag erstellen","Title (Optional)":"Titel (optional)","Search Gif":"GIF suchen","What's on your mind":"Was möchtest du posten","Looks like nothing available here right now.":"Sieht aus, als wäre hier im Moment nichts verfügbar.","Try exploring other tabs":"Erkunde andere Registerkarten","Delete Widget":"Widget löschen","Please select a section to post":"Bitte wähle einen Abschnitt zum Posten","Post added successfully!":"Beitrag erfolgreich hinzugefügt!","Failed to create post. Please check post content and retry again.":"Beitrag konnte nicht erstellt werden. Bitte überprüfe den Inhalt des Beitrags und versuche es erneut.","Are you sure you want to discard current post?":"Bist du sicher, dass du den aktuellen Beitrag verwerfen möchten?","By default it will take up the image uploaded with the post":"Standardmäßig wird das mit dem Beitrag hochgeladene Bild übernommen","Quiz can be only viewed and attempted from mobile device right now!":"Man kann das Quiz jetzt nur auf mobilen Geräten sehen und teilnehmen.","Community Banner":"Community Titelbild","Change Cover":"Titelbild ändern","Suggestions: Welcome to my community etc":"Vorschläge: Willkommen in meiner Community usw.","(edited)":"(bearbeitet)","Aspect ratio (recommended)":"Seitenverhältnis (empfohlen)","Banner details updated!":"Titelbild-Details aktualisiert!","Refresh if changes are not visible!":"Aktualisieren, wenn Änderungen nicht sichtbar sind!","Banner details could not be updated!":"Titelbild-Details konnten nicht aktualisiert werden!","Post deleted":"Beitrag gelöscht","Post not available. It may have been deleted.":"Beitrag ist nicht verfügbar. Vielleicht wurde er gelöscht.",Admin:"Admin",Moderator:"Moderator","Bookmark added!":"Lesezeichen hinzugefügt!","Bookmark removed":"Lesezeichen entfernt","Failed performing action!":"Ausführung der Aktion fehlgeschlagen!","Copy this link to share on other platforms":"Kopiere diesen Link, um ihn auf anderen Plattformen zu teilen","View this event":"Sieh dir dieses Event an",Event:"Event","Join Meeting":"Beitreten","The live meeting has ended":"Das Live-Meeting ist beendet","read more...":"Weiterlesen...","Load more comments":"Weitere Kommentare laden","Post Reply":"Antworten","Post Comment":"Kommentar schreiben",more:"mehr",upvoted:"Like","1 Upvote":"1 Like","1 Comment":"1 Kommentar","Please enter a title":"Bitte gib einen Titel ein","Please enter a url link":"Bitte gib einen URL-Link ein","Please enter button title":"Bitte gib dem Button eine Bezeichnung","Button label must be at least 20 characters":"Die Bezeichnung des Buttons muss mindestens 20 Zeichen lang sein","Please enter valid url":"Bitte gib eine gültige URL ein","Suggestions: Know more, Join, Apply...":"Vorschläge: mehr erfahren, beitreten, anfragen ...",URL:"URL","Community Events":"Community Events","Widget deleted successfully":"Widget erfolgreich gelöscht","Community Top Contributors":"Community Top-Mitwirkende",points:"Punkte","Points cannot be greater than current points":"Punkte können nicht höher sein als die aktuellen Punkte","Point cannot be a negative value":"Punkte können nicht negativ sein","Point cannot be a decimal point":"Punkte können keine Dezimalstellen sein","Please enter a valid number":"Bitte gib eine gültige Nummer ein","Karma points updated successfully":"Karmapunkte erfolgreich aktualisiert","Error in updating karma points":"Fehler bei der Aktualisierung von Karmapunkten","Add karma points":"Füge Karmapunkte hinzu","Minus karma points":"Karma Punkte verringern","Total Karma points:":"Gesamtkarma-Punkte:","Enter no. of karma points":"Gib die Anzahl an Karmapunkten ein","Minus Points":"Minus Punkte","Trending Post":"Populärer Post","No visible description":"Keine sichtbare Beschreibung","Picture ratio: 1:1":"Bildverhältnis: 1:1","home feed":"Home Feed","Event name is invalid!":"Der Event Name ist ungültig!",custom:"benutzerdefiniert","Custom widget updated successfully":"Benutzerdefiniertes Widget erfolgreich aktualisiert","Name invalid!":"Name ungültig!","Current timezone:":"Aktuelle Zeitzone:","can be updated from community settings":"Kann aus den Community Einstellungen übernommen werden","Event created successfully":"Event erfolgreich erstellt","Error in creating event":"Fehler beim Erstellen des Events",Attendees:"Teilnehmer","Do you wish to notify these changes to attendees?":"Möchtest du die Teilnehmer über diese Änderungen informieren?","users wants to attend this event":"Benutzer möchten an dieser Veranstaltung teilnehmen","Yes, Notify them":"Ja, benachrichtigen","No, its okay":"Nein, danke","Do you wish to notify that event is cancelled?":"Möchtest du mitteilen, dass das Event abgesagt wurde?","Are you sure you want to delete the event?":"Sicher, dass das Event gelöscht werden soll?","Delete Event":"Event löschen","New Event":"Neues Event","Accept Invitation":"Einladung annehmen",Requested:"Angefragt",Declined:"Abgelehnt","Request Access":"Zugang anfordern","Enroll for":"Anmelden für",Housefull:"Ausgebucht","Just copy paste this code wherever you want it to be embedded:":"Kopiere einfach diesen Code und füge ihn dort ein, wo er eingebettet werden soll:",Ended:"Beendet","Error getting events":"Fehler beim Laden der Events","Events could not be fetched!":"Events konnten nicht abgerufen werden!","Show Attendees":"Teilnehmer anzeigen",Subscribers:"Abonnenten","Make this a closed section":"Zu einem geschlossenen Abschnitt ändern","Update Section":"Abschnitt Aktualisieren","Valid section name required!":"Gültiger Abschnittsname erforderlich!","Enter section name":"Abschnittsname eingeben","Community Admin":"Community Admin",Embed:"Einbetten","Invite to":"Einladen zu","Please enter a valid email address":"Bitte gib eine gültige E-Mail-Adresse ein","Invitation sent successfully":"Einladung erfolgreich gesendet","Error sending invitation":"Fehler beim Senden der Einladung","Email is not valid!":"E-Mail ist ungültig!","Data could not be loaded!":"Daten konnten nicht geladen werden!","Posted in":"Veröffentlicht in","Invite Members Individually":"Einzelne Mitglieder einladen","Start a discussion":"Eine Diskussion beginnen","Post something":"Etwas posten","Invite your audience":"Publikum einladen","Choose Plan":"Plan wählen",or:"oder","Create a link":"Link erstellen","Add link":"Link hinzufügen","Update link":"Link aktualisieren","Add shortcut to your most used tools":"Verknüpfung zu den am häufigsten verwendeten Tools hinzufügen","Your website, Instagram Channel, Facebook profile etc":"Deine Website, Instagram, Facebook-Profil usw.","Valid link name required!":"Gültiger Name des Links erforderlich!","Valid url required, and make sure you are not missing http:// or https://":"Gültige URL erforderlich, stelle sicher, dass http:// oder https:// nicht fehlen","Invite to__1":"Einladen zu","Link Name":"Name des Links","Link URL":"URL verknüpfen","Could not subscribe to":"Konnte sich nicht anmelden für","Subscribed to":"Angemeldet für","By default it will take up the community banner uploaded with the community":"Standardmäßig wird das Community-Titelbild verwendet","Created by":"Erstellt von","Online Event (Meeting link will be visible once registered for the event)":"Online-Event (Meeting-Link wird sichtbar, sobald du für das Event angemeldet bist)","Join Call":"Meeting beitreten","Please login to book this event":"Bitte melde dich an um dich für dieses Event anzumelden","Commented on":"Kommentiert am","Replied to":"Geantwortet an","Looks like it's lonely here.":"Sieht so aus, als ob hier noch nichts gepostet wurde.","Try exploring other sections and groups.":"Versuche, andere Bereiche und Gruppen zu erkunden.","Please proceed with the payment or contact admin to gain access to this group.":"Bitte führe die Zahlung durch oder kontaktiere den Admin, um Zugang zu dieser Gruppe zu erhalten.","This is a closed group You'll need access to this group.":"Dies ist eine geschlossene Gruppe du benötigst Zugang zu dieser Gruppe.","You have no bookmarks right now.":"Du hast aktuell keine Lesezeichen.","The user hasn't posted anything yet publicly.":"Der Benutzer hat noch nichts öffentlich gepostet.","No activity to show.":"Keine Aktivität zu verzeichnen.","Are you sure you want to unsubscribe the community?":"Bist du sicher, dass du dich von dieser Community abmelden möchtest?","deals left":"Angebote übrig","Something went wrong while loading posts":"Beim Laden von Beiträgen ist ein Fehler aufgetreten","Could not unsubscribe from":"Die Abmeldung konnte nicht durchgeführt werden","Unsubscribed from":"Abgemeldet von","Login to view this page":"Melde dich an, um diese Seite anzuzeigen",Login:"Anmelden","There was some error while doing the action!":"Es ist ein Fehler bei der Durchführung der Aktion aufgetreten!","Unable to delete section!":"Abschnitt kann nicht gelöscht werden!",__2:"",__3:"",__4:"","Home page":"Startseite","Members Directory":"Mitgliederverzeichnis",Calendar:"Kalender","Create Group":"Gruppe erstellen","Start Live Session":"Live-Sitzung starten",Home__1:"Home",Following:"Nachfolgend",__5:"","Post Card":"Postkarte",Like:"Like",Comment__1:"Kommentar",Comment__2:"Kommentar",Share__1:"Teilen",Report:"Bericht","Follow User":"Dem Benutzer folgen","Report User":"Benutzer melden","Report Post":"Beitrag melden",__6:"","LeaderBoard Floating pop up":"Floating-Popup der Bestenliste","Go to leaderboard":"Zur Bestenliste","Total karma points":"Gesamte Karma-Punkte",Comments__1:"Kommentare",Upvotes__1:"Upvotes",Replies__1:"Antworten",Post__1:"Post","Custom Points__1":"Benutzerdefinierte Punkte","Base Points":"Basispunkte",__7:"",Channel:"Kanal","This is a private channel":"Dies ist ein privater Kanal","You'll need access to this channel":"Du benötigst Zugriff für diesen Kanal",__8:"","Profile Page":"",Followers:"Folgen dir",Activities:"Aktivitäten",__9:"","Settings Page":"Einstellungen (Seite)","Go back to community":"Zurück zur Community",Account:"Konto","Notification Centre":"Benachrichtigungscenter",__10:"","Edit Profile Page":"","Set profile Picture":"Profilbild festlegen","Your name__1":"Dein Name",Subtitle:"Untertitel","(Max char 60)":"(maximal 60 Zeichen)","User Id":"Benutzer-ID","Short Bio":"Kurzbiografie","Link For Social Account":"Link für soziale Medien","This will be displayed on your profile__1":"Dies wird in Deinem Profil angezeigt","Add social handles":"Füge soziale Netzwerke hinzu",__11:"","Verification Page":"",Email__1:"E-Mail",Verified__1:"Verifiziert",__12:"","Manage your personal account notification preferences__1":"Verwalte die Benachrichtigungseinstellungen deines persönlichen Kontos",Preferences:"Präferenzen","Email Notification":"E-Mail-Benachrichtigung","Notify me about comment on my posts":"Benachrichtige mich über Kommentare zu meinen Beiträgen","Notify me about replies on my comment":"Benachrichtige mich über Antworten auf meinen Kommentar","Notify me about upvote on my post":"Benachrichtige mich über die positive Bewertung meines Beitrags","Notify me about reaction to my comment":"Benachrichtige mich über die Reaktion auf meinen Kommentar","Notify me about reaction on my reply__1":"Benachrichtige mich über die Reaktion auf meine Antwort","Notify me about direct message__1":"Benachrichtige mich über Direktnachrichten","Notify me about mentions":"Benachrichtige mich über Erwähnungen","Notification for new posts__1":"Benachrichtigung für neue Beiträge","Only groups and channel available which you are part of. You can also control notification":"Es stehen nur Gruppen und Kanäle zur Verfügung, denen du angehörst. Du kannst auch Benachrichtigungen steuern","Group & Channels":"Gruppe und Kanäle","All Activity":"Alle Aktivitäten","Post by admin__1":"Beiträge von Admins","No Notification__1":"Keine Benachrichtigungen",__13:"","Direct Message__1":"Direktnachricht",Inbox:"Posteingang","No chats found":"Keine Chats gefunden",__14:"","Create Post Popup":"Beitrags-Popup erstellen","Create Post in":"Beitrag erstellen in","Select Channel":"Wähle einen Kanal",__15:"","Dark mode":"Dunkler Modus",Feed:"Feed",Saved:"Gespeichert",Workflows:"Workflows",Rewards:"Belohnungen",Networking:"Networking",Course:"Kurs","Member Directory":"Mitgliederverzeichnis","Email Marketing":"E-Mail-Marketing",Analytics:"Analysen","Log out":"Abmelden","Switch community":"Community wechseln",Support:"Support","Select topic":"Thema wählen","Featured Posts":"Hervorgehobene Beiträge","Featured posts":"Hervorgehobene Beiträge",Courses:"Kurse","Explore courses and learning paths in your community.":"Entdecke die Kurse und Lernpfade deiner Community.","Add course":"Kurs hinzufügen","Search title, description, or creator…":"Titel, Beschreibung oder Ersteller suchen…","Search courses":"Kurse suchen","Clear search":"Suche löschen","Filter courses":"Kurse filtern","Sort courses":"Kurse sortieren","Clear filters":"Filter zurücksetzen","{count} course":"{count} Kurs","{count} courses":"{count} Kurse",Updating:"Wird aktualisiert","Could not load courses":"Kurse konnten nicht geladen werden","Something went wrong. Please try again.":"Etwas ist schiefgelaufen. Bitte versuche es erneut.",Retry:"Erneut versuchen","No courses found":"Keine Kurse gefunden","Try another search term or change the filter.":"Probiere einen anderen Suchbegriff oder ändere den Filter.","No courses available":"Keine Kurse verfügbar","Create the first course for your community.":"Erstelle den ersten Kurs für deine Community.","Check back when new courses are published.":"Schau später wieder vorbei, wenn neue Kurse veröffentlicht werden.","Showing {shown} of {total} course":"{shown} von {total} Kurs angezeigt","Showing {shown} of {total} courses":"{shown} von {total} Kursen angezeigt","Show less":"Weniger anzeigen","Read more":"Mehr lesen","Request sent":"Anfrage gesendet","An admin will review your enrollment request.":"Ein Admin prüft deine Anmeldeanfrage.",Enrolled:"Angemeldet","You can start learning now.":"Du kannst jetzt mit dem Lernen beginnen.","Something went wrong.":"Etwas ist schiefgelaufen.","Could not join course":"Beitritt zum Kurs nicht möglich","No lessons yet":"Noch keine Lektionen","Content will appear when lessons are published.":"Inhalte erscheinen, sobald Lektionen veröffentlicht sind.","Course deleted":"Kurs gelöscht","Could not delete course":"Kurs konnte nicht gelöscht werden","Course duplicated":"Kurs dupliziert","The copy was created as a draft.":"Die Kopie wurde als Entwurf erstellt.","Could not duplicate course":"Kurs konnte nicht dupliziert werden","Left course":"Kurs verlassen","Could not leave course":"Kurs konnte nicht verlassen werden","Continue learning":"Weiterlernen","Buy now":"Jetzt kaufen","Send request to enroll":"Anmeldeanfrage senden","Enroll now":"Jetzt anmelden","Course not found":"Kurs nicht gefunden","This course may have been removed or you lack access.":"Dieser Kurs wurde möglicherweise entfernt, oder du hast keinen Zugriff.","Back to Courses":"Zurück zum Kurs","By {name}":"Von {name}","{count} lesson":"{count} Lektion","{count} lessons":"{count} Lektionen","Total time to complete":"Gesamtdauer","Attached to {group}":"Zugeordnet zu {group}",Progress:"Fortschritt","{done}/{total} lessons · {percent}%":"{done}/{total} Lektionen · {percent} %","Edit course":"Kurs bearbeiten","Duplicate course":"Kurs duplizieren","Delete course":"Kurs löschen","Course access is included with your active paid access":"Der Kurszugang ist in deinem aktiven kostenpflichtigen Zugang enthalten","Leave course":"Kurs verlassen",Content:"Inhalt","Quiz results":"Quiz-Ergebnisse","Delete course?":"Kurs löschen?","All course content and member progress will be permanently removed.":"Alle Kursinhalte und der Fortschritt der Mitglieder werden dauerhaft entfernt.","Leave course?":"Kurs verlassen?","You will lose access to lessons until you enroll again.":"Du verlierst den Zugriff auf die Lektionen, bis du dich erneut anmeldest.","Not enrolled":"Nicht angemeldet","Course content unlocks once you are enrolled. Request access or purchase membership if required.":"Die Kursinhalte werden nach der Anmeldung freigeschaltet. Fordere Zugang an oder kaufe bei Bedarf eine Mitgliedschaft.","Add section":"Abschnitt hinzufügen","No content yet":"Noch keine Inhalte","Add a section to start building this course.":"Füge einen Abschnitt hinzu, um mit dem Aufbau dieses Kurses zu beginnen.","Content will be available when the course starts.":"Die Inhalte sind verfügbar, sobald der Kurs beginnt.","{count} comment":"{count} Kommentar","{count} comments":"{count} Kommentare","No comments on this course yet.":"Noch keine Kommentare zu diesem Kurs.","Showing {from}-{to} of {total} comments":"{from}-{to} von {total} Kommentaren angezeigt",Lesson:"Lektion","Unlocks {date}":"Wird am {date} freigeschaltet","{count} day after enrollment":"{count} Tag nach der Anmeldung","{count} days after enrollment":"{count} Tage nach der Anmeldung","Releases {date}":"Erscheint am {date}","Section deleted":"Abschnitt gelöscht","Could not delete section":"Abschnitt konnte nicht gelöscht werden","Lesson updated":"Lektion aktualisiert","Lesson added":"Lektion hinzugefügt","Could not save lesson":"Lektion konnte nicht gespeichert werden","Lesson deleted":"Lektion gelöscht","Could not delete lesson":"Lektion konnte nicht gelöscht werden","Lesson duplicated as draft":"Lektion als Entwurf dupliziert","Could not duplicate lesson":"Lektion konnte nicht dupliziert werden","Total time for this section":"Gesamtdauer dieses Abschnitts","Edit section":"Abschnitt bearbeiten","Delete section":"Abschnitt löschen","Lessons will appear here once added.":"Lektionen erscheinen hier, sobald sie hinzugefügt wurden.","Not released yet":"Noch nicht freigegeben","Complete the previous lesson first":"Schließe zuerst die vorherige Lektion ab","Time to complete":"Dauer","Actions for {title}":"Aktionen für {title}","Edit lesson":"Lektion bearbeiten","Duplicate lesson":"Lektion duplizieren","Delete lesson":"Lektion löschen",Add:"Hinzufügen","Add lesson":"Lektion hinzufügen","Delete section?":"Abschnitt löschen?",'This removes "{name}" and all lessons inside it.':"Damit werden „{name}“ und alle darin enthaltenen Lektionen entfernt.","Delete lesson?":"Lektion löschen?",'This removes "{title}" permanently.':"Damit wird „{title}“ dauerhaft entfernt.","Lesson title":"Lektionstitel",Minutes:"Minuten","Time to complete, in minutes":"Dauer in Minuten","How long this lesson takes, in minutes":"Wie lange diese Lektion dauert, in Minuten","Joined group":"Gruppe beigetreten","You're now in {group}. Enrolling you in the course…":"Du bist jetzt in {group}. Du wirst für den Kurs angemeldet…","An admin will review your group request. After you're accepted you can enroll in the course.":"Ein Admin prüft deine Gruppenanfrage. Nach der Annahme kannst du dich für den Kurs anmelden.","Could not join group":"Beitritt zur Gruppe nicht möglich","This course moved to {group}":"Dieser Kurs ist nach {group} umgezogen","Join {group} first":"Tritt zuerst {group} bei","This course is now part of “{group}”. Join its new group to continue accessing the course.":"Dieser Kurs gehört jetzt zu „{group}“. Tritt der neuen Gruppe bei, um weiter auf den Kurs zuzugreifen.","This course belongs to “{group}”. Join the group before enrolling and starting the course.":"Dieser Kurs gehört zu „{group}“. Tritt der Gruppe bei, bevor du dich anmeldest und den Kurs beginnst.","Paid group access":"Kostenpflichtiger Gruppenzugang","Membership required":"Mitgliedschaft erforderlich","Explore the available plans for {group}, choose the one that suits you, and return here after purchase to begin learning.":"Entdecke die verfügbaren Tarife für {group}, wähle den passenden aus und komm nach dem Kauf hierher zurück, um mit dem Lernen zu beginnen.","Your request to join this group is already pending. You'll be able to enroll after an admin accepts it.":"Deine Anfrage zum Beitritt zu dieser Gruppe ist noch offen. Du kannst dich anmelden, sobald ein Admin sie annimmt.","This is a {type} group. Continue to join instantly.":"Dies ist eine {type}-Gruppe. Fahre fort, um sofort beizutreten.","This is a {type} group. Continue to send a request to the group admins.":"Dies ist eine {type}-Gruppe. Fahre fort, um eine Anfrage an die Gruppen-Admins zu senden.","Explore group":"Gruppe ansehen","Join group":"Gruppe beitreten","Request to join group":"Beitritt zur Gruppe anfragen","You can watch this lecture now.":"Du kannst dir diese Lektion jetzt ansehen.","Could not enroll":"Anmeldung nicht möglich","Want to view this lecture?":"Möchtest du diese Lektion ansehen?","Your enrollment request is waiting for approval. You'll be able to watch this lecture after an admin accepts it.":"Deine Anmeldeanfrage wartet auf Genehmigung. Du kannst dir diese Lektion ansehen, sobald ein Admin sie annimmt.","Enroll in {course} to watch this lecture and the rest of the course.":"Melde dich für {course} an, um diese Lektion und den Rest des Kurses anzusehen.","Back to course":"Zurück zum Kurs","Enroll to view lecture":"Anmelden, um Lektion anzusehen","Choose a membership plan that includes {course}.":"Wähle einen Mitgliedschaftstarif, der {course} enthält.",Subscribed:"Abonniert","Payment successful":"Zahlung erfolgreich","You can now request access to this course.":"Du kannst jetzt Zugang zu diesem Kurs anfragen.","Checkout failed":"Bezahlung fehlgeschlagen","Buy group access":"Gruppenzugang kaufen","No membership plans are linked to this group yet.":"Mit dieser Gruppe sind noch keine Mitgliedschaftstarife verknüpft.","Membership plan":"Mitgliedschaftstarif","Subscribe free":"Kostenlos abonnieren","{day} at {time}":"{day} um {time}","All courses":"Alle Kurse",Published:"Veröffentlicht",Drafts:"Entwürfe","Default order":"Standardreihenfolge","Title A–Z":"Titel A–Z","Shortest first":"Kürzeste zuerst","Longest first":"Längste zuerst","Most lessons":"Meiste Lektionen",Draft:"Entwurf",Personal:"Persönlich","Community member":"Community-Mitglied","Your browser does not support video playback.":"Dein Browser unterstützt keine Videowiedergabe.","Audio resource":"Audio-Ressource","Listen without leaving the Knowledge Hub":"Hör zu, ohne den Knowledge Hub zu verlassen","Your browser does not support audio playback.":"Dein Browser unterstützt keine Audiowiedergabe.","Attached files":"Angehängte Dateien",FILE:"DATEI",Hide:"Ausblenden",View:"Ansehen",Download:"Herunterladen","Resource media":"Medien der Ressource",Audio:"Audio",Attachments:"Anhänge","About this resource":"Über diese Ressource","Saving your resource…":"Deine Ressource wird gespeichert…","Finishing the upload…":"Upload wird abgeschlossen…","Uploading 1 file · {percent}%":"1 Datei wird hochgeladen · {percent} %","Uploading {count} files · {percent}%":"{count} Dateien werden hochgeladen · {percent} %","Remove {name}":"{name} entfernen","Description cannot exceed {max} characters":"Die Beschreibung darf höchstens {max} Zeichen lang sein","Your title":"Dein Titel","Add a cover image before publishing":"Füge vor dem Veröffentlichen ein Titelbild hinzu","Resource updated":"Ressource aktualisiert","Resource shared":"Ressource geteilt","Your changes are now live.":"Deine Änderungen sind jetzt live.","It is now available in the Knowledge Hub.":"Sie ist jetzt im Knowledge Hub verfügbar.","Upload cancelled":"Upload abgebrochen","Nothing was saved. Your files are still in the form.":"Es wurde nichts gespeichert. Deine Dateien sind weiterhin im Formular.","Could not update resource":"Ressource konnte nicht aktualisiert werden","Could not share resource":"Ressource konnte nicht geteilt werden","Please try again.":"Bitte versuche es erneut.","That file is not an image":"Diese Datei ist kein Bild","Choose a PNG, JPG or WebP for the cover.":"Wähle ein PNG, JPG oder WebP als Titelbild.","Couldn't use that cover":"Dieses Titelbild kann nicht verwendet werden","Pick another one, or choose a picture of your own.":"Wähle ein anderes oder ein eigenes Bild.","Couldn't open the current cover":"Aktuelles Titelbild konnte nicht geöffnet werden","Choose the image again to crop it.":"Wähle das Bild erneut aus, um es zuzuschneiden.","Video too large":"Video zu groß","Videos can be up to {limit}.":"Videos dürfen bis zu {limit} groß sein.","That file is not audio":"Diese Datei ist kein Audio","Choose an MP3, M4A, WAV or other audio file.":"Wähle eine MP3-, M4A-, WAV- oder andere Audiodatei.","Audio too large":"Audio zu groß","Audio files can be up to {size} MB.":"Audiodateien dürfen bis zu {size} MB groß sein.","File too large":"Datei zu groß","{count} files too large":"{count} Dateien zu groß",'"{name}" was not added. Files can be up to {limit}.':"„{name}“ wurde nicht hinzugefügt. Dateien dürfen bis zu {limit} groß sein.","{names} were not added. Files can be up to {size} MB ({videoLimit} for a video).":"{names} wurden nicht hinzugefügt. Dateien dürfen bis zu {size} MB groß sein ({videoLimit} bei Videos).","Up to 5 attachments":"Bis zu 5 Anhänge","Only the first {count} file was added.":"Nur {count} Datei wurde hinzugefügt.","Only the first {count} files were added.":"Nur die ersten {count} Dateien wurden hinzugefügt.","Remove one to add another.":"Entferne eine, um eine weitere hinzuzufügen.","Edit resource":"Ressource bearbeiten","Share a resource":"Ressource teilen","Update your resource. Saved changes will appear immediately.":"Aktualisiere deine Ressource. Gespeicherte Änderungen erscheinen sofort.","Add a cover and a description, then optionally a video, an audio file and files to download.":"Füge ein Titelbild und eine Beschreibung hinzu, optional dazu ein Video, eine Audiodatei und Dateien zum Herunterladen.",Details:"Details","Cover image file":"Titelbild-Datei","Video file":"Videodatei","Audio file":"Audiodatei","Attachment files":"Anhangsdateien","Cover image":"Titelbild","The picture on this resource's card in the library. It is not a download. After you pick a picture you choose which part to show, in the card's 16:9 shape, so nothing is cut off in the library. A large photo is resized before it is sent, so it uploads faster; the original on your device is not changed.":"Das Bild auf der Karte dieser Ressource in der Bibliothek. Es ist kein Download. Nach der Bildauswahl legst du fest, welcher Ausschnitt im 16:9-Format der Karte gezeigt wird, damit in der Bibliothek nichts abgeschnitten wird. Große Fotos werden vor dem Senden verkleinert, damit sie schneller hochgeladen werden; das Original auf deinem Gerät bleibt unverändert.","Cover preview":"Vorschau des Titelbilds","Choose a cover image":"Titelbild auswählen","PNG, JPG or WebP · you choose the part to show next":"PNG, JPG oder WebP · den Ausschnitt wählst du als Nächstes","Replace cover":"Titelbild ersetzen","Remove cover":"Titelbild entfernen","Without a cover, the card shows a plain one in the community's colour.":"Ohne Titelbild zeigt die Karte ein schlichtes Bild in der Farbe der Community.","Current cover":"Aktuelles Titelbild","Adjust crop":"Zuschnitt anpassen","No picture to hand? Use a ready-made cover":"Kein Bild zur Hand? Nutze ein vorgefertigtes Titelbild","Cover subjects":"Titelbild-Themen","All ({count})":"Alle ({count})","Earlier covers":"Frühere Titelbilder","Ready-made covers":"Vorgefertigte Titelbilder","Use the {name} cover":"Titelbild {name} verwenden","More covers":"Weitere Titelbilder",Title:"Titel","What will members learn?":"Was werden Mitglieder lernen?","Shorten the title to {max} characters or fewer.":"Kürze den Titel auf höchstens {max} Zeichen.","Share context, key takeaways, and why this is useful…":"Teile den Kontext, die wichtigsten Erkenntnisse und warum das nützlich ist…","Formatting counts toward the limit. Shorten the description to {max} characters or fewer.":"Formatierung zählt zum Limit. Kürze die Beschreibung auf höchstens {max} Zeichen.","Media to play":"Medien zum Abspielen","(optional)":"(optional)","Members watch or listen to these inside the resource.":"Mitglieder sehen oder hören diese direkt in der Ressource.","· one video, up to {limit}, or a link":"· ein Video, bis zu {limit}, oder ein Link","Current uploaded video":"Aktuell hochgeladenes Video","Already uploaded":"Bereits hochgeladen","Upload video":"Video hochladen","YouTube or Vimeo URL":"YouTube- oder Vimeo-URL","Enter a valid YouTube or Vimeo link.":"Gib einen gültigen YouTube- oder Vimeo-Link ein.","· one audio file":"· eine Audiodatei","Current audio file":"Aktuelle Audiodatei","Upload audio":"Audio hochladen","Files to download":"Dateien zum Herunterladen","PDFs, Word, Excel or any other file members can download · {count}/5":"PDFs, Word, Excel oder andere Dateien, die Mitglieder herunterladen können · {count}/5","Add files":"Dateien hinzufügen","PDF preview":"PDF-Vorschau","PDF attachment preview":"Vorschau des PDF-Anhangs","This is how members will see your resource. Nothing is shared until you save.":"So sehen Mitglieder deine Ressource. Es wird nichts geteilt, bis du speicherst.","This is how members will see your resource. Nothing is shared until you publish.":"So sehen Mitglieder deine Ressource. Es wird nichts geteilt, bis du veröffentlichst.","When opened":"Beim Öffnen","In the library":"In der Bibliothek","{done}/{total} done":"{done}/{total} erledigt","Upload progress":"Upload-Fortschritt","Keep this window open until it finishes.":"Lass dieses Fenster geöffnet, bis der Vorgang abgeschlossen ist.","Cancel upload":"Upload abbrechen","Save changes":"Änderungen speichern","Publish resource":"Ressource veröffentlichen","Choose what shows on the cover":"Wähle, was auf dem Titelbild gezeigt wird","Knowledge Hub":"Knowledge Hub","You created this resource.":"Du hast diese Ressource erstellt.","Moderator actions":"Moderationsaktionen","This file can't be previewed. Use Download instead.":"Diese Datei kann nicht in der Vorschau angezeigt werden. Nutze stattdessen Herunterladen.","Resource deleted":"Ressource gelöscht","Could not delete resource":"Ressource konnte nicht gelöscht werden","This resource is no longer available":"Diese Ressource ist nicht mehr verfügbar","Couldn't open that resource":"Ressource konnte nicht geöffnet werden","It may have been deleted. Here is the rest of the library.":"Sie wurde möglicherweise gelöscht. Hier ist der Rest der Bibliothek.","Community library":"Community-Bibliothek","Useful ideas, explainers and media shared by your community.":"Nützliche Ideen, Erklärungen und Medien, die deine Community teilt.","Search title, description, or author…":"Titel, Beschreibung oder Autor suchen…","Search Knowledge Hub resources":"Ressourcen im Knowledge Hub suchen","All content types":"Alle Inhaltstypen","Any date":"Beliebiges Datum","Past 7 days":"Letzte 7 Tage","Past 30 days":"Letzte 30 Tage","Past 90 days":"Letzte 90 Tage","Custom dates":"Eigener Zeitraum","Sort resources":"Ressourcen sortieren","Newest first":"Neueste zuerst","Most liked":"Am beliebtesten","Could not load the Knowledge Hub":"Knowledge Hub konnte nicht geladen werden","Please check your connection and try again.":"Bitte überprüfe deine Verbindung und versuche es erneut.","Build your community library":"Baue die Bibliothek deiner Community auf","Share the first useful guide, talk, or audio resource with everyone.":"Teile als Erstes einen nützlichen Leitfaden, Vortrag oder eine Audio-Ressource mit allen.","Share the first resource":"Erste Ressource teilen","No resources found":"Keine Ressourcen gefunden","Try another search term or change the filters.":"Probiere einen anderen Suchbegriff oder ändere die Filter.","Showing {shown} of {total} resource":"{shown} von {total} Ressource angezeigt","Showing {shown} of {total} resources":"{shown} von {total} Ressourcen angezeigt","Delete this resource?":"Diese Ressource löschen?","“{title}” will be permanently removed from the Knowledge Hub. This action cannot be undone.":"„{title}“ wird dauerhaft aus dem Knowledge Hub entfernt. Diese Aktion kann nicht rückgängig gemacht werden.","Delete resource":"Ressource löschen","Remove your like":"Dein „Gefällt mir“ entfernen","Like this resource":"Diese Ressource mit „Gefällt mir“ markieren","You like this. Click to remove your like.":"Dir gefällt das. Klicke, um dein „Gefällt mir“ zu entfernen.","Link copied":"Link kopiert","It opens this resource in the Knowledge Hub.":"Er öffnet diese Ressource im Knowledge Hub.","Couldn't copy link":"Link konnte nicht kopiert werden","Post in review":"Beitrag in Prüfung","An admin will review it before it appears.":"Ein Admin prüft ihn, bevor er erscheint.",Shared:"Geteilt","Posted to {channel}":"In {channel} gepostet","Couldn't share the resource":"Ressource konnte nicht geteilt werden","Copy link":"Link kopieren","Post to a channel":"In einem Kanal posten","Send in a message":"In einer Nachricht senden","Posts “{title}” with a link that opens it in the Knowledge Hub.":"Postet „{title}“ mit einem Link, der die Ressource im Knowledge Hub öffnet.","Select channel":"Kanal auswählen","Add a message to introduce this to your community (optional). Type @ to mention someone.":"Füge eine Nachricht hinzu, um es deiner Community vorzustellen (optional). Tippe @, um jemanden zu erwähnen.","Posting…":"Wird gepostet…","Share it in a message. The link opens the resource in the Knowledge Hub.":"Teile sie in einer Nachricht. Der Link öffnet die Ressource im Knowledge Hub.","{count} file":"{count} Datei","{count} files":"{count} Dateien","Open {title} in the Knowledge Hub":"{title} im Knowledge Hub öffnen","Like this course":"Diesen Kurs mit „Gefällt mir“ markieren","It opens this course's page.":"Er öffnet die Seite dieses Kurses.","Posts “{title}” as a card members can like and open. Enrolling works as it does on the course page.":"Veröffentlicht „{title}“ als Karte, die Mitglieder liken und öffnen können. Die Einschreibung funktioniert wie auf der Kursseite.","Couldn't share the course":"Der Kurs konnte nicht geteilt werden","Share it in a message. The link opens the course's page.":"Teile ihn in einer Nachricht. Der Link öffnet die Seite des Kurses.","Open the course {title}":"Den Kurs {title} öffnen","Paid plan":"Bezahlter Plan","Unlock {feature}":"{feature} freischalten","Your current plan doesn't include it. Choose a plan to start using it.":"Dein aktueller Plan enthält das nicht. Wähle einen Plan, um es zu nutzen.","Included in every paid plan, from {price}.":"In jedem bezahlten Plan enthalten, ab {price}.","Included in every paid plan.":"In jedem bezahlten Plan enthalten.","See plans":"Pläne ansehen","Maybe later":"Vielleicht später","Reach your members in their inbox with campaigns, newsletters, sequences, funnels and forms.":"Erreiche deine Mitglieder in ihrem Postfach mit Kampagnen, Newslettern, Sequenzen, Funnels und Formularen.","Send campaigns and newsletters to your audience":"Sende Kampagnen und Newsletter an deine Zielgruppe","Automated sequences, funnels and sign-up forms":"Automatisierte Sequenzen, Funnels und Anmeldeformulare","Audience management and delivery analytics":"Zielgruppenverwaltung und Zustellungsanalysen","Automate your community: act when members join, post or reach a milestone, without writing code.":"Automatisiere deine Community: Reagiere, wenn Mitglieder beitreten, posten oder einen Meilenstein erreichen, ganz ohne Code.","Automations triggered by joins, posts, streaks and more":"Automatisierungen, ausgelöst durch Beitritte, Beiträge, Serien und mehr","Multi-step actions: notify, tag, award points, send email":"Mehrstufige Aktionen: benachrichtigen, taggen, Punkte vergeben, E-Mail senden","Ready-made templates to start in minutes":"Fertige Vorlagen für einen Start in wenigen Minuten","Member Analytics":"Mitglieder-Analytics","See how each member uses your community: time spent, sessions and the pages they visit.":"Sieh, wie jedes Mitglied deine Community nutzt: verbrachte Zeit, Sitzungen und besuchte Seiten.","Time spent and sessions for every member":"Verbrachte Zeit und Sitzungen für jedes Mitglied","Page journeys: where members go and for how long":"Seitenpfade: wohin Mitglieder gehen und wie lange","Look up any member in Insights":"Jedes Mitglied in Insights nachschlagen","Content category":"Inhaltskategorie","Content categories":"Inhaltskategorien","All categories":"Alle Kategorien","No category":"Keine Kategorie","Add “{name}”":"„{name}“ hinzufügen","Filter by content category":"Nach Inhaltskategorie filtern","Search categories":"Kategorien suchen","Search or type a new category":"Suchen oder neue Kategorie eingeben","Loading…":"Wird geladen…","Couldn't load categories. Try again.":"Kategorien konnten nicht geladen werden. Bitte erneut versuchen.","No categories match.":"Keine Kategorie passt.",Author:"Autor",Authors:"Autoren","All authors":"Alle Autoren","Search authors":"Autoren suchen","Filter by author":"Nach Autor filtern","Couldn't load authors. Try again.":"Autoren konnten nicht geladen werden. Bitte erneut versuchen.","No authors match.":"Kein Autor passt.","No resources have been shared yet.":"Bisher wurden keine Ressourcen geteilt.","No courses have been made yet.":"Bisher wurden keine Kurse erstellt.","Shows only the resources one member has shared. The list has everyone who has shared a resource here, with how many each has shared; type a name to find someone. You can combine it with the other filters and the search box.":"Zeigt nur die Ressourcen, die ein Mitglied geteilt hat. Die Liste enthält alle, die hier eine Ressource geteilt haben, mit der jeweiligen Anzahl; tippe einen Namen, um jemanden zu finden. Kombinierbar mit den anderen Filtern und der Suche.","No resource has a category yet.":"Noch keine Ressource hat eine Kategorie.","Show more":"Mehr anzeigen","What kind of resource this is, such as a research paper or an opinion piece. Members can filter the Knowledge Hub by it. Pick one, or type your own and choose Add.":"Was für eine Ressource das ist, etwa eine Forschungsarbeit oder ein Meinungsbeitrag. Mitglieder können den Knowledge Hub danach filtern. Wähle eine aus oder gib eine eigene ein und wähle Hinzufügen.",Filters:"Filter","{count} applied":"{count} aktiv","Content type":"Inhaltstyp","Date shared":"Geteilt am","Remove filter {name}":"Filter {name} entfernen","Research Paper":"Forschungsarbeit",Article:"Artikel","Lecture/Talk":"Vortrag","Opinion Piece":"Meinungsbeitrag",General:"Allgemein",Football:"Fußball",Education:"Bildung",Physiotherapy:"Physiotherapie",Coaching:"Coaching","Sports Science":"Sportwissenschaft","Strength & Conditioning":"Kraft & Kondition",Recovery:"Regeneration",Nutrition:"Ernährung",Medicine:"Medizin",Health:"Gesundheit",Cars:"Autos",Entertainment:"Unterhaltung",Programming:"Programmierung",Technology:"Technologie",Business:"Business",Science:"Wissenschaft",Engineering:"Ingenieurwesen",Sports:"Sport",Arts:"Kunst",Travel:"Reisen",Food:"Essen",Resources:"Ressourcen","Could not load this course.":"Dieser Kurs konnte nicht geladen werden.","Back to course overview":"Zurück zur Kursübersicht","Preview as learner":"Als Lernender ansehen","Close table of contents":"Inhaltsverzeichnis schließen","Join {group} to continue learning.":"Tritt {group} bei, um weiterzulernen.","the course's current group":"die aktuelle Gruppe des Kurses","Enroll in this course to watch the lecture.":"Melde dich für diesen Kurs an, um die Lektion anzusehen.","Next lesson":"Nächste Lektion","Table of contents":"Inhaltsverzeichnis","Add a section to start building content.":"Füge einen Abschnitt hinzu, um mit dem Aufbau der Inhalte zu beginnen.","No lessons available yet.":"Noch keine Lektionen verfügbar.","Lesson completed":"Lektion abgeschlossen","Marked incomplete":"Als nicht abgeschlossen markiert","Could not update progress":"Fortschritt konnte nicht aktualisiert werden","Mark incomplete":"Als nicht abgeschlossen markieren","Mark complete":"Als abgeschlossen markieren","You need to join this course before you can view its lessons.":"Du musst diesem Kurs beitreten, bevor du seine Lektionen ansehen kannst.","Go to course overview":"Zur Kursübersicht","No lesson selected":"Keine Lektion ausgewählt","Pick a lesson from the table of contents.":"Wähle eine Lektion aus dem Inhaltsverzeichnis.","Lesson {current} of {total}":"Lektion {current} von {total}","This lesson has no written content yet.":"Diese Lektion hat noch keinen geschriebenen Inhalt.",Block:"Block","In this lesson":"In dieser Lektion","Lesson content":"Lektionsinhalt",Completed:"Abgeschlossen","Completed {date}":"Abgeschlossen am {date}","Open PDF":"PDF öffnen","Quick check":"Schnelltest",Assignment:"Aufgabe","Submit your work in the lesson discussion below.":"Reiche deine Arbeit unten in der Lektionsdiskussion ein.",Quiz:"Quiz","Could not save quiz.":"Quiz konnte nicht gespeichert werden.","Could not submit quiz":"Quiz konnte nicht abgesendet werden","Select all answers that apply.":"Wähle alle zutreffenden Antworten aus.","This is an open-ended check — continue when you are ready.":"Dies ist eine offene Aufgabe – mach weiter, wenn du bereit bist.","Submit quiz":"Quiz absenden","You {status} the quiz.":"Du hast das Quiz {status}.",passed:"bestanden","didn't pass":"nicht bestanden","Great job!":"Gut gemacht!","Review the answers below, then try again.":"Sieh dir die Antworten unten an und versuche es dann erneut.","Retake quiz":"Quiz wiederholen",Score:"Ergebnis","Correct answers":"Richtige Antworten",Correct:"Richtig",Incorrect:"Falsch",You:"Du","Could not post your comment":"Dein Kommentar konnte nicht gepostet werden","Could not update the comment":"Kommentar konnte nicht aktualisiert werden","Could not delete the comment":"Kommentar konnte nicht gelöscht werden",Discussion:"Diskussion","Loading comments…":"Kommentare werden geladen…","No comments yet — start the discussion.":"Noch keine Kommentare – starte die Diskussion.","Add to the discussion…":"Beteilige dich an der Diskussion…","Redirecting now…":"Weiterleitung läuft…","Redirecting in {count} second":"Weiterleitung in {count} Sekunde","Redirecting in {count} seconds":"Weiterleitung in {count} Sekunden","Lesson complete":"Lektion abgeschlossen","Up next":"Als Nächstes",Stay:"Bleiben",Continue:"Weiter","Quiz result":"Quiz-Ergebnis","Question-by-question review of this learner's quiz attempt.":"Frage-für-Frage-Auswertung des Quizversuchs dieses Lernenden.","Attempts: {count}":"Versuche: {count}",Submitted:"Abgesendet","You received {points} karma point.":"Du hast {points} Karma-Punkt erhalten.","You received {points} karma points.":"Du hast {points} Karma-Punkte erhalten.","Congratulations!":"Glückwunsch!","You've successfully completed {course}.":"Du hast {course} erfolgreich abgeschlossen.","Keep reviewing":"Weiter wiederholen",Text:"Text","Send feedback":"Feedback senden","You can attach up to {max} screenshots":"Du kannst bis zu {max} Screenshots anhängen","Only the first {count} screenshot was added":"Nur {count} Screenshot wurde hinzugefügt","Only the first {count} screenshots were added":"Nur die ersten {count} Screenshots wurden hinzugefügt","Unsupported image type":"Nicht unterstützter Bildtyp","Larger than 10 MB":"Größer als 10 MB","Upload failed":"Upload fehlgeschlagen","Add a short title.":"Füge einen kurzen Titel hinzu","Please add a bit more detail ({min}+ characters).":"Bitte füge etwas mehr Details hinzu ({min}+ Zeichen)","Bug report sent":"Fehlerbericht gesendet","Idea sent":"Idee gesendet","Thanks! The SpatialChat Communities team will take a look.":"Danke! Das SpatialChat Communities-Team schaut es sich an.","Couldn't send your feedback":"Dein Feedback konnte nicht gesendet werden","Report a problem or suggest an improvement to the SpatialChat Communities team.":"Melde dem SpatialChat Communities-Team ein Problem oder schlage eine Verbesserung vor.","Feedback type":"Feedback-Typ","Report a bug":"Fehler melden","Suggest an idea":"Idee vorschlagen","e.g. Verify code shows “Validation error!”":"z. B. Verifizierungscode zeigt „Validierungsfehler!“","e.g. Let me schedule posts":"z. B. Beiträge planen können","What happened?":"Was ist passiert?","What would you like?":"Was wünschst du dir?","What did you do, what did you expect, and what happened instead?":"Was hast du getan, was hast du erwartet und was ist stattdessen passiert?","What problem are you trying to solve? How would this help you?":"Welches Problem willst du lösen? Wie würde dir das helfen?",Screenshots:"Screenshots","(optional, up to {max})":"(optional, bis zu {max})",Uploading:"Wird hochgeladen","Add screenshot":"Screenshot hinzufügen","or drop / paste (Ctrl/⌘+V) an image":"oder Bild hierher ziehen / einfügen (Strg/⌘+V)","Screenshots that failed to upload won't be sent. Remove them or try again.":"Screenshots, deren Upload fehlgeschlagen ist, werden nicht gesendet. Entferne sie oder versuche es erneut.","Include technical details":"Technische Details einschließen","(recommended)":"(empfohlen)","Page, browser, and no recent errors. Passwords, tokens and emails are removed.":"Seite, Browser und keine aktuellen Fehler. Passwörter, Tokens und E-Mail-Adressen werden entfernt.","Page, browser, and {count} recent error. Passwords, tokens and emails are removed.":"Seite, Browser und {count} aktueller Fehler. Passwörter, Tokens und E-Mail-Adressen werden entfernt.","Page, browser, and {count} recent errors. Passwords, tokens and emails are removed.":"Seite, Browser und {count} aktuelle Fehler. Passwörter, Tokens und E-Mail-Adressen werden entfernt.","Page: {path}":"Seite: {path}","Browser: {browser}":"Browser: {browser}","Screen: {width}x{height} · Build: {version}":"Bildschirm: {width}x{height} · Build: {version}","No errors captured in this session.":"In dieser Sitzung wurden keine Fehler erfasst.","The SpatialChat Communities team may contact me about this":"Das SpatialChat Communities-Team darf mich dazu kontaktieren","Uploading…":"Wird hochgeladen…","Send report":"Bericht senden","Send idea":"Idee senden","{points} earned":"{points} verdient","{points} to spend":"{points} zum Ausgeben","Profile picture updated":"Profilbild aktualisiert","Couldn't update picture":"Bild konnte nicht aktualisiert werden","Cover photo updated":"Titelbild aktualisiert","Couldn't update cover":"Titelbild konnte nicht aktualisiert werden","Link copied!":"Link kopiert!","Profile link copied to clipboard.":"Profil-Link in die Zwischenablage kopiert.",Cover:"Titelbild","Joined {date}":"Beigetreten am {date}","Badges & achievements":"Abzeichen & Erfolge","No badges earned yet — stay active to unlock your first one.":"Noch keine Abzeichen verdient – bleib aktiv, um dein erstes freizuschalten.",Badge:"Abzeichen","You haven't posted yet.":"Du hast noch nichts gepostet.","No activity yet.":"Noch keine Aktivität.","Adjust cover photo":"Titelbild anpassen","Add a bio and interests from":"Füge eine Bio und Interessen hinzu über","to fill out your About section.":"um deinen Bereich „Über mich“ auszufüllen.",Bio:"Bio",Interests:"Interessen","No achievement badges are configured for this community yet.":"Für diese Community sind noch keine Erfolgsabzeichen eingerichtet.","Earned {date}":"Verdient am {date}","Profile updated":"Profil aktualisiert","Your changes have been saved.":"Deine Änderungen wurden gespeichert.","Couldn't save profile":"Profil konnte nicht gespeichert werden",Username:"Benutzername","Checking availability…":"Verfügbarkeit wird geprüft…","Username is available":"Benutzername ist verfügbar","Username is taken":"Benutzername ist bereits vergeben","3–64 chars: letters, numbers, _ or .":"3–64 Zeichen: Buchstaben, Zahlen, _ oder .",Headline:"Überschrift",Location:"Standort","Social links":"Social-Media-Links","Saving…":"Wird gespeichert…","Couldn't update preference":"Einstellung konnte nicht aktualisiert werden","Email notifications":"E-Mail-Benachrichtigungen","Choose which activity on your content sends you an email.":"Wähle, welche Aktivität bei deinen Inhalten dir eine E-Mail sendet.","Posts created":"Erstellte Beiträge","Comments made":"Verfasste Kommentare","Replies made":"Verfasste Antworten","Likes given":"Vergebene Likes","Likes on your posts":"Likes für deine Beiträge","Your posts commented":"Deine kommentierten Beiträge","Your replies received":"Deine erhaltenen Antworten","Followers gained":"Gewonnene Follower","Live sessions":"Live-Sessions","Admin-assigned":"Von Admins vergeben",Other:"Sonstiges","How you earned your {points}":"Wie du deine {points} verdient hast","No points yet — post, comment and react to start earning.":"Noch keine Punkte – poste, kommentiere und reagiere, um welche zu sammeln.","Language updated":"Sprache aktualisiert","Using the community's language":"Die Sprache der Community wird verwendet","Only you see this change.":"Nur du siehst diese Änderung.","Couldn't change your language":"Sprache konnte nicht geändert werden",Language:"Sprache","Menus, buttons and labels are shown in the language you pick here, for you only. Posts, comments and messages stay in the language they were written in. Other members keep the community's language unless they pick their own.":"Menüs, Schaltflächen und Beschriftungen werden in der hier gewählten Sprache angezeigt, nur für dich. Beiträge, Kommentare und Nachrichten bleiben in der Sprache, in der sie geschrieben wurden. Andere Mitglieder behalten die Sprache der Community, sofern sie keine eigene wählen.","Choose the language you read this community in.":"Wähle die Sprache, in der du diese Community liest.","My language":"Meine Sprache","Community default":"Community-Standard","Console error":"Konsolenfehler","Console warning":"Konsolenwarnung",Crash:"Absturz","Unhandled error":"Unbehandelter Fehler","Failed request":"Fehlgeschlagene Anfrage",About:"Über",Achievements:"Erfolge",Website:"Website",Silver:"Silber",Gold:"Gold",Platinum:"Platin",Diamond:"Diamant",Elite:"Elite","Comments on my posts":"Kommentare zu meinen Beiträgen","When someone comments on your post":"Wenn jemand deinen Beitrag kommentiert","Replies to my comments":"Antworten auf meine Kommentare","When someone replies to your comment":"Wenn jemand auf deinen Kommentar antwortet","Likes on my posts":"Likes für meine Beiträge","When someone likes your post":"Wenn jemand deinen Beitrag likt","Reactions to my comments":"Reaktionen auf meine Kommentare","When someone reacts to your comment":"Wenn jemand auf deinen Kommentar reagiert","Reactions to my replies":"Reaktionen auf meine Antworten","When someone reacts to your reply":"Wenn jemand auf deine Antwort reagiert","Direct messages":"Direktnachrichten","When you receive a direct message":"Wenn du eine Direktnachricht erhältst",Mentions:"Erwähnungen","When someone @mentions you":"Wenn dich jemand @erwähnt","Load more {label}":"Mehr {label} laden","Loading more {label}…":"Weitere {label} werden geladen…",courses:"Kurse",resources:"Ressourcen",items:"Elemente","About {label}":"Über {label}","Couldn't like this course":"Der Kurs konnte nicht mit „Gefällt mir“ markiert werden","Couldn't like this resource":"Die Ressource konnte nicht mit „Gefällt mir“ markiert werden","Couldn't remove your like":"Dein „Gefällt mir“ konnte nicht entfernt werden","Notify members":"Mitglieder benachrichtigen","Sends everyone in the community a notification about this resource, in the app and as a push notification on their phone or browser. Members who turned off notifications for this community don't get it.":"Schickt allen in der Community eine Benachrichtigung über diese Ressource – in der App und als Push-Nachricht auf Handy oder Browser. Mitglieder, die Benachrichtigungen für diese Community ausgeschaltet haben, erhalten sie nicht.","It is now available in the Knowledge Hub, and members are being notified.":"Sie ist jetzt im Knowledge Hub verfügbar, und die Mitglieder werden benachrichtigt.","How posts are ordered":"Wie Beiträge sortiert werden","Recent: newest first. Top posts: the most likes, of all time; comments don't change the order. Trending: the most likes and comments together, within the period you pick. Following: posts by people you follow.":"Neueste: die neuesten zuerst. Top-Beiträge: die meisten Likes, seit jeher; Kommentare ändern die Reihenfolge nicht. Trends: die meisten Likes und Kommentare zusammen im gewählten Zeitraum. Folge ich: Beiträge von Personen, denen du folgst.","Save this resource":"Diese Ressource speichern","Save this course":"Diesen Kurs speichern","Remove from saved":"Aus Gespeichert entfernen","Saved. Click to remove it from your saved list.":"Gespeichert. Klicke, um es aus deiner Liste zu entfernen.","Find it any time under Saved in the Knowledge Hub.":"Du findest es jederzeit unter Gespeichert im Knowledge Hub.","Find it any time under Saved on the Courses page.":"Du findest es jederzeit unter Gespeichert auf der Kursseite.","Couldn't save this resource":"Ressource konnte nicht gespeichert werden","Couldn't save this course":"Kurs konnte nicht gespeichert werden","Couldn't remove it from saved":"Konnte nicht aus Gespeichert entfernt werden","All resources":"Alle Ressourcen",Show:"Anzeigen","Press the bookmark on anything to save it here for later. Only you can see what you saved.":"Tippe auf das Lesezeichen, um etwas hier für später zu speichern. Nur du siehst, was du gespeichert hast.","Date range":"Zeitraum",Today:"Heute","Last 7 days":"Letzte 7 Tage","Last 4 weeks":"Letzte 4 Wochen","Last 6 months":"Letzte 6 Monate","Last 12 months":"Letzte 12 Monate","Month to date":"Monat bis heute","Quarter to date":"Quartal bis heute","Year to date":"Jahr bis heute","All time":"Gesamter Zeitraum",Start:"Beginn",End:"Ende",Clear:"Zurücksetzen",Apply:"Anwenden","Couldn't download this file":"Datei konnte nicht heruntergeladen werden","A new category is saved with capital letters, so “fancy dress” becomes “Fancy Dress”, and one that already exists is reused rather than added twice.":"Eine neue Kategorie wird mit großen Anfangsbuchstaben gespeichert, aus „fancy dress“ wird also „Fancy Dress“, und eine bereits vorhandene Kategorie wird wiederverwendet statt doppelt angelegt.","Job title":"Berufsbezeichnung","Your role, such as Head of Sports Science or Team Physiotherapist. It shows under your name in the member directory and on your profile, so members know who to contact.":"Deine Rolle, zum Beispiel Leitung Sportwissenschaft oder Team-Physiotherapeut. Sie steht im Mitgliederverzeichnis und auf deinem Profil unter deinem Namen, damit Mitglieder wissen, an wen sie sich wenden können.","e.g. Head of Sports Science":"z. B. Leitung Sportwissenschaft","Type where you are based, or use your current location: your browser asks first, and only the town and country are filled in. Your exact position is never saved. Check it, then save your profile.":"Gib ein, wo du ansässig bist, oder nutze deinen aktuellen Standort: Dein Browser fragt zuerst, und nur Ort und Land werden eingetragen. Deine genaue Position wird nie gespeichert. Prüfe ihn und speichere dann dein Profil.","e.g. Stockholm, Sweden":"z. B. Stockholm, Schweden","Finding you…":"Standort wird ermittelt…","Use my location":"Meinen Standort verwenden","Please enter your location, or use your current location.":"Bitte gib deinen Standort ein oder nutze deinen aktuellen Standort.","Fields marked * are required.":"Mit * markierte Felder sind Pflichtfelder.","Your details in {community}":"Deine Angaben in {community}","Your community details":"Deine Angaben in der Community","Community details":"Angaben in der Community","Questions this community's admins ask every member. Your answers show in its member directory, except ones marked “Only admins see this”.":"Fragen, die die Admins dieser Community allen Mitgliedern stellen. Deine Antworten erscheinen im Mitgliederverzeichnis, außer denen mit „Nur Admins sehen das“.","Couldn't save your profile":"Profil konnte nicht gespeichert werden","Check the highlighted detail, then save again.":"Prüfe die markierte Angabe und speichere erneut.","Location filled in":"Standort eingetragen","Check it, then save your profile.":"Prüfe ihn und speichere dann dein Profil.","Couldn't use your location":"Standort konnte nicht verwendet werden","Please type your location.":"Bitte gib deinen Standort ein.","Your browser can't share your location here. Please type it.":"Dein Browser kann deinen Standort hier nicht teilen. Bitte gib ihn ein.","Location access is blocked. Allow it for this site in your browser settings, or type your location.":"Der Standortzugriff ist blockiert. Erlaube ihn für diese Website in den Browsereinstellungen oder gib deinen Standort ein.","Finding your location took too long. Please try again, or type your location.":"Die Standortermittlung hat zu lange gedauert. Versuche es erneut oder gib deinen Standort ein.","Your location isn't available right now. Please type it.":"Dein Standort ist gerade nicht verfügbar. Bitte gib ihn ein.","Location lookup isn't available right now. Please type your location.":"Die Standortsuche ist gerade nicht verfügbar. Bitte gib deinen Standort ein."},Pnn={Home:"Home"},Rnn={"Home Page Left column":"Página de inicio Columna izquierda",Home:"Hogar","Explore Groups":"Explorar grupos",Events:"Eventos",Groups:"Grupos",Links:"Enlaces","Direct Message":"Mensaje directo","Powered by":"Energizado por","No groups here, please use + to create a new one, or join one see them here.":"No hay grupos aquí, use + para crear uno nuevo o únase a uno, verlos aquí.","Please join a group to see them here":"Únase a un grupo para verlos aquí","Channel can only be reordered within the group!":"¡La sección solo se puede reordenar dentro del grupo!","Group Page":"Página de grupo","Invite Members":"Invitar a los miembros",Join:"Unirse",Joined:"Unido","Create new Channel":"Crear nueva sección","Group Setting drop down":"Desenfato de ajuste grupal",Share:"Cuota","Edit group":"Grupo de edición","Delete group":"Grupo de eliminación",Leave:"Abandonar","Are you sure you want to delete the group?":"¿Estás seguro de que quieres eliminar el grupo?",Cancel:"Cancelar","Yes, Go Ahead":"Sí adelante","Share via link":"Compartir a través del enlace",Copy:"Copiar",Copied:"Copiado","Share on social media":"Compartir en las redes sociales","Add Channel":"Agregar sección","Channel Header":"Encabezado de sección",Live:"Vivir","Create post":"Crear publicación","Notificaiton Bell":"Notificaiton Bell","All posts":"Todos los mensajes","Admin posts only":"Solo publicaciones de administración",None:"Ninguna","Channel Setting drop down":"SECCIÓN DESPLAYO DESPLAY","Edit Channel":"Sección de edición","Embed Channel":"Sección de incrustaciones","Delete Channel":"Eliminar sección","Are you sure you want to delete the Channel?":"¿Estás seguro de que quieres eliminar la sección?","Channel deleted!":"Sección eliminada!","Create Group Pop up / Update":"Crear grupo emergente / actualización del grupo","Create group":"Crea un grupo","Basic Detail":"Detalle básico",Settings:"Ajustes","Size 16:9 or 1600 by 900":"Tamaño 16: 9 o 1600 por 900","Group name":"Nombre del grupo","Enter group name":"Ingrese el nombre del grupo","Suggestions: Spaces, Channels, Groups, Blog, Knowledgebase, etc":"Sugerencias: espacios, canales, grupos, blog, base de conocimiento, etc.","Group Description":"Descripción del Grupo","Enter description here":"Ingrese la descripción aquí","Group Type":"Tipo de grupo",Open:"Abierto","Visible to all & anyone can join":"Visible para todos y cualquiera puede unirse",Closed:"Cerrado","User will have to request to join the group":"El usuario tendrá que solicitar unirse al grupo",Paid:"Pagado","Group Price":"Precio grupal","Currency (Default: INR)":"Moneda (predeterminado: INR)","User will have to pay to join the group":"El usuario tendrá que pagar para unirse al grupo","Make this a private group":"Haz de este un grupo privado","Private group will only be visible to members who are part of it. Admin can add members manually from member list":"El grupo privado solo será visible para los miembros que forman parte de él. El administrador puede agregar miembros manualmente de la lista de miembros","Upload from device":"Cargar desde el dispositivo","Search image":"Imagen de búsqueda","Valid group name required!":"¡Se requiere nombre de grupo válido!","Update Group":"Grupo de actualización","SEO Settings":"Configuración de SEO","Custom URL":"URL personalizada","Meta Title":"Meta título","Maximum length of 255 characters allowed":"Longitud máxima de 255 caracteres permitidos","Meta Description":"Metadescripción","Open Graph Detail":"Abrir detalle del gráfico","Open Graph Title":"Título del gráfico abierto","Open Graph Description":"Descripción del gráfico abierto","Open Graph Image":"Imagen de gráfico abierto","Recommended dimensions: 1200px by 630px with a 1.91:1 aspect ratio.":"Dimensiones recomendadas: 1200px por 630px con una relación de aspecto 1.91: 1.","If no URL is used, it will automatically picked your group thumbnail.":"Si no se usa URL, elegirá automáticamente su miniatura de grupo.","Create Channel Pop up / Update":"Crear sección emergente / actualización","Create Channel":"Crear sección","Channel Name":"Nombre de la sección","Suggestions: General, Introductions, Community Guidelines":"Sugerencias: General, Introducciones, Directrices de la comunidad","Channel Type":"Tipo de sección","Post Type":"Tipo de mensaje","Group Chat":"Grupo de chat","Who can post in this Channel?":"¿Quién puede publicar en esta sección?","Only Admin":"Solo administrador","Any user":"Cualquier usuario","Sorting order for Channel":"Orden de clasificación para la sección","Latest first":"Último primero","Oldest post first":"Publicación más antigua primero","Channel Appearance":"Apariencia de sección","List View":"Vista de la lista","Grid View":"Vista en cuadrícula","Make this closed Channel":"Haga esta sección cerrada","Members will have to request access to see Channel content":"Los miembros deberán solicitar acceso para ver el contenido de la sección","Make this a private Channel":"Haga de esta una sección privada","Disables requests (Make sure closed Channel is selected as well).":"Desactiva las solicitudes (asegúrese de que se seleccione la sección cerrada).","Post Editor":"Editor de la publicación","Create new post in":"Crear una nueva publicación en","Add Cover Picture":"Agregar imagen de portada","Heading (Optional)":"Encabezado (opcional)","Write here..":"Escriba aqui..",Picture:"Imagen",Video:"Video",Attachment:"Archivo adjunto",Poll:"Encuesta","Embed Code":"Código de inserción",Tags:"Etiquetas","Toggle to question":"Alternar para cuestionar","Poll expire time":"Tiempo de expirar la encuesta","Poll question":"Pregunta de la encuesta","Enter Question":"Ingrese la pregunta",Question:"Pregunta",Option:"Opción",Options:"Opción","Add Option":"Añadir opción","Poll Expiry time":"Tiempo de vencimiento de la encuesta","12 Hours":"12 horas","1 Day":"1 día","2 Days":"2 días","1 Week":"1 semana","2 Weeks":"2 semanas","Always Open":"Siempre abierto","Write embeddable code":"Escribir código incrustable","Click here to add embed code.":"Haga clic aquí para agregar código de incrustación.","Paste your embed code here!":"¡Pega tu código de incrustación aquí!","Post Settings":"Configuración de publicación","Update Post":"Publicación de actualización",Update:"Actualizar","Start meeting / Video call / Live":"Comience a reuniones / videollamadas / en vivo","Meeting Name":"Nombre de reunión","Suggestion: Group discussion etc":"Sugerencia: discusión grupal, etc.",Description:"Descripción","Enter description here (optional)":"Ingrese la descripción aquí (opcional)","When do you want to start the session":"¿Cuándo quieres comenzar la sesión?","Right now":"En este momento","Schedule for later":"Programar para más tarde","Group video call":"Videollamada grupal",Webinar:"Seminario web","Go Live":"Ir a vivir","Go live":"Ir a vivir","Info on the Post":"Información sobre la publicación","Post comment":"Publicar comentario",Comment:"Comentario",Comments:"Comentario",Reply:"Respuesta",Replies:"Respuestas","Share via URL":"Compartir a través de URL","Reshare in other Channels":"Remodelar en otras secciones","Post Card Drop Down":"Post Card Downward",Bookmark:"Marcador","Pin post":"Postal",Edit:"Editar","Embed Post":"Incrustación",Delete:"Borrar","Remove Pin":"Quitar el alfiler","Remove Bookmark":"Eliminar marcador","Just copy paste this code wherever you want it to be embedded":"Simplemente copie Pegue este código donde quiera que esté incrustado",Height:"Altura",Preview:"Avance","Copied to clipboard":"Copiado al portapapeles","Select Widgets":"Seleccionar widgets","Add widgets to":"Agregar widgets a","You can change their order by dragging & dropping the widgets over each other":"Puede cambiar su pedido arrastrando y dejando caer los widgets uno sobre el otro","Please note: Widget wont be displayed if there is no data available, ":"Tenga en cuenta: el widget no se mostrará si no hay datos disponibles,","Group Members":"Miembros del grupo","Group Leaderboard":"Tabla de clasificación grupal","Community Leaderboard":"Tabla de clasificación comunitaria","Trending Posts":"Puestos de tendencia","Group Events":"Eventos grupales","Add Custom":"Agregar personalizado","Save Widgets":"Guardar widgets","Visible to user":"Visible para el usuario","Visible to admin":"Visible para administrador","Add widget to":"Agregar widget a","Upload cover picture":"Imagen de portada de carga","1:1 aspect ration (recommended)":"Ración de aspecto 1: 1 (recomendado)","Card Title":"Título de tarjeta","Enter widget name":"Ingrese el nombre del widget","Small Description (try to keep it under 50 words)":"Pequeña descripción (intente mantenerlo menos de 50 palabras)","Enter description":"Ingrese la descripción","Button Title":"Título de botón","Enter button name":"Ingrese el nombre del botón","Siggestion: Know more, Join, Apply, etc":"Siggestion: Conozca más, unirse, aplicar, etc.","URL link":"Enlace URL","Create custom widget":"Crear widget personalizado","Custom widget created successfully":"Widget personalizado creado correctamente",Widgets:"Widgets",Members:"Miembros","See All":"Ver todo","Communtiy Top Contributors":"Los principales contribuyentes comunes","Community members":"Miembros de la comunidad","Group Top Contributors":"Colaboradores de los mejores grupos","Upcoming Events":"Próximos Eventos","Home Page Banner":"Banner de la página de inicio","Edit Banner":"Banner de edición","Home page Edit Banner Pop up":"Página de inicio Editar banner","Update Banner":"Banner de actualización",Search:"Búsqueda","Upload Image":"Cargar imagen",Remove:"Remover","Banner image (please use 16:6 ratio or 1600px by 600px image for the best view)":"Imagen de banner (use la imagen de 16: 6 o 1600px por 600px para la mejor vista)","Banner Title":"Título de banner","Enter here":"Entre aquí","Suggestion: Welcome to my community etc":"Sugerencia: Bienvenido a mi comunidad, etc.","Banner Description":"Descripción del banner","Enter banner description":"Ingrese la descripción del banner","Save Banner Info":"Guardar información banner","Home Page Feed":"Feed de la página de inicio",Recent:"Reciente","Top posts":"Publicaciones principales",Trending:"Tendencias","Home Feed Groups":"Grupos de alimentación casera","Header BarProfile Drop down":"Encabezado barprofile desplegable","My profile":"Mi perfil",Logout:"Cerrar sesión",Notification:"Notificación",Notifications:"Notificaciones","Mark all viewed":"Marque todo visto","has created a post":"ha creado una publicación","wants to join":"Quiere unirse","has commented on your post":"ha comentado en tu publicación","has replied to your comment":"ha respondido a tu comentario","Search for tags":"Buscar etiquetas","All groups":"Todos los grupos","Search result":"Resultado de búsqueda","No post found for selected hashtag":"No se encuentra una publicación para el hashtag seleccionado","Start a conversation":"Iniciar una conversación","Search by name":"Buscar por nombre",Upcoming:"Próximo",UPCOMING:"Próximo",Past:"Pasado",PAST:"PASADO","No upcoming events":"Sin eventos próximos","Create event popup":"Crear ventana emergente de eventos","Event details":"Detalles del evento","16:9 aspect ratio":"Relación de aspecto 16: 9","Event name":"Nombre del evento","Enter event name":"Ingrese el nombre del evento","Host Name":"Nombre de host","You will be made host if none selected":"Se lo hará host si ninguno seleccionado","Write here...":"Escriba aqui...","No. of registration for the event":"No. de registro para el evento",Unlimited:"Ilimitado","When & where":"Cuando donde",From:"De","Start date":"Fecha de inicio",time:"tiempo",To:"A","End date":"Fecha final","Current time zone: ":"Zona horaria actual:","Can be updated from the communtiy setting":"Se puede actualizar desde la configuración de comunicación","Online event":"Evento en línea","Add meeting link":"Agregar enlace de reunión","Meeting link will be generated once event is created":"El enlace de reunión se generará una vez que se cree el evento",Venue:"Evento","Enter address":"Ingresa la direccion",Create:"Crear",Invite:"Invitar","Share event via link":"Evento de compartir a través del enlace","Copy ":"Copiar","Select Channel to post this event":"Seleccionar sección para publicar este evento","Once posted, members of that group or Channel will recieve an notification":"Una vez publicado, los miembros de ese grupo o sección recibirán una notificación",Post:"Correo",RSVP:"RSVP","Book Event":"Evento de libros","Yes, I'll attend":"Si, asistiré","May be":"Quizás","No, I won't attend":"No, no asistiré","Date & Time":"Fecha y hora",Host:"Anfitrión","Online meeting":"Reunión en línea","Meeting link will be visible once registered for the event":"El enlace de reunión será visible una vez registrado para el evento","User Management":"Gestión de usuarios","Go bac to community":"Ir a la comunidad","Manage Members":"Administrar miembros",Member:"Miembro",Invited:"Invitado","Search for member":"Buscar miembro","Add to group":"Añadir al grupo","Send Direct Message":"Enviar mensaje directo","Change role":"Cambiar de rol","Kick from community":"Patada de la comunidad","Super Admin":"Super administrador","Super admin will have full access to the communtiy settings":"Super Admin tendrá acceso completo a la configuración de Communtiy","Group Admin":"Administrador del grupo","Admin of the selected group can edit the group information and create, edt or delete Channel under selected group":"El administrador del grupo seleccionado puede editar la información del grupo y crear, EDT o eliminar sección en el grupo seleccionado","Group Moderator":"Moderador de grupo","Group moderator can create or delete post, comment, reply & messages in the selected group.":"El moderador del grupo puede crear o eliminar publicaciones, comentarios, responder y mensajes en el grupo seleccionado.",User:"Usuario",Save:"Ahorrar","User role updated successfully":"Rol de usuario actualizado con éxito",Leaderboard:"Tabla de clasificación","Click on the column header for sorting":"Haga clic en el encabezado de la columna para clasificar",Rank:"Rango","Karma Points":"Puntos de karma","Custom Points":"Puntos personalizados",Follow:"Seguir",Upvotes:"Votos",Posts:"Postes","Add custom points":"Agregar puntos personalizados","Subtract custom points":"Restar puntos personalizados","Enter no. of points":"Ingrese no. de puntos","Add points":"Añadir puntos","Invite members to":"Invitar a los miembros a","Invite via link":"Invitar a través de un enlace","Invite via email":"Invitar por correo electrónico","Add more":"Añadir más","Upload a CSV":"Subir un CSV","Please upload a comma-seprated CSV file, with header as name, email.":"Cargue un archivo CSV de compra de comas, con encabezado como nombre, correo electrónico.","Here is a template CSV file":"Aquí hay un archivo CSV de plantilla","Upload File":"Subir archivo","Send Invite":"Enviar invitación","Mail Template":"Plantilla de correo","Send Test Mail":"Enviar correo de prueba",Hey:"Oye","A has invite you to join the B":"A te ha invitado a unirte a la B","Switch to rich text editor":"Cambiar al editor de texto rico","Add Custom Message":"Agregar mensaje personalizado","Enter message here":"Ingrese el mensaje aquí","Send Bulk Mail":"Enviar correo a granel","Send Mail":"Enviar correo","Send bulk mail to all community members or select group members":"Enviar correo a granel a todos los miembros de la comunidad o seleccionar miembros del grupo",Date:"Fecha",Subject:"Tema",Recipients:"Receptores","1000 bulk emails remaining for this month. Resets on <date>":"1000 correos electrónicos a granel restantes para este mes. Restablecer en <Date>",Everyone:"Todo el mundo","Enter mail subject":"Ingrese el tema del correo","Write message":"Escribe un mensaje","Cancel ":"Cancelar",Send:"Enviar","Profile Page":"Página de perfil",Activity:"Actividad",Bookmarks:"Marcadores","Edit profile":"Editar perfil",Unsubscribe:"Cancelar la suscripción","Settings (Account)":"Configuración (cuenta)",Profile:"Perfil","Set profile Picture":"Establecer una foto de perfil","Your name":"Su nombre","User ID":"ID de usuario","Short bio":"Bio","Link your social account, this will be displayed on your profile":"Enlace su cuenta social, esto se mostrará en su perfil","Add social handle":"Agregar mango social",Verification:"Verificación","Account Verification":"Verificación de la cuenta",Email:"Correo electrónico","Enter email":"Ingrese correo electrónico",Verified:"Verificado",Unverified:"Inconfirmado",Change:"Cambio",Unlink:"Desconectar",Mobile:"Móvil","enter mobile no.":"Ingrese móvil no.","Request OTP":"Solicitar OTP","Notification centre":"Centro de notificación","Manage your personal account notification preferences":"Administre las preferencias de notificación de su cuenta personal",Prefrences:"Prefrencias","Email notification":"Notificación de correo electrónico","Notify me about comments on my posts":"Notificarme sobre los comentarios en mis publicaciones","Notify me about replies on my comments":"Notificarme sobre las respuestas sobre mis comentarios","Notify me about likes on my posts":"Notificarme sobre los me gusta en mis publicaciones","Notify me about reaction on my comments":"Notificarme sobre la reacción en mis comentarios","Notify me about reaction on my reply":"Notificarme sobre la reacción en mi respuesta","Notify me about direct message":"Notificarme sobre el mensaje directo","Notify me about my mentions":"Notificarme sobre mis menciones","Notification for new posts":"Notificación para nuevas publicaciones","Only group & Channel available which you are part of":"Solo grupo y sección disponible en la que forma parte","Group & Channel":"Grupo y sección","All activity":"Toda actividad","Post by admin":"Publicado por admin","No Notification":"Sin notificación","Setting (Community)":"Escenario (comunidad)","General Settings":"Configuración general","Upload community logo":"Subir el logotipo de la comunidad","Community name":"Nombre de la comunidad","Invalid field":"Campo no válido","Your community address":"Su dirección comunitaria","Fav icon":"Icono favorito","This will be visible on the browser tab (32px by 32px)":"Esto será visible en la pestaña del navegador (32px por 32px)",TimeZone:"Zona horaria","Privacy Policy on login page":"Política de privacidad en la página de inicio de sesión","Terms & Condition on login page":"Términos y condición en la página de inicio de sesión","Enter link here":"Ingrese el enlace aquí","Open Group Image":"Imagen de grupo abierto","By default ir takes up the community banner uploaded with the communtiy":"Por defecto, el IR toma el banner de la comunidad cargado con el communtiy","Community Experience":"Experiencia comunitaria",Onboarding:"Inducción","Make your community private":"Haz que tu comunidad sea privada","Users will have to login or sign up to access the community":"Los usuarios deberán iniciar sesión o registrarse para acceder a la comunidad","Make account verification mandatory for both email & mobile":"Haga que la verificación de la cuenta sea obligatoria para correo electrónico y móvil","New user will have to verify both email & mobile no. to access the community":"El nuevo usuario tendrá que verificar el correo electrónico y el móvil no. Para acceder a la comunidad","Admin will also have to verify their mobile no. & email or else they won't be able to access the community":"El administrador también tendrá que verificar su móvil no. y correo electrónico o no podrán acceder a la comunidad","Gated community access":"Acceso comunitario cerrado","Admin will have to approve or reject user's requests to join the community":"El administrador tendrá que aprobar o rechazar las solicitudes del usuario para unirse a la comunidad","Disable mobile login/register":"Deshabilitar el inicio de sesión/registro móvil","Disable email login/register":"Deshabilitar el inicio de sesión/registro de correo electrónico","Disable google login/register":"Deshabilitar el inicio de sesión/registro de Google","Disable facebook login/register":"Deshabilitar el inicio de sesión/registro de Facebook","Show & Hide features":"Show & Hide Características","Hide direct chat":"Ocultar chat directo","User will not be able to send direct messages to each other":"El usuario no podrá enviarse mensajes directos entre sí","Hide profile picture from top right corner for mobile responsive view":"Ocultar una imagen de perfil desde la esquina superior derecha para una vista de respuesta móvil","Useful when using community in an in app browser":"Útil cuando se usa la comunidad en un navegador en aplicaciones","Hide profile picture from top right corner in every view":"Ocultar una imagen de perfil desde la esquina superior derecha en cada vista","Disable header dropdown on profile picture":"Desactivar el desplegable de encabezado en la foto de perfil","Useful for integrated community, especially using SSO":"Útil para la comunidad integrada, especialmente el uso de SSO","Hide the communtiy logo from the header":"Esconde el logotipo de la comunicación del encabezado","Hide the communtiy title from the header":"Esconde el título de la comunicación del encabezado","Show collpased group in the side nav bar":"Mostrar grupo colpicado en la barra de navegación lateral","Show full expanded post in the home feed":"Mostrar publicación amplia completa en la alimentación casera","Hide the leaderboard score from the header":"Ocultar el puntaje de la tabla de clasificación del encabezado","Show powered by SpatialChat Communities":"Espectáculo impulsado por SpatialChat Communities","Hide closed groups if not joined":"Ocultar grupos cerrados si no se une","Closed groups would not be shown to the user if they are not a member of the group":"Los grupos cerrados no se mostrarían al usuario si no son miembros del grupo","Hide Community subscriber count from the users":"Ocultar el recuento de suscriptores de la comunidad de los usuarios","This will hide the community subscriber list in the community header":"Esto ocultará la lista de suscriptores de la comunidad en el encabezado de la comunidad","Disable Communtiy Switcher":"Deshabilitar el conmutador de communty","Use MD editor for create post description":"Use el editor MD para crear una descripción de la publicación","Non logged in user will land on explore group page instead of post directory":"El usuario no registrado aterrizará en la página del grupo Explore en lugar del directorio post","Advanced configurable":"Configurable avanzado","Communtiy default country code":"Código de país predeterminado de Communtiy","This will show up by default on login/signup":"Esto aparecerá de manera predeterminada en el inicio de sesión/registro","Onboarding/Welcome Message":"Mensaje de incorporación/bienvenida","Welcome Message":"Mensaje de bienvenida","Greet your members with personalized message":"Salude a sus miembros con un mensaje personalizado","Welcome to":"Bienvenido a",Message:"Mensaje","Add message":"Agregar mensaje","Custom domain":"Dominio personalizado","Add custom domain":"Agregar dominio personalizado","Create new request":"Crear nueva solicitud","Enter your custom domain":"Ingrese su dominio personalizado","Setup details":"Detalles de configuración","Add a CNAME record in your domain pointing to this community's address":"Agregue un registro CNAME en su dominio que señale la dirección de esta comunidad","To configure your domain, you'll need to add a CNAME record pointing your domain to your pensil community URL":"Para configurar su dominio, deberá agregar un registro CNAME que apunta a su dominio a la URL de su comunidad SpatialChat Communities","Step by Step help apge":"Paso a paso Ayuda APGE","All request list":"Toda la lista de solicitudes","Allow admin to assign/un-assign custom points to users":"Permitir que el administrador asigne/no asignar puntos personalizados a los usuarios","Base points for user to begin with":"Puntos base para que el usuario comience con","Base points will be updated for all the users, any changes will reflect for all the users.":"Los puntos base se actualizarán para todos los usuarios, cualquier cambio se reflejará para todos los usuarios.","Allocate points for interaction":"Asignar puntos para la interacción","Upvoting post":"Publicación de votación","creating a comment":"Creando un comentario","creating a reply":"Creando una respuesta","Getting upvote to their post":"Obtener votos a su publicación","Getting comment to their post":"Hacer comentarios en su publicación","Getting reply to their comment":"Recibiendo respuesta a su comentario","Creating a post":"Creando una publicación",Visiblity:"Visible","Move Up":"Ascender","Move Down":"Mover hacia abajo","Create embedded Channel":"Crear sección incrustada","Preview area":"Área previa","Theme selector":"Selector de temas","Community Theme":"Tema de la comunidad","Select theme":"Seleccione el tema","Select brand color":"Seleccionar el color de la marca","Customize your button color to match your brand":"Personalice el color de su botón para que coincida con su marca","Select on button text color":"Seleccionar el color del texto del botón","Suggestion: Keep inverted contrast against brand color":"Sugerencia: Mantenga el contraste invertido con el color de la marca",Billing:"Facturación","Current plan":"Plan actual","You are current on Free PLan":"Estás actualizado en el plan gratuito","Renew on: NA":"Renovar: NA",Select:"Seleccione","Email us at":"Envíanos un email a","Compare plan":"Plan de comparación","API Keys":"Llaves de API","Create new key":"Crear nueva clave","Total keys":"Total llaves","Keep your API keys safe! You can use them to access specific feature & let cetain apps perfrom certain actions on your behalf on the platform.":"¡Mantenga sus llaves API seguras! Puede usarlos para acceder a la característica específica y dejar que Cetain Apps busque ciertas acciones en su nombre en la plataforma.","Key name":"Nombre clave","Key value":"Valor clave",Action:"Acción","Group updated!":"Grupo actualizado!","Are you sure you want to":"Estás seguro que quieres","Make Moderator":"Hacer moderador","Remove from group":"Sacar del grupo","Show All":"Mostrar todo","Change Role":"Cambiar de rol",Close:"Cerca",copy:"Copiar",LINKS:"ENLACES","Email Id":"Identificación de correo",Name:"Nombre","Search for an image":"Buscar una imagen","Crop Image":"Delimitar imagen","No photos found":"No se encontraron fotos",Community:"Comunidad","Banner ratio - 16:9":"Relación de banner - 16: 9","Banner Ratio - 16:6":"Relación de banner - 16: 6","Share on mail":"Compartir por correo","Share on Telegram":"Compartir en telegrama","Share on Whatsapp":"Compartir en WhatsApp","Share on Linkedin":"Compartir en LinkedIn","Share on Facebook":"Compartir en Facebook","Share on Twitter":"Compartir en Twitter","Pin Post":"Postal","Heading (optional)":"Encabezado (opcional)","Select Channel":"SELECCIÓN SECCIÓN",Gif:"Gif","Create Custom Widget":"Crear widget personalizado","Are you sure you want to delete this widget?":"¿Estás seguro de que quieres eliminar este widget?","Go to event":"Ir al evento","Add Tags":"Agregar etiquetas","Create Tag":"Crear etiqueta","Title (Optional)":"Título (opcional)","Search Gif":"Buscar gif","What's on your mind":"Qué tienes en mente","Looks like nothing available here right now.":"Parece nada disponible aquí en este momento.","Try exploring other tabs":"Intenta explorar otras pestañas","Delete Widget":"Eliminar widget","Please select a Channel to post":"Seleccione una sección para publicar","Post added successfully!":"¡Publicación agregada con éxito!","Failed to create post. Please check post content and retry again.":"No se pudo crear publicaciones. Consulte el contenido de la publicación y vuelva a intentarlo.","Are you sure you want to discard current post?":"¿Estás seguro de que quieres descartar la publicación actual?","By default it will take up the image uploaded with the post":"Por defecto, tomará la imagen cargada con la publicación","Quiz can be only viewed and attempted from mobile device right now!":"¡El cuestionario solo se puede ver e intentar desde el dispositivo móvil en este momento!","Community Banner":"Bandera de la comunidad","Change Cover":"Cubierta de cambio","Suggestions: Welcome to my community etc":"Sugerencias: Bienvenido a mi comunidad, etc.","(edited)":"(Editado)","Aspect ratio (recommended)":"Relación de aspecto (recomendado)","Banner details updated!":"¡Detalles de banner actualizados!","Refresh if changes are not visible!":"¡Actualice si los cambios no son visibles!","Banner details could not be updated!":"¡Los detalles del banner no se pueden actualizar!","Post deleted":"Publicación eliminada","Post not available. It may have been deleted.":"Publicación no disponible. Puede haber sido borrada.",Admin:"Administración",Moderator:"Moderador","Bookmark added!":"¡Se agregó marcador!","Bookmark removed":"Marcador eliminado","Failed performing action!":"¡Falló en la acción!","Copy this link to share on other platforms":"Copie este enlace para compartir en otras plataformas","View this event":"Ver este evento",Event:"Evento","Join Meeting":"Unirse a la reunión","The live meeting has ended":"La reunión en vivo ha terminado","read more...":"Lee mas...","Load more comments":"Cargar más comentarios","Post Reply":"Enviar respuesta","Post Comment":"publicar comentario",more:"más",upvoted:"votado","1 Upvote":"1 voto superior","1 Comment":"1 comentario","Please enter a title":"Por favor ingrese un título","Please enter a url link":"Ingrese un enlace de URL","Please enter button title":"Ingrese el título del botón","Button label must be at least 20 characters":"La etiqueta del botón debe tener al menos 20 caracteres","Please enter valid url":"Ingrese URL válida","Suggestions: Know more, Join, Apply...":"Sugerencias: Conozca más, únase, aplique ...",URL:"Url","Community Events":"Eventos comunitarios","Widget deleted successfully":"Widget eliminado con éxito","Community Top Contributors":"Los principales contribuyentes de la comunidad",points:"puntos","Points cannot be greater than current points":"Los puntos no pueden ser mayores que los puntos actuales","Point cannot be a negative value":"El punto no puede ser un valor negativo","Point cannot be a decimal point":"El punto no puede ser un punto decimal","Please enter a valid number":"por favor ingrese un número valido","Karma points updated successfully":"Puntos de karma actualizados con éxito","Error in updating karma points":"Error al actualizar los puntos de karma","Add karma points":"Agregar puntos de karma","Minus karma points":"Puntos de menos karma","Total Karma points:":"Puntos totales de karma:","Enter no. of karma points":"Ingrese no. de puntos de karma","Minus Points":"Menos puntos","Trending Post":"Puesto de tendencia","No visible description":"Sin descripción visible","Picture ratio: 1:1":"Relación de imagen: 1: 1","home feed":"tus noticias","Event name is invalid!":"¡El nombre del evento no es válido!",custom:"disfraz","Custom widget updated successfully":"Widget personalizado actualizado correctamente","Name invalid!":"Nombre inválido!","Current timezone:":"Zona horaria actual:","can be updated from community settings":"se puede actualizar desde la configuración de la comunidad","Event created successfully":"Evento creado con éxito","Error in creating event":"Error al crear evento",Attendees:"Asistentes","Do you wish to notify these changes to attendees?":"¿Desea notificar estos cambios a los asistentes?","users wants to attend this event":"Los usuarios quieren asistir a este evento","Yes, Notify them":"Si, notifíqueles"," No, its okay":" No, está bien","Do you wish to notify that event is cancelled?":"¿Desea notificar que el evento está cancelado?","Are you sure you want to delete the event?":"¿Estás seguro de que quieres eliminar el evento?","Delete Event":"Evento de eliminación","New Event":"Nuevo evento","Accept Invitation":"Aceptar la invitacion",Requested:"Solicitado",Declined:"Rechazado","Request Access":"Solicitar acceso","Enroll for":"Inscribir para",Housefull:"Casa","Just copy paste this code wherever you want it to be embedded:":"Simplemente copie Pegue este código donde quiera que esté incrustado:",Ended:"Terminado","Error getting events":"Error a obtener eventos","Events could not be fetched!":"¡Los eventos no se pudieron buscar!","Show Attendees":"Mostrar asistentes",Subscribers:"Suscriptores","Make this a closed Channel":"Hacer de esto una sección cerrada","Update Channel":"Sección de actualización","Valid Channel name required!":"¡Se requiere nombre de sección válido!","Enter Channel name":"Ingrese el nombre de la sección","Community Admin":"Administrador de la comunidad",Embed:"Empotrar","Posted in":"Publicado en","Start a discussion":"Comience una discusión","Invite Members Individually":"Invitar a los miembros individualmente","Post something":"Publicar algo","Invite your audience":"Invita a tu audiencia","Choose Plan":"Elija el plan",or:"o","Create a link":"Crea un enlace","Update link":"Enlace de actualización","Add shortcut to your most used tools":"Agregue el atajo a sus herramientas más utilizadas","Your website, Instagram Channel, Facebook profile etc":"Su sitio web, canal de Instagram, perfil de Facebook, etc.","Valid url required, and make sure you are not missing http:// or https://":"Se requiere URL válida y asegúrese de que no le falte http:// o https://","Valid link name required!":"¡Se requiere nombre de enlace válido!","Add link":"Añadir enlace","Invite to":"Invitar a","Link Name":"Nombre de enlace","Link URL":"URL del enlace","Could not subscribe to":"No pudo suscribirse a","Subscribed to":"Suscrito a","By default it will take up the community banner uploaded with the community":"Por defecto, tomará el banner de la comunidad cargado con la comunidad","Online Event (Meeting link will be visible once registered for the event)":"Evento en línea (el enlace de reunión será visible una vez registrado para el evento)","Created by":"Creado por","Join Call":"Unir la llamada",Feed:"Muro",Saved:"Guardados",Workflows:"Flujos de trabajo",Rewards:"Recompensas",Networking:"Networking",Course:"Curso","Member Directory":"Directorio de miembros","Email Marketing":"Marketing por correo",Analytics:"Analítica","Log out":"Cerrar sesión","Switch community":"Cambiar de comunidad",Support:"Soporte",Following:"Siguiendo","Select topic":"Elegir tema","Featured Posts":"Publicaciones destacadas","Featured posts":"Publicaciones destacadas",Courses:"Cursos","Explore courses and learning paths in your community.":"Explora los cursos y rutas de aprendizaje de tu comunidad.","Add course":"Añadir curso","Search title, description, or creator…":"Buscar título, descripción o creador…","Search courses":"Buscar cursos","Clear search":"Borrar búsqueda","Filter courses":"Filtrar cursos","Sort courses":"Ordenar cursos","Clear filters":"Borrar filtros","{count} course":"{count} curso","{count} courses":"{count} cursos",Updating:"Actualizando","Could not load courses":"No se pudieron cargar los cursos","Something went wrong. Please try again.":"Algo salió mal. Inténtalo de nuevo.",Retry:"Reintentar","No courses found":"No se encontraron cursos","Try another search term or change the filter.":"Prueba con otro término de búsqueda o cambia el filtro.","No courses available":"No hay cursos disponibles","Create the first course for your community.":"Crea el primer curso para tu comunidad.","Check back when new courses are published.":"Vuelve cuando se publiquen nuevos cursos.","Showing {shown} of {total} course":"Mostrando {shown} de {total} curso","Showing {shown} of {total} courses":"Mostrando {shown} de {total} cursos","Show less":"Mostrar menos","Read more":"Leer más","Request sent":"Solicitud enviada","An admin will review your enrollment request.":"Un administrador revisará tu solicitud de inscripción.",Enrolled:"Inscrito","You can start learning now.":"Ya puedes empezar a aprender.","Something went wrong.":"Algo salió mal.","Could not join course":"No se pudo unir al curso","No lessons yet":"Aún no hay lecciones","Content will appear when lessons are published.":"El contenido aparecerá cuando se publiquen las lecciones.","Course deleted":"Curso eliminado","Could not delete course":"No se pudo eliminar el curso","Course duplicated":"Curso duplicado","The copy was created as a draft.":"La copia se creó como borrador.","Could not duplicate course":"No se pudo duplicar el curso","Left course":"Has salido del curso","Could not leave course":"No se pudo salir del curso","Continue learning":"Seguir aprendiendo","Buy now":"Comprar ahora","Send request to enroll":"Enviar solicitud de inscripción","Enroll now":"Inscribirme ahora","Course not found":"Curso no encontrado","This course may have been removed or you lack access.":"Es posible que este curso se haya eliminado o que no tengas acceso.","Back to Courses":"Volver al curso","By {name}":"Por {name}","{count} lesson":"{count} lección","{count} lessons":"{count} lecciones","Total time to complete":"Tiempo total para completar","Attached to {group}":"Vinculado a {group}",Progress:"Progreso","{done}/{total} lessons · {percent}%":"{done}/{total} lecciones · {percent} %","Edit course":"Editar curso","Duplicate course":"Duplicar curso","Delete course":"Eliminar curso","Course access is included with your active paid access":"El acceso al curso está incluido en tu acceso de pago activo","Leave course":"Salir del curso",Content:"Contenido","Quiz results":"Resultados del cuestionario","Delete course?":"¿Eliminar curso?","All course content and member progress will be permanently removed.":"Todo el contenido del curso y el progreso de los miembros se eliminarán de forma permanente.","Leave course?":"¿Salir del curso?","You will lose access to lessons until you enroll again.":"Perderás el acceso a las lecciones hasta que te vuelvas a inscribir.","Not enrolled":"No inscrito","Course content unlocks once you are enrolled. Request access or purchase membership if required.":"El contenido del curso se desbloquea al inscribirte. Solicita acceso o compra una membresía si es necesario.","Add section":"Añadir sección","No content yet":"Aún no hay contenido","Add a section to start building this course.":"Añade una sección para empezar a crear este curso.","Content will be available when the course starts.":"El contenido estará disponible cuando empiece el curso.","{count} comment":"{count} comentario","{count} comments":"{count} comentarios","No comments on this course yet.":"Aún no hay comentarios en este curso.","Showing {from}-{to} of {total} comments":"Mostrando {from}-{to} de {total} comentarios",Lesson:"Lección","Unlocks {date}":"Se desbloquea el {date}","{count} day after enrollment":"{count} día después de la inscripción","{count} days after enrollment":"{count} días después de la inscripción","Releases {date}":"Se publica el {date}","Section deleted":"Sección eliminada","Could not delete section":"No se pudo eliminar la sección","Lesson updated":"Lección actualizada","Lesson added":"Lección añadida","Could not save lesson":"No se pudo guardar la lección","Lesson deleted":"Lección eliminada","Could not delete lesson":"No se pudo eliminar la lección","Lesson duplicated as draft":"Lección duplicada como borrador","Could not duplicate lesson":"No se pudo duplicar la lección","Total time for this section":"Tiempo total de esta sección","Edit section":"Editar sección","Delete section":"Eliminar sección","Lessons will appear here once added.":"Las lecciones aparecerán aquí cuando se añadan.","Not released yet":"Aún no disponible","Complete the previous lesson first":"Completa primero la lección anterior","Time to complete":"Tiempo para completar","Actions for {title}":"Acciones para {title}","Edit lesson":"Editar lección","Duplicate lesson":"Duplicar lección","Delete lesson":"Eliminar lección",Add:"Añadir","Add lesson":"Añadir lección","Delete section?":"¿Eliminar sección?",'This removes "{name}" and all lessons inside it.':"Esto elimina “{name}” y todas las lecciones que contiene.","Delete lesson?":"¿Eliminar lección?",'This removes "{title}" permanently.':"Esto elimina “{title}” de forma permanente.","Lesson title":"Título de la lección",Minutes:"Minutos","Time to complete, in minutes":"Tiempo para completar, en minutos","How long this lesson takes, in minutes":"Cuánto dura esta lección, en minutos","Joined group":"Te has unido al grupo","You're now in {group}. Enrolling you in the course…":"Ahora estás en {group}. Te estamos inscribiendo en el curso…","An admin will review your group request. After you're accepted you can enroll in the course.":"Un administrador revisará tu solicitud para unirte al grupo. Cuando te acepten, podrás inscribirte en el curso.","Could not join group":"No se pudo unir al grupo","This course moved to {group}":"Este curso se movió a {group}","Join {group} first":"Únete primero a {group}","This course is now part of “{group}”. Join its new group to continue accessing the course.":"Este curso ahora forma parte de “{group}”. Únete a su nuevo grupo para seguir accediendo al curso.","This course belongs to “{group}”. Join the group before enrolling and starting the course.":"Este curso pertenece a “{group}”. Únete al grupo antes de inscribirte y empezar el curso.","Paid group access":"Acceso de pago al grupo","Membership required":"Se requiere membresía","Explore the available plans for {group}, choose the one that suits you, and return here after purchase to begin learning.":"Explora los planes disponibles de {group}, elige el que más te convenga y vuelve aquí tras la compra para empezar a aprender.","Your request to join this group is already pending. You'll be able to enroll after an admin accepts it.":"Tu solicitud para unirte a este grupo ya está pendiente. Podrás inscribirte cuando un administrador la acepte.","This is a {type} group. Continue to join instantly.":"Este es un grupo {type}. Continúa para unirte al instante.","This is a {type} group. Continue to send a request to the group admins.":"Este es un grupo {type}. Continúa para enviar una solicitud a los administradores del grupo.","Explore group":"Explorar grupo","Join group":"Unirme al grupo","Request to join group":"Solicitar unirme al grupo","You can watch this lecture now.":"Ya puedes ver esta clase.","Could not enroll":"No se pudo completar la inscripción","Want to view this lecture?":"¿Quieres ver esta clase?","Your enrollment request is waiting for approval. You'll be able to watch this lecture after an admin accepts it.":"Tu solicitud de inscripción está pendiente de aprobación. Podrás ver esta clase cuando un administrador la acepte.","Enroll in {course} to watch this lecture and the rest of the course.":"Inscríbete en {course} para ver esta clase y el resto del curso.","Back to course":"Volver al curso","Enroll to view lecture":"Inscríbete para ver la clase","Choose a membership plan that includes {course}.":"Elige un plan de membresía que incluya {course}.",Subscribed:"Suscrito","Payment successful":"Pago realizado","You can now request access to this course.":"Ahora puedes solicitar acceso a este curso.","Checkout failed":"Error en el pago","Buy group access":"Comprar acceso al grupo","No membership plans are linked to this group yet.":"Aún no hay planes de membresía vinculados a este grupo.","Membership plan":"Plan de membresía","Subscribe free":"Suscribirme gratis","{day} at {time}":"{day} a las {time}","All courses":"Todos los cursos",Published:"Publicados",Drafts:"Borradores","Default order":"Orden predeterminado","Title A–Z":"Título A–Z","Shortest first":"Más cortos primero","Longest first":"Más largos primero","Most lessons":"Más lecciones",Draft:"Borrador",Personal:"Personal","Community member":"Miembro de la comunidad","Your browser does not support video playback.":"Tu navegador no admite la reproducción de vídeo.","Audio resource":"Recurso de audio","Listen without leaving the Knowledge Hub":"Escucha sin salir del Knowledge Hub","Your browser does not support audio playback.":"Tu navegador no admite la reproducción de audio.","Attached files":"Archivos adjuntos",FILE:"ARCHIVO",Hide:"Ocultar",View:"Ver",Download:"Descargar","Resource media":"Multimedia del recurso",Audio:"Audio",Attachments:"Adjuntos","About this resource":"Acerca de este recurso","Saving your resource…":"Guardando tu recurso…","Finishing the upload…":"Finalizando la subida…","Uploading 1 file · {percent}%":"Subiendo 1 archivo · {percent} %","Uploading {count} files · {percent}%":"Subiendo {count} archivos · {percent} %","Remove {name}":"Quitar {name}","Description cannot exceed {max} characters":"La descripción no puede superar los {max} caracteres","Your title":"Tu título","Add a cover image before publishing":"Añade una imagen de portada antes de publicar","Resource updated":"Recurso actualizado","Resource shared":"Recurso compartido","Your changes are now live.":"Tus cambios ya están publicados.","It is now available in the Knowledge Hub.":"Ya está disponible en el Knowledge Hub.","Upload cancelled":"Subida cancelada","Nothing was saved. Your files are still in the form.":"No se guardó nada. Tus archivos siguen en el formulario.","Could not update resource":"No se pudo actualizar el recurso","Could not share resource":"No se pudo compartir el recurso","Please try again.":"Inténtalo de nuevo.","That file is not an image":"Ese archivo no es una imagen","Choose a PNG, JPG or WebP for the cover.":"Elige un PNG, JPG o WebP para la portada.","Couldn't use that cover":"No se pudo usar esa portada","Pick another one, or choose a picture of your own.":"Elige otra o selecciona una imagen propia.","Couldn't open the current cover":"No se pudo abrir la portada actual","Choose the image again to crop it.":"Vuelve a elegir la imagen para recortarla.","Video too large":"Vídeo demasiado grande","Videos can be up to {limit}.":"Los vídeos pueden pesar hasta {limit}.","That file is not audio":"Ese archivo no es de audio","Choose an MP3, M4A, WAV or other audio file.":"Elige un archivo MP3, M4A, WAV u otro archivo de audio.","Audio too large":"Audio demasiado grande","Audio files can be up to {size} MB.":"Los archivos de audio pueden pesar hasta {size} MB.","File too large":"Archivo demasiado grande","{count} files too large":"{count} archivos demasiado grandes",'"{name}" was not added. Files can be up to {limit}.':"No se añadió “{name}”. Los archivos pueden pesar hasta {limit}.","{names} were not added. Files can be up to {size} MB ({videoLimit} for a video).":"No se añadieron {names}. Los archivos pueden pesar hasta {size} MB ({videoLimit} para un vídeo).","Up to 5 attachments":"Hasta 5 adjuntos","Only the first {count} file was added.":"Solo se añadió {count} archivo.","Only the first {count} files were added.":"Solo se añadieron los primeros {count} archivos.","Remove one to add another.":"Quita uno para añadir otro.","Edit resource":"Editar recurso","Share a resource":"Compartir un recurso","Update your resource. Saved changes will appear immediately.":"Actualiza tu recurso. Los cambios guardados se verán de inmediato.","Add a cover and a description, then optionally a video, an audio file and files to download.":"Añade una portada y una descripción y, si quieres, un vídeo, un archivo de audio y archivos para descargar.",Details:"Detalles","Cover image file":"Archivo de imagen de portada","Video file":"Archivo de vídeo","Audio file":"Archivo de audio","Attachment files":"Archivos adjuntos","Cover image":"Imagen de portada","The picture on this resource's card in the library. It is not a download. After you pick a picture you choose which part to show, in the card's 16:9 shape, so nothing is cut off in the library. A large photo is resized before it is sent, so it uploads faster; the original on your device is not changed.":"La imagen de la tarjeta de este recurso en la biblioteca. No es una descarga. Tras elegir una imagen, seleccionas qué parte mostrar, con el formato 16:9 de la tarjeta, para que no se corte nada en la biblioteca. Las fotos grandes se redimensionan antes de enviarse para que se suban más rápido; el original de tu dispositivo no se modifica.","Cover preview":"Vista previa de la portada","Choose a cover image":"Elige una imagen de portada","PNG, JPG or WebP · you choose the part to show next":"PNG, JPG o WebP · después eliges la parte que se mostrará","Replace cover":"Reemplazar portada","Remove cover":"Quitar portada","Without a cover, the card shows a plain one in the community's colour.":"Sin portada, la tarjeta muestra una sencilla con el color de la comunidad.","Current cover":"Portada actual","Adjust crop":"Ajustar recorte","No picture to hand? Use a ready-made cover":"¿No tienes una imagen a mano? Usa una portada prediseñada","Cover subjects":"Temas de portada","All ({count})":"Todas ({count})","Earlier covers":"Portadas anteriores","Ready-made covers":"Portadas prediseñadas","Use the {name} cover":"Usar la portada {name}","More covers":"Más portadas",Title:"Título","What will members learn?":"¿Qué aprenderán los miembros?","Shorten the title to {max} characters or fewer.":"Acorta el título a {max} caracteres o menos.","Share context, key takeaways, and why this is useful…":"Comparte el contexto, las ideas clave y por qué es útil…","Formatting counts toward the limit. Shorten the description to {max} characters or fewer.":"El formato cuenta para el límite. Acorta la descripción a {max} caracteres o menos.","Media to play":"Multimedia para reproducir","(optional)":"(opcional)","Members watch or listen to these inside the resource.":"Los miembros los ven o escuchan dentro del recurso.","· one video, up to {limit}, or a link":"· un vídeo, de hasta {limit}, o un enlace","Current uploaded video":"Vídeo subido actualmente","Already uploaded":"Ya subido","Upload video":"Subir vídeo","YouTube or Vimeo URL":"URL de YouTube o Vimeo","Enter a valid YouTube or Vimeo link.":"Introduce un enlace válido de YouTube o Vimeo.","· one audio file":"· un archivo de audio","Current audio file":"Archivo de audio actual","Upload audio":"Subir audio","Files to download":"Archivos para descargar","PDFs, Word, Excel or any other file members can download · {count}/5":"PDF, Word, Excel o cualquier otro archivo que los miembros puedan descargar · {count}/5","Add files":"Añadir archivos","PDF preview":"Vista previa del PDF","PDF attachment preview":"Vista previa del PDF adjunto","This is how members will see your resource. Nothing is shared until you save.":"Así verán los miembros tu recurso. No se comparte nada hasta que guardes.","This is how members will see your resource. Nothing is shared until you publish.":"Así verán los miembros tu recurso. No se comparte nada hasta que publiques.","When opened":"Al abrirlo","In the library":"En la biblioteca","{done}/{total} done":"{done}/{total} completados","Upload progress":"Progreso de la subida","Keep this window open until it finishes.":"Mantén esta ventana abierta hasta que termine.","Cancel upload":"Cancelar subida","Save changes":"Guardar cambios","Publish resource":"Publicar recurso","Choose what shows on the cover":"Elige qué se muestra en la portada","Knowledge Hub":"Knowledge Hub","You created this resource.":"Creaste este recurso.","Moderator actions":"Acciones de moderación","This file can't be previewed. Use Download instead.":"Este archivo no se puede previsualizar. Usa Descargar.","Resource deleted":"Recurso eliminado","Could not delete resource":"No se pudo eliminar el recurso","This resource is no longer available":"Este recurso ya no está disponible","Couldn't open that resource":"No se pudo abrir ese recurso","It may have been deleted. Here is the rest of the library.":"Puede que se haya eliminado. Aquí tienes el resto de la biblioteca.","Community library":"Biblioteca de la comunidad","Useful ideas, explainers and media shared by your community.":"Ideas útiles, explicaciones y contenido multimedia compartidos por tu comunidad.","Search title, description, or author…":"Buscar título, descripción o autor…","Search Knowledge Hub resources":"Buscar recursos del Knowledge Hub","All content types":"Todos los tipos de contenido","Any date":"Cualquier fecha","Past 7 days":"Últimos 7 días","Past 30 days":"Últimos 30 días","Past 90 days":"Últimos 90 días","Custom dates":"Fechas personalizadas","Sort resources":"Ordenar recursos","Newest first":"Más recientes primero","Most liked":"Más gustados","Could not load the Knowledge Hub":"No se pudo cargar el Knowledge Hub","Please check your connection and try again.":"Revisa tu conexión e inténtalo de nuevo.","Build your community library":"Crea la biblioteca de tu comunidad","Share the first useful guide, talk, or audio resource with everyone.":"Comparte con todos la primera guía, charla o recurso de audio útil.","Share the first resource":"Compartir el primer recurso","No resources found":"No se encontraron recursos","Try another search term or change the filters.":"Prueba con otro término de búsqueda o cambia los filtros.","Showing {shown} of {total} resource":"Mostrando {shown} de {total} recurso","Showing {shown} of {total} resources":"Mostrando {shown} de {total} recursos","Delete this resource?":"¿Eliminar este recurso?","“{title}” will be permanently removed from the Knowledge Hub. This action cannot be undone.":"“{title}” se eliminará de forma permanente del Knowledge Hub. Esta acción no se puede deshacer.","Delete resource":"Eliminar recurso","Remove your like":"Quitar tu me gusta","Like this resource":"Dar me gusta a este recurso","You like this. Click to remove your like.":"Te gusta esto. Haz clic para quitar tu me gusta.","Link copied":"Enlace copiado","It opens this resource in the Knowledge Hub.":"Abre este recurso en el Knowledge Hub.","Couldn't copy link":"No se pudo copiar el enlace","Post in review":"Publicación en revisión","An admin will review it before it appears.":"Un administrador la revisará antes de que aparezca.",Shared:"Compartido","Posted to {channel}":"Publicado en {channel}","Couldn't share the resource":"No se pudo compartir el recurso","Copy link":"Copiar enlace","Post to a channel":"Publicar en un canal","Send in a message":"Enviar en un mensaje","Posts “{title}” with a link that opens it in the Knowledge Hub.":"Publica “{title}” con un enlace que lo abre en el Knowledge Hub.","Select channel":"Seleccionar canal","Add a message to introduce this to your community (optional). Type @ to mention someone.":"Añade un mensaje para presentarlo a tu comunidad (opcional). Escribe @ para mencionar a alguien.","Posting…":"Publicando…","Share it in a message. The link opens the resource in the Knowledge Hub.":"Compártelo en un mensaje. El enlace abre el recurso en el Knowledge Hub.","{count} file":"{count} archivo","{count} files":"{count} archivos","Open {title} in the Knowledge Hub":"Abrir {title} en el Knowledge Hub","Like this course":"Dar me gusta a este curso","It opens this course's page.":"Abre la página de este curso.","Posts “{title}” as a card members can like and open. Enrolling works as it does on the course page.":"Publica «{title}» como una tarjeta a la que los miembros pueden dar me gusta y abrir. La inscripción funciona igual que en la página del curso.","Couldn't share the course":"No se pudo compartir el curso","Share it in a message. The link opens the course's page.":"Compártelo en un mensaje. El enlace abre la página del curso.","Open the course {title}":"Abrir el curso {title}","Paid plan":"Plan de pago","Unlock {feature}":"Desbloquea {feature}","Your current plan doesn't include it. Choose a plan to start using it.":"Tu plan actual no lo incluye. Elige un plan para empezar a usarlo.","Included in every paid plan, from {price}.":"Incluido en todos los planes de pago, desde {price}.","Included in every paid plan.":"Incluido en todos los planes de pago.","See plans":"Ver planes","Maybe later":"Quizás más tarde","Reach your members in their inbox with campaigns, newsletters, sequences, funnels and forms.":"Llega a la bandeja de entrada de tus miembros con campañas, newsletters, secuencias, embudos y formularios.","Send campaigns and newsletters to your audience":"Envía campañas y newsletters a tu audiencia","Automated sequences, funnels and sign-up forms":"Secuencias automáticas, embudos y formularios de registro","Audience management and delivery analytics":"Gestión de la audiencia y análisis de entregas","Automate your community: act when members join, post or reach a milestone, without writing code.":"Automatiza tu comunidad: actúa cuando los miembros se unen, publican o alcanzan un hito, sin escribir código.","Automations triggered by joins, posts, streaks and more":"Automatizaciones activadas por altas, publicaciones, rachas y más","Multi-step actions: notify, tag, award points, send email":"Acciones de varios pasos: notificar, etiquetar, otorgar puntos, enviar correo","Ready-made templates to start in minutes":"Plantillas listas para empezar en minutos","Member Analytics":"Analítica de miembros","See how each member uses your community: time spent, sessions and the pages they visit.":"Descubre cómo usa cada miembro tu comunidad: tiempo dedicado, sesiones y páginas que visita.","Time spent and sessions for every member":"Tiempo dedicado y sesiones de cada miembro","Page journeys: where members go and for how long":"Recorridos de páginas: adónde van los miembros y durante cuánto tiempo","Look up any member in Insights":"Busca a cualquier miembro en Insights","Content category":"Categoría de contenido","Content categories":"Categorías de contenido","All categories":"Todas las categorías","No category":"Sin categoría","Add “{name}”":"Añadir «{name}»","Filter by content category":"Filtrar por categoría de contenido","Search categories":"Buscar categorías","Search or type a new category":"Busca o escribe una nueva categoría","Loading…":"Cargando…","Couldn't load categories. Try again.":"No se pudieron cargar las categorías. Inténtalo de nuevo.","No categories match.":"Ninguna categoría coincide.",Author:"Autor",Authors:"Autores","All authors":"Todos los autores","Search authors":"Buscar autores","Filter by author":"Filtrar por autor","Couldn't load authors. Try again.":"No se pudieron cargar los autores. Inténtalo de nuevo.","No authors match.":"Ningún autor coincide.","No resources have been shared yet.":"Todavía no se ha compartido ningún recurso.","No courses have been made yet.":"Todavía no se ha creado ningún curso.","Shows only the resources one member has shared. The list has everyone who has shared a resource here, with how many each has shared; type a name to find someone. You can combine it with the other filters and the search box.":"Muestra solo los recursos que ha compartido un miembro. La lista incluye a todos los que han compartido un recurso aquí, con cuántos ha compartido cada uno; escribe un nombre para encontrar a alguien. Puedes combinarlo con los demás filtros y la búsqueda.","No resource has a category yet.":"Ningún recurso tiene categoría todavía.","Show more":"Mostrar más","What kind of resource this is, such as a research paper or an opinion piece. Members can filter the Knowledge Hub by it. Pick one, or type your own and choose Add.":"Qué tipo de recurso es, por ejemplo un artículo de investigación o un artículo de opinión. Los miembros pueden filtrar el Knowledge Hub por ella. Elige una o escribe la tuya y selecciona Añadir.",Filters:"Filtros","{count} applied":"{count} aplicados","Content type":"Tipo de contenido","Date shared":"Fecha de publicación","Remove filter {name}":"Quitar filtro {name}","Research Paper":"Artículo de investigación",Article:"Artículo","Lecture/Talk":"Charla/Conferencia","Opinion Piece":"Artículo de opinión",General:"General",Football:"Fútbol",Education:"Educación",Physiotherapy:"Fisioterapia",Coaching:"Entrenamiento","Sports Science":"Ciencias del deporte","Strength & Conditioning":"Fuerza y acondicionamiento",Recovery:"Recuperación",Nutrition:"Nutrición",Medicine:"Medicina",Health:"Salud",Cars:"Coches",Entertainment:"Entretenimiento",Programming:"Programación",Technology:"Tecnología",Business:"Negocios",Science:"Ciencia",Engineering:"Ingeniería",Sports:"Deportes",Arts:"Arte",Travel:"Viajes",Food:"Comida",Resources:"Recursos","Could not load this course.":"No se pudo cargar este curso.","Back to course overview":"Volver a la vista general del curso","Preview as learner":"Vista previa como estudiante","Close table of contents":"Cerrar índice","Join {group} to continue learning.":"Únete a {group} para seguir aprendiendo.","the course's current group":"el grupo actual del curso","Enroll in this course to watch the lecture.":"Inscríbete en este curso para ver la clase.","Next lesson":"Siguiente lección","Table of contents":"Índice","Add a section to start building content.":"Añade una sección para empezar a crear contenido.","No lessons available yet.":"Aún no hay lecciones disponibles.","Lesson completed":"Lección completada","Marked incomplete":"Marcada como incompleta","Could not update progress":"No se pudo actualizar el progreso","Mark incomplete":"Marcar como incompleta","Mark complete":"Marcar como completada","You need to join this course before you can view its lessons.":"Debes unirte a este curso antes de poder ver sus lecciones.","Go to course overview":"Ir a la vista general del curso","No lesson selected":"Ninguna lección seleccionada","Pick a lesson from the table of contents.":"Elige una lección del índice.","Lesson {current} of {total}":"Lección {current} de {total}","This lesson has no written content yet.":"Esta lección aún no tiene contenido escrito.",Block:"Bloque","In this lesson":"En esta lección","Lesson content":"Contenido de la lección",Completed:"Completada","Completed {date}":"Completada el {date}","Open PDF":"Abrir PDF","Quick check":"Comprobación rápida",Assignment:"Tarea","Submit your work in the lesson discussion below.":"Entrega tu trabajo en la discusión de la lección más abajo.",Quiz:"Cuestionario","Could not save quiz.":"No se pudo guardar el cuestionario.","Could not submit quiz":"No se pudo enviar el cuestionario","Select all answers that apply.":"Selecciona todas las respuestas que correspondan.","This is an open-ended check — continue when you are ready.":"Esta es una comprobación abierta: continúa cuando estés listo.","Submit quiz":"Enviar cuestionario","You {status} the quiz.":"Has {status} el cuestionario.",passed:"aprobado","didn't pass":"suspendido","Great job!":"¡Buen trabajo!","Review the answers below, then try again.":"Revisa las respuestas de abajo y vuelve a intentarlo.","Retake quiz":"Repetir cuestionario",Score:"Puntuación","Correct answers":"Respuestas correctas",Correct:"Correcta",Incorrect:"Incorrecta",You:"Tú","Could not post your comment":"No se pudo publicar tu comentario","Could not update the comment":"No se pudo actualizar el comentario","Could not delete the comment":"No se pudo eliminar el comentario",Discussion:"Discusión","Loading comments…":"Cargando comentarios…","No comments yet — start the discussion.":"Aún no hay comentarios: inicia la discusión.","Add to the discussion…":"Participa en la discusión…","Redirecting now…":"Redirigiendo ahora…","Redirecting in {count} second":"Redirigiendo en {count} segundo","Redirecting in {count} seconds":"Redirigiendo en {count} segundos","Lesson complete":"Lección completada","Up next":"A continuación",Stay:"Quedarme",Continue:"Continuar","Quiz result":"Resultado del cuestionario","Question-by-question review of this learner's quiz attempt.":"Revisión pregunta por pregunta del intento de este estudiante.","Attempts: {count}":"Intentos: {count}",Submitted:"Enviado","You received {points} karma point.":"Recibiste {points} punto de karma.","You received {points} karma points.":"Recibiste {points} puntos de karma.","Congratulations!":"¡Enhorabuena!","You've successfully completed {course}.":"Has completado {course} con éxito.","Keep reviewing":"Seguir repasando",Text:"Texto","Send feedback":"Enviar comentarios","You can attach up to {max} screenshots":"Puedes adjuntar hasta {max} capturas de pantalla","Only the first {count} screenshot was added":"Solo se añadió {count} captura de pantalla","Only the first {count} screenshots were added":"Solo se añadieron las primeras {count} capturas de pantalla","Unsupported image type":"Tipo de imagen no admitido","Larger than 10 MB":"Más de 10 MB","Upload failed":"Error al subir","Add a short title.":"Añade un título breve","Please add a bit more detail ({min}+ characters).":"Añade un poco más de detalle ({min}+ caracteres)","Bug report sent":"Informe de error enviado","Idea sent":"Idea enviada","Thanks! The SpatialChat Communities team will take a look.":"¡Gracias! El equipo de SpatialChat Communities le echará un vistazo.","Couldn't send your feedback":"No se pudieron enviar tus comentarios","Report a problem or suggest an improvement to the SpatialChat Communities team.":"Informa de un problema o sugiere una mejora al equipo de SpatialChat Communities.","Feedback type":"Tipo de comentario","Report a bug":"Informar de un error","Suggest an idea":"Sugerir una idea","e.g. Verify code shows “Validation error!”":"p. ej. El código de verificación muestra “¡Error de validación!”","e.g. Let me schedule posts":"p. ej. Permitirme programar publicaciones","What happened?":"¿Qué pasó?","What would you like?":"¿Qué te gustaría?","What did you do, what did you expect, and what happened instead?":"¿Qué hiciste, qué esperabas y qué pasó en su lugar?","What problem are you trying to solve? How would this help you?":"¿Qué problema intentas resolver? ¿Cómo te ayudaría esto?",Screenshots:"Capturas de pantalla","(optional, up to {max})":"(opcional, hasta {max})",Uploading:"Subiendo","Add screenshot":"Añadir captura de pantalla","or drop / paste (Ctrl/⌘+V) an image":"o suelta / pega (Ctrl/⌘+V) una imagen","Screenshots that failed to upload won't be sent. Remove them or try again.":"Las capturas que no se hayan subido no se enviarán. Quítalas o inténtalo de nuevo.","Include technical details":"Incluir detalles técnicos","(recommended)":"(recomendado)","Page, browser, and no recent errors. Passwords, tokens and emails are removed.":"Página, navegador y ningún error reciente. Se eliminan contraseñas, tokens y correos electrónicos.","Page, browser, and {count} recent error. Passwords, tokens and emails are removed.":"Página, navegador y {count} error reciente. Se eliminan contraseñas, tokens y correos electrónicos.","Page, browser, and {count} recent errors. Passwords, tokens and emails are removed.":"Página, navegador y {count} errores recientes. Se eliminan contraseñas, tokens y correos electrónicos.","Page: {path}":"Página: {path}","Browser: {browser}":"Navegador: {browser}","Screen: {width}x{height} · Build: {version}":"Pantalla: {width}x{height} · Versión: {version}","No errors captured in this session.":"No se capturaron errores en esta sesión.","The SpatialChat Communities team may contact me about this":"El equipo de SpatialChat Communities puede contactarme sobre esto","Uploading…":"Subiendo…","Send report":"Enviar informe","Send idea":"Enviar idea","{points} earned":"{points} ganados","{points} to spend":"{points} para gastar","Profile picture updated":"Foto de perfil actualizada","Couldn't update picture":"No se pudo actualizar la foto","Cover photo updated":"Foto de portada actualizada","Couldn't update cover":"No se pudo actualizar la portada","Link copied!":"¡Enlace copiado!","Profile link copied to clipboard.":"Enlace del perfil copiado al portapapeles.",Cover:"Portada","Joined {date}":"Te uniste el {date}","Badges & achievements":"Insignias y logros","No badges earned yet — stay active to unlock your first one.":"Aún no has conseguido insignias: sigue activo para desbloquear la primera.",Badge:"Insignia","You haven't posted yet.":"Aún no has publicado nada.","No activity yet.":"Aún no hay actividad.","Adjust cover photo":"Ajustar foto de portada","Add a bio and interests from":"Añade una biografía e intereses desde","to fill out your About section.":"para completar tu sección Acerca de.",Bio:"Biografía",Interests:"Intereses","No achievement badges are configured for this community yet.":"Aún no hay insignias de logros configuradas para esta comunidad.","Earned {date}":"Conseguida el {date}","Profile updated":"Perfil actualizado","Your changes have been saved.":"Tus cambios se han guardado.","Couldn't save profile":"No se pudo guardar el perfil",Username:"Nombre de usuario","Checking availability…":"Comprobando disponibilidad…","Username is available":"El nombre de usuario está disponible","Username is taken":"El nombre de usuario ya está en uso","3–64 chars: letters, numbers, _ or .":"3–64 caracteres: letras, números, _ o .",Headline:"Titular",Location:"Ubicación","Social links":"Enlaces sociales","Saving…":"Guardando…","Couldn't update preference":"No se pudo actualizar la preferencia","Email notifications":"Notificaciones por correo","Choose which activity on your content sends you an email.":"Elige qué actividad en tu contenido te envía un correo.","Posts created":"Publicaciones creadas","Comments made":"Comentarios realizados","Replies made":"Respuestas realizadas","Likes given":"Me gusta dados","Likes on your posts":"Me gusta en tus publicaciones","Your posts commented":"Tus publicaciones comentadas","Your replies received":"Tus respuestas recibidas","Followers gained":"Seguidores ganados","Live sessions":"Sesiones en directo","Admin-assigned":"Asignados por un administrador",Other:"Otros","How you earned your {points}":"Cómo conseguiste tus {points}","No points yet — post, comment and react to start earning.":"Aún no tienes puntos: publica, comenta y reacciona para empezar a ganarlos.","Language updated":"Idioma actualizado","Using the community's language":"Usando el idioma de la comunidad","Only you see this change.":"Solo tú ves este cambio.","Couldn't change your language":"No se pudo cambiar tu idioma",Language:"Idioma","Menus, buttons and labels are shown in the language you pick here, for you only. Posts, comments and messages stay in the language they were written in. Other members keep the community's language unless they pick their own.":"Los menús, botones y etiquetas se muestran en el idioma que elijas aquí, solo para ti. Las publicaciones, comentarios y mensajes permanecen en el idioma en que se escribieron. Los demás miembros mantienen el idioma de la comunidad, salvo que elijan el suyo.","Choose the language you read this community in.":"Elige el idioma en el que lees esta comunidad.","My language":"Mi idioma","Community default":"Predeterminado de la comunidad","Console error":"Error de consola","Console warning":"Advertencia de consola",Crash:"Fallo","Unhandled error":"Error no controlado","Failed request":"Solicitud fallida",About:"Acerca de",Achievements:"Logros",Website:"Sitio web",Silver:"Plata",Gold:"Oro",Platinum:"Platino",Diamond:"Diamante",Elite:"Élite","Comments on my posts":"Comentarios en mis publicaciones","When someone comments on your post":"Cuando alguien comenta tu publicación","Replies to my comments":"Respuestas a mis comentarios","When someone replies to your comment":"Cuando alguien responde a tu comentario","Likes on my posts":"Me gusta en mis publicaciones","When someone likes your post":"Cuando alguien da me gusta a tu publicación","Reactions to my comments":"Reacciones a mis comentarios","When someone reacts to your comment":"Cuando alguien reacciona a tu comentario","Reactions to my replies":"Reacciones a mis respuestas","When someone reacts to your reply":"Cuando alguien reacciona a tu respuesta","Direct messages":"Mensajes directos","When you receive a direct message":"Cuando recibes un mensaje directo",Mentions:"Menciones","When someone @mentions you":"Cuando alguien te @menciona","Load more {label}":"Cargar más {label}","Loading more {label}…":"Cargando más {label}…",courses:"cursos",resources:"recursos",items:"elementos","About {label}":"Acerca de {label}","Couldn't like this course":"No se pudo dar me gusta a este curso","Couldn't like this resource":"No se pudo dar me gusta a este recurso","Couldn't remove your like":"No se pudo quitar tu me gusta","Notify members":"Avisar a los miembros","Sends everyone in the community a notification about this resource, in the app and as a push notification on their phone or browser. Members who turned off notifications for this community don't get it.":"Envía a todos en la comunidad una notificación sobre este recurso, en la app y como notificación push en su teléfono o navegador. Los miembros que desactivaron las notificaciones de esta comunidad no la reciben.","It is now available in the Knowledge Hub, and members are being notified.":"Ya está disponible en el Knowledge Hub y se está avisando a los miembros.","How posts are ordered":"Cómo se ordenan las publicaciones","Recent: newest first. Top posts: the most likes, of all time; comments don't change the order. Trending: the most likes and comments together, within the period you pick. Following: posts by people you follow.":"Recientes: las más nuevas primero. Destacadas: más me gusta, de todos los tiempos; los comentarios no cambian el orden. Tendencias: más me gusta y comentarios sumados, en el periodo que elijas. Siguiendo: publicaciones de las personas que sigues.","Save this resource":"Guardar este recurso","Save this course":"Guardar este curso","Remove from saved":"Quitar de guardados","Saved. Click to remove it from your saved list.":"Guardado. Haz clic para quitarlo de tu lista de guardados.","Find it any time under Saved in the Knowledge Hub.":"Encuéntralo cuando quieras en Guardados, en el Knowledge Hub.","Find it any time under Saved on the Courses page.":"Encuéntralo cuando quieras en Guardados, en la página de Cursos.","Couldn't save this resource":"No se pudo guardar este recurso","Couldn't save this course":"No se pudo guardar este curso","Couldn't remove it from saved":"No se pudo quitar de guardados","All resources":"Todos los recursos",Show:"Mostrar","Press the bookmark on anything to save it here for later. Only you can see what you saved.":"Pulsa el marcador en cualquier elemento para guardarlo aquí para más tarde. Solo tú puedes ver lo que guardaste.","Date range":"Rango de fechas",Today:"Hoy","Last 7 days":"Últimos 7 días","Last 4 weeks":"Últimas 4 semanas","Last 6 months":"Últimos 6 meses","Last 12 months":"Últimos 12 meses","Month to date":"Mes hasta la fecha","Quarter to date":"Trimestre hasta la fecha","Year to date":"Año hasta la fecha","All time":"Todo el tiempo",Start:"Inicio",End:"Fin",Clear:"Borrar",Apply:"Aplicar","Couldn't download this file":"No se pudo descargar este archivo","A new category is saved with capital letters, so “fancy dress” becomes “Fancy Dress”, and one that already exists is reused rather than added twice.":"Una categoría nueva se guarda con mayúsculas iniciales, así que «fancy dress» pasa a ser «Fancy Dress», y una que ya existe se reutiliza en lugar de añadirse dos veces.","Job title":"Cargo","Your role, such as Head of Sports Science or Team Physiotherapist. It shows under your name in the member directory and on your profile, so members know who to contact.":"Tu función, por ejemplo Responsable de Ciencias del Deporte o Fisioterapeuta del equipo. Aparece bajo tu nombre en el directorio de miembros y en tu perfil, para que los miembros sepan a quién contactar.","e.g. Head of Sports Science":"p. ej. Responsable de Ciencias del Deporte","Type where you are based, or use your current location: your browser asks first, and only the town and country are filled in. Your exact position is never saved. Check it, then save your profile.":"Escribe dónde estás o usa tu ubicación actual: el navegador te lo pregunta primero y solo se rellenan la ciudad y el país. Tu posición exacta nunca se guarda. Revísala y luego guarda tu perfil.","e.g. Stockholm, Sweden":"p. ej. Estocolmo, Suecia","Finding you…":"Buscándote…","Use my location":"Usar mi ubicación","Please enter your location, or use your current location.":"Introduce tu ubicación o usa tu ubicación actual.","Fields marked * are required.":"Los campos marcados con * son obligatorios.","Your details in {community}":"Tus datos en {community}","Your community details":"Tus datos en la comunidad","Community details":"Datos de la comunidad","Questions this community's admins ask every member. Your answers show in its member directory, except ones marked “Only admins see this”.":"Preguntas que los administradores de esta comunidad hacen a todos los miembros. Tus respuestas aparecen en su directorio de miembros, salvo las marcadas como «Solo lo ven los administradores».","Couldn't save your profile":"No se pudo guardar tu perfil","Check the highlighted detail, then save again.":"Revisa el dato resaltado y vuelve a guardar.","Location filled in":"Ubicación rellenada","Check it, then save your profile.":"Revísala y luego guarda tu perfil.","Couldn't use your location":"No se pudo usar tu ubicación","Please type your location.":"Escribe tu ubicación.","Your browser can't share your location here. Please type it.":"Tu navegador no puede compartir tu ubicación aquí. Escríbela.","Location access is blocked. Allow it for this site in your browser settings, or type your location.":"El acceso a la ubicación está bloqueado. Permítelo para este sitio en la configuración del navegador o escribe tu ubicación.","Finding your location took too long. Please try again, or type your location.":"Encontrar tu ubicación tardó demasiado. Inténtalo de nuevo o escribe tu ubicación.","Your location isn't available right now. Please type it.":"Tu ubicación no está disponible ahora. Escríbela.","Location lookup isn't available right now. Please type your location.":"La búsqueda de ubicación no está disponible ahora. Escribe tu ubicación."},Inn={"SpatialChat Communities Keyword":"Estonian",Home:"Kodu","Explore Groups":"Uurige gruppe",Events:"Sündmused",Groups:"Rühmad",Links:"Lingid","Direct Message":"Otsesõnum","Powered by":"Toiteallikaks","No groups here, please use + to create a new one, or join one see them here.":"Siin pole gruppe. Kasutage uue loomiseks nuppu + või liituge, vaadake neid siin.","Please join a group to see them here":"Liituge grupiga, et neid siin näha","Section can only be reordered within the group!":"Sektsiooni saab ümber tellida ainult grupisiseselt!","Group Page":"Grupi leht","Invite Members":"Kutsuge liikmeid",Join:"Liitu",Joined:"Liitunud","Create new section":"Loo uus jaotis","Group Setting drop down":"Rühma seadistuste rippmenüü",Share:"Jaga","Edit group":"Redigeeri gruppi","Delete group":"Kustuta grupp",Leave:"Lahku","Are you sure you want to delete the group?":"Kas olete kindel, et soovite grupi kustutada?",Cancel:"Tühista","Yes, Go Ahead":"Jah, jätkake","Share via link":"Jaga lingi kaudu",Copy:"Kopeeri",Copied:"Kopeeritud","Share on social media":"Jaga sotsiaalmeedias","Add Section":"Lisa jaotis","Section Header":"Jaotise päis",Live:"Otse","Create post":"Loo postitus","Notificaiton Bell":"Teavituskell","All posts":"Kõik postitused","Admin posts only":"Ainult administraatori postitused",None:"Mitte ühtegi","Section Setting drop down":"Jaotise Seade rippmenüü","Edit Section":"Redigeeri jaotist","Embed Section":"Manusta jaotis","Delete Section":"Kustuta jaotis","Are you sure you want to delete the section?":"Kas olete kindel, et soovite jaotise kustutada?","Section deleted!":"Jaotis kustutatud!","Create Group Pop up / Update":"Loo rühma hüpikaken / Värskenda","Create group":"Loo grupp","Basic Detail":"Põhidetail",Settings:"Seaded","Size 16:9 or 1600 by 900":"Suurus 16:9 või 1600 x 900","Group name":"Grupi nimi","Enter group name":"Sisestage rühma nimi","Suggestions: Spaces, Channels, Groups, Blog, Knowledgebase, etc":"Soovitused: ruumid, kanalid, rühmad, ajaveeb, teadmistebaas jne","Group Description":"Grupi kirjeldus","Enter description here":"Sisesta siia kirjeldus","Group Type":"Grupi tüüp",Open:"Avatud","Visible to all & anyone can join":"Nähtav kõigile ja kõik saavad liituda",Closed:"Suletud","User will have to request to join the group":"Kasutaja peab taotlema grupiga liitumist",Paid:"Tasuline","Group Price":"Grupi hind","Currency (Default: INR)":"Valuuta (vaikimisi: INR)","User will have to pay to join the group":"Kasutaja peab grupiga liitumise eest maksma","Make this a private group":"Muutke see privaatseks grupiks","Private group will only be visible to members who are part of it. Admin can add members manually from member list":"Privaatne grupp on nähtav ainult sellesse kuuluvatele liikmetele. Administraator saab liikmeid liikmete loendist käsitsi lisada","Upload from device":"Laadige seadmest üles","Search image":"Otsi pilti","Valid group name required!":"Nõutav kehtiv grupi nimi!","Update Group":"Värskenda gruppi","SEO Settings":"SEO seaded","Custom URL":"Kohandatud URL","Meta Title":"Meta pealkiri","Maximum length of 255 characters allowed":"Maksimaalne lubatud pikkus on 255 tähemärki","Meta Description":"Meta kirjeldus","Open Graph Detail":"Avage graafiku üksikasjad","Open Graph Title":"Avage graafiku pealkiri","Open Graph Description":"Avage graafiku kirjeldus","Open Graph Image":"Avage graafiku pilt","Recommended dimensions: 1200px by 630px with a 1.91:1 aspect ratio.":"Soovitatavad mõõtmed: 1200 x 630 pikslit kuvasuhtega 1,91:1.","If no URL is used, it will automatically picked your group thumbnail.":"Kui URL-i ei kasutata, valib see automaatselt teie rühma pisipildi.","Create Section Pop up / Update":"Loo jaotise hüpikaken / Värskenda","Create Section":"Loo jaotis","Section Name":"Sektsiooni nimi","Suggestions: General, Introductions, Community Guidelines":"Soovitused: Üldine, Sissejuhatus, Kogukonna juhised","Section Type":"Sektsiooni tüüp","Post Type":"Postituse tüüp","Group Chat":"Grupivestlus","Who can post in this section?":"Kes saavad sellesse jaotisesse postitada?","Only Admin":"Ainult Admin","Any user":"Iga kasutaja","Sorting order for section":"Jaotise sortimisjärjekord","Latest first":"Kõigepealt viimane","Oldest post first":"Kõigepealt vanim postitus","Section Appearance":"Sektsiooni välimus","List View":"Loendivaade","Grid View":"Võrguvaade","Make this closed section":"Tehke see suletud osa","Members will have to request access to see section content":"Liikmed peavad jaotise sisu nägemiseks taotlema juurdepääsu","Make this a private section":"Muutke see privaatseks jaotiseks","Disables requests (Make sure closed section is selected as well).":"Keelab päringud (veenduge, et valitud oleks ka suletud jaotis).","Post Editor":"Postituse toimetaja","Create new post in":"Loo uus postitus","Add Cover Picture":"Lisa kaanepilt","Heading (Optional)":"Pealkiri (valikuline)","Write here..":"Kirjuta siia..",Picture:"Pilt",Video:"Video",Attachment:"Manus",Poll:"Küsitlus","Embed Code":"Manusta kood",Tags:"Sildid","Toggle to question":"Lülitage küsimusele sisse","Poll expire time":"Küsitluse aegumisaeg","Poll question":"Küsitluse küsimus","Enter Question":"Sisestage küsimus",Question:"küsimus",Option:"Võimalus",Options:"Valikud","Add Option":"Lisa valik","Poll Expiry time":"Küsitluse aegumisaeg","12 Hours":"12 tundi","1 Day":"1 päev","2 Days":"2 päeva","1 Week":"1 nädal","2 Weeks":"2 nädalat","Always Open":"Alati avatud","Write embeddable code":"Kirjutage manustatav kood","Click here to add embed code.":"Manustuskoodi lisamiseks klõpsake siin.","Paste your embed code here!":"Kleepige oma manustamiskood siia!","Post Settings":"Postituse seaded","Update Post":"Värskenda postitust",Update:"Värskenda","Start meeting / Video call / Live":"Alustage koosolekut / Videokõne / Otseülekanne","Meeting Name":"Koosoleku nimi","Suggestion: Group discussion etc":"Soovitus: Rühmaarutelu jne",Description:"Kirjeldus","Enter description here (optional)":"Sisestage siia kirjeldus (valikuline)","When do you want to start the session":"Millal soovite seanssi alustada","Right now":"Just praegu","Schedule for later":"Ajakava hilisemaks","Group video call":"Grupi videokõne",Webinar:"Veebiseminar","Go Live":"Minge otseülekandesse","Go live":"Minge otseülekandesse","Info on the Post":"Info Postituses","Post comment":"Postita kommentaar",Comment:"kommenteerida",Comments:"Kommentaarid",Reply:"Vasta",Replies:"Vastused","Share via URL":"Jaga URL-i kaudu","Reshare in other sections":"Jagage edasi teistes jaotistes","Post Card Drop Down":"Postkaardi rippmenüü",Bookmark:"Järjehoidja","Pin post":"Kinnitage postitus",Edit:"Muuda","Embed Post":"Manusta postitus",Delete:"Kustuta","Remove Pin":"Eemalda Pin","Remove Bookmark":"Eemalda järjehoidja","Just copy paste this code wherever you want it to be embedded":"Lihtsalt kopeerige ja kleepige see kood kuhu iganes soovite selle manustada",Height:"Kõrgus",Preview:"Eelvaade","Copied to clipboard":"Kopeeriti lõikelauale","Select Widgets":"Valige Vidinad","Add widgets to":"Lisa vidinaid","You can change their order by dragging & dropping the widgets over each other":"Saate nende järjekorda muuta, pukseerides vidinaid üksteise peale","Please note: Widget wont be displayed if there is no data available,":"Pange tähele: vidinat ei kuvata, kui andmed puuduvad,","Group Members":"Grupi liikmed","Group Leaderboard":"Grupi edetabel","Community Leaderboard":"Kogukonna edetabel","Trending Posts":"Populaarsed postitused","Group Events":"Grupiüritused","Add Custom":"Lisa kohandatud","Save Widgets":"Salvesta vidinad","Visible to user":"Kasutajale nähtav","Visible to admin":"Nähtav administraatorile","Add widget to":"Lisa vidin","Upload cover picture":"Laadi üles kaanepilt","1:1 aspect ration (recommended)":"1:1 kuvasuhe (soovitatav)","Card Title":"Kaardi pealkiri","Enter widget name":"Sisestage vidina nimi","Small Description (try to keep it under 50 words)":"Väike kirjeldus (proovige hoida seda alla 50 sõna)","Enter description":"Sisesta kirjeldus","Button Title":"Nupu pealkiri","Enter button name":"Sisestage nupu nimi","Siggestion: Know more, Join, Apply, etc":"Soovitus: teadke rohkem, liituge, kandideerige jne","URL link":"URL-i link","Create custom widget":"Loo kohandatud vidin","Custom widget created successfully":"Kohandatud vidin on edukalt loodud",Widgets:"Vidinad",Members:"liikmed","See All":"Vaata kõiki","Communtiy Top Contributors":"Kogukonna tipp-panustajad","Community members":"kogukonna liikmed","Group Top Contributors":"Rühma suurimad panustajad","Upcoming Events":"Eelseisvad sündmused","Home Page Banner":"Kodulehe bänner","Edit Banner":"Redigeeri bännerit","Home page Edit Banner Pop up":"Avaleht Redigeeri bänneri hüpikaken","Update Banner":"Värskenda bännerit",Search:"Otsi","Upload Image":"Laadi pilt üles",Remove:"Eemalda","Banner image (please use 16:6 ratio or 1600px by 600px image for the best view)":"Bännerpilt (parima vaate saamiseks kasutage pilti 16:6 või 1600 × 600 pikslit)","Banner Title":"Bänneri pealkiri","Enter here":"Sisestage siia","Suggestion: Welcome to my community etc":"Soovitus: Tere tulemast minu kogukonda jne","Banner Description":"Bänneri kirjeldus","Enter banner description":"Sisestage bänneri kirjeldus","Save Banner Info":"Salvestage bänneriteave","Home Page Feed":"Avalehe voog",Recent:"Viimased","Top posts":"Populaarseimad postitused",Trending:"Trendikas","Home Feed Groups":"Kodukanalite rühmad","":"#VALUE!","My profile":"Minu profiil",Logout:"Väljalogimine",Notification:"Teavitus",Notifications:"Märguanded","Mark all viewed":"Märgi kõik vaadatud","has created a post":"on loonud postituse","wants to join":"tahab liituda","has commented on your post":"on teie postitust kommenteerinud","has replied to your comment":"on teie kommentaarile vastanud","Search for tags":"Otsige silte","All groups":"Kõik rühmad","Search result":"Otsingu tulemus","No post found for selected hashtag":"Valitud hashtagile postitust ei leitud","Start a conversation":"Alustage vestlust","Search by name":"Otsi nime järgi",Upcoming:"Tulemas",UPCOMING:"TULEMAS",Past:"Minevik",PAST:"MINEVIK","No upcoming events":"Tulevasi sündmusi pole","Create event popup":"Loo sündmuse hüpikaken","Event details":"Sündmuse üksikasjad","16:9 aspect ratio":"16:9 kuvasuhe","Event name":"Sündmuse nimi","Enter event name":"Sisestage sündmuse nimi","Host Name":"Hosti nimi","You will be made host if none selected":"Kui ühtegi valitud ei ole, muudetakse teid hostiks","Write here...":"Kirjuta siia...","No. of registration for the event":"Üritusele registreerimise number",Unlimited:"Piiramatu","When & where":"Millal ja kus",From:"Alates","Start date":"Alguskuupäev",time:"aega",To:"To","End date":"Lõppkuupäev","Current time zone:":"Praegune ajavöönd:","Can be updated from the communtiy setting":"Saab värskendada kogukonna seadetest","Online event":"Online üritus","Add meeting link":"Lisa koosoleku link","Meeting link will be generated once event is created":"Koosoleku link luuakse pärast sündmuse loomist",Venue:"Toimumiskoht","Enter address":"Sisestage aadress",Create:"Loo",Invite:"Kutsu","Share event via link":"Jaga sündmust lingi kaudu",Copy__1:"Kopeeri","Select section to post this event":"Valige selle sündmuse postitamiseks jaotis","Once posted, members of that group or section will recieve an notification":"Pärast postitamist saavad selle rühma või jaotise liikmed teatise",Post:"Postita",RSVP:"RSVP","Book Event":"Raamatu üritus","Yes, I'll attend":"Jah, ma osalen","May be":"Võib olla","No, I won't attend":"Ei, ma ei osale","Date & Time":"Kuupäev ja kellaaeg",Host:"Host","Online meeting":"Interneti-kohtumine","Meeting link will be visible once registered for the event":"Koosoleku link on nähtav pärast üritusele registreerumist","User Management":"Kasutajate haldamine","Go bac to community":"Mine tagasi kogukonda","Manage Members":"Liikmete haldamine",Member:"liige",Invited:"Kutsutud","Search for member":"Otsi liiget","Add to group":"Lisa gruppi","Send Direct Message":"Saada otsesõnum","Change role":"Muuda rolli","Kick from community":"Kick kogukonnast","Super Admin":"Superadministraator","Super admin will have full access to the communtiy settings":"Superadministraatoril on täielik juurdepääs kogukonna seadetele","Group Admin":"Grupi administraator","Admin of the selected group can edit the group information and create, edt or delete section under selected group":"Valitud grupi administraator saab grupi teavet redigeerida ja valitud grupi all jaotist luua, redigeerida või kustutada","Group Moderator":"Grupi moderaator","Group moderator can create or delete post, comment, reply & messages in the selected group.":"Grupi moderaator saab valitud grupis postitusi, kommenteerida, vastata ja sõnumeid luua või kustutada.",User:"Kasutaja",Save:"Salvesta","User role updated successfully":"Kasutaja rolli värskendamine õnnestus",Leaderboard:"Edetabel","Click on the column header for sorting":"Sortimiseks klõpsake veerupäisel",Rank:"Aste","Karma Points":"Karma punktid","Custom Points":"Kohandatud punktid",Follow:"Jälgi",Upvotes:"Poolthääli",Posts:"Postitused","Add custom points":"Lisage kohandatud punkte","Subtract custom points":"Lahutage kohandatud punktid","Enter no. of points":"Sisestage nr. punktidest","Add points":"Lisa punkte","Invite members to":"Kutsuge liikmeid","Invite via link":"Kutsu lingi kaudu","Invite via email":"Kutsuge meili teel","Add more":"Lisage veel","Upload a CSV":"Laadige üles CSV","Please upload a comma-seprated CSV file, with header as name, email.":"Laadige üles komadega eraldatud CSV-fail, mille päis on nimi, e-posti aadress.","Here is a template CSV file":"Siin on CSV-faili mall","Upload File":"Laadi fail üles","Send Invite":"Saada kutse","Mail Template":"Meili mall","Send Test Mail":"Saada testpost",Hey:"Tere","A has invite you to join the B":"A kutsus teid B-ga liituma","Switch to rich text editor":"Lülituge rikastekstiredaktorile","Add Custom Message":"Lisa kohandatud sõnum","Enter message here":"Sisesta sõnum siia","Send Bulk Mail":"Saada hulgipostitus","Send Mail":"Saada kiri","Send bulk mail to all community members or select group members":"Saatke hulgipostitus kõigile kogukonna liikmetele või valitud rühmaliikmetele",Date:"Kuupäev",Subject:"Teema",Recipients:"Saajad","1000 bulk emails remaining for this month. Resets on <date>":"Selleks kuuks on jäänud 1000 hulgikirja. Lähtestab <kuupäev>",Everyone:"Kõik","Enter mail subject":"Sisestage kirja teema","Write message":"Kirjutage sõnum",Cancel__1:"Tühista",Send:"Saada",__1:"#VALUE!",Activity:"Tegevus",Bookmarks:"Järjehoidjad","Edit profile":"Redigeeri profiili",Unsubscribe:"Loobu tellimusest","Settings (Account)":"Seaded (konto)",Profile:"Profiil","Set Profile Picture":"Määra profiilipilt","Your name":"Sinu nimi","User ID":"Kasutaja ID","Short bio":"Lühike biograafia","Link your social account":"Linkige oma sotsiaalkonto","This will be displayed on your profile":"See kuvatakse teie profiilil","Add social handle":"Lisage suhtluskäepide",Verification:"Kontrollimine","Account Verification":"Konto kinnitamine",Email:"Meil","Enter email":"Sisestage e-posti aadress",Verified:"Kinnitatud",Unverified:"Kinnitamata",Change:"Muuda",Unlink:"Tühista linkimine",Mobile:"Mobiilne","enter mobile no.":"sisestage mobiili nr.","Request OTP":"Taotlege OTP-d","Manage your personal account notification preferences":"Hallake oma isikliku konto teavituse eelistusi",Prefrences:"Eelistused","Email notification":"Meiliteade","Notify me about comments on my posts":"Anna mulle teada minu postituste kommentaaridest","Notify me about replies on my comments":"Anna mulle teada minu kommentaaridele vastamisest","Notify me about likes on my posts":"Teavita mind meeldimistest minu postitustele","Notify me about reaction on my comments":"Teavita mind kommentaaridele reageerimisest","Notify me about reaction on my reply":"Anna mulle teada minu vastusele reageerimisest","Notify me about direct message":"Teavitage mind otsesõnumi kohta","Notify me about my mentions":"Anna mulle minu mainimistest teada","Notification for new posts":"Teade uute postituste kohta","Only group & section available which you are part of":"Saadaval on ainult rühm ja jaotis, mille osa te olete","Group & Section":"Rühm ja sektsioon","All activity":"Kogu tegevus","Post by admin":"Postitus administraatorilt","No Notification":"Märguanne puudub","Setting (Community)":"Seade (kogukond)","General Settings":"Üldsätted","Upload community logo":"Laadige üles kogukonna logo","Community name":"kogukonna nimi","Invalid field":"Vale väli","Your community address":"Teie kogukonna aadress","Fav icon":"Lemmik ikoon","This will be visible on the browser tab (32px by 32px)":"See on nähtav brauseri vahekaardil (32 x 32 pikslit)",TimeZone:"Ajavöönd","Privacy Policy on login page":"Privaatsuspoliitika sisselogimislehel","Terms & Condition on login page":"Tingimused sisselogimislehel","Enter link here":"Sisesta link siia","Open Group Image":"Avage rühmapilt","By default ir takes up the community banner uploaded with the communtiy":"Vaikimisi kasutab ir koos kommuuniga üles laaditud kogukonna bänneri","Community Experience":"kogukonna kogemus",Onboarding:"Sissepääs","Member Fields":"Liikmeväljad","Make your community private":"Muutke oma kogukond privaatseks","Users will have to login or sign up to access the community":"Kasutajad peavad kogukonnale juurdepääsuks sisse logima või registreeruma","Make account verification mandatory for both email & mobile":"Muutke konto kinnitamine kohustuslikuks nii meili kui ka mobiili jaoks","New user will have to verify both email & mobile no. to access the community":"Uus kasutaja peab kinnitama nii e-posti kui ka mobiilinumbri. kogukonnale juurdepääsuks","Admin will also have to verify their mobile no. & email or else they won't be able to access the community":"Administraator peab kinnitama ka oma mobiilinumbri. & meilisõnumiga või muidu ei pääse nad kogukonnale juurde","Gated community access":"Piiratud kogukonna juurdepääs","Admin will have to approve or reject user's requests to join the community":"Administraator peab kasutaja taotlused kogukonnaga liitumiseks heaks kiitma või tagasi lükkama","Disable mobile login/register":"Keela mobiilne sisselogimine/registreerumine","Disable email login/register":"Keela e-posti sisselogimine/registreerimine","Disable google login/register":"Keela Google'i sisselogimine/registreerimine","Disable facebook login/register":"Keela Facebooki sisselogimine/registreerimine","Show & Hide features":"Funktsioonide näitamine ja peitmine","Hide direct chat":"Peida otsevestlus","User will not be able to send direct messages to each other":"Kasutajad ei saa üksteisele otsesõnumeid saata","Hide profile picture from top right corner for mobile responsive view":"Peida profiilipilt paremast ülanurgast, et näha mobiilile reageerivat vaadet","Useful when using community in an in app browser":"Kasulik kogukonna kasutamisel rakendusesiseses brauseris","Hide profile picture from top right corner in every view":"Peida profiilipilt igas vaates paremast ülanurgast","Disable header dropdown on profile picture":"Keela profiilipildil päise rippmenüü","Useful for integrated community, especially using SSO":"Kasulik integreeritud kogukonna jaoks, eriti SSO-d kasutades","Hide the communtiy logo from the header":"Peida kogukonna logo päisest","Hide the communtiy title from the header":"Peida kogukonna pealkiri päisest","Show collpased group in the side nav bar":"Kuva ahendatud rühm külgmisel navigeerimisribal","Show full expanded post in the home feed":"Kuva täielik laiendatud postitus koduvoos","Hide the leaderboard score from the header":"Peida edetabeli tulemus päisest","Show powered by SpatialChat Communities":"Show powered by SpatialChat Communities","Hide closed groups if not joined":"Peida suletud rühmad, kui pole liitunud","Closed groups would not be shown to the user if they are not a member of the group":"Suletud gruppe ei näidata kasutajale, kui ta ei ole grupi liige","Hide Community subscriber count from the users":"Peida kogukonna tellijate arv kasutajate eest","This will hide the community subscriber list in the community header":"See peidab kogukonna tellijate loendi kogukonna päises","Disable Communtiy Switcher":"Keela kogukonna vahetaja","Use MD editor for create post description":"Kasutage postituse kirjelduse loomiseks MD-redaktorit","Non logged in user will land on explore group page instead of post directory":"Sisselogimata kasutaja jõuab postituste kataloogi asemel uurimisrühma lehele","Advanced configurable":"Täpsemalt konfigureeritav","Communtiy default country code":"Ühenduse riigi vaikekood","This will show up by default on login/signup":"See kuvatakse sisselogimisel/registreerumisel vaikimisi","Onboarding/Welcome Message":"Sisseastumis-/tervitusteade","Welcome Message":"Tervitussõnum","Greet your members with personalized message":"Tervitage oma liikmeid isikupärastatud sõnumiga","Welcome to":"Tere tulemast",Message:"Sõnum","Add message":"Lisa sõnum","Custom domain":"Kohandatud domeen","Add custom domain":"Lisa kohandatud domeen","Create new request":"Loo uus taotlus","Enter your custom domain":"Sisestage oma kohandatud domeen","Setup details":"Seadistuse üksikasjad","Add a CNAME record in your domain pointing to this community's address":"Lisage oma domeeni CNAME-kirje, mis osutab selle kogukonna aadressile","To configure your domain, you'll need to add a CNAME record pointing your domain to your pensil community URL":"Domeeni konfigureerimiseks peate lisama teie domeenile suunava CNAME-kirje teie pensili kogukonna URL-ile","Step by Step help apge":"Samm-sammult abi lk","All request list":"Kõik taotlused","Allow admin to assign/un-assign custom points to users":"Luba administraatoril kasutajatele kohandatud punkte määrata/määramise tühistada","Base points for user to begin with":"Alustuseks kasutajate baaspunktid","Base points will be updated for all the users, any changes will reflect for all the users.":"Baaspunkte värskendatakse kõigi kasutajate jaoks, kõik muudatused kajastuvad kõigi kasutajate jaoks.","Allocate points for interaction":"Jagage suhtlemiseks punkte","Upvoting post":"Poolthääletav postitus","creating a comment":"kommentaari loomine","creating a reply":"vastuse loomine","Getting upvote to their post":"Saab nende postituse poolthääle","Getting comment to their post":"Kommentaari saamine nende postitusele","Getting reply to their comment":"Nende kommentaarile vastuse saamine","Creating a post":"Postituse loomine",Visiblity:"Nähtavus","Move Up":"Liigu üles","Move Down":"Liigu alla","Create embedded section":"Loo manustatud jaotis","Preview area":"Eelvaateala","Theme selector":"Teema valija","Community Theme":"Kogukonna teema","Select theme":"Valige teema","Select brand color":"Valige kaubamärgi värv","Customize your button color to match your brand":"Kohandage oma nupu värvi vastavalt oma kaubamärgile","Select on button text color":"Valige nupu teksti värv","Suggestion: Keep inverted contrast against brand color":"Soovitus: säilitage vastupidine kontrast brändi värvi suhtes",Billing:"Arveldamine","Current plan":"Praegune plaan","You are current on Free PLan":"Olete praegu tasuta PLanis","Renew on: NA":"Uuenda: NA",Select:"Valige","Email us at":"Saatke meile e-kiri aadressil","Compare plan":"Võrdle plaani","API Keys":"API võtmed","Create new key":"Loo uus võti","Total keys":"Võtmed kokku","Keep your API keys safe! You can use them to access specific feature & let cetain apps perfrom certain actions on your behalf on the platform.":"Hoidke oma API võtmed turvaliselt! Saate neid kasutada, et pääseda juurde konkreetsetele funktsioonidele ja lasta teatud rakendustel platvormil teie nimel teatud toiminguid teha.","Key name":"Võtme nimi","Key value":"Võtmeväärtus",Action:"Tegevus","Group updated!":"Gruppi värskendati!","Are you sure you want to":"Kas olete kindel, et soovite","Make Moderator":"Tee moderaatoriks","Remove from group":"Eemalda grupist","Show All":"Kuva kõik","Change Role":"Muuda rolli",Close:"Sule",copy:"kopeerida",LINKS:"LINGID","Email Id":"E-posti ID",Name:"Nimi","Search for an image":"Otsige pilti","Crop Image":"Kärbi pilti","No photos found":"Fotosid ei leitud",Community:"kogukond","Banner ratio - 16:9":"Bänneri suhe – 16:9","Banner Ratio - 16:6":"Bänneri suhe – 16:6","Share on mail":"Jaga meili teel","Share on Telegram":"Jaga Telegramis","Share on Whatsapp":"Jagage Whatsappis","Share on Linkedin":"Jagage Linkedinis","Share on Facebook":"Jaga Facebookis","Share on Twitter":"Jaga Twitteris","Pin Post":"Kinnitage postitus","Heading (optional)":"Pealkiri (valikuline)","Select section":"Valige jaotis",Gif:"Gif","Create Custom Widget":"Loo kohandatud vidin","Are you sure you want to delete this widget?":"Kas olete kindel, et soovite selle vidina kustutada?","Go to event":"Mine sündmusele","Add Tags":"Lisa sildid","Create Tag":"Loo silt","Title (Optional)":"Pealkiri (valikuline)","Search Gif":"Otsi Gif","What's on your mind":"Mis sul meeles on","Looks like nothing available here right now.":"Näib, et siin pole praegu midagi saadaval.","Try exploring other tabs":"Proovige uurida teisi vahekaarte","Delete Widget":"Kustuta vidin","Please select a section to post":"Valige postitamiseks jaotis","Post added successfully!":"Postituse lisamine õnnestus!","Failed to create post. Please check post content and retry again.":"Postituse loomine ebaõnnestus. Kontrollige postituse sisu ja proovige uuesti.","Are you sure you want to discard current post?":"Kas olete kindel, et soovite praegusest postitusest loobuda?","By default it will take up the image uploaded with the post":"Vaikimisi võtab see üles koos postitusega üles laaditud pildi","Quiz can be only viewed and attempted from mobile device right now!":"Viktoriini saab praegu vaadata ja proovida ainult mobiilseadmest!","Community Banner":"Kogukonna bänner","Change Cover":"Vahetage katet","Suggestions: Welcome to my community etc":"Soovitused: Tere tulemast minu kogukonda jne","(edited)":"(redigeeritud)","Aspect ratio (recommended)":"Kuvasuhe (soovitatav)","Banner details updated!":"Bänneri üksikasju uuendatud!","Refresh if changes are not visible!":"Värskendage, kui muudatusi pole näha!","Banner details could not be updated!":"Bänneri üksikasju ei saanud värskendada!","Post deleted":"Postitus kustutatud","Post not available. It may have been deleted.":"Postitus pole saadaval. See võib olla kustutatud.",Admin:"Admin",Moderator:"Moderaator","Bookmark added!":"Järjehoidja lisatud!","Bookmark removed":"Järjehoidja eemaldatud","Failed performing action!":"Toiming ebaõnnestus!","Copy this link to share on other platforms":"Teistel platvormidel jagamiseks kopeerige see link","View this event":"Vaadake seda sündmust",Event:"Sündmus","Join Meeting":"Liitu koosolekuga","The live meeting has ended":"Otseülekanne on lõppenud","read more...":"loe edasi...","Load more comments":"Laadige rohkem kommentaare","Post Reply":"Postita vastus","Post Comment":"Postita kommentaar",more:"rohkem",upvoted:"poolthääletanud","1 Upvote":"1 poolthääl","1 Comment":"1 kommentaar","Please enter a title":"Palun sisestage pealkiri","Please enter a url link":"Sisestage URL-i link","Please enter button title":"Sisestage nupu pealkiri","Button label must be at least 20 characters":"Nupu silt peab olema vähemalt 20 tähemärki pikk","Please enter valid url":"Sisestage kehtiv URL","Suggestions: Know more, Join, Apply...":"Soovitused: uuri rohkem, liitu, kandideeri...",URL:"URL","Community Events":"Ühiskondlikud üritused","Widget deleted successfully":"Vidina kustutamine õnnestus","Community Top Contributors":"Kogukonna tipp-panustajad",points:"punktid","Points cannot be greater than current points":"Punktid ei tohi olla suuremad kui praegused punktid","Point cannot be a negative value":"Punkt ei saa olla negatiivne väärtus","Point cannot be a decimal point":"Punkt ei saa olla koma","Please enter a valid number":"Sisestage kehtiv number","Karma points updated successfully":"Karma punktide värskendamine õnnestus","Error in updating karma points":"Viga karmapunktide värskendamisel","Add karma points":"Lisage karma punkte","Minus karma points":"Miinus karma punktid","Total Karma points:":"Karma punktid kokku:","Enter no. of karma points":"Sisestage nr. karma punktidest","Minus Points":"Miinuspunktid","Trending Post":"Populaarsust koguv postitus","No visible description":"Nähtavat kirjeldust pole","Picture ratio: 1:1":"Pildi suhe: 1:1","home feed":"kodu sööt","Event name is invalid!":"Sündmuse nimi on kehtetu!",custom:"kohandatud","Custom widget updated successfully":"Kohandatud vidina värskendamine õnnestus","Name invalid!":"Nimi kehtetu!","Current timezone:":"Praegune ajavöönd:","can be updated from community settings":"saab värskendada kogukonna seadetest","Event created successfully":"Sündmuse loomine õnnestus","Error in creating event":"Viga sündmuse loomisel",Attendees:"Osalejad","Do you wish to notify these changes to attendees?":"Kas soovite nendest muudatustest osalejaid teavitada?","users wants to attend this event":"kasutajad soovivad sellel sündmusel osaleda","Yes, Notify them":"Jah, teavitage neid","No, its okay":"Ei, see on korras","Do you wish to notify that event is cancelled?":"Kas soovite teavitada, et üritus jääb ära?","Are you sure you want to delete the event?":"Kas olete kindel, et soovite sündmuse kustutada?","Delete Event":"Kustuta sündmus","New Event":"Uus sündmus","Accept Invitation":"Võta kutse vastu",Requested:"Soovitud",Declined:"Keeldutud","Request Access":"Taotle juurdepääsu","Enroll for":"Registreeruge",Housefull:"Majatäis","Just copy paste this code wherever you want it to be embedded:":"Lihtsalt kopeerige ja kleepige see kood sinna, kuhu soovite selle manustada:",Ended:"Lõppenud","Error getting events":"Viga sündmuste hankimisel","Events could not be fetched!":"Sündmusi ei saanud tuua!","Show Attendees":"Näita osalejaid",Subscribers:"Tellijad","Make this a closed section":"Muutke see suletud jaotiseks","Update Section":"Uuenda jaotist","Valid section name required!":"Nõutav kehtiv jaotise nimi!","Enter section name":"Sisestage jaotise nimi","Community Admin":"Kogukonna administraator",Embed:"Manusta","Invite to":"Kutsu","Please enter a valid email address":"Sisestage kehtiv e-posti aadress","Invitation sent successfully":"Kutse saadeti edukalt","Error sending invitation":"Viga kutse saatmisel","Email is not valid!":"E-post ei kehti!","Data could not be loaded!":"Andmeid ei saanud laadida!","Posted in":"Postitatud","Invite Members Individually":"Kutsuge liikmeid individuaalselt","Start a discussion":"Alustage arutelu","Post something":"Postitage midagi","Invite your audience":"Kutsu oma publik","Choose Plan":"Valige Plaan",or:"või","Create a link":"Loo link","Add link":"Lisa link","Update link":"Värskenda linki","Add shortcut to your most used tools":"Lisage otsetee oma enimkasutatud tööriistadele","Your website, Instagram Channel, Facebook profile etc":"Teie veebisait, Instagrami kanal, Facebooki profiil jne","Valid link name required!":"Nõutav kehtiv lingi nimi!","Valid url required, and make sure you are not missing http:// or https://":"Nõutav on kehtiv URL ja veenduge, et teil pole puudu http:// või https://","Invite to__1":"Kutsu","Link Name":"Lingi nimi","Link URL":"Lingi URL","Could not subscribe to":"Ei saanud tellida","Subscribed to":"Tellitud","By default it will take up the community banner uploaded with the community":"Vaikimisi võtab see üles koos kogukonnaga üles laaditud kogukonna bänneri","Created by":"Loodud","Online Event (Meeting link will be visible once registered for the event)":"Veebisündmus (Koosoleku link on nähtav pärast üritusele registreerumist)","Join Call":"Liitu kõnega","Please login to book this event":"Selle ürituse broneerimiseks logige sisse","Commented on":"kommenteeris","Replied to":"Vastas","Looks like it's lonely here.":"Tundub, et siin on üksildane.","Try exploring other sections and groups.":"Proovige uurida teisi jaotisi ja rühmi.","Please proceed with the payment or contact admin to gain access to this group.":"Sellele grupile juurdepääsu saamiseks jätkake maksega või võtke ühendust administraatoriga.","This is a closed group You'll need access to this group.":"See on suletud grupp Teil on vaja sellele grupile juurdepääsu.","You have no bookmarks right now.":"Teil pole praegu järjehoidjaid.","The user hasn't posted anything yet publicly.":"Kasutaja pole veel midagi avalikult postitanud.","No activity to show.":"Kuvatavat tegevust pole.","Are you sure you want to unsubscribe the community?":"Kas olete kindel, et soovite kogukonna tellimusest loobuda?","deals left":"pakkumised jäänud","Something went wrong while loading posts":"Midagi läks postituste laadimisel valesti","Could not unsubscribe from":"Tellimust ei saanud tühistada","Unsubscribed from":"Tellimusest loobuti","Login to view this page":"Selle lehe vaatamiseks logige sisse",Login:"Logi sisse","There was some error while doing the action!":"Toimingu tegemisel ilmnes viga!","Unable to delete section!":"Jaotist ei saa kustutada!",__2:"",__3:"",__4:"","Home page":"Avaleht","Members Directory":"Liikmete kataloog",Calendar:"Kalender","Create Group":"Loo rühm","Start Live Session":"Alustage otseülekannet",Home__1:"Kodu",Following:"Jälgides",__5:"","Post Card":"Postkaart",Like:"meeldib",Comment__1:"kommenteerida",Comment__2:"kommenteerida",Share__1:"Jaga",Report:"Teata","Follow User":"Jälgi kasutajat","Report User":"Teata kasutajast","Report Post":"Teata postitusest",__6:"","LeaderBoard Floating pop up":"Edetabel Ujuv hüpikaken","Go to leaderboard":"Mine edetabelisse","Total karma points":"Karma punktid kokku",Comments__1:"Kommentaarid",Upvotes__1:"Poolthääli",Replies__1:"Vastused",Post__1:"Postita","Custom Points__1":"Kohandatud punktid","Base Points":"Baaspunktid",__7:"",Channel:"Kanal","This is a private channel":"See on privaatne kanal","You'll need access to this channel":"Teil on vaja juurdepääsu sellele kanalile",__8:"","Profile Page":"Profiilileht",Followers:"Jälgijad",Activities:"Tegevused",__9:"","Settings Page":"Seadete leht","Go back to community":"Mine tagasi kogukonda",Account:"konto","Notification Centre":"Teavituskeskus",__10:"","Edit Profile Page":"Redigeeri profiililehte","Set profile Picture":"Määra profiilipilt","Your name__1":"Sinu nimi",Subtitle:"Alapealkiri","(Max char 60)":"(Max 60 tähemärki)","User Id":"Kasutaja ID","Short Bio":"Lühike biograafia","Link For Social Account":"Link sotsiaalkonto jaoks","This will be displayed on your profile__1":"See kuvatakse teie profiilil","Add Social handles":"Lisage sotsiaalsed käepidemed",__11:"","Verification Page":"Kinnitusleht",Email__1:"Meil",Verified__1:"Kinnitatud",__12:"","Manage your personal account notification preferences__1":"Hallake oma isikliku konto teavituse eelistusi",Preferences:"Eelistused","Email Notification":"E-posti teavitus","Notify me about comment on my posts":"Anna mulle teada minu postituste kommenteerimisest","Notify me about replies on my comment":"Teavita mind minu kommentaarile vastamisest","Notify me about upvote on my post":"Teavita mind minu postituse poolthääle andmisest","Notify me about reaction to my comment":"Teavita mind minu kommentaarile reageerimisest","Notify me about reaction on my reply__1":"Anna mulle teada minu vastusele reageerimisest","Notify me about direct message__1":"Teavitage mind otsesõnumi kohta","Notify me about mentions":"Anna mulle mainimisest teada","Notification for new posts__1":"Teade uute postituste kohta","Only groups and channel available which you are part of. You can also control notification":"Saadaval on ainult rühmad ja kanal, mille osa te olete. Saate ka märguandeid juhtida","Group & Channels":"Grupp ja kanalid","All Activity":"Kõik tegevused","Post by admin__1":"Postitus administraatorilt","No Notification__1":"Märguanne puudub",__13:"","Direct Message__1":"Otsesõnum",Inbox:"Postkast","No chats found":"Vestlusi ei leitud",__14:"","Create Post Popup":"Loo postituse hüpikaken","Create Post in":"Loo postitus sisse","Select Channel":"Valige Kanal",__15:"","Dark mode":"Tume režiim",Feed:"Voog",Saved:"Salvestatud",Workflows:"Töövood",Rewards:"Auhinnad",Networking:"Võrgustumine",Course:"Kursus","Member Directory":"Liikmete kataloog","Email Marketing":"E-posti turundus",Analytics:"Analüütika","Log out":"Logi välja","Switch community":"Vaheta kogukonda",Support:"Tugi","Select topic":"Vali teema","Featured Posts":"Esiletõstetud postitused","Featured posts":"Esiletõstetud postitused",Courses:"Kursused","Explore courses and learning paths in your community.":"Avasta oma kogukonna kursusi ja õpiradu.","Add course":"Lisa kursus","Search title, description, or creator…":"Otsi pealkirja, kirjelduse või autori järgi…","Search courses":"Otsi kursusi","Clear search":"Tühjenda otsing","Filter courses":"Filtreeri kursusi","Sort courses":"Sorteeri kursusi","Clear filters":"Tühjenda filtrid","{count} course":"{count} kursus","{count} courses":"{count} kursust",Updating:"Värskendamine","Could not load courses":"Kursuste laadimine ebaõnnestus","Something went wrong. Please try again.":"Midagi läks valesti. Proovi palun uuesti.",Retry:"Proovi uuesti","No courses found":"Kursusi ei leitud","Try another search term or change the filter.":"Proovi mõnda muud otsingusõna või muuda filtrit.","No courses available":"Kursusi pole saadaval","Create the first course for your community.":"Loo oma kogukonnale esimene kursus.","Check back when new courses are published.":"Vaata hiljem uuesti, kui uusi kursusi avaldatakse.","Showing {shown} of {total} course":"Kuvatud {shown} kursust {total}-st","Showing {shown} of {total} courses":"Kuvatud {shown} kursust {total}-st","Show less":"Näita vähem","Read more":"Loe edasi","Request sent":"Taotlus saadetud","An admin will review your enrollment request.":"Administraator vaatab sinu registreerumistaotluse üle.",Enrolled:"Registreeritud","You can start learning now.":"Võid kohe õppima hakata.","Something went wrong.":"Midagi läks valesti.","Could not join course":"Kursusega liitumine ebaõnnestus","No lessons yet":"Õppetunde veel pole","Content will appear when lessons are published.":"Sisu ilmub, kui õppetunnid on avaldatud.","Course deleted":"Kursus kustutatud","Could not delete course":"Kursuse kustutamine ebaõnnestus","Course duplicated":"Kursus dubleeritud","The copy was created as a draft.":"Koopia loodi mustandina.","Could not duplicate course":"Kursuse dubleerimine ebaõnnestus","Left course":"Kursusest lahkutud","Could not leave course":"Kursusest lahkumine ebaõnnestus","Continue learning":"Jätka õppimist","Buy now":"Osta kohe","Send request to enroll":"Saada registreerumistaotlus","Enroll now":"Registreeru kohe","Course not found":"Kursust ei leitud","This course may have been removed or you lack access.":"See kursus on võidud eemaldada või sul puudub juurdepääs.","Back to Courses":"Tagasi kursuse juurde","By {name}":"Autor: {name}","{count} lesson":"{count} õppetund","{count} lessons":"{count} õppetundi","Total time to complete":"Läbimise koguaeg","Attached to {group}":"Seotud rühmaga {group}",Progress:"Edenemine","{done}/{total} lessons · {percent}%":"{done}/{total} õppetundi · {percent}%","Edit course":"Muuda kursust","Duplicate course":"Dubleeri kursus","Delete course":"Kustuta kursus","Course access is included with your active paid access":"Kursusele juurdepääs kuulub sinu aktiivse tasulise juurdepääsu hulka","Leave course":"Lahku kursuselt",Content:"Sisu","Quiz results":"Testi tulemused","Delete course?":"Kas kustutada kursus?","All course content and member progress will be permanently removed.":"Kogu kursuse sisu ja liikmete edenemine kustutatakse jäädavalt.","Leave course?":"Kas lahkuda kursuselt?","You will lose access to lessons until you enroll again.":"Sul puudub juurdepääs õppetundidele, kuni registreerud uuesti.","Not enrolled":"Pole registreeritud","Course content unlocks once you are enrolled. Request access or purchase membership if required.":"Kursuse sisu avaneb pärast registreerumist. Vajadusel taotle juurdepääsu või osta liikmelisus.","Add section":"Lisa jaotis","No content yet":"Sisu veel pole","Add a section to start building this course.":"Lisa jaotis, et selle kursuse loomist alustada.","Content will be available when the course starts.":"Sisu on saadaval, kui kursus algab.","{count} comment":"{count} kommentaar","{count} comments":"{count} kommentaari","No comments on this course yet.":"Sellel kursusel pole veel kommentaare.","Showing {from}-{to} of {total} comments":"Kuvatud {from}–{to} / {total} kommentaari",Lesson:"Õppetund","Unlocks {date}":"Avaneb {date}","{count} day after enrollment":"{count} päev pärast registreerumist","{count} days after enrollment":"{count} päeva pärast registreerumist","Releases {date}":"Avaldatakse {date}","Section deleted":"Jaotis kustutatud","Could not delete section":"Jaotise kustutamine ebaõnnestus","Lesson updated":"Õppetund uuendatud","Lesson added":"Õppetund lisatud","Could not save lesson":"Õppetunni salvestamine ebaõnnestus","Lesson deleted":"Õppetund kustutatud","Could not delete lesson":"Õppetunni kustutamine ebaõnnestus","Lesson duplicated as draft":"Õppetund dubleeritud mustandina","Could not duplicate lesson":"Õppetunni dubleerimine ebaõnnestus","Total time for this section":"Selle jaotise koguaeg","Edit section":"Muuda jaotist","Delete section":"Kustuta jaotis","Lessons will appear here once added.":"Õppetunnid ilmuvad siia, kui need on lisatud.","Not released yet":"Pole veel avaldatud","Complete the previous lesson first":"Lõpeta kõigepealt eelmine õppetund","Time to complete":"Läbimise aeg","Actions for {title}":"Toimingud: {title}","Edit lesson":"Muuda õppetundi","Duplicate lesson":"Dubleeri õppetund","Delete lesson":"Kustuta õppetund",Add:"Lisa","Add lesson":"Lisa õppetund","Delete section?":"Kas kustutada jaotis?",'This removes "{name}" and all lessons inside it.':"See eemaldab jaotise „{name}“ ja kõik selle õppetunnid.","Delete lesson?":"Kas kustutada õppetund?",'This removes "{title}" permanently.':"See eemaldab õppetunni „{title}“ jäädavalt.","Lesson title":"Õppetunni pealkiri",Minutes:"Minutit","Time to complete, in minutes":"Läbimise aeg minutites","How long this lesson takes, in minutes":"Kui kaua see õppetund kestab, minutites","Joined group":"Rühmaga liitutud","You're now in {group}. Enrolling you in the course…":"Oled nüüd rühmas {group}. Registreerin sind kursusele…","An admin will review your group request. After you're accepted you can enroll in the course.":"Administraator vaatab sinu rühmataotluse üle. Pärast vastuvõtmist saad kursusele registreeruda.","Could not join group":"Rühmaga liitumine ebaõnnestus","This course moved to {group}":"See kursus viidi rühma {group}","Join {group} first":"Liitu esmalt rühmaga {group}","This course is now part of “{group}”. Join its new group to continue accessing the course.":"See kursus kuulub nüüd rühma „{group}“. Kursusele juurdepääsu jätkamiseks liitu selle uue rühmaga.","This course belongs to “{group}”. Join the group before enrolling and starting the course.":"See kursus kuulub rühma „{group}“. Liitu rühmaga enne kursusele registreerumist ja selle alustamist.","Paid group access":"Tasuline rühmale juurdepääs","Membership required":"Liikmelisus on nõutav","Explore the available plans for {group}, choose the one that suits you, and return here after purchase to begin learning.":"Vaata rühma {group} saadaolevaid pakette, vali endale sobiv ja naase pärast ostmist siia õppima.","Your request to join this group is already pending. You'll be able to enroll after an admin accepts it.":"Sinu taotlus selle rühmaga liitumiseks on juba ootel. Saad registreeruda, kui administraator selle heaks kiidab.","This is a {type} group. Continue to join instantly.":"See on {type} rühm. Jätka, et kohe liituda.","This is a {type} group. Continue to send a request to the group admins.":"See on {type} rühm. Jätka, et saata taotlus rühma administraatoritele.","Explore group":"Tutvu rühmaga","Join group":"Liitu rühmaga","Request to join group":"Taotle rühmaga liitumist","You can watch this lecture now.":"Saad seda loengut nüüd vaadata.","Could not enroll":"Registreerumine ebaõnnestus","Want to view this lecture?":"Soovid seda loengut vaadata?","Your enrollment request is waiting for approval. You'll be able to watch this lecture after an admin accepts it.":"Sinu registreerumistaotlus ootab kinnitamist. Saad seda loengut vaadata, kui administraator selle heaks kiidab.","Enroll in {course} to watch this lecture and the rest of the course.":"Registreeru kursusele {course}, et vaadata seda loengut ja ülejäänud kursust.","Back to course":"Tagasi kursuse juurde","Enroll to view lecture":"Registreeru loengu vaatamiseks","Choose a membership plan that includes {course}.":"Vali liikmelisuse pakett, mis sisaldab kursust {course}.",Subscribed:"Tellitud","Payment successful":"Makse õnnestus","You can now request access to this course.":"Nüüd saad taotleda juurdepääsu sellele kursusele.","Checkout failed":"Makse ebaõnnestus","Buy group access":"Osta rühmale juurdepääs","No membership plans are linked to this group yet.":"Selle rühmaga pole veel ühtegi liikmelisuse paketti seotud.","Membership plan":"Liikmelisuse pakett","Subscribe free":"Telli tasuta","{day} at {time}":"{day} kell {time}","All courses":"Kõik kursused",Published:"Avaldatud",Drafts:"Mustandid","Default order":"Vaikejärjestus","Title A–Z":"Pealkiri A–Z","Shortest first":"Lühim enne","Longest first":"Pikim enne","Most lessons":"Enim õppetunde",Draft:"Mustand",Personal:"Isiklik","Community member":"Kogukonna liige","Your browser does not support video playback.":"Sinu brauser ei toeta videopleierit.","Audio resource":"Helimaterjal","Listen without leaving the Knowledge Hub":"Kuula Knowledge Hubist lahkumata","Your browser does not support audio playback.":"Sinu brauser ei toeta heli esitamist.","Attached files":"Lisatud failid",FILE:"FAIL",Hide:"Peida",View:"Vaata",Download:"Laadi alla","Resource media":"Materjali meedia",Audio:"Heli",Attachments:"Manused","About this resource":"Selle materjali kohta","Saving your resource…":"Salvestan sinu materjali…","Finishing the upload…":"Lõpetan üleslaadimist…","Uploading 1 file · {percent}%":"Laen üles 1 faili · {percent}%","Uploading {count} files · {percent}%":"Laen üles {count} faili · {percent}%","Remove {name}":"Eemalda {name}","Description cannot exceed {max} characters":"Kirjeldus ei tohi ületada {max} tähemärki","Your title":"Sinu pealkiri","Add a cover image before publishing":"Lisa enne avaldamist kaanepilt","Resource updated":"Materjal uuendatud","Resource shared":"Materjal jagatud","Your changes are now live.":"Sinu muudatused on nüüd avaldatud.","It is now available in the Knowledge Hub.":"See on nüüd Knowledge Hubis saadaval.","Upload cancelled":"Üleslaadimine tühistatud","Nothing was saved. Your files are still in the form.":"Midagi ei salvestatud. Sinu failid on vormis alles.","Could not update resource":"Materjali uuendamine ebaõnnestus","Could not share resource":"Materjali jagamine ebaõnnestus","Please try again.":"Proovi palun uuesti.","That file is not an image":"See fail ei ole pilt","Choose a PNG, JPG or WebP for the cover.":"Vali kaanepildiks PNG, JPG või WebP.","Couldn't use that cover":"Seda kaant ei saanud kasutada","Pick another one, or choose a picture of your own.":"Vali mõni muu või vali oma pilt.","Couldn't open the current cover":"Praegust kaant ei saanud avada","Choose the image again to crop it.":"Vali pilt uuesti, et seda kärpida.","Video too large":"Video on liiga suur","Videos can be up to {limit}.":"Videod võivad olla kuni {limit}.","That file is not audio":"See fail ei ole heli","Choose an MP3, M4A, WAV or other audio file.":"Vali MP3, M4A, WAV või mõni muu helifail.","Audio too large":"Heli on liiga suur","Audio files can be up to {size} MB.":"Helifailid võivad olla kuni {size} MB.","File too large":"Fail on liiga suur","{count} files too large":"{count} faili on liiga suured",'"{name}" was not added. Files can be up to {limit}.':"„{name}“ ei lisatud. Failid võivad olla kuni {limit}.","{names} were not added. Files can be up to {size} MB ({videoLimit} for a video).":"{names} ei lisatud. Failid võivad olla kuni {size} MB (video puhul {videoLimit}).","Up to 5 attachments":"Kuni 5 manust","Only the first {count} file was added.":"Lisati ainult esimene {count} fail.","Only the first {count} files were added.":"Lisati ainult esimesed {count} faili.","Remove one to add another.":"Eemalda üks, et lisada uus.","Edit resource":"Muuda materjali","Share a resource":"Jaga materjali","Update your resource. Saved changes will appear immediately.":"Uuenda oma materjali. Salvestatud muudatused ilmuvad kohe.","Add a cover and a description, then optionally a video, an audio file and files to download.":"Lisa kaanepilt ja kirjeldus ning soovi korral video, helifail ja allalaaditavad failid.",Details:"Üksikasjad","Cover image file":"Kaanepildi fail","Video file":"Videofail","Audio file":"Helifail","Attachment files":"Manustatud failid","Cover image":"Kaanepilt","The picture on this resource's card in the library. It is not a download. After you pick a picture you choose which part to show, in the card's 16:9 shape, so nothing is cut off in the library. A large photo is resized before it is sent, so it uploads faster; the original on your device is not changed.":"Pilt selle materjali kaardil teegis. See ei ole allalaaditav. Pärast pildi valimist valid, millist osa kuvada kaardi 16:9 vormis, et teegis midagi ära ei lõigataks. Suur foto muudetakse enne saatmist väiksemaks, et see laeks kiiremini üles; originaal sinu seadmes ei muutu.","Cover preview":"Kaanepildi eelvaade","Choose a cover image":"Vali kaanepilt","PNG, JPG or WebP · you choose the part to show next":"PNG, JPG või WebP · kuvatava osa valid järgmisena","Replace cover":"Asenda kaanepilt","Remove cover":"Eemalda kaanepilt","Without a cover, the card shows a plain one in the community's colour.":"Ilma kaanepildita näitab kaart lihtsat pilti kogukonna värvis.","Current cover":"Praegune kaanepilt","Adjust crop":"Kohanda kärpimist","No picture to hand? Use a ready-made cover":"Pole pilti käepärast? Kasuta valmis kaanepilti","Cover subjects":"Kaanepiltide teemad","All ({count})":"Kõik ({count})","Earlier covers":"Varasemad kaanepildid","Ready-made covers":"Valmis kaanepildid","Use the {name} cover":"Kasuta kaanepilti {name}","More covers":"Veel kaanepilte",Title:"Pealkiri","What will members learn?":"Mida liikmed õpivad?","Shorten the title to {max} characters or fewer.":"Lühenda pealkirja kuni {max} tähemärgini.","Share context, key takeaways, and why this is useful…":"Jaga konteksti, peamisi järeldusi ja seda, miks see kasulik on…","Formatting counts toward the limit. Shorten the description to {max} characters or fewer.":"Vormindus loetakse limiiti. Lühenda kirjeldust kuni {max} tähemärgini.","Media to play":"Esitatav meedia","(optional)":"(valikuline)","Members watch or listen to these inside the resource.":"Liikmed vaatavad või kuulavad neid materjali sees.","· one video, up to {limit}, or a link":"· üks video, kuni {limit}, või link","Current uploaded video":"Praegu üleslaaditud video","Already uploaded":"Juba üles laaditud","Upload video":"Laadi video üles","YouTube or Vimeo URL":"YouTube’i või Vimeo URL","Enter a valid YouTube or Vimeo link.":"Sisesta kehtiv YouTube’i või Vimeo link.","· one audio file":"· üks helifail","Current audio file":"Praegune helifail","Upload audio":"Laadi heli üles","Files to download":"Allalaaditavad failid","PDFs, Word, Excel or any other file members can download · {count}/5":"PDF-id, Word, Excel või mis tahes muud failid, mida liikmed saavad alla laadida · {count}/5","Add files":"Lisa faile","PDF preview":"PDF-i eelvaade","PDF attachment preview":"PDF-manuse eelvaade","This is how members will see your resource. Nothing is shared until you save.":"Nii näevad liikmed sinu materjali. Midagi ei jagata enne, kui salvestad.","This is how members will see your resource. Nothing is shared until you publish.":"Nii näevad liikmed sinu materjali. Midagi ei jagata enne, kui avaldad.","When opened":"Avamisel","In the library":"Teegis","{done}/{total} done":"{done}/{total} valmis","Upload progress":"Üleslaadimise edenemine","Keep this window open until it finishes.":"Hoia see aken lahti, kuni see lõpeb.","Cancel upload":"Tühista üleslaadimine","Save changes":"Salvesta muudatused","Publish resource":"Avalda materjal","Choose what shows on the cover":"Vali, mis kaanel kuvatakse","Knowledge Hub":"Knowledge Hub","You created this resource.":"Sina lõid selle materjali.","Moderator actions":"Moderaatori toimingud","This file can't be previewed. Use Download instead.":"Seda faili ei saa eelvaadata. Kasuta selle asemel allalaadimist.","Resource deleted":"Materjal kustutatud","Could not delete resource":"Materjali kustutamine ebaõnnestus","This resource is no longer available":"See materjal pole enam saadaval","Couldn't open that resource":"Seda materjali ei saanud avada","It may have been deleted. Here is the rest of the library.":"See võib olla kustutatud. Siin on ülejäänud teek.","Community library":"Kogukonna teek","Useful ideas, explainers and media shared by your community.":"Kogukonna jagatud kasulikud ideed, selgitused ja meedia.","Search title, description, or author…":"Otsi pealkirja, kirjelduse või autori järgi…","Search Knowledge Hub resources":"Otsi Knowledge Hubi materjale","All content types":"Kõik sisutüübid","Any date":"Mis tahes kuupäev","Past 7 days":"Viimased 7 päeva","Past 30 days":"Viimased 30 päeva","Past 90 days":"Viimased 90 päeva","Custom dates":"Kohandatud kuupäevad","Sort resources":"Sorteeri materjale","Newest first":"Uuemad enne","Most liked":"Enim meeldinud","Could not load the Knowledge Hub":"Knowledge Hubi laadimine ebaõnnestus","Please check your connection and try again.":"Kontrolli oma ühendust ja proovi uuesti.","Build your community library":"Ehita oma kogukonna teek","Share the first useful guide, talk, or audio resource with everyone.":"Jaga kõigiga esimest kasulikku juhendit, ettekannet või helimaterjali.","Share the first resource":"Jaga esimest materjali","No resources found":"Materjale ei leitud","Try another search term or change the filters.":"Proovi mõnda muud otsingusõna või muuda filtreid.","Showing {shown} of {total} resource":"Kuvatud {shown} materjal {total}-st","Showing {shown} of {total} resources":"Kuvatud {shown} materjali {total}-st","Delete this resource?":"Kas kustutada see materjal?","“{title}” will be permanently removed from the Knowledge Hub. This action cannot be undone.":"„{title}“ eemaldatakse Knowledge Hubist jäädavalt. Seda toimingut ei saa tagasi võtta.","Delete resource":"Kustuta materjal","Remove your like":"Eemalda meeldimine","Like this resource":"Märgi see materjal meeldivaks","You like this. Click to remove your like.":"See meeldib sulle. Meeldimise eemaldamiseks klõpsa.","Link copied":"Link kopeeritud","It opens this resource in the Knowledge Hub.":"See avab selle materjali Knowledge Hubis.","Couldn't copy link":"Linki ei saanud kopeerida","Post in review":"Postitus on ülevaatamisel","An admin will review it before it appears.":"Administraator vaatab selle enne ilmumist üle.",Shared:"Jagatud","Posted to {channel}":"Postitatud kanalisse {channel}","Couldn't share the resource":"Materjali ei saanud jagada","Copy link":"Kopeeri link","Post to a channel":"Postita kanalisse","Send in a message":"Saada sõnumis","Posts “{title}” with a link that opens it in the Knowledge Hub.":"Postitab „{title}“ lingiga, mis avab selle Knowledge Hubis.","Select channel":"Vali kanal","Add a message to introduce this to your community (optional). Type @ to mention someone.":"Lisa sõnum, et seda oma kogukonnale tutvustada (valikuline). Kirjuta @, et kedagi mainida.","Posting…":"Postitan…","Share it in a message. The link opens the resource in the Knowledge Hub.":"Jaga seda sõnumis. Link avab materjali Knowledge Hubis.","{count} file":"{count} fail","{count} files":"{count} faili","Open {title} in the Knowledge Hub":"Ava {title} Knowledge Hubis","Like this course":"Märgi see kursus meeldivaks","It opens this course's page.":"See avab selle kursuse lehe.","Posts “{title}” as a card members can like and open. Enrolling works as it does on the course page.":"Postitab „{title}“ kaardina, mida liikmed saavad meeldivaks märkida ja avada. Registreerumine toimib nagu kursuse lehel.","Couldn't share the course":"Kursust ei õnnestunud jagada","Share it in a message. The link opens the course's page.":"Jaga seda sõnumis. Link avab kursuse lehe.","Open the course {title}":"Ava kursus {title}","Paid plan":"Tasuline pakett","Unlock {feature}":"Ava {feature}","Your current plan doesn't include it. Choose a plan to start using it.":"Sinu praegune pakett seda ei sisalda. Vali pakett, et seda kasutama hakata.","Included in every paid plan, from {price}.":"Sisaldub igas tasulises paketis, alates {price}.","Included in every paid plan.":"Sisaldub igas tasulises paketis.","See plans":"Vaata pakette","Maybe later":"Võib-olla hiljem","Reach your members in their inbox with campaigns, newsletters, sequences, funnels and forms.":"Jõua oma liikmete postkasti kampaaniate, uudiskirjade, jadade, lehtrite ja vormidega.","Send campaigns and newsletters to your audience":"Saada kampaaniaid ja uudiskirju oma publikule","Automated sequences, funnels and sign-up forms":"Automaatsed jadad, lehtrid ja registreerumisvormid","Audience management and delivery analytics":"Publiku haldus ja kohaletoimetamise analüütika","Automate your community: act when members join, post or reach a milestone, without writing code.":"Automatiseeri oma kogukond: tegutse, kui liikmed liituvad, postitavad või jõuavad verstapostini, ilma koodi kirjutamata.","Automations triggered by joins, posts, streaks and more":"Automatiseerimised, mille käivitavad liitumised, postitused, seeriad ja muu","Multi-step actions: notify, tag, award points, send email":"Mitmeastmelised toimingud: teavita, sildista, anna punkte, saada e-kiri","Ready-made templates to start in minutes":"Valmis mallid, et alustada mõne minutiga","Member Analytics":"Liikmete analüütika","See how each member uses your community: time spent, sessions and the pages they visit.":"Vaata, kuidas iga liige sinu kogukonda kasutab: veedetud aeg, seansid ja külastatud lehed.","Time spent and sessions for every member":"Iga liikme veedetud aeg ja seansid","Page journeys: where members go and for how long":"Lehtede teekonnad: kuhu liikmed lähevad ja kui kauaks","Look up any member in Insights":"Otsi Insightsis üles ükskõik milline liige","Content category":"Sisu kategooria","Content categories":"Sisu kategooriad","All categories":"Kõik kategooriad","No category":"Kategooria puudub","Add “{name}”":"Lisa „{name}“","Filter by content category":"Filtreeri sisu kategooria järgi","Search categories":"Otsi kategooriaid","Search or type a new category":"Otsi või kirjuta uus kategooria","Loading…":"Laadimine…","Couldn't load categories. Try again.":"Kategooriaid ei õnnestunud laadida. Proovi uuesti.","No categories match.":"Ükski kategooria ei sobi.",Author:"Autor",Authors:"Autorid","All authors":"Kõik autorid","Search authors":"Otsi autoreid","Filter by author":"Filtreeri autori järgi","Couldn't load authors. Try again.":"Autoreid ei õnnestunud laadida. Proovi uuesti.","No authors match.":"Ükski autor ei sobi.","No resources have been shared yet.":"Ühtegi ressurssi pole veel jagatud.","No courses have been made yet.":"Ühtegi kursust pole veel loodud.","Shows only the resources one member has shared. The list has everyone who has shared a resource here, with how many each has shared; type a name to find someone. You can combine it with the other filters and the search box.":"Näitab ainult ühe liikme jagatud ressursse. Loendis on kõik, kes on siin ressurssi jaganud, koos arvuga; kirjuta nimi, et kedagi leida. Saab kombineerida teiste filtrite ja otsinguga.","No resource has a category yet.":"Ühelgi materjalil pole veel kategooriat.","Show more":"Näita rohkem","What kind of resource this is, such as a research paper or an opinion piece. Members can filter the Knowledge Hub by it. Pick one, or type your own and choose Add.":"Mis tüüpi materjal see on, näiteks teadustöö või arvamuslugu. Liikmed saavad Knowledge Hubi selle järgi filtreerida. Vali üks või kirjuta oma ja vali Lisa.",Filters:"Filtrid","{count} applied":"{count} valitud","Content type":"Sisu tüüp","Date shared":"Jagamise kuupäev","Remove filter {name}":"Eemalda filter {name}","Research Paper":"Teadustöö",Article:"Artikkel","Lecture/Talk":"Loeng/Ettekanne","Opinion Piece":"Arvamuslugu",General:"Üldine",Football:"Jalgpall",Education:"Haridus",Physiotherapy:"Füsioteraapia",Coaching:"Treenerlus","Sports Science":"Sporditeadus","Strength & Conditioning":"Jõu- ja vastupidavustreening",Recovery:"Taastumine",Nutrition:"Toitumine",Medicine:"Meditsiin",Health:"Tervis",Cars:"Autod",Entertainment:"Meelelahutus",Programming:"Programmeerimine",Technology:"Tehnoloogia",Business:"Ärimaailm",Science:"Teadus",Engineering:"Inseneeria",Sports:"Sport",Arts:"Kunst",Travel:"Reisimine",Food:"Toit",Resources:"Materjalid","Could not load this course.":"Seda kursust ei saanud laadida.","Back to course overview":"Tagasi kursuse ülevaatesse","Preview as learner":"Eelvaade õppija vaates","Close table of contents":"Sule sisukord","Join {group} to continue learning.":"Liitu rühmaga {group}, et õppimist jätkata.","the course's current group":"kursuse praeguse rühmaga","Enroll in this course to watch the lecture.":"Registreeru sellele kursusele, et loengut vaadata.","Next lesson":"Järgmine õppetund","Table of contents":"Sisukord","Add a section to start building content.":"Lisa jaotis, et sisu loomist alustada.","No lessons available yet.":"Õppetunde pole veel saadaval.","Lesson completed":"Õppetund lõpetatud","Marked incomplete":"Märgitud lõpetamata","Could not update progress":"Edenemist ei saanud uuendada","Mark incomplete":"Märgi lõpetamata","Mark complete":"Märgi lõpetatuks","You need to join this course before you can view its lessons.":"Õppetundide vaatamiseks pead sellele kursusele liituma.","Go to course overview":"Mine kursuse ülevaatesse","No lesson selected":"Õppetundi pole valitud","Pick a lesson from the table of contents.":"Vali õppetund sisukorrast.","Lesson {current} of {total}":"Õppetund {current}/{total}","This lesson has no written content yet.":"Selles õppetunnis pole veel kirjalikku sisu.",Block:"Plokk","In this lesson":"Selles õppetunnis","Lesson content":"Õppetunni sisu",Completed:"Lõpetatud","Completed {date}":"Lõpetatud {date}","Open PDF":"Ava PDF","Quick check":"Kiirkontroll",Assignment:"Ülesanne","Submit your work in the lesson discussion below.":"Esita oma töö allolevas õppetunni arutelus.",Quiz:"Test","Could not save quiz.":"Testi ei saanud salvestada.","Could not submit quiz":"Testi ei saanud esitada","Select all answers that apply.":"Vali kõik sobivad vastused.","This is an open-ended check — continue when you are ready.":"See on avatud kontroll – jätka, kui oled valmis.","Submit quiz":"Esita test","You {status} the quiz.":"Sa {status} testi.",passed:"sooritasid","didn't pass":"ei sooritanud","Great job!":"Hea töö!","Review the answers below, then try again.":"Vaata allolevad vastused üle ja proovi uuesti.","Retake quiz":"Tee test uuesti",Score:"Tulemus","Correct answers":"Õiged vastused",Correct:"Õige",Incorrect:"Vale",You:"Sina","Could not post your comment":"Kommentaari postitamine ebaõnnestus","Could not update the comment":"Kommentaari uuendamine ebaõnnestus","Could not delete the comment":"Kommentaari kustutamine ebaõnnestus",Discussion:"Arutelu","Loading comments…":"Laen kommentaare…","No comments yet — start the discussion.":"Kommentaare veel pole – alusta arutelu.","Add to the discussion…":"Lisa arutelule…","Redirecting now…":"Suunan ümber…","Redirecting in {count} second":"Suunamine {count} sekundi pärast","Redirecting in {count} seconds":"Suunamine {count} sekundi pärast","Lesson complete":"Õppetund lõpetatud","Up next":"Järgmisena",Stay:"Jää siia",Continue:"Jätka","Quiz result":"Testi tulemus","Question-by-question review of this learner's quiz attempt.":"Selle õppija testikatse ülevaade küsimuste kaupa.","Attempts: {count}":"Katseid: {count}",Submitted:"Esitatud","You received {points} karma point.":"Said {points} karmapunkti.","You received {points} karma points.":"Said {points} karmapunkti.","Congratulations!":"Palju õnne!","You've successfully completed {course}.":"Oled kursuse {course} edukalt läbinud.","Keep reviewing":"Jätka kordamist",Text:"Tekst","Send feedback":"Saada tagasisidet","You can attach up to {max} screenshots":"Saad lisada kuni {max} ekraanipilti","Only the first {count} screenshot was added":"Lisati ainult esimene {count} ekraanipilt","Only the first {count} screenshots were added":"Lisati ainult esimesed {count} ekraanipilti","Unsupported image type":"Toetamata pildi tüüp","Larger than 10 MB":"Suurem kui 10 MB","Upload failed":"Üleslaadimine ebaõnnestus","Add a short title.":"Lisa lühike pealkiri","Please add a bit more detail ({min}+ characters).":"Lisa palun veidi rohkem üksikasju (vähemalt {min} tähemärki)","Bug report sent":"Veateade saadetud","Idea sent":"Idee saadetud","Thanks! The SpatialChat Communities team will take a look.":"Aitäh! SpatialChat Communities meeskond vaatab selle üle.","Couldn't send your feedback":"Tagasisidet ei saanud saata","Report a problem or suggest an improvement to the SpatialChat Communities team.":"Teata SpatialChat Communities meeskonnale probleemist või tee parendusettepanek.","Feedback type":"Tagasiside tüüp","Report a bug":"Teata veast","Suggest an idea":"Soovita ideed","e.g. Verify code shows “Validation error!”":"nt kinnituskood näitab teadet „Validation error!“","e.g. Let me schedule posts":"nt Lase mul postitusi ajastada","What happened?":"Mis juhtus?","What would you like?":"Mida sa sooviksid?","What did you do, what did you expect, and what happened instead?":"Mida sa tegid, mida ootasid ja mis selle asemel juhtus?","What problem are you trying to solve? How would this help you?":"Millist probleemi sa lahendada püüad? Kuidas see sind aitaks?",Screenshots:"Ekraanipildid","(optional, up to {max})":"(valikuline, kuni {max})",Uploading:"Laen üles","Add screenshot":"Lisa ekraanipilt","or drop / paste (Ctrl/⌘+V) an image":"või lohista / kleebi (Ctrl/⌘+V) pilt","Screenshots that failed to upload won't be sent. Remove them or try again.":"Ekraanipilte, mille üleslaadimine ebaõnnestus, ei saadeta. Eemalda need või proovi uuesti.","Include technical details":"Lisa tehnilised üksikasjad","(recommended)":"(soovitatav)","Page, browser, and no recent errors. Passwords, tokens and emails are removed.":"Leht, brauser ja värskeid vigu pole. Paroolid, tokenid ja e-posti aadressid eemaldatakse.","Page, browser, and {count} recent error. Passwords, tokens and emails are removed.":"Leht, brauser ja {count} värske viga. Paroolid, tokenid ja e-posti aadressid eemaldatakse.","Page, browser, and {count} recent errors. Passwords, tokens and emails are removed.":"Leht, brauser ja {count} värsket viga. Paroolid, tokenid ja e-posti aadressid eemaldatakse.","Page: {path}":"Leht: {path}","Browser: {browser}":"Brauser: {browser}","Screen: {width}x{height} · Build: {version}":"Ekraan: {width}x{height} · Versioon: {version}","No errors captured in this session.":"Selles seansis ei registreeritud ühtegi viga.","The SpatialChat Communities team may contact me about this":"SpatialChat Communities meeskond võib selle kohta minuga ühendust võtta","Uploading…":"Laen üles…","Send report":"Saada aruanne","Send idea":"Saada idee","{points} earned":"Teenitud: {points}","{points} to spend":"Kulutamiseks: {points}","Profile picture updated":"Profiilipilt uuendatud","Couldn't update picture":"Pilti ei saanud uuendada","Cover photo updated":"Kaanefoto uuendatud","Couldn't update cover":"Kaant ei saanud uuendada","Link copied!":"Link kopeeritud!","Profile link copied to clipboard.":"Profiili link kopeeriti lõikelauale.",Cover:"Kaas","Joined {date}":"Liitus {date}","Badges & achievements":"Märgid ja saavutused","No badges earned yet — stay active to unlock your first one.":"Märke pole veel teenitud – ole aktiivne, et avada esimene.",Badge:"Märk","You haven't posted yet.":"Sa pole veel postitanud.","No activity yet.":"Tegevust veel pole.","Adjust cover photo":"Kohanda kaanefotot","Add a bio and interests from":"Lisa kirjeldus ja huvid siit:","to fill out your About section.":"et täita oma jaotis Teave.",Bio:"Kirjeldus",Interests:"Huvid","No achievement badges are configured for this community yet.":"Selles kogukonnas pole veel saavutusmärke seadistatud.","Earned {date}":"Teenitud {date}","Profile updated":"Profiil uuendatud","Your changes have been saved.":"Sinu muudatused on salvestatud.","Couldn't save profile":"Profiili ei saanud salvestada",Username:"Kasutajanimi","Checking availability…":"Kontrollin saadavust…","Username is available":"Kasutajanimi on vaba","Username is taken":"Kasutajanimi on hõivatud","3–64 chars: letters, numbers, _ or .":"3–64 märki: tähed, numbrid, _ või .",Headline:"Pealkiri",Location:"Asukoht","Social links":"Sotsiaalmeedia lingid","Saving…":"Salvestan…","Couldn't update preference":"Eelistust ei saanud uuendada","Email notifications":"E-posti teavitused","Choose which activity on your content sends you an email.":"Vali, millised tegevused sinu sisuga saadavad sulle e-kirja.","Posts created":"Loodud postitused","Comments made":"Tehtud kommentaarid","Replies made":"Tehtud vastused","Likes given":"Antud meeldimised","Likes on your posts":"Meeldimised sinu postitustele","Your posts commented":"Sinu postituste kommentaarid","Your replies received":"Saadud vastused","Followers gained":"Saadud jälgijad","Live sessions":"Otseülekanded","Admin-assigned":"Administraatori määratud",Other:"Muu","How you earned your {points}":"Kuidas sa oma {points} teenisid","No points yet — post, comment and react to start earning.":"Punkte veel pole – postita, kommenteeri ja reageeri, et teenima hakata.","Language updated":"Keel uuendatud","Using the community's language":"Kasutan kogukonna keelt","Only you see this change.":"Seda muudatust näed ainult sina.","Couldn't change your language":"Keelt ei saanud muuta",Language:"Keel","Menus, buttons and labels are shown in the language you pick here, for you only. Posts, comments and messages stay in the language they were written in. Other members keep the community's language unless they pick their own.":"Menüüd, nupud ja sildid kuvatakse siin valitud keeles, ainult sulle. Postitused, kommentaarid ja sõnumid jäävad keelde, milles need kirjutati. Teised liikmed näevad kogukonna keelt, kui nad ise teist ei vali.","Choose the language you read this community in.":"Vali keel, milles seda kogukonda loed.","My language":"Minu keel","Community default":"Kogukonna vaikimisi keel","Console error":"Konsooli viga","Console warning":"Konsooli hoiatus",Crash:"Krahh","Unhandled error":"Käsitlemata viga","Failed request":"Ebaõnnestunud päring",About:"Teave",Achievements:"Saavutused",Website:"Veebisait",Silver:"Hõbe",Gold:"Kuld",Platinum:"Plaatina",Diamond:"Teemant",Elite:"Eliit","Comments on my posts":"Kommentaarid minu postitustele","When someone comments on your post":"Kui keegi kommenteerib sinu postitust","Replies to my comments":"Vastused minu kommentaaridele","When someone replies to your comment":"Kui keegi vastab sinu kommentaarile","Likes on my posts":"Meeldimised minu postitustele","When someone likes your post":"Kui kellelegi meeldib sinu postitus","Reactions to my comments":"Reaktsioonid minu kommentaaridele","When someone reacts to your comment":"Kui keegi reageerib sinu kommentaarile","Reactions to my replies":"Reaktsioonid minu vastustele","When someone reacts to your reply":"Kui keegi reageerib sinu vastusele","Direct messages":"Otsesõnumid","When you receive a direct message":"Kui saad otsesõnumi",Mentions:"Mainimised","When someone @mentions you":"Kui keegi @mainib sind","Load more {label}":"Laadi veel {label}","Loading more {label}…":"Laen veel {label}…",courses:"kursusi",resources:"materjale",items:"kirjeid","About {label}":"Teave: {label}","Couldn't like this course":"Kursusele ei saanud meeldimist lisada","Couldn't like this resource":"Ressursile ei saanud meeldimist lisada","Couldn't remove your like":"Meeldimist ei saanud eemaldada","Notify members":"Teavita liikmeid","Sends everyone in the community a notification about this resource, in the app and as a push notification on their phone or browser. Members who turned off notifications for this community don't get it.":"Saadab kõigile kogukonnas teavituse selle ressursi kohta – rakenduses ja tõuketeavitusena telefonis või brauseris. Liikmed, kes on selle kogukonna teavitused välja lülitanud, seda ei saa.","It is now available in the Knowledge Hub, and members are being notified.":"See on nüüd Knowledge Hubis saadaval ja liikmeid teavitatakse.","How posts are ordered":"Kuidas postitused järjestatakse","Recent: newest first. Top posts: the most likes, of all time; comments don't change the order. Trending: the most likes and comments together, within the period you pick. Following: posts by people you follow.":"Uusimad: uusimad eespool. Top postitused: kõige rohkem meeldimisi kogu aja jooksul; kommentaarid järjekorda ei muuda. Trendid: kõige rohkem meeldimisi ja kommentaare kokku valitud perioodi jooksul. Jälgitavad: inimeste postitused, keda jälgid.","Save this resource":"Salvesta see ressurss","Save this course":"Salvesta see kursus","Remove from saved":"Eemalda salvestatutest","Saved. Click to remove it from your saved list.":"Salvestatud. Klõpsa, et see oma salvestatute loendist eemaldada.","Find it any time under Saved in the Knowledge Hub.":"Leiad selle igal ajal teadmiskeskuse jaotisest Salvestatud.","Find it any time under Saved on the Courses page.":"Leiad selle igal ajal kursuste lehe jaotisest Salvestatud.","Couldn't save this resource":"Ressurssi ei õnnestunud salvestada","Couldn't save this course":"Kursust ei õnnestunud salvestada","Couldn't remove it from saved":"Salvestatutest eemaldamine ebaõnnestus","All resources":"Kõik ressursid",Show:"Näita","Press the bookmark on anything to save it here for later. Only you can see what you saved.":"Vajuta millegi juures järjehoidjat, et see siia hilisemaks salvestada. Ainult sina näed, mida oled salvestanud.","Date range":"Kuupäevavahemik",Today:"Täna","Last 7 days":"Viimased 7 päeva","Last 4 weeks":"Viimased 4 nädalat","Last 6 months":"Viimased 6 kuud","Last 12 months":"Viimased 12 kuud","Month to date":"Kuu algusest","Quarter to date":"Kvartali algusest","Year to date":"Aasta algusest","All time":"Kogu aeg",Start:"Algus",End:"Lõpp",Clear:"Tühjenda",Apply:"Rakenda","Couldn't download this file":"Faili allalaadimine ebaõnnestus","A new category is saved with capital letters, so “fancy dress” becomes “Fancy Dress”, and one that already exists is reused rather than added twice.":"Uus kategooria salvestatakse suurte algustähtedega, nii et „fancy dress“ muutub „Fancy Dress“-iks, ja juba olemasolevat kategooriat kasutatakse uuesti, mitte ei lisata teist korda.","Job title":"Ametinimetus","Your role, such as Head of Sports Science or Team Physiotherapist. It shows under your name in the member directory and on your profile, so members know who to contact.":"Sinu roll, näiteks sporditeaduse juht või meeskonna füsioterapeut. See kuvatakse liikmete kataloogis ja sinu profiilil sinu nime all, et liikmed teaksid, kelle poole pöörduda.","e.g. Head of Sports Science":"nt sporditeaduse juht","Type where you are based, or use your current location: your browser asks first, and only the town and country are filled in. Your exact position is never saved. Check it, then save your profile.":"Kirjuta, kus sa asud, või kasuta oma praegust asukohta: brauser küsib enne luba ja täidetakse ainult linn ja riik. Sinu täpset asukohta ei salvestata kunagi. Kontrolli seda ja salvesta siis oma profiil.","e.g. Stockholm, Sweden":"nt Stockholm, Rootsi","Finding you…":"Otsin sind…","Use my location":"Kasuta minu asukohta","Please enter your location, or use your current location.":"Sisesta oma asukoht või kasuta praegust asukohta.","Fields marked * are required.":"Tärniga * märgitud väljad on kohustuslikud.","Your details in {community}":"Sinu andmed kogukonnas {community}","Your community details":"Sinu andmed kogukonnas","Community details":"Kogukonna andmed","Questions this community's admins ask every member. Your answers show in its member directory, except ones marked “Only admins see this”.":"Küsimused, mida selle kogukonna administraatorid kõigilt liikmetelt küsivad. Sinu vastused on näha liikmete kataloogis, välja arvatud need, mis on märgitud „Näevad ainult administraatorid“.","Couldn't save your profile":"Profiili ei õnnestunud salvestada","Check the highlighted detail, then save again.":"Kontrolli esiletõstetud andmeid ja salvesta uuesti.","Location filled in":"Asukoht täidetud","Check it, then save your profile.":"Kontrolli seda ja salvesta siis oma profiil.","Couldn't use your location":"Sinu asukohta ei saanud kasutada","Please type your location.":"Palun kirjuta oma asukoht.","Your browser can't share your location here. Please type it.":"Sinu brauser ei saa siin asukohta jagada. Palun kirjuta see.","Location access is blocked. Allow it for this site in your browser settings, or type your location.":"Asukoha juurdepääs on blokeeritud. Luba see selle saidi jaoks brauseri seadetes või kirjuta oma asukoht.","Finding your location took too long. Please try again, or type your location.":"Asukoha leidmine võttis liiga kaua. Proovi uuesti või kirjuta oma asukoht.","Your location isn't available right now. Please type it.":"Sinu asukoht pole praegu saadaval. Palun kirjuta see.","Location lookup isn't available right now. Please type your location.":"Asukoha otsing pole praegu saadaval. Palun kirjuta oma asukoht."},Mnn={"SpatialChat Communities Keyword":"French",Home:"Maison","Explore Groups":"Explorer les groupes",Events:"Événements",Groups:"Groupes",Links:"Links","Direct Message":"Message direct","Powered by":"Alimenté par","No groups here, please use + to create a new one, or join one see them here.":"Pas de groupes ici, veuillez utiliser + pour en créer un nouveau, ou en rejoindre un, voyez-les ici.","Please join a group to see them here":"Veuillez rejoindre un groupe pour les voir ici","Section can only be reordered within the group!":"La section ne peut être réorganisée qu'au sein du groupe !","Group Page":"Page de groupe","Invite Members":"Inviter des membres",Join:"Rejoindre",Joined:"Rejoint","Create new section":"Créer une nouvelle rubrique","Group Setting drop down":"Liste déroulante des paramètres de groupe",Share:"Partager","Edit group":"Modifier le groupe","Delete group":"Supprimer le groupe",Leave:"Partir","Are you sure you want to delete the group?":"Êtes-vous sûr de vouloir supprimer le groupe ?",Cancel:"Annuler","Yes, Go Ahead":"Oui, allez-y","Share via link":"Partager via un lien",Copy:"Copie",Copied:"Copié","Share on social media":"Partager sur les réseaux sociaux","Add Section":"Ajouter une section","Section Header":"En-tête de section",Live:"En direct","Create post":"Créer un message","Notificaiton Bell":"Cloche de notification","All posts":"Tous les messages","Admin posts only":"Messages d'administrateur uniquement",None:"Aucun","Section Setting drop down":"Section Paramètres déroulants","Edit Section":"Modifier la section","Embed Section":"Section Intégrer","Delete Section":"Supprimer la section","Are you sure you want to delete the section?":"Êtes-vous sûr de vouloir supprimer la section ?","Section deleted!":"Rubrique supprimée !","Create Group Pop up / Update":"Créer un groupe Pop-up / Mettre à jour","Create group":"Créer un groupe","Basic Detail":"Détail de base",Settings:"Paramètres","Size 16:9 or 1600 by 900":"Taille 16:9 ou 1600 par 900","Group name":"Nom du groupe","Enter group name":"Entrez le nom du groupe","Suggestions: Spaces, Channels, Groups, Blog, Knowledgebase, etc":"Suggestions : espaces, chaînes, groupes, blog, base de connaissances, etc.","Group Description":"Description du groupe","Enter description here":"Entrez la description ici","Group Type":"Type de groupe",Open:"Ouvrir","Visible to all & anyone can join":"Visible par tous et tout le monde peut adhérer",Closed:"Fermé","User will have to request to join the group":"L'utilisateur devra demander à rejoindre le groupe",Paid:"Payé","Group Price":"Tarif groupe","Currency (Default: INR)":"Devise (par défaut : INR)","User will have to pay to join the group":"L'utilisateur devra payer pour rejoindre le groupe","Make this a private group":"En faire un groupe privé","Private group will only be visible to members who are part of it. Admin can add members manually from member list":"Le groupe privé ne sera visible que par les membres qui en font partie. L'administrateur peut ajouter des membres manuellement à partir de la liste des membres","Upload from device":"Télécharger depuis l'appareil","Search image":"Rechercher une image","Valid group name required!":"Nom de groupe valide requis !","Update Group":"Mettre à jour le groupe","SEO Settings":"Paramètres de référencement","Custom URL":"URL personnalisée","Meta Title":"Méta-titre","Maximum length of 255 characters allowed":"Longueur maximale de 255 caractères autorisée","Meta Description":"Méta-description","Open Graph Detail":"Ouvrir les détails du graphique","Open Graph Title":"Titre du graphique ouvert","Open Graph Description":"Description du graphique ouvert","Open Graph Image":"Ouvrir l'image du graphique","Recommended dimensions: 1200px by 630px with a 1.91:1 aspect ratio.":"Dimensions recommandées : 1 200 px sur 630 px avec un rapport hauteur/largeur de 1,91 : 1.","If no URL is used, it will automatically picked your group thumbnail.":"Si aucune URL n’est utilisée, la vignette de votre groupe sera automatiquement sélectionnée.","Create Section Pop up / Update":"Créer une section contextuelle / Mettre à jour","Create Section":"Créer une section","Section Name":"Nom de la section","Suggestions: General, Introductions, Community Guidelines":"Suggestions : Général, Introductions, Lignes directrices de la communauté","Section Type":"Type de section","Post Type":"Type de message","Group Chat":"Discussion de groupe","Who can post in this section?":"Qui peut poster dans cette section ?","Only Admin":"Uniquement administrateur","Any user":"Tout utilisateur","Sorting order for section":"Ordre de tri pour la section","Latest first":"Dernier premier","Oldest post first":"Message le plus ancien en premier","Section Appearance":"Apparence des sections","List View":"Vue en liste","Grid View":"Vue Grille","Make this closed section":"Faire cette section fermée","Members will have to request access to see section content":"Les membres devront demander l'accès pour voir le contenu de la section","Make this a private section":"Faites-en une section privée","Disables requests (Make sure closed section is selected as well).":"Désactive les demandes (assurez-vous que la section fermée est également sélectionnée).","Post Editor":"Éditeur de messages","Create new post in":"Créer un nouveau message dans","Add Cover Picture":"Ajouter une photo de couverture","Heading (Optional)":"Titre (facultatif)","Write here..":"Écrivez ici..",Picture:"Image",Video:"Vidéo",Attachment:"Pièce jointe",Poll:"Sondage","Embed Code":"Code intégré",Tags:"Balises","Toggle to question":"Passer à la question","Poll expire time":"Heure d'expiration du sondage","Poll question":"Question de sondage","Enter Question":"Saisir une question",Question:"Question",Option:"Option",Options:"Possibilités","Add Option":"Ajouter une option","Poll Expiry time":"Heure d'expiration du sondage","12 Hours":"12 heures","1 Day":"1 jour","2 Days":"2 jours","1 Week":"1 semaine","2 Weeks":"2 semaines","Always Open":"Toujours ouvert","Write embeddable code":"Écrire du code intégrable","Click here to add embed code.":"Cliquez ici pour ajouter le code d'intégration.","Paste your embed code here!":"Collez votre code d'intégration ici !","Post Settings":"Paramètres de publication","Update Post":"Mettre à jour le message",Update:"Mise à jour","Start meeting / Video call / Live":"Démarrer la réunion / Appel vidéo / En direct","Meeting Name":"Nom de la réunion","Suggestion: Group discussion etc":"Suggestion : discussion de groupe, etc.",Description:"Description","Enter description here (optional)":"Entrez la description ici (facultatif)","When do you want to start the session":"Quand voulez-vous commencer la session","Right now":"Tout de suite","Schedule for later":"Programmer pour plus tard","Group video call":"Appel vidéo de groupe",Webinar:"Webinaire","Go Live":"Passez en direct","Go live":"Passez en direct","Info on the Post":"Infos sur la poste","Post comment":"Publier un commentaire",Comment:"Commentaire",Comments:"Commentaires",Reply:"Répondre",Replies:"Réponses","Share via URL":"Partager via une URL","Reshare in other sections":"Partager dans d'autres sections","Post Card Drop Down":"Carte postale déroulante",Bookmark:"Marque-page","Pin post":"Épingler le message",Edit:"Modifier","Embed Post":"Intégrer la publication",Delete:"Supprimer","Remove Pin":"Supprimer l'épingle","Remove Bookmark":"Supprimer le signet","Just copy paste this code wherever you want it to be embedded":"Copiez et collez simplement ce code là où vous souhaitez qu'il soit intégré",Height:"Hauteur",Preview:"Aperçu","Copied to clipboard":"Copié dans le presse-papiers","Select Widgets":"Sélectionnez les widgets","Add widgets to":"Ajouter des widgets à","You can change their order by dragging & dropping the widgets over each other":"Vous pouvez modifier leur ordre en glissant-déposant les widgets les uns sur les autres","Please note: Widget wont be displayed if there is no data available,":"Attention : le widget ne s'affichera pas si aucune donnée n'est disponible,","Group Members":"Membres du groupe","Group Leaderboard":"Classement du groupe","Community Leaderboard":"Classement de la communauté","Trending Posts":"Articles tendance","Group Events":"Événements de groupe","Add Custom":"Ajouter une personnalisation","Save Widgets":"Enregistrer les widgets","Visible to user":"Visible par l'utilisateur","Visible to admin":"Visible par l'administrateur","Add widget to":"Ajouter un widget à","Upload cover picture":"Télécharger la photo de couverture","1:1 aspect ration (recommended)":"Rapport d'aspect 1:1 (recommandé)","Card Title":"Titre de la carte","Enter widget name":"Entrez le nom du widget","Small Description (try to keep it under 50 words)":"Petite description (essayez de la limiter à moins de 50 mots)","Enter description":"Entrez la description","Button Title":"Titre du bouton","Enter button name":"Entrez le nom du bouton","Siggestion: Know more, Join, Apply, etc":"Siggestion : en savoir plus, rejoindre, postuler, etc.","URL link":"Lien URL","Create custom widget":"Créer un widget personnalisé","Custom widget created successfully":"Widget personnalisé créé avec succès",Widgets:"Widgets",Members:"Membres","See All":"Tout voir","Communtiy Top Contributors":"Meilleurs contributeurs de la communauté","Community members":"Membres de la communauté","Group Top Contributors":"Meilleurs contributeurs du groupe","Upcoming Events":"Événements à venir","Home Page Banner":"Bannière de la page d'accueil","Edit Banner":"Modifier la bannière","Home page Edit Banner Pop up":"Page d'accueil Modifier la bannière Pop up","Update Banner":"Mettre à jour la bannière",Search:"Recherche","Upload Image":"Télécharger une image",Remove:"Retirer","Banner image (please use 16:6 ratio or 1600px by 600px image for the best view)":"Image de bannière (veuillez utiliser un format 16:6 ou une image de 1 600 x 600 px pour une meilleure vue)","Banner Title":"Titre de la bannière","Enter here":"Entrez ici","Suggestion: Welcome to my community etc":"Suggestion : Bienvenue dans ma communauté, etc.","Banner Description":"Description de la bannière","Enter banner description":"Entrez la description de la bannière","Save Banner Info":"Enregistrer les informations sur la bannière","Home Page Feed":"Flux de la page d'accueil",Recent:"Récent","Top posts":"Meilleurs articles",Trending:"Tendance","Home Feed Groups":"Groupes de flux d’accueil","":"#VALUE!","My profile":"Mon profil",Logout:"Déconnexion",Notification:"Notification",Notifications:"Notifications","Mark all viewed":"Marquer tous les articles consultés","has created a post":"a créé un message","wants to join":"veut rejoindre","has commented on your post":"a commenté votre message","has replied to your comment":"a répondu à votre commentaire","Search for tags":"Rechercher des balises","All groups":"Tous les groupes","Search result":"Résultat de la recherche","No post found for selected hashtag":"Aucune publication trouvée pour le hashtag sélectionné","Start a conversation":"Démarrer une conversation","Search by name":"Rechercher par nom",Upcoming:"Prochain",UPCOMING:"PROCHAIN",Past:"Passé",PAST:"PASSÉ","No upcoming events":"Aucun événement à venir","Create event popup":"Créer une fenêtre contextuelle d'événement","Event details":"Détails de l'événement","16:9 aspect ratio":"Format d'image 16:9","Event name":"Nom de l'événement","Enter event name":"Entrez le nom de l'événement","Host Name":"Nom d'hôte","You will be made host if none selected":"Vous serez nommé hôte si aucun n'est sélectionné","Write here...":"Écrivez ici...","No. of registration for the event":"N° d'inscription à l'événement",Unlimited:"Illimité","When & where":"Quand et où",From:"Depuis","Start date":"Date de début",time:"temps",To:"À","End date":"Date de fin","Current time zone:":"Fuseau horaire actuel :","Can be updated from the communtiy setting":"Peut être mis à jour à partir des paramètres de la communauté","Online event":"Événement en ligne","Add meeting link":"Ajouter un lien de réunion","Meeting link will be generated once event is created":"Le lien de la réunion sera généré une fois l'événement créé",Venue:"Lieu","Enter address":"Entrez l'adresse",Create:"Créer",Invite:"Inviter","Share event via link":"Partager l'événement via un lien",Copy__1:"Copie","Select section to post this event":"Sélectionnez la section pour publier cet événement","Once posted, members of that group or section will recieve an notification":"Une fois publiés, les membres de ce groupe ou de cette section recevront une notification",Post:"Poste",RSVP:"RSVP","Book Event":"Événement de livre","Yes, I'll attend":"Oui, j'y participerai","May be":"Peut être","No, I won't attend":"Non, je n'y participerai pas","Date & Time":"Date et heure",Host:"Hôte","Online meeting":"Réunion en ligne","Meeting link will be visible once registered for the event":"Le lien de la réunion sera visible une fois inscrit à l'événement","User Management":"Gestion des utilisateurs","Go bac to community":"Retourner à la communauté","Manage Members":"Gérer les membres",Member:"Membre",Invited:"Invité","Search for member":"Rechercher un membre","Add to group":"Ajouter au groupe","Send Direct Message":"Envoyer un message direct","Change role":"Changer de rôle","Kick from community":"Coup de pied de la communauté","Super Admin":"Super administrateur","Super admin will have full access to the communtiy settings":"Le super administrateur aura un accès complet aux paramètres de la communauté","Group Admin":"Administrateur de groupe","Admin of the selected group can edit the group information and create, edt or delete section under selected group":"L'administrateur du groupe sélectionné peut modifier les informations du groupe et créer, modifier ou supprimer une section sous le groupe sélectionné.","Group Moderator":"Modérateur de groupe","Group moderator can create or delete post, comment, reply & messages in the selected group.":"Le modérateur du groupe peut créer ou supprimer des publications, des commentaires, des réponses et des messages dans le groupe sélectionné.",User:"Utilisateur",Save:"Sauvegarder","User role updated successfully":"Le rôle de l'utilisateur a été mis à jour avec succès",Leaderboard:"Classement","Click on the column header for sorting":"Cliquez sur l'en-tête de la colonne pour trier",Rank:"Rang","Karma Points":"Points de karma","Custom Points":"Points personnalisés",Follow:"Suivre",Upvotes:"Votes positifs",Posts:"Messages","Add custom points":"Ajouter des points personnalisés","Subtract custom points":"Soustraire des points personnalisés","Enter no. of points":"Entrez le numéro. de points","Add points":"Ajouter des points","Invite members to":"Invitez les membres à","Invite via link":"Inviter via un lien","Invite via email":"Inviter par e-mail","Add more":"Ajouter plus","Upload a CSV":"Téléchargez un CSV","Please upload a comma-seprated CSV file, with header as name, email.":"Veuillez télécharger un fichier CSV séparé par des virgules, avec en-tête comme nom et adresse e-mail.","Here is a template CSV file":"Voici un modèle de fichier CSV","Upload File":"Télécharger le fichier","Send Invite":"Envoyer une invitation","Mail Template":"Modèle de courrier","Send Test Mail":"Envoyer un courrier test",Hey:"Hé","A has invite you to join the B":"A vous a invité à rejoindre le B","Switch to rich text editor":"Passer à l'éditeur de texte enrichi","Add Custom Message":"Ajouter un message personnalisé","Enter message here":"Entrez le message ici","Send Bulk Mail":"Envoyer du courrier en masse","Send Mail":"Envoyer un courrier","Send bulk mail to all community members or select group members":"Envoyez du courrier en masse à tous les membres de la communauté ou à certains membres du groupe",Date:"Date",Subject:"Sujet",Recipients:"Destinataires","1000 bulk emails remaining for this month. Resets on <date>":"Il reste 1 000 e-mails en masse pour ce mois-ci. Réinitialisé le <date>",Everyone:"Tout le monde","Enter mail subject":"Entrez le sujet du courrier","Write message":"Écrire un message",Cancel__1:"Annuler",Send:"Envoyer",__1:"#VALUE!",Activity:"Activité",Bookmarks:"Signets","Edit profile":"Modifier le profil",Unsubscribe:"Se désabonner","Settings (Account)":"Paramètres (compte)",Profile:"Profil","Set Profile Picture":"Définir la photo de profil","Your name":"Votre nom","User ID":"ID de l'utilisateur","Short bio":"Courte biographie","Link your social account":"Liez votre compte social","This will be displayed on your profile":"Ceci sera affiché sur votre profil","Add social handle":"Ajouter un identifiant social",Verification:"Vérification","Account Verification":"Vérification du compte",Email:"E-mail","Enter email":"Entrez l'e-mail",Verified:"Vérifié",Unverified:"Non vérifié",Change:"Changement",Unlink:"Dissocier",Mobile:"Mobile","enter mobile no.":"entrez le numéro de portable.","Request OTP":"Demander un OTP","Manage your personal account notification preferences":"Gérer les préférences de notification de votre compte personnel",Prefrences:"Préférences","Email notification":"Notification par courrier électronique","Notify me about comments on my posts":"M'avertir des commentaires sur mes publications","Notify me about replies on my comments":"M'avertir des réponses à mes commentaires","Notify me about likes on my posts":"M'avertir des J'aime sur mes publications","Notify me about reaction on my comments":"Informez-moi des réactions à mes commentaires","Notify me about reaction on my reply":"Informez-moi de la réaction à ma réponse","Notify me about direct message":"M'avertir des messages directs","Notify me about my mentions":"M'avertir de mes mentions","Notification for new posts":"Notification pour les nouveaux messages","Only group & section available which you are part of":"Seuls les groupes et sections disponibles dont vous faites partie","Group & Section":"Groupe et section","All activity":"Toute l'activité","Post by admin":"Posté par l'administrateur","No Notification":"Aucune notification","Setting (Community)":"Cadre (communauté)","General Settings":"Paramètres généraux","Upload community logo":"Télécharger le logo de la communauté","Community name":"Nom de la communauté","Invalid field":"Champ invalide","Your community address":"L'adresse de votre communauté","Fav icon":"Icône Favoris","This will be visible on the browser tab (32px by 32px)":"Ceci sera visible sur l'onglet du navigateur (32px par 32px)",TimeZone:"Fuseau horaire","Privacy Policy on login page":"Politique de confidentialité sur la page de connexion","Terms & Condition on login page":"Conditions générales sur la page de connexion","Enter link here":"Entrez le lien ici","Open Group Image":"Image de groupe ouvert","By default ir takes up the community banner uploaded with the communtiy":"Par défaut, il reprend la bannière de la communauté téléchargée avec la communauté.","Community Experience":"Expérience communautaire",Onboarding:"Intégration","Member Fields":"Champs des membres","Make your community private":"Rendre votre communauté privée","Users will have to login or sign up to access the community":"Les utilisateurs devront se connecter ou s'inscrire pour accéder à la communauté","Make account verification mandatory for both email & mobile":"Rendre la vérification du compte obligatoire pour les e-mails et les mobiles","New user will have to verify both email & mobile no. to access the community":"Le nouvel utilisateur devra vérifier à la fois son e-mail et son numéro de mobile. pour accéder à la communauté","Admin will also have to verify their mobile no. & email or else they won't be able to access the community":"L'administrateur devra également vérifier son numéro de mobile. & email, sinon ils ne pourront pas accéder à la communauté","Gated community access":"Accès communautaire fermé","Admin will have to approve or reject user's requests to join the community":"L'administrateur devra approuver ou rejeter les demandes des utilisateurs pour rejoindre la communauté","Disable mobile login/register":"Désactiver la connexion/inscription mobile","Disable email login/register":"Désactiver la connexion/inscription par e-mail","Disable google login/register":"Désactiver la connexion/inscription Google","Disable facebook login/register":"Désactiver la connexion/l'enregistrement sur Facebook","Show & Hide features":"Afficher et masquer les fonctionnalités","Hide direct chat":"Masquer le chat direct","User will not be able to send direct messages to each other":"L'utilisateur ne pourra pas s'envoyer de messages directs","Hide profile picture from top right corner for mobile responsive view":"Masquer la photo de profil dans le coin supérieur droit pour une vue adaptée aux mobiles","Useful when using community in an in app browser":"Utile lors de l'utilisation de la communauté dans un navigateur intégré à l'application","Hide profile picture from top right corner in every view":"Masquer la photo de profil dans le coin supérieur droit dans chaque vue","Disable header dropdown on profile picture":"Désactiver le menu déroulant d'en-tête sur la photo de profil","Useful for integrated community, especially using SSO":"Utile pour une communauté intégrée, notamment en utilisant SSO","Hide the communtiy logo from the header":"Masquer le logo de la communauté dans l'en-tête","Hide the communtiy title from the header":"Masquer le titre de la communauté dans l'en-tête","Show collpased group in the side nav bar":"Afficher le groupe réduit dans la barre de navigation latérale","Show full expanded post in the home feed":"Afficher la publication entièrement développée dans le flux d'accueil","Hide the leaderboard score from the header":"Masquer le score du classement de l'en-tête","Show powered by SpatialChat Communities":"Spectacle propulsé par SpatialChat Communities","Hide closed groups if not joined":"Masquer les groupes fermés s'ils ne sont pas rejoints","Closed groups would not be shown to the user if they are not a member of the group":"Les groupes fermés ne seront pas affichés à l'utilisateur s'il n'est pas membre du groupe","Hide Community subscriber count from the users":"Masquer le nombre d'abonnés de la communauté des utilisateurs","This will hide the community subscriber list in the community header":"Cela masquera la liste des abonnés de la communauté dans l'en-tête de la communauté.","Disable Communtiy Switcher":"Désactiver le commutateur de communauté","Use MD editor for create post description":"Utilisez l'éditeur MD pour créer une description du message","Non logged in user will land on explore group page instead of post directory":"L'utilisateur non connecté atterrira sur la page du groupe d'exploration au lieu du répertoire de publication","Advanced configurable":"Configurable avancé","Communtiy default country code":"Code pays par défaut de la communauté","This will show up by default on login/signup":"Cela apparaîtra par défaut lors de la connexion/inscription","Onboarding/Welcome Message":"Message d'intégration/de bienvenue","Welcome Message":"Message de bienvenue","Greet your members with personalized message":"Saluez vos membres avec un message personnalisé","Welcome to":"Bienvenue à",Message:"Message","Add message":"Ajouter un message","Custom domain":"Domaine personnalisé","Add custom domain":"Ajouter un domaine personnalisé","Create new request":"Créer une nouvelle demande","Enter your custom domain":"Entrez votre domaine personnalisé","Setup details":"Détails de configuration","Add a CNAME record in your domain pointing to this community's address":"Ajoutez un enregistrement CNAME dans votre domaine pointant vers l'adresse de cette communauté","To configure your domain, you'll need to add a CNAME record pointing your domain to your pensil community URL":"Pour configurer votre domaine, vous devrez ajouter un enregistrement CNAME pointant votre domaine vers l'URL de votre communauté SpatialChat Communities.","Step by Step help apge":"Page d'aide étape par étape","All request list":"Liste de toutes les demandes","Allow admin to assign/un-assign custom points to users":"Autoriser l'administrateur à attribuer/désattribuer des points personnalisés aux utilisateurs","Base points for user to begin with":"Points de base pour l'utilisateur pour commencer","Base points will be updated for all the users, any changes will reflect for all the users.":"Les points de base seront mis à jour pour tous les utilisateurs, toute modification sera reflétée pour tous les utilisateurs.","Allocate points for interaction":"Attribuer des points pour l'interaction","Upvoting post":"Message de vote positif","creating a comment":"créer un commentaire","creating a reply":"créer une réponse","Getting upvote to their post":"Obtenir un vote positif pour leur message","Getting comment to their post":"Obtenir des commentaires sur leur message","Getting reply to their comment":"Obtenir une réponse à leur commentaire","Creating a post":"Créer un article",Visiblity:"Visibilité","Move Up":"Monter","Move Down":"Descendre","Create embedded section":"Créer une section intégrée","Preview area":"Zone d'aperçu","Theme selector":"Sélecteur de thème","Community Theme":"Thème communautaire","Select theme":"Sélectionner un thème","Select brand color":"Sélectionnez la couleur de la marque","Customize your button color to match your brand":"Personnalisez la couleur de votre bouton pour qu'elle corresponde à votre marque","Select on button text color":"Sélectionnez la couleur du texte du bouton","Suggestion: Keep inverted contrast against brand color":"Suggestion : conserver un contraste inversé par rapport à la couleur de la marque",Billing:"Facturation","Current plan":"Forfait actuel","You are current on Free PLan":"Vous êtes actuellement sur un plan gratuit","Renew on: NA":"Renouveler le : NA",Select:"Sélectionner","Email us at":"Envoyez-nous un courriel à","Compare plan":"Comparer les forfaits","API Keys":"Clés API","Create new key":"Créer une nouvelle clé","Total keys":"Clés totales","Keep your API keys safe! You can use them to access specific feature & let cetain apps perfrom certain actions on your behalf on the platform.":"Gardez vos clés API en sécurité ! Vous pouvez les utiliser pour accéder à des fonctionnalités spécifiques et permettre à certaines applications d'effectuer certaines actions en votre nom sur la plateforme.","Key name":"Nom de la clé","Key value":"Valeur clé",Action:"Action","Group updated!":"Groupe mis à jour !","Are you sure you want to":"Etes-vous sûr de vouloir","Make Moderator":"Devenir modérateur","Remove from group":"Supprimer du groupe","Show All":"Afficher tout","Change Role":"Changer de rôle",Close:"Fermer",copy:"copie",LINKS:"LINKS","Email Id":"Identifiant de courrier électronique",Name:"Nom","Search for an image":"Rechercher une image","Crop Image":"Recadrer l'image","No photos found":"Aucune photo trouvée",Community:"Communauté","Banner ratio - 16:9":"Rapport de bannière - 16:9","Banner Ratio - 16:6":"Rapport de bannière - 16:6","Share on mail":"Partager par courrier","Share on Telegram":"Partager sur Telegram","Share on Whatsapp":"Partager sur Whatsapp","Share on Linkedin":"Partager sur Linkedin","Share on Facebook":"Partager sur Facebook","Share on Twitter":"Partager sur Twitter","Pin Post":"Épingler le message","Heading (optional)":"Titre (facultatif)","Select section":"Sélectionner une rubrique",Gif:"Gifs","Create Custom Widget":"Créer un widget personnalisé","Are you sure you want to delete this widget?":"Êtes-vous sûr de vouloir supprimer ce widget ?","Go to event":"Aller à l'événement","Add Tags":"Ajouter des balises","Create Tag":"Créer une balise","Title (Optional)":"Titre (facultatif)","Search Gif":"Rechercher un gif","What's on your mind":"Qu'est-ce qui préoccupe votre esprit","Looks like nothing available here right now.":"Il semble que rien ne soit disponible ici pour le moment.","Try exploring other tabs":"Essayez d'explorer d'autres onglets","Delete Widget":"Supprimer le widget","Please select a section to post":"Veuillez sélectionner une section à publier","Post added successfully!":"Message ajouté avec succès !","Failed to create post. Please check post content and retry again.":"Échec de la création du message. Veuillez vérifier le contenu de la publication et réessayer.","Are you sure you want to discard current post?":"Etes-vous sûr de vouloir supprimer le message actuel ?","By default it will take up the image uploaded with the post":"Par défaut, l'image téléchargée avec la publication sera reprise.","Quiz can be only viewed and attempted from mobile device right now!":"Le quiz ne peut être consulté et tenté qu'à partir d'un appareil mobile pour le moment !","Community Banner":"Bannière communautaire","Change Cover":"Changer de couverture","Suggestions: Welcome to my community etc":"Suggestions : Bienvenue dans ma communauté, etc.","(edited)":"(édité)","Aspect ratio (recommended)":"Format d'image (recommandé)","Banner details updated!":"Détails de la bannière mis à jour !","Refresh if changes are not visible!":"Actualisez si les modifications ne sont pas visibles !","Banner details could not be updated!":"Les détails de la bannière n'ont pas pu être mis à jour !","Post deleted":"Message supprimé","Post not available. It may have been deleted.":"Poste non disponible. Il a peut-être été supprimé.",Admin:"Administrateur",Moderator:"Modérateur","Bookmark added!":"Marque-page ajouté !","Bookmark removed":"Favoris supprimé","Failed performing action!":"Échec de l'exécution de l'action !","Copy this link to share on other platforms":"Copiez ce lien pour partager sur d'autres plateformes","View this event":"Voir cet événement",Event:"Événement","Join Meeting":"Rejoindre la réunion","The live meeting has ended":"La réunion en direct est terminée","read more...":"En savoir plus...","Load more comments":"Charger plus de commentaires","Post Reply":"Publier une réponse","Post Comment":"Publier un commentaire",more:"plus",upvoted:"voté pour","1 Upvote":"1 vote positif","1 Comment":"1 commentaire","Please enter a title":"Veuillez entrer un titre","Please enter a url link":"Veuillez entrer un lien URL","Please enter button title":"Veuillez saisir le titre du bouton","Button label must be at least 20 characters":"L'étiquette du bouton doit comporter au moins 20 caractères","Please enter valid url":"Veuillez entrer une URL valide","Suggestions: Know more, Join, Apply...":"Suggestions : En savoir plus, Rejoindre, Postuler...",URL:"URL","Community Events":"Événements communautaires","Widget deleted successfully":"Widget supprimé avec succès","Community Top Contributors":"Meilleurs contributeurs de la communauté",points:"points","Points cannot be greater than current points":"Les points ne peuvent pas être supérieurs aux points actuels","Point cannot be a negative value":"Le point ne peut pas être une valeur négative","Point cannot be a decimal point":"Le point ne peut pas être un point décimal","Please enter a valid number":"Veuillez entrer un numéro valide","Karma points updated successfully":"Points de karma mis à jour avec succès","Error in updating karma points":"Erreur lors de la mise à jour des points de karma","Add karma points":"Ajouter des points de karma","Minus karma points":"Moins de points de karma","Total Karma points:":"Points de karma totaux :","Enter no. of karma points":"Entrez le numéro. de points de karma","Minus Points":"Points négatifs","Trending Post":"Article tendance","No visible description":"Aucune description visible","Picture ratio: 1:1":"Rapport d'image : 1:1","home feed":"flux d'accueil","Event name is invalid!":"Le nom de l'événement n'est pas valide !",custom:"coutume","Custom widget updated successfully":"Widget personnalisé mis à jour avec succès","Name invalid!":"Nom invalide !","Current timezone:":"Fuseau horaire actuel :","can be updated from community settings":"peut être mis à jour à partir des paramètres de la communauté","Event created successfully":"Événement créé avec succès","Error in creating event":"Erreur lors de la création de l'événement",Attendees:"Participants","Do you wish to notify these changes to attendees?":"Souhaitez-vous notifier ces changements aux participants ?","users wants to attend this event":"les utilisateurs veulent assister à cet événement","Yes, Notify them":"Oui, informez-les","No, its okay":"Non, ça va","Do you wish to notify that event is cancelled?":"Souhaitez-vous informer que l'événement est annulé?","Are you sure you want to delete the event?":"Êtes-vous sûr de vouloir supprimer l'événement ?","Delete Event":"Supprimer l'événement","New Event":"Nouvel événement","Accept Invitation":"Accepter l'invitation",Requested:"Demandé",Declined:"Refusé","Request Access":"Demander l'accès","Enroll for":"S'inscrire pour",Housefull:"Maison pleine","Just copy paste this code wherever you want it to be embedded:":"Copiez et collez simplement ce code là où vous souhaitez qu'il soit intégré :",Ended:"Terminé","Error getting events":"Erreur lors de l'obtention des événements","Events could not be fetched!":"Les événements n'ont pas pu être récupérés !","Show Attendees":"Participants au spectacle",Subscribers:"Abonnés","Make this a closed section":"Faites-en une section fermée","Update Section":"Section Mise à jour","Valid section name required!":"Nom de section valide requis !","Enter section name":"Entrez le nom de la section","Community Admin":"Administrateur de la communauté",Embed:"Intégrer","Invite to":"Inviter à","Please enter a valid email address":"S'il vous plaît, mettez une adresse email valide","Invitation sent successfully":"Invitation envoyée avec succès","Error sending invitation":"Erreur lors de l'envoi de l'invitation","Email is not valid!":"L'e-mail n'est pas valide !","Data could not be loaded!":"Les données n'ont pas pu être chargées !","Posted in":"Publié dans","Invite Members Individually":"Inviter des membres individuellement","Start a discussion":"Démarrer une discussion","Post something":"Publier quelque chose","Invite your audience":"Invitez votre public","Choose Plan":"Choisir un forfait",or:"ou","Create a link":"Créer un lien","Add link":"Ajouter un lien","Update link":"Lien de mise à jour","Add shortcut to your most used tools":"Ajoutez un raccourci vers vos outils les plus utilisés","Your website, Instagram Channel, Facebook profile etc":"Votre site Web, votre chaîne Instagram, votre profil Facebook, etc.","Valid link name required!":"Nom de lien valide requis !","Valid url required, and make sure you are not missing http:// or https://":"URL valide requise et assurez-vous de ne pas manquer http:// ou https://","Invite to__1":"Inviter à","Link Name":"Nom du lien","Link URL":"URL du lien","Could not subscribe to":"Impossible de s'abonner à","Subscribed to":"Abonné à","By default it will take up the community banner uploaded with the community":"Par défaut, il reprendra la bannière communautaire téléchargée avec la communauté","Created by":"Créé par","Online Event (Meeting link will be visible once registered for the event)":"Événement en ligne (le lien de la réunion sera visible une fois inscrit à l'événement)","Join Call":"Rejoindre l'appel","Please login to book this event":"Veuillez vous connecter pour réserver cet événement","Commented on":"Commenté","Replied to":"A répondu à","Looks like it's lonely here.":"On dirait que c'est solitaire ici.","Try exploring other sections and groups.":"Essayez d'explorer d'autres sections et groupes.","Please proceed with the payment or contact admin to gain access to this group.":"Veuillez procéder au paiement ou contacter l'administrateur pour accéder à ce groupe.","This is a closed group You'll need access to this group.":"Ceci est un groupe fermé. Vous devrez accéder à ce groupe.","You have no bookmarks right now.":"Vous n'avez aucun favori pour le moment.","The user hasn't posted anything yet publicly.":"L'utilisateur n'a encore rien publié publiquement.","No activity to show.":"Aucune activité à afficher.","Are you sure you want to unsubscribe the community?":"Etes-vous sûr de vouloir désabonner la communauté ?","deals left":"offres restantes","Something went wrong while loading posts":"Une erreur s'est produite lors du chargement des messages","Could not unsubscribe from":"Impossible de se désinscrire de","Unsubscribed from":"Désabonné de","Login to view this page":"Connectez-vous pour voir cette page",Login:"Se connecter","There was some error while doing the action!":"Une erreur s'est produite lors de l'exécution de l'action !","Unable to delete section!":"Impossible de supprimer la section !",__2:"",__3:"",__4:"","Home page":"Page d'accueil","Members Directory":"Annuaire des membres",Calendar:"Calendrier","Create Group":"Créer un groupe","Start Live Session":"Démarrer une session en direct",Home__1:"Maison",Following:"Suivant",__5:"","Post Card":"Carte postale",Like:"Comme",Comment__1:"Commentaire",Comment__2:"Commentaire",Share__1:"Partager",Report:"Rapport","Follow User":"Suivre l'utilisateur","Report User":"Signaler un utilisateur","Report Post":"Signaler le message",__6:"","LeaderBoard Floating pop up":"Pop-up flottant LeaderBoard","Go to leaderboard":"Aller au classement","Total karma points":"Points de karma totaux",Comments__1:"Commentaires",Upvotes__1:"Votes positifs",Replies__1:"Réponses",Post__1:"Poste","Custom Points__1":"Points personnalisés","Base Points":"Points de base",__7:"",Channel:"Canal","This is a private channel":"Ceci est une chaîne privée","You'll need access to this channel":"Vous aurez besoin d'accéder à cette chaîne",__8:"","Profile Page":"Page de profil",Followers:"Abonnés",Activities:"Activités",__9:"","Settings Page":"Page Paramètres","Go back to community":"Retourner à la communauté",Account:"Compte","Notification Centre":"Centre de notifications",__10:"","Edit Profile Page":"Modifier la page de profil","Set profile Picture":"Définir l'image du profil","Your name__1":"Votre nom",Subtitle:"Sous-titre","(Max char 60)":"(Maximum 60 caractères)","User Id":"ID de l'utilisateur","Short Bio":"Courte biographie","Link For Social Account":"Lien pour le compte social","This will be displayed on your profile__1":"Ceci sera affiché sur votre profil","Add Social handles":"Ajouter des poignées sociales",__11:"","Verification Page":"Page de vérification",Email__1:"E-mail",Verified__1:"Vérifié",__12:"","Manage your personal account notification preferences__1":"Gérer les préférences de notification de votre compte personnel",Preferences:"Préférences","Email Notification":"Notification par courrier électronique","Notify me about comment on my posts":"M'avertir des commentaires sur mes publications","Notify me about replies on my comment":"Me prévenir des réponses à mon commentaire","Notify me about upvote on my post":"M'avertir du vote positif sur mon message","Notify me about reaction to my comment":"M'informer de la réaction à mon commentaire","Notify me about reaction on my reply__1":"Informez-moi de la réaction à ma réponse","Notify me about direct message__1":"M'avertir des messages directs","Notify me about mentions":"M'avertir des mentions","Notification for new posts__1":"Notification pour les nouveaux messages","Only groups and channel available which you are part of. You can also control notification":"Seuls les groupes et chaînes disponibles dont vous faites partie. Vous pouvez également contrôler les notifications","Group & Channels":"Groupe et chaînes","All Activity":"Toutes les activités","Post by admin__1":"Posté par l'administrateur","No Notification__1":"Aucune notification",__13:"","Direct Message__1":"Message direct",Inbox:"Boîte de réception","No chats found":"Aucune discussion trouvée",__14:"","Create Post Popup":"Créer une fenêtre contextuelle de publication","Create Post in":"Créer une publication dans","Select Channel":"Sélectionnez la chaîne",__15:"","Dark mode":"Mode sombre",Feed:"Flux",Saved:"Enregistrés",Workflows:"Flux de travail",Rewards:"Récompenses",Networking:"Réseautage",Course:"Cours","Member Directory":"Annuaire des membres","Email Marketing":"Marketing par e-mail",Analytics:"Analytique","Log out":"Se déconnecter","Switch community":"Changer de communauté",Support:"Assistance","Select topic":"Choisir un sujet","Featured Posts":"Publications à la une","Featured posts":"Publications à la une",Courses:"Cours","Explore courses and learning paths in your community.":"Découvrez les cours et parcours d'apprentissage de votre communauté.","Add course":"Ajouter un cours","Search title, description, or creator…":"Rechercher un titre, une description ou un créateur…","Search courses":"Rechercher des cours","Clear search":"Effacer la recherche","Filter courses":"Filtrer les cours","Sort courses":"Trier les cours","Clear filters":"Effacer les filtres","{count} course":"{count} cours","{count} courses":"{count} cours",Updating:"Mise à jour","Could not load courses":"Impossible de charger les cours","Something went wrong. Please try again.":"Une erreur s'est produite. Veuillez réessayer.",Retry:"Réessayer","No courses found":"Aucun cours trouvé","Try another search term or change the filter.":"Essayez un autre terme de recherche ou modifiez le filtre.","No courses available":"Aucun cours disponible","Create the first course for your community.":"Créez le premier cours de votre communauté.","Check back when new courses are published.":"Revenez quand de nouveaux cours seront publiés.","Showing {shown} of {total} course":"Affichage de {shown} sur {total} cours","Showing {shown} of {total} courses":"Affichage de {shown} sur {total} cours","Show less":"Afficher moins","Read more":"Lire la suite","Request sent":"Demande envoyée","An admin will review your enrollment request.":"Un administrateur examinera votre demande d'inscription.",Enrolled:"Inscrit","You can start learning now.":"Vous pouvez commencer à apprendre dès maintenant.","Something went wrong.":"Une erreur s'est produite.","Could not join course":"Impossible de rejoindre le cours","No lessons yet":"Aucune leçon pour le moment","Content will appear when lessons are published.":"Le contenu apparaîtra lorsque les leçons seront publiées.","Course deleted":"Cours supprimé","Could not delete course":"Impossible de supprimer le cours","Course duplicated":"Cours dupliqué","The copy was created as a draft.":"La copie a été créée en brouillon.","Could not duplicate course":"Impossible de dupliquer le cours","Left course":"Cours quitté","Could not leave course":"Impossible de quitter le cours","Continue learning":"Continuer à apprendre","Buy now":"Acheter maintenant","Send request to enroll":"Envoyer une demande d'inscription","Enroll now":"S'inscrire maintenant","Course not found":"Cours introuvable","This course may have been removed or you lack access.":"Ce cours a peut-être été supprimé ou vous n'y avez pas accès.","Back to Courses":"Retour au cours","By {name}":"Par {name}","{count} lesson":"{count} leçon","{count} lessons":"{count} leçons","Total time to complete":"Durée totale","Attached to {group}":"Rattaché à {group}",Progress:"Progression","{done}/{total} lessons · {percent}%":"{done}/{total} leçons · {percent} %","Edit course":"Modifier le cours","Duplicate course":"Dupliquer le cours","Delete course":"Supprimer le cours","Course access is included with your active paid access":"L'accès au cours est inclus dans votre accès payant actif","Leave course":"Quitter le cours",Content:"Contenu","Quiz results":"Résultats du quiz","Delete course?":"Supprimer le cours ?","All course content and member progress will be permanently removed.":"Tout le contenu du cours et la progression des membres seront définitivement supprimés.","Leave course?":"Quitter le cours ?","You will lose access to lessons until you enroll again.":"Vous perdrez l'accès aux leçons jusqu'à votre prochaine inscription.","Not enrolled":"Non inscrit","Course content unlocks once you are enrolled. Request access or purchase membership if required.":"Le contenu du cours se débloque une fois inscrit. Demandez l'accès ou achetez un abonnement si nécessaire.","Add section":"Ajouter une section","No content yet":"Aucun contenu pour le moment","Add a section to start building this course.":"Ajoutez une section pour commencer à construire ce cours.","Content will be available when the course starts.":"Le contenu sera disponible au début du cours.","{count} comment":"{count} commentaire","{count} comments":"{count} commentaires","No comments on this course yet.":"Aucun commentaire sur ce cours pour le moment.","Showing {from}-{to} of {total} comments":"Affichage de {from}-{to} sur {total} commentaires",Lesson:"Leçon","Unlocks {date}":"Se débloque le {date}","{count} day after enrollment":"{count} jour après l'inscription","{count} days after enrollment":"{count} jours après l'inscription","Releases {date}":"Disponible le {date}","Section deleted":"Section supprimée","Could not delete section":"Impossible de supprimer la section","Lesson updated":"Leçon mise à jour","Lesson added":"Leçon ajoutée","Could not save lesson":"Impossible d'enregistrer la leçon","Lesson deleted":"Leçon supprimée","Could not delete lesson":"Impossible de supprimer la leçon","Lesson duplicated as draft":"Leçon dupliquée en brouillon","Could not duplicate lesson":"Impossible de dupliquer la leçon","Total time for this section":"Durée totale de cette section","Edit section":"Modifier la section","Delete section":"Supprimer la section","Lessons will appear here once added.":"Les leçons apparaîtront ici une fois ajoutées.","Not released yet":"Pas encore disponible","Complete the previous lesson first":"Terminez d'abord la leçon précédente","Time to complete":"Durée","Actions for {title}":"Actions pour {title}","Edit lesson":"Modifier la leçon","Duplicate lesson":"Dupliquer la leçon","Delete lesson":"Supprimer la leçon",Add:"Ajouter","Add lesson":"Ajouter une leçon","Delete section?":"Supprimer la section ?",'This removes "{name}" and all lessons inside it.':"Cela supprime « {name} » et toutes les leçons qu'elle contient.","Delete lesson?":"Supprimer la leçon ?",'This removes "{title}" permanently.':"Cela supprime « {title} » définitivement.","Lesson title":"Titre de la leçon",Minutes:"Minutes","Time to complete, in minutes":"Durée en minutes","How long this lesson takes, in minutes":"Durée de cette leçon, en minutes","Joined group":"Groupe rejoint","You're now in {group}. Enrolling you in the course…":"Vous êtes maintenant dans {group}. Inscription au cours en cours…","An admin will review your group request. After you're accepted you can enroll in the course.":"Un administrateur examinera votre demande d'adhésion au groupe. Une fois acceptée, vous pourrez vous inscrire au cours.","Could not join group":"Impossible de rejoindre le groupe","This course moved to {group}":"Ce cours a été déplacé vers {group}","Join {group} first":"Rejoignez d'abord {group}","This course is now part of “{group}”. Join its new group to continue accessing the course.":"Ce cours fait désormais partie de « {group} ». Rejoignez son nouveau groupe pour continuer à y accéder.","This course belongs to “{group}”. Join the group before enrolling and starting the course.":"Ce cours appartient à « {group} ». Rejoignez le groupe avant de vous inscrire et de commencer le cours.","Paid group access":"Accès payant au groupe","Membership required":"Abonnement requis","Explore the available plans for {group}, choose the one that suits you, and return here after purchase to begin learning.":"Découvrez les formules disponibles pour {group}, choisissez celle qui vous convient et revenez ici après l'achat pour commencer à apprendre.","Your request to join this group is already pending. You'll be able to enroll after an admin accepts it.":"Votre demande d'adhésion à ce groupe est déjà en attente. Vous pourrez vous inscrire une fois qu'un administrateur l'aura acceptée.","This is a {type} group. Continue to join instantly.":"Ceci est un groupe {type}. Continuez pour le rejoindre immédiatement.","This is a {type} group. Continue to send a request to the group admins.":"Ceci est un groupe {type}. Continuez pour envoyer une demande aux administrateurs du groupe.","Explore group":"Découvrir le groupe","Join group":"Rejoindre le groupe","Request to join group":"Demander à rejoindre le groupe","You can watch this lecture now.":"Vous pouvez regarder ce cours dès maintenant.","Could not enroll":"Impossible de s'inscrire","Want to view this lecture?":"Envie de voir ce cours ?","Your enrollment request is waiting for approval. You'll be able to watch this lecture after an admin accepts it.":"Votre demande d'inscription est en attente d'approbation. Vous pourrez regarder ce cours une fois qu'un administrateur l'aura acceptée.","Enroll in {course} to watch this lecture and the rest of the course.":"Inscrivez-vous à {course} pour regarder ce cours et le reste du programme.","Back to course":"Retour au cours","Enroll to view lecture":"S'inscrire pour voir le cours","Choose a membership plan that includes {course}.":"Choisissez une formule d'abonnement qui inclut {course}.",Subscribed:"Abonné","Payment successful":"Paiement réussi","You can now request access to this course.":"Vous pouvez maintenant demander l'accès à ce cours.","Checkout failed":"Échec du paiement","Buy group access":"Acheter l'accès au groupe","No membership plans are linked to this group yet.":"Aucune formule d'abonnement n'est encore liée à ce groupe.","Membership plan":"Formule d'abonnement","Subscribe free":"S'abonner gratuitement","{day} at {time}":"{day} à {time}","All courses":"Tous les cours",Published:"Publiés",Drafts:"Brouillons","Default order":"Ordre par défaut","Title A–Z":"Titre A–Z","Shortest first":"Plus courts d'abord","Longest first":"Plus longs d'abord","Most lessons":"Plus de leçons",Draft:"Brouillon",Personal:"Personnel","Community member":"Membre de la communauté","Your browser does not support video playback.":"Votre navigateur ne prend pas en charge la lecture vidéo.","Audio resource":"Ressource audio","Listen without leaving the Knowledge Hub":"Écoutez sans quitter le Knowledge Hub","Your browser does not support audio playback.":"Votre navigateur ne prend pas en charge la lecture audio.","Attached files":"Fichiers joints",FILE:"FICHIER",Hide:"Masquer",View:"Afficher",Download:"Télécharger","Resource media":"Média de la ressource",Audio:"Audio",Attachments:"Pièces jointes","About this resource":"À propos de cette ressource","Saving your resource…":"Enregistrement de votre ressource…","Finishing the upload…":"Finalisation de l'envoi…","Uploading 1 file · {percent}%":"Envoi de 1 fichier · {percent} %","Uploading {count} files · {percent}%":"Envoi de {count} fichiers · {percent} %","Remove {name}":"Retirer {name}","Description cannot exceed {max} characters":"La description ne peut pas dépasser {max} caractères","Your title":"Votre titre","Add a cover image before publishing":"Ajoutez une image de couverture avant de publier","Resource updated":"Ressource mise à jour","Resource shared":"Ressource partagée","Your changes are now live.":"Vos modifications sont maintenant en ligne.","It is now available in the Knowledge Hub.":"Elle est maintenant disponible dans le Knowledge Hub.","Upload cancelled":"Envoi annulé","Nothing was saved. Your files are still in the form.":"Rien n'a été enregistré. Vos fichiers sont toujours dans le formulaire.","Could not update resource":"Impossible de mettre à jour la ressource","Could not share resource":"Impossible de partager la ressource","Please try again.":"Veuillez réessayer.","That file is not an image":"Ce fichier n'est pas une image","Choose a PNG, JPG or WebP for the cover.":"Choisissez un PNG, JPG ou WebP pour la couverture.","Couldn't use that cover":"Impossible d'utiliser cette couverture","Pick another one, or choose a picture of your own.":"Choisissez-en une autre ou sélectionnez votre propre image.","Couldn't open the current cover":"Impossible d'ouvrir la couverture actuelle","Choose the image again to crop it.":"Choisissez à nouveau l'image pour la recadrer.","Video too large":"Vidéo trop volumineuse","Videos can be up to {limit}.":"Les vidéos peuvent peser jusqu'à {limit}.","That file is not audio":"Ce fichier n'est pas de l'audio","Choose an MP3, M4A, WAV or other audio file.":"Choisissez un fichier MP3, M4A, WAV ou autre fichier audio.","Audio too large":"Fichier audio trop volumineux","Audio files can be up to {size} MB.":"Les fichiers audio peuvent peser jusqu'à {size} Mo.","File too large":"Fichier trop volumineux","{count} files too large":"{count} fichiers trop volumineux",'"{name}" was not added. Files can be up to {limit}.':"« {name} » n'a pas été ajouté. Les fichiers peuvent peser jusqu'à {limit}.","{names} were not added. Files can be up to {size} MB ({videoLimit} for a video).":"{names} n'ont pas été ajoutés. Les fichiers peuvent peser jusqu'à {size} Mo ({videoLimit} pour une vidéo).","Up to 5 attachments":"Jusqu'à 5 pièces jointes","Only the first {count} file was added.":"Seul {count} fichier a été ajouté.","Only the first {count} files were added.":"Seuls les {count} premiers fichiers ont été ajoutés.","Remove one to add another.":"Retirez-en un pour en ajouter un autre.","Edit resource":"Modifier la ressource","Share a resource":"Partager une ressource","Update your resource. Saved changes will appear immediately.":"Mettez à jour votre ressource. Les modifications enregistrées apparaîtront immédiatement.","Add a cover and a description, then optionally a video, an audio file and files to download.":"Ajoutez une couverture et une description, puis éventuellement une vidéo, un fichier audio et des fichiers à télécharger.",Details:"Détails","Cover image file":"Fichier de l'image de couverture","Video file":"Fichier vidéo","Audio file":"Fichier audio","Attachment files":"Fichiers joints","Cover image":"Image de couverture","The picture on this resource's card in the library. It is not a download. After you pick a picture you choose which part to show, in the card's 16:9 shape, so nothing is cut off in the library. A large photo is resized before it is sent, so it uploads faster; the original on your device is not changed.":"L'image affichée sur la carte de cette ressource dans la bibliothèque. Ce n'est pas un téléchargement. Après avoir choisi une image, vous sélectionnez la partie à afficher, au format 16:9 de la carte, pour que rien ne soit coupé dans la bibliothèque. Une grande photo est redimensionnée avant l'envoi pour un envoi plus rapide ; l'original sur votre appareil n'est pas modifié.","Cover preview":"Aperçu de la couverture","Choose a cover image":"Choisir une image de couverture","PNG, JPG or WebP · you choose the part to show next":"PNG, JPG ou WebP · vous choisirez ensuite la partie à afficher","Replace cover":"Remplacer la couverture","Remove cover":"Retirer la couverture","Without a cover, the card shows a plain one in the community's colour.":"Sans couverture, la carte affiche une couverture simple aux couleurs de la communauté.","Current cover":"Couverture actuelle","Adjust crop":"Ajuster le recadrage","No picture to hand? Use a ready-made cover":"Pas d'image sous la main ? Utilisez une couverture prête à l'emploi","Cover subjects":"Thèmes de couverture","All ({count})":"Tous ({count})","Earlier covers":"Couvertures précédentes","Ready-made covers":"Couvertures prêtes à l'emploi","Use the {name} cover":"Utiliser la couverture {name}","More covers":"Plus de couvertures",Title:"Titre","What will members learn?":"Que vont apprendre les membres ?","Shorten the title to {max} characters or fewer.":"Raccourcissez le titre à {max} caractères maximum.","Share context, key takeaways, and why this is useful…":"Partagez le contexte, les points clés et l'intérêt de cette ressource…","Formatting counts toward the limit. Shorten the description to {max} characters or fewer.":"La mise en forme compte dans la limite. Raccourcissez la description à {max} caractères maximum.","Media to play":"Média à lire","(optional)":"(facultatif)","Members watch or listen to these inside the resource.":"Les membres les regardent ou les écoutent directement dans la ressource.","· one video, up to {limit}, or a link":"· une vidéo, jusqu'à {limit}, ou un lien","Current uploaded video":"Vidéo actuellement envoyée","Already uploaded":"Déjà envoyé","Upload video":"Envoyer une vidéo","YouTube or Vimeo URL":"URL YouTube ou Vimeo","Enter a valid YouTube or Vimeo link.":"Saisissez un lien YouTube ou Vimeo valide.","· one audio file":"· un fichier audio","Current audio file":"Fichier audio actuel","Upload audio":"Envoyer un fichier audio","Files to download":"Fichiers à télécharger","PDFs, Word, Excel or any other file members can download · {count}/5":"PDF, Word, Excel ou tout autre fichier que les membres peuvent télécharger · {count}/5","Add files":"Ajouter des fichiers","PDF preview":"Aperçu du PDF","PDF attachment preview":"Aperçu de la pièce jointe PDF","This is how members will see your resource. Nothing is shared until you save.":"Voici comment les membres verront votre ressource. Rien n'est partagé tant que vous n'enregistrez pas.","This is how members will see your resource. Nothing is shared until you publish.":"Voici comment les membres verront votre ressource. Rien n'est partagé tant que vous ne publiez pas.","When opened":"À l'ouverture","In the library":"Dans la bibliothèque","{done}/{total} done":"{done}/{total} terminé","Upload progress":"Progression de l'envoi","Keep this window open until it finishes.":"Gardez cette fenêtre ouverte jusqu'à la fin.","Cancel upload":"Annuler l'envoi","Save changes":"Enregistrer les modifications","Publish resource":"Publier la ressource","Choose what shows on the cover":"Choisissez ce qui s'affiche sur la couverture","Knowledge Hub":"Knowledge Hub","You created this resource.":"Vous avez créé cette ressource.","Moderator actions":"Actions de modération","This file can't be previewed. Use Download instead.":"Ce fichier ne peut pas être prévisualisé. Utilisez Télécharger.","Resource deleted":"Ressource supprimée","Could not delete resource":"Impossible de supprimer la ressource","This resource is no longer available":"Cette ressource n'est plus disponible","Couldn't open that resource":"Impossible d'ouvrir cette ressource","It may have been deleted. Here is the rest of the library.":"Elle a peut-être été supprimée. Voici le reste de la bibliothèque.","Community library":"Bibliothèque de la communauté","Useful ideas, explainers and media shared by your community.":"Idées utiles, explications et médias partagés par votre communauté.","Search title, description, or author…":"Rechercher un titre, une description ou un auteur…","Search Knowledge Hub resources":"Rechercher dans les ressources du Knowledge Hub","All content types":"Tous les types de contenu","Any date":"N'importe quelle date","Past 7 days":"7 derniers jours","Past 30 days":"30 derniers jours","Past 90 days":"90 derniers jours","Custom dates":"Dates personnalisées","Sort resources":"Trier les ressources","Newest first":"Plus récentes d'abord","Most liked":"Les plus aimées","Could not load the Knowledge Hub":"Impossible de charger le Knowledge Hub","Please check your connection and try again.":"Vérifiez votre connexion et réessayez.","Build your community library":"Construisez la bibliothèque de votre communauté","Share the first useful guide, talk, or audio resource with everyone.":"Partagez avec tous le premier guide, exposé ou contenu audio utile.","Share the first resource":"Partager la première ressource","No resources found":"Aucune ressource trouvée","Try another search term or change the filters.":"Essayez un autre terme de recherche ou modifiez les filtres.","Showing {shown} of {total} resource":"Affichage de {shown} sur {total} ressource","Showing {shown} of {total} resources":"Affichage de {shown} sur {total} ressources","Delete this resource?":"Supprimer cette ressource ?","“{title}” will be permanently removed from the Knowledge Hub. This action cannot be undone.":"« {title} » sera définitivement supprimée du Knowledge Hub. Cette action est irréversible.","Delete resource":"Supprimer la ressource","Remove your like":"Retirer votre « j'aime »","Like this resource":"Aimer cette ressource","You like this. Click to remove your like.":"Vous aimez ceci. Cliquez pour retirer votre « j'aime ».","Link copied":"Lien copié","It opens this resource in the Knowledge Hub.":"Il ouvre cette ressource dans le Knowledge Hub.","Couldn't copy link":"Impossible de copier le lien","Post in review":"Publication en cours de validation","An admin will review it before it appears.":"Un administrateur l'examinera avant son affichage.",Shared:"Partagé","Posted to {channel}":"Publié dans {channel}","Couldn't share the resource":"Impossible de partager la ressource","Copy link":"Copier le lien","Post to a channel":"Publier dans un canal","Send in a message":"Envoyer dans un message","Posts “{title}” with a link that opens it in the Knowledge Hub.":"Publie « {title} » avec un lien qui l'ouvre dans le Knowledge Hub.","Select channel":"Sélectionner un canal","Add a message to introduce this to your community (optional). Type @ to mention someone.":"Ajoutez un message pour le présenter à votre communauté (facultatif). Tapez @ pour mentionner quelqu'un.","Posting…":"Publication…","Share it in a message. The link opens the resource in the Knowledge Hub.":"Partagez-la dans un message. Le lien ouvre la ressource dans le Knowledge Hub.","{count} file":"{count} fichier","{count} files":"{count} fichiers","Open {title} in the Knowledge Hub":"Ouvrir {title} dans le Knowledge Hub","Like this course":"Aimer ce cours","It opens this course's page.":"Il ouvre la page de ce cours.","Posts “{title}” as a card members can like and open. Enrolling works as it does on the course page.":"Publie « {title} » sous forme de carte que les membres peuvent aimer et ouvrir. L'inscription fonctionne comme sur la page du cours.","Couldn't share the course":"Impossible de partager le cours","Share it in a message. The link opens the course's page.":"Partagez-le dans un message. Le lien ouvre la page du cours.","Open the course {title}":"Ouvrir le cours {title}","Paid plan":"Offre payante","Unlock {feature}":"Débloquez {feature}","Your current plan doesn't include it. Choose a plan to start using it.":"Votre offre actuelle ne l'inclut pas. Choisissez une offre pour commencer à l'utiliser.","Included in every paid plan, from {price}.":"Inclus dans toutes les offres payantes, à partir de {price}.","Included in every paid plan.":"Inclus dans toutes les offres payantes.","See plans":"Voir les offres","Maybe later":"Plus tard","Reach your members in their inbox with campaigns, newsletters, sequences, funnels and forms.":"Touchez vos membres dans leur boîte de réception avec des campagnes, newsletters, séquences, tunnels et formulaires.","Send campaigns and newsletters to your audience":"Envoyez des campagnes et des newsletters à votre audience","Automated sequences, funnels and sign-up forms":"Séquences automatisées, tunnels et formulaires d'inscription","Audience management and delivery analytics":"Gestion de l'audience et analyses de délivrabilité","Automate your community: act when members join, post or reach a milestone, without writing code.":"Automatisez votre communauté : agissez lorsque des membres rejoignent, publient ou atteignent une étape, sans écrire de code.","Automations triggered by joins, posts, streaks and more":"Automatisations déclenchées par les inscriptions, publications, séries et plus","Multi-step actions: notify, tag, award points, send email":"Actions en plusieurs étapes : notifier, étiqueter, attribuer des points, envoyer un e-mail","Ready-made templates to start in minutes":"Modèles prêts à l'emploi pour démarrer en quelques minutes","Member Analytics":"Analytique des membres","See how each member uses your community: time spent, sessions and the pages they visit.":"Voyez comment chaque membre utilise votre communauté : temps passé, sessions et pages visitées.","Time spent and sessions for every member":"Temps passé et sessions pour chaque membre","Page journeys: where members go and for how long":"Parcours de pages : où vont les membres et pendant combien de temps","Look up any member in Insights":"Recherchez n'importe quel membre dans Insights","Content category":"Catégorie de contenu","Content categories":"Catégories de contenu","All categories":"Toutes les catégories","No category":"Aucune catégorie","Add “{name}”":"Ajouter « {name} »","Filter by content category":"Filtrer par catégorie de contenu","Search categories":"Rechercher des catégories","Search or type a new category":"Rechercher ou saisir une nouvelle catégorie","Loading…":"Chargement…","Couldn't load categories. Try again.":"Impossible de charger les catégories. Réessayez.","No categories match.":"Aucune catégorie ne correspond.",Author:"Auteur",Authors:"Auteurs","All authors":"Tous les auteurs","Search authors":"Rechercher des auteurs","Filter by author":"Filtrer par auteur","Couldn't load authors. Try again.":"Impossible de charger les auteurs. Réessayez.","No authors match.":"Aucun auteur ne correspond.","No resources have been shared yet.":"Aucune ressource n’a encore été partagée.","No courses have been made yet.":"Aucun cours n’a encore été créé.","Shows only the resources one member has shared. The list has everyone who has shared a resource here, with how many each has shared; type a name to find someone. You can combine it with the other filters and the search box.":"N’affiche que les ressources partagées par un membre. La liste comprend tous ceux qui ont partagé une ressource ici, avec leur nombre ; tapez un nom pour trouver quelqu’un. Combinable avec les autres filtres et la recherche.","No resource has a category yet.":"Aucune ressource n'a encore de catégorie.","Show more":"Afficher plus","What kind of resource this is, such as a research paper or an opinion piece. Members can filter the Knowledge Hub by it. Pick one, or type your own and choose Add.":"Le type de ressource, par exemple un article de recherche ou une tribune. Les membres peuvent filtrer le Knowledge Hub par catégorie. Choisissez-en une, ou saisissez la vôtre et choisissez Ajouter.",Filters:"Filtres","{count} applied":"{count} appliqués","Content type":"Type de contenu","Date shared":"Date de partage","Remove filter {name}":"Retirer le filtre {name}","Research Paper":"Article de recherche",Article:"Article","Lecture/Talk":"Conférence","Opinion Piece":"Tribune",General:"Général",Football:"Football",Education:"Éducation",Physiotherapy:"Kinésithérapie",Coaching:"Entraînement","Sports Science":"Sciences du sport","Strength & Conditioning":"Préparation physique",Recovery:"Récupération",Nutrition:"Nutrition",Medicine:"Médecine",Health:"Santé",Cars:"Voitures",Entertainment:"Divertissement",Programming:"Programmation",Technology:"Technologie",Business:"Affaires",Science:"Sciences",Engineering:"Ingénierie",Sports:"Sports",Arts:"Arts",Travel:"Voyage",Food:"Cuisine",Resources:"Ressources","Could not load this course.":"Impossible de charger ce cours.","Back to course overview":"Retour à l'aperçu du cours","Preview as learner":"Aperçu en tant qu'apprenant","Close table of contents":"Fermer la table des matières","Join {group} to continue learning.":"Rejoignez {group} pour continuer à apprendre.","the course's current group":"le groupe actuel du cours","Enroll in this course to watch the lecture.":"Inscrivez-vous à ce cours pour regarder la leçon.","Next lesson":"Leçon suivante","Table of contents":"Table des matières","Add a section to start building content.":"Ajoutez une section pour commencer à créer du contenu.","No lessons available yet.":"Aucune leçon disponible pour le moment.","Lesson completed":"Leçon terminée","Marked incomplete":"Marquée comme non terminée","Could not update progress":"Impossible de mettre à jour la progression","Mark incomplete":"Marquer comme non terminée","Mark complete":"Marquer comme terminée","You need to join this course before you can view its lessons.":"Vous devez rejoindre ce cours avant de pouvoir voir ses leçons.","Go to course overview":"Aller à l'aperçu du cours","No lesson selected":"Aucune leçon sélectionnée","Pick a lesson from the table of contents.":"Choisissez une leçon dans la table des matières.","Lesson {current} of {total}":"Leçon {current} sur {total}","This lesson has no written content yet.":"Cette leçon n'a pas encore de contenu écrit.",Block:"Bloc","In this lesson":"Dans cette leçon","Lesson content":"Contenu de la leçon",Completed:"Terminée","Completed {date}":"Terminée le {date}","Open PDF":"Ouvrir le PDF","Quick check":"Vérification rapide",Assignment:"Devoir","Submit your work in the lesson discussion below.":"Rendez votre travail dans la discussion de la leçon ci-dessous.",Quiz:"Quiz","Could not save quiz.":"Impossible d'enregistrer le quiz.","Could not submit quiz":"Impossible de soumettre le quiz","Select all answers that apply.":"Sélectionnez toutes les réponses correctes.","This is an open-ended check — continue when you are ready.":"Il s'agit d'une vérification ouverte : continuez quand vous êtes prêt.","Submit quiz":"Soumettre le quiz","You {status} the quiz.":"Vous avez {status} le quiz.",passed:"réussi","didn't pass":"échoué","Great job!":"Bravo !","Review the answers below, then try again.":"Examinez les réponses ci-dessous, puis réessayez.","Retake quiz":"Repasser le quiz",Score:"Score","Correct answers":"Bonnes réponses",Correct:"Correct",Incorrect:"Incorrect",You:"Vous","Could not post your comment":"Impossible de publier votre commentaire","Could not update the comment":"Impossible de modifier le commentaire","Could not delete the comment":"Impossible de supprimer le commentaire",Discussion:"Discussion","Loading comments…":"Chargement des commentaires…","No comments yet — start the discussion.":"Aucun commentaire pour le moment — lancez la discussion.","Add to the discussion…":"Participez à la discussion…","Redirecting now…":"Redirection en cours…","Redirecting in {count} second":"Redirection dans {count} seconde","Redirecting in {count} seconds":"Redirection dans {count} secondes","Lesson complete":"Leçon terminée","Up next":"À suivre",Stay:"Rester",Continue:"Continuer","Quiz result":"Résultat du quiz","Question-by-question review of this learner's quiz attempt.":"Revue question par question de la tentative de cet apprenant.","Attempts: {count}":"Tentatives : {count}",Submitted:"Soumis","You received {points} karma point.":"Vous avez reçu {points} point de karma.","You received {points} karma points.":"Vous avez reçu {points} points de karma.","Congratulations!":"Félicitations !","You've successfully completed {course}.":"Vous avez terminé {course} avec succès.","Keep reviewing":"Continuer à réviser",Text:"Texte","Send feedback":"Envoyer un retour","You can attach up to {max} screenshots":"Vous pouvez joindre jusqu'à {max} captures d'écran","Only the first {count} screenshot was added":"Seule {count} capture d'écran a été ajoutée","Only the first {count} screenshots were added":"Seules les {count} premières captures d'écran ont été ajoutées","Unsupported image type":"Type d'image non pris en charge","Larger than 10 MB":"Plus de 10 Mo","Upload failed":"Échec de l'envoi","Add a short title.":"Ajoutez un titre court","Please add a bit more detail ({min}+ characters).":"Ajoutez un peu plus de détails ({min}+ caractères)","Bug report sent":"Rapport de bug envoyé","Idea sent":"Idée envoyée","Thanks! The SpatialChat Communities team will take a look.":"Merci ! L'équipe SpatialChat Communities y jettera un œil.","Couldn't send your feedback":"Impossible d'envoyer votre retour","Report a problem or suggest an improvement to the SpatialChat Communities team.":"Signalez un problème ou proposez une amélioration à l'équipe SpatialChat Communities.","Feedback type":"Type de retour","Report a bug":"Signaler un bug","Suggest an idea":"Proposer une idée","e.g. Verify code shows “Validation error!”":"ex. Le code de vérification affiche « Erreur de validation ! »","e.g. Let me schedule posts":"ex. Me permettre de programmer des publications","What happened?":"Que s'est-il passé ?","What would you like?":"Que souhaiteriez-vous ?","What did you do, what did you expect, and what happened instead?":"Qu'avez-vous fait, qu'attendiez-vous et que s'est-il passé à la place ?","What problem are you trying to solve? How would this help you?":"Quel problème essayez-vous de résoudre ? En quoi cela vous aiderait-il ?",Screenshots:"Captures d'écran","(optional, up to {max})":"(facultatif, jusqu'à {max})",Uploading:"Envoi en cours","Add screenshot":"Ajouter une capture d'écran","or drop / paste (Ctrl/⌘+V) an image":"ou déposez / collez (Ctrl/⌘+V) une image","Screenshots that failed to upload won't be sent. Remove them or try again.":"Les captures d'écran dont l'envoi a échoué ne seront pas envoyées. Retirez-les ou réessayez.","Include technical details":"Inclure les détails techniques","(recommended)":"(recommandé)","Page, browser, and no recent errors. Passwords, tokens and emails are removed.":"Page, navigateur et aucune erreur récente. Les mots de passe, jetons et e-mails sont supprimés.","Page, browser, and {count} recent error. Passwords, tokens and emails are removed.":"Page, navigateur et {count} erreur récente. Les mots de passe, jetons et e-mails sont supprimés.","Page, browser, and {count} recent errors. Passwords, tokens and emails are removed.":"Page, navigateur et {count} erreurs récentes. Les mots de passe, jetons et e-mails sont supprimés.","Page: {path}":"Page : {path}","Browser: {browser}":"Navigateur : {browser}","Screen: {width}x{height} · Build: {version}":"Écran : {width}x{height} · Version : {version}","No errors captured in this session.":"Aucune erreur capturée durant cette session.","The SpatialChat Communities team may contact me about this":"L'équipe SpatialChat Communities peut me contacter à ce sujet","Uploading…":"Envoi…","Send report":"Envoyer le rapport","Send idea":"Envoyer l'idée","{points} earned":"{points} gagnés","{points} to spend":"{points} à dépenser","Profile picture updated":"Photo de profil mise à jour","Couldn't update picture":"Impossible de mettre à jour la photo","Cover photo updated":"Photo de couverture mise à jour","Couldn't update cover":"Impossible de mettre à jour la couverture","Link copied!":"Lien copié !","Profile link copied to clipboard.":"Lien du profil copié dans le presse-papiers.",Cover:"Couverture","Joined {date}":"Inscrit le {date}","Badges & achievements":"Badges et réussites","No badges earned yet — stay active to unlock your first one.":"Aucun badge obtenu pour le moment — restez actif pour débloquer le premier.",Badge:"Badge","You haven't posted yet.":"Vous n'avez pas encore publié.","No activity yet.":"Aucune activité pour le moment.","Adjust cover photo":"Ajuster la photo de couverture","Add a bio and interests from":"Ajoutez une bio et des centres d'intérêt depuis","to fill out your About section.":"pour remplir votre section À propos.",Bio:"Bio",Interests:"Centres d'intérêt","No achievement badges are configured for this community yet.":"Aucun badge de réussite n'est encore configuré pour cette communauté.","Earned {date}":"Obtenu le {date}","Profile updated":"Profil mis à jour","Your changes have been saved.":"Vos modifications ont été enregistrées.","Couldn't save profile":"Impossible d'enregistrer le profil",Username:"Nom d'utilisateur","Checking availability…":"Vérification de la disponibilité…","Username is available":"Le nom d'utilisateur est disponible","Username is taken":"Le nom d'utilisateur est déjà pris","3–64 chars: letters, numbers, _ or .":"3–64 caractères : lettres, chiffres, _ ou .",Headline:"Titre",Location:"Localisation","Social links":"Liens sociaux","Saving…":"Enregistrement…","Couldn't update preference":"Impossible de mettre à jour la préférence","Email notifications":"Notifications par e-mail","Choose which activity on your content sends you an email.":"Choisissez quelle activité sur votre contenu vous envoie un e-mail.","Posts created":"Publications créées","Comments made":"Commentaires écrits","Replies made":"Réponses écrites","Likes given":"J'aime donnés","Likes on your posts":"J'aime sur vos publications","Your posts commented":"Vos publications commentées","Your replies received":"Vos réponses reçues","Followers gained":"Abonnés gagnés","Live sessions":"Sessions en direct","Admin-assigned":"Attribués par un admin",Other:"Autre","How you earned your {points}":"Comment vous avez gagné vos {points}","No points yet — post, comment and react to start earning.":"Pas encore de points — publiez, commentez et réagissez pour commencer à en gagner.","Language updated":"Langue mise à jour","Using the community's language":"Utilisation de la langue de la communauté","Only you see this change.":"Vous seul voyez ce changement.","Couldn't change your language":"Impossible de changer votre langue",Language:"Langue","Menus, buttons and labels are shown in the language you pick here, for you only. Posts, comments and messages stay in the language they were written in. Other members keep the community's language unless they pick their own.":"Les menus, boutons et libellés s'affichent dans la langue que vous choisissez ici, pour vous uniquement. Les publications, commentaires et messages restent dans la langue dans laquelle ils ont été écrits. Les autres membres gardent la langue de la communauté, sauf s'ils choisissent la leur.","Choose the language you read this community in.":"Choisissez la langue dans laquelle vous lisez cette communauté.","My language":"Ma langue","Community default":"Par défaut de la communauté","Console error":"Erreur de console","Console warning":"Avertissement de console",Crash:"Plantage","Unhandled error":"Erreur non gérée","Failed request":"Requête échouée",About:"À propos",Achievements:"Réussites",Website:"Site web",Silver:"Argent",Gold:"Or",Platinum:"Platine",Diamond:"Diamant",Elite:"Élite","Comments on my posts":"Commentaires sur mes publications","When someone comments on your post":"Quand quelqu'un commente votre publication","Replies to my comments":"Réponses à mes commentaires","When someone replies to your comment":"Quand quelqu'un répond à votre commentaire","Likes on my posts":"J'aime sur mes publications","When someone likes your post":"Quand quelqu'un aime votre publication","Reactions to my comments":"Réactions à mes commentaires","When someone reacts to your comment":"Quand quelqu'un réagit à votre commentaire","Reactions to my replies":"Réactions à mes réponses","When someone reacts to your reply":"Quand quelqu'un réagit à votre réponse","Direct messages":"Messages privés","When you receive a direct message":"Quand vous recevez un message privé",Mentions:"Mentions","When someone @mentions you":"Quand quelqu'un vous @mentionne","Load more {label}":"Charger plus de {label}","Loading more {label}…":"Chargement de plus de {label}…",courses:"cours",resources:"ressources",items:"éléments","About {label}":"À propos de {label}","Couldn't like this course":"Impossible d'aimer ce cours","Couldn't like this resource":"Impossible d'aimer cette ressource","Couldn't remove your like":"Impossible de retirer votre mention J'aime","Notify members":"Prévenir les membres","Sends everyone in the community a notification about this resource, in the app and as a push notification on their phone or browser. Members who turned off notifications for this community don't get it.":"Envoie à tous les membres de la communauté une notification sur cette ressource, dans l'application et en notification push sur leur téléphone ou navigateur. Les membres qui ont désactivé les notifications de cette communauté ne la reçoivent pas.","It is now available in the Knowledge Hub, and members are being notified.":"Elle est maintenant disponible dans le Knowledge Hub, et les membres sont prévenus.","How posts are ordered":"Comment les publications sont classées","Recent: newest first. Top posts: the most likes, of all time; comments don't change the order. Trending: the most likes and comments together, within the period you pick. Following: posts by people you follow.":"Récentes : les plus récentes d'abord. Top publications : le plus de j'aime, depuis toujours ; les commentaires ne changent pas l'ordre. Tendances : le plus de j'aime et de commentaires réunis, sur la période choisie. Abonnements : les publications des personnes que vous suivez.","Save this resource":"Enregistrer cette ressource","Save this course":"Enregistrer ce cours","Remove from saved":"Retirer des enregistrements","Saved. Click to remove it from your saved list.":"Enregistré. Cliquez pour le retirer de votre liste.","Find it any time under Saved in the Knowledge Hub.":"Retrouvez-le à tout moment dans Enregistrés, dans le Knowledge Hub.","Find it any time under Saved on the Courses page.":"Retrouvez-le à tout moment dans Enregistrés, sur la page Cours.","Couldn't save this resource":"Impossible d’enregistrer cette ressource","Couldn't save this course":"Impossible d’enregistrer ce cours","Couldn't remove it from saved":"Impossible de le retirer des enregistrements","All resources":"Toutes les ressources",Show:"Afficher","Press the bookmark on anything to save it here for later. Only you can see what you saved.":"Appuyez sur le signet de n’importe quel élément pour l’enregistrer ici pour plus tard. Vous seul voyez ce que vous avez enregistré.","Date range":"Période",Today:"Aujourd’hui","Last 7 days":"7 derniers jours","Last 4 weeks":"4 dernières semaines","Last 6 months":"6 derniers mois","Last 12 months":"12 derniers mois","Month to date":"Mois en cours","Quarter to date":"Trimestre en cours","Year to date":"Année en cours","All time":"Toute la période",Start:"Début",End:"Fin",Clear:"Effacer",Apply:"Appliquer","Couldn't download this file":"Impossible de télécharger ce fichier","A new category is saved with capital letters, so “fancy dress” becomes “Fancy Dress”, and one that already exists is reused rather than added twice.":"Une nouvelle catégorie est enregistrée avec des majuscules, donc « fancy dress » devient « Fancy Dress », et une catégorie qui existe déjà est réutilisée plutôt qu’ajoutée deux fois.","Job title":"Poste","Your role, such as Head of Sports Science or Team Physiotherapist. It shows under your name in the member directory and on your profile, so members know who to contact.":"Votre rôle, par exemple Responsable des sciences du sport ou Kinésithérapeute de l’équipe. Il s’affiche sous votre nom dans l’annuaire des membres et sur votre profil, pour que les membres sachent qui contacter.","e.g. Head of Sports Science":"ex. Responsable des sciences du sport","Type where you are based, or use your current location: your browser asks first, and only the town and country are filled in. Your exact position is never saved. Check it, then save your profile.":"Indiquez où vous êtes basé, ou utilisez votre position actuelle : votre navigateur demande d’abord l’autorisation et seuls la ville et le pays sont remplis. Votre position exacte n’est jamais enregistrée. Vérifiez-la, puis enregistrez votre profil.","e.g. Stockholm, Sweden":"ex. Stockholm, Suède","Finding you…":"Localisation…","Use my location":"Utiliser ma position","Please enter your location, or use your current location.":"Veuillez indiquer votre localisation, ou utiliser votre position actuelle.","Fields marked * are required.":"Les champs marqués d'un * sont obligatoires.","Your details in {community}":"Vos informations dans {community}","Your community details":"Vos informations dans la communauté","Community details":"Informations de la communauté","Questions this community's admins ask every member. Your answers show in its member directory, except ones marked “Only admins see this”.":"Questions que les administrateurs de cette communauté posent à chaque membre. Vos réponses apparaissent dans l'annuaire des membres, sauf celles marquées « Visible seulement par les administrateurs ».","Couldn't save your profile":"Impossible d'enregistrer votre profil","Check the highlighted detail, then save again.":"Vérifiez l'information en surbrillance, puis enregistrez à nouveau.","Location filled in":"Lieu renseigné","Check it, then save your profile.":"Vérifiez-le, puis enregistrez votre profil.","Couldn't use your location":"Impossible d’utiliser votre position","Please type your location.":"Veuillez saisir votre lieu.","Your browser can't share your location here. Please type it.":"Votre navigateur ne peut pas partager votre position ici. Veuillez la saisir.","Location access is blocked. Allow it for this site in your browser settings, or type your location.":"L’accès à la position est bloqué. Autorisez-le pour ce site dans les paramètres du navigateur, ou saisissez votre lieu.","Finding your location took too long. Please try again, or type your location.":"La localisation a pris trop de temps. Réessayez, ou saisissez votre lieu.","Your location isn't available right now. Please type it.":"Votre position n’est pas disponible pour le moment. Veuillez la saisir.","Location lookup isn't available right now. Please type your location.":"La recherche de lieu n’est pas disponible pour le moment. Veuillez saisir votre lieu."},Lnn={"SpatialChat Communities Keyword":"Japanese",Home:"家","Explore Groups":"グループを探索する",Events:"イベント",Groups:"グループ",Links:"リンク","Direct Message":"ダイレクトメッセージ","Powered by":"搭載","No groups here, please use + to create a new one, or join one see them here.":"ここにはグループがありません。+ を使用して新しいグループを作成するか、ここでグループに参加してください。","Please join a group to see them here":"ここで見るにはグループに参加してください","Section can only be reordered within the group!":"セクションはグループ内でのみ並べ替えることができます。","Group Page":"グループページ","Invite Members":"メンバーを招待する",Join:"参加する",Joined:"参加しました","Create new section":"新しいセクションを作成する","Group Setting drop down":"グループ設定ドロップダウン",Share:"共有","Edit group":"グループの編集","Delete group":"グループの削除",Leave:"離れる","Are you sure you want to delete the group?":"グループを削除してもよろしいですか?",Cancel:"キャンセル","Yes, Go Ahead":"はい、どうぞ","Share via link":"リンク経由で共有",Copy:"コピー",Copied:"コピーされました","Share on social media":"ソーシャルメディアで共有する","Add Section":"セクションの追加","Section Header":"セクションヘッダー",Live:"ライブ","Create post":"投稿の作成","Notificaiton Bell":"通知ベル","All posts":"すべての投稿","Admin posts only":"管理者の投稿のみ",None:"なし","Section Setting drop down":"セクション設定ドロップダウン","Edit Section":"セクションの編集","Embed Section":"セクションを埋め込む","Delete Section":"セクションの削除","Are you sure you want to delete the section?":"セクションを削除してもよろしいですか?","Section deleted!":"セクションが削除されました!","Create Group Pop up / Update":"グループ作成ポップアップ/更新","Create group":"グループの作成","Basic Detail":"基本的な詳細",Settings:"設定","Size 16:9 or 1600 by 900":"サイズ 16:9 または 1600 x 900","Group name":"グループ名","Enter group name":"グループ名を入力してください","Suggestions: Spaces, Channels, Groups, Blog, Knowledgebase, etc":"提案: スペース、チャネル、グループ、ブログ、ナレッジベースなど","Group Description":"グループの説明","Enter description here":"ここに説明を入力してください","Group Type":"グループタイプ",Open:"開ける","Visible to all & anyone can join":"全員に表示され、誰でも参加できます",Closed:"閉店","User will have to request to join the group":"ユーザーはグループへの参加をリクエストする必要があります",Paid:"有料","Group Price":"団体料金","Currency (Default: INR)":"通貨 (デフォルト: INR)","User will have to pay to join the group":"ユーザーはグループに参加するには料金を支払う必要があります","Make this a private group":"これをプライベートグループにする","Private group will only be visible to members who are part of it. Admin can add members manually from member list":"プライベート グループは、そのメンバーであるメンバーのみに表示されます。管理者はメンバーリストから手動でメンバーを追加できます","Upload from device":"デバイスからアップロードする","Search image":"画像検索","Valid group name required!":"有効なグループ名が必要です!","Update Group":"アップデートグループ","SEO Settings":"SEO設定","Custom URL":"カスタムURL","Meta Title":"メタタイトル","Maximum length of 255 characters allowed":"最大長は 255 文字です","Meta Description":"メタディスクリプション","Open Graph Detail":"グラフの詳細を開く","Open Graph Title":"グラフのタイトルを開く","Open Graph Description":"グラフの説明を開く","Open Graph Image":"グラフ画像を開く","Recommended dimensions: 1200px by 630px with a 1.91:1 aspect ratio.":"推奨サイズ: 1200 ピクセル x 630 ピクセル、アスペクト比 1.91:1。","If no URL is used, it will automatically picked your group thumbnail.":"URL が使用されない場合は、グループのサムネイルが自動的に選択されます。","Create Section Pop up / Update":"セクション作成ポップアップ/更新","Create Section":"セクションの作成","Section Name":"セクション名","Suggestions: General, Introductions, Community Guidelines":"提案: 一般、紹介、コミュニティ ガイドライン","Section Type":"セクションタイプ","Post Type":"投稿タイプ","Group Chat":"グループチャット","Who can post in this section?":"このセクションには誰が投稿できますか?","Only Admin":"管理者のみ","Any user":"任意のユーザー","Sorting order for section":"セクションの並べ替え順序","Latest first":"最新順","Oldest post first":"最も古い投稿が最初に表示されます","Section Appearance":"セクションの外観","List View":"リストビュー","Grid View":"グリッドビュー","Make this closed section":"このセクションを閉じたセクションにします","Members will have to request access to see section content":"メンバーはセクションのコンテンツを表示するにはアクセスをリクエストする必要があります","Make this a private section":"ここを非公開セクションにします","Disables requests (Make sure closed section is selected as well).":"リクエストを無効にします (閉じたセクションも選択されていることを確認してください)。","Post Editor":"投稿編集者","Create new post in":"に新しい投稿を作成します","Add Cover Picture":"カバー写真を追加する","Heading (Optional)":"見出し (オプション)","Write here..":"ここに書いてください。",Picture:"写真",Video:"ビデオ",Attachment:"アタッチメント",Poll:"投票","Embed Code":"コードを埋め込む",Tags:"タグ","Toggle to question":"質問に切り替えます","Poll expire time":"投票期限切れ時間","Poll question":"アンケートの質問","Enter Question":"質問を入力してください",Question:"質問",Option:"オプション",Options:"オプション","Add Option":"オプションの追加","Poll Expiry time":"ポーリング有効期限","12 Hours":"12時間","1 Day":"1日","2 Days":"2日間","1 Week":"1週間","2 Weeks":"2週間","Always Open":"常時オープン","Write embeddable code":"埋め込み可能なコードを書く","Click here to add embed code.":"埋め込みコードを追加するにはここをクリックしてください。","Paste your embed code here!":"ここに埋め込みコードを貼り付けてください。","Post Settings":"投稿設定","Update Post":"投稿を更新する",Update:"アップデート","Start meeting / Video call / Live":"ミーティング/ビデオ通話/ライブを開始","Meeting Name":"会議名","Suggestion: Group discussion etc":"提案：グループディスカッションなど",Description:"説明","Enter description here (optional)":"ここに説明を入力してください (オプション)","When do you want to start the session":"セッションをいつ開始したいですか","Right now":"今すぐ","Schedule for later":"後の予定を立てる","Group video call":"グループビデオ通話",Webinar:"ウェビナー","Go Live":"ライブに移行","Go live":"ライブに移行","Info on the Post":"投稿に関する情報","Post comment":"コメントを投稿する",Comment:"コメント",Comments:"コメント",Reply:"返事",Replies:"返信","Share via URL":"URL経由で共有","Reshare in other sections":"他のセクションで再共有する","Post Card Drop Down":"ポストカードドロップダウン",Bookmark:"ブックマーク","Pin post":"ピンポスト",Edit:"編集","Embed Post":"投稿を埋め込む",Delete:"消去","Remove Pin":"ピンを外す","Remove Bookmark":"ブックマークを削除","Just copy paste this code wherever you want it to be embedded":"このコードをコピーして埋め込みたい場所に貼り付けるだけです",Height:"身長",Preview:"プレビュー","Copied to clipboard":"クリップボードにコピーされました","Select Widgets":"ウィジェットの選択","Add widgets to":"ウィジェットを追加する","You can change their order by dragging & dropping the widgets over each other":"ウィジェットを相互にドラッグ＆ドロップすることで順序を変更できます","Please note: Widget wont be displayed if there is no data available,":"注意: 利用可能なデータがない場合、ウィジェットは表示されません。","Group Members":"グループメンバー","Group Leaderboard":"グループリーダーボード","Community Leaderboard":"コミュニティリーダーボード","Trending Posts":"注目の投稿","Group Events":"グループイベント","Add Custom":"カスタムの追加","Save Widgets":"ウィジェットの保存","Visible to user":"ユーザーに表示される","Visible to admin":"管理者に表示されます","Add widget to":"ウィジェットを追加する","Upload cover picture":"カバー写真をアップロードする","1:1 aspect ration (recommended)":"アスペクト比 1:1 (推奨)","Card Title":"カードタイトル","Enter widget name":"ウィジェット名を入力してください","Small Description (try to keep it under 50 words)":"簡単な説明 (50 単語以内に収めるようにしてください)","Enter description":"説明を入力してください","Button Title":"ボタンのタイトル","Enter button name":"ボタン名を入力してください","Siggestion: Know more, Join, Apply, etc":"サイン: 詳細を知る、参加する、申し込むなど","URL link":"URLリンク","Create custom widget":"カスタムウィジェットを作成する","Custom widget created successfully":"カスタム ウィジェットが正常に作成されました",Widgets:"ウィジェット",Members:"メンバー","See All":"すべて見る","Communtiy Top Contributors":"コミュニティのトップレベルの貢献者","Community members":"コミュニティメンバー","Group Top Contributors":"グループのトップレベルの貢献者","Upcoming Events":"今後のイベント","Home Page Banner":"ホームページのバナー","Edit Banner":"バナーの編集","Home page Edit Banner Pop up":"ホームページ編集バナーポップアップ","Update Banner":"バナーを更新",Search:"検索","Upload Image":"画像をアップロードする",Remove:"取り除く","Banner image (please use 16:6 ratio or 1600px by 600px image for the best view)":"バナー画像 (最適な表示を得るには、16:6 比率または 1600 ピクセル x 600 ピクセルの画像を使用してください)","Banner Title":"バナータイトル","Enter here":"ここに入力してください","Suggestion: Welcome to my community etc":"提案: 私のコミュニティへようこそなど","Banner Description":"バナーの説明","Enter banner description":"バナーの説明を入力してください","Save Banner Info":"バナー情報の保存","Home Page Feed":"ホームページフィード",Recent:"最近の","Top posts":"人気の投稿",Trending:"トレンド","Home Feed Groups":"ホームフィードグループ","":"#VALUE!","My profile":"私のプロフィール",Logout:"ログアウト",Notification:"通知",Notifications:"通知","Mark all viewed":"すべて閲覧済みとしてマークする","has created a post":"投稿を作成しました","wants to join":"参加したいです","has commented on your post":"あなたの投稿にコメントしました","has replied to your comment":"あなたのコメントに返信しました","Search for tags":"タグを検索する","All groups":"すべてのグループ","Search result":"検索結果","No post found for selected hashtag":"選択したハッシュタグの投稿が見つかりませんでした","Start a conversation":"会話を始める","Search by name":"名前で検索",Upcoming:"今後の予定",UPCOMING:"今後の予定",Past:"過去",PAST:"過去","No upcoming events":"今後のイベントはありません","Create event popup":"イベントポップアップを作成する","Event details":"イベント詳細","16:9 aspect ratio":"16:9 アスペクト比","Event name":"イベント名","Enter event name":"イベント名を入力してください","Host Name":"ホスト名","You will be made host if none selected":"何も選択されていない場合は、あなたがホストになります","Write here...":"ここに書いてください...","No. of registration for the event":"イベント登録数",Unlimited:"無制限","When & where":"いつ、どこで",From:"から","Start date":"開始日",time:"時間",To:"に","End date":"終了日","Current time zone:":"現在のタイムゾーン:","Can be updated from the communtiy setting":"コミュニティ設定から更新可能","Online event":"オンラインイベント","Add meeting link":"会議リンクを追加","Meeting link will be generated once event is created":"イベントが作成されると会議リンクが生成されます",Venue:"会場","Enter address":"住所を入力してください",Create:"作成する",Invite:"招待する","Share event via link":"リンク経由でイベントを共有する",Copy__1:"コピー","Select section to post this event":"このイベントを投稿するセクションを選択してください","Once posted, members of that group or section will recieve an notification":"投稿されると、そのグループまたはセクションのメンバーは通知を受け取ります",Post:"役職",RSVP:"お返事お願いします","Book Event":"書籍イベント","Yes, I'll attend":"はい、参加します","May be":"多分","No, I won't attend":"いいえ、参加しません","Date & Time":"日付と時刻",Host:"ホスト","Online meeting":"オンライン会議","Meeting link will be visible once registered for the event":"イベントに登録すると、ミーティングのリンクが表示されます","User Management":"ユーザー管理","Go bac to community":"コミュニティに戻る","Manage Members":"メンバーの管理",Member:"メンバー",Invited:"招待されました","Search for member":"メンバーを探す","Add to group":"グループに追加","Send Direct Message":"ダイレクトメッセージを送信する","Change role":"役割を変更する","Kick from community":"コミュニティからのキック","Super Admin":"スーパー管理者","Super admin will have full access to the communtiy settings":"スーパー管理者はコミュニティ設定に完全にアクセスできます","Group Admin":"グループ管理者","Admin of the selected group can edit the group information and create, edt or delete section under selected group":"選択したグループの管理者は、グループ情報を編集し、選択したグループの下にセクションを作成、編集、または削除できます。","Group Moderator":"グループモデレーター","Group moderator can create or delete post, comment, reply & messages in the selected group.":"グループモデレーターは、選択したグループ内の投稿、コメント、返信、メッセージを作成または削除できます。",User:"ユーザー",Save:"保存","User role updated successfully":"ユーザー役割が正常に更新されました",Leaderboard:"リーダーボード","Click on the column header for sorting":"並べ替えるには列ヘッダーをクリックします",Rank:"ランク","Karma Points":"カルマポイント","Custom Points":"カスタムポイント",Follow:"フォローする",Upvotes:"賛成票",Posts:"投稿","Add custom points":"カスタムポイントを追加する","Subtract custom points":"カスタムポイントを減算する","Enter no. of points":"いいえを入力してください。ポイントの","Add points":"ポイントを追加する","Invite members to":"メンバーを招待する","Invite via link":"リンク経由で招待する","Invite via email":"メールで招待する","Add more":"さらに追加","Upload a CSV":"CSVをアップロードする","Please upload a comma-seprated CSV file, with header as name, email.":"ヘッダーを名前、電子メールとして、カンマ区切りの CSV ファイルをアップロードしてください。","Here is a template CSV file":"テンプレートCSVファイルはこちら","Upload File":"ファイルをアップロードする","Send Invite":"招待を送信する","Mail Template":"メールテンプレート","Send Test Mail":"テストメールを送信する",Hey:"おい","A has invite you to join the B":"A があなたを B に招待しました","Switch to rich text editor":"リッチテキストエディタに切り替える","Add Custom Message":"カスタムメッセージの追加","Enter message here":"ここにメッセージを入力してください","Send Bulk Mail":"一括メールを送信する","Send Mail":"メールを送信する","Send bulk mail to all community members or select group members":"すべてのコミュニティ メンバーまたは選択したグループ メンバーに一括メールを送信する",Date:"日付",Subject:"主題",Recipients:"受信者","1000 bulk emails remaining for this month. Resets on <date>":"今月の一括メールは残り 1000 件です。 <日付> にリセットします",Everyone:"みんな","Enter mail subject":"メールの件名を入力してください","Write message":"メッセージを書く",Cancel__1:"キャンセル",Send:"送信",__1:"#VALUE!",Activity:"活動",Bookmarks:"ブックマーク","Edit profile":"プロフィールの編集",Unsubscribe:"購読を解除する","Settings (Account)":"設定（アカウント）",Profile:"プロフィール","Set Profile Picture":"プロフィール写真を設定する","Your name":"あなたの名前","User ID":"ユーザーID","Short bio":"短い略歴","Link your social account":"ソーシャルアカウントをリンクする","This will be displayed on your profile":"これはプロフィールに表示されます","Add social handle":"ソーシャルハンドルを追加",Verification:"検証","Account Verification":"アカウントの認証",Email:"電子メール","Enter email":"メールアドレスを入力してください",Verified:"確認済み",Unverified:"未検証",Change:"変化",Unlink:"リンクを解除する",Mobile:"携帯","enter mobile no.":"携帯番号を入力してください","Request OTP":"OTP をリクエストする","Manage your personal account notification preferences":"個人アカウントの通知設定を管理する",Prefrences:"好み","Email notification":"電子メール通知","Notify me about comments on my posts":"私の投稿へのコメントについて通知する","Notify me about replies on my comments":"コメントへの返信について通知する","Notify me about likes on my posts":"自分の投稿へのいいねを通知する","Notify me about reaction on my comments":"私のコメントに対する反応について通知する","Notify me about reaction on my reply":"私の返信に対する反応を通知する","Notify me about direct message":"ダイレクトメッセージについて通知する","Notify me about my mentions":"私のメンションについて通知する","Notification for new posts":"新しい投稿の通知","Only group & section available which you are part of":"あなたが所属しているグループとセクションのみが利用可能です","Group & Section":"グループとセクション","All activity":"すべてのアクティビティ","Post by admin":"管理者による投稿","No Notification":"通知なし","Setting (Community)":"設定（コミュニティ）","General Settings":"一般設定","Upload community logo":"コミュニティロゴをアップロードする","Community name":"コミュニティ名","Invalid field":"無効なフィールド","Your community address":"コミュニティのアドレス","Fav icon":"お気に入りアイコン","This will be visible on the browser tab (32px by 32px)":"これはブラウザのタブに表示されます (32 ピクセル x 32 ピクセル)。",TimeZone:"タイムゾーン","Privacy Policy on login page":"ログインページのプライバシーポリシー","Terms & Condition on login page":"ログインページの利用規約","Enter link here":"ここにリンクを入力してください","Open Group Image":"グループ画像を開く","By default ir takes up the community banner uploaded with the communtiy":"デフォルトでは、IR はコミュニティとともにアップロードされたコミュニティ バナーを取り上げます。","Community Experience":"コミュニティ体験",Onboarding:"オンボーディング","Member Fields":"メンバー項目","Make your community private":"コミュニティを非公開にする","Users will have to login or sign up to access the community":"ユーザーがコミュニティにアクセスするにはログインまたはサインアップする必要があります","Make account verification mandatory for both email & mobile":"電子メールとモバイルの両方でアカウント認証を必須にする","New user will have to verify both email & mobile no. to access the community":"新規ユーザーは電子メールと携帯電話番号の両方を確認する必要があります。コミュニティにアクセスするには","Admin will also have to verify their mobile no. & email or else they won't be able to access the community":"管理者は携帯電話番号も確認する必要があります。メールを送信しないとコミュニティにアクセスできなくなります","Gated community access":"ゲート付きコミュニティへのアクセス","Admin will have to approve or reject user's requests to join the community":"管理者はユーザーのコミュニティへの参加リクエストを承認または拒否する必要があります","Disable mobile login/register":"モバイルログイン/登録を無効にする","Disable email login/register":"電子メールのログイン/登録を無効にする","Disable google login/register":"Googleログイン/登録を無効にする","Disable facebook login/register":"Facebookのログイン/登録を無効にする","Show & Hide features":"表示と非表示の機能","Hide direct chat":"ダイレクトチャットを非表示にする","User will not be able to send direct messages to each other":"ユーザーは相互にダイレクトメッセージを送信できなくなります","Hide profile picture from top right corner for mobile responsive view":"モバイル対応ビューでは右上隅のプロフィール写真を非表示にします","Useful when using community in an in app browser":"アプリ内ブラウザでコミュニティを使用する場合に便利です","Hide profile picture from top right corner in every view":"すべてのビューで右上隅のプロフィール写真を非表示にします","Disable header dropdown on profile picture":"プロフィール写真のヘッダー ドロップダウンを無効にする","Useful for integrated community, especially using SSO":"統合コミュニティ、特に SSO を使用する場合に役立ちます","Hide the communtiy logo from the header":"ヘッダーからコミュニティのロゴを非表示にする","Hide the communtiy title from the header":"ヘッダーからコミュニティのタイトルを非表示にする","Show collpased group in the side nav bar":"サイド ナビゲーション バーに折りたたまれたグループを表示する","Show full expanded post in the home feed":"ホームフィードに展開された投稿全体を表示する","Hide the leaderboard score from the header":"ヘッダーからリーダーボードのスコアを非表示にする","Show powered by SpatialChat Communities":"SpatialChat Communities によるショー","Hide closed groups if not joined":"参加していない場合は非公開グループを非表示にする","Closed groups would not be shown to the user if they are not a member of the group":"閉じられたグループは、グループのメンバーではない場合、ユーザーには表示されません。","Hide Community subscriber count from the users":"コミュニティの登録者数をユーザーから非表示にする","This will hide the community subscriber list in the community header":"これにより、コミュニティ ヘッダーのコミュニティ購読者リストが非表示になります。","Disable Communtiy Switcher":"コミュニティスイッチャーを無効にする","Use MD editor for create post description":"MDエディタを使用して投稿の説明を作成します","Non logged in user will land on explore group page instead of post directory":"ログインしていないユーザーは、投稿ディレクトリではなくエクスプローラー グループ ページにアクセスします。","Advanced configurable":"高度な構成可能","Communtiy default country code":"コミュニティのデフォルトの国コード","This will show up by default on login/signup":"これはログイン/サインアップ時にデフォルトで表示されます","Onboarding/Welcome Message":"オンボーディング/ウェルカムメッセージ","Welcome Message":"ウェルカムメッセージ","Greet your members with personalized message":"パーソナライズされたメッセージでメンバーに挨拶します","Welcome to":"へようこそ",Message:"メッセージ","Add message":"メッセージを追加","Custom domain":"カスタムドメイン","Add custom domain":"カスタムドメインの追加","Create new request":"新しいリクエストを作成する","Enter your custom domain":"カスタム ドメインを入力してください","Setup details":"セットアップの詳細","Add a CNAME record in your domain pointing to this community's address":"このコミュニティのアドレスを指す CNAME レコードをドメインに追加します","To configure your domain, you'll need to add a CNAME record pointing your domain to your pensil community URL":"ドメインを設定するには、ドメインを SpatialChat Communities コミュニティ URL に指す CNAME レコードを追加する必要があります。","Step by Step help apge":"ステップバイステップヘルプ apge","All request list":"全リクエストリスト","Allow admin to assign/un-assign custom points to users":"管理者がユーザーにカスタム ポイントを割り当て/割り当て解除できるようにする","Base points for user to begin with":"ユーザーが最初に使用するベースポイント","Base points will be updated for all the users, any changes will reflect for all the users.":"ベースポイントはすべてのユーザーに対して更新され、変更はすべてのユーザーに反映されます。","Allocate points for interaction":"インタラクションにポイントを割り当てる","Upvoting post":"賛成票を投じた投稿","creating a comment":"コメントの作成","creating a reply":"返信を作成する","Getting upvote to their post":"自分の投稿に賛成票を集める","Getting comment to their post":"投稿へのコメントの取得","Getting reply to their comment":"コメントへの返信を取得する","Creating a post":"投稿の作成",Visiblity:"可視性","Move Up":"上に移動","Move Down":"下に移動","Create embedded section":"埋め込みセクションの作成","Preview area":"プレビューエリア","Theme selector":"テーマセレクター","Community Theme":"コミュニティのテーマ","Select theme":"テーマの選択","Select brand color":"ブランドカラーを選択してください","Customize your button color to match your brand":"ブランドに合わせてボタンの色をカスタマイズします","Select on button text color":"ボタンの文字色を選択してください","Suggestion: Keep inverted contrast against brand color":"提案: ブランドカラーに対してコントラストを反転させてください",Billing:"請求する","Current plan":"現在の計画","You are current on Free PLan":"現在は無料プランをご利用中です","Renew on: NA":"更新日: NA",Select:"選択","Email us at":"までメールでお問い合わせください","Compare plan":"プランを比較する","API Keys":"APIキー","Create new key":"新しいキーを作成する","Total keys":"キーの合計","Keep your API keys safe! You can use them to access specific feature & let cetain apps perfrom certain actions on your behalf on the platform.":"API キーを安全に保管してください。これらを使用すると、特定の機能にアクセスしたり、プラットフォーム上で特定のアプリに特定のアクションを実行させたりすることができます。","Key name":"キー名","Key value":"キーの値",Action:"アクション","Group updated!":"グループ更新しました！","Are you sure you want to":"本当によろしいですか","Make Moderator":"モデレーターにする","Remove from group":"グループから削除","Show All":"すべて表示","Change Role":"役割の変更",Close:"近い",copy:"コピー",LINKS:"リンク","Email Id":"メールID",Name:"名前","Search for an image":"画像を検索する","Crop Image":"画像のトリミング","No photos found":"写真が見つかりませんでした",Community:"コミュニティ","Banner ratio - 16:9":"バナー比率 - 16:9","Banner Ratio - 16:6":"バナー比率 - 16:6","Share on mail":"メールで共有する","Share on Telegram":"テレグラムでシェアする","Share on Whatsapp":"Whatsappで共有する","Share on Linkedin":"Linkedin で共有する","Share on Facebook":"Facebook でシェアする","Share on Twitter":"Twitterでシェアする","Pin Post":"ピンポスト","Heading (optional)":"見出し (オプション)","Select section":"セクションを選択",Gif:"GIF","Create Custom Widget":"カスタムウィジェットの作成","Are you sure you want to delete this widget?":"このウィジェットを削除してもよろしいですか?","Go to event":"イベントに行く","Add Tags":"タグを追加する","Create Tag":"タグの作成","Title (Optional)":"タイトル (オプション)","Search Gif":"GIFを検索","What's on your mind":"何を考えているの","Looks like nothing available here right now.":"現在ここでは何も入手できないようです。","Try exploring other tabs":"他のタブを調べてみる","Delete Widget":"ウィジェットの削除","Please select a section to post":"投稿するセクションを選択してください","Post added successfully!":"投稿が正常に追加されました。","Failed to create post. Please check post content and retry again.":"投稿の作成に失敗しました。投稿内容を確認して、もう一度やり直してください。","Are you sure you want to discard current post?":"現在の投稿を破棄してもよろしいですか?","By default it will take up the image uploaded with the post":"デフォルトでは、投稿と一緒にアップロードされた画像が使用されます","Quiz can be only viewed and attempted from mobile device right now!":"現在、クイズはモバイル デバイスからのみ表示および挑戦できます。","Community Banner":"コミュニティバナー","Change Cover":"カバーを変更する","Suggestions: Welcome to my community etc":"関連用語: 私のコミュニティへようこそ など","(edited)":"(編集済み)","Aspect ratio (recommended)":"アスペクト比 (推奨)","Banner details updated!":"バナー詳細を更新しました！","Refresh if changes are not visible!":"変更が表示されない場合は更新してください。","Banner details could not be updated!":"バナーの詳細を更新できませんでした。","Post deleted":"投稿が削除されました","Post not available. It may have been deleted.":"ポストは利用できません。削除された可能性があります。",Admin:"管理者",Moderator:"モデレータ","Bookmark added!":"ブックマークが追加されました！","Bookmark removed":"ブックマークが削除されました","Failed performing action!":"アクションの実行に失敗しました!","Copy this link to share on other platforms":"他のプラットフォームで共有するには、このリンクをコピーしてください","View this event":"このイベントを見る",Event:"イベント","Join Meeting":"ミーティングに参加する","The live meeting has ended":"ライブミーティングは終了しました","read more...":"続きを読む...","Load more comments":"さらにコメントを読み込む","Post Reply":"返信を投稿する","Post Comment":"コメントを投稿する",more:"もっと",upvoted:"賛成票を投じた","1 Upvote":"1 賛成票","1 Comment":"1 コメント","Please enter a title":"タイトルを入力してください","Please enter a url link":"URLリンクを入力してください","Please enter button title":"ボタンのタイトルを入力してください","Button label must be at least 20 characters":"ボタンのラベルは 20 文字以上である必要があります","Please enter valid url":"有効なURLを入力してください","Suggestions: Know more, Join, Apply...":"提案: もっと詳しく知る、参加する、申し込む...",URL:"URL","Community Events":"コミュニティイベント","Widget deleted successfully":"ウィジェットが正常に削除されました","Community Top Contributors":"コミュニティのトップレベルの貢献者",points:"ポイント","Points cannot be greater than current points":"現在のポイントを超えるポイントは設定できません","Point cannot be a negative value":"ポイントを負の値にすることはできません","Point cannot be a decimal point":"ポイントに小数点は使用できません","Please enter a valid number":"有効な番号を入力してください","Karma points updated successfully":"カルマポイントが正常に更新されました","Error in updating karma points":"カルマポイントの更新エラー","Add karma points":"カルマポイントを追加する","Minus karma points":"マイナスカルマポイント","Total Karma points:":"合計カルマポイント:","Enter no. of karma points":"いいえを入力してください。カルマポイントの","Minus Points":"マイナスポイント","Trending Post":"トレンドの投稿","No visible description":"目に見える説明はありません","Picture ratio: 1:1":"画像比率: 1:1","home feed":"ホームフィード","Event name is invalid!":"イベント名が無効です!",custom:"カスタム","Custom widget updated successfully":"カスタム ウィジェットが正常に更新されました","Name invalid!":"名前が無効です!","Current timezone:":"現在のタイムゾーン:","can be updated from community settings":"コミュニティ設定から更新できます","Event created successfully":"イベントが正常に作成されました","Error in creating event":"イベント作成時のエラー",Attendees:"出席者","Do you wish to notify these changes to attendees?":"これらの変更を出席者に通知しますか?","users wants to attend this event":"ユーザーはこのイベントに参加したいと考えています","Yes, Notify them":"はい、通知します","No, its okay":"いいえ、大丈夫です","Do you wish to notify that event is cancelled?":"イベントが中止になったことを通知しますか?","Are you sure you want to delete the event?":"イベントを削除してもよろしいですか?","Delete Event":"イベントの削除","New Event":"新しいイベント","Accept Invitation":"招待を承諾する",Requested:"リクエスト済み",Declined:"拒否されました","Request Access":"アクセスのリクエスト","Enroll for":"登録する",Housefull:"ハウスフル","Just copy paste this code wherever you want it to be embedded:":"このコードをコピーして、埋め込みたい場所に貼り付けるだけです。",Ended:"終了しました","Error getting events":"イベント取得エラー","Events could not be fetched!":"イベントを取得できませんでした。","Show Attendees":"出席者を表示する",Subscribers:"購読者","Make this a closed section":"ここをクローズドセクションにします","Update Section":"更新セクション","Valid section name required!":"有効なセクション名が必要です!","Enter section name":"セクション名を入力してください","Community Admin":"コミュニティ管理者",Embed:"埋め込む","Invite to":"に招待する","Please enter a valid email address":"有効なメールアドレスを入力してください","Invitation sent successfully":"招待状が正常に送信されました","Error sending invitation":"招待状の送信エラー","Email is not valid!":"電子メールが無効です!","Data could not be loaded!":"データをロードできませんでした!","Posted in":"で投稿される","Invite Members Individually":"メンバーを個別に招待する","Start a discussion":"ディスカッションを開始する","Post something":"何かを投稿する","Invite your audience":"視聴者を招待する","Choose Plan":"プランを選択",or:"または","Create a link":"リンクを作成する","Add link":"リンクを追加","Update link":"リンクを更新する","Add shortcut to your most used tools":"よく使うツールにショートカットを追加する","Your website, Instagram Channel, Facebook profile etc":"ウェブサイト、Instagram チャンネル、Facebook プロフィールなど","Valid link name required!":"有効なリンク名が必要です!","Valid url required, and make sure you are not missing http:// or https://":"有効な URL が必要です。http:// または https:// を忘れていないことを確認してください。","Invite to__1":"に招待する","Link Name":"リンク名","Link URL":"リンクURL","Could not subscribe to":"購読できませんでした","Subscribed to":"購読しました","By default it will take up the community banner uploaded with the community":"デフォルトでは、コミュニティとともにアップロードされたコミュニティ バナーが表示されます。","Created by":"作成者","Online Event (Meeting link will be visible once registered for the event)":"オンライン イベント (イベントに登録すると、ミーティングのリンクが表示されます)","Join Call":"通話に参加する","Please login to book this event":"このイベントを予約するにはログインしてください","Commented on":"コメントしました","Replied to":"に返信しました","Looks like it's lonely here.":"ここは寂しいようだ。","Try exploring other sections and groups.":"他のセクションやグループを探索してみてください。","Please proceed with the payment or contact admin to gain access to this group.":"支払いを続行するか、管理者に連絡してこのグループにアクセスしてください。","This is a closed group You'll need access to this group.":"これは非公開のグループです。このグループにアクセスする必要があります。","You have no bookmarks right now.":"現在ブックマークはありません。","The user hasn't posted anything yet publicly.":"ユーザーはまだ何も公開していません。","No activity to show.":"表示するアクティビティがありません。","Are you sure you want to unsubscribe the community?":"コミュニティの購読を解除してもよろしいですか?","deals left":"残りの取引","Something went wrong while loading posts":"投稿の読み込み中に問題が発生しました","Could not unsubscribe from":"購読を解除できませんでした","Unsubscribed from":"からの購読を解除しました","Login to view this page":"このページを表示するにはログインしてください",Login:"ログイン","There was some error while doing the action!":"アクションの実行中にエラーが発生しました。","Unable to delete section!":"セクションを削除できません!",__2:"",__3:"",__4:"","Home page":"ホームページ","Members Directory":"会員名簿",Calendar:"カレンダー","Create Group":"グループの作成","Start Live Session":"ライブセッションを開始する",Home__1:"家",Following:"続く",__5:"","Post Card":"ポストカード",Like:"のように",Comment__1:"コメント",Comment__2:"コメント",Share__1:"共有",Report:"報告","Follow User":"ユーザーをフォローする","Report User":"ユーザーを報告する","Report Post":"レポート投稿",__6:"","LeaderBoard Floating pop up":"LeaderBoard フローティング ポップアップ","Go to leaderboard":"リーダーボードに移動","Total karma points":"合計カルマポイント",Comments__1:"コメント",Upvotes__1:"賛成票",Replies__1:"返信",Post__1:"役職","Custom Points__1":"カスタムポイント","Base Points":"ベースポイント",__7:"",Channel:"チャネル","This is a private channel":"これはプライベートチャンネルです","You'll need access to this channel":"このチャンネルにアクセスする必要があります",__8:"","Profile Page":"プロフィールページ",Followers:"フォロワー",Activities:"活動内容",__9:"","Settings Page":"設定ページ","Go back to community":"コミュニティに戻る",Account:"アカウント","Notification Centre":"通知センター",__10:"","Edit Profile Page":"プロフィール編集ページ","Set profile Picture":"プロフィール画像を設定する","Your name__1":"あなたの名前",Subtitle:"字幕","(Max char 60)":"(最大文字数 60)","User Id":"ユーザーID","Short Bio":"短い略歴","Link For Social Account":"ソーシャルアカウントのリンク","This will be displayed on your profile__1":"これはプロフィールに表示されます","Add Social handles":"ソーシャルハンドルを追加する",__11:"","Verification Page":"認証ページ",Email__1:"電子メール",Verified__1:"確認済み",__12:"","Manage your personal account notification preferences__1":"個人アカウントの通知設定を管理する",Preferences:"設定","Email Notification":"電子メール通知","Notify me about comment on my posts":"私の投稿へのコメントについて通知する","Notify me about replies on my comment":"私のコメントへの返信について通知する","Notify me about upvote on my post":"自分の投稿に対する賛成票について通知する","Notify me about reaction to my comment":"私のコメントに対する反応について通知する","Notify me about reaction on my reply__1":"私の返信に対する反応を通知する","Notify me about direct message__1":"ダイレクトメッセージについて通知する","Notify me about mentions":"メンションについて通知する","Notification for new posts__1":"新しい投稿の通知","Only groups and channel available which you are part of. You can also control notification":"あなたが所属しているグループとチャンネルのみが利用可能です。通知を制御することもできます","Group & Channels":"グループとチャンネル","All Activity":"すべてのアクティビティ","Post by admin__1":"管理者による投稿","No Notification__1":"通知なし",__13:"","Direct Message__1":"ダイレクトメッセージ",Inbox:"受信箱","No chats found":"チャットが見つかりませんでした",__14:"","Create Post Popup":"投稿ポップアップの作成","Create Post in":"投稿を作成する","Select Channel":"チャンネルの選択",__15:"","Dark mode":"ダークモード",Feed:"フィード",Saved:"保存済み",Workflows:"ワークフロー",Rewards:"リワード",Networking:"ネットワーキング",Course:"コース","Member Directory":"メンバー名簿","Email Marketing":"メールマーケティング",Analytics:"アナリティクス","Log out":"ログアウト","Switch community":"コミュニティを切り替え",Support:"サポート","Select topic":"トピックを選択","Featured Posts":"注目の投稿","Featured posts":"注目の投稿",Courses:"コース","Explore courses and learning paths in your community.":"コミュニティのコースや学習パスを探しましょう。","Add course":"コースを追加","Search title, description, or creator…":"タイトル、説明、作成者で検索…","Search courses":"コースを検索","Clear search":"検索をクリア","Filter courses":"コースを絞り込む","Sort courses":"コースを並べ替え","Clear filters":"フィルターをクリア","{count} course":"{count} コース","{count} courses":"{count} コース",Updating:"更新中","Could not load courses":"コースを読み込めませんでした","Something went wrong. Please try again.":"問題が発生しました。もう一度お試しください。",Retry:"再試行","No courses found":"コースが見つかりません","Try another search term or change the filter.":"別の検索語を試すか、フィルターを変更してください。","No courses available":"利用できるコースはありません","Create the first course for your community.":"コミュニティ最初のコースを作成しましょう。","Check back when new courses are published.":"新しいコースが公開されたら、またご確認ください。","Showing {shown} of {total} course":"{total} 件中 {shown} 件のコースを表示","Showing {shown} of {total} courses":"{total} 件中 {shown} 件のコースを表示","Show less":"表示を減らす","Read more":"もっと見る","Request sent":"リクエストを送信しました","An admin will review your enrollment request.":"管理者が登録リクエストを確認します。",Enrolled:"登録済み","You can start learning now.":"今すぐ学習を始められます。","Something went wrong.":"問題が発生しました。","Could not join course":"コースに参加できませんでした","No lessons yet":"レッスンはまだありません","Content will appear when lessons are published.":"レッスンが公開されると、コンテンツが表示されます。","Course deleted":"コースを削除しました","Could not delete course":"コースを削除できませんでした","Course duplicated":"コースを複製しました","The copy was created as a draft.":"コピーは下書きとして作成されました。","Could not duplicate course":"コースを複製できませんでした","Left course":"コースから退出しました","Could not leave course":"コースから退出できませんでした","Continue learning":"学習を続ける","Buy now":"今すぐ購入","Send request to enroll":"登録をリクエスト","Enroll now":"今すぐ登録","Course not found":"コースが見つかりません","This course may have been removed or you lack access.":"このコースは削除されたか、アクセス権がない可能性があります。","Back to Courses":"コースに戻る","By {name}":"{name} 作成","{count} lesson":"{count} レッスン","{count} lessons":"{count} レッスン","Total time to complete":"合計所要時間","Attached to {group}":"{group} に紐づけ",Progress:"進捗","{done}/{total} lessons · {percent}%":"{done}/{total} レッスン · {percent}%","Edit course":"コースを編集","Duplicate course":"コースを複製","Delete course":"コースを削除","Course access is included with your active paid access":"コースへのアクセスは、有効な有料アクセスに含まれています","Leave course":"コースから退出",Content:"コンテンツ","Quiz results":"クイズ結果","Delete course?":"コースを削除しますか？","All course content and member progress will be permanently removed.":"コースのすべてのコンテンツとメンバーの進捗が完全に削除されます。","Leave course?":"コースから退出しますか？","You will lose access to lessons until you enroll again.":"再度登録するまで、レッスンにアクセスできなくなります。","Not enrolled":"未登録","Course content unlocks once you are enrolled. Request access or purchase membership if required.":"コースのコンテンツは登録すると利用できます。必要に応じてアクセスをリクエストするか、メンバーシップを購入してください。","Add section":"セクションを追加","No content yet":"コンテンツはまだありません","Add a section to start building this course.":"セクションを追加して、このコースを作り始めましょう。","Content will be available when the course starts.":"コンテンツはコースの開始時に利用できるようになります。","{count} comment":"{count} 件のコメント","{count} comments":"{count} 件のコメント","No comments on this course yet.":"このコースにはまだコメントがありません。","Showing {from}-{to} of {total} comments":"{total} 件中 {from}-{to} 件のコメントを表示",Lesson:"レッスン","Unlocks {date}":"{date} に解放","{count} day after enrollment":"登録後 {count} 日","{count} days after enrollment":"登録後 {count} 日","Releases {date}":"{date} に公開","Section deleted":"セクションを削除しました","Could not delete section":"セクションを削除できませんでした","Lesson updated":"レッスンを更新しました","Lesson added":"レッスンを追加しました","Could not save lesson":"レッスンを保存できませんでした","Lesson deleted":"レッスンを削除しました","Could not delete lesson":"レッスンを削除できませんでした","Lesson duplicated as draft":"レッスンを下書きとして複製しました","Could not duplicate lesson":"レッスンを複製できませんでした","Total time for this section":"このセクションの合計時間","Edit section":"セクションを編集","Delete section":"セクションを削除","Lessons will appear here once added.":"レッスンを追加すると、ここに表示されます。","Not released yet":"未公開","Complete the previous lesson first":"先に前のレッスンを完了してください","Time to complete":"所要時間","Actions for {title}":"{title} の操作","Edit lesson":"レッスンを編集","Duplicate lesson":"レッスンを複製","Delete lesson":"レッスンを削除",Add:"追加","Add lesson":"レッスンを追加","Delete section?":"セクションを削除しますか？",'This removes "{name}" and all lessons inside it.':"「{name}」と、その中のすべてのレッスンが削除されます。","Delete lesson?":"レッスンを削除しますか？",'This removes "{title}" permanently.':"「{title}」が完全に削除されます。","Lesson title":"レッスンのタイトル",Minutes:"分","Time to complete, in minutes":"所要時間（分）","How long this lesson takes, in minutes":"このレッスンにかかる時間（分）","Joined group":"グループに参加しました","You're now in {group}. Enrolling you in the course…":"{group} に参加しました。コースに登録しています…","An admin will review your group request. After you're accepted you can enroll in the course.":"管理者がグループへのリクエストを確認します。承認されると、コースに登録できます。","Could not join group":"グループに参加できませんでした","This course moved to {group}":"このコースは {group} に移動しました","Join {group} first":"先に {group} に参加してください","This course is now part of “{group}”. Join its new group to continue accessing the course.":"このコースは「{group}」の一部になりました。コースへのアクセスを続けるには、新しいグループに参加してください。","This course belongs to “{group}”. Join the group before enrolling and starting the course.":"このコースは「{group}」に属しています。登録してコースを開始する前に、グループに参加してください。","Paid group access":"有料グループアクセス","Membership required":"メンバーシップが必要です","Explore the available plans for {group}, choose the one that suits you, and return here after purchase to begin learning.":"{group} の利用可能なプランを確認し、ご自身に合ったものを選んで、購入後にここへ戻って学習を始めましょう。","Your request to join this group is already pending. You'll be able to enroll after an admin accepts it.":"このグループへの参加リクエストは承認待ちです。管理者が承認すると、登録できるようになります。","This is a {type} group. Continue to join instantly.":"これは{type}グループです。続行するとすぐに参加できます。","This is a {type} group. Continue to send a request to the group admins.":"これは{type}グループです。続行すると、グループ管理者にリクエストを送信します。","Explore group":"グループを見る","Join group":"グループに参加","Request to join group":"グループへの参加をリクエスト","You can watch this lecture now.":"この講義を今すぐ視聴できます。","Could not enroll":"登録できませんでした","Want to view this lecture?":"この講義を視聴しますか？","Your enrollment request is waiting for approval. You'll be able to watch this lecture after an admin accepts it.":"登録リクエストは承認待ちです。管理者が承認すると、この講義を視聴できるようになります。","Enroll in {course} to watch this lecture and the rest of the course.":"この講義とコースの残りを視聴するには、{course} に登録してください。","Back to course":"コースに戻る","Enroll to view lecture":"登録して講義を視聴","Choose a membership plan that includes {course}.":"{course} を含むメンバーシッププランを選んでください。",Subscribed:"加入済み","Payment successful":"お支払いが完了しました","You can now request access to this course.":"このコースへのアクセスをリクエストできるようになりました。","Checkout failed":"決済に失敗しました","Buy group access":"グループアクセスを購入","No membership plans are linked to this group yet.":"このグループには、まだメンバーシッププランが紐づけられていません。","Membership plan":"メンバーシッププラン","Subscribe free":"無料で加入","{day} at {time}":"{day} {time}","All courses":"すべてのコース",Published:"公開済み",Drafts:"下書き","Default order":"既定の順序","Title A–Z":"タイトル順（A〜Z）","Shortest first":"短い順","Longest first":"長い順","Most lessons":"レッスン数が多い順",Draft:"下書き",Personal:"個人","Community member":"コミュニティメンバー","Your browser does not support video playback.":"お使いのブラウザは動画の再生に対応していません。","Audio resource":"音声リソース","Listen without leaving the Knowledge Hub":"Knowledge Hub から離れずに聴く","Your browser does not support audio playback.":"お使いのブラウザは音声の再生に対応していません。","Attached files":"添付ファイル",FILE:"ファイル",Hide:"非表示",View:"表示",Download:"ダウンロード","Resource media":"リソースのメディア",Audio:"音声",Attachments:"添付ファイル","About this resource":"このリソースについて","Saving your resource…":"リソースを保存しています…","Finishing the upload…":"アップロードを完了しています…","Uploading 1 file · {percent}%":"1 ファイルをアップロード中 · {percent}%","Uploading {count} files · {percent}%":"{count} ファイルをアップロード中 · {percent}%","Remove {name}":"{name} を削除","Description cannot exceed {max} characters":"説明は {max} 文字以内で入力してください","Your title":"タイトルを入力","Add a cover image before publishing":"公開する前にカバー画像を追加してください","Resource updated":"リソースを更新しました","Resource shared":"リソースを共有しました","Your changes are now live.":"変更が反映されました。","It is now available in the Knowledge Hub.":"Knowledge Hub で利用できるようになりました。","Upload cancelled":"アップロードをキャンセルしました","Nothing was saved. Your files are still in the form.":"何も保存されていません。ファイルはフォームに残っています。","Could not update resource":"リソースを更新できませんでした","Could not share resource":"リソースを共有できませんでした","Please try again.":"もう一度お試しください。","That file is not an image":"そのファイルは画像ではありません","Choose a PNG, JPG or WebP for the cover.":"カバーには PNG、JPG、WebP のいずれかを選んでください。","Couldn't use that cover":"そのカバーは使用できませんでした","Pick another one, or choose a picture of your own.":"別のものを選ぶか、ご自身の画像を選んでください。","Couldn't open the current cover":"現在のカバーを開けませんでした","Choose the image again to crop it.":"トリミングするには、画像をもう一度選んでください。","Video too large":"動画が大きすぎます","Videos can be up to {limit}.":"動画は最大 {limit} までです。","That file is not audio":"そのファイルは音声ではありません","Choose an MP3, M4A, WAV or other audio file.":"MP3、M4A、WAV などの音声ファイルを選んでください。","Audio too large":"音声が大きすぎます","Audio files can be up to {size} MB.":"音声ファイルは最大 {size} MB までです。","File too large":"ファイルが大きすぎます","{count} files too large":"{count} 個のファイルが大きすぎます",'"{name}" was not added. Files can be up to {limit}.':"「{name}」は追加されませんでした。ファイルは最大 {limit} までです。","{names} were not added. Files can be up to {size} MB ({videoLimit} for a video).":"{names} は追加されませんでした。ファイルは最大 {size} MB までです（動画は {videoLimit}）。","Up to 5 attachments":"添付は最大 5 件まで","Only the first {count} file was added.":"最初の {count} ファイルのみ追加されました。","Only the first {count} files were added.":"最初の {count} ファイルのみ追加されました。","Remove one to add another.":"別のファイルを追加するには、1 つ削除してください。","Edit resource":"リソースを編集","Share a resource":"リソースを共有","Update your resource. Saved changes will appear immediately.":"リソースを更新します。保存した変更はすぐに反映されます。","Add a cover and a description, then optionally a video, an audio file and files to download.":"カバーと説明を追加し、必要に応じて動画、音声ファイル、ダウンロード用ファイルも追加してください。",Details:"詳細","Cover image file":"カバー画像ファイル","Video file":"動画ファイル","Audio file":"音声ファイル","Attachment files":"添付ファイル","Cover image":"カバー画像","The picture on this resource's card in the library. It is not a download. After you pick a picture you choose which part to show, in the card's 16:9 shape, so nothing is cut off in the library. A large photo is resized before it is sent, so it uploads faster; the original on your device is not changed.":"ライブラリでこのリソースのカードに表示される画像です。ダウンロードはできません。画像を選んだ後、ライブラリで切り取られないよう、カードの 16:9 の形で表示する部分を選びます。大きな写真は送信前にリサイズされるため、アップロードが速くなります。お使いのデバイス上の元の画像は変更されません。","Cover preview":"カバーのプレビュー","Choose a cover image":"カバー画像を選択","PNG, JPG or WebP · you choose the part to show next":"PNG、JPG、WebP · 表示する部分は次に選びます","Replace cover":"カバーを置き換え","Remove cover":"カバーを削除","Without a cover, the card shows a plain one in the community's colour.":"カバーがない場合、カードにはコミュニティのカラーのシンプルなカバーが表示されます。","Current cover":"現在のカバー","Adjust crop":"トリミングを調整","No picture to hand? Use a ready-made cover":"画像がありませんか？用意されたカバーを使う","Cover subjects":"カバーのテーマ","All ({count})":"すべて ({count})","Earlier covers":"以前のカバー","Ready-made covers":"用意されたカバー","Use the {name} cover":"{name} のカバーを使う","More covers":"その他のカバー",Title:"タイトル","What will members learn?":"メンバーは何を学べますか？","Shorten the title to {max} characters or fewer.":"タイトルを {max} 文字以内に短くしてください。","Share context, key takeaways, and why this is useful…":"背景や重要なポイント、役立つ理由を共有しましょう…","Formatting counts toward the limit. Shorten the description to {max} characters or fewer.":"書式も文字数に含まれます。説明を {max} 文字以内に短くしてください。","Media to play":"再生するメディア","(optional)":"（任意）","Members watch or listen to these inside the resource.":"メンバーはリソース内でこれらを視聴・再生できます。","· one video, up to {limit}, or a link":"· 動画 1 つ（最大 {limit}）またはリンク","Current uploaded video":"現在アップロード済みの動画","Already uploaded":"アップロード済み","Upload video":"動画をアップロード","YouTube or Vimeo URL":"YouTube または Vimeo の URL","Enter a valid YouTube or Vimeo link.":"有効な YouTube または Vimeo のリンクを入力してください。","· one audio file":"· 音声ファイル 1 つ","Current audio file":"現在の音声ファイル","Upload audio":"音声をアップロード","Files to download":"ダウンロード用ファイル","PDFs, Word, Excel or any other file members can download · {count}/5":"メンバーがダウンロードできる PDF、Word、Excel などのファイル · {count}/5","Add files":"ファイルを追加","PDF preview":"PDF プレビュー","PDF attachment preview":"PDF 添付ファイルのプレビュー","This is how members will see your resource. Nothing is shared until you save.":"メンバーにはこのように表示されます。保存するまで何も共有されません。","This is how members will see your resource. Nothing is shared until you publish.":"メンバーにはこのように表示されます。公開するまで何も共有されません。","When opened":"開いたとき","In the library":"ライブラリ内","{done}/{total} done":"{done}/{total} 完了","Upload progress":"アップロードの進捗","Keep this window open until it finishes.":"完了するまで、このウィンドウを開いたままにしてください。","Cancel upload":"アップロードをキャンセル","Save changes":"変更を保存","Publish resource":"リソースを公開","Choose what shows on the cover":"カバーに表示する部分を選択","Knowledge Hub":"Knowledge Hub","You created this resource.":"あなたがこのリソースを作成しました。","Moderator actions":"モデレーター操作","This file can't be previewed. Use Download instead.":"このファイルはプレビューできません。代わりにダウンロードしてください。","Resource deleted":"リソースを削除しました","Could not delete resource":"リソースを削除できませんでした","This resource is no longer available":"このリソースは利用できなくなりました","Couldn't open that resource":"そのリソースを開けませんでした","It may have been deleted. Here is the rest of the library.":"削除された可能性があります。ライブラリの残りを表示しています。","Community library":"コミュニティライブラリ","Useful ideas, explainers and media shared by your community.":"コミュニティで共有された、役立つアイデア、解説、メディア。","Search title, description, or author…":"タイトル、説明、投稿者で検索…","Search Knowledge Hub resources":"Knowledge Hub のリソースを検索","All content types":"すべてのコンテンツタイプ","Any date":"すべての期間","Past 7 days":"過去 7 日間","Past 30 days":"過去 30 日間","Past 90 days":"過去 90 日間","Custom dates":"期間を指定","Sort resources":"リソースを並べ替え","Newest first":"新しい順","Most liked":"いいねが多い順","Could not load the Knowledge Hub":"Knowledge Hub を読み込めませんでした","Please check your connection and try again.":"接続を確認して、もう一度お試しください。","Build your community library":"コミュニティライブラリを作りましょう","Share the first useful guide, talk, or audio resource with everyone.":"最初の役立つガイド、講演、音声リソースをみんなと共有しましょう。","Share the first resource":"最初のリソースを共有","No resources found":"リソースが見つかりません","Try another search term or change the filters.":"別の検索語を試すか、フィルターを変更してください。","Showing {shown} of {total} resource":"{total} 件中 {shown} 件のリソースを表示","Showing {shown} of {total} resources":"{total} 件中 {shown} 件のリソースを表示","Delete this resource?":"このリソースを削除しますか？","“{title}” will be permanently removed from the Knowledge Hub. This action cannot be undone.":"「{title}」は Knowledge Hub から完全に削除されます。この操作は元に戻せません。","Delete resource":"リソースを削除","Remove your like":"いいねを取り消す","Like this resource":"このリソースにいいね","You like this. Click to remove your like.":"いいね済みです。クリックして取り消します。","Link copied":"リンクをコピーしました","It opens this resource in the Knowledge Hub.":"Knowledge Hub でこのリソースが開きます。","Couldn't copy link":"リンクをコピーできませんでした","Post in review":"投稿は審査中です","An admin will review it before it appears.":"管理者が確認してから表示されます。",Shared:"共有しました","Posted to {channel}":"{channel} に投稿しました","Couldn't share the resource":"リソースを共有できませんでした","Copy link":"リンクをコピー","Post to a channel":"チャンネルに投稿","Send in a message":"メッセージで送信","Posts “{title}” with a link that opens it in the Knowledge Hub.":"「{title}」を、Knowledge Hub で開くリンク付きで投稿します。","Select channel":"チャンネルを選択","Add a message to introduce this to your community (optional). Type @ to mention someone.":"コミュニティに紹介するメッセージを追加（任意）。@を入力するとメンバーをメンションできます。","Posting…":"投稿中…","Share it in a message. The link opens the resource in the Knowledge Hub.":"メッセージで共有します。リンクから Knowledge Hub のリソースが開きます。","{count} file":"{count} ファイル","{count} files":"{count} ファイル","Open {title} in the Knowledge Hub":"{title} を Knowledge Hub で開く","Like this course":"このコースにいいね","It opens this course's page.":"このコースのページが開きます。","Posts “{title}” as a card members can like and open. Enrolling works as it does on the course page.":"「{title}」を、メンバーがいいねして開けるカードとして投稿します。受講登録はコースページと同じように行えます。","Couldn't share the course":"コースを共有できませんでした","Share it in a message. The link opens the course's page.":"メッセージで共有します。リンクを開くとコースのページが表示されます。","Open the course {title}":"コース {title} を開く","Paid plan":"有料プラン","Unlock {feature}":"{feature}を利用する","Your current plan doesn't include it. Choose a plan to start using it.":"現在のプランには含まれていません。プランを選ぶと利用を開始できます。","Included in every paid plan, from {price}.":"すべての有料プランに含まれます（{price}から）。","Included in every paid plan.":"すべての有料プランに含まれます。","See plans":"プランを見る","Maybe later":"あとで","Reach your members in their inbox with campaigns, newsletters, sequences, funnels and forms.":"キャンペーン、ニュースレター、シーケンス、ファネル、フォームでメンバーの受信箱に届けましょう。","Send campaigns and newsletters to your audience":"オーディエンスにキャンペーンやニュースレターを配信","Automated sequences, funnels and sign-up forms":"自動シーケンス、ファネル、登録フォーム","Audience management and delivery analytics":"オーディエンス管理と配信分析","Automate your community: act when members join, post or reach a milestone, without writing code.":"コミュニティを自動化：メンバーの参加、投稿、マイルストーン達成時にコード不要でアクションを実行。","Automations triggered by joins, posts, streaks and more":"参加、投稿、連続記録などをきっかけにした自動化","Multi-step actions: notify, tag, award points, send email":"複数ステップのアクション：通知、タグ付け、ポイント付与、メール送信","Ready-made templates to start in minutes":"数分で始められるテンプレート","Member Analytics":"メンバー分析","See how each member uses your community: time spent, sessions and the pages they visit.":"各メンバーのコミュニティの使い方を確認：滞在時間、セッション、閲覧したページ。","Time spent and sessions for every member":"すべてのメンバーの滞在時間とセッション","Page journeys: where members go and for how long":"ページの遷移：メンバーがどこへ行き、どれだけ滞在したか","Look up any member in Insights":"インサイトで任意のメンバーを検索","Content category":"コンテンツカテゴリ","Content categories":"コンテンツカテゴリ","All categories":"すべてのカテゴリ","No category":"カテゴリなし","Add “{name}”":"「{name}」を追加","Filter by content category":"コンテンツカテゴリで絞り込む","Search categories":"カテゴリを検索","Search or type a new category":"検索するか新しいカテゴリを入力","Loading…":"読み込み中…","Couldn't load categories. Try again.":"カテゴリを読み込めませんでした。もう一度お試しください。","No categories match.":"一致するカテゴリがありません。",Author:"作成者",Authors:"作成者","All authors":"すべての作成者","Search authors":"作成者を検索","Filter by author":"作成者で絞り込む","Couldn't load authors. Try again.":"作成者を読み込めませんでした。もう一度お試しください。","No authors match.":"一致する作成者がいません。","No resources have been shared yet.":"まだリソースは共有されていません。","No courses have been made yet.":"まだコースは作成されていません。","Shows only the resources one member has shared. The list has everyone who has shared a resource here, with how many each has shared; type a name to find someone. You can combine it with the other filters and the search box.":"1人のメンバーが共有したリソースだけを表示します。一覧には、ここでリソースを共有したすべての人と、その件数が表示されます。名前を入力すると探せます。他のフィルターや検索と組み合わせて使えます。","No resource has a category yet.":"カテゴリが設定されたリソースはまだありません。","Show more":"さらに表示","What kind of resource this is, such as a research paper or an opinion piece. Members can filter the Knowledge Hub by it. Pick one, or type your own and choose Add.":"研究論文やオピニオン記事など、リソースの種類です。メンバーはこれでKnowledge Hubを絞り込めます。1つ選ぶか、独自のカテゴリを入力して「追加」を選んでください。",Filters:"フィルター","{count} applied":"{count}件適用中","Content type":"コンテンツの種類","Date shared":"共有日","Remove filter {name}":"フィルター「{name}」を解除","Research Paper":"研究論文",Article:"記事","Lecture/Talk":"講演","Opinion Piece":"オピニオン記事",General:"一般",Football:"サッカー",Education:"教育",Physiotherapy:"理学療法",Coaching:"コーチング","Sports Science":"スポーツ科学","Strength & Conditioning":"ストレングス＆コンディショニング",Recovery:"リカバリー",Nutrition:"栄養",Medicine:"医学",Health:"健康",Cars:"自動車",Entertainment:"エンターテインメント",Programming:"プログラミング",Technology:"テクノロジー",Business:"ビジネス",Science:"科学",Engineering:"エンジニアリング",Sports:"スポーツ",Arts:"アート",Travel:"旅行",Food:"食べ物",Resources:"リソース","Could not load this course.":"このコースを読み込めませんでした。","Back to course overview":"コース概要に戻る","Preview as learner":"受講者として表示","Close table of contents":"目次を閉じる","Join {group} to continue learning.":"学習を続けるには {group} に参加してください。","the course's current group":"コースの現在のグループ","Enroll in this course to watch the lecture.":"講義を視聴するには、このコースに登録してください。","Next lesson":"次のレッスン","Table of contents":"目次","Add a section to start building content.":"セクションを追加して、コンテンツを作り始めましょう。","No lessons available yet.":"利用できるレッスンはまだありません。","Lesson completed":"レッスンを完了しました","Marked incomplete":"未完了にしました","Could not update progress":"進捗を更新できませんでした","Mark incomplete":"未完了にする","Mark complete":"完了にする","You need to join this course before you can view its lessons.":"レッスンを表示するには、先にこのコースに参加する必要があります。","Go to course overview":"コース概要へ","No lesson selected":"レッスンが選択されていません","Pick a lesson from the table of contents.":"目次からレッスンを選んでください。","Lesson {current} of {total}":"レッスン {current}/{total}","This lesson has no written content yet.":"このレッスンには、まだテキストの内容がありません。",Block:"ブロック","In this lesson":"このレッスンの内容","Lesson content":"レッスンの内容",Completed:"完了","Completed {date}":"{date} に完了","Open PDF":"PDF を開く","Quick check":"クイックチェック",Assignment:"課題","Submit your work in the lesson discussion below.":"下のレッスンのディスカッションで課題を提出してください。",Quiz:"クイズ","Could not save quiz.":"クイズを保存できませんでした。","Could not submit quiz":"クイズを送信できませんでした","Select all answers that apply.":"当てはまるものをすべて選んでください。","This is an open-ended check — continue when you are ready.":"これは自由回答のチェックです。準備ができたら続けてください。","Submit quiz":"クイズを送信","You {status} the quiz.":"クイズに{status}。",passed:"合格しました","didn't pass":"合格しませんでした","Great job!":"よくできました！","Review the answers below, then try again.":"下の回答を確認して、もう一度挑戦してください。","Retake quiz":"クイズをやり直す",Score:"スコア","Correct answers":"正解数",Correct:"正解",Incorrect:"不正解",You:"あなた","Could not post your comment":"コメントを投稿できませんでした","Could not update the comment":"コメントを更新できませんでした","Could not delete the comment":"コメントを削除できませんでした",Discussion:"ディスカッション","Loading comments…":"コメントを読み込み中…","No comments yet — start the discussion.":"コメントはまだありません。ディスカッションを始めましょう。","Add to the discussion…":"ディスカッションに参加…","Redirecting now…":"移動しています…","Redirecting in {count} second":"{count} 秒後に移動します","Redirecting in {count} seconds":"{count} 秒後に移動します","Lesson complete":"レッスン完了","Up next":"次はこちら",Stay:"とどまる",Continue:"続ける","Quiz result":"クイズ結果","Question-by-question review of this learner's quiz attempt.":"この受講者のクイズ受験を、問題ごとに確認できます。","Attempts: {count}":"受験回数: {count}",Submitted:"提出済み","You received {points} karma point.":"{points} カルマポイントを獲得しました。","You received {points} karma points.":"{points} カルマポイントを獲得しました。","Congratulations!":"おめでとうございます！","You've successfully completed {course}.":"{course} を修了しました。","Keep reviewing":"引き続き復習する",Text:"テキスト","Send feedback":"フィードバックを送信","You can attach up to {max} screenshots":"スクリーンショットは最大 {max} 枚まで添付できます","Only the first {count} screenshot was added":"最初の {count} 枚のスクリーンショットのみ追加されました","Only the first {count} screenshots were added":"最初の {count} 枚のスクリーンショットのみ追加されました","Unsupported image type":"対応していない画像形式です","Larger than 10 MB":"10 MB を超えています","Upload failed":"アップロードに失敗しました","Add a short title.":"短いタイトルを追加してください","Please add a bit more detail ({min}+ characters).":"もう少し詳しく入力してください（{min} 文字以上）","Bug report sent":"不具合報告を送信しました","Idea sent":"アイデアを送信しました","Thanks! The SpatialChat Communities team will take a look.":"ありがとうございます！SpatialChat Communities チームが確認します。","Couldn't send your feedback":"フィードバックを送信できませんでした","Report a problem or suggest an improvement to the SpatialChat Communities team.":"問題の報告や改善の提案を SpatialChat Communities チームにお送りください。","Feedback type":"フィードバックの種類","Report a bug":"不具合を報告","Suggest an idea":"アイデアを提案","e.g. Verify code shows “Validation error!”":"例: 確認コードに「Validation error!」と表示される","e.g. Let me schedule posts":"例: 投稿を予約できるようにしてほしい","What happened?":"何が起きましたか？","What would you like?":"どのような機能がほしいですか？","What did you do, what did you expect, and what happened instead?":"何をして、何を期待し、代わりに何が起きましたか？","What problem are you trying to solve? How would this help you?":"どのような問題を解決したいですか？どのように役立ちますか？",Screenshots:"スクリーンショット","(optional, up to {max})":"（任意、最大 {max} 枚）",Uploading:"アップロード中","Add screenshot":"スクリーンショットを追加","or drop / paste (Ctrl/⌘+V) an image":"または画像をドロップ／貼り付け（Ctrl/⌘+V）","Screenshots that failed to upload won't be sent. Remove them or try again.":"アップロードに失敗したスクリーンショットは送信されません。削除するか、もう一度お試しください。","Include technical details":"技術情報を含める","(recommended)":"（推奨）","Page, browser, and no recent errors. Passwords, tokens and emails are removed.":"ページ、ブラウザ、最近のエラーなし。パスワード、トークン、メールアドレスは除外されます。","Page, browser, and {count} recent error. Passwords, tokens and emails are removed.":"ページ、ブラウザ、最近のエラー {count} 件。パスワード、トークン、メールアドレスは除外されます。","Page, browser, and {count} recent errors. Passwords, tokens and emails are removed.":"ページ、ブラウザ、最近のエラー {count} 件。パスワード、トークン、メールアドレスは除外されます。","Page: {path}":"ページ: {path}","Browser: {browser}":"ブラウザ: {browser}","Screen: {width}x{height} · Build: {version}":"画面: {width}x{height} · ビルド: {version}","No errors captured in this session.":"このセッションで記録されたエラーはありません。","The SpatialChat Communities team may contact me about this":"この件について SpatialChat Communities チームから連絡を受けても構いません","Uploading…":"アップロード中…","Send report":"報告を送信","Send idea":"アイデアを送信","{points} earned":"{points} 獲得","{points} to spend":"{points} 利用可能","Profile picture updated":"プロフィール画像を更新しました","Couldn't update picture":"画像を更新できませんでした","Cover photo updated":"カバー写真を更新しました","Couldn't update cover":"カバーを更新できませんでした","Link copied!":"リンクをコピーしました！","Profile link copied to clipboard.":"プロフィールのリンクをクリップボードにコピーしました。",Cover:"カバー","Joined {date}":"{date} に参加","Badges & achievements":"バッジと実績","No badges earned yet — stay active to unlock your first one.":"獲得したバッジはまだありません。活動を続けて、最初のバッジを手に入れましょう。",Badge:"バッジ","You haven't posted yet.":"まだ投稿していません。","No activity yet.":"アクティビティはまだありません。","Adjust cover photo":"カバー写真を調整","Add a bio and interests from":"自己紹介や興味のある分野を","to fill out your About section.":"から追加して、「概要」セクションを充実させましょう。",Bio:"自己紹介",Interests:"興味・関心","No achievement badges are configured for this community yet.":"このコミュニティには、まだ実績バッジが設定されていません。","Earned {date}":"{date} に獲得","Profile updated":"プロフィールを更新しました","Your changes have been saved.":"変更を保存しました。","Couldn't save profile":"プロフィールを保存できませんでした",Username:"ユーザー名","Checking availability…":"利用可能か確認中…","Username is available":"このユーザー名は利用できます","Username is taken":"このユーザー名は既に使われています","3–64 chars: letters, numbers, _ or .":"3〜64文字: 英字、数字、_、.",Headline:"肩書き",Location:"場所","Social links":"ソーシャルリンク","Saving…":"保存中…","Couldn't update preference":"設定を更新できませんでした","Email notifications":"メール通知","Choose which activity on your content sends you an email.":"あなたのコンテンツへのどのアクティビティでメールを受け取るか選んでください。","Posts created":"作成した投稿","Comments made":"行ったコメント","Replies made":"行った返信","Likes given":"付けたいいね","Likes on your posts":"投稿へのいいね","Your posts commented":"投稿へのコメント","Your replies received":"受け取った返信","Followers gained":"増えたフォロワー","Live sessions":"ライブセッション","Admin-assigned":"管理者による付与",Other:"その他","How you earned your {points}":"{points} の獲得内訳","No points yet — post, comment and react to start earning.":"ポイントはまだありません。投稿、コメント、リアクションでポイントを貯めましょう。","Language updated":"言語を更新しました","Using the community's language":"コミュニティの言語を使用中","Only you see this change.":"この変更はあなたにのみ表示されます。","Couldn't change your language":"言語を変更できませんでした",Language:"言語","Menus, buttons and labels are shown in the language you pick here, for you only. Posts, comments and messages stay in the language they were written in. Other members keep the community's language unless they pick their own.":"メニュー、ボタン、ラベルは、ここで選んだ言語で表示されます（あなたにのみ適用）。投稿、コメント、メッセージは書かれた言語のままです。他のメンバーは、自分で選ばない限りコミュニティの言語で表示されます。","Choose the language you read this community in.":"このコミュニティを読む言語を選んでください。","My language":"自分の言語","Community default":"コミュニティの既定","Console error":"コンソールエラー","Console warning":"コンソール警告",Crash:"クラッシュ","Unhandled error":"未処理のエラー","Failed request":"失敗したリクエスト",About:"概要",Achievements:"実績",Website:"ウェブサイト",Silver:"シルバー",Gold:"ゴールド",Platinum:"プラチナ",Diamond:"ダイヤモンド",Elite:"エリート","Comments on my posts":"自分の投稿へのコメント","When someone comments on your post":"誰かがあなたの投稿にコメントしたとき","Replies to my comments":"自分のコメントへの返信","When someone replies to your comment":"誰かがあなたのコメントに返信したとき","Likes on my posts":"自分の投稿へのいいね","When someone likes your post":"誰かがあなたの投稿にいいねしたとき","Reactions to my comments":"自分のコメントへのリアクション","When someone reacts to your comment":"誰かがあなたのコメントにリアクションしたとき","Reactions to my replies":"自分の返信へのリアクション","When someone reacts to your reply":"誰かがあなたの返信にリアクションしたとき","Direct messages":"ダイレクトメッセージ","When you receive a direct message":"ダイレクトメッセージを受信したとき",Mentions:"メンション","When someone @mentions you":"誰かがあなたを @メンションしたとき","Load more {label}":"さらに{label}を読み込む","Loading more {label}…":"{label}をさらに読み込み中…",courses:"コース",resources:"リソース",items:"項目","About {label}":"{label}について","Couldn't like this course":"このコースに「いいね」できませんでした","Couldn't like this resource":"このリソースに「いいね」できませんでした","Couldn't remove your like":"「いいね」を取り消せませんでした","Notify members":"メンバーに通知","Sends everyone in the community a notification about this resource, in the app and as a push notification on their phone or browser. Members who turned off notifications for this community don't get it.":"このリソースについて、コミュニティの全員にアプリ内とスマートフォンやブラウザへのプッシュで通知します。このコミュニティの通知をオフにしているメンバーには届きません。","It is now available in the Knowledge Hub, and members are being notified.":"Knowledge Hub で公開され、メンバーに通知しています。","How posts are ordered":"投稿の並び順","Recent: newest first. Top posts: the most likes, of all time; comments don't change the order. Trending: the most likes and comments together, within the period you pick. Following: posts by people you follow.":"新着：新しい順。人気の投稿：これまでの「いいね」が多い順（コメントは順位に影響しません）。トレンド：選んだ期間の「いいね」とコメントの合計が多い順。フォロー中：フォローしている人の投稿。","Save this resource":"このリソースを保存","Save this course":"このコースを保存","Remove from saved":"保存から削除","Saved. Click to remove it from your saved list.":"保存済みです。クリックすると保存リストから削除されます。","Find it any time under Saved in the Knowledge Hub.":"ナレッジハブの「保存済み」からいつでも見られます。","Find it any time under Saved on the Courses page.":"コースページの「保存済み」からいつでも見られます。","Couldn't save this resource":"このリソースを保存できませんでした","Couldn't save this course":"このコースを保存できませんでした","Couldn't remove it from saved":"保存から削除できませんでした","All resources":"すべてのリソース",Show:"表示","Press the bookmark on anything to save it here for later. Only you can see what you saved.":"ブックマークを押すと、あとで見るためにここに保存できます。保存した内容はあなただけが見られます。","Date range":"期間",Today:"今日","Last 7 days":"過去7日間","Last 4 weeks":"過去4週間","Last 6 months":"過去6か月","Last 12 months":"過去12か月","Month to date":"今月","Quarter to date":"今四半期","Year to date":"今年","All time":"全期間",Start:"開始",End:"終了",Clear:"クリア",Apply:"適用","Couldn't download this file":"このファイルをダウンロードできませんでした","A new category is saved with capital letters, so “fancy dress” becomes “Fancy Dress”, and one that already exists is reused rather than added twice.":"新しいカテゴリは単語の先頭を大文字にして保存されます（「fancy dress」は「Fancy Dress」になります）。すでにあるカテゴリは重複して追加されず、そのまま使われます。","Job title":"役職","Your role, such as Head of Sports Science or Team Physiotherapist. It shows under your name in the member directory and on your profile, so members know who to contact.":"スポーツサイエンス責任者やチームの理学療法士など、あなたの役割です。メンバーディレクトリとプロフィールで名前の下に表示され、誰に連絡すればよいかが分かります。","e.g. Head of Sports Science":"例：スポーツサイエンス責任者","Type where you are based, or use your current location: your browser asks first, and only the town and country are filled in. Your exact position is never saved. Check it, then save your profile.":"拠点を入力するか、現在地を使用してください。ブラウザが最初に確認し、市区町村と国だけが入力されます。正確な位置が保存されることはありません。確認してからプロフィールを保存してください。","e.g. Stockholm, Sweden":"例：ストックホルム、スウェーデン","Finding you…":"現在地を取得中…","Use my location":"現在地を使用","Please enter your location, or use your current location.":"所在地を入力するか、現在地を使用してください。","Fields marked * are required.":"* の付いた項目は必須です。","Your details in {community}":"{community}でのあなたの情報","Your community details":"コミュニティでのあなたの情報","Community details":"コミュニティ情報","Questions this community's admins ask every member. Your answers show in its member directory, except ones marked “Only admins see this”.":"このコミュニティの管理者がすべてのメンバーに尋ねる質問です。回答はメンバー名簿に表示されます（「管理者のみ表示」の項目を除く）。","Couldn't save your profile":"プロフィールを保存できませんでした","Check the highlighted detail, then save again.":"強調表示された項目を確認して、もう一度保存してください。","Location filled in":"所在地を入力しました","Check it, then save your profile.":"確認してからプロフィールを保存してください。","Couldn't use your location":"現在地を使用できませんでした","Please type your location.":"所在地を入力してください。","Your browser can't share your location here. Please type it.":"このブラウザではここで現在地を共有できません。入力してください。","Location access is blocked. Allow it for this site in your browser settings, or type your location.":"位置情報へのアクセスがブロックされています。ブラウザの設定でこのサイトに許可するか、所在地を入力してください。","Finding your location took too long. Please try again, or type your location.":"現在地の取得に時間がかかりすぎました。もう一度試すか、所在地を入力してください。","Your location isn't available right now. Please type it.":"現在地を今は取得できません。入力してください。","Location lookup isn't available right now. Please type your location.":"所在地の検索は現在利用できません。所在地を入力してください。"},Dnn={"SpatialChat Communities Keyword":"Dutch",Home:"Thuis","Explore Groups":"Ontdek groepen",Events:"Evenementen",Groups:"Groepen",Links:"Koppelingen","Direct Message":"Direct bericht","Powered by":"Aangedreven door","No groups here, please use + to create a new one, or join one see them here.":"Er zijn hier geen groepen. Gebruik + om een ​​nieuwe aan te maken, of sluit je aan bij een groep. Bekijk ze hier.","Please join a group to see them here":"Sluit je aan bij een groep om ze hier te bekijken","Section can only be reordered within the group!":"Sectie kan alleen binnen de groep worden herschikt!","Group Page":"Groepspagina","Invite Members":"Nodig leden uit",Join:"Meedoen",Joined:"Aangesloten","Create new section":"Maak een nieuwe sectie","Group Setting drop down":"vervolgkeuzelijst Groepsinstelling",Share:"Deel","Edit group":"Groep bewerken","Delete group":"Groep verwijderen",Leave:"Vertrekken","Are you sure you want to delete the group?":"Weet u zeker dat u de groep wilt verwijderen?",Cancel:"Annuleren","Yes, Go Ahead":"Ja, ga je gang","Share via link":"Deel via link",Copy:"Kopiëren",Copied:"Gekopieerd","Share on social media":"Deel op sociale media","Add Section":"Sectie toevoegen","Section Header":"Sectiekop",Live:"Live","Create post":"Bericht maken","Notificaiton Bell":"Meldingsbel","All posts":"Alle berichten","Admin posts only":"Alleen beheerdersposts",None:"Geen","Section Setting drop down":"vervolgkeuzelijst Sectie-instelling","Edit Section":"Sectie bewerken","Embed Section":"Sectie insluiten","Delete Section":"Sectie verwijderen","Are you sure you want to delete the section?":"Weet u zeker dat u de sectie wilt verwijderen?","Section deleted!":"Sectie verwijderd!","Create Group Pop up / Update":"Pop-up/update voor groep maken","Create group":"Groep aanmaken","Basic Detail":"Basisdetail",Settings:"Instellingen","Size 16:9 or 1600 by 900":"Grootte 16:9 of 1600 bij 900","Group name":"Groepsnaam","Enter group name":"Groepsnaam invoeren","Suggestions: Spaces, Channels, Groups, Blog, Knowledgebase, etc":"Suggesties: ruimtes, kanalen, groepen, blog, kennisbank, enz","Group Description":"Groepsbeschrijving","Enter description here":"Vul hier de beschrijving in","Group Type":"Groepstype",Open:"Open","Visible to all & anyone can join":"Zichtbaar voor iedereen en iedereen kan meedoen",Closed:"Gesloten","User will have to request to join the group":"De gebruiker moet een verzoek indienen om lid te worden van de groep",Paid:"Betaald","Group Price":"Groepsprijs","Currency (Default: INR)":"Valuta (standaard: INR)","User will have to pay to join the group":"De gebruiker moet betalen om lid te worden van de groep","Make this a private group":"Maak er een besloten groep van","Private group will only be visible to members who are part of it. Admin can add members manually from member list":"De privégroep is alleen zichtbaar voor leden die er deel van uitmaken. De beheerder kan leden handmatig toevoegen vanuit de ledenlijst","Upload from device":"Uploaden vanaf apparaat","Search image":"Zoek afbeelding","Valid group name required!":"Geldige groepsnaam vereist!","Update Group":"Groep bijwerken","SEO Settings":"SEO-instellingen","Custom URL":"Aangepaste URL","Meta Title":"Metatitel","Maximum length of 255 characters allowed":"Maximale lengte van 255 tekens toegestaan","Meta Description":"Metabeschrijving","Open Graph Detail":"Grafiekdetail openen","Open Graph Title":"Titel van grafiek openen","Open Graph Description":"Open grafiekbeschrijving","Open Graph Image":"Open grafiekafbeelding","Recommended dimensions: 1200px by 630px with a 1.91:1 aspect ratio.":"Aanbevolen afmetingen: 1200 px bij 630 px met een beeldverhouding van 1,91:1.","If no URL is used, it will automatically picked your group thumbnail.":"Als er geen URL wordt gebruikt, wordt automatisch uw groepsminiatuur gekozen.","Create Section Pop up / Update":"Sectie pop-up maken/bijwerken","Create Section":"Sectie maken","Section Name":"Sectienaam","Suggestions: General, Introductions, Community Guidelines":"Suggesties: Algemeen, Introducties, Communityrichtlijnen","Section Type":"Sectietype","Post Type":"Berichttype","Group Chat":"Groepschat","Who can post in this section?":"Wie kan in deze sectie berichten plaatsen?","Only Admin":"Alleen beheerder","Any user":"Elke gebruiker","Sorting order for section":"Sorteervolgorde voor sectie","Latest first":"Laatste eerst","Oldest post first":"Oudste bericht eerst","Section Appearance":"Sectie uiterlijk","List View":"Lijstweergave","Grid View":"Rasterweergave","Make this closed section":"Maak dit gesloten gedeelte","Members will have to request access to see section content":"Leden moeten toegang vragen om de sectie-inhoud te bekijken","Make this a private section":"Maak hiervan een privégedeelte","Disables requests (Make sure closed section is selected as well).":"Schakelt verzoeken uit (zorg ervoor dat de gesloten sectie ook is geselecteerd).","Post Editor":"Berichteditor","Create new post in":"Nieuw bericht aanmaken in","Add Cover Picture":"Omslagafbeelding toevoegen","Heading (Optional)":"Kop (optioneel)","Write here..":"Schrijf hier..",Picture:"Afbeelding",Video:"Video",Attachment:"Bijlage",Poll:"Opiniepeiling","Embed Code":"Code insluiten",Tags:"Labels","Toggle to question":"Schakel naar vraag","Poll expire time":"Vervaltijd van de peiling","Poll question":"Poll vraag","Enter Question":"Vraag invoeren",Question:"Vraag",Option:"Optie",Options:"Opties","Add Option":"Optie toevoegen","Poll Expiry time":"Vervaltijd van de peiling","12 Hours":"12 uur","1 Day":"1 dag","2 Days":"2 dagen","1 Week":"1 week","2 Weeks":"2 weken","Always Open":"Altijd geopend","Write embeddable code":"Schrijf insluitbare code","Click here to add embed code.":"Klik hier om insluitcode toe te voegen.","Paste your embed code here!":"Plak hier uw insluitcode!","Post Settings":"Berichtinstellingen","Update Post":"Bericht bijwerken",Update:"Update","Start meeting / Video call / Live":"Vergadering starten / Videogesprek / Live","Meeting Name":"Naam van de vergadering","Suggestion: Group discussion etc":"Suggestie: Groepsdiscussie etc",Description:"Beschrijving","Enter description here (optional)":"Vul hier de omschrijving in (optioneel)","When do you want to start the session":"Wanneer wil je de sessie starten?","Right now":"Op dit moment","Schedule for later":"Plan voor later","Group video call":"Groepsvideogesprek",Webinar:"Webinar","Go Live":"Ga live","Go live":"Ga live","Info on the Post":"Info over het bericht","Post comment":"Reactie plaatsen",Comment:"Opmerking",Comments:"Opmerkingen",Reply:"Antwoord",Replies:"Antwoorden","Share via URL":"Deel via URL","Reshare in other sections":"Deel opnieuw in andere secties","Post Card Drop Down":"Ansichtkaart drop-down",Bookmark:"Bladwijzer","Pin post":"Bericht vastzetten",Edit:"Bewerking","Embed Post":"Bericht insluiten",Delete:"Verwijderen","Remove Pin":"Pin verwijderen","Remove Bookmark":"Bladwijzer verwijderen","Just copy paste this code wherever you want it to be embedded":"Kopieer en plak deze code waar u deze wilt insluiten",Height:"Hoogte",Preview:"Voorbeeld","Copied to clipboard":"Gekopieerd naar klembord","Select Widgets":"Selecteer Widgets","Add widgets to":"Widgets toevoegen aan","You can change their order by dragging & dropping the widgets over each other":"Je kunt de volgorde wijzigen door de widgets over elkaar te slepen en neer te zetten","Please note: Widget wont be displayed if there is no data available,":"Let op: Widget wordt niet weergegeven als er geen gegevens beschikbaar zijn,","Group Members":"Groepsleden","Group Leaderboard":"Groepsklassement","Community Leaderboard":"Gemeenschapsklassement","Trending Posts":"Populaire berichten","Group Events":"Groepsevenementen","Add Custom":"Aangepast toevoegen","Save Widgets":"Widgets opslaan","Visible to user":"Zichtbaar voor gebruiker","Visible to admin":"Zichtbaar voor beheerder","Add widget to":"Widget toevoegen aan","Upload cover picture":"Omslagafbeelding uploaden","1:1 aspect ration (recommended)":"Beeldverhouding 1:1 (aanbevolen)","Card Title":"Kaarttitel","Enter widget name":"Voer de widgetnaam in","Small Description (try to keep it under 50 words)":"Kleine beschrijving (probeer het onder de 50 woorden te houden)","Enter description":"Voer een beschrijving in","Button Title":"Knoptitel","Enter button name":"Voer de knopnaam in","Siggestion: Know more, Join, Apply, etc":"Siggestie: Meer weten, meedoen, solliciteren, etc","URL link":"URL-link","Create custom widget":"Maak een aangepaste widget","Custom widget created successfully":"Aangepaste widget is succesvol aangemaakt",Widgets:"Widgets",Members:"Leden","See All":"Bekijk alles","Communtiy Top Contributors":"Topbijdragers uit de gemeenschap","Community members":"Leden van de gemeenschap","Group Top Contributors":"Groep Topbijdragers","Upcoming Events":"Aankomende evenementen","Home Page Banner":"Banner op de startpagina","Edit Banner":"Banner bewerken","Home page Edit Banner Pop up":"Homepagina Banner bewerken Pop-up","Update Banner":"Banner bijwerken",Search:"Zoekopdracht","Upload Image":"Afbeelding uploaden",Remove:"Verwijderen","Banner image (please use 16:6 ratio or 1600px by 600px image for the best view)":"Bannerafbeelding (gebruik een verhouding van 16:6 of een afbeelding van 1600 bij 600 pixels voor de beste weergave)","Banner Title":"Bannertitel","Enter here":"Vul hier in","Suggestion: Welcome to my community etc":"Suggestie: Welkom bij mijn community etc","Banner Description":"Bannerbeschrijving","Enter banner description":"Voer de bannerbeschrijving in","Save Banner Info":"Bannerinformatie opslaan","Home Page Feed":"Startpaginafeed",Recent:"Recent","Top posts":"Topberichten",Trending:"Populair","Home Feed Groups":"Homefeedgroepen","":"#VALUE!","My profile":"Mijn profiel",Logout:"Uitloggen",Notification:"Kennisgeving",Notifications:"Meldingen","Mark all viewed":"Markeer alles bekeken","has created a post":"heeft een bericht aangemaakt","wants to join":"wil meedoen","has commented on your post":"heeft gereageerd op uw bericht","has replied to your comment":"heeft op uw reactie gereageerd","Search for tags":"Zoek naar tags","All groups":"Alle groepen","Search result":"Zoekresultaat","No post found for selected hashtag":"Geen bericht gevonden voor geselecteerde hashtag","Start a conversation":"Begin een gesprek","Search by name":"Zoek op naam",Upcoming:"Aankomend",UPCOMING:"AANKOMEND",Past:"Verleden",PAST:"VERLEDEN","No upcoming events":"Geen aankomende evenementen","Create event popup":"Maak een evenementpop-up","Event details":"Evenementdetails","16:9 aspect ratio":"Beeldverhouding 16:9","Event name":"Naam evenement","Enter event name":"Voer de naam van het evenement in","Host Name":"Hostnaam","You will be made host if none selected":"Als er geen is geselecteerd, wordt u gastheer gemaakt","Write here...":"Schrijf hier...","No. of registration for the event":"Registratienummer voor het evenement",Unlimited:"Onbeperkt","When & where":"Wanneer en waar",From:"Van","Start date":"Startdatum",time:"tijd",To:"Naar","End date":"Einddatum","Current time zone:":"Huidige tijdzone:","Can be updated from the communtiy setting":"Kan worden bijgewerkt vanuit de community-instelling","Online event":"Online evenement","Add meeting link":"Vergaderlink toevoegen","Meeting link will be generated once event is created":"De vergaderlink wordt gegenereerd zodra het evenement is gemaakt",Venue:"Locatie","Enter address":"Voer adres in",Create:"Creëren",Invite:"Uitnodiging","Share event via link":"Deel evenement via link",Copy__1:"Kopiëren","Select section to post this event":"Selecteer een sectie om dit evenement te posten","Once posted, members of that group or section will recieve an notification":"Zodra ze zijn gepost, ontvangen leden van die groep of sectie een melding",Post:"Na",RSVP:"Reageer","Book Event":"Boek evenement","Yes, I'll attend":"Ja, ik zal aanwezig zijn","May be":"Misschien","No, I won't attend":"Nee, ik zal niet aanwezig zijn","Date & Time":"Datum en tijd",Host:"Gastheer","Online meeting":"Online bijeenkomst","Meeting link will be visible once registered for the event":"De vergaderlink is zichtbaar zodra u zich voor het evenement heeft geregistreerd","User Management":"Gebruikersbeheer","Go bac to community":"Ga terug naar de gemeenschap","Manage Members":"Leden beheren",Member:"Lid",Invited:"Uitgenodigd","Search for member":"Zoek naar lid","Add to group":"Toevoegen aan groep","Send Direct Message":"Direct bericht verzenden","Change role":"Verander de rol","Kick from community":"Schop uit de gemeenschap","Super Admin":"Super beheerder","Super admin will have full access to the communtiy settings":"De hoofdbeheerder heeft volledige toegang tot de community-instellingen","Group Admin":"Groepsbeheerder","Admin of the selected group can edit the group information and create, edt or delete section under selected group":"De beheerder van de geselecteerde groep kan de groepsinformatie bewerken en een sectie onder de geselecteerde groep maken, bewerken of verwijderen","Group Moderator":"Groepsmoderator","Group moderator can create or delete post, comment, reply & messages in the selected group.":"Groepsmoderator kan berichten, opmerkingen, antwoorden en berichten in de geselecteerde groep maken of verwijderen.",User:"Gebruiker",Save:"Redden","User role updated successfully":"Gebruikersrol is succesvol bijgewerkt",Leaderboard:"Leiderbord","Click on the column header for sorting":"Klik op de kolomkop om te sorteren",Rank:"Rang","Karma Points":"Karma-punten","Custom Points":"Aangepaste punten",Follow:"Volgen",Upvotes:"Stemmen",Posts:"Berichten","Add custom points":"Voeg aangepaste punten toe","Subtract custom points":"Aangepaste punten aftrekken","Enter no. of points":"Voer nr. in. van punten","Add points":"Voeg punten toe","Invite members to":"Nodig leden uit","Invite via link":"Uitnodigen via link","Invite via email":"Uitnodigen via e-mail","Add more":"Voeg meer toe","Upload a CSV":"Upload een CSV","Please upload a comma-seprated CSV file, with header as name, email.":"Upload een door komma's gescheiden CSV-bestand, met header als naam en e-mailadres.","Here is a template CSV file":"Hier is een sjabloon-CSV-bestand","Upload File":"Bestand uploaden","Send Invite":"Uitnodiging verzenden","Mail Template":"E-mailsjabloon","Send Test Mail":"Testmail verzenden",Hey:"Hoi","A has invite you to join the B":"A heeft je uitgenodigd om lid te worden van B","Switch to rich text editor":"Schakel over naar de RTF-editor","Add Custom Message":"Aangepast bericht toevoegen","Enter message here":"Voer hier een bericht in","Send Bulk Mail":"Bulkpost verzenden","Send Mail":"Stuur e-mail","Send bulk mail to all community members or select group members":"Stuur bulkmail naar alle communityleden of selecteer groepsleden",Date:"Datum",Subject:"Onderwerp",Recipients:"Ontvangers","1000 bulk emails remaining for this month. Resets on <date>":"Er zijn nog 1000 bulk-e-mails over voor deze maand. Wordt gereset op <datum>",Everyone:"Iedereen","Enter mail subject":"Voer het e-mailonderwerp in","Write message":"Schrijf bericht",Cancel__1:"Annuleren",Send:"Versturen",__1:"#VALUE!",Activity:"Activiteit",Bookmarks:"Bladwijzers","Edit profile":"Profiel bewerken",Unsubscribe:"Uitschrijven","Settings (Account)":"Instellingen (account)",Profile:"Profiel","Set Profile Picture":"Profielfoto instellen","Your name":"Jouw naam","User ID":"Gebruikers-ID","Short bio":"Korte biografie","Link your social account":"Koppel uw sociale account","This will be displayed on your profile":"Dit wordt weergegeven op uw profiel","Add social handle":"Voeg sociaal handvat toe",Verification:"Verificatie","Account Verification":"Accountverificatie",Email:"E-mail","Enter email":"Voer e-mailadres in",Verified:"Geverifieerd",Unverified:"Niet geverifieerd",Change:"Wijziging",Unlink:"Ontkoppelen",Mobile:"Mobiel","enter mobile no.":"mobiel nr. invoeren","Request OTP":"OTP aanvragen","Manage your personal account notification preferences":"Beheer uw persoonlijke voorkeuren voor accountmeldingen",Prefrences:"Voorkeuren","Email notification":"E-mailmelding","Notify me about comments on my posts":"Houd mij op de hoogte van reacties op mijn berichten","Notify me about replies on my comments":"Houd mij op de hoogte van reacties op mijn opmerkingen","Notify me about likes on my posts":"Meld me likes op mijn berichten","Notify me about reaction on my comments":"Houd mij op de hoogte van de reactie op mijn opmerkingen","Notify me about reaction on my reply":"Houd mij op de hoogte van de reactie op mijn antwoord","Notify me about direct message":"Houd mij op de hoogte van een direct bericht","Notify me about my mentions":"Houd mij op de hoogte van mijn vermeldingen","Notification for new posts":"Melding voor nieuwe berichten","Only group & section available which you are part of":"Alleen groep en sectie beschikbaar waar u deel van uitmaakt","Group & Section":"Groep & Sectie","All activity":"Alle activiteit","Post by admin":"Geplaatst door beheerder","No Notification":"Geen melding","Setting (Community)":"Instelling (gemeenschap)","General Settings":"Algemene instellingen","Upload community logo":"Communitylogo uploaden","Community name":"Gemeenschapsnaam","Invalid field":"Ongeldig veld","Your community address":"Uw gemeenschapsadres","Fav icon":"Favoriet icoon","This will be visible on the browser tab (32px by 32px)":"Dit is zichtbaar op het browsertabblad (32px bij 32px)",TimeZone:"Tijdzone","Privacy Policy on login page":"Privacybeleid op de inlogpagina","Terms & Condition on login page":"Algemene voorwaarden op de inlogpagina","Enter link here":"Voer hier de link in","Open Group Image":"Groepsafbeelding openen","By default ir takes up the community banner uploaded with the communtiy":"Standaard neemt ir de communitybanner over die met de community is geüpload","Community Experience":"Gemeenschapservaring",Onboarding:"Aan boord","Member Fields":"Ledenvelden","Make your community private":"Maak uw community privé","Users will have to login or sign up to access the community":"Gebruikers moeten inloggen of zich aanmelden om toegang te krijgen tot de community","Make account verification mandatory for both email & mobile":"Maak accountverificatie verplicht voor zowel e-mail als mobiel","New user will have to verify both email & mobile no. to access the community":"Nieuwe gebruiker moet zowel e-mailadres als mobiel nummer verifiëren. om toegang te krijgen tot de gemeenschap","Admin will also have to verify their mobile no. & email or else they won't be able to access the community":"De beheerder moet ook zijn mobiele nummer verifiëren. en e-mail, anders hebben ze geen toegang tot de community","Gated community access":"Gated community-toegang","Admin will have to approve or reject user's requests to join the community":"De beheerder moet de verzoeken van gebruikers om lid te worden van de community goedkeuren of afwijzen","Disable mobile login/register":"Schakel mobiel inloggen/registreren uit","Disable email login/register":"Schakel e-mailaanmelding/-registratie uit","Disable google login/register":"Schakel google login/registreren uit","Disable facebook login/register":"Schakel Facebook-aanmelding/registreren uit","Show & Hide features":"Functies weergeven en verbergen","Hide direct chat":"Directe chat verbergen","User will not be able to send direct messages to each other":"Gebruikers kunnen geen directe berichten naar elkaar sturen","Hide profile picture from top right corner for mobile responsive view":"Verberg profielfoto in de rechterbovenhoek voor mobiel responsieve weergave","Useful when using community in an in app browser":"Handig bij gebruik van community in een in-app-browser","Hide profile picture from top right corner in every view":"Verberg profielfoto in de rechterbovenhoek in elke weergave","Disable header dropdown on profile picture":"Schakel de vervolgkeuzelijst voor kopteksten op profielfoto uit","Useful for integrated community, especially using SSO":"Handig voor een geïntegreerde community, vooral als u SSO gebruikt","Hide the communtiy logo from the header":"Verberg het gemeenschapslogo in de koptekst","Hide the communtiy title from the header":"Verberg de communitytitel in de koptekst","Show collpased group in the side nav bar":"Toon de samengevouwen groep in de navigatiebalk aan de zijkant","Show full expanded post in the home feed":"Volledig uitgevouwen bericht weergeven in de startfeed","Hide the leaderboard score from the header":"Verberg de scorebordscore in de koptekst","Show powered by SpatialChat Communities":"Show mogelijk gemaakt door SpatialChat Communities","Hide closed groups if not joined":"Verberg gesloten groepen als u er geen lid van bent","Closed groups would not be shown to the user if they are not a member of the group":"Gesloten groepen worden niet aan de gebruiker getoond als deze geen lid is van de groep","Hide Community subscriber count from the users":"Verberg het aantal abonnees van de community voor de gebruikers","This will hide the community subscriber list in the community header":"Hierdoor wordt de lijst met communityabonnees verborgen in de communitykoptekst","Disable Communtiy Switcher":"Schakel Community Switcher uit","Use MD editor for create post description":"Gebruik de MD-editor voor het maken van een berichtbeschrijving","Non logged in user will land on explore group page instead of post directory":"Een niet-ingelogde gebruiker komt terecht op de groepspagina verkennen in plaats van op de berichtenmap","Advanced configurable":"Geavanceerd configureerbaar","Communtiy default country code":"Standaard landcode van de gemeenschap","This will show up by default on login/signup":"Dit wordt standaard weergegeven bij het inloggen/aanmelden","Onboarding/Welcome Message":"Onboarding/welkomstbericht","Welcome Message":"Welkomstbericht","Greet your members with personalized message":"Begroet uw leden met een persoonlijk bericht","Welcome to":"Welkom bij",Message:"Bericht","Add message":"Bericht toevoegen","Custom domain":"Aangepast domein","Add custom domain":"Aangepast domein toevoegen","Create new request":"Nieuw verzoek aanmaken","Enter your custom domain":"Voer uw aangepaste domein in","Setup details":"Installatiedetails","Add a CNAME record in your domain pointing to this community's address":"Voeg een CNAME-record toe in uw domein dat naar het adres van deze community verwijst","To configure your domain, you'll need to add a CNAME record pointing your domain to your pensil community URL":"Om uw domein te configureren, moet u een CNAME-record toevoegen die uw domein naar de URL van uw pensil-community verwijst","Step by Step help apge":"Stap voor stap hulppagina","All request list":"Alle aanvraaglijsten","Allow admin to assign/un-assign custom points to users":"Sta de beheerder toe om aangepaste punten aan gebruikers toe te wijzen/de toewijzing ervan ongedaan te maken","Base points for user to begin with":"Basispunten voor de gebruiker om mee te beginnen","Base points will be updated for all the users, any changes will reflect for all the users.":"Basispunten worden voor alle gebruikers bijgewerkt. Eventuele wijzigingen gelden voor alle gebruikers.","Allocate points for interaction":"Wijs punten toe voor interactie","Upvoting post":"Post omhoog stemmen","creating a comment":"een opmerking maken","creating a reply":"een antwoord creëren","Getting upvote to their post":"Stemmen krijgen voor hun post","Getting comment to their post":"Reactie krijgen op hun bericht","Getting reply to their comment":"Antwoord krijgen op hun opmerking","Creating a post":"Een bericht maken",Visiblity:"Zichtbaarheid","Move Up":"Ga omhoog","Move Down":"Ga naar beneden","Create embedded section":"Ingesloten sectie maken","Preview area":"Voorbeeldgebied","Theme selector":"Themakiezer","Community Theme":"Gemeenschapsthema","Select theme":"Selecteer thema","Select brand color":"Selecteer merkkleur","Customize your button color to match your brand":"Pas de kleur van uw knop aan zodat deze bij uw merk past","Select on button text color":"Selecteer de tekstkleur van de knop","Suggestion: Keep inverted contrast against brand color":"Suggestie: Houd het omgekeerde contrast ten opzichte van de merkkleur",Billing:"Facturering","Current plan":"Huidig ​​abonnement","You are current on Free PLan":"Je bent momenteel bezig met Free PLAN","Renew on: NA":"Verlengen op: NA",Select:"Selecteer","Email us at":"E-mail ons op","Compare plan":"Vergelijk abonnement","API Keys":"API-sleutels","Create new key":"Nieuwe sleutel maken","Total keys":"Totaal sleutels","Keep your API keys safe! You can use them to access specific feature & let cetain apps perfrom certain actions on your behalf on the platform.":"Bewaar uw API-sleutels veilig! U kunt ze gebruiken om toegang te krijgen tot specifieke functies en bepaalde apps namens u bepaalde acties op het platform te laten uitvoeren.","Key name":"Sleutelnaam","Key value":"Sleutelwaarde",Action:"Actie","Group updated!":"Groep bijgewerkt!","Are you sure you want to":"Weet je zeker dat je dat wilt","Make Moderator":"Moderator maken","Remove from group":"Verwijderen uit groep","Show All":"Toon alles","Change Role":"Verander rol",Close:"Dichtbij",copy:"kopiëren",LINKS:"LINKS","Email Id":"E-mail-ID",Name:"Naam","Search for an image":"Zoek naar een afbeelding","Crop Image":"Afbeelding bijsnijden","No photos found":"Geen foto's gevonden",Community:"Gemeenschap","Banner ratio - 16:9":"Bannerverhouding - 16:9","Banner Ratio - 16:6":"Bannerverhouding - 16:6","Share on mail":"Deel via e-mail","Share on Telegram":"Deel op Telegram","Share on Whatsapp":"Deel op Whatsapp","Share on Linkedin":"Deel op Linkedin","Share on Facebook":"Deel op Facebook","Share on Twitter":"Deel op Twitter","Pin Post":"Pin-bericht","Heading (optional)":"Kop (optioneel)","Select section":"Selecteer sectie",Gif:"Gif","Create Custom Widget":"Maak een aangepaste widget","Are you sure you want to delete this widget?":"Weet u zeker dat u deze widget wilt verwijderen?","Go to event":"Ga naar evenement","Add Tags":"Tags toevoegen","Create Tag":"Tag maken","Title (Optional)":"Titel (optioneel)","Search Gif":"Zoek GIF","What's on your mind":"Waar denk je aan","Looks like nothing available here right now.":"Het lijkt erop dat hier op dit moment niets beschikbaar is.","Try exploring other tabs":"Probeer andere tabbladen te verkennen","Delete Widget":"Widget verwijderen","Please select a section to post":"Selecteer een sectie om te plaatsen","Post added successfully!":"Bericht succesvol toegevoegd!","Failed to create post. Please check post content and retry again.":"Kan bericht niet maken. Controleer de inhoud van het bericht en probeer het opnieuw.","Are you sure you want to discard current post?":"Weet je zeker dat je het huidige bericht wilt verwijderen?","By default it will take up the image uploaded with the post":"Standaard wordt de afbeelding overgenomen die bij het bericht is geüpload","Quiz can be only viewed and attempted from mobile device right now!":"De quiz kan momenteel alleen worden bekeken en geprobeerd vanaf een mobiel apparaat!","Community Banner":"Gemeenschapsbanner","Change Cover":"Wijzig de dekking","Suggestions: Welcome to my community etc":"Suggesties: Welkom bij mijn community etc","(edited)":"(bewerkt)","Aspect ratio (recommended)":"Beeldverhouding (aanbevolen)","Banner details updated!":"Bannergegevens bijgewerkt!","Refresh if changes are not visible!":"Ververs als wijzigingen niet zichtbaar zijn!","Banner details could not be updated!":"Bannergegevens konden niet worden bijgewerkt!","Post deleted":"Bericht verwijderd","Post not available. It may have been deleted.":"Bericht niet beschikbaar. Mogelijk is deze verwijderd.",Admin:"Beheerder",Moderator:"Moderator","Bookmark added!":"Bladwijzer toegevoegd!","Bookmark removed":"Bladwijzer verwijderd","Failed performing action!":"Mislukte actie!","Copy this link to share on other platforms":"Kopieer deze link om deze op andere platforms te delen","View this event":"Bekijk dit evenement",Event:"Evenement","Join Meeting":"Neem deel aan de vergadering","The live meeting has ended":"De livevergadering is beëindigd","read more...":"lees meer...","Load more comments":"Laad meer reacties","Post Reply":"Reactie plaatsen","Post Comment":"Reactie plaatsen",more:"meer",upvoted:"gestemd","1 Upvote":"1 stem omhoog","1 Comment":"1 reactie","Please enter a title":"Voer een titel in","Please enter a url link":"Voer een URL-link in","Please enter button title":"Voer de knoptitel in","Button label must be at least 20 characters":"Het knoplabel moet minimaal 20 tekens lang zijn","Please enter valid url":"Voer een geldige URL in","Suggestions: Know more, Join, Apply...":"Suggesties: Meer weten, meedoen, solliciteren...",URL:"URL","Community Events":"Gemeenschapsevenementen","Widget deleted successfully":"Widget succesvol verwijderd","Community Top Contributors":"Topbijdragers van de community",points:"punten","Points cannot be greater than current points":"Punten kunnen niet groter zijn dan de huidige punten","Point cannot be a negative value":"Punt kan geen negatieve waarde zijn","Point cannot be a decimal point":"Punt kan geen decimaalpunt zijn","Please enter a valid number":"Voer een geldig nummer in","Karma points updated successfully":"Karmapunten zijn succesvol bijgewerkt","Error in updating karma points":"Fout bij het bijwerken van karmapunten","Add karma points":"Voeg karmapunten toe","Minus karma points":"Min karmapunten","Total Karma points:":"Totaal Karmapunten:","Enter no. of karma points":"Voer nr. in. van karmapunten","Minus Points":"Min punten","Trending Post":"Trending bericht","No visible description":"Geen zichtbare beschrijving","Picture ratio: 1:1":"Beeldverhouding: 1:1","home feed":"thuis voeden","Event name is invalid!":"Evenementnaam is ongeldig!",custom:"aangepast","Custom widget updated successfully":"Aangepaste widget is succesvol bijgewerkt","Name invalid!":"Naam ongeldig!","Current timezone:":"Huidige tijdzone:","can be updated from community settings":"kan worden bijgewerkt vanuit de community-instellingen","Event created successfully":"Evenement succesvol aangemaakt","Error in creating event":"Fout bij het maken van een evenement",Attendees:"Deelnemers","Do you wish to notify these changes to attendees?":"Wilt u deze wijzigingen doorgeven aan deelnemers?","users wants to attend this event":"gebruikers willen dit evenement bijwonen","Yes, Notify them":"Ja, breng ze op de hoogte","No, its okay":"Nee, het is oké","Do you wish to notify that event is cancelled?":"Wilt u laten weten dat het evenement niet doorgaat?","Are you sure you want to delete the event?":"Weet je zeker dat je de gebeurtenis wilt verwijderen?","Delete Event":"Evenement verwijderen","New Event":"Nieuw evenement","Accept Invitation":"Accepteer de uitnodiging",Requested:"Gevraagd",Declined:"Afgewezen","Request Access":"Toegang aanvragen","Enroll for":"Schrijf je in voor",Housefull:"Huisvol","Just copy paste this code wherever you want it to be embedded:":"Kopieer en plak deze code waar u deze wilt insluiten:",Ended:"Beëindigd","Error getting events":"Fout bij het ophalen van gebeurtenissen","Events could not be fetched!":"Evenementen kunnen niet worden opgehaald!","Show Attendees":"Toon deelnemers",Subscribers:"Abonnees","Make this a closed section":"Maak hiervan een gesloten gedeelte","Update Section":"Sectie bijwerken","Valid section name required!":"Geldige sectienaam vereist!","Enter section name":"Voer de sectienaam in","Community Admin":"Gemeenschapsbeheerder",Embed:"Insluiten","Invite to":"Uitnodigen voor","Please enter a valid email address":"Voer een geldig e-mailadres in","Invitation sent successfully":"Uitnodiging succesvol verzonden","Error sending invitation":"Fout bij verzenden van uitnodiging","Email is not valid!":"E-mail is niet geldig!","Data could not be loaded!":"Gegevens konden niet worden geladen!","Posted in":"Geplaatst in","Invite Members Individually":"Nodig leden individueel uit","Start a discussion":"Begin een discussie","Post something":"Plaats iets","Invite your audience":"Nodig je publiek uit","Choose Plan":"Kies Abonnement",or:"of","Create a link":"Maak een koppeling","Add link":"Koppeling toevoegen","Update link":"Link bijwerken","Add shortcut to your most used tools":"Voeg een snelkoppeling toe aan uw meest gebruikte tools","Your website, Instagram Channel, Facebook profile etc":"Uw website, Instagram-kanaal, Facebook-profiel etc","Valid link name required!":"Geldige linknaam vereist!","Valid url required, and make sure you are not missing http:// or https://":"Geldige URL vereist, en zorg ervoor dat u http:// of https:// niet mist","Invite to__1":"Uitnodigen voor","Link Name":"Linknaam","Link URL":"Link-URL","Could not subscribe to":"Kon zich niet abonneren","Subscribed to":"Geabonneerd op","By default it will take up the community banner uploaded with the community":"Standaard wordt de communitybanner overgenomen die met de community is geüpload","Created by":"Gemaakt door","Online Event (Meeting link will be visible once registered for the event)":"Online evenement (link naar vergadering is zichtbaar zodra u zich voor het evenement heeft geregistreerd)","Join Call":"Doe mee met bellen","Please login to book this event":"Log in om dit evenement te boeken","Commented on":"Er is commentaar op gegeven","Replied to":"Beantwoord","Looks like it's lonely here.":"Het lijkt erop dat het hier eenzaam is.","Try exploring other sections and groups.":"Probeer andere secties en groepen te verkennen.","Please proceed with the payment or contact admin to gain access to this group.":"Ga door met de betaling of neem contact op met de beheerder om toegang te krijgen tot deze groep.","This is a closed group You'll need access to this group.":"Dit is een besloten groep. Je hebt toegang tot deze groep nodig.","You have no bookmarks right now.":"Je hebt momenteel geen bladwijzers.","The user hasn't posted anything yet publicly.":"De gebruiker heeft nog niets openbaar gepost.","No activity to show.":"Er is geen activiteit om te tonen.","Are you sure you want to unsubscribe the community?":"Weet je zeker dat je je wilt afmelden voor de community?","deals left":"aanbiedingen over","Something went wrong while loading posts":"Er is iets misgegaan bij het laden van berichten","Could not unsubscribe from":"Kan zich niet afmelden voor","Unsubscribed from":"Afgemeld van","Login to view this page":"Log in om deze pagina te bekijken",Login:"Login","There was some error while doing the action!":"Er is een fout opgetreden tijdens het uitvoeren van de actie!","Unable to delete section!":"Kan sectie niet verwijderen!",__2:"",__3:"",__4:"","Home page":"Startpagina","Members Directory":"Ledenlijst",Calendar:"Kalender","Create Group":"Groep aanmaken","Start Live Session":"Livesessie starten",Home__1:"Thuis",Following:"Volgende",__5:"","Post Card":"Postkaart",Like:"Leuk vinden",Comment__1:"Opmerking",Comment__2:"Opmerking",Share__1:"Deel",Report:"Rapport","Follow User":"Volg gebruiker","Report User":"Rapporteer gebruiker","Report Post":"Rapporteer bericht",__6:"","LeaderBoard Floating pop up":"LeaderBoard Zwevende pop-up","Go to leaderboard":"Ga naar het klassement","Total karma points":"Totaal karmapunten",Comments__1:"Opmerkingen",Upvotes__1:"Stemmen",Replies__1:"Antwoorden",Post__1:"Na","Custom Points__1":"Aangepaste punten","Base Points":"Basispunten",__7:"",Channel:"Kanaal","This is a private channel":"Dit is een privékanaal","You'll need access to this channel":"Je hebt toegang tot dit kanaal nodig",__8:"","Profile Page":"Profielpagina",Followers:"Volgers",Activities:"Activiteiten",__9:"","Settings Page":"Pagina Instellingen","Go back to community":"Ga terug naar de gemeenschap",Account:"Rekening","Notification Centre":"Meldingscentrum",__10:"","Edit Profile Page":"Profielpagina bewerken","Set profile Picture":"Profielfoto instellen","Your name__1":"Jouw naam",Subtitle:"Ondertitel","(Max char 60)":"(Maximaal teken 60)","User Id":"Gebruikers-ID","Short Bio":"Korte biografie","Link For Social Account":"Link voor sociaal account","This will be displayed on your profile__1":"Dit wordt weergegeven op uw profiel","Add Social handles":"Voeg sociale handvatten toe",__11:"","Verification Page":"Verificatiepagina",Email__1:"E-mail",Verified__1:"Geverifieerd",__12:"","Manage your personal account notification preferences__1":"Beheer uw persoonlijke voorkeuren voor accountmeldingen",Preferences:"Voorkeuren","Email Notification":"E-mailmelding","Notify me about comment on my posts":"Houd mij op de hoogte van reacties op mijn berichten","Notify me about replies on my comment":"Houd mij op de hoogte van reacties op mijn reactie","Notify me about upvote on my post":"Houd mij op de hoogte van stemmen op mijn bericht","Notify me about reaction to my comment":"Houd mij op de hoogte van de reactie op mijn reactie","Notify me about reaction on my reply__1":"Houd mij op de hoogte van de reactie op mijn antwoord","Notify me about direct message__1":"Houd mij op de hoogte van een direct bericht","Notify me about mentions":"Houd mij op de hoogte van vermeldingen","Notification for new posts__1":"Melding voor nieuwe berichten","Only groups and channel available which you are part of. You can also control notification":"Alleen groepen en kanalen beschikbaar waarvan u deel uitmaakt. U kunt ook de meldingen beheren","Group & Channels":"Groepen en kanalen","All Activity":"Alle activiteit","Post by admin__1":"Geplaatst door beheerder","No Notification__1":"Geen melding",__13:"","Direct Message__1":"Direct bericht",Inbox:"Postvak IN","No chats found":"Geen chats gevonden",__14:"","Create Post Popup":"Maak een berichtpop-up","Create Post in":"Maak een bericht in","Select Channel":"Selecteer Kanaal",__15:"","Dark mode":"Donkere modus",Feed:"Feed",Saved:"Opgeslagen",Workflows:"Workflows",Rewards:"Beloningen",Networking:"Netwerken",Course:"Cursus","Member Directory":"Ledenlijst","Email Marketing":"E-mailmarketing",Analytics:"Statistieken","Log out":"Uitloggen","Switch community":"Wissel van community",Support:"Ondersteuning","Select topic":"Kies onderwerp","Featured Posts":"Uitgelichte berichten","Featured posts":"Uitgelichte berichten",Courses:"Cursussen","Explore courses and learning paths in your community.":"Ontdek cursussen en leerpaden in je community.","Add course":"Cursus toevoegen","Search title, description, or creator…":"Zoek op titel, beschrijving of maker…","Search courses":"Cursussen zoeken","Clear search":"Zoekopdracht wissen","Filter courses":"Cursussen filteren","Sort courses":"Cursussen sorteren","Clear filters":"Filters wissen","{count} course":"{count} cursus","{count} courses":"{count} cursussen",Updating:"Bijwerken","Could not load courses":"Cursussen konden niet worden geladen","Something went wrong. Please try again.":"Er is iets misgegaan. Probeer het opnieuw.",Retry:"Opnieuw proberen","No courses found":"Geen cursussen gevonden","Try another search term or change the filter.":"Probeer een andere zoekterm of pas het filter aan.","No courses available":"Geen cursussen beschikbaar","Create the first course for your community.":"Maak de eerste cursus voor je community.","Check back when new courses are published.":"Kom later terug als er nieuwe cursussen zijn gepubliceerd.","Showing {shown} of {total} course":"{shown} van {total} cursus weergegeven","Showing {shown} of {total} courses":"{shown} van {total} cursussen weergegeven","Show less":"Minder tonen","Read more":"Meer lezen","Request sent":"Aanvraag verzonden","An admin will review your enrollment request.":"Een beheerder beoordeelt je inschrijvingsaanvraag.",Enrolled:"Ingeschreven","You can start learning now.":"Je kunt nu beginnen met leren.","Something went wrong.":"Er is iets misgegaan.","Could not join course":"Deelnemen aan cursus mislukt","No lessons yet":"Nog geen lessen","Content will appear when lessons are published.":"Inhoud verschijnt zodra lessen zijn gepubliceerd.","Course deleted":"Cursus verwijderd","Could not delete course":"Cursus kon niet worden verwijderd","Course duplicated":"Cursus gedupliceerd","The copy was created as a draft.":"De kopie is als concept gemaakt.","Could not duplicate course":"Cursus kon niet worden gedupliceerd","Left course":"Cursus verlaten","Could not leave course":"Cursus kon niet worden verlaten","Continue learning":"Verder leren","Buy now":"Nu kopen","Send request to enroll":"Aanvraag tot inschrijving versturen","Enroll now":"Nu inschrijven","Course not found":"Cursus niet gevonden","This course may have been removed or you lack access.":"Deze cursus is mogelijk verwijderd of je hebt geen toegang.","Back to Courses":"Terug naar cursus","By {name}":"Door {name}","{count} lesson":"{count} les","{count} lessons":"{count} lessen","Total time to complete":"Totale tijd om af te ronden","Attached to {group}":"Gekoppeld aan {group}",Progress:"Voortgang","{done}/{total} lessons · {percent}%":"{done}/{total} lessen · {percent}%","Edit course":"Cursus bewerken","Duplicate course":"Cursus dupliceren","Delete course":"Cursus verwijderen","Course access is included with your active paid access":"Toegang tot de cursus is inbegrepen bij je actieve betaalde toegang","Leave course":"Cursus verlaten",Content:"Inhoud","Quiz results":"Quizresultaten","Delete course?":"Cursus verwijderen?","All course content and member progress will be permanently removed.":"Alle cursusinhoud en voortgang van leden worden definitief verwijderd.","Leave course?":"Cursus verlaten?","You will lose access to lessons until you enroll again.":"Je verliest de toegang tot de lessen totdat je je opnieuw inschrijft.","Not enrolled":"Niet ingeschreven","Course content unlocks once you are enrolled. Request access or purchase membership if required.":"Cursusinhoud wordt ontgrendeld zodra je bent ingeschreven. Vraag toegang aan of koop een lidmaatschap als dat nodig is.","Add section":"Sectie toevoegen","No content yet":"Nog geen inhoud","Add a section to start building this course.":"Voeg een sectie toe om te beginnen met het opbouwen van deze cursus.","Content will be available when the course starts.":"Inhoud is beschikbaar zodra de cursus begint.","{count} comment":"{count} reactie","{count} comments":"{count} reacties","No comments on this course yet.":"Nog geen reacties op deze cursus.","Showing {from}-{to} of {total} comments":"{from}-{to} van {total} reacties weergegeven",Lesson:"Les","Unlocks {date}":"Ontgrendelt op {date}","{count} day after enrollment":"{count} dag na inschrijving","{count} days after enrollment":"{count} dagen na inschrijving","Releases {date}":"Beschikbaar op {date}","Section deleted":"Sectie verwijderd","Could not delete section":"Sectie kon niet worden verwijderd","Lesson updated":"Les bijgewerkt","Lesson added":"Les toegevoegd","Could not save lesson":"Les kon niet worden opgeslagen","Lesson deleted":"Les verwijderd","Could not delete lesson":"Les kon niet worden verwijderd","Lesson duplicated as draft":"Les als concept gedupliceerd","Could not duplicate lesson":"Les kon niet worden gedupliceerd","Total time for this section":"Totale tijd voor deze sectie","Edit section":"Sectie bewerken","Delete section":"Sectie verwijderen","Lessons will appear here once added.":"Lessen verschijnen hier zodra ze zijn toegevoegd.","Not released yet":"Nog niet beschikbaar","Complete the previous lesson first":"Rond eerst de vorige les af","Time to complete":"Tijd om af te ronden","Actions for {title}":"Acties voor {title}","Edit lesson":"Les bewerken","Duplicate lesson":"Les dupliceren","Delete lesson":"Les verwijderen",Add:"Toevoegen","Add lesson":"Les toevoegen","Delete section?":"Sectie verwijderen?",'This removes "{name}" and all lessons inside it.':'Hiermee worden "{name}" en alle lessen erin verwijderd.',"Delete lesson?":"Les verwijderen?",'This removes "{title}" permanently.':'Hiermee wordt "{title}" definitief verwijderd.',"Lesson title":"Lestitel",Minutes:"Minuten","Time to complete, in minutes":"Tijd om af te ronden, in minuten","How long this lesson takes, in minutes":"Hoe lang deze les duurt, in minuten","Joined group":"Lid geworden van de groep","You're now in {group}. Enrolling you in the course…":"Je zit nu in {group}. We schrijven je in voor de cursus…","An admin will review your group request. After you're accepted you can enroll in the course.":"Een beheerder beoordeelt je aanvraag voor de groep. Zodra je bent geaccepteerd, kun je je inschrijven voor de cursus.","Could not join group":"Deelnemen aan groep mislukt","This course moved to {group}":"Deze cursus is verplaatst naar {group}","Join {group} first":"Word eerst lid van {group}","This course is now part of “{group}”. Join its new group to continue accessing the course.":"Deze cursus maakt nu deel uit van “{group}”. Word lid van de nieuwe groep om toegang tot de cursus te houden.","This course belongs to “{group}”. Join the group before enrolling and starting the course.":"Deze cursus hoort bij “{group}”. Word lid van de groep voordat je je inschrijft en de cursus start.","Paid group access":"Betaalde groepstoegang","Membership required":"Lidmaatschap vereist","Explore the available plans for {group}, choose the one that suits you, and return here after purchase to begin learning.":"Bekijk de beschikbare abonnementen voor {group}, kies er een dat bij je past en kom na aankoop hier terug om te beginnen met leren.","Your request to join this group is already pending. You'll be able to enroll after an admin accepts it.":"Je verzoek om lid te worden van deze groep is nog in behandeling. Je kunt je inschrijven zodra een beheerder het accepteert.","This is a {type} group. Continue to join instantly.":"Dit is een {type} groep. Ga verder om direct lid te worden.","This is a {type} group. Continue to send a request to the group admins.":"Dit is een {type} groep. Ga verder om een verzoek naar de groepsbeheerders te sturen.","Explore group":"Groep verkennen","Join group":"Lid worden van groep","Request to join group":"Lidmaatschap van groep aanvragen","You can watch this lecture now.":"Je kunt deze les nu bekijken.","Could not enroll":"Inschrijven mislukt","Want to view this lecture?":"Wil je deze les bekijken?","Your enrollment request is waiting for approval. You'll be able to watch this lecture after an admin accepts it.":"Je inschrijvingsaanvraag wacht op goedkeuring. Je kunt deze les bekijken zodra een beheerder de aanvraag accepteert.","Enroll in {course} to watch this lecture and the rest of the course.":"Schrijf je in voor {course} om deze les en de rest van de cursus te bekijken.","Back to course":"Terug naar cursus","Enroll to view lecture":"Inschrijven om les te bekijken","Choose a membership plan that includes {course}.":"Kies een lidmaatschapsabonnement dat {course} bevat.",Subscribed:"Geabonneerd","Payment successful":"Betaling geslaagd","You can now request access to this course.":"Je kunt nu toegang tot deze cursus aanvragen.","Checkout failed":"Afrekenen mislukt","Buy group access":"Groepstoegang kopen","No membership plans are linked to this group yet.":"Er zijn nog geen lidmaatschapsabonnementen aan deze groep gekoppeld.","Membership plan":"Lidmaatschapsabonnement","Subscribe free":"Gratis abonneren","{day} at {time}":"{day} om {time}","All courses":"Alle cursussen",Published:"Gepubliceerd",Drafts:"Concepten","Default order":"Standaardvolgorde","Title A–Z":"Titel A–Z","Shortest first":"Kortste eerst","Longest first":"Langste eerst","Most lessons":"Meeste lessen",Draft:"Concept",Personal:"Persoonlijk","Community member":"Communitylid","Your browser does not support video playback.":"Je browser ondersteunt geen videoweergave.","Audio resource":"Audiobron","Listen without leaving the Knowledge Hub":"Luister zonder de Knowledge Hub te verlaten","Your browser does not support audio playback.":"Je browser ondersteunt geen audioweergave.","Attached files":"Bijgevoegde bestanden",FILE:"BESTAND",Hide:"Verbergen",View:"Bekijken",Download:"Downloaden","Resource media":"Media van bron",Audio:"Audio",Attachments:"Bijlagen","About this resource":"Over deze bron","Saving your resource…":"Je bron wordt opgeslagen…","Finishing the upload…":"Upload afronden…","Uploading 1 file · {percent}%":"1 bestand uploaden · {percent}%","Uploading {count} files · {percent}%":"{count} bestanden uploaden · {percent}%","Remove {name}":"{name} verwijderen","Description cannot exceed {max} characters":"De beschrijving mag niet langer zijn dan {max} tekens","Your title":"Je titel","Add a cover image before publishing":"Voeg een omslagafbeelding toe voordat je publiceert","Resource updated":"Bron bijgewerkt","Resource shared":"Bron gedeeld","Your changes are now live.":"Je wijzigingen zijn nu live.","It is now available in the Knowledge Hub.":"Het is nu beschikbaar in de Knowledge Hub.","Upload cancelled":"Upload geannuleerd","Nothing was saved. Your files are still in the form.":"Er is niets opgeslagen. Je bestanden staan nog in het formulier.","Could not update resource":"Bron kon niet worden bijgewerkt","Could not share resource":"Bron kon niet worden gedeeld","Please try again.":"Probeer het opnieuw.","That file is not an image":"Dat bestand is geen afbeelding","Choose a PNG, JPG or WebP for the cover.":"Kies een PNG, JPG of WebP voor de omslag.","Couldn't use that cover":"Die omslag kan niet worden gebruikt","Pick another one, or choose a picture of your own.":"Kies een andere of kies een eigen afbeelding.","Couldn't open the current cover":"De huidige omslag kon niet worden geopend","Choose the image again to crop it.":"Kies de afbeelding opnieuw om hem bij te snijden.","Video too large":"Video te groot","Videos can be up to {limit}.":"Video's mogen maximaal {limit} zijn.","That file is not audio":"Dat bestand is geen audio","Choose an MP3, M4A, WAV or other audio file.":"Kies een MP3-, M4A-, WAV- of ander audiobestand.","Audio too large":"Audio te groot","Audio files can be up to {size} MB.":"Audiobestanden mogen maximaal {size} MB zijn.","File too large":"Bestand te groot","{count} files too large":"{count} bestanden te groot",'"{name}" was not added. Files can be up to {limit}.':'"{name}" is niet toegevoegd. Bestanden mogen maximaal {limit} zijn.',"{names} were not added. Files can be up to {size} MB ({videoLimit} for a video).":"{names} zijn niet toegevoegd. Bestanden mogen maximaal {size} MB zijn ({videoLimit} voor een video).","Up to 5 attachments":"Maximaal 5 bijlagen","Only the first {count} file was added.":"Alleen het eerste {count} bestand is toegevoegd.","Only the first {count} files were added.":"Alleen de eerste {count} bestanden zijn toegevoegd.","Remove one to add another.":"Verwijder er een om een andere toe te voegen.","Edit resource":"Bron bewerken","Share a resource":"Een bron delen","Update your resource. Saved changes will appear immediately.":"Werk je bron bij. Opgeslagen wijzigingen verschijnen direct.","Add a cover and a description, then optionally a video, an audio file and files to download.":"Voeg een omslag en een beschrijving toe, en eventueel een video, een audiobestand en bestanden om te downloaden.",Details:"Details","Cover image file":"Omslagafbeeldingsbestand","Video file":"Videobestand","Audio file":"Audiobestand","Attachment files":"Bijlagebestanden","Cover image":"Omslagafbeelding","The picture on this resource's card in the library. It is not a download. After you pick a picture you choose which part to show, in the card's 16:9 shape, so nothing is cut off in the library. A large photo is resized before it is sent, so it uploads faster; the original on your device is not changed.":"De afbeelding op de kaart van deze bron in de bibliotheek. Het is geen download. Nadat je een afbeelding hebt gekozen, bepaal je welk deel wordt getoond, in de 16:9-vorm van de kaart, zodat er niets wordt afgesneden in de bibliotheek. Een grote foto wordt verkleind voordat hij wordt verzonden, zodat hij sneller uploadt; het origineel op je apparaat blijft ongewijzigd.","Cover preview":"Voorbeeld van omslag","Choose a cover image":"Kies een omslagafbeelding","PNG, JPG or WebP · you choose the part to show next":"PNG, JPG of WebP · je kiest hierna welk deel wordt getoond","Replace cover":"Omslag vervangen","Remove cover":"Omslag verwijderen","Without a cover, the card shows a plain one in the community's colour.":"Zonder omslag toont de kaart een eenvoudige omslag in de kleur van de community.","Current cover":"Huidige omslag","Adjust crop":"Uitsnede aanpassen","No picture to hand? Use a ready-made cover":"Geen afbeelding bij de hand? Gebruik een kant-en-klare omslag","Cover subjects":"Omslagonderwerpen","All ({count})":"Alle ({count})","Earlier covers":"Eerdere omslagen","Ready-made covers":"Kant-en-klare omslagen","Use the {name} cover":"De omslag {name} gebruiken","More covers":"Meer omslagen",Title:"Titel","What will members learn?":"Wat gaan leden leren?","Shorten the title to {max} characters or fewer.":"Kort de titel in tot maximaal {max} tekens.","Share context, key takeaways, and why this is useful…":"Deel context, belangrijkste inzichten en waarom dit nuttig is…","Formatting counts toward the limit. Shorten the description to {max} characters or fewer.":"Opmaak telt mee voor de limiet. Kort de beschrijving in tot maximaal {max} tekens.","Media to play":"Af te spelen media","(optional)":"(optioneel)","Members watch or listen to these inside the resource.":"Leden bekijken of beluisteren dit in de bron zelf.","· one video, up to {limit}, or a link":"· één video, maximaal {limit}, of een link","Current uploaded video":"Huidige geüploade video","Already uploaded":"Al geüpload","Upload video":"Video uploaden","YouTube or Vimeo URL":"YouTube- of Vimeo-URL","Enter a valid YouTube or Vimeo link.":"Voer een geldige YouTube- of Vimeo-link in.","· one audio file":"· één audiobestand","Current audio file":"Huidig audiobestand","Upload audio":"Audio uploaden","Files to download":"Bestanden om te downloaden","PDFs, Word, Excel or any other file members can download · {count}/5":"PDF's, Word, Excel of andere bestanden die leden kunnen downloaden · {count}/5","Add files":"Bestanden toevoegen","PDF preview":"PDF-voorbeeld","PDF attachment preview":"Voorbeeld van PDF-bijlage","This is how members will see your resource. Nothing is shared until you save.":"Zo zien leden je bron. Er wordt niets gedeeld totdat je opslaat.","This is how members will see your resource. Nothing is shared until you publish.":"Zo zien leden je bron. Er wordt niets gedeeld totdat je publiceert.","When opened":"Bij openen","In the library":"In de bibliotheek","{done}/{total} done":"{done}/{total} klaar","Upload progress":"Uploadvoortgang","Keep this window open until it finishes.":"Houd dit venster open totdat het klaar is.","Cancel upload":"Upload annuleren","Save changes":"Wijzigingen opslaan","Publish resource":"Bron publiceren","Choose what shows on the cover":"Kies wat er op de omslag staat","Knowledge Hub":"Knowledge Hub","You created this resource.":"Je hebt deze bron gemaakt.","Moderator actions":"Moderatoracties","This file can't be previewed. Use Download instead.":"Dit bestand kan niet worden bekeken. Gebruik in plaats daarvan Downloaden.","Resource deleted":"Bron verwijderd","Could not delete resource":"Bron kon niet worden verwijderd","This resource is no longer available":"Deze bron is niet meer beschikbaar","Couldn't open that resource":"Die bron kon niet worden geopend","It may have been deleted. Here is the rest of the library.":"Hij is mogelijk verwijderd. Hier is de rest van de bibliotheek.","Community library":"Communitybibliotheek","Useful ideas, explainers and media shared by your community.":"Nuttige ideeën, uitleg en media gedeeld door je community.","Search title, description, or author…":"Zoek op titel, beschrijving of auteur…","Search Knowledge Hub resources":"Zoek in Knowledge Hub-bronnen","All content types":"Alle contenttypen","Any date":"Elke datum","Past 7 days":"Afgelopen 7 dagen","Past 30 days":"Afgelopen 30 dagen","Past 90 days":"Afgelopen 90 dagen","Custom dates":"Aangepaste datums","Sort resources":"Bronnen sorteren","Newest first":"Nieuwste eerst","Most liked":"Meest geliket","Could not load the Knowledge Hub":"De Knowledge Hub kon niet worden geladen","Please check your connection and try again.":"Controleer je verbinding en probeer het opnieuw.","Build your community library":"Bouw je communitybibliotheek op","Share the first useful guide, talk, or audio resource with everyone.":"Deel de eerste nuttige gids, lezing of audiobron met iedereen.","Share the first resource":"Deel de eerste bron","No resources found":"Geen bronnen gevonden","Try another search term or change the filters.":"Probeer een andere zoekterm of pas de filters aan.","Showing {shown} of {total} resource":"{shown} van {total} bron weergegeven","Showing {shown} of {total} resources":"{shown} van {total} bronnen weergegeven","Delete this resource?":"Deze bron verwijderen?","“{title}” will be permanently removed from the Knowledge Hub. This action cannot be undone.":"“{title}” wordt definitief uit de Knowledge Hub verwijderd. Dit kan niet ongedaan worden gemaakt.","Delete resource":"Bron verwijderen","Remove your like":"Je like intrekken","Like this resource":"Deze bron liken","You like this. Click to remove your like.":"Je vindt dit leuk. Klik om je like in te trekken.","Link copied":"Link gekopieerd","It opens this resource in the Knowledge Hub.":"Hiermee open je deze bron in de Knowledge Hub.","Couldn't copy link":"Link kopiëren mislukt","Post in review":"Bericht in beoordeling","An admin will review it before it appears.":"Een beheerder beoordeelt het voordat het verschijnt.",Shared:"Gedeeld","Posted to {channel}":"Geplaatst in {channel}","Couldn't share the resource":"De bron kon niet worden gedeeld","Copy link":"Link kopiëren","Post to a channel":"In een kanaal plaatsen","Send in a message":"Versturen in een bericht","Posts “{title}” with a link that opens it in the Knowledge Hub.":"Plaatst “{title}” met een link die het in de Knowledge Hub opent.","Select channel":"Kanaal selecteren","Add a message to introduce this to your community (optional). Type @ to mention someone.":"Voeg een bericht toe om het aan je community voor te stellen (optioneel). Typ @ om iemand te vermelden.","Posting…":"Plaatsen…","Share it in a message. The link opens the resource in the Knowledge Hub.":"Deel het in een bericht. De link opent de bron in de Knowledge Hub.","{count} file":"{count} bestand","{count} files":"{count} bestanden","Open {title} in the Knowledge Hub":"{title} openen in de Knowledge Hub","Like this course":"Deze cursus liken","It opens this course's page.":"Hij opent de pagina van deze cursus.","Posts “{title}” as a card members can like and open. Enrolling works as it does on the course page.":"Plaatst ‘{title}’ als kaart die leden kunnen liken en openen. Inschrijven werkt zoals op de cursuspagina.","Couldn't share the course":"De cursus kon niet worden gedeeld","Share it in a message. The link opens the course's page.":"Deel hem in een bericht. De link opent de pagina van de cursus.","Open the course {title}":"De cursus {title} openen","Paid plan":"Betaald abonnement","Unlock {feature}":"Ontgrendel {feature}","Your current plan doesn't include it. Choose a plan to start using it.":"Je huidige abonnement bevat dit niet. Kies een abonnement om het te gaan gebruiken.","Included in every paid plan, from {price}.":"Inbegrepen in elk betaald abonnement, vanaf {price}.","Included in every paid plan.":"Inbegrepen in elk betaald abonnement.","See plans":"Bekijk abonnementen","Maybe later":"Misschien later","Reach your members in their inbox with campaigns, newsletters, sequences, funnels and forms.":"Bereik je leden in hun inbox met campagnes, nieuwsbrieven, reeksen, funnels en formulieren.","Send campaigns and newsletters to your audience":"Stuur campagnes en nieuwsbrieven naar je publiek","Automated sequences, funnels and sign-up forms":"Geautomatiseerde reeksen, funnels en aanmeldformulieren","Audience management and delivery analytics":"Publieksbeheer en bezorgingsanalyses","Automate your community: act when members join, post or reach a milestone, without writing code.":"Automatiseer je community: onderneem actie wanneer leden lid worden, posten of een mijlpaal bereiken, zonder code.","Automations triggered by joins, posts, streaks and more":"Automatiseringen die starten bij aanmeldingen, posts, reeksen en meer","Multi-step actions: notify, tag, award points, send email":"Acties in meerdere stappen: melden, taggen, punten geven, e-mail sturen","Ready-made templates to start in minutes":"Kant-en-klare sjablonen om binnen enkele minuten te beginnen","Member Analytics":"Ledenanalyse","See how each member uses your community: time spent, sessions and the pages they visit.":"Zie hoe elk lid je community gebruikt: bestede tijd, sessies en bezochte pagina's.","Time spent and sessions for every member":"Bestede tijd en sessies voor elk lid","Page journeys: where members go and for how long":"Paginatrajecten: waar leden heen gaan en hoe lang","Look up any member in Insights":"Zoek elk lid op in Insights","Content category":"Inhoudscategorie","Content categories":"Inhoudscategorieën","All categories":"Alle categorieën","No category":"Geen categorie","Add “{name}”":"„{name}” toevoegen","Filter by content category":"Filteren op inhoudscategorie","Search categories":"Categorieën zoeken","Search or type a new category":"Zoek of typ een nieuwe categorie","Loading…":"Laden…","Couldn't load categories. Try again.":"Categorieën konden niet worden geladen. Probeer het opnieuw.","No categories match.":"Geen categorie komt overeen.",Author:"Auteur",Authors:"Auteurs","All authors":"Alle auteurs","Search authors":"Auteurs zoeken","Filter by author":"Filteren op auteur","Couldn't load authors. Try again.":"Auteurs konden niet worden geladen. Probeer het opnieuw.","No authors match.":"Geen auteur komt overeen.","No resources have been shared yet.":"Er zijn nog geen bronnen gedeeld.","No courses have been made yet.":"Er zijn nog geen cursussen gemaakt.","Shows only the resources one member has shared. The list has everyone who has shared a resource here, with how many each has shared; type a name to find someone. You can combine it with the other filters and the search box.":"Toont alleen de bronnen die één lid heeft gedeeld. De lijst bevat iedereen die hier een bron heeft gedeeld, met het aantal; typ een naam om iemand te vinden. Te combineren met de andere filters en de zoekbalk.","No resource has a category yet.":"Nog geen bron heeft een categorie.","Show more":"Meer tonen","What kind of resource this is, such as a research paper or an opinion piece. Members can filter the Knowledge Hub by it. Pick one, or type your own and choose Add.":"Wat voor soort bron dit is, zoals een onderzoekspaper of een opiniestuk. Leden kunnen de Knowledge Hub erop filteren. Kies er een of typ je eigen en kies Toevoegen.",Filters:"Filters","{count} applied":"{count} actief","Content type":"Inhoudstype","Date shared":"Datum gedeeld","Remove filter {name}":"Filter {name} verwijderen","Research Paper":"Onderzoekspaper",Article:"Artikel","Lecture/Talk":"Lezing","Opinion Piece":"Opiniestuk",General:"Algemeen",Football:"Voetbal",Education:"Onderwijs",Physiotherapy:"Fysiotherapie",Coaching:"Coaching","Sports Science":"Sportwetenschap","Strength & Conditioning":"Kracht & conditie",Recovery:"Herstel",Nutrition:"Voeding",Medicine:"Geneeskunde",Health:"Gezondheid",Cars:"Auto's",Entertainment:"Entertainment",Programming:"Programmeren",Technology:"Technologie",Business:"Zakelijk",Science:"Wetenschap",Engineering:"Techniek",Sports:"Sport",Arts:"Kunst",Travel:"Reizen",Food:"Eten",Resources:"Bronnen","Could not load this course.":"Deze cursus kon niet worden geladen.","Back to course overview":"Terug naar cursusoverzicht","Preview as learner":"Voorbeeld als cursist","Close table of contents":"Inhoudsopgave sluiten","Join {group} to continue learning.":"Word lid van {group} om verder te leren.","the course's current group":"de huidige groep van de cursus","Enroll in this course to watch the lecture.":"Schrijf je in voor deze cursus om de les te bekijken.","Next lesson":"Volgende les","Table of contents":"Inhoudsopgave","Add a section to start building content.":"Voeg een sectie toe om inhoud op te bouwen.","No lessons available yet.":"Nog geen lessen beschikbaar.","Lesson completed":"Les voltooid","Marked incomplete":"Gemarkeerd als niet voltooid","Could not update progress":"Voortgang kon niet worden bijgewerkt","Mark incomplete":"Markeren als niet voltooid","Mark complete":"Markeren als voltooid","You need to join this course before you can view its lessons.":"Je moet deelnemen aan deze cursus voordat je de lessen kunt bekijken.","Go to course overview":"Naar cursusoverzicht","No lesson selected":"Geen les geselecteerd","Pick a lesson from the table of contents.":"Kies een les uit de inhoudsopgave.","Lesson {current} of {total}":"Les {current} van {total}","This lesson has no written content yet.":"Deze les heeft nog geen geschreven inhoud.",Block:"Blok","In this lesson":"In deze les","Lesson content":"Lesinhoud",Completed:"Voltooid","Completed {date}":"Voltooid op {date}","Open PDF":"PDF openen","Quick check":"Snelle check",Assignment:"Opdracht","Submit your work in the lesson discussion below.":"Lever je werk in via de lesdiscussie hieronder.",Quiz:"Quiz","Could not save quiz.":"Quiz kon niet worden opgeslagen.","Could not submit quiz":"Quiz kon niet worden ingediend","Select all answers that apply.":"Selecteer alle antwoorden die van toepassing zijn.","This is an open-ended check — continue when you are ready.":"Dit is een open vraag — ga verder wanneer je klaar bent.","Submit quiz":"Quiz indienen","You {status} the quiz.":"Je bent {status} voor de quiz.",passed:"geslaagd","didn't pass":"niet geslaagd","Great job!":"Goed gedaan!","Review the answers below, then try again.":"Bekijk de antwoorden hieronder en probeer het dan opnieuw.","Retake quiz":"Quiz opnieuw doen",Score:"Score","Correct answers":"Juiste antwoorden",Correct:"Juist",Incorrect:"Onjuist",You:"Jij","Could not post your comment":"Je reactie kon niet worden geplaatst","Could not update the comment":"De reactie kon niet worden bijgewerkt","Could not delete the comment":"De reactie kon niet worden verwijderd",Discussion:"Discussie","Loading comments…":"Reacties laden…","No comments yet — start the discussion.":"Nog geen reacties — start de discussie.","Add to the discussion…":"Voeg iets toe aan de discussie…","Redirecting now…":"Je wordt nu doorgestuurd…","Redirecting in {count} second":"Doorsturen over {count} seconde","Redirecting in {count} seconds":"Doorsturen over {count} seconden","Lesson complete":"Les voltooid","Up next":"Hierna",Stay:"Blijven",Continue:"Doorgaan","Quiz result":"Quizresultaat","Question-by-question review of this learner's quiz attempt.":"Vraag-voor-vraag-overzicht van de quizpoging van deze cursist.","Attempts: {count}":"Pogingen: {count}",Submitted:"Ingediend","You received {points} karma point.":"Je hebt {points} karmapunt ontvangen.","You received {points} karma points.":"Je hebt {points} karmapunten ontvangen.","Congratulations!":"Gefeliciteerd!","You've successfully completed {course}.":"Je hebt {course} met succes afgerond.","Keep reviewing":"Blijven bekijken",Text:"Tekst","Send feedback":"Feedback versturen","You can attach up to {max} screenshots":"Je kunt maximaal {max} schermafbeeldingen bijvoegen","Only the first {count} screenshot was added":"Alleen de eerste {count} schermafbeelding is toegevoegd","Only the first {count} screenshots were added":"Alleen de eerste {count} schermafbeeldingen zijn toegevoegd","Unsupported image type":"Niet-ondersteund afbeeldingstype","Larger than 10 MB":"Groter dan 10 MB","Upload failed":"Upload mislukt","Add a short title.":"Voeg een korte titel toe","Please add a bit more detail ({min}+ characters).":"Voeg wat meer details toe ({min}+ tekens)","Bug report sent":"Bugmelding verzonden","Idea sent":"Idee verzonden","Thanks! The SpatialChat Communities team will take a look.":"Bedankt! Het SpatialChat Communities-team gaat ernaar kijken.","Couldn't send your feedback":"Je feedback kon niet worden verzonden","Report a problem or suggest an improvement to the SpatialChat Communities team.":"Meld een probleem of stel een verbetering voor aan het SpatialChat Communities-team.","Feedback type":"Soort feedback","Report a bug":"Een bug melden","Suggest an idea":"Een idee voorstellen","e.g. Verify code shows “Validation error!”":"bijv. Verificatiecode toont “Validatiefout!”","e.g. Let me schedule posts":"bijv. Laat me berichten inplannen","What happened?":"Wat is er gebeurd?","What would you like?":"Wat zou je willen?","What did you do, what did you expect, and what happened instead?":"Wat heb je gedaan, wat verwachtte je en wat gebeurde er in plaats daarvan?","What problem are you trying to solve? How would this help you?":"Welk probleem probeer je op te lossen? Hoe zou dit je helpen?",Screenshots:"Schermafbeeldingen","(optional, up to {max})":"(optioneel, maximaal {max})",Uploading:"Uploaden","Add screenshot":"Schermafbeelding toevoegen","or drop / paste (Ctrl/⌘+V) an image":"of sleep / plak (Ctrl/⌘+V) een afbeelding","Screenshots that failed to upload won't be sent. Remove them or try again.":"Schermafbeeldingen die niet zijn geüpload, worden niet verzonden. Verwijder ze of probeer het opnieuw.","Include technical details":"Technische gegevens bijvoegen","(recommended)":"(aanbevolen)","Page, browser, and no recent errors. Passwords, tokens and emails are removed.":"Pagina, browser en geen recente fouten. Wachtwoorden, tokens en e-mailadressen worden verwijderd.","Page, browser, and {count} recent error. Passwords, tokens and emails are removed.":"Pagina, browser en {count} recente fout. Wachtwoorden, tokens en e-mailadressen worden verwijderd.","Page, browser, and {count} recent errors. Passwords, tokens and emails are removed.":"Pagina, browser en {count} recente fouten. Wachtwoorden, tokens en e-mailadressen worden verwijderd.","Page: {path}":"Pagina: {path}","Browser: {browser}":"Browser: {browser}","Screen: {width}x{height} · Build: {version}":"Scherm: {width}x{height} · Build: {version}","No errors captured in this session.":"Geen fouten vastgelegd in deze sessie.","The SpatialChat Communities team may contact me about this":"Het SpatialChat Communities-team mag contact met me opnemen hierover","Uploading…":"Uploaden…","Send report":"Melding versturen","Send idea":"Idee versturen","{points} earned":"{points} verdiend","{points} to spend":"{points} te besteden","Profile picture updated":"Profielfoto bijgewerkt","Couldn't update picture":"Foto kon niet worden bijgewerkt","Cover photo updated":"Omslagfoto bijgewerkt","Couldn't update cover":"Omslag kon niet worden bijgewerkt","Link copied!":"Link gekopieerd!","Profile link copied to clipboard.":"Profiellink naar klembord gekopieerd.",Cover:"Omslag","Joined {date}":"Lid sinds {date}","Badges & achievements":"Badges & prestaties","No badges earned yet — stay active to unlock your first one.":"Nog geen badges verdiend — blijf actief om je eerste te ontgrendelen.",Badge:"Badge","You haven't posted yet.":"Je hebt nog niets geplaatst.","No activity yet.":"Nog geen activiteit.","Adjust cover photo":"Omslagfoto aanpassen","Add a bio and interests from":"Voeg een bio en interesses toe via","to fill out your About section.":"om je sectie Over te vullen.",Bio:"Bio",Interests:"Interesses","No achievement badges are configured for this community yet.":"Voor deze community zijn nog geen prestatiebadges ingesteld.","Earned {date}":"Verdiend op {date}","Profile updated":"Profiel bijgewerkt","Your changes have been saved.":"Je wijzigingen zijn opgeslagen.","Couldn't save profile":"Profiel kon niet worden opgeslagen",Username:"Gebruikersnaam","Checking availability…":"Beschikbaarheid controleren…","Username is available":"Gebruikersnaam is beschikbaar","Username is taken":"Gebruikersnaam is al in gebruik","3–64 chars: letters, numbers, _ or .":"3–64 tekens: letters, cijfers, _ of .",Headline:"Kopregel",Location:"Locatie","Social links":"Sociale links","Saving…":"Opslaan…","Couldn't update preference":"Voorkeur kon niet worden bijgewerkt","Email notifications":"E-mailmeldingen","Choose which activity on your content sends you an email.":"Kies welke activiteit op je content je een e-mail stuurt.","Posts created":"Berichten gemaakt","Comments made":"Reacties geplaatst","Replies made":"Antwoorden geplaatst","Likes given":"Gegeven likes","Likes on your posts":"Likes op je berichten","Your posts commented":"Reacties op je berichten","Your replies received":"Antwoorden die je hebt ontvangen","Followers gained":"Nieuwe volgers","Live sessions":"Livesessies","Admin-assigned":"Door beheerder toegekend",Other:"Overig","How you earned your {points}":"Hoe je je {points} hebt verdiend","No points yet — post, comment and react to start earning.":"Nog geen punten — plaats berichten, reageer en geef reacties om punten te verdienen.","Language updated":"Taal bijgewerkt","Using the community's language":"De taal van de community wordt gebruikt","Only you see this change.":"Alleen jij ziet deze wijziging.","Couldn't change your language":"Je taal kon niet worden gewijzigd",Language:"Taal","Menus, buttons and labels are shown in the language you pick here, for you only. Posts, comments and messages stay in the language they were written in. Other members keep the community's language unless they pick their own.":"Menu's, knoppen en labels worden getoond in de taal die je hier kiest, alleen voor jou. Posts, reacties en chatberichten blijven in de taal waarin ze zijn geschreven. Andere leden houden de taal van de community, tenzij ze zelf een taal kiezen.","Choose the language you read this community in.":"Kies de taal waarin je deze community leest.","My language":"Mijn taal","Community default":"Standaard van de community","Console error":"Consolefout","Console warning":"Consolewaarschuwing",Crash:"Crash","Unhandled error":"Onafgehandelde fout","Failed request":"Mislukt verzoek",About:"Over",Achievements:"Prestaties",Website:"Website",Silver:"Zilver",Gold:"Goud",Platinum:"Platina",Diamond:"Diamant",Elite:"Elite","Comments on my posts":"Reacties op mijn berichten","When someone comments on your post":"Wanneer iemand reageert op je bericht","Replies to my comments":"Antwoorden op mijn reacties","When someone replies to your comment":"Wanneer iemand antwoordt op je reactie","Likes on my posts":"Likes op mijn berichten","When someone likes your post":"Wanneer iemand je bericht liket","Reactions to my comments":"Reacties op mijn reacties","When someone reacts to your comment":"Wanneer iemand reageert op je reactie","Reactions to my replies":"Reacties op mijn antwoorden","When someone reacts to your reply":"Wanneer iemand reageert op je antwoord","Direct messages":"Directe berichten","When you receive a direct message":"Wanneer je een direct bericht ontvangt",Mentions:"Vermeldingen","When someone @mentions you":"Wanneer iemand je @vermeldt","Load more {label}":"Meer {label} laden","Loading more {label}…":"Meer {label} laden…",courses:"cursussen",resources:"bronnen",items:"items","About {label}":"Over {label}","Couldn't like this course":"Kan deze cursus niet leuk vinden","Couldn't like this resource":"Kan deze bron niet leuk vinden","Couldn't remove your like":"Je like kon niet worden verwijderd","Notify members":"Leden laten weten","Sends everyone in the community a notification about this resource, in the app and as a push notification on their phone or browser. Members who turned off notifications for this community don't get it.":"Stuurt iedereen in de community een melding over deze bron, in de app en als pushmelding op hun telefoon of browser. Leden die meldingen voor deze community hebben uitgezet, krijgen hem niet.","It is now available in the Knowledge Hub, and members are being notified.":"Hij staat nu in de Knowledge Hub en de leden worden op de hoogte gebracht.","How posts are ordered":"Hoe berichten worden gesorteerd","Recent: newest first. Top posts: the most likes, of all time; comments don't change the order. Trending: the most likes and comments together, within the period you pick. Following: posts by people you follow.":"Recent: nieuwste eerst. Topberichten: de meeste likes, van altijd; reacties veranderen de volgorde niet. Trending: de meeste likes en reacties samen, binnen de periode die je kiest. Volgend: berichten van mensen die je volgt.","Save this resource":"Deze bron opslaan","Save this course":"Deze cursus opslaan","Remove from saved":"Verwijderen uit opgeslagen","Saved. Click to remove it from your saved list.":"Opgeslagen. Klik om het uit je lijst te verwijderen.","Find it any time under Saved in the Knowledge Hub.":"Je vindt het altijd terug onder Opgeslagen in de Knowledge Hub.","Find it any time under Saved on the Courses page.":"Je vindt het altijd terug onder Opgeslagen op de pagina Cursussen.","Couldn't save this resource":"Kan deze bron niet opslaan","Couldn't save this course":"Kan deze cursus niet opslaan","Couldn't remove it from saved":"Kan het niet uit opgeslagen verwijderen","All resources":"Alle bronnen",Show:"Weergeven","Press the bookmark on anything to save it here for later. Only you can see what you saved.":"Druk op de bladwijzer bij iets om het hier voor later op te slaan. Alleen jij ziet wat je hebt opgeslagen.","Date range":"Periode",Today:"Vandaag","Last 7 days":"Afgelopen 7 dagen","Last 4 weeks":"Afgelopen 4 weken","Last 6 months":"Afgelopen 6 maanden","Last 12 months":"Afgelopen 12 maanden","Month to date":"Maand tot nu toe","Quarter to date":"Kwartaal tot nu toe","Year to date":"Jaar tot nu toe","All time":"Altijd",Start:"Begin",End:"Einde",Clear:"Wissen",Apply:"Toepassen","Couldn't download this file":"Kan dit bestand niet downloaden","A new category is saved with capital letters, so “fancy dress” becomes “Fancy Dress”, and one that already exists is reused rather than added twice.":"Een nieuwe categorie wordt met hoofdletters opgeslagen, dus „fancy dress” wordt „Fancy Dress”, en een categorie die al bestaat wordt hergebruikt in plaats van twee keer toegevoegd.","Job title":"Functietitel","Your role, such as Head of Sports Science or Team Physiotherapist. It shows under your name in the member directory and on your profile, so members know who to contact.":"Je rol, bijvoorbeeld Hoofd Sportwetenschap of Teamfysiotherapeut. Die staat onder je naam in de ledenlijst en op je profiel, zodat leden weten wie ze moeten benaderen.","e.g. Head of Sports Science":"bijv. Hoofd Sportwetenschap","Type where you are based, or use your current location: your browser asks first, and only the town and country are filled in. Your exact position is never saved. Check it, then save your profile.":"Typ waar je gevestigd bent, of gebruik je huidige locatie: je browser vraagt eerst toestemming en alleen de plaats en het land worden ingevuld. Je exacte positie wordt nooit opgeslagen. Controleer het en sla daarna je profiel op.","e.g. Stockholm, Sweden":"bijv. Stockholm, Zweden","Finding you…":"Locatie zoeken…","Use my location":"Mijn locatie gebruiken","Please enter your location, or use your current location.":"Vul je locatie in, of gebruik je huidige locatie.","Fields marked * are required.":"Velden met een * zijn verplicht.","Your details in {community}":"Jouw gegevens in {community}","Your community details":"Jouw gegevens in de community","Community details":"Communitygegevens","Questions this community's admins ask every member. Your answers show in its member directory, except ones marked “Only admins see this”.":"Vragen die de beheerders van deze community aan alle leden stellen. Je antwoorden staan in de ledenlijst, behalve die gemarkeerd met „Alleen beheerders zien dit”.","Couldn't save your profile":"Je profiel kon niet worden opgeslagen","Check the highlighted detail, then save again.":"Controleer het gemarkeerde gegeven en sla opnieuw op.","Location filled in":"Locatie ingevuld","Check it, then save your profile.":"Controleer het en sla daarna je profiel op.","Couldn't use your location":"Je locatie kon niet worden gebruikt","Please type your location.":"Typ je locatie.","Your browser can't share your location here. Please type it.":"Je browser kan je locatie hier niet delen. Typ hem in.","Location access is blocked. Allow it for this site in your browser settings, or type your location.":"Toegang tot je locatie is geblokkeerd. Sta het toe voor deze site in je browserinstellingen, of typ je locatie.","Finding your location took too long. Please try again, or type your location.":"Het zoeken naar je locatie duurde te lang. Probeer het opnieuw, of typ je locatie.","Your location isn't available right now. Please type it.":"Je locatie is nu niet beschikbaar. Typ hem in.","Location lookup isn't available right now. Please type your location.":"Locatie opzoeken is nu niet beschikbaar. Typ je locatie."},$nn={"SpatialChat Communities Keyword":"Norwegian",Home:"Hjem","Explore Groups":"Utforsk grupper",Events:"Hendelser",Groups:"Grupper",Links:"Lenker","Direct Message":"Direkte melding","Powered by":"Drevet av","No groups here, please use + to create a new one, or join one see them here.":"Ingen grupper her, vennligst bruk + for å opprette en ny, eller bli med i en se dem her.","Please join a group to see them here":"Bli med i en gruppe for å se dem her","Section can only be reordered within the group!":"Seksjon kan kun ombestilles innenfor gruppen!","Group Page":"Gruppeside","Invite Members":"Inviter medlemmer",Join:"Bli med",Joined:"Ble med","Create new section":"Opprett ny seksjon","Group Setting drop down":"Gruppeinnstillinger rullegardinmenyen",Share:"Dele","Edit group":"Rediger gruppe","Delete group":"Slett gruppe",Leave:"Forlate","Are you sure you want to delete the group?":"Er du sikker på at du vil slette gruppen?",Cancel:"Kansellere","Yes, Go Ahead":"Ja, gå videre","Share via link":"Del via lenke",Copy:"Kopiere",Copied:"Kopiert","Share on social media":"Del på sosiale medier","Add Section":"Legg til seksjon","Section Header":"Seksjonsoverskrift",Live:"Bo","Create post":"Opprett innlegg","Notificaiton Bell":"Meldingsklokke","All posts":"Alle innlegg","Admin posts only":"Kun administratorinnlegg",None:"Ingen","Section Setting drop down":"Nedtrekksmenyen for seksjonsinnstilling","Edit Section":"Rediger seksjon","Embed Section":"Bygg inn seksjon","Delete Section":"Slett seksjon","Are you sure you want to delete the section?":"Er du sikker på at du vil slette delen?","Section deleted!":"Seksjon slettet!","Create Group Pop up / Update":"Opprett gruppe popup / oppdatering","Create group":"Opprett gruppe","Basic Detail":"Grunnleggende detalj",Settings:"Innstillinger","Size 16:9 or 1600 by 900":"Størrelse 16:9 eller 1600 x 900","Group name":"Gruppenavn","Enter group name":"Skriv inn gruppenavn","Suggestions: Spaces, Channels, Groups, Blog, Knowledgebase, etc":"Forslag: mellomrom, kanaler, grupper, blogg, kunnskapsbase osv","Group Description":"Gruppebeskrivelse","Enter description here":"Skriv inn beskrivelse her","Group Type":"Gruppetype",Open:"Åpne","Visible to all & anyone can join":"Synlig for alle og alle kan bli med",Closed:"Lukket","User will have to request to join the group":"Brukeren må be om å bli med i gruppen",Paid:"Betalt","Group Price":"Gruppepris","Currency (Default: INR)":"Valuta (standard: INR)","User will have to pay to join the group":"Brukeren må betale for å bli med i gruppen","Make this a private group":"Gjør dette til en privat gruppe","Private group will only be visible to members who are part of it. Admin can add members manually from member list":"Den private gruppen vil bare være synlig for medlemmer som er en del av den. Admin kan legge til medlemmer manuelt fra medlemslisten","Upload from device":"Last opp fra enheten","Search image":"Søk bilde","Valid group name required!":"Gyldig gruppenavn kreves!","Update Group":"Oppdater gruppe","SEO Settings":"SEO-innstillinger","Custom URL":"Egendefinert URL","Meta Title":"Metatittel","Maximum length of 255 characters allowed":"Maksimal lengde på 255 tegn tillatt","Meta Description":"Metabeskrivelse","Open Graph Detail":"Åpne Graph Detail","Open Graph Title":"Åpne graftittel","Open Graph Description":"Åpne grafbeskrivelse","Open Graph Image":"Åpne Graph Image","Recommended dimensions: 1200px by 630px with a 1.91:1 aspect ratio.":"Anbefalte dimensjoner: 1200 x 630 piksler med et sideforhold på 1,91:1.","If no URL is used, it will automatically picked your group thumbnail.":"Hvis ingen URL brukes, vil den automatisk velge gruppeminiatyrbildet ditt.","Create Section Pop up / Update":"Opprett seksjon popup / oppdatering","Create Section":"Opprett seksjon","Section Name":"Seksjonsnavn","Suggestions: General, Introductions, Community Guidelines":"Forslag: Generelt, introduksjoner, retningslinjer for fellesskapet","Section Type":"Seksjonstype","Post Type":"Posttype","Group Chat":"Gruppechat","Who can post in this section?":"Hvem kan legge ut innlegg i denne delen?","Only Admin":"Kun Admin","Any user":"Enhver bruker","Sorting order for section":"Sorteringsrekkefølge for seksjon","Latest first":"Siste først","Oldest post first":"Eldste innlegg først","Section Appearance":"Seksjonsutseende","List View":"Listevisning","Grid View":"Rutenettvisning","Make this closed section":"Lag denne lukkede delen","Members will have to request access to see section content":"Medlemmer må be om tilgang for å se seksjonsinnhold","Make this a private section":"Gjør dette til en privat del","Disables requests (Make sure closed section is selected as well).":"Deaktiverer forespørsler (sørg for at lukket seksjon også er valgt).","Post Editor":"Innleggsredaktør","Create new post in":"Opprett nytt innlegg i","Add Cover Picture":"Legg til forsidebilde","Heading (Optional)":"Overskrift (valgfritt)","Write here..":"Skriv her..",Picture:"Bilde",Video:"Video",Attachment:"Vedlegg",Poll:"Avstemning","Embed Code":"Bygg inn kode",Tags:"Tagger","Toggle to question":"Bytt til spørsmål","Poll expire time":"Avstemningens utløpstid","Poll question":"Avstemningsspørsmål","Enter Question":"Skriv inn spørsmål",Question:"Spørsmål",Option:"Alternativ",Options:"Alternativer","Add Option":"Legg til alternativ","Poll Expiry time":"Avstemningens utløpstid","12 Hours":"12 timer","1 Day":"1 dag","2 Days":"2 dager","1 Week":"1 uke","2 Weeks":"2 uker","Always Open":"Alltid åpen","Write embeddable code":"Skriv innbyggbar kode","Click here to add embed code.":"Klikk her for å legge til innebygd kode.","Paste your embed code here!":"Lim inn innbyggingskoden din her!","Post Settings":"Innstillinger for innlegg","Update Post":"Oppdater innlegg",Update:"Oppdater","Start meeting / Video call / Live":"Start møte / Videosamtale / Live","Meeting Name":"Møtenavn","Suggestion: Group discussion etc":"Forslag: Gruppediskusjon etc",Description:"Beskrivelse","Enter description here (optional)":"Skriv inn beskrivelse her (valgfritt)","When do you want to start the session":"Når vil du starte økten","Right now":"Akkurat nå","Schedule for later":"Plan for senere","Group video call":"Gruppevideosamtale",Webinar:"Webinar","Go Live":"Gå live","Go live":"Gå live","Info on the Post":"Info på Posten","Post comment":"Legg inn kommentar",Comment:"Kommentar",Comments:"Kommentarer",Reply:"Svar",Replies:"Svarer","Share via URL":"Del via URL","Reshare in other sections":"Del videre i andre seksjoner","Post Card Drop Down":"Postkort Drop Down",Bookmark:"Bokmerke","Pin post":"Fest innlegg",Edit:"Redigere","Embed Post":"Legg inn innlegg",Delete:"Slett","Remove Pin":"Fjern pinne","Remove Bookmark":"Fjern bokmerke","Just copy paste this code wherever you want it to be embedded":"Bare kopier og lim inn denne koden der du vil at den skal være innebygd",Height:"Høyde",Preview:"Forhåndsvisning","Copied to clipboard":"Kopiert til utklippstavlen","Select Widgets":"Velg Widgets","Add widgets to":"Legg til widgets til","You can change their order by dragging & dropping the widgets over each other":"Du kan endre rekkefølgen ved å dra og slippe widgetene over hverandre","Please note: Widget wont be displayed if there is no data available,":"Vennligst merk: Widget vil ikke vises hvis det ikke er data tilgjengelig,","Group Members":"Gruppemedlemmer","Group Leaderboard":"Gruppeledertavle","Community Leaderboard":"Community Leaderboard","Trending Posts":"Populære innlegg","Group Events":"Gruppearrangementer","Add Custom":"Legg til tilpasset","Save Widgets":"Lagre widgets","Visible to user":"Synlig for brukeren","Visible to admin":"Synlig for admin","Add widget to":"Legg til widget til","Upload cover picture":"Last opp forsidebilde","1:1 aspect ration (recommended)":"1:1 sideforhold (anbefalt)","Card Title":"Korttittel","Enter widget name":"Skriv inn widgetnavn","Small Description (try to keep it under 50 words)":"Liten beskrivelse (prøv å holde den under 50 ord)","Enter description":"Skriv inn beskrivelse","Button Title":"Knapptittel","Enter button name":"Skriv inn knappens navn","Siggestion: Know more, Join, Apply, etc":"Siggestion: Vit mer, Bli med, Søk osv","URL link":"URL-kobling","Create custom widget":"Lag egendefinert widget","Custom widget created successfully":"Egendefinert widget opprettet",Widgets:"Widgets",Members:"Medlemmer","See All":"Se alle","Communtiy Top Contributors":"Toppbidragsytere i fellesskapet","Community members":"Fellesskapsmedlemmer","Group Top Contributors":"Gruppens beste bidragsytere","Upcoming Events":"Kommende arrangementer","Home Page Banner":"Hjemmesidebanner","Edit Banner":"Rediger banner","Home page Edit Banner Pop up":"Hjemmeside Rediger banner Pop up","Update Banner":"Oppdater banner",Search:"Søk","Upload Image":"Last opp bilde",Remove:"Fjerne","Banner image (please use 16:6 ratio or 1600px by 600px image for the best view)":"Bannerbilde (bruk 16:6-forhold eller 1600px x 600px bilde for best mulig visning)","Banner Title":"Bannertittel","Enter here":"Gå inn her","Suggestion: Welcome to my community etc":"Forslag: Velkommen til fellesskapet mitt osv","Banner Description":"Bannerbeskrivelse","Enter banner description":"Skriv inn bannerbeskrivelse","Save Banner Info":"Lagre bannerinformasjon","Home Page Feed":"Hjemmesidefeed",Recent:"Nylig","Top posts":"Topp innlegg",Trending:"På vei opp","Home Feed Groups":"Hjemmestrømgrupper","":"#VALUE!","My profile":"Min profil",Logout:"Logg ut",Notification:"Melding",Notifications:"Varsler","Mark all viewed":"Merk alle sett","has created a post":"har opprettet et innlegg","wants to join":"ønsker å være med","has commented on your post":"har kommentert innlegget ditt","has replied to your comment":"har svart på kommentaren din","Search for tags":"Søk etter tagger","All groups":"Alle grupper","Search result":"Søkeresultat","No post found for selected hashtag":"Ingen innlegg funnet for valgt hashtag","Start a conversation":"Start en samtale","Search by name":"Søk etter navn",Upcoming:"Kommende",UPCOMING:"KOMMENDE",Past:"Forbi",PAST:"FORBI","No upcoming events":"Ingen kommende arrangementer","Create event popup":"Opprett hendelsespopup","Event details":"Begivenhetsdetaljer","16:9 aspect ratio":"16:9 sideforhold","Event name":"Navn på hendelsen","Enter event name":"Skriv inn hendelsesnavn","Host Name":"Vertsnavn","You will be made host if none selected":"Du vil bli vert hvis ingen er valgt","Write here...":"Skriv her...","No. of registration for the event":"Antall påmeldinger til arrangementet",Unlimited:"Ubegrenset","When & where":"Når og hvor",From:"Fra","Start date":"Startdato",time:"tid",To:"Til","End date":"Sluttdato","Current time zone:":"Gjeldende tidssone:","Can be updated from the communtiy setting":"Kan oppdateres fra fellesskapsinnstillingen","Online event":"Online arrangement","Add meeting link":"Legg til møtelink","Meeting link will be generated once event is created":"Møtelink vil bli generert når arrangementet er opprettet",Venue:"Sted","Enter address":"Skriv inn adresse",Create:"Skape",Invite:"Invitere","Share event via link":"Del arrangementet via lenke",Copy__1:"Kopiere","Select section to post this event":"Velg seksjon for å legge ut denne hendelsen","Once posted, members of that group or section will recieve an notification":"Når de er lagt ut, vil medlemmer av den gruppen eller delen motta et varsel",Post:"Stolpe",RSVP:"RSVP","Book Event":"Bestill arrangement","Yes, I'll attend":"Ja, jeg skal delta","May be":"Kan være","No, I won't attend":"Nei, jeg vil ikke delta","Date & Time":"Dato og tid",Host:"Vert","Online meeting":"Nettmøte","Meeting link will be visible once registered for the event":"Møtelink vil være synlig når du har registrert deg for arrangementet","User Management":"Brukeradministrasjon","Go bac to community":"Gå tilbake til fellesskapet","Manage Members":"Administrer medlemmer",Member:"Medlem",Invited:"Invitert","Search for member":"Søk etter medlem","Add to group":"Legg til i gruppe","Send Direct Message":"Send direktemelding","Change role":"Bytt rolle","Kick from community":"Kick fra fellesskapet","Super Admin":"Super Admin","Super admin will have full access to the communtiy settings":"Superadministrator vil ha full tilgang til fellesskapsinnstillingene","Group Admin":"Gruppeadministrator","Admin of the selected group can edit the group information and create, edt or delete section under selected group":"Administrator for den valgte gruppen kan redigere gruppeinformasjonen og opprette, redigere eller slette seksjon under valgt gruppe","Group Moderator":"Gruppemoderator","Group moderator can create or delete post, comment, reply & messages in the selected group.":"Gruppemoderator kan opprette eller slette innlegg, kommentarer, svar og meldinger i den valgte gruppen.",User:"Bruker",Save:"Spare","User role updated successfully":"Brukerrollen ble oppdatert",Leaderboard:"Leaderboard","Click on the column header for sorting":"Klikk på kolonneoverskriften for sortering",Rank:"Rang","Karma Points":"Karmapoeng","Custom Points":"Egendefinerte poeng",Follow:"Følge",Upvotes:"Oppstemmer",Posts:"Innlegg","Add custom points":"Legg til egendefinerte poeng","Subtract custom points":"Trekk fra egendefinerte poeng","Enter no. of points":"Skriv inn nr. av poeng","Add points":"Legg til poeng","Invite members to":"Inviter medlemmer til","Invite via link":"Inviter via link","Invite via email":"Inviter via e-post","Add more":"Legg til flere","Upload a CSV":"Last opp en CSV","Please upload a comma-seprated CSV file, with header as name, email.":"Last opp en kommadelt CSV-fil, med overskrift som navn, e-post.","Here is a template CSV file":"Her er en mal CSV-fil","Upload File":"Last opp fil","Send Invite":"Send invitasjon","Mail Template":"Mail mal","Send Test Mail":"Send testpost",Hey:"Hei","A has invite you to join the B":"A har invitert deg til å bli med i B","Switch to rich text editor":"Bytt til rik tekstredigeringsprogram","Add Custom Message":"Legg til egendefinert melding","Enter message here":"Skriv inn melding her","Send Bulk Mail":"Send massepost","Send Mail":"Send e-post","Send bulk mail to all community members or select group members":"Send massepost til alle fellesskapsmedlemmer eller utvalgte gruppemedlemmer",Date:"Dato",Subject:"Tema",Recipients:"Mottakere","1000 bulk emails remaining for this month. Resets on <date>":"1000 massee-poster igjen denne måneden. Tilbakestilles på <dato>",Everyone:"Alle sammen","Enter mail subject":"Skriv inn e-postemne","Write message":"Skriv melding",Cancel__1:"Kansellere",Send:"Sende",__1:"#VALUE!",Activity:"Aktivitet",Bookmarks:"Bokmerker","Edit profile":"Rediger profil",Unsubscribe:"Avslutt abonnementet","Settings (Account)":"Innstillinger (konto)",Profile:"Profil","Set Profile Picture":"Angi profilbilde","Your name":"Navnet ditt","User ID":"Bruker-ID","Short bio":"Kort biografi","Link your social account":"Koble til den sosiale kontoen din","This will be displayed on your profile":"Dette vil vises på profilen din","Add social handle":"Legg til sosialt håndtak",Verification:"Bekreftelse","Account Verification":"Kontobekreftelse",Email:"E-post","Enter email":"Skriv inn e-post",Verified:"Verifisert",Unverified:"Ubekreftet",Change:"Endre",Unlink:"Fjern tilknytningen",Mobile:"Mobil","enter mobile no.":"skriv inn mobilnr.","Request OTP":"Be om OTP","Manage your personal account notification preferences":"Administrer dine personlige kontovarslingspreferanser",Prefrences:"Preferenser","Email notification":"E-postvarsel","Notify me about comments on my posts":"Varsle meg om kommentarer på innleggene mine","Notify me about replies on my comments":"Gi meg beskjed om svar på kommentarene mine","Notify me about likes on my posts":"Varsle meg om likes på innleggene mine","Notify me about reaction on my comments":"Gi meg beskjed om reaksjoner på kommentarene mine","Notify me about reaction on my reply":"Gi meg beskjed om reaksjon på svaret mitt","Notify me about direct message":"Gi meg beskjed om direktemelding","Notify me about my mentions":"Gi meg beskjed om mine omtaler","Notification for new posts":"Varsling for nye innlegg","Only group & section available which you are part of":"Kun gruppe og seksjon tilgjengelig som du er en del av","Group & Section":"Gruppe og seksjon","All activity":"All aktivitet","Post by admin":"Innlegg av admin","No Notification":"Ingen varsel","Setting (Community)":"Innstilling (fellesskap)","General Settings":"Generelle innstillinger","Upload community logo":"Last opp fellesskapets logo","Community name":"Fellesskapsnavn","Invalid field":"Ugyldig felt","Your community address":"Samfunnsadressen din","Fav icon":"Favorittikon","This will be visible on the browser tab (32px by 32px)":"Dette vil være synlig på nettleserfanen (32px x 32px)",TimeZone:"Tidssone","Privacy Policy on login page":"Personvernerklæring på påloggingssiden","Terms & Condition on login page":"Vilkår og betingelser på innloggingssiden","Enter link here":"Skriv inn lenken her","Open Group Image":"Åpne gruppebilde","By default ir takes up the community banner uploaded with the communtiy":"Som standard tar ir opp fellesskapsbanneret som er lastet opp med fellesskapet","Community Experience":"Samfunnserfaring",Onboarding:"Onboarding","Member Fields":"Medlemsfelt","Make your community private":"Gjør fellesskapet ditt privat","Users will have to login or sign up to access the community":"Brukere må logge på eller registrere seg for å få tilgang til fellesskapet","Make account verification mandatory for both email & mobile":"Gjør kontoverifisering obligatorisk for både e-post og mobil","New user will have to verify both email & mobile no. to access the community":"Ny bruker må bekrefte både e-post og mobilnr. for å få tilgang til fellesskapet","Admin will also have to verify their mobile no. & email or else they won't be able to access the community":"Admin må også bekrefte mobilnummeret sitt. og e-post ellers vil de ikke få tilgang til fellesskapet","Gated community access":"Gated community tilgang","Admin will have to approve or reject user's requests to join the community":"Administrator må godkjenne eller avvise brukerens forespørsler om å bli med i fellesskapet","Disable mobile login/register":"Deaktiver mobil pålogging/registrering","Disable email login/register":"Deaktiver e-postpålogging/registrering","Disable google login/register":"Deaktiver google login/register","Disable facebook login/register":"Deaktiver Facebook-pålogging/registrering","Show & Hide features":"Vis og skjul funksjoner","Hide direct chat":"Skjul direkte chat","User will not be able to send direct messages to each other":"Brukere vil ikke kunne sende direktemeldinger til hverandre","Hide profile picture from top right corner for mobile responsive view":"Skjul profilbilde fra øverste høyre hjørne for responsiv visning på mobil","Useful when using community in an in app browser":"Nyttig når du bruker fellesskap i en nettleser i appen","Hide profile picture from top right corner in every view":"Skjul profilbilde fra øverste høyre hjørne i hver visning","Disable header dropdown on profile picture":"Deaktiver rullegardinoverskrift på profilbilde","Useful for integrated community, especially using SSO":"Nyttig for integrert fellesskap, spesielt ved bruk av SSO","Hide the communtiy logo from the header":"Skjul fellesskapslogoen fra overskriften","Hide the communtiy title from the header":"Skjul fellesskapstittelen fra overskriften","Show collpased group in the side nav bar":"Vis den sammenslåtte gruppen i navigasjonslinjen på siden","Show full expanded post in the home feed":"Vis fullstendig utvidet innlegg i hjemmefeeden","Hide the leaderboard score from the header":"Skjul poengsummen fra topplisten","Show powered by SpatialChat Communities":"Vis drevet av SpatialChat Communities","Hide closed groups if not joined":"Skjul lukkede grupper hvis de ikke er med","Closed groups would not be shown to the user if they are not a member of the group":"Lukkede grupper vil ikke bli vist til brukeren hvis de ikke er medlem av gruppen","Hide Community subscriber count from the users":"Skjul antallet abonnenter for brukerne","This will hide the community subscriber list in the community header":"Dette vil skjule listen over fellesskapsabonnenter i fellesskapsoverskriften","Disable Communtiy Switcher":"Deaktiver Community Switcher","Use MD editor for create post description":"Bruk MD editor for å lage innleggsbeskrivelse","Non logged in user will land on explore group page instead of post directory":"Ikke-pålogget bruker vil lande på Utforsk-gruppesiden i stedet for postkatalogen","Advanced configurable":"Avansert konfigurerbar","Communtiy default country code":"Standard landskode for fellesskapet","This will show up by default on login/signup":"Dette vil vises som standard ved pålogging/registrering","Onboarding/Welcome Message":"Onboarding/velkomstmelding","Welcome Message":"Velkomstmelding","Greet your members with personalized message":"Hils medlemmene dine med personlig melding","Welcome to":"Velkommen til",Message:"Beskjed","Add message":"Legg til melding","Custom domain":"Egendefinert domene","Add custom domain":"Legg til tilpasset domene","Create new request":"Opprett ny forespørsel","Enter your custom domain":"Skriv inn ditt egendefinerte domene","Setup details":"Oppsettdetaljer","Add a CNAME record in your domain pointing to this community's address":"Legg til en CNAME-post på domenet ditt som peker til denne fellesskapets adresse","To configure your domain, you'll need to add a CNAME record pointing your domain to your pensil community URL":"For å konfigurere domenet ditt, må du legge til en CNAME-post som peker domenet ditt til nettadressen til pensil-fellesskapet","Step by Step help apge":"Trinn for trinn hjelpeside","All request list":"Alle forespørsler","Allow admin to assign/un-assign custom points to users":"Tillat administrator å tildele/oppheve tildeling av egendefinerte poeng til brukere","Base points for user to begin with":"Grunnpoeng for brukeren til å begynne med","Base points will be updated for all the users, any changes will reflect for all the users.":"Basispunkter vil bli oppdatert for alle brukerne, eventuelle endringer vil reflektere for alle brukerne.","Allocate points for interaction":"Tildel poeng for samhandling","Upvoting post":"Stemmer opp innlegg","creating a comment":"opprette en kommentar","creating a reply":"opprette et svar","Getting upvote to their post":"Får stemme til innlegget deres","Getting comment to their post":"Får kommentar til innlegget deres","Getting reply to their comment":"Får svar på kommentaren deres","Creating a post":"Oppretter et innlegg",Visiblity:"Synlighet","Move Up":"Flytt opp","Move Down":"Flytt ned","Create embedded section":"Opprett en innebygd seksjon","Preview area":"Forhåndsvisningsområde","Theme selector":"Temavelger","Community Theme":"Fellesskapstema","Select theme":"Velg tema","Select brand color":"Velg merkefarge","Customize your button color to match your brand":"Tilpass knappefargen for å matche merket ditt","Select on button text color":"Velg tekstfarge på knappen","Suggestion: Keep inverted contrast against brand color":"Forslag: Hold omvendt kontrast mot merkefargen",Billing:"Fakturering","Current plan":"Gjeldende plan","You are current on Free PLan":"Du er oppdatert på gratis PLan","Renew on: NA":"Forny på: NA",Select:"Velge","Email us at":"Send oss ​​en e-post på","Compare plan":"Sammenlign plan","API Keys":"API-nøkler","Create new key":"Opprett ny nøkkel","Total keys":"Totalt nøkler","Keep your API keys safe! You can use them to access specific feature & let cetain apps perfrom certain actions on your behalf on the platform.":"Hold API-nøklene dine trygge! Du kan bruke dem til å få tilgang til spesifikke funksjoner og la enkelte apper utføre visse handlinger på dine vegne på plattformen.","Key name":"Nøkkelnavn","Key value":"Nøkkelverdi",Action:"Handling","Group updated!":"Gruppen er oppdatert!","Are you sure you want to":"Er du sikker på at du vil","Make Moderator":"Lag moderator","Remove from group":"Fjern fra gruppen","Show All":"Vis alle","Change Role":"Bytt rolle",Close:"Lukke",copy:"kopiere",LINKS:"LENKER","Email Id":"E-post-ID",Name:"Navn","Search for an image":"Søk etter et bilde","Crop Image":"Beskjær bilde","No photos found":"Ingen bilder funnet",Community:"Fellesskap","Banner ratio - 16:9":"Bannerforhold - 16:9","Banner Ratio - 16:6":"Bannerforhold - 16:6","Share on mail":"Del på mail","Share on Telegram":"Del på Telegram","Share on Whatsapp":"Del på Whatsapp","Share on Linkedin":"Del på Linkedin","Share on Facebook":"Del på Facebook","Share on Twitter":"Del på Twitter","Pin Post":"Pin Post","Heading (optional)":"Overskrift (valgfritt)","Select section":"Velg seksjon",Gif:"Gif","Create Custom Widget":"Lag egendefinert widget","Are you sure you want to delete this widget?":"Er du sikker på at du vil slette denne widgeten?","Go to event":"Gå til arrangementet","Add Tags":"Legg til tagger","Create Tag":"Opprett tag","Title (Optional)":"Tittel (valgfritt)","Search Gif":"Søk Gif","What's on your mind":"Hva tenker du på","Looks like nothing available here right now.":"Ser ut som ingenting tilgjengelig her akkurat nå.","Try exploring other tabs":"Prøv å utforske andre faner","Delete Widget":"Slett widget","Please select a section to post":"Vennligst velg en seksjon å legge ut","Post added successfully!":"Innlegget ble lagt til!","Failed to create post. Please check post content and retry again.":"Kunne ikke opprette innlegget. Sjekk innleggets innhold og prøv igjen.","Are you sure you want to discard current post?":"Er du sikker på at du vil forkaste gjeldende innlegg?","By default it will take up the image uploaded with the post":"Som standard vil det ta opp bildet som er lastet opp med innlegget","Quiz can be only viewed and attempted from mobile device right now!":"Quiz kan bare sees og forsøkes fra mobilenhet akkurat nå!","Community Banner":"Fellesskapsbanner","Change Cover":"Bytt deksel","Suggestions: Welcome to my community etc":"Forslag: Velkommen til fellesskapet mitt osv","(edited)":"(redigert)","Aspect ratio (recommended)":"Sideforhold (anbefalt)","Banner details updated!":"Bannerdetaljer oppdatert!","Refresh if changes are not visible!":"Oppdater hvis endringer ikke er synlige!","Banner details could not be updated!":"Bannerdetaljer kunne ikke oppdateres!","Post deleted":"Innlegg slettet","Post not available. It may have been deleted.":"Innlegget er ikke tilgjengelig. Det kan ha blitt slettet.",Admin:"Admin",Moderator:"Moderator","Bookmark added!":"Bokmerke lagt til!","Bookmark removed":"Bokmerket er fjernet","Failed performing action!":"Kunne ikke utføre handlingen!","Copy this link to share on other platforms":"Kopier denne lenken for å dele på andre plattformer","View this event":"Se denne hendelsen",Event:"Hendelse","Join Meeting":"Bli med på møtet","The live meeting has ended":"Direktemøtet er avsluttet","read more...":"les mer...","Load more comments":"Last inn flere kommentarer","Post Reply":"Legg inn svar","Post Comment":"Legg inn kommentar",more:"flere",upvoted:"stemte opp","1 Upvote":"1 Stem opp","1 Comment":"1 kommentar","Please enter a title":"Vennligst skriv inn en tittel","Please enter a url link":"Vennligst skriv inn en url-lenke","Please enter button title":"Vennligst skriv inn knappens tittel","Button label must be at least 20 characters":"Knappeetiketten må være på minst 20 tegn","Please enter valid url":"Vennligst skriv inn gyldig url","Suggestions: Know more, Join, Apply...":"Forslag: Finn ut mer, bli med, søk...",URL:"URL","Community Events":"Fellesarrangementer","Widget deleted successfully":"Widget er slettet","Community Top Contributors":"Fellesskapets beste bidragsytere",points:"poeng","Points cannot be greater than current points":"Poeng kan ikke være større enn gjeldende poeng","Point cannot be a negative value":"Punkt kan ikke være en negativ verdi","Point cannot be a decimal point":"Punkt kan ikke være et desimaltegn","Please enter a valid number":"Vennligst skriv inn et gyldig nummer","Karma points updated successfully":"Karma-punkter ble oppdatert","Error in updating karma points":"Feil under oppdatering av karmapunkter","Add karma points":"Legg til karmapoeng","Minus karma points":"Minus karmapoeng","Total Karma points:":"Totalt karmapoeng:","Enter no. of karma points":"Skriv inn nr. av karmapoeng","Minus Points":"Minus poeng","Trending Post":"Populært innlegg","No visible description":"Ingen synlig beskrivelse","Picture ratio: 1:1":"Bildeforhold: 1:1","home feed":"hjemmefôr","Event name is invalid!":"Navnet på arrangementet er ugyldig!",custom:"skikk","Custom widget updated successfully":"Tilpasset widget ble oppdatert","Name invalid!":"Navnet er ugyldig!","Current timezone:":"Gjeldende tidssone:","can be updated from community settings":"kan oppdateres fra fellesskapsinnstillingene","Event created successfully":"Arrangementet ble opprettet","Error in creating event":"Feil under oppretting av arrangement",Attendees:"Deltakere","Do you wish to notify these changes to attendees?":"Ønsker du å varsle deltakerne om disse endringene?","users wants to attend this event":"brukere ønsker å delta på dette arrangementet","Yes, Notify them":"Ja, gi beskjed til dem","No, its okay":"Nei, det er greit","Do you wish to notify that event is cancelled?":"Ønsker du å varsle om at arrangementet er avlyst?","Are you sure you want to delete the event?":"Er du sikker på at du vil slette arrangementet?","Delete Event":"Slett hendelse","New Event":"Ny begivenhet","Accept Invitation":"Godta invitasjon",Requested:"Forespurt",Declined:"Avslått","Request Access":"Be om tilgang","Enroll for":"Meld deg på",Housefull:"Husfull","Just copy paste this code wherever you want it to be embedded:":"Bare kopier og lim inn denne koden der du vil at den skal være innebygd:",Ended:"Avsluttet","Error getting events":"Feil ved henting av hendelser","Events could not be fetched!":"Begivenheter kunne ikke hentes!","Show Attendees":"Vis deltakere",Subscribers:"Abonnenter","Make this a closed section":"Gjør dette til en lukket seksjon","Update Section":"Oppdateringsseksjon","Valid section name required!":"Gyldig seksjonsnavn kreves!","Enter section name":"Skriv inn seksjonsnavn","Community Admin":"Fellesskapsadministrator",Embed:"Bygg inn","Invite to":"Inviter til","Please enter a valid email address":"Vennligst skriv inn en gyldig e-postadresse","Invitation sent successfully":"Invitasjonen ble sendt","Error sending invitation":"Feil under sending av invitasjon","Email is not valid!":"E-post er ikke gyldig!","Data could not be loaded!":"Data kunne ikke lastes!","Posted in":"Skrevet i","Invite Members Individually":"Inviter medlemmer individuelt","Start a discussion":"Start en diskusjon","Post something":"Legg ut noe","Invite your audience":"Inviter publikum","Choose Plan":"Velg Plan",or:"eller","Create a link":"Opprett en lenke","Add link":"Legg til lenke","Update link":"Oppdater lenke","Add shortcut to your most used tools":"Legg til snarvei til de mest brukte verktøyene dine","Your website, Instagram Channel, Facebook profile etc":"Din nettside, Instagram-kanal, Facebook-profil osv","Valid link name required!":"Gyldig lenkenavn kreves!","Valid url required, and make sure you are not missing http:// or https://":"Gyldig url kreves, og sørg for at du ikke mangler http:// eller https://","Invite to__1":"Inviter til","Link Name":"Koblingsnavn","Link URL":"Link URL","Could not subscribe to":"Kunne ikke abonnere på","Subscribed to":"Abonner på","By default it will take up the community banner uploaded with the community":"Som standard vil den ta opp fellesskapsbanneret som er lastet opp med fellesskapet","Created by":"Laget av","Online Event (Meeting link will be visible once registered for the event)":"Online arrangement (Møtelink vil være synlig når du er registrert for arrangementet)","Join Call":"Bli med i Call","Please login to book this event":"Vennligst logg inn for å bestille dette arrangementet","Commented on":"Kommenterte","Replied to":"svarte på","Looks like it's lonely here.":"Ser ut som det er ensomt her.","Try exploring other sections and groups.":"Prøv å utforske andre seksjoner og grupper.","Please proceed with the payment or contact admin to gain access to this group.":"Fortsett med betalingen eller kontakt administrator for å få tilgang til denne gruppen.","This is a closed group You'll need access to this group.":"Dette er en lukket gruppe. Du trenger tilgang til denne gruppen.","You have no bookmarks right now.":"Du har ingen bokmerker akkurat nå.","The user hasn't posted anything yet publicly.":"Brukeren har ikke lagt ut noe offentlig ennå.","No activity to show.":"Ingen aktivitet å vise.","Are you sure you want to unsubscribe the community?":"Er du sikker på at du vil avslutte abonnementet på fellesskapet?","deals left":"avtaler igjen","Something went wrong while loading posts":"Noe gikk galt under innlasting av innlegg","Could not unsubscribe from":"Kunne ikke melde deg av","Unsubscribed from":"Avmeldt fra","Login to view this page":"Logg inn for å se denne siden",Login:"Logg inn","There was some error while doing the action!":"Det oppsto en feil under handlingen!","Unable to delete section!":"Kan ikke slette delen!",__2:"",__3:"",__4:"","Home page":"Hjemmeside","Members Directory":"Medlemskatalog",Calendar:"Kalender","Create Group":"Opprett gruppe","Start Live Session":"Start Live Session",Home__1:"Hjem",Following:"Følgende",__5:"","Post Card":"Postkort",Like:"Like",Comment__1:"Kommentar",Comment__2:"Kommentar",Share__1:"Dele",Report:"Rapportere","Follow User":"Følg bruker","Report User":"Rapporter bruker","Report Post":"Rapporter innlegg",__6:"","LeaderBoard Floating pop up":"Leaderboard Flytende pop up","Go to leaderboard":"Gå til ledertavlen","Total karma points":"Totalt karmapoeng",Comments__1:"Kommentarer",Upvotes__1:"Oppstemmer",Replies__1:"Svarer",Post__1:"Stolpe","Custom Points__1":"Egendefinerte poeng","Base Points":"Basispoeng",__7:"",Channel:"Kanal","This is a private channel":"Dette er en privat kanal","You'll need access to this channel":"Du trenger tilgang til denne kanalen",__8:"","Profile Page":"Profilside",Followers:"Følgere",Activities:"Aktiviteter",__9:"","Settings Page":"Innstillingsside","Go back to community":"Gå tilbake til fellesskapet",Account:"Konto","Notification Centre":"Varslingssenter",__10:"","Edit Profile Page":"Rediger profilside","Set profile Picture":"Angi profilbilde","Your name__1":"Navnet ditt",Subtitle:"Undertekst","(Max char 60)":"(Maks røye 60)","User Id":"Bruker-ID","Short Bio":"Kort biografi","Link For Social Account":"Link for sosial konto","This will be displayed on your profile__1":"Dette vil vises på profilen din","Add Social handles":"Legg til sosiale håndtak",__11:"","Verification Page":"Bekreftelsesside",Email__1:"E-post",Verified__1:"Verifisert",__12:"","Manage your personal account notification preferences__1":"Administrer dine personlige kontovarslingspreferanser",Preferences:"Preferanser","Email Notification":"E-postvarsling","Notify me about comment on my posts":"Gi meg beskjed om kommentar til innleggene mine","Notify me about replies on my comment":"Gi meg beskjed om svar på kommentaren min","Notify me about upvote on my post":"Gi meg beskjed om oppstemme på innlegget mitt","Notify me about reaction to my comment":"Gi meg beskjed om reaksjon på kommentaren min","Notify me about reaction on my reply__1":"Gi meg beskjed om reaksjon på svaret mitt","Notify me about direct message__1":"Gi meg beskjed om direktemelding","Notify me about mentions":"Gi meg beskjed om omtaler","Notification for new posts__1":"Varsling for nye innlegg","Only groups and channel available which you are part of. You can also control notification":"Kun grupper og kanal tilgjengelig som du er en del av. Du kan også kontrollere varsling","Group & Channels":"Gruppe og kanaler","All Activity":"All aktivitet","Post by admin__1":"Innlegg av admin","No Notification__1":"Ingen varsel",__13:"","Direct Message__1":"Direkte melding",Inbox:"Innboks","No chats found":"Ingen chatter funnet",__14:"","Create Post Popup":"Opprett innleggspopup","Create Post in":"Opprett innlegg i","Select Channel":"Velg kanal",__15:"","Dark mode":"Mørk modus",Feed:"Strøm",Saved:"Lagret",Workflows:"Arbeidsflyter",Rewards:"Belønninger",Networking:"Nettverksbygging",Course:"Kurs","Member Directory":"Medlemskatalog","Email Marketing":"E-postmarkedsføring",Analytics:"Analyse","Log out":"Logg ut","Switch community":"Bytt fellesskap",Support:"Støtte","Select topic":"Velg emne","Featured Posts":"Utvalgte innlegg","Featured posts":"Utvalgte innlegg",Courses:"Kurs","Explore courses and learning paths in your community.":"Utforsk kurs og læringsløp i fellesskapet ditt.","Add course":"Legg til kurs","Search title, description, or creator…":"Søk etter tittel, beskrivelse eller oppretter…","Search courses":"Søk i kurs","Clear search":"Tøm søk","Filter courses":"Filtrer kurs","Sort courses":"Sorter kurs","Clear filters":"Tøm filtre","{count} course":"{count} kurs","{count} courses":"{count} kurs",Updating:"Oppdaterer","Could not load courses":"Kunne ikke laste inn kurs","Something went wrong. Please try again.":"Noe gikk galt. Prøv igjen.",Retry:"Prøv igjen","No courses found":"Ingen kurs funnet","Try another search term or change the filter.":"Prøv et annet søkeord eller endre filteret.","No courses available":"Ingen kurs tilgjengelig","Create the first course for your community.":"Opprett det første kurset for fellesskapet ditt.","Check back when new courses are published.":"Kom tilbake når nye kurs er publisert.","Showing {shown} of {total} course":"Viser {shown} av {total} kurs","Showing {shown} of {total} courses":"Viser {shown} av {total} kurs","Show less":"Vis mindre","Read more":"Les mer","Request sent":"Forespørsel sendt","An admin will review your enrollment request.":"En administrator vil vurdere påmeldingsforespørselen din.",Enrolled:"Påmeldt","You can start learning now.":"Du kan begynne å lære nå.","Something went wrong.":"Noe gikk galt.","Could not join course":"Kunne ikke bli med i kurset","No lessons yet":"Ingen leksjoner ennå","Content will appear when lessons are published.":"Innholdet vises når leksjonene er publisert.","Course deleted":"Kurset er slettet","Could not delete course":"Kunne ikke slette kurset","Course duplicated":"Kurset er duplisert","The copy was created as a draft.":"Kopien ble opprettet som et utkast.","Could not duplicate course":"Kunne ikke duplisere kurset","Left course":"Du har forlatt kurset","Could not leave course":"Kunne ikke forlate kurset","Continue learning":"Fortsett å lære","Buy now":"Kjøp nå","Send request to enroll":"Send forespørsel om påmelding","Enroll now":"Meld deg på nå","Course not found":"Fant ikke kurset","This course may have been removed or you lack access.":"Kurset kan ha blitt fjernet, eller du har ikke tilgang.","Back to Courses":"Tilbake til kurset","By {name}":"Av {name}","{count} lesson":"{count} leksjon","{count} lessons":"{count} leksjoner","Total time to complete":"Total tid for å fullføre","Attached to {group}":"Knyttet til {group}",Progress:"Fremgang","{done}/{total} lessons · {percent}%":"{done}/{total} leksjoner · {percent} %","Edit course":"Rediger kurs","Duplicate course":"Dupliser kurs","Delete course":"Slett kurs","Course access is included with your active paid access":"Kurstilgang er inkludert i din aktive betalte tilgang","Leave course":"Forlat kurs",Content:"Innhold","Quiz results":"Quizresultater","Delete course?":"Slette kurset?","All course content and member progress will be permanently removed.":"Alt kursinnhold og all medlemsfremgang slettes permanent.","Leave course?":"Forlate kurset?","You will lose access to lessons until you enroll again.":"Du mister tilgangen til leksjonene til du melder deg på igjen.","Not enrolled":"Ikke påmeldt","Course content unlocks once you are enrolled. Request access or purchase membership if required.":"Kursinnholdet låses opp når du er påmeldt. Be om tilgang eller kjøp medlemskap hvis det kreves.","Add section":"Legg til seksjon","No content yet":"Ikke noe innhold ennå","Add a section to start building this course.":"Legg til en seksjon for å begynne å bygge dette kurset.","Content will be available when the course starts.":"Innholdet blir tilgjengelig når kurset starter.","{count} comment":"{count} kommentar","{count} comments":"{count} kommentarer","No comments on this course yet.":"Ingen kommentarer på dette kurset ennå.","Showing {from}-{to} of {total} comments":"Viser {from}–{to} av {total} kommentarer",Lesson:"Leksjon","Unlocks {date}":"Låses opp {date}","{count} day after enrollment":"{count} dag etter påmelding","{count} days after enrollment":"{count} dager etter påmelding","Releases {date}":"Slippes {date}","Section deleted":"Seksjonen er slettet","Could not delete section":"Kunne ikke slette seksjonen","Lesson updated":"Leksjonen er oppdatert","Lesson added":"Leksjonen er lagt til","Could not save lesson":"Kunne ikke lagre leksjonen","Lesson deleted":"Leksjonen er slettet","Could not delete lesson":"Kunne ikke slette leksjonen","Lesson duplicated as draft":"Leksjonen er duplisert som utkast","Could not duplicate lesson":"Kunne ikke duplisere leksjonen","Total time for this section":"Total tid for denne seksjonen","Edit section":"Rediger seksjon","Delete section":"Slett seksjon","Lessons will appear here once added.":"Leksjoner vises her når de er lagt til.","Not released yet":"Ikke sluppet ennå","Complete the previous lesson first":"Fullfør den forrige leksjonen først","Time to complete":"Tid for å fullføre","Actions for {title}":"Handlinger for {title}","Edit lesson":"Rediger leksjon","Duplicate lesson":"Dupliser leksjon","Delete lesson":"Slett leksjon",Add:"Legg til","Add lesson":"Legg til leksjon","Delete section?":"Slette seksjonen?",'This removes "{name}" and all lessons inside it.':"Dette fjerner «{name}» og alle leksjonene i den.","Delete lesson?":"Slette leksjonen?",'This removes "{title}" permanently.':"Dette fjerner «{title}» permanent.","Lesson title":"Leksjonstittel",Minutes:"Minutter","Time to complete, in minutes":"Tid for å fullføre, i minutter","How long this lesson takes, in minutes":"Hvor lang tid denne leksjonen tar, i minutter","Joined group":"Ble med i gruppen","You're now in {group}. Enrolling you in the course…":"Du er nå med i {group}. Melder deg på kurset…","An admin will review your group request. After you're accepted you can enroll in the course.":"En administrator vil vurdere gruppeforespørselen din. Etter at du er godkjent, kan du melde deg på kurset.","Could not join group":"Kunne ikke bli med i gruppen","This course moved to {group}":"Dette kurset er flyttet til {group}","Join {group} first":"Bli med i {group} først","This course is now part of “{group}”. Join its new group to continue accessing the course.":"Dette kurset er nå en del av «{group}». Bli med i den nye gruppen for å beholde tilgangen til kurset.","This course belongs to “{group}”. Join the group before enrolling and starting the course.":"Dette kurset tilhører «{group}». Bli med i gruppen før du melder deg på og starter kurset.","Paid group access":"Betalt gruppetilgang","Membership required":"Medlemskap kreves","Explore the available plans for {group}, choose the one that suits you, and return here after purchase to begin learning.":"Utforsk de tilgjengelige planene for {group}, velg den som passer deg, og kom tilbake hit etter kjøpet for å begynne å lære.","Your request to join this group is already pending. You'll be able to enroll after an admin accepts it.":"Forespørselen din om å bli med i denne gruppen venter fortsatt. Du kan melde deg på etter at en administrator har godkjent den.","This is a {type} group. Continue to join instantly.":"Dette er en {type} gruppe. Fortsett for å bli med med en gang.","This is a {type} group. Continue to send a request to the group admins.":"Dette er en {type} gruppe. Fortsett for å sende en forespørsel til gruppeadministratorene.","Explore group":"Utforsk gruppen","Join group":"Bli med i gruppen","Request to join group":"Be om å bli med i gruppen","You can watch this lecture now.":"Du kan se denne forelesningen nå.","Could not enroll":"Kunne ikke melde deg på","Want to view this lecture?":"Vil du se denne forelesningen?","Your enrollment request is waiting for approval. You'll be able to watch this lecture after an admin accepts it.":"Påmeldingsforespørselen din venter på godkjenning. Du kan se forelesningen etter at en administrator har godkjent den.","Enroll in {course} to watch this lecture and the rest of the course.":"Meld deg på {course} for å se denne forelesningen og resten av kurset.","Back to course":"Tilbake til kurset","Enroll to view lecture":"Meld deg på for å se forelesningen","Choose a membership plan that includes {course}.":"Velg en medlemsplan som inkluderer {course}.",Subscribed:"Abonnerer","Payment successful":"Betalingen var vellykket","You can now request access to this course.":"Du kan nå be om tilgang til dette kurset.","Checkout failed":"Betalingen mislyktes","Buy group access":"Kjøp gruppetilgang","No membership plans are linked to this group yet.":"Ingen medlemsplaner er knyttet til denne gruppen ennå.","Membership plan":"Medlemsplan","Subscribe free":"Abonner gratis","{day} at {time}":"{day} kl. {time}","All courses":"Alle kurs",Published:"Publisert",Drafts:"Utkast","Default order":"Standardrekkefølge","Title A–Z":"Tittel A–Å","Shortest first":"Korteste først","Longest first":"Lengste først","Most lessons":"Flest leksjoner",Draft:"Utkast",Personal:"Personlig","Community member":"Fellesskapsmedlem","Your browser does not support video playback.":"Nettleseren din støtter ikke videoavspilling.","Audio resource":"Lydressurs","Listen without leaving the Knowledge Hub":"Lytt uten å forlate Knowledge Hub","Your browser does not support audio playback.":"Nettleseren din støtter ikke lydavspilling.","Attached files":"Vedlagte filer",FILE:"FIL",Hide:"Skjul",View:"Vis",Download:"Last ned","Resource media":"Ressursmedia",Audio:"Lyd",Attachments:"Vedlegg","About this resource":"Om denne ressursen","Saving your resource…":"Lagrer ressursen din…","Finishing the upload…":"Fullfører opplastingen…","Uploading 1 file · {percent}%":"Laster opp 1 fil · {percent} %","Uploading {count} files · {percent}%":"Laster opp {count} filer · {percent} %","Remove {name}":"Fjern {name}","Description cannot exceed {max} characters":"Beskrivelsen kan ikke være lengre enn {max} tegn","Your title":"Tittelen din","Add a cover image before publishing":"Legg til et omslagsbilde før du publiserer","Resource updated":"Ressursen er oppdatert","Resource shared":"Ressursen er delt","Your changes are now live.":"Endringene dine er nå live.","It is now available in the Knowledge Hub.":"Den er nå tilgjengelig i Knowledge Hub.","Upload cancelled":"Opplastingen er avbrutt","Nothing was saved. Your files are still in the form.":"Ingenting ble lagret. Filene dine ligger fortsatt i skjemaet.","Could not update resource":"Kunne ikke oppdatere ressursen","Could not share resource":"Kunne ikke dele ressursen","Please try again.":"Prøv igjen.","That file is not an image":"Den filen er ikke et bilde","Choose a PNG, JPG or WebP for the cover.":"Velg en PNG, JPG eller WebP som omslag.","Couldn't use that cover":"Kunne ikke bruke det omslaget","Pick another one, or choose a picture of your own.":"Velg et annet, eller velg et eget bilde.","Couldn't open the current cover":"Kunne ikke åpne det nåværende omslaget","Choose the image again to crop it.":"Velg bildet på nytt for å beskjære det.","Video too large":"Videoen er for stor","Videos can be up to {limit}.":"Videoer kan være opptil {limit}.","That file is not audio":"Den filen er ikke lyd","Choose an MP3, M4A, WAV or other audio file.":"Velg en MP3-, M4A-, WAV- eller annen lydfil.","Audio too large":"Lyden er for stor","Audio files can be up to {size} MB.":"Lydfiler kan være opptil {size} MB.","File too large":"Filen er for stor","{count} files too large":"{count} filer er for store",'"{name}" was not added. Files can be up to {limit}.':"«{name}» ble ikke lagt til. Filer kan være opptil {limit}.","{names} were not added. Files can be up to {size} MB ({videoLimit} for a video).":"{names} ble ikke lagt til. Filer kan være opptil {size} MB ({videoLimit} for en video).","Up to 5 attachments":"Opptil 5 vedlegg","Only the first {count} file was added.":"Bare den første {count} filen ble lagt til.","Only the first {count} files were added.":"Bare de første {count} filene ble lagt til.","Remove one to add another.":"Fjern en for å legge til en annen.","Edit resource":"Rediger ressurs","Share a resource":"Del en ressurs","Update your resource. Saved changes will appear immediately.":"Oppdater ressursen din. Lagrede endringer vises umiddelbart.","Add a cover and a description, then optionally a video, an audio file and files to download.":"Legg til et omslag og en beskrivelse, og eventuelt en video, en lydfil og filer som kan lastes ned.",Details:"Detaljer","Cover image file":"Fil for omslagsbilde","Video file":"Videofil","Audio file":"Lydfil","Attachment files":"Vedleggsfiler","Cover image":"Omslagsbilde","The picture on this resource's card in the library. It is not a download. After you pick a picture you choose which part to show, in the card's 16:9 shape, so nothing is cut off in the library. A large photo is resized before it is sent, so it uploads faster; the original on your device is not changed.":"Bildet på ressursens kort i biblioteket. Det er ikke en nedlasting. Etter at du har valgt et bilde, velger du hvilken del som skal vises, i kortets 16:9-format, slik at ingenting kuttes i biblioteket. Et stort bilde endres i størrelse før det sendes, slik at det lastes opp raskere; originalen på enheten din endres ikke.","Cover preview":"Forhåndsvisning av omslag","Choose a cover image":"Velg et omslagsbilde","PNG, JPG or WebP · you choose the part to show next":"PNG, JPG eller WebP · du velger hvilken del som skal vises neste","Replace cover":"Bytt omslag","Remove cover":"Fjern omslag","Without a cover, the card shows a plain one in the community's colour.":"Uten omslag viser kortet et enkelt omslag i fellesskapets farge.","Current cover":"Nåværende omslag","Adjust crop":"Juster beskjæring","No picture to hand? Use a ready-made cover":"Har du ikke et bilde for hånden? Bruk et ferdig omslag","Cover subjects":"Omslagstemaer","All ({count})":"Alle ({count})","Earlier covers":"Tidligere omslag","Ready-made covers":"Ferdige omslag","Use the {name} cover":"Bruk omslaget {name}","More covers":"Flere omslag",Title:"Tittel","What will members learn?":"Hva skal medlemmene lære?","Shorten the title to {max} characters or fewer.":"Forkort tittelen til {max} tegn eller færre.","Share context, key takeaways, and why this is useful…":"Del bakgrunn, hovedpoeng og hvorfor dette er nyttig…","Formatting counts toward the limit. Shorten the description to {max} characters or fewer.":"Formatering teller med i grensen. Forkort beskrivelsen til {max} tegn eller færre.","Media to play":"Media som skal spilles av","(optional)":"(valgfritt)","Members watch or listen to these inside the resource.":"Medlemmer ser på eller lytter til dette inne i ressursen.","· one video, up to {limit}, or a link":"· én video, opptil {limit}, eller en lenke","Current uploaded video":"Nåværende opplastede video","Already uploaded":"Allerede lastet opp","Upload video":"Last opp video","YouTube or Vimeo URL":"YouTube- eller Vimeo-URL","Enter a valid YouTube or Vimeo link.":"Skriv inn en gyldig YouTube- eller Vimeo-lenke.","· one audio file":"· én lydfil","Current audio file":"Nåværende lydfil","Upload audio":"Last opp lyd","Files to download":"Filer som kan lastes ned","PDFs, Word, Excel or any other file members can download · {count}/5":"PDF-er, Word, Excel eller andre filer medlemmer kan laste ned · {count}/5","Add files":"Legg til filer","PDF preview":"PDF-forhåndsvisning","PDF attachment preview":"Forhåndsvisning av PDF-vedlegg","This is how members will see your resource. Nothing is shared until you save.":"Slik ser medlemmene ressursen din. Ingenting deles før du lagrer.","This is how members will see your resource. Nothing is shared until you publish.":"Slik ser medlemmene ressursen din. Ingenting deles før du publiserer.","When opened":"Når den åpnes","In the library":"I biblioteket","{done}/{total} done":"{done}/{total} ferdig","Upload progress":"Opplastingsfremdrift","Keep this window open until it finishes.":"Hold dette vinduet åpent til det er ferdig.","Cancel upload":"Avbryt opplasting","Save changes":"Lagre endringer","Publish resource":"Publiser ressurs","Choose what shows on the cover":"Velg hva som vises på omslaget","Knowledge Hub":"Knowledge Hub","You created this resource.":"Du opprettet denne ressursen.","Moderator actions":"Moderatorhandlinger","This file can't be previewed. Use Download instead.":"Denne filen kan ikke forhåndsvises. Bruk Last ned i stedet.","Resource deleted":"Ressursen er slettet","Could not delete resource":"Kunne ikke slette ressursen","This resource is no longer available":"Denne ressursen er ikke lenger tilgjengelig","Couldn't open that resource":"Kunne ikke åpne den ressursen","It may have been deleted. Here is the rest of the library.":"Den kan ha blitt slettet. Her er resten av biblioteket.","Community library":"Fellesskapsbibliotek","Useful ideas, explainers and media shared by your community.":"Nyttige ideer, forklaringer og media delt av fellesskapet ditt.","Search title, description, or author…":"Søk etter tittel, beskrivelse eller forfatter…","Search Knowledge Hub resources":"Søk i Knowledge Hub-ressurser","All content types":"Alle innholdstyper","Any date":"Når som helst","Past 7 days":"Siste 7 dager","Past 30 days":"Siste 30 dager","Past 90 days":"Siste 90 dager","Custom dates":"Egendefinerte datoer","Sort resources":"Sorter ressurser","Newest first":"Nyeste først","Most liked":"Mest likt","Could not load the Knowledge Hub":"Kunne ikke laste inn Knowledge Hub","Please check your connection and try again.":"Sjekk tilkoblingen din og prøv igjen.","Build your community library":"Bygg fellesskapets bibliotek","Share the first useful guide, talk, or audio resource with everyone.":"Del den første nyttige veiledningen, foredraget eller lydressursen med alle.","Share the first resource":"Del den første ressursen","No resources found":"Ingen ressurser funnet","Try another search term or change the filters.":"Prøv et annet søkeord eller endre filtrene.","Showing {shown} of {total} resource":"Viser {shown} av {total} ressurs","Showing {shown} of {total} resources":"Viser {shown} av {total} ressurser","Delete this resource?":"Slette denne ressursen?","“{title}” will be permanently removed from the Knowledge Hub. This action cannot be undone.":"«{title}» fjernes permanent fra Knowledge Hub. Dette kan ikke angres.","Delete resource":"Slett ressurs","Remove your like":"Fjern liker-markeringen","Like this resource":"Lik denne ressursen","You like this. Click to remove your like.":"Du liker dette. Klikk for å fjerne liker-markeringen.","Link copied":"Lenken er kopiert","It opens this resource in the Knowledge Hub.":"Den åpner denne ressursen i Knowledge Hub.","Couldn't copy link":"Kunne ikke kopiere lenken","Post in review":"Innlegget er til vurdering","An admin will review it before it appears.":"En administrator vil vurdere det før det vises.",Shared:"Delt","Posted to {channel}":"Publisert i {channel}","Couldn't share the resource":"Kunne ikke dele ressursen","Copy link":"Kopier lenke","Post to a channel":"Publiser i en kanal","Send in a message":"Send i en melding","Posts “{title}” with a link that opens it in the Knowledge Hub.":"Publiserer «{title}» med en lenke som åpner den i Knowledge Hub.","Select channel":"Velg kanal","Add a message to introduce this to your community (optional). Type @ to mention someone.":"Legg til en melding for å presentere dette for fellesskapet ditt (valgfritt). Skriv @ for å nevne noen.","Posting…":"Publiserer…","Share it in a message. The link opens the resource in the Knowledge Hub.":"Del den i en melding. Lenken åpner ressursen i Knowledge Hub.","{count} file":"{count} fil","{count} files":"{count} filer","Open {title} in the Knowledge Hub":"Åpne {title} i Knowledge Hub","Like this course":"Lik dette kurset","It opens this course's page.":"Den åpner siden til dette kurset.","Posts “{title}” as a card members can like and open. Enrolling works as it does on the course page.":"Publiserer «{title}» som et kort medlemmer kan like og åpne. Påmelding fungerer som på kurssiden.","Couldn't share the course":"Kunne ikke dele kurset","Share it in a message. The link opens the course's page.":"Del det i en melding. Lenken åpner kursets side.","Open the course {title}":"Åpne kurset {title}","Paid plan":"Betalt plan","Unlock {feature}":"Lås opp {feature}","Your current plan doesn't include it. Choose a plan to start using it.":"Den nåværende planen din inkluderer ikke dette. Velg en plan for å ta det i bruk.","Included in every paid plan, from {price}.":"Inkludert i alle betalte planer, fra {price}.","Included in every paid plan.":"Inkludert i alle betalte planer.","See plans":"Se planer","Maybe later":"Kanskje senere","Reach your members in their inbox with campaigns, newsletters, sequences, funnels and forms.":"Nå medlemmene i innboksen deres med kampanjer, nyhetsbrev, sekvenser, trakter og skjemaer.","Send campaigns and newsletters to your audience":"Send kampanjer og nyhetsbrev til publikummet ditt","Automated sequences, funnels and sign-up forms":"Automatiske sekvenser, trakter og påmeldingsskjemaer","Audience management and delivery analytics":"Publikumsadministrasjon og leveringsanalyse","Automate your community: act when members join, post or reach a milestone, without writing code.":"Automatiser fellesskapet ditt: handle når medlemmer blir med, poster eller når en milepæl, uten å skrive kode.","Automations triggered by joins, posts, streaks and more":"Automatiseringer utløst av innmeldinger, innlegg, serier og mer","Multi-step actions: notify, tag, award points, send email":"Handlinger i flere trinn: varsle, tagge, gi poeng, sende e-post","Ready-made templates to start in minutes":"Ferdige maler for å komme i gang på minutter","Member Analytics":"Medlemsanalyse","See how each member uses your community: time spent, sessions and the pages they visit.":"Se hvordan hvert medlem bruker fellesskapet ditt: tid brukt, økter og sidene de besøker.","Time spent and sessions for every member":"Tid brukt og økter for hvert medlem","Page journeys: where members go and for how long":"Sidereiser: hvor medlemmene går og hvor lenge","Look up any member in Insights":"Slå opp hvilket som helst medlem i Insights","Content category":"Innholdskategori","Content categories":"Innholdskategorier","All categories":"Alle kategorier","No category":"Ingen kategori","Add “{name}”":"Legg til «{name}»","Filter by content category":"Filtrer etter innholdskategori","Search categories":"Søk i kategorier","Search or type a new category":"Søk eller skriv en ny kategori","Loading…":"Laster…","Couldn't load categories. Try again.":"Kunne ikke laste kategorier. Prøv igjen.","No categories match.":"Ingen kategorier passer.",Author:"Forfatter",Authors:"Forfattere","All authors":"Alle forfattere","Search authors":"Søk etter forfattere","Filter by author":"Filtrer etter forfatter","Couldn't load authors. Try again.":"Kunne ikke laste forfattere. Prøv igjen.","No authors match.":"Ingen forfattere passer.","No resources have been shared yet.":"Ingen ressurser er delt ennå.","No courses have been made yet.":"Ingen kurs er laget ennå.","Shows only the resources one member has shared. The list has everyone who has shared a resource here, with how many each has shared; type a name to find someone. You can combine it with the other filters and the search box.":"Viser bare ressursene ett medlem har delt. Listen har alle som har delt en ressurs her, med antall; skriv et navn for å finne noen. Kan kombineres med de andre filtrene og søket.","No resource has a category yet.":"Ingen ressurs har en kategori ennå.","Show more":"Vis mer","What kind of resource this is, such as a research paper or an opinion piece. Members can filter the Knowledge Hub by it. Pick one, or type your own and choose Add.":"Hva slags ressurs dette er, for eksempel en forskningsartikkel eller et debattinnlegg. Medlemmer kan filtrere Knowledge Hub etter den. Velg en, eller skriv din egen og velg Legg til.",Filters:"Filtre","{count} applied":"{count} brukt","Content type":"Innholdstype","Date shared":"Dato delt","Remove filter {name}":"Fjern filteret {name}","Research Paper":"Forskningsartikkel",Article:"Artikkel","Lecture/Talk":"Foredrag","Opinion Piece":"Debattinnlegg",General:"Generelt",Football:"Fotball",Education:"Utdanning",Physiotherapy:"Fysioterapi",Coaching:"Trenerarbeid","Sports Science":"Idrettsvitenskap","Strength & Conditioning":"Styrke og kondisjon",Recovery:"Restitusjon",Nutrition:"Ernæring",Medicine:"Medisin",Health:"Helse",Cars:"Biler",Entertainment:"Underholdning",Programming:"Programmering",Technology:"Teknologi",Business:"Næringsliv",Science:"Vitenskap",Engineering:"Ingeniørfag",Sports:"Sport",Arts:"Kunst",Travel:"Reise",Food:"Mat",Resources:"Ressurser","Could not load this course.":"Kunne ikke laste inn dette kurset.","Back to course overview":"Tilbake til kursoversikten","Preview as learner":"Forhåndsvis som elev","Close table of contents":"Lukk innholdsfortegnelsen","Join {group} to continue learning.":"Bli med i {group} for å fortsette å lære.","the course's current group":"kursets nåværende gruppe","Enroll in this course to watch the lecture.":"Meld deg på dette kurset for å se forelesningen.","Next lesson":"Neste leksjon","Table of contents":"Innholdsfortegnelse","Add a section to start building content.":"Legg til en seksjon for å begynne å bygge innhold.","No lessons available yet.":"Ingen leksjoner tilgjengelig ennå.","Lesson completed":"Leksjonen er fullført","Marked incomplete":"Merket som ikke fullført","Could not update progress":"Kunne ikke oppdatere fremgangen","Mark incomplete":"Merk som ikke fullført","Mark complete":"Merk som fullført","You need to join this course before you can view its lessons.":"Du må bli med i dette kurset før du kan se leksjonene.","Go to course overview":"Gå til kursoversikten","No lesson selected":"Ingen leksjon valgt","Pick a lesson from the table of contents.":"Velg en leksjon fra innholdsfortegnelsen.","Lesson {current} of {total}":"Leksjon {current} av {total}","This lesson has no written content yet.":"Denne leksjonen har ikke noe skrevet innhold ennå.",Block:"Blokk","In this lesson":"I denne leksjonen","Lesson content":"Leksjonsinnhold",Completed:"Fullført","Completed {date}":"Fullført {date}","Open PDF":"Åpne PDF","Quick check":"Hurtigsjekk",Assignment:"Oppgave","Submit your work in the lesson discussion below.":"Lever arbeidet ditt i leksjonsdiskusjonen nedenfor.",Quiz:"Quiz","Could not save quiz.":"Kunne ikke lagre quizen.","Could not submit quiz":"Kunne ikke levere quizen","Select all answers that apply.":"Velg alle svar som passer.","This is an open-ended check — continue when you are ready.":"Dette er en åpen sjekk — fortsett når du er klar.","Submit quiz":"Lever quiz","You {status} the quiz.":"Du {status} quizen.",passed:"besto","didn't pass":"besto ikke","Great job!":"Bra jobbet!","Review the answers below, then try again.":"Gå gjennom svarene nedenfor, og prøv så igjen.","Retake quiz":"Ta quizen på nytt",Score:"Poengsum","Correct answers":"Riktige svar",Correct:"Riktig",Incorrect:"Feil",You:"Du","Could not post your comment":"Kunne ikke publisere kommentaren din","Could not update the comment":"Kunne ikke oppdatere kommentaren","Could not delete the comment":"Kunne ikke slette kommentaren",Discussion:"Diskusjon","Loading comments…":"Laster inn kommentarer…","No comments yet — start the discussion.":"Ingen kommentarer ennå — start diskusjonen.","Add to the discussion…":"Bidra til diskusjonen…","Redirecting now…":"Omdirigerer nå…","Redirecting in {count} second":"Omdirigerer om {count} sekund","Redirecting in {count} seconds":"Omdirigerer om {count} sekunder","Lesson complete":"Leksjonen er fullført","Up next":"Neste",Stay:"Bli",Continue:"Fortsett","Quiz result":"Quizresultat","Question-by-question review of this learner's quiz attempt.":"Gjennomgang spørsmål for spørsmål av elevens quizforsøk.","Attempts: {count}":"Forsøk: {count}",Submitted:"Levert","You received {points} karma point.":"Du fikk {points} karmapoeng.","You received {points} karma points.":"Du fikk {points} karmapoeng.","Congratulations!":"Gratulerer!","You've successfully completed {course}.":"Du har fullført {course}.","Keep reviewing":"Fortsett å gjennomgå",Text:"Tekst","Send feedback":"Send tilbakemelding","You can attach up to {max} screenshots":"Du kan legge ved opptil {max} skjermbilder","Only the first {count} screenshot was added":"Bare det første {count} skjermbildet ble lagt til","Only the first {count} screenshots were added":"Bare de første {count} skjermbildene ble lagt til","Unsupported image type":"Bildetypen støttes ikke","Larger than 10 MB":"Større enn 10 MB","Upload failed":"Opplastingen mislyktes","Add a short title.":"Legg til en kort tittel","Please add a bit more detail ({min}+ characters).":"Legg til litt flere detaljer ({min}+ tegn)","Bug report sent":"Feilrapport sendt","Idea sent":"Idé sendt","Thanks! The SpatialChat Communities team will take a look.":"Takk! SpatialChat Communities-teamet tar en titt.","Couldn't send your feedback":"Kunne ikke sende tilbakemeldingen din","Report a problem or suggest an improvement to the SpatialChat Communities team.":"Rapporter et problem eller foreslå en forbedring til SpatialChat Communities-teamet.","Feedback type":"Type tilbakemelding","Report a bug":"Rapporter en feil","Suggest an idea":"Foreslå en idé","e.g. Verify code shows “Validation error!”":"f.eks. Bekreftelseskoden viser «Valideringsfeil!»","e.g. Let me schedule posts":"f.eks. La meg planlegge innlegg","What happened?":"Hva skjedde?","What would you like?":"Hva ønsker du?","What did you do, what did you expect, and what happened instead?":"Hva gjorde du, hva forventet du, og hva skjedde i stedet?","What problem are you trying to solve? How would this help you?":"Hvilket problem prøver du å løse? Hvordan ville dette hjelpe deg?",Screenshots:"Skjermbilder","(optional, up to {max})":"(valgfritt, opptil {max})",Uploading:"Laster opp","Add screenshot":"Legg til skjermbilde","or drop / paste (Ctrl/⌘+V) an image":"eller slipp / lim inn (Ctrl/⌘+V) et bilde","Screenshots that failed to upload won't be sent. Remove them or try again.":"Skjermbilder som ikke ble lastet opp, sendes ikke. Fjern dem eller prøv igjen.","Include technical details":"Ta med tekniske detaljer","(recommended)":"(anbefalt)","Page, browser, and no recent errors. Passwords, tokens and emails are removed.":"Side, nettleser og ingen nylige feil. Passord, tokens og e-postadresser fjernes.","Page, browser, and {count} recent error. Passwords, tokens and emails are removed.":"Side, nettleser og {count} nylig feil. Passord, tokens og e-postadresser fjernes.","Page, browser, and {count} recent errors. Passwords, tokens and emails are removed.":"Side, nettleser og {count} nylige feil. Passord, tokens og e-postadresser fjernes.","Page: {path}":"Side: {path}","Browser: {browser}":"Nettleser: {browser}","Screen: {width}x{height} · Build: {version}":"Skjerm: {width}x{height} · Build: {version}","No errors captured in this session.":"Ingen feil ble fanget opp i denne økten.","The SpatialChat Communities team may contact me about this":"SpatialChat Communities-teamet kan kontakte meg om dette","Uploading…":"Laster opp…","Send report":"Send rapport","Send idea":"Send idé","{points} earned":"{points} opptjent","{points} to spend":"{points} å bruke","Profile picture updated":"Profilbildet er oppdatert","Couldn't update picture":"Kunne ikke oppdatere bildet","Cover photo updated":"Omslagsbildet er oppdatert","Couldn't update cover":"Kunne ikke oppdatere omslaget","Link copied!":"Lenken er kopiert!","Profile link copied to clipboard.":"Profillenken er kopiert til utklippstavlen.",Cover:"Omslag","Joined {date}":"Ble med {date}","Badges & achievements":"Merker og prestasjoner","No badges earned yet — stay active to unlock your first one.":"Ingen merker opptjent ennå — vær aktiv for å låse opp det første.",Badge:"Merke","You haven't posted yet.":"Du har ikke publisert noe ennå.","No activity yet.":"Ingen aktivitet ennå.","Adjust cover photo":"Juster omslagsbilde","Add a bio and interests from":"Legg til en bio og interesser fra","to fill out your About section.":"for å fylle ut Om-seksjonen din.",Bio:"Bio",Interests:"Interesser","No achievement badges are configured for this community yet.":"Ingen prestasjonsmerker er satt opp for dette fellesskapet ennå.","Earned {date}":"Opptjent {date}","Profile updated":"Profilen er oppdatert","Your changes have been saved.":"Endringene dine er lagret.","Couldn't save profile":"Kunne ikke lagre profilen",Username:"Brukernavn","Checking availability…":"Sjekker tilgjengelighet…","Username is available":"Brukernavnet er ledig","Username is taken":"Brukernavnet er opptatt","3–64 chars: letters, numbers, _ or .":"3–64 tegn: bokstaver, tall, _ eller .",Headline:"Overskrift",Location:"Sted","Social links":"Sosiale lenker","Saving…":"Lagrer…","Couldn't update preference":"Kunne ikke oppdatere innstillingen","Email notifications":"E-postvarsler","Choose which activity on your content sends you an email.":"Velg hvilken aktivitet på innholdet ditt som sender deg en e-post.","Posts created":"Opprettede innlegg","Comments made":"Skrevne kommentarer","Replies made":"Skrevne svar","Likes given":"Gitte likes","Likes on your posts":"Likes på innleggene dine","Your posts commented":"Kommentarer på innleggene dine","Your replies received":"Svar du har mottatt","Followers gained":"Nye følgere","Live sessions":"Direktesendte økter","Admin-assigned":"Tildelt av admin",Other:"Annet","How you earned your {points}":"Slik opptjente du {points}","No points yet — post, comment and react to start earning.":"Ingen poeng ennå — publiser, kommenter og reager for å begynne å tjene poeng.","Language updated":"Språket er oppdatert","Using the community's language":"Bruker fellesskapets språk","Only you see this change.":"Bare du ser denne endringen.","Couldn't change your language":"Kunne ikke endre språket ditt",Language:"Språk","Menus, buttons and labels are shown in the language you pick here, for you only. Posts, comments and messages stay in the language they were written in. Other members keep the community's language unless they pick their own.":"Menyer, knapper og etiketter vises på språket du velger her, bare for deg. Innlegg, kommentarer og meldinger forblir på språket de ble skrevet på. Andre medlemmer beholder fellesskapets språk med mindre de velger sitt eget.","Choose the language you read this community in.":"Velg språket du leser dette fellesskapet på.","My language":"Mitt språk","Community default":"Fellesskapets standard","Console error":"Konsollfeil","Console warning":"Konsollvarsel",Crash:"Krasj","Unhandled error":"Uhåndtert feil","Failed request":"Mislykket forespørsel",About:"Om",Achievements:"Prestasjoner",Website:"Nettsted",Silver:"Sølv",Gold:"Gull",Platinum:"Platina",Diamond:"Diamant",Elite:"Elite","Comments on my posts":"Kommentarer på innleggene mine","When someone comments on your post":"Når noen kommenterer innlegget ditt","Replies to my comments":"Svar på kommentarene mine","When someone replies to your comment":"Når noen svarer på kommentaren din","Likes on my posts":"Likes på innleggene mine","When someone likes your post":"Når noen liker innlegget ditt","Reactions to my comments":"Reaksjoner på kommentarene mine","When someone reacts to your comment":"Når noen reagerer på kommentaren din","Reactions to my replies":"Reaksjoner på svarene mine","When someone reacts to your reply":"Når noen reagerer på svaret ditt","Direct messages":"Direktemeldinger","When you receive a direct message":"Når du mottar en direktemelding",Mentions:"Omtaler","When someone @mentions you":"Når noen @nevner deg","Load more {label}":"Last inn flere {label}","Loading more {label}…":"Laster inn flere {label}…",courses:"kurs",resources:"ressurser",items:"elementer","About {label}":"Om {label}","Couldn't like this course":"Kunne ikke like dette kurset","Couldn't like this resource":"Kunne ikke like denne ressursen","Couldn't remove your like":"Kunne ikke fjerne likerklikket ditt","Notify members":"Varsle medlemmene","Sends everyone in the community a notification about this resource, in the app and as a push notification on their phone or browser. Members who turned off notifications for this community don't get it.":"Sender alle i fellesskapet et varsel om denne ressursen, i appen og som push-varsel på telefon eller nettleser. Medlemmer som har slått av varsler for dette fellesskapet, får det ikke.","It is now available in the Knowledge Hub, and members are being notified.":"Den er nå tilgjengelig i Knowledge Hub, og medlemmene blir varslet.","How posts are ordered":"Hvordan innlegg sorteres","Recent: newest first. Top posts: the most likes, of all time; comments don't change the order. Trending: the most likes and comments together, within the period you pick. Following: posts by people you follow.":"Nyeste: nyeste først. Toppinnlegg: flest likerklikk, gjennom alle tider; kommentarer endrer ikke rekkefølgen. Populært: flest likerklikk og kommentarer til sammen, innenfor perioden du velger. Følger: innlegg fra folk du følger.","Save this resource":"Lagre denne ressursen","Save this course":"Lagre dette kurset","Remove from saved":"Fjern fra lagrede","Saved. Click to remove it from your saved list.":"Lagret. Klikk for å fjerne det fra listen din.","Find it any time under Saved in the Knowledge Hub.":"Du finner det når som helst under Lagret i Knowledge Hub.","Find it any time under Saved on the Courses page.":"Du finner det når som helst under Lagret på Kurs-siden.","Couldn't save this resource":"Kunne ikke lagre denne ressursen","Couldn't save this course":"Kunne ikke lagre dette kurset","Couldn't remove it from saved":"Kunne ikke fjerne det fra lagrede","All resources":"Alle ressurser",Show:"Vis","Press the bookmark on anything to save it here for later. Only you can see what you saved.":"Trykk på bokmerket på hva som helst for å lagre det her til senere. Bare du ser hva du har lagret.","Date range":"Datoperiode",Today:"I dag","Last 7 days":"Siste 7 dager","Last 4 weeks":"Siste 4 uker","Last 6 months":"Siste 6 måneder","Last 12 months":"Siste 12 måneder","Month to date":"Hittil denne måneden","Quarter to date":"Hittil dette kvartalet","Year to date":"Hittil i år","All time":"Hele perioden",Start:"Start",End:"Slutt",Clear:"Tøm",Apply:"Bruk","Couldn't download this file":"Kunne ikke laste ned denne filen","A new category is saved with capital letters, so “fancy dress” becomes “Fancy Dress”, and one that already exists is reused rather than added twice.":"En ny kategori lagres med store forbokstaver, så «fancy dress» blir «Fancy Dress», og en kategori som allerede finnes, gjenbrukes i stedet for å legges til to ganger.","Job title":"Stillingstittel","Your role, such as Head of Sports Science or Team Physiotherapist. It shows under your name in the member directory and on your profile, so members know who to contact.":"Rollen din, for eksempel leder for idrettsvitenskap eller lagets fysioterapeut. Den vises under navnet ditt i medlemskatalogen og på profilen din, så medlemmene vet hvem de skal kontakte.","e.g. Head of Sports Science":"f.eks. leder for idrettsvitenskap","Type where you are based, or use your current location: your browser asks first, and only the town and country are filled in. Your exact position is never saved. Check it, then save your profile.":"Skriv hvor du holder til, eller bruk din nåværende posisjon: nettleseren spør først, og bare sted og land fylles inn. Den nøyaktige posisjonen din lagres aldri. Sjekk den, og lagre deretter profilen.","e.g. Stockholm, Sweden":"f.eks. Stockholm, Sverige","Finding you…":"Finner deg…","Use my location":"Bruk min posisjon","Please enter your location, or use your current location.":"Skriv inn hvor du holder til, eller bruk din nåværende posisjon.","Fields marked * are required.":"Felt merket med * er obligatoriske.","Your details in {community}":"Dine opplysninger i {community}","Your community details":"Dine opplysninger i fellesskapet","Community details":"Opplysninger i fellesskapet","Questions this community's admins ask every member. Your answers show in its member directory, except ones marked “Only admins see this”.":"Spørsmål administratorene i dette fellesskapet stiller alle medlemmer. Svarene dine vises i medlemskatalogen, bortsett fra de som er merket «Bare administratorer ser dette».","Couldn't save your profile":"Kunne ikke lagre profilen","Check the highlighted detail, then save again.":"Sjekk den markerte opplysningen, og lagre igjen.","Location filled in":"Sted fylt inn","Check it, then save your profile.":"Sjekk det, og lagre deretter profilen.","Couldn't use your location":"Kunne ikke bruke posisjonen din","Please type your location.":"Skriv inn stedet ditt.","Your browser can't share your location here. Please type it.":"Nettleseren kan ikke dele posisjonen din her. Skriv den inn.","Location access is blocked. Allow it for this site in your browser settings, or type your location.":"Tilgang til posisjon er blokkert. Tillat den for dette nettstedet i nettleserinnstillingene, eller skriv inn stedet ditt.","Finding your location took too long. Please try again, or type your location.":"Det tok for lang tid å finne posisjonen din. Prøv igjen, eller skriv inn stedet ditt.","Your location isn't available right now. Please type it.":"Posisjonen din er ikke tilgjengelig nå. Skriv den inn.","Location lookup isn't available right now. Please type your location.":"Stedsoppslag er ikke tilgjengelig nå. Skriv inn stedet ditt."},Onn={"SpatialChat Communities Keyword":"Swedish","Home Page Left column":"Hemsida vänster kolumn",Home:"Hem","Explore Groups":"Utforska grupper",Events:"evenemang",Groups:"Grupper",Links:"Länkar","Direct Message":"Direkt meddelande","Powered by":"Drivs av","No groups here, please use + to create a new one, or join one see them here.":"Inga grupper här, använd + för att skapa en ny, eller gå med i en se dem här.","Please join a group to see them here":"Gå med i en grupp för att se dem här","Section can only be reordered within the group!":"Avsnitt kan endast omordnas i gruppen!","Group Page":"Gruppsida","Invite Members":"Bjuda in medlemmar",Join:"Ansluta sig",Joined:"Gick med i","Create new section":"Skapa en ny sektion","Group Setting drop down":"Gruppinställning nedgång",Share:"Dela med sig","Edit group":"Redigera grupp","Delete group":"Radera grupp",Leave:"Lämna","Are you sure you want to delete the group?":"Är du säker på att du vill ta bort gruppen?",Cancel:"Annullera","Yes, Go Ahead":"Ja gör det","Share via link":"Dela via länk",Copy:"Kopiera",Copied:"Kopierad","Share on social media":"Dela på sociala medier","Add Section":"Lägga till sektion","Section Header":"Sektionsrubrik",Live:"leva","Create post":"Skapa inlägg","Notificaiton Bell":"Notificaiton Bell","All posts":"Alla inlägg","Admin posts only":"Endast administratörsinlägg",None:"Ingen","Section Setting drop down":"Avsnittinställning nedgång","Edit Section":"Redigera avsnitt","Embed Section":"Bädda sektion","Delete Section":"Ta bort avsnitt","Are you sure you want to delete the section?":"Är du säker på att du vill ta bort avsnittet?","Section deleted!":"Avsnitt Raderat!","Create Group Pop up / Update":"Skapa grupppop -up / uppdatering","Create group":"Skapa grupp","Basic Detail":"Grundläggande detalj",Settings:"inställningar","Size 16:9 or 1600 by 900":"Storlek 16: 9 eller 1600 av 900","Group name":"Grupp namn","Enter group name":"Ange gruppnamn","Suggestions: Spaces, Channels, Groups, Blog, Knowledgebase, etc":"Förslag: utrymmen, kanaler, grupper, blogg, kunskapsbas, etc.","Group Description":"Gruppbeskrivning","Enter description here":"Ange beskrivning här","Group Type":"Grupptyp",Open:"Öppen","Visible to all & anyone can join":"Synlig för alla och vem som helst kan gå med",Closed:"Stängd","User will have to request to join the group":"Användaren måste begära att gå med i gruppen",Paid:"Betalad","Group Price":"Grupppris","Currency (Default: INR)":"Valuta (standard: INR)","User will have to pay to join the group":"Användaren måste betala för att gå med i gruppen","Make this a private group":"Gör detta till en privat grupp","Private group will only be visible to members who are part of it. Admin can add members manually from member list":"Privat grupp kommer bara att vara synlig för medlemmar som ingår i det. Administratör kan lägga till medlemmar manuellt från medlemslistan","Upload from device":"Ladda upp från enheten","Search image":"Sökbild","Valid group name required!":"Giltigt gruppnamn krävs!","Update Group":"Uppdateringsgrupp","SEO Settings":"SEO -inställningar","Custom URL":"Anpassad URL","Meta Title":"Metatitel","Maximum length of 255 characters allowed":"Maximal längd på 255 tecken tillåtet","Meta Description":"Metabeskrivning","Open Graph Detail":"Öppna grafdetalj","Open Graph Title":"Öppen graftitel","Open Graph Description":"Öppna grafbeskrivning","Open Graph Image":"Öppna grafbilden","Recommended dimensions: 1200px by 630px with a 1.91:1 aspect ratio.":"Rekommenderade dimensioner: 1200px av 630px med ett bildförhållande på 1,91: 1.","If no URL is used, it will automatically picked your group thumbnail.":"Om ingen URL används kommer den automatiskt att plocka din grupp miniatyrbild.","Create Section Pop up / Update":"Skapa avsnitt Pop Up / Update","Create Section":"Skapa avsnitt","Section Name":"Sektionsnamn","Suggestions: General, Introductions, Community Guidelines":"Förslag: Allmänt, introduktioner, gemenskapsriktlinjer","Section Type":"Sektionstyp","Post Type":"Posttyp","Group Chat":"Gruppchatt","Who can post in this section?":"Vem kan posta i det här avsnittet?","Only Admin":"Endast administratör","Any user":"Någon användare","Sorting order for section":"Sorteringsorder för avsnitt","Latest first":"Senaste första","Oldest post first":"Äldsta inlägg först","Section Appearance":"Sektionsutseende","List View":"Listvy","Grid View":"Rutnät","Make this closed section":"Gör detta stängda avsnitt","Members will have to request access to see section content":"Medlemmarna måste begära åtkomst för att se sektionsinnehåll","Make this a private section":"Gör detta till ett privat avsnitt","Disables requests (Make sure closed section is selected as well).":"Inaktiverar förfrågningar (se till att det stängda avsnittet är valt också).","Post Editor":"Postredaktör","Create new post in":"Skapa nytt inlägg i","Add Cover Picture":"Lägg till omslagsbild","Heading (Optional)":"Rubrik (valfritt)","Write here..":"Skriv här..",Picture:"Bild",Video:"Video",Attachment:"Anknytning",Poll:"Opinionsundersökning","Embed Code":"Inbäddade koden",Tags:"Taggar","Toggle to question":"Växla för att fråga","Poll expire time":"Undersökning löper ut","Poll question":"Undersökningsfråga","Enter Question":"Gå in i frågan",Question:"Fråga",Option:"Alternativ",Options:"alternativ","Add Option":"Lägg till alternativ","Poll Expiry time":"Undersökningstid","12 Hours":"12 timmar","1 Day":"1 dag","2 Days":"2 dagar","1 Week":"1 vecka","2 Weeks":"2 veckor","Always Open":"Alltid öppen","Write embeddable code":"Skriv inbäddningsbar kod","Click here to add embed code.":"Klicka här för att lägga till inbäddningskod.","Paste your embed code here!":"Klistra in din inbäddningskod här!","Post Settings":"Inställningar efter inställningar","Update Post":"Uppdatera inlägg",Update:"Uppdatering","Start meeting / Video call / Live":"Börja möte / videosamtal / live","Meeting Name":"Mötesnamn","Suggestion: Group discussion etc":"Förslag: Gruppdiskussion etc.",Description:"Beskrivning","Enter description here (optional)":"Ange beskrivning här (valfritt)","When do you want to start the session":"När vill du starta sessionen","Right now":"Just nu","Schedule for later":"Schema för senare","Group video call":"Gruppvideosamtal",Webinar:"Webbseminarium","Go Live":"Gå och lev","Go live":"Gå och lev","Info on the Post":"Info om inlägget","Post comment":"Publicera kommentar",Comment:"Kommentar",Comments:"Kommentarer",Reply:"Svar",Replies:"Svar","Share via URL":"Dela via URL","Reshare in other sections":"Reshare i andra avsnitt","Post Card Drop Down":"Postkortsavlopp",Bookmark:"Bokmärke","Pin post":"Stiftstolpe",Edit:"Redigera","Embed Post":"Inbäddas",Delete:"Radera","Remove Pin":"Ta bort stiftet","Remove Bookmark":"Ta bort bokmärket","Just copy paste this code wherever you want it to be embedded":"Kopiera bara klistra in den här koden var du vill att den ska vara inbäddad",Height:"Höjd",Preview:"Förhandsvisning","Copied to clipboard":"Kopierad till urklipp","Select Widgets":"Välj widgetar","Add widgets to":"Lägg till widgetar till","You can change their order by dragging & dropping the widgets over each other":"Du kan ändra beställningen genom att dra och släppa widgets över varandra","Please note: Widget wont be displayed if there is no data available,":"Observera: Widgeten visas inte om det inte finns några data tillgängliga,","Group Members":"Gruppmedlemmar","Group Leaderboard":"Grupptavla","Community Leaderboard":"Community learterboard","Trending Posts":"Trender","Group Events":"Gruppevenemang","Add Custom":"Lägg till anpassning","Save Widgets":"Spara widgetar","Visible to user":"Synlig för användaren","Visible to admin":"Synlig för administratör","Add widget to":"Tillsätt widget till","Upload cover picture":"Ladda upp omslagsbilden","1:1 aspect ration (recommended)":"1: 1 Aspektration (rekommenderas)","Card Title":"Korttitel","Enter widget name":"Ange widgetnamn","Small Description (try to keep it under 50 words)":"Liten beskrivning (försök att hålla den under 50 ord)","Enter description":"Ange beskrivning","Button Title":"Knapptitel","Enter button name":"Ange knappnamn","Siggestion: Know more, Join, Apply, etc":"Siggestion: Vet mer, gå med, ansök, etc.","URL link":"URL -länk","Create custom widget":"Skapa anpassad widget","Custom widget created successfully":"Anpassad widget skapade framgångsrikt",Widgets:"Widget",Members:"Medlemmar","See All":"Se allt","Communtiy Top Contributors":"CommunTiy Top -bidragsgivare","Community members":"Medlemmar i samhället","Group Top Contributors":"Gruppens toppbidragsgivare","Upcoming Events":"uppkommande händelser","Home Page Banner":"Hemsida banner","Edit Banner":"Redigera banderoll","Home page Edit Banner Pop up":"Hemsida Redigera banner dyker upp","Update Banner":"Uppdatera banner",Search:"Sök","Upload Image":"Ladda upp bild",Remove:"Avlägsna","Banner image (please use 16:6 ratio or 1600px by 600px image for the best view)":"Bannerbild (använd 16: 6 -förhållandet eller 1600px med 600px bild för bästa vy)","Banner Title":"Banner","Enter here":"Gå in här","Suggestion: Welcome to my community etc":"Förslag: Välkommen till mitt samhälle etc.","Banner Description":"Bannerbeskrivning","Enter banner description":"Ange bannerbeskrivning","Save Banner Info":"Spara bannerinfo","Home Page Feed":"Hemsida flöde",Recent:"Nyligen","Top posts":"Toppposter",Trending:"Trendig","Home Feed Groups":"Hemfodergrupper","Header BarProfile Drop down":"READER BARPROFILE Drop Down","My profile":"Min profil",Logout:"Logga ut",Notification:"Underrättelse",Notifications:"Meddelanden","Mark all viewed":"Markera alla visade","has created a post":"har skapat ett inlägg","wants to join":"vill gå med","has commented on your post":"har kommenterat ditt inlägg","has replied to your comment":"har svarat på din kommentar","Search for tags":"Sök efter taggar","All groups":"Alla grupper","Search result":"Sökresultat","No post found for selected hashtag":"Inget inlägg hittades för vald hashtag","Start a conversation":"Starta en konversation","Search by name":"Sök efter namn",Upcoming:"Kommande",UPCOMING:"Kommande",Past:"Dåtid",PAST:"DÅTID","No upcoming events":"Inga kommande evenemang","Create event popup":"Skapa popup -evenemang","Event details":"Evenemangsdetaljer","16:9 aspect ratio":"16: 9 bildförhållande","Event name":"Event namn","Enter event name":"Ange evenemangsnamn","Host Name":"Värdnamn","You will be made host if none selected":"Du kommer att bli värd om ingen vald","Write here...":"Skriv här...","No. of registration for the event":"Antal registrering för evenemanget",Unlimited:"Obegränsat","When & where":"När & var",From:"Från","Start date":"Start datum",time:"tid",To:"Till","End date":"Slutdatum","Current time zone:":"Aktuell tidszon:","Can be updated from the communtiy setting":"Kan uppdateras från kommunens inställning","Online event":"Onlineevenemang","Add meeting link":"Lägg till möteslänk","Meeting link will be generated once event is created":"Möteslänk kommer att genereras när evenemanget skapas",Venue:"Mötesplats","Enter address":"Ange adressen",Create:"Skapa",Invite:"Bjuda","Share event via link":"Dela händelse via länk",Copy__1:"Kopiera","Select section to post this event":"Välj avsnitt för att publicera detta evenemang","Once posted, members of that group or section will recieve an notification":"När de har lagts ut kommer medlemmar i den gruppen eller avsnittet att få ett meddelande",Post:"Posta",RSVP:"RSVP","Book Event":"Bokevenemang","Yes, I'll attend":"Ja, jag kommer att delta","May be":"Kanske","No, I won't attend":"Nej, jag kommer inte att delta","Date & Time":"Datum Tid",Host:"Värd","Online meeting":"Onlinemöte","Meeting link will be visible once registered for the event":"Möteslänk kommer att synas när den är registrerad för evenemanget","User Management":"Användarhantering","Go bac to community":"Gå Bac till samhället","Manage Members":"Hantera medlemmar",Member:"Medlem",Invited:"Inbjuden","Search for member":"Sök efter medlem","Add to group":"Lägg till i gruppen","Send Direct Message":"Skicka direktmeddelande","Change role":"Ändra roll","Kick from community":"Kick från samhället","Super Admin":"Superadministratör","Super admin will have full access to the communtiy settings":"Super Admin kommer att ha full tillgång till kommunikationsinställningarna","Group Admin":"Gruppadministratör","Admin of the selected group can edit the group information and create, edt or delete section under selected group":"Administratör för den valda gruppen kan redigera gruppinformationen och skapa, EDT eller ta bort avsnitt under vald grupp","Group Moderator":"Gruppmoderator","Group moderator can create or delete post, comment, reply & messages in the selected group.":"Gruppmoderator kan skapa eller ta bort inlägg, kommentera, svara och meddelanden i den valda gruppen.",User:"Användare",Save:"Spara","User role updated successfully":"Användarrollen uppdaterad framgångsrikt",Leaderboard:"Topplista","Click on the column header for sorting":"Klicka på kolumnhuvudet för sortering",Rank:"Rang","Karma Points":"Karma poäng","Custom Points":"Anpassade poäng",Follow:"Följ",Upvotes:"Utrotning",Posts:"Inlägg","Add custom points":"Lägg till anpassade punkter","Subtract custom points":"Subtrahera anpassade punkter","Enter no. of points":"Ange nej. punkter","Add points":"Lägga till poäng","Invite members to":"Bjuda in medlemmar till","Invite via link":"Bjud in via länk","Invite via email":"Bjud in via e -post","Add more":"Lägga till mer","Upload a CSV":"Ladda upp en CSV","Please upload a comma-seprated CSV file, with header as name, email.":"Ladda upp en kommasepraterad CSV-fil, med rubrik som namn, e-post.","Here is a template CSV file":"Här är en mall CSV -fil","Upload File":"Ladda upp fil","Send Invite":"Skicka inbjudan","Mail Template":"Postmall","Send Test Mail":"Skicka testpost",Hey:"Hallå","A has invite you to join the B":"A har bjudit in dig att gå med i B","Switch to rich text editor":"Byt till rik textredigerare","Add Custom Message":"Lägg till anpassat meddelande","Enter message here":"Ange meddelandet här","Send Bulk Mail":"Skicka bulkpost","Send Mail":"Skicka brev","Send bulk mail to all community members or select group members":"Skicka bulkpost till alla medlemmar i samhället eller välj gruppmedlemmar",Date:"Datum",Subject:"Ämne",Recipients:"Mottagare","1000 bulk emails remaining for this month. Resets on <date>":"1000 bulk -e -postmeddelanden kvar för denna månad. Återställs på <datum>",Everyone:"Alla","Enter mail subject":"Ange e -postämne","Write message":"Skrivmeddelande",Cancel__1:"Annullera",Send:"Skicka","Profile Page":"Profilsida",Activity:"Aktivitet",Bookmarks:"Bokmärken","Edit profile":"Redigera profil",Unsubscribe:"Säga upp","Settings (Account)":"Inställningar (konto)",Profile:"Profil","Set profile Picture":"Ställ in profilbild","Your name":"Ditt namn","User ID":"användar ID","Short bio":"Kort bio","Link your social account, this will be displayed on your profile":"Länk ditt sociala konto, detta kommer att visas på din profil","Add social handle":"Lägg till socialt handtag",Verification:"Verifiering","Account Verification":"Konto verifikation",Email:"E-post","Enter email":"Skriv in e-mail",Verified:"Verifierad",Unverified:"Overifierad",Change:"Förändra",Unlink:"Länka",Mobile:"Mobil","enter mobile no.":"Ange mobil nr.","Request OTP":"Begär OTP","Notification centre":"Anmälningscenter","Manage your personal account notification preferences":"Hantera dina personliga informationsmeddelanden",Prefrences:"Prefenser","Email notification":"E -postmeddelande","Notify me about comments on my posts":"Meddela mig om kommentarer på mina inlägg","Notify me about replies on my comments":"Meddela mig om svar på mina kommentarer","Notify me about likes on my posts":"Meddela mig om gillanden på mina inlägg","Notify me about reaction on my comments":"Meddela mig om reaktion på mina kommentarer","Notify me about reaction on my reply":"Meddela mig om reaktion på mitt svar","Notify me about direct message":"Meddela mig om direkt meddelande","Notify me about my mentions":"Meddela mig om mina omnämnanden","Notification for new posts":"Meddelande för nya inlägg","Only group & section available which you are part of":"Endast grupp och avsnitt tillgängliga som du är en del av","Group & Section":"Grupp och sektion","All activity":"All aktivitet","Post by admin":"Inlägg av admin","No Notification":"Ingen anmälan","Setting (Community)":"Inställning (community)","General Settings":"Allmänna Inställningar","Upload community logo":"Ladda upp community -logotypen","Community name":"Gruppnamn","Invalid field":"Ogiltig fält","Your community address":"Din samhällsadress","Fav icon":"FAV -ikon","This will be visible on the browser tab (32px by 32px)":"Detta kommer att synas på webbläsarfliken (32px med 32px)",TimeZone:"Tidszon","Privacy Policy on login page":"Sekretesspolicy på inloggningssidan","Terms & Condition on login page":"Villkor på inloggningssidan","Enter link here":"Ange länken här","Open Group Image":"Öppen gruppbild","By default ir takes up the community banner uploaded with the communtiy":"Som standard tar IR upp samhällsbannern som laddas upp med kommunen","Community Experience":"Samhällsupplevelse",Onboarding:"Ombord","Make your community private":"Gör ditt samhälle privat","Users will have to login or sign up to access the community":"Användare måste logga in eller registrera sig för att komma åt samhället","Make account verification mandatory for both email & mobile":"Gör kontoverifiering obligatorisk för både e -post och mobil","New user will have to verify both email & mobile no. to access the community":"Ny användare måste verifiera både e -post och mobil nr. för att få tillgång till samhället","Admin will also have to verify their mobile no. & email or else they won't be able to access the community":"Admin måste också verifiera sitt mobilnummer. & e -post annars kommer de inte att kunna komma åt samhället","Gated community access":"Gated community access","Admin will have to approve or reject user's requests to join the community":"Admin måste godkänna eller avvisa användarens förfrågningar om att gå med i samhället","Disable mobile login/register":"Inaktivera mobil inloggning/register","Disable email login/register":"Inaktivera e -postinloggning/register","Disable google login/register":"Inaktivera Google -inloggning/register","Disable facebook login/register":"Inaktivera Facebook -inloggning/register","Show & Hide features":"Visa och dölj funktioner","Hide direct chat":"Dölj direktchatt","User will not be able to send direct messages to each other":"Användaren kommer inte att kunna skicka direktmeddelanden till varandra","Hide profile picture from top right corner for mobile responsive view":"Dölj profilbild från det övre högra hörnet för mobil responsiv vy","Useful when using community in an in app browser":"Användbar när du använder community i en app -webbläsare","Hide profile picture from top right corner in every view":"Dölj profilbild från det övre högra hörnet i varje vy","Disable header dropdown on profile picture":"Inaktivera rullgardinsmenet för rubrik på profilbild","Useful for integrated community, especially using SSO":"Användbart för integrerat samhälle, särskilt med SSO","Hide the communtiy logo from the header":"Dölj kommunens logotyp från rubriken","Hide the communtiy title from the header":"Dölj kommunens titel från rubriken","Show collpased group in the side nav bar":"Visa kollegerad grupp i sido -navbaren","Show full expanded post in the home feed":"Visa ett fullt utökat inlägg i hemmatflödet","Hide the leaderboard score from the header":"Dölj spånen med topplistan från rubriken","Show powered by SpatialChat Communities":"Visa drivna av SpatialChat Communities","Hide closed groups if not joined":"Dölj stängda grupper om de inte är förenade","Closed groups would not be shown to the user if they are not a member of the group":"Stängda grupper skulle inte visas för användaren om de inte är medlem i gruppen","Hide Community subscriber count from the users":"Dölj community -abonnentantalet från användarna","This will hide the community subscriber list in the community header":"Detta kommer att dölja gemenskapens abonnentlista i gemenskapens rubrik","Disable Communtiy Switcher":"Inaktivera CommunTiy Switcher","Use MD editor for create post description":"Använd MD -redigerare för Create Post Description","Non logged in user will land on explore group page instead of post directory":"Icke inloggad användare kommer att landa på utforska gruppsidan istället för postkatalog","Advanced configurable":"Avancerad konfigurerbar","Communtiy default country code":"CommunTiy Standard Country Code","This will show up by default on login/signup":"Detta kommer som standard att dyka upp på inloggning/registrering","Onboarding/Welcome Message":"Onboarding/Welcome Message","Welcome Message":"Välkomstmeddelande","Greet your members with personalized message":"Hälsa dina medlemmar med personligt meddelande","Welcome to":"Välkommen till",Message:"Meddelande","Add message":"Lägg till meddelande","Custom domain":"Anpassad domän","Add custom domain":"Lägg till anpassad domän","Create new request":"Skapa ny begäran","Enter your custom domain":"Ange din anpassade domän","Setup details":"Inställningsdetaljer","Add a CNAME record in your domain pointing to this community's address":"Lägg till en CNAME -post i din domän som pekar på den här gemenskapens adress","To configure your domain, you'll need to add a CNAME record pointing your domain to your pensil community URL":"För att konfigurera din domän måste du lägga till en CNAME -post som pekar din domän till din SpatialChat Communities -URL","Step by Step help apge":"Steg för steg hjälp apge","All request list":"Alla förfrågningslista","Allow admin to assign/un-assign custom points to users":"Låt administratören tilldela/un-tilldela anpassade poäng till användare","Base points for user to begin with":"Baspoäng för användare till att börja med","Base points will be updated for all the users, any changes will reflect for all the users.":"Baspunkter kommer att uppdateras för alla användare, alla ändringar återspeglar för alla användare.","Allocate points for interaction":"Tilldela poäng för interaktion","Upvoting post":"Utvotningspost","creating a comment":"Skapa en kommentar","creating a reply":"Skapa ett svar","Getting upvote to their post":"Att komma till deras inlägg","Getting comment to their post":"Få kommentar till sitt inlägg","Getting reply to their comment":"Få svar på deras kommentar","Creating a post":"Skapa ett inlägg",Visiblity:"Synlighet","Move Up":"Flytta upp","Move Down":"Flytta ner","Create embedded section":"Skapa inbäddad sektion","Preview area":"Förhandsgranskning","Theme selector":"Temalös","Community Theme":"Gemenskapstema","Select theme":"Välj tema","Select brand color":"Välj varumärkesfärg","Customize your button color to match your brand":"Anpassa din knappfärg för att matcha ditt märke","Select on button text color":"Välj på knapptextfärg","Suggestion: Keep inverted contrast against brand color":"Förslag: Håll inverterad kontrast mot varumärkesfärg",Billing:"Fakturering","Current plan":"Aktuell plan","You are current on Free PLan":"Du är aktuell på gratis plan","Renew on: NA":"Förnya på: na",Select:"Välj","Email us at":"Maila oss på","Compare plan":"Jämför plan","API Keys":"API -nycklar","Create new key":"Skapa ny nyckel","Total keys":"Totala nycklar","Keep your API keys safe! You can use them to access specific feature & let cetain apps perfrom certain actions on your behalf on the platform.":"Håll dina API -nycklar säkra! Du kan använda dem för att få åtkomst till specifik funktion och låt cetain -appar perfekta vissa åtgärder för dina räkning på plattformen.","Key name":"Nyckelnamn","Key value":"Nyckelvärde",Action:"Handling","Group updated!":"Grupp uppdaterad!","Are you sure you want to":"Är du säker på att du vill","Make Moderator":"Göra moderator","Remove from group":"Ta bort från grupp","Show All":"Visa allt","Change Role":"Ändra roll",Close:"Stänga",copy:"kopiera",LINKS:"Länkar","Email Id":"E-post ID",Name:"namn","Search for an image":"Sök efter en bild","Crop Image":"Beskära bild","No photos found":"Inga foton hittades",Community:"gemenskap","Banner ratio - 16:9":"Bannerförhållande - 16: 9","Banner Ratio - 16:6":"Bannerförhållande - 16: 6","Share on mail":"Dela på post","Share on Telegram":"Dela på telegram","Share on Whatsapp":"Dela på WhatsApp","Share on Linkedin":"Dela på LinkedIn","Share on Facebook":"Dela på Facebook","Share on Twitter":"Dela på Twitter","Pin Post":"Stiftstolpe","Heading (optional)":"Rubrik (valfritt)","Select section":"Välj avsnitt",Gif:"GIF","Create Custom Widget":"Skapa anpassad widget","Are you sure you want to delete this widget?":"Är du säker på att du vill ta bort den här widgeten?","Go to event":"Gå till evenemanget","Add Tags":"Lägg till taggar","Create Tag":"Skapa tagg","Title (Optional)":"Titel (valfritt)","Search Gif":"Sök GIF","What's on your mind":"Vad tänker du på","Looks like nothing available here right now.":"Ser ut som ingenting tillgängligt här just nu.","Try exploring other tabs":"Försök utforska andra flikar","Delete Widget":"Ta bort widget","Please select a section to post":"Välj ett avsnitt att posta","Post added successfully!":"Post tillagd framgångsrikt!","Failed to create post. Please check post content and retry again.":"Det gick inte att skapa inlägg. Kontrollera postinnehållet och försök igen igen.","Are you sure you want to discard current post?":"Är du säker på att du vill kassera nuvarande inlägg?","By default it will take up the image uploaded with the post":"Som standard kommer det att ta upp bilden som laddas upp med inlägget","Quiz can be only viewed and attempted from mobile device right now!":"Quiz kan bara ses och försökt från mobil enhet just nu!","Community Banner":"Samhällsbanner","Change Cover":"Byta omslag","Suggestions: Welcome to my community etc":"Förslag: Välkommen till mitt samhälle etc.","(edited)":"(redigerad)","Aspect ratio (recommended)":"Bildförhållande (rekommenderas)","Banner details updated!":"Bannerinformation uppdateras!","Refresh if changes are not visible!":"Uppdatera om ändringar inte är synliga!","Banner details could not be updated!":"Bannerinformation kunde inte uppdateras!","Post deleted":"Efter raderad","Post not available. It may have been deleted.":"Post inte tillgängligt. Det kan ha tagits bort.",Admin:"Administration",Moderator:"Moderator","Bookmark added!":"Bokmärke tillagd!","Bookmark removed":"Bokmärke","Failed performing action!":"Misslyckades med att utföra åtgärder!","Copy this link to share on other platforms":"Kopiera den här länken för att dela på andra plattformar","View this event":"Visa det här evenemanget",Event:"Händelse","Join Meeting":"Gå med mötet","The live meeting has ended":"LIVE -mötet har avslutats","read more...":"Läs mer...","Load more comments":"Ladda fler kommentarer","Post Reply":"Skicka svar","Post Comment":"Publicera kommentar",more:"Mer",upvoted:"avtagen","1 Upvote":"1 Urvote","1 Comment":"1 kommentar","Please enter a title":"Ange en titel","Please enter a url link":"Ange en URL -länk","Please enter button title":"Ange knapptitel","Button label must be at least 20 characters":"Knappetikett måste vara minst 20 tecken","Please enter valid url":"Ange giltig URL","Suggestions: Know more, Join, Apply...":"Förslag: Vet mer, gå med, ansöka ...",URL:"Url","Community Events":"Community -evenemang","Widget deleted successfully":"Widget raderas framgångsrikt","Community Top Contributors":"Community Top -bidragsgivare",points:"punkter","Points cannot be greater than current points":"Poäng kan inte vara större än nuvarande poäng","Point cannot be a negative value":"Punkten kan inte vara ett negativt värde","Point cannot be a decimal point":"Punkten kan inte vara en decimalpunkt","Please enter a valid number":"var vänlig skriv in ett giltigt nummer","Karma points updated successfully":"Karma -poäng uppdateras framgångsrikt","Error in updating karma points":"Fel vid uppdatering av karma -poäng","Add karma points":"Lägg till karmapoäng","Minus karma points":"Minus karma poäng","Total Karma points:":"Totala karmapoäng:","Enter no. of karma points":"Ange nej. av Karma -poäng","Minus Points":"Minuspoäng","Trending Post":"Trending post","No visible description":"Ingen synlig beskrivning","Picture ratio: 1:1":"Bildförhållande: 1: 1","home feed":"hemfoder","Event name is invalid!":"Eventnamnet är ogiltigt!",custom:"beställnings-","Custom widget updated successfully":"Anpassad widget uppdaterad framgångsrikt","Name invalid!":"Namngiltigt!","Current timezone:":"Aktuell tidszon:","can be updated from community settings":"kan uppdateras från samhällsinställningar","Event created successfully":"Händelse skapades framgångsrikt","Error in creating event":"Fel i att skapa händelse",Attendees:"Deltagare","Do you wish to notify these changes to attendees?":"Vill du meddela dessa ändringar till deltagarna?","users wants to attend this event":"Användare vill delta i detta evenemang","Yes, Notify them":"Ja, meddela dem","No, its okay":"Nej det är okej","Do you wish to notify that event is cancelled?":"Vill du meddela att händelsen avbryts?","Are you sure you want to delete the event?":"Är du säker på att du vill ta bort evenemanget?","Delete Event":"Radera händelse","New Event":"Nytt event","Accept Invitation":"Acceptera inbjudan",Requested:"Begärda",Declined:"Tackade nej","Request Access":"Begära tillgång","Enroll for":"Anmäla sig till",Housefull:"Husfull","Just copy paste this code wherever you want it to be embedded:":"Kopiera bara klistra in den här koden var du vill att den ska vara inbäddad:",Ended:"Slut","Error getting events":"Fel att få händelser","Events could not be fetched!":"Händelser kunde inte hämtas!","Show Attendees":"Visa deltagare",Subscribers:"Prenumeranter","Make this a closed section":"Gör detta till ett stängt avsnitt","Update Section":"Uppdateringsavsnitt","Valid section name required!":"Giltigt avsnitt Namn krävs!","Enter section name":"Ange sektionsnamn","Community Admin":"Community admin",Embed:"Bädda in","Invite to":"Bjuda in till","Please enter a valid email address":"Ange en giltig e -postadress","Invitation sent successfully":"Inbjudan skickas framgångsrikt","Error sending invitation":"Fel skickar inbjudan","Email is not valid!":"E-post är inte giltig!","Data could not be loaded!":"Data kunde inte laddas!","Posted in":"Inlagd i","Invite Members Individually":"Bjuda in medlemmar individuellt","Start a discussion":"Starta en diskussion","Post something":"Lägga upp något","Invite your audience":"Bjud in din publik","Choose Plan":"Välj plan",or:"eller","Create a link":"Skapa en länk","Add link":"Lägg till länk","Update link":"Uppdateringslänk","Add shortcut to your most used tools":"Lägg till genväg till dina mest använda verktyg","Your website, Instagram Channel, Facebook profile etc":"Din webbplats, Instagram Channel, Facebook -profil etc.","Valid link name required!":"Giltigt länknamn krävs!","Valid url required, and make sure you are not missing http:// or https://":"Giltig URL krävs och se till att du inte saknar http: // eller https: //","Invite to__1":"Bjuda in till","Link Name":"Länknamn","Link URL":"Länkadress","Could not subscribe to":"Kunde inte prenumerera på","Subscribed to":"Prenumererad på","By default it will take up the community banner uploaded with the community":"Som standard kommer det att ta upp samhällsbannern som laddas upp med samhället","Created by":"Skapad av","Online Event (Meeting link will be visible once registered for the event)":"Online -evenemang (möteslänk kommer att vara synlig när den är registrerad för evenemanget)","Join Call":"Gå med i samtal","Please login to book this event":"Logga in på att boka detta evenemang","Commented on":"Kommenterade","Replied to":"Påskjutande av","Looks like it's lonely here.":"Ser ut som om det är ensamt här.","Try exploring other sections and groups.":"Försök utforska andra avsnitt och grupper.","Please proceed with the payment or contact admin to gain access to this group.":"Fortsätt med betalnings- eller kontaktadministratören för att få tillgång till denna grupp.","This is a closed group You'll need access to this group.":"Detta är en stängd grupp du behöver tillgång till den här gruppen.","You have no bookmarks right now.":"Du har inga bokmärken just nu.","The user hasn't posted anything yet publicly.":"Användaren har inte publicerat något ännu offentligt.","No activity to show.":"Ingen aktivitet att visa.","Are you sure you want to unsubscribe the community?":"Är du säker på att du vill avsluta prenumerationen?","deals left":"affärer kvar","Something went wrong while loading posts":"Något gick fel när du laddade inlägg","Could not unsubscribe from":"Kunde inte avsluta prenumerationen","Unsubscribed from":"Avbruten från","Login to view this page":"Logga in för att se den här sidan",Login:"Logga in","There was some error while doing the action!":"Det var något fel när han gjorde handlingen!","Unable to delete section!":"Det går inte att ta bort avsnittet!",Feed:"Flöde",Saved:"Sparade",Workflows:"Arbetsflöden",Rewards:"Belöningar",Networking:"Nätverkande",Course:"Kurs","Member Directory":"Medlemskatalog","Email Marketing":"E-postmarknadsföring",Analytics:"Analys","Log out":"Logga ut","Switch community":"Byt community",Support:"Support",Following:"Följer","Select topic":"Välj ämne","Featured Posts":"Utvalda inlägg","Featured posts":"Utvalda inlägg",Courses:"Kurser","Explore courses and learning paths in your community.":"Utforska kurser och lärstigar i din community.","Add course":"Lägg till kurs","Search title, description, or creator…":"Sök titel, beskrivning eller skapare…","Search courses":"Sök kurser","Clear search":"Rensa sökning","Filter courses":"Filtrera kurser","Sort courses":"Sortera kurser","Clear filters":"Rensa filter","{count} course":"{count} kurs","{count} courses":"{count} kurser",Updating:"Uppdaterar","Could not load courses":"Det gick inte att läsa in kurserna","Something went wrong. Please try again.":"Något gick fel. Försök igen.",Retry:"Försök igen","No courses found":"Inga kurser hittades","Try another search term or change the filter.":"Prova en annan sökterm eller ändra filtret.","No courses available":"Inga kurser tillgängliga","Create the first course for your community.":"Skapa den första kursen för din community.","Check back when new courses are published.":"Kom tillbaka när nya kurser har publicerats.","Showing {shown} of {total} course":"Visar {shown} av {total} kurs","Showing {shown} of {total} courses":"Visar {shown} av {total} kurser","Show less":"Visa mindre","Read more":"Läs mer","Request sent":"Begäran skickad","An admin will review your enrollment request.":"En administratör granskar din anmälningsförfrågan.",Enrolled:"Anmäld","You can start learning now.":"Du kan börja lära dig nu.","Something went wrong.":"Något gick fel.","Could not join course":"Det gick inte att gå med i kursen","No lessons yet":"Inga lektioner ännu","Content will appear when lessons are published.":"Innehållet visas när lektionerna har publicerats.","Course deleted":"Kursen har tagits bort","Could not delete course":"Det gick inte att ta bort kursen","Course duplicated":"Kursen har duplicerats","The copy was created as a draft.":"Kopian skapades som ett utkast.","Could not duplicate course":"Det gick inte att duplicera kursen","Left course":"Du har lämnat kursen","Could not leave course":"Det gick inte att lämna kursen","Continue learning":"Fortsätt lära dig","Buy now":"Köp nu","Send request to enroll":"Skicka anmälningsförfrågan","Enroll now":"Anmäl dig nu","Course not found":"Kursen hittades inte","This course may have been removed or you lack access.":"Kursen kan ha tagits bort eller så saknar du åtkomst.","Back to Courses":"Tillbaka till kursen","By {name}":"Av {name}","{count} lesson":"{count} lektion","{count} lessons":"{count} lektioner","Total time to complete":"Total tid att slutföra","Attached to {group}":"Kopplad till {group}",Progress:"Framsteg","{done}/{total} lessons · {percent}%":"{done}/{total} lektioner · {percent} %","Edit course":"Redigera kurs","Duplicate course":"Duplicera kurs","Delete course":"Ta bort kurs","Course access is included with your active paid access":"Kursåtkomst ingår i din aktiva betalda åtkomst","Leave course":"Lämna kurs",Content:"Innehåll","Quiz results":"Quizresultat","Delete course?":"Ta bort kursen?","All course content and member progress will be permanently removed.":"Allt kursinnehåll och alla medlemmars framsteg tas bort permanent.","Leave course?":"Lämna kursen?","You will lose access to lessons until you enroll again.":"Du förlorar åtkomsten till lektionerna tills du anmäler dig igen.","Not enrolled":"Inte anmäld","Course content unlocks once you are enrolled. Request access or purchase membership if required.":"Kursinnehållet låses upp när du är anmäld. Begär åtkomst eller köp ett medlemskap om det krävs.","Add section":"Lägg till avsnitt","No content yet":"Inget innehåll ännu","Add a section to start building this course.":"Lägg till ett avsnitt för att börja bygga kursen.","Content will be available when the course starts.":"Innehållet blir tillgängligt när kursen startar.","{count} comment":"{count} kommentar","{count} comments":"{count} kommentarer","No comments on this course yet.":"Inga kommentarer på den här kursen ännu.","Showing {from}-{to} of {total} comments":"Visar {from}–{to} av {total} kommentarer",Lesson:"Lektion","Unlocks {date}":"Låses upp {date}","{count} day after enrollment":"{count} dag efter anmälan","{count} days after enrollment":"{count} dagar efter anmälan","Releases {date}":"Släpps {date}","Section deleted":"Avsnittet har tagits bort","Could not delete section":"Det gick inte att ta bort avsnittet","Lesson updated":"Lektionen har uppdaterats","Lesson added":"Lektionen har lagts till","Could not save lesson":"Det gick inte att spara lektionen","Lesson deleted":"Lektionen har tagits bort","Could not delete lesson":"Det gick inte att ta bort lektionen","Lesson duplicated as draft":"Lektionen har duplicerats som utkast","Could not duplicate lesson":"Det gick inte att duplicera lektionen","Total time for this section":"Total tid för det här avsnittet","Edit section":"Redigera avsnitt","Delete section":"Ta bort avsnitt","Lessons will appear here once added.":"Lektioner visas här när de har lagts till.","Not released yet":"Inte släppt ännu","Complete the previous lesson first":"Slutför den föregående lektionen först","Time to complete":"Tid att slutföra","Actions for {title}":"Åtgärder för {title}","Edit lesson":"Redigera lektion","Duplicate lesson":"Duplicera lektion","Delete lesson":"Ta bort lektion",Add:"Lägg till","Add lesson":"Lägg till lektion","Delete section?":"Ta bort avsnittet?",'This removes "{name}" and all lessons inside it.':'Detta tar bort "{name}" och alla lektioner i det.',"Delete lesson?":"Ta bort lektionen?",'This removes "{title}" permanently.':'Detta tar bort "{title}" permanent.',"Lesson title":"Lektionstitel",Minutes:"Minuter","Time to complete, in minutes":"Tid att slutföra, i minuter","How long this lesson takes, in minutes":"Hur lång tid lektionen tar, i minuter","Joined group":"Gick med i gruppen","You're now in {group}. Enrolling you in the course…":"Du är nu med i {group}. Vi anmäler dig till kursen…","An admin will review your group request. After you're accepted you can enroll in the course.":"En administratör granskar din gruppförfrågan. När du har godkänts kan du anmäla dig till kursen.","Could not join group":"Det gick inte att gå med i gruppen","This course moved to {group}":"Kursen har flyttats till {group}","Join {group} first":"Gå med i {group} först","This course is now part of “{group}”. Join its new group to continue accessing the course.":"Kursen ingår nu i “{group}”. Gå med i den nya gruppen för att behålla åtkomsten till kursen.","This course belongs to “{group}”. Join the group before enrolling and starting the course.":"Kursen tillhör “{group}”. Gå med i gruppen innan du anmäler dig och startar kursen.","Paid group access":"Betald gruppåtkomst","Membership required":"Medlemskap krävs","Explore the available plans for {group}, choose the one that suits you, and return here after purchase to begin learning.":"Utforska de tillgängliga planerna för {group}, välj den som passar dig och kom tillbaka hit efter köpet för att börja lära dig.","Your request to join this group is already pending. You'll be able to enroll after an admin accepts it.":"Din förfrågan om att gå med i gruppen väntar redan. Du kan anmäla dig när en administratör har godkänt den.","This is a {type} group. Continue to join instantly.":"Det här är en {type} grupp. Fortsätt för att gå med direkt.","This is a {type} group. Continue to send a request to the group admins.":"Det här är en {type} grupp. Fortsätt för att skicka en förfrågan till gruppens administratörer.","Explore group":"Utforska gruppen","Join group":"Gå med i gruppen","Request to join group":"Begär att få gå med i gruppen","You can watch this lecture now.":"Du kan titta på den här föreläsningen nu.","Could not enroll":"Det gick inte att anmäla dig","Want to view this lecture?":"Vill du se den här föreläsningen?","Your enrollment request is waiting for approval. You'll be able to watch this lecture after an admin accepts it.":"Din anmälningsförfrågan väntar på godkännande. Du kan titta på föreläsningen när en administratör har godkänt den.","Enroll in {course} to watch this lecture and the rest of the course.":"Anmäl dig till {course} för att se den här föreläsningen och resten av kursen.","Back to course":"Tillbaka till kursen","Enroll to view lecture":"Anmäl dig för att se föreläsningen","Choose a membership plan that includes {course}.":"Välj en medlemsplan som inkluderar {course}.",Subscribed:"Prenumererar","Payment successful":"Betalningen lyckades","You can now request access to this course.":"Du kan nu begära åtkomst till den här kursen.","Checkout failed":"Betalningen misslyckades","Buy group access":"Köp gruppåtkomst","No membership plans are linked to this group yet.":"Inga medlemsplaner är kopplade till den här gruppen ännu.","Membership plan":"Medlemsplan","Subscribe free":"Prenumerera gratis","{day} at {time}":"{day} kl. {time}","All courses":"Alla kurser",Published:"Publicerade",Drafts:"Utkast","Default order":"Standardordning","Title A–Z":"Titel A–Ö","Shortest first":"Kortast först","Longest first":"Längst först","Most lessons":"Flest lektioner",Draft:"Utkast",Personal:"Personlig","Community member":"Communitymedlem","Your browser does not support video playback.":"Din webbläsare stöder inte videouppspelning.","Audio resource":"Ljudresurs","Listen without leaving the Knowledge Hub":"Lyssna utan att lämna Knowledge Hub","Your browser does not support audio playback.":"Din webbläsare stöder inte ljuduppspelning.","Attached files":"Bifogade filer",FILE:"FIL",Hide:"Dölj",View:"Visa",Download:"Ladda ned","Resource media":"Resursmedia",Audio:"Ljud",Attachments:"Bilagor","About this resource":"Om den här resursen","Saving your resource…":"Sparar din resurs…","Finishing the upload…":"Slutför uppladdningen…","Uploading 1 file · {percent}%":"Laddar upp 1 fil · {percent} %","Uploading {count} files · {percent}%":"Laddar upp {count} filer · {percent} %","Remove {name}":"Ta bort {name}","Description cannot exceed {max} characters":"Beskrivningen får inte vara längre än {max} tecken","Your title":"Din titel","Add a cover image before publishing":"Lägg till en omslagsbild innan du publicerar","Resource updated":"Resursen har uppdaterats","Resource shared":"Resursen har delats","Your changes are now live.":"Dina ändringar är nu live.","It is now available in the Knowledge Hub.":"Den finns nu i Knowledge Hub.","Upload cancelled":"Uppladdningen avbröts","Nothing was saved. Your files are still in the form.":"Inget sparades. Dina filer finns kvar i formuläret.","Could not update resource":"Det gick inte att uppdatera resursen","Could not share resource":"Det gick inte att dela resursen","Please try again.":"Försök igen.","That file is not an image":"Filen är ingen bild","Choose a PNG, JPG or WebP for the cover.":"Välj en PNG, JPG eller WebP som omslag.","Couldn't use that cover":"Det gick inte att använda det omslaget","Pick another one, or choose a picture of your own.":"Välj ett annat eller välj en egen bild.","Couldn't open the current cover":"Det gick inte att öppna det nuvarande omslaget","Choose the image again to crop it.":"Välj bilden igen för att beskära den.","Video too large":"Videon är för stor","Videos can be up to {limit}.":"Videor får vara upp till {limit}.","That file is not audio":"Filen är inte ljud","Choose an MP3, M4A, WAV or other audio file.":"Välj en MP3-, M4A-, WAV- eller annan ljudfil.","Audio too large":"Ljudet är för stort","Audio files can be up to {size} MB.":"Ljudfiler får vara upp till {size} MB.","File too large":"Filen är för stor","{count} files too large":"{count} filer är för stora",'"{name}" was not added. Files can be up to {limit}.':'"{name}" lades inte till. Filer får vara upp till {limit}.',"{names} were not added. Files can be up to {size} MB ({videoLimit} for a video).":"{names} lades inte till. Filer får vara upp till {size} MB ({videoLimit} för en video).","Up to 5 attachments":"Upp till 5 bilagor","Only the first {count} file was added.":"Endast den första {count} filen lades till.","Only the first {count} files were added.":"Endast de första {count} filerna lades till.","Remove one to add another.":"Ta bort en för att lägga till en annan.","Edit resource":"Redigera resurs","Share a resource":"Dela en resurs","Update your resource. Saved changes will appear immediately.":"Uppdatera din resurs. Sparade ändringar visas direkt.","Add a cover and a description, then optionally a video, an audio file and files to download.":"Lägg till ett omslag och en beskrivning, därefter eventuellt en video, en ljudfil och filer att ladda ned.",Details:"Detaljer","Cover image file":"Fil för omslagsbild","Video file":"Videofil","Audio file":"Ljudfil","Attachment files":"Bilagefiler","Cover image":"Omslagsbild","The picture on this resource's card in the library. It is not a download. After you pick a picture you choose which part to show, in the card's 16:9 shape, so nothing is cut off in the library. A large photo is resized before it is sent, so it uploads faster; the original on your device is not changed.":"Bilden på resursens kort i biblioteket. Den är ingen nedladdning. När du har valt en bild väljer du vilken del som ska visas, i kortets 16:9-format, så att inget klipps bort i biblioteket. Ett stort foto ändras i storlek innan det skickas, så att det laddas upp snabbare; originalet på din enhet ändras inte.","Cover preview":"Förhandsvisning av omslag","Choose a cover image":"Välj en omslagsbild","PNG, JPG or WebP · you choose the part to show next":"PNG, JPG eller WebP · du väljer vilken del som ska visas härnäst","Replace cover":"Byt omslag","Remove cover":"Ta bort omslag","Without a cover, the card shows a plain one in the community's colour.":"Utan omslag visar kortet ett enkelt omslag i communityns färg.","Current cover":"Nuvarande omslag","Adjust crop":"Justera beskärning","No picture to hand? Use a ready-made cover":"Har du ingen bild till hands? Använd ett färdigt omslag","Cover subjects":"Omslagsämnen","All ({count})":"Alla ({count})","Earlier covers":"Tidigare omslag","Ready-made covers":"Färdiga omslag","Use the {name} cover":"Använd omslaget {name}","More covers":"Fler omslag",Title:"Titel","What will members learn?":"Vad ska medlemmarna lära sig?","Shorten the title to {max} characters or fewer.":"Korta ned titeln till högst {max} tecken.","Share context, key takeaways, and why this is useful…":"Dela sammanhang, viktiga lärdomar och varför detta är användbart…","Formatting counts toward the limit. Shorten the description to {max} characters or fewer.":"Formatering räknas in i gränsen. Korta ned beskrivningen till högst {max} tecken.","Media to play":"Media att spela upp","(optional)":"(valfritt)","Members watch or listen to these inside the resource.":"Medlemmar tittar på eller lyssnar på detta direkt i resursen.","· one video, up to {limit}, or a link":"· en video, upp till {limit}, eller en länk","Current uploaded video":"Nuvarande uppladdade video","Already uploaded":"Redan uppladdad","Upload video":"Ladda upp video","YouTube or Vimeo URL":"YouTube- eller Vimeo-URL","Enter a valid YouTube or Vimeo link.":"Ange en giltig YouTube- eller Vimeo-länk.","· one audio file":"· en ljudfil","Current audio file":"Nuvarande ljudfil","Upload audio":"Ladda upp ljud","Files to download":"Filer att ladda ned","PDFs, Word, Excel or any other file members can download · {count}/5":"PDF:er, Word, Excel eller andra filer som medlemmar kan ladda ned · {count}/5","Add files":"Lägg till filer","PDF preview":"PDF-förhandsvisning","PDF attachment preview":"Förhandsvisning av PDF-bilaga","This is how members will see your resource. Nothing is shared until you save.":"Så här ser medlemmarna din resurs. Inget delas förrän du sparar.","This is how members will see your resource. Nothing is shared until you publish.":"Så här ser medlemmarna din resurs. Inget delas förrän du publicerar.","When opened":"När den öppnas","In the library":"I biblioteket","{done}/{total} done":"{done}/{total} klara","Upload progress":"Uppladdningsförlopp","Keep this window open until it finishes.":"Låt det här fönstret vara öppet tills det är klart.","Cancel upload":"Avbryt uppladdning","Save changes":"Spara ändringar","Publish resource":"Publicera resurs","Choose what shows on the cover":"Välj vad som visas på omslaget","Knowledge Hub":"Knowledge Hub","You created this resource.":"Du skapade den här resursen.","Moderator actions":"Moderatoråtgärder","This file can't be previewed. Use Download instead.":"Den här filen kan inte förhandsvisas. Använd Ladda ned i stället.","Resource deleted":"Resursen har tagits bort","Could not delete resource":"Det gick inte att ta bort resursen","This resource is no longer available":"Den här resursen är inte längre tillgänglig","Couldn't open that resource":"Det gick inte att öppna den resursen","It may have been deleted. Here is the rest of the library.":"Den kan ha tagits bort. Här är resten av biblioteket.","Community library":"Communitybibliotek","Useful ideas, explainers and media shared by your community.":"Användbara idéer, förklaringar och media som delas av din community.","Search title, description, or author…":"Sök titel, beskrivning eller författare…","Search Knowledge Hub resources":"Sök bland Knowledge Hub-resurser","All content types":"Alla innehållstyper","Any date":"Valfritt datum","Past 7 days":"Senaste 7 dagarna","Past 30 days":"Senaste 30 dagarna","Past 90 days":"Senaste 90 dagarna","Custom dates":"Anpassade datum","Sort resources":"Sortera resurser","Newest first":"Nyast först","Most liked":"Mest gillade","Could not load the Knowledge Hub":"Det gick inte att läsa in Knowledge Hub","Please check your connection and try again.":"Kontrollera din anslutning och försök igen.","Build your community library":"Bygg ditt communitybibliotek","Share the first useful guide, talk, or audio resource with everyone.":"Dela den första användbara guiden, föredraget eller ljudresursen med alla.","Share the first resource":"Dela den första resursen","No resources found":"Inga resurser hittades","Try another search term or change the filters.":"Prova en annan sökterm eller ändra filtren.","Showing {shown} of {total} resource":"Visar {shown} av {total} resurs","Showing {shown} of {total} resources":"Visar {shown} av {total} resurser","Delete this resource?":"Ta bort den här resursen?","“{title}” will be permanently removed from the Knowledge Hub. This action cannot be undone.":"“{title}” tas bort permanent från Knowledge Hub. Det går inte att ångra.","Delete resource":"Ta bort resurs","Remove your like":"Ta bort ditt gillande","Like this resource":"Gilla den här resursen","You like this. Click to remove your like.":"Du gillar detta. Klicka för att ta bort ditt gillande.","Link copied":"Länken kopierad","It opens this resource in the Knowledge Hub.":"Den öppnar den här resursen i Knowledge Hub.","Couldn't copy link":"Det gick inte att kopiera länken","Post in review":"Inlägget granskas","An admin will review it before it appears.":"En administratör granskar det innan det visas.",Shared:"Delad","Posted to {channel}":"Publicerad i {channel}","Couldn't share the resource":"Det gick inte att dela resursen","Copy link":"Kopiera länk","Post to a channel":"Publicera i en kanal","Send in a message":"Skicka i ett meddelande","Posts “{title}” with a link that opens it in the Knowledge Hub.":"Publicerar “{title}” med en länk som öppnar den i Knowledge Hub.","Select channel":"Välj kanal","Add a message to introduce this to your community (optional). Type @ to mention someone.":"Lägg till ett meddelande för att presentera detta för din community (valfritt). Skriv @ för att nämna någon.","Posting…":"Publicerar…","Share it in a message. The link opens the resource in the Knowledge Hub.":"Dela den i ett meddelande. Länken öppnar resursen i Knowledge Hub.","{count} file":"{count} fil","{count} files":"{count} filer","Open {title} in the Knowledge Hub":"Öppna {title} i Knowledge Hub","Like this course":"Gilla den här kursen","It opens this course's page.":"Den öppnar kursens sida.","Posts “{title}” as a card members can like and open. Enrolling works as it does on the course page.":"Publicerar ”{title}” som ett kort som medlemmar kan gilla och öppna. Anmälan fungerar som på kurssidan.","Couldn't share the course":"Det gick inte att dela kursen","Share it in a message. The link opens the course's page.":"Dela den i ett meddelande. Länken öppnar kursens sida.","Open the course {title}":"Öppna kursen {title}","Paid plan":"Betalplan","Unlock {feature}":"Lås upp {feature}","Your current plan doesn't include it. Choose a plan to start using it.":"Din nuvarande plan inkluderar inte detta. Välj en plan för att börja använda det.","Included in every paid plan, from {price}.":"Ingår i alla betalplaner, från {price}.","Included in every paid plan.":"Ingår i alla betalplaner.","See plans":"Se planer","Maybe later":"Kanske senare","Reach your members in their inbox with campaigns, newsletters, sequences, funnels and forms.":"Nå dina medlemmar i inkorgen med kampanjer, nyhetsbrev, sekvenser, trattar och formulär.","Send campaigns and newsletters to your audience":"Skicka kampanjer och nyhetsbrev till din publik","Automated sequences, funnels and sign-up forms":"Automatiska sekvenser, trattar och registreringsformulär","Audience management and delivery analytics":"Publikhantering och leveransanalys","Automate your community: act when members join, post or reach a milestone, without writing code.":"Automatisera din community: agera när medlemmar går med, gör inlägg eller når en milstolpe, utan att skriva kod.","Automations triggered by joins, posts, streaks and more":"Automationer som utlöses av medlemskap, inlägg, serier och mer","Multi-step actions: notify, tag, award points, send email":"Åtgärder i flera steg: avisera, tagga, ge poäng, skicka e-post","Ready-made templates to start in minutes":"Färdiga mallar för att komma igång på några minuter","Member Analytics":"Medlemsanalys","See how each member uses your community: time spent, sessions and the pages they visit.":"Se hur varje medlem använder din community: tid, sessioner och sidorna de besöker.","Time spent and sessions for every member":"Tid och sessioner för varje medlem","Page journeys: where members go and for how long":"Sidresor: vart medlemmar går och hur länge","Look up any member in Insights":"Slå upp vilken medlem som helst i Insights","Content category":"Innehållskategori","Content categories":"Innehållskategorier","All categories":"Alla kategorier","No category":"Ingen kategori","Add “{name}”":"Lägg till ”{name}”","Filter by content category":"Filtrera efter innehållskategori","Search categories":"Sök kategorier","Search or type a new category":"Sök eller skriv en ny kategori","Loading…":"Laddar…","Couldn't load categories. Try again.":"Det gick inte att läsa in kategorier. Försök igen.","No categories match.":"Inga kategorier matchar.",Author:"Författare",Authors:"Författare","All authors":"Alla författare","Search authors":"Sök författare","Filter by author":"Filtrera efter författare","Couldn't load authors. Try again.":"Det gick inte att läsa in författare. Försök igen.","No authors match.":"Ingen författare matchar.","No resources have been shared yet.":"Inga resurser har delats ännu.","No courses have been made yet.":"Inga kurser har skapats ännu.","Shows only the resources one member has shared. The list has everyone who has shared a resource here, with how many each has shared; type a name to find someone. You can combine it with the other filters and the search box.":"Visar bara resurserna som en medlem har delat. Listan har alla som har delat en resurs här, med antal; skriv ett namn för att hitta någon. Kan kombineras med de andra filtren och sökrutan.","No resource has a category yet.":"Ingen resurs har en kategori än.","Show more":"Visa mer","What kind of resource this is, such as a research paper or an opinion piece. Members can filter the Knowledge Hub by it. Pick one, or type your own and choose Add.":"Vilken sorts resurs det här är, till exempel en forskningsrapport eller en debattartikel. Medlemmar kan filtrera Knowledge Hub efter den. Välj en, eller skriv en egen och välj Lägg till.",Filters:"Filter","{count} applied":"{count} valda","Content type":"Innehållstyp","Date shared":"Delningsdatum","Remove filter {name}":"Ta bort filtret {name}","Research Paper":"Forskningsrapport",Article:"Artikel","Lecture/Talk":"Föreläsning","Opinion Piece":"Debattartikel",General:"Allmänt",Football:"Fotboll",Education:"Utbildning",Physiotherapy:"Fysioterapi",Coaching:"Coachning","Sports Science":"Idrottsvetenskap","Strength & Conditioning":"Styrka och kondition",Recovery:"Återhämtning",Nutrition:"Kost",Medicine:"Medicin",Health:"Hälsa",Cars:"Bilar",Entertainment:"Underhållning",Programming:"Programmering",Technology:"Teknik",Business:"Företag",Science:"Vetenskap",Engineering:"Ingenjörskonst",Sports:"Sport",Arts:"Konst",Travel:"Resor",Food:"Mat",Resources:"Resurser","Could not load this course.":"Det gick inte att läsa in kursen.","Back to course overview":"Tillbaka till kursöversikten","Preview as learner":"Förhandsgranska som elev","Close table of contents":"Stäng innehållsförteckningen","Join {group} to continue learning.":"Gå med i {group} för att fortsätta lära dig.","the course's current group":"kursens nuvarande grupp","Enroll in this course to watch the lecture.":"Anmäl dig till kursen för att se föreläsningen.","Next lesson":"Nästa lektion","Table of contents":"Innehållsförteckning","Add a section to start building content.":"Lägg till ett avsnitt för att börja bygga innehåll.","No lessons available yet.":"Inga lektioner tillgängliga ännu.","Lesson completed":"Lektionen slutförd","Marked incomplete":"Markerad som ej slutförd","Could not update progress":"Det gick inte att uppdatera framstegen","Mark incomplete":"Markera som ej slutförd","Mark complete":"Markera som slutförd","You need to join this course before you can view its lessons.":"Du måste gå med i kursen innan du kan se lektionerna.","Go to course overview":"Gå till kursöversikten","No lesson selected":"Ingen lektion vald","Pick a lesson from the table of contents.":"Välj en lektion i innehållsförteckningen.","Lesson {current} of {total}":"Lektion {current} av {total}","This lesson has no written content yet.":"Den här lektionen har inget skrivet innehåll ännu.",Block:"Block","In this lesson":"I den här lektionen","Lesson content":"Lektionsinnehåll",Completed:"Slutförd","Completed {date}":"Slutförd {date}","Open PDF":"Öppna PDF","Quick check":"Snabbkoll",Assignment:"Uppgift","Submit your work in the lesson discussion below.":"Lämna in ditt arbete i lektionsdiskussionen nedan.",Quiz:"Quiz","Could not save quiz.":"Det gick inte att spara quizen.","Could not submit quiz":"Det gick inte att skicka in quizen","Select all answers that apply.":"Markera alla svar som stämmer.","This is an open-ended check — continue when you are ready.":"Det här är en öppen fråga — fortsätt när du är redo.","Submit quiz":"Skicka in quiz","You {status} the quiz.":"Du har {status} quizen.",passed:"klarat","didn't pass":"inte klarat","Great job!":"Bra jobbat!","Review the answers below, then try again.":"Gå igenom svaren nedan och försök sedan igen.","Retake quiz":"Gör om quizen",Score:"Poäng","Correct answers":"Rätta svar",Correct:"Rätt",Incorrect:"Fel",You:"Du","Could not post your comment":"Det gick inte att publicera din kommentar","Could not update the comment":"Det gick inte att uppdatera kommentaren","Could not delete the comment":"Det gick inte att ta bort kommentaren",Discussion:"Diskussion","Loading comments…":"Läser in kommentarer…","No comments yet — start the discussion.":"Inga kommentarer ännu — starta diskussionen.","Add to the discussion…":"Bidra till diskussionen…","Redirecting now…":"Omdirigerar nu…","Redirecting in {count} second":"Omdirigerar om {count} sekund","Redirecting in {count} seconds":"Omdirigerar om {count} sekunder","Lesson complete":"Lektionen slutförd","Up next":"Nästa",Stay:"Stanna",Continue:"Fortsätt","Quiz result":"Quizresultat","Question-by-question review of this learner's quiz attempt.":"Genomgång fråga för fråga av elevens quizförsök.","Attempts: {count}":"Försök: {count}",Submitted:"Inskickad","You received {points} karma point.":"Du fick {points} karmapoäng.","You received {points} karma points.":"Du fick {points} karmapoäng.","Congratulations!":"Grattis!","You've successfully completed {course}.":"Du har slutfört {course}.","Keep reviewing":"Fortsätt granska",Text:"Text","Send feedback":"Skicka feedback","You can attach up to {max} screenshots":"Du kan bifoga upp till {max} skärmbilder","Only the first {count} screenshot was added":"Endast den första {count} skärmbilden lades till","Only the first {count} screenshots were added":"Endast de första {count} skärmbilderna lades till","Unsupported image type":"Bildtypen stöds inte","Larger than 10 MB":"Större än 10 MB","Upload failed":"Uppladdningen misslyckades","Add a short title.":"Lägg till en kort titel","Please add a bit more detail ({min}+ characters).":"Lägg till lite mer information (minst {min} tecken)","Bug report sent":"Felrapport skickad","Idea sent":"Idé skickad","Thanks! The SpatialChat Communities team will take a look.":"Tack! SpatialChat Communities-teamet tittar på det.","Couldn't send your feedback":"Det gick inte att skicka din feedback","Report a problem or suggest an improvement to the SpatialChat Communities team.":"Rapportera ett problem eller föreslå en förbättring till SpatialChat Communities-teamet.","Feedback type":"Typ av feedback","Report a bug":"Rapportera en bugg","Suggest an idea":"Föreslå en idé","e.g. Verify code shows “Validation error!”":"t.ex. Verifieringskoden visar “Valideringsfel!”","e.g. Let me schedule posts":"t.ex. Låt mig schemalägga inlägg","What happened?":"Vad hände?","What would you like?":"Vad skulle du vilja ha?","What did you do, what did you expect, and what happened instead?":"Vad gjorde du, vad förväntade du dig och vad hände i stället?","What problem are you trying to solve? How would this help you?":"Vilket problem försöker du lösa? Hur skulle detta hjälpa dig?",Screenshots:"Skärmbilder","(optional, up to {max})":"(valfritt, upp till {max})",Uploading:"Laddar upp","Add screenshot":"Lägg till skärmbild","or drop / paste (Ctrl/⌘+V) an image":"eller släpp / klistra in (Ctrl/⌘+V) en bild","Screenshots that failed to upload won't be sent. Remove them or try again.":"Skärmbilder som inte kunde laddas upp skickas inte. Ta bort dem eller försök igen.","Include technical details":"Inkludera tekniska uppgifter","(recommended)":"(rekommenderas)","Page, browser, and no recent errors. Passwords, tokens and emails are removed.":"Sida, webbläsare och inga senaste fel. Lösenord, tokens och e-postadresser tas bort.","Page, browser, and {count} recent error. Passwords, tokens and emails are removed.":"Sida, webbläsare och {count} senaste fel. Lösenord, tokens och e-postadresser tas bort.","Page, browser, and {count} recent errors. Passwords, tokens and emails are removed.":"Sida, webbläsare och {count} senaste fel. Lösenord, tokens och e-postadresser tas bort.","Page: {path}":"Sida: {path}","Browser: {browser}":"Webbläsare: {browser}","Screen: {width}x{height} · Build: {version}":"Skärm: {width}x{height} · Build: {version}","No errors captured in this session.":"Inga fel registrerades under den här sessionen.","The SpatialChat Communities team may contact me about this":"SpatialChat Communities-teamet får kontakta mig om detta","Uploading…":"Laddar upp…","Send report":"Skicka rapport","Send idea":"Skicka idé","{points} earned":"{points} intjänade","{points} to spend":"{points} att använda","Profile picture updated":"Profilbild uppdaterad","Couldn't update picture":"Det gick inte att uppdatera bilden","Cover photo updated":"Omslagsbild uppdaterad","Couldn't update cover":"Det gick inte att uppdatera omslaget","Link copied!":"Länken kopierad!","Profile link copied to clipboard.":"Profillänken kopierades till urklipp.",Cover:"Omslag","Joined {date}":"Gick med {date}","Badges & achievements":"Märken och prestationer","No badges earned yet — stay active to unlock your first one.":"Inga märken intjänade ännu — var aktiv för att låsa upp ditt första.",Badge:"Märke","You haven't posted yet.":"Du har inte publicerat något ännu.","No activity yet.":"Ingen aktivitet ännu.","Adjust cover photo":"Justera omslagsbild","Add a bio and interests from":"Lägg till en bio och intressen från","to fill out your About section.":"för att fylla i avsnittet Om.",Bio:"Bio",Interests:"Intressen","No achievement badges are configured for this community yet.":"Inga prestationsmärken har ställts in för den här communityn ännu.","Earned {date}":"Intjänat {date}","Profile updated":"Profilen uppdaterad","Your changes have been saved.":"Dina ändringar har sparats.","Couldn't save profile":"Det gick inte att spara profilen",Username:"Användarnamn","Checking availability…":"Kontrollerar tillgänglighet…","Username is available":"Användarnamnet är tillgängligt","Username is taken":"Användarnamnet är upptaget","3–64 chars: letters, numbers, _ or .":"3–64 tecken: bokstäver, siffror, _ eller .",Headline:"Rubrik",Location:"Plats","Social links":"Sociala länkar","Saving…":"Sparar…","Couldn't update preference":"Det gick inte att uppdatera inställningen","Email notifications":"E-postaviseringar","Choose which activity on your content sends you an email.":"Välj vilken aktivitet på ditt innehåll som skickar ett e-postmeddelande till dig.","Posts created":"Skapade inlägg","Comments made":"Skrivna kommentarer","Replies made":"Skrivna svar","Likes given":"Givna gillanden","Likes on your posts":"Gillanden på dina inlägg","Your posts commented":"Kommentarer på dina inlägg","Your replies received":"Svar du har fått","Followers gained":"Nya följare","Live sessions":"Livesessioner","Admin-assigned":"Tilldelat av admin",Other:"Övrigt","How you earned your {points}":"Så här tjänade du in dina {points}","No points yet — post, comment and react to start earning.":"Inga poäng ännu — publicera, kommentera och reagera för att börja tjäna poäng.","Language updated":"Språket uppdaterat","Using the community's language":"Använder communityns språk","Only you see this change.":"Bara du ser den här ändringen.","Couldn't change your language":"Det gick inte att ändra ditt språk",Language:"Språk","Menus, buttons and labels are shown in the language you pick here, for you only. Posts, comments and messages stay in the language they were written in. Other members keep the community's language unless they pick their own.":"Menyer, knappar och etiketter visas på det språk du väljer här, bara för dig. Inlägg, kommentarer och meddelanden behåller det språk de skrevs på. Andra medlemmar behåller communityns språk om de inte väljer ett eget.","Choose the language you read this community in.":"Välj det språk du läser den här communityn på.","My language":"Mitt språk","Community default":"Communityns standard","Console error":"Konsolfel","Console warning":"Konsolvarning",Crash:"Krasch","Unhandled error":"Ohanterat fel","Failed request":"Misslyckad begäran",About:"Om",Achievements:"Prestationer",Website:"Webbplats",Silver:"Silver",Gold:"Guld",Platinum:"Platina",Diamond:"Diamant",Elite:"Elit","Comments on my posts":"Kommentarer på mina inlägg","When someone comments on your post":"När någon kommenterar ditt inlägg","Replies to my comments":"Svar på mina kommentarer","When someone replies to your comment":"När någon svarar på din kommentar","Likes on my posts":"Gillanden på mina inlägg","When someone likes your post":"När någon gillar ditt inlägg","Reactions to my comments":"Reaktioner på mina kommentarer","When someone reacts to your comment":"När någon reagerar på din kommentar","Reactions to my replies":"Reaktioner på mina svar","When someone reacts to your reply":"När någon reagerar på ditt svar","Direct messages":"Direktmeddelanden","When you receive a direct message":"När du får ett direktmeddelande",Mentions:"Omnämnanden","When someone @mentions you":"När någon @nämner dig","Load more {label}":"Läs in fler {label}","Loading more {label}…":"Läser in fler {label}…",courses:"kurser",resources:"resurser",items:"objekt","About {label}":"Om {label}","Couldn't like this course":"Det gick inte att gilla kursen","Couldn't like this resource":"Det gick inte att gilla resursen","Couldn't remove your like":"Det gick inte att ta bort din gilla-markering","Notify members":"Meddela medlemmarna","Sends everyone in the community a notification about this resource, in the app and as a push notification on their phone or browser. Members who turned off notifications for this community don't get it.":"Skickar en avisering om den här resursen till alla i communityn, i appen och som push-avisering i telefonen eller webbläsaren. Medlemmar som har stängt av aviseringar för communityn får den inte.","It is now available in the Knowledge Hub, and members are being notified.":"Den finns nu i Knowledge Hub och medlemmarna får en avisering.","How posts are ordered":"Hur inlägg sorteras","Recent: newest first. Top posts: the most likes, of all time; comments don't change the order. Trending: the most likes and comments together, within the period you pick. Following: posts by people you follow.":"Senaste: nyast först. Toppinlägg: flest gilla-markeringar, genom tiderna; kommentarer påverkar inte ordningen. Trendar: flest gilla-markeringar och kommentarer tillsammans, inom perioden du väljer. Följer: inlägg från personer du följer.","Save this resource":"Spara den här resursen","Save this course":"Spara den här kursen","Remove from saved":"Ta bort från sparade","Saved. Click to remove it from your saved list.":"Sparad. Klicka för att ta bort den från din lista.","Find it any time under Saved in the Knowledge Hub.":"Du hittar den när som helst under Sparade i Knowledge Hub.","Find it any time under Saved on the Courses page.":"Du hittar den när som helst under Sparade på sidan Kurser.","Couldn't save this resource":"Det gick inte att spara resursen","Couldn't save this course":"Det gick inte att spara kursen","Couldn't remove it from saved":"Det gick inte att ta bort den från sparade","All resources":"Alla resurser",Show:"Visa","Press the bookmark on anything to save it here for later. Only you can see what you saved.":"Tryck på bokmärket på vad som helst för att spara det här till senare. Bara du ser vad du har sparat.","Date range":"Datumintervall",Today:"Idag","Last 7 days":"Senaste 7 dagarna","Last 4 weeks":"Senaste 4 veckorna","Last 6 months":"Senaste 6 månaderna","Last 12 months":"Senaste 12 månaderna","Month to date":"Hittills denna månad","Quarter to date":"Hittills detta kvartal","Year to date":"Hittills i år","All time":"Hela tiden",Start:"Start",End:"Slut",Clear:"Rensa",Apply:"Använd","Couldn't download this file":"Kunde inte ladda ner filen","A new category is saved with capital letters, so “fancy dress” becomes “Fancy Dress”, and one that already exists is reused rather than added twice.":"En ny kategori sparas med stora begynnelsebokstäver, så ”fancy dress” blir ”Fancy Dress”, och en kategori som redan finns återanvänds i stället för att läggas till två gånger.","Job title":"Yrkestitel","Your role, such as Head of Sports Science or Team Physiotherapist. It shows under your name in the member directory and on your profile, so members know who to contact.":"Din roll, till exempel chef för idrottsvetenskap eller lagets fysioterapeut. Den visas under ditt namn i medlemskatalogen och på din profil, så att medlemmar vet vem de ska kontakta.","e.g. Head of Sports Science":"t.ex. chef för idrottsvetenskap","Type where you are based, or use your current location: your browser asks first, and only the town and country are filled in. Your exact position is never saved. Check it, then save your profile.":"Skriv var du finns, eller använd din nuvarande plats: webbläsaren frågar först och bara ort och land fylls i. Din exakta position sparas aldrig. Kontrollera den och spara sedan din profil.","e.g. Stockholm, Sweden":"t.ex. Stockholm, Sverige","Finding you…":"Hittar dig…","Use my location":"Använd min plats","Please enter your location, or use your current location.":"Ange din plats, eller använd din nuvarande plats.","Fields marked * are required.":"Fält markerade med * är obligatoriska.","Your details in {community}":"Dina uppgifter i {community}","Your community details":"Dina uppgifter i communityn","Community details":"Uppgifter i communityn","Questions this community's admins ask every member. Your answers show in its member directory, except ones marked “Only admins see this”.":"Frågor som administratörerna i den här communityn ställer till alla medlemmar. Dina svar visas i medlemskatalogen, utom de som är markerade ”Bara administratörer ser detta”.","Couldn't save your profile":"Det gick inte att spara din profil","Check the highlighted detail, then save again.":"Kontrollera den markerade uppgiften och spara igen.","Location filled in":"Plats ifylld","Check it, then save your profile.":"Kontrollera den och spara sedan din profil.","Couldn't use your location":"Det gick inte att använda din plats","Please type your location.":"Skriv din plats.","Your browser can't share your location here. Please type it.":"Din webbläsare kan inte dela din plats här. Skriv den.","Location access is blocked. Allow it for this site in your browser settings, or type your location.":"Platsåtkomst är blockerad. Tillåt den för den här webbplatsen i webbläsarens inställningar, eller skriv din plats.","Finding your location took too long. Please try again, or type your location.":"Det tog för lång tid att hitta din plats. Försök igen, eller skriv din plats.","Your location isn't available right now. Please type it.":"Din plats är inte tillgänglig just nu. Skriv den.","Location lookup isn't available right now. Please type your location.":"Platssökning är inte tillgänglig just nu. Skriv din plats."},_De={EN:Pnn,JA:Lnn,ES:Rnn,DE:Ann,NL:Dnn,ET:Inn,FR:Mnn,CS:Tnn,SV:Onn,V1:_nn,NO:$nn};function Fnn(t){const e=_De[(t||"EN").toUpperCase()]??_De.EN;return n=>e[n]??n}function pn(t,e){return t.replace(/\{(\w+)\}/g,(n,r)=>r in e?String(e[r]):n)}const edt=y.createContext(t=>t);function Bnn({children:t}){var l;const{community:e}=qe(),n=(e==null?void 0:e.id)??null,{data:r}=lt({queryKey:["community-language",n],enabled:!!n,staleTime:5*6e4,queryFn:async()=>{var u;const d=(u=(await qj(n,dge)).configurable)==null?void 0:u.configurableValue;return typeof d=="string"&&d?d:"EN"}});jr();const s=((l=ro())==null?void 0:l.id)??null,{data:i}=lt({queryKey:Jct(n,s),enabled:!!(n&&s),staleTime:5*6e4,retry:!1,queryFn:()=>Xct(n)}),o=y.useMemo(()=>Fnn((i==null?void 0:i.language)||r),[i==null?void 0:i.language,r]);return a.jsx(edt.Provider,{value:o,children:t})}function Tn(){return y.useContext(edt)}const tdt="efc-home-widget-visibility",ndt="efc-homepage-settings",AD={bannerTitle:"Welcome to SpatialChat Communities",bannerDescription:"",coverImage:null,feedLayout:"list"};function Unn(){try{const t=localStorage.getItem(ndt);if(!t)return AD;const e=JSON.parse(t);return{...AD,...e,feedLayout:e.feedLayout==="compact"?"compact":"list"}}catch{return AD}}function ADe(t){localStorage.setItem(ndt,JSON.stringify(t))}const rdt=y.createContext(null);function znn({children:t}){const[e,n]=y.useState(Unn),r=y.useCallback(c=>{n(d=>({...d,...c}))},[]),s=y.useCallback(c=>{n(c)},[]),i=y.useCallback(()=>{n(c=>(ADe(c),c))},[]),o=y.useCallback(()=>{n(AD),ADe(AD)},[]),l=y.useMemo(()=>({settings:e,updateSettings:r,replaceSettings:s,persistSettings:i,resetToDefaults:o}),[e,r,s,i,o]);return a.jsx(rdt.Provider,{value:l,children:t})}function Vnn(){const t=y.useContext(rdt);if(!t)throw new Error("useHomepageSettings must be used within HomepageSettingsProvider");return t}const sdt=y.createContext({viewMode:"admin",isAdmin:!0,toggleViewMode:()=>{}});function Hnn({children:t}){const[e,n]=y.useState("admin"),r=()=>{n(s=>s==="admin"?"user":"admin")};return a.jsx(sdt.Provider,{value:{viewMode:e,isAdmin:e==="admin",toggleViewMode:r},children:t})}const X8=()=>y.useContext(sdt);function mge({title:t,description:e}){return a.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-4 px-6 text-center bg-background",children:[a.jsx(Ne,{className:"h-10 w-10 animate-spin text-primary","aria-hidden":!0}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-lg font-semibold text-foreground",children:t}),e?a.jsx("p",{className:"text-sm text-muted-foreground max-w-sm",children:e}):null]})]})}const GO=cI("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",{variants:{variant:{default:"bg-primary text-primary-foreground hover:bg-primary/90",destructive:"bg-destructive text-destructive-foreground hover:bg-destructive/90",outline:"border border-input bg-background hover:bg-accent hover:text-accent-foreground",secondary:"bg-secondary text-secondary-foreground hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),Z=y.forwardRef(({className:t,variant:e,size:n,asChild:r=!1,...s},i)=>{const o=r?TSe:"button";return a.jsx(o,{className:ee(GO({variant:e,size:n,className:t})),ref:i,...s})});Z.displayName="Button";const cR="support@spatial.chat";function my(t){return(t==null?void 0:t.platformStatus)==="suspended"}const Gnn=`This community has been suspended and cannot be entered. Contact support at ${cR}.`;function Wnn(t,e){const n=wo.communityUrlTemplate.replace("{subdomain}",t),r=new URL(n);return r.searchParams.set("token",e),r.toString()}function fge(){const t=window.location.hostname.toLowerCase();return t==="localhost"||t==="127.0.0.1"}function pge(t=ve.communities,e=typeof window<"u"?window.location.hostname:"",n=typeof window<"u"?window.location.protocol:"http:",r=typeof window<"u"?window.location.port:""){const s=String(e||"").toLowerCase(),i=r?`:${r}`:"";if(!s||s==="localhost"||s==="127.0.0.1")return t;if(s.endsWith(".localhost"))return`${n}//localhost${i}${t}`;for(const[l,c]of Object.entries(Fct))if(s===l||s.endsWith(`.${l}`))return`${n}//${c}${i}${t}`;const o=s.split(".").filter(Boolean);return o.length>=3?`${n}//${["app",...o.slice(1)].join(".")}${i}${t}`:t}function idt({className:t}){return a.jsx("a",{href:`mailto:${cR}`,className:t??"font-medium underline underline-offset-2",children:cR})}function qnn({logo:t}){const[e,n]=y.useState(!1);return y.useEffect(()=>n(!1),[t]),!(t!=null&&t.trim())||e?a.jsx("div",{className:"mx-auto mb-5 flex h-14 w-14 items-center justify-center rounded-full bg-destructive/10 text-destructive",children:a.jsx(mm,{className:"h-6 w-6","aria-hidden":!0})}):a.jsx("img",{src:t,alt:"",className:"mx-auto mb-5 h-16 w-16 rounded-xl object-cover",onError:()=>n(!0)})}function bje({communityName:t,communityLogo:e}){return a.jsx("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-background px-6 text-center",children:a.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-destructive/20 bg-card p-8 shadow-sm",children:[a.jsx(qnn,{logo:e}),a.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest text-destructive",children:"Suspended"}),a.jsx("h1",{className:"mt-2 text-xl font-semibold text-foreground",children:"This community has been suspended"}),a.jsxs("p",{className:"mt-3 text-sm leading-relaxed text-muted-foreground",children:[t?`${t} is temporarily unavailable.`:"This community is temporarily unavailable."," ","You cannot enter or join until it is restored. Contact support at"," ",a.jsx(idt,{}),"."]}),a.jsx(Z,{asChild:!0,className:"mt-6 rounded-full",children:a.jsx("a",{href:pge(),children:"Back to communities"})})]})})}function adt(t){const e=t.toLowerCase();return Xtn.some(n=>e===n||e===`www.${n}`)}function odt(t=window.location.hostname){if(!t||adt(t))return null;const e=t.split(".").filter(Boolean);if(t.endsWith(".localhost")&&e.length>=2)return e[0];if(e.length>=3){const n=e[0].toLowerCase();return n==="www"?null:n}return null}const Knn=[...Oct.map(t=>`.${t}`),".localhost"];function ldt(t=window.location.hostname){if(!t||adt(t))return null;const e=t.toLowerCase();if(Knn.some(n=>e.endsWith(n))){const n=e.split(".")[0];return n==="www"?null:n}return e.includes(".")?e:null}function e7(){return ldt()??wo.devCommunitySubdomain??null}function Ynn(){return e7()===null}function Qnn(){return fge()&&!wo.devCommunitySubdomain}function Xee(t,e,n){const r=e.trim().toLowerCase();return(t==null?void 0:t.trim().toLowerCase())===r?!0:(n==null?void 0:n.trim().toLowerCase())===r}const cdt="pensil.tour-completed",gY="New User";function xje(){return localStorage.getItem(cdt)!=null}function ddt(){xje()||lh("tour-completed"),localStorage.setItem(cdt,"true")}function udt(t){const e=t==null?void 0:t.welcomeMessages;return!(e!=null&&e.length)||e.length===1&&e[0]===""?!1:e.some(n=>n&&n.trim().length>0)}function gge(t){const e=ro();if(!e||!t)return null;if(e.name===gY)return"profile";const n=udt(t),r=xje();return n&&!r?"welcome":!r&&t.myRole==="admin"&&e.name!==gY&&!n?"admin-tour":null}function hdt(t){return gge(t)!==null}function mdt(t){return hdt(t)?ve.communitiesOnboarding:ve.dashboard}function wje(t){return t?t.isLoginRequired===!1&&t.needsAdminVerification!==!0:!1}function kje(){return!!Nd()}function Sje(){const t=window.location.pathname+window.location.search,e=t&&t!=="/"?`?redirect=${encodeURIComponent(t)}`:"";return`${ve.signIn}${e}`}function xm(t){return{id:String(t.id),name:t.name,description:typeof t.description=="string"?t.description:void 0,address:t.address,logo:t.logo??null,darkModeLogo:t.darkModeLogo??null,banner:t.banner??null,myRole:typeof t.myRole=="string"?t.myRole:void 0,joined:t.joined,isByMe:t.isByMe,welcomeMessages:Array.isArray(t.welcomeMessages)?t.welcomeMessages:void 0,showOnboardingList:typeof t.showOnboardingList=="boolean"?t.showOnboardingList:void 0,isCommunitySwitcherDisabled:typeof t.isCommunitySwitcherDisabled=="boolean"?t.isCommunitySwitcherDisabled:void 0,needsAdminVerification:typeof t.needsAdminVerification=="boolean"?t.needsAdminVerification:void 0,joinVerifiedByAdmin:typeof t.joinVerifiedByAdmin=="boolean"?t.joinVerifiedByAdmin:void 0,isMobileAndEmailVerificationRequired:typeof t.isMobileAndEmailVerificationRequired=="boolean"?t.isMobileAndEmailVerificationRequired:void 0,isLoginRequired:typeof t.isLoginRequired=="boolean"?t.isLoginRequired:void 0,platformStatus:typeof t.platformStatus=="string"?t.platformStatus:void 0,resolvedFromHost:typeof t.resolvedFromHost=="string"?t.resolvedFromHost:void 0,privacyPolicyLink:typeof t.privacyPolicyLink=="string"?t.privacyPolicyLink:void 0,termsAndConditionsLink:typeof t.termsAndConditionsLink=="string"?t.termsAndConditionsLink:void 0}}function Znn(){const t=new URL(window.location.href);if(!t.searchParams.has("action"))return;t.searchParams.delete("action");const e=t.searchParams.toString();window.history.replaceState({},"",e?`${t.pathname}?${e}`:t.pathname)}async function Jnn(t){const e=t.trim().toLowerCase(),{community:n}=await Zee(e);let r=xm({...n,address:n.address??e}),s=!1;try{const{community:i}=await lR(r.id);s=!0,r=xm({...r,...i,address:i.address??r.address})}catch{}if(s&&r.joined!==!0&&r.platformStatus!=="suspended"){const{community:i}=await vnn(r.id);r=xm({...r,...i,address:i.address??r.address}),lh("subscribe-community",{communityId:r.id,community:r.name})}return Znn(),r.resolvedFromHost=e,r}async function fdt(t){const e=t.trim().toLowerCase(),{community:n}=await Zee(e);let r=xm({...n,address:n.address??e});try{const{community:s}=await lR(r.id);r=xm({...r,...s,address:s.address??r.address})}catch{}return r.resolvedFromHost=e,r}function Xnn(t,e){return my(t)||!t.platformStatus?!1:e?t.joined===!0:wje(t)}function ern(t){return t?ve.communities:ve.signUp}function trn(){const{isAuthenticated:t,authLoading:e}=jr(),{community:n,setCommunity:r}=qe(),[s,i]=y.useState("loading"),[o,l]=y.useState(""),[c,d]=y.useState(null),[u,h]=y.useState(null),m=e7();if(y.useEffect(()=>{if(e)return;if(!m){i("ready");return}if(n&&Xee(n.address,m,n.resolvedFromHost)&&Xnn(n,t)){i("ready");return}let f=!1;async function p(){i("loading"),l("");try{if(t){const v=await Jnn(m);if(f)return;r(v),h(v.name),i(my(v)?"suspended":"ready");return}const g=await fdt(m);if(f)return;wje(g)?(r(g),h(g.name),i(my(g)?"suspended":"ready")):i("login-required")}catch(g){if(f)return;l(g instanceof ze?g.message:"Couldn't load this community."),d(g instanceof ze?g.status:null),i("error")}}return p(),()=>{f=!0}},[e,t,m,n,r]),e)return a.jsx(mge,{title:"Loading…"});if(s==="login-required"){const f=window.location.search;return new URLSearchParams(f).has("redirect")?a.jsx(Gs,{to:{pathname:ve.signUp,search:f},replace:!0}):a.jsx(Gs,{to:Sje(),replace:!0})}if(!m&&s==="ready")return a.jsx(Gs,{to:ern(t),replace:!0});if(s==="suspended")return a.jsx(bje,{communityName:(n==null?void 0:n.name)||u||void 0,communityLogo:n==null?void 0:n.logo});if(s==="ready"){const f=new URLSearchParams(window.location.search).get("redirect");if(f&&f.startsWith("/")&&!f.startsWith("//"))return a.jsx(Gs,{to:f,replace:!0})}if(s==="loading")return a.jsx(mge,{title:m?"Opening your community":"Loading…",description:m?u||`Fetching ${m}…`:void 0});if(s==="error"){const f=c===404;return a.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center gap-4 px-6 text-center",children:[a.jsx("p",{className:"text-lg font-semibold",children:f?"This community is not available":"Community unavailable"}),a.jsx("p",{className:"text-sm text-muted-foreground max-w-md",children:f?`There is no community at “${m}”. It may have been moved or deactivated.`:o}),a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("a",{href:pge(),className:"text-sm text-primary underline",children:"Choose another community"}),f&&a.jsx("a",{href:pge(ve.communitiesCreate),className:"text-sm text-primary underline",children:"Create your own"})]})]})}return a.jsx(Gs,{to:mdt(n),replace:!0})}function PDe({compact:t}){const e=t?"h-11 flex-1 rounded-full bg-primary text-primary-foreground hover:bg-primary/90":"h-11 flex-1 rounded-full border-0 bg-white font-semibold text-primary shadow-md hover:bg-white/95",n=t?"h-11 flex-1 rounded-full border-gray-200 bg-white text-gray-900 hover:bg-gray-50 hover:text-gray-900":"h-11 flex-1 rounded-full border-white/40 bg-white/15 text-white hover:bg-white/25 hover:text-white";return a.jsxs("div",{className:t?"flex flex-col gap-3 sm:flex-row":"flex flex-col gap-3 rounded-2xl border border-white/25 bg-white/10 p-4 shadow-[0_12px_40px_rgba(0,55,150,0.12)] backdrop-blur-xl sm:flex-row sm:p-5",children:[a.jsx(Z,{className:e,asChild:!0,children:a.jsxs(vr,{to:ve.communitiesCreate,children:[a.jsx(Dn,{className:"mr-2 h-4 w-4"}),"Create community"]})}),a.jsx(Z,{variant:"outline",className:n,asChild:!0,children:a.jsxs(vr,{to:ve.communitiesJoin,children:[a.jsx(Sa,{className:"mr-2 h-4 w-4"}),"Join community"]})})]})}var pdt={exports:{}},gdt={};/**
 * @license React
 * use-sync-external-store-shim.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var dR=y;function nrn(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var rrn=typeof Object.is=="function"?Object.is:nrn,srn=dR.useState,irn=dR.useEffect,arn=dR.useLayoutEffect,orn=dR.useDebugValue;function lrn(t,e){var n=e(),r=srn({inst:{value:n,getSnapshot:e}}),s=r[0].inst,i=r[1];return arn(function(){s.value=n,s.getSnapshot=e,Yoe(s)&&i({inst:s})},[t,n,e]),irn(function(){return Yoe(s)&&i({inst:s}),t(function(){Yoe(s)&&i({inst:s})})},[t]),orn(n),n}function Yoe(t){var e=t.getSnapshot;t=t.value;try{var n=e();return!rrn(t,n)}catch{return!0}}function crn(t,e){return e()}var drn=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?crn:lrn;gdt.useSyncExternalStore=dR.useSyncExternalStore!==void 0?dR.useSyncExternalStore:drn;pdt.exports=gdt;var vdt=pdt.exports;function urn(){return vdt.useSyncExternalStore(hrn,()=>!0,()=>!1)}function hrn(){return()=>{}}var Cje="Avatar",[mrn,Zks]=il(Cje),[frn,ydt]=mrn(Cje),bdt=y.forwardRef((t,e)=>{const{__scopeAvatar:n,...r}=t,[s,i]=y.useState("idle");return a.jsx(frn,{scope:n,imageLoadingStatus:s,onImageLoadingStatusChange:i,children:a.jsx(Sn.span,{...r,ref:e})})});bdt.displayName=Cje;var xdt="AvatarImage",wdt=y.forwardRef((t,e)=>{const{__scopeAvatar:n,src:r,onLoadingStatusChange:s=()=>{},...i}=t,o=ydt(xdt,n),l=prn(r,i),c=Lo(d=>{s(d),o.onImageLoadingStatusChange(d)});return rl(()=>{l!=="idle"&&c(l)},[l,c]),l==="loaded"?a.jsx(Sn.img,{...i,ref:e,src:r}):null});wdt.displayName=xdt;var kdt="AvatarFallback",Sdt=y.forwardRef((t,e)=>{const{__scopeAvatar:n,delayMs:r,...s}=t,i=ydt(kdt,n),[o,l]=y.useState(r===void 0);return y.useEffect(()=>{if(r!==void 0){const c=window.setTimeout(()=>l(!0),r);return()=>window.clearTimeout(c)}},[r]),o&&i.imageLoadingStatus!=="loaded"?a.jsx(Sn.span,{...s,ref:e}):null});Sdt.displayName=kdt;function RDe(t,e){return t?e?(t.src!==e&&(t.src=e),t.complete&&t.naturalWidth>0?"loaded":"loading"):"error":"idle"}function prn(t,{referrerPolicy:e,crossOrigin:n}){const r=urn(),s=y.useRef(null),i=r?(s.current||(s.current=new window.Image),s.current):null,[o,l]=y.useState(()=>RDe(i,t));return rl(()=>{l(RDe(i,t))},[i,t]),rl(()=>{const c=h=>()=>{l(h)};if(!i)return;const d=c("loaded"),u=c("error");return i.addEventListener("load",d),i.addEventListener("error",u),e&&(i.referrerPolicy=e),typeof n=="string"&&(i.crossOrigin=n),()=>{i.removeEventListener("load",d),i.removeEventListener("error",u)}},[i,n,e]),o}var Cdt=bdt,jdt=wdt,Edt=Sdt;const oo=y.forwardRef(({className:t,...e},n)=>a.jsx(Cdt,{ref:n,className:ee("relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",t),...e}));oo.displayName=Cdt.displayName;const lo=y.forwardRef(({className:t,...e},n)=>a.jsx(jdt,{ref:n,className:ee("aspect-square h-full w-full object-cover",t),...e}));lo.displayName=jdt.displayName;const co=y.forwardRef(({className:t,...e},n)=>a.jsx(Edt,{ref:n,className:ee("flex h-full w-full items-center justify-center rounded-full bg-muted",t),...e}));co.displayName=Edt.displayName;const grn=cI("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground"}},defaultVariants:{variant:"default"}});function ga({className:t,variant:e,...n}){return a.jsx("div",{className:ee(grn({variant:e}),t),...n})}const Oe=y.forwardRef(({className:t,type:e,...n},r)=>a.jsx("input",{type:e,className:ee("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-foreground placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm",t),ref:r,...n}));Oe.displayName="Input";function vY(t){const e=t.trim();return e?`${e}.${oR}`:`….${oR}`}function jje({id:t,value:e,onChange:n,disabled:r,placeholder:s="my-community",autoFocus:i,className:o}){return a.jsxs("div",{className:ee("flex h-10 w-full overflow-hidden rounded-md border border-input bg-background text-sm shadow-sm","focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2 focus-within:ring-offset-background",r&&"opacity-60 cursor-not-allowed",o),children:[a.jsx(Oe,{id:t,value:e,onChange:l=>n(l.target.value.replace(/\s/g,"").toLowerCase()),placeholder:s,disabled:r,autoFocus:i,autoComplete:"off",className:"h-full flex-1 min-w-0 border-0 rounded-none shadow-none focus-visible:ring-0 focus-visible:ring-offset-0"}),a.jsxs("span",{className:"flex shrink-0 items-center border-l border-input bg-muted/40 px-3 text-muted-foreground","aria-hidden":!0,children:[".",oR]})]})}function vrn(t){return t.split(/\s+/).filter(Boolean).slice(0,2).map(e=>{var n;return((n=e[0])==null?void 0:n.toUpperCase())??""}).join("")}function yrn(t){return t.toLowerCase().includes("admin")?"bg-primary/15 text-primary border-primary/20":"bg-gray-100 text-gray-600 border-transparent"}function brn({community:t,onSelect:e,disabled:n,isEntering:r}){return a.jsx("button",{type:"button",disabled:n,onClick:e,className:ee("group w-full rounded-2xl border border-white/60 bg-white/95 p-4 text-left text-gray-900 shadow-md","transition-all duration-200 ease-out","hover:border-white hover:bg-white hover:shadow-xl hover:scale-[1.01]","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-white/50 focus-visible:ring-offset-2 focus-visible:ring-offset-transparent","active:scale-[0.99]",(n||r)&&"pointer-events-none opacity-70"),children:a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs(oo,{className:"h-14 w-14 shrink-0 rounded-xl ring-2 ring-primary/10",children:[t.logo?a.jsx(lo,{src:t.logo,alt:"",className:"rounded-xl"}):null,a.jsx(co,{className:"rounded-xl bg-gradient-to-br from-primary/20 to-primary/5 text-base font-semibold text-primary",children:vrn(t.name)})]}),a.jsxs("div",{className:"min-w-0 flex-1 space-y-1.5",children:[a.jsx("p",{className:"truncate font-semibold text-gray-900 group-hover:text-primary transition-colors",children:t.name}),a.jsx("p",{className:"truncate text-xs text-gray-500",children:vY(t.address)}),t.myRole?a.jsx(ga,{variant:"outline",className:ee("text-[10px] font-medium uppercase tracking-wide",yrn(t.myRole)),children:t.myRole}):null,t.platformStatus==="suspended"?a.jsx(ga,{variant:"outline",className:"border-destructive/20 bg-destructive/10 text-[10px] font-medium uppercase tracking-wide text-destructive",children:"Suspended"}):null]}),a.jsx("div",{className:ee("flex h-9 w-9 shrink-0 items-center justify-center rounded-full transition-colors",r?"bg-primary/10 text-primary":"bg-gray-100 text-gray-500 group-hover:bg-primary/10 group-hover:text-primary"),children:r?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsx(io,{className:"h-5 w-5"})})]})})}function Ak({title:t,description:e,children:n,contentWidthClassName:r="max-w-2xl"}){const{logout:s,user:i}=jr();return a.jsxs("div",{className:"relative min-h-screen flex flex-col overflow-hidden",style:{background:Wct},children:[a.jsx("div",{className:"pointer-events-none absolute inset-0 overflow-hidden opacity-[0.07]",children:a.jsxs("svg",{className:"h-full w-full",viewBox:"0 0 1400 900",fill:"none","aria-hidden":!0,children:[a.jsx("path",{d:"M-100 500 Q200 300 500 500 Q800 700 1100 400 Q1300 200 1500 350",stroke:"white",strokeWidth:"2"}),a.jsx("path",{d:"M1400 100 Q1100 300 800 200 Q500 100 200 300 Q0 400 -100 350",stroke:"white",strokeWidth:"2"})]})}),a.jsxs("header",{className:"relative z-10 flex items-center justify-between border-b border-white/10 bg-white/5 px-6 py-4 backdrop-blur-md",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-3 text-left",children:[a.jsx("img",{src:J8,alt:"SpatialChat Communities",className:"h-11 w-11 shrink-0 object-contain drop-shadow-md"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-sm font-semibold text-white",children:"SpatialChat Communities"}),i!=null&&i.email?a.jsx("p",{className:"truncate text-xs text-white/70",children:i.email}):null]})]}),a.jsxs(Z,{type:"button",variant:"secondary",size:"sm",className:"shrink-0 rounded-full border-0 bg-white/90 text-neutral-900 shadow-sm hover:bg-white",onClick:s,children:[a.jsx(sI,{className:"mr-2 h-4 w-4"}),"Log out"]})]}),a.jsx("main",{className:"relative z-10 flex flex-1 flex-col items-center px-4 py-8 pb-12",children:a.jsxs("div",{className:ee("w-full space-y-6",r),children:[a.jsxs("div",{className:"space-y-2 text-center",children:[a.jsx("h1",{className:"text-3xl font-bold tracking-tight text-white sm:text-[2rem]",children:t}),e?a.jsx("p",{className:"mx-auto max-w-md text-sm leading-relaxed text-white/85",children:e}):null]}),n]})})]})}const xrn=cI("relative w-full rounded-lg border p-4 [&>svg~*]:pl-7 [&>svg+div]:translate-y-[-3px] [&>svg]:absolute [&>svg]:left-4 [&>svg]:top-4 [&>svg]:text-foreground",{variants:{variant:{default:"bg-background text-foreground",destructive:"border-destructive/50 text-destructive dark:border-destructive [&>svg]:text-destructive"}},defaultVariants:{variant:"default"}}),vI=y.forwardRef(({className:t,variant:e,...n},r)=>a.jsx("div",{ref:r,role:"alert",className:ee(xrn({variant:e}),t),...n}));vI.displayName="Alert";const t7=y.forwardRef(({className:t,...e},n)=>a.jsx("h5",{ref:n,className:ee("mb-1 font-medium leading-none tracking-tight",t),...e}));t7.displayName="AlertTitle";const yI=y.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ee("text-sm [&_p]:leading-relaxed",t),...e}));yI.displayName="AlertDescription";function sr({className:t,...e}){return a.jsx("div",{className:ee("animate-pulse rounded-md bg-muted",t),...e})}async function Eje(t,e){const n=Nd();if(!n)throw new Error("Session expired");let r=t;if(fge())try{const{community:o}=await lR(t.id);r=xm({...t,...o})}catch{r=t}if(my(r))throw new Error("This community has been suspended");e(r),lh("community-selected",{communityId:r.id,community:r.name});const s=mdt(r);if(fge()){window.location.href=s;return}const i=new URL(Wnn(t.address,n));s!==ve.dashboard&&(i.pathname=s),window.location.href=i.toString()}function IDe(){return a.jsxs(a.Fragment,{children:["This community has been suspended and cannot be entered. Contact support at"," ",a.jsx(idt,{className:"font-medium underline text-inherit"}),"."]})}function wrn(){return a.jsx("div",{className:"space-y-3",children:[1,2,3].map(t=>a.jsxs("div",{className:"flex items-center gap-4 rounded-2xl border border-white/30 bg-white/20 p-4 backdrop-blur-sm",children:[a.jsx(sr,{className:"h-14 w-14 shrink-0 rounded-xl bg-white/50"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx(sr,{className:"h-4 w-32 rounded-md bg-white/50"}),a.jsx(sr,{className:"h-3 w-48 rounded-md bg-white/40"}),a.jsx(sr,{className:"h-5 w-16 rounded-full bg-white/40"})]})]},t))})}function krn(){const[t,e]=y.useState([]),[n,r]=y.useState(!0),[s,i]=y.useState(null),[o,l]=y.useState(""),{setCommunity:c}=qe(),{toast:d}=yt(),u=async()=>{l(""),r(!0);try{const f=await fnn();e(f.communities??[])}catch(f){l(f instanceof ze?f.message:"Couldn't load your communities.")}finally{r(!1)}};y.useEffect(()=>{u()},[]);const h=async f=>{if(my(f)){d({title:"Community suspended",description:IDe(),variant:"destructive",duration:1e4});return}try{i(f.id),await Eje(f,c)}catch(p){d({title:p instanceof Error&&p.message==="This community has been suspended"?"Community suspended":"Session expired",description:p instanceof Error&&p.message==="This community has been suspended"?IDe():"Please sign in again.",variant:"destructive",duration:p instanceof Error&&p.message==="This community has been suspended"?1e4:void 0}),i(null)}},m=t.length===1?"1 community":`${t.length} communities`;return a.jsx(Ak,{title:"Your communities",description:"Pick a space to open, or start fresh by creating or joining one.",children:a.jsxs("div",{className:"w-full space-y-5",children:[n||t.length>0||o?a.jsx(PDe,{}):null,o?a.jsx(vI,{variant:"destructive",className:"border-red-200/50 bg-card/95 text-left",children:a.jsxs(yI,{className:"flex flex-col items-stretch gap-3",children:[a.jsx("span",{children:o}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"w-fit rounded-full",onClick:u,children:[a.jsx(Nl,{className:"mr-2 h-4 w-4"}),"Try again"]})]})}):null,n?a.jsx(wrn,{}):t.length>0?a.jsxs("div",{className:"space-y-3 text-left",children:[a.jsxs("div",{className:"flex items-center justify-between px-1",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest text-white/75",children:"Your spaces"}),a.jsx("span",{className:"rounded-full bg-white/15 px-2.5 py-0.5 text-xs font-medium text-white/90 backdrop-blur-sm",children:m})]}),a.jsx("div",{className:"space-y-3",children:t.map(f=>a.jsx(brn,{community:f,disabled:!!s,isEntering:s===f.id,onSelect:()=>h(f)},f.id))})]}):a.jsxs("div",{className:"light rounded-2xl border border-black/5 bg-white p-10 text-center text-gray-900 shadow-lg",children:[a.jsx("div",{className:"mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-2xl bg-primary/10",children:a.jsx(wr,{className:"h-7 w-7 text-primary"})}),a.jsx("h2",{className:"text-lg font-semibold text-gray-900",children:"No communities yet"}),a.jsx("p",{className:"mx-auto mt-2 max-w-sm text-sm leading-relaxed text-gray-600",children:"You're not in any community. Create your own hub or join one with an invite link."}),a.jsxs("div",{className:"mt-6 flex items-center justify-center gap-2 text-xs text-gray-500",children:[a.jsx(xo,{className:"h-3.5 w-3.5 text-primary"}),a.jsx("span",{children:"Get started in under a minute"})]}),a.jsx("div",{className:"mt-6",children:a.jsx(PDe,{compact:!0})})]})]})})}const Srn=[{type:"free",icon:wr,emoji:"🚁"},{type:"paid",icon:bO,emoji:"🚀"}];function Crn({selectedType:t,onSelectType:e}){const{user:n,logout:r}=jr(),s=(n==null?void 0:n.email)||(n==null?void 0:n.phone)||"your account";return a.jsxs("div",{className:"w-full space-y-8",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("p",{className:"text-lg font-semibold text-white",children:"How are you planning to use SpatialChat Communities?"}),a.jsx("p",{className:"mt-2 text-sm text-white/80",children:"We'll set up your community accordingly."})]}),a.jsxs("div",{className:"flex flex-col items-stretch gap-4 md:flex-row md:justify-center md:gap-4",children:[Srn.map(({type:i,icon:o,emoji:l})=>{const c=enn[i],d=t===i;return a.jsxs("button",{type:"button",onClick:()=>e(i),className:ee("light flex w-full flex-1 basis-0 flex-col rounded-xl border bg-card/95 p-5 text-left shadow-md transition-all md:max-w-[18rem]",d?"border-primary ring-2 ring-primary/30":"border-transparent hover:border-primary/40"),children:[a.jsx("div",{className:"mb-4 flex h-28 items-center justify-center rounded-lg bg-muted/50",children:a.jsx(o,{className:"h-14 w-14 text-primary/70",strokeWidth:1.25})}),a.jsxs("div",{className:"text-center text-base font-semibold text-foreground",children:[l," ",c.title]}),a.jsx("p",{className:"mt-1.5 min-h-[2.5rem] text-center text-xs leading-relaxed text-muted-foreground",children:c.subtitle}),a.jsxs("div",{className:"mt-auto pt-5",children:[a.jsx("p",{className:ee("text-center text-sm font-medium",d?"text-primary":"text-foreground"),children:c.price}),a.jsx("p",{className:"min-h-[1rem] text-center text-xs text-muted-foreground",children:c.footnote??" "})]})]},i)}),a.jsx("div",{className:"flex items-center justify-center md:flex-col",children:a.jsx("span",{className:"text-sm font-semibold uppercase text-white/90",children:"or"})}),a.jsxs(vr,{to:ve.communitiesJoin,className:"light flex w-full flex-1 basis-0 flex-col rounded-xl border border-transparent bg-card/95 p-5 shadow-md transition-all hover:border-primary/40 md:max-w-[18rem]",children:[a.jsx("div",{className:"mb-4 flex h-28 items-center justify-center rounded-lg bg-muted/50",children:a.jsx(Sa,{className:"h-14 w-14 text-primary/70",strokeWidth:1.25})}),a.jsx("div",{className:"text-center text-base font-semibold text-foreground",children:"🛵 Join community"}),a.jsx("p",{className:"mt-1.5 min-h-[2.5rem] text-center text-xs leading-relaxed text-muted-foreground",children:"Find other interesting communities to join."}),a.jsxs("div",{className:"mt-auto pt-5",children:[a.jsx("p",{className:"text-center text-sm font-medium text-foreground",children:"Join for free"}),a.jsx("p",{className:"min-h-[1rem] text-center text-xs text-muted-foreground",children:" "})]})]})]}),a.jsxs("div",{className:"space-y-2 text-center text-sm text-white/85",children:[a.jsxs("p",{children:["You're creating a community using"," ",a.jsx("span",{className:"font-semibold text-white",children:s}),"."]}),a.jsxs("p",{children:["If you don't intend to set up a community, you can"," ",a.jsxs("button",{type:"button",className:"font-medium text-white underline underline-offset-2 hover:text-white/90",onClick:()=>r(),children:["sign in with another ",n!=null&&n.email?"email":"account"]}),"."]})]})]})}function jrn({file:t,onChange:e,disabled:n}){const r=y.useRef(null),s=t?URL.createObjectURL(t):null;return a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsx("button",{type:"button",disabled:n,onClick:()=>{var i;return(i=r.current)==null?void 0:i.click()},className:ee("flex h-24 w-24 items-center justify-center overflow-hidden rounded-xl border-2 border-dashed border-border bg-muted/40 transition-colors hover:border-primary/50",n&&"pointer-events-none opacity-60"),children:s?a.jsx("img",{src:s,alt:"",className:"h-full w-full object-cover"}):a.jsxs("div",{className:"flex flex-col items-center gap-1 text-primary",children:[a.jsx(jy,{className:"h-6 w-6"}),a.jsx("span",{className:"text-xs font-semibold",children:"Set logo"})]})}),a.jsx("input",{ref:r,type:"file",accept:"image/*",className:"hidden",disabled:n,onChange:i=>{var o;return e(((o=i.target.files)==null?void 0:o[0])??null)}}),t?a.jsx("button",{type:"button",className:"text-xs text-muted-foreground hover:text-foreground",disabled:n,onClick:()=>e(null),children:"Remove logo"}):null]})}var Ern="Label",Ndt=y.forwardRef((t,e)=>a.jsx(Sn.label,{...t,ref:e,onMouseDown:n=>{var s;n.target.closest("button, input, select, textarea")||((s=t.onMouseDown)==null||s.call(t,n),!n.defaultPrevented&&n.detail>1&&n.preventDefault())}}));Ndt.displayName=Ern;var Tdt=Ndt;const Nrn=cI("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),_e=y.forwardRef(({className:t,...e},n)=>a.jsx(Tdt,{ref:n,className:ee(Nrn(),t),...e}));_e.displayName=Tdt.displayName;const us=y.forwardRef(({className:t,...e},n)=>a.jsx("textarea",{className:ee("flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),ref:n,...e}));us.displayName="Textarea";function Trn({selectedType:t,onCancel:e}){const n=Nn(),[r,s]=y.useState(""),[i,o]=y.useState(""),[l,c]=y.useState(""),[d,u]=y.useState(null),[h,m]=y.useState(!1),[f,p]=y.useState(""),[g,v]=y.useState("idle");y.useEffect(()=>{const x=i.trim().toLowerCase();if(!x){v("idle");return}if(!M2.test(x)){v("invalid");return}let w=!1;v("checking");const k=window.setTimeout(()=>{qct(x).then(S=>{w||v(S.addressAvailable?"available":"taken")}).catch(()=>{w||v("idle")})},400);return()=>{w=!0,window.clearTimeout(k)}},[i]);const b=async x=>{x.preventDefault(),p("");const w=i.trim().toLowerCase();if(r.trim().length<2){p("Community name must be at least 2 characters.");return}if(!M2.test(w)){p("Address must be 3–64 characters: letters, numbers, and hyphens (not at the ends).");return}if(g==="taken"){p("This address is already taken. Choose another.");return}m(!0);try{const k=await pnn({name:r.trim(),address:w,description:l.trim()||void 0,selectedType:t});let S=xm(k.community);if(d)try{const C=await cge(S.id,d);S=xm({...S,...C.community})}catch(C){const j=C instanceof ze?Dt(C.body,C.message):"Community created, but logo upload failed.";p(j),m(!1);return}n(ve.communitiesCreateOverview,{state:{community:S}})}catch(k){p(k instanceof ze?Dt(k.body,k.message):"Could not create community. Try again."),m(!1)}};return a.jsxs("form",{onSubmit:b,className:"space-y-4 text-left",children:[a.jsx(jrn,{file:d,onChange:u,disabled:h}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"create-name",children:"Your community name"}),a.jsx(Oe,{id:"create-name",value:r,onChange:x=>s(x.target.value),placeholder:"Enter here",disabled:h,autoFocus:!0,className:"h-11"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"create-address",children:"Your community address"}),a.jsx(jje,{id:"create-address",value:i,onChange:o,disabled:h,placeholder:"my-community"}),a.jsxs("p",{className:ee("text-xs",g==="available"&&"text-green-600",g==="taken"&&"text-destructive",g==="invalid"&&"text-destructive",(g==="idle"||g==="checking")&&"text-muted-foreground"),children:[g==="checking"&&"Checking availability…",g==="available"&&`${vY(i)} is available`,g==="taken"&&"This subdomain is already taken",g==="invalid"&&i.trim()&&"Invalid subdomain format",g==="idle"&&`Your community URL will be like ${vY("my-community")}`]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"create-description",children:"Description (optional)"}),a.jsx(us,{id:"create-description",value:l,onChange:x=>c(x.target.value),placeholder:"What is this community about?",disabled:h,rows:3})]}),f?a.jsx("p",{className:"text-sm text-destructive",children:f}):null,a.jsxs("div",{className:"flex flex-col-reverse gap-2 pt-2 sm:flex-row sm:justify-end",children:[a.jsx(Z,{type:"button",variant:"outline",className:"rounded-full",disabled:h,onClick:e,children:"Cancel"}),a.jsxs(Z,{type:"submit",className:"rounded-full",disabled:h||g==="taken"||!r.trim(),children:[h?a.jsx(Ne,{className:"h-4 w-4 animate-spin mr-2"}):null,"Create community"]})]})]})}function _rn(){const[t,e]=y.useState("type"),[n,r]=y.useState(null),s=i=>{r(i),e("details")};return t==="type"?a.jsx(Ak,{title:"Create community",description:"Choose how you want to use SpatialChat Communities.",contentWidthClassName:"max-w-4xl",children:a.jsxs("div",{className:"w-full",children:[a.jsxs(vr,{to:ve.communities,className:"mb-6 inline-flex items-center gap-1 text-sm text-white/85 hover:text-white transition-colors",children:[a.jsx(no,{className:"h-4 w-4"}),"Back to communities"]}),a.jsx(Crn,{selectedType:n,onSelectType:s})]})}):a.jsx(Ak,{title:"Create community",description:"Set a name and address for your community. You will be the admin.",children:a.jsxs("div",{className:"w-full text-left space-y-4",children:[a.jsxs("button",{type:"button",onClick:()=>e("type"),className:"inline-flex items-center gap-1 text-sm text-white/85 hover:text-white transition-colors",children:[a.jsx(no,{className:"h-4 w-4"}),"Back to plan selection"]}),a.jsx("div",{className:"light rounded-2xl bg-card/95 p-6 text-foreground shadow-md",children:n?a.jsx(Trn,{selectedType:n,onCancel:()=>e("type")}):null})]})})}function Arn(){var p;const t=Di(),{setCommunity:e}=qe(),[n,r]=y.useState(!1),[s,i]=y.useState(""),[o,l]=y.useState(!1),[c,d]=y.useState(!0),u=y.useRef(null),h=(p=t.state)==null?void 0:p.community,m=h?xm(h):null;if(!m)return a.jsx(Ak,{title:"Create community",description:"Start by creating a new community.",children:a.jsxs("div",{className:"light rounded-2xl bg-card/95 p-6 text-center text-sm text-muted-foreground shadow-md",children:[a.jsx("p",{children:"No community in progress. Create one first."}),a.jsx(Z,{asChild:!0,className:"mt-4 rounded-full",children:a.jsx(vr,{to:ve.communitiesCreate,children:"Create community"})})]})});const f=async()=>{r(!0),i("");try{await Eje(m,e)}catch(g){i(dn(g,"Could not enter community.")),r(!1)}};return a.jsx(Ak,{title:"Almost there",description:"A quick look at what is to come.",children:a.jsxs("div",{className:"light w-full max-w-3xl rounded-2xl bg-card/95 p-6 text-center text-foreground shadow-md",children:[a.jsx("h2",{className:"text-2xl font-semibold text-foreground",children:"A quick look of what is to come."}),a.jsx("p",{className:"mt-2.5 text-xs font-semibold text-muted-foreground",children:"This quick product tour covers just some of what SpatialChat Communities can do."}),a.jsx("div",{className:"mt-8 flex justify-center",children:o?a.jsx("p",{role:"status",className:"w-full max-w-[700px] rounded-lg bg-muted px-4 py-10 text-sm text-muted-foreground",children:"The tour video could not be loaded. You can continue to your community."}):a.jsxs("div",{className:"relative w-full max-w-[700px]",children:[a.jsxs("video",{ref:u,className:"aspect-video w-full rounded-lg bg-black",controls:!0,autoPlay:!0,muted:!0,playsInline:!0,preload:"metadata","aria-label":"SpatialChat Communities product tour",onError:()=>l(!0),onVolumeChange:g=>d(g.currentTarget.muted),children:[a.jsx("source",{src:wo.communityQuickOverviewVideoUrl,type:"video/mp4",onError:()=>l(!0)}),"Your browser does not support the video tag."]}),c?a.jsxs(Z,{type:"button",size:"sm",variant:"secondary",className:"absolute right-2 top-2 h-8 gap-1.5 rounded-full bg-white/90 px-3 text-xs shadow-md hover:bg-white sm:right-3 sm:top-3",onClick:()=>{const g=u.current;g&&(g.muted=!1,d(!1),g.play().catch(()=>{}))},children:[a.jsx(NSe,{className:"h-4 w-4","aria-hidden":"true"}),"Turn on sound"]}):null]})}),s?a.jsx("p",{className:"mt-4 text-sm text-destructive",children:s}):null,a.jsx("div",{className:"mt-8 flex justify-center",children:a.jsx(Z,{variant:"outline",className:"rounded-full px-8",disabled:n,onClick:()=>void f(),children:n?a.jsxs(a.Fragment,{children:[a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}),"Continuing…"]}):"Continue"})})]})})}var Qoe=0;function ete(){y.useEffect(()=>{const t=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",t[0]??MDe()),document.body.insertAdjacentElement("beforeend",t[1]??MDe()),Qoe++,()=>{Qoe===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(e=>e.remove()),Qoe--}},[])}function MDe(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}var Zoe="focusScope.autoFocusOnMount",Joe="focusScope.autoFocusOnUnmount",LDe={bubbles:!1,cancelable:!0},Prn="FocusScope",n7=y.forwardRef((t,e)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:s,onUnmountAutoFocus:i,...o}=t,[l,c]=y.useState(null),d=Lo(s),u=Lo(i),h=y.useRef(null),m=Sr(e,g=>c(g)),f=y.useRef({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;y.useEffect(()=>{if(r){let g=function(w){if(f.paused||!l)return;const k=w.target;l.contains(k)?h.current=k:bw(h.current,{select:!0})},v=function(w){if(f.paused||!l)return;const k=w.relatedTarget;k!==null&&(l.contains(k)||bw(h.current,{select:!0}))},b=function(w){if(document.activeElement===document.body)for(const S of w)S.removedNodes.length>0&&bw(l)};document.addEventListener("focusin",g),document.addEventListener("focusout",v);const x=new MutationObserver(b);return l&&x.observe(l,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",g),document.removeEventListener("focusout",v),x.disconnect()}}},[r,l,f.paused]),y.useEffect(()=>{if(l){$De.add(f);const g=document.activeElement;if(!l.contains(g)){const b=new CustomEvent(Zoe,LDe);l.addEventListener(Zoe,d),l.dispatchEvent(b),b.defaultPrevented||(Rrn($rn(_dt(l)),{select:!0}),document.activeElement===g&&bw(l))}return()=>{l.removeEventListener(Zoe,d),setTimeout(()=>{const b=new CustomEvent(Joe,LDe);l.addEventListener(Joe,u),l.dispatchEvent(b),b.defaultPrevented||bw(g??document.body,{select:!0}),l.removeEventListener(Joe,u),$De.remove(f)},0)}}},[l,d,u,f]);const p=y.useCallback(g=>{if(!n&&!r||f.paused)return;const v=g.key==="Tab"&&!g.altKey&&!g.ctrlKey&&!g.metaKey,b=document.activeElement;if(v&&b){const x=g.currentTarget,[w,k]=Irn(x);w&&k?!g.shiftKey&&b===k?(g.preventDefault(),n&&bw(w,{select:!0})):g.shiftKey&&b===w&&(g.preventDefault(),n&&bw(k,{select:!0})):b===x&&g.preventDefault()}},[n,r,f.paused]);return a.jsx(Sn.div,{tabIndex:-1,...o,ref:m,onKeyDown:p})});n7.displayName=Prn;function Rrn(t,{select:e=!1}={}){const n=document.activeElement;for(const r of t)if(bw(r,{select:e}),document.activeElement!==n)return}function Irn(t){const e=_dt(t),n=DDe(e,t),r=DDe(e.reverse(),t);return[n,r]}function _dt(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const s=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||s?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function DDe(t,e){for(const n of t)if(!Mrn(n,{upTo:e}))return n}function Mrn(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function Lrn(t){return t instanceof HTMLInputElement&&"select"in t}function bw(t,{select:e=!1}={}){if(t&&t.focus){const n=document.activeElement;t.focus({preventScroll:!0}),t!==n&&Lrn(t)&&e&&t.select()}}var $De=Drn();function Drn(){let t=[];return{add(e){const n=t[0];e!==n&&(n==null||n.pause()),t=ODe(t,e),t.unshift(e)},remove(e){var n;t=ODe(t,e),(n=t[0])==null||n.resume()}}}function ODe(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function $rn(t){return t.filter(e=>e.tagName!=="A")}var Orn=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},WN=new WeakMap,ZU=new WeakMap,JU={},Xoe=0,Adt=function(t){return t&&(t.host||Adt(t.parentNode))},Frn=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=Adt(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},Brn=function(t,e,n,r){var s=Frn(e,Array.isArray(t)?t:[t]);JU[n]||(JU[n]=new WeakMap);var i=JU[n],o=[],l=new Set,c=new Set(s),d=function(h){!h||l.has(h)||(l.add(h),d(h.parentNode))};s.forEach(d);var u=function(h){!h||c.has(h)||Array.prototype.forEach.call(h.children,function(m){if(l.has(m))u(m);else try{var f=m.getAttribute(r),p=f!==null&&f!=="false",g=(WN.get(m)||0)+1,v=(i.get(m)||0)+1;WN.set(m,g),i.set(m,v),o.push(m),g===1&&p&&ZU.set(m,!0),v===1&&m.setAttribute(n,"true"),p||m.setAttribute(r,"true")}catch(b){console.error("aria-hidden: cannot operate on ",m,b)}})};return u(e),l.clear(),Xoe++,function(){o.forEach(function(h){var m=WN.get(h)-1,f=i.get(h)-1;WN.set(h,m),i.set(h,f),m||(ZU.has(h)||h.removeAttribute(r),ZU.delete(h)),f||h.removeAttribute(n)}),Xoe--,Xoe||(WN=new WeakMap,WN=new WeakMap,ZU=new WeakMap,JU={})}},tte=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),s=Orn(t);return s?(r.push.apply(r,Array.from(s.querySelectorAll("[aria-live]"))),Brn(r,s,n,"aria-hidden")):function(){return null}},Gv=function(){return Gv=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},Gv.apply(this,arguments)};function Pdt(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n}function Urn(t,e,n){if(n||arguments.length===2)for(var r=0,s=e.length,i;r<s;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}var jG="right-scroll-bar-position",EG="width-before-scroll-bar",zrn="with-scroll-bars-hidden",Vrn="--removed-body-scroll-bar-size";function ele(t,e){return typeof t=="function"?t(e):t&&(t.current=e),t}function Hrn(t,e){var n=y.useState(function(){return{value:t,callback:e,facade:{get current(){return n.value},set current(r){var s=n.value;s!==r&&(n.value=r,n.callback(r,s))}}}})[0];return n.callback=e,n.facade}var Grn=typeof window<"u"?y.useLayoutEffect:y.useEffect,FDe=new WeakMap;function Wrn(t,e){var n=Hrn(null,function(r){return t.forEach(function(s){return ele(s,r)})});return Grn(function(){var r=FDe.get(n);if(r){var s=new Set(r),i=new Set(t),o=n.current;s.forEach(function(l){i.has(l)||ele(l,null)}),i.forEach(function(l){s.has(l)||ele(l,o)})}FDe.set(n,t)},[t]),n}function qrn(t){return t}function Krn(t,e){e===void 0&&(e=qrn);var n=[],r=!1,s={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:t},useMedium:function(i){var o=e(i,r);return n.push(o),function(){n=n.filter(function(l){return l!==o})}},assignSyncMedium:function(i){for(r=!0;n.length;){var o=n;n=[],o.forEach(i)}n={push:function(l){return i(l)},filter:function(){return n}}},assignMedium:function(i){r=!0;var o=[];if(n.length){var l=n;n=[],l.forEach(i),o=n}var c=function(){var u=o;o=[],u.forEach(i)},d=function(){return Promise.resolve().then(c)};d(),n={push:function(u){o.push(u),d()},filter:function(u){return o=o.filter(u),n}}}};return s}function Yrn(t){t===void 0&&(t={});var e=Krn(null);return e.options=Gv({async:!0,ssr:!1},t),e}var Rdt=function(t){var e=t.sideCar,n=Pdt(t,["sideCar"]);if(!e)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=e.read();if(!r)throw new Error("Sidecar medium not found");return y.createElement(r,Gv({},n))};Rdt.isSideCarExport=!0;function Qrn(t,e){return t.useMedium(e),Rdt}var Idt=Yrn(),tle=function(){},nte=y.forwardRef(function(t,e){var n=y.useRef(null),r=y.useState({onScrollCapture:tle,onWheelCapture:tle,onTouchMoveCapture:tle}),s=r[0],i=r[1],o=t.forwardProps,l=t.children,c=t.className,d=t.removeScrollBar,u=t.enabled,h=t.shards,m=t.sideCar,f=t.noRelative,p=t.noIsolation,g=t.inert,v=t.allowPinchZoom,b=t.as,x=b===void 0?"div":b,w=t.gapMode,k=Pdt(t,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noRelative","noIsolation","inert","allowPinchZoom","as","gapMode"]),S=m,C=Wrn([n,e]),j=Gv(Gv({},k),s);return y.createElement(y.Fragment,null,u&&y.createElement(S,{sideCar:Idt,removeScrollBar:d,shards:h,noRelative:f,noIsolation:p,inert:g,setCallbacks:i,allowPinchZoom:!!v,lockRef:n,gapMode:w}),o?y.cloneElement(y.Children.only(l),Gv(Gv({},j),{ref:C})):y.createElement(x,Gv({},j,{className:c,ref:C}),l))});nte.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1};nte.classNames={fullWidth:EG,zeroRight:jG};var Zrn=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function Jrn(){if(!document)return null;var t=document.createElement("style");t.type="text/css";var e=Zrn();return e&&t.setAttribute("nonce",e),t}function Xrn(t,e){t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e))}function esn(t){var e=document.head||document.getElementsByTagName("head")[0];e.appendChild(t)}var tsn=function(){var t=0,e=null;return{add:function(n){t==0&&(e=Jrn())&&(Xrn(e,n),esn(e)),t++},remove:function(){t--,!t&&e&&(e.parentNode&&e.parentNode.removeChild(e),e=null)}}},nsn=function(){var t=tsn();return function(e,n){y.useEffect(function(){return t.add(e),function(){t.remove()}},[e&&n])}},Mdt=function(){var t=nsn(),e=function(n){var r=n.styles,s=n.dynamic;return t(r,s),null};return e},rsn={left:0,top:0,right:0,gap:0},nle=function(t){return parseInt(t||"",10)||0},ssn=function(t){var e=window.getComputedStyle(document.body),n=e[t==="padding"?"paddingLeft":"marginLeft"],r=e[t==="padding"?"paddingTop":"marginTop"],s=e[t==="padding"?"paddingRight":"marginRight"];return[nle(n),nle(r),nle(s)]},isn=function(t){if(t===void 0&&(t="margin"),typeof window>"u")return rsn;var e=ssn(t),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:e[0],top:e[1],right:e[2],gap:Math.max(0,r-n+e[2]-e[0])}},asn=Mdt(),UA="data-scroll-locked",osn=function(t,e,n,r){var s=t.left,i=t.top,o=t.right,l=t.gap;return n===void 0&&(n="margin"),`
  .`.concat(zrn,` {
   overflow: hidden `).concat(r,`;
   padding-right: `).concat(l,"px ").concat(r,`;
  }
  body[`).concat(UA,`] {
    overflow: hidden `).concat(r,`;
    overscroll-behavior: contain;
    `).concat([e&&"position: relative ".concat(r,";"),n==="margin"&&`
    padding-left: `.concat(s,`px;
    padding-top: `).concat(i,`px;
    padding-right: `).concat(o,`px;
    margin-left:0;
    margin-top:0;
    margin-right: `).concat(l,"px ").concat(r,`;
    `),n==="padding"&&"padding-right: ".concat(l,"px ").concat(r,";")].filter(Boolean).join(""),`
  }
  
  .`).concat(jG,` {
    right: `).concat(l,"px ").concat(r,`;
  }
  
  .`).concat(EG,` {
    margin-right: `).concat(l,"px ").concat(r,`;
  }
  
  .`).concat(jG," .").concat(jG,` {
    right: 0 `).concat(r,`;
  }
  
  .`).concat(EG," .").concat(EG,` {
    margin-right: 0 `).concat(r,`;
  }
  
  body[`).concat(UA,`] {
    `).concat(Vrn,": ").concat(l,`px;
  }
`)},BDe=function(){var t=parseInt(document.body.getAttribute(UA)||"0",10);return isFinite(t)?t:0},lsn=function(){y.useEffect(function(){return document.body.setAttribute(UA,(BDe()+1).toString()),function(){var t=BDe()-1;t<=0?document.body.removeAttribute(UA):document.body.setAttribute(UA,t.toString())}},[])},csn=function(t){var e=t.noRelative,n=t.noImportant,r=t.gapMode,s=r===void 0?"margin":r;lsn();var i=y.useMemo(function(){return isn(s)},[s]);return y.createElement(asn,{styles:osn(i,!e,s,n?"":"!important")})},vge=!1;if(typeof window<"u")try{var XU=Object.defineProperty({},"passive",{get:function(){return vge=!0,!0}});window.addEventListener("test",XU,XU),window.removeEventListener("test",XU,XU)}catch{vge=!1}var qN=vge?{passive:!1}:!1,dsn=function(t){return t.tagName==="TEXTAREA"},Ldt=function(t,e){if(!(t instanceof Element))return!1;var n=window.getComputedStyle(t);return n[e]!=="hidden"&&!(n.overflowY===n.overflowX&&!dsn(t)&&n[e]==="visible")},usn=function(t){return Ldt(t,"overflowY")},hsn=function(t){return Ldt(t,"overflowX")},UDe=function(t,e){var n=e.ownerDocument,r=e;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var s=Ddt(t,r);if(s){var i=$dt(t,r),o=i[1],l=i[2];if(o>l)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},msn=function(t){var e=t.scrollTop,n=t.scrollHeight,r=t.clientHeight;return[e,n,r]},fsn=function(t){var e=t.scrollLeft,n=t.scrollWidth,r=t.clientWidth;return[e,n,r]},Ddt=function(t,e){return t==="v"?usn(e):hsn(e)},$dt=function(t,e){return t==="v"?msn(e):fsn(e)},psn=function(t,e){return t==="h"&&e==="rtl"?-1:1},gsn=function(t,e,n,r,s){var i=psn(t,window.getComputedStyle(e).direction),o=i*r,l=n.target,c=e.contains(l),d=!1,u=o>0,h=0,m=0;do{if(!l)break;var f=$dt(t,l),p=f[0],g=f[1],v=f[2],b=g-v-i*p;(p||b)&&Ddt(t,l)&&(h+=b,m+=p);var x=l.parentNode;l=x&&x.nodeType===Node.DOCUMENT_FRAGMENT_NODE?x.host:x}while(!c&&l!==document.body||c&&(e.contains(l)||e===l));return(u&&(Math.abs(h)<1||!s)||!u&&(Math.abs(m)<1||!s))&&(d=!0),d},ez=function(t){return"changedTouches"in t?[t.changedTouches[0].clientX,t.changedTouches[0].clientY]:[0,0]},zDe=function(t){return[t.deltaX,t.deltaY]},VDe=function(t){return t&&"current"in t?t.current:t},vsn=function(t,e){return t[0]===e[0]&&t[1]===e[1]},ysn=function(t){return`
  .block-interactivity-`.concat(t,` {pointer-events: none;}
  .allow-interactivity-`).concat(t,` {pointer-events: all;}
`)},bsn=0,KN=[];function xsn(t){var e=y.useRef([]),n=y.useRef([0,0]),r=y.useRef(),s=y.useState(bsn++)[0],i=y.useState(Mdt)[0],o=y.useRef(t);y.useEffect(function(){o.current=t},[t]),y.useEffect(function(){if(t.inert){document.body.classList.add("block-interactivity-".concat(s));var g=Urn([t.lockRef.current],(t.shards||[]).map(VDe),!0).filter(Boolean);return g.forEach(function(v){return v.classList.add("allow-interactivity-".concat(s))}),function(){document.body.classList.remove("block-interactivity-".concat(s)),g.forEach(function(v){return v.classList.remove("allow-interactivity-".concat(s))})}}},[t.inert,t.lockRef.current,t.shards]);var l=y.useCallback(function(g,v){if("touches"in g&&g.touches.length===2||g.type==="wheel"&&g.ctrlKey)return!o.current.allowPinchZoom;var b=ez(g),x=n.current,w="deltaX"in g?g.deltaX:x[0]-b[0],k="deltaY"in g?g.deltaY:x[1]-b[1],S,C=g.target,j=Math.abs(w)>Math.abs(k)?"h":"v";if("touches"in g&&j==="h"&&C.type==="range")return!1;var E=UDe(j,C);if(!E)return!0;if(E?S=j:(S=j==="v"?"h":"v",E=UDe(j,C)),!E)return!1;if(!r.current&&"changedTouches"in g&&(w||k)&&(r.current=S),!S)return!0;var N=r.current||S;return gsn(N,v,g,N==="h"?w:k,!0)},[]),c=y.useCallback(function(g){var v=g;if(!(!KN.length||KN[KN.length-1]!==i)){var b="deltaY"in v?zDe(v):ez(v),x=e.current.filter(function(S){return S.name===v.type&&(S.target===v.target||v.target===S.shadowParent)&&vsn(S.delta,b)})[0];if(x&&x.should){v.cancelable&&v.preventDefault();return}if(!x){var w=(o.current.shards||[]).map(VDe).filter(Boolean).filter(function(S){return S.contains(v.target)}),k=w.length>0?l(v,w[0]):!o.current.noIsolation;k&&v.cancelable&&v.preventDefault()}}},[]),d=y.useCallback(function(g,v,b,x){var w={name:g,delta:v,target:b,should:x,shadowParent:wsn(b)};e.current.push(w),setTimeout(function(){e.current=e.current.filter(function(k){return k!==w})},1)},[]),u=y.useCallback(function(g){n.current=ez(g),r.current=void 0},[]),h=y.useCallback(function(g){d(g.type,zDe(g),g.target,l(g,t.lockRef.current))},[]),m=y.useCallback(function(g){d(g.type,ez(g),g.target,l(g,t.lockRef.current))},[]);y.useEffect(function(){return KN.push(i),t.setCallbacks({onScrollCapture:h,onWheelCapture:h,onTouchMoveCapture:m}),document.addEventListener("wheel",c,qN),document.addEventListener("touchmove",c,qN),document.addEventListener("touchstart",u,qN),function(){KN=KN.filter(function(g){return g!==i}),document.removeEventListener("wheel",c,qN),document.removeEventListener("touchmove",c,qN),document.removeEventListener("touchstart",u,qN)}},[]);var f=t.removeScrollBar,p=t.inert;return y.createElement(y.Fragment,null,p?y.createElement(i,{styles:ysn(s)}):null,f?y.createElement(csn,{noRelative:t.noRelative,gapMode:t.gapMode}):null)}function wsn(t){for(var e=null;t!==null;)t instanceof ShadowRoot&&(e=t.host,t=t.host),t=t.parentNode;return e}const ksn=Qrn(Idt,xsn);var r7=y.forwardRef(function(t,e){return y.createElement(nte,Gv({},t,{ref:e,sideCar:ksn}))});r7.classNames=nte.classNames;var rte="Popover",[Odt,Jks]=il(rte,[sS]),s7=sS(),[Ssn,gS]=Odt(rte),Fdt=t=>{const{__scopePopover:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!1}=t,l=s7(e),c=y.useRef(null),[d,u]=y.useState(!1),[h,m]=Sd({prop:r,defaultProp:s??!1,onChange:i,caller:rte});return a.jsx(V8,{...l,children:a.jsx(Ssn,{scope:e,contentId:el(),triggerRef:c,open:h,onOpenChange:m,onOpenToggle:y.useCallback(()=>m(f=>!f),[m]),hasCustomAnchor:d,onCustomAnchorAdd:y.useCallback(()=>u(!0),[]),onCustomAnchorRemove:y.useCallback(()=>u(!1),[]),modal:o,children:n})})};Fdt.displayName=rte;var Bdt="PopoverAnchor",Udt=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=gS(Bdt,n),i=s7(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:l}=s;return y.useEffect(()=>(o(),()=>l()),[o,l]),a.jsx(H8,{...i,...r,ref:e})});Udt.displayName=Bdt;var zdt="PopoverTrigger",Vdt=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=gS(zdt,n),i=s7(n),o=Sr(e,s.triggerRef),l=a.jsx(Sn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Kdt(s.open),...r,ref:o,onClick:Kt(t.onClick,s.onOpenToggle)});return s.hasCustomAnchor?l:a.jsx(H8,{asChild:!0,...i,children:l})});Vdt.displayName=zdt;var Nje="PopoverPortal",[Csn,jsn]=Odt(Nje,{forceMount:void 0}),Hdt=t=>{const{__scopePopover:e,forceMount:n,children:r,container:s}=t,i=gS(Nje,e);return a.jsx(Csn,{scope:e,forceMount:n,children:a.jsx(Rl,{present:n||i.open,children:a.jsx(CE,{asChild:!0,container:s,children:r})})})};Hdt.displayName=Nje;var uR="PopoverContent",Gdt=y.forwardRef((t,e)=>{const n=jsn(uR,t.__scopePopover),{forceMount:r=n.forceMount,...s}=t,i=gS(uR,t.__scopePopover);return a.jsx(Rl,{present:r||i.open,children:i.modal?a.jsx(Nsn,{...s,ref:e}):a.jsx(Tsn,{...s,ref:e})})});Gdt.displayName=uR;var Esn=Ck("PopoverContent.RemoveScroll"),Nsn=y.forwardRef((t,e)=>{const n=gS(uR,t.__scopePopover),r=y.useRef(null),s=Sr(e,r),i=y.useRef(!1);return y.useEffect(()=>{const o=r.current;if(o)return tte(o)},[]),a.jsx(r7,{as:Esn,allowPinchZoom:!0,children:a.jsx(Wdt,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Kt(t.onCloseAutoFocus,o=>{var l;o.preventDefault(),i.current||(l=n.triggerRef.current)==null||l.focus()}),onPointerDownOutside:Kt(t.onPointerDownOutside,o=>{const l=o.detail.originalEvent,c=l.button===0&&l.ctrlKey===!0,d=l.button===2||c;i.current=d},{checkForDefaultPrevented:!1}),onFocusOutside:Kt(t.onFocusOutside,o=>o.preventDefault(),{checkForDefaultPrevented:!1})})})}),Tsn=y.forwardRef((t,e)=>{const n=gS(uR,t.__scopePopover),r=y.useRef(!1),s=y.useRef(!1);return a.jsx(Wdt,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var c,d;(c=t.onInteractOutside)==null||c.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),Wdt=y.forwardRef((t,e)=>{const{__scopePopover:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,disableOutsidePointerEvents:o,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onInteractOutside:u,...h}=t,m=gS(uR,n),f=s7(n);return ete(),a.jsx(n7,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(SE,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:u,onEscapeKeyDown:l,onPointerDownOutside:c,onFocusOutside:d,onDismiss:()=>m.onOpenChange(!1),children:a.jsx(bee,{"data-state":Kdt(m.open),role:"dialog",id:m.contentId,...f,...h,ref:e,style:{...h.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)"}})})})}),qdt="PopoverClose",_sn=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=gS(qdt,n);return a.jsx(Sn.button,{type:"button",...r,ref:e,onClick:Kt(t.onClick,()=>s.onOpenChange(!1))})});_sn.displayName=qdt;var Asn="PopoverArrow",Psn=y.forwardRef((t,e)=>{const{__scopePopover:n,...r}=t,s=s7(n);return a.jsx(xee,{...s,...r,ref:e})});Psn.displayName=Asn;function Kdt(t){return t?"open":"closed"}var Tje=Fdt,Ydt=Udt,Rsn=Vdt,_je=Hdt,ste=Gdt;const Ni=Tje,Ti=Rsn,yi=y.forwardRef(({className:t,align:e="center",sideOffset:n=4,...r},s)=>a.jsx(_je,{children:a.jsx(ste,{ref:s,align:e,sideOffset:n,className:ee("z-50 w-72 rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-none data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...r})}));yi.displayName=ste.displayName;function Isn(){return a.jsxs(Ni,{children:[a.jsx(Ti,{asChild:!0,children:a.jsx("button",{type:"button",className:"inline-flex h-6 w-6 items-center justify-center rounded-full bg-muted text-xs font-semibold text-muted-foreground hover:bg-muted/80","aria-label":"Address help",children:a.jsx(nS,{className:"h-3.5 w-3.5"})})}),a.jsxs(yi,{className:"w-72 text-xs",align:"start",children:[a.jsx("p",{className:"font-medium text-foreground",children:"Community address"}),a.jsx("p",{className:"mt-2 text-muted-foreground",children:"Ask the community owner or referrer for the address."}),a.jsx("p",{className:"mt-2 text-muted-foreground",children:"Use 3–64 characters: letters, numbers, and hyphens (not at the start or end). No spaces or underscores."}),a.jsxs("p",{className:"mt-2 rounded-md bg-muted p-2 text-muted-foreground",children:["Example: ",a.jsx("span",{className:"font-semibold text-foreground",children:"myclub"})," →"," ",a.jsxs("span",{className:"font-semibold text-foreground",children:["myclub.",oR]})]})]})]})}function i7(t){const e=y.useRef({value:t,previous:t});return y.useMemo(()=>(e.current.value!==t&&(e.current.previous=e.current.value,e.current.value=t),e.current.previous),[t])}var ite="Checkbox",[Msn,Xks]=il(ite),[Lsn,Aje]=Msn(ite);function Dsn(t){const{__scopeCheckbox:e,checked:n,children:r,defaultChecked:s,disabled:i,form:o,name:l,onCheckedChange:c,required:d,value:u="on",internal_do_not_use_render:h}=t,[m,f]=Sd({prop:n,defaultProp:s??!1,onChange:c,caller:ite}),[p,g]=y.useState(null),[v,b]=y.useState(null),x=y.useRef(!1),w=p?!!o||!!p.closest("form"):!0,k={checked:m,disabled:i,setChecked:f,control:p,setControl:g,name:l,form:o,value:u,hasConsumerStoppedPropagationRef:x,required:d,defaultChecked:ek(s)?!1:s,isFormControl:w,bubbleInput:v,setBubbleInput:b};return a.jsx(Lsn,{scope:e,...k,children:$sn(h)?h(k):r})}var Qdt="CheckboxTrigger",Zdt=y.forwardRef(({__scopeCheckbox:t,onKeyDown:e,onClick:n,...r},s)=>{const{control:i,value:o,disabled:l,checked:c,required:d,setControl:u,setChecked:h,hasConsumerStoppedPropagationRef:m,isFormControl:f,bubbleInput:p}=Aje(Qdt,t),g=Sr(s,u),v=y.useRef(c);return y.useEffect(()=>{const b=i==null?void 0:i.form;if(b){const x=()=>h(v.current);return b.addEventListener("reset",x),()=>b.removeEventListener("reset",x)}},[i,h]),a.jsx(Sn.button,{type:"button",role:"checkbox","aria-checked":ek(c)?"mixed":c,"aria-required":d,"data-state":nut(c),"data-disabled":l?"":void 0,disabled:l,value:o,...r,ref:g,onKeyDown:Kt(e,b=>{b.key==="Enter"&&b.preventDefault()}),onClick:Kt(n,b=>{h(x=>ek(x)?!0:!x),p&&f&&(m.current=b.isPropagationStopped(),m.current||b.stopPropagation())})})});Zdt.displayName=Qdt;var Pje=y.forwardRef((t,e)=>{const{__scopeCheckbox:n,name:r,checked:s,defaultChecked:i,required:o,disabled:l,value:c,onCheckedChange:d,form:u,...h}=t;return a.jsx(Dsn,{__scopeCheckbox:n,checked:s,defaultChecked:i,disabled:l,required:o,onCheckedChange:d,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:m})=>a.jsxs(a.Fragment,{children:[a.jsx(Zdt,{...h,ref:e,__scopeCheckbox:n}),m&&a.jsx(tut,{__scopeCheckbox:n})]})})});Pje.displayName=ite;var Jdt="CheckboxIndicator",Xdt=y.forwardRef((t,e)=>{const{__scopeCheckbox:n,forceMount:r,...s}=t,i=Aje(Jdt,n);return a.jsx(Rl,{present:r||ek(i.checked)||i.checked===!0,children:a.jsx(Sn.span,{"data-state":nut(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:e,style:{pointerEvents:"none",...t.style}})})});Xdt.displayName=Jdt;var eut="CheckboxBubbleInput",tut=y.forwardRef(({__scopeCheckbox:t,...e},n)=>{const{control:r,hasConsumerStoppedPropagationRef:s,checked:i,defaultChecked:o,required:l,disabled:c,name:d,value:u,form:h,bubbleInput:m,setBubbleInput:f}=Aje(eut,t),p=Sr(n,f),g=i7(i),v=z8(r);y.useEffect(()=>{const x=m;if(!x)return;const w=window.HTMLInputElement.prototype,S=Object.getOwnPropertyDescriptor(w,"checked").set,C=!s.current;if(g!==i&&S){const j=new Event("click",{bubbles:C});x.indeterminate=ek(i),S.call(x,ek(i)?!1:i),x.dispatchEvent(j)}},[m,g,i,s]);const b=y.useRef(ek(i)?!1:i);return a.jsx(Sn.input,{type:"checkbox","aria-hidden":!0,defaultChecked:o??b.current,required:l,disabled:c,name:d,value:u,form:h,...e,tabIndex:-1,ref:p,style:{...e.style,...v,position:"absolute",pointerEvents:"none",opacity:0,margin:0,transform:"translateX(-100%)"}})});tut.displayName=eut;function $sn(t){return typeof t=="function"}function ek(t){return t==="indeterminate"}function nut(t){return ek(t)?"indeterminate":t?"checked":"unchecked"}const ji=y.forwardRef(({className:t,...e},n)=>a.jsx(Pje,{ref:n,className:ee("peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:a.jsx(Xdt,{className:ee("flex items-center justify-center text-current"),children:a.jsx(Qn,{className:"h-4 w-4"})})}));ji.displayName=Pje.displayName;function Osn(){const t=Nn(),{setCommunity:e}=qe(),[n,r]=y.useState(""),[s,i]=y.useState(null),[o,l]=y.useState(!1),[c,d]=y.useState("idle"),[u,h]=y.useState(!1),[m,f]=y.useState(""),[p,g]=y.useState(!1);y.useEffect(()=>{const x=n.trim().toLowerCase();if(!x){i(null),l(!1),d("idle");return}if(!M2.test(x)){i(null),l(!1),d("invalid");return}let w=!1;d("checking");const k=window.setTimeout(()=>{Zee(x).then(S=>{w||(i(S.community.name),l(my(S.community)),d("found"))}).catch(()=>{w||(i(null),l(!1),d("not-found"))})},400);return()=>{w=!0,window.clearTimeout(k)}},[n]);const v=c==="found"&&!o&&!u,b=async x=>{x.preventDefault(),f("");const w=n.trim().toLowerCase();if(!M2.test(w)){f("Enter a valid community address.");return}if(c!=="found"){f("Community not found. Check the address with the owner.");return}if(o){f(Gnn);return}h(!0);try{const k=await gnn(w,{emailOptIn:p,emailOptInShown:!0});await Eje(xm(k.community),e)}catch(k){f(k instanceof ze?Dt(k.body,k.message):"Could not join community. Check the address and try again."),h(!1)}};return a.jsxs("form",{onSubmit:b,className:"space-y-4 text-left",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(_e,{htmlFor:"join-address",children:"Community address"}),a.jsx(Isn,{})]}),a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx("div",{className:"flex-1",children:a.jsx(jje,{id:"join-address",value:n,onChange:r,disabled:u,placeholder:"devcommunity",autoFocus:!0})}),a.jsx("div",{className:"mt-2 flex h-9 w-9 shrink-0 items-center justify-center",children:c==="checking"?a.jsx(Ne,{className:"h-4 w-4 animate-spin text-muted-foreground"}):c==="found"&&o?a.jsx(nn,{className:"h-5 w-5 text-destructive"}):c==="found"?a.jsx(Qn,{className:"h-5 w-5 text-green-600"}):(c==="not-found"||c==="invalid")&&n.trim()?a.jsx(nn,{className:"h-5 w-5 text-destructive"}):null})]}),a.jsxs("p",{className:ee("text-xs",c==="found"&&!o&&"text-green-600",(c==="found"&&o||c==="not-found"||c==="invalid")&&"text-destructive",(c==="idle"||c==="checking")&&"text-muted-foreground"),children:[c==="checking"&&`Looking up ${vY(n)}…`,c==="found"&&s&&!o&&`Found: ${s}`,c==="found"&&s&&o&&`${s} is suspended and cannot be joined. Contact support at ${cR}.`,c==="not-found"&&"No community at this address",c==="invalid"&&n.trim()&&"Invalid address format",c==="idle"&&!n.trim()&&"Enter the community subdomain you received"]})]}),c==="found"&&!o?a.jsxs("div",{className:"flex items-start gap-2.5 rounded-lg border border-border bg-muted/40 p-3",children:[a.jsx(ji,{id:"join-email-opt-in",checked:p,onCheckedChange:x=>g(x===!0),disabled:u,className:"mt-0.5"}),a.jsxs(_e,{htmlFor:"join-email-opt-in",className:"text-xs font-normal leading-relaxed text-muted-foreground",children:["Send me updates from ",s||"this community"," by email. You can turn this off anytime."]})]}):null,m?a.jsx("p",{className:"text-sm text-destructive",children:m}):null,a.jsxs("div",{className:"flex flex-col-reverse gap-2 pt-2 sm:flex-row sm:justify-end",children:[a.jsx(Z,{type:"button",variant:"outline",className:"rounded-full",disabled:u,onClick:()=>t(ve.communities),children:"Cancel"}),a.jsxs(Z,{type:"submit",className:"rounded-full",disabled:!v,children:[u?a.jsx(Ne,{className:"h-4 w-4 animate-spin mr-2"}):null,"Proceed"]})]})]})}function Fsn(){return a.jsx(Ak,{title:"Join a community",description:"Enter the community address.",children:a.jsxs("div",{className:"w-full text-left space-y-4",children:[a.jsxs(vr,{to:ve.communities,className:"inline-flex items-center gap-1 text-sm text-white/85 hover:text-white transition-colors",children:[a.jsx(no,{className:"h-4 w-4"}),"Back to communities"]}),a.jsx("div",{className:"light rounded-2xl bg-card/95 p-6 text-foreground shadow-md",children:a.jsx(Osn,{})})]})})}function Bsn(t){const e=ro(),[n,r]=y.useState(!1),[s,i]=y.useState(!1),o=(e==null?void 0:e.name)===gY&&!n,l=udt(t),c=xje(),d=y.useMemo(()=>e?o?"profile":l&&!c&&!s?"welcome":!c&&(t==null?void 0:t.myRole)==="admin"&&e.name!==gY&&(!l||s)?"admin-tour":null:null,[e,o,l,c,s,t==null?void 0:t.myRole]),u=y.useCallback(()=>r(!0),[]),h=y.useCallback(()=>i(!0),[]);return{activeStep:d,pensilUser:e,community:t,onProfileComplete:u,onWelcomeComplete:h}}function Usn(t,e){const n=(t??[]).map(r=>(r==null?void 0:r.trim())||"").filter(Boolean);return e&&!n.includes(e)&&n.push(e),n}function bI({sources:t,fallbackSrc:e,alt:n="",className:r,fallbackClassName:s}){const i=Usn(t,e),o=i.join("|"),[l,c]=y.useState(0),[d,u]=y.useState(!1);if(y.useEffect(()=>{c(0),u(!1)},[o]),d||i.length===0)return null;const h=i[Math.min(l,i.length-1)];return a.jsx("img",{src:h,alt:n,className:h===e&&s!==void 0?s:r,onError:()=>{l<i.length-1?c(m=>m+1):u(!0)}})}function zsn(t,e){switch(t){case"left":return{top:e.top,right:window.innerWidth-e.right+e.width+24,maxWidth:480};case"bottom":return{top:e.top+e.height+24,left:e.left,maxWidth:480};default:return{top:e.top,left:e.left+e.width+24,maxWidth:480}}}function Vsn({user:t,community:e,onComplete:n}){const{toast:r}=yt(),[s,i]=y.useState(-1),[o,l]=y.useState(!0),[,c]=y.useState(0),d=[{selector:".group-link-holder",heading:"Group & section lists",position:"right",content:a.jsxs("div",{className:"space-y-3 text-sm text-foreground",children:[a.jsx("p",{children:"Create groups and sections to organise content — discussions, files, and anything members share in your community."}),a.jsx("p",{className:"italic text-muted-foreground",children:"Example: Home is a group and Feed is a section."})]})},{selector:".HeaderUserDropDownHolder",heading:"Edit details",position:"left",content:a.jsx("p",{className:"text-sm text-foreground",children:"You can edit community and profile details from your profile menu."})}],u=()=>{ddt(),document.body.classList.remove("on-joyride"),l(!1),n()};if(y.useEffect(()=>{if(s>=0){document.body.classList.add("on-joyride");const v=window.setTimeout(()=>c(b=>b+1),100);return()=>window.clearTimeout(v)}document.body.classList.remove("on-joyride")},[s]),y.useEffect(()=>()=>document.body.classList.remove("on-joyride"),[]),!o)return null;const h=typeof window<"u"?window.location.origin:"";if(s===-1)return a.jsx("div",{className:"joyride-overlay joyride-prologue fixed inset-0 z-[10000] flex items-start justify-center bg-black/20 p-4 pt-8",children:a.jsxs("div",{className:"joyride-prologue-card relative max-w-md rounded-lg bg-card p-8 shadow-xl",children:[a.jsx(bI,{sources:[e.logo],fallbackSrc:J8,alt:"",className:"mb-2 max-h-10 max-w-[120px] object-contain"}),a.jsx("span",{className:"mb-5 block text-sm font-semibold text-muted-foreground",children:h}),a.jsxs("p",{className:"font-semibold text-foreground",children:["Congrats ",t.name,", your community has been created successfully."]}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Would you like a quick tour to help you get started?"}),a.jsxs("div",{className:"mt-6 flex items-center justify-between gap-4",children:[a.jsx("button",{type:"button",className:"text-sm font-semibold text-primary hover:underline",onClick:u,children:"Nah, I'll figure it out"}),a.jsx(Z,{onClick:()=>i(0),children:"Take tour"})]})]})});const m=d[s],f=document.querySelector(m.selector);if(!f)return s<d.length-1?(i(s+1),null):(u(),null);const p=f.getBoundingClientRect(),g=()=>{navigator.clipboard.writeText(h),r({title:"Copied to clipboard"})};return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"joyride-overlay fixed inset-0 z-[10000] pointer-events-none",children:a.jsx("div",{className:"joyride-spotlight pointer-events-auto absolute rounded-md bg-muted shadow-lg",style:{top:p.top,left:p.left,height:p.height,width:p.width}})}),a.jsxs("div",{className:"joyride-panel fixed z-[10001] rounded-md bg-card p-4 shadow-lg",style:zsn(m.position,p),children:[a.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[a.jsx("h3",{className:"font-semibold text-foreground",children:m.heading}),a.jsx("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-muted",onClick:u,"aria-label":"Close tour",children:a.jsx(nn,{className:"h-4 w-4"})})]}),m.content,s===1?a.jsxs("div",{className:"mt-4 rounded-md bg-primary/10 px-4 py-3 text-sm",children:[a.jsx("span",{className:"text-muted-foreground",children:"Invite to "}),a.jsx("span",{className:"font-semibold text-primary",children:h}),a.jsx(Z,{variant:"outline",size:"sm",className:"ml-3 mt-2",onClick:g,children:"Copy"})]}):null,a.jsxs("div",{className:"mt-8 flex items-center justify-between",children:[a.jsx("button",{type:"button",className:"text-sm font-semibold text-primary hover:underline disabled:opacity-40",disabled:s===0,onClick:()=>i(s-1),children:"Go back"}),a.jsxs("span",{className:"text-sm font-bold text-foreground",children:[s+1," / ",d.length]}),a.jsx(Z,{size:"sm",onClick:()=>{s<d.length-1?i(s+1):u()},children:s<d.length-1?"Next":"Done"})]})]})]})}const HDe=["#6366f1","#ec4899","#f59e0b","#10b981","#3b82f6","#8b5cf6","#ef4444","#14b8a6","#f97316","#06b6d4","#84cc16","#a855f7"];function Hsn(t){let e=0;for(let n=0;n<t.length;n++)e=t.charCodeAt(n)+((e<<5)-e);return Math.abs(e)}function Rje(t,e){return`${(t==null?void 0:t[0])||""}${(e==null?void 0:e[0])||""}`.toUpperCase()}function Gsn(t){const e=(t||"").trim().split(/\s+/).filter(Boolean);return Rje(e[0]||"",e[1]||"")||"?"}function Wsn(t){const e=t==null?void 0:t.trim();if(!e)return!1;try{const n=new URL(e,"http://pensil.local");return n.pathname.includes("/profile-picture/png")||n.hostname==="api.dicebear.com"}catch{return e.includes("/profile-picture/png")||e.includes("api.dicebear.com")}}function a7(t,e,n=128){const r=(t==null?void 0:t.trim())||"Guest",s=(e==null?void 0:e.trim())||"User",i=`${r} ${s}`.trim(),o=Rje(r,s)||"GU",l=HDe[Hsn(i)%HDe.length],c=Math.round(n*.36),d=`
    <svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${n}" viewBox="0 0 ${n} ${n}" role="img" aria-label="${i}">
      <circle cx="${n/2}" cy="${n/2}" r="${n/2}" fill="${l}" />
      <text x="50%" y="50%" dy="0.1em" text-anchor="middle" dominant-baseline="middle" fill="white" font-family="Arial, Helvetica, sans-serif" font-size="${c}" font-weight="700" letter-spacing="1">${o}</text>
    </svg>
  `;return`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(d)}`}function RE(t){return!!(t&&!Wsn(t)&&(t.startsWith("http")||t.startsWith("data:image")||t.startsWith("blob:")))}function o7(t,e,n=128){if(t&&RE(t))return t;const r=(e||"").trim().split(/\s+/).filter(Boolean);return a7(r[0]||"",r[1]||"",n)}function Pk(t,e=128){return t!=null&&t.picture&&RE(t.picture)?t.picture:a7((t==null?void 0:t.firstName)||"",(t==null?void 0:t.lastName)||"",e)}class PD extends Error{}function Ije(){return typeof navigator<"u"&&"geolocation"in navigator&&(typeof window>"u"||window.isSecureContext!==!1)}function qsn(){return new Promise((t,e)=>navigator.geolocation.getCurrentPosition(t,e,{enableHighAccuracy:!1,timeout:15e3,maximumAge:10*6e4}))}async function rut(t){if(!Ije())throw new PD(t("Your browser can't share your location here. Please type it."));let e;try{e=await qsn()}catch(n){const r=n==null?void 0:n.code;throw new PD(t(r===1?"Location access is blocked. Allow it for this site in your browser settings, or type your location.":r===3?"Finding your location took too long. Please try again, or type your location.":"Your location isn't available right now. Please type it."))}try{return await hWt(e.coords.latitude,e.coords.longitude)}catch(n){throw new PD(dn(n,t("Location lookup isn't available right now. Please type your location.")))}}const Ksn=/^[A-Za-z0-9_.]{3,63}$/;function Ysn({onComplete:t,onSessionUpdated:e}){const{toast:n}=yt(),r=Tn(),s=y.useRef(null),[i,o]=y.useState(""),[l,c]=y.useState(""),[d,u]=y.useState(""),[h,m]=y.useState(""),[f,p]=y.useState(!1),[g,v]=y.useState("idle"),[b,x]=y.useState(null),[w,k]=y.useState(null),[S,C]=y.useState(!1),[j,E]=y.useState(""),N=i.trim().length>=2&&i.trim().length<=50,A=h.trim().length>=2;y.useEffect(()=>{const F=l.trim();if(!F){v("idle");return}if(!Ksn.test(F)){v("invalid");return}v("checking");const D=setTimeout(()=>{dCe(F).then(I=>v(I?"available":"taken")).catch(()=>v("idle"))},400);return()=>clearTimeout(D)},[l]);const _=F=>{F&&(x(F),k(URL.createObjectURL(F)))},T=async()=>{p(!0);try{m(await rut(r)),n({title:r("Location filled in"),description:r("Check it, then save your profile.")})}catch(F){n({title:r("Couldn't use your location"),description:F instanceof PD?F.message:r("Please type your location."),variant:"destructive"})}finally{p(!1)}},R=async()=>{if(!N){E("Name must be between 2 and 50 characters.");return}if(!A){E(r("Please enter your location, or use your current location."));return}if(l.trim()&&g==="invalid"){E("Username must be 3–63 characters: letters, numbers, dots or underscores.");return}if(l.trim()&&g==="taken"){E("That username is already taken.");return}C(!0),E("");try{const F={name:i.trim()};l.trim()&&(F.userId=l.trim()),d.trim()&&(F.title=d.trim()),F.location=h.trim();const D=await nd.updatePensilProfile(F,b);e(D.user),n({title:"Profile updated",description:"Welcome to the community."}),t()}catch(F){const D=F instanceof ze?F.message:dn(F,"Could not update profile.");E(D)}finally{C(!1)}},O=w??a7(i.trim()||"New","User");return a.jsx("div",{className:"fixed inset-0 z-[900] flex items-center justify-center overflow-y-auto bg-card p-4",children:a.jsxs("div",{className:"my-8 w-full max-w-sm rounded-lg border border-border bg-card p-6 shadow-lg",children:[a.jsx("p",{className:"mb-6 text-center text-lg font-semibold text-foreground/90",children:"Hi! Tell us a little bit about yourself."}),a.jsxs("div",{className:"mb-4 flex flex-col items-center gap-3",children:[a.jsxs("button",{type:"button",onClick:()=>{var F;return(F=s.current)==null?void 0:F.click()},className:"relative h-20 w-20 overflow-hidden rounded-full border-2 border-border bg-muted",children:[a.jsx("img",{src:O,alt:"",className:"h-full w-full object-cover"}),a.jsx("span",{className:"absolute inset-0 flex items-center justify-center bg-black/30 opacity-0 transition-opacity hover:opacity-100",children:a.jsx(k2,{className:"h-6 w-6 text-white"})})]}),a.jsx("input",{ref:s,type:"file",accept:"image/*",className:"hidden",onChange:F=>{var D;return _((D=F.target.files)==null?void 0:D[0])}}),a.jsx("button",{type:"button",className:"text-xs text-primary hover:underline",onClick:()=>{var F;return(F=s.current)==null?void 0:F.click()},children:"Upload photo (optional)"})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs(_e,{htmlFor:"profile-name",className:"flex items-center gap-1.5",children:["Your full name",a.jsx("span",{className:"text-destructive","aria-hidden":!0,children:"*"})]}),a.jsx(Oe,{id:"profile-name",placeholder:"First and last name",autoComplete:"name",value:i,onChange:F=>o(F.target.value),maxLength:50,required:!0,"aria-required":"true",autoFocus:!0})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"profile-username",children:"Username (optional)"}),a.jsxs("div",{className:"relative",children:[a.jsx(Oe,{id:"profile-username",placeholder:"username",value:l,onChange:F=>c(F.target.value),maxLength:63}),a.jsxs("span",{className:"absolute right-3 top-1/2 -translate-y-1/2",children:[g==="checking"&&a.jsx(Ne,{className:"h-4 w-4 animate-spin text-muted-foreground"}),g==="available"&&a.jsx(Qn,{className:"h-4 w-4 text-green-600"}),(g==="taken"||g==="invalid")&&a.jsx(nn,{className:"h-4 w-4 text-destructive"})]})]}),g==="taken"&&a.jsx("p",{className:"text-xs text-destructive",children:"This username is already taken."}),g==="invalid"&&a.jsx("p",{className:"text-xs text-destructive",children:"3–63 characters: letters, numbers, dots or underscores."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(_e,{htmlFor:"profile-job-title",className:"flex items-center gap-1.5",children:[r("Job title")," ",r("(optional)")]}),a.jsx(Oe,{id:"profile-job-title",placeholder:r("e.g. Head of Sports Science"),value:d,onChange:F=>u(F.target.value),maxLength:80})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(_e,{htmlFor:"profile-location",className:"flex items-center gap-1.5",children:[r("Location"),a.jsx("span",{className:"text-destructive","aria-hidden":!0,children:"*"})]}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[a.jsx(Oe,{id:"profile-location",placeholder:r("e.g. Stockholm, Sweden"),value:h,onChange:F=>m(F.target.value),maxLength:100,required:!0,"aria-required":"true",className:"min-w-0 flex-1"}),Ije()&&a.jsxs(Z,{type:"button",variant:"outline",onClick:()=>void T(),disabled:f,className:"shrink-0 gap-1.5",children:[f?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsx(Ort,{className:"h-4 w-4"}),r(f?"Finding you…":"Use my location")]})]})]})]}),j?a.jsx("p",{role:"alert",className:"mt-3 text-sm text-destructive",children:j}):null,!j&&(!N||!A)?a.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:r("Fields marked * are required.")}):null,a.jsx(Z,{className:"mt-6 w-full",disabled:!N||!A||S||f||g==="checking",onClick:()=>void R(),children:S?a.jsxs(a.Fragment,{children:[a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}),"Saving…"]}):"Proceed"})]})})}var ate="Dialog",[sut,iut]=il(ate),[Qsn,Gg]=sut(ate),aut=t=>{const{__scopeDialog:e,children:n,open:r,defaultOpen:s,onOpenChange:i,modal:o=!0}=t,l=y.useRef(null),c=y.useRef(null),[d,u]=Sd({prop:r,defaultProp:s??!1,onChange:i,caller:ate});return a.jsx(Qsn,{scope:e,triggerRef:l,contentRef:c,contentId:el(),titleId:el(),descriptionId:el(),open:d,onOpenChange:u,onOpenToggle:y.useCallback(()=>u(h=>!h),[u]),modal:o,children:n})};aut.displayName=ate;var out="DialogTrigger",lut=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Gg(out,n),i=Sr(e,s.triggerRef);return a.jsx(Sn.button,{type:"button","aria-haspopup":"dialog","aria-expanded":s.open,"aria-controls":s.contentId,"data-state":Dje(s.open),...r,ref:i,onClick:Kt(t.onClick,s.onOpenToggle)})});lut.displayName=out;var Mje="DialogPortal",[Zsn,cut]=sut(Mje,{forceMount:void 0}),dut=t=>{const{__scopeDialog:e,forceMount:n,children:r,container:s}=t,i=Gg(Mje,e);return a.jsx(Zsn,{scope:e,forceMount:n,children:y.Children.map(r,o=>a.jsx(Rl,{present:n||i.open,children:a.jsx(CE,{asChild:!0,container:s,children:o})}))})};dut.displayName=Mje;var yY="DialogOverlay",uut=y.forwardRef((t,e)=>{const n=cut(yY,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,i=Gg(yY,t.__scopeDialog);return i.modal?a.jsx(Rl,{present:r||i.open,children:a.jsx(Xsn,{...s,ref:e})}):null});uut.displayName=yY;var Jsn=Ck("DialogOverlay.RemoveScroll"),Xsn=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Gg(yY,n);return a.jsx(r7,{as:Jsn,allowPinchZoom:!0,shards:[s.contentRef],children:a.jsx(Sn.div,{"data-state":Dje(s.open),...r,ref:e,style:{pointerEvents:"auto",...r.style}})})}),$2="DialogContent",hut=y.forwardRef((t,e)=>{const n=cut($2,t.__scopeDialog),{forceMount:r=n.forceMount,...s}=t,i=Gg($2,t.__scopeDialog);return a.jsx(Rl,{present:r||i.open,children:i.modal?a.jsx(ein,{...s,ref:e}):a.jsx(tin,{...s,ref:e})})});hut.displayName=$2;var ein=y.forwardRef((t,e)=>{const n=Gg($2,t.__scopeDialog),r=y.useRef(null),s=Sr(e,n.contentRef,r);return y.useEffect(()=>{const i=r.current;if(i)return tte(i)},[]),a.jsx(mut,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:Kt(t.onCloseAutoFocus,i=>{var o;i.preventDefault(),(o=n.triggerRef.current)==null||o.focus()}),onPointerDownOutside:Kt(t.onPointerDownOutside,i=>{const o=i.detail.originalEvent,l=o.button===0&&o.ctrlKey===!0;(o.button===2||l)&&i.preventDefault()}),onFocusOutside:Kt(t.onFocusOutside,i=>i.preventDefault())})}),tin=y.forwardRef((t,e)=>{const n=Gg($2,t.__scopeDialog),r=y.useRef(!1),s=y.useRef(!1);return a.jsx(mut,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:i=>{var o,l;(o=t.onCloseAutoFocus)==null||o.call(t,i),i.defaultPrevented||(r.current||(l=n.triggerRef.current)==null||l.focus(),i.preventDefault()),r.current=!1,s.current=!1},onInteractOutside:i=>{var c,d;(c=t.onInteractOutside)==null||c.call(t,i),i.defaultPrevented||(r.current=!0,i.detail.originalEvent.type==="pointerdown"&&(s.current=!0));const o=i.target;((d=n.triggerRef.current)==null?void 0:d.contains(o))&&i.preventDefault(),i.detail.originalEvent.type==="focusin"&&s.current&&i.preventDefault()}})}),mut=y.forwardRef((t,e)=>{const{__scopeDialog:n,trapFocus:r,onOpenAutoFocus:s,onCloseAutoFocus:i,...o}=t,l=Gg($2,n),c=y.useRef(null),d=Sr(e,c);return ete(),a.jsxs(a.Fragment,{children:[a.jsx(n7,{asChild:!0,loop:!0,trapped:r,onMountAutoFocus:s,onUnmountAutoFocus:i,children:a.jsx(SE,{role:"dialog",id:l.contentId,"aria-describedby":l.descriptionId,"aria-labelledby":l.titleId,"data-state":Dje(l.open),...o,ref:d,onDismiss:()=>l.onOpenChange(!1)})}),a.jsxs(a.Fragment,{children:[a.jsx(rin,{titleId:l.titleId}),a.jsx(iin,{contentRef:c,descriptionId:l.descriptionId})]})]})}),Lje="DialogTitle",fut=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Gg(Lje,n);return a.jsx(Sn.h2,{id:s.titleId,...r,ref:e})});fut.displayName=Lje;var put="DialogDescription",gut=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Gg(put,n);return a.jsx(Sn.p,{id:s.descriptionId,...r,ref:e})});gut.displayName=put;var vut="DialogClose",yut=y.forwardRef((t,e)=>{const{__scopeDialog:n,...r}=t,s=Gg(vut,n);return a.jsx(Sn.button,{type:"button",...r,ref:e,onClick:Kt(t.onClick,()=>s.onOpenChange(!1))})});yut.displayName=vut;function Dje(t){return t?"open":"closed"}var but="DialogTitleWarning",[nin,xut]=R9t(but,{contentName:$2,titleName:Lje,docsSlug:"dialog"}),rin=({titleId:t})=>{const e=xut(but),n=`\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.

If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.

For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;return y.useEffect(()=>{t&&(document.getElementById(t)||console.error(n))},[n,t]),null},sin="DialogDescriptionWarning",iin=({contentRef:t,descriptionId:e})=>{const r=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${xut(sin).contentName}}.`;return y.useEffect(()=>{var i;const s=(i=t.current)==null?void 0:i.getAttribute("aria-describedby");e&&s&&(document.getElementById(e)||console.warn(r))},[r,t,e]),null},ote=aut,wut=lut,lte=dut,xI=uut,wI=hut,l7=fut,c7=gut,cte=yut;const Bt=ote,ain=lte,kut=y.forwardRef(({className:t,...e},n)=>a.jsx(xI,{ref:n,className:ee("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e}));kut.displayName=xI.displayName;const Ft=y.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(ain,{children:[a.jsx(kut,{}),a.jsxs(wI,{ref:r,className:ee("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...n,children:[e,a.jsxs(cte,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-accent data-[state=open]:text-muted-foreground hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[a.jsx(nn,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Ft.displayName=wI.displayName;const Vt=({className:t,...e})=>a.jsx("div",{className:ee("flex flex-col space-y-1.5 text-center sm:text-left",t),...e});Vt.displayName="DialogHeader";const ir=({className:t,...e})=>a.jsx("div",{className:ee("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});ir.displayName="DialogFooter";const Ut=y.forwardRef(({className:t,...e},n)=>a.jsx(l7,{ref:n,className:ee("text-lg font-semibold leading-none tracking-tight",t),...e}));Ut.displayName=l7.displayName;const _n=y.forwardRef(({className:t,...e},n)=>a.jsx(c7,{ref:n,className:ee("text-sm text-muted-foreground",t),...e}));_n.displayName=c7.displayName;/*! @license DOMPurify 3.4.11 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.11/LICENSE */function GDe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function oin(t){if(Array.isArray(t))return t}function lin(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(u){d=!0,s=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function cin(){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 din(t,e){return oin(t)||lin(t,e)||uin(t,e)||cin()}function uin(t,e){if(t){if(typeof t=="string")return GDe(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?GDe(t,e):void 0}}const Sut=Object.entries,WDe=Object.setPrototypeOf,hin=Object.isFrozen,min=Object.getPrototypeOf,fin=Object.getOwnPropertyDescriptor;let gd=Object.freeze,Cd=Object.seal,JT=Object.create,Cut=typeof Reflect<"u"&&Reflect,yge=Cut.apply,bge=Cut.construct;gd||(gd=function(e){return e});Cd||(Cd=function(e){return e});yge||(yge=function(e,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),i=2;i<r;i++)s[i-2]=arguments[i];return e.apply(n,s)});bge||(bge=function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return new e(...r)});const TL=ec(Array.prototype.forEach),pin=ec(Array.prototype.lastIndexOf),qDe=ec(Array.prototype.pop),YN=ec(Array.prototype.push),gin=ec(Array.prototype.splice),s1=Array.isArray,g4=ec(String.prototype.toLowerCase),rle=ec(String.prototype.toString),KDe=ec(String.prototype.match),_L=ec(String.prototype.replace),YDe=ec(String.prototype.indexOf),vin=ec(String.prototype.trim),yin=ec(Number.prototype.toString),bin=ec(Boolean.prototype.toString),QDe=typeof BigInt>"u"?null:ec(BigInt.prototype.toString),ZDe=typeof Symbol>"u"?null:ec(Symbol.prototype.toString),_c=ec(Object.prototype.hasOwnProperty),AL=ec(Object.prototype.toString),Jc=ec(RegExp.prototype.test),qS=xin(TypeError);function ec(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return yge(t,e,r)}}function xin(t){return function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];return bge(t,n)}}function ai(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:g4;if(WDe&&WDe(t,null),!s1(e))return t;let r=e.length;for(;r--;){let s=e[r];if(typeof s=="string"){const i=n(s);i!==s&&(hin(e)||(e[r]=i),s=i)}t[s]=!0}return t}function win(t){for(let e=0;e<t.length;e++)_c(t,e)||(t[e]=null);return t}function cu(t){const e=JT(null);for(const r of Sut(t)){var n=din(r,2);const s=n[0],i=n[1];_c(t,s)&&(s1(i)?e[s]=win(i):i&&typeof i=="object"&&i.constructor===Object?e[s]=cu(i):e[s]=i)}return e}function kin(t){switch(typeof t){case"string":return t;case"number":return yin(t);case"boolean":return bin(t);case"bigint":return QDe?QDe(t):"0";case"symbol":return ZDe?ZDe(t):"Symbol()";case"undefined":return AL(t);case"function":case"object":{if(t===null)return AL(t);const e=t,n=wv(e,"toString");if(typeof n=="function"){const r=n(e);return typeof r=="string"?r:AL(r)}return AL(t)}default:return AL(t)}}function wv(t,e){for(;t!==null;){const r=fin(t,e);if(r){if(r.get)return ec(r.get);if(typeof r.value=="function")return ec(r.value)}t=min(t)}function n(){return null}return n}function Sin(t){try{return Jc(t,""),!0}catch{return!1}}const JDe=gd(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),sle=gd(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ile=gd(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Cin=gd(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),ale=gd(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),jin=gd(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),XDe=gd(["#text"]),e$e=gd(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),ole=gd(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),t$e=gd(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),tz=gd(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),Ein=Cd(/{{[\w\W]*|^[\w\W]*}}/g),Nin=Cd(/<%[\w\W]*|^[\w\W]*%>/g),Tin=Cd(/\${[\w\W]*/g),_in=Cd(/^data-[\-\w.\u00B7-\uFFFF]+$/),Ain=Cd(/^aria-[\-\w]+$/),n$e=Cd(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),Pin=Cd(/^(?:\w+script|data):/i),Rin=Cd(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Iin=Cd(/^html$/i),Min=Cd(/^[a-z][.\w]*(-[.\w]+)+$/i),r$e=Cd(/<[/\w!]/g),Lin=Cd(/<[/\w]/g),Din=Cd(/<\/no(script|embed|frames)/i),$in=Cd(/\/>/i),cv={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Oin=function(){return typeof window>"u"?null:window},Fin=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let r=null;const s="data-tt-policy-suffix";n&&n.hasAttribute(s)&&(r=n.getAttribute(s));const i="dompurify"+(r?"#"+r:"");try{return e.createPolicy(i,{createHTML(o){return o},createScriptURL(o){return o}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},s$e=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},tw=function(e,n,r,s){return _c(e,n)&&s1(e[n])?ai(s.base?cu(s.base):{},e[n],s.transform):r};function jut(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Oin();const e=bn=>jut(bn);if(e.version="3.4.11",e.removed=[],!t||!t.document||t.document.nodeType!==cv.document||!t.Element)return e.isSupported=!1,e;let n=t.document;const r=n,s=r.currentScript;t.DocumentFragment;const i=t.HTMLTemplateElement,o=t.Node,l=t.Element,c=t.NodeFilter,d=t.NamedNodeMap;d===void 0&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const u=t.DOMParser,h=t.trustedTypes,m=l.prototype,f=wv(m,"cloneNode"),p=wv(m,"remove"),g=wv(m,"nextSibling"),v=wv(m,"childNodes"),b=wv(m,"parentNode"),x=wv(m,"shadowRoot"),w=wv(m,"attributes"),k=o&&o.prototype?wv(o.prototype,"nodeType"):null,S=o&&o.prototype?wv(o.prototype,"nodeName"):null;if(typeof i=="function"){const bn=n.createElement("template");bn.content&&bn.content.ownerDocument&&(n=bn.content.ownerDocument)}let C,j="",E,N=!1,A=0;const _=function(){if(A>0)throw qS('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},T=function(Re){_(),A++;try{return C.createHTML(Re)}finally{A--}},R=function(Re){_(),A++;try{return C.createScriptURL(Re)}finally{A--}},O=function(){return N||(E=Fin(h,s),N=!0),E},F=n,D=F.implementation,I=F.createNodeIterator,P=F.createDocumentFragment,M=F.getElementsByTagName,z=r.importNode;let G=s$e();e.isSupported=typeof Sut=="function"&&typeof b=="function"&&D&&D.createHTMLDocument!==void 0;const B=Ein,H=Nin,W=Tin,V=_in,U=Ain,ne=Pin,te=Rin,re=Min;let fe=n$e,le=null;const q=ai({},[...JDe,...sle,...ile,...ale,...XDe]);let Y=null;const X=ai({},[...e$e,...ole,...t$e,...tz]);let Q=Object.seal(JT(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ie=null,he=null;const ye=Object.seal(JT(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let J=!0,K=!0,ce=!1,pe=!0,Ie=!1,Me=!0,we=!1,Be=!1,Ve=null,be=null,Ze=!1,Pe=!1,Ke=!1,De=!1,xt=!0,Xe=!1;const tt="user-content-";let $e=!0,wt=!1,Ee={},Ge=null;const Pt=ai({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let vn=null;const Hn=ai({},["audio","video","img","source","image","track"]);let yr=null;const br=ai({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Yt="http://www.w3.org/1998/Math/MathML",nr="http://www.w3.org/2000/svg",Kn="http://www.w3.org/1999/xhtml";let ms=Kn,is=!1,ke=null;const at=ai({},[Yt,nr,Kn],rle),Tt=gd(["mi","mo","mn","ms","mtext"]);let An=ai({},Tt);const Pn=gd(["annotation-xml"]);let yn=ai({},Pn);const Is=ai({},["title","style","font","a","script"]);let js=null;const Gt=["application/xhtml+xml","text/html"],lr="text/html";let ct=null,Bn=null;const Ms=n.createElement("form"),Ue=function(Re){return Re instanceof RegExp||Re instanceof Function},et=function(){let Re=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(Bn&&Bn===Re)return;(!Re||typeof Re!="object")&&(Re={}),Re=cu(Re),js=Gt.indexOf(Re.PARSER_MEDIA_TYPE)===-1?lr:Re.PARSER_MEDIA_TYPE,ct=js==="application/xhtml+xml"?rle:g4,le=tw(Re,"ALLOWED_TAGS",q,{transform:ct}),Y=tw(Re,"ALLOWED_ATTR",X,{transform:ct}),ke=tw(Re,"ALLOWED_NAMESPACES",at,{transform:rle}),yr=tw(Re,"ADD_URI_SAFE_ATTR",br,{transform:ct,base:br}),vn=tw(Re,"ADD_DATA_URI_TAGS",Hn,{transform:ct,base:Hn}),Ge=tw(Re,"FORBID_CONTENTS",Pt,{transform:ct}),ie=tw(Re,"FORBID_TAGS",cu({}),{transform:ct}),he=tw(Re,"FORBID_ATTR",cu({}),{transform:ct}),Ee=_c(Re,"USE_PROFILES")?Re.USE_PROFILES&&typeof Re.USE_PROFILES=="object"?cu(Re.USE_PROFILES):Re.USE_PROFILES:!1,J=Re.ALLOW_ARIA_ATTR!==!1,K=Re.ALLOW_DATA_ATTR!==!1,ce=Re.ALLOW_UNKNOWN_PROTOCOLS||!1,pe=Re.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ie=Re.SAFE_FOR_TEMPLATES||!1,Me=Re.SAFE_FOR_XML!==!1,we=Re.WHOLE_DOCUMENT||!1,Pe=Re.RETURN_DOM||!1,Ke=Re.RETURN_DOM_FRAGMENT||!1,De=Re.RETURN_TRUSTED_TYPE||!1,Ze=Re.FORCE_BODY||!1,xt=Re.SANITIZE_DOM!==!1,Xe=Re.SANITIZE_NAMED_PROPS||!1,$e=Re.KEEP_CONTENT!==!1,wt=Re.IN_PLACE||!1,fe=Sin(Re.ALLOWED_URI_REGEXP)?Re.ALLOWED_URI_REGEXP:n$e,ms=typeof Re.NAMESPACE=="string"?Re.NAMESPACE:Kn,An=_c(Re,"MATHML_TEXT_INTEGRATION_POINTS")&&Re.MATHML_TEXT_INTEGRATION_POINTS&&typeof Re.MATHML_TEXT_INTEGRATION_POINTS=="object"?cu(Re.MATHML_TEXT_INTEGRATION_POINTS):ai({},Tt),yn=_c(Re,"HTML_INTEGRATION_POINTS")&&Re.HTML_INTEGRATION_POINTS&&typeof Re.HTML_INTEGRATION_POINTS=="object"?cu(Re.HTML_INTEGRATION_POINTS):ai({},Pn);const gt=_c(Re,"CUSTOM_ELEMENT_HANDLING")&&Re.CUSTOM_ELEMENT_HANDLING&&typeof Re.CUSTOM_ELEMENT_HANDLING=="object"?cu(Re.CUSTOM_ELEMENT_HANDLING):JT(null);if(Q=JT(null),_c(gt,"tagNameCheck")&&Ue(gt.tagNameCheck)&&(Q.tagNameCheck=gt.tagNameCheck),_c(gt,"attributeNameCheck")&&Ue(gt.attributeNameCheck)&&(Q.attributeNameCheck=gt.attributeNameCheck),_c(gt,"allowCustomizedBuiltInElements")&&typeof gt.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=gt.allowCustomizedBuiltInElements),Cd(Q),Ie&&(K=!1),Ke&&(Pe=!0),Ee&&(le=ai({},XDe),Y=JT(null),Ee.html===!0&&(ai(le,JDe),ai(Y,e$e)),Ee.svg===!0&&(ai(le,sle),ai(Y,ole),ai(Y,tz)),Ee.svgFilters===!0&&(ai(le,ile),ai(Y,ole),ai(Y,tz)),Ee.mathMl===!0&&(ai(le,ale),ai(Y,t$e),ai(Y,tz))),ye.tagCheck=null,ye.attributeCheck=null,_c(Re,"ADD_TAGS")&&(typeof Re.ADD_TAGS=="function"?ye.tagCheck=Re.ADD_TAGS:s1(Re.ADD_TAGS)&&(le===q&&(le=cu(le)),ai(le,Re.ADD_TAGS,ct))),_c(Re,"ADD_ATTR")&&(typeof Re.ADD_ATTR=="function"?ye.attributeCheck=Re.ADD_ATTR:s1(Re.ADD_ATTR)&&(Y===X&&(Y=cu(Y)),ai(Y,Re.ADD_ATTR,ct))),_c(Re,"ADD_URI_SAFE_ATTR")&&s1(Re.ADD_URI_SAFE_ATTR)&&ai(yr,Re.ADD_URI_SAFE_ATTR,ct),_c(Re,"FORBID_CONTENTS")&&s1(Re.FORBID_CONTENTS)&&(Ge===Pt&&(Ge=cu(Ge)),ai(Ge,Re.FORBID_CONTENTS,ct)),_c(Re,"ADD_FORBID_CONTENTS")&&s1(Re.ADD_FORBID_CONTENTS)&&(Ge===Pt&&(Ge=cu(Ge)),ai(Ge,Re.ADD_FORBID_CONTENTS,ct)),$e&&(le["#text"]=!0),we&&ai(le,["html","head","body"]),le.table&&(ai(le,["tbody"]),delete ie.tbody),Re.TRUSTED_TYPES_POLICY){if(typeof Re.TRUSTED_TYPES_POLICY.createHTML!="function")throw qS('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof Re.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw qS('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const kn=C;C=Re.TRUSTED_TYPES_POLICY;try{j=T("")}catch(sn){throw C=kn,sn}}else Re.TRUSTED_TYPES_POLICY===null?(C=void 0,j=""):(C===void 0&&(C=O()),C&&typeof j=="string"&&(j=T("")));gd&&gd(Re),Bn=Re},Le=ai({},[...sle,...ile,...Cin]),Ye=ai({},[...ale,...jin]),st=function(Re,gt,kn){return gt.namespaceURI===Kn?Re==="svg":gt.namespaceURI===Yt?Re==="svg"&&(kn==="annotation-xml"||An[kn]):!!Le[Re]},nt=function(Re,gt,kn){return gt.namespaceURI===Kn?Re==="math":gt.namespaceURI===nr?Re==="math"&&yn[kn]:!!Ye[Re]},Je=function(Re,gt,kn){return gt.namespaceURI===nr&&!yn[kn]||gt.namespaceURI===Yt&&!An[kn]?!1:!Ye[Re]&&(Is[Re]||!Le[Re])},Rt=function(Re){let gt=b(Re);(!gt||!gt.tagName)&&(gt={namespaceURI:ms,tagName:"template"});const kn=g4(Re.tagName),sn=g4(gt.tagName);return ke[Re.namespaceURI]?Re.namespaceURI===nr?st(kn,gt,sn):Re.namespaceURI===Yt?nt(kn,gt,sn):Re.namespaceURI===Kn?Je(kn,gt,sn):!!(js==="application/xhtml+xml"&&ke[Re.namespaceURI]):!1},Qt=function(Re){YN(e.removed,{element:Re});try{b(Re).removeChild(Re)}catch{if(p(Re),!b(Re))throw qS("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},Jt=function(Re){const gt=v(Re);if(gt){const sn=[];TL(gt,Jr=>{YN(sn,Jr)}),TL(sn,Jr=>{try{p(Jr)}catch{}})}const kn=w(Re);if(kn)for(let sn=kn.length-1;sn>=0;--sn){const Jr=kn[sn],Ks=Jr&&Jr.name;if(typeof Ks=="string")try{Re.removeAttribute(Ks)}catch{}}},Qe=function(Re,gt){try{YN(e.removed,{attribute:gt.getAttributeNode(Re),from:gt})}catch{YN(e.removed,{attribute:null,from:gt})}if(gt.removeAttribute(Re),Re==="is")if(Pe||Ke)try{Qt(gt)}catch{}else try{gt.setAttribute(Re,"")}catch{}},Lt=function(Re){const gt=w(Re);if(gt)for(let kn=gt.length-1;kn>=0;--kn){const sn=gt[kn],Jr=sn&&sn.name;if(!(typeof Jr!="string"||Y[ct(Jr)]))try{Re.removeAttribute(Jr)}catch{}}},Xt=function(Re){const gt=[Re];for(;gt.length>0;){const kn=gt.pop();(k?k(kn):kn.nodeType)===cv.element&&Lt(kn);const Jr=v(kn);if(Jr)for(let Ks=Jr.length-1;Ks>=0;--Ks)gt.push(Jr[Ks])}},xr=function(Re){let gt=null,kn=null;if(Ze)Re="<remove></remove>"+Re;else{const Ks=KDe(Re,/^[\r\n\t ]+/);kn=Ks&&Ks[0]}js==="application/xhtml+xml"&&ms===Kn&&(Re='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+Re+"</body></html>");const sn=C?T(Re):Re;if(ms===Kn)try{gt=new u().parseFromString(sn,js)}catch{}if(!gt||!gt.documentElement){gt=D.createDocument(ms,"template",null);try{gt.documentElement.innerHTML=is?j:sn}catch{}}const Jr=gt.body||gt.documentElement;return Re&&kn&&Jr.insertBefore(n.createTextNode(kn),Jr.childNodes[0]||null),ms===Kn?M.call(gt,we?"html":"body")[0]:we?gt.documentElement:Jr},Ls=function(Re){return I.call(Re.ownerDocument||Re,Re,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},xi=function(Re){return Re=_L(Re,B," "),Re=_L(Re,H," "),Re=_L(Re,W," "),Re},oa=function(Re){var gt;Re.normalize();const kn=I.call(Re.ownerDocument||Re,Re,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null);let sn=kn.nextNode();for(;sn;)sn.data=xi(sn.data),sn=kn.nextNode();const Jr=(gt=Re.querySelectorAll)===null||gt===void 0?void 0:gt.call(Re,"template");Jr&&TL(Jr,Ks=>{$i(Ks.content)&&oa(Ks.content)})},la=function(Re){const gt=S?S(Re):null;return typeof gt!="string"||ct(gt)!=="form"?!1:typeof Re.nodeName!="string"||typeof Re.textContent!="string"||typeof Re.removeChild!="function"||Re.attributes!==w(Re)||typeof Re.removeAttribute!="function"||typeof Re.setAttribute!="function"||typeof Re.namespaceURI!="string"||typeof Re.insertBefore!="function"||typeof Re.hasChildNodes!="function"||Re.nodeType!==k(Re)||Re.childNodes!==v(Re)},$i=function(Re){if(!k||typeof Re!="object"||Re===null)return!1;try{return k(Re)===cv.documentFragment}catch{return!1}},al=function(Re){if(!k||typeof Re!="object"||Re===null)return!1;try{return typeof k(Re)=="number"}catch{return!1}};function $l(bn,Re,gt){bn.length!==0&&TL(bn,kn=>{kn.call(e,Re,gt,Bn)})}const ou=function(Re,gt){return!!(Me&&Re.hasChildNodes()&&!al(Re.firstElementChild)&&Jc(r$e,Re.textContent)&&Jc(r$e,Re.innerHTML)||Me&&Re.namespaceURI===Kn&&gt==="style"&&al(Re.firstElementChild)||Re.nodeType===cv.processingInstruction||Me&&Re.nodeType===cv.comment&&Jc(Lin,Re.data))},Ih=function(Re,gt){if(!ie[gt]&&K0(gt)&&(Q.tagNameCheck instanceof RegExp&&Jc(Q.tagNameCheck,gt)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(gt)))return!1;if($e&&!Ge[gt]){const kn=b(Re),sn=v(Re);if(sn&&kn){const Jr=sn.length;for(let Ks=Jr-1;Ks>=0;--Ks){const rc=wt?sn[Ks]:f(sn[Ks],!0);kn.insertBefore(rc,g(Re))}}}return Qt(Re),!0},av=function(Re){if($l(G.beforeSanitizeElements,Re,null),la(Re))return Qt(Re),!0;const gt=ct(S?S(Re):Re.nodeName);if($l(G.uponSanitizeElement,Re,{tagName:gt,allowedTags:le}),ou(Re,gt))return Qt(Re),!0;if(ie[gt]||!(ye.tagCheck instanceof Function&&ye.tagCheck(gt))&&!le[gt])return Ih(Re,gt);if((k?k(Re):Re.nodeType)===cv.element&&!Rt(Re)||(gt==="noscript"||gt==="noembed"||gt==="noframes")&&Jc(Din,Re.innerHTML))return Qt(Re),!0;if(Ie&&Re.nodeType===cv.text){const sn=xi(Re.textContent);Re.textContent!==sn&&(YN(e.removed,{element:Re.cloneNode()}),Re.textContent=sn)}return $l(G.afterSanitizeElements,Re,null),!1},ov=function(Re,gt,kn){if(he[gt]||xt&&(gt==="id"||gt==="name")&&(kn in n||kn in Ms))return!1;const sn=Y[gt]||ye.attributeCheck instanceof Function&&ye.attributeCheck(gt,Re);if(!(K&&Jc(V,gt))){if(!(J&&Jc(U,gt))){if(sn){if(!yr[gt]){if(!Jc(fe,_L(kn,te,""))){if(!((gt==="src"||gt==="xlink:href"||gt==="href")&&Re!=="script"&&YDe(kn,"data:")===0&&vn[Re])){if(!(ce&&!Jc(ne,_L(kn,te,"")))){if(kn)return!1}}}}}else if(!(K0(Re)&&(Q.tagNameCheck instanceof RegExp&&Jc(Q.tagNameCheck,Re)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(Re))&&(Q.attributeNameCheck instanceof RegExp&&Jc(Q.attributeNameCheck,gt)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(gt,Re))||gt==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&Jc(Q.tagNameCheck,kn)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(kn))))return!1}}return!0},Uu=ai({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),K0=function(Re){return!Uu[g4(Re)]&&Jc(re,Re)},lb=function(Re,gt,kn,sn){if(C&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!kn)switch(h.getAttributeType(Re,gt)){case"TrustedHTML":return T(sn);case"TrustedScriptURL":return R(sn)}return sn},Y0=function(Re,gt,kn,sn){try{kn?Re.setAttributeNS(kn,gt,sn):Re.setAttribute(gt,sn),la(Re)?Qt(Re):qDe(e.removed)}catch{Qe(gt,Re)}},cb=function(Re){$l(G.beforeSanitizeAttributes,Re,null);const gt=Re.attributes;if(!gt||la(Re))return;const kn={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y,forceKeepAttr:void 0};let sn=gt.length;const Jr=ct(Re.nodeName);for(;sn--;){const Ks=gt[sn],rc=Ks.name,ca=Ks.namespaceURI,Lh=Ks.value,Gc=ct(rc),Q0=Lh;let Cc=rc==="value"?Q0:vin(Q0);if(kn.attrName=Gc,kn.attrValue=Cc,kn.keepAttr=!0,kn.forceKeepAttr=void 0,$l(G.uponSanitizeAttribute,Re,kn),Cc=kn.attrValue,Xe&&(Gc==="id"||Gc==="name")&&YDe(Cc,tt)!==0&&(Qe(rc,Re),Cc=tt+Cc),Me&&Jc(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,Cc)){Qe(rc,Re);continue}if(Gc==="attributename"&&KDe(Cc,"href")){Qe(rc,Re);continue}if(!kn.forceKeepAttr){if(!kn.keepAttr){Qe(rc,Re);continue}if(!pe&&Jc($in,Cc)){Qe(rc,Re);continue}if(Ie&&(Cc=xi(Cc)),!ov(Jr,Gc,Cc)){Qe(rc,Re);continue}Cc=lb(Jr,Gc,ca,Cc),Cc!==Q0&&Y0(Re,rc,ca,Cc)}}$l(G.afterSanitizeAttributes,Re,null)},Mh=function(Re){let gt=null;const kn=Ls(Re);for($l(G.beforeSanitizeShadowDOM,Re,null);gt=kn.nextNode();)if($l(G.uponSanitizeShadowNode,gt,null),av(gt),cb(gt),$i(gt.content)&&Mh(gt.content),(k?k(gt):gt.nodeType)===cv.element){const Jr=x(gt);$i(Jr)&&(db(Jr),Mh(Jr))}$l(G.afterSanitizeShadowDOM,Re,null)},db=function(Re){const gt=[{node:Re,shadow:null}];for(;gt.length>0;){const kn=gt.pop();if(kn.shadow){Mh(kn.shadow);continue}const sn=kn.node,Ks=(k?k(sn):sn.nodeType)===cv.element,rc=v(sn);if(rc)for(let ca=rc.length-1;ca>=0;--ca)gt.push({node:rc[ca],shadow:null});if(Ks){const ca=S?S(sn):null;if(typeof ca=="string"&&ct(ca)==="template"){const Lh=sn.content;$i(Lh)&&gt.push({node:Lh,shadow:null})}}if(Ks){const ca=x(sn);$i(ca)&&gt.push({node:null,shadow:ca},{node:ca,shadow:null})}}};return e.sanitize=function(bn){let Re=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},gt=null,kn=null,sn=null,Jr=null;if(is=!bn,is&&(bn="<!-->"),typeof bn!="string"&&!al(bn)&&(bn=kin(bn),typeof bn!="string"))throw qS("dirty is not a string, aborting");if(!e.isSupported)return bn;Be?(le=Ve,Y=be):et(Re),(G.uponSanitizeElement.length>0||G.uponSanitizeAttribute.length>0)&&(le=cu(le)),G.uponSanitizeAttribute.length>0&&(Y=cu(Y)),e.removed=[];const Ks=wt&&typeof bn!="string"&&al(bn);if(Ks){const Lh=S?S(bn):bn.nodeName;if(typeof Lh=="string"){const Gc=ct(Lh);if(!le[Gc]||ie[Gc])throw qS("root node is forbidden and cannot be sanitized in-place")}if(la(bn))throw qS("root node is clobbered and cannot be sanitized in-place");try{db(bn)}catch(Gc){throw Jt(bn),Gc}}else if(al(bn))gt=xr("<!---->"),kn=gt.ownerDocument.importNode(bn,!0),kn.nodeType===cv.element&&kn.nodeName==="BODY"||kn.nodeName==="HTML"?gt=kn:gt.appendChild(kn),db(kn);else{if(!Pe&&!Ie&&!we&&bn.indexOf("<")===-1)return C&&De?T(bn):bn;if(gt=xr(bn),!gt)return Pe?null:De?j:""}gt&&Ze&&Qt(gt.firstChild);const rc=Ls(Ks?bn:gt);try{for(;sn=rc.nextNode();)av(sn),cb(sn),$i(sn.content)&&Mh(sn.content)}catch(Lh){throw Ks&&Jt(bn),Lh}if(Ks)return TL(e.removed,Lh=>{Lh.element&&Xt(Lh.element)}),Ie&&oa(bn),bn;if(Pe){if(Ie&&oa(gt),Ke)for(Jr=P.call(gt.ownerDocument);gt.firstChild;)Jr.appendChild(gt.firstChild);else Jr=gt;return(Y.shadowroot||Y.shadowrootmode)&&(Jr=z.call(r,Jr,!0)),Jr}let ca=we?gt.outerHTML:gt.innerHTML;return we&&le["!doctype"]&&gt.ownerDocument&&gt.ownerDocument.doctype&&gt.ownerDocument.doctype.name&&Jc(Iin,gt.ownerDocument.doctype.name)&&(ca="<!DOCTYPE "+gt.ownerDocument.doctype.name+`>
`+ca),Ie&&(ca=xi(ca)),C&&De?T(ca):ca},e.setConfig=function(){let bn=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};et(bn),Be=!0,Ve=le,be=Y},e.clearConfig=function(){Bn=null,Be=!1,Ve=null,be=null,C=E,j=""},e.isValidAttribute=function(bn,Re,gt){Bn||et({});const kn=ct(bn),sn=ct(Re);return ov(kn,sn,gt)},e.addHook=function(bn,Re){typeof Re=="function"&&_c(G,bn)&&YN(G[bn],Re)},e.removeHook=function(bn,Re){if(_c(G,bn)){if(Re!==void 0){const gt=pin(G[bn],Re);return gt===-1?void 0:gin(G[bn],gt,1)[0]}return qDe(G[bn])}},e.removeHooks=function(bn){_c(G,bn)&&(G[bn]=[])},e.removeAllHooks=function(){G=s$e()},e}var $je=jut();function Oje(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var IE=Oje();function Eut(t){IE=t}var RD={exec:()=>null};function Li(t,e=""){let n=typeof t=="string"?t:t.source;const r={replace:(s,i)=>{let o=typeof i=="string"?i:i.source;return o=o.replace(ju.caret,"$1"),n=n.replace(s,o),r},getRegex:()=>new RegExp(n,e)};return r}var ju={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceTabs:/^\t+/,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] /,listReplaceTask:/^\[[ xX]\] +/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,unescapeTest:/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:t=>new RegExp(`^( {0,3}${t})((?:[	 ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ 	][^\\n]*)?(?:\\n|$))`),hrRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}#`),htmlBeginRegex:t=>new RegExp(`^ {0,${Math.min(3,t-1)}}<(?:[a-z].*>|!--)`,"i")},Bin=/^(?:[ \t]*(?:\n|$))+/,Uin=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,zin=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,d7=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,Vin=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,Fje=/(?:[*+-]|\d{1,9}[.)])/,Nut=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Tut=Li(Nut).replace(/bull/g,Fje).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),Hin=Li(Nut).replace(/bull/g,Fje).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),Bje=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,Gin=/^[^\n]+/,Uje=/(?!\s*\])(?:\\.|[^\[\]\\])+/,Win=Li(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Uje).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),qin=Li(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,Fje).getRegex(),dte="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",zje=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,Kin=Li("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ 	]*)+\\n|$))","i").replace("comment",zje).replace("tag",dte).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),_ut=Li(Bje).replace("hr",d7).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",dte).getRegex(),Yin=Li(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",_ut).getRegex(),Vje={blockquote:Yin,code:Uin,def:Win,fences:zin,heading:Vin,hr:d7,html:Kin,lheading:Tut,list:qin,newline:Bin,paragraph:_ut,table:RD,text:Gin},i$e=Li("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",d7).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3}	)[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",dte).getRegex(),Qin={...Vje,lheading:Hin,table:i$e,paragraph:Li(Bje).replace("hr",d7).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",i$e).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",dte).getRegex()},Zin={...Vje,html:Li(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",zje).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:RD,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Li(Bje).replace("hr",d7).replace("heading",` *#{1,6} *[^
]`).replace("lheading",Tut).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},Jin=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Xin=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,Aut=/^( {2,}|\\)\n(?!\s*$)/,ean=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ute=/[\p{P}\p{S}]/u,Hje=/[\s\p{P}\p{S}]/u,Put=/[^\s\p{P}\p{S}]/u,tan=Li(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Hje).getRegex(),Rut=/(?!~)[\p{P}\p{S}]/u,nan=/(?!~)[\s\p{P}\p{S}]/u,ran=/(?:[^\s\p{P}\p{S}]|~)/u,san=/\[[^[\]]*?\]\((?:\\.|[^\\\(\)]|\((?:\\.|[^\\\(\)])*\))*\)|`[^`]*?`|<[^<>]*?>/g,Iut=/^(?:\*+(?:((?!\*)punct)|[^\s*]))|^_+(?:((?!_)punct)|([^\s_]))/,ian=Li(Iut,"u").replace(/punct/g,ute).getRegex(),aan=Li(Iut,"u").replace(/punct/g,Rut).getRegex(),Mut="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",oan=Li(Mut,"gu").replace(/notPunctSpace/g,Put).replace(/punctSpace/g,Hje).replace(/punct/g,ute).getRegex(),lan=Li(Mut,"gu").replace(/notPunctSpace/g,ran).replace(/punctSpace/g,nan).replace(/punct/g,Rut).getRegex(),can=Li("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Put).replace(/punctSpace/g,Hje).replace(/punct/g,ute).getRegex(),dan=Li(/\\(punct)/,"gu").replace(/punct/g,ute).getRegex(),uan=Li(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),han=Li(zje).replace("(?:-->|$)","-->").getRegex(),man=Li("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",han).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),bY=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,fan=Li(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]*(?:\n[ \t]*)?)(title))?\s*\)/).replace("label",bY).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Lut=Li(/^!?\[(label)\]\[(ref)\]/).replace("label",bY).replace("ref",Uje).getRegex(),Dut=Li(/^!?\[(ref)\](?:\[\])?/).replace("ref",Uje).getRegex(),pan=Li("reflink|nolink(?!\\()","g").replace("reflink",Lut).replace("nolink",Dut).getRegex(),Gje={_backpedal:RD,anyPunctuation:dan,autolink:uan,blockSkip:san,br:Aut,code:Xin,del:RD,emStrongLDelim:ian,emStrongRDelimAst:oan,emStrongRDelimUnd:can,escape:Jin,link:fan,nolink:Dut,punctuation:tan,reflink:Lut,reflinkSearch:pan,tag:man,text:ean,url:RD},gan={...Gje,link:Li(/^!?\[(label)\]\((.*?)\)/).replace("label",bY).getRegex(),reflink:Li(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",bY).getRegex()},xge={...Gje,emStrongRDelimAst:lan,emStrongLDelim:aan,url:Li(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,"i").replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\.|[^\\])*?(?:\\.|[^\s~\\]))\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},van={...xge,br:Li(Aut).replace("{2,}","*").getRegex(),text:Li(xge.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},nz={normal:Vje,gfm:Qin,pedantic:Zin},PL={normal:Gje,gfm:xge,breaks:van,pedantic:gan},yan={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},a$e=t=>yan[t];function kv(t,e){if(e){if(ju.escapeTest.test(t))return t.replace(ju.escapeReplace,a$e)}else if(ju.escapeTestNoEncode.test(t))return t.replace(ju.escapeReplaceNoEncode,a$e);return t}function o$e(t){try{t=encodeURI(t).replace(ju.percentDecode,"%")}catch{return null}return t}function l$e(t,e){var i;const n=t.replace(ju.findPipe,(o,l,c)=>{let d=!1,u=l;for(;--u>=0&&c[u]==="\\";)d=!d;return d?"|":" |"}),r=n.split(ju.splitPipe);let s=0;if(r[0].trim()||r.shift(),r.length>0&&!((i=r.at(-1))!=null&&i.trim())&&r.pop(),e)if(r.length>e)r.splice(e);else for(;r.length<e;)r.push("");for(;s<r.length;s++)r[s]=r[s].trim().replace(ju.slashPipe,"|");return r}function RL(t,e,n){const r=t.length;if(r===0)return"";let s=0;for(;s<r;){const i=t.charAt(r-s-1);if(i===e&&!n)s++;else if(i!==e&&n)s++;else break}return t.slice(0,r-s)}function ban(t,e){if(t.indexOf(e[1])===-1)return-1;let n=0;for(let r=0;r<t.length;r++)if(t[r]==="\\")r++;else if(t[r]===e[0])n++;else if(t[r]===e[1]&&(n--,n<0))return r;return n>0?-2:-1}function c$e(t,e,n,r,s){const i=e.href,o=e.title||null,l=t[1].replace(s.other.outputLinkReplace,"$1");r.state.inLink=!0;const c={type:t[0].charAt(0)==="!"?"image":"link",raw:n,href:i,title:o,text:l,tokens:r.inlineTokens(l)};return r.state.inLink=!1,c}function xan(t,e,n){const r=t.match(n.other.indentCodeCompensation);if(r===null)return e;const s=r[1];return e.split(`
`).map(i=>{const o=i.match(n.other.beginningSpace);if(o===null)return i;const[l]=o;return l.length>=s.length?i.slice(s.length):i}).join(`
`)}var xY=class{constructor(t){tn(this,"options");tn(this,"rules");tn(this,"lexer");this.options=t||IE}space(t){const e=this.rules.block.newline.exec(t);if(e&&e[0].length>0)return{type:"space",raw:e[0]}}code(t){const e=this.rules.block.code.exec(t);if(e){const n=e[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:e[0],codeBlockStyle:"indented",text:this.options.pedantic?n:RL(n,`
`)}}}fences(t){const e=this.rules.block.fences.exec(t);if(e){const n=e[0],r=xan(n,e[3]||"",this.rules);return{type:"code",raw:n,lang:e[2]?e[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):e[2],text:r}}}heading(t){const e=this.rules.block.heading.exec(t);if(e){let n=e[2].trim();if(this.rules.other.endingHash.test(n)){const r=RL(n,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(n=r.trim())}return{type:"heading",raw:e[0],depth:e[1].length,text:n,tokens:this.lexer.inline(n)}}}hr(t){const e=this.rules.block.hr.exec(t);if(e)return{type:"hr",raw:RL(e[0],`
`)}}blockquote(t){const e=this.rules.block.blockquote.exec(t);if(e){let n=RL(e[0],`
`).split(`
`),r="",s="";const i=[];for(;n.length>0;){let o=!1;const l=[];let c;for(c=0;c<n.length;c++)if(this.rules.other.blockquoteStart.test(n[c]))l.push(n[c]),o=!0;else if(!o)l.push(n[c]);else break;n=n.slice(c);const d=l.join(`
`),u=d.replace(this.rules.other.blockquoteSetextReplace,`
    $1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
${d}`:d,s=s?`${s}
${u}`:u;const h=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(u,i,!0),this.lexer.state.top=h,n.length===0)break;const m=i.at(-1);if((m==null?void 0:m.type)==="code")break;if((m==null?void 0:m.type)==="blockquote"){const f=m,p=f.raw+`
`+n.join(`
`),g=this.blockquote(p);i[i.length-1]=g,r=r.substring(0,r.length-f.raw.length)+g.raw,s=s.substring(0,s.length-f.text.length)+g.text;break}else if((m==null?void 0:m.type)==="list"){const f=m,p=f.raw+`
`+n.join(`
`),g=this.list(p);i[i.length-1]=g,r=r.substring(0,r.length-m.raw.length)+g.raw,s=s.substring(0,s.length-f.raw.length)+g.raw,n=p.substring(i.at(-1).raw.length).split(`
`);continue}}return{type:"blockquote",raw:r,tokens:i,text:s}}}list(t){let e=this.rules.block.list.exec(t);if(e){let n=e[1].trim();const r=n.length>1,s={type:"list",raw:"",ordered:r,start:r?+n.slice(0,-1):"",loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:"[*+-]");const i=this.rules.other.listItemRegex(n);let o=!1;for(;t;){let c=!1,d="",u="";if(!(e=i.exec(t))||this.rules.block.hr.test(t))break;d=e[0],t=t.substring(d.length);let h=e[2].split(`
`,1)[0].replace(this.rules.other.listReplaceTabs,b=>" ".repeat(3*b.length)),m=t.split(`
`,1)[0],f=!h.trim(),p=0;if(this.options.pedantic?(p=2,u=h.trimStart()):f?p=e[1].length+1:(p=e[2].search(this.rules.other.nonSpaceChar),p=p>4?1:p,u=h.slice(p),p+=e[1].length),f&&this.rules.other.blankLine.test(m)&&(d+=m+`
`,t=t.substring(m.length+1),c=!0),!c){const b=this.rules.other.nextBulletRegex(p),x=this.rules.other.hrRegex(p),w=this.rules.other.fencesBeginRegex(p),k=this.rules.other.headingBeginRegex(p),S=this.rules.other.htmlBeginRegex(p);for(;t;){const C=t.split(`
`,1)[0];let j;if(m=C,this.options.pedantic?(m=m.replace(this.rules.other.listReplaceNesting,"  "),j=m):j=m.replace(this.rules.other.tabCharGlobal,"    "),w.test(m)||k.test(m)||S.test(m)||b.test(m)||x.test(m))break;if(j.search(this.rules.other.nonSpaceChar)>=p||!m.trim())u+=`
`+j.slice(p);else{if(f||h.replace(this.rules.other.tabCharGlobal,"    ").search(this.rules.other.nonSpaceChar)>=4||w.test(h)||k.test(h)||x.test(h))break;u+=`
`+m}!f&&!m.trim()&&(f=!0),d+=C+`
`,t=t.substring(C.length+1),h=j.slice(p)}}s.loose||(o?s.loose=!0:this.rules.other.doubleBlankLine.test(d)&&(o=!0));let g=null,v;this.options.gfm&&(g=this.rules.other.listIsTask.exec(u),g&&(v=g[0]!=="[ ] ",u=u.replace(this.rules.other.listReplaceTask,""))),s.items.push({type:"list_item",raw:d,task:!!g,checked:v,loose:!1,text:u,tokens:[]}),s.raw+=d}const l=s.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;s.raw=s.raw.trimEnd();for(let c=0;c<s.items.length;c++)if(this.lexer.state.top=!1,s.items[c].tokens=this.lexer.blockTokens(s.items[c].text,[]),!s.loose){const d=s.items[c].tokens.filter(h=>h.type==="space"),u=d.length>0&&d.some(h=>this.rules.other.anyLine.test(h.raw));s.loose=u}if(s.loose)for(let c=0;c<s.items.length;c++)s.items[c].loose=!0;return s}}html(t){const e=this.rules.block.html.exec(t);if(e)return{type:"html",block:!0,raw:e[0],pre:e[1]==="pre"||e[1]==="script"||e[1]==="style",text:e[0]}}def(t){const e=this.rules.block.def.exec(t);if(e){const n=e[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=e[2]?e[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",s=e[3]?e[3].substring(1,e[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):e[3];return{type:"def",tag:n,raw:e[0],href:r,title:s}}}table(t){var o;const e=this.rules.block.table.exec(t);if(!e||!this.rules.other.tableDelimiter.test(e[2]))return;const n=l$e(e[1]),r=e[2].replace(this.rules.other.tableAlignChars,"").split("|"),s=(o=e[3])!=null&&o.trim()?e[3].replace(this.rules.other.tableRowBlankLine,"").split(`
`):[],i={type:"table",raw:e[0],header:[],align:[],rows:[]};if(n.length===r.length){for(const l of r)this.rules.other.tableAlignRight.test(l)?i.align.push("right"):this.rules.other.tableAlignCenter.test(l)?i.align.push("center"):this.rules.other.tableAlignLeft.test(l)?i.align.push("left"):i.align.push(null);for(let l=0;l<n.length;l++)i.header.push({text:n[l],tokens:this.lexer.inline(n[l]),header:!0,align:i.align[l]});for(const l of s)i.rows.push(l$e(l,i.header.length).map((c,d)=>({text:c,tokens:this.lexer.inline(c),header:!1,align:i.align[d]})));return i}}lheading(t){const e=this.rules.block.lheading.exec(t);if(e)return{type:"heading",raw:e[0],depth:e[2].charAt(0)==="="?1:2,text:e[1],tokens:this.lexer.inline(e[1])}}paragraph(t){const e=this.rules.block.paragraph.exec(t);if(e){const n=e[1].charAt(e[1].length-1)===`
`?e[1].slice(0,-1):e[1];return{type:"paragraph",raw:e[0],text:n,tokens:this.lexer.inline(n)}}}text(t){const e=this.rules.block.text.exec(t);if(e)return{type:"text",raw:e[0],text:e[0],tokens:this.lexer.inline(e[0])}}escape(t){const e=this.rules.inline.escape.exec(t);if(e)return{type:"escape",raw:e[0],text:e[1]}}tag(t){const e=this.rules.inline.tag.exec(t);if(e)return!this.lexer.state.inLink&&this.rules.other.startATag.test(e[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(e[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(e[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(e[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:e[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:e[0]}}link(t){const e=this.rules.inline.link.exec(t);if(e){const n=e[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(n)){if(!this.rules.other.endAngleBracket.test(n))return;const i=RL(n.slice(0,-1),"\\");if((n.length-i.length)%2===0)return}else{const i=ban(e[2],"()");if(i===-2)return;if(i>-1){const l=(e[0].indexOf("!")===0?5:4)+e[1].length+i;e[2]=e[2].substring(0,i),e[0]=e[0].substring(0,l).trim(),e[3]=""}}let r=e[2],s="";if(this.options.pedantic){const i=this.rules.other.pedanticHrefTitle.exec(r);i&&(r=i[1],s=i[3])}else s=e[3]?e[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(n)?r=r.slice(1):r=r.slice(1,-1)),c$e(e,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:s&&s.replace(this.rules.inline.anyPunctuation,"$1")},e[0],this.lexer,this.rules)}}reflink(t,e){let n;if((n=this.rules.inline.reflink.exec(t))||(n=this.rules.inline.nolink.exec(t))){const r=(n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal," "),s=e[r.toLowerCase()];if(!s){const i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return c$e(n,s,n[0],this.lexer,this.rules)}}emStrong(t,e,n=""){let r=this.rules.inline.emStrongLDelim.exec(t);if(!r||r[3]&&n.match(this.rules.other.unicodeAlphaNumeric))return;if(!(r[1]||r[2]||"")||!n||this.rules.inline.punctuation.exec(n)){const i=[...r[0]].length-1;let o,l,c=i,d=0;const u=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(u.lastIndex=0,e=e.slice(-1*t.length+i);(r=u.exec(e))!=null;){if(o=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!o)continue;if(l=[...o].length,r[3]||r[4]){c+=l;continue}else if((r[5]||r[6])&&i%3&&!((i+l)%3)){d+=l;continue}if(c-=l,c>0)continue;l=Math.min(l,l+c+d);const h=[...r[0]][0].length,m=t.slice(0,i+r.index+h+l);if(Math.min(i,l)%2){const p=m.slice(1,-1);return{type:"em",raw:m,text:p,tokens:this.lexer.inlineTokens(p)}}const f=m.slice(2,-2);return{type:"strong",raw:m,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(t){const e=this.rules.inline.code.exec(t);if(e){let n=e[2].replace(this.rules.other.newLineCharGlobal," ");const r=this.rules.other.nonSpaceChar.test(n),s=this.rules.other.startingSpaceChar.test(n)&&this.rules.other.endingSpaceChar.test(n);return r&&s&&(n=n.substring(1,n.length-1)),{type:"codespan",raw:e[0],text:n}}}br(t){const e=this.rules.inline.br.exec(t);if(e)return{type:"br",raw:e[0]}}del(t){const e=this.rules.inline.del.exec(t);if(e)return{type:"del",raw:e[0],text:e[2],tokens:this.lexer.inlineTokens(e[2])}}autolink(t){const e=this.rules.inline.autolink.exec(t);if(e){let n,r;return e[2]==="@"?(n=e[1],r="mailto:"+n):(n=e[1],r=n),{type:"link",raw:e[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}}}url(t){var n;let e;if(e=this.rules.inline.url.exec(t)){let r,s;if(e[2]==="@")r=e[0],s="mailto:"+r;else{let i;do i=e[0],e[0]=((n=this.rules.inline._backpedal.exec(e[0]))==null?void 0:n[0])??"";while(i!==e[0]);r=e[0],e[1]==="www."?s="http://"+e[0]:s=e[0]}return{type:"link",raw:e[0],text:r,href:s,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(t){const e=this.rules.inline.text.exec(t);if(e){const n=this.lexer.state.inRawBlock;return{type:"text",raw:e[0],text:e[0],escaped:n}}}},lx=class wge{constructor(e){tn(this,"tokens");tn(this,"options");tn(this,"state");tn(this,"tokenizer");tn(this,"inlineQueue");this.tokens=[],this.tokens.links=Object.create(null),this.options=e||IE,this.options.tokenizer=this.options.tokenizer||new xY,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};const n={other:ju,block:nz.normal,inline:PL.normal};this.options.pedantic?(n.block=nz.pedantic,n.inline=PL.pedantic):this.options.gfm&&(n.block=nz.gfm,this.options.breaks?n.inline=PL.breaks:n.inline=PL.gfm),this.tokenizer.rules=n}static get rules(){return{block:nz,inline:PL}}static lex(e,n){return new wge(n).lex(e)}static lexInline(e,n){return new wge(n).inlineTokens(e)}lex(e){e=e.replace(ju.carriageReturn,`
`),this.blockTokens(e,this.tokens);for(let n=0;n<this.inlineQueue.length;n++){const r=this.inlineQueue[n];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,n=[],r=!1){var s,i,o;for(this.options.pedantic&&(e=e.replace(ju.tabCharGlobal,"    ").replace(ju.spaceLine,""));e;){let l;if((i=(s=this.options.extensions)==null?void 0:s.block)!=null&&i.some(d=>(l=d.call({lexer:this},e,n))?(e=e.substring(l.raw.length),n.push(l),!0):!1))continue;if(l=this.tokenizer.space(e)){e=e.substring(l.raw.length);const d=n.at(-1);l.raw.length===1&&d!==void 0?d.raw+=`
`:n.push(l);continue}if(l=this.tokenizer.code(e)){e=e.substring(l.raw.length);const d=n.at(-1);(d==null?void 0:d.type)==="paragraph"||(d==null?void 0:d.type)==="text"?(d.raw+=`
`+l.raw,d.text+=`
`+l.text,this.inlineQueue.at(-1).src=d.text):n.push(l);continue}if(l=this.tokenizer.fences(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.heading(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.hr(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.blockquote(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.list(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.html(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.def(e)){e=e.substring(l.raw.length);const d=n.at(-1);(d==null?void 0:d.type)==="paragraph"||(d==null?void 0:d.type)==="text"?(d.raw+=`
`+l.raw,d.text+=`
`+l.raw,this.inlineQueue.at(-1).src=d.text):this.tokens.links[l.tag]||(this.tokens.links[l.tag]={href:l.href,title:l.title});continue}if(l=this.tokenizer.table(e)){e=e.substring(l.raw.length),n.push(l);continue}if(l=this.tokenizer.lheading(e)){e=e.substring(l.raw.length),n.push(l);continue}let c=e;if((o=this.options.extensions)!=null&&o.startBlock){let d=1/0;const u=e.slice(1);let h;this.options.extensions.startBlock.forEach(m=>{h=m.call({lexer:this},u),typeof h=="number"&&h>=0&&(d=Math.min(d,h))}),d<1/0&&d>=0&&(c=e.substring(0,d+1))}if(this.state.top&&(l=this.tokenizer.paragraph(c))){const d=n.at(-1);r&&(d==null?void 0:d.type)==="paragraph"?(d.raw+=`
`+l.raw,d.text+=`
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=d.text):n.push(l),r=c.length!==e.length,e=e.substring(l.raw.length);continue}if(l=this.tokenizer.text(e)){e=e.substring(l.raw.length);const d=n.at(-1);(d==null?void 0:d.type)==="text"?(d.raw+=`
`+l.raw,d.text+=`
`+l.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=d.text):n.push(l);continue}if(e){const d="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(d);break}else throw new Error(d)}}return this.state.top=!0,n}inline(e,n=[]){return this.inlineQueue.push({src:e,tokens:n}),n}inlineTokens(e,n=[]){var l,c,d;let r=e,s=null;if(this.tokens.links){const u=Object.keys(this.tokens.links);if(u.length>0)for(;(s=this.tokenizer.rules.inline.reflinkSearch.exec(r))!=null;)u.includes(s[0].slice(s[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(s=this.tokenizer.rules.inline.anyPunctuation.exec(r))!=null;)r=r.slice(0,s.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;(s=this.tokenizer.rules.inline.blockSkip.exec(r))!=null;)r=r.slice(0,s.index)+"["+"a".repeat(s[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);let i=!1,o="";for(;e;){i||(o=""),i=!1;let u;if((c=(l=this.options.extensions)==null?void 0:l.inline)!=null&&c.some(m=>(u=m.call({lexer:this},e,n))?(e=e.substring(u.raw.length),n.push(u),!0):!1))continue;if(u=this.tokenizer.escape(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.tag(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.link(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(u.raw.length);const m=n.at(-1);u.type==="text"&&(m==null?void 0:m.type)==="text"?(m.raw+=u.raw,m.text+=u.text):n.push(u);continue}if(u=this.tokenizer.emStrong(e,r,o)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.codespan(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.br(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.del(e)){e=e.substring(u.raw.length),n.push(u);continue}if(u=this.tokenizer.autolink(e)){e=e.substring(u.raw.length),n.push(u);continue}if(!this.state.inLink&&(u=this.tokenizer.url(e))){e=e.substring(u.raw.length),n.push(u);continue}let h=e;if((d=this.options.extensions)!=null&&d.startInline){let m=1/0;const f=e.slice(1);let p;this.options.extensions.startInline.forEach(g=>{p=g.call({lexer:this},f),typeof p=="number"&&p>=0&&(m=Math.min(m,p))}),m<1/0&&m>=0&&(h=e.substring(0,m+1))}if(u=this.tokenizer.inlineText(h)){e=e.substring(u.raw.length),u.raw.slice(-1)!=="_"&&(o=u.raw.slice(-1)),i=!0;const m=n.at(-1);(m==null?void 0:m.type)==="text"?(m.raw+=u.raw,m.text+=u.text):n.push(u);continue}if(e){const m="Infinite loop on byte: "+e.charCodeAt(0);if(this.options.silent){console.error(m);break}else throw new Error(m)}}return n}},wY=class{constructor(t){tn(this,"options");tn(this,"parser");this.options=t||IE}space(t){return""}code({text:t,lang:e,escaped:n}){var i;const r=(i=(e||"").match(ju.notSpaceStart))==null?void 0:i[0],s=t.replace(ju.endingNewline,"")+`
`;return r?'<pre><code class="language-'+kv(r)+'">'+(n?s:kv(s,!0))+`</code></pre>
`:"<pre><code>"+(n?s:kv(s,!0))+`</code></pre>
`}blockquote({tokens:t}){return`<blockquote>
${this.parser.parse(t)}</blockquote>
`}html({text:t}){return t}heading({tokens:t,depth:e}){return`<h${e}>${this.parser.parseInline(t)}</h${e}>
`}hr(t){return`<hr>
`}list(t){const e=t.ordered,n=t.start;let r="";for(let o=0;o<t.items.length;o++){const l=t.items[o];r+=this.listitem(l)}const s=e?"ol":"ul",i=e&&n!==1?' start="'+n+'"':"";return"<"+s+i+`>
`+r+"</"+s+`>
`}listitem(t){var n;let e="";if(t.task){const r=this.checkbox({checked:!!t.checked});t.loose?((n=t.tokens[0])==null?void 0:n.type)==="paragraph"?(t.tokens[0].text=r+" "+t.tokens[0].text,t.tokens[0].tokens&&t.tokens[0].tokens.length>0&&t.tokens[0].tokens[0].type==="text"&&(t.tokens[0].tokens[0].text=r+" "+kv(t.tokens[0].tokens[0].text),t.tokens[0].tokens[0].escaped=!0)):t.tokens.unshift({type:"text",raw:r+" ",text:r+" ",escaped:!0}):e+=r+" "}return e+=this.parser.parse(t.tokens,!!t.loose),`<li>${e}</li>
`}checkbox({checked:t}){return"<input "+(t?'checked="" ':"")+'disabled="" type="checkbox">'}paragraph({tokens:t}){return`<p>${this.parser.parseInline(t)}</p>
`}table(t){let e="",n="";for(let s=0;s<t.header.length;s++)n+=this.tablecell(t.header[s]);e+=this.tablerow({text:n});let r="";for(let s=0;s<t.rows.length;s++){const i=t.rows[s];n="";for(let o=0;o<i.length;o++)n+=this.tablecell(i[o]);r+=this.tablerow({text:n})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
<thead>
`+e+`</thead>
`+r+`</table>
`}tablerow({text:t}){return`<tr>
${t}</tr>
`}tablecell(t){const e=this.parser.parseInline(t.tokens),n=t.header?"th":"td";return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>
`}strong({tokens:t}){return`<strong>${this.parser.parseInline(t)}</strong>`}em({tokens:t}){return`<em>${this.parser.parseInline(t)}</em>`}codespan({text:t}){return`<code>${kv(t,!0)}</code>`}br(t){return"<br>"}del({tokens:t}){return`<del>${this.parser.parseInline(t)}</del>`}link({href:t,title:e,tokens:n}){const r=this.parser.parseInline(n),s=o$e(t);if(s===null)return r;t=s;let i='<a href="'+t+'"';return e&&(i+=' title="'+kv(e)+'"'),i+=">"+r+"</a>",i}image({href:t,title:e,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));const s=o$e(t);if(s===null)return kv(n);t=s;let i=`<img src="${t}" alt="${n}"`;return e&&(i+=` title="${kv(e)}"`),i+=">",i}text(t){return"tokens"in t&&t.tokens?this.parser.parseInline(t.tokens):"escaped"in t&&t.escaped?t.text:kv(t.text)}},Wje=class{strong({text:t}){return t}em({text:t}){return t}codespan({text:t}){return t}del({text:t}){return t}html({text:t}){return t}text({text:t}){return t}link({text:t}){return""+t}image({text:t}){return""+t}br(){return""}},cx=class kge{constructor(e){tn(this,"options");tn(this,"renderer");tn(this,"textRenderer");this.options=e||IE,this.options.renderer=this.options.renderer||new wY,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Wje}static parse(e,n){return new kge(n).parse(e)}static parseInline(e,n){return new kge(n).parseInline(e)}parse(e,n=!0){var s,i;let r="";for(let o=0;o<e.length;o++){const l=e[o];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[l.type]){const d=l,u=this.options.extensions.renderers[d.type].call({parser:this},d);if(u!==!1||!["space","hr","heading","code","table","blockquote","list","html","paragraph","text"].includes(d.type)){r+=u||"";continue}}const c=l;switch(c.type){case"space":{r+=this.renderer.space(c);continue}case"hr":{r+=this.renderer.hr(c);continue}case"heading":{r+=this.renderer.heading(c);continue}case"code":{r+=this.renderer.code(c);continue}case"table":{r+=this.renderer.table(c);continue}case"blockquote":{r+=this.renderer.blockquote(c);continue}case"list":{r+=this.renderer.list(c);continue}case"html":{r+=this.renderer.html(c);continue}case"paragraph":{r+=this.renderer.paragraph(c);continue}case"text":{let d=c,u=this.renderer.text(d);for(;o+1<e.length&&e[o+1].type==="text";)d=e[++o],u+=`
`+this.renderer.text(d);n?r+=this.renderer.paragraph({type:"paragraph",raw:u,text:u,tokens:[{type:"text",raw:u,text:u,escaped:!0}]}):r+=u;continue}default:{const d='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return r}parseInline(e,n=this.renderer){var s,i;let r="";for(let o=0;o<e.length;o++){const l=e[o];if((i=(s=this.options.extensions)==null?void 0:s.renderers)!=null&&i[l.type]){const d=this.options.extensions.renderers[l.type].call({parser:this},l);if(d!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(l.type)){r+=d||"";continue}}const c=l;switch(c.type){case"escape":{r+=n.text(c);break}case"html":{r+=n.html(c);break}case"link":{r+=n.link(c);break}case"image":{r+=n.image(c);break}case"strong":{r+=n.strong(c);break}case"em":{r+=n.em(c);break}case"codespan":{r+=n.codespan(c);break}case"br":{r+=n.br(c);break}case"del":{r+=n.del(c);break}case"text":{r+=n.text(c);break}default:{const d='Token with "'+c.type+'" type was not found.';if(this.options.silent)return console.error(d),"";throw new Error(d)}}}return r}},ime,NG=(ime=class{constructor(t){tn(this,"options");tn(this,"block");this.options=t||IE}preprocess(t){return t}postprocess(t){return t}processAllTokens(t){return t}provideLexer(){return this.block?lx.lex:lx.lexInline}provideParser(){return this.block?cx.parse:cx.parseInline}},tn(ime,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens"])),ime),$ut=class{constructor(...t){tn(this,"defaults",Oje());tn(this,"options",this.setOptions);tn(this,"parse",this.parseMarkdown(!0));tn(this,"parseInline",this.parseMarkdown(!1));tn(this,"Parser",cx);tn(this,"Renderer",wY);tn(this,"TextRenderer",Wje);tn(this,"Lexer",lx);tn(this,"Tokenizer",xY);tn(this,"Hooks",NG);this.use(...t)}walkTokens(t,e){var r,s;let n=[];for(const i of t)switch(n=n.concat(e.call(this,i)),i.type){case"table":{const o=i;for(const l of o.header)n=n.concat(this.walkTokens(l.tokens,e));for(const l of o.rows)for(const c of l)n=n.concat(this.walkTokens(c.tokens,e));break}case"list":{const o=i;n=n.concat(this.walkTokens(o.items,e));break}default:{const o=i;(s=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&s[o.type]?this.defaults.extensions.childTokens[o.type].forEach(l=>{const c=o[l].flat(1/0);n=n.concat(this.walkTokens(c,e))}):o.tokens&&(n=n.concat(this.walkTokens(o.tokens,e)))}}return n}use(...t){const e=this.defaults.extensions||{renderers:{},childTokens:{}};return t.forEach(n=>{const r={...n};if(r.async=this.defaults.async||r.async||!1,n.extensions&&(n.extensions.forEach(s=>{if(!s.name)throw new Error("extension name required");if("renderer"in s){const i=e.renderers[s.name];i?e.renderers[s.name]=function(...o){let l=s.renderer.apply(this,o);return l===!1&&(l=i.apply(this,o)),l}:e.renderers[s.name]=s.renderer}if("tokenizer"in s){if(!s.level||s.level!=="block"&&s.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");const i=e[s.level];i?i.unshift(s.tokenizer):e[s.level]=[s.tokenizer],s.start&&(s.level==="block"?e.startBlock?e.startBlock.push(s.start):e.startBlock=[s.start]:s.level==="inline"&&(e.startInline?e.startInline.push(s.start):e.startInline=[s.start]))}"childTokens"in s&&s.childTokens&&(e.childTokens[s.name]=s.childTokens)}),r.extensions=e),n.renderer){const s=this.defaults.renderer||new wY(this.defaults);for(const i in n.renderer){if(!(i in s))throw new Error(`renderer '${i}' does not exist`);if(["options","parser"].includes(i))continue;const o=i,l=n.renderer[o],c=s[o];s[o]=(...d)=>{let u=l.apply(s,d);return u===!1&&(u=c.apply(s,d)),u||""}}r.renderer=s}if(n.tokenizer){const s=this.defaults.tokenizer||new xY(this.defaults);for(const i in n.tokenizer){if(!(i in s))throw new Error(`tokenizer '${i}' does not exist`);if(["options","rules","lexer"].includes(i))continue;const o=i,l=n.tokenizer[o],c=s[o];s[o]=(...d)=>{let u=l.apply(s,d);return u===!1&&(u=c.apply(s,d)),u}}r.tokenizer=s}if(n.hooks){const s=this.defaults.hooks||new NG;for(const i in n.hooks){if(!(i in s))throw new Error(`hook '${i}' does not exist`);if(["options","block"].includes(i))continue;const o=i,l=n.hooks[o],c=s[o];NG.passThroughHooks.has(i)?s[o]=d=>{if(this.defaults.async)return Promise.resolve(l.call(s,d)).then(h=>c.call(s,h));const u=l.call(s,d);return c.call(s,u)}:s[o]=(...d)=>{let u=l.apply(s,d);return u===!1&&(u=c.apply(s,d)),u}}r.hooks=s}if(n.walkTokens){const s=this.defaults.walkTokens,i=n.walkTokens;r.walkTokens=function(o){let l=[];return l.push(i.call(this,o)),s&&(l=l.concat(s.call(this,o))),l}}this.defaults={...this.defaults,...r}}),this}setOptions(t){return this.defaults={...this.defaults,...t},this}lexer(t,e){return lx.lex(t,e??this.defaults)}parser(t,e){return cx.parse(t,e??this.defaults)}parseMarkdown(t){return(n,r)=>{const s={...r},i={...this.defaults,...s},o=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&s.async===!1)return o(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof n>"u"||n===null)return o(new Error("marked(): input parameter is undefined or null"));if(typeof n!="string")return o(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(n)+", string expected"));i.hooks&&(i.hooks.options=i,i.hooks.block=t);const l=i.hooks?i.hooks.provideLexer():t?lx.lex:lx.lexInline,c=i.hooks?i.hooks.provideParser():t?cx.parse:cx.parseInline;if(i.async)return Promise.resolve(i.hooks?i.hooks.preprocess(n):n).then(d=>l(d,i)).then(d=>i.hooks?i.hooks.processAllTokens(d):d).then(d=>i.walkTokens?Promise.all(this.walkTokens(d,i.walkTokens)).then(()=>d):d).then(d=>c(d,i)).then(d=>i.hooks?i.hooks.postprocess(d):d).catch(o);try{i.hooks&&(n=i.hooks.preprocess(n));let d=l(n,i);i.hooks&&(d=i.hooks.processAllTokens(d)),i.walkTokens&&this.walkTokens(d,i.walkTokens);let u=c(d,i);return i.hooks&&(u=i.hooks.postprocess(u)),u}catch(d){return o(d)}}}onError(t,e){return n=>{if(n.message+=`
Please report this to https://github.com/markedjs/marked.`,t){const r="<p>An error occurred:</p><pre>"+kv(n.message+"",!0)+"</pre>";return e?Promise.resolve(r):r}if(e)return Promise.reject(n);throw n}}},O2=new $ut;function vi(t,e){return O2.parse(t,e)}vi.options=vi.setOptions=function(t){return O2.setOptions(t),vi.defaults=O2.defaults,Eut(vi.defaults),vi};vi.getDefaults=Oje;vi.defaults=IE;vi.use=function(...t){return O2.use(...t),vi.defaults=O2.defaults,Eut(vi.defaults),vi};vi.walkTokens=function(t,e){return O2.walkTokens(t,e)};vi.parseInline=O2.parseInline;vi.Parser=cx;vi.parser=cx.parse;vi.Renderer=wY;vi.TextRenderer=Wje;vi.Lexer=lx;vi.lexer=lx.lex;vi.Tokenizer=xY;vi.Hooks=NG;vi.parse=vi;vi.options;vi.setOptions;vi.use;vi.walkTokens;vi.parseInline;cx.parse;lx.lex;const qje=$je(window),wan=/^https:\/\/(www\.youtube\.com\/embed\/|www\.youtube-nocookie\.com\/embed\/|player\.vimeo\.com\/video\/)/i;qje.addHook("uponSanitizeElement",(t,e)=>{var n,r;if(e.tagName==="iframe"){const s=((n=t.getAttribute)==null?void 0:n.call(t,"src"))||"";wan.test(s)||(r=t.parentNode)==null||r.removeChild(t)}});qje.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer nofollow"))});function hte(t){return qje.sanitize(t,{USE_PROFILES:{html:!0},ADD_TAGS:["iframe"],ADD_ATTR:["allowfullscreen","frameborder","allow","target"],FORBID_ATTR:["style"]})}function kan(t){return hte(vi.parse(t,{async:!1}))}function Kje(t){var i,o;let e;try{e=new URL(t)}catch{return null}if(e.protocol!=="https:"&&e.protocol!=="http:")return null;const n=e.hostname.replace(/^www\.|^m\./,"").toLowerCase(),r=e.pathname,s=l=>l&&/^[\w-]{6,20}$/.test(l)?l:null;if(n==="youtu.be"){const l=s(r.split("/")[1]);return l?`https://www.youtube.com/embed/${l}`:null}if(n==="youtube.com"){if(/\/(channel|c|user|playlist)\b/.test(r))return null;const l=s(e.searchParams.get("v"))??s((i=r.match(/^\/(?:shorts|embed|live)\/([\w-]+)/))==null?void 0:i[1]);return l?`https://www.youtube.com/embed/${l}`:null}if(n==="vimeo.com"||n==="player.vimeo.com"){const l=(o=r.match(/(?:^|\/)(?:video\/)?(\d{5,12})(?:$|\/)/))==null?void 0:o[1];return l?`https://player.vimeo.com/video/${l}`:null}return null}function San(t){for(const e of Array.from(t.querySelectorAll("a[href]"))){const n=Kje(e.getAttribute("href")||"");if(!n)continue;const r=t.createElement("iframe");r.setAttribute("title",n.includes("vimeo")?"Vimeo Embed":"Youtube Embed"),r.setAttribute("src",n),r.setAttribute("width","100%"),r.setAttribute("height",n.includes("vimeo")?"360":"315"),r.setAttribute("class","my-2"),r.setAttribute("allowfullscreen",""),e.replaceWith(r)}}const Can=/(^|[^\w@])@([a-zA-Z0-9._-]+)/g;function jan(t){var r;const e=t.createTreeWalker(t.body,NodeFilter.SHOW_TEXT),n=[];for(let s=e.nextNode();s;s=e.nextNode())(r=s.parentElement)!=null&&r.closest("a, code, pre")||n.push(s);for(const s of n){const i=s.nodeValue||"";if(!i.includes("@"))continue;const o=t.createDocumentFragment();let l=0;for(const c of i.matchAll(Can)){const d=(c.index??0)+c[1].length;o.append(i.slice(l,d));const u=t.createElement("span");u.className="font-medium text-primary",u.textContent=`@${c[2]}`,o.append(u),l=d+1+c[2].length}l!==0&&(o.append(i.slice(l)),s.replaceWith(o))}}function Out(t,{mentions:e=!1}={}){if(!(t!=null&&t.trim()))return"";const n=vi.parse(t,{async:!1,gfm:!0}),r=new DOMParser().parseFromString(`<body>${n}</body>`,"text/html");return San(r),e&&jan(r),hte(r.body.innerHTML)}function Ean(t){return Out(t)}function Nan({community:t,onComplete:e}){const n=y.useMemo(()=>(t.welcomeMessages??[]).filter(d=>d&&d.trim().length>0),[t.welcomeMessages]),r=y.useMemo(()=>n.map(d=>Ean(d)),[n]),[s,i]=y.useState(0),[o,l]=y.useState(!0),c=()=>{ddt(),l(!1),e()};return n.length?a.jsx(Bt,{open:o,onOpenChange:d=>!d&&c(),children:a.jsxs(Ft,{className:"max-w-lg gap-0 overflow-hidden p-0 sm:max-w-lg",children:[a.jsxs("div",{className:"flex flex-col items-center border-b border-border bg-card py-6",children:[a.jsx(bI,{sources:[t.logo],fallbackSrc:J8,alt:"",className:"h-[148px] max-h-[148px] max-w-[200px] object-contain"}),a.jsx("div",{className:"mb-1 mt-3 text-xs font-semibold text-muted-foreground",children:"Welcome to"}),a.jsx("div",{className:"text-lg font-bold text-foreground",children:t.name})]}),a.jsx("div",{className:"px-4 py-4",children:a.jsx("div",{className:"prose prose-sm max-w-none break-words text-foreground headings NL2BR",dangerouslySetInnerHTML:{__html:r[s]??""}})}),a.jsx("div",{className:"flex justify-center gap-1 pb-2 pt-2",children:n.map((d,u)=>a.jsx("span",{className:ee("block h-1 rounded-sm bg-muted transition-all",u===s?"w-4 bg-primary":"w-1")},u))}),a.jsxs("div",{className:"flex items-center justify-between border-t border-border bg-card px-4 py-3",children:[s===0?a.jsx("button",{type:"button",className:"cursor-pointer p-2 text-sm text-muted-foreground hover:text-foreground",onClick:c,children:"Close"}):a.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>i(s-1),children:"Back"}),a.jsx(Z,{size:"sm",onClick:()=>{s+1>=n.length?c():i(s+1)},children:s+1>=n.length?"Finish":"Next"})]})]})}):null}function Tan({onFinished:t}){const{community:e}=qe(),{applyPensilSessionUser:n}=jr(),{activeStep:r,pensilUser:s,onProfileComplete:i,onWelcomeComplete:o}=Bsn(e),l=y.useRef(r);y.useEffect(()=>{l.current&&!r&&(t==null||t()),l.current=r},[r,t]);const c=d=>{n(d)};return!s||!e?null:r==="profile"?a.jsx(Ysn,{onComplete:i,onSessionUpdated:c}):r==="welcome"?a.jsx(Nan,{community:e,onComplete:o}):r==="admin-tour"?a.jsx(Vsn,{user:s,community:e,onComplete:o}):null}function _an(){const t=Nn(),{community:e}=qe();return y.useEffect(()=>{e&&(gge(e)||t(ve.dashboard,{replace:!0}))},[e,t]),e?gge(e)?a.jsx(Ak,{title:e.name,description:"Complete these steps before you enter the community.",children:a.jsx("div",{className:"w-full min-h-[200px]",children:a.jsx(Tan,{onFinished:()=>t(ve.dashboard,{replace:!0})})})}):a.jsx(Gs,{to:ve.dashboard,replace:!0}):a.jsx(Gs,{to:ve.communities,replace:!0})}function Aan(){return a.jsx(Ak,{title:"Access restricted",description:"Your account cannot access this community.",children:a.jsxs("div",{className:"mx-auto max-w-md rounded-2xl bg-white p-8 text-center text-neutral-900 shadow-md",children:[a.jsx("h2",{className:"text-xl font-semibold text-red-600",children:"You are blocked by the community admin"}),a.jsx("p",{className:"mt-4 text-sm text-neutral-600",children:"Please contact your community administrator if you believe this is a mistake."}),a.jsx(Z,{asChild:!0,className:"mt-6 rounded-full",children:a.jsx(vr,{to:ve.signIn,children:"Back to sign in"})})]})})}function Fut(){const{community:t}=qe(),e=e7();return!!(e&&t&&Xee(t.address,e,t.resolvedFromHost)&&wje(t))}function kY(t,e){const n=t+e;return n&&n!=="/"?`?redirect=${encodeURIComponent(n)}`:""}function XT({children:t,allowGuest:e=!1}){const{isAuthenticated:n,authLoading:r}=jr(),s=Fut(),i=e7(),o=Di();return r?null:n?a.jsx(a.Fragment,{children:t}):e&&s?a.jsx(a.Fragment,{children:t}):e&&i?a.jsx(Gs,{to:{pathname:ve.home,search:kY(o.pathname,o.search)},replace:!0}):a.jsx(Gs,{to:{pathname:ve.signUp,search:kY(o.pathname,o.search)},replace:!0})}function d$e({children:t}){const{isAuthenticated:e,authLoading:n}=jr();return n?null:e?a.jsx(Gs,{to:ve.communities,replace:!0}):a.jsx(a.Fragment,{children:t})}function Pan({children:t}){const{isAuthenticated:e,authLoading:n}=jr(),{community:r}=qe(),s=Fut(),i=e7(),o=Di(),l={pathname:ve.home,search:kY(o.pathname,o.search)};return n?null:!e&&!s?a.jsx(Gs,{to:i?l:{pathname:ve.signIn,search:kY(o.pathname,o.search)},replace:!0}):r?e&&hdt(r)?a.jsx(Gs,{to:ve.communitiesOnboarding,replace:!0}):i?Xee(r.address,i,r.resolvedFromHost)?a.jsx(a.Fragment,{children:t}):a.jsx(Gs,{to:ve.home,replace:!0}):Ynn()?Qnn()?a.jsx(a.Fragment,{children:t}):a.jsx(Gs,{to:ve.communities,replace:!0}):a.jsx(a.Fragment,{children:t}):a.jsx(Gs,{to:i?l:{pathname:ve.communities},replace:!0})}const Gw=y.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ee("rounded-lg border bg-card text-card-foreground shadow-sm",t),...e}));Gw.displayName="Card";const Ran=y.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ee("flex flex-col space-y-1.5 p-6",t),...e}));Ran.displayName="CardHeader";const Ian=y.forwardRef(({className:t,...e},n)=>a.jsx("h3",{ref:n,className:ee("text-2xl font-semibold leading-none tracking-tight",t),...e}));Ian.displayName="CardTitle";const Man=y.forwardRef(({className:t,...e},n)=>a.jsx("p",{ref:n,className:ee("text-sm text-muted-foreground",t),...e}));Man.displayName="CardDescription";const Ww=y.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ee("p-6 pt-0",t),...e}));Ww.displayName="CardContent";const Lan=y.forwardRef(({className:t,...e},n)=>a.jsx("div",{ref:n,className:ee("flex items-center p-6 pt-0",t),...e}));Lan.displayName="CardFooter";const mte="/event-guests",fte=t=>({skipAuth:!0,credentials:"same-origin",headers:{"X-Event-Invite":t}});function Dan(t,e){return ae.post(`/community/${encodeURIComponent(t)}/event/${encodeURIComponent(e)}/guest-invites`,{})}const $an="We couldn't load this event right now. Please try again in a few minutes.";async function Oan(t){const e=await ae.get(`${mte}/details`,fte(t)),n=e&&typeof e=="object"?e.event:void 0;if(!n||typeof n!="object")throw new Error($an);return n}function u$e(t,e){return ae.post(`${mte}/access`,{password:e},fte(t))}function Fan(t,e,n){return ae.post(`${mte}/registration`,{name:e,email:n},fte(t))}async function But(t){return(await ae.post(`${mte}/join`,{},fte(t))).payload}function Nr(t){const e=Object.prototype.toString.call(t);return t instanceof Date||typeof t=="object"&&e==="[object Date]"?new t.constructor(+t):typeof t=="number"||e==="[object Number]"||typeof t=="string"||e==="[object String]"?new Date(t):new Date(NaN)}function ta(t,e){return t instanceof Date?new t.constructor(e):new Date(e)}function ld(t,e){const n=Nr(t);return isNaN(e)?ta(t,NaN):(e&&n.setDate(n.getDate()+e),n)}function Uf(t,e){const n=Nr(t);if(isNaN(e))return ta(t,NaN);if(!e)return n;const r=n.getDate(),s=ta(t,n.getTime());s.setMonth(n.getMonth()+e+1,0);const i=s.getDate();return r>=i?s:(n.setFullYear(s.getFullYear(),s.getMonth(),r),n)}const Yje=6048e5,Ban=864e5,Qje=6e4,Zje=36e5,Uan=1e3,rz=43200,h$e=1440;let zan={};function vS(){return zan}function Em(t,e){var l,c,d,u;const n=vS(),r=(e==null?void 0:e.weekStartsOn)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((u=(d=n.locale)==null?void 0:d.options)==null?void 0:u.weekStartsOn)??0,s=Nr(t),i=s.getDay(),o=(i<r?7:0)+i-r;return s.setDate(s.getDate()-o),s.setHours(0,0,0,0),s}function Jx(t){return Em(t,{weekStartsOn:1})}function Uut(t){const e=Nr(t),n=e.getFullYear(),r=ta(t,0);r.setFullYear(n+1,0,4),r.setHours(0,0,0,0);const s=Jx(r),i=ta(t,0);i.setFullYear(n,0,4),i.setHours(0,0,0,0);const o=Jx(i);return e.getTime()>=s.getTime()?n+1:e.getTime()>=o.getTime()?n:n-1}function Rk(t){const e=Nr(t);return e.setHours(0,0,0,0),e}function Ik(t){const e=Nr(t),n=new Date(Date.UTC(e.getFullYear(),e.getMonth(),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds(),e.getMilliseconds()));return n.setUTCFullYear(e.getFullYear()),+t-+n}function kf(t,e){const n=Rk(t),r=Rk(e),s=+n-Ik(n),i=+r-Ik(r);return Math.round((s-i)/Ban)}function Van(t){const e=Uut(t),n=ta(t,0);return n.setFullYear(e,0,4),n.setHours(0,0,0,0),Jx(n)}function Sge(t,e){const n=e*7;return ld(t,n)}function Han(t,e){return Uf(t,e*12)}function Gan(t){let e;return t.forEach(function(n){const r=Nr(n);(e===void 0||e<r||isNaN(Number(r)))&&(e=r)}),e||new Date(NaN)}function Wan(t){let e;return t.forEach(n=>{const r=Nr(n);(!e||e>r||isNaN(+r))&&(e=r)}),e||new Date(NaN)}function TG(t,e){const n=Nr(t),r=Nr(e),s=n.getTime()-r.getTime();return s<0?-1:s>0?1:s}function zut(t){return ta(t,Date.now())}function Gd(t,e){const n=Rk(t),r=Rk(e);return+n==+r}function Jje(t){return t instanceof Date||typeof t=="object"&&Object.prototype.toString.call(t)==="[object Date]"}function qan(t){if(!Jje(t)&&typeof t!="number")return!1;const e=Nr(t);return!isNaN(Number(e))}function hR(t,e){const n=Nr(t),r=Nr(e),s=n.getFullYear()-r.getFullYear(),i=n.getMonth()-r.getMonth();return s*12+i}function Kan(t,e,n){const r=Em(t,n),s=Em(e,n),i=+r-Ik(r),o=+s-Ik(s);return Math.round((i-o)/Yje)}function Yan(t){return e=>{const r=(t?Math[t]:Math.trunc)(e);return r===0?0:r}}function Qan(t,e){return+Nr(t)-+Nr(e)}function Zan(t){const e=Nr(t);return e.setHours(23,59,59,999),e}function pte(t){const e=Nr(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(23,59,59,999),e}function Jan(t){const e=Nr(t);return+Zan(e)==+pte(e)}function Xan(t,e){const n=Nr(t),r=Nr(e),s=TG(n,r),i=Math.abs(hR(n,r));let o;if(i<1)o=0;else{n.getMonth()===1&&n.getDate()>27&&n.setDate(30),n.setMonth(n.getMonth()-s*i);let l=TG(n,r)===-s;Jan(Nr(t))&&i===1&&TG(t,r)===1&&(l=!1),o=s*(i-Number(l))}return o===0?0:o}function eon(t,e,n){const r=Qan(t,e)/1e3;return Yan(n==null?void 0:n.roundingMethod)(r)}function ton(t){const e=Nr(t),n=e.getMonth(),r=n-n%3;return e.setMonth(r,1),e.setHours(0,0,0,0),e}function vc(t){const e=Nr(t);return e.setDate(1),e.setHours(0,0,0,0),e}function Xje(t){const e=Nr(t),n=ta(t,0);return n.setFullYear(e.getFullYear(),0,1),n.setHours(0,0,0,0),n}function e2e(t,e){var l,c,d,u;const n=vS(),r=(e==null?void 0:e.weekStartsOn)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.weekStartsOn)??n.weekStartsOn??((u=(d=n.locale)==null?void 0:d.options)==null?void 0:u.weekStartsOn)??0,s=Nr(t),i=s.getDay(),o=(i<r?-7:0)+6-(i-r);return s.setDate(s.getDate()+o),s.setHours(23,59,59,999),s}function Vut(t){return e2e(t,{weekStartsOn:1})}const non={lessThanXSeconds:{one:"less than a second",other:"less than {{count}} seconds"},xSeconds:{one:"1 second",other:"{{count}} seconds"},halfAMinute:"half a minute",lessThanXMinutes:{one:"less than a minute",other:"less than {{count}} minutes"},xMinutes:{one:"1 minute",other:"{{count}} minutes"},aboutXHours:{one:"about 1 hour",other:"about {{count}} hours"},xHours:{one:"1 hour",other:"{{count}} hours"},xDays:{one:"1 day",other:"{{count}} days"},aboutXWeeks:{one:"about 1 week",other:"about {{count}} weeks"},xWeeks:{one:"1 week",other:"{{count}} weeks"},aboutXMonths:{one:"about 1 month",other:"about {{count}} months"},xMonths:{one:"1 month",other:"{{count}} months"},aboutXYears:{one:"about 1 year",other:"about {{count}} years"},xYears:{one:"1 year",other:"{{count}} years"},overXYears:{one:"over 1 year",other:"over {{count}} years"},almostXYears:{one:"almost 1 year",other:"almost {{count}} years"}},ron=(t,e,n)=>{let r;const s=non[t];return typeof s=="string"?r=s:e===1?r=s.one:r=s.other.replace("{{count}}",e.toString()),n!=null&&n.addSuffix?n.comparison&&n.comparison>0?"in "+r:r+" ago":r};function lle(t){return(e={})=>{const n=e.width?String(e.width):t.defaultWidth;return t.formats[n]||t.formats[t.defaultWidth]}}const son={full:"EEEE, MMMM do, y",long:"MMMM do, y",medium:"MMM d, y",short:"MM/dd/yyyy"},ion={full:"h:mm:ss a zzzz",long:"h:mm:ss a z",medium:"h:mm:ss a",short:"h:mm a"},aon={full:"{{date}} 'at' {{time}}",long:"{{date}} 'at' {{time}}",medium:"{{date}}, {{time}}",short:"{{date}}, {{time}}"},oon={date:lle({formats:son,defaultWidth:"full"}),time:lle({formats:ion,defaultWidth:"full"}),dateTime:lle({formats:aon,defaultWidth:"full"})},lon={lastWeek:"'last' eeee 'at' p",yesterday:"'yesterday at' p",today:"'today at' p",tomorrow:"'tomorrow at' p",nextWeek:"eeee 'at' p",other:"P"},con=(t,e,n,r)=>lon[t];function IL(t){return(e,n)=>{const r=n!=null&&n.context?String(n.context):"standalone";let s;if(r==="formatting"&&t.formattingValues){const o=t.defaultFormattingWidth||t.defaultWidth,l=n!=null&&n.width?String(n.width):o;s=t.formattingValues[l]||t.formattingValues[o]}else{const o=t.defaultWidth,l=n!=null&&n.width?String(n.width):t.defaultWidth;s=t.values[l]||t.values[o]}const i=t.argumentCallback?t.argumentCallback(e):e;return s[i]}}const don={narrow:["B","A"],abbreviated:["BC","AD"],wide:["Before Christ","Anno Domini"]},uon={narrow:["1","2","3","4"],abbreviated:["Q1","Q2","Q3","Q4"],wide:["1st quarter","2nd quarter","3rd quarter","4th quarter"]},hon={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"]},mon={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"]},fon={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"}},pon={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"}},gon=(t,e)=>{const n=Number(t),r=n%100;if(r>20||r<10)switch(r%10){case 1:return n+"st";case 2:return n+"nd";case 3:return n+"rd"}return n+"th"},von={ordinalNumber:gon,era:IL({values:don,defaultWidth:"wide"}),quarter:IL({values:uon,defaultWidth:"wide",argumentCallback:t=>t-1}),month:IL({values:hon,defaultWidth:"wide"}),day:IL({values:mon,defaultWidth:"wide"}),dayPeriod:IL({values:fon,defaultWidth:"wide",formattingValues:pon,defaultFormattingWidth:"wide"})};function ML(t){return(e,n={})=>{const r=n.width,s=r&&t.matchPatterns[r]||t.matchPatterns[t.defaultMatchWidth],i=e.match(s);if(!i)return null;const o=i[0],l=r&&t.parsePatterns[r]||t.parsePatterns[t.defaultParseWidth],c=Array.isArray(l)?bon(l,h=>h.test(o)):yon(l,h=>h.test(o));let d;d=t.valueCallback?t.valueCallback(c):c,d=n.valueCallback?n.valueCallback(d):d;const u=e.slice(o.length);return{value:d,rest:u}}}function yon(t,e){for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&e(t[n]))return n}function bon(t,e){for(let n=0;n<t.length;n++)if(e(t[n]))return n}function xon(t){return(e,n={})=>{const r=e.match(t.matchPattern);if(!r)return null;const s=r[0],i=e.match(t.parsePattern);if(!i)return null;let o=t.valueCallback?t.valueCallback(i[0]):i[0];o=n.valueCallback?n.valueCallback(o):o;const l=e.slice(s.length);return{value:o,rest:l}}}const won=/^(\d+)(th|st|nd|rd)?/i,kon=/\d+/i,Son={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},Con={any:[/^b/i,/^(a|c)/i]},jon={narrow:/^[1234]/i,abbreviated:/^q[1234]/i,wide:/^[1234](th|st|nd|rd)? quarter/i},Eon={any:[/1/i,/2/i,/3/i,/4/i]},Non={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},Ton={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]},_on={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},Aon={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]},Pon={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},Ron={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}},Ion={ordinalNumber:xon({matchPattern:won,parsePattern:kon,valueCallback:t=>parseInt(t,10)}),era:ML({matchPatterns:Son,defaultMatchWidth:"wide",parsePatterns:Con,defaultParseWidth:"any"}),quarter:ML({matchPatterns:jon,defaultMatchWidth:"wide",parsePatterns:Eon,defaultParseWidth:"any",valueCallback:t=>t+1}),month:ML({matchPatterns:Non,defaultMatchWidth:"wide",parsePatterns:Ton,defaultParseWidth:"any"}),day:ML({matchPatterns:_on,defaultMatchWidth:"wide",parsePatterns:Aon,defaultParseWidth:"any"}),dayPeriod:ML({matchPatterns:Pon,defaultMatchWidth:"any",parsePatterns:Ron,defaultParseWidth:"any"})},u7={code:"en-US",formatDistance:ron,formatLong:oon,formatRelative:con,localize:von,match:Ion,options:{weekStartsOn:0,firstWeekContainsDate:1}};function Mon(t){const e=Nr(t);return kf(e,Xje(e))+1}function t2e(t){const e=Nr(t),n=+Jx(e)-+Van(e);return Math.round(n/Yje)+1}function n2e(t,e){var u,h,m,f;const n=Nr(t),r=n.getFullYear(),s=vS(),i=(e==null?void 0:e.firstWeekContainsDate)??((h=(u=e==null?void 0:e.locale)==null?void 0:u.options)==null?void 0:h.firstWeekContainsDate)??s.firstWeekContainsDate??((f=(m=s.locale)==null?void 0:m.options)==null?void 0:f.firstWeekContainsDate)??1,o=ta(t,0);o.setFullYear(r+1,0,i),o.setHours(0,0,0,0);const l=Em(o,e),c=ta(t,0);c.setFullYear(r,0,i),c.setHours(0,0,0,0);const d=Em(c,e);return n.getTime()>=l.getTime()?r+1:n.getTime()>=d.getTime()?r:r-1}function Lon(t,e){var l,c,d,u;const n=vS(),r=(e==null?void 0:e.firstWeekContainsDate)??((c=(l=e==null?void 0:e.locale)==null?void 0:l.options)==null?void 0:c.firstWeekContainsDate)??n.firstWeekContainsDate??((u=(d=n.locale)==null?void 0:d.options)==null?void 0:u.firstWeekContainsDate)??1,s=n2e(t,e),i=ta(t,0);return i.setFullYear(s,0,r),i.setHours(0,0,0,0),Em(i,e)}function r2e(t,e){const n=Nr(t),r=+Em(n,e)-+Lon(n,e);return Math.round(r/Yje)+1}function Fi(t,e){const n=t<0?"-":"",r=Math.abs(t).toString().padStart(e,"0");return n+r}const nw={y(t,e){const n=t.getFullYear(),r=n>0?n:1-n;return Fi(e==="yy"?r%100:r,e.length)},M(t,e){const n=t.getMonth();return e==="M"?String(n+1):Fi(n+1,2)},d(t,e){return Fi(t.getDate(),e.length)},a(t,e){const n=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.toUpperCase();case"aaa":return n;case"aaaaa":return n[0];case"aaaa":default:return n==="am"?"a.m.":"p.m."}},h(t,e){return Fi(t.getHours()%12||12,e.length)},H(t,e){return Fi(t.getHours(),e.length)},m(t,e){return Fi(t.getMinutes(),e.length)},s(t,e){return Fi(t.getSeconds(),e.length)},S(t,e){const n=e.length,r=t.getMilliseconds(),s=Math.trunc(r*Math.pow(10,n-3));return Fi(s,e.length)}},QN={am:"am",pm:"pm",midnight:"midnight",noon:"noon",morning:"morning",afternoon:"afternoon",evening:"evening",night:"night"},m$e={G:function(t,e,n){const r=t.getFullYear()>0?1:0;switch(e){case"G":case"GG":case"GGG":return n.era(r,{width:"abbreviated"});case"GGGGG":return n.era(r,{width:"narrow"});case"GGGG":default:return n.era(r,{width:"wide"})}},y:function(t,e,n){if(e==="yo"){const r=t.getFullYear(),s=r>0?r:1-r;return n.ordinalNumber(s,{unit:"year"})}return nw.y(t,e)},Y:function(t,e,n,r){const s=n2e(t,r),i=s>0?s:1-s;if(e==="YY"){const o=i%100;return Fi(o,2)}return e==="Yo"?n.ordinalNumber(i,{unit:"year"}):Fi(i,e.length)},R:function(t,e){const n=Uut(t);return Fi(n,e.length)},u:function(t,e){const n=t.getFullYear();return Fi(n,e.length)},Q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"Q":return String(r);case"QQ":return Fi(r,2);case"Qo":return n.ordinalNumber(r,{unit:"quarter"});case"QQQ":return n.quarter(r,{width:"abbreviated",context:"formatting"});case"QQQQQ":return n.quarter(r,{width:"narrow",context:"formatting"});case"QQQQ":default:return n.quarter(r,{width:"wide",context:"formatting"})}},q:function(t,e,n){const r=Math.ceil((t.getMonth()+1)/3);switch(e){case"q":return String(r);case"qq":return Fi(r,2);case"qo":return n.ordinalNumber(r,{unit:"quarter"});case"qqq":return n.quarter(r,{width:"abbreviated",context:"standalone"});case"qqqqq":return n.quarter(r,{width:"narrow",context:"standalone"});case"qqqq":default:return n.quarter(r,{width:"wide",context:"standalone"})}},M:function(t,e,n){const r=t.getMonth();switch(e){case"M":case"MM":return nw.M(t,e);case"Mo":return n.ordinalNumber(r+1,{unit:"month"});case"MMM":return n.month(r,{width:"abbreviated",context:"formatting"});case"MMMMM":return n.month(r,{width:"narrow",context:"formatting"});case"MMMM":default:return n.month(r,{width:"wide",context:"formatting"})}},L:function(t,e,n){const r=t.getMonth();switch(e){case"L":return String(r+1);case"LL":return Fi(r+1,2);case"Lo":return n.ordinalNumber(r+1,{unit:"month"});case"LLL":return n.month(r,{width:"abbreviated",context:"standalone"});case"LLLLL":return n.month(r,{width:"narrow",context:"standalone"});case"LLLL":default:return n.month(r,{width:"wide",context:"standalone"})}},w:function(t,e,n,r){const s=r2e(t,r);return e==="wo"?n.ordinalNumber(s,{unit:"week"}):Fi(s,e.length)},I:function(t,e,n){const r=t2e(t);return e==="Io"?n.ordinalNumber(r,{unit:"week"}):Fi(r,e.length)},d:function(t,e,n){return e==="do"?n.ordinalNumber(t.getDate(),{unit:"date"}):nw.d(t,e)},D:function(t,e,n){const r=Mon(t);return e==="Do"?n.ordinalNumber(r,{unit:"dayOfYear"}):Fi(r,e.length)},E:function(t,e,n){const r=t.getDay();switch(e){case"E":case"EE":case"EEE":return n.day(r,{width:"abbreviated",context:"formatting"});case"EEEEE":return n.day(r,{width:"narrow",context:"formatting"});case"EEEEEE":return n.day(r,{width:"short",context:"formatting"});case"EEEE":default:return n.day(r,{width:"wide",context:"formatting"})}},e:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"e":return String(i);case"ee":return Fi(i,2);case"eo":return n.ordinalNumber(i,{unit:"day"});case"eee":return n.day(s,{width:"abbreviated",context:"formatting"});case"eeeee":return n.day(s,{width:"narrow",context:"formatting"});case"eeeeee":return n.day(s,{width:"short",context:"formatting"});case"eeee":default:return n.day(s,{width:"wide",context:"formatting"})}},c:function(t,e,n,r){const s=t.getDay(),i=(s-r.weekStartsOn+8)%7||7;switch(e){case"c":return String(i);case"cc":return Fi(i,e.length);case"co":return n.ordinalNumber(i,{unit:"day"});case"ccc":return n.day(s,{width:"abbreviated",context:"standalone"});case"ccccc":return n.day(s,{width:"narrow",context:"standalone"});case"cccccc":return n.day(s,{width:"short",context:"standalone"});case"cccc":default:return n.day(s,{width:"wide",context:"standalone"})}},i:function(t,e,n){const r=t.getDay(),s=r===0?7:r;switch(e){case"i":return String(s);case"ii":return Fi(s,e.length);case"io":return n.ordinalNumber(s,{unit:"day"});case"iii":return n.day(r,{width:"abbreviated",context:"formatting"});case"iiiii":return n.day(r,{width:"narrow",context:"formatting"});case"iiiiii":return n.day(r,{width:"short",context:"formatting"});case"iiii":default:return n.day(r,{width:"wide",context:"formatting"})}},a:function(t,e,n){const s=t.getHours()/12>=1?"pm":"am";switch(e){case"a":case"aa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"aaa":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"aaaaa":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"aaaa":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},b:function(t,e,n){const r=t.getHours();let s;switch(r===12?s=QN.noon:r===0?s=QN.midnight:s=r/12>=1?"pm":"am",e){case"b":case"bb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"bbb":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"}).toLowerCase();case"bbbbb":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"bbbb":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},B:function(t,e,n){const r=t.getHours();let s;switch(r>=17?s=QN.evening:r>=12?s=QN.afternoon:r>=4?s=QN.morning:s=QN.night,e){case"B":case"BB":case"BBB":return n.dayPeriod(s,{width:"abbreviated",context:"formatting"});case"BBBBB":return n.dayPeriod(s,{width:"narrow",context:"formatting"});case"BBBB":default:return n.dayPeriod(s,{width:"wide",context:"formatting"})}},h:function(t,e,n){if(e==="ho"){let r=t.getHours()%12;return r===0&&(r=12),n.ordinalNumber(r,{unit:"hour"})}return nw.h(t,e)},H:function(t,e,n){return e==="Ho"?n.ordinalNumber(t.getHours(),{unit:"hour"}):nw.H(t,e)},K:function(t,e,n){const r=t.getHours()%12;return e==="Ko"?n.ordinalNumber(r,{unit:"hour"}):Fi(r,e.length)},k:function(t,e,n){let r=t.getHours();return r===0&&(r=24),e==="ko"?n.ordinalNumber(r,{unit:"hour"}):Fi(r,e.length)},m:function(t,e,n){return e==="mo"?n.ordinalNumber(t.getMinutes(),{unit:"minute"}):nw.m(t,e)},s:function(t,e,n){return e==="so"?n.ordinalNumber(t.getSeconds(),{unit:"second"}):nw.s(t,e)},S:function(t,e){return nw.S(t,e)},X:function(t,e,n){const r=t.getTimezoneOffset();if(r===0)return"Z";switch(e){case"X":return p$e(r);case"XXXX":case"XX":return bC(r);case"XXXXX":case"XXX":default:return bC(r,":")}},x:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"x":return p$e(r);case"xxxx":case"xx":return bC(r);case"xxxxx":case"xxx":default:return bC(r,":")}},O:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"O":case"OO":case"OOO":return"GMT"+f$e(r,":");case"OOOO":default:return"GMT"+bC(r,":")}},z:function(t,e,n){const r=t.getTimezoneOffset();switch(e){case"z":case"zz":case"zzz":return"GMT"+f$e(r,":");case"zzzz":default:return"GMT"+bC(r,":")}},t:function(t,e,n){const r=Math.trunc(t.getTime()/1e3);return Fi(r,e.length)},T:function(t,e,n){const r=t.getTime();return Fi(r,e.length)}};function f$e(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Math.trunc(r/60),i=r%60;return i===0?n+String(s):n+String(s)+e+Fi(i,2)}function p$e(t,e){return t%60===0?(t>0?"-":"+")+Fi(Math.abs(t)/60,2):bC(t,e)}function bC(t,e=""){const n=t>0?"-":"+",r=Math.abs(t),s=Fi(Math.trunc(r/60),2),i=Fi(r%60,2);return n+s+e+i}const g$e=(t,e)=>{switch(t){case"P":return e.date({width:"short"});case"PP":return e.date({width:"medium"});case"PPP":return e.date({width:"long"});case"PPPP":default:return e.date({width:"full"})}},Hut=(t,e)=>{switch(t){case"p":return e.time({width:"short"});case"pp":return e.time({width:"medium"});case"ppp":return e.time({width:"long"});case"pppp":default:return e.time({width:"full"})}},Don=(t,e)=>{const n=t.match(/(P+)(p+)?/)||[],r=n[1],s=n[2];if(!s)return g$e(t,e);let i;switch(r){case"P":i=e.dateTime({width:"short"});break;case"PP":i=e.dateTime({width:"medium"});break;case"PPP":i=e.dateTime({width:"long"});break;case"PPPP":default:i=e.dateTime({width:"full"});break}return i.replace("{{date}}",g$e(r,e)).replace("{{time}}",Hut(s,e))},Cge={p:Hut,P:Don},$on=/^D+$/,Oon=/^Y+$/,Fon=["D","DD","YY","YYYY"];function Gut(t){return $on.test(t)}function Wut(t){return Oon.test(t)}function jge(t,e,n){const r=Bon(t,e,n);if(console.warn(r),Fon.includes(t))throw new RangeError(r)}function Bon(t,e,n){const r=t[0]==="Y"?"years":"days of the month";return`Use \`${t.toLowerCase()}\` instead of \`${t}\` (in \`${e}\`) for formatting ${r} to the input \`${n}\`; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md`}const Uon=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,zon=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Von=/^'([^]*?)'?$/,Hon=/''/g,Gon=/[a-zA-Z]/;function fo(t,e,n){var u,h,m,f,p,g,v,b;const r=vS(),s=(n==null?void 0:n.locale)??r.locale??u7,i=(n==null?void 0:n.firstWeekContainsDate)??((h=(u=n==null?void 0:n.locale)==null?void 0:u.options)==null?void 0:h.firstWeekContainsDate)??r.firstWeekContainsDate??((f=(m=r.locale)==null?void 0:m.options)==null?void 0:f.firstWeekContainsDate)??1,o=(n==null?void 0:n.weekStartsOn)??((g=(p=n==null?void 0:n.locale)==null?void 0:p.options)==null?void 0:g.weekStartsOn)??r.weekStartsOn??((b=(v=r.locale)==null?void 0:v.options)==null?void 0:b.weekStartsOn)??0,l=Nr(t);if(!qan(l))throw new RangeError("Invalid time value");let c=e.match(zon).map(x=>{const w=x[0];if(w==="p"||w==="P"){const k=Cge[w];return k(x,s.formatLong)}return x}).join("").match(Uon).map(x=>{if(x==="''")return{isToken:!1,value:"'"};const w=x[0];if(w==="'")return{isToken:!1,value:Won(x)};if(m$e[w])return{isToken:!0,value:x};if(w.match(Gon))throw new RangeError("Format string contains an unescaped latin alphabet character `"+w+"`");return{isToken:!1,value:x}});s.localize.preprocessor&&(c=s.localize.preprocessor(l,c));const d={firstWeekContainsDate:i,weekStartsOn:o,locale:s};return c.map(x=>{if(!x.isToken)return x.value;const w=x.value;(!(n!=null&&n.useAdditionalWeekYearTokens)&&Wut(w)||!(n!=null&&n.useAdditionalDayOfYearTokens)&&Gut(w))&&jge(w,e,String(t));const k=m$e[w[0]];return k(l,w,s.localize,d)}).join("")}function Won(t){const e=t.match(Von);return e?e[1].replace(Hon,"'"):t}function qon(t,e,n){const r=vS(),s=(n==null?void 0:n.locale)??r.locale??u7,i=2520,o=TG(t,e);if(isNaN(o))throw new RangeError("Invalid time value");const l=Object.assign({},n,{addSuffix:n==null?void 0:n.addSuffix,comparison:o});let c,d;o>0?(c=Nr(e),d=Nr(t)):(c=Nr(t),d=Nr(e));const u=eon(d,c),h=(Ik(d)-Ik(c))/1e3,m=Math.round((u-h)/60);let f;if(m<2)return n!=null&&n.includeSeconds?u<5?s.formatDistance("lessThanXSeconds",5,l):u<10?s.formatDistance("lessThanXSeconds",10,l):u<20?s.formatDistance("lessThanXSeconds",20,l):u<40?s.formatDistance("halfAMinute",0,l):u<60?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",1,l):m===0?s.formatDistance("lessThanXMinutes",1,l):s.formatDistance("xMinutes",m,l);if(m<45)return s.formatDistance("xMinutes",m,l);if(m<90)return s.formatDistance("aboutXHours",1,l);if(m<h$e){const p=Math.round(m/60);return s.formatDistance("aboutXHours",p,l)}else{if(m<i)return s.formatDistance("xDays",1,l);if(m<rz){const p=Math.round(m/h$e);return s.formatDistance("xDays",p,l)}else if(m<rz*2)return f=Math.round(m/rz),s.formatDistance("aboutXMonths",f,l)}if(f=Xan(d,c),f<12){const p=Math.round(m/rz);return s.formatDistance("xMonths",p,l)}else{const p=f%12,g=Math.trunc(f/12);return p<3?s.formatDistance("aboutXYears",g,l):p<9?s.formatDistance("overXYears",g,l):s.formatDistance("almostXYears",g+1,l)}}function h7(t,e){return qon(t,zut(t),e)}function Kon(t){return Nr(t).getDay()}function Yon(t){const e=Nr(t),n=e.getFullYear(),r=e.getMonth(),s=ta(t,0);return s.setFullYear(n,r+1,0),s.setHours(0,0,0,0),s.getDate()}function Qon(){return Object.assign({},vS())}function Zon(t){let n=Nr(t).getDay();return n===0&&(n=7),n}function Jon(t){return Math.trunc(+Nr(t)/1e3)}function Xon(t){const e=Nr(t),n=e.getMonth();return e.setFullYear(e.getFullYear(),n+1,0),e.setHours(0,0,0,0),e}function eln(t,e){return Kan(Xon(t),vc(t),e)+1}function Ege(t,e){const n=Nr(t),r=Nr(e);return n.getTime()>r.getTime()}function qut(t,e){const n=Nr(t),r=Nr(e);return+n<+r}function tln(t,e){const n=e instanceof Date?ta(e,0):new e(0);return n.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),n.setHours(t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds()),n}const nln=10;class Kut{constructor(){tn(this,"subPriority",0)}validate(e,n){return!0}}class rln extends Kut{constructor(e,n,r,s,i){super(),this.value=e,this.validateValue=n,this.setValue=r,this.priority=s,i&&(this.subPriority=i)}validate(e,n){return this.validateValue(e,this.value,n)}set(e,n,r){return this.setValue(e,n,this.value,r)}}class sln extends Kut{constructor(){super(...arguments);tn(this,"priority",nln);tn(this,"subPriority",-1)}set(n,r){return r.timestampIsSet?n:ta(n,tln(n,Date))}}let _i=class{run(e,n,r,s){const i=this.parse(e,n,r,s);return i?{setter:new rln(i.value,this.validate,this.set,this.priority,this.subPriority),rest:i.rest}:null}validate(e,n,r){return!0}};class iln extends _i{constructor(){super(...arguments);tn(this,"priority",140);tn(this,"incompatibleTokens",["R","u","t","T"])}parse(n,r,s){switch(r){case"G":case"GG":case"GGG":return s.era(n,{width:"abbreviated"})||s.era(n,{width:"narrow"});case"GGGGG":return s.era(n,{width:"narrow"});case"GGGG":default:return s.era(n,{width:"wide"})||s.era(n,{width:"abbreviated"})||s.era(n,{width:"narrow"})}}set(n,r,s){return r.era=s,n.setFullYear(s,0,1),n.setHours(0,0,0,0),n}}const jl={month:/^(1[0-2]|0?\d)/,date:/^(3[0-1]|[0-2]?\d)/,dayOfYear:/^(36[0-6]|3[0-5]\d|[0-2]?\d?\d)/,week:/^(5[0-3]|[0-4]?\d)/,hour23h:/^(2[0-3]|[0-1]?\d)/,hour24h:/^(2[0-4]|[0-1]?\d)/,hour11h:/^(1[0-1]|0?\d)/,hour12h:/^(1[0-2]|0?\d)/,minute:/^[0-5]?\d/,second:/^[0-5]?\d/,singleDigit:/^\d/,twoDigits:/^\d{1,2}/,threeDigits:/^\d{1,3}/,fourDigits:/^\d{1,4}/,anyDigitsSigned:/^-?\d+/,singleDigitSigned:/^-?\d/,twoDigitsSigned:/^-?\d{1,2}/,threeDigitsSigned:/^-?\d{1,3}/,fourDigitsSigned:/^-?\d{1,4}/},Wv={basicOptionalMinutes:/^([+-])(\d{2})(\d{2})?|Z/,basic:/^([+-])(\d{2})(\d{2})|Z/,basicOptionalSeconds:/^([+-])(\d{2})(\d{2})((\d{2}))?|Z/,extended:/^([+-])(\d{2}):(\d{2})|Z/,extendedOptionalSeconds:/^([+-])(\d{2}):(\d{2})(:(\d{2}))?|Z/};function El(t,e){return t&&{value:e(t.value),rest:t.rest}}function Do(t,e){const n=e.match(t);return n?{value:parseInt(n[0],10),rest:e.slice(n[0].length)}:null}function qv(t,e){const n=e.match(t);if(!n)return null;if(n[0]==="Z")return{value:0,rest:e.slice(1)};const r=n[1]==="+"?1:-1,s=n[2]?parseInt(n[2],10):0,i=n[3]?parseInt(n[3],10):0,o=n[5]?parseInt(n[5],10):0;return{value:r*(s*Zje+i*Qje+o*Uan),rest:e.slice(n[0].length)}}function Yut(t){return Do(jl.anyDigitsSigned,t)}function sl(t,e){switch(t){case 1:return Do(jl.singleDigit,e);case 2:return Do(jl.twoDigits,e);case 3:return Do(jl.threeDigits,e);case 4:return Do(jl.fourDigits,e);default:return Do(new RegExp("^\\d{1,"+t+"}"),e)}}function SY(t,e){switch(t){case 1:return Do(jl.singleDigitSigned,e);case 2:return Do(jl.twoDigitsSigned,e);case 3:return Do(jl.threeDigitsSigned,e);case 4:return Do(jl.fourDigitsSigned,e);default:return Do(new RegExp("^-?\\d{1,"+t+"}"),e)}}function s2e(t){switch(t){case"morning":return 4;case"evening":return 17;case"pm":case"noon":case"afternoon":return 12;case"am":case"midnight":case"night":default:return 0}}function Qut(t,e){const n=e>0,r=n?e:1-e;let s;if(r<=50)s=t||100;else{const i=r+50,o=Math.trunc(i/100)*100,l=t>=i%100;s=t+o-(l?100:0)}return n?s:1-s}function Zut(t){return t%400===0||t%4===0&&t%100!==0}class aln extends _i{constructor(){super(...arguments);tn(this,"priority",130);tn(this,"incompatibleTokens",["Y","R","u","w","I","i","e","c","t","T"])}parse(n,r,s){const i=o=>({year:o,isTwoDigitYear:r==="yy"});switch(r){case"y":return El(sl(4,n),i);case"yo":return El(s.ordinalNumber(n,{unit:"year"}),i);default:return El(sl(r.length,n),i)}}validate(n,r){return r.isTwoDigitYear||r.year>0}set(n,r,s){const i=n.getFullYear();if(s.isTwoDigitYear){const l=Qut(s.year,i);return n.setFullYear(l,0,1),n.setHours(0,0,0,0),n}const o=!("era"in r)||r.era===1?s.year:1-s.year;return n.setFullYear(o,0,1),n.setHours(0,0,0,0),n}}class oln extends _i{constructor(){super(...arguments);tn(this,"priority",130);tn(this,"incompatibleTokens",["y","R","u","Q","q","M","L","I","d","D","i","t","T"])}parse(n,r,s){const i=o=>({year:o,isTwoDigitYear:r==="YY"});switch(r){case"Y":return El(sl(4,n),i);case"Yo":return El(s.ordinalNumber(n,{unit:"year"}),i);default:return El(sl(r.length,n),i)}}validate(n,r){return r.isTwoDigitYear||r.year>0}set(n,r,s,i){const o=n2e(n,i);if(s.isTwoDigitYear){const c=Qut(s.year,o);return n.setFullYear(c,0,i.firstWeekContainsDate),n.setHours(0,0,0,0),Em(n,i)}const l=!("era"in r)||r.era===1?s.year:1-s.year;return n.setFullYear(l,0,i.firstWeekContainsDate),n.setHours(0,0,0,0),Em(n,i)}}class lln extends _i{constructor(){super(...arguments);tn(this,"priority",130);tn(this,"incompatibleTokens",["G","y","Y","u","Q","q","M","L","w","d","D","e","c","t","T"])}parse(n,r){return SY(r==="R"?4:r.length,n)}set(n,r,s){const i=ta(n,0);return i.setFullYear(s,0,4),i.setHours(0,0,0,0),Jx(i)}}class cln extends _i{constructor(){super(...arguments);tn(this,"priority",130);tn(this,"incompatibleTokens",["G","y","Y","R","w","I","i","e","c","t","T"])}parse(n,r){return SY(r==="u"?4:r.length,n)}set(n,r,s){return n.setFullYear(s,0,1),n.setHours(0,0,0,0),n}}class dln extends _i{constructor(){super(...arguments);tn(this,"priority",120);tn(this,"incompatibleTokens",["Y","R","q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,r,s){switch(r){case"Q":case"QQ":return sl(r.length,n);case"Qo":return s.ordinalNumber(n,{unit:"quarter"});case"QQQ":return s.quarter(n,{width:"abbreviated",context:"formatting"})||s.quarter(n,{width:"narrow",context:"formatting"});case"QQQQQ":return s.quarter(n,{width:"narrow",context:"formatting"});case"QQQQ":default:return s.quarter(n,{width:"wide",context:"formatting"})||s.quarter(n,{width:"abbreviated",context:"formatting"})||s.quarter(n,{width:"narrow",context:"formatting"})}}validate(n,r){return r>=1&&r<=4}set(n,r,s){return n.setMonth((s-1)*3,1),n.setHours(0,0,0,0),n}}class uln extends _i{constructor(){super(...arguments);tn(this,"priority",120);tn(this,"incompatibleTokens",["Y","R","Q","M","L","w","I","d","D","i","e","c","t","T"])}parse(n,r,s){switch(r){case"q":case"qq":return sl(r.length,n);case"qo":return s.ordinalNumber(n,{unit:"quarter"});case"qqq":return s.quarter(n,{width:"abbreviated",context:"standalone"})||s.quarter(n,{width:"narrow",context:"standalone"});case"qqqqq":return s.quarter(n,{width:"narrow",context:"standalone"});case"qqqq":default:return s.quarter(n,{width:"wide",context:"standalone"})||s.quarter(n,{width:"abbreviated",context:"standalone"})||s.quarter(n,{width:"narrow",context:"standalone"})}}validate(n,r){return r>=1&&r<=4}set(n,r,s){return n.setMonth((s-1)*3,1),n.setHours(0,0,0,0),n}}class hln extends _i{constructor(){super(...arguments);tn(this,"incompatibleTokens",["Y","R","q","Q","L","w","I","D","i","e","c","t","T"]);tn(this,"priority",110)}parse(n,r,s){const i=o=>o-1;switch(r){case"M":return El(Do(jl.month,n),i);case"MM":return El(sl(2,n),i);case"Mo":return El(s.ordinalNumber(n,{unit:"month"}),i);case"MMM":return s.month(n,{width:"abbreviated",context:"formatting"})||s.month(n,{width:"narrow",context:"formatting"});case"MMMMM":return s.month(n,{width:"narrow",context:"formatting"});case"MMMM":default:return s.month(n,{width:"wide",context:"formatting"})||s.month(n,{width:"abbreviated",context:"formatting"})||s.month(n,{width:"narrow",context:"formatting"})}}validate(n,r){return r>=0&&r<=11}set(n,r,s){return n.setMonth(s,1),n.setHours(0,0,0,0),n}}class mln extends _i{constructor(){super(...arguments);tn(this,"priority",110);tn(this,"incompatibleTokens",["Y","R","q","Q","M","w","I","D","i","e","c","t","T"])}parse(n,r,s){const i=o=>o-1;switch(r){case"L":return El(Do(jl.month,n),i);case"LL":return El(sl(2,n),i);case"Lo":return El(s.ordinalNumber(n,{unit:"month"}),i);case"LLL":return s.month(n,{width:"abbreviated",context:"standalone"})||s.month(n,{width:"narrow",context:"standalone"});case"LLLLL":return s.month(n,{width:"narrow",context:"standalone"});case"LLLL":default:return s.month(n,{width:"wide",context:"standalone"})||s.month(n,{width:"abbreviated",context:"standalone"})||s.month(n,{width:"narrow",context:"standalone"})}}validate(n,r){return r>=0&&r<=11}set(n,r,s){return n.setMonth(s,1),n.setHours(0,0,0,0),n}}function fln(t,e,n){const r=Nr(t),s=r2e(r,n)-e;return r.setDate(r.getDate()-s*7),r}class pln extends _i{constructor(){super(...arguments);tn(this,"priority",100);tn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","i","t","T"])}parse(n,r,s){switch(r){case"w":return Do(jl.week,n);case"wo":return s.ordinalNumber(n,{unit:"week"});default:return sl(r.length,n)}}validate(n,r){return r>=1&&r<=53}set(n,r,s,i){return Em(fln(n,s,i),i)}}function gln(t,e){const n=Nr(t),r=t2e(n)-e;return n.setDate(n.getDate()-r*7),n}class vln extends _i{constructor(){super(...arguments);tn(this,"priority",100);tn(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","e","c","t","T"])}parse(n,r,s){switch(r){case"I":return Do(jl.week,n);case"Io":return s.ordinalNumber(n,{unit:"week"});default:return sl(r.length,n)}}validate(n,r){return r>=1&&r<=53}set(n,r,s){return Jx(gln(n,s))}}const yln=[31,28,31,30,31,30,31,31,30,31,30,31],bln=[31,29,31,30,31,30,31,31,30,31,30,31];class xln extends _i{constructor(){super(...arguments);tn(this,"priority",90);tn(this,"subPriority",1);tn(this,"incompatibleTokens",["Y","R","q","Q","w","I","D","i","e","c","t","T"])}parse(n,r,s){switch(r){case"d":return Do(jl.date,n);case"do":return s.ordinalNumber(n,{unit:"date"});default:return sl(r.length,n)}}validate(n,r){const s=n.getFullYear(),i=Zut(s),o=n.getMonth();return i?r>=1&&r<=bln[o]:r>=1&&r<=yln[o]}set(n,r,s){return n.setDate(s),n.setHours(0,0,0,0),n}}class wln extends _i{constructor(){super(...arguments);tn(this,"priority",90);tn(this,"subpriority",1);tn(this,"incompatibleTokens",["Y","R","q","Q","M","L","w","I","d","E","i","e","c","t","T"])}parse(n,r,s){switch(r){case"D":case"DD":return Do(jl.dayOfYear,n);case"Do":return s.ordinalNumber(n,{unit:"date"});default:return sl(r.length,n)}}validate(n,r){const s=n.getFullYear();return Zut(s)?r>=1&&r<=366:r>=1&&r<=365}set(n,r,s){return n.setMonth(0,s),n.setHours(0,0,0,0),n}}function i2e(t,e,n){var h,m,f,p;const r=vS(),s=(n==null?void 0:n.weekStartsOn)??((m=(h=n==null?void 0:n.locale)==null?void 0:h.options)==null?void 0:m.weekStartsOn)??r.weekStartsOn??((p=(f=r.locale)==null?void 0:f.options)==null?void 0:p.weekStartsOn)??0,i=Nr(t),o=i.getDay(),c=(e%7+7)%7,d=7-s,u=e<0||e>6?e-(o+d)%7:(c+d)%7-(o+d)%7;return ld(i,u)}class kln extends _i{constructor(){super(...arguments);tn(this,"priority",90);tn(this,"incompatibleTokens",["D","i","e","c","t","T"])}parse(n,r,s){switch(r){case"E":case"EE":case"EEE":return s.day(n,{width:"abbreviated",context:"formatting"})||s.day(n,{width:"short",context:"formatting"})||s.day(n,{width:"narrow",context:"formatting"});case"EEEEE":return s.day(n,{width:"narrow",context:"formatting"});case"EEEEEE":return s.day(n,{width:"short",context:"formatting"})||s.day(n,{width:"narrow",context:"formatting"});case"EEEE":default:return s.day(n,{width:"wide",context:"formatting"})||s.day(n,{width:"abbreviated",context:"formatting"})||s.day(n,{width:"short",context:"formatting"})||s.day(n,{width:"narrow",context:"formatting"})}}validate(n,r){return r>=0&&r<=6}set(n,r,s,i){return n=i2e(n,s,i),n.setHours(0,0,0,0),n}}class Sln extends _i{constructor(){super(...arguments);tn(this,"priority",90);tn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","c","t","T"])}parse(n,r,s,i){const o=l=>{const c=Math.floor((l-1)/7)*7;return(l+i.weekStartsOn+6)%7+c};switch(r){case"e":case"ee":return El(sl(r.length,n),o);case"eo":return El(s.ordinalNumber(n,{unit:"day"}),o);case"eee":return s.day(n,{width:"abbreviated",context:"formatting"})||s.day(n,{width:"short",context:"formatting"})||s.day(n,{width:"narrow",context:"formatting"});case"eeeee":return s.day(n,{width:"narrow",context:"formatting"});case"eeeeee":return s.day(n,{width:"short",context:"formatting"})||s.day(n,{width:"narrow",context:"formatting"});case"eeee":default:return s.day(n,{width:"wide",context:"formatting"})||s.day(n,{width:"abbreviated",context:"formatting"})||s.day(n,{width:"short",context:"formatting"})||s.day(n,{width:"narrow",context:"formatting"})}}validate(n,r){return r>=0&&r<=6}set(n,r,s,i){return n=i2e(n,s,i),n.setHours(0,0,0,0),n}}class Cln extends _i{constructor(){super(...arguments);tn(this,"priority",90);tn(this,"incompatibleTokens",["y","R","u","q","Q","M","L","I","d","D","E","i","e","t","T"])}parse(n,r,s,i){const o=l=>{const c=Math.floor((l-1)/7)*7;return(l+i.weekStartsOn+6)%7+c};switch(r){case"c":case"cc":return El(sl(r.length,n),o);case"co":return El(s.ordinalNumber(n,{unit:"day"}),o);case"ccc":return s.day(n,{width:"abbreviated",context:"standalone"})||s.day(n,{width:"short",context:"standalone"})||s.day(n,{width:"narrow",context:"standalone"});case"ccccc":return s.day(n,{width:"narrow",context:"standalone"});case"cccccc":return s.day(n,{width:"short",context:"standalone"})||s.day(n,{width:"narrow",context:"standalone"});case"cccc":default:return s.day(n,{width:"wide",context:"standalone"})||s.day(n,{width:"abbreviated",context:"standalone"})||s.day(n,{width:"short",context:"standalone"})||s.day(n,{width:"narrow",context:"standalone"})}}validate(n,r){return r>=0&&r<=6}set(n,r,s,i){return n=i2e(n,s,i),n.setHours(0,0,0,0),n}}function jln(t,e){const n=Nr(t),r=Zon(n),s=e-r;return ld(n,s)}class Eln extends _i{constructor(){super(...arguments);tn(this,"priority",90);tn(this,"incompatibleTokens",["y","Y","u","q","Q","M","L","w","d","D","E","e","c","t","T"])}parse(n,r,s){const i=o=>o===0?7:o;switch(r){case"i":case"ii":return sl(r.length,n);case"io":return s.ordinalNumber(n,{unit:"day"});case"iii":return El(s.day(n,{width:"abbreviated",context:"formatting"})||s.day(n,{width:"short",context:"formatting"})||s.day(n,{width:"narrow",context:"formatting"}),i);case"iiiii":return El(s.day(n,{width:"narrow",context:"formatting"}),i);case"iiiiii":return El(s.day(n,{width:"short",context:"formatting"})||s.day(n,{width:"narrow",context:"formatting"}),i);case"iiii":default:return El(s.day(n,{width:"wide",context:"formatting"})||s.day(n,{width:"abbreviated",context:"formatting"})||s.day(n,{width:"short",context:"formatting"})||s.day(n,{width:"narrow",context:"formatting"}),i)}}validate(n,r){return r>=1&&r<=7}set(n,r,s){return n=jln(n,s),n.setHours(0,0,0,0),n}}class Nln extends _i{constructor(){super(...arguments);tn(this,"priority",80);tn(this,"incompatibleTokens",["b","B","H","k","t","T"])}parse(n,r,s){switch(r){case"a":case"aa":case"aaa":return s.dayPeriod(n,{width:"abbreviated",context:"formatting"})||s.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaaa":return s.dayPeriod(n,{width:"narrow",context:"formatting"});case"aaaa":default:return s.dayPeriod(n,{width:"wide",context:"formatting"})||s.dayPeriod(n,{width:"abbreviated",context:"formatting"})||s.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,r,s){return n.setHours(s2e(s),0,0,0),n}}class Tln extends _i{constructor(){super(...arguments);tn(this,"priority",80);tn(this,"incompatibleTokens",["a","B","H","k","t","T"])}parse(n,r,s){switch(r){case"b":case"bb":case"bbb":return s.dayPeriod(n,{width:"abbreviated",context:"formatting"})||s.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbbb":return s.dayPeriod(n,{width:"narrow",context:"formatting"});case"bbbb":default:return s.dayPeriod(n,{width:"wide",context:"formatting"})||s.dayPeriod(n,{width:"abbreviated",context:"formatting"})||s.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,r,s){return n.setHours(s2e(s),0,0,0),n}}class _ln extends _i{constructor(){super(...arguments);tn(this,"priority",80);tn(this,"incompatibleTokens",["a","b","t","T"])}parse(n,r,s){switch(r){case"B":case"BB":case"BBB":return s.dayPeriod(n,{width:"abbreviated",context:"formatting"})||s.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBBB":return s.dayPeriod(n,{width:"narrow",context:"formatting"});case"BBBB":default:return s.dayPeriod(n,{width:"wide",context:"formatting"})||s.dayPeriod(n,{width:"abbreviated",context:"formatting"})||s.dayPeriod(n,{width:"narrow",context:"formatting"})}}set(n,r,s){return n.setHours(s2e(s),0,0,0),n}}class Aln extends _i{constructor(){super(...arguments);tn(this,"priority",70);tn(this,"incompatibleTokens",["H","K","k","t","T"])}parse(n,r,s){switch(r){case"h":return Do(jl.hour12h,n);case"ho":return s.ordinalNumber(n,{unit:"hour"});default:return sl(r.length,n)}}validate(n,r){return r>=1&&r<=12}set(n,r,s){const i=n.getHours()>=12;return i&&s<12?n.setHours(s+12,0,0,0):!i&&s===12?n.setHours(0,0,0,0):n.setHours(s,0,0,0),n}}class Pln extends _i{constructor(){super(...arguments);tn(this,"priority",70);tn(this,"incompatibleTokens",["a","b","h","K","k","t","T"])}parse(n,r,s){switch(r){case"H":return Do(jl.hour23h,n);case"Ho":return s.ordinalNumber(n,{unit:"hour"});default:return sl(r.length,n)}}validate(n,r){return r>=0&&r<=23}set(n,r,s){return n.setHours(s,0,0,0),n}}class Rln extends _i{constructor(){super(...arguments);tn(this,"priority",70);tn(this,"incompatibleTokens",["h","H","k","t","T"])}parse(n,r,s){switch(r){case"K":return Do(jl.hour11h,n);case"Ko":return s.ordinalNumber(n,{unit:"hour"});default:return sl(r.length,n)}}validate(n,r){return r>=0&&r<=11}set(n,r,s){return n.getHours()>=12&&s<12?n.setHours(s+12,0,0,0):n.setHours(s,0,0,0),n}}class Iln extends _i{constructor(){super(...arguments);tn(this,"priority",70);tn(this,"incompatibleTokens",["a","b","h","H","K","t","T"])}parse(n,r,s){switch(r){case"k":return Do(jl.hour24h,n);case"ko":return s.ordinalNumber(n,{unit:"hour"});default:return sl(r.length,n)}}validate(n,r){return r>=1&&r<=24}set(n,r,s){const i=s<=24?s%24:s;return n.setHours(i,0,0,0),n}}class Mln extends _i{constructor(){super(...arguments);tn(this,"priority",60);tn(this,"incompatibleTokens",["t","T"])}parse(n,r,s){switch(r){case"m":return Do(jl.minute,n);case"mo":return s.ordinalNumber(n,{unit:"minute"});default:return sl(r.length,n)}}validate(n,r){return r>=0&&r<=59}set(n,r,s){return n.setMinutes(s,0,0),n}}class Lln extends _i{constructor(){super(...arguments);tn(this,"priority",50);tn(this,"incompatibleTokens",["t","T"])}parse(n,r,s){switch(r){case"s":return Do(jl.second,n);case"so":return s.ordinalNumber(n,{unit:"second"});default:return sl(r.length,n)}}validate(n,r){return r>=0&&r<=59}set(n,r,s){return n.setSeconds(s,0),n}}class Dln extends _i{constructor(){super(...arguments);tn(this,"priority",30);tn(this,"incompatibleTokens",["t","T"])}parse(n,r){const s=i=>Math.trunc(i*Math.pow(10,-r.length+3));return El(sl(r.length,n),s)}set(n,r,s){return n.setMilliseconds(s),n}}class $ln extends _i{constructor(){super(...arguments);tn(this,"priority",10);tn(this,"incompatibleTokens",["t","T","x"])}parse(n,r){switch(r){case"X":return qv(Wv.basicOptionalMinutes,n);case"XX":return qv(Wv.basic,n);case"XXXX":return qv(Wv.basicOptionalSeconds,n);case"XXXXX":return qv(Wv.extendedOptionalSeconds,n);case"XXX":default:return qv(Wv.extended,n)}}set(n,r,s){return r.timestampIsSet?n:ta(n,n.getTime()-Ik(n)-s)}}class Oln extends _i{constructor(){super(...arguments);tn(this,"priority",10);tn(this,"incompatibleTokens",["t","T","X"])}parse(n,r){switch(r){case"x":return qv(Wv.basicOptionalMinutes,n);case"xx":return qv(Wv.basic,n);case"xxxx":return qv(Wv.basicOptionalSeconds,n);case"xxxxx":return qv(Wv.extendedOptionalSeconds,n);case"xxx":default:return qv(Wv.extended,n)}}set(n,r,s){return r.timestampIsSet?n:ta(n,n.getTime()-Ik(n)-s)}}class Fln extends _i{constructor(){super(...arguments);tn(this,"priority",40);tn(this,"incompatibleTokens","*")}parse(n){return Yut(n)}set(n,r,s){return[ta(n,s*1e3),{timestampIsSet:!0}]}}class Bln extends _i{constructor(){super(...arguments);tn(this,"priority",20);tn(this,"incompatibleTokens","*")}parse(n){return Yut(n)}set(n,r,s){return[ta(n,s),{timestampIsSet:!0}]}}const Uln={G:new iln,y:new aln,Y:new oln,R:new lln,u:new cln,Q:new dln,q:new uln,M:new hln,L:new mln,w:new pln,I:new vln,d:new xln,D:new wln,E:new kln,e:new Sln,c:new Cln,i:new Eln,a:new Nln,b:new Tln,B:new _ln,h:new Aln,H:new Pln,K:new Rln,k:new Iln,m:new Mln,s:new Lln,S:new Dln,X:new $ln,x:new Oln,t:new Fln,T:new Bln},zln=/[yYQqMLwIdDecihHKkms]o|(\w)\1*|''|'(''|[^'])+('|$)|./g,Vln=/P+p+|P+|p+|''|'(''|[^'])+('|$)|./g,Hln=/^'([^]*?)'?$/,Gln=/''/g,Wln=/\S/,qln=/[a-zA-Z]/;function Kln(t,e,n,r){var g,v,b,x,w,k,S,C;const s=Qon(),i=(r==null?void 0:r.locale)??s.locale??u7,o=(r==null?void 0:r.firstWeekContainsDate)??((v=(g=r==null?void 0:r.locale)==null?void 0:g.options)==null?void 0:v.firstWeekContainsDate)??s.firstWeekContainsDate??((x=(b=s.locale)==null?void 0:b.options)==null?void 0:x.firstWeekContainsDate)??1,l=(r==null?void 0:r.weekStartsOn)??((k=(w=r==null?void 0:r.locale)==null?void 0:w.options)==null?void 0:k.weekStartsOn)??s.weekStartsOn??((C=(S=s.locale)==null?void 0:S.options)==null?void 0:C.weekStartsOn)??0;if(e==="")return t===""?Nr(n):ta(n,NaN);const c={firstWeekContainsDate:o,weekStartsOn:l,locale:i},d=[new sln],u=e.match(Vln).map(j=>{const E=j[0];if(E in Cge){const N=Cge[E];return N(j,i.formatLong)}return j}).join("").match(zln),h=[];for(let j of u){!(r!=null&&r.useAdditionalWeekYearTokens)&&Wut(j)&&jge(j,e,t),!(r!=null&&r.useAdditionalDayOfYearTokens)&&Gut(j)&&jge(j,e,t);const E=j[0],N=Uln[E];if(N){const{incompatibleTokens:A}=N;if(Array.isArray(A)){const T=h.find(R=>A.includes(R.token)||R.token===E);if(T)throw new RangeError(`The format string mustn't contain \`${T.fullToken}\` and \`${j}\` at the same time`)}else if(N.incompatibleTokens==="*"&&h.length>0)throw new RangeError(`The format string mustn't contain \`${j}\` and any other token at the same time`);h.push({token:E,fullToken:j});const _=N.run(t,j,i.match,c);if(!_)return ta(n,NaN);d.push(_.setter),t=_.rest}else{if(E.match(qln))throw new RangeError("Format string contains an unescaped latin alphabet character `"+E+"`");if(j==="''"?j="'":E==="'"&&(j=Yln(j)),t.indexOf(j)===0)t=t.slice(j.length);else return ta(n,NaN)}}if(t.length>0&&Wln.test(t))return ta(n,NaN);const m=d.map(j=>j.priority).sort((j,E)=>E-j).filter((j,E,N)=>N.indexOf(j)===E).map(j=>d.filter(E=>E.priority===j).sort((E,N)=>N.subPriority-E.subPriority)).map(j=>j[0]);let f=Nr(n);if(isNaN(f.getTime()))return ta(n,NaN);const p={};for(const j of m){if(!j.validate(f,c))return ta(n,NaN);const E=j.set(f,p,c);Array.isArray(E)?(f=E[0],Object.assign(p,E[1])):f=E}return ta(n,f)}function Yln(t){return t.match(Hln)[1].replace(Gln,"'")}function gte(t,e){const n=Nr(t),r=Nr(e);return n.getFullYear()===r.getFullYear()&&n.getMonth()===r.getMonth()}function Nge(t,e){const n=Nr(t),r=Nr(e);return n.getFullYear()===r.getFullYear()}function Qln(t){return Gd(t,zut(t))}function ID(t,e){return ld(t,-e)}function Jut(t,e){const r=ecn(t);let s;if(r.date){const c=tcn(r.date,2);s=ncn(c.restDateString,c.year)}if(!s||isNaN(s.getTime()))return new Date(NaN);const i=s.getTime();let o=0,l;if(r.time&&(o=rcn(r.time),isNaN(o)))return new Date(NaN);if(r.timezone){if(l=scn(r.timezone),isNaN(l))return new Date(NaN)}else{const c=new Date(i+o),d=new Date(0);return d.setFullYear(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate()),d.setHours(c.getUTCHours(),c.getUTCMinutes(),c.getUTCSeconds(),c.getUTCMilliseconds()),d}return new Date(i+o+l)}const sz={dateTimeDelimiter:/[T ]/,timeZoneDelimiter:/[Z ]/i,timezone:/([Z+-].*)$/},Zln=/^-?(?:(\d{3})|(\d{2})(?:-?(\d{2}))?|W(\d{2})(?:-?(\d{1}))?|)$/,Jln=/^(\d{2}(?:[.,]\d*)?)(?::?(\d{2}(?:[.,]\d*)?))?(?::?(\d{2}(?:[.,]\d*)?))?$/,Xln=/^([+-])(\d{2})(?::?(\d{2}))?$/;function ecn(t){const e={},n=t.split(sz.dateTimeDelimiter);let r;if(n.length>2)return e;if(/:/.test(n[0])?r=n[0]:(e.date=n[0],r=n[1],sz.timeZoneDelimiter.test(e.date)&&(e.date=t.split(sz.timeZoneDelimiter)[0],r=t.substr(e.date.length,t.length))),r){const s=sz.timezone.exec(r);s?(e.time=r.replace(s[1],""),e.timezone=s[1]):e.time=r}return e}function tcn(t,e){const n=new RegExp("^(?:(\\d{4}|[+-]\\d{"+(4+e)+"})|(\\d{2}|[+-]\\d{"+(2+e)+"})$)"),r=t.match(n);if(!r)return{year:NaN,restDateString:""};const s=r[1]?parseInt(r[1]):null,i=r[2]?parseInt(r[2]):null;return{year:i===null?s:i*100,restDateString:t.slice((r[1]||r[2]).length)}}function ncn(t,e){if(e===null)return new Date(NaN);const n=t.match(Zln);if(!n)return new Date(NaN);const r=!!n[4],s=LL(n[1]),i=LL(n[2])-1,o=LL(n[3]),l=LL(n[4]),c=LL(n[5])-1;if(r)return ccn(e,l,c)?icn(e,l,c):new Date(NaN);{const d=new Date(0);return!ocn(e,i,o)||!lcn(e,s)?new Date(NaN):(d.setUTCFullYear(e,i,Math.max(s,o)),d)}}function LL(t){return t?parseInt(t):1}function rcn(t){const e=t.match(Jln);if(!e)return NaN;const n=cle(e[1]),r=cle(e[2]),s=cle(e[3]);return dcn(n,r,s)?n*Zje+r*Qje+s*1e3:NaN}function cle(t){return t&&parseFloat(t.replace(",","."))||0}function scn(t){if(t==="Z")return 0;const e=t.match(Xln);if(!e)return 0;const n=e[1]==="+"?-1:1,r=parseInt(e[2]),s=e[3]&&parseInt(e[3])||0;return ucn(r,s)?n*(r*Zje+s*Qje):NaN}function icn(t,e,n){const r=new Date(0);r.setUTCFullYear(t,0,4);const s=r.getUTCDay()||7,i=(e-1)*7+n+1-s;return r.setUTCDate(r.getUTCDate()+i),r}const acn=[31,null,31,30,31,30,31,31,30,31,30,31];function Xut(t){return t%400===0||t%4===0&&t%100!==0}function ocn(t,e,n){return e>=0&&e<=11&&n>=1&&n<=(acn[e]||(Xut(t)?29:28))}function lcn(t,e){return e>=1&&e<=(Xut(t)?366:365)}function ccn(t,e,n){return e>=1&&e<=53&&n>=0&&n<=6}function dcn(t,e,n){return t===24?e===0&&n===0:n>=0&&n<60&&e>=0&&e<60&&t>=0&&t<25}function ucn(t,e){return e>=0&&e<=59}function dle(t,e){const n=Nr(t),r=n.getFullYear(),s=n.getDate(),i=ta(t,0);i.setFullYear(r,e,15),i.setHours(0,0,0,0);const o=Yon(i);return n.setMonth(e,Math.min(s,o)),n}function v$e(t,e){const n=Nr(t);return isNaN(+n)?ta(t,NaN):(n.setFullYear(e),n)}function Tge(t,e){return Uf(t,-e)}function vte(t,e){const n=new Date(t),r=new Date(e);return Number.isNaN(n.getTime())||Number.isNaN(r.getTime())?"":n.getTime()===r.getTime()?fo(n,"d MMMM, yyyy, h:mm a"):Gd(n,r)?`${fo(n,"d MMMM, yyyy")}, ${fo(n,"h:mm a")} – ${fo(r,"h:mm a")}`:Nge(n,r)&&gte(n,r)?`${fo(n,"d MMM, h:mm a")} – ${fo(r,"d MMM, yyyy, h:mm a")}`:Nge(n,r)?`${fo(n,"d MMM, h:mm a")} – ${fo(r,"d MMM, yyyy, h:mm a")}`:`${fo(n,"d MMM, yyyy, h:mm a")} – ${fo(r,"d MMM, yyyy, h:mm a")}`}function _ge(t,e,n=!1,r=Date.now()){const s=new Date(t).getTime(),i=new Date(e).getTime();return Number.isNaN(s)||Number.isNaN(i)?n?"ended":null:r<s?"upcoming":n||r>i?"ended":"live"}function hcn(t,e=Date.now()){const n=new Date(t).getTime();if(Number.isNaN(n)||n<=e)return"";const r=Math.ceil((n-e)/1e3),s=Math.floor(r/86400),i=Math.floor(r%86400/3600),o=Math.floor(r%3600/60),l=r%60,c=d=>String(d).padStart(2,"0");return s>0?`in ${s} ${s===1?"day":"days"} ${i}h ${c(o)}m`:i>0?`in ${i}h ${c(o)}m ${c(l)}s`:o>0?`in ${o}m ${c(l)}s`:`in ${l} ${l===1?"second":"seconds"}`}function mcn(t){const e=s=>new Date(s).toISOString().replace(/[-:]/g,"").replace(/\.\d{3}/,""),n=[t.description||"",t.meetingUrl?`

Join here: ${t.meetingUrl}`:""].join("").trim(),r=new URLSearchParams({action:"TEMPLATE",dates:`${e(t.startTime)}/${e(t.endTime)}`,text:t.title,details:n});return t.location&&r.set("location",t.location),t.timezone&&r.set("ctz",t.timezone),`https://www.google.com/calendar/render?${r.toString()}`}function a2e({communityId:t,eventId:e,className:n}){const[r,s]=y.useState(!1),[i,o]=y.useState(""),[l,c]=y.useState(!1),d=async()=>{s(!0);try{const{token:h}=await Dan(t,e);o(`${window.location.origin}/guest-event#invite=${h}`),c(!0)}catch(h){He.error(Dt(h,"Couldn't create guest invitation."))}finally{s(!1)}},u=async()=>{try{await navigator.clipboard.writeText(i),He.success("Guest invitation copied")}catch{He.error("Couldn't copy. Select the link and copy it manually.")}};return a.jsxs(a.Fragment,{children:[a.jsxs(Z,{variant:"outline",size:"sm",className:n,disabled:r,onClick:()=>void d(),children:[r?a.jsx(Ne,{className:"h-4 w-4 mr-2 animate-spin"}):a.jsx(Sa,{className:"h-4 w-4 mr-2"})," Invite guest"]}),a.jsx(Bt,{open:l,onOpenChange:c,children:a.jsxs(Ft,{children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Invite guests to this event"}),a.jsx(_n,{children:"Share this link with your guests. They will enter the event passcode, if set, followed by their name and email. Anyone you share the link with can use it."})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Oe,{"aria-label":"Guest invitation link",value:i,readOnly:!0,onFocus:h=>h.target.select()}),a.jsx(Z,{"aria-label":"Copy guest invitation",onClick:()=>void u(),children:a.jsx(Zl,{className:"h-4 w-4"})})]})]})})]})}const o2e=y.createContext({});function l2e(t){const e=y.useRef(null);return e.current===null&&(e.current=t()),e.current}const eht=typeof window<"u",tht=eht?y.useLayoutEffect:y.useEffect,yte=y.createContext(null);function c2e(t,e){t.indexOf(e)===-1&&t.push(e)}function CY(t,e){const n=t.indexOf(e);n>-1&&t.splice(n,1)}const Ny=(t,e,n)=>n>e?e:n<t?t:n;let bte=()=>{},mR=()=>{};const Xx={},nht=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function rht(t){return typeof t=="object"&&t!==null}const sht=t=>/^0[^.\s]+$/u.test(t);function iht(t){let e;return()=>(e===void 0&&(e=t()),e)}const Af=t=>t,fcn=(t,e)=>n=>e(t(n)),m7=(...t)=>t.reduce(fcn),WO=(t,e,n)=>{const r=e-t;return r===0?1:(n-t)/r};class d2e{constructor(){this.subscriptions=[]}add(e){return c2e(this.subscriptions,e),()=>CY(this.subscriptions,e)}notify(e,n,r){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](e,n,r);else for(let i=0;i<s;i++){const o=this.subscriptions[i];o&&o(e,n,r)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Pf=t=>t*1e3,Sf=t=>t/1e3;function aht(t,e){return e?t*(1e3/e):0}const oht=(t,e,n)=>(((1-3*n+3*e)*t+(3*n-6*e))*t+3*e)*t,pcn=1e-7,gcn=12;function vcn(t,e,n,r,s){let i,o,l=0;do o=e+(n-e)/2,i=oht(o,r,s)-t,i>0?n=o:e=o;while(Math.abs(i)>pcn&&++l<gcn);return o}function f7(t,e,n,r){if(t===e&&n===r)return Af;const s=i=>vcn(i,0,1,t,n);return i=>i===0||i===1?i:oht(s(i),e,r)}const lht=t=>e=>e<=.5?t(2*e)/2:(2-t(2*(1-e)))/2,cht=t=>e=>1-t(1-e),dht=f7(.33,1.53,.69,.99),u2e=cht(dht),uht=lht(u2e),hht=t=>(t*=2)<1?.5*u2e(t):.5*(2-Math.pow(2,-10*(t-1))),h2e=t=>1-Math.sin(Math.acos(t)),mht=cht(h2e),fht=lht(h2e),ycn=f7(.42,0,1,1),bcn=f7(0,0,.58,1),pht=f7(.42,0,.58,1),xcn=t=>Array.isArray(t)&&typeof t[0]!="number",ght=t=>Array.isArray(t)&&typeof t[0]=="number",y$e={linear:Af,easeIn:ycn,easeInOut:pht,easeOut:bcn,circIn:h2e,circInOut:fht,circOut:mht,backIn:u2e,backInOut:uht,backOut:dht,anticipate:hht},wcn=t=>typeof t=="string",b$e=t=>{if(ght(t)){mR(t.length===4,"Cubic bezier arrays must contain four numerical values.","cubic-bezier-length");const[e,n,r,s]=t;return f7(e,n,r,s)}else if(wcn(t))return mR(y$e[t]!==void 0,`Invalid easing type '${t}'`,"invalid-easing-type"),y$e[t];return t},iz=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"],x$e={value:null,addProjectionMetrics:null};function kcn(t,e){let n=new Set,r=new Set,s=!1,i=!1;const o=new WeakSet;let l={delta:0,timestamp:0,isProcessing:!1},c=0;function d(h){o.has(h)&&(u.schedule(h),t()),c++,h(l)}const u={schedule:(h,m=!1,f=!1)=>{const g=f&&s?n:r;return m&&o.add(h),g.has(h)||g.add(h),h},cancel:h=>{r.delete(h),o.delete(h)},process:h=>{if(l=h,s){i=!0;return}s=!0,[n,r]=[r,n],n.forEach(d),e&&x$e.value&&x$e.value.frameloop[e].push(c),c=0,n.clear(),s=!1,i&&(i=!1,u.process(h))}};return u}const Scn=40;function vht(t,e){let n=!1,r=!0;const s={delta:0,timestamp:0,isProcessing:!1},i=()=>n=!0,o=iz.reduce((w,k)=>(w[k]=kcn(i,e?k:void 0),w),{}),{setup:l,read:c,resolveKeyframes:d,preUpdate:u,update:h,preRender:m,render:f,postRender:p}=o,g=()=>{const w=Xx.useManualTiming?s.timestamp:performance.now();n=!1,Xx.useManualTiming||(s.delta=r?1e3/60:Math.max(Math.min(w-s.timestamp,Scn),1)),s.timestamp=w,s.isProcessing=!0,l.process(s),c.process(s),d.process(s),u.process(s),h.process(s),m.process(s),f.process(s),p.process(s),s.isProcessing=!1,n&&e&&(r=!1,t(g))},v=()=>{n=!0,r=!0,s.isProcessing||t(g)};return{schedule:iz.reduce((w,k)=>{const S=o[k];return w[k]=(C,j=!1,E=!1)=>(n||v(),S.schedule(C,j,E)),w},{}),cancel:w=>{for(let k=0;k<iz.length;k++)o[iz[k]].cancel(w)},state:s,steps:o}}const{schedule:Da,cancel:Mk,state:id,steps:ule}=vht(typeof requestAnimationFrame<"u"?requestAnimationFrame:Af,!0);let _G;function Ccn(){_G=void 0}const Eu={now:()=>(_G===void 0&&Eu.set(id.isProcessing||Xx.useManualTiming?id.timestamp:performance.now()),_G),set:t=>{_G=t,queueMicrotask(Ccn)}},yht=t=>e=>typeof e=="string"&&e.startsWith(t),bht=yht("--"),jcn=yht("var(--"),m2e=t=>jcn(t)?Ecn.test(t.split("/*")[0].trim()):!1,Ecn=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;function w$e(t){return typeof t!="string"?!1:t.split("/*")[0].includes("var(--")}const kI={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},qO={...kI,transform:t=>Ny(0,1,t)},az={...kI,default:1},MD=t=>Math.round(t*1e5)/1e5,f2e=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Ncn(t){return t==null}const Tcn=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,p2e=(t,e)=>n=>!!(typeof n=="string"&&Tcn.test(n)&&n.startsWith(t)||e&&!Ncn(n)&&Object.prototype.hasOwnProperty.call(n,e)),xht=(t,e,n)=>r=>{if(typeof r!="string")return r;const[s,i,o,l]=r.match(f2e);return{[t]:parseFloat(s),[e]:parseFloat(i),[n]:parseFloat(o),alpha:l!==void 0?parseFloat(l):1}},_cn=t=>Ny(0,255,t),hle={...kI,transform:t=>Math.round(_cn(t))},bj={test:p2e("rgb","red"),parse:xht("red","green","blue"),transform:({red:t,green:e,blue:n,alpha:r=1})=>"rgba("+hle.transform(t)+", "+hle.transform(e)+", "+hle.transform(n)+", "+MD(qO.transform(r))+")"};function Acn(t){let e="",n="",r="",s="";return t.length>5?(e=t.substring(1,3),n=t.substring(3,5),r=t.substring(5,7),s=t.substring(7,9)):(e=t.substring(1,2),n=t.substring(2,3),r=t.substring(3,4),s=t.substring(4,5),e+=e,n+=n,r+=r,s+=s),{red:parseInt(e,16),green:parseInt(n,16),blue:parseInt(r,16),alpha:s?parseInt(s,16)/255:1}}const Age={test:p2e("#"),parse:Acn,transform:bj.transform},p7=t=>({test:e=>typeof e=="string"&&e.endsWith(t)&&e.split(" ").length===1,parse:parseFloat,transform:e=>`${e}${t}`}),xw=p7("deg"),fy=p7("%"),ar=p7("px"),Pcn=p7("vh"),Rcn=p7("vw"),k$e={...fy,parse:t=>fy.parse(t)/100,transform:t=>fy.transform(t*100)},iA={test:p2e("hsl","hue"),parse:xht("hue","saturation","lightness"),transform:({hue:t,saturation:e,lightness:n,alpha:r=1})=>"hsla("+Math.round(t)+", "+fy.transform(MD(e))+", "+fy.transform(MD(n))+", "+MD(qO.transform(r))+")"},Wl={test:t=>bj.test(t)||Age.test(t)||iA.test(t),parse:t=>bj.test(t)?bj.parse(t):iA.test(t)?iA.parse(t):Age.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?bj.transform(t):iA.transform(t),getAnimatableNone:t=>{const e=Wl.parse(t);return e.alpha=0,Wl.transform(e)}},Icn=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Mcn(t){var e,n;return isNaN(t)&&typeof t=="string"&&(((e=t.match(f2e))==null?void 0:e.length)||0)+(((n=t.match(Icn))==null?void 0:n.length)||0)>0}const wht="number",kht="color",Lcn="var",Dcn="var(",S$e="${}",$cn=/var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;function KO(t){const e=t.toString(),n=[],r={color:[],number:[],var:[]},s=[];let i=0;const l=e.replace($cn,c=>(Wl.test(c)?(r.color.push(i),s.push(kht),n.push(Wl.parse(c))):c.startsWith(Dcn)?(r.var.push(i),s.push(Lcn),n.push(c)):(r.number.push(i),s.push(wht),n.push(parseFloat(c))),++i,S$e)).split(S$e);return{values:n,split:l,indexes:r,types:s}}function Sht(t){return KO(t).values}function Cht(t){const{split:e,types:n}=KO(t),r=e.length;return s=>{let i="";for(let o=0;o<r;o++)if(i+=e[o],s[o]!==void 0){const l=n[o];l===wht?i+=MD(s[o]):l===kht?i+=Wl.transform(s[o]):i+=s[o]}return i}}const Ocn=t=>typeof t=="number"?0:Wl.test(t)?Wl.getAnimatableNone(t):t;function Fcn(t){const e=Sht(t);return Cht(t)(e.map(Ocn))}const Sg={test:Mcn,parse:Sht,createTransformer:Cht,getAnimatableNone:Fcn};function mle(t,e,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?t+(e-t)*6*n:n<1/2?e:n<2/3?t+(e-t)*(2/3-n)*6:t}function Bcn({hue:t,saturation:e,lightness:n,alpha:r}){t/=360,e/=100,n/=100;let s=0,i=0,o=0;if(!e)s=i=o=n;else{const l=n<.5?n*(1+e):n+e-n*e,c=2*n-l;s=mle(c,l,t+1/3),i=mle(c,l,t),o=mle(c,l,t-1/3)}return{red:Math.round(s*255),green:Math.round(i*255),blue:Math.round(o*255),alpha:r}}function jY(t,e){return n=>n>0?e:t}const $o=(t,e,n)=>t+(e-t)*n,fle=(t,e,n)=>{const r=t*t,s=n*(e*e-r)+r;return s<0?0:Math.sqrt(s)},Ucn=[Age,bj,iA],zcn=t=>Ucn.find(e=>e.test(t));function C$e(t){const e=zcn(t);if(bte(!!e,`'${t}' is not an animatable color. Use the equivalent color code instead.`,"color-not-animatable"),!e)return!1;let n=e.parse(t);return e===iA&&(n=Bcn(n)),n}const j$e=(t,e)=>{const n=C$e(t),r=C$e(e);if(!n||!r)return jY(t,e);const s={...n};return i=>(s.red=fle(n.red,r.red,i),s.green=fle(n.green,r.green,i),s.blue=fle(n.blue,r.blue,i),s.alpha=$o(n.alpha,r.alpha,i),bj.transform(s))},Pge=new Set(["none","hidden"]);function Vcn(t,e){return Pge.has(t)?n=>n<=0?t:e:n=>n>=1?e:t}function Hcn(t,e){return n=>$o(t,e,n)}function g2e(t){return typeof t=="number"?Hcn:typeof t=="string"?m2e(t)?jY:Wl.test(t)?j$e:qcn:Array.isArray(t)?jht:typeof t=="object"?Wl.test(t)?j$e:Gcn:jY}function jht(t,e){const n=[...t],r=n.length,s=t.map((i,o)=>g2e(i)(i,e[o]));return i=>{for(let o=0;o<r;o++)n[o]=s[o](i);return n}}function Gcn(t,e){const n={...t,...e},r={};for(const s in n)t[s]!==void 0&&e[s]!==void 0&&(r[s]=g2e(t[s])(t[s],e[s]));return s=>{for(const i in r)n[i]=r[i](s);return n}}function Wcn(t,e){const n=[],r={color:0,var:0,number:0};for(let s=0;s<e.values.length;s++){const i=e.types[s],o=t.indexes[i][r[i]],l=t.values[o]??0;n[s]=l,r[i]++}return n}const qcn=(t,e)=>{const n=Sg.createTransformer(e),r=KO(t),s=KO(e);return r.indexes.var.length===s.indexes.var.length&&r.indexes.color.length===s.indexes.color.length&&r.indexes.number.length>=s.indexes.number.length?Pge.has(t)&&!s.values.length||Pge.has(e)&&!r.values.length?Vcn(t,e):m7(jht(Wcn(r,s),s.values),n):(bte(!0,`Complex values '${t}' and '${e}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`,"complex-values-different"),jY(t,e))};function Eht(t,e,n){return typeof t=="number"&&typeof e=="number"&&typeof n=="number"?$o(t,e,n):g2e(t)(t,e)}const Kcn=t=>{const e=({timestamp:n})=>t(n);return{start:(n=!0)=>Da.update(e,n),stop:()=>Mk(e),now:()=>id.isProcessing?id.timestamp:Eu.now()}},Nht=(t,e,n=10)=>{let r="";const s=Math.max(Math.round(e/n),2);for(let i=0;i<s;i++)r+=Math.round(t(i/(s-1))*1e4)/1e4+", ";return`linear(${r.substring(0,r.length-2)})`},EY=2e4;function v2e(t){let e=0;const n=50;let r=t.next(e);for(;!r.done&&e<EY;)e+=n,r=t.next(e);return e>=EY?1/0:e}function Ycn(t,e=100,n){const r=n({...t,keyframes:[0,e]}),s=Math.min(v2e(r),EY);return{type:"keyframes",ease:i=>r.next(s*i).value/e,duration:Sf(s)}}const Qcn=5;function Tht(t,e,n){const r=Math.max(e-Qcn,0);return aht(n-t(r),e-r)}const Ao={stiffness:100,damping:10,mass:1,velocity:0,duration:800,bounce:.3,visualDuration:.3,restSpeed:{granular:.01,default:2},restDelta:{granular:.005,default:.5},minDuration:.01,maxDuration:10,minDamping:.05,maxDamping:1},ple=.001;function Zcn({duration:t=Ao.duration,bounce:e=Ao.bounce,velocity:n=Ao.velocity,mass:r=Ao.mass}){let s,i;bte(t<=Pf(Ao.maxDuration),"Spring duration must be 10 seconds or less","spring-duration-limit");let o=1-e;o=Ny(Ao.minDamping,Ao.maxDamping,o),t=Ny(Ao.minDuration,Ao.maxDuration,Sf(t)),o<1?(s=d=>{const u=d*o,h=u*t,m=u-n,f=Rge(d,o),p=Math.exp(-h);return ple-m/f*p},i=d=>{const h=d*o*t,m=h*n+n,f=Math.pow(o,2)*Math.pow(d,2)*t,p=Math.exp(-h),g=Rge(Math.pow(d,2),o);return(-s(d)+ple>0?-1:1)*((m-f)*p)/g}):(s=d=>{const u=Math.exp(-d*t),h=(d-n)*t+1;return-ple+u*h},i=d=>{const u=Math.exp(-d*t),h=(n-d)*(t*t);return u*h});const l=5/t,c=Xcn(s,i,l);if(t=Pf(t),isNaN(c))return{stiffness:Ao.stiffness,damping:Ao.damping,duration:t};{const d=Math.pow(c,2)*r;return{stiffness:d,damping:o*2*Math.sqrt(r*d),duration:t}}}const Jcn=12;function Xcn(t,e,n){let r=n;for(let s=1;s<Jcn;s++)r=r-t(r)/e(r);return r}function Rge(t,e){return t*Math.sqrt(1-e*e)}const edn=["duration","bounce"],tdn=["stiffness","damping","mass"];function E$e(t,e){return e.some(n=>t[n]!==void 0)}function ndn(t){let e={velocity:Ao.velocity,stiffness:Ao.stiffness,damping:Ao.damping,mass:Ao.mass,isResolvedFromDuration:!1,...t};if(!E$e(t,tdn)&&E$e(t,edn))if(t.visualDuration){const n=t.visualDuration,r=2*Math.PI/(n*1.2),s=r*r,i=2*Ny(.05,1,1-(t.bounce||0))*Math.sqrt(s);e={...e,mass:Ao.mass,stiffness:s,damping:i}}else{const n=Zcn(t);e={...e,...n,mass:Ao.mass},e.isResolvedFromDuration=!0}return e}function NY(t=Ao.visualDuration,e=Ao.bounce){const n=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:e}:t;let{restSpeed:r,restDelta:s}=n;const i=n.keyframes[0],o=n.keyframes[n.keyframes.length-1],l={done:!1,value:i},{stiffness:c,damping:d,mass:u,duration:h,velocity:m,isResolvedFromDuration:f}=ndn({...n,velocity:-Sf(n.velocity||0)}),p=m||0,g=d/(2*Math.sqrt(c*u)),v=o-i,b=Sf(Math.sqrt(c/u)),x=Math.abs(v)<5;r||(r=x?Ao.restSpeed.granular:Ao.restSpeed.default),s||(s=x?Ao.restDelta.granular:Ao.restDelta.default);let w;if(g<1){const S=Rge(b,g);w=C=>{const j=Math.exp(-g*b*C);return o-j*((p+g*b*v)/S*Math.sin(S*C)+v*Math.cos(S*C))}}else if(g===1)w=S=>o-Math.exp(-b*S)*(v+(p+b*v)*S);else{const S=b*Math.sqrt(g*g-1);w=C=>{const j=Math.exp(-g*b*C),E=Math.min(S*C,300);return o-j*((p+g*b*v)*Math.sinh(E)+S*v*Math.cosh(E))/S}}const k={calculatedDuration:f&&h||null,next:S=>{const C=w(S);if(f)l.done=S>=h;else{let j=S===0?p:0;g<1&&(j=S===0?Pf(p):Tht(w,S,C));const E=Math.abs(j)<=r,N=Math.abs(o-C)<=s;l.done=E&&N}return l.value=l.done?o:C,l},toString:()=>{const S=Math.min(v2e(k),EY),C=Nht(j=>k.next(S*j).value,S,30);return S+"ms "+C},toTransition:()=>{}};return k}NY.applyToOptions=t=>{const e=Ycn(t,100,NY);return t.ease=e.ease,t.duration=Pf(e.duration),t.type="keyframes",t};function Ige({keyframes:t,velocity:e=0,power:n=.8,timeConstant:r=325,bounceDamping:s=10,bounceStiffness:i=500,modifyTarget:o,min:l,max:c,restDelta:d=.5,restSpeed:u}){const h=t[0],m={done:!1,value:h},f=E=>l!==void 0&&E<l||c!==void 0&&E>c,p=E=>l===void 0?c:c===void 0||Math.abs(l-E)<Math.abs(c-E)?l:c;let g=n*e;const v=h+g,b=o===void 0?v:o(v);b!==v&&(g=b-h);const x=E=>-g*Math.exp(-E/r),w=E=>b+x(E),k=E=>{const N=x(E),A=w(E);m.done=Math.abs(N)<=d,m.value=m.done?b:A};let S,C;const j=E=>{f(m.value)&&(S=E,C=NY({keyframes:[m.value,p(m.value)],velocity:Tht(w,E,m.value),damping:s,stiffness:i,restDelta:d,restSpeed:u}))};return j(0),{calculatedDuration:null,next:E=>{let N=!1;return!C&&S===void 0&&(N=!0,k(E),j(E)),S!==void 0&&E>=S?C.next(E-S):(!N&&k(E),m)}}}function rdn(t,e,n){const r=[],s=n||Xx.mix||Eht,i=t.length-1;for(let o=0;o<i;o++){let l=s(t[o],t[o+1]);if(e){const c=Array.isArray(e)?e[o]||Af:e;l=m7(c,l)}r.push(l)}return r}function sdn(t,e,{clamp:n=!0,ease:r,mixer:s}={}){const i=t.length;if(mR(i===e.length,"Both input and output ranges must be the same length","range-length"),i===1)return()=>e[0];if(i===2&&e[0]===e[1])return()=>e[1];const o=t[0]===t[1];t[0]>t[i-1]&&(t=[...t].reverse(),e=[...e].reverse());const l=rdn(e,r,s),c=l.length,d=u=>{if(o&&u<t[0])return e[0];let h=0;if(c>1)for(;h<t.length-2&&!(u<t[h+1]);h++);const m=WO(t[h],t[h+1],u);return l[h](m)};return n?u=>d(Ny(t[0],t[i-1],u)):d}function idn(t,e){const n=t[t.length-1];for(let r=1;r<=e;r++){const s=WO(0,e,r);t.push($o(n,1,s))}}function adn(t){const e=[0];return idn(e,t.length-1),e}function odn(t,e){return t.map(n=>n*e)}function ldn(t,e){return t.map(()=>e||pht).splice(0,t.length-1)}function LD({duration:t=300,keyframes:e,times:n,ease:r="easeInOut"}){const s=xcn(r)?r.map(b$e):b$e(r),i={done:!1,value:e[0]},o=odn(n&&n.length===e.length?n:adn(e),t),l=sdn(o,e,{ease:Array.isArray(s)?s:ldn(e,s)});return{calculatedDuration:t,next:c=>(i.value=l(c),i.done=c>=t,i)}}const cdn=t=>t!==null;function y2e(t,{repeat:e,repeatType:n="loop"},r,s=1){const i=t.filter(cdn),l=s<0||e&&n!=="loop"&&e%2===1?0:i.length-1;return!l||r===void 0?i[l]:r}const ddn={decay:Ige,inertia:Ige,tween:LD,keyframes:LD,spring:NY};function _ht(t){typeof t.type=="string"&&(t.type=ddn[t.type])}class b2e{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(e=>{this.resolve=e})}notifyFinished(){this.resolve()}then(e,n){return this.finished.then(e,n)}}const udn=t=>t/100;class x2e extends b2e{constructor(e){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var r,s;const{motionValue:n}=this.options;n&&n.updatedAt!==Eu.now()&&this.tick(Eu.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(s=(r=this.options).onStop)==null||s.call(r))},this.options=e,this.initAnimation(),this.play(),e.autoplay===!1&&this.pause()}initAnimation(){const{options:e}=this;_ht(e);const{type:n=LD,repeat:r=0,repeatDelay:s=0,repeatType:i,velocity:o=0}=e;let{keyframes:l}=e;const c=n||LD;c!==LD&&typeof l[0]!="number"&&(this.mixKeyframes=m7(udn,Eht(l[0],l[1])),l=[0,100]);const d=c({...e,keyframes:l});i==="mirror"&&(this.mirroredGenerator=c({...e,keyframes:[...l].reverse(),velocity:-o})),d.calculatedDuration===null&&(d.calculatedDuration=v2e(d));const{calculatedDuration:u}=d;this.calculatedDuration=u,this.resolvedDuration=u+s,this.totalDuration=this.resolvedDuration*(r+1)-s,this.generator=d}updateTime(e){const n=Math.round(e-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=n}tick(e,n=!1){const{generator:r,totalDuration:s,mixKeyframes:i,mirroredGenerator:o,resolvedDuration:l,calculatedDuration:c}=this;if(this.startTime===null)return r.next(0);const{delay:d=0,keyframes:u,repeat:h,repeatType:m,repeatDelay:f,type:p,onUpdate:g,finalKeyframe:v}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,e):this.speed<0&&(this.startTime=Math.min(e-s/this.speed,this.startTime)),n?this.currentTime=e:this.updateTime(e);const b=this.currentTime-d*(this.playbackSpeed>=0?1:-1),x=this.playbackSpeed>=0?b<0:b>s;this.currentTime=Math.max(b,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let w=this.currentTime,k=r;if(h){const E=Math.min(this.currentTime,s)/l;let N=Math.floor(E),A=E%1;!A&&E>=1&&(A=1),A===1&&N--,N=Math.min(N,h+1),!!(N%2)&&(m==="reverse"?(A=1-A,f&&(A-=f/l)):m==="mirror"&&(k=o)),w=Ny(0,1,A)*l}const S=x?{done:!1,value:u[0]}:k.next(w);i&&(S.value=i(S.value));let{done:C}=S;!x&&c!==null&&(C=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const j=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&C);return j&&p!==Ige&&(S.value=y2e(u,this.options,v,this.speed)),g&&g(S.value),j&&this.finish(),S}then(e,n){return this.finished.then(e,n)}get duration(){return Sf(this.calculatedDuration)}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Sf(e)}get time(){return Sf(this.currentTime)}set time(e){var n;e=Pf(e),this.currentTime=e,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=e:this.driver&&(this.startTime=this.driver.now()-e/this.playbackSpeed),(n=this.driver)==null||n.start(!1)}get speed(){return this.playbackSpeed}set speed(e){this.updateTime(Eu.now());const n=this.playbackSpeed!==e;this.playbackSpeed=e,n&&(this.time=Sf(this.currentTime))}play(){var s,i;if(this.isStopped)return;const{driver:e=Kcn,startTime:n}=this.options;this.driver||(this.driver=e(o=>this.tick(o))),(i=(s=this.options).onPlay)==null||i.call(s);const r=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=r):this.holdTime!==null?this.startTime=r-this.holdTime:this.startTime||(this.startTime=n??r),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Eu.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var e,n;this.notifyFinished(),this.teardown(),this.state="finished",(n=(e=this.options).onComplete)==null||n.call(e)}cancel(){var e,n;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(n=(e=this.options).onCancel)==null||n.call(e)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(e){return this.startTime=0,this.tick(e,!0)}attachTimeline(e){var n;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(n=this.driver)==null||n.stop(),e.observe(this)}}function hdn(t){for(let e=1;e<t.length;e++)t[e]??(t[e]=t[e-1])}const xj=t=>t*180/Math.PI,Mge=t=>{const e=xj(Math.atan2(t[1],t[0]));return Lge(e)},mdn={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:Mge,rotateZ:Mge,skewX:t=>xj(Math.atan(t[1])),skewY:t=>xj(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},Lge=t=>(t=t%360,t<0&&(t+=360),t),N$e=Mge,T$e=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),_$e=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),fdn={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:T$e,scaleY:_$e,scale:t=>(T$e(t)+_$e(t))/2,rotateX:t=>Lge(xj(Math.atan2(t[6],t[5]))),rotateY:t=>Lge(xj(Math.atan2(-t[2],t[0]))),rotateZ:N$e,rotate:N$e,skewX:t=>xj(Math.atan(t[4])),skewY:t=>xj(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function Dge(t){return t.includes("scale")?1:0}function $ge(t,e){if(!t||t==="none")return Dge(e);const n=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let r,s;if(n)r=fdn,s=n;else{const l=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);r=mdn,s=l}if(!s)return Dge(e);const i=r[e],o=s[1].split(",").map(gdn);return typeof i=="function"?i(o):o[i]}const pdn=(t,e)=>{const{transform:n="none"}=getComputedStyle(t);return $ge(n,e)};function gdn(t){return parseFloat(t.trim())}const SI=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],CI=new Set(SI),A$e=t=>t===kI||t===ar,vdn=new Set(["x","y","z"]),ydn=SI.filter(t=>!vdn.has(t));function bdn(t){const e=[];return ydn.forEach(n=>{const r=t.getValue(n);r!==void 0&&(e.push([n,r.get()]),r.set(n.startsWith("scale")?1:0))}),e}const _1={width:({x:t},{paddingLeft:e="0",paddingRight:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),height:({y:t},{paddingTop:e="0",paddingBottom:n="0"})=>t.max-t.min-parseFloat(e)-parseFloat(n),top:(t,{top:e})=>parseFloat(e),left:(t,{left:e})=>parseFloat(e),bottom:({y:t},{top:e})=>parseFloat(e)+(t.max-t.min),right:({x:t},{left:e})=>parseFloat(e)+(t.max-t.min),x:(t,{transform:e})=>$ge(e,"x"),y:(t,{transform:e})=>$ge(e,"y")};_1.translateX=_1.x;_1.translateY=_1.y;const Kj=new Set;let Oge=!1,Fge=!1,Bge=!1;function Aht(){if(Fge){const t=Array.from(Kj).filter(r=>r.needsMeasurement),e=new Set(t.map(r=>r.element)),n=new Map;e.forEach(r=>{const s=bdn(r);s.length&&(n.set(r,s),r.render())}),t.forEach(r=>r.measureInitialState()),e.forEach(r=>{r.render();const s=n.get(r);s&&s.forEach(([i,o])=>{var l;(l=r.getValue(i))==null||l.set(o)})}),t.forEach(r=>r.measureEndState()),t.forEach(r=>{r.suspendedScrollY!==void 0&&window.scrollTo(0,r.suspendedScrollY)})}Fge=!1,Oge=!1,Kj.forEach(t=>t.complete(Bge)),Kj.clear()}function Pht(){Kj.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(Fge=!0)})}function xdn(){Bge=!0,Pht(),Aht(),Bge=!1}class w2e{constructor(e,n,r,s,i,o=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...e],this.onComplete=n,this.name=r,this.motionValue=s,this.element=i,this.isAsync=o}scheduleResolve(){this.state="scheduled",this.isAsync?(Kj.add(this),Oge||(Oge=!0,Da.read(Pht),Da.resolveKeyframes(Aht))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:e,name:n,element:r,motionValue:s}=this;if(e[0]===null){const i=s==null?void 0:s.get(),o=e[e.length-1];if(i!==void 0)e[0]=i;else if(r&&n){const l=r.readValue(n,o);l!=null&&(e[0]=l)}e[0]===void 0&&(e[0]=o),s&&i===void 0&&s.set(e[0])}hdn(e)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(e=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,e),Kj.delete(this)}cancel(){this.state==="scheduled"&&(Kj.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const wdn=t=>t.startsWith("--");function kdn(t,e,n){wdn(e)?t.style.setProperty(e,n):t.style[e]=n}const Sdn={};function Rht(t,e){const n=iht(t);return()=>Sdn[e]??n()}const Cdn=Rht(()=>window.ScrollTimeline!==void 0,"scrollTimeline"),Iht=Rht(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),v4=([t,e,n,r])=>`cubic-bezier(${t}, ${e}, ${n}, ${r})`,P$e={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:v4([0,.65,.55,1]),circOut:v4([.55,0,1,.45]),backIn:v4([.31,.01,.66,-.59]),backOut:v4([.33,1.53,.69,.99])};function Mht(t,e){if(t)return typeof t=="function"?Iht()?Nht(t,e):"ease-out":ght(t)?v4(t):Array.isArray(t)?t.map(n=>Mht(n,e)||P$e.easeOut):P$e[t]}function jdn(t,e,n,{delay:r=0,duration:s=300,repeat:i=0,repeatType:o="loop",ease:l="easeOut",times:c}={},d=void 0){const u={[e]:n};c&&(u.offset=c);const h=Mht(l,s);Array.isArray(h)&&(u.easing=h);const m={delay:r,duration:s,easing:Array.isArray(h)?"linear":h,fill:"both",iterations:i+1,direction:o==="reverse"?"alternate":"normal"};return d&&(m.pseudoElement=d),t.animate(u,m)}function Lht(t){return typeof t=="function"&&"applyToOptions"in t}function Edn({type:t,...e}){return Lht(t)&&Iht()?t.applyToOptions(e):(e.duration??(e.duration=300),e.ease??(e.ease="easeOut"),e)}class Dht extends b2e{constructor(e){if(super(),this.finishedTime=null,this.isStopped=!1,this.manualStartTime=null,!e)return;const{element:n,name:r,keyframes:s,pseudoElement:i,allowFlatten:o=!1,finalKeyframe:l,onComplete:c}=e;this.isPseudoElement=!!i,this.allowFlatten=o,this.options=e,mR(typeof e.type!="string",`Mini animate() doesn't support "type" as a string.`,"mini-spring");const d=Edn(e);this.animation=jdn(n,r,s,d,i),d.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!i){const u=y2e(s,this.options,l,this.speed);this.updateMotionValue?this.updateMotionValue(u):kdn(n,r,u),this.animation.cancel()}c==null||c(),this.notifyFinished()}}play(){this.isStopped||(this.manualStartTime=null,this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var e,n;(n=(e=this.animation).finish)==null||n.call(e)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:e}=this;e==="idle"||e==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var n,r,s;const e=(n=this.options)==null?void 0:n.element;!this.isPseudoElement&&(e!=null&&e.isConnected)&&((s=(r=this.animation).commitStyles)==null||s.call(r))}get duration(){var n,r;const e=((r=(n=this.animation.effect)==null?void 0:n.getComputedTiming)==null?void 0:r.call(n).duration)||0;return Sf(Number(e))}get iterationDuration(){const{delay:e=0}=this.options||{};return this.duration+Sf(e)}get time(){return Sf(Number(this.animation.currentTime)||0)}set time(e){this.manualStartTime=null,this.finishedTime=null,this.animation.currentTime=Pf(e)}get speed(){return this.animation.playbackRate}set speed(e){e<0&&(this.finishedTime=null),this.animation.playbackRate=e}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return this.manualStartTime??Number(this.animation.startTime)}set startTime(e){this.manualStartTime=this.animation.startTime=e}attachTimeline({timeline:e,observe:n}){var r;return this.allowFlatten&&((r=this.animation.effect)==null||r.updateTiming({easing:"linear"})),this.animation.onfinish=null,e&&Cdn()?(this.animation.timeline=e,Af):n(this)}}const $ht={anticipate:hht,backInOut:uht,circInOut:fht};function Ndn(t){return t in $ht}function Tdn(t){typeof t.ease=="string"&&Ndn(t.ease)&&(t.ease=$ht[t.ease])}const gle=10;class _dn extends Dht{constructor(e){Tdn(e),_ht(e),super(e),e.startTime!==void 0&&(this.startTime=e.startTime),this.options=e}updateMotionValue(e){const{motionValue:n,onUpdate:r,onComplete:s,element:i,...o}=this.options;if(!n)return;if(e!==void 0){n.set(e);return}const l=new x2e({...o,autoplay:!1}),c=Math.max(gle,Eu.now()-this.startTime),d=Ny(0,gle,c-gle);n.setWithVelocity(l.sample(Math.max(0,c-d)).value,l.sample(c).value,d),l.stop()}}const R$e=(t,e)=>e==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(Sg.test(t)||t==="0")&&!t.startsWith("url("));function Adn(t){const e=t[0];if(t.length===1)return!0;for(let n=0;n<t.length;n++)if(t[n]!==e)return!0}function Pdn(t,e,n,r){const s=t[0];if(s===null)return!1;if(e==="display"||e==="visibility")return!0;const i=t[t.length-1],o=R$e(s,e),l=R$e(i,e);return bte(o===l,`You are trying to animate ${e} from "${s}" to "${i}". "${o?i:s}" is not an animatable value.`,"value-not-animatable"),!o||!l?!1:Adn(t)||(n==="spring"||Lht(n))&&r}function Uge(t){t.duration=0,t.type="keyframes"}const Rdn=new Set(["opacity","clipPath","filter","transform"]),Idn=iht(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Mdn(t){var u;const{motionValue:e,name:n,repeatDelay:r,repeatType:s,damping:i,type:o}=t;if(!(((u=e==null?void 0:e.owner)==null?void 0:u.current)instanceof HTMLElement))return!1;const{onUpdate:c,transformTemplate:d}=e.owner.getProps();return Idn()&&n&&Rdn.has(n)&&(n!=="transform"||!d)&&!c&&!r&&s!=="mirror"&&i!==0&&o!=="inertia"}const Ldn=40;class Ddn extends b2e{constructor({autoplay:e=!0,delay:n=0,type:r="keyframes",repeat:s=0,repeatDelay:i=0,repeatType:o="loop",keyframes:l,name:c,motionValue:d,element:u,...h}){var p;super(),this.stop=()=>{var g,v;this._animation&&(this._animation.stop(),(g=this.stopTimeline)==null||g.call(this)),(v=this.keyframeResolver)==null||v.cancel()},this.createdAt=Eu.now();const m={autoplay:e,delay:n,type:r,repeat:s,repeatDelay:i,repeatType:o,name:c,motionValue:d,element:u,...h},f=(u==null?void 0:u.KeyframeResolver)||w2e;this.keyframeResolver=new f(l,(g,v,b)=>this.onKeyframesResolved(g,v,m,!b),c,d,u),(p=this.keyframeResolver)==null||p.scheduleResolve()}onKeyframesResolved(e,n,r,s){var v,b;this.keyframeResolver=void 0;const{name:i,type:o,velocity:l,delay:c,isHandoff:d,onUpdate:u}=r;this.resolvedAt=Eu.now(),Pdn(e,i,o,l)||((Xx.instantAnimations||!c)&&(u==null||u(y2e(e,r,n))),e[0]=e[e.length-1],Uge(r),r.repeat=0);const m={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>Ldn?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:n,...r,keyframes:e},f=!d&&Mdn(m),p=(b=(v=m.motionValue)==null?void 0:v.owner)==null?void 0:b.current,g=f?new _dn({...m,element:p}):new x2e(m);g.finished.then(()=>{this.notifyFinished()}).catch(Af),this.pendingTimeline&&(this.stopTimeline=g.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=g}get finished(){return this._animation?this.animation.finished:this._finished}then(e,n){return this.finished.finally(e).then(()=>{})}get animation(){var e;return this._animation||((e=this.keyframeResolver)==null||e.resume(),xdn()),this._animation}get duration(){return this.animation.duration}get iterationDuration(){return this.animation.iterationDuration}get time(){return this.animation.time}set time(e){this.animation.time=e}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(e){this.animation.speed=e}get startTime(){return this.animation.startTime}attachTimeline(e){return this._animation?this.stopTimeline=this.animation.attachTimeline(e):this.pendingTimeline=e,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var e;this._animation&&this.animation.cancel(),(e=this.keyframeResolver)==null||e.cancel()}}function Oht(t,e,n,r=0,s=1){const i=Array.from(t).sort((d,u)=>d.sortNodePosition(u)).indexOf(e),o=t.size,l=(o-1)*r;return typeof n=="function"?n(i,o):s===1?i*r:l-i*r}const $dn=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Odn(t){const e=$dn.exec(t);if(!e)return[,];const[,n,r,s]=e;return[`--${n??r}`,s]}const Fdn=4;function Fht(t,e,n=1){mR(n<=Fdn,`Max CSS variable fallback depth detected in property "${t}". This may indicate a circular fallback dependency.`,"max-css-var-depth");const[r,s]=Odn(t);if(!r)return;const i=window.getComputedStyle(e).getPropertyValue(r);if(i){const o=i.trim();return nht(o)?parseFloat(o):o}return m2e(s)?Fht(s,e,n+1):s}const Bdn={type:"spring",stiffness:500,damping:25,restSpeed:10},Udn=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),zdn={type:"keyframes",duration:.8},Vdn={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},Hdn=(t,{keyframes:e})=>e.length>2?zdn:CI.has(t)?t.startsWith("scale")?Udn(e[1]):Bdn:Vdn,Gdn=t=>t!==null;function Wdn(t,{repeat:e,repeatType:n="loop"},r){const s=t.filter(Gdn),i=e&&n!=="loop"&&e%2===1?0:s.length-1;return!i||r===void 0?s[i]:r}function Bht(t,e){if(t!=null&&t.inherit&&e){const{inherit:n,...r}=t;return{...e,...r}}return t}function k2e(t,e){const n=(t==null?void 0:t[e])??(t==null?void 0:t.default)??t;return n!==t?Bht(n,t):n}function qdn({when:t,delay:e,delayChildren:n,staggerChildren:r,staggerDirection:s,repeat:i,repeatType:o,repeatDelay:l,from:c,elapsed:d,...u}){return!!Object.keys(u).length}const S2e=(t,e,n,r={},s,i)=>o=>{const l=k2e(r,t)||{},c=l.delay||r.delay||0;let{elapsed:d=0}=r;d=d-Pf(c);const u={keyframes:Array.isArray(n)?n:[null,n],ease:"easeOut",velocity:e.getVelocity(),...l,delay:-d,onUpdate:m=>{e.set(m),l.onUpdate&&l.onUpdate(m)},onComplete:()=>{o(),l.onComplete&&l.onComplete()},name:t,motionValue:e,element:i?void 0:s};qdn(l)||Object.assign(u,Hdn(t,u)),u.duration&&(u.duration=Pf(u.duration)),u.repeatDelay&&(u.repeatDelay=Pf(u.repeatDelay)),u.from!==void 0&&(u.keyframes[0]=u.from);let h=!1;if((u.type===!1||u.duration===0&&!u.repeatDelay)&&(Uge(u),u.delay===0&&(h=!0)),(Xx.instantAnimations||Xx.skipAnimations||s!=null&&s.shouldSkipAnimations)&&(h=!0,Uge(u),u.delay=0),u.allowFlatten=!l.type&&!l.ease,h&&!i&&e.get()!==void 0){const m=Wdn(u.keyframes,l);if(m!==void 0){Da.update(()=>{u.onUpdate(m),u.onComplete()});return}}return l.isSync?new x2e(u):new Ddn(u)};function I$e(t){const e=[{},{}];return t==null||t.values.forEach((n,r)=>{e[0][r]=n.get(),e[1][r]=n.getVelocity()}),e}function C2e(t,e,n,r){if(typeof e=="function"){const[s,i]=I$e(r);e=e(n!==void 0?n:t.custom,s,i)}if(typeof e=="string"&&(e=t.variants&&t.variants[e]),typeof e=="function"){const[s,i]=I$e(r);e=e(n!==void 0?n:t.custom,s,i)}return e}function zA(t,e,n){const r=t.getProps();return C2e(r,e,n!==void 0?n:r.custom,t)}const Uht=new Set(["width","height","top","left","right","bottom",...SI]),M$e=30,Kdn=t=>!isNaN(parseFloat(t));class Ydn{constructor(e,n={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=r=>{var i;const s=Eu.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(r),this.current!==this.prev&&((i=this.events.change)==null||i.notify(this.current),this.dependents))for(const o of this.dependents)o.dirty()},this.hasAnimated=!1,this.setCurrent(e),this.owner=n.owner}setCurrent(e){this.current=e,this.updatedAt=Eu.now(),this.canTrackVelocity===null&&e!==void 0&&(this.canTrackVelocity=Kdn(this.current))}setPrevFrameValue(e=this.current){this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt}onChange(e){return this.on("change",e)}on(e,n){this.events[e]||(this.events[e]=new d2e);const r=this.events[e].add(n);return e==="change"?()=>{r(),Da.read(()=>{this.events.change.getSize()||this.stop()})}:r}clearListeners(){for(const e in this.events)this.events[e].clear()}attach(e,n){this.passiveEffect=e,this.stopPassiveEffect=n}set(e){this.passiveEffect?this.passiveEffect(e,this.updateAndNotify):this.updateAndNotify(e)}setWithVelocity(e,n,r){this.set(n),this.prev=void 0,this.prevFrameValue=e,this.prevUpdatedAt=this.updatedAt-r}jump(e,n=!0){this.updateAndNotify(e),this.prev=e,this.prevUpdatedAt=this.prevFrameValue=void 0,n&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var e;(e=this.events.change)==null||e.notify(this.current)}addDependent(e){this.dependents||(this.dependents=new Set),this.dependents.add(e)}removeDependent(e){this.dependents&&this.dependents.delete(e)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const e=Eu.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||e-this.updatedAt>M$e)return 0;const n=Math.min(this.updatedAt-this.prevUpdatedAt,M$e);return aht(parseFloat(this.current)-parseFloat(this.prevFrameValue),n)}start(e){return this.stop(),new Promise(n=>{this.hasAnimated=!0,this.animation=e(n),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var e,n;(e=this.dependents)==null||e.clear(),(n=this.events.destroy)==null||n.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function fR(t,e){return new Ydn(t,e)}const zge=t=>Array.isArray(t);function Qdn(t,e,n){t.hasValue(e)?t.getValue(e).set(n):t.addValue(e,fR(n))}function Zdn(t){return zge(t)?t[t.length-1]||0:t}function Jdn(t,e){const n=zA(t,e);let{transitionEnd:r={},transition:s={},...i}=n||{};i={...i,...r};for(const o in i){const l=Zdn(i[o]);Qdn(t,o,l)}}const Wd=t=>!!(t&&t.getVelocity);function Xdn(t){return!!(Wd(t)&&t.add)}function Vge(t,e){const n=t.getValue("willChange");if(Xdn(n))return n.add(e);if(!n&&Xx.WillChange){const r=new Xx.WillChange("auto");t.addValue("willChange",r),r.add(e)}}function j2e(t){return t.replace(/([A-Z])/g,e=>`-${e.toLowerCase()}`)}const eun="framerAppearId",zht="data-"+j2e(eun);function Vht(t){return t.props[zht]}function tun({protectedKeys:t,needsAnimating:e},n){const r=t.hasOwnProperty(n)&&e[n]!==!0;return e[n]=!1,r}function Hht(t,e,{delay:n=0,transitionOverride:r,type:s}={}){let{transition:i,transitionEnd:o,...l}=e;const c=t.getDefaultTransition();i=i?Bht(i,c):c;const d=i==null?void 0:i.reduceMotion;r&&(i=r);const u=[],h=s&&t.animationState&&t.animationState.getState()[s];for(const m in l){const f=t.getValue(m,t.latestValues[m]??null),p=l[m];if(p===void 0||h&&tun(h,m))continue;const g={delay:n,...k2e(i||{},m)},v=f.get();if(v!==void 0&&!f.isAnimating&&!Array.isArray(p)&&p===v&&!g.velocity)continue;let b=!1;if(window.MotionHandoffAnimation){const k=Vht(t);if(k){const S=window.MotionHandoffAnimation(k,m,Da);S!==null&&(g.startTime=S,b=!0)}}Vge(t,m);const x=d??t.shouldReduceMotion;f.start(S2e(m,f,p,x&&Uht.has(m)?{type:!1}:g,t,b));const w=f.animation;w&&u.push(w)}if(o){const m=()=>Da.update(()=>{o&&Jdn(t,o)});u.length?Promise.all(u).then(m):m()}return u}function Hge(t,e,n={}){var c;const r=zA(t,e,n.type==="exit"?(c=t.presenceContext)==null?void 0:c.custom:void 0);let{transition:s=t.getDefaultTransition()||{}}=r||{};n.transitionOverride&&(s=n.transitionOverride);const i=r?()=>Promise.all(Hht(t,r,n)):()=>Promise.resolve(),o=t.variantChildren&&t.variantChildren.size?(d=0)=>{const{delayChildren:u=0,staggerChildren:h,staggerDirection:m}=s;return nun(t,e,d,u,h,m,n)}:()=>Promise.resolve(),{when:l}=s;if(l){const[d,u]=l==="beforeChildren"?[i,o]:[o,i];return d().then(()=>u())}else return Promise.all([i(),o(n.delay)])}function nun(t,e,n=0,r=0,s=0,i=1,o){const l=[];for(const c of t.variantChildren)c.notify("AnimationStart",e),l.push(Hge(c,e,{...o,delay:n+(typeof r=="function"?0:r)+Oht(t.variantChildren,c,r,s,i)}).then(()=>c.notify("AnimationComplete",e)));return Promise.all(l)}function run(t,e,n={}){t.notify("AnimationStart",e);let r;if(Array.isArray(e)){const s=e.map(i=>Hge(t,i,n));r=Promise.all(s)}else if(typeof e=="string")r=Hge(t,e,n);else{const s=typeof e=="function"?zA(t,e,n.custom):e;r=Promise.all(Hht(t,s,n))}return r.then(()=>{t.notify("AnimationComplete",e)})}const sun={test:t=>t==="auto",parse:t=>t},Ght=t=>e=>e.test(t),Wht=[kI,ar,fy,xw,Rcn,Pcn,sun],L$e=t=>Wht.find(Ght(t));function iun(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||sht(t):!0}const aun=new Set(["brightness","contrast","saturate","opacity"]);function oun(t){const[e,n]=t.slice(0,-1).split("(");if(e==="drop-shadow")return t;const[r]=n.match(f2e)||[];if(!r)return t;const s=n.replace(r,"");let i=aun.has(e)?1:0;return r!==n&&(i*=100),e+"("+i+s+")"}const lun=/\b([a-z-]*)\(.*?\)/gu,Gge={...Sg,getAnimatableNone:t=>{const e=t.match(lun);return e?e.map(oun).join(" "):t}},Wge={...Sg,getAnimatableNone:t=>{const e=Sg.parse(t);return Sg.createTransformer(t)(e.map(r=>typeof r=="number"?0:typeof r=="object"?{...r,alpha:1}:r))}},D$e={...kI,transform:Math.round},cun={rotate:xw,rotateX:xw,rotateY:xw,rotateZ:xw,scale:az,scaleX:az,scaleY:az,scaleZ:az,skew:xw,skewX:xw,skewY:xw,distance:ar,translateX:ar,translateY:ar,translateZ:ar,x:ar,y:ar,z:ar,perspective:ar,transformPerspective:ar,opacity:qO,originX:k$e,originY:k$e,originZ:ar},E2e={borderWidth:ar,borderTopWidth:ar,borderRightWidth:ar,borderBottomWidth:ar,borderLeftWidth:ar,borderRadius:ar,borderTopLeftRadius:ar,borderTopRightRadius:ar,borderBottomRightRadius:ar,borderBottomLeftRadius:ar,width:ar,maxWidth:ar,height:ar,maxHeight:ar,top:ar,right:ar,bottom:ar,left:ar,inset:ar,insetBlock:ar,insetBlockStart:ar,insetBlockEnd:ar,insetInline:ar,insetInlineStart:ar,insetInlineEnd:ar,padding:ar,paddingTop:ar,paddingRight:ar,paddingBottom:ar,paddingLeft:ar,paddingBlock:ar,paddingBlockStart:ar,paddingBlockEnd:ar,paddingInline:ar,paddingInlineStart:ar,paddingInlineEnd:ar,margin:ar,marginTop:ar,marginRight:ar,marginBottom:ar,marginLeft:ar,marginBlock:ar,marginBlockStart:ar,marginBlockEnd:ar,marginInline:ar,marginInlineStart:ar,marginInlineEnd:ar,fontSize:ar,backgroundPositionX:ar,backgroundPositionY:ar,...cun,zIndex:D$e,fillOpacity:qO,strokeOpacity:qO,numOctaves:D$e},dun={...E2e,color:Wl,backgroundColor:Wl,outlineColor:Wl,fill:Wl,stroke:Wl,borderColor:Wl,borderTopColor:Wl,borderRightColor:Wl,borderBottomColor:Wl,borderLeftColor:Wl,filter:Gge,WebkitFilter:Gge,mask:Wge,WebkitMask:Wge},qht=t=>dun[t],uun=new Set([Gge,Wge]);function Kht(t,e){let n=qht(t);return uun.has(n)||(n=Sg),n.getAnimatableNone?n.getAnimatableNone(e):void 0}const hun=new Set(["auto","none","0"]);function mun(t,e,n){let r=0,s;for(;r<t.length&&!s;){const i=t[r];typeof i=="string"&&!hun.has(i)&&KO(i).values.length&&(s=t[r]),r++}if(s&&n)for(const i of e)t[i]=Kht(n,s)}class fun extends w2e{constructor(e,n,r,s,i){super(e,n,r,s,i,!0)}readKeyframes(){const{unresolvedKeyframes:e,element:n,name:r}=this;if(!n||!n.current)return;super.readKeyframes();for(let u=0;u<e.length;u++){let h=e[u];if(typeof h=="string"&&(h=h.trim(),m2e(h))){const m=Fht(h,n.current);m!==void 0&&(e[u]=m),u===e.length-1&&(this.finalKeyframe=h)}}if(this.resolveNoneKeyframes(),!Uht.has(r)||e.length!==2)return;const[s,i]=e,o=L$e(s),l=L$e(i),c=w$e(s),d=w$e(i);if(c!==d&&_1[r]){this.needsMeasurement=!0;return}if(o!==l)if(A$e(o)&&A$e(l))for(let u=0;u<e.length;u++){const h=e[u];typeof h=="string"&&(e[u]=parseFloat(h))}else _1[r]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:e,name:n}=this,r=[];for(let s=0;s<e.length;s++)(e[s]===null||iun(e[s]))&&r.push(s);r.length&&mun(e,r,n)}measureInitialState(){const{element:e,unresolvedKeyframes:n,name:r}=this;if(!e||!e.current)return;r==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=_1[r](e.measureViewportBox(),window.getComputedStyle(e.current)),n[0]=this.measuredOrigin;const s=n[n.length-1];s!==void 0&&e.getValue(r,s).jump(s,!1)}measureEndState(){var l;const{element:e,name:n,unresolvedKeyframes:r}=this;if(!e||!e.current)return;const s=e.getValue(n);s&&s.jump(this.measuredOrigin,!1);const i=r.length-1,o=r[i];r[i]=_1[n](e.measureViewportBox(),window.getComputedStyle(e.current)),o!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=o),(l=this.removedTransforms)!=null&&l.length&&this.removedTransforms.forEach(([c,d])=>{e.getValue(c).set(d)}),this.resolveNoneKeyframes()}}const pun=new Set(["opacity","clipPath","filter","transform"]);function Yht(t,e,n){if(t==null)return[];if(t instanceof EventTarget)return[t];if(typeof t=="string"){const s=document.querySelectorAll(t);return s?Array.from(s):[]}return Array.from(t).filter(r=>r!=null)}const Qht=(t,e)=>e&&typeof t=="number"?e.transform(t):t;function qge(t){return rht(t)&&"offsetHeight"in t}const{schedule:N2e,cancel:tSs}=vht(queueMicrotask,!1),Op={x:!1,y:!1};function Zht(){return Op.x||Op.y}function gun(t){return t==="x"||t==="y"?Op[t]?null:(Op[t]=!0,()=>{Op[t]=!1}):Op.x||Op.y?null:(Op.x=Op.y=!0,()=>{Op.x=Op.y=!1})}function Jht(t,e){const n=Yht(t),r=new AbortController,s={passive:!0,...e,signal:r.signal};return[n,s,()=>r.abort()]}function vun(t){return!(t.pointerType==="touch"||Zht())}function yun(t,e,n={}){const[r,s,i]=Jht(t,n);return r.forEach(o=>{let l=!1,c=!1,d;const u=()=>{o.removeEventListener("pointerleave",p)},h=v=>{d&&(d(v),d=void 0),u()},m=v=>{l=!1,window.removeEventListener("pointerup",m),window.removeEventListener("pointercancel",m),c&&(c=!1,h(v))},f=()=>{l=!0,window.addEventListener("pointerup",m,s),window.addEventListener("pointercancel",m,s)},p=v=>{if(v.pointerType!=="touch"){if(l){c=!0;return}h(v)}},g=v=>{if(!vun(v))return;c=!1;const b=e(o,v);typeof b=="function"&&(d=b,o.addEventListener("pointerleave",p,s))};o.addEventListener("pointerenter",g,s),o.addEventListener("pointerdown",f,s)}),i}const Xht=(t,e)=>e?t===e?!0:Xht(t,e.parentElement):!1,T2e=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,bun=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function xun(t){return bun.has(t.tagName)||t.isContentEditable===!0}const wun=new Set(["INPUT","SELECT","TEXTAREA"]);function kun(t){return wun.has(t.tagName)||t.isContentEditable===!0}const AG=new WeakSet;function $$e(t){return e=>{e.key==="Enter"&&t(e)}}function vle(t,e){t.dispatchEvent(new PointerEvent("pointer"+e,{isPrimary:!0,bubbles:!0}))}const Sun=(t,e)=>{const n=t.currentTarget;if(!n)return;const r=$$e(()=>{if(AG.has(n))return;vle(n,"down");const s=$$e(()=>{vle(n,"up")}),i=()=>vle(n,"cancel");n.addEventListener("keyup",s,e),n.addEventListener("blur",i,e)});n.addEventListener("keydown",r,e),n.addEventListener("blur",()=>n.removeEventListener("keydown",r),e)};function O$e(t){return T2e(t)&&!Zht()}const F$e=new WeakSet;function Cun(t,e,n={}){const[r,s,i]=Jht(t,n),o=l=>{const c=l.currentTarget;if(!O$e(l)||F$e.has(l))return;AG.add(c),n.stopPropagation&&F$e.add(l);const d=e(c,l),u=(f,p)=>{window.removeEventListener("pointerup",h),window.removeEventListener("pointercancel",m),AG.has(c)&&AG.delete(c),O$e(f)&&typeof d=="function"&&d(f,{success:p})},h=f=>{u(f,c===window||c===document||n.useGlobalTarget||Xht(c,f.target))},m=f=>{u(f,!1)};window.addEventListener("pointerup",h,s),window.addEventListener("pointercancel",m,s)};return r.forEach(l=>{(n.useGlobalTarget?window:l).addEventListener("pointerdown",o,s),qge(l)&&(l.addEventListener("focus",d=>Sun(d,s)),!xun(l)&&!l.hasAttribute("tabindex")&&(l.tabIndex=0))}),i}function _2e(t){return rht(t)&&"ownerSVGElement"in t}const PG=new WeakMap;let ww;const emt=(t,e,n)=>(r,s)=>s&&s[0]?s[0][t+"Size"]:_2e(r)&&"getBBox"in r?r.getBBox()[e]:r[n],jun=emt("inline","width","offsetWidth"),Eun=emt("block","height","offsetHeight");function Nun({target:t,borderBoxSize:e}){var n;(n=PG.get(t))==null||n.forEach(r=>{r(t,{get width(){return jun(t,e)},get height(){return Eun(t,e)}})})}function Tun(t){t.forEach(Nun)}function _un(){typeof ResizeObserver>"u"||(ww=new ResizeObserver(Tun))}function Aun(t,e){ww||_un();const n=Yht(t);return n.forEach(r=>{let s=PG.get(r);s||(s=new Set,PG.set(r,s)),s.add(e),ww==null||ww.observe(r)}),()=>{n.forEach(r=>{const s=PG.get(r);s==null||s.delete(e),s!=null&&s.size||ww==null||ww.unobserve(r)})}}const RG=new Set;let aA;function Pun(){aA=()=>{const t={get width(){return window.innerWidth},get height(){return window.innerHeight}};RG.forEach(e=>e(t))},window.addEventListener("resize",aA)}function Run(t){return RG.add(t),aA||Pun(),()=>{RG.delete(t),!RG.size&&typeof aA=="function"&&(window.removeEventListener("resize",aA),aA=void 0)}}function B$e(t,e){return typeof t=="function"?Run(t):Aun(t,e)}function Iun(t){return _2e(t)&&t.tagName==="svg"}const Mun=[...Wht,Wl,Sg],Lun=t=>Mun.find(Ght(t)),U$e=()=>({translate:0,scale:1,origin:0,originPoint:0}),oA=()=>({x:U$e(),y:U$e()}),z$e=()=>({min:0,max:0}),lc=()=>({x:z$e(),y:z$e()}),Dun=new WeakMap;function xte(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function YO(t){return typeof t=="string"||Array.isArray(t)}const A2e=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],P2e=["initial",...A2e];function wte(t){return xte(t.animate)||P2e.some(e=>YO(t[e]))}function tmt(t){return!!(wte(t)||t.variants)}function $un(t,e,n){for(const r in e){const s=e[r],i=n[r];if(Wd(s))t.addValue(r,s);else if(Wd(i))t.addValue(r,fR(s,{owner:t}));else if(i!==s)if(t.hasValue(r)){const o=t.getValue(r);o.liveStyle===!0?o.jump(s):o.hasAnimated||o.set(s)}else{const o=t.getStaticValue(r);t.addValue(r,fR(o!==void 0?o:s,{owner:t}))}}for(const r in n)e[r]===void 0&&t.removeValue(r);return e}const TY={current:null},R2e={current:!1},Oun=typeof window<"u";function nmt(){if(R2e.current=!0,!!Oun)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),e=()=>TY.current=t.matches;t.addEventListener("change",e),e()}else TY.current=!1}const V$e=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];let _Y={};function rmt(t){_Y=t}function Fun(){return _Y}class Bun{scrapeMotionValuesFromProps(e,n,r){return{}}constructor({parent:e,props:n,presenceContext:r,reducedMotionConfig:s,skipAnimations:i,blockInitialAnimation:o,visualState:l},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.shouldSkipAnimations=!1,this.values=new Map,this.KeyframeResolver=w2e,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.hasBeenMounted=!1,this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const f=Eu.now();this.renderScheduledAt<f&&(this.renderScheduledAt=f,Da.render(this.render,!1,!0))};const{latestValues:d,renderState:u}=l;this.latestValues=d,this.baseTarget={...d},this.initialValues=n.initial?{...d}:{},this.renderState=u,this.parent=e,this.props=n,this.presenceContext=r,this.depth=e?e.depth+1:0,this.reducedMotionConfig=s,this.skipAnimationsConfig=i,this.options=c,this.blockInitialAnimation=!!o,this.isControllingVariants=wte(n),this.isVariantNode=tmt(n),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(e&&e.current);const{willChange:h,...m}=this.scrapeMotionValuesFromProps(n,{},this);for(const f in m){const p=m[f];d[f]!==void 0&&Wd(p)&&p.set(d[f])}}mount(e){var n,r;if(this.hasBeenMounted)for(const s in this.initialValues)(n=this.values.get(s))==null||n.jump(this.initialValues[s]),this.latestValues[s]=this.initialValues[s];this.current=e,Dun.set(e,this),this.projection&&!this.projection.instance&&this.projection.mount(e),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((s,i)=>this.bindToMotionValue(i,s)),this.reducedMotionConfig==="never"?this.shouldReduceMotion=!1:this.reducedMotionConfig==="always"?this.shouldReduceMotion=!0:(R2e.current||nmt(),this.shouldReduceMotion=TY.current),this.shouldSkipAnimations=this.skipAnimationsConfig??!1,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext),this.hasBeenMounted=!0}unmount(){var e;this.projection&&this.projection.unmount(),Mk(this.notifyUpdate),Mk(this.render),this.valueSubscriptions.forEach(n=>n()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(e=this.parent)==null||e.removeChild(this);for(const n in this.events)this.events[n].clear();for(const n in this.features){const r=this.features[n];r&&(r.unmount(),r.isMounted=!1)}this.current=null}addChild(e){this.children.add(e),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(e)}removeChild(e){this.children.delete(e),this.enteringChildren&&this.enteringChildren.delete(e)}bindToMotionValue(e,n){if(this.valueSubscriptions.has(e)&&this.valueSubscriptions.get(e)(),n.accelerate&&pun.has(e)&&this.current instanceof HTMLElement){const{factory:o,keyframes:l,times:c,ease:d,duration:u}=n.accelerate,h=new Dht({element:this.current,name:e,keyframes:l,times:c,ease:d,duration:Pf(u)}),m=o(h);this.valueSubscriptions.set(e,()=>{m(),h.cancel()});return}const r=CI.has(e);r&&this.onBindTransform&&this.onBindTransform();const s=n.on("change",o=>{this.latestValues[e]=o,this.props.onUpdate&&Da.preRender(this.notifyUpdate),r&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let i;typeof window<"u"&&window.MotionCheckAppearSync&&(i=window.MotionCheckAppearSync(this,e,n)),this.valueSubscriptions.set(e,()=>{s(),i&&i(),n.owner&&n.stop()})}sortNodePosition(e){return!this.current||!this.sortInstanceNodePosition||this.type!==e.type?0:this.sortInstanceNodePosition(this.current,e.current)}updateFeatures(){let e="animation";for(e in _Y){const n=_Y[e];if(!n)continue;const{isEnabled:r,Feature:s}=n;if(!this.features[e]&&s&&r(this.props)&&(this.features[e]=new s(this)),this.features[e]){const i=this.features[e];i.isMounted?i.update():(i.mount(),i.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):lc()}getStaticValue(e){return this.latestValues[e]}setStaticValue(e,n){this.latestValues[e]=n}update(e,n){(e.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=e,this.prevPresenceContext=this.presenceContext,this.presenceContext=n;for(let r=0;r<V$e.length;r++){const s=V$e[r];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const i="on"+s,o=e[i];o&&(this.propEventSubscriptions[s]=this.on(s,o))}this.prevMotionValues=$un(this,this.scrapeMotionValuesFromProps(e,this.prevProps||{},this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(e){return this.props.variants?this.props.variants[e]:void 0}getDefaultTransition(){return this.props.transition}getTransformPagePoint(){return this.props.transformPagePoint}getClosestVariantNode(){return this.isVariantNode?this:this.parent?this.parent.getClosestVariantNode():void 0}addVariantChild(e){const n=this.getClosestVariantNode();if(n)return n.variantChildren&&n.variantChildren.add(e),()=>n.variantChildren.delete(e)}addValue(e,n){const r=this.values.get(e);n!==r&&(r&&this.removeValue(e),this.bindToMotionValue(e,n),this.values.set(e,n),this.latestValues[e]=n.get())}removeValue(e){this.values.delete(e);const n=this.valueSubscriptions.get(e);n&&(n(),this.valueSubscriptions.delete(e)),delete this.latestValues[e],this.removeValueFromRenderState(e,this.renderState)}hasValue(e){return this.values.has(e)}getValue(e,n){if(this.props.values&&this.props.values[e])return this.props.values[e];let r=this.values.get(e);return r===void 0&&n!==void 0&&(r=fR(n===null?void 0:n,{owner:this}),this.addValue(e,r)),r}readValue(e,n){let r=this.latestValues[e]!==void 0||!this.current?this.latestValues[e]:this.getBaseTargetFromProps(this.props,e)??this.readValueFromInstance(this.current,e,this.options);return r!=null&&(typeof r=="string"&&(nht(r)||sht(r))?r=parseFloat(r):!Lun(r)&&Sg.test(n)&&(r=Kht(e,n)),this.setBaseTarget(e,Wd(r)?r.get():r)),Wd(r)?r.get():r}setBaseTarget(e,n){this.baseTarget[e]=n}getBaseTarget(e){var i;const{initial:n}=this.props;let r;if(typeof n=="string"||typeof n=="object"){const o=C2e(this.props,n,(i=this.presenceContext)==null?void 0:i.custom);o&&(r=o[e])}if(n&&r!==void 0)return r;const s=this.getBaseTargetFromProps(this.props,e);return s!==void 0&&!Wd(s)?s:this.initialValues[e]!==void 0&&r===void 0?void 0:this.baseTarget[e]}on(e,n){return this.events[e]||(this.events[e]=new d2e),this.events[e].add(n)}notify(e,...n){this.events[e]&&this.events[e].notify(...n)}scheduleRenderMicrotask(){N2e.render(this.render)}}class smt extends Bun{constructor(){super(...arguments),this.KeyframeResolver=fun}sortInstanceNodePosition(e,n){return e.compareDocumentPosition(n)&2?1:-1}getBaseTargetFromProps(e,n){const r=e.style;return r?r[n]:void 0}removeValueFromRenderState(e,{vars:n,style:r}){delete n[e],delete r[e]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:e}=this.props;Wd(e)&&(this.childSubscription=e.on("change",n=>{this.current&&(this.current.textContent=`${n}`)}))}}class yS{constructor(e){this.isMounted=!1,this.node=e}update(){}}function imt({top:t,left:e,right:n,bottom:r}){return{x:{min:e,max:n},y:{min:t,max:r}}}function Uun({x:t,y:e}){return{top:e.min,right:t.max,bottom:e.max,left:t.min}}function zun(t,e){if(!e)return t;const n=e({x:t.left,y:t.top}),r=e({x:t.right,y:t.bottom});return{top:n.y,left:n.x,bottom:r.y,right:r.x}}function yle(t){return t===void 0||t===1}function Kge({scale:t,scaleX:e,scaleY:n}){return!yle(t)||!yle(e)||!yle(n)}function xC(t){return Kge(t)||amt(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function amt(t){return H$e(t.x)||H$e(t.y)}function H$e(t){return t&&t!=="0%"}function AY(t,e,n){const r=t-n,s=e*r;return n+s}function G$e(t,e,n,r,s){return s!==void 0&&(t=AY(t,s,r)),AY(t,n,r)+e}function Yge(t,e=0,n=1,r,s){t.min=G$e(t.min,e,n,r,s),t.max=G$e(t.max,e,n,r,s)}function omt(t,{x:e,y:n}){Yge(t.x,e.translate,e.scale,e.originPoint),Yge(t.y,n.translate,n.scale,n.originPoint)}const W$e=.999999999999,q$e=1.0000000000001;function Vun(t,e,n,r=!1){const s=n.length;if(!s)return;e.x=e.y=1;let i,o;for(let l=0;l<s;l++){i=n[l],o=i.projectionDelta;const{visualElement:c}=i.options;c&&c.props.style&&c.props.style.display==="contents"||(r&&i.options.layoutScroll&&i.scroll&&i!==i.root&&cA(t,{x:-i.scroll.offset.x,y:-i.scroll.offset.y}),o&&(e.x*=o.x.scale,e.y*=o.y.scale,omt(t,o)),r&&xC(i.latestValues)&&cA(t,i.latestValues))}e.x<q$e&&e.x>W$e&&(e.x=1),e.y<q$e&&e.y>W$e&&(e.y=1)}function lA(t,e){t.min=t.min+e,t.max=t.max+e}function K$e(t,e,n,r,s=.5){const i=$o(t.min,t.max,s);Yge(t,e,n,i,r)}function cA(t,e){K$e(t.x,e.x,e.scaleX,e.scale,e.originX),K$e(t.y,e.y,e.scaleY,e.scale,e.originY)}function lmt(t,e){return imt(zun(t.getBoundingClientRect(),e))}function Hun(t,e,n){const r=lmt(t,n),{scroll:s}=e;return s&&(lA(r.x,s.offset.x),lA(r.y,s.offset.y)),r}const Gun={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},Wun=SI.length;function qun(t,e,n){let r="",s=!0;for(let i=0;i<Wun;i++){const o=SI[i],l=t[o];if(l===void 0)continue;let c=!0;if(typeof l=="number")c=l===(o.startsWith("scale")?1:0);else{const d=parseFloat(l);c=o.startsWith("scale")?d===1:d===0}if(!c||n){const d=Qht(l,E2e[o]);if(!c){s=!1;const u=Gun[o]||o;r+=`${u}(${d}) `}n&&(e[o]=d)}}return r=r.trim(),n?r=n(e,s?"":r):s&&(r="none"),r}function I2e(t,e,n){const{style:r,vars:s,transformOrigin:i}=t;let o=!1,l=!1;for(const c in e){const d=e[c];if(CI.has(c)){o=!0;continue}else if(bht(c)){s[c]=d;continue}else{const u=Qht(d,E2e[c]);c.startsWith("origin")?(l=!0,i[c]=u):r[c]=u}}if(e.transform||(o||n?r.transform=qun(e,t.transform,n):r.transform&&(r.transform="none")),l){const{originX:c="50%",originY:d="50%",originZ:u=0}=i;r.transformOrigin=`${c} ${d} ${u}`}}function cmt(t,{style:e,vars:n},r,s){const i=t.style;let o;for(o in e)i[o]=e[o];s==null||s.applyProjectionStyles(i,r);for(o in n)i.setProperty(o,n[o])}function Y$e(t,e){return e.max===e.min?0:t/(e.max-e.min)*100}const DL={correct:(t,e)=>{if(!e.target)return t;if(typeof t=="string")if(ar.test(t))t=parseFloat(t);else return t;const n=Y$e(t,e.target.x),r=Y$e(t,e.target.y);return`${n}% ${r}%`}},Kun={correct:(t,{treeScale:e,projectionDelta:n})=>{const r=t,s=Sg.parse(t);if(s.length>5)return r;const i=Sg.createTransformer(t),o=typeof s[0]!="number"?1:0,l=n.x.scale*e.x,c=n.y.scale*e.y;s[0+o]/=l,s[1+o]/=c;const d=$o(l,c,.5);return typeof s[2+o]=="number"&&(s[2+o]/=d),typeof s[3+o]=="number"&&(s[3+o]/=d),i(s)}},Qge={borderRadius:{...DL,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:DL,borderTopRightRadius:DL,borderBottomLeftRadius:DL,borderBottomRightRadius:DL,boxShadow:Kun};function dmt(t,{layout:e,layoutId:n}){return CI.has(t)||t.startsWith("origin")||(e||n!==void 0)&&(!!Qge[t]||t==="opacity")}function M2e(t,e,n){var o;const r=t.style,s=e==null?void 0:e.style,i={};if(!r)return i;for(const l in r)(Wd(r[l])||s&&Wd(s[l])||dmt(l,t)||((o=n==null?void 0:n.getValue(l))==null?void 0:o.liveStyle)!==void 0)&&(i[l]=r[l]);return i}function Yun(t){return window.getComputedStyle(t)}class Qun extends smt{constructor(){super(...arguments),this.type="html",this.renderInstance=cmt}readValueFromInstance(e,n){var r;if(CI.has(n))return(r=this.projection)!=null&&r.isProjecting?Dge(n):pdn(e,n);{const s=Yun(e),i=(bht(n)?s.getPropertyValue(n):s[n])||0;return typeof i=="string"?i.trim():i}}measureInstanceViewportBox(e,{transformPagePoint:n}){return lmt(e,n)}build(e,n,r){I2e(e,n,r.transformTemplate)}scrapeMotionValuesFromProps(e,n,r){return M2e(e,n,r)}}const Zun={offset:"stroke-dashoffset",array:"stroke-dasharray"},Jun={offset:"strokeDashoffset",array:"strokeDasharray"};function Xun(t,e,n=1,r=0,s=!0){t.pathLength=1;const i=s?Zun:Jun;t[i.offset]=`${-r}`,t[i.array]=`${e} ${n}`}const ehn=["offsetDistance","offsetPath","offsetRotate","offsetAnchor"];function umt(t,{attrX:e,attrY:n,attrScale:r,pathLength:s,pathSpacing:i=1,pathOffset:o=0,...l},c,d,u){if(I2e(t,l,d),c){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:h,style:m}=t;h.transform&&(m.transform=h.transform,delete h.transform),(m.transform||h.transformOrigin)&&(m.transformOrigin=h.transformOrigin??"50% 50%",delete h.transformOrigin),m.transform&&(m.transformBox=(u==null?void 0:u.transformBox)??"fill-box",delete h.transformBox);for(const f of ehn)h[f]!==void 0&&(m[f]=h[f],delete h[f]);e!==void 0&&(h.x=e),n!==void 0&&(h.y=n),r!==void 0&&(h.scale=r),s!==void 0&&Xun(h,s,i,o,!1)}const hmt=new Set(["baseFrequency","diffuseConstant","kernelMatrix","kernelUnitLength","keySplines","keyTimes","limitingConeAngle","markerHeight","markerWidth","numOctaves","targetX","targetY","surfaceScale","specularConstant","specularExponent","stdDeviation","tableValues","viewBox","gradientTransform","pathLength","startOffset","textLength","lengthAdjust"]),mmt=t=>typeof t=="string"&&t.toLowerCase()==="svg";function thn(t,e,n,r){cmt(t,e,void 0,r);for(const s in e.attrs)t.setAttribute(hmt.has(s)?s:j2e(s),e.attrs[s])}function fmt(t,e,n){const r=M2e(t,e,n);for(const s in t)if(Wd(t[s])||Wd(e[s])){const i=SI.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;r[i]=t[s]}return r}class nhn extends smt{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=lc}getBaseTargetFromProps(e,n){return e[n]}readValueFromInstance(e,n){if(CI.has(n)){const r=qht(n);return r&&r.default||0}return n=hmt.has(n)?n:j2e(n),e.getAttribute(n)}scrapeMotionValuesFromProps(e,n,r){return fmt(e,n,r)}build(e,n,r){umt(e,n,this.isSVGTag,r.transformTemplate,r.style)}renderInstance(e,n,r,s){thn(e,n,r,s)}mount(e){this.isSVGTag=mmt(e.tagName),super.mount(e)}}const rhn=P2e.length;function pmt(t){if(!t)return;if(!t.isControllingVariants){const n=t.parent?pmt(t.parent)||{}:{};return t.props.initial!==void 0&&(n.initial=t.props.initial),n}const e={};for(let n=0;n<rhn;n++){const r=P2e[n],s=t.props[r];(YO(s)||s===!1)&&(e[r]=s)}return e}function gmt(t,e){if(!Array.isArray(e))return!1;const n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(e[r]!==t[r])return!1;return!0}const shn=[...A2e].reverse(),ihn=A2e.length;function ahn(t){return e=>Promise.all(e.map(({animation:n,options:r})=>run(t,n,r)))}function ohn(t){let e=ahn(t),n=Q$e(),r=!0;const s=c=>(d,u)=>{var m;const h=zA(t,u,c==="exit"?(m=t.presenceContext)==null?void 0:m.custom:void 0);if(h){const{transition:f,transitionEnd:p,...g}=h;d={...d,...g,...p}}return d};function i(c){e=c(t)}function o(c){const{props:d}=t,u=pmt(t.parent)||{},h=[],m=new Set;let f={},p=1/0;for(let v=0;v<ihn;v++){const b=shn[v],x=n[b],w=d[b]!==void 0?d[b]:u[b],k=YO(w),S=b===c?x.isActive:null;S===!1&&(p=v);let C=w===u[b]&&w!==d[b]&&k;if(C&&r&&t.manuallyAnimateOnMount&&(C=!1),x.protectedKeys={...f},!x.isActive&&S===null||!w&&!x.prevProp||xte(w)||typeof w=="boolean")continue;if(b==="exit"&&x.isActive&&S!==!0){x.prevResolvedValues&&(f={...f,...x.prevResolvedValues});continue}const j=lhn(x.prevProp,w);let E=j||b===c&&x.isActive&&!C&&k||v>p&&k,N=!1;const A=Array.isArray(w)?w:[w];let _=A.reduce(s(b),{});S===!1&&(_={});const{prevResolvedValues:T={}}=x,R={...T,..._},O=I=>{E=!0,m.has(I)&&(N=!0,m.delete(I)),x.needsAnimating[I]=!0;const P=t.getValue(I);P&&(P.liveStyle=!1)};for(const I in R){const P=_[I],M=T[I];if(f.hasOwnProperty(I))continue;let z=!1;zge(P)&&zge(M)?z=!gmt(P,M):z=P!==M,z?P!=null?O(I):m.add(I):P!==void 0&&m.has(I)?O(I):x.protectedKeys[I]=!0}x.prevProp=w,x.prevResolvedValues=_,x.isActive&&(f={...f,..._}),r&&t.blockInitialAnimation&&(E=!1);const F=C&&j;E&&(!F||N)&&h.push(...A.map(I=>{const P={type:b};if(typeof I=="string"&&r&&!F&&t.manuallyAnimateOnMount&&t.parent){const{parent:M}=t,z=zA(M,I);if(M.enteringChildren&&z){const{delayChildren:G}=z.transition||{};P.delay=Oht(M.enteringChildren,t,G)}}return{animation:I,options:P}}))}if(m.size){const v={};if(typeof d.initial!="boolean"){const b=zA(t,Array.isArray(d.initial)?d.initial[0]:d.initial);b&&b.transition&&(v.transition=b.transition)}m.forEach(b=>{const x=t.getBaseTarget(b),w=t.getValue(b);w&&(w.liveStyle=!0),v[b]=x??null}),h.push({animation:v})}let g=!!h.length;return r&&(d.initial===!1||d.initial===d.animate)&&!t.manuallyAnimateOnMount&&(g=!1),r=!1,g?e(h):Promise.resolve()}function l(c,d){var h;if(n[c].isActive===d)return Promise.resolve();(h=t.variantChildren)==null||h.forEach(m=>{var f;return(f=m.animationState)==null?void 0:f.setActive(c,d)}),n[c].isActive=d;const u=o(c);for(const m in n)n[m].protectedKeys={};return u}return{animateChanges:o,setActive:l,setAnimateFunction:i,getState:()=>n,reset:()=>{n=Q$e()}}}function lhn(t,e){return typeof e=="string"?e!==t:Array.isArray(e)?!gmt(e,t):!1}function KS(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function Q$e(){return{animate:KS(!0),whileInView:KS(),whileHover:KS(),whileTap:KS(),whileDrag:KS(),whileFocus:KS(),exit:KS()}}function Z$e(t,e){t.min=e.min,t.max=e.max}function hp(t,e){Z$e(t.x,e.x),Z$e(t.y,e.y)}function J$e(t,e){t.translate=e.translate,t.scale=e.scale,t.originPoint=e.originPoint,t.origin=e.origin}const vmt=1e-4,chn=1-vmt,dhn=1+vmt,ymt=.01,uhn=0-ymt,hhn=0+ymt;function Nu(t){return t.max-t.min}function mhn(t,e,n){return Math.abs(t-e)<=n}function X$e(t,e,n,r=.5){t.origin=r,t.originPoint=$o(e.min,e.max,t.origin),t.scale=Nu(n)/Nu(e),t.translate=$o(n.min,n.max,t.origin)-t.originPoint,(t.scale>=chn&&t.scale<=dhn||isNaN(t.scale))&&(t.scale=1),(t.translate>=uhn&&t.translate<=hhn||isNaN(t.translate))&&(t.translate=0)}function DD(t,e,n,r){X$e(t.x,e.x,n.x,r?r.originX:void 0),X$e(t.y,e.y,n.y,r?r.originY:void 0)}function eOe(t,e,n){t.min=n.min+e.min,t.max=t.min+Nu(e)}function fhn(t,e,n){eOe(t.x,e.x,n.x),eOe(t.y,e.y,n.y)}function tOe(t,e,n){t.min=e.min-n.min,t.max=t.min+Nu(e)}function PY(t,e,n){tOe(t.x,e.x,n.x),tOe(t.y,e.y,n.y)}function nOe(t,e,n,r,s){return t-=e,t=AY(t,1/n,r),s!==void 0&&(t=AY(t,1/s,r)),t}function phn(t,e=0,n=1,r=.5,s,i=t,o=t){if(fy.test(e)&&(e=parseFloat(e),e=$o(o.min,o.max,e/100)-o.min),typeof e!="number")return;let l=$o(i.min,i.max,r);t===i&&(l-=e),t.min=nOe(t.min,e,n,l,s),t.max=nOe(t.max,e,n,l,s)}function rOe(t,e,[n,r,s],i,o){phn(t,e[n],e[r],e[s],e.scale,i,o)}const ghn=["x","scaleX","originX"],vhn=["y","scaleY","originY"];function sOe(t,e,n,r){rOe(t.x,e,ghn,n?n.x:void 0,r?r.x:void 0),rOe(t.y,e,vhn,n?n.y:void 0,r?r.y:void 0)}function iOe(t){return t.translate===0&&t.scale===1}function bmt(t){return iOe(t.x)&&iOe(t.y)}function aOe(t,e){return t.min===e.min&&t.max===e.max}function yhn(t,e){return aOe(t.x,e.x)&&aOe(t.y,e.y)}function oOe(t,e){return Math.round(t.min)===Math.round(e.min)&&Math.round(t.max)===Math.round(e.max)}function xmt(t,e){return oOe(t.x,e.x)&&oOe(t.y,e.y)}function lOe(t){return Nu(t.x)/Nu(t.y)}function cOe(t,e){return t.translate===e.translate&&t.scale===e.scale&&t.originPoint===e.originPoint}function _v(t){return[t("x"),t("y")]}function bhn(t,e,n){let r="";const s=t.x.translate/e.x,i=t.y.translate/e.y,o=(n==null?void 0:n.z)||0;if((s||i||o)&&(r=`translate3d(${s}px, ${i}px, ${o}px) `),(e.x!==1||e.y!==1)&&(r+=`scale(${1/e.x}, ${1/e.y}) `),n){const{transformPerspective:d,rotate:u,rotateX:h,rotateY:m,skewX:f,skewY:p}=n;d&&(r=`perspective(${d}px) ${r}`),u&&(r+=`rotate(${u}deg) `),h&&(r+=`rotateX(${h}deg) `),m&&(r+=`rotateY(${m}deg) `),f&&(r+=`skewX(${f}deg) `),p&&(r+=`skewY(${p}deg) `)}const l=t.x.scale*e.x,c=t.y.scale*e.y;return(l!==1||c!==1)&&(r+=`scale(${l}, ${c})`),r||"none"}const wmt=["TopLeft","TopRight","BottomLeft","BottomRight"],xhn=wmt.length,dOe=t=>typeof t=="string"?parseFloat(t):t,uOe=t=>typeof t=="number"||ar.test(t);function whn(t,e,n,r,s,i){s?(t.opacity=$o(0,n.opacity??1,khn(r)),t.opacityExit=$o(e.opacity??1,0,Shn(r))):i&&(t.opacity=$o(e.opacity??1,n.opacity??1,r));for(let o=0;o<xhn;o++){const l=`border${wmt[o]}Radius`;let c=hOe(e,l),d=hOe(n,l);if(c===void 0&&d===void 0)continue;c||(c=0),d||(d=0),c===0||d===0||uOe(c)===uOe(d)?(t[l]=Math.max($o(dOe(c),dOe(d),r),0),(fy.test(d)||fy.test(c))&&(t[l]+="%")):t[l]=d}(e.rotate||n.rotate)&&(t.rotate=$o(e.rotate||0,n.rotate||0,r))}function hOe(t,e){return t[e]!==void 0?t[e]:t.borderRadius}const khn=kmt(0,.5,mht),Shn=kmt(.5,.95,Af);function kmt(t,e,n){return r=>r<t?0:r>e?1:n(WO(t,e,r))}function Chn(t,e,n){const r=Wd(t)?t:fR(t);return r.start(S2e("",r,e,n)),r.animation}function QO(t,e,n,r={passive:!0}){return t.addEventListener(e,n,r),()=>t.removeEventListener(e,n)}const jhn=(t,e)=>t.depth-e.depth;class Ehn{constructor(){this.children=[],this.isDirty=!1}add(e){c2e(this.children,e),this.isDirty=!0}remove(e){CY(this.children,e),this.isDirty=!0}forEach(e){this.isDirty&&this.children.sort(jhn),this.isDirty=!1,this.children.forEach(e)}}function Nhn(t,e){const n=Eu.now(),r=({timestamp:s})=>{const i=s-n;i>=e&&(Mk(r),t(i-e))};return Da.setup(r,!0),()=>Mk(r)}function IG(t){return Wd(t)?t.get():t}class Thn{constructor(){this.members=[]}add(e){c2e(this.members,e);for(let n=this.members.length-1;n>=0;n--){const r=this.members[n];if(r===e||r===this.lead||r===this.prevLead)continue;const s=r.instance;s&&s.isConnected===!1&&r.isPresent!==!1&&!r.snapshot&&CY(this.members,r)}e.scheduleRender()}remove(e){if(CY(this.members,e),e===this.prevLead&&(this.prevLead=void 0),e===this.lead){const n=this.members[this.members.length-1];n&&this.promote(n)}}relegate(e){const n=this.members.findIndex(s=>e===s);if(n===0)return!1;let r;for(let s=n;s>=0;s--){const i=this.members[s],o=i.instance;if(i.isPresent!==!1&&(!o||o.isConnected!==!1)){r=i;break}}return r?(this.promote(r),!0):!1}promote(e,n){const r=this.lead;if(e!==r&&(this.prevLead=r,this.lead=e,e.show(),r)){r.instance&&r.scheduleRender(),e.scheduleRender();const s=r.options.layoutDependency,i=e.options.layoutDependency;if(!(s!==void 0&&i!==void 0&&s===i)){const c=r.instance;c&&c.isConnected===!1&&!r.snapshot||(e.resumeFrom=r,n&&(e.resumeFrom.preserveOpacity=!0),r.snapshot&&(e.snapshot=r.snapshot,e.snapshot.latestValues=r.animationValues||r.latestValues),e.root&&e.root.isUpdating&&(e.isLayoutDirty=!0))}const{crossfade:l}=e.options;l===!1&&r.hide()}}exitAnimationComplete(){this.members.forEach(e=>{const{options:n,resumingFrom:r}=e;n.onExitComplete&&n.onExitComplete(),r&&r.options.onExitComplete&&r.options.onExitComplete()})}scheduleRender(){this.members.forEach(e=>{e.instance&&e.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}const MG={hasAnimatedSinceResize:!0,hasEverUpdated:!1},ble=["","X","Y","Z"],_hn=1e3;let Ahn=0;function xle(t,e,n,r){const{latestValues:s}=e;s[t]&&(n[t]=s[t],e.setStaticValue(t,0),r&&(r[t]=0))}function Smt(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:e}=t.options;if(!e)return;const n=Vht(e);if(window.MotionHasOptimisedAnimation(n,"transform")){const{layout:s,layoutId:i}=t.options;window.MotionCancelOptimisedAnimation(n,"transform",Da,!(s||i))}const{parent:r}=t;r&&!r.hasCheckedOptimisedAppear&&Smt(r)}function Cmt({attachResizeListener:t,defaultParent:e,measureScroll:n,checkIsScrollRoot:r,resetTransform:s}){return class{constructor(o={},l=e==null?void 0:e()){this.id=Ahn++,this.animationId=0,this.animationCommitId=0,this.children=new Set,this.options={},this.isTreeAnimating=!1,this.isAnimationBlocked=!1,this.isLayoutDirty=!1,this.isProjectionDirty=!1,this.isSharedProjectionDirty=!1,this.isTransformDirty=!1,this.updateManuallyBlocked=!1,this.updateBlockedByResize=!1,this.isUpdating=!1,this.isSVG=!1,this.needsReset=!1,this.shouldResetTransform=!1,this.hasCheckedOptimisedAppear=!1,this.treeScale={x:1,y:1},this.eventHandlers=new Map,this.hasTreeAnimated=!1,this.layoutVersion=0,this.updateScheduled=!1,this.scheduleUpdate=()=>this.update(),this.projectionUpdateScheduled=!1,this.checkUpdateFailed=()=>{this.isUpdating&&(this.isUpdating=!1,this.clearAllSnapshots())},this.updateProjection=()=>{this.projectionUpdateScheduled=!1,this.nodes.forEach(Ihn),this.nodes.forEach($hn),this.nodes.forEach(Ohn),this.nodes.forEach(Mhn)},this.resolvedRelativeTargetAt=0,this.linkedParentVersion=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=o,this.root=l?l.root||l:this,this.path=l?[...l.path,l]:[],this.parent=l,this.depth=l?l.depth+1:0;for(let c=0;c<this.path.length;c++)this.path[c].shouldResetTransform=!0;this.root===this&&(this.nodes=new Ehn)}addEventListener(o,l){return this.eventHandlers.has(o)||this.eventHandlers.set(o,new d2e),this.eventHandlers.get(o).add(l)}notifyListeners(o,...l){const c=this.eventHandlers.get(o);c&&c.notify(...l)}hasListeners(o){return this.eventHandlers.has(o)}mount(o){if(this.instance)return;this.isSVG=_2e(o)&&!Iun(o),this.instance=o;const{layoutId:l,layout:c,visualElement:d}=this.options;if(d&&!d.current&&d.mount(o),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(c||l)&&(this.isLayoutDirty=!0),t){let u,h=0;const m=()=>this.root.updateBlockedByResize=!1;Da.read(()=>{h=window.innerWidth}),t(o,()=>{const f=window.innerWidth;f!==h&&(h=f,this.root.updateBlockedByResize=!0,u&&u(),u=Nhn(m,250),MG.hasAnimatedSinceResize&&(MG.hasAnimatedSinceResize=!1,this.nodes.forEach(pOe)))})}l&&this.root.registerSharedNode(l,this),this.options.animate!==!1&&d&&(l||c)&&this.addEventListener("didUpdate",({delta:u,hasLayoutChanged:h,hasRelativeLayoutChanged:m,layout:f})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const p=this.options.transition||d.getDefaultTransition()||Vhn,{onLayoutAnimationStart:g,onLayoutAnimationComplete:v}=d.getProps(),b=!this.targetLayout||!xmt(this.targetLayout,f),x=!h&&m;if(this.options.layoutRoot||this.resumeFrom||x||h&&(b||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const w={...k2e(p,"layout"),onPlay:g,onComplete:v};(d.shouldReduceMotion||this.options.layoutRoot)&&(w.delay=0,w.type=!1),this.startAnimation(w),this.setAnimationOrigin(u,x)}else h||pOe(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=f})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const o=this.getStack();o&&o.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Mk(this.updateProjection)}blockUpdate(){this.updateManuallyBlocked=!0}unblockUpdate(){this.updateManuallyBlocked=!1}isUpdateBlocked(){return this.updateManuallyBlocked||this.updateBlockedByResize}isTreeAnimationBlocked(){return this.isAnimationBlocked||this.parent&&this.parent.isTreeAnimationBlocked()||!1}startUpdate(){this.isUpdateBlocked()||(this.isUpdating=!0,this.nodes&&this.nodes.forEach(Fhn),this.animationId++)}getTransformTemplate(){const{visualElement:o}=this.options;return o&&o.getProps().transformTemplate}willUpdate(o=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&Smt(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let u=0;u<this.path.length;u++){const h=this.path[u];h.shouldResetTransform=!0,h.updateScroll("snapshot"),h.options.layoutRoot&&h.willUpdate(!1)}const{layoutId:l,layout:c}=this.options;if(l===void 0&&!c)return;const d=this.getTransformTemplate();this.prevTransformTemplateValue=d?d(this.latestValues,""):void 0,this.updateSnapshot(),o&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(mOe);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(fOe);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(Dhn),this.nodes.forEach(Phn),this.nodes.forEach(Rhn)):this.nodes.forEach(fOe),this.clearAllSnapshots();const l=Eu.now();id.delta=Ny(0,1e3/60,l-id.timestamp),id.timestamp=l,id.isProcessing=!0,ule.update.process(id),ule.preRender.process(id),ule.render.process(id),id.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,N2e.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(Lhn),this.sharedNodes.forEach(Bhn)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Da.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Da.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!Nu(this.snapshot.measuredBox.x)&&!Nu(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let c=0;c<this.path.length;c++)this.path[c].updateScroll();const o=this.layout;this.layout=this.measure(!1),this.layoutVersion++,this.layoutCorrected=lc(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:l}=this.options;l&&l.notify("LayoutMeasure",this.layout.layoutBox,o?o.layoutBox:void 0)}updateScroll(o="measure"){let l=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===o&&(l=!1),l&&this.instance){const c=r(this.instance);this.scroll={animationId:this.root.animationId,phase:o,isRoot:c,offset:n(this.instance),wasRoot:this.scroll?this.scroll.isRoot:c}}}resetTransform(){if(!s)return;const o=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,l=this.projectionDelta&&!bmt(this.projectionDelta),c=this.getTransformTemplate(),d=c?c(this.latestValues,""):void 0,u=d!==this.prevTransformTemplateValue;o&&this.instance&&(l||xC(this.latestValues)||u)&&(s(this.instance,d),this.shouldResetTransform=!1,this.scheduleRender())}measure(o=!0){const l=this.measurePageBox();let c=this.removeElementScroll(l);return o&&(c=this.removeTransform(c)),Hhn(c),{animationId:this.root.animationId,measuredBox:l,layoutBox:c,latestValues:{},source:this.id}}measurePageBox(){var d;const{visualElement:o}=this.options;if(!o)return lc();const l=o.measureViewportBox();if(!(((d=this.scroll)==null?void 0:d.wasRoot)||this.path.some(Ghn))){const{scroll:u}=this.root;u&&(lA(l.x,u.offset.x),lA(l.y,u.offset.y))}return l}removeElementScroll(o){var c;const l=lc();if(hp(l,o),(c=this.scroll)!=null&&c.wasRoot)return l;for(let d=0;d<this.path.length;d++){const u=this.path[d],{scroll:h,options:m}=u;u!==this.root&&h&&m.layoutScroll&&(h.wasRoot&&hp(l,o),lA(l.x,h.offset.x),lA(l.y,h.offset.y))}return l}applyTransform(o,l=!1){const c=lc();hp(c,o);for(let d=0;d<this.path.length;d++){const u=this.path[d];!l&&u.options.layoutScroll&&u.scroll&&u!==u.root&&cA(c,{x:-u.scroll.offset.x,y:-u.scroll.offset.y}),xC(u.latestValues)&&cA(c,u.latestValues)}return xC(this.latestValues)&&cA(c,this.latestValues),c}removeTransform(o){const l=lc();hp(l,o);for(let c=0;c<this.path.length;c++){const d=this.path[c];if(!d.instance||!xC(d.latestValues))continue;Kge(d.latestValues)&&d.updateSnapshot();const u=lc(),h=d.measurePageBox();hp(u,h),sOe(l,d.latestValues,d.snapshot?d.snapshot.layoutBox:void 0,u)}return xC(this.latestValues)&&sOe(l,this.latestValues),l}setTargetDelta(o){this.targetDelta=o,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(o){this.options={...this.options,...o,crossfade:o.crossfade!==void 0?o.crossfade:!0}}clearMeasurements(){this.scroll=void 0,this.layout=void 0,this.snapshot=void 0,this.prevTransformTemplateValue=void 0,this.targetDelta=void 0,this.target=void 0,this.isLayoutDirty=!1}forceRelativeParentToResolveTarget(){this.relativeParent&&this.relativeParent.resolvedRelativeTargetAt!==id.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(o=!1){var f;const l=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=l.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=l.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=l.isSharedProjectionDirty);const c=!!this.resumingFrom||this!==l;if(!(o||c&&this.isSharedProjectionDirty||this.isProjectionDirty||(f=this.parent)!=null&&f.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:u,layoutId:h}=this.options;if(!this.layout||!(u||h))return;this.resolvedRelativeTargetAt=id.timestamp;const m=this.getClosestProjectingParent();m&&this.linkedParentVersion!==m.layoutVersion&&!m.options.layoutRoot&&this.removeRelativeTarget(),!this.targetDelta&&!this.relativeTarget&&(m&&m.layout?this.createRelativeTarget(m,this.layout.layoutBox,m.layout.layoutBox):this.removeRelativeTarget()),!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=lc(),this.targetWithTransforms=lc()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),fhn(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):hp(this.target,this.layout.layoutBox),omt(this.target,this.targetDelta)):hp(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget&&(this.attemptToResolveRelativeTarget=!1,m&&!!m.resumingFrom==!!this.resumingFrom&&!m.options.layoutScroll&&m.target&&this.animationProgress!==1?this.createRelativeTarget(m,this.target,m.target):this.relativeParent=this.relativeTarget=void 0))}getClosestProjectingParent(){if(!(!this.parent||Kge(this.parent.latestValues)||amt(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}createRelativeTarget(o,l,c){this.relativeParent=o,this.linkedParentVersion=o.layoutVersion,this.forceRelativeParentToResolveTarget(),this.relativeTarget=lc(),this.relativeTargetOrigin=lc(),PY(this.relativeTargetOrigin,l,c),hp(this.relativeTarget,this.relativeTargetOrigin)}removeRelativeTarget(){this.relativeParent=this.relativeTarget=void 0}calcProjection(){var p;const o=this.getLead(),l=!!this.resumingFrom||this!==o;let c=!0;if((this.isProjectionDirty||(p=this.parent)!=null&&p.isProjectionDirty)&&(c=!1),l&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(c=!1),this.resolvedRelativeTargetAt===id.timestamp&&(c=!1),c)return;const{layout:d,layoutId:u}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(d||u))return;hp(this.layoutCorrected,this.layout.layoutBox);const h=this.treeScale.x,m=this.treeScale.y;Vun(this.layoutCorrected,this.treeScale,this.path,l),o.layout&&!o.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(o.target=o.layout.layoutBox,o.targetWithTransforms=lc());const{target:f}=o;if(!f){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(J$e(this.prevProjectionDelta.x,this.projectionDelta.x),J$e(this.prevProjectionDelta.y,this.projectionDelta.y)),DD(this.projectionDelta,this.layoutCorrected,f,this.latestValues),(this.treeScale.x!==h||this.treeScale.y!==m||!cOe(this.projectionDelta.x,this.prevProjectionDelta.x)||!cOe(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",f))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(o=!0){var l;if((l=this.options.visualElement)==null||l.scheduleRender(),o){const c=this.getStack();c&&c.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=oA(),this.projectionDelta=oA(),this.projectionDeltaWithTransform=oA()}setAnimationOrigin(o,l=!1){const c=this.snapshot,d=c?c.latestValues:{},u={...this.latestValues},h=oA();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!l;const m=lc(),f=c?c.source:void 0,p=this.layout?this.layout.source:void 0,g=f!==p,v=this.getStack(),b=!v||v.members.length<=1,x=!!(g&&!b&&this.options.crossfade===!0&&!this.path.some(zhn));this.animationProgress=0;let w;this.mixTargetDelta=k=>{const S=k/1e3;gOe(h.x,o.x,S),gOe(h.y,o.y,S),this.setTargetDelta(h),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(PY(m,this.layout.layoutBox,this.relativeParent.layout.layoutBox),Uhn(this.relativeTarget,this.relativeTargetOrigin,m,S),w&&yhn(this.relativeTarget,w)&&(this.isProjectionDirty=!1),w||(w=lc()),hp(w,this.relativeTarget)),g&&(this.animationValues=u,whn(u,d,this.latestValues,S,x,b)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=S},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(o){var l,c,d;this.notifyListeners("animationStart"),(l=this.currentAnimation)==null||l.stop(),(d=(c=this.resumingFrom)==null?void 0:c.currentAnimation)==null||d.stop(),this.pendingAnimation&&(Mk(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Da.update(()=>{MG.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=fR(0)),this.currentAnimation=Chn(this.motionValue,[0,1e3],{...o,velocity:0,isSync:!0,onUpdate:u=>{this.mixTargetDelta(u),o.onUpdate&&o.onUpdate(u)},onStop:()=>{},onComplete:()=>{o.onComplete&&o.onComplete(),this.completeAnimation()}}),this.resumingFrom&&(this.resumingFrom.currentAnimation=this.currentAnimation),this.pendingAnimation=void 0})}completeAnimation(){this.resumingFrom&&(this.resumingFrom.currentAnimation=void 0,this.resumingFrom.preserveOpacity=void 0);const o=this.getStack();o&&o.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(_hn),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const o=this.getLead();let{targetWithTransforms:l,target:c,layout:d,latestValues:u}=o;if(!(!l||!c||!d)){if(this!==o&&this.layout&&d&&jmt(this.options.animationType,this.layout.layoutBox,d.layoutBox)){c=this.target||lc();const h=Nu(this.layout.layoutBox.x);c.x.min=o.target.x.min,c.x.max=c.x.min+h;const m=Nu(this.layout.layoutBox.y);c.y.min=o.target.y.min,c.y.max=c.y.min+m}hp(l,c),cA(l,u),DD(this.projectionDeltaWithTransform,this.layoutCorrected,l,u)}}registerSharedNode(o,l){this.sharedNodes.has(o)||this.sharedNodes.set(o,new Thn),this.sharedNodes.get(o).add(l);const d=l.options.initialPromotionConfig;l.promote({transition:d?d.transition:void 0,preserveFollowOpacity:d&&d.shouldPreserveFollowOpacity?d.shouldPreserveFollowOpacity(l):void 0})}isLead(){const o=this.getStack();return o?o.lead===this:!0}getLead(){var l;const{layoutId:o}=this.options;return o?((l=this.getStack())==null?void 0:l.lead)||this:this}getPrevLead(){var l;const{layoutId:o}=this.options;return o?(l=this.getStack())==null?void 0:l.prevLead:void 0}getStack(){const{layoutId:o}=this.options;if(o)return this.root.sharedNodes.get(o)}promote({needsReset:o,transition:l,preserveFollowOpacity:c}={}){const d=this.getStack();d&&d.promote(this,c),o&&(this.projectionDelta=void 0,this.needsReset=!0),l&&this.setOptions({transition:l})}relegate(){const o=this.getStack();return o?o.relegate(this):!1}resetSkewAndRotation(){const{visualElement:o}=this.options;if(!o)return;let l=!1;const{latestValues:c}=o;if((c.z||c.rotate||c.rotateX||c.rotateY||c.rotateZ||c.skewX||c.skewY)&&(l=!0),!l)return;const d={};c.z&&xle("z",o,d,this.animationValues);for(let u=0;u<ble.length;u++)xle(`rotate${ble[u]}`,o,d,this.animationValues),xle(`skew${ble[u]}`,o,d,this.animationValues);o.render();for(const u in d)o.setStaticValue(u,d[u]),this.animationValues&&(this.animationValues[u]=d[u]);o.scheduleRender()}applyProjectionStyles(o,l){if(!this.instance||this.isSVG)return;if(!this.isVisible){o.visibility="hidden";return}const c=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,o.visibility="",o.opacity="",o.pointerEvents=IG(l==null?void 0:l.pointerEvents)||"",o.transform=c?c(this.latestValues,""):"none";return}const d=this.getLead();if(!this.projectionDelta||!this.layout||!d.target){this.options.layoutId&&(o.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,o.pointerEvents=IG(l==null?void 0:l.pointerEvents)||""),this.hasProjected&&!xC(this.latestValues)&&(o.transform=c?c({},""):"none",this.hasProjected=!1);return}o.visibility="";const u=d.animationValues||d.latestValues;this.applyTransformsToTarget();let h=bhn(this.projectionDeltaWithTransform,this.treeScale,u);c&&(h=c(u,h)),o.transform=h;const{x:m,y:f}=this.projectionDelta;o.transformOrigin=`${m.origin*100}% ${f.origin*100}% 0`,d.animationValues?o.opacity=d===this?u.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:u.opacityExit:o.opacity=d===this?u.opacity!==void 0?u.opacity:"":u.opacityExit!==void 0?u.opacityExit:0;for(const p in Qge){if(u[p]===void 0)continue;const{correct:g,applyTo:v,isCSSVariable:b}=Qge[p],x=h==="none"?u[p]:g(u[p],d);if(v){const w=v.length;for(let k=0;k<w;k++)o[v[k]]=x}else b?this.options.visualElement.renderState.vars[p]=x:o[p]=x}this.options.layoutId&&(o.pointerEvents=d===this?IG(l==null?void 0:l.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(o=>{var l;return(l=o.currentAnimation)==null?void 0:l.stop()}),this.root.nodes.forEach(mOe),this.root.sharedNodes.clear()}}}function Phn(t){t.updateLayout()}function Rhn(t){var n;const e=((n=t.resumeFrom)==null?void 0:n.snapshot)||t.snapshot;if(t.isLead()&&t.layout&&e&&t.hasListeners("didUpdate")){const{layoutBox:r,measuredBox:s}=t.layout,{animationType:i}=t.options,o=e.source!==t.layout.source;i==="size"?_v(h=>{const m=o?e.measuredBox[h]:e.layoutBox[h],f=Nu(m);m.min=r[h].min,m.max=m.min+f}):jmt(i,e.layoutBox,r)&&_v(h=>{const m=o?e.measuredBox[h]:e.layoutBox[h],f=Nu(r[h]);m.max=m.min+f,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[h].max=t.relativeTarget[h].min+f)});const l=oA();DD(l,r,e.layoutBox);const c=oA();o?DD(c,t.applyTransform(s,!0),e.measuredBox):DD(c,r,e.layoutBox);const d=!bmt(l);let u=!1;if(!t.resumeFrom){const h=t.getClosestProjectingParent();if(h&&!h.resumeFrom){const{snapshot:m,layout:f}=h;if(m&&f){const p=lc();PY(p,e.layoutBox,m.layoutBox);const g=lc();PY(g,r,f.layoutBox),xmt(p,g)||(u=!0),h.options.layoutRoot&&(t.relativeTarget=g,t.relativeTargetOrigin=p,t.relativeParent=h)}}}t.notifyListeners("didUpdate",{layout:r,snapshot:e,delta:c,layoutDelta:l,hasLayoutChanged:d,hasRelativeLayoutChanged:u})}else if(t.isLead()){const{onExitComplete:r}=t.options;r&&r()}t.options.transition=void 0}function Ihn(t){t.parent&&(t.isProjecting()||(t.isProjectionDirty=t.parent.isProjectionDirty),t.isSharedProjectionDirty||(t.isSharedProjectionDirty=!!(t.isProjectionDirty||t.parent.isProjectionDirty||t.parent.isSharedProjectionDirty)),t.isTransformDirty||(t.isTransformDirty=t.parent.isTransformDirty))}function Mhn(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function Lhn(t){t.clearSnapshot()}function mOe(t){t.clearMeasurements()}function fOe(t){t.isLayoutDirty=!1}function Dhn(t){const{visualElement:e}=t.options;e&&e.getProps().onBeforeLayoutMeasure&&e.notify("BeforeLayoutMeasure"),t.resetTransform()}function pOe(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function $hn(t){t.resolveTargetDelta()}function Ohn(t){t.calcProjection()}function Fhn(t){t.resetSkewAndRotation()}function Bhn(t){t.removeLeadSnapshot()}function gOe(t,e,n){t.translate=$o(e.translate,0,n),t.scale=$o(e.scale,1,n),t.origin=e.origin,t.originPoint=e.originPoint}function vOe(t,e,n,r){t.min=$o(e.min,n.min,r),t.max=$o(e.max,n.max,r)}function Uhn(t,e,n,r){vOe(t.x,e.x,n.x,r),vOe(t.y,e.y,n.y,r)}function zhn(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const Vhn={duration:.45,ease:[.4,0,.1,1]},yOe=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),bOe=yOe("applewebkit/")&&!yOe("chrome/")?Math.round:Af;function xOe(t){t.min=bOe(t.min),t.max=bOe(t.max)}function Hhn(t){xOe(t.x),xOe(t.y)}function jmt(t,e,n){return t==="position"||t==="preserve-aspect"&&!mhn(lOe(e),lOe(n),.2)}function Ghn(t){var e;return t!==t.root&&((e=t.scroll)==null?void 0:e.wasRoot)}const Whn=Cmt({attachResizeListener:(t,e)=>QO(t,"resize",e),measureScroll:()=>{var t,e;return{x:document.documentElement.scrollLeft||((t=document.body)==null?void 0:t.scrollLeft)||0,y:document.documentElement.scrollTop||((e=document.body)==null?void 0:e.scrollTop)||0}},checkIsScrollRoot:()=>!0}),wle={current:void 0},Emt=Cmt({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!wle.current){const t=new Whn({});t.mount(window),t.setOptions({layoutScroll:!0}),wle.current=t}return wle.current},resetTransform:(t,e)=>{t.style.transform=e!==void 0?e:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),L2e=y.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function wOe(t,e){if(typeof t=="function")return t(e);t!=null&&(t.current=e)}function qhn(...t){return e=>{let n=!1;const r=t.map(s=>{const i=wOe(s,e);return!n&&typeof i=="function"&&(n=!0),i});if(n)return()=>{for(let s=0;s<r.length;s++){const i=r[s];typeof i=="function"?i():wOe(t[s],null)}}}}function Khn(...t){return y.useCallback(qhn(...t),t)}class Yhn extends y.Component{getSnapshotBeforeUpdate(e){const n=this.props.childRef.current;if(n&&e.isPresent&&!this.props.isPresent&&this.props.pop!==!1){const r=n.offsetParent,s=qge(r)&&r.offsetWidth||0,i=qge(r)&&r.offsetHeight||0,o=this.props.sizeRef.current;o.height=n.offsetHeight||0,o.width=n.offsetWidth||0,o.top=n.offsetTop,o.left=n.offsetLeft,o.right=s-o.width-o.left,o.bottom=i-o.height-o.top}return null}componentDidUpdate(){}render(){return this.props.children}}function Qhn({children:t,isPresent:e,anchorX:n,anchorY:r,root:s,pop:i}){var m;const o=y.useId(),l=y.useRef(null),c=y.useRef({width:0,height:0,top:0,left:0,right:0,bottom:0}),{nonce:d}=y.useContext(L2e),u=((m=t.props)==null?void 0:m.ref)??(t==null?void 0:t.ref),h=Khn(l,u);return y.useInsertionEffect(()=>{const{width:f,height:p,top:g,left:v,right:b,bottom:x}=c.current;if(e||i===!1||!l.current||!f||!p)return;const w=n==="left"?`left: ${v}`:`right: ${b}`,k=r==="bottom"?`bottom: ${x}`:`top: ${g}`;l.current.dataset.motionPopId=o;const S=document.createElement("style");d&&(S.nonce=d);const C=s??document.head;return C.appendChild(S),S.sheet&&S.sheet.insertRule(`
          [data-motion-pop-id="${o}"] {
            position: absolute !important;
            width: ${f}px !important;
            height: ${p}px !important;
            ${w}px !important;
            ${k}px !important;
          }
        `),()=>{C.contains(S)&&C.removeChild(S)}},[e]),a.jsx(Yhn,{isPresent:e,childRef:l,sizeRef:c,pop:i,children:i===!1?t:y.cloneElement(t,{ref:h})})}const Zhn=({children:t,initial:e,isPresent:n,onExitComplete:r,custom:s,presenceAffectsLayout:i,mode:o,anchorX:l,anchorY:c,root:d})=>{const u=l2e(Jhn),h=y.useId();let m=!0,f=y.useMemo(()=>(m=!1,{id:h,initial:e,isPresent:n,custom:s,onExitComplete:p=>{u.set(p,!0);for(const g of u.values())if(!g)return;r&&r()},register:p=>(u.set(p,!1),()=>u.delete(p))}),[n,u,r]);return i&&m&&(f={...f}),y.useMemo(()=>{u.forEach((p,g)=>u.set(g,!1))},[n]),y.useEffect(()=>{!n&&!u.size&&r&&r()},[n]),t=a.jsx(Qhn,{pop:o==="popLayout",isPresent:n,anchorX:l,anchorY:c,root:d,children:t}),a.jsx(yte.Provider,{value:f,children:t})};function Jhn(){return new Map}function Nmt(t=!0){const e=y.useContext(yte);if(e===null)return[!0,null];const{isPresent:n,onExitComplete:r,register:s}=e,i=y.useId();y.useEffect(()=>{if(t)return s(i)},[t]);const o=y.useCallback(()=>t&&r&&r(i),[i,r,t]);return!n&&r?[!1,o]:[!0]}const oz=t=>t.key||"";function kOe(t){const e=[];return y.Children.forEach(t,n=>{y.isValidElement(n)&&e.push(n)}),e}const Al=({children:t,custom:e,initial:n=!0,onExitComplete:r,presenceAffectsLayout:s=!0,mode:i="sync",propagate:o=!1,anchorX:l="left",anchorY:c="top",root:d})=>{const[u,h]=Nmt(o),m=y.useMemo(()=>kOe(t),[t]),f=o&&!u?[]:m.map(oz),p=y.useRef(!0),g=y.useRef(m),v=l2e(()=>new Map),b=y.useRef(new Set),[x,w]=y.useState(m),[k,S]=y.useState(m);tht(()=>{p.current=!1,g.current=m;for(let E=0;E<k.length;E++){const N=oz(k[E]);f.includes(N)?(v.delete(N),b.current.delete(N)):v.get(N)!==!0&&v.set(N,!1)}},[k,f.length,f.join("-")]);const C=[];if(m!==x){let E=[...m];for(let N=0;N<k.length;N++){const A=k[N],_=oz(A);f.includes(_)||(E.splice(N,0,A),C.push(A))}return i==="wait"&&C.length&&(E=C),S(kOe(E)),w(m),null}const{forceRender:j}=y.useContext(o2e);return a.jsx(a.Fragment,{children:k.map(E=>{const N=oz(E),A=o&&!u?!1:m===k||f.includes(N),_=()=>{if(b.current.has(N))return;if(b.current.add(N),v.has(N))v.set(N,!0);else return;let T=!0;v.forEach(R=>{R||(T=!1)}),T&&(j==null||j(),S(g.current),o&&(h==null||h()),r&&r())};return a.jsx(Zhn,{isPresent:A,initial:!p.current||n?void 0:!1,custom:e,presenceAffectsLayout:s,mode:i,root:d,onExitComplete:A?void 0:_,anchorX:l,anchorY:c,children:E},N)})})},Tmt=y.createContext({strict:!1}),SOe={animation:["animate","variants","whileHover","whileTap","exit","whileInView","whileFocus","whileDrag"],exit:["exit"],drag:["drag","dragControls"],focus:["whileFocus"],hover:["whileHover","onHoverStart","onHoverEnd"],tap:["whileTap","onTap","onTapStart","onTapCancel"],pan:["onPan","onPanStart","onPanSessionStart","onPanEnd"],inView:["whileInView","onViewportEnter","onViewportLeave"],layout:["layout","layoutId"]};let COe=!1;function Xhn(){if(COe)return;const t={};for(const e in SOe)t[e]={isEnabled:n=>SOe[e].some(r=>!!n[r])};rmt(t),COe=!0}function _mt(){return Xhn(),Fun()}function emn(t){const e=_mt();for(const n in t)e[n]={...e[n],...t[n]};rmt(e)}const tmn=new Set(["animate","exit","variants","initial","style","values","variants","transition","transformTemplate","custom","inherit","onBeforeLayoutMeasure","onAnimationStart","onAnimationComplete","onUpdate","onDragStart","onDrag","onDragEnd","onMeasureDragConstraints","onDirectionLock","onDragTransitionEnd","_dragX","_dragY","onHoverStart","onHoverEnd","onViewportEnter","onViewportLeave","globalTapTarget","propagate","ignoreStrict","viewport"]);function RY(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||tmn.has(t)}let Amt=t=>!RY(t);function nmn(t){typeof t=="function"&&(Amt=e=>e.startsWith("on")?!RY(e):t(e))}try{nmn(require("@emotion/is-prop-valid").default)}catch{}function rmn(t,e,n){const r={};for(const s in t)s==="values"&&typeof t.values=="object"||(Amt(s)||n===!0&&RY(s)||!e&&!RY(s)||t.draggable&&s.startsWith("onDrag"))&&(r[s]=t[s]);return r}const kte=y.createContext({});function smn(t,e){if(wte(t)){const{initial:n,animate:r}=t;return{initial:n===!1||YO(n)?n:void 0,animate:YO(r)?r:void 0}}return t.inherit!==!1?e:{}}function imn(t){const{initial:e,animate:n}=smn(t,y.useContext(kte));return y.useMemo(()=>({initial:e,animate:n}),[jOe(e),jOe(n)])}function jOe(t){return Array.isArray(t)?t.join(" "):t}const D2e=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function Pmt(t,e,n){for(const r in e)!Wd(e[r])&&!dmt(r,n)&&(t[r]=e[r])}function amn({transformTemplate:t},e){return y.useMemo(()=>{const n=D2e();return I2e(n,e,t),Object.assign({},n.vars,n.style)},[e])}function omn(t,e){const n=t.style||{},r={};return Pmt(r,n,t),Object.assign(r,amn(t,e)),r}function lmn(t,e){const n={},r=omn(t,e);return t.drag&&t.dragListener!==!1&&(n.draggable=!1,r.userSelect=r.WebkitUserSelect=r.WebkitTouchCallout="none",r.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(n.tabIndex=0),n.style=r,n}const Rmt=()=>({...D2e(),attrs:{}});function cmn(t,e,n,r){const s=y.useMemo(()=>{const i=Rmt();return umt(i,e,mmt(r),t.transformTemplate,t.style),{...i.attrs,style:{...i.style}}},[e]);if(t.style){const i={};Pmt(i,t.style,t),s.style={...i,...s.style}}return s}const dmn=["animate","circle","defs","desc","ellipse","g","image","line","filter","marker","mask","metadata","path","pattern","polygon","polyline","rect","stop","switch","symbol","svg","text","tspan","use","view"];function $2e(t){return typeof t!="string"||t.includes("-")?!1:!!(dmn.indexOf(t)>-1||/[A-Z]/u.test(t))}function umn(t,e,n,{latestValues:r},s,i=!1,o){const c=(o??$2e(t)?cmn:lmn)(e,r,s,t),d=rmn(e,typeof t=="string",i),u=t!==y.Fragment?{...d,...c,ref:n}:{},{children:h}=e,m=y.useMemo(()=>Wd(h)?h.get():h,[h]);return y.createElement(t,{...u,children:m})}function hmn({scrapeMotionValuesFromProps:t,createRenderState:e},n,r,s){return{latestValues:mmn(n,r,s,t),renderState:e()}}function mmn(t,e,n,r){const s={},i=r(t,{});for(const m in i)s[m]=IG(i[m]);let{initial:o,animate:l}=t;const c=wte(t),d=tmt(t);e&&d&&!c&&t.inherit!==!1&&(o===void 0&&(o=e.initial),l===void 0&&(l=e.animate));let u=n?n.initial===!1:!1;u=u||o===!1;const h=u?l:o;if(h&&typeof h!="boolean"&&!xte(h)){const m=Array.isArray(h)?h:[h];for(let f=0;f<m.length;f++){const p=C2e(t,m[f]);if(p){const{transitionEnd:g,transition:v,...b}=p;for(const x in b){let w=b[x];if(Array.isArray(w)){const k=u?w.length-1:0;w=w[k]}w!==null&&(s[x]=w)}for(const x in g)s[x]=g[x]}}}return s}const Imt=t=>(e,n)=>{const r=y.useContext(kte),s=y.useContext(yte),i=()=>hmn(t,e,r,s);return n?i():l2e(i)},fmn=Imt({scrapeMotionValuesFromProps:M2e,createRenderState:D2e}),pmn=Imt({scrapeMotionValuesFromProps:fmt,createRenderState:Rmt}),gmn=Symbol.for("motionComponentSymbol");function vmn(t,e,n){const r=y.useRef(n);y.useInsertionEffect(()=>{r.current=n});const s=y.useRef(null);return y.useCallback(i=>{var l;i&&((l=t.onMount)==null||l.call(t,i)),e&&(i?e.mount(i):e.unmount());const o=r.current;if(typeof o=="function")if(i){const c=o(i);typeof c=="function"&&(s.current=c)}else s.current?(s.current(),s.current=null):o(i);else o&&(o.current=i)},[e])}const Mmt=y.createContext({});function e_(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function ymn(t,e,n,r,s,i){var w,k;const{visualElement:o}=y.useContext(kte),l=y.useContext(Tmt),c=y.useContext(yte),d=y.useContext(L2e),u=d.reducedMotion,h=d.skipAnimations,m=y.useRef(null),f=y.useRef(!1);r=r||l.renderer,!m.current&&r&&(m.current=r(t,{visualState:e,parent:o,props:n,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u,skipAnimations:h,isSVG:i}),f.current&&m.current&&(m.current.manuallyAnimateOnMount=!0));const p=m.current,g=y.useContext(Mmt);p&&!p.projection&&s&&(p.type==="html"||p.type==="svg")&&bmn(m.current,n,s,g);const v=y.useRef(!1);y.useInsertionEffect(()=>{p&&v.current&&p.update(n,c)});const b=n[zht],x=y.useRef(!!b&&!((w=window.MotionHandoffIsComplete)!=null&&w.call(window,b))&&((k=window.MotionHasOptimisedAnimation)==null?void 0:k.call(window,b)));return tht(()=>{f.current=!0,p&&(v.current=!0,window.MotionIsMounted=!0,p.updateFeatures(),p.scheduleRenderMicrotask(),x.current&&p.animationState&&p.animationState.animateChanges())}),y.useEffect(()=>{p&&(!x.current&&p.animationState&&p.animationState.animateChanges(),x.current&&(queueMicrotask(()=>{var S;(S=window.MotionHandoffMarkAsComplete)==null||S.call(window,b)}),x.current=!1),p.enteringChildren=void 0)}),p}function bmn(t,e,n,r){const{layoutId:s,layout:i,drag:o,dragConstraints:l,layoutScroll:c,layoutRoot:d,layoutCrossfade:u}=e;t.projection=new n(t.latestValues,e["data-framer-portal-id"]?void 0:Lmt(t.parent)),t.projection.setOptions({layoutId:s,layout:i,alwaysMeasureLayout:!!o||l&&e_(l),visualElement:t,animationType:typeof i=="string"?i:"both",initialPromotionConfig:r,crossfade:u,layoutScroll:c,layoutRoot:d})}function Lmt(t){if(t)return t.options.allowProjection!==!1?t.projection:Lmt(t.parent)}function kle(t,{forwardMotionProps:e=!1,type:n}={},r,s){r&&emn(r);const i=n?n==="svg":$2e(t),o=i?pmn:fmn;function l(d,u){let h;const m={...y.useContext(L2e),...d,layoutId:xmn(d)},{isStatic:f}=m,p=imn(d),g=o(d,f);if(!f&&eht){wmn();const v=kmn(m);h=v.MeasureLayout,p.visualElement=ymn(t,g,m,s,v.ProjectionNode,i)}return a.jsxs(kte.Provider,{value:p,children:[h&&p.visualElement?a.jsx(h,{visualElement:p.visualElement,...m}):null,umn(t,d,vmn(g,p.visualElement,u),g,f,e,i)]})}l.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const c=y.forwardRef(l);return c[gmn]=t,c}function xmn({layoutId:t}){const e=y.useContext(o2e).id;return e&&t!==void 0?e+"-"+t:t}function wmn(t,e){y.useContext(Tmt).strict}function kmn(t){const e=_mt(),{drag:n,layout:r}=e;if(!n&&!r)return{};const s={...n,...r};return{MeasureLayout:n!=null&&n.isEnabled(t)||r!=null&&r.isEnabled(t)?s.MeasureLayout:void 0,ProjectionNode:s.ProjectionNode}}function Smn(t,e){if(typeof Proxy>"u")return kle;const n=new Map,r=(i,o)=>kle(i,o,t,e),s=(i,o)=>r(i,o);return new Proxy(s,{get:(i,o)=>o==="create"?r:(n.has(o)||n.set(o,kle(o,void 0,t,e)),n.get(o))})}const Cmn=(t,e)=>e.isSVG??$2e(t)?new nhn(e):new Qun(e,{allowProjection:t!==y.Fragment});class jmn extends yS{constructor(e){super(e),e.animationState||(e.animationState=ohn(e))}updateAnimationControlsSubscription(){const{animate:e}=this.node.getProps();xte(e)&&(this.unmountControls=e.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:e}=this.node.getProps(),{animate:n}=this.node.prevProps||{};e!==n&&this.updateAnimationControlsSubscription()}unmount(){var e;this.node.animationState.reset(),(e=this.unmountControls)==null||e.call(this)}}let Emn=0;class Nmn extends yS{constructor(){super(...arguments),this.id=Emn++}update(){if(!this.node.presenceContext)return;const{isPresent:e,onExitComplete:n}=this.node.presenceContext,{isPresent:r}=this.node.prevPresenceContext||{};if(!this.node.animationState||e===r)return;const s=this.node.animationState.setActive("exit",!e);n&&!e&&s.then(()=>{n(this.id)})}mount(){const{register:e,onExitComplete:n}=this.node.presenceContext||{};n&&n(this.id),e&&(this.unmount=e(this.id))}unmount(){}}const Tmn={animation:{Feature:jmn},exit:{Feature:Nmn}};function g7(t){return{point:{x:t.pageX,y:t.pageY}}}const _mn=t=>e=>T2e(e)&&t(e,g7(e));function $D(t,e,n,r){return QO(t,e,_mn(n),r)}const Dmt=({current:t})=>t?t.ownerDocument.defaultView:null,EOe=(t,e)=>Math.abs(t-e);function Amn(t,e){const n=EOe(t.x,e.x),r=EOe(t.y,e.y);return Math.sqrt(n**2+r**2)}const NOe=new Set(["auto","scroll"]);class $mt{constructor(e,n,{transformPagePoint:r,contextWindow:s=window,dragSnapToOrigin:i=!1,distanceThreshold:o=3,element:l}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.scrollPositions=new Map,this.removeScrollListeners=null,this.onElementScroll=f=>{this.handleScroll(f.target)},this.onWindowScroll=()=>{this.handleScroll(window)},this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=Cle(this.lastMoveEventInfo,this.history),p=this.startEvent!==null,g=Amn(f.offset,{x:0,y:0})>=this.distanceThreshold;if(!p&&!g)return;const{point:v}=f,{timestamp:b}=id;this.history.push({...v,timestamp:b});const{onStart:x,onMove:w}=this.handlers;p||(x&&x(this.lastMoveEvent,f),this.startEvent=this.lastMoveEvent),w&&w(this.lastMoveEvent,f)},this.handlePointerMove=(f,p)=>{this.lastMoveEvent=f,this.lastMoveEventInfo=Sle(p,this.transformPagePoint),Da.update(this.updatePoint,!0)},this.handlePointerUp=(f,p)=>{this.end();const{onEnd:g,onSessionEnd:v,resumeAnimation:b}=this.handlers;if((this.dragSnapToOrigin||!this.startEvent)&&b&&b(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=Cle(f.type==="pointercancel"?this.lastMoveEventInfo:Sle(p,this.transformPagePoint),this.history);this.startEvent&&g&&g(f,x),v&&v(f,x)},!T2e(e))return;this.dragSnapToOrigin=i,this.handlers=n,this.transformPagePoint=r,this.distanceThreshold=o,this.contextWindow=s||window;const c=g7(e),d=Sle(c,this.transformPagePoint),{point:u}=d,{timestamp:h}=id;this.history=[{...u,timestamp:h}];const{onSessionStart:m}=n;m&&m(e,Cle(d,this.history)),this.removeListeners=m7($D(this.contextWindow,"pointermove",this.handlePointerMove),$D(this.contextWindow,"pointerup",this.handlePointerUp),$D(this.contextWindow,"pointercancel",this.handlePointerUp)),l&&this.startScrollTracking(l)}startScrollTracking(e){let n=e.parentElement;for(;n;){const r=getComputedStyle(n);(NOe.has(r.overflowX)||NOe.has(r.overflowY))&&this.scrollPositions.set(n,{x:n.scrollLeft,y:n.scrollTop}),n=n.parentElement}this.scrollPositions.set(window,{x:window.scrollX,y:window.scrollY}),window.addEventListener("scroll",this.onElementScroll,{capture:!0,passive:!0}),window.addEventListener("scroll",this.onWindowScroll,{passive:!0}),this.removeScrollListeners=()=>{window.removeEventListener("scroll",this.onElementScroll,{capture:!0}),window.removeEventListener("scroll",this.onWindowScroll)}}handleScroll(e){const n=this.scrollPositions.get(e);if(!n)return;const r=e===window,s=r?{x:window.scrollX,y:window.scrollY}:{x:e.scrollLeft,y:e.scrollTop},i={x:s.x-n.x,y:s.y-n.y};i.x===0&&i.y===0||(r?this.lastMoveEventInfo&&(this.lastMoveEventInfo.point.x+=i.x,this.lastMoveEventInfo.point.y+=i.y):this.history.length>0&&(this.history[0].x-=i.x,this.history[0].y-=i.y),this.scrollPositions.set(e,s),Da.update(this.updatePoint,!0))}updateHandlers(e){this.handlers=e}end(){this.removeListeners&&this.removeListeners(),this.removeScrollListeners&&this.removeScrollListeners(),this.scrollPositions.clear(),Mk(this.updatePoint)}}function Sle(t,e){return e?{point:e(t.point)}:t}function TOe(t,e){return{x:t.x-e.x,y:t.y-e.y}}function Cle({point:t},e){return{point:t,delta:TOe(t,Omt(e)),offset:TOe(t,Pmn(e)),velocity:Rmn(e,.1)}}function Pmn(t){return t[0]}function Omt(t){return t[t.length-1]}function Rmn(t,e){if(t.length<2)return{x:0,y:0};let n=t.length-1,r=null;const s=Omt(t);for(;n>=0&&(r=t[n],!(s.timestamp-r.timestamp>Pf(e)));)n--;if(!r)return{x:0,y:0};r===t[0]&&t.length>2&&s.timestamp-r.timestamp>Pf(e)*2&&(r=t[1]);const i=Sf(s.timestamp-r.timestamp);if(i===0)return{x:0,y:0};const o={x:(s.x-r.x)/i,y:(s.y-r.y)/i};return o.x===1/0&&(o.x=0),o.y===1/0&&(o.y=0),o}function Imn(t,{min:e,max:n},r){return e!==void 0&&t<e?t=r?$o(e,t,r.min):Math.max(t,e):n!==void 0&&t>n&&(t=r?$o(n,t,r.max):Math.min(t,n)),t}function _Oe(t,e,n){return{min:e!==void 0?t.min+e:void 0,max:n!==void 0?t.max+n-(t.max-t.min):void 0}}function Mmn(t,{top:e,left:n,bottom:r,right:s}){return{x:_Oe(t.x,n,s),y:_Oe(t.y,e,r)}}function AOe(t,e){let n=e.min-t.min,r=e.max-t.max;return e.max-e.min<t.max-t.min&&([n,r]=[r,n]),{min:n,max:r}}function Lmn(t,e){return{x:AOe(t.x,e.x),y:AOe(t.y,e.y)}}function Dmn(t,e){let n=.5;const r=Nu(t),s=Nu(e);return s>r?n=WO(e.min,e.max-r,t.min):r>s&&(n=WO(t.min,t.max-s,e.min)),Ny(0,1,n)}function $mn(t,e){const n={};return e.min!==void 0&&(n.min=e.min-t.min),e.max!==void 0&&(n.max=e.max-t.min),n}const Zge=.35;function Omn(t=Zge){return t===!1?t=0:t===!0&&(t=Zge),{x:POe(t,"left","right"),y:POe(t,"top","bottom")}}function POe(t,e,n){return{min:ROe(t,e),max:ROe(t,n)}}function ROe(t,e){return typeof t=="number"?t:t[e]||0}const Fmn=new WeakMap;class Bmn{constructor(e){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=lc(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=e}start(e,{snapToCursor:n=!1,distanceThreshold:r}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const i=h=>{n&&this.snapToCursor(g7(h).point),this.stopAnimation()},o=(h,m)=>{const{drag:f,dragPropagation:p,onDragStart:g}=this.getProps();if(f&&!p&&(this.openDragLock&&this.openDragLock(),this.openDragLock=gun(f),!this.openDragLock))return;this.latestPointerEvent=h,this.latestPanInfo=m,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),_v(b=>{let x=this.getAxisMotionValue(b).get()||0;if(fy.test(x)){const{projection:w}=this.visualElement;if(w&&w.layout){const k=w.layout.layoutBox[b];k&&(x=Nu(k)*(parseFloat(x)/100))}}this.originPoint[b]=x}),g&&Da.update(()=>g(h,m),!1,!0),Vge(this.visualElement,"transform");const{animationState:v}=this.visualElement;v&&v.setActive("whileDrag",!0)},l=(h,m)=>{this.latestPointerEvent=h,this.latestPanInfo=m;const{dragPropagation:f,dragDirectionLock:p,onDirectionLock:g,onDrag:v}=this.getProps();if(!f&&!this.openDragLock)return;const{offset:b}=m;if(p&&this.currentDirection===null){this.currentDirection=zmn(b),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",m.point,b),this.updateAxis("y",m.point,b),this.visualElement.render(),v&&Da.update(()=>v(h,m),!1,!0)},c=(h,m)=>{this.latestPointerEvent=h,this.latestPanInfo=m,this.stop(h,m),this.latestPointerEvent=null,this.latestPanInfo=null},d=()=>{const{dragSnapToOrigin:h}=this.getProps();(h||this.constraints)&&this.startAnimation({x:0,y:0})},{dragSnapToOrigin:u}=this.getProps();this.panSession=new $mt(e,{onSessionStart:i,onStart:o,onMove:l,onSessionEnd:c,resumeAnimation:d},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:u,distanceThreshold:r,contextWindow:Dmt(this.visualElement),element:this.visualElement.current})}stop(e,n){const r=e||this.latestPointerEvent,s=n||this.latestPanInfo,i=this.isDragging;if(this.cancel(),!i||!s||!r)return;const{velocity:o}=s;this.startAnimation(o);const{onDragEnd:l}=this.getProps();l&&Da.postRender(()=>l(r,s))}cancel(){this.isDragging=!1;const{projection:e,animationState:n}=this.visualElement;e&&(e.isAnimationBlocked=!1),this.endPanSession();const{dragPropagation:r}=this.getProps();!r&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),n&&n.setActive("whileDrag",!1)}endPanSession(){this.panSession&&this.panSession.end(),this.panSession=void 0}updateAxis(e,n,r){const{drag:s}=this.getProps();if(!r||!lz(e,s,this.currentDirection))return;const i=this.getAxisMotionValue(e);let o=this.originPoint[e]+r[e];this.constraints&&this.constraints[e]&&(o=Imn(o,this.constraints[e],this.elastic[e])),i.set(o)}resolveConstraints(){var i;const{dragConstraints:e,dragElastic:n}=this.getProps(),r=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(i=this.visualElement.projection)==null?void 0:i.layout,s=this.constraints;e&&e_(e)?this.constraints||(this.constraints=this.resolveRefConstraints()):e&&r?this.constraints=Mmn(r.layoutBox,e):this.constraints=!1,this.elastic=Omn(n),s!==this.constraints&&!e_(e)&&r&&this.constraints&&!this.hasMutatedConstraints&&_v(o=>{this.constraints!==!1&&this.getAxisMotionValue(o)&&(this.constraints[o]=$mn(r.layoutBox[o],this.constraints[o]))})}resolveRefConstraints(){const{dragConstraints:e,onMeasureDragConstraints:n}=this.getProps();if(!e||!e_(e))return!1;const r=e.current;mR(r!==null,"If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.","drag-constraints-ref");const{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const i=Hun(r,s.root,this.visualElement.getTransformPagePoint());let o=Lmn(s.layout.layoutBox,i);if(n){const l=n(Uun(o));this.hasMutatedConstraints=!!l,l&&(o=imt(l))}return o}startAnimation(e){const{drag:n,dragMomentum:r,dragElastic:s,dragTransition:i,dragSnapToOrigin:o,onDragTransitionEnd:l}=this.getProps(),c=this.constraints||{},d=_v(u=>{if(!lz(u,n,this.currentDirection))return;let h=c&&c[u]||{};o&&(h={min:0,max:0});const m=s?200:1e6,f=s?40:1e7,p={type:"inertia",velocity:r?e[u]:0,bounceStiffness:m,bounceDamping:f,timeConstant:750,restDelta:1,restSpeed:10,...i,...h};return this.startAxisValueAnimation(u,p)});return Promise.all(d).then(l)}startAxisValueAnimation(e,n){const r=this.getAxisMotionValue(e);return Vge(this.visualElement,e),r.start(S2e(e,r,0,n,this.visualElement,!1))}stopAnimation(){_v(e=>this.getAxisMotionValue(e).stop())}getAxisMotionValue(e){const n=`_drag${e.toUpperCase()}`,r=this.visualElement.getProps(),s=r[n];return s||this.visualElement.getValue(e,(r.initial?r.initial[e]:void 0)||0)}snapToCursor(e){_v(n=>{const{drag:r}=this.getProps();if(!lz(n,r,this.currentDirection))return;const{projection:s}=this.visualElement,i=this.getAxisMotionValue(n);if(s&&s.layout){const{min:o,max:l}=s.layout.layoutBox[n],c=i.get()||0;i.set(e[n]-$o(o,l,.5)+c)}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:e,dragConstraints:n}=this.getProps(),{projection:r}=this.visualElement;if(!e_(n)||!r||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};_v(o=>{const l=this.getAxisMotionValue(o);if(l&&this.constraints!==!1){const c=l.get();s[o]=Dmn({min:c,max:c},this.constraints[o])}});const{transformTemplate:i}=this.visualElement.getProps();this.visualElement.current.style.transform=i?i({},""):"none",r.root&&r.root.updateScroll(),r.updateLayout(),this.constraints=!1,this.resolveConstraints(),_v(o=>{if(!lz(o,e,null))return;const l=this.getAxisMotionValue(o),{min:c,max:d}=this.constraints[o];l.set($o(c,d,s[o]))}),this.visualElement.render()}addListeners(){if(!this.visualElement.current)return;Fmn.set(this.visualElement,this);const e=this.visualElement.current,n=$D(e,"pointerdown",d=>{const{drag:u,dragListener:h=!0}=this.getProps(),m=d.target,f=m!==e&&kun(m);u&&h&&!f&&this.start(d)});let r;const s=()=>{const{dragConstraints:d}=this.getProps();e_(d)&&d.current&&(this.constraints=this.resolveRefConstraints(),r||(r=Umn(e,d.current,()=>this.scalePositionWithinConstraints())))},{projection:i}=this.visualElement,o=i.addEventListener("measure",s);i&&!i.layout&&(i.root&&i.root.updateScroll(),i.updateLayout()),Da.read(s);const l=QO(window,"resize",()=>this.scalePositionWithinConstraints()),c=i.addEventListener("didUpdate",({delta:d,hasLayoutChanged:u})=>{this.isDragging&&u&&(_v(h=>{const m=this.getAxisMotionValue(h);m&&(this.originPoint[h]+=d[h].translate,m.set(m.get()+d[h].translate))}),this.visualElement.render())});return()=>{l(),n(),o(),c&&c(),r&&r()}}getProps(){const e=this.visualElement.getProps(),{drag:n=!1,dragDirectionLock:r=!1,dragPropagation:s=!1,dragConstraints:i=!1,dragElastic:o=Zge,dragMomentum:l=!0}=e;return{...e,drag:n,dragDirectionLock:r,dragPropagation:s,dragConstraints:i,dragElastic:o,dragMomentum:l}}}function IOe(t){let e=!0;return()=>{if(e){e=!1;return}t()}}function Umn(t,e,n){const r=B$e(t,IOe(n)),s=B$e(e,IOe(n));return()=>{r(),s()}}function lz(t,e,n){return(e===!0||e===t)&&(n===null||n===t)}function zmn(t,e=10){let n=null;return Math.abs(t.y)>e?n="y":Math.abs(t.x)>e&&(n="x"),n}class Vmn extends yS{constructor(e){super(e),this.removeGroupControls=Af,this.removeListeners=Af,this.controls=new Bmn(e)}mount(){const{dragControls:e}=this.node.getProps();e&&(this.removeGroupControls=e.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||Af}update(){const{dragControls:e}=this.node.getProps(),{dragControls:n}=this.node.prevProps||{};e!==n&&(this.removeGroupControls(),e&&(this.removeGroupControls=e.subscribe(this.controls)))}unmount(){this.removeGroupControls(),this.removeListeners(),this.controls.isDragging||this.controls.endPanSession()}}const jle=t=>(e,n)=>{t&&Da.update(()=>t(e,n),!1,!0)};class Hmn extends yS{constructor(){super(...arguments),this.removePointerDownListener=Af}onPointerDown(e){this.session=new $mt(e,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:Dmt(this.node)})}createPanHandlers(){const{onPanSessionStart:e,onPanStart:n,onPan:r,onPanEnd:s}=this.node.getProps();return{onSessionStart:jle(e),onStart:jle(n),onMove:jle(r),onEnd:(i,o)=>{delete this.session,s&&Da.postRender(()=>s(i,o))}}}mount(){this.removePointerDownListener=$D(this.node.current,"pointerdown",e=>this.onPointerDown(e))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}let Ele=!1;class Gmn extends y.Component{componentDidMount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r,layoutId:s}=this.props,{projection:i}=e;i&&(n.group&&n.group.add(i),r&&r.register&&s&&r.register(i),Ele&&i.root.didUpdate(),i.addEventListener("animationComplete",()=>{this.safeToRemove()}),i.setOptions({...i.options,layoutDependency:this.props.layoutDependency,onExitComplete:()=>this.safeToRemove()})),MG.hasEverUpdated=!0}getSnapshotBeforeUpdate(e){const{layoutDependency:n,visualElement:r,drag:s,isPresent:i}=this.props,{projection:o}=r;return o&&(o.isPresent=i,e.layoutDependency!==n&&o.setOptions({...o.options,layoutDependency:n}),Ele=!0,s||e.layoutDependency!==n||n===void 0||e.isPresent!==i?o.willUpdate():this.safeToRemove(),e.isPresent!==i&&(i?o.promote():o.relegate()||Da.postRender(()=>{const l=o.getStack();(!l||!l.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:e}=this.props.visualElement;e&&(e.root.didUpdate(),N2e.postRender(()=>{!e.currentAnimation&&e.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:e,layoutGroup:n,switchLayoutGroup:r}=this.props,{projection:s}=e;Ele=!0,s&&(s.scheduleCheckAfterUnmount(),n&&n.group&&n.group.remove(s),r&&r.deregister&&r.deregister(s))}safeToRemove(){const{safeToRemove:e}=this.props;e&&e()}render(){return null}}function Fmt(t){const[e,n]=Nmt(),r=y.useContext(o2e);return a.jsx(Gmn,{...t,layoutGroup:r,switchLayoutGroup:y.useContext(Mmt),isPresent:e,safeToRemove:n})}const Wmn={pan:{Feature:Hmn},drag:{Feature:Vmn,ProjectionNode:Emt,MeasureLayout:Fmt}};function MOe(t,e,n){const{props:r}=t;t.animationState&&r.whileHover&&t.animationState.setActive("whileHover",n==="Start");const s="onHover"+n,i=r[s];i&&Da.postRender(()=>i(e,g7(e)))}class qmn extends yS{mount(){const{current:e}=this.node;e&&(this.unmount=yun(e,(n,r)=>(MOe(this.node,r,"Start"),s=>MOe(this.node,s,"End"))))}unmount(){}}class Kmn extends yS{constructor(){super(...arguments),this.isActive=!1}onFocus(){let e=!1;try{e=this.node.current.matches(":focus-visible")}catch{e=!0}!e||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!0),this.isActive=!0)}onBlur(){!this.isActive||!this.node.animationState||(this.node.animationState.setActive("whileFocus",!1),this.isActive=!1)}mount(){this.unmount=m7(QO(this.node.current,"focus",()=>this.onFocus()),QO(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function LOe(t,e,n){const{props:r}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&r.whileTap&&t.animationState.setActive("whileTap",n==="Start");const s="onTap"+(n==="End"?"":n),i=r[s];i&&Da.postRender(()=>i(e,g7(e)))}class Ymn extends yS{mount(){const{current:e}=this.node;if(!e)return;const{globalTapTarget:n,propagate:r}=this.node.props;this.unmount=Cun(e,(s,i)=>(LOe(this.node,i,"Start"),(o,{success:l})=>LOe(this.node,o,l?"End":"Cancel")),{useGlobalTarget:n,stopPropagation:(r==null?void 0:r.tap)===!1})}unmount(){}}const Jge=new WeakMap,Nle=new WeakMap,Qmn=t=>{const e=Jge.get(t.target);e&&e(t)},Zmn=t=>{t.forEach(Qmn)};function Jmn({root:t,...e}){const n=t||document;Nle.has(n)||Nle.set(n,{});const r=Nle.get(n),s=JSON.stringify(e);return r[s]||(r[s]=new IntersectionObserver(Zmn,{root:t,...e})),r[s]}function Xmn(t,e,n){const r=Jmn(e);return Jge.set(t,n),r.observe(t),()=>{Jge.delete(t),r.unobserve(t)}}const efn={some:0,all:1};class tfn extends yS{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:e={}}=this.node.getProps(),{root:n,margin:r,amount:s="some",once:i}=e,o={root:n?n.current:void 0,rootMargin:r,threshold:typeof s=="number"?s:efn[s]},l=c=>{const{isIntersecting:d}=c;if(this.isInView===d||(this.isInView=d,i&&!d&&this.hasEnteredView))return;d&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",d);const{onViewportEnter:u,onViewportLeave:h}=this.node.getProps(),m=d?u:h;m&&m(c)};return Xmn(this.node.current,o,l)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:e,prevProps:n}=this.node;["amount","margin","root"].some(nfn(e,n))&&this.startObserver()}unmount(){}}function nfn({viewport:t={}},{viewport:e={}}={}){return n=>t[n]!==e[n]}const rfn={inView:{Feature:tfn},tap:{Feature:Ymn},focus:{Feature:Kmn},hover:{Feature:qmn}},sfn={layout:{ProjectionNode:Emt,MeasureLayout:Fmt}},ifn={...Tmn,...rfn,...Wmn,...sfn},it=Smn(ifn,Cmn);function v7(){!R2e.current&&nmt();const[t]=y.useState(TY.current);return t}var cz,afn=new Uint8Array(16);function ofn(){if(!cz&&(cz=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!cz))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return cz(afn)}const lfn=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function O2e(t){return typeof t=="string"&&lfn.test(t)}var Xc=[];for(var Tle=0;Tle<256;++Tle)Xc.push((Tle+256).toString(16).substr(1));function cfn(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(Xc[t[e+0]]+Xc[t[e+1]]+Xc[t[e+2]]+Xc[t[e+3]]+"-"+Xc[t[e+4]]+Xc[t[e+5]]+"-"+Xc[t[e+6]]+Xc[t[e+7]]+"-"+Xc[t[e+8]]+Xc[t[e+9]]+"-"+Xc[t[e+10]]+Xc[t[e+11]]+Xc[t[e+12]]+Xc[t[e+13]]+Xc[t[e+14]]+Xc[t[e+15]]).toLowerCase();if(!O2e(n))throw TypeError("Stringified UUID is invalid");return n}function pR(t,e,n){t=t||{};var r=t.random||(t.rng||ofn)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,cfn(r)}const dfn={AmazonBot:"amazonbot","Amazon Silk":"amazon_silk","Android Browser":"android",BaiduSpider:"baiduspider",Bada:"bada",BingCrawler:"bingcrawler",Brave:"brave",BlackBerry:"blackberry","ChatGPT-User":"chatgpt_user",Chrome:"chrome",ClaudeBot:"claudebot",Chromium:"chromium",Diffbot:"diffbot",DuckDuckBot:"duckduckbot",DuckDuckGo:"duckduckgo",Electron:"electron",Epiphany:"epiphany",FacebookExternalHit:"facebookexternalhit",Firefox:"firefox",Focus:"focus",Generic:"generic","Google Search":"google_search",Googlebot:"googlebot",GPTBot:"gptbot","Internet Explorer":"ie",InternetArchiveCrawler:"internetarchivecrawler","K-Meleon":"k_meleon",LibreWolf:"librewolf",Linespider:"linespider",Maxthon:"maxthon","Meta-ExternalAds":"meta_externalads","Meta-ExternalAgent":"meta_externalagent","Meta-ExternalFetcher":"meta_externalfetcher","Meta-WebIndexer":"meta_webindexer","Microsoft Edge":"edge","MZ Browser":"mz","NAVER Whale Browser":"naver","OAI-SearchBot":"oai_searchbot",Omgilibot:"omgilibot",Opera:"opera","Opera Coast":"opera_coast","Pale Moon":"pale_moon",PerplexityBot:"perplexitybot","Perplexity-User":"perplexity_user",PhantomJS:"phantomjs",PingdomBot:"pingdombot",Puffin:"puffin",QQ:"qq",QQLite:"qqlite",QupZilla:"qupzilla",Roku:"roku",Safari:"safari",Sailfish:"sailfish","Samsung Internet for Android":"samsung_internet",SlackBot:"slackbot",SeaMonkey:"seamonkey",Sleipnir:"sleipnir","Sogou Browser":"sogou",Swing:"swing",Tizen:"tizen","UC Browser":"uc",Vivaldi:"vivaldi","WebOS Browser":"webos",WeChat:"wechat",YahooSlurp:"yahooslurp","Yandex Browser":"yandex",YandexBot:"yandexbot",YouBot:"youbot"},Bmt={amazonbot:"AmazonBot",amazon_silk:"Amazon Silk",android:"Android Browser",baiduspider:"BaiduSpider",bada:"Bada",bingcrawler:"BingCrawler",blackberry:"BlackBerry",brave:"Brave",chatgpt_user:"ChatGPT-User",chrome:"Chrome",claudebot:"ClaudeBot",chromium:"Chromium",diffbot:"Diffbot",duckduckbot:"DuckDuckBot",duckduckgo:"DuckDuckGo",edge:"Microsoft Edge",electron:"Electron",epiphany:"Epiphany",facebookexternalhit:"FacebookExternalHit",firefox:"Firefox",focus:"Focus",generic:"Generic",google_search:"Google Search",googlebot:"Googlebot",gptbot:"GPTBot",ie:"Internet Explorer",internetarchivecrawler:"InternetArchiveCrawler",k_meleon:"K-Meleon",librewolf:"LibreWolf",linespider:"Linespider",maxthon:"Maxthon",meta_externalads:"Meta-ExternalAds",meta_externalagent:"Meta-ExternalAgent",meta_externalfetcher:"Meta-ExternalFetcher",meta_webindexer:"Meta-WebIndexer",mz:"MZ Browser",naver:"NAVER Whale Browser",oai_searchbot:"OAI-SearchBot",omgilibot:"Omgilibot",opera:"Opera",opera_coast:"Opera Coast",pale_moon:"Pale Moon",perplexitybot:"PerplexityBot",perplexity_user:"Perplexity-User",phantomjs:"PhantomJS",pingdombot:"PingdomBot",puffin:"Puffin",qq:"QQ Browser",qqlite:"QQ Browser Lite",qupzilla:"QupZilla",roku:"Roku",safari:"Safari",sailfish:"Sailfish",samsung_internet:"Samsung Internet for Android",seamonkey:"SeaMonkey",slackbot:"SlackBot",sleipnir:"Sleipnir",sogou:"Sogou Browser",swing:"Swing",tizen:"Tizen",uc:"UC Browser",vivaldi:"Vivaldi",webos:"WebOS Browser",wechat:"WeChat",yahooslurp:"YahooSlurp",yandex:"Yandex Browser",yandexbot:"YandexBot",youbot:"YouBot"},rs={bot:"bot",desktop:"desktop",mobile:"mobile",tablet:"tablet",tv:"tv"},Ld={Android:"Android",Bada:"Bada",BlackBerry:"BlackBerry",ChromeOS:"Chrome OS",HarmonyOS:"HarmonyOS",iOS:"iOS",Linux:"Linux",MacOS:"macOS",PlayStation4:"PlayStation 4",Roku:"Roku",Tizen:"Tizen",WebOS:"WebOS",Windows:"Windows",WindowsPhone:"Windows Phone"},kw={Blink:"Blink",EdgeHTML:"EdgeHTML",Gecko:"Gecko",Presto:"Presto",Trident:"Trident",WebKit:"WebKit"};class ft{static getFirstMatch(e,n){const r=n.match(e);return r&&r.length>0&&r[1]||""}static getSecondMatch(e,n){const r=n.match(e);return r&&r.length>1&&r[2]||""}static matchAndReturnConst(e,n,r){if(e.test(n))return r}static getWindowsVersionName(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}static getMacOSVersionName(e){const n=e.split(".").splice(0,2).map(i=>parseInt(i,10)||0);n.push(0);const r=n[0],s=n[1];if(r===10)switch(s){case 5:return"Leopard";case 6:return"Snow Leopard";case 7:return"Lion";case 8:return"Mountain Lion";case 9:return"Mavericks";case 10:return"Yosemite";case 11:return"El Capitan";case 12:return"Sierra";case 13:return"High Sierra";case 14:return"Mojave";case 15:return"Catalina";default:return}switch(r){case 11:return"Big Sur";case 12:return"Monterey";case 13:return"Ventura";case 14:return"Sonoma";case 15:return"Sequoia";default:return}}static getAndroidVersionName(e){const n=e.split(".").splice(0,2).map(r=>parseInt(r,10)||0);if(n.push(0),!(n[0]===1&&n[1]<5)){if(n[0]===1&&n[1]<6)return"Cupcake";if(n[0]===1&&n[1]>=6)return"Donut";if(n[0]===2&&n[1]<2)return"Eclair";if(n[0]===2&&n[1]===2)return"Froyo";if(n[0]===2&&n[1]>2)return"Gingerbread";if(n[0]===3)return"Honeycomb";if(n[0]===4&&n[1]<1)return"Ice Cream Sandwich";if(n[0]===4&&n[1]<4)return"Jelly Bean";if(n[0]===4&&n[1]>=4)return"KitKat";if(n[0]===5)return"Lollipop";if(n[0]===6)return"Marshmallow";if(n[0]===7)return"Nougat";if(n[0]===8)return"Oreo";if(n[0]===9)return"Pie"}}static getVersionPrecision(e){return e.split(".").length}static compareVersions(e,n,r=!1){const s=ft.getVersionPrecision(e),i=ft.getVersionPrecision(n);let o=Math.max(s,i),l=0;const c=ft.map([e,n],d=>{const u=o-ft.getVersionPrecision(d),h=d+new Array(u+1).join(".0");return ft.map(h.split("."),m=>new Array(20-m.length).join("0")+m).reverse()});for(r&&(l=o-Math.min(s,i)),o-=1;o>=l;){if(c[0][o]>c[1][o])return 1;if(c[0][o]===c[1][o]){if(o===l)return 0;o-=1}else if(c[0][o]<c[1][o])return-1}}static map(e,n){const r=[];let s;if(Array.prototype.map)return Array.prototype.map.call(e,n);for(s=0;s<e.length;s+=1)r.push(n(e[s]));return r}static find(e,n){let r,s;if(Array.prototype.find)return Array.prototype.find.call(e,n);for(r=0,s=e.length;r<s;r+=1){const i=e[r];if(n(i,r))return i}}static assign(e,...n){const r=e;let s,i;if(Object.assign)return Object.assign(e,...n);for(s=0,i=n.length;s<i;s+=1){const o=n[s];typeof o=="object"&&o!==null&&Object.keys(o).forEach(c=>{r[c]=o[c]})}return e}static getBrowserAlias(e){return dfn[e]}static getBrowserTypeByAlias(e){return Bmt[e]||""}}const as=/version\/(\d+(\.?_?\d+)+)/i,ufn=[{test:[/gptbot/i],describe(t){const e={name:"GPTBot"},n=ft.getFirstMatch(/gptbot\/(\d+(\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/chatgpt-user/i],describe(t){const e={name:"ChatGPT-User"},n=ft.getFirstMatch(/chatgpt-user\/(\d+(\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/oai-searchbot/i],describe(t){const e={name:"OAI-SearchBot"},n=ft.getFirstMatch(/oai-searchbot\/(\d+(\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe(t){const e={name:"ClaudeBot"},n=ft.getFirstMatch(/(?:claudebot|claude-web|claude-user|claude-searchbot)\/(\d+(\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/omgilibot/i,/webzio-extended/i],describe(t){const e={name:"Omgilibot"},n=ft.getFirstMatch(/(?:omgilibot|webzio-extended)\/(\d+(\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/diffbot/i],describe(t){const e={name:"Diffbot"},n=ft.getFirstMatch(/diffbot\/(\d+(\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/perplexitybot/i],describe(t){const e={name:"PerplexityBot"},n=ft.getFirstMatch(/perplexitybot\/(\d+(\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/perplexity-user/i],describe(t){const e={name:"Perplexity-User"},n=ft.getFirstMatch(/perplexity-user\/(\d+(\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/youbot/i],describe(t){const e={name:"YouBot"},n=ft.getFirstMatch(/youbot\/(\d+(\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/meta-webindexer/i],describe(t){const e={name:"Meta-WebIndexer"},n=ft.getFirstMatch(/meta-webindexer\/(\d+(\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/meta-externalads/i],describe(t){const e={name:"Meta-ExternalAds"},n=ft.getFirstMatch(/meta-externalads\/(\d+(\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/meta-externalagent/i],describe(t){const e={name:"Meta-ExternalAgent"},n=ft.getFirstMatch(/meta-externalagent\/(\d+(\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/meta-externalfetcher/i],describe(t){const e={name:"Meta-ExternalFetcher"},n=ft.getFirstMatch(/meta-externalfetcher\/(\d+(\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/googlebot/i],describe(t){const e={name:"Googlebot"},n=ft.getFirstMatch(/googlebot\/(\d+(\.\d+))/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/linespider/i],describe(t){const e={name:"Linespider"},n=ft.getFirstMatch(/(?:linespider)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/amazonbot/i],describe(t){const e={name:"AmazonBot"},n=ft.getFirstMatch(/amazonbot\/(\d+(\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/bingbot/i],describe(t){const e={name:"BingCrawler"},n=ft.getFirstMatch(/bingbot\/(\d+(\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/baiduspider/i],describe(t){const e={name:"BaiduSpider"},n=ft.getFirstMatch(/baiduspider\/(\d+(\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/duckduckbot/i],describe(t){const e={name:"DuckDuckBot"},n=ft.getFirstMatch(/duckduckbot\/(\d+(\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/ia_archiver/i],describe(t){const e={name:"InternetArchiveCrawler"},n=ft.getFirstMatch(/ia_archiver\/(\d+(\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe(){return{name:"FacebookExternalHit"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe(t){const e={name:"SlackBot"},n=ft.getFirstMatch(/(?:slackbot|slack-imgproxy)(?:-[-\w]+)?[\s/](\d+(\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/yahoo!?[\s/]*slurp/i],describe(){return{name:"YahooSlurp"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe(){return{name:"YandexBot"}}},{test:[/pingdom/i],describe(){return{name:"PingdomBot"}}},{test:[/opera/i],describe(t){const e={name:"Opera"},n=ft.getFirstMatch(as,t)||ft.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opr\/|opios/i],describe(t){const e={name:"Opera"},n=ft.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/SamsungBrowser/i],describe(t){const e={name:"Samsung Internet for Android"},n=ft.getFirstMatch(as,t)||ft.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Whale/i],describe(t){const e={name:"NAVER Whale Browser"},n=ft.getFirstMatch(as,t)||ft.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/PaleMoon/i],describe(t){const e={name:"Pale Moon"},n=ft.getFirstMatch(as,t)||ft.getFirstMatch(/(?:PaleMoon)[\s/](\d+(?:\.\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/MZBrowser/i],describe(t){const e={name:"MZ Browser"},n=ft.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/focus/i],describe(t){const e={name:"Focus"},n=ft.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/swing/i],describe(t){const e={name:"Swing"},n=ft.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/coast/i],describe(t){const e={name:"Opera Coast"},n=ft.getFirstMatch(as,t)||ft.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/opt\/\d+(?:.?_?\d+)+/i],describe(t){const e={name:"Opera Touch"},n=ft.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/yabrowser/i],describe(t){const e={name:"Yandex Browser"},n=ft.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/ucbrowser/i],describe(t){const e={name:"UC Browser"},n=ft.getFirstMatch(as,t)||ft.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/Maxthon|mxios/i],describe(t){const e={name:"Maxthon"},n=ft.getFirstMatch(as,t)||ft.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/epiphany/i],describe(t){const e={name:"Epiphany"},n=ft.getFirstMatch(as,t)||ft.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/puffin/i],describe(t){const e={name:"Puffin"},n=ft.getFirstMatch(as,t)||ft.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sleipnir/i],describe(t){const e={name:"Sleipnir"},n=ft.getFirstMatch(as,t)||ft.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/k-meleon/i],describe(t){const e={name:"K-Meleon"},n=ft.getFirstMatch(as,t)||ft.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/micromessenger/i],describe(t){const e={name:"WeChat"},n=ft.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/qqbrowser/i],describe(t){const e={name:/qqbrowserlite/i.test(t)?"QQ Browser Lite":"QQ Browser"},n=ft.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/msie|trident/i],describe(t){const e={name:"Internet Explorer"},n=ft.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/\sedg\//i],describe(t){const e={name:"Microsoft Edge"},n=ft.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/edg([ea]|ios)/i],describe(t){const e={name:"Microsoft Edge"},n=ft.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/vivaldi/i],describe(t){const e={name:"Vivaldi"},n=ft.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/seamonkey/i],describe(t){const e={name:"SeaMonkey"},n=ft.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sailfish/i],describe(t){const e={name:"Sailfish"},n=ft.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i,t);return n&&(e.version=n),e}},{test:[/silk/i],describe(t){const e={name:"Amazon Silk"},n=ft.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/phantom/i],describe(t){const e={name:"PhantomJS"},n=ft.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/slimerjs/i],describe(t){const e={name:"SlimerJS"},n=ft.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e={name:"BlackBerry"},n=ft.getFirstMatch(as,t)||ft.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(web|hpw)[o0]s/i],describe(t){const e={name:"WebOS Browser"},n=ft.getFirstMatch(as,t)||ft.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/bada/i],describe(t){const e={name:"Bada"},n=ft.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/tizen/i],describe(t){const e={name:"Tizen"},n=ft.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/qupzilla/i],describe(t){const e={name:"QupZilla"},n=ft.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/librewolf/i],describe(t){const e={name:"LibreWolf"},n=ft.getFirstMatch(/(?:librewolf)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/firefox|iceweasel|fxios/i],describe(t){const e={name:"Firefox"},n=ft.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/electron/i],describe(t){const e={name:"Electron"},n=ft.getFirstMatch(/(?:electron)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/sogoumobilebrowser/i,/metasr/i,/se 2\.[x]/i],describe(t){const e={name:"Sogou Browser"},n=ft.getFirstMatch(/(?:sogoumobilebrowser)[\s/](\d+(\.?_?\d+)+)/i,t),r=ft.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t),s=ft.getFirstMatch(/se ([\d.]+)x/i,t),i=n||r||s;return i&&(e.version=i),e}},{test:[/MiuiBrowser/i],describe(t){const e={name:"Miui"},n=ft.getFirstMatch(/(?:MiuiBrowser)[\s/](\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){return t.hasBrand("DuckDuckGo")?!0:t.test(/\sDdg\/[\d.]+$/i)},describe(t,e){const n={name:"DuckDuckGo"};if(e){const s=e.getBrandVersion("DuckDuckGo");if(s)return n.version=s,n}const r=ft.getFirstMatch(/\sDdg\/([\d.]+)$/i,t);return r&&(n.version=r),n}},{test(t){return t.hasBrand("Brave")},describe(t,e){const n={name:"Brave"};if(e){const r=e.getBrandVersion("Brave");if(r)return n.version=r,n}return n}},{test:[/chromium/i],describe(t){const e={name:"Chromium"},n=ft.getFirstMatch(/(?:chromium)[\s/](\d+(\.?_?\d+)+)/i,t)||ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/chrome|crios|crmo/i],describe(t){const e={name:"Chrome"},n=ft.getFirstMatch(/(?:chrome|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/GSA/i],describe(t){const e={name:"Google Search"},n=ft.getFirstMatch(/(?:GSA)\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e={name:"Android Browser"},n=ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/playstation 4/i],describe(t){const e={name:"PlayStation 4"},n=ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/safari|applewebkit/i],describe(t){const e={name:"Safari"},n=ft.getFirstMatch(as,t);return n&&(e.version=n),e}},{test:[/.*/i],describe(t){const e=/^(.*)\/(.*) /,n=/^(.*)\/(.*)[ \t]\((.*)/,s=t.search("\\(")!==-1?n:e;return{name:ft.getFirstMatch(s,t),version:ft.getSecondMatch(s,t)}}}],hfn=[{test:[/Roku\/DVP/],describe(t){const e=ft.getFirstMatch(/Roku\/DVP-(\d+\.\d+)/i,t);return{name:Ld.Roku,version:e}}},{test:[/windows phone/i],describe(t){const e=ft.getFirstMatch(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i,t);return{name:Ld.WindowsPhone,version:e}}},{test:[/windows /i],describe(t){const e=ft.getFirstMatch(/Windows ((NT|XP)( \d\d?.\d)?)/i,t),n=ft.getWindowsVersionName(e);return{name:Ld.Windows,version:e,versionName:n}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(t){const e={name:Ld.iOS},n=ft.getSecondMatch(/(Version\/)(\d[\d.]+)/,t);return n&&(e.version=n),e}},{test:[/macintosh/i],describe(t){const e=ft.getFirstMatch(/mac os x (\d+(\.?_?\d+)+)/i,t).replace(/[_\s]/g,"."),n=ft.getMacOSVersionName(e),r={name:Ld.MacOS,version:e};return n&&(r.versionName=n),r}},{test:[/(ipod|iphone|ipad)/i],describe(t){const e=ft.getFirstMatch(/os (\d+([_\s]\d+)*) like mac os x/i,t).replace(/[_\s]/g,".");return{name:Ld.iOS,version:e}}},{test:[/OpenHarmony/i],describe(t){const e=ft.getFirstMatch(/OpenHarmony\s+(\d+(\.\d+)*)/i,t);return{name:Ld.HarmonyOS,version:e}}},{test(t){const e=!t.test(/like android/i),n=t.test(/android/i);return e&&n},describe(t){const e=ft.getFirstMatch(/android[\s/-](\d+(\.\d+)*)/i,t),n=ft.getAndroidVersionName(e),r={name:Ld.Android,version:e};return n&&(r.versionName=n),r}},{test:[/(web|hpw)[o0]s/i],describe(t){const e=ft.getFirstMatch(/(?:web|hpw)[o0]s\/(\d+(\.\d+)*)/i,t),n={name:Ld.WebOS};return e&&e.length&&(n.version=e),n}},{test:[/blackberry|\bbb\d+/i,/rim\stablet/i],describe(t){const e=ft.getFirstMatch(/rim\stablet\sos\s(\d+(\.\d+)*)/i,t)||ft.getFirstMatch(/blackberry\d+\/(\d+([_\s]\d+)*)/i,t)||ft.getFirstMatch(/\bbb(\d+)/i,t);return{name:Ld.BlackBerry,version:e}}},{test:[/bada/i],describe(t){const e=ft.getFirstMatch(/bada\/(\d+(\.\d+)*)/i,t);return{name:Ld.Bada,version:e}}},{test:[/tizen/i],describe(t){const e=ft.getFirstMatch(/tizen[/\s](\d+(\.\d+)*)/i,t);return{name:Ld.Tizen,version:e}}},{test:[/linux/i],describe(){return{name:Ld.Linux}}},{test:[/CrOS/],describe(){return{name:Ld.ChromeOS}}},{test:[/PlayStation 4/],describe(t){const e=ft.getFirstMatch(/PlayStation 4[/\s](\d+(\.\d+)*)/i,t);return{name:Ld.PlayStation4,version:e}}}],mfn=[{test:[/googlebot/i],describe(){return{type:rs.bot,vendor:"Google"}}},{test:[/linespider/i],describe(){return{type:rs.bot,vendor:"Line"}}},{test:[/amazonbot/i],describe(){return{type:rs.bot,vendor:"Amazon"}}},{test:[/gptbot/i],describe(){return{type:rs.bot,vendor:"OpenAI"}}},{test:[/chatgpt-user/i],describe(){return{type:rs.bot,vendor:"OpenAI"}}},{test:[/oai-searchbot/i],describe(){return{type:rs.bot,vendor:"OpenAI"}}},{test:[/baiduspider/i],describe(){return{type:rs.bot,vendor:"Baidu"}}},{test:[/bingbot/i],describe(){return{type:rs.bot,vendor:"Bing"}}},{test:[/duckduckbot/i],describe(){return{type:rs.bot,vendor:"DuckDuckGo"}}},{test:[/claudebot/i,/claude-web/i,/claude-user/i,/claude-searchbot/i],describe(){return{type:rs.bot,vendor:"Anthropic"}}},{test:[/omgilibot/i,/webzio-extended/i],describe(){return{type:rs.bot,vendor:"Webz.io"}}},{test:[/diffbot/i],describe(){return{type:rs.bot,vendor:"Diffbot"}}},{test:[/perplexitybot/i],describe(){return{type:rs.bot,vendor:"Perplexity AI"}}},{test:[/perplexity-user/i],describe(){return{type:rs.bot,vendor:"Perplexity AI"}}},{test:[/youbot/i],describe(){return{type:rs.bot,vendor:"You.com"}}},{test:[/ia_archiver/i],describe(){return{type:rs.bot,vendor:"Internet Archive"}}},{test:[/meta-webindexer/i],describe(){return{type:rs.bot,vendor:"Meta"}}},{test:[/meta-externalads/i],describe(){return{type:rs.bot,vendor:"Meta"}}},{test:[/meta-externalagent/i],describe(){return{type:rs.bot,vendor:"Meta"}}},{test:[/meta-externalfetcher/i],describe(){return{type:rs.bot,vendor:"Meta"}}},{test:[/facebookexternalhit/i,/facebookcatalog/i],describe(){return{type:rs.bot,vendor:"Meta"}}},{test:[/slackbot/i,/slack-imgProxy/i],describe(){return{type:rs.bot,vendor:"Slack"}}},{test:[/yahoo/i],describe(){return{type:rs.bot,vendor:"Yahoo"}}},{test:[/yandexbot/i,/yandexmobilebot/i],describe(){return{type:rs.bot,vendor:"Yandex"}}},{test:[/pingdom/i],describe(){return{type:rs.bot,vendor:"Pingdom"}}},{test:[/huawei/i],describe(t){const e=ft.getFirstMatch(/(can-l01)/i,t)&&"Nova",n={type:rs.mobile,vendor:"Huawei"};return e&&(n.model=e),n}},{test:[/nexus\s*(?:7|8|9|10).*/i],describe(){return{type:rs.tablet,vendor:"Nexus"}}},{test:[/ipad/i],describe(){return{type:rs.tablet,vendor:"Apple",model:"iPad"}}},{test:[/Macintosh(.*?) FxiOS(.*?)\//],describe(){return{type:rs.tablet,vendor:"Apple",model:"iPad"}}},{test:[/kftt build/i],describe(){return{type:rs.tablet,vendor:"Amazon",model:"Kindle Fire HD 7"}}},{test:[/silk/i],describe(){return{type:rs.tablet,vendor:"Amazon"}}},{test:[/tablet(?! pc)/i],describe(){return{type:rs.tablet}}},{test(t){const e=t.test(/ipod|iphone/i),n=t.test(/like (ipod|iphone)/i);return e&&!n},describe(t){const e=ft.getFirstMatch(/(ipod|iphone)/i,t);return{type:rs.mobile,vendor:"Apple",model:e}}},{test:[/nexus\s*[0-6].*/i,/galaxy nexus/i],describe(){return{type:rs.mobile,vendor:"Nexus"}}},{test:[/Nokia/i],describe(t){const e=ft.getFirstMatch(/Nokia\s+([0-9]+(\.[0-9]+)?)/i,t),n={type:rs.mobile,vendor:"Nokia"};return e&&(n.model=e),n}},{test:[/[^-]mobi/i],describe(){return{type:rs.mobile}}},{test(t){return t.getBrowserName(!0)==="blackberry"},describe(){return{type:rs.mobile,vendor:"BlackBerry"}}},{test(t){return t.getBrowserName(!0)==="bada"},describe(){return{type:rs.mobile}}},{test(t){return t.getBrowserName()==="windows phone"},describe(){return{type:rs.mobile,vendor:"Microsoft"}}},{test(t){const e=Number(String(t.getOSVersion()).split(".")[0]);return t.getOSName(!0)==="android"&&e>=3},describe(){return{type:rs.tablet}}},{test(t){return t.getOSName(!0)==="android"},describe(){return{type:rs.mobile}}},{test:[/smart-?tv|smarttv/i],describe(){return{type:rs.tv}}},{test:[/netcast/i],describe(){return{type:rs.tv}}},{test(t){return t.getOSName(!0)==="macos"},describe(){return{type:rs.desktop,vendor:"Apple"}}},{test(t){return t.getOSName(!0)==="windows"},describe(){return{type:rs.desktop}}},{test(t){return t.getOSName(!0)==="linux"},describe(){return{type:rs.desktop}}},{test(t){return t.getOSName(!0)==="playstation 4"},describe(){return{type:rs.tv}}},{test(t){return t.getOSName(!0)==="roku"},describe(){return{type:rs.tv}}}],ffn=[{test(t){return t.getBrowserName(!0)==="microsoft edge"},describe(t){if(/\sedg\//i.test(t))return{name:kw.Blink};const n=ft.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i,t);return{name:kw.EdgeHTML,version:n}}},{test:[/trident/i],describe(t){const e={name:kw.Trident},n=ft.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){return t.test(/presto/i)},describe(t){const e={name:kw.Presto},n=ft.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test(t){const e=t.test(/gecko/i),n=t.test(/like gecko/i);return e&&!n},describe(t){const e={name:kw.Gecko},n=ft.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}},{test:[/(apple)?webkit\/537\.36/i],describe(){return{name:kw.Blink}}},{test:[/(apple)?webkit/i],describe(t){const e={name:kw.WebKit},n=ft.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i,t);return n&&(e.version=n),e}}];class DOe{constructor(e,n=!1,r=null){if(e==null||e==="")throw new Error("UserAgent parameter can't be empty");this._ua=e;let s=!1;typeof n=="boolean"?(s=n,this._hints=r):n!=null&&typeof n=="object"?this._hints=n:this._hints=null,this.parsedResult={},s!==!0&&this.parse()}getHints(){return this._hints}hasBrand(e){if(!this._hints||!Array.isArray(this._hints.brands))return!1;const n=e.toLowerCase();return this._hints.brands.some(r=>r.brand&&r.brand.toLowerCase()===n)}getBrandVersion(e){if(!this._hints||!Array.isArray(this._hints.brands))return;const n=e.toLowerCase(),r=this._hints.brands.find(s=>s.brand&&s.brand.toLowerCase()===n);return r?r.version:void 0}getUA(){return this._ua}test(e){return e.test(this._ua)}parseBrowser(){this.parsedResult.browser={};const e=ft.find(ufn,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.browser=e.describe(this.getUA(),this)),this.parsedResult.browser}getBrowser(){return this.parsedResult.browser?this.parsedResult.browser:this.parseBrowser()}getBrowserName(e){return e?String(this.getBrowser().name).toLowerCase()||"":this.getBrowser().name||""}getBrowserVersion(){return this.getBrowser().version}getOS(){return this.parsedResult.os?this.parsedResult.os:this.parseOS()}parseOS(){this.parsedResult.os={};const e=ft.find(hfn,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.os=e.describe(this.getUA())),this.parsedResult.os}getOSName(e){const{name:n}=this.getOS();return e?String(n).toLowerCase()||"":n||""}getOSVersion(){return this.getOS().version}getPlatform(){return this.parsedResult.platform?this.parsedResult.platform:this.parsePlatform()}getPlatformType(e=!1){const{type:n}=this.getPlatform();return e?String(n).toLowerCase()||"":n||""}parsePlatform(){this.parsedResult.platform={};const e=ft.find(mfn,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.platform=e.describe(this.getUA())),this.parsedResult.platform}getEngine(){return this.parsedResult.engine?this.parsedResult.engine:this.parseEngine()}getEngineName(e){return e?String(this.getEngine().name).toLowerCase()||"":this.getEngine().name||""}parseEngine(){this.parsedResult.engine={};const e=ft.find(ffn,n=>{if(typeof n.test=="function")return n.test(this);if(Array.isArray(n.test))return n.test.some(r=>this.test(r));throw new Error("Browser's test function is not valid")});return e&&(this.parsedResult.engine=e.describe(this.getUA())),this.parsedResult.engine}parse(){return this.parseBrowser(),this.parseOS(),this.parsePlatform(),this.parseEngine(),this}getResult(){return ft.assign({},this.parsedResult)}satisfies(e){const n={};let r=0;const s={};let i=0;if(Object.keys(e).forEach(l=>{const c=e[l];typeof c=="string"?(s[l]=c,i+=1):typeof c=="object"&&(n[l]=c,r+=1)}),r>0){const l=Object.keys(n),c=ft.find(l,u=>this.isOS(u));if(c){const u=this.satisfies(n[c]);if(u!==void 0)return u}const d=ft.find(l,u=>this.isPlatform(u));if(d){const u=this.satisfies(n[d]);if(u!==void 0)return u}}if(i>0){const l=Object.keys(s),c=ft.find(l,d=>this.isBrowser(d,!0));if(c!==void 0)return this.compareVersion(s[c])}}isBrowser(e,n=!1){const r=this.getBrowserName().toLowerCase();let s=e.toLowerCase();const i=ft.getBrowserTypeByAlias(s);return n&&i&&(s=i.toLowerCase()),s===r}compareVersion(e){let n=[0],r=e,s=!1;const i=this.getBrowserVersion();if(typeof i=="string")return e[0]===">"||e[0]==="<"?(r=e.substr(1),e[1]==="="?(s=!0,r=e.substr(2)):n=[],e[0]===">"?n.push(1):n.push(-1)):e[0]==="="?r=e.substr(1):e[0]==="~"&&(s=!0,r=e.substr(1)),n.indexOf(ft.compareVersions(i,r,s))>-1}isOS(e){return this.getOSName(!0)===String(e).toLowerCase()}isPlatform(e){return this.getPlatformType(!0)===String(e).toLowerCase()}isEngine(e){return this.getEngineName(!0)===String(e).toLowerCase()}is(e,n=!1){return this.isBrowser(e,n)||this.isOS(e)||this.isPlatform(e)}some(e=[]){return e.some(n=>this.is(n))}}/*!
 * Bowser - a browser detector
 * https://github.com/bowser-js/bowser
 * MIT License | (c) Dustin Diaz 2012-2015
 * MIT License | (c) Denis Demchenko 2015-2019
 */class Umt{static getParser(e,n=!1,r=null){if(typeof e!="string")throw new Error("UserAgent should be a string");return new DOe(e,n,r)}static parse(e,n=null){return new DOe(e,n).getResult()}static get BROWSER_MAP(){return Bmt}static get ENGINE_MAP(){return kw}static get OS_MAP(){return Ld}static get PLATFORMS_MAP(){return rs}}function F2e(t){let e=typeof t;if(e=="object"){if(Array.isArray(t))return"array";if(t===null)return"null"}return e}function pfn(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}let Zb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),Ste=[];for(let t=0;t<Zb.length;t++)Ste[Zb[t].charCodeAt(0)]=t;Ste[45]=Zb.indexOf("+");Ste[95]=Zb.indexOf("/");function gfn(t){let e=t.length*3/4;t[t.length-2]=="="?e-=2:t[t.length-1]=="="&&(e-=1);let n=new Uint8Array(e),r=0,s=0,i,o=0;for(let l=0;l<t.length;l++){if(i=Ste[t.charCodeAt(l)],i===void 0)switch(t[l]){case"=":s=0;case`
`:case"\r":case"	":case" ":continue;default:throw Error("invalid base64 string.")}switch(s){case 0:o=i,s=1;break;case 1:n[r++]=o<<2|(i&48)>>4,o=i,s=2;break;case 2:n[r++]=(o&15)<<4|(i&60)>>2,o=i,s=3;break;case 3:n[r++]=(o&3)<<6|i,s=0;break}}if(s==1)throw Error("invalid base64 string.");return n.subarray(0,r)}function vfn(t){let e="",n=0,r,s=0;for(let i=0;i<t.length;i++)switch(r=t[i],n){case 0:e+=Zb[r>>2],s=(r&3)<<4,n=1;break;case 1:e+=Zb[s|r>>4],s=(r&15)<<2,n=2;break;case 2:e+=Zb[s|r>>6],e+=Zb[r&63],n=0;break}return n&&(e+=Zb[s],e+="=",n==1&&(e+="=")),e}var IY;(function(t){t.symbol=Symbol.for("protobuf-ts/unknown"),t.onRead=(n,r,s,i,o)=>{(e(r)?r[t.symbol]:r[t.symbol]=[]).push({no:s,wireType:i,data:o})},t.onWrite=(n,r,s)=>{for(let{no:i,wireType:o,data:l}of t.list(r))s.tag(i,o).raw(l)},t.list=(n,r)=>{if(e(n)){let s=n[t.symbol];return r?s.filter(i=>i.no==r):s}return[]},t.last=(n,r)=>t.list(n,r).slice(-1)[0];const e=n=>n&&Array.isArray(n[t.symbol])})(IY||(IY={}));var fl;(function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"})(fl||(fl={}));function yfn(){let t=0,e=0;for(let r=0;r<28;r+=7){let s=this.buf[this.pos++];if(t|=(s&127)<<r,!(s&128))return this.assertBounds(),[t,e]}let n=this.buf[this.pos++];if(t|=(n&15)<<28,e=(n&112)>>4,!(n&128))return this.assertBounds(),[t,e];for(let r=3;r<=31;r+=7){let s=this.buf[this.pos++];if(e|=(s&127)<<r,!(s&128))return this.assertBounds(),[t,e]}throw new Error("invalid varint")}function _le(t,e,n){for(let i=0;i<28;i=i+7){const o=t>>>i,l=!(!(o>>>7)&&e==0),c=(l?o|128:o)&255;if(n.push(c),!l)return}const r=t>>>28&15|(e&7)<<4,s=!!(e>>3);if(n.push((s?r|128:r)&255),!!s){for(let i=3;i<31;i=i+7){const o=e>>>i,l=!!(o>>>7),c=(l?o|128:o)&255;if(n.push(c),!l)return}n.push(e>>>31&1)}}const LG=65536*65536;function zmt(t){let e=t[0]=="-";e&&(t=t.slice(1));const n=1e6;let r=0,s=0;function i(o,l){const c=Number(t.slice(o,l));s*=n,r=r*n+c,r>=LG&&(s=s+(r/LG|0),r=r%LG)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),[e,r,s]}function Xge(t,e){if(e>>>0<=2097151)return""+(LG*e+(t>>>0));let n=t&16777215,r=(t>>>24|e<<8)>>>0&16777215,s=e>>16&65535,i=n+r*6777216+s*6710656,o=r+s*8147497,l=s*2,c=1e7;i>=c&&(o+=Math.floor(i/c),i%=c),o>=c&&(l+=Math.floor(o/c),o%=c);function d(u,h){let m=u?String(u):"";return h?"0000000".slice(m.length)+m:m}return d(l,0)+d(o,l)+d(i,1)}function $Oe(t,e){if(t>=0){for(;t>127;)e.push(t&127|128),t=t>>>7;e.push(t)}else{for(let n=0;n<9;n++)e.push(t&127|128),t=t>>7;e.push(1)}}function bfn(){let t=this.buf[this.pos++],e=t&127;if(!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<7,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<14,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<21,!(t&128))return this.assertBounds(),e;t=this.buf[this.pos++],e|=(t&15)<<28;for(let n=5;t&128&&n<10;n++)t=this.buf[this.pos++];if(t&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}let ma;function xfn(){const t=new DataView(new ArrayBuffer(8));ma=globalThis.BigInt!==void 0&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"?{MIN:BigInt("-9223372036854775808"),MAX:BigInt("9223372036854775807"),UMIN:BigInt("0"),UMAX:BigInt("18446744073709551615"),C:BigInt,V:t}:void 0}xfn();function Vmt(t){if(!t)throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support")}const Hmt=/^-?[0-9]+$/,MY=4294967296,dz=2147483648;class Gmt{constructor(e,n){this.lo=e|0,this.hi=n|0}isZero(){return this.lo==0&&this.hi==0}toNumber(){let e=this.hi*MY+(this.lo>>>0);if(!Number.isSafeInteger(e))throw new Error("cannot convert to safe number");return e}}class Kd extends Gmt{static from(e){if(ma)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=ma.C(e);case"number":if(e===0)return this.ZERO;e=ma.C(e);case"bigint":if(!e)return this.ZERO;if(e<ma.UMIN)throw new Error("signed value for ulong");if(e>ma.UMAX)throw new Error("ulong too large");return ma.V.setBigUint64(0,e,!0),new Kd(ma.V.getInt32(0,!0),ma.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!Hmt.test(e))throw new Error("string is no integer");let[n,r,s]=zmt(e);if(n)throw new Error("signed value for ulong");return new Kd(r,s);case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");if(e<0)throw new Error("signed value for ulong");return new Kd(e,e/MY)}throw new Error("unknown value "+typeof e)}toString(){return ma?this.toBigInt().toString():Xge(this.lo,this.hi)}toBigInt(){return Vmt(ma),ma.V.setInt32(0,this.lo,!0),ma.V.setInt32(4,this.hi,!0),ma.V.getBigUint64(0,!0)}}Kd.ZERO=new Kd(0,0);class La extends Gmt{static from(e){if(ma)switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=="")throw new Error("string is no integer");e=ma.C(e);case"number":if(e===0)return this.ZERO;e=ma.C(e);case"bigint":if(!e)return this.ZERO;if(e<ma.MIN)throw new Error("signed long too small");if(e>ma.MAX)throw new Error("signed long too large");return ma.V.setBigInt64(0,e,!0),new La(ma.V.getInt32(0,!0),ma.V.getInt32(4,!0))}else switch(typeof e){case"string":if(e=="0")return this.ZERO;if(e=e.trim(),!Hmt.test(e))throw new Error("string is no integer");let[n,r,s]=zmt(e);if(n){if(s>dz||s==dz&&r!=0)throw new Error("signed long too small")}else if(s>=dz)throw new Error("signed long too large");let i=new La(r,s);return n?i.negate():i;case"number":if(e==0)return this.ZERO;if(!Number.isSafeInteger(e))throw new Error("number is no integer");return e>0?new La(e,e/MY):new La(-e,-e/MY).negate()}throw new Error("unknown value "+typeof e)}isNegative(){return(this.hi&dz)!==0}negate(){let e=~this.hi,n=this.lo;return n?n=~n+1:e+=1,new La(n,e)}toString(){if(ma)return this.toBigInt().toString();if(this.isNegative()){let e=this.negate();return"-"+Xge(e.lo,e.hi)}return Xge(this.lo,this.hi)}toBigInt(){return Vmt(ma),ma.V.setInt32(0,this.lo,!0),ma.V.setInt32(4,this.hi,!0),ma.V.getBigInt64(0,!0)}}La.ZERO=new La(0,0);const OOe={readUnknownField:!0,readerFactory:t=>new kfn(t)};function wfn(t){return t?Object.assign(Object.assign({},OOe),t):OOe}class kfn{constructor(e,n){this.varint64=yfn,this.uint32=bfn,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=n??new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0})}tag(){let e=this.uint32(),n=e>>>3,r=e&7;if(n<=0||r<0||r>5)throw new Error("illegal tag: field no "+n+" wire type "+r);return[n,r]}skip(e){let n=this.pos;switch(e){case fl.Varint:for(;this.buf[this.pos++]&128;);break;case fl.Bit64:this.pos+=4;case fl.Bit32:this.pos+=4;break;case fl.LengthDelimited:let r=this.uint32();this.pos+=r;break;case fl.StartGroup:let s;for(;(s=this.tag()[1])!==fl.EndGroup;)this.skip(s);break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return new La(...this.varint64())}uint64(){return new Kd(...this.varint64())}sint64(){let[e,n]=this.varint64(),r=-(e&1);return e=(e>>>1|(n&1)<<31)^r,n=n>>>1^r,new La(e,n)}bool(){let[e,n]=this.varint64();return e!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return new Kd(this.sfixed32(),this.sfixed32())}sfixed64(){return new La(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),n=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(n,n+e)}string(){return this.textDecoder.decode(this.bytes())}}function wi(t,e){if(!t)throw new Error(e)}const Sfn=34028234663852886e22,Cfn=-34028234663852886e22,jfn=4294967295,Efn=2147483647,Nfn=-2147483648;function OD(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>Efn||t<Nfn)throw new Error("invalid int 32: "+t)}function LY(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>jfn||t<0)throw new Error("invalid uint 32: "+t)}function B2e(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>Sfn||t<Cfn))throw new Error("invalid float 32: "+t)}const FOe={writeUnknownFields:!0,writerFactory:()=>new _fn};function Tfn(t){return t?Object.assign(Object.assign({},FOe),t):FOe}class _fn{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let s=0;s<this.chunks.length;s++)e+=this.chunks[s].length;let n=new Uint8Array(e),r=0;for(let s=0;s<this.chunks.length;s++)n.set(this.chunks[s],r),r+=this.chunks[s].length;return this.chunks=[],n}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let e=this.finish(),n=this.stack.pop();if(!n)throw new Error("invalid state, fork stack empty");return this.chunks=n.chunks,this.buf=n.buf,this.uint32(e.byteLength),this.raw(e)}tag(e,n){return this.uint32((e<<3|n)>>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(LY(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return OD(e),$Oe(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let n=this.textEncoder.encode(e);return this.uint32(n.byteLength),this.raw(n)}float(e){B2e(e);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,e,!0),this.raw(n)}double(e){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,e,!0),this.raw(n)}fixed32(e){LY(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){OD(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return OD(e),e=(e<<1^e>>31)>>>0,$Oe(e,this.buf),this}sfixed64(e){let n=new Uint8Array(8),r=new DataView(n.buffer),s=La.from(e);return r.setInt32(0,s.lo,!0),r.setInt32(4,s.hi,!0),this.raw(n)}fixed64(e){let n=new Uint8Array(8),r=new DataView(n.buffer),s=Kd.from(e);return r.setInt32(0,s.lo,!0),r.setInt32(4,s.hi,!0),this.raw(n)}int64(e){let n=La.from(e);return _le(n.lo,n.hi,this.buf),this}sint64(e){let n=La.from(e),r=n.hi>>31,s=n.lo<<1^r,i=(n.hi<<1|n.lo>>>31)^r;return _le(s,i,this.buf),this}uint64(e){let n=Kd.from(e);return _le(n.lo,n.hi,this.buf),this}}const BOe={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0},UOe={ignoreUnknownFields:!1};function Afn(t){return t?Object.assign(Object.assign({},UOe),t):UOe}function Pfn(t){return t?Object.assign(Object.assign({},BOe),t):BOe}const Wmt=Symbol.for("protobuf-ts/message-type");function zOe(t){let e=!1;const n=[];for(let r=0;r<t.length;r++){let s=t.charAt(r);s=="_"?e=!0:/\d/.test(s)?(n.push(s),e=!0):e?(n.push(s.toUpperCase()),e=!1):r==0?n.push(s.toLowerCase()):n.push(s)}return n.join("")}var zt;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(zt||(zt={}));var py;(function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING",t[t.NUMBER=2]="NUMBER"})(py||(py={}));var DY;(function(t){t[t.NO=0]="NO",t[t.PACKED=1]="PACKED",t[t.UNPACKED=2]="UNPACKED"})(DY||(DY={}));function Rfn(t){var e,n,r,s;return t.localName=(e=t.localName)!==null&&e!==void 0?e:zOe(t.name),t.jsonName=(n=t.jsonName)!==null&&n!==void 0?n:zOe(t.name),t.repeat=(r=t.repeat)!==null&&r!==void 0?r:DY.NO,t.opt=(s=t.opt)!==null&&s!==void 0?s:t.repeat||t.oneof?!1:t.kind=="message",t}function Ifn(t){if(typeof t!="object"||t===null||!t.hasOwnProperty("oneofKind"))return!1;switch(typeof t.oneofKind){case"string":return t[t.oneofKind]===void 0?!1:Object.keys(t).length==2;case"undefined":return Object.keys(t).length==1;default:return!1}}class Mfn{constructor(e){var n;this.fields=(n=e.fields)!==null&&n!==void 0?n:[]}prepare(){if(this.data)return;const e=[],n=[],r=[];for(let s of this.fields)if(s.oneof)r.includes(s.oneof)||(r.push(s.oneof),e.push(s.oneof),n.push(s.oneof));else switch(n.push(s.localName),s.kind){case"scalar":case"enum":(!s.opt||s.repeat)&&e.push(s.localName);break;case"message":s.repeat&&e.push(s.localName);break;case"map":e.push(s.localName);break}this.data={req:e,known:n,oneofs:Object.values(r)}}is(e,n,r=!1){if(n<0)return!0;if(e==null||typeof e!="object")return!1;this.prepare();let s=Object.keys(e),i=this.data;if(s.length<i.req.length||i.req.some(o=>!s.includes(o))||!r&&s.some(o=>!i.known.includes(o)))return!1;if(n<1)return!0;for(const o of i.oneofs){const l=e[o];if(!Ifn(l))return!1;if(l.oneofKind===void 0)continue;const c=this.fields.find(d=>d.localName===l.oneofKind);if(!c||!this.field(l[l.oneofKind],c,r,n))return!1}for(const o of this.fields)if(o.oneof===void 0&&!this.field(e[o.localName],o,r,n))return!1;return!0}field(e,n,r,s){let i=n.repeat;switch(n.kind){case"scalar":return e===void 0?n.opt:i?this.scalars(e,n.T,s,n.L):this.scalar(e,n.T,n.L);case"enum":return e===void 0?n.opt:i?this.scalars(e,zt.INT32,s):this.scalar(e,zt.INT32);case"message":return e===void 0?!0:i?this.messages(e,n.T(),r,s):this.message(e,n.T(),r,s);case"map":if(typeof e!="object"||e===null)return!1;if(s<2)return!0;if(!this.mapKeys(e,n.K,s))return!1;switch(n.V.kind){case"scalar":return this.scalars(Object.values(e),n.V.T,s,n.V.L);case"enum":return this.scalars(Object.values(e),zt.INT32,s);case"message":return this.messages(Object.values(e),n.V.T(),r,s)}break}return!0}message(e,n,r,s){return r?n.isAssignable(e,s):n.is(e,s)}messages(e,n,r,s){if(!Array.isArray(e))return!1;if(s<2)return!0;if(r){for(let i=0;i<e.length&&i<s;i++)if(!n.isAssignable(e[i],s-1))return!1}else for(let i=0;i<e.length&&i<s;i++)if(!n.is(e[i],s-1))return!1;return!0}scalar(e,n,r){let s=typeof e;switch(n){case zt.UINT64:case zt.FIXED64:case zt.INT64:case zt.SFIXED64:case zt.SINT64:switch(r){case py.BIGINT:return s=="bigint";case py.NUMBER:return s=="number"&&!isNaN(e);default:return s=="string"}case zt.BOOL:return s=="boolean";case zt.STRING:return s=="string";case zt.BYTES:return e instanceof Uint8Array;case zt.DOUBLE:case zt.FLOAT:return s=="number"&&!isNaN(e);default:return s=="number"&&Number.isInteger(e)}}scalars(e,n,r,s){if(!Array.isArray(e))return!1;if(r<2)return!0;if(Array.isArray(e)){for(let i=0;i<e.length&&i<r;i++)if(!this.scalar(e[i],n,s))return!1}return!0}mapKeys(e,n,r){let s=Object.keys(e);switch(n){case zt.INT32:case zt.FIXED32:case zt.SFIXED32:case zt.SINT32:case zt.UINT32:return this.scalars(s.slice(0,r).map(i=>parseInt(i)),n,r);case zt.BOOL:return this.scalars(s.slice(0,r).map(i=>i=="true"?!0:i=="false"?!1:i),n,r);default:return this.scalars(s,n,r,py.STRING)}}}function ug(t,e){switch(e){case py.BIGINT:return t.toBigInt();case py.NUMBER:return t.toNumber();default:return t.toString()}}class Lfn{constructor(e){this.info=e}prepare(){var e;if(this.fMap===void 0){this.fMap={};const n=(e=this.info.fields)!==null&&e!==void 0?e:[];for(const r of n)this.fMap[r.name]=r,this.fMap[r.jsonName]=r,this.fMap[r.localName]=r}}assert(e,n,r){if(!e){let s=F2e(r);throw(s=="number"||s=="boolean")&&(s=r.toString()),new Error(`Cannot parse JSON ${s} for ${this.info.typeName}#${n}`)}}read(e,n,r){this.prepare();const s=[];for(const[i,o]of Object.entries(e)){const l=this.fMap[i];if(!l){if(!r.ignoreUnknownFields)throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${i}`);continue}const c=l.localName;let d;if(l.oneof){if(o===null&&(l.kind!=="enum"||l.T()[0]!=="google.protobuf.NullValue"))continue;if(s.includes(l.oneof))throw new Error(`Multiple members of the oneof group "${l.oneof}" of ${this.info.typeName} are present in JSON.`);s.push(l.oneof),d=n[l.oneof]={oneofKind:c}}else d=n;if(l.kind=="map"){if(o===null)continue;this.assert(pfn(o),l.name,o);const u=d[c];for(const[h,m]of Object.entries(o)){this.assert(m!==null,l.name+" map value",null);let f;switch(l.V.kind){case"message":f=l.V.T().internalJsonRead(m,r);break;case"enum":if(f=this.enum(l.V.T(),m,l.name,r.ignoreUnknownFields),f===!1)continue;break;case"scalar":f=this.scalar(m,l.V.T,l.V.L,l.name);break}this.assert(f!==void 0,l.name+" map value",m);let p=h;l.K==zt.BOOL&&(p=p=="true"?!0:p=="false"?!1:p),p=this.scalar(p,l.K,py.STRING,l.name).toString(),u[p]=f}}else if(l.repeat){if(o===null)continue;this.assert(Array.isArray(o),l.name,o);const u=d[c];for(const h of o){this.assert(h!==null,l.name,null);let m;switch(l.kind){case"message":m=l.T().internalJsonRead(h,r);break;case"enum":if(m=this.enum(l.T(),h,l.name,r.ignoreUnknownFields),m===!1)continue;break;case"scalar":m=this.scalar(h,l.T,l.L,l.name);break}this.assert(m!==void 0,l.name,o),u.push(m)}}else switch(l.kind){case"message":if(o===null&&l.T().typeName!="google.protobuf.Value"){this.assert(l.oneof===void 0,l.name+" (oneof member)",null);continue}d[c]=l.T().internalJsonRead(o,r,d[c]);break;case"enum":if(o===null)continue;let u=this.enum(l.T(),o,l.name,r.ignoreUnknownFields);if(u===!1)continue;d[c]=u;break;case"scalar":if(o===null)continue;d[c]=this.scalar(o,l.T,l.L,l.name);break}}}enum(e,n,r,s){if(e[0]=="google.protobuf.NullValue"&&wi(n===null||n==="NULL_VALUE",`Unable to parse field ${this.info.typeName}#${r}, enum ${e[0]} only accepts null.`),n===null)return 0;switch(typeof n){case"number":return wi(Number.isInteger(n),`Unable to parse field ${this.info.typeName}#${r}, enum can only be integral number, got ${n}.`),n;case"string":let i=n;e[2]&&n.substring(0,e[2].length)===e[2]&&(i=n.substring(e[2].length));let o=e[1][i];return typeof o>"u"&&s?!1:(wi(typeof o=="number",`Unable to parse field ${this.info.typeName}#${r}, enum ${e[0]} has no value for "${n}".`),o)}wi(!1,`Unable to parse field ${this.info.typeName}#${r}, cannot parse enum value from ${typeof n}".`)}scalar(e,n,r,s){let i;try{switch(n){case zt.DOUBLE:case zt.FLOAT:if(e===null)return 0;if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""){i="empty string";break}if(typeof e=="string"&&e.trim().length!==e.length){i="extra whitespace";break}if(typeof e!="string"&&typeof e!="number")break;let o=Number(e);if(Number.isNaN(o)){i="not a number";break}if(!Number.isFinite(o)){i="too large or small";break}return n==zt.FLOAT&&B2e(o),o;case zt.INT32:case zt.FIXED32:case zt.SFIXED32:case zt.SINT32:case zt.UINT32:if(e===null)return 0;let l;if(typeof e=="number"?l=e:e===""?i="empty string":typeof e=="string"&&(e.trim().length!==e.length?i="extra whitespace":l=Number(e)),l===void 0)break;return n==zt.UINT32?LY(l):OD(l),l;case zt.INT64:case zt.SFIXED64:case zt.SINT64:if(e===null)return ug(La.ZERO,r);if(typeof e!="number"&&typeof e!="string")break;return ug(La.from(e),r);case zt.FIXED64:case zt.UINT64:if(e===null)return ug(Kd.ZERO,r);if(typeof e!="number"&&typeof e!="string")break;return ug(Kd.from(e),r);case zt.BOOL:if(e===null)return!1;if(typeof e!="boolean")break;return e;case zt.STRING:if(e===null)return"";if(typeof e!="string"){i="extra whitespace";break}try{encodeURIComponent(e)}catch(c){c="invalid UTF8";break}return e;case zt.BYTES:if(e===null||e==="")return new Uint8Array(0);if(typeof e!="string")break;return gfn(e)}}catch(o){i=o.message}this.assert(!1,s+(i?" - "+i:""),e)}}class Dfn{constructor(e){var n;this.fields=(n=e.fields)!==null&&n!==void 0?n:[]}write(e,n){const r={},s=e;for(const i of this.fields){if(!i.oneof){let d=this.field(i,s[i.localName],n);d!==void 0&&(r[n.useProtoFieldName?i.name:i.jsonName]=d);continue}const o=s[i.oneof];if(o.oneofKind!==i.localName)continue;const l=i.kind=="scalar"||i.kind=="enum"?Object.assign(Object.assign({},n),{emitDefaultValues:!0}):n;let c=this.field(i,o[i.localName],l);wi(c!==void 0),r[n.useProtoFieldName?i.name:i.jsonName]=c}return r}field(e,n,r){let s;if(e.kind=="map"){wi(typeof n=="object"&&n!==null);const i={};switch(e.V.kind){case"scalar":for(const[c,d]of Object.entries(n)){const u=this.scalar(e.V.T,d,e.name,!1,!0);wi(u!==void 0),i[c.toString()]=u}break;case"message":const o=e.V.T();for(const[c,d]of Object.entries(n)){const u=this.message(o,d,e.name,r);wi(u!==void 0),i[c.toString()]=u}break;case"enum":const l=e.V.T();for(const[c,d]of Object.entries(n)){wi(d===void 0||typeof d=="number");const u=this.enum(l,d,e.name,!1,!0,r.enumAsInteger);wi(u!==void 0),i[c.toString()]=u}break}(r.emitDefaultValues||Object.keys(i).length>0)&&(s=i)}else if(e.repeat){wi(Array.isArray(n));const i=[];switch(e.kind){case"scalar":for(let c=0;c<n.length;c++){const d=this.scalar(e.T,n[c],e.name,e.opt,!0);wi(d!==void 0),i.push(d)}break;case"enum":const o=e.T();for(let c=0;c<n.length;c++){wi(n[c]===void 0||typeof n[c]=="number");const d=this.enum(o,n[c],e.name,e.opt,!0,r.enumAsInteger);wi(d!==void 0),i.push(d)}break;case"message":const l=e.T();for(let c=0;c<n.length;c++){const d=this.message(l,n[c],e.name,r);wi(d!==void 0),i.push(d)}break}(r.emitDefaultValues||i.length>0||r.emitDefaultValues)&&(s=i)}else switch(e.kind){case"scalar":s=this.scalar(e.T,n,e.name,e.opt,r.emitDefaultValues);break;case"enum":s=this.enum(e.T(),n,e.name,e.opt,r.emitDefaultValues,r.enumAsInteger);break;case"message":s=this.message(e.T(),n,e.name,r);break}return s}enum(e,n,r,s,i,o){if(e[0]=="google.protobuf.NullValue")return!i&&!s?void 0:null;if(n===void 0){wi(s);return}if(!(n===0&&!i&&!s))return wi(typeof n=="number"),wi(Number.isInteger(n)),o||!e[1].hasOwnProperty(n)?n:e[2]?e[2]+e[1][n]:e[1][n]}message(e,n,r,s){return n===void 0?s.emitDefaultValues?null:void 0:e.internalJsonWrite(n,s)}scalar(e,n,r,s,i){if(n===void 0){wi(s);return}const o=i||s;switch(e){case zt.INT32:case zt.SFIXED32:case zt.SINT32:return n===0?o?0:void 0:(OD(n),n);case zt.FIXED32:case zt.UINT32:return n===0?o?0:void 0:(LY(n),n);case zt.FLOAT:B2e(n);case zt.DOUBLE:return n===0?o?0:void 0:(wi(typeof n=="number"),Number.isNaN(n)?"NaN":n===Number.POSITIVE_INFINITY?"Infinity":n===Number.NEGATIVE_INFINITY?"-Infinity":n);case zt.STRING:return n===""?o?"":void 0:(wi(typeof n=="string"),n);case zt.BOOL:return n===!1?o?!1:void 0:(wi(typeof n=="boolean"),n);case zt.UINT64:case zt.FIXED64:wi(typeof n=="number"||typeof n=="string"||typeof n=="bigint");let l=Kd.from(n);return l.isZero()&&!o?void 0:l.toString();case zt.INT64:case zt.SFIXED64:case zt.SINT64:wi(typeof n=="number"||typeof n=="string"||typeof n=="bigint");let c=La.from(n);return c.isZero()&&!o?void 0:c.toString();case zt.BYTES:return wi(n instanceof Uint8Array),n.byteLength?vfn(n):o?"":void 0}}}function eve(t,e=py.STRING){switch(t){case zt.BOOL:return!1;case zt.UINT64:case zt.FIXED64:return ug(Kd.ZERO,e);case zt.INT64:case zt.SFIXED64:case zt.SINT64:return ug(La.ZERO,e);case zt.DOUBLE:case zt.FLOAT:return 0;case zt.BYTES:return new Uint8Array(0);case zt.STRING:return"";default:return 0}}class $fn{constructor(e){this.info=e}prepare(){var e;if(!this.fieldNoToField){const n=(e=this.info.fields)!==null&&e!==void 0?e:[];this.fieldNoToField=new Map(n.map(r=>[r.no,r]))}}read(e,n,r,s){this.prepare();const i=s===void 0?e.len:e.pos+s;for(;e.pos<i;){const[o,l]=e.tag(),c=this.fieldNoToField.get(o);if(!c){let m=r.readUnknownField;if(m=="throw")throw new Error(`Unknown field ${o} (wire type ${l}) for ${this.info.typeName}`);let f=e.skip(l);m!==!1&&(m===!0?IY.onRead:m)(this.info.typeName,n,o,l,f);continue}let d=n,u=c.repeat,h=c.localName;switch(c.oneof&&(d=d[c.oneof],d.oneofKind!==h&&(d=n[c.oneof]={oneofKind:h})),c.kind){case"scalar":case"enum":let m=c.kind=="enum"?zt.INT32:c.T,f=c.kind=="scalar"?c.L:void 0;if(u){let v=d[h];if(l==fl.LengthDelimited&&m!=zt.STRING&&m!=zt.BYTES){let b=e.uint32()+e.pos;for(;e.pos<b;)v.push(this.scalar(e,m,f))}else v.push(this.scalar(e,m,f))}else d[h]=this.scalar(e,m,f);break;case"message":if(u){let v=d[h],b=c.T().internalBinaryRead(e,e.uint32(),r);v.push(b)}else d[h]=c.T().internalBinaryRead(e,e.uint32(),r,d[h]);break;case"map":let[p,g]=this.mapEntry(c,e,r);d[h][p]=g;break}}}mapEntry(e,n,r){let s=n.uint32(),i=n.pos+s,o,l;for(;n.pos<i;){let[c,d]=n.tag();switch(c){case 1:e.K==zt.BOOL?o=n.bool().toString():o=this.scalar(n,e.K,py.STRING);break;case 2:switch(e.V.kind){case"scalar":l=this.scalar(n,e.V.T,e.V.L);break;case"enum":l=n.int32();break;case"message":l=e.V.T().internalBinaryRead(n,n.uint32(),r);break}break;default:throw new Error(`Unknown field ${c} (wire type ${d}) in map entry for ${this.info.typeName}#${e.name}`)}}if(o===void 0){let c=eve(e.K);o=e.K==zt.BOOL?c.toString():c}if(l===void 0)switch(e.V.kind){case"scalar":l=eve(e.V.T,e.V.L);break;case"enum":l=0;break;case"message":l=e.V.T().create();break}return[o,l]}scalar(e,n,r){switch(n){case zt.INT32:return e.int32();case zt.STRING:return e.string();case zt.BOOL:return e.bool();case zt.DOUBLE:return e.double();case zt.FLOAT:return e.float();case zt.INT64:return ug(e.int64(),r);case zt.UINT64:return ug(e.uint64(),r);case zt.FIXED64:return ug(e.fixed64(),r);case zt.FIXED32:return e.fixed32();case zt.BYTES:return e.bytes();case zt.UINT32:return e.uint32();case zt.SFIXED32:return e.sfixed32();case zt.SFIXED64:return ug(e.sfixed64(),r);case zt.SINT32:return e.sint32();case zt.SINT64:return ug(e.sint64(),r)}}}class Ofn{constructor(e){this.info=e}prepare(){if(!this.fields){const e=this.info.fields?this.info.fields.concat():[];this.fields=e.sort((n,r)=>n.no-r.no)}}write(e,n,r){this.prepare();for(const i of this.fields){let o,l,c=i.repeat,d=i.localName;if(i.oneof){const u=e[i.oneof];if(u.oneofKind!==d)continue;o=u[d],l=!0}else o=e[d],l=!1;switch(i.kind){case"scalar":case"enum":let u=i.kind=="enum"?zt.INT32:i.T;if(c)if(wi(Array.isArray(o)),c==DY.PACKED)this.packed(n,u,i.no,o);else for(const h of o)this.scalar(n,u,i.no,h,!0);else o===void 0?wi(i.opt):this.scalar(n,u,i.no,o,l||i.opt);break;case"message":if(c){wi(Array.isArray(o));for(const h of o)this.message(n,r,i.T(),i.no,h)}else this.message(n,r,i.T(),i.no,o);break;case"map":wi(typeof o=="object"&&o!==null);for(const[h,m]of Object.entries(o))this.mapEntry(n,r,i,h,m);break}}let s=r.writeUnknownFields;s!==!1&&(s===!0?IY.onWrite:s)(this.info.typeName,e,n)}mapEntry(e,n,r,s,i){e.tag(r.no,fl.LengthDelimited),e.fork();let o=s;switch(r.K){case zt.INT32:case zt.FIXED32:case zt.UINT32:case zt.SFIXED32:case zt.SINT32:o=Number.parseInt(s);break;case zt.BOOL:wi(s=="true"||s=="false"),o=s=="true";break}switch(this.scalar(e,r.K,1,o,!0),r.V.kind){case"scalar":this.scalar(e,r.V.T,2,i,!0);break;case"enum":this.scalar(e,zt.INT32,2,i,!0);break;case"message":this.message(e,n,r.V.T(),2,i);break}e.join()}message(e,n,r,s,i){i!==void 0&&(r.internalBinaryWrite(i,e.tag(s,fl.LengthDelimited).fork(),n),e.join())}scalar(e,n,r,s,i){let[o,l,c]=this.scalarInfo(n,s);(!c||i)&&(e.tag(r,o),e[l](s))}packed(e,n,r,s){if(!s.length)return;wi(n!==zt.BYTES&&n!==zt.STRING),e.tag(r,fl.LengthDelimited),e.fork();let[,i]=this.scalarInfo(n);for(let o=0;o<s.length;o++)e[i](s[o]);e.join()}scalarInfo(e,n){let r=fl.Varint,s,i=n===void 0,o=n===0;switch(e){case zt.INT32:s="int32";break;case zt.STRING:o=i||!n.length,r=fl.LengthDelimited,s="string";break;case zt.BOOL:o=n===!1,s="bool";break;case zt.UINT32:s="uint32";break;case zt.DOUBLE:r=fl.Bit64,s="double";break;case zt.FLOAT:r=fl.Bit32,s="float";break;case zt.INT64:o=i||La.from(n).isZero(),s="int64";break;case zt.UINT64:o=i||Kd.from(n).isZero(),s="uint64";break;case zt.FIXED64:o=i||Kd.from(n).isZero(),r=fl.Bit64,s="fixed64";break;case zt.BYTES:o=i||!n.byteLength,r=fl.LengthDelimited,s="bytes";break;case zt.FIXED32:r=fl.Bit32,s="fixed32";break;case zt.SFIXED32:r=fl.Bit32,s="sfixed32";break;case zt.SFIXED64:o=i||La.from(n).isZero(),r=fl.Bit64,s="sfixed64";break;case zt.SINT32:s="sint32";break;case zt.SINT64:o=i||La.from(n).isZero(),s="sint64";break}return[r,s,i||o]}}function Ffn(t){const e=t.messagePrototype?Object.create(t.messagePrototype):Object.defineProperty({},Wmt,{value:t});for(let n of t.fields){let r=n.localName;if(!n.opt)if(n.oneof)e[n.oneof]={oneofKind:void 0};else if(n.repeat)e[r]=[];else switch(n.kind){case"scalar":e[r]=eve(n.T,n.L);break;case"enum":e[r]=0;break;case"map":e[r]={};break}}return e}function Ale(t,e,n){let r,s=n,i;for(let o of t.fields){let l=o.localName;if(o.oneof){const c=s[o.oneof];if((c==null?void 0:c.oneofKind)==null)continue;if(r=c[l],i=e[o.oneof],i.oneofKind=c.oneofKind,r==null){delete i[l];continue}}else if(r=s[l],i=e,r==null)continue;switch(o.repeat&&(i[l].length=r.length),o.kind){case"scalar":case"enum":if(o.repeat)for(let d=0;d<r.length;d++)i[l][d]=r[d];else i[l]=r;break;case"message":let c=o.T();if(o.repeat)for(let d=0;d<r.length;d++)i[l][d]=c.create(r[d]);else i[l]===void 0?i[l]=c.create(r):c.mergePartial(i[l],r);break;case"map":switch(o.V.kind){case"scalar":case"enum":Object.assign(i[l],r);break;case"message":let d=o.V.T();for(let u of Object.keys(r))i[l][u]=d.create(r[u]);break}break}}}function Bfn(t,e,n){if(e===n)return!0;if(!e||!n)return!1;for(let r of t.fields){let s=r.localName,i=r.oneof?e[r.oneof][s]:e[s],o=r.oneof?n[r.oneof][s]:n[s];switch(r.kind){case"enum":case"scalar":let l=r.kind=="enum"?zt.INT32:r.T;if(!(r.repeat?VOe(l,i,o):qmt(l,i,o)))return!1;break;case"map":if(!(r.V.kind=="message"?HOe(r.V.T(),uz(i),uz(o)):VOe(r.V.kind=="enum"?zt.INT32:r.V.T,uz(i),uz(o))))return!1;break;case"message":let c=r.T();if(!(r.repeat?HOe(c,i,o):c.equals(i,o)))return!1;break}}return!0}const uz=Object.values;function qmt(t,e,n){if(e===n)return!0;if(t!==zt.BYTES)return!1;let r=e,s=n;if(r.length!==s.length)return!1;for(let i=0;i<r.length;i++)if(r[i]!=s[i])return!1;return!0}function VOe(t,e,n){if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(!qmt(t,e[r],n[r]))return!1;return!0}function HOe(t,e,n){if(e.length!==n.length)return!1;for(let r=0;r<e.length;r++)if(!t.equals(e[r],n[r]))return!1;return!0}const Kmt=Object.getOwnPropertyDescriptors(Object.getPrototypeOf({})),Ufn=Kmt[Wmt]={};class We{constructor(e,n,r){this.defaultCheckDepth=16,this.typeName=e,this.fields=n.map(Rfn),this.options=r??{},Ufn.value=this,this.messagePrototype=Object.create(null,Kmt),this.refTypeCheck=new Mfn(this),this.refJsonReader=new Lfn(this),this.refJsonWriter=new Dfn(this),this.refBinReader=new $fn(this),this.refBinWriter=new Ofn(this)}create(e){let n=Ffn(this);return e!==void 0&&Ale(this,n,e),n}clone(e){let n=this.create();return Ale(this,n,e),n}equals(e,n){return Bfn(this,e,n)}is(e,n=this.defaultCheckDepth){return this.refTypeCheck.is(e,n,!1)}isAssignable(e,n=this.defaultCheckDepth){return this.refTypeCheck.is(e,n,!0)}mergePartial(e,n){Ale(this,e,n)}fromBinary(e,n){let r=wfn(n);return this.internalBinaryRead(r.readerFactory(e),e.byteLength,r)}fromJson(e,n){return this.internalJsonRead(e,Afn(n))}fromJsonString(e,n){let r=JSON.parse(e);return this.fromJson(r,n)}toJson(e,n){return this.internalJsonWrite(e,Pfn(n))}toJsonString(e,n){var r;let s=this.toJson(e,n);return JSON.stringify(s,null,(r=n==null?void 0:n.prettySpaces)!==null&&r!==void 0?r:0)}toBinary(e,n){let r=Tfn(n);return this.internalBinaryWrite(e,r.writerFactory(),r).finish()}internalJsonRead(e,n,r){if(e!==null&&typeof e=="object"&&!Array.isArray(e)){let s=r??this.create();return this.refJsonReader.read(e,s,n),s}throw new Error(`Unable to parse message ${this.typeName} from JSON ${F2e(e)}.`)}internalJsonWrite(e,n){return this.refJsonWriter.write(e,n)}internalBinaryWrite(e,n,r){return this.refBinWriter.write(e,n,r),n}internalBinaryRead(e,n,r,s){let i=s??this.create();return this.refBinReader.read(e,i,r,n),i}}const zfn=t=>(e,n)=>(t.set(e,n),n),GOe=Number.MAX_SAFE_INTEGER===void 0?9007199254740991:Number.MAX_SAFE_INTEGER,Ymt=536870912,WOe=Ymt*2,Vfn=(t,e)=>n=>{const r=e.get(n);let s=r===void 0?n.size:r<WOe?r+1:0;if(!n.has(s))return t(n,s);if(n.size<Ymt){for(;n.has(s);)s=Math.floor(Math.random()*WOe);return t(n,s)}if(n.size>GOe)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;n.has(s);)s=Math.floor(Math.random()*GOe);return t(n,s)},Qmt=new WeakMap,Hfn=zfn(Qmt),hz=Vfn(Hfn,Qmt),Gfn=t=>t.method!==void 0&&t.method==="call",Wfn=t=>t.error===null&&typeof t.id=="number",qfn=t=>{const e=new Map([[0,()=>{}]]),n=new Map([[0,()=>{}]]),r=new Map,s=new Worker(t);return s.addEventListener("message",({data:d})=>{if(Gfn(d)){const{params:{timerId:u,timerType:h}}=d;if(h==="interval"){const m=e.get(u);if(typeof m=="number"){const f=r.get(m);if(f===void 0||f.timerId!==u||f.timerType!==h)throw new Error("The timer is in an undefined state.")}else if(typeof m<"u")m();else throw new Error("The timer is in an undefined state.")}else if(h==="timeout"){const m=n.get(u);if(typeof m=="number"){const f=r.get(m);if(f===void 0||f.timerId!==u||f.timerType!==h)throw new Error("The timer is in an undefined state.")}else if(typeof m<"u")m(),n.delete(u);else throw new Error("The timer is in an undefined state.")}}else if(Wfn(d)){const{id:u}=d,h=r.get(u);if(h===void 0)throw new Error("The timer is in an undefined state.");const{timerId:m,timerType:f}=h;r.delete(u),f==="interval"?e.delete(m):n.delete(m)}else{const{error:{message:u}}=d;throw new Error(u)}}),{clearInterval:d=>{const u=hz(r);r.set(u,{timerId:d,timerType:"interval"}),e.set(d,u),s.postMessage({id:u,method:"clear",params:{timerId:d,timerType:"interval"}})},clearTimeout:d=>{const u=hz(r);r.set(u,{timerId:d,timerType:"timeout"}),n.set(d,u),s.postMessage({id:u,method:"clear",params:{timerId:d,timerType:"timeout"}})},setInterval:(d,u=0)=>{const h=hz(e);return e.set(h,()=>{d(),typeof e.get(h)=="function"&&s.postMessage({id:null,method:"set",params:{delay:u,now:performance.now(),timerId:h,timerType:"interval"}})}),s.postMessage({id:null,method:"set",params:{delay:u,now:performance.now(),timerId:h,timerType:"interval"}}),h},setTimeout:(d,u=0)=>{const h=hz(n);return n.set(h,d),s.postMessage({id:null,method:"set",params:{delay:u,now:performance.now(),timerId:h,timerType:"timeout"}}),h}}},Kfn=(t,e)=>{let n=null;return()=>{if(n!==null)return n;const r=new Blob([e],{type:"application/javascript; charset=utf-8"}),s=URL.createObjectURL(r);return n=t(s),setTimeout(()=>URL.revokeObjectURL(s)),n}},Yfn=`(()=>{"use strict";const e=new Map,t=new Map,r=(e,t)=>{let r,o;const i=performance.now();r=i,o=e-Math.max(0,i-t);return{expected:r+o,remainingDelay:o}},o=(e,t,r,i)=>{const s=performance.now();s>r?postMessage({id:null,method:"call",params:{timerId:t,timerType:i}}):e.set(t,setTimeout(o,r-s,e,t,r,i))};addEventListener("message",(i=>{let{data:s}=i;try{if("clear"===s.method){const{id:r,params:{timerId:o,timerType:i}}=s;if("interval"===i)(t=>{const r=e.get(t);if(void 0===r)throw new Error('There is no interval scheduled with the given id "'.concat(t,'".'));clearTimeout(r),e.delete(t)})(o),postMessage({error:null,id:r});else{if("timeout"!==i)throw new Error('The given type "'.concat(i,'" is not supported'));(e=>{const r=t.get(e);if(void 0===r)throw new Error('There is no timeout scheduled with the given id "'.concat(e,'".'));clearTimeout(r),t.delete(e)})(o),postMessage({error:null,id:r})}}else{if("set"!==s.method)throw new Error('The given method "'.concat(s.method,'" is not supported'));{const{params:{delay:i,now:n,timerId:a,timerType:d}}=s;if("interval"===d)((t,i,s)=>{const{expected:n,remainingDelay:a}=r(t,s);e.set(i,setTimeout(o,a,e,i,n,"interval"))})(i,a,n);else{if("timeout"!==d)throw new Error('The given type "'.concat(d,'" is not supported'));((e,i,s)=>{const{expected:n,remainingDelay:a}=r(e,s);t.set(i,setTimeout(o,a,t,i,n,"timeout"))})(i,a,n)}}}}catch(e){postMessage({error:{message:e.message},id:s.id,result:null})}}))})();`,Cte=Kfn(qfn,Yfn),Zmt=t=>Cte().clearInterval(t),Qfn=t=>Cte().clearTimeout(t),Jmt=(t,e)=>Cte().setInterval(t,e),Zfn=(t,e)=>Cte().setTimeout(t,e),Xmt=Object.freeze(Object.defineProperty({__proto__:null,clearInterval:Zmt,clearTimeout:Qfn,setInterval:Jmt,setTimeout:Zfn},Symbol.toStringTag,{value:"Module"}));var eft={},tft={exports:{}},qOe=tft.exports={v:[{name:"version",reg:/^(\d*)$/}],o:[{name:"origin",reg:/^(\S*) (\d*) (\d*) (\S*) IP(\d) (\S*)/,names:["username","sessionId","sessionVersion","netType","ipVer","address"],format:"%s %s %d %s IP%d %s"}],s:[{name:"name"}],i:[{name:"description"}],u:[{name:"uri"}],e:[{name:"email"}],p:[{name:"phone"}],z:[{name:"timezones"}],r:[{name:"repeats"}],t:[{name:"timing",reg:/^(\d*) (\d*)/,names:["start","stop"],format:"%d %d"}],c:[{name:"connection",reg:/^IN IP(\d) (\S*)/,names:["version","ip"],format:"IN IP%d %s"}],b:[{push:"bandwidth",reg:/^(TIAS|AS|CT|RR|RS):(\d*)/,names:["type","limit"],format:"%s:%s"}],m:[{reg:/^(\w*) (\d*) ([\w/]*)(?: (.*))?/,names:["type","port","protocol","payloads"],format:"%s %d %s %s"}],a:[{push:"rtp",reg:/^rtpmap:(\d*) ([\w\-.]*)(?:\s*\/(\d*)(?:\s*\/(\S*))?)?/,names:["payload","codec","rate","encoding"],format:function(t){return t.encoding?"rtpmap:%d %s/%s/%s":t.rate?"rtpmap:%d %s/%s":"rtpmap:%d %s"}},{push:"fmtp",reg:/^fmtp:(\d*) ([\S| ]*)/,names:["payload","config"],format:"fmtp:%d %s"},{name:"control",reg:/^control:(.*)/,format:"control:%s"},{name:"rtcp",reg:/^rtcp:(\d*)(?: (\S*) IP(\d) (\S*))?/,names:["port","netType","ipVer","address"],format:function(t){return t.address!=null?"rtcp:%d %s IP%d %s":"rtcp:%d"}},{push:"rtcpFbTrrInt",reg:/^rtcp-fb:(\*|\d*) trr-int (\d*)/,names:["payload","value"],format:"rtcp-fb:%s trr-int %d"},{push:"rtcpFb",reg:/^rtcp-fb:(\*|\d*) ([\w-_]*)(?: ([\w-_]*))?/,names:["payload","type","subtype"],format:function(t){return t.subtype!=null?"rtcp-fb:%s %s %s":"rtcp-fb:%s %s"}},{push:"ext",reg:/^extmap:(\d+)(?:\/(\w+))?(?: (urn:ietf:params:rtp-hdrext:encrypt))? (\S*)(?: (\S*))?/,names:["value","direction","encrypt-uri","uri","config"],format:function(t){return"extmap:%d"+(t.direction?"/%s":"%v")+(t["encrypt-uri"]?" %s":"%v")+" %s"+(t.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(t){return t.sessionConfig!=null?"crypto:%d %s %s %s":"crypto:%d %s %s"}},{name:"setup",reg:/^setup:(\w*)/,format:"setup:%s"},{name:"connectionType",reg:/^connection:(new|existing)/,format:"connection:%s"},{name:"mid",reg:/^mid:([^\s]*)/,format:"mid:%s"},{name:"msid",reg:/^msid:(.*)/,format:"msid:%s"},{name:"ptime",reg:/^ptime:(\d*(?:\.\d*)*)/,format:"ptime:%d"},{name:"maxptime",reg:/^maxptime:(\d*(?:\.\d*)*)/,format:"maxptime:%d"},{name:"direction",reg:/^(sendrecv|recvonly|sendonly|inactive)/},{name:"icelite",reg:/^(ice-lite)/},{name:"iceUfrag",reg:/^ice-ufrag:(\S*)/,format:"ice-ufrag:%s"},{name:"icePwd",reg:/^ice-pwd:(\S*)/,format:"ice-pwd:%s"},{name:"fingerprint",reg:/^fingerprint:(\S*) (\S*)/,names:["type","hash"],format:"fingerprint:%s %s"},{push:"candidates",reg:/^candidate:(\S*) (\d*) (\S*) (\d*) (\S*) (\d*) typ (\S*)(?: raddr (\S*) rport (\d*))?(?: tcptype (\S*))?(?: generation (\d*))?(?: network-id (\d*))?(?: network-cost (\d*))?/,names:["foundation","component","transport","priority","ip","port","type","raddr","rport","tcptype","generation","network-id","network-cost"],format:function(t){var e="candidate:%s %d %s %d %s %d typ %s";return e+=t.raddr!=null?" raddr %s rport %d":"%v%v",e+=t.tcptype!=null?" tcptype %s":"%v",t.generation!=null&&(e+=" generation %d"),e+=t["network-id"]!=null?" network-id %d":"%v",e+=t["network-cost"]!=null?" network-cost %d":"%v",e}},{name:"endOfCandidates",reg:/^(end-of-candidates)/},{name:"remoteCandidates",reg:/^remote-candidates:(.*)/,format:"remote-candidates:%s"},{name:"iceOptions",reg:/^ice-options:(\S*)/,format:"ice-options:%s"},{push:"ssrcs",reg:/^ssrc:(\d*) ([\w_-]*)(?::(.*))?/,names:["id","attribute","value"],format:function(t){var e="ssrc:%d";return t.attribute!=null&&(e+=" %s",t.value!=null&&(e+=":%s")),e}},{push:"ssrcGroups",reg:/^ssrc-group:([\x21\x23\x24\x25\x26\x27\x2A\x2B\x2D\x2E\w]*) (.*)/,names:["semantics","ssrcs"],format:"ssrc-group:%s %s"},{name:"msidSemantic",reg:/^msid-semantic:\s?(\w*) (\S*)/,names:["semantic","token"],format:"msid-semantic: %s %s"},{push:"groups",reg:/^group:(\w*) (.*)/,names:["type","mids"],format:"group:%s %s"},{name:"rtcpMux",reg:/^(rtcp-mux)/},{name:"rtcpRsize",reg:/^(rtcp-rsize)/},{name:"sctpmap",reg:/^sctpmap:([\w_/]*) (\S*)(?: (\S*))?/,names:["sctpmapNumber","app","maxMessageSize"],format:function(t){return t.maxMessageSize!=null?"sctpmap:%s %s %s":"sctpmap:%s %s"}},{name:"xGoogleFlag",reg:/^x-google-flag:([^\s]*)/,format:"x-google-flag:%s"},{push:"rids",reg:/^rid:([\d\w]+) (\w+)(?: ([\S| ]*))?/,names:["id","direction","params"],format:function(t){return t.params?"rid:%s %s %s":"rid:%s %s"}},{push:"imageattrs",reg:new RegExp("^imageattr:(\\d+|\\*)[\\s\\t]+(send|recv)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*)(?:[\\s\\t]+(recv|send)[\\s\\t]+(\\*|\\[\\S+\\](?:[\\s\\t]+\\[\\S+\\])*))?"),names:["pt","dir1","attrs1","dir2","attrs2"],format:function(t){return"imageattr:%s %s %s"+(t.dir2?" %s %s":"")}},{name:"simulcast",reg:new RegExp("^simulcast:(send|recv) ([a-zA-Z0-9\\-_~;,]+)(?:\\s?(send|recv) ([a-zA-Z0-9\\-_~;,]+))?$"),names:["dir1","list1","dir2","list2"],format:function(t){return"simulcast:%s %s"+(t.dir2?" %s %s":"")}},{name:"simulcast_03",reg:/^simulcast:[\s\t]+([\S+\s\t]+)$/,names:["value"],format:"simulcast: %s"},{name:"framerate",reg:/^framerate:(\d+(?:$|\.\d+))/,format:"framerate:%s"},{name:"sourceFilter",reg:/^source-filter: *(excl|incl) (\S*) (IP4|IP6|\*) (\S*) (.*)/,names:["filterMode","netType","addressTypes","destAddress","srcList"],format:"source-filter: %s %s %s %s %s"},{name:"bundleOnly",reg:/^(bundle-only)/},{name:"label",reg:/^label:(.+)/,format:"label:%s"},{name:"sctpPort",reg:/^sctp-port:(\d+)$/,format:"sctp-port:%s"},{name:"maxMessageSize",reg:/^max-message-size:(\d+)$/,format:"max-message-size:%s"},{push:"tsRefClocks",reg:/^ts-refclk:([^\s=]*)(?:=(\S*))?/,names:["clksrc","clksrcExt"],format:function(t){return"ts-refclk:%s"+(t.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(t){var e="mediaclk:";return e+=t.id!=null?"id=%s %s":"%v%s",e+=t.mediaClockValue!=null?"=%s":"",e+=t.rateNumerator!=null?" rate=%s":"",e+=t.rateDenominator!=null?"/%s":"",e}},{name:"keywords",reg:/^keywds:(.+)$/,format:"keywds:%s"},{name:"content",reg:/^content:(.+)/,format:"content:%s"},{name:"bfcpFloorCtrl",reg:/^floorctrl:(c-only|s-only|c-s)/,format:"floorctrl:%s"},{name:"bfcpConfId",reg:/^confid:(\d+)/,format:"confid:%s"},{name:"bfcpUserId",reg:/^userid:(\d+)/,format:"userid:%s"},{name:"bfcpFloorId",reg:/^floorid:(.+) (?:m-stream|mstrm):(.+)/,names:["id","mStream"],format:"floorid:%s mstrm:%s"},{push:"invalid",names:["value"]}]};Object.keys(qOe).forEach(function(t){var e=qOe[t];e.forEach(function(n){n.reg||(n.reg=/(.*)/),n.format||(n.format="%s")})});var nft=tft.exports;(function(t){var e=function(l){return String(Number(l))===l?Number(l):l},n=function(l,c,d,u){if(u&&!d)c[u]=e(l[1]);else for(var h=0;h<d.length;h+=1)l[h+1]!=null&&(c[d[h]]=e(l[h+1]))},r=function(l,c,d){var u=l.name&&l.names;l.push&&!c[l.push]?c[l.push]=[]:u&&!c[l.name]&&(c[l.name]={});var h=l.push?{}:u?c[l.name]:c;n(d.match(l.reg),h,l.names,l.name),l.push&&c[l.push].push(h)},s=nft,i=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(l){var c={},d=[],u=c;return l.split(/(\r\n|\r|\n)/).filter(i).forEach(function(h){var m=h[0],f=h.slice(2);m==="m"&&(d.push({rtp:[],fmtp:[]}),u=d[d.length-1]);for(var p=0;p<(s[m]||[]).length;p+=1){var g=s[m][p];if(g.reg.test(f))return r(g,u,f)}}),c.media=d,c};var o=function(l,c){var d=c.split(/=(.+)/,2);return d.length===2?l[d[0]]=e(d[1]):d.length===1&&c.length>1&&(l[d[0]]=void 0),l};t.parseParams=function(l){return l.split(/;\s?/).reduce(o,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(l){return l.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(l){for(var c=[],d=l.split(" ").map(e),u=0;u<d.length;u+=3)c.push({component:d[u],ip:d[u+1],port:d[u+2]});return c},t.parseImageAttributes=function(l){return l.split(" ").map(function(c){return c.substring(1,c.length-1).split(",").reduce(o,{})})},t.parseSimulcastStreamList=function(l){return l.split(";").map(function(c){return c.split(",").map(function(d){var u,h=!1;return d[0]!=="~"?u=e(d):(u=e(d.substring(1,d.length)),h=!0),{scid:u,paused:h}})})}})(eft);var Ple=nft,Jfn=/%[sdv%]/g,Xfn=function(t){var e=1,n=arguments,r=n.length;return t.replace(Jfn,function(s){if(e>=r)return s;var i=n[e];switch(e+=1,s){case"%%":return"%";case"%s":return String(i);case"%d":return Number(i);case"%v":return""}})},$L=function(t,e,n){var r=e.format instanceof Function?e.format(e.push?n:n[e.name]):e.format,s=[t+"="+r];if(e.names)for(var i=0;i<e.names.length;i+=1){var o=e.names[i];e.name?s.push(n[e.name][o]):s.push(n[e.names[i]])}else s.push(n[e.name]);return Xfn.apply(null,s)},epn=["v","o","s","i","u","e","p","c","b","t","r","z","a"],tpn=["i","c","b","a"],npn=function(t,e){e=e||{},t.version==null&&(t.version=0),t.name==null&&(t.name=" "),t.media.forEach(function(i){i.payloads==null&&(i.payloads="")});var n=e.outerOrder||epn,r=e.innerOrder||tpn,s=[];return n.forEach(function(i){Ple[i].forEach(function(o){o.name in t&&t[o.name]!=null?s.push($L(i,o,t)):o.push in t&&t[o.push]!=null&&t[o.push].forEach(function(l){s.push($L(i,o,l))})})}),t.media.forEach(function(i){s.push($L("m",Ple.m[0],i)),r.forEach(function(o){Ple[o].forEach(function(l){l.name in i&&i[l.name]!=null?s.push($L(o,l,i)):l.push in i&&i[l.push]!=null&&i[l.push].forEach(function(c){s.push($L(o,l,c))})})})}),s.join(`\r
`)+`\r
`},ME=eft,rpn=npn,DG=rpn,XC=ME.parse;ME.parseParams;ME.parseFmtpConfig;ME.parsePayloads;ME.parseRemoteCandidates;ME.parseImageAttributes;ME.parseSimulcastStreamList;var KOe={},spn=Object.defineProperty,ipn=Object.defineProperties,apn=Object.getOwnPropertyDescriptors,$Y=Object.getOwnPropertySymbols,opn=Object.getPrototypeOf,rft=Object.prototype.hasOwnProperty,sft=Object.prototype.propertyIsEnumerable,lpn=Reflect.get,cpn=Math.pow,tve=(t,e,n)=>e in t?spn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,en=(t,e)=>{for(var n in e||(e={}))rft.call(e,n)&&tve(t,n,e[n]);if($Y)for(var n of $Y(e))sft.call(e,n)&&tve(t,n,e[n]);return t},Dr=(t,e)=>ipn(t,apn(e)),U2e=(t,e)=>{var n={};for(var r in t)rft.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&$Y)for(var r of $Y(t))e.indexOf(r)<0&&sft.call(t,r)&&(n[r]=t[r]);return n},xe=(t,e,n)=>(tve(t,typeof e!="symbol"?e+"":e,n),n),z2e=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},L=(t,e,n)=>(z2e(t,e,"read from private field"),n?n.call(t):e.get(t)),Se=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},Te=(t,e,n,r)=>(z2e(t,e,"write to private field"),e.set(t,n),n),In=(t,e,n)=>(z2e(t,e,"access private method"),n),dpn=(t,e,n)=>lpn(opn(t),n,e),me=(t,e,n)=>new Promise((r,s)=>{var i=c=>{try{l(n.next(c))}catch(d){s(d)}},o=c=>{try{l(n.throw(c))}catch(d){s(d)}},l=c=>c.done?r(c.value):Promise.resolve(c.value).then(i,o);l((n=n.apply(t,e)).next())});function upn(t){const{length:e}=this,n=t>=0?t:e+t;return n<0||n>=e?void 0:this[n]}Array.prototype.at||Object.assign(Array.prototype,{at:upn});function hpn(t){const{length:e}=this,n=t>=0?t:e+t;return n<0||n>=e?void 0:this[n]}String.prototype.at||Object.assign(String.prototype,{at:hpn});const mpn=t=>{!navigator.isReactNative&&typeof window<"u"&&(window.addEventListener("error",e=>{var n;!((n=e.filename)!=null&&n.includes("localhost"))&&e.lineno!==0&&t.error("window::error",{error:e.error},!0)}),window.addEventListener("unhandledrejection",e=>{var n,r,s,i,o,l,c,d;t.error("window::unhandledrejection",{error:e==null?void 0:e.reason,networkCall:{url:(r=(n=e==null?void 0:e.reason)==null?void 0:n.config)==null?void 0:r.url,baseURL:(i=(s=e==null?void 0:e.reason)==null?void 0:s.config)==null?void 0:i.baseURL,method:(l=(o=e==null?void 0:e.reason)==null?void 0:o.config)==null?void 0:l.method,status:(c=e==null?void 0:e.reason)==null?void 0:c.status,statusText:(d=e==null?void 0:e.reason)==null?void 0:d.statusText}},!0)}),window.addEventListener("offline",()=>{t.info("window::offline")}),window.addEventListener("online",()=>{t.info("window::online")}))},ZO="chrome",ift="opera",aft="firefox",oft="iexplorer",lft="safari",cft="nwjs",dft="electron",uft="react-native",V2e="unknown",OY={Chrome:ZO,Chromium:ZO,Opera:ift,Firefox:aft,"Internet Explorer":oft,Safari:lft};function fpn(){const{userAgent:t}=navigator,e={name:V2e,version:void 0};if(t.match(/Chrome/)&&!t.match(/Edge/))if(t.match(/Edg(A?)/)){const n=t.match(/Chrome\/([\d.]+)/)[1];Number.parseInt(n,10)>72&&(e.name=ZO,e.version=n)}else e.name=ZO,e.version=t.match(/Chrome\/([\d.]+)/)[1];return e}function ppn(){const{userAgent:t}=navigator;if(t.match(/Electron/)){const e=t.match(/Electron\/([\d.]+)/)[1];return{name:dft,version:e}}return null}function gpn(){const{userAgent:t}=navigator;if(t.match(/JitsiMeetNW/)){const e=t.match(/JitsiMeetNW\/([\d.]+)/)[1];return{name:cft,version:e}}}function vpn(){const t=navigator.userAgent.match(/\b(react[ \t_-]*native)(?:\/(\S+))?/i);let e;if(t||navigator.product==="ReactNative")return t&&t.length>2&&(t[1],e=t[2]),e||(e="unknown"),{name:uft,version:e}}function ypn(t){let e;const n=[vpn,ppn,gpn];for(let s=0;s<n.length;s+=1)if(e=n[s](),e)return e;const r=t.getBrowserName();return r in OY?{name:OY[r],version:t.getBrowserVersion()}:(e=fpn(),e||{name:V2e,version:void 0})}class bpn{constructor(){xe(this,"_bowser"),xe(this,"_name"),xe(this,"_version"),xe(this,"getDeviceInfo",()=>({isMobile:this.isMobile(),browserName:this._bowser.getBrowserName(),osName:this._bowser.getOSName(),browserVersion:this._bowser.getBrowserVersion(),osVersionName:this._bowser.getOSVersion(),engineName:this._bowser.getEngineName()}))}init(e){let n,r;if(this._bowser=Umt.getParser(navigator.userAgent),typeof e>"u"){const s=ypn(this._bowser);n=s.name,r=s.version}else e.name in OY?(n=OY[e.name],r=e.version):(n=V2e,r=void 0);this._name=n,this._version=r}getName(){return this._name}isChrome(){return this._name===ZO}isOpera(){return this._name===ift}isFirefox(){return this._name===aft}isIExplorer(){return this._name===oft}isSafari(){return this._name===lft}isNWJS(){return this._name===cft}isElectron(){return this._name===dft}isReactNative(){return this._name===uft||navigator.isReactNative===!0}getVersion(){return this._version}isMobile(){return this._bowser.getPlatformType()==="mobile"}_checkCondition(e){if(this._version)return this._bowser.satisfies(e)}isVersionGreaterThan(e){return this._checkCondition({[this._name]:`>${e}`})}isVersionLessThan(e){return this._checkCondition({[this._name]:`<${e}`})}isVersionEqualTo(e){return this._checkCondition({[this._name]:`~${e}`})}}class xpn extends bpn{doesVideoMuteByStreamRemove(){return this.isChromiumBased()||this.isWebKitBased()}supportsP2P(){return!this.usesUnifiedPlan()}isChromiumBased(){return this.isChrome()||this.isElectron()||this.isNWJS()||this.isOpera()}isWebKitBased(){return this._bowser.isEngine("webkit")&&typeof navigator.mediaDevices<"u"&&typeof navigator.mediaDevices.getUserMedia<"u"&&typeof window.RTCRtpTransceiver<"u"&&Object.keys(RTCRtpTransceiver.prototype).indexOf("currentDirection")>-1}isSupported(){return typeof RTCPeerConnection<"u"}isUserInteractionRequiredForUnmute(){return this.isFirefox()&&this.isVersionLessThan("68")}supportsVideoMuteOnConnInterrupted(){return this.isChromiumBased()||this.isReactNative()||this.isWebKitBased()}supportsBandwidthStatistics(){return!this.isFirefox()&&!this.isWebKitBased()}supportsCodecPreferences(){return this.usesUnifiedPlan()&&typeof window.RTCRtpTransceiver<"u"&&Object.keys(window.RTCRtpTransceiver.prototype).indexOf("setCodecPreferences")>-1&&Object.keys(RTCRtpSender.prototype).indexOf("getCapabilities")>-1&&!this.isWebKitBased()}supportsDeviceChangeEvent(){return navigator.mediaDevices&&typeof navigator.mediaDevices.ondevicechange<"u"&&typeof navigator.mediaDevices.addEventListener<"u"}supportsLocalCandidateRttStatistics(){return this.isChromiumBased()||this.isReactNative()||this.isWebKitBased()}supportsPerformanceObserver(){return typeof window.PerformanceObserver<"u"&&PerformanceObserver.supportedEntryTypes.indexOf("longtask")>-1}supportsReceiverStats(){return typeof window.RTCRtpReceiver<"u"&&Object.keys(RTCRtpReceiver.prototype).indexOf("getSynchronizationSources")>-1}supportsRTTStatistics(){return!this.isFirefox()}usesPlanB(){return!this.usesUnifiedPlan()}usesSdpMungingForSimulcast(){return this.isChromiumBased()||this.isReactNative()||this.isWebKitBased()}usesUnifiedPlan(){return!!(this.isFirefox()||this.isWebKitBased())}usesNewGumFlow(){return!!(this.isChromiumBased()||this.isFirefox()||this.isWebKitBased())}usesAdapter(){return this.usesNewGumFlow()}usesRidsForSimulcast(){return!1}supportsGetDisplayMedia(){return typeof navigator.getDisplayMedia<"u"||typeof navigator.mediaDevices<"u"&&typeof navigator.mediaDevices.getDisplayMedia<"u"}supportsInsertableStreams(){if(!(typeof window.RTCRtpSender<"u"&&(window.RTCRtpSender.prototype.createEncodedStreams||window.RTCRtpSender.prototype.createEncodedVideoStreams)))return!1;const e=new ReadableStream;try{return window.postMessage(e,"*",[e]),!0}catch{return!1}}supportsAudioRed(){return!!(window.RTCRtpSender&&window.RTCRtpSender.getCapabilities&&window.RTCRtpSender.getCapabilities("audio").codecs.some(e=>e.mimeType==="audio/red")&&window.RTCRtpReceiver&&window.RTCRtpReceiver.getCapabilities&&window.RTCRtpReceiver.getCapabilities("audio").codecs.some(e=>e.mimeType==="audio/red"))}supportsSdpSemantics(){return this.isChromiumBased()}_getChromiumBasedVersion(){if(this.isChromiumBased()){if(this.isNWJS())return Number.parseInt(process.versions.chromium,10);const e=navigator.userAgent;if(e.match(/Chrome/))return Number.parseInt(e.match(/Chrome\/([\d.]+)/)[1],10)}return-1}isIOSMobile(){return this.isMobile&&this._bowser.getOSName()==="iOS"}}const so=new xpn;var Zd={},wpn={get exports(){return Zd},set exports(t){Zd=t}},VA=typeof Reflect=="object"?Reflect:null,YOe=VA&&typeof VA.apply=="function"?VA.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)},$G;VA&&typeof VA.ownKeys=="function"?$G=VA.ownKeys:Object.getOwnPropertySymbols?$G=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:$G=function(t){return Object.getOwnPropertyNames(t)};function kpn(t){console&&console.warn&&console.warn(t)}var hft=Number.isNaN||function(t){return t!==t};function sa(){sa.init.call(this)}wpn.exports=sa;Zd.once=Epn;sa.EventEmitter=sa;sa.prototype._events=void 0;sa.prototype._eventsCount=0;sa.prototype._maxListeners=void 0;var QOe=10;function jte(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(sa,"defaultMaxListeners",{enumerable:!0,get:function(){return QOe},set:function(t){if(typeof t!="number"||t<0||hft(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");QOe=t}});sa.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};sa.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||hft(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function mft(t){return t._maxListeners===void 0?sa.defaultMaxListeners:t._maxListeners}sa.prototype.getMaxListeners=function(){return mft(this)};sa.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r=t==="error",s=this._events;if(s!==void 0)r=r&&s.error===void 0;else if(!r)return!1;if(r){var i;if(e.length>0&&(i=e[0]),i instanceof Error)throw i;var o=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw o.context=i,o}var l=s[t];if(l===void 0)return!1;if(typeof l=="function")YOe(l,this,e);else for(var c=l.length,d=yft(l,c),n=0;n<c;++n)YOe(d[n],this,e);return!0};function fft(t,e,n,r){var s,i,o;if(jte(n),i=t._events,i===void 0?(i=t._events=Object.create(null),t._eventsCount=0):(i.newListener!==void 0&&(t.emit("newListener",e,n.listener?n.listener:n),i=t._events),o=i[e]),o===void 0)o=i[e]=n,++t._eventsCount;else if(typeof o=="function"?o=i[e]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),s=mft(t),s>0&&o.length>s&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=o.length,kpn(l)}return t}sa.prototype.addListener=function(t,e){return fft(this,t,e,!1)};sa.prototype.on=sa.prototype.addListener;sa.prototype.prependListener=function(t,e){return fft(this,t,e,!0)};function Spn(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function pft(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},s=Spn.bind(r);return s.listener=n,r.wrapFn=s,s}sa.prototype.once=function(t,e){return jte(e),this.on(t,pft(this,t,e)),this};sa.prototype.prependOnceListener=function(t,e){return jte(e),this.prependListener(t,pft(this,t,e)),this};sa.prototype.removeListener=function(t,e){var n,r,s,i,o;if(jte(e),r=this._events,r===void 0)return this;if(n=r[t],n===void 0)return this;if(n===e||n.listener===e)--this._eventsCount===0?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if(typeof n!="function"){for(s=-1,i=n.length-1;i>=0;i--)if(n[i]===e||n[i].listener===e){o=n[i].listener,s=i;break}if(s<0)return this;s===0?n.shift():Cpn(n,s),n.length===1&&(r[t]=n[0]),r.removeListener!==void 0&&this.emit("removeListener",t,o||e)}return this};sa.prototype.off=sa.prototype.removeListener;sa.prototype.removeAllListeners=function(t){var e,n,r;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[t]),this;if(arguments.length===0){var s=Object.keys(n),i;for(r=0;r<s.length;++r)i=s[r],i!=="removeListener"&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(e=n[t],typeof e=="function")this.removeListener(t,e);else if(e!==void 0)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this};function gft(t,e,n){var r=t._events;if(r===void 0)return[];var s=r[e];return s===void 0?[]:typeof s=="function"?n?[s.listener||s]:[s]:n?jpn(s):yft(s,s.length)}sa.prototype.listeners=function(t){return gft(this,t,!0)};sa.prototype.rawListeners=function(t){return gft(this,t,!1)};sa.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):vft.call(t,e)};sa.prototype.listenerCount=vft;function vft(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}sa.prototype.eventNames=function(){return this._eventsCount>0?$G(this._events):[]};function yft(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function Cpn(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function jpn(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}function Epn(t,e){return new Promise(function(n,r){function s(o){t.removeListener(e,i),r(o)}function i(){typeof t.removeListener=="function"&&t.removeListener("error",s),n([].slice.call(arguments))}bft(t,e,i,{once:!0}),e!=="error"&&Npn(t,s,{once:!0})})}function Npn(t,e,n){typeof t.on=="function"&&bft(t,"error",e,n)}function bft(t,e,n,r){if(typeof t.on=="function")r.once?t.once(e,n):t.on(e,n);else if(typeof t.addEventListener=="function")t.addEventListener(e,function s(i){r.once&&t.removeEventListener(e,s),n(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}var Vr;(function(t){t[t.MAJOR_EVENT=0]="MAJOR_EVENT",t[t.MINOR_EVENT=1]="MINOR_EVENT"})(Vr||(Vr={}));var Zt;(function(t){t.PRECALL_TEST_BEGIN="precall_begin",t.PRECALL_TEST_COMPLETE="precall_end",t.CALL_JOIN_BEGIN="call_join",t.NET_QUALITY_TEST_BEGIN="net_quality_test_begin",t.NET_QUALITY_TEST_END="net_quality_test_end",t.WEBSOCKET_CONNECTED="websocket_connected",t.TRANSPORT_CONNECTED="transport_connected",t.AUDIO_ON="audio_on",t.AUDIO_OFF="audio_off",t.VIDEO_ON="video_on",t.VIDEO_OFF="video_off",t.PARTICIPANT_ROLE="participant_role",t.PING_STAT="ping_stat",t.DISCONNECT="disconnect",t.RECONNECT_ATTEMPT="reconnect_attempt",t.SCREENSHARE_START_REQUESTED="screenshare_start_requested",t.SCREENSHARE_STARTED="screenshare_started",t.SCREENSHARE_STOPPED="screenshare_stopped",t.TAB_CHANGE="tab_change",t.BROWSER_BACKGROUNDED="browser_backgrounded",t.BROWSER_FOREGROUNDED="browser_foregrounded",t.DOMINANT_SPEAKER="dominant_speaker",t.AUDIO_DEVICES_UPDATES="audio_devices_updates",t.VIDEO_DEVICES_UPDATES="video_devices_updates",t.SPEAKER_DEVICES_UPDATES="speaker_devices_updates",t.SELECTED_MICROHPONE_UPDATE="selected_microphone_update",t.SELECTED_CAMERA_UPDATE="selected_camera_update",t.SELECTED_SPEAKER_UPDATE="selected_speaker_update",t.EXPECTED_VIDEO_RESOLUTION="expected_video_resolution",t.EXPECTED_SCREENSHARE_RESOLUTION="expected_screenshare_resolution",t.MEDIA_PERMISSION="media_permission",t.LEGACY_SWITCH="legacy_switch",t.AUDIO_PLAY_FAILED="audio_play_failed",t.VIDEO_PLAY_FAILED="video_play_failed",t.AUDIO_TRACK_MUTED="audio_track_muted",t.VIDEO_TRACK_MUTED="video_track_muted",t.IVS_PLAYER_REBUFFERING="ivs_player_rebuffering",t.IVS_PLAYER_AUDIO_BLOCKED="ivs_player_audio_blocked",t.IVS_PLAYER_PLAYBACK_BLOCKED="ivs_player_playback_blocked",t.IVS_PLAYER_ERROR="ivs_player_error",t.IVS_PLAYER_RECOVERABLE_ERROR="ivs_player_recoverable_error",t.IVS_PLAYER_WORKER_ERROR="ivs_player_worker_error",t.IVS_PLAYER_NETWORK_UNAVAILABLE="ivs_player_network_unavailable",t.LIVESTREAM_LATENCY="livestream_latency",t.IVS_PLAYER_ANALYTICS_EVENT="ivs_player_analytics_event",t.IVS_PLAYER_PLAYBACK_RATE_CHANGED="ivs_player_playback_rate_changed",t.IVS_PLAYER_QUALITY_CHANGED="ivs_player_quality_changed",t.IVS_PLAYER_INITIALIZED="ivs_player_initialized"})(Zt||(Zt={}));const Tpn=new Map([[Zt.PRECALL_TEST_BEGIN,Vr.MINOR_EVENT],[Zt.PRECALL_TEST_COMPLETE,Vr.MINOR_EVENT],[Zt.CALL_JOIN_BEGIN,Vr.MAJOR_EVENT],[Zt.NET_QUALITY_TEST_BEGIN,Vr.MINOR_EVENT],[Zt.NET_QUALITY_TEST_END,Vr.MINOR_EVENT],[Zt.WEBSOCKET_CONNECTED,Vr.MINOR_EVENT],[Zt.TRANSPORT_CONNECTED,Vr.MAJOR_EVENT],[Zt.AUDIO_ON,Vr.MINOR_EVENT],[Zt.AUDIO_OFF,Vr.MINOR_EVENT],[Zt.VIDEO_ON,Vr.MINOR_EVENT],[Zt.VIDEO_OFF,Vr.MINOR_EVENT],[Zt.PARTICIPANT_ROLE,Vr.MINOR_EVENT],[Zt.PING_STAT,Vr.MAJOR_EVENT],[Zt.DISCONNECT,Vr.MAJOR_EVENT],[Zt.RECONNECT_ATTEMPT,Vr.MAJOR_EVENT],[Zt.SCREENSHARE_START_REQUESTED,Vr.MINOR_EVENT],[Zt.SCREENSHARE_STARTED,Vr.MINOR_EVENT],[Zt.SCREENSHARE_STOPPED,Vr.MINOR_EVENT],[Zt.TAB_CHANGE,Vr.MINOR_EVENT],[Zt.BROWSER_BACKGROUNDED,Vr.MINOR_EVENT],[Zt.BROWSER_FOREGROUNDED,Vr.MINOR_EVENT],[Zt.DOMINANT_SPEAKER,Vr.MINOR_EVENT],[Zt.AUDIO_DEVICES_UPDATES,Vr.MINOR_EVENT],[Zt.VIDEO_DEVICES_UPDATES,Vr.MINOR_EVENT],[Zt.SPEAKER_DEVICES_UPDATES,Vr.MINOR_EVENT],[Zt.SELECTED_MICROHPONE_UPDATE,Vr.MINOR_EVENT],[Zt.SELECTED_CAMERA_UPDATE,Vr.MINOR_EVENT],[Zt.SELECTED_SPEAKER_UPDATE,Vr.MINOR_EVENT],[Zt.MEDIA_PERMISSION,Vr.MINOR_EVENT],[Zt.LEGACY_SWITCH,Vr.MINOR_EVENT],[Zt.AUDIO_PLAY_FAILED,Vr.MINOR_EVENT],[Zt.VIDEO_PLAY_FAILED,Vr.MINOR_EVENT],[Zt.AUDIO_TRACK_MUTED,Vr.MINOR_EVENT],[Zt.VIDEO_TRACK_MUTED,Vr.MINOR_EVENT],[Zt.IVS_PLAYER_REBUFFERING,Vr.MAJOR_EVENT],[Zt.IVS_PLAYER_AUDIO_BLOCKED,Vr.MAJOR_EVENT],[Zt.IVS_PLAYER_PLAYBACK_BLOCKED,Vr.MAJOR_EVENT],[Zt.IVS_PLAYER_ERROR,Vr.MAJOR_EVENT],[Zt.IVS_PLAYER_RECOVERABLE_ERROR,Vr.MAJOR_EVENT],[Zt.IVS_PLAYER_WORKER_ERROR,Vr.MAJOR_EVENT],[Zt.IVS_PLAYER_NETWORK_UNAVAILABLE,Vr.MAJOR_EVENT],[Zt.LIVESTREAM_LATENCY,Vr.MAJOR_EVENT],[Zt.IVS_PLAYER_ANALYTICS_EVENT,Vr.MINOR_EVENT],[Zt.IVS_PLAYER_PLAYBACK_RATE_CHANGED,Vr.MINOR_EVENT],[Zt.IVS_PLAYER_QUALITY_CHANGED,Vr.MINOR_EVENT],[Zt.IVS_PLAYER_INITIALIZED,Vr.MINOR_EVENT],[Zt.EXPECTED_VIDEO_RESOLUTION,Vr.MINOR_EVENT],[Zt.EXPECTED_SCREENSHARE_RESOLUTION,Vr.MINOR_EVENT]]);class _pn{constructor(){xe(this,"events"),this.events=[]}add(e){this.events.push(e)}flush(){return{entries:this.events.splice(0,25)}}}class Apn extends Zd{constructor({logger:e,peerId:n,apiHostnames:r,authToken:s}){super(),xe(this,"logger"),xe(this,"peerId"),xe(this,"eventStore"),xe(this,"apiEndpoint"),xe(this,"authToken"),this.logger=e,this.peerId=n,this.authToken=s,this.apiEndpoint=`https://${r.daCollector}/api/v1/message`,this.eventStore=new _pn}sendEventsChunkToServer(e){return me(this,null,function*(){const n={payload:e,peerId:this.peerId},r=new AbortController,s=setTimeout(()=>r.abort(),3e3);try{return yield fetch(this.apiEndpoint,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${this.authToken}`},body:JSON.stringify(n),signal:r.signal}),!0}catch(i){return this.logger.error("callStats::sendEventsChunkToServer::catch",{peerId:this.peerId,endpoint:this.apiEndpoint,error:i instanceof Error?i.message:String(i),stack:i instanceof Error?i.stack:void 0}),!1}finally{clearTimeout(s)}})}callEvent(e){e.timestamp=new Date,this.eventStore.add(e),this.emit(e.event,e.metaData),Tpn.get(e.event)===Vr.MAJOR_EVENT&&this.flush()}flush(){return me(this,null,function*(){var e;const n=this.eventStore.flush();if((e=n==null?void 0:n.entries)!=null&&e.length){const r=yield this.sendEventsChunkToServer(n);return r||n.entries.forEach(s=>{this.eventStore.add(s)}),r}return!1})}}var ZOe;(function(t){t.CHROMIUM="chromum",t.FIREFOX="firefox",t.SAFARI="safari"})(ZOe||(ZOe={}));const xft={DEVEL:"devel",PREPROD:"preprod",PROD:"prod"};var ef;(function(t){t.AUDIO="AUDIO",t.VIDEO="VIDEO",t.SPEAKER="SPEAKER",t.SCREENSHARE="SCREENSHARE"})(ef||(ef={}));var JOe;(function(t){t[t.INIT=0]="INIT",t[t.ACCEPTED=1]="ACCEPTED",t[t.DENIED=2]="DENIED",t[t.SYS_DENIED=3]="SYS_DENIED",t[t.FAILED=4]="FAILED",t[t.NOTFOUND=5]="NOTFOUND",t[t.NOT_APPLICABLE=6]="NOT_APPLICABLE"})(JOe||(JOe={}));function tk(t){return t?t.split(".").slice(0,2).concat(["0","0"]).join("."):""}function FY({packetsLost:t,packetsSent:e}){return e>0?t*100/e:0}function BY({packetsLost:t,packetsReceived:e}){return e+t>0?t*100/(e+t):0}const wft=240,kft=720,Sft=8,Cft=3,Ete=10,Nte=.02,Tte=.03;function kx({stat:t,weight:e,rangeMin:n,rangeMax:r,rangeRankingDirection:s}){return t==null?e:n===r?s==="UP"?t<=n?e:0:t>=r?e:0:s==="UP"?(1-Math.max(Math.min(r,Math.abs(t))-n,0)/(r-n))*e:s==="DOWN"?Math.max(Math.min(r,Math.abs(t))-n,0)/(r-n)*e:e}function jft({isLowQualityVideo:t,isVideoStuck:e,isVideoLagging:n,jitterQuality:r,packetsLostQuality:s}){const i=.8*((t?.85:1)*(n?.7:1)*(e?.5:1))+.2*(r*s);return Math.round((i+Number.EPSILON)*100)/100}function Eft({packetsLost:t,packetsSent:e}){return e>0?t*100/e:0}function Nft({packetsLost:t,packetsSent:e,jitter:n}){const r=kx({stat:Eft({packetsLost:t,packetsSent:e}),weight:.7,rangeMin:0,rangeMax:Ete,rangeRankingDirection:"UP"}),s=kx({stat:n,weight:.3,rangeMin:Nte,rangeMax:Tte,rangeRankingDirection:"UP"});return r+s}function Ppn({frameWidth:t,isScreenShare:e}){return t<(e?kft:wft)}function Rpn({framesPerSecond:t,isScreenShare:e}){return t<(e?Cft:Sft)}function Ipn({framesEncoded:t}){return t===0}function Tft({frameWidth:t,framesPerSecond:e,packetsLost:n,packetsSent:r,jitter:s,isScreenShare:i,framesEncoded:o}){const l=kx({stat:Eft({packetsLost:n,packetsSent:r}),weight:1,rangeMin:0,rangeMax:Ete,rangeRankingDirection:"UP"}),c=kx({stat:s,weight:1,rangeMin:Nte,rangeMax:Tte,rangeRankingDirection:"UP"}),d=Ppn({frameWidth:t,isScreenShare:i}),u=Rpn({framesPerSecond:e,isScreenShare:i}),h=Ipn({framesEncoded:o,isScreenShare:i});return jft({isLowQualityVideo:d,isVideoLagging:u,isVideoStuck:h,jitterQuality:c,packetsLostQuality:l})}function _ft({packetsLost:t,packetsReceived:e}){return e+t>0?t*100/(e+t):0}function Aft({concealmentEvents:t,packetsLost:e,packetsReceived:n,jitter:r}){const s=kx({stat:t,weight:.2,rangeMin:0,rangeMax:3,rangeRankingDirection:"UP"}),i=.5,o=kx({stat:_ft({packetsLost:e,packetsReceived:n}),weight:i,rangeMin:0,rangeMax:Ete,rangeRankingDirection:"UP"}),l=kx({stat:r,weight:.3,rangeMin:Nte,rangeMax:Tte,rangeRankingDirection:"UP"});return s+o+l}function Mpn({framesDecoded:t}){return t===0}function Lpn({framesPerSecond:t,isScreenShare:e}){return t<(e?Cft:Sft)}function Dpn({frameWidth:t,isScreenShare:e}){return t<(e?kft:wft)}function Pft({frameWidth:t,framesPerSecond:e,packetsLost:n,packetsReceived:r,jitter:s,isScreenShare:i,framesDecoded:o}){const l=kx({stat:_ft({packetsLost:n,packetsReceived:r}),weight:1,rangeMin:0,rangeMax:Ete,rangeRankingDirection:"UP"}),c=kx({stat:s,weight:1,rangeMin:Nte,rangeMax:Tte,rangeRankingDirection:"UP"}),d=Dpn({frameWidth:t,isScreenShare:i}),u=Lpn({framesPerSecond:e,isScreenShare:i}),h=Mpn({framesDecoded:o,isScreenShare:i});return jft({isLowQualityVideo:d,isVideoLagging:u,isVideoStuck:h,jitterQuality:c,packetsLostQuality:l})}class e0{constructor(e){xe(this,"pc1"),xe(this,"pc2"),xe(this,"constrainVideoBitrateKbps"),xe(this,"constrainOfferToRemoveVideoFec",!1),xe(this,"iceCandidateFilter");const n=new RTCPeerConnection(e),r=new RTCPeerConnection(e);this.pc1=n,this.pc2=r,this.iceCandidateFilter=e0.noFilter,this.pc1.addEventListener("icecandidate",this.onIceCandidate.bind(this,this.pc2)),this.pc2.addEventListener("icecandidate",this.onIceCandidate.bind(this,this.pc1))}static parseCandidate(e){const n="candidate:",r=e.indexOf(n)+n.length,s=e.substr(r).split(" ");return{type:s[7],protocol:s[2],address:s[4]}}static isNotHostCandidate(e){return e.type!=="host"}static isHost(e){return e.type==="host"}static isRelay(e){return e.type==="relay"}static isReflexive(e){return e.type==="srflx"}static noFilter(e){return!0}onIceCandidate(e,n){if(n.candidate){const r=e0.parseCandidate(n.candidate.candidate);this.iceCandidateFilter(r)&&e.addIceCandidate(n.candidate)}}setIceCandidateFilter(e){this.iceCandidateFilter=e}constrainVideoBitrate(e){this.constrainVideoBitrateKbps=e}disableVideoFec(){this.constrainOfferToRemoveVideoFec=!0}gotOffer(e){this.constrainOfferToRemoveVideoFec&&(e.sdp=e.sdp.replace(/(m=video 1 [^\r]+)(116 117)(\r\n)/g,`$1\r
`),e.sdp=e.sdp.replace(/a=rtpmap:116 red\/90000\r\n/g,""),e.sdp=e.sdp.replace(/a=rtpmap:117 ulpfec\/90000\r\n/g,""),e.sdp=e.sdp.replace(/a=rtpmap:98 rtx\/90000\r\n/g,""),e.sdp=e.sdp.replace(/a=fmtp:98 apt=116\r\n/g,"")),this.pc1.setLocalDescription(e),this.pc2.setRemoteDescription(e),this.pc2.createAnswer().then(this.gotAnswer.bind(this),this.reportFatal.bind(this))}gotAnswer(e){this.constrainVideoBitrateKbps&&(e.sdp=e.sdp.replace(/a=mid:video\r\n/g,`a=mid:video\r
b=AS:${this.constrainVideoBitrateKbps}\r
`)),this.pc2.setLocalDescription(e),this.pc1.setRemoteDescription(e)}establishConnection(){this.pc1.createOffer().then(this.gotOffer.bind(this),this.reportFatal.bind(this))}reportFatal(e){console.error("Error:",e)}getRoundTripTime(){return me(this,null,function*(){const[e,n]=yield Promise.all([this.pc1.getStats(),this.pc2.getStats()]);let r,s;if(e.forEach(i=>{i.type==="candidate-pair"&&i.nominated===!0&&i.bytesSent>0&&(r=i)}),n.forEach(i=>{i.type==="candidate-pair"&&i.nominated===!0&&i.bytesReceived>0&&(s=i)}),r&&s)try{if(r.currentRoundTripTime&&s.currentRoundTripTime)return{rtt:r.currentRoundTripTime,backendRTT:s.currentRoundTripTime};const i=(s.lastPacketReceivedTimestamp-r.lastPacketSentTimestamp)/1e3;return{rtt:i,backendRTT:i}}catch{return}})}close(){this.pc1.close(),this.pc2.close()}}class Rft extends Zd{constructor(e){super(),xe(this,"call"),xe(this,"timeOut"),this.call=new e0(e)}start(e=1e4){this.call.establishConnection(),this.timeOut=setTimeout(this.testFailed.bind(this),e)}testComplete(e){clearTimeout(this.timeOut),this.call.close(),this.emit("done",e)}testFailed(e){this.call.close(),this.emit("failed",e)}}const $pn=8,Opn=1/1e3;class Fpn extends Rft{constructor(e){super(e),xe(this,"senderChannel"),xe(this,"recieveChannel"),xe(this,"startTime"),xe(this,"lastBitrateMeasureTime"),xe(this,"sentPayloadBytes",0),xe(this,"recievedPayloadBytes",0),xe(this,"lastReceivedPayloadBytes",0),xe(this,"stopSending",!1),xe(this,"testProgress",0),xe(this,"samplePacket",""),xe(this,"finalBitrateSum",0),xe(this,"bitRateSampels",0),xe(this,"maxNumberOfPacketsToSend",0),xe(this,"bytesToKeepBuffered",0),xe(this,"testDurationSeconds",5),this.call.setIceCandidateFilter(e0.isNotHostCandidate),this.senderChannel=this.call.pc1.createDataChannel(null);for(let n=0;n<1024*256;n+=1)this.samplePacket+="h";this.maxNumberOfPacketsToSend=1,this.bytesToKeepBuffered=1024*this.maxNumberOfPacketsToSend,this.testDurationSeconds=4,this.senderChannel.addEventListener("open",this.sendingStep.bind(this)),this.call.pc2.addEventListener("datachannel",this.onRecieverChannel.bind(this))}sendingStep(){const e=new Date;this.startTime||(this.startTime=e,this.lastBitrateMeasureTime=e);for(let r=0;r!==this.maxNumberOfPacketsToSend&&!(this.senderChannel.bufferedAmount>=this.bytesToKeepBuffered);r+=1){this.sentPayloadBytes+=this.samplePacket.length;try{this.senderChannel.send(this.samplePacket)}catch{}}const n=e.getTime()-this.startTime.getTime();n>=1e3*this.testDurationSeconds?(this.stopSending=!0,this.testProgress=100):(this.testProgress=n/(10*this.testDurationSeconds),setTimeout(this.sendingStep.bind(this),1))}onMessageRecieved(e){this.recievedPayloadBytes+=e.data.length;const n=new Date,r=n.getTime()-this.lastBitrateMeasureTime.getTime();if(r>=1e3){const s=(this.recievedPayloadBytes-this.lastReceivedPayloadBytes)*$pn/(r/1e3);this.finalBitrateSum+=s,this.bitRateSampels+=1,this.lastReceivedPayloadBytes=this.recievedPayloadBytes,this.lastBitrateMeasureTime=n}if(this.stopSending&&this.sentPayloadBytes===this.recievedPayloadBytes){const s=this.finalBitrateSum/this.bitRateSampels;this.testComplete({throughput:Math.round(s*Opn)})}}testComplete(e){this.call.getRoundTripTime().then(({rtt:n,backendRTT:r})=>super.testComplete({RTT:n,backendRTT:r,throughput:e.throughput}))}onRecieverChannel(e){this.recieveChannel=e.channel,this.recieveChannel.addEventListener("message",this.onMessageRecieved.bind(this))}}class H2e extends Rft{constructor(e,n=e0.noFilter){super(e),xe(this,"ch1"),xe(this,"ch2"),this.call.setIceCandidateFilter(n);const r=this.call.pc1.createDataChannel(null);this.ch1=r,r.addEventListener("open",()=>{r.send("hello")}),r.addEventListener("message",this.onCh1Recieve.bind(this)),this.call.pc2.addEventListener("datachannel",this.dataChannelHandler.bind(this))}onCh1Recieve(e){e.data!=="world"?this.hangup("Invalid data transmitted."):this.testComplete({connectivity:!0})}onCh2Recieve(e){if(e.data!=="hello")this.hangup("Invalid data transmitted.");else try{this.ch2.send("world")}catch{}}dataChannelHandler(e){const n=e.channel;this.ch2=n,n.addEventListener("message",this.onCh2Recieve.bind(this))}hangup(e){this.testFailed(e)}}class Bpn extends H2e{constructor(e){super(e,e0.isHost)}}class Upn extends H2e{constructor(e){super(e,e0.isRelay)}}class zpn extends H2e{constructor(e){super(e,e0.isReflexive)}}class Vpn{constructor(){xe(this,"ipInformation",null)}getIPDetails(e){return me(this,arguments,function*({peerId:n,apiHostnames:r,logger:s}){var i,o,l;if(!this.ipInformation){try{const c=`https://${r.location}`,d=yield(yield fetch(c)).json();if(((i=d.loc)==null?void 0:i.length)>5)return this.ipInformation=d,(o=this.ipInformation)!=null&&o.ip&&(this.ipInformation.ip=tk(this.ipInformation.ip)),d;throw Error("Insufficient data")}catch(c){s.error("callstats::ipDetails:: failed to fetch ip using location service",{error:c})}try{const c=yield fetch(`https://${r.locationLegacy}/?token=3c493932b0624c&peerId=${n}`,{method:"POST"});this.ipInformation=yield c.json(),(l=this.ipInformation)!=null&&l.ip&&(this.ipInformation.ip=tk(this.ipInformation.ip))}catch(c){s.error("callstats::ipDetails:: failed to fetch ip using legacy location service",{error:c})}}return this.ipInformation})}resetCache(){this.ipInformation=null}}const Ift=new Vpn,XOe=[{urls:"turn:turn.dyte.in:443?transport=tcp",username:"dyte",credential:"dytein",credentialType:"password"},{urls:"turn:turn.dyte.in:3478?transport=udp",username:"dyte",credential:"dytein",credentialType:"password"}];function e6e(t){const[e,n]=t.split(",");return{coords:{latitude:Number(e),longitude:Number(n)}}}class Mft{constructor(){xe(this,"transport"),xe(this,"candidatePair"),xe(this,"outboundVideoRtp",new Map),xe(this,"inboundVideoRtp",new Map),xe(this,"outboundAudioRtp",new Map),xe(this,"inboundAudioRtp",new Map),xe(this,"remoteInboundRtp",new Map),xe(this,"producerStreamMap",new Map),xe(this,"consumerStreamMap",new Map),xe(this,"staleProducerStreamMap",!1),xe(this,"staleConsumerStreamMap",!1)}}class Lft extends Zd{constructor(){super(),xe(this,"observer"),xe(this,"outboundProducerMap",new Map),xe(this,"inboundConsumerMap",new Map),xe(this,"consumerPeerIdMap",new Map),xe(this,"pausedConsumerMap",new Map),xe(this,"pausedProducerMap",new Map),xe(this,"overallProducingTransportsStatsMap",{}),xe(this,"overallConsumingTransportsStatsMap",{}),xe(this,"overallConsumersStatsMap",{}),xe(this,"overallProducersStatsMap",{}),xe(this,"videoProducerToStatsMap",new Map),xe(this,"audioProducerToStatsMap",new Map),xe(this,"videoConsumerToStatsMap",new Map),xe(this,"audioConsumerToStatsMap",new Map),xe(this,"consumerIdsWithFreezedVideo",new Set),xe(this,"consumerIdsWithFreezedAudio",new Set),xe(this,"producerIdsWithFreezedVideo",new Set),xe(this,"producerIdsWithFreezedAudio",new Set),xe(this,"freezedProducingTransportIds",new Set),xe(this,"freezedConsumingTransportIds",new Set),xe(this,"screenShareProducers",new Set),xe(this,"screenShareConsumers",new Set),xe(this,"ipDetails"),xe(this,"callStatsInstance"),this.observer=new Zd}registerProducer(e){return me(this,null,function*(){yield this.generateProducerStreamMap(e),e.on("close",this.deregisterProducer.bind(this,e)),e.on("pause",this.pauseProducer.bind(this,e.id)),e.on("resume",this.resumeProducer.bind(this,e.id)),e.appData.screenShare===!0&&this.screenShareProducers.add(e.id)})}pauseProducer(e){this.pausedProducerMap.set(e,{lastReportCalculated:!1})}resumeProducer(e){this.pausedProducerMap.delete(e)}processInboundConsumerVideoStats(e,n,r){var s,i;const o=((i=(s=this==null?void 0:this.callStatsInstance)==null?void 0:s.consumerSharedMediaStatesMap)==null?void 0:i.get(e))||{};n.totalVideoPacketsReceived===r.packetsReceived?(this.consumerIdsWithFreezedVideo.add(e),this.callStatsInstance&&o.video&&(this.callStatsInstance.logger.debug("callstats::measurements::consumerVideoFreezed",{consumerId:e}),this.callStatsInstance.eventHandler.emit("consumer_video_status","pause",e))):(n.totalVideoPacketsReceived=r.packetsReceived,this.consumerIdsWithFreezedVideo.has(e)&&(this.consumerIdsWithFreezedVideo.delete(e),this.callStatsInstance&&o.video&&(this.callStatsInstance.logger.debug("callstats::measurements::consumerVideoDefreezed",{consumerId:e}),this.callStatsInstance.eventHandler.emit("consumer_video_status","resume",e))))}processInboundConsumerAudioStats(e,n,r){var s,i;const o=((i=(s=this==null?void 0:this.callStatsInstance)==null?void 0:s.consumerSharedMediaStatesMap)==null?void 0:i.get(e))||{};n.totalAudioPacketsReceived===r.packetsReceived?(this.consumerIdsWithFreezedAudio.add(e),this.callStatsInstance&&o.audio&&(this.callStatsInstance.logger.debug("callStats::measurements::consumerAudioFreezed",{consumerId:e}),this.callStatsInstance.eventHandler.emit("consumer_audio_status","pause",e))):(n.totalAudioPacketsReceived=r.packetsReceived,this.consumerIdsWithFreezedAudio.has(e)&&(this.consumerIdsWithFreezedAudio.delete(e),this.callStatsInstance&&o.audio&&(this.callStatsInstance.logger.debug("callStats::measurements::consumerAudioDefreezed",{consumerId:e}),this.callStatsInstance.eventHandler.emit("consumer_audio_status","resume",e))))}processOutboundProducerVideoStats(e,n,r){var s;const i=((s=this==null?void 0:this.callStatsInstance)==null?void 0:s.currentUserMediaStates)||{};n.totalVideoPacketsSent===r.packetsSent?(this.producerIdsWithFreezedVideo.add(e),this.callStatsInstance&&i.video&&(this.callStatsInstance.logger.debug("callStats::measurements::producerVideoFreezed",{producerId:e}),this.callStatsInstance.eventHandler.emit("producer_video_status","pause",e))):(n.totalVideoPacketsSent=r.packetsSent,this.producerIdsWithFreezedVideo.has(e)&&(this.producerIdsWithFreezedVideo.delete(e),this.callStatsInstance&&i.video&&(this.callStatsInstance.logger.debug("callStats::measurements::producerVideoDefreezed",{producerId:e}),this.callStatsInstance.eventHandler.emit("producer_video_status","resume",e))))}processOutboundProducerAudioStats(e,n,r){var s;const i=((s=this==null?void 0:this.callStatsInstance)==null?void 0:s.currentUserMediaStates)||{};n.totalAudioPacketsSent===r.packetsSent?(this.producerIdsWithFreezedAudio.add(e),this.callStatsInstance&&i.audio&&(this.callStatsInstance.logger.debug("callStats::measurements::producerAudioFreezed",{producerId:e}),this.callStatsInstance.eventHandler.emit("producer_audio_status","pause",e))):(n.totalAudioPacketsSent=r.packetsSent,this.producerIdsWithFreezedAudio.has(e)&&(this.producerIdsWithFreezedAudio.delete(e),this.callStatsInstance&&i.audio&&(this.callStatsInstance.logger.debug("callStats::measurements::producerAudioDefreezed",{producerId:e}),this.callStatsInstance.eventHandler.emit("producer_audio_status","resume",e))))}processProducingTransportStats(e,n,r){var s;const i=((s=this==null?void 0:this.callStatsInstance)==null?void 0:s.currentUserMediaStates)||{},{audio:o,video:l,screen:c}=i,d=o||l||c;n.totalPacketsSent===r.packetsSent?(this.freezedProducingTransportIds.add(e),this.callStatsInstance&&d&&(this.callStatsInstance.logger.debug("callStats::measurements::producingTransportFreezed",{transportId:e}),this.callStatsInstance.eventHandler.emit("producing_transport_status","pause",e))):(n.totalPacketsSent=r.packetsSent,this.freezedProducingTransportIds.has(e)&&(this.freezedProducingTransportIds.delete(e),this.callStatsInstance&&d&&(this.callStatsInstance.logger.debug("callStats::measurements::producingTransportDefreezed",{transportId:e}),this.callStatsInstance.eventHandler.emit("producing_transport_status","resume",e))))}processConsumingTransportStats(e,n,r){var s,i;const o=!!Array.from(((i=(s=this==null?void 0:this.callStatsInstance)==null?void 0:s.consumerSharedMediaStatesMap)==null?void 0:i.values())||[]).reduce((l,c)=>l||c.audio||c.video||c.screen,!1);n.totalPacketsReceived===r.packetsSent?(this.freezedConsumingTransportIds.add(e),this.callStatsInstance&&o&&(this.callStatsInstance.logger.debug("callStats::measurements::consumingTransportFreezed",{transportId:e}),this.callStatsInstance.eventHandler.emit("consuming_transport_status","pause",e))):(n.totalPacketsReceived=r.packetsSent,this.freezedConsumingTransportIds.has(e)&&(this.freezedConsumingTransportIds.delete(e),this.callStatsInstance&&o&&(this.callStatsInstance.logger.debug("callStats::measurements::consumingTransportDefreezed",{transportId:e}),this.callStatsInstance.eventHandler.emit("consuming_transport_status","resume",e))))}registerConsumer(e){return me(this,null,function*(){yield this.generateConsumerStreamMap(e),this.consumerPeerIdMap.set(e.id,{producerId:e.producerId,peerId:e.appData.peerId,appData:e.appData}),e.on("close",this.deregisterConsumer.bind(this,e)),e.on("pause",this.pauseConsumer.bind(this,e.id)),e.on("resume",this.resumeConsumer.bind(this,e.id)),e.appData.screenShare===!0&&this.screenShareConsumers.add(e.id)})}pauseConsumer(e){this.pausedConsumerMap.set(e,{lastReportCalculated:!1})}resumeConsumer(e){this.pausedConsumerMap.delete(e)}generateProducerStreamMap(e,n=!1){return me(this,null,function*(){const r=yield e.getStats(),s=n?this.getProducerStatsFromReport(this.parseRTCReport(r,["outbound-rtp","remote-inbound-rtp"],!1,e.id))[0]:void 0;for(const i of r.values())switch(i.type){case"outbound-rtp":{this.outboundProducerMap.set(i.id,e.id);break}}return s})}generateConsumerStreamMap(e,n=!1){return me(this,null,function*(){const r=yield e.getStats(),s=n?this.getConsumerStatsFromReport(this.parseRTCReport(r,["inbound-rtp"],!1,e.id))[0]:void 0;for(const i of r.values())switch(i.type){case"inbound-rtp":{this.inboundConsumerMap.set(i.id,e.id);break}}return s})}deregisterProducer(e){this.outboundProducerMap.forEach((n,r)=>{n===e.id&&this.outboundProducerMap.delete(r)}),this.pausedProducerMap.delete(e.id),this.screenShareProducers.delete(e.id)}deregisterConsumer(e){this.inboundConsumerMap.forEach((n,r)=>{n===e.id&&this.inboundConsumerMap.delete(r)}),this.consumerPeerIdMap.delete(e.id),this.pausedConsumerMap.delete(e.id),this.screenShareConsumers.delete(e.id)}getIceCandidateStats(e){var n;return{id:e.id,type:e.candidateType||e.type,address:e.address,port:e.port,url:e.url,protocol:(n=e.relayProtocol)!=null?n:e.protocol,networkType:e.networkType,relatedAddress:e.relatedAddress,relatedPort:e.relatedPort}}getWorkingSimulcastVideoStats(e){return e.find(n=>{const r=n.framesEncoded>0,s=n.packetsSent>0,i=n.frameWidth&&n.frameHeight;return r&&s&&!!i})||e[e.length-1]}parseRTCReport(e,n=[],r=!1,s=void 0,i=void 0){var o,l,c,d,u,h,m,f,p,g,v,b,x;const w=e,k=new Mft,S=n.length?new Set(n):void 0,C=[],j=[],E=[],N=new Map,A=new Map;for(const _ of w.values()){if(S){if(S.size===0)break;if(S.has(_.type))r&&S.delete(_.type);else continue}switch(_.type){case"local-candidate":{C.push(this.getIceCandidateStats(_));break}case"remote-candidate":{j.push(this.getIceCandidateStats(_));break}case"candidate-pair":{const{nominated:T}=_,{selected:R}=_,O=_,F={nominated:T??R,currentRoundTripTime:O.currentRoundTripTime,totalRoundTripTime:O.totalRoundTripTime,bytesReceived:O.bytesReceived,bytesSent:O.bytesSent,availableOutgoingBitrate:O.availableOutgoingBitrate,availableIncomingBitrate:O.availableIncomingBitrate,lastPacketReceivedTimestamp:O.lastPacketReceivedTimestamp,lastPacketSentTimestamp:O.lastPacketSentTimestamp,localCandidateId:O.localCandidateId,remoteCandidateId:O.remoteCandidateId,bytesDiscardedOnSend:O.bytesDiscardedOnSend,packetsSent:O.packetsSent,packetsReceived:O.packetsReceived,packetsDiscardedOnSend:O.packetsDiscardedOnSend};E.push(F),(_.nominated===!0||_.selected===!0)&&(k.candidatePair=F);break}case"transport":{const T=_;i&&(i.producing&&(this.overallProducingTransportsStatsMap[i.id]||(this.overallProducingTransportsStatsMap[i.id]={totalPacketsSent:0})),i.consuming&&(this.overallConsumingTransportsStatsMap[i.id]||(this.overallConsumingTransportsStatsMap[i.id]={totalPacketsReceived:0})));const R={bytesReceived:T.bytesReceived,bytesSent:T.bytesSent,packetsSent:T.packetsSent,packetsReceived:T.packetsReceived,dtlsCipher:T.dtlsCipher,dtlsState:T.dtlsState,iceRole:T.iceRole};if(k.transport=R,i){if(i.producing){const O=this.overallProducingTransportsStatsMap[i.id];this.processProducingTransportStats(i.id,O,R)}if(i.consuming){const O=this.overallConsumingTransportsStatsMap[i.id];this.processConsumingTransportStats(i.id,O,R)}}break}case"remote-inbound-rtp":{const T=_,R={jitter:T.jitter,fractionLost:T.fractionLost,roundTripTime:T.roundTripTime,roundTripTimeMeasurements:T.roundTripTimeMeasurements,totalRoundTripTime:T.totalRoundTripTime,packetsLost:T.packetsLost};k.remoteInboundRtp.set(T.localId,R);break}case"outbound-rtp":{if(!this.outboundProducerMap.has(_.id))break;const T=_,R=s||this.outboundProducerMap.get(_.id),O=this.pausedProducerMap.get(R);if(O){if(O.lastReportCalculated===!0)break;this.pausedProducerMap.set(R,{lastReportCalculated:!0})}this.overallProducersStatsMap[R]||(this.overallProducersStatsMap[R]={totalVideoPacketsSent:0,totalAudioPacketsSent:0});const F=this.overallProducersStatsMap[R];if(["video","audio"].includes(T.mediaType)||["video","audio"].includes(T.kind)){if(!this.outboundProducerMap.has(_.id)){k.staleProducerStreamMap=!0;break}const D=this.callStatsInstance.producers.get(R);if(((o=D==null?void 0:D.track)==null?void 0:o.readyState)==="ended")break;k.producerStreamMap.has(R)||k.producerStreamMap.set(R,{outboundVideoRtpId:[],outboundAudioRtpId:[]});const I={bytesSent:T.bytesSent,packetsSent:T.packetsSent,nackCount:T.nackCount,ssrc:T.ssrc,mid:T.mid,active:T.active,codecId:T.codecId,headerBytesSent:T.headerBytesSent||0,totalPacketSendDelay:T.totalPacketSendDelay||0};if(T.mediaType==="video"||T.kind==="video"){const P=T,M=en({frameHeight:P.frameHeight,frameWidth:P.frameWidth,framesEncoded:P.framesEncoded,framesDropped:P.framesDropped,framesPerSecond:P.framesPerSecond,framesSent:P.framesSent,keyFramesEncoded:P.keyFramesEncoded,firCount:P.firCount,encoderImplementation:P.encoderImplementation,hugeFramesSent:P.hugeFramesSent,pliCount:P.pliCount,qpSum:P.qpSum,qualityLimitationDurations:P.qualityLimitationDurations,qualityLimitationReason:P.qualityLimitationReason,qualityLimitationResolutionChanges:P.qualityLimitationResolutionChanges,totalEncodeTime:P.targetBitrate,totalPacketSendDelay:P.totalPacketSendDelay,retransmittedBytesSent:P.retransmittedBytesSent,retransmittedPacketsSent:P.retransmittedPacketsSent,scalabilityMode:P.scalabilityMode,powerEfficientEncoder:P.powerEfficientEncoder},I);k.outboundVideoRtp.set(_.id,M),k.producerStreamMap.get(R).outboundVideoRtpId.push(_.id),this.processOutboundProducerVideoStats(R,F,M)}else if(T.mediaType==="audio"||T.kind==="audio"){const P=T,M=en({retransmittedBytesSent:P.retransmittedBytesSent,retransmittedPacketsSent:P.retransmittedPacketsSent},I);k.outboundAudioRtp.set(_.id,M),k.producerStreamMap.get(R).outboundAudioRtpId.push(_.id),this.processOutboundProducerAudioStats(R,F,M)}}else this.callStatsInstance.logger.error(`Callstats: Unknown Outbound-rtp. mediatype: ${T.mediaType} kind: ${T.kind}`);break}case"inbound-rtp":{if(!this.inboundConsumerMap.has(_.id))break;const T=_,R=s||this.inboundConsumerMap.get(_.id),O=this.pausedConsumerMap.get(R);if(O){if(O.lastReportCalculated===!0)break;this.pausedConsumerMap.set(R,{lastReportCalculated:!0})}if(T.ssrc===1234)break;this.overallConsumersStatsMap[R]||(this.overallConsumersStatsMap[R]={totalVideoPacketsReceived:0,totalAudioPacketsReceived:0});const F=this.overallConsumersStatsMap[R];if(["video","audio"].includes(T.mediaType)||["video","audio"].includes(T.kind)){if(!this.inboundConsumerMap.has(_.id)){k.staleConsumerStreamMap=!0;break}k.consumerStreamMap.has(R)||k.consumerStreamMap.set(R,{inboundVideoRtpId:[],inboundAudioRtpId:[]});const D={bytesReceived:T.bytesReceived,packetsReceived:T.packetsReceived,packetsLost:T.packetsLost>=0?T.packetsLost:0,jitter:T.jitter,nackCount:T.nackCount,jitterBufferDelay:T.jitterBufferDelay,jitterBufferEmittedCount:T.jitterBufferEmittedCount,lastPacketReceivedTimestamp:T.lastPacketReceivedTimestamp,ssrc:T.ssrc,mid:T.mid,codecId:T.codecId,headerBytesReceived:T.headerBytesReceived||0,packetsDiscarded:T.packetsDiscarded||0,jitterBufferMinimumDelay:T.jitterBufferMinimumDelay||0,jitterBufferTargetDelay:T.jitterBufferTargetDelay||0};if(T.mediaType==="video"||T.kind==="video"){const I=T,P=en({frameHeight:I.frameHeight,frameWidth:I.frameWidth,framesDecoded:I.framesDecoded,framesDropped:I.framesDropped,framesPerSecond:I.framesPerSecond,framesReceived:I.framesReceived,keyFramesDecoded:I.keyFramesDecoded,firCount:I.firCount,decoderImplementation:I.decoderImplementation,pliCount:I.pliCount,totalProcessingDelay:I.totalProcessingDelay,qpSum:I.qpSum||0,totalAssemblyTime:I.totalAssemblyTime||0,totalDecodeTime:I.totalDecodeTime||0,totalFreezesDuration:I.totalFreezesDuration||0,totalInterFrameDelay:I.totalInterFrameDelay||0,totalPausesDuration:I.totalPausesDuration||0,totalSquaredInterFrameDelay:I.totalSquaredInterFrameDelay||0,freezeCount:I.freezeCount||0,pauseCount:I.pauseCount||0,powerEfficientDecoder:I.powerEfficientDecoder},D);P.score=Pft({frameWidth:P.frameWidth||0,framesDecoded:(P.framesDecoded||0)-(((l=this.videoConsumerToStatsMap.get(R))==null?void 0:l.framesDecoded)||0),framesPerSecond:P.framesPerSecond||0,packetsLost:(P.packetsLost||0)-(((c=this.videoConsumerToStatsMap.get(R))==null?void 0:c.packetsLost)||0),packetsReceived:(P.packetsReceived||0)-(((d=this.videoConsumerToStatsMap.get(R))==null?void 0:d.packetsReceived)||0),jitter:P.jitter||0,isScreenShare:this.screenShareConsumers.has(R)}),A.set(R,{score:+(P.score*10).toFixed(),frameWidth:P.frameWidth||0,frameHeight:P.frameHeight||0,framesPerSecond:P.framesPerSecond||0,packetsLostPercentage:BY({packetsLost:(P.packetsLost||0)-(((u=this.videoConsumerToStatsMap.get(R))==null?void 0:u.packetsLost)||0),packetsReceived:(P.packetsReceived||0)-(((h=this.videoConsumerToStatsMap.get(R))==null?void 0:h.packetsReceived)||0)}),jitter:P.jitter||0,isScreenShare:this.screenShareConsumers.has(R),bitrate:((P.bytesReceived||0)-(((m=this.videoConsumerToStatsMap.get(R))==null?void 0:m.bytesReceived)||0))*8/7}),this.videoConsumerToStatsMap.set(R,P),k.inboundVideoRtp.set(_.id,P),k.consumerStreamMap.get(R).inboundVideoRtpId.push(_.id),this.processInboundConsumerVideoStats(R,F,P)}else if(T.mediaType==="audio"||T.kind==="audio"){const I=T,P=en({audioLevel:I.audioLevel,concealedSamples:I.concealedSamples,concealmentEvents:I.concealmentEvents,totalAudioEnergy:I.totalAudioEnergy,totalSamplesDuration:I.totalSamplesDuration,totalSamplesReceived:I.totalSamplesReceived,fecPacketsDiscarded:I.fecPacketsDiscarded||0,fecPacketsReceived:I.fecPacketsReceived||0,insertedSamplesForDeceleration:I.insertedSamplesForDeceleration||0,removedSamplesForAcceleration:I.removedSamplesForAcceleration||0,silentConcealedSamples:I.silentConcealedSamples||0,playoutId:I.playoutId},D);P.score=Aft({concealmentEvents:(P.concealmentEvents||0)-(((f=this.audioConsumerToStatsMap.get(R))==null?void 0:f.concealmentEvents)||0),packetsLost:(P.packetsLost||0)-(((p=this.audioConsumerToStatsMap.get(R))==null?void 0:p.packetsLost)||0),packetsReceived:(P.packetsReceived||0)-(((g=this.audioConsumerToStatsMap.get(R))==null?void 0:g.packetsReceived)||0),jitter:P.jitter||0}),A.set(R,{score:+(P.score*10).toFixed(),packetsLostPercentage:BY({packetsLost:(P.packetsLost||0)-(((v=this.audioConsumerToStatsMap.get(R))==null?void 0:v.packetsLost)||0),packetsReceived:(P.packetsReceived||0)-(((b=this.audioConsumerToStatsMap.get(R))==null?void 0:b.packetsReceived)||0)}),jitter:P.jitter||0,isScreenShare:this.screenShareConsumers.has(R),bitrate:((P.bytesReceived||0)-(((x=this.audioConsumerToStatsMap.get(R))==null?void 0:x.bytesReceived)||0))*8/7}),this.audioConsumerToStatsMap.set(R,P),k.inboundAudioRtp.set(_.id,P),k.consumerStreamMap.get(R).inboundAudioRtpId.push(_.id),this.processInboundConsumerAudioStats(R,F,P)}}else this.callStatsInstance.logger.error(`Callstats: Unknown Inbound-rtp. mediatype: ${T.mediaType} kind: ${T.kind}`);break}}}if(k.producerStreamMap.forEach((_,T)=>{var R,O,F,D,I,P,M,z,G,B,H,W,V,U,ne,te,re,fe,le,q,Y,X,Q;if(_.outboundVideoRtpId.length>0){const ie=[];_.outboundVideoRtpId.forEach(ye=>{ie.push(k.outboundVideoRtp.get(ye))});const he=this.getWorkingSimulcastVideoStats(ie);he.score=Tft({frameWidth:he.frameWidth||0,framesPerSecond:he.framesPerSecond||0,jitter:((R=he.remoteData)==null?void 0:R.jitter)||0,isScreenShare:this.screenShareProducers.has(T),packetsSent:(he.packetsSent||0)-(((O=this.videoProducerToStatsMap.get(T))==null?void 0:O.packetsSent)||0),packetsLost:(((F=he.remoteData)==null?void 0:F.packetsLost)||0)-(((I=(D=this.videoProducerToStatsMap.get(T))==null?void 0:D.remoteData)==null?void 0:I.packetsLost)||0),framesEncoded:(he.framesEncoded||0)-(((P=this.videoProducerToStatsMap.get(T))==null?void 0:P.framesEncoded)||0)}),N.set(T,{score:+(he.score*10).toFixed(),frameWidth:he.frameWidth||0,frameHeight:he.frameHeight||0,framesPerSecond:he.framesPerSecond||0,jitter:((M=he.remoteData)==null?void 0:M.jitter)||0,isScreenShare:this.screenShareProducers.has(T),packetsLostPercentage:FY({packetsSent:(he.packetsSent||0)-(((z=this.videoProducerToStatsMap.get(T))==null?void 0:z.packetsSent)||0),packetsLost:(((G=he.remoteData)==null?void 0:G.packetsLost)||0)-(((H=(B=this.videoProducerToStatsMap.get(T))==null?void 0:B.remoteData)==null?void 0:H.packetsLost)||0)}),bitrate:((he.bytesSent||0)-(((W=this.videoProducerToStatsMap.get(T))==null?void 0:W.bytesSent)||0))*8/7,cpuLimitations:he.qualityLimitationReason==="cpu",bandwidthLimitations:he.qualityLimitationReason==="bandwidth"}),this.videoProducerToStatsMap.set(T,he)}else if(_.outboundAudioRtpId.length>0){const ie=k.outboundAudioRtp.get(_.outboundAudioRtpId[0]);ie.score=Nft({packetsSent:(ie.packetsSent||0)-(((V=this.audioProducerToStatsMap.get(T))==null?void 0:V.packetsSent)||0),packetsLost:(((U=ie.remoteData)==null?void 0:U.packetsLost)||0)-(((te=(ne=this.audioProducerToStatsMap.get(T))==null?void 0:ne.remoteData)==null?void 0:te.packetsLost)||0),jitter:((re=ie.remoteData)==null?void 0:re.jitter)||0}),N.set(T,{score:+(ie.score*10).toFixed(),bitrate:((ie.bytesSent||0)-(((fe=this.audioProducerToStatsMap.get(T))==null?void 0:fe.bytesSent)||0))*8/7,packetsLostPercentage:FY({packetsSent:(ie.packetsSent||0)-(((le=this.audioProducerToStatsMap.get(T))==null?void 0:le.packetsSent)||0),packetsLost:(((q=ie.remoteData)==null?void 0:q.packetsLost)||0)-(((X=(Y=this.audioProducerToStatsMap.get(T))==null?void 0:Y.remoteData)==null?void 0:X.packetsLost)||0)}),jitter:((Q=ie.remoteData)==null?void 0:Q.jitter)||0,isScreenShare:this.screenShareProducers.has(T)}),this.audioProducerToStatsMap.set(T,ie)}}),E.forEach(_=>{const T=C.find(O=>O.id===_.localCandidateId?(_.localCandidateId=O.id,O):null),R=j.find(O=>O.id===_.remoteCandidateId?(_.remoteCandidateId=O.id,O):null);T&&(_.localCandidateType=T.type,_.localCandidateAddress=tk(T.address),_.localCandidatePort=T.port,_.localCandidateProtocol=T.protocol,_.localCandidateUrl=T.url,_.localCandidateNetworkType=T.networkType,_.localCandidateRelatedAddress=tk(T.relatedAddress),_.localCandidateRelatedPort=T.relatedPort),R&&(_.remoteCandidateType=R.type,_.remoteCandidateAddress=tk(R.address),_.remoteCandidatePort=R.port,_.remoteCandidateProtocol=R.protocol,_.remoteCandidateUrl=R.url)}),k.candidatePair&&(k.transport?(k.transport.totalRoundTripTime=k.candidatePair.totalRoundTripTime,k.transport.availableOutgoingBitrate=k.candidatePair.availableOutgoingBitrate,k.transport.availableIncomingBitrate=k.candidatePair.availableIncomingBitrate,k.transport.roundTripTime=k.candidatePair.currentRoundTripTime):k.transport={bytesReceived:k.candidatePair.bytesReceived,bytesSent:k.candidatePair.bytesSent,totalRoundTripTime:k.candidatePair.totalRoundTripTime,availableOutgoingBitrate:k.candidatePair.availableOutgoingBitrate,availableIncomingBitrate:k.candidatePair.availableIncomingBitrate,roundTripTime:k.candidatePair.currentRoundTripTime}),k.transport&&(k.transport.candidatePairs=E),k.transport&&!k.transport.roundTripTime){let _=0,T=0;k.remoteInboundRtp.forEach((R,O)=>{R.roundTripTime&&R.roundTripTime>_&&(_=R.roundTripTime,T=R.totalRoundTripTime)}),k.transport.roundTripTime=_,k.transport.totalRoundTripTime=T}if(A.size>0)try{this.observer.emit("consumer_score",A)}catch{}if(N.size>0)try{this.observer.emit("producer_score",N)}catch{}return k}getProducersReport(e){return me(this,null,function*(){const n=e.map(r=>this.generateProducerStreamMap(r,!0));return n.length>0?Promise.all(n):void 0})}getConsumersReport(e){return me(this,null,function*(){const n=e.map(r=>this.generateConsumerStreamMap(r,!0));return n.length>0?Promise.all(n):void 0})}getTransportReport(e){return me(this,null,function*(){return e.getStats()})}getProcessedStats(e,n,r){return me(this,null,function*(){const s=yield this.getTransportReport(e),i={producing:r,consuming:n,id:e.id},o=s,l=this.parseRTCReport(o,["transport","candidate-pair","inbound-rtp","outbound-rtp","remote-inbound-rtp","local-candidate","remote-candidate"],!1,void 0,i);if(!l)return;const c={stats:l.transport,transportId:e.id,consuming:n,producing:r},d=l.staleProducerStreamMap?void 0:this.getProducerStatsFromReport(l),u=l.staleConsumerStreamMap?void 0:this.getConsumerStatsFromReport(l);return{transportReport:c,producerReport:d,consumerReport:u}})}getProducerStatsFromReport(e){const n=[];try{e.producerStreamMap.forEach((r,s)=>{var i,o;n.push({producerId:s,videoStats:r.outboundVideoRtpId.map(l=>e.outboundVideoRtp.get(l)),audioStats:r.outboundAudioRtpId.map(l=>e.outboundAudioRtp.get(l)),appData:((o=(i=this.callStatsInstance.producers)==null?void 0:i.get(s))==null?void 0:o.appData)||null})})}catch(r){this.callStatsInstance.logger.error("callStats::measurements::getProducerStatsFromReport",{error:{reason:r.reason,message:r.message}})}return n}getConsumerStatsFromReport(e){const n=[];try{e.consumerStreamMap.forEach((r,s)=>{const{peerId:i,producerId:o,appData:l}=this.consumerPeerIdMap.get(s);n.push({consumerId:s,peerId:i,producerId:o,appData:l,videoStats:r.inboundVideoRtpId.map(c=>e.inboundVideoRtp.get(c)),audioStats:r.inboundAudioRtpId.map(c=>e.inboundAudioRtp.get(c))})})}catch(r){console.error("getConsumersReport: ",r,e)}return n}getUserLocation(){return me(this,null,function*(){return new Promise((e,n)=>{try{navigator.geolocation?navigator.geolocation.getCurrentPosition(r=>{e(r)}):n()}catch(r){n(r)}})})}getConnectivity(e){return me(this,null,function*(){try{const n={iceServers:e||XOe},r=new Promise((d,u)=>{try{const h=new Bpn(n);h.addListener("done",d),h.addListener("failed",()=>{d({connectivity:!1})}),h.start(2e3)}catch(h){u(h)}}),s=new Promise((d,u)=>{try{const h=new Upn(n);h.addListener("done",d),h.addListener("failed",()=>{d({connectivity:!1})}),h.start(2e3)}catch(h){u(h)}}),i=new Promise((d,u)=>{try{const h=new zpn(n);h.addListener("done",d),h.addListener("failed",()=>{d({connectivity:!1})}),h.start(2e3)}catch(h){u(h)}}),[o,l,c]=yield Promise.all([r,s,i]);return{host:o==null?void 0:o.connectivity,relay:l==null?void 0:l.connectivity,reflexive:c==null?void 0:c.connectivity}}catch{return{host:!1,relay:!1,reflexive:!1}}})}getThroughput(e){return me(this,null,function*(){try{const n=yield new Promise((r,s)=>{try{const i={iceServers:e||XOe},o=new Fpn(i);o.addListener("done",r),o.addListener("failed",s),o.start(1e4)}catch(i){s(i)}});return{throughput:n.throughput,fractionalLoss:0,RTT:n.RTT,jitter:0,backendRTT:n.backendRTT}}catch{return}})}getIPDetails(){return me(this,null,function*(){var e,n;try{return this.ipDetails||(this.ipDetails=yield Ift.getIPDetails({peerId:(e=this.callStatsInstance)==null?void 0:e.peerId,apiHostnames:(n=this.callStatsInstance)==null?void 0:n.apiHostnames,logger:this.callStatsInstance.logger})),this.ipDetails}catch{return}})}getNetworkQuality(e){return me(this,null,function*(){const[n,r]=yield Promise.all([this.getConnectivity(e),this.getThroughput(e)]);return{connectivity:n,throughput:r==null?void 0:r.throughput,fractionalLoss:r==null?void 0:r.fractionalLoss,RTT:r==null?void 0:r.RTT,jitter:r==null?void 0:r.jitter,backendRTT:r==null?void 0:r.backendRTT}})}getNetworkInfo(e,n=!1){return me(this,null,function*(){var r,s;if(n){const c=yield this.getIPDetails();return{ipDetails:c,effectiveNetworkType:(r=navigator.connection)==null?void 0:r.effectiveType,location:c!=null&&c.loc?e6e(c==null?void 0:c.loc):void 0}}const[i,o,l]=yield Promise.all([this.getConnectivity(e),this.getThroughput(e),this.getIPDetails()]);return{ipDetails:l,effectiveNetworkType:(s=navigator.connection)==null?void 0:s.effectiveType,location:l!=null&&l.loc?e6e(l==null?void 0:l.loc):void 0,turnConnectivity:i?i.host||i.relay||i.reflexive:!1,connectivity:i,throughput:o==null?void 0:o.throughput,fractionalLoss:o==null?void 0:o.fractionalLoss,RTT:o==null?void 0:o.RTT,jitter:o==null?void 0:o.jitter,backendRTT:o==null?void 0:o.backendRTT}})}}class Hpn extends Lft{}class Dft extends Lft{constructor(){super(...arguments),xe(this,"producerMap",new Map),xe(this,"consumerMap",new Map)}registerProducer(e){return me(this,null,function*(){this.producerMap.set(e.id,e),yield this.generateProducerStreamMap(e),e.on("close",this.deregisterProducer.bind(this,e)),e.on("pause",this.pauseProducer.bind(this,e.id)),e.on("resume",this.resumeProducer.bind(this,e.id)),e.appData.screenShare===!0&&this.screenShareProducers.add(e.id)})}registerConsumer(e){return me(this,null,function*(){this.consumerMap.set(e.id,e),yield this.generateConsumerStreamMap(e),this.consumerPeerIdMap.set(e.id,{producerId:e.producerId,peerId:e.appData.peerId,appData:e.appData}),e.on("close",this.deregisterConsumer.bind(this,e)),e.on("pause",this.pauseConsumer.bind(this,e.id)),e.on("resume",this.resumeConsumer.bind(this,e.id)),e.appData.screenShare===!0&&this.screenShareConsumers.add(e.id)})}generateConsumerStreamMap(e,n=!1){return me(this,null,function*(){const r=yield e.getStats(),s=this.parseRTCReport(r,["inbound-rtp"],!1,e.id),i=[...s.consumerStreamMap.values()][0],o=n?this.getConsumerStatsFromParsedConsumerStats(s,i,e.id):void 0;for(const l of r.values())switch(l.type){case"inbound-rtp":{this.inboundConsumerMap.set(l.id,e.id);break}}return o})}deregisterProducer(e){this.producerMap.delete(e.id),this.outboundProducerMap.forEach((n,r)=>{n===e.id&&this.outboundProducerMap.delete(r)}),this.pausedProducerMap.delete(e.id),this.screenShareProducers.delete(e.id)}deregisterConsumer(e){this.consumerMap.delete(e.id),this.inboundConsumerMap.forEach((n,r)=>{n===e.id&&this.inboundConsumerMap.delete(r)}),this.consumerPeerIdMap.delete(e.id),this.pausedConsumerMap.delete(e.id),this.screenShareConsumers.delete(e.id)}getIceCandidateStats(e){var n;return{id:e.id,type:e.candidateType||e.type,address:e.address,port:e.port,url:e.url,protocol:(n=e.relayProtocol)!=null?n:e.protocol,networkType:e.networkType,relatedAddress:e.relatedAddress,relatedPort:e.relatedPort}}parseRTCReport(e,n=[],r=!1,s=void 0,i=void 0){var o,l,c,d,u,h,m,f,p,g,v,b,x;const w=e,k=new Mft,S=n.length?new Set(n):void 0,C=[],j=[],E=[],N=new Map,A=new Map;for(const _ of w.values()){if(S){if(S.size===0)break;if(S.has(_.type))r&&S.delete(_.type);else continue}switch(_.type){case"local-candidate":{C.push(this.getIceCandidateStats(_));break}case"remote-candidate":{j.push(this.getIceCandidateStats(_));break}case"candidate-pair":{const{nominated:T}=_,{selected:R}=_,O=_,F={nominated:T??R,currentRoundTripTime:O.currentRoundTripTime,totalRoundTripTime:O.totalRoundTripTime,bytesReceived:O.bytesReceived,bytesSent:O.bytesSent,availableOutgoingBitrate:O.availableOutgoingBitrate,availableIncomingBitrate:O.availableIncomingBitrate,lastPacketReceivedTimestamp:O.lastPacketReceivedTimestamp,lastPacketSentTimestamp:O.lastPacketSentTimestamp,localCandidateId:O.localCandidateId,remoteCandidateId:O.remoteCandidateId,bytesDiscardedOnSend:O.bytesDiscardedOnSend,packetsSent:O.packetsSent,packetsReceived:O.packetsReceived,packetsDiscardedOnSend:O.packetsDiscardedOnSend};E.push(F),(_.nominated===!0||_.selected===!0)&&(k.candidatePair=F);break}case"transport":{const T=_;i&&(i.producing&&(this.overallProducingTransportsStatsMap[i.id]||(this.overallProducingTransportsStatsMap[i.id]={totalPacketsSent:0})),i.consuming&&(this.overallConsumingTransportsStatsMap[i.id]||(this.overallConsumingTransportsStatsMap[i.id]={totalPacketsReceived:0})));const R={bytesReceived:T.bytesReceived,bytesSent:T.bytesSent,packetsSent:T.packetsSent,packetsReceived:T.packetsReceived,dtlsCipher:T.dtlsCipher,dtlsState:T.dtlsState,iceRole:T.iceRole};if(k.transport=R,i){if(i.producing){const O=this.overallProducingTransportsStatsMap[i.id];this.processProducingTransportStats(i.id,O,R)}if(i.consuming){const O=this.overallConsumingTransportsStatsMap[i.id];this.processConsumingTransportStats(i.id,O,R)}}break}case"remote-inbound-rtp":{const T=_,R={jitter:T.jitter,fractionLost:T.fractionLost,roundTripTime:T.roundTripTime,roundTripTimeMeasurements:T.roundTripTimeMeasurements,totalRoundTripTime:T.totalRoundTripTime,packetsLost:T.packetsLost};k.remoteInboundRtp.set(T.localId,R);break}case"outbound-rtp":{if(!this.outboundProducerMap.has(_.id))break;const T=_,R=s||this.outboundProducerMap.get(_.id),O=this.pausedProducerMap.get(R);if(O){if(O.lastReportCalculated===!0)break;this.pausedProducerMap.set(R,{lastReportCalculated:!0})}this.overallProducersStatsMap[R]||(this.overallProducersStatsMap[R]={totalVideoPacketsSent:0,totalAudioPacketsSent:0});const F=this.overallProducersStatsMap[R];if(["video","audio"].includes(T.mediaType)||["video","audio"].includes(T.kind)){if(!this.outboundProducerMap.has(_.id)){k.staleProducerStreamMap=!0;break}const D=this.callStatsInstance.producers.get(R);if(((o=D==null?void 0:D.track)==null?void 0:o.readyState)==="ended")break;k.producerStreamMap.has(R)||k.producerStreamMap.set(R,{outboundVideoRtpId:[],outboundAudioRtpId:[]});const I={bytesSent:T.bytesSent,packetsSent:T.packetsSent,nackCount:T.nackCount,ssrc:T.ssrc,mid:T.mid,active:T.active,codecId:T.codecId,headerBytesSent:T.headerBytesSent||0,totalPacketSendDelay:T.totalPacketSendDelay||0};if(T.mediaType==="video"||T.kind==="video"){const P=T,M=en({frameHeight:P.frameHeight,frameWidth:P.frameWidth,framesEncoded:P.framesEncoded,framesDropped:P.framesDropped?P.framesDropped:P.droppedFrames,framesPerSecond:P.framesPerSecond?P.framesPerSecond:P.framerateMean,framesSent:P.framesSent,keyFramesEncoded:P.keyFramesEncoded,firCount:P.firCount,encoderImplementation:P.encoderImplementation,hugeFramesSent:P.hugeFramesSent,pliCount:P.pliCount,qpSum:P.qpSum,qualityLimitationReason:P.qualityLimitationReason,qualityLimitationDurations:P.qualityLimitationDurations,qualityLimitationResolutionChanges:P.qualityLimitationResolutionChanges,totalEncodeTime:P.totalEncodeTime,totalPacketSendDelay:P.totalEncodeTime,retransmittedBytesSent:P.retransmittedBytesSent,retransmittedPacketsSent:P.retransmittedPacketsSent,scalabilityMode:P.scalabilityMode,powerEfficientEncoder:P.powerEfficientEncoder},I);k.outboundVideoRtp.set(_.id,M),k.producerStreamMap.get(R).outboundVideoRtpId.push(_.id),this.processOutboundProducerVideoStats(R,F,M)}else if(T.mediaType==="audio"||T.kind==="audio"){const P=T,M=en({retransmittedBytesSent:P.retransmittedBytesSent,retransmittedPacketsSent:P.retransmittedPacketsSent},I);k.outboundAudioRtp.set(_.id,M),k.producerStreamMap.get(R).outboundAudioRtpId.push(_.id),this.processOutboundProducerAudioStats(R,F,M)}}else this.callStatsInstance.logger.error(`Callstats: Unknown Outbound-rtp. mediatype: ${T.mediaType} kind: ${T.kind}`);break}case"inbound-rtp":{if(!this.inboundConsumerMap.has(_.id))break;const T=_,R=s||this.inboundConsumerMap.get(_.id),O=this.pausedConsumerMap.get(R);if(O){if(O.lastReportCalculated===!0)break;this.pausedConsumerMap.set(R,{lastReportCalculated:!0})}if(T.ssrc===1234)break;this.overallConsumersStatsMap[R]||(this.overallConsumersStatsMap[R]={totalVideoPacketsReceived:0,totalAudioPacketsReceived:0});const F=this.overallConsumersStatsMap[R];if(["video","audio"].includes(T.mediaType)||["video","audio"].includes(T.kind)){if(!this.inboundConsumerMap.has(_.id)){k.staleConsumerStreamMap=!0;break}k.consumerStreamMap.has(R)||k.consumerStreamMap.set(R,{inboundVideoRtpId:[],inboundAudioRtpId:[]});const D={bytesReceived:T.bytesReceived,packetsReceived:T.packetsReceived,packetsLost:T.packetsLost>=0?T.packetsLost:0,jitter:T.jitter,nackCount:T.nackCount,jitterBufferDelay:T.jitterBufferDelay,jitterBufferEmittedCount:T.jitterBufferEmittedCount,lastPacketReceivedTimestamp:T.lastPacketReceivedTimestamp,ssrc:T.ssrc,mid:T.mid,codecId:T.codecId,headerBytesReceived:T.headerBytesReceived||0,packetsDiscarded:T.packetsDiscarded||0,jitterBufferMinimumDelay:T.jitterBufferMinimumDelay||0,jitterBufferTargetDelay:T.jitterBufferTargetDelay||0};if(T.mediaType==="video"||T.kind==="video"){const I=T,P=en({frameHeight:I.frameHeight,frameWidth:I.frameWidth,framesDecoded:I.framesDecoded,framesDropped:I.framesDropped?I.framesDropped:I.droppedFrames,framesPerSecond:I.framesPerSecond?I.framesPerSecond:I.framerateMean,framesReceived:I.framesReceived,keyFramesDecoded:I.keyFramesDecoded,firCount:I.firCount,decoderImplementation:I.decoderImplementation,pliCount:I.pliCount,totalProcessingDelay:I.totalProcessingDelay,qpSum:I.qpSum||0,totalAssemblyTime:I.totalAssemblyTime||0,totalDecodeTime:I.totalDecodeTime||0,totalFreezesDuration:I.totalFreezesDuration||0,totalInterFrameDelay:I.totalInterFrameDelay||0,totalPausesDuration:I.totalPausesDuration||0,totalSquaredInterFrameDelay:I.totalSquaredInterFrameDelay||0,freezeCount:I.freezeCount||0,pauseCount:I.pauseCount||0,powerEfficientDecoder:I.powerEfficientDecoder},D);P.score=Pft({frameWidth:P.frameWidth||0,framesDecoded:(P.framesDecoded||0)-(((l=this.videoConsumerToStatsMap.get(R))==null?void 0:l.framesDecoded)||0),framesPerSecond:P.framesPerSecond||0,packetsLost:(P.packetsLost||0)-(((c=this.videoConsumerToStatsMap.get(R))==null?void 0:c.packetsLost)||0),packetsReceived:(P.packetsReceived||0)-(((d=this.videoConsumerToStatsMap.get(R))==null?void 0:d.packetsReceived)||0),jitter:P.jitter||0,isScreenShare:this.screenShareConsumers.has(R)}),A.set(R,{score:+(P.score*10).toFixed(),frameWidth:P.frameWidth||0,frameHeight:P.frameHeight||0,framesPerSecond:P.framesPerSecond||0,packetsLostPercentage:BY({packetsLost:(P.packetsLost||0)-(((u=this.videoConsumerToStatsMap.get(R))==null?void 0:u.packetsLost)||0),packetsReceived:(P.packetsReceived||0)-(((h=this.videoConsumerToStatsMap.get(R))==null?void 0:h.packetsReceived)||0)}),jitter:P.jitter||0,isScreenShare:this.screenShareConsumers.has(R),bitrate:((P.bytesReceived||0)-(((m=this.videoConsumerToStatsMap.get(R))==null?void 0:m.bytesReceived)||0))*8/7}),this.videoConsumerToStatsMap.set(R,P),k.inboundVideoRtp.set(_.id,P),k.consumerStreamMap.get(R).inboundVideoRtpId.push(_.id),this.processInboundConsumerVideoStats(R,F,P)}else if(T.mediaType==="audio"||T.kind==="audio"){const I=T,P=en({audioLevel:I.audioLevel,concealedSamples:I.concealedSamples,concealmentEvents:I.concealmentEvents,totalAudioEnergy:I.totalAudioEnergy,totalSamplesDuration:I.totalSamplesDuration,totalSamplesReceived:I.totalSamplesReceived,fecPacketsDiscarded:I.fecPacketsDiscarded||0,fecPacketsReceived:I.fecPacketsReceived||0,insertedSamplesForDeceleration:I.insertedSamplesForDeceleration||0,removedSamplesForAcceleration:I.removedSamplesForAcceleration||0,silentConcealedSamples:I.silentConcealedSamples||0,playoutId:I.playoutId},D);P.score=Aft({concealmentEvents:(P.concealmentEvents||0)-(((f=this.audioConsumerToStatsMap.get(R))==null?void 0:f.concealmentEvents)||0),packetsLost:(P.packetsLost||0)-(((p=this.audioConsumerToStatsMap.get(R))==null?void 0:p.packetsLost)||0),packetsReceived:(P.packetsReceived||0)-(((g=this.audioConsumerToStatsMap.get(R))==null?void 0:g.packetsReceived)||0),jitter:P.jitter||0}),A.set(R,{score:+(P.score*10).toFixed(),packetsLostPercentage:BY({packetsLost:(P.packetsLost||0)-(((v=this.audioConsumerToStatsMap.get(R))==null?void 0:v.packetsLost)||0),packetsReceived:(P.packetsReceived||0)-(((b=this.audioConsumerToStatsMap.get(R))==null?void 0:b.packetsReceived)||0)}),jitter:P.jitter||0,isScreenShare:this.screenShareConsumers.has(R),bitrate:((P.bytesReceived||0)-(((x=this.audioConsumerToStatsMap.get(R))==null?void 0:x.bytesReceived)||0))*8/7}),this.audioConsumerToStatsMap.set(R,P),k.inboundAudioRtp.set(_.id,P),k.consumerStreamMap.get(R).inboundAudioRtpId.push(_.id),this.processInboundConsumerAudioStats(R,F,P)}}else this.callStatsInstance.logger.error(`Callstats: Unknown Inbound-rtp. mediatype: ${T.mediaType} kind: ${T.kind}`);break}}}if(k.producerStreamMap.forEach((_,T)=>{var R,O,F,D,I,P,M,z,G,B,H,W,V,U,ne,te,re,fe,le,q,Y,X,Q;if(_.outboundVideoRtpId.length>0){const ie=[];_.outboundVideoRtpId.forEach(ye=>{ie.push(k.outboundVideoRtp.get(ye))});const he=this.getWorkingSimulcastVideoStats(ie);he.score=Tft({frameWidth:he.frameWidth||0,framesPerSecond:he.framesPerSecond||0,jitter:((R=he.remoteData)==null?void 0:R.jitter)||0,isScreenShare:this.screenShareProducers.has(T),packetsSent:(he.packetsSent||0)-(((O=this.videoProducerToStatsMap.get(T))==null?void 0:O.packetsSent)||0),packetsLost:(((F=he.remoteData)==null?void 0:F.packetsLost)||0)-(((I=(D=this.videoProducerToStatsMap.get(T))==null?void 0:D.remoteData)==null?void 0:I.packetsLost)||0),framesEncoded:(he.framesEncoded||0)-(((P=this.videoProducerToStatsMap.get(T))==null?void 0:P.framesEncoded)||0)}),N.set(T,{score:+(he.score*10).toFixed(),frameWidth:he.frameWidth||0,frameHeight:he.frameHeight||0,framesPerSecond:he.framesPerSecond||0,jitter:((M=he.remoteData)==null?void 0:M.jitter)||0,isScreenShare:this.screenShareProducers.has(T),packetsLostPercentage:FY({packetsSent:(he.packetsSent||0)-(((z=this.videoProducerToStatsMap.get(T))==null?void 0:z.packetsSent)||0),packetsLost:(((G=he.remoteData)==null?void 0:G.packetsLost)||0)-(((H=(B=this.videoProducerToStatsMap.get(T))==null?void 0:B.remoteData)==null?void 0:H.packetsLost)||0)}),bitrate:((he.bytesSent||0)-(((W=this.videoProducerToStatsMap.get(T))==null?void 0:W.bytesSent)||0))*8/7,cpuLimitations:he.qualityLimitationReason==="cpu",bandwidthLimitations:he.qualityLimitationReason==="bandwidth"}),this.videoProducerToStatsMap.set(T,he)}else if(_.outboundAudioRtpId.length>0){const ie=k.outboundAudioRtp.get(_.outboundAudioRtpId[0]);ie.score=Nft({packetsSent:(ie.packetsSent||0)-(((V=this.audioProducerToStatsMap.get(T))==null?void 0:V.packetsSent)||0),packetsLost:(((U=ie.remoteData)==null?void 0:U.packetsLost)||0)-(((te=(ne=this.audioProducerToStatsMap.get(T))==null?void 0:ne.remoteData)==null?void 0:te.packetsLost)||0),jitter:((re=ie.remoteData)==null?void 0:re.jitter)||0}),N.set(T,{score:+(ie.score*10).toFixed(),bitrate:((ie.bytesSent||0)-(((fe=this.audioProducerToStatsMap.get(T))==null?void 0:fe.bytesSent)||0))*8/7,packetsLostPercentage:FY({packetsSent:(ie.packetsSent||0)-(((le=this.audioProducerToStatsMap.get(T))==null?void 0:le.packetsSent)||0),packetsLost:(((q=ie.remoteData)==null?void 0:q.packetsLost)||0)-(((X=(Y=this.audioProducerToStatsMap.get(T))==null?void 0:Y.remoteData)==null?void 0:X.packetsLost)||0)}),jitter:((Q=ie.remoteData)==null?void 0:Q.jitter)||0,isScreenShare:this.screenShareProducers.has(T)}),this.audioProducerToStatsMap.set(T,ie)}}),E.forEach(_=>{const T=C.find(O=>O.id===_.localCandidateId?(_.localCandidateId=O.id,O):null),R=j.find(O=>O.id===_.remoteCandidateId?(_.remoteCandidateId=O.id,O):null);T&&(_.localCandidateType=T.type,_.localCandidateAddress=tk(T.address),_.localCandidatePort=T.port,_.localCandidateProtocol=T.protocol,_.localCandidateUrl=T.url,_.localCandidateNetworkType=T.networkType,_.localCandidateRelatedAddress=tk(T.relatedAddress),_.localCandidateRelatedPort=T.relatedPort),R&&(_.remoteCandidateType=R.type,_.remoteCandidateAddress=tk(R.address),_.remoteCandidatePort=R.port,_.remoteCandidateProtocol=R.protocol,_.remoteCandidateUrl=R.url)}),k.candidatePair&&(k.transport?(k.transport.bytesReceived=k.candidatePair.bytesReceived,k.transport.bytesSent=k.candidatePair.bytesSent,k.transport.totalRoundTripTime=k.candidatePair.totalRoundTripTime,k.transport.availableOutgoingBitrate=k.candidatePair.availableOutgoingBitrate,k.transport.availableIncomingBitrate=k.candidatePair.availableIncomingBitrate,k.transport.roundTripTime=k.candidatePair.currentRoundTripTime):k.transport={bytesReceived:k.candidatePair.bytesReceived,bytesSent:k.candidatePair.bytesSent,totalRoundTripTime:k.candidatePair.totalRoundTripTime,availableOutgoingBitrate:k.candidatePair.availableOutgoingBitrate,availableIncomingBitrate:k.candidatePair.availableIncomingBitrate,roundTripTime:k.candidatePair.currentRoundTripTime}),k.transport&&(k.transport.candidatePairs=E),k.transport&&!k.transport.roundTripTime){let _=0,T=0;k.remoteInboundRtp.forEach((R,O)=>{R.roundTripTime&&R.roundTripTime>_&&(_=R.roundTripTime,T=R.totalRoundTripTime)}),k.transport.roundTripTime=_,k.transport.totalRoundTripTime=T}if(A.size>0)try{this.observer.emit("consumer_score",A)}catch{}if(N.size>0)try{this.observer.emit("producer_score",N)}catch{}return k}getProducerStatsFromReport(e){const n=[];try{e.producerStreamMap.forEach((r,s)=>{const i=this.producerMap.get(s),o=i.track.getSettings(),l=r.outboundVideoRtpId.map(d=>{const u=e.outboundVideoRtp.get(d);return u.frameHeight||(u.frameHeight=o.height,u.frameWidth=o.width,u.framesPerSecond=o.frameRate),u}),c={producerId:s,appData:i.appData,videoStats:l,audioStats:r.outboundAudioRtpId.map(d=>e.outboundAudioRtp.get(d))};n.push(c)})}catch(r){console.error("getProducersReport: ",r,e)}return n}getConsumerStatsFromParsedConsumerStats(e,n,r){let s;try{const{peerId:i,producerId:o,appData:l}=this.consumerPeerIdMap.get(r),c=n==null?void 0:n.inboundVideoRtpId.map(d=>{const u=this.consumerMap.get(r).track.getSettings(),h=e.inboundVideoRtp.get(d);return h.frameHeight||(h.frameHeight=u.height,h.frameWidth=u.width,h.framesPerSecond=u.frameRate),h});s={consumerId:r,peerId:i,producerId:o,appData:l,videoStats:c,audioStats:n==null?void 0:n.inboundAudioRtpId.map(d=>e.inboundAudioRtp.get(d))}}catch(i){console.error("getConsumerStatsFromParsedConsumerStats: ",i,e)}return s}getConsumerStatsFromReport(e){const n=[];try{e.consumerStreamMap.forEach((r,s)=>{n.push(this.getConsumerStatsFromParsedConsumerStats(e,r,s))})}catch(r){console.error("getConsumerStatsFromReport: ",r,e)}return n}}class Gpn extends Dft{}function UY(t,e,n,r){if(t!=null&&t.logger&&t.logger.error("Callstats::handleError",{error:r}),typeof n=="function"&&r instanceof e)n.call(null,r,t);else throw r}function t6e(t,e,n){const r=t.value;return t.value=function(...s){try{const i=r.apply(this,s);return i&&i instanceof Promise?i.catch(o=>{UY(this,e,n,o)}):i}catch(i){UY(this,e,n,i)}return null},t}const ns=(t,e)=>(n,r,s)=>{const i=s.value;return s.value=function(...o){try{const l=i.apply(this,o);return l&&l instanceof Promise?l.catch(c=>{UY(this,t,e,c)}):l}catch(l){UY(this,t,e,l)}return null},s},Wpn=(t,e)=>(n,r,s)=>{if(s)return t6e(s,t,e);for(const i of Reflect.ownKeys(n.prototype).filter(o=>o!=="constructor")){const o=Object.getOwnPropertyDescriptor(n.prototype,i);o.value instanceof Function&&Object.defineProperty(n.prototype,i,t6e(o,t,e))}};var Qr=globalThis&&globalThis.__decorate||function(t,e,n,r){var s=arguments.length,i=s<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,n):r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const Zr=console;let Mr=class extends Zd{constructor(e="https://api.testingv3.dyte.in",n="Blink",r=xft.PROD,s,i,o,l,c){if(super(),xe(this,"observer"),xe(this,"eventHandler"),xe(this,"measurements"),xe(this,"producingTransport"),xe(this,"consumingTransport"),xe(this,"producers",new Map),xe(this,"consumers",new Map),xe(this,"iceServers"),xe(this,"connectionInfoPromise"),xe(this,"pingStatsTimeout"),xe(this,"logger"),xe(this,"env"),xe(this,"apiHostnames"),xe(this,"peerId"),xe(this,"consumerSharedMediaStatesMap",new Map),xe(this,"currentUserMediaStates",{}),!c)throw Error("authToken is missing but required to initialize CallStats!");switch(this.env=r,this.apiHostnames=l,this.logger=i,this.peerId=o,this.eventHandler=new Apn({logger:i,peerId:o,apiHostnames:l,authToken:c}),this.logger.debug("callStats::engineName: ",{engineName:n}),n){case"Blink":this.measurements=new Hpn;break;case"Gecko":this.measurements=new Dft;break;case"WebKit":this.measurements=new Gpn;break;default:throw Error(`Unknown engineName! ${n}`)}this.measurements.callStatsInstance=this,this.registerProducer=this.registerProducer.bind(this),this.registerConsumer=this.registerConsumer.bind(this),this.observer=new Zd,this.measurements.observer.on("consumer_score",d=>{i.debug(`callStats::consumer_score ${[...d.entries()]}`),this.eventHandler.emit("consumer_score",d)}),this.measurements.observer.on("producer_score",d=>{i.debug(`callStats::producer_score ${[...d.entries()]}`),this.eventHandler.emit("producer_score",d)})}registerIceServers(e){this.iceServers=e}registerConsumer(e){var n;this.consumerSharedMediaStatesMap.has(e.id)||this.consumerSharedMediaStatesMap.set(e.id,{}),this.consumers.set(e.id,e),this.measurements.registerConsumer(e),this.logger.debug("callStats::registerConsumer",{consumerId:e.id,consumerkind:e.kind,isScreenShare:!!((n=e.appData)!=null&&n.screenShare)}),e.on("close",this.deRegisterConsumer.bind(this,e))}registerProducer(e){var n;this.producers.set(e.id,e),this.measurements.registerProducer(e),this.logger.debug("callStats::registerProducer",{producerId:e.id,producerKind:e.kind,isScreenShare:!!((n=e.appData)!=null&&n.screenShare)}),e.on("close",this.deRegisterProducer.bind(this,e))}sendConsumerSharedMediaStateEvent(e,n){this.consumerSharedMediaStatesMap.has(e)||this.consumerSharedMediaStatesMap.set(e,{});const r=this.consumerSharedMediaStatesMap.get(e);this.consumerSharedMediaStatesMap.set(e,Object.assign(r,n))}registerProducingTransport(e){var n;this.producingTransport=e,e.on("close",this.disconnectProducingTransport.bind(this,e)),e.on("disconnect",this.disconnectProducingTransport.bind(this,e)),Array.from(((n=e._producers)==null?void 0:n.values())||[]).forEach(r=>{this.registerProducer(r)}),e.on("newproducer",this.registerProducer)}registerConsumingTransport(e){var n;this.consumingTransport=e,e.on("close",this.disconnectConsumingTransport.bind(this,e)),e.on("disconnect",this.disconnectConsumingTransport.bind(this,e)),Array.from(((n=e._consumers)==null?void 0:n.values())||[]).forEach(r=>{this.registerConsumer(r)}),e.on("newconsumer",this.registerConsumer)}deRegisterConsumer(e){this.consumers.delete(e.id)}deRegisterProducer(e){var n;this.producers.delete(e.id),this.logger.debug("callStats::deRegisterProducer",{producerId:e.id,producerKind:e.kind,isScreenShare:!!((n=e.appData)!=null&&n.screenShare)})}disconnectConsumingTransport(){this.consumingTransport=void 0}disconnectProducingTransport(){this.producingTransport=void 0}callEvent(e){this.eventHandler.callEvent(e)}sendPreCallTestBeginEvent(e=!1,n){this.connectionInfoPromise=this.measurements.getNetworkInfo(this.iceServers,e),this.eventHandler.callEvent({event:Zt.PRECALL_TEST_BEGIN,timestamp:n}),this.connectionInfoPromise&&this.connectionInfoPromise.then(r=>{this.eventHandler.callEvent({event:Zt.PRECALL_TEST_COMPLETE,metaData:{connectionInfo:r},timestamp:n})})}sendScreenShareToggleEvent(e,n=null,r){this.currentUserMediaStates.screen=e,this.eventHandler.callEvent({event:e?Zt.SCREENSHARE_STARTED:Zt.SCREENSHARE_STOPPED,metaData:{ssrc:n},timestamp:r})}sendScreenShareRequestedEvent(e){this.eventHandler.callEvent({event:Zt.SCREENSHARE_START_REQUESTED,timestamp:e})}sendActiveSpeakerEvent(e,n){this.eventHandler.callEvent({event:Zt.DOMINANT_SPEAKER,metaData:{peerId:e},timestamp:n})}devices(e,n,r){this.eventHandler.callEvent({event:e===ef.AUDIO&&Zt.AUDIO_DEVICES_UPDATES||e===ef.VIDEO&&Zt.VIDEO_DEVICES_UPDATES||e===ef.SPEAKER&&Zt.SPEAKER_DEVICES_UPDATES,metaData:{deviceList:n},timestamp:r})}selectedDevice(e,n,r){this.eventHandler.callEvent({event:e===ef.AUDIO&&Zt.SELECTED_MICROHPONE_UPDATE||e===ef.VIDEO&&Zt.SELECTED_CAMERA_UPDATE||e===ef.SPEAKER&&Zt.SELECTED_SPEAKER_UPDATE,metaData:{device:n},timestamp:r})}mediaPermission(e,n,r){this.eventHandler.callEvent({event:Zt.MEDIA_PERMISSION,metaData:{deviceType:e,permission:n},timestamp:r})}mediaPlaybackFailed(e,n){this.eventHandler.callEvent({event:e===ef.AUDIO&&Zt.AUDIO_PLAY_FAILED||e===ef.VIDEO&&Zt.VIDEO_PLAY_FAILED,metaData:{deviceType:e},timestamp:n})}mediaTrackMuted(e,n){this.eventHandler.callEvent({event:e===ef.AUDIO&&Zt.AUDIO_TRACK_MUTED||e===ef.VIDEO&&Zt.VIDEO_TRACK_MUTED,metaData:{deviceType:e},timestamp:n})}tabChanged(e,n){this.eventHandler.callEvent({event:Zt.TAB_CHANGE,metaData:{isMeetingsTabActive:e},timestamp:n})}browserBackgrounded(e){this.eventHandler.callEvent({event:Zt.BROWSER_BACKGROUNDED,timestamp:e})}browserForegrounded(e){this.eventHandler.callEvent({event:Zt.BROWSER_FOREGROUNDED,timestamp:e})}legacySwitch(e,n){this.eventHandler.callEvent({event:Zt.LEGACY_SWITCH,metadata:{on:e},timestamp:n})}getPreCallTestResults(){return me(this,null,function*(){return this.connectionInfoPromise})}sendCallJoinBeginEvent(e,n){e=Dr(en({},e),{meetingEnv:this.env}),e.deviceInfo=Dr(en({},e.deviceInfo),{userAgent:navigator.userAgent,cpus:navigator.hardwareConcurrency,memory:navigator.deviceMemory}),this.eventHandler.callEvent({event:Zt.CALL_JOIN_BEGIN,metaData:{peerMetaData:e},timestamp:n})}sendNetworkQualityTestBeginEvent(e,n){this.eventHandler.callEvent({event:Zt.NET_QUALITY_TEST_BEGIN,timestamp:n}),new Promise((r,s)=>me(this,null,function*(){const i=[];try{for(const o of e)try{if(o.iceServers&&o.iceServers.length>0){const l=yield this.measurements.getNetworkQuality(o.iceServers);i.push(Dr(en({},o),{networkResults:l}))}}catch(l){console.warn("Error handling ",l)}r({regionData:i})}catch(o){console.warn("Error in callstats, ",o),s(o)}})).then(r=>{this.eventHandler.callEvent({event:Zt.NET_QUALITY_TEST_END,timestamp:n,metaData:r})})}sendWebSocketConnectedEvent(e){this.eventHandler.callEvent({event:Zt.WEBSOCKET_CONNECTED,timestamp:e})}sendTransportConnectedEvent(e){this.eventHandler.callEvent({event:Zt.TRANSPORT_CONNECTED,timestamp:e})}sendAudioToggleEvent(e,n){this.currentUserMediaStates.audio=e;let r;e?r=Zt.AUDIO_ON:r=Zt.AUDIO_OFF,this.eventHandler.callEvent({event:r,timestamp:n})}sendVideoToggleEvent(e,n){this.currentUserMediaStates.video=e;let r;e?r=Zt.VIDEO_ON:r=Zt.VIDEO_OFF,this.eventHandler.callEvent({event:r,timestamp:n})}sendParticipantRoleToggleEvent(e,n){this.eventHandler.callEvent({event:Zt.PARTICIPANT_ROLE,timestamp:n,metaData:e})}startPingStats(e=7e3){this.sendPingStatsEvent(!1,new Date),this.pingStatsTimeout=setInterval(this.sendPingStatsEvent.bind(this),e)}stopPingStats(){clearInterval(this.pingStatsTimeout)}sendPingStatsEvent(e=!0,n){return me(this,null,function*(){var r,s;let i,o;if(this.producingTransport&&(i=yield this.measurements.getProcessedStats(this.producingTransport,!1,!0),!i||!((r=i==null?void 0:i.producerReport)!=null&&r.length))){this.logger.debug("callStats::sendPingStatsEvent::staleProducingTransport",{disclaimer:"Stale producer? Regenerating Stream Maps!"});const c=yield this.measurements.getProducersReport([...this.producers.values()]);i&&c?i.producerReport=c:(i=yield this.measurements.getProcessedStats(this.producingTransport,!1,!0),(!i||!(i!=null&&i.producerReport))&&this.logger.debug("callStats::sendPingStatsEvent::noProducingTransportReport",{disclaimer:"Stream maps invalid despite regenerating!"}))}if(this.consumingTransport&&(o=yield this.measurements.getProcessedStats(this.consumingTransport,!0,!1),!o||!((s=o.consumerReport)!=null&&s.length))){this.logger.debug("callStats::sendPingStatsEvent::staleConsumingTransport",{disclaimer:"Stale consumer? Regenerating Stream Maps!"});const c=yield this.measurements.getConsumersReport([...this.consumers.values()]);o&&c?o.consumerReport=c:(o=yield this.measurements.getProcessedStats(this.consumingTransport,!0,!1),(!o||!o.consumerReport)&&this.logger.debug("callStats::sendPingStatsEvent::noConsumingTransportReport",{disclaimer:"Stream maps invalid despite regenerating!"}))}const l={producingTransportStats:i?i==null?void 0:i.transportReport:void 0,consumingTransportStats:o?o==null?void 0:o.transportReport:void 0,producerStats:[].concat((i==null?void 0:i.producerReport)||[]).concat((o==null?void 0:o.producerReport)||[]),consumerStats:[].concat((o==null?void 0:o.consumerReport)||[]).concat((i==null?void 0:i.consumerReport)||[])};if(e&&l.producerStats.length===0&&l.consumerStats.length===0){yield this.eventHandler.flush();return}this.eventHandler.callEvent({event:Zt.PING_STAT,metaData:l,timestamp:n})})}sendIVSPlayerRebufferEvent(e){this.eventHandler.callEvent({event:Zt.IVS_PLAYER_REBUFFERING,timestamp:e})}sendIVSPlayerAudioBlockEvent(e){this.eventHandler.callEvent({event:Zt.IVS_PLAYER_AUDIO_BLOCKED,timestamp:e})}sendIVSPlayerPlaybackBlockedEvent(e){this.eventHandler.callEvent({event:Zt.IVS_PLAYER_PLAYBACK_BLOCKED,timestamp:e})}sendIVSPlayerNetworkUnavailableEvent(e){this.eventHandler.callEvent({event:Zt.IVS_PLAYER_NETWORK_UNAVAILABLE,timestamp:e})}sendIVSPlayerInitializedEvent(e){this.eventHandler.callEvent({event:Zt.IVS_PLAYER_INITIALIZED,timestamp:e})}sendIVSPlayerWorkerErrorEvent(e){this.eventHandler.callEvent({event:Zt.IVS_PLAYER_WORKER_ERROR,timestamp:e})}sendIVSPlayerErrorEvent(e,n){this.eventHandler.callEvent({event:Zt.IVS_PLAYER_ERROR,timestamp:n,metaData:e})}sendIVSPlayerRecoverableErrorEvent(e,n){this.eventHandler.callEvent({event:Zt.IVS_PLAYER_RECOVERABLE_ERROR,timestamp:n,metaData:e})}sendIVSPlayerAnalyticsEvent(e,n){this.eventHandler.callEvent({event:Zt.IVS_PLAYER_ANALYTICS_EVENT,timestamp:n,metaData:e})}sendIVSPlayerPlaybackRateChangedEvent(e,n){this.eventHandler.callEvent({event:Zt.IVS_PLAYER_PLAYBACK_RATE_CHANGED,timestamp:n,metaData:{updatedPlaybackRate:e}})}sendIVSPlayerQualityChanged(e,n){this.eventHandler.callEvent({event:Zt.IVS_PLAYER_QUALITY_CHANGED,timestamp:n,metaData:e})}sendPlayerLiveLatency(e,n){this.eventHandler.callEvent({event:Zt.LIVESTREAM_LATENCY,timestamp:n,metaData:{latency:e}})}sendDisconnectEvent(e){this.eventHandler.callEvent({event:Zt.DISCONNECT,timestamp:e})}sendReconnectEvent(e){this.eventHandler.callEvent({event:Zt.RECONNECT_ATTEMPT,timestamp:e})}expectedVideoResolution(e,n,r){this.eventHandler.callEvent({event:Zt.EXPECTED_VIDEO_RESOLUTION,timestamp:r,metaData:{frameWidth:e,frameHeight:n}})}expectedScreenshareResolution(e,n,r){this.eventHandler.callEvent({event:Zt.EXPECTED_SCREENSHARE_RESOLUTION,timestamp:r,metaData:{frameWidth:e,frameHeight:n}})}};Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"registerIceServers",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"registerConsumer",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"registerProducer",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendConsumerSharedMediaStateEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"registerProducingTransport",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"registerConsumingTransport",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"deRegisterConsumer",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"deRegisterProducer",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"disconnectConsumingTransport",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"disconnectProducingTransport",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendPreCallTestBeginEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendScreenShareToggleEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendScreenShareRequestedEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendActiveSpeakerEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"devices",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"selectedDevice",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"mediaPermission",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"mediaPlaybackFailed",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"mediaTrackMuted",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"tabChanged",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"browserBackgrounded",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"browserForegrounded",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"legacySwitch",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"getPreCallTestResults",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendCallJoinBeginEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendNetworkQualityTestBeginEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendWebSocketConnectedEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendTransportConnectedEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendAudioToggleEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendVideoToggleEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendParticipantRoleToggleEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"startPingStats",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"stopPingStats",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendPingStatsEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendIVSPlayerRebufferEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendIVSPlayerAudioBlockEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendIVSPlayerPlaybackBlockedEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendIVSPlayerNetworkUnavailableEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendIVSPlayerInitializedEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendIVSPlayerWorkerErrorEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendIVSPlayerErrorEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendIVSPlayerRecoverableErrorEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendIVSPlayerAnalyticsEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendIVSPlayerPlaybackRateChangedEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendIVSPlayerQualityChanged",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendPlayerLiveLatency",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendDisconnectEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"sendReconnectEvent",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"expectedVideoResolution",null);Qr([ns(TypeError,(t,e)=>Zr.error(e,t))],Mr.prototype,"expectedScreenshareResolution",null);Mr=Qr([Wpn(TypeError,(t,e)=>Zr.error(e,t))],Mr);const qpn=Mr;class $ft extends Zd{constructor(){super(...arguments),xe(this,"stats"),xe(this,"peerId"),xe(this,"backend"),xe(this,"iceServers"),xe(this,"initialized",!1),xe(this,"stalled",!1),xe(this,"ipInformation"),xe(this,"logger")}initialize(e){return me(this,arguments,function*({peerId:n,engineName:r,env:s=xft.PROD,iceServers:i,apiBase:o="https://api.cluster.dyte.in",flags:l,logger:c=console,apiHostnames:d,skipConnectivityChecks:u=!1,authToken:h}){var m,f,p;try{if(this.peerId=n,this.logger=c,!h){this.logger.error("callStats::initialize",{event:"auth_token_missing",peerId:this.peerId}),this.stallCallStats();return}this.ipInformation=yield Ift.getIPDetails({peerId:n,apiHostnames:d,logger:c}),this.backend=new qpn(o,r,s,l,c,n,d,h),this.iceServers=i,(m=this.backend)==null||m.registerIceServers(this.iceServers),this.initialized=!0,(p=(f=this.backend)==null?void 0:f.eventHandler)==null||p.emit("initialized",this.ipInformation),this.emit("initialized",this.ipInformation),this.startPreCallTest(u)}catch(g){this.logger.error("callStats::CallStatsIntegration",{peerId:this.peerId,error:g instanceof Error?g.message:String(g),stack:g instanceof Error?g.stack:void 0}),this.stallCallStats()}})}configureSendTransport(e){this.onSafeInitialization(()=>{var n;(n=this.backend)==null||n.registerProducingTransport(e)})}configureRecvTransport(e){this.onSafeInitialization(()=>{var n;(n=this.backend)==null||n.registerConsumingTransport(e)})}candidateRegionalNetworkQualityTest(e){return me(this,null,function*(){const n=new Date;this.onSafeInitialization(()=>{var r;try{(r=this.backend)==null||r.sendNetworkQualityTestBeginEvent(e,n)}catch(s){this.logger.error("callStats::sendNetworkQualityTestBeginEvent",{error:{reason:s.reason}})}})})}roomJoined(e){return me(this,null,function*(){const n=new Date;this.onSafeInitialization(()=>{var r,s;(r=this.backend)==null||r.sendCallJoinBeginEvent(e,n),this.backend,(s=this.backend)==null||s.startPingStats()})})}audioOff(){const e=new Date;this.onSafeInitialization(()=>{var n;(n=this.backend)==null||n.sendAudioToggleEvent(!1,e)})}audioOn(){const e=new Date;this.onSafeInitialization(()=>{var n;(n=this.backend)==null||n.sendAudioToggleEvent(!0,e)})}videoOff(){const e=new Date;this.onSafeInitialization(()=>{var n;(n=this.backend)==null||n.sendVideoToggleEvent(!1,e)})}videoOn(){const e=new Date;this.onSafeInitialization(()=>{var n;(n=this.backend)==null||n.sendVideoToggleEvent(!0,e)})}callEnded(){const e=new Date;this.onSafeInitialization(()=>{var n,r;(n=this.backend)==null||n.stopPingStats(),(r=this.backend)==null||r.sendDisconnectEvent(e)})}screenShareStart(e){const n=new Date;this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.sendScreenShareToggleEvent(!0,e,n)})}consumerSharedMediaState(e,n){this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.sendConsumerSharedMediaStateEvent(e,n)})}screenShareStop(e){const n=new Date;this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.sendScreenShareToggleEvent(!1,e,n)})}screenShareRequested(){const e=new Date;this.onSafeInitialization(()=>{var n;(n=this.backend)==null||n.sendScreenShareRequestedEvent(e)})}activeSpeaker(e){if(e!==this.peerId)return;const n=new Date;this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.sendActiveSpeakerEvent(e,n)})}devices(e,n){const r=new Date;this.onSafeInitialization(()=>{var s;(s=this.backend)==null||s.devices(e,n,r)})}selectedDevice(e,n){const r=new Date;this.onSafeInitialization(()=>{var s;(s=this.backend)==null||s.selectedDevice(e,n,r)})}mediaPermission(e,n){const r=new Date;this.onSafeInitialization(()=>{var s;(s=this.backend)==null||s.mediaPermission(e,n,r)})}mediaPlaybackFailed(e){const n=new Date;this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.mediaPlaybackFailed(e,n)})}mediaTrackMuted(e){const n=new Date;this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.mediaTrackMuted(e,n)})}tabChanged(e=!1){const n=new Date;this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.tabChanged(e,n)})}browserBackgrounded(){const e=new Date;this.onSafeInitialization(()=>{var n;(n=this.backend)==null||n.browserBackgrounded(e)})}browserForegrounded(){const e=new Date;this.onSafeInitialization(()=>{var n;(n=this.backend)==null||n.browserForegrounded(e)})}legacySwitch(e){const n=new Date;this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.legacySwitch(e,n)})}startPreCallTest(e=!1){return me(this,null,function*(){const n=new Date;this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.sendPreCallTestBeginEvent(e,n)})})}onPreCallTestResults(e){return this.onSafeInitialization(()=>{var n;(n=this.backend)==null||n.eventHandler.once("precall_end",e)}),e}onReceivingConsumerAudioStatus(e){this.onSafeInitialization(()=>{var n;(n=this.backend)==null||n.eventHandler.on("consumer_audio_status",e)})}onReceivingConsumerVideoStatus(e){this.onSafeInitialization(()=>{var n;(n=this.backend)==null||n.eventHandler.on("consumer_video_status",e)})}onReceivingProducerAudioStatus(e){this.onSafeInitialization(()=>{var n;(n=this.backend)==null||n.eventHandler.on("producer_audio_status",e)})}onReceivingProducerVideoStatus(e){this.onSafeInitialization(()=>{var n;(n=this.backend)==null||n.eventHandler.on("producer_video_status",e)})}onReceivingProducingTransportStatus(e){this.onSafeInitialization(()=>{var n;(n=this.backend)==null||n.eventHandler.on("producing_transport_status",e)})}onReceivingConsumingTransportStatus(e){this.onSafeInitialization(()=>{var n;(n=this.backend)==null||n.eventHandler.on("consuming_transport_status",e)})}onProducerScore(e){this.onSafeInitialization(()=>{var n;(n=this.backend)==null||n.eventHandler.on("producer_score",e)})}onConsumerScore(e){this.onSafeInitialization(()=>{var n;(n=this.backend)==null||n.eventHandler.on("consumer_score",e)})}onSafeInitialization(e){if(this.initialized)e(this.ipInformation,!1);else if(!this.stalled){const n=r=>{e(r,!0)};return this.once("initialized",n),n}return()=>{}}removeInitializationListener(e){this.removeListener("initialized",e)}stallCallStats(){this.stalled=!0,this.removeAllListeners("initialized")}ivsPlayerEvent(e,n){const r=new Date;this.onSafeInitialization(()=>{var s,i,o,l,c,d,u,h,m,f,p;switch(e){case"PlayerRebuffering":(s=this.backend)==null||s.sendIVSPlayerRebufferEvent(r);break;case"PlayerAudioBlocked":(i=this.backend)==null||i.sendIVSPlayerAudioBlockEvent(r);break;case"PlayerPlaybackBlocked":(o=this.backend)==null||o.sendIVSPlayerPlaybackBlockedEvent(r);break;case"PlayerNetworkUnavailable":(l=this.backend)==null||l.sendIVSPlayerNetworkUnavailableEvent(r);break;case"PlayerInitialized":(c=this.backend)==null||c.sendIVSPlayerInitializedEvent(r);break;case"PlayerWorkerError":(d=this.backend)==null||d.sendIVSPlayerWorkerErrorEvent(r);break;case"PlayerError":(u=this.backend)==null||u.sendIVSPlayerErrorEvent(n,r);break;case"PlayerRecoverableError":(h=this.backend)==null||h.sendIVSPlayerRecoverableErrorEvent(n,r);break;case"PlayerAnalyticsEvent":(m=this.backend)==null||m.sendIVSPlayerAnalyticsEvent(n,r);break;case"PlayerPlaybackRateChanged":(f=this.backend)==null||f.sendIVSPlayerPlaybackRateChangedEvent(n,r);break;case"PlayerQualityChanged":(p=this.backend)==null||p.sendIVSPlayerQualityChanged(n,r);break}})}livestreamLatency(e){const n=new Date;this.onSafeInitialization(()=>{var r;(r=this.backend)==null||r.sendPlayerLiveLatency(e,n)})}expectedVideoResolution(e,n){const r=new Date;this.onSafeInitialization(()=>{var s;(s=this.backend)==null||s.expectedVideoResolution(e,n,r)})}expectedScreenshareResolution(e,n){const r=new Date;this.onSafeInitialization(()=>{var s;(s=this.backend)==null||s.expectedScreenshareResolution(e,n,r)})}}const Kpn=new $ft;Kpn.setMaxListeners(30);var OG;class Ypn{constructor(){Se(this,OG,void 0)}get telemetry(){var e;return(e=L(this,OG))==null?void 0:e.getValue("telemetry")}init(e){Te(this,OG,e)}info(e,n,r){var s;(s=this.telemetry)==null||s.addLogInCurrentSpan("info",e,n,r)}error(e,n,r){var s;(s=this.telemetry)==null||s.addLogInCurrentSpan("error",e,n,r)}debug(e,n,r){var s;(s=this.telemetry)==null||s.addLogInCurrentSpan("debug",e,n,r)}log(e,n,r){var s;(s=this.telemetry)==null||s.addLogInCurrentSpan("log",e,n,r)}warn(e,n,r){var s;(s=this.telemetry)==null||s.addLogInCurrentSpan("warn",e,n,r)}}OG=new WeakMap;var Sw,Cw;const Oft=class extends Zd.EventEmitter{constructor(t){super(),Se(this,Sw,void 0),Se(this,Cw,void 0),xe(this,"asyncPromiseTimeout"),xe(this,"logger"),this.logger=t,Te(this,Sw,new Map),Te(this,Cw,new Map),this.asyncPromiseTimeout=8e3}emitAsync(t,...e){return me(this,null,function*(){L(this,Sw).set(t,[]);const n=L(this,Cw).get(t).map(()=>new Promise(r=>{L(this,Sw).get(t).push(r)}));dpn(Oft.prototype,this,"emit").call(this,t,...e),yield Promise.race([Promise.all(n),new Promise((r,s)=>setTimeout(()=>s(new Error(`emitAsync failed to resolve for event ${t}.`)),this.asyncPromiseTimeout))]),L(this,Sw).delete(t)})}onAsync(t,e){const n=L(this,Sw),r=(...s)=>me(this,null,function*(){var i;try{yield e(...s)}catch(l){this.logger.error("[onAsync]",{error:l})}const o=(i=n.get(t))==null?void 0:i.shift();o==null||o()});return L(this,Cw).get(t)||L(this,Cw).set(t,[]),L(this,Cw).get(t).push(r),super.on(t,r)}reset(){Te(this,Sw,new Map),Te(this,Cw,new Map),super.removeAllListeners()}};let Qpn=Oft;Sw=new WeakMap,Cw=new WeakMap;var Zpn=typeof global=="object"&&global&&global.Object===Object&&global;const Fft=Zpn;var Jpn=typeof self=="object"&&self&&self.Object===Object&&self,Xpn=Fft||Jpn||Function("return this")();const Wg=Xpn;var egn=Wg.Symbol;const Ty=egn;var Bft=Object.prototype,tgn=Bft.hasOwnProperty,ngn=Bft.toString,OL=Ty?Ty.toStringTag:void 0;function rgn(t){var e=tgn.call(t,OL),n=t[OL];try{t[OL]=void 0;var r=!0}catch{}var s=ngn.call(t);return r&&(e?t[OL]=n:delete t[OL]),s}var sgn=Object.prototype,ign=sgn.toString;function agn(t){return ign.call(t)}var ogn="[object Null]",lgn="[object Undefined]",n6e=Ty?Ty.toStringTag:void 0;function LE(t){return t==null?t===void 0?lgn:ogn:n6e&&n6e in Object(t)?rgn(t):agn(t)}function _y(t){return t!=null&&typeof t=="object"}var cgn="[object Symbol]";function _te(t){return typeof t=="symbol"||_y(t)&&LE(t)==cgn}function dgn(t,e){for(var n=-1,r=t==null?0:t.length,s=Array(r);++n<r;)s[n]=e(t[n],n,t);return s}var ugn=Array.isArray;const Nm=ugn;var hgn=1/0,r6e=Ty?Ty.prototype:void 0,s6e=r6e?r6e.toString:void 0;function Uft(t){if(typeof t=="string")return t;if(Nm(t))return dgn(t,Uft)+"";if(_te(t))return s6e?s6e.call(t):"";var e=t+"";return e=="0"&&1/t==-hgn?"-0":e}var mgn=/\s/;function fgn(t){for(var e=t.length;e--&&mgn.test(t.charAt(e)););return e}var pgn=/^\s+/;function ggn(t){return t&&t.slice(0,fgn(t)+1).replace(pgn,"")}function zf(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var i6e=NaN,vgn=/^[-+]0x[0-9a-f]+$/i,ygn=/^0b[01]+$/i,bgn=/^0o[0-7]+$/i,xgn=parseInt;function a6e(t){if(typeof t=="number")return t;if(_te(t))return i6e;if(zf(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=zf(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=ggn(t);var n=ygn.test(t);return n||bgn.test(t)?xgn(t.slice(2),n?2:8):vgn.test(t)?i6e:+t}function G2e(t){return t}var wgn="[object AsyncFunction]",kgn="[object Function]",Sgn="[object GeneratorFunction]",Cgn="[object Proxy]";function W2e(t){if(!zf(t))return!1;var e=LE(t);return e==kgn||e==Sgn||e==wgn||e==Cgn}var jgn=Wg["__core-js_shared__"];const Rle=jgn;var o6e=function(){var t=/[^.]+$/.exec(Rle&&Rle.keys&&Rle.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Egn(t){return!!o6e&&o6e in t}var Ngn=Function.prototype,Tgn=Ngn.toString;function DE(t){if(t!=null){try{return Tgn.call(t)}catch{}try{return t+""}catch{}}return""}var _gn=/[\\^$.*+?()[\]{}|]/g,Agn=/^\[object .+?Constructor\]$/,Pgn=Function.prototype,Rgn=Object.prototype,Ign=Pgn.toString,Mgn=Rgn.hasOwnProperty,Lgn=RegExp("^"+Ign.call(Mgn).replace(_gn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function Dgn(t){if(!zf(t)||Egn(t))return!1;var e=W2e(t)?Lgn:Agn;return e.test(DE(t))}function $gn(t,e){return t==null?void 0:t[e]}function $E(t,e){var n=$gn(t,e);return Dgn(n)?n:void 0}var Ogn=$E(Wg,"WeakMap");const nve=Ogn;var l6e=Object.create,Fgn=function(){function t(){}return function(e){if(!zf(e))return{};if(l6e)return l6e(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();const Bgn=Fgn;function Ugn(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function zgn(){}function zft(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}var Vgn=800,Hgn=16,Ggn=Date.now;function Wgn(t){var e=0,n=0;return function(){var r=Ggn(),s=Hgn-(r-n);if(n=r,s>0){if(++e>=Vgn)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function qgn(t){return function(){return t}}var Kgn=function(){try{var t=$E(Object,"defineProperty");return t({},"",{}),t}catch{}}();const zY=Kgn;var Ygn=zY?function(t,e){return zY(t,"toString",{configurable:!0,enumerable:!1,value:qgn(e),writable:!0})}:G2e;const Qgn=Ygn;var Zgn=Wgn(Qgn);const Jgn=Zgn;function Xgn(t,e){for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}function evn(t,e,n,r){for(var s=t.length,i=n+-1;++i<s;)if(e(t[i],i,t))return i;return-1}function tvn(t){return t!==t}function nvn(t,e,n){for(var r=n-1,s=t.length;++r<s;)if(t[r]===e)return r;return-1}function rvn(t,e,n){return e===e?nvn(t,e,n):evn(t,tvn,n)}function svn(t,e){var n=t==null?0:t.length;return!!n&&rvn(t,e,0)>-1}var ivn=9007199254740991,avn=/^(?:0|[1-9]\d*)$/;function q2e(t,e){var n=typeof t;return e=e??ivn,!!e&&(n=="number"||n!="symbol"&&avn.test(t))&&t>-1&&t%1==0&&t<e}function K2e(t,e,n){e=="__proto__"&&zY?zY(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function y7(t,e){return t===e||t!==t&&e!==e}var ovn=Object.prototype,lvn=ovn.hasOwnProperty;function Vft(t,e,n){var r=t[e];(!(lvn.call(t,e)&&y7(r,n))||n===void 0&&!(e in t))&&K2e(t,e,n)}function b7(t,e,n,r){var s=!n;n||(n={});for(var i=-1,o=e.length;++i<o;){var l=e[i],c=void 0;c===void 0&&(c=t[l]),s?K2e(n,l,c):Vft(n,l,c)}return n}var c6e=Math.max;function cvn(t,e,n){return e=c6e(e===void 0?t.length-1:e,0),function(){for(var r=arguments,s=-1,i=c6e(r.length-e,0),o=Array(i);++s<i;)o[s]=r[e+s];s=-1;for(var l=Array(e+1);++s<e;)l[s]=r[s];return l[e]=n(o),Ugn(t,this,l)}}function dvn(t,e){return Jgn(cvn(t,e,G2e),t+"")}var uvn=9007199254740991;function Y2e(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=uvn}function x7(t){return t!=null&&Y2e(t.length)&&!W2e(t)}function hvn(t,e,n){if(!zf(n))return!1;var r=typeof e;return(r=="number"?x7(n)&&q2e(e,n.length):r=="string"&&e in n)?y7(n[e],t):!1}function mvn(t){return dvn(function(e,n){var r=-1,s=n.length,i=s>1?n[s-1]:void 0,o=s>2?n[2]:void 0;for(i=t.length>3&&typeof i=="function"?(s--,i):void 0,o&&hvn(n[0],n[1],o)&&(i=s<3?void 0:i,s=1),e=Object(e);++r<s;){var l=n[r];l&&t(e,l,r,i)}return e})}var fvn=Object.prototype;function Ate(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||fvn;return t===n}function pvn(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var gvn="[object Arguments]";function d6e(t){return _y(t)&&LE(t)==gvn}var Hft=Object.prototype,vvn=Hft.hasOwnProperty,yvn=Hft.propertyIsEnumerable,bvn=d6e(function(){return arguments}())?d6e:function(t){return _y(t)&&vvn.call(t,"callee")&&!yvn.call(t,"callee")};const JO=bvn;function xvn(){return!1}var Gft=typeof exports=="object"&&exports&&!exports.nodeType&&exports,u6e=Gft&&typeof module=="object"&&module&&!module.nodeType&&module,wvn=u6e&&u6e.exports===Gft,h6e=wvn?Wg.Buffer:void 0,kvn=h6e?h6e.isBuffer:void 0,Svn=kvn||xvn;const gR=Svn;var Cvn="[object Arguments]",jvn="[object Array]",Evn="[object Boolean]",Nvn="[object Date]",Tvn="[object Error]",_vn="[object Function]",Avn="[object Map]",Pvn="[object Number]",Rvn="[object Object]",Ivn="[object RegExp]",Mvn="[object Set]",Lvn="[object String]",Dvn="[object WeakMap]",$vn="[object ArrayBuffer]",Ovn="[object DataView]",Fvn="[object Float32Array]",Bvn="[object Float64Array]",Uvn="[object Int8Array]",zvn="[object Int16Array]",Vvn="[object Int32Array]",Hvn="[object Uint8Array]",Gvn="[object Uint8ClampedArray]",Wvn="[object Uint16Array]",qvn="[object Uint32Array]",qa={};qa[Fvn]=qa[Bvn]=qa[Uvn]=qa[zvn]=qa[Vvn]=qa[Hvn]=qa[Gvn]=qa[Wvn]=qa[qvn]=!0;qa[Cvn]=qa[jvn]=qa[$vn]=qa[Evn]=qa[Ovn]=qa[Nvn]=qa[Tvn]=qa[_vn]=qa[Avn]=qa[Pvn]=qa[Rvn]=qa[Ivn]=qa[Mvn]=qa[Lvn]=qa[Dvn]=!1;function Kvn(t){return _y(t)&&Y2e(t.length)&&!!qa[LE(t)]}function Q2e(t){return function(e){return t(e)}}var Wft=typeof exports=="object"&&exports&&!exports.nodeType&&exports,FD=Wft&&typeof module=="object"&&module&&!module.nodeType&&module,Yvn=FD&&FD.exports===Wft,Ile=Yvn&&Fft.process,Qvn=function(){try{var t=FD&&FD.require&&FD.require("util").types;return t||Ile&&Ile.binding&&Ile.binding("util")}catch{}}();const vR=Qvn;var m6e=vR&&vR.isTypedArray,Zvn=m6e?Q2e(m6e):Kvn;const Pte=Zvn;var Jvn=Object.prototype,Xvn=Jvn.hasOwnProperty;function qft(t,e){var n=Nm(t),r=!n&&JO(t),s=!n&&!r&&gR(t),i=!n&&!r&&!s&&Pte(t),o=n||r||s||i,l=o?pvn(t.length,String):[],c=l.length;for(var d in t)(e||Xvn.call(t,d))&&!(o&&(d=="length"||s&&(d=="offset"||d=="parent")||i&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||q2e(d,c)))&&l.push(d);return l}function Kft(t,e){return function(n){return t(e(n))}}var eyn=Kft(Object.keys,Object);const tyn=eyn;var nyn=Object.prototype,ryn=nyn.hasOwnProperty;function Yft(t){if(!Ate(t))return tyn(t);var e=[];for(var n in Object(t))ryn.call(t,n)&&n!="constructor"&&e.push(n);return e}function Rte(t){return x7(t)?qft(t):Yft(t)}function syn(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}var iyn=Object.prototype,ayn=iyn.hasOwnProperty;function oyn(t){if(!zf(t))return syn(t);var e=Ate(t),n=[];for(var r in t)r=="constructor"&&(e||!ayn.call(t,r))||n.push(r);return n}function w7(t){return x7(t)?qft(t,!0):oyn(t)}var lyn=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,cyn=/^\w*$/;function Z2e(t,e){if(Nm(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||_te(t)?!0:cyn.test(t)||!lyn.test(t)||e!=null&&t in Object(e)}var dyn=$E(Object,"create");const XO=dyn;function uyn(){this.__data__=XO?XO(null):{},this.size=0}function hyn(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var myn="__lodash_hash_undefined__",fyn=Object.prototype,pyn=fyn.hasOwnProperty;function gyn(t){var e=this.__data__;if(XO){var n=e[t];return n===myn?void 0:n}return pyn.call(e,t)?e[t]:void 0}var vyn=Object.prototype,yyn=vyn.hasOwnProperty;function byn(t){var e=this.__data__;return XO?e[t]!==void 0:yyn.call(e,t)}var xyn="__lodash_hash_undefined__";function wyn(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=XO&&e===void 0?xyn:e,this}function F2(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}F2.prototype.clear=uyn;F2.prototype.delete=hyn;F2.prototype.get=gyn;F2.prototype.has=byn;F2.prototype.set=wyn;function kyn(){this.__data__=[],this.size=0}function Ite(t,e){for(var n=t.length;n--;)if(y7(t[n][0],e))return n;return-1}var Syn=Array.prototype,Cyn=Syn.splice;function jyn(t){var e=this.__data__,n=Ite(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():Cyn.call(e,n,1),--this.size,!0}function Eyn(t){var e=this.__data__,n=Ite(e,t);return n<0?void 0:e[n][1]}function Nyn(t){return Ite(this.__data__,t)>-1}function Tyn(t,e){var n=this.__data__,r=Ite(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function T0(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}T0.prototype.clear=kyn;T0.prototype.delete=jyn;T0.prototype.get=Eyn;T0.prototype.has=Nyn;T0.prototype.set=Tyn;var _yn=$E(Wg,"Map");const e6=_yn;function Ayn(){this.size=0,this.__data__={hash:new F2,map:new(e6||T0),string:new F2}}function Pyn(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function Mte(t,e){var n=t.__data__;return Pyn(e)?n[typeof e=="string"?"string":"hash"]:n.map}function Ryn(t){var e=Mte(this,t).delete(t);return this.size-=e?1:0,e}function Iyn(t){return Mte(this,t).get(t)}function Myn(t){return Mte(this,t).has(t)}function Lyn(t,e){var n=Mte(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}function _0(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}_0.prototype.clear=Ayn;_0.prototype.delete=Ryn;_0.prototype.get=Iyn;_0.prototype.has=Myn;_0.prototype.set=Lyn;var Dyn="Expected a function";function J2e(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(Dyn);var n=function(){var r=arguments,s=e?e.apply(this,r):r[0],i=n.cache;if(i.has(s))return i.get(s);var o=t.apply(this,r);return n.cache=i.set(s,o)||i,o};return n.cache=new(J2e.Cache||_0),n}J2e.Cache=_0;var $yn=500;function Oyn(t){var e=J2e(t,function(r){return n.size===$yn&&n.clear(),r}),n=e.cache;return e}var Fyn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Byn=/\\(\\)?/g,Uyn=Oyn(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(Fyn,function(n,r,s,i){e.push(s?i.replace(Byn,"$1"):r||n)}),e});const zyn=Uyn;function Vyn(t){return t==null?"":Uft(t)}function Qft(t,e){return Nm(t)?t:Z2e(t,e)?[t]:zyn(Vyn(t))}var Hyn=1/0;function Lte(t){if(typeof t=="string"||_te(t))return t;var e=t+"";return e=="0"&&1/t==-Hyn?"-0":e}function Zft(t,e){e=Qft(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[Lte(e[n++])];return n&&n==r?t:void 0}function Gyn(t,e,n){var r=t==null?void 0:Zft(t,e);return r===void 0?n:r}function Jft(t,e){for(var n=-1,r=e.length,s=t.length;++n<r;)t[s+n]=e[n];return t}var Wyn=Kft(Object.getPrototypeOf,Object);const X2e=Wyn;var qyn="[object Object]",Kyn=Function.prototype,Yyn=Object.prototype,Xft=Kyn.toString,Qyn=Yyn.hasOwnProperty,Zyn=Xft.call(Object);function Jyn(t){if(!_y(t)||LE(t)!=qyn)return!1;var e=X2e(t);if(e===null)return!0;var n=Qyn.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&Xft.call(n)==Zyn}function Xyn(){this.__data__=new T0,this.size=0}function ebn(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function tbn(t){return this.__data__.get(t)}function nbn(t){return this.__data__.has(t)}var rbn=200;function sbn(t,e){var n=this.__data__;if(n instanceof T0){var r=n.__data__;if(!e6||r.length<rbn-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new _0(r)}return n.set(t,e),this.size=n.size,this}function Cg(t){var e=this.__data__=new T0(t);this.size=e.size}Cg.prototype.clear=Xyn;Cg.prototype.delete=ebn;Cg.prototype.get=tbn;Cg.prototype.has=nbn;Cg.prototype.set=sbn;function ibn(t,e){return t&&b7(e,Rte(e),t)}function abn(t,e){return t&&b7(e,w7(e),t)}var ept=typeof exports=="object"&&exports&&!exports.nodeType&&exports,f6e=ept&&typeof module=="object"&&module&&!module.nodeType&&module,obn=f6e&&f6e.exports===ept,p6e=obn?Wg.Buffer:void 0,g6e=p6e?p6e.allocUnsafe:void 0;function tpt(t,e){if(e)return t.slice();var n=t.length,r=g6e?g6e(n):new t.constructor(n);return t.copy(r),r}function lbn(t,e){for(var n=-1,r=t==null?0:t.length,s=0,i=[];++n<r;){var o=t[n];e(o,n,t)&&(i[s++]=o)}return i}function npt(){return[]}var cbn=Object.prototype,dbn=cbn.propertyIsEnumerable,v6e=Object.getOwnPropertySymbols,ubn=v6e?function(t){return t==null?[]:(t=Object(t),lbn(v6e(t),function(e){return dbn.call(t,e)}))}:npt;const eEe=ubn;function hbn(t,e){return b7(t,eEe(t),e)}var mbn=Object.getOwnPropertySymbols,fbn=mbn?function(t){for(var e=[];t;)Jft(e,eEe(t)),t=X2e(t);return e}:npt;const rpt=fbn;function pbn(t,e){return b7(t,rpt(t),e)}function spt(t,e,n){var r=e(t);return Nm(t)?r:Jft(r,n(t))}function rve(t){return spt(t,Rte,eEe)}function gbn(t){return spt(t,w7,rpt)}var vbn=$E(Wg,"DataView");const sve=vbn;var ybn=$E(Wg,"Promise");const ive=ybn;var bbn=$E(Wg,"Set");const HA=bbn;var y6e="[object Map]",xbn="[object Object]",b6e="[object Promise]",x6e="[object Set]",w6e="[object WeakMap]",k6e="[object DataView]",wbn=DE(sve),kbn=DE(e6),Sbn=DE(ive),Cbn=DE(HA),jbn=DE(nve),wC=LE;(sve&&wC(new sve(new ArrayBuffer(1)))!=k6e||e6&&wC(new e6)!=y6e||ive&&wC(ive.resolve())!=b6e||HA&&wC(new HA)!=x6e||nve&&wC(new nve)!=w6e)&&(wC=function(t){var e=LE(t),n=e==xbn?t.constructor:void 0,r=n?DE(n):"";if(r)switch(r){case wbn:return k6e;case kbn:return y6e;case Sbn:return b6e;case Cbn:return x6e;case jbn:return w6e}return e});const yR=wC;var Ebn=Object.prototype,Nbn=Ebn.hasOwnProperty;function Tbn(t){var e=t.length,n=new t.constructor(e);return e&&typeof t[0]=="string"&&Nbn.call(t,"index")&&(n.index=t.index,n.input=t.input),n}var _bn=Wg.Uint8Array;const VY=_bn;function tEe(t){var e=new t.constructor(t.byteLength);return new VY(e).set(new VY(t)),e}function Abn(t,e){var n=e?tEe(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}var Pbn=/\w*$/;function Rbn(t){var e=new t.constructor(t.source,Pbn.exec(t));return e.lastIndex=t.lastIndex,e}var S6e=Ty?Ty.prototype:void 0,C6e=S6e?S6e.valueOf:void 0;function Ibn(t){return C6e?Object(C6e.call(t)):{}}function ipt(t,e){var n=e?tEe(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var Mbn="[object Boolean]",Lbn="[object Date]",Dbn="[object Map]",$bn="[object Number]",Obn="[object RegExp]",Fbn="[object Set]",Bbn="[object String]",Ubn="[object Symbol]",zbn="[object ArrayBuffer]",Vbn="[object DataView]",Hbn="[object Float32Array]",Gbn="[object Float64Array]",Wbn="[object Int8Array]",qbn="[object Int16Array]",Kbn="[object Int32Array]",Ybn="[object Uint8Array]",Qbn="[object Uint8ClampedArray]",Zbn="[object Uint16Array]",Jbn="[object Uint32Array]";function Xbn(t,e,n){var r=t.constructor;switch(e){case zbn:return tEe(t);case Mbn:case Lbn:return new r(+t);case Vbn:return Abn(t,n);case Hbn:case Gbn:case Wbn:case qbn:case Kbn:case Ybn:case Qbn:case Zbn:case Jbn:return ipt(t,n);case Dbn:return new r;case $bn:case Bbn:return new r(t);case Obn:return Rbn(t);case Fbn:return new r;case Ubn:return Ibn(t)}}function apt(t){return typeof t.constructor=="function"&&!Ate(t)?Bgn(X2e(t)):{}}var exn="[object Map]";function txn(t){return _y(t)&&yR(t)==exn}var j6e=vR&&vR.isMap,nxn=j6e?Q2e(j6e):txn;const rxn=nxn;var sxn="[object Set]";function ixn(t){return _y(t)&&yR(t)==sxn}var E6e=vR&&vR.isSet,axn=E6e?Q2e(E6e):ixn;const oxn=axn;var lxn=1,cxn=2,dxn=4,opt="[object Arguments]",uxn="[object Array]",hxn="[object Boolean]",mxn="[object Date]",fxn="[object Error]",lpt="[object Function]",pxn="[object GeneratorFunction]",gxn="[object Map]",vxn="[object Number]",cpt="[object Object]",yxn="[object RegExp]",bxn="[object Set]",xxn="[object String]",wxn="[object Symbol]",kxn="[object WeakMap]",Sxn="[object ArrayBuffer]",Cxn="[object DataView]",jxn="[object Float32Array]",Exn="[object Float64Array]",Nxn="[object Int8Array]",Txn="[object Int16Array]",_xn="[object Int32Array]",Axn="[object Uint8Array]",Pxn="[object Uint8ClampedArray]",Rxn="[object Uint16Array]",Ixn="[object Uint32Array]",Ta={};Ta[opt]=Ta[uxn]=Ta[Sxn]=Ta[Cxn]=Ta[hxn]=Ta[mxn]=Ta[jxn]=Ta[Exn]=Ta[Nxn]=Ta[Txn]=Ta[_xn]=Ta[gxn]=Ta[vxn]=Ta[cpt]=Ta[yxn]=Ta[bxn]=Ta[xxn]=Ta[wxn]=Ta[Axn]=Ta[Pxn]=Ta[Rxn]=Ta[Ixn]=!0;Ta[fxn]=Ta[lpt]=Ta[kxn]=!1;function BD(t,e,n,r,s,i){var o,l=e&lxn,c=e&cxn,d=e&dxn;if(o!==void 0)return o;if(!zf(t))return t;var u=Nm(t);if(u){if(o=Tbn(t),!l)return zft(t,o)}else{var h=yR(t),m=h==lpt||h==pxn;if(gR(t))return tpt(t,l);if(h==cpt||h==opt||m&&!s){if(o=c||m?{}:apt(t),!l)return c?pbn(t,abn(o,t)):hbn(t,ibn(o,t))}else{if(!Ta[h])return s?t:{};o=Xbn(t,h,l)}}i||(i=new Cg);var f=i.get(t);if(f)return f;i.set(t,o),oxn(t)?t.forEach(function(v){o.add(BD(v,e,n,v,t,i))}):rxn(t)&&t.forEach(function(v,b){o.set(b,BD(v,e,n,b,t,i))});var p=d?c?gbn:rve:c?w7:Rte,g=u?void 0:p(t);return Xgn(g||t,function(v,b){g&&(b=v,v=t[b]),Vft(o,b,BD(v,e,n,b,t,i))}),o}var Mxn=4;function Lxn(t){return BD(t,Mxn)}var Dxn=1,$xn=4;function nEe(t){return BD(t,Dxn|$xn)}var Oxn="__lodash_hash_undefined__";function Fxn(t){return this.__data__.set(t,Oxn),this}function Bxn(t){return this.__data__.has(t)}function t6(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new _0;++e<n;)this.add(t[e])}t6.prototype.add=t6.prototype.push=Fxn;t6.prototype.has=Bxn;function Uxn(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}function dpt(t,e){return t.has(e)}var zxn=1,Vxn=2;function upt(t,e,n,r,s,i){var o=n&zxn,l=t.length,c=e.length;if(l!=c&&!(o&&c>l))return!1;var d=i.get(t),u=i.get(e);if(d&&u)return d==e&&u==t;var h=-1,m=!0,f=n&Vxn?new t6:void 0;for(i.set(t,e),i.set(e,t);++h<l;){var p=t[h],g=e[h];if(r)var v=o?r(g,p,h,e,t,i):r(p,g,h,t,e,i);if(v!==void 0){if(v)continue;m=!1;break}if(f){if(!Uxn(e,function(b,x){if(!dpt(f,x)&&(p===b||s(p,b,n,r,i)))return f.push(x)})){m=!1;break}}else if(!(p===g||s(p,g,n,r,i))){m=!1;break}}return i.delete(t),i.delete(e),m}function Hxn(t){var e=-1,n=Array(t.size);return t.forEach(function(r,s){n[++e]=[s,r]}),n}function rEe(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var Gxn=1,Wxn=2,qxn="[object Boolean]",Kxn="[object Date]",Yxn="[object Error]",Qxn="[object Map]",Zxn="[object Number]",Jxn="[object RegExp]",Xxn="[object Set]",e0n="[object String]",t0n="[object Symbol]",n0n="[object ArrayBuffer]",r0n="[object DataView]",N6e=Ty?Ty.prototype:void 0,Mle=N6e?N6e.valueOf:void 0;function s0n(t,e,n,r,s,i,o){switch(n){case r0n:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case n0n:return!(t.byteLength!=e.byteLength||!i(new VY(t),new VY(e)));case qxn:case Kxn:case Zxn:return y7(+t,+e);case Yxn:return t.name==e.name&&t.message==e.message;case Jxn:case e0n:return t==e+"";case Qxn:var l=Hxn;case Xxn:var c=r&Gxn;if(l||(l=rEe),t.size!=e.size&&!c)return!1;var d=o.get(t);if(d)return d==e;r|=Wxn,o.set(t,e);var u=upt(l(t),l(e),r,s,i,o);return o.delete(t),u;case t0n:if(Mle)return Mle.call(t)==Mle.call(e)}return!1}var i0n=1,a0n=Object.prototype,o0n=a0n.hasOwnProperty;function l0n(t,e,n,r,s,i){var o=n&i0n,l=rve(t),c=l.length,d=rve(e),u=d.length;if(c!=u&&!o)return!1;for(var h=c;h--;){var m=l[h];if(!(o?m in e:o0n.call(e,m)))return!1}var f=i.get(t),p=i.get(e);if(f&&p)return f==e&&p==t;var g=!0;i.set(t,e),i.set(e,t);for(var v=o;++h<c;){m=l[h];var b=t[m],x=e[m];if(r)var w=o?r(x,b,m,e,t,i):r(b,x,m,t,e,i);if(!(w===void 0?b===x||s(b,x,n,r,i):w)){g=!1;break}v||(v=m=="constructor")}if(g&&!v){var k=t.constructor,S=e.constructor;k!=S&&"constructor"in t&&"constructor"in e&&!(typeof k=="function"&&k instanceof k&&typeof S=="function"&&S instanceof S)&&(g=!1)}return i.delete(t),i.delete(e),g}var c0n=1,T6e="[object Arguments]",_6e="[object Array]",mz="[object Object]",d0n=Object.prototype,A6e=d0n.hasOwnProperty;function u0n(t,e,n,r,s,i){var o=Nm(t),l=Nm(e),c=o?_6e:yR(t),d=l?_6e:yR(e);c=c==T6e?mz:c,d=d==T6e?mz:d;var u=c==mz,h=d==mz,m=c==d;if(m&&gR(t)){if(!gR(e))return!1;o=!0,u=!1}if(m&&!u)return i||(i=new Cg),o||Pte(t)?upt(t,e,n,r,s,i):s0n(t,e,c,n,r,s,i);if(!(n&c0n)){var f=u&&A6e.call(t,"__wrapped__"),p=h&&A6e.call(e,"__wrapped__");if(f||p){var g=f?t.value():t,v=p?e.value():e;return i||(i=new Cg),s(g,v,n,r,i)}}return m?(i||(i=new Cg),l0n(t,e,n,r,s,i)):!1}function Dte(t,e,n,r,s){return t===e?!0:t==null||e==null||!_y(t)&&!_y(e)?t!==t&&e!==e:u0n(t,e,n,r,Dte,s)}var h0n=1,m0n=2;function f0n(t,e,n,r){var s=n.length,i=s;if(t==null)return!i;for(t=Object(t);s--;){var o=n[s];if(o[2]?o[1]!==t[o[0]]:!(o[0]in t))return!1}for(;++s<i;){o=n[s];var l=o[0],c=t[l],d=o[1];if(o[2]){if(c===void 0&&!(l in t))return!1}else{var u=new Cg,h;if(!(h===void 0?Dte(d,c,h0n|m0n,r,u):h))return!1}}return!0}function hpt(t){return t===t&&!zf(t)}function p0n(t){for(var e=Rte(t),n=e.length;n--;){var r=e[n],s=t[r];e[n]=[r,s,hpt(s)]}return e}function mpt(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}function g0n(t){var e=p0n(t);return e.length==1&&e[0][2]?mpt(e[0][0],e[0][1]):function(n){return n===t||f0n(n,t,e)}}function v0n(t,e){return t!=null&&e in Object(t)}function y0n(t,e,n){e=Qft(e,t);for(var r=-1,s=e.length,i=!1;++r<s;){var o=Lte(e[r]);if(!(i=t!=null&&n(t,o)))break;t=t[o]}return i||++r!=s?i:(s=t==null?0:t.length,!!s&&Y2e(s)&&q2e(o,s)&&(Nm(t)||JO(t)))}function b0n(t,e){return t!=null&&y0n(t,e,v0n)}var x0n=1,w0n=2;function k0n(t,e){return Z2e(t)&&hpt(e)?mpt(Lte(t),e):function(n){var r=Gyn(n,t);return r===void 0&&r===e?b0n(n,t):Dte(e,r,x0n|w0n)}}function S0n(t){return function(e){return e==null?void 0:e[t]}}function C0n(t){return function(e){return Zft(e,t)}}function j0n(t){return Z2e(t)?S0n(Lte(t)):C0n(t)}function E0n(t){return typeof t=="function"?t:t==null?G2e:typeof t=="object"?Nm(t)?k0n(t[0],t[1]):g0n(t):j0n(t)}function N0n(t){return function(e,n,r){for(var s=-1,i=Object(e),o=r(e),l=o.length;l--;){var c=o[++s];if(n(i[c],c,i)===!1)break}return e}}var T0n=N0n();const _0n=T0n;var A0n=function(){return Wg.Date.now()};const Lle=A0n;var P0n="Expected a function",R0n=Math.max,I0n=Math.min;function sEe(t,e,n){var r,s,i,o,l,c,d=0,u=!1,h=!1,m=!0;if(typeof t!="function")throw new TypeError(P0n);e=a6e(e)||0,zf(n)&&(u=!!n.leading,h="maxWait"in n,i=h?R0n(a6e(n.maxWait)||0,e):i,m="trailing"in n?!!n.trailing:m);function f(C){var j=r,E=s;return r=s=void 0,d=C,o=t.apply(E,j),o}function p(C){return d=C,l=setTimeout(b,e),u?f(C):o}function g(C){var j=C-c,E=C-d,N=e-j;return h?I0n(N,i-E):N}function v(C){var j=C-c,E=C-d;return c===void 0||j>=e||j<0||h&&E>=i}function b(){var C=Lle();if(v(C))return x(C);l=setTimeout(b,g(C))}function x(C){return l=void 0,m&&r?f(C):(r=s=void 0,o)}function w(){l!==void 0&&clearTimeout(l),d=0,r=c=s=l=void 0}function k(){return l===void 0?o:x(Lle())}function S(){var C=Lle(),j=v(C);if(r=arguments,s=this,c=C,j){if(l===void 0)return p(c);if(h)return clearTimeout(l),l=setTimeout(b,e),f(c)}return l===void 0&&(l=setTimeout(b,e)),o}return S.cancel=w,S.flush=k,S}function ave(t,e,n){(n!==void 0&&!y7(t[e],n)||n===void 0&&!(e in t))&&K2e(t,e,n)}function M0n(t){return _y(t)&&x7(t)}function ove(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}function L0n(t){return b7(t,w7(t))}function D0n(t,e,n,r,s,i,o){var l=ove(t,n),c=ove(e,n),d=o.get(c);if(d){ave(t,n,d);return}var u=i?i(l,c,n+"",t,e,o):void 0,h=u===void 0;if(h){var m=Nm(c),f=!m&&gR(c),p=!m&&!f&&Pte(c);u=c,m||f||p?Nm(l)?u=l:M0n(l)?u=zft(l):f?(h=!1,u=tpt(c,!0)):p?(h=!1,u=ipt(c,!0)):u=[]:Jyn(c)||JO(c)?(u=l,JO(l)?u=L0n(l):(!zf(l)||W2e(l))&&(u=apt(c))):h=!1}h&&(o.set(c,u),s(u,c,r,i,o),o.delete(c)),ave(t,n,u)}function fpt(t,e,n,r,s){t!==e&&_0n(e,function(i,o){if(s||(s=new Cg),zf(i))D0n(t,e,o,n,fpt,r,s);else{var l=r?r(ove(t,o),i,o+"",t,e,s):void 0;l===void 0&&(l=i),ave(t,o,l)}},w7)}var $0n="[object Map]",O0n="[object Set]",F0n=Object.prototype,B0n=F0n.hasOwnProperty;function U0n(t){if(t==null)return!0;if(x7(t)&&(Nm(t)||typeof t=="string"||typeof t.splice=="function"||gR(t)||Pte(t)||JO(t)))return!t.length;var e=yR(t);if(e==$0n||e==O0n)return!t.size;if(Ate(t))return!Yft(t).length;for(var n in t)if(B0n.call(t,n))return!1;return!0}function z0n(t,e){return Dte(t,e)}var V0n=mvn(function(t,e,n){fpt(t,e,n)});const jw=V0n;var H0n=1/0,G0n=HA&&1/rEe(new HA([,-0]))[1]==H0n?function(t){return new HA(t)}:zgn;const W0n=G0n;var q0n=200;function ppt(t,e,n){var r=-1,s=svn,i=t.length,o=!0,l=[],c=l;if(i>=q0n){var d=e?null:W0n(t);if(d)return rEe(d);o=!1,s=dpt,c=new t6}else c=e?[]:l;e:for(;++r<i;){var u=t[r],h=e?e(u):u;if(u=u!==0?u:0,o&&h===h){for(var m=c.length;m--;)if(c[m]===h)continue e;e&&c.push(h),l.push(u)}else s(c,h,n)||(c!==l&&c.push(h),l.push(u))}return l}function K0n(t){return t&&t.length?ppt(t):[]}function Y0n(t,e){return t&&t.length?ppt(t,E0n(e)):[]}function FG(t){const e={};return typeof(t==null?void 0:t.code)=="number"&&(e.code=t.code),typeof(t==null?void 0:t.code)=="string"&&(e.code=t.code.substring(0,100)),typeof(t==null?void 0:t.name)=="string"&&(e.name=t.name.substring(0,500)),typeof(t==null?void 0:t.message)=="string"&&(e.message=t.message.substring(0,500)),typeof(t==null?void 0:t.reason)=="string"&&(e.reason=t.reason.substring(0,500)),typeof(t==null?void 0:t.stack)=="string"&&(e.stack=t.stack.substring(0,500)),e}const Q0n={audio:!0,video:!0,screenshareAudio:!0,screenshareVideo:!0},P6e={STAGING:"staging",PROD:"prod"},Z0n={pip:!0,poll:!0,chat:!0,stage:!0,theme:!0,plugin:!0,tracing:!0,internals:!0,recording:!0,livestream:!0,participant:!0,connectedMeetings:!0,devTools:{logs:!1}};function bR(t,e){const n=t.getValue("overrides");return n&&n[e]?n[e]:!1}function J0n({baseURI:t}){return t.includes("staging.realtime")?P6e.STAGING:P6e.PROD}function GA({servicePrefix:t,baseURI:e}){return`${t}.${e}`}function X0n(t){const e=t.getValue("baseURI");return{location:GA({servicePrefix:"location",baseURI:e}),locationLegacy:GA({servicePrefix:"location-legacy",baseURI:e}),daCollector:GA({servicePrefix:"da-collector",baseURI:e})}}const ewn='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m16.242 2.932 4.826 4.826a2.75 2.75 0 0 1-.715 4.404l-4.87 2.435a.75.75 0 0 0-.374.426l-1.44 4.166a1.25 1.25 0 0 1-2.065.476L8.5 16.561 4.06 21H3v-1.06l4.44-4.44-3.105-3.104a1.25 1.25 0 0 1 .476-2.066l4.166-1.44a.75.75 0 0 0 .426-.373l2.435-4.87a2.75 2.75 0 0 1 4.405-.715Zm3.766 5.886-4.826-4.826a1.25 1.25 0 0 0-2.002.325l-2.435 4.871a2.25 2.25 0 0 1-1.278 1.12l-3.789 1.31 6.705 6.704 1.308-3.789a2.25 2.25 0 0 1 1.12-1.277l4.872-2.436a1.25 1.25 0 0 0 .325-2.002Z" fill="currentColor"/></svg>',twn='<svg viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M4 12.02c0 1.06.2 2.1.6 3.08l.6 1.42c.22.55.64 1.01 1.17 1.29.27.14.56.21.86.21h2.55c.77 0 1.49-.41 1.87-1.08.5-.87 1.02-1.7 1.72-2.43l1.32-1.39c.44-.46.97-.84 1.49-1.23l.59-.45a.6.6 0 0 0 .23-.47c0-.75-.54-1.57-1.22-1.79a3.34 3.34 0 0 0-2.78.29V4.5a1.5 1.5 0 0 0-2.05-1.4 1.5 1.5 0 0 0-2.9 0A1.5 1.5 0 0 0 6 4.5v.09A1.5 1.5 0 0 0 4 6v6.02ZM8 4.5v4a.5.5 0 0 0 1 0v-5a.5.5 0 0 1 1 0v5a.5.5 0 0 0 1 0v-4a.5.5 0 0 1 1 0v6a.5.5 0 0 0 .85.37h.01c.22-.22.44-.44.72-.58.7-.35 2.22-.57 2.4.5l-.53.4c-.52.4-1.04.78-1.48 1.24l-1.33 1.38c-.75.79-1.31 1.7-1.85 2.63-.21.36-.6.58-1.01.58H7.23a.87.87 0 0 1-.4-.1 1.55 1.55 0 0 1-.71-.78l-.59-1.42a7.09 7.09 0 0 1-.53-2.7V6a.5.5 0 0 1 1 0v3.5a.5.5 0 0 0 1 0v-5a.5.5 0 0 1 1 0Z" fill="currentColor"></path></svg>',fz=t=>{if(!t)return;if(!t.startsWith("<svg"))return new Promise(s=>{s(t)});const e=new Blob([t],{type:"image/svg+xml"}),n=new Image,r=window.URL.createObjectURL(e);return new Promise((s,i)=>{n.onload=()=>{s(n),window.URL.revokeObjectURL(r)},n.onerror=()=>{i(),window.URL.revokeObjectURL(r)},n.src=r})},wj={logs:"https://api.realtime.cloudflare.com/logs/otel/logs",mock:{url:"https://api.realtime.cloudflare.com/mock",domain:"mock.realtime.cloudflare.com",app:"https://examples.realtime.cloudflare.com/meeting",stagingApp:"https://examples.staging.realtime.cloudflare.com/meeting"},apiBase:{prod:"https://api.realtime.cloudflare.com",staging:"https://api.staging.realtime.cloudflare.com",prodAlternate:"https://api.realtime.cloudflare.com"},baseURI:{prod:"realtime.cloudflare.com",staging:"staging.realtime.cloudflare.com"}},nwn=/\b(?:1[7-9](?:\.\d+)?|[2-9]\d(?:\.\d+)?|[1-9]\d{2,}(?:\.\d+)?)\b/,gpt="__rtk_plugins__",rwn=[gpt];function vpt(t){var e,n,r;const s=typeof navigator<"u"&&!navigator.isReactNative&&typeof window<"u"&&((e=window.location.host)==null?void 0:e.includes(wj.baseURI.staging)),i=!!((r=(n=t==null?void 0:t.getValue("modules"))==null?void 0:n.devTools)!=null&&r.logs);return s||i}function swn(t,e){var n;const r=(n=t==null?void 0:t.getValue("telemetry"))==null?void 0:n.logLevel;if(r==="off")return!1;if(r!=="all"){const s=["debug","log","info","warn","error"],i=s.indexOf(e.toLowerCase()),o=s.indexOf(r);if(i<o)return!1}return!0}function ypt(t,e,n={}){return Object.getOwnPropertyNames(t).forEach(r=>{var s;if([null,void 0,NaN].includes(t[r])||e&&(((s=e.match(/\./g))==null?void 0:s.length)||0)>=10)return;const i=e?`${e}.${r}`:r;typeof t[r]=="object"?ypt(t[r],i,n):["number","string","boolean"].includes(typeof t[r])&&(n[i]=t[r])}),n}function R6e(t,e,n={},r=""){const s={};try{const i=JSON.stringify(n),o=JSON.parse(i),l=ypt(o,r),c=JSON.stringify(l);if(!(e!=null&&e.startsWith("[SDP]"))&&c.length>5e3){const d=`Log named: "${e}" is trying to log an flattened object of size 
			${c.length} chars that is beyond permitted limit of 5000 chars. Please optimize.`;throw vpt(t)&&console.error(d,{log:n,flattened:c}),new Error(d)}return JSON.parse(c)}catch(i){const o=FG(i);s[`${r}.error.message`]=o.message||"",s[`${r}.error.stack`]=o.stack||"",s[`${r}.error.reason`]=o.reason||"",s[`${r}.error.source`]="safelyFlattenObjForOpenTelemetry"}return s}let ut=class{constructor(){xe(this,"logsCache",[]),xe(this,"logsProcessorTimer"),xe(this,"compressionSupported",null),xe(this,"tracingEnabled",!0),xe(this,"initialized",!1),xe(this,"logLevel","log"),xe(this,"logsProcessingInterval",7e3),xe(this,"logExclusionList",["message","websocket/message","roomMessage","websocket/room-message","websocket/room-legacy-mode","chatMessage","websocket/new-chat-message","websocket/no-active-speaker","websocket/selected-peers","websocket/active-speaker","ping","websocket/new-consumer","websocket/producer-score","websocket/consumer-score","websocket/plugin-event","websocket/plugin-data","websocket/plugin-internal-data"]),xe(this,"meetingMetadata",{})}isCompressionSupported(){if(this.compressionSupported===null)try{this.compressionSupported=typeof CompressionStream<"u"&&typeof Blob<"u"&&typeof Blob.prototype.stream=="function"&&typeof Response<"u"}catch(e){this.compressionSupported=!1,this.addLogInCurrentSpan("warn","Compression feature detection failed, using uncompressed logs",{error:e})}return this.compressionSupported}get logsEndpoint(){const e=nk.getContext(this.meetingMetadata.peerId);return`https://${GA({servicePrefix:"api-silos",baseURI:e.getValue("baseURI")})}/otel/logs`}get logsBatchSize(){return this.isCompressionSupported()?50:25}resetPeerId(e){this.meetingMetadata.peerId=e}init(e,n,r,s){this.tracingEnabled=!0,this.initialized=!1,s&&(this.logLevel=s),this.logsCache=[];const i=e.getValue("peerId");this.meetingMetadata=n,this.tracingEnabled=r,this.meetingMetadata.peerId=i,this.meetingMetadata.sdkVersion=e.getValue("sdkVersion");const{RNDeviceInfoImpl:o}=navigator;this.meetingMetadata.deviceInfo=navigator.isReactNative?o==null?void 0:o.getDeviceInfo():so.getDeviceInfo(),this.meetingMetadata.visitedUrl=!navigator.isReactNative&&typeof window<"u"&&window.location.href,this.logsProcessorTimer=setInterval(()=>this.processCachedLogs().catch(()=>{}),this.logsProcessingInterval),r&&(this.initialized=!0)}static trace(e,n=void 0){return(r,s,i)=>{const o=i.value;return i.value=function(...l){const c=this==null?void 0:this.telemetry;if(!c||!c.initialized||navigator.isReactNative||!c.tracingEnabled)return o.apply(this,l);c.addLogInCurrentSpan("info",e,n);const d=performance.now(),u=o.apply(this,l);return Promise.resolve(u).then(()=>{const h=performance.now();h-d>10&&c.addLogInCurrentSpan("info",`${e}_timing`,{execTime:h-d})}).catch(()=>{const h=performance.now();c.addLogInCurrentSpan("info",`${e}_timing`,{execTime:h-d})}),u},i}}injectContext(e){var n;const r=pR().replace(/-/g,"").substring(0,16),s=(n=this.meetingMetadata.peerId)==null?void 0:n.replace(/-/g,"");e.TRACEPARENT=`00-${s}-${r}-01`}addLogInCurrentSpan(e,n,r={},s=!1){r!=null&&r.error&&Object.assign(r,{error:FG(r.error)});const i=nk.getContext(this.meetingMetadata.peerId);if(vpt(i)&&(U0n(r)?console[e]("InternalLogs:: ",e,n):console[e]("InternalLogs:: ",e,n,r)),!!swn(i,e))try{const o=R6e(i,n,r,"metadata"),l=new Date,c=Dr(en({message:n,level:e},o),{loggedAt:l.toISOString(),loggedAtTzOffset:l.getTimezoneOffset()});s?this.sendOtelLogsToNewRelic([c],{isInDestructionMode:!1}).catch(()=>{}):this.logsCache.push(c)}catch(o){this.addLogInCurrentSpan("error","opentelemetry::addLogInCurrentSpan_failed",{error:FG(o)})}}sendOtelLogsToNewRelic(e){return me(this,arguments,function*(n,{isInDestructionMode:r=!1}={isInDestructionMode:!1}){const s=new AbortController,i=setTimeout(()=>s.abort("Logs request timed out after 8 seconds"),8e3);try{const o=nk.getContext(this.meetingMetadata.peerId),l=JSON.stringify({meetingMetadata:R6e(o,"sendOtelLogsToNewRelic",this.meetingMetadata,"meetingMetadata"),serviceName:o.getValue("sdkName"),logs:n});let c;const d={Authorization:`Bearer ${o.getValue("authToken")}`};if(this.isCompressionSupported()){const u=new Blob([l]).stream().pipeThrough(new CompressionStream("gzip"));c=yield new Response(u).arrayBuffer(),d["Content-Type"]="application/gzip",d["Content-Encoding"]="gzip"}else c=l,d["Content-Type"]="application/json";yield fetch(this.logsEndpoint,{method:"POST",headers:d,body:c,signal:s.signal,keepalive:!!r})}catch(o){r||(this.addLogInCurrentSpan("error","opentelemetry::sendOtelLogToNewRelic_failed",{error:FG(o)}),this.logsCache.push(...n))}finally{clearTimeout(i)}})}processCachedLogs(){return me(this,arguments,function*({isInDestructionMode:e=!1}={isInDestructionMode:!1}){const n=this.logsCache.splice(0,this.logsBatchSize);n!=null&&n.length&&(yield this.sendOtelLogsToNewRelic(n,{isInDestructionMode:e}))})}destruct(){return me(this,null,function*(){for(clearInterval(this.logsProcessorTimer);this.logsCache.length;)yield this.processCachedLogs({isInDestructionMode:!0})})}};function iwn(t){const e=en({},t),n=new Map,r=(o,l)=>(n.has(o)||n.set(o,new Set),n.get(o).add(l),()=>{var c;return(c=n.get(o))==null?void 0:c.delete(l)}),s=(o,l)=>{var c;(c=n.get(o))==null||c.delete(l)},i=o=>{var l;(l=n.get(o))==null||l.forEach(c=>{try{c(e[o])}catch{}})};return{subscribe:r,unsubscribe:s,notify:i,setValue:(o,l,c=!0)=>{e[o]=l,c&&i(o)},getValue:o=>e[o],getAllValues:()=>e}}class awn{constructor(){xe(this,"contexts",new Map),xe(this,"mostRecentPeerId",null)}createContext(e,n){if(this.contexts.has(e))return this.contexts.get(e);const r=new ut,s=new Ypn;this.contexts.set(e,iwn(n)),this.contexts.get(e).setValue("peerSessionStore",new Qpn(s));const i=new $ft;return i.setMaxListeners(50),this.contexts.get(e).setValue("logger",s),this.contexts.get(e).setValue("telemetry",r),this.contexts.get(e).setValue("callstats",i),this.mostRecentPeerId=e,this.contexts.get(e)}remapContext(e,n){const r=n.getValue("peerId");r!==e&&(n.setValue("peerId",e),this.mostRecentPeerId=e,this.contexts.set(e,n),this.contexts.delete(r))}getContext(e){return this.contexts.get(e)}getMostRecentPeerId(){return this.mostRecentPeerId}}const nk=new awn,own={"00":"Client","01":"Controller","02":"RoomNodeClient","03":"HiveNodeClient","04":"SocketService","05":"Chat","06":"Plugin","07":"Polls","08":"Meta","09":"Preset",10:"Recording",11:"Self",12:"Participant",13:"Spotlight",14:"Remote Request",15:"Webinar",16:"LocalMediaHandler",17:"End-End Encryption",18:"AI",19:"Livestream",20:"Stage"},BG={"0000":"Internal exception.","0001":"Failed to initialize.","0002":"Failed to join room.","0003":"Failed to leave room.","0004":"Invalid auth token","0010":"Browser not supported","0011":"HTTP Network Error","0012":"Websocket Network Error","0013":"Rate Limited","0014":"Failed to establish media connection.","0100":"Internal exception","0101":"Permission denied","0102":"Prerequisite module missing","0200":"Internal exception.","0300":"Internal exception","0400":"Internal exception","0404":"Missing prerequisites to establish a websocket connection","0500":"Internal exception","0501":"Permission denied.","0502":"Invalid message body.","0503":"Text Message is too large","0504":"Message not found by the given id","0505":"Action not permitted without joining room","0506":"Message search is disabled","0600":"Internal exception","0601":"Permission denied.","0602":"Auth token not set for plugin","0603":"Iframe was not provided","0700":"Internal exception","0705":"Action not permitted without joining room","0800":"Internal exception","0801":"Permission denied","0900":"Internal exception","0904":"Could not load preset",1e3:"Internal exception",1001:"Permission denied",1004:"Could not find specified recording",1005:"Action not permitted in given recording state",1100:"Internal exception",1101:"Permission denied",1102:"Unsupported",1103:"Name cannot be empty",1104:"No device selected while calling meeting.self.setDevice",1105:"Action not permitted without joining room",1106:"Can't set currently used device",1200:"Internal exception",1201:"Permission denied",1202:"Invalid page number was requested",1203:"Invalid participant count per page was requested",1204:"No participants exists with the given UserIds",1205:"Action not permitted without joining room",1206:"Manual Subscription Mode was not ACTIVATED",1207:"Invalid view mode",1208:"Manual Subscription not enabled for organization",1209:"Broadcast message type must be a non-empty string",1300:"Internal exception",1400:"Internal exception",1402:"No existing remote requests",1403:"No peer exists with given id",1500:"Internal exception",1600:"Internal exception",1601:"Failed to get audio track",1602:"Failed to get video track",1603:"Incorrect device",1604:"Failed to change device",1605:"Failed to get audio & video track",1606:"No audio input devices are available",1607:"No video input devices are available",1608:"No audio output devices (speakers) are available",1609:"Failed to fetch list of media devices",1610:"No media track exists",1611:"Failed to unmute track",1612:"Failed to get screenshare tracks",1701:"Crypto error",1800:"Internal exception",1801:"Can't fetch transcript file",1900:"Internal exception",1901:"Permission denied.",1902:"Livestream that has not yet started, can't be stopped",2e3:"Internal exception",2001:"Permission denied",2002:"Unsupported",2003:"Stage is disabled",2004:"Method not implemented",2005:"Action not permitted without joining room",2006:"Action not permitted in current stage status",9900:"Internal exception"};Object.keys(BG).forEach(t=>{BG[t]=`{${own[t.slice(0,2)]}} ${BG[t]}`});class _t extends Error{constructor(e,n,r=void 0,s=!1){super(e),xe(this,"code"),this.code=n,this.name="ClientError";const i=this.code?`[ERR${this.code}]`:"[ERR]",o=this.code?BG[this.code]:"";this.message=`${i}: ${o}
${this.message}`;try{let l=s&&!!r;n&&n.endsWith("00")&&r&&(l=!0),l&&r.error("ClientError",{error:{message:this.message,name:this.name,code:n}});const c=nk.getContext(nk.getMostRecentPeerId());if(c){const d=c.getValue("onError");try{d(this)}catch{}}typeof window<"u"&&window.dispatchEvent(new CustomEvent("ClientError",{detail:this}))}catch{}}}function pz(t,e,n,r){if(r instanceof _t)throw r;if(r instanceof e){const s=new _t(r.message,n);throw s.stack=r.stack,s}else throw r}function I6e(t,e,n){if(!t.value){const s=t.get,i=t.set;return s&&(t.get=function(){try{return s.apply(this)}catch(o){pz(this,e,n,o)}}),i&&(t.set=function(o){try{return i.apply(this,[o])}catch(l){pz(this,e,n,l)}}),t}const r=t.value;return t.value=function(...s){try{const i=r.apply(this,s);return i&&i instanceof Promise?i.catch(o=>{pz(this,e,n,o)}):i}catch(i){pz(this,e,n,i)}},t}function lwn(t,e){return(n,r,s)=>{if(s)return I6e(s,t,e);for(const i of Reflect.ownKeys(n.prototype).filter(o=>o!=="constructor")){const o=Object.getOwnPropertyDescriptor(n.prototype,i);(o.value instanceof Function||o.get instanceof Function||o.set instanceof Function)&&Object.defineProperty(n.prototype,i,I6e(o,t,e))}}}const tu=t=>lwn(Error,t);var Sx=(t=>(t.GroupCall="GROUP_CALL",t.Webinar="WEBINAR",t.AudioRoom="AUDIO_ROOM",t.Livestream="LIVESTREAM",t.Chat="CHAT",t))(Sx||{}),Hr=(t=>(t.Allowed="ALLOWED",t.NotAllowed="NOT_ALLOWED",t.CanRequest="CAN_REQUEST",t))(Hr||{}),M6e;typeof process<"u"&&(M6e=process==null?void 0:KOe)!=null&&M6e.FLAGSMITH_ENVIRONMENT_KEY&&KOe.FLAGSMITH_ENVIRONMENT_KEY;var bpt=[-2,-1,0,1,2],cwn=[0,1,2,3,4];function dwn(t){t=t.trim();let e="0",n="0",r="0";return t.length==4?(e=`0x${t[1]}${t[1]}`,n=`0x${t[2]}${t[2]}`,r=`0x${t[3]}${t[3]}`):t.length>6&&(e=`0x${t[1]}${t[2]}`,n=`0x${t[3]}${t[4]}`,r=`0x${t[5]}${t[6]}`),[+e,+n,+r]}var uwn=(t,e,n)=>{let r,s,i;if(e==0)r=s=i=n;else{const o=(d,u,h)=>(h<0&&(h+=1),h>1&&(h-=1),h<.16666666666666666?d+(u-d)*6*h:h<.5?u:h<.6666666666666666?d+(u-d)*(.6666666666666666-h)*6:d),l=n<.5?n*(1+e):n+e-n*e,c=2*n-l;r=o(c,l,t+1/3),s=o(c,l,t),i=o(c,l,t-1/3)}return[Math.round(r*255),Math.round(s*255),Math.round(i*255)]},hwn=(t,e,n)=>{t/=255,e/=255,n/=255;const r=Math.max(t,e,n),s=Math.min(t,e,n);let i,o;const l=(r+s)/2;if(r==s)i=o=0;else{const c=r-s;switch(o=l>.5?c/(2-r-s):c/(r+s),r){case t:i=(e-n)/c+(e<n?6:0);break;case e:i=(n-t)/c+2;break;case n:i=(t-e)/c+4;break}i/=6}return[i,o,l]},mwn=(t,e,n)=>{const r=s=>s.toString(16).padStart(2,"0");return`#${r(t)}${r(e)}${r(n)}`},xpt=(t,e=bpt,n=.4)=>{const r=[],[s,i,o]=dwn(t),[l,c,d]=hwn(s,i,o),u=Math.round(d*100);u>70?n=.8:u>60?n=.9:u<10?n=.075:u<42&&(n=.3);const h=e.findIndex(v=>v===0);if(h===-1)throw new Error("Invalid reducer provided, it must contain atleast one zero");const m=5-h,f=h+1,p=(100-u)/m,g=u/f;for(const v of e){let b;v<0?b=u+v*g*n:v>0?b=u+v*p*n:b=u;const[x,w,k]=uwn(l,c,b/100);r.push(mwn(x,w,k))}return r},fwn=t=>{const[e,n,r,s,i]=xpt(t,bpt);return{300:e,400:n,500:r,600:s,700:i}},pwn=t=>{const[e,n,r,s,i]=xpt(t,cwn);return{1e3:e,900:n,800:r,700:s,600:i}},gwn={border_radius:"rounded",border_width:"thin",spacing_base:4,theme:"dark",colors:{brand:fwn("#2160FD"),background:pwn("#141414"),danger:"#FF2D2D",text:"#EEEEEE",text_on_brand:"#EEEEEE",success:"#62A504",video_bg:"#191919",warning:"#FFCD07"}};function wpt(){return nEe(gwn)}var vwn={permissions:{can_accept_production_requests:!1,can_edit_display_name:!0,accept_waiting_requests:!1,disable_participant_audio:!1,disable_participant_screensharing:!1,disable_participant_video:!1,can_spotlight:!1,kick_participant:!1,pin_participant:!1,can_record:!1,can_livestream:!1,waiting_room_type:"SKIP",plugins:{can_close:!0,can_start:!0,can_edit_config:!1,config:{}},polls:{can_create:!0,can_vote:!0,can_view:!0},media:{video:{can_produce:"ALLOWED",can_consume:"ALLOWED"},audio:{can_produce:"ALLOWED"},screenshare:{can_produce:"ALLOWED",can_consume:"ALLOWED"}},chat:{public:{can_send:!0,text:!0,files:!0},private:{can_send:!1,can_receive:!1,text:!1,files:!1},channel:{can_create:"ALL",can_delete:"ALL",can_update:"ALL",can_read_all:!1},message:{can_delete:"ALL",can_edit:"ALL",delete_cutoff_time_seconds:0,edit_cutoff_time_seconds:0}},hidden_participant:!1,is_recorder:!1,recorder_type:"NONE",show_participant_list:!0,transcription_enabled:!1,can_change_participant_permissions:!1,connected_meetings:{can_alter_connected_meetings:!1,can_switch_connected_meetings:!1,can_switch_to_parent_meeting:!1},stage_enabled:!1,stage_access:void 0,accept_stage_requests:!1},ui:{oldTheme:{setup_screen:{is_enabled:!1},alone_here:{is_enabled:!1},waiting_room:{is_enabled:!1,enable_preview:!0},control_bar:{is_enabled:!0,elements:{plugins:!0,screenshare:!0,invite:!1,participants:!0,chat:!0,reactions:!1,polls:!0,fullscreen:!0,layout:!0}},header:{is_enabled:!0,elements:{timer:!0,title:!0,participant_count:!0,change_layout:!0}},pip_mode:!0,auto_tune:!0,colors:{primary:"#2160FD",secondary:"#1A1A1A",text:"#EEEEEE",background:"#1A1A1A",textPrimary:"#EEEEEE",videoBackground:"#1A1A1A"},dimensions:{mode:"fillParent"},grid:{multi:{maxVideoCount:6,videoFit:"cover"},single:{maxVideoCount:6,videoFit:"cover"},defaultView:"MULTI"},controls:{pip_toggle:!1},plugins:[]},design_tokens:wpt(),config_diff:{}},config:{view_type:"GROUP_CALL",media:{audio:{enable_stereo:!1,enable_high_bitrate:!1},video:{quality:"vga",frame_rate:30,simulcast:!1},screenshare:{quality:"hd",frame_rate:5}},max_video_streams:{mobile:6,desktop:6},max_screenshare_count:1,track_recording:{subscriptions:[]}},version:"hybrid"};function ywn(){return nEe(vwn)}var bwn={permissions:{can_accept_production_requests:!1,can_edit_display_name:!0,accept_waiting_requests:!1,disable_participant_audio:!1,disable_participant_screensharing:!1,disable_participant_video:!1,can_spotlight:!1,kick_participant:!1,pin_participant:!1,can_record:!1,can_livestream:!1,waiting_room_type:"SKIP",plugins:{can_close:!0,can_start:!0,can_edit_config:!1,config:{}},polls:{can_create:!0,can_vote:!0,can_view:!0},media:{video:{can_produce:"ALLOWED"},audio:{can_produce:"ALLOWED"},screenshare:{can_produce:"ALLOWED"}},chat:{public:{can_send:!0,text:!0,files:!0},private:{can_send:!1,can_receive:!1,text:!1,files:!1}},hidden_participant:!1,is_recorder:!1,recorder_type:"NONE",show_participant_list:!0,transcription_enabled:!1,can_change_participant_permissions:!1,connected_meetings:{can_alter_connected_meetings:!1,can_switch_connected_meetings:!1,can_switch_to_parent_meeting:!1},stage_enabled:!1,stage_access:void 0,accept_stage_requests:!1},ui:{design_tokens:wpt(),config_diff:{}},config:{view_type:"GROUP_CALL",media:{audio:{enable_stereo:!1,enable_high_bitrate:!1},video:{quality:"vga",frame_rate:30,simulcast:!1},screenshare:{quality:"hd",frame_rate:5}},max_video_streams:{mobile:6,desktop:6},max_screenshare_count:1,track_recording:{subscriptions:[]}},version:"2.0.0"};function iEe(){return nEe(bwn)}function xwn(){so.isElectron()&&window.electronGetDisplayMediaSource&&(navigator.mediaDevices.getDisplayMedia=()=>me(this,null,function*(){const t=yield window.electronGetDisplayMediaSource({types:["window","screen"]});let e=[];if(t&&(Array.isArray(t)?e=t:e=[t]),!(e!=null&&e.length))throw new Error("Couldn't find any media source for screen share.");let n=e.find(s=>{var i;return(i=s.id)==null?void 0:i.includes("screen")});n=n??e[0];const r={audio:!1,video:{mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:n.id}}};return yield navigator.mediaDevices.getUserMedia(r)}))}var Et=(t=>(t.NEW_PRODUCER="NEW_PRODUCER",t.ROOM_NODE_CONNECTION_ERROR="ROOM_NODE_CONNECTION_ERROR",t.SOCKET_SERVICE_ROOM_JOINED="SOCKET_SERVICE_ROOM_JOINED",t.SOCKET_SERVICE_RECONNECTED="SOCKET_SERVICE_RECONNECTED",t.SOCKET_SERVICE_DISCONNECTED="SOCKET_SERVICE_DISCONNECTED",t.SOCKET_SERVICE_FAILED="SOCKET_SERVICE_FAILED",t.SOCKET_STATE_UPDATE="SOCKET_STATE_UPDATE",t.ROOM_NODE_RECONNECTED="ROOM_NODE_RECONNECTED",t.ROOM_NODE_DISCONNECTED="ROOM_NODE_DISCONNECTED",t.ROOM_NODE_FAILED="ROOM_NODE_FAILED",t.TRANSPORT_STATE_UPDATE="TRANSPORT_STATE_UPDATE",t.PRODUCER_SCORE_UPDATE="PRODUCER_SCORE_UPDATE",t.CONSUMER_SCORE_UPDATE="CONSUMER_SCORE_UPDATE",t.PRODUCER_STATUS_UPDATE="PRODUCER_STATUS_UPDATE",t.CONSUMER_STATUS_UPDATE="CONSUMER_STATUS_UPDATE",t.LOW_CONSUMER_SCORE="LOW_CONSUMER_SCORE",t.MEDIA_PERMISSION_ERROR="MEDIA_PERMISSION_ERROR",t.MEDIA_PERMISSION_UPDATE="MEDIA_PERMISSION_UPDATE",t.MESSAGE="websocket/message",t.ROOM_MESSAGE="websocket/room-message",t.PEER_JOINED_INTERNAL="peer/joined-internal",t.PEER_CLOSED="websocket/peer-closed",t.CONSUMER_CLOSED="websocket/consumer-closed",t.CONSUMER_PAUSED="websocket/consumer-paused",t.CONSUMER_RESUMED="websocket/consumer-resumed",t.PRODUCER_CLOSED="websocket/producer-closed",t.NEW_CONSUMER="websocket/new-consumer",t.PRODUCER_SCORE="websocket/producer-score",t.CONSUMER_SCORE="websocket/consumer-score",t.PRODUCER_TOGGLE="cf/producer-toggle",t.UPDATE_ACTIVE="media/update-active",t.RESET_PRODUCER_STATE="cf/reset-producer-state",t.ROOM_STATE="sockethub/room-state",t.GET_STAGE_REQUESTS="GET_STAGE_REQUESTS",t.UPDATE_STAGE_REQUESTS="UPDATE_STAGE_REQUESTS",t.KICK_PEER="KICK_PEER",t.UPDATE_PEER_STAGE_STATUS="UPDATE_PEER_STAGE_STATUS",t.JOIN_MEDIA_ROOM="JOIN_MEDIA_ROOM",t.LEAVE_MEDIA_ROOM="LEAVE_MEDIA_ROOM",t.PIP_HANGUP="PIP_HANGUP",t.E2EE_ACTIVE_PRODUCER="E2EE_ACTIVE_PRODUCER",t.E2EE_INACTIVE_PRODUCER="E2EE_INACTIVE_PRODUCER",t.E2EE_ACTIVE_CONSUMER="E2EE_ACTIVE_CONSUMER",t.E2EE_INACTIVE_CONSUMER="E2EE_INACTIVE_CONSUMER",t.SOCKET_PEERS="SOCKET_PEERS",t.UPDATE_PERMISSIONS="UPDATE_PERMISSIONS",t.MAX_SPATIAL_LAYER_CHANGE="MAX_SPATIAL_LAYER_CHANGE",t.MUTE_SELF="MUTE_SELF",t.MUTE_SELF_VIDEO="MUTE_SELF_VIDEO",t))(Et||{});class jI extends Zd.EventEmitter{constructor(e){super(),xe(this,"logger"),this.logger=e,super.setMaxListeners(25)}emit(e,...n){return super.emit("*",e,...n),super.emit(e,...n)}on(e,n){var r;try{const s=this.listenerCount(e);s>25&&s%25===0&&((r=this.logger)==null||r.warn("CustomEventEmitter::maxListenersExceeded",{eventListener:{eventName:e.toString(),listenerCount:this.listenerCount(e)}}))}catch{}return super.on(e,n)}addListener(e,n){var r;try{const s=this.listenerCount(e);s>25&&s%25===0&&((r=this.logger)==null||r.warn("CustomEventEmitter::maxListenersExceeded",{eventListener:{eventName:e.toString(),listenerCount:this.listenerCount(e)}}))}catch{}return super.addListener(e,n)}off(e,n){return super.off(e,n)}once(e,n){return super.once(e,n)}prependListener(e,n){return super.prependListener(e,n)}prependOnceListener(e,n){return super.prependOnceListener(e,n)}removeListener(e,n){return super.removeListener(e,n)}removeAllListeners(e){return super.removeAllListeners(e)}listeners(e){return super.listeners(e)}listenerCount(e){return super.listenerCount(e)}}let Dm=class extends Zd.EventEmitter{constructor(e){super(),xe(this,"logger"),this.logger=e,super.setMaxListeners(25)}emit(e,...n){return super.emit("*",e,...n),super.emit(e,...n)}on(e,n){var r;try{const s=this.listenerCount(e);s>25&&s%25===0&&((r=this.logger)==null||r.warn("CustomEventEmitter::maxListenersExceeded",{eventListener:{eventName:e.toString(),listenerCount:this.listenerCount(e)}}))}catch{}return super.on(e,n)}addListener(e,n){var r;try{const s=this.listenerCount(e);s>25&&s%25===0&&((r=this.logger)==null||r.warn("CustomEventEmitter::maxListenersExceeded",{eventListener:{eventName:e.toString(),listenerCount:this.listenerCount(e)}}))}catch{}return super.addListener(e,n)}off(e,n){return super.off(e,n)}once(e,n){return super.once(e,n)}prependListener(e,n){return super.prependListener(e,n)}prependOnceListener(e,n){return super.prependOnceListener(e,n)}removeListener(e,n){return super.removeListener(e,n)}removeAllListeners(e){return super.removeAllListeners(e)}listeners(e){return super.listeners(e)}listenerCount(e){return super.listenerCount(e)}};function wwn(t,e=2){return t.replace(/[^\u00BF-\u1FFF\u2C00-\uD7FF\w\s]/g,"").trim().split(/\s+/).slice(0,e).map(n=>n.charAt(0)).join("").toUpperCase()}const L6e=1080,D6e=1920,kwn=(t,e,n,r,s,i)=>{let o=.5,l=.5;const c=s,d=i,u=Math.min(n/c,r/d);let h=c*u,m=d*u,f,p,g,v,b=1;return h<n&&(b=n/h),Math.abs(b-1)<1e-14&&m<r&&(b=r/m),h*=b,m*=b,g=c/(h/n),v=d/(m/r),f=(c-g)*o,p=(d-v)*l,f<0&&(f=0),p<0&&(p=0),g>c&&(g=c),v>d&&(v=d),[f,p,g,v,t,e,n,r]};var Ep,t_,lu,Np,ul,Sv,Ew,qu,Ul,y4,b4,Nw,x4;const kpt=class extends Dm{constructor(t,e,n,r){const s=t.getValue("logger");super(s),Se(this,Ep,void 0),Se(this,t_,void 0),Se(this,lu,void 0),Se(this,Np,void 0),Se(this,ul,{height:L6e,width:D6e}),Se(this,Sv,{brand:"#2160FD",background:"#141414",text:"#000000",videoBackground:"#191919",textOnBrand:"#EEEEEE"}),Se(this,Ew,void 0),Se(this,qu,{}),Se(this,Ul,void 0),Se(this,y4,void 0),Se(this,b4,void 0),Se(this,Nw,void 0),Se(this,x4,!1),xe(this,"cleanupEventListeners",()=>{L(this,t_).unsubscribe("stageStatus",this.handlePipMediaControls),L(this,Ul).removeListener("videoUpdate",this.onSelfVideoUpdateListener),L(this,Ul).removeListener("audioUpdate",this.onSelfAudioUpdateListener),L(this,Ul).removeListener("roomLeft",()=>this.disable())}),xe(this,"enablePipMediaControls",()=>{this.mountAudioEvents(),this.mountVideoEvents()}),xe(this,"onSelfVideoUpdateListener",({videoEnabled:i})=>{this.updateMediaSession("CAMERA",i)}),xe(this,"onSelfAudioUpdateListener",({audioEnabled:i})=>{this.updateMediaSession("MIC",i)}),xe(this,"handlePipMediaControls",i=>{i==="ON_STAGE"?this.enablePipMediaControls():this.unmountEvents()}),xe(this,"eventCallback",i=>{i==="CAMERA"&&(L(this,Ul).videoEnabled?L(this,Ul).disableVideo():L(this,Ul).enableVideo(),this.emit("cameraToggled")),i==="MIC"&&(L(this,Ul).audioEnabled?L(this,Ul).disableAudio():L(this,Ul).enableAudio(),this.emit("micToggled")),i==="END"&&(L(this,t_).getValue("peerSessionStore").emit(Et.PIP_HANGUP),this.cleanupEventListeners(),this.emit("hangup"),this.cleanup())}),xe(this,"unmountEvents",()=>{navigator.mediaSession===void 0||navigator.mediaSession.setCameraActive===void 0||(navigator.mediaSession.setActionHandler("togglemicrophone",void 0),navigator.mediaSession.setActionHandler("togglecamera",void 0))}),xe(this,"animate",()=>{if(!this.isActive&&L(this,Nw)==="active"){this.disable(!0);return}L(this,qu)!==void 0&&this.paintCanvas(),L(this,Ew)!==void 0&&Te(this,Ew,requestAnimationFrame(()=>this.animate()))}),xe(this,"disable",(i=!1)=>{Te(this,Nw,"idle"),this.cleanupEventListeners(),cancelAnimationFrame(L(this,Ew)),i!==!0&&document.body.removeChild(L(this,lu)),Te(this,Ew,void 0),document.pictureInPictureElement&&document.exitPictureInPicture()}),Te(this,t_,t),Te(this,Nw,"idle"),Te(this,Ul,e),Te(this,Sv,{brand:e.config.designTokens.colors.brand[500],background:e.config.designTokens.colors.background[1e3],text:e.config.designTokens.colors.text,videoBackground:e.config.designTokens.colors.videoBg,textOnBrand:e.config.designTokens.colors.textOnBrand}),n&&this.setupIcon("pin",n),r&&this.setupIcon("handRaise",r)}static _init(t,e){return me(this,null,function*(){let n,r;try{n=yield fz(ewn),r=yield fz(twn)}catch{}return new kpt(t,e,n,r)})}setupIcon(t,e){return me(this,null,function*(){switch(t){case"handRaise":Te(this,b4,e);break;case"pin":Te(this,y4,e);break}})}overrideIcon(t,e){return me(this,null,function*(){switch(t){case"handRaise":Te(this,b4,yield fz(e));break;case"pin":Te(this,y4,yield fz(e));break}})}constructImage(t){const e=new Image,n=new Blob([t],{type:"image/svg+xml"}),r=window.URL.createObjectURL(n);return new Promise(s=>{e.onload=()=>{s(e),window.URL.revokeObjectURL(r)},e.src=r})}createVideoContainer(){Te(this,lu,document.createElement("div")),L(this,lu).style.width="0.1px",L(this,lu).style.height="0.1px",L(this,lu).style.overflow="hidden",L(this,lu).style.position="absolute",L(this,lu).style.bottom="0",L(this,lu).style.right="0",L(this,lu).style.opacity="0",L(this,lu).appendChild(L(this,Np))}setupEventListeners(){L(this,t_).subscribe("stageStatus",this.handlePipMediaControls),L(this,Ul).addListener("videoUpdate",this.onSelfVideoUpdateListener),L(this,Ul).addListener("audioUpdate",this.onSelfAudioUpdateListener),L(this,Ul).addListener("roomLeft",()=>this.disable())}createCanvas(){const t=document.createElement("canvas");t.height=L(this,ul).height,t.width=L(this,ul).width,Te(this,Ep,t)}setupMediaSessionEvents(){navigator.mediaSession===void 0||navigator.mediaSession.setCameraActive===void 0||(navigator.mediaSession.setActionHandler("hangup",()=>{this.eventCallback("END")}),this.mountAudioEvents(),this.mountVideoEvents())}mountAudioEvents(){navigator.mediaSession===void 0||navigator.mediaSession.setMicrophoneActive===void 0||L(this,Ul).permissions.canProduceAudio&&navigator.mediaSession.setActionHandler("togglemicrophone",()=>{this.eventCallback("MIC")})}mountVideoEvents(){navigator.mediaSession===void 0||navigator.mediaSession.setCameraActive===void 0||L(this,Ul).permissions.canProduceVideo&&navigator.mediaSession.setActionHandler("togglecamera",()=>{this.eventCallback("CAMERA")})}getSources(){const t=Object.values(L(this,qu)).reduce((e,n)=>(e[n.pinned?"pinned":"regular"].push(n),e),{pinned:[],regular:[]});return[...t.pinned,...t.regular]}drawEmptyTile(t,e,n,r){if(L(this,Ep)===void 0)return;const s=L(this,Ep).getContext("2d"),i=L(this,Ep).width,o=0,l=0,c=e-o*2,d=n-o*2,u=Math.floor(i/c),h=Math.floor(t/u),m=t%u*(c+o)+o,f=h*(d+o)+o,{displayText:p,image:g}=r??{};s.fillStyle=p||g?L(this,Sv).videoBackground:L(this,Sv).background,s.strokeStyle=L(this,Sv).brand,s.beginPath(),s.moveTo(m+l,f),s.arcTo(m+c,f,m+c,f+l,l),s.arcTo(m+c,f+d,m+c-l,f+d,l),s.arcTo(m,f+d,m,f+d-l,l),s.arcTo(m,f,m+l,f,l),s.closePath(),s.fill(),s.stroke();const v=c/6,b=c/2+m,x=d/2+f;s.save(),(p||g)&&(s.beginPath(),s.arc(b,x,v,0,Math.PI*2),s.fillStyle=L(this,Sv).brand,s.fill(),g?(s.clip(),s.drawImage(g,b-v,x-v,v*2,v*2),s.restore()):p&&(s.fillStyle=L(this,Sv).textOnBrand,s.font=`${v/2}px sans-serif`,s.textAlign="center",s.textBaseline="middle",s.fillText(p,b,x)),this.drawIcons(r,m,f,Math.max(c,d)))}drawIcons(t,e,n,r){const s=Math.min(Math.max(r*.15,100),200),i=s*.2,o=s*.2;let l=e+i;const c=n+i,d=u=>{const h=L(this,Ep).getContext("2d");h.save(),h.fillStyle=L(this,Sv).background,h.beginPath(),h.moveTo(l+o,c),h.arcTo(l+s,c,l+s,c+o,o),h.arcTo(l+s,c+s,l+s-o,c+s,o),h.arcTo(l,c+s,l,c+s-o,o),h.arcTo(l,c,l+o,c,o),h.closePath(),h.fill(),typeof u=="string"?(h.font=`${s/1.5}px sans-serif`,h.fillStyle=L(this,Sv).text,h.textAlign="center",h.textBaseline="top",h.fillText(u,s/2+l,c+i)):h.drawImage(u,l+i,c+i,s-i*2,s-i*2),l+=s+i,h.restore()};t.pinned&&d(L(this,y4)),t.handRaised&&d(L(this,b4)),t.reaction&&d(t.reaction)}drawTile(t,e,n){var r,s;if(L(this,Ep)===void 0)return;const i=L(this,Ep).getContext("2d"),o=this.getSources();let l=0,c=0;for(;l<L(this,ul).height-5;){let d=0;for(;d<L(this,ul).width-5&&c<n;){if((r=o[c])!=null&&r.enabled){const u=o[c].element,[h,m,f,p,g,v,b,x]=kwn(d,l,t,e,u.videoWidth,u.videoHeight);(s=u==null?void 0:u.classList)!=null&&s.contains("mirror")?(i.save(),i.scale(-1,1),i.drawImage(u,h,m,f,p,-1*g,v,-1*b,x),i.restore()):i.drawImage(u,h,m,f,p,g,v,b,x),this.drawIcons(o[c],g,v,Math.max(b,x))}else this.drawEmptyTile(c,t,e,o[c]);c+=1,d+=t}l+=e}}calcGridElemSize(t){switch(t){case 0:case 1:return[L(this,ul).width,L(this,ul).height];case 2:return[Math.floor(L(this,ul).width/2),L(this,ul).height];case 3:case 4:return[Math.floor(L(this,ul).width/2),Math.floor(L(this,ul).height/2)];case 5:case 6:return[Math.floor(L(this,ul).width/3),Math.floor(L(this,ul).height/2)];case 7:case 8:case 9:return[Math.floor(L(this,ul).width/3),Math.floor(L(this,ul).height/3)];default:return[Math.floor(L(this,ul).width/3),Math.floor(L(this,ul).height/2)]}}paintCanvas(){let t=this.getSources().length;t!==1&&(t=t%2>0?t+1:t);const[e,n]=this.calcGridElemSize(t);this.drawTile(e,n,t)}isSupported(){var t;return!!window.chrome&&document.pictureInPictureEnabled&&((t=L(this,Ul).config)==null?void 0:t.viewType)!=="LIVESTREAM"}get isActive(){return document.pictureInPictureElement!==null}cleanup(){if(Te(this,x4,!1),this.isSupported()&&document.exitPictureInPicture!==void 0&&document.pictureInPictureElement!==null&&document.exitPictureInPicture(),L(this,lu))try{document.body.removeChild(L(this,lu))}catch{}this.removeAllSources(),Te(this,Ep,void 0),Te(this,Np,void 0),Te(this,Ew,void 0)}init({height:t,width:e}={}){if(!this.isSupported())throw this.logger.error("Pip.unsupported"),new Error("Picture-in-picture is not available in this environment");if(L(this,x4))return;Te(this,x4,!0),this.createCanvas(),this.setupMediaSessionEvents();const n=document.createElement("video");Te(this,ul,{height:t??L6e,width:e??D6e}),n.height=L(this,ul).height,n.width=L(this,ul).width,n.autoplay=!0,n.muted=!0,n.srcObject=L(this,Ep).captureStream(24),Te(this,Np,n),L(this,Np).onloadedmetadata=()=>{try{this.emit("pipStarted"),L(this,Np).onleavepictureinpicture=()=>{this.emit("pipEnded")}}catch{this.emit("pipEnded")}},this.createVideoContainer(),this.paintCanvas()}updateMediaSession(t,e){navigator.mediaSession!==void 0&&(t==="CAMERA"&&navigator.mediaSession.setCameraActive!==void 0&&navigator.mediaSession.setCameraActive(e),t==="MIC"&&navigator.mediaSession.setMicrophoneActive!==void 0&&navigator.mediaSession.setMicrophoneActive(e))}enableSource(t){L(this,qu)[t]!==void 0&&(L(this,qu)[t].enabled=!0)}disableSource(t){L(this,qu)[t]!==void 0&&(L(this,qu)[t].enabled=!1)}generateAvatar(t,e){return me(this,null,function*(){if(!e)return;const n=new Image;try{const r=yield(yield fetch(e)).blob(),s=window.URL.createObjectURL(r);n.onload=()=>{this.updateSource(t,{image:n}),window.URL.revokeObjectURL(s)},n.src=s}catch(r){this.logger.error("Pip::GenerateAvatar",{error:r})}})}addSource(t,e,n,r=!1,s=void 0,i=void 0,o=!1){this.logger.debug("Pip::AddSource",{pip:{id:t,handRaised:o}}),L(this,qu)[t]={id:t,element:e,enabled:n,pinned:r,displayText:s?wwn(s):void 0,imageUrl:i,handRaised:o},i&&this.generateAvatar(t,i)}updateSource(t,e){this.logger.info("Pip::UpdateSource",{pip:{id:t,handRaised:e.handRaised,reaction:e.reaction}});const n=L(this,qu)[t];n&&(L(this,qu)[t]=en(en({},n),e))}removeSource(t){delete L(this,qu)[t]}removePinnedSource(){Object.values(L(this,qu)).forEach(t=>{t.pinned&&this.removeSource(t.id)})}removeAllSources(){Te(this,qu,{})}enable(){Te(this,Nw,"activating"),this.setupEventListeners(),this.updateMediaSession("CAMERA",L(this,Ul).videoEnabled),this.updateMediaSession("MIC",L(this,Ul).audioEnabled),document.body.appendChild(L(this,lu)),Te(this,Ew,requestAnimationFrame(()=>this.animate())),L(this,Np).onloadedmetadata=()=>{L(this,Np).requestPictureInPicture().then(()=>{Te(this,Nw,"active")})},L(this,Np).readyState===4&&L(this,Np).requestPictureInPicture().then(()=>{Te(this,Nw,"active")})}};let Swn=kpt;Ep=new WeakMap,t_=new WeakMap,lu=new WeakMap,Np=new WeakMap,ul=new WeakMap,Sv=new WeakMap,Ew=new WeakMap,qu=new WeakMap,Ul=new WeakMap,y4=new WeakMap,b4=new WeakMap,Nw=new WeakMap,x4=new WeakMap;var t0;(function(t){t[t.PUBLISHER=0]="PUBLISHER",t[t.SUBSCRIBER=1]="SUBSCRIBER"})(t0||(t0={}));var Cx;(function(t){t[t.AUDIO=0]="AUDIO",t[t.VIDEO=1]="VIDEO"})(Cx||(Cx={}));class Cwn extends We{constructor(){super("media.Codec",[{no:1,name:"channels",kind:"scalar",opt:!0,T:5},{no:2,name:"clock_rate",kind:"scalar",T:5},{no:3,name:"mime_type",kind:"scalar",T:9},{no:4,name:"sdp_fmtp_line",kind:"scalar",opt:!0,T:9},{no:5,name:"payload_type",kind:"scalar",opt:!0,T:13}])}}const Spt=new Cwn;class jwn extends We{constructor(){super("media.HeaderExtension",[{no:1,name:"direction",kind:"scalar",opt:!0,T:9},{no:2,name:"uri",kind:"scalar",T:9}])}}const Ewn=new jwn;class Nwn extends We{constructor(){super("media.Fingerprint",[{no:1,name:"algorithm",kind:"scalar",T:9},{no:2,name:"value",kind:"scalar",T:9}])}}new Nwn;class Twn extends We{constructor(){super("media.SessionDescription",[{no:1,name:"target",kind:"enum",T:()=>["media.Target",t0]},{no:2,name:"type",kind:"scalar",T:9},{no:3,name:"sdp",kind:"scalar",T:9}])}}const qg=new Twn;class _wn extends We{constructor(){super("media.ProducerPayload",[{no:1,name:"kind",kind:"scalar",T:9},{no:2,name:"paused",kind:"scalar",T:8},{no:3,name:"screen_share",kind:"scalar",T:8},{no:4,name:"msid",kind:"scalar",T:9},{no:5,name:"app_data",kind:"scalar",opt:!0,T:9},{no:6,name:"mime_type",kind:"scalar",opt:!0,T:9}])}}const Awn=new _wn;class Pwn extends We{constructor(){super("media.CreateTransportRequest",[{no:1,name:"consuming",kind:"scalar",T:8},{no:2,name:"force_tcp",kind:"scalar",opt:!0,T:8},{no:3,name:"description",kind:"message",T:()=>qg},{no:4,name:"private_ice",kind:"scalar",opt:!0,T:8},{no:5,name:"producers",kind:"message",repeat:1,T:()=>Awn}])}}const Rwn=new Pwn;class Iwn extends We{constructor(){super("media.AudioActivityRequest",[{no:1,name:"producer_id",kind:"scalar",T:9},{no:2,name:"energy",kind:"scalar",T:5},{no:3,name:"silent",kind:"scalar",T:8}])}}const Mwn=new Iwn;class Lwn extends We{constructor(){super("media.CreateTransportResponse",[{no:1,name:"transport_id",kind:"scalar",T:9},{no:2,name:"description",kind:"message",T:()=>qg},{no:3,name:"transcription_enabled",kind:"scalar",opt:!0,T:8},{no:4,name:"producer_ids",kind:"scalar",repeat:2,T:9}])}}const Cpt=new Lwn;class Dwn extends We{constructor(){super("media.RenegotiateRequest",[{no:1,name:"transport_id",kind:"scalar",T:9},{no:2,name:"description",kind:"message",T:()=>qg}])}}const $wn=new Dwn;class Own extends We{constructor(){super("media.RenegotiateResponse",[{no:1,name:"transport_id",kind:"scalar",T:9},{no:2,name:"description",kind:"message",T:()=>qg}])}}new Own;class Fwn extends We{constructor(){super("media.NestedScore",[{no:1,name:"encoding_idx",kind:"scalar",T:5},{no:2,name:"rid",kind:"scalar",T:9},{no:3,name:"score",kind:"scalar",T:5},{no:4,name:"ssrc",kind:"scalar",T:3,L:0}])}}const Bwn=new Fwn;class Uwn extends We{constructor(){super("media.ProducerTrack",[{no:1,name:"track_id",kind:"scalar",T:9},{no:2,name:"producer_id",kind:"scalar",T:9},{no:3,name:"stream_id",kind:"scalar",T:9}])}}const zwn=new Uwn;class Vwn extends We{constructor(){super("media.ProducerEntry",[{no:1,name:"producing_transport_id",kind:"scalar",T:9},{no:2,name:"producer_id",kind:"scalar",T:9}])}}new Vwn;class Hwn extends We{constructor(){super("media.ConsumerEntry",[{no:1,name:"consuming_transport_id",kind:"scalar",T:9},{no:2,name:"consumer_id",kind:"scalar",T:9}])}}new Hwn;class Gwn extends We{constructor(){super("media.ProducerState",[{no:1,name:"producer_id",kind:"scalar",T:9},{no:2,name:"kind",kind:"enum",T:()=>["media.ProducerKind",Cx]},{no:3,name:"pause",kind:"scalar",T:8},{no:4,name:"screen_share",kind:"scalar",T:8},{no:5,name:"app_data",kind:"scalar",opt:!0,T:9},{no:6,name:"producing_transport_id",kind:"scalar",opt:!0,T:9},{no:7,name:"mime_type",kind:"scalar",opt:!0,T:9},{no:8,name:"codec",kind:"message",T:()=>Spt}])}}const k7=new Gwn;class Wwn extends We{constructor(){super("media.ConsumerState",[{no:1,name:"consumer_id",kind:"scalar",T:9},{no:2,name:"producer_state",kind:"message",T:()=>k7},{no:3,name:"producer_track",kind:"message",T:()=>zwn},{no:4,name:"error_code",kind:"scalar",opt:!0,T:9}])}}const qwn=new Wwn;class Kwn extends We{constructor(){super("media.ProducerIdToConsumerMap",[{no:1,name:"map",kind:"map",K:9,V:{kind:"message",T:()=>qwn}}])}}const jpt=new Kwn;class Ywn extends We{constructor(){super("media.PeerRtpCapabilitites",[{no:1,name:"sender",kind:"message",T:()=>O6e},{no:2,name:"receiver",kind:"message",T:()=>O6e}])}}const Ept=new Ywn;class Qwn extends We{constructor(){super("media.RtpCapability",[{no:1,name:"codecs",kind:"message",repeat:1,T:()=>Spt},{no:2,name:"header_extensions",kind:"message",repeat:1,T:()=>Ewn}])}}const $6e=new Qwn;class Zwn extends We{constructor(){super("media.RtpCapabilitites",[{no:1,name:"audio",kind:"message",T:()=>$6e},{no:2,name:"video",kind:"message",T:()=>$6e}])}}const O6e=new Zwn;class Jwn extends We{constructor(){super("media.PreferredCodec",[{no:1,name:"audio",kind:"scalar",opt:!0,T:9},{no:2,name:"video",kind:"scalar",opt:!0,T:9}])}}const Xwn=new Jwn;class e1n extends We{constructor(){super("media.Simulcast",[{no:1,name:"preferred_rid",kind:"scalar",opt:!0,T:9},{no:2,name:"priority_ordering",kind:"scalar",opt:!0,T:9},{no:3,name:"rid_not_available",kind:"scalar",opt:!0,T:9}])}}const Npt=new e1n;class t1n extends We{constructor(){super("media.edge.GeoLocation",[{no:1,name:"latitude",kind:"scalar",T:2},{no:2,name:"longitude",kind:"scalar",T:2},{no:3,name:"region",kind:"scalar",opt:!0,T:9}])}}const n1n=new t1n;class r1n extends We{constructor(){super("media.edge.PeerJoinRequest",[{no:1,name:"display_name",kind:"scalar",opt:!0,T:9},{no:2,name:"prejoined",kind:"scalar",T:8},{no:3,name:"room_uuid",kind:"scalar",T:9},{no:4,name:"meeting_id",kind:"scalar",opt:!0,T:9},{no:5,name:"preset",kind:"scalar",opt:!0,T:12},{no:6,name:"user_id",kind:"scalar",opt:!0,T:9},{no:7,name:"organization_id",kind:"scalar",opt:!0,T:9},{no:8,name:"location",kind:"message",T:()=>n1n},{no:9,name:"capabilities",kind:"message",T:()=>Ept}])}}const s1n=new r1n;class i1n extends We{constructor(){super("media.edge.PeerJoinCompleteRequest",[])}}const a1n=new i1n;class o1n extends We{constructor(){super("media.edge.PeerLeaveRequest",[{no:1,name:"close_room",kind:"scalar",T:8}])}}const l1n=new o1n;class c1n extends We{constructor(){super("media.edge.ConsumeMultipleProducerRequest",[{no:1,name:"producer_ids",kind:"scalar",repeat:2,T:9},{no:2,name:"paused",kind:"scalar",opt:!0,T:8}])}}new c1n;class d1n extends We{constructor(){super("media.edge.ConsumePeerRequest",[{no:1,name:"producing_peer_id",kind:"scalar",T:9},{no:2,name:"paused",kind:"scalar",opt:!0,T:8},{no:3,name:"producer_id",kind:"scalar",opt:!0,T:9},{no:4,name:"preferred_codec",kind:"message",T:()=>Xwn},{no:5,name:"producing_transport_id",kind:"scalar",opt:!0,T:9},{no:6,name:"simulcast",kind:"message",T:()=>Npt}])}}const u1n=new d1n;class h1n extends We{constructor(){super("media.edge.ConsumePeersRequest",[{no:1,name:"requests",kind:"message",repeat:1,T:()=>u1n},{no:2,name:"consuming_transport_id",kind:"scalar",opt:!0,T:9}])}}const m1n=new h1n;class f1n extends We{constructor(){super("media.edge.UpdateConsumerSimulcastConfigRequest",[{no:1,name:"producer_id",kind:"scalar",T:9},{no:2,name:"simulcast",kind:"message",T:()=>Npt},{no:3,name:"producing_transport_id",kind:"scalar",T:9},{no:4,name:"mid",kind:"scalar",T:9}])}}const p1n=new f1n;class g1n extends We{constructor(){super("media.edge.UpdateConsumersSimulcastConfigRequest",[{no:1,name:"requests",kind:"message",repeat:1,T:()=>p1n},{no:2,name:"consuming_transport_id",kind:"scalar",opt:!0,T:9}])}}const v1n=new g1n;class y1n extends We{constructor(){super("media.edge.ProducerCreateRequest",[{no:1,name:"kind",kind:"scalar",T:9},{no:2,name:"paused",kind:"scalar",T:8},{no:3,name:"screen_share",kind:"scalar",T:8},{no:4,name:"description",kind:"message",T:()=>qg},{no:5,name:"msid",kind:"scalar",T:9},{no:6,name:"app_data",kind:"scalar",opt:!0,T:9},{no:7,name:"mime_type",kind:"scalar",opt:!0,T:9},{no:8,name:"producing_transport_id",kind:"scalar",opt:!0,T:9}])}}const b1n=new y1n;class x1n extends We{constructor(){super("media.edge.SelectedPeersRequest",[])}}new x1n;class w1n extends We{constructor(){super("media.edge.GlobalPeerPinningRequest",[{no:1,name:"participant_id",kind:"scalar",T:9}])}}const k1n=new w1n;class S1n extends We{constructor(){super("media.edge.ProducerToggleRequest",[{no:1,name:"producer_id",kind:"scalar",T:9},{no:2,name:"pause",kind:"scalar",T:8}])}}const gz=new S1n;class C1n extends We{constructor(){super("media.edge.ConsumerToggleRequest",[{no:1,name:"consumer_id",kind:"scalar",T:9},{no:2,name:"pause",kind:"scalar",T:8}])}}new C1n;class j1n extends We{constructor(){super("media.edge.ProducerCloseRequest",[{no:1,name:"producer_id",kind:"scalar",T:9},{no:2,name:"description",kind:"message",T:()=>qg},{no:3,name:"producing_transport_id",kind:"scalar",opt:!0,T:9}])}}const E1n=new j1n;class N1n extends We{constructor(){super("media.edge.ConsumerCloseRequest",[{no:1,name:"consumer_ids",kind:"scalar",repeat:2,T:9},{no:2,name:"description",kind:"message",T:()=>qg},{no:3,name:"consuming_transport_id",kind:"scalar",opt:!0,T:9}])}}const T1n=new N1n;class _1n extends We{constructor(){super("media.edge.KickPeerRequest",[{no:1,name:"participant_id",kind:"scalar",T:9}])}}new _1n;class A1n extends We{constructor(){super("media.edge.KickAllPeersRequest",[{no:1,name:"propagate_kick_across_rooms",kind:"scalar",T:8}])}}const Tpt=new A1n;class P1n extends We{constructor(){super("media.edge.PeerDisplayNameEditRequest",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"display_name",kind:"scalar",T:9}])}}const R1n=new P1n;class I1n extends We{constructor(){super("media.edge.HostMediaControlForPeerRequest",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"audio",kind:"scalar",T:8},{no:3,name:"video",kind:"scalar",T:8},{no:4,name:"scree_share",kind:"scalar",T:8}])}}const M1n=new I1n;class L1n extends We{constructor(){super("media.edge.HostMediaControlForAllPeerRequest",[{no:1,name:"audio",kind:"scalar",T:8},{no:2,name:"video",kind:"scalar",T:8},{no:3,name:"screen_share",kind:"scalar",T:8}])}}const D1n=new L1n;class $1n extends We{constructor(){super("media.edge.GetRoomStateResponse",[{no:1,name:"display_title",kind:"scalar",T:9},{no:2,name:"locked_mode",kind:"scalar",T:8},{no:3,name:"room_uuid",kind:"scalar",T:9},{no:4,name:"room_name",kind:"scalar",T:9},{no:5,name:"current_peer_id",kind:"scalar",T:9},{no:6,name:"is_recording",kind:"scalar",opt:!0,T:8},{no:7,name:"recorder_participant_id",kind:"scalar",opt:!0,T:9},{no:8,name:"pinned_peer_ids",kind:"scalar",repeat:2,T:9}])}}const O1n=new $1n;class F1n extends We{constructor(){super("media.edge.ErrorResponse",[{no:1,name:"error_message",kind:"scalar",T:9},{no:2,name:"event_id",kind:"scalar",T:5}])}}const B1n=new F1n;class U1n extends We{constructor(){super("media.edge.EmptyResponse",[])}}new U1n;class z1n extends We{constructor(){super("media.edge.RoomParticipants",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"producer_states",kind:"message",repeat:1,T:()=>k7},{no:3,name:"display_name",kind:"scalar",T:9},{no:4,name:"user_id",kind:"scalar",opt:!0,T:9},{no:5,name:"capabilities",kind:"message",T:()=>Ept}])}}const _pt=new z1n;class V1n extends We{constructor(){super("media.edge.SelectedPeersResponse",[{no:1,name:"audio_peers",kind:"scalar",repeat:2,T:9},{no:2,name:"compulsory_peers",kind:"scalar",repeat:2,T:9}])}}const lve=new V1n;class H1n extends We{constructor(){super("media.edge.SelectedPeersDiffEntry",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"priority",kind:"scalar",T:5}])}}const G1n=new H1n;class W1n extends We{constructor(){super("media.edge.SelectedPeersDiffResponse",[{no:1,name:"entries",kind:"message",repeat:1,T:()=>G1n}])}}const F6e=new W1n;class q1n extends We{constructor(){super("media.edge.PeerJoinResponse",[])}}new q1n;class K1n extends We{constructor(){super("media.edge.PeerJoinCompleteResponse",[{no:1,name:"room_state",kind:"message",T:()=>O1n},{no:2,name:"participants",kind:"message",repeat:1,T:()=>_pt},{no:3,name:"selected_peers",kind:"message",T:()=>lve},{no:4,name:"max_preferred_streams",kind:"scalar",T:5}])}}const cve=new K1n;class Y1n extends We{constructor(){super("media.edge.PeerLeaveResponse",[{no:1,name:"closed",kind:"scalar",T:8}])}}const Q1n=new Y1n;class Z1n extends We{constructor(){super("media.edge.ConsumeMultipleProducerResponse",[{no:1,name:"status",kind:"scalar",T:8},{no:2,name:"consumer_ids_map",kind:"message",T:()=>jpt}])}}new Z1n;class J1n extends We{constructor(){super("media.edge.ConsumePeerResponse",[{no:1,name:"status",kind:"scalar",T:8},{no:2,name:"consumer_ids_map",kind:"message",T:()=>jpt},{no:3,name:"description",kind:"message",T:()=>qg}])}}const X1n=new J1n;class ekn extends We{constructor(){super("media.edge.ProducerCreateResponse",[{no:1,name:"status",kind:"scalar",T:8},{no:2,name:"producer_id",kind:"scalar",T:9},{no:4,name:"description",kind:"message",T:()=>qg}])}}const tkn=new ekn;class nkn extends We{constructor(){super("media.edge.ProducerScoreResponse",[{no:1,name:"responseid",kind:"scalar",T:9},{no:2,name:"score",kind:"message",T:()=>Bwn}])}}new nkn;class rkn extends We{constructor(){super("media.edge.ActiveSpeakerResponse",[{no:1,name:"responsepeer_id",kind:"scalar",T:9},{no:2,name:"volume",kind:"scalar",T:5}])}}new rkn;class skn extends We{constructor(){super("media.edge.NoActiveSpeakerResponse",[])}}new skn;class ikn extends We{constructor(){super("media.edge.ProducerToggleResponse",[])}}new ikn;class akn extends We{constructor(){super("media.edge.ConsumerToggleResponse",[])}}new akn;class okn extends We{constructor(){super("media.edge.ProducerClosingResponse",[{no:1,name:"description",kind:"message",T:()=>qg}])}}const lkn=new okn;class ckn extends We{constructor(){super("media.edge.ConsumerClosingResponse",[{no:1,name:"description",kind:"message",T:()=>qg}])}}const dkn=new ckn;class ukn extends We{constructor(){super("media.edge.GlobalPeerPinningResponse",[])}}new ukn;class hkn extends We{constructor(){super("media.edge.KickPeerResponse",[{no:1,name:"status",kind:"scalar",T:9}])}}new hkn;class mkn extends We{constructor(){super("media.edge.KickAllPeersResponse",[{no:1,name:"status",kind:"scalar",T:9}])}}new mkn;class fkn extends We{constructor(){super("media.edge.HostMediaControlForPeerResponse",[{no:1,name:"status",kind:"scalar",T:9}])}}const pkn=new fkn;class gkn extends We{constructor(){super("media.edge.HostMediaControlForAllPeerResponse",[{no:1,name:"status",kind:"scalar",T:9}])}}const vkn=new gkn;class ykn extends We{constructor(){super("media.edge.PeerDisplayNameEditResponse",[{no:1,name:"status",kind:"scalar",T:9}])}}const bkn=new ykn;class xkn extends We{constructor(){super("media.edge.PeerJoinBroadcastResponse",[{no:1,name:"participant",kind:"message",T:()=>_pt}])}}const B6e=new xkn;class wkn extends We{constructor(){super("media.edge.TrackSubscriptionKind",[{no:1,name:"audio",kind:"scalar",T:8},{no:2,name:"video",kind:"scalar",T:8}])}}const U6e=new wkn;class kkn extends We{constructor(){super("media.edge.TrackSubscription",[{no:1,name:"label",kind:"scalar",T:9},{no:2,name:"webcam",kind:"message",T:()=>U6e},{no:3,name:"screenshare",kind:"message",T:()=>U6e}])}}const Skn=new kkn;class Ckn extends We{constructor(){super("media.edge.PeerProducingTransportCreateBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"transport_details",kind:"message",T:()=>Cpt},{no:3,name:"track_subscriptions",kind:"message",repeat:1,T:()=>Skn}])}}new Ckn;class jkn extends We{constructor(){super("media.edge.PeerProducerCreateBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"producer_state",kind:"message",T:()=>k7}])}}const Ekn=new jkn;class Nkn extends We{constructor(){super("media.edge.PeerProducerToggleBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"producer_state",kind:"message",T:()=>k7},{no:3,name:"initiator_participant_id",kind:"scalar",opt:!0,T:9}])}}const z6e=new Nkn;class Tkn extends We{constructor(){super("media.edge.PeerProducerCloseBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"producer_state",kind:"message",T:()=>k7}])}}const _kn=new Tkn;class Akn extends We{constructor(){super("media.edge.PeerLeaveBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9}])}}const dve=new Akn;class Pkn extends We{constructor(){super("media.edge.GlobalPeerPinningBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9}])}}const V6e=new Pkn;class Rkn extends We{constructor(){super("media.edge.GlobalPeerUnPinningBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9}])}}new Rkn;class Ikn extends We{constructor(){super("media.edge.RecordingStartedBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9}])}}new Ikn;class Mkn extends We{constructor(){super("media.edge.RecordingStoppedBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9}])}}new Mkn;class Lkn extends We{constructor(){super("media.edge.PeerDisplayNameEditBroadcastResponse",[{no:1,name:"participant_id",kind:"scalar",T:9},{no:2,name:"display_name",kind:"scalar",T:9}])}}new Lkn;class Dkn extends We{constructor(){super("media.edge.PeerPingRequestBroadcastResponse",[{no:1,name:"password",kind:"scalar",T:9}])}}new Dkn;class $kn extends We{constructor(){super("media.edge.MediaRoomTerminationBroadcastResponse",[{no:1,name:"reason",kind:"scalar",T:9}])}}new $kn;class Okn extends We{constructor(){super("socket.ai.MeetingTranscript",[{no:1,name:"meeting_id",kind:"scalar",T:9},{no:2,name:"transcript",kind:"scalar",T:9},{no:3,name:"is_partial",kind:"scalar",T:8}])}}const Dle=new Okn;class Fkn extends We{constructor(){super("socket.api.BaseSocketHubMessage",[{no:1,name:"event",kind:"scalar",T:5},{no:2,name:"id",kind:"scalar",T:9},{no:3,name:"peer_id",kind:"scalar",T:9},{no:4,name:"room_id",kind:"scalar",T:9},{no:5,name:"user_id",kind:"scalar",T:9},{no:6,name:"payload",kind:"scalar",T:12},{no:7,name:"error",kind:"scalar",opt:!0,T:8},{no:8,name:"sid",kind:"scalar",opt:!0,T:9}])}}new Fkn;class Bkn extends We{constructor(){super("socket.api.ErrorMessage",[{no:1,name:"code",kind:"scalar",opt:!0,T:5},{no:2,name:"message",kind:"scalar",T:9}])}}const Ukn=new Bkn;var Yj;(function(t){t[t.BROWSER=0]="BROWSER",t[t.TRACK=1]="TRACK",t[t.COMPOSITE=2]="COMPOSITE"})(Yj||(Yj={}));var Jb;(function(t){t[t.UNSPECIFIED=0]="UNSPECIFIED",t[t.ON_STAGE=1]="ON_STAGE",t[t.APPROVED_STAGE=2]="APPROVED_STAGE",t[t.REQUESTED_STAGE=3]="REQUESTED_STAGE",t[t.OFF_STAGE=4]="OFF_STAGE"})(Jb||(Jb={}));var uve;(function(t){t[t.NONE=0]="NONE",t[t.RECORDER=1]="RECORDER",t[t.LIVESTREAMER=2]="LIVESTREAMER"})(uve||(uve={}));var hve;(function(t){t[t.PEERS=0]="PEERS",t[t.ROOMS=1]="ROOMS"})(hve||(hve={}));var HY;(function(t){t[t.HIVE=0]="HIVE",t[t.CHAT=1]="CHAT",t[t.PING=2]="PING"})(HY||(HY={}));class zkn extends We{constructor(){super("socket.room.PeerFlags",[{no:1,name:"preset_name",kind:"scalar",T:9},{no:2,name:"recorder_type",kind:"scalar",T:9},{no:3,name:"hidden_participant",kind:"scalar",T:8}])}}const Vkn=new zkn;class Hkn extends We{constructor(){super("socket.room.Peer",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9},{no:3,name:"display_name",kind:"scalar",T:9},{no:4,name:"stage_type",kind:"enum",opt:!0,T:()=>["socket.room.StageType",Jb,"STAGE_TYPE_"]},{no:5,name:"custom_participant_id",kind:"scalar",opt:!0,T:9},{no:6,name:"preset_id",kind:"scalar",opt:!0,T:9},{no:7,name:"display_picture_url",kind:"scalar",opt:!0,T:9},{no:8,name:"waitlisted",kind:"scalar",T:8},{no:9,name:"flags",kind:"message",T:()=>Vkn}])}}const $te=new Hkn;class Gkn extends We{constructor(){super("socket.room.PeerInfoResponse",[{no:1,name:"peer",kind:"message",T:()=>$te}])}}const n_=new Gkn;class Wkn extends We{constructor(){super("socket.room.PeerStatusUpdate",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9},{no:3,name:"stage_type",kind:"enum",opt:!0,T:()=>["socket.room.StageType",Jb,"STAGE_TYPE_"]}])}}const H6e=new Wkn;class qkn extends We{constructor(){super("socket.room.RoomPeersInfoRequest",[{no:1,name:"seach_query",kind:"scalar",T:9},{no:2,name:"limit",kind:"scalar",T:5},{no:3,name:"offset",kind:"scalar",T:5}])}}const Kkn=new qkn;class Ykn extends We{constructor(){super("socket.room.RoomPeersInfoResponse",[{no:1,name:"peers",kind:"message",repeat:1,T:()=>$te}])}}const $le=new Ykn;class Qkn extends We{constructor(){super("socket.room.RoomPeerCountResponse",[{no:1,name:"count",kind:"scalar",T:4,L:2}])}}const G6e=new Qkn;class Zkn extends We{constructor(){super("socket.room.Room",[{no:1,name:"room_id",kind:"scalar",T:9},{no:2,name:"title",kind:"scalar",T:9},{no:4,name:"created_at",kind:"scalar",T:4,L:2},{no:5,name:"active_recordings",kind:"message",repeat:1,T:()=>Xkn},{no:6,name:"room_uuid",kind:"scalar",opt:!0,T:9}])}}const Apt=new Zkn;class Jkn extends We{constructor(){super("socket.room.ActiveRecording",[{no:1,name:"recording_id",kind:"scalar",T:9},{no:2,name:"recording_type",kind:"enum",T:()=>["common.RecordingType",Yj]},{no:3,name:"recording_status",kind:"scalar",T:9}])}}const Xkn=new Jkn;class eSn extends We{constructor(){super("socket.room.RoomInfoResponse",[{no:1,name:"room",kind:"message",T:()=>Apt}])}}const W6e=new eSn;class tSn extends We{constructor(){super("socket.room.GetPeerInfoRequest",[{no:1,name:"peer_id",kind:"scalar",T:9}])}}const Ppt=new tSn;class nSn extends We{constructor(){super("socket.room.UpdatePeerInfoRequest",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"display_name",kind:"scalar",opt:!0,T:9}])}}new nSn;class rSn extends We{constructor(){super("socket.room.JoinRoomRequest",[{no:1,name:"peer",kind:"message",T:()=>$te},{no:3,name:"room_uuid",kind:"scalar",T:9},{no:4,name:"organization_id",kind:"scalar",opt:!0,T:9},{no:5,name:"use_hive",kind:"scalar",opt:!0,T:8},{no:6,name:"preset",kind:"scalar",opt:!0,T:12},{no:7,name:"capabilities",kind:"enum",repeat:1,T:()=>["socket.room.Capabilities",HY,"CAPABILITIES_"]},{no:8,name:"timestamp",kind:"scalar",opt:!0,T:4,L:2}])}}const sSn=new rSn;class iSn extends We{constructor(){super("socket.room.LeaveRoomRequest",[{no:1,name:"peer",kind:"message",T:()=>$te},{no:2,name:"timestamp",kind:"scalar",opt:!0,T:4,L:2}])}}const aSn=new iSn;class oSn extends We{constructor(){super("socket.room.UpdateRoomInfoRequest",[{no:1,name:"room",kind:"message",T:()=>Apt}])}}new oSn;class lSn extends We{constructor(){super("socket.room.GetConnectedRoomsDumpRequest",[])}}new lSn;class cSn extends We{constructor(){super("socket.room.ServiceError",[{no:1,name:"message",kind:"scalar",opt:!0,T:9},{no:2,name:"code",kind:"scalar",opt:!0,T:9}])}}const aEe=new cSn;class dSn extends We{constructor(){super("socket.room.ConnectedMeetingPeer",[{no:1,name:"id",kind:"scalar",opt:!0,T:9},{no:2,name:"display_name",kind:"scalar",opt:!0,T:9},{no:3,name:"custom_participant_id",kind:"scalar",opt:!0,T:9},{no:4,name:"preset_id",kind:"scalar",opt:!0,T:9},{no:5,name:"display_picture_url",kind:"scalar",opt:!0,T:9}])}}const uSn=new dSn;class hSn extends We{constructor(){super("socket.room.ConnectedMeetingDump",[{no:1,name:"id",kind:"scalar",opt:!0,T:9},{no:2,name:"title",kind:"scalar",opt:!0,T:9},{no:3,name:"participants",kind:"message",repeat:1,T:()=>uSn}])}}const q6e=new hSn;class mSn extends We{constructor(){super("socket.room.GetConnectedRoomsDumpResponse",[{no:1,name:"parent_meeting",kind:"message",T:()=>q6e},{no:2,name:"meetings",kind:"message",repeat:1,T:()=>q6e}])}}const fSn=new mSn;class pSn extends We{constructor(){super("socket.room.CreateRoomRequestPayload",[{no:1,name:"title",kind:"scalar",opt:!0,T:9}])}}const gSn=new pSn;class vSn extends We{constructor(){super("socket.room.CreateConnectedRoomsRequest",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>gSn}])}}const ySn=new vSn;class bSn extends We{constructor(){super("socket.room.CreateRoomResponsePayload",[{no:1,name:"id",kind:"scalar",opt:!0,T:9},{no:2,name:"title",kind:"scalar",opt:!0,T:9},{no:3,name:"error",kind:"message",T:()=>aEe}])}}const xSn=new bSn;class wSn extends We{constructor(){super("socket.room.CreateConnectedRoomsResponse",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>xSn}])}}const K6e=new wSn;class kSn extends We{constructor(){super("socket.room.UpdateRoomRequestPayload",[{no:1,name:"meeting_id",kind:"scalar",opt:!0,T:9},{no:2,name:"title",kind:"scalar",opt:!0,T:9}])}}const SSn=new kSn;class CSn extends We{constructor(){super("socket.room.UpdateConnectedRoomsRequest",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>SSn}])}}new CSn;class jSn extends We{constructor(){super("socket.room.DisableRoomPayload",[{no:1,name:"id",kind:"scalar",opt:!0,T:9}])}}const ESn=new jSn;class NSn extends We{constructor(){super("socket.room.DisableConnectedRoomsRequest",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>ESn}])}}const TSn=new NSn;class _Sn extends We{constructor(){super("socket.room.DisableConnectedRoomsResponse",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>RSn}])}}const ASn=new _Sn;class PSn extends We{constructor(){super("socket.room.DisableConnectedRoomPayload",[{no:1,name:"id",kind:"scalar",opt:!0,T:9},{no:2,name:"status",kind:"scalar",opt:!0,T:9},{no:3,name:"title",kind:"scalar",opt:!0,T:9},{no:4,name:"error",kind:"message",T:()=>aEe}])}}const RSn=new PSn;class ISn extends We{constructor(){super("socket.room.MovePeerPayload",[{no:1,name:"id",kind:"scalar",opt:!0,T:9},{no:2,name:"preset_id",kind:"scalar",opt:!0,T:9}])}}const MSn=new ISn;class LSn extends We{constructor(){super("socket.room.MovePeersBetweenRoomsRequest",[{no:1,name:"source_meeting_id",kind:"scalar",opt:!0,T:9},{no:2,name:"destination_meeting_id",kind:"scalar",opt:!0,T:9},{no:3,name:"participants",kind:"message",repeat:1,T:()=>MSn}])}}const DSn=new LSn;class $Sn extends We{constructor(){super("socket.room.MovedPeer",[{no:1,name:"meeting_id",kind:"scalar",opt:!0,T:9},{no:2,name:"custom_participant_id",kind:"scalar",opt:!0,T:9},{no:3,name:"error",kind:"message",T:()=>aEe}])}}const Rpt=new $Sn;class OSn extends We{constructor(){super("socket.room.MovePeersBetweenRoomsResponse",[{no:1,name:"payloads",kind:"message",repeat:1,T:()=>Rpt}])}}new OSn;class FSn extends We{constructor(){super("socket.room.TransferPeer",[{no:1,name:"meeting_id",kind:"scalar",opt:!0,T:9},{no:2,name:"auth_token",kind:"scalar",opt:!0,T:9}])}}const BSn=new FSn;class USn extends We{constructor(){super("socket.room.GetAllAddedParticipantsResponse",[{no:1,name:"participants",kind:"message",repeat:1,T:()=>HSn}])}}const zSn=new USn;class VSn extends We{constructor(){super("socket.room.AddedParticipant",[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",opt:!0,T:9},{no:3,name:"picture",kind:"scalar",opt:!0,T:9},{no:4,name:"custom_participant_id",kind:"scalar",T:9}])}}const HSn=new VSn;class GSn extends We{constructor(){super("socket.room.RemoveParticipantsRequest",[{no:1,name:"peer_ids",kind:"scalar",repeat:2,T:9}])}}const Ipt=new GSn;class WSn extends We{constructor(){super("socket.room.BroadcastMessage",[{no:1,name:"type",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",T:12},{no:3,name:"timestamp",kind:"scalar",T:4,L:2},{no:4,name:"ids",kind:"scalar",repeat:2,T:9},{no:5,name:"broadcast_type",kind:"enum",opt:!0,T:()=>["socket.room.BroadcastType",hve,"BROADCAST_TYPE_"]}])}}const FL=new WSn;class qSn extends We{constructor(){super("socket.room.AcceptWaitingRoomRequests",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}}const KSn=new qSn;class YSn extends We{constructor(){super("socket.room.DenyWaitingRoomRequests",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}}const QSn=new YSn;class ZSn extends We{constructor(){super("socket.room.WaitingRoomRequest",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9},{no:3,name:"display_name",kind:"scalar",T:9},{no:4,name:"picture",kind:"scalar",opt:!0,T:9},{no:5,name:"custom_participant_id",kind:"scalar",opt:!0,T:9},{no:6,name:"preset_name",kind:"scalar",opt:!0,T:9}])}}const JSn=new ZSn;class XSn extends We{constructor(){super("socket.room.GetWaitingRoomRequests",[{no:1,name:"requests",kind:"message",repeat:1,T:()=>JSn}])}}const Y6e=new XSn;class eCn extends We{constructor(){super("socket.room.GetRoomStageStateResponse",[{no:1,name:"on_stage_peers",kind:"scalar",repeat:2,T:9},{no:2,name:"approved_stage_peers",kind:"scalar",repeat:2,T:9},{no:3,name:"requested_stage_peers",kind:"scalar",repeat:2,T:9}])}}const Q6e=new eCn;var mve;(function(t){t[t.NONE=0]="NONE",t[t.SKIP=1]="SKIP",t[t.ON_PRIVILEGED_USER_ENTRY=2]="ON_PRIVILEGED_USER_ENTRY",t[t.SKIP_ON_ACCEPT=3]="SKIP_ON_ACCEPT"})(mve||(mve={}));var A1;(function(t){t[t.NONE=0]="NONE",t[t.ALLOWED=1]="ALLOWED",t[t.NOT_ALLOWED=2]="NOT_ALLOWED",t[t.CAN_REQUEST=3]="CAN_REQUEST"})(A1||(A1={}));class tCn extends We{constructor(){super("socket.preset.PollsPermissionUpdate",[{no:1,name:"can_create",kind:"scalar",opt:!0,T:8},{no:2,name:"can_vote",kind:"scalar",opt:!0,T:8},{no:3,name:"can_view",kind:"scalar",opt:!0,T:8}])}}const nCn=new tCn;class rCn extends We{constructor(){super("socket.preset.PluginsPermissionsUpdate",[{no:1,name:"can_close",kind:"scalar",opt:!0,T:8},{no:2,name:"can_start",kind:"scalar",opt:!0,T:8}])}}const sCn=new rCn;class iCn extends We{constructor(){super("socket.preset.PublicChatPermission",[{no:1,name:"can_send",kind:"scalar",opt:!0,T:8},{no:2,name:"text",kind:"scalar",opt:!0,T:8},{no:3,name:"files",kind:"scalar",opt:!0,T:8}])}}const aCn=new iCn;class oCn extends We{constructor(){super("socket.preset.PrivateChatPermission",[{no:1,name:"can_send",kind:"scalar",opt:!0,T:8},{no:2,name:"can_receive",kind:"scalar",opt:!0,T:8},{no:3,name:"text",kind:"scalar",opt:!0,T:8},{no:4,name:"files",kind:"scalar",opt:!0,T:8}])}}const lCn=new oCn;class cCn extends We{constructor(){super("socket.preset.ChatPermissionUpdate",[{no:1,name:"public",kind:"message",T:()=>aCn},{no:2,name:"private",kind:"message",T:()=>lCn}])}}const dCn=new cCn;class uCn extends We{constructor(){super("socket.preset.ConnectedMeetingPermissionUpdate",[{no:1,name:"can_alter_connected_meetings",kind:"scalar",opt:!0,T:8},{no:2,name:"can_switch_to_parent_meeting",kind:"scalar",opt:!0,T:8},{no:3,name:"can_switch_connected_meetings",kind:"scalar",opt:!0,T:8}])}}const hCn=new uCn;class mCn extends We{constructor(){super("socket.preset.StreamPermission",[{no:1,name:"can_produce",kind:"enum",opt:!0,T:()=>["socket.preset.StreamPermissionType",A1,"STREAM_PERMISSION_TYPE_"]},{no:2,name:"can_consume",kind:"enum",opt:!0,T:()=>["socket.preset.StreamPermissionType",A1,"STREAM_PERMISSION_TYPE_"]}])}}const Ole=new mCn;class fCn extends We{constructor(){super("socket.preset.MediaPermissionUpdate",[{no:1,name:"video",kind:"message",T:()=>Ole},{no:2,name:"audio",kind:"message",T:()=>Ole},{no:3,name:"screenshare",kind:"message",T:()=>Ole}])}}const pCn=new fCn;class gCn extends We{constructor(){super("socket.preset.PresetUpdates",[{no:1,name:"polls",kind:"message",T:()=>nCn},{no:2,name:"plugins",kind:"message",T:()=>sCn},{no:3,name:"chat",kind:"message",T:()=>dCn},{no:4,name:"accept_waiting_requests",kind:"scalar",opt:!0,T:8},{no:5,name:"can_accept_production_requests",kind:"scalar",opt:!0,T:8},{no:6,name:"can_edit_display_name",kind:"scalar",opt:!0,T:8},{no:7,name:"can_record",kind:"scalar",opt:!0,T:8},{no:8,name:"can_livestream",kind:"scalar",opt:!0,T:8},{no:9,name:"can_spotlight",kind:"scalar",opt:!0,T:8},{no:10,name:"disable_participant_audio",kind:"scalar",opt:!0,T:8},{no:11,name:"disable_participant_screensharing",kind:"scalar",opt:!0,T:8},{no:12,name:"disable_participant_video",kind:"scalar",opt:!0,T:8},{no:13,name:"kick_participant",kind:"scalar",opt:!0,T:8},{no:14,name:"pin_participant",kind:"scalar",opt:!0,T:8},{no:15,name:"transcription_enabled",kind:"scalar",opt:!0,T:8},{no:16,name:"waiting_room_type",kind:"enum",opt:!0,T:()=>["socket.preset.WaitingRoomType",mve,"WAITING_ROOM_TYPE_"]},{no:17,name:"is_recorder",kind:"scalar",opt:!0,T:8},{no:18,name:"recorder_type",kind:"enum",opt:!0,T:()=>["socket.room.RecorderType",uve,"RECORDER_TYPE_"]},{no:19,name:"hidden_participant",kind:"scalar",opt:!0,T:8},{no:20,name:"show_participant_list",kind:"scalar",opt:!0,T:8},{no:21,name:"can_change_participant_permissions",kind:"scalar",opt:!0,T:8},{no:22,name:"connected_meetings",kind:"message",T:()=>hCn},{no:23,name:"media",kind:"message",T:()=>pCn}])}}const oEe=new gCn;class vCn extends We{constructor(){super("socket.preset.ReadPeersPresetRequest",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}}const yCn=new vCn;class bCn extends We{constructor(){super("socket.preset.PeerPreset",[{no:1,name:"user_id",kind:"scalar",T:9},{no:2,name:"peer_id",kind:"scalar",T:9},{no:3,name:"preset",kind:"scalar",T:12}])}}const xCn=new bCn;class wCn extends We{constructor(){super("socket.preset.ReadPeersPresetResponse",[{no:1,name:"peer_presets",kind:"message",repeat:1,T:()=>xCn}])}}const kCn=new wCn;class SCn extends We{constructor(){super("socket.preset.UpdatePeerPreset",[{no:1,name:"user_ids",kind:"scalar",T:9},{no:2,name:"patch",kind:"message",T:()=>oEe}])}}const Mpt=new SCn;class CCn extends We{constructor(){super("socket.preset.UpdatePeersPresetRequest",[{no:1,name:"update_peers_presets",kind:"message",repeat:1,T:()=>Mpt}])}}const jCn=new CCn;class ECn extends We{constructor(){super("socket.preset.UpdatePeersPresetResponse",[{no:1,name:"update_peers_presets",kind:"message",repeat:1,T:()=>Mpt}])}}const Z6e=new ECn;class NCn extends We{constructor(){super("socket.preset.PeerUserIDMap",[{no:1,name:"peer_id",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9}])}}const TCn=new NCn;class _Cn extends We{constructor(){super("socket.preset.BulkUpdatePeerPresetRequest",[{no:1,name:"peers",kind:"message",repeat:1,T:()=>TCn},{no:2,name:"patch",kind:"message",T:()=>oEe}])}}new _Cn;class ACn extends We{constructor(){super("socket.preset.BulkUpdatePeerPresetResponse",[{no:2,name:"patch",kind:"message",T:()=>oEe}])}}new ACn;class PCn extends We{constructor(){super("socket.chat.ChatMessage",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"peer_id",kind:"scalar",T:9},{no:3,name:"user_id",kind:"scalar",T:9},{no:4,name:"display_name",kind:"scalar",T:9},{no:5,name:"pinned",kind:"scalar",T:8},{no:6,name:"is_edited",kind:"scalar",T:8},{no:7,name:"payload_type",kind:"scalar",T:5},{no:8,name:"payload",kind:"scalar",T:9},{no:10,name:"target_user_ids",kind:"scalar",repeat:2,T:9},{no:11,name:"created_at",kind:"scalar",T:4,L:2},{no:12,name:"created_at_ms",kind:"scalar",opt:!0,T:4,L:2},{no:13,name:"channel_id",kind:"scalar",opt:!0,T:9},{no:14,name:"channel_index",kind:"scalar",opt:!0,T:9}])}}const bS=new PCn;class RCn extends We{constructor(){super("socket.chat.GetPaginatedChatMessageFilters",[{no:1,name:"pinned",kind:"scalar",oneof:"filters",T:8},{no:2,name:"user_id",kind:"scalar",oneof:"filters",T:9}])}}const ICn=new RCn;class MCn extends We{constructor(){super("socket.chat.GetPaginatedChatMessageRoomRequest",[{no:1,name:"time_stamp",kind:"scalar",T:4,L:2},{no:2,name:"size",kind:"scalar",T:5},{no:3,name:"from",kind:"scalar",T:5},{no:4,name:"reversed",kind:"scalar",T:8},{no:5,name:"channel_id",kind:"scalar",opt:!0,T:9},{no:6,name:"filters",kind:"message",T:()=>ICn}])}}const LCn=new MCn;class DCn extends We{constructor(){super("socket.chat.GetPaginatedChatMessageRoomResponse",[{no:1,name:"messages",kind:"message",repeat:1,T:()=>bS},{no:2,name:"next",kind:"scalar",T:8}])}}const $Cn=new DCn;class OCn extends We{constructor(){super("socket.chat.GetChatMessagesResponse",[{no:1,name:"messages",kind:"message",repeat:1,T:()=>bS}])}}const Lpt=new OCn;class FCn extends We{constructor(){super("socket.chat.SendChatMessageToRoomRequest",[{no:1,name:"payload_type",kind:"scalar",T:5},{no:2,name:"payload",kind:"scalar",T:9}])}}const BCn=new FCn;class UCn extends We{constructor(){super("socket.chat.SendChatMessageToRoomResponse",[{no:1,name:"message",kind:"message",T:()=>bS}])}}const Fle=new UCn;class zCn extends We{constructor(){super("socket.chat.SendChatMessageToPeersRequest",[{no:1,name:"peer_ids",kind:"scalar",repeat:2,T:9},{no:2,name:"payload_type",kind:"scalar",T:5},{no:3,name:"payload",kind:"scalar",T:9}])}}const VCn=new zCn;class HCn extends We{constructor(){super("socket.chat.SendChatMessageToPeersResponse",[{no:1,name:"message",kind:"message",T:()=>bS}])}}const Ble=new HCn;class GCn extends We{constructor(){super("socket.chat.SendChatMessageToChannelRequest",[{no:1,name:"channel_id",kind:"scalar",T:9},{no:2,name:"payload_type",kind:"scalar",T:5},{no:3,name:"payload",kind:"scalar",T:9}])}}new GCn;class WCn extends We{constructor(){super("socket.chat.SendChatMessageToChannelResponse",[{no:1,name:"message",kind:"message",T:()=>bS}])}}new WCn;class qCn extends We{constructor(){super("socket.chat.EditChatMessageRequest",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"payload_type",kind:"scalar",opt:!0,T:5},{no:3,name:"payload",kind:"scalar",opt:!0,T:9},{no:4,name:"pinned",kind:"scalar",opt:!0,T:8},{no:5,name:"channel_id",kind:"scalar",opt:!0,T:9}])}}const KCn=new qCn;class YCn extends We{constructor(){super("socket.chat.PinChatMessageRequest",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"pinned",kind:"scalar",T:8},{no:3,name:"channel_id",kind:"scalar",opt:!0,T:9}])}}const QCn=new YCn;class ZCn extends We{constructor(){super("socket.chat.PinChatMessageResponse",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"pinned",kind:"scalar",T:8},{no:3,name:"channel_id",kind:"scalar",opt:!0,T:9},{no:4,name:"message",kind:"message",T:()=>bS}])}}const vz=new ZCn;class JCn extends We{constructor(){super("socket.chat.EditChatMessageResponse",[{no:1,name:"message",kind:"message",T:()=>bS}])}}const yz=new JCn;class XCn extends We{constructor(){super("socket.chat.DeleteChatMessageRequest",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"channel_id",kind:"scalar",opt:!0,T:9}])}}const ejn=new XCn;class tjn extends We{constructor(){super("socket.chat.DeleteChatMessageResponse",[{no:1,name:"chat_id",kind:"scalar",T:9},{no:2,name:"channel_id",kind:"scalar",opt:!0,T:9}])}}const bz=new tjn;class njn extends We{constructor(){super("socket.chat.SearchChatMessagesRequest",[{no:1,name:"time_stamp",kind:"scalar",T:4,L:2},{no:2,name:"size",kind:"scalar",T:5},{no:3,name:"from",kind:"scalar",T:5},{no:4,name:"reversed",kind:"scalar",T:8},{no:5,name:"channel_id",kind:"scalar",opt:!0,T:9},{no:6,name:"search_term",kind:"scalar",T:9}])}}const rjn=new njn;class sjn extends We{constructor(){super("socket.chat.MarkChannelIndexAsReadRequest",[{no:1,name:"channel_id",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9},{no:3,name:"channel_index",kind:"scalar",T:9}])}}new sjn;class ijn extends We{constructor(){super("socket.chat.MarkChannelIndexAsReadResponse",[{no:1,name:"channel_index",kind:"scalar",T:9}])}}new ijn;class ajn extends We{constructor(){super("socket.chat.CreateChatChannelRequest",[{no:1,name:"display_name",kind:"scalar",T:9},{no:2,name:"target_user_ids",kind:"scalar",repeat:2,T:9},{no:3,name:"display_picture_url",kind:"scalar",opt:!0,T:9},{no:4,name:"visibility",kind:"scalar",T:9},{no:5,name:"is_direct_message",kind:"scalar",T:8}])}}new ajn;class ojn extends We{constructor(){super("socket.chat.UpdateChatChannelRequest",[{no:1,name:"chat_channel_id",kind:"scalar",T:9},{no:2,name:"display_name",kind:"scalar",opt:!0,T:9},{no:3,name:"target_user_ids",kind:"scalar",repeat:2,T:9},{no:4,name:"display_picture_url",kind:"scalar",opt:!0,T:9},{no:5,name:"visibility",kind:"scalar",opt:!0,T:9},{no:6,name:"is_direct_message",kind:"scalar",opt:!0,T:8}])}}new ojn;class ljn extends We{constructor(){super("socket.chat.CreateChatChannelResponse",[{no:1,name:"chat_channel_id",kind:"scalar",T:9}])}}new ljn;class cjn extends We{constructor(){super("socket.chat.GetChatChannelRequest",[{no:1,name:"chat_channel_id",kind:"scalar",T:9}])}}new cjn;class djn extends We{constructor(){super("socket.chat.LatestMessageAndUnreadCount",[{no:1,name:"message",kind:"message",T:()=>bS},{no:2,name:"unread_count",kind:"scalar",T:4,L:2}])}}const ujn=new djn;class hjn extends We{constructor(){super("socket.chat.ChatChannel",[{no:1,name:"chat_channel_id",kind:"scalar",T:9},{no:2,name:"display_name",kind:"scalar",T:9},{no:3,name:"display_picture_url",kind:"scalar",opt:!0,T:9},{no:4,name:"visibility",kind:"scalar",T:9},{no:5,name:"is_direct_message",kind:"scalar",T:8},{no:6,name:"latest_message_and_unread_count",kind:"message",T:()=>ujn},{no:7,name:"target_user_ids",kind:"scalar",repeat:2,T:9}])}}const mjn=new hjn;class fjn extends We{constructor(){super("socket.chat.GetChatChannelResponse",[{no:1,name:"chat_channels",kind:"message",repeat:1,T:()=>mjn}])}}new fjn;class pjn extends We{constructor(){super("socket.chat.ChannelMember",[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",opt:!0,T:9},{no:3,name:"picture",kind:"scalar",opt:!0,T:9},{no:4,name:"custom_participant_id",kind:"scalar",T:9}])}}const gjn=new pjn;class vjn extends We{constructor(){super("socket.chat.GetChatChannelMembersResponse",[{no:1,name:"channel_members",kind:"message",repeat:1,T:()=>gjn}])}}new vjn;class yjn extends We{constructor(){super("socket.plugin.AddPluginRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"staggered",kind:"scalar",T:8}])}}new yjn;class bjn extends We{constructor(){super("socket.plugin.RemovePluginRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"staggered",kind:"scalar",T:8}])}}new bjn;class xjn extends We{constructor(){super("socket.plugin.EnablePluginForRoomRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9}])}}new xjn;class wjn extends We{constructor(){super("socket.plugin.DisablePluginForRoomRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9}])}}new wjn;class kjn extends We{constructor(){super("socket.plugin.EnablePluginForPeersRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"peer_ids",kind:"scalar",repeat:2,T:9}])}}new kjn;class Sjn extends We{constructor(){super("socket.plugin.DisablePluginForPeersRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"peer_ids",kind:"scalar",repeat:2,T:9}])}}new Sjn;class Cjn extends We{constructor(){super("socket.plugin.PluginEventToRoomRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"plugin_data",kind:"scalar",T:12}])}}new Cjn;class jjn extends We{constructor(){super("socket.plugin.PluginEventToPeersRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"peer_ids",kind:"scalar",repeat:2,T:9},{no:3,name:"plugin_data",kind:"scalar",T:12}])}}new jjn;class Ejn extends We{constructor(){super("socket.plugin.StoreKeys",[{no:1,name:"store_key",kind:"scalar",T:9},{no:2,name:"payload",kind:"scalar",opt:!0,T:12}])}}const lEe=new Ejn;class Njn extends We{constructor(){super("socket.plugin.PluginStoreInsertKeysRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"store_name",kind:"scalar",T:9},{no:3,name:"insert_keys",kind:"message",repeat:1,T:()=>lEe}])}}const Tjn=new Njn;class _jn extends We{constructor(){super("socket.plugin.PluginStoreGetKeysRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"store_name",kind:"scalar",T:9},{no:3,name:"get_keys",kind:"message",repeat:1,T:()=>lEe}])}}const Ajn=new _jn;class Pjn extends We{constructor(){super("socket.plugin.PluginStoreDeleteKeysRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"store_name",kind:"scalar",T:9},{no:3,name:"delete_keys",kind:"message",repeat:1,T:()=>lEe}])}}const Rjn=new Pjn;class Ijn extends We{constructor(){super("socket.plugin.PluginStoreDeleteRequest",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"store_name",kind:"scalar",T:9}])}}new Ijn;class Mjn extends We{constructor(){super("socket.plugin.EnablePluginResponse",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"enabled_by",kind:"scalar",T:9}])}}const Ljn=new Mjn;class Djn extends We{constructor(){super("socket.plugin.EnablePluginsResponse",[{no:1,name:"plugins",kind:"message",repeat:1,T:()=>Ljn}])}}new Djn;class $jn extends We{constructor(){super("socket.plugin.DisablePluginResponse",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"disabled_by",kind:"scalar",T:9}])}}new $jn;class Ojn extends We{constructor(){super("socket.plugin.PluginStoreItem",[{no:1,name:"timestamp",kind:"scalar",T:9},{no:2,name:"peer_id",kind:"scalar",T:9},{no:3,name:"store_key",kind:"scalar",T:9},{no:4,name:"payload",kind:"scalar",T:12}])}}const Fjn=new Ojn;class Bjn extends We{constructor(){super("socket.plugin.PluginStoreResponse",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"store_name",kind:"scalar",T:9},{no:3,name:"store_items",kind:"message",repeat:1,T:()=>Fjn}])}}const J6e=new Bjn;class Ujn extends We{constructor(){super("socket.plugin.PluginEventResponse",[{no:1,name:"plugin_id",kind:"scalar",T:9},{no:2,name:"plugin_data",kind:"scalar",T:12}])}}new Ujn;class zjn extends We{constructor(){super("socket.livestreaming.LiveStreamingEvent",[{no:1,name:"livestream_id",kind:"scalar",T:9},{no:2,name:"err_message",kind:"scalar",T:9},{no:3,name:"name",kind:"scalar",T:9},{no:4,name:"meeting_id",kind:"scalar",T:9},{no:5,name:"playback_url",kind:"scalar",T:9},{no:6,name:"org_id",kind:"scalar",T:9},{no:7,name:"room_name",kind:"scalar",T:9},{no:8,name:"room_uuid",kind:"scalar",T:9},{no:9,name:"status",kind:"scalar",T:9},{no:10,name:"manual_ingest",kind:"scalar",opt:!0,T:8}])}}const X6e=new zjn;class Vjn extends We{constructor(){super("socket.livestreaming.GetStagePeersResponse",[{no:1,name:"stage_peers",kind:"scalar",repeat:2,T:9}])}}const eFe=new Vjn;class Hjn extends We{constructor(){super("socket.livestreaming.StageRequest",[{no:1,name:"display_name",kind:"scalar",T:9},{no:2,name:"user_id",kind:"scalar",T:9},{no:3,name:"peer_id",kind:"scalar",T:9}])}}const Gjn=new Hjn;class Wjn extends We{constructor(){super("socket.livestreaming.GetStageRequestsResponse",[{no:1,name:"stage_requests",kind:"message",repeat:1,T:()=>Gjn}])}}const Ule=new Wjn;class qjn extends We{constructor(){super("socket.livestreaming.GrantStageAccessRequest",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}}const Kjn=new qjn;class Yjn extends We{constructor(){super("socket.livestreaming.DenyStageAccessRequest",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}}const Qjn=new Yjn;class Zjn extends We{constructor(){super("socket.livestreaming.LeaveStageRequest",[{no:1,name:"user_ids",kind:"scalar",repeat:2,T:9}])}}const tFe=new Zjn;class Jjn extends We{constructor(){super("socket.polls.Poll",[{no:1,name:"poll_id",kind:"scalar",T:9},{no:2,name:"created_by",kind:"scalar",T:9},{no:3,name:"created_by_user_id",kind:"scalar",T:9},{no:4,name:"question",kind:"scalar",T:9},{no:5,name:"options",kind:"message",repeat:1,T:()=>e2n},{no:6,name:"hide_votes",kind:"scalar",T:8},{no:7,name:"anonymous",kind:"scalar",T:8},{no:8,name:"votes",kind:"scalar",repeat:2,T:9}])}}const Dpt=new Jjn;class Xjn extends We{constructor(){super("socket.polls.PollOption",[{no:1,name:"text",kind:"scalar",T:9},{no:2,name:"count",kind:"scalar",opt:!0,T:4,L:2},{no:3,name:"votes",kind:"message",repeat:1,T:()=>n2n}])}}const e2n=new Xjn;class t2n extends We{constructor(){super("socket.polls.PollVote",[{no:1,name:"user_id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9}])}}const n2n=new t2n;class r2n extends We{constructor(){super("socket.polls.NewPollRequest",[{no:1,name:"question",kind:"scalar",T:9},{no:2,name:"options",kind:"scalar",repeat:2,T:9},{no:3,name:"anonymous",kind:"scalar",T:8},{no:4,name:"hide_votes",kind:"scalar",T:8},{no:5,name:"created_by",kind:"scalar",opt:!0,T:9},{no:6,name:"created_by_user_id",kind:"scalar",opt:!0,T:9}])}}const s2n=new r2n;class i2n extends We{constructor(){super("socket.polls.VotePollRequest",[{no:1,name:"poll_id",kind:"scalar",T:9},{no:2,name:"index",kind:"scalar",T:4,L:2}])}}const a2n=new i2n;class o2n extends We{constructor(){super("socket.polls.UpdatePollResponse",[{no:1,name:"poll",kind:"message",T:()=>Dpt}])}}const zle=new o2n;class l2n extends We{constructor(){super("socket.polls.GetPollsResponse",[{no:1,name:"polls",kind:"message",repeat:1,T:()=>Dpt}])}}const c2n=new l2n;class d2n extends We{constructor(){super("socket.recording.RecordingEvent",[{no:1,name:"recording_id",kind:"scalar",T:9},{no:2,name:"err_message",kind:"scalar",T:9},{no:3,name:"recording_type",kind:"enum",T:()=>["common.RecordingType",Yj]}])}}const nFe=new d2n;class u2n extends We{constructor(){super("google.protobuf.Timestamp",[{no:1,name:"seconds",kind:"scalar",T:3,L:0},{no:2,name:"nanos",kind:"scalar",T:5}])}now(){const e=this.create(),n=Date.now();return e.seconds=La.from(Math.floor(n/1e3)).toBigInt(),e.nanos=n%1e3*1e6,e}toDate(e){return new Date(La.from(e.seconds).toNumber()*1e3+Math.ceil(e.nanos/1e6))}fromDate(e){const n=this.create(),r=e.getTime();return n.seconds=La.from(Math.floor(r/1e3)).toBigInt(),n.nanos=r%1e3*1e6,n}internalJsonWrite(e,n){let r=La.from(e.seconds).toNumber()*1e3;if(r<Date.parse("0001-01-01T00:00:00Z")||r>Date.parse("9999-12-31T23:59:59Z"))throw new Error("Unable to encode Timestamp to JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");if(e.nanos<0)throw new Error("Unable to encode invalid Timestamp to JSON. Nanos must not be negative.");let s="Z";if(e.nanos>0){let i=(e.nanos+1e9).toString().substring(1);i.substring(3)==="000000"?s="."+i.substring(0,3)+"Z":i.substring(6)==="000"?s="."+i.substring(0,6)+"Z":s="."+i+"Z"}return new Date(r).toISOString().replace(".000Z",s)}internalJsonRead(e,n,r){if(typeof e!="string")throw new Error("Unable to parse Timestamp from JSON "+F2e(e)+".");let s=e.match(/^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})(?:Z|\.([0-9]{3,9})Z|([+-][0-9][0-9]:[0-9][0-9]))$/);if(!s)throw new Error("Unable to parse Timestamp from JSON. Invalid format.");let i=Date.parse(s[1]+"-"+s[2]+"-"+s[3]+"T"+s[4]+":"+s[5]+":"+s[6]+(s[8]?s[8]:"Z"));if(Number.isNaN(i))throw new Error("Unable to parse Timestamp from JSON. Invalid value.");if(i<Date.parse("0001-01-01T00:00:00Z")||i>Date.parse("9999-12-31T23:59:59Z"))throw new globalThis.Error("Unable to parse Timestamp from JSON. Must be from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59Z inclusive.");return r||(r=this.create()),r.seconds=La.from(i/1e3).toBigInt(),r.nanos=0,s[7]&&(r.nanos=parseInt("1"+s[7]+"0".repeat(9-s[7].length))-1e9),r}}new u2n;class h2n extends We{constructor(){super("common.BaseHubMessage",[{no:1,name:"event",kind:"scalar",T:5},{no:2,name:"id",kind:"scalar",T:9},{no:3,name:"peer_id",kind:"scalar",T:9},{no:4,name:"room_id",kind:"scalar",T:9},{no:5,name:"user_id",kind:"scalar",T:9},{no:6,name:"payload",kind:"scalar",T:12},{no:7,name:"error",kind:"scalar",opt:!0,T:8},{no:8,name:"sid",kind:"scalar",opt:!0,T:9},{no:9,name:"room_object_id",kind:"scalar",opt:!0,T:9},{no:10,name:"preset",kind:"scalar",opt:!0,T:9},{no:11,name:"use_start_session",kind:"scalar",opt:!0,T:8}])}}const fve=new h2n;class m2n extends We{constructor(){super("common.BulkedHubMessage",[{no:1,name:"messages",kind:"message",repeat:1,T:()=>fve}])}}new m2n;class f2n extends We{constructor(){super("common.CFWorkersResponse",[{no:1,name:"responses",kind:"message",repeat:1,T:()=>fve},{no:2,name:"broadcast_responses",kind:"message",repeat:1,T:()=>fve}])}}new f2n;const p2n=0,g2n=1,v2n=2,y2n=3,b2n=5,x2n={getPeerInfo:0,updatePeerInfo:1,getRoomPeersInfo:2,joinRoom:3,leaveRoom:4,getRoomInfo:5,updateRoomInfo:6,closeRoom:7,startedLivestream:8,stoppedLivestream:9,erroredLivestream:10,getStagePeers:11,getStageRequests:12,requestStageAccess:13,cancelStageRequest:14,grantStageAccess:15,denyStageAccess:16,roomPeerCount:17,joinStage:18,leaveStage:19,getConnectedRoomsDump:20,createConnectedRooms:21,deleteConnectedRooms:22,movePeers:23,transferPeer:24,movedPeer:25,connectedRoomsUpdated:26,connectedRoomsDeleted:27,getAllAddedParticipants:28,broadcastMessage:29,kick:30,kickAll:31,transcript:32,getWaitingRoomRequests:33,acceptWaitingRoomRequests:34,waitingRoomRequestAccepted:35,denyWaitingRoomRequests:36,waitingRoomRequestDenied:37,peerStageStatusUpdate:38,broadcastToEntity:39,recordingStarted:40,recordingStopped:41,recordingPaused:42,getRoomStageState:43,livestreamingInvoked:44},w2n={getMessages:0,sendMessageToRoom:1,sendMessageToPeers:2,editMessage:3,deleteMessage:4,getPaginatedMessages:5,searchChannelMessages:7,pinMessage:10},k2n={getPlugins:0,addPlugin:1,enablePluginForRoom:2,disablePluginForPeers:3,enablePluginForPeers:4,disablePluginForRoom:5,removePlugin:6,customPluginEventToRoom:7,customPluginEventToPeers:8,storeInsertKeys:9,storeGetKeys:10,storeDeleteKeys:11,storeDelete:12},S2n={createPoll:0,getPolls:1,votePoll:2,updatePoll:3},$pt={unknown:0,createWebRTCTransport:1,produce:2,consume:3,toggleProducer:4,toggleConsumer:5,closeProducer:6,closeConsumer:7,updateConsumersSimulcastConfig:8,joinRoom:16,leaveRoom:17,selectedPeer:18,globalPinPeer:19,selfJoinComplete:20,peerJoinedBroadcast:25,peerLeaveBroadcast:26,peerProducerCreateBroadcast:27,peerProducerToggleBroadcast:28,peerProducerCloseBroadcast:29,globalPeerPinBroadcast:30,recordingStartedBroadcast:31,recordingStoppedBroadcast:32,peerDisplayNameEditBroadcast:33,mediaRoomTerminationBroadcastResponse:36,selectedPeerDiff:40,renegotiateSessionDescription:50,errorResponse:60,kickPeer:90,kickAll:91,changeDisplayName:92,hostControlPeer:93,hostControlAllPeers:94,audioActivity:100},C2n={getUserPresets:0,updateUserPreset:1};function S7(t,e){return Object.keys(e).reduce((n,r)=>(n[r]=(t<<16)+e[r],n),{})}function Opt(t,e){return Object.keys(t).reduce((n,r)=>(n[r]=e|t[r],n),{})}const Rn=S7(p2n,x2n),Pc=S7(g2n,w2n),Bb=S7(v2n,k2n),Ub=S7(y2n,S2n),qw=Opt($pt,16777216),tg=Opt($pt,50331648),UG=S7(b2n,C2n);var j2n=Object.defineProperty,E2n=Object.getOwnPropertyDescriptor,xS=(t,e,n,r)=>{for(var s=E2n(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&j2n(e,n,s),s},lf=(t=>(t[t.TEXT=0]="TEXT",t[t.IMAGE=1]="IMAGE",t[t.FILE=2]="FILE",t[t.CUSTOM=3]="CUSTOM",t))(lf||{}),Ym,w4;class A0{constructor(e,n){Se(this,Ym,void 0),Se(this,w4,void 0),Te(this,Ym,n),Te(this,w4,e)}get telemetry(){return L(this,w4).getValue("telemetry")}get logger(){return L(this,w4).getValue("logger")}getChatMessages(){return L(this,Ym).sendMessagePromise(Pc.getMessages)}getChatMessagesPaginated(e,n,r,s){return me(this,null,function*(){const i=en({timeStamp:e,size:n,from:0,reversed:r},s&&{filters:{filters:s}}),o=yield L(this,Ym).sendMessagePromise(Pc.getPaginatedMessages,LCn.toBinary(i));return o.payload?$Cn.fromBinary(o.payload):{messages:[],next:!1}})}sendMessageToRoom(e,n){const r={payloadType:n,payload:e};L(this,Ym).sendMessage(Pc.sendMessageToRoom,BCn.toBinary(r))}sendMessageToPeers(e,n,r){const s={payloadType:n,peerIds:r,payload:e};L(this,Ym).sendMessage(Pc.sendMessageToPeers,VCn.toBinary(s))}sendMessage(e,n,r){if(r&&r.length>0){this.sendMessageToPeers(e,n,r);return}this.sendMessageToRoom(e,n)}editMessage(e,n,r,s){return me(this,null,function*(){const i={chatId:e,payloadType:r,payload:n};s!==void 0&&(i.pinned=s);const o=yield L(this,Ym).sendMessagePromise(Pc.editMessage,KCn.toBinary(i));return yz.fromBinary(o.payload).message})}deleteMessage(e){return me(this,null,function*(){const n={chatId:e},r=yield L(this,Ym).sendMessagePromise(Pc.deleteMessage,ejn.toBinary(n));return{id:bz.fromBinary(r.payload).chatId}})}searchMessages(e,n){return me(this,null,function*(){var r,s,i,o;const l={searchTerm:e,timeStamp:(r=n.timestamp)!=null?r:Date.now(),size:(s=n.limit)!=null?s:75,from:(i=n.offset)!=null?i:0,reversed:(o=n.reversed)!=null?o:!0};try{const c=yield L(this,Ym).sendMessagePromise(Pc.searchChannelMessages,rjn.toBinary(l));return Lpt.fromBinary(c.payload).messages}catch{return[]}})}setPinState(e,n){return me(this,null,function*(){const r={chatId:e,pinned:n},s=yield L(this,Ym).sendMessagePromise(Pc.pinMessage,QCn.toBinary(r));return vz.fromBinary(s.payload)})}on(e,n){let r,s;switch(e){case Pc.sendMessageToRoom:{r=Fle.fromBinary.bind(Fle),s=Fle.create();break}case Pc.sendMessageToPeers:{r=Ble.fromBinary.bind(Ble),s=Ble.create();break}case Pc.editMessage:{r=yz.fromBinary.bind(yz),s=yz.create();break}case Pc.pinMessage:{r=vz.fromBinary.bind(vz),s=vz.create();break}case Pc.deleteMessage:{r=bz.fromBinary.bind(bz),s=bz.create();break}}if(!r){this.logger.warn(`ChatSocketHandler::Event ${e} is not recognized`);return}L(this,Ym).on(e,({payload:i})=>{let o=s;try{o=r(i)}catch(l){this.logger.error("chatSocketHandler::on::binary_decode_error",{error:l})}return n(o)})}}Ym=new WeakMap,w4=new WeakMap;xS([ut.trace("SocketService.getChatMessages")],A0.prototype,"getChatMessages");xS([ut.trace("SocketService.getChatMessagesPaginated")],A0.prototype,"getChatMessagesPaginated");xS([ut.trace("SocketService.sendMessageToRoom")],A0.prototype,"sendMessageToRoom");xS([ut.trace("SocketService.sendMessageToPeers")],A0.prototype,"sendMessageToPeers");xS([ut.trace("SocketService.sendMessage")],A0.prototype,"sendMessage");xS([ut.trace("SocketService.editMessage")],A0.prototype,"editMessage");xS([ut.trace("SocketService.deleteMessage")],A0.prototype,"deleteMessage");xS([ut.trace("SocketService.searchMessages")],A0.prototype,"searchMessages");function N2n(t){return t.replace(/([-_]\w)/g,e=>e[1].toUpperCase())}function gy(t){if(!t||typeof t!="object")return t;if(Array.isArray(t))return t.map(n=>gy(n));const e={};return Object.keys(t).forEach(n=>{const r=O2e(n)?n:N2n(n);e[r]=gy(t[n])}),e}function T2n(t){return t.replace(/[A-Z]/g,e=>`_${e.toLowerCase()}`)}function Fpt(t){if(!t||typeof t!="object")return t;if(Array.isArray(t))return t.map(n=>Fpt(n));const e={};return Object.keys(t).forEach(n=>{const r=O2e(n)?n:T2n(n);e[r]=t[n]}),e}class pve extends Error{constructor(e){var n=(...r)=>{super(...r),xe(this,"status"),xe(this,"response"),xe(this,"isTimeout")};e instanceof Error?(n(e.message),this.stack=e.stack,this.isTimeout=e.name==="AbortError"):(n(`Request failed with status ${e.status}`),this.status=e.status,this.response=e,this.isTimeout=!1),this.name="RequestError"}get isHttpError(){return this.status!==void 0}get isNetworkError(){return this.status===void 0&&!this.isTimeout}}class rFe{constructor(e){xe(this,"defaults"),this.defaults={baseURL:e.baseURL,headers:{common:{}},timeout:e.timeout,retry:e.retry,retryDelay:e.retryDelay}}buildURL(e,n){const{baseURL:r}=this.defaults,s=e.startsWith("http")?e:`${r}${e.startsWith("/")?e:`/${e}`}`;if(n){const i=new URLSearchParams;return Object.entries(n).forEach(([o,l])=>{i.append(o,l)}),`${s}${s.includes("?")?"&":"?"}${i.toString()}`}return s}request(e){return me(this,null,function*(){var n;const r=((n=e.method)==null?void 0:n.toUpperCase())||"GET",s=this.buildURL(e.url||"",e.params),i=en(en({},this.defaults.headers.common),e.headers);r!=="GET"&&r!=="HEAD"&&e.data&&!i["Content-Type"]&&(i["Content-Type"]="application/json");const o=i["Content-Type"]==="application/json"?JSON.stringify(e.data):e.data,l={method:r,headers:i,body:r!=="GET"&&r!=="HEAD"&&e.data?o:void 0},c=e.timeout||this.defaults.timeout,d=e.retry!==void 0?e.retry:this.defaults.retry,u=e.retryDelay||this.defaults.retryDelay;try{const h=new AbortController,m=setTimeout(()=>h.abort(),c);l.signal=h.signal;const f=yield fetch(s,l);clearTimeout(m);let p=null;const g=f.headers.get("content-type");g&&g.includes("application/json")?p=yield f.json():p=yield f.text();const v={};f.headers.forEach((x,w)=>{v[w]=x});const b={data:p,status:f.status,statusText:f.statusText,headers:v,config:e};if(!f.ok)throw b;return b}catch(h){if(h instanceof Error&&d>0)return yield new Promise(m=>setTimeout(m,u)),this.defaults.baseURL===wj.apiBase.prod?this.defaults.baseURL=wj.apiBase.prodAlternate:this.defaults.baseURL===wj.apiBase.prodAlternate&&(this.defaults.baseURL=wj.apiBase.prod),this.request(Dr(en({},e),{retry:d-1}));throw h}})}get(e){return me(this,arguments,function*(n,r={}){return this.request(Dr(en({},r),{method:"GET",url:n}))})}post(e,n){return me(this,arguments,function*(r,s,i={}){return this.request(Dr(en({},i),{method:"POST",url:r,data:s}))})}put(e,n){return me(this,arguments,function*(r,s,i={}){return this.request(Dr(en({},i),{method:"PUT",url:r,data:s}))})}}const _2n=3,A2n=30,P2n=8e3;class R2n{constructor(e,n){xe(this,"fetchClient"),xe(this,"requests"),xe(this,"roomName"),xe(this,"roomUUID"),xe(this,"authToken"),xe(this,"organizationId"),xe(this,"iceServers"),xe(this,"userDetails"),xe(this,"roomDetails"),xe(this,"context"),this.context=e;const{timeout:r=P2n,retry:s=_2n,retryDelay:i=A2n,baseURL:o=wj.apiBase.prod,authToken:l,cachedUserDetails:c}=n||{};this.iceServers=c==null?void 0:c.iceServers,this.userDetails=c==null?void 0:c.userDetails,this.roomDetails=c==null?void 0:c.roomDetails,this.requests=new rFe({baseURL:o,timeout:r,retry:s,retryDelay:i,responseType:"json"}),this.fetchClient=new rFe({baseURL:"",timeout:r,retry:s,retryDelay:i,responseType:"json"}),this.setAuthToken(l,{bearer:!0});const d=this.requests.request.bind(this.requests);this.requests.request=u=>me(this,null,function*(){var h,m,f,p,g;const v=e.getValue("telemetry");try{v.injectContext(this.requests.defaults.headers.common);const b=yield d(u);return u.url!==v.logsEndpoint&&this.logger.debug("xhr::fetch",{networkCall:{status:b.status,statusText:b.statusText,baseURL:u.baseURL||this.requests.defaults.baseURL,url:u.url,method:u.method}}),b}catch(b){if(!b)throw new _t("Unknown network error occurred","0011");if(b instanceof _t||b instanceof pve)throw b;((h=b.config)==null?void 0:h.url)!==v.logsEndpoint&&this.logger.error("xhr::fetch",{error:b,networkCall:{status:b.status,statusText:b.statusText,baseURL:((m=b.config)==null?void 0:m.baseURL)||this.requests.defaults.baseURL,url:(f=b.config)==null?void 0:f.url,retries:(p=b.config)==null?void 0:p.retry,method:(g=b.config)==null?void 0:g.method,isOnline:navigator.onLine?"online":"offline"}});const x=b instanceof Error&&b.message||"Network request failed";throw new _t(x,"0011"),new pve(b)}})}get peerId(){return this.context.getValue("peerId")}get logger(){return this.context.getValue("logger")}setAuthToken(e,n){const{bearer:r}=n||{};this.authToken=e,this.requests.defaults.headers.common.Authorization=r?`Bearer ${e}`:e}setHeader(e,n){this.requests.defaults.headers.common[e]=n}setRoomName(e){this.roomName=e}setRoomUUID(e){this.roomUUID=e}setOrganizationId(e){this.organizationId=e}}var I2n=Object.defineProperty,M2n=Object.getOwnPropertyDescriptor,P0=(t,e,n,r)=>{for(var s=M2n(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&I2n(e,n,s),s};class qy extends R2n{constructor(e,n){super(e,n),xe(this,"telemetry"),this.telemetry=e.getValue("telemetry"),this.setHeader("x-realtimekit-version",e.getValue("sdkVersion"))}getICEServers(){return me(this,null,function*(){if(this.iceServers)return this.iceServers;const{success:e,iceServers:n}=(yield this.requests.get("/iceservers")).data;if(e)return(n==null?void 0:n.length)>0&&(this.iceServers=n),n})}getPresignedUrls(e){return me(this,null,function*(){const n=bR(this.context,"chat_upload_expiry"),r={roomUUID:this.roomUUID,filename:e,expiry:typeof n=="number"?n:void 0},{get_location:s,put_location:i}=(yield this.requests.post("/v2/meetings/chat-upload",r)).data.data;return{getLocation:s,putLocation:i}})}uploadFile(e,n){return me(this,null,function*(){if(navigator.isReactNative&&"uri"in e)try{yield fetch(n,{method:"PUT",headers:{"Content-Type":"application/octet-stream"},body:{uri:e.uri,name:e.name}})}catch(r){this.logger.error(`sendFileMessage::${r}`)}else yield this.fetchClient.put(n,e,{headers:{"Content-Type":e.type}})})}startLivestreaming(e){return me(this,arguments,function*({manualIngestion:n}){const r=gy(yield this.requests.post(`/v2/meetings/${this.context.getValue("meetingId")}/livestreams`,{manual_ingest:!!n})).data.data;return{playbackUrl:r.playbackUrl,status:r.status,manualIngest:r.manualIngest,ingestionCredentials:r.streamKey?{ingestionServer:r.ingestServer,streamKey:r.streamKey}:null}})}stopLivestreaming(){return me(this,null,function*(){return this.requests.post(`/v2/meetings/${this.context.getValue("meetingId")}/active-livestream/stop`)})}getActiveLivestream(){return me(this,null,function*(){const e=gy((yield this.requests.get(`/v2/meetings/${this.context.getValue("meetingId")}/active-livestream`)).data.data);return{playbackUrl:e.playbackUrl,status:e.status,manualIngest:e.manualIngest,ingestionCredentials:e.streamKey?{ingestionServer:e.ingestServer,streamKey:e.streamKey}:null}})}getUserDetails(){return me(this,null,function*(){if(this.userDetails)return this.userDetails;const e=(yield this.requests.get("v2/internals/participant-details")).data.data;return gy(e)})}startRecording(e,n){return me(this,null,function*(){return(yield this.requests.post("/v2/recordings",Dr(en({},Fpt(e)),{meeting_id:this.context.getValue("meetingId"),allow_multiple_recordings:!!n}))).data.data.id})}updateRecording(e,n){return me(this,null,function*(){return this.requests.put(`v2/recordings/${e}`,{action:n})})}getActiveRecording(){return me(this,null,function*(){const{status:e,id:n}=(yield this.requests.get(`v2/recordings/active-recording/${this.context.getValue("meetingId")}`)).data.data;return{status:e,id:n}})}getActiveTranscript(){return me(this,null,function*(){const{transcript_download_url:e}=(yield this.requests.get(`v2/meetings/${this.context.getValue("meetingId")}/active-transcript`)).data.data;try{return{transcript:(yield this.fetchClient.get(e)).data}}catch{throw new _t("Cant fetch transcript s3 url","1801")}})}}P0([ut.trace("APIClient.getICEServers")],qy.prototype,"getICEServers");P0([ut.trace("APIClient.startLivestreaming")],qy.prototype,"startLivestreaming");P0([ut.trace("APIClient.stopLivestreaming")],qy.prototype,"stopLivestreaming");P0([ut.trace("APIClient.getActiveLivestream")],qy.prototype,"getActiveLivestream");P0([ut.trace("APIClient.getUserDetails")],qy.prototype,"getUserDetails");P0([ut.trace("APIClient.startRecording")],qy.prototype,"startRecording");P0([ut.trace("APIClient.stopRecording")],qy.prototype,"updateRecording");P0([ut.trace("APIClient.getActiveRecording")],qy.prototype,"getActiveRecording");P0([ut.trace("APIClient.getActiveTranscript")],qy.prototype,"getActiveTranscript");let gve;function L2n(t,e){return gve=new qy(t,e),gve}function dh(){return gve}const EI={maxInvocations:5,period:1};function $m(t,e){return function(n,r,s){const i=s.value;let o=0,l=Date.now();return s.value=function(...c){const d=Date.now(),u=e?this[e]:t;if(d-l>u.period*1e3&&(l=d,o=0),o>=u.maxInvocations)throw new _t(`Method rate limit ${u.maxInvocations} invocations/${u.period}sec exceeded`,"0013");return o+=1,i.apply(this,c)},s}}var D2n=Object.defineProperty,$2n=Object.getOwnPropertyDescriptor,Ky=(t,e,n,r)=>{for(var s=r>1?void 0:r?$2n(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&D2n(e,n,s),s};const O2n=["text","image","file","custom","poll"],zG={maxInvocations:180,period:60};var di,ZN,Pd,BL,Vle,sFe,xz,Hle,iFe;let Vf=(iFe=class extends Dm{constructor(t,e,n,r){const s=t.getValue("logger");super(s),Se(this,Vle),Se(this,xz),xe(this,"messages"),Se(this,di,void 0),Se(this,ZN,void 0),Se(this,Pd,void 0),Se(this,BL,void 0),xe(this,"maxTextLimit",2e3),Te(this,BL,t),Te(this,Pd,e),Te(this,di,n),Te(this,ZN,r),this.messages=[]}get telemetry(){return L(this,BL).getValue("telemetry")}setMaxTextLimit(t){this.maxTextLimit=t}sendMessageInternal(t,e){return me(this,null,function*(){switch(t.type){case"text":{yield this.sendTextMessageInternal(t.message,e);break}case"image":yield this.sendImageMessageInternal(t.image,e);break;case"file":yield this.sendFileMessageInternal(t.file,e);break;default:this.logger.error("sendMessage::message_type_not_supported",{chat:{messageType:t.type}});break}})}sendTextMessageInternal(t,e){return me(this,null,function*(){var n,r,s,i,o,l;if(t.length>this.maxTextLimit)throw new _t("Max character limit breached","0503");if(e&&e.length>0){if(!((n=L(this,di).permissions)!=null&&n.chatPrivate.canSend)||!((r=L(this,di).permissions)!=null&&r.chatPrivate.text))throw this.logger.error("sendTextMessage::private_chat_permission_denied"),new _t("Could not send message to private chat.","0501")}else if(!((i=(s=L(this,di).permissions)==null?void 0:s.chatPublic)!=null&&i.canSend)||!((l=(o=L(this,di).permissions)==null?void 0:o.chatPublic)!=null&&l.text))throw this.logger.error("sendTextMessage::public_chat_permission_denied"),new _t("Could not send message to public chat.","0501");if(!t)throw this.logger.error("sendTextMessage::message_can_not_be_empty"),new _t("Message can not be empty.","0502");let c=[];e&&e.length>0&&(e.push(L(this,di).id),c=L(this,ZN).joined.toArray().filter(d=>e.includes(d.id)).map(d=>d.userId),c.push(L(this,di).userId)),L(this,Pd).sendMessage(t,lf.TEXT,e)})}sendImageMessageInternal(t,e){return me(this,null,function*(){var n,r,s,i,o,l;if(e&&e.length>0){if(!((n=L(this,di).permissions)!=null&&n.chatPrivate.canSend)||!((r=L(this,di).permissions)!=null&&r.chatPrivate.files)){this.logger.error("sendImageMessage::private_chat_permission_denied");return}}else if(!((i=(s=L(this,di).permissions)==null?void 0:s.chatPublic)!=null&&i.canSend)||!((l=(o=L(this,di).permissions)==null?void 0:o.chatPublic)!=null&&l.files)){this.logger.error("sendImageMessage::permission_denied");return}if(!t){this.logger.error("sendImageMessage::required_argument_image_can_not_be_empty");return}if(!["image/gif","image/jpeg","image/png"].includes(t.type)){this.logger.error("sendImageMessage::image_type_not_supported",{chat:{imageType:t.type}});return}try{const c=dh(),{getLocation:d,putLocation:u}=yield c.getPresignedUrls(t.name);yield c.uploadFile(t,u);let h=[];e&&e.length>0&&(e.push(L(this,di).id),h=L(this,ZN).joined.toArray().filter(m=>e.includes(m.id)).map(m=>m.userId),h.push(L(this,di).userId)),L(this,Pd).sendMessage(d,lf.IMAGE,e)}catch{throw new _t("Error sending image message.","0500",this.logger)}})}sendFileMessageInternal(t,e){return me(this,null,function*(){var n,r,s,i,o,l;if(e&&e.length>0){if(!((n=L(this,di).permissions)!=null&&n.chatPrivate.canSend)||!((r=L(this,di).permissions)!=null&&r.chatPrivate.files)){this.logger.error("sendFileMessage::private_chat_permission_denied");return}}else if(!((i=(s=L(this,di).permissions)==null?void 0:s.chatPublic)!=null&&i.canSend)||!((l=(o=L(this,di).permissions)==null?void 0:o.chatPublic)!=null&&l.files)){this.logger.error("sendFileMessage::permission_denied");return}if(!t){this.logger.error("sendFileMessage::required_argument_file_can_not_be_empty");return}try{const c=dh(),{getLocation:d,putLocation:u}=yield c.getPresignedUrls(t.name);yield c.uploadFile(t,u);let h=[];e&&e.length>0&&(e.push(L(this,di).id),h=L(this,ZN).joined.toArray().filter(f=>e.includes(f.id)).map(f=>f.userId),h.push(L(this,di).userId));const m=JSON.stringify({link:d,name:t.name,size:"size"in t?t.size:0});L(this,Pd).sendMessage(m,lf.FILE,e)}catch{throw new _t("Error sending file message.","0500",this.logger)}})}get rateLimits(){return zG}updateRateLimits(t,e){zG.maxInvocations=t,zG.period=e}sendTextMessage(t,e){return me(this,null,function*(){return this.sendTextMessageInternal(t,e)})}sendCustomMessage(t,e){return me(this,null,function*(){var n,r,s,i,o,l,c,d,u,h,m,f,p,g,v;if(e&&e.length>0){if(!((n=L(this,di).permissions)!=null&&n.chatPrivate.canSend)||!((r=L(this,di).permissions)!=null&&r.chatPrivate.files)||!((s=L(this,di).permissions)!=null&&s.chatPrivate.text)){this.logger.error("sendCustomMessage::private_chat_permission_denied");return}}else if(!((o=(i=L(this,di).permissions)==null?void 0:i.chatPublic)!=null&&o.canSend)||!((c=(l=L(this,di).permissions)==null?void 0:l.chatPublic)!=null&&c.files)||!((u=(d=L(this,di).permissions)==null?void 0:d.chatPublic)!=null&&u.text)){this.logger.error("sendCustomMessage::permission_denied");return}const b=w=>me(this,null,function*(){try{if(typeof w=="string")return{link:w};const k=dh(),{getLocation:S,putLocation:C}=yield k.getPresignedUrls(w.name);return yield k.uploadFile(w,C),{link:S,type:w.type,name:w.name,size:w.size}}catch{throw new _t("Error sending image message.","0500",this.logger)}}),x=Dr(en({},t),{files:yield Promise.all((m=(h=t.files)!=null?h:[])==null?void 0:m.map(w=>me(this,null,function*(){return b(w)}))),images:yield Promise.all((p=(f=t.images)!=null?f:[])==null?void 0:p.map(w=>me(this,null,function*(){return b(w)}))),videos:yield Promise.all((v=(g=t.videos)!=null?g:[])==null?void 0:v.map(w=>me(this,null,function*(){return b(w)})))});L(this,Pd).sendMessage(JSON.stringify(x),lf.CUSTOM,e)})}sendImageMessage(t,e){return me(this,null,function*(){return this.sendImageMessageInternal(t,e)})}sendFileMessage(t,e){return me(this,null,function*(){return this.sendFileMessageInternal(t,e)})}sendMessage(t,e){return me(this,null,function*(){return this.sendMessageInternal(t,e)})}editTextMessage(t,e){return me(this,null,function*(){var n,r,s,i;if(!((r=(n=L(this,di).permissions)==null?void 0:n.chatPublic)!=null&&r.canSend)||!((i=(s=L(this,di).permissions)==null?void 0:s.chatPublic)!=null&&i.text)){this.logger.error("editTextMessage::permission_denied");return}if(!e){this.logger.error("editTextMessage::message_can_not_be_empty");return}L(this,Pd).editMessage(t,e,lf.TEXT)})}editImageMessage(t,e){return me(this,null,function*(){var n,r,s,i;if(!((r=(n=L(this,di).permissions)==null?void 0:n.chatPublic)!=null&&r.canSend)||!((i=(s=L(this,di).permissions)==null?void 0:s.chatPublic)!=null&&i.files)){this.logger.error("editImageMessage::permission_denied");return}if(!e){this.logger.error("editImageMessage::required_argument_image_can_not_be_empty");return}if(!["image/gif","image/jpeg","image/png"].includes(e.type)){this.logger.error("sendImageMessage::image_type_not_supported",{chat:{imageType:e.type}});return}try{const o=dh(),{getLocation:l,putLocation:c}=yield o.getPresignedUrls(e.name);yield o.uploadFile(e,c),L(this,Pd).editMessage(t,l,lf.IMAGE)}catch{throw new _t("Error editing image message.","0500",this.logger)}})}editFileMessage(t,e){return me(this,null,function*(){var n,r,s,i;if(!((r=(n=L(this,di).permissions)==null?void 0:n.chatPublic)!=null&&r.canSend)||!((i=(s=L(this,di).permissions)==null?void 0:s.chatPublic)!=null&&i.files)){this.logger.error("sendFileMessage::permission_denied");return}if(!e){this.logger.error("sendFileMessage::required_argument_file_can_not_be_empty");return}try{const o=dh(),{getLocation:l,putLocation:c}=yield o.getPresignedUrls(e.name);yield o.uploadFile(e,c),L(this,Pd).editMessage(t,JSON.stringify({link:l,name:e.name,size:"size"in e?e.size:0}),lf.FILE)}catch{throw new _t("Error editing file message.","0500",this.logger)}})}editMessage(t,e){return me(this,null,function*(){switch(e.type){case"text":{this.editTextMessage(t,e.message);break}case"image":{this.editImageMessage(t,e.image);break}case"file":{this.editFileMessage(t,e.file);break}default:{this.logger.error("editMessage::message_type_not_supported",{chat:{messageType:e.type}});break}}})}deleteMessage(t){return me(this,null,function*(){L(this,Pd).deleteMessage(t)})}pin(t){return me(this,null,function*(){if(!L(this,xz,Hle))throw new _t("Can`t pin message without joining room","0505");try{yield L(this,Pd).setPinState(t,!0)}catch{throw new _t(`No message found with id: ${t}`,"0504")}})}unpin(t){return me(this,null,function*(){if(!L(this,xz,Hle))throw new _t("Can`t unpin message without joining room","0505");try{yield L(this,Pd).setPinState(t,!1)}catch{throw new _t(`No message found with id: ${t}`,"0504")}})}fetchPublicMessages(t){return me(this,arguments,function*({timestamp:e=new Date().getTime(),limit:n,direction:r="after"}){return(yield L(this,Pd).getChatMessagesPaginated(e,n,r==="before")).messages.map(s=>UD.formatSocketPeerMessage(s))})}fetchPrivateMessages(t){return me(this,arguments,function*({timestamp:e=new Date().getTime(),limit:n,direction:r="after",userId:s}){return(yield L(this,Pd).getChatMessagesPaginated(e,n,r==="before",{oneofKind:"userId",userId:s})).messages.map(i=>UD.formatSocketPeerMessage(i))})}fetchPinnedMessages(t){return me(this,arguments,function*({timestamp:e=new Date().getTime(),limit:n,direction:r="after"}){return(yield L(this,Pd).getChatMessagesPaginated(e,n,r==="before",{oneofKind:"pinned",pinned:!0})).messages.map(s=>UD.formatSocketPeerMessage(s))})}},di=new WeakMap,ZN=new WeakMap,Pd=new WeakMap,BL=new WeakMap,Vle=new WeakSet,sFe=function(){return L(this,BL).getValue("connectionHandler")},xz=new WeakSet,Hle=function(){return L(this,Vle,sFe).socketJoined===!0},iFe);Ky([ut.trace("Chat.sendTextMessage"),$m(zG)],Vf.prototype,"sendTextMessage",1);Ky([ut.trace("Chat.sendImageMessage"),$m({maxInvocations:20,period:60})],Vf.prototype,"sendImageMessage",1);Ky([ut.trace("Chat.sendFileMessage"),$m({maxInvocations:20,period:60})],Vf.prototype,"sendFileMessage",1);Ky([ut.trace("Chat.sendMessage"),$m({maxInvocations:180,period:60})],Vf.prototype,"sendMessage",1);Ky([ut.trace("Chat.editTextMessage")],Vf.prototype,"editTextMessage",1);Ky([ut.trace("Chat.editImageMessage")],Vf.prototype,"editImageMessage",1);Ky([ut.trace("Chat.editFileMessage")],Vf.prototype,"editFileMessage",1);Ky([ut.trace("Chat.editMessage")],Vf.prototype,"editMessage",1);Ky([ut.trace("Chat.deleteMessage")],Vf.prototype,"deleteMessage",1);Vf=Ky([tu("0500")],Vf);var F2n=Object.defineProperty,B2n=Object.getOwnPropertyDescriptor,U2n=(t,e,n,r)=>{for(var s=B2n(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&F2n(e,n,s),s},JN,aFe;const Tw=(aFe=class{constructor(t,e,n,r){xe(this,"chat"),xe(this,"chatSocketHandler"),xe(this,"self"),Se(this,JN,void 0),Te(this,JN,t),this.chatSocketHandler=e,this.chat=new Vf(t,e,n,r),this.self=n,this.setupEvents()}get telemetry(){return L(this,JN).getValue("telemetry")}get logger(){return L(this,JN).getValue("logger")}static init(t,e,n,r){return me(this,null,function*(){return new Tw(t,e,n,r)})}static formatMessage(t){return Dr(en({},t),{time:new Date(t.time),type:O2n[t.type]})}static formatSocketPeerMessage(t){const e=t.createdAt*1e3,n={displayName:t.displayName,id:t.chatId,time:e,timeMs:t.createdAtMs,type:t.payloadType,isEdited:t.isEdited,userId:t.userId,targetUserIds:t.targetUserIds,message:"",link:"",name:"",html:"",images:[],videos:[],files:[],size:0,pinned:t.pinned};switch(n.type){case lf.TEXT:{n.message=t.payload;break}case lf.IMAGE:{n.link=t.payload;break}case lf.FILE:{const{link:r,name:s,size:i}=JSON.parse(t.payload);n.link=r,n.name=s,n.size=i;break}case lf.CUSTOM:{const{html:r,images:s,message:i,videos:o,files:l}=JSON.parse(t.payload);n.message=i,n.html=r,n.images=s,n.videos=o,n.files=l;break}}return Tw.formatMessage(n)}getChatMessages(){return me(this,null,function*(){if(this.self.config.viewType==="LIVESTREAM")return;const t=yield this.chatSocketHandler.getChatMessages();if(!(t!=null&&t.payload))return;const e=Lpt.fromBinary(t.payload).messages;this.chat.messages=e.map(n=>Tw.formatSocketPeerMessage(n))})}setupEvents(){L(this,JN).getValue("peerSessionStore").on(Et.SOCKET_SERVICE_ROOM_JOINED,()=>me(this,null,function*(){this.getChatMessages()})),this.chatSocketHandler.on(Pc.sendMessageToRoom,t=>{if(!t.message)return;const e=Tw.formatSocketPeerMessage(t.message);this.chat.messages=[...this.chat.messages,e],this.chat.emit("chatUpdate",{action:"add",message:e,messages:this.chat.messages})}),this.chatSocketHandler.on(Pc.sendMessageToPeers,t=>{const e=Tw.formatSocketPeerMessage(t.message);this.chat.messages=[...this.chat.messages,e],this.chat.emit("chatUpdate",{action:"add",message:e,messages:this.chat.messages})}),this.chatSocketHandler.on(Pc.editMessage,t=>{if(!t.message)return;const e=Tw.formatSocketPeerMessage(t.message),n=this.chat.messages.findIndex(r=>r.id===e.id);n!==-1&&(this.chat.messages[n]=e),this.chat.emit("chatUpdate",{action:"edit",message:e,messages:this.chat.messages})}),this.chatSocketHandler.on(Pc.deleteMessage,t=>{const e=this.chat.messages.findIndex(r=>r.id===t.chatId);let n={id:t.chatId};e!==-1&&([n]=this.chat.messages.splice(e,1)),this.chat.emit("chatUpdate",{action:"delete",message:n,messages:this.chat.messages})}),this.chatSocketHandler.on(Pc.pinMessage,t=>{const e=this.chat.messages.findIndex(r=>r.id===t.chatId),n=Tw.formatSocketPeerMessage(t.message);e!==-1&&(this.chat.messages[e]=n),this.chat.emit("chatUpdate",{action:"edit",message:n,messages:this.chat.messages}),t.pinned?this.chat.emit("pinMessage",{message:n,messages:this.chat.messages}):this.chat.emit("unpinMessage",{message:n,messages:this.chat.messages})})}},JN=new WeakMap,aFe);let UD=Tw;U2n([ut.trace("ChatController.setupEvents")],UD.prototype,"setupEvents");var z2n=(t,e,n,r)=>{for(var s=e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(s)||s);return s},Gle,oFe,Wle,lFe,UL,zL,wz,cFe;let vve=(cFe=class extends Dm{constructor(t,e,n){const r=t.getValue("logger");super(r),Se(this,Gle),Se(this,Wle),xe(this,"items"),Se(this,UL,void 0),Se(this,zL,void 0),Se(this,wz,void 0),Te(this,wz,t),Te(this,UL,e),Te(this,zL,n),this.items=[]}create(t,e,n=!1,r=!1){return me(this,null,function*(){if(!L(this,Wle,lFe))throw new _t("Can't create polls without joining room","0705");if(!L(this,UL).permissions.polls.canCreate){this.logger.error("Polls::create::permission_denied");return}if(!t||!e){this.logger.error("Polls::question_and_options_can_not_be_empty",{polls:{hasQuestion:!!t,optionsLength:e==null?void 0:e.length}});return}if(e.length<2){this.logger.error("Polls::there_must_be_at_least_two_options",{polls:{hasQuestion:!!t,optionsLength:e.length}});return}yield L(this,zL).createPoll(t,e,n,r)})}vote(t,e){return me(this,null,function*(){if(!L(this,UL).permissions.polls.canVote){this.logger.error("Polls::vote::permission_denied");return}yield L(this,zL).votePoll(t,e)})}},Gle=new WeakSet,oFe=function(){return L(this,wz).getValue("connectionHandler")},Wle=new WeakSet,lFe=function(){var t;return((t=L(this,Gle,oFe))==null?void 0:t.socketJoined)===!0},UL=new WeakMap,zL=new WeakMap,wz=new WeakMap,cFe);vve=z2n([tu("0700")],vve);var V2n=Object.defineProperty,H2n=Object.getOwnPropertyDescriptor,G2n=(t,e,n,r)=>{for(var s=H2n(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&V2n(e,n,s),s},YS,VL,XN,dFe;const r_=(dFe=class{constructor(t,e,n){xe(this,"polls"),Se(this,YS,void 0),Se(this,VL,void 0),Se(this,XN,void 0),this.polls=new vve(t,e,n),Te(this,VL,e),Te(this,YS,t),Te(this,XN,n),this.setupEvents()}get telemetry(){return L(this,YS).getValue("telemetry")}get logger(){return L(this,YS).getValue("logger")}static init(t,e,n){return me(this,null,function*(){return new r_(t,e,n)})}canViewPolls(){return L(this,VL).permissions.polls.canView}setupEvents(){const t={[Ub.createPoll]:r=>{r.poll&&this.updatePoll(r_.formatSocketServicePoll(r.poll))},[Ub.updatePoll]:r=>{r.poll&&this.updatePoll(r_.formatSocketServicePoll(r.poll))},[Ub.votePoll]:r=>{r.poll&&this.updatePoll(r_.formatSocketServicePoll(r.poll))}},e=()=>{L(this,YS).getValue("peerSessionStore").on(Et.SOCKET_SERVICE_ROOM_JOINED,()=>{this.getPolls()}),Object.keys(t).map(Number).forEach(r=>{L(this,XN).on(r,t[r])})},n=()=>{L(this,YS).getValue("peerSessionStore").on(Et.SOCKET_SERVICE_ROOM_JOINED,()=>{this.getPolls()}),Object.keys(t).map(Number).forEach(r=>{L(this,XN).removeListeners(r)})};L(this,VL).permissions.on("permissionsUpdate",r=>me(this,null,function*(){var s;r!=null&&r.polls&&((s=r==null?void 0:r.polls)!=null&&s.canView?(yield this.getPolls(),e()):(this.polls.items=[],n()))})),this.canViewPolls()&&e()}updatePoll(t){if(!this.canViewPolls())return;const e=this.polls.items.findIndex(n=>n.id===t.id);if(e>-1){const n=JSON.stringify(this.polls.items[e]);this.polls.items[e]=t,n!==JSON.stringify(t)&&this.polls.emit("pollsUpdate",{polls:this.polls.items,newPoll:!1});return}this.polls.items=[...this.polls.items,t],this.polls.emit("pollsUpdate",{polls:this.polls.items,newPoll:!0})}getPolls(){return me(this,null,function*(){const t=yield L(this,XN).getPolls();if(!(t!=null&&t.payload))return;const{polls:e}=c2n.fromBinary(t.payload);this.polls.items=e.map(n=>r_.formatSocketServicePoll(n))})}static formatSocketServicePoll(t){const e=t.options.map(n=>({count:n.count,text:n.text,votes:n.votes.map(r=>({id:r.userId,name:r.name}))}));return{anonymous:t.anonymous,createdBy:t.createdBy,createdByUserId:t.createdByUserId,hideVotes:t.hideVotes,id:t.pollId,options:e,question:t.question,voted:t.votes}}},YS=new WeakMap,VL=new WeakMap,XN=new WeakMap,dFe);let Bpt=r_;G2n([ut.trace("PollController.setupEvents")],Bpt.prototype,"setupEvents");var W2n=(t,e,n,r)=>{for(var s=e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(s)||s);return s},Upt=(t=>(t[t.User=0]="User",t[t.Meeting=1]="Meeting",t))(Upt||{}),HL,kz,qle,eT,Sz,uFe;let yve=(uFe=class extends Dm{constructor(t,e,n,r,s){const i=t.getValue("logger");super(i),Se(this,kz),xe(this,"selfActiveTab"),xe(this,"broadcastTabChanges"),Se(this,HL,void 0),Se(this,eT,void 0),Se(this,Sz,void 0),xe(this,"viewType"),xe(this,"meetingStartedTimestamp"),xe(this,"meetingTitle"),xe(this,"sessionId"),Te(this,HL,t),Te(this,eT,e),this.viewType=n,Te(this,Sz,r),this.meetingTitle=s,this.broadcastTabChanges=e.permissions.canSpotlight}get socketState(){return L(this,kz,qle).socketState}get mediaState(){return L(this,kz,qle).mediaState}get meetingId(){return L(this,HL).getValue("meetingId")}setBroadcastTabChanges(t){if(!L(this,eT).permissions.canSpotlight)throw this.logger.error("Spotlight::setSpotlighted::permission_denied"),new _t("User does not have permission to toggle spotlight","0801");this.broadcastTabChanges=t,this.emit("broadcastTabChangesUpdate",this.broadcastTabChanges),this.broadcastTabChanges&&this.assertActiveTabToRoom()}setSelfActiveTab(t,e){var n;this.logger.info("Spotlight::setActiveTab",{spotlight:{currentTab:{id:t.id,type:t.type}}}),this.selfActiveTab=t,e===0&&this.emit("selfTabUpdate",t),(n=L(this,eT).permissions)!=null&&n.canSpotlight&&this.broadcastTabChanges&&e===0&&this.assertActiveTabToRoom()}assertActiveTabToRoom(){L(this,Sz).broadcastMessage("spotlight",{userId:L(this,eT).userId,currentTab:this.selfActiveTab})}},HL=new WeakMap,kz=new WeakSet,qle=function(){return L(this,HL).getValue("connectionHandler")},eT=new WeakMap,Sz=new WeakMap,uFe);yve=W2n([tu("0800")],yve);function q2n(t){let e="",n=[""];const r=[n];let s=0,i=0,o=!0,l;for(l of t)l==='"'?(o&&l===e&&(n[s]+=l),o=!o):l===","&&o?l=n[++s]="":l===`
`&&o?(e==="\r"&&(n[s]=n[s].slice(0,-1)),n=r[++i]=[l=""],s=0):n[s]+=l,e=l;return r}var K2n=Object.defineProperty,Y2n=Object.getOwnPropertyDescriptor,zpt=(t,e,n,r)=>{for(var s=r>1?void 0:r?Y2n(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&K2n(e,n,s),s},Cz,hFe;let rk=(hFe=class extends Dm{constructor(t){const e=t.getValue("logger");super(e),xe(this,"transcripts"),Se(this,Cz,void 0),Te(this,Cz,t),this.transcripts=[]}get telemetry(){return L(this,Cz).getValue("telemetry")}static init(t,e){return me(this,null,function*(){const n=new rk(t),r=t.getValue("logger");try{e&&n.getActiveTranscript()}catch(s){r.error("Error fetching active transcriptions ",s)}return n})}static parseTranscript(t,e=!1){if(!t)return;const[[n,r,s,i,o,l]]=q2n(t);return{id:pR(),name:o,peerId:r,userId:s,customParticipantId:i,transcript:l,isPartialTranscript:e,date:new Date(parseInt(n,10)*1e3)}}static parseTranscripts(t){return t?t.split(`
`).map(e=>rk.parseTranscript(e,!1)).filter(Boolean):[]}getActiveTranscript(){return me(this,null,function*(){try{const t=dh(),{transcript:e}=yield t.getActiveTranscript();this.transcripts=rk.parseTranscripts(e)}catch{}})}onTranscript(t){return me(this,null,function*(){var e;const n=this.transcripts.filter(({peerId:r})=>r===t.peerId);if((e=n==null?void 0:n.at(-1))!=null&&e.isPartialTranscript){const r=n.at(-1);r.transcript=t.transcript,r.isPartialTranscript=t.isPartialTranscript,this.emit("transcript",r);return}this.transcripts=[...this.transcripts,t],this.emit("transcript",t)})}},Cz=new WeakMap,hFe);zpt([ut.trace("Ai.getActiveTranscript")],rk.prototype,"getActiveTranscript",1);rk=zpt([tu("0000")],rk);var Q2n=Object.defineProperty,Z2n=Object.getOwnPropertyDescriptor,J2n=(t,e,n,r)=>{for(var s=Z2n(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&Q2n(e,n,s),s},QS,GL,Vm,mFe;const Vpt=(mFe=class{constructor(t,e,n,r,s,i){xe(this,"meta"),xe(this,"ai"),Se(this,QS,void 0),Se(this,GL,void 0),xe(this,"aiSocketHandler"),Se(this,Vm,void 0),Te(this,Vm,t),this.meta=new yve(t,e,e.config.viewType,n,i),this.ai=r,Te(this,QS,e),Te(this,GL,n),this.aiSocketHandler=s,this.setupEvents()}get telemetry(){return L(this,Vm).getValue("telemetry")}get logger(){return L(this,Vm).getValue("logger")}static init(t,e,n,r,s){return me(this,null,function*(){const i=yield rk.init(t,e.permissions.transcriptionEnabled);return new Vpt(t,e,n,i,r,s)})}conditionallySetActiveTab(t){var e;t!=null&&t.currentTab&&((e=this.meta.selfActiveTab)==null?void 0:e.id)!==t.currentTab.id&&(this.meta.setSelfActiveTab(t.currentTab,Upt.Meeting),this.meta.emit("activeTabUpdate",t.currentTab))}setupEvents(){L(this,Vm).getValue("peerSessionStore").on(Et.TRANSPORT_STATE_UPDATE,t=>{this.meta.emit("mediaConnectionUpdate",t)}),L(this,Vm).getValue("peerSessionStore").on(Et.SOCKET_STATE_UPDATE,t=>{this.meta.emit("socketConnectionUpdate",t)}),L(this,Vm).getValue("peerSessionStore").on(Et.ROOM_STATE,({createdAt:t,roomUuid:e})=>{const n=this.meta.meetingStartedTimestamp;if(e&&(this.meta.sessionId=e),t&&!n){const r=new Date(t*1e3);this.meta.meetingStartedTimestamp=r,this.meta.emit("meetingStartTimeUpdate",{meetingStartedTimestamp:this.meta.meetingStartedTimestamp})}}),L(this,Vm).getValue("peerSessionStore").on(Et.PRODUCER_SCORE_UPDATE,({score:t})=>{t<5&&this.meta.emit("poorConnection",{score:t})}),L(this,QS).permissions.canSpotlight&&(this.logger.info("MetaController::Asserting Spotlight"),this.meta.selfActiveTab&&L(this,GL).broadcastMessage("spotlight",{userId:L(this,QS).userId,currentTab:this.meta.selfActiveTab})),L(this,Vm).getValue("peerSessionStore").on(Et.PEER_JOINED_INTERNAL,t=>me(this,null,function*(){L(this,QS).permissions.canSpotlight&&this.meta.selfActiveTab&&L(this,GL).broadcastToPeers("spotlight",[t.id],{userId:L(this,QS).userId,currentTab:this.meta.selfActiveTab})})),L(this,Vm).getValue("peerSessionStore").on(Et.ROOM_MESSAGE,t=>{var e,n;let r;if("type"in t){if(t.type!=="spotlight")return;r=en(en({},t),t.payload)}else if("roomMessageType"in t){if(t.roomMessageType!=="spotlight")return;r=t}else return;this.logger.info("Spotlight Assertion Received",{spotlight:{spotlighter:{id:r.userId},currentTab:{id:(e=r.currentTab)==null?void 0:e.id,type:(n=r.currentTab)==null?void 0:n.type}}}),this.conditionallySetActiveTab(r)}),L(this,Vm).getValue("peerSessionStore").on(Et.MESSAGE,t=>{var e,n;let r;if("type"in t){if(t.type!=="spotlight")return;r=en(en({},t),t.payload)}else if("roomMessageType"in t){if(t.roomMessageType!=="spotlight")return;r=t}else return;this.logger.info("Spotlight Assertion Received",{spotlight:{spotlighter:{id:r.userId},currentTab:{id:(e=r.currentTab)==null?void 0:e.id,type:(n=r.currentTab)==null?void 0:n.type}}}),this.conditionallySetActiveTab(r)}),this.aiSocketHandler.on(Rn.transcript,t=>{const{meetingId:e,transcript:n,isPartial:r}=t;let s;try{s=rk.parseTranscript(n,r)}catch(c){this.logger.error(`Failed to parse transcript: ${n}`,c)}if(!s){this.logger.warn("Received empty transcript data");return}this.ai.onTranscript(s);const{peerId:i,name:o,transcript:l}=s;this.logger.debug(`${e} Received transcript for peer ${i} - ${o}: ${l}`)})}},QS=new WeakMap,GL=new WeakMap,Vm=new WeakMap,mFe);let Hpt=Vpt;J2n([ut.trace("MetaController.setupEvents")],Hpt.prototype,"setupEvents");const WL={},R0={executeWithLock({methodName:t,lockName:e,timeout:n}){return(r,s,i)=>{const o=i.value;return i.value=function(...l){var c,d;const u=(d=(this==null?void 0:this.peerId)||((c=l[0])==null?void 0:c.authToken))!=null?d:"",h=`${e}-${u}`,m=this==null?void 0:this.logger;if(WL[h]){const g=new Error(`Unsupported concurrent calls on method: ${t}.`);throw g.name="UnsupportedConcurrentMethodExecution",m==null||m.error("Locker::UnsupportedConcurrentMethodExecution",{error:{stack:g.stack},locker:{methodName:t,lockName:h}}),g}WL[h]=!0;const f=setTimeout(()=>delete WL[h],n),p=o.apply(this,l);return Promise.resolve(p).then(()=>{delete WL[h],clearTimeout(f)}).catch(()=>{delete WL[h],clearTimeout(f)}),p},i}}};var X2n=Object.defineProperty,eEn=Object.getOwnPropertyDescriptor,OE=(t,e,n,r)=>{for(var s=eEn(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&X2n(e,n,s),s},Tp,bve,Qi,VG,_b,td,HG,xve,k4,GG;class wS extends Dm{constructor(e,n,r,s,i){const o=e.getValue("logger");super(o),Se(this,HG),Se(this,k4),Se(this,Tp,void 0),Se(this,bve,void 0),Se(this,Qi,void 0),Se(this,VG,void 0),Se(this,_b,void 0),Se(this,td,void 0),Te(this,td,e),Te(this,Tp,s),Te(this,bve,i),Te(this,Qi,n),Te(this,VG,r),Te(this,_b,[]),this.setupEvents()}get telemetry(){return L(this,td).getValue("telemetry")}get status(){return L(this,td).getValue("stageStatus")}setupEvents(){const e={[Et.GET_STAGE_REQUESTS]:s=>me(this,null,function*(){Te(this,_b,s)}),[Et.UPDATE_STAGE_REQUESTS]:s=>me(this,[s],function*({add:i}){const o=L(this,_b).length,{stageRequests:l}=this.getAccessRequests();(i||l.length>o)&&this.emit("newStageRequest",{count:l.length}),this.emit("stageAccessRequestUpdate",l)})},n=()=>{Object.entries(e).forEach(([s,i])=>{L(this,td).getValue("peerSessionStore").onAsync(s,i)})},r=()=>{Object.entries(e).forEach(([s,i])=>{L(this,td).getValue("peerSessionStore").removeListener(s,i)})};L(this,Qi).permissions.on("permissionsUpdate",s=>{const{canAcceptProductionRequests:i}=s;i!==void 0&&(L(this,Qi).permissions.acceptStageRequests?(n(),L(this,Tp).getStageRequests()):(r(),Te(this,_b,[]),this.emit("stageAccessRequestUpdate",L(this,_b))))}),L(this,Qi).permissions.acceptStageRequests&&n()}getAccessRequests(){if(!L(this,Qi).permissions.stageEnabled)throw this.logger.error("Stage::stage_disabled"),new _t("Stage is disabled","2003");if(!L(this,Qi).permissions.acceptStageRequests)throw this.logger.error("Stage::get_access_request::permission_denied"),new _t("You do not have permission to perform this action","2001");const e=L(this,VG).joined.toArray().filter(n=>n.stageStatus==="REQUESTED_TO_JOIN_STAGE").map(n=>({displayName:n.name,userId:n.userId,peerId:n.id}));return Te(this,_b,e),{stageRequests:L(this,_b)}}requestAccess(){return me(this,null,function*(){if(!L(this,Qi).permissions.stageEnabled)throw this.logger.error("Stage::stage_disabled"),new _t("Stage is disabled","2003");if(this.status!=="OFF_STAGE")throw new _t(`Unable to request access you are currently ${this.status}`,"2006");if(L(this,Qi).permissions.stageAccess===Hr.Allowed){In(this,k4,GG).call(this,"ACCEPTED_TO_JOIN_STAGE");return}L(this,Tp).requestAccess(),In(this,k4,GG).call(this,"REQUESTED_TO_JOIN_STAGE")})}cancelRequestAccess(){return me(this,null,function*(){if(!L(this,Qi).permissions.stageEnabled)throw this.logger.error("Stage::stage_disabled"),new _t("Stage is disabled","2003");L(this,Tp).cancelRequestAccess(),In(this,k4,GG).call(this,"OFF_STAGE")})}grantAccess(e){if(!L(this,Qi).roomJoined)throw new _t("Can`t grant for participant without joining room");if(!L(this,Qi).permissions.stageEnabled)throw this.logger.error("Stage::stage_disabled"),new _t("Stage is disabled","2003");if(!L(this,Qi).permissions.acceptStageRequests)throw this.logger.error("Stage::grant_access::permission_denied"),new _t("You do not have permission to perform this action","2001");return L(this,Tp).grantAccess(e)}denyAccess(e){if(!L(this,Qi).roomJoined)throw new _t("Can`t rejectRequestToJoinStage for participant without joining room","2005");if(!L(this,Qi).permissions.stageEnabled)throw this.logger.error("Stage::stage_disabled"),new _t("Stage is disabled","2003");if(!L(this,Qi).permissions.acceptStageRequests)throw this.logger.error("Stage::deny_access::permission_denied"),new _t("You do not have permission to perform this action","2001");return L(this,Tp).denyAccess(e)}get peerId(){return L(this,td).getValue("peerId")}join(){return me(this,null,function*(){const e=L(this,td).getValue("viewType");if(this.status==="ON_STAGE")throw new _t("You are already on stage.","2006");if(this.status!=="ACCEPTED_TO_JOIN_STAGE"||L(this,Qi).permissions.stageAccess===Hr.NotAllowed)throw new _t(`Unable to join stage you are currently ${this.status}`,"2006");if(L(this,td).setValue("stageStatus","ON_STAGE",!1),yield L(this,Tp).joinStage(),e===Sx.Livestream){yield L(this,td).getValue("selfController").joinRoom();return}L(this,td).notify("stageStatus"),L(this,Qi).audioEnabled&&L(this,HG,xve).shareMic(L(this,Qi).audioTrack),L(this,Qi).videoEnabled&&L(this,HG,xve).shareWebcam(L(this,Qi).videoTrack)})}leave(){return me(this,null,function*(){if(!L(this,Qi).permissions.stageEnabled)throw this.logger.error("Stage::stage_disabled"),new _t("Stage is disabled","2003");if(!(this.status==="ON_STAGE"||this.status==="ACCEPTED_TO_JOIN_STAGE"))throw new _t(`Unable to leave stage you are currently ${this.status}`,"2006");L(this,Qi).setIsPinned(!1),L(this,td).setValue("stageStatus","OFF_STAGE",!1),yield L(this,Tp).leaveStage(L(this,Qi).userId);try{yield L(this,td).getValue("peerSessionStore").emitAsync(Et.LEAVE_MEDIA_ROOM,"stageLeft")}catch(e){this.logger.error("Stage::leave::emitAsync::failed",{error:e})}L(this,td).notify("stageStatus")})}kick(e){return me(this,null,function*(){if(!L(this,Qi).roomJoined)throw new _t("Can`t kick participant without joining room","2005");if(!L(this,Qi).permissions.stageEnabled)throw this.logger.error("Stage::stage_disabled"),new _t("Stage is disabled","2003");if(!L(this,Qi).permissions.acceptStageRequests)throw this.logger.error("Stage::kick::permission_denied"),new _t("You do not have permissions for kick","2001");return L(this,Tp).kick(e)})}}Tp=new WeakMap,bve=new WeakMap,Qi=new WeakMap,VG=new WeakMap,_b=new WeakMap,td=new WeakMap,HG=new WeakSet,xve=function(){return L(this,td).getValue("roomNodeClient")},k4=new WeakSet,GG=function(t){return me(this,null,function*(){this.status!==t&&L(this,td).setValue("stageStatus",t)})};OE([ut.trace("Stage.getStageRequests")],wS.prototype,"getAccessRequests");OE([ut.trace("Stage.requestAccess")],wS.prototype,"requestAccess");OE([ut.trace("Stage.cancelRequestAccess")],wS.prototype,"cancelRequestAccess");OE([ut.trace("Stage.grantAccess")],wS.prototype,"grantAccess");OE([ut.trace("Stage.denyAccess")],wS.prototype,"denyAccess");OE([R0.executeWithLock({methodName:"joinStage",lockName:"Stage.join",timeout:5e3}),ut.trace("Stage.joinStage")],wS.prototype,"join");OE([ut.trace("Stage.leaveStage")],wS.prototype,"leave");function tEn(t){return!(t.viewType==="LIVESTREAM"||t.viewType==="CHAT")}function cEe(t){switch(t){case Jb.UNSPECIFIED:return"OFF_STAGE";case Jb.REQUESTED_STAGE:return"REQUESTED_TO_JOIN_STAGE";case Jb.APPROVED_STAGE:return"ACCEPTED_TO_JOIN_STAGE";case Jb.OFF_STAGE:return"OFF_STAGE";case Jb.ON_STAGE:return"ON_STAGE";default:return"OFF_STAGE"}}var nEn=Object.defineProperty,rEn=Object.getOwnPropertyDescriptor,sEn=(t,e,n,r)=>{for(var s=rEn(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&nEn(e,n,s),s},kC,Cv,SC,WG,Ku;class Gpt{constructor(e,n,r,s,i){xe(this,"stage"),Se(this,kC,void 0),Se(this,Cv,void 0),Se(this,SC,void 0),Se(this,WG,0),Se(this,Ku,void 0),Te(this,Ku,e),this.stage=new wS(e,s,i,n,r),Te(this,SC,n),Te(this,kC,s),Te(this,Cv,i),this.setupEvents()}get telemetry(){return L(this,Ku).getValue("telemetry")}get logger(){return L(this,Ku).getValue("logger")}setupEvents(){L(this,Ku).subscribe("stageStatus",e=>{this.stage.emit("stageStatusUpdate",e)}),L(this,SC).on(Rn.grantStageAccess,()=>{L(this,kC).permissions.stageAccess!==Hr.Allowed&&(this.stage.emit("stageRequestApproved"),this.setStageStatus("ACCEPTED_TO_JOIN_STAGE"))}),L(this,SC).on(Rn.peerStageStatusUpdate,e=>{e!==void 0&&(e.peerId===L(this,kC).id?this.selfStageStatusHandler(e):this.peerStageStatusHandler(e))}),L(this,SC).on(Rn.denyStageAccess,()=>{L(this,kC).permissions.stageAccess!==Hr.Allowed&&(this.stage.emit("stageRequestRejected"),this.setStageStatus("OFF_STAGE"))}),L(this,SC).on(Rn.getStageRequests,e=>me(this,null,function*(){var n;if(L(this,kC).permissions.stageAccess!==Hr.Allowed)return;const r=(n=e==null?void 0:e.stageRequests)!=null?n:[];yield L(this,Ku).getValue("peerSessionStore").emitAsync(Et.GET_STAGE_REQUESTS,r),L(this,WG)<r.length&&r.length>0&&this.stage.emit("newStageRequest",{count:r.length}),Te(this,WG,r.length),this.stage.emit("stageAccessRequestUpdate",r)}))}getCurrentStageRequests(){return L(this,Cv).joined.toArray().filter(e=>e.stageStatus==="REQUESTED_TO_JOIN_STAGE").map(e=>({displayName:e.name,userId:e.userId,peerId:e.id}))}setStageStatus(e){return me(this,null,function*(){this.stage.status!==e&&L(this,Ku).setValue("stageStatus",e)})}selfStageStatusHandler(e){const n=cEe(e.stageType),r=L(this,Ku).getValue("stageStatus");if(r!==n)switch(e.stageType){case 1:L(this,Ku).setValue("stageStatus","ACCEPTED_TO_JOIN_STAGE",!1),this.stage.join();break;case 2:case 3:this.setStageStatus(r);break;case 0:case 4:default:L(this,Ku).setValue("stageStatus","ACCEPTED_TO_JOIN_STAGE",!1),this.stage.leave();break}}peerStageStatusHandler(e){return me(this,null,function*(){const n=L(this,Cv).joined.get(e.peerId),r=L(this,Cv).viewMode==="ACTIVE_GRID";if(!n){this.logger.warn("err::peerStageStatusUpdate: participant not found");return}switch(e.stageType){case 1:n.setStageStatus("ON_STAGE"),r&&L(this,Ku).getValue("peerSessionStore").emit(Et.UPDATE_ACTIVE,{viewMode:L(this,Cv).viewMode,page:L(this,Cv).currentPage});break;case 2:n.setStageStatus("ACCEPTED_TO_JOIN_STAGE");break;case 3:n.setStageStatus("REQUESTED_TO_JOIN_STAGE");break;case 0:case 4:default:n.setStageStatus("OFF_STAGE"),r&&L(this,Ku).getValue("peerSessionStore").emit(Et.UPDATE_ACTIVE,{viewMode:L(this,Cv).viewMode,page:L(this,Cv).currentPage});break}L(this,Ku).getValue("peerSessionStore").emit(Et.UPDATE_PEER_STAGE_STATUS,{id:n.id,status:n.stageStatus})})}}kC=new WeakMap,Cv=new WeakMap,SC=new WeakMap,WG=new WeakMap,Ku=new WeakMap;sEn([ut.trace("Stage.setupEvents")],Gpt.prototype,"setupEvents");var iEn=Object.defineProperty,aEn=Object.getOwnPropertyDescriptor,dEe=(t,e,n,r)=>{for(var s=r>1?void 0:r?aEn(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&iEn(e,n,s),s},tT,qL,jz,Ez,nT,fFe;let n6=(fFe=class extends jI{constructor(t,e,n,r){const s=t.getValue("logger");super(s),xe(this,"name"),xe(this,"icon"),xe(this,"id"),xe(this,"permissions"),Se(this,tT,void 0),Se(this,qL,void 0),Se(this,jz,void 0),Se(this,Ez,void 0),Se(this,nT,void 0),xe(this,"active"),xe(this,"enabledBy"),Te(this,jz,t);const i=t.getValue("meetingId");this.id=`${i}:${e.id}`,this.name=e.name,this.icon=e.icon,Te(this,Ez,e.component),this.permissions=e.permissions,Te(this,tT,r),Te(this,qL,n),this.active=!1,this.enabledBy=""}get component(){return L(this,Ez)}get telemetry(){return L(this,jz).getValue("telemetry")}activateForSelf(){Te(this,nT,new Date),this.active=!0,this.emit("stateUpdate",{active:this.active,pluginId:this.id}),this.emit("enabled")}deactivateForSelf(){Te(this,nT,void 0),this.active=!1,this.emit("stateUpdate",{active:this.active,pluginId:this.id}),this.emit("closed")}activate(){return me(this,null,function*(){var t;this.active||(t=this.permissions)!=null&&t.canActivate&&(yield L(this,qL).set(this.id,{name:this.name,icon:this.icon,id:this.id,enabledBy:L(this,tT).id}),this.enabledBy=L(this,tT).id,this.activateForSelf(),this.logger.info("plugin::activated",{plugin:{id:this.id,enabledBy:this.enabledBy,name:this.name}}))})}deactivate(){return me(this,null,function*(){var t;if(!this.active||!((t=this.permissions)!=null&&t.canDeactivate)&&this.enabledBy!==L(this,tT).id)return;const e=L(this,nT)?new Date().getTime()-L(this,nT).getTime():0;yield L(this,qL).set(this.id,null),this.deactivateForSelf(),this.logger.info("plugin::deactivated",{plugin:{id:this.id,name:this.name,duration:e}})})}},tT=new WeakMap,qL=new WeakMap,jz=new WeakMap,Ez=new WeakMap,nT=new WeakMap,fFe);dEe([ut.trace("Plugin.activatePlugin")],n6.prototype,"activate",1);dEe([ut.trace("Plugin.deactivatePlugin")],n6.prototype,"deactivate",1);n6=dEe([tu("0600")],n6);var zl,s_;class Wpt extends Map{constructor(e,n=void 0){const{onAddEvent:r,onDeleteEvent:s,onClearEvent:i}=e;super(),Se(this,zl,void 0),Se(this,s_,void 0),xe(this,"onAddEvent"),xe(this,"onDeleteEvent"),xe(this,"onClearEvent"),Te(this,zl,new jI(n)),this.onAddEvent=r,this.onDeleteEvent=s,this.onClearEvent=i,Te(this,s_,new Map)}emit(e,...n){return L(this,zl).emit(e,...n)}on(e,n){return L(this,zl).on(e,n)}addListener(e,n){return L(this,zl).addListener(e,n)}off(e,n){return L(this,zl).off(e,n)}once(e,n){return L(this,zl).once(e,n)}prependListener(e,n){return L(this,zl).prependListener(e,n)}prependOnceListener(e,n){return L(this,zl).prependOnceListener(e,n)}removeListener(e,n){return L(this,zl).removeListener(e,n)}removeAllListeners(e){return L(this,zl).removeAllListeners(e)}listeners(e){return L(this,zl).listeners(e)}listenerCount(e){return L(this,zl).listenerCount(e)}getMaxListeners(){return L(this,zl).getMaxListeners()}setMaxListeners(e){return L(this,zl).setMaxListeners(e)}eventNames(){return L(this,zl).eventNames()}add(e,n=!0){return this.set(e.id,e,n)}set(e,n,r=!0){const s=super.set(e,n),i=(o,...l)=>{this.emit(o,n,...l)};return L(this,s_).set(e,i),n.on("*",i),r&&L(this,zl).emit(this.onAddEvent,n),s}delete(e,n=!0,r=!1){const s=this.get(e);if(!s)return!1;s.removeListener("*",L(this,s_).get(e));const i=super.delete(e);return r&&s.removeAllListeners(),n&&L(this,zl).emit(this.onDeleteEvent,s),i}clear(e=!0,n=!1){this.forEach(s=>{s.removeListener("*",L(this,s_).get(s.id)),n&&s.removeAllListeners()});const r=super.clear();return e&&L(this,zl).emit(this.onClearEvent),r}toArray(){return Array.from(this.values())}}zl=new WeakMap,s_=new WeakMap;class pFe extends Wpt{constructor(e){super({onAddEvent:"pluginAdded",onDeleteEvent:"pluginDeleted"},e)}add(e,n=!0){return super.add(e,n)}delete(e,n=!0,r=!1){return super.delete(e,n,r)}}var oEn=(t,e,n,r)=>{for(var s=e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(s)||s);return s};let wve=class{constructor(t){xe(this,"all"),xe(this,"active"),this.all=new pFe(t),this.active=new pFe(t)}};wve=oEn([tu("0600")],wve);var lEn=Object.defineProperty,cEn=Object.getOwnPropertyDescriptor,dEn=(t,e,n,r)=>{for(var s=cEn(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&lEn(e,n,s),s},rT,Nz,sT,gFe;const qpt=(gFe=class{constructor(t,e,n,r){xe(this,"plugins"),Se(this,rT,void 0),Se(this,Nz,void 0),Se(this,sT,void 0),Te(this,sT,t),this.plugins=e,Te(this,rT,n),Te(this,Nz,r),this.setupEvents()}get telemetry(){return L(this,sT).getValue("telemetry")}get logger(){return L(this,sT).getValue("logger")}static init(t,e,n,r,s){return me(this,null,function*(){const i=t.getValue("logger"),o=new wve(i);return e.forEach(l=>{const c=new n6(t,l,n,r);o.all.add(c)}),new qpt(t,o,n,s)})}setupEvents(){this.plugins.all.on("stateUpdate",({active:t,id:e})=>{if(t){this.plugins.active.add(this.plugins.all.get(e));return}this.plugins.active.delete(e)}),L(this,sT).getValue("peerSessionStore").onAsync(Et.SOCKET_SERVICE_ROOM_JOINED,()=>me(this,null,function*(){var t,e;((e=(t=this.plugins.active)==null?void 0:t.toArray())!=null?e:[]).forEach(r=>{r.deactivateForSelf()});try{yield L(this,Nz).refresh(L(this,rT).name)}catch(r){this.logger.error("[PluginController] Failed to refresh active plugins store, syncing from stale data.",{error:r})}const n=L(this,rT).getAll();Object.entries(n).forEach(([r,s])=>{if(!s)return;const i=this.plugins.all.get(r);if(!i){this.logger.warn(`[PluginController] Plugin '${r}' not found in plugins.all, ignoring store entry.`);return}i.active||(i.enabledBy=s.enabledBy,i.activateForSelf())}),this.logger.debug("[SOCKET_SERVICE_ROOM_JOINED] resolved request to sync active plugins.")})),L(this,rT).subscribe("*",t=>{Object.entries(t).forEach(([e,n])=>{const r=this.plugins.all.get(e);if(!r){this.logger.warn(`[PluginController] Plugin '${e}' not found in plugins.all, ignoring store update.`);return}!n&&r.active&&r.deactivateForSelf(),n&&!r.active&&(r.enabledBy=n.enabledBy,r.activateForSelf())})})}},rT=new WeakMap,Nz=new WeakMap,sT=new WeakMap,gFe);let Kpt=qpt;dEn([ut.trace("PluginController.setupEvents")],Kpt.prototype,"setupEvents");var qG;class uEn{constructor(e){xe(this,"mediaJoined"),xe(this,"socketJoined"),xe(this,"socketJoinAttempted"),xe(this,"mediaJoinAttempted"),xe(this,"socketState"),xe(this,"mediaState"),Se(this,qG,void 0),this.mediaJoined=!1,this.socketJoined=!1,this.socketJoinAttempted=!1,this.mediaJoinAttempted=!1,this.socketState={state:void 0,reconnected:!1,reconnectionAttempt:void 0},this.mediaState={recv:void 0,send:void 0},Te(this,qG,e)}get joinAttempted(){return this.mediaJoinAttempted||this.socketJoinAttempted}get roomJoined(){return this.mediaJoined&&this.socketJoined}updateSocketConnectionState(e,n){let r;const{reconnected:s}=this.socketState;switch(e){case"connected":r={state:"connected",reconnected:s,reconnectionAttempt:void 0};break;case"disconnected":r={state:"disconnected",reconnected:!1,reconnectionAttempt:0},this.socketJoined=!1;break;case"reconnected":r={state:"connected",reconnected:!0,reconnectionAttempt:void 0};break;case"reconnecting":r={state:"reconnecting",reconnected:s,reconnectionAttempt:0};break;case"reconnectAttempt":r={state:"reconnecting",reconnected:s,reconnectionAttempt:n};break;case"failed":r={state:"failed",reconnected:s,reconnectionAttempt:void 0},this.socketJoined=!1;break}r&&(L(this,qG).getValue("peerSessionStore").emit(Et.SOCKET_STATE_UPDATE,r),this.socketState=r)}}qG=new WeakMap;var hEn=Object.defineProperty,mEn=Object.getOwnPropertyDescriptor,C7=(t,e,n,r)=>{for(var s=r>1?void 0:r?mEn(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&hEn(e,n,s),s},KL,YL,QL,Tz,vFe;let B2=(vFe=class extends Dm{constructor(t,e){const n=t.getValue("logger");super(n),Se(this,QL),Se(this,KL,void 0),Se(this,YL,void 0),xe(this,"recordingPeerIds",[]),xe(this,"recordings",[]),Te(this,YL,t),Te(this,KL,e)}get recordingState(){return this.recordings.some(t=>t.state==="RECORDING")?"RECORDING":this.recordings.some(t=>t.state==="PAUSED")?"PAUSED":this.recordings.some(t=>t.state==="STARTING")?"STARTING":this.recordings.some(t=>t.state==="STOPPING")?"STOPPING":"IDLE"}get telemetry(){return L(this,YL).getValue("telemetry")}updateRecordings(t){this.recordings=t,this.emit("recordingUpdate",this.recordingState)}start(t){return me(this,null,function*(){if(!L(this,KL).permissions.canRecord)throw this.logger.error("Recording::start::permission_denied"),new _t("User does not have permission to start recording","1001");if((t==null?void 0:t.allowMultiple)!==!0&&(this.recordingState==="STARTING"||this.recordingState==="RECORDING"||this.recordingState==="STOPPING"))throw this.logger.error("Recording::start::recording_in_progress",{recording:{state:this.recordingState}}),new _t(`Cant start recording, recordingState irregular: ${this.recordingState}`,"1005");try{const e=dh(),{recording:n={}}=L(this,YL).getValue("defaults"),r=yield e.startRecording(n,t==null?void 0:t.allowMultiple);this.updateRecordings([...this.recordings,{id:r,state:"STARTING",type:"BROWSER"}])}catch(e){throw this.logger.error("Recording::stop::recording_failed_to_start",{error:e}),new _t("Error while starting recording","1000",this.logger)}})}stop(t){return me(this,null,function*(){yield In(this,QL,Tz).call(this,"stop",["RECORDING","PAUSED"],t)})}pause(t){return me(this,null,function*(){yield In(this,QL,Tz).call(this,"pause",["RECORDING"],t)})}resume(t){return me(this,null,function*(){yield In(this,QL,Tz).call(this,"resume",["PAUSED"],t)})}},KL=new WeakMap,YL=new WeakMap,QL=new WeakSet,Tz=function(t,e,n){return me(this,null,function*(){if(!L(this,KL).permissions.canRecord)throw this.logger.error("Recording::stop::permission_denied"),new _t("User does not have permission to stop recording","1001");let r=[];if(n!==void 0){const s=this.recordings.find(i=>i.id===n);if(s===void 0)throw new _t("Could not find the specified recording","1004");if(e.includes(s.state)){this.logger.error("Recording::stop::recording_not_in_expected_state",{recording:{state:s.state}});return}r.push(s)}else r=this.recordings.filter(s=>e.includes(s.state));r.forEach(s=>me(this,null,function*(){const i=s.state;t==="stop"&&(s.state="STOPPING",this.emit("recordingUpdate","STOPPING"));try{yield dh().updateRecording(s.id,t)}catch(o){throw this.logger.error("Recording::stop::recording_failed_to_stop",{error:o}),s.state!==i&&(s.state=i,this.emit("recordingUpdate",i)),new _t("Error while stopping recording","1000",this.logger)}}))})},vFe);C7([ut.trace("Recording.start")],B2.prototype,"start",1);C7([ut.trace("Recording.stop")],B2.prototype,"stop",1);C7([ut.trace("Recording.stop")],B2.prototype,"pause",1);C7([ut.trace("Recording.stop")],B2.prototype,"resume",1);B2=C7([tu("1000")],B2);var fEn=Object.defineProperty,pEn=Object.getOwnPropertyDescriptor,gEn=(t,e,n,r)=>{for(var s=pEn(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&fEn(e,n,s),s},i_;class Ypt{constructor(e,n,r){xe(this,"recording"),xe(this,"room"),Se(this,i_,void 0),Te(this,i_,e),this.recording=new B2(e,n),this.room=r,this.setupEvents()}get telemetry(){return L(this,i_).getValue("telemetry")}get logger(){return L(this,i_).getValue("logger")}getRecordingTypeFromProtoType(e){let n;switch(e){case Yj.BROWSER:n="BROWSER";break;case Yj.COMPOSITE:n="COMPOSITE";break;case Yj.TRACK:n="TRACK";break;default:n="BROWSER"}return n}setupEvents(){L(this,i_).getValue("peerSessionStore").on(Et.ROOM_STATE,e=>{e.activeRecordings.length!==0?this.recording.updateRecordings(e.activeRecordings.map(n=>{const r=this.getRecordingTypeFromProtoType(n.recordingType);return{id:n.recordingId,state:n.recordingStatus,type:r}})):this.recording.recordings.length&&this.recording.updateRecordings([])}),this.room.on(Rn.recordingStarted,e=>{let n=!1;const r=[...this.recording.recordings];if(r.forEach(s=>{s.id===e.recordingId&&(n=!0,s.state="RECORDING")}),n===!1){const s=this.getRecordingTypeFromProtoType(e.recordingType);r.push({id:e.recordingId,state:"RECORDING",type:s})}this.recording.updateRecordings(r)}),this.room.on(Rn.recordingPaused,e=>{const n=[...this.recording.recordings];n.forEach(r=>{r.id===e.recordingId&&(r.state="PAUSED")}),this.recording.updateRecordings(n)}),this.room.on(Rn.recordingStopped,e=>{const n=[...this.recording.recordings.filter(r=>r.id!==e.recordingId)];this.recording.updateRecordings(n)})}}i_=new WeakMap;gEn([ut.trace("RecordingController.setupEvents")],Ypt.prototype,"setupEvents");var a_;class vEn{constructor(e){Se(this,a_,void 0),Te(this,a_,e)}hasFeature(e){return L(this,a_).getValue("logger").warn("Unimplemented method: meeting.__internals__.hasFeature called"),!1}getFeatureValue(e){return L(this,a_).getValue("logger").warn("Unimplemented method: meeting.__internals__.getFeatureValue called"),null}getAllFeatures(){return L(this,a_).getValue("logger").warn("Unimplemented method: meeting.__internals__.getAllFeatures called"),{}}}a_=new WeakMap;class uEe{constructor(e,n,r,s){xe(this,"authToken"),xe(this,"logger"),xe(this,"features"),xe(this,"browserSpecs"),xe(this,"callStats"),this.authToken=e,this.logger=n,this.features=r,this.browserSpecs=so,this.callStats=s}static init(e){return new uEe(e.getValue("authToken"),e.getValue("logger"),new vEn(e),e.getValue("callstats"))}}class hEe{constructor(e){xe(this,"internals"),this.internals=e}static init(e){return me(this,null,function*(){const n=uEe.init(e);return new hEe(n)})}}var yEn=Object.defineProperty,bEn=Object.getOwnPropertyDescriptor,Om=(t,e,n,r)=>{for(var s=bEn(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&yEn(e,n,s),s},Nc,ho,Wa,_w,_p,KG,hl;let Th=class extends jI{constructor(e,n,r=GY,s=!0){const i=e.getValue("logger");super(i),Se(this,Nc,void 0),Se(this,ho,void 0),Se(this,Wa,void 0),Se(this,_w,void 0),Se(this,_p,void 0),Se(this,KG,void 0),Se(this,hl,void 0),xe(this,"audioUpdateInProgress"),xe(this,"videoUpdateInProgress"),Te(this,hl,e),this.audioUpdateInProgress=!1,this.videoUpdateInProgress=!1,Te(this,Nc,new Qpt(e,n)),Te(this,ho,new zEn(e,L(this,Nc),void 0,r)),Te(this,Wa,new YEn(e,L(this,Nc),void 0,r)),Te(this,_p,new WEn(L(this,hl),L(this,Nc))),Te(this,_w,new HEn(e,L(this,Nc))),Te(this,KG,s),L(this,ho).on("trackMuted",this.onAudioTrackMuted.bind(this)),L(this,ho).on("trackChanged",this.onAudioTrackChanged.bind(this)),L(this,Wa).on("trackChanged",this.onVideoTrackChanged.bind(this)),L(this,Wa).on("trackEnded",this.onVideoTrackEnded.bind(this)),L(this,_p).on("trackEnded",this.onScreenShareEnded.bind(this)),this.onVisibilityChange=this.onVisibilityChange.bind(this),document.addEventListener("visibilitychange",this.onVisibilityChange)}get telemetry(){return L(this,hl).getValue("telemetry")}set context(e){Te(this,hl,e)}onVisibilityChange(){return me(this,null,function*(){L(this,hl).getValue("callstats").tabChanged(document.visibilityState==="visible"),document.visibilityState!=="visible"?L(this,hl).getValue("callstats").browserBackgrounded():(L(this,hl).getValue("callstats").browserForegrounded(),yield this.setupSpeaker())})}repopulateAvailableDevices(){return me(this,null,function*(){return!0})}setupStreams(e){return me(this,arguments,function*({audio:n,video:r}){var s;n?L(this,hl).getValue("callstats").audioOn():L(this,hl).getValue("callstats").audioOff(),r?L(this,hl).getValue("callstats").videoOn():L(this,hl).getValue("callstats").videoOff();let i,o;if(n&&r)try{const l=yield L(this,Nc).getAudioAndVideoTrack(L(this,ho).userSelectedDevice,L(this,Wa).userSelectedDevice);i=l.audioTrack,o=l.videoTrack}catch(l){this.logger.error("LocalMediaHandler::init::Failed to get audio video tracks",{error:l})}if(!i&&n)try{i=yield L(this,Nc).getAudioTrack(!1,L(this,ho).userSelectedDevice)}catch(l){this.logger.error("LocalMediaHandler::init::Failed to get audio track",{error:l})}if(!o&&r)try{o=yield L(this,Nc).getVideoTrack(L(this,Wa).userSelectedDevice)}catch(l){this.logger.error("LocalMediaHandler::init::Failed to get video track",{error:l})}n&&!i&&L(this,hl).getValue("callstats").audioOff(),r&&!o&&L(this,hl).getValue("callstats").videoOff(),yield L(this,ho).setMediaTrack(i),yield L(this,Wa).setMediaTrack(o);try{yield this.setupSpeaker()}catch{}if(o){const l=yield this.getDeviceById(o.getSettings().deviceId);L(this,hl).getValue("callstats").selectedDevice("VIDEO",l)}if(i){const l=yield this.getDeviceById(i.getSettings().deviceId);L(this,hl).getValue("callstats").selectedDevice("AUDIO",l)}(s=L(this,_w).currentDevice)!=null&&s.deviceId&&L(this,hl).getValue("callstats").selectedDevice("SPEAKER",L(this,_w).currentDevice),L(this,Nc).onDeviceChange((l,c,d)=>{this.onDeviceChange(c,d)})})}getCurrentDevices(){return{audio:L(this,ho).currentDevice,video:L(this,Wa).currentDevice,speaker:L(this,_w).currentDevice}}get permissions(){return L(this,Nc).permissions}getAllDevices(){return L(this,Nc).getAvailableDevices()}getDeviceById(e,n){return L(this,Nc).getDevice(e)}onAudioTrackMuted(){this.emit("AUDIO_TRACK_SILENT")}onAudioTrackChanged(){this.emit("AUDIO_TRACK_CHANGE")}get rawAudioTrack(){return L(this,ho).mediaTrack}get audioTrack(){return L(this,ho).transformedMediaTrack}get audioEnabled(){return L(this,ho).trackEnabled}enableAudio(e){return me(this,null,function*(){if(!this.audioUpdateInProgress){this.audioUpdateInProgress=!0;try{e?yield L(this,ho).enableTrack(!1,e):yield L(this,ho).unmuteTrack()}catch{}finally{this.audioUpdateInProgress=!1}}})}disableAudio(){L(this,ho).mediaTrack&&!L(this,ho).isCustomTrack?L(this,ho).muteTrack():L(this,ho).disableTrack()}getAudioDevices(e){return L(this,Nc).getAudioInputDevices(e)}setAudioDevice(e,n){return me(this,arguments,function*(r,{saveDevicePreference:s}){yield L(this,ho).setDevice(r,{saveDevicePreference:s}),r!=null&&r.deviceId&&L(this,hl).getValue("callstats").selectedDevice("AUDIO",r),this.emit("AUDIO_TRACK_CHANGE"),this.emit("DEVICE_CHANGE",{device:r})})}setupSpeaker(){return me(this,null,function*(){const{speaker:e}=this.getCurrentDevices();yield L(this,_w).setPreferredSpeaker();const{speaker:n}=this.getCurrentDevices();(e==null?void 0:e.deviceId)!==(n==null?void 0:n.deviceId)&&n&&this.emit("DEVICE_CHANGE",{device:n})})}setSpeakerDevice(e,n){return me(this,arguments,function*(r,{saveDevicePreference:s}){yield L(this,_w).setupSpeaker(r,{saveDevicePreference:s}),r!=null&&r.deviceId&&L(this,hl).getValue("callstats").selectedDevice("SPEAKER",r),this.emit("DEVICE_CHANGE",{device:r})})}onVideoTrackChanged(){this.emit("VIDEO_TRACK_CHANGE")}onVideoTrackEnded(){this.emit("VIDEO_TRACK_CHANGE")}get rawVideoTrack(){return L(this,Wa).mediaTrack}get videoTrack(){return L(this,Wa).transformedMediaTrack}get videoEnabled(){return L(this,Wa).trackEnabled}enableVideo(e){return me(this,null,function*(){if(!this.videoUpdateInProgress){this.videoUpdateInProgress=!0;try{e?yield L(this,Wa).enableTrack(!1,e):yield L(this,Wa).unmuteTrack()}catch{}finally{this.videoUpdateInProgress=!1}}})}disableVideo(){L(this,Wa).disableTrack()}getVideoDevices(e){return L(this,Nc).getVideoInputDevices(e)}setVideoDevice(e,n){return me(this,arguments,function*(r,{saveDevicePreference:s}){yield L(this,Wa).setDevice(r,{saveDevicePreference:s}),r!=null&&r.deviceId&&L(this,hl).getValue("callstats").selectedDevice("VIDEO",r),this.emit("VIDEO_TRACK_CHANGE"),this.emit("DEVICE_CHANGE",{device:r})})}updateVideoConstraints(e){return me(this,null,function*(){yield L(this,Wa).updateConstraints(e)})}onScreenShareEnded(){this.emit("SCREENSHARE_ENDED")}get screenShareTracks(){return{audio:L(this,_p).audioMediaTrack,video:L(this,_p).videoMediaTrack}}get screenShareEnabled(){return L(this,_p).trackEnabled}enableScreenShare(){return me(this,null,function*(){yield L(this,_p).enableScreenShare()})}disableScreenShare(){return me(this,null,function*(){L(this,_p).disableScreenShare()})}updateScreenshareConstraints(e){return me(this,null,function*(){yield L(this,_p).updateConstraints(e)})}getSpeakerDevices(e){return L(this,Nc).getAudioOutputDevices(e)}addAudioMiddleware(e){return L(this,ho).addMiddleware(e)}removeAudioMiddleware(e){return L(this,ho).removeMiddleware(e)}removeAllAudioMiddlewares(){return L(this,ho).removeAllMiddlewares()}addVideoMiddleware(e){return L(this,Wa).addMiddleware(e)}removeVideoMiddleware(e){return L(this,Wa).removeMiddleware(e)}removeAllVideoMiddlewares(){return L(this,Wa).removeAllMiddlewares()}setVideoMiddlewareGlobalConfig(e){return L(this,Wa).setVideoMiddlewareGlobalConfig(e)}destruct(){L(this,ho).disableTrack(),L(this,Wa).disableTrack(),L(this,Wa).terminateMiddlewareWebWorker(),L(this,_p).disableScreenShare(),L(this,Nc).destruct()}onDeviceChange(e,n){return me(this,null,function*(){var r,s;if(this.emit("DEVICE_LIST_UPDATED",e),n||!L(this,KG))return;let i=!1;(r=e==null?void 0:e.added)==null||r.reverse().forEach(o=>me(this,null,function*(){var l;o&&!GY(o)&&(o.kind==="audioinput"&&((l=this.audioTrack)==null?void 0:l.enabled)===!0?yield this.setAudioDevice(o,{saveDevicePreference:!1}):o.kind==="audiooutput"&&(i=!0,yield this.setSpeakerDevice(o,{saveDevicePreference:!1})))})),i||(s=e==null?void 0:e.removed)==null||s.forEach(o=>me(this,null,function*(){var l;if(o.kind==="audiooutput"&&((l=this.getCurrentDevices().speaker)==null?void 0:l.deviceId)===o.deviceId){const c=yield this.getSpeakerDevices();(c==null?void 0:c.length)>0&&(yield this.setSpeakerDevice(c[0],{saveDevicePreference:!1}))}}))})}removeAllTracks(){this.destruct()}removeAudioTrack(){L(this,ho).disableTrack()}removeVideoTrack(){L(this,Wa).disableTrack(),L(this,Wa).terminateMiddlewareWebWorker()}removeDocumentEventListeners(){return me(this,null,function*(){document.removeEventListener("visibilitychange",this.onVisibilityChange)})}};Nc=new WeakMap,ho=new WeakMap,Wa=new WeakMap,_w=new WeakMap,_p=new WeakMap,KG=new WeakMap,hl=new WeakMap;Om([ut.trace("MediaHandler.setupStreams")],Th.prototype,"setupStreams");Om([ut.trace("MediaHandler.enableAudio")],Th.prototype,"enableAudio");Om([ut.trace("MediaHandler.disableAudio")],Th.prototype,"disableAudio");Om([ut.trace("MediaHandler.setAudioDevice")],Th.prototype,"setAudioDevice");Om([ut.trace("MediaHandler.enableVideo")],Th.prototype,"enableVideo");Om([ut.trace("MediaHandler.disableVideo")],Th.prototype,"disableVideo");Om([ut.trace("MediaHandler.setVideoDevice")],Th.prototype,"setVideoDevice");Om([ut.trace("MediaHandler.updateVideoConstraints")],Th.prototype,"updateVideoConstraints");Om([ut.trace("MediaHandler.enableScreenShare")],Th.prototype,"enableScreenShare");Om([ut.trace("MediaHandler.disableScreenShare")],Th.prototype,"disableScreenShare");Om([ut.trace("MediaHandler.updateScreenshareConstraints")],Th.prototype,"updateScreenshareConstraints");Om([ut.trace("MediaHandler.destruct")],Th.prototype,"destruct");Om([ut.trace("MediaHandler.onDeviceChange")],Th.prototype,"onDeviceChange");function _z(t,e,n){switch(!0){case so.isChromiumBased():switch(e){case"NotAllowedError":return n.includes("by system")?"SYSTEM_DENIED":t==="screenshare"?"CANCELED":"DENIED";case"NotReadableError":default:return"COULD_NOT_START"}case so.isSafari():switch(e){case"NotAllowedError":return"DENIED";default:return"COULD_NOT_START"}case so.isFirefox():switch(e){case"NotFoundError":case"NotReadableError":return"SYSTEM_DENIED";case"NotAllowedError":return"DENIED";case"AbortError":default:return"COULD_NOT_START"}default:return"COULD_NOT_START"}}const xEn=["virtual","emulator","krisp","solstice conference","teams","loom","zoom","manycam","blackhole","displayport","xsplit","wirecast","vMix","elgato","epiphan","voice changer","voicemod","morphvoxx"];function GY(t){var e,n;const r=(e=t.label)==null?void 0:e.toLowerCase();return((n=so._bowser)==null?void 0:n.getOSName())==="macOS"&&r.includes("iphone")?!0:xEn.some(s=>r==null?void 0:r.includes(s))}function wEn(t,e,n){return me(this,null,function*(){if(!(e!=null&&e.length))return n;const r=t.getValue("logger"),s=new AudioContext,i=yield Promise.all(e==null?void 0:e.map(c=>c(s))),o=s.createMediaStreamSource(new MediaStream([n])),l=s.createMediaStreamDestination();try{let c=o;for(let d=0;d<i.length;d+=1)c.connect(i[d]),c=i[d];c.connect(l)}catch(c){return r.error("getTransformedAudioTrack::middleware_execution_failed",{error:c}),n}return l.stream.getAudioTracks()[0]})}var o_,YG;class kEn{constructor(e){Se(this,o_,void 0),Se(this,YG,void 0),Te(this,YG,e)}get logger(){return L(this,YG).getValue("logger")}terminateMiddlewareWebWorker(){if(L(this,o_))try{Zmt(L(this,o_)),Te(this,o_,void 0)}catch{this.logger.debug("WorkerTimers::terminateMiddlewareWebWorker::failed")}}getTransformedVideoTrack(e,n,r){return me(this,null,function*(){if(!(e!=null&&e.length))return n;const s=document.createElement("canvas"),i=yield Promise.all(e==null?void 0:e.map(h=>h({canvas:s,WorkerTimers:Xmt})));if(r.disablePerFrameCanvasRendering){const h=s.captureStream().getVideoTracks()[0];return Object.defineProperty(h,"originalSettings",{value:n.getSettings()}),h}const o=document.createElement("video"),l=new MediaStream;l.addTrack(n);const c=s.getContext("2d");o.srcObject=l,o.autoplay=!0,this.terminateMiddlewareWebWorker();const d=()=>me(this,null,function*(){if(n.enabled===!1||n.readyState==="ended"){this.terminateMiddlewareWebWorker(),o.remove(),s.remove();return}try{c.drawImage(o,0,0);for(let h=0;h<i.length;h+=1)typeof i[h]=="function"&&(yield i[h](s,c))}catch(h){this.logger.error("getTransformedVideoTrack::middleware_execution_failed",{error:h})}});try{o.play()}catch{}o.addEventListener("play",()=>{s.width=o.width||n.getSettings().width,s.height=o.width||n.getSettings().height,Te(this,o_,Jmt(d,50))},!1);const u=s.captureStream().getVideoTracks()[0];return Object.defineProperty(u,"originalSettings",{value:n.getSettings()}),u})}}o_=new WeakMap,YG=new WeakMap;const SEn={qvga:{width:{ideal:320},height:{ideal:240},frameRate:{ideal:30}},vga:{width:{ideal:640},height:{ideal:480},frameRate:{ideal:30}},hd:{width:{ideal:1280},height:{ideal:720},frameRate:{ideal:30}},fhd:{width:{ideal:1920},height:{ideal:1080},frameRate:{ideal:30}},uhd:{width:{ideal:3840},height:{ideal:2160},frameRate:{ideal:30}}},CEn=[[320,[{rid:"f",scaleResolutionDownBy:1},{rid:"h",scaleResolutionDownBy:2}]],[640,[{rid:"f",scaleResolutionDownBy:1},{rid:"h",scaleResolutionDownBy:2}]],[1280,[{rid:"f",scaleResolutionDownBy:1},{rid:"h",scaleResolutionDownBy:2},{rid:"q",scaleResolutionDownBy:4}]],[1920,[{rid:"f",scaleResolutionDownBy:1},{rid:"h",scaleResolutionDownBy:2},{rid:"q",scaleResolutionDownBy:4}]],[3840,[{rid:"f",scaleResolutionDownBy:1},{rid:"h",scaleResolutionDownBy:2},{rid:"q",scaleResolutionDownBy:4}]]],jEn=(t,e)=>{var n,r,s;const i=(n=t==null?void 0:t.getValue("overrides"))==null?void 0:n.simulcastConfig;if((r=i==null?void 0:i.encodings)!=null&&r.length)return i.encodings;const o="getSettings"in e&&e.getSettings().width||"getConstraints"in e&&e.getConstraints().width||"originalSettings"in e&&((s=e.originalSettings)==null?void 0:s.width),l=CEn,c=l.map(([h])=>h).sort((h,m)=>h-m);let d=Number.MAX_VALUE,u=0;return c.forEach((h,m)=>{Math.abs(h-o)<d&&(d=Math.abs(h-o),u=m)}),l[u][1]};var Go=(t=>(t.WEBCAM="webcam",t.WEBCAM_BACKUP="webcam_backup",t.MIC="mic",t.SCREENSHARE_VIDEO="screenshare_video",t.SCREENSHARE_AUDIO="screenshare_audio",t))(Go||{});const EEn=ywn(),iT=gy(EEn.config.media);function NEn(t){var e,n;const r={};return t.audio&&(r.audio={enableStereo:(e=t.audio.enableStereo)!=null?e:!1,enableHighBitrate:(n=t.audio.enableHighBitrate)!=null?n:!1}),r.video=t.video.quality,r}var l_,kve;class TEn{constructor(e,n){Se(this,l_,void 0),Se(this,kve,void 0),xe(this,"getScreenShareConstraints",()=>{var r,s,i,o,l,c,d,u,h;const m=(r=L(this,l_))==null?void 0:r.screenshare,f=(i=(s=m==null?void 0:m.width)==null?void 0:s.max)!=null?i:1920,p=(l=(o=m==null?void 0:m.height)==null?void 0:o.max)!=null?l:1080,g=(d=(c=m==null?void 0:m.frameRate)==null?void 0:c.max)!=null?d:5,v=(h=(u=m==null?void 0:m.frameRate)==null?void 0:u.ideal)!=null?h:5,b=m==null?void 0:m.displaySurface,x=m==null?void 0:m.selfBrowserSurface;let w={width:{max:f},height:{max:p},frameRate:{ideal:v,max:g}};return b!==void 0&&["monitor","browser","window"].includes(b)&&(w=Dr(en({},w),{displaySurface:b})),x!==void 0&&(w=Dr(en({},w),{selfBrowserSurface:x})),{audio:!0,video:w}}),xe(this,"getAudioConstraints",r=>{var s,i,o,l,c,d,u;const h={},m=(s=L(this,l_))==null?void 0:s.audio,f=m!=null&&m.enableStereo?2:1;return so.isFirefox()||so.isWebKitBased()?(h.audio={deviceId:r,autoGainControl:(i=m==null?void 0:m.autoGainControl)!=null?i:!0,echoCancellation:(o=m==null?void 0:m.echoCancellation)!=null?o:!0,noiseSuppression:(l=m==null?void 0:m.noiseSupression)!=null?l:!0,channelCount:f},h):(h.audio={autoGainControl:(c=m==null?void 0:m.autoGainControl)!=null?c:!0,echoCancellation:(d=m==null?void 0:m.echoCancellation)!=null?d:!0,noiseSuppression:(u=m==null?void 0:m.noiseSupression)!=null?u:!0,channelCount:f},r&&(h.audio.deviceId={exact:r}),h)}),xe(this,"getVideoConstraints",r=>{var s,i,o;const l={},c=(s=L(this,l_))==null?void 0:s.video,d=Lxn(SEn);let u=d.vga;if(typeof c=="string"){const h=d[c];h&&(u=h)}else c!==void 0&&(u.height.ideal=c.height.ideal,u.width.ideal=c.width.ideal,u.frameRate.ideal=(o=(i=c.frameRate)==null?void 0:i.ideal)!=null?o:30);return l.video=u,typeof l.video=="boolean"||(r?l.video.deviceId={exact:r}:l.video.facingMode="user"),l}),Te(this,kve,e),Te(this,l_,n)}getUpdatedVideoConstraints(e){return e}}l_=new WeakMap,kve=new WeakMap;class Kle extends Error{constructor(e,n,r){super(n),xe(this,"constraints"),xe(this,"name"),this.name=e,this.constraints=r}}class _En{constructor(){xe(this,"permissions"),this.permissions={audio:"NOT_REQUESTED",video:"NOT_REQUESTED",screenshare:"NOT_REQUESTED"}}getAudioInputDevices(e){return me(this,null,function*(){let n=e;return e||(n=yield this.getAvailableDevices()),n.filter(r=>r.kind==="audioinput")})}getVideoInputDevices(e){return me(this,null,function*(){let n=e;return e||(n=yield this.getAvailableDevices()),n.filter(r=>r.kind==="videoinput")})}getAudioOutputDevices(e){return me(this,null,function*(){let n=e;return e||(n=yield this.getAvailableDevices()),n.filter(r=>r.kind==="audiooutput")})}}var AEn=Object.defineProperty,PEn=Object.getOwnPropertyDescriptor,Kg=(t,e,n,r)=>{for(var s=r>1?void 0:r?PEn(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&AEn(e,n,s),s},ZL,mp,Wc,yFe;let Tm=(yFe=class extends _En{constructor(t,e){super(),Se(this,ZL,void 0),Se(this,mp,void 0),Se(this,Wc,void 0),Te(this,Wc,t),Te(this,mp,new TEn(t,e)),Te(this,ZL,new AbortController)}get telemetry(){return L(this,Wc).getValue("telemetry")}get logger(){return L(this,Wc).getValue("logger")}get constraintsBuilder(){return L(this,mp)}destruct(){return me(this,null,function*(){var t;(t=L(this,ZL))==null||t.abort()})}handlePermissionErrors(t,e){const n=_z(t,e.name,e.message);return this.permissions[t]=n,L(this,Wc).getValue("peerSessionStore").emit(Et.MEDIA_PERMISSION_ERROR,{message:n,constraints:e.constraints,kind:t}),n}getAudioAndVideoTrack(t,e){return me(this,null,function*(){var n,r,s,i;try{const o=yield this.getAudioInputDevices(),l=yield this.getVideoInputDevices(),c=!!(o!=null&&o.find(v=>v.deviceId===t));let d;t&&c?d=t:o&&(n=o[0])!=null&&n.deviceId&&(d=(r=o[0])==null?void 0:r.deviceId);const u=!!(l!=null&&l.find(v=>v.deviceId===e));let h;e&&u?h=e:l&&(s=l[0])!=null&&s.deviceId&&(h=(i=l[0])==null?void 0:i.deviceId);const m={audio:L(this,mp).getAudioConstraints(d).audio,video:L(this,mp).getVideoConstraints(h).video};this.logger.info("getUserMediaWithoutTimeout::requesting_user_media",{constraints:JSON.stringify(m)});const f=yield navigator.mediaDevices.getUserMedia(m);this.logger.info("getUserMediaWithoutTimeout::received_user_media",{constraints:JSON.stringify(m)});const p=f.getAudioTracks()[0];let g=f.getVideoTracks()[0];if(this.permissions.audio="ACCEPTED",this.permissions.video="ACCEPTED",g.label.includes("OBS Virtual")){const v=(yield this.getVideoInputDevices()).find(b=>b.label.includes("OBS Virtual"));g=yield this.getVideoTrack(v.deviceId)}return L(this,Wc).getValue("peerSessionStore").emit(Et.MEDIA_PERMISSION_UPDATE,{message:this.permissions.audio,kind:"audio"}),L(this,Wc).getValue("peerSessionStore").emit(Et.MEDIA_PERMISSION_UPDATE,{message:this.permissions.video,kind:"video"}),{audioTrack:p,videoTrack:g}}catch(o){throw this.logger.error("WebMediaInterface.getAudioAndVideoTrack",{error:o}),new _t("Couldnt fetch audio and video track","1605")}})}getAudioTrack(t,e){return me(this,null,function*(){var n,r;let s=yield this.getAudioInputDevices();if(!(s!=null&&s.length))throw this.permissions.audio="NO_DEVICES_AVAILABLE",L(this,Wc).getValue("peerSessionStore").emit(Et.MEDIA_PERMISSION_UPDATE,{message:this.permissions.audio,kind:"audio"}),new _t("No audio devices available","1606");const i=!!(s!=null&&s.find(c=>c.deviceId===e));let o;e&&i?o=e:(n=s[0])!=null&&n.deviceId&&(o=(r=s[0])==null?void 0:r.deviceId);const l=c=>me(this,null,function*(){let d;try{s=s.filter(h=>h.deviceId!==c),d=L(this,mp).getAudioConstraints(c),this.logger.info("getUserMediaWithoutTimeout::requesting_user_media",{constraints:JSON.stringify(d)});const[u]=(yield navigator.mediaDevices.getUserMedia(d)).getAudioTracks();return this.logger.info("getUserMediaWithoutTimeout::received_user_media",{constraints:JSON.stringify(d)}),u}catch(u){const h=_z("audio",u.name,u.message),m=new Kle(u.name,u.message,d);if(h==="COULD_NOT_START"){const f=s.shift();if(!f)throw m;this.logger.info("getAudioTrack::gum_failed",{constraints:JSON.stringify(d),error:u});const p=L(this,mp).getAudioConstraints(f.deviceId);return this.logger.info("getAudioTrack::retrying_gum_for_next_device",{constraints:JSON.stringify(p)}),l(f.deviceId)}throw m}});try{const c=yield l(o);return c.enabled=!t,this.permissions.audio!=="ACCEPTED"&&(this.permissions.audio="ACCEPTED",L(this,Wc).getValue("peerSessionStore").emit(Et.MEDIA_PERMISSION_UPDATE,{message:this.permissions.audio,kind:"audio"})),c}catch(c){throw c.constraints&&this.handlePermissionErrors("audio",c),new _t(c.message,"1601")}})}getVideoTrack(t){return me(this,null,function*(){var e,n,r;const s=(e=yield this.getCurrentDeviceLabel(t))==null?void 0:e.includes("OBS Virtual"),i=yield this.getVideoInputDevices();if(!(i!=null&&i.length))throw this.permissions.video="NO_DEVICES_AVAILABLE",L(this,Wc).getValue("peerSessionStore").emit(Et.MEDIA_PERMISSION_UPDATE,{message:this.permissions.video,kind:"video"}),new _t("No video devices available","1607");const o=!!(i!=null&&i.find(d=>d.deviceId===t));let l;t&&o?l=t:(n=i[0])!=null&&n.deviceId&&(l=(r=i[0])==null?void 0:r.deviceId);const c=d=>me(this,null,function*(){try{let u=d;const{video:h}=u;s&&typeof h!="boolean"&&(u={video:{deviceId:h.deviceId}}),this.logger.info("getUserMediaWithoutTimeout::requesting_user_media",{constraints:JSON.stringify(u)});const[m]=(yield navigator.mediaDevices.getUserMedia(u)).getVideoTracks();if(s&&typeof h!="boolean"&&typeof h.width=="object"){const{width:f,height:p}=m.getSettings(),{ideal:g}=h.width;m.applyConstraints({width:{ideal:g},height:{ideal:Math.floor(p*g/f)},frameRate:h.frameRate})}return this.logger.info("getUserMediaWithoutTimeout::received_user_media",{constraints:JSON.stringify(u)}),m}catch(u){const h=_z("video",u.name,u.message),m=new Kle(u.name,u.message,d);if(h==="COULD_NOT_START"){const f=i.shift();if(!f)throw m;this.logger.info("getVideoTrack::gum_failed",{constraints:JSON.stringify(d),error:u});const p=L(this,mp).getVideoConstraints(f.deviceId);return this.logger.info("getVideoTrack::retrying_gum_for_next_device",{constraints:JSON.stringify(p)}),c({video:p.video})}throw m}});try{const d=L(this,mp).getVideoConstraints(l),u=yield c(d);return this.permissions.video!=="ACCEPTED"&&(this.permissions.video="ACCEPTED",L(this,Wc).getValue("peerSessionStore").emit(Et.MEDIA_PERMISSION_UPDATE,{message:this.permissions.video,kind:"video"})),u}catch(d){throw d.constraints&&this.handlePermissionErrors("video",d),new _t(d.message,"1602")}})}getScreenShareTracks(){return me(this,null,function*(){const t=e=>me(this,null,function*(){try{this.logger.info("getDisplayMediaWithoutTimeout::requesting_display_media",{constraints:JSON.stringify(e)}),L(this,Wc).getValue("callstats").screenShareRequested();const n=yield navigator.mediaDevices.getDisplayMedia(e);return this.logger.info("getDisplayMediaWithoutTimeout::received_display_media",{constraints:JSON.stringify(e)}),n}catch(n){const r=_z("video",n.name,n.message),s=new Kle(n.name,n.message,e),i={video:!0};if(z0n(e,i))throw s;if(r==="COULD_NOT_START")return t(i);throw s}});try{const e=L(this,mp).getScreenShareConstraints(),n=yield t(e);return this.permissions.screenshare!=="ACCEPTED"&&(this.permissions.screenshare="ACCEPTED",L(this,Wc).getValue("peerSessionStore").emit(Et.MEDIA_PERMISSION_UPDATE,{message:this.permissions.screenshare,kind:"screenshare"})),{audioTrack:n.getAudioTracks()[0],videoTrack:n.getVideoTracks()[0]}}catch(e){throw e.constraints&&this.handlePermissionErrors("screenshare",e),new _t(e.message,"1612")}})}getCurrentDeviceLabel(t){return me(this,null,function*(){const e=yield this.getDevice(t||"default");return e==null?void 0:e.label})}enumerateDevicesWithExternalFirst(){return me(this,null,function*(){const t=yield navigator.mediaDevices.enumerateDevices(),e=r=>{var s;const i=((s=r.label)==null?void 0:s.toLowerCase())||"";return GY(r)?4:i.includes("airpods")||i.includes("airdopes")||i.includes("bluetooth")||i.includes("wireless")||i.includes("headphones")||i.includes("headset")||i.includes("earbuds")||i.includes("usb")||i.includes("external")?0:r.deviceId==="default"||i.includes("default")?1:i.includes("built-in")||i.includes("internal")?2:3},n=r=>{var s;if(r.kind!=="videoinput")return!1;const i=((s=r.label)==null?void 0:s.toLowerCase())||"";return i.includes("front")||i.includes("user")||i.includes("selfie")?!0:!(i.includes("back")||i.includes("rear")||i.includes("environment"))};return t.sort((r,s)=>{var i,o;const l=e(r),c=e(s);if(l!==c)return l-c;const d=r.deviceId==="default"||((i=r.label)==null?void 0:i.toLowerCase().includes("default")),u=s.deviceId==="default"||((o=s.label)==null?void 0:o.toLowerCase().includes("default"));if(d&&!u)return-1;if(!d&&u)return 1;if(r.kind==="videoinput"&&s.kind==="videoinput"){const h=n(r),m=n(s);if(h&&!m)return-1;if(!h&&m)return 1}return 0})})}getAvailableDevices(){return me(this,null,function*(){try{return(yield this.enumerateDevicesWithExternalFirst())||[]}catch(t){return this.logger.error("enumerate_devices_failed",{error:t}),[]}})}getAvailableDevicesByKind(t){return me(this,null,function*(){try{return(yield this.enumerateDevicesWithExternalFirst()).filter(({kind:e})=>t===e)}catch(e){throw this.logger.error("enumerate_devices_failed",{error:e}),new _t("Failed to get available devices by kind","1609")}})}getDevice(t){return me(this,null,function*(){try{return(yield this.enumerateDevicesWithExternalFirst()).filter(e=>e.deviceId===t)[0]}catch(e){throw this.logger.error("enumerate_devices_failed",{error:e}),new _t("Failed to get device","1609")}})}onDeviceChange(t){return me(this,null,function*(){if(so.supportsDeviceChangeEvent()){let e=yield this.getAvailableDevices();navigator.mediaDevices.addEventListener("devicechange",n=>me(this,null,function*(){var r,s;const i=u=>`${u.kind}-${u.label}-${u.deviceId}-${u.groupId}`,o=new Set(e.map(u=>i(u))),l=yield this.getAvailableDevices(),c=new Set(l.map(u=>i(u))),d={added:l.filter(u=>!o.has(i(u))),removed:e.filter(u=>!c.has(i(u))),devices:l};if(e=l,(r=d.added)!=null&&r.length||(s=d.removed)!=null&&s.length){this.logger.info("repopulated_full_device_list",{devices:JSON.stringify(l)});const u=[...d.added,...d.removed];u.some(h=>h.kind==="audioinput")&&L(this,Wc).getValue("callstats").devices("AUDIO",l==null?void 0:l.filter(h=>h.kind==="audioinput")),u.some(h=>h.kind==="videoinput")&&L(this,Wc).getValue("callstats").devices("VIDEO",l==null?void 0:l.filter(h=>h.kind==="videoinput")),u.some(h=>h.kind==="audiooutput")&&L(this,Wc).getValue("callstats").devices("SPEAKER",l==null?void 0:l.filter(h=>h.kind==="audiooutput")),t(n,d,!1)}}),{signal:L(this,ZL).signal})}})}},ZL=new WeakMap,mp=new WeakMap,Wc=new WeakMap,yFe);Kg([ut.trace("WebMediaInterface.destruct")],Tm.prototype,"destruct",1);Kg([ut.trace("WebMediaInterface.handlePermissionErrors")],Tm.prototype,"handlePermissionErrors",1);Kg([ut.trace("WebMediaInterface.getAudioAndVideoTrack")],Tm.prototype,"getAudioAndVideoTrack",1);Kg([ut.trace("WebMediaInterface.getAudioTrack")],Tm.prototype,"getAudioTrack",1);Kg([ut.trace("WebMediaInterface.getVideoTrack")],Tm.prototype,"getVideoTrack",1);Kg([ut.trace("WebMediaInterface.getScreenShareTracks")],Tm.prototype,"getScreenShareTracks",1);Kg([ut.trace("WebMediaInterface.getAvailableDevices")],Tm.prototype,"getAvailableDevices",1);Kg([ut.trace("WebMediaInterface.getAvailableDevicesByKind")],Tm.prototype,"getAvailableDevicesByKind",1);Kg([ut.trace("WebMediaInterface.getDevice")],Tm.prototype,"getDevice",1);Kg([ut.trace("WebMediaInterface.onDeviceChange")],Tm.prototype,"onDeviceChange",1);Tm=Kg([tu("1600")],Tm);const Qpt=Tm,Qj={setItem:(t,e,n)=>{try{localStorage.setItem(t,e)}catch(r){n==null||n.error("LocalStorage::setItem::crashed",{error:r,localStorage:{key:t,value:e}})}},getItem:(t,e)=>{try{return localStorage.getItem(t)}catch(n){e==null||e.error("LocalStorage::getItem::crashed",{error:n,localStorage:{key:t}})}return null}},REn=(t=0)=>new Promise(e=>setTimeout(e,t)),IEn=(t,e,n)=>{const r=n,s=t.createMediaStreamSource(e),i=t.createAnalyser();i.fftSize=2048,s.connect(i);const o=new Uint8Array(i.fftSize);let l=!1;setTimeout(()=>{l=!0},r);function c(){return l?Promise.resolve(!0):(i.getByteTimeDomainData(o),o.some(d=>d!==128&&d!==0)?Promise.resolve(!1):REn().then(c))}return c().then(d=>(s.disconnect(),d),d=>{throw s.disconnect(),d})},MEn=typeof AudioContext<"u"?AudioContext:null;class mEe{constructor(e){xe(this,"_AudioContext"),xe(this,"audioContext"),xe(this,"_audioContextRefContainers");const n=en({AudioContext:MEn},e);Object.defineProperties(this,{_AudioContext:{value:n.AudioContext},audioContext:{value:null,writable:!0},_audioContextRefContainers:{value:new Set},AudioContextProvider:{enumerable:!0,value:mEe}})}getOrCreate(e){if(!this._audioContextRefContainers.has(e)&&(this._audioContextRefContainers.add(e),this._AudioContext&&!this.audioContext))try{this.audioContext=new this._AudioContext}catch{}return this.audioContext}release(e){this._audioContextRefContainers.has(e)&&(this._audioContextRefContainers.delete(e),!this._audioContextRefContainers.size&&this.audioContext&&(this.audioContext.close(),this.audioContext=null))}}const bFe=new mEe,LEn=3,DEn=250;function $En(t){const e={},n=bFe.getOrCreate(e);let r=LEn;function s(){return r-=1,IEn(n,t.srcObject,DEn).then(i=>i?r>0?s():!0:!1).catch(()=>!0)}return s().finally(()=>{bFe.release(e)})}function xFe(t,e){return me(this,null,function*(){const n=new Audio,r=new MediaStream;r.addTrack(e),n.srcObject=r;let s=!1;try{const i=n.play();i&&(yield i),s=yield $En(n),s&&t.info("checkIfAudioTrackIsSilent::silence_detected")}catch(i){t.error("checkIfAudioTrackIsSilent::failed_to_detect_silence",{error:i})}finally{n.pause(),n.remove()}return s})}var OEn=Object.defineProperty,FEn=Object.getOwnPropertyDescriptor,Zpt=(t,e,n,r)=>{for(var s=r>1?void 0:r?FEn(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&OEn(e,n,s),s};let WY=class extends jI{constructor(t,e,n,r){var s;const i=t.getValue("logger");super(i),xe(this,"constructorName",this.constructor.name),xe(this,"userSelectedDevice"),xe(this,"mediaInterface"),xe(this,"isNonPreferredDevice"),xe(this,"_mediaTrack"),xe(this,"transformedMediaTrack"),xe(this,"middlewares",[]),xe(this,"currentDevice"),xe(this,"userPreferredDeviceKey",`Realtimekit::${this.constructorName}::UserDeviceID`),xe(this,"setUserPreferredDevice",o=>Qj.setItem(this.userPreferredDeviceKey,o,this.logger)),xe(this,"getUserPreferredDevice",()=>Qj.getItem(this.userPreferredDeviceKey,this.logger)),xe(this,"isCustomTrack",!1),xe(this,"context"),this.context=t,this.mediaInterface=e,n&&this.setMediaTrack(n),this.userSelectedDevice=(s=this.getUserPreferredDevice())!=null?s:void 0,this.isNonPreferredDevice=r,this.onTrackEnded=this.onTrackEnded.bind(this),this.onTrackMuted=this.onTrackMuted.bind(this)}get telemetry(){return this.context.getValue("telemetry")}disableTrack(){var t,e;this.removeMediaTrackListeners(),this.isCustomTrack||(t=this._mediaTrack)==null||t.stop(),this._mediaTrack=void 0,(e=this.transformedMediaTrack)==null||e.stop(),this.transformedMediaTrack=void 0}get mediaTrack(){return this._mediaTrack}setMediaTrack(t,e=!1){return me(this,null,function*(){const n=r=>{this.logger.error(`${this.constructorName}.setMediaTrack.error`,{error:r})};try{this.disableTrack()}catch(r){n(r)}this._mediaTrack=yield this.conditionallyChangeTrack(t,e),yield this.setTransformedTrack();try{this.addMediaTrackListeners(),yield this.setCurrentDevice()}catch(r){n(r)}})}get trackEnabled(){return!!this.mediaTrack&&this.mediaTrack.readyState==="live"&&this.mediaTrack.enabled}muteTrack(){if(!this.mediaTrack){this.logger.warn("BaseMediaHandler.muteTrack Tried muting with no track present");return}this.transformedMediaTrack&&(this.transformedMediaTrack.enabled=!1),this.mediaTrack.enabled=!1}unmuteTrack(){return me(this,null,function*(){try{this.mediaTrack?this.mediaTrack.enabled=!0:yield this.enableTrack(!1)}catch(t){throw this.logger.error(`${this.constructorName}.unmuteTrack.error`,{error:t}),this.disableTrack(),new _t("Failed to unmute track","1611")}})}getCurrentDeviceId(){var t;const{kind:e}=this.mediaTrack;switch(e){case"audio":{const{deviceId:n}=this.mediaTrack.getSettings();if(n)return n;const r=this.mediaTrack.getConstraints();return this.userSelectedDevice?(r&&typeof r.deviceId=="object"&&"exact"in r.deviceId?r.deviceId.exact:r.deviceId)||((t=r==null?void 0:r.advanced)==null?void 0:t[0].deviceId)||"default":this.mediaTrack.getSettings().deviceId}default:return this.mediaTrack.getSettings().deviceId}}setCurrentDevice(){return me(this,null,function*(){var t;if(!this.mediaTrack){this.currentDevice=void 0;return}const e=this.getCurrentDeviceId();((t=this.currentDevice)==null?void 0:t.deviceId)!==e&&(this.currentDevice=yield this.mediaInterface.getDevice(e))})}setDevice(t,e){return me(this,arguments,function*(n,{saveDevicePreference:r}){if(!n)throw this.logger.warn(`${this.constructorName}.setDevice No device received`),new _t("No device received!","1603");this.userSelectedDevice=n.deviceId,r&&this.setUserPreferredDevice(n.deviceId),yield this.onSetDevice(n)})}addMiddleware(t){return me(this,null,function*(){if(so.isWebKitBased()&&!(so.isSafari()&&nwn.test(so.getVersion())))return{success:!1,message:"Middlewares are not supported in this WebKit engine based browser."};if(this.middlewares.includes(t))return{success:!1,message:"This middleware has been applied, already. Skipping."};try{return this.middlewares.push(t),this.trackEnabled&&(yield this.setTransformedTrack()),{success:!0,message:"Successfully added the middleware."}}catch(e){return this.logger.error("While adding middleware",{error:e}),this.removeMiddleware(t),{success:!1,message:e==null?void 0:e.message}}})}removeMiddleware(t){return me(this,null,function*(){const e=this.middlewares.indexOf(t,0);if(e>-1)try{return this.middlewares.splice(e,1),yield this.setTransformedTrack(!0),{success:!0,message:"Successfully removed the middleware."}}catch(n){return this.logger.error("While removing middleware",{error:n}),{success:!1,message:n==null?void 0:n.message}}return{success:!1,message:"No such middleware was found. Skipping."}})}removeAllMiddlewares(){return me(this,null,function*(){var t;if((t=this.middlewares)!=null&&t.length)try{return this.middlewares=[],yield this.setTransformedTrack(!0),{success:!0,message:"Successfully removed all the middlewares."}}catch(e){return this.logger.error("While removing all the middlewares",{error:e}),{success:!1,message:e==null?void 0:e.message}}return{success:!1,message:"No middlewares were found. Skipping."}})}addMediaTrackListeners(){var t,e,n;this.mediaTrack&&(this.logger.info(`${this.constructorName}.addMediaTrackListeners for deviceId ${(e=(t=this.mediaTrack)==null?void 0:t.getSettings())==null?void 0:e.deviceId} of type ${(n=this.mediaTrack)==null?void 0:n.kind}`),this.mediaTrack.addEventListener("ended",this.onTrackEnded),this.mediaTrack.addEventListener("mute",this.onTrackMuted))}removeMediaTrackListeners(){var t,e,n;this.mediaTrack&&(this.logger.info(`${this.constructorName}.removeMediaTrackListeners for deviceId ${(e=(t=this.mediaTrack)==null?void 0:t.getSettings())==null?void 0:e.deviceId} of type ${(n=this.mediaTrack)==null?void 0:n.kind}`),this.logger.info(`${this.constructorName}.removeMediaTrackListeners`),this.mediaTrack.removeEventListener("ended",this.onTrackEnded),this.mediaTrack.removeEventListener("mute",this.onTrackMuted))}};Zpt([ut.trace("BaseMediaHandler.unmuteTrack")],WY.prototype,"unmuteTrack",1);WY=Zpt([tu("1600")],WY);const Jpt=WY;var BEn=Object.defineProperty,UEn=Object.getOwnPropertyDescriptor,fEe=(t,e,n,r)=>{for(var s=UEn(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&BEn(e,n,s),s};const Yle="[Realtimekit]nonSilentDeviceLabels";class Ote extends Jpt{onSetDevice(e){return me(this,null,function*(){if(!e)throw this.logger.warn("AudioMediaHandler.setDevice No device received"),new _t("No device received!","1603");if(e.kind!=="audioinput")throw this.logger.warn("AudioMediaHandler.setDevice Received non audio device"),new _t("Non audio device received while setting device!","1603");try{const n=this.trackEnabled;this.disableTrack(),yield this.setMediaTrack(yield this.mediaInterface.getAudioTrack(!n,this.userSelectedDevice))}catch(n){throw this.logger.error("AudioMediaHandler.setDevice.error",{error:n}),this.disableTrack(),new _t(n.message,"1604")}})}enableTrack(e,n){return me(this,null,function*(){if(this.trackEnabled){this.logger.warn("AudioMediaHandler.enableTrack Track already enabled!");return}if(n){this.isCustomTrack=!0,yield this.setMediaTrack(n,!0);return}this.isCustomTrack=!1;const r=yield this.mediaInterface.getAudioTrack(e,this.userSelectedDevice);yield this.setMediaTrack(r)})}setTransformedTrack(e){return me(this,null,function*(){var n;if(!e&&!((n=this.middlewares)!=null&&n.length)){this.transformedMediaTrack=this.mediaTrack;return}try{this.transformedMediaTrack=yield wEn(this.context,this.middlewares,this.mediaTrack),this.emit("trackChanged")}catch(r){this.logger.error("AudioMediaHandler.setTransformedTrack",{error:r}),this.transformedMediaTrack=this.mediaTrack}})}onTrackEnded(){return me(this,null,function*(){this.logger.info("AudioMediaHandler.TrackEnded"),this.emit("trackEnded");const e=this.mediaTrack.enabled;this.disableTrack(),yield this.enableTrack(!e),yield this.setTransformedTrack(),this.emit("trackChanged")})}onTrackMuted(){this.logger.info("AudioMediaHandler.TrackMuted"),this.emit("trackMuted")}conditionallyChangeTrack(e,n=!1){return me(this,null,function*(){var r;if(!e||this.userSelectedDevice||n)return e;let s=e;const i=yield this.mediaInterface.getAudioInputDevices(),o=this.isNonPreferredDevice?i.filter(d=>d&&!this.isNonPreferredDevice(d)):i;if(!(o!=null&&o.length))return s;o.find(d=>d.deviceId===e.getSettings().deviceId)||(s.stop(),this.logger.info("localmediahandler::setupstreams::found_audio_non_preferred"),s=yield this.mediaInterface.getAudioTrack(!1,o[0].deviceId));const l=JSON.parse(Qj.getItem(Yle,this.logger));if(l!=null&&l.devices.some(d=>d.label===s.label))return s;if(!(yield xFe(this.logger,s))){const d=(r=l==null?void 0:l.devices.concat({label:s.label}))!=null?r:[{label:s.label}];return Qj.setItem(Yle,JSON.stringify({devices:d}),this.logger),s}this.logger.info("AudioMediaHandler.conditionallyChangeTrack.DetectedSilentTrack");const c=s.getSettings().deviceId;return o.filter(d=>d.deviceId!==c).some(d=>me(this,null,function*(){var u;if(s=yield this.mediaInterface.getAudioTrack(!1,d.deviceId),!(yield xFe(this.logger,s))){const h=(u=l==null?void 0:l.devices.concat({label:s.label}))!=null?u:[{label:s.label}];return Qj.setItem(Yle,JSON.stringify({devices:h}),this.logger),this.logger.info("AudioMediaHandler.conditionallyChangeTrack.SuccesfullyChangedTrack"),!0}return this.logger.info("AudioMediaHandler.conditionallyChangeTrack.AnotherSilentTrackFound"),!1})),s})}}fEe([ut.trace("AudioMediaHandler.setTransformedTrack")],Ote.prototype,"setTransformedTrack");fEe([ut.trace("AudioMediaHandler.onTrackEnded")],Ote.prototype,"onTrackEnded");fEe([ut.trace("AudioMediaHandler.conditionallyChangeTrack")],Ote.prototype,"conditionallyChangeTrack");const zEn=Ote;var c_;class VEn{constructor(e,n){Se(this,c_,void 0),xe(this,"currentDevice"),xe(this,"userPreferredDeviceKey","Realtimekit::speaker::UserDeviceID"),xe(this,"logger"),xe(this,"setUserPreferredDevice",r=>Qj.setItem(this.userPreferredDeviceKey,r,this.logger)),xe(this,"getUserPreferredDevice",()=>Qj.getItem(this.userPreferredDeviceKey,this.logger)),Te(this,c_,n),this.logger=e.getValue("logger")}setPreferredSpeaker(){return me(this,null,function*(){const e=this.getUserPreferredDevice(),n=yield L(this,c_).getAudioOutputDevices(),r=n==null?void 0:n.find(s=>s.deviceId===e);yield this.setupSpeaker(r,{saveDevicePreference:!1})})}setupSpeaker(e,n){return me(this,arguments,function*(r,{saveDevicePreference:s}){var i,o;if(!(L(this,c_)instanceof Qpt))return;let l=r;if(r||([l]=(yield L(this,c_).getAvailableDevicesByKind("audiooutput")).filter(d=>!GY(d))),!l)throw new _t("No speaker found","1608");if(((i=this.currentDevice)==null?void 0:i.deviceId)===l.deviceId)return;s&&this.setUserPreferredDevice(l.deviceId),this.currentDevice=l;const c=document.querySelectorAll("audio");(o=c[0])!=null&&o.setSinkId&&c.forEach(d=>me(this,null,function*(){if(typeof d.sinkId<"u"&&this.currentDevice.deviceId&&d.sinkId!==this.currentDevice.deviceId)try{yield d.setSinkId(this.currentDevice.deviceId)}catch{}}))})}}c_=new WeakMap;const HEn=VEn;var QG;class GEn extends jI{constructor(e,n){const r=e.getValue("logger");super(r),xe(this,"mediaInterface"),xe(this,"audioMediaTrack"),xe(this,"videoMediaTrack"),Se(this,QG,void 0),Te(this,QG,e),this.mediaInterface=n}get trackEnabled(){return!!this.videoMediaTrack}enableScreenShare(){return me(this,null,function*(){var e,n;try{const{audioTrack:r,videoTrack:s}=yield this.mediaInterface.getScreenShareTracks();if(this.audioMediaTrack=r,this.videoMediaTrack=s,this.addMediaTrackListeners(),((n=(e=this.mediaInterface)==null?void 0:e.permissions)==null?void 0:n.screenshare)==="ACCEPTED")return;this.mediaInterface.permissions&&(this.mediaInterface.permissions.screenshare="ACCEPTED",L(this,QG).getValue("peerSessionStore").emit(Et.MEDIA_PERMISSION_UPDATE,{message:this.mediaInterface.permissions.screenshare,kind:"screenshare"}))}catch{}})}disableScreenShare(){var e,n;this.removeMediaTrackListeners(),(e=this.audioMediaTrack)==null||e.stop(),(n=this.videoMediaTrack)==null||n.stop(),this.videoMediaTrack=void 0,this.audioMediaTrack=void 0}updateConstraints(e){return me(this,null,function*(){if(!this.videoMediaTrack)throw new _t("No media track enabled!","1610");const n=this.mediaInterface;if(!n.constraintsBuilder)throw new _t("update constraints not supported for non web clients","1100",this.logger);try{this.videoMediaTrack.applyConstraints(n.constraintsBuilder.getUpdatedVideoConstraints(e)),this.addMediaTrackListeners()}catch(r){this.logger.error("ScreenShareHandler.updateConstraints.error",{error:r})}})}addMediaTrackListeners(){var e,n;(e=this.videoMediaTrack)==null||e.addEventListener("ended",this.onTrackEnded.bind(this)),so.isWebKitBased()&&((n=this.videoMediaTrack)==null||n.addEventListener("mute",this.onTrackEnded.bind(this)))}removeMediaTrackListeners(){var e,n;(e=this.videoMediaTrack)==null||e.removeEventListener("ended",this.onTrackEnded),(n=this.videoMediaTrack)==null||n.removeEventListener("mute",this.onTrackEnded)}onTrackEnded(){this.emit("trackEnded")}}QG=new WeakMap;const WEn=GEn;var qEn=Object.defineProperty,KEn=Object.getOwnPropertyDescriptor,Fte=(t,e,n,r)=>{for(var s=KEn(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&qEn(e,n,s),s},S4,ZG;class j7 extends Jpt{constructor(e,n,r,s){super(e,n,r,s),Se(this,S4,void 0),Se(this,ZG,{disablePerFrameCanvasRendering:!1}),Te(this,S4,new kEn(e))}onSetDevice(e){return me(this,null,function*(){if(!e)throw this.logger.warn("VideoMediaHandler.setDevice No device received"),new _t("No device received!","1603");if(e.kind!=="videoinput")throw this.logger.warn("VideoMediaHandler.setDevice Received non video device",{devices:[e]}),new _t("Non video device received while setting video device!","1603");if(!(this.mediaTrack&&this.mediaTrack.enabled)){this.logger.warn("VideoMediaHandler.setDevice Tried switching device with video disabled",{devices:[e]}),this.currentDevice=e;return}try{this.disableTrack(),yield this.setMediaTrack(yield this.mediaInterface.getVideoTrack(this.userSelectedDevice))}catch(n){throw this.logger.error("VideoMediaHandler.setDevice.error",{error:n}),this.disableTrack(),new _t("Failed to change device","1600",this.logger)}})}enableTrack(e,n){return me(this,null,function*(){if(this.trackEnabled){this.logger.warn("VideoMediaHandler.enableTrack Track already enabled!");return}if(n){this.isCustomTrack=!0,yield this.setMediaTrack(n,!0);return}this.isCustomTrack=!1;const r=yield this.mediaInterface.getVideoTrack(this.userSelectedDevice);yield this.setMediaTrack(r)})}setTransformedTrack(e){return me(this,null,function*(){var n;if(!e&&!((n=this.middlewares)!=null&&n.length)){this.transformedMediaTrack=this.mediaTrack;return}try{this.transformedMediaTrack=yield L(this,S4).getTransformedVideoTrack(this.middlewares,this.mediaTrack,L(this,ZG)),this.emit("trackChanged")}catch(r){this.logger.error("VideoMediaHandler.setTransformedTrack",{error:r}),this.transformedMediaTrack=this.mediaTrack}})}setVideoMiddlewareGlobalConfig(e){return me(this,null,function*(){Te(this,ZG,e)})}updateConstraints(e){return me(this,null,function*(){if(!this._mediaTrack)throw new _t("No media track enabled!","1610");const n=this.mediaInterface;if(!n.constraintsBuilder)throw new _t("update constraints not supported for non web clients","1100",this.logger);try{this._mediaTrack.applyConstraints(n.constraintsBuilder.getUpdatedVideoConstraints(e)),yield this.setTransformedTrack(),this.addMediaTrackListeners(),yield this.setCurrentDevice()}catch(r){this.logger.error("VideoMediaHandler.updateConstraints.error",{error:r})}})}terminateMiddlewareWebWorker(){L(this,S4).terminateMiddlewareWebWorker()}onTrackEnded(){return me(this,null,function*(){this.logger.info("VideoMediaHandler.TrackEnded"),this.disableTrack(),this.emit("trackEnded")})}onTrackMuted(){this.logger.info("VideoMediaHandler.TrackMuted"),this.emit("trackMuted")}conditionallyChangeTrack(e,n=!1){return me(this,null,function*(){if(!e||this.userSelectedDevice||n)return e;let r=e;const s=yield this.mediaInterface.getVideoInputDevices(),i=this.isNonPreferredDevice?s.filter(o=>!this.isNonPreferredDevice(o)):s;return!(i!=null&&i.length)||window.FAST_RTK||i.find(o=>o.deviceId===e.getSettings().deviceId)||(r.stop(),this.logger.info("localmediahandler::setupstreams::found_video_non_preferred"),r=yield this.mediaInterface.getVideoTrack(i[0].deviceId)),r})}}S4=new WeakMap,ZG=new WeakMap;Fte([ut.trace("VideoMediaHandler.setTransformedTrack")],j7.prototype,"setTransformedTrack");Fte([ut.trace("VideoMediaHandler.setVideoMiddlewareGlobalConfig")],j7.prototype,"setVideoMiddlewareGlobalConfig");Fte([ut.trace("VideoMediaHandler.onTrackEnded")],j7.prototype,"onTrackEnded");Fte([ut.trace("VideoMediaHandler.conditionallyChangeTrack")],j7.prototype,"conditionallyChangeTrack");const YEn=j7,wFe=gy(iEe());var Yu,d_,JG,C4;const j4=class{constructor(e){if(Se(this,Yu,void 0),Se(this,d_,void 0),Se(this,JG,void 0),Se(this,C4,void 0),!e)throw new _t("Could not load preset.","0904");Te(this,Yu,e.config),Te(this,JG,e.name),Te(this,d_,e.ui||gy(iEe().ui)),Te(this,C4,e.permissions.plugins.config)}static fromResponse(e){return new j4(e)}static default(){return new j4(wFe)}static init(e,n=!0){return!e||n?new j4(wFe):new j4(e)}get setupScreen(){return{isEnabled:!0}}get waitingRoom(){return{isEnabled:!0}}get controlBar(){return{isEnabled:!0,elements:{chat:!0,fullscreen:!0,invite:!1,layout:!1,participants:!0,plugins:!0,polls:!0,reactions:!1,screenshare:!0}}}get header(){return{isEnabled:!0,elements:{logo:L(this,d_).designTokens.logo,timer:!0,title:!0,participantCount:!0,changeLayout:!1}}}get pipMode(){return!0}get viewType(){return L(this,Yu).viewType}get livestreamViewerQualities(){return L(this,Yu).livestreamViewerQualities||[]}get maxVideoStreams(){return L(this,Yu).maxVideoStreams}get maxScreenShareCount(){return L(this,Yu).maxScreenshareCount}get plugins(){return[]}get disabledPlugins(){return Object.keys(L(this,C4)).filter(e=>L(this,C4)[e].disabled)}get designTokens(){return L(this,d_).designTokens}get configDiff(){return L(this,d_).configDiff}get isSimulcastEnabled(){var e,n,r,s;return(s=(r=(n=(e=L(this,Yu))==null?void 0:e.media)==null?void 0:n.video)==null?void 0:r.simulcast)!=null?s:!1}get mediaConstraints(){var e,n,r,s,i,o,l,c,d,u,h,m,f,p,g,v,b,x,w,k,S,C,j,E;return{audio:{enableStereo:(s=(r=(n=(e=L(this,Yu))==null?void 0:e.media)==null?void 0:n.audio)==null?void 0:r.enableStereo)!=null?s:iT.audio.enableStereo,enableHighBitrate:(c=(l=(o=(i=L(this,Yu))==null?void 0:i.media)==null?void 0:o.audio)==null?void 0:l.enableHighBitrate)!=null?c:iT.audio.enableHighBitrate},video:{quality:(m=(h=(u=(d=L(this,Yu))==null?void 0:d.media)==null?void 0:u.video)==null?void 0:h.quality)!=null?m:iT.video.quality,frameRate:(v=(g=(p=(f=L(this,Yu))==null?void 0:f.media)==null?void 0:p.video)==null?void 0:g.frameRate)!=null?v:iT.video.frameRate},screenshare:{quality:(k=(w=(x=(b=L(this,Yu))==null?void 0:b.media)==null?void 0:x.screenshare)==null?void 0:w.quality)!=null?k:iT.screenshare.quality,frameRate:(E=(j=(C=(S=L(this,Yu))==null?void 0:S.media)==null?void 0:C.screenshare)==null?void 0:j.frameRate)!=null?E:iT.screenshare.frameRate}}}get name(){return L(this,JG)}};let QEn=j4;Yu=new WeakMap,d_=new WeakMap,JG=new WeakMap,C4=new WeakMap;var ZEn=Object.defineProperty,JEn=Object.getOwnPropertyDescriptor,Xpt=(t,e,n,r)=>{for(var s=JEn(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&ZEn(e,n,s),s},E4,XG;class pEe extends Dm{constructor(e,n){const r=e.getValue("logger");super(r),Se(this,E4,void 0),xe(this,"state","IDLE"),xe(this,"playbackUrl"),xe(this,"ingestionCredentials"),xe(this,"viewerCount"),Se(this,XG,void 0),Te(this,E4,n),Te(this,XG,e),this.viewerCount=0}get telemetry(){return L(this,XG).getValue("telemetry")}setLivestreamState(e){const n=this.state;this.state=e,n!==e&&this.emitCurrentLivestreamState()}emitCurrentLivestreamState(){this.emit("livestreamUpdate",this.state)}start(){return me(this,arguments,function*(e={manualIngestion:!1}){if(!L(this,E4).permissions.canLivestream)throw this.logger.error("Livestream::start::permission_denied"),new _t("User does not have permission to start livestreaming","1901");this.setLivestreamState("STARTING");try{const n=dh(),{playbackUrl:r,ingestionCredentials:s}=yield n.startLivestreaming(e);this.playbackUrl=r,this.ingestionCredentials=s,e!=null&&e.manualIngestion&&this.setLivestreamState("WAITING_ON_MANUAL_INGESTION")}catch(n){throw this.logger.error("Recording::stop::livestream_failed_to_start",{error:n}),this.setLivestreamState("IDLE"),new _t("Error while starting livestream","1900",this.logger)}})}stop(){return me(this,null,function*(){if(!L(this,E4).permissions.canLivestream)throw this.logger.error("Livestream::stop::permission_denied"),new _t("User does not have permission to stop livestreaming","1901");if(this.state!=="LIVESTREAMING"&&this.state!=="WAITING_ON_MANUAL_INGESTION")throw this.logger.error("Livestream::stop::inconsistent_state"),new _t("Livestream not started yet","1902");try{this.setLivestreamState("STOPPING"),yield dh().stopLivestreaming()}catch(e){throw this.logger.error("Livestream::stop::livestream_failed_to_stop",{error:e}),this.setLivestreamState("STOPPING"),new _t("Error while stopping livestream","1900",this.logger)}})}}E4=new WeakMap,XG=new WeakMap;Xpt([ut.trace("livestream.start")],pEe.prototype,"start");Xpt([ut.trace("livestream.stop")],pEe.prototype,"stop");var XEn=Object.defineProperty,eNn=Object.getOwnPropertyDescriptor,tNn=(t,e,n,r)=>{for(var s=eNn(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&XEn(e,n,s),s},N4,T4,Aw,Ab;class egt{constructor(e,n,r){xe(this,"livestream"),Se(this,N4,void 0),Se(this,T4,void 0),Se(this,Aw,void 0),Se(this,Ab,void 0),Te(this,Ab,e),Te(this,T4,n),this.livestream=new pEe(e,n),Te(this,Aw,r),this.setupEvents()}get logger(){return L(this,Ab).getValue("logger")}get telemetry(){return L(this,Ab).getValue("telemetry")}fetchInitialLivestreamingState(){return me(this,null,function*(){const e=dh(),{status:n,playbackUrl:r,manualIngest:s,ingestionCredentials:i}=yield e.getActiveLivestream();this.livestream.playbackUrl=r,this.livestream.ingestionCredentials=i,n==="LIVE"&&this.livestream.setLivestreamState("LIVESTREAMING"),n==="INVOKED"&&s&&this.livestream.setLivestreamState("WAITING_ON_MANUAL_INGESTION")})}setupEvents(){L(this,Aw).on(Rn.startedLivestream,e=>me(this,null,function*(){this.livestream.playbackUrl=e.playbackUrl,this.livestream.setLivestreamState("LIVESTREAMING");try{L(this,T4).permissions.canLivestream&&(yield this.fetchInitialLivestreamingState())}catch{this.logger.error("Error: LivestreamController.fetchLivestream during startedLivestream re-fetch")}})),L(this,Aw).on(Rn.livestreamingInvoked,e=>me(this,null,function*(){if(e.manualIngest){this.livestream.setLivestreamState("WAITING_ON_MANUAL_INGESTION");try{L(this,T4).permissions.canLivestream&&(yield this.fetchInitialLivestreamingState())}catch{this.logger.error("Error: LivestreamController.fetchLivestream during livestreamingInvoked re-fetch")}}})),L(this,Aw).on(Rn.stoppedLivestream,()=>{this.livestream.setLivestreamState("IDLE"),this.livestream.playbackUrl=void 0,this.livestream.ingestionCredentials=void 0}),L(this,Aw).on(Rn.erroredLivestream,()=>{this.livestream.setLivestreamState("IDLE"),this.livestream.playbackUrl=void 0}),L(this,Aw).on(Rn.roomPeerCount,e=>{this.livestream.viewerCount=e.count,this.livestream.emit("viewerCountUpdate",e.count)}),L(this,Ab).getValue("peerSessionStore").on(Et.PEER_JOINED_INTERNAL,e=>me(this,null,function*(){var n;((n=e.flags)==null?void 0:n.hiddenParticipant)===!0&&e.recorderType==="LIVESTREAMER"&&(Te(this,N4,e.id),this.livestream.setLivestreamState("LIVESTREAMING"))})),L(this,Ab).getValue("peerSessionStore").on(Et.PEER_CLOSED,e=>{e.id===L(this,N4)&&(Te(this,N4,void 0),this.livestream.setLivestreamState("IDLE"))}),L(this,Ab).getValue("peerSessionStore").onAsync(Et.LEAVE_MEDIA_ROOM,()=>me(this,null,function*(){if(!this.livestream.playbackUrl){this.logger.info("Fetching livestreaming state on leave stage");try{yield this.fetchInitialLivestreamingState()}catch(e){this.logger.error("Failed to fetch livestreaming state on leave stage",{error:e})}}})),L(this,Ab).getValue("peerSessionStore").on(Et.SOCKET_SERVICE_ROOM_JOINED,()=>me(this,null,function*(){try{yield this.fetchInitialLivestreamingState()}catch{this.logger.error("Error: LivestreamController.fetchLivestream")}}))}}N4=new WeakMap,T4=new WeakMap,Aw=new WeakMap,Ab=new WeakMap;tNn([ut.trace("LivestreamController.setupEvents")],egt.prototype,"setupEvents");var nNn=Object.defineProperty,rNn=Object.getOwnPropertyDescriptor,E7=(t,e,n,r)=>{for(var s=rNn(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&nNn(e,n,s),s},$d,CC,jC,Sve,tgt;class NI{constructor({name:e,socketHandler:n,meetingId:r}){Se(this,Sve),xe(this,"name",""),Se(this,$d,{}),Se(this,CC,""),Se(this,jC,void 0),xe(this,"rateLimitConfig",{maxInvocations:5,period:1}),xe(this,"bulkRateLimitConfig",{maxInvocations:5,period:1}),xe(this,"listeners",{}),this.name=e,Te(this,jC,n),Te(this,CC,r)}set(e,n,r=!0,s=!1){return me(this,null,function*(){L(this,$d)[e]=n,r&&this.remoteSet(e,n),s&&(this.listeners[e]&&this.listeners[e].forEach(i=>i({[e]:L(this,$d)[e]})),this.listeners["*"]&&this.listeners["*"].forEach(i=>i({[e]:L(this,$d)[e]})))})}remoteSet(e,n){L(this,jC).storeInsertKeys(L(this,CC),this.name,[{key:e,payload:n}])}bulkSet(e){return me(this,null,function*(){e.forEach(({key:n,payload:r})=>{L(this,$d)[n]=r}),L(this,jC).storeInsertKeys(L(this,CC),this.name,e)})}update(e,n,r=!0){return me(this,null,function*(){In(this,Sve,tgt).call(this,e,n,r)})}delete(e,n=!0,r=!1){return me(this,null,function*(){if(L(this,$d)[e]&&delete L(this,$d)[e],n)return L(this,jC).storeDeleteKeys(L(this,CC),this.name,[{key:e}]);r&&(this.listeners[e]&&(this.listeners[e].forEach(s=>s({[e]:void 0})),delete this.listeners[e]),this.listeners["*"]&&this.listeners["*"].forEach(s=>s({[e]:void 0})))})}bulkDelete(e){return me(this,null,function*(){return e.forEach(({key:n})=>{L(this,$d)[n]&&delete L(this,$d)[n]}),L(this,jC).storeDeleteKeys(L(this,CC),this.name,e)})}get(e){if(L(this,$d)[e])return L(this,$d)[e]}getAll(){return L(this,$d)}clear(){Te(this,$d,{})}get rateLimits(){return this.rateLimitConfig}updateRateLimits(e,n){this.rateLimitConfig.maxInvocations=e,this.rateLimitConfig.period=n}get bulkRateLimits(){return this.bulkRateLimitConfig}updateBulkRateLimits(e,n){this.bulkRateLimitConfig.maxInvocations=e,this.bulkRateLimitConfig.period=n}subscribe(e,n){if(this.listeners[e]){this.listeners[e].push(n);return}this.listeners[e]=[n]}unsubscribe(e,n){var r;if(n){this.listeners[e]=((r=this.listeners[e])==null?void 0:r.filter(s=>s!==n))||[];return}this.listeners[e]&&delete this.listeners[e]}populate(e){Te(this,$d,e)}}$d=new WeakMap,CC=new WeakMap,jC=new WeakMap,Sve=new WeakSet,tgt=function(t,e,n=!0){let r;const s=L(this,$d)[t],i=Object.prototype.toString.call(e),o=Object.prototype.toString.call(s);if(i!==o){this.set(t,e);return}switch(o){case"[object Array]":r=[...s,...e];break;case"[object Object]":r=en(en({},s),e);break;case"[object Map]":r=new Map([...s,...e]);break;case"[object Set]":r=new Set([...s,...e]);break;default:r=e;break}this.set(t,r,n)};E7([$m(EI,"rateLimitConfig")],NI.prototype,"remoteSet");E7([$m(EI,"bulkRateLimitConfig")],NI.prototype,"bulkSet");E7([$m(EI,"rateLimitConfig")],NI.prototype,"update");E7([$m(EI,"rateLimitConfig")],NI.prototype,"delete");E7([$m(EI,"bulkRateLimitConfig")],NI.prototype,"bulkDelete");var ej,tj,eW,Qle,qY,Kv,Cve,ngt;class sNn{constructor(e,n){Se(this,eW),Se(this,Cve),xe(this,"stores",new Map),Se(this,ej,void 0),Se(this,tj,""),Se(this,qY,void 0),Se(this,Kv,new Map),Te(this,ej,n),Te(this,tj,e.getValue("meetingId")),Te(this,qY,e),In(this,Cve,ngt).call(this)}create(e,n=!1){if(rwn.includes(e)&&!n)throw new _t(`'${e}' is a reserved store name.`,"0601");const r=new NI({name:e,socketHandler:L(this,ej),meetingId:L(this,tj)});return L(this,ej).storeGetKeys(L(this,tj),e,[]),new Promise((s,i)=>{const o=setTimeout(()=>{L(this,Kv).delete(e),i(Error("Failed"))},3e3);L(this,Kv).set(e,{rejectTimeout:o,resolve:s,store:r})})}refresh(e){const n=this.stores.get(e);return n?(n.clear(),L(this,ej).storeGetKeys(L(this,tj),e,[]),new Promise((r,s)=>{const i=setTimeout(()=>{L(this,Kv).delete(e),s(Error("Store refresh timed out"))},3e3);L(this,Kv).set(e,{rejectTimeout:i,resolve:r,store:n})})):Promise.reject(Error(`Store '${e}' does not exist`))}}ej=new WeakMap,tj=new WeakMap,eW=new WeakSet,Qle=function(){return L(this,qY).getValue("peerId")},qY=new WeakMap,Kv=new WeakMap,Cve=new WeakSet,ngt=function(){[Bb.storeInsertKeys,Bb.storeGetKeys,Bb.storeDeleteKeys].forEach(t=>{L(this,ej).on(t,e=>me(this,null,function*(){var n,r;if(e.pluginId!==L(this,tj))return;const s=(n=e.storeItems)==null?void 0:n.map(o=>{var l;return{timestamp:o.timestamp,peerId:o.peerId,payload:JSON.parse((l=o.payload)!=null&&l.length?new TextDecoder().decode(o.payload):"{}"),key:o.storeKey}});if(t===Bb.storeGetKeys){const o=L(this,Kv).get(e.storeName),l=this.stores.get(e.storeName)||(o==null?void 0:o.store);if(L(this,Kv).get(e.storeName)&&(this.stores.set(e.storeName,o.store),o.resolve(l),clearTimeout(o.rejectTimeout),L(this,Kv).delete(e.storeName)),!l)return;s.forEach(c=>{l.set(c.key,c.payload,!1,!1)});return}const i=this.stores.get(e.storeName)||((r=L(this,Kv).get(e.storeName))==null?void 0:r.store);i!==void 0&&(t===Bb.storeInsertKeys&&s.forEach(({key:o,peerId:l,payload:c})=>{l!==L(this,eW,Qle)&&i.set(o,c,!1,!0)}),t===Bb.storeDeleteKeys&&s.forEach(({key:o,peerId:l})=>{l!==L(this,eW,Qle)&&i.delete(o,!1,!0)}))}))})};function nj(t){var e,n,r,s,i,o,l,c,d,u,h,m,f;return t?{media:{audio:{enabled:t.audioEnabled,trackId:(e=t.audioTrack)==null?void 0:e.id,permission:"mediaPermissions"in t?(n=t.mediaPermissions)==null?void 0:n.audio:null},video:{enabled:t.videoEnabled,trackId:(r=t.videoTrack)==null?void 0:r.id,permission:"mediaPermissions"in t?(s=t.mediaPermissions)==null?void 0:s.video:null},screenshare:{enabled:t.screenShareEnabled,permission:"mediaPermissions"in t?(i=t.mediaPermissions)==null?void 0:i.screenshare:null,audio:{enabled:(l=(o=t.screenShareTracks)==null?void 0:o.audio)==null?void 0:l.enabled,trackId:(d=(c=t.screenShareTracks)==null?void 0:c.audio)==null?void 0:d.id},video:{enabled:(h=(u=t.screenShareTracks)==null?void 0:u.video)==null?void 0:h.enabled,trackId:(f=(m=t.screenShareTracks)==null?void 0:m.video)==null?void 0:f.id}}}}:{}}var iNn=Object.defineProperty,aNn=Object.getOwnPropertyDescriptor,TI=(t,e,n,r)=>{for(var s=r>1?void 0:r?aNn(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&iNn(e,n,s),s};const oNn=.8,lNn=1.2;var JL,XL,Hm,aT,e3,ZS,oT,lT,t3,Zle,kFe,rw,Az,JS,cT,n3,sw,Jle,Pz,Xle,ece,SFe,tce,CFe,jFe;let n0=(jFe=class extends Dm{constructor(t,e,n,r){const s=t.getValue("logger");super(s),Se(this,aT),Se(this,ZS),Se(this,lT),Se(this,Zle),Se(this,cT),Se(this,Pz),Se(this,ece),Se(this,tce),xe(this,"id"),xe(this,"userId"),xe(this,"name"),xe(this,"picture"),xe(this,"isHost"),xe(this,"customParticipantId"),xe(this,"flags"),xe(this,"device"),xe(this,"videoTrack"),xe(this,"audioTrack"),xe(this,"screenShareTracks"),xe(this,"videoEnabled"),xe(this,"audioEnabled"),xe(this,"screenShareEnabled"),xe(this,"producers"),xe(this,"manualProducerConfig"),Se(this,JL,void 0),xe(this,"supportsRemoteControl",!1),Se(this,XL,void 0),xe(this,"presetName"),Se(this,Hm,void 0),Se(this,rw,void 0),Se(this,Az,void 0),Se(this,JS,new Map),Se(this,sw,1),Se(this,Jle,sEe(k=>{if(!this.videoTrack)return;const{clientWidth:S,clientHeight:C}=k,{width:j,height:E}=this.videoTrack.getSettings();if(!j||!E)return;const N=E/C,A=j/S,_=Math.max(N,A);_>lNn&&L(this,sw)===1?(Te(this,sw,0),L(this,Hm).getValue("peerSessionStore").emit(Et.MAX_SPATIAL_LAYER_CHANGE,{peerId:this.id,maxSpatialLayer:L(this,sw)})):_<oNn&&L(this,sw)===0&&(Te(this,sw,1),L(this,Hm).getValue("peerSessionStore").emit(Et.MAX_SPATIAL_LAYER_CHANGE,{peerId:this.id,maxSpatialLayer:L(this,sw)}))},2e3)),Te(this,Hm,t);const{id:i,userId:o,displayName:l,device:c,picture:d,isHost:u,flags:h,stageStatus:m,customParticipantId:f,audioMuted:p,audioTrack:g,videoEnabled:v=!1,videoTrack:b,producers:x,metadata:w}=e;this.id=i,this.userId=o,this.name=l,this.device=c,this.picture=d,this.isHost=u,this.flags=h,this.manualProducerConfig=Q0n,Te(this,XL,m??"ON_STAGE"),this.customParticipantId=f,this.audioEnabled=!p,this.audioTrack=g,this.videoEnabled=v,this.videoTrack=b,this.screenShareTracks={audio:void 0,video:void 0},this.producers=x??[],this.presetName=w==null?void 0:w.preset_name,Te(this,JL,!1),Te(this,rw,n),Te(this,Az,r),this.setupEvents(),this.updateVideo=this.updateVideo.bind(this),In(this,Pz,Xle).call(this)}get stageStatus(){return L(this,XL)}get telemetry(){return L(this,Hm).getValue("telemetry")}setVideoEnabled(t,e=!0){this.videoEnabled=t,e&&(this.logger.info("Participant::setVideoEnabled::videoUpdate",en({},nj(this))),this.emit("videoUpdate",{videoEnabled:this.videoEnabled,videoTrack:this.videoTrack}))}setAudioEnabled(t,e=!0){this.audioEnabled=t,e&&(this.logger.info("Participant::setAudioEnabled::audioUpdate",en({},nj(this))),this.emit("audioUpdate",{audioEnabled:this.audioEnabled,audioTrack:this.audioTrack}))}setScreenShareEnabled(t,e=!0){this.screenShareEnabled=t,e&&this.emit("screenShareUpdate",{screenShareEnabled:this.screenShareEnabled,screenShareTracks:this.screenShareTracks})}setupEvents(){this.on("videoUpdate",In(this,Pz,Xle)),L(this,ZS,oT)&&(this.on("audioUpdate",In(this,ece,SFe)),this.on("screenShareUpdate",In(this,tce,CFe)))}pin(){return me(this,null,function*(){if(!L(this,lT,t3))throw new _t("Can`t pin participant without joining room","1205");if(!L(this,rw).permissions.pinParticipant)throw new _t("You do not have permission to pin participants.","1201");return L(this,aT,e3).pinPeer(this.id)})}unpin(){return me(this,null,function*(){if(!L(this,lT,t3))throw new _t("Can`t unpin participant without joining room","1205");if(!L(this,rw).permissions.pinParticipant)throw new _t("You do not have permission to unpin participants.","1201");return L(this,aT,e3).pinPeer(null)})}setIsPinned(t,e=!0){var n;Te(this,JL,t);const r=t?"pinned":"unpinned";(n=L(this,cT,n3))==null||n.updateSource(this.id,{pinned:t}),e&&this.emit(r,this)}disableAudio(){return me(this,null,function*(){const t=this.id;if(this.logger.info("Participant::disable_audio",{participant:{id:t}}),!L(this,lT,t3))throw new _t("Can`t disable participant audio without joining room","1205");if(L(this,rw).permissions.canDisableParticipantAudio)return L(this,aT,e3).disableAudio(t);throw this.logger.error("Participant::unauthorized_disable_audio",{participant:{id:t}}),new _t("Unauthorized: User does not have permission to disable participant audio.","1201")})}kick(){return me(this,null,function*(){const t=this.id;if(this.logger.info("Participant::kick",{participant:{id:t}}),!L(this,Zle,kFe))throw new _t("Can`t kick participant without joining room","1205");if(L(this,rw).permissions.kickParticipant){yield L(this,Hm).getValue("peerSessionStore").emitAsync(Et.KICK_PEER,{peerId:t});return}throw this.logger.error("Participant::unauthorized_kick",{participant:{id:t}}),new _t("Unauthorized: User does not have permission to kick participants.","1201")})}disableVideo(){return me(this,null,function*(){const t=this.id;if(this.logger.info("Participant::disable_video",{participant:{id:t}}),!L(this,lT,t3))throw new _t("Can`t disable participant video without joining room","1205");if(L(this,rw).permissions.canDisableParticipantVideo)return L(this,aT,e3).disableVideo(t);throw this.logger.error("Participant::unauthorized_disable_video",{participant:{id:t}}),new _t("Unauthorized: User does not have permission to disable participant video.","1201")})}getPermissions(){return me(this,null,function*(){return L(this,Az).getUserPermissions(this.userId)})}setStageStatus(t){Te(this,XL,t),this.emit("stageStatusUpdate",this)}get isPinned(){return L(this,JL)}registerVideoElement(t){var e,n,r,s;if(!t)return;let i;(n=(e=L(this,JS).get(t))==null?void 0:e.observer)==null||n.disconnect(),"ResizeObserver"in window&&(i=new ResizeObserver(()=>L(this,Jle).call(this,t)),i.observe(t)),L(this,JS).set(t,{observer:i}),this.updateVideo(t),(s=L(this,cT,n3))==null||s.addSource(this.id,t,this.videoEnabled,this.isPinned,this.name,this.picture,(r=this.raised)!=null?r:!1)}deregisterVideoElement(t){var e,n,r,s;if(!t){(e=L(this,cT,n3))==null||e.removeSource(this.id);return}t.srcObject=void 0,(r=(n=L(this,JS).get(t))==null?void 0:n.observer)==null||r.disconnect(),L(this,JS).delete(t),(s=L(this,cT,n3))==null||s.removeSource(this.id)}updateVideo(t){var e;if(this.videoEnabled){if(this.videoTrack==null)return;const n=(e=t.srcObject)==null?void 0:e.getTracks()[0];if((n==null?void 0:n.id)===this.videoTrack.id)return;const r=new MediaStream;r.addTrack(this.videoTrack),t.srcObject=r}else t.srcObject=void 0;t.style.display=this.videoEnabled?"block":"none"}},JL=new WeakMap,XL=new WeakMap,Hm=new WeakMap,aT=new WeakSet,e3=function(){return L(this,Hm).getValue("roomNodeClient")},ZS=new WeakSet,oT=function(){return L(this,Hm).getValue("audioPlayback")},lT=new WeakSet,t3=function(){return L(this,Hm).getValue("connectionHandler").mediaJoined},Zle=new WeakSet,kFe=function(){return L(this,Hm).getValue("connectionHandler").socketJoined},rw=new WeakMap,Az=new WeakMap,JS=new WeakMap,cT=new WeakSet,n3=function(){return L(this,Hm).getValue("pip")},sw=new WeakMap,Jle=new WeakMap,Pz=new WeakSet,Xle=function(){Array.from(L(this,JS).keys()).forEach(this.updateVideo)},ece=new WeakSet,SFe=function(){var t,e;this.audioEnabled&&this.audioTrack?(t=L(this,ZS,oT))==null||t.addParticipantTrack(this.id,this.audioTrack):(e=L(this,ZS,oT))==null||e.removeParticipantTrack(this.id)},tce=new WeakSet,CFe=function(){var t,e;this.screenShareEnabled&&this.screenShareTracks.audio?(t=L(this,ZS,oT))==null||t.addParticipantTrack(`screenshare-${this.id}`,this.screenShareTracks.audio):(e=L(this,ZS,oT))==null||e.removeParticipantTrack(`screenshare-${this.id}`)},jFe);TI([ut.trace("Participant.disableAudio")],n0.prototype,"disableAudio",1);TI([ut.trace("Participant.kick")],n0.prototype,"kick",1);TI([ut.trace("Participant.disableVideo")],n0.prototype,"disableVideo",1);TI([ut.trace("Participant.getPermissions")],n0.prototype,"getPermissions",1);TI([ut.trace("Participant.setStageStatus")],n0.prototype,"setStageStatus",1);n0=TI([tu("1200")],n0);class r3 extends Wpt{constructor(e,n){const{onAddEvent:r="participantJoined",onDeleteEvent:s="participantLeft",onClearEvent:i="participantsCleared"}=n??{};super({onAddEvent:r,onDeleteEvent:s,onClearEvent:i},e)}add(e,n=!0){return this.has(e.id)&&Object.is(this.get(e.id),e)===!1&&this.delete(e.id),super.add(e,n)}clear(e=!0,n=!1){return super.clear(e,n)}delete(e,n=!0,r=!1){return super.delete(e,n,r)}}var EC;class cNn extends jI{constructor(e){super(e),Se(this,EC,void 0),Te(this,EC,new Map)}__set(e,n){return L(this,EC).set(e,n)}__clear(){return L(this,EC).clear()}get(e){return L(this,EC).get(e)}toArray(){return Array.from(L(this,EC).values())}}EC=new WeakMap;class dNn{constructor(){xe(this,"_orderedArray"),xe(this,"_map"),this._map=new Map,this._orderedArray=[]}add(e,n){if(!this._map.has(e))return this._map.set(e,{peerId:e,priority:n}),this._orderedArray.splice(Math.max(n-1,0),0,e),this.index(e);const r=this.index(e);this.delete(e);const s=this.add(e,n);return r!==s?s:-1}delete(e){if(this._map.has(e)){const n=this.index(e);this._map.delete(e),this._orderedArray.splice(n,1)}}index(e){return this._map.has(e)?this._orderedArray.indexOf(e):-1}[Symbol.iterator](){return this._orderedArray[Symbol.iterator]()}}class uNn{constructor(){xe(this,"_activeSpeakerPeers"),xe(this,"_compulsoryPeers"),this._activeSpeakerPeers=new dNn,this._compulsoryPeers=new Set}add(e,n,r){if(!e)return-1;if(n<0)return this._compulsoryPeers.add(e),0;const s=r.getValue("logger");if(this.compulsoryPeers.includes(e)&&(n>0||n===246267631)){if(s.info("SelectedPeer::removing_compulsory_peer",{selectedPeer:{peerId:e}}),this._removeFromCompulsoryPeer(e),n===246267631)return-1}else if(n===229490415)return this.delete(e,r),-1;return this._activeSpeakerPeers.add(e,n)}delete(e,n){const r=n==null?void 0:n.getValue("logger");r==null||r.info("SelectedPeer::deleting_peer_from_selectedPeer",{selectedPeer:{peerId:e}}),this._removeFromCompulsoryPeer(e),this._activeSpeakerPeers.delete(e)}index(e){return this._activeSpeakerPeers.index(e)}get peers(){return Array.from(new Set(this.compulsoryPeers.concat(this.activeSpeakerPeers)))}get compulsoryPeers(){return Array.from(this._compulsoryPeers.values())}get activeSpeakerPeers(){return Array.from(this._activeSpeakerPeers)}_removeFromCompulsoryPeer(e){this._compulsoryPeers.delete(e)}}const rgt=new uNn;var hNn=Object.defineProperty,mNn=Object.getOwnPropertyDescriptor,Yy=(t,e,n,r)=>{for(var s=r>1?void 0:r?mNn(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&hNn(e,n,s),s};const fNn=["ACTIVE_GRID","PAGINATED","MANUAL"];var ol,Rz,nce,dT,s3,i3,Iz,uT,Dh,EFe;let Hf=(EFe=class extends Dm{constructor(t,e,n){const r=t.getValue("logger");super(r),Se(this,Rz),Se(this,dT),Se(this,i3),xe(this,"waitlisted"),xe(this,"joined"),xe(this,"active"),xe(this,"videoSubscribed"),xe(this,"audioSubscribed"),xe(this,"pinned"),xe(this,"all"),Se(this,ol,void 0),Se(this,uT,void 0),Se(this,Dh,void 0),xe(this,"rateLimitConfig",{maxInvocations:5,period:1}),xe(this,"viewMode"),xe(this,"currentPage"),xe(this,"lastActiveSpeaker"),xe(this,"selectedPeers",rgt),Te(this,ol,t),Te(this,uT,e),Te(this,Dh,n),this.waitlisted=new r3(r),this.joined=new r3(r),this.videoSubscribed=new r3(r),this.audioSubscribed=new r3(r),this.active=this.videoSubscribed,this.pinned=new r3(r),this.all=new cNn(r),this.viewMode="ACTIVE_GRID",this.currentPage=0,this.setupEvents()}get pip(){return L(this,ol).getValue("pip")}get rateLimits(){return this.rateLimitConfig}updateRateLimits(t,e){this.rateLimitConfig.maxInvocations=t,this.rateLimitConfig.period=e}get telemetry(){return L(this,ol).getValue("telemetry")}setupEvents(){L(this,ol).getValue("peerSessionStore").on(Et.E2EE_ACTIVE_CONSUMER,({peerId:e})=>{var n;((n=L(this,ol).getValue("modules").e2ee)==null?void 0:n.enabled)!==!0&&this.emit("media_decode_error",{reason:`Got encrypted media for participantId ${e}, but encryption wasn't enabled in init.defaults`,code:"1702"})});const t=L(this,ol).getValue("audioPlayback");t&&this.audioSubscribed.on("participantLeft",e=>{t.removeParticipantTrack(e.id)})}get count(){return this.joined.size}get maxActiveParticipantsCount(){var t;return(t=L(this,ol))==null?void 0:t.getValue("maxPreferredStreams")}setMaxActiveParticipantsCount(t){if(t<0||t>24)throw new _t("0 <= Max active participants count limit <= 24","1203");L(this,ol).setValue("maxPreferredStreams",t),L(this,i3,Iz)&&L(this,ol).getValue("peerSessionStore").emit(Et.UPDATE_ACTIVE,{viewMode:this.viewMode,page:this.currentPage})}get pageCount(){if(this.viewMode==="PAGINATED"){const t=this.selectedPeers.compulsoryPeers.length,e=this.joined.toArray().filter(n=>n.stageStatus==="ON_STAGE");return Math.ceil((e.length-t)/Math.max(this.maxActiveParticipantsCount-t,1))}return 0}acceptWaitingRoomRequest(t){var e,n;if(!L(this,dT,s3))throw new _t("Can`t accept waiting room request without joining room","1205");const r=(n=(e=this.waitlisted.get(t))==null?void 0:e.userId)!=null?n:t;return L(this,Dh).acceptWaitingRoomRequest([r])}acceptAllWaitingRoomRequest(t){return me(this,null,function*(){const e=t.map(n=>{var r,s;return(s=(r=this.waitlisted.get(n))==null?void 0:r.userId)!=null?s:n});return L(this,Dh).acceptWaitingRoomRequest(e)})}rejectWaitingRoomRequest(t){return me(this,null,function*(){var e,n;if(!L(this,dT,s3))throw new _t("Can`t reject waiting room request without joining room","1205");const r=(n=(e=this.waitlisted.get(t))==null?void 0:e.userId)!=null?n:t;L(this,Dh).rejectWaitingRoomRequest([r])})}setViewMode(t){return me(this,null,function*(){if(this.logger.info("Participants::set_view_mode",{pageNavigation:{viewMode:t,currentPage:this.currentPage,pageCount:this.pageCount,maxActiveParticipantsCount:this.maxActiveParticipantsCount}}),!(e=>fNn.includes(e))(t))throw this.logger.error("Participants::setViewMode::invalid_view_mode",{pageNavigation:{viewMode:t,currentPage:this.currentPage,pageCount:this.pageCount,maxActiveParticipantsCount:this.maxActiveParticipantsCount}}),new _t(`Invalid view mode: ${t}. Try ACTIVE_GRID, PAGINATED or MANUAL.`,"1207");if(this.viewMode===t){this.logger.info("Participants::setViewMode::view_mode_same_as_previous");return}this.viewMode=t,t==="PAGINATED"?(this.currentPage=1,L(this,ol).getValue("peerSessionStore").emit(Et.UPDATE_ACTIVE,{viewMode:t,page:this.currentPage})):t==="ACTIVE_GRID"?(this.currentPage=0,L(this,ol).getValue("peerSessionStore").emit(Et.UPDATE_ACTIVE,{viewMode:t,page:this.currentPage})):t==="MANUAL"&&(this.currentPage=0,L(this,ol).getValue("peerSessionStore").emit(Et.UPDATE_ACTIVE,{viewMode:t,page:this.currentPage})),this.emit("viewModeChanged",{viewMode:t,currentPage:this.currentPage,pageCount:this.pageCount})})}subscribe(t){return me(this,arguments,function*(e,n=["audio","video","screenshareAudio","screenshareVideo"]){if(this.viewMode!=="MANUAL")throw new _t("MANUAL subscription mode was not activated.","1206");e.forEach(r=>{const s=this.joined.get(r);s&&(n.includes("audio")&&(s.manualProducerConfig=Dr(en({},s.manualProducerConfig),{audio:!0}),this.audioSubscribed.has(s.id)||this.audioSubscribed.add(s)),n.includes("video")&&(s.manualProducerConfig=Dr(en({},s.manualProducerConfig),{video:!0}),this.videoSubscribed.has(s.id)||this.videoSubscribed.add(s)),n.includes("screenshareAudio")&&(s.manualProducerConfig=Dr(en({},s.manualProducerConfig),{screenshareAudio:!0}),this.audioSubscribed.has(s.id)||this.audioSubscribed.add(s)),n.includes("screenshareVideo")&&(s.manualProducerConfig=Dr(en({},s.manualProducerConfig),{screenshareVideo:!0}),this.videoSubscribed.has(s.id)||this.videoSubscribed.add(s)))}),L(this,ol).getValue("peerSessionStore").emit(Et.UPDATE_ACTIVE,{viewMode:this.viewMode,page:this.currentPage})})}unsubscribe(t){return me(this,arguments,function*(e,n=["audio","video","screenshareAudio","screenshareVideo"]){if(this.viewMode!=="MANUAL")throw new _t("MANUAL subscription mode was not activated.","1206");e.forEach(r=>{const s=this.joined.get(r);s&&(n.includes("audio")&&(s.manualProducerConfig=Dr(en({},s.manualProducerConfig),{audio:!1}),s.manualProducerConfig.screenshareAudio||this.audioSubscribed.delete(s.id)),n.includes("video")&&(s.manualProducerConfig=Dr(en({},s.manualProducerConfig),{video:!1}),s.manualProducerConfig.screenshareVideo||this.videoSubscribed.delete(s.id)),n.includes("screenshareAudio")&&(s.manualProducerConfig=Dr(en({},s.manualProducerConfig),{screenshareAudio:!1}),s.manualProducerConfig.audio||this.audioSubscribed.delete(s.id)),n.includes("screenshareVideo")&&(s.manualProducerConfig=Dr(en({},s.manualProducerConfig),{screenshareVideo:!1}),s.manualProducerConfig.video||this.videoSubscribed.delete(s.id)))}),L(this,ol).getValue("peerSessionStore").emit(Et.UPDATE_ACTIVE,{viewMode:this.viewMode,page:this.currentPage})})}getPeerIdsForCurrentPage(){this.logger.info("Participants::getPeerIdsForCurrentPage()",{pageNavigation:{viewMode:this.viewMode,currentPage:this.currentPage,pageCount:this.pageCount,maxActiveParticipantsCount:this.maxActiveParticipantsCount}});const{compulsoryPeers:t}=this.selectedPeers,e=t.filter(o=>this.joined.has(o)),n=Array.from(this.pinned.keys()).filter(o=>!e.includes(o)),r=Array.from(this.joined.toArray().filter(o=>o.stageStatus==="ON_STAGE").map(o=>o.id)),s=Math.max((this.currentPage-1)*(this.maxActiveParticipantsCount-e.length-n.length)),i=this.currentPage*(this.maxActiveParticipantsCount-e.length-n.length);return e.concat(n,r.slice(s,i))}setPage(t){return me(this,null,function*(){if(this.logger.info("Participants::set_page",{pageNavigation:{settingPage:t,viewMode:this.viewMode,currentPage:this.currentPage,pageCount:this.pageCount,maxActiveParticipantsCount:this.maxActiveParticipantsCount}}),this.viewMode==="PAGINATED"){if(!Number.isInteger(t))throw this.logger.error("Participants::invalid_page_number"),new _t(`Invalid page: ${t}. Page must be an integer and greater than 0 and less than or equal to .pageCount`,"1202");this.currentPage=t,L(this,ol).getValue("peerSessionStore").emit(Et.UPDATE_ACTIVE,{viewMode:this.viewMode,page:t}),this.emit("pageChanged",{viewMode:this.viewMode,currentPage:this.currentPage,pageCount:this.pageCount})}})}disableAllAudio(t){return me(this,null,function*(){if(this.logger.info("Participants::disable_all_audio",{actions:{disableAllAudio:{allowUnmute:t}}}),!L(this,i3,Iz))throw new _t("Can`t disable all audio without joining room","1205");if(L(this,uT).permissions.canAllowParticipantAudio)return L(this,Rz,nce).muteAll(t);throw this.logger.error("Participants::unauthorized_disable_all_audio",{actions:{disableAllAudio:{allowUnmute:t}}}),new _t("Unauthorized: User does not have permission to disable peer audio.","1201")})}disableAllVideo(){return me(this,null,function*(){if(this.logger.info("Participants::disable_all_video"),!L(this,i3,Iz))throw new _t("Can`t disable all video without joining room","1205");if(L(this,uT).permissions.canAllowParticipantVideo)return L(this,Rz,nce).muteAllVideo();throw this.logger.error("Participants::unauthorized_disable_all_video"),new _t("Unauthorized: User does not have permission to disable peer video.","1201")})}kickAll(){return me(this,null,function*(){if(this.logger.info("Participants::kick_all"),L(this,ol).getValue("viewType")!=="LIVESTREAM"&&!L(this,dT,s3))throw new _t("Can`t kick all without joining room","1205");if(!L(this,uT).permissions.kickParticipant)throw this.logger.error("Participants::unauthorized_kick_all"),new _t("Unauthorized: User does not have permission to kick peers.","1201");L(this,Dh).kickAll(!0)})}broadcastMessage(t,e,n){return me(this,null,function*(){if(this.logger.info("Participants::broadcastMessage"),!L(this,dT,s3))throw new _t("Can`t broadcast message without joining room","1205");if(!(t!=null&&t.trim()))throw new _t("`type` must be a non-empty string.","1209");if(n)if("meetingIds"in n)yield L(this,Dh).broadcastToMeetings(t,n.meetingIds,e);else{let r=[];"participantIds"in n?r=n.participantIds:r=this.joined.toArray().filter(s=>{var i;return(i=n.presetNames)==null?void 0:i.includes(s.presetName)}).map(s=>s.id),yield L(this,Dh).broadcastToPeers(t,r,e)}else yield L(this,Dh).broadcastMessage(t,e)})}getAllJoinedPeers(t,e,n){return me(this,null,function*(){return(yield L(this,Dh).getRoomPeers(t,e,n)).peers.map(I0.formatSocketPeerMessage)})}updatePermissions(t,e){return me(this,null,function*(){const n=this.joined.toArray().filter(s=>t.includes(s.id)).map(s=>s.userId),r=[...new Set(n)];if(!r.length)throw new _t("Cannot update permissions, no valid userIDs found","1204");L(this,Dh).updatePermissions(r,e)})}getParticipantsInMeetingPreJoin(){return me(this,null,function*(){return L(this,Dh).getRoomPeersNonPaginated()})}},ol=new WeakMap,Rz=new WeakSet,nce=function(){return L(this,ol).getValue("roomNodeClient")},dT=new WeakSet,s3=function(){var t;return((t=L(this,ol).getValue("connectionHandler"))==null?void 0:t.socketJoined)===!0},i3=new WeakSet,Iz=function(){var t;return((t=L(this,ol).getValue("connectionHandler"))==null?void 0:t.mediaJoined)===!0},uT=new WeakMap,Dh=new WeakMap,EFe);Yy([ut.trace("Participants.setViewMode")],Hf.prototype,"setViewMode",1);Yy([ut.trace("Participants.setPage")],Hf.prototype,"setPage",1);Yy([ut.trace("Participants.disableAllAudio")],Hf.prototype,"disableAllAudio",1);Yy([ut.trace("Participants.disableAllVideo")],Hf.prototype,"disableAllVideo",1);Yy([ut.trace("Participants.kickAll")],Hf.prototype,"kickAll",1);Yy([ut.trace("Participants.broadcastMessage"),$m(EI,"rateLimitConfig")],Hf.prototype,"broadcastMessage",1);Yy([ut.trace("Participants.getAllJoinedPeers"),$m({maxInvocations:10,period:60})],Hf.prototype,"getAllJoinedPeers",1);Yy([ut.trace("Participant.updatePermissions"),$m({maxInvocations:1e3,period:60})],Hf.prototype,"updatePermissions",1);Yy([ut.trace("Participants.getParticipantsInMeetingPreJoin")],Hf.prototype,"getParticipantsInMeetingPreJoin",1);Hf=Yy([tu("1200")],Hf);var pNn=Object.defineProperty,gNn=Object.getOwnPropertyDescriptor,FE=(t,e,n,r)=>{for(var s=gNn(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&pNn(e,n,s),s},fp,dv,a3,NFe;const sgt=(NFe=class{constructor(t,e,n){xe(this,"participants"),xe(this,"self"),xe(this,"selectedPeers",rgt),xe(this,"maxSpatialLayerUpdates",new Map),xe(this,"consumerPeerMap"),xe(this,"events"),xe(this,"roomSocketHandler"),xe(this,"context"),xe(this,"videoPeerConsumerMap",new Map),Se(this,fp,{mode:"ACTIVE_GRID",page:0}),Se(this,dv,!1),Se(this,a3,!1),xe(this,"updateConsumerSpatialLayers",sEe(()=>{const r={},s=new Map(this.maxSpatialLayerUpdates);this.maxSpatialLayerUpdates.clear(),Array.from(s.entries()).forEach(([i,o])=>{r[o]===void 0&&(r[o]={layer:o,consumerIds:[]}),r[o].consumerIds.push(i)}),Object.keys(r).forEach(i=>{const o=r[i];this.logger.log(`Switching max spatial layer to ${o.layer}`,{consumerIds:o.consumerIds}),this.roomNodeClient.switchConsumersToLayer(o.consumerIds,o.layer)})},2e3)),xe(this,"updateConsumers",(r,s)=>me(this,null,function*(){this.logger.info(`updateConsumers: Starting consumer updates - AddProducers: ${r.length}, RemoveProducers: ${s.length}, ConsumersSyncing: ${L(this,dv)}`);try{r.length!==0&&(this.logger.info(`updateConsumers: Creating consumers for ${r.length} producers: [${r.map(i=>i.producerId).join(", ")}]`),yield this.roomNodeClient.createConsumers(r),this.logger.info("updateConsumers: Successfully created consumers."))}catch(i){this.logger.error("updateConsumers: Error creating consumers",{error:i})}try{s.length!==0&&(this.logger.info(`updateConsumers: Closing consumers for ${s.length} producers: [${s.map(i=>i.producerId).join(", ")}]`),yield this.roomNodeClient.closeConsumers(s),this.logger.info("updateConsumers: Successfully closed consumers."))}catch(i){this.logger.error("updateConsumers: Error closing consumers",{error:i})}this.logger.info("updateConsumers: Completed consumer updates.")})),this.context=t,this.roomSocketHandler=n,this.participants=new Hf(t,e,this.roomSocketHandler),this.self=e,this.consumerPeerMap=new Map,this.events=tg,e.config.viewType!=="CHAT"&&this.setupEventsGlobal(),this.setupEvents()}get roomNodeClient(){return this.context.getValue("roomNodeClient")}get mediaJoined(){var t;return((t=this.roomNodeClient)==null?void 0:t.mediaJoined)===!0}get pip(){return this.context.getValue("pip")}get telemetry(){return this.context.getValue("telemetry")}get logger(){return this.context.getValue("logger")}setupEvents(){this.roomSocketHandler.on(Rn.getWaitingRoomRequests,this.waitingRoomRequestHandler.bind(this)),this.context.getValue("peerSessionStore").on(Et.SOCKET_PEERS,t=>{const e=this.participants.joined.size>0;this.participants.videoSubscribed.clear(),this.participants.audioSubscribed.clear(),this.participants.pinned.clear(),this.participants.joined.clear(),this.participants.currentPage=0,this.participants.viewMode="ACTIVE_GRID",e&&this.participants.emit("viewModeChanged",{viewMode:"ACTIVE_GRID",currentPage:this.participants.currentPage,pageCount:this.participants.pageCount}),t==null||t.forEach(n=>{n.waitlisted||this.onParticipantSocketJoined(this.createParticipantObjFromSocketPeer(n))})}),this.roomSocketHandler.on(this.events.peerJoinedBroadcast,({participant:t})=>{this.logger.info("PEER_INFO:::MEDIA_JOIN",{participant:{id:t.peerId,maskedName:[...(t==null?void 0:t.displayName)||""].map((e,n)=>n%2?"*":e).join("")}}),this.onParticipantMediaJoined(t.peerId,t.producerStates)}),this.roomSocketHandler.on(this.events.selfJoinComplete,({participants:t,selectedPeers:e,roomState:n})=>{t.forEach(({peerId:i,producerStates:o})=>this.onParticipantMediaJoined(i,o));const{audioPeers:r,compulsoryPeers:s}=e??{};n.pinnedPeerIds.length!==0&&this.onParticipantPinned(n.pinnedPeerIds[0]),this.computeActivateParticipants(r??[],s),this.logger.info("selfJoinComplete: Emitting UPDATE_ACTIVE with createAllConsumers=true"),this.context.getValue("peerSessionStore").emit(Et.UPDATE_ACTIVE,{createAllConsumers:!0})}),this.context.getValue("peerSessionStore").on(Et.MAX_SPATIAL_LAYER_CHANGE,({peerId:t,maxSpatialLayer:e})=>{const n=this.videoPeerConsumerMap.get(t);n&&(this.maxSpatialLayerUpdates.set(n,e),this.updateConsumerSpatialLayers())}),this.context.getValue("peerSessionStore").on(Et.NEW_PRODUCER,({peerId:t,producer:e})=>{const n=this.participants.joined.get(t);if(!n){this.logger.warn("ParticipantController::NEW_PRODUCER::participant not found",{producer:{id:e==null?void 0:e.producerId,kind:e==null?void 0:e.kind,status:"not_initialized",appData:{screenShare:e==null?void 0:e.screenShare}},participant:{id:t}});return}n.producers.push(e),this.logger.info("ParticipantController::NEW_PRODUCER::producer_added_to_participant",{producer:{id:e==null?void 0:e.producerId,peerId:t,kind:e==null?void 0:e.kind,status:"not_initialized",appData:{screenShare:e==null?void 0:e.screenShare}}}),(e==null?void 0:e.kind)==="audio"&&this.participants.audioSubscribed.get(t)||(e==null?void 0:e.kind)==="video"&&this.participants.videoSubscribed.get(t)||e!=null&&e.screenShare?(this.logger.info(`NEW_PRODUCER: scheduling syncConsumer (AUTO mode) - Producer: ${e.producerId}, Peer: ${t}, Kind: ${e.kind}, ScreenShare: ${e.screenShare}, ConsumersSyncing: ${L(this,dv)}, VideoSub: ${e.kind==="video"?this.participants.videoSubscribed.has(t):"N/A"}, AudioSub: ${e.kind==="audio"?this.participants.audioSubscribed.has(t):"N/A"}`),this.scheduleSyncConsumers({source:"NEW_PRODUCER_AUTO"})):this.logger.info("ParticipantController::NEW_PRODUCER::not_consuming_producer_auto",{producer:{id:e==null?void 0:e.producerId,peerId:t,kind:e==null?void 0:e.kind,status:"UNKNOWN",appData:{screenShare:e==null?void 0:e.screenShare}}})}),this.context.getValue("peerSessionStore").on(Et.PRODUCER_CLOSED,({peerId:t,producerId:e})=>{const n=this.participants.joined.get(t);if(!n){this.logger.warn("ParticipantController::NEW_PRODUCER::participant not found",{participant:{id:t}});return}n.producers=n.producers.filter(r=>r.producerId!==e)}),this.context.getValue("peerSessionStore").on(Et.PRODUCER_TOGGLE,({peerId:t,producerId:e,paused:n,kind:r})=>{const s=this.participants.joined.get(t);if(s){r==="audio"&&s.setAudioEnabled(!n);const i=s.producers.find(o=>o.producerId===e);i&&(i.pause=n),r==="video"&&this.context.getValue("peerSessionStore").emit(Et.UPDATE_ACTIVE,{viewMode:this.participants.viewMode,page:this.participants.currentPage})}}),this.roomSocketHandler.on(this.events.globalPeerPinBroadcast,t=>{let e;if(t&&(e=t.participantId),!this.mediaJoined)return;const n=e;this.onParticipantPinned(n);const r=this.participants.joined.get(n);r&&(this.logger.info(`globalPeerPinBroadcast: Scheduling audio/video consumer sync for pinned participant ${n} - ProducerCount: ${r.producers.length}, ConsumersSyncing: ${L(this,dv)}, ProducerIds: [${r.producers.map(s=>s.producerId).join(", ")}]`),this.scheduleSyncConsumers({source:"GLOBAL_PEER_PIN"}))}),this.roomSocketHandler.on(this.events.selectedPeer,({audioPeers:t,compulsoryPeers:e})=>{this.mediaJoined&&this.onSelectedPeers(e.concat(t))}),this.roomSocketHandler.on(this.events.selectedPeerDiff,({entries:t})=>{if(!this.mediaJoined)return;const e=t.map(n=>({peerId:n.peerId,priority:n.priority}));this.updateActiveParticipantsWithPriorities(e,!0)})}waitingRoomRequestHandler(t){const e=t.requests.filter(r=>!this.participants.waitlisted.toArray().find(s=>s.userId===r.userId)),n=this.participants.waitlisted.toArray().filter(r=>!t.requests.find(s=>s.userId===r.userId));e.forEach(r=>this.participants.waitlisted.add(new n0(this.context,{id:r.peerId,displayName:r.displayName,audioMuted:!0,videoEnabled:!1,audioTrack:void 0,videoTrack:void 0,stageStatus:"OFF_STAGE",userId:r.userId,flags:{},isHost:!1,customParticipantId:r.customParticipantId,picture:r.picture,metadata:{preset_name:r.presetName}},this.self,this.roomSocketHandler))),n.forEach(r=>this.participants.waitlisted.delete(r.id))}get maxPreferredStreams(){return this.participants.maxActiveParticipantsCount}selectPagePeers(t){const{compulsoryPeers:e}=this.selectedPeers,n=e.filter(l=>this.participants.joined.has(l)),r=Array.from(this.participants.pinned.keys()).filter(l=>!n.includes(l)),s=Array.from(this.participants.joined.toArray().filter(l=>l.stageStatus==="ON_STAGE").map(l=>l.id)),i=Math.max((t-1)*(this.maxPreferredStreams-n.length-r.length)),o=t*(this.maxPreferredStreams-n.length-r.length);return n.concat(r,s.slice(i,o))}selectActivePeers(t){const e=new Map,n=Array.from(this.participants.joined.toArray().filter(u=>u.stageStatus==="ON_STAGE").map(u=>(e.set(u.id,!0),u.id))),r=this.selectedPeers.peers,s=this.participants.pinned.toArray().reduce((u,h)=>(h.stageStatus!=="ON_STAGE"?this.participants.pinned.delete(h.id):u.push(h.id),u),[]),i=this.self.stageStatus==="ON_STAGE"?1:0,o=t-i,l=new Set(r.concat(s).filter(u=>u!==this.self.id&&e.has(u)));let c=Array.from(l);const d=o-l.size;if(d>=0){const u=n.filter(h=>!l.has(h)&&h!==this.self.id).slice(0,d);c=Array.from(l).concat(u)}else c=c.slice(0,o);return c}updateMediaSubscribedMaps(t,e){const{page:n}=e??{};t&&L(this,fp).mode!==t&&(L(this,fp).mode=t),n&&L(this,fp).page!==n&&(L(this,fp).page=n);const{mode:r,page:s}=L(this,fp);switch(r){case"PAGINATED":{if(!s)return;const i=this.selectPagePeers(s),o=this.selectActivePeers(this.participants.maxActiveParticipantsCount+4);this.updateParticipantsMap(this.participants.videoSubscribed,i),this.updateParticipantsMap(this.participants.audioSubscribed,o),this.logger.debug("ParticipantController::updateActive::updating_current_page_peers",{peerIds:i});break}case"ACTIVE_GRID":{const i=this.selectActivePeers(this.participants.maxActiveParticipantsCount),o=this.selectActivePeers(this.participants.maxActiveParticipantsCount+4);this.updateParticipantsMapMinReplacement(this.participants.videoSubscribed,i),this.updateParticipantsMap(this.participants.audioSubscribed,o);break}case"MANUAL":break;default:throw new Error(`View mode ${t} not supported`)}}scheduleSyncConsumers(t){return me(this,arguments,function*({source:e}){var n,r,s;const i=((n=L(this,fp))==null?void 0:n.mode)==="PAGINATED"&&!L(this,dv)?200:0;this.logger.info(`scheduleSyncConsumers():: Source: ${e}, ViewMode: ${(r=L(this,fp))==null?void 0:r.mode}, ConsumersSyncing: ${L(this,dv)}, Delay: ${i}, Page: ${(s=L(this,fp))==null?void 0:s.page}`),setTimeout(()=>this.syncConsumers(),i)})}syncConsumers(){return me(this,null,function*(){var t,e,n,r,s;if(((n=(e=(t=this.context.getValue("connectionHandler"))==null?void 0:t.mediaState)==null?void 0:e.recv)==null?void 0:n.state)!=="connected"){this.logger.info("syncConsumers: Connection not ready, exiting.");return}if(L(this,dv)){Te(this,a3,!0),this.logger.info("syncConsumers: Sync in progress, marking resyncRequired=true and exiting.");return}this.logger.info("syncConsumers: Starting sync operation."),Te(this,dv,!0),Te(this,a3,!1);let i=[];this.participants.videoSubscribed.forEach(h=>{var m,f;const p=this.participants.joined.get(h.id),g=(f=(m=h.producers)==null?void 0:m.filter(v=>v.kind==="video"))!=null?f:[];p&&g!=null&&g.length&&g.forEach(v=>{var b,x,w,k;const S=((x=(b=p.manualProducerConfig)==null?void 0:b.video)!=null?x:!0)&&v.kind==="video"&&!v.screenShare,C=((k=(w=p.manualProducerConfig)==null?void 0:w.screenshareVideo)!=null?k:!0)&&v.kind==="video"&&v.screenShare;(S||C)&&(v.pause||i.push(v))})}),this.participants.audioSubscribed.forEach(h=>{var m,f;const p=this.participants.joined.get(h.id),g=(f=(m=h.producers)==null?void 0:m.filter(v=>v.kind==="audio"))!=null?f:[];p&&g!=null&&g.length&&g.forEach(v=>{var b,x,w,k;const S=((x=(b=p.manualProducerConfig)==null?void 0:b.audio)!=null?x:!0)&&v.kind==="audio"&&!v.screenShare,C=((k=(w=p.manualProducerConfig)==null?void 0:w.screenshareAudio)!=null?k:!0)&&v.kind==="audio"&&v.screenShare;(S||C)&&i.push(v)})}),i=Y0n(i,h=>h.producerId);const o=new Map;i.forEach(h=>{o.set(h.producerId,h)});const l=(r=this.roomNodeClient)==null?void 0:r.getConsumers(),c=i.filter(h=>!(l!=null&&l.has(h.producerId)));i.filter(h=>!h.consumer&&(l==null?void 0:l.has(h.producerId))).forEach(h=>{const m=l.get(h.producerId);m&&(this.logger.info(`syncConsumers: remapping existing consumer ${m.id} to producer ${h.producerId}`),this.context.getValue("peerSessionStore").emit(Et.NEW_CONSUMER,{id:m.id,appData:m.appData,peerId:m.peerId}))});const d=[];let u=Array.from((s=l==null?void 0:l.values())!=null?s:[]).map(h=>h.peerId);u=K0n(u),u==null||u.forEach(h=>{var m;const f=this.participants.joined.get(h);if(!f){this.logger.warn(`Peer with ${h} doesn't exist in joined list but producers of it are being consumed.`);return}(m=f.producers)!=null&&m.length&&f.producers.forEach(p=>{const g=p.consumer&&l.has(p.consumer.id);!o.has(p.producerId)&&(l.has(p.producerId)||g)&&d.push(p)})}),this.logger.info(`syncConsumers: Computed changes - AddProducers: ${c.length} [${c.map(h=>h.producerId).join(", ")}], RemoveProducers: ${d.length} [${d.map(h=>h.producerId).join(", ")}]`.substring(0,5e3));try{c.length>0||d.length>0?(this.logger.info(`syncConsumers: Calling updateConsumers with changes. Adding ${c.length} and removing ${d.length}.`),yield this.updateConsumers(c,d),this.logger.info("syncConsumers: updateConsumers completed successfully.")):this.logger.info("syncConsumers: No changes needed, skipping updateConsumers.")}catch(h){this.logger.error("syncConsumers: updateConsumers failed with error.",{error:h})}finally{this.logger.info("syncConsumers: Setting consumersSyncing=false and completing sync."),Te(this,dv,!1)}L(this,a3)&&(this.logger.info("syncConsumers: Resync required, calling syncConsumers again."),this.syncConsumers())})}computeActivateParticipants(t,e){const n=t.map((s,i)=>({peerId:s,priority:i+1})),r=e==null?void 0:e.map((s,i)=>({peerId:s,priority:-(i+1)}));n.push(...r??[]),n.length>0&&this.updateActiveParticipantsWithPriorities(n)}createParticipantObjFromSocketPeer(t){const e=sgt.formatSocketPeerMessage(t);return new n0(this.context,Dr(en({},e),{isHost:!1,videoEnabled:!1,audioMuted:!0,videoTrack:void 0,audioTrack:void 0}),this.self,this.roomSocketHandler)}updatePipSource(t,e){var n,r;e?(n=this.pip)==null||n.enableSource(t):(r=this.pip)==null||r.disableSource(t)}onParticipantMediaJoined(t,e){if(!this.mediaJoined||t===this.self.id)return;const n=this.participants.joined.get(t);if(!n){this.logger.warn(`Received media.peerJoinedBroadcast for non-existent peer ${t}`);return}this.logger.info("PEER_INFO:::SOCKET_ON_MEDIA_JOIN",{participant:{id:n.id,maskedName:[...(n==null?void 0:n.name)||""].map((r,s)=>s%2?"*":r).join("")}}),this.logger.info(`onParticipantMediaJoined: peer ${t} has joined media room. Processing.`),e.forEach(r=>{r.kind===Cx.AUDIO&&!r.screenShare?n.setAudioEnabled(!r.pause):r.kind===Cx.VIDEO&&!r.screenShare&&(n.setVideoEnabled(!r.pause),this.updatePipSource(n.id,!r.pause)),n.producers.push(Dr(en({},r),{producingTransportId:r.producingTransportId,kind:r.kind===Cx.AUDIO?"audio":"video",producingPeerId:t,mimeType:r.mimeType}))}),this.logger.info(`onParticipantMediaJoined: Emitting UPDATE_ACTIVE for peer ${t}`),this.context.getValue("peerSessionStore").emit(Et.UPDATE_ACTIVE,{viewMode:this.participants.viewMode,page:this.participants.currentPage})}updateParticipantsMapMinReplacement(t,e){const n=Array.from(t.keys()),r=new Map(t),s=new Set(e),i=[];n.forEach((o,l)=>{(!s.has(o)||!this.participants.joined.get(o))&&i.push(l)}),e.forEach(o=>{if(t.get(o))return;if(n.length<e.length){n.push(o);return}const l=i.shift();n[l]=o}),i.forEach(o=>{n.splice(o,1)}),Array.from(t.keys()).forEach(o=>{t.delete(o,!s.has(o))}),n.forEach(o=>{if(!this.participants.joined.get(o)){this.logger.warn("updateActiveParticipants::participant_not_in_joined_list",{participant:{id:o}});return}t.add(this.participants.joined.get(o),!r.get(o))}),t.emit("participantsUpdate")}updateParticipantsMap(t,e){Array.from(t.keys()).forEach(n=>{e.includes(n)||t.delete(n,!0)}),e.forEach(n=>{t.get(n)||t.add(this.participants.joined.get(n),!0)}),t.emit("participantsUpdate")}updatePinnedParticipants(){this.participants.pinned.forEach(t=>{t.setIsPinned(!1),this.participants.pinned.delete(t.id)})}setupEventsGlobal(){this.roomSocketHandler.on(Rn.joinRoom,({peer:t})=>{t.waitlisted||(this.logger.info("Processing socket join",{peers:t.peerId}),this.onParticipantSocketJoined(this.createParticipantObjFromSocketPeer(t)),this.logger.info("Processed socket join",{peers:t.peerId}))}),this.roomSocketHandler.on(Rn.leaveRoom,t=>{const{peerId:e}=t.peer;this.selectedPeers.delete(e,this.context),this.onParticipantLeave(e)}),this.context.getValue("peerSessionStore").on(Et.SOCKET_SERVICE_ROOM_JOINED,()=>{this.self.permissions.acceptWaitingRequests&&this.roomSocketHandler.getWaitingRoomRequests()}),this.self.permissions.on("permissionsUpdate",t=>{const{acceptWaitingRequests:e}=t;e!==void 0&&(e?this.roomSocketHandler.getWaitingRoomRequests():this.participants.waitlisted.clear())}),this.context.getValue("peerSessionStore").on(Et.SOCKET_SERVICE_DISCONNECTED,()=>{this.logger.info("Socket disconnected — keeping participants visible for seamless reconnection")}),this.context.getValue("peerSessionStore").on(Et.CONSUMER_PAUSED,({id:t})=>{this.processConsumerPaused(t)}),this.context.getValue("peerSessionStore").on(Et.CONSUMER_RESUMED,({id:t})=>{this.processConsumerResumed(t)}),this.context.getValue("peerSessionStore").on(Et.NEW_CONSUMER,({id:t})=>{this.processNewConsumer(t)}),this.context.getValue("peerSessionStore").on(Et.CONSUMER_CLOSED,({id:t})=>{this.processConsumerClosed(t)}),this.context.getValue("peerSessionStore").on(Et.ROOM_MESSAGE,t=>me(this,[t],function*({payload:e,type:n,timestamp:r}){this.participants.emit("broadcastedMessage",{type:n,payload:e,timestamp:r})})),this.context.getValue("peerSessionStore").on(Et.MESSAGE,t=>me(this,[t],function*({payload:e,type:n,timestamp:r}){n!=="spotlight"&&this.participants.emit("broadcastedMessage",{type:n,payload:e,timestamp:r})})),this.context.getValue("peerSessionStore").on(Et.LOW_CONSUMER_SCORE,({peerId:t,score:e,kind:n})=>{const r=this.participants.joined.get(t);r&&(r.emit("poorConnection",{score:e,kind:n}),this.participants.emit("poorConnection",{participantId:t,score:e,kind:n}))}),this.context.getValue("peerSessionStore").on(Et.CONSUMER_SCORE_UPDATE,({score:t,kind:e,appData:n,peerId:r,scoreStats:s})=>{var i;const o=e==="video"&&((i=n==null?void 0:n.screenShare)!=null?i:!1),l=this.participants.joined.get(r);l&&(l.emit("mediaScoreUpdate",{kind:e,isScreenshare:o,score:t,participantId:r,scoreStats:s}),this.participants.emit("mediaScoreUpdate",{kind:e,isScreenshare:o,score:t,participantId:r,scoreStats:s}))}),this.context.getValue("peerSessionStore").onAsync(Et.KICK_PEER,t=>me(this,[t],function*({peerId:e}){const n=this.participants.joined.get(e);this.roomNodeClient.kick(e),yield this.roomSocketHandler.kick(e),n?n.emit("kicked"):this.participants.joined.emit("kicked",{id:e})})),this.context.getValue("peerSessionStore").on(Et.UPDATE_ACTIVE,(...t)=>me(this,[...t],function*({viewMode:e,page:n,createAllConsumers:r}={viewMode:"ACTIVE_GRID",page:0,createAllConsumers:!1}){this.logger.info(`UPDATE_ACTIVE event received - viewMode: ${L(this,fp).mode}, page: ${n}, CreateAllConsumers: ${r}`),r&&(this.logger.info(`UPDATE_ACTIVE viewMode: ${e}, Page: ${n}, Removing existing subscriptions.`),this.participants.videoSubscribed.clear(),this.participants.audioSubscribed.clear()),this.updateMediaSubscribedMaps(e,{page:n}),this.scheduleSyncConsumers({source:"UPDATE_ACTIVE"})}))}onParticipantPinned(t){return me(this,null,function*(){if(!t){this.self.isPinned&&this.self.setIsPinned(!1),this.participants.pinned.size!==0&&this.updatePinnedParticipants();return}if(t===this.self.id){this.participants.pinned.size!==0&&this.updatePinnedParticipants(),this.self.setIsPinned(!0);return}const e=this.participants.joined.get(t);this.self.isPinned&&this.self.setIsPinned(!1),this.updatePinnedParticipants(),e.setIsPinned(!0),this.participants.pinned.add(e)})}onParticipantSocketJoined(t){return me(this,null,function*(){var e,n,r;this.logger.info(`onParticipantSocketJoined: peer ${t.id} has joined socket edge. Processing.`),this.self.id!==t.id&&!((e=t.flags)!=null&&e.recorder)&&!((n=t.flags)!=null&&n.hidden_participant)&&!((r=t.flags)!=null&&r.hiddenParticipant)&&(this.participants.videoSubscribed.delete(t.id),this.participants.audioSubscribed.delete(t.id),this.participants.joined.add(t),this.participants.waitlisted.delete(t.id),t.stageStatus==="REQUESTED_TO_JOIN_STAGE"&&this.context.getValue("peerSessionStore").emit(Et.UPDATE_STAGE_REQUESTS,{request:{displayName:t.name,userId:t.userId,peerId:t.id},add:!0})),this.context.getValue("peerSessionStore").emit(Et.PEER_JOINED_INTERNAL,t)})}onParticipantLeave(t){return me(this,null,function*(){const e=this.participants.joined.get(t);this.participants.joined.delete(t,!0,!0),this.participants.pinned.delete(t,!0,!0),this.participants.waitlisted.delete(t,!0,!0),this.roomNodeClient&&this.roomNodeClient.closeConsumers(e==null?void 0:e.producers),e&&e.stageStatus==="REQUESTED_TO_JOIN_STAGE"&&this.context.getValue("peerSessionStore").emit(Et.UPDATE_STAGE_REQUESTS,{request:{displayName:e.name,userId:e.userId,peerId:e.id},add:!1});const{currentPage:n}=this.participants,r=this.maxPreferredStreams*(n-1),s=this.participants.videoSubscribed.get(t);this.participants.viewMode==="MANUAL"?this.context.getValue("peerSessionStore").emit(Et.UPDATE_ACTIVE,{viewMode:this.participants.viewMode,page:n}):r===0?this.participants.setViewMode("ACTIVE_GRID"):this.participants.joined.size<=r?n===2?this.participants.setViewMode("ACTIVE_GRID"):this.participants.setPage(n-1):s&&this.context.getValue("peerSessionStore").emit(Et.UPDATE_ACTIVE,{viewMode:this.participants.viewMode,page:n})})}processMedia(t){var e;const n=this.roomNodeClient.getConsumers(),{peerId:r,kind:s,appData:i,track:o,producerId:l,rtpReceiver:c,paused:d,localId:u}=(e=n.get(t))!=null?e:{};if(!r)return this.logger.warn("processMedia::Peer ID is undefined",{consumer:{id:t,kind:s,peerId:r,appData:{supportsRemoteControl:!!(i!=null&&i.supportsRemoteControl),screenShare:!!(i!=null&&i.screenShare)},remotelyPaused:d,producerId:l}}),{};const h=i;return s==="video"&&h.screenShare!==!0&&this.videoPeerConsumerMap.set(r,t),this.logger.info("ParticipantController::processMedia",{consumer:{id:t,peerId:r,kind:s,appData:h,remotelyPaused:d,producerId:l}}),this.consumerPeerMap.set(t,{type:s,peerId:r,appData:h,remotelyPaused:d,producerId:l}),{peerId:r,kind:s,appData:h,remotelyPaused:d,track:o,producerId:l,rtpReceiver:c,localId:u}}processConsumerClosed(t){const{peerId:e,type:n,appData:r,remotelyPaused:s,producerId:i}=this.consumerPeerMap.get(t)||{},o=this.participants.joined.get(e);if(this.logger.info("ParticipantController::processConsumerClosed",{consumer:{id:t,peerId:e,appData:r,kind:n,remotelyPaused:s,producerId:i}}),this.consumerPeerMap.delete(t),n==="video"&&r.screenShare!==!0&&this.videoPeerConsumerMap.delete(e),!o)return;const l=o.producers.find(d=>d.producerId===i);l&&(l.consumer={id:t,peerId:e,kind:void 0,appData:r,paused:s,producerId:i,rtpReceiver:void 0,localId:void 0});const c=[];r&&r.screenShare?(o.setScreenShareEnabled(!1),this.context.getValue("callstats").consumerSharedMediaState(t,{screen:!1}),o.screenShareTracks.video&&c.push(o.screenShareTracks.video.id),o.screenShareTracks.audio&&c.push(o.screenShareTracks.audio.id),o.screenShareTracks={audio:void 0,video:void 0}):n==="audio"?(o.setAudioEnabled(!1),o.audioTrack&&c.push(o.audioTrack.id),this.context.getValue("callstats").consumerSharedMediaState(t,{audio:!1}),o.audioTrack=void 0):n==="video"&&(o.setVideoEnabled(!1),this.updatePipSource(o.id,!1),o.videoTrack&&c.push(o.videoTrack.id),this.context.getValue("callstats").consumerSharedMediaState(t,{video:!1}),o.videoTrack=void 0),r.e2ee&&c.forEach(d=>{this.context.getValue("peerSessionStore").emit(Et.E2EE_INACTIVE_CONSUMER,{peerId:e,trackId:d})})}processConsumerResumed(t){var e;const n=this.processMedia(t),{peerId:r,kind:s,appData:i,track:o,remotelyPaused:l,producerId:c,rtpReceiver:d,localId:u}=n;if(!r)return;this.logger.info("ParticipantController::processConsumerResumed",{consumer:{id:t,peerId:r,kind:s,appData:i,remotelyPaused:l,producerId:c}});const h=this.participants.joined.get(r);if(!h)return;const m=h.producers.find(f=>f.producerId===c);if(m&&(m.consumer={id:t,peerId:r,kind:s,appData:i,paused:l,producerId:c,rtpReceiver:d,localId:u}),i.e2ee&&this.context.getValue("peerSessionStore").emit(Et.E2EE_ACTIVE_CONSUMER,{peerId:r,rtpReceiver:d,track:o}),i.screenShare){s==="video"?h.screenShareTracks.video=o:s==="audio"&&(h.screenShareTracks.audio=o),h.setScreenShareEnabled(!0),(e=this.context)==null||e.getValue("callstats").consumerSharedMediaState(t,{screen:!0});return}s==="video"?(h.videoTrack=o,h.setVideoEnabled(!0),this.updatePipSource(h.id,!0),this.context.getValue("callstats").consumerSharedMediaState(t,{video:!0})):s==="audio"&&(h.audioTrack=o,h.setAudioEnabled(h.audioEnabled),this.context.getValue("callstats").consumerSharedMediaState(t,{audio:h.audioEnabled}))}processConsumerPaused(t){this.logger.info(`ParticipantController::processConsumerPaused called for consumerId: ${t}`);const{peerId:e,kind:n,track:r,appData:s,remotelyPaused:i,producerId:o,rtpReceiver:l,localId:c}=this.processMedia(t);if(!e)return;this.logger.info("ParticipantController::processConsumerPaused",{consumer:{id:t,peerId:e,kind:n,appData:s,remotelyPaused:i,producerId:o}});const d=this.participants.joined.get(e);if(!d)return;const u=d.producers.find(h=>h.producerId===o);u&&(u.consumer={id:t,peerId:e,kind:n,appData:s,paused:i,producerId:o,rtpReceiver:l,localId:c}),r&&s.e2ee&&this.context.getValue("peerSessionStore").emit(Et.E2EE_INACTIVE_CONSUMER,{peerId:e,trackId:r.id}),n==="video"?(d.videoTrack=r,d.setVideoEnabled(!1),this.updatePipSource(d.id,!1),this.context.getValue("callstats").consumerSharedMediaState(t,{video:!1})):n==="audio"&&(d.audioTrack=r,d.setAudioEnabled(d.audioEnabled),this.context.getValue("callstats").consumerSharedMediaState(t,{audio:d.audioEnabled}))}processNewConsumer(t){const{peerId:e,kind:n,remotelyPaused:r,track:s,appData:i,producerId:o,rtpReceiver:l,localId:c}=this.processMedia(t);if(!e)return;this.logger.info("ParticipantController::processNewConsumer",{consumer:{id:t,peerId:e,kind:n,remotelyPaused:r,appData:i,producerId:o}});const d=this.participants.joined.get(e);if(!d)return;const u=d.producers.find(h=>h.producerId===o);if(u&&(u.consumer={id:t,peerId:e,kind:n,appData:i,paused:r,producerId:o,rtpReceiver:l,localId:c}),i.screenShare){n==="video"?d.screenShareTracks.video=s:n==="audio"&&(d.screenShareTracks.audio=s),(!r||this.self.permissions.isRecorder)&&d.setScreenShareEnabled(!0),i.supportsRemoteControl&&(d.supportsRemoteControl=!0),this.participants.broadcastMessage("screenshareConsumerCreated",{producerId:o,peerId:e,screenShare:!0,consumerId:t,consumerPeerId:this.self.id}),this.logger.info("ParticipantController::newScreenshareConsumer::screenshareConsumerCreated",{consumer:{id:t,peerId:e,kind:n,remotelyPaused:r,appData:i,producerId:o}});return}n==="video"?(d.videoTrack=s,r||(d.setVideoEnabled(!0),this.updatePipSource(d.id,!0)),this.context.getValue("callstats").consumerSharedMediaState(t,{video:!r})):n==="audio"&&(d.audioTrack=s,r||d.setAudioEnabled(!0),this.context.getValue("callstats").consumerSharedMediaState(t,{audio:!r})),!r&&i.e2ee&&this.context.getValue("peerSessionStore").emit(Et.E2EE_ACTIVE_CONSUMER,{peerId:e,rtpReceiver:l,track:s})}static formatSocketPeerMessage(t){var e,n,r,s,i,o;if(!t)return;const l=cEe(t.stageType);return{id:t.peerId,userId:t.userId,name:t.displayName,displayName:t.displayName,stageType:l,customParticipantId:t.customParticipantId,presetId:t.presetId,picture:t.displayPictureUrl,waitlisted:t.waitlisted,stageStatus:l,metadata:{preset_name:(e=t.flags)==null?void 0:e.presetName},recorderType:(n=t.flags)==null?void 0:n.recorderType,flags:{hiddenParticipant:(r=t.flags)==null?void 0:r.hiddenParticipant,hidden_participant:(s=t.flags)==null?void 0:s.hiddenParticipant,recorder:((i=t.flags)==null?void 0:i.recorderType)!==void 0&&((o=t.flags)==null?void 0:o.recorderType)!=="NONE"}}}onSelectedPeers(t,e){return me(this,null,function*(){this.participants.viewMode==="ACTIVE_GRID"&&this.computeActivateParticipants(t,e)})}updateActiveParticipantsWithPriorities(t,e=!1){if(this.participants.viewMode==="MANUAL")return;if(!this.mediaJoined){this.logger.warn("Skipped::ParticipantController::updateActiveParticipantsWithPriorities",{roomJoined:this.mediaJoined});return}t.forEach(r=>{this.selectedPeers.add(r.peerId,r.priority,this.context)});const n=this.selectedPeers.activeSpeakerPeers.at(0);n!==void 0&&n!==this.participants.lastActiveSpeaker&&(this.participants.lastActiveSpeaker=n,this.participants.emit("activeSpeaker",{peerId:n,volume:1})),e&&this.context.getValue("peerSessionStore").emit(Et.UPDATE_ACTIVE,{viewMode:this.participants.viewMode,page:this.participants.currentPage})}},fp=new WeakMap,dv=new WeakMap,a3=new WeakMap,NFe);let I0=sgt;FE([ut.trace("ParticipantController.setupEvents")],I0.prototype,"setupEvents");FE([ut.trace("ParticipantController.setupEvents")],I0.prototype,"setupEventsGlobal");FE([ut.trace("ParticipantController.processMedia")],I0.prototype,"processMedia");FE([ut.trace("ParticipantController.processConsumerClosed")],I0.prototype,"processConsumerClosed");FE([ut.trace("ParticipantController.processConsumerResumed")],I0.prototype,"processConsumerResumed");FE([ut.trace("ParticipantController.processConsumerPaused")],I0.prototype,"processConsumerPaused");FE([ut.trace("ParticipantController.processNewConsumer")],I0.prototype,"processNewConsumer");const ll=gy(iEe().permissions);var ss,_4,zD,jve,Qu,Bh;const Eve=class extends Dm{constructor(t,e,n,r=!1){const s=t.getValue("logger");if(super(s),Se(this,Qu),Se(this,ss,void 0),Se(this,_4,void 0),Se(this,zD,void 0),Se(this,jve,i=>{var o,l,c;const d=i,{chat:u,connectedMeetings:h,plugins:m,polls:f,media:p}=d,g=U2e(d,["chat","connectedMeetings","plugins","polls","media"]);if(u&&(u.private&&jw(L(this,ss).chat.private,u.private),u.public&&jw(L(this,ss).chat.public,u.public),this.emit("chatUpdate")),h&&jw(L(this,ss).connectedMeetings,h),p){const v=x=>{switch(x){case A1.NONE:return Hr.Allowed;case A1.ALLOWED:return Hr.Allowed;case A1.NOT_ALLOWED:return Hr.NotAllowed;case A1.CAN_REQUEST:return Hr.CanRequest;default:return}},b={audio:void 0,video:void 0,screenshare:void 0};(o=p.audio)!=null&&o.canProduce&&(b.audio={canProduce:v(p.audio.canProduce)}),(l=p.video)!=null&&l.canProduce&&(b.video={canProduce:v(p.video.canProduce)}),(c=p.screenshare)!=null&&c.canProduce&&(b.screenshare={canProduce:v(p.screenshare.canProduce)}),jw(L(this,ss).media,b)}m&&(jw(L(this,ss).plugins,m),this.emit("pluginsUpdate")),f&&(jw(L(this,ss).polls,f),this.emit("pollsUpdate")),Object.keys(g).length!==0&&jw(L(this,ss),g),this.emit("permissionsUpdate",i)}),!e)throw this.logger.error("PermissionPreset::load_preset_permissions_failed"),new _t("Could not load preset permissions.","0904");Te(this,zD,t),Te(this,_4,n),Te(this,ss,e),r&&this.setupEvents()}setupEvents(){L(this,zD).getValue("peerSessionStore").on(Et.UPDATE_PERMISSIONS,L(this,jve))}static init(t,e,n){let r;return n?r=new Eve(t,n,e,!0):r=new Eve(t,ll,e),r}get mediaRoomType(){return"CF"}get stageEnabled(){var t;return((t=L(this,ss))==null?void 0:t.stageEnabled)||L(this,_4)===Sx.Webinar||L(this,_4)===Sx.Livestream}get acceptStageRequests(){var t,e;return this.stageEnabled?((t=L(this,ss))==null?void 0:t.acceptStageRequests)||((e=L(this,ss))==null?void 0:e.canAcceptProductionRequests):!1}get stageAccess(){var t,e,n;return((t=L(this,ss))==null?void 0:t.stageAccess)===Hr.NotAllowed?Hr.NotAllowed:((e=L(this,ss))==null?void 0:e.stageAccess)===Hr.CanRequest?Hr.CanRequest:((n=L(this,ss))==null?void 0:n.stageAccess)===Hr.Allowed||L(this,ss).media.audio.canProduce===Hr.Allowed||L(this,ss).media.video.canProduce===Hr.Allowed||L(this,ss).media.screenshare.canProduce===Hr.Allowed?Hr.Allowed:L(this,ss).media.audio.canProduce===Hr.CanRequest||L(this,ss).media.video.canProduce===Hr.CanRequest||L(this,ss).media.screenshare.canProduce===Hr.CanRequest?Hr.CanRequest:Hr.NotAllowed}get acceptWaitingRequests(){var t,e;return(e=(t=L(this,ss))==null?void 0:t.acceptWaitingRequests)!=null?e:ll.acceptWaitingRequests}get requestProduceVideo(){var t,e,n;return((n=(e=(t=L(this,ss))==null?void 0:t.media)==null?void 0:e.video)==null?void 0:n.canProduce)===Hr.CanRequest}get requestProduceAudio(){var t,e,n;return((n=(e=(t=L(this,ss))==null?void 0:t.media)==null?void 0:e.audio)==null?void 0:n.canProduce)===Hr.CanRequest}get requestProduceScreenshare(){var t,e,n;return((n=(e=(t=L(this,ss))==null?void 0:t.media)==null?void 0:e.screenshare)==null?void 0:n.canProduce)===Hr.CanRequest}get canAllowParticipantAudio(){var t,e;return(e=(t=L(this,ss))==null?void 0:t.disableParticipantAudio)!=null?e:ll.disableParticipantAudio}get canAllowParticipantScreensharing(){var t,e;return(e=(t=L(this,ss))==null?void 0:t.canAcceptProductionRequests)!=null?e:ll.canAcceptProductionRequests}get canAllowParticipantVideo(){var t,e;return(e=(t=L(this,ss))==null?void 0:t.disableParticipantVideo)!=null?e:ll.disableParticipantVideo}get canDisableParticipantAudio(){return this.canAllowParticipantAudio}get canDisableParticipantVideo(){return this.canAllowParticipantVideo}get kickParticipant(){var t,e;return(e=(t=L(this,ss))==null?void 0:t.kickParticipant)!=null?e:ll.kickParticipant}get pinParticipant(){var t,e;return(e=(t=L(this,ss))==null?void 0:t.pinParticipant)!=null?e:ll.pinParticipant}get canRecord(){var t,e;return(e=(t=L(this,ss))==null?void 0:t.canRecord)!=null?e:ll.canRecord}get waitingRoomBehaviour(){var t,e;return(e=(t=L(this,ss))==null?void 0:t.waitingRoomType)!=null?e:ll.waitingRoomType}get plugins(){var t,e;return(e=(t=L(this,ss))==null?void 0:t.plugins)!=null?e:ll.plugins}get polls(){var t,e;return(e=(t=L(this,ss))==null?void 0:t.polls)!=null?e:ll.polls}get canProduceVideo(){var t;const e=(t=L(this,ss).media.video.canProduce)!=null?t:ll.media.video.canProduce;return this.stageEnabled&&(L(this,Qu,Bh)==="ACCEPTED_TO_JOIN_STAGE"||L(this,Qu,Bh)==="ON_STAGE")&&e===Hr.CanRequest?Hr.Allowed:this.stageEnabled&&(L(this,Qu,Bh)==="OFF_STAGE"||L(this,Qu,Bh)==="REQUESTED_TO_JOIN_STAGE")&&e===Hr.Allowed?Hr.NotAllowed:e}get canProduceScreenshare(){var t;const e=(t=L(this,ss).media.screenshare.canProduce)!=null?t:ll.media.screenshare.canProduce;return this.stageEnabled&&(L(this,Qu,Bh)==="ACCEPTED_TO_JOIN_STAGE"||L(this,Qu,Bh)==="ON_STAGE")&&e===Hr.CanRequest?Hr.Allowed:this.stageEnabled&&(L(this,Qu,Bh)==="OFF_STAGE"||L(this,Qu,Bh)==="REQUESTED_TO_JOIN_STAGE")&&e===Hr.Allowed?Hr.NotAllowed:e}get canProduceAudio(){var t;const e=(t=L(this,ss).media.audio.canProduce)!=null?t:ll.media.audio.canProduce;return this.stageEnabled&&(L(this,Qu,Bh)==="ACCEPTED_TO_JOIN_STAGE"||L(this,Qu,Bh)==="ON_STAGE")&&e===Hr.CanRequest?Hr.Allowed:this.stageEnabled&&(L(this,Qu,Bh)==="OFF_STAGE"||L(this,Qu,Bh)==="REQUESTED_TO_JOIN_STAGE")&&e===Hr.Allowed?Hr.NotAllowed:e}get chatPublic(){var t,e,n;return(n=(e=(t=L(this,ss))==null?void 0:t.chat)==null?void 0:e.public)!=null?n:ll.chat.public}get chatPrivate(){var t,e,n;return(n=(e=(t=L(this,ss))==null?void 0:t.chat)==null?void 0:e.private)!=null?n:ll.chat.private}get connectedMeetings(){var t,e;return(e=(t=L(this,ss))==null?void 0:t.connectedMeetings)!=null?e:ll==null?void 0:ll.connectedMeetings}get hiddenParticipant(){var t,e;return(e=(t=L(this,ss))==null?void 0:t.hiddenParticipant)!=null?e:ll.hiddenParticipant}get showParticipantList(){var t;return(t=L(this,ss).showParticipantList)!=null?t:ll.showParticipantList}get canChangeParticipantPermissions(){var t,e;return(e=(t=L(this,ss))==null?void 0:t.canChangeParticipantPermissions)!=null?e:ll.canChangeParticipantPermissions}get canEditDisplayName(){var t;return(t=L(this,ss).canEditDisplayName)!=null?t:!1}get isRecorder(){return L(this,ss).isRecorder}get canSpotlight(){return L(this,ss).canSpotlight}get canLivestream(){return L(this,ss).canLivestream}get transcriptionEnabled(){return L(this,ss).transcriptionEnabled}};let vNn=Eve;ss=new WeakMap,_4=new WeakMap,zD=new WeakMap,jve=new WeakMap,Qu=new WeakSet,Bh=function(){return L(this,zD).getValue("stageStatus")};var Qm;class igt extends Dm{constructor(e,n){super(n),xe(this,"localMediaHandler"),Se(this,Qm,void 0),Te(this,Qm,e)}updatePermission(){return me(this,null,function*(){var e,n;const r=(d,u)=>{this.mediaPermissions[d]=u;const h={message:this.mediaPermissions[d],kind:d};u==="DENIED"?L(this,Qm).getValue("peerSessionStore").emit(Et.MEDIA_PERMISSION_ERROR,h):L(this,Qm).getValue("peerSessionStore").emit(Et.MEDIA_PERMISSION_UPDATE,h)};if(so.getName()==="firefox")return;const s="microphone",i="camera",o=yield(e=navigator==null?void 0:navigator.permissions)==null?void 0:e.query({name:s}),l=yield(n=navigator==null?void 0:navigator.permissions)==null?void 0:n.query({name:i}),c=(d,u)=>{switch(u){case"granted":r(d,"ACCEPTED");break;case"denied":r(d,"DENIED");break;case"prompt":r(d,"NOT_REQUESTED");break}this.localMediaHandler.repopulateAvailableDevices()};o&&(o.onchange=()=>c("audio",o.state)),l&&(l.onchange=()=>c("video",l.state))})}populateMediaPermissionsInCallstats(e){return me(this,arguments,function*({message:n,kind:r}){var s,i,o,l;switch(r){case"audio":{(s=L(this,Qm))==null||s.getValue("callstats").mediaPermission("AUDIO",n),(i=L(this,Qm))==null||i.getValue("callstats").mediaPermission("SPEAKER",n);break}case"video":{(o=L(this,Qm))==null||o.getValue("callstats").mediaPermission("VIDEO",n);break}case"screenshare":{(l=L(this,Qm))==null||l.getValue("callstats").mediaPermission("SCREENSHARE",n);break}}})}get peerId(){var e;return(e=L(this,Qm))==null?void 0:e.getValue("peerId")}init(){return me(this,arguments,function*(e={},n=!1,r=null){var s,i,o,l,c,d,u;if(so.init(),r&&Te(this,Qm,r),!this.localMediaHandler)try{let h=!0;if((s=r==null?void 0:r.getValue("defaults"))!=null&&s.mediaHandler)h=!1,this.localMediaHandler=r.getValue("defaults").mediaHandler.localMediaHandler;else if(navigator.RNLocalMediaHandlerImpl){const{RNLocalMediaHandlerImpl:m}=navigator;this.localMediaHandler=yield m.init(e)}else this.localMediaHandler=new Th(r,e.constraints,(i=r==null?void 0:r.getValue("defaults"))==null?void 0:i.isNonPreferredDevice,(o=r==null?void 0:r.getValue("defaults"))==null?void 0:o.autoSwitchAudioDevice);if(r==null||r.getValue("peerSessionStore").on(Et.MEDIA_PERMISSION_UPDATE,m=>me(this,null,function*(){if(this.populateMediaPermissionsInCallstats({message:m.message,kind:m.kind}),m.message==="NOT_REQUESTED")switch(m==null?void 0:m.kind){case"audio":this.rawAudioTrack&&(this.logger.info("Disabling audio due to media permission update"),this.disableAudio());break;case"video":this.rawVideoTrack&&(this.logger.info("Disabling video due to media permission update"),this.disableVideo());break;default:break}this.emit("mediaPermissionUpdate",m)})),r==null||r.getValue("peerSessionStore").on(Et.MEDIA_PERMISSION_ERROR,m=>me(this,null,function*(){const{kind:f,message:p,constraints:g}=m;this.populateMediaPermissionsInCallstats({message:p,kind:f}),f==="audio"?(this.logger.info(`Disabling audio due to media permission error  skipping: ${this.localMediaHandler.audioUpdateInProgress}`),this.localMediaHandler.audioUpdateInProgress===!1&&this.disableAudio()):f==="video"&&(this.logger.info(`Disabling video due to media permission error skipping: ${this.localMediaHandler.videoUpdateInProgress}`),this.localMediaHandler.videoUpdateInProgress===!1&&this.disableVideo()),this.logger.error("SelfController::mediaPermissionError",{error:{message:p},constraints:g,mediaPermissionsErrors:{kind:f,message:p}}),this.emit("mediaPermissionError",m),this.emit("mediaPermissionUpdate",{message:p,kind:f})})),h){this.logger.info(`Setting up SelfMedia streams using media handler. audio:${(l=e==null?void 0:e.audio)!=null?l:!0} video:${(c=e==null?void 0:e.video)!=null?c:!0}`);const m=this.localMediaHandler.setupStreams({video:(d=e==null?void 0:e.video)!=null?d:!0,audio:(u=e==null?void 0:e.audio)!=null?u:!0});n||(yield m)}}catch(h){this.logger.error("Self::init::Failed To Setup Streams",{error:{name:h.name,message:h.message}})}})}set context(e){Te(this,Qm,e),this.localMediaHandler.context=e}get audioTrack(){return this.localMediaHandler.audioTrack}get rawAudioTrack(){return this.localMediaHandler.rawAudioTrack}get mediaPermissions(){return this.localMediaHandler.permissions}addAudioMiddleware(e){return me(this,null,function*(){return this.localMediaHandler.addAudioMiddleware(e)})}removeAudioMiddleware(e){return me(this,null,function*(){return this.localMediaHandler.removeAudioMiddleware(e)})}removeAllAudioMiddlewares(){return me(this,null,function*(){return this.localMediaHandler.removeAllAudioMiddlewares()})}get videoTrack(){return this.localMediaHandler.videoTrack}get rawVideoTrack(){return this.localMediaHandler.rawVideoTrack}addVideoMiddleware(e){return me(this,null,function*(){return this.localMediaHandler.addVideoMiddleware(e)})}setVideoMiddlewareGlobalConfig(){return me(this,arguments,function*(e={disablePerFrameCanvasRendering:!1}){return this.localMediaHandler.setVideoMiddlewareGlobalConfig(e)})}removeVideoMiddleware(e){return me(this,null,function*(){return this.localMediaHandler.removeVideoMiddleware(e)})}removeAllVideoMiddlewares(){return me(this,null,function*(){return this.localMediaHandler.removeAllVideoMiddlewares()})}get screenShareTracks(){return this.localMediaHandler.screenShareTracks}get audioEnabled(){return this.localMediaHandler.audioEnabled}get videoEnabled(){return this.localMediaHandler.videoEnabled}get screenShareEnabled(){return this.localMediaHandler.screenShareEnabled}enableAudio(){return me(this,null,function*(){yield this.localMediaHandler.enableAudio(),this.emit("audioUpdate",{audioEnabled:this.audioEnabled,audioTrack:this.audioTrack})})}enableVideo(){return me(this,null,function*(){yield this.localMediaHandler.enableVideo(),this.emit("videoUpdate",{videoEnabled:this.videoEnabled,videoTrack:this.videoTrack})})}disableAudio(){return me(this,null,function*(){this.localMediaHandler.disableAudio(),this.emit("audioUpdate",{audioEnabled:this.audioEnabled,audioTrack:this.audioTrack})})}enableScreenShare(){return me(this,null,function*(){yield this.localMediaHandler.enableScreenShare(),this.emit("screenShareUpdate",{screenShareEnabled:this.screenShareEnabled,screenShareTracks:this.screenShareTracks})})}disableScreenShare(){return me(this,null,function*(){yield this.localMediaHandler.disableScreenShare(),this.emit("screenShareUpdate",{screenShareEnabled:this.screenShareEnabled,screenShareTracks:this.screenShareTracks})})}disableVideo(){return me(this,null,function*(){yield this.localMediaHandler.disableVideo(),this.emit("videoUpdate",{videoEnabled:this.videoEnabled,videoTrack:this.videoTrack})})}getCurrentDevices(){return this.localMediaHandler.getCurrentDevices()}getAudioDevices(){return me(this,null,function*(){return yield this.localMediaHandler.getAudioDevices()})}getVideoDevices(){return me(this,null,function*(){return yield this.localMediaHandler.getVideoDevices()})}getSpeakerDevices(){return me(this,null,function*(){return yield this.localMediaHandler.getSpeakerDevices()})}getDeviceById(e,n){let r;return n==="audio"?r="audioinput":n==="video"?r="videoinput":n==="speaker"&&(r="audiooutput"),this.localMediaHandler.getDeviceById(e,r)}setDevice(e){return me(this,null,function*(){switch(e.kind){case"audioinput":try{yield this.localMediaHandler.setAudioDevice(e,{saveDevicePreference:!0})}catch{}finally{this.emit("audioUpdate",{audioEnabled:this.audioEnabled,audioTrack:this.audioTrack})}break;case"audiooutput":yield this.localMediaHandler.setSpeakerDevice(e,{saveDevicePreference:!0});break;case"videoinput":try{yield this.localMediaHandler.setVideoDevice(e,{saveDevicePreference:!0})}catch{}finally{this.emit("videoUpdate",{videoEnabled:this.videoEnabled,videoTrack:this.videoTrack})}break}this.emit("deviceUpdate",{device:e})})}}Qm=new WeakMap;var yNn=Object.defineProperty,bNn=Object.getOwnPropertyDescriptor,Fu=(t,e,n,r)=>{for(var s=r>1?void 0:r?bNn(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&yNn(e,n,s),s},o3,Vu,l3,qc,iw,XS,Kc,Rd,c3,Mz,Fl,sc,d3,u3,Lz,rce,TFe;let Bc=(TFe=class extends igt{constructor(t,e,n,r,s){const i=t.getValue("logger");super(t,i),Se(this,iw),Se(this,Kc),Se(this,c3),Se(this,Fl),Se(this,Lz),xe(this,"name"),xe(this,"picture"),xe(this,"customParticipantId"),xe(this,"waitlistStatus"),Se(this,o3,void 0),Se(this,Vu,void 0),Se(this,l3,void 0),xe(this,"role"),xe(this,"userId"),xe(this,"organizationId"),xe(this,"supportsRemoteControl",!1),xe(this,"device"),Se(this,qc,void 0),xe(this,"hidden",!1),xe(this,"presetName"),xe(this,"roomState","init"),Se(this,d3,new Set),Se(this,u3,new Set),Te(this,qc,t),this.userId=e.id,this.name=e.name,this.picture=e.picture,this.customParticipantId=e.customParticipantId,this.waitlistStatus="none",Te(this,Vu,n),Te(this,o3,r),this.hidden=!1,Te(this,l3,!1),this.organizationId=e.organizationId,this.supportsRemoteControl=so.isElectron(),this.device=so.getDeviceInfo(),this.presetName=s,this.updatePermission(),this.updateVideo=this.updateVideo.bind(this),In(this,Lz,rce).call(this)}get telemetry(){return L(this,qc).getValue("telemetry")}get stageStatus(){return L(this,qc).getValue("stageStatus")}get producers(){var t,e;return Array.from((e=(t=L(this,Kc,Rd).getProducers())==null?void 0:t.values())!=null?e:[])}get id(){return this.peerId}get peerId(){return L(this,qc).getValue("peerId")}static __init__(t,e,n,r,s,i=!1){return me(this,null,function*(){var o,l,c,d,u,h;let m=(l=(o=t.getValue("defaults"))==null?void 0:o.audio)!=null?l:!0,f=(d=(c=t.getValue("defaults"))==null?void 0:c.video)!=null?d:!0;n.canProduceAudio!=="ALLOWED"&&(m=!1),n.canProduceVideo!=="ALLOWED"&&(f=!1);const p=new Bc(t,e,n,r,s),g=NEn(r.mediaConstraints);jw(g,(u=t.getValue("defaults"))==null?void 0:u.mediaConfiguration);const v=(h=t.getValue("defaults"))==null?void 0:h.mediaHandler;return v&&(v.context=t),yield p.init({audio:m,video:f,constraints:g},i,t),p.setupEvents(),p})}cleanupEvents(){this.removeAllListeners("videoUpdate"),this.localMediaHandler.removeAllListeners("AUDIO_TRACK_CHANGE"),this.localMediaHandler.removeAllListeners("VIDEO_TRACK_CHANGE"),this.localMediaHandler.removeAllListeners("DEVICE_CHANGE"),this.localMediaHandler.removeAllListeners("DEVICE_LIST_UPDATED"),this.localMediaHandler.removeAllListeners("SCREENSHARE_TRACK_CHANGE"),this.localMediaHandler.removeAllListeners("SCREENSHARE_ENDED"),this.localMediaHandler.removeAllListeners("AUDIO_TRACK_SILENT"),this.localMediaHandler.removeAllListeners("FORCE_MUTE_AUDIO"),this.localMediaHandler.removeAllListeners("FORCE_MUTE_VIDEO"),L(this,Vu).removeAllListeners("permissionsUpdate")}setupEvents(){this.on("videoUpdate",In(this,Lz,rce));const t=L(this,c3,Mz);t&&t.onError(e=>{this.emit("autoplayError",e)}),this.localMediaHandler.on("AUDIO_TRACK_CHANGE",()=>me(this,null,function*(){if(this.logger.info("Self::setupEvents::AUDIO_TRACK_CHANGE",en({},nj(this))),L(this,Fl,sc)&&this.audioEnabled)try{yield L(this,Kc,Rd).shareMic(this.audioTrack)}catch(e){this.logger.error("Self::setupEvents::Error while sharing mic",{error:e}),this.localMediaHandler.disableAudio()}this.emit("audioUpdate",{audioEnabled:this.audioEnabled,audioTrack:this.audioTrack})})),this.localMediaHandler.on("VIDEO_TRACK_CHANGE",()=>me(this,null,function*(){if(this.logger.info("Self::setupEvents::VIDEO_TRACK_CHANGE",en({},nj(this))),L(this,Fl,sc)&&this.rawVideoTrack===void 0)this.logger.info("Self::VIDEO_TRACK_CHANGE::Forcing_disable_video"),this.disableVideo();else if(this.videoEnabled&&L(this,Fl,sc))try{yield L(this,Kc,Rd).shareWebcam(this.videoTrack)}catch(e){this.logger.error("Self::setupEvents::failed shareWebcam",{error:e}),this.videoEnabled&&(yield this.localMediaHandler.disableVideo())}this.emit("videoUpdate",{videoEnabled:this.videoEnabled,videoTrack:this.videoTrack})})),this.localMediaHandler.on("DEVICE_CHANGE",e=>me(this,[e],function*({device:n}){var r;this.emit("deviceUpdate",{device:n}),n.kind==="audiooutput"&&typeof HTMLAudioElement.prototype.setSinkId=="function"&&((r=L(this,c3,Mz))==null||r.setSpeakerDevice(n.deviceId))})),this.localMediaHandler.on("DEVICE_LIST_UPDATED",e=>{this.emit("deviceListUpdate",e)}),this.localMediaHandler.on("SCREENSHARE_TRACK_CHANGE",()=>me(this,null,function*(){if(!L(this,Fl,sc)){this.logger.error("Self.SCREENSHARE_TRACK_CHANGE.LocalMediaInitialized_WithoutRoomNode");return}if(this.screenShareEnabled)try{yield L(this,Kc,Rd).shareScreen(this.screenShareTracks)}catch(e){this.logger.error("Self::setupEvents::Error while sharing screen",{error:e}),this.screenShareEnabled&&(yield this.localMediaHandler.disableScreenShare())}this.logger.info("Self::setupEvents::SCREENSHARE_TRACK_CHANGE",en({},nj(this))),this.emit("screenShareUpdate",{screenShareEnabled:this.screenShareEnabled,screenShareTracks:this.screenShareTracks})})),this.localMediaHandler.on("SCREENSHARE_ENDED",()=>me(this,null,function*(){this.logger.log("Disabling screenshare due to SCREENSHARE_ENDED"),yield this.disableScreenShare(),this.logger.info("Self::setupEvents::SCREENSHARE_ENDED",en({},nj(this)))})),this.localMediaHandler.on("AUDIO_TRACK_SILENT",()=>{var e;(e=L(this,qc))==null||e.getValue("callstats").mediaTrackMuted("AUDIO")}),this.localMediaHandler.on("FORCE_MUTE_AUDIO",()=>{this.disableAudio()}),this.localMediaHandler.on("FORCE_MUTE_VIDEO",()=>me(this,null,function*(){var e;L(this,Fl,sc)&&(yield L(this,Kc,Rd).pauseWebcam()),this.emit("videoUpdate",{videoEnabled:this.videoEnabled,videoTrack:this.videoTrack}),(e=L(this,qc))==null||e.getValue("callstats").videoOff()})),L(this,Vu).on("permissionsUpdate",e=>{var n,r,s;(n=e==null?void 0:e.media)!=null&&n.audio&&L(this,Vu).canProduceAudio!==Hr.Allowed&&(this.disableAudio(),this.logger.info(`Disabled audio due to dynamic preset change: canProduceAudio: ${this.permissions.canProduceAudio}`)),(r=e==null?void 0:e.media)!=null&&r.video&&L(this,Vu).canProduceVideo!==Hr.Allowed&&(this.disableVideo(),this.logger.info(`Disabled video due to dynamic preset change: canProduceVideo: ${this.permissions.canProduceVideo}`)),(s=e==null?void 0:e.media)!=null&&s.screenshare&&L(this,Vu).canProduceScreenshare!==Hr.Allowed&&(this.disableScreenShare(),this.logger.info(`Disabled screenshare due to dynamic preset change: canProduceScreenshare: ${this.permissions.canProduceScreenshare}`))})}get permissions(){return L(this,Vu)}get config(){return L(this,o3)}get roomJoined(){var t;return L(this,o3).viewType===Sx.Livestream&&this.stageStatus!=="ON_STAGE"?((t=L(this,qc).getValue("connectionHandler"))==null?void 0:t.socketJoined)===!0:L(this,Fl,sc)}setName(t){if(!t)throw new _t("Name cannot be empty.","1103");this.name=t}setupTracks(){return me(this,arguments,function*(t={}){t.forceReset,yield this.disableAudio(),yield this.disableVideo(),this.localMediaHandler.removeAudioTrack(),this.localMediaHandler.removeVideoTrack(),t.audio&&(yield this.enableAudio()),t.video&&(yield this.enableVideo())})}destructMediaHandler(){return me(this,null,function*(){return this.localMediaHandler.destruct()})}removeDocumentEventListeners(){return me(this,null,function*(){return this.localMediaHandler.removeDocumentEventListeners()})}enableAudio(t){return me(this,null,function*(){var e;if(this.permissions.canProduceAudio!==Hr.NotAllowed&&!(L(this,Vu).canProduceAudio===Hr.CanRequest&&(this.stageStatus==="OFF_STAGE"||this.stageStatus==="REQUESTED_TO_JOIN_STAGE"))&&!this.audioEnabled){if((e=L(this,qc))==null||e.getValue("callstats").audioOn(),yield this.localMediaHandler.enableAudio(t),L(this,Fl,sc)&&this.stageStatus==="ON_STAGE"){if(this.audioTrack)try{yield L(this,Kc,Rd).shareMic(this.audioTrack)}catch(n){this.logger.error("Self::enableAudio::Error while sharing mic",{error:n}),this.localMediaHandler.disableAudio()}if(!this.audioEnabled)return}this.emit("audioUpdate",{audioEnabled:this.audioEnabled,audioTrack:this.audioTrack})}})}enableVideo(t){return me(this,null,function*(){var e;if(L(this,Vu).canProduceVideo!==Hr.NotAllowed&&!(L(this,Vu).canProduceVideo===Hr.CanRequest&&(this.stageStatus==="OFF_STAGE"||this.stageStatus==="REQUESTED_TO_JOIN_STAGE"))&&!this.videoEnabled){if((e=L(this,qc))==null||e.getValue("callstats").videoOn(),yield this.localMediaHandler.enableVideo(t),L(this,Fl,sc)&&this.stageStatus==="ON_STAGE")try{yield L(this,Kc,Rd).shareWebcam(this.videoTrack)}catch(n){this.logger.error("Self::enableVideo::Error while sharing video",{error:n}),this.videoEnabled&&this.localMediaHandler.disableVideo()}this.emit("videoUpdate",{videoEnabled:this.videoEnabled,videoTrack:this.videoTrack}),this.logger.info("Self.enableVideo",en({},nj(this)))}})}updateVideoConstraints(t){return me(this,null,function*(){if(!this.localMediaHandler.updateVideoConstraints)throw new _t("Unsupported","1102");yield this.localMediaHandler.updateVideoConstraints(t)})}enableScreenShare(){return me(this,null,function*(){if(!L(this,Fl,sc))throw new _t("Can`t enable screenshare without joining room","1105");if(L(this,Vu).canProduceScreenshare!==Hr.NotAllowed&&!(L(this,Vu).canProduceScreenshare===Hr.CanRequest&&(this.stageStatus==="OFF_STAGE"||this.stageStatus==="REQUESTED_TO_JOIN_STAGE"))&&!this.screenShareEnabled&&(yield this.localMediaHandler.enableScreenShare(),this.screenShareTracks.audio||this.screenShareTracks.video)){try{yield L(this,Kc,Rd).shareScreen(this.screenShareTracks)}catch(t){this.logger.error("Self::enableScreenShare::Error while sharing screen",{error:t}),this.screenShareEnabled&&(yield this.localMediaHandler.disableScreenShare())}this.emit("screenShareUpdate",{screenShareEnabled:this.screenShareEnabled,screenShareTracks:this.screenShareTracks})}})}updateScreenshareConstraints(t){return me(this,null,function*(){if(!this.localMediaHandler.updateScreenshareConstraints)throw new _t("Unsupported","1102");yield this.localMediaHandler.updateScreenshareConstraints(t)})}disableAudio(){return me(this,null,function*(){var t;this.audioEnabled&&(this.localMediaHandler.disableAudio(),L(this,Fl,sc)&&L(this,Kc,Rd).muteSelf(),this.emit("audioUpdate",{audioEnabled:this.audioEnabled,audioTrack:this.audioTrack}),(t=L(this,qc))==null||t.getValue("callstats").audioOff())})}disableVideo(){return me(this,null,function*(){var t;this.videoEnabled&&(yield this.localMediaHandler.disableVideo(),L(this,Fl,sc)&&(yield L(this,Kc,Rd).pauseWebcam()),this.emit("videoUpdate",{videoEnabled:this.videoEnabled,videoTrack:this.videoTrack}),(t=L(this,qc))==null||t.getValue("callstats").videoOff())})}disableScreenShare(){return me(this,null,function*(){this.screenShareEnabled&&(yield this.localMediaHandler.disableScreenShare(),L(this,Fl,sc)&&(yield L(this,Kc,Rd).disableScreenShare()),this.emit("screenShareUpdate",{screenShareEnabled:this.screenShareEnabled,screenShareTracks:this.screenShareTracks}))})}getAllDevices(){return this.localMediaHandler.getAllDevices()}setIsPinned(t,e=!0){var n;Te(this,l3,t);const r=t?"pinned":"unpinned";(n=L(this,iw,XS))==null||n.updateSource(this.id,{pinned:t}),e&&this.emit(r,this)}get isPinned(){return L(this,l3)}pin(){return me(this,null,function*(){if(!L(this,Fl,sc))throw new _t("Can`t pin participants without joining room","1105");return this.show(),L(this,Kc,Rd).pinPeer(this.id)})}unpin(){return me(this,null,function*(){if(!L(this,Fl,sc))throw new _t("Can`t unpin participants without joining room","1105");return L(this,Kc,Rd).pinPeer(null)})}hide(){return me(this,null,function*(){if(!L(this,Fl,sc))throw new _t("Can`t toggle participant tile without joining room","1105");this.hidden=!0,this.emit("toggleTile",{hidden:this.hidden})})}show(){if(!L(this,Fl,sc))throw new _t("Can`t toggle participant tile without joining room","1105");this.hidden=!1,this.emit("toggleTile",{hidden:this.hidden})}setDevice(t){return me(this,null,function*(){var e,n,r;if(!t)throw new _t("No device selected","1104");const s=this.getCurrentDevices();switch(t.deviceId&&(((e=s==null?void 0:s.audio)==null?void 0:e.deviceId)===t.deviceId||((n=s==null?void 0:s.video)==null?void 0:n.deviceId)===t.deviceId||((r=s==null?void 0:s.speaker)==null?void 0:r.deviceId)===t.deviceId)&&this.logger.warn("Self.setDevice.setting_to_in_use_device",{devices:[t]}),t.kind){case"audioinput":try{yield this.localMediaHandler.setAudioDevice(t,{saveDevicePreference:!0})}catch{L(this,Fl,sc)&&(yield L(this,Kc,Rd).muteSelf()),this.emit("audioUpdate",{audioEnabled:this.audioEnabled,audioTrack:this.audioTrack})}break;case"audiooutput":yield this.localMediaHandler.setSpeakerDevice(t,{saveDevicePreference:!0});break;case"videoinput":try{yield this.localMediaHandler.setVideoDevice(t,{saveDevicePreference:!0})}catch{L(this,Fl,sc)&&(yield L(this,Kc,Rd).pauseWebcam()),this.emit("videoUpdate",{videoEnabled:this.videoEnabled,videoTrack:this.videoTrack})}break}})}cleanUpTracks(){var t,e,n,r;(t=this.audioTrack)==null||t.stop(),(e=this.rawAudioTrack)==null||e.stop(),(n=this.videoTrack)==null||n.stop(),(r=this.rawVideoTrack)==null||r.stop()}playAudio(){var t;return(t=L(this,c3,Mz))==null?void 0:t.play()}registerVideoElement(t,e=!1){var n,r;t&&(e?L(this,d3).add(t):L(this,u3).add(t),this.updateVideo(t),e||(r=L(this,iw,XS))==null||r.addSource(this.id,t,this.videoEnabled,this.isPinned,this.name,this.picture,(n=this.raised)!=null?n:!1))}deregisterVideoElement(t,e=!1){if(!t){L(this,iw,XS).removeSource(this.id);return}t.srcObject=void 0,e?L(this,d3).delete(t):(L(this,u3).delete(t),L(this,iw,XS).removeSource(this.id))}updateVideo(t,e=!1){var n,r,s;if(this.videoEnabled){if(this.videoTrack==null)return;const i=(n=t.srcObject)==null?void 0:n.getTracks()[0];if((i==null?void 0:i.id)===this.videoTrack.id)return;const o=new MediaStream;o.addTrack(this.videoTrack),t.srcObject=o,e||(r=L(this,iw,XS))==null||r.enableSource(this.id)}else t.srcObject=void 0,e||(s=L(this,iw,XS))==null||s.disableSource(this.id);t.style.display=this.videoEnabled?"block":"none"}},o3=new WeakMap,Vu=new WeakMap,l3=new WeakMap,qc=new WeakMap,iw=new WeakSet,XS=function(){return L(this,qc).getValue("pip")},Kc=new WeakSet,Rd=function(){return L(this,qc).getValue("roomNodeClient")},c3=new WeakSet,Mz=function(){return L(this,qc).getValue("audioPlayback")},Fl=new WeakSet,sc=function(){var t;return((t=L(this,qc).getValue("connectionHandler"))==null?void 0:t.mediaJoined)===!0},d3=new WeakMap,u3=new WeakMap,Lz=new WeakSet,rce=function(){Array.from(L(this,u3)).forEach(t=>this.updateVideo(t,!1)),Array.from(L(this,d3)).forEach(t=>this.updateVideo(t,!0))},TFe);Fu([ut.trace("Self.cleanupEvents")],Bc.prototype,"cleanupEvents",1);Fu([ut.trace("Self.setupEvents")],Bc.prototype,"setupEvents",1);Fu([ut.trace("Self.setupTracks")],Bc.prototype,"setupTracks",1);Fu([ut.trace("Self.destructMediaHandler")],Bc.prototype,"destructMediaHandler",1);Fu([ut.trace("Self.removeDocumentEventListeners")],Bc.prototype,"removeDocumentEventListeners",1);Fu([R0.executeWithLock({methodName:"meeting.self.enableAudio",lockName:"Self.toggleAudio",timeout:3e3}),ut.trace("Self.enableAudio")],Bc.prototype,"enableAudio",1);Fu([R0.executeWithLock({methodName:"meeting.self.enableVideo",lockName:"Self.toggleVideo",timeout:3e3}),ut.trace("Self.enableVideo")],Bc.prototype,"enableVideo",1);Fu([ut.trace("Self.updateVideoConstraints")],Bc.prototype,"updateVideoConstraints",1);Fu([ut.trace("Self.enableScreenShare"),R0.executeWithLock({methodName:"meeting.self.enableScreenShare",lockName:"Self.toggleScreenShare",timeout:3e3})],Bc.prototype,"enableScreenShare",1);Fu([ut.trace("Self.updateScreenshareConstraints")],Bc.prototype,"updateScreenshareConstraints",1);Fu([R0.executeWithLock({methodName:"meeting.self.disableAudio",lockName:"Self.toggleAudio",timeout:3e3}),ut.trace("Self.disableAudio")],Bc.prototype,"disableAudio",1);Fu([R0.executeWithLock({methodName:"meeting.self.disableVideo",lockName:"Self.toggleVideo",timeout:3e3}),ut.trace("Self.disableVideo")],Bc.prototype,"disableVideo",1);Fu([R0.executeWithLock({methodName:"meeting.self.disableScreenShare",lockName:"Self.toggleScreenShare",timeout:3e3}),ut.trace("Self.disableScreenShare")],Bc.prototype,"disableScreenShare",1);Fu([ut.trace("Self.setDevice")],Bc.prototype,"setDevice",1);Bc=Fu([tu("1100")],Bc);class gEe extends Error{constructor(e){super(e??"AwaitQueue stopped"),this.name="AwaitQueueStoppedError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,gEe)}}class vEe extends Error{constructor(e){super(e??"AwaitQueue task removed"),this.name="AwaitQueueRemovedTaskError",typeof Error.captureStackTrace=="function"&&Error.captureStackTrace(this,vEe)}}var tW;class Nve{constructor(e,n=!1){xe(this,"pendingTasks",new Map),xe(this,"nextTaskId",0),xe(this,"stopping",!1),Se(this,tW,void 0),this.log=n,Te(this,tW,{info:n&&e?e.info:()=>{}})}get size(){return this.pendingTasks.size}push(e,n,r){return me(this,null,function*(){if(n=n??e.name,typeof e!="function")throw new TypeError("given task is not a function");if(n)try{Object.defineProperty(e,"name",{value:n})}catch{}return new Promise((s,i)=>{const o={id:this.nextTaskId++,task:e,metadata:r,name:n,enqueuedAt:Date.now(),executedAt:void 0,completed:!1,resolve:l=>{if(o.completed)return;o.completed=!0,this.pendingTasks.delete(o.id),s(l);const[c]=this.pendingTasks.values();c&&!c.executedAt&&this.execute(c)},reject:l=>{if(!o.completed&&(o.completed=!0,this.pendingTasks.delete(o.id),i(l),!this.stopping)){const[c]=this.pendingTasks.values();c&&!c.executedAt&&this.execute(c)}}};this.pendingTasks.set(o.id,o),this.pendingTasks.size===1&&this.execute(o)})})}stop(){this.stopping=!0;for(const e of this.pendingTasks.values())e.reject(new gEe);this.stopping=!1}remove(e){const n=Array.from(this.pendingTasks.values())[e];n&&n.reject(new vEe)}get(e){return Array.from(this.pendingTasks.values())[e]}dump(){const e=Date.now();let n=0;return Array.from(this.pendingTasks.values()).map(r=>({idx:n++,task:r.task,name:r.name,enqueuedTime:r.executedAt?r.executedAt-r.enqueuedAt:e-r.enqueuedAt,executionTime:r.executedAt?e-r.executedAt:0}))}execute(e){return me(this,null,function*(){if(e.executedAt)throw new Error("task already being executed");e.executedAt=Date.now();try{const n=this.pendingTasks.size,r=yield e.task(),s=Date.now();L(this,tW).info(`AwaitQueue.push(${e.name})_timings`,{awaitQueueTask:{id:e.id,metadata:e.metadata,queueSizeAtStart:n,execTime:(s-e.executedAt)/1e3,taskStartTime:(e.executedAt-e.enqueuedAt)/1e3}}),e.resolve(r)}catch(n){e.reject(n)}})}}tW=new WeakMap;function xNn(t,e){const n=new Error(e);return n.name=t,n}class r6 extends Error{constructor(e){super(e),this.name="UnsupportedError",Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(this,r6):this.stack=new Error(e).stack}}let yf=class agt extends Error{constructor(e){super(e),this.name="InvalidStateError",Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(this,agt):this.stack=new Error(e).stack}};class i1 extends Error{constructor(e){super(e),this.name="TransportConnectionError",Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(this,yf):this.stack=new Error(e).stack}}const _Fe=t=>new Promise(e=>setTimeout(e,t));function ogt(t,e){return me(this,null,function*(){return new Promise((n,r)=>me(this,null,function*(){const{strategy:s,maxRetryCount:i,delayTime:o}=en({strategy:"linear",maxRetryCount:3,delayTime:10},e);let l=0,c,d=!1;const u=h=>{d=!0,r(h)};for(;l<i;){try{const h=yield t(l,u);return n(h)}catch(h){if(c=h,d)break;if(l<i)s==="linear"?yield _Fe(o*(l+1)):s==="exponential"&&(yield _Fe(o*(l+Math.max(0,l-1))));else break}l+=1}return r(c)}))})}function wNn(t){return t.map(e=>({channels:e.channels,clockRate:e.clockRate,mimeType:e.mimeType,sdpFmtpLine:e.sdpFmtpLine}))}function kNn(t){return t.map(e=>({uri:e.uri}))}function Dz(t){return{codecs:wNn(t.codecs),headerExtensions:kNn(t.headerExtensions?t.headerExtensions:[])}}function SNn(t){const e=RTCRtpReceiver.getCapabilities("audio"),n=RTCRtpReceiver.getCapabilities("video"),r=RTCRtpSender.getCapabilities("audio"),s=RTCRtpSender.getCapabilities("video");n.codecs=n.codecs.filter(({mimeType:o})=>t===o),s.codecs=s.codecs.filter(({mimeType:o})=>t===o);const i={audio:Dz(e),video:Dz(n)};return{sender:{audio:Dz(r),video:Dz(s)},receiver:i}}var ed;class CNn{constructor(e){Se(this,ed,void 0),xe(this,"events"),Te(this,ed,e),this.events=tg}joinRoom(e,n,r,s=!1){return me(this,null,function*(){const i={roomUuid:e,displayName:n,prejoined:s,capabilities:r};return(yield L(this,ed).sendMessagePromiseWithTimeout({event:this.events.joinRoom,protobuf:s1n.toBinary(i),timeout:5e3})).payload})}connectTransport(e){return me(this,null,function*(){const n=(yield L(this,ed).sendMessagePromise(this.events.createWebRTCTransport,Rwn.toBinary(e))).payload,{transportId:r,description:s,producerIds:i}=Cpt.fromBinary(n),o={sdp:s==null?void 0:s.sdp,type:s.type};return{transportId:r,answer:o,producerIds:i}})}produce(e){return me(this,null,function*(){var n,r;const s=(yield L(this,ed).sendMessagePromise(this.events.produce,b1n.toBinary(e))).payload,i=tkn.fromBinary(s);return{answer:{sdp:(n=i==null?void 0:i.description)==null?void 0:n.sdp,type:(r=i==null?void 0:i.description)==null?void 0:r.type},producerId:i.producerId}})}consume(e){return me(this,null,function*(){const n=(yield L(this,ed).sendMessagePromise(this.events.consume,m1n.toBinary(e))).payload,{consumerIdsMap:{map:r},description:s}=X1n.fromBinary(n);return{consumerStateMap:r,sessionDescription:s}})}closeProducer(e){return me(this,null,function*(){const n=(yield L(this,ed).sendMessagePromise(this.events.closeProducer,E1n.toBinary(e))).payload,{description:r}=lkn.fromBinary(n);return r})}closeConsumer(e){return me(this,null,function*(){return(yield L(this,ed).sendMessagePromise(this.events.closeConsumer,T1n.toBinary(e))).payload})}updateConsumersSimulcastConfig(e){return me(this,null,function*(){return(yield L(this,ed).sendMessagePromise(this.events.updateConsumersSimulcastConfig,v1n.toBinary(e))).payload})}hostControlForPeer(e,n){return me(this,null,function*(){const r={audio:n==="audio",screeShare:!1,video:n==="video",participantId:e},s=(yield L(this,ed).sendMessagePromise(this.events.hostControlPeer,M1n.toBinary(r))).payload;if(!s)return!1;const{status:i}=pkn.fromBinary(s);return i==="success"})}hostControlForAll(e){return me(this,null,function*(){const n={audio:e==="audio",screenShare:!1,video:e==="video"},r=(yield L(this,ed).sendMessagePromise(this.events.hostControlAllPeers,D1n.toBinary(n))).payload;if(!r)return!1;const{status:s}=vkn.fromBinary(r);return s==="success"})}kickAll(){return me(this,null,function*(){const e={propagateKickAcrossRooms:!1};L(this,ed).sendMessagePromise(Rn.kickAll,Tpt.toBinary(e))})}kickPeer(e){return me(this,null,function*(){L(this,ed).sendMessagePromise(Rn.kick,Ipt.toBinary(e))})}changeDisplayName(e){return me(this,null,function*(){const n=(yield L(this,ed).sendMessagePromise(this.events.changeDisplayName,R1n.toBinary(e))).payload;if(!n)return!1;const{status:r}=bkn.fromBinary(n);return r==="success"})}notifySelfJoinComplete(){return me(this,null,function*(){const e={},n=(yield L(this,ed).sendMessagePromise(this.events.selfJoinComplete,a1n.toBinary(e))).payload;return cve.fromBinary(n)})}audioActivity(e){return me(this,null,function*(){L(this,ed).sendMessage(this.events.audioActivity,Mwn.toBinary(e))})}}ed=new WeakMap;var Lk=(t=>(t.NEW="new",t.CONNECTING="connecting",t.RECONNECTING="reconnecting",t.DISCONNECTED="disconnected",t.CONNECTED="connected",t.FAILED="failed",t.CLOSED="closed",t))(Lk||{}),nW;class Bte extends Zd.EventEmitter{constructor(e){super(),Se(this,nW,void 0),Te(this,nW,e),this.setMaxListeners(1/0)}get logger(){return L(this,nW).getValue("logger")}safeEmit(e,...n){const r=this.listenerCount(e);try{return this.emit(e,...n)}catch(s){return this.logger.error(`EnhancedEventEmitter:: safeEmit() | event listener ${e} threw an error`,{error:s}),!!r}}safeEmitAsPromise(e,...n){return me(this,null,function*(){const r={}.EVENT_PROMISE_TIMEOUT?parseInt({}.EVENT_PROMISE_TIMEOUT,10):1e4;return this.safeEmitAsPromiseWithTimeout(e,r,...n)})}safeEmitAsPromiseWithTimeout(e,n,...r){return me(this,null,function*(){return new Promise((s,i)=>{setTimeout(i,n,"event request timeout");try{this.emit(e.toString(),...r,s,i)}catch(o){this.logger.error(`EnhancedEventEmitter:: safeEmitAsPromise() | event listener for event ${e.toString()} threw an error [event:%s]:%o`,{error:o}),i(o)}})})}}nW=new WeakMap;class yEe extends Bte{constructor(){super(...arguments),xe(this,"_sendWebStream",new MediaStream),xe(this,"_sendScreenShareStream",new MediaStream),xe(this,"_direction"),xe(this,"pc"),xe(this,"_transportReady",!1),xe(this,"_mapMidTransceiver",new Map),xe(this,"enableHighBitrate",!1),xe(this,"enableStereo",!1),xe(this,"enableDtx",!0)}get midTransceiverMap(){return this._mapMidTransceiver}close(){if(this.logger.debug(`${this.name}::close()`),this.pc)try{this.pc.close()}catch(e){this.logger.error(`${this.name}::pc.close()`,{error:e})}}restartIce(){return me(this,null,function*(){this.logger.debug(`${this.name}::restartIce()`);const e=yield this.pc.createOffer({iceRestart:!0});return this.logger.debug(`[SDP] ${this.name}::restartIce() | calling pc.setLocalDescription() [offer:${JSON.stringify(e)}]`),{offerSdp:e,callback:n=>me(this,null,function*(){this.logger.info(`[SDP] ${this.name}::restartIce() | calling pc.setRemoteDescription() [answer:${JSON.stringify(n)}]`),yield this.pc.setRemoteDescription(n)})}})}init({direction:e,iceServers:n,iceTransportPolicy:r,additionalSettings:s,proprietaryConstraints:i,onTrackHandler:o}){this.logger.debug("HandlerInterface::init()"),this._direction=e,this.pc=new RTCPeerConnection(en({iceServers:n||[],iceTransportPolicy:r||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require"},s),i),o&&this.pc.addEventListener("track",l=>{o(l)}),this._addEventListeners()}connect(){return me(this,null,function*(){this.pc.addTransceiver("audio",{direction:"sendonly"}),this.pc.addTransceiver("video",en({direction:"sendonly"},this._direction==="send"?{sendEncodings:[{rid:"f",scaleResolutionDownBy:1},{rid:"h",scaleResolutionDownBy:2},{rid:"q",scaleResolutionDownBy:4}]}:{}));const e=yield this.pc.createOffer();return yield this.pc.setLocalDescription(e),this.logger.info(`[SDP] connect offer: ${JSON.stringify(e)}`),{offerSdp:e,callback:n=>me(this,null,function*(){this.logger.debug(`[SDP] ${this.name}::connect() | calling pc.setRemoteDescription() [answer:${JSON.stringify(n)}]`),yield this.pc.setRemoteDescription(n)})}})}getTransportStats(){return me(this,null,function*(){return this.pc.getStats()})}_assertSendDirection(){if(this._direction!=="send")throw new Error('method can just be called for handlers with "send" direction')}_assertRecvDirection(){if(this._direction!=="recv")throw new Error('method can just be called for handlers with "recv" direction')}getReceiverStats(e){return me(this,null,function*(){this._assertRecvDirection();const n=this.midTransceiverMap.get(e);if(!n)throw new Error("associated RTCRtpTransceiver not found");return n.receiver.getStats()})}stopSending(e){return me(this,null,function*(){this._assertSendDirection(),this.logger.debug(`stopSending() [localId:${e}]`);const n=this.midTransceiverMap.get(e);if(!n)throw new Error("associated RTCRtpTransceiver not found");n.sender.replaceTrack(null),this.pc.removeTrack(n.sender),n.direction="inactive";const r=yield this.pc.createOffer();return this.logger.debug(`[SDP] stopSending() | calling pc.setLocalDescription() [offer:${JSON.stringify(r)}]`),yield this.pc.setLocalDescription(r),{offerSdp:r,callback:s=>me(this,null,function*(){this.logger.debug(`[SDP] stopSending() | calling pc.setRemoteDescription() [answer:${JSON.stringify(s)}]`),yield this.pc.setRemoteDescription(s),this.midTransceiverMap.delete(e)})}})}replaceTrack(e,n){return me(this,null,function*(){this._assertSendDirection(),n?this.logger.debug(`replaceTrack() [localId:${e}, track.id:${n.id}]`):this.logger.debug(`replaceTrack() [localId:${e}, no track]`);const r=this.midTransceiverMap.get(e);if(!r)throw new Error("associated RTCRtpTransceiver not found");yield r.sender.replaceTrack(n)})}setMaxSpatialLayer(e,n){return me(this,null,function*(){this._assertSendDirection(),this.logger.debug(`setMaxSpatialLayer() [localId:${e}, spatialLayer:${n}]`);const r=this.midTransceiverMap.get(e);if(!r)throw new Error("associated RTCRtpTransceiver not found");const s=r.sender.getParameters();s.encodings.forEach((i,o)=>{o<=n?i.active=!0:i.active=!1}),yield r.sender.setParameters(s)})}setRtpEncodingParameters(e,n){return me(this,null,function*(){this._assertSendDirection(),this.logger.debug(`setRtpEncodingParameters() [localId:${e}, params:${JSON.stringify(n)}]`);const r=this.midTransceiverMap.get(e);if(!r)throw new Error("associated RTCRtpTransceiver not found");const s=r.sender.getParameters();s.encodings.forEach((i,o)=>{s.encodings[o]=en(en({},i),n)}),yield r.sender.setParameters(s)})}getSenderStats(e){this._assertSendDirection();const n=this.midTransceiverMap.get(e);if(!n)throw new Error("associated RTCRtpTransceiver not found");return n.sender.getStats()}_addEventListeners(){this.pc.addEventListener("icecandidate",e=>{e.candidate&&this.emit("@icecandidate",{candidate:e.candidate})}),this.pc.addEventListener("iceconnectionstatechange",()=>{switch(this.pc.iceConnectionState){case"checking":this.emit("@connectionstatechange","connecting");break;case"connected":case"completed":this.emit("@connectionstatechange","connected"),this._transportReady=!0;break;case"failed":this.emit("@connectionstatechange","failed");break;case"disconnected":this.emit("@connectionstatechange","disconnected");break;case"closed":this.emit("@connectionstatechange","closed");break;default:this.logger.warn("unknown state");break}}),this.pc.addEventListener("negotiationneeded",()=>{this.emit("@negotiationneeded",{}),this.logger.debug("negotiationneeded")}),this.pc.addEventListener("icegatheringstatechange",()=>{switch(this.pc.iceGatheringState){case"gathering":this.logger.debug("icegatheringstatechange | gathering"),this.emit("@icegatheringstatechange","gathering");break;case"complete":this.logger.debug("icegatheringstatechange | complete"),this.emit("@icegatheringstatechange","complete");break;default:this.logger.warn("unknown state");break}}),this.pc.addEventListener("icecandidateerror",e=>{this.logger.warn("icecandidateerror",{error:{code:e.errorCode,message:e.errorText}})}),this.pc.addEventListener("datachannel",e=>{this.logger.info("data channel created: ",{rtcChannel:{label:e.channel.label}});const{channel:n}=e;n.onopen=()=>{this.logger.info("data channel open: ",{rtcChannel:{label:e.channel.label}}),this.safeEmit("dc_open",e.channel)},n.onclose=()=>{this.logger.warn("data channel closed: ",{rtcChannel:{label:e.channel.label}})},n.onerror=()=>{this.logger.error("data channel error: ",{rtcChannel:{label:e.channel.label}})}}),this.addCustomEventListeners()}addCustomEventListeners(){}}class bEe extends yEe{static createFactory(e){return()=>new bEe(e)}get name(){return"Chrome74"}init({direction:e,iceServers:n,iceTransportPolicy:r,additionalSettings:s,proprietaryConstraints:i,onTrackHandler:o}){this._direction=e,this.pc=new RTCPeerConnection(en({iceServers:n||[],iceTransportPolicy:r||"all",bundlePolicy:"max-bundle",rtcpMuxPolicy:"require",sdpSemantics:"unified-plan"},s),i),o&&this.pc.addEventListener("track",l=>{o(l)}),this._addEventListeners()}send(e){return me(this,arguments,function*({track:n,encodings:r,codecOptions:s,screenShare:i}){this._assertSendDirection();const o=this.pc.addTransceiver(n,{direction:"sendonly",streams:[i?this._sendScreenShareStream:this._sendWebStream],sendEncodings:r});if(!navigator.isReactNative){this.logger.debug("creating new transceiver");const d=RTCRtpSender.getCapabilities(typeof n=="string"?n:n.kind);this.logger.info(`senders available params: ${JSON.stringify(d)}`);const u=[];s&&s.length&&s.forEach(h=>{var m;const f=d.codecs.find(p=>p.mimeType.includes(h.name));if(h.parameters){this.logger.debug(`codecOption.parameters:${JSON.stringify(h.parameters)}`);const p=((m=f.sdpFmtpLine)==null?void 0:m.split(";"))||[];p.push(...h.parameters);const g=Array.from(new Set(p).values());f.sdpFmtpLine=g.join(";")}u.push(f)}),this.logger.info(`selected codecs: ${JSON.stringify(u)}`),o.setCodecPreferences(u)}const l=yield this.pc.createOffer();if(yield this.pc.setLocalDescription(l),s&&s.findIndex(({name:d})=>d==="opus")>=0){const{enableDtx:d,enableStereo:u}=this,h=this.enableHighBitrate?u?128e3:64e3:u?64e3:32e3;l.sdp=l.sdp.replace("minptime=10;useinbandfec=1",`minptime=10;useinbandfec=1;${d?"usedtx=1;":""}${u?"stereo=1;sprop-stereo=1;":""}maxaveragebitrate=${h}`),l.sdp+=`a=rtcp-fb:111 nack\r
`}this.midTransceiverMap.set(o.mid,o);const c=d=>me(this,null,function*(){return this.logger.debug(`[SDP] send() | calling pc.setRemoteDescription() [answer:${JSON.stringify(d)}]`),yield this.pc.setRemoteDescription(d),o.mid});return this.logger.debug(`[SDP] send() | calling pc.setLocalDescription() [offer: ${JSON.stringify(l,void 0,2)}]`),{offerSdp:l,callback:c,sender:o.sender,mid:o.mid}})}addCustomEventListeners(){this.pc.addEventListener("datachannel",e=>{const{channel:n}=e;n.onmessage=r=>{this.safeEmit("datachannel",e.channel,String.fromCharCode(...new Uint8Array(r.data)))}})}}class KY extends yEe{constructor(e,n){super(e),xe(this,"supportsSendEncodings",!1),this.supportsSendEncodings=n.supportsSendEncodings}static createFactory(e,n){return()=>new KY(e,n)}get name(){return"Firefox60"}send(e){return me(this,arguments,function*({track:n,encodings:r,codecOptions:s,screenShare:i}){this._assertSendDirection();const o=this.supportsSendEncodings&&r!==void 0?{sendEncodings:r}:{},l=this.pc.addTransceiver(n,en({direction:"sendonly",streams:[i?this._sendScreenShareStream:this._sendWebStream]},o));if(!this.supportsSendEncodings&&r){r.reverse();const u=l.sender.getParameters();u.encodings=r,yield l.sender.setParameters(u)}const c=(u,h)=>{var m;const f=XC(u),p=f.media[f.media.length-1],g=p.rtp.filter(w=>h.some(k=>k.name===w.codec)),v=p.fmtp.filter(w=>g.some(k=>k.payload===w.payload)),b=(m=p.rtcpFb)==null?void 0:m.filter(w=>g.some(k=>k.payload===w.payload)),x=g.map(w=>w.payload);return f.media[f.media.length-1].rtp=g,f.media[f.media.length-1].fmtp=v,f.media[f.media.length-1].rtcpFb=b,f.media[f.media.length-1].payloads=x.join(" "),DG(f)},d=yield this.pc.createOffer();if(d.sdp=c(d.sdp,s),this.logger.debug(`[SDP] send() | calling pc.setLocalDescription() [offer:${JSON.stringify(d)}]`),yield this.pc.setLocalDescription(d),n==="audio"||n.kind==="audio"){const{enableDtx:u,enableStereo:h}=this,m=this.enableHighBitrate?h?128e3:64e3:h?64e3:32e3;d.sdp=d.sdp.replace("minptime=10;useinbandfec=1",`minptime=10;useinbandfec=1;${u?"usedtx=1;":""}${h?"stereo=1;sprop-stereo=1;":""}maxaveragebitrate=${m}`)}return this.midTransceiverMap.set(l.mid,l),{offerSdp:d,callback:u=>me(this,null,function*(){return this.logger.debug(`send() | calling pc.setRemoteDescription() [answer:${JSON.stringify(u)}]`),yield this.pc.setRemoteDescription(u),l.mid}),sender:l.sender,mid:l.mid}})}setMaxSpatialLayer(e,n){return me(this,null,function*(){this._assertSendDirection(),this.logger.debug(`setMaxSpatialLayer() [localId:${e}, spatialLayer:${n}]`);const r=this.midTransceiverMap.get(e);if(!r)throw new Error("associated RTCRtpTransceiver not found");const s=r.sender.getParameters(),i=s.encodings.length-1-n;s.encodings.forEach((o,l)=>{l>=i?o.active=!0:o.active=!1}),yield r.sender.setParameters(s)})}addCustomEventListeners(){this.pc.addEventListener("datachannel",e=>{const{channel:n}=e;n.onmessage=r=>me(this,null,function*(){const s=yield r.data.arrayBuffer();this.safeEmit("datachannel",e.channel,String.fromCharCode(...new Uint8Array(s)))})})}}class xEe extends yEe{static createFactory(e){return()=>new xEe(e)}get name(){return"Safari12"}send(e){return me(this,arguments,function*({track:n,encodings:r,codecOptions:s,screenShare:i}){this._assertSendDirection(),this.logger.debug("Safari12::creating new transceiver");const o=this.pc.addTransceiver(n,{direction:"sendonly",streams:[i?this._sendScreenShareStream:this._sendWebStream],sendEncodings:r}),l=RTCRtpSender.getCapabilities(typeof n=="string"?n:n.kind);this.logger.info(`Safari12::senders available params: ${JSON.stringify(l)}`);const c=[];s&&s.length>0&&s.forEach(u=>{var h;const m=l.codecs.find(f=>f.mimeType.includes(u.name));if(u.parameters){this.logger.info(`Safari12::codecOption.parameters:, ${JSON.stringify(u.parameters)}`);const f=((h=m.sdpFmtpLine)==null?void 0:h.split(";"))||[];f.push(...u.parameters);const p=[...new Set(f).values()];m.sdpFmtpLine=p.join(";")}c.push(m)}),this.logger.info(`Safari12::selected codecs: ${JSON.stringify(c)}`),o.setCodecPreferences(c);const d=yield this.pc.createOffer();if(yield this.pc.setLocalDescription(d),n==="audio"||n.kind==="audio"){const{enableStereo:u,enableDtx:h}=this,m=this.enableHighBitrate?u?128e3:64e3:u?64e3:32e3;d.sdp=d.sdp.replace("minptime=10;useinbandfec=1",`minptime=10;useinbandfec=1;${h?"usedtx=1;":""}${u?"stereo=1;sprop-stereo=1;":""}maxaveragebitrate=${m}`)}return this.midTransceiverMap.set(o.mid,o),{offerSdp:d,callback:u=>me(this,null,function*(){return this.logger.debug(`Safari12::send() | calling pc.setRemoteDescription() [answer:${JSON.stringify(u)}]`),yield this.pc.setRemoteDescription(u),o.mid}),sender:o.sender,mid:o.mid}})}addCustomEventListeners(){this.pc.ondatachannel=e=>{const{channel:n}=e;n.onmessage=r=>me(this,null,function*(){const s=String.fromCharCode(...new Uint8Array(r.data));this.safeEmit("datachannel",e.channel,s)})}}}function jNn(t,e){return typeof t>"u"?e:typeof window<"u"&&Object.getOwnPropertyDescriptor(window,"structuredClone")?structuredClone(t):JSON.parse(JSON.stringify(t))}var rW,u_,Pb,Tve,zb,a1,sW,sce,_ve,lgt,Ave,cgt;class ENn extends Bte{constructor(e,n){var r;super(e),Se(this,zb),Se(this,sW),Se(this,_ve),Se(this,Ave),xe(this,"rtpReceiver"),xe(this,"id"),xe(this,"localId"),xe(this,"producerId"),xe(this,"producingTransportId"),xe(this,"mimeType"),xe(this,"track"),xe(this,"peerId"),xe(this,"appData"),xe(this,"transceiver"),Se(this,rW,void 0),Se(this,u_,void 0),Se(this,Pb,void 0),Se(this,Tve,void 0),this.id=n.id,this.localId=n.localId,Te(this,rW,n.handler),this.appData=n.appData,this.peerId=n.producingPeerId,this.producingTransportId=n.producingTransportId,Te(this,Pb,!1),this.producerId=n.producerId,this.track=n.track,Te(this,u_,(r=n.paused)!=null?r:!1),this.mimeType=n.mimeType,this.transceiver=n.transceiver,this.rtpReceiver=n.rtpReceiver,In(this,_ve,lgt).call(this),Te(this,Tve,e)}get closed(){return L(this,Pb)}get kind(){return this.track.kind}get paused(){return L(this,u_)}close(e,n){L(this,Pb)||(this.logger.debug(`Consumer::close() ${e?`with reason ${e}`:""}`,L(this,zb,a1)),Te(this,Pb,!0),n&&(In(this,Ave,cgt).call(this),this.transceiver.stop()),this.safeEmit("close",e))}getStats(){return me(this,null,function*(){if(L(this,Pb))throw new yf("closed");return L(this,rW).getReceiverStats(this.localId)})}pause(){if(this.logger.debug("consumer::pause()",L(this,zb,a1)),L(this,Pb)){this.logger.error("consumer::pause() | Consumer closed",L(this,zb,a1));return}Te(this,u_,!0),this.track.enabled=!1,this.safeEmit("pause")}resume(){if(this.logger.debug("consumer::resume()",L(this,zb,a1)),L(this,Pb)){this.logger.error("Consumer::resume() | Consumer closed",L(this,zb,a1));return}Te(this,u_,!1),this.track.enabled=!0,this.safeEmit("resume")}}rW=new WeakMap,u_=new WeakMap,Pb=new WeakMap,Tve=new WeakMap,zb=new WeakSet,a1=function(){return{consumer:{id:this.id,appData:this.appData,peerId:this.peerId,kind:this.kind}}},sW=new WeakSet,sce=function(){this.logger.debug('Consumer::track "ended" event',L(this,zb,a1)),this.safeEmit("trackended")},_ve=new WeakSet,lgt=function(){this.track.addEventListener("ended",In(this,sW,sce).bind(this))},Ave=new WeakSet,cgt=function(){try{this.track.removeEventListener("ended",In(this,sW,sce)),this.track.stop()}catch(t){this.logger.error("Consumer::destroyTrack()",Dr(en({},L(this,zb,a1)),{error:t}))}};var jv,A4,P4,h_,Ap,Dd,NC,R4,Pve,Zm,Pp;class NNn extends Bte{constructor(e,n){var r,s;super(e),Se(this,Zm),xe(this,"id"),xe(this,"localId"),Se(this,jv,void 0),xe(this,"kind"),xe(this,"appData"),xe(this,"rtpSender"),Se(this,A4,void 0),Se(this,P4,void 0),Se(this,h_,void 0),Se(this,Ap,!1),Se(this,Dd,void 0),Se(this,NC,void 0),Se(this,R4,void 0),Se(this,Pve,void 0),this.id=n.id,this.localId=n.localId,Te(this,Dd,n.track),this.kind=(r=n.track)==null?void 0:r.kind,Te(this,NC,n.disableTrackOnPause?!((s=n.track)!=null&&s.enabled):!1),Te(this,R4,void 0),Te(this,A4,n.stopTracks),Te(this,P4,n.disableTrackOnPause),Te(this,h_,n.zeroRtpOnPause),this.appData=n.appData||{},this._onTrackEnded=this._onTrackEnded.bind(this),Te(this,jv,n.handler),this.rtpSender=n.rtpSender,this._handleTrack(),Te(this,Pve,e)}get closed(){return L(this,Ap)}get track(){return L(this,Dd)}get paused(){return L(this,NC)}get maxSpatialLayer(){return L(this,R4)}close(e){return me(this,null,function*(){if(L(this,Ap))return;if(this.logger.debug(`Producer::close() ${e?`with reason ${e}`:""}`,L(this,Zm,Pp)),Te(this,Ap,!0),this._destroyTrack(),e===s6){this.safeEmit("close",{reason:e});return}const{offerSdp:n,callback:r}=yield L(this,jv).stopSending(this.localId),{answer:s}=yield this.safeEmitAsPromise("close",{offer:n,reason:e});r(s)})}getStats(){return me(this,null,function*(){if(L(this,Ap))throw new yf("closed");return L(this,jv).getSenderStats(this.localId)})}pause(){this.logger.debug("Producer::pause()",L(this,Zm,Pp)),L(this,Ap)&&this.logger.error("Producer::pause() | Producer closed",L(this,Zm,Pp)),Te(this,NC,!0),L(this,Dd)&&L(this,P4)&&(L(this,Dd).enabled=!1),L(this,h_)&&L(this,jv).replaceTrack(this.localId,null),this.emit("pause")}resume(){if(this.logger.debug("Producer::resume()",L(this,Zm,Pp)),L(this,Ap)){this.logger.error("Producer::resume() | Producer closed",L(this,Zm,Pp));return}Te(this,NC,!1),L(this,Dd)&&L(this,P4)&&(L(this,Dd).enabled=!0),L(this,h_)&&L(this,jv).replaceTrack(this.localId,L(this,Dd)),this.emit("resume")}replaceTrack(e){return me(this,arguments,function*({track:n}){if(this.logger.debug(`Producer::replaceTrack() trackId: ${n==null?void 0:n.id}`,L(this,Zm,Pp)),L(this,Ap)){if(n&&L(this,A4))try{n.stop()}catch(r){this.logger.error("Producer::replaceTrack",Dr(en({},L(this,Zm,Pp)),{error:r}))}throw new yf("closed")}else if(n&&n.readyState==="ended")throw new yf("track ended");if(n===L(this,Dd)){this.logger.debug(`replaceTrack() | same track, ignored trackId: ${n.id}`,L(this,Zm,Pp));return}(!L(this,h_)||!L(this,NC))&&(yield L(this,jv).replaceTrack(this.localId,n)),this._destroyTrack(),Te(this,Dd,n),this._handleTrack()})}setMaxSpatialLayer(e){return me(this,null,function*(){if(L(this,Ap))throw new yf("closed");if(this.kind!=="video")throw new r6("not a video Producer");if(typeof e!="number")throw new TypeError("invalid spatialLayer");yield L(this,jv).setMaxSpatialLayer(this.localId,e),Te(this,R4,e)})}setRtpEncodingParameters(e){return me(this,null,function*(){if(L(this,Ap))throw new yf("closed");if(typeof e!="object")throw new TypeError("invalid params");yield L(this,jv).setRtpEncodingParameters(this.localId,e)})}_onTrackEnded(){this.logger.debug(`Producer::track "ended" event trackId: ${this.track.id}`,L(this,Zm,Pp)),this.safeEmit("trackended",this.track.id)}_handleTrack(){L(this,Dd)&&L(this,Dd).addEventListener("ended",this._onTrackEnded)}_destroyTrack(){var e;if(L(this,Dd))try{L(this,Dd).removeEventListener("ended",this._onTrackEnded),L(this,A4)&&L(this,Dd).stop()}catch(n){this.logger.error(`Producer::_destroyTrack trackId: ${(e=this.track)==null?void 0:e.id}`,Dr(en({},L(this,Zm,Pp)),{error:n}))}}}jv=new WeakMap,A4=new WeakMap,P4=new WeakMap,h_=new WeakMap,Ap=new WeakMap,Dd=new WeakMap,NC=new WeakMap,R4=new WeakMap,Pve=new WeakMap,Zm=new WeakSet,Pp=function(){return{producer:{id:this.id,appData:this.appData,kind:this.kind}}};function dgt(t){return typeof t=="object"&&!Array.isArray(t)&&t!==null}function Rve(t){return Math.random().toString(36).substring(2,2+t)}const $z=1;function AFe(t){const e=t;return delete e.payload._bolt,e}function TNn(t){return t.payload&&dgt(t.payload)}function _Nn(t){var e,n;return TNn(t)&&(n=(e=t.payload._bolt)==null?void 0:e.id)!=null?n:""}var TC,Ive,m_;const I4=class extends Zd.EventEmitter{constructor(t,e,n,r){super(),xe(this,"channel"),xe(this,"queue"),xe(this,"serverProtocolVersion"),Se(this,TC,new Map),Se(this,Ive,void 0),Se(this,m_,void 0),xe(this,"respond",(s,i,o=!1)=>{let l;o?l=I4.createErrorResponse(s,i):l=I4.createResponse(s,i),this.channel.send(JSON.stringify(l))}),xe(this,"notify",s=>{const i=I4.createNotification(s);this.channel.send(JSON.stringify(i))}),xe(this,"request",s=>me(this,null,function*(){const i=I4.createRequest(s),o=new Promise((l,c)=>{const{id:d}=i.payload._bolt,u={id:d,method:i.type,resolve:h=>{this.queue.delete(d)&&(clearTimeout(u.timer),l(h))},timer:setTimeout(()=>{this.queue.delete(d)&&c(new Error(`request timeout for message id: ${d}`))},2e4),cancel:h=>{this.queue.delete(d)&&(clearTimeout(u.timer),c(h))}};this.queue.set(d,u)});return this.channel.send(JSON.stringify(i)),o})),xe(this,"send",s=>{const i=JSON.stringify(s),o=16384;if(i.length>o){const l=o-200,c=Math.ceil(i.length/l),d=[];for(let h=0;h<c;h+=1){const m=h*l,f=(h+1)*l;d.push(i.slice(m,f))}const u=pR();for(let h=0;h<c;h+=1){const m=d[h],f=JSON.stringify({id:u,count:c,chunkIndex:h,chunk:m});L(this,m_).debug(`Sending message chunk over dc: ${f}`),this.channel.send(f)}}else L(this,m_).debug(`Sending message over dc: ${i}`),this.channel.send(i)}),xe(this,"processMessage",s=>{var i;L(this,TC).has(s.id)||L(this,TC).set(s.id,[]);const o=L(this,TC).get(s.id);if(o[s.chunkIndex]=s,(o==null?void 0:o.length)===s.count&&!o.some(l=>l===void 0)){const l=L(this,TC).get(s.id),c=l==null?void 0:l.reduce((u,h)=>u+h.chunk,"");L(this,TC).delete(s.id);const d=JSON.parse(c);if(!d.payload||!dgt(d.payload))throw new Error("corrupted incoming message over dc",{cause:{code:"CORRUPT_DC_MESSAGE",values:d}});if(this.processBoltHandshake(d))return;if(this.serverProtocolVersion=(i=d.payload._bolt)==null?void 0:i.version,!this.processResponseMsg(d))return d}}),xe(this,"processResponseMsg",s=>{const{id:i}=s.payload._bolt,o=this.queue.get(i);return o?(L(this,m_).debug(`resolving pending request with id: ${i}, complete response: ${JSON.stringify(s)}`),s.type==="error"?o.cancel(AFe(s)):o.resolve(AFe(s)),!0):!1}),xe(this,"processBoltHandshake",s=>{var i,o;return s.type==="_bolt"||s.type==="handshake"?(this.respond((o=(i=s.payload._bolt)==null?void 0:i.id)!=null?o:Rve(8),{type:"_bolt",payload:{message:"pong"}}),!0):!1}),this.label=n,this.transportId=r,Te(this,Ive,t),Te(this,m_,t.getValue("logger")),this.channel=e,this.queue=new Map}};let M4=I4;TC=new WeakMap,Ive=new WeakMap,m_=new WeakMap,xe(M4,"createRequest",t=>{var e;if((e=t.payload)!=null&&e._bolt)throw new Error("rpc fields are internal values");return{type:t.type,payload:Dr(en({},t.payload),{_bolt:{id:Rve(8),type:"REQUEST",version:$z}})}}),xe(M4,"createResponse",(t,e)=>{var n;if((n=e.payload)!=null&&n._bolt)throw new Error("rpc fields are internal values");return{type:e.type,payload:Dr(en({},e.payload),{_bolt:{id:t,type:"RESPONSE",version:$z}})}}),xe(M4,"createNotification",t=>{var e;if((e=t.payload)!=null&&e._bolt)throw new Error("rpc fields are internal values");return{type:t.type,payload:Dr(en({},t.payload),{bolt:{id:Rve(8),type:"NOTIFY",version:$z}})}}),xe(M4,"createErrorResponse",(t,e)=>({type:"error",payload:{error:e.message,_bolt:{id:t,type:"RESPONSE",version:$z}}}));const s6="transport closed";var f_;const L4=class extends Bte{constructor(e,{id:n,direction:r,handlerFactory:s,iceServers:i,iceTransportPolicy:o,proprietaryConstraints:l,additionalSettings:c,appData:d,config:u}){var h,m,f;super(e),xe(this,"awaitQueue"),xe(this,"observer"),xe(this,"id"),xe(this,"serverId"),xe(this,"direction"),xe(this,"maxSctpMessageSize"),xe(this,"handler"),xe(this,"connectionState","new"),xe(this,"producers"),xe(this,"consumers"),xe(this,"datachannels"),xe(this,"connected",!1),xe(this,"eventsDCReadyPromise"),xe(this,"eventsDCReadyPromiseResolver"),xe(this,"eventsDCFailureTimer"),xe(this,"transportConnectionPromise"),xe(this,"consumerTrackEvents"),xe(this,"unknownTracksMap"),xe(this,"appData"),Se(this,f_,void 0),Te(this,f_,e);const p=e.getValue("logger");p.debug(`constructor() [id: ${n}, direction: ${r}]`),this.id=n,this.direction=r;const g=jNn(c,{});delete g.iceServers,delete g.iceTransportPolicy,delete g.bundlePolicy,delete g.rtcpMuxPolicy,delete g.sdpSemantics,this.producers=new Map,this.consumers=new Map,this.datachannels=new Map,this.consumerTrackEvents=new Map,this.unknownTracksMap=new Map,this.awaitQueue=new Nve(p,!0),this.handler=s(),this.handler.enableHighBitrate=(h=u==null?void 0:u.enableHighBitrate)!=null?h:!1,this.handler.enableStereo=(m=u==null?void 0:u.enableStereo)!=null?m:!1,this.handler.enableDtx=(f=u==null?void 0:u.enableDtx)!=null?f:!0,this.handler.init({onTrackHandler:this._ontrack.bind(this),direction:r,iceServers:i,iceTransportPolicy:o,additionalSettings:c,proprietaryConstraints:l}),this.appData=d||{};const v=3e4;this.transportConnectionPromise=new Promise(b=>{const x=setTimeout(()=>{p.error("ICE connection timeout - possible firewall blocking WebRTC or TURN unreachable",{transport:{id:this.id,type:this.direction}}),b(!1)},v);this.once("connected",()=>{clearTimeout(x),b(!0)}),this.once("disconnect",()=>{clearTimeout(x),b(!1)}),this.once("close",()=>{clearTimeout(x),b(!1)})}),this.eventsDCReadyPromise=new Promise(b=>{this.eventsDCReadyPromiseResolver=b}),this.handler.on("@connectionstatechange",b=>{b!==this.connectionState&&(this.logger.debug(`connection state changed to ${b}`),this.connectionState=b,b==="connected"&&(this.connected=!0,this.emit("connected")),b==="disconnected"&&(this.connected=!1,this.emit("disconnect")),(b==="failed"||b==="closed")&&(this.connected=!1,this.emit("close")),this.closed||this.safeEmit("connectionstatechange",b))}),this.handler.on("@icecandidate",({candidate:b})=>{this.closed||this.safeEmit("icecandidate",b)}),this.handler.on("dc_open",b=>{let x=this.datachannels.get(b.label);x||(x||(x=new M4(L(this,f_),b,b.label,this.serverId),this.datachannels.set(b.label,x)),this.eventsDCFailureTimer=setTimeout(()=>{b.label==="events"&&(this.eventsDCReadyPromiseResolver(!1),this.safeEmit("dc_error",b.label))},5e3))}),this.handler.on("datachannel",(b,x)=>{b.label==="events"&&(this.eventsDCReadyPromiseResolver(!0),this.eventsDCFailureTimer&&clearTimeout(this.eventsDCFailureTimer));const w=this.datachannels.get(b.label);if(!w){this.logger.error("unregistered datachannel for message",{rtcChannel:{label:b.label,message:x}});return}try{const k=JSON.parse(x);this.logger.debug("datachannel message chunk recieved",{dataChannelMessageChunk:{id:k.id,count:k.count,chunkIndex:k.chunkIndex,chunk:k.chunk,transprtId:this.serverId}});const S=w.processMessage(k);if(!S)return;this.logger.debug(`datachannel message with id:${k.id} on transport:${this.serverId}complete - ${JSON.stringify(S)}`),this.emit(`datachannel:${b.label}`,w.label,S)}catch(k){this.logger.error("error parsing message",{error:k})}})}get closed(){return this.connectionState==="closed"}setServerId(e){this.serverId=e}getDatachannel(e){return this.datachannels.get(e)}get isEventsDCReady(){return this.eventsDCReadyPromise}close(){this.closed||(this.logger.debug("Transport close called"),this.connectionState="closed",this.awaitQueue.stop(),this.awaitQueue=void 0,this.connected=!1,this.handler.close(),Array.from(this.producers.values()).forEach(e=>{e.close(s6).catch(()=>{})}),this.producers.clear(),Array.from(this.consumers.values()).forEach(e=>{e.close(s6)}),this.consumers.clear(),this.consumerTrackEvents.clear(),this.emit("close"))}getStats(){return me(this,null,function*(){if(this.closed)throw new yf("closed");return this.handler.getTransportStats()})}connect(e){return me(this,null,function*(){try{if(yield this.awaitQueue.push(()=>me(this,null,function*(){const{offerSdp:n,callback:r}=yield this.handler.connect(),{transportId:s,answer:i}=yield e(n);this.setServerId(s),yield r(i)})),!(yield this.transportConnectionPromise))throw new Error("ice connection failed")}catch(n){throw this.logger.error("transport failed to connect:",{error:n}),n}})}restartIce(){return me(this,null,function*(){if(this.logger.debug("restartIce()"),this.closed)throw new yf("closed");return this.handler.restartIce()})}canProduce(e){return me(this,null,function*(){const{track:n,appData:r}=e;if(n){if(this.direction!=="send")throw new r6("not a sending Transport");if(n.readyState==="ended")throw new yf("track ended");if(r&&typeof r!="object")throw new TypeError("if given, appData must be an object")}else throw new TypeError("missing track");if(!(yield this.transportConnectionPromise))throw new i1("transport not connected");return!0})}produce(e,n){return me(this,null,function*(){if(!(yield this.canProduce(e)))throw new Error("Cannot produce");const{track:r,encodings:s,codecOptions:i,stopTracks:o=!0,disableTrackOnPause:l=!0,zeroRtpOnPause:c=!1,appData:d={}}=e;this.logger.debug(`produce() [track:${r.id}]`);const{producerId:u,localId:h,rtpSender:m}=yield this.awaitQueue.push(()=>me(this,null,function*(){const{offerSdp:f,callback:p,sender:g,mid:v}=yield this.handler.send({track:r,encodings:s,codecOptions:i,screenShare:d==null?void 0:d.screenShare}),{answer:b,producerId:x}=yield n({offer:f,kind:r.kind,paused:l?!r.enabled||Object.hasOwn(r,"fakeTracks"):!1,appData:Dr(en({},d||{}),{mid:v}),codecOptions:i,producingTransportId:this.serverId}),w=yield p(b);return{producerId:x,localId:w,rtpSender:g}}),"Transport.produce");return this.createProducerObject({id:u,localId:h,track:r,stopTracks:o,disableTrackOnPause:l,zeroRtpOnPause:c,appData:d,handler:this.handler,rtpSender:m})})}createProducerObject(e){return me(this,null,function*(){const n=new NNn(L(this,f_),e);return this.producers.set(n.id,n),n.once("close",()=>{this.producers.delete(n.id)}),this.emit("newproducer",n),n})}closeProducer(e){return me(this,null,function*(){yield this.awaitQueue.push(e.close.bind(e),"Transport.closeProducer")})}canConsume(){return me(this,null,function*(){if(this.closed)throw new yf("closed");if(this.direction!=="recv")throw new r6("not a receiving transport");if(!(yield this.transportConnectionPromise))throw new i1("transport not connected");return!0})}consume(e,n,r){return me(this,null,function*(){return this.awaitQueue.push(()=>me(this,null,function*(){const s={},{consumerStates:i,sessionDescription:o,failedProducers:l}=yield n(e);i.forEach((d,u)=>{s[u]=this.createConsumerObjectAndWaitForTrack(Dr(en({},d),{producerId:u}))}),o&&(this.logger.info("Session description found, sending negotiation request"),yield r(o));const c=[];return yield Promise.all(Object.entries(s).map(([d,u])=>u.then(h=>c.push(h)).catch(()=>{this.logger.error(`Failed to create consumer object, producer: ${d}`,{error:{message:"This should not happen"},transport:{serverId:this.serverId}})}))),{consumers:c,failedProducers:l}}),"Transport.consume",{producersLength:e.length})})}static parseCodecAndFmtpMappings(e,n){const r=XC(e.sdp),s={};return r.media.forEach(i=>{n.includes(i.mid.toString())&&(s[i.mid.toString()]={rtp:i.rtp,fmtp:i.fmtp,payloads:i.payloads,rtcpFb:i.rtcpFb})}),s}static setCodecAndFmtpMappings(e,n,r){const s=XC(e.sdp);return s.media=s.media.map(i=>{if(n.includes(i.mid.toString())){const o=en({},i);return o.rtp=r[i.mid.toString()].rtp,o.fmtp=r[i.mid.toString()].fmtp,o.payloads=r[i.mid.toString()].payloads,o.rtcpFb=r[i.mid.toString()].rtcpFb,o}return i}),Dr(en({},e),{sdp:DG(s)})}static parseHeaderExtensionMappings(e){const n=XC(e.sdp),r={};return n.media.forEach(s=>{r[s.mid]=s.ext}),r}static setHeaderExtensionMappings(e,n){const r=XC(e.sdp);return r.media=r.media.map(s=>{const i=en({},s);return i.ext=n[s.mid],i}),Dr(en({},e),{sdp:DG(r)})}closeConsumers(e,n){return me(this,null,function*(){try{const r=e.map(c=>c.transceiver.mid),s=L4.parseCodecAndFmtpMappings(this.handler.pc.remoteDescription,r),i=L4.parseHeaderExtensionMappings(this.handler.pc.remoteDescription);this.logger.info("Stopping transceivers",{consumerIds:e.map(({id:c})=>c)}),e.forEach(c=>c.close(void 0,!0));let o=yield this.handler.pc.createOffer();this.logger.info("[SDP] Created offer for closing consumers",{sdp:o.sdp}),o=L4.setCodecAndFmtpMappings(o,r,s),o=L4.setHeaderExtensionMappings(o,i),this.logger.info("[SDP] Updated codec and fmtp mappings in close consumer offer",{sdp:o.sdp}),yield this.setLocalDescription(o),this.logger.info("Successfully set local description in close consumers");const l=yield n(e,o);this.logger.info("[SDP] Received answer in close consumers",{sdp:l.sdp}),yield this.setRemoteDescription(l),this.logger.info("[SDP] Remote description was set successfully in close consumers",{sdp:l.sdp})}catch(r){this.logger.error("Failed to close consumers",{error:r})}})}setRemoteOffer(e){return me(this,null,function*(){try{this.logger.info("[SDP] Received offer from SFU",{sdp:e.sdp}),yield this.setRemoteDescription(e);const n=yield this.handler.pc.createAnswer();this.logger.info("[SDP] Created answer corresponding to received offer",{sdp:n.sdp});const r=XC(n.sdp);return r.media=r.media.map(s=>{if(s.type==="audio"){const i=en({},s),o=i.fmtp.find(l=>l.payload===111);return o&&(o.config+=";stereo=1;sprop-stereo=1"),i.rtcpFb||(i.rtcpFb=[]),i.rtcpFb.some(l=>l.type==="nack")||i.rtcpFb.push({payload:parseInt(i.payloads,10),type:"nack"}),i}return s}),n.sdp=DG(r),this.logger.info("[SDP] Setting munged SDP",{sdp:n.sdp}),yield this.setLocalDescription(n),this.logger.info("[SDP] Successfully set local description",{sdp:n.sdp}),n}catch(n){throw this.logger.error("Set remote offer failed",{error:n}),n}})}_ontrack(e){const{track:n,transceiver:r}=e;this.logger.info(`track event received [trackId: ${n.id}] [mid: ${r.mid}]`);const s=`${r.mid}:${n.kind}`;n.addEventListener("ended",()=>{this.logger.info(`rtc consumer track ended [trackId: ${n.id}]`),this.unknownTracksMap.delete(s)});const i=this.consumerTrackEvents.get(s);i?(i(n,r),this.consumerTrackEvents.delete(s)):(this.logger.warn(`track event handler not found ${s}`),this.unknownTracksMap.set(s,e))}sendErrorOverDC(e,n,r){const s=this.getDatachannel(e);if(!s)throw new Error("datachannel not found",{cause:{code:"DC_NOT_FOUND",values:{label:e}}});s.respond(n,r,!0)}sendResponseOverDC(e,n,r){const s=this.getDatachannel(e);if(!s)throw new Error("datachannel not found",{cause:{code:"DC_NOT_FOUND",values:{label:e}}});s.respond(n,r)}createConsumerObjectAndWaitForTrack(e){return me(this,null,function*(){const{consumerId:n,producerId:r,producingPeerId:s,producingTransportId:i,streamId:o,paused:l,screenShare:c,appData:d,kind:u,mimeType:h}=e,m=`${o}:${u}`,f=Dr(en({},e),{name:"consumer creation task error",message:"consumer creation failed"});return new Promise((p,g)=>me(this,null,function*(){const v=setTimeout(()=>{this.logger.warn(`Timed out waiting for track event ${m} producingPeerId: ${s}`),this.consumerTrackEvents.delete(m),f.isTimedout=!0,g(f)},5e3),b=(w,k)=>{try{if(w.readyState==="ended")clearTimeout(v),g(f);else{const S=w;S.enabled=!0,this.handler.midTransceiverMap.set(k.mid,k);const C=new ENn(L(this,f_),{id:n,localId:k.mid,transceiver:k,track:S,paused:l,producerId:r,producingPeerId:s,producingTransportId:i,handler:this.handler,appData:Dr(en({},d),{screenShare:c,peerId:s}),rtpReceiver:k.receiver,mimeType:h});this.consumers.set(n,C),C.once("close",()=>{this.consumers.delete(C.id),this.handler.midTransceiverMap.delete(k.mid)}),this.logger.info("consumer created for ",{consumer:{id:n,kind:u,appData:{screenShare:c},peerId:s,producerId:r}}),this.emit("newconsumer",C),clearTimeout(v),p(C)}}catch(S){this.logger.warn("error while creating consumer:",S),clearTimeout(v),g(f)}},x=this.unknownTracksMap.get(m);x?(this.logger.info(`track event already received [trackId: ${x.track.id}] [mid: ${x.transceiver.mid}]`),this.unknownTracksMap.delete(m),b(x.track,x.transceiver)):(this.logger.info(`Registering onTrack handler for key ${m} [producingPeerId: ${s}]`),this.consumerTrackEvents.set(m,b))}))})}setRemoteDescription(e){return me(this,null,function*(){yield this.handler.pc.setRemoteDescription(e)})}setLocalDescription(e){return me(this,null,function*(){this.logger.debug(`[SDP] ${this.direction}() {transportId: ${this.serverId}} | calling pc.setLocalDescription() [offer:${JSON.stringify(e)}]`),yield this.handler.pc.setLocalDescription(e)})}sendDataChannelMessage(e,n){return me(this,null,function*(){const r=this.getDatachannel(e);if(!r)throw xNn("DC_NOT_READY",`${e} datachannel not ready`);const s=(yield r.request(n)).payload;return this.logger.info(`sendDataChannelMessage::response ${JSON.stringify(s)}`),s})}};let ANn=L4;f_=new WeakMap;function PNn(t){if(typeof navigator=="object"&&navigator.product==="ReactNative"){if(typeof RTCPeerConnection>"u"){t.warn("Device::this._detectDevice() | unsupported ReactNative without RTCPeerConnection");return}return t.debug("Device::this._detectDevice() | ReactNative handler chosen"),"Chrome74"}if(typeof navigator=="object"&&typeof navigator.userAgent=="string"){const e=navigator.userAgent,n=Umt.getParser(e),r=n.getEngine();if(n.satisfies({chrome:">=74",chromium:">=74","microsoft edge":">=88"}))return"Chrome74";if(n.satisfies({chrome:">=55",chromium:">=55"}))return;if(n.satisfies({firefox:">=110"}))return"Firefox110";if(n.satisfies({firefox:">=60"}))return"Firefox60";if(n.satisfies({ios:{OS:">=14.3",firefox:">=30.0"}})||n.satisfies({safari:">=12.0"})&&typeof RTCRtpTransceiver<"u"&&RTCRtpTransceiver.prototype.hasOwnProperty("currentDirection"))return"Safari12";if(n.satisfies({safari:">=11"})||n.satisfies({"microsoft edge":">=11"})&&n.satisfies({"microsoft edge":"<=18"}))return;if(r.name&&r.name.toLowerCase()==="blink"){const s=e.match(/(?:(?:Chrome|Chromium))[ /](\w+)/i);return s?Number(s[1])>=74?"Chrome74":void 0:"Chrome74"}if(r.name.toLowerCase()==="webkit"&&n.getOS().name.toLowerCase()==="ios")return typeof RTCRtpTransceiver<"u"&&RTCRtpTransceiver.prototype.hasOwnProperty("currentDirection")?"Safari12":void 0;t.warn("Device::this._detectDevice() | browser not supported");return}t.warn("Device::this._detectDevice() | unknown device")}var Pw,p_;class RNn{constructor(e,{handlerName:n,handlerFactory:r}={}){xe(this,"handlerFactory"),Se(this,Pw,void 0),Se(this,p_,void 0);const s=e.getValue("logger");if(s.debug("constructor()"),Te(this,Pw,e),Te(this,p_,s),n&&r)throw new TypeError("just one of handlerName or handlerInterface can be given");if(r)this.handlerFactory=r;else{if(n)L(this,p_).debug(`Device::constructor() | handler given: ${n}`);else if(n=PNn(L(this,p_)),n)L(this,p_).debug(`Device::constructor() | detected handler: ${n}`);else throw new Error("device not supported");switch(n){case"Chrome74":this.handlerFactory=bEe.createFactory(L(this,Pw));break;case"Safari12":this.handlerFactory=xEe.createFactory(L(this,Pw));break;case"Firefox60":this.handlerFactory=KY.createFactory(L(this,Pw),{supportsSendEncodings:!1});break;case"Firefox110":this.handlerFactory=KY.createFactory(L(this,Pw),{supportsSendEncodings:!0});break;default:throw new TypeError(`unknown handlerName "${n}"`)}}}createTransport(e){const n=pR();return new ANn(L(this,Pw),Dr(en({id:n},e),{handlerFactory:this.handlerFactory}))}}Pw=new WeakMap,p_=new WeakMap;const INn=2e3;var VD,gu,vu,iW,aW,WA,HD,oW,D4,g_,Vb,GD,lW,cW,Mve,Lve,ugt,dW,Dve,$ve,PFe,Ove,RFe,Fve,IFe,Bve,MFe,Uve,LFe,uW,ice,hW,ace;class MNn extends Zd.EventEmitter{constructor(e,n){super(),Se(this,GD),Se(this,cW),Se(this,Lve),Se(this,dW),Se(this,$ve),Se(this,Ove),Se(this,Fve),Se(this,Bve),Se(this,Uve),Se(this,uW),Se(this,hW),xe(this,"context"),Se(this,VD,void 0),Se(this,gu,void 0),Se(this,vu,void 0),Se(this,iW,void 0),Se(this,aW,void 0),Se(this,WA,void 0),Se(this,HD,void 0),Se(this,oW,void 0),Se(this,D4,{transportFailureCount:{send:0,recv:0},lastConnectionTime:0}),Se(this,g_,void 0),Se(this,Vb,"all"),this.context=e,Te(this,WA,n),Te(this,VD,new RNn(e)),Te(this,HD,new CNn(n)),Te(this,oW,tg),L(this,GD,lW).mediaState={send:{state:Lk.NEW},recv:{state:Lk.NEW}},bR(this.context,"forceRelay")&&Te(this,Vb,"relay"),this.logger.info(`ICE Transport Policy initially set to ${L(this,Vb)}`),In(this,cW,Mve).call(this)}get telemetry(){return this.context.getValue("telemetry")}get logger(){return this.context.getValue("logger")}get socket(){return L(this,WA)}get socketHandler(){return L(this,HD)}get sendTransport(){return L(this,gu)}get recvTransport(){return L(this,vu)}get events(){return L(this,oW)}set sendTransportConnectedCallback(e){Te(this,iW,e)}set recvTransportConnectedCallback(e){Te(this,aW,e)}setupTransports(e){return me(this,null,function*(){yield In(this,Lve,ugt).call(this,e);let n,r;e.send&&(n=In(this,dW,Dve).call(this,L(this,gu)).then(s=>{try{L(this,iW).call(this,s)}catch{this.logger.error("Failed to run send transport callback")}})),e.recv&&(r=In(this,dW,Dve).call(this,L(this,vu)).then(s=>{try{L(this,aW).call(this,s)}catch{this.logger.error("Failed to run recv transport callback")}})),yield Promise.all([n,r])})}stopTransports(e){var n,r;if(e.send&&this.sendTransport!==void 0){const{id:s,serverId:i,direction:o}=L(this,gu);this.logger.info("Closing send transport",{transport:{id:s,serverId:i,type:o}}),L(this,gu).close(),L(this,gu).removeAllListeners(),Te(this,gu,void 0)}if(e.recv&&this.recvTransport!==void 0){const{id:s,serverId:i,direction:o}=L(this,vu);this.logger.info("Closing recv transport",{transport:{id:s,serverId:i,type:o}}),(n=L(this,vu))==null||n.close(),(r=L(this,vu))==null||r.removeAllListeners(),Te(this,vu,void 0)}In(this,cW,Mve).call(this)}stopAllTransports(){this.logger.info("Closing all transports"),this.stopTransports({send:!0,recv:!0})}handleErrors(e){throw new Error("Method not implemented.")}}VD=new WeakMap,gu=new WeakMap,vu=new WeakMap,iW=new WeakMap,aW=new WeakMap,WA=new WeakMap,HD=new WeakMap,oW=new WeakMap,D4=new WeakMap,g_=new WeakMap,Vb=new WeakMap,GD=new WeakSet,lW=function(){return this.context.getValue("connectionHandler")},cW=new WeakSet,Mve=function(){Te(this,g_,{send:void 0,recv:void 0})},Lve=new WeakSet,ugt=function(t){return me(this,null,function*(){var e,n,r,s,i,o,l,c;bR(this.context,"forceRelay")&&Te(this,Vb,"relay"),this.logger.info(`ICE Transport Policy set to ${L(this,Vb)}`);const d=yield dh().getICEServers().catch(u=>(this.logger.warn(`failed to get iceservers from server: ${u.message}`),[]));t.send&&In(this,Ove,RFe).call(this,{iceServers:d,additionalSettings:{encodedInsertableStreams:(e=this.context.getValue("modules").e2ee)==null?void 0:e.enabled},config:{enableHighBitrate:(s=(r=(n=this.context.getValue("defaults").mediaConfiguration)==null?void 0:n.audio)==null?void 0:r.enableHighBitrate)!=null?s:!1,enableStereo:(l=(o=(i=this.context.getValue("defaults").mediaConfiguration)==null?void 0:i.audio)==null?void 0:o.enableStereo)!=null?l:!1,enableDtx:!1},iceTransportPolicy:L(this,Vb)}),t.recv&&In(this,Fve,IFe).call(this,{iceServers:d,additionalSettings:{encodedInsertableStreams:(c=this.context.getValue("modules").e2ee)==null?void 0:c.enabled},iceTransportPolicy:L(this,Vb)})})},dW=new WeakSet,Dve=function(t){return me(this,null,function*(){const{id:e,serverId:n,direction:r}=t;In(this,Bve,MFe).call(this,t);try{return yield ogt((s,i)=>me(this,null,function*(){s>0&&this.logger.debug(`Retrying transport connect, count: ${s}`,{transport:{id:e,serverId:n,type:r}});try{if(t.closed)throw new i1("Cannot reconnect closed transport");yield In(this,$ve,PFe).call(this,t)}catch(o){if(o instanceof i1){i(o);return}throw this.logger.error("Failed to connect transport, retrying",{transport:t,error:o}),o}}),{delayTime:100,strategy:"exponential",maxRetryCount:15}),t}catch(s){throw this.logger.error(`Failed to connect send transport after retry: ${t.id}`,{error:s,transport:{id:e,serverId:n,type:r}}),t.close(),t.removeAllListeners(),s}})},$ve=new WeakSet,PFe=function(t){return me(this,null,function*(){const{id:e,direction:n}=t;if(this.logger.info(`Connecting ${n} transport`,{transport:{id:e,type:n}}),!L(this,WA).isConnected)throw new i1("Socket is not connected");if(t.connectionState==="closed")throw new i1("Transport is closed");try{yield t.connect(r=>In(this,Uve,LFe).call(this,n,r)),this.logger.info(`Connected ${n} transport`,{transport:{id:e,serverId:t.serverId,type:n}})}catch(r){throw L(this,D4).transportFailureCount[n]+=1,r.message==="ice connection failed"?new i1(r.message):r}})},Ove=new WeakSet,RFe=function(t){var e,n;if(L(this,gu)&&L(this,gu).connected){this.logger.info("Transport send is already connected",{transport:{id:(e=L(this,gu))==null?void 0:e.id,serverId:(n=L(this,gu))==null?void 0:n.serverId,type:"send"}});return}Te(this,gu,L(this,VD).createTransport(Dr(en({},t),{direction:"send"}))),this.context.getValue("callstats").configureSendTransport(L(this,gu))},Fve=new WeakSet,IFe=function(t){var e,n;if(L(this,vu)&&L(this,vu).connected){this.logger.info("Transport recv is already connected",{transport:{id:(e=L(this,vu))==null?void 0:e.id,serverId:(n=L(this,vu))==null?void 0:n.serverId,type:"recv"}});return}Te(this,vu,L(this,VD).createTransport(Dr(en({},t),{direction:"recv"}))),this.context.getValue("callstats").configureRecvTransport(L(this,vu))},Bve=new WeakSet,MFe=function(t){const{direction:e,id:n}=t;t.on("connectionstatechange",r=>me(this,null,function*(){In(this,hW,ace).call(this,{state:r,direction:e}),this.logger.info(`Transport connection state changed for ${e} transport`,{transport:{id:n,serverId:t.serverId,type:e,status:r}});const s=()=>{const i=L(this,g_)[e];i!==void 0&&(clearTimeout(i),L(this,g_)[e]=void 0)};switch(r){case"connected":s(),L(this,D4).lastConnectionTime=performance.now();break;case"disconnected":L(this,g_)[e]=setTimeout(()=>me(this,null,function*(){this.logger.warn(`${e} transport is in disconnected state, reconnecting transport`,{transport:{id:n,serverId:t.serverId,type:e}}),yield In(this,uW,ice).call(this,t.direction)}),INn);break;case"failed":if(t.closed)return;s(),this.logger.warn(`${e} transport is in failed state, reconnecting transport`,{transport:{id:n,serverId:t.serverId,type:e}}),yield In(this,uW,ice).call(this,t.direction);break}})),t.on("icecandidate",r=>me(this,null,function*(){this.logger.debug("Sending iceCandidate:",{iceCandidate:r})})),t.on("datachannel:events",(r,s)=>me(this,null,function*(){var i,o;this.logger.debug("Got data channel message on event:",{rtcChannel:{label:r,message:s}});try{switch(s.type){case"handshake":{const l={type:"handshake",payload:{message:"pong"}};t.sendResponseOverDC(r,_Nn(s),l);break}case"hub-disconnect":{this.logger.debug(`media hub disconnected, full_reconnect: ${(i=s.payload)==null?void 0:i.full_reconnect}`),((o=s.payload)==null?void 0:o.full_reconnect)===!0&&this.handleErrors("rejoin");break}case"error":break;default:break}}catch{this.logger.error(`Unable to handle the incoming datachannel message on channel ${r}`)}})),t.on("dc_error",()=>{t.direction==="recv"&&(this.logger.warn("Events datachannel did not open in 5s"),this.handleErrors("reconnectRecvTransport"))})},Uve=new WeakSet,LFe=function(t,e){return me(this,null,function*(){const n=t==="recv";try{const{sdp:r,type:s}=e,i={consuming:n,description:{sdp:r,type:s,target:n?t0.SUBSCRIBER:t0.PUBLISHER},producers:[]};return L(this,HD).connectTransport(i)}catch(r){throw this.logger.error(`Error in ${t} transport connection:`,{error:r}),r}})},uW=new WeakSet,ice=function(t){return me(this,null,function*(){switch(this.logger.info("Called reconnect transport",{transport:{type:t}}),this.stopTransports({[t]:!0}),L(this,WA).isConnected&&L(this,D4).transportFailureCount[t]>2&&(this.logger.warn(`Multiple disconnections in ${t} transport, forcing relay`),Te(this,Vb,"relay")),yield this.setupTransports({[t]:!0}),t){case"send":{this.logger.info("Transport reconnected",{transport:L(this,gu)}),this.context.getValue("peerSessionStore").emit(Et.RESET_PRODUCER_STATE);break}case"recv":{this.logger.info("Transport reconnected",{transport:L(this,vu)}),this.context.getValue("peerSessionStore").emit(Et.UPDATE_ACTIVE,{createAllConsumers:!0});break}default:this.logger.warn("Unknown transport direction",{transport:{type:t}})}In(this,hW,ace).call(this,{state:Lk.CONNECTED,direction:t})})},hW=new WeakSet,ace=function(t){const{state:e,direction:n}=t;L(this,GD,lW).mediaState[n]={state:e},this.context.getValue("peerSessionStore").emit(Et.TRANSPORT_STATE_UPDATE,en({transport:n},L(this,GD,lW).mediaState[n]))};var zve,Rp;class LNn{constructor(e,n,r,s,i){Se(this,zve,void 0),Se(this,Rp,void 0),this.events=n,this.recvTransport=r,this.socket=s,this.socketHandler=i,Te(this,zve,e),Te(this,Rp,e.getValue("logger"))}create(e){return me(this,null,function*(){if(!e||e&&e.length===0)throw new Error("List of producers is required");const n=new Map,r=[];e.forEach(c=>{const{producingPeerId:d,producerId:u,producingTransportId:h}=c,m={simulcast:{preferredRid:"f",priorityOrdering:"asciibetical",ridNotAvailable:"asciibetical"}};n.set(u,d),r.push(en({producingPeerId:d,producerId:u,producingTransportId:h},m))});const s=yield this.socketHandler.consume({requests:r,consumingTransportId:this.recvTransport.serverId}),i=new Map;e.forEach(c=>i.set(c.producerId,c));const o=new Map,l=[];return Object.entries(s.consumerStateMap).forEach(([c,d])=>{const u=i.get(c);if(!u)return;if(d.errorCode){L(this,Rp).warn(`Consumer request failed for producer ${c}`,{error:{message:d.errorCode}}),l.push(Dr(en({},u),{errorCode:d.errorCode}));return}let h={};try{h=JSON.parse(d.producerState.appData)}catch{}o.set(c,{consumerId:d.consumerId,producingTransportId:u.producingTransportId,producingPeerId:u.producingPeerId,kind:u.kind,paused:u.pause,streamId:d.producerTrack.streamId,trackId:d.producerTrack.trackId,screenShare:u.screenShare,mimeType:u.mimeType,appData:h})}),{consumerStates:o,sessionDescription:s.sessionDescription,failedProducers:l}})}negotiate(e){return me(this,null,function*(){try{L(this,Rp).info("Negotiating socket consumer",{transport:this.recvTransport}),L(this,Rp).debug(`[SDP] setting remote offer: ${JSON.stringify(e)} on recvTransport`,{transport:this.recvTransport});const n=yield this.recvTransport.setRemoteOffer(e),r={transportId:this.recvTransport.serverId,description:{sdp:n.sdp,type:n.type,target:t0.SUBSCRIBER}};return L(this,Rp).debug(`sending renegotiate request: ${JSON.stringify(r)} on recvTransport`,{transport:this.recvTransport}),yield this.socket.sendMessagePromise(this.events.renegotiateSessionDescription,$wn.toBinary(r)),L(this,Rp).info("Renegotiation done",{transport:this.recvTransport}),n}catch(n){L(this,Rp).error("Failed to renegotiate",{error:n});return}})}close(e){return me(this,null,function*(){if(!e.length)return{};const n=(r,s)=>me(this,null,function*(){const i=r.map(d=>d.localId);L(this,Rp).info(`Closing consumers: ${JSON.stringify(i)}`);const o={description:{sdp:s.sdp,type:s.type,target:t0.SUBSCRIBER},consumerIds:i,consumingTransportId:this.recvTransport.serverId},l=yield this.socketHandler.closeConsumer(o),c=dkn.fromBinary(l).description;return{sdp:c.sdp,type:c.type}});return yield this.recvTransport.awaitQueue.push(()=>this.recvTransport.closeConsumers(e,n),"ConsumerStrategy.close",{consumersLength:e.length}),{}})}switchConsumersToLayer(e,n){return me(this,null,function*(){const r={requests:[],consumingTransportId:this.recvTransport.serverId},s=e.filter(i=>i&&i.id);s.forEach(({id:i,producingTransportId:o,localId:l})=>{r.requests.push({producerId:i,producingTransportId:o,mid:l,simulcast:{preferredRid:n===0?"q":"h",priorityOrdering:"asciibetical",ridNotAvailable:"asciibetical"}})}),yield this.socketHandler.updateConsumersSimulcastConfig(r),L(this,Rp).info(`Consumers switched layers to ${n}`,{consumerIds:s==null?void 0:s.map(({id:i})=>i)})})}}zve=new WeakMap,Rp=new WeakMap;class wEe{constructor(e){this.socketHandler=e}static getMSIDFromSDP(e,n){return XC(e).media.filter(r=>n==="video"?r.type==="video":r.type==="audio").at(-1).msid}create(e){return me(this,arguments,function*({offer:n,kind:r,paused:s,appData:i,codecOptions:o,producingTransportId:l}){var c,d;const u=wEe.getMSIDFromSDP(n.sdp,r),h={description:{sdp:n.sdp,type:n.type,target:t0.PUBLISHER},paused:s,kind:r,msid:u,appData:JSON.stringify(i),screenShare:(c=i.screenShare)!=null?c:!1,mimeType:`${r}/${(d=o[0])==null?void 0:d.name}`,producingTransportId:l},{answer:m,producerId:f}=yield this.socketHandler.produce(h);return{answer:m,producerId:f}})}}var rj,kj,$4,YY,Xb,Vve,o1,WD,QY,Hve,Gve,hgt,Wve,mgt,qve,DFe,Kve,$Fe;class DNn extends MNn{constructor(e,n){super(e,n),Se(this,QY),Se(this,Gve),Se(this,Wve),Se(this,qve),Se(this,Kve),Se(this,rj,void 0),Se(this,kj,void 0),Se(this,$4,void 0),Se(this,YY,void 0),Se(this,Xb,void 0),Se(this,Vve,{producerCreationFailureCount:0,consumerCreationFailureCount:0,producerNotReadyFailureCount:0}),Se(this,o1,[]),Se(this,WD,void 0),this.context=e,this.sendTransportConnectedCallback=()=>me(this,null,function*(){Te(this,YY,new wEe(this.socketHandler))}),this.recvTransportConnectedCallback=r=>me(this,null,function*(){L(this,$4).clear(),Te(this,Xb,new LNn(this.context,this.events,r,this.socket,this.socketHandler))}),this.reset()}get socketHandler(){return super.socketHandler}get producers(){return L(this,rj)}get consumers(){return L(this,kj)}get producerIdToConsumerIdMap(){return L(this,$4)}get logger(){return this.context.getValue("logger")}reset(){Te(this,rj,new Map),Te(this,kj,new Map),Te(this,$4,new Map)}createProducer(e,n){return me(this,null,function*(){var r,s;if(!this.sendTransport||this.sendTransport.closed)throw new Error("Send transport is closed");try{const i=yield this.sendTransport.produce(e,In(this,Gve,hgt).bind(this));return(r=e.appData)!=null&&r.e2ee&&this.context.getValue("peerSessionStore").emit(Et.E2EE_ACTIVE_PRODUCER,i),In(this,Wve,mgt).call(this,i,n),i}catch(i){throw this.logger.error(`Failed to create ${((s=e==null?void 0:e.track)==null?void 0:s.kind)||"unknown"} producer`,{error:i}),L(this,Vve).producerCreationFailureCount+=1,i}})}closeProducer(e,n){return me(this,null,function*(){var r;const s=this.producers.get(e);if(!s){this.logger.warn(`Producer with ID ${e} was not found`);return}n!=null&&n.stopTrack&&s.track.stop();try{yield this.sendTransport.closeProducer(s),(r=this.context.getValue("modules").e2ee)!=null&&r.enabled&&this.context.getValue("peerSessionStore").emit(Et.E2EE_INACTIVE_PRODUCER,s)}catch(i){this.logger.error("Failed to close producer on server",{error:i,producer:s})}})}closeAllProducers(){return Promise.all(Array.from(L(this,rj).entries()).map(([,e])=>e.close()))}closeAllProducersLocally(){return me(this,null,function*(){var e;const n=(e=this.sendTransport)==null?void 0:e.handler;yield Promise.all(Array.from(L(this,rj).values()).map(r=>me(this,null,function*(){try{if(n){const s=n.midTransceiverMap.get(r.localId);s&&(yield s.sender.replaceTrack(null),s.direction="inactive")}}catch(s){this.logger.warn("closeAllProducersLocally: failed to deactivate transceiver",{producer:{id:r.id,kind:r.kind,appData:r.appData},error:s})}yield r.close(s6)})))})}createConsumer(e){return this.createConsumers([e])}createConsumers(e){return me(this,null,function*(){L(this,WD)||clearTimeout(L(this,WD)),Te(this,o1,L(this,o1).concat(e)),yield In(this,QY,Hve).call(this)})}closeConsumer(e){return this.closeConsumers([e])}closeConsumers(e){return me(this,null,function*(){if(!L(this,Xb))return;const n=e.map(s=>this.consumers.get(s)).filter(s=>s!==void 0);if(n.length===0)return;const{failedConsumers:r}=yield L(this,Xb).close(n);r!=null&&r.length&&this.logger.warn("Failed to close some consumers",{consumerIds:r})})}closeAllConsumers(){return this.closeConsumers(Array.from(L(this,kj).keys()))}switchConsumersToLayer(e,n){return me(this,null,function*(){L(this,Xb).switchConsumersToLayer(e,n)})}}rj=new WeakMap,kj=new WeakMap,$4=new WeakMap,YY=new WeakMap,Xb=new WeakMap,Vve=new WeakMap,o1=new WeakMap,WD=new WeakMap,QY=new WeakSet,Hve=function(){return me(this,null,function*(){if(!this.recvTransport||this.recvTransport.closed)throw new Error("Recv transport is closed");const t=500,e=L(this,o1).splice(0,L(this,o1).length);try{const n=new Set(Array.from(this.consumers.values()).map(({producerId:o})=>o)),r=e.filter(({producerId:o})=>!this.producers.get(o)&&!n.has(o));if(r.length===0)return;const{consumers:s,failedProducers:i}=yield this.recvTransport.consume(r,In(this,qve,DFe).bind(this),L(this,Xb).negotiate.bind(L(this,Xb)));if(s.forEach(In(this,Kve,$Fe).bind(this)),i!=null&&i.length){this.logger.error("Failed to create consumers for producers",{producers:i});const o=i.filter(({errorCode:l,producerId:c})=>l==="not_found_track_error"?(this.logger.error(`Track not found for producer: ${c}. This will not be retried.`),!1):l==="backend_error"?(this.logger.error("Unrecoverable error: backend error"),!1):!0);Te(this,o1,L(this,o1).concat(o)),Te(this,WD,setTimeout(In(this,QY,Hve).bind(this),t))}}catch(n){if(this.logger.error("failed to consume on transport",{error:n}),n.errorCode==="internal_error"&&n.errorDescription==="Backend error"||n.errorCode==="invalid_session_description"){this.logger.error("Irrecoverable error, closing current recvTransport to create a new one",{transport:this.recvTransport,error:{code:n.errorCode,message:n.errorDescription}});try{this.stopTransports({recv:!0})}catch{}yield this.setupTransports({recv:!0})}}})},Gve=new WeakSet,hgt=function(t){return L(this,YY).create(t)},Wve=new WeakSet,mgt=function(t,e){t.on("close",(n,r)=>me(this,null,function*(){const{offer:s,reason:i}=n;if(this.logger.info("producer::closing",{debuggingHint:i,producer:Dr(en({},t),{status:"closing"})}),i!==s6){const o={producerId:t.id,description:{sdp:s.sdp,type:s.type,target:t0.PUBLISHER}};try{const l=yield this.socketHandler.closeProducer(o),c={sdp:l==null?void 0:l.sdp,type:l==null?void 0:l.type};this.logger.info("producer::closed",{producer:Dr(en({},t),{status:"closed"})}),r({answer:c})}catch(l){this.logger.error("producer close error",l)}}this.producers.delete(t.id),e()})),t.on("trackended",()=>{this.logger.info("producer::trackended",{producer:Dr(en({},t),{status:"UNKNOWN"})})}),L(this,rj).set(t.id,t)},qve=new WeakSet,DFe=function(t){return me(this,null,function*(){try{return yield this.recvTransport.canConsume(),yield L(this,Xb).create(t)}catch(e){throw this.logger.error("Error in consume request",{error:e}),e}})},Kve=new WeakSet,$Fe=function(t){t.on("close",e=>me(this,null,function*(){this.logger.debug("consumer closed",{consumer:{closureReason:e,id:t.id,kind:t.kind,appData:t.appData}}),L(this,kj).delete(t.id),this.context.getValue("peerSessionStore").emit(Et.CONSUMER_CLOSED,{id:t.id})})),L(this,kj).set(t.id,t),this.producerIdToConsumerIdMap.set(t.producerId,t.id),this.context.getValue("peerSessionStore").emit(Et.NEW_CONSUMER,{id:t.id,appData:t.appData,peerId:t.peerId})};var mW,fW,pW,O4,qD,KD,ZY,JY,F4,nm,Yv,Av,_C,AC,Kw,XY,Yve,fgt,Qve,pgt,Zve,ggt,Jve,vgt;const Xve=class{constructor({initialEnergyThreshold:t=.015,zeroCrossingThreshold:e=20,minVoiceDuration:n=3,hangoverFrames:r=5,noiseAdaptationRate:s=.95,voiceAdaptationRate:i=.99,minEnergyThreshold:o=.005,maxEnergyThreshold:l=.2,energyRatioThreshold:c=1.5,noiseHistorySize:d=50}={}){Se(this,Yve),Se(this,Qve),Se(this,mW,void 0),Se(this,fW,void 0),Se(this,pW,void 0),Se(this,O4,void 0),Se(this,qD,void 0),Se(this,KD,void 0),Se(this,ZY,void 0),Se(this,JY,void 0),Se(this,F4,void 0),Se(this,nm,void 0),Se(this,Yv,void 0),Se(this,Av,!1),Se(this,_C,0),Se(this,AC,0),Se(this,Kw,[]),Se(this,XY,void 0),Te(this,O4,t),Te(this,nm,t),Te(this,mW,e),Te(this,fW,n),Te(this,pW,r),Te(this,qD,s),Te(this,KD,i),Te(this,ZY,o),Te(this,JY,l),Te(this,F4,c),Te(this,XY,d),Te(this,Yv,t/2)}get voiceDetected(){return L(this,Av)}processAudioChunk(t){var e,n;const r=In(e=Xve,Zve,ggt).call(e,t),s=In(n=Xve,Jve,vgt).call(n,t);return In(this,Yve,fgt).call(this,r),r/L(this,Yv)>L(this,F4)&&r>L(this,nm)&&s>L(this,mW)?(Te(this,_C,L(this,_C)+1),Te(this,AC,L(this,pW)),L(this,_C)>=L(this,fW)&&Te(this,Av,!0)):(Te(this,_C,0),L(this,AC)>0?Te(this,AC,L(this,AC)-1):L(this,Av)&&Te(this,Av,!1),L(this,Av)||In(this,Qve,pgt).call(this,r)),{energy:r,isVoice:L(this,Av)}}reset(){Te(this,Av,!1),Te(this,_C,0),Te(this,AC,0),Te(this,nm,L(this,O4)),Te(this,Yv,L(this,O4)/2),Te(this,Kw,[])}getThresholdInfo(){return{currentEnergyThreshold:L(this,nm),backgroundNoiseEnergy:L(this,Yv),energyRatioThreshold:L(this,F4)}}};let eye=Xve;mW=new WeakMap,fW=new WeakMap,pW=new WeakMap,O4=new WeakMap,qD=new WeakMap,KD=new WeakMap,ZY=new WeakMap,JY=new WeakMap,F4=new WeakMap,nm=new WeakMap,Yv=new WeakMap,Av=new WeakMap,_C=new WeakMap,AC=new WeakMap,Kw=new WeakMap,XY=new WeakMap,Yve=new WeakSet,fgt=function(t){L(this,Av)?Te(this,nm,L(this,KD)*L(this,nm)+(1-L(this,KD))*t):Te(this,nm,L(this,qD)*L(this,nm)+(1-L(this,qD))*L(this,Yv)),Te(this,nm,Math.max(L(this,ZY),Math.min(L(this,JY),L(this,nm))))},Qve=new WeakSet,pgt=function(t){if(t<L(this,nm)*1.2)if(L(this,Kw).push(t),L(this,Kw).length>L(this,XY)&&L(this,Kw).shift(),L(this,Kw).length>=10){const e=[...L(this,Kw)].sort((r,s)=>r-s),n=Math.floor(e.length/2);Te(this,Yv,e[n])}else Te(this,Yv,.95*L(this,Yv)+.05*t)},Zve=new WeakSet,ggt=function(t){return Math.sqrt(t.map(e=>e*e).reduce((e,n)=>e+n)/t.length)},Jve=new WeakSet,vgt=function(t){let e=0;for(let n=1;n<t.length;n+=1)(t[n]>=0&&t[n-1]<0||t[n]<0&&t[n-1]>=0)&&(e+=1);return e},Se(eye,Zve),Se(eye,Jve);var gW;class OFe{constructor(e){xe(this,"RNAudioSampleHandler"),Se(this,gW,void 0),Te(this,gW,e);const{RNAudioSampleHandlerImpl:n}=navigator;n==null||n.init().then(r=>{this.RNAudioSampleHandler=r}).catch(r=>{this.logger.error("ReactNativeAudioSampler: Failed to initialize audio sampler",r)})}get logger(){return L(this,gW).getValue("logger")}get samples(){var e;const n=new Float32Array(1024);return(e=this.RNAudioSampleHandler)==null||e.getFloatTimeDomainData(n),n}stop(){var e;(e=this.RNAudioSampleHandler)==null||e.destructor()}}gW=new WeakMap;var vW;class FFe{constructor(e){xe(this,"audioContext"),xe(this,"analyser"),Se(this,vW,void 0),Te(this,vW,e),this.audioContext=new AudioContext,this.analyser=this.audioContext.createAnalyser(),this.analyser.fftSize=2048}get logger(){return L(this,vW).getValue("logger")}get samples(){if(this.audioContext.state==="suspended")try{this.audioContext.resume()}catch(n){this.logger.error("AudioContextSampler: Failed to resume audio context",n)}const e=new Float32Array(this.analyser.frequencyBinCount);return this.analyser.getFloatTimeDomainData(e),e}set audioTrack(e){const n=new MediaStream;n.addTrack(e),this.audioContext.createMediaStreamSource(n).connect(this.analyser)}}vW=new WeakMap;class $Nn{static setInterval(e,n=0,...r){return navigator&&navigator.RNBackgroundTimerImpl?navigator.RNBackgroundTimerImpl.setInterval(e,n,...r):global.setInterval(e,n,...r)}static clearInterval(e){return navigator&&navigator.RNBackgroundTimerImpl?navigator.RNBackgroundTimerImpl.clearInterval(e):global.clearInterval(e)}static setTimeout(e,n=0,...r){return navigator&&navigator.RNBackgroundTimerImpl?navigator.RNBackgroundTimerImpl.setTimeout(e,n,...r):global.setTimeout(e,n,...r)}static clearTimeout(e){return navigator&&navigator.RNBackgroundTimerImpl?navigator.RNBackgroundTimerImpl.clearTimeout(e):global.clearTimeout(e)}}const ONn=60,FNn=400;var Rw,Iw,l1,yW,YD,QD,PC,v_,ZD,y_,Yw,Rb,tye,ygt,bW,nye,rye,bgt,oce,BFe;const eQ=class{constructor(t,e){Se(this,tye),Se(this,rye),Se(this,Rw,void 0),Se(this,Iw,void 0),Se(this,l1,void 0),Se(this,yW,void 0),Se(this,YD,void 0),Se(this,QD,void 0),Se(this,PC,void 0),Se(this,v_,void 0),Se(this,ZD,void 0),Se(this,y_,void 0),Se(this,Yw,void 0),Se(this,Rb,void 0),this.reportRequest=e,Te(this,y_,t),Te(this,QD,new eye);const{isReactNative:n}=navigator;Te(this,Yw,n?new OFe(L(this,y_)):new FFe(L(this,y_))),Te(this,Rb,n?$Nn:Xmt)}get logger(){return L(this,y_).getValue("logger")}set producerId(t){Te(this,l1,t)}set audioTrack(t){Te(this,yW,t),L(this,Yw)instanceof FFe&&(L(this,Yw).audioTrack=t)}start(){this.logger.debug(`AudioActivityReporter: Starting audio activity reporter: ${L(this,l1)}`),L(this,Rw)&&L(this,Rb).clearInterval(L(this,Rw)),Te(this,Rw,L(this,Rb).setInterval(()=>me(this,null,function*(){var t;if(!L(this,yW)||!L(this,l1))return;const{energy:e}=In(this,tye,ygt).call(this),n=In(t=eQ,bW,nye).call(t,e);let r=.9;L(this,ZD)!==n&&L(this,ZD)?r=.9:n?r=.3:r=.5,Te(this,YD,(L(this,YD)||0)*(1-r)+e*r)}),ONn)),L(this,Iw)&&L(this,Rb).clearInterval(L(this,Iw)),Te(this,Iw,L(this,Rb).setInterval(In(this,rye,bgt).bind(this),FNn))}stop(){try{this.logger.debug(`AudioActivityReporter: Stopping audio activity reporter: ${L(this,l1)}`),L(this,Rw)&&(L(this,Rb).clearInterval(L(this,Rw)),Te(this,Rw,void 0)),L(this,Iw)&&(L(this,Rb).clearInterval(L(this,Iw)),Te(this,Iw,void 0))}catch{}L(this,QD).reset(),L(this,Yw)instanceof OFe&&L(this,Yw).stop()}};let sye=eQ;Rw=new WeakMap,Iw=new WeakMap,l1=new WeakMap,yW=new WeakMap,YD=new WeakMap,QD=new WeakMap,PC=new WeakMap,v_=new WeakMap,ZD=new WeakMap,y_=new WeakMap,Yw=new WeakMap,Rb=new WeakMap,tye=new WeakSet,ygt=function(){var t;const{samples:e}=L(this,Yw),{energy:n,isVoice:r}=L(this,QD).processAudioChunk(e),s=In(t=eQ,oce,BFe).call(t,n);return s===-1/0||n<1e-6?{energy:0,isVoice:!1}:((!L(this,PC)||s<L(this,PC))&&Te(this,PC,s),(!L(this,v_)||s>L(this,v_))&&Te(this,v_,s),{energy:(s-L(this,PC))/(L(this,v_)-L(this,PC))*10||0,isVoice:r})},bW=new WeakSet,nye=function(t){return t<5},rye=new WeakSet,bgt=function(t=L(this,YD)){var e;if(!L(this,l1)||!t)return;const n={producerId:L(this,l1),energy:Math.round(t),silent:In(e=eQ,bW,nye).call(e,t)};Te(this,ZD,n.silent),this.reportRequest(n)},oce=new WeakSet,BFe=function(t){const e=Math.log10(t);return Math.round(e)},Se(sye,bW),Se(sye,oce);var BNn=Object.defineProperty,UNn=Object.getOwnPropertyDescriptor,aa=(t,e,n,r)=>{for(var s=UNn(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&BNn(e,n,s),s},tQ,nQ,du,Ar,iye,Zu,dA,uA,b_,xW,cf,Mb,fu,Uh,Qw,sj,aye,xgt,oye,UFe,lye,zFe,rQ,cye,dye,VFe,uye,HFe,Ju,zh,x_,B4,hye,wgt,mye,kgt,fye,Sgt;class Ki{constructor(e,n){Se(this,Qw),Se(this,aye),Se(this,oye),Se(this,lye),Se(this,rQ),Se(this,dye),Se(this,uye),Se(this,Ju),Se(this,x_),Se(this,hye),Se(this,mye),Se(this,fye),xe(this,"context"),xe(this,"authToken"),xe(this,"e2ee"),Se(this,tQ,void 0),Se(this,nQ,void 0),Se(this,du,void 0),Se(this,Ar,void 0),Se(this,iye,void 0),Se(this,Zu,void 0),Se(this,dA,void 0),Se(this,uA,void 0),Se(this,b_,void 0),Se(this,xW,void 0),Se(this,cf,null),Se(this,Mb,void 0),Se(this,fu,void 0),Se(this,Uh,void 0);var r,s;this.context=e;const{socket:i}=n;this.mediaJoined=!1,Te(this,du,i),Te(this,dA,!1),Te(this,Ar,new DNn(e,i)),Te(this,Zu,L(this,Ar).events),Te(this,Mb,new Set),Te(this,fu,new Map),Te(this,uA,!1),Te(this,b_,new Nve(e.getValue("logger"))),Te(this,Uh,new sye(this.context,L(this,Ar).socketHandler.audioActivity.bind(L(this,Ar).socketHandler))),this.e2ee=(s=(r=e.getValue("modules").e2ee)==null?void 0:r.enabled)!=null?s:!1,this.handleSocketEvents(),this.handleCallstatsEvents(),Te(this,xW,sEe(()=>me(this,null,function*(){if(!L(this,Qw,sj).mediaJoinAttempted)return;const{roomJoined:o}=yield this.joinRoom(L(this,nQ),L(this,tQ),!0);o&&(this.context.getValue("peerSessionStore").emit(Et.RESET_PRODUCER_STATE),this.context.getValue("peerSessionStore").emit(Et.ROOM_NODE_RECONNECTED))}),5e3,{leading:!0,maxWait:1e3}))}get peerId(){return this.context.getValue("peerId")}get telemetry(){return this.context.getValue("telemetry")}get logger(){return this.context.getValue("logger")}get mediaJoined(){return L(this,Qw,sj).mediaJoined}set mediaJoined(e){L(this,Qw,sj).mediaJoined=e}reset({resetTransportQueue:e}){this.logger.info(`Resetting media node client: closing all transports, producers, consumers, and queues(resetTransportQueue: ${e}).`),L(this,Ar).closeAllProducers(),L(this,Ar).closeAllConsumers(),L(this,fu).clear(),L(this,Mb).clear(),Te(this,cf,null),e&&L(this,b_).stop(),L(this,Ar).stopAllTransports(),L(this,Ar).reset(),e&&Te(this,b_,new Nve)}joinRoom(e,n){return me(this,arguments,function*(r,s,i=!1,o={}){L(this,Qw,sj).mediaJoinAttempted=!0,Te(this,dA,!0);try{return yield L(this,b_).push(()=>In(this,aye,xgt).call(this,r,s,i,o),"joinRoom")}catch(l){return this.logger.error("Error in room joining process",{error:l}),this.context.getValue("peerSessionStore").emit(Et.ROOM_NODE_FAILED),{roomJoined:!1,error:l}}})}initializeConnection(e,n){return me(this,arguments,function*(r,s,i=!1,o={}){return L(this,cf)?L(this,cf):(Te(this,cf,me(this,null,function*(){try{yield In(this,rQ,cye).call(this,r,s,i,o)}catch(l){throw Te(this,cf,null),l}})),L(this,cf))})}getConsumers(){return L(this,Ar).consumers}getProducers(){return L(this,Ar).producers}leaveRoom(){return me(this,null,function*(){L(this,Ar).stopAllTransports(),Te(this,uA,!1),L(this,Qw,sj).mediaJoinAttempted=!1;const e={closeRoom:!1};L(this,du).sendMessagePromise(L(this,Zu).leaveRoom,l1n.toBinary(e)).then(n=>{var r;(r=Q1n.fromBinary(n.payload))!=null&&r.closed&&this.logger.warn("Weird state on peer closed and should not happen")}).catch(n=>{this.logger.error("error on sending leave room request",{error:n})}),this.context.getValue("callstats").callEnded(),this.context.getValue("telemetry").destruct().catch(n=>{this.logger.error("leaveRoom::telemetry_destruct_failed",{error:n})})})}activatePeers(e){return me(this,null,function*(){return this.createConsumers(e)})}createConsumers(e){return me(this,null,function*(){return e.length===0?Promise.resolve():L(this,Ar).createConsumers(e)})}closeConsumers(e){return me(this,null,function*(){if(!e.length)return;const n=e.reduce((r,s)=>{const i=L(this,Ar).producerIdToConsumerIdMap.get(s.producerId);return i?(r.push(i),r):(this.logger.warn(`consumer not found in close consumers: ${s.producerId}`),r)},[]);yield L(this,Ar).closeConsumers(n)})}_shareWebcam(e){return me(this,null,function*(){var n,r,s,i;const o=Go.WEBCAM,l=In(this,Ju,zh).call(this,o);if(l){const f=yield l;if(L(this,Ar).producers.has(f)){const p=L(this,Ar).producers.get(f);if(!p.closed)return yield p.replaceTrack({track:e}),yield this.resumeWebcam(o),e;yield this.disableWebcam()}return this._shareWebcam(e)}const c=In(this,fye,Sgt).call(this,e),d=bR(this.context,"disableSimulcast"),u=(r=(n=this.context)==null?void 0:n.getValue("overrides"))==null?void 0:r.simulcastConfig;d||u&&u.disable||!((i=(s=this.context)==null?void 0:s.getValue("theme"))!=null&&i.isSimulcastEnabled)?this.logger.info("Simulcast disabled for webcam producer, SFU: CF"):(this.logger.info("Simulcast enabled for SFU: CF"),c.encodings=jEn(this.context,e),this.logger.info(`Simulcast encodings: ${JSON.stringify(c.encodings)}`));const h=()=>{this.logger.info("Disabling video due to the producer closure"),L(this,fu).delete(o)},m=L(this,Ar).createProducer(c,h);return In(this,x_,B4).call(this,o,m.then(f=>f.id)),m.then(f=>f.track)})}shareWebcam(e){return me(this,null,function*(){return e===void 0?null:(this.logger.debug("Calling _shareWebcam with VP8 codec"),this._shareWebcam(e))})}shareScreen(e){return me(this,null,function*(){const{video:n,audio:r}=e;if(n===void 0)return;const s={track:n,codecOptions:[{name:"VP8"}],appData:{screenShare:!0,e2ee:this.e2ee,supportsRemoteControl:so.isElectron()},stopTracks:!1},i=()=>{this.logger.info("Disabling screenShare due to the producer closure"),L(this,fu).delete(Go.SCREENSHARE_VIDEO),L(this,fu).delete(Go.SCREENSHARE_AUDIO)},o=L(this,Ar).createProducer(s,i);In(this,x_,B4).call(this,Go.SCREENSHARE_VIDEO,o.then(c=>c.id));let l;if(r){const c={track:r,codecOptions:[{name:"opus"}],appData:{screenShare:!0,e2ee:this.e2ee,supportsRemoteControl:so.isElectron()},stopTracks:!1,zeroRtpOnPause:!1},d=()=>{};l=L(this,Ar).createProducer(c,d),In(this,x_,B4).call(this,Go.SCREENSHARE_AUDIO,l.then(u=>u.id))}yield Promise.all([o,l||Promise.resolve()]),this.context.getValue("callstats").screenShareStart()})}shareMic(e){return me(this,null,function*(){try{if(e===void 0)throw new yf("track undefined");const n=In(this,Ju,zh).call(this,Go.MIC);if(n){const o=yield n;if(L(this,Ar).producers.has(o)){const l=L(this,Ar).producers.get(o);if(!l.closed){yield l.replaceTrack({track:e}),yield this.resumeMic(),L(this,Uh)&&(L(this,Uh).audioTrack=e,L(this,Uh).producerId=o,L(this,Uh).start());return}yield L(this,Ar).closeProducer(o,{stopTrack:!1})}yield this.shareMic(e);return}const r=In(this,mye,kgt).call(this,e),s=()=>{L(this,fu).delete(Go.MIC)},i=L(this,Ar).createProducer(r,s);In(this,x_,B4).call(this,Go.MIC,i.then(o=>o.id)),yield i.then(o=>{L(this,Uh)&&(L(this,Uh).audioTrack=o.track,L(this,Uh).producerId=o.id,L(this,Uh).start())})}catch(n){throw new _t(n)}})}pauseMic(){return me(this,null,function*(){var e;const n=yield In(this,Ju,zh).call(this,Go.MIC),r=L(this,Ar).producers.get(n);if(!r){this.logger.error("pauseMic::could_not_find_mic_producer");return}if(r.paused){this.logger.info("pauseMic::mic_producer_already_paused");return}r.pause(),(e=L(this,Uh))==null||e.stop();const s={producerId:r.id,pause:!0};L(this,du).sendMessage(L(this,Zu).toggleProducer,gz.toBinary(s))})}pauseWebcam(){return me(this,null,function*(){const e=yield In(this,Ju,zh).call(this,Go.WEBCAM),n=L(this,Ar).producers.get(e);if(!n){this.logger.error("pauseWebcam::could_not_find_webcam_producer");return}n.pause();const r={producerId:n.id,pause:!0};L(this,du).sendMessage(L(this,Zu).toggleProducer,gz.toBinary(r))})}resumeMic(){return me(this,null,function*(){const e=yield In(this,Ju,zh).call(this,Go.MIC),n=L(this,Ar).producers.get(e);if(!n){this.logger.error("resumeMic::could_not_find_mic_producer");return}if(!n.pause){this.logger.info("resumeMic::mic_producer_already_resumed");return}n.resume(),n.appData.e2ee&&this.context.getValue("peerSessionStore").emit(Et.E2EE_ACTIVE_PRODUCER,n);const r={producerId:n.id,pause:!1};L(this,du).sendMessage(L(this,Zu).toggleProducer,gz.toBinary(r))})}resumeWebcam(){return me(this,arguments,function*(e=Go.WEBCAM){const n=yield In(this,Ju,zh).call(this,e),r=L(this,Ar).producers.get(n);if(!r){this.logger.error("resumeWebcam::could_not_find_webcam_producer");return}if(!r.paused){this.logger.info("resumeWebcam::webcam_producer_already_resumed");return}r.resume(),r.appData.e2ee&&this.context.getValue("peerSessionStore").emit(Et.E2EE_ACTIVE_PRODUCER,r);const s={producerId:r.id,pause:!1};L(this,du).sendMessage(L(this,Zu).toggleProducer,gz.toBinary(s))})}disableWebcam(){return me(this,null,function*(){const e=Go.WEBCAM,n=yield In(this,Ju,zh).call(this,e);In(this,hye,wgt).call(this,e),n&&(yield L(this,Ar).closeProducer(n))})}disableMic(){return me(this,null,function*(){var e;const n=yield In(this,Ju,zh).call(this,Go.MIC);n&&(yield L(this,Ar).closeProducer(n)),(e=L(this,Uh))==null||e.stop(),L(this,fu).delete(Go.MIC)})}disableScreenShare(){return me(this,null,function*(){this.logger.info("screen_sharing_stopped"),this.context.getValue("callstats").screenShareStop();const e=yield In(this,Ju,zh).call(this,Go.SCREENSHARE_VIDEO),n=yield In(this,Ju,zh).call(this,Go.SCREENSHARE_AUDIO);e&&(yield L(this,Ar).closeProducer(e)),n&&(yield L(this,Ar).closeProducer(n)),L(this,Mb).clear(),L(this,fu).delete(Go.SCREENSHARE_VIDEO),L(this,fu).delete(Go.SCREENSHARE_AUDIO)})}muteSelf(){return me(this,null,function*(){this.pauseMic()})}resetVideoProducers(e,n){return me(this,null,function*(){if(e){const r=yield In(this,Ju,zh).call(this,Go.WEBCAM);yield L(this,Ar).closeProducer(r,{stopTrack:!1}),this.shareWebcam(e)}if(n){const r=yield In(this,Ju,zh).call(this,Go.SCREENSHARE_VIDEO);yield L(this,Ar).closeProducer(r,{stopTrack:!1}),this.shareScreen({video:n})}})}changeDisplayName(e,n){return me(this,null,function*(){const r={displayName:e,participantId:n??this.peerId};if(!(yield L(this,Ar).socketHandler.changeDisplayName(r)))throw new Error("failed to change display name!")})}kick(e){const n={peerIds:[e]};L(this,Ar).socketHandler.kickPeer(n)}kickAll(){L(this,Ar).socketHandler.kickAll()}muteAll(e){return me(this,null,function*(){if(!(yield L(this,Ar).socketHandler.hostControlForAll("audio")))throw new Error("failed to mute all participant")})}muteAllVideo(){return me(this,null,function*(){if(!(yield L(this,Ar).socketHandler.hostControlForAll("video")))throw new Error("failed to mute all video participant")})}disableAudio(e){return me(this,null,function*(){if(!(yield L(this,Ar).socketHandler.hostControlForPeer(e,"audio")))throw new Error("failed to mute given participant")})}disableVideo(e){return me(this,null,function*(){if(!(yield L(this,Ar).socketHandler.hostControlForPeer(e,"video")))throw new Error("failed to mute video of given participant")})}pinPeer(e){return me(this,null,function*(){const n={participantId:e??""};try{yield L(this,du).sendMessagePromise(L(this,Zu).globalPinPeer,k1n.toBinary(n))}catch(r){this.logger.error("Error in pinning peer:",{error:r})}})}validateScreenShare(e){return this.peerId===e.peerId&&L(this,Ar).producers.get(e.producerId)&&L(this,Mb).add(e.consumerPeerId),L(this,Mb).size}switchConsumersToLayer(e,n){return me(this,null,function*(){const r=e.map(s=>this.getConsumers().get(s));L(this,Ar).switchConsumersToLayer(r,n)})}handleSocketEvents(){return me(this,null,function*(){L(this,du).on(L(this,Zu).peerProducerCreateBroadcast,({payload:e})=>{if(this.mediaJoined)try{const{participantId:n,producerState:r}=Ekn.fromBinary(e);if(n===this.peerId)return;r!=null&&r.mimeType||(r.mimeType=r.kind===Cx.AUDIO?"audio/opus":"video/VP8"),this.logger.info(`producer created broadcast: ${n}, producer state: ${r}`),this.context.getValue("peerSessionStore").emit(Et.NEW_PRODUCER,{peerId:n,producer:Dr(en({},r),{kind:r.kind===Cx.AUDIO?"audio":"video",producingPeerId:n})})}catch(n){this.logger.error("error in peer-producer-create-broadcast",{error:n})}}),L(this,du).on(L(this,Zu).peerProducerToggleBroadcast,({payload:e})=>{if(this.mediaJoined)try{const{participantId:n,initiatorParticipantId:r,producerState:{kind:s,pause:i,producerId:o,screenShare:l}}=z6e.fromBinary(e);if(l)return;const c=s===Cx.AUDIO?"audio":"video";if(this.logger.info(`producer toggle broadcast: ${n}, producerId: ${o}, kind:${c}, paused:${i} payload: ${JSON.stringify(z6e.fromBinary(e))}`),n===this.peerId&&r!==this.peerId&&i&&this.context.getValue("peerSessionStore").emit(c==="audio"?Et.MUTE_SELF:Et.MUTE_SELF_VIDEO),n===this.peerId)return;this.context.getValue("peerSessionStore").emit(Et.PRODUCER_TOGGLE,{peerId:n,producerId:o,paused:i,kind:c}),Array.from(this.getConsumers().values()).filter(d=>d.producerId===o).forEach(d=>{d.kind==="video"&&i||d.paused!==i&&(this.logger.debug(`consumer state mismatched for ${d.id}. updating consumer pause state ${d.paused} to ${i}`),i?(d.pause(),this.context.getValue("peerSessionStore").emit(Et.CONSUMER_PAUSED,{id:d.id})):(d.resume(),this.context.getValue("peerSessionStore").emit(Et.CONSUMER_RESUMED,{id:d.id})))})}catch(n){this.logger.error("error in producer toggle broadcast handler",{error:n})}}),L(this,du).on(L(this,Zu).peerLeaveBroadcast,({payload:e})=>{if(this.mediaJoined)try{const{participantId:n}=dve.fromBinary(e);if(n===this.peerId)return;this.logger.info(`peer left broadcast:${n}`),L(this,Mb).delete(n),L(this,Ar).consumers.forEach(r=>{r.peerId===n&&r.close()}),this.context.getValue("peerSessionStore").emit(Et.PEER_CLOSED,{id:n})}catch(n){this.logger.error("error in peer left broadcast",{error:n})}}),L(this,du).on(L(this,Zu).peerProducerCloseBroadcast,({payload:e})=>{if(this.mediaJoined)try{const{participantId:n,producerState:{producerId:r}}=_kn.fromBinary(e);if(n===this.peerId)return;this.logger.info(`producer closed broadcast:${n}`),this.context.getValue("peerSessionStore").emit(Et.PRODUCER_CLOSED,{peerId:n,producerId:r});const s=L(this,Ar).producerIdToConsumerIdMap.get(r);if(!s){this.logger.warn(`no consumer found for producer:${r}`);return}this.logger.info(`closing consumer ${s}, producer id: ${r}`),L(this,Ar).closeConsumer(s).then(()=>{this.logger.info(`closed consumer: ${s}`),L(this,Ar).producerIdToConsumerIdMap.delete(r),this.context.getValue("peerSessionStore").emit(Et.CONSUMER_CLOSED,{id:s})}).catch(i=>{this.logger.error("error closing consumer",{error:i})})}catch(n){this.logger.error("error on producer close broadcast",{error:n})}}),L(this,du).on(L(this,Zu).mediaRoomTerminationBroadcastResponse,()=>{!this.mediaJoined&&!L(this,dA)&&!L(this,uA)||(this.logger.warn("media hub termination broadcast received, rejoining room"),this.context.getValue("peerSessionStore").emit(Et.ROOM_NODE_DISCONNECTED),L(this,xW).call(this))})})}handleCallstatsEvents(){this.context.getValue("callstats").onConsumerScore(e=>{e.forEach((n,r)=>{const s=L(this,Ar).consumers.get(r);s&&this.context.getValue("peerSessionStore").emit(Et.CONSUMER_SCORE_UPDATE,{id:r,kind:s.kind,peerId:s.peerId,score:n.score,scoreStats:n})})}),this.context.getValue("callstats").onProducerScore(e=>{e.forEach((n,r)=>{const s=Array.from(L(this,Ar).producers.values()).find(i=>i.id===r);s&&this.context.getValue("peerSessionStore").emit(Et.PRODUCER_SCORE_UPDATE,{id:r,kind:s.kind,appData:s.appData,score:n.score,scoreStats:n})})})}}tQ=new WeakMap,nQ=new WeakMap,du=new WeakMap,Ar=new WeakMap,iye=new WeakMap,Zu=new WeakMap,dA=new WeakMap,uA=new WeakMap,b_=new WeakMap,xW=new WeakMap,cf=new WeakMap,Mb=new WeakMap,fu=new WeakMap,Uh=new WeakMap,Qw=new WeakSet,sj=function(){return this.context.getValue("connectionHandler")},aye=new WeakSet,xgt=function(t,e,n,r){return me(this,null,function*(){var s;Te(this,nQ,t);let i=!1;if(n){const{recv:o,send:l}=(s=L(this,Qw,sj).mediaState)!=null?s:{};(l==null?void 0:l.state)===Lk.CONNECTED&&(o==null?void 0:o.state)===Lk.CONNECTED?(this.logger.info("MediaNodeClient.joinRoom: transports healthy — partial reset (producers only)"),yield L(this,Ar).closeAllProducersLocally(),L(this,fu).clear(),L(this,Mb).clear(),Te(this,cf,null),i=!0):(this.logger.info("MediaNodeClient.joinRoom: transports unhealthy — full reset"),this.reset({resetTransportQueue:!1}))}try{L(this,cf)?yield L(this,cf):yield In(this,rQ,cye).call(this,t,e,n,r,i),In(this,lye,zFe).call(this,e);const{joined:o,error:l}=yield In(this,oye,UFe).call(this);return{roomJoined:o,error:l}}catch(o){return this.logger.error("Failed to complete room join",{error:o}),{roomJoined:!1,error:o}}finally{Te(this,cf,null)}})},oye=new WeakSet,UFe=function(){return me(this,null,function*(){try{this.mediaJoined=!0;const{roomState:t}=yield L(this,Ar).socketHandler.notifySelfJoinComplete();return Te(this,tQ,t.roomUuid),Te(this,uA,!0),Te(this,dA,!1),{joined:!0}}catch(t){return this.logger.error("Error completing room join",{error:t}),this.mediaJoined=!1,{joined:!1,error:t}}})},lye=new WeakSet,zFe=function(t){navigator.product!=="ReactNative"&&setTimeout(()=>{try{const e={userId:this.context.getValue("userId"),peerId:this.peerId,roomUUID:t,roomViewType:"groupCall",deviceInfo:Dr(en({},so.getDeviceInfo()),{userAgent:navigator.userAgent,memory:navigator.deviceMemory,cpus:navigator.hardwareConcurrency}),sdkName:this.context.getValue("sdkName"),sdkVersion:this.context.getValue("sdkVersion"),metaData:{},permissions:{}};this.context.getValue("callstats").roomJoined(e)}catch(e){this.logger.error("Error reporting room joined analytics",{error:e})}},0)},rQ=new WeakSet,cye=function(t,e,n,r,s=!1){return me(this,null,function*(){try{const i=In(this,dye,VFe).call(this);yield In(this,uye,HFe).call(this,t,e,n,i),s?this.logger.info("MediaNodeClient: reusing existing transports on rejoin"):yield L(this,Ar).setupTransports({send:!0,recv:!0})}catch(i){throw this.logger.error("Failed to initialize connection",{error:i}),i}})},dye=new WeakSet,VFe=function(){const t=SNn("video/VP8");return Te(this,iye,t),t},uye=new WeakSet,HFe=function(t,e,n,r){return me(this,null,function*(){yield ogt((s,i)=>me(this,null,function*(){if(!L(this,du).isConnected){i(new Error("Socket is not connected"));return}s>0&&this.logger.warn("Retry: send joinRoom message",{debuggingHint:`Retry attempt ${s}`});try{yield L(this,Ar).socketHandler.joinRoom(e,t,r,n)}catch(o){throw this.logger.error("Failed to send joinRoom message after retries",{error:o}),o}}),{delayTime:1e3,strategy:"exponential",maxRetryCount:15})})},Ju=new WeakSet,zh=function(t){return L(this,fu).get(t)},x_=new WeakSet,B4=function(t,e){return L(this,fu).set(t,e)},hye=new WeakSet,wgt=function(t){return L(this,fu).delete(t)},mye=new WeakSet,kgt=function(t){return{track:t,encodings:[{priority:"high"}],codecOptions:[{name:"opus"}],appData:{e2ee:this.e2ee},stopTracks:!1,zeroRtpOnPause:!1}},fye=new WeakSet,Sgt=function(t){return{track:t,codecOptions:[{name:"VP8"}],appData:{screenShare:!1,e2ee:this.e2ee},stopTracks:!1}};aa([ut.trace("MediaNodeClient.reset")],Ki.prototype,"reset");aa([ut.trace("MediaNodeClient.joinRoom")],Ki.prototype,"joinRoom");aa([ut.trace("MediaNodeClient.leaveRoom")],Ki.prototype,"leaveRoom");aa([ut.trace("MediaNodeClient.activatePeers")],Ki.prototype,"activatePeers");aa([ut.trace("MediaNodeClient.createConsumers")],Ki.prototype,"createConsumers");aa([ut.trace("MediaNodeClient.closeConsumers")],Ki.prototype,"closeConsumers");aa([ut.trace("MediaNodeClient._shareWebcam")],Ki.prototype,"_shareWebcam");aa([ut.trace("MediaNodeClient.shareWebcam")],Ki.prototype,"shareWebcam");aa([ut.trace("MediaNodeClient.shareScreen")],Ki.prototype,"shareScreen");aa([ut.trace("MediaNodeClient.shareMic")],Ki.prototype,"shareMic");aa([ut.trace("MediaNodeClient.pauseMic")],Ki.prototype,"pauseMic");aa([ut.trace("MediaNodeClient.pauseWebcam")],Ki.prototype,"pauseWebcam");aa([ut.trace("MediaNodeClient.resumeMic")],Ki.prototype,"resumeMic");aa([ut.trace("MediaNodeClient.resumeWebcam")],Ki.prototype,"resumeWebcam");aa([ut.trace("MediaNodeClient.disableWebcam")],Ki.prototype,"disableWebcam");aa([ut.trace("MediaNodeClient.disableMic")],Ki.prototype,"disableMic");aa([ut.trace("MediaNodeClient.disableScreenShare")],Ki.prototype,"disableScreenShare");aa([ut.trace("MediaNodeClient.muteSelf")],Ki.prototype,"muteSelf");aa([ut.trace("MediaNodeClient.resetVideoProducers")],Ki.prototype,"resetVideoProducers");aa([ut.trace("MediaNodeClient.changeDisplayName")],Ki.prototype,"changeDisplayName");aa([ut.trace("MediaNodeClient.kickPeer")],Ki.prototype,"kick");aa([ut.trace("MediaNodeClient.kickAllPeers")],Ki.prototype,"kickAll");aa([ut.trace("MediaNodeClient.muteAll")],Ki.prototype,"muteAll");aa([ut.trace("MediaNodeClient.muteAllVideo")],Ki.prototype,"muteAllVideo");aa([ut.trace("MediaNodeClient.disableAudio")],Ki.prototype,"disableAudio");aa([ut.trace("MediaNodeClient.disableVideo")],Ki.prototype,"disableVideo");aa([ut.trace("MediaNodeClient.pinPeer")],Ki.prototype,"pinPeer");aa([ut.trace("MediaNodeClient.validateScreenShare")],Ki.prototype,"validateScreenShare");function Cgt(t,e){const n=t.getValue("roomNodeClient");if(n){if(n)return n;throw new Error("Room node client already set up.")}const r=new Ki(t,e);return t.setValue("roomNodeClient",r),r}function zNn(t){const e=t.getValue("roomNodeClient");try{e==null||e.leaveRoom()}catch{t.getValue("logger").error("roomNodeClient::cleanupRoomNodeClient")}t.setValue("roomNodeClient",void 0)}var VNn=Object.defineProperty,HNn=Object.getOwnPropertyDescriptor,BE=(t,e,n,r)=>{for(var s=HNn(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&VNn(e,n,s),s},h3,uv,Xs,$h,Gm,GFe;const jgt=(GFe=class{constructor(t,e,n,r){Se(this,$h),xe(this,"self"),xe(this,"authToken"),Se(this,h3,void 0),xe(this,"viewType"),Se(this,uv,void 0),Se(this,Xs,void 0);const{socket:s}=n,i=t.getValue("authToken");this.self=e,Te(this,Xs,t),this.viewType=r,this.authToken=i,Te(this,h3,s),Te(this,uv,n),this.setupEvents()}get peerId(){return L(this,Xs).getValue("peerId")}get telemetry(){return L(this,Xs).getValue("telemetry")}get logger(){return L(this,Xs).getValue("logger")}get mediaJoined(){return L(this,Xs).getValue("connectionHandler").mediaJoined}static init(t,e,n,r,s){return me(this,null,function*(){const i=dh(),o=t.getValue("peerId"),l=!!t.getValue("cachedUserDetails"),c=yield Bc.__init__(t,n,r,s,s.name,l);t.setValue("self",c);const d=t.getValue("logger");return navigator.product!=="ReactNative"?setTimeout(()=>me(this,null,function*(){const u=yield c.getAllDevices();d.info("populated_full_device_list",{devices:JSON.stringify(u)}),t.getValue("callstats").devices("AUDIO",u==null?void 0:u.filter(h=>h.kind==="audioinput")),t.getValue("callstats").devices("VIDEO",u==null?void 0:u.filter(h=>h.kind==="videoinput")),t.getValue("callstats").devices("SPEAKER",u==null?void 0:u.filter(h=>h.kind==="audiooutput")),d.info("Callstats:: initializing");try{yield t.getValue("callstats").initialize({peerId:o,engineName:so.getDeviceInfo().engineName,env:t.getValue("env")==="prod"?"prod":"devel",iceServers:yield i.getICEServers(),apiBase:t.getValue("apiBase"),flags:{},logger:d,apiHostnames:X0n(t),skipConnectivityChecks:!0,authToken:t.getValue("authToken")}),d.info("Callstats:: initialized")}catch(h){d.error("Callstats:: initialization failed",{error:h})}}),0):d.info("Callstats:: Skipped initialization due to navigator product being ReactNative."),new jgt(t,c,e,s.viewType)})}shareMediaTracks(){return me(this,null,function*(){var t;const{audioTrack:e,videoTrack:n,permissions:r,audioEnabled:s,videoEnabled:i,screenShareEnabled:o,screenShareTracks:l}=this.self;if(r.canProduceAudio===Hr.Allowed&&s)if((e==null?void 0:e.readyState)==="live")try{yield L(this,$h,Gm).shareMic(e),this.self.audioEnabled||L(this,$h,Gm).pauseMic()}catch{this.self.disableAudio()}else this.logger.warn("shareMediaTracks: audio track is dead, disabling audio"),this.self.disableAudio();if(r.canProduceVideo===Hr.Allowed&&i)if((n==null?void 0:n.readyState)==="live")try{yield L(this,$h,Gm).shareWebcam(n),this.self.videoEnabled||L(this,$h,Gm).pauseWebcam()}catch{this.self.disableVideo()}else this.logger.warn("shareMediaTracks: video track is dead, disabling video"),this.self.disableVideo();if(r.canProduceScreenshare===Hr.Allowed&&o){const c=l.video,d=l.audio;if((c==null?void 0:c.readyState)==="live")try{yield(t=L(this,$h,Gm))==null?void 0:t.shareScreen({video:c,audio:(d==null?void 0:d.readyState)==="live"?d:void 0})}catch{this.self.disableScreenShare()}else this.logger.warn("shareMediaTracks: screenshare video track is dead, disabling screenshare"),this.self.disableScreenShare()}})}kickHandler(t){return me(this,null,function*(){let e="kicked";(t==null?void 0:t.kickType)==="kickAll"&&(e="ended"),this.leaveRoom(e)})}waitlistedHandler(){this.logger.info("SelController.waitlisted"),this.self.waitlistStatus="waiting",this.self.roomState="waitlisted",this.self.emit("waitlisted")}waitlistAcceptHandler(){if(this.logger.info("SelController.waitlistAccepted"),this.self.waitlistStatus==="accepted"){this.logger.warn("SelfController.WAITLIST_ACCEPTED.UserAlreadyAccepted");return}this.self.waitlistStatus="accepted",this.joinRoom()}waitlistRejectedHandler(){if(this.logger.info("SelfController.waitlistRejected"),this.self.waitlistStatus==="rejected"){this.logger.warn("SelfController.WAITLIST_REJECTED.UserAlreadyRejected");return}this.self.waitlistStatus="rejected",this.leaveRoom("rejected")}resetSelf(t){return me(this,null,function*(){L(this,Xs).getValue("callstats").callEnded(),t?(this.logger.info("Resetting Self post reconnect. Peer has earlier tried joining the meeting. State cleanup will be done during room rejoin."),yield this.joinRoom(t)):(this.logger.info("Resetting Self post reconnect. User never joined the room so doing full reset."),L(this,$h,Gm).reset({resetTransportQueue:!0}))})}setupEvents(){L(this,Xs).getValue("peerSessionStore").on(Et.RESET_PRODUCER_STATE,()=>me(this,null,function*(){this.mediaJoined&&this.shareMediaTracks()})),L(this,Xs).getValue("peerSessionStore").on(Et.ROOM_NODE_RECONNECTED,()=>{this.self.roomState="joined",this.self.emit("roomJoined",{reconnected:!0})}),L(this,Xs).getValue("peerSessionStore").on(Et.ROOM_NODE_DISCONNECTED,()=>{this.self.roomState!=="disconnected"&&(this.self.roomState="disconnected",this.self.emit("roomLeft",{state:"disconnected"}))}),L(this,Xs).getValue("peerSessionStore").on(Et.ROOM_NODE_FAILED,()=>{this.logger.error("Room node failed. SDK re-initialization is required."),this.self.roomState="failed",this.self.emit("roomLeft",{state:"failed"})}),L(this,Xs).getValue("peerSessionStore").on(Et.SOCKET_SERVICE_RECONNECTED,({wasJoinAttempted:t})=>{t===!1&&(this.self.roomState="init"),this.resetSelf(t)}),L(this,Xs).getValue("peerSessionStore").on(Et.SOCKET_SERVICE_DISCONNECTED,({joinAttempted:t})=>{if(this.self.roomState==="disconnected")return;const{peerId:e}=this;L(this,h3).updateURL(e),L(this,Xs).getValue("telemetry").resetPeerId(e),dh().setHeader("tracing-id",e),nk.remapContext(e,L(this,Xs)),this.self.roomState="disconnected",this.self.emit("roomLeft",{state:"disconnected"})}),L(this,Xs).getValue("peerSessionStore").on(Et.SOCKET_SERVICE_FAILED,()=>{this.logger.error("Socket reconnection failed after exhausting all attempts. SDK re-initialization is required."),this.self.roomState="failed",this.self.emit("roomLeft",{state:"failed"})}),L(this,uv).on(Rn.waitingRoomRequestAccepted,()=>{this.waitlistAcceptHandler()}),L(this,uv).on(UG.updateUserPreset,t=>{t.updatePeersPresets.forEach(e=>{e.userIds===this.self.userId&&L(this,Xs).getValue("peerSessionStore").emit(Et.UPDATE_PERMISSIONS,e.patch)})}),L(this,uv).on(Rn.waitingRoomRequestDenied,()=>{this.waitlistRejectedHandler()}),L(this,uv).on(Rn.kick,()=>{this.kickHandler({kickType:"kick"})}),L(this,uv).on(Rn.kickAll,()=>{this.kickHandler({kickType:"kickAll"})}),L(this,Xs).getValue("peerSessionStore").onAsync(Et.JOIN_MEDIA_ROOM,this.joinMediaRoom.bind(this)),L(this,Xs).getValue("peerSessionStore").on(Et.PRODUCER_SCORE_UPDATE,({score:t,kind:e,appData:n,scoreStats:r})=>{var s;const i=(s=n==null?void 0:n.screenShare)!=null?s:!1;this.self.emit("mediaScoreUpdate",{kind:e,isScreenshare:i,score:t,participantId:this.self.id,scoreStats:r})}),L(this,Xs).getValue("peerSessionStore").on(Et.MUTE_SELF,()=>me(this,null,function*(){this.self.audioEnabled&&(yield this.self.disableAudio(),L(this,Xs).getValue("callstats").audioOff())})),L(this,Xs).getValue("peerSessionStore").on(Et.MUTE_SELF_VIDEO,()=>me(this,null,function*(){this.self.videoEnabled&&(yield this.self.disableVideo(),L(this,Xs).getValue("callstats").videoOff())})),L(this,Xs).getValue("peerSessionStore").onAsync(Et.LEAVE_MEDIA_ROOM,this.leaveMediaRoom.bind(this)),L(this,Xs).getValue("peerSessionStore").on(Et.PIP_HANGUP,this.leaveRoom.bind(this))}joinRoom(t=!1){return me(this,null,function*(){try{this.logger.info("Joining socket room.");const{peer:e}=yield L(this,uv).joinRoom(this.self);this.logger.info("Joined socket room."),L(this,uv).socket.flush();const n=cEe(e.stageType);if(L(this,Xs).setValue("stageStatus",n,!1),e.waitlisted){this.logger.info("Peer was waitlisted. Skipped joining media room."),this.waitlistedHandler();return}}catch(e){throw this.logger.error("SelfController.joinRoom: socket join failed",{error:e}),new _t("Check the network and try again.","0002")}try{this.logger.info("Joining media room."),yield this.joinMediaRoom(t),this.logger.info("Joined media room."),L(this,Xs).notify("stageStatus")}catch(e){throw this.logger.error("SelfController.joinRoom: media room join failed",{error:e}),e instanceof i1&&e.message==="ice connection failed"?new _t("A firewall or network restriction may be blocking the connection.","0014"):new _t("Check the network and try again.","0014")}})}leaveRoom(t="left"){return me(this,null,function*(){var e;if(this.logger.info(`Leaving room with state: ${t}`),t==="rejected"){this.self.roomState=t,this.self.emit("roomLeft",{state:t});return}this.self.setIsPinned(!1),L(this,Xs).setValue("stageStatus","OFF_STAGE",!1),yield this.leaveMediaRoom(t),L(this,Xs).setValue("roomNodeClient",void 0),L(this,Xs).notify("stageStatus"),(e=L(this,Xs).getValue("roomSocketHandler"))==null||e.cleanup(),this.self.roomState=t,this.self.emit("roomLeft",{state:t}),this.logger.info(`roomLeft event emitted with state: ${t}`)})}joinMediaRoom(t=!1){return me(this,null,function*(){var e,n;const{peerId:r,viewType:s,meetingId:i,stageStatus:o}=L(this,Xs).getAllValues();try{if(s===Sx.Livestream){if(o!=="ON_STAGE"){this.self.roomState="joined",this.self.emit("roomJoined",{reconnected:t});return}Cgt(L(this,Xs),{socket:L(this,h3),peerId:r})}const{canProduceAudio:l,canProduceVideo:c,canProduceScreenshare:d}=this.self.permissions,{roomJoined:u,error:h}=(n=yield(e=L(this,$h,Gm))==null?void 0:e.joinRoom(this.self.name,i,t,{canProduceAudio:l,canProduceVideo:c,canProduceScreenshare:d}))!=null?n:{};if(!u)throw h??new Error("Could not connect to media server");this.logger.info(o==="ON_STAGE"?"Peer is on stage. Sharing media tracks":"Peer is not on stage. Not sharing media tracks"),o==="ON_STAGE"&&(yield this.shareMediaTracks()),this.logger.info(o==="ON_STAGE"?"Peer is on stage. Shared media tracks":"Peer is not on stage. Did not share media tracks"),this.self.roomState="joined",this.self.emit("roomJoined",{reconnected:t})}catch(l){throw this.logger.error("SelfController.mediaRoomJoin",{error:l}),l}})}leaveMediaRoom(t){return me(this,null,function*(){const e=L(this,Xs).getValue("viewType");t!=="connected-meeting"&&(yield this.cleanupSelf()),!(t==="stageLeft"&&e===Sx.Webinar)&&L(this,$h,Gm)&&(L(this,$h,Gm).mediaJoined&&t!=="disconnected"&&(yield L(this,$h,Gm).leaveRoom()),!(t==="stageLeft"&&e===Sx.Livestream)&&(L(this,$h,Gm).mediaJoined=!1))})}cleanupSelf(){return me(this,null,function*(){yield this.self.disableAudio(),yield this.self.disableVideo(),yield this.self.disableScreenShare(),this.self.cleanUpTracks(),this.self.destructMediaHandler(),navigator.isReactNative||this.self.removeDocumentEventListeners()})}},h3=new WeakMap,uv=new WeakMap,Xs=new WeakMap,$h=new WeakSet,Gm=function(){return L(this,Xs).getValue("roomNodeClient")},GFe);let kS=jgt;BE([ut.trace("SelfController.resetSelf")],kS.prototype,"resetSelf");BE([ut.trace("SelfController.setupEvents")],kS.prototype,"setupEvents");BE([ut.trace("SelfController.joinRoom")],kS.prototype,"joinRoom");BE([ut.trace("SelfController.leaveRoom")],kS.prototype,"leaveRoom");BE([ut.trace("SelfController.joinMediaRoom")],kS.prototype,"joinMediaRoom");BE([ut.trace("SelfController.leaveMediaRoom")],kS.prototype,"leaveMediaRoom");BE([ut.trace("SelfController.init")],kS,"init");var wW;class GNn{constructor(e){Se(this,wW,void 0),Te(this,wW,e)}on(e,n){let r;e===Rn.roomPeerCount?r=G6e.fromBinary.bind(G6e):r=X6e.fromBinary.bind(X6e),L(this,wW).on(e,({payload:s})=>{if(e===Rn.roomPeerCount&&!s)return;const i=r(s);n(i)})}}wW=new WeakMap;var kW,SW;class WNn{constructor(e,n){Se(this,kW,void 0),Se(this,SW,void 0),Te(this,kW,n),Te(this,SW,e)}get logger(){return L(this,SW).getValue("logger")}on(e,n){let r,s;switch(e){case Rn.transcript:{r=Dle.fromBinary.bind(Dle),s=Dle.create();break}default:{this.logger.debug("AISocketHandler switch case hit default, event not accounted for.");break}}L(this,kW).on(e,({payload:i})=>{let o=s;try{o=r(i)}catch(l){this.logger.error("aiSocketHandler::on::binary_decode_error",{error:l})}return n(o)})}}kW=new WeakMap,SW=new WeakMap;var qNn=Object.defineProperty,KNn=Object.getOwnPropertyDescriptor,kEe=(t,e,n,r)=>{for(var s=KNn(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&qNn(e,n,s),s},Mw,U4;class Ute{constructor(e,n){Se(this,Mw,void 0),Se(this,U4,void 0),Te(this,Mw,n),Te(this,U4,e)}get logger(){return L(this,U4).getValue("logger")}get telemetry(){return L(this,U4).getValue("telemetry")}getPolls(){return L(this,Mw).sendMessagePromise(Ub.getPolls)}createPoll(e,n,r=!1,s=!1){const i={anonymous:r,hideVotes:s,question:e,options:n};return L(this,Mw).sendMessage(Ub.createPoll,s2n.toBinary(i))}votePoll(e,n){const r={index:n,pollId:e};return L(this,Mw).sendMessage(Ub.votePoll,a2n.toBinary(r))}on(e,n){let r,s;switch(e){case Ub.updatePoll:case Ub.createPoll:case Ub.votePoll:{r=zle.fromBinary.bind(zle),s=zle.create();break}}L(this,Mw).on(e,({payload:i})=>{let o=s;try{o=r(i)}catch(l){this.logger.error("pollSocketHandler::on::binary_decode_error",{error:l})}return n(o)})}removeListeners(e){L(this,Mw).removeListeners(e)}}Mw=new WeakMap,U4=new WeakMap;kEe([ut.trace("PollSocketHandler.getPolls")],Ute.prototype,"getPolls");kEe([ut.trace("PollSocketHandler.createPoll")],Ute.prototype,"createPoll");kEe([ut.trace("PollSocketHandler.votePoll")],Ute.prototype,"votePoll");var YNn=Object.defineProperty,QNn=Object.getOwnPropertyDescriptor,ZNn=(t,e,n,r)=>{for(var s=QNn(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&YNn(e,n,s),s},Jm;class Egt{constructor(e,n){xe(this,"socket"),Se(this,Jm,void 0),Te(this,Jm,e),this.socket=n,this.handleSocketEvents(),L(this,Jm).setValue("roomSocketHandler",this)}get telemetry(){return L(this,Jm).getValue("telemetry")}get logger(){return L(this,Jm).getValue("logger")}cleanup(){var e;try{(e=this.socket)==null||e.disconnect()}catch{this.logger.error("roomSocketHandler::cleanup")}}joinRoom(e){return me(this,null,function*(){var n;this.socket.joinAttempted=!0;const r={capabilities:[],peer:{displayName:(n=e.name)!=null?n:"Participant",customParticipantId:e.customParticipantId,peerId:e.id,userId:e.userId,displayPictureUrl:e.picture,waitlisted:!1},roomUuid:""},s=this.socket.sendMessagePromise(Rn.joinRoom,sSn.toBinary(r));try{const{peer:i}=n_.fromBinary((yield s).payload);L(this,Jm).getValue("connectionHandler").socketJoined=!0,L(this,Jm).getValue("peerSessionStore").emit(Et.SOCKET_SERVICE_ROOM_JOINED,{peer:i});const o=this.getRoomState(),l=this.getRoomPeersNonPaginated(),[{room:c},{peers:d}]=yield Promise.all([o,l]);return L(this,Jm).getValue("peerSessionStore").emit(Et.ROOM_STATE,c),L(this,Jm).getValue("peerSessionStore").emit(Et.SOCKET_PEERS,d),{peer:i}}catch(i){throw this.logger.error("RoomSocketHandler.joinRoom.failed",{error:i}),i}})}getAllAddedParticipants(){return me(this,null,function*(){try{return zSn.fromBinary((yield this.socket.sendMessagePromise(Rn.getAllAddedParticipants)).payload).participants.map(e=>{var n=e,{id:r}=n,s=U2e(n,["id"]);return Dr(en({},s),{userId:r})})}catch{return[]}})}getRoomPeers(e,n,r){return me(this,null,function*(){let s;try{const i={seachQuery:e,limit:n,offset:r},o=yield this.socket.sendMessagePromise(Rn.getRoomPeersInfo,Kkn.toBinary(i));s=$le.fromBinary(o.payload)}catch(i){this.logger.error("getRoomPeers::binary_decode_error",{error:i})}return s})}getRoomPeersNonPaginated(){return me(this,null,function*(){let e;try{const n=yield this.socket.sendMessagePromise(Rn.getRoomPeersInfo);e=$le.fromBinary(n.payload)}catch(n){this.logger.error("getRoomJoinedPeers::binary_decode_error",{error:n})}return e})}getStagePeers(){return me(this,null,function*(){let e;try{const n=yield this.socket.sendMessagePromise(Rn.getRoomPeersInfo);e=$le.fromBinary(n.payload)}catch(n){this.logger.error("getRoomJoinedPeers::binary_decode_error",{error:n})}return e})}getPeerInfo(e){return me(this,null,function*(){let n;try{const r=yield this.socket.sendMessagePromise(Rn.getPeerInfo,Ppt.toBinary({peerId:e}));n=n_.fromBinary(r.payload)}catch(r){this.logger.error("getPeerInfo::binary_decode_error",{error:r})}return n})}getRoomState(){return me(this,null,function*(){let e=W6e.create();try{const n=yield this.socket.sendMessagePromise(Rn.getRoomInfo);e=W6e.fromBinary(n.payload)}catch(n){this.logger.error("getRoomState::binary_decode_error",{error:n})}return e})}getRoomStageState(){return me(this,null,function*(){let e=Q6e.create();try{const n=yield this.socket.sendMessagePromise(Rn.getRoomStageState);e=Q6e.fromBinary(n.payload)}catch(n){this.logger.error("getRoomStageState::binary_decode_error",{error:n})}return e})}broadcastMessage(e,n){return me(this,null,function*(){const r={type:e,payload:new TextEncoder().encode(JSON.stringify(n)),timestamp:Date.now(),ids:[]};return this.socket.sendMessagePromise(Rn.broadcastMessage,FL.toBinary(r))})}broadcastToMeetings(e,n,r){return me(this,null,function*(){const s={type:e,payload:new TextEncoder().encode(JSON.stringify(r)),timestamp:Date.now(),ids:n,broadcastType:1};return this.socket.sendMessagePromise(Rn.broadcastToEntity,FL.toBinary(s))})}broadcastToPeers(e,n,r){return me(this,null,function*(){const s={type:e,payload:new TextEncoder().encode(JSON.stringify(r)),timestamp:Date.now(),ids:n,broadcastType:0};return this.socket.sendMessage(Rn.broadcastToEntity,FL.toBinary(s))})}leaveRoom(){return me(this,null,function*(){this.socket.joinAttempted=!1,this.socket.sendMessagePromise(Rn.leaveRoom,aSn.toBinary({}))})}kick(e){return me(this,null,function*(){const n={peerIds:[e]};this.socket.sendMessage(Rn.kick,Ipt.toBinary(n))})}kickAll(e=!1){return me(this,null,function*(){const n={propagateKickAcrossRooms:e};this.socket.sendMessage(Rn.kickAll,Tpt.toBinary(n))})}getWaitingRoomRequests(){this.socket.sendMessage(Rn.getWaitingRoomRequests)}acceptWaitingRoomRequest(e){const n={userIds:e};this.socket.sendMessage(Rn.acceptWaitingRoomRequests,KSn.toBinary(n))}rejectWaitingRoomRequest(e){const n={userIds:e};this.socket.sendMessage(Rn.denyWaitingRoomRequests,QSn.toBinary(n))}updatePermissions(e,n){return me(this,null,function*(){const r={updatePeersPresets:[]};return e.forEach(s=>{r.updatePeersPresets.push({userIds:s,patch:n})}),this.socket.sendMessagePromise(UG.updateUserPreset,jCn.toBinary(r))})}handleSocketEvents(){this.socket.on(Rn.broadcastMessage,({payload:e})=>{try{const n=FL.fromBinary(e);L(this,Jm).getValue("peerSessionStore").emit(Et.ROOM_MESSAGE,{payload:JSON.parse(new TextDecoder().decode(n.payload)),type:n.type,timestamp:n.timestamp})}catch(n){this.logger.error("failed to decode broadcast message:",n)}}),this.socket.on(Rn.broadcastToEntity,({payload:e})=>{try{const n=FL.fromBinary(e);L(this,Jm).getValue("peerSessionStore").emit(Et.MESSAGE,{payload:JSON.parse(new TextDecoder().decode(n.payload)),type:n.type,timestamp:n.timestamp})}catch(n){this.logger.error("failed to decode peer broadcast message:",n)}})}on(e,n){let r,s;switch(e){case Rn.joinRoom:case Rn.leaveRoom:case Rn.kick:case Rn.kickAll:{r=n_.fromBinary.bind(n_),s=n_.create();break}case Rn.getWaitingRoomRequests:{r=(i,o)=>i?Y6e.fromBinary(i,o):{requests:[]},s=Y6e.create();break}case Rn.recordingPaused:case Rn.recordingStarted:case Rn.recordingStopped:{r=nFe.fromBinary.bind(nFe);break}case UG.updateUserPreset:{r=Z6e.fromBinary.bind(Z6e);break}case tg.peerJoinedBroadcast:case qw.peerJoinedBroadcast:{r=B6e.fromBinary.bind(B6e);break}case tg.selfJoinComplete:case qw.selfJoinComplete:{r=cve.fromBinary.bind(cve);break}case tg.globalPeerPinBroadcast:case qw.globalPeerPinBroadcast:{r=V6e.fromBinary.bind(V6e);break}case tg.selectedPeer:case qw.selectedPeer:{r=lve.fromBinary.bind(lve);break}case tg.selectedPeerDiff:case qw.selectedPeerDiff:{r=F6e.fromBinary.bind(F6e);break}case tg.leaveRoom:case qw.leaveRoom:{r=dve.fromBinary.bind(dve);break}}this.socket.on(e,({payload:i})=>{let o=s;if(!r)return n(void 0);try{o=r(i)}catch(l){this.logger.error("roomSocketHandler::on::binary_decode_error",{error:l})}return n(o)})}getUserPermissions(e){return me(this,null,function*(){const n={userIds:[e]};try{const r=yield this.socket.sendMessagePromise(UG.getUserPresets,yCn.toBinary(n)),s=kCn.fromBinary(r.payload).peerPresets[0],i=new TextDecoder().decode(s.preset),o=JSON.parse(i).permissions;return{chat:o.chat,polls:o.polls,plugins:o.plugins}}catch(r){throw this.logger.error("Error in getting user preset",{error:r}),r}})}}Jm=new WeakMap;ZNn([ut.trace("RoomSocketHandler.joinRoom")],Egt.prototype,"joinRoom");var Vh;class JNn{constructor(e){Se(this,Vh,void 0),Te(this,Vh,e)}getStageRequests(){return me(this,null,function*(){const{payload:e}=yield L(this,Vh).sendMessagePromise(Rn.getStageRequests);return e?Ule.fromBinary(e):{stageRequests:[]}})}requestAccess(){L(this,Vh).sendMessage(Rn.requestStageAccess)}cancelRequestAccess(){L(this,Vh).sendMessage(Rn.cancelStageRequest)}grantAccess(e){return me(this,null,function*(){const n={userIds:e};L(this,Vh).sendMessage(Rn.grantStageAccess,Kjn.toBinary(n))})}denyAccess(e){return me(this,null,function*(){const n={userIds:e};L(this,Vh).sendMessage(Rn.denyStageAccess,Qjn.toBinary(n))})}joinStage(){return L(this,Vh).sendMessagePromise(Rn.joinStage,void 0,void 0,Rn.peerStageStatusUpdate)}leaveStage(e){const n={userIds:[e]};return L(this,Vh).sendMessagePromise(Rn.leaveStage,tFe.toBinary(n),void 0,Rn.peerStageStatusUpdate)}kick(e){const n={userIds:e};return L(this,Vh).sendMessagePromise(Rn.leaveStage,tFe.toBinary(n))}on(e,n){let r;switch(e){case Rn.grantStageAccess:case Rn.denyStageAccess:{r=void 0;break}case Rn.getStagePeers:{r=eFe.fromBinary.bind(eFe);break}case Rn.getStageRequests:case Rn.requestStageAccess:case Rn.cancelStageRequest:{r=Ule.fromBinary.bind(Ule);break}case Rn.peerStageStatusUpdate:{r=H6e.fromBinary.bind(H6e);break}}L(this,Vh).on(e,({payload:s,id:i})=>{if(!s||!r)return n(void 0,i);const o=r(s);return n(o,i)})}getPeerInfo(e){return me(this,null,function*(){const n=yield L(this,Vh).sendMessagePromise(Rn.getPeerInfo,Ppt.toBinary({peerId:e}));return n_.fromBinary(n.payload)})}}Vh=new WeakMap;var RC,z4;class XNn{constructor(e,n){Se(this,RC,void 0),Se(this,z4,void 0),Te(this,RC,n),Te(this,z4,e)}get logger(){return L(this,z4).getValue("logger")}get peerId(){return L(this,z4).getValue("peerId")}storeInsertKeys(e,n,r,s){const i={pluginId:e,storeName:n,insertKeys:r.map(o=>({storeKey:o.key,payload:new TextEncoder().encode(JSON.stringify(o.payload))}))};L(this,RC).sendMessage(Bb.storeInsertKeys,Tjn.toBinary(i),s)}storeGetKeys(e,n,r,s){const i={pluginId:e,storeName:n,getKeys:r.map(o=>({storeKey:o.key}))};L(this,RC).sendMessage(Bb.storeGetKeys,Ajn.toBinary(i),s)}storeDeleteKeys(e,n,r,s){const i={pluginId:e,storeName:n,deleteKeys:r.map(o=>({storeKey:o.key}))};L(this,RC).sendMessage(Bb.storeDeleteKeys,Rjn.toBinary(i),s)}on(e,n){const r=J6e.fromBinary.bind(J6e);L(this,RC).on(e,({payload:s,id:i})=>{const o=r(s);return n(o,i)})}}RC=new WeakMap,z4=new WeakMap;var eTn=Object.defineProperty,tTn=(t,e,n)=>e in t?eTn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,nTn=(t,e,n)=>(tTn(t,e+"",n),n),SEe=(t,e,n)=>{if(!e.has(t))throw TypeError("Cannot "+n)},Ot=(t,e,n)=>(SEe(t,e,"read from private field"),n?n.call(t):e.get(t)),Zi=(t,e,n)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,n)},ki=(t,e,n,r)=>(SEe(t,e,"write to private field"),e.set(t,n),n),Pi=(t,e,n)=>(SEe(t,e,"access private method"),n),sQ={},rTn={get exports(){return sQ},set exports(t){sQ=t}},qA=typeof Reflect=="object"?Reflect:null,WFe=qA&&typeof qA.apply=="function"?qA.apply:function(t,e,n){return Function.prototype.apply.call(t,e,n)},CW;qA&&typeof qA.ownKeys=="function"?CW=qA.ownKeys:Object.getOwnPropertySymbols?CW=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:CW=function(t){return Object.getOwnPropertyNames(t)};function sTn(t){console&&console.warn&&console.warn(t)}var Ngt=Number.isNaN||function(t){return t!==t};function ia(){ia.init.call(this)}rTn.exports=ia;sQ.once=lTn;ia.EventEmitter=ia;ia.prototype._events=void 0;ia.prototype._eventsCount=0;ia.prototype._maxListeners=void 0;var qFe=10;function zte(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(ia,"defaultMaxListeners",{enumerable:!0,get:function(){return qFe},set:function(t){if(typeof t!="number"||t<0||Ngt(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");qFe=t}});ia.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};ia.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Ngt(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Tgt(t){return t._maxListeners===void 0?ia.defaultMaxListeners:t._maxListeners}ia.prototype.getMaxListeners=function(){return Tgt(this)};ia.prototype.emit=function(t){for(var e=[],n=1;n<arguments.length;n++)e.push(arguments[n]);var r=t==="error",s=this._events;if(s!==void 0)r=r&&s.error===void 0;else if(!r)return!1;if(r){var i;if(e.length>0&&(i=e[0]),i instanceof Error)throw i;var o=new Error("Unhandled error."+(i?" ("+i.message+")":""));throw o.context=i,o}var l=s[t];if(l===void 0)return!1;if(typeof l=="function")WFe(l,this,e);else for(var c=l.length,d=Igt(l,c),n=0;n<c;++n)WFe(d[n],this,e);return!0};function _gt(t,e,n,r){var s,i,o;if(zte(n),i=t._events,i===void 0?(i=t._events=Object.create(null),t._eventsCount=0):(i.newListener!==void 0&&(t.emit("newListener",e,n.listener?n.listener:n),i=t._events),o=i[e]),o===void 0)o=i[e]=n,++t._eventsCount;else if(typeof o=="function"?o=i[e]=r?[n,o]:[o,n]:r?o.unshift(n):o.push(n),s=Tgt(t),s>0&&o.length>s&&!o.warned){o.warned=!0;var l=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=t,l.type=e,l.count=o.length,sTn(l)}return t}ia.prototype.addListener=function(t,e){return _gt(this,t,e,!1)};ia.prototype.on=ia.prototype.addListener;ia.prototype.prependListener=function(t,e){return _gt(this,t,e,!0)};function iTn(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Agt(t,e,n){var r={fired:!1,wrapFn:void 0,target:t,type:e,listener:n},s=iTn.bind(r);return s.listener=n,r.wrapFn=s,s}ia.prototype.once=function(t,e){return zte(e),this.on(t,Agt(this,t,e)),this};ia.prototype.prependOnceListener=function(t,e){return zte(e),this.prependListener(t,Agt(this,t,e)),this};ia.prototype.removeListener=function(t,e){var n,r,s,i,o;if(zte(e),r=this._events,r===void 0)return this;if(n=r[t],n===void 0)return this;if(n===e||n.listener===e)--this._eventsCount===0?this._events=Object.create(null):(delete r[t],r.removeListener&&this.emit("removeListener",t,n.listener||e));else if(typeof n!="function"){for(s=-1,i=n.length-1;i>=0;i--)if(n[i]===e||n[i].listener===e){o=n[i].listener,s=i;break}if(s<0)return this;s===0?n.shift():aTn(n,s),n.length===1&&(r[t]=n[0]),r.removeListener!==void 0&&this.emit("removeListener",t,o||e)}return this};ia.prototype.off=ia.prototype.removeListener;ia.prototype.removeAllListeners=function(t){var e,n,r;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[t]),this;if(arguments.length===0){var s=Object.keys(n),i;for(r=0;r<s.length;++r)i=s[r],i!=="removeListener"&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(e=n[t],typeof e=="function")this.removeListener(t,e);else if(e!==void 0)for(r=e.length-1;r>=0;r--)this.removeListener(t,e[r]);return this};function Pgt(t,e,n){var r=t._events;if(r===void 0)return[];var s=r[e];return s===void 0?[]:typeof s=="function"?n?[s.listener||s]:[s]:n?oTn(s):Igt(s,s.length)}ia.prototype.listeners=function(t){return Pgt(this,t,!0)};ia.prototype.rawListeners=function(t){return Pgt(this,t,!1)};ia.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Rgt.call(t,e)};ia.prototype.listenerCount=Rgt;function Rgt(t){var e=this._events;if(e!==void 0){var n=e[t];if(typeof n=="function")return 1;if(n!==void 0)return n.length}return 0}ia.prototype.eventNames=function(){return this._eventsCount>0?CW(this._events):[]};function Igt(t,e){for(var n=new Array(e),r=0;r<e;++r)n[r]=t[r];return n}function aTn(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function oTn(t){for(var e=new Array(t.length),n=0;n<e.length;++n)e[n]=t[n].listener||t[n];return e}function lTn(t,e){return new Promise(function(n,r){function s(o){t.removeListener(e,i),r(o)}function i(){typeof t.removeListener=="function"&&t.removeListener("error",s),n([].slice.call(arguments))}Mgt(t,e,i,{once:!0}),e!=="error"&&cTn(t,s,{once:!0})})}function cTn(t,e,n){typeof t.on=="function"&&Mgt(t,"error",e,n)}function Mgt(t,e,n,r){if(typeof t.on=="function")r.once?t.once(e,n):t.on(e,n);else if(typeof t.addEventListener=="function")t.addEventListener(e,function s(i){r.once&&t.removeEventListener(e,s),n(i)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}class dTn extends We{constructor(){super("message.v1.SocketMessage",[{no:1,name:"event",kind:"scalar",T:13},{no:2,name:"id",kind:"scalar",opt:!0,T:9},{no:3,name:"payload",kind:"scalar",opt:!0,T:12},{no:4,name:"metadata",kind:"scalar",opt:!0,T:12}])}}const KFe=new dTn;class Lgt{static encode(e){return KFe.toBinary(e)}static decode(e){return KFe.fromBinary(new Uint8Array(e))}}function uTn(t,e){return Math.floor(Math.random()*(e-t+1)+t)}var Lw;class hTn{constructor(e={}){nTn(this,"opts"),Zi(this,Lw,void 0),this.opts={initialTimeout:e.initialTimeout||1e3,maxTimeout:e.maxTimeout||1e4,factor:e.factor||2},ki(this,Lw,0)}wait(){return me(this,null,function*(){ki(this,Lw,Ot(this,Lw)+1);const e=uTn(0,Math.min(this.opts.maxTimeout,this.opts.initialTimeout*cpn(2,Ot(this,Lw))));yield new Promise(n=>{setTimeout(n,e)})})}getAttempts(){return Ot(this,Lw)}reset(){ki(this,Lw,0)}}Lw=new WeakMap;const aw={debug:0,info:1,warn:2,error:3};var IC,MC;class mTn{constructor(e){Zi(this,IC,void 0),Zi(this,MC,void 0),ki(this,IC,console),ki(this,MC,e)}debug(...e){aw[Ot(this,MC)]>aw.debug||Ot(this,IC).debug("[Sockrates]:",...e)}info(...e){aw[Ot(this,MC)]>aw.info||Ot(this,IC).info("[Sockrates]:",...e)}warn(...e){aw[Ot(this,MC)]>aw.warn||Ot(this,IC).warn("[Sockrates]:",...e)}error(...e){aw[Ot(this,MC)]>aw.error||Ot(this,IC).error("[Sockrates]:",...e)}}IC=new WeakMap,MC=new WeakMap;var Dgt=(t=>(t[t.CONNECTING=0]="CONNECTING",t[t.OPEN=1]="OPEN",t[t.CLOSING=2]="CLOSING",t[t.CLOSED=3]="CLOSED",t))(Dgt||{});const YFe="2",QFe="3";var Ko,w_,Xi,_o,Dw,Rc,ex,P1,Kp,k_,S_,Lb,pye,$gt,V4,jW,gye,Ogt,EW,lce,iQ,vye,yye,Fgt,JD,NW,KA,XD,aQ,bye,YA,e$,xye,Bgt,t$,TW,n$,oQ;class fTn{constructor(e,n){var r;Zi(this,pye),Zi(this,V4),Zi(this,gye),Zi(this,EW),Zi(this,iQ),Zi(this,yye),Zi(this,JD),Zi(this,KA),Zi(this,aQ),Zi(this,YA),Zi(this,xye),Zi(this,t$),Zi(this,n$),Zi(this,Ko,void 0),Zi(this,w_,void 0),Zi(this,Xi,void 0),Zi(this,_o,void 0),Zi(this,Dw,void 0),Zi(this,Rc,void 0),Zi(this,ex,void 0),Zi(this,P1,void 0),Zi(this,Kp,void 0),Zi(this,k_,void 0),Zi(this,S_,void 0),Zi(this,Lb,void 0);var s,i,o,l,c,d,u,h,m,f,p;ki(this,w_,e),ki(this,Dw,[]),ki(this,Rc,new sQ),ki(this,ex,!0),ki(this,Kp,!1),ki(this,Xi,n??{}),(s=Ot(this,Xi)).autoReconnect!=null||(s.autoReconnect=!0),(i=Ot(this,Xi)).retryConnectionInterval!=null||(i.retryConnectionInterval=1e3),(o=Ot(this,Xi)).pingTimeout!=null||(o.pingTimeout=3e4),(l=Ot(this,Xi)).connectionTimeout!=null||(l.connectionTimeout=5e3),(c=Ot(this,Xi)).debug!=null||(c.debug=!0),(d=Ot(this,Xi)).maxReconnectionAttempts!=null||(d.maxReconnectionAttempts=10),(u=Ot(this,Xi)).disconnectOnPingTimeout!=null||(u.disconnectOnPingTimeout=!0),(h=Ot(this,Xi)).queueOnDisconnect!=null||(h.queueOnDisconnect=!1),(m=Ot(this,Xi)).flushOnReconnect!=null||(m.flushOnReconnect=!1),(f=Ot(this,Xi)).clientInitiatedPings!=null||(f.clientInitiatedPings=!1),(p=Ot(this,Xi)).clientInitiatedPingInterval!=null||(p.clientInitiatedPingInterval=3e4),ki(this,P1,{code:void 0,reason:void 0}),ki(this,_o,(r=Ot(this,Xi).logger)!=null?r:new mTn(Ot(this,Xi).debug?"debug":"info")),ki(this,Lb,new hTn)}get readyState(){var e;return(e=Ot(this,Ko))==null?void 0:e.readyState}get url(){return Ot(this,w_)}updateURL(e){ki(this,w_,e),Pi(this,yye,Fgt).call(this)}get config(){return Ot(this,Xi)}get sendQueue(){return Ot(this,Dw)}flush(){if(!Ot(this,Xi).queueOnDisconnect)return!1;const e=[];return Ot(this,Dw).forEach(n=>{this.send(n.event,n.id,n.payload,n.metadata)||e.push(n)}),ki(this,Dw,e),Ot(this,Dw)}connect(e=!1){return me(this,null,function*(){if(!e&&[0,1].includes(this.readyState)){Ot(this,_o).debug("Websocket was already connecting or connected.");return}if(Ot(this,ex)!==!1)return new Promise((n,r)=>{Pi(this,YA,e$).call(this),Pi(this,n$,oQ).call(this);try{ki(this,Ko,new WebSocket(Pi(this,pye,$gt).call(this,Ot(this,w_)))),Ot(this,Ko).binaryType="arraybuffer",Ot(this,_o).debug("Connecting");const s=setTimeout(()=>{Ot(this,_o).debug("Connection timeout. Closing socket"),ki(this,ex,!0),Pi(this,n$,oQ).call(this),Ot(this,Ko).close(3001,"Connection Timeout"),Ot(this,Xi).autoReconnect&&!Ot(this,Kp)&&(Ot(this,Rc).emit("reconnecting"),Pi(this,JD,NW).call(this)),r(new Error("Connection timed out!"))},Ot(this,Xi).connectionTimeout);Ot(this,Ko).onopen=()=>{Ot(this,_o).debug(`Ready State: ${Dgt[Ot(this,Ko).readyState]}`),s&&clearTimeout(s),Pi(this,aQ,bye).call(this),Pi(this,xye,Bgt).call(this),ki(this,P1,{code:void 0,reason:void 0}),Ot(this,Rc).emit("connected"),Ot(this,Xi).flushOnReconnect&&this.flush(),n()},Ot(this,Ko).onclose=i=>{try{s&&clearTimeout(s);const{code:o,reason:l}=i;r(l),Ot(this,_o).debug("Socket closed. Close event:",{event:i}),Ot(this,_o).debug(`Connection closed code: ${o}`),Ot(this,_o).debug(`Connection closed reason: ${l}`),Ot(this,Kp)||Pi(this,iQ,vye).call(this,o,l)}catch(o){Pi(this,V4,jW).call(this,o)}},Ot(this,Ko).onerror=i=>{Pi(this,V4,jW).call(this,i)},Ot(this,Ko).onmessage=i=>Pi(this,gye,Ogt).call(this,i)}catch(s){Pi(this,V4,jW).call(this,s,r)}})})}send(e,n,r,s){const i={event:e,id:n,payload:r,metadata:s};if(Ot(this,Xi).queueOnDisconnect&&(!Ot(this,Ko)||Ot(this,Ko).readyState!==1))return Ot(this,_o).debug("Queuing message since socket is not connected!",i),Ot(this,Dw).push(i),!1;const o=Lgt.encode(i);return Pi(this,KA,XD).call(this,o)}emit(e,n,r,s){return this.send(e,n,r,s)}sendRaw(e){return Pi(this,KA,XD).call(this,e)}receive(e,n){return Ot(this,Rc).on(e.toString(),n)}on(e,n){if(typeof e=="string"&&(e==="connected"||e==="disconnected"||e==="errored"||e==="reconnected"||e==="reconnecting"||e==="reconnectAttempt"||e==="reconnectFailure"||e==="failed")){Ot(this,Rc).on(e,n);return}this.receive(e,n)}removeAllListeners(){Ot(this,Rc).removeAllListeners()}removeReceiver(e,n){this.removeListener(e,n)}removeListener(e,n){Ot(this,Rc).removeListener(e.toString(),n)}removeReceivers(e){this.removeListeners(e)}removeListeners(e){Ot(this,Rc).listeners(e.toString()).map(n=>this.removeListener(e,n))}disconnect(){ki(this,ex,!1),Pi(this,YA,e$).call(this),Pi(this,t$,TW).call(this),this.removeAllListeners(),ki(this,P1,{code:1e3,reason:"Sockrates disconnect method called"}),Ot(this,Ko).close(1e3,"Sockrates disconnect method called.")}}Ko=new WeakMap,w_=new WeakMap,Xi=new WeakMap,_o=new WeakMap,Dw=new WeakMap,Rc=new WeakMap,ex=new WeakMap,P1=new WeakMap,Kp=new WeakMap,k_=new WeakMap,S_=new WeakMap,Lb=new WeakMap,pye=new WeakSet,$gt=function(t){if(t.startsWith("ws://")||t.startsWith("wss://"))return t;if(t.startsWith("https://"))return`wss://${t.substring(8)}`;if(t.startsWith("http://"))return`ws://${t.substring(7)}`;throw new Error("Invalid URL. URL must start with http(s):// or ws(s)://.")},V4=new WeakSet,jW=function(t,e){Ot(this,_o).error("Error:",{error:t}),Ot(this,Rc).emit("errored",{error:t}),e==null||e(t)},gye=new WeakSet,Ogt=function(t){if(Pi(this,aQ,bye).call(this),t.data===YFe){Ot(this,_o).debug("Received ping from server"),Pi(this,KA,XD).call(this,QFe);return}if(t.data===QFe){Ot(this,_o).debug("Received pong from server");return}const e=Lgt.decode(t.data),{id:n,payload:r}=e;Ot(this,_o).debug("Received message",{event:e.event,messageID:n}),Ot(this,Rc).emit(e.event.toString(),{id:n,payload:r})},EW=new WeakSet,lce=function(){return Ot(this,Ko).readyState===1},iQ=new WeakSet,vye=function(t,e){ki(this,P1,{reason:e,code:t}),Ot(this,Rc).emit("disconnected",{code:t,reason:e})},yye=new WeakSet,Fgt=function(){const{reason:t,code:e}=Ot(this,P1);e&&e!==1e3&&Ot(this,ex)&&Ot(this,Xi).autoReconnect&&!Ot(this,Kp)&&(Ot(this,_o).debug(`Triggering reconnection due to ${t}.`),Ot(this,Rc).emit("reconnecting"),Pi(this,JD,NW).call(this))},JD=new WeakSet,NW=function(t=!0){return me(this,null,function*(){if(t&&Ot(this,Kp)){Ot(this,_o).debug("Reconnect called when already in a reconnect loop. Ignoring.");return}if(Ot(this,Kp)||Ot(this,Lb).reset(),Ot(this,Xi).maxReconnectionAttempts!==null&&Ot(this,Lb).getAttempts()>=Ot(this,Xi).maxReconnectionAttempts){Ot(this,Rc).emit("failed"),ki(this,Kp,!1);return}ki(this,Kp,!0),Pi(this,n$,oQ).call(this),Pi(this,YA,e$).call(this);try{if(yield Ot(this,Lb).wait(),Ot(this,ex)===!1)return;if(Ot(this,_o).debug(`Reconnection attempt ${Ot(this,Lb).getAttempts()}`),Ot(this,Rc).emit("reconnectAttempt",{attempt:Ot(this,Lb).getAttempts()}),yield this.connect(),!Pi(this,EW,lce).call(this))throw Error("Reconnect Failed");ki(this,Kp,!1),ki(this,P1,{code:void 0,reason:void 0}),Ot(this,Rc).emit("reconnected")}catch{Ot(this,_o).debug("Failed to reconnect."),Ot(this,Rc).emit("reconnectFailure",{attempt:Ot(this,Lb).getAttempts()}),Pi(this,JD,NW).call(this,!1)}})},KA=new WeakSet,XD=function(t){try{return Ot(this,Ko).send(t),!0}catch(e){return Ot(this,_o).error(e.message),!1}},aQ=new WeakSet,bye=function(){this.config.disconnectOnPingTimeout&&(Ot(this,_o).debug("Resetting ping timeout"),Pi(this,YA,e$).call(this),ki(this,k_,setTimeout(()=>{var t;Ot(this,_o).debug("Disconnecting the socket due to ping timeout"),ki(this,ex,!0);const e=3002,n="Ping timeout";(t=Ot(this,Ko))==null||t.close(e,n),Pi(this,iQ,vye).call(this,e,n)},Ot(this,Xi).pingTimeout)))},YA=new WeakSet,e$=function(){Ot(this,k_)&&(clearTimeout(Ot(this,k_)),ki(this,k_,void 0))},xye=new WeakSet,Bgt=function(){Pi(this,t$,TW).call(this),Ot(this,Xi).clientInitiatedPings&&ki(this,S_,setInterval(()=>{Pi(this,EW,lce).call(this)&&(Ot(this,_o).debug("Sending client-initiated ping"),Pi(this,KA,XD).call(this,YFe))},Ot(this,Xi).clientInitiatedPingInterval))},t$=new WeakSet,TW=function(){Ot(this,S_)&&(clearInterval(Ot(this,S_)),ki(this,S_,void 0))},n$=new WeakSet,oQ=function(){Pi(this,t$,TW).call(this),Ot(this,Ko)&&(Ot(this,Ko).onopen=void 0,Ot(this,Ko).onerror=void 0,Ot(this,Ko).onmessage=void 0,Ot(this,Ko).onclose=void 0)};var pTn=Object.defineProperty,gTn=Object.getOwnPropertyDescriptor,Vte=(t,e,n,r)=>{for(var s=gTn(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&pTn(e,n,s),s};const ZFe=65535,vTn=3e3;var eC,zo,Vo,cl,pp,Yc,Oz,cce,Fz,dce,JFe;const Ugt=(JFe=class{constructor(t,{peerId:e,meetingId:n,authToken:r,capabilities:s}){if(Se(this,Vo),Se(this,Oz),Se(this,Fz),Se(this,eC,void 0),Se(this,zo,void 0),xe(this,"roomName"),xe(this,"authToken"),xe(this,"capabilities"),Se(this,pp,void 0),Se(this,Yc,void 0),!e||!n||!r)throw new _t("peerId, meetingId, or authToken can not be empty","0404");Te(this,pp,void 0),Te(this,Yc,t),this.capabilities=s,this.roomName=n,this.authToken=r,Te(this,eC,In(this,Oz,cce).call(this,e));const i=s.includes("PING");Te(this,zo,new fTn(L(this,eC),{autoReconnect:!0,disconnectOnPingTimeout:i,queueOnDisconnect:!1,flushOnReconnect:!1,logger:this.logger,clientInitiatedPings:!i,maxReconnectionAttempts:50,clientInitiatedPingInterval:15e3})),this.handleSocketConnectionEvents()}get joinAttempted(){return L(this,Vo,cl).socketJoinAttempted}set joinAttempted(t){L(this,Vo,cl).socketJoinAttempted=t}get telemetry(){return L(this,Yc).getValue("telemetry")}get logger(){return L(this,Yc).getValue("logger")}get peerId(){return L(this,Yc).getValue("peerId")}updateURL(t){t!==this.peerId&&(Te(this,eC,In(this,Oz,cce).call(this,t)),this.logger.debug("SocketService:: Connection URL updated.")),L(this,zo).updateURL(L(this,eC))}static getSocketEdgeDomain(t){return GA({servicePrefix:"socket-edge",baseURI:t})}get url(){return L(this,eC)}connect(){return me(this,null,function*(){L(this,Vo,cl).socketJoinAttempted=!0,yield L(this,zo).connect(),L(this,Vo,cl).socketJoinAttempted=!0,L(this,Vo,cl).socketState={state:"connected",reconnected:!1,reconnectionAttempt:void 0}})}disconnect(){L(this,Vo,cl).socketJoinAttempted=!1,L(this,zo).disconnect(),L(this,Vo,cl).socketJoinAttempted=!0,L(this,Vo,cl).socketState={state:"disconnected",reconnected:!1,reconnectionAttempt:void 0}}get isConnected(){try{return L(this,zo).readyState===1}catch{return!1}}sendMessage(t,e,n){const r={};return L(this,Yc).getValue("telemetry").injectContext(r),L(this,zo).send(t,n??In(this,Fz,dce).call(this),e,new TextEncoder().encode(JSON.stringify(r)))}sendMessagePromise(t,e,n,r){const s=parseInt({}.SOCKET_SERVICE_MESSAGE_REQUEST_TIMEOUT,10)||2e4;return this.sendMessagePromiseWithTimeout({event:t,timeout:s,protobuf:e,messageId:n,resp:r})}sendMessagePromiseWithTimeout({event:t,timeout:e,protobuf:n,messageId:r,resp:s}){const i=s??t;return new Promise((o,l)=>{const c=(f,p)=>{L(this,zo).removeListener(i,f),L(this,zo).removeListener(ZFe,p),L(this,zo).removeListener(qw.errorResponse,p),L(this,zo).removeListener(tg.errorResponse,p)},d=r??In(this,Fz,dce).call(this),u={};L(this,Yc).getValue("telemetry").injectContext(u);const h=({id:f,payload:p})=>{if(d===f){let g;try{const v=B1n.fromBinary(p);g=new Error(v.errorMessage)}catch(v){g=new Error("failed to parse error message",{cause:v});try{const b=Ukn.fromBinary(p);g=new Error(b.message)}catch(b){g=new Error("failed to parse error message",{cause:b})}}l(g),c(m,h)}},m=({id:f,payload:p})=>{d===f&&(o({id:f,payload:p}),c(m,h))};L(this,zo).on(i,m),L(this,zo).on(ZFe,h),L(this,zo).on(qw.errorResponse,h),L(this,zo).on(tg.errorResponse,h),setTimeout(()=>{c(m,h),l(new Error(`request timeout for callback eventId:${t}`))},e),L(this,zo).send(t,d,n,new TextEncoder().encode(JSON.stringify(u)))})}on(t,e){L(this,zo).on(t,e)}onStateEvent(t,e){L(this,zo).on(t,e)}removeListener(t,e){L(this,zo).removeListener(t,e)}removeListeners(t){L(this,zo).removeListeners(t)}flush(){return L(this,zo).flush()}handleSocketConnectionEvents(){this.onStateEvent("connected",()=>me(this,null,function*(){this.logger.info("SocketService::Connected to socket-edge"),L(this,pp)&&(clearTimeout(L(this,pp)),Te(this,pp,void 0)),L(this,Vo,cl).updateSocketConnectionState("connected")})),this.onStateEvent("disconnected",({code:t,reason:e})=>{var n;this.logger.info("SocketService::Disconnected from socket-edge",{error:{code:t,reason:e}});const{recv:r,send:s}=(n=L(this,Vo,cl).mediaState)!=null?n:{};r!=null&&r.state&&(r==null?void 0:r.state)!==Lk.CONNECTED||s!=null&&s.state&&(s==null?void 0:s.state)!==Lk.CONNECTED?L(this,Yc).getValue("peerSessionStore").emit(Et.SOCKET_SERVICE_DISCONNECTED,{joinAttempted:L(this,Vo,cl).joinAttempted}):Te(this,pp,setTimeout(()=>{L(this,Yc).getValue("peerSessionStore").emit(Et.SOCKET_SERVICE_DISCONNECTED,{joinAttempted:L(this,Vo,cl).joinAttempted}),Te(this,pp,void 0)},vTn)),L(this,Vo,cl).updateSocketConnectionState("disconnected")}),this.onStateEvent("reconnecting",()=>me(this,null,function*(){this.logger.info("SocketService::Reconnecting to socket-edge"),L(this,Vo,cl).updateSocketConnectionState("reconnecting")})),this.onStateEvent("reconnectAttempt",t=>me(this,[t],function*({attempt:e}){this.logger.info("SocketService::Attempting to reconnect to socket-edge",{socket:{retryAttempt:e}}),L(this,Vo,cl).updateSocketConnectionState("reconnectAttempt",e)})),this.onStateEvent("reconnectFailure",({attempt:t})=>{this.logger.info("SocketService::Reconnect attempt to socket-edge failed",{socket:{retryAttempt:t}}),L(this,Vo,cl).updateSocketConnectionState("reconnectFailure",t)}),this.onStateEvent("reconnected",()=>me(this,null,function*(){this.logger.info("SocketService::Reconnected to socket-edge",{connectionState:{joinAttempted:L(this,Vo,cl).mediaJoinAttempted}}),L(this,pp)&&(clearTimeout(L(this,pp)),Te(this,pp,void 0)),L(this,Yc).getValue("peerSessionStore").emit(Et.SOCKET_SERVICE_RECONNECTED,{wasJoinAttempted:L(this,Vo,cl).mediaJoinAttempted}),L(this,Vo,cl).updateSocketConnectionState("reconnected")})),this.onStateEvent("failed",()=>me(this,null,function*(){this.logger.info("SocketService::Failed to connect to socket-edge"),L(this,Yc).getValue("peerSessionStore").emit(Et.SOCKET_SERVICE_FAILED),L(this,Vo,cl).updateSocketConnectionState("failed")}))}},eC=new WeakMap,zo=new WeakMap,Vo=new WeakSet,cl=function(){return L(this,Yc).getValue("connectionHandler")},pp=new WeakMap,Yc=new WeakMap,Oz=new WeakSet,cce=function(t){const e=L(this,Yc).getValue("socketBaseURI")||L(this,Yc).getValue("baseURI");let n=Ugt.getSocketEdgeDomain(e);typeof bR(L(this,Yc),"socket_server_base")=="string"&&(n=bR(L(this,Yc),"socket_server_base"));const r=`wss://${n}`,s=new URL(`${r}/ws`),i=this.peerId,o=Dr(en({roomID:this.roomName,peerID:t,authToken:this.authToken,useMediaV2:!0},i!==t&&{oldPeerID:i}),{ping:this.capabilities.includes("PING"),capabilities:this.capabilities.map(l=>HY[l]).join(" "),joinWithDetails:!0,useCfWorker:!0,useStartSession:!0});return Object.entries(o).forEach(([l,c])=>{s.searchParams.append(l,c.toString())}),s.href},Fz=new WeakSet,dce=function(){return`${this.peerId}-${(Math.random()+1).toString(36).substring(7)}`},JFe);let N7=Ugt;Vte([ut.trace("SocketService.connect")],N7.prototype,"connect");Vte([ut.trace("SocketService.disconnect")],N7.prototype,"disconnect");Vte([ut.trace("SocketService.sendMessagePromise")],N7.prototype,"sendMessagePromise");Vte([ut.trace("SocketService.sendMessagePromiseWithTimeout")],N7.prototype,"sendMessagePromiseWithTimeout");class yTn{constructor(e){xe(this,"socketService"),this.socketService=e}handleConnectedRoomsDumpRaw({payload:e}){var n;const r=fSn.fromBinary(e),s=r.meetings.map(i=>{var o;return{id:i.id,title:i.title,participants:(o=i.participants)!=null?o:[]}});return{parentMeeting:{id:r.parentMeeting.id,title:r.parentMeeting.title,participants:(n=r.parentMeeting.participants)!=null?n:[]},meetings:s}}handleTransferPeerRaw({payload:e}){const n=BSn.fromBinary(e);return{authToken:n.authToken,meetingId:n.meetingId}}handleMovedPeerRaw({payload:e}){const n=Rpt.fromBinary(e);return{meetingId:n.meetingId,customParticipantId:n.customParticipantId}}handleConnectedRoomsUpdatedRaw({payload:e}){return K6e.fromBinary(e).payloads.map(n=>({id:n.id,title:n.title}))}handleConnectedRoomsDeletedRaw({payload:e}){return ASn.fromBinary(e).payloads}getConnectedRoomsDump(){return me(this,null,function*(){const e=yield this.socketService.sendMessagePromise(Rn.getConnectedRoomsDump);return this.handleConnectedRoomsDumpRaw(e)})}createConnectedRooms(e){return me(this,null,function*(){const{payload:n}=yield this.socketService.sendMessagePromise(Rn.createConnectedRooms,ySn.toBinary({payloads:e}));return K6e.fromBinary(n).payloads.map(r=>({id:r.id,title:r.title}))})}updateConnectedRooms(e){return me(this,null,function*(){})}disableConnectedRooms(e){return me(this,null,function*(){const n=e.map(s=>({id:s})),r=yield this.socketService.sendMessagePromise(Rn.deleteConnectedRooms,TSn.toBinary({payloads:n}));return this.handleConnectedRoomsDeletedRaw(r)})}movePeersBetweenRooms(e){return me(this,null,function*(){try{const n=yield this.socketService.sendMessagePromise(Rn.movePeers,DSn.toBinary({sourceMeetingId:e.sourceMeetingId,destinationMeetingId:e.destinationMeetingId,participants:e.participants}));return new TextDecoder().decode(n.payload).includes("error")?{success:!1,error:"failed to move participants"}:{success:!0}}catch(n){return{success:!1,error:n}}})}}var bTn=Object.defineProperty,xTn=Object.getOwnPropertyDescriptor,wTn=(t,e,n,r)=>{for(var s=xTn(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&bTn(e,n,s),s},Xm;class zgt extends Dm{constructor(e){const n=e.getValue("logger");super(n),xe(this,"meetings",[]),xe(this,"parentMeeting",null),Se(this,Xm,void 0),Te(this,Xm,e)}get isActive(){return this.meetings.length!==0}validateAlterAction(){const e=L(this,Xm).getValue("self").permissions.connectedMeetings;if(!(e!=null&&e.canAlterConnectedMeetings))throw new Error("You are not allowed to perform this action. Please enable canAlterConnectedMeetings permission in your preset.")}validateMoveAction(e,n){var r;if(!(n!=null&&n.length))throw new Error("You're trying to move participants with an empty list.");const s=L(this,Xm).getValue("self").permissions.connectedMeetings;if(!s)throw new Error("You are not allowed to perform this action. Please enable connected meetings permissions in your preset.");if(s.canAlterConnectedMeetings)return;const i=L(this,Xm).getValue("userId");if(!(n.length===1&&n[0]===i))throw new Error("You are not allowed to move other participants. Please enable canAlterConnectedMeetings permission in your preset.");if(e===((r=this.parentMeeting)==null?void 0:r.id)){if(!s.canSwitchToParentMeeting)throw new Error("You are not allowed to move to the parent meeting. Please enable canSwitchToParentMeeting permission in your preset.");return}if(!s.canSwitchConnectedMeetings)throw new Error("You are not allowed to move to a connected meeting. Please enable canSwitchConnectedMeetings permission in your preset.")}getConnectedMeetings(){return me(this,null,function*(){this.logger.info("Getting connected meetings dump");const e=yield L(this,Xm).getValue("connectedMeetingsSocketHandler").getConnectedRoomsDump();return this.logger.info("Got connected meetings dump"),e})}createMeetings(e){return me(this,null,function*(){this.validateAlterAction(),this.logger.info(`Creating connected meetings ${JSON.stringify(e)}`);const n=yield L(this,Xm).getValue("connectedMeetingsSocketHandler").createConnectedRooms(e);return this.logger.info(`Created connected meetings ${JSON.stringify(n)}`),n.map(r=>({id:r.id,title:r.title}))})}updateMeetings(e){return me(this,null,function*(){this.validateAlterAction(),this.logger.info(`Updating connected meetings ${JSON.stringify(e)}`),yield L(this,Xm).getValue("connectedMeetingsSocketHandler").updateConnectedRooms(e.map(n=>({meetingId:n.id,title:n.title}))),this.logger.info(`Updated connected meetings ${JSON.stringify(e)}`)})}deleteMeetings(e){return me(this,null,function*(){this.validateAlterAction(),this.logger.info(`Moving participants before deleting connected meetings ${JSON.stringify(e)}`);const n=this.meetings.map(s=>e.includes(s.id)&&s.participants.length!==0?this.moveParticipants(s.id,this.parentMeeting.id,s.participants.map(i=>i.id)):Promise.resolve());this.logger.info(`Moved participants before deleting connected meetings ${JSON.stringify(e)}. Deleting now.`),yield Promise.all(n);const r=yield L(this,Xm).getValue("connectedMeetingsSocketHandler").disableConnectedRooms(e);return this.logger.info(`Deleted connected meetings ${JSON.stringify(e)}`),r})}moveParticipants(e,n,r){return me(this,null,function*(){this.validateMoveAction(n,r),this.logger.info(`Moving connected meetings participants ${JSON.stringify(r)} from ${e} to ${n}`);const s=yield L(this,Xm).getValue("connectedMeetingsSocketHandler").movePeersBetweenRooms({sourceMeetingId:e,destinationMeetingId:n,participants:r.map(i=>({id:i}))});return s.success?(this.logger.info(`Moved connected meetings participants ${JSON.stringify(r)} from ${e} to ${n}`),this.moveSuccessHandler(e,n,r)):this.logger.error(`Failed to move connected meetings participants ${JSON.stringify(r)} from ${e} to ${n}`),s})}moveParticipantsWithCustomPreset(e,n,r){return me(this,null,function*(){this.validateMoveAction(n,r.map(i=>i.id)),this.logger.info(`Moving connected meetings participants (custom preset) ${JSON.stringify(r)} from ${e} to ${n}`);const s=yield L(this,Xm).getValue("connectedMeetingsSocketHandler").movePeersBetweenRooms({sourceMeetingId:e,destinationMeetingId:n,participants:r});return s.success?(this.logger.info(`Moved connected meetings participants (custom preset) ${JSON.stringify(r)} from ${e} to ${n}`),this.moveSuccessHandler(e,n,r.map(i=>i.id))):this.logger.error(`Failed to move connected meetings participants (custom preset) ${JSON.stringify(r)} from ${e} to ${n}`),s})}moveSuccessHandler(e,n,r){const s=new Map;[...this.parentMeeting.participants,...this.meetings.flatMap(i=>i.participants)].forEach(i=>s.set(i.id,i)),n===this.parentMeeting.id&&(this.parentMeeting.participants=this.parentMeeting.participants.concat(r.map(i=>s.get(i)))),e===this.parentMeeting.id&&(this.parentMeeting.participants=this.parentMeeting.participants.filter(i=>!r.includes(i.id))),this.meetings=this.meetings.map(i=>{if(n===i.id){const o=i.participants.concat(r.map(l=>s.get(l)));return Dr(en({},i),{participants:o})}if(e===i.id){const o=i.participants.filter(l=>!r.includes(l.id));return Dr(en({},i),{participants:o})}return i})}}Xm=new WeakMap;wTn([$m({maxInvocations:60,period:60})],zgt.prototype,"getConnectedMeetings");var kTn=Object.defineProperty,STn=Object.getOwnPropertyDescriptor,CEe=(t,e,n,r)=>{for(var s=STn(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&kTn(e,n,s),s},Ha,XFe;const Vgt=(XFe=class{constructor(t){xe(this,"connectedMeetings"),Se(this,Ha,void 0),Te(this,Ha,t),this.connectedMeetings=new zgt(t)}get telemetry(){return L(this,Ha).getValue("telemetry")}get logger(){return L(this,Ha).getValue("logger")}static init(t){const e=new Vgt(t);return t.getValue("self").once("roomJoined",()=>e.getConnectedMeetings()),e.setupEvents(),e}getConnectedMeetings(){this.connectedMeetings.getConnectedMeetings()}setupEvents(){L(this,Ha).getValue("connectedMeetingsSocketHandler").socketService.on(Rn.getConnectedRoomsDump,this.handleConnectedRoomsDump.bind(this)),L(this,Ha).getValue("connectedMeetingsSocketHandler").socketService.on(Rn.transferPeer,this.handleTransferPeer.bind(this)),L(this,Ha).getValue("connectedMeetingsSocketHandler").socketService.on(Rn.movedPeer,this.handleMovedPeer.bind(this)),L(this,Ha).getValue("connectedMeetingsSocketHandler").socketService.on(Rn.connectedRoomsUpdated,this.handleConnectedRoomsUpdated.bind(this)),L(this,Ha).getValue("connectedMeetingsSocketHandler").socketService.on(Rn.connectedRoomsDeleted,this.handleConnectedRoomsDeleted.bind(this))}handleTransferPeer(t){this.logger.info("Received backend request to switch connected meetings");const e=L(this,Ha).getValue("connectedMeetingsSocketHandler").handleTransferPeerRaw(t);return this.logger.info(`Honoring request to switch connected meetings. Going to ${e==null?void 0:e.meetingId}`),this.switchMeeting(e)}switchMeeting(t){return me(this,arguments,function*({authToken:e,meetingId:n}){var r,s,i,o;this.logger.info("ConnectedMeetingsController::switchMeeting:: asking ui-kit to show switching breakout UI"),this.connectedMeetings.emit("changingMeeting",n);const l={video:L(this,Ha).getValue("self").videoEnabled,audio:L(this,Ha).getValue("self").audioEnabled};try{L(this,Ha).getValue("self").cleanupEvents(),yield L(this,Ha).getValue("meeting").leave("connected-meeting")}catch(d){this.logger.error(`ConnectedMeetingsController:: switchMeeting:: issues in leaving previous meeting. Meeting Id: ${(s=(r=L(this,Ha).getValue("meeting"))==null?void 0:r.meta)==null?void 0:s.meetingId}`,{error:d})}this.logger.info(`ConnectedMeetingsController::switchMeeting:: initializing new meeting. Meeting Id: ${n}`);const c=yield Ggt.init(Dr(en({},L(this,Ha).getValue("options")),{cachedUserDetails:null,defaults:Dr(en(en({},L(this,Ha).getValue("options").defaults),l),{mediaHandler:L(this,Ha).getValue("self")}),authToken:e}));this.logger.info(`ConnectedMeetingsController::switchMeeting:: initialized new meeting. Meeting Id: ${(i=c==null?void 0:c.meta)==null?void 0:i.meetingId}`);try{const{hidden:d}=L(this,Ha).getValue("self");c.self.setName(L(this,Ha).getValue("self").name),yield c.join(),d&&c.self.hide()}catch(d){this.logger.error("ConnectedMeetingsController.joinRoom",{error:d})}return this.logger.info(`ConnectedMeetingsController::switchMeeting:: asking ui-kit to show in-meeting ui of newly joined meeting id: ${(o=c==null?void 0:c.meta)==null?void 0:o.meetingId}`),this.connectedMeetings.emit("meetingChanged",c),c})}handleConnectedRoomsDump(t){const e=L(this,Ha).getValue("connectedMeetingsSocketHandler").handleConnectedRoomsDumpRaw(t);this.connectedMeetings.meetings=e.meetings.map(n=>({id:n.id,title:n.title,participants:n.participants||[]})),this.connectedMeetings.parentMeeting={id:e.parentMeeting.id,title:e.parentMeeting.title,participants:e.parentMeeting.participants},this.emitStateUpdate()}handleMovedPeer(t){return L(this,Ha).getValue("connectedMeetingsSocketHandler").handleMovedPeerRaw(t)}handleConnectedRoomsUpdated(t){const e=L(this,Ha).getValue("connectedMeetingsSocketHandler").handleConnectedRoomsUpdatedRaw(t),n=new Map;this.connectedMeetings.meetings.forEach(r=>{n.set(r.id,r)}),e.forEach(r=>{n.has(r.id)?n.get(r.id).title=r.title:n.set(r.id,Dr(en({},r),{participants:[]}))}),this.connectedMeetings.meetings=Array.from(n.values()),this.emitStateUpdate()}handleConnectedRoomsDeleted(t){const e=L(this,Ha).getValue("connectedMeetingsSocketHandler").handleConnectedRoomsDeletedRaw(t).map(n=>n.id);this.connectedMeetings.meetings=this.connectedMeetings.meetings.filter(n=>!e.includes(n.id)),this.emitStateUpdate()}emitStateUpdate(){this.connectedMeetings.emit("stateUpdate",{meetings:this.connectedMeetings.meetings,parentMeeting:this.connectedMeetings.parentMeeting})}},Ha=new WeakMap,XFe);let Hte=Vgt;CEe([ut.trace("ConnectedMeetingsController.getConnectedMeetings")],Hte.prototype,"getConnectedMeetings");CEe([ut.trace("ConnectedMeetingsController.setupEvents")],Hte.prototype,"setupEvents");CEe([ut.trace("ConnectedMeetingsController.switchMeeting")],Hte.prototype,"switchMeeting");var CTn=Object.defineProperty,jTn=Object.getOwnPropertyDescriptor,jEe=(t,e,n,r)=>{for(var s=jTn(e,n),i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=o(e,n,s)||s);return s&&CTn(e,n,s),s};const H4=class{constructor(t,e,n){xe(this,"apiBase"),xe(this,"selfController"),xe(this,"pollController"),xe(this,"chatController"),xe(this,"metaController"),xe(this,"storesManager"),xe(this,"stageController"),xe(this,"pluginController"),xe(this,"internalsController"),xe(this,"recordingController"),xe(this,"livestreamController"),xe(this,"participantController"),xe(this,"connectedMeetingsController"),xe(this,"telemetry"),xe(this,"logger"),this.apiBase=t,this.storesManager=e.storesManager,this.metaController=e.metaController,this.selfController=e.selfController,this.chatController=e.chatController,this.pollController=e.pollController,this.stageController=e.stageController,this.pluginController=e.pluginController,this.recordingController=e.recordingController,this.internalsController=e.internalsController,this.participantController=e.participantController,this.livestreamController=e.livestreamController,this.connectedMeetingsController=e.connectedMeetingsController,this.telemetry=n.getValue("telemetry"),this.logger=n.getValue("logger")}static init(t){return me(this,null,function*(){var e,n,r;const{peerId:s,apiBase:i,authToken:o,meetingId:l,organizationId:c,cachedUserDetails:d,logger:u}=t.getAllValues();if(zNn(t),so.isSupported()===!1)throw new _t("Browser not supported","0010",u,!0);const h=L2n(t,{authToken:o,baseURL:i,cachedUserDetails:d});h.setRoomName(l),h.setRoomUUID(l),h.setOrganizationId(c),h.setHeader("tracing-id",s),t.setValue("apiClient",h);const m=new uEn(t);t.setValue("connectionHandler",m);let f="",p="",g=null;u.info("CF SFU is being used.");try{g=yield h.getUserDetails(),f=((e=g.meeting)==null?void 0:e.title)||"",p=((n=g.socket)==null?void 0:n.baseUri)||t.getValue("baseURI"),t.setValue("presetName",g.preset.name),t.setValue("socketBaseURI",p),u.info(`Socket Base URI ${p} is being used`)}catch(C){throw u.error("Failed to get user details",{error:C}),C instanceof pve?C.status===401?new _t("Unauthorized. The auth token may be invalid or expired. (401)","0004"):C.status===403?new _t("Access denied. Insufficient permissions to join the meeting. (403)","0004"):C.status===404?new _t("The auth token is not associated with an active participant in this meeting. The meeting may have ended, or the participant may no longer exist. (404)","0004"):C.status>=500?new _t(`The server encountered an error. Try again. (${C.status})`,"0001"):C.isHttpError?new _t(`Request rejected by the server. (${C.status})`,"0001"):C.isTimeout?new _t("Connection timed out. Check the network and try again.","0001"):new _t("Unable to connect to the server. Check the internet connection.","0001"):new _t((C==null?void 0:C.message)||"Failed to initialize.","0001")}const v=H4.createSocketService(t),b=v.connect();try{yield b}catch(C){u.error("[Controller]: Failed to connect to socket server:",{error:C})}const x=QEn.init(g.preset,!t.getValue("modules").theme);t.setValue("theme",x);const w=vNn.init(t,x.viewType,g.preset.permissions),k=H4.setupControllers(v,t,g,f,x,w);tEn(x)&&((r=H4.createRoomNodeClient(t,v).initializeConnection(g.participant.name,l,!1,w))==null||r.catch(C=>{u.error("[Controller]: Failed to queue partial media room promise:",{error:C})}));const{controllers:S}=yield k;return xwn(),new H4(i,S,t)})}static setupControllers(t,e,n,r,s,i){return me(this,null,function*(){var o,l,c;const d=e.getValue("modules"),{participant:u}=n,h=e.getValue("defaults"),m=e.getValue("logger"),{viewType:f,mediaConstraints:{audio:p}}=s;e.setValue("viewType",f),e.setValue("defaults",en({mediaConfiguration:{audio:{enableHighBitrate:(o=p.enableHighBitrate)!=null?o:!1,enableStereo:(l=p.enableStereo)!=null?l:!1}}},h)),e.setValue("maxPreferredStreams",so.isMobile()?s.maxVideoStreams.mobile:s.maxVideoStreams.desktop);let g,v,b,x,w,k,S,C,j;const E=new WNn(e,t),N=new yTn(t);e.setValue("connectedMeetingsSocketHandler",N);const A=new Ute(e,t),_=new A0(e,t),T=new JNn(t),R=new Egt(e,t),O=new XNn(e,t),F=new GNn(t),D=yield kS.init(e,R,u,i,s);e.setValue("selfController",D);const I=yield Hpt.init(e,D.self,R,E,r);d.participant&&(C=new I0(e,D.self,R)),(c=d.e2ee)!=null&&c.enabled&&d.e2ee.manager.init(m,e.getValue("peerSessionStore")),d.chat&&(v=yield UD.init(e,_,D.self,C.participants)),d.internals&&(w=yield hEe.init(e)),d.livestream&&s.viewType===Sx.Livestream&&(S=new egt(e,D.self,F)),d.poll&&(g=yield Bpt.init(e,D.self,A)),d.recording&&(k=new Ypt(e,D.self,R)),d.stage&&(b=new Gpt(e,T,R,D.self,C.participants));const P=new sNn(e,O);if(d.plugin){if(!C)throw new _t("The plugin module cannot be initialized without the `participant` module","0102");const M=h.plugins||[],z=yield P.create(gpt,!0);x=yield Kpt.init(e,M,z,D.self,P)}if(d.connectedMeetings&&(j=yield Hte.init(e)),d.pip){const M=yield Swn._init(e,D.self);e.setValue("pip",M)}return{theme:s,permissions:i,controllers:{storesManager:P,pollController:g,selfController:D,metaController:I,chatController:v,stageController:b,pluginController:x,recordingController:k,internalsController:w,livestreamController:S,participantController:C,connectedMeetingsController:j}}})}static createRoomNodeClient(t,e){const{peerId:n}=t.getAllValues();return Cgt(t,{socket:e,peerId:n})}static createSocketService(t){var e;const{peerId:n,meetingId:r,authToken:s}=t.getAllValues(),i=((e=t.getValue("socketBaseURI"))!=null?e:"").includes("realtime.cloudflare.com")?[]:["PING"];return t.getValue("logger").info(`Socket service capabilities: ${JSON.stringify(i)}`),new N7(t,{peerId:n,meetingId:r,authToken:s,capabilities:i})}};let Gte=H4;jEe([ut.trace("Controller.init")],Gte,"init");jEe([ut.trace("Controller.createRoomNodeClient")],Gte,"createRoomNodeClient");jEe([ut.trace("Controller.createSocketService")],Gte,"createSocketService");class ETn{constructor(){xe(this,"battery"),xe(this,"logger"),xe(this,"init",e=>me(this,null,function*(){this.logger=e;try{"getBattery"in navigator&&(this.battery=yield navigator.getBattery(),this.battery.addEventListener("chargingchange",this.updateChargeInfo),this.battery.addEventListener("levelchange",this.updateLevelInfo),this.updateLevelInfo(),this.updateChargeInfo())}catch(n){e.error("Error getting battery",n)}})),xe(this,"updateChargeInfo",()=>{var e;this.logger.log(`Battery charging? ${(e=this.battery)!=null&&e.charging?"Yes":"No"}`)}),xe(this,"updateLevelInfo",()=>{if(!this.battery){this.logger.log("Battery level: Not known");return}this.logger.log(`Battery level: ${this.battery.level*100}%`)}),xe(this,"cleanup",()=>{var e,n;"getBattery"in navigator&&((e=this.battery)==null||e.removeEventListener("chargingchange",this.updateChargeInfo),(n=this.battery)==null||n.removeEventListener("levelchange",this.updateLevelInfo))})}}const e8e=new ETn;function NTn(t,e){t.startsWith("eyJ")||console.error("Invalid auth token provided. Ensure you are passing a %cparticipant `authToken`%c — not an Org API Key or an incorrectly formatted token.\nYou get the participant token from the Add Participant API: https://docs.realtime.cloudflare.com/api#/operations/add_participant","font-weight: bold","font-weight: normal");try{const{meetingId:n,orgId:r,participantId:s}=JSON.parse(atob(t.split(".")[1]));if(!n)throw Error(`Received V1 auth token ${t}`);let i=wj.baseURI.prod;e&&(i=e);const o=`https://${GA({servicePrefix:"api",baseURI:i})}`;return{meetingId:n,orgId:r,participantId:s,baseURI:i,apiBase:o}}catch{throw new _t("Invalid auth token","0004")}}var LC,C_,j_,lQ,wye,Hgt;class TTn{constructor(){Se(this,wye),Se(this,LC,new Audio),Se(this,C_,new MediaStream),Se(this,j_,new Map),Se(this,lQ,void 0),L(this,LC).srcObject=L(this,C_),L(this,LC).autoplay=!0}playTracks(e){return me(this,null,function*(){return e.forEach(n=>{L(this,j_).has(n.id)||(L(this,C_).addTrack(n),L(this,j_).set(n.id,n))}),this.play()})}setSpeakerDevice(e){typeof HTMLAudioElement.prototype.setSinkId=="function"&&L(this,LC).setSinkId(e)}removeTrack(e){const n=L(this,j_).get(e);n&&(L(this,C_).removeTrack(n),L(this,j_).delete(e))}play(){return me(this,null,function*(){return L(this,LC).srcObject=L(this,C_),L(this,LC).play().catch(e=>{In(this,wye,Hgt).call(this,e)})})}onError(e){Te(this,lQ,e)}}LC=new WeakMap,C_=new WeakMap,j_=new WeakMap,lQ=new WeakMap,wye=new WeakSet,Hgt=function(t){var e;(e=L(this,lQ))==null||e.call(this,t)};var E_;class _Tn extends TTn{constructor(){super(),Se(this,E_,void 0),Te(this,E_,new Map)}addParticipantTrack(e,n){L(this,E_).set(e,n.id),this.playTracks([n])}removeParticipantTrack(e){const n=L(this,E_).get(e);n&&this.removeTrack(n),L(this,E_).delete(e)}}E_=new WeakMap;var ATn=Object.defineProperty,PTn=Object.getOwnPropertyDescriptor,Wte=(t,e,n,r)=>{for(var s=r>1?void 0:r?PTn(e,n):e,i=t.length-1,o;i>=0;i--)(o=t[i])&&(s=(r?o(e,n,s):o(s))||s);return r&&s&&ATn(e,n,s),s},jc,hT,t8e;let Dk=(t8e=class{constructor(t,e){Se(this,jc,void 0),Se(this,hT,void 0),Te(this,hT,t),Te(this,jc,e)}get peerId(){return L(this,hT).getValue("peerId")}static initMedia(){return me(this,arguments,function*(t={},e=!1,n=void 0){var r;const s=(r=n==null?void 0:n.peerId)!=null?r:pR(),i=nk.createContext(s,{peerId:s}),o=i.getValue("logger");o.init(i);const l=new igt(i,o);return yield l.init(t,e,i),i.setValue("defaults",{mediaHandler:l}),l})}static init(t){return me(this,null,function*(){var e,n,r,s,i,o,l,c,d;so.init();const u=(n=(e=t==null?void 0:t.cachedUserDetails)==null?void 0:e.peerId)!=null?n:pR(),{authToken:h,baseURI:m}=t,f=NTn(h,m),{meetingId:p}=f,g=U2e(f,["meetingId"]);if((r=g.baseURI)!=null&&r.includes("dyte.io"))throw new _t("Dyte Base URIs are no longer supported. Use RealtimeKit Base URIs.","0001");window.__zone_symbol__DISABLE_WRAPPING_UNCAUGHT_PROMISE_REJECTION=!0;const v=Dk.setupContext(u,t,p,g),b=v.getValue("telemetry"),x=v.getValue("logger");mpn(x),e8e.init(x),b.init(v,{roomName:p,userId:g.participantId,organizationId:g.orgId,peerId:u},(i=(s=t.modules)==null?void 0:s.tracing)!=null?i:!0,(l=(o=t==null?void 0:t.modules)==null?void 0:o.devTools)==null?void 0:l.logLevel),x.init(v),x.info("Client::init::options",{clientInitOptions:Dr(en({},t),{authToken:`${(c=t.authToken)==null?void 0:c.slice(0,10)}...
				${(d=t.authToken)==null?void 0:d.slice(-10)}`})});const w=yield Gte.init(v),k=new Dk(v,w);return v.setValue("meeting",k),k})}static setupContext(t,e,n,r){var s,i;const o=nk.createContext(t,e),l=en(en({},Z0n),e==null?void 0:e.modules),c=e.defaults||{audio:!0,video:!0};return o.setValue("options",e),o.setValue("peerId",t),o.setValue("modules",l),o.setValue("sdkName","web-core"),o.setValue("meetingId",n),o.setValue("apiBase",r.apiBase),o.setValue("baseURI",r.baseURI),o.setValue("userId",r.participantId),o.setValue("organizationId",r.orgId),o.setValue("authToken",e.authToken),o.setValue("overrides",(s=e.overrides)!=null?s:{}),o.setValue("env",J0n({baseURI:r.baseURI})),o.setValue("defaults",c),o.setValue("onError",e.onError||(()=>{})),o.setValue("cachedUserDetails",gy(e.cachedUserDetails)),o.setValue("sdkVersion","2.0.0"),(i=e.modules)!=null&&i.experimentalAudioPlayback&&o.setValue("audioPlayback",new _Tn),o}join(){return me(this,null,function*(){const{selfController:t}=L(this,jc);return t.self.roomJoined?null:t.joinRoom()})}leave(t){return me(this,null,function*(){e8e.cleanup(),L(this,hT).getValue("peerSessionStore").reset();const{selfController:e}=L(this,jc);return e.leaveRoom(t)})}get participants(){var t;return(t=L(this,jc).participantController)==null?void 0:t.participants}get self(){var t;return(t=L(this,jc).selfController)==null?void 0:t.self}get meta(){var t;return(t=L(this,jc).metaController)==null?void 0:t.meta}get ai(){var t;return(t=L(this,jc).metaController)==null?void 0:t.ai}get plugins(){var t;return(t=L(this,jc).pluginController)==null?void 0:t.plugins}get chat(){var t;return(t=L(this,jc).chatController)==null?void 0:t.chat}get polls(){var t;return(t=L(this,jc).pollController)==null?void 0:t.polls}get connectedMeetings(){var t;return(t=L(this,jc).connectedMeetingsController)==null?void 0:t.connectedMeetings}get recording(){var t;return(t=L(this,jc).recordingController)==null?void 0:t.recording}get livestream(){var t;return(t=L(this,jc).livestreamController)==null?void 0:t.livestream}get stage(){var t;return(t=L(this,jc).stageController)==null?void 0:t.stage}get stores(){return L(this,jc).storesManager}get audio(){return L(this,hT).getValue("audioPlayback")}get __internals__(){var t;return(t=L(this,jc).internalsController)==null?void 0:t.internals}},jc=new WeakMap,hT=new WeakMap,t8e);Wte([tu("0002"),R0.executeWithLock({methodName:"meeting.join",lockName:"Client.join",timeout:3e3})],Dk.prototype,"join",1);Wte([tu("0003")],Dk.prototype,"leave",1);Wte([tu("0001"),R0.executeWithLock({methodName:"Client.init",lockName:"Client.init",timeout:3e3})],Dk,"init",1);Dk=Wte([tu("0000")],Dk);const Ggt=Dk;var RTn=Object.defineProperty,ITn=(t,e,n)=>e in t?RTn(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,uce=(t,e,n)=>(ITn(t,typeof e!="symbol"?e+"":e,n),n);class MTn{constructor(e){uce(this,"meeting"),uce(this,"l"),uce(this,"onUpdate",()=>{this.l.forEach(x=>{x()})});var n,r,s,i,o,l,c,d,u,h,m,f,p,g,v,b;this.meeting=e,this.l=new Set,(n=this.meeting.self)==null||n.addListener("*",this.onUpdate),(r=this.meeting.meta)==null||r.addListener("*",this.onUpdate),(s=this.meeting.participants)==null||s.addListener("*",this.onUpdate),(o=(i=this.meeting.participants)==null?void 0:i.joined)==null||o.addListener("*",this.onUpdate),(c=(l=this.meeting.participants)==null?void 0:l.active)==null||c.addListener("*",this.onUpdate),(u=(d=this.meeting.participants)==null?void 0:d.waitlisted)==null||u.addListener("*",this.onUpdate),(h=this.meeting.stage)==null||h.addListener("*",this.onUpdate),(m=this.meeting.livestream)==null||m.addListener("*",this.onUpdate),(f=this.meeting.chat)==null||f.addListener("*",this.onUpdate),(p=this.meeting.plugins)==null||p.all.addListener("*",this.onUpdate),(g=this.meeting.recording)==null||g.addListener("*",this.onUpdate),(v=this.meeting.connectedMeetings)==null||v.addListener("*",this.onUpdate),(b=this.meeting.polls)==null||b.addListener("*",this.onUpdate)}clean(){var e,n,r,s,i,o,l,c,d,u,h,m,f,p,g,v;(e=this.meeting.self)==null||e.removeListener("*",this.onUpdate),(n=this.meeting.meta)==null||n.removeListener("*",this.onUpdate),(r=this.meeting.participants)==null||r.removeListener("*",this.onUpdate),(i=(s=this.meeting.participants)==null?void 0:s.joined)==null||i.removeListener("*",this.onUpdate),(l=(o=this.meeting.participants)==null?void 0:o.active)==null||l.removeListener("*",this.onUpdate),(d=(c=this.meeting.participants)==null?void 0:c.waitlisted)==null||d.removeListener("*",this.onUpdate),(u=this.meeting.stage)==null||u.removeListener("*",this.onUpdate),(h=this.meeting.livestream)==null||h.removeListener("*",this.onUpdate),(m=this.meeting.chat)==null||m.removeListener("*",this.onUpdate),(f=this.meeting.plugins)==null||f.all.removeListener("*",this.onUpdate),(p=this.meeting.recording)==null||p.removeListener("*",this.onUpdate),(g=this.meeting.connectedMeetings)==null||g.removeListener("*",this.onUpdate),(v=this.meeting.polls)==null||v.removeListener("*",this.onUpdate)}addListener(e){this.l.add(e)}removeListener(e){this.l.delete(e)}}const EEe=y.createContext({meeting:void 0,updates:void 0});function Wgt({value:t,children:e,fallback:n}){const[r,s]=y.useState(),i=y.useRef();return y.useEffect(()=>(t&&s(new MTn(t)),()=>{var o;(o=i.current)==null||o.clean()}),[t]),se.createElement(EEe.Provider,{value:{meeting:t,updates:r}},t?e:n)}const Vc=()=>{const{meeting:t}=y.useContext(EEe);if(!t)throw new Error("useRealtimeKitMeeting must be used within the RealtimeKitProvider");return{meeting:t}},qgt=t=>{const e=y.useRef(!1),[n,r]=y.useState(),s=void 0,i=y.useCallback(async o=>{if(!e.current)return e.current=!0,Ggt.init(o).then(l=>(r(l),l)).finally(()=>{e.current=!1})},[]);return y.useEffect(()=>{if(!n||!s)return()=>{};const o=({state:l})=>{l!=="connected-meeting"&&l!=="disconnected"&&r(void 0)};return n.self.on("roomLeft",o),()=>{n.self.removeListener("roomLeft",o)}},[n]),y.useEffect(()=>{if(!n||!n.connectedMeetings)return()=>{};const o=l=>{r(void 0),setTimeout(()=>{r(l)},100)};return n.connectedMeetings.on("meetingChanged",o),()=>{n.connectedMeetings.removeListener("meetingChanged",o)}},[n]),[n,i]},LTn=(t,e)=>!!(t!==e||Array.isArray(t)&&Array.isArray(e)&&t.length!==e.length),Ns=t=>{const{meeting:e,updates:n}=y.useContext(EEe);if(!e)throw new Error("useRealtimeKitSelector must be used within the RealtimeKitProvider");const r=y.useRef(t(e)),[,s]=y.useReducer(i=>i+1,0);return y.useEffect(()=>{const i=e&&t(e),o=()=>{const l=e&&t(e);LTn(r.current,l)&&(r.current=l,s())};return i&&typeof i=="object"&&"addListener"in i?(i.addListener("*",s),()=>{i.removeListener("*",s)}):(n==null||n.addListener(o),()=>{n==null||n.removeListener(o)})},[e,n]),r.current},DTn="modulepreload",$Tn=function(t){return"/"+t},n8e={},wn=function(e,n,r){let s=Promise.resolve();if(n&&n.length>0){document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));s=Promise.allSettled(n.map(c=>{if(c=$Tn(c),c in n8e)return;n8e[c]=!0;const d=c.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${c}"]${u}`))return;const h=document.createElement("link");if(h.rel=d?"stylesheet":DTn,d||(h.as="script"),h.crossOrigin="",h.href=c,l&&h.setAttribute("nonce",l),document.head.appendChild(h),d)return new Promise((m,f)=>{h.addEventListener("load",m),h.addEventListener("error",()=>f(new Error(`Unable to preload CSS for ${c}`)))})}))}function i(o){const l=new Event("vite:preloadError",{cancelable:!0});if(l.payload=o,window.dispatchEvent(l),!l.defaultPrevented)throw o}return s.then(o=>{for(const l of o||[])l.status==="rejected"&&i(l.reason);return e().catch(i)})},cQ="realtimekit-ui",Ce={allRenderFn:!0,appendChildSlotFix:!1,asyncLoading:!0,asyncQueue:!1,attachStyles:!0,cloneNodeFix:!1,constructableCSS:!0,cssAnnotations:!0,devTools:!1,element:!1,event:!0,experimentalScopedSlotChanges:!1,experimentalSlotFixes:!1,formAssociated:!1,hasRenderFn:!0,hostListener:!0,hostListenerTarget:!0,hostListenerTargetBody:!1,hostListenerTargetDocument:!1,hostListenerTargetParent:!1,hostListenerTargetWindow:!0,hotModuleReplacement:!1,hydrateClientSide:!1,hydrateServerSide:!1,hydratedAttribute:!1,hydratedClass:!0,hydratedSelectorName:"hydrated",initializeNextTick:!1,invisiblePrehydration:!0,isDebug:!1,isDev:!1,isTesting:!1,lazyLoad:!0,lifecycle:!0,lifecycleDOMEvents:!1,member:!0,method:!0,mode:!1,modernPropertyDecls:!1,observeAttribute:!0,profile:!1,prop:!0,propBoolean:!0,propMutable:!0,propNumber:!0,propString:!0,reflect:!0,scoped:!1,scopedSlotTextContentFix:!1,scriptDataOpts:!1,shadowDelegatesFocus:!0,shadowDom:!0,slot:!0,slotChildNodesFix:!1,slotRelocation:!0,state:!0,style:!0,svg:!1,taskQueue:!0,transformTagName:!1,updatable:!0,vdomAttribute:!0,vdomClass:!0,vdomFunctional:!0,vdomKey:!0,vdomListener:!0,vdomPropOrAttr:!0,vdomRef:!0,vdomRender:!0,vdomStyle:!0,vdomText:!0,vdomXlink:!0,watchCallback:!0},OTn={};var FTn=Object.defineProperty,BTn=(t,e)=>{for(var n in e)FTn(t,n,{get:e[n],enumerable:!0})},kye={isDev:!!Ce.isDev,isBrowser:!0,isServer:!1,isTesting:!!Ce.isTesting},UTn="http://www.w3.org/2000/svg",zTn="http://www.w3.org/1999/xhtml",Kgt=(t,e)=>{var n;const r=e.$cmpMeta$;Object.entries((n=r.$members$)!=null?n:{}).map(([i,[o]])=>{if((Ce.state||Ce.prop)&&(o&31||o&32)){const l=t[i],c=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),i);Object.defineProperty(t,i,{get(){return c.get.call(this)},set(d){c.set.call(this,d)},configurable:!0,enumerable:!0}),t[i]=e.$instanceValues$.has(i)?e.$instanceValues$.get(i):l}})},kl=t=>{if(t.__stencil__getHostRef)return t.__stencil__getHostRef()},VTn=(t,e)=>{t.__stencil__getHostRef=()=>e,e.$lazyInstance$=t,Ce.modernPropertyDecls&&(Ce.state||Ce.prop)&&Kgt(t,e)},NEe=(t,e)=>{const n={$flags$:0,$hostElement$:t,$cmpMeta$:e,$instanceValues$:new Map};Ce.isDev&&(n.$renderCount$=0),Ce.method&&Ce.lazyLoad&&(n.$onInstancePromise$=new Promise(s=>n.$onInstanceResolve$=s)),Ce.asyncLoading&&(n.$onReadyPromise$=new Promise(s=>n.$onReadyResolve$=s),t["s-p"]=[],t["s-rc"]=[]);const r=n;return t.__stencil__getHostRef=()=>r,!Ce.lazyLoad&&Ce.modernPropertyDecls&&(Ce.state||Ce.prop)&&Kgt(t,n),r},Sye=(t,e)=>e in t,Ygt,hn=(t,e)=>(Ygt||console.error)(t,e),qte=Ce.isTesting?["STENCIL:"]:["%cstencil","color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"],i6=(...t)=>console.error(...qte,...t),xR=(...t)=>console.warn(...qte,...t),HTn=(...t)=>console.info(...qte,...t),GTn=t=>Ygt=t,_W=new Map,Qgt=(t,e,n)=>{const r=t.$tagName$.replace(/-/g,"_"),s=t.$lazyBundleId$;if(Ce.isDev&&typeof s!="string"){i6(`Trying to lazily load component <${t.$tagName$}> with style mode "${e.$modeName$}", but it does not exist.`);return}else if(!s)return;const i=Ce.hotModuleReplacement?!1:_W.get(s);if(i)return i[r];if(!n||!Ce.hotModuleReplacement){const o=l=>(_W.set(s,l),l[r]);switch(s){case"rtk-avatar_26":return wn(()=>import("./rtk-avatar_26.entry-C8X0JZ1P.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10])).then(o,hn);case"rtk-ai-toggle":return wn(()=>import("./rtk-ai-toggle.entry-yOUjvgPO.js"),__vite__mapDeps([11,2])).then(o,hn);case"rtk-audio-grid":return wn(()=>import("./rtk-audio-grid.entry-DkzpKwwc.js"),__vite__mapDeps([12,2,5])).then(o,hn);case"rtk-audio-tile":return wn(()=>import("./rtk-audio-tile.entry-D6T4pLQE.js"),__vite__mapDeps([13,14,2])).then(o,hn);case"rtk-breakout-rooms-toggle":return wn(()=>import("./rtk-breakout-rooms-toggle.entry-ClNLPWMY.js"),__vite__mapDeps([15,2])).then(o,hn);case"rtk-camera-toggle":return wn(()=>import("./rtk-camera-toggle.entry-BW_2Je6S.js"),__vite__mapDeps([16,2])).then(o,hn);case"rtk-caption-toggle":return wn(()=>import("./rtk-caption-toggle.entry-B__nNgtr.js"),__vite__mapDeps([17,2])).then(o,hn);case"rtk-chat-composer-ui":return wn(()=>import("./rtk-chat-composer-ui.entry-DlP53NPE.js"),__vite__mapDeps([18,3,2])).then(o,hn);case"rtk-chat-messages-ui":return wn(()=>import("./rtk-chat-messages-ui.entry-B2YCOyTL.js"),__vite__mapDeps([19,9,20,2])).then(o,hn);case"rtk-chat-search-results":return wn(()=>import("./rtk-chat-search-results.entry-BaMlOvub.js"),__vite__mapDeps([21,2])).then(o,hn);case"rtk-chat-selector-ui":return wn(()=>import("./rtk-chat-selector-ui.entry-VIZKCZVn.js"),__vite__mapDeps([22,3,2])).then(o,hn);case"rtk-chat-toggle":return wn(()=>import("./rtk-chat-toggle.entry-D_kVuiGe.js"),__vite__mapDeps([23,24,2])).then(o,hn);case"rtk-clock":return wn(()=>import("./rtk-clock.entry-CHUh8JHL.js"),__vite__mapDeps([25,2])).then(o,hn);case"rtk-controlbar":return wn(()=>import("./rtk-controlbar.entry-CyjWCwfc.js"),__vite__mapDeps([26,5,2])).then(o,hn);case"rtk-debugger-toggle":return wn(()=>import("./rtk-debugger-toggle.entry-Bm7oBnrT.js"),__vite__mapDeps([27,2])).then(o,hn);case"rtk-dialog-manager":return wn(()=>import("./rtk-dialog-manager.entry-CMWsV33q.js"),__vite__mapDeps([28,2,5])).then(o,hn);case"rtk-ended-screen":return wn(()=>import("./rtk-ended-screen.entry-DHMScRMp.js"),__vite__mapDeps([29,2])).then(o,hn);case"rtk-file-dropzone":return wn(()=>import("./rtk-file-dropzone.entry-D9kEf9nv.js"),__vite__mapDeps([30,2])).then(o,hn);case"rtk-grid":return wn(()=>import("./rtk-grid.entry-DecmwPsE.js"),__vite__mapDeps([31,32,5,2,33])).then(o,hn);case"rtk-grid-pagination":return wn(()=>import("./rtk-grid-pagination.entry-BwpCUt8D.js"),__vite__mapDeps([34,2,32])).then(o,hn);case"rtk-header":return wn(()=>import("./rtk-header.entry-Cg7jPACn.js"),__vite__mapDeps([35,5,2])).then(o,hn);case"rtk-idle-screen":return wn(()=>import("./rtk-idle-screen.entry-bz6lbV8l.js"),__vite__mapDeps([36,2])).then(o,hn);case"rtk-image-viewer":return wn(()=>import("./rtk-image-viewer.entry-BHBF04CV.js"),__vite__mapDeps([37,4,1,2])).then(o,hn);case"rtk-information-tooltip":return wn(()=>import("./rtk-information-tooltip.entry-D7rUnbe3.js"),__vite__mapDeps([38,2])).then(o,hn);case"rtk-leave-button":return wn(()=>import("./rtk-leave-button.entry-BIn7DKsJ.js"),__vite__mapDeps([39,2])).then(o,hn);case"rtk-livestream-toggle":return wn(()=>import("./rtk-livestream-toggle.entry-271Lurd9.js"),__vite__mapDeps([40,2])).then(o,hn);case"rtk-meeting-title":return wn(()=>import("./rtk-meeting-title.entry-B-cvw5b8.js"),__vite__mapDeps([41,2])).then(o,hn);case"rtk-message-list-view":return wn(()=>import("./rtk-message-list-view.entry-CSIhBgZy.js"),__vite__mapDeps([42,2,10])).then(o,hn);case"rtk-mic-toggle":return wn(()=>import("./rtk-mic-toggle.entry-jTESfsHe.js"),__vite__mapDeps([43,2])).then(o,hn);case"rtk-mixed-grid":return wn(()=>import("./rtk-mixed-grid.entry-DT8NXwEz.js"),__vite__mapDeps([44,33,5,2])).then(o,hn);case"rtk-more-toggle":return wn(()=>import("./rtk-more-toggle.entry-k6snwy_U.js"),__vite__mapDeps([45,2])).then(o,hn);case"rtk-mute-all-button":return wn(()=>import("./rtk-mute-all-button.entry-DIlYteuv.js"),__vite__mapDeps([46,2])).then(o,hn);case"rtk-network-indicator":return wn(()=>import("./rtk-network-indicator.entry-C6w0Qd7a.js"),__vite__mapDeps([47,2])).then(o,hn);case"rtk-notifications":return wn(()=>import("./rtk-notifications.entry-CjYA0y8L.js"),__vite__mapDeps([48,49,1,3,2])).then(o,hn);case"rtk-participant-count":return wn(()=>import("./rtk-participant-count.entry-Le8F1CRt.js"),__vite__mapDeps([50,2])).then(o,hn);case"rtk-participant-setup":return wn(()=>import("./rtk-participant-setup.entry-BjybrLlW.js"),__vite__mapDeps([51,2])).then(o,hn);case"rtk-participants":return wn(()=>import("./rtk-participants.entry-BRCjNDSH.js"),__vite__mapDeps([52,2,10])).then(o,hn);case"rtk-participants-audio":return wn(()=>import("./rtk-participants-audio.entry-BDffpbxd.js"),__vite__mapDeps([53,49,2])).then(o,hn);case"rtk-participants-toggle":return wn(()=>import("./rtk-participants-toggle.entry-DRj1FtCy.js"),__vite__mapDeps([54,24,2])).then(o,hn);case"rtk-pip-toggle":return wn(()=>import("./rtk-pip-toggle.entry-BT4uzOdK.js"),__vite__mapDeps([55,2])).then(o,hn);case"rtk-plugins-toggle":return wn(()=>import("./rtk-plugins-toggle.entry-CzYQDHH3.js"),__vite__mapDeps([56,24,2])).then(o,hn);case"rtk-polls-toggle":return wn(()=>import("./rtk-polls-toggle.entry-BfEEnSad.js"),__vite__mapDeps([57,24,2])).then(o,hn);case"rtk-recording-indicator":return wn(()=>import("./rtk-recording-indicator.entry-D3W7RcVg.js"),__vite__mapDeps([58,2])).then(o,hn);case"rtk-recording-toggle":return wn(()=>import("./rtk-recording-toggle.entry-C97DPNyM.js"),__vite__mapDeps([59,2])).then(o,hn);case"rtk-screen-share-toggle":return wn(()=>import("./rtk-screen-share-toggle.entry-Bah-JqMR.js"),__vite__mapDeps([60,2])).then(o,hn);case"rtk-screenshare-view":return wn(()=>import("./rtk-screenshare-view.entry-C63qsdhS.js"),__vite__mapDeps([61,62,2])).then(o,hn);case"rtk-settings":return wn(()=>import("./rtk-settings.entry-Ble5jhgT.js"),__vite__mapDeps([63,2])).then(o,hn);case"rtk-settings-toggle":return wn(()=>import("./rtk-settings-toggle.entry-DNaCrmzG.js"),__vite__mapDeps([64,2])).then(o,hn);case"rtk-setup-screen":return wn(()=>import("./rtk-setup-screen.entry-BS5PFNe3.js"),__vite__mapDeps([65,1,5,2,7])).then(o,hn);case"rtk-sidebar":return wn(()=>import("./rtk-sidebar.entry-B44Nt2vO.js"),__vite__mapDeps([66,24,2,5])).then(o,hn);case"rtk-simple-grid":return wn(()=>import("./rtk-simple-grid.entry-q6fBr6Cz.js"),__vite__mapDeps([67,5,33,6,2])).then(o,hn);case"rtk-spotlight-grid":return wn(()=>import("./rtk-spotlight-grid.entry-DeDOAr54.js"),__vite__mapDeps([68,33,5,2])).then(o,hn);case"rtk-stage":return wn(()=>import("./rtk-stage.entry-CEwfxtui.js"),__vite__mapDeps([69,2])).then(o,hn);case"rtk-stage-toggle":return wn(()=>import("./rtk-stage-toggle.entry-DshXSm2_.js"),__vite__mapDeps([70,2])).then(o,hn);case"rtk-transcripts":return wn(()=>import("./rtk-transcripts.entry-DI2fu2pk.js"),__vite__mapDeps([71,2])).then(o,hn);case"rtk-ui-provider":return wn(()=>import("./rtk-ui-provider.entry-CVx9A57g.js"),[]).then(o,hn);case"rtk-waiting-screen":return wn(()=>import("./rtk-waiting-screen.entry-Bb8kpiFU.js"),__vite__mapDeps([72,2])).then(o,hn);case"rtk-ai_3":return wn(()=>import("./rtk-ai_3.entry-fplF31is.js"),__vite__mapDeps([73,2,20])).then(o,hn);case"rtk-breakout-rooms-manager_9":return wn(()=>import("./rtk-breakout-rooms-manager_9.entry-DKlP0b1i.js"),__vite__mapDeps([74,2,5])).then(o,hn);case"rtk-chat-message":return wn(()=>import("./rtk-chat-message.entry-DBxM8rDh.js"),__vite__mapDeps([75,2])).then(o,hn);case"rtk-livestream-indicator_3":return wn(()=>import("./rtk-livestream-indicator_3.entry-B7VwPRdm.js"),__vite__mapDeps([76,2])).then(o,hn);case"rtk-name-tag":return wn(()=>import("./rtk-name-tag.entry-Cdaym7rm.js"),__vite__mapDeps([77,1,2])).then(o,hn);case"rtk-notification":return wn(()=>import("./rtk-notification.entry-CSLUgEwU.js"),__vite__mapDeps([78,2,79,3])).then(o,hn);case"rtk-participants-stage-list_4":return wn(()=>import("./rtk-participants-stage-list_4.entry-CzAEl4gQ.js"),__vite__mapDeps([80,5,2])).then(o,hn);case"rtk-plugin-main_2":return wn(()=>import("./rtk-plugin-main_2.entry-BFtDcF5m.js"),__vite__mapDeps([81,2,1])).then(o,hn);case"rtk-settings-audio_2":return wn(()=>import("./rtk-settings-audio_2.entry-DDUoR49B.js"),__vite__mapDeps([82,2])).then(o,hn);case"rtk-transcript":return wn(()=>import("./rtk-transcript.entry-DX-gOBQQ.js"),__vite__mapDeps([83,2])).then(o,hn);case"rtk-ai-transcriptions":return wn(()=>import("./rtk-ai-transcriptions.entry-T_D6R3nO.js"),__vite__mapDeps([84,85,9,1,20,2])).then(o,hn);case"rtk-audio-visualizer_4":return wn(()=>import("./rtk-audio-visualizer_4.entry-iKw-1OzZ.js"),__vite__mapDeps([86,14,2,49])).then(o,hn);case"rtk-breakout-room-manager_3":return wn(()=>import("./rtk-breakout-room-manager_3.entry-DhjTniEy.js"),__vite__mapDeps([87,1,2])).then(o,hn);case"rtk-debugger-audio_4":return wn(()=>import("./rtk-debugger-audio_4.entry-gYn2E3ej.js"),__vite__mapDeps([88,2])).then(o,hn);case"rtk-dialog":return wn(()=>import("./rtk-dialog.entry-CLZSy900.js"),__vite__mapDeps([89,2])).then(o,hn);case"rtk-file-message_3":return wn(()=>import("./rtk-file-message_3.entry-cNJFbwAr.js"),__vite__mapDeps([90,85,9,1,4,2,79,3])).then(o,hn);case"rtk-fullscreen-toggle":return wn(()=>import("./rtk-fullscreen-toggle.entry-F5yUmy7M.js"),__vite__mapDeps([91,62,2])).then(o,hn);case"rtk-participant_2":return wn(()=>import("./rtk-participant_2.entry-DFy8iYXX.js"),__vite__mapDeps([92,5,1,8,2,10])).then(o,hn);case"rtk-camera-selector_2":return wn(()=>import("./rtk-camera-selector_2.entry-DCwL5vNz.js"),__vite__mapDeps([93,2,5])).then(o,hn);case"rtk-poll_2":return wn(()=>import("./rtk-poll_2.entry-8MZbiRB1.js"),__vite__mapDeps([94,2,1])).then(o,hn);case"rtk-sidebar-ui":return wn(()=>import("./rtk-sidebar-ui.entry-DkKUXWjR.js"),__vite__mapDeps([95,2])).then(o,hn);case"rtk-spotlight-indicator":return wn(()=>import("./rtk-spotlight-indicator.entry-CGhQpLH4.js"),__vite__mapDeps([96,2])).then(o,hn);case"rtk-logo":return wn(()=>import("./rtk-logo.entry-C8FJMFDt.js"),__vite__mapDeps([97,2])).then(o,hn);case"rtk-controlbar-button":return wn(()=>import("./rtk-controlbar-button.entry-CsfmkmRz.js"),__vite__mapDeps([98,2])).then(o,hn)}}return wn(()=>import(`./${s}.entry.js${Ce.hotModuleReplacement&&n?"?s-hmr="+n:""}`),[]).then(o=>(Ce.hotModuleReplacement||_W.set(s,o),o[r]),o=>{hn(o,e.$hostElement$)})},wR=new Map,TEe=[],Zgt="r",Jgt="o",Xgt="s",_Ee="t",evt="c",kR="s-id",r$="sty-id",SR="c-id",WTn="{visibility:hidden}.hydrated{visibility:inherit}",r8e="_stencilDocData",qTn={hostIds:0,rootLevelIds:0,staticComponents:new Set},tvt="slot-fb{display:contents}slot-fb[hidden]{display:none}",s8e="http://www.w3.org/1999/xlink",KTn=["formAssociatedCallback","formResetCallback","formDisabledCallback","formStateRestoreCallback"],zs=typeof window<"u"?window:{},i8e=zs.HTMLElement||class{},gs={$flags$:0,$resourcesUrl$:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,r)=>t.addEventListener(e,n,r),rel:(t,e,n,r)=>t.removeEventListener(e,n,r),ce:(t,e)=>new CustomEvent(t,e)},YTn=t=>{Object.assign(gs,t)},r0=Ce.shadowDom,nvt=(()=>{var t;let e=!1;try{(t=zs.document)==null||t.addEventListener("e",null,Object.defineProperty({},"passive",{get(){e=!0}}))}catch{}return e})(),rvt=t=>Promise.resolve(t),AEe=Ce.constructableCSS?(()=>{try{return new CSSStyleSheet,typeof new CSSStyleSheet().replaceSync=="function"}catch{}return!1})():!1,hce=0,dQ=!1,AW=[],DC=[],mce=[],svt=(t,e)=>n=>{t.push(n),dQ||(dQ=!0,e&&gs.$flags$&4?T7(uQ):gs.raf(uQ))},a8e=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(n){hn(n)}t.length=0},o8e=(t,e)=>{let n=0,r=0;for(;n<t.length&&(r=performance.now())<e;)try{t[n++](r)}catch(s){hn(s)}n===t.length?t.length=0:n!==0&&t.splice(0,n)},uQ=()=>{if(Ce.asyncQueue&&hce++,a8e(AW),Ce.asyncQueue){const t=(gs.$flags$&6)===2?performance.now()+14*Math.ceil(hce*.1):1/0;o8e(DC,t),o8e(mce,t),DC.length>0&&(mce.push(...DC),DC.length=0),(dQ=AW.length+DC.length+mce.length>0)?gs.raf(uQ):hce=0}else a8e(DC),(dQ=AW.length>0)&&gs.raf(uQ)},T7=t=>rvt().then(t),QTn=svt(AW,!1),ivt=svt(DC,!0),ZTn=t=>{const e=new URL(t,gs.$resourcesUrl$);return e.origin!==zs.location.origin?e.href:e.pathname},JTn=t=>gs.$resourcesUrl$=t,XTn=t=>t!=null&&t!==void 0,PEe=t=>(t=typeof t,t==="object"||t==="function");function avt(t){var e,n,r;return(r=(n=(e=t.head)==null?void 0:e.querySelector('meta[name="csp-nonce"]'))==null?void 0:n.getAttribute("content"))!=null?r:void 0}var e_n=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),t_n={};BTn(t_n,{err:()=>ovt,map:()=>n_n,ok:()=>Cye,unwrap:()=>r_n,unwrapErr:()=>s_n});var Cye=t=>({isOk:!0,isErr:!1,value:t}),ovt=t=>({isOk:!1,isErr:!0,value:t});function n_n(t,e){if(t.isOk){const n=e(t.value);return n instanceof Promise?n.then(r=>Cye(r)):Cye(n)}if(t.isErr){const n=t.value;return ovt(n)}throw"should never get here"}var r_n=t=>{if(t.isOk)return t.value;throw t.value},s_n=t=>{if(t.isErr)return t.value;throw t.value},Kte=t=>{const e=hh(t,"childNodes");t.tagName&&t.tagName.includes("-")&&t["s-cr"]&&t.tagName!=="SLOT-FB"&&_7(e,t.tagName).forEach(r=>{r.nodeType===1&&r.tagName==="SLOT-FB"&&(REe(r,_I(r),!1).length?r.hidden=!0:r.hidden=!1)});let n=0;for(n=0;n<e.length;n++){const r=e[n];r.nodeType===1&&hh(r,"childNodes").length&&Kte(r)}},a6=t=>{const e=[];for(let n=0;n<t.length;n++){const r=t[n]["s-nr"]||void 0;r&&r.isConnected&&e.push(r)}return e};function _7(t,e,n){let r=0,s=[],i;for(;r<t.length;r++){if(i=t[r],i["s-sr"]&&(!e||i["s-hn"]===e)&&(n===void 0||_I(i)===n)&&(s.push(i),typeof n<"u"))return s;s=[...s,..._7(i.childNodes,e,n)]}return s}var REe=(t,e,n=!0)=>{const r=[];(n&&t["s-sr"]||!t["s-sr"])&&r.push(t);let s=t;for(;s=s.nextSibling;)_I(s)===e&&(n||!s["s-sr"])&&r.push(s);return r},l8e=(t,e)=>t.nodeType===1?t.getAttribute("slot")===null&&e===""||t.getAttribute("slot")===e:t["s-sn"]===e?!0:e==="",Yte=(t,e,n,r)=>{if(t["s-ol"]&&t["s-ol"].isConnected)return;const s=document.createTextNode("");if(s["s-nr"]=t,!e["s-cr"]||!e["s-cr"].parentNode)return;const i=e["s-cr"].parentNode,o=n?hh(i,"prepend"):hh(i,"appendChild");if(Ce.hydrateClientSide&&typeof r<"u"){s["s-oo"]=r;const l=hh(i,"childNodes"),c=[s];l.forEach(d=>{d["s-nr"]&&c.push(d)}),c.sort((d,u)=>!d["s-oo"]||d["s-oo"]<(u["s-oo"]||0)?-1:!u["s-oo"]||u["s-oo"]<d["s-oo"]?1:0),c.forEach(d=>o.call(i,d))}else o.call(i,s);t["s-ol"]=s,t["s-sh"]=e["s-hn"]},_I=t=>typeof t["s-sn"]=="string"?t["s-sn"]:t.nodeType===1&&t.getAttribute("slot")||void 0;function lvt(t){if(t.assignedElements||t.assignedNodes||!t["s-sr"])return;const e=n=>(function(r){const s=[],i=this["s-sn"];r!=null&&r.flatten&&console.error(`
          Flattening is not supported for Stencil non-shadow slots. 
          You can use \`.childNodes\` to nested slot fallback content.
          If you have a particular use case, please open an issue on the Stencil repo.
        `);const o=this["s-cr"].parentElement;return(o.__childNodes?o.childNodes:a6(o.childNodes)).forEach(c=>{i===_I(c)&&s.push(c)}),n?s.filter(c=>c.nodeType===1):s}).bind(t);t.assignedElements=e(!0),t.assignedNodes=e(!1)}function Qte(t){t.dispatchEvent(new CustomEvent("slotchange",{bubbles:!1,cancelable:!1,composed:!1}))}function IEe(t,e){var n;if(e=e||((n=t["s-ol"])==null?void 0:n.parentElement),!e)return{slotNode:null,slotName:""};const r=t["s-sn"]=_I(t)||"",s=hh(e,"childNodes");return{slotNode:_7(s,e.tagName,r)[0],slotName:r}}var cvt=t=>{MEe(t),LEe(t),o_n(t),a_n(t),u_n(t),l_n(t),c_n(t),d_n(t),DEe(t),$Ee(t),i_n(t)},MEe=t=>{const e=t.cloneNode;t.cloneNode=function(n){const r=this,s=Ce.shadowDom?r.shadowRoot&&r0:!1,i=e.call(r,s?n:!1);if(Ce.slot&&!s&&n){let o=0,l,c;const d=["s-id","s-cr","s-lr","s-rc","s-sc","s-p","s-cn","s-sr","s-sn","s-hn","s-ol","s-nr","s-si","s-rf","s-scs"],u=this.__childNodes||this.childNodes;for(;o<u.length;o++)l=u[o]["s-nr"],c=d.every(h=>!u[o][h]),l&&(Ce.appendChildSlotFix&&i.__appendChild?i.__appendChild(l.cloneNode(!0)):i.appendChild(l.cloneNode(!0))),c&&i.appendChild(u[o].cloneNode(!0))}return i}},LEe=t=>{t.__appendChild=t.appendChild,t.appendChild=function(e){const{slotName:n,slotNode:r}=IEe(e,this);if(r){Yte(e,r);const s=REe(r,n),i=s[s.length-1],o=hh(i,"parentNode"),l=hh(o,"insertBefore")(e,i.nextSibling);return Qte(r),Kte(this),l}return this.__appendChild(e)}},i_n=t=>{t.__removeChild=t.removeChild,t.removeChild=function(e){if(e&&typeof e["s-sn"]<"u"){const n=this.__childNodes||this.childNodes;if(_7(n,this.tagName,e["s-sn"])&&e.isConnected){e.remove(),Kte(this);return}}return this.__removeChild(e)}},a_n=t=>{t.__prepend=t.prepend,t.prepend=function(...e){e.forEach(n=>{typeof n=="string"&&(n=this.ownerDocument.createTextNode(n));const r=(n["s-sn"]=_I(n))||"",s=hh(this,"childNodes"),i=_7(s,this.tagName,r)[0];if(i){Yte(n,i,!0);const l=REe(i,r)[0],c=hh(l,"parentNode"),d=hh(c,"insertBefore")(n,hh(l,"nextSibling"));return Qte(i),d}return n.nodeType===1&&n.getAttribute("slot")&&(n.hidden=!0),t.__prepend(n)})}},o_n=t=>{t.__append=t.append,t.append=function(...e){e.forEach(n=>{typeof n=="string"&&(n=this.ownerDocument.createTextNode(n)),this.appendChild(n)})}},l_n=t=>{const e=t.insertAdjacentHTML;t.insertAdjacentHTML=function(n,r){if(n!=="afterbegin"&&n!=="beforeend")return e.call(this,n,r);const s=this.ownerDocument.createElement("_");let i;if(s.innerHTML=r,n==="afterbegin")for(;i=s.firstChild;)this.prepend(i);else if(n==="beforeend")for(;i=s.firstChild;)this.append(i)}},c_n=t=>{t.insertAdjacentText=function(e,n){this.insertAdjacentHTML(e,n)}},d_n=t=>{const e=t;e.__insertBefore||(e.__insertBefore=t.insertBefore,t.insertBefore=function(n,r){const{slotName:s,slotNode:i}=IEe(n,this),o=this.__childNodes?this.childNodes:a6(this.childNodes);if(i){let c=!1;if(o.forEach(d=>{if(d===r||r===null){if(c=!0,r===null||s!==r["s-sn"]){this.appendChild(n);return}if(s===r["s-sn"]){Yte(n,i);const u=hh(r,"parentNode");hh(u,"insertBefore")(n,r),Qte(i)}return}}),c)return n}const l=r==null?void 0:r.__parentNode;return l&&!this.isSameNode(l)?this.appendChild(n):this.__insertBefore(n,r)})},u_n=t=>{const e=t.insertAdjacentElement;t.insertAdjacentElement=function(n,r){return n!=="afterbegin"&&n!=="beforeend"?e.call(this,n,r):n==="afterbegin"?(this.prepend(r),r):(n==="beforeend"&&this.append(r),r)}},DEe=t=>{ey("textContent",t),Object.defineProperty(t,"textContent",{get:function(){let e="";return(this.__childNodes?this.childNodes:a6(this.childNodes)).forEach(r=>e+=r.textContent||""),e},set:function(e){(this.__childNodes?this.childNodes:a6(this.childNodes)).forEach(r=>{r["s-ol"]&&r["s-ol"].remove(),r.remove()}),this.insertAdjacentHTML("beforeend",e)}})},$Ee=t=>{class e extends Array{item(r){return this[r]}}ey("children",t),Object.defineProperty(t,"children",{get(){return this.childNodes.filter(n=>n.nodeType===1)}}),Object.defineProperty(t,"childElementCount",{get(){return this.children.length}}),ey("firstChild",t),Object.defineProperty(t,"firstChild",{get(){return this.childNodes[0]}}),ey("lastChild",t),Object.defineProperty(t,"lastChild",{get(){return this.childNodes[this.childNodes.length-1]}}),ey("childNodes",t),Object.defineProperty(t,"childNodes",{get(){const n=new e;return n.push(...a6(this.__childNodes)),n}})},h_n=t=>{!t||t.__nextSibling!==void 0||!globalThis.Node||(m_n(t),p_n(t),dvt(t),t.nodeType===Node.ELEMENT_NODE&&(f_n(t),g_n(t)))},m_n=t=>{!t||t.__nextSibling||(ey("nextSibling",t),Object.defineProperty(t,"nextSibling",{get:function(){var e;const n=(e=this["s-ol"])==null?void 0:e.parentNode.childNodes,r=n==null?void 0:n.indexOf(this);return n&&r>-1?n[r+1]:this.__nextSibling}}))},f_n=t=>{!t||t.__nextElementSibling||(ey("nextElementSibling",t),Object.defineProperty(t,"nextElementSibling",{get:function(){var e;const n=(e=this["s-ol"])==null?void 0:e.parentNode.children,r=n==null?void 0:n.indexOf(this);return n&&r>-1?n[r+1]:this.__nextElementSibling}}))},p_n=t=>{!t||t.__previousSibling||(ey("previousSibling",t),Object.defineProperty(t,"previousSibling",{get:function(){var e;const n=(e=this["s-ol"])==null?void 0:e.parentNode.childNodes,r=n==null?void 0:n.indexOf(this);return n&&r>-1?n[r-1]:this.__previousSibling}}))},g_n=t=>{!t||t.__previousElementSibling||(ey("previousElementSibling",t),Object.defineProperty(t,"previousElementSibling",{get:function(){var e;const n=(e=this["s-ol"])==null?void 0:e.parentNode.children,r=n==null?void 0:n.indexOf(this);return n&&r>-1?n[r-1]:this.__previousElementSibling}}))},dvt=t=>{!t||t.__parentNode||(ey("parentNode",t),Object.defineProperty(t,"parentNode",{get:function(){var e;return((e=this["s-ol"])==null?void 0:e.parentNode)||this.__parentNode},set:function(e){this.__parentNode=e}}))},v_n=["children","nextElementSibling","previousElementSibling"],y_n=["childNodes","firstChild","lastChild","nextSibling","previousSibling","textContent","parentNode"];function ey(t,e){let n;v_n.includes(t)?n=Object.getOwnPropertyDescriptor(Element.prototype,t):y_n.includes(t)&&(n=Object.getOwnPropertyDescriptor(Node.prototype,t)),n||(n=Object.getOwnPropertyDescriptor(e,t)),n&&Object.defineProperty(e,"__"+t,n)}function hh(t,e){if("__"+e in t){const n=t["__"+e];return typeof n!="function"?n:n.bind(t)}else return typeof t[e]!="function"?t[e]:t[e].bind(t)}var b_n=0,Ay=(t,e="")=>{if(Ce.profile&&performance.mark){const n=`st:${t}:${e}:${b_n++}`;return performance.mark(n),()=>performance.measure(`[Stencil] ${t}() <${e}>`,n)}else return()=>{}},x_n=(t,e)=>Ce.profile&&performance.mark?(performance.getEntriesByName(t,"mark").length===0&&performance.mark(t),()=>{performance.getEntriesByName(e,"measure").length===0&&performance.measure(e,t)}):()=>{},w_n=t=>{const e=kl(t);if(!e)return;const n=e.$flags$,r=e.$hostElement$;return{renderCount:e.$renderCount$,flags:{hasRendered:!!(n&2),hasConnected:!!(n&1),isWaitingForChildren:!!(n&4),isConstructingInstance:!!(n&8),isQueuedForUpdate:!!(n&16),hasInitializedComponent:!!(n&32),hasLoadedComponent:!!(n&64),isWatchReady:!!(n&128),isListenReady:!!(n&256),needsRerender:!!(n&512)},instanceValues:e.$instanceValues$,ancestorComponent:e.$ancestorComponent$,hostElement:r,lazyInstance:e.$lazyInstance$,vnode:e.$vnode$,modeName:e.$modeName$,onReadyPromise:e.$onReadyPromise$,onReadyResolve:e.$onReadyResolve$,onInstancePromise:e.$onInstancePromise$,onInstanceResolve:e.$onInstanceResolve$,onRenderResolve:e.$onRenderResolve$,queuedListeners:e.$queuedListeners$,rmListeners:e.$rmListeners$,"s-id":r["s-id"],"s-cr":r["s-cr"],"s-lr":r["s-lr"],"s-p":r["s-p"],"s-rc":r["s-rc"],"s-sc":r["s-sc"]}},k_n=()=>{if(Ce.devTools){const t=zs.stencil=zs.stencil||{},e=t.inspect;t.inspect=n=>{let r=w_n(n);return!r&&typeof e=="function"&&(r=e(n)),r}}},OEe=(t,e,...n)=>{let r=null,s=null,i=null,o=!1,l=!1;const c=[],d=h=>{for(let m=0;m<h.length;m++)r=h[m],Array.isArray(r)?d(r):r!=null&&typeof r!="boolean"&&((o=typeof t!="function"&&!PEe(r))?r=String(r):Ce.isDev&&typeof t!="function"&&r.$flags$===void 0&&i6(`vNode passed as children has unexpected type.
Make sure it's using the correct h() function.
Empty objects can also be the cause, look for JSX comments that became objects.`),o&&l?c[c.length-1].$text$+=r:c.push(o?CR(null,r):r),l=o)};if(d(n),e&&(Ce.isDev&&t==="input"&&j_n(e),Ce.vdomKey&&e.key&&(s=e.key),Ce.slotRelocation&&e.name&&(i=e.name),Ce.vdomClass)){const h=e.className||e.class;h&&(e.class=typeof h!="object"?h:Object.keys(h).filter(m=>h[m]).join(" "))}if(Ce.isDev&&c.some(jye)&&i6(`The <Host> must be the single root component. Make sure:
- You are NOT using hostData() and <Host> in the same component.
- <Host> is used once, and it's the single root component of the render() function.`),Ce.vdomFunctional&&typeof t=="function")return t(e===null?{}:e,c,S_n);const u=CR(t,null);return u.$attrs$=e,c.length>0&&(u.$children$=c),Ce.vdomKey&&(u.$key$=s),Ce.slotRelocation&&(u.$name$=i),u},CR=(t,e)=>{const n={$flags$:0,$tag$:t,$text$:e,$elm$:null,$children$:null};return Ce.vdomAttribute&&(n.$attrs$=null),Ce.vdomKey&&(n.$key$=null),Ce.slotRelocation&&(n.$name$=null),n},uvt={},jye=t=>t&&t.$tag$===uvt,S_n={forEach:(t,e)=>t.map(c8e).forEach(e),map:(t,e)=>t.map(c8e).map(e).map(C_n)},c8e=t=>({vattrs:t.$attrs$,vchildren:t.$children$,vkey:t.$key$,vname:t.$name$,vtag:t.$tag$,vtext:t.$text$}),C_n=t=>{if(typeof t.vtag=="function"){const n={...t.vattrs};return t.vkey&&(n.key=t.vkey),t.vname&&(n.name=t.vname),OEe(t.vtag,n,...t.vchildren||[])}const e=CR(t.vtag,t.vtext);return e.$attrs$=t.vattrs,e.$children$=t.vchildren,e.$key$=t.vkey,e.$name$=t.vname,e},j_n=t=>{const e=Object.keys(t),n=e.indexOf("value");if(n===-1)return;const r=e.indexOf("type"),s=e.indexOf("min"),i=e.indexOf("max"),o=e.indexOf("step");(n<r||n<s||n<i||n<o)&&xR('The "value" prop of <input> should be set after "min", "max", "type" and "step"')},E_n=(t,e,n,r)=>{const s=Ay("hydrateClient",e),i=t.shadowRoot,o=[],l=[],c=[],d=Ce.shadowDom&&i?[]:null,u=CR(e,null);u.$elm$=t;let h;if(Ce.scoped){const C=r.$cmpMeta$;C&&C.$flags$&10&&t["s-sc"]?(h=t["s-sc"],t.classList.add(h+"-h")):t["s-sc"]&&delete t["s-sc"]}zs.document&&(!gs.$orgLocNodes$||!gs.$orgLocNodes$.size)&&Nye(zs.document.body,gs.$orgLocNodes$=new Map),t[kR]=n,t.removeAttribute(kR),r.$vnode$=Eye(u,o,l,d,t,t,n,c);let m=0;const f=o.length;let p;for(m;m<f;m++){p=o[m];const C=p.$hostId$+"."+p.$nodeId$,j=gs.$orgLocNodes$.get(C),E=p.$elm$;i||(E["s-hn"]=e.toUpperCase(),p.$tag$==="slot"&&(E["s-cr"]=t["s-cr"])),p.$tag$==="slot"&&(p.$name$=p.$elm$["s-sn"]||p.$elm$.name||null,p.$children$?(p.$flags$|=2,p.$elm$.childNodes.length||p.$children$.forEach(N=>{p.$elm$.appendChild(N.$elm$)})):p.$flags$|=1),j&&j.isConnected&&(i&&j["s-en"]===""&&j.parentNode.insertBefore(E,j.nextSibling),j.parentNode.removeChild(j),i||(E["s-oo"]=parseInt(p.$nodeId$))),gs.$orgLocNodes$.delete(C)}const g=[],v=c.length;let b=0,x,w,k,S;for(b;b<v;b++)if(x=c[b],!(!x||!x.length))for(k=x.length,w=0,w;w<k;w++){if(S=x[w],g[S.hostId]||(g[S.hostId]=gs.$orgLocNodes$.get(S.hostId)),!g[S.hostId])continue;const C=g[S.hostId];(!C.shadowRoot||!i)&&(S.slot["s-cr"]=C["s-cr"],!S.slot["s-cr"]&&C.shadowRoot?S.slot["s-cr"]=C:S.slot["s-cr"]=(C.__childNodes||C.childNodes)[0],Yte(S.node,S.slot,!1,S.node["s-oo"]),Ce.experimentalSlotFixes&&h_n(S.node)),C.shadowRoot&&S.node.parentElement!==C&&C.appendChild(S.node)}if(Ce.scoped&&h&&l.length&&l.forEach(C=>{C.$elm$.parentElement.classList.add(h+"-s")}),Ce.shadowDom&&i&&!i.childNodes.length){let C=0;const j=d.length;if(j){for(C;C<j;C++)i.appendChild(d[C]);Array.from(t.childNodes).forEach(E=>{typeof E["s-sn"]!="string"&&(E.nodeType===1&&E.slot&&E.hidden?E.removeAttribute("hidden"):(E.nodeType===8||E.nodeType===3&&!E.wholeText.trim())&&E.parentNode.removeChild(E))})}}gs.$orgLocNodes$.delete(t["s-id"]),r.$hostElement$=t,s()},Eye=(t,e,n,r,s,i,o,l=[])=>{let c,d,u,h;const m=s["s-sc"];if(i.nodeType===1){if(c=i.getAttribute(SR),c&&(d=c.split("."),d[0]===o||d[0]==="0")){u=d8e({$flags$:0,$hostId$:d[0],$nodeId$:d[1],$depth$:d[2],$index$:d[3],$tag$:i.tagName.toLowerCase(),$elm$:i,$attrs$:{class:i.className||""}}),e.push(u),i.removeAttribute(SR),t.$children$||(t.$children$=[]),Ce.scoped&&m&&(i["s-si"]=m,u.$attrs$.class+=" "+m);const p=u.$elm$.getAttribute("s-sn");typeof p=="string"&&(u.$tag$==="slot-fb"&&(u8e(p,d[2],u,i,t,e,n,r,l),Ce.scoped&&m&&i.classList.add(m)),u.$elm$["s-sn"]=p,u.$elm$.removeAttribute("s-sn")),u.$index$!==void 0&&(t.$children$[u.$index$]=u),t=u,r&&u.$depth$==="0"&&(r[u.$index$]=u.$elm$)}if(i.shadowRoot)for(h=i.shadowRoot.childNodes.length-1;h>=0;h--)Eye(t,e,n,r,s,i.shadowRoot.childNodes[h],o,l);const f=i.__childNodes||i.childNodes;for(h=f.length-1;h>=0;h--)Eye(t,e,n,r,s,f[h],o,l)}else if(i.nodeType===8){if(d=i.nodeValue.split("."),d[1]===o||d[1]==="0"){if(c=d[0],u=d8e({$hostId$:d[1],$nodeId$:d[2],$depth$:d[3],$index$:d[4]||"0",$elm$:i,$attrs$:null,$children$:null,$key$:null,$name$:null,$tag$:null,$text$:null}),c===_Ee)u.$elm$=m8e(i,3),u.$elm$&&u.$elm$.nodeType===3&&(u.$text$=u.$elm$.textContent,e.push(u),i.remove(),o===u.$hostId$&&(t.$children$||(t.$children$=[]),t.$children$[u.$index$]=u),r&&u.$depth$==="0"&&(r[u.$index$]=u.$elm$));else if(c===evt)u.$elm$=m8e(i,8),u.$elm$&&u.$elm$.nodeType===8&&(e.push(u),i.remove());else if(u.$hostId$===o)if(c===Xgt){const f=i["s-sn"]=d[5]||"";u8e(f,d[2],u,i,t,e,n,r,l)}else c===Zgt&&(Ce.shadowDom&&r?i.remove():Ce.slotRelocation&&(s["s-cr"]=i,i["s-cn"]=!0))}}else if(t&&t.$tag$==="style"){const f=CR(null,i.textContent);f.$elm$=i,f.$index$="0",t.$children$=[f]}else i.nodeType===3&&!i.wholeText.trim()&&i.remove();return t},Nye=(t,e)=>{if(t.nodeType===1){const n=t[kR]||t.getAttribute(kR);n&&e.set(n,t);let r=0;if(t.shadowRoot)for(;r<t.shadowRoot.childNodes.length;r++)Nye(t.shadowRoot.childNodes[r],e);const s=t.__childNodes||t.childNodes;for(r=0;r<s.length;r++)Nye(s[r],e)}else if(t.nodeType===8){const n=t.nodeValue.split(".");n[0]===Jgt&&(e.set(n[1]+"."+n[2],t),t.nodeValue="",t["s-en"]=n[3])}},d8e=t=>({...{$flags$:0,$hostId$:null,$nodeId$:null,$depth$:null,$index$:"0",$elm$:null,$attrs$:null,$children$:null,$key$:null,$name$:null,$tag$:null,$text$:null},...t});function u8e(t,e,n,r,s,i,o,l,c){r["s-sr"]=!0,n.$name$=t||null,n.$tag$="slot";const d=s!=null&&s.$elm$?s.$elm$["s-id"]||s.$elm$.getAttribute("s-id"):"";if(Ce.shadowDom&&l&&zs.document){const u=n.$elm$=zs.document.createElement(n.$tag$);n.$name$&&n.$elm$.setAttribute("name",t),d&&d!==n.$hostId$?s.$elm$.insertBefore(u,s.$elm$.children[0]):r.parentNode.insertBefore(n.$elm$,r),h8e(c,e,t,r,n.$hostId$),r.remove(),n.$depth$==="0"&&(l[n.$index$]=n.$elm$)}else{const u=n.$elm$,h=d&&d!==n.$hostId$&&s.$elm$.shadowRoot;h8e(c,e,t,r,h?d:n.$hostId$),lvt(r),h&&s.$elm$.insertBefore(u,s.$elm$.children[0]),i.push(n)}o.push(n),s.$children$||(s.$children$=[]),s.$children$[n.$index$]=n}var h8e=(t,e,n,r,s)=>{let i=r.nextSibling;for(t[e]=t[e]||[];i&&((i.getAttribute&&i.getAttribute("slot")||i["s-sn"])===n||n===""&&!i["s-sn"]&&(i.nodeType===8&&i.nodeValue.indexOf(".")!==1||i.nodeType===3));)i["s-sn"]=n,t[e].push({slot:r,node:i,hostId:s}),i=i.nextSibling},m8e=(t,e)=>{let n=t;do n=n.nextSibling;while(n&&(n.nodeType!==e||!n.nodeValue));return n};/**
 * @license
 * Copyright Google Inc. All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://angular.io/license
 *
 * This file is a port of shadowCSS from `webcomponents.js` to TypeScript.
 * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
 * https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts
 */var N_n=t=>{const e=[];let n=0;return t=t.replace(/(\[[^\]]*\])/g,(i,o)=>{const l=`__ph-${n}__`;return e.push(o),n++,l}),{content:t.replace(/(:nth-[-\w]+)(\([^)]+\))/g,(i,o,l)=>{const c=`__ph-${n}__`;return e.push(l),n++,o+c}),placeholders:e}},T_n=(t,e)=>e.replace(/__ph-(\d+)__/g,(n,r)=>t[+r]),A7="-shadowcsshost",hvt="-shadowcssslotted",mvt="-shadowcsscontext",FEe=")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)",__n=new RegExp("("+A7+FEe,"gim"),A_n=new RegExp("("+mvt+FEe,"gim"),P_n=new RegExp("("+hvt+FEe,"gim"),Sj=A7+"-no-combinator",R_n=/-shadowcsshost-no-combinator([^\s]*)/,I_n=[/::shadow/g,/::content/g],M_n="([>\\s~+[.,{:][\\s\\S]*)?$",PW=/-shadowcsshost/gim,BEe=t=>new RegExp(`((?<!(^@supports(.*)))|(?<={.*))(${t}\\b)`,"gim"),L_n=BEe("::slotted"),D_n=BEe(":host"),$_n=BEe(":host-context"),O_n=/\/\*\s*[\s\S]*?\*\//g,F_n=t=>t.replace(O_n,""),B_n=/\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g,U_n=t=>t.match(B_n)||[],z_n=/(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g,V_n=/([{}])/g,H_n=/(^.*?[^\\])??((:+)(.*)|$)/,G_n="{",W_n="}",hQ="%BLOCK%",Tye=(t,e)=>{const n=q_n(t);let r=0;return n.escapedString.replace(z_n,(...s)=>{const i=s[2];let o="",l=s[4],c="";l&&l.startsWith("{"+hQ)&&(o=n.blocks[r++],l=l.substring(hQ.length+1),c="{");const u=e({selector:i,content:o});return`${s[1]}${u.selector}${s[3]}${c}${u.content}${l}`})},q_n=t=>{const e=t.split(V_n),n=[],r=[];let s=0,i=[];for(let l=0;l<e.length;l++){const c=e[l];c===W_n&&s--,s>0?i.push(c):(i.length>0&&(r.push(i.join("")),n.push(hQ),i=[]),n.push(c)),c===G_n&&s++}return i.length>0&&(r.push(i.join("")),n.push(hQ)),{escapedString:n.join(""),blocks:r}},K_n=t=>(t=t.replace($_n,`$1${mvt}`).replace(D_n,`$1${A7}`).replace(L_n,`$1${hvt}`),t),fvt=(t,e,n)=>t.replace(e,(...r)=>{if(r[2]){const s=r[2].split(","),i=[];for(let o=0;o<s.length;o++){const l=s[o].trim();if(!l)break;i.push(n(Sj,l,r[3]))}return i.join(",")}else return Sj+r[3]}),pvt=(t,e,n)=>t+e.replace(A7,"")+n,Y_n=t=>fvt(t,__n,pvt),Q_n=(t,e,n)=>e.indexOf(A7)>-1?pvt(t,e,n):t+e+n+", "+e+" "+t+n,Z_n=(t,e)=>{const n="."+e+" > ",r=[];return t=t.replace(P_n,(...s)=>{if(s[2]){const i=s[2].trim(),o=s[3],l=n+i+o;let c="";for(let h=s[4]-1;h>=0;h--){const m=s[5][h];if(m==="}"||m===",")break;c=m+c}const d=(c+l).trim(),u=`${c.trimEnd()}${l.trim()}`.trim();if(d!==u){const h=`${u}, ${d}`;r.push({orgSelector:d,updatedSelector:h})}return l}else return Sj+s[3]}),{selectors:r,cssText:t}},J_n=t=>fvt(t,A_n,Q_n),X_n=t=>I_n.reduce((e,n)=>e.replace(n," "),t),eAn=t=>{const e=/\[/g,n=/\]/g;return t=t.replace(e,"\\[").replace(n,"\\]"),new RegExp("^("+t+")"+M_n,"m")},tAn=(t,e)=>!eAn(e).test(t),gvt=(t,e)=>t.replace(H_n,(n,r="",s,i="",o="")=>r+e+i+o),nAn=(t,e,n)=>{if(PW.lastIndex=0,PW.test(t)){const r=`.${n}`;return t.replace(R_n,(s,i)=>gvt(i,r)).replace(PW,r+" ")}return e+" "+t},rAn=(t,e,n)=>{const r=/\[is=([^\]]*)\]/g;e=e.replace(r,(p,...g)=>g[0]);const s="."+e,i=p=>{let g=p.trim();if(!g)return"";if(p.indexOf(Sj)>-1)g=nAn(p,e,n);else{const v=p.replace(PW,"");v.length>0&&(g=gvt(v,s))}return g},o=N_n(t);t=o.content;let l="",c=0,d;const u=/( |>|\+|~(?!=))\s*/g;let m=!(t.indexOf(Sj)>-1);for(;(d=u.exec(t))!==null;){const p=d[1],g=t.slice(c,d.index).trim();m=m||g.indexOf(Sj)>-1;const v=m?i(g):g;l+=`${v} ${p} `,c=u.lastIndex}const f=t.substring(c);return m=m||f.indexOf(Sj)>-1,l+=m?i(f):f,T_n(o.placeholders,l)},sAn=(t,e,n,r)=>t.split(",").map(s=>r&&s.indexOf("."+r)>-1?s.trim():tAn(s,e)?rAn(s,e,n).trim():s.trim()).join(", "),vvt=(t,e,n,r,s)=>Tye(t,i=>{let o=i.selector,l=i.content;return i.selector[0]!=="@"?o=sAn(i.selector,e,n,r):(i.selector.startsWith("@media")||i.selector.startsWith("@supports")||i.selector.startsWith("@page")||i.selector.startsWith("@document"))&&(l=vvt(i.content,e,n,r)),{selector:o.replace(/\s{2,}/g," ").trim(),content:l}}),iAn=(t,e,n,r,s)=>{t=K_n(t),t=Y_n(t),t=J_n(t);const i=Z_n(t,r);return t=i.cssText,t=X_n(t),e&&(t=vvt(t,e,n,r)),t=fce(t,n),t=t.replace(/>\s*\*\s+([^{, ]+)/gm," $1 "),{cssText:t.trim(),slottedSelectors:i.selectors.map(o=>({orgSelector:fce(o.orgSelector,n),updatedSelector:fce(o.updatedSelector,n)}))}},fce=(t,e)=>t.replace(/-shadowcsshost-no-combinator/g,`.${e}`),aAn=(t,e,n)=>{const r=e+"-h",s=e+"-s",i=U_n(t);t=F_n(t);const o=[];{const c=d=>{const u=`/*!@___${o.length}___*/`,h=`/*!@${d.selector}*/`;return o.push({placeholder:u,comment:h}),d.selector=u+d.selector,d};t=Tye(t,d=>d.selector[0]!=="@"?c(d):((d.selector.startsWith("@media")||d.selector.startsWith("@supports")||d.selector.startsWith("@page")||d.selector.startsWith("@document"))&&(d.content=Tye(d.content,c)),d))}const l=iAn(t,e,r,s);return t=[l.cssText,...i].join(`
`),o.forEach(({placeholder:c,comment:d})=>{t=t.replace(c,d)}),l.slottedSelectors.forEach(c=>{const d=new RegExp(e_n(c.orgSelector),"g");t=t.replace(d,c.updatedSelector)}),t},yvt=t=>TEe.map(e=>e(t)).find(e=>!!e),oAn=t=>TEe.push(t),lAn=t=>kl(t).$modeName$,mQ=(t,e)=>t!=null&&!PEe(t)?Ce.propBoolean&&e&4?t==="false"?!1:t===""||!!t:Ce.propNumber&&e&2?parseFloat(t):Ce.propString&&e&1?String(t):t:t,bvt=t=>Ce.lazyLoad?kl(t).$hostElement$:t,cAn=(t,e,n)=>{const r=bvt(t);return{emit:s=>(Ce.isDev&&!r.isConnected&&xR(`The "${e}" event was emitted, but the dispatcher node is no longer connected to the dom.`),UEe(r,e,{bubbles:!!(n&4),composed:!!(n&2),cancelable:!!(n&1),detail:s}))}},UEe=(t,e,n)=>{const r=gs.ce(e,n);return t.dispatchEvent(r),r},hA=new WeakMap,zEe=(t,e,n)=>{let r=wR.get(t);AEe&&n?(r=r||new CSSStyleSheet,typeof r=="string"?r=e:r.replaceSync(e)):r=e,wR.set(t,r)},_ye=(t,e,n)=>{var r;const s=Zte(e,n),i=wR.get(s);if(!Ce.attachStyles||!zs.document)return s;if(t=t.nodeType===11?t:zs.document,i)if(typeof i=="string"){t=t.head||t;let o=hA.get(t),l;if(o||hA.set(t,o=new Set),!o.has(s)){if(Ce.hydrateClientSide&&t.host&&(l=t.querySelector(`[${r$}="${s}"]`)))l.innerHTML=i;else{l=document.querySelector(`[${r$}="${s}"]`)||zs.document.createElement("style"),l.innerHTML=i;const c=(r=gs.$nonce$)!=null?r:avt(zs.document);if(c!=null&&l.setAttribute("nonce",c),(Ce.hydrateServerSide||Ce.hotModuleReplacement)&&(e.$flags$&2||e.$flags$&128)&&l.setAttribute(r$,s),!(e.$flags$&1))if(t.nodeName==="HEAD"){const d=t.querySelectorAll("link[rel=preconnect]"),u=d.length>0?d[d.length-1].nextSibling:t.querySelector("style");t.insertBefore(l,(u==null?void 0:u.parentNode)===t?u:null)}else if("host"in t)if(AEe){const d=new CSSStyleSheet;d.replaceSync(i),t.adoptedStyleSheets=[d,...t.adoptedStyleSheets]}else{const d=t.querySelector("style");d?d.innerHTML=i+d.innerHTML:t.prepend(l)}else t.append(l);e.$flags$&1&&t.insertBefore(l,null)}e.$flags$&4&&(l.innerHTML+=tvt),o&&o.add(s)}}else Ce.constructableCSS&&!t.adoptedStyleSheets.includes(i)&&(t.adoptedStyleSheets=[...t.adoptedStyleSheets,i]);return s},xvt=t=>{const e=t.$cmpMeta$,n=t.$hostElement$,r=e.$flags$,s=Ay("attachStyles",e.$tagName$),i=_ye(Ce.shadowDom&&r0&&n.shadowRoot?n.shadowRoot:n.getRootNode(),e,t.$modeName$);(Ce.shadowDom||Ce.scoped)&&Ce.cssAnnotations&&(r&10&&r&2||r&128)&&(n["s-sc"]=i,n.classList.add(i+"-h")),s()},Zte=(t,e)=>"sc-"+(Ce.mode&&e&&t.$flags$&32?t.$tagName$+"-"+e:t.$tagName$),dAn=t=>t.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g,"$1{"),wvt=()=>{if(!zs.document)return;const t=zs.document.querySelectorAll(`[${r$}]`);let e=0;for(;e<t.length;e++)zEe(t[e].getAttribute(r$),dAn(t[e].innerHTML),!0)},f8e=(t,e,n,r,s,i,o)=>{if(n===r)return;let l=Sye(t,e),c=e.toLowerCase();if(Ce.vdomClass&&e==="class"){const d=t.classList,u=p8e(n);let h=p8e(r);Ce.hydrateClientSide&&t["s-si"]&&o?(h.push(t["s-si"]),u.forEach(m=>{m.startsWith(t["s-si"])&&h.push(m)}),h=[...new Set(h)],d.add(...h)):(d.remove(...u.filter(m=>m&&!h.includes(m))),d.add(...h.filter(m=>m&&!u.includes(m))))}else if(Ce.vdomStyle&&e==="style"){if(Ce.updatable)for(const d in n)(!r||r[d]==null)&&(!Ce.hydrateServerSide&&d.includes("-")?t.style.removeProperty(d):t.style[d]="");for(const d in r)(!n||r[d]!==n[d])&&(!Ce.hydrateServerSide&&d.includes("-")?t.style.setProperty(d,r[d]):t.style[d]=r[d])}else if(!(Ce.vdomKey&&e==="key")){if(Ce.vdomRef&&e==="ref")r&&r(t);else if(Ce.vdomListener&&(Ce.lazyLoad?!l:!t.__lookupSetter__(e))&&e[0]==="o"&&e[1]==="n"){if(e[2]==="-"?e=e.slice(3):Sye(zs,c)?e=c.slice(2):e=c[2]+e.slice(3),n||r){const d=e.endsWith(kvt);e=e.replace(hAn,""),n&&gs.rel(t,e,n,d),r&&gs.ael(t,e,r,d)}}else if(Ce.vdomPropOrAttr){const d=PEe(r);if((l||d&&r!==null)&&!s)try{if(t.tagName.includes("-"))t[e]!==r&&(t[e]=r);else{const h=r??"";e==="list"?l=!1:(n==null||t[e]!=h)&&(typeof t.__lookupSetter__(e)=="function"?t[e]=h:t.setAttribute(e,h))}}catch{}let u=!1;Ce.vdomXlink&&c!==(c=c.replace(/^xlink\:?/,""))&&(e=c,u=!0),r==null||r===!1?(r!==!1||t.getAttribute(e)==="")&&(Ce.vdomXlink&&u?t.removeAttributeNS(s8e,e):t.removeAttribute(e)):(!l||i&4||s)&&!d&&t.nodeType===1&&(r=r===!0?"":r,Ce.vdomXlink&&u?t.setAttributeNS(s8e,e,r):t.setAttribute(e,r))}}},uAn=/\s/,p8e=t=>(typeof t=="object"&&t&&"baseVal"in t&&(t=t.baseVal),!t||typeof t!="string"?[]:t.split(uAn)),kvt="Capture",hAn=new RegExp(kvt+"$"),Aye=(t,e,n,r)=>{const s=e.$elm$.nodeType===11&&e.$elm$.host?e.$elm$.host:e.$elm$,i=t&&t.$attrs$||{},o=e.$attrs$||{};if(Ce.updatable)for(const l of g8e(Object.keys(i)))l in o||f8e(s,l,i[l],void 0,n,e.$flags$,r);for(const l of g8e(Object.keys(o)))f8e(s,l,i[l],o[l],n,e.$flags$,r)};function g8e(t){return t.includes("ref")?[...t.filter(e=>e!=="ref"),"ref"]:t}var RW,fQ,jx,s$=!1,pQ=!1,Jte=!1,sh=!1,gQ=(t,e,n)=>{var r;const s=e.$children$[n];let i=0,o,l,c;if(Ce.slotRelocation&&!s$&&(Jte=!0,s.$tag$==="slot"&&(s.$flags$|=s.$children$?2:1)),Ce.isDev&&s.$elm$&&i6(`The JSX ${s.$text$!==null?`"${s.$text$}" text`:`"${s.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`),Ce.vdomText&&s.$text$!==null)o=s.$elm$=zs.document.createTextNode(s.$text$);else if(Ce.slotRelocation&&s.$flags$&1)o=s.$elm$=Ce.isDebug||Ce.hydrateServerSide?fAn(s):zs.document.createTextNode(""),Ce.vdomAttribute&&Aye(null,s,sh);else{if(Ce.svg&&!sh&&(sh=s.$tag$==="svg"),!zs.document)throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component.");if(o=s.$elm$=Ce.svg?zs.document.createElementNS(sh?UTn:zTn,!s$&&Ce.slotRelocation&&s.$flags$&2?"slot-fb":s.$tag$):zs.document.createElement(!s$&&Ce.slotRelocation&&s.$flags$&2?"slot-fb":s.$tag$),Ce.svg&&sh&&s.$tag$==="foreignObject"&&(sh=!1),Ce.vdomAttribute&&Aye(null,s,sh),Ce.scoped&&XTn(RW)&&o["s-si"]!==RW&&o.classList.add(o["s-si"]=RW),s.$children$)for(i=0;i<s.$children$.length;++i)l=gQ(t,s,i),l&&o.appendChild(l);Ce.svg&&(s.$tag$==="svg"?sh=!1:o.tagName==="foreignObject"&&(sh=!0))}return o["s-hn"]=jx,Ce.slotRelocation&&s.$flags$&3&&(o["s-sr"]=!0,o["s-cr"]=fQ,o["s-sn"]=s.$name$||"",o["s-rf"]=(r=s.$attrs$)==null?void 0:r.ref,lvt(o),c=t&&t.$children$&&t.$children$[n],c&&c.$tag$===s.$tag$&&t.$elm$&&(Ce.experimentalSlotFixes?Svt(t.$elm$):o6(t.$elm$,!1)),Ce.scoped&&Tvt(fQ,o,e.$elm$,t==null?void 0:t.$elm$)),o},Svt=t=>{gs.$flags$|=1;const e=t.closest(jx.toLowerCase());if(e!=null){const n=Array.from(e.__childNodes||e.childNodes).find(s=>s["s-cr"]),r=Array.from(t.__childNodes||t.childNodes);for(const s of n?r.reverse():r)s["s-sh"]!=null&&(Cf(e,s,n??null),s["s-sh"]=void 0,Jte=!0)}gs.$flags$&=-2},o6=(t,e)=>{gs.$flags$|=1;const n=Array.from(t.__childNodes||t.childNodes);if(t["s-sr"]&&Ce.experimentalSlotFixes){let r=t;for(;r=r.nextSibling;)r&&r["s-sn"]===t["s-sn"]&&r["s-sh"]===jx&&n.push(r)}for(let r=n.length-1;r>=0;r--){const s=n[r];s["s-hn"]!==jx&&s["s-ol"]&&(Cf(l6(s).parentNode,s,l6(s)),s["s-ol"].remove(),s["s-ol"]=void 0,s["s-sh"]=void 0,Jte=!0),e&&o6(s,e)}gs.$flags$&=-2},Cvt=(t,e,n,r,s,i)=>{let o=Ce.slotRelocation&&t["s-cr"]&&t["s-cr"].parentNode||t,l;for(Ce.shadowDom&&o.shadowRoot&&o.tagName===jx&&(o=o.shadowRoot);s<=i;++s)r[s]&&(l=gQ(null,n,s),l&&(r[s].$elm$=l,Cf(o,l,Ce.slotRelocation?l6(e):e)))},jvt=(t,e,n)=>{for(let r=e;r<=n;++r){const s=t[r];if(s){const i=s.$elm$;Nvt(s),i&&(Ce.slotRelocation&&(pQ=!0,i["s-ol"]?i["s-ol"].remove():o6(i,!0)),i.remove())}}},mAn=(t,e,n,r,s=!1)=>{let i=0,o=0,l=0,c=0,d=e.length-1,u=e[0],h=e[d],m=r.length-1,f=r[0],p=r[m],g,v;for(;i<=d&&o<=m;)if(u==null)u=e[++i];else if(h==null)h=e[--d];else if(f==null)f=r[++o];else if(p==null)p=r[--m];else if(Bz(u,f,s))N_(u,f,s),u=e[++i],f=r[++o];else if(Bz(h,p,s))N_(h,p,s),h=e[--d],p=r[--m];else if(Bz(u,p,s))Ce.slotRelocation&&(u.$tag$==="slot"||p.$tag$==="slot")&&o6(u.$elm$.parentNode,!1),N_(u,p,s),Cf(t,u.$elm$,h.$elm$.nextSibling),u=e[++i],p=r[--m];else if(Bz(h,f,s))Ce.slotRelocation&&(u.$tag$==="slot"||p.$tag$==="slot")&&o6(h.$elm$.parentNode,!1),N_(h,f,s),Cf(t,h.$elm$,u.$elm$),h=e[--d],f=r[++o];else{if(l=-1,Ce.vdomKey){for(c=i;c<=d;++c)if(e[c]&&e[c].$key$!==null&&e[c].$key$===f.$key$){l=c;break}}Ce.vdomKey&&l>=0?(v=e[l],v.$tag$!==f.$tag$?g=gQ(e&&e[o],n,l):(N_(v,f,s),e[l]=void 0,g=v.$elm$),f=r[++o]):(g=gQ(e&&e[o],n,o),f=r[++o]),g&&(Ce.slotRelocation?Cf(l6(u.$elm$).parentNode,g,l6(u.$elm$)):Cf(u.$elm$.parentNode,g,u.$elm$))}i>d?Cvt(t,r[m+1]==null?null:r[m+1].$elm$,n,r,o,m):Ce.updatable&&o>m&&jvt(e,i,d)},Bz=(t,e,n=!1)=>t.$tag$===e.$tag$?Ce.slotRelocation&&t.$tag$==="slot"?t.$name$===e.$name$:Ce.vdomKey&&!n?t.$key$===e.$key$:(n&&!t.$key$&&e.$key$&&(t.$key$=e.$key$),!0):!1,l6=t=>t&&t["s-ol"]||t,N_=(t,e,n=!1)=>{const r=e.$elm$=t.$elm$,s=t.$children$,i=e.$children$,o=e.$tag$,l=e.$text$;let c;!Ce.vdomText||l===null?(Ce.svg&&(sh=o==="svg"?!0:o==="foreignObject"?!1:sh),(Ce.vdomAttribute||Ce.reflect)&&(Ce.slot&&o==="slot"&&!s$&&Ce.experimentalSlotFixes&&t.$name$!==e.$name$&&(e.$elm$["s-sn"]=e.$name$||"",Svt(e.$elm$.parentElement)),Aye(t,e,sh,n)),Ce.updatable&&s!==null&&i!==null?mAn(r,s,e,i,n):i!==null?(Ce.updatable&&Ce.vdomText&&t.$text$!==null&&(r.textContent=""),Cvt(r,null,e,i,0,i.length-1)):!n&&Ce.updatable&&s!==null&&jvt(s,0,s.length-1),Ce.svg&&sh&&o==="svg"&&(sh=!1)):Ce.vdomText&&Ce.slotRelocation&&(c=r["s-cr"])?c.parentNode.textContent=l:Ce.vdomText&&t.$text$!==l&&(r.data=l)},Hb=[],Evt=t=>{let e,n,r;const s=t.__childNodes||t.childNodes;for(const i of s){if(i["s-sr"]&&(e=i["s-cr"])&&e.parentNode){n=e.parentNode.__childNodes||e.parentNode.childNodes;const o=i["s-sn"];for(r=n.length-1;r>=0;r--)if(e=n[r],!e["s-cn"]&&!e["s-nr"]&&e["s-hn"]!==i["s-hn"]&&(!Ce.experimentalSlotFixes||!e["s-sh"]||e["s-sh"]!==i["s-hn"]))if(l8e(e,o)){let l=Hb.find(c=>c.$nodeToRelocate$===e);pQ=!0,e["s-sn"]=e["s-sn"]||o,l?(l.$nodeToRelocate$["s-sh"]=i["s-hn"],l.$slotRefNode$=i):(e["s-sh"]=i["s-hn"],Hb.push({$slotRefNode$:i,$nodeToRelocate$:e})),e["s-sr"]&&Hb.map(c=>{l8e(c.$nodeToRelocate$,e["s-sn"])&&(l=Hb.find(d=>d.$nodeToRelocate$===e),l&&!c.$slotRefNode$&&(c.$slotRefNode$=l.$slotRefNode$))})}else Hb.some(l=>l.$nodeToRelocate$===e)||Hb.push({$nodeToRelocate$:e})}i.nodeType===1&&Evt(i)}},Nvt=t=>{Ce.vdomRef&&(t.$attrs$&&t.$attrs$.ref&&t.$attrs$.ref(null),t.$children$&&t.$children$.map(Nvt))},Cf=(t,e,n)=>{if(Ce.scoped&&typeof e["s-sn"]=="string"&&e["s-sr"]&&e["s-cr"])Tvt(e["s-cr"],e,t,e.parentElement);else if(Ce.experimentalSlotFixes&&typeof e["s-sn"]=="string"){t.getRootNode().nodeType!==11&&dvt(e),t.insertBefore(e,n);const{slotNode:r}=IEe(e);return r&&Qte(r),e}return Ce.experimentalSlotFixes&&t.__insertBefore?t.__insertBefore(e,n):t==null?void 0:t.insertBefore(e,n)};function Tvt(t,e,n,r){var s,i;let o;if(t&&typeof e["s-sn"]=="string"&&e["s-sr"]&&t.parentNode&&t.parentNode["s-sc"]&&(o=e["s-si"]||t.parentNode["s-sc"])){const l=e["s-sn"],c=e["s-hn"];if((s=n.classList)==null||s.add(o+"-s"),r&&((i=r.classList)!=null&&i.contains(o+"-s"))){let d=(r.__childNodes||r.childNodes)[0],u=!1;for(;d;){if(d["s-sn"]!==l&&d["s-hn"]===c&&d["s-sr"]){u=!0;break}d=d.nextSibling}u||r.classList.remove(o+"-s")}}}var Pye=(t,e,n=!1)=>{var r,s,i,o,l;const c=t.$hostElement$,d=t.$cmpMeta$,u=t.$vnode$||CR(null,null),h=jye(e)?e:OEe(null,null,e);if(jx=c.tagName,Ce.isDev&&Array.isArray(e)&&e.some(jye))throw new Error(`The <Host> must be the single root component.
Looks like the render() function of "${jx.toLowerCase()}" is returning an array that contains the <Host>.

The render() function should look like this instead:

render() {
  // Do not return an array
  return (
    <Host>{content}</Host>
  );
}
  `);if(Ce.reflect&&d.$attrsToReflect$&&(h.$attrs$=h.$attrs$||{},d.$attrsToReflect$.map(([m,f])=>h.$attrs$[f]=c[m])),n&&h.$attrs$)for(const m of Object.keys(h.$attrs$))c.hasAttribute(m)&&!["key","ref","style","class"].includes(m)&&(h.$attrs$[m]=c[m]);if(h.$tag$=null,h.$flags$|=4,t.$vnode$=h,h.$elm$=u.$elm$=Ce.shadowDom&&c.shadowRoot||c,(Ce.scoped||Ce.shadowDom)&&(RW=c["s-sc"]),s$=r0&&!!(d.$flags$&1)&&!(d.$flags$&128),Ce.slotRelocation&&(fQ=c["s-cr"],pQ=!1),N_(u,h,n),Ce.slotRelocation){if(gs.$flags$|=1,Jte){Evt(h.$elm$);for(const m of Hb){const f=m.$nodeToRelocate$;if(!f["s-ol"]&&zs.document){const p=Ce.isDebug||Ce.hydrateServerSide?pAn(f):zs.document.createTextNode("");p["s-nr"]=f,Cf(f.parentNode,f["s-ol"]=p,f)}}for(const m of Hb){const f=m.$nodeToRelocate$,p=m.$slotRefNode$;if(p){const g=p.parentNode;let v=p.nextSibling;if(!Ce.hydrateServerSide&&(!Ce.experimentalSlotFixes||v&&v.nodeType===1)){let w=(r=f["s-ol"])==null?void 0:r.previousSibling;for(;w;){let k=(s=w["s-nr"])!=null?s:null;if(k&&k["s-sn"]===f["s-sn"]&&g===(k.__parentNode||k.parentNode)){for(k=k.nextSibling;k===f||k!=null&&k["s-sr"];)k=k==null?void 0:k.nextSibling;if(!k||!k["s-nr"]){v=k;break}}w=w.previousSibling}}const b=f.__parentNode||f.parentNode,x=f.__nextSibling||f.nextSibling;(!v&&g!==b||x!==v)&&f!==v&&(!Ce.experimentalSlotFixes&&!f["s-hn"]&&f["s-ol"]&&(f["s-hn"]=f["s-ol"].parentNode.nodeName),Cf(g,f,v),f.nodeType===1&&f.tagName!=="SLOT-FB"&&(f.hidden=(i=f["s-ih"])!=null?i:!1)),f&&typeof p["s-rf"]=="function"&&p["s-rf"](p)}else f.nodeType===1&&(n&&(f["s-ih"]=(o=f.hidden)!=null?o:!1),f.hidden=!0)}}pQ&&Kte(h.$elm$),gs.$flags$&=-2,Hb.length=0}if(Ce.experimentalScopedSlotChanges&&d.$flags$&2){const m=h.$elm$.__childNodes||h.$elm$.childNodes;for(const f of m)f["s-hn"]!==jx&&!f["s-sh"]&&(n&&f["s-ih"]==null&&(f["s-ih"]=(l=f.hidden)!=null?l:!1),f.hidden=!0)}fQ=void 0},fAn=t=>{var e;return(e=zs.document)==null?void 0:e.createComment(`<slot${t.$name$?' name="'+t.$name$+'"':""}> (host=${jx.toLowerCase()})`)},pAn=t=>{var e;return(e=zs.document)==null?void 0:e.createComment("org-location for "+(t.localName?`<${t.localName}> (host=${t["s-hn"]})`:`[${t.textContent}]`))},_vt=(t,e)=>{if(Ce.asyncLoading&&e&&!t.$onRenderResolve$&&e["s-p"]){const n=e["s-p"].push(new Promise(r=>t.$onRenderResolve$=()=>{e["s-p"].splice(n-1,1),r()}))}},Xte=(t,e)=>{if(Ce.taskQueue&&Ce.updatable&&(t.$flags$|=16),Ce.asyncLoading&&t.$flags$&4){t.$flags$|=512;return}_vt(t,t.$ancestorComponent$);const n=()=>gAn(t,e);return Ce.taskQueue?ivt(n):n()},gAn=(t,e)=>{const n=t.$hostElement$,r=Ay("scheduleUpdate",t.$cmpMeta$.$tagName$),s=Ce.lazyLoad?t.$lazyInstance$:n;if(!s)throw new Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let i;return e?(Ce.lazyLoad&&Ce.hostListener&&(t.$flags$|=256,t.$queuedListeners$&&(t.$queuedListeners$.map(([o,l])=>dx(s,o,l,n)),t.$queuedListeners$=void 0)),QA(n,"componentWillLoad"),i=dx(s,"componentWillLoad",void 0,n)):(QA(n,"componentWillUpdate"),i=dx(s,"componentWillUpdate",void 0,n)),QA(n,"componentWillRender"),i=v8e(i,()=>dx(s,"componentWillRender",void 0,n)),r(),v8e(i,()=>yAn(t,s,e))},v8e=(t,e)=>vAn(t)?t.then(e).catch(n=>{console.error(n),e()}):e(),vAn=t=>t instanceof Promise||t&&t.then&&typeof t.then=="function",yAn=async(t,e,n)=>{var r;const s=t.$hostElement$,i=Ay("update",t.$cmpMeta$.$tagName$),o=s["s-rc"];Ce.style&&n&&xvt(t);const l=Ay("render",t.$cmpMeta$.$tagName$);if(Ce.isDev&&(t.$flags$|=1024),Ce.hydrateServerSide?await y8e(t,e,s,n):y8e(t,e,s,n),Ce.isDev&&(t.$renderCount$=t.$renderCount$===void 0?1:t.$renderCount$+1,t.$flags$&=-1025),Ce.hydrateServerSide)try{Pvt(s),n&&(t.$cmpMeta$.$flags$&1?s["s-en"]="":t.$cmpMeta$.$flags$&2&&(s["s-en"]="c"))}catch(c){hn(c,s)}if(Ce.asyncLoading&&o&&(o.map(c=>c()),s["s-rc"]=void 0),l(),i(),Ce.asyncLoading){const c=(r=s["s-p"])!=null?r:[],d=()=>Iye(t);c.length===0?d():(Promise.all(c).then(d),t.$flags$|=4,c.length=0)}else Iye(t)},Rye=null,y8e=(t,e,n,r)=>{const s=!!Ce.allRenderFn,i=!!Ce.lazyLoad,o=!!Ce.taskQueue,l=!!Ce.updatable;try{if(Rye=e,e=(s||e.render)&&e.render(),l&&o&&(t.$flags$&=-17),(l||i)&&(t.$flags$|=2),Ce.hasRenderFn||Ce.reflect)if(Ce.vdomRender||Ce.reflect){if(Ce.hydrateServerSide)return Promise.resolve(e).then(c=>Pye(t,c,r));Pye(t,e,r)}else{const c=n.shadowRoot;t.$cmpMeta$.$flags$&1?c.textContent=e:n.textContent=e}}catch(c){hn(c,t.$hostElement$)}return Rye=null,null},bAn=()=>Rye,Iye=t=>{const e=t.$cmpMeta$.$tagName$,n=t.$hostElement$,r=Ay("postUpdate",e),s=Ce.lazyLoad?t.$lazyInstance$:n,i=t.$ancestorComponent$;Ce.isDev&&(t.$flags$|=1024),dx(s,"componentDidRender",void 0,n),Ce.isDev&&(t.$flags$&=-1025),QA(n,"componentDidRender"),t.$flags$&64?(Ce.isDev&&(t.$flags$|=1024),dx(s,"componentDidUpdate",void 0,n),Ce.isDev&&(t.$flags$&=-1025),QA(n,"componentDidUpdate"),r()):(t.$flags$|=64,Ce.asyncLoading&&Ce.cssAnnotations&&xAn(n),Ce.isDev&&(t.$flags$|=2048),dx(s,"componentDidLoad",void 0,n),Ce.isDev&&(t.$flags$&=-2049),QA(n,"componentDidLoad"),r(),Ce.asyncLoading&&(t.$onReadyResolve$(n),i||Mye(e))),Ce.method&&Ce.lazyLoad&&t.$onInstanceResolve$(n),Ce.asyncLoading&&(t.$onRenderResolve$&&(t.$onRenderResolve$(),t.$onRenderResolve$=void 0),t.$flags$&512&&T7(()=>Xte(t,!1)),t.$flags$&=-517)},Avt=t=>{if(Ce.updatable&&(kye.isBrowser||kye.isTesting)){const e=kl(t),n=e.$hostElement$.isConnected;return n&&(e.$flags$&18)===2&&Xte(e,!1),n}return!1},Mye=t=>{Ce.asyncQueue&&(gs.$flags$|=2),T7(()=>UEe(zs,"appload",{detail:{namespace:cQ}})),Ce.profile&&performance.measure&&performance.measure(`[Stencil] ${cQ} initial load (by ${t})`,"st:app:start")},dx=(t,e,n,r)=>{if(t&&t[e])try{return t[e](n)}catch(s){hn(s,r)}},QA=(t,e)=>{Ce.lifecycleDOMEvents&&UEe(t,"stencil_"+e,{bubbles:!0,composed:!0,detail:{namespace:cQ}})},xAn=t=>{var e,n;return Ce.hydratedClass?t.classList.add((e=Ce.hydratedSelectorName)!=null?e:"hydrated"):Ce.hydratedAttribute?t.setAttribute((n=Ce.hydratedSelectorName)!=null?n:"hydrated",""):void 0},Pvt=t=>{const e=t.children;if(e!=null)for(let n=0,r=e.length;n<r;n++){const s=e[n];typeof s.connectedCallback=="function"&&s.connectedCallback(),Pvt(s)}},Lye=(t,e)=>kl(t).$instanceValues$.get(e),G4=(t,e,n,r)=>{const s=kl(t);if(Ce.lazyLoad&&!s)throw new Error(`Couldn't find host element for "${r.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`);const i=Ce.lazyLoad?s.$hostElement$:t,o=s.$instanceValues$.get(e),l=s.$flags$,c=Ce.lazyLoad?s.$lazyInstance$:i;n=mQ(n,r.$members$[e][0]);const d=Number.isNaN(o)&&Number.isNaN(n),u=n!==o&&!d;if((!Ce.lazyLoad||!(l&8)||o===void 0)&&u&&(s.$instanceValues$.set(e,n),Ce.isDev&&(s.$flags$&1024?xR(`The state/prop "${e}" changed during rendering. This can potentially lead to infinite-loops and other bugs.`,`
Element`,i,`
New value`,n,`
Old value`,o):s.$flags$&2048&&xR(`The state/prop "${e}" changed during "componentDidLoad()", this triggers extra re-renders, try to setup on "componentWillLoad()"`,`
Element`,i,`
New value`,n,`
Old value`,o)),!Ce.lazyLoad||c)){if(Ce.watchCallback&&r.$watchers$&&l&128){const h=r.$watchers$[e];h&&h.map(m=>{try{c[m](n,o,e)}catch(f){hn(f,i)}})}if(Ce.updatable&&(l&18)===2){if(c.componentShouldUpdate&&c.componentShouldUpdate(n,o,e)===!1)return;Xte(s,!1)}}},ene=(t,e,n)=>{var r,s;const i=t.prototype;if(Ce.isTesting){if(i.__stencilAugmented)return;i.__stencilAugmented=!0}if(Ce.formAssociated&&e.$flags$&64&&n&1&&KTn.forEach(o=>{const l=i[o];Object.defineProperty(i,o,{value(...c){const d=kl(this),u=Ce.lazyLoad?d.$lazyInstance$:this;if(!u)d.$onReadyPromise$.then(h=>{const m=h[o];typeof m=="function"&&m.call(h,...c)});else{const h=Ce.lazyLoad?u[o]:l;typeof h=="function"&&h.call(u,...c)}}})}),Ce.member&&e.$members$||Ce.watchCallback&&(e.$watchers$||t.watchers)){Ce.watchCallback&&t.watchers&&!e.$watchers$&&(e.$watchers$=t.watchers);const o=Object.entries((r=e.$members$)!=null?r:{});if(o.map(([l,[c]])=>{if((Ce.prop||Ce.state)&&(c&31||(!Ce.lazyLoad||n&2)&&c&32)){const{get:d,set:u}=Object.getOwnPropertyDescriptor(i,l)||{};d&&(e.$members$[l][0]|=2048),u&&(e.$members$[l][0]|=4096),(n&1||!d)&&Object.defineProperty(i,l,{get(){if(Ce.lazyLoad){if(!(e.$members$[l][0]&2048))return Lye(this,l);const h=kl(this),m=h?h.$lazyInstance$:i;return m?m[l]:void 0}if(!Ce.lazyLoad)return d?d.apply(this):Lye(this,l)},configurable:!0,enumerable:!0}),Object.defineProperty(i,l,{set(h){const m=kl(this);if(Ce.isDev&&!(n&1)&&!(e.$members$[l][0]&4096)&&(m&&m.$flags$&8)===0&&c&31&&!(c&1024)&&xR(`@Prop() "${l}" on <${e.$tagName$}> is immutable but was modified from within the component.
More information: https://stenciljs.com/docs/properties#prop-mutability`),u){const f=c&32?this[l]:m.$hostElement$[l];typeof f>"u"&&m.$instanceValues$.get(l)?h=m.$instanceValues$.get(l):!m.$instanceValues$.get(l)&&f&&m.$instanceValues$.set(l,f),u.apply(this,[mQ(h,c)]),h=c&32?this[l]:m.$hostElement$[l],G4(this,l,h,e);return}if(!Ce.lazyLoad){G4(this,l,h,e);return}if(Ce.lazyLoad){if(!(n&1)||!(e.$members$[l][0]&4096)){G4(this,l,h,e),n&1&&!m.$lazyInstance$&&m.$onReadyPromise$.then(()=>{e.$members$[l][0]&4096&&m.$lazyInstance$[l]!==m.$instanceValues$.get(l)&&(m.$lazyInstance$[l]=h)});return}const f=()=>{const p=m.$lazyInstance$[l];!m.$instanceValues$.get(l)&&p&&m.$instanceValues$.set(l,p),m.$lazyInstance$[l]=mQ(h,c),G4(this,l,m.$lazyInstance$[l],e)};m.$lazyInstance$?f():m.$onReadyPromise$.then(()=>f())}}})}else Ce.lazyLoad&&Ce.method&&n&1&&c&64&&Object.defineProperty(i,l,{value(...d){var u;const h=kl(this);return(u=h==null?void 0:h.$onInstancePromise$)==null?void 0:u.then(()=>{var m;return(m=h.$lazyInstance$)==null?void 0:m[l](...d)})}})}),Ce.observeAttribute&&(!Ce.lazyLoad||n&1)){const l=new Map;i.attributeChangedCallback=function(c,d,u){gs.jmp(()=>{var h;const m=l.get(c);if(this.hasOwnProperty(m)&&Ce.lazyLoad)u=this[m],delete this[m];else{if(i.hasOwnProperty(m)&&typeof this[m]=="number"&&this[m]==u)return;if(m==null){const p=kl(this),g=p==null?void 0:p.$flags$;if(g&&!(g&8)&&g&128&&u!==d){const v=Ce.lazyLoad?p.$hostElement$:this,b=Ce.lazyLoad?p.$lazyInstance$:v,x=(h=e.$watchers$)==null?void 0:h[c];x==null||x.forEach(w=>{b[w]!=null&&b[w].call(b,u,d,c)})}return}}const f=Object.getOwnPropertyDescriptor(i,m);u=u===null&&typeof this[m]=="boolean"?!1:u,u!==this[m]&&(!f.get||f.set)&&(this[m]=u)})},t.observedAttributes=Array.from(new Set([...Object.keys((s=e.$watchers$)!=null?s:{}),...o.filter(([c,d])=>d[0]&15).map(([c,d])=>{var u;const h=d[1]||c;return l.set(h,c),Ce.reflect&&d[0]&512&&((u=e.$attrsToReflect$)==null||u.push([c,h])),h})]))}}return t},Dye=async(t,e,n,r)=>{let s;if(!(e.$flags$&32)){e.$flags$|=32;const l=n.$lazyBundleId$;if(Ce.lazyLoad&&l){const c=Qgt(n,e,r);if(c&&"then"in c){const u=x_n(`st:load:${n.$tagName$}:${e.$modeName$}`,`[Stencil] Load module for <${n.$tagName$}>`);s=await c,u()}else s=c;if(!s)throw new Error(`Constructor for "${n.$tagName$}#${e.$modeName$}" was not found`);Ce.member&&!s.isProxied&&(Ce.watchCallback&&(n.$watchers$=s.watchers),ene(s,n,2),s.isProxied=!0);const d=Ay("createInstance",n.$tagName$);Ce.member&&(e.$flags$|=8);try{new s(e)}catch(u){hn(u,t)}Ce.member&&(e.$flags$&=-9),Ce.watchCallback&&(e.$flags$|=128),d(),$ye(e.$lazyInstance$,t)}else{s=t.constructor;const c=t.localName;customElements.whenDefined(c).then(()=>e.$flags$|=128)}if(Ce.style&&s&&s.style){let c;typeof s.style=="string"?c=s.style:Ce.mode&&typeof s.style!="string"&&(e.$modeName$=yvt(t),e.$modeName$&&(c=s.style[e.$modeName$]),Ce.hydrateServerSide&&e.$modeName$&&t.setAttribute("s-mode",e.$modeName$));const d=Zte(n,e.$modeName$);if(!wR.has(d)){const u=Ay("registerStyles",n.$tagName$);Ce.hydrateServerSide&&Ce.shadowDom&&n.$flags$&128&&(c=aAn(c,d)),zEe(d,c,!!(n.$flags$&1)),u()}}}const i=e.$ancestorComponent$,o=()=>Xte(e,!0);Ce.asyncLoading&&i&&i["s-rc"]?i["s-rc"].push(o):o()},$ye=(t,e)=>{Ce.lazyLoad&&dx(t,"connectedCallback",void 0,e)},VEe=t=>{if(!(gs.$flags$&1)){const e=kl(t),n=e.$cmpMeta$,r=Ay("connectedCallback",n.$tagName$);if(Ce.hostListenerTargetParent&&c6(t,e,n.$listeners$,!0),e.$flags$&1)c6(t,e,n.$listeners$,!1),e!=null&&e.$lazyInstance$?$ye(e.$lazyInstance$,t):e!=null&&e.$onReadyPromise$&&e.$onReadyPromise$.then(()=>$ye(e.$lazyInstance$,t));else{e.$flags$|=1;let s;if(Ce.hydrateClientSide&&(s=t.getAttribute(kR),s)){if(Ce.shadowDom&&r0&&n.$flags$&1){const i=Ce.mode?_ye(t.shadowRoot,n,t.getAttribute("s-mode")):_ye(t.shadowRoot,n);t.classList.remove(i+"-h",i+"-s")}else if(Ce.scoped&&n.$flags$&2){const i=Zte(n,Ce.mode?t.getAttribute("s-mode"):void 0);t["s-sc"]=i}E_n(t,n.$tagName$,s,e)}if(Ce.slotRelocation&&!s&&(Ce.hydrateServerSide||(Ce.slot||Ce.shadowDom)&&n.$flags$&12)&&wAn(t),Ce.asyncLoading){let i=t;for(;i=i.parentNode||i.host;)if(Ce.hydrateClientSide&&i.nodeType===1&&i.hasAttribute("s-id")&&i["s-p"]||i["s-p"]){_vt(e,e.$ancestorComponent$=i);break}}Ce.prop&&!Ce.hydrateServerSide&&n.$members$&&Object.entries(n.$members$).map(([i,[o]])=>{if(o&31&&t.hasOwnProperty(i)){const l=t[i];delete t[i],t[i]=l}}),Ce.initializeNextTick?T7(()=>Dye(t,e,n)):Dye(t,e,n)}r()}},wAn=t=>{if(!zs.document)return;const e=t["s-cr"]=zs.document.createComment(Ce.isDebug?`content-ref (host=${t.localName})`:"");e["s-cn"]=!0,Cf(t,e,t.firstChild)},pce=(t,e)=>{Ce.lazyLoad&&dx(t,"disconnectedCallback",void 0,e||t)},HEe=async t=>{if(!(gs.$flags$&1)){const e=kl(t);Ce.hostListener&&e.$rmListeners$&&(e.$rmListeners$.map(n=>n()),e.$rmListeners$=void 0),Ce.lazyLoad?e!=null&&e.$lazyInstance$?pce(e.$lazyInstance$,t):e!=null&&e.$onReadyPromise$&&e.$onReadyPromise$.then(()=>pce(e.$lazyInstance$,t)):pce(t)}hA.has(t)&&hA.delete(t),t.shadowRoot&&hA.has(t.shadowRoot)&&hA.delete(t.shadowRoot)},kAn=(t,e)=>{customElements.define(e[1],Rvt(t,e))},Rvt=(t,e)=>{const n={$flags$:e[0],$tagName$:e[1]};Ce.member&&(n.$members$=e[2]),Ce.hostListener&&(n.$listeners$=e[3]),Ce.watchCallback&&(n.$watchers$=t.$watchers$),Ce.reflect&&(n.$attrsToReflect$=[]),Ce.shadowDom&&!r0&&n.$flags$&1&&(n.$flags$|=8),Ce.experimentalSlotFixes?Ce.scoped&&n.$flags$&2&&cvt(t.prototype):(Ce.slotChildNodesFix&&$Ee(t.prototype),Ce.cloneNodeFix&&MEe(t.prototype),Ce.appendChildSlotFix&&LEe(t.prototype),Ce.scopedSlotTextContentFix&&n.$flags$&2&&DEe(t.prototype)),Ce.hydrateClientSide&&Ce.shadowDom&&wvt();const r=t.prototype.connectedCallback,s=t.prototype.disconnectedCallback;return Object.assign(t.prototype,{__hasHostListenerAttached:!1,__registerHost(){NEe(this,n)},connectedCallback(){if(!this.__hasHostListenerAttached){const i=kl(this);c6(this,i,n.$listeners$,!1),this.__hasHostListenerAttached=!0}VEe(this),r&&r.call(this)},disconnectedCallback(){HEe(this),s&&s.call(this)},__attachShadow(){if(r0){if(!this.shadowRoot)Ce.shadowDelegatesFocus?this.attachShadow({mode:"open",delegatesFocus:!!(n.$flags$&16)}):this.attachShadow({mode:"open"});else if(this.shadowRoot.mode!=="open")throw new Error(`Unable to re-use existing shadow root for ${n.$tagName$}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else this.shadowRoot=this}}),t.is=n.$tagName$,ene(t,n,3)},SAn=t=>{if(Ce.style&&Ce.mode&&!Ce.lazyLoad){const e=yvt(t),n=kl(t);if(n.$modeName$!==e){const r=n.$cmpMeta$,s=t["s-sc"],i=Zte(r,e),o=t.constructor.style[e],l=r.$flags$;o&&(wR.has(i)||zEe(i,o,!!(l&1)),n.$modeName$=e,t.classList.remove(s+"-h",s+"-s"),xvt(n),Avt(t))}}},CAn=(t,e,n)=>{const r=kl(t);r.$flags$=1,Dye(t,r,e,n)},jAn=(t,e={})=>{var n;if(Ce.profile&&performance.mark&&performance.mark("st:app:start"),k_n(),!zs.document){console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");return}const r=Ay("bootstrapLazy"),s=[],i=e.exclude||[],o=zs.customElements,l=zs.document.head,c=l.querySelector("meta[charset]"),d=zs.document.createElement("style"),u=[];let h,m=!0;Object.assign(gs,e),gs.$resourcesUrl$=new URL(e.resourcesUrl||"./",zs.document.baseURI).href,Ce.asyncQueue&&e.syncQueue&&(gs.$flags$|=4),Ce.hydrateClientSide&&(gs.$flags$|=2),Ce.hydrateClientSide&&Ce.shadowDom&&wvt();let f=!1;if(t.map(p=>{p[1].map(g=>{var v;const b={$flags$:g[0],$tagName$:g[1],$members$:g[2],$listeners$:g[3]};b.$flags$&4&&(f=!0),Ce.member&&(b.$members$=g[2]),Ce.hostListener&&(b.$listeners$=g[3]),Ce.reflect&&(b.$attrsToReflect$=[]),Ce.watchCallback&&(b.$watchers$=(v=g[4])!=null?v:{}),Ce.shadowDom&&!r0&&b.$flags$&1&&(b.$flags$|=8);const x=Ce.transformTagName&&e.transformTagName?e.transformTagName(b.$tagName$):b.$tagName$,w=class extends HTMLElement{constructor(k){if(super(k),this.hasRegisteredEventListeners=!1,k=this,NEe(k,b),Ce.shadowDom&&b.$flags$&1)if(r0){if(!k.shadowRoot)Ce.shadowDelegatesFocus?k.attachShadow({mode:"open",delegatesFocus:!!(b.$flags$&16)}):k.attachShadow({mode:"open"});else if(k.shadowRoot.mode!=="open")throw new Error(`Unable to re-use existing shadow root for ${b.$tagName$}! Mode is set to ${k.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else!Ce.hydrateServerSide&&!("shadowRoot"in k)&&(k.shadowRoot=k)}connectedCallback(){const k=kl(this);this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0,c6(this,k,b.$listeners$,!1)),h&&(clearTimeout(h),h=null),m?u.push(this):gs.jmp(()=>VEe(this))}disconnectedCallback(){gs.jmp(()=>HEe(this)),gs.raf(()=>{var k;const S=kl(this),C=u.findIndex(j=>j===this);C>-1&&u.splice(C,1),((k=S==null?void 0:S.$vnode$)==null?void 0:k.$elm$)instanceof Node&&!S.$vnode$.$elm$.isConnected&&delete S.$vnode$.$elm$})}componentOnReady(){return kl(this).$onReadyPromise$}};Ce.experimentalSlotFixes?Ce.scoped&&b.$flags$&2&&cvt(w.prototype):(Ce.slotChildNodesFix&&$Ee(w.prototype),Ce.cloneNodeFix&&MEe(w.prototype),Ce.appendChildSlotFix&&LEe(w.prototype),Ce.scopedSlotTextContentFix&&b.$flags$&2&&DEe(w.prototype)),Ce.formAssociated&&b.$flags$&64&&(w.formAssociated=!0),Ce.hotModuleReplacement&&(w.prototype["s-hmr"]=function(k){CAn(this,b,k)}),b.$lazyBundleId$=p[0],!i.includes(x)&&!o.get(x)&&(s.push(x),o.define(x,ene(w,b,1)))})}),s.length>0&&(f&&(d.textContent+=tvt),Ce.invisiblePrehydration&&(Ce.hydratedClass||Ce.hydratedAttribute)&&(d.textContent+=s.sort()+WTn),d.innerHTML.length)){d.setAttribute("data-styles","");const p=(n=gs.$nonce$)!=null?n:avt(zs.document);p!=null&&d.setAttribute("nonce",p),l.insertBefore(d,c?c.nextSibling:l.firstChild)}m=!1,u.length?u.map(p=>p.connectedCallback()):Ce.profile?gs.jmp(()=>h=setTimeout(Mye,30,"timeout")):gs.jmp(()=>h=setTimeout(Mye,30)),r()},EAn=(t,e)=>e,c6=(t,e,n,r)=>{Ce.hostListener&&n&&zs.document&&(Ce.hostListenerTargetParent&&(r?n=n.filter(([s])=>s&32):n=n.filter(([s])=>!(s&32))),n.map(([s,i,o])=>{const l=Ce.hostListenerTarget?TAn(zs.document,t,s):t,c=NAn(e,o),d=_An(s);gs.ael(l,i,c,d),(e.$rmListeners$=e.$rmListeners$||[]).push(()=>gs.rel(l,i,c,d))}))},NAn=(t,e)=>n=>{var r;try{Ce.lazyLoad?t.$flags$&256?(r=t.$lazyInstance$)==null||r[e](n):(t.$queuedListeners$=t.$queuedListeners$||[]).push([e,n]):t.$hostElement$[e](n)}catch(s){hn(s,t.$hostElement$)}},TAn=(t,e,n)=>Ce.hostListenerTargetDocument&&n&4?t:Ce.hostListenerTargetWindow&&n&8?zs:Ce.hostListenerTargetBody&&n&16?t.body:Ce.hostListenerTargetParent&&n&32&&e.parentElement?e.parentElement:e,_An=t=>nvt?{passive:(t&1)!==0,capture:(t&2)!==0}:(t&2)!==0,AAn=t=>gs.$nonce$=t,PAn=t=>Object.assign(gs,t),RAn=(t,e)=>{if(t!=null){const n=r8e in t?t[r8e]:{...qTn};n.staticComponents=new Set(e);const r=[];Ivt(t,t.body,n,r),r.forEach(s=>{var i;if(s!=null&&s["s-nr"]){const o=s["s-nr"];let l=o["s-host-id"],c=o["s-node-id"],d=`${l}.${c}`;if(l==null){if(l=0,n.rootLevelIds++,c=n.rootLevelIds,d=`${l}.${c}`,o.nodeType===1)o.setAttribute(SR,d),typeof o["s-sn"]=="string"&&!o.getAttribute("slot")&&o.setAttribute("s-sn",o["s-sn"]);else if(o.nodeType===3){if(l===0&&((i=o.nodeValue)==null?void 0:i.trim())===""){s.remove();return}const m=t.createComment(d);m.nodeValue=`${_Ee}.${d}`,Cf(o.parentNode,m,o)}else if(o.nodeType===8){const m=t.createComment(d);m.nodeValue=`${evt}.${d}`,o.parentNode.insertBefore(m,o)}}let u=`${Jgt}.${d}`;const h=s.parentElement;h&&(h["s-en"]===""?u+=".":h["s-en"]==="c"&&(u+=".c")),s.nodeValue=u}})}},Ivt=(t,e,n,r)=>{var s;e!=null&&(e["s-nr"]!=null&&r.push(e),e.nodeType===1&&[...Array.from(e.childNodes),...Array.from(((s=e.shadowRoot)==null?void 0:s.childNodes)||[])].forEach(o=>{const l=kl(o);if(l!=null&&!n.staticComponents.has(o.nodeName.toLowerCase())){const c={nodeIds:0};IAn(t,o,l.$vnode$,n,c)}Ivt(t,o,n,r)}))},IAn=(t,e,n,r,s)=>{if(n!=null){const i=++r.hostIds;if(e.setAttribute(kR,i),e["s-cr"]!=null&&(e["s-cr"].nodeValue=`${Zgt}.${i}`),n.$children$!=null&&n.$children$.forEach((l,c)=>{Mvt(t,l,s,i,0,c)}),e&&n&&n.$elm$&&!e.hasAttribute(SR)){const o=e.parentElement;if(o&&o.childNodes){const l=Array.from(o.childNodes),c=l.find(d=>d.nodeType===8&&d["s-sr"]);if(c){const d=l.indexOf(e)-1;n.$elm$.setAttribute(SR,`${c["s-host-id"]}.${c["s-node-id"]}.0.${d}`)}}}}},Mvt=(t,e,n,r,s,i)=>{const o=e.$elm$;if(o==null)return;const l=n.nodeIds++,c=`${r}.${l}.${s}.${i}`;if(o["s-host-id"]=r,o["s-node-id"]=l,o.nodeType===1)o.setAttribute(SR,c),typeof o["s-sn"]=="string"&&!o.getAttribute("slot")&&o.setAttribute("s-sn",o["s-sn"]);else if(o.nodeType===3){const d=o.parentNode,u=d==null?void 0:d.nodeName;if(u!=="STYLE"&&u!=="SCRIPT"){const h=`${_Ee}.${c}`,m=t.createComment(h);Cf(d,m,o)}}else if(o.nodeType===8&&o["s-sr"]){const d=o["s-sn"]||"",u=`${Xgt}.${c}.${d}`;o.nodeValue=u}if(e.$children$!=null){const d=s+1;e.$children$.forEach((u,h)=>{Mvt(t,u,n,r,d,h)})}};const MAn=Object.freeze({__proto__:null,BUILD:Ce,Build:kye,Env:OTn,Fragment:EAn,H:i8e,HTMLElement:i8e,Host:uvt,NAMESPACE:cQ,STENCIL_DEV_MODE:qte,addHostEventListeners:c6,bootstrapLazy:jAn,cmpModules:_W,connectedCallback:VEe,consoleDevError:i6,consoleDevInfo:HTn,consoleDevWarn:xR,consoleError:hn,createEvent:cAn,defineCustomElement:kAn,disconnectedCallback:HEe,forceModeUpdate:SAn,forceUpdate:Avt,getAssetPath:ZTn,getElement:bvt,getHostRef:kl,getMode:lAn,getRenderingRef:bAn,getValue:Lye,h:OEe,insertVdomAnnotations:RAn,isMemberInElement:Sye,loadModule:Qgt,modeResolutionChain:TEe,nextTick:T7,parsePropertyValue:mQ,plt:gs,postUpdateComponent:Iye,promiseResolve:rvt,proxyComponent:ene,proxyCustomElement:Rvt,readTask:QTn,registerHost:NEe,registerInstance:VTn,renderVdom:Pye,setAssetPath:JTn,setErrorHandler:GTn,setMode:oAn,setNonce:AAn,setPlatformHelpers:YTn,setPlatformOptions:PAn,setValue:G4,styles:wR,supportsConstructableStylesheets:AEe,supportsListenerOptions:nvt,supportsShadow:r0,win:zs,writeTask:ivt});let Lvt=0;function LAn(){return++Lvt}function cSs(){Lvt=0}const Dvt="temp-";function DAn(){return{id:`${Dvt}${Math.random().toString(36)}`,title:`Room ${LAn()}`,participants:[]}}function gce(t){return t.includes(Dvt)}function $An(t,e){const n=t.length,r=Math.ceil(n/e),s=new Array(e);let i=0;for(let o=0;o<e;o++)s[o]=t.slice(i,i+r),i+=r;return s.filter(o=>o.length)}function ng(t){return t.customParticipantId}function dSs(t){const e=new Map;return[t.self,...t.participants.joined.toArray()].map(n=>{e.set(ng(n),n.picture)}),[t.connectedMeetings.parentMeeting,...t.connectedMeetings.meetings].flatMap(n=>n.participants).map(n=>({id:n.id,customParticipantId:ng(n),displayName:n.displayName,displayPictureUrl:n.displayPictureUrl!==""?n.displayPictureUrl:e.get(ng(n))}))}const uSs=t=>{const e=t.self.permissions.connectedMeetings;return e.canAlterConnectedMeetings?!0:e.canSwitchConnectedMeetings||e.canSwitchToParentMeeting?t.connectedMeetings.isActive:!1};var Zh=function(t,e,n,r,s){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?s.call(t,n):s?s.value=n:e.set(t,n),n},pr=function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},OAn=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n},qh,$w,rg,sg,ij,rm,c1,ig,i$,a$,$vt,vQ,Ovt,Fvt,T_;let hSs=class{constructor(){qh.add(this),$w.set(this,!1),rg.set(this,void 0),sg.set(this,void 0),ij.set(this,void 0),rm.set(this,void 0),c1.set(this,void 0),ig.set(this,void 0),i$.set(this,void 0),a$.set(this,void 0)}get hasLocalChanges(){return pr(this,$w,"f")}get currentState(){let e,n=[];return Array.from(pr(this,rm,"f").keys()).forEach(r=>{const s=pr(this,ig,"f").get(r);s.isParent?e=Object.assign(Object.assign({},s),{participants:pr(this,qh,"m",T_).call(this,r)}):n.push(Object.assign(Object.assign({},s),{participants:pr(this,qh,"m",T_).call(this,r)}))}),{parentMeeting:e,meetings:n}}get allConnectedMeetings(){return this.currentState.meetings.sort((e,n)=>e.title.localeCompare(n.title))}get allParticipants(){return Array.from(pr(this,c1,"f").values())}get unassignedParticipants(){return pr(this,qh,"m",T_).call(this,pr(this,rg,"f").parentMeeting.id)}getParticipantsForMeeting(e){return pr(this,qh,"m",T_).call(this,e)}addNewMeeting(){Zh(this,$w,!0,"f");const e=DAn(),n=OAn(e,["participants"]);return pr(this,qh,"m",vQ).call(this,Object.assign(Object.assign({},n),{isParent:!1})),n}addNewMeetings(e){return Array.from({length:e}).map(()=>this.addNewMeeting())}updateMeetingTitle(e,n){pr(this,ig,"f").get(e).title=n,gce(e)||pr(this,i$,"f").add(e)}deleteMeeting(e){Zh(this,$w,!0,"f");const n=pr(this,ig,"f").get(e),r=pr(this,qh,"m",T_).call(this,n.id).map(ng);this.assignParticipantsToMeeting(r,pr(this,rg,"f").parentMeeting.id),pr(this,ig,"f").delete(n.id),pr(this,rm,"f").delete(n.id),gce(n.id)||pr(this,a$,"f").add(n.id)}assignParticipantsToMeeting(e,n){return Zh(this,$w,!0,"f"),e.forEach(r=>{const s=pr(this,sg,"f").get(r);pr(this,rm,"f").get(s).delete(r),pr(this,rm,"f").get(n).add(r),pr(this,sg,"f").set(r,n)}),this.currentState}assignParticipantsRandomly(){const e=$An(this.unassignedParticipants,this.allConnectedMeetings.length);return this.allConnectedMeetings.forEach((n,r)=>{const s=e[r];s&&s.length!==0&&this.assignParticipantsToMeeting(s.map(i=>i.customParticipantId),n.id)}),this.currentState}unassignParticipants(e){const n=pr(this,rg,"f").parentMeeting.id;return this.assignParticipantsToMeeting(e,n)}unassignAllParticipants(){const e=pr(this,rg,"f").parentMeeting.id,n=this.allParticipants.map(ng);return this.assignParticipantsToMeeting(n,e)}updateCurrentState(e){pr(this,$w,"f")||pr(this,qh,"m",$vt).call(this,e),[e.parentMeeting,...e.meetings].forEach((n,r)=>{const s=Object.assign(Object.assign({},n),{isParent:r===0});pr(this,qh,"m",vQ).call(this,s),n.participants.forEach(i=>{pr(this,qh,"m",Ovt).call(this,i,s)})})}get meetingsToCreate(){return this.allConnectedMeetings.filter(e=>gce(e.id)).map(({id:e,title:n})=>({id:e,title:n}))}get meetingsToUpdate(){return this.allConnectedMeetings.filter(e=>pr(this,i$,"f").has(e.id)).map(({id:e,title:n})=>({id:e,title:n}))}get meetingsToDelete(){return Array.from(pr(this,a$,"f"))}get participantsToMove(){const e=new Map;return Array.from(pr(this,sg,"f").keys()).forEach(n=>{const r=pr(this,ij,"f").get(n),s=pr(this,sg,"f").get(n);if(r===s)return;const i=`${r}__${s}`;e.has(i)||e.set(i,[]);const o=pr(this,c1,"f").get(n);e.get(i).push(o.id)}),Array.from(e.keys()).map(n=>{const[r,s]=n.split("__");return{sourceMeetingId:r,destinationMeetingId:s,participantIds:e.get(n)}})}async applyChanges(e){const n=this.meetingsToCreate.length!==0?e.connectedMeetings.createMeetings(this.meetingsToCreate):Promise.resolve([]),r=this.meetingsToUpdate.length!==0?e.connectedMeetings.updateMeetings(this.meetingsToUpdate):Promise.resolve(),[s]=await Promise.all([n,r]);s&&s.forEach(i=>{this.meetingsToCreate.forEach(o=>{o.title===i.title&&pr(this,qh,"m",Fvt).call(this,pr(this,ig,"f").get(o.id),i.id)})}),this.participantsToMove.length!==0&&this.participantsToMove.forEach(({sourceMeetingId:i,destinationMeetingId:o,participantIds:l})=>{e.connectedMeetings.moveParticipants(i,o,l)}),this.meetingsToDelete.length!==0&&e.connectedMeetings.deleteMeetings(this.meetingsToDelete)}discardChanges(){return Zh(this,$w,!1,"f"),this.updateCurrentState(pr(this,rg,"f")),this.currentState}};$w=new WeakMap,rg=new WeakMap,sg=new WeakMap,ij=new WeakMap,rm=new WeakMap,c1=new WeakMap,ig=new WeakMap,i$=new WeakMap,a$=new WeakMap,qh=new WeakSet,$vt=function(e){Zh(this,rg,e,"f"),Zh(this,ig,new Map,"f"),Zh(this,c1,new Map,"f"),Zh(this,i$,new Set,"f"),Zh(this,a$,new Set,"f"),Zh(this,rm,new Map,"f"),Zh(this,sg,new Map,"f"),Zh(this,ij,new Map,"f"),Zh(this,ij,new Map,"f"),pr(this,rg,"f").parentMeeting.participants.forEach(n=>{pr(this,ij,"f").set(ng(n),pr(this,rg,"f").parentMeeting.id)}),pr(this,rg,"f").meetings.forEach(n=>{n.participants.forEach(r=>{pr(this,ij,"f").set(ng(r),n.id)})})},vQ=function(e){pr(this,ig,"f").has(e.id)||(pr(this,ig,"f").set(e.id,e),pr(this,rm,"f").set(e.id,new Set))},Ovt=function(e,n){pr(this,c1,"f").has(ng(e))||(pr(this,c1,"f").set(ng(e),e),pr(this,sg,"f").set(ng(e),n.id),pr(this,rm,"f").get(n.id).add(ng(e)))},Fvt=function(e,n){const r=e.id;pr(this,qh,"m",vQ).call(this,Object.assign(Object.assign({},e),{id:n})),pr(this,ig,"f").delete(r);const s=pr(this,rm,"f").get(r);pr(this,rm,"f").set(n,s),pr(this,rm,"f").delete(r),Array.from(pr(this,sg,"f").keys()).forEach(i=>{pr(this,sg,"f").get(i)===r&&pr(this,sg,"f").set(i,n)})},T_=function(e){return Array.from(pr(this,rm,"f").get(e)).map(r=>pr(this,c1,"f").get(r))};var FAn=typeof global=="object"&&global&&global.Object===Object&&global;const Bvt=FAn;var BAn=typeof self=="object"&&self&&self.Object===Object&&self,UAn=Bvt||BAn||Function("return this")();const Qy=UAn;var zAn=Qy.Symbol;const jR=zAn;var Uvt=Object.prototype,VAn=Uvt.hasOwnProperty,HAn=Uvt.toString,m3=jR?jR.toStringTag:void 0;function GAn(t){var e=VAn.call(t,m3),n=t[m3];try{t[m3]=void 0;var r=!0}catch{}var s=HAn.call(t);return r&&(e?t[m3]=n:delete t[m3]),s}var WAn=Object.prototype,qAn=WAn.toString;function KAn(t){return qAn.call(t)}var YAn="[object Null]",QAn="[object Undefined]",b8e=jR?jR.toStringTag:void 0;function AI(t){return t==null?t===void 0?QAn:YAn:b8e&&b8e in Object(t)?GAn(t):KAn(t)}function UE(t){return t!=null&&typeof t=="object"}var ZAn=Array.isArray;const d6=ZAn;function SS(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var JAn="[object AsyncFunction]",XAn="[object Function]",ePn="[object GeneratorFunction]",tPn="[object Proxy]";function GEe(t){if(!SS(t))return!1;var e=AI(t);return e==XAn||e==ePn||e==JAn||e==tPn}var nPn=Qy["__core-js_shared__"];const vce=nPn;var x8e=function(){var t=/[^.]+$/.exec(vce&&vce.keys&&vce.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function rPn(t){return!!x8e&&x8e in t}var sPn=Function.prototype,iPn=sPn.toString;function zE(t){if(t!=null){try{return iPn.call(t)}catch{}try{return t+""}catch{}}return""}var aPn=/[\\^$.*+?()[\]{}|]/g,oPn=/^\[object .+?Constructor\]$/,lPn=Function.prototype,cPn=Object.prototype,dPn=lPn.toString,uPn=cPn.hasOwnProperty,hPn=RegExp("^"+dPn.call(uPn).replace(aPn,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function mPn(t){if(!SS(t)||rPn(t))return!1;var e=GEe(t)?hPn:oPn;return e.test(zE(t))}function fPn(t,e){return t==null?void 0:t[e]}function VE(t,e){var n=fPn(t,e);return mPn(n)?n:void 0}var pPn=VE(Qy,"WeakMap");const Oye=pPn;var w8e=Object.create,gPn=function(){function t(){}return function(e){if(!SS(e))return{};if(w8e)return w8e(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();const vPn=gPn;function yPn(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}var bPn=function(){try{var t=VE(Object,"defineProperty");return t({},"",{}),t}catch{}}();const yQ=bPn;function xPn(t,e){for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}var wPn=9007199254740991,kPn=/^(?:0|[1-9]\d*)$/;function zvt(t,e){var n=typeof t;return e=e??wPn,!!e&&(n=="number"||n!="symbol"&&kPn.test(t))&&t>-1&&t%1==0&&t<e}function WEe(t,e,n){e=="__proto__"&&yQ?yQ(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function tne(t,e){return t===e||t!==t&&e!==e}var SPn=Object.prototype,CPn=SPn.hasOwnProperty;function Vvt(t,e,n){var r=t[e];(!(CPn.call(t,e)&&tne(r,n))||n===void 0&&!(e in t))&&WEe(t,e,n)}function jPn(t,e,n,r){var s=!n;n||(n={});for(var i=-1,o=e.length;++i<o;){var l=e[i],c=void 0;c===void 0&&(c=t[l]),s?WEe(n,l,c):Vvt(n,l,c)}return n}var EPn=9007199254740991;function Hvt(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=EPn}function nne(t){return t!=null&&Hvt(t.length)&&!GEe(t)}var NPn=Object.prototype;function qEe(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||NPn;return t===n}function TPn(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var _Pn="[object Arguments]";function k8e(t){return UE(t)&&AI(t)==_Pn}var Gvt=Object.prototype,APn=Gvt.hasOwnProperty,PPn=Gvt.propertyIsEnumerable,RPn=k8e(function(){return arguments}())?k8e:function(t){return UE(t)&&APn.call(t,"callee")&&!PPn.call(t,"callee")};const Fye=RPn;function IPn(){return!1}var Wvt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,S8e=Wvt&&typeof module=="object"&&module&&!module.nodeType&&module,MPn=S8e&&S8e.exports===Wvt,C8e=MPn?Qy.Buffer:void 0,LPn=C8e?C8e.isBuffer:void 0,DPn=LPn||IPn;const KEe=DPn;var $Pn="[object Arguments]",OPn="[object Array]",FPn="[object Boolean]",BPn="[object Date]",UPn="[object Error]",zPn="[object Function]",VPn="[object Map]",HPn="[object Number]",GPn="[object Object]",WPn="[object RegExp]",qPn="[object Set]",KPn="[object String]",YPn="[object WeakMap]",QPn="[object ArrayBuffer]",ZPn="[object DataView]",JPn="[object Float32Array]",XPn="[object Float64Array]",eRn="[object Int8Array]",tRn="[object Int16Array]",nRn="[object Int32Array]",rRn="[object Uint8Array]",sRn="[object Uint8ClampedArray]",iRn="[object Uint16Array]",aRn="[object Uint32Array]",Ka={};Ka[JPn]=Ka[XPn]=Ka[eRn]=Ka[tRn]=Ka[nRn]=Ka[rRn]=Ka[sRn]=Ka[iRn]=Ka[aRn]=!0;Ka[$Pn]=Ka[OPn]=Ka[QPn]=Ka[FPn]=Ka[ZPn]=Ka[BPn]=Ka[UPn]=Ka[zPn]=Ka[VPn]=Ka[HPn]=Ka[GPn]=Ka[WPn]=Ka[qPn]=Ka[KPn]=Ka[YPn]=!1;function oRn(t){return UE(t)&&Hvt(t.length)&&!!Ka[AI(t)]}function YEe(t){return function(e){return t(e)}}var qvt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,o$=qvt&&typeof module=="object"&&module&&!module.nodeType&&module,lRn=o$&&o$.exports===qvt,yce=lRn&&Bvt.process,cRn=function(){try{var t=o$&&o$.require&&o$.require("util").types;return t||yce&&yce.binding&&yce.binding("util")}catch{}}();const ER=cRn;var j8e=ER&&ER.isTypedArray,dRn=j8e?YEe(j8e):oRn;const Kvt=dRn;var uRn=Object.prototype,hRn=uRn.hasOwnProperty;function Yvt(t,e){var n=d6(t),r=!n&&Fye(t),s=!n&&!r&&KEe(t),i=!n&&!r&&!s&&Kvt(t),o=n||r||s||i,l=o?TPn(t.length,String):[],c=l.length;for(var d in t)(e||hRn.call(t,d))&&!(o&&(d=="length"||s&&(d=="offset"||d=="parent")||i&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||zvt(d,c)))&&l.push(d);return l}function Qvt(t,e){return function(n){return t(e(n))}}var mRn=Qvt(Object.keys,Object);const fRn=mRn;var pRn=Object.prototype,gRn=pRn.hasOwnProperty;function vRn(t){if(!qEe(t))return fRn(t);var e=[];for(var n in Object(t))gRn.call(t,n)&&n!="constructor"&&e.push(n);return e}function yRn(t){return nne(t)?Yvt(t):vRn(t)}function bRn(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}var xRn=Object.prototype,wRn=xRn.hasOwnProperty;function kRn(t){if(!SS(t))return bRn(t);var e=qEe(t),n=[];for(var r in t)r=="constructor"&&(e||!wRn.call(t,r))||n.push(r);return n}function Zvt(t){return nne(t)?Yvt(t,!0):kRn(t)}var SRn=VE(Object,"create");const u6=SRn;function CRn(){this.__data__=u6?u6(null):{},this.size=0}function jRn(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var ERn="__lodash_hash_undefined__",NRn=Object.prototype,TRn=NRn.hasOwnProperty;function _Rn(t){var e=this.__data__;if(u6){var n=e[t];return n===ERn?void 0:n}return TRn.call(e,t)?e[t]:void 0}var ARn=Object.prototype,PRn=ARn.hasOwnProperty;function RRn(t){var e=this.__data__;return u6?e[t]!==void 0:PRn.call(e,t)}var IRn="__lodash_hash_undefined__";function MRn(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=u6&&e===void 0?IRn:e,this}function U2(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}U2.prototype.clear=CRn;U2.prototype.delete=jRn;U2.prototype.get=_Rn;U2.prototype.has=RRn;U2.prototype.set=MRn;function LRn(){this.__data__=[],this.size=0}function rne(t,e){for(var n=t.length;n--;)if(tne(t[n][0],e))return n;return-1}var DRn=Array.prototype,$Rn=DRn.splice;function ORn(t){var e=this.__data__,n=rne(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():$Rn.call(e,n,1),--this.size,!0}function FRn(t){var e=this.__data__,n=rne(e,t);return n<0?void 0:e[n][1]}function BRn(t){return rne(this.__data__,t)>-1}function URn(t,e){var n=this.__data__,r=rne(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function M0(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}M0.prototype.clear=LRn;M0.prototype.delete=ORn;M0.prototype.get=FRn;M0.prototype.has=BRn;M0.prototype.set=URn;var zRn=VE(Qy,"Map");const h6=zRn;function VRn(){this.size=0,this.__data__={hash:new U2,map:new(h6||M0),string:new U2}}function HRn(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function sne(t,e){var n=t.__data__;return HRn(e)?n[typeof e=="string"?"string":"hash"]:n.map}function GRn(t){var e=sne(this,t).delete(t);return this.size-=e?1:0,e}function WRn(t){return sne(this,t).get(t)}function qRn(t){return sne(this,t).has(t)}function KRn(t,e){var n=sne(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}function PI(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}PI.prototype.clear=VRn;PI.prototype.delete=GRn;PI.prototype.get=WRn;PI.prototype.has=qRn;PI.prototype.set=KRn;function YRn(t,e){for(var n=-1,r=e.length,s=t.length;++n<r;)t[s+n]=e[n];return t}var QRn=Qvt(Object.getPrototypeOf,Object);const Jvt=QRn;function ZRn(){this.__data__=new M0,this.size=0}function JRn(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function XRn(t){return this.__data__.get(t)}function e5n(t){return this.__data__.has(t)}var t5n=200;function n5n(t,e){var n=this.__data__;if(n instanceof M0){var r=n.__data__;if(!h6||r.length<t5n-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new PI(r)}return n.set(t,e),this.size=n.size,this}function HE(t){var e=this.__data__=new M0(t);this.size=e.size}HE.prototype.clear=ZRn;HE.prototype.delete=JRn;HE.prototype.get=XRn;HE.prototype.has=e5n;HE.prototype.set=n5n;var Xvt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,E8e=Xvt&&typeof module=="object"&&module&&!module.nodeType&&module,r5n=E8e&&E8e.exports===Xvt,N8e=r5n?Qy.Buffer:void 0,T8e=N8e?N8e.allocUnsafe:void 0;function eyt(t,e){if(e)return t.slice();var n=t.length,r=T8e?T8e(n):new t.constructor(n);return t.copy(r),r}function s5n(t,e){for(var n=-1,r=t==null?0:t.length,s=0,i=[];++n<r;){var o=t[n];e(o,n,t)&&(i[s++]=o)}return i}function i5n(){return[]}var a5n=Object.prototype,o5n=a5n.propertyIsEnumerable,_8e=Object.getOwnPropertySymbols,l5n=_8e?function(t){return t==null?[]:(t=Object(t),s5n(_8e(t),function(e){return o5n.call(t,e)}))}:i5n;const c5n=l5n;function d5n(t,e,n){var r=e(t);return d6(t)?r:YRn(r,n(t))}function u5n(t){return d5n(t,yRn,c5n)}var h5n=VE(Qy,"DataView");const Bye=h5n;var m5n=VE(Qy,"Promise");const Uye=m5n;var f5n=VE(Qy,"Set");const zye=f5n;var A8e="[object Map]",p5n="[object Object]",P8e="[object Promise]",R8e="[object Set]",I8e="[object WeakMap]",M8e="[object DataView]",g5n=zE(Bye),v5n=zE(h6),y5n=zE(Uye),b5n=zE(zye),x5n=zE(Oye),$C=AI;(Bye&&$C(new Bye(new ArrayBuffer(1)))!=M8e||h6&&$C(new h6)!=A8e||Uye&&$C(Uye.resolve())!=P8e||zye&&$C(new zye)!=R8e||Oye&&$C(new Oye)!=I8e)&&($C=function(t){var e=AI(t),n=e==p5n?t.constructor:void 0,r=n?zE(n):"";if(r)switch(r){case g5n:return M8e;case v5n:return A8e;case y5n:return P8e;case b5n:return R8e;case x5n:return I8e}return e});const QEe=$C;var w5n=Object.prototype,k5n=w5n.hasOwnProperty;function S5n(t){var e=t.length,n=new t.constructor(e);return e&&typeof t[0]=="string"&&k5n.call(t,"index")&&(n.index=t.index,n.input=t.input),n}var C5n=Qy.Uint8Array;const L8e=C5n;function ZEe(t){var e=new t.constructor(t.byteLength);return new L8e(e).set(new L8e(t)),e}function j5n(t,e){var n=ZEe(t.buffer);return new t.constructor(n,t.byteOffset,t.byteLength)}var E5n=/\w*$/;function N5n(t){var e=new t.constructor(t.source,E5n.exec(t));return e.lastIndex=t.lastIndex,e}var D8e=jR?jR.prototype:void 0,$8e=D8e?D8e.valueOf:void 0;function T5n(t){return $8e?Object($8e.call(t)):{}}function tyt(t,e){var n=e?ZEe(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var _5n="[object Boolean]",A5n="[object Date]",P5n="[object Map]",R5n="[object Number]",I5n="[object RegExp]",M5n="[object Set]",L5n="[object String]",D5n="[object Symbol]",$5n="[object ArrayBuffer]",O5n="[object DataView]",F5n="[object Float32Array]",B5n="[object Float64Array]",U5n="[object Int8Array]",z5n="[object Int16Array]",V5n="[object Int32Array]",H5n="[object Uint8Array]",G5n="[object Uint8ClampedArray]",W5n="[object Uint16Array]",q5n="[object Uint32Array]";function K5n(t,e,n){var r=t.constructor;switch(e){case $5n:return ZEe(t);case _5n:case A5n:return new r(+t);case O5n:return j5n(t);case F5n:case B5n:case U5n:case z5n:case V5n:case H5n:case G5n:case W5n:case q5n:return tyt(t,n);case P5n:return new r;case R5n:case L5n:return new r(t);case I5n:return N5n(t);case M5n:return new r;case D5n:return T5n(t)}}function nyt(t){return typeof t.constructor=="function"&&!qEe(t)?vPn(Jvt(t)):{}}var Y5n="[object Map]";function Q5n(t){return UE(t)&&QEe(t)==Y5n}var O8e=ER&&ER.isMap,Z5n=O8e?YEe(O8e):Q5n;const J5n=Z5n;var X5n="[object Set]";function eIn(t){return UE(t)&&QEe(t)==X5n}var F8e=ER&&ER.isSet,tIn=F8e?YEe(F8e):eIn;const nIn=tIn;var rIn=1,ryt="[object Arguments]",sIn="[object Array]",iIn="[object Boolean]",aIn="[object Date]",oIn="[object Error]",syt="[object Function]",lIn="[object GeneratorFunction]",cIn="[object Map]",dIn="[object Number]",iyt="[object Object]",uIn="[object RegExp]",hIn="[object Set]",mIn="[object String]",fIn="[object Symbol]",pIn="[object WeakMap]",gIn="[object ArrayBuffer]",vIn="[object DataView]",yIn="[object Float32Array]",bIn="[object Float64Array]",xIn="[object Int8Array]",wIn="[object Int16Array]",kIn="[object Int32Array]",SIn="[object Uint8Array]",CIn="[object Uint8ClampedArray]",jIn="[object Uint16Array]",EIn="[object Uint32Array]",_a={};_a[ryt]=_a[sIn]=_a[gIn]=_a[vIn]=_a[iIn]=_a[aIn]=_a[yIn]=_a[bIn]=_a[xIn]=_a[wIn]=_a[kIn]=_a[cIn]=_a[dIn]=_a[iyt]=_a[uIn]=_a[hIn]=_a[mIn]=_a[fIn]=_a[SIn]=_a[CIn]=_a[jIn]=_a[EIn]=!0;_a[oIn]=_a[syt]=_a[pIn]=!1;function IW(t,e,n,r,s,i){var o,l=e&rIn;if(o!==void 0)return o;if(!SS(t))return t;var c=d6(t);if(c)o=S5n(t);else{var d=QEe(t),u=d==syt||d==lIn;if(KEe(t))return eyt(t,l);if(d==iyt||d==ryt||u&&!s)o=u?{}:nyt(t);else{if(!_a[d])return s?t:{};o=K5n(t,d,l)}}i||(i=new HE);var h=i.get(t);if(h)return h;i.set(t,o),nIn(t)?t.forEach(function(p){o.add(IW(p,e,n,p,t,i))}):J5n(t)&&t.forEach(function(p,g){o.set(g,IW(p,e,n,g,t,i))});var m=u5n,f=c?void 0:m(t);return xPn(f||t,function(p,g){f&&(g=p,p=t[g]),Vvt(o,g,IW(p,e,n,g,t,i))}),o}var NIn=1,TIn=4;function _In(t){return IW(t,NIn|TIn)}function AIn(t){return structuredClone?structuredClone(t):_In(t)}const PIn={designTokens:{spacingBase:4,googleFont:"Inter"},styles:{"rtk-header":{display:"grid",height:"48px",gridTemplateColumns:"repeat(3, 1fr)",gridTemplateRows:"1fr",alignItems:"center","--header-section-gap":"var(--rtk-space-2, 8px)"},"rtk-header.sm":{display:"grid",gridArea:"header",gridTemplateColumns:"repeat(2, 1fr)",gridTemplateRows:"1fr",alignItems:"center","--header-section-gap":"var(--rtk-space-1, 4px)"},"div#header-left":{display:"flex",alignItems:"center",height:"48px",wordBreak:"break-all",gap:"var(--header-section-gap)"},"rtk-logo":{height:"26px"},"div#header-center":{display:"flex",alignItems:"center",justifyContent:"center",wordBreak:"break-all",gap:"var(--header-section-gap)",paddingInline:"var(--rtk-space-3, 12px)"},"div#header-right":{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"var(--header-section-gap)"},"rtk-stage":{display:"flex",flex:"1"},"rtk-grid":{flex:"1",height:"auto"},"rtk-controlbar":{display:"grid",gridTemplateColumns:"repeat(3,1fr)",gridTemplateRows:"1fr",alignItems:"center",padding:"8px"},"rtk-controlbar.sm":{display:"flex",position:"relative",backgroundColor:"rgb(var(--rtk-colors-background-1000, 0 0 0))"},"rtk-controlbar.md":{display:"flex",position:"relative",backgroundColor:"rgb(var(--rtk-colors-background-1000, 0 0 0))"},"div#controlbar-left":{display:"flex",alignItems:"center",gap:"var(--rtk-space-1, 4px)"},"div#controlbar-center":{display:"flex",alignItems:"center",gap:"var(--rtk-space-1, 4px)",position:"relative",overflow:"visible",justifyContent:"center"},"div#controlbar-mobile":{display:"flex",flex:"1",alignItems:"center",gap:"var(--rtk-space-1, 4px)",justifyContent:"center"},"div#controlbar-right":{display:"flex",alignItems:"center",gap:"var(--rtk-space-1, 4px)",justifyContent:"flex-end"},"rtk-settings":{width:"720px",height:"480px"},"rtk-debugger":{width:"720px",height:"480px"},"rtk-breakout-rooms-manager":{minHeight:"400px",minWidth:"500px",maxWidth:"80%",maxHeight:"480px"},"div#setupcontrols-media":{position:"absolute",bottom:"8px",right:"8px",display:"flex",gap:"4px"},"div#setupcontrols-settings":{position:"absolute",top:"8px",right:"8px",display:"flex",flexDirection:"column",gap:"6px"},"rtk-meeting-title.sm":{marginLeft:"0"},"rtk-clock":{marginRight:"0"}},root:{"rtk-meeting":{state:"meeting",states:["activeSidebar"]},"rtk-meeting[meeting=waiting]":["rtk-waiting-screen"],"rtk-meeting[meeting=idle]":["rtk-idle-screen"],"rtk-meeting[meeting=setup]":["rtk-setup-screen","rtk-dialog-manager"],"rtk-meeting[meeting=joined]":["rtk-header","rtk-stage","rtk-controlbar","rtk-participants-audio","rtk-dialog-manager"],"rtk-meeting[meeting=joined].activeSidebar.sm":{add:[["rtk-sidebar",{view:"full-screen"}]]},"rtk-meeting[meeting=joined].activeSidebar.md":{add:[["rtk-sidebar",{view:"full-screen"}]]},"rtk-meeting[meeting=ended]":["rtk-ended-screen"],"rtk-header":["div#header-left","div#header-center","div#header-right"],"rtk-header.sm":{remove:["div#header-center"]},"div#header-left":["rtk-logo","rtk-recording-indicator","rtk-livestream-indicator"],"div#header-center":["rtk-meeting-title"],"div#header-right":["rtk-grid-pagination","rtk-clock","rtk-participant-count","rtk-viewer-count"],"div#header-left.sm":["rtk-meeting-title","rtk-recording-indicator","rtk-livestream-indicator"],"rtk-stage":{states:["activeSidebar"],children:["rtk-grid","rtk-notifications","rtk-transcripts"]},"rtk-stage.activeSidebar":{add:[["rtk-sidebar",{view:"sidebar"}]]},"rtk-stage.activeSidebar.sm":{remove:["rtk-sidebar"]},"rtk-grid":{states:["activeScreenShare","activePlugin","activeSpotlight"],children:["rtk-simple-grid"]},"rtk-grid.activeSpotlight":["rtk-spotlight-grid"],"rtk-grid.activeScreenShare":["rtk-mixed-grid"],"rtk-grid.activePlugin":["rtk-mixed-grid"],"rtk-grid.activeScreenShare.activeSpotlight":["rtk-mixed-grid"],"rtk-grid.activePlugin.activeSpotlight":["rtk-mixed-grid"],"rtk-grid.activePlugin.activeScreenShare.activeSpotlight":["rtk-mixed-grid"],"rtk-mixed-grid":{states:["activeSpotlight"],children:["rtk-simple-grid"]},"rtk-mixed-grid.activeSpotlight":["rtk-spotlight-grid"],"rtk-participant-tile":{state:"meeting",children:["rtk-name-tag","rtk-avatar","rtk-network-indicator"]},"rtk-participant-setup":["rtk-avatar","div#setupcontrols-media"],"rtk-participant-tile[meeting=setup]":["rtk-avatar","div#setupcontrols-settings","div#setupcontrols-media"],"div#setupcontrols-media":[["rtk-mic-toggle",{size:"sm"}],["rtk-camera-toggle",{size:"sm"}]],"div#setupcontrols-settings":[["rtk-settings-toggle",{size:"sm"}]],"rtk-screenshare-view":{children:["rtk-name-tag","rtk-network-indicator"]},"rtk-name-tag":[["rtk-audio-visualizer",{slot:"start"}]],"rtk-controlbar":{states:["activeMoreMenu"],props:{variant:"solid"},children:["div#controlbar-left","div#controlbar-center","div#controlbar-right"]},"rtk-more-toggle":{states:["activeMoreMenu"],children:[]},"rtk-controlbar.sm":["div#controlbar-mobile"],"rtk-controlbar.md":["div#controlbar-mobile"],"rtk-more-toggle.activeMoreMenu":[["rtk-fullscreen-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-pip-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-caption-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-mute-all-button",{variant:"horizontal",slot:"more-elements"}],["rtk-breakout-rooms-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-recording-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-debugger-toggle",{variant:"horizontal"}]],"rtk-more-toggle.activeMoreMenu.sm":[["rtk-chat-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-participants-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-polls-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-plugins-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-fullscreen-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-screen-share-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-pip-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-caption-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-mute-all-button",{variant:"horizontal",slot:"more-elements"}],["rtk-breakout-rooms-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-settings-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-ai-toggle",{variant:"horizontal"}],["rtk-debugger-toggle",{variant:"horizontal"}]],"rtk-more-toggle.activeMoreMenu.md":[["rtk-chat-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-participants-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-polls-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-plugins-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-fullscreen-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-screen-share-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-pip-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-caption-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-mute-all-button",{variant:"horizontal",slot:"more-elements"}],["rtk-breakout-rooms-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-settings-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-ai-toggle",{variant:"horizontal"}],["rtk-debugger-toggle",{variant:"horizontal"}]],"div#controlbar-mobile":["rtk-mic-toggle","rtk-camera-toggle","rtk-webinar-stage-toggle","rtk-stage-toggle","rtk-leave-button","rtk-more-toggle"],"div#controlbar-left":["rtk-settings-toggle","rtk-screen-share-toggle","rtk-livestream-toggle"],"div#controlbar-center":["rtk-mic-toggle","rtk-camera-toggle","rtk-webinar-stage-toggle","rtk-stage-toggle","rtk-more-toggle","rtk-leave-button"],"div#controlbar-right":["rtk-chat-toggle","rtk-polls-toggle","rtk-participants-toggle","rtk-plugins-toggle","rtk-ai-toggle"]},config:{notification_sounds:{participant_left:!1},participant_joined_sound_notification_limit:10,participant_chat_message_sound_notification_limit:10,videoFit:"cover"}},ayt=()=>AIn(PIn),fSs=t=>oyt(t)?t.meta.viewType==="LIVESTREAM"&&t.stage.status!=="ON_STAGE":!1,pSs=t=>{var e;return oyt(t)?t.meta.viewType==="LIVESTREAM"&&((e=t==null?void 0:t.self)===null||e===void 0?void 0:e.permissions.canLivestream):!1},oyt=t=>t==null?void 0:t.livestream;var B8e;(function(t){t.BUFFERING="Buffering",t.ENDED="Ended",t.IDLE="Idle",t.PAUSED="Paused",t.PLAYING="Playing",t.READY="Ready"})(B8e||(B8e={}));var U8e;(function(t){t.INITIALIZED="PlayerInitialized",t.QUALITY_CHANGED="PlayerQualityChanged",t.DURATION_CHANGED="PlayerDurationChanged",t.VOLUME_CHANGED="PlayerVolumeChanged",t.MUTED_CHANGED="PlayerMutedChanged",t.PLAYBACK_RATE_CHANGED="PlayerPlaybackRateChanged",t.REBUFFERING="PlayerRebuffering",t.AUDIO_BLOCKED="PlayerAudioBlocked",t.PLAYBACK_BLOCKED="PlayerPlaybackBlocked",t.ERROR="PlayerError",t.RECOVERABLE_ERROR="PlayerRecoverableError",t.ANALYTICS_EVENT="PlayerAnalyticsEvent",t.TIME_UPDATE="PlayerTimeUpdate",t.BUFFER_UPDATE="PlayerBufferUpdate",t.SEEK_COMPLETED="PlayerSeekCompleted",t.SESSION_DATA="PlayerSessionData",t.STATE_CHANGED="PlayerStateChanged",t.WORKER_ERROR="PlayerWorkerError",t.METADATA="PlayerMetadata",t.TEXT_CUE="PlayerTextCue",t.TEXT_METADATA_CUE="PlayerTextMetadataCue",t.AD_CUE="PlayerAdCue",t.STREAM_SOURCE_CUE="PlayerStreamSourceCue",t.NETWORK_UNAVAILABLE="PlayerNetworkUnavailable",t.SEGMENT_DISCONTINUITY="PlayerSegmentDiscontinuity",t.SEGMENT_METADATA="PlayerSegmentMetadata",t.PLAYER_METADATA="PlayerMetadata"})(U8e||(U8e={}));function gSs({meeting:t,hlsLevels:e}){let n=t.self.config.livestreamViewerQualities||[];if(!n.length)return{autoLevelChangeAllowed:!0,levels:e};const r=e.filter(s=>n.includes(s.height));return r.length?{autoLevelChangeAllowed:!1,levels:r}:{autoLevelChangeAllowed:!0,levels:e}}const RIn=(t,e,n)=>{let r=t.get(e);r||(r=[],t.set(e,r)),r.some(s=>s.deref()===n)||r.push(new WeakRef(n))},IIn=(t,e)=>{let n;return(...r)=>{n&&clearTimeout(n),n=setTimeout(()=>{n=0,t(...r)},e)}},MIn=t=>!("isConnected"in t)||t.isConnected,z8e=IIn(t=>{for(let e of t.keys()){const n=t.get(e).filter(r=>{const s=r.deref();return s&&MIn(s)});t.set(e,n)}},2e3),lyt=MAn,V8e=lyt.forceUpdate,H8e=lyt.getRenderingRef,LIn=()=>{if(typeof H8e!="function"||typeof V8e!="function")return{};const t=V8e,e=H8e,n=new Map;return{dispose:()=>n.clear(),get:r=>{const s=e();s&&RIn(n,r,s)},set:r=>{const s=n.get(r);if(s){const i=s.filter(o=>{const l=o.deref();return l?t(l):!1});n.set(r,i)}z8e(n)},reset:()=>{n.forEach(r=>{r.forEach(s=>{const i=s.deref();i&&t(i)})}),z8e(n)}}},DIn=t=>typeof t=="function"?t():t,$In=(t,e=(n,r)=>n!==r)=>{const n=()=>DIn(t)??{},r=n();let s=new Map(Object.entries(r));const i=typeof Proxy<"u",o=i?null:{},l={dispose:[],get:[],set:[],reset:[]},c=new Map,d=()=>{s=new Map(Object.entries(n())),i||k(),l.reset.forEach(S=>S())},u=()=>{l.dispose.forEach(S=>S()),d()},h=S=>(l.get.forEach(C=>C(S)),s.get(S)),m=(S,C)=>{const j=s.get(S);e(C,j,S)&&(s.set(S,C),i||w(S),l.set.forEach(E=>E(S,C,j)))},f=i?new Proxy(r,{get(S,C){return h(C)},ownKeys(S){return Array.from(s.keys())},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}},has(S,C){return s.has(C)},set(S,C,j){return m(C,j),!0}}):(k(),o),p=(S,C)=>(l[S].push(C),()=>{bce(l[S],C)}),g=(S,C)=>{const j=(_,T)=>{_===S&&C(T)},E=()=>{const _=n();C(_[S])},N=p("set",j),A=p("reset",E);return c.set(C,{setHandler:j,resetHandler:E,propName:S}),()=>{N(),A(),c.delete(C)}},v=(...S)=>{const C=S.reduce((j,E)=>(E.set&&j.push(p("set",E.set)),E.get&&j.push(p("get",E.get)),E.reset&&j.push(p("reset",E.reset)),E.dispose&&j.push(p("dispose",E.dispose)),j),[]);return()=>C.forEach(j=>j())},b=S=>{const C=s.get(S);l.set.forEach(j=>j(S,C,C))},x=(S,C)=>{const j=c.get(C);j&&j.propName===S&&(bce(l.set,j.setHandler),bce(l.reset,j.resetHandler),c.delete(C))};function w(S){i||!o||Object.prototype.hasOwnProperty.call(o,S)||Object.defineProperty(o,S,{configurable:!0,enumerable:!0,get(){return h(S)},set(C){m(S,C)}})}function k(){if(i||!o)return;const S=new Set(s.keys());for(const C of Object.keys(o))S.has(C)||delete o[C];for(const C of S)w(C)}return{state:f,get:h,set:m,on:p,onChange:g,use:v,dispose:u,reset:d,forceUpdate:b,removeListener:x}},bce=(t,e)=>{const n=t.indexOf(e);n>=0&&(t[n]=t[t.length-1],t.length--)},cyt=(t,e)=>{const n=$In(t,e);return n.use(LIn()),n},Uz={about_call:"About Call",screen:"Screen",camera:"Camera",leave:"Leave",dismiss:"Dismiss",logo:"Logo",page:"Page",more:"More","page.prev":"Previous Page","page.next":"Next Page",layout:"Layout","layout.auto":"Auto Layout",settings:"Settings",file:"File",image:"Image",connection:"Connection",leave_confirmation:"Are you sure you want to leave the call?",cancel:"Cancel",yes:"Yes","(you)":"(you)",you:"You",everyone:"Everyone",to:"To",mute:"Mute",kick:"Kick",pin:"Pin",pinned:"Pinned",accept:"Accept",unpin:"Unpin",pip_on:"Show PiP",pip_off:"Hide PiP",viewers:"Viewers",join:"Join",joined:"Joined",create:"Create",close:"Close",ask:"Ask",type:"Type",activate:"Activate",requests:"Requests",mic_off:"Mic Off",disable_mic:"Disable Mic",mic_on:"Mic On",enable_mic:"Enable Mic",audio:"Audio",test:"Test",minimize:"Hide Tile",maximize:"Show Tile",mute_all:"Mute all","mute_all.description":"Everyone else in the meeting will be muted.","mute_all.header":"Are you sure?","mute_all.allow_unmute":"Allow others to unmute",video_off:"Video Off",disable_video:"Disable Video",video_on:"Video On",enable_video:"Enable Video",video:"Video",offline:"You're offline","offline.description":"Please ensure that you are connected to the internet.",disconnected:"You haven't joined the meeting.",failed:"You've been disconnected","failed.description":"We could not connect you back to the meeting room. Please try rejoining the meeting.","disconnected.description":"Please join the meeting in order to see and interact with other participants.",participants:"Participants","participants.errors.empty_results":"Couldn't find a participant with the specified name or ID.","participants.empty_list":"It looks like nobody is here.","participants.no_pending_requests":"There are no pending requests.","participants.turn_off_video":"Turn off video",polls:"Polls","polls.by":"Poll by","polls.question":"Poll Question","polls.question.placeholder":"What is your poll for?","polls.answers":"Answers","polls.option":"Add an option.","polls.option.placeholder":"Enter an option","polls.results.anon":"Anonymous","polls.results.hide":"Hide results before voting","polls.create":"Create Poll","polls.cancel":"Cancel Poll Creation","polls.empty":"No polls available","polls.errors.question_required":"Question is required.","polls.errors.empty_option":"Empty options not allowed.",screenshare:"Screen Share","screenshare.min_preview":"Minimize Preview","screenshare.max_preview":"Expand Preview","screenshare.shared":"Your screen is being shared.","screenshare.start":"Share Screen","screenshare.stop":"Stop Sharing","screenshare.error.unknown":"An error occurred while starting screenshare.","screenshare.error.max_count":"Maximum screen share limit reached.",plugins:"Plugins","plugins.empty":"No plugins available",perm_denied:"Permission denied by browser.","perm_denied.audio":"Mic permission denied by browser","perm_denied.video":"Camera permission denied by browser","perm_denied.screenshare":"Screenshare permission denied by browser","perm_denied.audio.chrome.message":"In the top navigation bar, click on the icon left to the URL and ensure 'Microphone' permission is checked","perm_denied.video.chrome.message":"In the top navigation bar, click on the icon left to the URL and ensure 'Camera' permission is checked","perm_denied.screenshare.chrome.message":"Under Chrome settings, navigate to 'Privacy and Security > Site Settings > Permissions'. Select 'Screenshare', provide permission and reload this application.","perm_denied.audio.safari.message":"Under Safari settings, navigate to 'Websites > Microphone', provide permission and reload this application.","perm_denied.video.safari.message":"Under Safari settings, navigate to 'Websites > Camera', provide permission and reload this application.","perm_denied.screenshare.safari.message":"Under Safari settings, navigate to 'Websites > Screenshare', provide permission and reload this application.","perm_denied.audio.edge.message":"Under Edge settings, navigate to 'Site Permissions > Microphone', provide permission and reload this application.","perm_denied.video.edge.message":"Under Edge settings, navigate to 'Site Permissions > Camera', provide permission and reload this application.","perm_denied.screenshare.edge.message":"Under Edge settings, navigate to 'Site Permissions > Screenshare', provide permission and reload this application.","perm_denied.audio.microsoft edge.message":"Under Edge settings, navigate to 'Site Permissions > Microphone', provide permission and reload this application.","perm_denied.video.microsoft edge.message":"Under Edge settings, navigate to 'Site Permissions > Camera', provide permission and reload this application.","perm_denied.screenshare.microsoft edge.message":"Under Edge settings, navigate to 'Site Permissions > Screenshare', provide permission and reload this application.","perm_denied.audio.firefox.message":"Under Firefox settings, navigate to 'Privacy and Security > Permissions > Microphone', provide permission and reload this application.","perm_denied.video.firefox.message":"Under Firefox settings, navigate to 'Privacy and Security > Permissions > Camera', provide permission and reload this application.","perm_denied.screenshare.firefox.message":"Under Firefox settings, navigate to 'Privacy and Security > Permissions > Screenshare', provide permission and reload this application.","perm_denied.audio.others.message":"From your browser settings, enable 'Microphone' permissions and reload this application.","perm_denied.video.others.message":"From your browser settings, enable 'Camera' permissions and reload this application.","perm_denied.screenshare.others.message":"From your browser settings, enable 'Screenshare' permissions and reload this application.",perm_sys_denied:"Permission denied by system","perm_sys_denied.audio":"Mic permission denied by system","perm_sys_denied.video":"Camera permission denied by system","perm_sys_denied.screenshare":"Screenshare permission denied by system","perm_sys_denied.audio.macos.message":"Open Apple Menu, navigate to 'System Settings > Privacy & Security > Microphone'. Allow access to your browser and reload this application.","perm_sys_denied.video.macos.message":"Open Apple Menu, navigate to 'System Settings > Privacy & Security > Camera'. Allow access to your browser and reload this application.","perm_sys_denied.screenshare.macos.message":"Open Apple Menu, navigate to 'System Settings > Privacy & Security > Screenshare'. Allow access to your browser and reload this application.","perm_sys_denied.audio.ios.message":"On your iPhone, navigate to 'Settings > Privacy > Microphone', allow access to your browser and reload this application.","perm_sys_denied.video.ios.message":"On your iPhone, navigate to 'Settings > Privacy > Camera', allow access to your browser and reload this application.","perm_sys_denied.screenshare.ios.message":"On your iPhone, navigate to 'Settings > Privacy > Screenshare', allow access to your browser and reload this application.","perm_sys_denied.audio.windows.message":"Go to Windows settings, select 'Settings > Privacy > Microphone'. Allow permissions to your browser and reload this application.","perm_sys_denied.video.windows.message":"Go to Windows settings, select 'Settings > Privacy > Camera'. Allow permissions to your browser and reload this application.","perm_sys_denied.screenshare.windows.message":"Go to Windows settings, select 'Settings > Privacy > Screenshare'. Allow permissions to your browser and reload this application.","perm_sys_denied.audio.android.message":"On your device, navigate to 'Settings > Apps'. Select your browser, allow Microphone permissions and reload this application.","perm_sys_denied.video.android.message":"On your device, navigate to 'Settings > Apps'. Select your browser, allow Camera permissions and reload this application.","perm_sys_denied.screenshare.android.message":"On your device, navigate to 'Settings > Apps'. Select your browser, allow Screenshare permissions and reload this application.","perm_sys_denied.audio.others.message":"Navigate to your system settings. Allow 'Microphone' permissions for your browser and reload this application.","perm_sys_denied.video.others.message":"Navigate to your system settings. Allow 'Camera' permissions for your browser and reload this application.","perm_sys_denied.screenshare.others.message":"Navigate to your system settings. Allow 'Screenshare' permissions for your browser and reload this application.",perm_could_not_start:"Could not capture device.","perm_could_not_start.audio":"Unable to start your Microphone","perm_could_not_start.video":"Unable to start your Camera","perm_could_not_start.screenshare":"Unable to start your Screenshare","perm_could_not_start.audio.message":"Looks like the system could not capture your microphone. Please restart your device or upgrade your browser to fix this.","perm_could_not_start.video.message":"Looks like the system could not capture your camera. Please restart your device or upgrade your browser to fix this.","perm_could_not_start.screenshare.message":"Looks like the system could not capture your screenshare. Please restart your device or upgrade your browser to fix this.",full_screen:"Full Screen","full_screen.exit":"Exit Full Screen","waitlist.header_title":"Waiting","waitlist.body_text":"You are in the waiting room, the host will let you in soon.","waitlist.deny_request":"Deny request","waitlist.accept_request":"Accept request","waitlist.accept_all":"Accept all","stage_request.header_title":"Join Stage Requests","stage_request.deny_request":"Deny request","stage_request.accept_request":"Accept request","stage_request.accept_all":"Accept all","stage_request.deny_all":"Deny all","stage_request.approval_pending":"Pending","stage_request.denied":"Denied","stage_request.request":"Join stage","stage_request.requested":"Requested","stage_request.cancel_request":"Cancel request","stage_request.leave_stage":"Leave stage","stage_request.request_tip":"Request to join the discussion","stage_request.leave_tip":"Leave the stage","stage_request.pending_tip":"Request pending","stage_request.denied_tip":"Rejected request","stage.empty_host":"The stage is empty","stage.empty_host_summary":"You are off stage. You can manage stage requests from the participants tab.","stage.empty_viewer":"There is no one on stage","stage.remove_from_stage":"Remove from stage","stage.invited_notification":"has been invited to join stage.","stage.add_to_stage":"Invite to stage","stage.join_title":"Join Stage","stage.join_summary":"You are about to join the stage, your video & audio as shown above will be visible to all participants.","stage.join_cancel":"Cancel","stage.join_confirm":"Join","setup_screen.join_in_as":"Joining as","setup_screen.your_name":"Your name","stage.reconnecting":"Reconnecting...","recording.label":"REC","recording.indicator":"This meeting is being recorded.","recording.started":"This meeting is being recorded.","recording.stopped":"Recording for this meeting has been stopped.","recording.paused":"Recording for this meeting has been paused.","recording.error.start":"Error while starting recording.","recording.error.stop":"Error while stopping recording.","recording.error.resume":"Error while resuming recording.","recording.start":"Start Recording","recording.stop":"Stop Recording","recording.resume":"Resume Recording","recording.starting":"Starting","recording.stopping":"Stopping","recording.loading":"Loading","recording.idle":"Record",audio_playback:"Play Audio","audio_playback.title":"Allow Audio Playback","audio_playback.description":"In order to play audio properly on your device, click the button below.",breakout_rooms:"Breakout Rooms","breakout_rooms.room_config_header":"Create Breakout","breakout_rooms.join_breakout_header":"Join Breakout","breakout_rooms.empty":"Nobody here yet.","breakout_rooms.delete":"Delete Room","breakout_rooms.switch":"Switch","breakout_rooms.main_room":"Main Room","breakout_rooms.shuffle_participants":"Shuffle Participants","breakout_rooms.deselect":"Deselect","breakout_rooms.selected":"selected","breakout_rooms.num_of_rooms":"No. of Rooms","breakout_rooms.approx":"Approx.","breakout_rooms.participants_per_room":"participants/room","breakout_rooms.division_text":"when equally divided.","breakout_rooms.start_breakout":"Start Breakout","breakout_rooms.close_breakout":"Close Breakout","breakout_rooms.update_breakout":"Update Breakout","breakout_rooms.discard_changes":"Discard Changes","breakout_rooms.room":"Room","breakout_rooms.rooms":"Rooms","breakout_rooms.room_name":"Room Name","breakout_rooms.edit_room_name":"Edit Room Name","breakout_rooms.save_room_name":"Save Room Name","breakout_rooms.add_room":"Add","breakout_rooms.add_room_brief":"Add Room","breakout_rooms.select_all":"Select all","breakout_rooms.unassign_all":"Unassign all","breakout_rooms.assign":"Assign","breakout_rooms.assign_participants":"Assign Participants","breakout_rooms.none_assigned":"No participants assigned yet","breakout_rooms.drag_drop_participants":"Drag and drop participants","breakout_rooms.click_drop_participants":"Click here to assign","breakout_rooms.status.assign_multiple":"Assign multiple participants at once by clicking and selecting them","breakout_rooms.status.select_room":"Select a room to assign","breakout_rooms.ephemeral_status.participants_assigned":"Participants assigned","breakout_rooms.ephemeral_status.participants_assigned_randomly":"Participants assigned randomly","breakout_rooms.ephemeral_status.changes_discarded":"Changes discarded","breakout_rooms.confirm_modal.start_breakout.header":"Start breakout rooms?","breakout_rooms.confirm_modal.start_breakout.content":"Once started, all participants will be moved to their assigned rooms.","breakout_rooms.confirm_modal.start_breakout.cancelText":"No, go back","breakout_rooms.confirm_modal.start_breakout.ctaText":"Yes, start","breakout_rooms.confirm_modal.close_breakout.header":"Close breakout rooms?","breakout_rooms.confirm_modal.close_breakout.content":"All breakout rooms will be closed & participants will be moved back to the main room.","breakout_rooms.confirm_modal.close_breakout.ctaText":"Yes, close breakout","breakout_rooms.move_reason.started_msg":"Starting breakout rooms...","breakout_rooms.move_reason.started_desc":"You are being moved to your assigned room","breakout_rooms.move_reason.closed_msg":"Closing breakout rooms...","breakout_rooms.move_reason.closed_desc":"You are being moved back to the main room","breakout_rooms.move_reason.switch_room":"Joining Breakout Room...","breakout_rooms.move_reason.switch_main_room":"Joining Main Room...","breakout_rooms.all_assigned":"All participants have been assigned","breakout_rooms.empty_main_room":"No more participants in the main room.","breakout_rooms.leave_confirmation":"Are you sure you want to leave the call? You are in a breakout room, you can join the main room too.","breakout_rooms.leave_confirmation.main_room_btn":"Go back to main room",ai:"AI","ai.meeting_ai":"Meeting AI","ai.home":"Home","ai.transcriptions":"Transcriptions","ai.personal":"Personal","ai.caption_view":"Caption View","ai.chat.tooltip":"This conversation will just be visible to you and not to others in the call.","ai.chat.summarize":"Hey AI, summarize this call","ai.chat.agenda":"Hey AI, what is today's agenda?","ai.transcriptions.search_placeholder":"Search by participant name or transcript","ai.transcriptions.no_transcripts_found":"No transcripts found. Try searching for a different participant or transcript.","ai.transcriptions.no_transcripts_yet":"No transcripts yet.",search:"Search","search.could_not_find":"Couldn't find a participant with the specified name or ID.","search.empty":"It looks like nobody is here.",end:"End Meeting","end.all":"End meeting for all",ended:"The meeting ended.","ended.rejected":"Your request to join the meeting was denied.","ended.left":"You left the meeting.","ended.kicked":"You were removed from the meeting.","ended.disconnected":"The call ended because the connection was lost.","ended.network":"Please check your internet connection and try again.","ended.unauthorized":"You are not authorized to join this meeting.",network:"Network","network.reconnecting":"Connection lost. Trying to reconnect.","network.delay_extended":"Taking too long to reconnect. Please check your network connection.","network.disconnected":"Could not reconnect. Please leave the meeting and try refreshing the window.","network.leaving":"Automatically leaving the meeting in 10 seconds.","network.restored":"Connection restored","network.delay":"Taking too long to reconnect.","network.lost":"Connection lost","network.lost_extended":"Connection lost. Please check your network connection.","network.troubleshoot":"Troubleshoot your connection","join.network_error":"We couldn't connect to the meeting. Please check your internet connection and try again.","join.media_error":"We're having trouble connecting to the meeting. Please try again, and if the problem continues, try using a different network.","join.media_firewall_error":"Your network may be blocking this connection. Try using a different network, or contact your network administrator for help.","join.default_error":"Something went wrong while joining the meeting. Please try again.","join.error_code":"Error code",livestream:"Livestream","livestream.indicator":"This meeting is being livestreamed.","livestream.skip":"Skip to Live","livestream.idle":"Waiting to go live.","livestream.starting":"Livestream is starting...","livestream.stopping":"Livestream is stopping...","livestream.waiting_on_manual_ingestion":"Please ingest livestream media.","livestream.error.not_supported":"Player not supported.","livestream.error.not_found":"Playback URL not found.","livestream.error.unknown":"An unknown error occurred.","livestream.error.sync":"Could not sync livestream, please try again later.","livestream.error.start":"Error while starting livestream.","livestream.error.stop":"Error while stopping livestream.","livestream.go_live":"Go Live","livestream.end_live":"End Live","livestream.error":"Error","cta.help":"Need help on how to do this?","cta.continue":"Ignore","cta.reload":"Reload","cta.confirmation":"Are you sure?","cta.system_settings":"Open Settings","remote_access.empty":"There are no remote requests, yet.","remote_access.requests":"The following people have requested remote control to your screen share.","remote_access.allow":"Please select whom you want to give access to.","remote_access.grant":"Grant access","remote_access.indicator":"Any plugin or screenshare you switch to will sync the change across the meeting",chat:"Chat","chat.new":"New","chat.max_limit_warning":"Max Character Limit","chat.rate_limit_error":"Please wait before you can send another message","chat.member_name":"Enter member name","chat.add_members":"Add members","chat.delete_msg":"Delete","chat.edit_msg":"Edit","chat.send_msg":"Send message","chat.send_attachment":"Drop files/images to send","chat.send_img":"Send an image","chat.send_file":"Send a file","chat.send_emoji":"Send an emoji","chat.update_msg":"Update message","chat.img.loading":"Loading image","chat.error.img_not_found":"Image not found","chat.error.empty_results":"Couldn't find a member with the specified name.","chat.img.shared_by":"Shared by","chat.reply":"Reply","chat.message_placeholder":"Message...","chat.click_to_send":"Click to send as message","chat.search_msgs":"Search messages","chat.search_conversations":"Search conversations","chat.start_conversation":"Start a conversation...","chat.empty_search":"No messages found","chat.empty_chat":"Send a message to get started","chat.cancel_upload":"Cancel upload","chat.view_chats":"View chats","chat.everyone":"Everyone","chat.pinned_msgs":"Pinned messages","chat.toggle_pinned_msgs":"Toggle pinned messages","date.today":"Today","date.yesterday":"Yesterday","date.sunday":"Sunday","date.monday":"Monday","date.tuesday":"Tuesday","date.wednesday":"Wednesday","date.thursday":"Thursday","date.friday":"Friday","date.saturday":"Saturday","list.empty":"No items found","grid.listening":"Listening","transcript.off":"Turn off Transcripts","transcript.on":"Turn on Transcripts","settings.notification_sound":"Notification sound","settings.microphone_input":"Microphone","settings.speaker_output":"Speaker","settings.mirror_video":"Mirror my Video","settings.camera_off":"Camera is off","dialog.close":"Close dialog","notifications.joined":"just joined","notifications.left":"left","notifications.requesting_to_join_meeting":"is requesting to join the meeting","notifications.requested_to_join_stage":"has requested to join stage","notifications.joined_stage":"has joined stage","notifications.request_to_join_accepted":"Request to join accepted","notifications.request_to_join_rejected":"Request to join rejected","notifications.accept":"Accept","notifications.new_poll_created_by":"New poll created by","notifications.connected_to":"Connected to","notifications.plugin_switched_to":"Plugin switched to","notifications.remote_control_requested":"has requested for remote control","notifications.remote_control_request_sent":"Sent remote control request to","notifications.remote_control_request_accepted":"has granted remote control","notifications.remote_control_granted":"Granted remote control to","notifications.remote_control_terminated":"Existing remote control has been terminated","debugger.troubleshooting.label":"Troubleshooting","debugger.quality.good":"Good","debugger.quality.average":"Average","debugger.quality.poor":"Poor","debugger.stats.bitrate.label":"Bitrate","debugger.stats.bitrate.description":"Data transmitted per second, affects quality and file size.","debugger.stats.packet_loss.label":"Packet Loss","debugger.stats.packet_loss.description":"Amount of data lost during transfer","debugger.stats.jitter.label":"Jitter","debugger.stats.jitter.description":"Variance or fluctuation in latency","debugger.stats.cpu_limitations.label":"CPU Limitations","debugger.stats.cpu_limitations.description":"CPU limitations can impact WebRTC call quality and performance.","debugger.stats.bandwidth_limitations.label":"Bandwidth Limitations","debugger.stats.bandwidth_limitations.description":"Slow internet speeds can degrade video quality.","debugger.audio.label":"Audio","debugger.audio.troubleshooting.label":"Audio Troubleshooting","debugger.audio.messages.generating_report":"Generating report. Please wait for a few seconds.","debugger.audio.messages.enable_media":"Please enable mic to see the report.","debugger.audio.sections.network_media":"Network & Media","debugger.video.label":"Video","debugger.video.troubleshooting.label":"Video Troubleshooting","debugger.video.messages.generating_report":"Generating report. Please wait for a few seconds.","debugger.video.messages.enable_media":"Please enable camera to see the report.","debugger.video.sections.network_media":"Network & Media","debugger.screenshare.label":"Screenshare","debugger.screenshare.troubleshooting.label":"Screenshare Troubleshooting","debugger.screenshare.sections.network_media":"Network & Media","debugger.screenshare.messages.generating_report":"Generating report. Please wait for a few seconds.","debugger.screenshare.messages.enable_media":"Please share screen to see the report.","debugger.system.label":"System","debugger.system.troubleshooting.label":"System Troubleshooting","debugger.system.sections.battery":"Battery","debugger.system.battery.level.label":"Battery Level","debugger.system.battery.level.description":"A low battery charge may result in reduced performance.","debugger.system.battery.charging.label":"Battery Charging Status","debugger.system.battery.charging.description":"A device running on power performs optimally.","debugger.system.battery.charging.is_charging":"Charging","debugger.system.battery.charging.is_not_charging":"Not charging"},OIn=(t=Uz)=>{let e=Uz;return(t!==Uz||Object.keys(t).length>0)&&(e=Object.assign({},Uz,t)),n=>{var r;return(r=e[n])!==null&&r!==void 0?r:n}},FIn={people:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 13.999 13 14a2 2 0 0 1 1.995 1.85L15 16v1.5C14.999 21 11.284 22 8.5 22c-2.722 0-6.335-.956-6.495-4.27L2 17.5v-1.501c0-1.054.816-1.918 1.85-1.995L4 14ZM15.22 14H20c1.054 0 1.918.816 1.994 1.85L22 16v1c-.001 3.062-2.858 4-5 4a7.16 7.16 0 0 1-2.14-.322c.336-.386.607-.827.802-1.327A6.19 6.19 0 0 0 17 19.5l.267-.006c.985-.043 3.086-.363 3.226-2.289L20.5 17v-1a.501.501 0 0 0-.41-.492L20 15.5h-4.051a2.957 2.957 0 0 0-.595-1.34L15.22 14H20h-4.78ZM4 15.499l-.1.01a.51.51 0 0 0-.254.136.506.506 0 0 0-.136.253l-.01.101V17.5c0 1.009.45 1.722 1.417 2.242.826.445 2.003.714 3.266.753l.317.005.317-.005c1.263-.039 2.439-.308 3.266-.753.906-.488 1.359-1.145 1.412-2.057l.005-.186V16a.501.501 0 0 0-.41-.492L13 15.5l-9-.001ZM8.5 3a4.5 4.5 0 1 1 0 9 4.5 4.5 0 0 1 0-9Zm9 2a3.5 3.5 0 1 1 0 7 3.5 3.5 0 0 1 0-7Zm-9-.5c-1.654 0-3 1.346-3 3s1.346 3 3 3 3-1.346 3-3-1.346-3-3-3Zm9 2c-1.103 0-2 .897-2 2s.897 2 2 2 2-.897 2-2-.897-2-2-2Z" fill="currentColor"/></svg>',people_checked:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 29 29"><path fill="currentColor" d="M14.58 15.333H2.833a2.667 2.667 0 0 0-2.666 2.666v2l.006.307c.214 4.419 5.031 5.693 8.66 5.693 1.374 0 2.92-.182 4.32-.649a8.53 8.53 0 0 1-.717-1.87c-.93.298-2.027.478-3.18.513l-.423.006-.422-.006c-1.684-.052-3.254-.411-4.355-1.004-1.29-.694-1.89-1.644-1.89-2.99v-2.001l.014-.135a.675.675 0 0 1 .181-.337.68.68 0 0 1 .338-.181l.134-.014h10.31a8.71 8.71 0 0 1 1.436-1.998h.001Zm.253-8.667a6 6 0 1 0-12 0 6 6 0 0 0 12 0Zm-10 0c0-2.205 1.795-4 4-4 2.206 0 4 1.795 4 4s-1.794 4-4 4c-2.205 0-4-1.795-4-4ZM25.5 7.999a4.667 4.667 0 1 0-9.333 0A4.667 4.667 0 0 0 25.5 8Zm-7.333 0a2.67 2.67 0 0 1 2.666-2.666A2.67 2.67 0 0 1 23.5 7.999a2.67 2.67 0 0 1-2.667 2.667 2.67 2.67 0 0 1-2.666-2.667Zm10 13.334a7.333 7.333 0 1 1-14.667 0 7.333 7.333 0 0 1 14.667 0Zm-2.862-3.139a.666.666 0 0 0-.944 0l-4.86 4.863-2.196-2.196a.667.667 0 1 0-.944.944l2.667 2.666a.666.666 0 0 0 .944 0l5.333-5.333a.666.666 0 0 0 0-.944Z"/></svg>',chat:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10a9.96 9.96 0 0 1-4.587-1.112l-3.826 1.067a1.25 1.25 0 0 1-1.54-1.54l1.068-3.823A9.96 9.96 0 0 1 2 12C2 6.477 6.477 2 12 2Zm0 1.5A8.5 8.5 0 0 0 3.5 12c0 1.47.373 2.883 1.073 4.137l.15.27-1.112 3.984 3.987-1.112.27.15A8.5 8.5 0 1 0 12 3.5ZM8.75 13h4.498a.75.75 0 0 1 .102 1.493l-.102.007H8.75a.75.75 0 0 1-.102-1.493L8.75 13h4.498H8.75Zm0-3.5h6.505a.75.75 0 0 1 .101 1.493l-.101.007H8.75a.75.75 0 0 1-.102-1.493L8.75 9.5h6.505H8.75Z" fill="currentColor"/></svg>',poll:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.752 2a2.752 2.752 0 0 1 2.752 2.751V19.25a2.752 2.752 0 1 1-5.504 0V4.75A2.752 2.752 0 0 1 11.752 2Zm7 5a2.752 2.752 0 0 1 2.752 2.751v9.499a2.752 2.752 0 1 1-5.504 0V9.75A2.752 2.752 0 0 1 18.752 7Zm-14 5a2.752 2.752 0 0 1 2.752 2.751v4.499a2.752 2.752 0 0 1-5.504 0V14.75A2.752 2.752 0 0 1 4.752 12Zm7-8.5c-.692 0-1.252.56-1.252 1.251V19.25a1.252 1.252 0 0 0 2.504 0V4.75c0-.691-.56-1.251-1.252-1.251Zm7 5c-.691 0-1.252.56-1.252 1.251v9.499a1.252 1.252 0 0 0 2.504 0V9.75c0-.691-.56-1.251-1.252-1.251Zm-14 5c-.692 0-1.252.56-1.252 1.251v4.499a1.252 1.252 0 1 0 2.504 0V14.75c0-.691-.56-1.252-1.252-1.252Z" fill="currentColor"/></svg>',participants:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14.754 10c.966 0 1.75.784 1.75 1.75v4.749a4.501 4.501 0 0 1-9.002 0V11.75c0-.966.783-1.75 1.75-1.75h5.502Zm0 1.5H9.252a.25.25 0 0 0-.25.25v4.749a3.001 3.001 0 0 0 6.002 0V11.75a.25.25 0 0 0-.25-.25ZM3.75 10h3.381a2.738 2.738 0 0 0-.618 1.5H3.75a.25.25 0 0 0-.25.25v3.249a2.501 2.501 0 0 0 3.082 2.433c.085.504.24.985.453 1.432A4.001 4.001 0 0 1 2 14.999V11.75c0-.966.784-1.75 1.75-1.75Zm13.125 0h3.375c.966 0 1.75.784 1.75 1.75V15a4 4 0 0 1-5.03 3.866c.214-.448.369-.929.455-1.433A2.5 2.5 0 0 0 20.5 15v-3.25a.25.25 0 0 0-.25-.25h-2.757a2.738 2.738 0 0 0-.618-1.5ZM12 3a3 3 0 1 1 0 6 3 3 0 0 1 0-6Zm6.5 1a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5Zm-13 0a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5Zm6.5.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Zm6.5 1a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm-13 0a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z" fill="currentColor"/></svg>',rocket:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><path d="M9.35 20.45 14.65 22.7Q15.55 20.9 16.575 19.15Q17.6 17.4 18.75 15.8L14.8 15Q14.8 15 14.8 15Q14.8 15 14.8 15ZM17.05 24.5 23.7 31.15Q26.55 29.85 29.05 28.2Q31.55 26.55 33.1 25Q37.15 20.95 39.05 16.7Q40.95 12.45 41.1 7.1Q35.75 7.25 31.5 9.15Q27.25 11.05 23.2 15.1Q21.65 16.65 20 19.15Q18.35 21.65 17.05 24.5ZM28.5 19.7Q27.5 18.7 27.5 17.225Q27.5 15.75 28.5 14.75Q29.5 13.75 30.975 13.75Q32.45 13.75 33.45 14.75Q34.45 15.75 34.45 17.225Q34.45 18.7 33.45 19.7Q32.45 20.7 30.975 20.7Q29.5 20.7 28.5 19.7ZM27.75 38.85 33.2 33.4Q33.2 33.4 33.2 33.4Q33.2 33.4 33.2 33.4L32.4 29.45Q30.8 30.6 29.05 31.625Q27.3 32.65 25.5 33.55ZM44.05 4.15Q44.5 10.95 42.35 16.55Q40.2 22.15 35.25 27.1Q35.2 27.15 35.15 27.2Q35.1 27.25 35.05 27.3L36.15 32.8Q36.3 33.55 36.075 34.25Q35.85 34.95 35.3 35.5L26.75 44.1L22.5 34.2L14 25.7L4.1 21.45L12.7 12.9Q13.25 12.35 13.95 12.125Q14.65 11.9 15.4 12.05L20.9 13.15Q20.95 13.1 21 13.075Q21.05 13.05 21.1 13Q26.05 8.05 31.65 5.875Q37.25 3.7 44.05 4.15ZM7.45 31.75Q9.2 30 11.725 29.975Q14.25 29.95 16 31.7Q17.75 33.45 17.725 35.975Q17.7 38.5 15.95 40.25Q14.65 41.55 11.925 42.4Q9.2 43.25 3.75 44Q4.5 38.55 5.325 35.8Q6.15 33.05 7.45 31.75ZM9.55 33.9Q8.85 34.65 8.3 36.25Q7.75 37.85 7.35 40.35Q9.85 39.95 11.45 39.4Q13.05 38.85 13.8 38.15Q14.75 37.3 14.775 36.025Q14.8 34.75 13.9 33.8Q12.95 32.9 11.675 32.925Q10.4 32.95 9.55 33.9Z" fill="currentColor" /></svg>',call_end:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m21.903 13.202-.191.816a2.75 2.75 0 0 1-2.955 2.107l-1.755-.178A2.75 2.75 0 0 1 14.6 13.83l-.389-1.686a.25.25 0 0 0-.113-.157c-.321-.197-1.034-.32-2.098-.32-.786 0-1.386.067-1.786.189-.14.043-.238.085-.301.116l-.09.048-.015.04-.409 1.77A2.75 2.75 0 0 1 7 15.948l-1.746.177A2.75 2.75 0 0 1 2.3 14.03l-.196-.817a3.75 3.75 0 0 1 1.13-3.651C5.134 7.839 8.064 7 12 7c3.943 0 6.875.842 8.776 2.57a3.75 3.75 0 0 1 1.172 3.41l-.045.222Zm-1.426-.514a2.25 2.25 0 0 0-.71-2.009C18.184 9.241 15.602 8.5 12 8.5c-3.598 0-6.177.739-7.76 2.172a2.25 2.25 0 0 0-.677 2.19l.196.818a1.25 1.25 0 0 0 1.342.953l1.746-.178a1.25 1.25 0 0 0 1.09-.962l.423-1.82.043-.136c.376-.998 1.591-1.37 3.597-1.37 1.318 0 2.265.164 2.88.54.401.245.687.642.793 1.1l.389 1.685c.12.522.56.909 1.092.963l1.754.178a1.25 1.25 0 0 0 1.343-.958l.192-.816.034-.171Z" fill="currentColor"/></svg>',share:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17 2.498a3.502 3.502 0 1 1-2.597 5.851l-4.558 2.604a3.5 3.5 0 0 1 0 2.093l4.557 2.606a3.502 3.502 0 1 1-.745 1.302L9.1 14.347a3.502 3.502 0 1 1 0-4.698l4.557-2.604A3.502 3.502 0 0 1 17 2.498Zm0 13.5a2.002 2.002 0 1 0 0 4.004 2.002 2.002 0 0 0 0-4.004Zm-10.498-6a2.002 2.002 0 1 0 0 4.004 2.002 2.002 0 0 0 0-4.004Zm10.498-6a2.002 2.002 0 1 0 0 4.004 2.002 2.002 0 0 0 0-4.004Z" fill="currentColor"/></svg>',mic_on:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.25 11a.75.75 0 0 1 .743.648l.007.102v.5a6.75 6.75 0 0 1-6.249 6.732l-.001 2.268a.75.75 0 0 1-1.493.102l-.007-.102v-2.268a6.75 6.75 0 0 1-6.246-6.496L5 12.25v-.5a.75.75 0 0 1 1.493-.102l.007.102v.5a5.25 5.25 0 0 0 5.034 5.246l.216.004h.5a5.25 5.25 0 0 0 5.246-5.034l.004-.216v-.5a.75.75 0 0 1 .75-.75ZM12 2a4 4 0 0 1 4 4v6a4 4 0 0 1-8 0V6a4 4 0 0 1 4-4Zm0 1.5A2.5 2.5 0 0 0 9.5 6v6a2.5 2.5 0 0 0 5 0V6A2.5 2.5 0 0 0 12 3.5Z" fill="currentColor"/></svg>',mic_off:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.28 2.22a.75.75 0 1 0-1.06 1.06L8 9.06V12a4 4 0 0 0 6.248 3.309l1.146 1.146A5.227 5.227 0 0 1 12.25 17.5h-.5l-.216-.004A5.25 5.25 0 0 1 6.5 12.25v-.5l-.007-.102A.75.75 0 0 0 5 11.75v.5l.004.236a6.75 6.75 0 0 0 6.246 6.496v2.268l.007.102a.75.75 0 0 0 1.493-.102l.001-2.268a6.718 6.718 0 0 0 3.712-1.458l4.256 4.256a.75.75 0 0 0 1.061-1.06L3.28 2.22Zm9.876 11.997A2.5 2.5 0 0 1 9.5 12v-1.44l3.656 3.657ZM14.5 6v5.318l1.43 1.43c.046-.242.07-.492.07-.748V6a4 4 0 0 0-7.862-1.044L9.5 6.318V6a2.5 2.5 0 0 1 5 0ZM17.196 14.014l1.146 1.146A6.725 6.725 0 0 0 19 12.25v-.5l-.007-.102a.75.75 0 0 0-1.493.102v.5l-.004.216a5.233 5.233 0 0 1-.3 1.548Z" fill="currentColor"/></svg>',video_on:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13.75 4.5A3.25 3.25 0 0 1 17 7.75v.173l3.864-2.318A.75.75 0 0 1 22 6.248V17.75a.75.75 0 0 1-1.136.643L17 16.075v.175a3.25 3.25 0 0 1-3.25 3.25h-8.5A3.25 3.25 0 0 1 2 16.25v-8.5A3.25 3.25 0 0 1 5.25 4.5h8.5Zm0 1.5h-8.5A1.75 1.75 0 0 0 3.5 7.75v8.5c0 .966.784 1.75 1.75 1.75h8.5a1.75 1.75 0 0 0 1.75-1.75v-8.5A1.75 1.75 0 0 0 13.75 6Zm6.75 1.573L17 9.674v4.651l3.5 2.1V7.573Z" fill="currentColor"/></svg>',video_off:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.28 2.22a.75.75 0 1 0-1.06 1.06l1.567 1.567A3.25 3.25 0 0 0 2 7.75v8.5a3.25 3.25 0 0 0 3.25 3.25h8.5a3.25 3.25 0 0 0 2.903-1.786l4.066 4.067a.75.75 0 0 0 1.061-1.061L3.28 2.22Zm12.196 14.317A1.75 1.75 0 0 1 13.75 18h-8.5a1.75 1.75 0 0 1-1.75-1.75v-8.5c0-.869.633-1.59 1.463-1.727l10.514 10.514ZM15.5 12.318V7.75A1.75 1.75 0 0 0 13.75 6H9.182l-1.5-1.5h6.068A3.25 3.25 0 0 1 17 7.75v.173l3.864-2.318A.75.75 0 0 1 22 6.248V17.75c0 .301-.17.543-.403.665L20.5 17.318V7.573L17 9.674v4.144l-1.5-1.5Z" fill="currentColor"/></svg>',share_screen_start:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 6.25A2.25 2.25 0 0 1 4.25 4h15.5A2.25 2.25 0 0 1 22 6.25v11.5A2.25 2.25 0 0 1 19.75 20H4.25A2.25 2.25 0 0 1 2 17.75V6.25Zm2.25-.75a.75.75 0 0 0-.75.75v11.5c0 .414.336.75.75.75h15.5a.75.75 0 0 0 .75-.75V6.25a.75.75 0 0 0-.75-.75H4.25Z"/><path d="M12 7.245a.75.75 0 0 1 .53.22l3.255 3.255a.75.75 0 1 1-1.06 1.06L12.75 9.806v6.447a.75.75 0 0 1-1.5 0V9.808L9.28 11.78a.75.75 0 1 1-1.06-1.06l3.25-3.254a.75.75 0 0 1 .53-.22Z"/></svg>',share_screen_stop:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 6.25A2.25 2.25 0 0 1 4.25 4h15.5A2.25 2.25 0 0 1 22 6.25v11.5A2.25 2.25 0 0 1 19.75 20H4.25A2.25 2.25 0 0 1 2 17.75V6.25Zm2.25-.75a.75.75 0 0 0-.75.75v11.5c0 .414.336.75.75.75h15.5a.75.75 0 0 0 .75-.75V6.25a.75.75 0 0 0-.75-.75H4.25Z"/><path d="M8.22 8.215a.75.75 0 0 1 1.06 0l2.72 2.72 2.725-2.716a.75.75 0 0 1 1.06 1.062l-2.724 2.715 2.724 2.724a.75.75 0 1 1-1.06 1.06L12 13.057 9.28 15.78a.75.75 0 0 1-1.06-1.06l2.72-2.724-2.72-2.72a.75.75 0 0 1 0-1.06Z"/></svg>',share_screen_person:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 7.25A3.25 3.25 0 0 1 5.25 4h13.5A3.25 3.25 0 0 1 22 7.25V13h-.258a3.74 3.74 0 0 0-1.242-2.545V7.25a1.75 1.75 0 0 0-1.75-1.75H5.25A1.75 1.75 0 0 0 3.5 7.25v9.5c0 .966.784 1.75 1.75 1.75H12v.5c0 .34.04.674.118 1H5.25A3.25 3.25 0 0 1 2 16.75v-9.5ZM21.5 17a1.5 1.5 0 0 1 1.5 1.5v.5c0 1.971-1.86 4-5 4-3.14 0-5-2.029-5-4v-.5a1.5 1.5 0 0 1 1.5-1.5h7ZM18 10.5a2.75 2.75 0 1 1 0 5.5 2.75 2.75 0 0 1 0-5.5Z" fill="currentColor"/></svg>',clock:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2c5.523 0 10 4.478 10 10s-4.477 10-10 10S2 17.522 2 12 6.477 2 12 2Zm0 1.667c-4.595 0-8.333 3.738-8.333 8.333 0 4.595 3.738 8.333 8.333 8.333 4.595 0 8.333-3.738 8.333-8.333 0-4.595-3.738-8.333-8.333-8.333ZM11.25 6a.75.75 0 0 1 .743.648L12 6.75V12h3.25a.75.75 0 0 1 .102 1.493l-.102.007h-4a.75.75 0 0 1-.743-.648l-.007-.102v-6a.75.75 0 0 1 .75-.75Z" fill="currentColor"/></svg>',dismiss:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m4.397 4.554.073-.084a.75.75 0 0 1 .976-.073l.084.073L12 10.939l6.47-6.47a.75.75 0 1 1 1.06 1.061L13.061 12l6.47 6.47a.75.75 0 0 1 .072.976l-.073.084a.75.75 0 0 1-.976.073l-.084-.073L12 13.061l-6.47 6.47a.75.75 0 0 1-1.06-1.061L10.939 12l-6.47-6.47a.75.75 0 0 1-.072-.976l.073-.084-.073.084Z" fill="currentColor"/></svg>',send:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5.694 12 2.299 3.272c-.236-.607.356-1.188.942-.982l.093.04 18 9a.75.75 0 0 1 .097 1.283l-.097.058-18 9a.75.75 0 0 1-1.065-.847l.03-.096L5.694 12 2.299 3.272 5.694 12ZM4.402 4.54l2.61 6.71h6.627a.75.75 0 0 1 .743.648l.007.102a.75.75 0 0 1-.649.743l-.101.007H7.01l-2.609 6.71L19.322 12 4.401 4.54Z" fill="currentColor"/></svg>',search:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10 2.75a7.25 7.25 0 0 1 5.63 11.819l4.9 4.9a.75.75 0 0 1-.976 1.134l-.084-.073-4.901-4.9A7.25 7.25 0 1 1 10 2.75Zm0 1.5a5.75 5.75 0 1 0 0 11.5 5.75 5.75 0 0 0 0-11.5Z" fill="currentColor"/</svg>',more_vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 7.75a1.75 1.75 0 1 1 0-3.5 1.75 1.75 0 0 1 0 3.5ZM12 13.75a1.75 1.75 0 1 1 0-3.5 1.75 1.75 0 0 1 0 3.5ZM10.25 18a1.75 1.75 0 1 0 3.5 0 1.75 1.75 0 0 0-3.5 0Z" fill="currentColor"/></svg>',chevron_down:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4.22 8.47a.75.75 0 0 1 1.06 0L12 15.19l6.72-6.72a.75.75 0 1 1 1.06 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L4.22 9.53a.75.75 0 0 1 0-1.06Z" fill="currentColor"/></svg>',chevron_up:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4.22 15.53a.75.75 0 0 0 1.06 0L12 8.81l6.72 6.72a.75.75 0 1 0 1.06-1.06l-7.25-7.25a.75.75 0 0 0-1.06 0l-7.25 7.25a.75.75 0 0 0 0 1.06Z" fill="currentColor"/></svg>',chevron_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.53 4.22a.75.75 0 0 1 0 1.06L8.81 12l6.72 6.72a.75.75 0 1 1-1.06 1.06l-7.25-7.25a.75.75 0 0 1 0-1.06l7.25-7.25a.75.75 0 0 1 1.06 0Z" fill="currentColor"/></svg>',chevron_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.47 4.22a.75.75 0 0 0 0 1.06L15.19 12l-6.72 6.72a.75.75 0 1 0 1.06 1.06l7.25-7.25a.75.75 0 0 0 0-1.06L9.53 4.22a.75.75 0 0 0-1.06 0Z" fill="currentColor"/></svg>',settings:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.012 2.25c.734.008 1.465.093 2.182.253a.75.75 0 0 1 .582.649l.17 1.527a1.384 1.384 0 0 0 1.927 1.116l1.401-.615a.75.75 0 0 1 .85.174 9.792 9.792 0 0 1 2.204 3.792.75.75 0 0 1-.271.825l-1.242.916a1.381 1.381 0 0 0 0 2.226l1.243.915a.75.75 0 0 1 .272.826 9.797 9.797 0 0 1-2.204 3.792.75.75 0 0 1-.848.175l-1.407-.617a1.38 1.38 0 0 0-1.926 1.114l-.169 1.526a.75.75 0 0 1-.572.647 9.518 9.518 0 0 1-4.406 0 .75.75 0 0 1-.572-.647l-.168-1.524a1.382 1.382 0 0 0-1.926-1.11l-1.406.616a.75.75 0 0 1-.849-.175 9.798 9.798 0 0 1-2.204-3.796.75.75 0 0 1 .272-.826l1.243-.916a1.38 1.38 0 0 0 0-2.226l-1.243-.914a.75.75 0 0 1-.271-.826 9.793 9.793 0 0 1 2.204-3.792.75.75 0 0 1 .85-.174l1.4.615a1.387 1.387 0 0 0 1.93-1.118l.17-1.526a.75.75 0 0 1 .583-.65c.717-.159 1.45-.243 2.201-.252Zm0 1.5a9.135 9.135 0 0 0-1.354.117l-.109.977A2.886 2.886 0 0 1 6.525 7.17l-.898-.394a8.293 8.293 0 0 0-1.348 2.317l.798.587a2.881 2.881 0 0 1 0 4.643l-.799.588c.32.842.776 1.626 1.348 2.322l.905-.397a2.882 2.882 0 0 1 4.017 2.318l.11.984c.889.15 1.798.15 2.687 0l.11-.984a2.881 2.881 0 0 1 4.018-2.322l.905.396a8.296 8.296 0 0 0 1.347-2.318l-.798-.588a2.881 2.881 0 0 1 0-4.643l.796-.587a8.293 8.293 0 0 0-1.348-2.317l-.896.393a2.884 2.884 0 0 1-4.023-2.324l-.11-.976a8.988 8.988 0 0 0-1.333-.117ZM12 8.25a3.75 3.75 0 1 1 0 7.5 3.75 3.75 0 0 1 0-7.5Zm0 1.5a2.25 2.25 0 1 0 0 4.5 2.25 2.25 0 0 0 0-4.5Z" fill="currentColor"/></svg>',wifi:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17.745 10.75a8.291 8.291 0 0 1 1.492 2.07.75.75 0 1 1-1.335.683 6.798 6.798 0 0 0-1.218-1.692 6.562 6.562 0 0 0-10.493 1.673.75.75 0 1 1-1.339-.677 8.062 8.062 0 0 1 12.893-2.057Zm-2.102 3.07c.448.447.816.997 1.072 1.582a.75.75 0 1 1-1.373.602 3.72 3.72 0 0 0-.76-1.124 3.592 3.592 0 0 0-5.08 0c-.31.31-.562.689-.746 1.11a.75.75 0 1 1-1.375-.6 5.11 5.11 0 0 1 1.061-1.57 5.092 5.092 0 0 1 7.201 0Zm4.805-5.541c.51.509.99 1.09 1.409 1.697a.75.75 0 0 1-1.235.852 10.822 10.822 0 0 0-1.234-1.489c-4.08-4.08-10.695-4.08-14.776 0-.421.422-.84.934-1.222 1.484a.75.75 0 0 1-1.232-.855c.43-.62.905-1.2 1.394-1.69 4.666-4.665 12.23-4.665 16.896 0Zm-7.387 8.16a1.5 1.5 0 1 1-2.122 2.122 1.5 1.5 0 0 1 2.122-2.122Z" fill="currentColor"/></svg>',speaker:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M15 4.25c0-1.079-1.274-1.65-2.08-.934L8.427 7.309a.75.75 0 0 1-.498.19H4.25A2.25 2.25 0 0 0 2 9.749v4.497a2.25 2.25 0 0 0 2.25 2.25h3.68a.75.75 0 0 1 .498.19l4.491 3.994c.806.716 2.081.144 2.081-.934V4.25ZM9.425 8.43 13.5 4.807v14.382l-4.075-3.624a2.25 2.25 0 0 0-1.495-.569H4.25a.75.75 0 0 1-.75-.75V9.75a.75.75 0 0 1 .75-.75h3.68a2.25 2.25 0 0 0 1.495-.569ZM18.992 5.897a.75.75 0 0 1 1.049.157A9.959 9.959 0 0 1 22 12a9.96 9.96 0 0 1-1.96 5.946.75.75 0 0 1-1.205-.892A8.459 8.459 0 0 0 20.5 12a8.459 8.459 0 0 0-1.665-5.054.75.75 0 0 1 .157-1.049Z" /><path d="M17.143 8.37a.75.75 0 0 1 1.017.302c.536.99.84 2.125.84 3.328a6.973 6.973 0 0 1-.84 3.328.75.75 0 0 1-1.32-.714c.42-.777.66-1.666.66-2.614s-.24-1.837-.66-2.614a.75.75 0 0 1 .303-1.017Z"/></svg>',speaker_off:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M3.28 2.22a.75.75 0 1 0-1.06 1.06L6.438 7.5H4.25A2.25 2.25 0 0 0 2 9.749v4.497a2.25 2.25 0 0 0 2.25 2.25h3.68a.75.75 0 0 1 .498.19l4.491 3.994c.806.716 2.081.144 2.081-.934V16.06l5.72 5.72a.75.75 0 0 0 1.06-1.061L3.28 2.22ZM13.5 14.56v4.629l-4.075-3.624a2.25 2.25 0 0 0-1.495-.569H4.25a.75.75 0 0 1-.75-.75V9.75a.75.75 0 0 1 .75-.75h3.688L13.5 14.56ZM13.5 4.807v5.511l1.5 1.5V4.25c0-1.079-1.274-1.65-2.08-.934l-3.4 3.022 1.063 1.063L13.5 4.807ZM17.141 13.96l1.138 1.137A6.974 6.974 0 0 0 19 12a6.973 6.973 0 0 0-.84-3.328.75.75 0 0 0-1.32.714c.42.777.66 1.666.66 2.614 0 .691-.127 1.351-.359 1.96ZM19.388 16.206l1.093 1.094A9.955 9.955 0 0 0 22 12a9.959 9.959 0 0 0-1.96-5.946.75.75 0 0 0-1.205.892A8.46 8.46 0 0 1 20.5 12a8.458 8.458 0 0 1-1.112 4.206Z"/></svg>',download:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.25 20.5a.75.75 0 1 1 0 1.5l-13 .004a.75.75 0 1 1 0-1.5l13-.004ZM11.648 2.012l.102-.007a.75.75 0 0 1 .743.648l.007.102-.001 13.685 3.722-3.72a.75.75 0 0 1 .976-.073l.085.073a.75.75 0 0 1 .072.976l-.073.084-4.997 4.997a.75.75 0 0 1-.976.073l-.085-.073-5.003-4.996a.75.75 0 0 1 .976-1.134l.084.072 3.719 3.714L11 2.755a.75.75 0 0 1 .648-.743l.102-.007-.102.007Z" fill="currentColor"/></svg>',full_screen_maximize:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4.5 5.75c0-.69.56-1.25 1.25-1.25h2a.75.75 0 0 0 0-1.5h-2A2.75 2.75 0 0 0 3 5.75v2a.75.75 0 0 0 1.5 0v-2ZM4.5 18.25c0 .69.56 1.25 1.25 1.25h2a.75.75 0 0 1 0 1.5h-2A2.75 2.75 0 0 1 3 18.25v-2a.75.75 0 0 1 1.5 0v2ZM18.25 4.5c.69 0 1.25.56 1.25 1.25v2a.75.75 0 0 0 1.5 0v-2A2.75 2.75 0 0 0 18.25 3h-2a.75.75 0 0 0 0 1.5h2ZM19.5 18.25c0 .69-.56 1.25-1.25 1.25h-2a.75.75 0 0 0 0 1.5h2A2.75 2.75 0 0 0 21 18.25v-2a.75.75 0 0 0-1.5 0v2Z" fill="currentColor"/></svg>',full_screen_minimize:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.5 3.75a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 0 0 1.5h2.5A2.25 2.25 0 0 0 8.5 6.25v-2.5ZM8.5 20.25a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 0-.75-.75h-2.5a.75.75 0 0 1 0-1.5h2.5a2.25 2.25 0 0 1 2.25 2.25v2.5ZM16.25 3a.75.75 0 0 0-.75.75v2.5a2.25 2.25 0 0 0 2.25 2.25h2.5a.75.75 0 0 0 0-1.5h-2.5a.75.75 0 0 1-.75-.75v-2.5a.75.75 0 0 0-.75-.75ZM15.5 20.25a.75.75 0 0 0 1.5 0v-2.5a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 0 0-1.5h-2.5a2.25 2.25 0 0 0-2.25 2.25v2.5Z" fill="currentColor"/></svg>',copy:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5.503 4.627 5.5 6.75v10.504a3.25 3.25 0 0 0 3.25 3.25h8.616a2.251 2.251 0 0 1-2.122 1.5H8.75A4.75 4.75 0 0 1 4 17.254V6.75c0-.98.627-1.815 1.503-2.123ZM17.75 2A2.25 2.25 0 0 1 20 4.25v13a2.25 2.25 0 0 1-2.25 2.25h-9a2.25 2.25 0 0 1-2.25-2.25v-13A2.25 2.25 0 0 1 8.75 2h9Zm0 1.5h-9a.75.75 0 0 0-.75.75v13c0 .414.336.75.75.75h9a.75.75 0 0 0 .75-.75v-13a.75.75 0 0 0-.75-.75Z" fill="currentColor"/></svg>',attach:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.772 3.743a6 6 0 0 1 8.66 8.302l-.19.197-8.8 8.798-.036.03a3.723 3.723 0 0 1-5.489-4.973.764.764 0 0 1 .085-.13l.054-.06.086-.088.142-.148.002.003 7.436-7.454a.75.75 0 0 1 .977-.074l.084.073a.75.75 0 0 1 .074.976l-.073.084-7.594 7.613a2.23 2.23 0 0 0 3.174 3.106l8.832-8.83A4.502 4.502 0 0 0 13 4.644l-.168.16-.013.014-9.536 9.536a.75.75 0 0 1-1.133-.977l.072-.084 9.549-9.55h.002Z" fill="currentColor"/></svg>',image:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17.75 3A3.25 3.25 0 0 1 21 6.25v11.5A3.25 3.25 0 0 1 17.75 21H6.25A3.25 3.25 0 0 1 3 17.75V6.25A3.25 3.25 0 0 1 6.25 3h11.5Zm.58 16.401-5.805-5.686a.75.75 0 0 0-.966-.071l-.084.07-5.807 5.687c.182.064.378.099.582.099h11.5c.203 0 .399-.035.58-.099l-5.805-5.686L18.33 19.4ZM17.75 4.5H6.25A1.75 1.75 0 0 0 4.5 6.25v11.5c0 .208.036.408.103.594l5.823-5.701a2.25 2.25 0 0 1 3.02-.116l.128.116 5.822 5.702c.067-.186.104-.386.104-.595V6.25a1.75 1.75 0 0 0-1.75-1.75Zm-2.498 2a2.252 2.252 0 1 1 0 4.504 2.252 2.252 0 0 1 0-4.504Zm0 1.5a.752.752 0 1 0 0 1.504.752.752 0 0 0 0-1.504Z" fill="currentColor"/></svg>',emoji_multiple:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.5 2a6.503 6.503 0 0 1 6.312 4.943c-.515.01-1.02.068-1.506.171a5 5 0 1 0-6.191 6.191 8.053 8.053 0 0 0-.172 1.507A6.5 6.5 0 0 1 8.5 2Zm.16 8.006c.355-.451.759-.864 1.202-1.23a3.5 3.5 0 0 0-4.022.95.75.75 0 1 0 1.14.974 2 2 0 0 1 1.68-.694ZM7.5 6.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm4 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm1 8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm5.458 2.042a.75.75 0 0 1 .082 1.058 4 4 0 0 1-6.075.005.75.75 0 0 1 1.138-.977 2.499 2.499 0 0 0 3.797-.003.75.75 0 0 1 1.058-.083ZM17.5 14.5a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM15 22a7 7 0 1 0 0-14 7 7 0 0 0 0 14Zm0-1.5a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11Z" fill="currentColor"/></svg>',image_off:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.28 2.22a.75.75 0 1 0-1.06 1.06l1.263 1.264A3.235 3.235 0 0 0 3 6.25v11.5A3.25 3.25 0 0 0 6.25 21h11.5c.626 0 1.21-.177 1.706-.483l1.263 1.264a.75.75 0 0 0 1.061-1.061L3.28 2.22Zm8.788 10.909 6.206 6.206.056.066a1.746 1.746 0 0 1-.58.099H6.25c-.204 0-.4-.035-.582-.099l5.807-5.686.593-.586Zm-.95-.95a2.245 2.245 0 0 0-.692.464l-5.823 5.7a1.747 1.747 0 0 1-.103-.593V6.25c0-.206.036-.404.101-.588l6.518 6.518ZM19.5 16.318V6.25a1.75 1.75 0 0 0-1.75-1.75H7.682L6.182 3H17.75A3.25 3.25 0 0 1 21 6.25v11.568l-1.5-1.5Z" fill="currentColor"/><path d="M15.252 6.5a2.252 2.252 0 1 1 0 4.504 2.252 2.252 0 0 1 0-4.504Zm0 1.5a.752.752 0 1 0 0 1.504.752.752 0 0 0 0-1.504Z" fill="currentColor"/></svg>',disconnected:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.28 2.22a.75.75 0 0 0-1.06 1.06l3.364 3.365a11.99 11.99 0 0 0-2.033 1.634c-.49.489-.964 1.069-1.394 1.689a.75.75 0 1 0 1.233.855c.381-.55.8-1.062 1.222-1.484a10.468 10.468 0 0 1 2.063-1.604l1.591 1.592a8.062 8.062 0 0 0-1.923 1.424c-.61.61-1.109 1.3-1.491 2.056a.75.75 0 1 0 1.338.677 6.51 6.51 0 0 1 1.214-1.673 6.546 6.546 0 0 1 1.984-1.362l1.93 1.93a5.07 5.07 0 0 0-2.876 1.44 5.11 5.11 0 0 0-1.061 1.57.75.75 0 0 0 1.374.602c.185-.422.437-.8.747-1.111a3.59 3.59 0 0 1 3.36-.958l7.858 7.858a.75.75 0 0 0 1.06-1.06L3.28 2.22Zm8.304 6.182 1.584 1.584a6.532 6.532 0 0 1 3.516 1.825 6.798 6.798 0 0 1 1.217 1.692.75.75 0 1 0 1.336-.683 8.292 8.292 0 0 0-1.492-2.07 8.042 8.042 0 0 0-6.16-2.348ZM8.487 5.305 9.713 6.53a10.44 10.44 0 0 1 10.908 4.297.75.75 0 1 0 1.235-.852 11.946 11.946 0 0 0-13.369-4.67Zm4.573 11.134a1.5 1.5 0 1 1-2.121 2.122 1.5 1.5 0 0 1 2.121-2.122Z" fill="currentColor"/></svg>',wand:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m13.314 7.565-.136.126-10.48 10.488a2.27 2.27 0 0 0 3.211 3.208L16.388 10.9a2.251 2.251 0 0 0-.001-3.182l-.157-.146a2.25 2.25 0 0 0-2.916-.007Zm-.848 2.961 1.088 1.088-8.706 8.713a.77.77 0 1 1-1.089-1.088l8.707-8.713Zm4.386 4.48L16.75 15a.75.75 0 0 0-.743.648L16 15.75v.75h-.75a.75.75 0 0 0-.743.648l-.007.102c0 .38.282.694.648.743l.102.007H16v.75c0 .38.282.694.648.743l.102.007a.75.75 0 0 0 .743-.648l.007-.102V18h.75a.75.75 0 0 0 .743-.648L19 17.25a.75.75 0 0 0-.648-.743l-.102-.007h-.75v-.75a.75.75 0 0 0-.648-.743L16.75 15l.102.007Zm-1.553-6.254.027.027a.751.751 0 0 1 0 1.061l-.711.713-1.089-1.089.73-.73a.75.75 0 0 1 1.043.018ZM6.852 5.007 6.75 5a.75.75 0 0 0-.743.648L6 5.75v.75h-.75a.75.75 0 0 0-.743.648L4.5 7.25c0 .38.282.693.648.743L5.25 8H6v.75c0 .38.282.693.648.743l.102.007a.75.75 0 0 0 .743-.648L7.5 8.75V8h.75a.75.75 0 0 0 .743-.648L9 7.25a.75.75 0 0 0-.648-.743L8.25 6.5H7.5v-.75a.75.75 0 0 0-.648-.743L6.75 5l.102.007Zm12-2L18.75 3a.75.75 0 0 0-.743.648L18 3.75v.75h-.75a.75.75 0 0 0-.743.648l-.007.102c0 .38.282.693.648.743L17.25 6H18v.75c0 .38.282.693.648.743l.102.007a.75.75 0 0 0 .743-.648l.007-.102V6h.75a.75.75 0 0 0 .743-.648L21 5.25a.75.75 0 0 0-.648-.743L20.25 4.5h-.75v-.75a.75.75 0 0 0-.648-.743L18.75 3l.102.007Z" fill="currentColor"/></svg>',recording:'<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M12 18a6 6 0 1 0 0-12 6 6 0 0 0 0 12Z"/><path d="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2ZM3.5 12a8.5 8.5 0 1 1 17 0 8.5 8.5 0 0 1-17 0Z"/></svg>',subtract:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.755 12.5h16.492a.75.75 0 0 0 0-1.5H3.755a.75.75 0 0 0 0 1.5Z" fill="currentColor"/></svg>',stop_recording:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 3.5C9.74566 3.5 7.58365 4.39553 5.98959 5.98959C4.39553 7.58365 3.5 9.74566 3.5 12C3.5 14.2543 4.39553 16.4163 5.98959 18.0104C7.58365 19.6045 9.74566 20.5 12 20.5C14.2543 20.5 16.4163 19.6045 18.0104 18.0104C19.6045 16.4163 20.5 14.2543 20.5 12C20.5 9.74566 19.6045 7.58365 18.0104 5.98959C16.4163 4.39553 14.2543 3.5 12 3.5ZM2 12C2 6.477 6.477 2 12 2C17.523 2 22 6.477 22 12C22 17.523 17.523 22 12 22C6.477 22 2 17.523 2 12ZM8 9.5C8 9.10218 8.15804 8.72064 8.43934 8.43934C8.72064 8.15804 9.10218 8 9.5 8H14.5C14.8978 8 15.2794 8.15804 15.5607 8.43934C15.842 8.72064 16 9.10218 16 9.5V14.5C16 14.8978 15.842 15.2794 15.5607 15.5607C15.2794 15.842 14.8978 16 14.5 16H9.5C9.10218 16 8.72064 15.842 8.43934 15.5607C8.15804 15.2794 8 14.8978 8 14.5V9.5Z" fill="currentColor"/></svg>',warning:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10.91 2.782a2.25 2.25 0 0 1 2.975.74l.083.138 7.759 14.009a2.25 2.25 0 0 1-1.814 3.334l-.154.006H4.243a2.25 2.25 0 0 1-2.041-3.197l.072-.143L10.031 3.66a2.25 2.25 0 0 1 .878-.878Zm9.505 15.613-7.76-14.008a.75.75 0 0 0-1.254-.088l-.057.088-7.757 14.008a.75.75 0 0 0 .561 1.108l.095.006h15.516a.75.75 0 0 0 .696-1.028l-.04-.086-7.76-14.008 7.76 14.008ZM12 16.002a.999.999 0 1 1 0 1.997.999.999 0 0 1 0-1.997ZM11.995 8.5a.75.75 0 0 1 .744.647l.007.102.004 4.502a.75.75 0 0 1-1.494.103l-.006-.102-.004-4.502a.75.75 0 0 1 .75-.75Z" fill="currentColor"/></svg>',pin:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m16.242 2.932 4.826 4.826a2.75 2.75 0 0 1-.715 4.404l-4.87 2.435a.75.75 0 0 0-.374.426l-1.44 4.166a1.25 1.25 0 0 1-2.065.476L8.5 16.561 4.06 21H3v-1.06l4.44-4.44-3.105-3.104a1.25 1.25 0 0 1 .476-2.066l4.166-1.44a.75.75 0 0 0 .426-.373l2.435-4.87a2.75 2.75 0 0 1 4.405-.715Zm3.766 5.886-4.826-4.826a1.25 1.25 0 0 0-2.002.325l-2.435 4.871a2.25 2.25 0 0 1-1.278 1.12l-3.789 1.31 6.705 6.704 1.308-3.789a2.25 2.25 0 0 1 1.12-1.277l4.872-2.436a1.25 1.25 0 0 0 .325-2.002Z" fill="currentColor"/></svg>',pin_off:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.28 2.22a.75.75 0 0 0-1.06 1.06l5.905 5.905L4.81 10.33a1.25 1.25 0 0 0-.476 2.065L7.439 15.5 3 19.94V21h1.06l4.44-4.44 3.105 3.105a1.25 1.25 0 0 0 2.065-.476l1.145-3.313 5.905 5.904a.75.75 0 0 0 1.06-1.06L3.28 2.22Zm10.355 12.476-1.252 3.626-6.705-6.705 3.626-1.252 4.331 4.331Zm6.048-3.876-3.787 1.894 1.118 1.118 3.34-1.67a2.75 2.75 0 0 0 .714-4.404l-4.825-4.826a2.75 2.75 0 0 0-4.405.715l-1.67 3.34 1.118 1.117 1.894-3.787a1.25 1.25 0 0 1 2.002-.325l4.826 4.826a1.25 1.25 0 0 1-.325 2.002Z" fill="currentColor"/></svg>',spinner:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="10" stroke-width="2" stroke="currentColor" stroke-opacity="0.2" vector-effect="non-scaling-stroke"/><path d="M22 12C22 10.6868 21.7413 9.38642 21.2388 8.17317C20.7362 6.95991 19.9997 5.85752 19.0711 4.92893C18.1425 4.00035 17.0401 3.26375 15.8268 2.7612C14.6136 2.25866 13.3132 2 12 2" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke"/></svg>',breakout_rooms:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10.5 3a2.25 2.25 0 0 1 2.25 2.25v6h6A2.25 2.25 0 0 1 21 13.5v5.25A2.25 2.25 0 0 1 18.75 21H5.25A2.25 2.25 0 0 1 3 18.75V5.25A2.25 2.25 0 0 1 5.25 3h5.25Zm.75 9.75H4.5v6c0 .414.336.75.75.75h5.999l.001-6.75Zm7.5 0h-6.001v6.75h6.001a.75.75 0 0 0 .75-.75V13.5a.75.75 0 0 0-.75-.75ZM10.5 4.5H5.25a.75.75 0 0 0-.75.75v6h6.75v-6a.75.75 0 0 0-.75-.75Zm7.398-2.493L18 2a.75.75 0 0 1 .743.648l.007.102v2.5h2.5a.75.75 0 0 1 .743.648L22 6a.75.75 0 0 1-.648.743l-.102.007h-2.5v2.5a.75.75 0 0 1-.648.743L18 10a.75.75 0 0 1-.743-.648l-.007-.102v-2.5h-2.5a.75.75 0 0 1-.743-.648L14 6a.75.75 0 0 1 .648-.743l.102-.007h2.5v-2.5a.75.75 0 0 1 .648-.743Z" fill="currentColor"/></svg>',add:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M11.75 3a.75.75 0 0 1 .743.648l.007.102.001 7.25h7.253a.75.75 0 0 1 .102 1.493l-.102.007h-7.253l.002 7.25a.75.75 0 0 1-1.493.101l-.007-.102-.002-7.249H3.752a.75.75 0 0 1-.102-1.493L3.752 11h7.25L11 3.75a.75.75 0 0 1 .75-.75Z" fill="currentColor"/></svg>',shuffle:'<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M14.0058 8.11111H18.7947L16.9613 9.94444C16.9095 9.99587 16.8684 10.057 16.8402 10.1243C16.812 10.1917 16.7974 10.2639 16.7971 10.3369C16.7966 10.4843 16.8547 10.6259 16.9586 10.7306C17.01 10.7823 17.0711 10.8235 17.1385 10.8517C17.2058 10.8799 17.278 10.8945 17.351 10.8947C17.4985 10.8953 17.64 10.8372 17.7447 10.7333L20.8891 7.59999L20.4947 7.20555L17.7447 4.46111C17.64 4.35723 17.4985 4.29917 17.351 4.29969C17.2036 4.30021 17.0624 4.35927 16.9586 4.46388C16.8547 4.5685 16.7966 4.71009 16.7971 4.85751C16.7977 5.00494 16.8567 5.14612 16.9613 5.24999L18.728 6.99999H13.6669C13.5699 7.00058 13.4748 7.02653 13.391 7.07526C13.3072 7.12399 13.2376 7.19381 13.1891 7.27777L11.7224 9.82777L12.3669 10.9389L14.0058 8.11111Z" fill="currentColor"/><path d="M8.15022 15.9278H3.66688C3.51954 15.9278 3.37823 15.9863 3.27405 16.0905C3.16986 16.1947 3.11133 16.336 3.11133 16.4833C3.11133 16.6307 3.16986 16.772 3.27405 16.8762C3.37823 16.9804 3.51954 17.0389 3.66688 17.0389H8.47244C8.56939 17.0383 8.6645 17.0124 8.74832 16.9636C8.83214 16.9149 8.90174 16.8451 8.95022 16.7611L10.4335 14.2222L9.77799 13.1111L8.15022 15.9278Z"/><path d="M17.7447 13.2056C17.64 13.1017 17.4985 13.0436 17.351 13.0441C17.2036 13.0447 17.0624 13.1037 16.9586 13.2083C16.8547 13.3129 16.7966 13.4545 16.7971 13.602C16.7977 13.7494 16.8567 13.8906 16.9613 13.9944L18.9058 15.9389H14.0058L8.95022 7.29444C8.90174 7.21047 8.83214 7.14066 8.74832 7.09193C8.6645 7.04319 8.56939 7.01725 8.47244 7.01666H3.66688C3.51954 7.01666 3.37823 7.07519 3.27405 7.17938C3.16986 7.28357 3.11133 7.42487 3.11133 7.57222C3.11133 7.71956 3.16986 7.86087 3.27405 7.96505C3.37823 8.06924 3.51954 8.12777 3.66688 8.12777H8.15022L13.2058 16.7667C13.2542 16.8506 13.3239 16.9204 13.4077 16.9692C13.4915 17.0179 13.5866 17.0439 13.6836 17.0444H18.6113L16.9447 18.7111C16.8929 18.7625 16.8517 18.8237 16.8235 18.891C16.7954 18.9584 16.7807 19.0306 16.7805 19.1036C16.7802 19.1766 16.7943 19.2489 16.822 19.3165C16.8497 19.384 16.8905 19.4454 16.9419 19.4972C16.9933 19.549 17.0545 19.5902 17.1218 19.6184C17.1891 19.6465 17.2614 19.6612 17.3344 19.6614C17.4074 19.6617 17.4797 19.6476 17.5472 19.6199C17.6148 19.5922 17.6762 19.5514 17.728 19.5L20.478 16.7556L20.8724 16.3611L17.7447 13.2056Z"/></svg>',edit:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M21.03 2.97a3.578 3.578 0 0 1 0 5.06L9.062 20a2.25 2.25 0 0 1-.999.58l-5.116 1.395a.75.75 0 0 1-.92-.921l1.395-5.116a2.25 2.25 0 0 1 .58-.999L15.97 2.97a3.578 3.578 0 0 1 5.06 0ZM15 6.06 5.062 16a.75.75 0 0 0-.193.333l-1.05 3.85 3.85-1.05A.75.75 0 0 0 8 18.938L17.94 9 15 6.06Zm2.03-2.03-.97.97L19 7.94l.97-.97a2.079 2.079 0 0 0-2.94-2.94Z" fill="currentColor"/></svg>',delete:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 1.75a3.25 3.25 0 0 1 3.245 3.066L15.25 5h5.25a.75.75 0 0 1 .102 1.493L20.5 6.5h-.796l-1.28 13.02a2.75 2.75 0 0 1-2.561 2.474l-.176.006H8.313a2.75 2.75 0 0 1-2.714-2.307l-.023-.174L4.295 6.5H3.5a.75.75 0 0 1-.743-.648L2.75 5.75a.75.75 0 0 1 .648-.743L3.5 5h5.25A3.25 3.25 0 0 1 12 1.75Zm6.197 4.75H5.802l1.267 12.872a1.25 1.25 0 0 0 1.117 1.122l.127.006h7.374c.6 0 1.109-.425 1.225-1.002l.02-.126L18.196 6.5ZM13.75 9.25a.75.75 0 0 1 .743.648L14.5 10v7a.75.75 0 0 1-1.493.102L13 17v-7a.75.75 0 0 1 .75-.75Zm-3.5 0a.75.75 0 0 1 .743.648L11 10v7a.75.75 0 0 1-1.493.102L9.5 17v-7a.75.75 0 0 1 .75-.75Zm1.75-6a1.75 1.75 0 0 0-1.744 1.606L10.25 5h3.5A1.75 1.75 0 0 0 12 3.25Z" fill="currentColor"/></svg>',back:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M4.75 2a.75.75 0 0 1 .743.648l.007.102v5.69l4.574-4.56a6.41 6.41 0 0 1 8.879-.179l.186.18a6.41 6.41 0 0 1 0 9.063l-8.846 8.84a.75.75 0 0 1-1.06-1.062l8.845-8.838a4.91 4.91 0 0 0-6.766-7.112l-.178.17L6.562 9.5h5.688a.75.75 0 0 1 .743.648l.007.102a.75.75 0 0 1-.648.743L12.25 11h-7.5a.75.75 0 0 1-.743-.648L4 10.25v-7.5A.75.75 0 0 1 4.75 2Z" fill="currentColor"/></svg>',save:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M3 5.75A2.75 2.75 0 0 1 5.75 3h9.964a3.25 3.25 0 0 1 2.299.952l2.035 2.035c.61.61.952 1.437.952 2.299v9.964A2.75 2.75 0 0 1 18.25 21H5.75A2.75 2.75 0 0 1 3 18.25V5.75ZM5.75 4.5c-.69 0-1.25.56-1.25 1.25v12.5c0 .69.56 1.25 1.25 1.25H6v-5.25A2.25 2.25 0 0 1 8.25 12h7.5A2.25 2.25 0 0 1 18 14.25v5.25h.25c.69 0 1.25-.56 1.25-1.25V8.286c0-.465-.184-.91-.513-1.238l-2.035-2.035a1.75 1.75 0 0 0-.952-.49V7.25a2.25 2.25 0 0 1-2.25 2.25h-4.5A2.25 2.25 0 0 1 7 7.25V4.5H5.75Zm10.75 15v-5.25a.75.75 0 0 0-.75-.75h-7.5a.75.75 0 0 0-.75.75v5.25h9Zm-8-15v2.75c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75V4.5h-6Z" fill="currentColor"/></svg>',web:'<svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 1.999c5.524 0 10.002 4.478 10.002 10.002 0 5.523-4.478 10.001-10.002 10.001-5.524 0-10.002-4.478-10.002-10.001C1.998 6.477 6.476 1.999 12 1.999ZM14.939 16.5H9.06c.652 2.414 1.786 4.002 2.939 4.002s2.287-1.588 2.939-4.002Zm-7.43 0H4.785a8.532 8.532 0 0 0 4.094 3.411c-.522-.82-.953-1.846-1.27-3.015l-.102-.395Zm11.705 0h-2.722c-.324 1.335-.792 2.5-1.373 3.411a8.528 8.528 0 0 0 3.91-3.127l.185-.283ZM7.094 10H3.735l-.005.017a8.525 8.525 0 0 0-.233 1.984c0 1.056.193 2.067.545 3h3.173a20.847 20.847 0 0 1-.123-5Zm8.303 0H8.603a18.966 18.966 0 0 0 .135 5h6.524a18.974 18.974 0 0 0 .135-5Zm4.868 0h-3.358c.062.647.095 1.317.095 2a20.3 20.3 0 0 1-.218 3h3.173a8.482 8.482 0 0 0 .544-3c0-.689-.082-1.36-.236-2ZM8.88 4.09l-.023.008A8.531 8.531 0 0 0 4.25 8.5h3.048c.314-1.752.86-3.278 1.583-4.41ZM12 3.499l-.116.005C10.62 3.62 9.396 5.622 8.83 8.5h6.342c-.566-2.87-1.783-4.869-3.045-4.995L12 3.5Zm3.12.59.107.175c.669 1.112 1.177 2.572 1.475 4.237h3.048a8.533 8.533 0 0 0-4.339-4.29l-.291-.121Z" fill="currentColor"/></svg>',checkmark:'<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0V0z"/><path d="m18 6.7-8.48 8.48-3.54-3.54a.996.996 0 1 0-1.41 1.41l4.24 4.24c.39.39 1.02.39 1.41 0l9.18-9.18a.999.999 0 0 0-.01-1.42c-.37-.38-1-.38-1.39.01z"/></svg>',spotlight:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M19.745 4C20.3417 4 20.914 4.23705 21.336 4.65901C21.7579 5.08097 21.995 5.65326 21.995 6.25V12.805C21.5485 12.3774 21.0434 12.0154 20.495 11.73V6.25C20.495 6.05109 20.416 5.86032 20.2753 5.71967C20.1347 5.57902 19.9439 5.5 19.745 5.5H4.25C4.05109 5.5 3.86032 5.57902 3.71967 5.71967C3.57902 5.86032 3.5 6.05109 3.5 6.25V17.755C3.5 18.169 3.836 18.505 4.25 18.505L6.999 18.504L7 15.75C7.00002 15.3108 7.16517 14.8877 7.46268 14.5646C7.76019 14.2415 8.1683 14.0421 8.606 14.006L8.75 14H12.022C11.7223 14.4675 11.484 14.9716 11.313 15.5H8.75C8.69368 15.5001 8.63904 15.5192 8.59493 15.5542C8.55083 15.5893 8.51984 15.6382 8.507 15.693L8.5 15.75L8.499 18.504H11.077C11.1569 19.0193 11.2989 19.5229 11.5 20.004H4.25C3.65344 20.004 3.08129 19.7671 2.65936 19.3453C2.23744 18.9236 2.00027 18.3516 2 17.755V6.25C2 5.65326 2.23705 5.08097 2.65901 4.65901C3.08097 4.23705 3.65326 4 4.25 4H19.745Z"/><path d="M12 7C12.7956 7 13.5587 7.31607 14.1213 7.87868C14.6839 8.44129 15 9.20435 15 10C15 10.7956 14.6839 11.5587 14.1213 12.1213C13.5587 12.6839 12.7956 13 12 13C11.2044 13 10.4413 12.6839 9.87868 12.1213C9.31607 11.5587 9 10.7956 9 10C9 9.20435 9.31607 8.44129 9.87868 7.87868C10.4413 7.31607 11.2044 7 12 7ZM12 8.5C11.6022 8.5 11.2206 8.65804 10.9393 8.93934C10.658 9.22064 10.5 9.60218 10.5 10C10.5 10.3978 10.658 10.7794 10.9393 11.0607C11.2206 11.342 11.6022 11.5 12 11.5C12.3978 11.5 12.7794 11.342 13.0607 11.0607C13.342 10.7794 13.5 10.3978 13.5 10C13.5 9.60218 13.342 9.22064 13.0607 8.93934C12.7794 8.65804 12.3978 8.5 12 8.5Z"/><path d="M23 17.5C23 18.9587 22.4205 20.3576 21.3891 21.3891C20.3576 22.4205 18.9587 23 17.5 23C16.0413 23 14.6424 22.4205 13.6109 21.3891C12.5795 20.3576 12 18.9587 12 17.5C12 16.0413 12.5795 14.6424 13.6109 13.6109C14.6424 12.5795 16.0413 12 17.5 12C18.9587 12 20.3576 12.5795 21.3891 13.6109C22.4205 14.6424 23 16.0413 23 17.5ZM18.055 14.42C18.0207 14.2993 17.9479 14.193 17.8478 14.1174C17.7476 14.0417 17.6255 14.0008 17.5 14.0008C17.3745 14.0008 17.2524 14.0417 17.1522 14.1174C17.0521 14.193 16.9793 14.2993 16.945 14.42L16.388 16.208H14.585C14.019 16.208 13.785 16.962 14.242 17.308L15.7 18.413L15.143 20.2C14.968 20.761 15.584 21.228 16.042 20.881L17.5 19.777L18.958 20.881C19.416 21.228 20.032 20.761 19.857 20.201L19.3 18.413L20.758 17.309C21.216 16.962 20.981 16.208 20.415 16.208H18.612L18.055 14.421V14.42Z"/></svg>',join_stage:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M17.5 22C14.4618 22 12 19.5376 12 16.5C12 13.4623 14.4618 11 17.5 11C20.5371 11 23 13.4624 23 16.5C23 19.5376 20.5371 22 17.5 22ZM17.0704 18.992L17.1167 19.0322C17.1868 19.0841 17.2716 19.1125 17.3588 19.1132C17.4461 19.1139 17.5314 19.0869 17.6023 19.036L17.654 18.992L17.6936 18.9458C17.7455 18.8757 17.7739 18.7909 17.7746 18.7037C17.7753 18.6164 17.7483 18.5311 17.6975 18.4602L17.6535 18.4085L16.158 16.9125H19.8375L19.8936 16.9092C19.9829 16.8969 20.0657 16.8558 20.1293 16.792C20.193 16.7282 20.234 16.6454 20.2462 16.5561L20.25 16.5005L20.2462 16.4444C20.2339 16.3553 20.1928 16.2725 20.1292 16.2089C20.0655 16.1452 19.9828 16.1041 19.8936 16.0919L19.8375 16.088H16.158L17.654 14.592L17.6941 14.5453C17.7537 14.4659 17.7827 14.3676 17.7756 14.2686C17.7686 14.1695 17.726 14.0763 17.6558 14.0061C17.5856 13.9359 17.4924 13.8934 17.3934 13.8863C17.2943 13.8793 17.1961 13.9082 17.1167 13.9678L17.071 14.0079L14.8699 16.2079L14.8303 16.2547C14.7784 16.3247 14.75 16.4094 14.7493 16.4965C14.7485 16.5837 14.7753 16.6688 14.8259 16.7398L14.8699 16.7915L17.0704 18.992Z"/><path d="M2.80546 3.80546C2.28973 4.32118 2 5.02065 2 5.75V16.25C2 16.6111 2.07113 16.9687 2.20933 17.3024C2.34753 17.636 2.5501 17.9392 2.80546 18.1945C3.06082 18.4499 3.36398 18.6525 3.69762 18.7907C4.03127 18.9289 4.38886 19 4.75 19H11.498C11.3 18.526 11.157 18.023 11.076 17.5H9.002V14.75C9.002 14.6837 9.02834 14.6201 9.07522 14.5732C9.12211 14.5263 9.1857 14.5 9.252 14.5H11.3135C11.4858 13.9665 11.7253 13.4632 12.0218 13H9.252C8.285 13 7.502 13.784 7.502 14.75V16H7.5V17.5H4.75C4.06 17.5 3.5 16.94 3.5 16.25V5.75C3.5 5.06 4.06 4.5 4.75 4.5H19.25C19.94 4.5 20.5 5.06 20.5 5.75V10.732C20.6457 10.808 20.7884 10.8895 20.9277 10.9762C20.9687 11.0017 21.0093 11.0276 21.0497 11.054C21.3899 11.2762 21.708 11.5294 22 11.8096V5.75C22 5.02065 21.7103 4.32118 21.1945 3.80546C20.6788 3.28973 19.9793 3 19.25 3H4.75C4.02065 3 3.32118 3.28973 2.80546 3.80546Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M14.4181 10.7757C14.7938 10.264 15 9.64262 15 9C15 8.20435 14.6839 7.44129 14.1213 6.87868C13.5587 6.31607 12.7956 6 12 6C11.2044 6 10.4413 6.31607 9.87868 6.87868C9.31607 7.44129 9 8.20435 9 9C9 9.79565 9.31607 10.5587 9.87868 11.1213C10.4413 11.6839 11.2044 12 12 12C12.333 12 12.6602 11.9446 12.9695 11.839C13.3992 11.4213 13.8864 11.0625 14.4181 10.7757ZM10.9393 7.93934C11.2206 7.65804 11.6022 7.5 12 7.5C12.3978 7.5 12.7794 7.65804 13.0607 7.93934C13.342 8.22064 13.5 8.60218 13.5 9C13.5 9.39782 13.342 9.77936 13.0607 10.0607C12.7794 10.342 12.3978 10.5 12 10.5C11.6022 10.5 11.2206 10.342 10.9393 10.0607C10.658 9.77936 10.5 9.39782 10.5 9C10.5 8.60218 10.658 8.22064 10.9393 7.93934Z"></svg>',leave_stage:'<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M2.80546 3.80546C2.28973 4.32118 2 5.02065 2 5.75V16.25C2 16.6111 2.07113 16.9687 2.20933 17.3024C2.34753 17.636 2.5501 17.9392 2.80546 18.1945C3.06082 18.4499 3.36398 18.6525 3.69762 18.7907C4.03127 18.9289 4.38886 19 4.75 19H11.498C11.3 18.526 11.157 18.023 11.076 17.5H9.002V14.75C9.002 14.6837 9.02834 14.6201 9.07522 14.5732C9.12211 14.5263 9.1857 14.5 9.252 14.5H11.3135C11.4858 13.9665 11.7253 13.4632 12.0218 13H9.252C8.285 13 7.502 13.784 7.502 14.75V16H7.5V17.5H4.75C4.06 17.5 3.5 16.94 3.5 16.25V5.75C3.5 5.06 4.06 4.5 4.75 4.5H19.25C19.94 4.5 20.5 5.06 20.5 5.75V10.732C20.6457 10.808 20.7884 10.8895 20.9277 10.9762C20.9687 11.0017 21.0093 11.0276 21.0497 11.054C21.3899 11.2762 21.708 11.5294 22 11.8096V5.75C22 5.02065 21.7103 4.32118 21.1945 3.80546C20.6788 3.28973 19.9793 3 19.25 3H4.75C4.02065 3 3.32118 3.28973 2.80546 3.80546Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M14.4181 10.7757C14.7938 10.264 15 9.64262 15 9C15 8.20435 14.6839 7.44129 14.1213 6.87868C13.5587 6.31607 12.7956 6 12 6C11.2044 6 10.4413 6.31607 9.87868 6.87868C9.31607 7.44129 9 8.20435 9 9C9 9.79565 9.31607 10.5587 9.87868 11.1213C10.4413 11.6839 11.2044 12 12 12C12.333 12 12.6602 11.9446 12.9695 11.839C13.3992 11.4213 13.8864 11.0625 14.4181 10.7757ZM10.9393 7.93934C11.2206 7.65804 11.6022 7.5 12 7.5C12.3978 7.5 12.7794 7.65804 13.0607 7.93934C13.342 8.22064 13.5 8.60218 13.5 9C13.5 9.39782 13.342 9.77936 13.0607 10.0607C12.7794 10.342 12.3978 10.5 12 10.5C11.6022 10.5 11.2206 10.342 10.9393 10.0607C10.658 9.77936 10.5 9.39782 10.5 9C10.5 8.60218 10.658 8.22064 10.9393 7.93934Z"/><path d="M17.5 11C20.5382 11 23 13.4624 23 16.5C23 19.5377 20.5382 22 17.5 22C14.4629 22 12 19.5377 12 16.5C12 13.4624 14.4629 11 17.5 11V11ZM17.9296 14.0079L17.8833 13.9678C17.8132 13.9159 17.7284 13.8875 17.6412 13.8868C17.5539 13.8861 17.4686 13.9131 17.3977 13.964L17.346 14.0079L17.3064 14.0542C17.2545 14.1243 17.2261 14.2091 17.2254 14.2963C17.2247 14.3836 17.2517 14.4689 17.3026 14.5398L17.3465 14.5915L18.842 16.0875H15.1625L15.1064 16.0908C15.0171 16.1031 14.9343 16.1442 14.8707 16.208C14.807 16.2718 14.766 16.3546 14.7539 16.4439L14.75 16.4995L14.7539 16.5556C14.7661 16.6447 14.8072 16.7275 14.8708 16.7911C14.9345 16.8548 15.0172 16.8959 15.1064 16.9081L15.1625 16.912H18.842L17.346 18.408L17.3059 18.4547C17.2463 18.5341 17.2173 18.6324 17.2244 18.7314C17.2314 18.8305 17.274 18.9237 17.3442 18.9939C17.4144 19.0641 17.5076 19.1066 17.6066 19.1137C17.7057 19.1207 17.8039 19.0918 17.8833 19.0322L17.929 18.9921L20.1301 16.7921L20.1697 16.7453C20.2216 16.6753 20.25 16.5906 20.2507 16.5035C20.2515 16.4163 20.2247 16.3312 20.1741 16.2602L20.1301 16.2085L17.9301 14.0079L17.8833 13.9678L17.9296 14.0079V14.0079Z"/></svg>',pip_off:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.8666 12.3058C11.0731 12.3058 11.2404 12.1385 11.2404 11.932V8.56753C11.2404 8.36107 11.0731 8.1937 10.8666 8.1937C10.6601 8.1937 10.4928 8.36107 10.4928 8.56753V11.0295L6.45393 6.99066C6.30794 6.84467 6.07124 6.84467 5.92525 6.99066C5.77926 7.13665 5.77926 7.37335 5.92525 7.51934L9.9641 11.5582L7.50212 11.5582C7.29566 11.5582 7.12829 11.7256 7.12829 11.932C7.12829 12.1385 7.29566 12.3058 7.50212 12.3058L10.8666 12.3058ZM5.73832 19.8879C3.6737 19.8879 2 18.2141 2 16.1495V7.73832C2 5.6737 3.6737 4 5.73832 4H18.2617C20.3263 4 22 5.6737 22 7.73832L22 13.0269C22 12.2687 21.6002 11.6038 21 11.2316C20.8468 11.1366 20.6806 11.0607 20.5047 11.0071V7.73832C20.5047 6.49955 19.5005 5.49533 18.2617 5.49533H5.73832C4.49955 5.49533 3.49533 6.49955 3.49533 7.73832V16.1495C3.49533 17.3883 4.49955 18.3925 5.73832 18.3925H10.7971C10.8506 18.5685 10.9266 18.7347 11.0216 18.8879C11.3938 19.4881 12.0587 19.8879 12.8169 19.8879H5.73832Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M19.7265 12.5H13.3911C12.899 12.5 12.5 12.899 12.5 13.3911V17.6462C12.5 18.1384 12.899 18.5374 13.3911 18.5374H19.7265C20.2187 18.5374 20.6176 18.1384 20.6176 17.6462V13.3911C20.6176 12.899 20.2187 12.5 19.7265 12.5ZM13.3911 11.5C12.3467 11.5 11.5 12.3467 11.5 13.3911V17.6462C11.5 18.6907 12.3467 19.5374 13.3911 19.5374H19.7265C20.771 19.5374 21.6176 18.6907 21.6176 17.6462V13.3911C21.6176 12.3467 20.771 11.5 19.7265 11.5H13.3911Z"/></svg>',pip_on:'<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M5.73832 19.8879C3.6737 19.8879 2 18.2141 2 16.1495V7.73832C2 5.6737 3.6737 4 5.73832 4H18.2617C20.3263 4 22 5.6737 22 7.73832L22 13.0269C22 12.2687 21.6002 11.6038 21 11.2316C20.8468 11.1366 20.6806 11.0607 20.5047 11.0071V7.73832C20.5047 6.49955 19.5005 5.49533 18.2617 5.49533H5.73832C4.49955 5.49533 3.49533 6.49955 3.49533 7.73832V16.1495C3.49533 17.3883 4.49955 18.3925 5.73832 18.3925H10.7971C10.8506 18.5685 10.9266 18.7347 11.0216 18.8879C11.3938 19.4881 12.0587 19.8879 12.8169 19.8879H5.73832Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M19.7265 12.5H13.3911C12.899 12.5 12.5 12.899 12.5 13.3911V17.6462C12.5 18.1384 12.899 18.5374 13.3911 18.5374H19.7265C20.2187 18.5374 20.6176 18.1384 20.6176 17.6462V13.3911C20.6176 12.899 20.2187 12.5 19.7265 12.5ZM13.3911 11.5C12.3467 11.5 11.5 12.3467 11.5 13.3911V17.6462C11.5 18.6907 12.3467 19.5374 13.3911 19.5374H19.7265C20.771 19.5374 21.6176 18.6907 21.6176 17.6462V13.3911C21.6176 12.3467 20.771 11.5 19.7265 11.5H13.3911Z"/><path d="M6.18951 6.88123C5.98304 6.88123 5.81567 7.0486 5.81567 7.25506V10.6195C5.81567 10.826 5.98304 10.9934 6.18951 10.9934C6.39597 10.9934 6.56334 10.826 6.56334 10.6195V8.15757L10.6022 12.1964C10.7482 12.3424 10.9849 12.3424 11.1309 12.1964C11.2769 12.0504 11.2769 11.8137 11.1309 11.6677L7.09202 7.62889L9.55399 7.62889C9.76045 7.62889 9.92782 7.46152 9.92782 7.25506C9.92782 7.0486 9.76045 6.88123 9.55399 6.88123L6.18951 6.88123Z"/></svg>',signal_1:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 16h2v5H3z"></path></svg>',signal_2:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 16h2v5H3zm4-3h2v8H7z"></path></svg>',signal_3:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 16h2v5H3zm4-3h2v8H7zm4-3h2v11h-2z"></path></svg>',signal_4:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 16h2v5H3zm4-3h2v8H7zm4-3h2v11h-2zm4-3h2v14h-2z"></path></svg>',signal_5:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 16h2v5H3zm4-3h2v8H7zm4-3h2v11h-2zm4-3h2v14h-2zm4-3h2v17h-2z"></path></svg>',start_livestream:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M6.343 4.938a1 1 0 0 1 0 1.415a8.003 8.003 0 0 0 0 11.317a1 1 0 1 1-1.415 1.414c-3.906-3.906-3.906-10.24 0-14.146a1 1 0 0 1 1.415 0Zm12.731 0c3.906 3.907 3.906 10.24 0 14.146a1 1 0 0 1-1.414-1.414a8.003 8.003 0 0 0 0-11.317a1 1 0 0 1 1.414-1.415ZM9.31 7.812a1 1 0 0 1 0 1.414a3.92 3.92 0 0 0 0 5.544a1 1 0 1 1-1.414 1.414a5.92 5.92 0 0 1 0-8.372a1 1 0 0 1 1.414 0Zm6.959 0a5.92 5.92 0 0 1 0 8.372a1 1 0 0 1-1.415-1.414a3.92 3.92 0 0 0 0-5.544a1 1 0 0 1 1.415-1.414Zm-4.187 2.77a1.5 1.5 0 1 1 0 3a1.5 1.5 0 0 1 0-3Z"/></svg>',stop_livestream:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill="currentColor" d="M2.854 2.146a.5.5 0 1 0-.708.708l1.811 1.81A8.218 8.218 0 0 0 2 10a8.228 8.228 0 0 0 2.604 6.015a.725.725 0 0 0 1.01-.025c.316-.316.277-.819-.027-1.11A6.73 6.73 0 0 1 3.5 10c0-1.62.57-3.107 1.522-4.27l.712.71A5.726 5.726 0 0 0 4.5 10c0 1.691.73 3.213 1.893 4.264a.713.713 0 0 0 .983-.037c.328-.328.267-.844-.041-1.134A4.238 4.238 0 0 1 6 10c0-.93.298-1.789.804-2.489l1.842 1.842a1.5 1.5 0 0 0 2 2l6.5 6.5a.5.5 0 0 0 .708-.707l-1.811-1.81l-1.065-1.066l-.712-.71l-1.07-1.072l-1.842-1.841l-2-2L7.4 6.693l-.942-.942l-.82-.82l-.944-.944l-1.841-1.842Zm13.794 12.38A8.212 8.212 0 0 0 18 10c0-2.283-.928-4.35-2.426-5.843a.726.726 0 0 0-1.027.01c-.31.31-.28.8.01 1.095A6.727 6.727 0 0 1 16.5 10a6.718 6.718 0 0 1-.94 3.438l1.088 1.089Zm-1.822-1.822A5.73 5.73 0 0 0 15.5 10a5.733 5.733 0 0 0-1.706-4.087a.714.714 0 0 0-1.008.016c-.319.318-.272.816.014 1.111A4.235 4.235 0 0 1 14 10c0 .557-.107 1.09-.302 1.577l1.128 1.127Z"/></svg>',viewers:'<svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 9.005a4 4 0 1 1 0 8 4 4 0 0 1 0-8Zm0 1.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5ZM12 5.5c4.613 0 8.596 3.15 9.701 7.564a.75.75 0 1 1-1.455.365 8.503 8.503 0 0 0-16.493.004.75.75 0 0 1-1.455-.363A10.003 10.003 0 0 1 12 5.5Z" fill="currentColor"/></svg>',debug:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m10.05 15.42 6.256-8.476a.694.694 0 0 1 1.235.57l-.03.098-3.87 9.8a2.07 2.07 0 1 1-3.737-1.766l.069-.115.076-.11 6.257-8.477-6.257 8.476Zm2.05-4.549-1.226 1.66a3.32 3.32 0 0 0-2.29 3.024.75.75 0 0 1-1.5-.063A4.819 4.819 0 0 1 9.14 11.74c.9-.631 1.942-.911 2.961-.87Zm4.167 2.752c.28.586.436 1.22.463 1.866a.75.75 0 0 1-1.376.444l.913-2.31Zm-2.233-5.37-.969 1.311a6.22 6.22 0 0 0-4.736 1.02 6.208 6.208 0 0 0-2.419 3.39.75.75 0 0 1-1.442-.412 7.708 7.708 0 0 1 3-4.207 7.724 7.724 0 0 1 6.566-1.102Zm3.51 2.138c.25.267.486.556.702.865a7.727 7.727 0 0 1 1.097 2.288.75.75 0 0 1-1.44.417 6.23 6.23 0 0 0-.885-1.845l-.102-.138.627-1.587ZM15.98 5.852l-.088.054c-.123.082-.236.18-.337.295l-.096.12-.54.732a9.138 9.138 0 0 0-8.261 1.146A9.103 9.103 0 0 0 3.38 12.37a.75.75 0 1 1-1.398-.543A10.603 10.603 0 0 1 5.799 6.97 10.642 10.642 0 0 1 15.98 5.852Zm2.629 1.562a10.646 10.646 0 0 1 2.022 2.171c.49.702.892 1.451 1.199 2.235a.75.75 0 1 1-1.397.547 9.188 9.188 0 0 0-2.327-3.405l.381-.964c.076-.19.115-.388.122-.584Z" fill="currentColor"/></svg>',info:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 1.999c5.524 0 10.002 4.478 10.002 10.002 0 5.523-4.478 10.001-10.002 10.001-5.524 0-10.002-4.478-10.002-10.001C1.998 6.477 6.476 1.999 12 1.999Zm0 1.5a8.502 8.502 0 1 0 0 17.003A8.502 8.502 0 0 0 12 3.5Zm-.004 7a.75.75 0 0 1 .744.648l.007.102.003 5.502a.75.75 0 0 1-1.493.102l-.007-.101-.003-5.502a.75.75 0 0 1 .75-.75ZM12 7.003a.999.999 0 1 1 0 1.997.999.999 0 0 1 0-1.997Z" fill="currentColor"/></svg>',devices:'<svg fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 18.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm5.5-8.5V9a5.5 5.5 0 1 0-11 0v1H9a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H6.5v.25a2.25 2.25 0 0 0 2.096 2.245l.154.005h1.128a2.251 2.251 0 1 1 0 1.5H8.75a3.75 3.75 0 0 1-3.745-3.55L5 16.25V9a7 7 0 0 1 14 0v5a2 2 0 0 1-1.85 1.995L17 16h-2a1 1 0 0 1-.993-.883L14 15v-4a1 1 0 0 1 .883-.993L15 10h2.5Zm-9 1.5h-2v3h2v-3Zm9 0h-2v3H17a.5.5 0 0 0 .492-.41L17.5 14v-2.5Z" fill="currentColor"/></svg>',horizontal_dots:'<svg fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M8 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM14 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM18 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z" fill="currentColor"/></svg>',ai_sparkle:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 49 48" fill="none"><path fill="#F13E1B" d="m30.023 15.96.07.016a1.362 1.362 0 0 1 .657 2.068c-.163.23-.392.403-.658.497l-3.444 1.118a7.095 7.095 0 0 0-4.495 4.492l-1.12 3.442a1.357 1.357 0 0 1-1.267.907h-.016a1.361 1.361 0 0 1-1.283-.907l-1.12-3.442a7.091 7.091 0 0 0-4.495-4.509l-3.444-1.119a1.36 1.36 0 0 1 0-2.564l3.444-1.118a7.097 7.097 0 0 0 4.427-4.492l1.119-3.442a1.36 1.36 0 0 1 2.566 0l1.12 3.442a7.09 7.09 0 0 0 4.495 4.492l3.444 1.118Zm9.195 16.007-2.755-.894a5.678 5.678 0 0 1-3.596-3.594l-.896-2.753a1.087 1.087 0 0 0-2.053 0l-.895 2.753a5.672 5.672 0 0 1-3.541 3.594l-2.756.894a1.088 1.088 0 0 0 0 2.052l2.756.895a5.675 5.675 0 0 1 3.596 3.607l.896 2.753a1.088 1.088 0 0 0 2.052 0l.896-2.753a5.672 5.672 0 0 1 3.596-3.594l2.756-.894a1.088 1.088 0 0 0 0-2.052l-.056-.014Z"/><path fill="#2160FD" d="m39.218 31.967-2.755-.894a5.677 5.677 0 0 1-3.596-3.594l-.896-2.753a1.087 1.087 0 0 0-2.053 0l-.895 2.753a5.672 5.672 0 0 1-3.541 3.594l-2.756.894a1.088 1.088 0 0 0 0 2.052l2.756.895a5.675 5.675 0 0 1 3.596 3.607l.896 2.753a1.088 1.088 0 0 0 2.052 0l.896-2.753a5.672 5.672 0 0 1 3.596-3.594l2.756-.894a1.088 1.088 0 0 0 0-2.052l-.056-.014Z"/></svg>',meeting_ai:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" fill="none"><path fill="#F13E1B" d="M9.111 12.888a4.98 4.98 0 0 0-1.075-.8l-.04.048a4.651 4.651 0 0 0-.903-.424l-2.446-.8a.963.963 0 0 1-.467-.356.953.953 0 0 1 0-1.116.955.955 0 0 1 .467-.352l2.446-.8A5.088 5.088 0 0 0 9.04 7.06a5.048 5.048 0 0 0 1.2-1.904l.02-.064.799-2.444A.97.97 0 0 1 11.969 2a.97.97 0 0 1 .91.648l.8 2.444a5.147 5.147 0 0 0 1.219 1.976 5.042 5.042 0 0 0 1.974 1.2l2.45.8h.048c.188.067.351.19.468.352.115.164.176.36.175.56.001.2-.06.396-.175.56a1 1 0 0 1-.468.352l-2.446.8a5.067 5.067 0 0 0-1.978 1.2 5.096 5.096 0 0 0-1.199 1.976l-.8 2.448-.023.06a1.02 1.02 0 0 1-.184.284.967.967 0 0 1-.703.3 1 1 0 0 1-.927-.644l-.8-2.448a5.11 5.11 0 0 0-.799-1.508 5.16 5.16 0 0 0-.4-.472Zm10.434 5.396a.492.492 0 0 1 .176-.236.473.473 0 0 1 .1-.048.466.466 0 0 1 .168-.04c.1 0 .197.031.28.088l.091.072a.456.456 0 0 1 .096.164l.4 1.224c.124.372.332.71.607.988.278.276.616.484.987.608l1.223.4h.028l.084.04a.536.536 0 0 1 .148.136c.056.082.087.18.088.28a.484.484 0 0 1-.32.456l-1.227.4a2.528 2.528 0 0 0-1.595 1.6l-.399 1.224a.46.46 0 0 1-.176.232.464.464 0 0 1-.28.088.475.475 0 0 1-.455-.32l-.4-1.224a2.507 2.507 0 0 0-.611-.992 2.487 2.487 0 0 0-.987-.612l-1.223-.4a.48.48 0 0 1 0-.908l1.223-.4c.367-.128.7-.337.975-.612.137-.142.257-.3.36-.468.1-.162.18-.335.24-.516l.399-1.224Z"/><path fill="currentColor" d="M19.545 18.284a.492.492 0 0 1 .176-.236.469.469 0 0 1 .1-.048.466.466 0 0 1 .168-.04c.1 0 .197.031.28.088l.091.072a.456.456 0 0 1 .096.164l.4 1.224c.124.372.332.71.607.988.279.276.616.484.988.608l1.222.4h.028l.084.04a.534.534 0 0 1 .148.136c.057.082.087.18.088.28a.484.484 0 0 1-.32.456l-1.227.4a2.528 2.528 0 0 0-1.595 1.6l-.399 1.224a.46.46 0 0 1-.175.232.464.464 0 0 1-.28.088.475.475 0 0 1-.456-.32l-.4-1.224a2.509 2.509 0 0 0-.61-.992 2.487 2.487 0 0 0-.988-.612l-1.223-.4a.48.48 0 0 1 0-.908l1.223-.4c.367-.128.7-.337.975-.612a2.7 2.7 0 0 0 .36-.468c.1-.162.18-.335.24-.516l.4-1.224Z"/></svg>',captionsOn:'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M18.75 4A3.25 3.25 0 0 1 22 7.25v9.505a3.25 3.25 0 0 1-3.25 3.25H5.25A3.25 3.25 0 0 1 2 16.755V7.25a3.25 3.25 0 0 1 3.066-3.245L5.25 4h13.5Zm0 1.5H5.25l-.144.006A1.75 1.75 0 0 0 3.5 7.25v9.505c0 .966.784 1.75 1.75 1.75h13.5a1.75 1.75 0 0 0 1.75-1.75V7.25a1.75 1.75 0 0 0-1.75-1.75ZM5.5 12c0-3.146 2.713-4.775 5.122-3.401A.75.75 0 0 1 9.878 9.9C8.481 9.104 7 9.994 7 12c0 2.005 1.484 2.896 2.88 2.103a.75.75 0 0 1 .74 1.304C8.216 16.775 5.5 15.143 5.5 12Zm7.5 0c0-3.146 2.713-4.775 5.122-3.401a.75.75 0 0 1-.744 1.302C15.981 9.104 14.5 9.994 14.5 12c0 2.005 1.484 2.896 2.88 2.103a.75.75 0 0 1 .74 1.304C15.716 16.775 13 15.143 13 12Z" fill="currentColor"/></svg>',captionsOff:'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M3.28 2.22a.75.75 0 0 0-1.06 1.06l1.25 1.25A3.247 3.247 0 0 0 2 7.25v9.505a3.25 3.25 0 0 0 3.25 3.25h13.5c.063 0 .126-.002.188-.006l1.781 1.781a.75.75 0 0 0 1.061-1.06L3.28 2.22Zm14.164 16.284H5.25a1.75 1.75 0 0 1-1.75-1.75V7.25c0-.727.443-1.35 1.074-1.615l2.828 2.828C6.292 9.043 5.5 10.3 5.5 12c0 3.143 2.715 4.775 5.12 3.406a.75.75 0 0 0-.74-1.303C8.483 14.896 7 14.005 7 12c0-1.37.69-2.22 1.573-2.366l8.87 8.87Zm2.986-1.256c.045-.157.07-.322.07-.494V7.25a1.75 1.75 0 0 0-1.75-1.75H8.682L7.182 4H18.75A3.25 3.25 0 0 1 22 7.25v9.505c0 .593-.159 1.148-.436 1.627l-1.134-1.134Zm-5.877-5.877-1.197-1.197c.813-1.888 2.882-2.65 4.766-1.575a.75.75 0 0 1-.744 1.302c-1.241-.708-2.549-.085-2.825 1.47Z" fill="currentColor"/></svg>',play:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M8 5v14l11-7z" /></svg>',pause:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M6 4 H9 V20 H6 Z" /><path d="M15 4 H18 V20 H15 Z" /></svg>',fastForward:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 24" fill="currentColor"><path d="M4 5v14l11-7-11-7zm13 0v14l11-7-11-7z"/></svg>',minimize:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M21.778 2.223a.75.75 0 0 1 .072.976l-.072.084-6.223 6.224h5.693a.75.75 0 0 1 .743.65l.007.1a.75.75 0 0 1-.649.744l-.101.007-7.55-.002-.016-.002a.727.727 0 0 1-.195-.042l-.098-.046a.747.747 0 0 1-.386-.553l-.007-.105V2.754a.75.75 0 0 1 1.493-.102l.007.102v5.69l6.222-6.221a.749.749 0 0 1 1.06 0ZM11.003 13.755v7.504a.75.75 0 0 1-1.494.102l-.007-.102v-5.695L3.28 21.78a.75.75 0 0 1-1.133-.977l.073-.084 6.22-6.214H2.751a.75.75 0 0 1-.743-.648L2 13.755a.75.75 0 0 1 .75-.75l7.554.002.074.009.097.023.053.019.086.04.089.058a.761.761 0 0 1 .148.148l.066.106.041.094.022.07.01.055.007.058v-.008l.005.076Z" fill="currentColor"/></svg>',maximize:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12.748 3.001h7.554l.1.014.099.028.061.026a.72.72 0 0 1 .218.15l.04.044.061.082.037.065.039.09.02.064.013.064.009.093v7.534a.75.75 0 0 1-1.493.102l-.006-.102-.001-5.696-13.94 13.945h5.69a.75.75 0 0 1 .744.65l.007.1a.75.75 0 0 1-.649.744l-.101.007H3.714L3.684 21a.705.705 0 0 1-.187-.04l-.09-.038-.018-.01a.746.746 0 0 1-.384-.553l-.007-.105V12.75a.75.75 0 0 1 1.493-.102l.007.102v5.692L18.438 4.5l-5.69.001a.75.75 0 0 1-.743-.648l-.007-.102a.75.75 0 0 1 .648-.743L12.748 3Z" fill="currentColor"/></svg>'},G8e={get:(t,e,n)=>(...r)=>{try{return Reflect.get(t,e,n).apply(t,r)}catch{return null}}};let Vye;try{Vye=new Proxy(localStorage,G8e)}catch{Vye=new Proxy({},G8e)}const bQ=Vye,JEe="rtk-prefs",vSs=(t,e)=>{const n=JSON.parse(bQ.getItem(JEe)||"{}");n[t]=JSON.stringify(e),bQ.setItem("rtk-prefs",JSON.stringify(n))},ySs=t=>JSON.parse(bQ.getItem(JEe)||"{}")[t],BIn=()=>{const t=JSON.parse(bQ.getItem(JEe)||"{}"),e=t["mirror-video"]?t["mirror-video"]==="true":!0,n=t["mute-notification-sounds"]?t["mute-notification-sounds"]==="true":!1;return{mirrorVideo:e,muteNotificationSounds:n}},bSs={},UIn={disableEmojiPicker:!1,disablePrivateChat:!1},dyt=t=>({meeting:"idle",prefs:BIn(),peerId:t||"LEGACY_GLOBAL_PEER"}),P7=cyt({meeting:null,t:OIn(),iconPack:FIn,states:dyt(),config:ayt(),peerId:"global",storeType:"global",storeId:"store-global",overrides:UIn}),Hye=new Map;P7.elementsMap=Hye;P7.use({set:(t,e)=>{const n=Hye.get(t);n&&Hye.set(t,n.filter(r=>r[t]!==e?(r[t]=e,!0):!1))}});P7.state;function xSs({meeting:t,config:e,providerId:n,iconPack:r,t:s,overrides:i}){const o=cyt({meeting:t,t:s,iconPack:r,states:dyt(t.self.peerId),config:e||ayt(),peerId:t.self.id,storeType:"peer",storeId:"store-"+n.replace("provider-",""),overrides:i}),l=new Map;return o.elementsMap=l,o.use({set:(c,d)=>{const u=l.get(c);u&&l.set(c,u.filter(h=>h[c]!==d?(h[c]=d,!0):!1))}}),o}function wSs(t,e,n=P7){const r=n.elementsMap;if(!r){console.error("appendElement: No elementsMap found on store",n);return}const s=r.get(t);if(s)try{zIn(t,e,n),s.push(e)}catch(i){console.error("appendElement: Error adding element:",i)}else try{r.set(t,[e])}catch(i){console.error("appendElement: Error setting new array:",i)}}function zIn(t,e,n=P7){const r=n.elementsMap;if(!r){console.error("removeElement: No elementsMap found on store",n);return}const s=r.get(t);if(s){const i=s.indexOf(e);i>-1&&s.splice(i,1)}}const VIn=[0,.5,1,1.5,2,3,4,5,6,7,8,9,10,12,14,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96],HIn={darkest:{background:{1e3:"#080808",900:"#1A1A1A",800:"#1E1E1E",700:"#2C2C2C",600:"#393939"},text:"#FFFFFF"},dark:{background:{1e3:"#252525",900:"#2F2F2F",800:"#323232",700:"#3E3E3E",600:"#4A4A4A"},text:"#F5F5F5","video-bg":"#1C1C1C"},light:{background:{1e3:"#FFFFFF",900:"#F5F5F5",800:"#EBEBEB",700:"#E0E0E0",600:"#D6D6D6"},text:"#111111","text-on-brand":"#ffffff","video-bg":"#DADADA"}},W8e={none:{none:0,sm:0,md:0,lg:0},thin:{none:0,sm:1,md:2,lg:4},fat:{none:0,sm:2,md:4,lg:8}},q8e={sharp:{none:0,sm:0,md:0,lg:0},rounded:{none:0,sm:4,md:8,lg:12},"extra-rounded":{none:0,sm:8,md:16,lg:24},circular:{none:9999,sm:9999,md:9999,lg:9999}};function xce(t){t=t.trim();let e="0",n="0",r="0";return t.length==4?(e="0x"+t[1]+t[1],n="0x"+t[2]+t[2],r="0x"+t[3]+t[3]):t.length>6&&(e="0x"+t[1]+t[2],n="0x"+t[3]+t[4],r="0x"+t[5]+t[6]),[+e,+n,+r]}const kSs=t=>typeof t=="string"&&t.length===7&&t.startsWith("#"),RI="--rtk-";function df(t,e=RI){return e+t}const GIn=t=>{const e=[400,500,700],n=[];if(document.querySelector("link[data-rtk-font]")==null){const s=document.createElement("link");s.rel="preconnect",s.setAttribute("data-rtk-font","true"),s.href="https://fonts.googleapis.com";const i=s.cloneNode(!0);i.href="https://fonts.gstatic.com",i.crossOrigin="",n.push(s,i)}const r=document.createElement("link");r.rel="stylesheet",r.setAttribute("data-rtk-font",t),r.href=encodeURI(`https://fonts.googleapis.com/css2?family=${t}:wght@${e.join(";")}&display=swap`),n.push(r),document.head.append(...n)},WIn=(t,e,n=RI)=>{VIn.forEach(r=>{t.style.setProperty(df(`space-${r}`,n),`${r*e}px`)})},qIn=(t,e,n=RI)=>{if(e in W8e){const r=W8e[e];Object.keys(r).forEach(s=>{t.style.setProperty(df(`border-width-${s}`,n),`${r[s]}px`)})}},KIn=(t,e,n=RI)=>{if(e in q8e){const r=q8e[e];Object.keys(r).forEach(s=>{t.style.setProperty(df(`border-radius-${s}`,n),`${r[s]}px`)})}},K8e=(t,e,n=RI)=>{Object.keys(e).forEach(r=>{const s=e[r];if(typeof s=="string")if(r==="text"||r==="text-on-brand"){const i=xce(s).join(" ");t.style.setProperty(df(`colors-${r}-1000`,n),`${i}`),t.style.setProperty(df(`colors-${r}-900`,n),`${i} / 0.88`),t.style.setProperty(df(`colors-${r}-800`,n),`${i} / 0.76`),t.style.setProperty(df(`colors-${r}-700`,n),`${i} / 0.64`),t.style.setProperty(df(`colors-${r}-600`,n),`${i} / 0.52`)}else{const i=xce(s).join(" ");t.style.setProperty(df(`colors-${r}`,n),i)}else typeof s=="object"&&Object.keys(s).forEach(i=>{const o=s[i],l=xce(o).join(" ");t.style.setProperty(df(`colors-${r}-${i}`,n),l)})})},SSs=(t,{spacingBase:e,borderRadius:n,borderWidth:r,colors:s,fontFamily:i,googleFont:o,theme:l,tokenPrefix:c=RI})=>{if(typeof t!="object")throw new Error("[rtk-ui-kit] (provideRtkDesignSystem): Passed element is not a valid HTML Element");if(typeof o=="string"&&(GIn(o),t.style.setProperty(df("font-family",c),o)),typeof i=="string"&&t.style.setProperty(df("font-family",c),i),typeof e=="number"&&WIn(t,e,c),typeof r=="string"&&qIn(t,r,c),typeof n=="string"&&KIn(t,n,c),typeof l=="string"){const d=HIn[l];d!=null&&K8e(t,d,c)}typeof s=="object"&&K8e(t,s,c)};function uyt(t){return t}function YIn(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var QIn=800,ZIn=16,JIn=Date.now;function XIn(t){var e=0,n=0;return function(){var r=JIn(),s=ZIn-(r-n);if(n=r,s>0){if(++e>=QIn)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function eMn(t){return function(){return t}}var tMn=yQ?function(t,e){return yQ(t,"toString",{configurable:!0,enumerable:!1,value:eMn(e),writable:!0})}:uyt;const nMn=tMn;var rMn=XIn(nMn);const sMn=rMn;var Y8e=Math.max;function iMn(t,e,n){return e=Y8e(e===void 0?t.length-1:e,0),function(){for(var r=arguments,s=-1,i=Y8e(r.length-e,0),o=Array(i);++s<i;)o[s]=r[e+s];s=-1;for(var l=Array(e+1);++s<e;)l[s]=r[s];return l[e]=n(o),YIn(t,this,l)}}function aMn(t,e){return sMn(iMn(t,e,uyt),t+"")}function oMn(t,e,n){if(!SS(n))return!1;var r=typeof e;return(r=="number"?nne(n)&&zvt(e,n.length):r=="string"&&e in n)?tne(n[e],t):!1}function lMn(t){return aMn(function(e,n){var r=-1,s=n.length,i=s>1?n[s-1]:void 0,o=s>2?n[2]:void 0;for(i=t.length>3&&typeof i=="function"?(s--,i):void 0,o&&oMn(n[0],n[1],o)&&(i=s<3?void 0:i,s=1),e=Object(e);++r<s;){var l=n[r];l&&t(e,l,r,i)}return e})}var cMn="[object Object]",dMn=Function.prototype,uMn=Object.prototype,hyt=dMn.toString,hMn=uMn.hasOwnProperty,mMn=hyt.call(Object);function fMn(t){if(!UE(t)||AI(t)!=cMn)return!1;var e=Jvt(t);if(e===null)return!0;var n=hMn.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&hyt.call(n)==mMn}function pMn(t){return function(e,n,r){for(var s=-1,i=Object(e),o=r(e),l=o.length;l--;){var c=o[++s];if(n(i[c],c,i)===!1)break}return e}}var gMn=pMn();const vMn=gMn;function Gye(t,e,n){(n!==void 0&&!tne(t[e],n)||n===void 0&&!(e in t))&&WEe(t,e,n)}function yMn(t){return UE(t)&&nne(t)}function Wye(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}function bMn(t){return jPn(t,Zvt(t))}function xMn(t,e,n,r,s,i,o){var l=Wye(t,n),c=Wye(e,n),d=o.get(c);if(d){Gye(t,n,d);return}var u=i?i(l,c,n+"",t,e,o):void 0,h=u===void 0;if(h){var m=d6(c),f=!m&&KEe(c),p=!m&&!f&&Kvt(c);u=c,m||f||p?d6(l)?u=l:yMn(l)?u=yPn(l):f?(h=!1,u=eyt(c,!0)):p?(h=!1,u=tyt(c,!0)):u=[]:fMn(c)||Fye(c)?(u=l,Fye(l)?u=bMn(l):(!SS(l)||GEe(l))&&(u=nyt(c))):h=!1}h&&(o.set(c,u),s(u,c,r,i,o),o.delete(c)),Gye(t,n,u)}function myt(t,e,n,r,s){t!==e&&vMn(e,function(i,o){if(s||(s=new HE),SS(i))xMn(t,e,o,n,myt,r,s);else{var l=r?r(Wye(t,o),i,o+"",t,e,s):void 0;l===void 0&&(l=i),Gye(t,o,l)}},Zvt)}var wMn=lMn(function(t,e,n){myt(t,e,n)});const CSs=wMn,kMn=t=>t.toLowerCase().split("-").map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(""),fyt=t=>t.replace(/([A-Z])/g,e=>`-${e[0].toLowerCase()}`),SMn=(t,e,n={})=>{if(t instanceof Element){const r=CMn(t.classList,e,n);r!==""&&(t.className=r),Object.keys(e).forEach(s=>{if(!(s==="children"||s==="style"||s==="ref"||s==="class"||s==="className"||s==="forwardedRef"))if(s.indexOf("on")===0&&s[2]===s[2].toUpperCase()){const i=s.substring(2),o=i[0].toLowerCase()+i.substring(1);pyt(o)||EMn(t,o,e[s])}else t[s]=e[s],typeof e[s]==="string"&&t.setAttribute(fyt(s),e[s])})}},CMn=(t,e,n)=>{const r=e.className||e.class,s=n.className||n.class,i=wce(t),o=wce(r?r.split(" "):[]),l=wce(s?s.split(" "):[]),c=[];return i.forEach(d=>{o.has(d)?(c.push(d),o.delete(d)):l.has(d)||c.push(d)}),o.forEach(d=>c.push(d)),c.join(" ")},jMn=t=>{switch(t){case"doubleclick":return"dblclick"}return t};/**
 * Checks if an event is supported in the current execution environment.
 * @license Modernizr 3.0.0pre (Custom Build) | MIT
 */const pyt=t=>{if(typeof document>"u")return!0;{const e="on"+jMn(t);let n=e in document;if(!n){const r=document.createElement("div");r.setAttribute(e,"return;"),n=typeof r[e]=="function"}return n}},EMn=(t,e,n)=>{const r=t.__events||(t.__events={}),s=r[e];s&&t.removeEventListener(e,s),t.addEventListener(e,r[e]=function(o){n&&n.call(this,o)})},wce=t=>{const e=new Map;return t.forEach(n=>e.set(n,n)),e},NMn=(t,e)=>{typeof t=="function"?t(e):t!=null&&(t.current=e)},TMn=(...t)=>e=>{t.forEach(n=>{NMn(n,e)})},_Mn=(t,e)=>{const n=(r,s)=>se.createElement(t,Object.assign({},r,{forwardedRef:s}));return n.displayName=e,se.forwardRef(n)};var AMn=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n};const R7=(t,e,n,r)=>{const s=kMn(t),i=class extends se.Component{constructor(o){super(o),this.setComponentElRef=l=>{this.componentEl=l}}componentDidMount(){this.componentDidUpdate(this.props)}componentDidUpdate(o){SMn(this.componentEl,this.props,o)}render(){const o=this.props,{children:l,forwardedRef:c,style:d,className:u,ref:h}=o,m=AMn(o,["children","forwardedRef","style","className","ref"]);let f=Object.keys(m).reduce((g,v)=>{const b=m[v];if(v.indexOf("on")===0&&v[2]===v[2].toUpperCase()){const x=v.substring(2).toLowerCase();typeof document<"u"&&pyt(x)&&(g[v]=b)}else{const x=typeof b;(x==="string"||x==="boolean"||x==="number")&&(g[fyt(v)]=b)}return g},{});const p=Object.assign(Object.assign({},f),{ref:TMn(c,this.setComponentElRef),style:d});return y.createElement(t,p,l)}static get displayName(){return s}};return _Mn(i,s)},xQ="realtimekit-ui",je={allRenderFn:!0,appendChildSlotFix:!1,asyncLoading:!0,asyncQueue:!1,attachStyles:!0,cloneNodeFix:!1,constructableCSS:!0,cssAnnotations:!0,devTools:!1,element:!1,event:!0,experimentalScopedSlotChanges:!1,experimentalSlotFixes:!1,formAssociated:!1,hasRenderFn:!0,hostListener:!0,hostListenerTarget:!0,hostListenerTargetBody:!1,hostListenerTargetDocument:!1,hostListenerTargetParent:!1,hostListenerTargetWindow:!0,hotModuleReplacement:!1,hydrateClientSide:!1,hydrateServerSide:!1,hydratedAttribute:!1,hydratedClass:!0,hydratedSelectorName:"hydrated",initializeNextTick:!1,invisiblePrehydration:!0,isDebug:!1,isDev:!1,isTesting:!1,lazyLoad:!0,lifecycle:!0,lifecycleDOMEvents:!1,member:!0,method:!0,mode:!1,modernPropertyDecls:!1,observeAttribute:!0,profile:!1,prop:!0,propBoolean:!0,propMutable:!0,propNumber:!0,propString:!0,reflect:!0,scoped:!1,scopedSlotTextContentFix:!1,scriptDataOpts:!1,shadowDelegatesFocus:!0,shadowDom:!0,slot:!0,slotChildNodesFix:!1,slotRelocation:!0,state:!0,style:!0,svg:!1,taskQueue:!0,transformTagName:!1,updatable:!0,vdomAttribute:!0,vdomClass:!0,vdomFunctional:!0,vdomKey:!0,vdomListener:!0,vdomPropOrAttr:!0,vdomRef:!0,vdomRender:!0,vdomStyle:!0,vdomText:!0,vdomXlink:!0,watchCallback:!0},PMn={};var RMn=Object.defineProperty,IMn=(t,e)=>{for(var n in e)RMn(t,n,{get:e[n],enumerable:!0})},wQ={isDev:!!je.isDev,isBrowser:!0,isServer:!1,isTesting:!!je.isTesting},MMn="http://www.w3.org/2000/svg",LMn="http://www.w3.org/1999/xhtml",gyt=(t,e)=>{var n;const r=e.$cmpMeta$;Object.entries((n=r.$members$)!=null?n:{}).map(([i,[o]])=>{if((je.state||je.prop)&&(o&31||o&32)){const l=t[i],c=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),i);Object.defineProperty(t,i,{get(){return c.get.call(this)},set(d){c.set.call(this,d)},configurable:!0,enumerable:!0}),t[i]=e.$instanceValues$.has(i)?e.$instanceValues$.get(i):l}})},Sl=t=>{if(t.__stencil__getHostRef)return t.__stencil__getHostRef()},kt=(t,e)=>{t.__stencil__getHostRef=()=>e,e.$lazyInstance$=t,je.modernPropertyDecls&&(je.state||je.prop)&&gyt(t,e)},XEe=(t,e)=>{const n={$flags$:0,$hostElement$:t,$cmpMeta$:e,$instanceValues$:new Map};je.isDev&&(n.$renderCount$=0),je.method&&je.lazyLoad&&(n.$onInstancePromise$=new Promise(s=>n.$onInstanceResolve$=s)),je.asyncLoading&&(n.$onReadyPromise$=new Promise(s=>n.$onReadyResolve$=s),t["s-p"]=[],t["s-rc"]=[]);const r=n;return t.__stencil__getHostRef=()=>r,!je.lazyLoad&&je.modernPropertyDecls&&(je.state||je.prop)&&gyt(t,n),r},qye=(t,e)=>e in t,vyt,mn=(t,e)=>(vyt||console.error)(t,e),ine=je.isTesting?["STENCIL:"]:["%cstencil","color: white;background:#4c47ff;font-weight: bold; font-size:10px; padding:2px 6px; border-radius: 5px"],m6=(...t)=>console.error(...ine,...t),NR=(...t)=>console.warn(...ine,...t),DMn=(...t)=>console.info(...ine,...t),$Mn=t=>vyt=t,MW=new Map,yyt=(t,e,n)=>{const r=t.$tagName$.replace(/-/g,"_"),s=t.$lazyBundleId$;if(je.isDev&&typeof s!="string"){m6(`Trying to lazily load component <${t.$tagName$}> with style mode "${e.$modeName$}", but it does not exist.`);return}else if(!s)return;const i=je.hotModuleReplacement?!1:MW.get(s);if(i)return i[r];if(!n||!je.hotModuleReplacement){const o=l=>(MW.set(s,l),l[r]);switch(s){case"rtk-avatar_26":return Promise.resolve().then(function(){return G8n}).then(o,mn);case"rtk-ai-toggle":return Promise.resolve().then(function(){return K8n}).then(o,mn);case"rtk-audio-grid":return Promise.resolve().then(function(){return Z8n}).then(o,mn);case"rtk-audio-tile":return Promise.resolve().then(function(){return r7n}).then(o,mn);case"rtk-breakout-rooms-toggle":return Promise.resolve().then(function(){return a7n}).then(o,mn);case"rtk-camera-toggle":return Promise.resolve().then(function(){return c7n}).then(o,mn);case"rtk-caption-toggle":return Promise.resolve().then(function(){return h7n}).then(o,mn);case"rtk-chat-composer-ui":return Promise.resolve().then(function(){return p7n}).then(o,mn);case"rtk-chat-messages-ui":return Promise.resolve().then(function(){return y7n}).then(o,mn);case"rtk-chat-search-results":return Promise.resolve().then(function(){return w7n}).then(o,mn);case"rtk-chat-selector-ui":return Promise.resolve().then(function(){return C7n}).then(o,mn);case"rtk-chat-toggle":return Promise.resolve().then(function(){return T7n}).then(o,mn);case"rtk-clock":return Promise.resolve().then(function(){return P7n}).then(o,mn);case"rtk-controlbar":return Promise.resolve().then(function(){return M7n}).then(o,mn);case"rtk-debugger-toggle":return Promise.resolve().then(function(){return $7n}).then(o,mn);case"rtk-dialog-manager":return Promise.resolve().then(function(){return B7n}).then(o,mn);case"rtk-ended-screen":return Promise.resolve().then(function(){return V7n}).then(o,mn);case"rtk-file-dropzone":return Promise.resolve().then(function(){return W7n}).then(o,mn);case"rtk-grid":return Promise.resolve().then(function(){return ZBn}).then(o,mn);case"rtk-grid-pagination":return Promise.resolve().then(function(){return e9n}).then(o,mn);case"rtk-header":return Promise.resolve().then(function(){return r9n}).then(o,mn);case"rtk-idle-screen":return Promise.resolve().then(function(){return a9n}).then(o,mn);case"rtk-image-viewer":return Promise.resolve().then(function(){return c9n}).then(o,mn);case"rtk-information-tooltip":return Promise.resolve().then(function(){return m9n}).then(o,mn);case"rtk-leave-button":return Promise.resolve().then(function(){return g9n}).then(o,mn);case"rtk-livestream-toggle":return Promise.resolve().then(function(){return b9n}).then(o,mn);case"rtk-meeting-title":return Promise.resolve().then(function(){return k9n}).then(o,mn);case"rtk-message-list-view":return Promise.resolve().then(function(){return N9n}).then(o,mn);case"rtk-mic-toggle":return Promise.resolve().then(function(){return A9n}).then(o,mn);case"rtk-mixed-grid":return Promise.resolve().then(function(){return I9n}).then(o,mn);case"rtk-more-toggle":return Promise.resolve().then(function(){return D9n}).then(o,mn);case"rtk-mute-all-button":return Promise.resolve().then(function(){return F9n}).then(o,mn);case"rtk-network-indicator":return Promise.resolve().then(function(){return z9n}).then(o,mn);case"rtk-notifications":return Promise.resolve().then(function(){return K9n}).then(o,mn);case"rtk-participant-count":return Promise.resolve().then(function(){return Z9n}).then(o,mn);case"rtk-participant-setup":return Promise.resolve().then(function(){return eUn}).then(o,mn);case"rtk-participants":return Promise.resolve().then(function(){return rUn}).then(o,mn);case"rtk-participants-audio":return Promise.resolve().then(function(){return oUn}).then(o,mn);case"rtk-participants-toggle":return Promise.resolve().then(function(){return dUn}).then(o,mn);case"rtk-pip-toggle":return Promise.resolve().then(function(){return mUn}).then(o,mn);case"rtk-plugins-toggle":return Promise.resolve().then(function(){return gUn}).then(o,mn);case"rtk-polls-toggle":return Promise.resolve().then(function(){return bUn}).then(o,mn);case"rtk-recording-indicator":return Promise.resolve().then(function(){return kUn}).then(o,mn);case"rtk-recording-toggle":return Promise.resolve().then(function(){return jUn}).then(o,mn);case"rtk-screen-share-toggle":return Promise.resolve().then(function(){return TUn}).then(o,mn);case"rtk-screenshare-view":return Promise.resolve().then(function(){return PUn}).then(o,mn);case"rtk-settings":return Promise.resolve().then(function(){return MUn}).then(o,mn);case"rtk-settings-toggle":return Promise.resolve().then(function(){return $Un}).then(o,mn);case"rtk-setup-screen":return Promise.resolve().then(function(){return BUn}).then(o,mn);case"rtk-sidebar":return Promise.resolve().then(function(){return VUn}).then(o,mn);case"rtk-simple-grid":return Promise.resolve().then(function(){return WUn}).then(o,mn);case"rtk-spotlight-grid":return Promise.resolve().then(function(){return YUn}).then(o,mn);case"rtk-stage":return Promise.resolve().then(function(){return JUn}).then(o,mn);case"rtk-stage-toggle":return Promise.resolve().then(function(){return rzn}).then(o,mn);case"rtk-transcripts":return Promise.resolve().then(function(){return azn}).then(o,mn);case"rtk-ui-provider":return Promise.resolve().then(function(){return dzn}).then(o,mn);case"rtk-waiting-screen":return Promise.resolve().then(function(){return mzn}).then(o,mn);case"rtk-ai_3":return Promise.resolve().then(function(){return xzn}).then(o,mn);case"rtk-breakout-rooms-manager_9":return Promise.resolve().then(function(){return Bzn}).then(o,mn);case"rtk-chat-message":return Promise.resolve().then(function(){return Vzn}).then(o,mn);case"rtk-livestream-indicator_3":return Promise.resolve().then(function(){return tKn}).then(o,mn);case"rtk-name-tag":return Promise.resolve().then(function(){return sKn}).then(o,mn);case"rtk-notification":return Promise.resolve().then(function(){return hKn}).then(o,mn);case"rtk-participants-stage-list_4":return Promise.resolve().then(function(){return wKn}).then(o,mn);case"rtk-plugin-main_2":return Promise.resolve().then(function(){return EKn}).then(o,mn);case"rtk-settings-audio_2":return Promise.resolve().then(function(){return PKn}).then(o,mn);case"rtk-transcript":return Promise.resolve().then(function(){return LKn}).then(o,mn);case"rtk-ai-transcriptions":return Promise.resolve().then(function(){return OKn}).then(o,mn);case"rtk-audio-visualizer_4":return Promise.resolve().then(function(){return qKn}).then(o,mn);case"rtk-breakout-room-manager_3":return Promise.resolve().then(function(){return eYn}).then(o,mn);case"rtk-debugger-audio_4":return Promise.resolve().then(function(){return hYn}).then(o,mn);case"rtk-dialog":return Promise.resolve().then(function(){return pYn}).then(o,mn);case"rtk-file-message_3":return Promise.resolve().then(function(){return yYn}).then(o,mn);case"rtk-fullscreen-toggle":return Promise.resolve().then(function(){return wYn}).then(o,mn);case"rtk-participant_2":return Promise.resolve().then(function(){return EYn}).then(o,mn);case"rtk-camera-selector_2":return Promise.resolve().then(function(){return PYn}).then(o,mn);case"rtk-poll_2":return Promise.resolve().then(function(){return DYn}).then(o,mn);case"rtk-sidebar-ui":return Promise.resolve().then(function(){return BYn}).then(o,mn);case"rtk-spotlight-indicator":return Promise.resolve().then(function(){return VYn}).then(o,mn);case"rtk-logo":return Promise.resolve().then(function(){return WYn}).then(o,mn);case"rtk-controlbar-button":return Promise.resolve().then(function(){return QYn}).then(o,mn)}}return wn(()=>import(`./${s}.entry.js${je.hotModuleReplacement&&n?"?s-hmr="+n:""}`),[]).then(o=>(je.hotModuleReplacement||MW.set(s,o),o[r]),o=>{mn(o,e.$hostElement$)})},TR=new Map,eNe=[],byt="r",xyt="o",wyt="s",tNe="t",kyt="c",_R="s-id",l$="sty-id",AR="c-id",OMn="{visibility:hidden}.hydrated{visibility:inherit}",Q8e="_stencilDocData",FMn={hostIds:0,rootLevelIds:0,staticComponents:new Set},Syt="slot-fb{display:contents}slot-fb[hidden]{display:none}",Z8e="http://www.w3.org/1999/xlink",BMn=["formAssociatedCallback","formResetCallback","formDisabledCallback","formStateRestoreCallback"],Vs=typeof window<"u"?window:{},J8e=Vs.HTMLElement||class{},vs={$flags$:0,$resourcesUrl$:"",jmp:t=>t(),raf:t=>requestAnimationFrame(t),ael:(t,e,n,r)=>t.addEventListener(e,n,r),rel:(t,e,n,r)=>t.removeEventListener(e,n,r),ce:(t,e)=>new CustomEvent(t,e)},UMn=t=>{Object.assign(vs,t)},s0=je.shadowDom,Cyt=(()=>{var t;let e=!1;try{(t=Vs.document)==null||t.addEventListener("e",null,Object.defineProperty({},"passive",{get(){e=!0}}))}catch{}return e})(),jyt=t=>Promise.resolve(t),nNe=je.constructableCSS?(()=>{try{return new CSSStyleSheet,typeof new CSSStyleSheet().replaceSync=="function"}catch{}return!1})():!1,kce=0,kQ=!1,LW=[],OC=[],Sce=[],Eyt=(t,e)=>n=>{t.push(n),kQ||(kQ=!0,e&&vs.$flags$&4?I7(SQ):vs.raf(SQ))},X8e=t=>{for(let e=0;e<t.length;e++)try{t[e](performance.now())}catch(n){mn(n)}t.length=0},e7e=(t,e)=>{let n=0,r=0;for(;n<t.length&&(r=performance.now())<e;)try{t[n++](r)}catch(s){mn(s)}n===t.length?t.length=0:n!==0&&t.splice(0,n)},SQ=()=>{if(je.asyncQueue&&kce++,X8e(LW),je.asyncQueue){const t=(vs.$flags$&6)===2?performance.now()+14*Math.ceil(kce*.1):1/0;e7e(OC,t),e7e(Sce,t),OC.length>0&&(Sce.push(...OC),OC.length=0),(kQ=LW.length+OC.length+Sce.length>0)?vs.raf(SQ):kce=0}else X8e(OC),(kQ=LW.length>0)&&vs.raf(SQ)},I7=t=>jyt().then(t),zMn=Eyt(LW,!1),Dc=Eyt(OC,!0),VMn=t=>{const e=new URL(t,vs.$resourcesUrl$);return e.origin!==Vs.location.origin?e.href:e.pathname},HMn=t=>vs.$resourcesUrl$=t,GMn=t=>t!=null&&t!==void 0,rNe=t=>(t=typeof t,t==="object"||t==="function");function Nyt(t){var e,n,r;return(r=(n=(e=t.head)==null?void 0:e.querySelector('meta[name="csp-nonce"]'))==null?void 0:n.getAttribute("content"))!=null?r:void 0}var WMn=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),qMn={};IMn(qMn,{err:()=>Tyt,map:()=>KMn,ok:()=>Kye,unwrap:()=>YMn,unwrapErr:()=>QMn});var Kye=t=>({isOk:!0,isErr:!1,value:t}),Tyt=t=>({isOk:!1,isErr:!0,value:t});function KMn(t,e){if(t.isOk){const n=e(t.value);return n instanceof Promise?n.then(r=>Kye(r)):Kye(n)}if(t.isErr){const n=t.value;return Tyt(n)}throw"should never get here"}var YMn=t=>{if(t.isOk)return t.value;throw t.value},QMn=t=>{if(t.isErr)return t.value;throw t.value},ane=t=>{const e=mh(t,"childNodes");t.tagName&&t.tagName.includes("-")&&t["s-cr"]&&t.tagName!=="SLOT-FB"&&M7(e,t.tagName).forEach(r=>{r.nodeType===1&&r.tagName==="SLOT-FB"&&(sNe(r,II(r),!1).length?r.hidden=!0:r.hidden=!1)});let n=0;for(n=0;n<e.length;n++){const r=e[n];r.nodeType===1&&mh(r,"childNodes").length&&ane(r)}},f6=t=>{const e=[];for(let n=0;n<t.length;n++){const r=t[n]["s-nr"]||void 0;r&&r.isConnected&&e.push(r)}return e};function M7(t,e,n){let r=0,s=[],i;for(;r<t.length;r++){if(i=t[r],i["s-sr"]&&(!e||i["s-hn"]===e)&&(n===void 0||II(i)===n)&&(s.push(i),typeof n<"u"))return s;s=[...s,...M7(i.childNodes,e,n)]}return s}var sNe=(t,e,n=!0)=>{const r=[];(n&&t["s-sr"]||!t["s-sr"])&&r.push(t);let s=t;for(;s=s.nextSibling;)II(s)===e&&(n||!s["s-sr"])&&r.push(s);return r},t7e=(t,e)=>t.nodeType===1?t.getAttribute("slot")===null&&e===""||t.getAttribute("slot")===e:t["s-sn"]===e?!0:e==="",one=(t,e,n,r)=>{if(t["s-ol"]&&t["s-ol"].isConnected)return;const s=document.createTextNode("");if(s["s-nr"]=t,!e["s-cr"]||!e["s-cr"].parentNode)return;const i=e["s-cr"].parentNode,o=n?mh(i,"prepend"):mh(i,"appendChild");if(je.hydrateClientSide&&typeof r<"u"){s["s-oo"]=r;const l=mh(i,"childNodes"),c=[s];l.forEach(d=>{d["s-nr"]&&c.push(d)}),c.sort((d,u)=>!d["s-oo"]||d["s-oo"]<(u["s-oo"]||0)?-1:!u["s-oo"]||u["s-oo"]<d["s-oo"]?1:0),c.forEach(d=>o.call(i,d))}else o.call(i,s);t["s-ol"]=s,t["s-sh"]=e["s-hn"]},II=t=>typeof t["s-sn"]=="string"?t["s-sn"]:t.nodeType===1&&t.getAttribute("slot")||void 0;function _yt(t){if(t.assignedElements||t.assignedNodes||!t["s-sr"])return;const e=n=>(function(r){const s=[],i=this["s-sn"];r!=null&&r.flatten&&console.error(`
          Flattening is not supported for Stencil non-shadow slots. 
          You can use \`.childNodes\` to nested slot fallback content.
          If you have a particular use case, please open an issue on the Stencil repo.
        `);const o=this["s-cr"].parentElement;return(o.__childNodes?o.childNodes:f6(o.childNodes)).forEach(c=>{i===II(c)&&s.push(c)}),n?s.filter(c=>c.nodeType===1):s}).bind(t);t.assignedElements=e(!0),t.assignedNodes=e(!1)}function lne(t){t.dispatchEvent(new CustomEvent("slotchange",{bubbles:!1,cancelable:!1,composed:!1}))}function iNe(t,e){var n;if(e=e||((n=t["s-ol"])==null?void 0:n.parentElement),!e)return{slotNode:null,slotName:""};const r=t["s-sn"]=II(t)||"",s=mh(e,"childNodes");return{slotNode:M7(s,e.tagName,r)[0],slotName:r}}var Ayt=t=>{aNe(t),oNe(t),XMn(t),JMn(t),rLn(t),eLn(t),tLn(t),nLn(t),lNe(t),cNe(t),ZMn(t)},aNe=t=>{const e=t.cloneNode;t.cloneNode=function(n){const r=this,s=je.shadowDom?r.shadowRoot&&s0:!1,i=e.call(r,s?n:!1);if(je.slot&&!s&&n){let o=0,l,c;const d=["s-id","s-cr","s-lr","s-rc","s-sc","s-p","s-cn","s-sr","s-sn","s-hn","s-ol","s-nr","s-si","s-rf","s-scs"],u=this.__childNodes||this.childNodes;for(;o<u.length;o++)l=u[o]["s-nr"],c=d.every(h=>!u[o][h]),l&&(je.appendChildSlotFix&&i.__appendChild?i.__appendChild(l.cloneNode(!0)):i.appendChild(l.cloneNode(!0))),c&&i.appendChild(u[o].cloneNode(!0))}return i}},oNe=t=>{t.__appendChild=t.appendChild,t.appendChild=function(e){const{slotName:n,slotNode:r}=iNe(e,this);if(r){one(e,r);const s=sNe(r,n),i=s[s.length-1],o=mh(i,"parentNode"),l=mh(o,"insertBefore")(e,i.nextSibling);return lne(r),ane(this),l}return this.__appendChild(e)}},ZMn=t=>{t.__removeChild=t.removeChild,t.removeChild=function(e){if(e&&typeof e["s-sn"]<"u"){const n=this.__childNodes||this.childNodes;if(M7(n,this.tagName,e["s-sn"])&&e.isConnected){e.remove(),ane(this);return}}return this.__removeChild(e)}},JMn=t=>{t.__prepend=t.prepend,t.prepend=function(...e){e.forEach(n=>{typeof n=="string"&&(n=this.ownerDocument.createTextNode(n));const r=(n["s-sn"]=II(n))||"",s=mh(this,"childNodes"),i=M7(s,this.tagName,r)[0];if(i){one(n,i,!0);const l=sNe(i,r)[0],c=mh(l,"parentNode"),d=mh(c,"insertBefore")(n,mh(l,"nextSibling"));return lne(i),d}return n.nodeType===1&&n.getAttribute("slot")&&(n.hidden=!0),t.__prepend(n)})}},XMn=t=>{t.__append=t.append,t.append=function(...e){e.forEach(n=>{typeof n=="string"&&(n=this.ownerDocument.createTextNode(n)),this.appendChild(n)})}},eLn=t=>{const e=t.insertAdjacentHTML;t.insertAdjacentHTML=function(n,r){if(n!=="afterbegin"&&n!=="beforeend")return e.call(this,n,r);const s=this.ownerDocument.createElement("_");let i;if(s.innerHTML=r,n==="afterbegin")for(;i=s.firstChild;)this.prepend(i);else if(n==="beforeend")for(;i=s.firstChild;)this.append(i)}},tLn=t=>{t.insertAdjacentText=function(e,n){this.insertAdjacentHTML(e,n)}},nLn=t=>{const e=t;e.__insertBefore||(e.__insertBefore=t.insertBefore,t.insertBefore=function(n,r){const{slotName:s,slotNode:i}=iNe(n,this),o=this.__childNodes?this.childNodes:f6(this.childNodes);if(i){let c=!1;if(o.forEach(d=>{if(d===r||r===null){if(c=!0,r===null||s!==r["s-sn"]){this.appendChild(n);return}if(s===r["s-sn"]){one(n,i);const u=mh(r,"parentNode");mh(u,"insertBefore")(n,r),lne(i)}return}}),c)return n}const l=r==null?void 0:r.__parentNode;return l&&!this.isSameNode(l)?this.appendChild(n):this.__insertBefore(n,r)})},rLn=t=>{const e=t.insertAdjacentElement;t.insertAdjacentElement=function(n,r){return n!=="afterbegin"&&n!=="beforeend"?e.call(this,n,r):n==="afterbegin"?(this.prepend(r),r):(n==="beforeend"&&this.append(r),r)}},lNe=t=>{ty("textContent",t),Object.defineProperty(t,"textContent",{get:function(){let e="";return(this.__childNodes?this.childNodes:f6(this.childNodes)).forEach(r=>e+=r.textContent||""),e},set:function(e){(this.__childNodes?this.childNodes:f6(this.childNodes)).forEach(r=>{r["s-ol"]&&r["s-ol"].remove(),r.remove()}),this.insertAdjacentHTML("beforeend",e)}})},cNe=t=>{class e extends Array{item(r){return this[r]}}ty("children",t),Object.defineProperty(t,"children",{get(){return this.childNodes.filter(n=>n.nodeType===1)}}),Object.defineProperty(t,"childElementCount",{get(){return this.children.length}}),ty("firstChild",t),Object.defineProperty(t,"firstChild",{get(){return this.childNodes[0]}}),ty("lastChild",t),Object.defineProperty(t,"lastChild",{get(){return this.childNodes[this.childNodes.length-1]}}),ty("childNodes",t),Object.defineProperty(t,"childNodes",{get(){const n=new e;return n.push(...f6(this.__childNodes)),n}})},sLn=t=>{!t||t.__nextSibling!==void 0||!globalThis.Node||(iLn(t),oLn(t),Pyt(t),t.nodeType===Node.ELEMENT_NODE&&(aLn(t),lLn(t)))},iLn=t=>{!t||t.__nextSibling||(ty("nextSibling",t),Object.defineProperty(t,"nextSibling",{get:function(){var e;const n=(e=this["s-ol"])==null?void 0:e.parentNode.childNodes,r=n==null?void 0:n.indexOf(this);return n&&r>-1?n[r+1]:this.__nextSibling}}))},aLn=t=>{!t||t.__nextElementSibling||(ty("nextElementSibling",t),Object.defineProperty(t,"nextElementSibling",{get:function(){var e;const n=(e=this["s-ol"])==null?void 0:e.parentNode.children,r=n==null?void 0:n.indexOf(this);return n&&r>-1?n[r+1]:this.__nextElementSibling}}))},oLn=t=>{!t||t.__previousSibling||(ty("previousSibling",t),Object.defineProperty(t,"previousSibling",{get:function(){var e;const n=(e=this["s-ol"])==null?void 0:e.parentNode.childNodes,r=n==null?void 0:n.indexOf(this);return n&&r>-1?n[r-1]:this.__previousSibling}}))},lLn=t=>{!t||t.__previousElementSibling||(ty("previousElementSibling",t),Object.defineProperty(t,"previousElementSibling",{get:function(){var e;const n=(e=this["s-ol"])==null?void 0:e.parentNode.children,r=n==null?void 0:n.indexOf(this);return n&&r>-1?n[r-1]:this.__previousElementSibling}}))},Pyt=t=>{!t||t.__parentNode||(ty("parentNode",t),Object.defineProperty(t,"parentNode",{get:function(){var e;return((e=this["s-ol"])==null?void 0:e.parentNode)||this.__parentNode},set:function(e){this.__parentNode=e}}))},cLn=["children","nextElementSibling","previousElementSibling"],dLn=["childNodes","firstChild","lastChild","nextSibling","previousSibling","textContent","parentNode"];function ty(t,e){let n;cLn.includes(t)?n=Object.getOwnPropertyDescriptor(Element.prototype,t):dLn.includes(t)&&(n=Object.getOwnPropertyDescriptor(Node.prototype,t)),n||(n=Object.getOwnPropertyDescriptor(e,t)),n&&Object.defineProperty(e,"__"+t,n)}function mh(t,e){if("__"+e in t){const n=t["__"+e];return typeof n!="function"?n:n.bind(t)}else return typeof t[e]!="function"?t[e]:t[e].bind(t)}var uLn=0,Py=(t,e="")=>{if(je.profile&&performance.mark){const n=`st:${t}:${e}:${uLn++}`;return performance.mark(n),()=>performance.measure(`[Stencil] ${t}() <${e}>`,n)}else return()=>{}},hLn=(t,e)=>je.profile&&performance.mark?(performance.getEntriesByName(t,"mark").length===0&&performance.mark(t),()=>{performance.getEntriesByName(e,"measure").length===0&&performance.measure(e,t)}):()=>{},mLn=t=>{const e=Sl(t);if(!e)return;const n=e.$flags$,r=e.$hostElement$;return{renderCount:e.$renderCount$,flags:{hasRendered:!!(n&2),hasConnected:!!(n&1),isWaitingForChildren:!!(n&4),isConstructingInstance:!!(n&8),isQueuedForUpdate:!!(n&16),hasInitializedComponent:!!(n&32),hasLoadedComponent:!!(n&64),isWatchReady:!!(n&128),isListenReady:!!(n&256),needsRerender:!!(n&512)},instanceValues:e.$instanceValues$,ancestorComponent:e.$ancestorComponent$,hostElement:r,lazyInstance:e.$lazyInstance$,vnode:e.$vnode$,modeName:e.$modeName$,onReadyPromise:e.$onReadyPromise$,onReadyResolve:e.$onReadyResolve$,onInstancePromise:e.$onInstancePromise$,onInstanceResolve:e.$onInstanceResolve$,onRenderResolve:e.$onRenderResolve$,queuedListeners:e.$queuedListeners$,rmListeners:e.$rmListeners$,"s-id":r["s-id"],"s-cr":r["s-cr"],"s-lr":r["s-lr"],"s-p":r["s-p"],"s-rc":r["s-rc"],"s-sc":r["s-sc"]}},fLn=()=>{if(je.devTools){const t=Vs.stencil=Vs.stencil||{},e=t.inspect;t.inspect=n=>{let r=mLn(n);return!r&&typeof e=="function"&&(r=e(n)),r}}},$=(t,e,...n)=>{let r=null,s=null,i=null,o=!1,l=!1;const c=[],d=h=>{for(let m=0;m<h.length;m++)r=h[m],Array.isArray(r)?d(r):r!=null&&typeof r!="boolean"&&((o=typeof t!="function"&&!rNe(r))?r=String(r):je.isDev&&typeof t!="function"&&r.$flags$===void 0&&m6(`vNode passed as children has unexpected type.
Make sure it's using the correct h() function.
Empty objects can also be the cause, look for JSX comments that became objects.`),o&&l?c[c.length-1].$text$+=r:c.push(o?PR(null,r):r),l=o)};if(d(n),e&&(je.isDev&&t==="input"&&vLn(e),je.vdomKey&&e.key&&(s=e.key),je.slotRelocation&&e.name&&(i=e.name),je.vdomClass)){const h=e.className||e.class;h&&(e.class=typeof h!="object"?h:Object.keys(h).filter(m=>h[m]).join(" "))}if(je.isDev&&c.some(Yye)&&m6(`The <Host> must be the single root component. Make sure:
- You are NOT using hostData() and <Host> in the same component.
- <Host> is used once, and it's the single root component of the render() function.`),je.vdomFunctional&&typeof t=="function")return t(e===null?{}:e,c,pLn);const u=PR(t,null);return u.$attrs$=e,c.length>0&&(u.$children$=c),je.vdomKey&&(u.$key$=s),je.slotRelocation&&(u.$name$=i),u},PR=(t,e)=>{const n={$flags$:0,$tag$:t,$text$:e,$elm$:null,$children$:null};return je.vdomAttribute&&(n.$attrs$=null),je.vdomKey&&(n.$key$=null),je.slotRelocation&&(n.$name$=null),n},mt={},Yye=t=>t&&t.$tag$===mt,pLn={forEach:(t,e)=>t.map(n7e).forEach(e),map:(t,e)=>t.map(n7e).map(e).map(gLn)},n7e=t=>({vattrs:t.$attrs$,vchildren:t.$children$,vkey:t.$key$,vname:t.$name$,vtag:t.$tag$,vtext:t.$text$}),gLn=t=>{if(typeof t.vtag=="function"){const n={...t.vattrs};return t.vkey&&(n.key=t.vkey),t.vname&&(n.name=t.vname),$(t.vtag,n,...t.vchildren||[])}const e=PR(t.vtag,t.vtext);return e.$attrs$=t.vattrs,e.$children$=t.vchildren,e.$key$=t.vkey,e.$name$=t.vname,e},vLn=t=>{const e=Object.keys(t),n=e.indexOf("value");if(n===-1)return;const r=e.indexOf("type"),s=e.indexOf("min"),i=e.indexOf("max"),o=e.indexOf("step");(n<r||n<s||n<i||n<o)&&NR('The "value" prop of <input> should be set after "min", "max", "type" and "step"')},yLn=(t,e,n,r)=>{const s=Py("hydrateClient",e),i=t.shadowRoot,o=[],l=[],c=[],d=je.shadowDom&&i?[]:null,u=PR(e,null);u.$elm$=t;let h;if(je.scoped){const C=r.$cmpMeta$;C&&C.$flags$&10&&t["s-sc"]?(h=t["s-sc"],t.classList.add(h+"-h")):t["s-sc"]&&delete t["s-sc"]}Vs.document&&(!vs.$orgLocNodes$||!vs.$orgLocNodes$.size)&&Zye(Vs.document.body,vs.$orgLocNodes$=new Map),t[_R]=n,t.removeAttribute(_R),r.$vnode$=Qye(u,o,l,d,t,t,n,c);let m=0;const f=o.length;let p;for(m;m<f;m++){p=o[m];const C=p.$hostId$+"."+p.$nodeId$,j=vs.$orgLocNodes$.get(C),E=p.$elm$;i||(E["s-hn"]=e.toUpperCase(),p.$tag$==="slot"&&(E["s-cr"]=t["s-cr"])),p.$tag$==="slot"&&(p.$name$=p.$elm$["s-sn"]||p.$elm$.name||null,p.$children$?(p.$flags$|=2,p.$elm$.childNodes.length||p.$children$.forEach(N=>{p.$elm$.appendChild(N.$elm$)})):p.$flags$|=1),j&&j.isConnected&&(i&&j["s-en"]===""&&j.parentNode.insertBefore(E,j.nextSibling),j.parentNode.removeChild(j),i||(E["s-oo"]=parseInt(p.$nodeId$))),vs.$orgLocNodes$.delete(C)}const g=[],v=c.length;let b=0,x,w,k,S;for(b;b<v;b++)if(x=c[b],!(!x||!x.length))for(k=x.length,w=0,w;w<k;w++){if(S=x[w],g[S.hostId]||(g[S.hostId]=vs.$orgLocNodes$.get(S.hostId)),!g[S.hostId])continue;const C=g[S.hostId];(!C.shadowRoot||!i)&&(S.slot["s-cr"]=C["s-cr"],!S.slot["s-cr"]&&C.shadowRoot?S.slot["s-cr"]=C:S.slot["s-cr"]=(C.__childNodes||C.childNodes)[0],one(S.node,S.slot,!1,S.node["s-oo"]),je.experimentalSlotFixes&&sLn(S.node)),C.shadowRoot&&S.node.parentElement!==C&&C.appendChild(S.node)}if(je.scoped&&h&&l.length&&l.forEach(C=>{C.$elm$.parentElement.classList.add(h+"-s")}),je.shadowDom&&i&&!i.childNodes.length){let C=0;const j=d.length;if(j){for(C;C<j;C++)i.appendChild(d[C]);Array.from(t.childNodes).forEach(E=>{typeof E["s-sn"]!="string"&&(E.nodeType===1&&E.slot&&E.hidden?E.removeAttribute("hidden"):(E.nodeType===8||E.nodeType===3&&!E.wholeText.trim())&&E.parentNode.removeChild(E))})}}vs.$orgLocNodes$.delete(t["s-id"]),r.$hostElement$=t,s()},Qye=(t,e,n,r,s,i,o,l=[])=>{let c,d,u,h;const m=s["s-sc"];if(i.nodeType===1){if(c=i.getAttribute(AR),c&&(d=c.split("."),d[0]===o||d[0]==="0")){u=r7e({$flags$:0,$hostId$:d[0],$nodeId$:d[1],$depth$:d[2],$index$:d[3],$tag$:i.tagName.toLowerCase(),$elm$:i,$attrs$:{class:i.className||""}}),e.push(u),i.removeAttribute(AR),t.$children$||(t.$children$=[]),je.scoped&&m&&(i["s-si"]=m,u.$attrs$.class+=" "+m);const p=u.$elm$.getAttribute("s-sn");typeof p=="string"&&(u.$tag$==="slot-fb"&&(s7e(p,d[2],u,i,t,e,n,r,l),je.scoped&&m&&i.classList.add(m)),u.$elm$["s-sn"]=p,u.$elm$.removeAttribute("s-sn")),u.$index$!==void 0&&(t.$children$[u.$index$]=u),t=u,r&&u.$depth$==="0"&&(r[u.$index$]=u.$elm$)}if(i.shadowRoot)for(h=i.shadowRoot.childNodes.length-1;h>=0;h--)Qye(t,e,n,r,s,i.shadowRoot.childNodes[h],o,l);const f=i.__childNodes||i.childNodes;for(h=f.length-1;h>=0;h--)Qye(t,e,n,r,s,f[h],o,l)}else if(i.nodeType===8){if(d=i.nodeValue.split("."),d[1]===o||d[1]==="0"){if(c=d[0],u=r7e({$hostId$:d[1],$nodeId$:d[2],$depth$:d[3],$index$:d[4]||"0",$elm$:i,$attrs$:null,$children$:null,$key$:null,$name$:null,$tag$:null,$text$:null}),c===tNe)u.$elm$=a7e(i,3),u.$elm$&&u.$elm$.nodeType===3&&(u.$text$=u.$elm$.textContent,e.push(u),i.remove(),o===u.$hostId$&&(t.$children$||(t.$children$=[]),t.$children$[u.$index$]=u),r&&u.$depth$==="0"&&(r[u.$index$]=u.$elm$));else if(c===kyt)u.$elm$=a7e(i,8),u.$elm$&&u.$elm$.nodeType===8&&(e.push(u),i.remove());else if(u.$hostId$===o)if(c===wyt){const f=i["s-sn"]=d[5]||"";s7e(f,d[2],u,i,t,e,n,r,l)}else c===byt&&(je.shadowDom&&r?i.remove():je.slotRelocation&&(s["s-cr"]=i,i["s-cn"]=!0))}}else if(t&&t.$tag$==="style"){const f=PR(null,i.textContent);f.$elm$=i,f.$index$="0",t.$children$=[f]}else i.nodeType===3&&!i.wholeText.trim()&&i.remove();return t},Zye=(t,e)=>{if(t.nodeType===1){const n=t[_R]||t.getAttribute(_R);n&&e.set(n,t);let r=0;if(t.shadowRoot)for(;r<t.shadowRoot.childNodes.length;r++)Zye(t.shadowRoot.childNodes[r],e);const s=t.__childNodes||t.childNodes;for(r=0;r<s.length;r++)Zye(s[r],e)}else if(t.nodeType===8){const n=t.nodeValue.split(".");n[0]===xyt&&(e.set(n[1]+"."+n[2],t),t.nodeValue="",t["s-en"]=n[3])}},r7e=t=>({...{$flags$:0,$hostId$:null,$nodeId$:null,$depth$:null,$index$:"0",$elm$:null,$attrs$:null,$children$:null,$key$:null,$name$:null,$tag$:null,$text$:null},...t});function s7e(t,e,n,r,s,i,o,l,c){r["s-sr"]=!0,n.$name$=t||null,n.$tag$="slot";const d=s!=null&&s.$elm$?s.$elm$["s-id"]||s.$elm$.getAttribute("s-id"):"";if(je.shadowDom&&l&&Vs.document){const u=n.$elm$=Vs.document.createElement(n.$tag$);n.$name$&&n.$elm$.setAttribute("name",t),d&&d!==n.$hostId$?s.$elm$.insertBefore(u,s.$elm$.children[0]):r.parentNode.insertBefore(n.$elm$,r),i7e(c,e,t,r,n.$hostId$),r.remove(),n.$depth$==="0"&&(l[n.$index$]=n.$elm$)}else{const u=n.$elm$,h=d&&d!==n.$hostId$&&s.$elm$.shadowRoot;i7e(c,e,t,r,h?d:n.$hostId$),_yt(r),h&&s.$elm$.insertBefore(u,s.$elm$.children[0]),i.push(n)}o.push(n),s.$children$||(s.$children$=[]),s.$children$[n.$index$]=n}var i7e=(t,e,n,r,s)=>{let i=r.nextSibling;for(t[e]=t[e]||[];i&&((i.getAttribute&&i.getAttribute("slot")||i["s-sn"])===n||n===""&&!i["s-sn"]&&(i.nodeType===8&&i.nodeValue.indexOf(".")!==1||i.nodeType===3));)i["s-sn"]=n,t[e].push({slot:r,node:i,hostId:s}),i=i.nextSibling},a7e=(t,e)=>{let n=t;do n=n.nextSibling;while(n&&(n.nodeType!==e||!n.nodeValue));return n};/**
 * @license
 * Copyright Google Inc. All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://angular.io/license
 *
 * This file is a port of shadowCSS from `webcomponents.js` to TypeScript.
 * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
 * https://github.com/angular/angular/blob/master/packages/compiler/src/shadow_css.ts
 */var bLn=t=>{const e=[];let n=0;return t=t.replace(/(\[[^\]]*\])/g,(i,o)=>{const l=`__ph-${n}__`;return e.push(o),n++,l}),{content:t.replace(/(:nth-[-\w]+)(\([^)]+\))/g,(i,o,l)=>{const c=`__ph-${n}__`;return e.push(l),n++,o+c}),placeholders:e}},xLn=(t,e)=>e.replace(/__ph-(\d+)__/g,(n,r)=>t[+r]),L7="-shadowcsshost",Ryt="-shadowcssslotted",Iyt="-shadowcsscontext",dNe=")(?:\\(((?:\\([^)(]*\\)|[^)(]*)+?)\\))?([^,{]*)",wLn=new RegExp("("+L7+dNe,"gim"),kLn=new RegExp("("+Iyt+dNe,"gim"),SLn=new RegExp("("+Ryt+dNe,"gim"),Cj=L7+"-no-combinator",CLn=/-shadowcsshost-no-combinator([^\s]*)/,jLn=[/::shadow/g,/::content/g],ELn="([>\\s~+[.,{:][\\s\\S]*)?$",DW=/-shadowcsshost/gim,uNe=t=>new RegExp(`((?<!(^@supports(.*)))|(?<={.*))(${t}\\b)`,"gim"),NLn=uNe("::slotted"),TLn=uNe(":host"),_Ln=uNe(":host-context"),ALn=/\/\*\s*[\s\S]*?\*\//g,PLn=t=>t.replace(ALn,""),RLn=/\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g,ILn=t=>t.match(RLn)||[],MLn=/(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g,LLn=/([{}])/g,DLn=/(^.*?[^\\])??((:+)(.*)|$)/,$Ln="{",OLn="}",CQ="%BLOCK%",Jye=(t,e)=>{const n=FLn(t);let r=0;return n.escapedString.replace(MLn,(...s)=>{const i=s[2];let o="",l=s[4],c="";l&&l.startsWith("{"+CQ)&&(o=n.blocks[r++],l=l.substring(CQ.length+1),c="{");const u=e({selector:i,content:o});return`${s[1]}${u.selector}${s[3]}${c}${u.content}${l}`})},FLn=t=>{const e=t.split(LLn),n=[],r=[];let s=0,i=[];for(let l=0;l<e.length;l++){const c=e[l];c===OLn&&s--,s>0?i.push(c):(i.length>0&&(r.push(i.join("")),n.push(CQ),i=[]),n.push(c)),c===$Ln&&s++}return i.length>0&&(r.push(i.join("")),n.push(CQ)),{escapedString:n.join(""),blocks:r}},BLn=t=>(t=t.replace(_Ln,`$1${Iyt}`).replace(TLn,`$1${L7}`).replace(NLn,`$1${Ryt}`),t),Myt=(t,e,n)=>t.replace(e,(...r)=>{if(r[2]){const s=r[2].split(","),i=[];for(let o=0;o<s.length;o++){const l=s[o].trim();if(!l)break;i.push(n(Cj,l,r[3]))}return i.join(",")}else return Cj+r[3]}),Lyt=(t,e,n)=>t+e.replace(L7,"")+n,ULn=t=>Myt(t,wLn,Lyt),zLn=(t,e,n)=>e.indexOf(L7)>-1?Lyt(t,e,n):t+e+n+", "+e+" "+t+n,VLn=(t,e)=>{const n="."+e+" > ",r=[];return t=t.replace(SLn,(...s)=>{if(s[2]){const i=s[2].trim(),o=s[3],l=n+i+o;let c="";for(let h=s[4]-1;h>=0;h--){const m=s[5][h];if(m==="}"||m===",")break;c=m+c}const d=(c+l).trim(),u=`${c.trimEnd()}${l.trim()}`.trim();if(d!==u){const h=`${u}, ${d}`;r.push({orgSelector:d,updatedSelector:h})}return l}else return Cj+s[3]}),{selectors:r,cssText:t}},HLn=t=>Myt(t,kLn,zLn),GLn=t=>jLn.reduce((e,n)=>e.replace(n," "),t),WLn=t=>{const e=/\[/g,n=/\]/g;return t=t.replace(e,"\\[").replace(n,"\\]"),new RegExp("^("+t+")"+ELn,"m")},qLn=(t,e)=>!WLn(e).test(t),Dyt=(t,e)=>t.replace(DLn,(n,r="",s,i="",o="")=>r+e+i+o),KLn=(t,e,n)=>{if(DW.lastIndex=0,DW.test(t)){const r=`.${n}`;return t.replace(CLn,(s,i)=>Dyt(i,r)).replace(DW,r+" ")}return e+" "+t},YLn=(t,e,n)=>{const r=/\[is=([^\]]*)\]/g;e=e.replace(r,(p,...g)=>g[0]);const s="."+e,i=p=>{let g=p.trim();if(!g)return"";if(p.indexOf(Cj)>-1)g=KLn(p,e,n);else{const v=p.replace(DW,"");v.length>0&&(g=Dyt(v,s))}return g},o=bLn(t);t=o.content;let l="",c=0,d;const u=/( |>|\+|~(?!=))\s*/g;let m=!(t.indexOf(Cj)>-1);for(;(d=u.exec(t))!==null;){const p=d[1],g=t.slice(c,d.index).trim();m=m||g.indexOf(Cj)>-1;const v=m?i(g):g;l+=`${v} ${p} `,c=u.lastIndex}const f=t.substring(c);return m=m||f.indexOf(Cj)>-1,l+=m?i(f):f,xLn(o.placeholders,l)},QLn=(t,e,n,r)=>t.split(",").map(s=>r&&s.indexOf("."+r)>-1?s.trim():qLn(s,e)?YLn(s,e,n).trim():s.trim()).join(", "),$yt=(t,e,n,r,s)=>Jye(t,i=>{let o=i.selector,l=i.content;return i.selector[0]!=="@"?o=QLn(i.selector,e,n,r):(i.selector.startsWith("@media")||i.selector.startsWith("@supports")||i.selector.startsWith("@page")||i.selector.startsWith("@document"))&&(l=$yt(i.content,e,n,r)),{selector:o.replace(/\s{2,}/g," ").trim(),content:l}}),ZLn=(t,e,n,r,s)=>{t=BLn(t),t=ULn(t),t=HLn(t);const i=VLn(t,r);return t=i.cssText,t=GLn(t),e&&(t=$yt(t,e,n,r)),t=Cce(t,n),t=t.replace(/>\s*\*\s+([^{, ]+)/gm," $1 "),{cssText:t.trim(),slottedSelectors:i.selectors.map(o=>({orgSelector:Cce(o.orgSelector,n),updatedSelector:Cce(o.updatedSelector,n)}))}},Cce=(t,e)=>t.replace(/-shadowcsshost-no-combinator/g,`.${e}`),JLn=(t,e,n)=>{const r=e+"-h",s=e+"-s",i=ILn(t);t=PLn(t);const o=[];{const c=d=>{const u=`/*!@___${o.length}___*/`,h=`/*!@${d.selector}*/`;return o.push({placeholder:u,comment:h}),d.selector=u+d.selector,d};t=Jye(t,d=>d.selector[0]!=="@"?c(d):((d.selector.startsWith("@media")||d.selector.startsWith("@supports")||d.selector.startsWith("@page")||d.selector.startsWith("@document"))&&(d.content=Jye(d.content,c)),d))}const l=ZLn(t,e,r,s);return t=[l.cssText,...i].join(`
`),o.forEach(({placeholder:c,comment:d})=>{t=t.replace(c,d)}),l.slottedSelectors.forEach(c=>{const d=new RegExp(WMn(c.orgSelector),"g");t=t.replace(d,c.updatedSelector)}),t},Oyt=t=>eNe.map(e=>e(t)).find(e=>!!e),XLn=t=>eNe.push(t),e3n=t=>Sl(t).$modeName$,jQ=(t,e)=>t!=null&&!rNe(t)?je.propBoolean&&e&4?t==="false"?!1:t===""||!!t:je.propNumber&&e&2?parseFloat(t):je.propString&&e&1?String(t):t:t,Pl=t=>je.lazyLoad?Sl(t).$hostElement$:t,Wt=(t,e,n)=>{const r=Pl(t);return{emit:s=>(je.isDev&&!r.isConnected&&NR(`The "${e}" event was emitted, but the dispatcher node is no longer connected to the dom.`),hNe(r,e,{bubbles:!!(n&4),composed:!!(n&2),cancelable:!!(n&1),detail:s}))}},hNe=(t,e,n)=>{const r=vs.ce(e,n);return t.dispatchEvent(r),r},mA=new WeakMap,mNe=(t,e,n)=>{let r=TR.get(t);nNe&&n?(r=r||new CSSStyleSheet,typeof r=="string"?r=e:r.replaceSync(e)):r=e,TR.set(t,r)},Xye=(t,e,n)=>{var r;const s=cne(e,n),i=TR.get(s);if(!je.attachStyles||!Vs.document)return s;if(t=t.nodeType===11?t:Vs.document,i)if(typeof i=="string"){t=t.head||t;let o=mA.get(t),l;if(o||mA.set(t,o=new Set),!o.has(s)){if(je.hydrateClientSide&&t.host&&(l=t.querySelector(`[${l$}="${s}"]`)))l.innerHTML=i;else{l=document.querySelector(`[${l$}="${s}"]`)||Vs.document.createElement("style"),l.innerHTML=i;const c=(r=vs.$nonce$)!=null?r:Nyt(Vs.document);if(c!=null&&l.setAttribute("nonce",c),(je.hydrateServerSide||je.hotModuleReplacement)&&(e.$flags$&2||e.$flags$&128)&&l.setAttribute(l$,s),!(e.$flags$&1))if(t.nodeName==="HEAD"){const d=t.querySelectorAll("link[rel=preconnect]"),u=d.length>0?d[d.length-1].nextSibling:t.querySelector("style");t.insertBefore(l,(u==null?void 0:u.parentNode)===t?u:null)}else if("host"in t)if(nNe){const d=new CSSStyleSheet;d.replaceSync(i),t.adoptedStyleSheets=[d,...t.adoptedStyleSheets]}else{const d=t.querySelector("style");d?d.innerHTML=i+d.innerHTML:t.prepend(l)}else t.append(l);e.$flags$&1&&t.insertBefore(l,null)}e.$flags$&4&&(l.innerHTML+=Syt),o&&o.add(s)}}else je.constructableCSS&&!t.adoptedStyleSheets.includes(i)&&(t.adoptedStyleSheets=[...t.adoptedStyleSheets,i]);return s},Fyt=t=>{const e=t.$cmpMeta$,n=t.$hostElement$,r=e.$flags$,s=Py("attachStyles",e.$tagName$),i=Xye(je.shadowDom&&s0&&n.shadowRoot?n.shadowRoot:n.getRootNode(),e,t.$modeName$);(je.shadowDom||je.scoped)&&je.cssAnnotations&&(r&10&&r&2||r&128)&&(n["s-sc"]=i,n.classList.add(i+"-h")),s()},cne=(t,e)=>"sc-"+(je.mode&&e&&t.$flags$&32?t.$tagName$+"-"+e:t.$tagName$),t3n=t=>t.replace(/\/\*!@([^\/]+)\*\/[^\{]+\{/g,"$1{"),Byt=()=>{if(!Vs.document)return;const t=Vs.document.querySelectorAll(`[${l$}]`);let e=0;for(;e<t.length;e++)mNe(t[e].getAttribute(l$),t3n(t[e].innerHTML),!0)},o7e=(t,e,n,r,s,i,o)=>{if(n===r)return;let l=qye(t,e),c=e.toLowerCase();if(je.vdomClass&&e==="class"){const d=t.classList,u=l7e(n);let h=l7e(r);je.hydrateClientSide&&t["s-si"]&&o?(h.push(t["s-si"]),u.forEach(m=>{m.startsWith(t["s-si"])&&h.push(m)}),h=[...new Set(h)],d.add(...h)):(d.remove(...u.filter(m=>m&&!h.includes(m))),d.add(...h.filter(m=>m&&!u.includes(m))))}else if(je.vdomStyle&&e==="style"){if(je.updatable)for(const d in n)(!r||r[d]==null)&&(!je.hydrateServerSide&&d.includes("-")?t.style.removeProperty(d):t.style[d]="");for(const d in r)(!n||r[d]!==n[d])&&(!je.hydrateServerSide&&d.includes("-")?t.style.setProperty(d,r[d]):t.style[d]=r[d])}else if(!(je.vdomKey&&e==="key")){if(je.vdomRef&&e==="ref")r&&r(t);else if(je.vdomListener&&(je.lazyLoad?!l:!t.__lookupSetter__(e))&&e[0]==="o"&&e[1]==="n"){if(e[2]==="-"?e=e.slice(3):qye(Vs,c)?e=c.slice(2):e=c[2]+e.slice(3),n||r){const d=e.endsWith(Uyt);e=e.replace(r3n,""),n&&vs.rel(t,e,n,d),r&&vs.ael(t,e,r,d)}}else if(je.vdomPropOrAttr){const d=rNe(r);if((l||d&&r!==null)&&!s)try{if(t.tagName.includes("-"))t[e]!==r&&(t[e]=r);else{const h=r??"";e==="list"?l=!1:(n==null||t[e]!=h)&&(typeof t.__lookupSetter__(e)=="function"?t[e]=h:t.setAttribute(e,h))}}catch{}let u=!1;je.vdomXlink&&c!==(c=c.replace(/^xlink\:?/,""))&&(e=c,u=!0),r==null||r===!1?(r!==!1||t.getAttribute(e)==="")&&(je.vdomXlink&&u?t.removeAttributeNS(Z8e,e):t.removeAttribute(e)):(!l||i&4||s)&&!d&&t.nodeType===1&&(r=r===!0?"":r,je.vdomXlink&&u?t.setAttributeNS(Z8e,e,r):t.setAttribute(e,r))}}},n3n=/\s/,l7e=t=>(typeof t=="object"&&t&&"baseVal"in t&&(t=t.baseVal),!t||typeof t!="string"?[]:t.split(n3n)),Uyt="Capture",r3n=new RegExp(Uyt+"$"),ebe=(t,e,n,r)=>{const s=e.$elm$.nodeType===11&&e.$elm$.host?e.$elm$.host:e.$elm$,i=t&&t.$attrs$||{},o=e.$attrs$||{};if(je.updatable)for(const l of c7e(Object.keys(i)))l in o||o7e(s,l,i[l],void 0,n,e.$flags$,r);for(const l of c7e(Object.keys(o)))o7e(s,l,i[l],o[l],n,e.$flags$,r)};function c7e(t){return t.includes("ref")?[...t.filter(e=>e!=="ref"),"ref"]:t}var $W,EQ,Ex,c$=!1,NQ=!1,dne=!1,ih=!1,TQ=(t,e,n)=>{var r;const s=e.$children$[n];let i=0,o,l,c;if(je.slotRelocation&&!c$&&(dne=!0,s.$tag$==="slot"&&(s.$flags$|=s.$children$?2:1)),je.isDev&&s.$elm$&&m6(`The JSX ${s.$text$!==null?`"${s.$text$}" text`:`"${s.$tag$}" element`} node should not be shared within the same renderer. The renderer caches element lookups in order to improve performance. However, a side effect from this is that the exact same JSX node should not be reused. For more information please see https://stenciljs.com/docs/templating-jsx#avoid-shared-jsx-nodes`),je.vdomText&&s.$text$!==null)o=s.$elm$=Vs.document.createTextNode(s.$text$);else if(je.slotRelocation&&s.$flags$&1)o=s.$elm$=je.isDebug||je.hydrateServerSide?i3n(s):Vs.document.createTextNode(""),je.vdomAttribute&&ebe(null,s,ih);else{if(je.svg&&!ih&&(ih=s.$tag$==="svg"),!Vs.document)throw new Error("You are trying to render a Stencil component in an environment that doesn't support the DOM. Make sure to populate the [`window`](https://developer.mozilla.org/en-US/docs/Web/API/Window/window) object before rendering a component.");if(o=s.$elm$=je.svg?Vs.document.createElementNS(ih?MMn:LMn,!c$&&je.slotRelocation&&s.$flags$&2?"slot-fb":s.$tag$):Vs.document.createElement(!c$&&je.slotRelocation&&s.$flags$&2?"slot-fb":s.$tag$),je.svg&&ih&&s.$tag$==="foreignObject"&&(ih=!1),je.vdomAttribute&&ebe(null,s,ih),je.scoped&&GMn($W)&&o["s-si"]!==$W&&o.classList.add(o["s-si"]=$W),s.$children$)for(i=0;i<s.$children$.length;++i)l=TQ(t,s,i),l&&o.appendChild(l);je.svg&&(s.$tag$==="svg"?ih=!1:o.tagName==="foreignObject"&&(ih=!0))}return o["s-hn"]=Ex,je.slotRelocation&&s.$flags$&3&&(o["s-sr"]=!0,o["s-cr"]=EQ,o["s-sn"]=s.$name$||"",o["s-rf"]=(r=s.$attrs$)==null?void 0:r.ref,_yt(o),c=t&&t.$children$&&t.$children$[n],c&&c.$tag$===s.$tag$&&t.$elm$&&(je.experimentalSlotFixes?zyt(t.$elm$):p6(t.$elm$,!1)),je.scoped&&qyt(EQ,o,e.$elm$,t==null?void 0:t.$elm$)),o},zyt=t=>{vs.$flags$|=1;const e=t.closest(Ex.toLowerCase());if(e!=null){const n=Array.from(e.__childNodes||e.childNodes).find(s=>s["s-cr"]),r=Array.from(t.__childNodes||t.childNodes);for(const s of n?r.reverse():r)s["s-sh"]!=null&&(jf(e,s,n??null),s["s-sh"]=void 0,dne=!0)}vs.$flags$&=-2},p6=(t,e)=>{vs.$flags$|=1;const n=Array.from(t.__childNodes||t.childNodes);if(t["s-sr"]&&je.experimentalSlotFixes){let r=t;for(;r=r.nextSibling;)r&&r["s-sn"]===t["s-sn"]&&r["s-sh"]===Ex&&n.push(r)}for(let r=n.length-1;r>=0;r--){const s=n[r];s["s-hn"]!==Ex&&s["s-ol"]&&(jf(g6(s).parentNode,s,g6(s)),s["s-ol"].remove(),s["s-ol"]=void 0,s["s-sh"]=void 0,dne=!0),e&&p6(s,e)}vs.$flags$&=-2},Vyt=(t,e,n,r,s,i)=>{let o=je.slotRelocation&&t["s-cr"]&&t["s-cr"].parentNode||t,l;for(je.shadowDom&&o.shadowRoot&&o.tagName===Ex&&(o=o.shadowRoot);s<=i;++s)r[s]&&(l=TQ(null,n,s),l&&(r[s].$elm$=l,jf(o,l,je.slotRelocation?g6(e):e)))},Hyt=(t,e,n)=>{for(let r=e;r<=n;++r){const s=t[r];if(s){const i=s.$elm$;Wyt(s),i&&(je.slotRelocation&&(NQ=!0,i["s-ol"]?i["s-ol"].remove():p6(i,!0)),i.remove())}}},s3n=(t,e,n,r,s=!1)=>{let i=0,o=0,l=0,c=0,d=e.length-1,u=e[0],h=e[d],m=r.length-1,f=r[0],p=r[m],g,v;for(;i<=d&&o<=m;)if(u==null)u=e[++i];else if(h==null)h=e[--d];else if(f==null)f=r[++o];else if(p==null)p=r[--m];else if(zz(u,f,s))__(u,f,s),u=e[++i],f=r[++o];else if(zz(h,p,s))__(h,p,s),h=e[--d],p=r[--m];else if(zz(u,p,s))je.slotRelocation&&(u.$tag$==="slot"||p.$tag$==="slot")&&p6(u.$elm$.parentNode,!1),__(u,p,s),jf(t,u.$elm$,h.$elm$.nextSibling),u=e[++i],p=r[--m];else if(zz(h,f,s))je.slotRelocation&&(u.$tag$==="slot"||p.$tag$==="slot")&&p6(h.$elm$.parentNode,!1),__(h,f,s),jf(t,h.$elm$,u.$elm$),h=e[--d],f=r[++o];else{if(l=-1,je.vdomKey){for(c=i;c<=d;++c)if(e[c]&&e[c].$key$!==null&&e[c].$key$===f.$key$){l=c;break}}je.vdomKey&&l>=0?(v=e[l],v.$tag$!==f.$tag$?g=TQ(e&&e[o],n,l):(__(v,f,s),e[l]=void 0,g=v.$elm$),f=r[++o]):(g=TQ(e&&e[o],n,o),f=r[++o]),g&&(je.slotRelocation?jf(g6(u.$elm$).parentNode,g,g6(u.$elm$)):jf(u.$elm$.parentNode,g,u.$elm$))}i>d?Vyt(t,r[m+1]==null?null:r[m+1].$elm$,n,r,o,m):je.updatable&&o>m&&Hyt(e,i,d)},zz=(t,e,n=!1)=>t.$tag$===e.$tag$?je.slotRelocation&&t.$tag$==="slot"?t.$name$===e.$name$:je.vdomKey&&!n?t.$key$===e.$key$:(n&&!t.$key$&&e.$key$&&(t.$key$=e.$key$),!0):!1,g6=t=>t&&t["s-ol"]||t,__=(t,e,n=!1)=>{const r=e.$elm$=t.$elm$,s=t.$children$,i=e.$children$,o=e.$tag$,l=e.$text$;let c;!je.vdomText||l===null?(je.svg&&(ih=o==="svg"?!0:o==="foreignObject"?!1:ih),(je.vdomAttribute||je.reflect)&&(je.slot&&o==="slot"&&!c$&&je.experimentalSlotFixes&&t.$name$!==e.$name$&&(e.$elm$["s-sn"]=e.$name$||"",zyt(e.$elm$.parentElement)),ebe(t,e,ih,n)),je.updatable&&s!==null&&i!==null?s3n(r,s,e,i,n):i!==null?(je.updatable&&je.vdomText&&t.$text$!==null&&(r.textContent=""),Vyt(r,null,e,i,0,i.length-1)):!n&&je.updatable&&s!==null&&Hyt(s,0,s.length-1),je.svg&&ih&&o==="svg"&&(ih=!1)):je.vdomText&&je.slotRelocation&&(c=r["s-cr"])?c.parentNode.textContent=l:je.vdomText&&t.$text$!==l&&(r.data=l)},Gb=[],Gyt=t=>{let e,n,r;const s=t.__childNodes||t.childNodes;for(const i of s){if(i["s-sr"]&&(e=i["s-cr"])&&e.parentNode){n=e.parentNode.__childNodes||e.parentNode.childNodes;const o=i["s-sn"];for(r=n.length-1;r>=0;r--)if(e=n[r],!e["s-cn"]&&!e["s-nr"]&&e["s-hn"]!==i["s-hn"]&&(!je.experimentalSlotFixes||!e["s-sh"]||e["s-sh"]!==i["s-hn"]))if(t7e(e,o)){let l=Gb.find(c=>c.$nodeToRelocate$===e);NQ=!0,e["s-sn"]=e["s-sn"]||o,l?(l.$nodeToRelocate$["s-sh"]=i["s-hn"],l.$slotRefNode$=i):(e["s-sh"]=i["s-hn"],Gb.push({$slotRefNode$:i,$nodeToRelocate$:e})),e["s-sr"]&&Gb.map(c=>{t7e(c.$nodeToRelocate$,e["s-sn"])&&(l=Gb.find(d=>d.$nodeToRelocate$===e),l&&!c.$slotRefNode$&&(c.$slotRefNode$=l.$slotRefNode$))})}else Gb.some(l=>l.$nodeToRelocate$===e)||Gb.push({$nodeToRelocate$:e})}i.nodeType===1&&Gyt(i)}},Wyt=t=>{je.vdomRef&&(t.$attrs$&&t.$attrs$.ref&&t.$attrs$.ref(null),t.$children$&&t.$children$.map(Wyt))},jf=(t,e,n)=>{if(je.scoped&&typeof e["s-sn"]=="string"&&e["s-sr"]&&e["s-cr"])qyt(e["s-cr"],e,t,e.parentElement);else if(je.experimentalSlotFixes&&typeof e["s-sn"]=="string"){t.getRootNode().nodeType!==11&&Pyt(e),t.insertBefore(e,n);const{slotNode:r}=iNe(e);return r&&lne(r),e}return je.experimentalSlotFixes&&t.__insertBefore?t.__insertBefore(e,n):t==null?void 0:t.insertBefore(e,n)};function qyt(t,e,n,r){var s,i;let o;if(t&&typeof e["s-sn"]=="string"&&e["s-sr"]&&t.parentNode&&t.parentNode["s-sc"]&&(o=e["s-si"]||t.parentNode["s-sc"])){const l=e["s-sn"],c=e["s-hn"];if((s=n.classList)==null||s.add(o+"-s"),r&&((i=r.classList)!=null&&i.contains(o+"-s"))){let d=(r.__childNodes||r.childNodes)[0],u=!1;for(;d;){if(d["s-sn"]!==l&&d["s-hn"]===c&&d["s-sr"]){u=!0;break}d=d.nextSibling}u||r.classList.remove(o+"-s")}}}var tbe=(t,e,n=!1)=>{var r,s,i,o,l;const c=t.$hostElement$,d=t.$cmpMeta$,u=t.$vnode$||PR(null,null),h=Yye(e)?e:$(null,null,e);if(Ex=c.tagName,je.isDev&&Array.isArray(e)&&e.some(Yye))throw new Error(`The <Host> must be the single root component.
Looks like the render() function of "${Ex.toLowerCase()}" is returning an array that contains the <Host>.

The render() function should look like this instead:

render() {
  // Do not return an array
  return (
    <Host>{content}</Host>
  );
}
  `);if(je.reflect&&d.$attrsToReflect$&&(h.$attrs$=h.$attrs$||{},d.$attrsToReflect$.map(([m,f])=>h.$attrs$[f]=c[m])),n&&h.$attrs$)for(const m of Object.keys(h.$attrs$))c.hasAttribute(m)&&!["key","ref","style","class"].includes(m)&&(h.$attrs$[m]=c[m]);if(h.$tag$=null,h.$flags$|=4,t.$vnode$=h,h.$elm$=u.$elm$=je.shadowDom&&c.shadowRoot||c,(je.scoped||je.shadowDom)&&($W=c["s-sc"]),c$=s0&&!!(d.$flags$&1)&&!(d.$flags$&128),je.slotRelocation&&(EQ=c["s-cr"],NQ=!1),__(u,h,n),je.slotRelocation){if(vs.$flags$|=1,dne){Gyt(h.$elm$);for(const m of Gb){const f=m.$nodeToRelocate$;if(!f["s-ol"]&&Vs.document){const p=je.isDebug||je.hydrateServerSide?a3n(f):Vs.document.createTextNode("");p["s-nr"]=f,jf(f.parentNode,f["s-ol"]=p,f)}}for(const m of Gb){const f=m.$nodeToRelocate$,p=m.$slotRefNode$;if(p){const g=p.parentNode;let v=p.nextSibling;if(!je.hydrateServerSide&&(!je.experimentalSlotFixes||v&&v.nodeType===1)){let w=(r=f["s-ol"])==null?void 0:r.previousSibling;for(;w;){let k=(s=w["s-nr"])!=null?s:null;if(k&&k["s-sn"]===f["s-sn"]&&g===(k.__parentNode||k.parentNode)){for(k=k.nextSibling;k===f||k!=null&&k["s-sr"];)k=k==null?void 0:k.nextSibling;if(!k||!k["s-nr"]){v=k;break}}w=w.previousSibling}}const b=f.__parentNode||f.parentNode,x=f.__nextSibling||f.nextSibling;(!v&&g!==b||x!==v)&&f!==v&&(!je.experimentalSlotFixes&&!f["s-hn"]&&f["s-ol"]&&(f["s-hn"]=f["s-ol"].parentNode.nodeName),jf(g,f,v),f.nodeType===1&&f.tagName!=="SLOT-FB"&&(f.hidden=(i=f["s-ih"])!=null?i:!1)),f&&typeof p["s-rf"]=="function"&&p["s-rf"](p)}else f.nodeType===1&&(n&&(f["s-ih"]=(o=f.hidden)!=null?o:!1),f.hidden=!0)}}NQ&&ane(h.$elm$),vs.$flags$&=-2,Gb.length=0}if(je.experimentalScopedSlotChanges&&d.$flags$&2){const m=h.$elm$.__childNodes||h.$elm$.childNodes;for(const f of m)f["s-hn"]!==Ex&&!f["s-sh"]&&(n&&f["s-ih"]==null&&(f["s-ih"]=(l=f.hidden)!=null?l:!1),f.hidden=!0)}EQ=void 0},i3n=t=>{var e;return(e=Vs.document)==null?void 0:e.createComment(`<slot${t.$name$?' name="'+t.$name$+'"':""}> (host=${Ex.toLowerCase()})`)},a3n=t=>{var e;return(e=Vs.document)==null?void 0:e.createComment("org-location for "+(t.localName?`<${t.localName}> (host=${t["s-hn"]})`:`[${t.textContent}]`))},Kyt=(t,e)=>{if(je.asyncLoading&&e&&!t.$onRenderResolve$&&e["s-p"]){const n=e["s-p"].push(new Promise(r=>t.$onRenderResolve$=()=>{e["s-p"].splice(n-1,1),r()}))}},une=(t,e)=>{if(je.taskQueue&&je.updatable&&(t.$flags$|=16),je.asyncLoading&&t.$flags$&4){t.$flags$|=512;return}Kyt(t,t.$ancestorComponent$);const n=()=>o3n(t,e);return je.taskQueue?Dc(n):n()},o3n=(t,e)=>{const n=t.$hostElement$,r=Py("scheduleUpdate",t.$cmpMeta$.$tagName$),s=je.lazyLoad?t.$lazyInstance$:n;if(!s)throw new Error(`Can't render component <${n.tagName.toLowerCase()} /> with invalid Stencil runtime! Make sure this imported component is compiled with a \`externalRuntime: true\` flag. For more information, please refer to https://stenciljs.com/docs/custom-elements#externalruntime`);let i;return e?(je.lazyLoad&&je.hostListener&&(t.$flags$|=256,t.$queuedListeners$&&(t.$queuedListeners$.map(([o,l])=>ux(s,o,l,n)),t.$queuedListeners$=void 0)),ZA(n,"componentWillLoad"),i=ux(s,"componentWillLoad",void 0,n)):(ZA(n,"componentWillUpdate"),i=ux(s,"componentWillUpdate",void 0,n)),ZA(n,"componentWillRender"),i=d7e(i,()=>ux(s,"componentWillRender",void 0,n)),r(),d7e(i,()=>c3n(t,s,e))},d7e=(t,e)=>l3n(t)?t.then(e).catch(n=>{console.error(n),e()}):e(),l3n=t=>t instanceof Promise||t&&t.then&&typeof t.then=="function",c3n=async(t,e,n)=>{var r;const s=t.$hostElement$,i=Py("update",t.$cmpMeta$.$tagName$),o=s["s-rc"];je.style&&n&&Fyt(t);const l=Py("render",t.$cmpMeta$.$tagName$);if(je.isDev&&(t.$flags$|=1024),je.hydrateServerSide?await u7e(t,e,s,n):u7e(t,e,s,n),je.isDev&&(t.$renderCount$=t.$renderCount$===void 0?1:t.$renderCount$+1,t.$flags$&=-1025),je.hydrateServerSide)try{Qyt(s),n&&(t.$cmpMeta$.$flags$&1?s["s-en"]="":t.$cmpMeta$.$flags$&2&&(s["s-en"]="c"))}catch(c){mn(c,s)}if(je.asyncLoading&&o&&(o.map(c=>c()),s["s-rc"]=void 0),l(),i(),je.asyncLoading){const c=(r=s["s-p"])!=null?r:[],d=()=>rbe(t);c.length===0?d():(Promise.all(c).then(d),t.$flags$|=4,c.length=0)}else rbe(t)},nbe=null,u7e=(t,e,n,r)=>{const s=!!je.allRenderFn,i=!!je.lazyLoad,o=!!je.taskQueue,l=!!je.updatable;try{if(nbe=e,e=(s||e.render)&&e.render(),l&&o&&(t.$flags$&=-17),(l||i)&&(t.$flags$|=2),je.hasRenderFn||je.reflect)if(je.vdomRender||je.reflect){if(je.hydrateServerSide)return Promise.resolve(e).then(c=>tbe(t,c,r));tbe(t,e,r)}else{const c=n.shadowRoot;t.$cmpMeta$.$flags$&1?c.textContent=e:n.textContent=e}}catch(c){mn(c,t.$hostElement$)}return nbe=null,null},d3n=()=>nbe,rbe=t=>{const e=t.$cmpMeta$.$tagName$,n=t.$hostElement$,r=Py("postUpdate",e),s=je.lazyLoad?t.$lazyInstance$:n,i=t.$ancestorComponent$;je.isDev&&(t.$flags$|=1024),ux(s,"componentDidRender",void 0,n),je.isDev&&(t.$flags$&=-1025),ZA(n,"componentDidRender"),t.$flags$&64?(je.isDev&&(t.$flags$|=1024),ux(s,"componentDidUpdate",void 0,n),je.isDev&&(t.$flags$&=-1025),ZA(n,"componentDidUpdate"),r()):(t.$flags$|=64,je.asyncLoading&&je.cssAnnotations&&u3n(n),je.isDev&&(t.$flags$|=2048),ux(s,"componentDidLoad",void 0,n),je.isDev&&(t.$flags$&=-2049),ZA(n,"componentDidLoad"),r(),je.asyncLoading&&(t.$onReadyResolve$(n),i||sbe(e))),je.method&&je.lazyLoad&&t.$onInstanceResolve$(n),je.asyncLoading&&(t.$onRenderResolve$&&(t.$onRenderResolve$(),t.$onRenderResolve$=void 0),t.$flags$&512&&I7(()=>une(t,!1)),t.$flags$&=-517)},Yyt=t=>{if(je.updatable&&(wQ.isBrowser||wQ.isTesting)){const e=Sl(t),n=e.$hostElement$.isConnected;return n&&(e.$flags$&18)===2&&une(e,!1),n}return!1},sbe=t=>{je.asyncQueue&&(vs.$flags$|=2),I7(()=>hNe(Vs,"appload",{detail:{namespace:xQ}})),je.profile&&performance.measure&&performance.measure(`[Stencil] ${xQ} initial load (by ${t})`,"st:app:start")},ux=(t,e,n,r)=>{if(t&&t[e])try{return t[e](n)}catch(s){mn(s,r)}},ZA=(t,e)=>{je.lifecycleDOMEvents&&hNe(t,"stencil_"+e,{bubbles:!0,composed:!0,detail:{namespace:xQ}})},u3n=t=>{var e,n;return je.hydratedClass?t.classList.add((e=je.hydratedSelectorName)!=null?e:"hydrated"):je.hydratedAttribute?t.setAttribute((n=je.hydratedSelectorName)!=null?n:"hydrated",""):void 0},Qyt=t=>{const e=t.children;if(e!=null)for(let n=0,r=e.length;n<r;n++){const s=e[n];typeof s.connectedCallback=="function"&&s.connectedCallback(),Qyt(s)}},ibe=(t,e)=>Sl(t).$instanceValues$.get(e),W4=(t,e,n,r)=>{const s=Sl(t);if(je.lazyLoad&&!s)throw new Error(`Couldn't find host element for "${r.$tagName$}" as it is unknown to this Stencil runtime. This usually happens when integrating a 3rd party Stencil component with another Stencil component or application. Please reach out to the maintainers of the 3rd party Stencil component or report this on the Stencil Discord server (https://chat.stenciljs.com) or comment on this similar [GitHub issue](https://github.com/stenciljs/core/issues/5457).`);const i=je.lazyLoad?s.$hostElement$:t,o=s.$instanceValues$.get(e),l=s.$flags$,c=je.lazyLoad?s.$lazyInstance$:i;n=jQ(n,r.$members$[e][0]);const d=Number.isNaN(o)&&Number.isNaN(n),u=n!==o&&!d;if((!je.lazyLoad||!(l&8)||o===void 0)&&u&&(s.$instanceValues$.set(e,n),je.isDev&&(s.$flags$&1024?NR(`The state/prop "${e}" changed during rendering. This can potentially lead to infinite-loops and other bugs.`,`
Element`,i,`
New value`,n,`
Old value`,o):s.$flags$&2048&&NR(`The state/prop "${e}" changed during "componentDidLoad()", this triggers extra re-renders, try to setup on "componentWillLoad()"`,`
Element`,i,`
New value`,n,`
Old value`,o)),!je.lazyLoad||c)){if(je.watchCallback&&r.$watchers$&&l&128){const h=r.$watchers$[e];h&&h.map(m=>{try{c[m](n,o,e)}catch(f){mn(f,i)}})}if(je.updatable&&(l&18)===2){if(c.componentShouldUpdate&&c.componentShouldUpdate(n,o,e)===!1)return;une(s,!1)}}},hne=(t,e,n)=>{var r,s;const i=t.prototype;if(je.isTesting){if(i.__stencilAugmented)return;i.__stencilAugmented=!0}if(je.formAssociated&&e.$flags$&64&&n&1&&BMn.forEach(o=>{const l=i[o];Object.defineProperty(i,o,{value(...c){const d=Sl(this),u=je.lazyLoad?d.$lazyInstance$:this;if(!u)d.$onReadyPromise$.then(h=>{const m=h[o];typeof m=="function"&&m.call(h,...c)});else{const h=je.lazyLoad?u[o]:l;typeof h=="function"&&h.call(u,...c)}}})}),je.member&&e.$members$||je.watchCallback&&(e.$watchers$||t.watchers)){je.watchCallback&&t.watchers&&!e.$watchers$&&(e.$watchers$=t.watchers);const o=Object.entries((r=e.$members$)!=null?r:{});if(o.map(([l,[c]])=>{if((je.prop||je.state)&&(c&31||(!je.lazyLoad||n&2)&&c&32)){const{get:d,set:u}=Object.getOwnPropertyDescriptor(i,l)||{};d&&(e.$members$[l][0]|=2048),u&&(e.$members$[l][0]|=4096),(n&1||!d)&&Object.defineProperty(i,l,{get(){if(je.lazyLoad){if(!(e.$members$[l][0]&2048))return ibe(this,l);const h=Sl(this),m=h?h.$lazyInstance$:i;return m?m[l]:void 0}if(!je.lazyLoad)return d?d.apply(this):ibe(this,l)},configurable:!0,enumerable:!0}),Object.defineProperty(i,l,{set(h){const m=Sl(this);if(je.isDev&&!(n&1)&&!(e.$members$[l][0]&4096)&&(m&&m.$flags$&8)===0&&c&31&&!(c&1024)&&NR(`@Prop() "${l}" on <${e.$tagName$}> is immutable but was modified from within the component.
More information: https://stenciljs.com/docs/properties#prop-mutability`),u){const f=c&32?this[l]:m.$hostElement$[l];typeof f>"u"&&m.$instanceValues$.get(l)?h=m.$instanceValues$.get(l):!m.$instanceValues$.get(l)&&f&&m.$instanceValues$.set(l,f),u.apply(this,[jQ(h,c)]),h=c&32?this[l]:m.$hostElement$[l],W4(this,l,h,e);return}if(!je.lazyLoad){W4(this,l,h,e);return}if(je.lazyLoad){if(!(n&1)||!(e.$members$[l][0]&4096)){W4(this,l,h,e),n&1&&!m.$lazyInstance$&&m.$onReadyPromise$.then(()=>{e.$members$[l][0]&4096&&m.$lazyInstance$[l]!==m.$instanceValues$.get(l)&&(m.$lazyInstance$[l]=h)});return}const f=()=>{const p=m.$lazyInstance$[l];!m.$instanceValues$.get(l)&&p&&m.$instanceValues$.set(l,p),m.$lazyInstance$[l]=jQ(h,c),W4(this,l,m.$lazyInstance$[l],e)};m.$lazyInstance$?f():m.$onReadyPromise$.then(()=>f())}}})}else je.lazyLoad&&je.method&&n&1&&c&64&&Object.defineProperty(i,l,{value(...d){var u;const h=Sl(this);return(u=h==null?void 0:h.$onInstancePromise$)==null?void 0:u.then(()=>{var m;return(m=h.$lazyInstance$)==null?void 0:m[l](...d)})}})}),je.observeAttribute&&(!je.lazyLoad||n&1)){const l=new Map;i.attributeChangedCallback=function(c,d,u){vs.jmp(()=>{var h;const m=l.get(c);if(this.hasOwnProperty(m)&&je.lazyLoad)u=this[m],delete this[m];else{if(i.hasOwnProperty(m)&&typeof this[m]=="number"&&this[m]==u)return;if(m==null){const p=Sl(this),g=p==null?void 0:p.$flags$;if(g&&!(g&8)&&g&128&&u!==d){const v=je.lazyLoad?p.$hostElement$:this,b=je.lazyLoad?p.$lazyInstance$:v,x=(h=e.$watchers$)==null?void 0:h[c];x==null||x.forEach(w=>{b[w]!=null&&b[w].call(b,u,d,c)})}return}}const f=Object.getOwnPropertyDescriptor(i,m);u=u===null&&typeof this[m]=="boolean"?!1:u,u!==this[m]&&(!f.get||f.set)&&(this[m]=u)})},t.observedAttributes=Array.from(new Set([...Object.keys((s=e.$watchers$)!=null?s:{}),...o.filter(([c,d])=>d[0]&15).map(([c,d])=>{var u;const h=d[1]||c;return l.set(h,c),je.reflect&&d[0]&512&&((u=e.$attrsToReflect$)==null||u.push([c,h])),h})]))}}return t},abe=async(t,e,n,r)=>{let s;if(!(e.$flags$&32)){e.$flags$|=32;const l=n.$lazyBundleId$;if(je.lazyLoad&&l){const c=yyt(n,e,r);if(c&&"then"in c){const u=hLn(`st:load:${n.$tagName$}:${e.$modeName$}`,`[Stencil] Load module for <${n.$tagName$}>`);s=await c,u()}else s=c;if(!s)throw new Error(`Constructor for "${n.$tagName$}#${e.$modeName$}" was not found`);je.member&&!s.isProxied&&(je.watchCallback&&(n.$watchers$=s.watchers),hne(s,n,2),s.isProxied=!0);const d=Py("createInstance",n.$tagName$);je.member&&(e.$flags$|=8);try{new s(e)}catch(u){mn(u,t)}je.member&&(e.$flags$&=-9),je.watchCallback&&(e.$flags$|=128),d(),obe(e.$lazyInstance$,t)}else{s=t.constructor;const c=t.localName;customElements.whenDefined(c).then(()=>e.$flags$|=128)}if(je.style&&s&&s.style){let c;typeof s.style=="string"?c=s.style:je.mode&&typeof s.style!="string"&&(e.$modeName$=Oyt(t),e.$modeName$&&(c=s.style[e.$modeName$]),je.hydrateServerSide&&e.$modeName$&&t.setAttribute("s-mode",e.$modeName$));const d=cne(n,e.$modeName$);if(!TR.has(d)){const u=Py("registerStyles",n.$tagName$);je.hydrateServerSide&&je.shadowDom&&n.$flags$&128&&(c=JLn(c,d)),mNe(d,c,!!(n.$flags$&1)),u()}}}const i=e.$ancestorComponent$,o=()=>une(e,!0);je.asyncLoading&&i&&i["s-rc"]?i["s-rc"].push(o):o()},obe=(t,e)=>{je.lazyLoad&&ux(t,"connectedCallback",void 0,e)},fNe=t=>{if(!(vs.$flags$&1)){const e=Sl(t),n=e.$cmpMeta$,r=Py("connectedCallback",n.$tagName$);if(je.hostListenerTargetParent&&v6(t,e,n.$listeners$,!0),e.$flags$&1)v6(t,e,n.$listeners$,!1),e!=null&&e.$lazyInstance$?obe(e.$lazyInstance$,t):e!=null&&e.$onReadyPromise$&&e.$onReadyPromise$.then(()=>obe(e.$lazyInstance$,t));else{e.$flags$|=1;let s;if(je.hydrateClientSide&&(s=t.getAttribute(_R),s)){if(je.shadowDom&&s0&&n.$flags$&1){const i=je.mode?Xye(t.shadowRoot,n,t.getAttribute("s-mode")):Xye(t.shadowRoot,n);t.classList.remove(i+"-h",i+"-s")}else if(je.scoped&&n.$flags$&2){const i=cne(n,je.mode?t.getAttribute("s-mode"):void 0);t["s-sc"]=i}yLn(t,n.$tagName$,s,e)}if(je.slotRelocation&&!s&&(je.hydrateServerSide||(je.slot||je.shadowDom)&&n.$flags$&12)&&h3n(t),je.asyncLoading){let i=t;for(;i=i.parentNode||i.host;)if(je.hydrateClientSide&&i.nodeType===1&&i.hasAttribute("s-id")&&i["s-p"]||i["s-p"]){Kyt(e,e.$ancestorComponent$=i);break}}je.prop&&!je.hydrateServerSide&&n.$members$&&Object.entries(n.$members$).map(([i,[o]])=>{if(o&31&&t.hasOwnProperty(i)){const l=t[i];delete t[i],t[i]=l}}),je.initializeNextTick?I7(()=>abe(t,e,n)):abe(t,e,n)}r()}},h3n=t=>{if(!Vs.document)return;const e=t["s-cr"]=Vs.document.createComment(je.isDebug?`content-ref (host=${t.localName})`:"");e["s-cn"]=!0,jf(t,e,t.firstChild)},jce=(t,e)=>{je.lazyLoad&&ux(t,"disconnectedCallback",void 0,e||t)},pNe=async t=>{if(!(vs.$flags$&1)){const e=Sl(t);je.hostListener&&e.$rmListeners$&&(e.$rmListeners$.map(n=>n()),e.$rmListeners$=void 0),je.lazyLoad?e!=null&&e.$lazyInstance$?jce(e.$lazyInstance$,t):e!=null&&e.$onReadyPromise$&&e.$onReadyPromise$.then(()=>jce(e.$lazyInstance$,t)):jce(t)}mA.has(t)&&mA.delete(t),t.shadowRoot&&mA.has(t.shadowRoot)&&mA.delete(t.shadowRoot)},m3n=(t,e)=>{customElements.define(e[1],Zyt(t,e))},Zyt=(t,e)=>{const n={$flags$:e[0],$tagName$:e[1]};je.member&&(n.$members$=e[2]),je.hostListener&&(n.$listeners$=e[3]),je.watchCallback&&(n.$watchers$=t.$watchers$),je.reflect&&(n.$attrsToReflect$=[]),je.shadowDom&&!s0&&n.$flags$&1&&(n.$flags$|=8),je.experimentalSlotFixes?je.scoped&&n.$flags$&2&&Ayt(t.prototype):(je.slotChildNodesFix&&cNe(t.prototype),je.cloneNodeFix&&aNe(t.prototype),je.appendChildSlotFix&&oNe(t.prototype),je.scopedSlotTextContentFix&&n.$flags$&2&&lNe(t.prototype)),je.hydrateClientSide&&je.shadowDom&&Byt();const r=t.prototype.connectedCallback,s=t.prototype.disconnectedCallback;return Object.assign(t.prototype,{__hasHostListenerAttached:!1,__registerHost(){XEe(this,n)},connectedCallback(){if(!this.__hasHostListenerAttached){const i=Sl(this);v6(this,i,n.$listeners$,!1),this.__hasHostListenerAttached=!0}fNe(this),r&&r.call(this)},disconnectedCallback(){pNe(this),s&&s.call(this)},__attachShadow(){if(s0){if(!this.shadowRoot)je.shadowDelegatesFocus?this.attachShadow({mode:"open",delegatesFocus:!!(n.$flags$&16)}):this.attachShadow({mode:"open"});else if(this.shadowRoot.mode!=="open")throw new Error(`Unable to re-use existing shadow root for ${n.$tagName$}! Mode is set to ${this.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else this.shadowRoot=this}}),t.is=n.$tagName$,hne(t,n,3)},f3n=t=>{if(je.style&&je.mode&&!je.lazyLoad){const e=Oyt(t),n=Sl(t);if(n.$modeName$!==e){const r=n.$cmpMeta$,s=t["s-sc"],i=cne(r,e),o=t.constructor.style[e],l=r.$flags$;o&&(TR.has(i)||mNe(i,o,!!(l&1)),n.$modeName$=e,t.classList.remove(s+"-h",s+"-s"),Fyt(n),Yyt(t))}}},p3n=(t,e,n)=>{const r=Sl(t);r.$flags$=1,abe(t,r,e,n)},Jyt=(t,e={})=>{var n;if(je.profile&&performance.mark&&performance.mark("st:app:start"),fLn(),!Vs.document){console.warn("Stencil: No document found. Skipping bootstrapping lazy components.");return}const r=Py("bootstrapLazy"),s=[],i=e.exclude||[],o=Vs.customElements,l=Vs.document.head,c=l.querySelector("meta[charset]"),d=Vs.document.createElement("style"),u=[];let h,m=!0;Object.assign(vs,e),vs.$resourcesUrl$=new URL(e.resourcesUrl||"./",Vs.document.baseURI).href,je.asyncQueue&&e.syncQueue&&(vs.$flags$|=4),je.hydrateClientSide&&(vs.$flags$|=2),je.hydrateClientSide&&je.shadowDom&&Byt();let f=!1;if(t.map(p=>{p[1].map(g=>{var v;const b={$flags$:g[0],$tagName$:g[1],$members$:g[2],$listeners$:g[3]};b.$flags$&4&&(f=!0),je.member&&(b.$members$=g[2]),je.hostListener&&(b.$listeners$=g[3]),je.reflect&&(b.$attrsToReflect$=[]),je.watchCallback&&(b.$watchers$=(v=g[4])!=null?v:{}),je.shadowDom&&!s0&&b.$flags$&1&&(b.$flags$|=8);const x=je.transformTagName&&e.transformTagName?e.transformTagName(b.$tagName$):b.$tagName$,w=class extends HTMLElement{constructor(k){if(super(k),this.hasRegisteredEventListeners=!1,k=this,XEe(k,b),je.shadowDom&&b.$flags$&1)if(s0){if(!k.shadowRoot)je.shadowDelegatesFocus?k.attachShadow({mode:"open",delegatesFocus:!!(b.$flags$&16)}):k.attachShadow({mode:"open"});else if(k.shadowRoot.mode!=="open")throw new Error(`Unable to re-use existing shadow root for ${b.$tagName$}! Mode is set to ${k.shadowRoot.mode} but Stencil only supports open shadow roots.`)}else!je.hydrateServerSide&&!("shadowRoot"in k)&&(k.shadowRoot=k)}connectedCallback(){const k=Sl(this);this.hasRegisteredEventListeners||(this.hasRegisteredEventListeners=!0,v6(this,k,b.$listeners$,!1)),h&&(clearTimeout(h),h=null),m?u.push(this):vs.jmp(()=>fNe(this))}disconnectedCallback(){vs.jmp(()=>pNe(this)),vs.raf(()=>{var k;const S=Sl(this),C=u.findIndex(j=>j===this);C>-1&&u.splice(C,1),((k=S==null?void 0:S.$vnode$)==null?void 0:k.$elm$)instanceof Node&&!S.$vnode$.$elm$.isConnected&&delete S.$vnode$.$elm$})}componentOnReady(){return Sl(this).$onReadyPromise$}};je.experimentalSlotFixes?je.scoped&&b.$flags$&2&&Ayt(w.prototype):(je.slotChildNodesFix&&cNe(w.prototype),je.cloneNodeFix&&aNe(w.prototype),je.appendChildSlotFix&&oNe(w.prototype),je.scopedSlotTextContentFix&&b.$flags$&2&&lNe(w.prototype)),je.formAssociated&&b.$flags$&64&&(w.formAssociated=!0),je.hotModuleReplacement&&(w.prototype["s-hmr"]=function(k){p3n(this,b,k)}),b.$lazyBundleId$=p[0],!i.includes(x)&&!o.get(x)&&(s.push(x),o.define(x,hne(w,b,1)))})}),s.length>0&&(f&&(d.textContent+=Syt),je.invisiblePrehydration&&(je.hydratedClass||je.hydratedAttribute)&&(d.textContent+=s.sort()+OMn),d.innerHTML.length)){d.setAttribute("data-styles","");const p=(n=vs.$nonce$)!=null?n:Nyt(Vs.document);p!=null&&d.setAttribute("nonce",p),l.insertBefore(d,c?c.nextSibling:l.firstChild)}m=!1,u.length?u.map(p=>p.connectedCallback()):je.profile?vs.jmp(()=>h=setTimeout(sbe,30,"timeout")):vs.jmp(()=>h=setTimeout(sbe,30)),r()},Xyt=(t,e)=>e,v6=(t,e,n,r)=>{je.hostListener&&n&&Vs.document&&(je.hostListenerTargetParent&&(r?n=n.filter(([s])=>s&32):n=n.filter(([s])=>!(s&32))),n.map(([s,i,o])=>{const l=je.hostListenerTarget?v3n(Vs.document,t,s):t,c=g3n(e,o),d=y3n(s);vs.ael(l,i,c,d),(e.$rmListeners$=e.$rmListeners$||[]).push(()=>vs.rel(l,i,c,d))}))},g3n=(t,e)=>n=>{var r;try{je.lazyLoad?t.$flags$&256?(r=t.$lazyInstance$)==null||r[e](n):(t.$queuedListeners$=t.$queuedListeners$||[]).push([e,n]):t.$hostElement$[e](n)}catch(s){mn(s,t.$hostElement$)}},v3n=(t,e,n)=>je.hostListenerTargetDocument&&n&4?t:je.hostListenerTargetWindow&&n&8?Vs:je.hostListenerTargetBody&&n&16?t.body:je.hostListenerTargetParent&&n&32&&e.parentElement?e.parentElement:e,y3n=t=>Cyt?{passive:(t&1)!==0,capture:(t&2)!==0}:(t&2)!==0,b3n=t=>vs.$nonce$=t,x3n=t=>Object.assign(vs,t),w3n=(t,e)=>{if(t!=null){const n=Q8e in t?t[Q8e]:{...FMn};n.staticComponents=new Set(e);const r=[];ebt(t,t.body,n,r),r.forEach(s=>{var i;if(s!=null&&s["s-nr"]){const o=s["s-nr"];let l=o["s-host-id"],c=o["s-node-id"],d=`${l}.${c}`;if(l==null){if(l=0,n.rootLevelIds++,c=n.rootLevelIds,d=`${l}.${c}`,o.nodeType===1)o.setAttribute(AR,d),typeof o["s-sn"]=="string"&&!o.getAttribute("slot")&&o.setAttribute("s-sn",o["s-sn"]);else if(o.nodeType===3){if(l===0&&((i=o.nodeValue)==null?void 0:i.trim())===""){s.remove();return}const m=t.createComment(d);m.nodeValue=`${tNe}.${d}`,jf(o.parentNode,m,o)}else if(o.nodeType===8){const m=t.createComment(d);m.nodeValue=`${kyt}.${d}`,o.parentNode.insertBefore(m,o)}}let u=`${xyt}.${d}`;const h=s.parentElement;h&&(h["s-en"]===""?u+=".":h["s-en"]==="c"&&(u+=".c")),s.nodeValue=u}})}},ebt=(t,e,n,r)=>{var s;e!=null&&(e["s-nr"]!=null&&r.push(e),e.nodeType===1&&[...Array.from(e.childNodes),...Array.from(((s=e.shadowRoot)==null?void 0:s.childNodes)||[])].forEach(o=>{const l=Sl(o);if(l!=null&&!n.staticComponents.has(o.nodeName.toLowerCase())){const c={nodeIds:0};k3n(t,o,l.$vnode$,n,c)}ebt(t,o,n,r)}))},k3n=(t,e,n,r,s)=>{if(n!=null){const i=++r.hostIds;if(e.setAttribute(_R,i),e["s-cr"]!=null&&(e["s-cr"].nodeValue=`${byt}.${i}`),n.$children$!=null&&n.$children$.forEach((l,c)=>{tbt(t,l,s,i,0,c)}),e&&n&&n.$elm$&&!e.hasAttribute(AR)){const o=e.parentElement;if(o&&o.childNodes){const l=Array.from(o.childNodes),c=l.find(d=>d.nodeType===8&&d["s-sr"]);if(c){const d=l.indexOf(e)-1;n.$elm$.setAttribute(AR,`${c["s-host-id"]}.${c["s-node-id"]}.0.${d}`)}}}}},tbt=(t,e,n,r,s,i)=>{const o=e.$elm$;if(o==null)return;const l=n.nodeIds++,c=`${r}.${l}.${s}.${i}`;if(o["s-host-id"]=r,o["s-node-id"]=l,o.nodeType===1)o.setAttribute(AR,c),typeof o["s-sn"]=="string"&&!o.getAttribute("slot")&&o.setAttribute("s-sn",o["s-sn"]);else if(o.nodeType===3){const d=o.parentNode,u=d==null?void 0:d.nodeName;if(u!=="STYLE"&&u!=="SCRIPT"){const h=`${tNe}.${c}`,m=t.createComment(h);jf(d,m,o)}}else if(o.nodeType===8&&o["s-sr"]){const d=o["s-sn"]||"",u=`${wyt}.${c}.${d}`;o.nodeValue=u}if(e.$children$!=null){const d=s+1;e.$children$.forEach((u,h)=>{tbt(t,u,n,r,d,h)})}};const S3n=Object.freeze({__proto__:null,BUILD:je,Build:wQ,Env:PMn,Fragment:Xyt,H:J8e,HTMLElement:J8e,Host:mt,NAMESPACE:xQ,STENCIL_DEV_MODE:ine,addHostEventListeners:v6,bootstrapLazy:Jyt,cmpModules:MW,connectedCallback:fNe,consoleDevError:m6,consoleDevInfo:DMn,consoleDevWarn:NR,consoleError:mn,createEvent:Wt,defineCustomElement:m3n,disconnectedCallback:pNe,forceModeUpdate:f3n,forceUpdate:Yyt,getAssetPath:VMn,getElement:Pl,getHostRef:Sl,getMode:e3n,getRenderingRef:d3n,getValue:ibe,h:$,insertVdomAnnotations:w3n,isMemberInElement:qye,loadModule:yyt,modeResolutionChain:eNe,nextTick:I7,parsePropertyValue:jQ,plt:vs,postUpdateComponent:rbe,promiseResolve:jyt,proxyComponent:hne,proxyCustomElement:Zyt,readTask:zMn,registerHost:XEe,registerInstance:kt,renderVdom:tbe,setAssetPath:HMn,setErrorHandler:$Mn,setMode:XLn,setNonce:b3n,setPlatformHelpers:UMn,setPlatformOptions:x3n,setValue:W4,styles:TR,supportsConstructableStylesheets:nNe,supportsListenerOptions:Cyt,supportsShadow:s0,win:Vs,writeTask:Dc}),C3n=()=>{},j3n=async(t,e)=>{if(!(typeof window>"u"))return await C3n(),Jyt(JSON.parse('[["rtk-avatar_26",[[1,"rtk-meeting",{"loadConfigFromPreset":[1028,"load-config-from-preset"],"applyDesignSystem":[1028,"apply-design-system"],"mode":[513],"leaveOnUnmount":[4,"leave-on-unmount"],"meeting":[16],"showSetupScreen":[1028,"show-setup-screen"],"t":[16],"config":[1040],"size":[1537],"gridLayout":[1,"grid-layout"],"iconPack":[16],"overrides":[16]},null,{"meeting":["meetingChanged"],"iconPack":["iconPackChanged"],"t":["tChanged"],"config":["configChanged"],"overrides":["overridesChanged"]}],[1,"rtk-chat",{"meeting":[16],"config":[16],"size":[513],"iconPack":[16],"t":[16],"overrides":[16],"canPinMessages":[32],"now":[32],"dropzoneActivated":[32],"showLatestMessageButton":[32],"canSend":[32],"canSendTextMessage":[32],"canSendFiles":[32],"canPrivateMessage":[32],"canSendPrivateTexts":[32],"canSendPrivateFiles":[32],"emojiPickerEnabled":[32],"participants":[32],"selectedParticipant":[32],"editingMessage":[32],"replyMessage":[32],"searchQuery":[32],"selectorState":[32],"isSendingMessage":[32],"showPinnedMessages":[32]},[[8,"editMessageInit","onEditMessageInit"],[0,"rtkChatSelectorChange","onChatSelectorChange"]],{"meeting":["meetingChanged"]}],[1,"rtk-chat-messages-ui-paginated",{"meeting":[16],"size":[513],"iconPack":[16],"t":[16],"privateChatRecipient":[16],"children":[32],"permissionsChanged":[32]},[[8,"rtkPinnedMessageSelect","onPinnedMessageSelect"]],{"privateChatRecipient":["privateChatRecipientChanged"],"meeting":["meetingChanged"]}],[1,"rtk-chat-composer-view",{"canSendTextMessage":[4,"can-send-text-message"],"isSending":[4,"is-sending"],"canSendFiles":[4,"can-send-files"],"message":[1],"quotedMessage":[1,"quoted-message"],"storageKey":[1,"storage-key"],"inputTextPlaceholder":[1,"input-text-placeholder"],"isEditing":[4,"is-editing"],"iconPack":[16],"t":[16],"maxLength":[2,"max-length"],"disableEmojiPicker":[4,"disable-emoji-picker"],"rateLimits":[16],"fileToUpload":[32],"isEmojiPickerOpen":[32],"disableSendButton":[32],"rateLimitsBreached":[32]}],[1,"rtk-chat-header"],[1,"rtk-chat-selector",{"meeting":[16],"states":[16],"config":[16],"iconPack":[16],"t":[16],"overrides":[16],"size":[513],"isOpen":[32],"showPrivateChat":[32],"selectedUser":[32],"pageSize":[32],"pagesAllowed":[32],"unreadMap":[32],"close":[64]},null,{"overrides":["overridesChanged"],"meeting":["meetingChanged"]}],[1,"rtk-pinned-message-selector",{"meeting":[16],"iconPack":[16],"t":[16],"isOpen":[32],"pageSize":[32],"pagesAllowed":[32],"showPinnedMessages":[32],"close":[64]},[[8,"rtkChatSelectorChange","onChatSelectorChange"]],{"meeting":["meetingChanged"]}],[1,"rtk-draft-attachment-view",{"iconPack":[16],"t":[16],"attachment":[16],"filePreview":[32]},null,{"attachment":["onAttachmentChange"]}],[1,"rtk-emoji-picker-button",{"iconPack":[16],"t":[16],"isActive":[4,"is-active"]}],[1,"rtk-file-picker-button",{"filter":[1],"label":[1],"icon":[1],"iconPack":[16],"t":[16]}],[1,"rtk-text-composer-view",{"disabled":[4],"placeholder":[1],"value":[1],"maxLength":[2,"max-length"],"rateLimitBreached":[4,"rate-limit-breached"],"keyDownHandler":[16],"iconPack":[16],"t":[16],"maxLengthBreached":[32],"setText":[64]}],[1,"rtk-message-view",{"actions":[16],"messageType":[1,"message-type"],"isEdited":[4,"is-edited"],"variant":[1],"pinned":[4],"viewType":[1,"view-type"],"avatarUrl":[1,"avatar-url"],"hideAvatar":[4,"hide-avatar"],"authorName":[1,"author-name"],"isSelf":[4,"is-self"],"hideAuthorName":[4,"hide-author-name"],"hideMetadata":[4,"hide-metadata"],"time":[16],"iconPack":[16]}],[1,"rtk-emoji-picker",{"iconPack":[16],"t":[16],"focusWhenOpened":[4,"focus-when-opened"],"emojiList":[32],"filterVal":[32],"filteredEmojis":[32]}],[1,"rtk-image-message-view",{"url":[1],"iconPack":[16],"t":[16],"status":[32]}],[1,"rtk-file-message-view",{"name":[1],"size":[2],"url":[1],"iconPack":[16]}],[0,"rtk-text-message-view",{"text":[1],"isMarkdown":[4,"is-markdown"]}],[1,"rtk-markdown-view",{"text":[1],"maxLength":[2,"max-length"]}],[1,"rtk-paginated-list",{"pageSize":[2,"page-size"],"pagesAllowed":[2,"pages-allowed"],"emptyListLabel":[1,"empty-list-label"],"fetchData":[16],"createNodes":[16],"autoScroll":[4,"auto-scroll"],"iconPack":[16],"t":[16],"rerenderBoolean":[32],"showEmptyListLabel":[32],"isLoading":[32],"isLoadingTop":[32],"isLoadingBottom":[32],"rerenderList":[64],"onNewNode":[64],"onNodeDelete":[64],"onNodeUpdate":[64],"reset":[64]}],[1,"rtk-menu",{"size":[513],"placement":[1],"offset":[2],"iconPack":[16],"t":[16]}],[1,"rtk-menu-item",{"size":[513],"menuVariant":[1,"menu-variant"],"iconPack":[16],"t":[16]}],[1,"rtk-menu-list",{"iconPack":[16],"menuVariant":[1,"menu-variant"],"t":[16]}],[1,"rtk-avatar",{"participant":[16],"variant":[513],"size":[513],"iconPack":[16],"t":[16],"imageState":[32]}],[1,"rtk-tooltip",{"label":[1],"variant":[513],"disabled":[516],"open":[516],"kind":[513],"size":[513],"placement":[1],"delay":[2],"isInFocus":[32]},null,{"open":["openChanged"]}],[1,"rtk-spinner",{"iconPack":[16],"size":[513]}],[17,"rtk-button",{"size":[513],"variant":[513],"kind":[513],"reverse":[516],"disabled":[516],"type":[513]}],[1,"rtk-icon",{"icon":[1],"variant":[513],"size":[513]}]]],["rtk-dialog-manager",[[1,"rtk-dialog-manager",{"meeting":[16],"config":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16]},null,{"meeting":["meetingChanged"]}]]],["rtk-participants",[[1,"rtk-participants",{"meeting":[16],"states":[16],"config":[16],"size":[513],"iconPack":[16],"defaultParticipantsTabId":[1,"default-participants-tab-id"],"t":[16],"currentParticipantsTabId":[32],"tabs":[32],"hasRequests":[32],"search":[32]},null,{"meeting":["meetingChanged"],"currentParticipantsTabId":["currentParticipantsTabIdChanged"]}]]],["rtk-chat-messages-ui",[[1,"rtk-chat-messages-ui",{"selectedGroup":[1,"selected-group"],"messages":[16],"selfUserId":[1,"self-user-id"],"canPinMessages":[4,"can-pin-messages"],"size":[513],"iconPack":[16],"t":[16],"now":[32],"showLatestMessageButton":[32]},null,{"messages":["chatChanged"],"selectedGroup":["selectedBucketChanged"]}]]],["rtk-chat-search-results",[[1,"rtk-chat-search-results",{"meeting":[16],"query":[1],"channelId":[1,"channel-id"],"iconPack":[16],"t":[16]}]]],["rtk-settings",[[1,"rtk-settings",{"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"activeTab":[32],"isMobileMainVisible":[32],"networkStatus":[32],"canProduceVideo":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-sidebar",[[1,"rtk-sidebar",{"enabledSections":[1040],"defaultSection":[1,"default-section"],"meeting":[16],"states":[16],"config":[16],"iconPack":[16],"t":[16],"size":[513],"view":[513],"currentTab":[32],"isFloating":[32],"enablePinning":[32]},null,{"meeting":["meetingChanged"],"states":["statesChanged"],"view":["viewChanged"]}]]],["rtk-grid",[[1,"rtk-grid",{"layout":[513],"aspectRatio":[513,"aspect-ratio"],"meeting":[16],"gap":[514],"size":[513],"states":[16],"config":[16],"iconPack":[16],"t":[16],"gridSize":[16],"overrides":[8],"participants":[32],"pinnedParticipants":[32],"screenShareParticipants":[32],"plugins":[32],"emptyStage":[32],"showLiveStreamPlayer":[32],"canCurrentPeerHost":[32],"pipSupported":[32],"pipEnabled":[32],"hidden":[32],"roomState":[32]},null,{"meeting":["meetingChanged"],"overrides":["overridesChanged"],"screenShareParticipants":["screenShareParticipantsChanged"],"plugins":["pluginsChanged"],"pinnedParticipants":["pinnedParticipantsChanged"]}]]],["rtk-chat-composer-ui",[[1,"rtk-chat-composer-ui",{"canSendTextMessage":[4,"can-send-text-message"],"canSendFiles":[4,"can-send-files"],"size":[513],"iconPack":[16],"t":[16],"disableEmojiPicker":[4,"disable-emoji-picker"],"prefill":[16],"members":[16],"emojiPickerActive":[32],"mentionQuery":[32],"focusedMemberIndex":[32],"filePreview":[32]}]]],["rtk-mixed-grid",[[1,"rtk-mixed-grid",{"layout":[513],"participants":[16],"pinnedParticipants":[16],"screenShareParticipants":[16],"plugins":[16],"aspectRatio":[1,"aspect-ratio"],"gap":[2],"size":[513],"meeting":[16],"states":[16],"config":[16],"iconPack":[16],"t":[16],"gridSize":[16],"activeTab":[32],"initialised":[32]},null,{"meeting":["meetingChanged"],"screenShareParticipants":["screenShareParticipantsChanged"],"plugins":["pluginsChanged"]}]]],["rtk-setup-screen",[[1,"rtk-setup-screen",{"meeting":[16],"states":[16],"size":[513],"config":[16],"iconPack":[16],"t":[16],"displayName":[32],"isJoining":[32],"joinError":[32],"joinErrorCode":[32],"canEditName":[32],"canProduceAudio":[32],"connectionState":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-audio-tile",[[1,"rtk-audio-tile",{"meeting":[16],"config":[16],"size":[513],"states":[16],"iconPack":[16],"t":[16],"participant":[16],"audioEnabled":[32],"volume":[32]},null,{"participant":["participantChanged"]}]]],["rtk-camera-toggle",[[1,"rtk-camera-toggle",{"variant":[513],"meeting":[16],"size":[513],"iconPack":[16],"t":[16],"videoEnabled":[32],"canProduceVideo":[32],"cameraPermission":[32],"stageStatus":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-mic-toggle",[[1,"rtk-mic-toggle",{"variant":[513],"meeting":[16],"size":[513],"iconPack":[16],"t":[16],"audioEnabled":[32],"canProduceAudio":[32],"micPermission":[32],"stageStatus":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-mute-all-button",[[1,"rtk-mute-all-button",{"variant":[513],"meeting":[16],"size":[513],"iconPack":[16],"t":[16],"canDisable":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-screen-share-toggle",[[1,"rtk-screen-share-toggle",{"states":[16],"variant":[513],"meeting":[16],"size":[513],"iconPack":[16],"t":[16],"maxScreenShareCount":[32],"screenShareCount":[32],"screenShareEnabled":[32],"canScreenShare":[32],"shareScreenPermission":[32],"screenShareState":[32],"stageStatus":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-stage-toggle",[[1,"rtk-stage-toggle",{"variant":[513],"meeting":[16],"size":[513],"iconPack":[16],"states":[16],"t":[16],"stageStatus":[32],"state":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-ai-toggle",[[1,"rtk-ai-toggle",{"variant":[513],"states":[16],"meeting":[16],"size":[513],"iconPack":[16],"t":[16],"aiActive":[32]},null,{"states":["statesChanged"]}]]],["rtk-breakout-rooms-toggle",[[1,"rtk-breakout-rooms-toggle",{"variant":[513],"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"canToggle":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-caption-toggle",[[1,"rtk-caption-toggle",{"variant":[513],"meeting":[16],"states":[16],"config":[16],"iconPack":[16],"size":[513],"t":[16],"captionEnabled":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-chat-toggle",[[1,"rtk-chat-toggle",{"variant":[513],"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"unreadMessageCount":[32],"chatActive":[32],"canViewChat":[32]},null,{"meeting":["meetingChanged"],"states":["statesChanged"],"chatActive":["handleChatActiveChange"]}]]],["rtk-debugger-toggle",[[1,"rtk-debugger-toggle",{"variant":[513],"meeting":[16],"states":[16],"t":[16],"iconPack":[16],"size":[513]}]]],["rtk-grid-pagination",[[1,"rtk-grid-pagination",{"meeting":[16],"states":[16],"size":[513],"variant":[513],"iconPack":[16],"t":[16],"page":[32],"pageCount":[32],"activeCount":[32],"activeComputedCount":[32],"showPagination":[32]},null,{"meeting":["meetingChanged"],"size":["sizeChanged"]}]]],["rtk-idle-screen",[[1,"rtk-idle-screen",{"meeting":[16],"states":[16],"config":[16],"iconPack":[16],"t":[16],"joinError":[32],"joinErrorCode":[32],"connectionState":[32]},null,{"meeting":["meetingChanged"],"states":["statesChanged"]}]]],["rtk-leave-button",[[1,"rtk-leave-button",{"variant":[513],"size":[513],"iconPack":[16],"t":[16]}]]],["rtk-livestream-toggle",[[1,"rtk-livestream-toggle",{"variant":[513],"meeting":[16],"size":[513],"iconPack":[16],"t":[16],"livestreamState":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-more-toggle",[[1,"rtk-more-toggle",{"states":[16],"size":[513],"iconPack":[16],"t":[16]}]]],["rtk-notifications",[[1,"rtk-notifications",{"meeting":[16],"states":[16],"config":[16],"t":[16],"size":[513],"iconPack":[16],"notifications":[32],"paused":[32]},[[8,"rtkApiError","apiErrorListener"],[8,"rtkSendNotification","sendNotificationListener"]],{"meeting":["meetingChanged"],"config":["configChanged"],"states":["statesChanged"]}]]],["rtk-participants-audio",[[1,"rtk-participants-audio",{"meeting":[16],"iconPack":[16],"t":[16],"preloadedAudioElem":[16],"showPlayDialog":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-participants-toggle",[[1,"rtk-participants-toggle",{"variant":[513],"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"participantsActive":[32],"waitlistedParticipants":[32],"stageRequestedParticipants":[32],"badgeCount":[32],"canViewParticipants":[32]},null,{"meeting":["meetingChanged"],"states":["statesChanged"],"participantsActive":["handleParticipantsActiveChange"]}]]],["rtk-pip-toggle",[[1,"rtk-pip-toggle",{"variant":[513],"meeting":[16],"states":[16],"config":[16],"iconPack":[16],"size":[513],"t":[16],"pipSupported":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-plugins-toggle",[[1,"rtk-plugins-toggle",{"variant":[513],"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"pluginsActive":[32],"canViewPlugins":[32]},null,{"meeting":["meetingChanged"],"states":["statesChanged"],"pluginsActive":["handlePluginsActiveChange"]}]]],["rtk-polls-toggle",[[1,"rtk-polls-toggle",{"variant":[513],"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"pollsActive":[32],"unreadPollsCount":[32],"canViewPolls":[32]},null,{"meeting":["meetingChanged"],"states":["statesChanged"],"pollsActive":["handlePollsActiveChange"]}]]],["rtk-recording-toggle",[[1,"rtk-recording-toggle",{"variant":[513],"meeting":[16],"t":[16],"iconPack":[16],"size":[513],"disabled":[4],"recordingState":[32],"canRecord":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-screenshare-view",[[1,"rtk-screenshare-view",{"hideFullScreenButton":[4,"hide-full-screen-button"],"nameTagPosition":[513,"name-tag-position"],"participant":[16],"meeting":[16],"variant":[513],"size":[513],"iconPack":[16],"t":[16],"videoExpanded":[32],"screenShareEnabled":[32],"isFullScreen":[32],"remoteControlInfo":[32]},null,{"participant":["participantChanged"]}]]],["rtk-settings-toggle",[[1,"rtk-settings-toggle",{"variant":[513],"states":[16],"size":[513],"iconPack":[16],"t":[16]}]]],["rtk-ended-screen",[[1,"rtk-ended-screen",{"config":[16],"size":[513],"states":[16],"t":[16],"iconPack":[16],"meeting":[16],"icon":[32],"message":[32]},null,{"states":["statesChanged"]}]]],["rtk-image-viewer",[[1,"rtk-image-viewer",{"image":[16],"size":[513],"t":[16],"iconPack":[16]}]]],["rtk-message-list-view",[[0,"rtk-message-list-view",{"messages":[16],"renderer":[16],"loadMore":[16],"visibleItemsCount":[2,"visible-items-count"],"estimateItemSize":[2,"estimate-item-size"],"iconPack":[16],"range":[32],"isFetching":[32],"autoScroll":[32],"totalHeight":[32]},null,{"messages":["messagesUpdated"]}]]],["rtk-chat-selector-ui",[[1,"rtk-chat-selector-ui",{"selfUserId":[1,"self-user-id"],"selectedGroupId":[1,"selected-group-id"],"unreadCounts":[16],"groups":[16],"iconPack":[16],"t":[16],"showParticipantsPanel":[32],"query":[32]}]]],["rtk-clock",[[1,"rtk-clock",{"meeting":[16],"iconPack":[16],"size":[513],"startedTime":[32],"timeDiff":[32]},null,{"meeting":["meetingChanged"],"startedTime":["startedTimeChanged"]}]]],["rtk-file-dropzone",[[1,"rtk-file-dropzone",{"hostEl":[16],"iconPack":[16],"t":[16],"dropzoneActivated":[32]}]]],["rtk-information-tooltip",[[1,"rtk-information-tooltip",{"iconPack":[16]}]]],["rtk-meeting-title",[[1,"rtk-meeting-title",{"meeting":[16],"iconPack":[16],"t":[16]}]]],["rtk-network-indicator",[[1,"rtk-network-indicator",{"participant":[16],"meeting":[16],"iconPack":[16],"t":[16],"isScreenShare":[4,"is-screen-share"],"score":[32]},null,{"participant":["participantChanged"]}]]],["rtk-participant-count",[[1,"rtk-participant-count",{"meeting":[16],"iconPack":[16],"t":[16],"size":[513],"participantCount":[32],"isViewer":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-recording-indicator",[[1,"rtk-recording-indicator",{"meeting":[16],"size":[513],"t":[16],"iconPack":[16],"isRecording":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-transcripts",[[1,"rtk-transcripts",{"meeting":[16],"states":[16],"config":[16],"t":[16],"transcripts":[32],"listenerAttached":[32]},null,{"meeting":["meetingChanged"],"states":["statesChanged"]}]]],["rtk-waiting-screen",[[1,"rtk-waiting-screen",{"meeting":[16],"config":[16],"iconPack":[16],"t":[16]}]]],["rtk-audio-grid",[[1,"rtk-audio-grid",{"meeting":[16],"config":[16],"states":[16],"iconPack":[16],"size":[513],"t":[16],"hideSelf":[4,"hide-self"],"activeParticipants":[32],"onStageParticipants":[32],"offStageParticipants":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-controlbar",[[1,"rtk-controlbar",{"variant":[513],"disableRender":[4,"disable-render"],"meeting":[16],"config":[16],"states":[16],"iconPack":[16],"t":[16],"size":[513]}]]],["rtk-header",[[1,"rtk-header",{"variant":[513],"disableRender":[4,"disable-render"],"meeting":[16],"config":[16],"states":[16],"iconPack":[16],"t":[16],"size":[513]}]]],["rtk-participant-setup",[[1,"rtk-participant-setup",{"nameTagPosition":[513,"name-tag-position"],"isPreview":[4,"is-preview"],"participant":[16],"states":[16],"config":[16],"variant":[513],"size":[513],"iconPack":[16],"t":[16],"videoState":[32],"isPinned":[32]},null,{"participant":["participantsChanged"],"videoState":["videoStateChanged"]}]]],["rtk-simple-grid",[[1,"rtk-simple-grid",{"participants":[16],"aspectRatio":[1,"aspect-ratio"],"gap":[2],"size":[513],"meeting":[16],"states":[16],"config":[16],"iconPack":[16],"t":[16],"dimensions":[32],"mediaConnection":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-spotlight-grid",[[1,"rtk-spotlight-grid",{"layout":[513],"participants":[16],"pinnedParticipants":[16],"aspectRatio":[1,"aspect-ratio"],"gap":[2],"size":[513],"meeting":[16],"states":[16],"config":[16],"iconPack":[16],"t":[16],"gridSize":[16]}]]],["rtk-stage",[[1,"rtk-stage",{"iconPack":[16],"t":[16]}]]],["rtk-ui-provider",[[4,"rtk-ui-provider",{"meeting":[16],"iconPack":[16],"t":[16],"config":[16],"mode":[513],"showSetupScreen":[4,"show-setup-screen"],"overrides":[16]},null,{"meeting":["meetingChanged"],"iconPack":["iconPackChanged"],"t":["tChanged"],"config":["configChanged"],"overrides":["overridesChanged"]}]]],["rtk-chat-message",[[1,"rtk-chat-message",{"message":[16],"isContinued":[4,"is-continued"],"child":[16],"isUnread":[4,"is-unread"],"size":[513],"iconPack":[16],"t":[16],"isSelf":[4,"is-self"],"canEdit":[4,"can-edit"],"canDelete":[4,"can-delete"],"canReply":[4,"can-reply"],"canPin":[4,"can-pin"],"disableControls":[4,"disable-controls"],"alignRight":[4,"align-right"],"senderDisplayPicture":[1,"sender-display-picture"],"hideAvatar":[4,"hide-avatar"],"leftAlign":[4,"left-align"],"now":[32]}]]],["rtk-notification",[[1,"rtk-notification",{"notification":[16],"paused":[4],"size":[513],"iconPack":[16],"t":[16],"imageState":[32]},null,{"paused":["pausedChanged"],"notification":["notificationChanged"]}]]],["rtk-name-tag",[[1,"rtk-name-tag",{"participant":[16],"meeting":[16],"size":[513],"isScreenShare":[4,"is-screen-share"],"variant":[513],"iconPack":[16],"t":[16],"length":[32]},null,{"size":["sizeChanged"]}]]],["rtk-transcript",[[1,"rtk-transcript",{"transcript":[16],"t":[16],"timeout":[32]},null,{"transcript":["transcriptChanged"]}]]],["rtk-fullscreen-toggle",[[1,"rtk-fullscreen-toggle",{"states":[16],"targetElement":[16],"variant":[513],"size":[513],"iconPack":[16],"t":[16],"fullScreenActive":[32],"isFullScreenSupported":[32]}]]],["rtk-spotlight-indicator",[[1,"rtk-spotlight-indicator",{"meeting":[16],"iconPack":[16],"t":[16],"size":[513],"canSpotlight":[32],"isSpotlighted":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-audio-visualizer_4",[[1,"rtk-audio-visualizer",{"variant":[513],"participant":[16],"size":[513],"iconPack":[16],"t":[16],"hideMuted":[4,"hide-muted"],"isScreenShare":[4,"is-screen-share"],"audioEnabled":[32],"volume":[32]},null,{"participant":["participantChanged"]}],[1,"rtk-speaker-selector",{"meeting":[16],"states":[16],"variant":[1],"size":[513],"iconPack":[16],"t":[16],"speakerDevices":[32],"currentDevices":[32]},null,{"meeting":["meetingChanged"]}],[1,"rtk-microphone-selector",{"meeting":[16],"size":[513],"iconPack":[16],"variant":[1],"t":[16],"audioinputDevices":[32],"canProduceAudio":[32],"currentDevices":[32]},null,{"meeting":["meetingChanged"]}],[1,"rtk-switch",{"checked":[1028],"readonly":[4],"disabled":[516],"iconPack":[16],"t":[16]},null,{"checked":["checkedChange"]}]]],["rtk-settings-audio_2",[[1,"rtk-settings-audio",{"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16]}],[1,"rtk-settings-video",{"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"videoEnabled":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-plugin-main_2",[[1,"rtk-tab-bar",{"size":[513],"meeting":[16],"states":[16],"config":[16],"layout":[513],"iconPack":[16],"t":[16],"activeTab":[16],"tabs":[16]}],[1,"rtk-plugin-main",{"meeting":[16],"plugin":[16],"iconPack":[16],"t":[16],"canDeactivatePlugin":[32]},null,{"plugin":["pluginChanged"]}]]],["rtk-dialog",[[1,"rtk-dialog",{"hideCloseButton":[4,"hide-close-button"],"disableEscapeKey":[4,"disable-escape-key"],"meeting":[16],"config":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"open":[1540]}]]],["rtk-sidebar-ui",[[1,"rtk-sidebar-ui",{"view":[513],"tabs":[16],"hideHeader":[4,"hide-header"],"hideCloseAction":[4,"hide-close-action"],"currentTab":[1,"current-tab"],"iconPack":[16],"focusCloseButton":[4,"focus-close-button"],"t":[16]},null,{"currentTab":["handleFocusCloseButton"]}]]],["rtk-ai-transcriptions",[[1,"rtk-ai-transcriptions",{"meeting":[16],"iconPack":[16],"t":[16],"initialTranscriptions":[16],"searchQuery":[32],"isProcessing":[32],"transcriptions":[32]},null,{"meeting":["meetingChanged"],"transcriptions":["transcriptionsChanged"]}]]],["rtk-poll_2",[[1,"rtk-poll-form",{"iconPack":[16],"t":[16],"options":[32],"anonymous":[32],"hideVotes":[32],"error":[32]}],[1,"rtk-poll",{"poll":[16],"self":[1],"permissions":[16],"iconPack":[16],"t":[16]}]]],["rtk-ai_3",[[1,"rtk-polls",{"meeting":[16],"config":[16],"size":[513],"iconPack":[16],"t":[16],"create":[32],"polls":[32],"permissions":[32]},null,{"meeting":["meetingChanged"]}],[1,"rtk-ai",{"meeting":[16],"states":[16],"config":[16],"iconPack":[16],"t":[16],"size":[513],"view":[513]}],[1,"rtk-plugins",{"meeting":[16],"config":[16],"size":[513],"iconPack":[16],"t":[16],"plugins":[32],"activatedPluginsId":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-livestream-indicator_3",[[1,"rtk-livestream-player",{"meeting":[16],"size":[513],"t":[16],"iconPack":[16],"playbackUrl":[32],"isSupported":[32],"playerState":[32],"livestreamState":[32],"playerError":[32],"livestreamId":[32],"audioPlaybackError":[32],"qualityLevels":[32],"selectedQuality":[32],"currentTime":[32],"duration":[32],"hideControls":[32],"isDragging":[32],"seekPosition":[32],"isSeeking":[32]},null,{"livestreamState":["updateLivestreamId"],"meeting":["meetingChanged"]}],[1,"rtk-livestream-indicator",{"meeting":[16],"size":[513],"t":[16],"iconPack":[16],"isLivestreaming":[32]},null,{"meeting":["meetingChanged"]}],[1,"rtk-viewer-count",{"meeting":[16],"variant":[513],"iconPack":[16],"t":[16],"viewerCount":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-logo",[[1,"rtk-logo",{"logoUrl":[1025,"logo-url"],"config":[16],"meeting":[16],"t":[16]},null,{"config":["configChanged"],"meeting":["meetingChanged"]}]]],["rtk-participant_2",[[1,"rtk-participant",{"meeting":[16],"states":[16],"view":[1],"participant":[16],"iconPack":[16],"t":[16],"config":[16],"audioEnabled":[32],"videoEnabled":[32],"isPinned":[32],"isHidden":[32],"isOnStage":[32],"canDisableParticipantAudio":[32],"canDisableParticipantVideo":[32],"canKickParticipant":[32],"canPinParticipant":[32],"canAllowParticipantOnStage":[32],"menuOpen":[32]},null,{"meeting":["meetingChanged"],"participant":["participantChanged"]}],[0,"rtk-virtualized-participant-list",{"items":[16],"renderItem":[16],"itemHeight":[1026,"item-height"],"bufferedItemsCount":[2,"buffered-items-count"],"emptyListElement":[16],"visibleStart":[32],"visibleEnd":[32]},null,{"items":["itemsChanged"]}]]],["rtk-participants-stage-list_4",[[1,"rtk-participants-viewer-list",{"meeting":[16],"config":[16],"size":[513],"hideHeader":[4,"hide-header"],"iconPack":[16],"view":[1],"search":[1],"t":[16],"stageViewers":[32]},null,{"meeting":["meetingChanged"],"search":["searchChanged"]}],[1,"rtk-participants-stage-queue",{"meeting":[16],"config":[16],"size":[513],"iconPack":[16],"view":[1],"t":[16],"stageRequestedParticipants":[32]},null,{"meeting":["meetingChanged"]}],[1,"rtk-participants-waiting-list",{"meeting":[16],"config":[16],"size":[513],"iconPack":[16],"view":[1],"t":[16],"waitlistedParticipants":[32]},null,{"meeting":["meetingChanged"]}],[1,"rtk-participants-stage-list",{"meeting":[16],"states":[16],"config":[16],"size":[513],"hideHeader":[4,"hide-header"],"iconPack":[16],"view":[1],"t":[16],"search":[1],"participants":[32]},null,{"meeting":["meetingChanged"],"search":["searchChanged"]}]]],["rtk-camera-selector_2",[[1,"rtk-participant-tile",{"nameTagPosition":[513,"name-tag-position"],"isPreview":[4,"is-preview"],"participant":[16],"meeting":[16],"states":[16],"config":[16],"variant":[513],"size":[513],"iconPack":[16],"t":[16],"isPinned":[32],"mediaConnectionError":[32]},null,{"meeting":["meetingChanged"],"participant":["participantsChanged"]}],[1,"rtk-camera-selector",{"meeting":[16],"size":[513],"iconPack":[16],"variant":[1],"t":[16],"videoDevices":[32],"currentDevice":[32],"canProduceVideo":[32]},null,{"meeting":["meetingChanged"]}]]],["rtk-breakout-room-manager_3",[[1,"rtk-breakout-room-manager",{"meeting":[16],"assigningParticipants":[4,"assigning-participants"],"mode":[1],"states":[16],"allowDelete":[4,"allow-delete"],"iconPack":[16],"t":[16],"isDragMode":[4,"is-drag-mode"],"room":[16],"defaultExpanded":[4,"default-expanded"],"editingTitleRoomId":[32],"newTitle":[32],"showExpandedCard":[32],"glowingCard":[32]}],[1,"rtk-breakout-room-participants",{"meeting":[16],"participantIds":[16],"iconPack":[16],"t":[16],"selectedParticipantIds":[16],"search":[32],"participantsToShow":[32],"isDragging":[32]},null,{"meeting":["meetingChanged"],"participantIds":["participantsChanged"],"search":["searchChanged"]}],[1,"rtk-counter",{"size":[513],"value":[2],"minValue":[2,"min-value"],"iconPack":[16],"t":[16],"input":[32]},null,{"input":["watchStateHandler"]}]]],["rtk-file-message_3",[[0,"rtk-image-message",{"message":[16],"now":[16],"isContinued":[516,"is-continued"],"iconPack":[16],"t":[16],"showBubble":[4,"show-bubble"],"status":[32]}],[0,"rtk-file-message",{"message":[16],"now":[16],"isContinued":[516,"is-continued"],"iconPack":[16],"t":[16],"showBubble":[4,"show-bubble"]}],[0,"rtk-text-message",{"message":[16],"now":[16],"isContinued":[516,"is-continued"],"iconPack":[16],"t":[16],"showBubble":[4,"show-bubble"]}]]],["rtk-debugger-audio_4",[[1,"rtk-debugger-audio",{"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"isNetworkOpen":[32],"isDevicesOpen":[32],"audioProducerFormattedStats":[32],"audioProducerScoreStats":[32],"networkBasedMediaHealth":[32],"devicesHealth":[32]},null,{"audioProducerScoreStats":["audioProducerScoreStatsChanged"],"meeting":["meetingChanged"]}],[1,"rtk-debugger-screenshare",{"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"isNetworkOpen":[32],"isDevicesOpen":[32],"videoProducerFormattedStats":[32],"videoProducerScoreStats":[32],"audioProducerFormattedStats":[32],"audioProducerScoreStats":[32],"networkBasedMediaHealth":[32]},null,{"videoProducerScoreStats":["videoProducerScoreStatsChanged"],"audioProducerScoreStats":["audioProducerScoreStatsChanged"],"meeting":["meetingChanged"]}],[1,"rtk-debugger-system",{"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"isBatterySectionOpen":[32],"batterySectionHealth":[32],"battery":[32],"batteryFormattedStats":[32]},null,{"meeting":["meetingChanged"]}],[1,"rtk-debugger-video",{"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"isNetworkOpen":[32],"isDevicesOpen":[32],"videoProducerFormattedStats":[32],"videoProducerScoreStats":[32],"networkBasedMediaHealth":[32],"devicesHealth":[32]},null,{"videoProducerScoreStats":["videoProducerScoreStatsChanged"],"meeting":["meetingChanged"]}]]],["rtk-breakout-rooms-manager_9",[[1,"rtk-breakout-rooms-manager",{"meeting":[16],"states":[16],"iconPack":[16],"t":[16],"loading":[32],"roomConfig":[32],"draftState":[32],"assigningParticipants":[32],"selectedParticipants":[32],"ephemeralStatusText":[32],"isDragMode":[32]},[[0,"participantDelete","onParticipantDelete"],[0,"participantsDragging","toggleDragMode"],[0,"selectedParticipantsUpdate","updateSelectedParticipants"],[0,"allParticipantsToggleUpdate","updateAllParticipants"]],{"selectedParticipants":["onSelectedParticipantsChanged"]}],[1,"rtk-debugger",{"meeting":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"activeTab":[32],"isMobileMainVisible":[32],"progress":[32]},[[0,"testProgress","progressUpdate"]]],[1,"rtk-broadcast-message-modal",{"meeting":[16],"states":[16],"iconPack":[16],"t":[16],"messagePayload":[32],"successMessage":[32]}],[1,"rtk-join-stage",{"meeting":[16],"config":[16],"states":[16],"size":[513],"iconPack":[16],"t":[16],"dataConfig":[16],"isLoading":[32]}],[1,"rtk-permissions-message",{"meeting":[16],"t":[16],"iconPack":[16],"states":[16],"device":[32],"currentStep":[32],"svgSteps":[32]},null,{"meeting":["meetingChanged"]}],[1,"rtk-confirmation-modal",{"meeting":[16],"states":[16],"iconPack":[16],"t":[16]}],[1,"rtk-leave-meeting",{"meeting":[16],"states":[16],"iconPack":[16],"t":[16],"canEndMeeting":[32]},null,{"meeting":["meetingChanged"]}],[1,"rtk-mute-all-confirmation",{"meeting":[16],"states":[16],"iconPack":[16],"t":[16],"allowUnmute":[32]}],[1,"rtk-overlay-modal",{"meeting":[16],"states":[16],"iconPack":[16],"t":[16]}]]],["rtk-controlbar-button",[[17,"rtk-controlbar-button",{"variant":[513],"showWarning":[4,"show-warning"],"size":[513],"label":[1],"icon":[1],"isLoading":[4,"is-loading"],"disabled":[516],"iconPack":[16],"brandIcon":[516,"brand-icon"]}]]]]'),e)};let nbt=0;function E3n(){return++nbt}function N3n(){nbt=0}const rbt="temp-";function T3n(){return{id:`${rbt}${Math.random().toString(36)}`,title:`Room ${E3n()}`,participants:[]}}function Ece(t){return t.includes(rbt)}function _3n(t,e){const n=t.length,r=Math.ceil(n/e),s=new Array(e);let i=0;for(let o=0;o<e;o++)s[o]=t.slice(i,i+r),i+=r;return s.filter(o=>o.length)}function bl(t){return t.customParticipantId}function sbt(t){const e=new Map;return[t.self,...t.participants.joined.toArray()].map(n=>{e.set(bl(n),n.picture)}),[t.connectedMeetings.parentMeeting,...t.connectedMeetings.meetings].flatMap(n=>n.participants).map(n=>({id:n.id,customParticipantId:bl(n),displayName:n.displayName,displayPictureUrl:n.displayPictureUrl!==""?n.displayPictureUrl:e.get(bl(n))}))}const h7e=t=>{const e=t.self.permissions.connectedMeetings;return e.canAlterConnectedMeetings?!0:e.canSwitchConnectedMeetings||e.canSwitchToParentMeeting?t.connectedMeetings.isActive:!1};var Jh=function(t,e,n,r,s){if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return e.set(t,n),n},gr=function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},A3n=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n},Kh,Ow,ag,og,aj,sm,d1,lg,d$,u$,ibt,_Q,abt,obt,A_;class P3n{constructor(){Kh.add(this),Ow.set(this,!1),ag.set(this,void 0),og.set(this,void 0),aj.set(this,void 0),sm.set(this,void 0),d1.set(this,void 0),lg.set(this,void 0),d$.set(this,void 0),u$.set(this,void 0)}get hasLocalChanges(){return gr(this,Ow,"f")}get currentState(){let e,n=[];return Array.from(gr(this,sm,"f").keys()).forEach(r=>{const s=gr(this,lg,"f").get(r);s.isParent?e=Object.assign(Object.assign({},s),{participants:gr(this,Kh,"m",A_).call(this,r)}):n.push(Object.assign(Object.assign({},s),{participants:gr(this,Kh,"m",A_).call(this,r)}))}),{parentMeeting:e,meetings:n}}get allConnectedMeetings(){return this.currentState.meetings.sort((e,n)=>e.title.localeCompare(n.title))}get allParticipants(){return Array.from(gr(this,d1,"f").values())}get unassignedParticipants(){return gr(this,Kh,"m",A_).call(this,gr(this,ag,"f").parentMeeting.id)}getParticipantsForMeeting(e){return gr(this,Kh,"m",A_).call(this,e)}addNewMeeting(){Jh(this,Ow,!0);const e=T3n(),n=A3n(e,["participants"]);return gr(this,Kh,"m",_Q).call(this,Object.assign(Object.assign({},n),{isParent:!1})),n}addNewMeetings(e){return Array.from({length:e}).map(()=>this.addNewMeeting())}updateMeetingTitle(e,n){gr(this,lg,"f").get(e).title=n,Ece(e)||gr(this,d$,"f").add(e)}deleteMeeting(e){Jh(this,Ow,!0);const n=gr(this,lg,"f").get(e),r=gr(this,Kh,"m",A_).call(this,n.id).map(bl);this.assignParticipantsToMeeting(r,gr(this,ag,"f").parentMeeting.id),gr(this,lg,"f").delete(n.id),gr(this,sm,"f").delete(n.id),Ece(n.id)||gr(this,u$,"f").add(n.id)}assignParticipantsToMeeting(e,n){return Jh(this,Ow,!0),e.forEach(r=>{const s=gr(this,og,"f").get(r);gr(this,sm,"f").get(s).delete(r),gr(this,sm,"f").get(n).add(r),gr(this,og,"f").set(r,n)}),this.currentState}assignParticipantsRandomly(){const e=_3n(this.unassignedParticipants,this.allConnectedMeetings.length);return this.allConnectedMeetings.forEach((n,r)=>{const s=e[r];s&&s.length!==0&&this.assignParticipantsToMeeting(s.map(i=>i.customParticipantId),n.id)}),this.currentState}unassignParticipants(e){const n=gr(this,ag,"f").parentMeeting.id;return this.assignParticipantsToMeeting(e,n)}unassignAllParticipants(){const e=gr(this,ag,"f").parentMeeting.id,n=this.allParticipants.map(bl);return this.assignParticipantsToMeeting(n,e)}updateCurrentState(e){gr(this,Ow,"f")||gr(this,Kh,"m",ibt).call(this,e),[e.parentMeeting,...e.meetings].forEach((n,r)=>{const s=Object.assign(Object.assign({},n),{isParent:r===0});gr(this,Kh,"m",_Q).call(this,s),n.participants.forEach(i=>{gr(this,Kh,"m",abt).call(this,i,s)})})}get meetingsToCreate(){return this.allConnectedMeetings.filter(e=>Ece(e.id)).map(({id:e,title:n})=>({id:e,title:n}))}get meetingsToUpdate(){return this.allConnectedMeetings.filter(e=>gr(this,d$,"f").has(e.id)).map(({id:e,title:n})=>({id:e,title:n}))}get meetingsToDelete(){return Array.from(gr(this,u$,"f"))}get participantsToMove(){const e=new Map;return Array.from(gr(this,og,"f").keys()).forEach(n=>{const r=gr(this,aj,"f").get(n),s=gr(this,og,"f").get(n);if(r===s)return;const i=`${r}__${s}`;e.has(i)||e.set(i,[]);const o=gr(this,d1,"f").get(n);e.get(i).push(o.id)}),Array.from(e.keys()).map(n=>{const[r,s]=n.split("__");return{sourceMeetingId:r,destinationMeetingId:s,participantIds:e.get(n)}})}async applyChanges(e){const n=this.meetingsToCreate.length!==0?e.connectedMeetings.createMeetings(this.meetingsToCreate):Promise.resolve([]),r=this.meetingsToUpdate.length!==0?e.connectedMeetings.updateMeetings(this.meetingsToUpdate):Promise.resolve(),[s]=await Promise.all([n,r]);s&&s.forEach(i=>{this.meetingsToCreate.forEach(o=>{o.title===i.title&&gr(this,Kh,"m",obt).call(this,gr(this,lg,"f").get(o.id),i.id)})}),this.participantsToMove.length!==0&&this.participantsToMove.forEach(({sourceMeetingId:i,destinationMeetingId:o,participantIds:l})=>{e.connectedMeetings.moveParticipants(i,o,l)}),this.meetingsToDelete.length!==0&&e.connectedMeetings.deleteMeetings(this.meetingsToDelete)}discardChanges(){return Jh(this,Ow,!1),this.updateCurrentState(gr(this,ag,"f")),this.currentState}}Ow=new WeakMap,ag=new WeakMap,og=new WeakMap,aj=new WeakMap,sm=new WeakMap,d1=new WeakMap,lg=new WeakMap,d$=new WeakMap,u$=new WeakMap,Kh=new WeakSet,ibt=function(e){Jh(this,ag,e),Jh(this,lg,new Map),Jh(this,d1,new Map),Jh(this,d$,new Set),Jh(this,u$,new Set),Jh(this,sm,new Map),Jh(this,og,new Map),Jh(this,aj,new Map),Jh(this,aj,new Map),gr(this,ag,"f").parentMeeting.participants.forEach(n=>{gr(this,aj,"f").set(bl(n),gr(this,ag,"f").parentMeeting.id)}),gr(this,ag,"f").meetings.forEach(n=>{n.participants.forEach(r=>{gr(this,aj,"f").set(bl(r),n.id)})})},_Q=function(e){gr(this,lg,"f").has(e.id)||(gr(this,lg,"f").set(e.id,e),gr(this,sm,"f").set(e.id,new Set))},abt=function(e,n){gr(this,d1,"f").has(bl(e))||(gr(this,d1,"f").set(bl(e),e),gr(this,og,"f").set(bl(e),n.id),gr(this,sm,"f").get(n.id).add(bl(e)))},obt=function(e,n){const r=e.id;gr(this,Kh,"m",_Q).call(this,Object.assign(Object.assign({},e),{id:n})),gr(this,lg,"f").delete(r);const s=gr(this,sm,"f").get(r);gr(this,sm,"f").set(n,s),gr(this,sm,"f").delete(r),Array.from(gr(this,og,"f").keys()).forEach(i=>{gr(this,og,"f").get(i)===r&&gr(this,og,"f").set(i,n)})},A_=function(e){return Array.from(gr(this,sm,"f").get(e)).map(r=>gr(this,d1,"f").get(r))};var R3n=typeof global=="object"&&global&&global.Object===Object&&global;const lbt=R3n;var I3n=typeof self=="object"&&self&&self.Object===Object&&self,M3n=lbt||I3n||Function("return this")();const Yg=M3n;var L3n=Yg.Symbol;const RR=L3n;var cbt=Object.prototype,D3n=cbt.hasOwnProperty,$3n=cbt.toString,f3=RR?RR.toStringTag:void 0;function O3n(t){var e=D3n.call(t,f3),n=t[f3];try{t[f3]=void 0;var r=!0}catch{}var s=$3n.call(t);return r&&(e?t[f3]=n:delete t[f3]),s}var F3n=Object.prototype,B3n=F3n.toString;function U3n(t){return B3n.call(t)}var z3n="[object Null]",V3n="[object Undefined]",m7e=RR?RR.toStringTag:void 0;function GE(t){return t==null?t===void 0?V3n:z3n:m7e&&m7e in Object(t)?O3n(t):U3n(t)}function CS(t){return t!=null&&typeof t=="object"}var H3n=Array.isArray;const y6=H3n;function Mg(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var G3n="[object AsyncFunction]",W3n="[object Function]",q3n="[object GeneratorFunction]",K3n="[object Proxy]";function gNe(t){if(!Mg(t))return!1;var e=GE(t);return e==W3n||e==q3n||e==G3n||e==K3n}var Y3n=Yg["__core-js_shared__"];const Nce=Y3n;var f7e=function(){var t=/[^.]+$/.exec(Nce&&Nce.keys&&Nce.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function Q3n(t){return!!f7e&&f7e in t}var Z3n=Function.prototype,J3n=Z3n.toString;function WE(t){if(t!=null){try{return J3n.call(t)}catch{}try{return t+""}catch{}}return""}var X3n=/[\\^$.*+?()[\]{}|]/g,e4n=/^\[object .+?Constructor\]$/,t4n=Function.prototype,n4n=Object.prototype,r4n=t4n.toString,s4n=n4n.hasOwnProperty,i4n=RegExp("^"+r4n.call(s4n).replace(X3n,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function a4n(t){if(!Mg(t)||Q3n(t))return!1;var e=gNe(t)?i4n:e4n;return e.test(WE(t))}function o4n(t,e){return t==null?void 0:t[e]}function qE(t,e){var n=o4n(t,e);return a4n(n)?n:void 0}var l4n=qE(Yg,"WeakMap");const lbe=l4n;var p7e=Object.create,c4n=function(){function t(){}return function(e){if(!Mg(e))return{};if(p7e)return p7e(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}();const d4n=c4n;function u4n(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}var h4n=function(){try{var t=qE(Object,"defineProperty");return t({},"",{}),t}catch{}}();const AQ=h4n;function m4n(t,e){for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}var f4n=9007199254740991,p4n=/^(?:0|[1-9]\d*)$/;function dbt(t,e){var n=typeof t;return e=e??f4n,!!e&&(n=="number"||n!="symbol"&&p4n.test(t))&&t>-1&&t%1==0&&t<e}function vNe(t,e,n){e=="__proto__"&&AQ?AQ(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}function mne(t,e){return t===e||t!==t&&e!==e}var g4n=Object.prototype,v4n=g4n.hasOwnProperty;function ubt(t,e,n){var r=t[e];(!(v4n.call(t,e)&&mne(r,n))||n===void 0&&!(e in t))&&vNe(t,e,n)}function y4n(t,e,n,r){var s=!n;n||(n={});for(var i=-1,o=e.length;++i<o;){var l=e[i],c=void 0;c===void 0&&(c=t[l]),s?vNe(n,l,c):ubt(n,l,c)}return n}var b4n=9007199254740991;function hbt(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=b4n}function fne(t){return t!=null&&hbt(t.length)&&!gNe(t)}var x4n=Object.prototype;function yNe(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||x4n;return t===n}function w4n(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var k4n="[object Arguments]";function g7e(t){return CS(t)&&GE(t)==k4n}var mbt=Object.prototype,S4n=mbt.hasOwnProperty,C4n=mbt.propertyIsEnumerable,j4n=g7e(function(){return arguments}())?g7e:function(t){return CS(t)&&S4n.call(t,"callee")&&!C4n.call(t,"callee")};const cbe=j4n;function E4n(){return!1}var fbt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,v7e=fbt&&typeof module=="object"&&module&&!module.nodeType&&module,N4n=v7e&&v7e.exports===fbt,y7e=N4n?Yg.Buffer:void 0,T4n=y7e?y7e.isBuffer:void 0,_4n=T4n||E4n;const bNe=_4n;var A4n="[object Arguments]",P4n="[object Array]",R4n="[object Boolean]",I4n="[object Date]",M4n="[object Error]",L4n="[object Function]",D4n="[object Map]",$4n="[object Number]",O4n="[object Object]",F4n="[object RegExp]",B4n="[object Set]",U4n="[object String]",z4n="[object WeakMap]",V4n="[object ArrayBuffer]",H4n="[object DataView]",G4n="[object Float32Array]",W4n="[object Float64Array]",q4n="[object Int8Array]",K4n="[object Int16Array]",Y4n="[object Int32Array]",Q4n="[object Uint8Array]",Z4n="[object Uint8ClampedArray]",J4n="[object Uint16Array]",X4n="[object Uint32Array]",Ya={};Ya[G4n]=Ya[W4n]=Ya[q4n]=Ya[K4n]=Ya[Y4n]=Ya[Q4n]=Ya[Z4n]=Ya[J4n]=Ya[X4n]=!0;Ya[A4n]=Ya[P4n]=Ya[V4n]=Ya[R4n]=Ya[H4n]=Ya[I4n]=Ya[M4n]=Ya[L4n]=Ya[D4n]=Ya[$4n]=Ya[O4n]=Ya[F4n]=Ya[B4n]=Ya[U4n]=Ya[z4n]=!1;function eDn(t){return CS(t)&&hbt(t.length)&&!!Ya[GE(t)]}function xNe(t){return function(e){return t(e)}}var pbt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,h$=pbt&&typeof module=="object"&&module&&!module.nodeType&&module,tDn=h$&&h$.exports===pbt,Tce=tDn&&lbt.process,nDn=function(){try{var t=h$&&h$.require&&h$.require("util").types;return t||Tce&&Tce.binding&&Tce.binding("util")}catch{}}();const IR=nDn;var b7e=IR&&IR.isTypedArray,rDn=b7e?xNe(b7e):eDn;const gbt=rDn;var sDn=Object.prototype,iDn=sDn.hasOwnProperty;function vbt(t,e){var n=y6(t),r=!n&&cbe(t),s=!n&&!r&&bNe(t),i=!n&&!r&&!s&&gbt(t),o=n||r||s||i,l=o?w4n(t.length,String):[],c=l.length;for(var d in t)(e||iDn.call(t,d))&&!(o&&(d=="length"||s&&(d=="offset"||d=="parent")||i&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||dbt(d,c)))&&l.push(d);return l}function ybt(t,e){return function(n){return t(e(n))}}var aDn=ybt(Object.keys,Object);const oDn=aDn;var lDn=Object.prototype,cDn=lDn.hasOwnProperty;function dDn(t){if(!yNe(t))return oDn(t);var e=[];for(var n in Object(t))cDn.call(t,n)&&n!="constructor"&&e.push(n);return e}function uDn(t){return fne(t)?vbt(t):dDn(t)}function hDn(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}var mDn=Object.prototype,fDn=mDn.hasOwnProperty;function pDn(t){if(!Mg(t))return hDn(t);var e=yNe(t),n=[];for(var r in t)r=="constructor"&&(e||!fDn.call(t,r))||n.push(r);return n}function bbt(t){return fne(t)?vbt(t,!0):pDn(t)}var gDn=qE(Object,"create");const b6=gDn;function vDn(){this.__data__=b6?b6(null):{},this.size=0}function yDn(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var bDn="__lodash_hash_undefined__",xDn=Object.prototype,wDn=xDn.hasOwnProperty;function kDn(t){var e=this.__data__;if(b6){var n=e[t];return n===bDn?void 0:n}return wDn.call(e,t)?e[t]:void 0}var SDn=Object.prototype,CDn=SDn.hasOwnProperty;function jDn(t){var e=this.__data__;return b6?e[t]!==void 0:CDn.call(e,t)}var EDn="__lodash_hash_undefined__";function NDn(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=b6&&e===void 0?EDn:e,this}function z2(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}z2.prototype.clear=vDn;z2.prototype.delete=yDn;z2.prototype.get=kDn;z2.prototype.has=jDn;z2.prototype.set=NDn;function TDn(){this.__data__=[],this.size=0}function pne(t,e){for(var n=t.length;n--;)if(mne(t[n][0],e))return n;return-1}var _Dn=Array.prototype,ADn=_Dn.splice;function PDn(t){var e=this.__data__,n=pne(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():ADn.call(e,n,1),--this.size,!0}function RDn(t){var e=this.__data__,n=pne(e,t);return n<0?void 0:e[n][1]}function IDn(t){return pne(this.__data__,t)>-1}function MDn(t,e){var n=this.__data__,r=pne(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}function L0(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}L0.prototype.clear=TDn;L0.prototype.delete=PDn;L0.prototype.get=RDn;L0.prototype.has=IDn;L0.prototype.set=MDn;var LDn=qE(Yg,"Map");const x6=LDn;function DDn(){this.size=0,this.__data__={hash:new z2,map:new(x6||L0),string:new z2}}function $Dn(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}function gne(t,e){var n=t.__data__;return $Dn(e)?n[typeof e=="string"?"string":"hash"]:n.map}function ODn(t){var e=gne(this,t).delete(t);return this.size-=e?1:0,e}function FDn(t){return gne(this,t).get(t)}function BDn(t){return gne(this,t).has(t)}function UDn(t,e){var n=gne(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}function MI(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}MI.prototype.clear=DDn;MI.prototype.delete=ODn;MI.prototype.get=FDn;MI.prototype.has=BDn;MI.prototype.set=UDn;function zDn(t,e){for(var n=-1,r=e.length,s=t.length;++n<r;)t[s+n]=e[n];return t}var VDn=ybt(Object.getPrototypeOf,Object);const xbt=VDn;function HDn(){this.__data__=new L0,this.size=0}function GDn(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}function WDn(t){return this.__data__.get(t)}function qDn(t){return this.__data__.has(t)}var KDn=200;function YDn(t,e){var n=this.__data__;if(n instanceof L0){var r=n.__data__;if(!x6||r.length<KDn-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new MI(r)}return n.set(t,e),this.size=n.size,this}function KE(t){var e=this.__data__=new L0(t);this.size=e.size}KE.prototype.clear=HDn;KE.prototype.delete=GDn;KE.prototype.get=WDn;KE.prototype.has=qDn;KE.prototype.set=YDn;var wbt=typeof exports=="object"&&exports&&!exports.nodeType&&exports,x7e=wbt&&typeof module=="object"&&module&&!module.nodeType&&module,QDn=x7e&&x7e.exports===wbt,w7e=QDn?Yg.Buffer:void 0,k7e=w7e?w7e.allocUnsafe:void 0;function kbt(t,e){if(e)return t.slice();var n=t.length,r=k7e?k7e(n):new t.constructor(n);return t.copy(r),r}function ZDn(t,e){for(var n=-1,r=t==null?0:t.length,s=0,i=[];++n<r;){var o=t[n];e(o,n,t)&&(i[s++]=o)}return i}function JDn(){return[]}var XDn=Object.prototype,e$n=XDn.propertyIsEnumerable,S7e=Object.getOwnPropertySymbols,t$n=S7e?function(t){return t==null?[]:(t=Object(t),ZDn(S7e(t),function(e){return e$n.call(t,e)}))}:JDn;const n$n=t$n;function r$n(t,e,n){var r=e(t);return y6(t)?r:zDn(r,n(t))}function s$n(t){return r$n(t,uDn,n$n)}var i$n=qE(Yg,"DataView");const dbe=i$n;var a$n=qE(Yg,"Promise");const ube=a$n;var o$n=qE(Yg,"Set");const hbe=o$n;var C7e="[object Map]",l$n="[object Object]",j7e="[object Promise]",E7e="[object Set]",N7e="[object WeakMap]",T7e="[object DataView]",c$n=WE(dbe),d$n=WE(x6),u$n=WE(ube),h$n=WE(hbe),m$n=WE(lbe),FC=GE;(dbe&&FC(new dbe(new ArrayBuffer(1)))!=T7e||x6&&FC(new x6)!=C7e||ube&&FC(ube.resolve())!=j7e||hbe&&FC(new hbe)!=E7e||lbe&&FC(new lbe)!=N7e)&&(FC=function(t){var e=GE(t),n=e==l$n?t.constructor:void 0,r=n?WE(n):"";if(r)switch(r){case c$n:return T7e;case d$n:return C7e;case u$n:return j7e;case h$n:return E7e;case m$n:return N7e}return e});const wNe=FC;var f$n=Object.prototype,p$n=f$n.hasOwnProperty;function g$n(t){var e=t.length,n=new t.constructor(e);return e&&typeof t[0]=="string"&&p$n.call(t,"index")&&(n.index=t.index,n.input=t.input),n}var v$n=Yg.Uint8Array;const _7e=v$n;function kNe(t){var e=new t.constructor(t.byteLength);return new _7e(e).set(new _7e(t)),e}function y$n(t,e){var n=kNe(t.buffer);return new t.constructor(n,t.byteOffset,t.byteLength)}var b$n=/\w*$/;function x$n(t){var e=new t.constructor(t.source,b$n.exec(t));return e.lastIndex=t.lastIndex,e}var A7e=RR?RR.prototype:void 0,P7e=A7e?A7e.valueOf:void 0;function w$n(t){return P7e?Object(P7e.call(t)):{}}function Sbt(t,e){var n=e?kNe(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var k$n="[object Boolean]",S$n="[object Date]",C$n="[object Map]",j$n="[object Number]",E$n="[object RegExp]",N$n="[object Set]",T$n="[object String]",_$n="[object Symbol]",A$n="[object ArrayBuffer]",P$n="[object DataView]",R$n="[object Float32Array]",I$n="[object Float64Array]",M$n="[object Int8Array]",L$n="[object Int16Array]",D$n="[object Int32Array]",$$n="[object Uint8Array]",O$n="[object Uint8ClampedArray]",F$n="[object Uint16Array]",B$n="[object Uint32Array]";function U$n(t,e,n){var r=t.constructor;switch(e){case A$n:return kNe(t);case k$n:case S$n:return new r(+t);case P$n:return y$n(t);case R$n:case I$n:case M$n:case L$n:case D$n:case $$n:case O$n:case F$n:case B$n:return Sbt(t,n);case C$n:return new r;case j$n:case T$n:return new r(t);case E$n:return x$n(t);case N$n:return new r;case _$n:return w$n(t)}}function Cbt(t){return typeof t.constructor=="function"&&!yNe(t)?d4n(xbt(t)):{}}var z$n="[object Map]";function V$n(t){return CS(t)&&wNe(t)==z$n}var R7e=IR&&IR.isMap,H$n=R7e?xNe(R7e):V$n;const G$n=H$n;var W$n="[object Set]";function q$n(t){return CS(t)&&wNe(t)==W$n}var I7e=IR&&IR.isSet,K$n=I7e?xNe(I7e):q$n;const Y$n=K$n;var Q$n=1,jbt="[object Arguments]",Z$n="[object Array]",J$n="[object Boolean]",X$n="[object Date]",eOn="[object Error]",Ebt="[object Function]",tOn="[object GeneratorFunction]",nOn="[object Map]",rOn="[object Number]",Nbt="[object Object]",sOn="[object RegExp]",iOn="[object Set]",aOn="[object String]",oOn="[object Symbol]",lOn="[object WeakMap]",cOn="[object ArrayBuffer]",dOn="[object DataView]",uOn="[object Float32Array]",hOn="[object Float64Array]",mOn="[object Int8Array]",fOn="[object Int16Array]",pOn="[object Int32Array]",gOn="[object Uint8Array]",vOn="[object Uint8ClampedArray]",yOn="[object Uint16Array]",bOn="[object Uint32Array]",Aa={};Aa[jbt]=Aa[Z$n]=Aa[cOn]=Aa[dOn]=Aa[J$n]=Aa[X$n]=Aa[uOn]=Aa[hOn]=Aa[mOn]=Aa[fOn]=Aa[pOn]=Aa[nOn]=Aa[rOn]=Aa[Nbt]=Aa[sOn]=Aa[iOn]=Aa[aOn]=Aa[oOn]=Aa[gOn]=Aa[vOn]=Aa[yOn]=Aa[bOn]=!0;Aa[eOn]=Aa[Ebt]=Aa[lOn]=!1;function OW(t,e,n,r,s,i){var o,l=e&Q$n;if(o!==void 0)return o;if(!Mg(t))return t;var c=y6(t);if(c)o=g$n(t);else{var d=wNe(t),u=d==Ebt||d==tOn;if(bNe(t))return kbt(t,l);if(d==Nbt||d==jbt||u&&!s)o=u?{}:Cbt(t);else{if(!Aa[d])return s?t:{};o=U$n(t,d,l)}}i||(i=new KE);var h=i.get(t);if(h)return h;i.set(t,o),Y$n(t)?t.forEach(function(p){o.add(OW(p,e,n,p,t,i))}):G$n(t)&&t.forEach(function(p,g){o.set(g,OW(p,e,n,g,t,i))});var m=s$n,f=c?void 0:m(t);return m4n(f||t,function(p,g){f&&(g=p,p=t[g]),ubt(o,g,OW(p,e,n,g,t,i))}),o}var xOn=1,wOn=4;function kOn(t){return OW(t,xOn|wOn)}function SNe(t){return structuredClone?structuredClone(t):kOn(t)}const SOn={designTokens:{spacingBase:4,googleFont:"Inter"},styles:{"rtk-header":{display:"grid",height:"48px",gridTemplateColumns:"repeat(3, 1fr)",gridTemplateRows:"1fr",alignItems:"center","--header-section-gap":"var(--rtk-space-2, 8px)"},"rtk-header.sm":{display:"grid",gridArea:"header",gridTemplateColumns:"repeat(2, 1fr)",gridTemplateRows:"1fr",alignItems:"center","--header-section-gap":"var(--rtk-space-1, 4px)"},"div#header-left":{display:"flex",alignItems:"center",height:"48px",wordBreak:"break-all",gap:"var(--header-section-gap)"},"rtk-logo":{height:"26px"},"div#header-center":{display:"flex",alignItems:"center",justifyContent:"center",wordBreak:"break-all",gap:"var(--header-section-gap)",paddingInline:"var(--rtk-space-3, 12px)"},"div#header-right":{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"var(--header-section-gap)"},"rtk-stage":{display:"flex",flex:"1"},"rtk-grid":{flex:"1",height:"auto"},"rtk-controlbar":{display:"grid",gridTemplateColumns:"repeat(3,1fr)",gridTemplateRows:"1fr",alignItems:"center",padding:"8px"},"rtk-controlbar.sm":{display:"flex",position:"relative",backgroundColor:"rgb(var(--rtk-colors-background-1000, 0 0 0))"},"rtk-controlbar.md":{display:"flex",position:"relative",backgroundColor:"rgb(var(--rtk-colors-background-1000, 0 0 0))"},"div#controlbar-left":{display:"flex",alignItems:"center",gap:"var(--rtk-space-1, 4px)"},"div#controlbar-center":{display:"flex",alignItems:"center",gap:"var(--rtk-space-1, 4px)",position:"relative",overflow:"visible",justifyContent:"center"},"div#controlbar-mobile":{display:"flex",flex:"1",alignItems:"center",gap:"var(--rtk-space-1, 4px)",justifyContent:"center"},"div#controlbar-right":{display:"flex",alignItems:"center",gap:"var(--rtk-space-1, 4px)",justifyContent:"flex-end"},"rtk-settings":{width:"720px",height:"480px"},"rtk-debugger":{width:"720px",height:"480px"},"rtk-breakout-rooms-manager":{minHeight:"400px",minWidth:"500px",maxWidth:"80%",maxHeight:"480px"},"div#setupcontrols-media":{position:"absolute",bottom:"8px",right:"8px",display:"flex",gap:"4px"},"div#setupcontrols-settings":{position:"absolute",top:"8px",right:"8px",display:"flex",flexDirection:"column",gap:"6px"},"rtk-meeting-title.sm":{marginLeft:"0"},"rtk-clock":{marginRight:"0"}},root:{"rtk-meeting":{state:"meeting",states:["activeSidebar"]},"rtk-meeting[meeting=waiting]":["rtk-waiting-screen"],"rtk-meeting[meeting=idle]":["rtk-idle-screen"],"rtk-meeting[meeting=setup]":["rtk-setup-screen","rtk-dialog-manager"],"rtk-meeting[meeting=joined]":["rtk-header","rtk-stage","rtk-controlbar","rtk-participants-audio","rtk-dialog-manager"],"rtk-meeting[meeting=joined].activeSidebar.sm":{add:[["rtk-sidebar",{view:"full-screen"}]]},"rtk-meeting[meeting=joined].activeSidebar.md":{add:[["rtk-sidebar",{view:"full-screen"}]]},"rtk-meeting[meeting=ended]":["rtk-ended-screen"],"rtk-header":["div#header-left","div#header-center","div#header-right"],"rtk-header.sm":{remove:["div#header-center"]},"div#header-left":["rtk-logo","rtk-recording-indicator","rtk-livestream-indicator"],"div#header-center":["rtk-meeting-title"],"div#header-right":["rtk-grid-pagination","rtk-clock","rtk-participant-count","rtk-viewer-count"],"div#header-left.sm":["rtk-meeting-title","rtk-recording-indicator","rtk-livestream-indicator"],"rtk-stage":{states:["activeSidebar"],children:["rtk-grid","rtk-notifications","rtk-transcripts"]},"rtk-stage.activeSidebar":{add:[["rtk-sidebar",{view:"sidebar"}]]},"rtk-stage.activeSidebar.sm":{remove:["rtk-sidebar"]},"rtk-grid":{states:["activeScreenShare","activePlugin","activeSpotlight"],children:["rtk-simple-grid"]},"rtk-grid.activeSpotlight":["rtk-spotlight-grid"],"rtk-grid.activeScreenShare":["rtk-mixed-grid"],"rtk-grid.activePlugin":["rtk-mixed-grid"],"rtk-grid.activeScreenShare.activeSpotlight":["rtk-mixed-grid"],"rtk-grid.activePlugin.activeSpotlight":["rtk-mixed-grid"],"rtk-grid.activePlugin.activeScreenShare.activeSpotlight":["rtk-mixed-grid"],"rtk-mixed-grid":{states:["activeSpotlight"],children:["rtk-simple-grid"]},"rtk-mixed-grid.activeSpotlight":["rtk-spotlight-grid"],"rtk-participant-tile":{state:"meeting",children:["rtk-name-tag","rtk-avatar","rtk-network-indicator"]},"rtk-participant-setup":["rtk-avatar","div#setupcontrols-media"],"rtk-participant-tile[meeting=setup]":["rtk-avatar","div#setupcontrols-settings","div#setupcontrols-media"],"div#setupcontrols-media":[["rtk-mic-toggle",{size:"sm"}],["rtk-camera-toggle",{size:"sm"}]],"div#setupcontrols-settings":[["rtk-settings-toggle",{size:"sm"}]],"rtk-screenshare-view":{children:["rtk-name-tag","rtk-network-indicator"]},"rtk-name-tag":[["rtk-audio-visualizer",{slot:"start"}]],"rtk-controlbar":{states:["activeMoreMenu"],props:{variant:"solid"},children:["div#controlbar-left","div#controlbar-center","div#controlbar-right"]},"rtk-more-toggle":{states:["activeMoreMenu"],children:[]},"rtk-controlbar.sm":["div#controlbar-mobile"],"rtk-controlbar.md":["div#controlbar-mobile"],"rtk-more-toggle.activeMoreMenu":[["rtk-fullscreen-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-pip-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-caption-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-mute-all-button",{variant:"horizontal",slot:"more-elements"}],["rtk-breakout-rooms-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-recording-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-debugger-toggle",{variant:"horizontal"}]],"rtk-more-toggle.activeMoreMenu.sm":[["rtk-chat-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-participants-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-polls-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-plugins-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-fullscreen-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-screen-share-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-pip-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-caption-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-mute-all-button",{variant:"horizontal",slot:"more-elements"}],["rtk-breakout-rooms-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-settings-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-ai-toggle",{variant:"horizontal"}],["rtk-debugger-toggle",{variant:"horizontal"}]],"rtk-more-toggle.activeMoreMenu.md":[["rtk-chat-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-participants-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-polls-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-plugins-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-fullscreen-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-screen-share-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-pip-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-caption-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-mute-all-button",{variant:"horizontal",slot:"more-elements"}],["rtk-breakout-rooms-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-settings-toggle",{variant:"horizontal",slot:"more-elements"}],["rtk-ai-toggle",{variant:"horizontal"}],["rtk-debugger-toggle",{variant:"horizontal"}]],"div#controlbar-mobile":["rtk-mic-toggle","rtk-camera-toggle","rtk-webinar-stage-toggle","rtk-stage-toggle","rtk-leave-button","rtk-more-toggle"],"div#controlbar-left":["rtk-settings-toggle","rtk-screen-share-toggle","rtk-livestream-toggle"],"div#controlbar-center":["rtk-mic-toggle","rtk-camera-toggle","rtk-webinar-stage-toggle","rtk-stage-toggle","rtk-more-toggle","rtk-leave-button"],"div#controlbar-right":["rtk-chat-toggle","rtk-polls-toggle","rtk-participants-toggle","rtk-plugins-toggle","rtk-ai-toggle"]},config:{notification_sounds:{participant_left:!1},participant_joined_sound_notification_limit:10,participant_chat_message_sound_notification_limit:10,videoFit:"cover"}},Os=()=>SNe(SOn),w6=t=>LI(t)?t.meta.viewType==="LIVESTREAM"&&t.stage.status!=="ON_STAGE":!1,Tbt=t=>{var e;return LI(t)?t.meta.viewType==="LIVESTREAM"&&((e=t==null?void 0:t.self)===null||e===void 0?void 0:e.permissions.canLivestream):!1},LI=t=>t==null?void 0:t.livestream;var uu;(function(t){t.BUFFERING="Buffering",t.ENDED="Ended",t.IDLE="Idle",t.PAUSED="Paused",t.PLAYING="Playing",t.READY="Ready"})(uu||(uu={}));var M7e;(function(t){t.INITIALIZED="PlayerInitialized",t.QUALITY_CHANGED="PlayerQualityChanged",t.DURATION_CHANGED="PlayerDurationChanged",t.VOLUME_CHANGED="PlayerVolumeChanged",t.MUTED_CHANGED="PlayerMutedChanged",t.PLAYBACK_RATE_CHANGED="PlayerPlaybackRateChanged",t.REBUFFERING="PlayerRebuffering",t.AUDIO_BLOCKED="PlayerAudioBlocked",t.PLAYBACK_BLOCKED="PlayerPlaybackBlocked",t.ERROR="PlayerError",t.RECOVERABLE_ERROR="PlayerRecoverableError",t.ANALYTICS_EVENT="PlayerAnalyticsEvent",t.TIME_UPDATE="PlayerTimeUpdate",t.BUFFER_UPDATE="PlayerBufferUpdate",t.SEEK_COMPLETED="PlayerSeekCompleted",t.SESSION_DATA="PlayerSessionData",t.STATE_CHANGED="PlayerStateChanged",t.WORKER_ERROR="PlayerWorkerError",t.METADATA="PlayerMetadata",t.TEXT_CUE="PlayerTextCue",t.TEXT_METADATA_CUE="PlayerTextMetadataCue",t.AD_CUE="PlayerAdCue",t.STREAM_SOURCE_CUE="PlayerStreamSourceCue",t.NETWORK_UNAVAILABLE="PlayerNetworkUnavailable",t.SEGMENT_DISCONTINUITY="PlayerSegmentDiscontinuity",t.SEGMENT_METADATA="PlayerSegmentMetadata",t.PLAYER_METADATA="PlayerMetadata"})(M7e||(M7e={}));function COn({meeting:t,hlsLevels:e}){let n=t.self.config.livestreamViewerQualities||[];if(!n.length)return{autoLevelChangeAllowed:!0,levels:e};const r=e.filter(s=>n.includes(s.height));return r.length?{autoLevelChangeAllowed:!1,levels:r}:{autoLevelChangeAllowed:!0,levels:e}}const jOn=(t,e,n)=>{let r=t.get(e);r||(r=[],t.set(e,r)),r.some(s=>s.deref()===n)||r.push(new WeakRef(n))},EOn=(t,e)=>{let n;return(...r)=>{n&&clearTimeout(n),n=setTimeout(()=>{n=0,t(...r)},e)}},NOn=t=>!("isConnected"in t)||t.isConnected,L7e=EOn(t=>{for(let e of t.keys()){const n=t.get(e).filter(r=>{const s=r.deref();return s&&NOn(s)});t.set(e,n)}},2e3),_bt=S3n,D7e=_bt.forceUpdate,$7e=_bt.getRenderingRef,TOn=()=>{if(typeof $7e!="function"||typeof D7e!="function")return{};const t=D7e,e=$7e,n=new Map;return{dispose:()=>n.clear(),get:r=>{const s=e();s&&jOn(n,r,s)},set:r=>{const s=n.get(r);if(s){const i=s.filter(o=>{const l=o.deref();return l?t(l):!1});n.set(r,i)}L7e(n)},reset:()=>{n.forEach(r=>{r.forEach(s=>{const i=s.deref();i&&t(i)})}),L7e(n)}}},_On=t=>typeof t=="function"?t():t,AOn=(t,e=(n,r)=>n!==r)=>{const n=()=>_On(t)??{},r=n();let s=new Map(Object.entries(r));const i=typeof Proxy<"u",o=i?null:{},l={dispose:[],get:[],set:[],reset:[]},c=new Map,d=()=>{s=new Map(Object.entries(n())),i||k(),l.reset.forEach(S=>S())},u=()=>{l.dispose.forEach(S=>S()),d()},h=S=>(l.get.forEach(C=>C(S)),s.get(S)),m=(S,C)=>{const j=s.get(S);e(C,j,S)&&(s.set(S,C),i||w(S),l.set.forEach(E=>E(S,C,j)))},f=i?new Proxy(r,{get(S,C){return h(C)},ownKeys(S){return Array.from(s.keys())},getOwnPropertyDescriptor(){return{enumerable:!0,configurable:!0}},has(S,C){return s.has(C)},set(S,C,j){return m(C,j),!0}}):(k(),o),p=(S,C)=>(l[S].push(C),()=>{_ce(l[S],C)}),g=(S,C)=>{const j=(_,T)=>{_===S&&C(T)},E=()=>{const _=n();C(_[S])},N=p("set",j),A=p("reset",E);return c.set(C,{setHandler:j,resetHandler:E,propName:S}),()=>{N(),A(),c.delete(C)}},v=(...S)=>{const C=S.reduce((j,E)=>(E.set&&j.push(p("set",E.set)),E.get&&j.push(p("get",E.get)),E.reset&&j.push(p("reset",E.reset)),E.dispose&&j.push(p("dispose",E.dispose)),j),[]);return()=>C.forEach(j=>j())},b=S=>{const C=s.get(S);l.set.forEach(j=>j(S,C,C))},x=(S,C)=>{const j=c.get(C);j&&j.propName===S&&(_ce(l.set,j.setHandler),_ce(l.reset,j.resetHandler),c.delete(C))};function w(S){i||!o||Object.prototype.hasOwnProperty.call(o,S)||Object.defineProperty(o,S,{configurable:!0,enumerable:!0,get(){return h(S)},set(C){m(S,C)}})}function k(){if(i||!o)return;const S=new Set(s.keys());for(const C of Object.keys(o))S.has(C)||delete o[C];for(const C of S)w(C)}return{state:f,get:h,set:m,on:p,onChange:g,use:v,dispose:u,reset:d,forceUpdate:b,removeListener:x}},_ce=(t,e)=>{const n=t.indexOf(e);n>=0&&(t[n]=t[t.length-1],t.length--)},Abt=(t,e)=>{const n=AOn(t,e);return n.use(TOn()),n},Vz={about_call:"About Call",screen:"Screen",camera:"Camera",leave:"Leave",dismiss:"Dismiss",logo:"Logo",page:"Page",more:"More","page.prev":"Previous Page","page.next":"Next Page",layout:"Layout","layout.auto":"Auto Layout",settings:"Settings",file:"File",image:"Image",connection:"Connection",leave_confirmation:"Are you sure you want to leave the call?",cancel:"Cancel",yes:"Yes","(you)":"(you)",you:"You",everyone:"Everyone",to:"To",mute:"Mute",kick:"Kick",pin:"Pin",pinned:"Pinned",accept:"Accept",unpin:"Unpin",pip_on:"Show PiP",pip_off:"Hide PiP",viewers:"Viewers",join:"Join",joined:"Joined",create:"Create",close:"Close",ask:"Ask",type:"Type",activate:"Activate",requests:"Requests",mic_off:"Mic Off",disable_mic:"Disable Mic",mic_on:"Mic On",enable_mic:"Enable Mic",audio:"Audio",test:"Test",minimize:"Hide Tile",maximize:"Show Tile",mute_all:"Mute all","mute_all.description":"Everyone else in the meeting will be muted.","mute_all.header":"Are you sure?","mute_all.allow_unmute":"Allow others to unmute",video_off:"Video Off",disable_video:"Disable Video",video_on:"Video On",enable_video:"Enable Video",video:"Video",offline:"You're offline","offline.description":"Please ensure that you are connected to the internet.",disconnected:"You haven't joined the meeting.",failed:"You've been disconnected","failed.description":"We could not connect you back to the meeting room. Please try rejoining the meeting.","disconnected.description":"Please join the meeting in order to see and interact with other participants.",participants:"Participants","participants.errors.empty_results":"Couldn't find a participant with the specified name or ID.","participants.empty_list":"It looks like nobody is here.","participants.no_pending_requests":"There are no pending requests.","participants.turn_off_video":"Turn off video",polls:"Polls","polls.by":"Poll by","polls.question":"Poll Question","polls.question.placeholder":"What is your poll for?","polls.answers":"Answers","polls.option":"Add an option.","polls.option.placeholder":"Enter an option","polls.results.anon":"Anonymous","polls.results.hide":"Hide results before voting","polls.create":"Create Poll","polls.cancel":"Cancel Poll Creation","polls.empty":"No polls available","polls.errors.question_required":"Question is required.","polls.errors.empty_option":"Empty options not allowed.",screenshare:"Screen Share","screenshare.min_preview":"Minimize Preview","screenshare.max_preview":"Expand Preview","screenshare.shared":"Your screen is being shared.","screenshare.start":"Share Screen","screenshare.stop":"Stop Sharing","screenshare.error.unknown":"An error occurred while starting screenshare.","screenshare.error.max_count":"Maximum screen share limit reached.",plugins:"Plugins","plugins.empty":"No plugins available",perm_denied:"Permission denied by browser.","perm_denied.audio":"Mic permission denied by browser","perm_denied.video":"Camera permission denied by browser","perm_denied.screenshare":"Screenshare permission denied by browser","perm_denied.audio.chrome.message":"In the top navigation bar, click on the icon left to the URL and ensure 'Microphone' permission is checked","perm_denied.video.chrome.message":"In the top navigation bar, click on the icon left to the URL and ensure 'Camera' permission is checked","perm_denied.screenshare.chrome.message":"Under Chrome settings, navigate to 'Privacy and Security > Site Settings > Permissions'. Select 'Screenshare', provide permission and reload this application.","perm_denied.audio.safari.message":"Under Safari settings, navigate to 'Websites > Microphone', provide permission and reload this application.","perm_denied.video.safari.message":"Under Safari settings, navigate to 'Websites > Camera', provide permission and reload this application.","perm_denied.screenshare.safari.message":"Under Safari settings, navigate to 'Websites > Screenshare', provide permission and reload this application.","perm_denied.audio.edge.message":"Under Edge settings, navigate to 'Site Permissions > Microphone', provide permission and reload this application.","perm_denied.video.edge.message":"Under Edge settings, navigate to 'Site Permissions > Camera', provide permission and reload this application.","perm_denied.screenshare.edge.message":"Under Edge settings, navigate to 'Site Permissions > Screenshare', provide permission and reload this application.","perm_denied.audio.microsoft edge.message":"Under Edge settings, navigate to 'Site Permissions > Microphone', provide permission and reload this application.","perm_denied.video.microsoft edge.message":"Under Edge settings, navigate to 'Site Permissions > Camera', provide permission and reload this application.","perm_denied.screenshare.microsoft edge.message":"Under Edge settings, navigate to 'Site Permissions > Screenshare', provide permission and reload this application.","perm_denied.audio.firefox.message":"Under Firefox settings, navigate to 'Privacy and Security > Permissions > Microphone', provide permission and reload this application.","perm_denied.video.firefox.message":"Under Firefox settings, navigate to 'Privacy and Security > Permissions > Camera', provide permission and reload this application.","perm_denied.screenshare.firefox.message":"Under Firefox settings, navigate to 'Privacy and Security > Permissions > Screenshare', provide permission and reload this application.","perm_denied.audio.others.message":"From your browser settings, enable 'Microphone' permissions and reload this application.","perm_denied.video.others.message":"From your browser settings, enable 'Camera' permissions and reload this application.","perm_denied.screenshare.others.message":"From your browser settings, enable 'Screenshare' permissions and reload this application.",perm_sys_denied:"Permission denied by system","perm_sys_denied.audio":"Mic permission denied by system","perm_sys_denied.video":"Camera permission denied by system","perm_sys_denied.screenshare":"Screenshare permission denied by system","perm_sys_denied.audio.macos.message":"Open Apple Menu, navigate to 'System Settings > Privacy & Security > Microphone'. Allow access to your browser and reload this application.","perm_sys_denied.video.macos.message":"Open Apple Menu, navigate to 'System Settings > Privacy & Security > Camera'. Allow access to your browser and reload this application.","perm_sys_denied.screenshare.macos.message":"Open Apple Menu, navigate to 'System Settings > Privacy & Security > Screenshare'. Allow access to your browser and reload this application.","perm_sys_denied.audio.ios.message":"On your iPhone, navigate to 'Settings > Privacy > Microphone', allow access to your browser and reload this application.","perm_sys_denied.video.ios.message":"On your iPhone, navigate to 'Settings > Privacy > Camera', allow access to your browser and reload this application.","perm_sys_denied.screenshare.ios.message":"On your iPhone, navigate to 'Settings > Privacy > Screenshare', allow access to your browser and reload this application.","perm_sys_denied.audio.windows.message":"Go to Windows settings, select 'Settings > Privacy > Microphone'. Allow permissions to your browser and reload this application.","perm_sys_denied.video.windows.message":"Go to Windows settings, select 'Settings > Privacy > Camera'. Allow permissions to your browser and reload this application.","perm_sys_denied.screenshare.windows.message":"Go to Windows settings, select 'Settings > Privacy > Screenshare'. Allow permissions to your browser and reload this application.","perm_sys_denied.audio.android.message":"On your device, navigate to 'Settings > Apps'. Select your browser, allow Microphone permissions and reload this application.","perm_sys_denied.video.android.message":"On your device, navigate to 'Settings > Apps'. Select your browser, allow Camera permissions and reload this application.","perm_sys_denied.screenshare.android.message":"On your device, navigate to 'Settings > Apps'. Select your browser, allow Screenshare permissions and reload this application.","perm_sys_denied.audio.others.message":"Navigate to your system settings. Allow 'Microphone' permissions for your browser and reload this application.","perm_sys_denied.video.others.message":"Navigate to your system settings. Allow 'Camera' permissions for your browser and reload this application.","perm_sys_denied.screenshare.others.message":"Navigate to your system settings. Allow 'Screenshare' permissions for your browser and reload this application.",perm_could_not_start:"Could not capture device.","perm_could_not_start.audio":"Unable to start your Microphone","perm_could_not_start.video":"Unable to start your Camera","perm_could_not_start.screenshare":"Unable to start your Screenshare","perm_could_not_start.audio.message":"Looks like the system could not capture your microphone. Please restart your device or upgrade your browser to fix this.","perm_could_not_start.video.message":"Looks like the system could not capture your camera. Please restart your device or upgrade your browser to fix this.","perm_could_not_start.screenshare.message":"Looks like the system could not capture your screenshare. Please restart your device or upgrade your browser to fix this.",full_screen:"Full Screen","full_screen.exit":"Exit Full Screen","waitlist.header_title":"Waiting","waitlist.body_text":"You are in the waiting room, the host will let you in soon.","waitlist.deny_request":"Deny request","waitlist.accept_request":"Accept request","waitlist.accept_all":"Accept all","stage_request.header_title":"Join Stage Requests","stage_request.deny_request":"Deny request","stage_request.accept_request":"Accept request","stage_request.accept_all":"Accept all","stage_request.deny_all":"Deny all","stage_request.approval_pending":"Pending","stage_request.denied":"Denied","stage_request.request":"Join stage","stage_request.requested":"Requested","stage_request.cancel_request":"Cancel request","stage_request.leave_stage":"Leave stage","stage_request.request_tip":"Request to join the discussion","stage_request.leave_tip":"Leave the stage","stage_request.pending_tip":"Request pending","stage_request.denied_tip":"Rejected request","stage.empty_host":"The stage is empty","stage.empty_host_summary":"You are off stage. You can manage stage requests from the participants tab.","stage.empty_viewer":"There is no one on stage","stage.remove_from_stage":"Remove from stage","stage.invited_notification":"has been invited to join stage.","stage.add_to_stage":"Invite to stage","stage.join_title":"Join Stage","stage.join_summary":"You are about to join the stage, your video & audio as shown above will be visible to all participants.","stage.join_cancel":"Cancel","stage.join_confirm":"Join","setup_screen.join_in_as":"Joining as","setup_screen.your_name":"Your name","stage.reconnecting":"Reconnecting...","recording.label":"REC","recording.indicator":"This meeting is being recorded.","recording.started":"This meeting is being recorded.","recording.stopped":"Recording for this meeting has been stopped.","recording.paused":"Recording for this meeting has been paused.","recording.error.start":"Error while starting recording.","recording.error.stop":"Error while stopping recording.","recording.error.resume":"Error while resuming recording.","recording.start":"Start Recording","recording.stop":"Stop Recording","recording.resume":"Resume Recording","recording.starting":"Starting","recording.stopping":"Stopping","recording.loading":"Loading","recording.idle":"Record",audio_playback:"Play Audio","audio_playback.title":"Allow Audio Playback","audio_playback.description":"In order to play audio properly on your device, click the button below.",breakout_rooms:"Breakout Rooms","breakout_rooms.room_config_header":"Create Breakout","breakout_rooms.join_breakout_header":"Join Breakout","breakout_rooms.empty":"Nobody here yet.","breakout_rooms.delete":"Delete Room","breakout_rooms.switch":"Switch","breakout_rooms.main_room":"Main Room","breakout_rooms.shuffle_participants":"Shuffle Participants","breakout_rooms.deselect":"Deselect","breakout_rooms.selected":"selected","breakout_rooms.num_of_rooms":"No. of Rooms","breakout_rooms.approx":"Approx.","breakout_rooms.participants_per_room":"participants/room","breakout_rooms.division_text":"when equally divided.","breakout_rooms.start_breakout":"Start Breakout","breakout_rooms.close_breakout":"Close Breakout","breakout_rooms.update_breakout":"Update Breakout","breakout_rooms.discard_changes":"Discard Changes","breakout_rooms.room":"Room","breakout_rooms.rooms":"Rooms","breakout_rooms.room_name":"Room Name","breakout_rooms.edit_room_name":"Edit Room Name","breakout_rooms.save_room_name":"Save Room Name","breakout_rooms.add_room":"Add","breakout_rooms.add_room_brief":"Add Room","breakout_rooms.select_all":"Select all","breakout_rooms.unassign_all":"Unassign all","breakout_rooms.assign":"Assign","breakout_rooms.assign_participants":"Assign Participants","breakout_rooms.none_assigned":"No participants assigned yet","breakout_rooms.drag_drop_participants":"Drag and drop participants","breakout_rooms.click_drop_participants":"Click here to assign","breakout_rooms.status.assign_multiple":"Assign multiple participants at once by clicking and selecting them","breakout_rooms.status.select_room":"Select a room to assign","breakout_rooms.ephemeral_status.participants_assigned":"Participants assigned","breakout_rooms.ephemeral_status.participants_assigned_randomly":"Participants assigned randomly","breakout_rooms.ephemeral_status.changes_discarded":"Changes discarded","breakout_rooms.confirm_modal.start_breakout.header":"Start breakout rooms?","breakout_rooms.confirm_modal.start_breakout.content":"Once started, all participants will be moved to their assigned rooms.","breakout_rooms.confirm_modal.start_breakout.cancelText":"No, go back","breakout_rooms.confirm_modal.start_breakout.ctaText":"Yes, start","breakout_rooms.confirm_modal.close_breakout.header":"Close breakout rooms?","breakout_rooms.confirm_modal.close_breakout.content":"All breakout rooms will be closed & participants will be moved back to the main room.","breakout_rooms.confirm_modal.close_breakout.ctaText":"Yes, close breakout","breakout_rooms.move_reason.started_msg":"Starting breakout rooms...","breakout_rooms.move_reason.started_desc":"You are being moved to your assigned room","breakout_rooms.move_reason.closed_msg":"Closing breakout rooms...","breakout_rooms.move_reason.closed_desc":"You are being moved back to the main room","breakout_rooms.move_reason.switch_room":"Joining Breakout Room...","breakout_rooms.move_reason.switch_main_room":"Joining Main Room...","breakout_rooms.all_assigned":"All participants have been assigned","breakout_rooms.empty_main_room":"No more participants in the main room.","breakout_rooms.leave_confirmation":"Are you sure you want to leave the call? You are in a breakout room, you can join the main room too.","breakout_rooms.leave_confirmation.main_room_btn":"Go back to main room",ai:"AI","ai.meeting_ai":"Meeting AI","ai.home":"Home","ai.transcriptions":"Transcriptions","ai.personal":"Personal","ai.caption_view":"Caption View","ai.chat.tooltip":"This conversation will just be visible to you and not to others in the call.","ai.chat.summarize":"Hey AI, summarize this call","ai.chat.agenda":"Hey AI, what is today's agenda?","ai.transcriptions.search_placeholder":"Search by participant name or transcript","ai.transcriptions.no_transcripts_found":"No transcripts found. Try searching for a different participant or transcript.","ai.transcriptions.no_transcripts_yet":"No transcripts yet.",search:"Search","search.could_not_find":"Couldn't find a participant with the specified name or ID.","search.empty":"It looks like nobody is here.",end:"End Meeting","end.all":"End meeting for all",ended:"The meeting ended.","ended.rejected":"Your request to join the meeting was denied.","ended.left":"You left the meeting.","ended.kicked":"You were removed from the meeting.","ended.disconnected":"The call ended because the connection was lost.","ended.network":"Please check your internet connection and try again.","ended.unauthorized":"You are not authorized to join this meeting.",network:"Network","network.reconnecting":"Connection lost. Trying to reconnect.","network.delay_extended":"Taking too long to reconnect. Please check your network connection.","network.disconnected":"Could not reconnect. Please leave the meeting and try refreshing the window.","network.leaving":"Automatically leaving the meeting in 10 seconds.","network.restored":"Connection restored","network.delay":"Taking too long to reconnect.","network.lost":"Connection lost","network.lost_extended":"Connection lost. Please check your network connection.","network.troubleshoot":"Troubleshoot your connection","join.network_error":"We couldn't connect to the meeting. Please check your internet connection and try again.","join.media_error":"We're having trouble connecting to the meeting. Please try again, and if the problem continues, try using a different network.","join.media_firewall_error":"Your network may be blocking this connection. Try using a different network, or contact your network administrator for help.","join.default_error":"Something went wrong while joining the meeting. Please try again.","join.error_code":"Error code",livestream:"Livestream","livestream.indicator":"This meeting is being livestreamed.","livestream.skip":"Skip to Live","livestream.idle":"Waiting to go live.","livestream.starting":"Livestream is starting...","livestream.stopping":"Livestream is stopping...","livestream.waiting_on_manual_ingestion":"Please ingest livestream media.","livestream.error.not_supported":"Player not supported.","livestream.error.not_found":"Playback URL not found.","livestream.error.unknown":"An unknown error occurred.","livestream.error.sync":"Could not sync livestream, please try again later.","livestream.error.start":"Error while starting livestream.","livestream.error.stop":"Error while stopping livestream.","livestream.go_live":"Go Live","livestream.end_live":"End Live","livestream.error":"Error","cta.help":"Need help on how to do this?","cta.continue":"Ignore","cta.reload":"Reload","cta.confirmation":"Are you sure?","cta.system_settings":"Open Settings","remote_access.empty":"There are no remote requests, yet.","remote_access.requests":"The following people have requested remote control to your screen share.","remote_access.allow":"Please select whom you want to give access to.","remote_access.grant":"Grant access","remote_access.indicator":"Any plugin or screenshare you switch to will sync the change across the meeting",chat:"Chat","chat.new":"New","chat.max_limit_warning":"Max Character Limit","chat.rate_limit_error":"Please wait before you can send another message","chat.member_name":"Enter member name","chat.add_members":"Add members","chat.delete_msg":"Delete","chat.edit_msg":"Edit","chat.send_msg":"Send message","chat.send_attachment":"Drop files/images to send","chat.send_img":"Send an image","chat.send_file":"Send a file","chat.send_emoji":"Send an emoji","chat.update_msg":"Update message","chat.img.loading":"Loading image","chat.error.img_not_found":"Image not found","chat.error.empty_results":"Couldn't find a member with the specified name.","chat.img.shared_by":"Shared by","chat.reply":"Reply","chat.message_placeholder":"Message...","chat.click_to_send":"Click to send as message","chat.search_msgs":"Search messages","chat.search_conversations":"Search conversations","chat.start_conversation":"Start a conversation...","chat.empty_search":"No messages found","chat.empty_chat":"Send a message to get started","chat.cancel_upload":"Cancel upload","chat.view_chats":"View chats","chat.everyone":"Everyone","chat.pinned_msgs":"Pinned messages","chat.toggle_pinned_msgs":"Toggle pinned messages","date.today":"Today","date.yesterday":"Yesterday","date.sunday":"Sunday","date.monday":"Monday","date.tuesday":"Tuesday","date.wednesday":"Wednesday","date.thursday":"Thursday","date.friday":"Friday","date.saturday":"Saturday","list.empty":"No items found","grid.listening":"Listening","transcript.off":"Turn off Transcripts","transcript.on":"Turn on Transcripts","settings.notification_sound":"Notification sound","settings.microphone_input":"Microphone","settings.speaker_output":"Speaker","settings.mirror_video":"Mirror my Video","settings.camera_off":"Camera is off","dialog.close":"Close dialog","notifications.joined":"just joined","notifications.left":"left","notifications.requesting_to_join_meeting":"is requesting to join the meeting","notifications.requested_to_join_stage":"has requested to join stage","notifications.joined_stage":"has joined stage","notifications.request_to_join_accepted":"Request to join accepted","notifications.request_to_join_rejected":"Request to join rejected","notifications.accept":"Accept","notifications.new_poll_created_by":"New poll created by","notifications.connected_to":"Connected to","notifications.plugin_switched_to":"Plugin switched to","notifications.remote_control_requested":"has requested for remote control","notifications.remote_control_request_sent":"Sent remote control request to","notifications.remote_control_request_accepted":"has granted remote control","notifications.remote_control_granted":"Granted remote control to","notifications.remote_control_terminated":"Existing remote control has been terminated","debugger.troubleshooting.label":"Troubleshooting","debugger.quality.good":"Good","debugger.quality.average":"Average","debugger.quality.poor":"Poor","debugger.stats.bitrate.label":"Bitrate","debugger.stats.bitrate.description":"Data transmitted per second, affects quality and file size.","debugger.stats.packet_loss.label":"Packet Loss","debugger.stats.packet_loss.description":"Amount of data lost during transfer","debugger.stats.jitter.label":"Jitter","debugger.stats.jitter.description":"Variance or fluctuation in latency","debugger.stats.cpu_limitations.label":"CPU Limitations","debugger.stats.cpu_limitations.description":"CPU limitations can impact WebRTC call quality and performance.","debugger.stats.bandwidth_limitations.label":"Bandwidth Limitations","debugger.stats.bandwidth_limitations.description":"Slow internet speeds can degrade video quality.","debugger.audio.label":"Audio","debugger.audio.troubleshooting.label":"Audio Troubleshooting","debugger.audio.messages.generating_report":"Generating report. Please wait for a few seconds.","debugger.audio.messages.enable_media":"Please enable mic to see the report.","debugger.audio.sections.network_media":"Network & Media","debugger.video.label":"Video","debugger.video.troubleshooting.label":"Video Troubleshooting","debugger.video.messages.generating_report":"Generating report. Please wait for a few seconds.","debugger.video.messages.enable_media":"Please enable camera to see the report.","debugger.video.sections.network_media":"Network & Media","debugger.screenshare.label":"Screenshare","debugger.screenshare.troubleshooting.label":"Screenshare Troubleshooting","debugger.screenshare.sections.network_media":"Network & Media","debugger.screenshare.messages.generating_report":"Generating report. Please wait for a few seconds.","debugger.screenshare.messages.enable_media":"Please share screen to see the report.","debugger.system.label":"System","debugger.system.troubleshooting.label":"System Troubleshooting","debugger.system.sections.battery":"Battery","debugger.system.battery.level.label":"Battery Level","debugger.system.battery.level.description":"A low battery charge may result in reduced performance.","debugger.system.battery.charging.label":"Battery Charging Status","debugger.system.battery.charging.description":"A device running on power performs optimally.","debugger.system.battery.charging.is_charging":"Charging","debugger.system.battery.charging.is_not_charging":"Not charging"},It=(t=Vz)=>{let e=Vz;return(t!==Vz||Object.keys(t).length>0)&&(e=Object.assign({},Vz,t)),n=>{var r;return(r=e[n])!==null&&r!==void 0?r:n}},Nt={people:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 13.999 13 14a2 2 0 0 1 1.995 1.85L15 16v1.5C14.999 21 11.284 22 8.5 22c-2.722 0-6.335-.956-6.495-4.27L2 17.5v-1.501c0-1.054.816-1.918 1.85-1.995L4 14ZM15.22 14H20c1.054 0 1.918.816 1.994 1.85L22 16v1c-.001 3.062-2.858 4-5 4a7.16 7.16 0 0 1-2.14-.322c.336-.386.607-.827.802-1.327A6.19 6.19 0 0 0 17 19.5l.267-.006c.985-.043 3.086-.363 3.226-2.289L20.5 17v-1a.501.501 0 0 0-.41-.492L20 15.5h-4.051a2.957 2.957 0 0 0-.595-1.34L15.22 14H20h-4.78ZM4 15.499l-.1.01a.51.51 0 0 0-.254.136.506.506 0 0 0-.136.253l-.01.101V17.5c0 1.009.45 1.722 1.417 2.242.826.445 2.003.714 3.266.753l.317.005.317-.005c1.263-.039 2.439-.308 3.266-.753.906-.488 1.359-1.145 1.412-2.057l.005-.186V16a.501.501 0 0 0-.41-.492L13 15.5l-9-.001ZM8.5 3a4.5 4.5 0 1 1 0 9 4.5 4.5 0 0 1 0-9Zm9 2a3.5 3.5 0 1 1 0 7 3.5 3.5 0 0 1 0-7Zm-9-.5c-1.654 0-3 1.346-3 3s1.346 3 3 3 3-1.346 3-3-1.346-3-3-3Zm9 2c-1.103 0-2 .897-2 2s.897 2 2 2 2-.897 2-2-.897-2-2-2Z" fill="currentColor"/></svg>',people_checked:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 29 29"><path fill="currentColor" d="M14.58 15.333H2.833a2.667 2.667 0 0 0-2.666 2.666v2l.006.307c.214 4.419 5.031 5.693 8.66 5.693 1.374 0 2.92-.182 4.32-.649a8.53 8.53 0 0 1-.717-1.87c-.93.298-2.027.478-3.18.513l-.423.006-.422-.006c-1.684-.052-3.254-.411-4.355-1.004-1.29-.694-1.89-1.644-1.89-2.99v-2.001l.014-.135a.675.675 0 0 1 .181-.337.68.68 0 0 1 .338-.181l.134-.014h10.31a8.71 8.71 0 0 1 1.436-1.998h.001Zm.253-8.667a6 6 0 1 0-12 0 6 6 0 0 0 12 0Zm-10 0c0-2.205 1.795-4 4-4 2.206 0 4 1.795 4 4s-1.794 4-4 4c-2.205 0-4-1.795-4-4ZM25.5 7.999a4.667 4.667 0 1 0-9.333 0A4.667 4.667 0 0 0 25.5 8Zm-7.333 0a2.67 2.67 0 0 1 2.666-2.666A2.67 2.67 0 0 1 23.5 7.999a2.67 2.67 0 0 1-2.667 2.667 2.67 2.67 0 0 1-2.666-2.667Zm10 13.334a7.333 7.333 0 1 1-14.667 0 7.333 7.333 0 0 1 14.667 0Zm-2.862-3.139a.666.666 0 0 0-.944 0l-4.86 4.863-2.196-2.196a.667.667 0 1 0-.944.944l2.667 2.666a.666.666 0 0 0 .944 0l5.333-5.333a.666.666 0 0 0 0-.944Z"/></svg>',chat:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2c5.523 0 10 4.477 10 10s-4.477 10-10 10a9.96 9.96 0 0 1-4.587-1.112l-3.826 1.067a1.25 1.25 0 0 1-1.54-1.54l1.068-3.823A9.96 9.96 0 0 1 2 12C2 6.477 6.477 2 12 2Zm0 1.5A8.5 8.5 0 0 0 3.5 12c0 1.47.373 2.883 1.073 4.137l.15.27-1.112 3.984 3.987-1.112.27.15A8.5 8.5 0 1 0 12 3.5ZM8.75 13h4.498a.75.75 0 0 1 .102 1.493l-.102.007H8.75a.75.75 0 0 1-.102-1.493L8.75 13h4.498H8.75Zm0-3.5h6.505a.75.75 0 0 1 .101 1.493l-.101.007H8.75a.75.75 0 0 1-.102-1.493L8.75 9.5h6.505H8.75Z" fill="currentColor"/></svg>',poll:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.752 2a2.752 2.752 0 0 1 2.752 2.751V19.25a2.752 2.752 0 1 1-5.504 0V4.75A2.752 2.752 0 0 1 11.752 2Zm7 5a2.752 2.752 0 0 1 2.752 2.751v9.499a2.752 2.752 0 1 1-5.504 0V9.75A2.752 2.752 0 0 1 18.752 7Zm-14 5a2.752 2.752 0 0 1 2.752 2.751v4.499a2.752 2.752 0 0 1-5.504 0V14.75A2.752 2.752 0 0 1 4.752 12Zm7-8.5c-.692 0-1.252.56-1.252 1.251V19.25a1.252 1.252 0 0 0 2.504 0V4.75c0-.691-.56-1.251-1.252-1.251Zm7 5c-.691 0-1.252.56-1.252 1.251v9.499a1.252 1.252 0 0 0 2.504 0V9.75c0-.691-.56-1.251-1.252-1.251Zm-14 5c-.692 0-1.252.56-1.252 1.251v4.499a1.252 1.252 0 1 0 2.504 0V14.75c0-.691-.56-1.252-1.252-1.252Z" fill="currentColor"/></svg>',participants:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M14.754 10c.966 0 1.75.784 1.75 1.75v4.749a4.501 4.501 0 0 1-9.002 0V11.75c0-.966.783-1.75 1.75-1.75h5.502Zm0 1.5H9.252a.25.25 0 0 0-.25.25v4.749a3.001 3.001 0 0 0 6.002 0V11.75a.25.25 0 0 0-.25-.25ZM3.75 10h3.381a2.738 2.738 0 0 0-.618 1.5H3.75a.25.25 0 0 0-.25.25v3.249a2.501 2.501 0 0 0 3.082 2.433c.085.504.24.985.453 1.432A4.001 4.001 0 0 1 2 14.999V11.75c0-.966.784-1.75 1.75-1.75Zm13.125 0h3.375c.966 0 1.75.784 1.75 1.75V15a4 4 0 0 1-5.03 3.866c.214-.448.369-.929.455-1.433A2.5 2.5 0 0 0 20.5 15v-3.25a.25.25 0 0 0-.25-.25h-2.757a2.738 2.738 0 0 0-.618-1.5ZM12 3a3 3 0 1 1 0 6 3 3 0 0 1 0-6Zm6.5 1a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5Zm-13 0a2.5 2.5 0 1 1 0 5 2.5 2.5 0 0 1 0-5Zm6.5.5a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Zm6.5 1a1 1 0 1 0 0 2 1 1 0 0 0 0-2Zm-13 0a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z" fill="currentColor"/></svg>',rocket:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48"><path d="M9.35 20.45 14.65 22.7Q15.55 20.9 16.575 19.15Q17.6 17.4 18.75 15.8L14.8 15Q14.8 15 14.8 15Q14.8 15 14.8 15ZM17.05 24.5 23.7 31.15Q26.55 29.85 29.05 28.2Q31.55 26.55 33.1 25Q37.15 20.95 39.05 16.7Q40.95 12.45 41.1 7.1Q35.75 7.25 31.5 9.15Q27.25 11.05 23.2 15.1Q21.65 16.65 20 19.15Q18.35 21.65 17.05 24.5ZM28.5 19.7Q27.5 18.7 27.5 17.225Q27.5 15.75 28.5 14.75Q29.5 13.75 30.975 13.75Q32.45 13.75 33.45 14.75Q34.45 15.75 34.45 17.225Q34.45 18.7 33.45 19.7Q32.45 20.7 30.975 20.7Q29.5 20.7 28.5 19.7ZM27.75 38.85 33.2 33.4Q33.2 33.4 33.2 33.4Q33.2 33.4 33.2 33.4L32.4 29.45Q30.8 30.6 29.05 31.625Q27.3 32.65 25.5 33.55ZM44.05 4.15Q44.5 10.95 42.35 16.55Q40.2 22.15 35.25 27.1Q35.2 27.15 35.15 27.2Q35.1 27.25 35.05 27.3L36.15 32.8Q36.3 33.55 36.075 34.25Q35.85 34.95 35.3 35.5L26.75 44.1L22.5 34.2L14 25.7L4.1 21.45L12.7 12.9Q13.25 12.35 13.95 12.125Q14.65 11.9 15.4 12.05L20.9 13.15Q20.95 13.1 21 13.075Q21.05 13.05 21.1 13Q26.05 8.05 31.65 5.875Q37.25 3.7 44.05 4.15ZM7.45 31.75Q9.2 30 11.725 29.975Q14.25 29.95 16 31.7Q17.75 33.45 17.725 35.975Q17.7 38.5 15.95 40.25Q14.65 41.55 11.925 42.4Q9.2 43.25 3.75 44Q4.5 38.55 5.325 35.8Q6.15 33.05 7.45 31.75ZM9.55 33.9Q8.85 34.65 8.3 36.25Q7.75 37.85 7.35 40.35Q9.85 39.95 11.45 39.4Q13.05 38.85 13.8 38.15Q14.75 37.3 14.775 36.025Q14.8 34.75 13.9 33.8Q12.95 32.9 11.675 32.925Q10.4 32.95 9.55 33.9Z" fill="currentColor" /></svg>',call_end:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m21.903 13.202-.191.816a2.75 2.75 0 0 1-2.955 2.107l-1.755-.178A2.75 2.75 0 0 1 14.6 13.83l-.389-1.686a.25.25 0 0 0-.113-.157c-.321-.197-1.034-.32-2.098-.32-.786 0-1.386.067-1.786.189-.14.043-.238.085-.301.116l-.09.048-.015.04-.409 1.77A2.75 2.75 0 0 1 7 15.948l-1.746.177A2.75 2.75 0 0 1 2.3 14.03l-.196-.817a3.75 3.75 0 0 1 1.13-3.651C5.134 7.839 8.064 7 12 7c3.943 0 6.875.842 8.776 2.57a3.75 3.75 0 0 1 1.172 3.41l-.045.222Zm-1.426-.514a2.25 2.25 0 0 0-.71-2.009C18.184 9.241 15.602 8.5 12 8.5c-3.598 0-6.177.739-7.76 2.172a2.25 2.25 0 0 0-.677 2.19l.196.818a1.25 1.25 0 0 0 1.342.953l1.746-.178a1.25 1.25 0 0 0 1.09-.962l.423-1.82.043-.136c.376-.998 1.591-1.37 3.597-1.37 1.318 0 2.265.164 2.88.54.401.245.687.642.793 1.1l.389 1.685c.12.522.56.909 1.092.963l1.754.178a1.25 1.25 0 0 0 1.343-.958l.192-.816.034-.171Z" fill="currentColor"/></svg>',share:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17 2.498a3.502 3.502 0 1 1-2.597 5.851l-4.558 2.604a3.5 3.5 0 0 1 0 2.093l4.557 2.606a3.502 3.502 0 1 1-.745 1.302L9.1 14.347a3.502 3.502 0 1 1 0-4.698l4.557-2.604A3.502 3.502 0 0 1 17 2.498Zm0 13.5a2.002 2.002 0 1 0 0 4.004 2.002 2.002 0 0 0 0-4.004Zm-10.498-6a2.002 2.002 0 1 0 0 4.004 2.002 2.002 0 0 0 0-4.004Zm10.498-6a2.002 2.002 0 1 0 0 4.004 2.002 2.002 0 0 0 0-4.004Z" fill="currentColor"/></svg>',mic_on:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.25 11a.75.75 0 0 1 .743.648l.007.102v.5a6.75 6.75 0 0 1-6.249 6.732l-.001 2.268a.75.75 0 0 1-1.493.102l-.007-.102v-2.268a6.75 6.75 0 0 1-6.246-6.496L5 12.25v-.5a.75.75 0 0 1 1.493-.102l.007.102v.5a5.25 5.25 0 0 0 5.034 5.246l.216.004h.5a5.25 5.25 0 0 0 5.246-5.034l.004-.216v-.5a.75.75 0 0 1 .75-.75ZM12 2a4 4 0 0 1 4 4v6a4 4 0 0 1-8 0V6a4 4 0 0 1 4-4Zm0 1.5A2.5 2.5 0 0 0 9.5 6v6a2.5 2.5 0 0 0 5 0V6A2.5 2.5 0 0 0 12 3.5Z" fill="currentColor"/></svg>',mic_off:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.28 2.22a.75.75 0 1 0-1.06 1.06L8 9.06V12a4 4 0 0 0 6.248 3.309l1.146 1.146A5.227 5.227 0 0 1 12.25 17.5h-.5l-.216-.004A5.25 5.25 0 0 1 6.5 12.25v-.5l-.007-.102A.75.75 0 0 0 5 11.75v.5l.004.236a6.75 6.75 0 0 0 6.246 6.496v2.268l.007.102a.75.75 0 0 0 1.493-.102l.001-2.268a6.718 6.718 0 0 0 3.712-1.458l4.256 4.256a.75.75 0 0 0 1.061-1.06L3.28 2.22Zm9.876 11.997A2.5 2.5 0 0 1 9.5 12v-1.44l3.656 3.657ZM14.5 6v5.318l1.43 1.43c.046-.242.07-.492.07-.748V6a4 4 0 0 0-7.862-1.044L9.5 6.318V6a2.5 2.5 0 0 1 5 0ZM17.196 14.014l1.146 1.146A6.725 6.725 0 0 0 19 12.25v-.5l-.007-.102a.75.75 0 0 0-1.493.102v.5l-.004.216a5.233 5.233 0 0 1-.3 1.548Z" fill="currentColor"/></svg>',video_on:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13.75 4.5A3.25 3.25 0 0 1 17 7.75v.173l3.864-2.318A.75.75 0 0 1 22 6.248V17.75a.75.75 0 0 1-1.136.643L17 16.075v.175a3.25 3.25 0 0 1-3.25 3.25h-8.5A3.25 3.25 0 0 1 2 16.25v-8.5A3.25 3.25 0 0 1 5.25 4.5h8.5Zm0 1.5h-8.5A1.75 1.75 0 0 0 3.5 7.75v8.5c0 .966.784 1.75 1.75 1.75h8.5a1.75 1.75 0 0 0 1.75-1.75v-8.5A1.75 1.75 0 0 0 13.75 6Zm6.75 1.573L17 9.674v4.651l3.5 2.1V7.573Z" fill="currentColor"/></svg>',video_off:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.28 2.22a.75.75 0 1 0-1.06 1.06l1.567 1.567A3.25 3.25 0 0 0 2 7.75v8.5a3.25 3.25 0 0 0 3.25 3.25h8.5a3.25 3.25 0 0 0 2.903-1.786l4.066 4.067a.75.75 0 0 0 1.061-1.061L3.28 2.22Zm12.196 14.317A1.75 1.75 0 0 1 13.75 18h-8.5a1.75 1.75 0 0 1-1.75-1.75v-8.5c0-.869.633-1.59 1.463-1.727l10.514 10.514ZM15.5 12.318V7.75A1.75 1.75 0 0 0 13.75 6H9.182l-1.5-1.5h6.068A3.25 3.25 0 0 1 17 7.75v.173l3.864-2.318A.75.75 0 0 1 22 6.248V17.75c0 .301-.17.543-.403.665L20.5 17.318V7.573L17 9.674v4.144l-1.5-1.5Z" fill="currentColor"/></svg>',share_screen_start:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 6.25A2.25 2.25 0 0 1 4.25 4h15.5A2.25 2.25 0 0 1 22 6.25v11.5A2.25 2.25 0 0 1 19.75 20H4.25A2.25 2.25 0 0 1 2 17.75V6.25Zm2.25-.75a.75.75 0 0 0-.75.75v11.5c0 .414.336.75.75.75h15.5a.75.75 0 0 0 .75-.75V6.25a.75.75 0 0 0-.75-.75H4.25Z"/><path d="M12 7.245a.75.75 0 0 1 .53.22l3.255 3.255a.75.75 0 1 1-1.06 1.06L12.75 9.806v6.447a.75.75 0 0 1-1.5 0V9.808L9.28 11.78a.75.75 0 1 1-1.06-1.06l3.25-3.254a.75.75 0 0 1 .53-.22Z"/></svg>',share_screen_stop:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M2 6.25A2.25 2.25 0 0 1 4.25 4h15.5A2.25 2.25 0 0 1 22 6.25v11.5A2.25 2.25 0 0 1 19.75 20H4.25A2.25 2.25 0 0 1 2 17.75V6.25Zm2.25-.75a.75.75 0 0 0-.75.75v11.5c0 .414.336.75.75.75h15.5a.75.75 0 0 0 .75-.75V6.25a.75.75 0 0 0-.75-.75H4.25Z"/><path d="M8.22 8.215a.75.75 0 0 1 1.06 0l2.72 2.72 2.725-2.716a.75.75 0 0 1 1.06 1.062l-2.724 2.715 2.724 2.724a.75.75 0 1 1-1.06 1.06L12 13.057 9.28 15.78a.75.75 0 0 1-1.06-1.06l2.72-2.724-2.72-2.72a.75.75 0 0 1 0-1.06Z"/></svg>',share_screen_person:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M2 7.25A3.25 3.25 0 0 1 5.25 4h13.5A3.25 3.25 0 0 1 22 7.25V13h-.258a3.74 3.74 0 0 0-1.242-2.545V7.25a1.75 1.75 0 0 0-1.75-1.75H5.25A1.75 1.75 0 0 0 3.5 7.25v9.5c0 .966.784 1.75 1.75 1.75H12v.5c0 .34.04.674.118 1H5.25A3.25 3.25 0 0 1 2 16.75v-9.5ZM21.5 17a1.5 1.5 0 0 1 1.5 1.5v.5c0 1.971-1.86 4-5 4-3.14 0-5-2.029-5-4v-.5a1.5 1.5 0 0 1 1.5-1.5h7ZM18 10.5a2.75 2.75 0 1 1 0 5.5 2.75 2.75 0 0 1 0-5.5Z" fill="currentColor"/></svg>',clock:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 2c5.523 0 10 4.478 10 10s-4.477 10-10 10S2 17.522 2 12 6.477 2 12 2Zm0 1.667c-4.595 0-8.333 3.738-8.333 8.333 0 4.595 3.738 8.333 8.333 8.333 4.595 0 8.333-3.738 8.333-8.333 0-4.595-3.738-8.333-8.333-8.333ZM11.25 6a.75.75 0 0 1 .743.648L12 6.75V12h3.25a.75.75 0 0 1 .102 1.493l-.102.007h-4a.75.75 0 0 1-.743-.648l-.007-.102v-6a.75.75 0 0 1 .75-.75Z" fill="currentColor"/></svg>',dismiss:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m4.397 4.554.073-.084a.75.75 0 0 1 .976-.073l.084.073L12 10.939l6.47-6.47a.75.75 0 1 1 1.06 1.061L13.061 12l6.47 6.47a.75.75 0 0 1 .072.976l-.073.084a.75.75 0 0 1-.976.073l-.084-.073L12 13.061l-6.47 6.47a.75.75 0 0 1-1.06-1.061L10.939 12l-6.47-6.47a.75.75 0 0 1-.072-.976l.073-.084-.073.084Z" fill="currentColor"/></svg>',send:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5.694 12 2.299 3.272c-.236-.607.356-1.188.942-.982l.093.04 18 9a.75.75 0 0 1 .097 1.283l-.097.058-18 9a.75.75 0 0 1-1.065-.847l.03-.096L5.694 12 2.299 3.272 5.694 12ZM4.402 4.54l2.61 6.71h6.627a.75.75 0 0 1 .743.648l.007.102a.75.75 0 0 1-.649.743l-.101.007H7.01l-2.609 6.71L19.322 12 4.401 4.54Z" fill="currentColor"/></svg>',search:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10 2.75a7.25 7.25 0 0 1 5.63 11.819l4.9 4.9a.75.75 0 0 1-.976 1.134l-.084-.073-4.901-4.9A7.25 7.25 0 1 1 10 2.75Zm0 1.5a5.75 5.75 0 1 0 0 11.5 5.75 5.75 0 0 0 0-11.5Z" fill="currentColor"/</svg>',more_vertical:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 7.75a1.75 1.75 0 1 1 0-3.5 1.75 1.75 0 0 1 0 3.5ZM12 13.75a1.75 1.75 0 1 1 0-3.5 1.75 1.75 0 0 1 0 3.5ZM10.25 18a1.75 1.75 0 1 0 3.5 0 1.75 1.75 0 0 0-3.5 0Z" fill="currentColor"/></svg>',chevron_down:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4.22 8.47a.75.75 0 0 1 1.06 0L12 15.19l6.72-6.72a.75.75 0 1 1 1.06 1.06l-7.25 7.25a.75.75 0 0 1-1.06 0L4.22 9.53a.75.75 0 0 1 0-1.06Z" fill="currentColor"/></svg>',chevron_up:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4.22 15.53a.75.75 0 0 0 1.06 0L12 8.81l6.72 6.72a.75.75 0 1 0 1.06-1.06l-7.25-7.25a.75.75 0 0 0-1.06 0l-7.25 7.25a.75.75 0 0 0 0 1.06Z" fill="currentColor"/></svg>',chevron_left:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M15.53 4.22a.75.75 0 0 1 0 1.06L8.81 12l6.72 6.72a.75.75 0 1 1-1.06 1.06l-7.25-7.25a.75.75 0 0 1 0-1.06l7.25-7.25a.75.75 0 0 1 1.06 0Z" fill="currentColor"/></svg>',chevron_right:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.47 4.22a.75.75 0 0 0 0 1.06L15.19 12l-6.72 6.72a.75.75 0 1 0 1.06 1.06l7.25-7.25a.75.75 0 0 0 0-1.06L9.53 4.22a.75.75 0 0 0-1.06 0Z" fill="currentColor"/></svg>',settings:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12.012 2.25c.734.008 1.465.093 2.182.253a.75.75 0 0 1 .582.649l.17 1.527a1.384 1.384 0 0 0 1.927 1.116l1.401-.615a.75.75 0 0 1 .85.174 9.792 9.792 0 0 1 2.204 3.792.75.75 0 0 1-.271.825l-1.242.916a1.381 1.381 0 0 0 0 2.226l1.243.915a.75.75 0 0 1 .272.826 9.797 9.797 0 0 1-2.204 3.792.75.75 0 0 1-.848.175l-1.407-.617a1.38 1.38 0 0 0-1.926 1.114l-.169 1.526a.75.75 0 0 1-.572.647 9.518 9.518 0 0 1-4.406 0 .75.75 0 0 1-.572-.647l-.168-1.524a1.382 1.382 0 0 0-1.926-1.11l-1.406.616a.75.75 0 0 1-.849-.175 9.798 9.798 0 0 1-2.204-3.796.75.75 0 0 1 .272-.826l1.243-.916a1.38 1.38 0 0 0 0-2.226l-1.243-.914a.75.75 0 0 1-.271-.826 9.793 9.793 0 0 1 2.204-3.792.75.75 0 0 1 .85-.174l1.4.615a1.387 1.387 0 0 0 1.93-1.118l.17-1.526a.75.75 0 0 1 .583-.65c.717-.159 1.45-.243 2.201-.252Zm0 1.5a9.135 9.135 0 0 0-1.354.117l-.109.977A2.886 2.886 0 0 1 6.525 7.17l-.898-.394a8.293 8.293 0 0 0-1.348 2.317l.798.587a2.881 2.881 0 0 1 0 4.643l-.799.588c.32.842.776 1.626 1.348 2.322l.905-.397a2.882 2.882 0 0 1 4.017 2.318l.11.984c.889.15 1.798.15 2.687 0l.11-.984a2.881 2.881 0 0 1 4.018-2.322l.905.396a8.296 8.296 0 0 0 1.347-2.318l-.798-.588a2.881 2.881 0 0 1 0-4.643l.796-.587a8.293 8.293 0 0 0-1.348-2.317l-.896.393a2.884 2.884 0 0 1-4.023-2.324l-.11-.976a8.988 8.988 0 0 0-1.333-.117ZM12 8.25a3.75 3.75 0 1 1 0 7.5 3.75 3.75 0 0 1 0-7.5Zm0 1.5a2.25 2.25 0 1 0 0 4.5 2.25 2.25 0 0 0 0-4.5Z" fill="currentColor"/></svg>',wifi:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17.745 10.75a8.291 8.291 0 0 1 1.492 2.07.75.75 0 1 1-1.335.683 6.798 6.798 0 0 0-1.218-1.692 6.562 6.562 0 0 0-10.493 1.673.75.75 0 1 1-1.339-.677 8.062 8.062 0 0 1 12.893-2.057Zm-2.102 3.07c.448.447.816.997 1.072 1.582a.75.75 0 1 1-1.373.602 3.72 3.72 0 0 0-.76-1.124 3.592 3.592 0 0 0-5.08 0c-.31.31-.562.689-.746 1.11a.75.75 0 1 1-1.375-.6 5.11 5.11 0 0 1 1.061-1.57 5.092 5.092 0 0 1 7.201 0Zm4.805-5.541c.51.509.99 1.09 1.409 1.697a.75.75 0 0 1-1.235.852 10.822 10.822 0 0 0-1.234-1.489c-4.08-4.08-10.695-4.08-14.776 0-.421.422-.84.934-1.222 1.484a.75.75 0 0 1-1.232-.855c.43-.62.905-1.2 1.394-1.69 4.666-4.665 12.23-4.665 16.896 0Zm-7.387 8.16a1.5 1.5 0 1 1-2.122 2.122 1.5 1.5 0 0 1 2.122-2.122Z" fill="currentColor"/></svg>',speaker:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M15 4.25c0-1.079-1.274-1.65-2.08-.934L8.427 7.309a.75.75 0 0 1-.498.19H4.25A2.25 2.25 0 0 0 2 9.749v4.497a2.25 2.25 0 0 0 2.25 2.25h3.68a.75.75 0 0 1 .498.19l4.491 3.994c.806.716 2.081.144 2.081-.934V4.25ZM9.425 8.43 13.5 4.807v14.382l-4.075-3.624a2.25 2.25 0 0 0-1.495-.569H4.25a.75.75 0 0 1-.75-.75V9.75a.75.75 0 0 1 .75-.75h3.68a2.25 2.25 0 0 0 1.495-.569ZM18.992 5.897a.75.75 0 0 1 1.049.157A9.959 9.959 0 0 1 22 12a9.96 9.96 0 0 1-1.96 5.946.75.75 0 0 1-1.205-.892A8.459 8.459 0 0 0 20.5 12a8.459 8.459 0 0 0-1.665-5.054.75.75 0 0 1 .157-1.049Z" /><path d="M17.143 8.37a.75.75 0 0 1 1.017.302c.536.99.84 2.125.84 3.328a6.973 6.973 0 0 1-.84 3.328.75.75 0 0 1-1.32-.714c.42-.777.66-1.666.66-2.614s-.24-1.837-.66-2.614a.75.75 0 0 1 .303-1.017Z"/></svg>',speaker_off:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M3.28 2.22a.75.75 0 1 0-1.06 1.06L6.438 7.5H4.25A2.25 2.25 0 0 0 2 9.749v4.497a2.25 2.25 0 0 0 2.25 2.25h3.68a.75.75 0 0 1 .498.19l4.491 3.994c.806.716 2.081.144 2.081-.934V16.06l5.72 5.72a.75.75 0 0 0 1.06-1.061L3.28 2.22ZM13.5 14.56v4.629l-4.075-3.624a2.25 2.25 0 0 0-1.495-.569H4.25a.75.75 0 0 1-.75-.75V9.75a.75.75 0 0 1 .75-.75h3.688L13.5 14.56ZM13.5 4.807v5.511l1.5 1.5V4.25c0-1.079-1.274-1.65-2.08-.934l-3.4 3.022 1.063 1.063L13.5 4.807ZM17.141 13.96l1.138 1.137A6.974 6.974 0 0 0 19 12a6.973 6.973 0 0 0-.84-3.328.75.75 0 0 0-1.32.714c.42.777.66 1.666.66 2.614 0 .691-.127 1.351-.359 1.96ZM19.388 16.206l1.093 1.094A9.955 9.955 0 0 0 22 12a9.959 9.959 0 0 0-1.96-5.946.75.75 0 0 0-1.205.892A8.46 8.46 0 0 1 20.5 12a8.458 8.458 0 0 1-1.112 4.206Z"/></svg>',download:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M18.25 20.5a.75.75 0 1 1 0 1.5l-13 .004a.75.75 0 1 1 0-1.5l13-.004ZM11.648 2.012l.102-.007a.75.75 0 0 1 .743.648l.007.102-.001 13.685 3.722-3.72a.75.75 0 0 1 .976-.073l.085.073a.75.75 0 0 1 .072.976l-.073.084-4.997 4.997a.75.75 0 0 1-.976.073l-.085-.073-5.003-4.996a.75.75 0 0 1 .976-1.134l.084.072 3.719 3.714L11 2.755a.75.75 0 0 1 .648-.743l.102-.007-.102.007Z" fill="currentColor"/></svg>',full_screen_maximize:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4.5 5.75c0-.69.56-1.25 1.25-1.25h2a.75.75 0 0 0 0-1.5h-2A2.75 2.75 0 0 0 3 5.75v2a.75.75 0 0 0 1.5 0v-2ZM4.5 18.25c0 .69.56 1.25 1.25 1.25h2a.75.75 0 0 1 0 1.5h-2A2.75 2.75 0 0 1 3 18.25v-2a.75.75 0 0 1 1.5 0v2ZM18.25 4.5c.69 0 1.25.56 1.25 1.25v2a.75.75 0 0 0 1.5 0v-2A2.75 2.75 0 0 0 18.25 3h-2a.75.75 0 0 0 0 1.5h2ZM19.5 18.25c0 .69-.56 1.25-1.25 1.25h-2a.75.75 0 0 0 0 1.5h2A2.75 2.75 0 0 0 21 18.25v-2a.75.75 0 0 0-1.5 0v2Z" fill="currentColor"/></svg>',full_screen_minimize:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.5 3.75a.75.75 0 0 0-1.5 0v2.5a.75.75 0 0 1-.75.75h-2.5a.75.75 0 0 0 0 1.5h2.5A2.25 2.25 0 0 0 8.5 6.25v-2.5ZM8.5 20.25a.75.75 0 0 1-1.5 0v-2.5a.75.75 0 0 0-.75-.75h-2.5a.75.75 0 0 1 0-1.5h2.5a2.25 2.25 0 0 1 2.25 2.25v2.5ZM16.25 3a.75.75 0 0 0-.75.75v2.5a2.25 2.25 0 0 0 2.25 2.25h2.5a.75.75 0 0 0 0-1.5h-2.5a.75.75 0 0 1-.75-.75v-2.5a.75.75 0 0 0-.75-.75ZM15.5 20.25a.75.75 0 0 0 1.5 0v-2.5a.75.75 0 0 1 .75-.75h2.5a.75.75 0 0 0 0-1.5h-2.5a2.25 2.25 0 0 0-2.25 2.25v2.5Z" fill="currentColor"/></svg>',copy:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M5.503 4.627 5.5 6.75v10.504a3.25 3.25 0 0 0 3.25 3.25h8.616a2.251 2.251 0 0 1-2.122 1.5H8.75A4.75 4.75 0 0 1 4 17.254V6.75c0-.98.627-1.815 1.503-2.123ZM17.75 2A2.25 2.25 0 0 1 20 4.25v13a2.25 2.25 0 0 1-2.25 2.25h-9a2.25 2.25 0 0 1-2.25-2.25v-13A2.25 2.25 0 0 1 8.75 2h9Zm0 1.5h-9a.75.75 0 0 0-.75.75v13c0 .414.336.75.75.75h9a.75.75 0 0 0 .75-.75v-13a.75.75 0 0 0-.75-.75Z" fill="currentColor"/></svg>',attach:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M11.772 3.743a6 6 0 0 1 8.66 8.302l-.19.197-8.8 8.798-.036.03a3.723 3.723 0 0 1-5.489-4.973.764.764 0 0 1 .085-.13l.054-.06.086-.088.142-.148.002.003 7.436-7.454a.75.75 0 0 1 .977-.074l.084.073a.75.75 0 0 1 .074.976l-.073.084-7.594 7.613a2.23 2.23 0 0 0 3.174 3.106l8.832-8.83A4.502 4.502 0 0 0 13 4.644l-.168.16-.013.014-9.536 9.536a.75.75 0 0 1-1.133-.977l.072-.084 9.549-9.55h.002Z" fill="currentColor"/></svg>',image:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17.75 3A3.25 3.25 0 0 1 21 6.25v11.5A3.25 3.25 0 0 1 17.75 21H6.25A3.25 3.25 0 0 1 3 17.75V6.25A3.25 3.25 0 0 1 6.25 3h11.5Zm.58 16.401-5.805-5.686a.75.75 0 0 0-.966-.071l-.084.07-5.807 5.687c.182.064.378.099.582.099h11.5c.203 0 .399-.035.58-.099l-5.805-5.686L18.33 19.4ZM17.75 4.5H6.25A1.75 1.75 0 0 0 4.5 6.25v11.5c0 .208.036.408.103.594l5.823-5.701a2.25 2.25 0 0 1 3.02-.116l.128.116 5.822 5.702c.067-.186.104-.386.104-.595V6.25a1.75 1.75 0 0 0-1.75-1.75Zm-2.498 2a2.252 2.252 0 1 1 0 4.504 2.252 2.252 0 0 1 0-4.504Zm0 1.5a.752.752 0 1 0 0 1.504.752.752 0 0 0 0-1.504Z" fill="currentColor"/></svg>',emoji_multiple:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M8.5 2a6.503 6.503 0 0 1 6.312 4.943c-.515.01-1.02.068-1.506.171a5 5 0 1 0-6.191 6.191 8.053 8.053 0 0 0-.172 1.507A6.5 6.5 0 0 1 8.5 2Zm.16 8.006c.355-.451.759-.864 1.202-1.23a3.5 3.5 0 0 0-4.022.95.75.75 0 1 0 1.14.974 2 2 0 0 1 1.68-.694ZM7.5 6.5a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm4 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0Zm1 8a1 1 0 1 0 0-2 1 1 0 0 0 0 2Zm5.458 2.042a.75.75 0 0 1 .082 1.058 4 4 0 0 1-6.075.005.75.75 0 0 1 1.138-.977 2.499 2.499 0 0 0 3.797-.003.75.75 0 0 1 1.058-.083ZM17.5 14.5a1 1 0 1 0 0-2 1 1 0 0 0 0 2ZM15 22a7 7 0 1 0 0-14 7 7 0 0 0 0 14Zm0-1.5a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11Z" fill="currentColor"/></svg>',image_off:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.28 2.22a.75.75 0 1 0-1.06 1.06l1.263 1.264A3.235 3.235 0 0 0 3 6.25v11.5A3.25 3.25 0 0 0 6.25 21h11.5c.626 0 1.21-.177 1.706-.483l1.263 1.264a.75.75 0 0 0 1.061-1.061L3.28 2.22Zm8.788 10.909 6.206 6.206.056.066a1.746 1.746 0 0 1-.58.099H6.25c-.204 0-.4-.035-.582-.099l5.807-5.686.593-.586Zm-.95-.95a2.245 2.245 0 0 0-.692.464l-5.823 5.7a1.747 1.747 0 0 1-.103-.593V6.25c0-.206.036-.404.101-.588l6.518 6.518ZM19.5 16.318V6.25a1.75 1.75 0 0 0-1.75-1.75H7.682L6.182 3H17.75A3.25 3.25 0 0 1 21 6.25v11.568l-1.5-1.5Z" fill="currentColor"/><path d="M15.252 6.5a2.252 2.252 0 1 1 0 4.504 2.252 2.252 0 0 1 0-4.504Zm0 1.5a.752.752 0 1 0 0 1.504.752.752 0 0 0 0-1.504Z" fill="currentColor"/></svg>',disconnected:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.28 2.22a.75.75 0 0 0-1.06 1.06l3.364 3.365a11.99 11.99 0 0 0-2.033 1.634c-.49.489-.964 1.069-1.394 1.689a.75.75 0 1 0 1.233.855c.381-.55.8-1.062 1.222-1.484a10.468 10.468 0 0 1 2.063-1.604l1.591 1.592a8.062 8.062 0 0 0-1.923 1.424c-.61.61-1.109 1.3-1.491 2.056a.75.75 0 1 0 1.338.677 6.51 6.51 0 0 1 1.214-1.673 6.546 6.546 0 0 1 1.984-1.362l1.93 1.93a5.07 5.07 0 0 0-2.876 1.44 5.11 5.11 0 0 0-1.061 1.57.75.75 0 0 0 1.374.602c.185-.422.437-.8.747-1.111a3.59 3.59 0 0 1 3.36-.958l7.858 7.858a.75.75 0 0 0 1.06-1.06L3.28 2.22Zm8.304 6.182 1.584 1.584a6.532 6.532 0 0 1 3.516 1.825 6.798 6.798 0 0 1 1.217 1.692.75.75 0 1 0 1.336-.683 8.292 8.292 0 0 0-1.492-2.07 8.042 8.042 0 0 0-6.16-2.348ZM8.487 5.305 9.713 6.53a10.44 10.44 0 0 1 10.908 4.297.75.75 0 1 0 1.235-.852 11.946 11.946 0 0 0-13.369-4.67Zm4.573 11.134a1.5 1.5 0 1 1-2.121 2.122 1.5 1.5 0 0 1 2.121-2.122Z" fill="currentColor"/></svg>',wand:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m13.314 7.565-.136.126-10.48 10.488a2.27 2.27 0 0 0 3.211 3.208L16.388 10.9a2.251 2.251 0 0 0-.001-3.182l-.157-.146a2.25 2.25 0 0 0-2.916-.007Zm-.848 2.961 1.088 1.088-8.706 8.713a.77.77 0 1 1-1.089-1.088l8.707-8.713Zm4.386 4.48L16.75 15a.75.75 0 0 0-.743.648L16 15.75v.75h-.75a.75.75 0 0 0-.743.648l-.007.102c0 .38.282.694.648.743l.102.007H16v.75c0 .38.282.694.648.743l.102.007a.75.75 0 0 0 .743-.648l.007-.102V18h.75a.75.75 0 0 0 .743-.648L19 17.25a.75.75 0 0 0-.648-.743l-.102-.007h-.75v-.75a.75.75 0 0 0-.648-.743L16.75 15l.102.007Zm-1.553-6.254.027.027a.751.751 0 0 1 0 1.061l-.711.713-1.089-1.089.73-.73a.75.75 0 0 1 1.043.018ZM6.852 5.007 6.75 5a.75.75 0 0 0-.743.648L6 5.75v.75h-.75a.75.75 0 0 0-.743.648L4.5 7.25c0 .38.282.693.648.743L5.25 8H6v.75c0 .38.282.693.648.743l.102.007a.75.75 0 0 0 .743-.648L7.5 8.75V8h.75a.75.75 0 0 0 .743-.648L9 7.25a.75.75 0 0 0-.648-.743L8.25 6.5H7.5v-.75a.75.75 0 0 0-.648-.743L6.75 5l.102.007Zm12-2L18.75 3a.75.75 0 0 0-.743.648L18 3.75v.75h-.75a.75.75 0 0 0-.743.648l-.007.102c0 .38.282.693.648.743L17.25 6H18v.75c0 .38.282.693.648.743l.102.007a.75.75 0 0 0 .743-.648l.007-.102V6h.75a.75.75 0 0 0 .743-.648L21 5.25a.75.75 0 0 0-.648-.743L20.25 4.5h-.75v-.75a.75.75 0 0 0-.648-.743L18.75 3l.102.007Z" fill="currentColor"/></svg>',recording:'<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path d="M12 18a6 6 0 1 0 0-12 6 6 0 0 0 0 12Z"/><path d="M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2ZM3.5 12a8.5 8.5 0 1 1 17 0 8.5 8.5 0 0 1-17 0Z"/></svg>',subtract:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.755 12.5h16.492a.75.75 0 0 0 0-1.5H3.755a.75.75 0 0 0 0 1.5Z" fill="currentColor"/></svg>',stop_recording:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 3.5C9.74566 3.5 7.58365 4.39553 5.98959 5.98959C4.39553 7.58365 3.5 9.74566 3.5 12C3.5 14.2543 4.39553 16.4163 5.98959 18.0104C7.58365 19.6045 9.74566 20.5 12 20.5C14.2543 20.5 16.4163 19.6045 18.0104 18.0104C19.6045 16.4163 20.5 14.2543 20.5 12C20.5 9.74566 19.6045 7.58365 18.0104 5.98959C16.4163 4.39553 14.2543 3.5 12 3.5ZM2 12C2 6.477 6.477 2 12 2C17.523 2 22 6.477 22 12C22 17.523 17.523 22 12 22C6.477 22 2 17.523 2 12ZM8 9.5C8 9.10218 8.15804 8.72064 8.43934 8.43934C8.72064 8.15804 9.10218 8 9.5 8H14.5C14.8978 8 15.2794 8.15804 15.5607 8.43934C15.842 8.72064 16 9.10218 16 9.5V14.5C16 14.8978 15.842 15.2794 15.5607 15.5607C15.2794 15.842 14.8978 16 14.5 16H9.5C9.10218 16 8.72064 15.842 8.43934 15.5607C8.15804 15.2794 8 14.8978 8 14.5V9.5Z" fill="currentColor"/></svg>',warning:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10.91 2.782a2.25 2.25 0 0 1 2.975.74l.083.138 7.759 14.009a2.25 2.25 0 0 1-1.814 3.334l-.154.006H4.243a2.25 2.25 0 0 1-2.041-3.197l.072-.143L10.031 3.66a2.25 2.25 0 0 1 .878-.878Zm9.505 15.613-7.76-14.008a.75.75 0 0 0-1.254-.088l-.057.088-7.757 14.008a.75.75 0 0 0 .561 1.108l.095.006h15.516a.75.75 0 0 0 .696-1.028l-.04-.086-7.76-14.008 7.76 14.008ZM12 16.002a.999.999 0 1 1 0 1.997.999.999 0 0 1 0-1.997ZM11.995 8.5a.75.75 0 0 1 .744.647l.007.102.004 4.502a.75.75 0 0 1-1.494.103l-.006-.102-.004-4.502a.75.75 0 0 1 .75-.75Z" fill="currentColor"/></svg>',pin:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="m16.242 2.932 4.826 4.826a2.75 2.75 0 0 1-.715 4.404l-4.87 2.435a.75.75 0 0 0-.374.426l-1.44 4.166a1.25 1.25 0 0 1-2.065.476L8.5 16.561 4.06 21H3v-1.06l4.44-4.44-3.105-3.104a1.25 1.25 0 0 1 .476-2.066l4.166-1.44a.75.75 0 0 0 .426-.373l2.435-4.87a2.75 2.75 0 0 1 4.405-.715Zm3.766 5.886-4.826-4.826a1.25 1.25 0 0 0-2.002.325l-2.435 4.871a2.25 2.25 0 0 1-1.278 1.12l-3.789 1.31 6.705 6.704 1.308-3.789a2.25 2.25 0 0 1 1.12-1.277l4.872-2.436a1.25 1.25 0 0 0 .325-2.002Z" fill="currentColor"/></svg>',pin_off:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3.28 2.22a.75.75 0 0 0-1.06 1.06l5.905 5.905L4.81 10.33a1.25 1.25 0 0 0-.476 2.065L7.439 15.5 3 19.94V21h1.06l4.44-4.44 3.105 3.105a1.25 1.25 0 0 0 2.065-.476l1.145-3.313 5.905 5.904a.75.75 0 0 0 1.06-1.06L3.28 2.22Zm10.355 12.476-1.252 3.626-6.705-6.705 3.626-1.252 4.331 4.331Zm6.048-3.876-3.787 1.894 1.118 1.118 3.34-1.67a2.75 2.75 0 0 0 .714-4.404l-4.825-4.826a2.75 2.75 0 0 0-4.405.715l-1.67 3.34 1.118 1.117 1.894-3.787a1.25 1.25 0 0 1 2.002-.325l4.826 4.826a1.25 1.25 0 0 1-.325 2.002Z" fill="currentColor"/></svg>',spinner:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="10" stroke-width="2" stroke="currentColor" stroke-opacity="0.2" vector-effect="non-scaling-stroke"/><path d="M22 12C22 10.6868 21.7413 9.38642 21.2388 8.17317C20.7362 6.95991 19.9997 5.85752 19.0711 4.92893C18.1425 4.00035 17.0401 3.26375 15.8268 2.7612C14.6136 2.25866 13.3132 2 12 2" stroke="currentColor" stroke-width="2" stroke-linecap="round" vector-effect="non-scaling-stroke"/></svg>',breakout_rooms:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M10.5 3a2.25 2.25 0 0 1 2.25 2.25v6h6A2.25 2.25 0 0 1 21 13.5v5.25A2.25 2.25 0 0 1 18.75 21H5.25A2.25 2.25 0 0 1 3 18.75V5.25A2.25 2.25 0 0 1 5.25 3h5.25Zm.75 9.75H4.5v6c0 .414.336.75.75.75h5.999l.001-6.75Zm7.5 0h-6.001v6.75h6.001a.75.75 0 0 0 .75-.75V13.5a.75.75 0 0 0-.75-.75ZM10.5 4.5H5.25a.75.75 0 0 0-.75.75v6h6.75v-6a.75.75 0 0 0-.75-.75Zm7.398-2.493L18 2a.75.75 0 0 1 .743.648l.007.102v2.5h2.5a.75.75 0 0 1 .743.648L22 6a.75.75 0 0 1-.648.743l-.102.007h-2.5v2.5a.75.75 0 0 1-.648.743L18 10a.75.75 0 0 1-.743-.648l-.007-.102v-2.5h-2.5a.75.75 0 0 1-.743-.648L14 6a.75.75 0 0 1 .648-.743l.102-.007h2.5v-2.5a.75.75 0 0 1 .648-.743Z" fill="currentColor"/></svg>',add:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M11.75 3a.75.75 0 0 1 .743.648l.007.102.001 7.25h7.253a.75.75 0 0 1 .102 1.493l-.102.007h-7.253l.002 7.25a.75.75 0 0 1-1.493.101l-.007-.102-.002-7.249H3.752a.75.75 0 0 1-.102-1.493L3.752 11h7.25L11 3.75a.75.75 0 0 1 .75-.75Z" fill="currentColor"/></svg>',shuffle:'<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M14.0058 8.11111H18.7947L16.9613 9.94444C16.9095 9.99587 16.8684 10.057 16.8402 10.1243C16.812 10.1917 16.7974 10.2639 16.7971 10.3369C16.7966 10.4843 16.8547 10.6259 16.9586 10.7306C17.01 10.7823 17.0711 10.8235 17.1385 10.8517C17.2058 10.8799 17.278 10.8945 17.351 10.8947C17.4985 10.8953 17.64 10.8372 17.7447 10.7333L20.8891 7.59999L20.4947 7.20555L17.7447 4.46111C17.64 4.35723 17.4985 4.29917 17.351 4.29969C17.2036 4.30021 17.0624 4.35927 16.9586 4.46388C16.8547 4.5685 16.7966 4.71009 16.7971 4.85751C16.7977 5.00494 16.8567 5.14612 16.9613 5.24999L18.728 6.99999H13.6669C13.5699 7.00058 13.4748 7.02653 13.391 7.07526C13.3072 7.12399 13.2376 7.19381 13.1891 7.27777L11.7224 9.82777L12.3669 10.9389L14.0058 8.11111Z" fill="currentColor"/><path d="M8.15022 15.9278H3.66688C3.51954 15.9278 3.37823 15.9863 3.27405 16.0905C3.16986 16.1947 3.11133 16.336 3.11133 16.4833C3.11133 16.6307 3.16986 16.772 3.27405 16.8762C3.37823 16.9804 3.51954 17.0389 3.66688 17.0389H8.47244C8.56939 17.0383 8.6645 17.0124 8.74832 16.9636C8.83214 16.9149 8.90174 16.8451 8.95022 16.7611L10.4335 14.2222L9.77799 13.1111L8.15022 15.9278Z"/><path d="M17.7447 13.2056C17.64 13.1017 17.4985 13.0436 17.351 13.0441C17.2036 13.0447 17.0624 13.1037 16.9586 13.2083C16.8547 13.3129 16.7966 13.4545 16.7971 13.602C16.7977 13.7494 16.8567 13.8906 16.9613 13.9944L18.9058 15.9389H14.0058L8.95022 7.29444C8.90174 7.21047 8.83214 7.14066 8.74832 7.09193C8.6645 7.04319 8.56939 7.01725 8.47244 7.01666H3.66688C3.51954 7.01666 3.37823 7.07519 3.27405 7.17938C3.16986 7.28357 3.11133 7.42487 3.11133 7.57222C3.11133 7.71956 3.16986 7.86087 3.27405 7.96505C3.37823 8.06924 3.51954 8.12777 3.66688 8.12777H8.15022L13.2058 16.7667C13.2542 16.8506 13.3239 16.9204 13.4077 16.9692C13.4915 17.0179 13.5866 17.0439 13.6836 17.0444H18.6113L16.9447 18.7111C16.8929 18.7625 16.8517 18.8237 16.8235 18.891C16.7954 18.9584 16.7807 19.0306 16.7805 19.1036C16.7802 19.1766 16.7943 19.2489 16.822 19.3165C16.8497 19.384 16.8905 19.4454 16.9419 19.4972C16.9933 19.549 17.0545 19.5902 17.1218 19.6184C17.1891 19.6465 17.2614 19.6612 17.3344 19.6614C17.4074 19.6617 17.4797 19.6476 17.5472 19.6199C17.6148 19.5922 17.6762 19.5514 17.728 19.5L20.478 16.7556L20.8724 16.3611L17.7447 13.2056Z"/></svg>',edit:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M21.03 2.97a3.578 3.578 0 0 1 0 5.06L9.062 20a2.25 2.25 0 0 1-.999.58l-5.116 1.395a.75.75 0 0 1-.92-.921l1.395-5.116a2.25 2.25 0 0 1 .58-.999L15.97 2.97a3.578 3.578 0 0 1 5.06 0ZM15 6.06 5.062 16a.75.75 0 0 0-.193.333l-1.05 3.85 3.85-1.05A.75.75 0 0 0 8 18.938L17.94 9 15 6.06Zm2.03-2.03-.97.97L19 7.94l.97-.97a2.079 2.079 0 0 0-2.94-2.94Z" fill="currentColor"/></svg>',delete:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 1.75a3.25 3.25 0 0 1 3.245 3.066L15.25 5h5.25a.75.75 0 0 1 .102 1.493L20.5 6.5h-.796l-1.28 13.02a2.75 2.75 0 0 1-2.561 2.474l-.176.006H8.313a2.75 2.75 0 0 1-2.714-2.307l-.023-.174L4.295 6.5H3.5a.75.75 0 0 1-.743-.648L2.75 5.75a.75.75 0 0 1 .648-.743L3.5 5h5.25A3.25 3.25 0 0 1 12 1.75Zm6.197 4.75H5.802l1.267 12.872a1.25 1.25 0 0 0 1.117 1.122l.127.006h7.374c.6 0 1.109-.425 1.225-1.002l.02-.126L18.196 6.5ZM13.75 9.25a.75.75 0 0 1 .743.648L14.5 10v7a.75.75 0 0 1-1.493.102L13 17v-7a.75.75 0 0 1 .75-.75Zm-3.5 0a.75.75 0 0 1 .743.648L11 10v7a.75.75 0 0 1-1.493.102L9.5 17v-7a.75.75 0 0 1 .75-.75Zm1.75-6a1.75 1.75 0 0 0-1.744 1.606L10.25 5h3.5A1.75 1.75 0 0 0 12 3.25Z" fill="currentColor"/></svg>',back:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M4.75 2a.75.75 0 0 1 .743.648l.007.102v5.69l4.574-4.56a6.41 6.41 0 0 1 8.879-.179l.186.18a6.41 6.41 0 0 1 0 9.063l-8.846 8.84a.75.75 0 0 1-1.06-1.062l8.845-8.838a4.91 4.91 0 0 0-6.766-7.112l-.178.17L6.562 9.5h5.688a.75.75 0 0 1 .743.648l.007.102a.75.75 0 0 1-.648.743L12.25 11h-7.5a.75.75 0 0 1-.743-.648L4 10.25v-7.5A.75.75 0 0 1 4.75 2Z" fill="currentColor"/></svg>',save:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M3 5.75A2.75 2.75 0 0 1 5.75 3h9.964a3.25 3.25 0 0 1 2.299.952l2.035 2.035c.61.61.952 1.437.952 2.299v9.964A2.75 2.75 0 0 1 18.25 21H5.75A2.75 2.75 0 0 1 3 18.25V5.75ZM5.75 4.5c-.69 0-1.25.56-1.25 1.25v12.5c0 .69.56 1.25 1.25 1.25H6v-5.25A2.25 2.25 0 0 1 8.25 12h7.5A2.25 2.25 0 0 1 18 14.25v5.25h.25c.69 0 1.25-.56 1.25-1.25V8.286c0-.465-.184-.91-.513-1.238l-2.035-2.035a1.75 1.75 0 0 0-.952-.49V7.25a2.25 2.25 0 0 1-2.25 2.25h-4.5A2.25 2.25 0 0 1 7 7.25V4.5H5.75Zm10.75 15v-5.25a.75.75 0 0 0-.75-.75h-7.5a.75.75 0 0 0-.75.75v5.25h9Zm-8-15v2.75c0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75V4.5h-6Z" fill="currentColor"/></svg>',web:'<svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 1.999c5.524 0 10.002 4.478 10.002 10.002 0 5.523-4.478 10.001-10.002 10.001-5.524 0-10.002-4.478-10.002-10.001C1.998 6.477 6.476 1.999 12 1.999ZM14.939 16.5H9.06c.652 2.414 1.786 4.002 2.939 4.002s2.287-1.588 2.939-4.002Zm-7.43 0H4.785a8.532 8.532 0 0 0 4.094 3.411c-.522-.82-.953-1.846-1.27-3.015l-.102-.395Zm11.705 0h-2.722c-.324 1.335-.792 2.5-1.373 3.411a8.528 8.528 0 0 0 3.91-3.127l.185-.283ZM7.094 10H3.735l-.005.017a8.525 8.525 0 0 0-.233 1.984c0 1.056.193 2.067.545 3h3.173a20.847 20.847 0 0 1-.123-5Zm8.303 0H8.603a18.966 18.966 0 0 0 .135 5h6.524a18.974 18.974 0 0 0 .135-5Zm4.868 0h-3.358c.062.647.095 1.317.095 2a20.3 20.3 0 0 1-.218 3h3.173a8.482 8.482 0 0 0 .544-3c0-.689-.082-1.36-.236-2ZM8.88 4.09l-.023.008A8.531 8.531 0 0 0 4.25 8.5h3.048c.314-1.752.86-3.278 1.583-4.41ZM12 3.499l-.116.005C10.62 3.62 9.396 5.622 8.83 8.5h6.342c-.566-2.87-1.783-4.869-3.045-4.995L12 3.5Zm3.12.59.107.175c.669 1.112 1.177 2.572 1.475 4.237h3.048a8.533 8.533 0 0 0-4.339-4.29l-.291-.121Z" fill="currentColor"/></svg>',checkmark:'<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 24 24"><path fill="none" d="M0 0h24v24H0V0z"/><path d="m18 6.7-8.48 8.48-3.54-3.54a.996.996 0 1 0-1.41 1.41l4.24 4.24c.39.39 1.02.39 1.41 0l9.18-9.18a.999.999 0 0 0-.01-1.42c-.37-.38-1-.38-1.39.01z"/></svg>',spotlight:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M19.745 4C20.3417 4 20.914 4.23705 21.336 4.65901C21.7579 5.08097 21.995 5.65326 21.995 6.25V12.805C21.5485 12.3774 21.0434 12.0154 20.495 11.73V6.25C20.495 6.05109 20.416 5.86032 20.2753 5.71967C20.1347 5.57902 19.9439 5.5 19.745 5.5H4.25C4.05109 5.5 3.86032 5.57902 3.71967 5.71967C3.57902 5.86032 3.5 6.05109 3.5 6.25V17.755C3.5 18.169 3.836 18.505 4.25 18.505L6.999 18.504L7 15.75C7.00002 15.3108 7.16517 14.8877 7.46268 14.5646C7.76019 14.2415 8.1683 14.0421 8.606 14.006L8.75 14H12.022C11.7223 14.4675 11.484 14.9716 11.313 15.5H8.75C8.69368 15.5001 8.63904 15.5192 8.59493 15.5542C8.55083 15.5893 8.51984 15.6382 8.507 15.693L8.5 15.75L8.499 18.504H11.077C11.1569 19.0193 11.2989 19.5229 11.5 20.004H4.25C3.65344 20.004 3.08129 19.7671 2.65936 19.3453C2.23744 18.9236 2.00027 18.3516 2 17.755V6.25C2 5.65326 2.23705 5.08097 2.65901 4.65901C3.08097 4.23705 3.65326 4 4.25 4H19.745Z"/><path d="M12 7C12.7956 7 13.5587 7.31607 14.1213 7.87868C14.6839 8.44129 15 9.20435 15 10C15 10.7956 14.6839 11.5587 14.1213 12.1213C13.5587 12.6839 12.7956 13 12 13C11.2044 13 10.4413 12.6839 9.87868 12.1213C9.31607 11.5587 9 10.7956 9 10C9 9.20435 9.31607 8.44129 9.87868 7.87868C10.4413 7.31607 11.2044 7 12 7ZM12 8.5C11.6022 8.5 11.2206 8.65804 10.9393 8.93934C10.658 9.22064 10.5 9.60218 10.5 10C10.5 10.3978 10.658 10.7794 10.9393 11.0607C11.2206 11.342 11.6022 11.5 12 11.5C12.3978 11.5 12.7794 11.342 13.0607 11.0607C13.342 10.7794 13.5 10.3978 13.5 10C13.5 9.60218 13.342 9.22064 13.0607 8.93934C12.7794 8.65804 12.3978 8.5 12 8.5Z"/><path d="M23 17.5C23 18.9587 22.4205 20.3576 21.3891 21.3891C20.3576 22.4205 18.9587 23 17.5 23C16.0413 23 14.6424 22.4205 13.6109 21.3891C12.5795 20.3576 12 18.9587 12 17.5C12 16.0413 12.5795 14.6424 13.6109 13.6109C14.6424 12.5795 16.0413 12 17.5 12C18.9587 12 20.3576 12.5795 21.3891 13.6109C22.4205 14.6424 23 16.0413 23 17.5ZM18.055 14.42C18.0207 14.2993 17.9479 14.193 17.8478 14.1174C17.7476 14.0417 17.6255 14.0008 17.5 14.0008C17.3745 14.0008 17.2524 14.0417 17.1522 14.1174C17.0521 14.193 16.9793 14.2993 16.945 14.42L16.388 16.208H14.585C14.019 16.208 13.785 16.962 14.242 17.308L15.7 18.413L15.143 20.2C14.968 20.761 15.584 21.228 16.042 20.881L17.5 19.777L18.958 20.881C19.416 21.228 20.032 20.761 19.857 20.201L19.3 18.413L20.758 17.309C21.216 16.962 20.981 16.208 20.415 16.208H18.612L18.055 14.421V14.42Z"/></svg>',join_stage:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M17.5 22C14.4618 22 12 19.5376 12 16.5C12 13.4623 14.4618 11 17.5 11C20.5371 11 23 13.4624 23 16.5C23 19.5376 20.5371 22 17.5 22ZM17.0704 18.992L17.1167 19.0322C17.1868 19.0841 17.2716 19.1125 17.3588 19.1132C17.4461 19.1139 17.5314 19.0869 17.6023 19.036L17.654 18.992L17.6936 18.9458C17.7455 18.8757 17.7739 18.7909 17.7746 18.7037C17.7753 18.6164 17.7483 18.5311 17.6975 18.4602L17.6535 18.4085L16.158 16.9125H19.8375L19.8936 16.9092C19.9829 16.8969 20.0657 16.8558 20.1293 16.792C20.193 16.7282 20.234 16.6454 20.2462 16.5561L20.25 16.5005L20.2462 16.4444C20.2339 16.3553 20.1928 16.2725 20.1292 16.2089C20.0655 16.1452 19.9828 16.1041 19.8936 16.0919L19.8375 16.088H16.158L17.654 14.592L17.6941 14.5453C17.7537 14.4659 17.7827 14.3676 17.7756 14.2686C17.7686 14.1695 17.726 14.0763 17.6558 14.0061C17.5856 13.9359 17.4924 13.8934 17.3934 13.8863C17.2943 13.8793 17.1961 13.9082 17.1167 13.9678L17.071 14.0079L14.8699 16.2079L14.8303 16.2547C14.7784 16.3247 14.75 16.4094 14.7493 16.4965C14.7485 16.5837 14.7753 16.6688 14.8259 16.7398L14.8699 16.7915L17.0704 18.992Z"/><path d="M2.80546 3.80546C2.28973 4.32118 2 5.02065 2 5.75V16.25C2 16.6111 2.07113 16.9687 2.20933 17.3024C2.34753 17.636 2.5501 17.9392 2.80546 18.1945C3.06082 18.4499 3.36398 18.6525 3.69762 18.7907C4.03127 18.9289 4.38886 19 4.75 19H11.498C11.3 18.526 11.157 18.023 11.076 17.5H9.002V14.75C9.002 14.6837 9.02834 14.6201 9.07522 14.5732C9.12211 14.5263 9.1857 14.5 9.252 14.5H11.3135C11.4858 13.9665 11.7253 13.4632 12.0218 13H9.252C8.285 13 7.502 13.784 7.502 14.75V16H7.5V17.5H4.75C4.06 17.5 3.5 16.94 3.5 16.25V5.75C3.5 5.06 4.06 4.5 4.75 4.5H19.25C19.94 4.5 20.5 5.06 20.5 5.75V10.732C20.6457 10.808 20.7884 10.8895 20.9277 10.9762C20.9687 11.0017 21.0093 11.0276 21.0497 11.054C21.3899 11.2762 21.708 11.5294 22 11.8096V5.75C22 5.02065 21.7103 4.32118 21.1945 3.80546C20.6788 3.28973 19.9793 3 19.25 3H4.75C4.02065 3 3.32118 3.28973 2.80546 3.80546Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M14.4181 10.7757C14.7938 10.264 15 9.64262 15 9C15 8.20435 14.6839 7.44129 14.1213 6.87868C13.5587 6.31607 12.7956 6 12 6C11.2044 6 10.4413 6.31607 9.87868 6.87868C9.31607 7.44129 9 8.20435 9 9C9 9.79565 9.31607 10.5587 9.87868 11.1213C10.4413 11.6839 11.2044 12 12 12C12.333 12 12.6602 11.9446 12.9695 11.839C13.3992 11.4213 13.8864 11.0625 14.4181 10.7757ZM10.9393 7.93934C11.2206 7.65804 11.6022 7.5 12 7.5C12.3978 7.5 12.7794 7.65804 13.0607 7.93934C13.342 8.22064 13.5 8.60218 13.5 9C13.5 9.39782 13.342 9.77936 13.0607 10.0607C12.7794 10.342 12.3978 10.5 12 10.5C11.6022 10.5 11.2206 10.342 10.9393 10.0607C10.658 9.77936 10.5 9.39782 10.5 9C10.5 8.60218 10.658 8.22064 10.9393 7.93934Z"></svg>',leave_stage:'<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path d="M2.80546 3.80546C2.28973 4.32118 2 5.02065 2 5.75V16.25C2 16.6111 2.07113 16.9687 2.20933 17.3024C2.34753 17.636 2.5501 17.9392 2.80546 18.1945C3.06082 18.4499 3.36398 18.6525 3.69762 18.7907C4.03127 18.9289 4.38886 19 4.75 19H11.498C11.3 18.526 11.157 18.023 11.076 17.5H9.002V14.75C9.002 14.6837 9.02834 14.6201 9.07522 14.5732C9.12211 14.5263 9.1857 14.5 9.252 14.5H11.3135C11.4858 13.9665 11.7253 13.4632 12.0218 13H9.252C8.285 13 7.502 13.784 7.502 14.75V16H7.5V17.5H4.75C4.06 17.5 3.5 16.94 3.5 16.25V5.75C3.5 5.06 4.06 4.5 4.75 4.5H19.25C19.94 4.5 20.5 5.06 20.5 5.75V10.732C20.6457 10.808 20.7884 10.8895 20.9277 10.9762C20.9687 11.0017 21.0093 11.0276 21.0497 11.054C21.3899 11.2762 21.708 11.5294 22 11.8096V5.75C22 5.02065 21.7103 4.32118 21.1945 3.80546C20.6788 3.28973 19.9793 3 19.25 3H4.75C4.02065 3 3.32118 3.28973 2.80546 3.80546Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M14.4181 10.7757C14.7938 10.264 15 9.64262 15 9C15 8.20435 14.6839 7.44129 14.1213 6.87868C13.5587 6.31607 12.7956 6 12 6C11.2044 6 10.4413 6.31607 9.87868 6.87868C9.31607 7.44129 9 8.20435 9 9C9 9.79565 9.31607 10.5587 9.87868 11.1213C10.4413 11.6839 11.2044 12 12 12C12.333 12 12.6602 11.9446 12.9695 11.839C13.3992 11.4213 13.8864 11.0625 14.4181 10.7757ZM10.9393 7.93934C11.2206 7.65804 11.6022 7.5 12 7.5C12.3978 7.5 12.7794 7.65804 13.0607 7.93934C13.342 8.22064 13.5 8.60218 13.5 9C13.5 9.39782 13.342 9.77936 13.0607 10.0607C12.7794 10.342 12.3978 10.5 12 10.5C11.6022 10.5 11.2206 10.342 10.9393 10.0607C10.658 9.77936 10.5 9.39782 10.5 9C10.5 8.60218 10.658 8.22064 10.9393 7.93934Z"/><path d="M17.5 11C20.5382 11 23 13.4624 23 16.5C23 19.5377 20.5382 22 17.5 22C14.4629 22 12 19.5377 12 16.5C12 13.4624 14.4629 11 17.5 11V11ZM17.9296 14.0079L17.8833 13.9678C17.8132 13.9159 17.7284 13.8875 17.6412 13.8868C17.5539 13.8861 17.4686 13.9131 17.3977 13.964L17.346 14.0079L17.3064 14.0542C17.2545 14.1243 17.2261 14.2091 17.2254 14.2963C17.2247 14.3836 17.2517 14.4689 17.3026 14.5398L17.3465 14.5915L18.842 16.0875H15.1625L15.1064 16.0908C15.0171 16.1031 14.9343 16.1442 14.8707 16.208C14.807 16.2718 14.766 16.3546 14.7539 16.4439L14.75 16.4995L14.7539 16.5556C14.7661 16.6447 14.8072 16.7275 14.8708 16.7911C14.9345 16.8548 15.0172 16.8959 15.1064 16.9081L15.1625 16.912H18.842L17.346 18.408L17.3059 18.4547C17.2463 18.5341 17.2173 18.6324 17.2244 18.7314C17.2314 18.8305 17.274 18.9237 17.3442 18.9939C17.4144 19.0641 17.5076 19.1066 17.6066 19.1137C17.7057 19.1207 17.8039 19.0918 17.8833 19.0322L17.929 18.9921L20.1301 16.7921L20.1697 16.7453C20.2216 16.6753 20.25 16.5906 20.2507 16.5035C20.2515 16.4163 20.2247 16.3312 20.1741 16.2602L20.1301 16.2085L17.9301 14.0079L17.8833 13.9678L17.9296 14.0079V14.0079Z"/></svg>',pip_off:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.8666 12.3058C11.0731 12.3058 11.2404 12.1385 11.2404 11.932V8.56753C11.2404 8.36107 11.0731 8.1937 10.8666 8.1937C10.6601 8.1937 10.4928 8.36107 10.4928 8.56753V11.0295L6.45393 6.99066C6.30794 6.84467 6.07124 6.84467 5.92525 6.99066C5.77926 7.13665 5.77926 7.37335 5.92525 7.51934L9.9641 11.5582L7.50212 11.5582C7.29566 11.5582 7.12829 11.7256 7.12829 11.932C7.12829 12.1385 7.29566 12.3058 7.50212 12.3058L10.8666 12.3058ZM5.73832 19.8879C3.6737 19.8879 2 18.2141 2 16.1495V7.73832C2 5.6737 3.6737 4 5.73832 4H18.2617C20.3263 4 22 5.6737 22 7.73832L22 13.0269C22 12.2687 21.6002 11.6038 21 11.2316C20.8468 11.1366 20.6806 11.0607 20.5047 11.0071V7.73832C20.5047 6.49955 19.5005 5.49533 18.2617 5.49533H5.73832C4.49955 5.49533 3.49533 6.49955 3.49533 7.73832V16.1495C3.49533 17.3883 4.49955 18.3925 5.73832 18.3925H10.7971C10.8506 18.5685 10.9266 18.7347 11.0216 18.8879C11.3938 19.4881 12.0587 19.8879 12.8169 19.8879H5.73832Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M19.7265 12.5H13.3911C12.899 12.5 12.5 12.899 12.5 13.3911V17.6462C12.5 18.1384 12.899 18.5374 13.3911 18.5374H19.7265C20.2187 18.5374 20.6176 18.1384 20.6176 17.6462V13.3911C20.6176 12.899 20.2187 12.5 19.7265 12.5ZM13.3911 11.5C12.3467 11.5 11.5 12.3467 11.5 13.3911V17.6462C11.5 18.6907 12.3467 19.5374 13.3911 19.5374H19.7265C20.771 19.5374 21.6176 18.6907 21.6176 17.6462V13.3911C21.6176 12.3467 20.771 11.5 19.7265 11.5H13.3911Z"/></svg>',pip_on:'<svg viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M5.73832 19.8879C3.6737 19.8879 2 18.2141 2 16.1495V7.73832C2 5.6737 3.6737 4 5.73832 4H18.2617C20.3263 4 22 5.6737 22 7.73832L22 13.0269C22 12.2687 21.6002 11.6038 21 11.2316C20.8468 11.1366 20.6806 11.0607 20.5047 11.0071V7.73832C20.5047 6.49955 19.5005 5.49533 18.2617 5.49533H5.73832C4.49955 5.49533 3.49533 6.49955 3.49533 7.73832V16.1495C3.49533 17.3883 4.49955 18.3925 5.73832 18.3925H10.7971C10.8506 18.5685 10.9266 18.7347 11.0216 18.8879C11.3938 19.4881 12.0587 19.8879 12.8169 19.8879H5.73832Z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M19.7265 12.5H13.3911C12.899 12.5 12.5 12.899 12.5 13.3911V17.6462C12.5 18.1384 12.899 18.5374 13.3911 18.5374H19.7265C20.2187 18.5374 20.6176 18.1384 20.6176 17.6462V13.3911C20.6176 12.899 20.2187 12.5 19.7265 12.5ZM13.3911 11.5C12.3467 11.5 11.5 12.3467 11.5 13.3911V17.6462C11.5 18.6907 12.3467 19.5374 13.3911 19.5374H19.7265C20.771 19.5374 21.6176 18.6907 21.6176 17.6462V13.3911C21.6176 12.3467 20.771 11.5 19.7265 11.5H13.3911Z"/><path d="M6.18951 6.88123C5.98304 6.88123 5.81567 7.0486 5.81567 7.25506V10.6195C5.81567 10.826 5.98304 10.9934 6.18951 10.9934C6.39597 10.9934 6.56334 10.826 6.56334 10.6195V8.15757L10.6022 12.1964C10.7482 12.3424 10.9849 12.3424 11.1309 12.1964C11.2769 12.0504 11.2769 11.8137 11.1309 11.6677L7.09202 7.62889L9.55399 7.62889C9.76045 7.62889 9.92782 7.46152 9.92782 7.25506C9.92782 7.0486 9.76045 6.88123 9.55399 6.88123L6.18951 6.88123Z"/></svg>',signal_1:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 16h2v5H3z"></path></svg>',signal_2:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 16h2v5H3zm4-3h2v8H7z"></path></svg>',signal_3:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 16h2v5H3zm4-3h2v8H7zm4-3h2v11h-2z"></path></svg>',signal_4:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 16h2v5H3zm4-3h2v8H7zm4-3h2v11h-2zm4-3h2v14h-2z"></path></svg>',signal_5:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><path d="M3 16h2v5H3zm4-3h2v8H7zm4-3h2v11h-2zm4-3h2v14h-2zm4-3h2v17h-2z"></path></svg>',start_livestream:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="currentColor" d="M6.343 4.938a1 1 0 0 1 0 1.415a8.003 8.003 0 0 0 0 11.317a1 1 0 1 1-1.415 1.414c-3.906-3.906-3.906-10.24 0-14.146a1 1 0 0 1 1.415 0Zm12.731 0c3.906 3.907 3.906 10.24 0 14.146a1 1 0 0 1-1.414-1.414a8.003 8.003 0 0 0 0-11.317a1 1 0 0 1 1.414-1.415ZM9.31 7.812a1 1 0 0 1 0 1.414a3.92 3.92 0 0 0 0 5.544a1 1 0 1 1-1.414 1.414a5.92 5.92 0 0 1 0-8.372a1 1 0 0 1 1.414 0Zm6.959 0a5.92 5.92 0 0 1 0 8.372a1 1 0 0 1-1.415-1.414a3.92 3.92 0 0 0 0-5.544a1 1 0 0 1 1.415-1.414Zm-4.187 2.77a1.5 1.5 0 1 1 0 3a1.5 1.5 0 0 1 0-3Z"/></svg>',stop_livestream:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path fill="currentColor" d="M2.854 2.146a.5.5 0 1 0-.708.708l1.811 1.81A8.218 8.218 0 0 0 2 10a8.228 8.228 0 0 0 2.604 6.015a.725.725 0 0 0 1.01-.025c.316-.316.277-.819-.027-1.11A6.73 6.73 0 0 1 3.5 10c0-1.62.57-3.107 1.522-4.27l.712.71A5.726 5.726 0 0 0 4.5 10c0 1.691.73 3.213 1.893 4.264a.713.713 0 0 0 .983-.037c.328-.328.267-.844-.041-1.134A4.238 4.238 0 0 1 6 10c0-.93.298-1.789.804-2.489l1.842 1.842a1.5 1.5 0 0 0 2 2l6.5 6.5a.5.5 0 0 0 .708-.707l-1.811-1.81l-1.065-1.066l-.712-.71l-1.07-1.072l-1.842-1.841l-2-2L7.4 6.693l-.942-.942l-.82-.82l-.944-.944l-1.841-1.842Zm13.794 12.38A8.212 8.212 0 0 0 18 10c0-2.283-.928-4.35-2.426-5.843a.726.726 0 0 0-1.027.01c-.31.31-.28.8.01 1.095A6.727 6.727 0 0 1 16.5 10a6.718 6.718 0 0 1-.94 3.438l1.088 1.089Zm-1.822-1.822A5.73 5.73 0 0 0 15.5 10a5.733 5.733 0 0 0-1.706-4.087a.714.714 0 0 0-1.008.016c-.319.318-.272.816.014 1.111A4.235 4.235 0 0 1 14 10c0 .557-.107 1.09-.302 1.577l1.128 1.127Z"/></svg>',viewers:'<svg fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 9.005a4 4 0 1 1 0 8 4 4 0 0 1 0-8Zm0 1.5a2.5 2.5 0 1 0 0 5 2.5 2.5 0 0 0 0-5ZM12 5.5c4.613 0 8.596 3.15 9.701 7.564a.75.75 0 1 1-1.455.365 8.503 8.503 0 0 0-16.493.004.75.75 0 0 1-1.455-.363A10.003 10.003 0 0 1 12 5.5Z" fill="currentColor"/></svg>',debug:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="m10.05 15.42 6.256-8.476a.694.694 0 0 1 1.235.57l-.03.098-3.87 9.8a2.07 2.07 0 1 1-3.737-1.766l.069-.115.076-.11 6.257-8.477-6.257 8.476Zm2.05-4.549-1.226 1.66a3.32 3.32 0 0 0-2.29 3.024.75.75 0 0 1-1.5-.063A4.819 4.819 0 0 1 9.14 11.74c.9-.631 1.942-.911 2.961-.87Zm4.167 2.752c.28.586.436 1.22.463 1.866a.75.75 0 0 1-1.376.444l.913-2.31Zm-2.233-5.37-.969 1.311a6.22 6.22 0 0 0-4.736 1.02 6.208 6.208 0 0 0-2.419 3.39.75.75 0 0 1-1.442-.412 7.708 7.708 0 0 1 3-4.207 7.724 7.724 0 0 1 6.566-1.102Zm3.51 2.138c.25.267.486.556.702.865a7.727 7.727 0 0 1 1.097 2.288.75.75 0 0 1-1.44.417 6.23 6.23 0 0 0-.885-1.845l-.102-.138.627-1.587ZM15.98 5.852l-.088.054c-.123.082-.236.18-.337.295l-.096.12-.54.732a9.138 9.138 0 0 0-8.261 1.146A9.103 9.103 0 0 0 3.38 12.37a.75.75 0 1 1-1.398-.543A10.603 10.603 0 0 1 5.799 6.97 10.642 10.642 0 0 1 15.98 5.852Zm2.629 1.562a10.646 10.646 0 0 1 2.022 2.171c.49.702.892 1.451 1.199 2.235a.75.75 0 1 1-1.397.547 9.188 9.188 0 0 0-2.327-3.405l.381-.964c.076-.19.115-.388.122-.584Z" fill="currentColor"/></svg>',info:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 1.999c5.524 0 10.002 4.478 10.002 10.002 0 5.523-4.478 10.001-10.002 10.001-5.524 0-10.002-4.478-10.002-10.001C1.998 6.477 6.476 1.999 12 1.999Zm0 1.5a8.502 8.502 0 1 0 0 17.003A8.502 8.502 0 0 0 12 3.5Zm-.004 7a.75.75 0 0 1 .744.648l.007.102.003 5.502a.75.75 0 0 1-1.493.102l-.007-.101-.003-5.502a.75.75 0 0 1 .75-.75ZM12 7.003a.999.999 0 1 1 0 1.997.999.999 0 0 1 0-1.997Z" fill="currentColor"/></svg>',devices:'<svg fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12 18.5a.75.75 0 1 0 0 1.5.75.75 0 0 0 0-1.5Zm5.5-8.5V9a5.5 5.5 0 1 0-11 0v1H9a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H6.5v.25a2.25 2.25 0 0 0 2.096 2.245l.154.005h1.128a2.251 2.251 0 1 1 0 1.5H8.75a3.75 3.75 0 0 1-3.745-3.55L5 16.25V9a7 7 0 0 1 14 0v5a2 2 0 0 1-1.85 1.995L17 16h-2a1 1 0 0 1-.993-.883L14 15v-4a1 1 0 0 1 .883-.993L15 10h2.5Zm-9 1.5h-2v3h2v-3Zm9 0h-2v3H17a.5.5 0 0 0 .492-.41L17.5 14v-2.5Z" fill="currentColor"/></svg>',horizontal_dots:'<svg fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M8 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM14 12a2 2 0 1 1-4 0 2 2 0 0 1 4 0ZM18 14a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z" fill="currentColor"/></svg>',ai_sparkle:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 49 48" fill="none"><path fill="#F13E1B" d="m30.023 15.96.07.016a1.362 1.362 0 0 1 .657 2.068c-.163.23-.392.403-.658.497l-3.444 1.118a7.095 7.095 0 0 0-4.495 4.492l-1.12 3.442a1.357 1.357 0 0 1-1.267.907h-.016a1.361 1.361 0 0 1-1.283-.907l-1.12-3.442a7.091 7.091 0 0 0-4.495-4.509l-3.444-1.119a1.36 1.36 0 0 1 0-2.564l3.444-1.118a7.097 7.097 0 0 0 4.427-4.492l1.119-3.442a1.36 1.36 0 0 1 2.566 0l1.12 3.442a7.09 7.09 0 0 0 4.495 4.492l3.444 1.118Zm9.195 16.007-2.755-.894a5.678 5.678 0 0 1-3.596-3.594l-.896-2.753a1.087 1.087 0 0 0-2.053 0l-.895 2.753a5.672 5.672 0 0 1-3.541 3.594l-2.756.894a1.088 1.088 0 0 0 0 2.052l2.756.895a5.675 5.675 0 0 1 3.596 3.607l.896 2.753a1.088 1.088 0 0 0 2.052 0l.896-2.753a5.672 5.672 0 0 1 3.596-3.594l2.756-.894a1.088 1.088 0 0 0 0-2.052l-.056-.014Z"/><path fill="#2160FD" d="m39.218 31.967-2.755-.894a5.677 5.677 0 0 1-3.596-3.594l-.896-2.753a1.087 1.087 0 0 0-2.053 0l-.895 2.753a5.672 5.672 0 0 1-3.541 3.594l-2.756.894a1.088 1.088 0 0 0 0 2.052l2.756.895a5.675 5.675 0 0 1 3.596 3.607l.896 2.753a1.088 1.088 0 0 0 2.052 0l.896-2.753a5.672 5.672 0 0 1 3.596-3.594l2.756-.894a1.088 1.088 0 0 0 0-2.052l-.056-.014Z"/></svg>',meeting_ai:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28" fill="none"><path fill="#F13E1B" d="M9.111 12.888a4.98 4.98 0 0 0-1.075-.8l-.04.048a4.651 4.651 0 0 0-.903-.424l-2.446-.8a.963.963 0 0 1-.467-.356.953.953 0 0 1 0-1.116.955.955 0 0 1 .467-.352l2.446-.8A5.088 5.088 0 0 0 9.04 7.06a5.048 5.048 0 0 0 1.2-1.904l.02-.064.799-2.444A.97.97 0 0 1 11.969 2a.97.97 0 0 1 .91.648l.8 2.444a5.147 5.147 0 0 0 1.219 1.976 5.042 5.042 0 0 0 1.974 1.2l2.45.8h.048c.188.067.351.19.468.352.115.164.176.36.175.56.001.2-.06.396-.175.56a1 1 0 0 1-.468.352l-2.446.8a5.067 5.067 0 0 0-1.978 1.2 5.096 5.096 0 0 0-1.199 1.976l-.8 2.448-.023.06a1.02 1.02 0 0 1-.184.284.967.967 0 0 1-.703.3 1 1 0 0 1-.927-.644l-.8-2.448a5.11 5.11 0 0 0-.799-1.508 5.16 5.16 0 0 0-.4-.472Zm10.434 5.396a.492.492 0 0 1 .176-.236.473.473 0 0 1 .1-.048.466.466 0 0 1 .168-.04c.1 0 .197.031.28.088l.091.072a.456.456 0 0 1 .096.164l.4 1.224c.124.372.332.71.607.988.278.276.616.484.987.608l1.223.4h.028l.084.04a.536.536 0 0 1 .148.136c.056.082.087.18.088.28a.484.484 0 0 1-.32.456l-1.227.4a2.528 2.528 0 0 0-1.595 1.6l-.399 1.224a.46.46 0 0 1-.176.232.464.464 0 0 1-.28.088.475.475 0 0 1-.455-.32l-.4-1.224a2.507 2.507 0 0 0-.611-.992 2.487 2.487 0 0 0-.987-.612l-1.223-.4a.48.48 0 0 1 0-.908l1.223-.4c.367-.128.7-.337.975-.612.137-.142.257-.3.36-.468.1-.162.18-.335.24-.516l.399-1.224Z"/><path fill="currentColor" d="M19.545 18.284a.492.492 0 0 1 .176-.236.469.469 0 0 1 .1-.048.466.466 0 0 1 .168-.04c.1 0 .197.031.28.088l.091.072a.456.456 0 0 1 .096.164l.4 1.224c.124.372.332.71.607.988.279.276.616.484.988.608l1.222.4h.028l.084.04a.534.534 0 0 1 .148.136c.057.082.087.18.088.28a.484.484 0 0 1-.32.456l-1.227.4a2.528 2.528 0 0 0-1.595 1.6l-.399 1.224a.46.46 0 0 1-.175.232.464.464 0 0 1-.28.088.475.475 0 0 1-.456-.32l-.4-1.224a2.509 2.509 0 0 0-.61-.992 2.487 2.487 0 0 0-.988-.612l-1.223-.4a.48.48 0 0 1 0-.908l1.223-.4c.367-.128.7-.337.975-.612a2.7 2.7 0 0 0 .36-.468c.1-.162.18-.335.24-.516l.4-1.224Z"/></svg>',captionsOn:'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M18.75 4A3.25 3.25 0 0 1 22 7.25v9.505a3.25 3.25 0 0 1-3.25 3.25H5.25A3.25 3.25 0 0 1 2 16.755V7.25a3.25 3.25 0 0 1 3.066-3.245L5.25 4h13.5Zm0 1.5H5.25l-.144.006A1.75 1.75 0 0 0 3.5 7.25v9.505c0 .966.784 1.75 1.75 1.75h13.5a1.75 1.75 0 0 0 1.75-1.75V7.25a1.75 1.75 0 0 0-1.75-1.75ZM5.5 12c0-3.146 2.713-4.775 5.122-3.401A.75.75 0 0 1 9.878 9.9C8.481 9.104 7 9.994 7 12c0 2.005 1.484 2.896 2.88 2.103a.75.75 0 0 1 .74 1.304C8.216 16.775 5.5 15.143 5.5 12Zm7.5 0c0-3.146 2.713-4.775 5.122-3.401a.75.75 0 0 1-.744 1.302C15.981 9.104 14.5 9.994 14.5 12c0 2.005 1.484 2.896 2.88 2.103a.75.75 0 0 1 .74 1.304C15.716 16.775 13 15.143 13 12Z" fill="currentColor"/></svg>',captionsOff:'<svg width="24" height="24" fill="none" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M3.28 2.22a.75.75 0 0 0-1.06 1.06l1.25 1.25A3.247 3.247 0 0 0 2 7.25v9.505a3.25 3.25 0 0 0 3.25 3.25h13.5c.063 0 .126-.002.188-.006l1.781 1.781a.75.75 0 0 0 1.061-1.06L3.28 2.22Zm14.164 16.284H5.25a1.75 1.75 0 0 1-1.75-1.75V7.25c0-.727.443-1.35 1.074-1.615l2.828 2.828C6.292 9.043 5.5 10.3 5.5 12c0 3.143 2.715 4.775 5.12 3.406a.75.75 0 0 0-.74-1.303C8.483 14.896 7 14.005 7 12c0-1.37.69-2.22 1.573-2.366l8.87 8.87Zm2.986-1.256c.045-.157.07-.322.07-.494V7.25a1.75 1.75 0 0 0-1.75-1.75H8.682L7.182 4H18.75A3.25 3.25 0 0 1 22 7.25v9.505c0 .593-.159 1.148-.436 1.627l-1.134-1.134Zm-5.877-5.877-1.197-1.197c.813-1.888 2.882-2.65 4.766-1.575a.75.75 0 0 1-.744 1.302c-1.241-.708-2.549-.085-2.825 1.47Z" fill="currentColor"/></svg>',play:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M8 5v14l11-7z" /></svg>',pause:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="currentColor"><path d="M6 4 H9 V20 H6 Z" /><path d="M15 4 H18 V20 H15 Z" /></svg>',fastForward:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 30 24" fill="currentColor"><path d="M4 5v14l11-7-11-7zm13 0v14l11-7-11-7z"/></svg>',minimize:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M21.778 2.223a.75.75 0 0 1 .072.976l-.072.084-6.223 6.224h5.693a.75.75 0 0 1 .743.65l.007.1a.75.75 0 0 1-.649.744l-.101.007-7.55-.002-.016-.002a.727.727 0 0 1-.195-.042l-.098-.046a.747.747 0 0 1-.386-.553l-.007-.105V2.754a.75.75 0 0 1 1.493-.102l.007.102v5.69l6.222-6.221a.749.749 0 0 1 1.06 0ZM11.003 13.755v7.504a.75.75 0 0 1-1.494.102l-.007-.102v-5.695L3.28 21.78a.75.75 0 0 1-1.133-.977l.073-.084 6.22-6.214H2.751a.75.75 0 0 1-.743-.648L2 13.755a.75.75 0 0 1 .75-.75l7.554.002.074.009.097.023.053.019.086.04.089.058a.761.761 0 0 1 .148.148l.066.106.041.094.022.07.01.055.007.058v-.008l.005.076Z" fill="currentColor"/></svg>',maximize:'<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M12.748 3.001h7.554l.1.014.099.028.061.026a.72.72 0 0 1 .218.15l.04.044.061.082.037.065.039.09.02.064.013.064.009.093v7.534a.75.75 0 0 1-1.493.102l-.006-.102-.001-5.696-13.94 13.945h5.69a.75.75 0 0 1 .744.65l.007.1a.75.75 0 0 1-.649.744l-.101.007H3.714L3.684 21a.705.705 0 0 1-.187-.04l-.09-.038-.018-.01a.746.746 0 0 1-.384-.553l-.007-.105V12.75a.75.75 0 0 1 1.493-.102l.007.102v5.692L18.438 4.5l-5.69.001a.75.75 0 0 1-.743-.648l-.007-.102a.75.75 0 0 1 .648-.743L12.748 3Z" fill="currentColor"/></svg>'},O7e={get:(t,e,n)=>(...r)=>{try{return Reflect.get(t,e,n).apply(t,r)}catch{return null}}};let mbe;try{mbe=new Proxy(localStorage,O7e)}catch{mbe=new Proxy({},O7e)}const Ef=mbe,CNe="rtk-prefs",Pbt=(t,e)=>{const n=JSON.parse(Ef.getItem(CNe)||"{}");n[t]=JSON.stringify(e),Ef.setItem("rtk-prefs",JSON.stringify(n))},Rbt=t=>JSON.parse(Ef.getItem(CNe)||"{}")[t],POn=()=>{const t=JSON.parse(Ef.getItem(CNe)||"{}"),e=t["mirror-video"]?t["mirror-video"]==="true":!0,n=t["mute-notification-sounds"]?t["mute-notification-sounds"]==="true":!1;return{mirrorVideo:e,muteNotificationSounds:n}},F7e={},Nx={disableEmojiPicker:!1,disablePrivateChat:!1},Ibt=t=>({meeting:"idle",prefs:POn(),peerId:t||"LEGACY_GLOBAL_PEER"}),gl=Abt({meeting:null,t:It(),iconPack:Nt,states:Ibt(),config:Os(),peerId:"global",storeType:"global",storeId:"store-global",overrides:Nx}),fbe=new Map;gl.elementsMap=fbe;gl.use({set:(t,e)=>{const n=fbe.get(t);n&&fbe.set(t,n.filter(r=>r[t]!==e?(r[t]=e,!0):!1))}});gl.state;function Mbt({meeting:t,config:e,providerId:n,iconPack:r,t:s,overrides:i}){const o=Abt({meeting:t,t:s,iconPack:r,states:Ibt(t.self.peerId),config:e||Os(),peerId:t.self.id,storeType:"peer",storeId:"store-"+n.replace("provider-",""),overrides:i}),l=new Map;return o.elementsMap=l,o.use({set:(c,d)=>{const u=l.get(c);u&&l.set(c,u.filter(h=>h[c]!==d?(h[c]=d,!0):!1))}}),o}function B7e(t,e,n=gl){const r=n.elementsMap;if(!r){console.error("appendElement: No elementsMap found on store",n);return}const s=r.get(t);if(s)try{pbe(t,e,n),s.push(e)}catch(i){console.error("appendElement: Error adding element:",i)}else try{r.set(t,[e])}catch(i){console.error("appendElement: Error setting new array:",i)}}function pbe(t,e,n=gl){const r=n.elementsMap;if(!r){console.error("removeElement: No elementsMap found on store",n);return}const s=r.get(t);if(s){const i=s.indexOf(e);i>-1&&s.splice(i,1)}}const pm=(t,e=20)=>t==null?"":t.length>e?`${t.substring(0,e)}...`:t,Lbt=t=>{const e=/^\d+$/;return new RegExp("^\\p{Emoji}+$","u").test(t)&&!e.test(t)},D7=t=>t!=null&&t.trim().toLowerCase().startsWith("javascript:")?"https://realtime.cloudflare.com":t,Rf=t=>(t=t==null?void 0:t.trim(),t===""?"Participant":t),ROn=new RegExp(/[^\u00BF-\u1FFF\u2C00-\uD7FF\w\s]/,"g"),IOn=new RegExp(/\s+/);function Dbt(t,e=2){return t.replace(ROn,"").trim().split(IOn).slice(0,e).map(s=>s.charAt(0)).join("").toUpperCase()}function ge(){return function(t,e){const{connectedCallback:n,disconnectedCallback:r}=t;t.connectedCallback=function(){const s=Pl(this),i=s[e];if(s[`_rtkStoreToCleanup-${e}`]=gl,!i){const u=gl.state[e];s[e]=u,B7e(e,s,gl)}const o=u=>{const h=s._storeRequestId;if(u.detail.requestId===h){const m=u.detail.store.state[e];s.componentOnReady().then(()=>{s[e]=m}),B7e(e,s,u.detail.store),s[`_rtkStoreToCleanup-${e}`]=u.detail.store,pbe(e,s,gl)}};s[`_rtkStoreResponseListener-${e}`]=o,document.addEventListener("rtkProvideStore",o);const l=`${s.tagName}-${Date.now()}-${Math.random()}`;s._storeRequestId=l;const c=new CustomEvent("rtkRequestStore",{detail:{element:s,propName:e,requestId:l},bubbles:!0,composed:!0});s.dispatchEvent(c);const d=()=>{const u=`${s.tagName}-${Date.now()}-${Math.random().toString(36)}`;s._storeRequestId=u;const h=new CustomEvent("rtkRequestStore",{detail:{element:s,propName:e,requestId:u},bubbles:!0,composed:!0});s.dispatchEvent(h)};return s[`_rtkStoreReadyListener-${e}`]=d,document.addEventListener("rtkPeerStoreReady",d),n==null?void 0:n.call(this)},t.disconnectedCallback=function(){const s=Pl(this);pbe(e,s,s[`_rtkStoreToCleanup-${e}`]);const i=s[`_rtkStoreResponseListener-${e}`];i&&(document.removeEventListener("rtkProvideStore",i),delete s[`_rtkStoreResponseListener-${e}`]);const o=s[`_rtkStoreReadyListener-${e}`];return o&&(document.removeEventListener("rtkPeerStoreReady",o),delete s[`_rtkStoreReadyListener-${e}`]),r==null?void 0:r.call(this)}}}const MOn=t=>{let e=null;try{const n=JSON.parse(t.message),{target:r,message:s}=n;r===void 0||s===void 0?e=t:e=Object.assign(Object.assign({},t),{targetUserIds:r,message:s})}catch{e=t}return e};function LOn(t){return t.sort((e,n)=>e.localeCompare(n)).join("_")}function $bt(t,e){if(t==null)return!0;for(const n of t)if(n.kind==="file"){const r=n.getAsFile();n.type.startsWith("image/")?e("image",r):e("file",r)}}function p3(t){return t.split("").reverse().join("")}const U7e=/^\*([^*\s]+)\*/,z7e=/^_([^_\s]+)_/,V7e=/^~([^~\s]+)~/,H7e=/https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_\+.,~#?&//=]*)/,jNe=/<blockquote>[.\s\S]*<\/blockquote>\n\n/m;function ENe(t,e=!1){if(!jNe.test(t))return"";let n=0,r=13;return e&&(n=12,r=0),t.substring(t.indexOf("<blockquote>")+n,t.indexOf("</blockquote>")+r)}function NNe(t){return t.replace(jNe,"")}const k6=2e3,DOn=["<a>","<b>","<i>","<q>","<s>"];function gbe(t){t=t.split(" ").map(n=>{if(H7e.test(n)){const r=H7e.exec(n);n=n.replace(r[0],`<a>${r[0]}</a>`)}else{if(U7e.test(n)){const r=U7e.exec(n);n=n.replace(r[0],`<b>${r[1]}</b>`)}if(z7e.test(n)){const r=z7e.exec(n);n=n.replace(r[0],`<i>${r[1]}</i>`)}if(V7e.test(n)){const r=V7e.exec(n);n=n.replace(r[0],`<s>${r[1]}</s>`)}}return n}).join(" "),t=t.split(" ").map((n,r)=>n===">"&&(r===0||n[r-1]===">")?"<q></q>":n).join(" ");const[e]=Obt(t);return e}function Obt(t,e=""){const n=[];if(t.length===0)return[n,0];let r=0;for(;r<t.length;){if(e.length&&e===t.substring(r,r+e.length))return[n,r+e.length];if(DOn.includes(t.substring(r,r+3))){const[s,i]=Obt(t.substring(r+3),`</${t[r+1]}>`);n.push({type:t[r+1],content:s.length===1&&s[0].type==="plain_text"?s[0].content:s}),r+=i+3}else{let s=n[n.length-1];(!s||s.type!=="plain_text")&&(n.push({type:"plain_text",content:""}),s=n[n.length-1]),s.content+=t[r],r++}}return[n,r]}const Fbt=t=>t.split(/[#?]/)[0].split(".").pop().trim(),Bbt=t=>{if(!t)return"0 B";const e=Math.floor(Math.log(t)/Math.log(1024));return`${(t/1024**e).toFixed(2)} ${["B","kB","MB","GB","TB"][e]}`},$On=(t,e="file")=>{try{const r=new URL(t).pathname.split("/").pop();return r!=="/"?r:e}catch{return e}},$7=async(t,e)=>{t=D7(t);let n=e==null?void 0:e.name;const r=await fetch(t);if(!r.ok){window.open(t,"_blank");return}const s=URL.createObjectURL(await r.blob()),i=document.createElement("a");i.href=s,i.download=n??$On(t,e==null?void 0:e.fallbackName),i.click()},OOn=[0,.5,1,1.5,2,3,4,5,6,7,8,9,10,12,14,16,20,24,28,32,36,40,44,48,52,56,60,64,72,80,96],FOn={darkest:{background:{1e3:"#080808",900:"#1A1A1A",800:"#1E1E1E",700:"#2C2C2C",600:"#393939"},text:"#FFFFFF"},dark:{background:{1e3:"#252525",900:"#2F2F2F",800:"#323232",700:"#3E3E3E",600:"#4A4A4A"},text:"#F5F5F5","video-bg":"#1C1C1C"},light:{background:{1e3:"#FFFFFF",900:"#F5F5F5",800:"#EBEBEB",700:"#E0E0E0",600:"#D6D6D6"},text:"#111111","text-on-brand":"#ffffff","video-bg":"#DADADA"}},G7e={none:{none:0,sm:0,md:0,lg:0},thin:{none:0,sm:1,md:2,lg:4},fat:{none:0,sm:2,md:4,lg:8}},W7e={sharp:{none:0,sm:0,md:0,lg:0},rounded:{none:0,sm:4,md:8,lg:12},"extra-rounded":{none:0,sm:8,md:16,lg:24},circular:{none:9999,sm:9999,md:9999,lg:9999}};function Ace(t){t=t.trim();let e="0",n="0",r="0";return t.length==4?(e="0x"+t[1]+t[1],n="0x"+t[2]+t[2],r="0x"+t[3]+t[3]):t.length>6&&(e="0x"+t[1]+t[2],n="0x"+t[3]+t[4],r="0x"+t[5]+t[6]),[+e,+n,+r]}const q7e=t=>typeof t=="string"&&t.length===7&&t.startsWith("#"),DI="--rtk-";function uf(t,e=DI){return e+t}const BOn=t=>{const e=[400,500,700],n=[];if(document.querySelector("link[data-rtk-font]")==null){const s=document.createElement("link");s.rel="preconnect",s.setAttribute("data-rtk-font","true"),s.href="https://fonts.googleapis.com";const i=s.cloneNode(!0);i.href="https://fonts.gstatic.com",i.crossOrigin="",n.push(s,i)}const r=document.createElement("link");r.rel="stylesheet",r.setAttribute("data-rtk-font",t),r.href=encodeURI(`https://fonts.googleapis.com/css2?family=${t}:wght@${e.join(";")}&display=swap`),n.push(r),document.head.append(...n)},UOn=(t,e,n=DI)=>{OOn.forEach(r=>{t.style.setProperty(uf(`space-${r}`,n),`${r*e}px`)})},zOn=(t,e,n=DI)=>{if(e in G7e){const r=G7e[e];Object.keys(r).forEach(s=>{t.style.setProperty(uf(`border-width-${s}`,n),`${r[s]}px`)})}},VOn=(t,e,n=DI)=>{if(e in W7e){const r=W7e[e];Object.keys(r).forEach(s=>{t.style.setProperty(uf(`border-radius-${s}`,n),`${r[s]}px`)})}},K7e=(t,e,n=DI)=>{Object.keys(e).forEach(r=>{const s=e[r];if(typeof s=="string")if(r==="text"||r==="text-on-brand"){const i=Ace(s).join(" ");t.style.setProperty(uf(`colors-${r}-1000`,n),`${i}`),t.style.setProperty(uf(`colors-${r}-900`,n),`${i} / 0.88`),t.style.setProperty(uf(`colors-${r}-800`,n),`${i} / 0.76`),t.style.setProperty(uf(`colors-${r}-700`,n),`${i} / 0.64`),t.style.setProperty(uf(`colors-${r}-600`,n),`${i} / 0.52`)}else{const i=Ace(s).join(" ");t.style.setProperty(uf(`colors-${r}`,n),i)}else typeof s=="object"&&Object.keys(s).forEach(i=>{const o=s[i],l=Ace(o).join(" ");t.style.setProperty(uf(`colors-${r}-${i}`,n),l)})})},FW=(t,{spacingBase:e,borderRadius:n,borderWidth:r,colors:s,fontFamily:i,googleFont:o,theme:l,tokenPrefix:c=DI})=>{if(typeof t!="object")throw new Error("[rtk-ui-kit] (provideRtkDesignSystem): Passed element is not a valid HTML Element");if(typeof o=="string"&&(BOn(o),t.style.setProperty(uf("font-family",c),o)),typeof i=="string"&&t.style.setProperty(uf("font-family",c),i),typeof e=="number"&&UOn(t,e,c),typeof r=="string"&&zOn(t,r,c),typeof n=="string"&&VOn(t,n,c),typeof l=="string"){const d=FOn[l];d!=null&&K7e(t,d,c)}typeof s=="object"&&K7e(t,s,c)};function Ubt(t){return t}function HOn(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var GOn=800,WOn=16,qOn=Date.now;function KOn(t){var e=0,n=0;return function(){var r=qOn(),s=WOn-(r-n);if(n=r,s>0){if(++e>=GOn)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}function YOn(t){return function(){return t}}var QOn=AQ?function(t,e){return AQ(t,"toString",{configurable:!0,enumerable:!1,value:YOn(e),writable:!0})}:Ubt;const ZOn=QOn;var JOn=KOn(ZOn);const XOn=JOn;var Y7e=Math.max;function e6n(t,e,n){return e=Y7e(e===void 0?t.length-1:e,0),function(){for(var r=arguments,s=-1,i=Y7e(r.length-e,0),o=Array(i);++s<i;)o[s]=r[e+s];s=-1;for(var l=Array(e+1);++s<e;)l[s]=r[s];return l[e]=n(o),HOn(t,this,l)}}function t6n(t,e){return XOn(e6n(t,e,Ubt),t+"")}function n6n(t,e,n){if(!Mg(n))return!1;var r=typeof e;return(r=="number"?fne(n)&&dbt(e,n.length):r=="string"&&e in n)?mne(n[e],t):!1}function r6n(t){return t6n(function(e,n){var r=-1,s=n.length,i=s>1?n[s-1]:void 0,o=s>2?n[2]:void 0;for(i=t.length>3&&typeof i=="function"?(s--,i):void 0,o&&n6n(n[0],n[1],o)&&(i=s<3?void 0:i,s=1),e=Object(e);++r<s;){var l=n[r];l&&t(e,l,r,i)}return e})}var s6n="[object Object]",i6n=Function.prototype,a6n=Object.prototype,zbt=i6n.toString,o6n=a6n.hasOwnProperty,l6n=zbt.call(Object);function c6n(t){if(!CS(t)||GE(t)!=s6n)return!1;var e=xbt(t);if(e===null)return!0;var n=o6n.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&zbt.call(n)==l6n}function d6n(t){return function(e,n,r){for(var s=-1,i=Object(e),o=r(e),l=o.length;l--;){var c=o[++s];if(n(i[c],c,i)===!1)break}return e}}var u6n=d6n();const h6n=u6n;function vbe(t,e,n){(n!==void 0&&!mne(t[e],n)||n===void 0&&!(e in t))&&vNe(t,e,n)}function m6n(t){return CS(t)&&fne(t)}function ybe(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}function f6n(t){return y4n(t,bbt(t))}function p6n(t,e,n,r,s,i,o){var l=ybe(t,n),c=ybe(e,n),d=o.get(c);if(d){vbe(t,n,d);return}var u=i?i(l,c,n+"",t,e,o):void 0,h=u===void 0;if(h){var m=y6(c),f=!m&&bNe(c),p=!m&&!f&&gbt(c);u=c,m||f||p?y6(l)?u=l:m6n(l)?u=u4n(l):f?(h=!1,u=kbt(c,!0)):p?(h=!1,u=Sbt(c,!0)):u=[]:c6n(c)||cbe(c)?(u=l,cbe(l)?u=f6n(l):(!Mg(l)||gNe(l))&&(u=Cbt(c))):h=!1}h&&(o.set(c,u),s(u,c,r,i,o),o.delete(c)),vbe(t,n,u)}function Vbt(t,e,n,r,s){t!==e&&h6n(e,function(i,o){if(s||(s=new KE),Mg(i))p6n(t,e,o,n,Vbt,r,s);else{var l=r?r(ybe(t,o),i,o+"",t,e,s):void 0;l===void 0&&(l=i),vbe(t,o,l)}},bbt)}var g6n=r6n(function(t,e,n){Vbt(t,e,n)});const Zj=g6n,Hbt=({element:t,size:e,states:n={},config:r={}})=>{let s=[];const i=r==null?void 0:r.root[t],o=l=>{s.push(l),typeof e=="string"&&s.push(`${l}.${e}`)};if(o(t),typeof i=="object"&&!Array.isArray(i)&&i!==null){const{state:l,states:c}=i;let d=t,u=[];if(Array.isArray(c)){u=c.filter(h=>n[h]),u.sort();for(const h of u)o(`${d}.${h}`);if(u.length>1){const h=[d,...u].join(".");o(h)}}if(typeof l=="string"){const h=`${t}[${l}=${n[l]}]`;o(h);for(const m of u)o(`${h}.${m}`);if(u.length>1){const m=[h,...u].join(".");o(m)}}}return s},v6n=({selectors:t,styles:e})=>{if(!Array.isArray(t)||e==null)return{};const n={};for(const r of t){const s=e[r];s!=null&&Object.assign(n,s)}return n},Gbt=({selectors:t,root:e})=>{if(!e||!Array.isArray(t))return[];let n=[];for(const r of t){const s=e[r];if(Array.isArray(s))n=[...s];else if(s){if(s.children&&(n=[...s.children]),Array.isArray(s.remove))for(const i of s.remove)n=n.filter(o=>typeof o=="string"?o!==i:Array.isArray(o)?o[0]!==i:!0);if(s.addBefore)for(const[i,o]of Object.entries(s.addBefore)){const l=n.findIndex(c=>typeof c=="string"?c===i:Array.isArray(c)?c[0]===i:!1);l>=0&&n.splice(l,0,...o)}Array.isArray(s.add)&&(n=n.concat(s.add)),Array.isArray(s.prepend)&&(n=s.prepend.concat(n))}}return n},Hz=({elements:t,defaults:e,props:n={},deepProps:r=!1,elementProps:s={}})=>!Array.isArray(t)||t.length===0?null:t.map(i=>$(tc,{element:i,defaults:e,props:n,childProps:r&&n,elementProps:s})),y6n=({element:t,defaults:e,props:n={},elementProps:r={}})=>{var s;const{config:i,size:o,states:l}=e;let c,d={},u=[];Array.isArray(t)?[c,d,...u]=t:c=t;const h=(s=i==null?void 0:i.root)===null||s===void 0?void 0:s[c];h!=null&&"props"in h&&(n=Object.assign(Object.assign({},h.props),n)),n=Object.assign(Object.assign({},n),d),c in r&&(n=Object.assign(Object.assign({},n),r[c]));const m=Hbt({element:c,size:o,states:l,config:i});return Gbt({selectors:m,root:i.root}).length},tc=({element:t,defaults:e,childProps:n={},props:r={},onlyChildren:s=!1,asHost:i=!1,deepProps:o=!1,elementProps:l={}},c)=>{var d;const{config:u,size:h,states:m}=e;let f,p={},g=[];Array.isArray(t)?[f,p,...g]=t:f=t;const v=(d=u==null?void 0:u.root)===null||d===void 0?void 0:d[f];v!=null&&"props"in v&&(r=Object.assign(Object.assign({},v.props),r)),r=Object.assign(Object.assign({},r),p),f in l&&(r=Object.assign(Object.assign({},r),l[f]));const b=Hbt({element:f,size:h,states:m,config:u}),x=Gbt({selectors:b,root:u.root});if(s)return $(Hz,{elements:x,defaults:e,props:n,deepProps:o,elementProps:l});const w=v6n({selectors:b,styles:u.styles});if(i)return $(mt,Object.assign({},e,{style:w},r),$(Hz,{elements:x,defaults:e,props:n,deepProps:o,elementProps:l}),c,g.map(k=>{if(Array.isArray(k)){const[S,C]=k;return $(S,Object.assign({},e,C))}return k}));if(["rtk-header","rtk-controlbar"].includes(f)&&(r.disableRender=!0),f.startsWith("rtk-"))return $(f,Object.assign({},e,{style:w},r),$(Hz,{elements:x,defaults:e,props:n,deepProps:o,elementProps:l}),c,g.map(k=>{if(Array.isArray(k)){const[S,C]=k;return $(S,Object.assign({},e,C))}return k}));{const[k,S]=f.split("#");return $(k,Object.assign({id:S,style:w},r),$(Hz,{elements:x,defaults:e,props:n,deepProps:o,elementProps:l}),c,g.map(C=>{if(Array.isArray(C)){const[j,E]=C;return $(j,Object.assign({},e,E))}return C}))}},b6n=(t,e=Os())=>{let n=Object.assign({},e);return Zj(n,t),n},x6n=(t,e,n={},r={grid_pagination:!0,settings_toggle:!0})=>{var s,i,o,l,c,d,u,h,m,f,p,g,v,b,x,w,k,S;const C={showSetupScreen:!0};let j,E=["rtk-stage"],N={},A={};const _=(r==null?void 0:r.settings_toggle)!==!1,T=(r==null?void 0:r.grid_pagination)!==!1;if(!((s=t.controlBar)===null||s===void 0)&&s.isEnabled){E.push("rtk-controlbar");const{elements:F}=t.controlBar,D=[...F.fullscreen?["rtk-fullscreen-toggle"]:[],..._?["rtk-settings-toggle"]:[]],I=[],P=[];!((i=e.participants.pip)===null||i===void 0)&&i.isSupported()&&(!((l=(o=e.self)===null||o===void 0?void 0:o.config)===null||l===void 0)&&l.pipMode)&&((c=e.self.config)===null||c===void 0?void 0:c.viewType)!=="LIVESTREAM"&&P.push("rtk-pip-toggle"),e!=null&&e.self.permissions.canDisableParticipantAudio&&P.push("rtk-mute-all-button"),P.push("rtk-breakout-rooms-toggle"),!((d=e.self)===null||d===void 0)&&d.permissions.canRecord&&P.push("rtk-recording-toggle"),(u=e.self.permissions.transcriptionEnabled)!==null&&u!==void 0&&u&&P.push("rtk-caption-toggle"),navigator.product!=="ReactNative"&&P.push("rtk-debugger-toggle"),Tbt(e)&&D.push("rtk-livestream-toggle"),F.screenshare&&D.push("rtk-screen-share-toggle"),F.chat&&I.push("rtk-chat-toggle"),F.polls&&I.push("rtk-polls-toggle"),F.participants&&I.push("rtk-participants-toggle"),F.plugins&&I.push("rtk-plugins-toggle"),I.push("rtk-ai-toggle");const M=["rtk-mic-toggle","rtk-camera-toggle","rtk-stage-toggle","rtk-leave-button"];P.length>0&&M.push("rtk-more-toggle");const z=D.concat(I).concat(P);let G=!1;z.length>0&&(G=!0),A={"rtk-controlbar":{states:["activeMoreMenu"],children:["div#controlbar-left","div#controlbar-center","div#controlbar-right"]},"div#controlbar-left":D,"div#controlbar-center":M,"div#controlbar-right":I,"rtk-more-toggle":{states:["activeMoreMenu"],children:[]},"rtk-more-toggle.activeMoreMenu":P.map(B=>[B,{variant:"horizontal",slot:"more-elements"}]),"rtk-controlbar.sm":["div#controlbar-mobile"],"rtk-controlbar.md":["div#controlbar-mobile"],"rtk-more-toggle.activeMoreMenu.md":z.map(B=>[B,{variant:"horizontal",slot:"more-elements"}]),"rtk-more-toggle.activeMoreMenu.sm":z.map(B=>[B,{variant:"horizontal",slot:"more-elements"}]),"div#controlbar-mobile":["rtk-mic-toggle","rtk-camera-toggle","rtk-stage-toggle",G&&"rtk-more-toggle","rtk-leave-button"]}}if(!((h=t.header)===null||h===void 0)&&h.isEnabled){E.unshift("rtk-header");const{elements:F}=t.header;let D=["rtk-recording-indicator","rtk-livestream-indicator"],I=[],P=[];T&&P.push("rtk-grid-pagination"),F.title&&I.push("rtk-meeting-title"),typeof F.logo=="string"&&F.logo.length>0&&(j=F.logo,D.unshift("rtk-logo")),F.participantCount&&P.push("rtk-participant-count","rtk-viewer-count"),F.timer&&P.push("rtk-clock"),N={"rtk-header":["div#header-left","div#header-center","div#header-right"],"rtk-header.sm":{remove:["div#header-center"]},"div#header-left":D,"div#header-center":I,"div#header-right":P,"div#header-left.sm":{remove:["rtk-logo"],prepend:["rtk-meeting-title"]}}}E.push("rtk-participants-audio","rtk-dialog-manager");let R={logo:j};R=t.designTokens,q7e((f=(m=t==null?void 0:t.designTokens)===null||m===void 0?void 0:m.colors)===null||f===void 0?void 0:f.textOnBrand)&&(R.colors["text-on-brand"]=(g=(p=t==null?void 0:t.designTokens)===null||p===void 0?void 0:p.colors)===null||g===void 0?void 0:g.textOnBrand),q7e((b=(v=t==null?void 0:t.designTokens)===null||v===void 0?void 0:v.colors)===null||b===void 0?void 0:b.videoBg)&&(R.colors["video-bg"]=(w=(x=t==null?void 0:t.designTokens)===null||x===void 0?void 0:x.colors)===null||w===void 0?void 0:w.videoBg);let O={designTokens:R,styles:{"rtk-header":{display:"grid",height:"48px",gridTemplateColumns:"repeat(3, 1fr)",gridTemplateRows:"1fr",alignItems:"center","--header-section-gap":"var(--rtk-space-2, 8px)"},"rtk-header.sm":{display:"grid",gridArea:"header",gridTemplateColumns:"repeat(2, 1fr)",gridTemplateRows:"1fr",alignItems:"center","--header-section-gap":"var(--rtk-space-1, 4px)"},"div#header-left":{display:"flex",alignItems:"center",height:"48px",wordBreak:"break-all",gap:"var(--header-section-gap)"},"rtk-logo":{height:"26px"},"div#header-center":{display:"flex",alignItems:"center",justifyContent:"center",wordBreak:"break-all",gap:"var(--header-section-gap)",paddingInline:"var(--rtk-space-3, 12px)"},"div#header-right":{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"var(--header-section-gap)"},"rtk-stage":{display:"flex",flex:"1"},"rtk-grid":{flex:"1",height:"auto"},"rtk-controlbar":{display:"grid",gridTemplateColumns:"repeat(3,1fr)",gridTemplateRows:"1fr",alignItems:"center",padding:"8px"},"rtk-controlbar.sm":{display:"flex",position:"relative",backgroundColor:"var(--rtk-colors-background-1000, #000)"},"rtk-controlbar.md":{display:"flex",position:"relative",backgroundColor:"var(--rtk-colors-background-1000, #000)"},"div#controlbar-left":{display:"flex",alignItems:"center",gap:"var(--rtk-space-1, 4px)"},"div#controlbar-center":{display:"flex",alignItems:"center",position:"relative",overflow:"visible",justifyContent:"center",gap:"var(--rtk-space-1, 4px)"},"div#controlbar-mobile":{display:"flex",flex:"1",alignItems:"center",justifyContent:"center",zIndex:"10000",gap:"var(--rtk-space-1, 4px)"},"div#controlbar-right":{display:"flex",alignItems:"center",justifyContent:"flex-end",gap:"var(--rtk-space-1, 4px)"},"rtk-settings":{width:"720px",height:"480px"},"rtk-debugger":{width:"720px",height:"480px"},"div#setupcontrols-indicator":{position:"absolute",bottom:"12px",left:"12px",display:"flex",gap:"6px",background:"rgb(var(--rtk-colors-background-800, 0 0 0))",borderRadius:"100%"},"div#setupcontrols-media":{position:"absolute",bottom:"8px",right:"8px",display:"flex",gap:"6px"},"div#setupcontrols-settings":{position:"absolute",top:"8px",right:"8px",display:"flex",flexDirection:"column",gap:"6px"},"rtk-meeting-title.sm":{marginLeft:"0"},"rtk-clock":{marginRight:"0"}},root:Object.assign(Object.assign(Object.assign({"rtk-meeting":{state:"meeting",states:["activeSidebar"]},"rtk-meeting[meeting=idle]":["rtk-idle-screen"],"rtk-meeting[meeting=waiting]":["rtk-waiting-screen"],"rtk-meeting[meeting=setup]":["rtk-setup-screen","rtk-dialog-manager"],"rtk-meeting[meeting=joined]":E,"rtk-meeting[meeting=joined].activeSidebar.sm":{add:[["rtk-sidebar",{view:"full-screen"}]]},"rtk-meeting[meeting=joined].activeSidebar.md":{add:[["rtk-sidebar",{view:"full-screen"}]]},"rtk-meeting[meeting=ended]":["rtk-ended-screen"]},N),A),{"rtk-stage":{states:["activeSidebar"],children:["rtk-grid","rtk-notifications","rtk-transcripts"]},"rtk-stage.activeSidebar":{add:[["rtk-sidebar",{view:"sidebar"}]]},"rtk-stage.activeSidebar.sm":{remove:["rtk-sidebar"]},"rtk-grid":{states:["activeScreenShare","activePlugin","activeSpotlight"],state:"viewType",children:["rtk-simple-grid"]},"rtk-grid[viewType=AUDIO_ROOM]":["rtk-audio-grid"],"rtk-grid[viewType=AUDIO_ROOM].activePlugin":["rtk-mixed-grid"],"rtk-grid[viewType=AUDIO_ROOM].activeScreenshare":["rtk-mixed-grid"],"rtk-grid[viewType=AUDIO_ROOM].activeScreenShare.activeSpotlight":["rtk-mixed-grid"],"rtk-grid[viewType=AUDIO_ROOM].activePlugin.activeSpotlight":["rtk-mixed-grid"],"rtk-grid[viewType=AUDIO_ROOM].activePlugin.activeScreenShare.activeSpotlight":["rtk-mixed-grid"],"rtk-grid.activeSpotlight":["rtk-spotlight-grid"],"rtk-grid.activeScreenShare":["rtk-mixed-grid"],"rtk-grid.activePlugin":["rtk-mixed-grid"],"rtk-grid.activeScreenShare.activeSpotlight":["rtk-mixed-grid"],"rtk-grid.activePlugin.activeSpotlight":["rtk-mixed-grid"],"rtk-grid.activePlugin.activeScreenShare.activeSpotlight":["rtk-mixed-grid"],"rtk-mixed-grid":{states:["activeSpotlight"],state:"viewType",children:["rtk-simple-grid"]},"rtk-mixed-grid[viewType=AUDIO_ROOM]":["rtk-audio-grid"],"rtk-mixed-grid.activeSpotlight":["rtk-spotlight-grid"],"rtk-participant-tile":{state:"meeting",children:["rtk-name-tag","rtk-avatar","rtk-network-indicator"]},"rtk-participant-setup":["rtk-avatar","div#setupcontrols-media"],"rtk-participant-tile[meeting=setup]":["rtk-avatar","div#setupcontrols-indicator","div#setupcontrols-media",..._?["div#setupcontrols-settings"]:[]],"div#setupcontrols-indicator":[["rtk-audio-visualizer",{slot:"start",hideMuted:!0}]],"div#setupcontrols-media":[["rtk-mic-toggle",{size:"sm"}],["rtk-camera-toggle",{size:"sm"}]],"div#setupcontrols-settings":[["rtk-settings-toggle",{size:"sm"}]],"rtk-screenshare-view":["rtk-name-tag","rtk-network-indicator"],"rtk-name-tag":[["rtk-audio-visualizer",{slot:"start"}]]}),config:{notification_sounds:{participant_left:!1},participant_joined_sound_notification_limit:3,participant_chat_message_sound_notification_limit:10,videoFit:"cover"}};return O=b6n(n,O),C.showSetupScreen=(S=(k=t.setupScreen)===null||k===void 0?void 0:k.isEnabled)!==null&&S!==void 0?S:!0,{config:O,data:C}};var Wbt=function(){if(typeof Map<"u")return Map;function t(e,n){var r=-1;return e.some(function(s,i){return s[0]===n?(r=i,!0):!1}),r}return function(){function e(){this.__entries__=[]}return Object.defineProperty(e.prototype,"size",{get:function(){return this.__entries__.length},enumerable:!0,configurable:!0}),e.prototype.get=function(n){var r=t(this.__entries__,n),s=this.__entries__[r];return s&&s[1]},e.prototype.set=function(n,r){var s=t(this.__entries__,n);~s?this.__entries__[s][1]=r:this.__entries__.push([n,r])},e.prototype.delete=function(n){var r=this.__entries__,s=t(r,n);~s&&r.splice(s,1)},e.prototype.has=function(n){return!!~t(this.__entries__,n)},e.prototype.clear=function(){this.__entries__.splice(0)},e.prototype.forEach=function(n,r){r===void 0&&(r=null);for(var s=0,i=this.__entries__;s<i.length;s++){var o=i[s];n.call(r,o[1],o[0])}},e}()}(),bbe=typeof window<"u"&&typeof document<"u"&&window.document===document,PQ=function(){return typeof global<"u"&&global.Math===Math?global:typeof self<"u"&&self.Math===Math?self:typeof window<"u"&&window.Math===Math?window:Function("return this")()}(),w6n=function(){return typeof requestAnimationFrame=="function"?requestAnimationFrame.bind(PQ):function(t){return setTimeout(function(){return t(Date.now())},1e3/60)}}(),k6n=2;function S6n(t,e){var n=!1,r=!1,s=0;function i(){n&&(n=!1,t()),r&&l()}function o(){w6n(i)}function l(){var c=Date.now();if(n){if(c-s<k6n)return;r=!0}else n=!0,r=!1,setTimeout(o,e);s=c}return l}var C6n=20,j6n=["top","right","bottom","left","width","height","size","weight"],E6n=typeof MutationObserver<"u",N6n=function(){function t(){this.connected_=!1,this.mutationEventsAdded_=!1,this.mutationsObserver_=null,this.observers_=[],this.onTransitionEnd_=this.onTransitionEnd_.bind(this),this.refresh=S6n(this.refresh.bind(this),C6n)}return t.prototype.addObserver=function(e){~this.observers_.indexOf(e)||this.observers_.push(e),this.connected_||this.connect_()},t.prototype.removeObserver=function(e){var n=this.observers_,r=n.indexOf(e);~r&&n.splice(r,1),!n.length&&this.connected_&&this.disconnect_()},t.prototype.refresh=function(){var e=this.updateObservers_();e&&this.refresh()},t.prototype.updateObservers_=function(){var e=this.observers_.filter(function(n){return n.gatherActive(),n.hasActive()});return e.forEach(function(n){return n.broadcastActive()}),e.length>0},t.prototype.connect_=function(){!bbe||this.connected_||(document.addEventListener("transitionend",this.onTransitionEnd_),window.addEventListener("resize",this.refresh),E6n?(this.mutationsObserver_=new MutationObserver(this.refresh),this.mutationsObserver_.observe(document,{attributes:!0,childList:!0,characterData:!0,subtree:!0})):(document.addEventListener("DOMSubtreeModified",this.refresh),this.mutationEventsAdded_=!0),this.connected_=!0)},t.prototype.disconnect_=function(){!bbe||!this.connected_||(document.removeEventListener("transitionend",this.onTransitionEnd_),window.removeEventListener("resize",this.refresh),this.mutationsObserver_&&this.mutationsObserver_.disconnect(),this.mutationEventsAdded_&&document.removeEventListener("DOMSubtreeModified",this.refresh),this.mutationsObserver_=null,this.mutationEventsAdded_=!1,this.connected_=!1)},t.prototype.onTransitionEnd_=function(e){var n=e.propertyName,r=n===void 0?"":n,s=j6n.some(function(i){return!!~r.indexOf(i)});s&&this.refresh()},t.getInstance=function(){return this.instance_||(this.instance_=new t),this.instance_},t.instance_=null,t}(),qbt=function(t,e){for(var n=0,r=Object.keys(e);n<r.length;n++){var s=r[n];Object.defineProperty(t,s,{value:e[s],enumerable:!1,writable:!1,configurable:!0})}return t},MR=function(t){var e=t&&t.ownerDocument&&t.ownerDocument.defaultView;return e||PQ},Kbt=vne(0,0,0,0);function RQ(t){return parseFloat(t)||0}function Q7e(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];return e.reduce(function(r,s){var i=t["border-"+s+"-width"];return r+RQ(i)},0)}function T6n(t){for(var e=["top","right","bottom","left"],n={},r=0,s=e;r<s.length;r++){var i=s[r],o=t["padding-"+i];n[i]=RQ(o)}return n}function _6n(t){var e=t.getBBox();return vne(0,0,e.width,e.height)}function A6n(t){var e=t.clientWidth,n=t.clientHeight;if(!e&&!n)return Kbt;var r=MR(t).getComputedStyle(t),s=T6n(r),i=s.left+s.right,o=s.top+s.bottom,l=RQ(r.width),c=RQ(r.height);if(r.boxSizing==="border-box"&&(Math.round(l+i)!==e&&(l-=Q7e(r,"left","right")+i),Math.round(c+o)!==n&&(c-=Q7e(r,"top","bottom")+o)),!R6n(t)){var d=Math.round(l+i)-e,u=Math.round(c+o)-n;Math.abs(d)!==1&&(l-=d),Math.abs(u)!==1&&(c-=u)}return vne(s.left,s.top,l,c)}var P6n=function(){return typeof SVGGraphicsElement<"u"?function(t){return t instanceof MR(t).SVGGraphicsElement}:function(t){return t instanceof MR(t).SVGElement&&typeof t.getBBox=="function"}}();function R6n(t){return t===MR(t).document.documentElement}function I6n(t){return bbe?P6n(t)?_6n(t):A6n(t):Kbt}function M6n(t){var e=t.x,n=t.y,r=t.width,s=t.height,i=typeof DOMRectReadOnly<"u"?DOMRectReadOnly:Object,o=Object.create(i.prototype);return qbt(o,{x:e,y:n,width:r,height:s,top:n,right:e+r,bottom:s+n,left:e}),o}function vne(t,e,n,r){return{x:t,y:e,width:n,height:r}}var L6n=function(){function t(e){this.broadcastWidth=0,this.broadcastHeight=0,this.contentRect_=vne(0,0,0,0),this.target=e}return t.prototype.isActive=function(){var e=I6n(this.target);return this.contentRect_=e,e.width!==this.broadcastWidth||e.height!==this.broadcastHeight},t.prototype.broadcastRect=function(){var e=this.contentRect_;return this.broadcastWidth=e.width,this.broadcastHeight=e.height,e},t}(),D6n=function(){function t(e,n){var r=M6n(n);qbt(this,{target:e,contentRect:r})}return t}(),$6n=function(){function t(e,n,r){if(this.activeObservations_=[],this.observations_=new Wbt,typeof e!="function")throw new TypeError("The callback provided as parameter 1 is not a function.");this.callback_=e,this.controller_=n,this.callbackCtx_=r}return t.prototype.observe=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(e instanceof MR(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(e)||(n.set(e,new L6n(e)),this.controller_.addObserver(this),this.controller_.refresh())}},t.prototype.unobserve=function(e){if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");if(!(typeof Element>"u"||!(Element instanceof Object))){if(!(e instanceof MR(e).Element))throw new TypeError('parameter 1 is not of type "Element".');var n=this.observations_;n.has(e)&&(n.delete(e),n.size||this.controller_.removeObserver(this))}},t.prototype.disconnect=function(){this.clearActive(),this.observations_.clear(),this.controller_.removeObserver(this)},t.prototype.gatherActive=function(){var e=this;this.clearActive(),this.observations_.forEach(function(n){n.isActive()&&e.activeObservations_.push(n)})},t.prototype.broadcastActive=function(){if(this.hasActive()){var e=this.callbackCtx_,n=this.activeObservations_.map(function(r){return new D6n(r.target,r.broadcastRect())});this.callback_.call(e,n,e),this.clearActive()}},t.prototype.clearActive=function(){this.activeObservations_.splice(0)},t.prototype.hasActive=function(){return this.activeObservations_.length>0},t}(),Ybt=typeof WeakMap<"u"?new WeakMap:new Wbt,Qbt=function(){function t(e){if(!(this instanceof t))throw new TypeError("Cannot call a class as a function.");if(!arguments.length)throw new TypeError("1 argument required, but only 0 present.");var n=N6n.getInstance(),r=new $6n(e,n,this);Ybt.set(this,r)}return t}();["observe","unobserve","disconnect"].forEach(function(t){Qbt.prototype[t]=function(){var e;return(e=Ybt.get(this))[t].apply(e,arguments)}});var Zbt=function(){return typeof PQ.ResizeObserver<"u"?PQ.ResizeObserver:Qbt}();function Jbt(t,e){const n=e==null?void 0:e.code;switch(n){case"0002":return{message:t("join.network_error"),code:n};case"0014":{const r=typeof(e==null?void 0:e.message)=="string"&&e.message.includes("firewall");return{message:t(r?"join.media_firewall_error":"join.media_error"),code:n}}default:return{message:t("join.default_error"),code:n}}}const Xbt=["top","right","bottom","left"],Z7e=["start","end"],J7e=Xbt.reduce((t,e)=>t.concat(e,e+"-"+Z7e[0],e+"-"+Z7e[1]),[]),S6=Math.min,JA=Math.max,IQ=Math.round,vy=t=>({x:t,y:t}),O6n={left:"right",right:"left",bottom:"top",top:"bottom"};function xbe(t,e,n){return JA(t,S6(e,n))}function YE(t,e){return typeof t=="function"?t(e):t}function i0(t){return t.split("-")[0]}function yy(t){return t.split("-")[1]}function ext(t){return t==="x"?"y":"x"}function TNe(t){return t==="y"?"height":"width"}function R1(t){const e=t[0];return e==="t"||e==="b"?"y":"x"}function _Ne(t){return ext(R1(t))}function txt(t,e,n){n===void 0&&(n=!1);const r=yy(t),s=_Ne(t),i=TNe(s);let o=s==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(o=LQ(o)),[o,LQ(o)]}function F6n(t){const e=LQ(t);return[MQ(t),e,MQ(e)]}function MQ(t){return t.includes("start")?t.replace("start","end"):t.replace("end","start")}const X7e=["left","right"],eBe=["right","left"],B6n=["top","bottom"],U6n=["bottom","top"];function z6n(t,e,n){switch(t){case"top":case"bottom":return n?e?eBe:X7e:e?X7e:eBe;case"left":case"right":return e?B6n:U6n;default:return[]}}function V6n(t,e,n,r){const s=yy(t);let i=z6n(i0(t),n==="start",r);return s&&(i=i.map(o=>o+"-"+s),e&&(i=i.concat(i.map(MQ)))),i}function LQ(t){const e=i0(t);return O6n[e]+t.slice(e.length)}function H6n(t){return{top:0,right:0,bottom:0,left:0,...t}}function nxt(t){return typeof t!="number"?H6n(t):{top:t,right:t,bottom:t,left:t}}function DQ(t){const{x:e,y:n,width:r,height:s}=t;return{width:r,height:s,top:n,left:e,right:e+r,bottom:n+s,x:e,y:n}}function tBe(t,e,n){let{reference:r,floating:s}=t;const i=R1(e),o=_Ne(e),l=TNe(o),c=i0(e),d=i==="y",u=r.x+r.width/2-s.width/2,h=r.y+r.height/2-s.height/2,m=r[l]/2-s[l]/2;let f;switch(c){case"top":f={x:u,y:r.y-s.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:h};break;case"left":f={x:r.x-s.width,y:h};break;default:f={x:r.x,y:r.y}}switch(yy(e)){case"start":f[o]-=m*(n&&d?-1:1);break;case"end":f[o]+=m*(n&&d?-1:1);break}return f}async function G6n(t,e){var n;e===void 0&&(e={});const{x:r,y:s,platform:i,rects:o,elements:l,strategy:c}=t,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:h="floating",altBoundary:m=!1,padding:f=0}=YE(e,t),p=nxt(f),v=l[m?h==="floating"?"reference":"floating":h],b=DQ(await i.getClippingRect({element:(n=await(i.isElement==null?void 0:i.isElement(v)))==null||n?v:v.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:d,rootBoundary:u,strategy:c})),x=h==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),k=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},S=DQ(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:x,offsetParent:w,strategy:c}):x);return{top:(b.top-S.top+p.top)/k.y,bottom:(S.bottom-b.bottom+p.bottom)/k.y,left:(b.left-S.left+p.left)/k.x,right:(S.right-b.right+p.right)/k.x}}const W6n=50,q6n=async(t,e,n)=>{const{placement:r="bottom",strategy:s="absolute",middleware:i=[],platform:o}=n,l=o.detectOverflow?o:{...o,detectOverflow:G6n},c=await(o.isRTL==null?void 0:o.isRTL(e));let d=await o.getElementRects({reference:t,floating:e,strategy:s}),{x:u,y:h}=tBe(d,r,c),m=r,f=0;const p={};for(let g=0;g<i.length;g++){const v=i[g];if(!v)continue;const{name:b,fn:x}=v,{x:w,y:k,data:S,reset:C}=await x({x:u,y:h,initialPlacement:r,placement:m,strategy:s,middlewareData:p,rects:d,platform:l,elements:{reference:t,floating:e}});u=w??u,h=k??h,p[b]={...p[b],...S},C&&f<W6n&&(f++,typeof C=="object"&&(C.placement&&(m=C.placement),C.rects&&(d=C.rects===!0?await o.getElementRects({reference:t,floating:e,strategy:s}):C.rects),{x:u,y:h}=tBe(d,m,c)),g=-1)}return{x:u,y:h,placement:m,strategy:s,middlewareData:p}},K6n=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:s,rects:i,platform:o,elements:l,middlewareData:c}=e,{element:d,padding:u=0}=YE(t,e)||{};if(d==null)return{};const h=nxt(u),m={x:n,y:r},f=_Ne(s),p=TNe(f),g=await o.getDimensions(d),v=f==="y",b=v?"top":"left",x=v?"bottom":"right",w=v?"clientHeight":"clientWidth",k=i.reference[p]+i.reference[f]-m[f]-i.floating[p],S=m[f]-i.reference[f],C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let j=C?C[w]:0;(!j||!await(o.isElement==null?void 0:o.isElement(C)))&&(j=l.floating[w]||i.floating[p]);const E=k/2-S/2,N=j/2-g[p]/2-1,A=S6(h[b],N),_=S6(h[x],N),T=A,R=j-g[p]-_,O=j/2-g[p]/2+E,F=xbe(T,O,R),D=!c.arrow&&yy(s)!=null&&O!==F&&i.reference[p]/2-(O<T?A:_)-g[p]/2<0,I=D?O<T?O-T:O-R:0;return{[f]:m[f]+I,data:{[f]:F,centerOffset:O-F-I,...D&&{alignmentOffset:I}},reset:D}}});function Y6n(t,e,n){return(t?[...n.filter(s=>yy(s)===t),...n.filter(s=>yy(s)!==t)]:n.filter(s=>i0(s)===s)).filter(s=>t?yy(s)===t||(e?MQ(s)!==s:!1):!0)}const Q6n=function(t){return t===void 0&&(t={}),{name:"autoPlacement",options:t,async fn(e){var n,r,s;const{rects:i,middlewareData:o,placement:l,platform:c,elements:d}=e,{crossAxis:u=!1,alignment:h,allowedPlacements:m=J7e,autoAlignment:f=!0,...p}=YE(t,e),g=h!==void 0||m===J7e?Y6n(h||null,f,m):m,v=await c.detectOverflow(e,p),b=((n=o.autoPlacement)==null?void 0:n.index)||0,x=g[b];if(x==null)return{};const w=txt(x,i,await(c.isRTL==null?void 0:c.isRTL(d.floating)));if(l!==x)return{reset:{placement:g[0]}};const k=[v[i0(x)],v[w[0]],v[w[1]]],S=[...((r=o.autoPlacement)==null?void 0:r.overflows)||[],{placement:x,overflows:k}],C=g[b+1];if(C)return{data:{index:b+1,overflows:S},reset:{placement:C}};const j=S.map(A=>{const _=yy(A.placement);return[A.placement,_&&u?A.overflows.slice(0,2).reduce((T,R)=>T+R,0):A.overflows[0],A.overflows]}).sort((A,_)=>A[1]-_[1]),N=((s=j.filter(A=>A[2].slice(0,yy(A[0])?2:3).every(_=>_<=0))[0])==null?void 0:s[0])||j[0][0];return N!==l?{data:{index:b+1,overflows:S},reset:{placement:N}}:{}}}},Z6n=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:s,middlewareData:i,rects:o,initialPlacement:l,platform:c,elements:d}=e,{mainAxis:u=!0,crossAxis:h=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:g=!0,...v}=YE(t,e);if((n=i.arrow)!=null&&n.alignmentOffset)return{};const b=i0(s),x=R1(l),w=i0(l)===l,k=await(c.isRTL==null?void 0:c.isRTL(d.floating)),S=m||(w||!g?[LQ(l)]:F6n(l)),C=p!=="none";!m&&C&&S.push(...V6n(l,g,p,k));const j=[l,...S],E=await c.detectOverflow(e,v),N=[];let A=((r=i.flip)==null?void 0:r.overflows)||[];if(u&&N.push(E[b]),h){const O=txt(s,o,k);N.push(E[O[0]],E[O[1]])}if(A=[...A,{placement:s,overflows:N}],!N.every(O=>O<=0)){var _,T;const O=(((_=i.flip)==null?void 0:_.index)||0)+1,F=j[O];if(F&&(!(h==="alignment"?x!==R1(F):!1)||A.every(P=>R1(P.placement)===x?P.overflows[0]>0:!0)))return{data:{index:O,overflows:A},reset:{placement:F}};let D=(T=A.filter(I=>I.overflows[0]<=0).sort((I,P)=>I.overflows[1]-P.overflows[1])[0])==null?void 0:T.placement;if(!D)switch(f){case"bestFit":{var R;const I=(R=A.filter(P=>{if(C){const M=R1(P.placement);return M===x||M==="y"}return!0}).map(P=>[P.placement,P.overflows.filter(M=>M>0).reduce((M,z)=>M+z,0)]).sort((P,M)=>P[1]-M[1])[0])==null?void 0:R[0];I&&(D=I);break}case"initialPlacement":D=l;break}if(s!==D)return{reset:{placement:D}}}return{}}}};function nBe(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function rBe(t){return Xbt.some(e=>t[e]>=0)}const J6n=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n,platform:r}=e,{strategy:s="referenceHidden",...i}=YE(t,e);switch(s){case"referenceHidden":{const o=await r.detectOverflow(e,{...i,elementContext:"reference"}),l=nBe(o,n.reference);return{data:{referenceHiddenOffsets:l,referenceHidden:rBe(l)}}}case"escaped":{const o=await r.detectOverflow(e,{...i,altBoundary:!0}),l=nBe(o,n.floating);return{data:{escapedOffsets:l,escaped:rBe(l)}}}default:return{}}}}},X6n=new Set(["left","top"]);async function eFn(t,e){const{placement:n,platform:r,elements:s}=t,i=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=i0(n),l=yy(n),c=R1(n)==="y",d=X6n.has(o)?-1:1,u=i&&c?-1:1,h=YE(e,t);let{mainAxis:m,crossAxis:f,alignmentAxis:p}=typeof h=="number"?{mainAxis:h,crossAxis:0,alignmentAxis:null}:{mainAxis:h.mainAxis||0,crossAxis:h.crossAxis||0,alignmentAxis:h.alignmentAxis};return l&&typeof p=="number"&&(f=l==="end"?p*-1:p),c?{x:f*u,y:m*d}:{x:m*d,y:f*u}}const tFn=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:s,y:i,placement:o,middlewareData:l}=e,c=await eFn(e,t);return o===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:i+c.y,data:{...c,placement:o}}}}},nFn=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:s,platform:i}=e,{mainAxis:o=!0,crossAxis:l=!1,limiter:c={fn:b=>{let{x,y:w}=b;return{x,y:w}}},...d}=YE(t,e),u={x:n,y:r},h=await i.detectOverflow(e,d),m=R1(i0(s)),f=ext(m);let p=u[f],g=u[m];if(o){const b=f==="y"?"top":"left",x=f==="y"?"bottom":"right",w=p+h[b],k=p-h[x];p=xbe(w,p,k)}if(l){const b=m==="y"?"top":"left",x=m==="y"?"bottom":"right",w=g+h[b],k=g-h[x];g=xbe(w,g,k)}const v=c.fn({...e,[f]:p,[m]:g});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[f]:o,[m]:l}}}}}};function yne(){return typeof window<"u"}function $I(t){return rxt(t)?(t.nodeName||"").toLowerCase():"#document"}function wm(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function D0(t){var e;return(e=(rxt(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function rxt(t){return yne()?t instanceof Node||t instanceof wm(t).Node:!1}function Lg(t){return yne()?t instanceof Element||t instanceof wm(t).Element:!1}function $0(t){return yne()?t instanceof HTMLElement||t instanceof wm(t).HTMLElement:!1}function sBe(t){return!yne()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof wm(t).ShadowRoot}function O7(t){const{overflow:e,overflowX:n,overflowY:r,display:s}=Dg(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&s!=="inline"&&s!=="contents"}function rFn(t){return/^(table|td|th)$/.test($I(t))}function bne(t){try{if(t.matches(":popover-open"))return!0}catch{}try{return t.matches(":modal")}catch{return!1}}const sFn=/transform|translate|scale|rotate|perspective|filter/,iFn=/paint|layout|strict|content/,tC=t=>!!t&&t!=="none";let Pce;function ANe(t){const e=Lg(t)?Dg(t):t;return tC(e.transform)||tC(e.translate)||tC(e.scale)||tC(e.rotate)||tC(e.perspective)||!PNe()&&(tC(e.backdropFilter)||tC(e.filter))||sFn.test(e.willChange||"")||iFn.test(e.contain||"")}function aFn(t){let e=$k(t);for(;$0(e)&&!LR(e);){if(ANe(e))return e;if(bne(e))return null;e=$k(e)}return null}function PNe(){return Pce==null&&(Pce=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Pce}function LR(t){return/^(html|body|#document)$/.test($I(t))}function Dg(t){return wm(t).getComputedStyle(t)}function xne(t){return Lg(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function $k(t){if($I(t)==="html")return t;const e=t.assignedSlot||t.parentNode||sBe(t)&&t.host||D0(t);return sBe(e)?e.host:e}function sxt(t){const e=$k(t);return LR(e)?t.ownerDocument?t.ownerDocument.body:t.body:$0(e)&&O7(e)?e:sxt(e)}function ixt(t,e,n){var r;e===void 0&&(e=[]);const s=sxt(t),i=s===((r=t.ownerDocument)==null?void 0:r.body),o=wm(s);return i?(wbe(o),e.concat(o,o.visualViewport||[],O7(s)?s:[],[])):e.concat(s,ixt(s,[]))}function wbe(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function axt(t){const e=Dg(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=$0(t),i=s?t.offsetWidth:n,o=s?t.offsetHeight:r,l=IQ(n)!==i||IQ(r)!==o;return l&&(n=i,r=o),{width:n,height:r,$:l}}function oxt(t){return Lg(t)?t:t.contextElement}function XA(t){const e=oxt(t);if(!$0(e))return vy(1);const n=e.getBoundingClientRect(),{width:r,height:s,$:i}=axt(e);let o=(i?IQ(n.width):n.width)/r,l=(i?IQ(n.height):n.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!l||!Number.isFinite(l))&&(l=1),{x:o,y:l}}const oFn=vy(0);function lxt(t){const e=wm(t);return!PNe()||!e.visualViewport?oFn:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function lFn(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==wm(t)?!1:e}function C6(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const s=t.getBoundingClientRect(),i=oxt(t);let o=vy(1);e&&(r?Lg(r)&&(o=XA(r)):o=XA(t));const l=lFn(i,n,r)?lxt(i):vy(0);let c=(s.left+l.x)/o.x,d=(s.top+l.y)/o.y,u=s.width/o.x,h=s.height/o.y;if(i){const m=wm(i),f=r&&Lg(r)?wm(r):r;let p=m,g=wbe(p);for(;g&&r&&f!==p;){const v=XA(g),b=g.getBoundingClientRect(),x=Dg(g),w=b.left+(g.clientLeft+parseFloat(x.paddingLeft))*v.x,k=b.top+(g.clientTop+parseFloat(x.paddingTop))*v.y;c*=v.x,d*=v.y,u*=v.x,h*=v.y,c+=w,d+=k,p=wm(g),g=wbe(p)}}return DQ({width:u,height:h,x:c,y:d})}function wne(t,e){const n=xne(t).scrollLeft;return e?e.left+n:C6(D0(t)).left+n}function cxt(t,e){const n=t.getBoundingClientRect(),r=n.left+e.scrollLeft-wne(t,n),s=n.top+e.scrollTop;return{x:r,y:s}}function cFn(t){let{elements:e,rect:n,offsetParent:r,strategy:s}=t;const i=s==="fixed",o=D0(r),l=e?bne(e.floating):!1;if(r===o||l&&i)return n;let c={scrollLeft:0,scrollTop:0},d=vy(1);const u=vy(0),h=$0(r);if((h||!h&&!i)&&(($I(r)!=="body"||O7(o))&&(c=xne(r)),h)){const f=C6(r);d=XA(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}const m=o&&!h&&!i?cxt(o,c):vy(0);return{width:n.width*d.x,height:n.height*d.y,x:n.x*d.x-c.scrollLeft*d.x+u.x+m.x,y:n.y*d.y-c.scrollTop*d.y+u.y+m.y}}function dFn(t){return Array.from(t.getClientRects())}function uFn(t){const e=D0(t),n=xne(t),r=t.ownerDocument.body,s=JA(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),i=JA(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-n.scrollLeft+wne(t);const l=-n.scrollTop;return Dg(r).direction==="rtl"&&(o+=JA(e.clientWidth,r.clientWidth)-s),{width:s,height:i,x:o,y:l}}const iBe=25;function hFn(t,e){const n=wm(t),r=D0(t),s=n.visualViewport;let i=r.clientWidth,o=r.clientHeight,l=0,c=0;if(s){i=s.width,o=s.height;const u=PNe();(!u||u&&e==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}const d=wne(r);if(d<=0){const u=r.ownerDocument,h=u.body,m=getComputedStyle(h),f=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,p=Math.abs(r.clientWidth-h.clientWidth-f);p<=iBe&&(i-=p)}else d<=iBe&&(i+=d);return{width:i,height:o,x:l,y:c}}function mFn(t,e){const n=C6(t,!0,e==="fixed"),r=n.top+t.clientTop,s=n.left+t.clientLeft,i=$0(t)?XA(t):vy(1),o=t.clientWidth*i.x,l=t.clientHeight*i.y,c=s*i.x,d=r*i.y;return{width:o,height:l,x:c,y:d}}function aBe(t,e,n){let r;if(e==="viewport")r=hFn(t,n);else if(e==="document")r=uFn(D0(t));else if(Lg(e))r=mFn(e,n);else{const s=lxt(t);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return DQ(r)}function dxt(t,e){const n=$k(t);return n===e||!Lg(n)||LR(n)?!1:Dg(n).position==="fixed"||dxt(n,e)}function fFn(t,e){const n=e.get(t);if(n)return n;let r=ixt(t,[]).filter(l=>Lg(l)&&$I(l)!=="body"),s=null;const i=Dg(t).position==="fixed";let o=i?$k(t):t;for(;Lg(o)&&!LR(o);){const l=Dg(o),c=ANe(o);!c&&l.position==="fixed"&&(s=null),(i?!c&&!s:!c&&l.position==="static"&&!!s&&(s.position==="absolute"||s.position==="fixed")||O7(o)&&!c&&dxt(t,o))?r=r.filter(u=>u!==o):s=l,o=$k(o)}return e.set(t,r),r}function pFn(t){let{element:e,boundary:n,rootBoundary:r,strategy:s}=t;const o=[...n==="clippingAncestors"?bne(e)?[]:fFn(e,this._c):[].concat(n),r],l=aBe(e,o[0],s);let c=l.top,d=l.right,u=l.bottom,h=l.left;for(let m=1;m<o.length;m++){const f=aBe(e,o[m],s);c=JA(f.top,c),d=S6(f.right,d),u=S6(f.bottom,u),h=JA(f.left,h)}return{width:d-h,height:u-c,x:h,y:c}}function gFn(t){const{width:e,height:n}=axt(t);return{width:e,height:n}}function vFn(t,e,n){const r=$0(e),s=D0(e),i=n==="fixed",o=C6(t,!0,i,e);let l={scrollLeft:0,scrollTop:0};const c=vy(0);function d(){c.x=wne(s)}if(r||!r&&!i)if(($I(e)!=="body"||O7(s))&&(l=xne(e)),r){const f=C6(e,!0,i,e);c.x=f.x+e.clientLeft,c.y=f.y+e.clientTop}else s&&d();i&&!r&&s&&d();const u=s&&!r&&!i?cxt(s,l):vy(0),h=o.left+l.scrollLeft-c.x-u.x,m=o.top+l.scrollTop-c.y-u.y;return{x:h,y:m,width:o.width,height:o.height}}function Rce(t){return Dg(t).position==="static"}function oBe(t,e){if(!$0(t)||Dg(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return D0(t)===n&&(n=n.ownerDocument.body),n}function uxt(t,e){const n=wm(t);if(bne(t))return n;if(!$0(t)){let s=$k(t);for(;s&&!LR(s);){if(Lg(s)&&!Rce(s))return s;s=$k(s)}return n}let r=oBe(t,e);for(;r&&rFn(r)&&Rce(r);)r=oBe(r,e);return r&&LR(r)&&Rce(r)&&!ANe(r)?n:r||aFn(t)||n}const yFn=async function(t){const e=this.getOffsetParent||uxt,n=this.getDimensions,r=await n(t.floating);return{reference:vFn(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function bFn(t){return Dg(t).direction==="rtl"}const xFn={convertOffsetParentRelativeRectToViewportRelativeRect:cFn,getDocumentElement:D0,getClippingRect:pFn,getOffsetParent:uxt,getElementRects:yFn,getClientRects:dFn,getDimensions:gFn,getScale:XA,isElement:Lg,isRTL:bFn},RNe=tFn,wFn=Q6n,INe=nFn,hxt=Z6n,kFn=J6n,SFn=K6n,MNe=(t,e,n)=>{const r=new Map,s={platform:xFn,...n},i={...s.platform,_c:r};return q6n(t,e,{...s,platform:i})},mxt=(t,e)=>{const n=e.getTime()-t.getTime();return Math.round(Math.abs(n/1e3/60))},kne=(t,e)=>{const n=mxt(t,e);if(n<2)return"just now";if(n<60)return`${n}m ago`;const r=Math.round(n/60);if(n<90)return`about ${r}h ago`;if(r<24)return`${r}h ago`;const s=Math.round(r/24);return s<7?`${s}d ago`:`${Math.round(s/7)}w ago`},LNe=t=>t.toDateString()+" "+t.toLocaleTimeString();var CFn="[object Symbol]";function jFn(t){return typeof t=="symbol"||CS(t)&&GE(t)==CFn}var EFn=/\s/;function NFn(t){for(var e=t.length;e--&&EFn.test(t.charAt(e)););return e}var TFn=/^\s+/;function _Fn(t){return t&&t.slice(0,NFn(t)+1).replace(TFn,"")}var lBe=NaN,AFn=/^[-+]0x[0-9a-f]+$/i,PFn=/^0b[01]+$/i,RFn=/^0o[0-7]+$/i,IFn=parseInt;function cBe(t){if(typeof t=="number")return t;if(jFn(t))return lBe;if(Mg(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=Mg(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=_Fn(t);var n=PFn.test(t);return n||RFn.test(t)?IFn(t.slice(2),n?2:8):AFn.test(t)?lBe:+t}var MFn=function(){return Yg.Date.now()};const Ice=MFn;var LFn="Expected a function",DFn=Math.max,$Fn=Math.min;function Sne(t,e,n){var r,s,i,o,l,c,d=0,u=!1,h=!1,m=!0;if(typeof t!="function")throw new TypeError(LFn);e=cBe(e)||0,Mg(n)&&(u=!!n.leading,h="maxWait"in n,i=h?DFn(cBe(n.maxWait)||0,e):i,m="trailing"in n?!!n.trailing:m);function f(C){var j=r,E=s;return r=s=void 0,d=C,o=t.apply(E,j),o}function p(C){return d=C,l=setTimeout(b,e),u?f(C):o}function g(C){var j=C-c,E=C-d,N=e-j;return h?$Fn(N,i-E):N}function v(C){var j=C-c,E=C-d;return c===void 0||j>=e||j<0||h&&E>=i}function b(){var C=Ice();if(v(C))return x(C);l=setTimeout(b,g(C))}function x(C){return l=void 0,m&&r?f(C):(r=s=void 0,o)}function w(){l!==void 0&&clearTimeout(l),d=0,r=c=s=l=void 0}function k(){return l===void 0?o:x(Ice())}function S(){var C=Ice(),j=v(C);if(r=arguments,s=this,c=C,j){if(l===void 0)return p(c);if(h)return clearTimeout(l),l=setTimeout(b,e),f(c)}return l===void 0&&(l=setTimeout(b,e)),o}return S.cancel=w,S.flush=k,S}const OFn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;height:var(--rtk-space-32, 128px);width:var(--rtk-space-32, 128px);align-items:center;justify-content:center;font-size:28px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));overflow:clip;border-radius:9999px;-webkit-user-select:none;-moz-user-select:none;user-select:none}rtk-icon{height:50%;width:50%}.image-ctr{display:flex;height:100%;width:100%;align-items:center;justify-content:center;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}img{height:var(--rtk-space-0, 0px);width:var(--rtk-space-0, 0px);-o-object-fit:cover;object-fit:cover}img.loaded{height:100%;width:100%}.initials{display:flex;height:100%;width:100%;align-items:center;justify-content:center;text-transform:uppercase}.image{display:flex;height:100%;width:100%;align-items:center;justify-content:center}.image img{display:none;height:100%;width:100%;-o-object-fit:cover;object-fit:cover}.image img.loaded{display:block}:host([variant='hexagon']){border-radius:var(--rtk-border-radius-none, 0);clip-path:polygon(50% 0, 95% 25%, 95% 75%, 50% 100%, 5% 75%, 5% 25%)}:host([variant='square']){border-radius:var(--rtk-border-radius-none, 0);clip-path:polygon(0% 0%, 100% 0%, 100% 100%, 0% 100%)}:host([size='sm']){height:var(--rtk-space-14, 56px);width:var(--rtk-space-14, 56px);font-size:12px}:host([size='md']){height:var(--rtk-space-28, 112px);width:var(--rtk-space-28, 112px)}:host([size='lg']){height:var(--rtk-space-32, 128px);width:var(--rtk-space-32, 128px)}",FFn=OFn;var fxt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const Cne=class{constructor(e){kt(this,e),this.variant="circular",this.iconPack=Nt,this.t=It(),this.imageState="loading",this.getAvatar=()=>{var n;const r=Rf(((n=this.participant)===null||n===void 0?void 0:n.name)||"");let s;if(this.participant!=null&&"picture"in this.participant&&(s=this.participant.picture),s&&s.length>0&&this.imageState!=="errored")return $("div",{class:"image-ctr"},this.imageState==="loading"&&$("rtk-spinner",{iconPack:this.iconPack}),$("img",{src:s,class:{loaded:this.imageState==="loaded"},loading:"lazy",title:r,onLoad:()=>this.imageState="loaded",onError:()=>this.imageState="errored",part:"image"}));const i=Dbt(r);return $("div",{class:"initials",title:r,part:"initials"},i)}}render(){return $(mt,{key:"d7d3a7b03a3807984dc6798b5e35cec4418e06e7"},this.getAvatar(),$("slot",{key:"25aa9fe632a132c1e2f8ef88ac98043bb8ef085a"}))}};fxt([ge()],Cne.prototype,"iconPack",void 0);fxt([ge()],Cne.prototype,"t",void 0);Cne.style=FFn;const BFn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{--icon-size:var(--rtk-button-icon-size, var(--rtk-space-5, 20px));--transition-property:var(--rtk-transition-property, all);--transition-duration:100ms;display:inline-flex;height:var(--rtk-space-8, 32px);cursor:pointer;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));font-size:14px;-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:var(--rtk-border-radius-sm, 4px);transition-property:var(--transition-property);transition-duration:var(--transition-duration)}button{box-sizing:border-box;background-color:transparent;color:inherit;border:var(--rtk-border-width-sm, 1px) solid transparent;padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);display:inline-flex;flex-grow:1;justify-content:center;vertical-align:baseline;gap:var(--rtk-space-1, 4px);transition-property:var(--transition-property);transition-duration:var(--transition-duration);outline:none;height:inherit;border-radius:inherit;fill:inherit;cursor:inherit;font-weight:inherit;font-family:inherit;font-size:inherit;line-height:inherit}.start,.content,.end{align-self:center}::slotted(rtk-icon),::slotted(rtk-spinner){height:var(--icon-size);width:var(--icon-size)}:host([variant='primary']){color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}:host(:hover){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-600, 13 81 253) / var(--tw-bg-opacity))}button:focus-visible{border-color:rgb(var(--rtk-colors-text-1000, 255 255 255))}:host(:active){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-700, 2 70 253) / var(--tw-bg-opacity))}:host([disabled]:not([disabled='false'])){cursor:not-allowed;opacity:0.6}:host([variant='secondary']){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}:host([variant='secondary']:hover){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}:host([variant='secondary']:active){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}:host([variant='danger']){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-bg-opacity))}:host([variant='danger']:hover){background-color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.7)}:host([variant='danger']:active){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-bg-opacity))}:host([variant='ghost']){background-color:transparent;color:inherit}:host([variant='ghost'].active){--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity))}:host([variant='ghost']:hover){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}:host([variant='ghost']:active){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}:host([kind='icon']){--icon-size:var(--rtk-space-5, 20px);width:var(--rtk-space-8, 32px)}:host([kind='icon']) button{padding-left:var(--rtk-space-0, 0px);padding-right:var(--rtk-space-0, 0px)}:host([kind='wide']){width:100%}:host([size='lg']){--icon-size:var(--rtk-space-5, 20px);height:var(--rtk-space-10, 40px);font-size:16px}:host([size='lg'][kind='icon']){--icon-size:var(--rtk-space-6, 24px);height:var(--rtk-space-10, 40px);width:var(--rtk-space-10, 40px)}:host([size='sm']){--icon-size:var(--rtk-space-4, 16px);height:var(--rtk-space-6, 24px);font-size:12px}:host([size='sm'][kind='icon']){height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}",UFn=BFn,pxt=class{constructor(t){kt(this,t),this.variant="primary",this.kind="button",this.reverse=!1,this.disabled=!1,this.type="button"}render(){return $(mt,{key:"0f96cef4ae77a2be8013fa5d62d39626734eeced"},$("button",{key:"8c06d5f5cc71779b8d56f31d2dd77b8d35e8b280",part:"button",type:this.type,disabled:this.disabled},$("span",{key:"ae741ddf8cc914f9493c26330b1f322541f64223",class:"start"},$("slot",{key:"18275dab42a4dd38b5a59463ffca227e4a6df3c8",name:"start"})),$("span",{key:"c2b912515b6edc2966c4cdb282c89022aa05c13f",class:"content",part:"content"},$("slot",{key:"5d87993198e16a3b5f38e62979fa2ee5637a059d"})),$("span",{key:"0bc907da23ea362f8ae0b3fdf88452b1c3881078",class:"end"},$("slot",{key:"0862eeefcfa5765ce605b99a04aab88222ed6e68",name:"end"}))))}static get delegatesFocus(){return!0}};pxt.style=UFn;const zFn=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{display:flex;height:100%;width:100%;flex-direction:column;font-size:14px;position:relative;box-sizing:border-box;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}h3{margin:var(--rtk-space-0, 0px);display:flex;height:var(--rtk-space-12, 48px);align-items:center;justify-content:center;font-size:16px;font-weight:400;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));text-align:center}#dropzone{position:absolute;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);z-index:10;display:none;flex-direction:column;align-items:center;justify-content:center;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}#dropzone.active{display:flex;animation:0.2s slide-up ease-in}rtk-chat-messages-ui,rtk-chat-messages-ui-paginated{flex:1 0 0}rtk-chat-composer-view{margin:var(--rtk-space-2, 8px)}.chat-container{display:flex;height:100%;width:100%;flex-direction:row;container-type:size;container-name:chatcontainer}.chat{box-sizing:border-box;display:flex;flex:1 1 0%;flex-direction:column}.banner{height:100%;width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center}.view-chats-btn{margin-top:var(--rtk-space-4, 16px)}.selector-container{z-index:50;width:100%;max-width:var(--rtk-space-80, 320px);border-right:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60))}.selector-container.hide{display:none}.mobile-close-btn{display:none}.selector-container.mobile{height:100%;width:100%;max-width:100%;position:absolute;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / 0.6);display:flex}.selector-container.mobile .mobile-close-btn{margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-4, 16px);margin-left:var(--rtk-space-6, 24px);margin-right:var(--rtk-space-6, 24px);display:block}.pinned-messages{position:relative;display:flex;flex-direction:column}.pinned-messages-header{display:flex;align-items:center;justify-content:space-between;gap:var(--rtk-space-2, 8px);padding:var(--rtk-space-4, 16px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));font-size:14px;cursor:pointer}.pinned-messages-header div{display:flex;flex-direction:row;align-items:center;gap:var(--rtk-space-2, 8px)}.pinned-messages-header rtk-icon{height:var(--rtk-space-3, 12px);width:var(--rtk-space-3, 12px)}.pinned-messages-content{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));position:absolute;left:var(--rtk-space-0, 0px);top:100%;z-index:50;max-height:30vh;width:100%;overflow:auto}.pinned-message{display:flex;cursor:pointer;flex-direction:row;align-items:center;gap:var(--rtk-space-2, 8px);--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-border-opacity));padding:var(--rtk-space-4, 16px);border-bottom-width:var(--rtk-border-width-sm, 1px);border-right-width:var(--rtk-border-width-none, 0);border-left-width:var(--rtk-border-width-none, 0);border-top-width:var(--rtk-border-width-none, 0);border-style:solid}.pinned-message-avatar{height:var(--rtk-space-6, 24px) !important;width:var(--rtk-space-6, 24px) !important}@keyframes swipe-in{from{transform:translateX(-100%)}to{transform:translateX(0)}}`,VFn=zFn;var F7=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const QE=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.chatPermissionUpdateListener=()=>{this.canSend=this.meeting.self.permissions.chatPublic.canSend,this.canSendTextMessage=this.meeting.self.permissions.chatPublic.text,this.canSendFiles=this.meeting.self.permissions.chatPublic.files},this.config=Os(),this.iconPack=Nt,this.t=It(),this.overrides=Nx,this.canPinMessages=!1,this.now=new Date,this.dropzoneActivated=!1,this.showLatestMessageButton=!1,this.canSend=!1,this.canSendTextMessage=!1,this.canSendFiles=!1,this.canPrivateMessage=!1,this.canSendPrivateTexts=!1,this.canSendPrivateFiles=!1,this.emojiPickerEnabled=!1,this.participants=[],this.editingMessage=null,this.replyMessage=null,this.searchQuery="",this.selectorState="hide",this.isSendingMessage=!1,this.showPinnedMessages=!1,this.onDragOver=e=>{e.preventDefault(),this.dropzoneActivated=!0},this.onDragLeave=()=>{this.dropzoneActivated=!1},this.onDrop=e=>{e.preventDefault(),this.dropzoneActivated=!1,$bt(e.dataTransfer.items,(n,r)=>{var s,i,o,l;switch(n){case"image":this.isFileMessagingAllowed()&&((i=(s=this.meeting)===null||s===void 0?void 0:s.chat)===null||i===void 0||i.sendImageMessage(r,this.getRecipientPeerIds()));break;case"file":this.isFileMessagingAllowed()&&((l=(o=this.meeting)===null||o===void 0?void 0:o.chat)===null||l===void 0||l.sendFileMessage(r,this.getRecipientPeerIds()));break}})},this.disconnectMeeting=e=>{e.self.permissions.removeListener("*",this.chatPermissionUpdateListener)},this.isTextMessagingAllowed=()=>this.selectedParticipant?this.canPrivateMessage&&this.canSendPrivateTexts:this.canSend&&this.canSendTextMessage,this.isFileMessagingAllowed=()=>this.selectedParticipant?this.canPrivateMessage&&this.canSendPrivateFiles:this.canSend&&this.canSendFiles,this.onQuotedMessageDismiss=()=>{this.replyMessage=null},this.onNewMessageHandler=async e=>{const n=e.detail;this.isSendingMessage=!0;try{await this.meeting.chat.sendMessage(n,this.getRecipientPeerIds())}finally{this.isSendingMessage=!1}},this.onEditMessageHandler=async e=>{var n,r;this.isSendingMessage=!0;try{await((r=(n=this.meeting)===null||n===void 0?void 0:n.chat)===null||r===void 0?void 0:r.editTextMessage(this.editingMessage.id,e.detail))}finally{this.isSendingMessage=!1,this.editingMessage=null}},this.onEditCancel=()=>{this.editingMessage=null},this.onPinMessage=e=>{const n=e.detail;n.pinned?this.meeting.chat.unpin(n.id):this.meeting.chat.pin(n.id)},this.onDeleteMessage=e=>{var n;const r=e.detail;((n=this.editingMessage)===null||n===void 0?void 0:n.id)===r.id&&(this.editingMessage=null);try{if(typeof localStorage<"u"){const s=[];for(let i=0;i<localStorage.length;i++){const o=localStorage.key(i);o&&o.startsWith("rtk-chat-edit-")&&o.endsWith(`-${r.id}`)&&s.push(o)}s.forEach(i=>localStorage.removeItem(i))}}catch{}this.meeting.chat.deleteMessage(r.id)},this.onMessageEdit=e=>{const n=e.detail;n.type==="text"&&(this.replyMessage=null,this.editingMessage=n)}}connectedCallback(){this.meeting&&(this.meetingChanged(this.meeting),!(this.meeting&&!this.meeting.chat)&&this.isFileMessagingAllowed()&&(this.host.addEventListener("dragover",this.onDragOver),this.host.addEventListener("dragleave",this.onDragLeave),this.host.addEventListener("drop",this.onDrop)))}onEditMessageInit(t){t.detail.flags.isReply?this.replyMessage=t.detail.payload:t.detail.flags.isEdit&&(this.editingMessage=t.detail.payload)}onChatSelectorChange(t){var e;const n=(e=t.detail)===null||e===void 0?void 0:e.selectedUser;if(!n){this.selectedParticipant=null;return}this.selectedParticipant=n}disconnectedCallback(){var t;(t=this.resizeObserver)===null||t===void 0||t.disconnect(),this.disconnectMeeting(this.meeting),this.host.removeEventListener("dragover",this.onDragOver),this.host.removeEventListener("dragleave",this.onDragLeave),this.host.removeEventListener("drop",this.onDrop)}meetingChanged(t,e){var n,r,s,i;e!=null&&this.disconnectMeeting(e),!(t&&!t.chat)&&t!=null&&(this.canSend=t.self.permissions.chatPublic.canSend,this.canSendTextMessage=t.self.permissions.chatPublic.text,this.canSendFiles=t.self.permissions.chatPublic.files,this.canPrivateMessage=!!(!((n=t.self.permissions.chatPrivate)===null||n===void 0)&&n.canSend||!((r=t.self.permissions.chatPrivate)===null||r===void 0)&&r.canReceive),this.canSendPrivateTexts=!!(!((s=t.self.permissions.chatPrivate)===null||s===void 0)&&s.text),this.canSendPrivateFiles=!!(!((i=t.self.permissions.chatPrivate)===null||i===void 0)&&i.files),t.self.permissions.on("*",this.chatPermissionUpdateListener))}getRecipientPeerIds(){return this.selectedParticipant?[this.selectedParticipant.id]:[]}renderComposerUI(){if(this.selectedParticipant){if(!this.canSendPrivateTexts&&!this.canSendPrivateFiles)return null}else if(!this.canSendTextMessage&&!this.canSendFiles)return null;const t={iconPack:this.iconPack,t:this.t,size:this.size},e=this.editingMessage?this.editingMessage.message:"",n=this.replyMessage?this.replyMessage.message:"",r="rtk-chat-draft",s=this.editingMessage?`rtk-chat-edit-no-channel-${this.editingMessage.id}`:"rtk-chat-edit",i=this.editingMessage?s:r;return $("rtk-chat-composer-view",Object.assign({message:e,storageKey:i,quotedMessage:n,isEditing:!!this.editingMessage,isSending:this.isSendingMessage,canSendTextMessage:this.isTextMessagingAllowed(),canSendFiles:this.isFileMessagingAllowed(),disableEmojiPicker:this.overrides.disableEmojiPicker,maxLength:this.meeting.chat.maxTextLimit,rateLimits:this.meeting.chat.rateLimits,inputTextPlaceholder:this.t("chat.message_placeholder"),onNewMessage:this.onNewMessageHandler,onEditMessage:this.onEditMessageHandler,onEditCancel:this.onEditCancel,onQuotedMessageDismiss:this.onQuotedMessageDismiss},t),$("slot",{name:"chat-addon",slot:"chat-addon"}))}render(){return this.meeting?$(mt,null,$("div",{class:"chat-container"},$("div",{class:"chat"},this.isFileMessagingAllowed()&&$("div",{id:"dropzone",class:{active:this.dropzoneActivated},part:"dropzone"},$("rtk-icon",{icon:this.iconPack.attach}),$("p",null,this.t("chat.send_attachment"))),$("rtk-chat-header",null),$("rtk-chat-messages-ui-paginated",{meeting:this.meeting,privateChatRecipient:this.selectedParticipant,onPinMessage:this.onPinMessage,onEditMessage:this.onMessageEdit,onDeleteMessage:this.onDeleteMessage,size:this.size,iconPack:this.iconPack,t:this.t}),this.renderComposerUI()))):null}get host(){return Pl(this)}static get watchers(){return{meeting:["meetingChanged"]}}};F7([ge()],QE.prototype,"meeting",void 0);F7([ge()],QE.prototype,"config",void 0);F7([ge()],QE.prototype,"iconPack",void 0);F7([ge()],QE.prototype,"t",void 0);F7([ge()],QE.prototype,"overrides",void 0);QE.style=VFn;const HFn=`:host {
  display: flex;
  flex-direction: column;
  font-family: var(--rtk-font-family, sans-serif);
  font-size: 14px;
  position: relative;
}

.quoted-message-container {
  margin-bottom: var(--rtk-space-2, 8px);
  display: flex;
  justify-content: space-between;
  --tw-bg-opacity: 1;
  background-color: rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));
  color: rgb(var(--rtk-colors-text-1000, 255 255 255));
  border-radius: var(--rtk-border-radius-md, 8px);
  border: var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));
}

.quoted-message-container .quoted-message {
  flex: 1 1 0%;
  padding: var(--rtk-space-2, 8px);
  border-radius: var(--rtk-border-radius-md, 8px);
  max-height: var(--rtk-space-24, 96px);
  overflow-y: auto;
  word-break: break-all;
}

.quoted-message-container .quoted-message blockquote {
  display: none;
}

.quoted-message-container rtk-icon.dismiss {
  margin-left: auto;
  height: var(--rtk-space-5, 20px);
  width: var(--rtk-space-5, 20px);
  padding: var(--rtk-space-2, 8px);
  border-radius: var(--rtk-border-radius-md, 8px);
  color: rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));
}

.quoted-message-container rtk-icon.dismiss:hover {
  cursor: pointer;
  color: rgb(var(--rtk-colors-text-1000, 255 255 255));
}

.quoted-message-container rtk-icon.dismiss {
  transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}

.composer-container {
  position: relative;
  --tw-bg-opacity: 1;
  background-color: rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));
  border-radius: var(--rtk-border-radius-md, 8px);
  overflow: hidden;
  border: var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));
}

.composer-container > .composers {
    min-height: 60px;
  }

@container chatcontainer (height < 360px) {
    .composer-container > .composers {
      min-height: 30px;
    }
}

.chat-buttons {
  padding: var(--rtk-space-3, 12px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  --tw-bg-opacity: 1;
  background-color: rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));
  color: rgb(var(--rtk-colors-text-1000, 255 255 255));
}

.chat-buttons .right {
  z-index: 10;
}

.chat-buttons .right .edit-buttons {
  display: flex;
  gap: var(--rtk-space-2, 8px);
}

.chat-buttons > div {
  display: flex;
  align-items: center;
}

rtk-emoji-picker {
  z-index: 20;
  position: absolute;
  top: calc(var(--rtk-space-72, 288px) * -1);
  border-top: var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));
  animation: 0.3s slide-up ease;
}

@keyframes slide-up {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0%);
  }
}
`,GFn=HFn;var gxt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const ow={messagesSent:0,startTime:0},jne=class{constructor(t){kt(this,t),this.onNewMessage=Wt(this,"newMessage",7),this.onEditMessage=Wt(this,"editMessage",7),this.onEditCancel=Wt(this,"editCancel",7),this.onQuotedMessageDismiss=Wt(this,"quotedMessageDismiss",7),this.canSendTextMessage=!0,this.isSending=!1,this.canSendFiles=!0,this.message="",this.quotedMessage="",this.storageKey="rtk-text-message",this.inputTextPlaceholder="Enter your message",this.isEditing=!1,this.iconPack=Nt,this.t=It(),this.disableEmojiPicker=!1,this.rateLimits={period:60,maxInvocations:60},this.fileToUpload=null,this.isEmojiPickerOpen=!1,this.disableSendButton=!1,this.rateLimitsBreached=!1,this.textMessage="",this.sendFile=()=>{this.canSendFiles&&(this.fileToUpload.type==="image"?this.onNewMessage.emit({type:"image",image:this.fileToUpload.file}):this.onNewMessage.emit({type:"file",file:this.fileToUpload.file}),this.fileToUpload=null)},this.handleSendMessage=()=>{if(!this.canSendTextMessage||this.rateLimitsBreached)return;if(this.fileToUpload!==null){this.sendFile();return}const e=this.textMessage,n=Date.now();n-ow.startTime>this.rateLimits.period*1e3&&(ow.startTime=n,ow.messagesSent=0),ow.messagesSent+=1,this.checkRateLimitBreached(n),e.length>0&&(this.onNewMessage.emit({type:"text",message:e}),this.cleanup())},this.handleEditMessage=()=>{this.onEditMessage.emit(this.textMessage),this.cleanup()},this.handleEditCancel=()=>{this.onEditCancel.emit(),this.cleanup()},this.onTextChangeHandler=e=>{var n;this.textMessage=e.detail,this.textMessage.length>=((n=this.maxLength)!==null&&n!==void 0?n:k6)?this.disableSendButton=!0:this.disableSendButton&&(this.disableSendButton=!1),Ef.setItem(this.storageKey,e.detail)},this.onKeyDownHandler=e=>{e.key==="Enter"&&e.shiftKey||this.disableSendButton||e.key==="Enter"&&(e.preventDefault(),this.isEditing?this.handleEditMessage():this.handleSendMessage())},this.onFileUploadHandler=(e,n)=>{this.fileToUpload={type:e,file:n}},this.onQuotedMessageDismissHandler=()=>{this.onQuotedMessageDismiss.emit()},this.cleanup=()=>{this.textMessage="",this.fileToUpload=null,Ef.setItem(this.storageKey,""),this.$textComposer.setText("",!0),this.isEmojiPickerOpen=!1},this.onKeyDownHandler=this.onKeyDownHandler.bind(this)}connectedCallback(){this.textMessage=this.message||Ef.getItem(this.storageKey)||"",this.checkRateLimitBreached(Date.now())}componentWillUpdate(){this.textMessage=this.message||Ef.getItem(this.storageKey)||""}componentDidLoad(){this.message&&Dc(()=>this.$textComposer.setText(this.message,!0))}checkRateLimitBreached(t){if(ow.messagesSent>=this.rateLimits.maxInvocations){this.disableSendButton=!0,this.rateLimitsBreached=!0;const e=t-ow.startTime+this.rateLimits.period*1e3;setTimeout(()=>{ow.messagesSent=0,ow.startTime=Date.now(),this.disableSendButton=!1,this.rateLimitsBreached=!1},e)}}render(){var t;const e={iconPack:this.iconPack,t:this.t};return $(mt,{key:"2df23422579c855ced1cb6d24bb95786a1326baf"},this.canSendTextMessage&&this.isEmojiPickerOpen&&$("rtk-emoji-picker",Object.assign({key:"a7ed280a636d0207f58f0ad13f79c1eaed52ab9c",part:"emoji-picker",onPickerClose:()=>{this.isEmojiPickerOpen=!1},onRtkEmojiClicked:n=>{this.textMessage+=n.detail,this.$textComposer.setText(this.textMessage,!0)}},e)),$("slot",{key:"759df2a2029fbba963cfc26cd871771881dd6c5e",name:"chat-addon"}),this.quotedMessage&&this.quotedMessage.length!==0&&$("div",{key:"413be05a7374fc76f790ad3f6f5bef5a56a6ef97",class:"quoted-message-container",part:"quoted-message-container"},$("div",{key:"7fb6b571103c675dca202b74bd07fd55062dab70",class:"quoted-message scrollbar"},$("rtk-text-message-view",{key:"3997aa719a746234c5641e976dd0c27e68b69dae",text:this.quotedMessage,isMarkdown:!0})),$("div",{key:"f76ec54e3d67d6957d5d152b144b22d8cc122660"},$("rtk-icon",{key:"897b52fc41814d2cb8beeb461c36c9843cb2869e","aria-label":this.t("dismiss"),class:"dismiss",icon:this.iconPack.dismiss,onClick:this.onQuotedMessageDismissHandler}))),$("div",{key:"35447eb1fffffd372c231bc76ce741e483e7f26a",class:"composer-container"},$("div",{key:"0f8f198df49fcc27f6c85b8d6909eb2a7c00e142",class:"composers"},this.fileToUpload&&$("rtk-draft-attachment-view",Object.assign({key:"9d325d05fecb12ecb41f02e54561d2e1b59b2c2f"},e,{attachment:this.fileToUpload,onDeleteAttachment:()=>this.fileToUpload=null})),!this.fileToUpload&&$("rtk-text-composer-view",{key:"fbc870bb9d9c2418e528e64273edb67846e23e17",value:this.textMessage,placeholder:this.inputTextPlaceholder,onTextChange:this.onTextChangeHandler,keyDownHandler:this.onKeyDownHandler,maxLength:(t=this.maxLength)!==null&&t!==void 0?t:k6,rateLimitBreached:this.rateLimitsBreached,t:this.t,iconPack:this.iconPack,ref:n=>this.$textComposer=n})),$("div",{key:"20191403531eb87bca86d13387c7937153a4c99e",class:"chat-buttons",part:"chat-buttons"},$("div",{key:"4914a61fea3f502dc14778a237e9ce35a97e3afc",class:"left",part:"chat-buttons-left"},!this.fileToUpload&&!this.isEditing&&$("div",{key:"76c843588f2f7d90f5e60a1e44955309026eda27"},this.canSendFiles&&[$("rtk-file-picker-button",Object.assign({key:"cbb6f17b22f10b48ada27a4b4da3c1d5b2c7e320"},e,{onFileChange:n=>this.onFileUploadHandler("file",n.detail)})),$("rtk-file-picker-button",Object.assign({key:"0868162a2da021dd4175e977adf47d72ca54044a",filter:"image/*",label:this.t("chat.send_img"),icon:"image",onFileChange:n=>this.onFileUploadHandler("image",n.detail)},e))],this.canSendTextMessage&&!this.disableEmojiPicker&&$("rtk-emoji-picker-button",Object.assign({key:"a73378b5495dc3bfcde7dba335f674292ee6a96c",isActive:this.isEmojiPickerOpen,onClick:()=>{this.isEmojiPickerOpen=!this.isEmojiPickerOpen}},e)),$("slot",{key:"31208ad279dec430da4527d22730de8e418bc722",name:"chat-buttons"}))),$("div",{key:"04fcdd3f690548cbf1e257ffb2982785e557726b",class:"right",part:"chat-buttons-right"},!this.isEditing&&$("rtk-tooltip",{key:"367bf710673a0a2276f46d52289409abb77fe27b",variant:"primary",label:this.t("chat.send_msg"),delay:2e3},$("rtk-button",{key:"c677e3026636c375ed7eee411c596f6d2a802794",kind:"icon",disabled:this.disableSendButton||this.isSending,onClick:()=>this.handleSendMessage(),title:this.t("chat.send_msg")},this.isSending?$("rtk-spinner",{size:"sm"}):$("rtk-icon",{icon:this.iconPack.send}))),this.isEditing&&$("div",{key:"1e09e8868e4ae048b36bc8198b8aa1de92209a00",class:"edit-buttons"},$("rtk-tooltip",{key:"29ff7a39bd168169fa7d104357b529a2c9efe0fd",variant:"secondary",label:this.t("cancel"),delay:2e3},$("rtk-button",{key:"27cf5353d0e8c2620fd8d4213994a9dcc83f83f3",kind:"icon",variant:"secondary",onClick:()=>this.handleEditCancel(),title:this.t("cancel")},$("rtk-icon",{key:"aeb4c9df3993c6cebf952f64f6676eb8a3866bb0",icon:this.iconPack.dismiss}))),$("rtk-tooltip",{key:"835195d0f51a1db81e66a1b2d9076a71f2aaee4e",variant:"primary",label:this.t("chat.update_msg"),delay:2e3},$("rtk-button",{key:"d524f01ba5d7ca52224d39e23e7f963972ad80c9",kind:"icon",onClick:()=>this.handleEditMessage(),title:this.t("chat.send_msg")},this.isSending?$("rtk-spinner",{size:"sm"}):$("rtk-icon",{icon:this.iconPack.checkmark}))))))))}};gxt([ge()],jne.prototype,"iconPack",void 0);gxt([ge()],jne.prototype,"t",void 0);jne.style=GFn;const WFn=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{display:flex;width:100%;flex-direction:column;gap:var(--rtk-space-2, 8px);font-size:14px;z-index:10;margin-bottom:var(--rtk-space-2, 8px);box-sizing:border-box;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.chat-header{position:relative;margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);gap:var(--rtk-space-2, 8px);padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px);padding-top:var(--rtk-space-3, 12px);padding-bottom:var(--rtk-space-3, 12px);display:flex;flex-direction:row;align-items:center;justify-content:space-between;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));border-radius:var(--rtk-border-radius-sm, 4px);overflow:hidden;border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));cursor:pointer}.chat-header-label{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:var(--rtk-space-2, 8px)}`,qFn=WFn,vxt=class{constructor(t){kt(this,t),this.onPinnedToggle=async e=>{var n,r,s;!((n=e.detail)===null||n===void 0)&&n.open&&await((s=(r=this.$chatSelector)===null||r===void 0?void 0:r.close)===null||s===void 0?void 0:s.call(r))},this.onChatToggle=async e=>{var n,r,s;!((n=e.detail)===null||n===void 0)&&n.open&&await((s=(r=this.$pinnedSelector)===null||r===void 0?void 0:r.close)===null||s===void 0?void 0:s.call(r))}}render(){return $(mt,{key:"3cec93546dc5c7eec01df7b1b1a3847a6f004f0d"},$("rtk-pinned-message-selector",{key:"f099b29e1fb773bfb2931bec2358dd15819778ce",ref:t=>this.$pinnedSelector=t,onRtkDropdownToggle:this.onPinnedToggle}),$("rtk-chat-selector",{key:"0d33e69cf161381dc7598de279147ec9035ef8d7",ref:t=>this.$chatSelector=t,onRtkDropdownToggle:this.onChatToggle}))}};vxt.style=qFn;const KFn=":host{display:flex;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));flex:1 0 0px}",YFn=KFn;var DNe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const B7=class{constructor(t){kt(this,t),this.editMessageInit=Wt(this,"editMessageInit",7),this.onPinMessage=Wt(this,"pinMessage",7),this.onEditMessage=Wt(this,"editMessage",7),this.onDeleteMessage=Wt(this,"deleteMessage",7),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.iconPack=Nt,this.t=It(),this.permissionsChanged=!1,this.pageSize=25,this.permissionsUpdateListener=()=>{this.permissionsChanged=!this.permissionsChanged},this.getChatMessages=async(e,n,r)=>{if(this.privateChatRecipient)try{return await this.meeting.chat.fetchPrivateMessages({timestamp:e,limit:n,direction:r?"before":"after",userId:this.privateChatRecipient.userId})}catch{return[]}try{return await this.meeting.chat.fetchPublicMessages({timestamp:e,limit:n,direction:r?"before":"after"})}catch{return[]}},this.createChatNodes=e=>e.map((n,r)=>{var s,i;const o=n.userId===((s=e[r-1])===null||s===void 0?void 0:s.userId);if(!(!this.privateChatRecipient&&((i=n.targetUserIds)===null||i===void 0?void 0:i.length)>0))return this.createChatNode(n,o)}),this.disconnectMeeting=e=>{var n,r;(n=e==null?void 0:e.chat)===null||n===void 0||n.removeListener("chatUpdate",this.chatUpdateListener),(r=this.meeting)===null||r===void 0||r.self.permissions.removeListener("permissionsUpdate",this.permissionsUpdateListener)},this.getMessageActions=e=>{var n;const r=[],s=e.userId===this.meeting.self.userId;return((n=e.targetUserIds)===null||n===void 0?void 0:n.length)>0||r.push({id:"pin_message",label:e.pinned?this.t("unpin"):this.t("pin"),icon:this.iconPack.pin}),s&&(r.push({id:"edit_message",label:this.t("chat.edit_msg"),icon:this.iconPack.edit}),r.push({id:"delete_message",label:this.t("chat.delete_msg"),icon:this.iconPack.delete})),r},this.onMessageActionHandler=(e,n)=>{switch(e){case"pin_message":this.onPinMessage.emit(n);break;case"edit_message":this.onEditMessage.emit(n);break;case"delete_message":this.onDeleteMessage.emit(n);break}},this.createChatNode=(e,n)=>{var r,s,i,o;let l;this.meeting.meta.viewType==="CHAT"?l=(r=this.meeting.participants.all.toArray().find(u=>u.userId===e.userId))===null||r===void 0?void 0:r.picture:this.meeting.self.userId===e.userId?l=this.meeting.self.picture:l=(i=(s=this.meeting.participants.joined.toArray().find(u=>u.userId===e.userId))===null||s===void 0?void 0:s.picture)!==null&&i!==void 0?i:(o=this.meeting.participants.waitlisted.toArray().find(u=>u.userId===e.userId))===null||o===void 0?void 0:o.picture;const c=e.userId===this.meeting.self.userId,d=c?"outgoing":"incoming";return $("div",null,$("div",{class:"message-wrapper",id:e.id},$("rtk-message-view",{messageType:e.type,pinned:e.pinned,isEdited:e.isEdited,time:e.time,actions:this.getMessageActions(e),authorName:e.displayName,isSelf:c,avatarUrl:l,hideAuthorName:n,viewType:d,variant:"bubble",onAction:u=>this.onMessageActionHandler(u.detail,e)},$("div",null,$("div",{class:"body"},e.type==="text"&&$("rtk-text-message-view",{text:e.message,isMarkdown:!0}),e.type==="file"&&$("rtk-file-message-view",{name:e.name,url:e.link,size:e.size}),e.type==="image"&&$("rtk-image-message-view",{url:e.link,onPreview:()=>{this.stateUpdate.emit({image:e})}}))))))},this.chatUpdateListener=e=>{var n,r,s;((n=e.message.targetUserIds)===null||n===void 0?void 0:n.length)>0&&!e.message.targetUserIds.includes((r=this.privateChatRecipient)===null||r===void 0?void 0:r.userId)||this.privateChatRecipient&&((s=e.message.targetUserIds)===null||s===void 0?void 0:s.length)===0||(e.action==="add"?this.$paginatedListRef.onNewNode(e.message):e.action==="delete"?this.$paginatedListRef.onNodeDelete(e.message.id):e.action==="edit"&&this.$paginatedListRef.onNodeUpdate(e.message.id,e.message))}}componentDidLoad(){const t=this.host.shadowRoot.querySelector("slot");t&&(this.children=t.assignedElements()[0])}connectedCallback(){this.meetingChanged(this.meeting)}async onPinnedMessageSelect(t){var e,n;const r=t.detail;r&&await((n=(e=this.$paginatedListRef)===null||e===void 0?void 0:e.reset)===null||n===void 0?void 0:n.call(e,r.timeMs+1))}disconnectedCallback(){this.disconnectMeeting(this.meeting)}privateChatRecipientChanged(){var t;(t=this.$paginatedListRef)===null||t===void 0||t.reset()}meetingChanged(t,e){var n;e!=null&&this.disconnectMeeting(e),!(t&&!t.chat)&&(t!=null&&((n=t.chat)===null||n===void 0||n.addListener("chatUpdate",this.chatUpdateListener),t.self.permissions.addListener("permissionsUpdate",this.permissionsUpdateListener)),this.permissionsUpdateListener())}render(){return $(mt,{key:"8862788879d34ba9474f6970251df29c4ac2064d"},$("rtk-paginated-list",{key:"cb0965c8bc5118408e943872b04d9fa7b6b9c970",ref:t=>this.$paginatedListRef=t,pageSize:this.pageSize,pagesAllowed:3,fetchData:this.getChatMessages,createNodes:this.createChatNodes,emptyListLabel:this.t("chat.empty_chat")},$("slot",{key:"7b1686d75404515a2bc018b9e40918612b826136"})))}get host(){return Pl(this)}static get watchers(){return{privateChatRecipient:["privateChatRecipientChanged"],meeting:["meetingChanged"]}}};DNe([ge()],B7.prototype,"meeting",void 0);DNe([ge()],B7.prototype,"iconPack",void 0);DNe([ge()],B7.prototype,"t",void 0);B7.style=YFn;const QFn=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{display:flex;width:100%;flex-direction:column;font-size:14px;position:relative;box-sizing:border-box;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.chat-header{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);gap:var(--rtk-space-2, 8px);padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px);padding-top:var(--rtk-space-3, 12px);padding-bottom:var(--rtk-space-3, 12px);display:flex;flex-direction:row;align-items:center;justify-content:space-between;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));cursor:pointer;border-radius:var(--rtk-border-radius-sm, 4px);border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60))}.chat-header-label{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:var(--rtk-space-2, 8px)}.dropdown{position:absolute;top:100%;z-index:10;padding:var(--rtk-space-0, 0px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));opacity:0;pointer-events:none;border-bottom-right-radius:var(--rtk-border-radius-sm, 4px);border-bottom-left-radius:var(--rtk-border-radius-sm, 4px);left:var(--rtk-space-2, 8px);right:var(--rtk-space-2, 8px);max-width:calc(100vw - var(--rtk-space-4, 16px));box-sizing:border-box}.dropdown.open{opacity:1;pointer-events:auto;border-width:1px;border-top-width:var(--rtk-border-width-none, 0);border-style:solid;--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-border-opacity))}.dropdown rtk-paginated-list{box-sizing:border-box;display:flex;height:30vh;flex-direction:column}.public-chat-group-label{display:flex;cursor:pointer;flex-direction:row;align-items:center;justify-content:flex-start;gap:var(--rtk-space-2, 8px);border-left-width:var(--rtk-border-width-none, 0);border-right-width:var(--rtk-border-width-none, 0);border-top-width:var(--rtk-border-width-none, 0);border-bottom-width:var(--rtk-border-width-none, 0);border-bottom-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-border-opacity));padding-top:var(--rtk-space-4, 16px);padding-bottom:var(--rtk-space-4, 16px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px)}.public-chat-icon{display:flex;align-items:center;justify-content:center;padding:var(--rtk-space-1, 4px);border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity))}.public-chat-icon rtk-icon{color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}`,ZFn=QFn;var OI=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const jS=class{constructor(t){kt(this,t),this.dropdownToggle=Wt(this,"rtkDropdownToggle",7),this.chatSelectorChange=Wt(this,"rtkChatSelectorChange",7),this.config=Os(),this.iconPack=Nt,this.t=It(),this.overrides=Nx,this.isOpen=!1,this.showPrivateChat=!1,this.selectedUser=void 0,this.pageSize=1e5,this.pagesAllowed=3,this.unreadMap=new Map,this.disconnectMeeting=e=>{var n,r,s,i;const{self:o,participants:l}=e||{};(n=e.chat)===null||n===void 0||n.off("chatUpdate",this.chatUpdateListener),(r=o==null?void 0:o.permissions)===null||r===void 0||r.off("*",this.chatPermissionUpdateListener),(s=l==null?void 0:l.joined)===null||s===void 0||s.off("participantJoined",this.participantJoinedListener),(i=l==null?void 0:l.joined)===null||i===void 0||i.off("participantLeft",this.participantLeftListener)},this.toggle=e=>{e.preventDefault(),e.stopPropagation(),this.isOpen=!this.isOpen,this.dropdownToggle.emit({open:this.isOpen})},this.selectUser=async e=>{e!=null&&e.userId&&(this.unreadMap.set(e.userId,!1),this.$paginatedListRef.rerenderList()),this.selectedUser=e,this.chatSelectorChange.emit({selectedUser:e}),await this.close()},this.chatPermissionUpdateListener=()=>{var e,n;this.showPrivateChat=!!(!((e=this.meeting.self.permissions.chatPrivate)===null||e===void 0)&&e.canSend||!((n=this.meeting.self.permissions.chatPrivate)===null||n===void 0)&&n.canReceive),this.showPrivateChat||(this.selectedUser=void 0,this.chatSelectorChange.emit({selectedUser:void 0}))},this.onParticipantUpdate=()=>{var e,n,r,s;if(!this.selectedUser)return;(((s=(r=(n=(e=this.meeting)===null||e===void 0?void 0:e.participants)===null||n===void 0?void 0:n.joined)===null||r===void 0?void 0:r.toArray)===null||s===void 0?void 0:s.call(r))||[]).some(o=>{var l;return o.id===((l=this.selectedUser)===null||l===void 0?void 0:l.id)})||(this.selectedUser=void 0,this.chatSelectorChange.emit({selectedUser:void 0}))},this.participantJoinedListener=e=>{this.$paginatedListRef.onNewNode(e)},this.participantLeftListener=e=>{this.$paginatedListRef.onNodeDelete(e.id),this.onParticipantUpdate()},this.getParticipants=async(e,n,r)=>{const s=this.meeting;return s?e?s.participants.joined.toArray():[]:[]},this.createPaticipantNodes=e=>e.map(n=>{var r;return $("div",{class:"private-chat-label",id:n.id,onClick:()=>this.selectUser(n)},$("rtk-avatar",{size:"sm",participant:n}),$("span",null,(r=n.name)!==null&&r!==void 0?r:this.t("participant")),this.unreadMap.get(n.userId)?$("div",{class:"private-chat-unread-badge"}):null)}),this.chatUpdateListener=e=>{var n;if(e.action!=="add"||!(!((n=e.message.targetUserIds)===null||n===void 0)&&n.length))return;const r=this.meeting.self.userId,s=e.message.targetUserIds.find(i=>i!==r);s&&(this.unreadMap.set(s,!0),this.$paginatedListRef.rerenderList())}}async close(){this.isOpen&&(this.isOpen=!1,this.dropdownToggle.emit({open:!1}))}connectedCallback(){this.meetingChanged(this.meeting),this.overridesChanged(this.overrides)}disconnectedCallback(){var t,e,n;if(!this.meeting)return;const{self:r,participants:s}=this.meeting;(t=r==null?void 0:r.permissions)===null||t===void 0||t.off("*",this.chatPermissionUpdateListener),(e=s==null?void 0:s.joined)===null||e===void 0||e.off("participantJoined",this.participantJoinedListener),(n=s==null?void 0:s.joined)===null||n===void 0||n.off("participantLeft",this.participantLeftListener)}overridesChanged(t){var e,n;!this.meeting||this.meeting.self||(this.showPrivateChat=!!(!((e=this.meeting.self.permissions.chatPrivate)===null||e===void 0)&&e.canSend||!((n=this.meeting.self.permissions.chatPrivate)===null||n===void 0)&&n.canReceive)&&!t.disablePrivateChat)}meetingChanged(t,e){var n,r,s,i,o,l,c;e&&this.disconnectMeeting(e),!(!t||!t.chat)&&(this.showPrivateChat=!!(!((n=t.self.permissions.chatPrivate)===null||n===void 0)&&n.canSend||!((r=t.self.permissions.chatPrivate)===null||r===void 0)&&r.canReceive)&&!this.overrides.disablePrivateChat,this.onParticipantUpdate(),(s=t.chat)===null||s===void 0||s.on("chatUpdate",this.chatUpdateListener),t.self.permissions.on("*",this.chatPermissionUpdateListener),(o=(i=t==null?void 0:t.participants)===null||i===void 0?void 0:i.joined)===null||o===void 0||o.on("participantJoined",this.participantJoinedListener),(c=(l=t==null?void 0:t.participants)===null||l===void 0?void 0:l.joined)===null||c===void 0||c.on("participantLeft",this.participantLeftListener))}render(){return this.showPrivateChat?$(mt,null,$("div",{class:"chat-header",onClick:this.toggle},$("div",{class:"chat-header-label"},this.selectedUser?$("rtk-icon",{icon:this.iconPack.people,size:"sm"}):$("rtk-icon",{icon:this.iconPack.participants,size:"sm"}),this.selectedUser?this.selectedUser.name:this.t("chat.everyone")),$("div",{class:"chevron"},$("rtk-icon",{icon:this.isOpen?this.iconPack.chevron_up:this.iconPack.chevron_down,size:"sm"}))),$("div",{class:{dropdown:!0,open:this.isOpen,scrollbar:!0}},$("div",{class:"public-chat-group-label",onClick:()=>this.selectUser(void 0)},$("div",{class:"public-chat-icon"},$("rtk-icon",{icon:this.iconPack.participants,size:"sm"})),this.t("chat.everyone")),$("rtk-paginated-list",{class:"chat-selector-paginated-list",ref:t=>this.$paginatedListRef=t,pageSize:this.pageSize,pagesAllowed:3,fetchData:this.getParticipants,createNodes:this.createPaticipantNodes,emptyListLabel:this.t("participants.empty_list")},$("slot",null)))):null}static get watchers(){return{overrides:["overridesChanged"],meeting:["meetingChanged"]}}};OI([ge()],jS.prototype,"meeting",void 0);OI([ge()],jS.prototype,"states",void 0);OI([ge()],jS.prototype,"config",void 0);OI([ge()],jS.prototype,"iconPack",void 0);OI([ge()],jS.prototype,"t",void 0);OI([ge()],jS.prototype,"overrides",void 0);jS.style=ZFn;const JFn=":host{display:flex;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));border-top-left-radius:var(--rtk-border-radius-md, 8px);border-top-right-radius:var(--rtk-border-radius-md, 8px)}.preview-overlay{position:absolute;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);background-color:inherit}.preview{position:absolute;top:var(--rtk-space-4, 16px);left:var(--rtk-space-4, 16px);max-width:-moz-fit-content;max-width:fit-content;max-height:var(--rtk-space-20, 80px)}.preview:hover rtk-tooltip{display:block}.preview rtk-tooltip{position:absolute;top:calc(var(--rtk-space-1, 4px) * -1);left:calc(var(--rtk-space-1, 4px) * -1);display:none;margin-left:calc(var(--rtk-space-1, 4px) * -1);margin-top:calc(var(--rtk-space-1, 4px) * -1)}.preview rtk-button{display:flex;height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));border:1px solid rgb(var(--rtk-colors-text-1000, 255 255 255))}.preview rtk-icon{height:var(--rtk-space-3, 12px);width:var(--rtk-space-3, 12px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.preview-image{height:var(--rtk-space-16, 64px);width:var(--rtk-space-16, 64px);-o-object-fit:cover;object-fit:cover;max-height:100%;max-width:100%;overflow:clip;border-radius:var(--rtk-border-radius-md, 8px)}.preview-file{padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:var(--rtk-border-radius-md, 8px);max-width:200px}",XFn=JFn;var yxt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const Ene=class{constructor(t){kt(this,t),this.onDeleteAttachment=Wt(this,"deleteAttachment",7),this.iconPack=Nt,this.t=It(),this.attachment=null,this.filePreview=null,this.fileReader=new FileReader,this.generatePreview=()=>{this.attachment.type==="image"?this.fileReader.readAsDataURL(this.attachment.file):this.attachment.type==="file"&&(this.filePreview=this.attachment.file.name)},this.onDeleteClickHandler=()=>{this.filePreview=null,this.onDeleteAttachment.emit()}}onAttachmentChange(){this.generatePreview()}connectedCallback(){this.fileReader.onload=t=>{typeof t.target.result=="string"&&(this.filePreview=t.target.result)}}componentWillLoad(){this.onAttachmentChange()}render(){return $(mt,{key:"4bdc44453552e63a40d31d851a752009d4df74d1"},$("div",{key:"c3024512c383063e7b7be4c3006c726ce9641670",class:"preview-overlay"},$("div",{key:"a14d0cd7148029828baea3fc9261c7b8f70f5bfc",class:"preview"},$("rtk-tooltip",{key:"600f07d41fcf00b156120268fdbdff165ae9c040",label:this.t("chat.cancel_upload")},$("rtk-button",{key:"99059cb78c5451758fe859bb002a05ab3827f718",variant:"secondary",kind:"icon",onClick:this.onDeleteClickHandler},$("rtk-icon",{key:"422f06eb7d08f0708e9c46dc64eb329708a9307a",icon:this.iconPack.dismiss}))),this.attachment.type==="image"?$("img",{class:"preview-image",src:this.filePreview}):$("div",{class:"preview-file"},$("span",null,this.filePreview)))))}static get watchers(){return{attachment:["onAttachmentChange"]}}};yxt([ge()],Ene.prototype,"iconPack",void 0);yxt([ge()],Ene.prototype,"t",void 0);Ene.style=XFn;const e8n="https://rtk-assets.realtime.cloudflare.com/assets/emojis-data.json";let Mce;const t8n=async()=>(Mce||(Mce=(await fetch(e8n)).json()),Mce),n8n=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{width:100%}.emoji-parent{box-sizing:border-box;display:inline-flex;height:var(--rtk-space-64, 256px);width:100%;max-width:640px;flex-direction:column;padding:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-0, 0px);-webkit-user-select:none;-moz-user-select:none;user-select:none;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.close-parent{display:flex;flex:1 1 0%;justify-content:flex-end;padding:var(--rtk-space-0, 0px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}#emoji-grid{margin-top:var(--rtk-space-2, 8px);box-sizing:border-box;display:flex;flex-direction:row;flex-wrap:wrap;align-content:flex-start;overflow-x:hidden;overflow-y:scroll;height:100%;grid-auto-rows:minmax(min-content, max-content)}#loader{display:flex;height:100%;width:100%;align-items:center;justify-content:center}input{display:block;height:var(--rtk-space-8, 32px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);font-size:14px;border-width:var(--rtk-border-width-none, 0);border-style:solid;border-style:none;border-color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}input::-moz-placeholder{color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}input::placeholder{color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}input{border-radius:var(--rtk-border-radius-sm, 4px);outline:2px solid transparent;outline-offset:2px;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60))}input:focus{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-border-opacity));--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(4px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);--tw-ring-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-ring-opacity));--tw-ring-opacity:0.3}.emoji{height:var(--rtk-space-10, 40px);width:var(--rtk-space-10, 40px);font-size:20px;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}`,r8n=n8n;var bxt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const Nne=class{constructor(t){kt(this,t),this.pickerClose=Wt(this,"pickerClose",7),this.emojiClicked=Wt(this,"rtkEmojiClicked",7),this.iconPack=Nt,this.t=It(),this.focusWhenOpened=!0,this.filterVal="",this.filteredEmojis=[]}componentWillLoad(){t8n().then(t=>{this.emojiList=t,this.handleInputChange(this.inputElement)})}componentDidLoad(){this.focusWhenOpened&&this.inputElement.focus()}handleInputChange(t){this.filterVal=t.value;const e=new RegExp(`([^,]*?${this.filterVal}[^,]*):(\\d+)`,"g");this.filteredEmojis=Array.from(this.emojiList.search.matchAll(e)).map(n=>({name:n[1],emoji:this.emojiList.emojis[n[2]]}))}handleEmojiClick(t){this.emojiClicked.emit(t)}mapEmojiList(){var t;return((t=this.emojiList)===null||t===void 0?void 0:t.length)>0?$("div",{id:"loader"},$("rtk-spinner",{iconPack:this.iconPack})):$("div",{id:"emoji-grid",class:"scrollbar max-w-40"},this.filteredEmojis.map(e=>$("rtk-button",{key:`emoji-button-${e.name}`,class:"emoji",variant:"ghost",kind:"icon",title:e.name,onClick:()=>this.handleEmojiClick(e.emoji)},e.emoji)))}render(){return $(mt,{key:"e2b74cd93028974812eeba320368eb7d645b8e6d"},$("div",{key:"4656f9afbcde1e6a952a5eb7229649e3d9f7bf8a",class:"close-parent"},$("rtk-button",{key:"03759c6ee2b3b8bedcf965d340425bf9b7a9f370",variant:"ghost",kind:"icon",class:"close",onClick:()=>{var t;return(t=this.pickerClose)===null||t===void 0?void 0:t.emit()},"aria-label":this.t("close")},$("rtk-icon",{key:"b5b746e6c18e2a67a57f550f35bb32ea4de37cb9",icon:this.iconPack.dismiss}))),$("div",{key:"73235fd8e554ece4539e4d2fc9b086c32e43bd47",class:"emoji-parent"},$("input",{key:"315f45bcc6560f61d7c8448fee7d2e36ca04784d",value:this.filterVal,onInput:t=>this.handleInputChange(t.target),placeholder:this.t("search"),ref:t=>this.inputElement=t}),this.mapEmojiList()))}};bxt([ge()],Nne.prototype,"iconPack",void 0);bxt([ge()],Nne.prototype,"t",void 0);Nne.style=r8n;const s8n=":host{}",i8n=s8n;var xxt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const Tne=class{constructor(t){kt(this,t),this.iconPack=Nt,this.t=It()}render(){return $("rtk-tooltip",{key:"aef7b8c5bfdd8888a7fcca9ba9ba2df7ca801da4",label:this.t("chat.send_emoji")},$("rtk-button",{key:"e7b23bcd81515fe0cae3916b4de7565547472171",variant:"ghost",kind:"icon",class:{active:this.isActive},title:this.t("chat.send_emoji")},$("rtk-icon",{key:"af7e05bb06b9fe01b47e8f11f09a957e37187f63",icon:this.iconPack.emoji_multiple})))}};xxt([ge()],Tne.prototype,"iconPack",void 0);xxt([ge()],Tne.prototype,"t",void 0);Tne.style=i8n;const a8n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.file{display:flex;align-items:center;gap:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);min-width:var(--rtk-space-40, 160px);max-width:var(--rtk-space-64, 256px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.file .file-data{margin-left:var(--rtk-space-1, 4px);flex:1 1 0%}.file .file-data .name{word-break:break-all;color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.file .file-data .file-data-split{margin-top:var(--rtk-space-0\\.5, 2px);display:flex;align-items:center;font-size:12px}.file .file-data .file-data-split .ext{margin-right:var(--rtk-space-2, 8px);text-transform:uppercase;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.file .file-data .file-data-split .divider{height:var(--rtk-space-4, 16px);width:var(--rtk-space-0\\.5, 2px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.file .file-data .file-data-split .size{margin-left:var(--rtk-space-2, 8px)}",o8n=a8n;var l8n=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const $Ne=class{constructor(t){kt(this,t),this.iconPack=Nt}render(){return $("div",{key:"10de68cdb7ebb9bc5579f1d26ac20b00909f5236",class:"file"},$("rtk-button",{key:"ba255f55de300a1d9cbc4ccf3fb5ec3f93670d50",variant:"secondary",kind:"icon",onClick:()=>$7(D7(this.url),{name:this.name,fallbackName:"file"}),part:"button"},$("rtk-icon",{key:"2ff668ad0b4b48f0cb05acc9f62727bf4cb9bbd5",icon:this.iconPack.download})),$("div",{key:"4b77a03fc4896994430c1bf814767622e5c21cf4",class:"file-data"},$("div",{key:"df4dfdf5d2cffb47cc635c8bc410e5bd3f478570",class:"name"},this.name),$("div",{key:"6bafabd74cc4d6fe0585874542f183519c6e1000",class:"file-data-split"},$("div",{key:"5ba6f3fcc10a2d8e580e584597c946c650e6d58c",class:"ext"},Fbt(this.name)),$("span",{key:"682887e1f3ebaf33c48704f7443bb1de3c3c5201",class:"divider"}),$("div",{key:"fc2c82f17558a794a2192c9e4a23d9888a176b6e",class:"size"},Bbt(this.size)))))}};l8n([ge()],$Ne.prototype,"iconPack",void 0);$Ne.style=o8n;const c8n=":host{}",d8n=c8n;var wxt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const _ne=class{constructor(t){kt(this,t),this.onFileChange=Wt(this,"fileChange",7),this.icon="attach",this.iconPack=Nt,this.t=It(),this.uploadFile=()=>{const e=this.fileInputField;e.type="file",this.filter&&(e.accept=this.filter),e.onchange=n=>{const{validity:r,files:[s]}=n.target;r.valid&&this.onFileChange.emit(s)},e.click()}}connectedCallback(){this.fileInputField=document.createElement("input")}disconnectedCallback(){this.fileInputField=void 0}render(){const t=this.label||this.t("chat.send_file"),e=this.iconPack[this.icon];return $("rtk-tooltip",{key:"329c452b2de6664978946000c6264e823c87830d",label:t},$("rtk-button",{key:"7b6a275ab946ad2aa751c8e36a6c9701f5fa0dab",variant:"ghost",kind:"icon",onClick:()=>this.uploadFile(),title:t},$("rtk-icon",{key:"d3306859b107d0988c24f098db21467787b03afc",icon:e})))}};wxt([ge()],_ne.prototype,"iconPack",void 0);wxt([ge()],_ne.prototype,"t",void 0);_ne.style=d8n;const u8n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block;height:var(--rtk-space-10, 40px);outline:2px solid transparent;outline-offset:2px}:host .icon-wrapper{display:flex;height:100%;width:100%;flex-direction:column;align-items:center}:host svg{height:100%;width:100%;outline:2px solid transparent;outline-offset:2px}:host([size='xl']){box-sizing:border-box;display:block;height:var(--rtk-space-16, 64px) !important;width:var(--rtk-space-16, 64px) !important;--rtk-spinner-color:currentColor}:host([size='md']){box-sizing:border-box;display:block;height:var(--rtk-space-6, 24px) !important;width:var(--rtk-space-6, 24px) !important;--rtk-spinner-color:currentColor}:host([size='sm']){box-sizing:border-box;display:block;height:var(--rtk-space-4, 16px) !important;width:var(--rtk-space-4, 16px) !important;--rtk-spinner-color:currentColor}:host([variant='secondary']) .icon-wrapper{--tw-text-opacity:1;color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-text-opacity))}:host([variant='danger']) .icon-wrapper{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}",h8n=u8n,m8n=t=>{try{return JSON.parse(t)}catch{return t}},kxt=class{constructor(t){kt(this,t),this.variant="primary",this.size="lg"}render(){return $(mt,{key:"fdbe6fd9647bae7cfdf02ba6a250aa3c0c39ad85"},$("div",{key:"114baca2f9ce9376e69073b40170473cc359915f",class:"icon-wrapper",innerHTML:m8n(this.icon),part:"wrapper"}))}};kxt.style=h8n;const f8n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.image-spinner{cursor:wait}.image-errored{cursor:not-allowed}.image{display:block;font-family:var(--rtk-font-family, sans-serif);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));position:relative;height:var(--rtk-space-40, 160px);max-width:var(--rtk-space-64, 256px);cursor:pointer}.image img{display:none;height:100%;width:100%;border-radius:var(--rtk-border-radius-sm, 4px);-o-object-fit:cover;object-fit:cover}.image .image-spinner{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.image .image-spinner rtk-spinner{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}.image .image-errored{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);background-color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.1);--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}.image .actions{display:none;height:var(--rtk-space-8, 32px);align-items:center;position:absolute;top:var(--rtk-space-2, 8px);right:var(--rtk-space-2, 8px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;--tw-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.image .actions .action{height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);border-radius:var(--rtk-border-radius-none, 0);border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.image .actions .action:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.image.loaded img{display:block}.image.loaded .image-spinner{display:none}.image:hover .actions,.image:focus .actions{display:flex}",p8n=f8n;var Sxt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const Ane=class{constructor(t){kt(this,t),this.onPreview=Wt(this,"preview",7),this.iconPack=Nt,this.t=It(),this.status="loading"}render(){return $("div",{key:"4f52d3d7ff948d02832cf5f53ae9b483c8502b84",class:{image:!0,loaded:this.status==="loaded"}},$("img",{key:"06efe7798b2d59ee6b3acde68418763c89fc285f",src:D7(this.url),onLoad:()=>{this.status="loaded"},onError:()=>{this.status="errored"},onClick:()=>{this.status==="loaded"&&this.onPreview.emit(this.url)}}),this.status==="loading"&&$("div",{key:"366f02c0b48cf06e527cc0b3c42ef1ac5ff0ac36",class:"image-spinner",title:this.t("chat.img.loading"),"aria-label":this.t("chat.img.loading")},$("rtk-spinner",{key:"90cd7d607487b8016ab838a31bcee39aacec0ba2",iconPack:this.iconPack})),this.status==="errored"&&$("div",{key:"d7b1fe803153799855aa8220af81f6b973b9117d",class:"image-errored",title:this.t("chat.error.img_not_found"),"aria-label":this.t("chat.error.img_not_found")},$("rtk-icon",{key:"83060f609b0df333aa91d3b21a4634d943d2352f",icon:this.iconPack.image_off})),this.status==="loaded"&&$("div",{key:"1db7dc269511f477c60faa681fb39cfa09a517ab",class:"actions"},$("rtk-button",{key:"a45138b3cfeeae245d28d3493396e5c5ea102b49",class:"action",variant:"secondary",kind:"icon",onClick:()=>{this.onPreview.emit(this.url)}},$("rtk-icon",{key:"b44a303fa4ed28a2a39ef372dfa5b58908698a2c",icon:this.iconPack.full_screen_maximize})),$("rtk-button",{key:"0e687d5c92264a8d2fa28e1921ccbd4797bfd2e3",class:"action",variant:"secondary",kind:"icon",onClick:()=>$7(this.url,{fallbackName:"image"})},$("rtk-icon",{key:"1f2d01d576a2faa7483ada2e82f5cbf4cb8534b5",icon:this.iconPack.download}))))}};Sxt([ge()],Ane.prototype,"iconPack",void 0);Sxt([ge()],Ane.prototype,"t",void 0);Ane.style=p8n;const g8n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{overflow-wrap:break-word}a{color:currentColor}.block-quote,blockquote{margin:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-3, 12px);--tw-border-spacing-x:1px;--tw-border-spacing-y:1px;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y);border-top-width:var(--rtk-border-width-none, 0);border-bottom-width:var(--rtk-border-width-none, 0);border-left-width:var(--rtk-border-width-md, 2px);border-right-width:var(--rtk-border-width-none, 0);border-style:solid;padding:var(--rtk-space-0\\.5, 2px);padding-left:var(--rtk-space-2, 8px);border-radius:var(--rtk-border-radius-sm, 4px);border-top-left-radius:var(--rtk-border-radius-none, 0);border-bottom-left-radius:var(--rtk-border-radius-none, 0)}pre{white-space:pre-wrap;width:300px;margin-right:var(--rtk-space-2, 8px)}.markdown-message{box-sizing:border-box}",v8n=g8n,Cxt=class{constructor(t){kt(this,t),this.maxLength=k6,this.restoreEmpty=(e,n,r)=>e.trim().length===0?`${n}${e}${n}`:r(e),this.renderLink=e=>$("a",{class:"link",href:e,target:"_blank",rel:"noopener noreferrer"},e),this.renderBold=e=>typeof e=="string"?this.restoreEmpty(e,"*",n=>$("b",null,n)):$("b",null,this.renderTokens(e)),this.renderItalic=e=>typeof e=="string"?this.restoreEmpty(e,"_",n=>$("i",null,n)):$("i",null,this.renderTokens(e)),this.renderStrikethrough=e=>typeof e=="string"?this.restoreEmpty(e,"~",n=>$("s",null,n)):$("b",null,this.renderTokens(e)),this.renderPlainText=e=>typeof e=="string"?e:$("p",null,this.renderTokens(e)),this.renderTokens=e=>e.map(n=>{switch(n.type){case"a":if(typeof n.content=="string")return this.renderLink(n.content);case"b":return this.renderBold(n.content);case"i":return this.renderItalic(n.content);case"s":return this.renderStrikethrough(n.content);case"q":return $("span",{class:"block-quote"});case"plain_text":default:return this.renderPlainText(n.content)}})}renderMessage(t){let e=t.split(`
`),n=!1;e[0]==="```"&&e[e.length-1]==="```"&&(n=!0,e=e.slice(1,-1));const r=e.map(s=>{const i=gbe(s);return $("p",null,this.renderTokens(i))});return n?$("pre",{style:{whiteSpace:"pre",overflow:"scroll"}},e.join(`
`)):r}render(){const t=this.text.slice(0,this.maxLength),e=ENe(t,!0),n=NNe(t);return $("p",{key:"ff1a72f01b0cf274f0135874dade41d08771b6af",class:"markdown-message"},e.length!==0&&$("blockquote",{key:"35f779d8e7aa8f4ea44f16b2d35094cb9740a3f5"},this.renderMessage(e)),n.length!==0&&this.renderMessage(n))}};Cxt.style=v8n;const y8n=768,b8n=1080,dBe={md:y8n,lg:b8n},x8n=t=>t>=dBe.lg?"lg":t>=dBe.md?"md":"sm",w8n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:flex;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));overflow:hidden;position:fixed;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);height:100%;width:100%}:host([mode='fill']){position:relative}",k8n=w8n,jxt=class{constructor(t){kt(this,t),this.statesUpdate=Wt(this,"rtkStatesUpdate",7),this.providerId="provider-"+Math.floor(Math.random()*100),this.roomJoinedListener=()=>{this.updateStates({meeting:"joined",joinError:void 0,joinErrorCode:void 0})},this.waitlistedListener=()=>{this.updateStates({meeting:"waiting"})},this.roomLeftListener=({state:e})=>{e==="disconnected"||e==="failed"||this.updateStates({meeting:"ended",roomLeftState:e})},this.mediaPermissionUpdateListener=({kind:e,message:n})=>{if(["audio","video"].includes(e)&&(n==="DENIED"||n==="SYSTEM_DENIED")&&(this.peerStore||gl).state.states.activeDebugger!==!0){const r={enabled:!0,kind:e};this.updateStates({activePermissionsMessage:r})}},this.socketConnectionUpdateListener=({state:e})=>{e==="failed"&&setTimeout(()=>{this.meeting.leave("disconnected")},this.leaveRoomTimer)},this.peerStore=null,this.loadConfigFromPreset=!1,this.applyDesignSystem=!1,this.mode="fixed",this.leaveOnUnmount=!1,this.t=It(),this.config=Os(),this.gridLayout="row",this.iconPack=Nt,this.overrides=Nx,this.handleChangingMeeting=e=>{const n=(this.peerStore||gl).state.states;this.updateStates({activeBreakoutRoomsManager:Object.assign(Object.assign({},n.activeBreakoutRoomsManager),{destinationMeetingId:e})})}}connectedCallback(){var t;typeof window<"u"&&(this.authErrorListener=e=>{e.detail.message.includes("401")&&this.updateStates({meeting:"ended",roomLeftState:"unauthorized"})},window.addEventListener("rtkError",this.authErrorListener)),this.leaveRoomTimer=1e4,this.loadConfigFromPreset=!0,this.applyDesignSystem=!0,this.setupStoreRequestListener(),this.setupStateUpdateListener(),this.meetingChanged(this.meeting),this.iconPackChanged(this.iconPack),this.tChanged(this.t),this.configChanged(this.config),this.overridesChanged(this.overrides),this.resizeObserver=new Zbt(()=>this.handleResize()),this.resizeObserver.observe(this.host),this.applyDesignSystem&&((t=this.config)===null||t===void 0?void 0:t.designTokens)!=null&&typeof document<"u"&&(this.peerStore||gl).state.states.activeDebugger!==!0&&FW(document.documentElement,this.config.designTokens)}disconnectedCallback(){var t;this.leaveOnUnmount&&((t=this.meeting)===null||t===void 0||t.leave()),this.resizeObserver.disconnect(),window.removeEventListener("rtkError",this.authErrorListener),this.storeRequestListener&&(this.host.removeEventListener("rtkRequestStore",this.storeRequestListener),this.storeRequestListener=null),this.stateUpdateListener&&(this.host.removeEventListener("rtkStateUpdate",this.stateUpdateListener),this.stateUpdateListener=null),this.meeting&&this.clearListeners(this.meeting)}setupStoreRequestListener(){this.storeRequestListener&&this.host.removeEventListener("rtkRequestStore",this.storeRequestListener),this.storeRequestListener=t=>{if(!this.peerStore)return;const e=this.peerStore,n=new CustomEvent("rtkProvideStore",{detail:{store:e,requestId:t.detail.requestId}});document.dispatchEvent(n),t.stopPropagation()},this.host.addEventListener("rtkRequestStore",this.storeRequestListener)}setupStateUpdateListener(){this.stateUpdateListener&&this.host.removeEventListener("rtkStateUpdate",this.stateUpdateListener),this.stateUpdateListener=t=>{const e=t.target;this.host.contains(e)&&this.updateStates(t.detail)},this.host.addEventListener("rtkStateUpdate",this.stateUpdateListener)}clearListeners(t){t&&(t.self.removeListener("roomLeft",this.roomLeftListener),t.self.removeListener("roomJoined",this.roomJoinedListener),t.self.removeListener("waitlisted",this.waitlistedListener),t.self.removeListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),t.meta.removeListener("socketConnectionUpdate",this.socketConnectionUpdateListener))}meetingChanged(t,e){var n,r;if(!t)return;t?(this.peerStore=Mbt({meeting:t,config:this.config,iconPack:this.iconPack,t:this.t,providerId:this.providerId,overrides:Zj(Object.assign({},Nx),this.overrides)}),document.dispatchEvent(new CustomEvent("rtkPeerStoreReady",{detail:{peerId:t.self.id}}))):this.peerStore=null;const s=this.peerStore||gl,i=e?!!s.state.states.activeCaptions:!!t.self.permissions.transcriptionEnabled;if(this.updateStates({viewType:t.meta.viewType,activeCaptions:i}),this.loadConfigFromPreset&&t.self.config!=null){const o=t.self.config,{config:l,data:c}=x6n(o,t);this.config=l,this.showSetupScreen==null&&(this.showSetupScreen=c.showSetupScreen),!((n=s.state.states.activeBreakoutRoomsManager)===null||n===void 0)&&n.destinationMeetingId&&(this.showSetupScreen=!1)}this.applyDesignSystem&&((r=this.config)===null||r===void 0?void 0:r.designTokens)!=null&&typeof document<"u"&&s.state.states.activeDebugger!==!0&&FW(document.documentElement,this.config.designTokens),t.self.addListener("roomJoined",this.roomJoinedListener),t.self.addListener("waitlisted",this.waitlistedListener),t.self.addListener("roomLeft",this.roomLeftListener),t.self.addListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),t.meta.addListener("socketConnectionUpdate",this.socketConnectionUpdateListener),t.connectedMeetings.once("changingMeeting",this.handleChangingMeeting),t.self.roomJoined?this.updateStates({meeting:"joined"}):this.showSetupScreen?this.updateStates({meeting:"setup"}):t.join().then(()=>{this.updateStates({joinError:void 0,joinErrorCode:void 0})}).catch(o=>{const{message:l,code:c}=Jbt(this.t,o);this.updateStates({joinError:l,joinErrorCode:c})}),window.removeEventListener("rtkError",this.authErrorListener)}iconPackChanged(t){this.peerStore&&(this.peerStore.state.iconPack=t)}tChanged(t){this.peerStore&&(this.peerStore.state.t=t)}configChanged(t){this.peerStore&&(this.peerStore.state.config=t),t!=null&&t.designTokens&&typeof document<"u"&&(this.peerStore||gl).state.states.activeDebugger!==!0&&FW(document.documentElement,t.designTokens)}overridesChanged(t){this.peerStore&&(this.peerStore.state.overrides=Zj(Object.assign({},Nx),t))}handleResize(){this.size=x8n(this.host.clientWidth)}updateStates(t){const e=this.peerStore||gl,n=Object.assign({},e.state.states);e.state.states=Zj(n,t),this.statesUpdate.emit(e.state.states);const r=new CustomEvent("rtkStatesUpdate",{detail:e.state.states,bubbles:!0,composed:!0});this.host.dispatchEvent(r)}render(){const t={meeting:this.meeting,size:this.size,states:(this.peerStore||gl).state.states,config:this.config||Os(),iconPack:this.iconPack,t:this.t};if((this.peerStore||gl).state.states.viewType==="CHAT")return $("rtk-chat",Object.assign({},t));const e={"rtk-grid":{layout:this.gridLayout}};return $(tc,{element:"rtk-meeting",defaults:t,asHost:!0,elementProps:e})}get host(){return Pl(this)}static get watchers(){return{meeting:["meetingChanged"],iconPack:["iconPackChanged"],t:["tChanged"],config:["configChanged"],overrides:["overridesChanged"]}}};jxt.style=k8n;const S8n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:inline-block;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}#menu-list{position:absolute;z-index:20;display:none}",C8n=S8n;var Ext=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const Pne=class{constructor(t){kt(this,t),this.clickedThis=!1,this.placement="bottom-end",this.offset=10,this.iconPack=Nt,this.t=It(),this.handleOutsideClick=()=>{this.clickedThis||(this.menuListEl.style.display="none"),this.clickedThis=!1}}componentDidLoad(){document.addEventListener("click",this.handleOutsideClick),this.update()}disconnectedCallback(){document.removeEventListener("click",this.handleOutsideClick)}update(){MNe(this.triggerEl,this.menuListEl,{placement:this.placement,middleware:[RNe(this.offset),hxt(),INe({padding:5})]}).then(({x:t,y:e})=>{Object.assign(this.menuListEl.style,{left:`${t}px`,top:`${e}px`})})}render(){return $(mt,{key:"c7cf93be6e90e8e8e09b1ff8ff717b328ab91660"},$("span",{key:"6b77e648ffbf038450bfdc36c45a50d7a73e6bb4",id:"trigger",ref:t=>this.triggerEl=t,onClick:()=>{this.clickedThis=!0,this.menuListEl.style.display!=="block"?(this.menuListEl.style.display="block",this.update()):this.menuListEl.style.display="none"}},$("slot",{key:"08c30f54a39dfc8c21a248e63c9879fcb93b4ad0",name:"trigger"})),$("span",{key:"7d824c0d9140fa47cf4a72463b5d795c86f026a4",part:"menu-list",id:"menu-list",ref:t=>this.menuListEl=t},$("slot",{key:"fc13149fe4447fada518248c30258d0e908d3030"})))}};Ext([ge()],Pne.prototype,"iconPack",void 0);Ext([ge()],Pne.prototype,"t",void 0);Pne.style=C8n;const j8n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;align-items:center;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px);cursor:pointer;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;color:rgb(var(--rtk-colors-text-1000, 255 255 255));font-size:14px}::slotted([slot='start']){margin-right:var(--rtk-space-2, 8px)}::slotted([slot='end']){margin-left:var(--rtk-space-2, 8px)}:host(:hover){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}:host(.primary:hover){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-400, 53 110 253) / var(--tw-bg-opacity))}:host(.red){--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}",E8n=j8n;var Nxt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const Rne=class{constructor(t){kt(this,t),this.menuVariant="secondary",this.iconPack=Nt,this.t=It()}render(){return $(mt,{key:"34effd6df180c6a3d5a356f481934c9312f62f83",class:{[this.menuVariant]:!0}},$("slot",{key:"c2313c150db2f804e9170bd8c93afdbc68d05bc8",name:"start"}),$("slot",{key:"5c8428b279af80a626fa300e4cafae55cc987170"}),$("slot",{key:"a5eab032080c4ca615fd1cd848c30675232e3043",name:"end"}))}};Nxt([ge()],Rne.prototype,"iconPack",void 0);Nxt([ge()],Rne.prototype,"t",void 0);Rne.style=E8n;const N8n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;width:-moz-max-content;width:max-content;flex-direction:column;padding:var(--rtk-space-0, 0px);color:rgb(var(--rtk-colors-text-1000, 255 255 255));border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));overflow:hidden;border-radius:var(--rtk-border-radius-sm, 4px);--tw-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);backdrop-filter:blur(60px)}:host(.primary){--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-600, 13 81 253) / var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-bg-opacity))}",T8n=N8n;var Txt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const Ine=class{constructor(t){kt(this,t),this.iconPack=Nt,this.menuVariant="secondary",this.t=It()}render(){return $(mt,{key:"083bcaabc43d7a19060a0922b1106514f5267d6e",class:{[this.menuVariant]:!0}},$("slot",{key:"d1ecbf870d71e99fc2b2345359e61d61c51dc039"}))}};Txt([ge()],Ine.prototype,"iconPack",void 0);Txt([ge()],Ine.prototype,"t",void 0);Ine.style=T8n;const _8n=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{max-width:var(--rtk-space-96, 384px)}.message-wrapper{display:flex;flex-direction:row-reverse;align-items:flex-start;gap:var(--rtk-space-2, 8px)}.message-wrapper.incoming{flex-direction:row}.message{display:flex;flex-direction:column;align-items:flex-end}.incoming .message{display:flex;flex-direction:column;align-items:flex-start}.header{margin-top:var(--rtk-space-1, 4px);margin-bottom:var(--rtk-space-1, 4px);align-self:flex-end;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));font-size:12px;font-weight:600}.incoming .header{align-self:flex-start}.body{display:flex;flex-direction:column;min-width:var(--rtk-space-24, 96px);font-family:var(--rtk-font-family, sans-serif);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));font-size:14px;line-height:1.375;position:relative}.bubble{max-width:90%;padding:var(--rtk-space-2, 8px);border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-600, 13 81 253) / var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));border-radius:var(--rtk-border-radius-md, 8px);line-height:1}.incoming .bubble{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}.metadata{margin-top:var(--rtk-space-1, 4px);display:flex;flex-direction:row;align-items:center;gap:var(--rtk-space-1, 4px);align-self:flex-end;font-size:11px;color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.incoming .metadata{margin-top:var(--rtk-space-1, 4px);display:flex;flex-direction:row;align-items:center;gap:var(--rtk-space-1, 4px);align-self:flex-end;font-size:11px;color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.metadata-content{display:flex;flex-direction:row;align-items:center;gap:var(--rtk-space-1, 4px)}.avatar{display:none}rtk-menu{position:absolute;right:var(--rtk-space-1, 4px);top:var(--rtk-space-1, 4px);border-radius:var(--rtk-border-radius-lg, 12px)}rtk-menu rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);cursor:pointer}.actions{display:flex;align-items:center;justify-content:center;border-width:1px;border-style:solid;--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-600, 13 81 253) / var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-bg-opacity));padding:var(--rtk-space-1, 4px);border-radius:var(--rtk-border-radius-md, 8px);border-width:var(--rtk-border-width-none, 0);border-style:none}.actions rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.incoming rtk-avatar{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}.incoming .actions{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}@media (min-width: 400px){.avatar{display:flex;width:var(--rtk-space-6, 24px)}.avatar rtk-avatar{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px);font-size:10px;overflow:clip;border-radius:9999px}}@media (hover: hover){rtk-menu{visibility:hidden}.body:hover rtk-menu{visibility:visible}}`,A8n=_8n;var P8n=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const ONe=class{constructor(t){kt(this,t),this.onAction=Wt(this,"action",7),this.actions=[],this.variant="bubble",this.pinned=!1,this.viewType="outgoing",this.hideAvatar=!1,this.isSelf=!1,this.hideAuthorName=!1,this.hideMetadata=!1,this.iconPack=Nt}renderActions(){return $("rtk-menu",{placement:this.isSelf?"bottom-start":"bottom-end",offset:1},$("button",{slot:"trigger",class:"actions"},$("rtk-icon",{icon:this.iconPack.chevron_down})),$("rtk-menu-list",{menuVariant:this.isSelf?"primary":"secondary"},this.actions.map(t=>{if(!(t.id==="edit_message"&&this.messageType!=="text"))return $("rtk-menu-item",{menuVariant:this.isSelf?"primary":"secondary",onClick:()=>this.onAction.emit(t.id)},t.icon&&$("rtk-icon",{icon:t.icon,slot:"start"}),t.label)})))}render(){return $(mt,{key:"3d53fc59bda6a82e4c4753e34f915c8f62611f6b"},$("div",{key:"1f9cbd79c9e5526645fafd0c4436b91c6c612f08",class:{"message-wrapper":!0,[this.viewType]:!0}},!this.hideAvatar&&$("aside",{key:"23071b4dff9dd4ecc1385be9a1610ffbab98a9e9",class:"avatar",part:"avatar"},$("rtk-avatar",{key:"9a4596ea3636188ef391e65f86d6a608b3aa02d5",participant:{name:this.authorName,picture:this.avatarUrl},size:"sm"})),$("div",{key:"eefe1bf5803e371266a0b8ee230dd2f42a193dc2",class:"message",part:"message"},!this.hideAuthorName&&$("div",{key:"45ba437f7a3ba2b253f22a1885d7e5be954a387e",class:"header"},this.authorName," ",this.isSelf?" (You)":""),$("div",{key:"e9636fb45358423d5cc4e8144b6b47cf065117cc",class:{body:!0,bubble:this.variant==="bubble"}},$("slot",{key:"1d6cd92eb8d4514b7ae4266fae8cd060a56ac1e3"}),!this.hideMetadata&&!!this.time&&$("div",{key:"77b29974a960e4b4809025305ce005aeab8edebc",class:"metadata",title:LNe(this.time)},this.pinned&&$("span",{key:"e6b99085f2cbcbc9505c20e5407a98c382306614",class:"metadata-content"},$("rtk-icon",{key:"45ad875ef38b1db0105c85659cf938cc9bd792d8",icon:this.iconPack.pin,size:"sm"})," •"),this.isEdited&&$("span",{key:"48d5ecd659fe2308d8c33e94a2216049a2bea5ef",class:"metadata-content"},$("span",{key:"9203ff6d3f65b81b875f5bc17231fd2c65c1c2c2"},"Edited")," •"),kne(this.time,new Date(Date.now()))),this.actions.length!==0&&this.renderActions()))))}};P8n([ge()],ONe.prototype,"iconPack",void 0);ONe.style=A8n;const R8n=`.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;display:flex;flex-direction:column;flex:1}:host(.chat-selector-paginated-list) .container{box-sizing:border-box;display:flex;flex-direction:column;padding:var(--rtk-space-2, 8px);flex:1 0 0px;overflow-y:scroll}:host(.chat-selector-paginated-list) .private-chat-label{display:flex;width:100%;cursor:pointer;flex-direction:row;align-items:center;justify-content:flex-start;gap:var(--rtk-space-2, 8px);padding-top:var(--rtk-space-3, 12px);padding-bottom:var(--rtk-space-3, 12px)}:host(.chat-selector-paginated-list) .private-chat-label rtk-avatar{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}:host(.chat-selector-paginated-list) .show-new-messages-ctr.active{display:none}.private-chat-unread-badge{height:var(--rtk-space-2, 8px);width:var(--rtk-space-2, 8px);border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity))}:host(.pinned-message-selector-paginated-list) .container{box-sizing:border-box;display:flex;flex-direction:column-reverse;padding:var(--rtk-space-2, 8px);flex:1 0 0px;overflow-y:scroll}:host(.pinned-message-selector-paginated-list) .page{position:relative;box-sizing:border-box}:host(.pinned-message-selector-paginated-list) .pinned-message{box-sizing:border-box;display:flex;width:100%;cursor:pointer;flex-direction:row;overflow:hidden;border-radius:var(--rtk-border-radius-sm, 4px)}:host(.pinned-message-selector-paginated-list) .pinned-message:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}:host(.pinned-message-selector-paginated-list) .pinned-message-container{display:flex;width:100%;flex-direction:row;align-items:flex-start;padding:var(--rtk-space-2, 8px)}:host(.pinned-message-selector-paginated-list) .pinned-message-content{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);display:flex;min-width:var(--rtk-space-0, 0px);flex:1 1 0%;flex-direction:column}:host(.pinned-message-selector-paginated-list) .pinned-message-time{font-size:12px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}:host(.pinned-message-selector-paginated-list) .pinned-message-preview{margin-bottom:var(--rtk-space-2, 8px);word-break:break-all;color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}:host(.pinned-message-selector-paginated-list) rtk-avatar{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}.container{box-sizing:border-box;display:flex;flex-direction:column-reverse;padding-top:var(--rtk-space-4, 16px);padding-bottom:var(--rtk-space-4, 16px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);flex:1 0 0px;overflow-y:scroll}.file-picker{display:none}.chat *:first-child{margin-top:var(--rtk-space-0, 0px)}.chat .head{display:flex;align-items:center}.chat .head .name{margin-right:var(--rtk-space-4, 16px);font-size:12px;font-weight:700}.chat .head .time{font-size:12px;color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.chat .body{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);overflow-wrap:break-word;font-size:14px;line-height:1.375}.chat .body .emoji{font-size:24px}p{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-3, 12px)}rtk-text-message,rtk-image-message,rtk-file-message{margin-top:var(--rtk-space-4, 16px);display:block;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);font-family:var(--rtk-font-family, sans-serif);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));box-sizing:border-box}*[is-continued]{margin-top:var(--rtk-space-3, 12px)}rtk-text-message[is-continued]{margin-top:var(--rtk-space-2, 8px)}.chat .image{position:relative;height:var(--rtk-space-40, 160px);max-width:var(--rtk-space-64, 256px);cursor:pointer}.chat .image img{display:none;height:100%;width:100%;border-radius:var(--rtk-border-radius-sm, 4px);-o-object-fit:cover;object-fit:cover}.chat .image .image-spinner{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.chat .image .image-spinner rtk-spinner{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}.chat .image .image-errored{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);background-color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.1);--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}.chat .image .actions{display:none;height:var(--rtk-space-8, 32px);align-items:center;position:absolute;top:var(--rtk-space-2, 8px);right:var(--rtk-space-2, 8px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;--tw-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.chat .image .actions .action{height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);border-radius:var(--rtk-border-radius-none, 0);border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.chat .image .actions .action:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.image.loaded img{display:block}.image.loaded .image-spinner{display:none}.image:hover .actions,.image:focus .actions{display:flex}.chat .file{display:flex;align-items:center;gap:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);padding-top:var(--rtk-space-1\\.5, 6px);padding-bottom:var(--rtk-space-1\\.5, 6px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.chat .file .file-data{flex:1 1 0%}.chat .file .file-data .name{word-break:break-all;color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.chat .file .file-data .file-data-split{margin-top:var(--rtk-space-0\\.5, 2px);display:flex;align-items:center;font-size:12px}.chat .file .file-data .file-data-split .ext{margin-right:var(--rtk-space-2, 8px);text-transform:uppercase;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.chat .file .file-data .file-data-split .divider{height:var(--rtk-space-4, 16px);width:var(--rtk-space-0\\.5, 2px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.chat .file .file-data .file-data-split .size{margin-left:var(--rtk-space-2, 8px)}.smallest-dom-element{width:1px}#top-scroll{transform:translateY(20vh);transform:translateY(20px)}a{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity));text-decoration-line:none}a:hover{text-decoration-line:underline}.show-new-messages-ctr{position:absolute;bottom:var(--rtk-space-4, 16px);right:var(--rtk-space-4, 16px);z-index:10;margin-top:calc(var(--rtk-space-14, 56px) * -1);--tw-translate-y:var(--rtk-space-28, 112px);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:0;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.show-new-messages-ctr.active{--tw-translate-y:var(--rtk-space-0, 0px);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));cursor:pointer;opacity:1}.show-new-messages{pointer-events:auto;border-radius:9999px}.show-new-messages:hover{border-radius:9999px;--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-ring-opacity));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}rtk-spinner,.empty-list{margin:auto}.page-wrapper{margin-left:var(--rtk-space-1, 4px);margin-right:var(--rtk-space-1, 4px);display:flex;flex-direction:column-reverse}.message-wrapper{margin-bottom:var(--rtk-space-2, 8px)}.pinned .message-wrapper{position:relative}.pinned .pin-icon{position:absolute;right:calc(var(--rtk-space-1, 4px) * -1);top:calc(var(--rtk-space-1, 4px) * -1);display:flex;border-radius:var(--rtk-border-radius-sm, 4px)}.pinned rtk-message-view{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px)}.load-more-on-top-container{pointer-events:none;position:absolute;top:var(--rtk-space-2, 8px);right:var(--rtk-space-4, 16px);z-index:10}.load-more-icon{pointer-events:auto;border-radius:9999px}.load-more-icon:hover{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-ring-opacity));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}`,I8n=R8n;var _xt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const Mne=class{constructor(t){kt(this,t),this.oldestPaginatedTimestamp=0,this.latestPaginatedTimestamp=null,this.latestMessageTimestamp=null,this.pages=[],this.shouldScrollToBottom=!1,this.showNewMessagesCTR=!1,this.emptyListLabel=null,this.iconPack=Nt,this.t=It(),this.rerenderBoolean=!1,this.showEmptyListLabel=!1,this.isLoading=!1,this.isLoadingTop=!1,this.isLoadingBottom=!1,this.pendingScrollAnchor=null,this.isInView=e=>{const n=e.getBoundingClientRect();return n.top>=0&&n.bottom<=window.innerHeight}}async rerenderList(){this.rerenderBoolean=!this.rerenderBoolean}async onNewNode(t){if(this.pages.length<1)this.oldestPaginatedTimestamp=t.timeMs,this.pages.unshift([t]),this.latestPaginatedTimestamp=t.timeMs,this.latestMessageTimestamp=t.timeMs,this.rerender(),this.autoScroll&&this.$bottomRef.scrollIntoView({behavior:"smooth"});else if(this.latestMessageTimestamp===this.latestPaginatedTimestamp){if(this.pages[0].length<this.pageSize)this.pages[0].unshift(t),this.latestPaginatedTimestamp=t.timeMs,this.latestMessageTimestamp=t.timeMs,this.rerender();else{this.pages.unshift([t]),this.latestPaginatedTimestamp=t.timeMs,this.latestMessageTimestamp=t.timeMs,this.pages.length>this.pagesAllowed&&this.pages.pop();const e=this.pages[this.pages.length-1];this.oldestPaginatedTimestamp=e[e.length-1].timeMs,this.rerender()}this.autoScroll&&this.$bottomRef.scrollIntoView({behavior:"smooth"})}else this.autoScroll&&this.scrollToBottom();this.pendingScrollAnchor=null}async onNodeDelete(t){var e,n;for(let r=this.pages.length-1;r>=0;r--){const s=this.pages[r].findIndex(l=>l.id===t);if(s===-1)continue;this.pages[r].splice(s,1),this.pages[r].length===0&&this.pages.splice(r,1);const i=this.pages[0],o=this.pages[this.pages.length-1];this.latestPaginatedTimestamp=(e=i==null?void 0:i[0])===null||e===void 0?void 0:e.timeMs,this.oldestPaginatedTimestamp=(n=o==null?void 0:o[o.length-1])===null||n===void 0?void 0:n.timeMs,s===0&&r===0&&(this.latestMessageTimestamp=this.latestPaginatedTimestamp),this.rerender();break}}async onNodeUpdate(t,e){for(let n=this.pages.length-1;n>=0;n--){const r=this.pages[n].findIndex(s=>s.id===t);if(r!==-1){this.pages[n][r]=Object.assign(Object.assign({},this.pages[n][r]),e),this.rerender();break}}}async reset(t=0){this.oldestPaginatedTimestamp=t,this.latestPaginatedTimestamp=null,this.pages=[],this.shouldScrollToBottom=!1,this.showNewMessagesCTR=!1,this.pendingScrollAnchor=null,this.isLoading=!1,this.isLoadingTop=!1,this.isLoadingBottom=!1,t===0&&(this.latestMessageTimestamp=null),this.rerender(),await this.loadPrevPage()}connectedCallback(){this.rerender=Sne(this.rerender.bind(this),50,{maxWait:200})}componentDidLoad(){this.loadPrevPage(),this.$containerRef&&(this.$containerRef.onscrollend=async()=>{this.shouldScrollToBottom||(this.isInView(this.$bottomRef)&&this.latestMessageTimestamp>this.latestPaginatedTimestamp?await this.loadNextPage():this.isInView(this.$topRef)&&(this.showNewMessagesCTR=!0,await this.loadPrevPage()))})}componentDidRender(){if(!this.pendingScrollAnchor)return;const t=this.pendingScrollAnchor;this.pendingScrollAnchor=null,this.restoreScrollToAnchor(t)}async loadPrevPage(){if(this.isLoading)return;const t=this.getScrollAnchor("top");this.oldestPaginatedTimestamp===0&&(this.oldestPaginatedTimestamp=new Date().getTime()),this.isLoading=!0,this.isLoadingTop=!0;const e=await this.fetchData(this.oldestPaginatedTimestamp-1,this.pageSize,!0);if(this.isLoading=!1,this.isLoadingTop=!1,!e.length)return;this.pages.push(e),this.pages.length>this.pagesAllowed&&this.pages.shift();const n=this.pages[this.pages.length-1];this.oldestPaginatedTimestamp=n[n.length-1].timeMs,this.latestPaginatedTimestamp=this.pages[0][0].timeMs,this.latestMessageTimestamp||(this.latestMessageTimestamp=this.latestPaginatedTimestamp),this.rerender(),t&&(this.pendingScrollAnchor=t)}async loadNextPage(){if(this.isLoading)return[];if(!this.latestPaginatedTimestamp)return this.showNewMessagesCTR=!1,[];this.isLoading=!0,this.isLoadingBottom=!0;const t=this.getScrollAnchor("bottom"),e=await this.fetchData(this.latestPaginatedTimestamp+1,this.pageSize,!1);if(this.isLoading=!1,this.isLoadingBottom=!1,!e.length)return this.latestMessageTimestamp=this.latestPaginatedTimestamp,this.showNewMessagesCTR=!1,[];const n=[...e].reverse();this.pages.length===0&&this.pages.unshift([]);const r=this.pages[0],s=this.pageSize-r.length;if(s>0){const o=n.splice(0,s);r.unshift(...o)}for(;n.length>0;)this.pages.unshift(n.splice(0,this.pageSize));this.pages.length>this.pagesAllowed&&this.pages.pop();const i=this.pages[this.pages.length-1];return this.oldestPaginatedTimestamp=i[i.length-1].timeMs,this.latestPaginatedTimestamp=this.pages[0][0].timeMs,this.rerender(),this.pendingScrollAnchor=t,e}getScrollAnchor(t="top"){if(!this.$containerRef)return null;const e=this.$containerRef.getBoundingClientRect(),n=Array.from(this.$containerRef.querySelectorAll("[id]")).filter(s=>s.id!=="top-scroll"&&s.id!=="bottom-scroll");let r=null;for(const s of n){const i=s.getBoundingClientRect();if(i.bottom>e.top&&i.top<e.bottom)if(t==="top"){const l=i.top-e.top;(r==null||r.edge==="top"&&l<r.offsetTop)&&(r={id:s.id,edge:"top",offsetTop:l})}else{const l=e.bottom-i.bottom;(r==null||r.edge==="bottom"&&l<r.offsetBottom)&&(r={id:s.id,edge:"bottom",offsetBottom:l})}}return r}restoreScrollToAnchor(t){if(!this.$containerRef)return;const e=i=>{var o;const l=(o=globalThis.CSS)===null||o===void 0?void 0:o.escape;return typeof l=="function"?l(i):i.replace(/[^a-zA-Z0-9_-]/g,"\\$&")},n=this.$containerRef.querySelector(`#${e(t.id)}`);if(!n)return;const r=this.$containerRef.getBoundingClientRect(),s=n.getBoundingClientRect();if(t.edge==="top"){const i=s.top-r.top;this.$containerRef.scrollTop+=i-t.offsetTop}else{const i=r.bottom-s.bottom;this.$containerRef.scrollTop+=t.offsetBottom-i}}async scrollToBottom(){for(this.shouldScrollToBottom=!0;this.shouldScrollToBottom;){const t=await this.loadNextPage();this.$bottomRef.scrollIntoView({behavior:"smooth"}),t.length===0&&(this.shouldScrollToBottom=!1)}}rerender(){this.rerenderBoolean=!this.rerenderBoolean}render(){var t;return $(mt,{key:"bff4fc91b737334c5764e690fbf2adafa1444408"},$("div",{key:"f4efa98ef0bd178602ee03718d35fcb833487909",class:"scrollbar container",part:"container",ref:e=>this.$containerRef=e},$("div",{key:"37403f6462812a6662efa9577ae9ed43d27f63d6",class:{"show-new-messages-ctr":!0,active:this.showNewMessagesCTR}},$("rtk-button",{key:"ee7e04e6281370dddb1b1e10b753e96dc602d42a",class:"show-new-messages",kind:"icon",variant:"secondary",part:"show-new-messages",onClick:()=>{this.scrollToBottom()}},this.shouldScrollToBottom?$("rtk-spinner",{size:"sm"}):$("rtk-icon",{icon:this.iconPack.chevron_down}))),$("div",{key:"91bcdadd2518313fa06306a172575f5acc786596",class:"smallest-dom-element",id:"bottom-scroll",ref:e=>this.$bottomRef=e}),this.isLoadingBottom&&this.pages.length>0&&$("rtk-spinner",{key:"932af19af69c3ecd5af22dd3051a5eea5cb25e7a",size:"sm"}),this.isLoading&&this.pages.length<1&&$("rtk-spinner",{key:"9fa60fb784a09800a32a3accdc81d940476330d2",size:"lg"}),!this.isLoading&&this.pages.flat().length===0?$("div",{class:"empty-list"},(t=this.emptyListLabel)!==null&&t!==void 0?t:this.t("list.empty")):$("div",{class:"page-wrapper"},this.pages.map((e,n)=>$("div",{class:"page","data-page-index":n},this.createNodes([...e].reverse())))),this.isLoadingTop&&this.pages.length>0&&$("rtk-spinner",{key:"73103f58338bdb89be69f9f6dc742e3cdd2c95d8",size:"sm"}),$("div",{key:"9c4c43ffb6442d58040448fe1b2d7332505fc81e",class:"smallest-dom-element",id:"top-scroll",ref:e=>this.$topRef=e})))}};_xt([ge()],Mne.prototype,"iconPack",void 0);_xt([ge()],Mne.prototype,"t",void 0);Mne.style=I8n;const M8n=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{display:flex;width:100%;flex-direction:column;font-size:14px;position:relative;box-sizing:border-box;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.chat-header{position:relative;margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);cursor:pointer;gap:var(--rtk-space-2, 8px);padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px);padding-top:var(--rtk-space-3, 12px);padding-bottom:var(--rtk-space-3, 12px);display:flex;flex-direction:row;align-items:center;justify-content:space-between;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));border-radius:var(--rtk-border-radius-sm, 4px);border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60))}.chat-header-label{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:var(--rtk-space-2, 8px)}.dropdown{position:absolute;top:100%;z-index:10;padding:var(--rtk-space-0, 0px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));opacity:0;pointer-events:none;border-bottom-right-radius:var(--rtk-border-radius-sm, 4px);border-bottom-left-radius:var(--rtk-border-radius-sm, 4px);left:var(--rtk-space-2, 8px);right:var(--rtk-space-2, 8px);max-width:calc(100vw - var(--rtk-space-4, 16px));box-sizing:border-box}.dropdown.open{opacity:1;pointer-events:auto;border-width:1px;border-top-width:var(--rtk-border-width-none, 0);border-style:solid;--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-border-opacity))}.dropdown rtk-paginated-list{box-sizing:border-box;display:flex;height:30vh;flex-direction:column}`,L8n=M8n;var FNe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const U7=class{constructor(t){kt(this,t),this.dropdownToggle=Wt(this,"rtkDropdownToggle",7),this.pinnedMessageSelect=Wt(this,"rtkPinnedMessageSelect",7),this.isOpen=!1,this.iconPack=Nt,this.t=It(),this.pageSize=25,this.pagesAllowed=3,this.showPinnedMessages=!0,this.toggle=e=>{e.preventDefault(),e.stopPropagation(),this.isOpen=!this.isOpen,this.dropdownToggle.emit({open:this.isOpen})},this.getPinnedChatMessages=async(e,n,r)=>{const s=this.meeting;if(!s)return[];try{return await s.chat.fetchPinnedMessages({timestamp:e,limit:n,direction:r?"before":"after"})}catch{return[]}},this.createPinnedChatNodes=e=>e.map(n=>{const r=n.type==="text"?(n.message||"").replace(/\s+/g," ").trim():n.type==="file"?"File Attachment":n.type==="image"?"Image Attachment":"";return $("div",{class:"pinned-message",id:n.id,onClick:()=>{this.pinnedMessageSelect.emit(n),this.close()}},$("div",{class:"pinned-message-container"},$("rtk-avatar",{size:"sm",participant:{name:n.displayName,picture:""}}),$("div",{class:"pinned-message-content"},$("div",{class:"pinned-message-preview",title:r},r),$("div",{class:"pinned-message-meta"},$("span",{class:"pinned-message-time"},kne(n.time,new Date(Date.now())))))))}),this.pinChatListener=e=>{var n,r;((n=e.message.targetUserIds)===null||n===void 0?void 0:n.length)>0||(r=this.$paginatedListRef)===null||r===void 0||r.reset()},this.unpinChatListener=async e=>{var n,r;((n=e.message.targetUserIds)===null||n===void 0?void 0:n.length)>0||(r=this.$paginatedListRef)===null||r===void 0||r.onNodeDelete(e.message.id)},this.chatUpdateListener=async e=>{e.action==="delete"&&this.unpinChatListener(e)}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.disconnectMeeting(this.meeting)}disconnectMeeting(t){var e,n,r;(e=t.chat)===null||e===void 0||e.removeListener("pinMessage",this.pinChatListener),(n=t.chat)===null||n===void 0||n.removeListener("unpinMessage",this.unpinChatListener),(r=t.chat)===null||r===void 0||r.removeListener("chatUpdate",this.chatUpdateListener)}meetingChanged(t,e){var n,r,s,i;e&&this.disconnectMeeting(e),t&&((n=this.$paginatedListRef)===null||n===void 0||n.reset(),(r=t.chat)===null||r===void 0||r.addListener("pinMessage",this.pinChatListener),(s=t.chat)===null||s===void 0||s.addListener("unpinMessage",this.unpinChatListener),(i=t.chat)===null||i===void 0||i.addListener("chatUpdate",this.chatUpdateListener))}async close(){this.isOpen&&(this.isOpen=!1,this.dropdownToggle.emit({open:!1}))}async onChatSelectorChange(t){var e;((e=t.detail)===null||e===void 0?void 0:e.selectedUser)?this.showPinnedMessages=!1:this.showPinnedMessages=!0}render(){return this.showPinnedMessages?$(mt,null,$("div",{class:"chat-header",onClick:this.toggle},$("div",{class:"chat-header-label"},$("rtk-icon",{icon:this.iconPack.pin,size:"sm"}),this.t("chat.pinned_msgs")),$("div",{class:"chevron"},$("rtk-icon",{icon:this.isOpen?this.iconPack.chevron_up:this.iconPack.chevron_down,size:"sm"}))),$("div",{class:{dropdown:!0,open:this.isOpen,scrollbar:!0}},$("rtk-paginated-list",{class:"pinned-message-selector-paginated-list",ref:t=>this.$paginatedListRef=t,pageSize:this.pageSize,pagesAllowed:3,fetchData:this.getPinnedChatMessages,createNodes:this.createPinnedChatNodes,emptyListLabel:this.t("chat.empty_search")},$("slot",null)))):null}static get watchers(){return{meeting:["meetingChanged"]}}};FNe([ge()],U7.prototype,"meeting",void 0);FNe([ge()],U7.prototype,"iconPack",void 0);FNe([ge()],U7.prototype,"t",void 0);U7.style=L8n;const D8n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:block;height:var(--rtk-space-10, 40px);width:var(--rtk-space-10, 40px);--rtk-spinner-color:currentColor}.spinner{height:100%;width:100%}@keyframes spin{to{transform:rotate(360deg)}}.spinner{animation:spin 1s linear infinite;border-radius:9999px;background-color:transparent;animation-duration:1.3s}:host([size='md']){height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}:host([size='sm']){height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}",$8n=D8n;var O8n=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const BNe=class{constructor(t){kt(this,t),this.iconPack=Nt,this.size="md"}render(){return $(mt,{key:"5e435f3b94bf3a2b9d242d78407390996a76be15"},$("rtk-icon",{key:"9e9e4200e0dc295bfe9048e57beb6cd809bf53a2",class:"spinner",icon:this.iconPack.spinner}))}};O8n([ge()],BNe.prototype,"iconPack",void 0);BNe.style=$8n;const F8n=`.chat-input {
  position: relative;
  z-index: 10;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  border-top-left-radius: var(--rtk-border-radius-md, 8px);
  border-top-right-radius: var(--rtk-border-radius-md, 8px)
}

  .chat-input textarea {
  --tw-bg-opacity: 1;
  background-color: rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));
  box-sizing: border-box;
  padding: var(--rtk-space-3, 12px);
  color: rgb(var(--rtk-colors-text-1000, 255 255 255))
}

  .chat-input textarea::-moz-placeholder {
  color: rgb(var(--rtk-colors-text-1000, 255 255 255))
}

  .chat-input textarea::placeholder {
  color: rgb(var(--rtk-colors-text-1000, 255 255 255))
}

  .chat-input textarea {
  font-family: var(--rtk-font-family, sans-serif);
  outline: 2px solid transparent;
  outline-offset: 2px;
  resize: none;
  overflow-y: auto;
  border-width: var(--rtk-border-width-none, 0);
  border-style: none;
  min-height: 60px;
  font-size: 14px
}

@container chatcontainer (height < 360px) {
  textarea {
    height: 30px !important;
    min-height: 30px !important
  }
}

.text-error {
  left: var(--rtk-space-0, 0px);
  z-index: 10;
  margin-top: var(--rtk-space-1, 4px);
  margin-left: var(--rtk-space-1, 4px);
  display: flex;
  width: -moz-fit-content;
  width: fit-content;
  align-items: center;
  justify-content: flex-start;
  border-radius: var(--rtk-border-radius-sm, 4px);
  --tw-border-opacity: 1;
  border-color: rgba(var(--rtk-colors-warning, 255 205 7) / var(--tw-border-opacity));
  --tw-bg-opacity: 1;
  background-color: rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));
  padding-left: var(--rtk-space-2, 8px);
  padding-right: var(--rtk-space-2, 8px);
  font-size: 12px;
  font-weight: 600;
  --tw-text-opacity: 1;
  color: rgba(var(--rtk-colors-warning, 255 205 7) / var(--tw-text-opacity));
  border: 1px solid
}

#warning-indicator {
  margin-right: var(--rtk-space-1, 4px);
  height: var(--rtk-space-3, 12px);
  width: var(--rtk-space-3, 12px)
}

.text-error.breached {
  --tw-border-opacity: 1;
  border-color: rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-border-opacity));
  --tw-text-opacity: 1;
  color: rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))
}`,B8n=F8n;var Axt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const Lne=class{constructor(t){kt(this,t),this.onTextChange=Wt(this,"textChange",7),this.disabled=!1,this.rateLimitBreached=!1,this.keyDownHandler=()=>{},this.iconPack=Nt,this.t=It(),this.maxLengthBreached=0,this.onInputHandler=()=>{const e=this.$textArea.value.trim();this.maybeResize(e),this.checkLength(e),this.onTextChange.emit(e)},this.maybeResize=e=>{const n=[...e.matchAll(/\n/g)].length;this.$textArea.style.height=`${Math.min(200,60+20*n)}px`}}componentDidLoad(){this.maxLength&&(this.$textArea.maxLength=this.maxLength);const t=this.$textArea.value.trim();t!==""&&this.maybeResize(t),this.$textArea.focus()}async setText(t,e=!1){this.$textArea.value=t,this.maybeResize(t),e&&this.$textArea.focus(),this.checkLength(t),this.onTextChange.emit(t)}checkLength(t){const e=t.length;e+10>=this.maxLength?this.maxLengthBreached=t.length:e+10<this.maxLength&&this.maxLengthBreached>0&&(this.maxLengthBreached=0)}render(){return $("div",{key:"900c8fc082af9cffe94011fb0d682802cc450851",class:"chat-input",part:"chat-input-container"},this.maxLengthBreached>0&&$("div",{key:"fa2362fa593952c3680ae3408c8041c2567342dc",class:"text-error "+(this.maxLengthBreached===this.maxLength?"breached":"")},$("rtk-icon",{key:"0bfa55917acfbe23250bb2b3d487cf27c1eddc58",id:"warning-indicator",icon:this.iconPack.warning,part:"warning-indicator"})," ",this.maxLengthBreached," / ",this.maxLength," ",this.t("chat.max_limit_warning")),this.rateLimitBreached&&$("div",{key:"b4dc7987ec892e6dd8746d21efddeb0a3b765a4c",class:"text-error breached"},$("rtk-icon",{key:"e74b331f6674c5a5a7596d848c7b4846d28a4700",id:"warning-indicator",icon:this.iconPack.warning,part:"warning-indicator"})," ",this.t("chat.rate_limit_error")),$("textarea",{key:"16dfc924b0d935a2e6b4d9fd22418331a9cd1044",ref:t=>this.$textArea=t,placeholder:this.placeholder,disabled:this.disabled,onInput:this.onInputHandler,onKeyDown:this.keyDownHandler,part:"chat-input",value:this.value}))}};Axt([ge()],Lne.prototype,"iconPack",void 0);Axt([ge()],Lne.prototype,"t",void 0);Lne.style=B8n;const U8n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.text{word-break:break-word;display:block;overflow-wrap:break-word;line-height:1.375}.text.emoji{font-size:24px}",z8n=U8n,Pxt=class{constructor(t){kt(this,t),this.isMarkdown=!1}render(){return $("p",{key:"45d7cc7d147e74609251f6ab3c2918d42ec6aaea",class:{text:!0,emoji:Lbt(this.text)}},this.isMarkdown?$("rtk-markdown-view",{text:this.text}):this.text)}};Pxt.style=z8n;const V8n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{--background-color:var(--rtk-tooltip-background-color, rgb(var(--rtk-colors-background-600, 60 60 60)));--color:var(--rtk-tooltip-color, rgb(var(--rtk-colors-text-1000, 255 255 255)));display:inline-flex}#trigger{display:block;width:100%;flex:1 1 0%}.tooltip{max-width:var(--rtk-space-64, 256px);position:fixed;z-index:20;display:none;width:-moz-max-content;width:max-content;padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);font-size:12px}.tooltip,#arrow{position:absolute;background-color:var(--background-color);color:var(--color)}#arrow{position:absolute;height:var(--rtk-space-2, 8px);width:var(--rtk-space-2, 8px);transform:rotate(45deg)}:host([variant='primary']){--background-color:rgb(var(--rtk-colors-brand-500, 33 96 253));--color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}:host([kind='block']){display:block}",H8n=V8n,Rxt=class{constructor(t){kt(this,t),this.openChange=Wt(this,"rtkOpenChange",7),this.label="",this.variant="secondary",this.disabled=!1,this.open=!1,this.kind="inline",this.placement="top",this.delay=0,this.isInFocus=!1,this.showMenu=()=>{this.disabled||(this.isInFocus=!0,setTimeout(()=>{this.isInFocus&&(this.tooltipEl.style.display="block",this.update(),this.openChange.emit(!0),this.size==="sm"&&setTimeout(()=>{this.isInFocus&&this.hideMenu()},1e3))},this.delay))},this.hideMenu=()=>{this.open||this.disabled||(this.isInFocus=!1,this.tooltipEl.style.display="none",this.openChange.emit(!1))}}componentDidLoad(){this.triggerEl.addEventListener("focusin",this.showMenu),this.triggerEl.addEventListener("mouseenter",this.showMenu),this.triggerEl.addEventListener("focusout",this.hideMenu),this.triggerEl.addEventListener("mouseleave",this.hideMenu),Dc(()=>{this.openChanged(this.open)})}disconnectedCallback(){this.triggerEl&&(this.triggerEl.removeEventListener("focusin",this.showMenu),this.triggerEl.removeEventListener("mouseenter",this.showMenu),this.triggerEl.removeEventListener("focusout",this.hideMenu),this.triggerEl.removeEventListener("mouseleave",this.hideMenu),this.triggerEl=void 0)}openChanged(t){t?this.showMenu():this.hideMenu()}update(){MNe(this.triggerEl,this.tooltipEl,{placement:this.placement,middleware:[RNe(8),hxt(),INe({padding:5}),SFn({element:this.arrowEl})]}).then(({x:t,y:e,placement:n,middlewareData:r})=>{Object.assign(this.tooltipEl.style,{left:`${t}px`,top:`${e}px`});const{x:s,y:i}=r.arrow,o={top:"bottom",right:"left",bottom:"top",left:"right"}[n.split("-")[0]];Object.assign(this.arrowEl.style,{left:s!=null?`${s}px`:"",top:i!=null?`${i}px`:"",right:"",bottom:"",[o]:"-4px"})})}render(){return $(mt,{key:"ce9cb2211743e50c83b7f572b2e9dc5b02fa3ac8"},$("span",{key:"74f73894f5a62519b3bf8c03a83e7102092ccd5c",part:"trigger",id:"trigger",ref:t=>this.triggerEl=t},$("slot",{key:"4551b2a438b1c57ca68e4a2973529186063a13c2"})),$("div",{key:"e3dd196c6ee225cb363bcf54d35836ff17ed5969",part:"tooltip",class:"tooltip",id:"tooltip",role:"tooltip",ref:t=>this.tooltipEl=t},$("div",{key:"4eb8bb3af588160018ef9d8899afc09edf4b195d",id:"arrow",ref:t=>this.arrowEl=t,part:"arrow"}),this.label,$("slot",{key:"c427ef3ef9953b764f9b1adcb4a8b7eee1fe91cd",name:"tooltip"})))}static get watchers(){return{open:["openChanged"]}}};Rxt.style=H8n;var G8n=Object.freeze({__proto__:null,rtk_avatar:Cne,rtk_button:pxt,rtk_chat:QE,rtk_chat_composer_view:jne,rtk_chat_header:vxt,rtk_chat_messages_ui_paginated:B7,rtk_chat_selector:jS,rtk_draft_attachment_view:Ene,rtk_emoji_picker:Nne,rtk_emoji_picker_button:Tne,rtk_file_message_view:$Ne,rtk_file_picker_button:_ne,rtk_icon:kxt,rtk_image_message_view:Ane,rtk_markdown_view:Cxt,rtk_meeting:jxt,rtk_menu:Pne,rtk_menu_item:Rne,rtk_menu_list:Ine,rtk_message_view:ONe,rtk_paginated_list:Mne,rtk_pinned_message_selector:U7,rtk_spinner:BNe,rtk_text_composer_view:Lne,rtk_text_message_view:Pxt,rtk_tooltip:Rxt});const W8n=":host{display:block}:host([data-hidden]){display:none}",q8n=W8n;var Dne=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const FI=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.variant="button",this.iconPack=Nt,this.t=It(),this.aiActive=!1,this.toggleAI=()=>{const e=this.states;this.aiActive=!(e!=null&&e.activeSidebar&&(e==null?void 0:e.sidebar)==="ai"),this.stateUpdate.emit({activeSidebar:this.aiActive,sidebar:this.aiActive?"ai":void 0,activeMoreMenu:!1})}}connectedCallback(){this.statesChanged(this.states)}statesChanged(t){t!=null&&(this.aiActive=t.activeSidebar===!0&&t.sidebar==="ai")}render(){var t,e;if(!this.meeting)return null;const n=this.t("ai.meeting_ai");return((e=(t=this.meeting)===null||t===void 0?void 0:t.self)===null||e===void 0?void 0:e.permissions).transcriptionEnabled?$(mt,{title:n},$("rtk-controlbar-button",{part:"controlbar-button",size:this.size,iconPack:this.iconPack,class:{active:this.aiActive},onClick:this.toggleAI,icon:this.iconPack.meeting_ai,label:n,variant:this.variant,brandIcon:!0})):$(mt,{"data-hidden":!0})}static get watchers(){return{states:["statesChanged"]}}};Dne([ge()],FI.prototype,"states",void 0);Dne([ge()],FI.prototype,"meeting",void 0);Dne([ge()],FI.prototype,"iconPack",void 0);Dne([ge()],FI.prototype,"t",void 0);FI.style=q8n;var K8n=Object.freeze({__proto__:null,rtk_ai_toggle:FI});const Y8n=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;height:100%;width:100%;box-sizing:border-box}.content{position:relative;display:flex;height:100%;width:100%;flex-direction:column;overflow-y:auto}.waitlist-area{display:flex;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.listening-title{text-align:center;margin-top:var(--rtk-space-5, 20px);margin-bottom:var(--rtk-space-4, 16px)}.waitlist-grid{flex:1 1 0%}.grid{box-sizing:border-box;flex:1 1 0%;gap:var(--rtk-space-6, 24px);display:flex;align-content:center;justify-content:center;flex-wrap:wrap}:host([size='md']) .grid{gap:var(--rtk-space-4, 16px)}:host([size='sm']) .grid{gap:var(--rtk-space-3, 12px)}rtk-audio-tile{aspect-ratio:1 / 1;flex:none;width:calc(20%);max-width:var(--rtk-space-48, 192px);transition:all 0.3s}rtk-audio-tile[size='md']{width:100%;max-width:var(--rtk-space-36, 144px)}rtk-audio-tile[size='sm']{width:100%;max-width:var(--rtk-space-24, 96px)}`,Q8n=Y8n;var z7=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const ZE=class{constructor(t){kt(this,t),this.iconPack=Nt,this.t=It(),this.hideSelf=!1,this.activeParticipants=[],this.onStageParticipants=[],this.offStageParticipants=[],this.onParticipantListUpdate=()=>{if(!this.meeting)return;let e=this.meeting.participants.active.toArray();this.hideSelf||(e=[...e,this.meeting.self]);let n=this.meeting.participants.joined.toArray().filter(r=>!e.some(s=>s.id===r.id));this.activeParticipants=e,this.onStageParticipants=n}}connectedCallback(){this.meetingChanged(this.meeting)}meetingChanged(t){!t||t.self.config.viewType!=="AUDIO_ROOM"||(this.onParticipantListUpdate(),t.participants.active.addListener("participantJoined",this.onParticipantListUpdate),t.participants.active.addListener("participantLeft",this.onParticipantListUpdate),t.participants.joined.addListener("participantJoined",this.onParticipantListUpdate),t.participants.joined.addListener("participantLeft",this.onParticipantListUpdate))}disconnectedCallback(){this.resizeObserver.disconnect(),this.resizeObserver=void 0,this.meeting.participants.active.removeListener("participantJoined",this.onParticipantListUpdate),this.meeting.participants.active.removeListener("participantLeft",this.onParticipantListUpdate),this.meeting.participants.joined.removeListener("participantJoined",this.onParticipantListUpdate),this.meeting.participants.joined.removeListener("participantLeft",this.onParticipantListUpdate)}renderGrid(t=[]){const e={meeting:this.meeting,size:this.size,config:this.config,t:this.t,iconPack:this.iconPack,states:this.states};return t.map(n=>$(tc,{element:"rtk-audio-tile",defaults:e,props:{key:n.id,participant:n},childProps:{participant:n},deepProps:!0}))}render(){const t=this.activeParticipants.concat(this.onStageParticipants);return $(mt,{key:"46eacac44f967fdac3ca9d1a62ffa08a9e2bec0e"},$("div",{key:"6121a8d6ec144197981ced909076345163f0fa69",class:"content scrollbar"},$("div",{key:"caeb7f4830e847e7dab63db199ec00cd12cb8ecc",class:"stage grid"},this.renderGrid(t)),this.offStageParticipants.length>0&&$("div",{key:"b5923cbb9be5992fdb007c3354e7792b19003d5b",class:"waitlist-area"},$("div",{key:"b93cefbe7de0eaf46c69f9d0dd6cf231ce683f27",class:"listening-title"},this.offStageParticipants.length," ",this.t("grid.listening")),$("div",{key:"f75c7cd4aa2422d3faed994ed24929e3c05fd097",class:"waitlist-grid grid"},this.renderGrid(this.offStageParticipants)))),$("slot",{key:"91240e462e7e510317b0ea6625ecba3aea94d5f3"}))}get host(){return Pl(this)}static get watchers(){return{meeting:["meetingChanged"]}}};z7([ge()],ZE.prototype,"meeting",void 0);z7([ge()],ZE.prototype,"config",void 0);z7([ge()],ZE.prototype,"states",void 0);z7([ge()],ZE.prototype,"iconPack",void 0);z7([ge()],ZE.prototype,"t",void 0);ZE.style=Q8n;var Z8n=Object.freeze({__proto__:null,rtk_audio_grid:ZE}),J8n=$Q;function $Q(){}$Q.mixin=function(t){var e=t.prototype||t;e.isWildEmitter=!0,e.on=function(n,r,s){this.callbacks=this.callbacks||{};var i=arguments.length===3,o=i?arguments[1]:void 0,l=i?arguments[2]:arguments[1];return l._groupName=o,(this.callbacks[n]=this.callbacks[n]||[]).push(l),this},e.once=function(n,r,s){var i=this,o=arguments.length===3,l=o?arguments[1]:void 0,c=o?arguments[2]:arguments[1];function d(){i.off(n,d),c.apply(this,arguments)}return this.on(n,l,d),this},e.releaseGroup=function(n){this.callbacks=this.callbacks||{};var r,s,i,o;for(r in this.callbacks)for(o=this.callbacks[r],s=0,i=o.length;s<i;s++)o[s]._groupName===n&&(o.splice(s,1),s--,i--);return this},e.off=function(n,r){this.callbacks=this.callbacks||{};var s=this.callbacks[n],i;return s?arguments.length===1?(delete this.callbacks[n],this):(i=s.indexOf(r),i!==-1&&(s.splice(i,1),s.length===0&&delete this.callbacks[n]),this):this},e.emit=function(n){this.callbacks=this.callbacks||{};var r=[].slice.call(arguments,1),s=this.callbacks[n],i=this.getWildcardCallbacks(n),o,l,c;if(s)for(c=s.slice(),o=0,l=c.length;o<l&&c[o];++o)c[o].apply(this,r);if(i)for(l=i.length,c=i.slice(),o=0,l=c.length;o<l&&c[o];++o)c[o].apply(this,[n].concat(r));return this},e.getWildcardCallbacks=function(n){this.callbacks=this.callbacks||{};var r,s,i=[];for(r in this.callbacks)s=r.split("*"),(r==="*"||s.length===2&&n.slice(0,s[0].length)===s[0])&&(i=i.concat(this.callbacks[r]));return i}};$Q.mixin($Q);var X8n=J8n;function e7n(t,e){var n=-1/0;t.getFloatFrequencyData(e);for(var r=4,s=e.length;r<s;r++)e[r]>n&&e[r]<0&&(n=e[r]);return n}var kbe;typeof window<"u"&&(kbe=window.AudioContext||window.webkitAudioContext);var gp=null,Ixt=function(t,r){var n=new X8n;if(!kbe)return n;var r=r||{},s=r.smoothing||.1,i=r.interval||50,o=r.threshold,l=r.play,c=r.history||10,d=!0;gp=r.audioContext||gp||new kbe;var u,h,m;m=gp.createAnalyser(),m.fftSize=512,m.smoothingTimeConstant=s,h=new Float32Array(m.frequencyBinCount),t.jquery&&(t=t[0]),t instanceof HTMLAudioElement||t instanceof HTMLVideoElement?(u=gp.createMediaElementSource(t),typeof l>"u"&&(l=!0),o=o||-50):(u=gp.createMediaStreamSource(t),o=o||-50),u.connect(m),l&&m.connect(gp.destination),n.speaking=!1,n.suspend=function(){return gp.suspend()},n.resume=function(){return gp.resume()},Object.defineProperty(n,"state",{get:function(){return gp.state}}),gp.onstatechange=function(){n.emit("state_change",gp.state)},n.setThreshold=function(g){o=g},n.setInterval=function(g){i=g},n.stop=function(){d=!1,n.emit("volume_change",-100,o),n.speaking&&(n.speaking=!1,n.emit("stopped_speaking")),m.disconnect(),u.disconnect()},n.speakingHistory=[];for(var f=0;f<c;f++)n.speakingHistory.push(0);var p=function(){setTimeout(function(){if(d){var g=e7n(m,h);n.emit("volume_change",g,o);var v=0;if(g>o&&!n.speaking){for(var b=n.speakingHistory.length-3;b<n.speakingHistory.length;b++)v+=n.speakingHistory[b];v>=2&&(n.speaking=!0,n.emit("speaking"))}else if(g<o&&n.speaking){for(var b=0;b<n.speakingHistory.length;b++)v+=n.speakingHistory[b];v==0&&(n.speaking=!1,n.emit("stopped_speaking"))}n.speakingHistory.shift(),n.speakingHistory.push(0+(g>o)),p()}},i)};return p(),n};const t7n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:flex;flex-direction:column}.avatar-ctr{box-sizing:border-box;width:100%;flex:1 1 0%;padding:var(--rtk-space-1\\.5, 6px);border:2px solid transparent;border-radius:calc(var(--rtk-border-radius-xl, 40px) + var(--rtk-space-1\\.5, 6px))}.avatar-ctr.speaking{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-border-opacity));transition-property:box-shadow;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.bar-0{box-shadow:none}.bar-1{box-shadow:0 0 4px rgb(var(--rtk-colors-brand-500, 33 96 253))}.bar-2{box-shadow:0 0 8px rgb(var(--rtk-colors-brand-500, 33 96 253))}.bar-3{box-shadow:0 0 16px 1px rgb(var(--rtk-colors-brand-500, 33 96 253))}.bar-4{box-shadow:0 0 20px 3px rgb(var(--rtk-colors-brand-500, 33 96 253))}.bar-5{box-shadow:0 0 24px 6px rgb(var(--rtk-colors-brand-500, 33 96 253))}rtk-avatar{aspect-ratio:1 / 1;height:100%;width:100%;position:relative;border-radius:var(--rtk-border-radius-xl, 40px)}rtk-name-tag{display:block;height:var(--rtk-space-10, 40px);width:100%;text-align:center;line-height:2.5rem}:host([size='sm']) .avatar-ctr{border-radius:calc(var(--rtk-border-radius-lg, 12px) + var(--rtk-space-1\\.5, 6px))}:host([size='sm']) rtk-name-tag{height:var(--rtk-space-7, 28px);line-height:1.75rem}:host([size='sm']) rtk-avatar{border-radius:var(--rtk-border-radius-lg, 12px)}.mic-icon{position:absolute;bottom:calc(var(--rtk-space-1, 4px) * -1);right:calc(var(--rtk-space-1, 4px) * -1);border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));padding:var(--rtk-space-2, 8px);color:rgb(var(--rtk-colors-text-1000, 255 255 255));--tw-shadow:0 1px 2px 0 rgb(0 0 0 / 0.05);--tw-shadow-colored:0 1px 2px 0 var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.mic-icon rtk-icon{height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px)}:host([size='sm']) .mic-icon rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}:host([size='md']) .mic-icon rtk-icon{height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}",n7n=t7n;var V7=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const JE=class{constructor(t){kt(this,t),this.iconPack=Nt,this.t=It(),this.audioEnabled=!1,this.volume=0,this.onAudioUpdate=({audioEnabled:e,audioTrack:n})=>{if(this.participant)if(e&&n){const r=new MediaStream;r.addTrack(n),this.calcVolume(r),this.audioEnabled=!0}else this.volume=0,this.audioEnabled=!1}}connectedCallback(){this.participantChanged(this.participant)}disconnectedCallback(){var t,e;(t=this.hark)===null||t===void 0||t.stop(),(e=this.participant)===null||e===void 0||e.removeListener("audioUpdate",this.onAudioUpdate)}participantChanged(t){t&&(this.audioEnabled=t.audioEnabled,t.addListener("audioUpdate",this.onAudioUpdate))}calcVolume(t){this.hark=Ixt(t,{play:!1,interval:1e3/10}),this.hark.on("volume_change",e=>{const n=this.volume;let r=Math.round(10**(e/115)*10);r<3&&(r=0);let s=Math.round((n*2+r)/3);n!==s&&(this.volume=s)})}render(){if(!this.meeting)return null;const t={meeting:this.meeting,size:this.size,config:this.config,states:this.states,iconPack:this.iconPack,t:this.t};let e="bar-0";return this.volume>5?e="bar-5":this.volume<0?e="bar-0":e="bar-"+this.volume,$(mt,null,$("div",{class:{"avatar-ctr":!0,speaking:this.audioEnabled,[e]:!0}},$("rtk-avatar",{participant:this.participant,size:this.size},!this.audioEnabled&&$("div",{class:"mic-icon"},$("rtk-icon",{icon:Nt.mic_off})))),$("rtk-name-tag",Object.assign({variant:"text",participant:this.participant},t)),$("slot",null))}static get watchers(){return{participant:["participantChanged"]}}};V7([ge()],JE.prototype,"meeting",void 0);V7([ge()],JE.prototype,"config",void 0);V7([ge()],JE.prototype,"states",void 0);V7([ge()],JE.prototype,"iconPack",void 0);V7([ge()],JE.prototype,"t",void 0);JE.style=n7n;var r7n=Object.freeze({__proto__:null,rtk_audio_tile:JE});const s7n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}",i7n=s7n;var $ne=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const BI=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.variant="button",this.iconPack=Nt,this.t=It(),this.canToggle=!1,this.permissionsUpdateListener=()=>{this.canToggle=h7e(this.meeting)},this.breakoutRoomToggle=()=>{var e,n;const r=this.meeting.connectedMeetings.isActive?"view":"create";this.stateUpdate.emit({activeBreakoutRoomsManager:{active:!(!((n=(e=this.states)===null||e===void 0?void 0:e.activeBreakoutRoomsManager)===null||n===void 0)&&n.active),mode:r}})}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var t,e,n;(n=(e=(t=this.meeting)===null||t===void 0?void 0:t.self)===null||e===void 0?void 0:e.permissions)===null||n===void 0||n.off("permissionsUpdate",this.permissionsUpdateListener)}meetingChanged(t){t&&(this.canToggle=h7e(t),t.self.permissions.on("permissionsUpdate",this.permissionsUpdateListener))}render(){if(!this.meeting)return null;if(this.canToggle)return $(mt,{title:this.t("breakout_rooms")},$("rtk-controlbar-button",{part:"controlbar-button",size:this.size,iconPack:this.iconPack,onClick:this.breakoutRoomToggle,icon:this.iconPack.breakout_rooms,label:this.t("breakout_rooms"),variant:this.variant}))}static get watchers(){return{meeting:["meetingChanged"]}}};$ne([ge()],BI.prototype,"meeting",void 0);$ne([ge()],BI.prototype,"states",void 0);$ne([ge()],BI.prototype,"iconPack",void 0);$ne([ge()],BI.prototype,"t",void 0);BI.style=i7n;var a7n=Object.freeze({__proto__:null,rtk_breakout_rooms_toggle:BI});const o7n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}:host([data-hidden]){display:none}",l7n=o7n;var UNe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const H7=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.videoUpdateListener=({videoEnabled:e})=>{this.videoEnabled=e},this.stageStatusListener=()=>{this.stageStatus=this.meeting.stage.status,this.canProduceVideo=this.meeting.self.permissions.canProduceVideo==="ALLOWED"},this.mediaPermissionUpdateListener=({kind:e,message:n})=>{e==="video"&&(this.cameraPermission=n)},this.meetingPermissionsUpdateListener=e=>{var n;!((n=e==null?void 0:e.media)===null||n===void 0)&&n.video&&(this.canProduceVideo=this.meeting.self.permissions.canProduceVideo==="ALLOWED")},this.variant="button",this.iconPack=Nt,this.t=It(),this.videoEnabled=!1,this.canProduceVideo=!1,this.cameraPermission="NOT_REQUESTED",this.stageStatus="OFF_STAGE",this.toggleCamera=()=>{var e,n,r,s,i,o,l,c,d,u,h;if((e=this.meeting)===null||e===void 0||e.__internals__.logger.info("rtkCameraToggle::toggleCamera",{media:{video:{enabled:!!(!((r=(n=this.meeting)===null||n===void 0?void 0:n.self)===null||r===void 0)&&r.videoEnabled),permission:this.cameraPermission,canProduce:(o=(i=(s=this.meeting)===null||s===void 0?void 0:s.self)===null||i===void 0?void 0:i.permissions)===null||o===void 0?void 0:o.canProduceVideo}},webinar:{stageStatus:(l=this.meeting)===null||l===void 0?void 0:l.stage.status},livestream:{stageStatus:(d=(c=this.meeting)===null||c===void 0?void 0:c.stage)===null||d===void 0?void 0:d.status},moduleExists:{self:!!(!((u=this.meeting)===null||u===void 0)&&u.self)}}),this.hasPermissionError()){const f={enabled:!0,kind:"video"};return this.stateUpdate.emit({activePermissionsMessage:f}),!1}const m=(h=this.meeting)===null||h===void 0?void 0:h.self;m==null||!this.canProduceVideo||(m.videoEnabled?m.disableVideo():m.enableVideo())}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var t,e,n,r,s,i,o;(t=this.meeting)===null||t===void 0||t.self.removeListener("videoUpdate",this.videoUpdateListener),(e=this.meeting)===null||e===void 0||e.self.removeListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),(r=(n=this.meeting)===null||n===void 0?void 0:n.stage)===null||r===void 0||r.removeListener("stageStatusUpdate",this.stageStatusListener),(o=(i=(s=this.meeting)===null||s===void 0?void 0:s.self)===null||i===void 0?void 0:i.permissions)===null||o===void 0||o.removeListener("permissionsUpdate",this.meetingPermissionsUpdateListener)}meetingChanged(t){var e,n;if(t!=null){const{self:r,stage:s}=t;this.canProduceVideo=this.meeting.self.permissions.canProduceVideo==="ALLOWED",this.cameraPermission=r.mediaPermissions.video||"NOT_REQUESTED",this.videoEnabled=r.videoEnabled,this.stageStatus=t.stage.status,r.addListener("videoUpdate",this.videoUpdateListener),r.addListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),s==null||s.addListener("stageStatusUpdate",this.stageStatusListener),(n=(e=t==null?void 0:t.self)===null||e===void 0?void 0:e.permissions)===null||n===void 0||n.addListener("permissionsUpdate",this.meetingPermissionsUpdateListener)}}hasPermissionError(){return this.cameraPermission==="DENIED"||this.cameraPermission==="SYSTEM_DENIED"}getState(){let t="",e="",n="",r={},s=this.hasPermissionError(),i=this.cameraPermission==="COULD_NOT_START";return this.videoEnabled&&!s?(e=this.t("video_on"),n=this.iconPack.video_on):(e=this.t("video_off"),n=this.iconPack.video_off,r["red-icon"]=!0),i?t=this.t("perm_could_not_start.video"):this.cameraPermission==="SYSTEM_DENIED"?t=this.t("perm_sys_denied.video"):this.cameraPermission==="DENIED"?t=this.t("perm_denied.video"):t=this.videoEnabled?this.t("disable_video"):this.t("enable_video"),{tooltipLabel:t,label:e,icon:n,classList:r,showWarning:s||i,disable:s}}render(){var t;if(!this.meeting)return null;if(!this.canProduceVideo||((t=this.meeting)===null||t===void 0?void 0:t.meta.viewType)==="AUDIO_ROOM"||["OFF_STAGE","REQUESTED_TO_JOIN_STAGE"].includes(this.stageStatus))return $(mt,{"data-hidden":!0});const{tooltipLabel:e,label:n,icon:r,classList:s,showWarning:i,disable:o}=this.getState();return $(mt,{title:n},$("rtk-tooltip",{kind:"block",label:e,part:"tooltip"},$("rtk-controlbar-button",{part:"controlbar-button",size:this.size,iconPack:this.iconPack,class:s,variant:this.variant,label:n,icon:r,onClick:this.toggleCamera,showWarning:i,disabled:o})))}static get watchers(){return{meeting:["meetingChanged"]}}};UNe([ge()],H7.prototype,"meeting",void 0);UNe([ge()],H7.prototype,"iconPack",void 0);UNe([ge()],H7.prototype,"t",void 0);H7.style=l7n;var c7n=Object.freeze({__proto__:null,rtk_camera_toggle:H7});const d7n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}",u7n=d7n;var G7=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const XE=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.variant="button",this.config=Os(),this.iconPack=Nt,this.t=It(),this.captionEnabled=!1,this.permissionsUpdateListener=()=>{var e;this.captionEnabled=(e=this.meeting.self.permissions.transcriptionEnabled)!==null&&e!==void 0?e:!1}}connectedCallback(){this.meetingChanged(this.meeting)}meetingChanged(t){t&&(this.permissionsUpdateListener(),this.meeting.self.permissions.addListener("permissionsUpdate",this.permissionsUpdateListener))}disconnectedCallback(){var t;(t=this.meeting)===null||t===void 0||t.self.permissions.removeListener("permissionsUpdate",this.permissionsUpdateListener)}toggleCaptions(){this.stateUpdate.emit({activeCaptions:!this.states.activeCaptions,activeMoreMenu:!1})}render(){if(!this.meeting||!this.captionEnabled)return null;const t=this.states.activeCaptions;return $(mt,{tabIndex:0,role:"log","aria-label":"Picture-in-Picture mode"},$("rtk-controlbar-button",{part:"controlbar-button",size:this.size,iconPack:this.iconPack,onClick:()=>this.toggleCaptions(),icon:t?this.iconPack.captionsOff:this.iconPack.captionsOn,label:t?this.t("transcript.off"):this.t("transcript.on"),variant:this.variant}))}static get watchers(){return{meeting:["meetingChanged"]}}};G7([ge()],XE.prototype,"meeting",void 0);G7([ge()],XE.prototype,"states",void 0);G7([ge()],XE.prototype,"config",void 0);G7([ge()],XE.prototype,"iconPack",void 0);G7([ge()],XE.prototype,"t",void 0);XE.style=u7n;var h7n=Object.freeze({__proto__:null,rtk_caption_toggle:XE});const m7n=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{display:flex;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}.chat-input{position:relative;margin:var(--rtk-space-2, 8px);z-index:10;box-sizing:border-box;display:flex;flex-direction:column;border-radius:var(--rtk-border-radius-md, 8px);border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60))}textarea{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));box-sizing:border-box;padding:var(--rtk-space-3, 12px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}textarea::-moz-placeholder{color:rgb(var(--rtk-colors-text-1000, 255 255 255))}textarea::placeholder{color:rgb(var(--rtk-colors-text-1000, 255 255 255))}textarea{border-top-left-radius:var(--rtk-border-radius-md, 8px);border-top-right-radius:var(--rtk-border-radius-md, 8px);font-family:var(--rtk-font-family, sans-serif);outline:2px solid transparent;outline-offset:2px;resize:none;overflow-y:auto;border-width:var(--rtk-border-width-none, 0);border-style:none;min-height:60px;font-size:16px}.chat-buttons{border-bottom-right-radius:var(--rtk-border-radius-md, 8px);border-bottom-left-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));display:flex;height:var(--rtk-space-8, 32px);align-items:center;justify-content:space-between;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px)}.chat-buttons .left rtk-button{margin-right:var(--rtk-space-1, 4px)}.chat-buttons .left rtk-button rtk-icon{height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}.chat-buttons .right{z-index:10}.chat-buttons .right .edit-buttons{display:flex;gap:var(--rtk-space-2, 8px)}.chat-buttons>div{display:flex;align-items:center}rtk-emoji-picker{z-index:0;position:absolute;bottom:var(--rtk-space-32, 128px);border-top:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));animation:0.3s slide-up ease}@keyframes slide-up{from{transform:translateY(100%)}to{transform:translateY(0%)}}.member-list{margin:var(--rtk-space-0, 0px);margin-top:var(--rtk-space-1, 4px);max-height:var(--rtk-space-28, 112px);min-width:var(--rtk-space-40, 160px);max-width:var(--rtk-space-64, 256px);padding:var(--rtk-space-0, 0px);position:absolute;bottom:var(--rtk-space-28, 112px);list-style-type:none;overflow-y:auto;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));border-radius:var(--rtk-border-radius-sm, 4px);--tw-border-spacing-x:var(--rtk-space-2, 8px);--tw-border-spacing-y:var(--rtk-space-2, 8px);border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y);border-style:solid;border-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / 0.5)}.member-list .member{display:flex;align-items:center;gap:var(--rtk-space-1, 4px);padding:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-4, 16px);cursor:pointer}.member-list .member rtk-avatar{flex-shrink:0;height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px);font-size:14px;color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.member-list .member span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.member-list .member:hover,.member-list .member.selected{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-700, 2 70 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.suggested-replies{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-3, 12px);display:flex;flex-wrap:nowrap;gap:var(--rtk-space-2, 8px);list-style-type:none;overflow-x:auto}.suggested-replies rtk-tooltip{flex-shrink:0}.suggested-replies li{padding:var(--rtk-space-2, 8px);border-radius:var(--rtk-border-radius-md, 8px);background-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / 0.75);color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));cursor:pointer}.suggested-replies li:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-bg-opacity))}.preview-overlay{position:absolute;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));border-radius:var(--rtk-border-radius-md, 8px)}.file-preview{position:absolute;top:var(--rtk-space-4, 16px);left:var(--rtk-space-4, 16px);max-width:-moz-fit-content;max-width:fit-content;max-height:var(--rtk-space-20, 80px)}.file-preview:hover rtk-tooltip{display:block}.file-preview rtk-tooltip{position:absolute;top:calc(var(--rtk-space-1, 4px) * -1);left:calc(var(--rtk-space-1, 4px) * -1);display:none;margin-left:calc(var(--rtk-space-1, 4px) * -1);margin-top:calc(var(--rtk-space-1, 4px) * -1)}.file-preview rtk-button{display:flex;height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);align-items:center;justify-content:center;border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));border:1px solid rgb(var(--rtk-colors-text-1000, 255 255 255))}.file-preview rtk-icon{height:var(--rtk-space-3, 12px);width:var(--rtk-space-3, 12px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.preview-image{height:var(--rtk-space-16, 64px);width:var(--rtk-space-16, 64px);-o-object-fit:cover;object-fit:cover;max-height:100%;max-width:100%;overflow:clip;border-radius:var(--rtk-border-radius-md, 8px)}.preview-file{padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));overflow:hidden;text-overflow:ellipsis;white-space:nowrap;border-radius:var(--rtk-border-radius-md, 8px);max-width:200px}@keyframes scroll-text{0%{transform:translateX(0%)}70%{transform:translateX(-100%)}80%{transform:translateX(0%)}100%{transform:translateX(0%)}}`,f7n=m7n;var Mxt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const nC="@",One=class{constructor(t){kt(this,t),this.onNewMessage=Wt(this,"rtkNewMessage",7),this.onEditMessage=Wt(this,"rtkEditMessage",7),this.onEditCancelled=Wt(this,"rtkEditCancelled",7),this.canSendTextMessage=!1,this.canSendFiles=!1,this.iconPack=Nt,this.t=It(),this.disableEmojiPicker=!1,this.prefill={},this.members=[],this.emojiPickerActive=!1,this.mentionQuery="",this.focusedMemberIndex=0,this.filePreview=null,this.fileReader=new FileReader,this.fileToUpload=null,this.handleKeyDown=e=>{if(e.key===nC&&[void 0," "].includes(this.$textArea.value.at(-1))&&(this.mentionQuery=nC),e.key==="ArrowDown"&&(this.focusedMemberIndex=Math.min(this.focusedMemberIndex+1,this.getFilteredMembers().length-1)),e.key==="ArrowUp"&&(this.focusedMemberIndex=Math.max(0,this.focusedMemberIndex-1)),(e.key==="Escape"||e.key==="Backspace"&&this.mentionQuery===nC)&&(this.mentionQuery=""),["Enter","Tab"," "].includes(e.key)&&this.mentionQuery!==""){const n=this.getFilteredMembers()[this.focusedMemberIndex];this.onMemberSelect(n),e.preventDefault();return}e.key==="Enter"&&e.shiftKey?this.$textArea.clientHeight<200&&(this.$textArea.style.height=this.$textArea.clientHeight+20+"px"):e.key==="Enter"?(e.preventDefault(),this.prefill.editMessage?this.handleEditMessage():this.handleSendMessage()):e.key==="Backspace"&&(this.$textArea.value.endsWith(`
`)?this.$textArea.style.height=this.$textArea.clientHeight-20+"px":this.$textArea.value===""&&(this.$textArea.style.height="auto"))},this.handleKeyUp=e=>{if(this.mentionQuery!==""){const n=p3(this.$textArea.value.trim()),r=n.substring(0,n.indexOf(nC));this.mentionQuery=`${nC}${p3(r)}`}},this.onPaste=e=>{const n=e.clipboardData||e.originalEvent.clipboardData;Dc(()=>{n&&n.items&&n.items.length>0&&($bt(n.items,this.generateFilePreview),this.$textArea.value="")})},this.generateFilePreview=(e,n)=>{this.fileToUpload={type:e,image:n,file:n},e==="image"?this.fileReader.readAsDataURL(n):e==="file"&&(this.filePreview=n.name)},this.sendFile=()=>{this.canSendFiles&&(this.fileToUpload.type==="image"?this.onNewMessage.emit({type:"image",file:this.fileToUpload.image,image:this.fileToUpload.image}):this.onNewMessage.emit({type:"file",file:this.fileToUpload.file}),this.cleanUpFileUpload())},this.handleSendMessage=()=>{if(!this.canSendTextMessage)return;if(this.fileToUpload!==null){this.sendFile();return}const e=this.$textArea.value.trim();e.length>0&&(this.prefill.replyMessage?this.onNewMessage.emit({type:"text",message:e,replyTo:this.prefill.replyMessage}):this.onNewMessage.emit({type:"text",message:e}),this.cleanup())},this.cleanup=()=>{this.mentionQuery="",this.focusedMemberIndex=0,this.$textArea.value="",this.$textArea.style.height="auto",Ef.setItem(this.storageKey,"")},this.handleEditMessage=()=>{var e;let n=this.$textArea.value.trim();!((e=this.prefill.editMessage)===null||e===void 0)&&e.message&&jNe.test(this.prefill.editMessage.message)&&(n=`${ENe(this.prefill.editMessage.message)}

${n}`),this.onEditMessage.emit({id:this.prefill.editMessage.id,message:n}),this.cleanup()},this.handleEditCancel=()=>{this.onEditCancelled.emit(),this.cleanup()},this.initializeTextField=e=>{this.$textArea=e;const n=Ef.getItem(this.storageKey)||"";this.$textArea.value=n},this.onMemberSelect=e=>{const n=p3(this.mentionQuery),r=p3(this.$textArea.value.trim()).replace(n,"");this.$textArea.value=p3(r)+`${nC}${e.name} `,this.mentionQuery="",this.focusedMemberIndex=0,Dc(()=>this.$textArea.focus())},this.getFilteredMembers=()=>{const e=this.mentionQuery.replace(nC,"");return this.members.filter(n=>n.name.toLowerCase().includes(e.toLowerCase()))},this.cleanUpFileUpload=()=>{this.filePreview=null,this.fileToUpload=null},this.renderSuggestedReplies=()=>{if(this.prefill.suggestedReplies&&this.prefill.suggestedReplies.length!==0)return $("ul",{class:"suggested-replies scrollbar"},this.prefill.suggestedReplies.map(e=>$("rtk-tooltip",{label:this.t("chat.click_to_send")},$("li",{onClick:()=>this.onNewMessage.emit({type:"text",message:e})},e))))},this.renderMenu=()=>{if(this.mentionQuery.length===0)return;const e=this.getFilteredMembers();if(e.length!==0)return $("ul",{class:"member-list scrollbar"},e.map((n,r)=>$("li",{class:{member:!0,selected:r===this.focusedMemberIndex},onClick:()=>this.onMemberSelect(n),ref:s=>{r===this.focusedMemberIndex&&Dc(()=>{s&&s.scrollIntoView({behavior:"smooth",block:"end",inline:"nearest"})})}},$("rtk-avatar",{participant:{name:n.name,picture:n.picture},size:"sm"}),$("span",null,n.name))))}}connectedCallback(){this.fileReader.onload=t=>{typeof t.target.result=="string"&&(this.filePreview=t.target.result)}}componentDidRender(){(this.prefill.editMessage||this.prefill.replyMessage)&&Dc(()=>this.$textArea.focus())}get storageKey(){return"rtk-text-message"}uploadFile(t){const e=document.createElement("input");e.type="file",t==="image"&&(e.accept="image/*"),e.onchange=n=>{const{validity:r,files:[s]}=n.target;r.valid&&this.generateFilePreview(t,s)},e.click()}renderFilePreview(){if(typeof this.filePreview=="string")return $("div",{class:"preview-overlay"},$("div",{class:"file-preview"},$("rtk-tooltip",{label:this.t("chat.cancel_upload")},$("rtk-button",{variant:"secondary",kind:"icon",onClick:this.cleanUpFileUpload},$("rtk-icon",{icon:this.iconPack.dismiss}))),this.fileToUpload.type==="image"?$("img",{class:"preview-image",src:this.filePreview}):$("div",{class:"preview-file"},$("span",null,this.filePreview))))}render(){var t;let e="";return!((t=this.prefill.editMessage)===null||t===void 0)&&t.message&&(e=NNe(this.prefill.editMessage.message)),$(mt,{key:"c1bbf529244184de2062ddb50b40a918fe6b89f0"},this.canSendTextMessage&&this.emojiPickerActive&&$("rtk-emoji-picker",{key:"62c92f177bdf7ff725a345efd948fbd07e58efda",part:"emoji-picker",onPickerClose:()=>{this.emojiPickerActive=!1},onRtkEmojiClicked:n=>{this.$textArea.value+=n.detail,this.$textArea.focus()},t:this.t}),this.renderSuggestedReplies(),$("slot",{key:"02f70148bdae1f9e3b9fc60d088c59f85af68880",name:"chat-addon"}),$("slot",{key:"0ac47b719d6c39807076f86bcd0fe4fb9b75fcd5",name:"quote-block"}),$("div",{key:"e88db8097f1615f62235c41262700c0c11bc0453",class:"chat-input",part:"chat-input"},this.renderMenu(),this.canSendTextMessage&&$("textarea",{key:"f1aa0c834b37e25a7e3093d10b6ad4531d58c0e8",class:"scrollbar",part:"textarea",ref:this.initializeTextField,autoFocus:!0,placeholder:this.fileToUpload?"":this.t("chat.message_placeholder"),value:e,onPaste:this.onPaste,maxLength:k6,onKeyDown:this.handleKeyDown,onKeyUp:this.handleKeyUp,onInput:n=>{Ef.setItem(this.storageKey,n.target.value)},disabled:!!this.filePreview}),$("div",{key:"724a8e40a0384c4f11efca4d7abf081b110a7c9f",class:"chat-buttons",part:"chat-buttons"},$("div",{key:"028b74f93d7b8ba1964460ea80ed4c63d56e5146",class:"left",part:"chat-buttons-left"},!this.prefill.editMessage&&this.canSendFiles&&[$("rtk-tooltip",{key:"e4b0edc4f6a0f8f8b91ec4925dbd661c3e3b1a32",label:this.t("chat.send_file")},$("rtk-button",{key:"53f030c9720362995342eb1959da07136c44724b",variant:"ghost",kind:"icon",onClick:()=>this.uploadFile("file"),title:this.t("chat.send_file")},$("rtk-icon",{key:"51bf45a1074886452e1c7d6ca80d8b5f9e7a61ba",icon:this.iconPack.attach}))),$("rtk-tooltip",{key:"d20a53b034f312ced9d7f5441da7574100cbb6e7",label:this.t("chat.send_img")},$("rtk-button",{key:"822413ff8636a33d2d70c7d10412a0ff5d043d86",variant:"ghost",kind:"icon",onClick:()=>this.uploadFile("image"),title:this.t("chat.send_img")},$("rtk-icon",{key:"af60e5ec42253e7780af31bc5f2fb9ad00ad6245",icon:this.iconPack.image})))],!this.prefill.editMessage&&this.canSendTextMessage&&!this.disableEmojiPicker&&$("rtk-tooltip",{key:"665bb180737c220297a9394f582ddd8d57135ed4",label:this.t("chat.send_emoji")},$("rtk-button",{key:"6550bd345555644e89a501df5838452206ea9c55",variant:"ghost",kind:"icon",class:{active:this.emojiPickerActive},title:this.t("chat.send_emoji"),onClick:()=>{this.emojiPickerActive=!this.emojiPickerActive}},$("rtk-icon",{key:"4ee0c02bf3efc309a58db7be0f51545d6d346a9c",icon:this.iconPack.emoji_multiple})))),!!this.filePreview&&this.renderFilePreview(),this.canSendTextMessage&&$("div",{key:"a7d3f27cbe43f591363d1ffd8858f30d457e6629",class:"right",part:"chat-buttons-right"},!this.prefill.editMessage&&$("rtk-tooltip",{key:"57fc69e04c29b54cfb8510914659f0b94c3944eb",variant:"primary",label:this.t("chat.send_msg"),delay:2e3},$("rtk-button",{key:"949e480cc2a243265f1268aff6396cd9bda20b03",kind:"icon",onClick:()=>this.handleSendMessage(),title:this.t("chat.send_msg")},$("rtk-icon",{key:"8fe5bc5391bef475805c86ab3fec94690bd71dfd",icon:this.iconPack.send}))),this.prefill.editMessage&&$("div",{key:"3e87dae17dcac9be10a20fe15252756d496bf924",class:"edit-buttons"},$("rtk-tooltip",{key:"201e7b44dc8a40cfc94bb299448a1e89c972ea92",variant:"secondary",label:this.t("cancel"),delay:2e3},$("rtk-button",{key:"64d5dc9e41bc87a654c760c709b7b7d378f28141",kind:"icon",variant:"secondary",onClick:()=>this.handleEditCancel(),title:this.t("cancel")},$("rtk-icon",{key:"7e75e511da878e45f88b75c2f23a855a8c191b9b",icon:this.iconPack.dismiss}))),$("rtk-tooltip",{key:"df6284b88ac9651d5cb1c736b92fb929ee5795a1",variant:"primary",label:this.t("chat.update_msg"),delay:2e3},$("rtk-button",{key:"c6b375320d193ccbf6658aa040302453ae361f91",kind:"icon",onClick:()=>this.handleEditMessage(),title:this.t("chat.send_msg")},$("rtk-icon",{key:"f047153809bc154526364f2e9a903449f83f51a9",icon:this.iconPack.checkmark}))))))))}};Mxt([ge()],One.prototype,"iconPack",void 0);Mxt([ge()],One.prototype,"t",void 0);One.style=f7n;var p7n=Object.freeze({__proto__:null,rtk_chat_composer_ui:One});const m$=(t,e=!0)=>{t!=null&&t.scrollTo({top:t.scrollHeight,behavior:e?"smooth":"auto"})},g7n=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;display:flex;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));word-break:break-word}.chat-container{box-sizing:border-box;display:flex;flex-direction:column;padding-top:var(--rtk-space-4, 16px);padding-bottom:var(--rtk-space-4, 16px);flex:1 0 0px;overflow-y:scroll}.chat-container .spacer{flex:1 1 auto}.chat-container .chat{flex:0 0 auto}.file-picker{display:none}.chat .head{margin-bottom:var(--rtk-space-2, 8px);display:flex;align-items:center}.chat .head .name{margin-right:var(--rtk-space-2, 8px);font-size:12px;font-weight:700}.chat .head .time{font-size:12px;color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.chat .body{overflow-wrap:break-word;line-height:1.5}.chat .body .emoji{font-size:24px}p{margin:var(--rtk-space-0, 0px);line-height:1.5}rtk-message-view{margin-top:var(--rtk-space-2, 8px);display:block;padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));box-sizing:border-box}rtk-message-view::part(message){flex-grow:1}*[is-continued] rtk-message-view{margin-top:var(--rtk-space-1, 4px)}.pinned .message-wrapper{position:relative}.pinned .pin-button{position:absolute;right:var(--rtk-space-4, 16px);top:calc(var(--rtk-space-4, 16px) * -1);display:flex;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.pinned .pin-button:hover rtk-button{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-600, 13 81 253) / var(--tw-bg-opacity))}.pinned rtk-message-view{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px)}a{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity));text-decoration-line:none}a:hover{text-decoration-line:underline}.new-chat-marker{display:flex;width:100%;align-items:center;gap:var(--rtk-space-2, 8px);--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity))}.new-chat-marker::before{content:'';height:1px;flex:1 1 0%;background-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / 0.5)}.show-new-messages-ctr{pointer-events:none;display:flex;justify-content:flex-end;padding:var(--rtk-space-3, 12px);z-index:0;margin-top:calc(var(--rtk-space-14, 56px) * -1)}.show-new-messages{pointer-events:auto;--tw-translate-y:var(--rtk-space-16, 64px);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:0;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.show-new-messages.active{--tw-translate-y:var(--rtk-space-0, 0px);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:1}`,v7n=g7n;var Lxt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};let uBe=!1;const Fne=class{constructor(t){kt(this,t),this.onPinMessage=Wt(this,"pinMessage",7),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.observingEl=[],this.autoScrollEnabled=!0,this.messages=[],this.canPinMessages=!1,this.iconPack=Nt,this.t=It(),this.now=new Date,this.showLatestMessageButton=!1,this.onScroll=e=>{const n=e.target;Dc(()=>{const{scrollTop:r,clientHeight:s,scrollHeight:i}=n;r+s+10>=i?(this.autoScrollEnabled=!0,this.showLatestMessageButton=!1):this.autoScrollEnabled=!1})},this.scrollToBottom=()=>{m$(this.$chat)},this.observeMessage=e=>{e&&this.observingEl.push(e);try{this.intersectionObserver.observe(e)}catch{}},this.getMessageActions=e=>{const n=[];return!e.pinned&&this.canPinMessages&&n.push({id:"pin_message",label:this.t("pin"),icon:this.iconPack.pin}),n},this.onMessageActionHandler=(e,n)=>{switch(e){case"pin_message":this.onPinMessage.emit(n);break}}}connectedCallback(){var t;wQ.isDev&&!uBe&&(uBe=!0,console.warn("[realtimekit-ui] `rtk-chat-messages-ui` is deprecated and will be removed in a future release. Use `rtk-chat-messages-ui-paginated` instead.")),this.lastReadTimestamp=(t=F7e.everyone)!==null&&t!==void 0?t:new Date("0001-01-01T00:00:00Z"),this.intersectionObserver=new IntersectionObserver(n=>{document.hasFocus()&&Dc(()=>{for(const r of n)r.isIntersecting&&parseInt(r.target.getAttribute("data-timestamp"))>this.lastReadTimestamp.getTime()&&(F7e[this.selectedGroup]=new Date)})});const e=()=>{this.now=new Date,this.timeout=setTimeout(()=>{this.request!=null&&(this.request=requestAnimationFrame(e))},60*1e3)};this.request=requestAnimationFrame(e),this.chatChanged(this.messages)}componentDidLoad(){this.$chat.addEventListener("scroll",this.onScroll),this.$chat.scrollTop=this.$chat.scrollHeight}componentDidRender(){this.autoScrollEnabled?m$(this.$chat):this.autoScrollEnabled==null&&m$(this.$chat,!1)}chatChanged(t){if(this.$chat!=null&&!(this.autoScrollEnabled||this.$chat.clientHeight===this.$chat.scrollHeight)){for(let e=t.length-1;e>=0;e--)if(t[e].message.time>this.lastReadTimestamp&&t[e].message.userId!==this.selfUserId){this.showLatestMessageButton=!0;break}}}selectedBucketChanged(){this.autoScrollEnabled=void 0,this.observingEl.forEach(t=>{this.intersectionObserver.unobserve(t)}),this.observingEl=[]}disconnectedCallback(){this.$chat.removeEventListener("scroll",this.onScroll),this.intersectionObserver.disconnect(),clearTimeout(this.timeout),cancelAnimationFrame(this.request)}render(){var t;let e=null,n=!1;return $(mt,{key:"5fa9062dc2937e4eb9d1210808a91c430a54535d"},$("div",{key:"6a45ba033904cc222f4461262049d71c801a8b7c",class:"chat-container scrollbar",ref:r=>this.$chat=r,part:"container"},$("div",{key:"f9cfd2960e08ddf5f024cce91f9aa6f247ebe54f",class:"spacer",part:"spacer"}),$("div",{key:"ec66c68f1d3876be4767279fe25022ca6994f1a0",class:"chat",part:"chat"},(t=this.messages)===null||t===void 0?void 0:t.map(r=>{if(r.type==="chat"){const{message:s}=r,o=!(s.userId===this.selfUserId)&&!this.autoScrollEnabled&&!n&&s.time>this.lastReadTimestamp;o&&(n=o);const l=!o&&s.userId===(e==null?void 0:e.userId)&&mxt(s.time,e==null?void 0:e.time)<2;return e=s,$("div",{"is-continued":l,key:r.message.id,ref:this.observeMessage,"data-timestamp":s.time.getTime(),class:s.pinned?"pinned":""},o&&$("div",{class:"new-chat-marker",part:"new-chat-marker"},this.t("chat.new")),$("div",{class:"message-wrapper"},$("rtk-message-view",{time:s.time,actions:this.getMessageActions(s),authorName:s.displayName,hideAuthorName:!0,hideAvatar:!0,hideMetadata:!0,viewType:"incoming",variant:"bubble",onAction:c=>this.onMessageActionHandler(c.detail,s)},!l&&$("div",{class:"head"},$("div",{class:"name"},s.displayName),!!s.time&&$("div",{class:"time",title:LNe(s.time)},kne(s.time,new Date(Date.now())))),$("div",{class:"body"},s.type==="text"&&$("rtk-text-message-view",{text:s.message,isMarkdown:!0}),s.type==="file"&&$("rtk-file-message-view",{name:s.name,url:s.link,size:s.size}),s.type==="image"&&$("rtk-image-message-view",{url:s.link,onPreview:()=>{this.stateUpdate.emit({image:s})}}))),s.pinned&&$("div",{class:"pin-button",part:"pin-button"},$("rtk-tooltip",{label:this.t("unpin")},$("rtk-button",{kind:"icon",variant:"ghost",onClick:()=>this.onMessageActionHandler("pin_message",s),disabled:!this.canPinMessages},$("rtk-icon",{icon:this.iconPack.pin,size:"sm"}))))))}return null}))),$("div",{key:"eae0a23fbe7ba44722539e98ac74eb1406bbc162",class:"show-new-messages-ctr"},$("rtk-button",{key:"05c860848174c514a28bb475157c2d81c78538ff",class:{"show-new-messages":!0,active:this.showLatestMessageButton},kind:"icon",part:"show-new-messages",onClick:this.scrollToBottom},$("rtk-icon",{key:"99b6ad3515cfbdf400cb96ca9cc2bbfd83a7deb9",icon:this.iconPack.chevron_down}))))}static get watchers(){return{messages:["chatChanged"],selectedGroup:["selectedBucketChanged"]}}};Lxt([ge()],Fne.prototype,"iconPack",void 0);Lxt([ge()],Fne.prototype,"t",void 0);Fne.style=v7n;var y7n=Object.freeze({__proto__:null,rtk_chat_messages_ui:Fne});const b7n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;height:100%;flex-direction:column;position:relative;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}",x7n=b7n;var zNe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const W7=class{constructor(t){kt(this,t),this.iconPack=Nt,this.t=It(),this.pageSize=50,this.searchMessages=async(e,n,r)=>[],this.nodeRenderer=e=>e.map(n=>$("rtk-chat-message",{key:n.id,message:n,disableControls:!0}))}render(){return $(mt,{key:"4ea17889c442ac91c4bb54896c600d17290c0715"},$("rtk-paginated-list",{key:"8fa700caf9b3a2c7329fb555baf1a979231fa71c",pageSize:this.pageSize,pagesAllowed:3,fetchData:this.searchMessages,createNodes:this.nodeRenderer}))}};zNe([ge()],W7.prototype,"meeting",void 0);zNe([ge()],W7.prototype,"iconPack",void 0);zNe([ge()],W7.prototype,"t",void 0);W7.style=x7n;var w7n=Object.freeze({__proto__:null,rtk_chat_search_results:W7});const k7n=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{display:flex;flex-direction:column}.chat-scope-selector{position:relative;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));z-index:10}.chat-scope-selector button{width:100%;border-width:var(--rtk-border-width-none, 0);border-style:none;padding:var(--rtk-space-4, 16px);display:flex;align-items:center;justify-content:space-between;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));font-size:14px;cursor:pointer;height:var(--rtk-space-12, 48px)}.chat-scope-selector button span{display:flex;align-items:center;justify-content:flex-start}.chat-scope-selector button rtk-icon{height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}.chat-scope-selector .search{position:sticky;box-sizing:border-box;display:flex;align-items:center;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));margin-left:var(--rtk-space-3, 12px);margin-right:var(--rtk-space-3, 12px);margin-top:var(--rtk-space-3, 12px);margin-bottom:var(--rtk-space-0, 0px)}.chat-scope-selector .search rtk-icon{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px);color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}.chat-scope-selector .search input{box-sizing:border-box;height:var(--rtk-space-9, 36px);width:100%;padding-right:var(--rtk-space-2, 8px);border-width:var(--rtk-border-width-none, 0);border-style:none;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));outline:2px solid transparent;outline-offset:2px;border-radius:var(--rtk-border-radius-sm, 4px);font-size:14px}.chat-scope-selector .search input::-moz-placeholder{color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.chat-scope-selector .search input::placeholder{color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.chat-scope-selector .participants-container{position:absolute;width:100%;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));top:var(--rtk-space-12, 48px);animation:0.3s slide-down ease}@keyframes slide-down{from{transform:translateY(-50px)}to{transform:translateY(0%)}}.chat-scope-selector .scope-list{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0, 0px);list-style-type:none;padding-left:var(--rtk-space-0, 0px);padding-right:var(--rtk-space-0, 0px);overflow:auto;max-height:375px}.chat-scope-selector .scope-list .scope{position:relative;display:flex;flex-direction:row;align-items:center;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);padding-top:var(--rtk-space-4, 16px);padding-bottom:var(--rtk-space-4, 16px)}.chat-scope-selector .scope-list .scope:hover{cursor:pointer;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}.chat-scope-selector .scope-list .scope-special{margin-top:var(--rtk-space-4, 16px);--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}.chat-scope-selector .scope-list .everyone-icon>rtk-icon{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px);color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.chat-scope-selector .scope-list .everyone-icon{display:flex;height:100%;width:100%;align-items:center;justify-content:center;margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));font-size:12px}.unread-count.selector{position:unset;margin-left:var(--rtk-space-2, 8px)}.unread-count{position:absolute;right:var(--rtk-space-3, 12px);box-sizing:border-box;padding:var(--rtk-space-0\\.5, 2px);-webkit-user-select:none;-moz-user-select:none;user-select:none;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));font-size:12px;color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));display:flex;height:var(--rtk-space-5, 20px);min-width:var(--rtk-space-5, 20px);align-items:center;justify-content:center;border-radius:9999px;z-index:1}rtk-avatar{height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px)}`,S7n=k7n;var Dxt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const Bne=class{constructor(t){kt(this,t),this.groupChanged=Wt(this,"rtkChatGroupChanged",7),this.unreadCounts={},this.groups=[],this.iconPack=Nt,this.t=It(),this.showParticipantsPanel=!1,this.query="",this.onScopeClick=e=>{this.showParticipantsPanel=!1,this.groupChanged.emit(e)}}toggleParticipants(){this.showParticipantsPanel=!this.showParticipantsPanel}getGroups(){return this.groups.filter(t=>t.name.toLowerCase().includes(this.query.toLowerCase()))}getName(){if(!this.selectedGroupId||this.selectedGroupId==="everyone")return this.t("everyone");const t=this.groups.find(e=>e.userId===this.selectedGroupId);return t?t.name:this.t("everyone")}render(){const t=Object.keys(this.unreadCounts).reduce((e,n)=>e+this.unreadCounts[n],0);return $(mt,null,$("div",{class:"chat-scope-selector"},this.showParticipantsPanel&&$("div",{class:"participants-container"},$("div",{class:"search",part:"search"},$("rtk-icon",{icon:this.iconPack.search,part:"search-icon"}),$("input",{type:"search",autocomplete:"off",placeholder:this.t("search"),value:this.query,onInput:e=>{this.query=e.target.value},part:"search-input"})),$("ul",{class:"scope-list scrollbar"},this.query===""&&$("li",{class:"scope scope-special",onClick:()=>this.onScopeClick("everyone")},$("div",{class:"everyone-icon"},$("rtk-icon",{icon:this.iconPack.participants})),this.t("everyone"),this.unreadCounts.everyone>0&&$("div",{class:"unread-count",part:"unread-count"},$("span",null,this.unreadCounts.everyone))),this.getGroups().map(e=>{const n=this.unreadCounts[LOn([this.selfUserId,e.userId])];return $("li",{class:"scope",onClick:()=>this.onScopeClick(e),key:e.userId},e.name,n>0&&$("div",{class:"unread-count",part:"unread-count"},$("span",null,n)))}))),$("button",{onClick:()=>this.toggleParticipants()},$("span",null,`${this.t("to")} ${this.getName()}`,"  ",t>0&&$("div",{class:"unread-count selector"},$("span",null,t))),$("rtk-icon",{icon:this.showParticipantsPanel?this.iconPack.chevron_up:this.iconPack.chevron_down}))))}};Dxt([ge()],Bne.prototype,"iconPack",void 0);Dxt([ge()],Bne.prototype,"t",void 0);Bne.style=S7n;var C7n=Object.freeze({__proto__:null,rtk_chat_selector_ui:Bne});const Sbe=t=>{if(t&&!t.chat)return!1;const{chatPublic:e,chatPrivate:n}=t.self.permissions;return e.canSend||e.canReceive||e.text||e.files||n.canSend||n.canReceive||n.files||n.text},Cbe=t=>{if(t&&!t.polls)return!1;const{polls:e}=t.self.permissions;return e.canCreate||e.canView||e.canVote},jbe=t=>{var e;if(!(!((e=t.self.permissions)===null||e===void 0)&&e.showParticipantList)||t&&!t.participants)return!1;const n=t==null?void 0:t.self.config;return!(n&&!n.controlBar.elements.participants)},j7n=t=>{var e,n;return!!(!((n=(e=t==null?void 0:t.self)===null||e===void 0?void 0:e.permissions)===null||n===void 0)&&n.transcriptionEnabled)},Ebe=t=>{if(w6(t)||t&&!t.plugins)return!1;if(t.meta.viewType==="LIVESTREAM")return t.stage.status==="ON_STAGE";const{plugins:e}=t.self.permissions;return e.canClose||e.canStart},E7n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:block}:host([data-hidden]){display:none}.unread-count{position:absolute;right:var(--rtk-space-4, 16px);box-sizing:border-box;padding:var(--rtk-space-0\\.5, 2px);-webkit-user-select:none;-moz-user-select:none;user-select:none;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));font-size:12px;color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));display:flex;height:var(--rtk-space-5, 20px);min-width:var(--rtk-space-5, 20px);align-items:center;justify-content:center;border-radius:9999px;z-index:1}.unread-count-dot{position:absolute;right:var(--rtk-space-3, 12px);z-index:10;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));border-radius:50%;display:flex;height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);align-items:center;justify-content:center}:host([variant='horizontal']) .unread-count{right:var(--rtk-space-4, 16px);top:50%;transform:translateY(-50%)}",N7n=E7n;var Une=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const UI=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.unreadMessageCount=0,this.variant="button",this.iconPack=Nt,this.t=It(),this.chatActive=!1,this.canViewChat=!1,this.pageSize=11,this.onChatUpdate=({action:e,message:n})=>{var r;this.chatActive||e==="add"&&n.userId!==((r=this.meeting)===null||r===void 0?void 0:r.self.userId)&&this.unreadMessageCount<=10&&(this.unreadMessageCount+=1)},this.toggleChat=()=>{const e=this.states;this.chatActive=!(e!=null&&e.activeSidebar&&(e==null?void 0:e.sidebar)==="chat"),this.chatActive&&(this.unreadMessageCount=0),this.stateUpdate.emit({activeSidebar:this.chatActive,sidebar:this.chatActive?"chat":void 0,activeMoreMenu:!1})},this.updateCanView=()=>{this.canViewChat=Sbe(this.meeting)}}connectedCallback(){this.meetingChanged(this.meeting),this.statesChanged(this.states)}disconnectedCallback(){var t,e,n,r,s,i;(e=(t=this.meeting)===null||t===void 0?void 0:t.chat)===null||e===void 0||e.removeListener("chatUpdate",this.onChatUpdate),(r=(n=this.meeting)===null||n===void 0?void 0:n.stage)===null||r===void 0||r.removeListener("stageStatusUpdate",this.updateCanView),(i=(s=this.meeting)===null||s===void 0?void 0:s.self)===null||i===void 0||i.permissions.removeListener("chatUpdate",this.updateCanView)}meetingChanged(t){var e,n,r;t&&(this.setUnreadMessageCount(),this.canViewChat=Sbe(t),(e=t.chat)===null||e===void 0||e.addListener("chatUpdate",this.onChatUpdate),(n=t==null?void 0:t.stage)===null||n===void 0||n.on("stageStatusUpdate",this.updateCanView),(r=t==null?void 0:t.self)===null||r===void 0||r.permissions.on("chatUpdate",this.updateCanView))}statesChanged(t){t!=null&&(this.chatActive=t.activeSidebar===!0&&t.sidebar==="chat")}async setUnreadMessageCount(){var t,e;const n=this.meeting.chat;if(!n)return;const r=(e=(t=this.meeting.meta)===null||t===void 0?void 0:t.meetingStartedTimestamp.getTime())!==null&&e!==void 0?e:0,s=await n.fetchPublicMessages({timestamp:r,limit:this.pageSize,direction:"after"});this.unreadMessageCount=s.length}handleChatActiveChange(){!this.chatActive&&!this.states.activeSidebar&&this.buttonEl.focus()}render(){return this.meeting?this.canViewChat?$(mt,{title:this.t("chat")},this.unreadMessageCount!==0&&!this.chatActive&&$("div",{class:"unread-count",part:"unread-count"},$("span",null,this.unreadMessageCount<this.pageSize?this.unreadMessageCount:"10+")),$("rtk-controlbar-button",{ref:t=>this.buttonEl=t,part:"controlbar-button",size:this.size,iconPack:this.iconPack,class:{active:this.chatActive},onClick:this.toggleChat,icon:this.iconPack.chat,label:this.t("chat"),variant:this.variant})):$(mt,{"data-hidden":!0}):null}static get watchers(){return{meeting:["meetingChanged"],states:["statesChanged"],chatActive:["handleChatActiveChange"]}}};Une([ge()],UI.prototype,"meeting",void 0);Une([ge()],UI.prototype,"states",void 0);Une([ge()],UI.prototype,"iconPack",void 0);Une([ge()],UI.prototype,"t",void 0);UI.style=N7n;var T7n=Object.freeze({__proto__:null,rtk_chat_toggle:UI});const _7n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:inline-flex;align-items:center;-webkit-user-select:none;-moz-user-select:none;user-select:none;font-size:14px;color:rgb(var(--rtk-colors-text-1000, 255 255 255));font-variant-numeric:tabular-nums}:host([data-hidden]){display:none}:host([size='sm']){font-size:12px}rtk-icon{margin-right:var(--rtk-space-1, 4px);height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}:host([size='sm']) rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}",A7n=_7n;var $xt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const Lce=t=>Math.trunc(t).toString().padStart(2,"0"),zne=class{constructor(t){kt(this,t),this.iconPack=Nt,this.disconnectMeeting=()=>{var e,n;this.timeout&&clearTimeout(this.timeout),typeof this.request=="number"&&cancelAnimationFrame(this.request),(n=(e=this.meeting)===null||e===void 0?void 0:e.meta)===null||n===void 0||n.removeListener("meetingStartTimeUpdate",this.startedTimeUpdateListener)},this.startedTimeUpdateListener=()=>{var e,n,r;this.startedTime=(r=(n=(e=this.meeting)===null||e===void 0?void 0:e.meta)===null||n===void 0?void 0:n.meetingStartedTimestamp)===null||r===void 0?void 0:r.toISOString()}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.disconnectMeeting()}meetingChanged(t){var e,n,r;this.disconnectMeeting(),t!=null&&(this.startedTime=(n=(e=t.meta)===null||e===void 0?void 0:e.meetingStartedTimestamp)===null||n===void 0?void 0:n.toISOString(),(r=t.meta)===null||r===void 0||r.addListener("meetingStartTimeUpdate",this.startedTimeUpdateListener))}startedTimeChanged(t){if(t!==void 0){const e=()=>{this.timeDiff=(Date.now()-new Date(this.startedTime).getTime())/1e3,this.timeout=setTimeout(()=>{this.request!=null&&(this.request=requestAnimationFrame(e))},500)};this.request=requestAnimationFrame(e)}}getFormattedTime(){if(this.timeDiff==null)return null;const t=this.timeDiff;let e="";return t>=3600&&(e=`${Lce(t/3600)}:`),e+=`${Lce(t%3600/60)}:${Lce(t%60)}`,e}render(){const t=this.startedTime!==void 0;return $(mt,{key:"4592c92b870075a8ec23d89c01c382f61278983a","data-hidden":!t,tabIndex:0,role:"timer","aria-live":"off"},this.startedTime!==void 0&&[$("rtk-icon",{key:"87b1012dd7c5d7187182a2ed025868f05ed010e7",icon:this.iconPack.clock,"aria-hidden":!0,tabIndex:-1,part:"icon"}),$("span",{key:"6fec2fef30be9c54a3e68108fde81a59ce000576",part:"text"},this.getFormattedTime())])}static get watchers(){return{meeting:["meetingChanged"],startedTime:["startedTimeChanged"]}}};$xt([ge()],zne.prototype,"meeting",void 0);$xt([ge()],zne.prototype,"iconPack",void 0);zne.style=A7n;var P7n=Object.freeze({__proto__:null,rtk_clock:zne});const R7n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:flex;align-items:center;gap:var(--rtk-space-0\\.5, 2px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px);position:relative;z-index:10}@media only screen and (max-device-height: 480px) and (orientation: landscape){:host{padding-top:var(--rtk-space-0, 0px) !important}}",I7n=R7n;var q7=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const eN=class{constructor(t){kt(this,t),this.variant="solid",this.disableRender=!1,this.config=Os(),this.iconPack=Nt,this.t=It()}render(){const t={meeting:this.meeting,config:this.config,states:this.states,t:this.t,iconPack:this.iconPack,size:this.size};return $(mt,{key:"68af3001ce88b084a7f11db7bbd201cad5bf477f"},!this.disableRender&&$(tc,{key:"0f9084065a6ffb76744d97c78b81cb62022fe6af",element:"rtk-controlbar",defaults:t,onlyChildren:!0}),$("slot",{key:"fb6acf7e94afc107c0ce8dc721c568020f5fd35c"}))}};q7([ge()],eN.prototype,"meeting",void 0);q7([ge()],eN.prototype,"config",void 0);q7([ge()],eN.prototype,"states",void 0);q7([ge()],eN.prototype,"iconPack",void 0);q7([ge()],eN.prototype,"t",void 0);eN.style=I7n;var M7n=Object.freeze({__proto__:null,rtk_controlbar:eN});const L7n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}",D7n=L7n;var Vne=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const zI=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.variant="button",this.t=It(),this.iconPack=Nt}toggleDebugger(){var t;this.stateUpdate.emit({activeDebugger:!(!((t=this.states)===null||t===void 0)&&t.activeDebugger),activeMoreMenu:!1})}render(){return $(mt,{key:"33f74fc915ee6fe35432cda13c27812bc505e516",title:this.t("Troubleshooting")},$("rtk-controlbar-button",{key:"24981c8bbaaa255dd0c7f77d9ef13eee0c9939a7",size:this.size,iconPack:this.iconPack,onClick:()=>this.toggleDebugger(),icon:this.iconPack.debug,label:this.t("Troubleshooting"),variant:this.variant}))}};Vne([ge()],zI.prototype,"meeting",void 0);Vne([ge()],zI.prototype,"states",void 0);Vne([ge()],zI.prototype,"t",void 0);Vne([ge()],zI.prototype,"iconPack",void 0);zI.style=D7n;var $7n=Object.freeze({__proto__:null,rtk_debugger_toggle:zI});const O7n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}",F7n=O7n;var K7=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const tN=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.config=Os(),this.iconPack=Nt,this.t=It(),this.updateStoreState=(e,n)=>{this.stateUpdate.emit({[e]:n})},this.cancelJoinStage=async()=>{var e,n,r;((e=this.meeting.stage)===null||e===void 0?void 0:e.status)==="ACCEPTED_TO_JOIN_STAGE"&&await((r=(n=this.meeting)===null||n===void 0?void 0:n.stage)===null||r===void 0?void 0:r.leave()),this.updateStoreState("activeJoinStage",!1)},this.joinStage=async()=>{await this.meeting.stage.join()},this.stageStatusUpdateListener=e=>{var n;!((n=this.states)===null||n===void 0)&&n.activeJoinStage&&e==="ON_STAGE"&&this.updateStoreState("activeJoinStage",!1)}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var t;(t=this.meeting.stage)===null||t===void 0||t.removeListener("stageStatusUpdate",this.stageStatusUpdateListener)}meetingChanged(t){if(!t)return;const{stage:e}=t;e==null||e.addListener("stageStatusUpdate",this.stageStatusUpdateListener)}render(){var t,e,n,r;if(!this.meeting)return;const s={meeting:this.meeting,states:this.states,config:this.config,size:this.size,iconPack:this.iconPack,t:this.t},i=this.states;if((i==null?void 0:i.image)!=null){const o=i.image,l=()=>{this.stateUpdate.emit({image:null})};return $(mt,null,$("rtk-dialog",{open:!0,onRtkDialogClose:l,hideCloseButton:!0,iconPack:this.iconPack,t:this.t},$(tc,{element:"rtk-image-viewer",defaults:s,props:{image:o,onClose:l}})))}else{if((i==null?void 0:i.activeSettings)===!0)return $(mt,null,$("rtk-dialog",{open:!0,onRtkDialogClose:()=>this.updateStoreState("activeSettings",!1),iconPack:this.iconPack,t:this.t},$(tc,{element:"rtk-settings",defaults:s})));if((i==null?void 0:i.activeDebugger)===!0)return $(mt,null,$("rtk-dialog",{open:!0,onRtkDialogClose:()=>this.updateStoreState("activeDebugger",!1),iconPack:this.iconPack,t:this.t},$("rtk-debugger",Object.assign({},s))));if((i==null?void 0:i.activeLeaveConfirmation)===!0)return $(mt,null,$("rtk-dialog",{open:!0,onRtkDialogClose:()=>this.updateStoreState("activeLeaveConfirmation",!1),iconPack:this.iconPack,t:this.t},$("rtk-leave-meeting",Object.assign({},s))));if(((t=i==null?void 0:i.activePermissionsMessage)===null||t===void 0?void 0:t.enabled)===!0)return $(mt,null,$("rtk-dialog",{open:!0,hideCloseButton:!0,iconPack:this.iconPack,t:this.t},$("rtk-permissions-message",Object.assign({},s))));if(((e=i==null?void 0:i.activeBreakoutRoomsManager)===null||e===void 0?void 0:e.active)===!0)return $(mt,null,$("rtk-dialog",{open:!0,onRtkDialogClose:()=>this.updateStoreState("activeBreakoutRoomsManager",{active:!1,data:void 0}),iconPack:this.iconPack,t:this.t},$("rtk-breakout-rooms-manager",Object.assign({},s))));if(((n=i==null?void 0:i.activeConfirmationModal)===null||n===void 0?void 0:n.active)===!0)return $(mt,null,$("rtk-dialog",{open:!0,onRtkDialogClose:()=>this.updateStoreState("activeConfirmationModal",!1),iconPack:this.iconPack,t:this.t},$("rtk-confirmation-modal",Object.assign({},s))));if(((r=i==null?void 0:i.activeOverlayModal)===null||r===void 0?void 0:r.active)===!0)return $(mt,null,$("rtk-overlay-modal",{meeting:this.meeting,states:this.states,iconPack:this.iconPack,t:this.t}));if(i!=null&&i.activeBroadcastMessageModal)return $(mt,null,$("rtk-dialog",{open:!0,onRtkDialogClose:()=>this.updateStoreState("activeBroadcastMessageModal",!1),iconPack:this.iconPack,t:this.t},$("rtk-broadcast-message-modal",Object.assign({},s))));if((i==null?void 0:i.activeJoinStage)===!0){const o={title:this.t("stage.join_title"),label:{accept:this.t("stage.join_confirm"),reject:this.t("stage.join_cancel")},description:this.t("stage.join_summary")};return $(mt,null,$("rtk-dialog",{open:!0,onRtkDialogClose:this.cancelJoinStage,iconPack:this.iconPack,t:this.t},$("rtk-join-stage",Object.assign({dataConfig:o,onRtkJoinStage:this.joinStage,onRtkLeaveStage:this.cancelJoinStage},s))))}else if((i==null?void 0:i.activeMuteAllConfirmation)===!0)return $(mt,null,$("rtk-dialog",{open:!0,onRtkDialogClose:()=>{this.updateStoreState("activeMuteAllConfirmation",!1)},iconPack:this.iconPack,t:this.t},$("rtk-mute-all-confirmation",Object.assign({},s))))}}static get watchers(){return{meeting:["meetingChanged"]}}};K7([ge()],tN.prototype,"meeting",void 0);K7([ge()],tN.prototype,"config",void 0);K7([ge()],tN.prototype,"states",void 0);K7([ge()],tN.prototype,"iconPack",void 0);K7([ge()],tN.prototype,"t",void 0);tN.style=F7n;var B7n=Object.freeze({__proto__:null,rtk_dialog_manager:tN});const U7n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{height:100%;width:100%;-webkit-user-select:none;-moz-user-select:none;user-select:none;display:flex;flex-direction:column;align-items:center;justify-content:center}.ctr{display:flex;flex-direction:column;align-items:center;gap:var(--rtk-space-8, 32px)}rtk-logo.loaded{height:var(--rtk-space-12, 48px)}.rejoin-button{margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-4, 16px);padding-top:var(--rtk-space-6, 24px);padding-bottom:var(--rtk-space-6, 24px);padding-left:var(--rtk-space-16, 64px);padding-right:var(--rtk-space-16, 64px)}.rejoin-icon{margin-right:var(--rtk-space-2, 8px)}p{font-size:16px;border-radius:var(--rtk-border-radius-lg, 12px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));padding-left:var(--rtk-space-8, 32px);padding-right:var(--rtk-space-8, 32px);padding-top:var(--rtk-space-4, 16px);padding-bottom:var(--rtk-space-4, 16px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}p.breakout{font-size:20px;display:flex;flex-direction:column;align-items:center}p.breakout span{margin-top:var(--rtk-space-1, 4px);margin-bottom:var(--rtk-space-0, 0px);color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}span{margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-4, 16px);font-size:14px}",z7n=U7n;var Y7=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const nN=class{constructor(t){kt(this,t),this.config=Os(),this.icon=Nt,this.t=It(),this.iconPack=Nt,this.message=""}connectedCallback(){this.statesChanged(this.states)}getBreakoutRoomsMessage(t){var e;let n;return(t==null?void 0:t.roomLeftState)==="connected-meeting"&&(((e=this.states.activeBreakoutRoomsManager)===null||e===void 0?void 0:e.destinationMeetingId)===this.meeting.connectedMeetings.parentMeeting.id?n="breakout_rooms.move_reason.switch_main_room":n="breakout_rooms.move_reason.switch_room"),n}statesChanged(t){if(t!=null)switch(t==null?void 0:t.roomLeftState){case"left":this.message="ended.left";break;case"kicked":this.message="ended.kicked";break;case"disconnected":this.message="ended.disconnected";break;case"rejected":this.message="ended.rejected";break;case"connected-meeting":this.message=this.getBreakoutRoomsMessage(t);break;case"unauthorized":this.message="ended.unauthorized";break;default:this.message="ended"}}renderBreakoutRoomScreen(){return $(mt,null,$("div",{class:"ctr",part:"container"},$("rtk-icon",{icon:this.iconPack.breakout_rooms}),$("p",{part:"message",class:"breakout"},this.t(this.message))))}render(){if(!this.meeting)return null;const t=this.states;return t.roomLeftState==="connected-meeting"?this.renderBreakoutRoomScreen():$(mt,null,$("div",{class:"ctr",part:"container"},$("rtk-logo",{meeting:this.meeting,config:this.config,part:"logo",t:this.t}),$("p",{part:"message"},this.t(this.message)),(t==null?void 0:t.roomLeftState)==="disconnected"&&$("span",{part:"description"},this.t("ended.network"))))}static get watchers(){return{states:["statesChanged"]}}};Y7([ge()],nN.prototype,"config",void 0);Y7([ge()],nN.prototype,"states",void 0);Y7([ge()],nN.prototype,"t",void 0);Y7([ge()],nN.prototype,"iconPack",void 0);Y7([ge()],nN.prototype,"meeting",void 0);nN.style=z7n;var V7n=Object.freeze({__proto__:null,rtk_ended_screen:nN});const H7n="#dropzone{position:absolute;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);z-index:10;display:none;flex-direction:column;align-items:center;justify-content:center;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}#dropzone.active{display:flex;animation:0.2s slide-up ease-in}",G7n=H7n;var Oxt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const Hne=class{constructor(t){kt(this,t),this.onDropCallback=Wt(this,"dropCallback",7),this.iconPack=Nt,this.t=It(),this.dropzoneActivated=!1}connectedCallback(){if(!this.hostEl)throw new Error("hostEl prop is required");this.hostEl.addEventListener("dragover",t=>{t.preventDefault(),this.dropzoneActivated=!0}),this.hostEl.addEventListener("dragleave",()=>{this.dropzoneActivated=!1}),this.hostEl.addEventListener("drop",t=>{t.preventDefault(),this.dropzoneActivated=!1,this.onDropCallback.emit(t)})}render(){return $(mt,{key:"31d5ca1c0b9612c257ca9fb2233c6c1d2a4d049f"},$("div",{key:"697c79cbd3c736b7efb890fddfca94c393b48d08",id:"dropzone",class:{active:this.dropzoneActivated},part:"dropzone"},$("rtk-icon",{key:"3fea26663f603965ef5dfc7d548cdcfc892bbc90",icon:this.iconPack.attach}),$("p",{key:"cab674da2e590d75ad20ca66661753cb52771925"},this.t("chat.send_attachment"))))}};Oxt([ge()],Hne.prototype,"iconPack",void 0);Oxt([ge()],Hne.prototype,"t",void 0);Hne.style=G7n;var W7n=Object.freeze({__proto__:null,rtk_file_dropzone:Hne}),Gz=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function q7n(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var Fxt=q7n,K7n=typeof Gz=="object"&&Gz&&Gz.Object===Object&&Gz,Y7n=K7n,Q7n=Y7n,Z7n=typeof self=="object"&&self&&self.Object===Object&&self,J7n=Q7n||Z7n||Function("return this")(),Bxt=J7n,X7n=Bxt,eBn=function(){return X7n.Date.now()},tBn=eBn,nBn=/\s/;function rBn(t){for(var e=t.length;e--&&nBn.test(t.charAt(e)););return e}var sBn=rBn,iBn=sBn,aBn=/^\s+/;function oBn(t){return t&&t.slice(0,iBn(t)+1).replace(aBn,"")}var lBn=oBn,cBn=Bxt,dBn=cBn.Symbol,Uxt=dBn,hBe=Uxt,zxt=Object.prototype,uBn=zxt.hasOwnProperty,hBn=zxt.toString,g3=hBe?hBe.toStringTag:void 0;function mBn(t){var e=uBn.call(t,g3),n=t[g3];try{t[g3]=void 0;var r=!0}catch{}var s=hBn.call(t);return r&&(e?t[g3]=n:delete t[g3]),s}var fBn=mBn,pBn=Object.prototype,gBn=pBn.toString;function vBn(t){return gBn.call(t)}var yBn=vBn,mBe=Uxt,bBn=fBn,xBn=yBn,wBn="[object Null]",kBn="[object Undefined]",fBe=mBe?mBe.toStringTag:void 0;function SBn(t){return t==null?t===void 0?kBn:wBn:fBe&&fBe in Object(t)?bBn(t):xBn(t)}var CBn=SBn;function jBn(t){return t!=null&&typeof t=="object"}var EBn=jBn,NBn=CBn,TBn=EBn,_Bn="[object Symbol]";function ABn(t){return typeof t=="symbol"||TBn(t)&&NBn(t)==_Bn}var PBn=ABn,RBn=lBn,pBe=Fxt,IBn=PBn,gBe=NaN,MBn=/^[-+]0x[0-9a-f]+$/i,LBn=/^0b[01]+$/i,DBn=/^0o[0-7]+$/i,$Bn=parseInt;function OBn(t){if(typeof t=="number")return t;if(IBn(t))return gBe;if(pBe(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=pBe(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=RBn(t);var n=LBn.test(t);return n||DBn.test(t)?$Bn(t.slice(2),n?2:8):MBn.test(t)?gBe:+t}var FBn=OBn,BBn=Fxt,Dce=tBn,vBe=FBn,UBn="Expected a function",zBn=Math.max,VBn=Math.min;function HBn(t,e,n){var r,s,i,o,l,c,d=0,u=!1,h=!1,m=!0;if(typeof t!="function")throw new TypeError(UBn);e=vBe(e)||0,BBn(n)&&(u=!!n.leading,h="maxWait"in n,i=h?zBn(vBe(n.maxWait)||0,e):i,m="trailing"in n?!!n.trailing:m);function f(C){var j=r,E=s;return r=s=void 0,d=C,o=t.apply(E,j),o}function p(C){return d=C,l=setTimeout(b,e),u?f(C):o}function g(C){var j=C-c,E=C-d,N=e-j;return h?VBn(N,i-E):N}function v(C){var j=C-c,E=C-d;return c===void 0||j>=e||j<0||h&&E>=i}function b(){var C=Dce();if(v(C))return x(C);l=setTimeout(b,g(C))}function x(C){return l=void 0,m&&r?f(C):(r=s=void 0,o)}function w(){l!==void 0&&clearTimeout(l),d=0,r=c=s=l=void 0}function k(){return l===void 0?o:x(Dce())}function S(){var C=Dce(),j=v(C);if(r=arguments,s=this,c=C,j){if(l===void 0)return p(c);if(h)return clearTimeout(l),l=setTimeout(b,e),f(c)}return l===void 0&&(l=setTimeout(b,e)),o}return S.cancel=w,S.flush=k,S}var fA=HBn;function yBe(t,e){const n=Math.pow(10,e);return Math.floor(t*n)/n}function GBn({dimensions:t,count:e,aspectRatio:n,gap:r}){const{width:s,height:i,rows:o,cols:l}=WBn({dimensions:t,count:e,aspectRatio:n,gap:r}),c=qBn({parentDimensions:t,dimensions:{width:s,height:i},rows:o,cols:l,count:e,gap:r});return{width:s,height:i,getPosition:c}}function WBn({count:t,dimensions:e,aspectRatio:n,gap:r}){let{width:s,height:i}=e;if(s===0||i===0)return{width:0,height:0,rows:1,cols:1};s-=r*2,i-=r*2;const o=r,l=t,c=KBn(n);let d=0,u=0,h=1,m=1;const f=[];for(let p=1;p<=l;p++)f.push((s-o*(p-1))/p),f.push((i-o*(p-1))/(p*c));f.sort((p,g)=>g-p);for(const p of f)if(d=yBe(p,4),u=yBe(d*c,4),h=Math.floor((s+o)/(d+o)),m=Math.floor((i+o)/(u+o)),h*m>=l){m=Math.ceil(l/h);break}return{width:d,height:u,rows:m,cols:h}}function qBn({parentDimensions:t,dimensions:e,rows:n,cols:r,count:s,gap:i}){const{width:o,height:l}=t,{width:c,height:d}=e,u=(l-(d*n+(n-1)*i))/2;let h=(o-(c*r+(r-1)*i))/2;const m=d+i,f=c+i;let p=0,g=0;const v=s%r;function b(x){const w=s-x;w===v&&(h=(o-(c*w+(w-1)*i))/2);const k=u+g*m,S=h+p*f;return p++,(x+1)%r===0&&(g++,p=0),{top:k,left:S}}return b}const KBn=t=>{const[e,n]=t.split(":");return Number.parseInt(n)/Number.parseInt(e)},VNe={spotlight:"sm",mixed:"sm"},YBn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block;height:100%;width:100%}.offline-grid{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center}.offline-grid h3{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);margin-left:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-0, 0px);font-size:20px;font-weight:500;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}.offline-grid p{margin-top:var(--rtk-space-1, 4px);margin-bottom:var(--rtk-space-1, 4px);margin-left:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-0, 0px);text-align:center;font-size:16px;font-weight:400;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.offline-grid rtk-icon{margin-bottom:var(--rtk-space-2, 8px)}.webinar-stage{box-sizing:border-box;height:100%;display:flex;align-content:center;align-items:center;justify-content:center;text-align:center}.webinar-stage h2{margin:var(--rtk-space-0, 0px);font-weight:normal}rtk-viewer-count{display:none}.ctr{display:flex;flex-direction:column;align-items:center}.message{font-size:16px;border-radius:var(--rtk-border-radius-lg, 12px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));padding-left:var(--rtk-space-8, 32px);padding-right:var(--rtk-space-8, 32px);padding-top:var(--rtk-space-4, 16px);padding-bottom:var(--rtk-space-4, 16px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.description{margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-4, 16px);font-size:14px}rtk-livestream-indicator{display:none}@media only screen and (max-device-height: 480px) and (orientation: landscape){rtk-viewer-count[variant='embedded']{position:absolute;top:var(--rtk-space-0, 0px);right:var(--rtk-space-2, 8px);z-index:20;margin-top:var(--rtk-space-0, 0px);margin-left:var(--rtk-space-0, 0px);display:flex}rtk-livestream-indicator{position:absolute;top:var(--rtk-space-0, 0px);left:var(--rtk-space-2, 8px);z-index:20;margin-top:var(--rtk-space-0, 0px);margin-left:var(--rtk-space-0, 0px);display:flex}}",QBn=YBn;var Q7=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const bBe=50,rN=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.hideSelf=!1,this.participants=[],this.pinnedParticipants=[],this.screenShareParticipants=[],this.plugins=[],this.emptyStage=!1,this.showLiveStreamPlayer=!1,this.canCurrentPeerHost=!1,this.pipSupported=!1,this.pipEnabled=!1,this.hidden=!1,this.layout="row",this.aspectRatio="16:9",this.gap=8,this.config=Os(),this.iconPack=Nt,this.t=It(),this.gridSize=VNe,this.overrides={},this.invalidRoomStates=["init","waitlisted","ended","kicked","rejected"],this.filterParticipants=e=>{var n;if(this.overrides&&(!((n=this.overrides)===null||n===void 0)&&n.videoUnsubscribed)){const r=this.overrides.videoUnsubscribed.preset;r.length>0&&(e=e.filter(s=>!r.some(o=>s.presetName===void 0?!1:s.presetName.match(o))))}return e},this.onViewModeChanged=()=>{this.meeting&&this.updateActiveParticipants()},this.onParticipantJoined=fA(()=>{this.updateActiveParticipants()},bBe),this.onParticipantLeft=fA(()=>{this.updateActiveParticipants()},bBe),this.stageStatusListener=()=>{this.updateActiveParticipants(),this.showLiveStreamPlayer=w6(this.meeting),this.meeting.stage.status!=="ON_STAGE"&&this.removeScreenShare(this.meeting.self)},this.peerStageStatusListener=e=>{this.updateActiveParticipants(),this.meeting.stage.status!=="ON_STAGE"&&(this.removePinned(e),this.removeScreenShare(e))},this.onScreenShareUpdate=e=>{e.screenShareEnabled?this.addScreenShare(e):this.removeScreenShare(e)},this.onSelfScreenShareUpdate=({screenShareEnabled:e})=>{e?this.addScreenShare(this.meeting.self):this.removeScreenShare(this.meeting.self)},this.toggleTileListener=({hidden:e})=>{this.hidden=e,this.updateActiveParticipants()},this.onPluginStateUpdate=(e,{active:n})=>{n?this.plugins.some(r=>r.id===e.id)||(this.plugins=[...this.plugins,e]):this.plugins=this.plugins.filter(r=>r.id!==e.id)},this.onParticipantPinned=()=>{this.updateActiveParticipants()},this.onParticipantUnpinned=()=>{this.updateActiveParticipants()},this.updateRoomStateListener=()=>{this.roomState=this.meeting.self.roomState}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.disconnectMeeting(this.meeting)}disconnectMeeting(t){var e;if(!t)return;this.participants=[],this.plugins=[];const{self:n,participants:r,plugins:s}=t;n.removeListener("pinned",this.onParticipantPinned),n.removeListener("unpinned",this.onParticipantUnpinned),n.removeListener("roomLeft",this.updateRoomStateListener),n.removeListener("roomJoined",this.updateRoomStateListener),n.removeListener("screenShareUpdate",this.onSelfScreenShareUpdate),n.removeListener("toggleTile",this.toggleTileListener),s==null||s.all.removeListener("stateUpdate",this.onPluginStateUpdate),(e=t.stage)===null||e===void 0||e.removeListener("stageStatusUpdate",this.stageStatusListener),r.removeListener("viewModeChanged",this.onViewModeChanged),r.active.removeListener("participantLeft",this.onParticipantLeft),r.active.removeListener("participantJoined",this.onParticipantJoined),r.pinned.removeListener("participantJoined",this.onParticipantPinned),r.pinned.removeListener("participantLeft",this.onParticipantUnpinned),r.joined.removeListener("screenShareUpdate",this.onScreenShareUpdate),r.joined.removeListener("stageStatusUpdate",this.peerStageStatusListener)}meetingChanged(t,e){var n,r,s,i;if(e!==null&&this.disconnectMeeting(e),t!=null){const{self:o,participants:l,plugins:c,stage:d}=t;this.pipSupported=((n=this.meeting.participants.pip)===null||n===void 0?void 0:n.isSupported())&&((r=t.self.config)===null||r===void 0?void 0:r.pipMode),this.pipSupported&&this.meeting.participants.pip.init();const{permissions:u}=o;this.roomState=o.roomState;const h=this.meeting.stage.status!=="ON_STAGE",m=u==null?void 0:u.isRecorder;this.hideSelf=h||m||u.hiddenParticipant,this.participants=this.filterParticipants([...l.active.toArray(),...!o.isPinned&&!this.hideSelf?[o]:[]]),this.pinnedParticipants=[...l.pinned.toArray(),...o.isPinned&&!this.hideSelf?[o]:[]],this.screenShareParticipants=l.joined.toArray().filter(f=>f.screenShareEnabled),this.plugins=(c==null?void 0:c.active.toArray())||[],u!=null&&u.stageEnabled&&(this.canCurrentPeerHost=u.acceptStageRequests||u.canProduceAudio==="ALLOWED"||u.canProduceVideo==="ALLOWED"||u.canProduceScreenshare==="ALLOWED",this.updateStage()),this.hidden=t.self.hidden,o.addListener("roomLeft",this.updateRoomStateListener),o.addListener("roomJoined",this.updateRoomStateListener),o.addListener("screenShareUpdate",this.onSelfScreenShareUpdate),o.addListener("pinned",this.onParticipantPinned),o.addListener("unpinned",this.onParticipantUnpinned),o.addListener("toggleTile",this.toggleTileListener),d==null||d.addListener("stageStatusUpdate",this.stageStatusListener),c==null||c.all.addListener("stateUpdate",this.onPluginStateUpdate),l.addListener("viewModeChanged",this.onViewModeChanged),l.active.addListener("participantLeft",this.onParticipantLeft),(s=l==null?void 0:l.joined)===null||s===void 0||s.on("stageStatusUpdate",this.peerStageStatusListener),l.joined.addListener("screenShareUpdate",this.onScreenShareUpdate),l.active.addListener("participantJoined",this.onParticipantJoined),l.pinned.addListener("participantJoined",this.onParticipantPinned),l.pinned.addListener("participantLeft",this.onParticipantUnpinned),!((i=t.stage)===null||i===void 0)&&i.status&&this.stageStatusListener()}}overridesChanged(t){this.updateActiveParticipants()}screenShareParticipantsChanged(t){const e=t.length>0;!!this.states.activeScreenShare!==e&&(this.stateUpdate.emit({activeScreenShare:e}),this.states.activeScreenShare=e)}pluginsChanged(t){const e=t.length>0;!!this.states.activePlugin!==e&&(this.stateUpdate.emit({activePlugin:e}),this.states.activePlugin=e)}pinnedParticipantsChanged(t){const e=t.length>0;!!this.states.activeSpotlight!==e&&(this.stateUpdate.emit({activeSpotlight:e}),this.states.activeSpotlight=e)}updateActiveParticipants(){var t;const{self:e,participants:n,stage:r}=this.meeting;this.hideSelf=this.hidden||r.status!=="ON_STAGE"||((t=e.permissions)===null||t===void 0?void 0:t.isRecorder)||e.permissions.hiddenParticipant,this.participants=this.filterParticipants([...n.active.toArray().filter(s=>s.id!==e.id),...n.viewMode==="ACTIVE_GRID"&&!e.isPinned&&!this.hideSelf?[e]:[]]),this.pinnedParticipants=[...n.pinned.toArray().filter(s=>s.id!==e.id),...e.isPinned&&!this.hideSelf?[e]:[]],this.screenShareParticipants=n.joined.toArray().filter(s=>s.screenShareEnabled),e.screenShareEnabled&&(this.screenShareParticipants=this.screenShareParticipants.concat([e])),this.updateStage()}updateStage(){var t;const{self:e}=this.meeting;this.meeting&&(!((t=e==null?void 0:e.permissions)===null||t===void 0)&&t.stageEnabled?this.emptyStage=this.participants.length===0&&this.pinnedParticipants.length===0:this.emptyStage=!1)}addScreenShare(t){this.screenShareParticipants.some(e=>e.id===t.id)||(this.screenShareParticipants=[...this.screenShareParticipants,t])}removeScreenShare(t){this.screenShareParticipants=this.screenShareParticipants.filter(e=>e.id!==t.id)}removePinned(t){this.pinnedParticipants=this.pinnedParticipants.filter(e=>e.id!==t.id)}render(){var t,e,n,r;const s={meeting:this.meeting,size:this.size,states:this.states,config:this.config,iconPack:this.iconPack,t:this.t};if(this.invalidRoomStates.includes(this.roomState))return $(mt,null,$("div",{class:"offline-grid"},$("rtk-icon",{icon:this.iconPack.join_stage,size:"xl"}),$("h3",null,this.t("disconnected")),$("p",null,this.t("disconnected.description"))));if(this.roomState==="disconnected"){const i=(e=(t=this.meeting)===null||t===void 0?void 0:t.meta)===null||e===void 0?void 0:e.mediaState;if(!(((n=i==null?void 0:i.send)===null||n===void 0?void 0:n.state)==="connected"&&((r=i==null?void 0:i.recv)===null||r===void 0?void 0:r.state)==="connected"))return $(mt,null,$("div",{class:"offline-grid"},$("rtk-icon",{icon:this.iconPack.disconnected,size:"xl"}),$("h3",null,this.t("offline")),$("p",null,this.t("offline.description"))))}return this.roomState==="failed"?$(mt,null,$("div",{class:"offline-grid"},$("rtk-icon",{icon:this.iconPack.disconnected,size:"xl"}),$("h3",null,this.t("failed")),$("p",null,this.t("failed.description")))):this.showLiveStreamPlayer?$(mt,null,$("rtk-livestream-player",{meeting:this.meeting,size:this.size}),$("rtk-livestream-indicator",{meeting:this.meeting,size:"sm",t:this.t}),$("rtk-viewer-count",{meeting:this.meeting,variant:"embedded",t:this.t})):this.emptyStage?$(mt,null,$("div",{class:"webinar-stage"},$("div",{class:"center"},this.canCurrentPeerHost&&$("div",{class:"ctr",part:"container"},$("p",{class:"message",part:"message"},this.t("stage.empty_host")),$("span",{class:"description",part:"description"},this.t("stage.empty_host_summary"))),!this.canCurrentPeerHost&&$("div",{class:"ctr",part:"container"},$("p",{class:"message",part:"message"},this.t("stage.empty_viewer")))))):$(mt,null,$(tc,{element:"rtk-grid",defaults:s,childProps:{participants:this.participants,screenShareParticipants:this.screenShareParticipants,plugins:this.plugins,pinnedParticipants:this.pinnedParticipants,aspectRatio:this.aspectRatio,gap:this.gap,layout:this.layout,gridSize:this.gridSize},onlyChildren:!0}),$("rtk-livestream-indicator",{meeting:this.meeting,size:"sm",t:this.t}),$("rtk-viewer-count",{meeting:this.meeting,variant:"embedded",t:this.t}))}static get watchers(){return{meeting:["meetingChanged"],overrides:["overridesChanged"],screenShareParticipants:["screenShareParticipantsChanged"],plugins:["pluginsChanged"],pinnedParticipants:["pinnedParticipantsChanged"]}}};Q7([ge()],rN.prototype,"meeting",void 0);Q7([ge()],rN.prototype,"states",void 0);Q7([ge()],rN.prototype,"config",void 0);Q7([ge()],rN.prototype,"iconPack",void 0);Q7([ge()],rN.prototype,"t",void 0);rN.style=QBn;var ZBn=Object.freeze({__proto__:null,rtk_grid:rN});const JBn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center;font-size:16px}:host([data-hidden]){display:none}:host([size='sm']){font-size:12px}:host([size='sm']) .center{margin-left:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-0, 0px)}:host([size='sm']) rtk-button{height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px)}:host([size='sm']) rtk-button rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}rtk-button{--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.center{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.center .page{color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}.center .slash{margin-left:var(--rtk-space-0\\.5, 2px);margin-right:var(--rtk-space-0\\.5, 2px)}.center .pages{align-self:flex-end;font-size:12px}:host([variant='rounded']){overflow:hidden;border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}:host([variant='rounded']) rtk-button{border-radius:9999px;border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}:host([variant='rounded']) rtk-button:not([disabled]):hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}:host([variant='rounded']) rtk-button:not([disabled]):focus{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}:host([variant='grid']) rtk-button{position:absolute;top:50%;height:var(--rtk-space-20, 80px);width:var(--rtk-space-20, 80px);opacity:0.2;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}:host([variant='grid']) rtk-button:hover{opacity:1}:host([variant='grid']) rtk-button{transform:translateY(-50%)}:host([variant='grid']) rtk-button.prev{left:var(--rtk-space-0, 0px);border-top-right-radius:9999px;border-bottom-right-radius:9999px}:host([variant='grid']) rtk-button.next{right:var(--rtk-space-0, 0px);border-top-left-radius:9999px;border-bottom-left-radius:9999px}:host([variant='grid']) rtk-button.auto{left:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);border-top-right-radius:9999px;border-bottom-right-radius:9999px}:host([variant='grid']) .dots{position:absolute;left:50%;bottom:var(--rtk-space-3, 12px);display:flex;align-items:center;transform:translateX(-50%)}:host([variant='grid']) .dots .dot{margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-2, 8px);width:var(--rtk-space-2, 8px);cursor:pointer;border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}:host([variant='grid']) .dots .dot:last-child{margin-right:var(--rtk-space-0, 0px)}:host([variant='grid']) .dots .dot.active{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity))}:host([variant='grid'][size='sm']) rtk-button{height:var(--rtk-space-14, 56px);width:var(--rtk-space-14, 56px);opacity:0.1}",XBn=JBn;var Gne=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const Wz=50,VI=class{constructor(t){kt(this,t),this.variant="rounded",this.iconPack=Nt,this.t=It(),this.page=1,this.pageCount=0,this.activeCount=0,this.activeComputedCount=0,this.showPagination=!1,this.onPageChanged=({currentPage:e,pageCount:n})=>{this.pageCount=n,this.page=e},this.toggleGridPagination=fA(()=>{var e;const{self:n,participants:r}=this.meeting,{mobile:s,desktop:i}=(e=n.config)===null||e===void 0?void 0:e.maxVideoStreams,o=this.size==="sm"?s:i;r.joined.toArray().filter(c=>c.stageStatus==="ON_STAGE").length<o?this.showPagination=!1:this.showPagination=!0},Wz),this.onParticipantJoin=fA(()=>{this.pageCount=this.meeting.participants.pageCount,this.toggleGridPagination()},Wz),this.onParticipantLeave=fA(()=>{this.pageCount=this.meeting.participants.pageCount,this.toggleGridPagination()},Wz),this.onStateStatusUpdate=fA(()=>{this.pageCount=this.meeting.participants.pageCount,this.toggleGridPagination()},Wz),this.prevPage=()=>{if(!this.meeting)return;const{participants:e}=this.meeting;this.page>1?e.setPage(this.page-=1):e.viewMode==="PAGINATED"&&e.setViewMode("ACTIVE_GRID")},this.nextPage=()=>{if(!this.meeting)return;const{participants:e}=this.meeting;this.page>0&&this.page<this.pageCount?e.setPage(this.page+=1):e.count>0&&this.pageCount===0&&e.setViewMode("PAGINATED")}}connectedCallback(){this.meetingChanged(this.meeting),this.sizeChanged()}disconnectedCallback(){if(!this.meeting)return;const{participants:t,stage:e}=this.meeting;t.removeListener("pageChanged",this.onPageChanged),t.removeListener("viewModeChanged",this.onPageChanged),t.joined.removeListener("participantJoined",this.onParticipantJoin),t.joined.removeListener("participantLeft",this.onParticipantLeave),t.joined.removeListener("stageStatusUpdate",this.onStateStatusUpdate),e.removeListener("stageStatusUpdate",this.onStateStatusUpdate)}meetingChanged(t){if(t!=null){const{stage:e,participants:n}=t;this.page=n.currentPage,this.pageCount=n.pageCount,n.addListener("viewModeChanged",this.onPageChanged),n.addListener("pageChanged",this.onPageChanged),n.joined.addListener("participantJoined",this.onParticipantJoin),n.joined.addListener("participantLeft",this.onParticipantLeave),n.joined.addListener("stageStatusUpdate",this.onStateStatusUpdate),e.addListener("stageStatusUpdate",this.onStateStatusUpdate),this.activeCount=this.meeting.participants.joined.size,this.activeComputedCount=this.meeting.participants.joined.size,this.toggleGridPagination()}}sizeChanged(){this.toggleGridPagination()}render(){if(!this.meeting)return null;const{meta:t}=this.meeting;return(t==null?void 0:t.viewType)==="AUDIO_ROOM"||!this.showPagination?$(mt,{"data-hidden":!0}):$(mt,null,$("rtk-button",{class:"prev",variant:"secondary",kind:"icon",disabled:this.pageCount===0,onClick:this.prevPage,"aria-label":this.t("page.prev")},$("rtk-icon",{icon:this.iconPack.chevron_left})),this.variant!=="grid"&&$("div",{class:"center"},$("span",{class:"page"},this.pageCount===0?$("rtk-tooltip",{label:this.t("layout.auto")},$("rtk-button",{kind:"icon",class:"auto"},$("rtk-icon",{icon:this.iconPack.wand}))):this.page),this.pageCount!==0&&[$("span",{class:"slash"},"/"),$("span",{class:"pages"},this.pageCount)]),this.variant==="grid"&&this.pageCount>0&&$("div",{class:"dots"},[...Array(this.pageCount)].map((n,r)=>$("div",{key:`dot-${r}`,class:{dot:!0,active:r+1===this.page}}))),$("rtk-button",{class:"next",variant:"secondary",kind:"icon",disabled:this.page!==0&&this.page===this.pageCount,onClick:this.nextPage,"aria-label":this.t("page.next")},$("rtk-icon",{icon:this.iconPack.chevron_right,tabIndex:-1,"aria-hidden":!0})))}static get watchers(){return{meeting:["meetingChanged"],size:["sizeChanged"]}}};Gne([ge()],VI.prototype,"meeting",void 0);Gne([ge()],VI.prototype,"states",void 0);Gne([ge()],VI.prototype,"iconPack",void 0);Gne([ge()],VI.prototype,"t",void 0);VI.style=XBn;var e9n=Object.freeze({__proto__:null,rtk_grid_pagination:VI});const t9n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;height:var(--rtk-space-12, 48px);align-items:center;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}@media only screen and (max-device-height: 480px) and (orientation: landscape){:host{display:none !important}}@media only screen and (max-height: 480px) and (orientation: landscape){:host{display:none !important}}",n9n=t9n;var Z7=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const sN=class{constructor(t){kt(this,t),this.variant="solid",this.disableRender=!1,this.config=Os(),this.iconPack=Nt,this.t=It()}render(){const t={meeting:this.meeting,config:this.config,states:this.states,t:this.t,iconPack:this.iconPack,size:this.size};return $(mt,{key:"a323f95dac8cde8fdb77b1ecb0950402b7d418bb"},!this.disableRender&&$(tc,{key:"a7beb145a76f2f879af3f54c9ec08317865b17d2",element:"rtk-header",defaults:t,onlyChildren:!0}),$("slot",{key:"5bee25d9949611736d9c772e438314655ab8ae58"}))}};Z7([ge()],sN.prototype,"meeting",void 0);Z7([ge()],sN.prototype,"config",void 0);Z7([ge()],sN.prototype,"states",void 0);Z7([ge()],sN.prototype,"iconPack",void 0);Z7([ge()],sN.prototype,"t",void 0);sN.style=n9n;var r9n=Object.freeze({__proto__:null,rtk_header:sN});const s9n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{height:100%;width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center}.ctr{display:flex;flex-direction:column;align-items:center;gap:var(--rtk-space-8, 32px)}.no-network-badge{margin-top:var(--rtk-space-2, 8px);display:flex;width:100%;flex-direction:row;align-items:center;justify-content:flex-start;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));background-color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.1);padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);font-size:12px;color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.75)}.no-network-badge rtk-icon{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px)}.error-state{display:flex;width:100%;flex-direction:column;align-items:center}.troubleshoot-link{margin-top:var(--rtk-space-1, 4px);font-size:12px;--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-400, 53 110 253) / var(--tw-text-opacity));text-decoration-line:underline;text-underline-offset:2px}.troubleshoot-link:hover{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity))}.error-code{margin-top:var(--rtk-space-1, 4px);font-size:10px;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}rtk-logo.loaded{height:var(--rtk-space-12, 48px)}rtk-spinner{height:var(--rtk-space-12, 48px);width:var(--rtk-space-12, 48px);--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}",i9n=s9n;var J7=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const iN=class{constructor(t){kt(this,t),this.config=Os(),this.iconPack=Nt,this.t=It(),this.socketStateUpdate=({state:e})=>{var n;this.connectionState=e,e==="connected"&&(!((n=this.states)===null||n===void 0)&&n.joinError||(this.joinError=void 0,this.joinErrorCode=void 0))}}connectedCallback(){this.meetingChanged(this.meeting,void 0),this.statesChanged(this.states)}disconnectedCallback(){var t,e;(e=(t=this.meeting)===null||t===void 0?void 0:t.meta)===null||e===void 0||e.removeListener("socketConnectionUpdate",this.socketStateUpdate)}meetingChanged(t,e){var n,r,s,i;(n=e==null?void 0:e.meta)===null||n===void 0||n.removeListener("socketConnectionUpdate",this.socketStateUpdate),t&&(this.connectionState=(s=(r=t.meta)===null||r===void 0?void 0:r.socketState)===null||s===void 0?void 0:s.state,(i=t.meta)===null||i===void 0||i.addListener("socketConnectionUpdate",this.socketStateUpdate))}statesChanged(t){this.joinError=t==null?void 0:t.joinError,this.joinErrorCode=t==null?void 0:t.joinErrorCode}render(){const t=!!this.connectionState&&this.connectionState!=="connected"&&!this.joinError,e=this.joinError?this.joinError:this.connectionState==="failed"?this.t("network.lost_extended"):this.t("network.lost");return $(mt,{key:"31ce933ba66fc5c52da8d66500484f7a2578a845"},$("slot",{key:"6716a6b7d8d1f43ff93b8f3d8255215b29e5f41c"},$("div",{key:"ca47792dfae8a018d42e0693d2ae28c2891c8120",class:"ctr",part:"container"},$("rtk-logo",{key:"ab77174bdd736b0b5829b84ea39da26e5e93fe99",meeting:this.meeting,config:this.config,t:this.t,part:"logo"}),this.joinError||t?$("div",{class:"error-state"},$("div",{class:"no-network-badge",part:"network-badge",role:"alert"},$("rtk-icon",{size:"md",variant:"danger",icon:this.iconPack.disconnected,part:"network-badge-icon"}),e),this.meeting&&this.joinError&&$("a",{class:"troubleshoot-link",href:`https://test.realtime.cloudflare.com?authToken=${this.meeting.__internals__.authToken}`,target:"_blank",rel:"noopener noreferrer"},this.t("network.troubleshoot")),this.joinErrorCode&&$("span",{class:"error-code",part:"error-code"},this.t("join.error_code"),": ",this.joinErrorCode)):$("rtk-spinner",{"aria-label":"Idle, waiting for meeting data",part:"spinner",iconPack:this.iconPack}))))}static get watchers(){return{meeting:["meetingChanged"],states:["statesChanged"]}}};J7([ge()],iN.prototype,"meeting",void 0);J7([ge()],iN.prototype,"states",void 0);J7([ge()],iN.prototype,"config",void 0);J7([ge()],iN.prototype,"iconPack",void 0);J7([ge()],iN.prototype,"t",void 0);iN.style=i9n;var a9n=Object.freeze({__proto__:null,rtk_idle_screen:iN});const o9n=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{width:1140px;max-width:100%;box-sizing:border-box;display:flex;flex-direction:column;padding:var(--rtk-space-6, 24px);padding-top:var(--rtk-space-5, 20px);overflow-y:auto;color:rgb(var(--rtk-colors-text-1000, 255 255 255));z-index:40;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}.displayName{font-weight:700}.image-ctr{margin-top:var(--rtk-space-2, 8px);box-sizing:border-box;display:flex;justify-content:center;overflow:hidden}.actions{display:flex;align-items:center;justify-content:flex-end;gap:var(--rtk-space-2, 8px)}img{box-sizing:border-box;display:block;max-height:100%;max-width:100%;-o-object-fit:contain;object-fit:contain}.header{display:flex;align-items:center;justify-content:space-between;padding-bottom:var(--rtk-space-4, 16px)}.shared-by-user{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}:host([size='sm']) .header{flex-direction:column}:host([size='sm']) .header .actions{margin-top:var(--rtk-space-4, 16px)}`,l9n=o9n;var Vxt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const Wne=class{constructor(t){kt(this,t),this.close=Wt(this,"close",7),this.t=It(),this.iconPack=Nt,this.keypressListener=e=>{e.key==="Escape"&&this.close.emit()},this.handleOutsideClick=()=>this.close.emit()}connectedCallback(){document.addEventListener("keydown",this.keypressListener),document.addEventListener("click",this.handleOutsideClick)}disconnectedCallback(){document.removeEventListener("keydown",this.keypressListener),document.removeEventListener("click",this.handleOutsideClick)}render(){return $(mt,{key:"09122e4d61355092a9c82bc337ea002a6c2acd58",class:"scrollbar",onClick:t=>t.stopPropagation()},$("div",{key:"2c6c3f705abf067d866e02b81c4b3d610f09fede",class:"header"},$("div",{key:"66cd4c200a2e8704acdf75d8830c94ac2abdc6be",class:"shared-by-user"},this.t("chat.img.shared_by")," ",$("span",{key:"3b4a866b673f35a454e7115fdc5c915d68966b1d",class:"displayName"},Rf(pm(this.image.displayName)))),$("div",{key:"29e0e95e3e3d3b36917745a8f0a47beb9b5e3f02",class:"actions"},$("rtk-button",{key:"5cd7383e265a02c8b57a0f712e9e445495498c32",onClick:()=>$7(this.image.link,{fallbackName:"image"})},$("rtk-icon",{key:"b098e89f707cc4cf413a620319e0eb2fd10b729a",icon:this.iconPack.download,slot:"start"}),"Download"),$("rtk-button",{key:"2cd6b7c21f0357d3104618d96d853d8bd8fcc542",kind:"icon",variant:"secondary",onClick:()=>this.close.emit()},$("rtk-icon",{key:"891428595d7a61c5400dc884bf8e1a501009eed5",icon:this.iconPack.dismiss})))),$("div",{key:"6194a26ac1357b93776b1c77ff72d1502151d619",class:"image-ctr"},$("img",{key:"24f21e7fff100bea8e79d261f180a57dc14fa5f4",src:this.image.link})))}};Vxt([ge()],Wne.prototype,"t",void 0);Vxt([ge()],Wne.prototype,"iconPack",void 0);Wne.style=l9n;var c9n=Object.freeze({__proto__:null,rtk_image_viewer:Wne});const d9n=":host{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);cursor:pointer}.tooltip-container{position:relative;display:flex;flex-direction:row;align-items:center}.tooltip-container rtk-icon{cursor:pointer;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}.tooltip-container rtk-icon:hover+.tooltip{display:flex !important}.tooltip{position:absolute;margin-left:var(--rtk-space-2, 8px);display:none !important;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));padding:var(--rtk-space-2, 8px);font-weight:400;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));z-index:50;display:flex;min-width:var(--rtk-space-60, 240px);flex-direction:column;--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);left:14px}",u9n=d9n;var h9n=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const HNe=class{constructor(t){kt(this,t),this.iconPack=Nt}render(){return $(mt,{key:"ff8e44d0644f3a81e71ec3595f109c396effd80e"},$("div",{key:"9b07fcd50ec2050f65008ad447b42fe0a2431fba",class:"tooltip-container"},$("rtk-icon",{key:"09393761a1ee443f54d08034c451397adf05c0a2",icon:this.iconPack.info,size:"sm"}),$("div",{key:"edcc65636e3888864a4f619b34929a494a748b43",class:"tooltip"},$("slot",{key:"298db1c52802862d8d1da4a3b9cfc33e3695163d",name:"tootlip-text"}))))}};h9n([ge()],HNe.prototype,"iconPack",void 0);HNe.style=u9n;var m9n=Object.freeze({__proto__:null,rtk_information_tooltip:HNe});const f9n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}",p9n=f9n;var Hxt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const qne=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.variant="button",this.iconPack=Nt,this.t=It(),this.leave=()=>{this.stateUpdate.emit({activeLeaveConfirmation:!0})}}render(){const t=this.t("leave");return $(mt,{key:"b81ffe328736f1df741c1ef1f88a128771b5366e",label:t},$("rtk-controlbar-button",{key:"0674e4975571a6cbccca1b1252c33405ab8c1cb4",size:this.size,iconPack:this.iconPack,class:"leave red-icon",onClick:this.leave,icon:this.iconPack.call_end,label:t,variant:this.variant,part:"controlbar-button"}))}};Hxt([ge()],qne.prototype,"iconPack",void 0);Hxt([ge()],qne.prototype,"t",void 0);qne.style=p9n;var g9n=Object.freeze({__proto__:null,rtk_leave_button:qne});const v9n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}:host([data-hidden]){display:none}",y9n=v9n;var GNe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const X7=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.apiError=Wt(this,"rtkApiError",7),this.variant="button",this.iconPack=Nt,this.t=It(),this.livestreamState="IDLE",this.livestreamStateListener=e=>{this.livestreamState=e,(e==="LIVESTREAMING"||e==="IDLE")&&this.stateUpdate.emit({activeMoreMenu:!1})},this.isLoading=()=>!this.meeting||this.livestreamState==="STARTING"||this.livestreamState==="STOPPING"}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.clearListeners()}meetingChanged(t){var e,n;t&&(this.livestreamState=(e=this.meeting.livestream)===null||e===void 0?void 0:e.state,(n=this.meeting.livestream)===null||n===void 0||n.on("livestreamUpdate",this.livestreamStateListener))}async toggleLivestream(){var t,e;if(this.livestreamState==="LIVESTREAMING")try{await((t=this.meeting.livestream)===null||t===void 0?void 0:t.stop())}catch{this.apiError.emit({trace:this.t("livestream.stop"),message:this.t("livestream.error.stop")})}else try{await((e=this.meeting.livestream)===null||e===void 0?void 0:e.start())}catch{this.apiError.emit({trace:this.t("livestream.start"),message:this.t("livestream.error.start")})}}clearListeners(){var t;(t=this.meeting.livestream)===null||t===void 0||t.removeListener("livestreamUpdate",this.livestreamStateListener)}getLivestreamLabel(){switch(this.livestreamState){case"IDLE":return this.t("livestream.go_live");case"LIVESTREAMING":return this.t("livestream.end_live");case"WAITING_ON_MANUAL_INGESTION":return this.t("livestream.waiting_on_manual_ingestion");case"STARTING":return this.t("livestream.starting");case"STOPPING":return this.t("livestream.stopping");default:return this.t("livestream.error")}}getLivestreamIcon(){switch(this.livestreamState){case"IDLE":return this.iconPack.start_livestream;case"LIVESTREAMING":return this.iconPack.stop_livestream;case"WAITING_ON_MANUAL_INGESTION":return this.iconPack.start_livestream;case"STARTING":case"STOPPING":default:return this.iconPack.stop_livestream}}render(){return this.meeting?Tbt(this.meeting)?$(mt,null,$("rtk-controlbar-button",{part:"controlbar-button",size:this.size,iconPack:this.iconPack,isLoading:this.isLoading(),class:{"active-livestream":this.livestreamState==="LIVESTREAMING"},onClick:()=>this.toggleLivestream(),icon:this.getLivestreamIcon(),disabled:this.isLoading(),label:this.t(this.getLivestreamLabel()),variant:this.variant})):$(mt,{"data-hidden":!0}):null}static get watchers(){return{meeting:["meetingChanged"]}}};GNe([ge()],X7.prototype,"meeting",void 0);GNe([ge()],X7.prototype,"iconPack",void 0);GNe([ge()],X7.prototype,"t",void 0);X7.style=y9n;var b9n=Object.freeze({__proto__:null,rtk_livestream_toggle:X7});const x9n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{-webkit-user-select:none;-moz-user-select:none;user-select:none;font-size:16px;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}:host([data-hidden]){display:none}.title{text-align:center;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}:host([size='sm']){font-size:12px}",w9n=x9n;var WNe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const eB=class{constructor(t){kt(this,t),this.iconPack=Nt,this.t=It()}render(){var t;const e=(t=this.meeting)===null||t===void 0?void 0:t.meta.meetingTitle;return e==null?$(mt,{"data-hidden":!0}):$(mt,{role:"banner","aria-label":e},$("rtk-tooltip",{label:e,part:"tooltip"},$("div",{class:"title",part:"title"},e)))}};WNe([ge()],eB.prototype,"meeting",void 0);WNe([ge()],eB.prototype,"iconPack",void 0);WNe([ge()],eB.prototype,"t",void 0);eB.style=w9n;var k9n=Object.freeze({__proto__:null,rtk_meeting_title:eB});const S9n=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}.loading{cursor:wait}.content-wrapper{height:100%;overflow-y:auto;position:relative;contain:strict}.scroller{width:1px;opacity:0}.content{position:absolute;top:0;width:100%}.smallest-dom-element{width:100%;height:2px;background:red}.loader{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);display:flex;justify-content:center}`,C9n=S9n;var j9n=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const E9n=20,v3=5,qNe=class{constructor(t){kt(this,t),this.visibleItemsCount=E9n,this.estimateItemSize=100,this.iconPack=Nt,this.isFetching=!1,this.autoScroll=!0,this.totalHeight=0,this.sizes=new Map,this.lastScrollTop=0,this.scrollToBottomRetries=0,this.elementObserver=(()=>{let e=null;const n=()=>e||(typeof ResizeObserver<"u"?e=new ResizeObserver(r=>{r.forEach(s=>{this.measureElement(s.target,s)})}):null);return{disconnect:()=>{var r;return(r=n())===null||r===void 0?void 0:r.disconnect()},observe:r=>{var s;return(s=n())===null||s===void 0?void 0:s.observe(r,{box:"border-box"})},unobserve:r=>{var s;return(s=n())===null||s===void 0?void 0:s.unobserve(r)}}})(),this.measureElement=(e,n)=>{if(!e)return;const r=e.dataset.id;if(this.sizes.has(r)){this.elementObserver.unobserve(e);return}if(n){const i=n.borderBoxSize[0];if(i&&i.blockSize>0){this.saveItemSize(r,i.blockSize),this.elementObserver.unobserve(e);return}}const s=e.getBoundingClientRect();s.height>0&&this.saveItemSize(r,s.height)},this.getVisibleItems=()=>this.messages.slice(this.range.start,this.range.end+1),this.updateVisibleItems=(e,n)=>{const r=this.messages.length;let s=e,i=n;r<=this.visibleItemsCount?(s=0,i=r-1):n-e<this.visibleItemsCount-1&&(s=this.range.end-this.visibleItemsCount+1),this.range.start!==s&&(this.range={start:s,end:i},this.totalHeight=this.getRangeSize(0,r))},this.getEstimatedItemSize=()=>this.estimateItemSize,this.getRangeSize=(e,n)=>{let r=0,s=0;for(let i=e;i<n;i++)s=this.sizes.get(this.messages[i].id),r=r+(s||this.getEstimatedItemSize());return r},this.getScrollTop=()=>this.$listRef?Math.ceil(this.$listRef.scrollTop):0,this.getClientHeight=()=>this.$listRef?Math.ceil(this.$listRef.clientHeight):0,this.getScrollHeight=()=>this.$listRef?Math.ceil(this.$listRef.scrollHeight):0,this.getItemsScrolled=()=>{const e=this.lastScrollTop;if(e<=0)return 0;let n=0,r=0,s=0,i=this.messages.length;for(;n<=i;){if(r=n+i>>>1,s=this.getRangeSize(0,r),s===e)return r;s<e?n=r+1:s>e&&(i=r-1)}return n>0?--n:0},this.getEndByStart=e=>Math.min(e+this.visibleItemsCount,this.messages.length-1),this.scrollToOffset=e=>{this.$listRef&&(this.$listRef.scrollTop=e)},this.scrollToIndex=e=>{if(e>=this.messages.length-1)this.scrollToBottom();else{const n=e<1?0:this.getRangeSize(0,e);this.scrollToOffset(n)}},this.scrollToBottom=()=>{this.$listEndRef&&Dc(()=>{this.$listEndRef.scrollIntoView(),this.getScrollHeight()-(this.getScrollTop()+this.getClientHeight())>0&&this.scrollToBottomRetries<10?setTimeout(()=>{this.scrollToBottom()},1e3/60):(this.scrollToBottomRetries=0,this.autoScroll=!0)})},this.handleScroll=async()=>{if(this.isFetching)return;const e=this.getScrollTop(),n=e<this.lastScrollTop||e===0?"UP":"DOWN";if(this.lastScrollTop=e,this.loadMore&&e===0&&n==="UP"&&this.isFetching===!1){this.isFetching=!0;const r=await this.loadMore(this.messages[0]);r&&r.length&&(this.messages=[...r,...this.messages]),this.isFetching=!1}n==="UP"?this.handleTop():n==="DOWN"&&this.handleBottom()},this.handleTop=()=>{const e=this.getItemsScrolled();if(e<=this.range.end-v3&&(this.autoScroll=!1),e>this.range.start+v3)return;const n=Math.max(this.range.start-v3,0);this.updateVisibleItems(n,this.getEndByStart(n))},this.handleBottom=()=>{if(this.getItemsScrolled()<this.range.start+v3)return;const n=this.range.start+v3,r=this.getEndByStart(n);r===this.messages.length-1?this.updateVisibleItems(r-this.visibleItemsCount,r):this.updateVisibleItems(n,r)},this.updateTotalHeight=Sne(()=>{this.totalHeight=this.getRangeSize(0,this.messages.length)},1e3/30,{leading:!0}),this.rendererInternal=(e,n,r)=>{if(!e||e.dataset.id===n.id)return;const s=this.renderer(n,r);e.hasChildNodes&&(e.innerHTML=""),this.elementObserver.observe(e),e.dataset.id=n.id,e.appendChild(s)}}connectedCallback(){const t=this.messages.length-1;this.range={start:t-this.visibleItemsCount,end:t},this.updateVisibleItems(this.range.start,this.range.end),this.totalHeight=this.getRangeSize(0,t)}componentDidLoad(){this.autoScroll&&this.scrollToBottom()}messagesUpdated(t,e){if(t.length>e.length){const n=t.length-e.length;this.updateVisibleItems(n,this.getEndByStart(n)),this.scrollToIndex(this.range.start)}}saveItemSize(t,e){this.sizes.set(t,Math.round(e)),this.updateTotalHeight()}render(){return $("div",{key:"6564a301cf646ed53993d924111206cf4a382833",class:"scrollbar content-wrapper",ref:t=>this.$listRef=t,onScroll:this.handleScroll},$("div",{key:"81469bde1e421f0a881c3ad33b30a601fc54901c",class:"scroller"},$("div",{key:"5e0c8dd617aa7ed5517cde108539dc23265a29e2",style:{height:`${this.totalHeight}px`}}),$("div",{key:"f994d2627b4787f803b9c7ac00f574dbd034f924",class:"smallest-dom-element",id:"list-end",ref:t=>this.$listEndRef=t})),$("div",{key:"4de62649e894f024ecb7d5767f6eefc702544964",class:"content",style:{transform:`translateY(${this.getRangeSize(0,this.range.start)}px)`}},this.isFetching&&$("div",{key:"dfa9a9abbc190896f80aa90191ab654fee7b7d8f",class:"loader"},$("rtk-spinner",{key:"416b800f9d481689860340aff00fe30f30255603",size:"md"})),this.getVisibleItems().map((t,e)=>$("div",{key:t.id,ref:n=>this.rendererInternal(n,t,e)}))))}static get watchers(){return{messages:["messagesUpdated"]}}};j9n([ge()],qNe.prototype,"iconPack",void 0);qNe.style=C9n;var N9n=Object.freeze({__proto__:null,rtk_message_list_view:qNe});const T9n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}:host([data-hidden]){display:none}:host(.audioDisabled) :slotted(rtk-icon){--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}",_9n=T9n;var KNe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const tB=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.audioUpdateListener=({audioEnabled:e})=>{this.audioEnabled=e},this.stageStatusListener=()=>{this.stageStatus=this.meeting.stage.status,this.canProduceAudio=this.meeting.self.permissions.canProduceAudio==="ALLOWED"},this.mediaPermissionUpdateListener=({kind:e,message:n})=>{e==="audio"&&(this.micPermission=n)},this.meetingPermissionsUpdateListener=e=>{var n;!((n=e==null?void 0:e.media)===null||n===void 0)&&n.audio&&(this.canProduceAudio=this.meeting.self.permissions.canProduceAudio==="ALLOWED")},this.variant="button",this.iconPack=Nt,this.t=It(),this.audioEnabled=!1,this.canProduceAudio=!1,this.micPermission="NOT_REQUESTED",this.stageStatus="OFF_STAGE",this.toggleMic=()=>{var e,n,r,s,i,o,l,c,d,u,h,m;if((e=this.meeting)===null||e===void 0||e.__internals__.logger.info("rtkMicToggle::toggleMic",{media:{audio:{enabled:!!(!((r=(n=this.meeting)===null||n===void 0?void 0:n.self)===null||r===void 0)&&r.audioEnabled),permission:this.micPermission,canProduce:(o=(i=(s=this.meeting)===null||s===void 0?void 0:s.self)===null||i===void 0?void 0:i.permissions)===null||o===void 0?void 0:o.canProduceAudio}},webinar:{stageStatus:(c=(l=this.meeting)===null||l===void 0?void 0:l.stage)===null||c===void 0?void 0:c.status},livestream:{stageStatus:(u=(d=this.meeting)===null||d===void 0?void 0:d.stage)===null||u===void 0?void 0:u.status},moduleExists:{self:!!(!((h=this.meeting)===null||h===void 0)&&h.self)}}),this.hasPermissionError()){const p={enabled:!0,kind:"audio"};return this.stateUpdate.emit({activePermissionsMessage:p}),!1}const f=(m=this.meeting)===null||m===void 0?void 0:m.self;f==null||!this.canProduceAudio||(f.audioEnabled?f.disableAudio():f.enableAudio())}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var t,e,n,r,s,i,o;(t=this.meeting)===null||t===void 0||t.self.removeListener("audioUpdate",this.audioUpdateListener),(e=this.meeting)===null||e===void 0||e.self.removeListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),(r=(n=this.meeting)===null||n===void 0?void 0:n.stage)===null||r===void 0||r.removeListener("stageStatusUpdate",this.stageStatusListener),(o=(i=(s=this.meeting)===null||s===void 0?void 0:s.self)===null||i===void 0?void 0:i.permissions)===null||o===void 0||o.removeListener("permissionsUpdate",this.meetingPermissionsUpdateListener)}meetingChanged(t){var e,n;if(t!=null){const{self:r,stage:s}=t;this.canProduceAudio=this.meeting.self.permissions.canProduceAudio==="ALLOWED",this.micPermission=t.self.mediaPermissions.audio||"NOT_REQUESTED",this.audioEnabled=r.audioEnabled,this.stageStatus=t.stage.status,r.addListener("audioUpdate",this.audioUpdateListener),r.addListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),s==null||s.addListener("stageStatusUpdate",this.stageStatusListener),(n=(e=t.self)===null||e===void 0?void 0:e.permissions)===null||n===void 0||n.addListener("permissionsUpdate",this.meetingPermissionsUpdateListener)}}hasPermissionError(){return this.micPermission==="DENIED"||this.micPermission==="SYSTEM_DENIED"}getState(){let t="",e="",n="",r={},s=this.hasPermissionError(),i=this.micPermission==="COULD_NOT_START";return this.audioEnabled&&!s?(e=this.t("mic_on"),n=this.iconPack.mic_on):(e=this.t("mic_off"),n=this.iconPack.mic_off,r["red-icon"]=!0),i?t=this.t("perm_could_not_start.audio"):this.micPermission==="SYSTEM_DENIED"?t=this.t("perm_sys_denied.audio"):this.micPermission==="DENIED"?t=this.t("perm_denied.audio"):t=this.audioEnabled?this.t("disable_mic"):this.t("enable_mic"),{tooltipLabel:t,label:e,icon:n,classList:r,showWarning:s||i,disable:s}}render(){if(!this.meeting)return null;if(!this.canProduceAudio||["OFF_STAGE","REQUESTED_TO_JOIN_STAGE"].includes(this.stageStatus))return $(mt,{"data-hidden":!0});const{tooltipLabel:t,label:e,icon:n,classList:r,showWarning:s,disable:i}=this.getState();return $(mt,{title:e},$("rtk-tooltip",{kind:"block",label:t,part:"tooltip"},$("rtk-controlbar-button",{part:"controlbar-button",icon:n,label:e,size:this.size,iconPack:this.iconPack,variant:this.variant,class:r,onClick:this.toggleMic,showWarning:s,disabled:i})))}static get watchers(){return{meeting:["meetingChanged"]}}};KNe([ge()],tB.prototype,"meeting",void 0);KNe([ge()],tB.prototype,"iconPack",void 0);KNe([ge()],tB.prototype,"t",void 0);tB.style=_9n;var A9n=Object.freeze({__proto__:null,rtk_mic_toggle:tB});const P9n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block;height:100%;width:100%;display:flex}main{display:flex;flex:1 1 0%;padding-left:var(--rtk-space-4, 16px)}:host([layout='column']) main{padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}main rtk-tab-bar{margin-right:var(--rtk-space-4, 16px);box-sizing:border-box;display:flex;height:100%;width:var(--rtk-space-16, 64px);flex-direction:column}main #tabs{height:100%;flex:1 1 0%}rtk-button{z-index:10}.grid-width-sm{width:25%}.grid-width-md{width:50%}.grid-width-lg{width:66.666667%}.col{display:flex;flex-direction:column;align-items:center}.tab{display:flex;height:var(--rtk-space-16, 64px);width:var(--rtk-space-16, 64px);align-items:center;justify-content:center;margin-bottom:var(--rtk-space-2, 8px);font-size:12px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}.tab.active{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity))}.tab img{height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px);border-radius:var(--rtk-border-radius-sm, 4px)}:host([size='sm']){flex-direction:column}:host([size='sm']) .grid-width-lg,:host([size='sm']) .grid-width-md{height:50%;width:100%;max-width:100%}:host([size='sm']) .grid-width-sm{height:33.333333%;width:100%;max-width:100%}:host([size='sm']) main{display:flex;flex:1 1 0%;flex-direction:column;padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}:host([size='sm']) rtk-tab-bar{height:var(--rtk-space-12, 48px);width:100%;flex-direction:row}:host([size='sm']) #tabs{flex:1 1 0%}:host([size='sm']) .tab{margin:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-2, 8px)}:host([layout='column']){flex-direction:column}:host([layout='column']) main{display:flex;flex:1 1 0%}:host([layout='column']) .grid-width-lg,:host([layout='column']) .grid-width-md{height:50%;max-width:100%;width:100%}:host([layout='column']) .grid-width-sm{height:33.333333%;max-width:100%;width:100%}@media (orientation: portrait){:host{flex-direction:column}:host .grid-width-lg{height:50%;width:100%;max-width:100%}:host .grid-width-md{height:33.333333%;width:100%;max-width:100%}:host .grid-width-sm{height:25%;width:100%;max-width:100%}:host main{flex:1 1 0%;flex-direction:column;padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}:host([size='md']) main{flex:1 1 0%;flex-direction:column;padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}:host rtk-tab-bar{height:var(--rtk-space-16, 64px);width:100%;flex-direction:row}:host #tabs{flex:1 1 0%}:host .tab{margin:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-2, 8px)}}@media (orientation: landscape){:host{flex-direction:row}:host([size='sm']){flex-direction:row}:host .grid-width-lg{height:50%;width:100%;max-width:100%}:host([size='sm']) .grid-width-sm{height:100%;max-height:100%;width:16.666667%}:host([size='sm']) main{flex:1 1 0%;flex-direction:row;padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px)}:host([size='md']) main{flex:1 1 0%;flex-direction:row;padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}:host([size='sm']) rtk-tab-bar{margin-right:var(--rtk-space-2, 8px);height:100%;width:var(--rtk-space-12, 48px);flex-direction:column}:host #tabs{flex:1 1 0%}:host .tab{margin:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-2, 8px)}}",R9n=P9n;var nB=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const aN=class{constructor(t){kt(this,t),this.layout="row",this.participants=[],this.pinnedParticipants=[],this.screenShareParticipants=[],this.plugins=[],this.aspectRatio="16:9",this.gap=8,this.config=Os(),this.iconPack=Nt,this.t=It(),this.gridSize=VNe}componentWillLoad(){this.initialised=!1,this.screenShareParticipantsChanged(this.screenShareParticipants),this.pluginsChanged(this.plugins),this.initialised=!0}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var t;(t=this.meeting.meta)===null||t===void 0||t.removeListener("activeTabUpdate",this.activeTabUpdateListener)}meetingChanged(t){var e,n,r,s;t!=null&&(((e=t.meta)===null||e===void 0?void 0:e.selfActiveTab)!=null&&this.onActiveTabUpdate((n=t.meta.selfActiveTab)===null||n===void 0?void 0:n.type,(r=t.meta.selfActiveTab)===null||r===void 0?void 0:r.id),this.activeTabUpdateListener=i=>{this.onActiveTabUpdate(i==null?void 0:i.type,i==null?void 0:i.id)},(s=t.meta)===null||s===void 0||s.addListener("activeTabUpdate",this.activeTabUpdateListener))}screenShareParticipantsChanged(t=[]){!this.initialised&&this.activeTab!=null||(this.activeTab==null&&t.length>0?this.setActiveTab({type:"screenshare",participant:t[0]}):this.revalidateActiveTab())}pluginsChanged(t){if(!(!this.initialised&&this.activeTab!=null))if(t.length>0){const e=t.length-1;this.setActiveTab({type:"plugin",plugin:t[e]})}else this.revalidateActiveTab()}revalidateActiveTab(){if(this.activeTab!=null)if(this.activeTab.type==="screenshare"){const{participant:t}=this.activeTab;this.screenShareParticipants.some(e=>e.id===t.id)||this.reassignActiveTab()}else{const{plugin:t}=this.activeTab;this.plugins.some(e=>e.id===t.id)||this.reassignActiveTab()}}setActiveTab(t,e=!0){var n;this.activeTab=t;const r=t.type==="screenshare"?t.participant.id:t.plugin.id;e&&((n=this.meeting.meta)===null||n===void 0||n.setSelfActiveTab({type:t.type,id:r},0))}reassignActiveTab(){if(this.screenShareParticipants.length>0)this.setActiveTab({type:"screenshare",participant:this.screenShareParticipants[0]});else if(this.plugins.length>0){const t=this.plugins.length-1;this.setActiveTab({type:"plugin",plugin:this.plugins[t]})}}onActiveTabUpdate(t,e){if(t!=null&&e!=null)switch(t){case"plugin":const n=this.plugins.find(s=>s.id===e);n!=null&&this.setActiveTab({type:"plugin",plugin:n},!1);break;case"screenshare":const r=this.screenShareParticipants.find(s=>s.id===e);r!=null&&this.setActiveTab({type:"screenshare",participant:r},!1)}}getTabs(){const t=this.screenShareParticipants.map(n=>({type:"screenshare",participant:n})),e=this.plugins.map(n=>({type:"plugin",plugin:n}));return t.concat(e)}render(){var t,e;if(!this.meeting)return null;const n={meeting:this.meeting,config:this.config,states:this.states,size:this.size,iconPack:this.iconPack,t:this.t};return $(mt,null,$("main",{id:"main-view",part:"main-view"},((t=this.getTabs())===null||t===void 0?void 0:t.length)>1&&$("rtk-tab-bar",Object.assign({activeTab:this.activeTab,tabs:this.getTabs(),onTabChange:r=>this.setActiveTab(r.detail)},n)),$("div",{id:"tabs",key:"tabs"},this.screenShareParticipants.map(r=>{var s,i;return $(tc,{element:"rtk-screenshare-view",defaults:n,props:{participant:r,key:r.id,style:{display:((s=this.activeTab)===null||s===void 0?void 0:s.type)==="screenshare"&&((i=this.activeTab)===null||i===void 0?void 0:i.participant.id)===r.id?"flex":"none"}},childProps:{participant:r,isScreenShare:!0},deepProps:!0})}),this.plugins.map(r=>{var s,i;return $("rtk-plugin-main",Object.assign({},n,{plugin:r,key:r.id,style:{display:((s=this.activeTab)===null||s===void 0?void 0:s.type)==="plugin"&&((i=this.activeTab)===null||i===void 0?void 0:i.plugin.id)===r.id?"flex":"none"}}))}))),$(tc,{element:"rtk-mixed-grid",defaults:n,childProps:{part:"participants-grid",class:this.gridSize.mixed?`grid-width-${this.gridSize.mixed}`:"grid-width-lg",participants:this.participants,pinnedParticipants:this.pinnedParticipants,screenShareParticipants:this.screenShareParticipants,plugins:this.plugins,aspectRatio:this.aspectRatio,gap:this.gap,size:((e=this.meeting.meta)===null||e===void 0?void 0:e.viewType)==="AUDIO_ROOM"?"md":"sm",layout:"row"},onlyChildren:!0}))}get host(){return Pl(this)}static get watchers(){return{meeting:["meetingChanged"],screenShareParticipants:["screenShareParticipantsChanged"],plugins:["pluginsChanged"]}}};nB([ge()],aN.prototype,"meeting",void 0);nB([ge()],aN.prototype,"states",void 0);nB([ge()],aN.prototype,"config",void 0);nB([ge()],aN.prototype,"iconPack",void 0);nB([ge()],aN.prototype,"t",void 0);aN.style=R9n;var I9n=Object.freeze({__proto__:null,rtk_mixed_grid:aN});const M9n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:flex;flex-direction:column;overflow:visible}.more-menu{position:absolute;right:calc(var(--rtk-space-24, 96px) * -1);bottom:var(--rtk-space-16, 64px);z-index:50;margin-bottom:var(--rtk-space-3, 12px);box-sizing:border-box;max-height:60vh;width:var(--rtk-space-64, 256px);overflow:auto;border-radius:var(--rtk-border-radius-md, 8px);border-width:var(--rtk-border-width-sm, 1px);border-style:solid;--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));outline:2px solid transparent;outline-offset:2px;display:flex;flex-direction:column;align-items:stretch}:host([size='sm']) .more-menu{bottom:var(--rtk-space-10, 40px)}.more-menu::-webkit-scrollbar{height:var(--rtk-space-0, 0px);width:var(--rtk-space-1\\.5, 6px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}.more-menu::-webkit-scrollbar-thumb{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}",L9n=M9n;var YNe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const rB=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.iconPack=Nt,this.t=It(),this.handleKeyDown=({key:e})=>{e==="Escape"&&this.stateUpdate.emit({activeMoreMenu:!1})},this.handleOnClick=e=>{!e.composedPath().includes(this.host)&&this.states.activeMoreMenu&&this.stateUpdate.emit({activeMoreMenu:!1})},this.toggleMoreMenu=()=>{this.stateUpdate.emit({activeMoreMenu:!this.states.activeMoreMenu})}}connectedCallback(){window.addEventListener("keydown",this.handleKeyDown),window.addEventListener("click",this.handleOnClick)}disconnectedCallback(){window.removeEventListener("keydown",this.handleKeyDown),window.removeEventListener("click",this.handleOnClick)}render(){const t=this.t("more");return $(mt,{key:"bb6bc743afd9c5c2c91f48097f98afc0f58fface",title:t},this.states.activeMoreMenu&&$("div",{key:"ca5d042b877cd1bee68b2563d40764bbc2072df4",class:"more-menu"},$("slot",{key:"9931da3f9e96d792be362c64338d582be2990647",name:"more-elements"})),$("rtk-controlbar-button",{key:"d0d7e0f19a37029c9cdfb8238c0a7af88876b2c0",size:this.size,iconPack:this.iconPack,onClick:e=>{e.stopPropagation(),this.toggleMoreMenu()},icon:this.iconPack.horizontal_dots,label:t,part:"controlbar-button"}),$("slot",{key:"603c0b5f092419c98ed56614a1468b5802c95702",name:"expanded"}))}get host(){return Pl(this)}};YNe([ge()],rB.prototype,"states",void 0);YNe([ge()],rB.prototype,"iconPack",void 0);YNe([ge()],rB.prototype,"t",void 0);rB.style=L9n;var D9n=Object.freeze({__proto__:null,rtk_more_toggle:rB});const $9n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}",O9n=$9n;var QNe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const sB=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.variant="button",this.iconPack=Nt,this.t=It(),this.canDisable=!1,this.permissionsUpdateListener=()=>{var e;this.canDisable=!!(!((e=this.meeting)===null||e===void 0)&&e.self.permissions.canDisableParticipantAudio)},this.onMuteAll=()=>{this.stateUpdate.emit({activeMuteAllConfirmation:!0})}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var t,e,n;(n=(e=(t=this.meeting)===null||t===void 0?void 0:t.self)===null||e===void 0?void 0:e.permissions)===null||n===void 0||n.removeListener("permissionsUpdate",this.permissionsUpdateListener)}meetingChanged(t){t&&(this.canDisable=!!(t!=null&&t.self.permissions.canDisableParticipantAudio),t.self.permissions.addListener("permissionsUpdate",this.permissionsUpdateListener))}render(){if(!this.meeting||!this.canDisable)return null;const t=this.t("mute_all");return $(mt,{title:t},$("rtk-tooltip",{kind:"block",label:t,part:"tooltip"},$("rtk-controlbar-button",{part:"controlbar-button",icon:this.iconPack.speaker_off,label:t,size:this.size,iconPack:this.iconPack,variant:this.variant,onClick:this.onMuteAll})))}static get watchers(){return{meeting:["meetingChanged"]}}};QNe([ge()],sB.prototype,"meeting",void 0);QNe([ge()],sB.prototype,"iconPack",void 0);QNe([ge()],sB.prototype,"t",void 0);sB.style=O9n;var F9n=Object.freeze({__proto__:null,rtk_mute_all_button:sB});const B9n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:block;height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px)}rtk-icon{position:absolute;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);z-index:10;height:100%;width:100%;--tw-text-opacity:1;color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-text-opacity))}rtk-icon.good{--tw-text-opacity:1;color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-text-opacity))}rtk-icon.poor{--tw-text-opacity:1;color:rgba(var(--rtk-colors-warning, 255 205 7) / var(--tw-text-opacity))}rtk-icon.poorest{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}:host([size='md']){height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}:host([size='sm']){height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}.bg-signal{position:absolute;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);z-index:0;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}",U9n=B9n;var ZNe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const iB=class{constructor(t){kt(this,t),this.iconPack=Nt,this.t=It(),this.isScreenShare=!1,this.score=10,this.onMediaScoreUpdate=({kind:e,isScreenshare:n,score:r})=>{(e==="video"||this.isScreenShare&&n)&&(this.score=r)}}connectedCallback(){this.participantChanged(this.participant)}participantChanged(t){t&&t.addListener("mediaScoreUpdate",this.onMediaScoreUpdate)}disconnectedCallback(){var t;(t=this.participant)===null||t===void 0||t.removeListener("mediaScoreUpdate",this.onMediaScoreUpdate)}render(){let t=Math.round(this.score/2),e="good";if(t>3)return null;switch(t<1&&(t=1),t){case 3:case 2:e="poor";break;case 1:e="poorest"}return $(mt,null,$("rtk-icon",{icon:this.iconPack[`signal_${t}`],class:e}),$("rtk-icon",{icon:this.iconPack.signal_5,class:"bg-signal"}))}static get watchers(){return{participant:["participantChanged"]}}};ZNe([ge()],iB.prototype,"meeting",void 0);ZNe([ge()],iB.prototype,"iconPack",void 0);ZNe([ge()],iB.prototype,"t",void 0);iB.style=U9n;var z9n=Object.freeze({__proto__:null,rtk_network_indicator:iB});const j6=t=>{var e;return(e=t==null?void 0:t.__internals__)===null||e===void 0?void 0:e.browserSpecs.isFirefox()},V9n={joined:"https://rtk-uploads.realtime.cloudflare.com/notification_join.mp3",left:"https://rtk-uploads.realtime.cloudflare.com/notification_join.mp3",message:"https://rtk-uploads.realtime.cloudflare.com/notification_message.mp3"};class H9n{constructor(e){this.meeting=e,this.audio=document.createElement("audio"),this.audio.volume=.3}play(e,n=3e3){var r;this.playing||(this.playing=!0,this.audio.src=V9n[e],this.audio.volume=.3,(r=this.audio.play())===null||r===void 0||r.catch(s=>{}),setTimeout(()=>{this.playing=!1},n))}async setDevice(e){var n,r,s;j6(this.meeting)||await((s=(r=(n=this.audio)===null||n===void 0?void 0:n.setSinkId)===null||r===void 0?void 0:r.call(n,e))===null||s===void 0?void 0:s.catch(i=>{}))}}const Uv=2e3,Nbe=Object.freeze({notifications:{participant_joined:!0,participant_left:!0,participant_joined_waitlist:!0,chat:!0,polls:!0,webinar:!0,tab_sync:!0,recording_started:!0,recording_stopped:!0},notification_sounds:{participant_joined:!0,participant_left:!0,chat:!0,polls:!0,webinar:!0,participant_joined_waitlist:!0},notification_duration:{participant_joined:2100,participant_left:2100,participant_joined_waitlist:4e3,chat:Uv,polls:Uv,webinar:Uv,tab_sync:Uv,recording_started:Uv,recording_stopped:Uv},participant_joined_sound_notification_limit:10,participant_chat_message_sound_notification_limit:10}),G9n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:absolute;top:var(--rtk-space-4, 16px);right:var(--rtk-space-4, 16px);bottom:var(--rtk-space-4, 16px);left:var(--rtk-space-4, 16px);top:auto;display:flex;flex-direction:column;pointer-events:none;z-index:100}rtk-notification{margin-top:var(--rtk-space-2, 8px)}",W9n=G9n;var aB=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};function q9n(t){const e=Object.assign({},Nbe);return t==null||(Object.assign(e.notification_sounds,t.notification_sounds),Object.assign(e.notifications,t.notifications),Object.assign(e.notification_duration,t.notification_duration),e.participant_chat_message_sound_notification_limit=t.participant_chat_message_sound_notification_limit,e.participant_joined_sound_notification_limit=t.participant_joined_sound_notification_limit),e}function xBe(t){return Object.keys(t).filter(e=>t[e])}const oN=class{constructor(t){kt(this,t),this.permissions=Nbe,this.enabledSounds=xBe(Nbe.notification_sounds),this.config=Os(),this.t=It(),this.iconPack=Nt,this.notifications=[],this.addStagePeersListeners=e=>{e.participants.joined.addListener("participantJoined",this.participantJoinedListener),e.participants.joined.addListener("participantLeft",this.participantLeftListener)},this.removeStagePeersListeners=e=>{e.participants.joined.removeListener("participantJoined",this.participantJoinedListener),e.participants.joined.removeListener("participantLeft",this.participantLeftListener)},this.onNotification=e=>{this.add(e.detail);const n=e.detail.playSound;n!=null&&this.audio.play(n)},this.onRecordingUpdate=e=>{var n,r;e==="RECORDING"&&this.permissions.notifications.recording_started!==!1?this.add({id:"recording-started",icon:this.iconPack.recording,message:this.t("recording.started"),duration:(n=this.permissions.notification_duration.recording_started)!==null&&n!==void 0?n:Uv}):e==="STOPPING"&&this.permissions.notifications.recording_stopped!==!1&&this.add({id:"recording-stopped",icon:this.iconPack.stop_recording,message:this.t("recording.stopped"),duration:(r=this.permissions.notification_duration.recording_stopped)!==null&&r!==void 0?r:Uv})},this.paused=!1}connectedCallback(){typeof document<"u"&&(document==null||document.addEventListener("rtkNotification",this.onNotification)),this.meetingChanged(this.meeting),this.configChanged(this.config),this.statesChanged(this.states)}clearListeners(t){var e,n,r,s,i,o,l,c;const d=t.meta.viewType==="LIVESTREAM";(d&&((e=t.stage)===null||e===void 0?void 0:e.status)==="ON_STAGE"||!d)&&this.removeStagePeersListeners(t),this.chatUpdateListener&&((n=t.chat)===null||n===void 0||n.removeListener("chatUpdate",this.chatUpdateListener)),this.pollUpdateListener&&((r=t.polls)===null||r===void 0||r.removeListener("pollsUpdate",this.pollUpdateListener)),t.meta.removeListener("socketConnectionUpdate",this.socketConnectionUpdateListener),this.stageRequestAccepted&&((s=t.stage)===null||s===void 0||s.removeListener("stageRequestApproved",this.stageRequestAccepted)),this.stageRequestRejected&&((i=t.stage)===null||i===void 0||i.removeListener("stageRequestRejected",this.stageRequestRejected)),this.newStageRequests&&((o=t.stage)===null||o===void 0||o.removeListener("newStageRequest",this.newStageRequests)),this.stageStatusUpdateListener&&((l=t.stage)===null||l===void 0||l.removeListener("stageStatusUpdate",this.stageStatusUpdateListener)),(c=t.recording)===null||c===void 0||c.removeListener("recordingUpdate",this.onRecordingUpdate),clearTimeout(this.disconnectTimeout),t.self.removeListener("deviceUpdate",this.deviceUpdateListener)}disconnectedCallback(){var t;typeof document<"u"&&(document==null||document.removeEventListener("rtkNotification",this.onNotification)),this.meeting&&(this.clearListeners(this.meeting),this.waitlistedParticipantJoinedListener&&this.meeting.participants.waitlisted.removeListener("participantJoined",this.waitlistedParticipantJoinedListener),this.waitlistedParticipantLeftListener&&this.meeting.participants.waitlisted.removeListener("participantLeft",this.waitlistedParticipantLeftListener),this.activeTabUpdateListener&&((t=this.meeting.meta)===null||t===void 0||t.removeListener("activeTabUpdate",this.activeTabUpdateListener)),this.peerStageStatusListener&&this.meeting.participants.joined.removeListener("stageStatusUpdate",this.peerStageStatusListener))}meetingChanged(t,e){var n,r,s,i,o,l,c,d,u;if(clearTimeout(this.disconnectTimeout),e&&this.clearListeners(e),!t)return;const h=t.meta.viewType==="LIVESTREAM";this.audio=new H9n(t);const{notifications:m,notification_duration:f,notification_sounds:p}=this.permissions;if(this.participantJoinedListener=v=>{m.participant_joined&&this.add({id:`${v.id}-joined`,message:`${Rf(v.name)} ${this.t("notifications.joined")}`,image:v.picture,duration:f.participant_joined}),p.participant_joined&&this.canPlayParticipantJoinedSound()&&this.audio.play("joined")},this.participantLeftListener=v=>{const{socketState:{state:b}}=this.meeting.meta;m.participant_left&&b!=="connected"&&this.add({id:`${v.id}-left`,message:`${Rf(v.name)} ${this.t("notifications.left")}`,image:v.picture,duration:f.participant_left}),p.participant_left&&this.canPlayParticipantJoinedSound()&&this.audio.play("left")},this.waitlistedParticipantJoinedListener=v=>{if(!this.canAcceptWaitingRequests())return;const b=`${v.id}-joined-waitlist`;this.add({id:b,message:`${Rf(v.name)} ${this.t("notifications.requesting_to_join_meeting")}`,image:v.picture,duration:f.participant_joined_waitlist,button:{text:this.t("notifications.accept"),variant:"primary",onClick:async()=>{await this.meeting.participants.acceptWaitingRoomRequest(v.id),this.remove(b)}}}),p.participant_joined_waitlist&&this.canPlayParticipantJoinedSound()&&this.audio.play("message")},this.waitlistedParticipantLeftListener=v=>{this.remove(`${v.id}-joined-waitlist`)},this.chatUpdateListener=({message:v,action:b})=>{if(b!=="add")return;const x=MOn(v);if(x!=null){if(x.userId===t.self.userId)return;x.type==="text"&&(m.chat&&this.add({id:`message-${Math.random().toString(36)}`,icon:this.iconPack.chat,message:`${x.displayName}: ${x.message}`,duration:f.chat}),p.chat&&this.canPlayChatSound()&&this.audio.play("message"))}},this.pollUpdateListener=({polls:v,newPoll:b})=>{b!==!1&&(m.polls&&this.meeting.self.userId!==v[v.length-1].createdByUserId&&this.add({id:`poll-${Math.random().toString(36)}`,icon:this.iconPack.poll,message:`${this.t("notifications.new_poll_created_by")} ${v[v.length-1].createdBy}`,duration:f.polls}),p.polls&&this.meeting.self.userId!==v[v.length-1].createdByUserId&&this.canPlayChatSound()&&this.audio.play("message"))},this.deviceUpdateListener=({device:v,preview:b})=>{b||(v.kind==="audiooutput"&&(this.audio.setDevice(v.deviceId),this.remove("speaker-switched"),this.add({id:"speaker-switched",message:`${this.t("notifications.connected_to")} ${v.label}`,icon:this.iconPack.speaker,duration:5e3})),v.kind==="videoinput"&&(this.remove("camera-switched"),this.add({id:"camera-switched",message:`${this.t("notifications.connected_to")} ${v.label}`,icon:this.meeting.self.videoEnabled?this.iconPack.video_on:this.iconPack.video_off,iconVariant:this.meeting.self.videoEnabled?"primary":"danger",duration:5e3})),v.kind==="audioinput"&&(this.remove("mic-switched"),this.add({id:"mic-switched",message:`${this.t("notifications.connected_to")} ${v.label}`,icon:this.meeting.self.audioEnabled?this.iconPack.mic_on:this.iconPack.mic_off,iconVariant:this.meeting.self.audioEnabled?"primary":"danger",duration:5e3})))},this.socketConnectionUpdateListener=({state:v,reconnectionAttempt:b,reconnected:x})=>{switch(v){case"connected":this.remove("socket"),x&&this.add({id:"socket",icon:this.iconPack.wifi,message:this.t("network.restored"),duration:3e3});break;case"disconnected":this.remove("socket"),this.add({id:"socket",icon:this.iconPack.disconnected,message:this.t("network.reconnecting")});break;case"reconnecting":b>=6?(this.remove("socket"),this.add({id:"socket",icon:this.iconPack.disconnected,message:this.t("network.disconnected"),button:{text:this.t("end"),variant:"danger",onClick:()=>{var w;return(w=this.meeting)===null||w===void 0?void 0:w.leave()}}})):b>=4&&(this.remove("socket"),this.add({id:"socket",icon:this.iconPack.disconnected,message:this.t("network.delay_extended")}));break;case"failed":this.remove("socket"),this.add({id:"socket",icon:this.iconPack.disconnected,message:this.t("network.leaving"),button:{text:this.t("end"),variant:"danger",onClick:()=>{var w;return(w=this.meeting)===null||w===void 0?void 0:w.leave()}}});break}},this.activeTabUpdateListener=v=>{if(m.tab_sync)switch(v.type){case"plugin":const b=t.plugins.active.toArray().find(w=>w.id==v.id);b!=null&&this.add({id:"activeTab",message:`${this.t("notifications.plugin_switched_to")} ${b.name}`,duration:f.participant_joined});break;case"screenshare":const x=t.participants.joined.toArray().filter(w=>w.screenShareEnabled).find(w=>w.id==v.id);x!=null&&this.add({id:"spotlight",message:`Now watching ${x.name}'s screen`,duration:f.webinar});break}},this.peerStageStatusListener=v=>{v.stageStatus==="REQUESTED_TO_JOIN_STAGE"&&(this.add({id:`stage-request-${v.id}`,message:`${v.name} ${this.t("notifications.requested_to_join_stage")}`,duration:f.webinar,button:{text:this.t("notifications.accept"),variant:"primary",onClick:async()=>{await this.meeting.stage.grantAccess([v.userId]),this.remove(`stage-request-${v.id}`)}}}),p.webinar&&this.audio.play("joined")),v.stageStatus==="ON_STAGE"&&(this.add({id:`stage-joined-${v.id}`,message:`${v.name} ${this.t("notifications.joined_stage")}`,duration:f.webinar}),p.webinar&&this.audio.play("joined"))},this.stageRequestAccepted=()=>{this.add({id:"stage-request-accepted",message:this.t("notifications.request_to_join_accepted"),duration:3e3})},this.stageRequestRejected=()=>{this.add({id:"stage-request-rejected",message:this.t("notifications.request_to_join_rejected"),duration:3e3})},this.newStageRequests=({count:v})=>{this.add({id:"new-stage-request",message:`You have ${v<0?"new stage":`${v} pending`} request${v===1?"":"s"}`,duration:3e3})},this.stageStatusUpdateListener=v=>{v==="ON_STAGE"?this.addStagePeersListeners(t):this.removeStagePeersListeners(t)},!LI(t)&&((n=t.chat)===null||n===void 0||n.addListener("chatUpdate",this.chatUpdateListener)),((r=t.self.config.viewType)===null||r===void 0?void 0:r.toString())==="CHAT")return;const g=t.self.getCurrentDevices();g.speaker!=null&&this.audio.setDevice(g.speaker.deviceId),h?(s=t.stage)===null||s===void 0||s.on("stageStatusUpdate",this.stageStatusUpdateListener):this.addStagePeersListeners(t),this.canAcceptWaitingRequests()&&(t.participants.waitlisted.addListener("participantJoined",this.waitlistedParticipantJoinedListener),t.participants.waitlisted.addListener("participantLeft",this.waitlistedParticipantLeftListener)),(i=t.polls)===null||i===void 0||i.addListener("pollsUpdate",this.pollUpdateListener),t.self.addListener("deviceUpdate",this.deviceUpdateListener),t.meta.addListener("socketConnectionUpdate",this.socketConnectionUpdateListener),(o=t.meta)===null||o===void 0||o.addListener("activeTabUpdate",this.activeTabUpdateListener),(l=t.recording)===null||l===void 0||l.addListener("recordingUpdate",this.onRecordingUpdate),(c=t.stage)===null||c===void 0||c.addListener("stageRequestApproved",this.stageRequestAccepted),(d=t.stage)===null||d===void 0||d.addListener("stageRequestRejected",this.stageRequestRejected),t.self.permissions.stageEnabled&&t.self.permissions.acceptStageRequests&&((u=t.stage)===null||u===void 0||u.addListener("newStageRequest",this.newStageRequests))}configChanged(t){t!=null&&(t==null?void 0:t.config)!=null&&(this.permissions=q9n(t.config),this.enabledSounds=xBe(this.permissions.notification_sounds))}statesChanged(t){var e;if(t!=null){const n=!(!((e=t==null?void 0:t.prefs)===null||e===void 0)&&e.muteNotificationSounds);for(const r of this.enabledSounds)r in this.permissions.notification_sounds&&(this.permissions.notification_sounds[r]=n)}}apiErrorListener({detail:t}){const{trace:e,message:n}=t;this.add({id:e,message:n,duration:Uv,icon:this.iconPack.warning})}sendNotificationListener({detail:t}){const{trace:e,message:n}=t;this.add({id:e,message:n,duration:Uv})}add(t){document.visibilityState==="visible"&&this.notifications.length<5&&(this.notifications=[...this.notifications,t])}remove(t){this.notifications=this.notifications.filter(e=>e.id!==t)}handleDismiss(t){t.stopPropagation();const e=t.detail,n=this.host.shadowRoot.querySelector(`[data-id="${e}"]`);n==null||n.classList.add("exit"),setTimeout(()=>{Dc(()=>{this.remove(e)})},400)}canPlayParticipantJoinedSound(){return this.permissions.participant_joined_sound_notification_limit==null||this.permissions.participant_joined_sound_notification_limit<=0||this.meeting.participants.count<=this.permissions.participant_joined_sound_notification_limit}canPlayChatSound(){return this.permissions.participant_chat_message_sound_notification_limit==null||this.permissions.participant_chat_message_sound_notification_limit<=0||this.meeting.participants.count<=this.permissions.participant_chat_message_sound_notification_limit}canAcceptWaitingRequests(){return this.permissions.notifications.participant_joined_waitlist&&this.meeting.self.permissions.acceptWaitingRequests}render(){if(this.meeting)return $(mt,null,$("div",{onMouseEnter:()=>this.paused=!0,onFocusin:()=>this.paused=!0,onMouseLeave:()=>this.paused=!1,onFocusout:()=>this.paused=!1},this.notifications.map(t=>$("rtk-notification",{size:this.size,key:t.id,"data-id":t.id,notification:t,onRtkNotificationDismiss:e=>this.handleDismiss(e),iconPack:this.iconPack,paused:this.paused,t:this.t}))))}get host(){return Pl(this)}static get watchers(){return{meeting:["meetingChanged"],config:["configChanged"],states:["statesChanged"]}}};aB([ge()],oN.prototype,"meeting",void 0);aB([ge()],oN.prototype,"states",void 0);aB([ge()],oN.prototype,"config",void 0);aB([ge()],oN.prototype,"t",void 0);aB([ge()],oN.prototype,"iconPack",void 0);oN.style=W9n;var K9n=Object.freeze({__proto__:null,rtk_notifications:oN});const Y9n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:inline-flex;height:var(--rtk-space-10, 40px);-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center}:host([data-hidden]){display:none}:host([size='sm']){font-size:12px}rtk-icon{margin-right:var(--rtk-space-1, 4px);height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}:host([size='sm']) rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}",Q9n=Y9n;var JNe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const oB=class{constructor(t){kt(this,t),this.iconPack=Nt,this.t=It(),this.participantCount=0,this.isViewer=!1,this.disconnectMeeting=e=>{e!=null&&this.countListener!=null&&(e.participants.joined.removeListener("participantJoined",this.countListener),e.participants.joined.removeListener("participantLeft",this.countListener),e!=null&&e.stage&&this.stageUpdateListener&&e.stage.removeListener("stageStatusUpdate",this.stageUpdateListener),e.self.removeListener("roomJoined",this.countListener))}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.disconnectMeeting(this.meeting)}meetingChanged(t,e){this.disconnectMeeting(e),t!=null&&(this.countListener=()=>{this.participantCount=t.participants.joined.size+(t.self.roomJoined?1:0)},this.countListener(),this.isViewer=w6(this.meeting),t.participants.joined.addListener("participantJoined",this.countListener),t.participants.joined.addListener("participantLeft",this.countListener),t!=null&&t.stage&&(this.stageUpdateListener=()=>{this.isViewer=w6(this.meeting)},t==null||t.stage.addListener("stageStatusUpdate",this.stageUpdateListener)),t.self.addListener("roomJoined",this.countListener))}render(){return this.isViewer?$(mt,{"data-hidden":!0}):$(mt,{tabIndex:0,role:"log","aria-label":`${this.participantCount} ${this.t("participants")}`},$("rtk-icon",{icon:this.iconPack.people,tabIndex:-1,"aria-hidden":!0,part:"icon"}),this.participantCount)}static get watchers(){return{meeting:["meetingChanged"]}}};JNe([ge()],oB.prototype,"meeting",void 0);JNe([ge()],oB.prototype,"iconPack",void 0);JNe([ge()],oB.prototype,"t",void 0);oB.style=Q9n;var Z9n=Object.freeze({__proto__:null,rtk_participant_count:oB});const J9n=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:flex;align-items:center;justify-content:center;aspect-ratio:16 / 9;height:var(--rtk-space-56, 224px);overflow:hidden;border-radius:var(--rtk-border-radius-lg, 12px);-webkit-user-select:none;-moz-user-select:none;user-select:none;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-video-bg, 24 24 24) / var(--tw-bg-opacity));transition-property:var(--rtk-transition-property, all);transition-duration:150ms}@media (prefers-reduced-motion){:host{--rtk-transition-property:none}}:host([size='sm'][variant='solid']) ::slotted(rtk-name-tag){left:var(--rtk-space-2, 8px);bottom:var(--rtk-space-2, 8px);height:var(--rtk-space-4, 16px)}video{display:none;position:absolute;height:100%;width:100%;border-radius:var(--rtk-border-radius-lg, 12px)}video.contain{-o-object-fit:contain;object-fit:contain}video.cover{-o-object-fit:cover;object-fit:cover}video.visible{display:block}video::-webkit-media-controls{display:none !important}:host([variant='gradient']) ::slotted(rtk-audio-visualizer){position:absolute;top:var(--rtk-space-2, 8px);right:var(--rtk-space-2, 8px);border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));padding:var(--rtk-space-2, 8px)}:host([variant='gradient']) ::slotted(rtk-name-tag){bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);display:flex;width:100%;align-items:center;justify-content:center;text-align:center;background-color:transparent;background-image:linear-gradient(to top, var(--tw-gradient-stops));--tw-gradient-from:rgb(var(--rtk-colors-background-1000, 8 8 8));--tw-gradient-to:rgba(var(--rtk-colors-background-1000, 8 8 8) / 0);--tw-gradient-stops:var(--tw-gradient-from), var(--tw-gradient-to);--tw-gradient-to:transparent}video.mirror{transform:scaleX(-1)}@media (orientation: portrait){:host{height:var(--rtk-space-44, 176px)}}",X9n=J9n;var Kne=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const HI=class{constructor(t){kt(this,t),this.isPinned=!1,this.nameTagPosition="bottom-left",this.isPreview=!1,this.config=Os(),this.variant="solid",this.iconPack=Nt,this.t=It(),this.onVideoUpdate=e=>{this.videoState=e}}connectedCallback(){this.participantsChanged(this.participant)}componentDidLoad(){this.videoStateChanged(this.videoState)}disconnectedCallback(){this.participant!=null&&this.participant.removeListener("videoUpdate",this.onVideoUpdate)}async participantsChanged(t){t!=null&&(this.videoState={videoEnabled:t.videoEnabled,videoTrack:t.videoTrack},this.isPinned=t.isPinned,t.addListener("videoUpdate",this.onVideoUpdate))}videoStateChanged(t){if(t!=null&&this.videoEl!=null)if(t.videoEnabled){const e=new MediaStream;e.addTrack(t.videoTrack),this.videoEl.srcObject=e}else this.videoEl.srcObject=void 0}isMirrored(){var t;if(this.participant!=null&&("preview"in this.participant||this.isPreview)){const n=this.states,r=(t=n==null?void 0:n.prefs)===null||t===void 0?void 0:t.mirrorVideo;if(typeof r=="boolean")return r}return!1}render(){var t,e,n,r;return $(mt,{key:"28dd3343464f9c18cae6161f8ad56005b748a637"},$("video",{key:"556343e40a061ddb9522569a77b574309bed9f31",ref:s=>this.videoEl=s,class:{visible:(t=this.videoState)===null||t===void 0?void 0:t.videoEnabled,mirror:this.isMirrored(),[(r=(n=(e=this.config)===null||e===void 0?void 0:e.config)===null||n===void 0?void 0:n.videoFit)!==null&&r!==void 0?r:"cover"]:!0},autoPlay:!0,playsInline:!0,muted:!0}),$("slot",{key:"c5da0b57d92652e54ef88cedcc269ccc720d1054"}))}static get watchers(){return{participant:["participantsChanged"],videoState:["videoStateChanged"]}}};Kne([ge()],HI.prototype,"states",void 0);Kne([ge()],HI.prototype,"config",void 0);Kne([ge()],HI.prototype,"iconPack",void 0);Kne([ge()],HI.prototype,"t",void 0);HI.style=X9n;var eUn=Object.freeze({__proto__:null,rtk_participant_setup:HI});const tUn=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{display:flex;height:100%;width:100%;flex-direction:column;font-size:14px}*{box-sizing:border-box}.ctr{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);box-sizing:border-box;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);padding-top:var(--rtk-space-0, 0px);padding-bottom:var(--rtk-space-0, 0px);overflow-y:auto;flex-grow:1;flex-basis:0}.ctr.virtualised{overflow-y:hidden}.search{position:sticky;box-sizing:border-box;display:flex;align-items:center;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));margin-left:var(--rtk-space-3, 12px);margin-right:var(--rtk-space-3, 12px);margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0, 0px)}.search rtk-icon{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px);color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}.search input{box-sizing:border-box;height:var(--rtk-space-9, 36px);width:100%;padding-right:var(--rtk-space-2, 8px);border-width:var(--rtk-border-width-none, 0);border-style:none;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));outline:2px solid transparent;outline-offset:2px;border-radius:var(--rtk-border-radius-sm, 4px);font-size:14px}.search input::-moz-placeholder{color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.search input::placeholder{color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}:host([size='md']) .search{margin-top:var(--rtk-space-4, 16px) !important;margin-bottom:var(--rtk-space-4, 16px) !important}:host([size='sm']) .search{margin-top:var(--rtk-space-4, 16px) !important;margin-bottom:var(--rtk-space-4, 16px) !important}.no-pending-requests{margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-4, 16px);text-align:center;font-size:12px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}`,nUn=tUn;var lB=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const lN=class{constructor(e){kt(this,e),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.config=Os(),this.iconPack=Nt,this.defaultParticipantsTabId="stage-list",this.t=It(),this.currentParticipantsTabId=this.defaultParticipantsTabId,this.tabs=[],this.hasRequests=!1,this.search="",this.updateParticipantCountsInTabs=Sne(()=>{var n;let r=((n=this.meeting.participants.waitlisted)===null||n===void 0?void 0:n.size)||0,s=0,i=0;this.meeting.participants.joined.toArray().forEach(l=>{l.stageStatus==="ON_STAGE"&&s++,l.stageStatus==="OFF_STAGE"&&i++,l.stageStatus==="REQUESTED_TO_JOIN_STAGE"&&(r++,i++),l.stageStatus==="ACCEPTED_TO_JOIN_STAGE"&&i++}),this.meeting.self.stageStatus==="ON_STAGE"&&s++,this.meeting.self.stageStatus==="OFF_STAGE"&&i++,this.meeting.self.stageStatus==="REQUESTED_TO_JOIN_STAGE"&&(r++,i++),this.meeting.self.stageStatus==="ACCEPTED_TO_JOIN_STAGE"&&i++;const o=[];this.shouldShowRequestsTab()&&o.push({id:"requests",name:$("span",null,this.t("requests")," ",$("span",{class:`tab-participant-count-badge ${r>0?"requests-pending":""} ${this.currentParticipantsTabId==="requests"?"selected-tab":""}`},r))}),o.push({id:"stage-list",name:$("span",null,this.t("participants")," ",$("span",{class:`tab-participant-count-badge ${this.currentParticipantsTabId==="stage-list"?"selected-tab":""}`},s))}),this.shouldShowViewersTab()&&o.push({id:"viewer-list",name:$("span",null,this.t("viewers")," ",$("span",{class:`tab-participant-count-badge ${this.currentParticipantsTabId==="viewer-list"?"selected-tab":""}`},i))}),this.tabs=o,this.hasRequests=r>0}),this.onSearchInput=n=>{this.search=n.target.value},this.shouldShowViewersTab=()=>{var n,r,s;return(s=(r=(n=this.meeting)===null||n===void 0?void 0:n.self)===null||r===void 0?void 0:r.permissions)===null||s===void 0?void 0:s.stageEnabled},this.shouldShowRequestsTab=()=>{var n;let r=!1;return this.meeting.meta.viewType==="LIVESTREAM"?r=!1:r=((n=this.meeting.self.config.waitingRoom)===null||n===void 0?void 0:n.isEnabled)&&this.meeting.self.permissions.acceptWaitingRequests,this.meeting.self.permissions.stageEnabled&&this.meeting.self.permissions.acceptStageRequests||r},this.viewSection=n=>{this.currentParticipantsTabId=n}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.meeting&&(this.meeting.participants.joined.off("participantJoined",this.updateParticipantCountsInTabs),this.meeting.participants.joined.off("participantsUpdate",this.updateParticipantCountsInTabs),this.meeting.participants.joined.off("participantLeft",this.updateParticipantCountsInTabs),this.meeting.participants.joined.off("stageStatusUpdate",this.updateParticipantCountsInTabs),this.meeting.stage.off("stageStatusUpdate",this.updateParticipantCountsInTabs),this.meeting.participants.waitlisted.off("participantJoined",this.updateParticipantCountsInTabs),this.meeting.participants.waitlisted.off("participantLeft",this.updateParticipantCountsInTabs),this.meeting.participants.waitlisted.off("stageStatusUpdate",this.updateParticipantCountsInTabs))}meetingChanged(e){e&&(e.participants.joined.on("participantJoined",this.updateParticipantCountsInTabs),e.participants.joined.on("participantsUpdate",this.updateParticipantCountsInTabs),e.participants.joined.on("participantLeft",this.updateParticipantCountsInTabs),e.participants.joined.on("stageStatusUpdate",this.updateParticipantCountsInTabs),e.stage.on("stageStatusUpdate",this.updateParticipantCountsInTabs),e.participants.waitlisted.on("participantJoined",this.updateParticipantCountsInTabs),e.participants.waitlisted.on("participantLeft",this.updateParticipantCountsInTabs),e.participants.waitlisted.on("stageStatusUpdate",this.updateParticipantCountsInTabs),this.updateParticipantCountsInTabs())}currentParticipantsTabIdChanged(){this.stateUpdate.emit({participantsTabId:this.currentParticipantsTabId}),this.updateParticipantCountsInTabs()}render(){if(!this.meeting)return null;const e={meeting:this.meeting,states:this.states,config:this.config,size:this.size,iconPack:this.iconPack,t:this.t};return $(mt,null,$("div",{class:"search",part:"search"},$("rtk-icon",{icon:this.iconPack.search,part:"search-icon"}),$("input",{type:"search",autocomplete:"off",placeholder:this.t("search"),onInput:this.onSearchInput,part:"search-input"})),$("slot",{name:"start"}),$("div",{class:`ctr scrollbar ${this.currentParticipantsTabId!=="requests"?"virtualised":""}`,part:"container"},$("rtk-sidebar-ui",{tabs:this.tabs,currentTab:this.currentParticipantsTabId,view:"full-screen",hideHeader:!0,hideCloseAction:!0,style:{position:"relative"},onTabChange:n=>{this.viewSection(n.detail),n.stopPropagation()}},(!this.currentParticipantsTabId||this.currentParticipantsTabId==="stage-list")&&$("div",{slot:"stage-list",style:{marginTop:"10px",height:"100%"}},$("rtk-participants-stage-list",Object.assign({},e,{search:this.search,hideHeader:!0}))),this.currentParticipantsTabId==="requests"&&$("div",{slot:"requests",style:{marginTop:"10px",height:"100%"}},!this.hasRequests&&$("div",{class:"no-pending-requests"},this.t("participants.no_pending_requests")),$("rtk-participants-stage-queue",Object.assign({},e)),$("rtk-participants-waiting-list",Object.assign({},e))),this.currentParticipantsTabId==="viewer-list"&&$("div",{slot:"viewer-list",style:{marginTop:"10px",height:"100%"}},$("rtk-participants-viewer-list",Object.assign({},e,{search:this.search,hideHeader:!0}))))),$("slot",{name:"end"}))}static get watchers(){return{meeting:["meetingChanged"],currentParticipantsTabId:["currentParticipantsTabIdChanged"]}}};lB([ge()],lN.prototype,"meeting",void 0);lB([ge()],lN.prototype,"states",void 0);lB([ge()],lN.prototype,"config",void 0);lB([ge()],lN.prototype,"iconPack",void 0);lB([ge()],lN.prototype,"t",void 0);lN.style=nUn;var rUn=Object.freeze({__proto__:null,rtk_participants:lN});class sUn{constructor(e,n){this.meeting=e,this.audio=n??document.createElement("audio"),this.audio.autoplay=!0,this.logger=e.__internals__.logger,this.audioStream=new MediaStream,this.audio.srcObject=this.audioStream,this.audioTracks=[]}addTrack(e,n){this.removeTrack(e),this.audioTracks.push({id:e,track:n}),this.audioStream.addTrack(n),this.play()}removeTrack(e){const n=this.audioTracks.find(r=>r.id===e);n!=null&&(this.audioStream.removeTrack(n.track),this.audioTracks=this.audioTracks.filter(r=>r.id!==e))}async play(){var e;this.audio.srcObject=this.audioStream,await((e=this.audio.play())===null||e===void 0?void 0:e.catch(n=>{n.name==="NotAllowedError"?this._onError!=null&&this._onError():n.name!=="AbortError"&&this.logger.error(`[rtk-audio] play() error
`,n)}))}async setDevice(e){var n,r,s;j6(this.meeting)||await((s=(r=(n=this.audio).setSinkId)===null||r===void 0?void 0:r.call(n,e))===null||s===void 0?void 0:s.catch(i=>{this.logger.error(`[rtk-audio] setSinkId() error
`,i)}))}onError(e){this._onError=e}}const iUn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block;overflow-wrap:break-word;color:rgb(var(--rtk-colors-text-1000, 255 255 255));word-wrap:break-word}.modal{box-sizing:border-box;width:100%;max-width:var(--rtk-space-96, 384px);padding:var(--rtk-space-4, 16px);border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}.modal h3{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px);font-size:24px;font-weight:500}.modal p{margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-6, 24px)}.modal rtk-button{width:100%}",aUn=iUn;var XNe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const cB=class{constructor(e){kt(this,e),this.dialogClose=Wt(this,"dialogClose",7),this.iconPack=Nt,this.t=It(),this.preloadedAudioElem=void 0,this.showPlayDialog=!1,this.onRtkDialogClose=()=>{this.showPlayDialog=!1,this.dialogClose.emit()}}componentDidLoad(){this.meetingChanged(this.meeting)}disconnectedCallback(){var e;this.meeting&&(this.audioUpdateListener&&this.meeting.participants.joined.removeListener("audioUpdate",this.audioUpdateListener),this.screenShareUpdateListener&&this.meeting.participants.joined.removeListener("screenShareUpdate",this.screenShareUpdateListener),this.participantLeftListener&&this.meeting.participants.joined.removeListener("participantLeft",this.participantLeftListener),this.deviceUpdateListener&&this.meeting.self.removeListener("deviceUpdate",this.deviceUpdateListener),this.stageStatusUpdateListener&&((e=this.meeting.stage)===null||e===void 0||e.removeListener("stageStatusUpdate",this.stageStatusUpdateListener)))}async setupAudio(){this.audio=new sUn(this.meeting,this.preloadedAudioElem);const e=this.meeting.self.getCurrentDevices();e.speaker!=null&&await this.audio.setDevice(e.speaker.deviceId)}async handleAutoPlayError(){this.audio||await this.setupAudio(),this.audio.onError(()=>{this.showPlayDialog=!0}),this.audio.play()}async handleEvents(e){this.audioUpdateListener=({id:r,audioEnabled:s,audioTrack:i})=>{const o=`audio-${r}`;s&&i!=null?this.audio.addTrack(o,i):this.audio.removeTrack(o)};const n=e.participants.joined.toArray();for(const r of n)this.audioUpdateListener(r);this.participantLeftListener=({id:r})=>{this.audio.removeTrack(`audio-${r}`),this.audio.removeTrack(`screenshare-${r}`)},this.screenShareUpdateListener=({id:r,screenShareEnabled:s,screenShareTracks:i})=>{const o=`screenshare-${r}`;s&&i.audio!=null?this.audio.addTrack(o,i.audio):this.audio.removeTrack(o)},this.deviceUpdateListener=({device:r,preview:s})=>{s||r.kind==="audiooutput"&&this.audio.setDevice(r.deviceId)},e.participants.joined.addListener("audioUpdate",this.audioUpdateListener),e.participants.joined.addListener("screenShareUpdate",this.screenShareUpdateListener),e.participants.joined.addListener("participantLeft",this.participantLeftListener),e.self.addListener("deviceUpdate",this.deviceUpdateListener)}async meetingChanged(e){var n;e&&(this.setupAudio(),w6(e)?(this.stageStatusUpdateListener=async r=>{r==="ON_STAGE"&&await this.handleAutoPlayError()},(n=e.stage)===null||n===void 0||n.on("stageStatusUpdate",this.stageStatusUpdateListener)):await this.handleAutoPlayError(),await this.handleEvents(e))}render(){return $(mt,{key:"14ddae0562633e4433788c18fb89533248df6c2b"},this.showPlayDialog&&$("rtk-dialog",{key:"d0e33058fbcd77861009ce80d7d4e29b2b597475",open:!0,onRtkDialogClose:this.onRtkDialogClose,hideCloseButton:!0,disableEscapeKey:!0,iconPack:this.iconPack,t:this.t},$("div",{key:"e6a9a18c1eaf3e09d13e25373982183b3ad6f8ec",class:"modal"},$("h3",{key:"bc87cc408aad7117cc8d808e38142b3801e5ff53"},this.t("audio_playback.title")),$("p",{key:"b1927a5cd053c59e19a6c4c54044ca500691ee71"},this.t("audio_playback.description")),$("rtk-button",{key:"3c022bb0602295cbd5996ae2ee066e254b1af2fb",kind:"wide",onClick:()=>{this.audio.play(),this.onRtkDialogClose()},title:this.t("audio_playback")},this.t("audio_playback")))))}static get watchers(){return{meeting:["meetingChanged"]}}};XNe([ge()],cB.prototype,"meeting",void 0);XNe([ge()],cB.prototype,"iconPack",void 0);XNe([ge()],cB.prototype,"t",void 0);cB.style=aUn;var oUn=Object.freeze({__proto__:null,rtk_participants_audio:cB});const lUn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:block}:host([data-hidden]){display:none}.waiting-participants-count{position:absolute;right:var(--rtk-space-3, 12px);box-sizing:border-box;padding:var(--rtk-space-0\\.5, 2px);-webkit-user-select:none;-moz-user-select:none;user-select:none;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));font-size:12px;display:flex;height:var(--rtk-space-5, 20px);min-width:var(--rtk-space-5, 20px);align-items:center;justify-content:center;border-radius:9999px;z-index:1}:host([variant='horizontal']) .waiting-participants-count{right:var(--rtk-space-4, 16px);top:50%;transform:translateY(-50%)}",cUn=lUn;var Yne=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const GI=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.variant="button",this.iconPack=Nt,this.t=It(),this.participantsActive=!1,this.waitlistedParticipants=[],this.stageRequestedParticipants=[],this.badgeCount=0,this.canViewParticipants=!1,this.updateStageRequests=async e=>{var n,r,s;e||(e=(s=(r=(n=this.meeting.stage)===null||n===void 0?void 0:n.getAccessRequests())===null||r===void 0?void 0:r.stageRequests)!==null&&s!==void 0?s:[]),this.stageRequestedParticipants=e,this.stageRequestedParticipants=this.meeting.stage.status==="REQUESTED_TO_JOIN_STAGE"?[this.meeting.self,...e]:e,this.updateBadgeCount()},this.updateBadgeCount=()=>{this.badgeCount=this.waitlistedParticipants.length+this.stageRequestedParticipants.length},this.updateCanView=()=>{this.canViewParticipants=jbe(this.meeting)}}connectedCallback(){this.meetingChanged(this.meeting),this.statesChanged(this.states)}disconnectedCallback(){var t,e,n;this.meeting&&((e=(t=this.meeting)===null||t===void 0?void 0:t.stage)===null||e===void 0||e.removeListener("stageStatusUpdate",this.updateCanView),this.waitlistedParticipantJoinedListener&&this.meeting.participants.waitlisted.removeListener("participantJoined",this.waitlistedParticipantJoinedListener),this.waitlistedParticipantLeftListener&&this.meeting.participants.waitlisted.removeListener("participantLeft",this.waitlistedParticipantLeftListener),(n=this.meeting.stage)===null||n===void 0||n.removeListener("stageAccessRequestUpdate",this.updateStageRequests))}meetingChanged(t){var e;t&&(this.canViewParticipants=jbe(t),(e=t==null?void 0:t.stage)===null||e===void 0||e.on("stageStatusUpdate",this.updateCanView),t.self.permissions.acceptWaitingRequests&&(this.waitlistedParticipants=t.participants.waitlisted.toArray(),this.waitlistedParticipantJoinedListener=n=>{this.waitlistedParticipants.some(r=>r.id===n.id)||(this.waitlistedParticipants=[...this.waitlistedParticipants,n],this.updateBadgeCount())},this.waitlistedParticipantLeftListener=n=>{this.waitlistedParticipants=this.waitlistedParticipants.filter(r=>r.id!==n.id),this.updateBadgeCount()},t.participants.waitlisted.addListener("participantJoined",this.waitlistedParticipantJoinedListener),t.participants.waitlisted.addListener("participantLeft",this.waitlistedParticipantLeftListener)),this.meeting.self.permissions.stageEnabled&&this.meeting.self.permissions.acceptStageRequests&&(this.updateStageRequests(),t==null||t.stage.on("stageAccessRequestUpdate",this.updateStageRequests)),this.updateBadgeCount())}statesChanged(t){t!=null&&(this.participantsActive=t.activeSidebar===!0&&t.sidebar==="participants")}toggleParticipantsTab(){const t=this.states;this.participantsActive=!(t!=null&&t.activeSidebar&&(t==null?void 0:t.sidebar)==="participants"),this.stateUpdate.emit({activeSidebar:this.participantsActive,sidebar:this.participantsActive?"participants":void 0,activeMoreMenu:!1})}handleParticipantsActiveChange(){!this.participantsActive&&!this.states.activeSidebar&&this.buttonEl.focus()}render(){if(!this.canViewParticipants)return $(mt,{"data-hidden":!0});const t=this.t("participants");return $(mt,{title:t},this.badgeCount!==0&&!this.participantsActive&&$("div",{class:"waiting-participants-count",part:"waiting-participants-count"},$("span",null,this.badgeCount<=100?this.badgeCount:"99+")),$("rtk-controlbar-button",{ref:e=>this.buttonEl=e,part:"controlbar-button",size:this.size,iconPack:this.iconPack,class:{active:this.participantsActive},onClick:()=>this.toggleParticipantsTab(),icon:this.iconPack.participants,label:t,variant:this.variant}))}static get watchers(){return{meeting:["meetingChanged"],states:["statesChanged"],participantsActive:["handleParticipantsActiveChange"]}}};Yne([ge()],GI.prototype,"meeting",void 0);Yne([ge()],GI.prototype,"states",void 0);Yne([ge()],GI.prototype,"iconPack",void 0);Yne([ge()],GI.prototype,"t",void 0);GI.style=cUn;var dUn=Object.freeze({__proto__:null,rtk_participants_toggle:GI});const uUn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}:host([data-hidden]){display:none}",hUn=uUn;var dB=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const cN=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.variant="button",this.config=Os(),this.iconPack=Nt,this.t=It(),this.pipSupported=!1}connectedCallback(){this.meetingChanged(this.meeting)}meetingChanged(t){var e,n,r;t&&(this.pipSupported=((e=t.participants.pip)===null||e===void 0?void 0:e.isSupported())&&((n=t.self.config)===null||n===void 0?void 0:n.pipMode)&&((r=t.self.config)===null||r===void 0?void 0:r.viewType)!=="LIVESTREAM")}togglePip(){this.meeting.participants.pip&&(this.meeting.participants.pip.isActive?this.meeting.participants.pip.disable():this.meeting.participants.pip.enable(),this.stateUpdate.emit({activeMoreMenu:!1}))}render(){if(!this.meeting)return null;if(!this.pipSupported)return $(mt,{"data-hidden":!0});const t=this.meeting.participants.pip.isActive;return $(mt,{role:"log","aria-label":"Picture-in-Picture mode"},$("rtk-controlbar-button",{part:"controlbar-button",size:this.size,iconPack:this.iconPack,onClick:()=>this.togglePip(),icon:t?this.iconPack.pip_on:this.iconPack.pip_off,label:t?this.t("pip_off"):this.t("pip_on"),variant:this.variant}))}static get watchers(){return{meeting:["meetingChanged"]}}};dB([ge()],cN.prototype,"meeting",void 0);dB([ge()],cN.prototype,"states",void 0);dB([ge()],cN.prototype,"config",void 0);dB([ge()],cN.prototype,"iconPack",void 0);dB([ge()],cN.prototype,"t",void 0);cN.style=hUn;var mUn=Object.freeze({__proto__:null,rtk_pip_toggle:cN});const fUn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}:host([data-hidden]){display:none}",pUn=fUn;var Qne=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const WI=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.variant="button",this.iconPack=Nt,this.t=It(),this.pluginsActive=!1,this.canViewPlugins=!1,this.updateCanView=()=>{this.canViewPlugins=Ebe(this.meeting)}}disconnectedCallback(){var t,e,n,r;(e=(t=this.meeting)===null||t===void 0?void 0:t.stage)===null||e===void 0||e.removeListener("stageStatusUpdate",this.updateCanView),(r=(n=this.meeting)===null||n===void 0?void 0:n.self)===null||r===void 0||r.permissions.removeListener("pluginsUpdate",this.updateCanView)}connectedCallback(){this.statesChanged(this.states),this.meetingChanged(this.meeting)}meetingChanged(t){var e,n;t&&(this.canViewPlugins=Ebe(t),(e=t==null?void 0:t.stage)===null||e===void 0||e.on("stageStatusUpdate",this.updateCanView),(n=t==null?void 0:t.self)===null||n===void 0||n.permissions.addListener("pluginsUpdate",this.updateCanView))}statesChanged(t){t!=null&&(this.pluginsActive=t.activeSidebar===!0&&t.sidebar==="plugins")}togglePlugins(){const t=this.states;this.pluginsActive=!(t!=null&&t.activeSidebar&&(t==null?void 0:t.sidebar)==="plugins"),this.stateUpdate.emit({activeSidebar:this.pluginsActive,sidebar:this.pluginsActive?"plugins":void 0,activeMoreMenu:!1})}handlePluginsActiveChange(){!this.pluginsActive&&!this.states.activeSidebar&&this.buttonEl.focus()}render(){if(!this.canViewPlugins)return $(mt,{"data-hidden":!0});const t=this.t("plugins");return $(mt,{title:t},$("rtk-controlbar-button",{ref:e=>this.buttonEl=e,part:"controlbar-button",size:this.size,iconPack:this.iconPack,class:{active:this.pluginsActive},onClick:()=>this.togglePlugins(),icon:this.iconPack.rocket,label:t,variant:this.variant}))}static get watchers(){return{meeting:["meetingChanged"],states:["statesChanged"],pluginsActive:["handlePluginsActiveChange"]}}};Qne([ge()],WI.prototype,"meeting",void 0);Qne([ge()],WI.prototype,"states",void 0);Qne([ge()],WI.prototype,"iconPack",void 0);Qne([ge()],WI.prototype,"t",void 0);WI.style=pUn;var gUn=Object.freeze({__proto__:null,rtk_plugins_toggle:WI});const vUn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:block}:host([data-hidden]){display:none}.unread-count{position:absolute;right:var(--rtk-space-3, 12px);box-sizing:border-box;padding:var(--rtk-space-0\\.5, 2px);-webkit-user-select:none;-moz-user-select:none;user-select:none;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));font-size:12px;color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));display:flex;height:var(--rtk-space-5, 20px);min-width:var(--rtk-space-5, 20px);align-items:center;justify-content:center;border-radius:9999px;z-index:1}:host([variant='horizontal']) .unread-count{right:var(--rtk-space-4, 16px);top:50%;transform:translateY(-50%)}",yUn=vUn;var Zne=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const qI=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.variant="button",this.iconPack=Nt,this.t=It(),this.pollsActive=!1,this.unreadPollsCount=0,this.canViewPolls=!1,this.onPollsUpdate=({newPoll:e})=>{e===!0&&(this.unreadPollsCount+=1)},this.updateCanView=()=>{this.canViewPolls=Cbe(this.meeting)}}connectedCallback(){this.meetingChanged(this.meeting),this.statesChanged(this.states)}disconnectedCallback(){var t,e,n,r,s,i;(e=(t=this.meeting)===null||t===void 0?void 0:t.polls)===null||e===void 0||e.removeListener("pollsUpdate",this.onPollsUpdate),(r=(n=this.meeting)===null||n===void 0?void 0:n.self)===null||r===void 0||r.permissions.removeListener("pollsUpdate",this.updateCanView),(i=(s=this.meeting)===null||s===void 0?void 0:s.stage)===null||i===void 0||i.removeListener("stageStatusUpdate",this.updateCanView)}meetingChanged(t){var e,n;t&&t.polls&&(this.unreadPollsCount=t.polls.items.length,this.meeting.polls.addListener("pollsUpdate",this.onPollsUpdate),(e=t==null?void 0:t.self)===null||e===void 0||e.permissions.addListener("pollsUpdate",this.updateCanView),this.canViewPolls=Cbe(t),(n=t==null?void 0:t.stage)===null||n===void 0||n.on("stageStatusUpdate",this.updateCanView))}statesChanged(t){t!=null&&(this.pollsActive=t.activeSidebar===!0&&t.sidebar==="polls")}togglePollsTab(){const t=this.states;this.unreadPollsCount=0,this.pollsActive=!(t!=null&&t.activeSidebar&&(t==null?void 0:t.sidebar)==="polls"),this.stateUpdate.emit({activeSidebar:this.pollsActive,sidebar:this.pollsActive?"polls":void 0,activeMoreMenu:!1})}handlePollsActiveChange(){!this.pollsActive&&!this.states.activeSidebar&&this.buttonEl.focus()}render(){if(!this.canViewPolls)return $(mt,{"data-hidden":!0});const t=this.t("polls");return $(mt,{title:t},this.unreadPollsCount!==0&&!this.pollsActive&&$("div",{class:"unread-count",part:"unread-count"},$("span",null,this.unreadPollsCount<=100?this.unreadPollsCount:"99+")),$("rtk-controlbar-button",{ref:e=>this.buttonEl=e,part:"controlbar-button",size:this.size,iconPack:this.iconPack,class:{active:this.pollsActive},onClick:()=>this.togglePollsTab(),icon:this.iconPack.poll,label:t,variant:this.variant}))}static get watchers(){return{meeting:["meetingChanged"],states:["statesChanged"],pollsActive:["handlePollsActiveChange"]}}};Zne([ge()],qI.prototype,"meeting",void 0);Zne([ge()],qI.prototype,"states",void 0);Zne([ge()],qI.prototype,"iconPack",void 0);Zne([ge()],qI.prototype,"t",void 0);qI.style=yUn;var bUn=Object.freeze({__proto__:null,rtk_polls_toggle:qI});const xUn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}:host([data-hidden]){display:none}:host[size='sm']{margin-left:var(--rtk-space-1, 4px);margin-right:var(--rtk-space-1, 4px)}.indicator{display:flex;flex-direction:row;align-items:center;font-size:14px;--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}rtk-icon{margin-right:var(--rtk-space-1, 4px);height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px);animation:blink 4s linear infinite}:host([size='sm']) rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}:host([size='sm']) .indicator span{display:none}@keyframes blink{0%,10%{opacity:0}11%,100%{opacity:1}}",wUn=xUn;var eTe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const uB=class{constructor(t){kt(this,t),this.t=It(),this.iconPack=Nt,this.setIsRecording=e=>{this.isRecording=e==="RECORDING"}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var t;(t=this.meeting)===null||t===void 0||t.recording.removeListener("recordingUpdate",this.updateRecordingStatus)}meetingChanged(t){t!=null&&(this.setIsRecording(t.recording.recordingState),this.updateRecordingStatus=e=>{this.setIsRecording(e)},t.recording.addListener("recordingUpdate",this.updateRecordingStatus))}render(){return $(mt,{key:"c4246e4721b0ca5fbc689a90688f1239df60ecad","data-hidden":!this.isRecording},this.isRecording&&$("div",{key:"ce19b3649bba8a91cd22770534762c932b934557",class:"indicator","aria-label":this.t("recording.indicator"),part:"indicator"},$("rtk-icon",{key:"9d2ae89fef0d4e1e0d3546f765f48be8a6da6b5a",icon:this.iconPack.recording,"aria-hidden":!0,tabIndex:-1,part:"icon"}),$("span",{key:"cedf044a1a96c164022d734be2baf7e568fb849e"},this.t("recording.label"))))}static get watchers(){return{meeting:["meetingChanged"]}}};eTe([ge()],uB.prototype,"meeting",void 0);eTe([ge()],uB.prototype,"t",void 0);eTe([ge()],uB.prototype,"iconPack",void 0);uB.style=wUn;var kUn=Object.freeze({__proto__:null,rtk_recording_indicator:uB});const SUn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}",CUn=SUn;var tTe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const hB=class{constructor(t){kt(this,t),this.apiError=Wt(this,"rtkApiError",7),this.variant="button",this.t=It(),this.iconPack=Nt,this.disabled=!1,this.canRecord=!1,this.permissionsUpdateListener=()=>{this.canRecord=this.meeting.self.permissions.canRecord===!0},this.toggleRecording=async()=>{var e,n,r;if(!(this.isLoading()||this.disabled))switch(this.recordingState){case"IDLE":try{await((e=this.meeting)===null||e===void 0?void 0:e.recording.start());return}catch{this.apiError.emit({trace:this.t("recording.start"),message:this.t("recording.error.start")})}return;case"RECORDING":try{await((n=this.meeting)===null||n===void 0?void 0:n.recording.stop());return}catch{this.apiError.emit({trace:this.t("recording.stop"),message:this.t("recording.error.stop")})}return;case"PAUSED":try{await((r=this.meeting)===null||r===void 0?void 0:r.recording.resume());return}catch{this.apiError.emit({trace:this.t("recording.resume"),message:this.t("recording.error.resume")})}return;case"STARTING":case"STOPPING":default:return}},this.isLoading=()=>!this.meeting||this.recordingState==="STARTING"||this.recordingState==="STOPPING"}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var t,e;this.recordingStateUpdateListener&&((t=this.meeting)===null||t===void 0||t.recording.removeListener("recordingUpdate",this.recordingStateUpdateListener)),(e=this.meeting)===null||e===void 0||e.self.permissions.removeListener("permissionsUpdate",this.permissionsUpdateListener)}meetingChanged(t){t!=null&&(this.recordingState=t.recording.recordingState,this.permissionsUpdateListener(),this.recordingStateUpdateListener=e=>{this.recordingState=e},t.recording.addListener("recordingUpdate",this.recordingStateUpdateListener),t.self.permissions.addListener("permissionsUpdate",this.permissionsUpdateListener))}getLabel(){switch(this.recordingState){case"IDLE":return"recording.idle";case"RECORDING":return"recording.stop";case"STARTING":return"recording.starting";case"STOPPING":return"recording.stopping";case"PAUSED":return"recording.resume";default:return"recording.loading"}}getIcon(){switch(this.recordingState){case"IDLE":return this.iconPack.recording;case"RECORDING":return this.iconPack.stop_recording;case"STARTING":case"STOPPING":default:return this.iconPack.recording}}render(){if(!this.meeting)return null;if(this.canRecord)return $(mt,{title:this.t(this.recordingState==="RECORDING"?"recording.stop":"recording.idle")},$("rtk-controlbar-button",{part:"controlbar-button",size:this.size,iconPack:this.iconPack,onClick:this.toggleRecording,icon:this.getIcon(),isLoading:this.isLoading(),label:this.t(this.getLabel()),variant:this.variant,disabled:this.disabled}))}static get watchers(){return{meeting:["meetingChanged"]}}};tTe([ge()],hB.prototype,"meeting",void 0);tTe([ge()],hB.prototype,"t",void 0);tTe([ge()],hB.prototype,"iconPack",void 0);hB.style=CUn;var jUn=Object.freeze({__proto__:null,rtk_recording_toggle:hB});const EUn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}:host([data-hidden]){display:none}",NUn=EUn;var Jne=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const wBe=()=>typeof navigator<"u"&&typeof navigator.mediaDevices<"u"&&"getDisplayMedia"in navigator.mediaDevices,KI=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.apiError=Wt(this,"rtkApiError",7),this.variant="button",this.iconPack=Nt,this.t=It(),this.maxScreenShareCount=-1,this.screenShareCount=0,this.screenShareEnabled=!1,this.canScreenShare=!1,this.shareScreenPermission="NOT_REQUESTED",this.screenShareState={tooltipLabel:this.t("screenshare.start"),label:this.t("screenshare.start"),icon:this.iconPack.share_screen_start,classList:{},showWarning:!1,disable:!1},this.stageStatus="OFF_STAGE",this.screenShareListener=()=>{const e=this.meeting.participants.active.toArray().filter(r=>r.screenShareEnabled).length,n=this.meeting.self.screenShareEnabled?1:0;this.screenShareCount=e+n,this.screenShareEnabled=this.meeting.self.screenShareEnabled,this.getState(),this.meeting.__internals__.logger.info("rtkScreenShare::screenShareUpdate",{media:{screenshare:{enabled:this.screenShareEnabled,count:this.screenShareCount}}})},this.participantLeftListener=({screenShareEnabled:e})=>{e&&(this.screenShareCount=Math.max(this.screenShareCount-1,0),this.getState(),this.meeting.__internals__.logger.info("rtkScreenShare::screenShareUpdate",{media:{screenshare:{enabled:this.screenShareEnabled,count:this.screenShareCount}}}))},this.stageStatusListener=()=>{this.stageStatus=this.meeting.stage.status,this.canScreenShare=this.meeting.self.permissions.canProduceScreenshare==="ALLOWED"},this.mediaPermissionUpdateListener=({kind:e,message:n})=>{if(e==="screenshare"&&(this.shareScreenPermission=n,this.getState(),n==="COULD_NOT_START"&&this.apiError.emit({trace:this.t("screenshare.permissions"),message:this.t("screenshare.error.unknown")}),this.hasPermissionError())){const r={enabled:!0,kind:"screenshare"};this.stateUpdate.emit({activePermissionsMessage:r})}},this.reachedMaxScreenShares=()=>this.maxScreenShareCount>0&&this.screenShareCount>=this.maxScreenShareCount,this.toggleScreenShare=async()=>{var e;if(this.screenShareState.disable)return;if(this.hasPermissionError()){const r={enabled:!0,kind:"screenshare"};return this.stateUpdate.emit({activePermissionsMessage:r}),!1}const n=(e=this.meeting)===null||e===void 0?void 0:e.self;if(this.screenShareEnabled){n.disableScreenShare();return}n==null||!this.canScreenShare||this.reachedMaxScreenShares()||this.hasPermissionError()||(this.screenShareState=Object.assign(Object.assign({},this.screenShareState),{disable:!0}),await n.enableScreenShare(),this.screenShareState=Object.assign(Object.assign({},this.screenShareState),{disable:!1}),this.stateUpdate.emit({activeMoreMenu:!1}))}}connectedCallback(){if(!wBe()){this.meeting.__internals__.logger.error("[rtk-screenshare-toggle] Device does not support screensharing.");return}this.meetingChanged(this.meeting)}disconnectedCallback(){var t,e,n,r,s,i;(t=this.meeting)===null||t===void 0||t.participants.joined.removeListener("screenShareUpdate",this.screenShareListener),(e=this.meeting)===null||e===void 0||e.participants.joined.removeListener("participantLeft",this.participantLeftListener),(n=this.meeting)===null||n===void 0||n.self.removeListener("screenShareUpdate",this.screenShareListener),(r=this.meeting)===null||r===void 0||r.self.removeListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),(i=(s=this.meeting)===null||s===void 0?void 0:s.stage)===null||i===void 0||i.removeListener("stageStatusUpdate",this.stageStatusListener)}meetingChanged(t){if(t!=null){const{self:e,stage:n}=t;this.canScreenShare=this.meeting.self.permissions.canProduceScreenshare==="ALLOWED",this.maxScreenShareCount=e.config.maxScreenShareCount,this.screenShareEnabled=e.screenShareEnabled;let r=0;for(const s of t.participants.joined.toArray())s.screenShareEnabled&&r++;this.screenShareCount=r,this.getState(),t.__internals__.logger.info("rtkScreenShare::initialise",{media:{screenshare:{enabled:this.screenShareEnabled,count:this.screenShareCount,maxAllowedCount:this.maxScreenShareCount}}}),this.stageStatus=t.stage.status,t.participants.joined.addListener("screenShareUpdate",this.screenShareListener),t.participants.joined.addListener("participantLeft",this.participantLeftListener),e.addListener("screenShareUpdate",this.screenShareListener),e.addListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),n==null||n.addListener("stageStatusUpdate",this.stageStatusListener)}}hasPermissionError(){return this.shareScreenPermission==="SYSTEM_DENIED"||this.shareScreenPermission==="DENIED"}getState(){let t="",e="",n="",r={};const s=this.hasPermissionError()&&!this.screenShareEnabled,i=this.reachedMaxScreenShares()&&!this.screenShareEnabled,o=this.shareScreenPermission==="COULD_NOT_START";this.screenShareEnabled&&!s?(e=this.t("screenshare.stop"),n=this.iconPack.share_screen_stop,r["red-icon"]=!0):(e=this.t("screenshare.start"),n=this.iconPack.share_screen_start),this.shareScreenPermission==="SYSTEM_DENIED"?(t=this.t("perm_sys_denied.screenshare"),r["red-icon"]=!0):this.shareScreenPermission==="DENIED"?(t=this.t("perm_denied.screenshare"),r["red-icon"]=!0):t=e,i&&(t=this.t("screenshare.error.max_count")),o&&(t=this.t("screenshare.error.unknown")),this.screenShareState={tooltipLabel:t,label:e,icon:n,classList:r,disable:s||i,showWarning:s||i||o}}render(){return!wBe()||!this.canScreenShare||["OFF_STAGE","REQUESTED_TO_JOIN_STAGE"].includes(this.stageStatus)?$(mt,{"data-hidden":!0}):$(mt,{title:this.screenShareState.label},$("rtk-tooltip",{placement:"top",kind:"block",label:this.screenShareState.tooltipLabel,delay:600,part:"tooltip"},$("rtk-controlbar-button",{part:"controlbar-button",size:this.size,iconPack:this.iconPack,variant:this.variant,label:this.screenShareState.label,icon:this.screenShareState.icon,class:this.screenShareState.classList,onClick:this.toggleScreenShare,disabled:this.screenShareState.disable,showWarning:this.screenShareState.showWarning})))}static get watchers(){return{meeting:["meetingChanged"]}}};Jne([ge()],KI.prototype,"states",void 0);Jne([ge()],KI.prototype,"meeting",void 0);Jne([ge()],KI.prototype,"iconPack",void 0);Jne([ge()],KI.prototype,"t",void 0);KI.style=NUn;var TUn=Object.freeze({__proto__:null,rtk_screen_share_toggle:KI});const Gxt=t=>{t!=null&&(t.requestFullscreen!=null?t.requestFullscreen():t.mozRequestFullScreen!=null?t.mozRequestFullScreen():t.webkitRequestFullscreen!=null?t.webkitRequestFullscreen():t.msRequestFullscreen!=null&&t.msRequestFullscreen())},Wxt=()=>{document.exitFullscreen!=null?document.exitFullscreen():document.mozExitFullScreen!=null?document.mozExitFullScreen():document.webkitExitFullscreen!=null?document.webkitExitFullscreen():document.msExitFullscreen!=null&&document.msExitFullscreen()},qxt=()=>document.fullscreenElement!=null||document.webkitCurrentFullScreenElement!=null,Kxt=()=>typeof document<"u"?document.fullscreenEnabled||document.mozFullscreenEnabled||document.webkitFullscreenEnabled||document.msFullscreenEnabled:!1,_Un=`:host {
  line-height: initial;
  font-family: var(--rtk-font-family, sans-serif);

  font-feature-settings: normal;
  font-variation-settings: normal;
}

p {
  margin: var(--rtk-space-0, 0px);
  padding: var(--rtk-space-0, 0px);
}


:host {
  height: 100%;
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: var(--rtk-border-radius-lg, 12px);
  --tw-bg-opacity: 1;
  background-color: rgba(var(--rtk-colors-video-bg, 24 24 24) / var(--tw-bg-opacity));
  container-type: inline-size;
  container-name: screentile;
}

::slotted(rtk-name-tag) {
  position: absolute;
  left: var(--rtk-space-3, 12px);
  bottom: var(--rtk-space-3, 12px);
  opacity: 0.8;
}

#video-container {
  position: absolute;
  display: block;
  height: 100%;
  width: 100%;
}

#video-container .fit-in-container {
  -o-object-fit: fill;
     object-fit: fill;
}

video {
  height: 100%;
  width: 100%;
  -o-object-fit: contain;
     object-fit: contain;
}

:host([variant='gradient']) ::slotted(rtk-audio-visualizer) {
  position: absolute;
  top: var(--rtk-space-2, 8px);
  right: var(--rtk-space-2, 8px);
  border-radius: 9999px;
  --tw-bg-opacity: 1;
  background-color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));
  padding: var(--rtk-space-2, 8px);
}

:host([variant='gradient']) ::slotted(rtk-name-tag) {
  bottom: var(--rtk-space-0, 0px);
  left: var(--rtk-space-0, 0px);
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  text-align: center;
  background-color: transparent;
  background-image: linear-gradient(to top, var(--tw-gradient-stops));
  --tw-gradient-from: rgb(var(--rtk-colors-background-1000, 8 8 8));
  --tw-gradient-to: rgba(var(--rtk-colors-background-1000, 8 8 8) / 0);
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
  --tw-gradient-to: transparent;
}

:host([size='sm'][variant='gradient']) ::slotted(rtk-audio-visualizer) {
  height: var(--rtk-space-5, 20px);
  width: var(--rtk-space-5, 20px);
}

video.visible {
  animation: video-fadein 0.4s ease;
}

#controls {
  display: none;
  position: absolute;
  top: var(--rtk-space-3, 12px);
  right: var(--rtk-space-3, 12px);
  align-items: center;
  justify-content: flex-end;
  gap: var(--rtk-space-2, 8px);
}

:host(:hover) #controls, 
:host(:active) #controls, 
:host(:focus-visible) #controls {
  display: flex;
}

#full-screen-btn {
  --tw-bg-opacity: 1;
  background-color: rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));
}

/** For self view */

h3 {
  margin-top: var(--rtk-space-10, 40px);
  margin-bottom: var(--rtk-space-6, 24px);
  text-align: center;
  font-size: 20px;
  font-weight: 500;
}

:host([size='sm']) h3 {
  font-size: 16px;
}

#self-message {
  padding-left: var(--rtk-space-4, 16px);
  padding-right: var(--rtk-space-4, 16px);
}

:host(.isSelf) #self-view {
  flex: 1 1 0%;
}

:host(.isSelf) #video-container {
  position: static;
  aspect-ratio: auto;
  height: auto;
  width: 50%;
  max-width: var(--rtk-space-96, 384px);
  border-radius: var(--rtk-border-radius-md, 8px);
  transition: 0.6s ease;
}

:host(.isSelf) #video-container.expand {
  width: 60%;
  max-width: 100%;
}

.actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--rtk-space-2, 8px);
}

:host([size='sm'].isSelf) #video-container,
:host([size='md'].isSelf) #video-container,
:host([size='sm'].isSelf) #expand-btn,
:host([size='md'].isSelf) #expand-btn {
  /** Hide video, fullscreen buttons in sm and md breakpoints */
  display: none;
}

/** Remote control */

p {
  margin: var(--rtk-space-0, 0px);
  padding: var(--rtk-space-0, 0px);
}

.remote-control {
  z-index: 10;
  height: 100%;
  max-height: 100%;
  flex: 0 1 auto;
}

#remote-control-self {
  position: absolute;
  top: var(--rtk-space-0, 0px);
  left: 50%;
  z-index: 10;
  width: -moz-max-content;
  width: max-content;
  max-width: 100%;
  box-sizing: border-box;
  display: flex;
  height: var(--rtk-space-8, 32px);
  align-items: center;
  overflow: hidden;
  border-radius: var(--rtk-border-radius-sm, 4px);
  --tw-bg-opacity: 1;
  background-color: rgba(var(--rtk-colors-warning, 255 205 7) / var(--tw-bg-opacity));
  font-size: 12px;
  color: rgb(var(--rtk-colors-text-1000, 255 255 255));
  transform: translateX(-50%);
}

#remote-control-self p {
  padding-left: var(--rtk-space-3, 12px);
  padding-right: var(--rtk-space-3, 12px);
  padding-top: var(--rtk-space-2, 8px);
  padding-bottom: var(--rtk-space-2, 8px);
}

#remote-control-self rtk-button {
  height: 100%;
  border-radius: var(--rtk-border-radius-none, 0);
  --tw-bg-opacity: 1;
  background-color: rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-bg-opacity));
  font-size: 12px;
}

:host([size='sm']) #remote-control-self {
  height: auto;
  flex-direction: column;
}

:host([size='sm']) #remote-control-self rtk-button {
  width: 100%;
  padding-top: var(--rtk-space-1, 4px);
  padding-bottom: var(--rtk-space-1, 4px);
}

/** Name tag positions */

:host([name-tag-position='bottom-right']) ::slotted(rtk-name-tag) {
  left: auto;
  right: var(--rtk-space-3, 12px);
}

:host([name-tag-position='bottom-center']) ::slotted(rtk-name-tag) {
  left: auto;
  right: auto;
}

:host([name-tag-position='top-left']) ::slotted(rtk-name-tag) {
  top: var(--rtk-space-3, 12px);
  bottom: auto;
}

:host([name-tag-position='top-right']) ::slotted(rtk-name-tag) {
  top: var(--rtk-space-3, 12px);
  right: var(--rtk-space-3, 12px);
  left: auto;
  bottom: auto;
}

:host([name-tag-position='top-center']) ::slotted(rtk-name-tag) {
  left: auto;
  right: auto;
  bottom: auto;
  top: var(--rtk-space-3, 12px);
}

/** Keyframes */

@keyframes video-fadein {
  0% {
    opacity: 0;
    transform: scale(1.4) translateY(20px);
  }

  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

::slotted(rtk-network-indicator) {
  position: absolute;
  right: var(--rtk-space-3, 12px);
  bottom: var(--rtk-space-3, 12px);
}

@media only screen and (max-height: 480px) and (orientation: landscape) {
    :host([size='sm'][variant='solid']) ::slotted(rtk-name-tag), 
    :host([size='sm'][variant='solid']) rtk-name-tag {
    left: var(--rtk-space-0, 0px);
    bottom: var(--rtk-space-0, 0px);
    border-radius: var(--rtk-border-radius-none, 0);
      transform-origin: 0% 110%;
      transform: scale(0.6);
  }
}

@container screentile (max-width: 400px) {
  ::slotted(rtk-name-tag) {
    transform-origin: 0 130%;
    transform: scale(0.7);
  }
}
`,AUn=_Un;var nTe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const mB=class{constructor(e){kt(this,e),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.play=Wt(this,"screensharePlay",7),this.fullScreenListener=()=>{this.isFullScreen=qxt()},this.participantScreenshareUpdate=n=>{n.id===this.participant.id&&this.screenShareListener(n)},this.hideFullScreenButton=!1,this.nameTagPosition="bottom-left",this.variant="solid",this.iconPack=Nt,this.t=It(),this.videoExpanded=!1,this.screenShareEnabled=!1,this.isFullScreen=!1,this.toggleFullScreen=()=>{this.isFullScreen?(Wxt(),this.isFullScreen=!1):(Gxt(this.host),this.isFullScreen=!0)}}connectedCallback(){window==null||window.addEventListener("fullscreenchange",this.fullScreenListener),window==null||window.addEventListener("webkitfullscreenchange",this.fullScreenListener)}componentDidLoad(){this.participantChanged(this.participant)}disconnectedCallback(){if(!this.meeting)return;const{self:e}=this.meeting;this.participant.id===e.id&&this.screenShareListener?this.participant.removeListener("screenShareUpdate",this.screenShareListener):this.meeting.participants.joined.removeListener("screenShareUpdate",this.participantScreenshareUpdate),window==null||window.removeEventListener("fullscreenchange",this.fullScreenListener),window==null||window.removeEventListener("webkitfullscreenchange",this.fullScreenListener)}participantChanged(e){if(e!=null&&this.meeting){const{self:n}=this.meeting;this.screenShareListener=({screenShareEnabled:r,screenShareTracks:s})=>{const i=r&&s.video!=null;if(Dc(()=>{this.screenShareEnabled=i}),i){const o=new MediaStream;o.addTrack(s.video),this.videoEl!=null&&(this.videoEl.srcObject=o,this.videoEl.play())}else this.videoEl!=null&&(this.videoEl.srcObject=void 0)},this.screenShareListener(e),e.id===n.id?e.addListener("screenShareUpdate",this.screenShareListener):this.meeting.participants.joined.addListener("screenShareUpdate",this.participantScreenshareUpdate)}}render(){var e,n;const r=((e=this.participant)===null||e===void 0?void 0:e.id)===((n=this.meeting)===null||n===void 0?void 0:n.self.id),s=this.isFullScreen?this.t("full_screen.exit"):this.t("full_screen"),i=this.isFullScreen?this.iconPack.full_screen_minimize:this.iconPack.full_screen_maximize;return $(mt,{key:"10646f5ea7b7b9bc162c2a98af07928a0f68f605",class:{isSelf:r}},$("div",{key:"video-container",id:"video-container",class:{expand:this.videoExpanded}},$("video",{key:"13e87cfee55fdd6d45a72ec55792fbbfefdc5206",ref:o=>this.videoEl=o,class:{visible:this.screenShareEnabled,"fit-in-container":this.participant.supportsRemoteControl},playsInline:!0,onPlay:()=>{this.play.emit({screenshareParticipant:this.participant,participant:this.meeting.self})},autoPlay:!0,muted:!0,id:`screen-share-video-${this.participant.id}`})),$("div",{id:"controls",key:"controls"},!this.hideFullScreenButton&&!r&&Kxt()&&$("rtk-tooltip",{key:"97ba6869139126f0114aee3239999bfe1172a798",label:s},$("rtk-button",{key:"0769449ffcba69117d10a7346e4881c207e7ac6f",id:"full-screen-btn",kind:"icon",onClick:this.toggleFullScreen,title:s},$("rtk-icon",{key:"508cf201f0b2e6da061e35dff4d3899f1da0749a",icon:i,"aria-hidden":!0,tabIndex:-1})))),r&&$("div",{id:"self-message",key:"self-message"},$("h3",{key:"6f055da4722c11893e3f8640bddad7f6844838da"},this.t("screenshare.shared")),$("div",{key:"96fa5f8b47cef2a2a58352e4275c3c325f22a465",class:"actions"},this.meeting!=null&&$("rtk-button",{key:"144c3908476ac18d1ffcc1282a46a4d7fad698c2",variant:"danger",onClick:()=>{this.meeting.self.disableScreenShare()}},$("rtk-icon",{key:"7a6f710ccb916ca78edbb5daa9b6bcf3547ed54e",icon:this.iconPack.share_screen_stop,slot:"start"}),this.t("screenshare.stop")),$("rtk-button",{key:"1667e04e5a22c3edfdab9300ffca06df7eba4948",variant:"secondary",id:"expand-btn",onClick:()=>{this.videoExpanded=!this.videoExpanded}},$("rtk-icon",{key:"6140671792e626d5de181861ee4c7aef1dd11e3e",icon:this.videoExpanded?this.iconPack.full_screen_minimize:this.iconPack.full_screen_maximize,slot:"start"}),this.videoExpanded?this.t("screenshare.min_preview"):this.t("screenshare.max_preview")))),$("slot",{key:"beeecb6fe5a1f46d259a86e698c31fb477949bf3"}))}get host(){return Pl(this)}static get watchers(){return{participant:["participantChanged"]}}};nTe([ge()],mB.prototype,"meeting",void 0);nTe([ge()],mB.prototype,"iconPack",void 0);nTe([ge()],mB.prototype,"t",void 0);mB.style=AUn;var PUn=Object.freeze({__proto__:null,rtk_screenshare_view:mB});const RUn=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;display:flex;overflow:hidden;border-radius:var(--rtk-border-radius-md, 8px);width:100%;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}header{display:flex;align-items:center;justify-content:space-between;padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}.title{font-size:20px;line-height:1}.back-btn,.dismiss-btn{border-radius:var(--rtk-border-radius-sm, 4px);background-color:transparent;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.back-btn:hover,.dismiss-btn:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}aside{box-sizing:border-box;display:flex;min-width:var(--rtk-space-56, 224px);flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));padding-left:var(--rtk-space-2, 8px)}aside button{margin-top:var(--rtk-space-4, 16px);box-sizing:border-box;display:flex;width:100%;align-items:center;justify-content:space-between;border-top-left-radius:var(--rtk-border-radius-sm, 4px);border-bottom-left-radius:var(--rtk-border-radius-sm, 4px);padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px);padding-top:var(--rtk-space-3, 12px);padding-bottom:var(--rtk-space-3, 12px);background-color:transparent;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));cursor:default;font-size:16px;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);border-width:var(--rtk-border-width-none, 0);border-style:none;outline:2px solid transparent;outline-offset:2px}aside button .right{display:flex;align-items:center}aside button .right rtk-icon{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}aside button .right rtk-icon:last-child{margin-left:var(--rtk-space-4, 16px)}aside button[type='button']{cursor:pointer;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}aside button[type='button']:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}aside button[type='button']{border-right:var(--rtk-border-width-md, 2px) solid transparent}aside button.active{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-border-opacity));background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / 0.2)}aside button.active:hover{background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / 0.2)}rtk-icon.poor{--tw-text-opacity:1;color:rgba(var(--rtk-colors-warning, 255 205 7) / var(--tw-text-opacity))}rtk-icon.poorest{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}rtk-icon.good{--tw-text-opacity:1;color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-text-opacity))}main{display:flex;flex:1 1 0%;align-items:center;justify-content:center;padding-left:var(--rtk-space-6, 24px);padding-right:var(--rtk-space-6, 24px);box-sizing:border-box;width:100%;max-width:calc(100% - var(--rtk-space-56, 224px))}.dismiss-btn{position:absolute;top:var(--rtk-space-3, 12px);right:var(--rtk-space-3, 12px);height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}:host([size='sm']) aside{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}:host([size='sm']) .dismiss-btn{top:var(--rtk-space-5, 20px);right:var(--rtk-space-4, 16px)}:host([size='sm']) aside{width:100%;padding-left:var(--rtk-space-0, 0px)}:host([size='sm']) aside button{border-radius:var(--rtk-border-radius-none, 0)}:host([size='sm']) aside button.active{border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent}:host([size='sm']) aside button.active:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}:host([size='sm']) aside.hide{display:none}:host([size='sm']) main{display:none;max-width:100%;overflow-y:auto;padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}:host([size='sm']) main header{justify-content:center}:host([size='sm']) main header rtk-button{position:absolute;left:var(--rtk-space-4, 16px)}:host([size='sm']) main.active{display:block}`,IUn=RUn;var Xne=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const YI=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.keyPressListener=e=>{e.key==="Escape"&&this.close()},this.stageStatusListener=()=>{this.canProduceVideo=this.meeting.self.permissions.canProduceVideo==="ALLOWED"},this.iconPack=Nt,this.t=It(),this.activeTab="connection",this.isMobileMainVisible=!1,this.networkStatus="good",this.canProduceVideo=!1}connectedCallback(){document.addEventListener("keydown",this.keyPressListener),this.meetingChanged(this.meeting)}disconnectedCallback(){var t;this.keyPressListener&&document.removeEventListener("keydown",this.keyPressListener),this.poorConnectionListener&&((t=this.meeting)===null||t===void 0||t.meta.removeListener("poorConnection",this.poorConnectionListener)),this.meeting.stage.removeListener("stageStatusUpdate",this.stageStatusListener)}meetingChanged(t){t!=null&&(this.canProduceVideo=this.meeting.self.permissions.canProduceVideo==="ALLOWED",this.canProduceVideo?this.activeTab="video":this.activeTab="audio",this.poorConnectionListener=({score:e})=>{e<7?this.networkStatus="poor":e<4&&(this.networkStatus="poorest"),setTimeout(()=>{this.networkStatus="good"},5e3)},t.meta.addListener("poorConnection",this.poorConnectionListener),t.stage.addListener("stageStatusUpdate",this.stageStatusListener))}changeTab(t){this.activeTab=t,this.size==="sm"&&(this.isMobileMainVisible||(this.isMobileMainVisible=!0))}close(){this.stateUpdate.emit({activeSettings:!1})}render(){if(!this.meeting)return null;const t={meeting:this.meeting,states:this.states,iconPack:this.iconPack,t:this.t};return $(mt,null,$("aside",{class:{hide:this.isMobileMainVisible},part:"menu"},$("header",null,$("h2",null,this.t("settings"))),$("button",{type:"button",class:{active:this.activeTab==="audio"},onClick:()=>this.changeTab("audio")},this.t("audio"),$("div",{class:"right"},$("rtk-icon",{icon:this.iconPack.mic_on}),this.size==="sm"&&$("rtk-icon",{icon:this.iconPack.chevron_right}))),this.canProduceVideo&&$("button",{type:"button",class:{active:this.activeTab==="video"},onClick:()=>this.changeTab("video")},this.t("video"),$("div",{class:"right"},$("rtk-icon",{icon:this.iconPack.video_on}),this.size==="sm"&&$("rtk-icon",{icon:this.iconPack.chevron_right}))),$("button",{type:"none",title:`Your network condition is ${this.networkStatus}`},this.t("connection"),$("div",{class:"right"},$("rtk-icon",{icon:this.iconPack.wifi,class:this.networkStatus})))),$("main",{class:{active:this.isMobileMainVisible,scrollbar:!0},part:"main-content"},this.size==="sm"&&$("header",null,$("rtk-button",{kind:"icon",class:"back-btn",onClick:()=>this.isMobileMainVisible=!1},$("rtk-icon",{icon:this.iconPack.chevron_left})),$("h2",null,this.t(this.activeTab==="audio"?"audio":"video"))),this.activeTab==="audio"&&$("rtk-settings-audio",Object.assign({},t)),this.activeTab==="video"&&$("rtk-settings-video",Object.assign({},t))))}static get watchers(){return{meeting:["meetingChanged"]}}};Xne([ge()],YI.prototype,"meeting",void 0);Xne([ge()],YI.prototype,"states",void 0);Xne([ge()],YI.prototype,"iconPack",void 0);Xne([ge()],YI.prototype,"t",void 0);YI.style=IUn;var MUn=Object.freeze({__proto__:null,rtk_settings:YI});const LUn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}",DUn=LUn;var rTe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const fB=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.variant="button",this.iconPack=Nt,this.t=It()}toggleSettings(){const t={activeSettings:!0,activeMoreMenu:!1};this.states=Object.assign(Object.assign({},this.states),t),this.stateUpdate.emit(t)}render(){const t=this.t("settings");return $(mt,{key:"921afc41ed4a6019ff882c896855ab455b3edfb7",title:t},$("rtk-controlbar-button",{key:"88d4194fee24f1b96769e06e3a935d516ad543b0",part:"controlbar-button",size:this.size,iconPack:this.iconPack,onClick:()=>this.toggleSettings(),icon:this.iconPack.settings,label:t,variant:this.variant}))}};rTe([ge()],fB.prototype,"states",void 0);rTe([ge()],fB.prototype,"iconPack",void 0);rTe([ge()],fB.prototype,"t",void 0);fB.style=DUn;var $Un=Object.freeze({__proto__:null,rtk_settings_toggle:fB});const OUn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;padding:var(--rtk-space-4, 16px);height:100%;min-height:100%;width:100%;display:flex;place-items:center;justify-content:center;--rtk-controlbar-button-background-color:rgb(var(--rtk-colors-background-700, 44 44 44))}.container{width:100%;max-width:1080px;display:flex;align-items:center;justify-content:space-evenly;gap:var(--rtk-space-4, 16px)}.container-tile{display:flex;height:100%;width:100%;max-width:584px;flex-direction:column;gap:var(--rtk-space-2, 8px)}.metadata{display:flex;width:100%;max-width:var(--rtk-space-80, 320px);flex-direction:column;align-items:center;text-align:center}.meeting-title{margin-bottom:var(--rtk-space-4, 16px);text-align:center;font-size:24px;font-weight:500}.join-as{margin:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-4, 16px);text-align:center;font-size:16px;letter-spacing:-0.025em;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.uneditable-name{margin-bottom:var(--rtk-space-6, 24px)}.uneditable-name .text,.uneditable-name .name{display:inline-block}.uneditable-name .name{font-size:16px;font-weight:500}input{margin-bottom:var(--rtk-space-6, 24px);display:block;height:var(--rtk-space-10, 40px);width:100%;max-width:var(--rtk-space-80, 320px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);color:rgb(var(--rtk-colors-text-1000, 255 255 255));box-sizing:border-box;font-size:16px;outline:2px solid transparent;outline-offset:2px;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}input::-moz-placeholder{color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}input::placeholder{color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}input{border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60))}input:focus{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-border-opacity))}rtk-spinner{color:rgb(var(--rtk-colors-text-1000, 255 255 255));--icon-size:var(--rtk-space-8, 32px)}:host([size='sm']) .container,:host([size='md']) .container{height:100%;flex-direction:column;justify-content:space-evenly}:host([size='sm']) .container-tile,:host([size='md']) .container-tile{height:-moz-min-content;height:min-content;flex-direction:column;justify-content:center}rtk-participant-tile{height:auto;width:100%;max-width:584px}.media-selectors{display:flex;flex-direction:column;justify-content:space-between}.media-selectors .row{display:grid;grid-template-columns:repeat(2, minmax(0, 1fr))}.no-network-badge{margin-top:var(--rtk-space-2, 8px);display:flex;width:100%;flex-direction:row;align-items:center;justify-content:flex-start;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));background-color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.1);padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);font-size:12px;color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.75)}.no-network-badge rtk-icon{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px)}.troubleshoot-link{margin-top:var(--rtk-space-1, 4px);font-size:12px;--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-400, 53 110 253) / var(--tw-text-opacity));text-decoration-line:underline;text-underline-offset:2px}.troubleshoot-link:hover{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity))}.error-code{margin-top:var(--rtk-space-1, 4px);font-size:10px;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}",FUn=OUn;var pB=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const dN=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.config=Os(),this.iconPack=Nt,this.t=It(),this.isJoining=!1,this.canEditName=!0,this.canProduceAudio=!0,this.socketStateUpdate=({state:e})=>{this.connectionState=e,e==="connected"&&(this.joinError=void 0,this.joinErrorCode=void 0),e==="failed"&&(this.isJoining=!1)},this.join=async()=>{var e,n,r;if(((e=this.displayName)===null||e===void 0?void 0:e.trim())!==""&&!this.isJoining){if(this.connectionState!=="connected"){this.connectionState&&(this.joinError=this.connectionState==="failed"?this.t("network.lost_extended"):this.t("network.lost"));return}this.isJoining=!0,this.joinError=void 0,this.joinErrorCode=void 0,(n=this.meeting)===null||n===void 0||n.self.setName(this.displayName),Ef.setItem("rtk-display-name",this.displayName);try{await((r=this.meeting)===null||r===void 0?void 0:r.join())}catch(s){this.isJoining=!1;const{message:i,code:o}=Jbt(this.t,s);this.joinError=i,this.joinErrorCode=o}}}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.meeting.meta.removeListener("socketConnectionUpdate",this.socketStateUpdate)}componentDidLoad(){var t;(t=this.inputEl)===null||t===void 0||t.focus()}meetingChanged(t){var e,n,r;t&&(this.connectionState=(e=t.meta.socketState)===null||e===void 0?void 0:e.state,this.canEditName=(n=t.self.permissions.canEditDisplayName)!==null&&n!==void 0?n:!0,this.displayName=((r=t.self.name)===null||r===void 0?void 0:r.trim())||(this.canEditName?"":"Participant"),t.meta.addListener("socketConnectionUpdate",this.socketStateUpdate))}render(){var t,e,n,r,s,i;if(!this.meeting)return;const o=!!this.connectionState&&this.connectionState!=="connected"&&!this.joinError,l=this.joinError?this.joinError:this.connectionState==="failed"?this.t("network.lost_extended"):this.t("network.lost"),c=((t=this.displayName)===null||t===void 0?void 0:t.trim())===""||this.connectionState!=="connected"||this.isJoining,d={meeting:this.meeting,config:this.config,states:this.states,size:this.size,iconPack:this.iconPack,t:this.t},u=(r=(n=(e=this.meeting)===null||e===void 0?void 0:e.meta)===null||n===void 0?void 0:n.meetingTitle)===null||r===void 0?void 0:r.trim();return $(mt,null,$("div",{class:"container"},$("div",{class:"container-tile"},$(tc,{element:"rtk-participant-tile",defaults:d,props:{participant:(s=this.meeting)===null||s===void 0?void 0:s.self,size:"md",isPreview:!0},childProps:{participant:(i=this.meeting)===null||i===void 0?void 0:i.self,size:"md"},deepProps:!0}),$("div",{class:"media-selectors"},$("rtk-microphone-selector",Object.assign({},d,{variant:"inline"})),$("rtk-camera-selector",Object.assign({},d,{variant:"inline"})),$("rtk-speaker-selector",Object.assign({},d,{variant:"inline"})))),$("div",{class:"metadata"},u&&u!==""&&$("div",{class:"meeting-title"},u),this.canEditName?$(Xyt,null,$("div",{class:"join-as"},this.t("setup_screen.join_in_as")),$("input",{placeholder:this.t("setup_screen.your_name"),value:this.displayName,spellcheck:!1,autoFocus:!0,ref:h=>{this.inputEl=h},onInput:h=>{this.displayName=h.target.value},onKeyDown:h=>{h.key==="Enter"&&this.join()}})):$("div",{class:"uneditable-name"},$("span",{class:"text"},this.t("setup_screen.join_in_as")," ")," ",$("div",{class:"name"},pm(this.displayName,20))),$("rtk-button",{size:"lg",kind:"wide",onClick:this.join,disabled:c},this.isJoining?$("rtk-spinner",{iconPack:this.iconPack}):this.t("join")),(this.joinError||o)&&$("div",{class:"no-network-badge",role:"alert"},$("rtk-icon",{size:"md",variant:"danger",icon:this.iconPack.disconnected}),l),this.meeting&&this.joinError&&$("a",{class:"troubleshoot-link",href:`https://test.realtime.cloudflare.com?authToken=${this.meeting.__internals__.authToken}`,target:"_blank",rel:"noopener noreferrer"},this.t("network.troubleshoot")),this.joinErrorCode&&$("span",{class:"error-code",part:"error-code"},this.t("join.error_code"),": ",this.joinErrorCode))))}static get watchers(){return{meeting:["meetingChanged"]}}};pB([ge()],dN.prototype,"meeting",void 0);pB([ge()],dN.prototype,"states",void 0);pB([ge()],dN.prototype,"config",void 0);pB([ge()],dN.prototype,"iconPack",void 0);pB([ge()],dN.prototype,"t",void 0);dN.style=FUn;var BUn=Object.freeze({__proto__:null,rtk_setup_screen:dN});const UUn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{margin-right:var(--rtk-space-0, 0px);height:100%;width:100%;max-width:var(--rtk-space-96, 384px);box-sizing:border-box;display:flex;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));border-width:var(--rtk-border-width-sm, 1px);border-style:solid;--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-border-opacity))}:host([view='sidebar']){right:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-4, 16px);overflow:clip;border-radius:var(--rtk-border-radius-lg, 12px);--tw-shadow:0 25px 50px -12px rgb(0 0 0 / 0.25);--tw-shadow-colored:0 25px 50px -12px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);--tw-shadow-color:rgb(var(--rtk-colors-background-900, 26 26 26));--tw-shadow:var(--tw-shadow-colored)}:host([view='full-screen']){top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);max-width:100%}:host(.floating){position:absolute !important;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);left:auto;z-index:50}.pinned-state{position:absolute;right:var(--rtk-space-1, 4px);display:inline-flex;width:var(--rtk-space-2, 8px);justify-content:flex-end}",zUn=UUn;var gB=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const uN=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.enabledSections=[],this.defaultSection="chat",this.config=Os(),this.iconPack=Nt,this.t=It(),this.view="sidebar",this.currentTab=this.defaultSection,this.isFloating=!1,this.enablePinning=!0,this.getTabs=()=>this.meeting.self.config?this.enabledSections.filter(e=>!(e.id in this.meeting.self.config.controlBar.elements)||this.meeting.self.config.controlBar.elements[e.id]):this.enabledSections,this.close=()=>{this.stateUpdate.emit({activeSidebar:!1,sidebar:this.defaultSection})},this.toggleFloating=()=>{this.isFloating=!this.isFloating}}connectedCallback(){var t;this.viewChanged(this.view),this.statesChanged(this.states),this.meetingChanged(this.meeting),this.isFloating=((t=this.states)===null||t===void 0?void 0:t.sidebarFloating)||!1}disconnectedCallback(){var t,e;(e=(t=this.meeting)===null||t===void 0?void 0:t.stage)===null||e===void 0||e.removeListener("stageStatusUpdate",this.onStageStatusUpdate),this.onStageStatusUpdate=null}meetingChanged(t){var e,n;t&&(this.updateEnabledSections(t),this.onStageStatusUpdate=r=>{this.updateEnabledSections(this.meeting)},(n=(e=this.meeting)===null||e===void 0?void 0:e.stage)===null||n===void 0||n.on("stageStatusUpdate",this.onStageStatusUpdate))}statesChanged(t){const e=t;e!=null&&e.sidebar&&(this.currentTab=e.sidebar)}viewChanged(t){t==="full-screen"?this.enablePinning=!1:this.enablePinning=!0}viewSection(t){this.currentTab=t,this.stateUpdate.emit({activeSidebar:!0,sidebar:this.currentTab})}updateEnabledSections(t=this.meeting){const e=[];Sbe(t)&&e.push({id:"chat",name:this.t("chat")}),Cbe(t)&&e.push({id:"polls",name:this.t("polls")}),jbe(t)&&e.push({id:"participants",name:this.t("participants")}),Ebe(t)&&e.push({id:"plugins",name:this.t("plugins")}),j7n(t)&&e.push({id:"ai",name:this.t("ai.meeting_ai")}),this.enabledSections=e}render(){var t;if(!this.meeting)return null;const e={meeting:this.meeting,config:this.config,states:this.states,size:this.size,t:this.t,iconPack:this.iconPack};return((t=e.states)===null||t===void 0?void 0:t.activeSidebar)===!1||!this.currentTab?null:$(mt,{class:this.enablePinning?this.isFloating?"floating":"":"floating"},$("rtk-sidebar-ui",{tabs:this.getTabs(),currentTab:this.currentTab,view:this.view,onTabChange:n=>{this.viewSection(n.detail)},onSidebarClose:this.close},this.enablePinning&&$("div",{class:"pinned-state",slot:"pinned-state"},$("rtk-button",{variant:"ghost",kind:"icon",onClick:this.toggleFloating,"aria-label":this.isFloating?this.t("pin"):this.t("unpin")},$("rtk-icon",{icon:this.isFloating?this.iconPack.pin:this.iconPack.pin_off}))),e.states.sidebar==="chat"&&$(tc,{element:"rtk-chat",defaults:e,props:{slot:"chat"}}),e.states.sidebar==="polls"&&$("rtk-polls",Object.assign({},e,{slot:"polls"})),e.states.sidebar==="participants"&&$(tc,{element:"rtk-participants",defaults:e,props:{slot:"participants"}}),e.states.sidebar==="plugins"&&$("rtk-plugins",Object.assign({},e,{slot:"plugins"})),e.states.sidebar==="ai"&&$("rtk-ai",Object.assign({},e,{slot:"ai"}))))}static get watchers(){return{meeting:["meetingChanged"],states:["statesChanged"],view:["viewChanged"]}}};gB([ge()],uN.prototype,"meeting",void 0);gB([ge()],uN.prototype,"states",void 0);gB([ge()],uN.prototype,"config",void 0);gB([ge()],uN.prototype,"iconPack",void 0);gB([ge()],uN.prototype,"t",void 0);uN.style=zUn;var VUn=Object.freeze({__proto__:null,rtk_sidebar:uN});const HUn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:block;height:100%;width:100%}",GUn=HUn;var vB=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const hN=class{constructor(t){kt(this,t),this.participants=[],this.aspectRatio="16:9",this.gap=8,this.config=Os(),this.iconPack=Nt,this.t=It(),this.dimensions={width:0,height:0},this.setHostDimensions=()=>{const{clientWidth:e,clientHeight:n}=this.host;this.dimensions={width:e,height:n}}}connectedCallback(){this.resizeObserver=new Zbt(this.setHostDimensions),this.resizeObserver.observe(this.host),this.meetingChanged(this.meeting)}meetingChanged(t){const e=t==null?void 0:t.meta;e&&(this.mediaConnection=Object.assign({},e.mediaState))}disconnectedCallback(){var t;(t=this.resizeObserver)===null||t===void 0||t.disconnect()}render(){if(!this.meeting)return null;const t={meeting:this.meeting,config:this.config,states:this.states,size:this.size,iconPack:this.iconPack,t:this.t},{width:e,height:n,getPosition:r}=GBn({dimensions:this.dimensions,count:this.participants.length,aspectRatio:this.aspectRatio,gap:this.gap});return $(mt,null,$("slot",null,this.participants.map((s,i)=>{const{top:o,left:l}=r(i);return $(tc,{element:"rtk-participant-tile",defaults:t,props:{participant:s,style:{position:"absolute",top:`${o}px`,left:`${l}px`,width:`${e}px`,height:`${n}px`},key:s.id,"data-participant":s.id,mediaConnection:this.mediaConnection},childProps:{participant:s},deepProps:!0})})))}get host(){return Pl(this)}static get watchers(){return{meeting:["meetingChanged"]}}};vB([ge()],hN.prototype,"meeting",void 0);vB([ge()],hN.prototype,"states",void 0);vB([ge()],hN.prototype,"config",void 0);vB([ge()],hN.prototype,"iconPack",void 0);vB([ge()],hN.prototype,"t",void 0);hN.style=GUn;var WUn=Object.freeze({__proto__:null,rtk_simple_grid:hN});const qUn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;height:100%;width:100%}main{flex:1 1 0%}.grid-width-sm{width:25%}.grid-width-md{width:50%}.grid-width-lg{width:66.666667%}:host([size='sm']),:host([size='md']){flex-direction:column}:host([size='md']) aside{max-height:var(--rtk-space-96, 384px);width:100%;max-width:100%}:host([size='md']) .grid-width-sm{height:25%}:host([size='md']) .grid-width-md{height:50%}:host([size='md']) .grid-width-lg{height:66.666667%}:host([size='sm']) aside{max-height:var(--rtk-space-96, 384px);width:100%;max-width:100%}:host([size='sm']) .grid-width-sm,:host([size='sm']) .grid-width-md,:host([size='sm']) .grid-width-lg{height:50%}:host([size='xl']) .grid-width-sm,:host([size='xl']) .grid-width-md,:host([size='xl']) .grid-width-lg{width:400px}:host([layout='column']){flex-direction:column}:host([layout='column']) main{flex:4}:host([layout='column']) aside{flex:2;max-width:100%;width:100%}",KUn=qUn;var yB=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const mN=class{constructor(t){kt(this,t),this.layout="row",this.participants=[],this.pinnedParticipants=[],this.aspectRatio="16:9",this.gap=8,this.config=Os(),this.iconPack=Nt,this.t=It(),this.gridSize=VNe,this.getAdaptiveSize=e=>this.size==="sm"||e>3||this.size==="md"?"sm":"md"}render(){const t={meeting:this.meeting,config:this.config,states:this.states,size:this.size,iconPack:this.iconPack,t:this.t},e=this.participants.filter(n=>this.pinnedParticipants.some(r=>r.id!=n.id));return $(mt,{key:"1cb846cc92b660a8244d16a74f48dfadcef903b6"},$("main",{key:"8564f8b0bf6e7bd668132e2833fe73c73855d090",part:"main"},$(tc,{key:"61b96f305727dc74de15f4c3c645069d6300afd9",element:"rtk-simple-grid",defaults:t,props:{part:"main-grid",participants:this.pinnedParticipants,aspectRatio:this.aspectRatio,gap:this.gap,size:this.getAdaptiveSize(this.pinnedParticipants.length)}})),e.length>0&&$("aside",{key:"2e297a8d83c1f7241d8688b643c055331d69299b",part:"aside",class:this.gridSize.spotlight?`grid-width-${this.gridSize.spotlight}`:"grid-width-md"},$(tc,{key:"2c1969c610018dfb0a23308316f072e3b8d87a6e",element:"rtk-simple-grid",defaults:t,props:{part:"aside-grid",participants:e,aspectRatio:this.aspectRatio,gap:this.gap,size:this.getAdaptiveSize(e.length)}})))}get host(){return Pl(this)}};yB([ge()],mN.prototype,"meeting",void 0);yB([ge()],mN.prototype,"states",void 0);yB([ge()],mN.prototype,"config",void 0);yB([ge()],mN.prototype,"iconPack",void 0);yB([ge()],mN.prototype,"t",void 0);mN.style=KUn;var YUn=Object.freeze({__proto__:null,rtk_spotlight_grid:mN});const QUn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block;position:relative;overflow:hidden}",ZUn=QUn;var Yxt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const ere=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.iconPack=Nt,this.t=It()}render(){return $(mt,{key:"681977138d7984d09fce875a7de3ccf763dbe3f7"},$("slot",{key:"8412278c7a9491758d6cc0b96b262b616a8ba04f"}))}};Yxt([ge()],ere.prototype,"iconPack",void 0);Yxt([ge()],ere.prototype,"t",void 0);ere.style=ZUn;var JUn=Object.freeze({__proto__:null,rtk_stage:ere});const XUn=t=>{var e,n;return((e=t==null?void 0:t.self)===null||e===void 0?void 0:e.permissions.stageEnabled)&&((n=t==null?void 0:t.self)===null||n===void 0?void 0:n.permissions.stageAccess)==="ALLOWED"},ezn=t=>{var e,n;return((e=t==null?void 0:t.self)===null||e===void 0?void 0:e.permissions.stageEnabled)&&((n=t==null?void 0:t.self)===null||n===void 0?void 0:n.permissions.stageAccess)!=="NOT_ALLOWED"},tzn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}:host([data-hidden]){display:none}",nzn=tzn;var tre=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const QI=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.variant="button",this.iconPack=Nt,this.t=It(),this.stageStatus="OFF_STAGE",this.state={label:"",disabled:!1,icon:""},this.stageCallback=async()=>{var e,n,r,s,i,o,l;const c=(e=this.meeting.stage)===null||e===void 0?void 0:e.status;c==="ON_STAGE"&&await((r=(n=this===null||this===void 0?void 0:this.meeting)===null||n===void 0?void 0:n.stage)===null||r===void 0?void 0:r.leave()),c==="OFF_STAGE"&&((i=(s=this===null||this===void 0?void 0:this.meeting)===null||s===void 0?void 0:s.stage)===null||i===void 0||i.requestAccess(),XUn(this.meeting)&&(this.states.activeJoinStage=!0,this.stateUpdate.emit({activeJoinStage:!0}))),c==="REQUESTED_TO_JOIN_STAGE"&&((l=(o=this===null||this===void 0?void 0:this.meeting)===null||o===void 0?void 0:o.stage)===null||l===void 0||l.cancelRequestAccess())}}connectedCallback(){this.meetingChanged(this.meeting)}stageStatusHandler(t,e){this.stageStatus=e,e==="ACCEPTED_TO_JOIN_STAGE"&&(t.self.setupTracks({audio:!1,video:!1}),this.stateUpdate.emit({activeJoinStage:!0})),this.state=this.getState()}disconnectedCallback(){var t,e;(e=(t=this.meeting)===null||t===void 0?void 0:t.stage)===null||e===void 0||e.removeListener("stageStatusUpdate",n=>this.stageStatusHandler(this.meeting,n))}meetingChanged(t){var e,n,r,s;t&&(this.stageStatus=(e=t.stage)===null||e===void 0?void 0:e.status,this.stageStatusHandler(t,(n=t.stage)===null||n===void 0?void 0:n.status),(s=(r=this.meeting)===null||r===void 0?void 0:r.stage)===null||s===void 0||s.on("stageStatusUpdate",i=>this.stageStatusHandler(t,i)))}getState(){let t="",e="",n=!1;switch(this.stageStatus){case"ON_STAGE":{e=this.iconPack.leave_stage,t=this.t("stage_request.leave_stage"),n=!1;break}case"ACCEPTED_TO_JOIN_STAGE":{e=this.iconPack.join_stage,t=this.t("stage_request.request"),n=!0;break}case"REQUESTED_TO_JOIN_STAGE":{e=this.iconPack.join_stage,t=this.t("stage_request.requested"),n=!1;break}default:{e=this.iconPack.join_stage,t=this.t("stage_request.request"),n=!1;break}}return{label:t,disabled:n,icon:e}}render(){return ezn(this.meeting)?$(mt,{title:this.state.label},$("rtk-tooltip",{placement:"top",kind:"block",label:this.state.label,delay:600,part:"tooltip"},$("rtk-controlbar-button",{part:"controlbar-button",size:this.size,iconPack:this.iconPack,variant:this.variant,label:this.state.label,icon:this.state.icon,onClick:this.stageCallback,disabled:this.state.disabled,showWarning:!1}))):$(mt,{"data-hidden":!0})}static get watchers(){return{meeting:["meetingChanged"]}}};tre([ge()],QI.prototype,"meeting",void 0);tre([ge()],QI.prototype,"iconPack",void 0);tre([ge()],QI.prototype,"states",void 0);tre([ge()],QI.prototype,"t",void 0);QI.style=nzn;var rzn=Object.freeze({__proto__:null,rtk_stage_toggle:QI});const szn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:absolute;top:var(--rtk-space-4, 16px);right:var(--rtk-space-4, 16px);bottom:var(--rtk-space-4, 16px);left:var(--rtk-space-4, 16px);top:auto;display:flex;flex-direction:column;pointer-events:none;justify-content:center;width:100%;z-index:5}rtk-transcript{margin-top:var(--rtk-space-2, 8px)}",izn=szn;var nre=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const ZI=class{constructor(t){kt(this,t),this.config=Os(),this.t=It(),this.transcripts=[],this.listenerAttached=!1,this.onTranscript=e=>{e.transcript&&this.add(e)}}connectedCallback(){this.meetingChanged(this.meeting)}addListener(t){var e;(e=t==null?void 0:t.ai)===null||e===void 0||e.addListener("transcript",this.onTranscript),this.listenerAttached=!0}clearListeners(t){var e;this.onTranscript&&((e=t==null?void 0:t.ai)===null||e===void 0||e.removeListener("transcript",this.onTranscript)),this.listenerAttached=!1,clearTimeout(this.disconnectTimeout),this.transcripts=[]}disconnectedCallback(){this.meeting&&this.clearListeners(this.meeting)}meetingChanged(t,e){clearTimeout(this.disconnectTimeout),e&&this.clearListeners(e),t&&this.states.activeCaptions&&this.addListener(t)}statesChanged(t){t&&(t.activeCaptions&&!this.listenerAttached&&this.addListener(this.meeting),!t.activeCaptions&&this.listenerAttached&&this.clearListeners(this.meeting))}transcriptionsReducer(t,e){if(!t.length)return[e];let n=t[t.length-1];return n.peerId!==e.peerId?t.concat(e):n.id===e.id?(n.transcript=e.transcript,t.pop(),t.concat(SNe(n))):t.concat(e)}add(t){this.transcripts=this.transcriptionsReducer(this.transcripts,t)}remove(t){this.transcripts=this.transcripts.filter(e=>e.renderedId!==t)}handleDismiss(t){t.stopPropagation();const{id:e,renderedId:n}=t.detail,r=this.host.shadowRoot.querySelector(`[data-id="${e}"]`);r==null||r.classList.add("exit"),setTimeout(()=>{Dc(()=>{this.remove(n)})},400)}renderTranscripts(){const t=[];return this.transcripts.forEach(e=>{const n={name:e.name,date:e.date,peerId:e.peerId,transcript:e.transcript,id:e.id,renderedId:e.id};if(!t.length){e.renderedId=n.renderedId,t.push(n);return}const r=t[t.length-1];if(r.transcript.length+n.transcript.length>400||r.peerId!==e.peerId){e.renderedId=n.renderedId,t.push(n);return}r.transcript+=" "+e.transcript,e.renderedId=r.renderedId}),t.splice(0,t.length-2),t==null?void 0:t.map(e=>$("rtk-transcript",{key:e.id,"data-id":e.id,transcript:e,onRtkTranscriptDismiss:n=>this.handleDismiss(n),t:this.t}))}render(){if(this.states.activeCaptions)return $(mt,null,this.renderTranscripts())}get host(){return Pl(this)}static get watchers(){return{meeting:["meetingChanged"],states:["statesChanged"]}}};nre([ge()],ZI.prototype,"meeting",void 0);nre([ge()],ZI.prototype,"states",void 0);nre([ge()],ZI.prototype,"config",void 0);nre([ge()],ZI.prototype,"t",void 0);ZI.style=izn;var azn=Object.freeze({__proto__:null,rtk_transcripts:ZI});const ozn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:flex;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));overflow:hidden;position:fixed;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);height:100%;width:100%}:host([mode='fill']){position:relative}",lzn=ozn,czn=1e4,Qxt=class{constructor(t){kt(this,t),this.statesUpdate=Wt(this,"rtkStatesUpdate",7),this.peerStore=null,this.providerId="provider-"+Math.floor(Math.random()*100),this.meeting=null,this.iconPack=Nt,this.t=It(),this.config=Os(),this.mode="fixed",this.showSetupScreen=!1,this.overrides=Nx,this.roomJoinedListener=()=>{this.updateStates({meeting:"joined"})},this.waitlistedListener=()=>{this.updateStates({meeting:"waiting"})},this.roomLeftListener=({state:e})=>{e==="disconnected"||e==="failed"||this.updateStates({meeting:"ended",roomLeftState:e})},this.mediaPermissionUpdateListener=({kind:e,message:n})=>{if(["audio","video"].includes(e)&&(n==="DENIED"||n==="SYSTEM_DENIED")&&(this.peerStore||gl).state.states.activeDebugger!==!0){const r={enabled:!0,kind:e};this.updateStates({activePermissionsMessage:r})}},this.socketConnectionUpdateListener=({state:e})=>{e==="failed"&&setTimeout(()=>{this.meeting.leave("disconnected")},czn)},this.handleChangingMeeting=e=>{const n=this.peerStore.state.states;this.updateStates({activeBreakoutRoomsManager:Object.assign(Object.assign({},n.activeBreakoutRoomsManager),{destinationMeetingId:e})})}}connectedCallback(){typeof window<"u"&&(this.authErrorListener=t=>{t.detail.message.includes("401")&&this.updateStates({meeting:"ended",roomLeftState:"unauthorized"})},window.addEventListener("rtkError",this.authErrorListener)),this.setupStoreRequestListener(),this.meetingChanged(this.meeting),this.iconPackChanged(this.iconPack),this.tChanged(this.t),this.configChanged(this.config),this.overridesChanged(this.overrides)}disconnectedCallback(){window.removeEventListener("rtkError",this.authErrorListener),this.storeRequestListener&&this.host.removeEventListener("rtkRequestStore",this.storeRequestListener),this.stateUpdateListener&&this.host.removeEventListener("rtkStateUpdate",this.stateUpdateListener),this.meeting&&(this.meeting.self.removeListener("roomLeft",this.roomLeftListener),this.meeting.self.removeListener("roomJoined",this.roomJoinedListener),this.meeting.self.removeListener("waitlisted",this.waitlistedListener),this.meeting.self.removeListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),this.meeting.meta.removeListener("socketConnectionUpdate",this.socketConnectionUpdateListener))}updateStates(t){const e=this.peerStore||gl,n=Object.assign({},e.state.states);e.state.states=Zj(n,t),this.statesUpdate.emit(e.state.states);const r=new CustomEvent("rtkStatesUpdate",{detail:e.state.states,bubbles:!0,composed:!0});this.host.dispatchEvent(r)}setupStateUpdateListener(){this.stateUpdateListener&&this.host.removeEventListener("rtkStateUpdate",this.stateUpdateListener),this.stateUpdateListener=t=>{this.updateStates(t.detail)},this.host.addEventListener("rtkStateUpdate",this.stateUpdateListener)}setupStoreRequestListener(){this.storeRequestListener&&this.host.removeEventListener("rtkRequestStore",this.storeRequestListener),this.storeRequestListener=t=>{if(!this.peerStore)return;const e=new CustomEvent("rtkProvideStore",{detail:{store:this.peerStore,requestId:t.detail.requestId}});document.dispatchEvent(e),t.stopPropagation()},this.host.addEventListener("rtkRequestStore",this.storeRequestListener)}meetingChanged(t,e){if(t&&(this.peerStore=Mbt({meeting:t,config:this.config,iconPack:this.iconPack,t:this.t,providerId:this.providerId,overrides:Zj(Object.assign({},Nx),this.overrides)}),document.dispatchEvent(new CustomEvent("rtkPeerStoreReady",{detail:{peerId:t.self.id}}))),this.setupStateUpdateListener(),t){const n=this.peerStore||gl;n.state.meeting=t;const r=e?!!n.state.states.activeCaptions:!!t.self.permissions.transcriptionEnabled;this.updateStates({viewType:t.meta.viewType,activeCaptions:r}),t.self.addListener("roomJoined",this.roomJoinedListener),t.self.addListener("waitlisted",this.waitlistedListener),t.self.addListener("roomLeft",this.roomLeftListener),t.self.addListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),t.meta.addListener("socketConnectionUpdate",this.socketConnectionUpdateListener),t.connectedMeetings.once("changingMeeting",this.handleChangingMeeting),t.self.roomJoined?this.updateStates({meeting:"joined"}):this.showSetupScreen?this.updateStates({meeting:"setup"}):t.join(),window.removeEventListener("rtkError",this.authErrorListener)}}iconPackChanged(t){this.peerStore&&(this.peerStore.state.iconPack=t)}tChanged(t){this.peerStore&&(this.peerStore.state.t=t)}configChanged(t){this.peerStore&&(this.peerStore.state.config=t),t!=null&&t.designTokens&&typeof document<"u"&&(this.peerStore||gl).state.states.activeDebugger!==!0&&FW(document.documentElement,t.designTokens)}overridesChanged(t){this.peerStore&&(this.peerStore.state.overrides=Zj(Object.assign({},Nx),t))}render(){return this.meeting?$(mt,null,$("slot",null)):null}get host(){return Pl(this)}static get watchers(){return{meeting:["meetingChanged"],iconPack:["iconPackChanged"],t:["tChanged"],config:["configChanged"],overrides:["overridesChanged"]}}};Qxt.style=lzn;var dzn=Object.freeze({__proto__:null,rtk_ui_provider:Qxt});const uzn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{height:100%;width:100%;display:flex;flex-direction:column;align-items:center;justify-content:center}.centered{display:flex;flex-direction:column;align-items:center}rtk-logo{margin-bottom:var(--rtk-space-8, 32px);height:var(--rtk-space-12, 48px)}p{font-size:16px;border-radius:var(--rtk-border-radius-lg, 12px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));padding-left:var(--rtk-space-8, 32px);padding-right:var(--rtk-space-8, 32px);padding-top:var(--rtk-space-4, 16px);padding-bottom:var(--rtk-space-4, 16px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}",hzn=uzn;var rre=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const JI=class{constructor(t){kt(this,t),this.config=Os(),this.iconPack=Nt,this.t=It()}render(){return $(mt,{key:"ac7096bd5df59387dcef15bbd4ef8955a4a42298"},$("slot",{key:"6dd0f5b9555c956c1371311ef3c4ac8f661e9523"},$("div",{key:"07925b636545e1196b10512cd504516df2cfbbf4",class:"centered",part:"content"},$("rtk-logo",{key:"9b3fcf182d7c68aaf525a8170dbab9e59fc40404",meeting:this.meeting,config:this.config,part:"logo",t:this.t}),$("p",{key:"763a6403bc98a16f020101090bbed250041ae7cd"},this.t("waitlist.body_text")))))}};rre([ge()],JI.prototype,"meeting",void 0);rre([ge()],JI.prototype,"config",void 0);rre([ge()],JI.prototype,"iconPack",void 0);rre([ge()],JI.prototype,"t",void 0);JI.style=hzn;var mzn=Object.freeze({__proto__:null,rtk_waiting_screen:JI});const fzn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;box-sizing:border-box;display:flex;width:100%;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden}.close{position:absolute;top:var(--rtk-space-3, 12px);left:var(--rtk-space-3, 12px)}.title{margin-left:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-0, 0px);margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-2, 8px);-webkit-user-select:none;-moz-user-select:none;user-select:none;padding:var(--rtk-space-0, 0px);text-align:center;font-size:14px;font-weight:400}rtk-ai-transcriptions{flex:1}:host([view='sidebar']){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}:host([view='full-screen']){position:absolute;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);bottom:var(--rtk-space-0, 0px);left:var(--rtk-space-0, 0px);z-index:50;max-width:100%;border:none}",pzn=fzn;var bB=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const fN=class{constructor(t){kt(this,t),this.config=Os(),this.iconPack=Nt,this.t=It(),this.view="sidebar"}render(){if(!this.meeting)return null;const t={meeting:this.meeting,config:this.config,states:this.states,size:this.size,t:this.t,iconPack:this.iconPack};return $(mt,null,$("rtk-ai-transcriptions",Object.assign({},t)))}};bB([ge()],fN.prototype,"meeting",void 0);bB([ge()],fN.prototype,"states",void 0);bB([ge()],fN.prototype,"config",void 0);bB([ge()],fN.prototype,"iconPack",void 0);bB([ge()],fN.prototype,"t",void 0);fN.style=pzn;const gzn=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);display:flex;height:100%;width:100%;flex-direction:column;font-size:14px;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}h3{margin-left:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-0, 0px);margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-4, 16px);display:block;padding:var(--rtk-space-0, 0px);font-size:16px;font-weight:400;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));text-align:center}ul{overflow-y:auto;padding:var(--rtk-space-0, 0px);flex-grow:1;flex-basis:0}.metadata{display:flex;align-items:center}.metadata img{height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);border-radius:var(--rtk-border-radius-sm, 4px)}.metadata .name{margin-left:var(--rtk-space-2, 8px);font-weight:500}.plugin{display:flex;align-items:center;justify-content:space-between;padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px);padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px)}.plugin .buttons{display:flex;align-items:center}.empty-plugins{display:flex;height:100%;width:100%;align-items:center;justify-content:center;padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px);color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}rtk-button:hover{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000);--tw-ring-opacity:1;--tw-ring-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-ring-opacity));--tw-ring-offset-width:2px;--tw-ring-offset-color:rgb(var(--rtk-colors-background-1000, 8 8 8))}`,vzn=gzn;var sre=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const XI=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.updateActivePlugins=()=>{this.meeting&&(this.activatedPluginsId=this.meeting.plugins.active.toArray().map(e=>e.id))},this.config=Os(),this.iconPack=Nt,this.t=It(),this.plugins=[],this.activatedPluginsId=[],this.close=()=>{this.stateUpdate.emit({activeSidebar:!1,sidebar:void 0})}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var t;(t=this.meeting)===null||t===void 0||t.plugins.all.removeListener("stateUpdate",this.updateActivePlugins)}meetingChanged(t,e){e&&e.plugins.all.removeListener("stateUpdate",this.updateActivePlugins),t!=null&&(this.plugins=t.plugins.all.toArray(),this.updateActivePlugins(),t.plugins.all.addListener("stateUpdate",this.updateActivePlugins))}render(){return $(mt,{key:"9a0c98a1c3313bae757ecdc7c2c6932456c2d924"},this.plugins.length===0&&$("div",{key:"ea6629a4739c87842bb0fa7cb0c73d0dc9511f51",class:"empty-plugins"},this.t("plugins.empty")),$("ul",{key:"9632e9183e3c1dbbaa5adb80b81cb66096b6742f",class:"scrollbar"},this.plugins.map(t=>{var e,n;return $("li",{key:t.name,class:"plugin"},$("div",{class:"metadata"},$("img",{src:t.icon,alt:t.name}),$("div",{class:"name"},t.name)),!this.activatedPluginsId.includes(t.id)&&((e=t==null?void 0:t.permissions)===null||e===void 0?void 0:e.canActivate)&&$("div",{class:"buttons"},$("rtk-button",{kind:"icon",size:"lg",onClick:()=>{t.activate(),this.close()},"aria-label":`${this.t("activate")} ${t.name}`},$("rtk-icon",{icon:this.iconPack.rocket,tabIndex:-1,"aria-hidden":!0}))),this.activatedPluginsId.includes(t.id)&&((n=t==null?void 0:t.permissions)===null||n===void 0?void 0:n.canDeactivate)&&$("div",{class:"buttons"},$("rtk-button",{kind:"icon",size:"lg",onClick:()=>{t.deactivate()},"aria-label":`${this.t("close")} ${t.name}`},$("rtk-icon",{icon:this.iconPack.dismiss,tabIndex:-1,"aria-hidden":!0}))))})))}static get watchers(){return{meeting:["meetingChanged"]}}};sre([ge()],XI.prototype,"meeting",void 0);sre([ge()],XI.prototype,"config",void 0);sre([ge()],XI.prototype,"iconPack",void 0);sre([ge()],XI.prototype,"t",void 0);XI.style=vzn;const yzn=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{margin-top:var(--rtk-space-2, 8px);display:flex;height:100%;width:100%;flex-direction:column;font-size:14px}*{box-sizing:border-box}.ctr{box-sizing:border-box;padding:var(--rtk-space-3, 12px);padding-top:var(--rtk-space-0, 0px);display:flex;flex:1 1 0%;flex-direction:column}.polls-view{overflow-y:auto;flex:1 1 0%;flex-basis:0}.empty-polls{display:flex;height:100%;width:100%;align-items:center;justify-content:center}`,bzn=yzn;var ire=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const eM=class{constructor(e){kt(this,e),this.config=Os(),this.iconPack=Nt,this.t=It(),this.create=!1,this.polls=[],this.onPollsUpdate=n=>{this.polls=[...n.polls]},this.onUpdatePermissions=()=>{this.permissions=this.meeting.self.permissions}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var e;this.meeting&&((e=this.meeting.polls)===null||e===void 0||e.removeListener("pollsUpdate",this.onPollsUpdate),this.meeting.self.permissions.removeListener("pollsUpdate",this.onUpdatePermissions))}meetingChanged(e){e&&e.polls&&(this.permissions=this.meeting.self.permissions,this.polls=[...e.polls.items],e.polls.addListener("pollsUpdate",this.onPollsUpdate),this.meeting.self.permissions.addListener("pollsUpdate",this.onUpdatePermissions),this.onCreate=async n=>{this.create=!1,await e.polls.create(n.question,n.options,n.anonymous,n.hideVotes)},this.onVote=async(n,r)=>{await e.polls.vote(n,r)})}toggleCreateState(){this.create=!this.create}componentDidRender(){m$(this.pollEl)}render(){var e,n;return $(mt,{key:"0e868573a28a637e9df91a0c2e10bc1a73da2848"},$("div",{key:"63cf282074f7c9eb248c4a645f6798001379907b",class:"ctr",part:"container"},$("div",{key:"3237128bcbff4b513970e9832f26326a8be1cf56",class:"polls-view scrollbar",ref:r=>this.pollEl=r,part:"polls"},this.polls.length==0&&this.create!==!0&&$("div",{key:"12b3c463d0f63f0a62ab33f17c0f18bb44fa0408",class:"empty-polls"},this.t("polls.empty")),this.polls.map(r=>{var s;return $("rtk-poll",{key:r.id,poll:r,onRtkVotePoll:i=>{this.onVote(i.detail.id,i.detail.index)},self:(s=this.meeting)===null||s===void 0?void 0:s.self.userId,iconPack:this.iconPack,t:this.t,permissions:this.permissions})}),this.create&&$("rtk-poll-form",{key:"fb8b90bb86654aa8742ced745f88e5fbdc9282bf",part:"poll-form",onRtkCreatePoll:r=>{this.onCreate(r.detail)},iconPack:this.iconPack,t:this.t})),((n=(e=this.permissions)===null||e===void 0?void 0:e.polls)===null||n===void 0?void 0:n.canCreate)&&$("rtk-button",{key:"7fffe35088db7620b4301145c6efa2f6da05153c",kind:"wide",onClick:()=>this.toggleCreateState(),variant:this.create?"secondary":"primary",part:"button"},this.create?this.t("polls.cancel"):this.t("polls.create"))))}static get watchers(){return{meeting:["meetingChanged"]}}};ire([ge()],eM.prototype,"meeting",void 0);ire([ge()],eM.prototype,"config",void 0);ire([ge()],eM.prototype,"iconPack",void 0);ire([ge()],eM.prototype,"t",void 0);eM.style=bzn;var xzn=Object.freeze({__proto__:null,rtk_ai:fN,rtk_plugins:XI,rtk_polls:eM});const wzn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.color-brand{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity))}.color-danger{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}.loading-content{height:var(--rtk-space-60, 240px);width:var(--rtk-space-96, 384px);padding:var(--rtk-space-9, 36px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));display:flex;align-items:center;justify-content:center}.room-config{overflow:hidden;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));display:flex;flex-direction:column;width:var(--rtk-space-96, 384px);padding-left:var(--rtk-space-9, 36px);padding-right:var(--rtk-space-9, 36px);padding-top:var(--rtk-space-10, 40px);padding-bottom:var(--rtk-space-10, 40px)}header{margin-bottom:var(--rtk-space-8, 32px);display:flex;align-items:center;gap:var(--rtk-space-2, 8px);font-size:24px;font-weight:600}header rtk-icon{height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px)}.create-room{margin-bottom:var(--rtk-space-4, 16px);display:flex;align-items:center;gap:var(--rtk-space-3, 12px);width:100%}.create-room p{margin:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-1, 4px);font-size:16px}.distribution-hint{margin-bottom:var(--rtk-space-8, 32px);font-size:14px;font-weight:400;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}.distribution-hint em{font-style:normal;color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}footer{display:flex;flex-direction:row;vertical-align:middle;justify-content:center}footer rtk-button{width:100%;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}label{margin-bottom:var(--rtk-space-3, 12px);font-weight:400;color:rgb(var(--rtk-colors-text-1000, 255 255 255));opacity:0.4}.participant-config-wrapper{width:850px;min-height:595px;max-width:100%;max-height:100%;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));display:flex;flex-direction:column}.participant-config-actions{display:flex;justify-content:space-between;padding-left:var(--rtk-space-8, 32px);padding-right:var(--rtk-space-8, 32px);padding-top:var(--rtk-space-5, 20px);padding-bottom:var(--rtk-space-5, 20px);border-bottom-right-radius:var(--rtk-border-radius-md, 8px);border-bottom-left-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}.participant-config{display:flex;flex-grow:1;flex-direction:row;overflow:hidden}aside{box-sizing:border-box;display:flex;width:var(--rtk-space-96, 384px);flex-grow:1;flex-direction:column;padding-left:var(--rtk-space-8, 32px);padding-right:var(--rtk-space-4, 16px);border-right-width:var(--rtk-border-width-sm, 1px);border-top-width:var(--rtk-border-width-none, 0);border-bottom-width:var(--rtk-border-width-none, 0);border-left-width:var(--rtk-border-width-none, 0);border-style:solid;--tw-border-opacity:1;border-right-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-border-opacity))}aside header{margin-bottom:var(--rtk-space-4, 16px);width:100%;padding-left:var(--rtk-space-0, 0px);padding-right:var(--rtk-space-0, 0px);padding-top:var(--rtk-space-8, 32px);font-size:20px;font-weight:500;line-height:2rem}.shuffle-button{display:flex;flex-direction:row;align-items:center}.shuffle-button rtk-icon{height:var(--rtk-space-8, 32px)}.participants-assign-actions{display:flex;flex-direction:row;align-items:center;justify-content:space-between;font-size:14px;padding-left:var(--rtk-space-8, 32px);padding-right:var(--rtk-space-2, 8px);margin-left:calc(var(--rtk-space-8, 32px) * -1);margin-right:calc(var(--rtk-space-4, 16px) * -1);padding-top:var(--rtk-space-0\\.5, 2px);padding-bottom:var(--rtk-space-0\\.5, 2px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}.participants-assign-actions .deselect-button{height:var(--rtk-space-6, 24px)}.participants-assign-actions .deselect-button:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}.assign-rooms{padding:var(--rtk-space-8, 32px);display:flex;width:100%;flex-direction:column}.assign-rooms .disabled{opacity:0.2}.assign-rooms .back{display:flex;cursor:pointer;flex-direction:row;align-items:center;justify-content:flex-start;padding:var(--rtk-space-4, 16px);padding-bottom:var(--rtk-space-0, 0px);font-size:14px;color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.assign-rooms .back rtk-icon{height:var(--rtk-space-5, 20px)}.assign-rooms .row{display:flex;flex-direction:row;align-items:center;justify-content:flex-start;gap:var(--rtk-space-3, 12px);margin-bottom:var(--rtk-space-4, 16px);font-size:14px}.assign-rooms .row-header{margin:var(--rtk-space-0, 0px);font-size:16px;line-height:2rem}.assign-rooms .cta-buttons{display:flex;align-items:center;justify-content:flex-start;gap:var(--rtk-space-2, 8px)}.assign-rooms .cta-buttons rtk-button div{display:flex;flex-direction:row;align-items:center}.assign-rooms .cta-buttons rtk-button div rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}.rooms{margin-bottom:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-1, 4px);display:flex;flex-grow:1;flex-direction:column;gap:var(--rtk-space-2, 8px);overflow-y:auto;max-height:500px}.rooms::-webkit-scrollbar{width:var(--rtk-space-1\\.5, 6px);border-radius:var(--rtk-border-radius-sm, 4px)}.rooms::-webkit-scrollbar-thumb{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.rooms::-webkit-scrollbar-track{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.breakout-actions{display:flex;flex-direction:row;align-items:center;justify-content:flex-end;gap:var(--rtk-space-2, 8px)}.breakout-actions .start-breakout-button{color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.breakout-actions .close-breakout-button{color:rgb(var(--rtk-colors-text-1000, 255 255 255));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-bg-opacity))}.breakout-actions .update-breakout-button{background-color:transparent;--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity));border-width:var(--rtk-border-width-sm, 1px);border-style:solid;--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-border-opacity))}.status-bar{display:flex;align-items:center;font-size:14px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));width:var(--rtk-space-80, 320px)}.ephemeral-status{--tw-text-opacity:1;color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-text-opacity))}.ephemeral-status rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}.room-switcher-container{border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));width:468px;padding:var(--rtk-space-8, 32px)}.add-room-jumbo-btn div{display:flex;align-items:center;gap:var(--rtk-space-1, 4px);font-size:14px;--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity))}.add-room-jumbo-btn div rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}.br-primary-btn:not([disabled]){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.br-primary-btn:not([disabled]):hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-600, 13 81 253) / var(--tw-bg-opacity))}.br-secondary-btn:not([disabled]){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.br-secondary-btn:not([disabled]):hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}",kzn=wzn;var are=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const y3=1,tM=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.loading=!1,this.roomConfig={rooms:2,step:"room-config",mode:"create",applyingChanges:!1},this.assigningParticipants=!1,this.selectedParticipants=[],this.ephemeralStatusText="",this.isDragMode=!1,this.iconPack=Nt,this.t=It(),this.permissionsUpdateListener=()=>{this.permissions=this.meeting.self.permissions.connectedMeetings},this.updateLocalState=e=>{this.stateManager.updateCurrentState(e),this.draftState=this.stateManager.currentState,this.meeting.connectedMeetings.isActive&&(this.roomConfig=Object.assign(Object.assign({},this.roomConfig),{mode:"edit"})),this.roomConfig.mode==="create"&&!this.meeting.connectedMeetings.isActive&&N3n(),["edit","view"].includes(this.roomConfig.mode)&&(this.roomConfig=Object.assign(Object.assign({},this.roomConfig),{rooms:e.meetings.length,step:"participants-config"}),this.selectedParticipants=[])},this.onAddNewRoom=()=>{this.stateManager.addNewMeeting(),this.draftState=this.stateManager.currentState,this.selectorRef.scrollTo({top:this.selectorRef.scrollHeight,behavior:"smooth"})},this.onRoomUpdate=e=>{const{detail:n}=e;this.stateManager.updateMeetingTitle(n.id,n.title),this.draftState=this.stateManager.currentState},this.onRoomDelete=e=>{this.stateManager.allConnectedMeetings.find(r=>r.id===e)&&(this.stateManager.deleteMeeting(e),this.draftState=this.stateManager.currentState)},this.unassignParticipant=e=>{this.stateManager.unassignParticipants([e]),this.draftState=this.stateManager.currentState},this.onUnassignAll=()=>{this.stateManager.unassignAllParticipants(),this.draftState=this.stateManager.currentState},this.assignParticipantsToRoom=e=>{this.selectedParticipants.length===0||this.assigningParticipants==!1||(this.stateManager.assignParticipantsToMeeting(this.selectedParticipants,e),this.draftState=this.stateManager.currentState,this.selectedParticipants=[],this.assigningParticipants=!1,this.setEphemeralStatus(this.t("breakout_rooms.ephemeral_status.participants_assigned")))},this.handleClose=(e,n)=>{e.emit({activeBreakoutRoomsManager:{active:!0}}),n.activeBreakoutRoomsManager={active:!0}},this.enableConfirmationModal=(e="start-breakout")=>{let n={active:!0,header:"breakout_rooms.confirm_modal.start_breakout.header",content:"breakout_rooms.confirm_modal.start_breakout.content",variant:"primary",cancelText:"breakout_rooms.confirm_modal.start_breakout.cancelText",ctaText:"breakout_rooms.confirm_modal.start_breakout.ctaText",onClick:()=>this.applyChanges(),onClose:this.handleClose};e==="close-breakout"&&(n={active:!0,header:"breakout_rooms.confirm_modal.close_breakout.header",content:"breakout_rooms.confirm_modal.close_breakout.content",variant:"danger",cancelText:"cancel",ctaText:"breakout_rooms.confirm_modal.close_breakout.ctaText",onClick:()=>this.closeBreakout(),onClose:this.handleClose}),this.stateUpdate.emit({activeBreakoutRoomsManager:{active:!1},activeConfirmationModal:n})},this.close=()=>{this.stateManager.discardChanges(),this.stateUpdate.emit({activeBreakoutRoomsManager:{active:!1}})},this.applyChanges=async()=>{this.roomConfig=Object.assign(Object.assign({},this.roomConfig),{applyingChanges:!0}),await this.stateManager.applyChanges(this.meeting),this.close(),this.roomConfig=Object.assign(Object.assign({},this.roomConfig),{applyingChanges:!1})}}onSelectedParticipantsChanged(t){t.length>0?this.assigningParticipants=!0:this.assigningParticipants=!1}connectedCallback(){this.permissionsUpdateListener(),this.meeting.connectedMeetings.on("stateUpdate",this.updateLocalState),this.meeting.connectedMeetings.on("changingMeeting",this.close),this.meeting.self.permissions.on("permissionsUpdate",this.permissionsUpdateListener),this.stateManager=new P3n,this.fetchRoomState()}disconnectedCallback(){this.meeting.connectedMeetings.off("stateUpdate",this.updateLocalState),this.meeting.connectedMeetings.off("changingMeeting",this.close),this.meeting.self.permissions.off("permissionsUpdate",this.permissionsUpdateListener)}async fetchRoomState(){this.loading=!0,await this.meeting.connectedMeetings.getConnectedMeetings(),this.loading=!1}setEphemeralStatus(t){this.ephemeralStatusText=t,setTimeout(()=>{this.ephemeralStatusText=""},3e3)}onCreateRooms(){this.selectedParticipants=[],this.stateManager.addNewMeetings(this.roomConfig.rooms),this.draftState=this.stateManager.currentState,this.roomConfig=Object.assign(Object.assign({},this.roomConfig),{step:"participants-config"})}onParticipantDelete(t){const{detail:e}=t,n=bl(e);n!=null&&this.unassignParticipant(n)}toggleDragMode(t){this.isDragMode=t.detail}assignParticipantsRandomly(){this.stateManager.unassignedParticipants.length!==0&&(this.stateManager.assignParticipantsRandomly(),this.draftState=this.stateManager.currentState,this.setEphemeralStatus(this.t("breakout_rooms.ephemeral_status.participants_assigned_randomly")))}async joinRoom(t){const e=bl(this.meeting.self);this.stateManager.assignParticipantsToMeeting([e],t),await this.applyChanges()}async closeBreakout(){this.stateManager.allConnectedMeetings.forEach(t=>this.stateManager.deleteMeeting(t.id)),await this.applyChanges()}updateSelectedParticipants(t){this.selectedParticipants=t.detail}updateAllParticipants(t){this.selectedParticipants=t.detail}getStatusText(){if(this.ephemeralStatusText!=="")return this.ephemeralStatusText;let t="";return this.roomConfig.mode==="create"&&(t=this.t("breakout_rooms.status.assign_multiple"),this.selectedParticipants.length!==0&&(t=this.t("breakout_rooms.status.select_room"))),t}getApproxDistribution(){const t=this.stateManager.unassignedParticipants.length/(this.roomConfig.rooms||y3);return Math.max(y3,Math.round(t))}deselectAll(){this.selectedParticipants=[]}async discardChanges(){this.stateManager.discardChanges(),await this.fetchRoomState(),this.setEphemeralStatus(this.t("breakout_rooms.ephemeral_status.changes_discarded"))}shouldShowOnlyRoomSwitcher(){return this.permissions.canAlterConnectedMeetings===!1}getPermittedRooms(){return this.permissions.canAlterConnectedMeetings||this.permissions.canSwitchConnectedMeetings?this.stateManager.allConnectedMeetings:this.stateManager.allConnectedMeetings.filter(t=>t.id===this.meeting.meta.meetingId)}renderMainRoomMaybe(){return this.meeting.connectedMeetings.isActive&&this.permissions.canSwitchToParentMeeting?$("rtk-breakout-room-manager",{key:this.stateManager.currentState.parentMeeting.id,assigningParticipants:this.assigningParticipants,isDragMode:this.isDragMode,meeting:this.meeting,mode:this.roomConfig.mode,onParticipantsAdd:()=>this.assignParticipantsToRoom(this.stateManager.currentState.parentMeeting.id),onRoomJoin:()=>this.joinRoom(this.stateManager.currentState.parentMeeting.id),onUpdate:this.onRoomUpdate,states:this.states,room:Object.assign({},this.stateManager.currentState.parentMeeting),iconPack:this.iconPack,t:this.t}):null}renderRoomSwitcher(){return $(mt,null,$("div",{class:"room-switcher-container"},$("header",null,$("rtk-icon",{icon:this.iconPack.breakout_rooms}),$("span",null,this.t("breakout_rooms.join_breakout_header"))),$("div",{class:"rooms",ref:t=>this.selectorRef=t},this.renderMainRoomMaybe(),this.getPermittedRooms().map((t,e)=>$("rtk-breakout-room-manager",{key:t.id,assigningParticipants:this.assigningParticipants,isDragMode:this.isDragMode,defaultExpanded:e===0,meeting:this.meeting,mode:this.roomConfig.mode,onDelete:()=>this.onRoomDelete(t.id),onParticipantsAdd:()=>this.assignParticipantsToRoom(t.id),onRoomJoin:()=>this.joinRoom(t.id),states:this.states,room:Object.assign({},t),iconPack:this.iconPack,t:this.t,allowDelete:!1})))))}renderLoading(){return $(mt,null,$("div",{class:"loading-content"},$("rtk-spinner",{size:"xl"})))}renderRoomConfig(){return $(mt,null,$("div",{class:"room-config"},$("header",null,$("rtk-icon",{icon:this.iconPack.breakout_rooms}),$("span",null,this.t("breakout_rooms.room_config_header"))),$("div",{class:"create-room"},$("p",null,this.t("breakout_rooms.num_of_rooms")),$("rtk-counter",{value:this.roomConfig.rooms,minValue:y3,iconPack:this.iconPack,t:this.t,onValueChange:t=>{this.roomConfig=Object.assign(Object.assign({},this.roomConfig),{rooms:Math.max(+t.detail,y3)})}})),$("span",{class:"distribution-hint"},`${this.t("breakout_rooms.approx")} `," ",$("em",null,this.getApproxDistribution()," ",this.t("breakout_rooms.participants_per_room"))," ",this.t("breakout_rooms.division_text")),$("footer",null,$("rtk-button",{kind:"button",size:"lg",title:this.t("create"),disabled:this.roomConfig.rooms===0,onClick:()=>this.onCreateRooms()},this.t("create")))))}render(){return this.loading?this.renderLoading():this.shouldShowOnlyRoomSwitcher()?this.renderRoomSwitcher():this.roomConfig.step==="room-config"?this.renderRoomConfig():$(mt,null,$("div",{class:"participant-config-wrapper"},$("div",{class:"participant-config"},$("aside",{part:"menu"},$("header",null,this.t("breakout_rooms.assign_participants")),$("rtk-breakout-room-participants",{meeting:this.meeting,iconPack:this.iconPack,t:this.t,participantIds:this.stateManager.unassignedParticipants.map(bl),selectedParticipantIds:this.selectedParticipants},$("rtk-tooltip",{label:this.t("breakout_rooms.shuffle_participants"),slot:"shuffle-button"},$("rtk-button",{disabled:this.roomConfig.mode==="edit"||this.stateManager.unassignedParticipants.length===0,kind:"button",variant:"secondary",size:"md",onClick:()=>this.assignParticipantsRandomly(),class:"shuffle-button br-primary-btn"},$("rtk-icon",{icon:this.iconPack.shuffle})))),this.selectedParticipants.length!==0&&$("div",{class:"participants-assign-actions"},$("span",null,`${this.selectedParticipants.length} ${this.t("breakout_rooms.selected")}`),$("rtk-button",{disabled:this.roomConfig.mode==="edit",kind:"button",variant:"ghost",size:"md",onClick:()=>this.deselectAll(),class:"deselect-button color-danger"},this.t("breakout_rooms.deselect")))),$("div",{class:"assign-rooms"},$("div",{class:"row"},$("p",{class:"row-header"},this.t("breakout_rooms.rooms")," (",this.stateManager.allConnectedMeetings.length,")"),!this.assigningParticipants&&$("div",{class:"cta-buttons"},$("rtk-button",{kind:"button",variant:"secondary",class:"br-primary-btn"},$("div",{onClick:this.onAddNewRoom},$("rtk-icon",{icon:this.iconPack.add}),this.t("breakout_rooms.add_room"))),this.stateManager.allConnectedMeetings.flatMap(t=>t.participants).length!==0&&$("rtk-button",{kind:"button",variant:"ghost",onClick:this.onUnassignAll},this.t("breakout_rooms.unassign_all")))),$("div",{class:"rooms",ref:t=>this.selectorRef=t},this.renderMainRoomMaybe(),this.getPermittedRooms().map((t,e)=>$("rtk-breakout-room-manager",{key:t.id,assigningParticipants:this.assigningParticipants,isDragMode:this.isDragMode,defaultExpanded:e===0,meeting:this.meeting,mode:this.roomConfig.mode,onDelete:()=>this.onRoomDelete(t.id),onParticipantsAdd:()=>this.assignParticipantsToRoom(t.id),onRoomJoin:()=>this.joinRoom(t.id),onUpdate:this.onRoomUpdate,states:this.states,room:Object.assign({},t),iconPack:this.iconPack,t:this.t,allowDelete:this.stateManager.allConnectedMeetings.length>y3})),$("rtk-button",{kind:"button",variant:"secondary",onClick:this.onAddNewRoom,class:"add-room-jumbo-btn br-secondary-btn"},$("div",null,$("rtk-icon",{icon:this.iconPack.add}),$("span",null,this.t("breakout_rooms.add_room_brief"))))))),$("div",{class:"participant-config-actions"},$("div",{class:{"status-bar":!0,"ephemeral-status":this.ephemeralStatusText!==""}},this.ephemeralStatusText!==""&&$("rtk-icon",{icon:this.iconPack.checkmark}),this.getStatusText()),$("div",{class:"breakout-actions"},this.roomConfig.mode==="create"&&this.permissions.canAlterConnectedMeetings&&$("rtk-button",{size:"md",class:"start-breakout-button",onClick:()=>this.enableConfirmationModal("start-breakout")},this.t("breakout_rooms.start_breakout")),this.roomConfig.mode==="edit"&&this.stateManager.hasLocalChanges&&this.permissions.canAlterConnectedMeetings&&$("rtk-button",{size:"md",class:"color-danger",variant:"ghost",onClick:()=>this.discardChanges()},this.t("breakout_rooms.discard_changes")),this.roomConfig.mode==="edit"&&this.stateManager.hasLocalChanges&&this.permissions.canAlterConnectedMeetings&&$("rtk-button",{size:"md",class:"update-breakout-button",onClick:this.applyChanges},this.t("breakout_rooms.update_breakout")),this.roomConfig.mode==="edit"&&!this.stateManager.hasLocalChanges&&this.permissions.canAlterConnectedMeetings&&$("rtk-button",{size:"md",class:"close-breakout-button",onClick:()=>this.enableConfirmationModal("close-breakout")},this.t("breakout_rooms.close_breakout"))))))}static get watchers(){return{selectedParticipants:["onSelectedParticipantsChanged"]}}};are([ge()],tM.prototype,"meeting",void 0);are([ge()],tM.prototype,"states",void 0);are([ge()],tM.prototype,"iconPack",void 0);are([ge()],tM.prototype,"t",void 0);tM.style=kzn;const Szn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:flex;flex-direction:column;overflow:hidden;border-radius:var(--rtk-border-radius-md, 8px);padding:var(--rtk-space-4, 16px);width:100%;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));width:400px;max-width:80%}.content-col{display:flex;width:100%;flex-direction:column}h2{margin:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-2, 8px)}.content-row{display:flex;width:100%;flex-direction:row}.content-row rtk-button{margin-top:var(--rtk-space-4, 16px);width:100%}textarea{margin-top:var(--rtk-space-3, 12px);resize:none;border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;font-family:var(--rtk-font-family, sans-serif);outline:2px solid transparent;outline-offset:2px;height:var(--rtk-space-16, 64px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));padding:var(--rtk-space-2, 8px);color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}textarea::-moz-placeholder{color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}textarea::placeholder{color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}select{border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;padding-top:var(--rtk-space-3, 12px);padding-bottom:var(--rtk-space-3, 12px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);outline:2px solid transparent;outline-offset:2px;border-right-width:var(--rtk-border-width-md, 2px);border-style:solid;border-color:transparent;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}p{margin:var(--rtk-space-0, 0px);margin-top:var(--rtk-space-2, 8px);width:100%;text-align:center;font-size:14px;--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity));display:flex;flex-direction:row;align-items:center;justify-content:center}p rtk-icon{margin-left:var(--rtk-space-1, 4px);height:var(--rtk-space-5, 20px)}",Czn=Szn;var ore=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const nM=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.iconPack=Nt,this.t=It(),this.messagePayload={to:"Everyone",message:""},this.successMessage=!1}close(){var t;(t=this.stateUpdate)===null||t===void 0||t.emit({activeBroadcastMessageModal:!1})}sendMessage(){this.successMessage=!0,setTimeout(()=>{this.close()},2e3)}render(){return $(mt,{key:"0ddf3933cc56bd2d95a2d112965c22070a52c1ca"},$("div",{key:"4a1428283dee02f1d09b0650b0facceebd612772",class:"content-col"},$("h2",{key:"610e4ada5ae3543b629526324e4608e9950a20b0"},"Broadcast message to"),$("select",{key:"46b4a3573a196f00ad1d9d20d92f3e03b250162c",onChange:t=>{this.messagePayload=Object.assign(Object.assign({},this.messagePayload),{to:t.target.value})}},$("option",{key:"aaa981db25435bb257d02086463703d3d2a14ec2"},"Everyone"),$("option",{key:"4bae49f7600fe5b5156f030e2f2433b334856e00"},"List of rooms")),$("textarea",{key:"0d6da453ebb0b9711c79ba3c2c2c71a662955a9d",placeholder:"Type message here...",onInput:t=>{this.messagePayload=Object.assign(Object.assign({},this.messagePayload),{message:t.target.value})}}),this.successMessage?$("p",null,"Message sent to ",this.messagePayload.to,$("rtk-icon",{icon:this.iconPack.checkmark})):$("div",{class:"content-row"},$("rtk-button",{onClick:()=>this.close(),variant:"secondary"},"Cancel")," ",$("rtk-button",{variant:"primary",onClick:()=>this.sendMessage()},"Send"))))}};ore([ge()],nM.prototype,"meeting",void 0);ore([ge()],nM.prototype,"states",void 0);ore([ge()],nM.prototype,"iconPack",void 0);ore([ge()],nM.prototype,"t",void 0);nM.style=Czn;const jzn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:flex;flex-direction:column;overflow:hidden;border-radius:var(--rtk-border-radius-md, 8px);padding:var(--rtk-space-8, 32px);width:100%;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));width:400px;max-width:80%}.leave-modal{width:100%;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.leave-modal .header h2{margin:var(--rtk-space-0, 0px)}.leave-modal .content{font-size:14px}.leave-modal p{margin-top:var(--rtk-space-3, 12px);margin-bottom:var(--rtk-space-3, 12px)}.leave-meeting{display:flex;flex-direction:row;justify-content:space-between;gap:var(--rtk-space-4, 16px)}.leave-meeting rtk-button{color:rgb(var(--rtk-colors-text-1000, 255 255 255));flex:1 1 0%}.br-secondary-btn{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.br-secondary-btn:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}",Ezn=jzn;var lre=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const rM=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.keyPressListener=e=>{e.key==="Escape"&&this.close()},this.iconPack=Nt,this.t=It(),this.close=()=>{this.states.activeConfirmationModal.onClose(this.stateUpdate,this.states,this.meeting),this.stateUpdate.emit({activeConfirmationModal:{active:!1}}),this.states.activeConfirmationModal={active:!1}},this.onConfirmation=async()=>{this.states.activeConfirmationModal.onClick(this.stateUpdate,this.states,this.meeting),this.stateUpdate.emit({activeConfirmationModal:{active:!1}}),this.states.activeConfirmationModal={active:!1}}}connectedCallback(){document.addEventListener("keydown",this.keyPressListener)}componentDidLoad(){}disconnectedCallback(){document.removeEventListener("keydown",this.keyPressListener)}render(){var t,e;const n=this.states.activeConfirmationModal;return $(mt,{key:"faaa0531618c40c1e31ab3f77a9b038cd917244e"},$("div",{key:"930c37d5d2e290a739d50dcd9c2ad298465850d3",class:"leave-modal"},$("div",{key:"0bfb807f0f28d8bc1a28c03c548eca5b0e36eaab",class:"header"},$("h2",{key:"0985fb052282b0b67ec259bd4e3b555405bc7283",class:"title"},n.header?this.t(n.header):this.t("cta.confirmation"))),n.content&&$("p",{key:"99ea852e8d28f4164a6bd159dcb1b967c92b7a63",class:"message"},this.t(n.content)),$("div",{key:"44073f19fa772c1d4c4bcc4962be90aad26b6965",class:"content"},$("div",{key:"823c39dfd07659d5f9391242acdac1654e14b588",class:"leave-meeting"},$("rtk-button",{key:"e549f53577a5a3b4e677fac6b66f5024868c748f",variant:"secondary",title:n.cancelText?this.t(n.cancelText):this.t("cancel"),onClick:this.close,class:"br-secondary-btn"},n.cancelText?this.t(n.cancelText):this.t("cancel")),$("rtk-button",{key:"da7969392d5781fb63e999c6e4c6b022f7aae23d",onClick:()=>this.onConfirmation(),variant:(e=(t=this.states.activeConfirmationModal)===null||t===void 0?void 0:t.variant)!==null&&e!==void 0?e:"danger",title:n.ctaText?this.t(n.ctaText):this.t("yes")},n.ctaText?this.t(n.ctaText):this.t("yes"))))))}};lre([ge()],rM.prototype,"meeting",void 0);lre([ge()],rM.prototype,"states",void 0);lre([ge()],rM.prototype,"iconPack",void 0);lre([ge()],rM.prototype,"t",void 0);rM.style=Ezn;const Nzn=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;display:flex;overflow:hidden;border-radius:var(--rtk-border-radius-md, 8px);width:100%;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}header{margin-right:var(--rtk-space-2, 8px);display:flex;align-items:center;justify-content:space-between;padding-top:var(--rtk-space-0, 0px);padding-bottom:var(--rtk-space-0, 0px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px)}header h3{margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-4, 16px)}.back-btn{border-radius:var(--rtk-border-radius-sm, 4px);background-color:transparent;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.back-btn:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}aside{box-sizing:border-box;display:flex;max-width:var(--rtk-space-56, 224px) !important;flex-direction:column;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));padding-left:var(--rtk-space-2, 8px)}aside button{margin-top:var(--rtk-space-4, 16px);box-sizing:border-box;display:flex;width:100%;align-items:center;justify-content:space-between;border-top-left-radius:var(--rtk-border-radius-sm, 4px);border-bottom-left-radius:var(--rtk-border-radius-sm, 4px);padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px);padding-top:var(--rtk-space-3, 12px);padding-bottom:var(--rtk-space-3, 12px);background-color:transparent;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));cursor:default;font-size:14px;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);border-width:var(--rtk-border-width-none, 0);border-style:none;outline:2px solid transparent;outline-offset:2px}aside button .right{display:flex;align-items:center}aside button .right rtk-icon{height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}aside button .right rtk-icon:last-child{margin-left:var(--rtk-space-4, 16px)}aside button[type='button']{cursor:pointer;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}aside button[type='button']:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}aside button[type='button']{border-right:var(--rtk-border-width-md, 2px) solid transparent}aside button.active{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-border-opacity));background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / 0.2)}aside button.active:hover{background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / 0.2)}aside button.hidden{display:none}main{position:relative;box-sizing:border-box;display:flex;height:100%;width:100%;flex-direction:column}:host([size='sm']) aside{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));width:100% !important;max-width:100% !important;padding-left:var(--rtk-space-0, 0px)}:host([size='sm']) aside button{border-radius:var(--rtk-border-radius-none, 0)}:host([size='sm']) aside button.active{border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent}:host([size='sm']) aside button.active:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}:host([size='sm']) aside button.hidden{display:none}:host([size='sm']) aside.hide{display:none}aside button:host([size='sm']) aside.hide{display:none}:host([size='sm']) aside button:host([size='sm']) aside.hide{display:none}:host([size='sm']) main{display:none;height:100%;width:100%;padding:var(--rtk-space-0, 0px)}aside button:host([size='sm']) main{display:none}:host([size='sm']) aside button:host([size='sm']) main{display:none}:host([size='sm']) main.active{display:block}:host([size='sm']) header{margin:var(--rtk-space-0, 0px);justify-content:center}:host([size='sm']) header rtk-button{position:absolute;left:var(--rtk-space-4, 16px)}::-webkit-scrollbar{width:8px}::-webkit-scrollbar-track{border-radius:var(--rtk-border-radius-lg, 12px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}::-webkit-scrollbar-thumb{border-radius:var(--rtk-border-radius-lg, 12px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}::-webkit-scrollbar-thumb:hover{border-radius:var(--rtk-border-radius-lg, 12px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}.progress-bar{height:var(--rtk-space-1, 4px);width:100%;overflow:hidden;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.progress-indicator{height:100%;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity))}`,Tzn=Nzn;var cre=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const sM=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.keyPressListener=e=>{e.key==="Escape"&&this.close()},this.iconPack=Nt,this.t=It(),this.activeTab="audio",this.isMobileMainVisible=!1,this.progress=0}connectedCallback(){document.addEventListener("keydown",this.keyPressListener)}disconnectedCallback(){this.keyPressListener&&document.removeEventListener("keydown",this.keyPressListener)}progressUpdate(t){this.progress=t.detail}changeTab(t){this.activeTab=t,this.size==="sm"&&(this.isMobileMainVisible||(this.isMobileMainVisible=!0))}close(){this.stateUpdate.emit({activeDebugger:!1})}getActiveTab(){switch(this.activeTab){case"audio":return this.t("debugger.audio.troubleshooting.label");case"screenshare":return this.t("debugger.screenshare.troubleshooting.label");case"video":return this.t("debugger.video.troubleshooting.label");case"system":return this.t("debugger.system.troubleshooting.label");default:return this.t("debugger.troubleshooting.label")}}render(){if(!this.meeting)return null;const t={meeting:this.meeting,states:this.states,iconPack:this.iconPack,t:this.t,size:this.size},e=this.getActiveTab(),n=typeof navigator.getBattery<"u";return $(mt,null,$("aside",{class:{hide:this.isMobileMainVisible},part:"menu"},$("header",null,$("h3",null,this.t("debugger.troubleshooting.label"))),$("button",{type:"button",class:{active:this.activeTab==="audio"},onClick:()=>this.changeTab("audio")},this.t("debugger.audio.label"),$("div",{class:"right"},$("rtk-icon",{icon:this.iconPack.mic_on}),this.size==="sm"&&$("rtk-icon",{icon:this.iconPack.chevron_right}))),$("button",{type:"button",class:{active:this.activeTab==="video"},onClick:()=>this.changeTab("video")},this.t("debugger.video.label"),$("div",{class:"right"},$("rtk-icon",{icon:this.iconPack.video_on}),this.size==="sm"&&$("rtk-icon",{icon:this.iconPack.chevron_right}))),$("button",{type:"button",class:{active:this.activeTab==="screenshare"},onClick:()=>this.changeTab("screenshare")},this.t("debugger.screenshare.label"),$("div",{class:"right"},$("rtk-icon",{icon:this.iconPack.share_screen_start}),this.size==="sm"&&$("rtk-icon",{icon:this.iconPack.chevron_right}))),$("button",{type:"button",class:{active:this.activeTab==="system",hidden:!n},onClick:()=>this.changeTab("system")},this.t("debugger.system.label"),$("div",{class:"right"},$("rtk-icon",{icon:this.iconPack.settings}),this.size==="sm"&&$("rtk-icon",{icon:this.iconPack.chevron_right})))),$("main",{class:{active:this.isMobileMainVisible},part:"main-content"},this.size==="sm"&&$("header",null,$("rtk-button",{kind:"icon",class:"back-btn",onClick:()=>this.isMobileMainVisible=!1},$("rtk-icon",{icon:this.iconPack.chevron_left})),$("h4",null,e)),this.activeTab==="audio"&&$("rtk-debugger-audio",Object.assign({},t)),this.activeTab==="video"&&$("rtk-debugger-video",Object.assign({},t)),this.activeTab==="screenshare"&&$("rtk-debugger-screenshare",Object.assign({},t)),this.activeTab==="system"&&n&&$("rtk-debugger-system",Object.assign({},t))))}};cre([ge()],sM.prototype,"meeting",void 0);cre([ge()],sM.prototype,"states",void 0);cre([ge()],sM.prototype,"iconPack",void 0);cre([ge()],sM.prototype,"t",void 0);sM.style=Tzn;const _zn=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host::-webkit-scrollbar{width:var(--rtk-space-1\\.5, 6px);border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}:host::-webkit-scrollbar-thumb{border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}:host(.stage){box-sizing:border-box;display:block;width:512px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));padding:var(--rtk-space-6, 24px);-webkit-user-select:none;-moz-user-select:none;user-select:none;overflow:auto;border-radius:var(--rtk-border-radius-md, 8px);line-height:1.25}:host(.stage) rtk-participant-setup{display:flex;flex:1 1 0%;align-items:center;justify-content:space-around;margin-left:auto;margin-right:auto}:host(.stage) .container rtk-button{flex-grow:1;padding:var(--rtk-space-1, 4px);width:50%}:host(.stage) .container rtk-button:nth-child(1){margin-right:var(--rtk-space-1\\.5, 6px)}:host(.stage) .container rtk-button:nth-child(2){margin-left:var(--rtk-space-1\\.5, 6px)}:host(.stage) h2{font-size:24px;font-weight:500;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}:host(.stage) header{padding-left:var(--rtk-space-4, 16px);padding-right:var(--rtk-space-4, 16px)}:host(.stage) .summary{padding:var(--rtk-space-4, 16px)}.deny-access{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}.container{width:100%;max-width:1080px;display:flex;flex:1 1 0%;align-items:center;justify-content:space-around}header{display:flex;align-items:center;justify-content:space-between}`,Azn=_zn;var xB=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const pN=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.joinStage=Wt(this,"rtkJoinStage",7),this.leaveStage=Wt(this,"rtkLeaveStage",7),this.config=Os(),this.iconPack=Nt,this.t=It(),this.dataConfig={title:this.t("stage.join_title"),label:{accept:this.t("stage.join_confirm"),reject:this.t("stage.join_cancel")},description:this.t("stage.join_summary")},this.isLoading=!1}render(){var t,e;const n={meeting:this.meeting,size:this.size,states:this.states,config:this.config,iconPack:this.iconPack,t:this.t};return $(mt,{key:"2000c74c7b15b8ad8cc8d7b2940ee1c47c504111",class:{stage:!0}},$("header",{key:"1be2b7c17338f42472bd47c761e8a972d960eb45"},$("h2",{key:"8a2d2e49eb154fc58f121f26c067519473007aa1"},this.dataConfig.title)),$(tc,{key:"17476c475c67d3eedfce7e66a2dc1829211e6f7b",element:"rtk-participant-setup",defaults:n,props:{participant:(t=this.meeting)===null||t===void 0?void 0:t.self,size:"md"},childProps:{participant:(e=this.meeting)===null||e===void 0?void 0:e.self,size:"md"},deepProps:!0}),$("div",{key:"708a514d2f5c903c5e01161a374455134f9c5fde",class:"summary"},this.dataConfig.description),$("div",{key:"690c062b55469b6d2757628cf9c841db05cb50dd",class:"container"},$("rtk-button",{key:"3c840601730f7c31da94f58fcc7a36fa7f2e98ac",variant:"secondary",onClick:()=>this.leaveStage.emit(),title:this.dataConfig.label.reject},this.dataConfig.label.reject),$("rtk-button",{key:"d4838af3f9b36c6d91ce04d9862840ee838111de",onClick:()=>{this.isLoading||(this.isLoading=!0,this.joinStage.emit())},title:this.dataConfig.label.accept},this.isLoading?$("rtk-icon",{icon:this.iconPack.spinner}):this.dataConfig.label.accept)))}};xB([ge()],pN.prototype,"meeting",void 0);xB([ge()],pN.prototype,"config",void 0);xB([ge()],pN.prototype,"states",void 0);xB([ge()],pN.prototype,"iconPack",void 0);xB([ge()],pN.prototype,"t",void 0);pN.style=Azn;const Pzn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.leave-modal{width:var(--rtk-space-72, 288px)}@media (min-width: 768px){.leave-modal{width:var(--rtk-space-96, 384px)}}.leave-modal{position:relative;display:flex;flex-direction:column;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));padding:var(--rtk-space-8, 32px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.leave-modal .header h2{margin:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-3, 12px)}.leave-modal .message{color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}.leave-modal .content{margin-top:var(--rtk-space-4, 16px);font-size:14px;display:flex;flex-wrap:wrap;gap:var(--rtk-space-4, 16px)}.leave-modal .content rtk-button{height:var(--rtk-space-9, 36px);min-width:var(--rtk-space-44, 176px);flex-grow:1}.leave-modal .content .secondary-btn{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.leave-modal .content .secondary-btn:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.leave-modal .content .secondary-danger-btn{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}",Rzn=Pzn;var dre=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const iM=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.keyPressListener=e=>{e.key==="Escape"&&this.close()},this.iconPack=Nt,this.t=It(),this.canEndMeeting=!1,this.isBreakoutRoomsActive=!1,this.isChildMeeting=!1,this.canJoinMainRoom=!1,this.permissionsUpdateListener=()=>{this.canEndMeeting=this.meeting.self.permissions.kickParticipant,this.canJoinMainRoom=this.meeting.self.permissions.connectedMeetings.canSwitchToParentMeeting},this.close=()=>{this.stateUpdate.emit({activeLeaveConfirmation:!1})},this.handleLeave=()=>{var e;(e=this.meeting)===null||e===void 0||e.leave(),this.close()},this.handleJoinMainRoom=()=>{this.meeting.connectedMeetings.moveParticipants(this.meeting.meta.meetingId,this.meeting.connectedMeetings.parentMeeting.id,[this.meeting.self.userId]),this.close()},this.handleEndMeeting=()=>{var e;(e=this.meeting)===null||e===void 0||e.participants.kickAll(),this.close()}}connectedCallback(){this.meetingChanged(this.meeting),document.addEventListener("keydown",this.keyPressListener)}disconnectedCallback(){var t;document.removeEventListener("keydown",this.keyPressListener),(t=this.meeting)===null||t===void 0||t.self.permissions.removeListener("permissionsUpdate",this.permissionsUpdateListener)}meetingChanged(t){t!=null&&(this.isBreakoutRoomsActive=this.meeting.connectedMeetings.isActive,this.isChildMeeting=this.meeting.connectedMeetings.meetings.some(e=>e.id===t.meta.meetingId),this.meeting.self.permissions.addListener("permissionsUpdate",this.permissionsUpdateListener),this.permissionsUpdateListener())}render(){return $(mt,{key:"93a88022c62d7e1dbcd512fa19ad72e7e938e6cc"},$("div",{key:"526c2dc395fe41a2e980c881c0d3d145c86e7c76",class:"leave-modal"},$("div",{key:"ecd34ea2ecc74099a9377ced64a24667aa2e24aa",class:"header"},$("h2",{key:"51c05788210388df22e871bad265c05c40b7dd75",class:"title"},this.t("leave"))),$("p",{key:"fd6a2f2cc6f75c808f995bff3bf5e8628806a0b1",class:"message"},this.isBreakoutRoomsActive&&this.isChildMeeting?this.t("breakout_rooms.leave_confirmation"):this.t("leave_confirmation")),$("div",{key:"6ed0ae860e10f08858707aea9eae9530cfb0eb88",class:"content"},$("rtk-button",{key:"8ecc5aca329f6bb5eac183dc5e997834c9b511ae",variant:"secondary",onClick:this.close,class:"secondary-btn"},this.t("cancel")),this.isBreakoutRoomsActive&&this.isChildMeeting&&this.canJoinMainRoom&&$("rtk-button",{key:"8a31fdea844a2ce4b3b4aeba4114ef0178e2df0b",variant:"secondary",onClick:this.handleJoinMainRoom,class:"secondary-btn"},this.t("breakout_rooms.leave_confirmation.main_room_btn")),$("rtk-button",{key:"e8d815dccf9ea30ab9290f4789f855412b2c9baa",variant:"danger",title:this.t("leave"),onClick:this.handleLeave},this.t("leave")),this.canEndMeeting&&$("rtk-button",{key:"64073a99ca9ee3beee04ce0aaa4ec4346d5c4de1",variant:"danger",class:"secondary-btn secondary-danger-btn",onClick:this.handleEndMeeting},this.t("end.all")))))}static get watchers(){return{meeting:["meetingChanged"]}}};dre([ge()],iM.prototype,"meeting",void 0);dre([ge()],iM.prototype,"states",void 0);dre([ge()],iM.prototype,"iconPack",void 0);dre([ge()],iM.prototype,"t",void 0);iM.style=Rzn;const Izn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block;-webkit-user-select:none;-moz-user-select:none;user-select:none}.leave-modal{position:relative;display:flex;flex-direction:column;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));padding:var(--rtk-space-4, 16px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.leave-modal .header h2{margin:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-3, 12px)}.leave-modal .content{font-size:14px}.leave-message p{margin-top:var(--rtk-space-3, 12px);margin-bottom:var(--rtk-space-3, 12px)}.leave-meeting{display:flex;flex-direction:row;justify-content:space-between;gap:var(--rtk-space-2, 8px)}.leave-meeting rtk-button{flex:1 1 0%}.end-meeting{margin-top:var(--rtk-space-2, 8px)}.message{margin-bottom:var(--rtk-space-4, 16px)}label{display:flex;align-items:center}input[type='checkbox']{margin-right:var(--rtk-space-2, 8px);accent-color:rgb(var(--rtk-colors-brand-500, 33 96 253))}",Mzn=Izn;var ure=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const aM=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.iconPack=Nt,this.t=It(),this.allowUnmute=!0,this.onClose=()=>{this.stateUpdate.emit({activeMuteAllConfirmation:!1})},this.onMuteAll=()=>{var e;(e=this.meeting)===null||e===void 0||e.participants.disableAllAudio(this.allowUnmute),this.onClose()}}render(){return $(mt,{key:"e47a9e4e3c89bc1badc85cb76edf522eb8514c58"},$("div",{key:"bafee985eb5f1e01d87e509018917473d3723190",class:"leave-modal"},$("div",{key:"f21285fa0b0239c9f64a9390599528dfe50a355b",class:"header"},$("h2",{key:"5201c1d79f1d64e513ef8036b16fd03e27280baf",class:"title"},this.t("mute_all.header"))),$("p",{key:"5c5af2814146578f3b3c3ae434f45da414b97f15",class:"message"},this.t("mute_all.description")),$("div",{key:"cde4bbb5ee289ad5b65a9fb13d0fb5bc5f309a0b",class:"content"},$("div",{key:"1f034975b9099d8474c3442da08fc79660b74a70",class:"leave-meeting"},$("rtk-button",{key:"16614bc8443e1e249d0eda46d66227eedf036856",variant:"secondary",title:this.t("close"),onClick:this.onClose},this.t("cancel")),$("rtk-button",{key:"6f67cf660adcc1d849f5cd090003a5c7ad26947d",variant:"danger",title:this.t("mute_all"),onClick:this.onMuteAll},this.t("mute_all"))))))}};ure([ge()],aM.prototype,"meeting",void 0);ure([ge()],aM.prototype,"states",void 0);ure([ge()],aM.prototype,"iconPack",void 0);ure([ge()],aM.prototype,"t",void 0);aM.style=Mzn;const Lzn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / 0.6);position:fixed;top:var(--rtk-space-0, 0px);right:var(--rtk-space-0, 0px);z-index:50}rtk-icon{height:var(--rtk-space-20, 80px)}h2{margin:var(--rtk-space-2, 8px);font-weight:500}p{margin:var(--rtk-space-0, 0px);font-size:16px}",Dzn=Lzn;var hre=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const oM=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.iconPack=Nt,this.t=It()}connectedCallback(){this.states.activeOverlayModal.timeout&&setTimeout(()=>{this.stateUpdate.emit({activeOverlayModal:{active:!1}})},this.states.activeOverlayModal.timeout)}render(){return $(mt,{key:"1c15f5569d6914a3cbbd9685c354f9c14e38d7af"},$("rtk-icon",{key:"b3a08daa8c951ca46a8b98c64fca1d178f56ac72",icon:this.states.activeOverlayModal.icon}),$("h2",{key:"e8498afe9cf9434aaf8e4f1157c174b3268dbd41"},this.states.activeOverlayModal.title),$("p",{key:"a48d9a3ed6634682e1f2fc7af69e357d57cb9aaf"},this.states.activeOverlayModal.description))}};hre([ge()],oM.prototype,"meeting",void 0);hre([ge()],oM.prototype,"states",void 0);hre([ge()],oM.prototype,"iconPack",void 0);hre([ge()],oM.prototype,"t",void 0);oM.style=Dzn;const $zn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:block;max-height:100%;width:600px;overflow-y:auto;padding:var(--rtk-space-6, 24px);border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));overflow-wrap:break-word;color:rgb(var(--rtk-colors-text-1000, 255 255 255));word-wrap:break-word}.actions{display:flex;align-items:center;gap:var(--rtk-space-2, 8px)}.text-icon{display:inline-block;vertical-align:middle}h2{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-4, 16px)}h2 .text-icon{margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}p{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-4, 16px)}.need-help-link{margin-top:var(--rtk-space-2, 8px);display:inline-block;text-underline-offset:2px;--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-400, 53 110 253) / var(--tw-text-opacity))}.need-help-link:hover{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-600, 13 81 253) / var(--tw-text-opacity))}a rtk-icon{margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}:host([size='sm']) .actions{flex-direction:column;align-items:flex-start;justify-content:center}:host([size='sm']) .action{width:100%;padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px)}.actions{margin-top:var(--rtk-space-6, 24px)}.actions rtk-button{flex:1 1 0%}.svg-container{display:flex;width:100%;justify-content:center !important}.svg-ins{width:80%;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgb(255 255 255 / var(--tw-bg-opacity))}",Ozn=$zn;var mre=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const Fzn={"Chrome.Desktop.audio":["Chrome1.svg","Chrome2.svg","Chrome3.svg"],"Chrome.Desktop.video":["Chrome1.svg","Chrome2.svg","Chrome3.svg"]},lM=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.t=It(),this.iconPack=Nt,this.currentStep=0,this.svgSteps=[],this.continue=()=>{this.stateUpdate.emit({activePermissionsMessage:{enabled:!1}})},this.reload=()=>{typeof window<"u"&&window.location.reload()},this.getImage=async e=>{function n(i,o,l){return i.split(o).join(l)}let s=await(await fetch(`https://rtk-assets.realtime.cloudflare.com/ui-kit/permissions/${e}`)).text();return s=n(s,"yoursite.com",location.host),s=n(s,"Yoursite",document.title.length>14?`${document.title.slice(0,14)}...`:document.title),s},this.nextStep=()=>{this.currentStep=(this.currentStep+1)%this.svgSteps.length},this.openMacSystemSettings=()=>{const e=document.createElement("a");switch(this.mediaType){case"audio":e.href="x-apple.systempreferences:com.apple.preference.security?Privacy_Microphone";break;case"screenshare":e.href="x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture";break;case"video":e.href="x-apple.systempreferences:com.apple.preference.security?Privacy_Camera";break}e.click()}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.stepsTimer&&clearTimeout(this.stepsTimer)}meetingChanged(t){var e,n,r;if(t!=null){this.device=t.self.device;const s=!((e=this.device)===null||e===void 0)&&e.isMobile?"Mobile":"Desktop",i=(r=Fzn[`${(n=this.device)===null||n===void 0?void 0:n.browserName}.${s}.${this.mediaType}`])!==null&&r!==void 0?r:[];Promise.all(i.map(this.getImage)).then(o=>{this.svgSteps=o})}}getLink(t){let e;switch(t){case"audio":e="microphone";break;case"video":e="camera";break;default:e="screenshare";break}const n="https://www.google.com/search?q=";let r=`Allow+${e}+access`;if(this.device!=null){const{browserName:s,isMobile:i}=this.device;r+="+"+s,i&&(r+="+mobile")}return n+r}isDeniedBySystem(){var t;const e=(t=this.meeting)===null||t===void 0?void 0:t.self.mediaPermissions;return e==null?!1:e[this.mediaType]==="SYSTEM_DENIED"}getTitle(){return this.isDeniedBySystem()?this.t(`perm_sys_denied.${this.mediaType}`):this.t(`perm_denied.${this.mediaType}`)}get mediaType(){var t,e,n;return(n=(e=(t=this.states)===null||t===void 0?void 0:t.activePermissionsMessage)===null||e===void 0?void 0:e.kind)!==null&&n!==void 0?n:"audio"}getMessage(){var t;const{browserName:e,osName:n}=this.meeting.self.device,r=this.isDeniedBySystem(),s=(t=e.toLowerCase())!==null&&t!==void 0?t:"others",i=n??"others";if(r){const l=`perm_sys_denied.${this.mediaType}.${i.toLowerCase()}.message`;return this.t(l)===l?this.t(`perm_sys_denied.${this.mediaType}.others.message`):this.t(l)}const o=`perm_denied.${this.mediaType}.${s}.message`;return this.t(o)===o?this.t(`perm_denied.${this.mediaType}.others.message`):this.t(o)}render(){var t,e,n;const r=this.isDeniedBySystem();this.svgSteps.length>0&&(this.stepsTimer&&clearTimeout(this.stepsTimer),this.stepsTimer=setTimeout(this.nextStep,2500));const s=r&&this.meeting.self.device.osName=="macOS";return $(mt,{key:"7e7ee4ed331dc9e736b710ce0e492d0d9a749c1b"},$("h2",{key:"1100ed23a733006ee6b644cbd7293f3e8b187e1b"},$("rtk-icon",{key:"23d61902856332821e9b9cf60c126fc4e82f2421",class:"text-icon",icon:this.iconPack.warning}),this.getTitle()),this.svgSteps.length>0&&$("div",{key:"c39e69a21e4d5d009397cbe0563c89d2f00bf414",class:"svg-container"},this.svgSteps.map((i,o)=>$("p",{innerHTML:i,class:"svg-ins",key:this.currentStep,hidden:o!==this.currentStep}))),$("div",{key:"209bdbc52a9a26b9b71328a57e79d424302bc8ea"},this.getMessage()),!r&&$("a",{key:"a096c4b00a29239970f8cd23c123a3d94f78b78f",class:"need-help-link",href:this.getLink((n=(e=(t=this.states)===null||t===void 0?void 0:t.activePermissionsMessage)===null||e===void 0?void 0:e.kind)!==null&&n!==void 0?n:"audio"),target:"_blank",rel:"noreferrer external noreferrer noopener"},$("rtk-icon",{key:"3a0e5cdf4f040381e417a0cf46783ebb47f88f8d",class:"text-icon",icon:this.iconPack.attach}),this.t("cta.help")),$("div",{key:"31fa2a14b1d134f2bab798852b0a339cbd5e53c4",class:"actions"},$("rtk-button",{key:"0574447e6f141a5d899d145f6741500304f16e70",size:"lg",kind:"wide",variant:"secondary",onClick:this.continue},this.t("cta.continue")),s?$("rtk-button",{size:"lg",kind:"wide",onClick:this.openMacSystemSettings},this.t("cta.system_settings")):$("rtk-button",{size:"lg",kind:"wide",onClick:this.reload},this.t("cta.reload"))),$("slot",{key:"bab0db24f078ff258a8223a9910e089c2e2229e1"}))}static get watchers(){return{meeting:["meetingChanged"]}}};mre([ge()],lM.prototype,"meeting",void 0);mre([ge()],lM.prototype,"t",void 0);mre([ge()],lM.prototype,"iconPack",void 0);mre([ge()],lM.prototype,"states",void 0);lM.style=Ozn;var Bzn=Object.freeze({__proto__:null,rtk_breakout_rooms_manager:tM,rtk_broadcast_message_modal:nM,rtk_confirmation_modal:rM,rtk_debugger:sM,rtk_join_stage:pN,rtk_leave_meeting:iM,rtk_mute_all_confirmation:aM,rtk_overlay_modal:oM,rtk_permissions_message:lM});const Uzn=".message-wrapper{display:flex;gap:var(--rtk-space-2, 8px);margin-left:var(--rtk-space-4, 16px);margin-right:var(--rtk-space-4, 16px);margin-top:var(--rtk-space-4, 16px)}[is-continued] .message-wrapper{margin-top:var(--rtk-space-0, 0px)}.message-wrapper.align-right{flex-direction:row-reverse}.file-picker{display:none}.message{position:relative;display:flex}.show-on-hover rtk-menu{visibility:hidden}.show-on-hover:hover rtk-menu{visibility:visible}.align-right .message{justify-content:flex-end;margin-left:auto}.align-right .message .head{margin-right:var(--rtk-space-1, 4px);margin-left:var(--rtk-space-0, 0px);flex-direction:row-reverse;gap:var(--rtk-space-4, 16px)}.align-right .message rtk-text-message .bubble,.align-right .message rtk-image-message .bubble,.align-right .message rtk-file-message .bubble{padding-right:var(--rtk-space-5, 20px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.align-right .message .actions rtk-icon{color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.align-right rtk-menu{left:auto;right:var(--rtk-space-0, 0px)}.head{margin-bottom:var(--rtk-space-2, 8px);margin-left:var(--rtk-space-1, 4px);display:flex;align-items:center;gap:var(--rtk-space-2, 8px)}.head .name{font-size:14px;font-weight:600}.head .time{font-size:12px;color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}rtk-menu{position:absolute;left:var(--rtk-space-0, 0px);top:var(--rtk-space-6, 24px);border-radius:var(--rtk-border-radius-lg, 12px)}rtk-menu rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);cursor:pointer}[is-continued] rtk-menu{top:var(--rtk-space-2, 8px)}.actions{display:flex;align-items:center;justify-content:center;padding:var(--rtk-space-0\\.5, 2px);border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent}.actions rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.body{margin-top:var(--rtk-space-1, 4px);margin-bottom:var(--rtk-space-1, 4px);overflow-wrap:break-word;font-size:14px;line-height:1.375}.body .emoji{font-size:24px}.body.bubble{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-1, 4px);max-width:var(--rtk-space-96, 384px);padding-top:var(--rtk-space-3, 12px);padding-bottom:var(--rtk-space-3, 12px);padding-left:var(--rtk-space-5, 20px);padding-right:var(--rtk-space-5, 20px);overflow-wrap:break-word;font-size:14px;line-height:1.375;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.body.bubble p{margin:var(--rtk-space-0, 0px);word-break:break-word}p{margin:var(--rtk-space-0, 0px)}rtk-text-message,rtk-image-message,rtk-file-message{display:block;font-family:var(--rtk-font-family, sans-serif);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));box-sizing:border-box}*[is-continued]{margin-top:var(--rtk-space-0, 0px)}.image{position:relative;height:var(--rtk-space-40, 160px);max-width:var(--rtk-space-64, 256px);cursor:pointer}.image img{display:none;height:100%;width:100%;border-radius:var(--rtk-border-radius-sm, 4px);-o-object-fit:cover;object-fit:cover}.image .image-spinner{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.image .image-spinner rtk-spinner{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}.image .image-errored{display:flex;height:100%;width:100%;flex-direction:column;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);background-color:rgba(var(--rtk-colors-danger, 255 45 45) / 0.1);--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}.image .actions{display:none;height:var(--rtk-space-8, 32px);align-items:center;position:absolute;top:var(--rtk-space-2, 8px);right:var(--rtk-space-2, 8px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;--tw-shadow:0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.image .actions .action{height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);border-radius:var(--rtk-border-radius-none, 0);border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent;--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}.image .actions .action:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.image.loaded img{display:block}.image.loaded .image-spinner{display:none}.image:hover .actions,.image:focus .actions{display:flex}.file{display:flex;align-items:center;gap:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);padding-top:var(--rtk-space-1\\.5, 6px);padding-bottom:var(--rtk-space-1\\.5, 6px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.file .file-data{flex:1 1 0%}.file .file-data .name{word-break:break-all;color:rgb(var(--rtk-colors-text-1000, 255 255 255));overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.file .file-data .file-data-split{margin-top:var(--rtk-space-0\\.5, 2px);display:flex;align-items:center;font-size:12px}.file .file-data .file-data-split .ext{margin-right:var(--rtk-space-2, 8px);text-transform:uppercase;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}.file .file-data .file-data-split .divider{height:var(--rtk-space-4, 16px);width:var(--rtk-space-0\\.5, 2px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.file .file-data .file-data-split .size{margin-left:var(--rtk-space-2, 8px)}a{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity));text-decoration-line:none}a:hover{text-decoration-line:underline}.new-chat-marker{display:flex;width:100%;align-items:center;gap:var(--rtk-space-2, 8px);--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity))}.new-chat-marker::before{content:'';height:1px;flex:1 1 0%;background-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / 0.5)}.show-new-messages-ctr{pointer-events:none;display:flex;justify-content:flex-end;padding:var(--rtk-space-3, 12px);z-index:0;margin-top:calc(var(--rtk-space-14, 56px) * -1)}.show-new-messages{pointer-events:auto;--tw-translate-y:calc(var(--rtk-space-6, 24px) * -1);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:0;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.show-new-messages.active{--tw-translate-y:var(--rtk-space-0, 0px);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));opacity:1}blockquote{margin:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-3, 12px);background-color:transparent}.block-quote,blockquote{--tw-border-spacing-x:1px;--tw-border-spacing-y:1px;border-spacing:var(--tw-border-spacing-x) var(--tw-border-spacing-y);border-top-width:var(--rtk-border-width-none, 0);border-bottom-width:var(--rtk-border-width-none, 0);border-left-width:var(--rtk-border-width-md, 2px);border-right-width:var(--rtk-border-width-none, 0);border-style:solid;border-left-color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));padding:var(--rtk-space-0\\.5, 2px);padding-left:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px) !important;border-radius:var(--rtk-border-radius-sm, 4px);border-top-left-radius:var(--rtk-border-radius-none, 0);border-bottom-left-radius:var(--rtk-border-radius-none, 0)}.link{color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}.align-right .block-quote{border-color:rgb(var(--rtk-colors-text-on-brand-600, var(--rtk-colors-text-600, 255 255 255 / 0.52)));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-bg-opacity))}.align-right .link{color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.align-right .image .actions rtk-icon{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity))}.avatar{display:flex;width:var(--rtk-space-6, 24px)}.avatar rtk-avatar{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px);font-size:10px}.message{width:75%}.left-align .body{margin-top:var(--rtk-space-4, 16px)}.left-align [is-continued] .body{margin-top:var(--rtk-space-0, 0px)}.left-align .body{--tw-translate-x:calc(var(--rtk-space-8, 32px) * -1);transform:translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}",zzn=Uzn;var Zxt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const fre=class{constructor(t){kt(this,t),this.edit=Wt(this,"edit",7),this.reply=Wt(this,"reply",7),this.pin=Wt(this,"pin",7),this.delete=Wt(this,"delete",7),this.iconPack=Nt,this.t=It(),this.isSelf=!1,this.canEdit=!1,this.canDelete=!1,this.canReply=!1,this.canPin=!1,this.disableControls=!1,this.alignRight=!1,this.hideAvatar=!1,this.now=new Date,this.leftAlign=!1,this.renderMessage=()=>{switch(this.message.type){case"text":return $("div",{"is-continued":this.isContinued,key:this.message.id},this.isUnread&&$("div",{class:"new-chat-marker",part:"new-chat-marker"},this.t("chat.new")),$("rtk-text-message",{message:this.message,now:this.now,isContinued:this.isContinued,"data-timestamp":this.message.time.getTime(),iconPack:this.iconPack,t:this.t,showBubble:!0}));case"image":return $("div",{"is-continued":this.isContinued,key:this.message.id},this.isUnread&&$("div",{class:"new-chat-marker",part:"new-chat-marker"},this.t("chat.new")),$("rtk-image-message",{message:this.message,now:this.now,isContinued:this.isContinued,iconPack:this.iconPack,"data-timestamp":this.message.time.getTime(),t:this.t,showBubble:!0}));case"file":return $("div",{"is-continued":this.isContinued,key:this.message.id},this.isUnread&&$("div",{class:"new-chat-marker",part:"new-chat-marker"},this.t("chat.new")),$("rtk-file-message",{message:this.message,now:this.now,isContinued:this.isContinued,iconPack:this.iconPack,t:this.t,"data-timestamp":this.message.time.getTime(),showBubble:!0}));case"custom":this.child.setAttribute("message",JSON.stringify(this.message));const e=this.child.cloneNode(!0);return $("div",{"is-continued":this.isContinued,key:this.message.id,ref:n=>n.appendChild(e)})}},this.onReply=()=>{this.reply.emit(this.message)},this.onPinned=()=>{this.pin.emit(this.message)},this.onDelete=()=>{this.delete.emit(this.message)},this.onEdit=async()=>{this.edit.emit(this.message)},this.isTouchDevice=()=>"ontouchstart"in window||navigator.maxTouchPoints>0}renderControls(){if(!this.disableControls)return $("rtk-menu",{placement:this.alignRight?"bottom-end":"bottom-start"},$("button",{slot:"trigger",class:"actions"},$("rtk-icon",{icon:this.iconPack.chevron_down})),$("rtk-menu-list",null,this.canReply&&$("rtk-menu-item",{onClick:this.onReply},$("rtk-icon",{icon:this.iconPack.back,slot:"start"}),this.t("chat.reply")),this.canPin&&$("rtk-menu-item",{onClick:this.onPinned},$("rtk-icon",{icon:this.iconPack.pin,slot:"start"}),this.t("pin")),this.canEdit&&$("rtk-menu-item",{onClick:this.onEdit},$("rtk-icon",{icon:this.iconPack.edit,slot:"start"}),this.t("chat.edit_msg")),this.canDelete&&$("rtk-menu-item",{onClick:this.onDelete},$("rtk-icon",{icon:this.iconPack.delete,slot:"start"}),this.t("chat.delete_msg"))))}renderAvatar(){if(!this.hideAvatar)return this.isContinued?$("div",{class:"avatar"}):$("div",{class:"avatar"},$("rtk-avatar",{size:"sm",participant:{name:this.message.displayName,picture:this.senderDisplayPicture}}))}render(){return $(mt,{key:"4ca0e3d6e38c1f576ebffbc4c06eae77ab9fb4d5"},$("div",{key:"182c410a2ba918fc0dde0600234c336f83a74c80",class:{"message-wrapper":!0,"align-right":this.alignRight,"left-align":this.leftAlign},"is-continued":this.isContinued},this.renderAvatar(),$("div",{key:"2aa6e896e51e7d766b4a48a7128f5784f0e0e48f",class:{message:!0,"show-on-hover":!this.isTouchDevice()},"is-continued":this.isContinued},this.renderMessage(),this.renderControls())))}get $el(){return Pl(this)}};Zxt([ge()],fre.prototype,"iconPack",void 0);Zxt([ge()],fre.prototype,"t",void 0);fre.style=zzn;var Vzn=Object.freeze({__proto__:null,rtk_chat_message:fre});const Hzn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);display:flex}:host([data-hidden]){display:none}:host[size='sm']{margin-left:var(--rtk-space-1, 4px);margin-right:var(--rtk-space-1, 4px)}.indicator{display:flex;flex-direction:row;align-items:center;font-size:14px;--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}rtk-icon{margin-right:var(--rtk-space-1, 4px);height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px);animation:blink 4s linear infinite}:host([size='sm']) rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}:host([size='sm']) .indicator span{display:none}@keyframes blink{0%,10%{opacity:0}11%,100%{opacity:1}}",Gzn=Hzn;var sTe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const wB=class{constructor(t){kt(this,t),this.t=It(),this.iconPack=Nt,this.setIsLivestreaming=e=>{this.isLivestreaming=e==="LIVESTREAMING"}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var t,e;(e=(t=this.meeting)===null||t===void 0?void 0:t.livestream)===null||e===void 0||e.removeListener("livestreamUpdate",this.setIsLivestreaming)}meetingChanged(t){var e,n;t&&(this.setIsLivestreaming((e=this.meeting.livestream)===null||e===void 0?void 0:e.state),(n=this.meeting.livestream)===null||n===void 0||n.on("livestreamUpdate",this.setIsLivestreaming))}render(){return!LI(this.meeting)||!this.isLivestreaming?$(mt,{"data-hidden":!0}):$(mt,null,$("div",{class:"indicator","aria-label":this.t("livestream.indicator"),part:"indicator"},$("rtk-icon",{icon:this.iconPack.start_livestream,size:this.size}),$("span",null,this.t("LIVE"))))}static get watchers(){return{meeting:["meetingChanged"]}}};sTe([ge()],wB.prototype,"meeting",void 0);sTe([ge()],wB.prototype,"t",void 0);sTe([ge()],wB.prototype,"iconPack",void 0);wB.style=Gzn;const $n=Number.isFinite||function(t){return typeof t=="number"&&isFinite(t)},Wzn=Number.isSafeInteger||function(t){return typeof t=="number"&&Math.abs(t)<=qzn},qzn=Number.MAX_SAFE_INTEGER||9007199254740991;let ur=function(t){return t.NETWORK_ERROR="networkError",t.MEDIA_ERROR="mediaError",t.KEY_SYSTEM_ERROR="keySystemError",t.MUX_ERROR="muxError",t.OTHER_ERROR="otherError",t}({}),dt=function(t){return t.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",t.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",t.KEY_SYSTEM_NO_SESSION="keySystemNoSession",t.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",t.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",t.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",t.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",t.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",t.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",t.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",t.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",t.MANIFEST_LOAD_ERROR="manifestLoadError",t.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",t.MANIFEST_PARSING_ERROR="manifestParsingError",t.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",t.LEVEL_EMPTY_ERROR="levelEmptyError",t.LEVEL_LOAD_ERROR="levelLoadError",t.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",t.LEVEL_PARSING_ERROR="levelParsingError",t.LEVEL_SWITCH_ERROR="levelSwitchError",t.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",t.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",t.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",t.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",t.FRAG_LOAD_ERROR="fragLoadError",t.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",t.FRAG_DECRYPT_ERROR="fragDecryptError",t.FRAG_PARSING_ERROR="fragParsingError",t.FRAG_GAP="fragGap",t.REMUX_ALLOC_ERROR="remuxAllocError",t.KEY_LOAD_ERROR="keyLoadError",t.KEY_LOAD_TIMEOUT="keyLoadTimeOut",t.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",t.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",t.BUFFER_APPEND_ERROR="bufferAppendError",t.BUFFER_APPENDING_ERROR="bufferAppendingError",t.BUFFER_STALLED_ERROR="bufferStalledError",t.BUFFER_FULL_ERROR="bufferFullError",t.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",t.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",t.ASSET_LIST_LOAD_ERROR="assetListLoadError",t.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",t.ASSET_LIST_PARSING_ERROR="assetListParsingError",t.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",t.INTERNAL_EXCEPTION="internalException",t.INTERNAL_ABORTED="aborted",t.ATTACH_MEDIA_ERROR="attachMediaError",t.UNKNOWN="unknown",t}({}),ue=function(t){return t.MEDIA_ATTACHING="hlsMediaAttaching",t.MEDIA_ATTACHED="hlsMediaAttached",t.MEDIA_DETACHING="hlsMediaDetaching",t.MEDIA_DETACHED="hlsMediaDetached",t.MEDIA_ENDED="hlsMediaEnded",t.STALL_RESOLVED="hlsStallResolved",t.BUFFER_RESET="hlsBufferReset",t.BUFFER_CODECS="hlsBufferCodecs",t.BUFFER_CREATED="hlsBufferCreated",t.BUFFER_APPENDING="hlsBufferAppending",t.BUFFER_APPENDED="hlsBufferAppended",t.BUFFER_EOS="hlsBufferEos",t.BUFFERED_TO_END="hlsBufferedToEnd",t.BUFFER_FLUSHING="hlsBufferFlushing",t.BUFFER_FLUSHED="hlsBufferFlushed",t.MANIFEST_LOADING="hlsManifestLoading",t.MANIFEST_LOADED="hlsManifestLoaded",t.MANIFEST_PARSED="hlsManifestParsed",t.LEVEL_SWITCHING="hlsLevelSwitching",t.LEVEL_SWITCHED="hlsLevelSwitched",t.LEVEL_LOADING="hlsLevelLoading",t.LEVEL_LOADED="hlsLevelLoaded",t.LEVEL_UPDATED="hlsLevelUpdated",t.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",t.LEVELS_UPDATED="hlsLevelsUpdated",t.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",t.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",t.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",t.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",t.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",t.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",t.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",t.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",t.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",t.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",t.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",t.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",t.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",t.CUES_PARSED="hlsCuesParsed",t.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",t.INIT_PTS_FOUND="hlsInitPtsFound",t.FRAG_LOADING="hlsFragLoading",t.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",t.FRAG_LOADED="hlsFragLoaded",t.FRAG_DECRYPTED="hlsFragDecrypted",t.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",t.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",t.FRAG_PARSING_METADATA="hlsFragParsingMetadata",t.FRAG_PARSED="hlsFragParsed",t.FRAG_BUFFERED="hlsFragBuffered",t.FRAG_CHANGED="hlsFragChanged",t.FPS_DROP="hlsFpsDrop",t.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",t.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",t.ERROR="hlsError",t.DESTROYING="hlsDestroying",t.KEY_LOADING="hlsKeyLoading",t.KEY_LOADED="hlsKeyLoaded",t.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",t.BACK_BUFFER_REACHED="hlsBackBufferReached",t.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",t.ASSET_LIST_LOADING="hlsAssetListLoading",t.ASSET_LIST_LOADED="hlsAssetListLoaded",t.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",t.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",t.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",t.INTERSTITIAL_STARTED="hlsInterstitialStarted",t.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",t.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",t.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",t.INTERSTITIAL_ENDED="hlsInterstitialEnded",t.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",t.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",t.EVENT_CUE_ENTER="hlsEventCueEnter",t}({});var Us={MANIFEST:"manifest",LEVEL:"level",AUDIO_TRACK:"audioTrack",SUBTITLE_TRACK:"subtitleTrack"},Yn={MAIN:"main",AUDIO:"audio",SUBTITLE:"subtitle"};let mT=class{constructor(e,n=0,r=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=n,this.totalWeight_=r}sample(e,n){const r=Math.pow(this.alpha_,e);this.estimate_=n*(1-r)+r*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}},Kzn=class{constructor(e,n,r,s=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=r,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new mT(e),this.fast_=new mT(n),this.defaultTTFB_=s,this.ttfb_=new mT(e)}update(e,n){const{slow_:r,fast_:s,ttfb_:i}=this;r.halfLife!==e&&(this.slow_=new mT(e,r.getEstimate(),r.getTotalWeight())),s.halfLife!==n&&(this.fast_=new mT(n,s.getEstimate(),s.getTotalWeight())),i.halfLife!==e&&(this.ttfb_=new mT(e,i.getEstimate(),i.getTotalWeight()))}sample(e,n){e=Math.max(e,this.minDelayMs_);const r=8*n,s=e/1e3,i=r/s;this.fast_.sample(s,i),this.slow_.sample(s,i)}sampleTTFB(e){const n=e/1e3,r=Math.sqrt(2)*Math.exp(-Math.pow(n,2)/2);this.ttfb_.sample(r,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}};function Yzn(t,e,n){return(e=Zzn(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ra(){return ra=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},ra.apply(null,arguments)}function kBe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Bi(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?kBe(Object(n),!0).forEach(function(r){Yzn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):kBe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Qzn(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Zzn(t){var e=Qzn(t,"string");return typeof e=="symbol"?e:e+""}let tp=class{constructor(e,n){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const r=`[${e}]:`;this.trace=Zw,this.debug=n.debug.bind(null,r),this.log=n.log.bind(null,r),this.warn=n.warn.bind(null,r),this.info=n.info.bind(null,r),this.error=n.error.bind(null,r)}};const Zw=function(){},Jzn={trace:Zw,debug:Zw,log:Zw,warn:Zw,info:Zw,error:Zw};function Tbe(){return ra({},Jzn)}function Xzn(t,e){const n=self.console[t];return n?n.bind(self.console,`${e?"["+e+"] ":""}[${t}] >`):Zw}function SBe(t,e,n){return e[t]?e[t].bind(e):Xzn(t,n)}const _be=Tbe();function eVn(t,e,n){const r=Tbe();if(typeof console=="object"&&t===!0||typeof t=="object"){const s=["debug","log","info","warn","error"];s.forEach(i=>{r[i]=SBe(i,t,n)});try{r.log(`Debug logs enabled for "${e}" in hls.js version 1.6.16`)}catch{return Tbe()}s.forEach(i=>{_be[i]=SBe(i,t)})}else ra(_be,r);return r}const Ui=_be;function Ok(t=!0){return typeof self>"u"?void 0:(t||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function tVn(t){return typeof self<"u"&&t===self.ManagedMediaSource}function Jxt(t,e){const n=Object.keys(t),r=Object.keys(e),s=n.length,i=r.length;return!s||!i||s===i&&!n.some(o=>r.indexOf(o)===-1)}function km(t,e=!1){if(typeof TextDecoder<"u"){const d=new TextDecoder("utf-8").decode(t);if(e){const u=d.indexOf("\0");return u!==-1?d.substring(0,u):d}return d.replace(/\0/g,"")}const n=t.length;let r,s,i,o="",l=0;for(;l<n;){if(r=t[l++],r===0&&e)return o;if(r===0||r===3)continue;switch(r>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:o+=String.fromCharCode(r);break;case 12:case 13:s=t[l++],o+=String.fromCharCode((r&31)<<6|s&63);break;case 14:s=t[l++],i=t[l++],o+=String.fromCharCode((r&15)<<12|(s&63)<<6|(i&63)<<0);break}}return o}function cd(t){let e="";for(let n=0;n<t.length;n++){let r=t[n].toString(16);r.length<2&&(r="0"+r),e+=r}return e}function Xxt(t){return Uint8Array.from(t.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function nVn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var $ce={exports:{}},CBe;function rVn(){return CBe||(CBe=1,function(t,e){(function(n){var r=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,l={buildAbsoluteURL:function(c,d,u){if(u=u||{},c=c.trim(),d=d.trim(),!d){if(!u.alwaysNormalize)return c;var h=l.parseURL(c);if(!h)throw new Error("Error trying to parse base URL.");return h.path=l.normalizePath(h.path),l.buildURLFromParts(h)}var m=l.parseURL(d);if(!m)throw new Error("Error trying to parse relative URL.");if(m.scheme)return u.alwaysNormalize?(m.path=l.normalizePath(m.path),l.buildURLFromParts(m)):d;var f=l.parseURL(c);if(!f)throw new Error("Error trying to parse base URL.");if(!f.netLoc&&f.path&&f.path[0]!=="/"){var p=s.exec(f.path);f.netLoc=p[1],f.path=p[2]}f.netLoc&&!f.path&&(f.path="/");var g={scheme:f.scheme,netLoc:m.netLoc,path:null,params:m.params,query:m.query,fragment:m.fragment};if(!m.netLoc&&(g.netLoc=f.netLoc,m.path[0]!=="/"))if(!m.path)g.path=f.path,m.params||(g.params=f.params,m.query||(g.query=f.query));else{var v=f.path,b=v.substring(0,v.lastIndexOf("/")+1)+m.path;g.path=l.normalizePath(b)}return g.path===null&&(g.path=u.alwaysNormalize?l.normalizePath(m.path):m.path),l.buildURLFromParts(g)},parseURL:function(c){var d=r.exec(c);return d?{scheme:d[1]||"",netLoc:d[2]||"",path:d[3]||"",params:d[4]||"",query:d[5]||"",fragment:d[6]||""}:null},normalizePath:function(c){for(c=c.split("").reverse().join("").replace(i,"");c.length!==(c=c.replace(o,"")).length;);return c.split("").reverse().join("")},buildURLFromParts:function(c){return c.scheme+c.netLoc+c.path+c.params+c.query+c.fragment}};t.exports=l})()}($ce)),$ce.exports}var iTe=rVn();let aTe=class{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}};var pa={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};let e0t=class{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e=="string"&&(e={url:e}),this.base=e,iVn(this,"stats")}setByteRange(e,n){const r=e.split("@",2);let s;r.length===1?s=(n==null?void 0:n.byteRangeEndOffset)||0:s=parseInt(r[1]),this._byteRange=[s,parseInt(r[0])+s]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[pa.AUDIO]:null,[pa.VIDEO]:null,[pa.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new aTe),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.baseurl&&this.relurl&&(this._url=iTe.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[pa.AUDIO]=null,e[pa.VIDEO]=null,e[pa.AUDIOVIDEO]=null}};function xl(t){return t.sn!=="initSegment"}let Oce=class extends e0t{constructor(e,n){super(n),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange.length){const e=this.byteRange[0],n=this.byteRange[1];if($n(e)&&$n(n))return n-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;const{levelkeys:n}=this;if(!n||n.NONE)return null;if(n.identity)this._decryptdata||(this._decryptdata=n.identity.getDecryptData(this.sn));else if(!((e=this._decryptdata)!=null&&e.keyId)){const r=Object.keys(n);if(r.length===1){const s=this._decryptdata=n[r[0]]||null;s&&(this._decryptdata=s.getDecryptData(this.sn,n))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=$n(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var n;const r=Object.keys(this.levelkeys),s=r.length;if(s>1||s===1&&(n=this.levelkeys[r[0]])!=null&&n.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!$n(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return xl(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){const n=this.levelkeys;if(n){var r;const s=n[e];s&&!((r=this._decryptdata)!=null&&r.keyId)&&(this._decryptdata=s.getDecryptData(this.sn,n))}}abortRequests(){var e,n;(e=this.loader)==null||e.abort(),(n=this.keyLoader)==null||n.abort()}setElementaryStreamInfo(e,n,r,s,i,o=!1){const{elementaryStreams:l}=this,c=l[e];if(!c){l[e]={startPTS:n,endPTS:r,startDTS:s,endDTS:i,partial:o};return}c.startPTS=Math.min(c.startPTS,n),c.endPTS=Math.max(c.endPTS,r),c.startDTS=Math.min(c.startDTS,s),c.endDTS=Math.max(c.endDTS,i)}},sVn=class extends e0t{constructor(e,n,r,s,i){super(r),this.fragOffset=0,this.duration=0,this.gap=!1,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=n,this.index=s;const o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,i),i&&(this.fragOffset=i.fragOffset+i.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo)}};function t0t(t,e){const n=Object.getPrototypeOf(t);if(n){const r=Object.getOwnPropertyDescriptor(n,e);return r||t0t(n,e)}}function iVn(t,e){const n=t0t(t,e);n&&(n.enumerable=!0,Object.defineProperty(t,e,n))}const jBe=Math.pow(2,32)-1,aVn=[].push,n0t={video:1,audio:2,id3:3,text:4};function cc(t){return String.fromCharCode.apply(null,t)}function r0t(t,e){const n=t[e]<<8|t[e+1];return n<0?65536+n:n}function ls(t,e){const n=s0t(t,e);return n<0?4294967296+n:n}function EBe(t,e){let n=ls(t,e);return n*=Math.pow(2,32),n+=ls(t,e+4),n}function s0t(t,e){return t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function oVn(t){const e=t.byteLength;for(let n=0;n<e;){const r=ls(t,n);if(r>8&&t[n+4]===109&&t[n+5]===111&&t[n+6]===111&&t[n+7]===102)return!0;n=r>1?n+r:e}return!1}function Ds(t,e){const n=[];if(!e.length)return n;const r=t.byteLength;for(let s=0;s<r;){const i=ls(t,s),o=cc(t.subarray(s+4,s+8)),l=i>1?s+i:r;if(o===e[0])if(e.length===1)n.push(t.subarray(s+8,l));else{const c=Ds(t.subarray(s+8,l),e.slice(1));c.length&&aVn.apply(n,c)}s=l}return n}function lVn(t){const e=[],n=t[0];let r=8;const s=ls(t,r);r+=4;let i=0,o=0;n===0?(i=ls(t,r),o=ls(t,r+4),r+=8):(i=EBe(t,r),o=EBe(t,r+8),r+=16),r+=2;let l=t.length+o;const c=r0t(t,r);r+=2;for(let d=0;d<c;d++){let u=r;const h=ls(t,u);u+=4;const m=h&2147483647;if((h&2147483648)>>>31===1)return Ui.warn("SIDX has hierarchical references (not supported)"),null;const p=ls(t,u);u+=4,e.push({referenceSize:m,subsegmentDuration:p,info:{duration:p/s,start:l,end:l+m-1}}),l+=m,u+=4,r=u}return{earliestPresentationTime:i,timescale:s,version:n,referencesCount:c,references:e}}function i0t(t){const e=[],n=Ds(t,["moov","trak"]);for(let s=0;s<n.length;s++){const i=n[s],o=Ds(i,["tkhd"])[0];if(o){let l=o[0];const c=ls(o,l===0?12:20),d=Ds(i,["mdia","mdhd"])[0];if(d){l=d[0];const u=ls(d,l===0?12:20),h=Ds(i,["mdia","hdlr"])[0];if(h){const m=cc(h.subarray(8,12)),f={soun:pa.AUDIO,vide:pa.VIDEO}[m],p=Ds(i,["mdia","minf","stbl","stsd"])[0],g=cVn(p);f?(e[c]={timescale:u,type:f,stsd:g},e[f]=Bi({timescale:u,id:c},g)):e[c]={timescale:u,type:m,stsd:g}}}}}return Ds(t,["moov","mvex","trex"]).forEach(s=>{const i=ls(s,4),o=e[i];o&&(o.default={duration:ls(s,12),flags:ls(s,20)})}),e}function cVn(t){const e=t.subarray(8),n=e.subarray(86),r=cc(e.subarray(4,8));let s=r,i;const o=r==="enca"||r==="encv";if(o){const d=Ds(e,[r])[0].subarray(r==="enca"?28:78);Ds(d,["sinf"]).forEach(h=>{const m=Ds(h,["schm"])[0];if(m){const f=cc(m.subarray(4,8));if(f==="cbcs"||f==="cenc"){const p=Ds(h,["frma"])[0];p&&(s=cc(p))}}})}const l=s;switch(s){case"avc1":case"avc2":case"avc3":case"avc4":{const c=Ds(n,["avcC"])[0];c&&c.length>3&&(s+="."+Kz(c[1])+Kz(c[2])+Kz(c[3]),i=qz(l==="avc1"?"dva1":"dvav",n));break}case"mp4a":{const c=Ds(e,[r])[0],d=Ds(c.subarray(28),["esds"])[0];if(d&&d.length>7){let u=4;if(d[u++]!==3)break;u=Fce(d,u),u+=2;const h=d[u++];if(h&128&&(u+=2),h&64&&(u+=d[u++]),d[u++]!==4)break;u=Fce(d,u);const m=d[u++];if(m===64)s+="."+Kz(m);else break;if(u+=12,d[u++]!==5)break;u=Fce(d,u);const f=d[u++];let p=(f&248)>>3;p===31&&(p+=1+((f&7)<<3)+((d[u]&224)>>5)),s+="."+p}break}case"hvc1":case"hev1":{const c=Ds(n,["hvcC"])[0];if(c&&c.length>12){const d=c[1],u=["","A","B","C"][d>>6],h=d&31,m=ls(c,2),f=(d&32)>>5?"H":"L",p=c[12],g=c.subarray(6,12);s+="."+u+h,s+="."+dVn(m).toString(16).toUpperCase(),s+="."+f+p;let v="";for(let b=g.length;b--;){const x=g[b];(x||v)&&(v="."+x.toString(16).toUpperCase()+v)}s+=v}i=qz(l=="hev1"?"dvhe":"dvh1",n);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{s=qz(s,n)||s;break}case"vp09":{const c=Ds(n,["vpcC"])[0];if(c&&c.length>6){const d=c[4],u=c[5],h=c[6]>>4&15;s+="."+Pv(d)+"."+Pv(u)+"."+Pv(h)}break}case"av01":{const c=Ds(n,["av1C"])[0];if(c&&c.length>2){const d=c[1]>>>5,u=c[1]&31,h=c[2]>>>7?"H":"M",m=(c[2]&64)>>6,f=(c[2]&32)>>5,p=d===2&&m?f?12:10:m?10:8,g=(c[2]&16)>>4,v=(c[2]&8)>>3,b=(c[2]&4)>>2,x=c[2]&3;s+="."+d+"."+Pv(u)+h+"."+Pv(p)+"."+g+"."+v+b+x+"."+Pv(1)+"."+Pv(1)+"."+Pv(1)+"."+0,i=qz("dav1",n)}break}}return{codec:s,encrypted:o,supplemental:i}}function qz(t,e){const n=Ds(e,["dvvC"]),r=n.length?n[0]:Ds(e,["dvcC"])[0];if(r){const s=r[2]>>1&127,i=r[2]<<5&32|r[3]>>3&31;return t+"."+Pv(s)+"."+Pv(i)}}function dVn(t){let e=0;for(let n=0;n<32;n++)e|=(t>>n&1)<<31-n;return e>>>0}function Fce(t,e){const n=e+5;for(;t[e++]&128&&e<n;);return e}function Kz(t){return("0"+t.toString(16).toUpperCase()).slice(-2)}function Pv(t){return(t<10?"0":"")+t}function uVn(t,e){if(!t||!e)return;const n=e.keyId;n&&e.isCommonEncryption&&a0t(t,(r,s)=>{const i=r.subarray(8,24);i.some(o=>o!==0)||(Ui.log(`[eme] Patching keyId in 'enc${s?"a":"v"}>sinf>>tenc' box: ${cd(i)} -> ${cd(n)}`),r.set(n,8))})}function hVn(t){const e=[];return a0t(t,n=>e.push(n.subarray(8,24))),e}function a0t(t,e){Ds(t,["moov","trak"]).forEach(r=>{const s=Ds(r,["mdia","minf","stbl","stsd"])[0];if(!s)return;const i=s.subarray(8);let o=Ds(i,["enca"]);const l=o.length>0;l||(o=Ds(i,["encv"])),o.forEach(c=>{const d=l?c.subarray(28):c.subarray(78);Ds(d,["sinf"]).forEach(h=>{const m=o0t(h);m&&e(m,l)})})})}function o0t(t){const e=Ds(t,["schm"])[0];if(e){const n=cc(e.subarray(4,8));if(n==="cbcs"||n==="cenc"){const r=Ds(t,["schi","tenc"])[0];if(r)return r}}}function mVn(t,e,n){const r={},s=Ds(t,["moof","traf"]);for(let i=0;i<s.length;i++){const o=s[i],l=Ds(o,["tfhd"])[0],c=ls(l,4),d=e[c];if(!d)continue;r[c]||(r[c]={start:NaN,duration:0,sampleCount:0,timescale:d.timescale,type:d.type});const u=r[c],h=Ds(o,["tfdt"])[0];if(h){const w=h[0];let k=ls(h,4);w===1&&(k===jBe?n.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(k*=jBe+1,k+=ls(h,8))),$n(k)&&(!$n(u.start)||k<u.start)&&(u.start=k)}const m=d.default,f=ls(l,0)|(m==null?void 0:m.flags);let p=(m==null?void 0:m.duration)||0;f&8&&(f&2?p=ls(l,12):p=ls(l,8));const g=Ds(o,["trun"]);let v=u.start||0,b=0,x=p;for(let w=0;w<g.length;w++){const k=g[w],S=ls(k,4),C=u.sampleCount;u.sampleCount+=S;const j=k[3]&1,E=k[3]&4,N=k[2]&1,A=k[2]&2,_=k[2]&4,T=k[2]&8;let R=8,O=S;for(j&&(R+=4),E&&S&&(!(k[R+1]&1)&&u.keyFrameIndex===void 0&&(u.keyFrameIndex=C),R+=4,N?(x=ls(k,R),R+=4):x=p,A&&(R+=4),T&&(R+=4),v+=x,b+=x,O--);O--;)N?(x=ls(k,R),R+=4):x=p,A&&(R+=4),_&&(k[R+1]&1||u.keyFrameIndex===void 0&&(u.keyFrameIndex=u.sampleCount-(O+1),u.keyFrameStart=v),R+=4),T&&(R+=4),v+=x,b+=x;!b&&p&&(b+=p*S)}u.duration+=b}if(!Object.keys(r).some(i=>r[i].duration)){let i=0;const o=Ds(t,["sidx"]);for(let l=0;l<o.length;l++){const c=lVn(o[l]);if(c!=null&&c.references){const d=c.references.reduce((u,h)=>u+h.info.duration||0,0);i=Math.max(i,d+c.earliestPresentationTime/c.timescale)}}i&&$n(i)&&Object.keys(r).forEach(l=>{r[l].duration||(r[l].duration=i*r[l].timescale-r[l].start)})}return r}function fVn(t){const e={valid:null,remainder:null},n=Ds(t,["moof"]);if(n.length<2)return e.remainder=t,e;const r=n[n.length-1];return e.valid=t.slice(0,r.byteOffset-8),e.remainder=t.slice(r.byteOffset-8),e}function Gf(t,e){const n=new Uint8Array(t.length+e.length);return n.set(t),n.set(e,t.length),n}function NBe(t,e){const n=[],r=e.samples,s=e.timescale,i=e.id;let o=!1;return Ds(r,["moof"]).map(c=>{const d=c.byteOffset-8;Ds(c,["traf"]).map(h=>{const m=Ds(h,["tfdt"]).map(f=>{const p=f[0];let g=ls(f,4);return p===1&&(g*=Math.pow(2,32),g+=ls(f,8)),g/s})[0];return m!==void 0&&(t=m),Ds(h,["tfhd"]).map(f=>{const p=ls(f,4),g=ls(f,0)&16777215,v=(g&1)!==0,b=(g&2)!==0,x=(g&8)!==0;let w=0;const k=(g&16)!==0;let S=0;const C=(g&32)!==0;let j=8;p===i&&(v&&(j+=8),b&&(j+=4),x&&(w=ls(f,j),j+=4),k&&(S=ls(f,j),j+=4),C&&(j+=4),e.type==="video"&&(o=pre(e.codec)),Ds(h,["trun"]).map(E=>{const N=E[0],A=ls(E,0)&16777215,_=(A&1)!==0;let T=0;const R=(A&4)!==0,O=(A&256)!==0;let F=0;const D=(A&512)!==0;let I=0;const P=(A&1024)!==0,M=(A&2048)!==0;let z=0;const G=ls(E,4);let B=8;_&&(T=ls(E,B),B+=4),R&&(B+=4);let H=T+d;for(let W=0;W<G;W++){if(O?(F=ls(E,B),B+=4):F=w,D?(I=ls(E,B),B+=4):I=S,P&&(B+=4),M&&(N===0?z=ls(E,B):z=s0t(E,B),B+=4),e.type===pa.VIDEO){let V=0;for(;V<I;){const U=ls(r,H);if(H+=4,pVn(o,r[H])){const ne=r.subarray(H,H+U);oTe(ne,o?2:1,t+z/s,n)}H+=U,V+=U+4}}t+=F/s}}))})})}),n}function pre(t){if(!t)return!1;const e=t.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function pVn(t,e){if(t){const n=e>>1&63;return n===39||n===40}else return(e&31)===6}function oTe(t,e,n,r){const s=l0t(t);let i=0;i+=e;let o=0,l=0,c=0;for(;i<s.length;){o=0;do{if(i>=s.length)break;c=s[i++],o+=c}while(c===255);l=0;do{if(i>=s.length)break;c=s[i++],l+=c}while(c===255);const d=s.length-i;let u=i;if(l<d)i+=l;else if(l>d){Ui.error(`Malformed SEI payload. ${l} is too small, only ${d} bytes left to parse.`);break}if(o===4){if(s[u++]===181){const m=r0t(s,u);if(u+=2,m===49){const f=ls(s,u);if(u+=4,f===1195456820){const p=s[u++];if(p===3){const g=s[u++],v=31&g,b=64&g,x=b?2+v*3:0,w=new Uint8Array(x);if(b){w[0]=g;for(let k=1;k<x;k++)w[k]=s[u++]}r.push({type:p,payloadType:o,pts:n,bytes:w})}}}}}else if(o===5&&l>16){const h=[];for(let p=0;p<16;p++){const g=s[u++].toString(16);h.push(g.length==1?"0"+g:g),(p===3||p===5||p===7||p===9)&&h.push("-")}const m=l-16,f=new Uint8Array(m);for(let p=0;p<m;p++)f[p]=s[u++];r.push({payloadType:o,pts:n,uuid:h.join(""),userData:km(f),userDataBytes:f})}}}function l0t(t){const e=t.byteLength,n=[];let r=1;for(;r<e-2;)t[r]===0&&t[r+1]===0&&t[r+2]===3?(n.push(r+2),r+=2):r++;if(n.length===0)return t;const s=e-n.length,i=new Uint8Array(s);let o=0;for(r=0;r<s;o++,r++)o===n[0]&&(o++,n.shift()),i[r]=t[o];return i}function gVn(t){const e=t[0];let n="",r="",s=0,i=0,o=0,l=0,c=0,d=0;if(e===0){for(;cc(t.subarray(d,d+1))!=="\0";)n+=cc(t.subarray(d,d+1)),d+=1;for(n+=cc(t.subarray(d,d+1)),d+=1;cc(t.subarray(d,d+1))!=="\0";)r+=cc(t.subarray(d,d+1)),d+=1;r+=cc(t.subarray(d,d+1)),d+=1,s=ls(t,12),i=ls(t,16),l=ls(t,20),c=ls(t,24),d=28}else if(e===1){d+=4,s=ls(t,d),d+=4;const h=ls(t,d);d+=4;const m=ls(t,d);for(d+=4,o=2**32*h+m,Wzn(o)||(o=Number.MAX_SAFE_INTEGER,Ui.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),l=ls(t,d),d+=4,c=ls(t,d),d+=4;cc(t.subarray(d,d+1))!=="\0";)n+=cc(t.subarray(d,d+1)),d+=1;for(n+=cc(t.subarray(d,d+1)),d+=1;cc(t.subarray(d,d+1))!=="\0";)r+=cc(t.subarray(d,d+1)),d+=1;r+=cc(t.subarray(d,d+1)),d+=1}const u=t.subarray(d,t.byteLength);return{schemeIdUri:n,value:r,timeScale:s,presentationTime:o,presentationTimeDelta:i,eventDuration:l,id:c,payload:u}}function vVn(t,...e){const n=e.length;let r=8,s=n;for(;s--;)r+=e[s].byteLength;const i=new Uint8Array(r);for(i[0]=r>>24&255,i[1]=r>>16&255,i[2]=r>>8&255,i[3]=r&255,i.set(t,4),s=0,r=8;s<n;s++)i.set(e[s],r),r+=e[s].byteLength;return i}function yVn(t,e,n){if(t.byteLength!==16)throw new RangeError("Invalid system id");let r,s;r=0,s=new Uint8Array;let i;r>0?(i=new Uint8Array(4),e.length>0&&new DataView(i.buffer).setUint32(0,e.length,!1)):i=new Uint8Array;const o=new Uint8Array(4);return n.byteLength>0&&new DataView(o.buffer).setUint32(0,n.byteLength,!1),vVn([112,115,115,104],new Uint8Array([r,0,0,0]),t,i,s,o,n)}function bVn(t){const e=[];if(t instanceof ArrayBuffer){const n=t.byteLength;let r=0;for(;r+32<n;){const s=new DataView(t,r),i=xVn(s);e.push(i),r+=i.size}}return e}function xVn(t){const e=t.getUint32(0),n=t.byteOffset,r=t.byteLength;if(r<e)return{offset:n,size:r};if(t.getUint32(4)!==1886614376)return{offset:n,size:e};const i=t.getUint32(8)>>>24;if(i!==0&&i!==1)return{offset:n,size:e};const o=t.buffer,l=cd(new Uint8Array(o,n+12,16));let c=null,d=null,u=0;if(i===0)u=28;else{const m=t.getUint32(28);if(!m||r<32+m*16)return{offset:n,size:e};c=[];for(let f=0;f<m;f++)c.push(new Uint8Array(o,n+32+f*16,16));u=32+m*16}if(!u)return{offset:n,size:e};const h=t.getUint32(u);return e-32<h?{offset:n,size:e}:(d=new Uint8Array(o,n+u+4,h),{version:i,systemId:l,kids:c,data:d,offset:n,size:e})}const c0t=()=>/\(Windows.+Firefox\//i.test(navigator.userAgent),DR={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1}};function lTe(t,e){const n=DR[e];return!!n&&!!n[t.slice(0,4)]}function E6(t,e,n=!0){return!t.split(",").some(r=>!cTe(r,e,n))}function cTe(t,e,n=!0){var r;const s=Ok(n);return(r=s==null?void 0:s.isTypeSupported(N6(t,e)))!=null?r:!1}function N6(t,e){return`${e}/mp4;codecs=${t}`}function TBe(t){if(t){const e=t.substring(0,4);return DR.video[e]}return 2}function OQ(t){const e=c0t();return t.split(",").reduce((n,r)=>{const i=e&&pre(r)?9:DR.video[r];return i?(i*2+n)/(n?3:2):(DR.audio[r]+n)/(n?2:1)},0)}const Bce={};function wVn(t,e=!0){if(Bce[t])return Bce[t];const n={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[t];for(let s=0;s<n.length;s++){var r;if(cTe(n[s],"audio",e))return Bce[t]=n[s],n[s];if(n[s]==="mp3"&&(r=Ok(e))!=null&&r.isTypeSupported("audio/mpeg"))return""}return t}const kVn=/flac|opus|mp4a\.40\.34/i;function FQ(t,e=!0){return t.replace(kVn,n=>wVn(n.toLowerCase(),e))}function SVn(t,e){const n=[];if(t){const r=t.split(",");for(let s=0;s<r.length;s++)lTe(r[s],"video")||n.push(r[s])}return e&&n.push(e),n.join(",")}function BW(t,e){if(t&&(t.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(t)!==-1)&&(_Be(t,"audio")||_Be(t,"video")))return t;if(e){const n=e.split(",");if(n.length>1){if(t){for(let r=n.length;r--;)if(n[r].substring(0,4)===t.substring(0,4))return n[r]}return n[0]}}return e||t}function _Be(t,e){return lTe(t,e)&&cTe(t,e)}function CVn(t){const e=t.split(",");for(let n=0;n<e.length;n++){const r=e[n].split(".");r.length>2&&r[0]==="avc1"&&(e[n]=`avc1.${parseInt(r[1]).toString(16)}${("000"+parseInt(r[2]).toString(16)).slice(-4)}`)}return e.join(",")}function jVn(t){if(t.startsWith("av01.")){const e=t.split("."),n=["0","111","01","01","01","0"];for(let r=e.length;r>4&&r<10;r++)e[r]=n[r-4];return e.join(".")}return t}function ABe(t){const e=Ok(t)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function Abe(t){return t.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const EVn={supported:!0,powerEfficient:!0,smooth:!0},NVn={supported:!1,smooth:!1,powerEfficient:!1},d0t={supported:!0,configurations:[],decodingInfoResults:[EVn]};function u0t(t,e){return{supported:!1,configurations:e,decodingInfoResults:[NVn],error:t}}function TVn(t,e,n,r,s,i){const o=t.videoCodec,l=t.audioCodec?t.audioGroups:null,c=i==null?void 0:i.audioCodec,d=i==null?void 0:i.channels,u=d?parseInt(d):c?1/0:2;let h=null;if(l!=null&&l.length)try{l.length===1&&l[0]?h=e.groups[l[0]].channels:h=l.reduce((m,f)=>{if(f){const p=e.groups[f];if(!p)throw new Error(`Audio track group ${f} not found`);Object.keys(p.channels).forEach(g=>{m[g]=(m[g]||0)+p.channels[g]})}return m},{2:0})}catch{return!0}return o!==void 0&&(o.split(",").some(m=>pre(m))||t.width>1920&&t.height>1088||t.height>1920&&t.width>1088||t.frameRate>Math.max(r,30)||t.videoRange!=="SDR"&&t.videoRange!==n||t.bitrate>Math.max(s,8e6))||!!h&&$n(u)&&Object.keys(h).some(m=>parseInt(m)>u)}function h0t(t,e,n,r={}){const s=t.videoCodec;if(!s&&!t.audioCodec||!n)return Promise.resolve(d0t);const i=[],o=_Vn(t),l=o.length,c=AVn(t,e,l>0),d=c.length;for(let u=l||1*d||1;u--;){const h={type:"media-source"};if(l&&(h.video=o[u%l]),d){h.audio=c[u%d];const m=h.audio.bitrate;h.video&&m&&(h.video.bitrate-=m)}i.push(h)}if(s){const u=navigator.userAgent;if(s.split(",").some(h=>pre(h))&&c0t())return Promise.resolve(u0t(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${u})`),i))}return Promise.all(i.map(u=>{const h=RVn(u);return r[h]||(r[h]=n.decodingInfo(u))})).then(u=>({supported:!u.some(h=>!h.supported),configurations:i,decodingInfoResults:u})).catch(u=>({supported:!1,configurations:i,decodingInfoResults:[],error:u}))}function _Vn(t){var e;const n=(e=t.videoCodec)==null?void 0:e.split(","),r=m0t(t),s=t.width||640,i=t.height||480,o=t.frameRate||30,l=t.videoRange.toLowerCase();return n?n.map(c=>{const d={contentType:N6(jVn(c),"video"),width:s,height:i,bitrate:r,framerate:o};return l!=="sdr"&&(d.transferFunction=l),d}):[]}function AVn(t,e,n){var r;const s=(r=t.audioCodec)==null?void 0:r.split(","),i=m0t(t);return s&&t.audioGroups?t.audioGroups.reduce((o,l)=>{var c;const d=l?(c=e.groups[l])==null?void 0:c.tracks:null;return d?d.reduce((u,h)=>{if(h.groupId===l){const m=parseFloat(h.channels||"");s.forEach(f=>{const p={contentType:N6(f,"audio"),bitrate:n?PVn(f,i):i};m&&(p.channels=""+m),u.push(p)})}return u},o):o},[]):[]}function PVn(t,e){if(e<=1)return 1;let n=128e3;return t==="ec-3"?n=768e3:t==="ac-3"&&(n=64e4),Math.min(e/2,n)}function m0t(t){return Math.ceil(Math.max(t.bitrate*.9,t.averageBitrate)/1e3)*1e3||1}function RVn(t){let e="";const{audio:n,video:r}=t;if(r){const s=Abe(r.contentType);e+=`${s}_r${r.height}x${r.width}f${Math.ceil(r.framerate)}${r.transferFunction||"sd"}_${Math.ceil(r.bitrate/1e5)}`}if(n){const s=Abe(n.contentType);e+=`${r?"_":""}${s}_c${n.channels}`}return e}const Pbe=["NONE","TYPE-0","TYPE-1",null];function IVn(t){return Pbe.indexOf(t)>-1}const BQ=["SDR","PQ","HLG"];function MVn(t){return!!t&&BQ.indexOf(t)>-1}var UW={No:"",Yes:"YES",v2:"v2"};function PBe(t){const{canSkipUntil:e,canSkipDateRanges:n,age:r}=t,s=r<e/2;return e&&s?n?UW.v2:UW.Yes:UW.No}let RBe=class{constructor(e,n,r){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=n,this.skip=r}addDirectives(e){const n=new self.URL(e);return this.msn!==void 0&&n.searchParams.set("_HLS_msn",this.msn.toString()),this.part!==void 0&&n.searchParams.set("_HLS_part",this.part.toString()),this.skip&&n.searchParams.set("_HLS_skip",this.skip),n.href}},T6=class{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,this.codecSet=[e.videoCodec,e.audioCodec].filter(r=>!!r).map(r=>r.substring(0,4)).join(","),"supplemental"in e){var n;this.supplemental=e.supplemental;const r=(n=e.supplemental)==null?void 0:n.videoCodec;r&&r!==e.videoCodec&&(this.codecSet+=`,${r.substring(0,4)}`)}this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES)}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return IBe(this._audioGroups,e)}hasSubtitleGroup(e){return IBe(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,n){if(n){if(e==="audio"){let r=this._audioGroups;r||(r=this._audioGroups=[]),r.indexOf(n)===-1&&r.push(n)}else if(e==="text"){let r=this._subtitleGroups;r||(r=this._subtitleGroups=[]),r.indexOf(n)===-1&&r.push(n)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}};function IBe(t,e){return!e||!t?!1:t.indexOf(e)!==-1}function LVn(){if(typeof matchMedia=="function"){const t=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(t.media!==e.media)return t.matches===!0}return!1}function DVn(t,e){let n=!1,r=[];if(t&&(n=t!=="SDR",r=[t]),e){r=e.allowedVideoRanges||BQ.slice(0);const s=r.join("")!=="SDR"&&!e.videoCodec;n=e.preferHDR!==void 0?e.preferHDR:s&&LVn(),n||(r=["SDR"])}return{preferHDR:n,allowedVideoRanges:r}}const $Vn=t=>{const e=new WeakSet;return(n,r)=>{if(t&&(r=t(n,r)),typeof r=="object"&&r!==null){if(e.has(r))return;e.add(r)}return r}},va=(t,e)=>JSON.stringify(t,$Vn(e));function OVn(t,e,n,r,s){const i=Object.keys(t),o=r==null?void 0:r.channels,l=r==null?void 0:r.audioCodec,c=s==null?void 0:s.videoCodec,d=o&&parseInt(o)===2;let u=!1,h=!1,m=1/0,f=1/0,p=1/0,g=1/0,v=0,b=[];const{preferHDR:x,allowedVideoRanges:w}=DVn(e,s);for(let E=i.length;E--;){const N=t[i[E]];u||(u=N.channels[2]>0),m=Math.min(m,N.minHeight),f=Math.min(f,N.minFramerate),p=Math.min(p,N.minBitrate),w.filter(_=>N.videoRanges[_]>0).length>0&&(h=!0)}m=$n(m)?m:0,f=$n(f)?f:0;const k=Math.max(1080,m),S=Math.max(30,f);p=$n(p)?p:n,n=Math.max(p,n),h||(e=void 0);const C=i.length>1;return{codecSet:i.reduce((E,N)=>{const A=t[N];if(N===E)return E;if(b=h?w.filter(_=>A.videoRanges[_]>0):[],C){if(A.minBitrate>n)return hv(N,`min bitrate of ${A.minBitrate} > current estimate of ${n}`),E;if(!A.hasDefaultAudio)return hv(N,"no renditions with default or auto-select sound found"),E;if(l&&N.indexOf(l.substring(0,4))%5!==0)return hv(N,`audio codec preference "${l}" not found`),E;if(o&&!d){if(!A.channels[o])return hv(N,`no renditions with ${o} channel sound found (channels options: ${Object.keys(A.channels)})`),E}else if((!l||d)&&u&&A.channels[2]===0)return hv(N,"no renditions with stereo sound found"),E;if(A.minHeight>k)return hv(N,`min resolution of ${A.minHeight} > maximum of ${k}`),E;if(A.minFramerate>S)return hv(N,`min framerate of ${A.minFramerate} > maximum of ${S}`),E;if(!b.some(_=>A.videoRanges[_]>0))return hv(N,`no variants with VIDEO-RANGE of ${va(b)} found`),E;if(c&&N.indexOf(c.substring(0,4))%5!==0)return hv(N,`video codec preference "${c}" not found`),E;if(A.maxScore<v)return hv(N,`max score of ${A.maxScore} < selected max of ${v}`),E}return E&&(OQ(N)>=OQ(E)||A.fragmentError>t[E].fragmentError)?E:(g=A.minIndex,v=A.maxScore,N)},void 0),videoRanges:b,preferHDR:x,minFramerate:f,minBitrate:p,minIndex:g}}function hv(t,e){Ui.log(`[abr] start candidates with "${t}" ignored because ${e}`)}function f0t(t){return t.reduce((e,n)=>{let r=e.groups[n.groupId];r||(r=e.groups[n.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),r.tracks.push(n);const s=n.channels||"2";return r.channels[s]=(r.channels[s]||0)+1,r.hasDefault=r.hasDefault||n.default,r.hasAutoSelect=r.hasAutoSelect||n.autoselect,r.hasDefault&&(e.hasDefaultAudio=!0),r.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function FVn(t,e,n,r){return t.slice(n,r+1).reduce((s,i,o)=>{if(!i.codecSet)return s;const l=i.audioGroups;let c=s[i.codecSet];c||(s[i.codecSet]=c={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:o,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!l,fragmentError:0}),c.minBitrate=Math.min(c.minBitrate,i.bitrate);const d=Math.min(i.height,i.width);return c.minHeight=Math.min(c.minHeight,d),c.minFramerate=Math.min(c.minFramerate,i.frameRate),c.minIndex=Math.min(c.minIndex,o),c.maxScore=Math.max(c.maxScore,i.score),c.fragmentError+=i.fragmentError,c.videoRanges[i.videoRange]=(c.videoRanges[i.videoRange]||0)+1,l&&l.forEach(u=>{if(!u)return;const h=e.groups[u];h&&(c.hasDefaultAudio=c.hasDefaultAudio||e.hasDefaultAudio?h.hasDefault:h.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(h.channels).forEach(m=>{c.channels[m]=(c.channels[m]||0)+h.channels[m]}))}),s},{})}function MBe(t){if(!t)return t;const{lang:e,assocLang:n,characteristics:r,channels:s,audioCodec:i}=t;return{lang:e,assocLang:n,characteristics:r,channels:s,audioCodec:i}}function ny(t,e,n){if("attrs"in t){const r=e.indexOf(t);if(r!==-1)return r}for(let r=0;r<e.length;r++){const s=e[r];if(Jj(t,s,n))return r}return-1}function Jj(t,e,n){const{groupId:r,name:s,lang:i,assocLang:o,default:l}=t,c=t.forced;return(r===void 0||e.groupId===r)&&(s===void 0||e.name===s)&&(i===void 0||BVn(i,e.lang))&&(i===void 0||e.assocLang===o)&&(l===void 0||e.default===l)&&(c===void 0||e.forced===c)&&(!("characteristics"in t)||UVn(t.characteristics||"",e.characteristics))&&(n===void 0||n(t,e))}function BVn(t,e="--"){return t.length===e.length?t===e:t.startsWith(e)||e.startsWith(t)}function UVn(t,e=""){const n=t.split(","),r=e.split(",");return n.length===r.length&&!n.some(s=>r.indexOf(s)===-1)}function BC(t,e){const{audioCodec:n,channels:r}=t;return(n===void 0||(e.audioCodec||"").substring(0,4)===n.substring(0,4))&&(r===void 0||r===(e.channels||"2"))}function zVn(t,e,n,r,s){const i=e[r],l=e.reduce((m,f,p)=>{const g=f.uri;return(m[g]||(m[g]=[])).push(p),m},{})[i.uri];l.length>1&&(r=Math.max.apply(Math,l));const c=i.videoRange,d=i.frameRate,u=i.codecSet.substring(0,4),h=LBe(e,r,m=>{if(m.videoRange!==c||m.frameRate!==d||m.codecSet.substring(0,4)!==u)return!1;const f=m.audioGroups,p=n.filter(g=>!f||f.indexOf(g.groupId)!==-1);return ny(t,p,s)>-1});return h>-1?h:LBe(e,r,m=>{const f=m.audioGroups,p=n.filter(g=>!f||f.indexOf(g.groupId)!==-1);return ny(t,p,s)>-1})}function LBe(t,e,n){for(let r=e;r>-1;r--)if(n(t[r]))return r;for(let r=e+1;r<t.length;r++)if(n(t[r]))return r;return-1}function UQ(t,e){var n;return!!t&&t!==((n=e.loadLevelObj)==null?void 0:n.uri)}let VVn=class extends tp{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=n=>{var r;const{fragCurrent:s,partCurrent:i,hls:o}=this,{autoLevelEnabled:l,media:c}=o;if(!s||!c)return;const d=performance.now(),u=i?i.stats:s.stats,h=i?i.duration:s.duration,m=d-u.loading.start,f=o.minAutoLevel,p=s.level,g=this._nextAutoLevel;if(u.aborted||u.loaded&&u.loaded===u.total||p<=f){this.clearTimer(),this._nextAutoLevel=-1;return}if(!l)return;const v=g>-1&&g!==p,b=!!n||v;if(!b&&(c.paused||!c.playbackRate||!c.readyState))return;const x=o.mainForwardBufferInfo;if(!b&&x===null)return;const w=this.bwEstimator.getEstimateTTFB(),k=Math.abs(c.playbackRate);if(m<=Math.max(w,1e3*(h/(k*2))))return;const S=x?x.len/k:0,C=u.loading.first?u.loading.first-u.loading.start:-1,j=u.loaded&&C>-1,E=this.getBwEstimate(),N=o.levels,A=N[p],_=Math.max(u.loaded,Math.round(h*(s.bitrate||A.averageBitrate)/8));let T=j?m-C:m;T<1&&j&&(T=Math.min(m,u.loaded*8/E));const R=j?u.loaded*1e3/T:0,O=w/1e3,F=R?(_-u.loaded)/R:_*8/E+O;if(F<=S)return;const D=R?R*8:E,I=((r=(n==null?void 0:n.details)||this.hls.latestLevelDetails)==null?void 0:r.live)===!0,P=this.hls.config.abrBandWidthUpFactor;let M=Number.POSITIVE_INFINITY,z;for(z=p-1;z>f;z--){const W=N[z].maxBitrate,V=!N[z].details||I;if(M=this.getTimeToLoadFrag(O,D,h*W,V),M<Math.min(S,h+O))break}if(M>=F||M>h*10)return;j?this.bwEstimator.sample(m-Math.min(w,C),u.loaded):this.bwEstimator.sampleTTFB(m);const G=N[z].maxBitrate;this.getBwEstimate()*P>G&&this.resetEstimator(G);const B=this.findBestLevel(G,f,z,0,S,1,1);B>-1&&(z=B),this.warn(`Fragment ${s.sn}${i?" part "+i.index:""} of level ${p} is loading too slowly;
      Fragment duration: ${s.duration.toFixed(3)}
      Time to underbuffer: ${S.toFixed(3)} s
      Estimated load time for current fragment: ${F.toFixed(3)} s
      Estimated load time for down switch fragment: ${M.toFixed(3)} s
      TTFB estimate: ${C|0} ms
      Current BW estimate: ${$n(E)?E|0:"Unknown"} bps
      New BW estimate: ${this.getBwEstimate()|0} bps
      Switching to level ${z} @ ${G|0} bps`),o.nextLoadLevel=o.nextAutoLevel=z,this.clearTimer();const H=()=>{if(this.clearTimer(),this.fragCurrent===s&&this.hls.loadLevel===z&&z>0){const W=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${z>0?"and switching down":""}
      Fragment duration: ${s.duration.toFixed(3)} s
      Time to underbuffer: ${W.toFixed(3)} s`),s.abortRequests(),this.fragCurrent=this.partCurrent=null,z>f){let V=this.findBestLevel(this.hls.levels[f].bitrate,f,z,0,W,1,1);V===-1&&(V=f),this.hls.nextLoadLevel=this.hls.nextAutoLevel=V,this.resetEstimator(this.hls.levels[V].bitrate)}}};v||F>M*2?H():this.timer=self.setInterval(H,M*1e3),o.trigger(ue.FRAG_LOAD_EMERGENCY_ABORTED,{frag:s,part:i,stats:u})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator()}initEstimator(){const e=this.hls.config;return new Kzn(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const{hls:e}=this;e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.FRAG_LOADING,this.onFragLoading,this),e.on(ue.FRAG_LOADED,this.onFragLoaded,this),e.on(ue.FRAG_BUFFERED,this.onFragBuffered,this),e.on(ue.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(ue.LEVEL_LOADED,this.onLevelLoaded,this),e.on(ue.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(ue.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(ue.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.FRAG_LOADING,this.onFragLoading,this),e.off(ue.FRAG_LOADED,this.onFragLoaded,this),e.off(ue.FRAG_BUFFERED,this.onFragBuffered,this),e.off(ue.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(ue.LEVEL_LOADED,this.onLevelLoaded,this),e.off(ue.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(ue.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(ue.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.fragCurrent=this.partCurrent=null}onManifestLoading(e,n){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,n){const r=n.frag;if(!this.ignoreFragment(r)){if(!r.bitrateTest){var s;this.fragCurrent=r,this.partCurrent=(s=n.part)!=null?s:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,n){this.clearTimer()}onError(e,n){if(!n.fatal)switch(n.details){case dt.BUFFER_ADD_CODEC_ERROR:case dt.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case dt.FRAG_LOAD_TIMEOUT:{const r=n.frag,{fragCurrent:s,partCurrent:i}=this;if(r&&s&&r.sn===s.sn&&r.level===s.level){const o=performance.now(),l=i?i.stats:r.stats,c=o-l.loading.start,d=l.loading.first?l.loading.first-l.loading.start:-1;if(l.loaded&&d>-1){const h=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(c-Math.min(h,d),l.loaded)}else this.bwEstimator.sampleTTFB(c)}break}}}getTimeToLoadFrag(e,n,r,s){const i=e+r/n,o=s?e+this.lastLevelLoadSec:0;return i+o}onLevelLoaded(e,n){const r=this.hls.config,{loading:s}=n.stats,i=s.end-s.first;$n(i)&&(this.lastLevelLoadSec=i/1e3),n.details.live?this.bwEstimator.update(r.abrEwmaSlowLive,r.abrEwmaFastLive):this.bwEstimator.update(r.abrEwmaSlowVoD,r.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(n.levelInfo)}onFragLoaded(e,{frag:n,part:r}){const s=r?r.stats:n.stats;if(n.type===Yn.MAIN&&this.bwEstimator.sampleTTFB(s.loading.first-s.loading.start),!this.ignoreFragment(n)){if(this.clearTimer(),n.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,this.hls.config.abrMaxWithRealBitrate){const i=r?r.duration:n.duration,o=this.hls.levels[n.level],l=(o.loaded?o.loaded.bytes:0)+s.loaded,c=(o.loaded?o.loaded.duration:0)+i;o.loaded={bytes:l,duration:c},o.realBitrate=Math.round(8*l/c)}if(n.bitrateTest){const i={stats:s,frag:n,part:r,id:n.type};this.onFragBuffered(ue.FRAG_BUFFERED,i),n.bitrateTest=!1}else this.lastLoadedFragLevel=n.level}}onFragBuffered(e,n){const{frag:r,part:s}=n,i=s!=null&&s.stats.loaded?s.stats:r.stats;if(i.aborted||this.ignoreFragment(r))return;const o=i.parsing.end-i.loading.start-Math.min(i.loading.first-i.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(o,i.loaded),i.bwEstimate=this.getBwEstimate(),r.bitrateTest?this.bitrateTestDelay=o/1e3:this.bitrateTestDelay=0}ignoreFragment(e){return e.type!==Yn.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{maxAutoLevel:e,minAutoLevel:n}=this.hls,r=this.getBwEstimate(),s=this.hls.config.maxStarvationDelay,i=this.findBestLevel(r,n,e,0,s,1,1);if(i>-1)return i;const o=this.hls.firstLevel,l=Math.min(Math.max(o,n),e);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${o} clamped to ${l}`),l}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){const e=this.forcedAutoLevel,r=this.bwEstimator.canEstimate(),s=this.lastLoadedFragLevel>-1;if(e!==-1&&(!r||!s||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const i=r&&s?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const o=this.hls.levels;if(o.length>Math.max(e,i)&&o[e].loadError<=o[i].loadError)return e}return this._nextAutoLevel=i,this.nextAutoLevelKey=this.getAutoLevelKey(),i}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:n,hls:r}=this;if(r.levels.length<=1)return r.loadLevel;const{maxAutoLevel:s,config:i,minAutoLevel:o}=r,l=n?n.duration:e?e.duration:0,c=this.getBwEstimate(),d=this.getStarvationDelay();let u=i.abrBandWidthFactor,h=i.abrBandWidthUpFactor;if(d){const v=this.findBestLevel(c,o,s,d,0,u,h);if(v>=0)return this.rebufferNotice=-1,v}let m=l?Math.min(l,i.maxStarvationDelay):i.maxStarvationDelay;if(!d){const v=this.bitrateTestDelay;v&&(m=(l?Math.min(l,i.maxLoadingDelay):i.maxLoadingDelay)-v,this.info(`bitrate test took ${Math.round(1e3*v)}ms, set first fragment max fetchDuration to ${Math.round(1e3*m)} ms`),u=h=1)}const f=this.findBestLevel(c,o,s,d,m,u,h);if(this.rebufferNotice!==f&&(this.rebufferNotice=f,this.info(`${d?"rebuffering expected":"buffer is empty"}, optimal quality level ${f}`)),f>-1)return f;const p=r.levels[o],g=r.loadLevelObj;return g&&(p==null?void 0:p.bitrate)<g.bitrate?o:r.loadLevel}getStarvationDelay(){const e=this.hls,n=e.media;if(!n)return 1/0;const r=n&&n.playbackRate!==0?Math.abs(n.playbackRate):1,s=e.mainForwardBufferInfo;return(s?s.len:0)/r}getBwEstimate(){return this.bwEstimator.canEstimate()?this.bwEstimator.getEstimate():this.hls.config.abrEwmaDefaultEstimate}findBestLevel(e,n,r,s,i,o,l){var c;const d=s+i,u=this.lastLoadedFragLevel,h=u===-1?this.hls.firstLevel:u,{fragCurrent:m,partCurrent:f}=this,{levels:p,allAudioTracks:g,loadLevel:v,config:b}=this.hls;if(p.length===1)return 0;const x=p[h],w=!!((c=this.hls.latestLevelDetails)!=null&&c.live),k=v===-1||u===-1;let S,C="SDR",j=(x==null?void 0:x.frameRate)||0;const{audioPreference:E,videoPreference:N}=b,A=this.audioTracksByGroup||(this.audioTracksByGroup=f0t(g));let _=-1;if(k){if(this.firstSelection!==-1)return this.firstSelection;const D=this.codecTiers||(this.codecTiers=FVn(p,A,n,r)),I=OVn(D,C,e,E,N),{codecSet:P,videoRanges:M,minFramerate:z,minBitrate:G,minIndex:B,preferHDR:H}=I;_=B,S=P,C=H?M[M.length-1]:M[0],j=z,e=Math.max(e,G),this.log(`picked start tier ${va(I)}`)}else S=x==null?void 0:x.codecSet,C=x==null?void 0:x.videoRange;const T=f?f.duration:m?m.duration:0,R=this.bwEstimator.getEstimateTTFB()/1e3,O=[];for(let D=r;D>=n;D--){var F;const I=p[D],P=D>h;if(!I)continue;if(b.useMediaCapabilities&&!I.supportedResult&&!I.supportedPromise){const V=navigator.mediaCapabilities;typeof(V==null?void 0:V.decodingInfo)=="function"&&TVn(I,A,C,j,e,E)?(I.supportedPromise=h0t(I,A,V,this.supportedCache),I.supportedPromise.then(U=>{if(!this.hls)return;I.supportedResult=U;const ne=this.hls.levels,te=ne.indexOf(I);U.error?this.warn(`MediaCapabilities decodingInfo error: "${U.error}" for level ${te} ${va(U)}`):U.supported?U.decodingInfoResults.some(re=>re.smooth===!1||re.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${te} not smooth or powerEfficient: ${va(U)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${te} ${va(U)}`),te>-1&&ne.length>1&&(this.log(`Removing unsupported level ${te}`),this.hls.removeLevel(te),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(U=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${U}`)})):I.supportedResult=d0t}if((S&&I.codecSet!==S||C&&I.videoRange!==C||P&&j>I.frameRate||!P&&j>0&&j<I.frameRate||(F=I.supportedResult)!=null&&(F=F.decodingInfoResults)!=null&&F.some(V=>V.smooth===!1))&&(!k||D!==_)){O.push(D);continue}const M=I.details,z=(f?M==null?void 0:M.partTarget:M==null?void 0:M.averagetargetduration)||T;let G;P?G=l*e:G=o*e;const B=T&&s>=T*2&&i===0?I.averageBitrate:I.maxBitrate,H=this.getTimeToLoadFrag(R,G,B*z,M===void 0);if(G>=B&&(D===u||I.loadError===0&&I.fragmentError===0)&&(H<=R||!$n(H)||w&&!this.bitrateTestDelay||H<d)){const V=this.forcedAutoLevel;return D!==v&&(V===-1||V!==v)&&(O.length&&this.trace(`Skipped level(s) ${O.join(",")} of ${r} max with CODECS and VIDEO-RANGE:"${p[O[0]].codecs}" ${p[O[0]].videoRange}; not compatible with "${S}" ${C}`),this.info(`switch candidate:${h}->${D} adjustedbw(${Math.round(G)})-bitrate=${Math.round(G-B)} ttfb:${R.toFixed(1)} avgDuration:${z.toFixed(1)} maxFetchDuration:${d.toFixed(1)} fetchDuration:${H.toFixed(1)} firstSelection:${k} codecSet:${I.codecSet} videoRange:${I.videoRange} hls.loadLevel:${v}`)),k&&(this.firstSelection=D),D}}return-1}set nextAutoLevel(e){const n=this.deriveNextAutoLevel(e);this._nextAutoLevel!==n&&(this.nextAutoLevelKey="",this._nextAutoLevel=n)}deriveNextAutoLevel(e){const{maxAutoLevel:n,minAutoLevel:r}=this.hls;return Math.min(Math.max(e,r),n)}};const p0t={search:function(t,e){let n=0,r=t.length-1,s=null,i=null;for(;n<=r;){s=(n+r)/2|0,i=t[s];const o=e(i);if(o>0)n=s+1;else if(o<0)r=s-1;else return i}return null}};function HVn(t,e,n){if(e===null||!Array.isArray(t)||!t.length||!$n(e))return null;const r=t[0].programDateTime;if(e<(r||0))return null;const s=t[t.length-1].endProgramDateTime;if(e>=(s||0))return null;for(let i=0;i<t.length;++i){const o=t[i];if(WVn(e,n,o))return o}return null}function V2(t,e,n=0,r=0,s=.005){let i=null;if(t){i=e[1+t.sn-e[0].sn]||null;const l=t.endDTS-n;l>0&&l<15e-7&&(n+=15e-7),i&&t.level!==i.level&&i.end<=t.end&&(i=e[2+t.sn-e[0].sn]||null)}else n===0&&e[0].start===0&&(i=e[0]);if(i&&((!t||t.level===i.level)&&DBe(n,r,i)===0||GVn(i,t,Math.min(s,r))))return i;const o=p0t.search(e,DBe.bind(null,n,r));return o&&(o!==t||!i)?o:i}function GVn(t,e,n){if(e&&e.start===0&&e.level<t.level&&(e.endPTS||0)>0){const r=e.tagList.reduce((s,i)=>(i[0]==="INF"&&(s+=parseFloat(i[1])),s),n);return t.start<=r}return!1}function DBe(t=0,e=0,n){if(n.start<=t&&n.start+n.duration>t)return 0;const r=Math.min(e,n.duration+(n.deltaPTS?n.deltaPTS:0));return n.start+n.duration-r<=t?1:n.start-r>t&&n.start?-1:0}function WVn(t,e,n){const r=Math.min(e,n.duration+(n.deltaPTS?n.deltaPTS:0))*1e3;return(n.endProgramDateTime||0)-r>t}function g0t(t,e,n){if(t&&t.startCC<=e&&t.endCC>=e){let r=t.fragments;const{fragmentHint:s}=t;s&&(r=r.concat(s));let i;return p0t.search(r,o=>o.cc<e?1:o.cc>e?-1:(i=o,o.end<=n?1:o.start>n?-1:0)),i||null}return null}function zQ(t){switch(t.details){case dt.FRAG_LOAD_TIMEOUT:case dt.KEY_LOAD_TIMEOUT:case dt.LEVEL_LOAD_TIMEOUT:case dt.MANIFEST_LOAD_TIMEOUT:return!0}return!1}function v0t(t){return t.details.startsWith("key")}function y0t(t){return v0t(t)&&!!t.frag&&!t.frag.decryptdata}function $Be(t,e){const n=zQ(e);return t.default[`${n?"timeout":"error"}Retry`]}function dTe(t,e){const n=t.backoff==="linear"?1:Math.pow(2,e);return Math.min(n*t.retryDelayMs,t.maxRetryDelayMs)}function OBe(t){return Bi(Bi({},t),{errorRetry:null,timeoutRetry:null})}function VQ(t,e,n,r){if(!t)return!1;const s=r==null?void 0:r.code,i=e<t.maxNumRetry&&(qVn(s)||!!n);return t.shouldRetry?t.shouldRetry(t,e,n,r,i):i}function qVn(t){return Rbe(t)||!!t&&(t<400||t>499)}function Rbe(t){return t===0&&navigator.onLine===!1}var ad={DoNothing:0,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,RetryRequest:5},Yh={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4};let KVn=class extends tp{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(ue.ERROR,this.onError,this),e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(ue.ERROR,this.onError,this),e.off(ue.ERROR,this.onErrorOut,this),e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===Yn.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const n=this.hls,r=n.currentLevel;return(e=n.loadLevelObj)!=null&&e.details||r===-1?n.loadLevel:r}variantHasKey(e,n){if(e){var r;if((r=e.details)!=null&&r.hasKey(n))return!0;const s=e.audioGroups;if(s)return this.hls.allAudioTracks.filter(o=>s.indexOf(o.groupId)>=0).some(o=>{var l;return(l=o.details)==null?void 0:l.hasKey(n)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,n){var r;if(n.fatal)return;const s=this.hls,i=n.context;switch(n.details){case dt.FRAG_LOAD_ERROR:case dt.FRAG_LOAD_TIMEOUT:case dt.KEY_LOAD_ERROR:case dt.KEY_LOAD_TIMEOUT:n.errorAction=this.getFragRetryOrSwitchAction(n);return;case dt.FRAG_PARSING_ERROR:if((r=n.frag)!=null&&r.gap){n.errorAction=eP();return}case dt.FRAG_GAP:case dt.FRAG_DECRYPT_ERROR:{n.errorAction=this.getFragRetryOrSwitchAction(n),n.errorAction.action=ad.SendAlternateToPenaltyBox;return}case dt.LEVEL_EMPTY_ERROR:case dt.LEVEL_PARSING_ERROR:{var o;const c=n.parent===Yn.MAIN?n.level:s.loadLevel;n.details===dt.LEVEL_EMPTY_ERROR&&((o=n.context)!=null&&(o=o.levelDetails)!=null&&o.live)?n.errorAction=this.getPlaylistRetryOrSwitchAction(n,c):(n.levelRetry=!1,n.errorAction=this.getLevelSwitchAction(n,c))}return;case dt.LEVEL_LOAD_ERROR:case dt.LEVEL_LOAD_TIMEOUT:typeof(i==null?void 0:i.level)=="number"&&(n.errorAction=this.getPlaylistRetryOrSwitchAction(n,i.level));return;case dt.AUDIO_TRACK_LOAD_ERROR:case dt.AUDIO_TRACK_LOAD_TIMEOUT:case dt.SUBTITLE_LOAD_ERROR:case dt.SUBTITLE_TRACK_LOAD_TIMEOUT:if(i){const c=s.loadLevelObj;if(c&&(i.type===Us.AUDIO_TRACK&&c.hasAudioGroup(i.groupId)||i.type===Us.SUBTITLE_TRACK&&c.hasSubtitleGroup(i.groupId))){n.errorAction=this.getPlaylistRetryOrSwitchAction(n,s.loadLevel),n.errorAction.action=ad.SendAlternateToPenaltyBox,n.errorAction.flags=Yh.MoveAllAlternatesMatchingHost;return}}return;case dt.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:n.errorAction={action:ad.SendAlternateToPenaltyBox,flags:Yh.MoveAllAlternatesMatchingHDCP};return;case dt.KEY_SYSTEM_SESSION_UPDATE_FAILED:case dt.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case dt.KEY_SYSTEM_NO_SESSION:n.errorAction={action:ad.SendAlternateToPenaltyBox,flags:Yh.MoveAllAlternatesMatchingKey};return;case dt.BUFFER_ADD_CODEC_ERROR:case dt.REMUX_ALLOC_ERROR:case dt.BUFFER_APPEND_ERROR:if(!n.errorAction){var l;n.errorAction=this.getLevelSwitchAction(n,(l=n.level)!=null?l:s.loadLevel)}return;case dt.INTERNAL_EXCEPTION:case dt.BUFFER_APPENDING_ERROR:case dt.BUFFER_FULL_ERROR:case dt.LEVEL_SWITCH_ERROR:case dt.BUFFER_STALLED_ERROR:case dt.BUFFER_SEEK_OVER_HOLE:case dt.BUFFER_NUDGE_ON_STALL:n.errorAction=eP();return}n.type===ur.KEY_SYSTEM_ERROR&&(n.levelRetry=!1,n.errorAction=eP())}getPlaylistRetryOrSwitchAction(e,n){const r=this.hls,s=$Be(r.config.playlistLoadPolicy,e),i=this.playlistError++;if(VQ(s,i,zQ(e),e.response))return{action:ad.RetryRequest,flags:Yh.None,retryConfig:s,retryCount:i};const l=this.getLevelSwitchAction(e,n);return s&&(l.retryConfig=s,l.retryCount=i),l}getFragRetryOrSwitchAction(e){const n=this.hls,r=this.getVariantLevelIndex(e.frag),s=n.levels[r],{fragLoadPolicy:i,keyLoadPolicy:o}=n.config,l=$Be(v0t(e)?o:i,e),c=n.levels.reduce((u,h)=>u+h.fragmentError,0);if(s&&(e.details!==dt.FRAG_GAP&&s.fragmentError++,!y0t(e)&&VQ(l,c,zQ(e),e.response)))return{action:ad.RetryRequest,flags:Yh.None,retryConfig:l,retryCount:c};const d=this.getLevelSwitchAction(e,r);return l&&(d.retryConfig=l,d.retryCount=c),d}getLevelSwitchAction(e,n){const r=this.hls;n==null&&(n=r.loadLevel);const s=this.hls.levels[n];if(s){var i,o;const d=e.details;s.loadError++,d===dt.BUFFER_APPEND_ERROR&&s.fragmentError++;let u=-1;const{levels:h,loadLevel:m,minAutoLevel:f,maxAutoLevel:p}=r;!r.autoLevelEnabled&&!r.config.preserveManualLevelOnError&&(r.loadLevel=-1);const g=(i=e.frag)==null?void 0:i.type,b=(g===Yn.AUDIO&&d===dt.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&(d===dt.BUFFER_ADD_CODEC_ERROR||d===dt.BUFFER_APPEND_ERROR))&&h.some(({audioCodec:C})=>s.audioCodec!==C),w=e.sourceBufferName==="video"&&(d===dt.BUFFER_ADD_CODEC_ERROR||d===dt.BUFFER_APPEND_ERROR)&&h.some(({codecSet:C,audioCodec:j})=>s.codecSet!==C&&s.audioCodec===j),{type:k,groupId:S}=(o=e.context)!=null?o:{};for(let C=h.length;C--;){const j=(C+m)%h.length;if(j!==m&&j>=f&&j<=p&&h[j].loadError===0){var l,c;const E=h[j];if(d===dt.FRAG_GAP&&g===Yn.MAIN&&e.frag){const N=h[j].details;if(N){const A=V2(e.frag,N.fragments,e.frag.start);if(A!=null&&A.gap)continue}}else{if(k===Us.AUDIO_TRACK&&E.hasAudioGroup(S)||k===Us.SUBTITLE_TRACK&&E.hasSubtitleGroup(S))continue;if(g===Yn.AUDIO&&(l=s.audioGroups)!=null&&l.some(N=>E.hasAudioGroup(N))||g===Yn.SUBTITLE&&(c=s.subtitleGroups)!=null&&c.some(N=>E.hasSubtitleGroup(N))||b&&s.audioCodec===E.audioCodec||w&&s.codecSet===E.codecSet||!b&&s.codecSet!==E.codecSet)continue}u=j;break}}if(u>-1&&r.loadLevel!==u)return e.levelRetry=!0,this.playlistError=0,{action:ad.SendAlternateToPenaltyBox,flags:Yh.None,nextAutoLevel:u}}return{action:ad.SendAlternateToPenaltyBox,flags:Yh.MoveAllAlternatesMatchingHost}}onErrorOut(e,n){var r;switch((r=n.errorAction)==null?void 0:r.action){case ad.DoNothing:break;case ad.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(n),!n.errorAction.resolved&&n.details!==dt.FRAG_GAP?n.fatal=!0:/MediaSource readyState: ended/.test(n.error.message)&&(this.warn(`MediaSource ended after "${n.sourceBufferName}" sourceBuffer append error. Attempting to recover from media error.`),this.hls.recoverMediaError());break}if(n.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const n=this.hls,r=e.errorAction;if(!r)return;const{flags:s}=r,i=r.nextAutoLevel;switch(s){case Yh.None:this.switchLevel(e,i);break;case Yh.MoveAllAlternatesMatchingHDCP:{const c=this.getVariantLevelIndex(e.frag),d=n.levels[c],u=d==null?void 0:d.attrs["HDCP-LEVEL"];if(r.hdcpLevel=u,u==="NONE")this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE");else if(u){n.maxHdcpLevel=Pbe[Pbe.indexOf(u)-1],r.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${n.maxHdcpLevel}" or lower`);break}}case Yh.MoveAllAlternatesMatchingKey:{const c=e.decryptdata;if(c){const d=this.hls.levels,u=d.length;for(let m=u;m--;)if(this.variantHasKey(d[m],c)){var o,l;this.log(`Banned key found in level ${m} (${d[m].bitrate}bps) or audio group "${(o=d[m].audioGroups)==null?void 0:o.join(",")}" (${(l=e.frag)==null?void 0:l.type} fragment) ${cd(c.keyId||[])}`),d[m].fragmentError++,d[m].loadError++,this.log(`Removing level ${m} with key error (${e.error})`),this.hls.removeLevel(m)}const h=e.frag;if(this.hls.levels.length<u)r.resolved=!0;else if(h&&h.type!==Yn.MAIN){const m=h.decryptdata;m&&!c.matches(m)&&(r.resolved=!0)}}break}}r.resolved||this.switchLevel(e,i)}switchLevel(e,n){if(n!==void 0&&e.errorAction&&(this.warn(`switching to level ${n} after ${e.details}`),this.hls.nextAutoLevel=n,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===dt.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const r=Abe(e.mimeType),s=this.hls.levels;for(let i=s.length;i--;)s[i][`${e.sourceBufferName}Codec`]===r&&(this.log(`Removing level ${i} for ${e.details} ("${r}" not supported)`),this.hls.removeLevel(i))}}};function eP(t){const e={action:ad.DoNothing,flags:Yh.None};return t&&(e.resolved=!0),e}var hc={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};let YVn=class{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e&&(e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.BUFFER_APPENDED,this.onBufferAppended,this),e.on(ue.FRAG_BUFFERED,this.onFragBuffered,this),e.on(ue.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.BUFFER_APPENDED,this.onBufferAppended,this),e.off(ue.FRAG_BUFFERED,this.onFragBuffered,this),e.off(ue.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,n){const r=this.activePartLists[n];if(r)for(let s=r.length;s--;){const i=r[s];if(!i)break;if(i.start<=e&&e<=i.end&&i.loaded)return i}return this.getBufferedFrag(e,n)}getBufferedFrag(e,n){return this.getFragAtPos(e,n,!0)}getFragAtPos(e,n,r){const{fragments:s}=this,i=Object.keys(s);for(let o=i.length;o--;){const l=s[i[o]];if((l==null?void 0:l.body.type)===n&&(!r||l.buffered)){const c=l.body;if(c.start<=e&&e<=c.end)return c}}return null}detectEvictedFragments(e,n,r,s,i){this.timeRanges&&(this.timeRanges[e]=n);const o=(s==null?void 0:s.fragment.sn)||-1;Object.keys(this.fragments).forEach(l=>{const c=this.fragments[l];if(!c||o>=c.body.sn)return;if(!c.buffered&&(!c.loaded||i)){c.body.type===r&&this.removeFragment(c.body);return}const d=c.range[e];if(d){if(d.time.length===0){this.removeFragment(c.body);return}d.time.some(u=>{const h=!this.isTimeBuffered(u.startPTS,u.endPTS,n);return h&&this.removeFragment(c.body),h})}})}detectPartialFragments(e){const n=this.timeRanges;if(!n||e.frag.sn==="initSegment")return;const r=e.frag,s=fT(r),i=this.fragments[s];if(!i||i.buffered&&r.gap)return;const o=!r.relurl;Object.keys(n).forEach(l=>{const c=r.elementaryStreams[l];if(!c)return;const d=n[l],u=o||c.partial===!0;i.range[l]=this.getBufferedTimes(r,e.part,u,d)}),i.loaded=null,Object.keys(i.range).length?(this.bufferedEnd(i,r),Yz(i)||this.removeParts(r.sn-1,r.type)):this.removeFragment(i.body)}bufferedEnd(e,n){e.buffered=!0,(e.body.endList=n.endList||e.body.endList)&&(this.endListFragments[e.body.type]=e)}removeParts(e,n){const r=this.activePartLists[n];r&&(this.activePartLists[n]=FBe(r,s=>s.fragment.sn>=e))}fragBuffered(e,n){const r=fT(e);let s=this.fragments[r];!s&&n&&(s=this.fragments[r]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),s&&(s.loaded=null,this.bufferedEnd(s,e))}getBufferedTimes(e,n,r,s){const i={time:[],partial:r},o=e.start,l=e.end,c=e.minEndPTS||l,d=e.maxStartPTS||o;for(let u=0;u<s.length;u++){const h=s.start(u)-this.bufferPadding,m=s.end(u)+this.bufferPadding;if(d>=h&&c<=m){i.time.push({startPTS:Math.max(o,s.start(u)),endPTS:Math.min(l,s.end(u))});break}else if(o<m&&l>h){const f=Math.max(o,s.start(u)),p=Math.min(l,s.end(u));p>f&&(i.partial=!0,i.time.push({startPTS:f,endPTS:p}))}else if(l<=h)break}return i}getPartialFragment(e){let n=null,r,s,i,o=0;const{bufferPadding:l,fragments:c}=this;return Object.keys(c).forEach(d=>{const u=c[d];u&&Yz(u)&&(s=u.body.start-l,i=u.body.end+l,e>=s&&e<=i&&(r=Math.min(e-s,i-e),o<=r&&(n=u.body,o=r)))}),n}isEndListAppended(e){const n=this.endListFragments[e];return n!==void 0&&(n.buffered||Yz(n))}getState(e){const n=fT(e),r=this.fragments[n];return r?r.buffered?Yz(r)?hc.PARTIAL:hc.OK:hc.APPENDING:hc.NOT_LOADED}isTimeBuffered(e,n,r){let s,i;for(let o=0;o<r.length;o++){if(s=r.start(o)-this.bufferPadding,i=r.end(o)+this.bufferPadding,e>=s&&n<=i)return!0;if(n<=s)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,n){if(n.frag.sn==="initSegment"||n.frag.bitrateTest)return;const r=n.frag,s=n.part?null:n,i=fT(r);this.fragments[i]={body:r,appendedPTS:null,loaded:s,buffered:!1,range:Object.create(null)}}onBufferAppended(e,n){const{frag:r,part:s,timeRanges:i,type:o}=n;if(r.sn==="initSegment")return;const l=r.type;if(s){let d=this.activePartLists[l];d||(this.activePartLists[l]=d=[]),d.push(s)}this.timeRanges=i;const c=i[o];this.detectEvictedFragments(o,c,l,s)}onFragBuffered(e,n){this.detectPartialFragments(n)}hasFragment(e){const n=fT(e);return!!this.fragments[n]}hasFragments(e){const{fragments:n}=this,r=Object.keys(n);if(!e)return r.length>0;for(let s=r.length;s--;){const i=n[r[s]];if((i==null?void 0:i.body.type)===e)return!0}return!1}hasParts(e){var n;return!!((n=this.activePartLists[e])!=null&&n.length)}removeFragmentsInRange(e,n,r,s,i){s&&!this.hasGaps||Object.keys(this.fragments).forEach(o=>{const l=this.fragments[o];if(!l)return;const c=l.body;c.type!==r||s&&!c.gap||c.start<n&&c.end>e&&(l.buffered||i)&&this.removeFragment(c)})}removeFragment(e){const n=fT(e);e.clearElementaryStreamInfo();const r=this.activePartLists[e.type];if(r){const s=e.sn;this.activePartLists[e.type]=FBe(r,i=>i.fragment.sn!==s)}delete this.fragments[n],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const n=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;n&&n.forEach(r=>r.clearElementaryStreamInfo())}};function Yz(t){var e,n,r;return t.buffered&&!!(t.body.gap||(e=t.range.video)!=null&&e.partial||(n=t.range.audio)!=null&&n.partial||(r=t.range.audiovideo)!=null&&r.partial)}function fT(t){return`${t.type}_${t.level}_${t.sn}`}function FBe(t,e){return t.filter(n=>{const r=e(n);return r||n.clearElementaryStreamInfo(),r})}var Fk={cbc:0,ctr:1};let QVn=class{constructor(e,n,r){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=n,this.aesMode=r}decrypt(e,n){switch(this.aesMode){case Fk.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},n,e);case Fk.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},n,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}};function ZVn(t){const e=t.byteLength,n=e&&new DataView(t.buffer).getUint8(e-1);return n?t.slice(0,e-n):t}let JVn=class{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const n=new DataView(e),r=new Uint32Array(4);for(let s=0;s<4;s++)r[s]=n.getUint32(s*4);return r}initTable(){const e=this.sBox,n=this.invSBox,r=this.subMix,s=r[0],i=r[1],o=r[2],l=r[3],c=this.invSubMix,d=c[0],u=c[1],h=c[2],m=c[3],f=new Uint32Array(256);let p=0,g=0,v=0;for(v=0;v<256;v++)v<128?f[v]=v<<1:f[v]=v<<1^283;for(v=0;v<256;v++){let b=g^g<<1^g<<2^g<<3^g<<4;b=b>>>8^b&255^99,e[p]=b,n[b]=p;const x=f[p],w=f[x],k=f[w];let S=f[b]*257^b*16843008;s[p]=S<<24|S>>>8,i[p]=S<<16|S>>>16,o[p]=S<<8|S>>>24,l[p]=S,S=k*16843009^w*65537^x*257^p*16843008,d[b]=S<<24|S>>>8,u[b]=S<<16|S>>>16,h[b]=S<<8|S>>>24,m[b]=S,p?(p=x^f[f[f[k^x]]],g^=f[f[g]]):p=g=1}}expandKey(e){const n=this.uint8ArrayToUint32Array_(e);let r=!0,s=0;for(;s<n.length&&r;)r=n[s]===this.key[s],s++;if(r)return;this.key=n;const i=this.keySize=n.length;if(i!==4&&i!==6&&i!==8)throw new Error("Invalid aes key size="+i);const o=this.ksRows=(i+6+1)*4;let l,c;const d=this.keySchedule=new Uint32Array(o),u=this.invKeySchedule=new Uint32Array(o),h=this.sBox,m=this.rcon,f=this.invSubMix,p=f[0],g=f[1],v=f[2],b=f[3];let x,w;for(l=0;l<o;l++){if(l<i){x=d[l]=n[l];continue}w=x,l%i===0?(w=w<<8|w>>>24,w=h[w>>>24]<<24|h[w>>>16&255]<<16|h[w>>>8&255]<<8|h[w&255],w^=m[l/i|0]<<24):i>6&&l%i===4&&(w=h[w>>>24]<<24|h[w>>>16&255]<<16|h[w>>>8&255]<<8|h[w&255]),d[l]=x=(d[l-i]^w)>>>0}for(c=0;c<o;c++)l=o-c,c&3?w=d[l]:w=d[l-4],c<4||l<=4?u[c]=w:u[c]=p[h[w>>>24]]^g[h[w>>>16&255]]^v[h[w>>>8&255]]^b[h[w&255]],u[c]=u[c]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,n,r){const s=this.keySize+6,i=this.invKeySchedule,o=this.invSBox,l=this.invSubMix,c=l[0],d=l[1],u=l[2],h=l[3],m=this.uint8ArrayToUint32Array_(r);let f=m[0],p=m[1],g=m[2],v=m[3];const b=new Int32Array(e),x=new Int32Array(b.length);let w,k,S,C,j,E,N,A,_,T,R,O,F,D;const I=this.networkToHostOrderSwap;for(;n<b.length;){for(_=I(b[n]),T=I(b[n+1]),R=I(b[n+2]),O=I(b[n+3]),j=_^i[0],E=O^i[1],N=R^i[2],A=T^i[3],F=4,D=1;D<s;D++)w=c[j>>>24]^d[E>>16&255]^u[N>>8&255]^h[A&255]^i[F],k=c[E>>>24]^d[N>>16&255]^u[A>>8&255]^h[j&255]^i[F+1],S=c[N>>>24]^d[A>>16&255]^u[j>>8&255]^h[E&255]^i[F+2],C=c[A>>>24]^d[j>>16&255]^u[E>>8&255]^h[N&255]^i[F+3],j=w,E=k,N=S,A=C,F=F+4;w=o[j>>>24]<<24^o[E>>16&255]<<16^o[N>>8&255]<<8^o[A&255]^i[F],k=o[E>>>24]<<24^o[N>>16&255]<<16^o[A>>8&255]<<8^o[j&255]^i[F+1],S=o[N>>>24]<<24^o[A>>16&255]<<16^o[j>>8&255]<<8^o[E&255]^i[F+2],C=o[A>>>24]<<24^o[j>>16&255]<<16^o[E>>8&255]<<8^o[N&255]^i[F+3],x[n]=I(w^f),x[n+1]=I(C^p),x[n+2]=I(S^g),x[n+3]=I(k^v),f=_,p=T,g=R,v=O,n=n+4}return x.buffer}},XVn=class{constructor(e,n,r){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=n,this.aesMode=r}expandKey(){const e=eHn(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}};function eHn(t){switch(t){case Fk.cbc:return"AES-CBC";case Fk.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${t}`)}}const tHn=16;let uTe=class{constructor(e,{removePKCS7Padding:n=!0}={}){if(this.logEnabled=!0,this.removePKCS7Padding=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,this.removePKCS7Padding=n,n)try{const r=self.crypto;r&&(this.subtle=r.subtle||r.webkitSubtle)}catch{}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:n}=this;if(!e||n)return this.reset(),null;const r=new Uint8Array(e);return this.reset(),this.removePKCS7Padding?ZVn(r):r}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,n,r,s){return this.useSoftware?new Promise((i,o)=>{const l=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(l,n,r,s);const c=this.flush();c?i(c.buffer):o(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),n,r,s)}softwareDecrypt(e,n,r,s){const{currentIV:i,currentResult:o,remainderData:l}=this;if(s!==Fk.cbc||n.byteLength!==16)return Ui.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),l&&(e=Gf(l,e),this.remainderData=null);const c=this.getValidChunk(e);if(!c.length)return null;i&&(r=i);let d=this.softwareDecrypter;d||(d=this.softwareDecrypter=new JVn),d.expandKey(n);const u=o;return this.currentResult=d.decrypt(c.buffer,0,r),this.currentIV=c.slice(-16).buffer,u||null}webCryptoDecrypt(e,n,r,s){if(this.key!==n||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,n,r,s));this.key=n,this.fastAesKey=new XVn(this.subtle,n,s)}return this.fastAesKey.expandKey().then(i=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new QVn(this.subtle,new Uint8Array(r),s).decrypt(e.buffer,i)):Promise.reject(new Error("web crypto not initialized"))).catch(i=>(Ui.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${i.name}: ${i.message}`),this.onWebCryptoError(e,n,r,s)))}onWebCryptoError(e,n,r,s){const i=this.enableSoftwareAES;if(i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,n,r,s);const o=this.flush();if(o)return o.buffer}throw new Error("WebCrypto"+(i?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let n=e;const r=e.length-e.length%tHn;return r!==e.length&&(n=e.slice(0,r),this.remainderData=e.slice(r)),n}logOnce(e){this.logEnabled&&(Ui.log(`[decrypter]: ${e}`),this.logEnabled=!1)}};const BBe=Math.pow(2,17);let nHn=class{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,n){const r=e.url;if(!r)return Promise.reject(new Db({type:ur.NETWORK_ERROR,details:dt.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${r?"part list":"url"}`),networkDetails:null}));this.abort();const s=this.config,i=s.fLoader,o=s.loader;return new Promise((l,c)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(p=>p[0]==="GAP")){c(zBe(e));return}else e.gap=!1;const d=this.loader=i?new i(s):new o(s),u=UBe(e);e.loader=d;const h=OBe(s.fragLoadPolicy.default),m={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:BBe};e.stats=d.stats;const f={onSuccess:(p,g,v,b)=>{this.resetLoader(e,d);let x=p.data;v.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(x.slice(0,16)),x=x.slice(16)),l({frag:e,part:null,payload:x,networkDetails:b})},onError:(p,g,v,b)=>{this.resetLoader(e,d),c(new Db({type:ur.NETWORK_ERROR,details:dt.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:Bi({url:r,data:void 0},p),error:new Error(`HTTP Error ${p.code} ${p.text}`),networkDetails:v,stats:b}))},onAbort:(p,g,v)=>{this.resetLoader(e,d),c(new Db({type:ur.NETWORK_ERROR,details:dt.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:v,stats:p}))},onTimeout:(p,g,v)=>{this.resetLoader(e,d),c(new Db({type:ur.NETWORK_ERROR,details:dt.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${m.timeout}ms`),networkDetails:v,stats:p}))}};n&&(f.onProgress=(p,g,v,b)=>n({frag:e,part:null,payload:v,networkDetails:b})),d.load(u,m,f)})}loadPart(e,n,r){this.abort();const s=this.config,i=s.fLoader,o=s.loader;return new Promise((l,c)=>{if(this.loader&&this.loader.destroy(),e.gap||n.gap){c(zBe(e,n));return}const d=this.loader=i?new i(s):new o(s),u=UBe(e,n);e.loader=d;const h=OBe(s.fragLoadPolicy.default),m={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:BBe};n.stats=d.stats,d.load(u,m,{onSuccess:(f,p,g,v)=>{this.resetLoader(e,d),this.updateStatsFromPart(e,n);const b={frag:e,part:n,payload:f.data,networkDetails:v};r(b),l(b)},onError:(f,p,g,v)=>{this.resetLoader(e,d),c(new Db({type:ur.NETWORK_ERROR,details:dt.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:n,response:Bi({url:u.url,data:void 0},f),error:new Error(`HTTP Error ${f.code} ${f.text}`),networkDetails:g,stats:v}))},onAbort:(f,p,g)=>{e.stats.aborted=n.stats.aborted,this.resetLoader(e,d),c(new Db({type:ur.NETWORK_ERROR,details:dt.INTERNAL_ABORTED,fatal:!1,frag:e,part:n,error:new Error("Aborted"),networkDetails:g,stats:f}))},onTimeout:(f,p,g)=>{this.resetLoader(e,d),c(new Db({type:ur.NETWORK_ERROR,details:dt.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:n,error:new Error(`Timeout after ${m.timeout}ms`),networkDetails:g,stats:f}))}})})}updateStatsFromPart(e,n){const r=e.stats,s=n.stats,i=s.total;if(r.loaded+=s.loaded,i){const c=Math.round(e.duration/n.duration),d=Math.min(Math.round(r.loaded/i),c),h=(c-d)*Math.round(r.loaded/d);r.total=r.loaded+h}else r.total=Math.max(r.loaded,r.total);const o=r.loading,l=s.loading;o.start?o.first+=l.first-l.start:(o.start=l.start,o.first=l.first),o.end=l.end}resetLoader(e,n){e.loader=null,this.loader===n&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),n.destroy()}};function UBe(t,e=null){const n=e||t,r={frag:t,part:e,responseType:"arraybuffer",url:n.url,headers:{},rangeStart:0,rangeEnd:0},s=n.byteRangeStartOffset,i=n.byteRangeEndOffset;if($n(s)&&$n(i)){var o;let l=s,c=i;if(t.sn==="initSegment"&&rHn((o=t.decryptdata)==null?void 0:o.method)){const d=i-s;d%16&&(c=i+(16-d%16)),s!==0&&(r.resetIV=!0,l=s-16)}r.rangeStart=l,r.rangeEnd=c}return r}function zBe(t,e){const n=new Error(`GAP ${t.gap?"tag":"attribute"} found`),r={type:ur.MEDIA_ERROR,details:dt.FRAG_GAP,fatal:!1,frag:t,error:n,networkDetails:null};return e&&(r.part=e),(e||t).stats.aborted=!0,new Db(r)}function rHn(t){return t==="AES-128"||t==="AES-256"}let Db=class extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}},b0t=class extends tp{constructor(e,n){super(e,n),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}},hTe=class{constructor(e,n,r,s=0,i=-1,o=!1){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.transmuxing=Qz(),this.buffering={audio:Qz(),video:Qz(),audiovideo:Qz()},this.level=e,this.sn=n,this.id=r,this.size=s,this.part=i,this.partial=o}};function Qz(){return{start:0,executeStart:0,executeEnd:0,end:0}}const VBe={length:0,start:()=>0,end:()=>0};let $s=class P_{static isBuffered(e,n){if(e){const r=P_.getBuffered(e);for(let s=r.length;s--;)if(n>=r.start(s)&&n<=r.end(s))return!0}return!1}static bufferedRanges(e){if(e){const n=P_.getBuffered(e);return P_.timeRangesToArray(n)}return[]}static timeRangesToArray(e){const n=[];for(let r=0;r<e.length;r++)n.push({start:e.start(r),end:e.end(r)});return n}static bufferInfo(e,n,r){if(e){const s=P_.bufferedRanges(e);if(s.length)return P_.bufferedInfo(s,n,r)}return{len:0,start:n,end:n,bufferedIndex:-1}}static bufferedInfo(e,n,r){n=Math.max(0,n),e.length>1&&e.sort((u,h)=>u.start-h.start||h.end-u.end);let s=-1,i=[];if(r)for(let u=0;u<e.length;u++){n>=e[u].start&&n<=e[u].end&&(s=u);const h=i.length;if(h){const m=i[h-1].end;e[u].start-m<r?e[u].end>m&&(i[h-1].end=e[u].end):i.push(e[u])}else i.push(e[u])}else i=e;let o=0,l,c=n,d=n;for(let u=0;u<i.length;u++){const h=i[u].start,m=i[u].end;if(s===-1&&n>=h&&n<=m&&(s=u),n+r>=h&&n<m)c=h,d=m,o=d-n;else if(n+r<h){l=h;break}}return{len:o,start:c||0,end:d||0,nextStart:l,buffered:e,bufferedIndex:s}}static getBuffered(e){try{return e.buffered||VBe}catch(n){return Ui.log("failed to get media.buffered",n),VBe}}};const x0t=/\{\$([a-zA-Z0-9-_]+)\}/g;function HBe(t){return x0t.test(t)}function Ibe(t,e){if(t.variableList!==null||t.hasVariableRefs){const n=t.variableList;return e.replace(x0t,r=>{const s=r.substring(2,r.length-1),i=n==null?void 0:n[s];return i===void 0?(t.playlistParsingError||(t.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${s}"`)),r):i})}return e}function GBe(t,e,n){let r=t.variableList;r||(t.variableList=r={});let s,i;if("QUERYPARAM"in e){s=e.QUERYPARAM;try{const o=new self.URL(n).searchParams;if(o.has(s))i=o.get(s);else throw new Error(`"${s}" does not match any query parameter in URI: "${n}"`)}catch(o){t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${o.message}`))}}else s=e.NAME,i=e.VALUE;s in r?t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${s}"`)):r[s]=i||""}function sHn(t,e,n){const r=e.IMPORT;if(n&&r in n){let s=t.variableList;s||(t.variableList=s={}),s[r]=n[r]}else t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${r}"`))}const iHn=/^(\d+)x(\d+)$/,WBe=/(.+?)=(".*?"|.*?)(?:,|$)/g;let ml=class w0t{constructor(e,n){typeof e=="string"&&(e=w0t.parseAttrList(e,n)),ra(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const n=parseInt(this[e],10);return n>Number.MAX_SAFE_INTEGER?1/0:n}hexadecimalInteger(e){if(this[e]){let n=(this[e]||"0x").slice(2);n=(n.length&1?"0":"")+n;const r=new Uint8Array(n.length/2);for(let s=0;s<n.length/2;s++)r[s]=parseInt(n.slice(s*2,s*2+2),16);return r}return null}hexadecimalIntegerAsNumber(e){const n=parseInt(this[e],16);return n>Number.MAX_SAFE_INTEGER?1/0:n}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,n){const r=this[e];return r?parseFloat(r):n}enumeratedString(e){return this[e]}enumeratedStringList(e,n){const r=this[e];return(r?r.split(/[ ,]+/):[]).reduce((s,i)=>(s[i.toLowerCase()]=!0,s),n)}bool(e){return this[e]==="YES"}decimalResolution(e){const n=iHn.exec(this[e]);if(n!==null)return{width:parseInt(n[1],10),height:parseInt(n[2],10)}}static parseAttrList(e,n){let r;const s={},i='"';for(WBe.lastIndex=0;(r=WBe.exec(e))!==null;){const o=r[1].trim();let l=r[2];const c=l.indexOf(i)===0&&l.lastIndexOf(i)===l.length-1;let d=!1;if(c)l=l.slice(1,-1);else switch(o){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":d=!0}if(n&&(c||d))l=Ibe(n,l);else if(!d&&!c)switch(o){case"CLOSED-CAPTIONS":if(l==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":Ui.warn(`${e}: attribute ${o} is missing quotes`)}s[o]=l}return s}};const aHn="com.apple.hls.interstitial";function oHn(t){return t!=="ID"&&t!=="CLASS"&&t!=="CUE"&&t!=="START-DATE"&&t!=="DURATION"&&t!=="END-DATE"&&t!=="END-ON-NEXT"}function lHn(t){return t==="SCTE35-OUT"||t==="SCTE35-IN"||t==="SCTE35-CMD"}let k0t=class{constructor(e,n,r=0){var s;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(n==null?void 0:n.tagAnchor)||null,this.tagOrder=(s=n==null?void 0:n.tagOrder)!=null?s:r,n){const i=n.attr;for(const o in i)if(Object.prototype.hasOwnProperty.call(e,o)&&e[o]!==i[o]){Ui.warn(`DATERANGE tag attribute: "${o}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=o;break}e=ra(new ml({}),i,e)}if(this.attr=e,n?(this._startDate=n._startDate,this._cue=n._cue,this._endDate=n._endDate,this._dateAtEnd=n._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in this.attr){const i=(n==null?void 0:n.endDate)||new Date(this.attr["END-DATE"]);$n(i.getTime())&&(this._endDate=i)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(Ui.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const n=this.duration;return n!==null?this._dateAtEnd=new Date(this._startDate.getTime()+n*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if($n(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return this.class===aHn}get isValid(){return!!this.id&&!this._badValueForSameId&&$n(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}};const cHn=10;let dHn=class{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const n=this.lastPartSn-e.lastPartSn,r=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!r||!!n||!this.live,this.advanced=this.endSN>e.endSN||n>0||n===0&&r>0,this.updated||this.advanced?this.misses=Math.floor(e.misses*.6):this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(n=>{let r=n.decryptdata;return r||(n.setKeyFormat(e.keyFormat),r=n.decryptdata),!!r&&e.matches(r)})}get hasProgramDateTime(){return this.fragments.length?$n(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||cHn}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const n=this.lastPartIndex;if(n!==-1){for(let r=e.length;r--;)if(e[r].index>n)return e[r].index;return n}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}};function HQ(t,e){return t.length===e.length?!t.some((n,r)=>n!==e[r]):!1}function qBe(t,e){return!t&&!e?!0:!t||!e?!1:HQ(t,e)}function tP(t){return t==="AES-128"||t==="AES-256"||t==="AES-256-CTR"}function mTe(t){switch(t){case"AES-128":case"AES-256":return Fk.cbc;case"AES-256-CTR":return Fk.ctr;default:throw new Error(`invalid full segment method ${t}`)}}function fTe(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}function Mbe(t){return Uint8Array.from(unescape(encodeURIComponent(t)),e=>e.charCodeAt(0))}function uHn(t){const e=Mbe(t).subarray(0,16),n=new Uint8Array(16);return n.set(e,16-e.length),n}function S0t(t){const e=function(r,s,i){const o=r[s];r[s]=r[i],r[i]=o};e(t,0,3),e(t,1,2),e(t,4,5),e(t,6,7)}function C0t(t){const e=t.split(":");let n=null;if(e[0]==="data"&&e.length===2){const r=e[1].split(";"),s=r[r.length-1].split(",");if(s.length===2){const i=s[0]==="base64",o=s[1];i?(r.splice(-1,1),n=fTe(o)):n=uHn(o)}}return n}const GQ=typeof self<"u"?self:void 0;var Io={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},ud={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function zW(t){switch(t){case ud.FAIRPLAY:return Io.FAIRPLAY;case ud.PLAYREADY:return Io.PLAYREADY;case ud.WIDEVINE:return Io.WIDEVINE;case ud.CLEARKEY:return Io.CLEARKEY}}function Uce(t){switch(t){case Io.FAIRPLAY:return ud.FAIRPLAY;case Io.PLAYREADY:return ud.PLAYREADY;case Io.WIDEVINE:return ud.WIDEVINE;case Io.CLEARKEY:return ud.CLEARKEY}}function q4(t){const{drmSystems:e,widevineLicenseUrl:n}=t,r=e?[Io.FAIRPLAY,Io.WIDEVINE,Io.PLAYREADY,Io.CLEARKEY].filter(s=>!!e[s]):[];return!r[Io.WIDEVINE]&&n&&r.push(Io.WIDEVINE),r}const j0t=function(t){return GQ!=null&&(t=GQ.navigator)!=null&&t.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function hHn(t,e,n,r){let s;switch(t){case Io.FAIRPLAY:s=["cenc","sinf"];break;case Io.WIDEVINE:case Io.PLAYREADY:s=["cenc"];break;case Io.CLEARKEY:s=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${t}`)}return mHn(s,e,n,r)}function mHn(t,e,n,r){return[{initDataTypes:t,persistentState:r.persistentState||"optional",distinctiveIdentifier:r.distinctiveIdentifier||"optional",sessionTypes:r.sessionTypes||[r.sessionType||"temporary"],audioCapabilities:e.map(i=>({contentType:`audio/mp4; codecs=${i}`,robustness:r.audioRobustness||"",encryptionScheme:r.audioEncryptionScheme||null})),videoCapabilities:n.map(i=>({contentType:`video/mp4; codecs=${i}`,robustness:r.videoRobustness||"",encryptionScheme:r.videoEncryptionScheme||null}))}]}function fHn(t){var e;return!!t&&(t.sessionType==="persistent-license"||!!((e=t.sessionTypes)!=null&&e.some(n=>n==="persistent-license")))}function E0t(t){const e=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),n=String.fromCharCode.apply(null,Array.from(e)),r=n.substring(n.indexOf("<"),n.length),o=new DOMParser().parseFromString(r,"text/xml").getElementsByTagName("KID")[0];if(o){const l=o.childNodes[0]?o.childNodes[0].nodeValue:o.getAttribute("VALUE");if(l){const c=fTe(l).subarray(0,16);return S0t(c),c}}return null}let pT={},WQ=class VW{static clearKeyUriToKeyIdMap(){pT={}}static setKeyIdForUri(e,n){pT[e]=n}static addKeyIdForUri(e){const n=Object.keys(pT).length%Number.MAX_SAFE_INTEGER,r=new Uint8Array(16);return new DataView(r.buffer,12,4).setUint32(0,n),pT[e]=r,r}constructor(e,n,r,s=[1],i=null,o){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.method=e,this.uri=n,this.keyFormat=r,this.keyFormatVersions=s,this.iv=i,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!tP(e),o!=null&&o.startsWith("0x")&&(this.keyId=new Uint8Array(Xxt(o)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&HQ(e.keyFormatVersions,this.keyFormatVersions)&&qBe(e.iv,this.iv)&&qBe(e.keyId,this.keyId)}isSupported(){if(this.method){if(tP(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case ud.FAIRPLAY:case ud.WIDEVINE:case ud.PLAYREADY:case ud.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e,n){if(!this.encrypted||!this.uri)return null;if(tP(this.method)){let i=this.iv;return i||(typeof e!="number"&&(Ui.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),i=gHn(e)),new VW(this.method,this.uri,"identity",this.keyFormatVersions,i)}if(this.keyId){const i=pT[this.uri];if(i&&!HQ(this.keyId,i)&&VW.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const r=C0t(this.uri);if(r)switch(this.keyFormat){case ud.WIDEVINE:if(this.pssh=r,!this.keyId){const i=bVn(r.buffer);if(i.length){var s;const o=i[0];this.keyId=(s=o.kids)!=null&&s.length?o.kids[0]:null}}this.keyId||(this.keyId=KBe(n));break;case ud.PLAYREADY:{const i=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=yVn(i,null,r),this.keyId=E0t(r);break}default:{let i=r.subarray(0,16);if(i.length!==16){const o=new Uint8Array(16);o.set(i,16-i.length),i=o}this.keyId=i;break}}if(!this.keyId||this.keyId.byteLength!==16){let i;i=pHn(n),i||(i=KBe(n),i||(i=pT[this.uri])),i&&(this.keyId=i,VW.setKeyIdForUri(this.uri,i))}return this}};function pHn(t){const e=t==null?void 0:t[ud.WIDEVINE];return e?e.keyId:null}function KBe(t){const e=t==null?void 0:t[ud.PLAYREADY];if(e){const n=C0t(e.uri);if(n)return E0t(n)}return null}function gHn(t){const e=new Uint8Array(16);for(let n=12;n<16;n++)e[n]=t>>8*(15-n)&255;return e}const YBe=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)[\r\n]+/g,QBe=/#EXT-X-MEDIA:(.*)/g,vHn=/^#EXT(?:INF|-X-TARGETDURATION):/m,zce=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),yHn=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));let K4=class Y4{static findGroup(e,n){for(let r=0;r<e.length;r++){const s=e[r];if(s.id===n)return s}}static resolve(e,n){return iTe.buildAbsoluteURL(n,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return vHn.test(e)}static parseMasterPlaylist(e,n){const r=HBe(e),s={contentSteering:null,levels:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:r},i=[];if(YBe.lastIndex=0,!e.startsWith("#EXTM3U"))return s.playlistParsingError=new Error("no EXTM3U delimiter"),s;let o;for(;(o=YBe.exec(e))!=null;)if(o[1]){var l;const d=new ml(o[1],s),u=Ibe(s,o[2]),h={attrs:d,bitrate:d.decimalInteger("BANDWIDTH")||d.decimalInteger("AVERAGE-BANDWIDTH"),name:d.NAME,url:Y4.resolve(u,n)},m=d.decimalResolution("RESOLUTION");m&&(h.width=m.width,h.height=m.height),XBe(d.CODECS,h);const f=d["SUPPLEMENTAL-CODECS"];f&&(h.supplemental={},XBe(f,h.supplemental)),(l=h.unknownCodecs)!=null&&l.length||i.push(h),s.levels.push(h)}else if(o[3]){const d=o[3],u=o[4];switch(d){case"SESSION-DATA":{const h=new ml(u,s),m=h["DATA-ID"];m&&(s.sessionData===null&&(s.sessionData={}),s.sessionData[m]=h);break}case"SESSION-KEY":{const h=ZBe(u,n,s);h.encrypted&&h.isSupported()?(s.sessionKeys===null&&(s.sessionKeys=[]),s.sessionKeys.push(h)):Ui.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${u}"`);break}case"DEFINE":{{const h=new ml(u,s);GBe(s,h,n)}break}case"CONTENT-STEERING":{const h=new ml(u,s);s.contentSteering={uri:Y4.resolve(h["SERVER-URI"],n),pathwayId:h["PATHWAY-ID"]||"."};break}case"START":{s.startTimeOffset=JBe(u);break}}}const c=i.length>0&&i.length<s.levels.length;return s.levels=c?i:s.levels,s.levels.length===0&&(s.playlistParsingError=new Error("no levels found in manifest")),s}static parseMasterPlaylistMedia(e,n,r){let s;const i={},o=r.levels,l={AUDIO:o.map(d=>({id:d.attrs.AUDIO,audioCodec:d.audioCodec})),SUBTITLES:o.map(d=>({id:d.attrs.SUBTITLES,textCodec:d.textCodec})),"CLOSED-CAPTIONS":[]};let c=0;for(QBe.lastIndex=0;(s=QBe.exec(e))!==null;){const d=new ml(s[1],r),u=d.TYPE;if(u){const h=l[u],m=i[u]||[];i[u]=m;const f=d.LANGUAGE,p=d["ASSOC-LANGUAGE"],g=d.CHANNELS,v=d.CHARACTERISTICS,b=d["INSTREAM-ID"],x={attrs:d,bitrate:0,id:c++,groupId:d["GROUP-ID"]||"",name:d.NAME||f||"",type:u,default:d.bool("DEFAULT"),autoselect:d.bool("AUTOSELECT"),forced:d.bool("FORCED"),lang:f,url:d.URI?Y4.resolve(d.URI,n):""};if(p&&(x.assocLang=p),g&&(x.channels=g),v&&(x.characteristics=v),b&&(x.instreamId=b),h!=null&&h.length){const w=Y4.findGroup(h,x.groupId)||h[0];e9e(x,w,"audioCodec"),e9e(x,w,"textCodec")}m.push(x)}}return i}static parseLevelPlaylist(e,n,r,s,i,o){var l;const c={url:n},d=new dHn(n),u=d.fragments,h=[];let m=null,f=0,p=0,g=0,v=0,b=0,x=null,w=new Oce(s,c),k,S,C,j=-1,E=!1,N=null,A;if(zce.lastIndex=0,d.m3u8=e,d.hasVariableRefs=HBe(e),((l=zce.exec(e))==null?void 0:l[0])!=="#EXTM3U")return d.playlistParsingError=new Error("Missing format identifier #EXTM3U"),d;for(;(k=zce.exec(e))!==null;){E&&(E=!1,w=new Oce(s,c),w.playlistOffset=g,w.setStart(g),w.sn=f,w.cc=v,b&&(w.bitrate=b),w.level=r,m&&(w.initSegment=m,m.rawProgramDateTime&&(w.rawProgramDateTime=m.rawProgramDateTime,m.rawProgramDateTime=null),N&&(w.setByteRange(N),N=null)));const O=k[1];if(O){w.duration=parseFloat(O);const F=(" "+k[2]).slice(1);w.title=F||null,w.tagList.push(F?["INF",O,F]:["INF",O])}else if(k[3]){if($n(w.duration)){w.playlistOffset=g,w.setStart(g),C&&n9e(w,C,d),w.sn=f,w.level=r,w.cc=v,u.push(w);const F=(" "+k[3]).slice(1);w.relurl=Ibe(d,F),Lbe(w,x,h),x=w,g+=w.duration,f++,p=0,E=!0}}else{if(k=k[0].match(yHn),!k){Ui.warn("No matches on slow regex match for level playlist!");continue}for(S=1;S<k.length&&k[S]===void 0;S++);const F=(" "+k[S]).slice(1),D=(" "+k[S+1]).slice(1),I=k[S+2]?(" "+k[S+2]).slice(1):null;switch(F){case"BYTERANGE":x?w.setByteRange(D,x):w.setByteRange(D);break;case"PROGRAM-DATE-TIME":w.rawProgramDateTime=D,w.tagList.push(["PROGRAM-DATE-TIME",D]),j===-1&&(j=u.length);break;case"PLAYLIST-TYPE":d.type&&hb(d,F,k),d.type=D.toUpperCase();break;case"MEDIA-SEQUENCE":d.startSN!==0?hb(d,F,k):u.length>0&&r9e(d,F,k),f=d.startSN=parseInt(D);break;case"SKIP":{d.skippedSegments&&hb(d,F,k);const P=new ml(D,d),M=P.decimalInteger("SKIPPED-SEGMENTS");if($n(M)){d.skippedSegments+=M;for(let G=M;G--;)u.push(null);f+=M}const z=P.enumeratedString("RECENTLY-REMOVED-DATERANGES");z&&(d.recentlyRemovedDateranges=(d.recentlyRemovedDateranges||[]).concat(z.split("	")));break}case"TARGETDURATION":d.targetduration!==0&&hb(d,F,k),d.targetduration=Math.max(parseInt(D),1);break;case"VERSION":d.version!==null&&hb(d,F,k),d.version=parseInt(D);break;case"INDEPENDENT-SEGMENTS":break;case"ENDLIST":d.live||hb(d,F,k),d.live=!1;break;case"#":(D||I)&&w.tagList.push(I?[D,I]:[D]);break;case"DISCONTINUITY":v++,w.tagList.push(["DIS"]);break;case"GAP":w.gap=!0,w.tagList.push([F]);break;case"BITRATE":w.tagList.push([F,D]),b=parseInt(D)*1e3,$n(b)?w.bitrate=b:b=0;break;case"DATERANGE":{const P=new ml(D,d),M=new k0t(P,d.dateRanges[P.ID],d.dateRangeTagCount);d.dateRangeTagCount++,M.isValid||d.skippedSegments?d.dateRanges[M.id]=M:Ui.warn(`Ignoring invalid DATERANGE tag: "${D}"`),w.tagList.push(["EXT-X-DATERANGE",D]);break}case"DEFINE":{{const P=new ml(D,d);"IMPORT"in P?sHn(d,P,o):GBe(d,P,n)}break}case"DISCONTINUITY-SEQUENCE":d.startCC!==0?hb(d,F,k):u.length>0&&r9e(d,F,k),d.startCC=v=parseInt(D);break;case"KEY":{const P=ZBe(D,n,d);if(P.isSupported()){if(P.method==="NONE"){C=void 0;break}C||(C={});const M=C[P.keyFormat];M!=null&&M.matches(P)||(M&&(C=ra({},C)),C[P.keyFormat]=P)}else Ui.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${D}"`);break}case"START":d.startTimeOffset=JBe(D);break;case"MAP":{const P=new ml(D,d);if(w.duration){const M=new Oce(s,c);t9e(M,P,r,C),m=M,w.initSegment=m,m.rawProgramDateTime&&!w.rawProgramDateTime&&(w.rawProgramDateTime=m.rawProgramDateTime)}else{const M=w.byteRangeEndOffset;if(M){const z=w.byteRangeStartOffset;N=`${M-z}@${z}`}else N=null;t9e(w,P,r,C),m=w,E=!0}m.cc=v;break}case"SERVER-CONTROL":{A&&hb(d,F,k),A=new ml(D),d.canBlockReload=A.bool("CAN-BLOCK-RELOAD"),d.canSkipUntil=A.optionalFloat("CAN-SKIP-UNTIL",0),d.canSkipDateRanges=d.canSkipUntil>0&&A.bool("CAN-SKIP-DATERANGES"),d.partHoldBack=A.optionalFloat("PART-HOLD-BACK",0),d.holdBack=A.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{d.partTarget&&hb(d,F,k);const P=new ml(D);d.partTarget=P.decimalFloatingPoint("PART-TARGET");break}case"PART":{let P=d.partList;P||(P=d.partList=[]);const M=p>0?P[P.length-1]:void 0,z=p++,G=new ml(D,d),B=new sVn(G,w,c,z,M);P.push(B),w.duration+=B.duration;break}case"PRELOAD-HINT":{const P=new ml(D,d);d.preloadHint=P;break}case"RENDITION-REPORT":{const P=new ml(D,d);d.renditionReports=d.renditionReports||[],d.renditionReports.push(P);break}default:Ui.warn(`line parsed but not handled: ${k}`);break}}}x&&!x.relurl?(u.pop(),g-=x.duration,d.partList&&(d.fragmentHint=x)):d.partList&&(Lbe(w,x,h),w.cc=v,d.fragmentHint=w,C&&n9e(w,C,d)),d.targetduration||(d.playlistParsingError=new Error("Missing Target Duration"));const _=u.length,T=u[0],R=u[_-1];if(g+=d.skippedSegments*d.targetduration,g>0&&_&&R){d.averagetargetduration=g/_;const O=R.sn;d.endSN=O!=="initSegment"?O:0,d.live||(R.endList=!0),j>0&&(xHn(u,j),T&&h.unshift(T))}return d.fragmentHint&&(g+=d.fragmentHint.duration),d.totalduration=g,h.length&&d.dateRangeTagCount&&T&&N0t(h,d),d.endCC=v,d}};function N0t(t,e){let n=t.length;if(!n)if(e.hasProgramDateTime){const l=e.fragments[e.fragments.length-1];t.push(l),n++}else return;const r=t[n-1],s=e.live?1/0:e.totalduration,i=Object.keys(e.dateRanges);for(let l=i.length;l--;){const c=e.dateRanges[i[l]],d=c.startDate.getTime();c.tagAnchor=r.ref;for(let u=n;u--;){var o;if(((o=t[u])==null?void 0:o.sn)<e.startSN)break;const h=bHn(e,d,t,u,s);if(h!==-1){c.tagAnchor=e.fragments[h].ref;break}}}}function bHn(t,e,n,r,s){const i=n[r];if(i){const l=i.programDateTime;if(e>=l||r===0){var o;const c=(((o=n[r+1])==null?void 0:o.start)||s)-i.start;if(e<=l+c*1e3){const d=n[r].sn-t.startSN;if(d<0)return-1;const u=t.fragments;if(u.length>n.length){const m=(n[r+1]||u[u.length-1]).sn-t.startSN;for(let f=m;f>d;f--){const p=u[f].programDateTime;if(e>=p&&e<p+u[f].duration*1e3)return f}}return d}}}return-1}function ZBe(t,e,n){var r,s;const i=new ml(t,n),o=(r=i.METHOD)!=null?r:"",l=i.URI,c=i.hexadecimalInteger("IV"),d=i.KEYFORMATVERSIONS,u=(s=i.KEYFORMAT)!=null?s:"identity";l&&i.IV&&!c&&Ui.error(`Invalid IV: ${i.IV}`);const h=l?K4.resolve(l,e):"",m=(d||"1").split("/").map(Number).filter(Number.isFinite);return new WQ(o,h,u,m,c,i.KEYID)}function JBe(t){const n=new ml(t).decimalFloatingPoint("TIME-OFFSET");return $n(n)?n:null}function XBe(t,e){let n=(t||"").split(/[ ,]+/).filter(r=>r);["video","audio","text"].forEach(r=>{const s=n.filter(i=>lTe(i,r));s.length&&(e[`${r}Codec`]=s.map(i=>i.split("/")[0]).join(","),n=n.filter(i=>s.indexOf(i)===-1))}),e.unknownCodecs=n}function e9e(t,e,n){const r=e[n];r&&(t[n]=r)}function xHn(t,e){let n=t[e];for(let r=e;r--;){const s=t[r];if(!s)return;s.programDateTime=n.programDateTime-s.duration*1e3,n=s}}function Lbe(t,e,n){t.rawProgramDateTime?n.push(t):e!=null&&e.programDateTime&&(t.programDateTime=e.endProgramDateTime)}function t9e(t,e,n,r){t.relurl=e.URI,e.BYTERANGE&&t.setByteRange(e.BYTERANGE),t.level=n,t.sn="initSegment",r&&(t.levelkeys=r),t.initSegment=null}function n9e(t,e,n){t.levelkeys=e;const{encryptedFragments:r}=n;(!r.length||r[r.length-1].levelkeys!==e)&&Object.keys(e).some(s=>e[s].isCommonEncryption)&&r.push(t)}function hb(t,e,n){t.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${n[0]})`)}function r9e(t,e,n){t.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${n[0]})`)}function Vce(t,e){const n=e.startPTS;if($n(n)){let r=0,s;e.sn>t.sn?(r=n-t.start,s=t):(r=t.start-n,s=e),s.duration!==r&&s.setDuration(r)}else e.sn>t.sn?t.cc===e.cc&&t.minEndPTS?e.setStart(t.start+(t.minEndPTS-t.start)):e.setStart(t.start+t.duration):e.setStart(Math.max(t.start-e.duration,0))}function T0t(t,e,n,r,s,i,o){r-n<=0&&(o.warn("Fragment should have a positive duration",e),r=n+e.duration,i=s+e.duration);let c=n,d=r;const u=e.startPTS,h=e.endPTS;if($n(u)){const b=Math.abs(u-n);t&&b>t.totalduration?o.warn(`media timestamps and playlist times differ by ${b}s for level ${e.level} ${t.url}`):$n(e.deltaPTS)?e.deltaPTS=Math.max(b,e.deltaPTS):e.deltaPTS=b,c=Math.max(n,u),n=Math.min(n,u),s=e.startDTS!==void 0?Math.min(s,e.startDTS):s,d=Math.min(r,h),r=Math.max(r,h),i=e.endDTS!==void 0?Math.max(i,e.endDTS):i}const m=n-e.start;e.start!==0&&e.setStart(n),e.setDuration(r-e.start),e.startPTS=n,e.maxStartPTS=c,e.startDTS=s,e.endPTS=r,e.minEndPTS=d,e.endDTS=i;const f=e.sn;if(!t||f<t.startSN||f>t.endSN)return 0;let p;const g=f-t.startSN,v=t.fragments;for(v[g]=e,p=g;p>0;p--)Vce(v[p],v[p-1]);for(p=g;p<v.length-1;p++)Vce(v[p],v[p+1]);return t.fragmentHint&&Vce(v[v.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,m}function wHn(t,e,n){if(t===e)return;let r=null;const s=t.fragments;for(let u=s.length-1;u>=0;u--){const h=s[u].initSegment;if(h){r=h;break}}t.fragmentHint&&delete t.fragmentHint.endPTS;let i;CHn(t,e,(u,h,m,f)=>{if((!e.startCC||e.skippedSegments)&&h.cc!==u.cc){const p=u.cc-h.cc;for(let g=m;g<f.length;g++)f[g].cc+=p;e.endCC=f[f.length-1].cc}$n(u.startPTS)&&$n(u.endPTS)&&(h.setStart(h.startPTS=u.startPTS),h.startDTS=u.startDTS,h.maxStartPTS=u.maxStartPTS,h.endPTS=u.endPTS,h.endDTS=u.endDTS,h.minEndPTS=u.minEndPTS,h.setDuration(u.endPTS-u.startPTS),h.duration&&(i=h),e.PTSKnown=e.alignedSliding=!0),u.hasStreams&&(h.elementaryStreams=u.elementaryStreams),h.loader=u.loader,u.hasStats&&(h.stats=u.stats),u.initSegment&&(h.initSegment=u.initSegment,r=u.initSegment)});const o=e.fragments,l=e.fragmentHint?o.concat(e.fragmentHint):o;if(r&&l.forEach(u=>{var h;u&&(!u.initSegment||u.initSegment.relurl===((h=r)==null?void 0:h.relurl))&&(u.initSegment=r)}),e.skippedSegments){if(e.deltaUpdateFailed=o.some(u=>!u),e.deltaUpdateFailed){n.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let u=e.skippedSegments;u--;)o.shift();e.startSN=o[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=kHn(t.dateRanges,e,n));const u=t.fragments.filter(h=>h.rawProgramDateTime);if(t.hasProgramDateTime&&!e.hasProgramDateTime)for(let h=1;h<l.length;h++)l[h].programDateTime===null&&Lbe(l[h],l[h-1],u);N0t(u,e)}e.endCC=o[o.length-1].cc}if(!e.startCC){var c;const u=P0t(t,e.startSN-1);e.startCC=(c=u==null?void 0:u.cc)!=null?c:o[0].cc}SHn(t.partList,e.partList,(u,h)=>{h.elementaryStreams=u.elementaryStreams,h.stats=u.stats}),i?T0t(e,i,i.startPTS,i.endPTS,i.startDTS,i.endDTS,n):_0t(t,e),o.length&&(e.totalduration=e.edge-o[0].start),e.driftStartTime=t.driftStartTime,e.driftStart=t.driftStart;const d=e.advancedDateTime;if(e.advanced&&d){const u=e.edge;e.driftStart||(e.driftStartTime=d,e.driftStart=u),e.driftEndTime=d,e.driftEnd=u}else e.driftEndTime=t.driftEndTime,e.driftEnd=t.driftEnd,e.advancedDateTime=t.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=t.requestScheduled)}function kHn(t,e,n){const{dateRanges:r,recentlyRemovedDateranges:s}=e,i=ra({},t);s&&s.forEach(c=>{delete i[c]});const l=Object.keys(i).length;return l?(Object.keys(r).forEach(c=>{const d=i[c],u=new k0t(r[c].attr,d);u.isValid?(i[c]=u,d||(u.tagOrder+=l)):n.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${va(r[c].attr)}"`)}),i):r}function SHn(t,e,n){if(t&&e){let r=0;for(let s=0,i=t.length;s<=i;s++){const o=t[s],l=e[s+r];o&&l&&o.index===l.index&&o.fragment.sn===l.fragment.sn?n(o,l):r--}}}function CHn(t,e,n){const r=e.skippedSegments,s=Math.max(t.startSN,e.startSN)-e.startSN,i=(t.fragmentHint?1:0)+(r?e.endSN:Math.min(t.endSN,e.endSN))-e.startSN,o=e.startSN-t.startSN,l=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,c=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments;for(let d=s;d<=i;d++){const u=c[o+d];let h=l[d];if(r&&!h&&u&&(h=e.fragments[d]=u),u&&h){n(u,h,d,l);const m=u.relurl,f=h.relurl;if(m&&jHn(m,f)){e.playlistParsingError=s9e(`media sequence mismatch ${h.sn}:`,t,e,u,h);return}else if(u.cc!==h.cc){e.playlistParsingError=s9e(`discontinuity sequence mismatch (${u.cc}!=${h.cc})`,t,e,u,h);return}}}}function s9e(t,e,n,r,s){return new Error(`${t} ${s.url}
Playlist starting @${e.startSN}
${e.m3u8}

Playlist starting @${n.startSN}
${n.m3u8}`)}function _0t(t,e,n=!0){const r=e.startSN+e.skippedSegments-t.startSN,s=t.fragments,i=r>=0;let o=0;if(i&&r<s.length)o=s[r].start;else if(i&&e.startSN===t.endSN+1)o=t.fragmentEnd;else if(i&&n)o=t.fragmentStart+r*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)o=t.fragmentStart;else return;Dbe(e,o)}function Dbe(t,e){if(e){const n=t.fragments;for(let r=t.skippedSegments;r<n.length;r++)n[r].addStart(e);t.fragmentHint&&t.fragmentHint.addStart(e)}}function A0t(t,e=1/0){let n=1e3*t.targetduration;if(t.updated){const r=t.fragments;if(r.length&&n*4>e){const i=r[r.length-1].duration*1e3;i<n&&(n=i)}}else n/=2;return Math.round(n)}function P0t(t,e,n){if(!t)return null;let r=t.fragments[e-t.startSN];return r||(r=t.fragmentHint,r&&r.sn===e)?r:e<t.startSN&&n&&n.sn===e?n:null}function i9e(t,e,n){return t?R0t(t.partList,e,n):null}function R0t(t,e,n){if(t)for(let r=t.length;r--;){const s=t[r];if(s.index===n&&s.fragment.sn===e)return s}return null}function I0t(t){t.forEach((e,n)=>{var r;(r=e.details)==null||r.fragments.forEach(s=>{s.level=n,s.initSegment&&(s.initSegment.level=n)})})}function jHn(t,e){return t!==e&&e?a9e(t)!==a9e(e):!1}function a9e(t){return t.replace(/\?[^?]*$/,"")}function f$(t,e){for(let r=0,s=t.length;r<s;r++){var n;if(((n=t[r])==null?void 0:n.cc)===e)return t[r]}return null}function EHn(t,e){return!!(t&&e.startCC<t.endCC&&e.endCC>t.startCC)}function o9e(t,e){const n=t.start+e;t.startPTS=n,t.setStart(n),t.endPTS=n+t.duration}function M0t(t,e){const n=e.fragments;for(let r=0,s=n.length;r<s;r++)o9e(n[r],t);e.fragmentHint&&o9e(e.fragmentHint,t),e.alignedSliding=!0}function NHn(t,e){t&&(L0t(e,t),e.alignedSliding||qQ(e,t),!e.alignedSliding&&!e.skippedSegments&&_0t(t,e,!1))}function L0t(t,e){if(!EHn(e,t))return;const n=Math.min(e.endCC,t.endCC),r=f$(e.fragments,n),s=f$(t.fragments,n);if(!r||!s)return;Ui.log(`Aligning playlist at start of dicontinuity sequence ${n}`);const i=r.start-s.start;M0t(i,t)}function qQ(t,e){if(!t.hasProgramDateTime||!e.hasProgramDateTime)return;const n=t.fragments,r=e.fragments;if(!n.length||!r.length)return;let s,i;const o=Math.min(e.endCC,t.endCC);e.startCC<o&&t.startCC<o&&(s=f$(r,o),i=f$(n,o)),(!s||!i)&&(s=r[Math.floor(r.length/2)],i=f$(n,s.cc)||n[Math.floor(n.length/2)]);const l=s.programDateTime,c=i.programDateTime;if(!l||!c)return;const d=(c-l)/1e3-(i.start-s.start);M0t(d,t)}function Tu(t,e,n){fh(t,e,n),t.addEventListener(e,n)}function fh(t,e,n){t.removeEventListener(e,n)}const THn={toString:function(t){let e="";const n=t.length;for(let r=0;r<n;r++)e+=`[${t.start(r).toFixed(3)}-${t.end(r).toFixed(3)}]`;return e}},Mt={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};let pTe=class extends b0t{constructor(e,n,r,s,i){super(s,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=Mt.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=0,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:o,fragCurrent:l,media:c,mediaBuffer:d,state:u}=this,h=c?c.currentTime:0,m=$s.bufferInfo(d||c,h,o.maxBufferHole),f=!m.len;if(this.log(`Media seeking to ${$n(h)?h.toFixed(3):h}, state: ${u}, ${f?"out of":"in"} buffer`),this.state===Mt.ENDED)this.resetLoadingState();else if(l){const p=o.maxFragLookUpTolerance,g=l.start-p,v=l.start+l.duration+p;if(f||v<m.start||g>m.end){const b=h>v;(h<g||b)&&(b&&l.loader&&(this.log(`Cancelling fragment load for seek (sn: ${l.sn})`),l.abortRequests(),this.resetLoadingState()),this.fragPrevious=null)}}if(c){this.fragmentTracker.removeFragmentsInRange(h,1/0,this.playlistType,!0);const p=this.lastCurrentTime;if(h>p&&(this.lastCurrentTime=h),!this.loadingParts){const g=Math.max(m.end,h),v=this.shouldLoadParts(this.getLevelDetails(),g);v&&(this.log(`LL-Part loading ON after seeking to ${h.toFixed(2)} with buffer @${g.toFixed(2)}`),this.loadingParts=v)}}this.hls.hasEnoughToStart||(this.log(`Setting ${f?"startPosition":"nextLoadPosition"} to ${h} for seek without enough to start`),this.nextLoadPosition=h,f&&(this.startPosition=h)),f&&this.state===Mt.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=i,this.hls=e,this.fragmentLoader=new nHn(e.config),this.keyLoader=r,this.fragmentTracker=n,this.config=e.config,this.decrypter=new uTe(e.config)}registerListeners(){const{hls:e}=this;e.on(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(ue.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(ue.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===Mt.STOPPED)return;this.fragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=Mt.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:n}=this;return n===-1&&e?e:n}get bufferingEnabled(){return this.buffering}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,n){if(n.live||!this.media)return!1;const r=e.end||0,s=this.config.timelineOffset||0;if(r<=s)return!1;const i=e.buffered;this.config.maxBufferHole&&i&&i.length>1&&(e=$s.bufferedInfo(i,e.start,0));const o=e.nextStart;if(o&&o>s&&o<n.edge||this.media.currentTime<e.start)return!1;const c=n.partList;if(c!=null&&c.length){const u=c[c.length-1];return $s.isBuffered(this.media,u.start+u.duration/2)}const d=n.fragments[n.fragments.length-1].type;return this.fragmentTracker.isEndListAppended(d)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.details}get timelineOffset(){const e=this.config.timelineOffset;if(e){var n;return((n=this.getLevelDetails())==null?void 0:n.appliedTimelineOffset)||e}return 0}onMediaAttached(e,n){const r=this.media=this.mediaBuffer=n.media;Tu(r,"seeking",this.onMediaSeeking),Tu(r,"ended",this.onMediaEnded);const s=this.config;this.levels&&s.autoStartLoad&&this.state===Mt.STOPPED&&this.startLoad(s.startPosition)}onMediaDetaching(e,n){const r=!!n.transferMedia,s=this.media;if(s!==null){if(s.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),fh(s,"seeking",this.onMediaSeeking),fh(s,"ended",this.onMediaEnded),this.keyLoader&&!r&&this.keyLoader.detach(),this.media=this.mediaBuffer=null,this.loopSn=void 0,r){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=this.startPosition=0,this.startFragRequested=!1}onError(e,n){}onManifestLoaded(e,n){this.startTimeOffset=n.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=Mt.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.log=this.warn=this.decrypter=this.keyLoader=this.fragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,n,r){this.startFragRequested=!0,this._loadFragForPlayback(e,n,r)}_loadFragForPlayback(e,n,r){const s=i=>{const o=i.frag;if(this.fragContextChanged(o)){this.warn(`${o.type} sn: ${o.sn}${i.part?" part: "+i.part.index:""} of ${this.fragInfo(o,!1,i.part)}) was dropped during download.`),this.fragmentTracker.removeFragment(o);return}o.stats.chunkCount++,this._handleFragmentLoadProgress(i)};this._doFragLoad(e,n,r,s).then(i=>{if(!i)return;const o=this.state,l=i.frag;if(this.fragContextChanged(l)){(o===Mt.FRAG_LOADING||!this.fragCurrent&&o===Mt.PARSING)&&(this.fragmentTracker.removeFragment(l),this.state=Mt.IDLE);return}"payload"in i&&(this.log(`Loaded ${l.type} sn: ${l.sn} of ${this.playlistLabel()} ${l.level}`),this.hls.trigger(ue.FRAG_LOADED,i)),this._handleFragmentLoadComplete(i)}).catch(i=>{this.state===Mt.STOPPED||this.state===Mt.ERROR||(this.warn(`Frag error: ${(i==null?void 0:i.message)||i}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var n;const{fragmentTracker:r}=this;if(r.getState(e)===hc.APPENDING){const i=e.type,o=this.getFwdBufferInfo(this.mediaBuffer,i),l=Math.max(e.duration,o?o.len:this.config.maxBufferLength),c=this.backtrackFragment;((c?e.sn-c.sn:0)===1||this.reduceMaxBufferLength(l,e.duration))&&r.removeFragment(e)}else((n=this.mediaBuffer)==null?void 0:n.buffered.length)===0?r.removeAllFragments():r.hasParts(e.type)&&(r.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),r.getState(e)===hc.PARTIAL&&r.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const n=e.fragments[e.fragments.length-1];this.fragmentTracker.detectPartialFragments({frag:n,part:null,stats:n.stats,id:n.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const n=e.details;return(n==null?void 0:n.live)&&n.type!=="EVENT"&&(this.levelLastLoaded!==e||n.expired)}flushMainBuffer(e,n,r=null){if(!(e-n))return;const s={startOffset:e,endOffset:n,type:r};this.hls.trigger(ue.BUFFER_FLUSHING,s)}_loadInitSegment(e,n){this._doFragLoad(e,n).then(r=>{const s=r==null?void 0:r.frag;if(!s||this.fragContextChanged(s)||!this.levels)throw new Error("init load aborted");return r}).then(r=>{const{hls:s}=this,{frag:i,payload:o}=r,l=i.decryptdata;if(o&&o.byteLength>0&&l!=null&&l.key&&l.iv&&tP(l.method)){const c=self.performance.now();return this.decrypter.decrypt(new Uint8Array(o),l.key.buffer,l.iv.buffer,mTe(l.method)).catch(d=>{throw s.trigger(ue.ERROR,{type:ur.MEDIA_ERROR,details:dt.FRAG_DECRYPT_ERROR,fatal:!1,error:d,reason:d.message,frag:i}),d}).then(d=>{const u=self.performance.now();return s.trigger(ue.FRAG_DECRYPTED,{frag:i,payload:d,stats:{tstart:c,tdecrypt:u}}),r.payload=d,this.completeInitSegmentLoad(r)})}return this.completeInitSegmentLoad(r)}).catch(r=>{this.state===Mt.STOPPED||this.state===Mt.ERROR||(this.warn(r),this.resetFragmentLoading(e))})}completeInitSegmentLoad(e){const{levels:n}=this;if(!n)throw new Error("init load aborted, missing levels");const r=e.frag.stats;this.state!==Mt.STOPPED&&(this.state=Mt.IDLE),e.frag.data=new Uint8Array(e.payload),r.parsing.start=r.buffering.start=self.performance.now(),r.parsing.end=r.buffering.end=self.performance.now(),this.tick()}unhandledEncryptionError(e,n){var r,s;const i=e.tracks;if(i&&!n.encrypted&&((r=i.audio)!=null&&r.encrypted||(s=i.video)!=null&&s.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const o=this.media,l=new Error(`Encrypted track with no key in ${this.fragInfo(n)} (media ${o?"attached mediaKeys: "+o.mediaKeys:"detached"})`);return this.warn(l.message),!o||o.mediaKeys?!1:(this.hls.trigger(ue.ERROR,{type:ur.KEY_SYSTEM_ERROR,details:dt.KEY_SYSTEM_NO_KEYS,fatal:!1,error:l,frag:n}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){const{fragCurrent:n}=this;return!e||!n||e.sn!==n.sn||e.level!==n.level}fragBufferedComplete(e,n){const r=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${n?" part: "+n.index:""} of ${this.fragInfo(e,!1,n)} > buffer:${r?THn.toString($s.getBuffered(r)):"(detached)"})`),xl(e)){var s;if(e.type!==Yn.SUBTITLE){const o=e.elementaryStreams;if(!Object.keys(o).some(l=>!!o[l])){this.state=Mt.IDLE;return}}const i=(s=this.levels)==null?void 0:s[e.level];i!=null&&i.fragmentError&&(this.log(`Resetting level fragment error count of ${i.fragmentError} on frag buffered`),i.fragmentError=0)}this.state=Mt.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:n}=this;if(!n)return;const{frag:r,part:s,partsLoaded:i}=e,o=!i||i.length===0||i.some(c=>!c),l=new hTe(r.level,r.sn,r.stats.chunkCount+1,0,s?s.index:-1,!o);n.flush(l)}_handleFragmentLoadProgress(e){}_doFragLoad(e,n,r=null,s){var i;this.fragCurrent=e;const o=n.details;if(!this.levels||!o)throw new Error(`frag load aborted, missing level${o?"":" detail"}s`);let l=null;if(e.encrypted&&!((i=e.decryptdata)!=null&&i.key)){if(this.log(`Loading key for ${e.sn} of [${o.startSN}-${o.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=Mt.KEY_LOADING,this.fragCurrent=e,l=this.keyLoader.load(e).then(m=>{if(!this.fragContextChanged(m.frag))return this.hls.trigger(ue.KEY_LOADED,m),this.state===Mt.KEY_LOADING&&(this.state=Mt.IDLE),m}),this.hls.trigger(ue.KEY_LOADING,{frag:e}),this.fragCurrent===null)return this.log("context changed in KEY_LOADING"),Promise.resolve(null)}else e.encrypted||(l=this.keyLoader.loadClear(e,o.encryptedFragments,this.startFragRequested),l&&this.log("[eme] blocking frag load until media-keys acquired"));const c=this.fragPrevious;if(xl(e)&&(!c||e.sn!==c.sn)){const m=this.shouldLoadParts(n.details,e.end);m!==this.loadingParts&&(this.log(`LL-Part loading ${m?"ON":"OFF"} loading sn ${c==null?void 0:c.sn}->${e.sn}`),this.loadingParts=m)}if(r=Math.max(e.start,r||0),this.loadingParts&&xl(e)){const m=o.partList;if(m&&s){r>o.fragmentEnd&&o.fragmentHint&&(e=o.fragmentHint);const f=this.getNextPart(m,e,r);if(f>-1){const p=m[f];e=this.fragCurrent=p.fragment,this.log(`Loading ${e.type} sn: ${e.sn} part: ${p.index} (${f}/${m.length-1}) of ${this.fragInfo(e,!1,p)}) cc: ${e.cc} [${o.startSN}-${o.endSN}], target: ${parseFloat(r.toFixed(3))}`),this.nextLoadPosition=p.start+p.duration,this.state=Mt.FRAG_LOADING;let g;return l?g=l.then(v=>!v||this.fragContextChanged(v.frag)?null:this.doFragPartsLoad(e,p,n,s)).catch(v=>this.handleFragLoadError(v)):g=this.doFragPartsLoad(e,p,n,s).catch(v=>this.handleFragLoadError(v)),this.hls.trigger(ue.FRAG_LOADING,{frag:e,part:p,targetBufferTime:r}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):g}else if(!e.url||this.loadedEndOfParts(m,r))return Promise.resolve(null)}}if(xl(e)&&this.loadingParts){var d;this.log(`LL-Part loading OFF after next part miss @${r.toFixed(2)} Check buffer at sn: ${e.sn} loaded parts: ${(d=o.partList)==null?void 0:d.filter(m=>m.loaded).map(m=>`[${m.start}-${m.end}]`)}`),this.loadingParts=!1}else if(!e.url)return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)}) cc: ${e.cc} ${"["+o.startSN+"-"+o.endSN+"]"}, target: ${parseFloat(r.toFixed(3))}`),$n(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Mt.FRAG_LOADING;const u=this.config.progressive&&e.type!==Yn.SUBTITLE;let h;return u&&l?h=l.then(m=>!m||this.fragContextChanged(m.frag)?null:this.fragmentLoader.load(e,s)).catch(m=>this.handleFragLoadError(m)):h=Promise.all([this.fragmentLoader.load(e,u?s:void 0),l]).then(([m])=>(!u&&s&&s(m),m)).catch(m=>this.handleFragLoadError(m)),this.hls.trigger(ue.FRAG_LOADING,{frag:e,targetBufferTime:r}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):h}doFragPartsLoad(e,n,r,s){return new Promise((i,o)=>{var l;const c=[],d=(l=r.details)==null?void 0:l.partList,u=h=>{this.fragmentLoader.loadPart(e,h,s).then(m=>{c[h.index]=m;const f=m.part;this.hls.trigger(ue.FRAG_LOADED,m);const p=i9e(r.details,e.sn,h.index+1)||R0t(d,e.sn,h.index+1);if(p)u(p);else return i({frag:e,part:f,partsLoaded:c})}).catch(o)};u(n)})}handleFragLoadError(e){if("data"in e){const n=e.data;n.frag&&n.details===dt.INTERNAL_ABORTED?this.handleFragLoadAborted(n.frag,n.part):n.frag&&n.type===ur.KEY_SYSTEM_ERROR?(n.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(n.frag)):this.hls.trigger(ue.ERROR,n)}else this.hls.trigger(ue.ERROR,{type:ur.OTHER_ERROR,details:dt.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const n=this.getCurrentContext(e);if(!n||this.state!==Mt.PARSING){!this.fragCurrent&&this.state!==Mt.STOPPED&&this.state!==Mt.ERROR&&(this.state=Mt.IDLE);return}const{frag:r,part:s,level:i}=n,o=self.performance.now();r.stats.parsing.end=o,s&&(s.stats.parsing.end=o);const l=this.getLevelDetails(),d=l&&r.sn>l.endSN||this.shouldLoadParts(l,r.end);d!==this.loadingParts&&(this.log(`LL-Part loading ${d?"ON":"OFF"} after parsing segment ending @${r.end.toFixed(2)}`),this.loadingParts=d),this.updateLevelTiming(r,s,i,e.partial)}shouldLoadParts(e,n){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList){var r;const i=e.partList[0];if(i.fragment.type===Yn.SUBTITLE)return!1;const o=i.end+(((r=e.fragmentHint)==null?void 0:r.duration)||0);if(n>=o){var s;if((this.hls.hasEnoughToStart?((s=this.media)==null?void 0:s.currentTime)||this.lastCurrentTime:this.getLoadPosition())>i.start-i.fragment.duration)return!0}}}return!1}getCurrentContext(e){const{levels:n,fragCurrent:r}=this,{level:s,sn:i,part:o}=e;if(!(n!=null&&n[s]))return this.warn(`Levels object was unset while buffering fragment ${i} of ${this.playlistLabel()} ${s}. The current chunk will not be buffered.`),null;const l=n[s],c=l.details,d=o>-1?i9e(c,i,o):null,u=d?d.fragment:P0t(c,i,r);return u?(r&&r!==u&&(u.stats=r.stats),{frag:u,part:d,level:l}):null}bufferFragmentData(e,n,r,s,i){if(this.state!==Mt.PARSING)return;const{data1:o,data2:l}=e;let c=o;if(l&&(c=Gf(o,l)),!c.length)return;const d=this.initPTS[n.cc],u=d?-d.baseTime/d.timescale:void 0,h={type:e.type,frag:n,part:r,chunkMeta:s,offset:u,parent:n.type,data:c};if(this.hls.trigger(ue.BUFFER_APPENDING,h),e.dropped&&e.independent&&!r){if(i)return;this.flushBufferGap(n)}}flushBufferGap(e){const n=this.media;if(!n)return;if(!$s.isBuffered(n,n.currentTime)){this.flushMainBuffer(0,e.start);return}const r=n.currentTime,s=$s.bufferInfo(n,r,0),i=e.duration,o=Math.min(this.config.maxFragLookUpTolerance*2,i*.25),l=Math.max(Math.min(e.start-o,s.end-o),r+o);e.start-l>o&&this.flushMainBuffer(l,e.start)}getFwdBufferInfo(e,n){var r;const s=this.getLoadPosition();if(!$n(s))return null;const o=this.lastCurrentTime>s||(r=this.media)!=null&&r.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,s,n,o)}getFwdBufferInfoAtPos(e,n,r,s){const i=$s.bufferInfo(e,n,s);if(i.len===0&&i.nextStart!==void 0){const o=this.fragmentTracker.getBufferedFrag(n,r);if(o&&(i.nextStart<=o.end||o.gap)){const l=Math.max(Math.min(i.nextStart,o.end)-n,s);return $s.bufferInfo(e,n,l)}}return i}getMaxBufferLength(e){const{config:n}=this;let r;return e?r=Math.max(8*n.maxBufferSize/e,n.maxBufferLength):r=n.maxBufferLength,Math.min(r,n.maxMaxBufferLength)}exceedsMaxBuffer(e,n,r){const s=e.nextStart;if(s&&r.start>s){const i=e.buffered;if(i){let o=e.len;const l=e.bufferedIndex;for(let c=i.length-1;c>l;c--)i[c].start<r.start&&(o+=i[c].end-i[c].start);return o>=n}}return!1}reduceMaxBufferLength(e,n){const r=this.config,s=Math.max(Math.min(e-n,r.maxBufferLength),n),i=Math.max(e-n*3,r.maxMaxBufferLength/2,s);return i>=s?(r.maxMaxBufferLength=i,this.warn(`Reduce max buffer length to ${i}s`),!0):!1}getAppendedFrag(e,n=Yn.MAIN){const r=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,n):null;return r&&"fragment"in r?r.fragment:r}getNextFragment(e,n){const r=n.fragments,s=r.length;if(!s)return null;const{config:i}=this,o=n.fragmentStart,l=i.lowLatencyMode&&!!n.partList;let c=null;if(n.live){const h=i.initialLiveManifestSize;if(s<h)return this.warn(`Not enough fragments to start playback (have: ${s}, need: ${h})`),null;if(!n.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<o){var d;l&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),c=this.getInitialLiveFragment(n);const m=this.config.startPosition,f=this.hls.startPosition,p=this.hls.liveSyncPosition,g=((d=c)==null?void 0:d.start)||0;let v,b;f!==-1&&f>=o?(v=f,b=f===m?"config":"next load start"):p!==null?(v=p,b="live edge"):(v=e,b="buffer pos"),v<g&&(v=g,b="live frag start"),v<o&&(v=o,b="playlist start"),(this.startPosition!=v||this.nextLoadPosition!=v)&&(this.log(`Setting startPosition to ${v.toFixed(3)} ${f===-1?"":`(from ${m}) `}based on ${b}. live edge: ${p} live frag start: ${g.toFixed(3)} playlist start: ${o.toFixed(3)} buffer pos: ${e}`),this.startPosition=this.nextLoadPosition=v)}}else e<=o&&(c=r[0]);if(!c){const h=this.loadingParts?n.partEnd:n.fragmentEnd;c=this.getFragmentAtPosition(e,h,n)}let u=this.filterReplacedPrimary(c,n);if(!u&&c){const h=c.sn-n.startSN;u=this.filterReplacedPrimary(r[h+1]||null,n)}return this.mapToInitFragWhenRequired(u)}isLoopLoading(e,n){if(this.nextLoadPosition<=n)return!1;const r=this.fragmentTracker.getState(e);return r===hc.OK||r===hc.PARTIAL&&!!e.gap}getNextFragmentLoopLoading(e,n,r,s,i){let o=null;if(e.gap&&(o=this.getNextFragment(this.nextLoadPosition,n),o&&!o.gap&&r.nextStart)){const l=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,r.nextStart,s,0);if(l!==null&&r.len+l.len>=i){const c=o.sn;return this.loopSn!==c&&(this.log(`buffer full after gaps in "${s}" playlist starting at sn: ${c}`),this.loopSn=c),null}}return this.loopSn=void 0,o}get primaryPrefetch(){if(l9e(this.config)){var e;if((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,n){if(!e)return e;if(l9e(this.config)&&e.type!==Yn.SUBTITLE){const r=this.hls.interstitialsManager,s=r==null?void 0:r.bufferingItem;if(s){const o=s.event;if(o){if(o.appendInPlace||Math.abs(e.start-s.start)>1||s.start===0)return null}else if(e.end<=s.start&&(n==null?void 0:n.live)===!1||e.start>s.end&&s.nextEvent&&(s.nextEvent.appendInPlace||e.start-s.end>1))return null}const i=r==null?void 0:r.playerQueue;if(i)for(let o=i.length;o--;){const l=i[o].interstitial;if(l.appendInPlace&&e.start>=l.startTime&&e.end<=l.resumeTime)return null}}return e}mapToInitFragWhenRequired(e){return e!=null&&e.initSegment&&!e.initSegment.data&&!this.bitrateTest?e.initSegment:e}getNextPart(e,n,r){let s=-1,i=!1,o=!0;for(let l=0,c=e.length;l<c;l++){const d=e[l];if(o=o&&!d.independent,s>-1&&r<d.start)break;const u=d.loaded;u?s=-1:(i||(d.independent||o)&&d.fragment===n)&&(d.fragment!==n&&this.warn(`Need buffer at ${r} but next unloaded part starts at ${d.start}`),s=l),i=u}return s}loadedEndOfParts(e,n){let r;for(let s=e.length;s--;){if(r=e[s],!r.loaded)return!1;if(n>r.start)return!0}return!1}getInitialLiveFragment(e){const n=e.fragments,r=this.fragPrevious;let s=null;if(r){if(e.hasProgramDateTime&&(s=HVn(n,r.endProgramDateTime,this.config.maxFragLookUpTolerance),s&&this.log(`Live playlist, switching playlist, load frag with same PDT: ${r.programDateTime}`)),!s){const i=r.sn+1;if(i>=e.startSN&&i<=e.endSN){const o=n[i-e.startSN];r.cc===o.cc&&(s=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${s.sn}`))}s||(s=g0t(e,r.cc,r.end),s&&this.log(`Live playlist, switching playlist, load frag with same CC: ${s.sn}`))}}else{const i=this.hls.liveSyncPosition;i!==null&&(s=this.getFragmentAtPosition(i,this.bitrateTest?e.fragmentEnd:e.edge,e))}return s}getFragmentAtPosition(e,n,r){const{config:s}=this;let{fragPrevious:i}=this,{fragments:o,endSN:l}=r;const{fragmentHint:c}=r,{maxFragLookUpTolerance:d}=s,u=r.partList,h=!!(this.loadingParts&&u!=null&&u.length&&c);h&&!this.bitrateTest&&u[u.length-1].fragment.sn===c.sn&&(o=o.concat(c),l=c.sn);let m;if(e<n){var f;const g=e<this.lastCurrentTime||e>n-d||(f=this.media)!=null&&f.paused||!this.startFragRequested?0:d;m=V2(i,o,e,g)}else m=o[o.length-1];if(m){const p=m.sn-r.startSN,g=this.fragmentTracker.getState(m);if((g===hc.OK||g===hc.PARTIAL&&m.gap)&&(i=m),i&&m.sn===i.sn&&(!h||u[0].fragment.sn>m.sn||!r.live)&&m.level===i.level){const b=o[p+1];m.sn<l&&this.fragmentTracker.getState(b)!==hc.OK?m=b:m=null}}return m}alignPlaylists(e,n,r){const s=e.fragments.length;if(!s)return this.warn("No fragments in live playlist"),0;const i=e.fragmentStart,o=!n,l=e.alignedSliding&&$n(i);if(o||!l&&!i){NHn(r,e);const c=e.fragmentStart;return this.log(`Live playlist sliding: ${c.toFixed(2)} start-sn: ${n?n.startSN:"na"}->${e.startSN} fragments: ${s}`),c}return i}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,n){let r=this.startPosition;r<n&&(r=-1);const s=this.timelineOffset;if(r===-1){const i=this.startTimeOffset!==null,o=i?this.startTimeOffset:e.startTimeOffset;o!==null&&$n(o)?(r=n+o,o<0&&(r+=e.edge),r=Math.min(Math.max(n,r),n+e.totalduration),this.log(`Setting startPosition to ${r} for start time offset ${o} found in ${i?"multivariant":"media"} playlist`),this.startPosition=r):e.live?(r=this.hls.liveSyncPosition||n,this.log(`Setting startPosition to -1 to start at live edge ${r}`),this.startPosition=-1):(this.log("setting startPosition to 0 by default"),this.startPosition=r=0),this.lastCurrentTime=r+s}this.nextLoadPosition=r+s}getLoadPosition(){var e;const{media:n}=this;let r=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&n?r=n.currentTime:this.nextLoadPosition>=0&&(r=this.nextLoadPosition),r}handleFragLoadAborted(e,n){this.transmuxer&&e.type===this.playlistType&&xl(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${n?" part "+n.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==Mt.FRAG_LOADING_WAITING_RETRY)&&(this.state=Mt.IDLE)}onFragmentOrKeyLoadError(e,n){var r;if(n.chunkMeta&&!n.frag){const b=this.getCurrentContext(n.chunkMeta);b&&(n.frag=b.frag)}const s=n.frag;if(!s||s.type!==e||!this.levels)return;if(this.fragContextChanged(s)){var i;this.warn(`Frag load error must match current frag to retry ${s.url} > ${(i=this.fragCurrent)==null?void 0:i.url}`);return}const o=n.details===dt.FRAG_GAP;o&&this.fragmentTracker.fragBuffered(s,!0);const l=n.errorAction;if(!l){this.state=Mt.ERROR;return}const{action:c,flags:d,retryCount:u=0,retryConfig:h}=l,m=!!h,f=m&&c===ad.RetryRequest,p=m&&!l.resolved&&d===Yh.MoveAllAlternatesMatchingHost,g=(r=this.hls.latestLevelDetails)==null?void 0:r.live;if(!f&&p&&xl(s)&&!s.endList&&g&&!y0t(n))this.resetFragmentErrors(e),this.treatAsGap(s),l.resolved=!0;else if((f||p)&&u<h.maxNumRetry){var v;const b=Rbe((v=n.response)==null?void 0:v.code),x=dTe(h,u);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+x,this.state=Mt.FRAG_LOADING_WAITING_RETRY,l.resolved=!0,b){this.log("Waiting for connection (offline)"),this.retryDate=1/0,n.reason="offline";return}this.warn(`Fragment ${s.sn} of ${e} ${s.level} errored with ${n.details}, retrying loading ${u+1}/${h.maxNumRetry} in ${x}ms`)}else if(h)if(this.resetFragmentErrors(e),u<h.maxNumRetry)!o&&c!==ad.RemoveAlternatePermanently&&(l.resolved=!0);else{this.warn(`${n.details} reached or exceeded max retry (${u})`);return}else c===ad.SendAlternateToPenaltyBox?this.state=Mt.WAITING_LEVEL:this.state=Mt.ERROR;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),n=this.retryDate,r=n===1/0;(!n||e>=n||r&&!Rbe(0))&&(r&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=Mt.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===Mt.PARSING||this.state===Mt.PARSED){const n=e.frag,r=e.parent,s=this.getFwdBufferInfo(this.mediaBuffer,r),i=s&&s.len>.5;i&&this.reduceMaxBufferLength(s.len,(n==null?void 0:n.duration)||10);const o=!i;return o&&this.warn(`Buffer full error while media.currentTime (${this.getLoadPosition()}) is not buffered, flush ${r} buffer`),n&&(this.fragmentTracker.removeFragment(n),this.nextLoadPosition=n.start),this.resetLoadingState(),o}return!1}resetFragmentErrors(e){e===Yn.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==Mt.STOPPED&&(this.state=Mt.IDLE)}afterBufferFlushed(e,n,r){if(!e)return;const s=$s.getBuffered(e);this.fragmentTracker.detectEvictedFragments(n,s,r),this.state===Mt.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==Mt.STOPPED&&(this.state=Mt.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.levelLastLoaded,n=e?e.details:null;n!=null&&n.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(n,n.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?"<removed>":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,n,r,s){const i=r.details;if(!i){this.warn("level.details undefined");return}if(!Object.keys(e.elementaryStreams).reduce((c,d)=>{const u=e.elementaryStreams[d];if(u){const h=u.endPTS-u.startPTS;if(h<=0)return this.warn(`Could not parse fragment ${e.sn} ${d} duration reliably (${h})`),c||!1;const m=s?0:T0t(i,e,u.startPTS,u.endPTS,u.startDTS,u.endDTS,this);return this.hls.trigger(ue.LEVEL_PTS_UPDATED,{details:i,level:r,drift:m,type:d,frag:e,start:u.startPTS,end:u.endPTS}),!0}return c},!1)){var l;const c=((l=this.transmuxer)==null?void 0:l.error)===null;if((r.fragmentError===0||c&&(r.fragmentError<2||e.endList))&&this.treatAsGap(e,r),c){const d=new Error(`Found no media in fragment ${e.sn} of ${this.playlistLabel()} ${e.level} resetting transmuxer to fallback to playlist timing`);if(this.warn(d.message),this.hls.trigger(ue.ERROR,{type:ur.MEDIA_ERROR,details:dt.FRAG_PARSING_ERROR,fatal:!1,error:d,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${r.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=Mt.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${n?" part: "+n.index:""} of ${this.fragInfo(e,!1,n)})`),this.hls.trigger(ue.FRAG_PARSED,{frag:e,part:n})}playlistLabel(){return this.playlistType===Yn.MAIN?"level":"track"}fragInfo(e,n=!0,r){var s,i;return`${this.playlistLabel()} ${e.level} (${r?"part":"frag"}:[${((s=n&&!r?e.startPTS:(r||e).start)!=null?s:NaN).toFixed(3)}-${((i=n&&!r?e.endPTS:(r||e).end)!=null?i:NaN).toFixed(3)}]${r&&e.type==="main"?"INDEPENDENT="+(r.independent?"YES":"NO"):""}`}treatAsGap(e,n){n&&n.fragmentError++,e.gap=!0,this.fragmentTracker.removeFragment(e),this.fragmentTracker.fragBuffered(e,!0)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const n=this._state;n!==e&&(this._state=e,this.log(`${n}->${e}`))}get state(){return this._state}};function l9e(t){return!!t.interstitialsController&&t.enableInterstitialPlayback!==!1}let D0t=class{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:n}=this;let r;if(e.length)e.length===1?r=e[0]:r=_Hn(e,n);else return new Uint8Array(0);return this.reset(),r}reset(){this.chunks.length=0,this.dataLength=0}};function _Hn(t,e){const n=new Uint8Array(e);let r=0;for(let s=0;s<t.length;s++){const i=t[s];n.set(i,r),r+=i.length}return n}var Hce={exports:{}},c9e;function AHn(){return c9e||(c9e=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(c,d,u){this.fn=c,this.context=d,this.once=u||!1}function i(c,d,u,h,m){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new s(u,h||c,m),p=n?n+d:d;return c._events[p]?c._events[p].fn?c._events[p]=[c._events[p],f]:c._events[p].push(f):(c._events[p]=f,c._eventsCount++),c}function o(c,d){--c._eventsCount===0?c._events=new r:delete c._events[d]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var d=[],u,h;if(this._eventsCount===0)return d;for(h in u=this._events)e.call(u,h)&&d.push(n?h.slice(1):h);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(u)):d},l.prototype.listeners=function(d){var u=n?n+d:d,h=this._events[u];if(!h)return[];if(h.fn)return[h.fn];for(var m=0,f=h.length,p=new Array(f);m<f;m++)p[m]=h[m].fn;return p},l.prototype.listenerCount=function(d){var u=n?n+d:d,h=this._events[u];return h?h.fn?1:h.length:0},l.prototype.emit=function(d,u,h,m,f,p){var g=n?n+d:d;if(!this._events[g])return!1;var v=this._events[g],b=arguments.length,x,w;if(v.fn){switch(v.once&&this.removeListener(d,v.fn,void 0,!0),b){case 1:return v.fn.call(v.context),!0;case 2:return v.fn.call(v.context,u),!0;case 3:return v.fn.call(v.context,u,h),!0;case 4:return v.fn.call(v.context,u,h,m),!0;case 5:return v.fn.call(v.context,u,h,m,f),!0;case 6:return v.fn.call(v.context,u,h,m,f,p),!0}for(w=1,x=new Array(b-1);w<b;w++)x[w-1]=arguments[w];v.fn.apply(v.context,x)}else{var k=v.length,S;for(w=0;w<k;w++)switch(v[w].once&&this.removeListener(d,v[w].fn,void 0,!0),b){case 1:v[w].fn.call(v[w].context);break;case 2:v[w].fn.call(v[w].context,u);break;case 3:v[w].fn.call(v[w].context,u,h);break;case 4:v[w].fn.call(v[w].context,u,h,m);break;default:if(!x)for(S=1,x=new Array(b-1);S<b;S++)x[S-1]=arguments[S];v[w].fn.apply(v[w].context,x)}}return!0},l.prototype.on=function(d,u,h){return i(this,d,u,h,!1)},l.prototype.once=function(d,u,h){return i(this,d,u,h,!0)},l.prototype.removeListener=function(d,u,h,m){var f=n?n+d:d;if(!this._events[f])return this;if(!u)return o(this,f),this;var p=this._events[f];if(p.fn)p.fn===u&&(!m||p.once)&&(!h||p.context===h)&&o(this,f);else{for(var g=0,v=[],b=p.length;g<b;g++)(p[g].fn!==u||m&&!p[g].once||h&&p[g].context!==h)&&v.push(p[g]);v.length?this._events[f]=v.length===1?v[0]:v:o(this,f)}return this},l.prototype.removeAllListeners=function(d){var u;return d?(u=n?n+d:d,this._events[u]&&o(this,u)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,t.exports=l}(Hce)),Hce.exports}var PHn=AHn(),gTe=nVn(PHn);const _6="1.6.16",$R={};function RHn(){return typeof __HLS_WORKER_BUNDLE__=="function"}function IHn(){const t=$R[_6];if(t)return t.clientCount++,t;const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),n=self.URL.createObjectURL(e),s={worker:new self.Worker(n),objectURL:n,clientCount:1};return $R[_6]=s,s}function MHn(t){const e=$R[t];if(e)return e.clientCount++,e;const n=new self.URL(t,self.location.href).href,s={worker:new self.Worker(n),scriptURL:n,clientCount:1};return $R[t]=s,s}function LHn(t){const e=$R[t||_6];if(e&&e.clientCount--===1){const{worker:r,objectURL:s}=e;delete $R[t||_6],s&&self.URL.revokeObjectURL(s),r.terminate()}}function $0t(t,e){return e+10<=t.length&&t[e]===51&&t[e+1]===68&&t[e+2]===73&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128}function vTe(t,e){return e+10<=t.length&&t[e]===73&&t[e+1]===68&&t[e+2]===51&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128}function gre(t,e){let n=0;return n=(t[e]&127)<<21,n|=(t[e+1]&127)<<14,n|=(t[e+2]&127)<<7,n|=t[e+3]&127,n}function A6(t,e){const n=e;let r=0;for(;vTe(t,e);){r+=10;const s=gre(t,e+6);r+=s,$0t(t,e+10)&&(r+=10),e+=r}if(r>0)return t.subarray(n,n+r)}function DHn(t,e,n,r){const s=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],i=e[n+2],o=i>>2&15;if(o>12){const f=new Error(`invalid ADTS sampling index:${o}`);t.emit(ue.ERROR,ue.ERROR,{type:ur.MEDIA_ERROR,details:dt.FRAG_PARSING_ERROR,fatal:!0,error:f,reason:f.message});return}const l=(i>>6&3)+1,c=e[n+3]>>6&3|(i&1)<<2,d="mp4a.40."+l,u=s[o];let h=o;(l===5||l===29)&&(h-=3);const m=[l<<3|(h&14)>>1,(h&1)<<7|c<<3];return Ui.log(`manifest codec:${r}, parsed codec:${d}, channels:${c}, rate:${u} (ADTS object type:${l} sampling index:${o})`),{config:m,samplerate:u,channelCount:c,codec:d,parsedCodec:d,manifestCodec:r}}function O0t(t,e){return t[e]===255&&(t[e+1]&246)===240}function F0t(t,e){return t[e+1]&1?7:9}function yTe(t,e){return(t[e+3]&3)<<11|t[e+4]<<3|(t[e+5]&224)>>>5}function $Hn(t,e){return e+5<t.length}function KQ(t,e){return e+1<t.length&&O0t(t,e)}function OHn(t,e){return $Hn(t,e)&&O0t(t,e)&&yTe(t,e)<=t.length-e}function FHn(t,e){if(KQ(t,e)){const n=F0t(t,e);if(e+n>=t.length)return!1;const r=yTe(t,e);if(r<=n)return!1;const s=e+r;return s===t.length||KQ(t,s)}return!1}function B0t(t,e,n,r,s){if(!t.samplerate){const i=DHn(e,n,r,s);if(!i)return;ra(t,i)}}function U0t(t){return 1024*9e4/t}function BHn(t,e){const n=F0t(t,e);if(e+n<=t.length){const r=yTe(t,e)-n;if(r>0)return{headerLength:n,frameLength:r}}}function z0t(t,e,n,r,s){const i=U0t(t.samplerate),o=r+s*i,l=BHn(e,n);let c;if(l){const{frameLength:h,headerLength:m}=l,f=m+h,p=Math.max(0,n+f-e.length);p?(c=new Uint8Array(f-m),c.set(e.subarray(n+m,e.length),0)):c=e.subarray(n+m,n+f);const g={unit:c,pts:o};return p||t.samples.push(g),{sample:g,length:f,missing:p}}const d=e.length-n;return c=new Uint8Array(d),c.set(e.subarray(n,e.length),0),{sample:{unit:c,pts:o},length:d,missing:-1}}function UHn(t,e){return vTe(t,e)&&gre(t,e+6)+10<=t.length-e}function zHn(t){return t instanceof ArrayBuffer?t:t.byteOffset==0&&t.byteLength==t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer}function Gce(t,e=0,n=1/0){return VHn(t,e,n,Uint8Array)}function VHn(t,e,n,r){const s=HHn(t);let i=1;"BYTES_PER_ELEMENT"in r&&(i=r.BYTES_PER_ELEMENT);const o=GHn(t)?t.byteOffset:0,l=(o+t.byteLength)/i,c=(o+e)/i,d=Math.floor(Math.max(0,Math.min(c,l))),u=Math.floor(Math.min(d+Math.max(n,0),l));return new r(s,d,u-d)}function HHn(t){return t instanceof ArrayBuffer?t:t.buffer}function GHn(t){return t&&t.buffer instanceof ArrayBuffer&&t.byteLength!==void 0&&t.byteOffset!==void 0}function WHn(t){const e={key:t.type,description:"",data:"",mimeType:null,pictureType:null},n=3;if(t.size<2)return;if(t.data[0]!==n){console.log("Ignore frame with unrecognized character encoding");return}const r=t.data.subarray(1).indexOf(0);if(r===-1)return;const s=km(Gce(t.data,1,r)),i=t.data[2+r],o=t.data.subarray(3+r).indexOf(0);if(o===-1)return;const l=km(Gce(t.data,3+r,o));let c;return s==="-->"?c=km(Gce(t.data,4+r+o)):c=zHn(t.data.subarray(4+r+o)),e.mimeType=s,e.pictureType=i,e.description=l,e.data=c,e}function qHn(t){if(t.size<2)return;const e=km(t.data,!0),n=new Uint8Array(t.data.subarray(e.length+1));return{key:t.type,info:e,data:n.buffer}}function KHn(t){if(t.size<2)return;if(t.type==="TXXX"){let n=1;const r=km(t.data.subarray(n),!0);n+=r.length+1;const s=km(t.data.subarray(n));return{key:t.type,info:r,data:s}}const e=km(t.data.subarray(1));return{key:t.type,info:"",data:e}}function YHn(t){if(t.type==="WXXX"){if(t.size<2)return;let n=1;const r=km(t.data.subarray(n),!0);n+=r.length+1;const s=km(t.data.subarray(n));return{key:t.type,info:r,data:s}}const e=km(t.data);return{key:t.type,info:"",data:e}}function QHn(t){return t.type==="PRIV"?qHn(t):t.type[0]==="W"?YHn(t):t.type==="APIC"?WHn(t):KHn(t)}function ZHn(t){const e=String.fromCharCode(t[0],t[1],t[2],t[3]),n=gre(t,4),r=10;return{type:e,size:n,data:t.subarray(r,r+n)}}const Zz=10,JHn=10;function V0t(t){let e=0;const n=[];for(;vTe(t,e);){const r=gre(t,e+6);t[e+5]>>6&1&&(e+=Zz),e+=Zz;const s=e+r;for(;e+JHn<s;){const i=ZHn(t.subarray(e)),o=QHn(i);o&&n.push(o),e+=i.size+Zz}$0t(t,e)&&(e+=Zz)}return n}function H0t(t){return t&&t.key==="PRIV"&&t.info==="com.apple.streaming.transportStreamTimestamp"}function XHn(t){if(t.data.byteLength===8){const e=new Uint8Array(t.data),n=e[3]&1;let r=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return r/=45,n&&(r+=4772185884e-2),Math.round(r)}}function bTe(t){const e=V0t(t);for(let n=0;n<e.length;n++){const r=e[n];if(H0t(r))return XHn(r)}}let lm=function(t){return t.audioId3="org.id3",t.dateRange="com.apple.quicktime.HLS",t.emsg="https://aomedia.org/emsg/ID3",t.misbklv="urn:misb:KLV:bin:1910.1",t}({});function zv(t="",e=9e4){return{type:t,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}let xTe=class{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,n,r,s){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,n){return!1}appendFrame(e,n,r){}demux(e,n){this.cachedData&&(e=Gf(this.cachedData,e),this.cachedData=null);let r=A6(e,0),s=r?r.length:0,i;const o=this._audioTrack,l=this._id3Track,c=r?bTe(r):void 0,d=e.length;for((this.basePTS===null||this.frameIndex===0&&$n(c))&&(this.basePTS=eGn(c,n,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),r&&r.length>0&&l.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:lm.audioId3,duration:Number.POSITIVE_INFINITY});s<d;){if(this.canParse(e,s)){const u=this.appendFrame(o,e,s);u?(this.frameIndex++,this.lastPTS=u.sample.pts,s+=u.length,i=s):s=d}else UHn(e,s)?(r=A6(e,s),l.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:lm.audioId3,duration:Number.POSITIVE_INFINITY}),s+=r.length,i=s):s++;if(s===d&&i!==d){const u=e.slice(i);this.cachedData?this.cachedData=Gf(this.cachedData,u):this.cachedData=u}}return{audioTrack:o,videoTrack:zv(),id3Track:l,textTrack:zv()}}demuxSampleAes(e,n,r){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const n=this.cachedData;return n&&(this.cachedData=null,this.demux(n,0)),{audioTrack:this._audioTrack,videoTrack:zv(),id3Track:this._id3Track,textTrack:zv()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}};const eGn=(t,e,n)=>{if($n(t))return t*90;const r=n?n.baseTime*9e4/n.timescale:0;return e*9e4+r};let Jz=null;const tGn=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],nGn=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],rGn=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],sGn=[0,1,1,4];function G0t(t,e,n,r,s){if(n+24>e.length)return;const i=W0t(e,n);if(i&&n+i.frameLength<=e.length){const o=i.samplesPerFrame*9e4/i.sampleRate,l=r+s*o,c={unit:e.subarray(n,n+i.frameLength),pts:l,dts:l};return t.config=[],t.channelCount=i.channelCount,t.samplerate=i.sampleRate,t.samples.push(c),{sample:c,length:i.frameLength,missing:0}}}function W0t(t,e){const n=t[e+1]>>3&3,r=t[e+1]>>1&3,s=t[e+2]>>4&15,i=t[e+2]>>2&3;if(n!==1&&s!==0&&s!==15&&i!==3){const o=t[e+2]>>1&1,l=t[e+3]>>6,c=n===3?3-r:r===3?3:4,d=tGn[c*14+s-1]*1e3,h=nGn[(n===3?0:n===2?1:2)*3+i],m=l===3?1:2,f=rGn[n][r],p=sGn[r],g=f*8*p,v=Math.floor(f*d/h+o)*p;if(Jz===null){const w=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);Jz=w?parseInt(w[1]):0}return!!Jz&&Jz<=87&&r===2&&d>=224e3&&l===0&&(t[e+3]=t[e+3]|128),{sampleRate:h,channelCount:m,frameLength:v,samplesPerFrame:g}}}function wTe(t,e){return t[e]===255&&(t[e+1]&224)===224&&(t[e+1]&6)!==0}function q0t(t,e){return e+1<t.length&&wTe(t,e)}function iGn(t,e){return wTe(t,e)&&4<=t.length-e}function K0t(t,e){if(e+1<t.length&&wTe(t,e)){const r=W0t(t,e);let s=4;r!=null&&r.frameLength&&(s=r.frameLength);const i=e+s;return i===t.length||q0t(t,i)}return!1}let aGn=class extends xTe{constructor(e,n){super(),this.observer=void 0,this.config=void 0,this.observer=e,this.config=n}resetInitSegment(e,n,r,s){super.resetInitSegment(e,n,r,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:n,duration:s,inputTimeScale:9e4,dropped:0}}static probe(e,n){if(!e)return!1;const r=A6(e,0);let s=(r==null?void 0:r.length)||0;if(K0t(e,s))return!1;for(let i=e.length;s<i;s++)if(FHn(e,s))return n.log("ADTS sync word found !"),!0;return!1}canParse(e,n){return OHn(e,n)}appendFrame(e,n,r){B0t(e,this.observer,n,r,e.manifestCodec);const s=z0t(e,n,r,this.basePTS,this.frameIndex);if(s&&s.missing===0)return s}};const Y0t=(t,e)=>{let n=0,r=5;e+=r;const s=new Uint32Array(1),i=new Uint32Array(1),o=new Uint8Array(1);for(;r>0;){o[0]=t[e];const l=Math.min(r,8),c=8-l;i[0]=4278190080>>>24+c<<c,s[0]=(o[0]&i[0])>>c,n=n?n<<l|s[0]:s[0],e+=1,r-=l}return n};let oGn=class extends xTe{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,n,r,s){super.resetInitSegment(e,n,r,s),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:n,duration:s,inputTimeScale:9e4,dropped:0}}canParse(e,n){return n+64<e.length}appendFrame(e,n,r){const s=Q0t(e,n,r,this.basePTS,this.frameIndex);if(s!==-1)return{sample:e.samples[e.samples.length-1],length:s,missing:0}}static probe(e){if(!e)return!1;const n=A6(e,0);if(!n)return!1;const r=n.length;return e[r]===11&&e[r+1]===119&&bTe(n)!==void 0&&Y0t(e,r)<16}};function Q0t(t,e,n,r,s){if(n+8>e.length||e[n]!==11||e[n+1]!==119)return-1;const i=e[n+4]>>6;if(i>=3)return-1;const l=[48e3,44100,32e3][i],c=e[n+4]&63,u=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][c*3+i]*2;if(n+u>e.length)return-1;const h=e[n+6]>>5;let m=0;h===2?m+=2:(h&1&&h!==1&&(m+=2),h&4&&(m+=2));const f=(e[n+6]<<8|e[n+7])>>12-m&1,g=[2,1,2,3,3,4,4,5][h]+f,v=e[n+5]>>3,b=e[n+5]&7,x=new Uint8Array([i<<6|v<<1|b>>2,(b&3)<<6|h<<3|f<<2|c>>4,c<<4&224]),w=1536/l*9e4,k=r+s*w,S=e.subarray(n,n+u);return t.config=x,t.channelCount=g,t.samplerate=l,t.samples.push({unit:S,pts:k}),u}let lGn=class extends xTe{resetInitSegment(e,n,r,s){super.resetInitSegment(e,n,r,s),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:n,duration:s,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const n=A6(e,0);let r=(n==null?void 0:n.length)||0;if(n&&e[r]===11&&e[r+1]===119&&bTe(n)!==void 0&&Y0t(e,r)<=16)return!1;for(let s=e.length;r<s;r++)if(K0t(e,r))return Ui.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,n){return iGn(e,n)}appendFrame(e,n,r){if(this.basePTS!==null)return G0t(e,n,r,this.basePTS,this.frameIndex)}};const cGn=/\/emsg[-/]ID3/i;let dGn=class{constructor(e,n){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.config=n}resetTimeStamp(){}resetInitSegment(e,n,r,s){const i=this.videoTrack=zv("video",1),o=this.audioTrack=zv("audio",1),l=this.txtTrack=zv("text",1);if(this.id3Track=zv("id3",1),this.timeOffset=0,!(e!=null&&e.byteLength))return;const c=i0t(e);if(c.video){const{id:d,timescale:u,codec:h,supplemental:m}=c.video;i.id=d,i.timescale=l.timescale=u,i.codec=h,i.supplemental=m}if(c.audio){const{id:d,timescale:u,codec:h}=c.audio;o.id=d,o.timescale=u,o.codec=h}l.id=n0t.text,i.sampleDuration=0,i.duration=o.duration=s}resetContiguity(){this.remainderData=null}static probe(e){return oVn(e)}demux(e,n){this.timeOffset=n;let r=e;const s=this.videoTrack,i=this.txtTrack;if(this.config.progressive){this.remainderData&&(r=Gf(this.remainderData,e));const l=fVn(r);this.remainderData=l.remainder,s.samples=l.valid||new Uint8Array}else s.samples=r;const o=this.extractID3Track(s,n);return i.samples=NBe(n,s),{videoTrack:s,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}}flush(){const e=this.timeOffset,n=this.videoTrack,r=this.txtTrack;n.samples=this.remainderData||new Uint8Array,this.remainderData=null;const s=this.extractID3Track(n,this.timeOffset);return r.samples=NBe(e,n),{videoTrack:n,audioTrack:zv(),id3Track:s,textTrack:zv()}}extractID3Track(e,n){const r=this.id3Track;if(e.samples.length){const s=Ds(e.samples,["emsg"]);s&&s.forEach(i=>{const o=gVn(i);if(cGn.test(o.schemeIdUri)){const l=d9e(o,n);let c=o.eventDuration===4294967295?Number.POSITIVE_INFINITY:o.eventDuration/o.timeScale;c<=.001&&(c=Number.POSITIVE_INFINITY);const d=o.payload;r.samples.push({data:d,len:d.byteLength,dts:l,pts:l,type:lm.emsg,duration:c})}else if(this.config.enableEmsgKLVMetadata&&o.schemeIdUri.startsWith("urn:misb:KLV:bin:1910.1")){const l=d9e(o,n);r.samples.push({data:o.payload,len:o.payload.byteLength,dts:l,pts:l,type:lm.misbklv,duration:Number.POSITIVE_INFINITY})}})}return r}demuxSampleAes(e,n,r){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0}};function d9e(t,e){return $n(t.presentationTime)?t.presentationTime/t.timeScale:e+t.presentationTimeDelta/t.timeScale}let uGn=class{constructor(e,n,r){this.keyData=void 0,this.decrypter=void 0,this.keyData=r,this.decrypter=new uTe(n,{removePKCS7Padding:!1})}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Fk.cbc)}decryptAacSample(e,n,r){const s=e[n].unit;if(s.length<=16)return;const i=s.subarray(16,s.length-s.length%16),o=i.buffer.slice(i.byteOffset,i.byteOffset+i.length);this.decryptBuffer(o).then(l=>{const c=new Uint8Array(l);s.set(c,16),this.decrypter.isSync()||this.decryptAacSamples(e,n+1,r)}).catch(r)}decryptAacSamples(e,n,r){for(;;n++){if(n>=e.length){r();return}if(!(e[n].unit.length<32)&&(this.decryptAacSample(e,n,r),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const n=Math.floor((e.length-48)/160)*16+16,r=new Int8Array(n);let s=0;for(let i=32;i<e.length-16;i+=160,s+=16)r.set(e.subarray(i,i+16),s);return r}getAvcDecryptedUnit(e,n){const r=new Uint8Array(n);let s=0;for(let i=32;i<e.length-16;i+=160,s+=16)e.set(r.subarray(s,s+16),i);return e}decryptAvcSample(e,n,r,s,i){const o=l0t(i.data),l=this.getAvcEncryptedData(o);this.decryptBuffer(l.buffer).then(c=>{i.data=this.getAvcDecryptedUnit(o,c),this.decrypter.isSync()||this.decryptAvcSamples(e,n,r+1,s)}).catch(s)}decryptAvcSamples(e,n,r,s){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;n++,r=0){if(n>=e.length){s();return}const i=e[n].units;for(;!(r>=i.length);r++){const o=i[r];if(!(o.data.length<=48||o.type!==1&&o.type!==5)&&(this.decryptAvcSample(e,n,r,s,o),!this.decrypter.isSync()))return}}}},Z0t=class{constructor(){this.VideoSample=null}createVideoSample(e,n,r){return{key:e,frame:!1,pts:n,dts:r,units:[],length:0}}getLastNalUnit(e){var n;let r=this.VideoSample,s;if((!r||r.units.length===0)&&(r=e[e.length-1]),(n=r)!=null&&n.units){const i=r.units;s=i[i.length-1]}return s}pushAccessUnit(e,n){if(e.units.length&&e.frame){if(e.pts===void 0){const r=n.samples,s=r.length;if(s){const i=r[s-1];e.pts=i.pts,e.dts=i.dts}else{n.dropped++;return}}n.samples.push(e)}}parseNALu(e,n,r){const s=n.byteLength;let i=e.naluState||0;const o=i,l=[];let c=0,d,u,h,m=-1,f=0;for(i===-1&&(m=0,f=this.getNALuType(n,0),i=0,c=1);c<s;){if(d=n[c++],!i){i=d?0:1;continue}if(i===1){i=d?0:2;continue}if(!d)i=3;else if(d===1){if(u=c-i-1,m>=0){const p={data:n.subarray(m,u),type:f};l.push(p)}else{const p=this.getLastNalUnit(e.samples);p&&(o&&c<=4-o&&p.state&&(p.data=p.data.subarray(0,p.data.byteLength-o)),u>0&&(p.data=Gf(p.data,n.subarray(0,u)),p.state=0))}c<s?(h=this.getNALuType(n,c),m=c,f=h,i=0):i=-1}else i=0}if(m>=0&&i>=0){const p={data:n.subarray(m,s),type:f,state:i};l.push(p)}if(l.length===0){const p=this.getLastNalUnit(e.samples);p&&(p.data=Gf(p.data,n))}return e.naluState=i,l}},p$=class{constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,n=this.bytesAvailable,r=e.byteLength-n,s=new Uint8Array(4),i=Math.min(4,n);if(i===0)throw new Error("no bytes available");s.set(e.subarray(r,r+i)),this.word=new DataView(s.buffer).getUint32(0),this.bitsAvailable=i*8,this.bytesAvailable-=i}skipBits(e){let n;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,n=e>>3,e-=n<<3,this.bytesAvailable-=n,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let n=Math.min(this.bitsAvailable,e);const r=this.word>>>32-n;if(e>32&&Ui.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=n,this.bitsAvailable>0)this.word<<=n;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return n=e-n,n>0&&this.bitsAvailable?r<<n|this.readBits(n):r}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}readUShort(){return this.readBits(16)}readUInt(){return this.readBits(32)}},hGn=class extends Z0t{parsePES(e,n,r,s){const i=this.parseNALu(e,r.data,s);let o=this.VideoSample,l,c=!1;r.data=null,o&&i.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts)),i.forEach(d=>{var u,h;switch(d.type){case 1:{let g=!1;l=!0;const v=d.data;if(c&&v.length>4){const b=this.readSliceType(v);(b===2||b===4||b===7||b===9)&&(g=!0)}if(g){var m;(m=o)!=null&&m.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null)}o||(o=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts)),o.frame=!0,o.key=g;break}case 5:l=!0,(u=o)!=null&&u.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts)),o.key=!0,o.frame=!0;break;case 6:{l=!0,oTe(d.data,1,r.pts,n.samples);break}case 7:{var f,p;l=!0,c=!0;const g=d.data,v=this.readSPS(g);if(!e.sps||e.width!==v.width||e.height!==v.height||((f=e.pixelRatio)==null?void 0:f[0])!==v.pixelRatio[0]||((p=e.pixelRatio)==null?void 0:p[1])!==v.pixelRatio[1]){e.width=v.width,e.height=v.height,e.pixelRatio=v.pixelRatio,e.sps=[g];const b=g.subarray(1,4);let x="avc1.";for(let w=0;w<3;w++){let k=b[w].toString(16);k.length<2&&(k="0"+k),x+=k}e.codec=x}break}case 8:l=!0,e.pps=[d.data];break;case 9:l=!0,e.audFound=!0,(h=o)!=null&&h.frame&&(this.pushAccessUnit(o,e),o=null),o||(o=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts));break;case 12:l=!0;break;default:l=!1;break}o&&l&&o.units.push(d)}),s&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}getNALuType(e,n){return e[n]&31}readSliceType(e){const n=new p$(e);return n.readUByte(),n.readUEG(),n.readUEG()}skipScalingList(e,n){let r=8,s=8,i;for(let o=0;o<e;o++)s!==0&&(i=n.readEG(),s=(r+i+256)%256),r=s===0?r:s}readSPS(e){const n=new p$(e);let r=0,s=0,i=0,o=0,l,c,d;const u=n.readUByte.bind(n),h=n.readBits.bind(n),m=n.readUEG.bind(n),f=n.readBoolean.bind(n),p=n.skipBits.bind(n),g=n.skipEG.bind(n),v=n.skipUEG.bind(n),b=this.skipScalingList.bind(this);u();const x=u();if(h(5),p(3),u(),v(),x===100||x===110||x===122||x===244||x===44||x===83||x===86||x===118||x===128){const E=m();if(E===3&&p(1),v(),v(),p(1),f())for(c=E!==3?8:12,d=0;d<c;d++)f()&&(d<6?b(16,n):b(64,n))}v();const w=m();if(w===0)m();else if(w===1)for(p(1),g(),g(),l=m(),d=0;d<l;d++)g();v(),p(1);const k=m(),S=m(),C=h(1);C===0&&p(1),p(1),f()&&(r=m(),s=m(),i=m(),o=m());let j=[1,1];if(f()&&f())switch(u()){case 1:j=[1,1];break;case 2:j=[12,11];break;case 3:j=[10,11];break;case 4:j=[16,11];break;case 5:j=[40,33];break;case 6:j=[24,11];break;case 7:j=[20,11];break;case 8:j=[32,11];break;case 9:j=[80,33];break;case 10:j=[18,11];break;case 11:j=[15,11];break;case 12:j=[64,33];break;case 13:j=[160,99];break;case 14:j=[4,3];break;case 15:j=[3,2];break;case 16:j=[2,1];break;case 255:{j=[u()<<8|u(),u()<<8|u()];break}}return{width:Math.ceil((k+1)*16-r*2-s*2),height:(2-C)*(S+1)*16-(C?2:4)*(i+o),pixelRatio:j}}},mGn=class extends Z0t{constructor(...e){super(...e),this.initVPS=null}parsePES(e,n,r,s){const i=this.parseNALu(e,r.data,s);let o=this.VideoSample,l,c=!1;r.data=null,o&&i.length&&!e.audFound&&(this.pushAccessUnit(o,e),o=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts)),i.forEach(d=>{var u,h;switch(d.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:o||(o=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts)),o.frame=!0,l=!0;break;case 16:case 17:case 18:case 21:if(l=!0,c){var m;(m=o)!=null&&m.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null)}o||(o=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts)),o.key=!0,o.frame=!0;break;case 19:case 20:l=!0,(u=o)!=null&&u.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts)),o.key=!0,o.frame=!0;break;case 39:l=!0,oTe(d.data,2,r.pts,n.samples);break;case 32:l=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=ra(e.params,this.readVPS(d.data)),this.initVPS=d.data),e.vps=[d.data];break;case 33:if(l=!0,c=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],d.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const f=this.readSPS(d.data);e.width=f.width,e.height=f.height,e.pixelRatio=f.pixelRatio,e.codec=f.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const p in f.params)e.params[p]=f.params[p]}this.pushParameterSet(e.sps,d.data,e.vps),o||(o=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts)),o.key=!0;break;case 34:if(l=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const f=this.readPPS(d.data);for(const p in f)e.params[p]=f[p]}this.pushParameterSet(e.pps,d.data,e.vps)}break;case 35:l=!0,e.audFound=!0,(h=o)!=null&&h.frame&&(this.pushAccessUnit(o,e),o=null),o||(o=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts));break;default:l=!1;break}o&&l&&o.units.push(d)}),s&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}pushParameterSet(e,n,r){(r&&r[0]===this.initVPS||!r&&!e.length)&&e.push(n)}getNALuType(e,n){return(e[n]&126)>>>1}ebsp2rbsp(e){const n=new Uint8Array(e.byteLength);let r=0;for(let s=0;s<e.byteLength;s++)s>=2&&e[s]===3&&e[s-1]===0&&e[s-2]===0||(n[r]=e[s],r++);return new Uint8Array(n.buffer,0,r)}pushAccessUnit(e,n){super.pushAccessUnit(e,n),this.initVPS&&(this.initVPS=null)}readVPS(e){const n=new p$(e);n.readUByte(),n.readUByte(),n.readBits(4),n.skipBits(2),n.readBits(6);const r=n.readBits(3),s=n.readBoolean();return{numTemporalLayers:r+1,temporalIdNested:s}}readSPS(e){const n=new p$(this.ebsp2rbsp(e));n.readUByte(),n.readUByte(),n.readBits(4);const r=n.readBits(3);n.readBoolean();const s=n.readBits(2),i=n.readBoolean(),o=n.readBits(5),l=n.readUByte(),c=n.readUByte(),d=n.readUByte(),u=n.readUByte(),h=n.readUByte(),m=n.readUByte(),f=n.readUByte(),p=n.readUByte(),g=n.readUByte(),v=n.readUByte(),b=n.readUByte(),x=[],w=[];for(let ie=0;ie<r;ie++)x.push(n.readBoolean()),w.push(n.readBoolean());if(r>0)for(let ie=r;ie<8;ie++)n.readBits(2);for(let ie=0;ie<r;ie++)x[ie]&&(n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte()),w[ie]&&n.readUByte();n.readUEG();const k=n.readUEG();k==3&&n.skipBits(1);const S=n.readUEG(),C=n.readUEG(),j=n.readBoolean();let E=0,N=0,A=0,_=0;j&&(E+=n.readUEG(),N+=n.readUEG(),A+=n.readUEG(),_+=n.readUEG());const T=n.readUEG(),R=n.readUEG(),O=n.readUEG(),F=n.readBoolean();for(let ie=F?0:r;ie<=r;ie++)n.skipUEG(),n.skipUEG(),n.skipUEG();if(n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG(),n.readBoolean()&&n.readBoolean())for(let he=0;he<4;he++)for(let ye=0;ye<(he===3?2:6);ye++)if(!n.readBoolean())n.readUEG();else{const K=Math.min(64,1<<4+(he<<1));he>1&&n.readEG();for(let ce=0;ce<K;ce++)n.readEG()}n.readBoolean(),n.readBoolean(),n.readBoolean()&&(n.readUByte(),n.skipUEG(),n.skipUEG(),n.readBoolean());const P=n.readUEG();let M=0;for(let ie=0;ie<P;ie++){let he=!1;if(ie!==0&&(he=n.readBoolean()),he){ie===P&&n.readUEG(),n.readBoolean(),n.readUEG();let ye=0;for(let J=0;J<=M;J++){const K=n.readBoolean();let ce=!1;K||(ce=n.readBoolean()),(K||ce)&&ye++}M=ye}else{const ye=n.readUEG(),J=n.readUEG();M=ye+J;for(let K=0;K<ye;K++)n.readUEG(),n.readBoolean();for(let K=0;K<J;K++)n.readUEG(),n.readBoolean()}}if(n.readBoolean()){const ie=n.readUEG();for(let he=0;he<ie;he++){for(let ye=0;ye<O+4;ye++)n.readBits(1);n.readBits(1)}}let G=0,B=1,H=1,W=!0,V=1,U=0;n.readBoolean(),n.readBoolean();let ne=!1;if(n.readBoolean()){if(n.readBoolean()){const pe=n.readUByte(),Ie=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Me=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];pe>0&&pe<16?(B=Ie[pe-1],H=Me[pe-1]):pe===255&&(B=n.readBits(16),H=n.readBits(16))}if(n.readBoolean()&&n.readBoolean(),n.readBoolean()&&(n.readBits(3),n.readBoolean(),n.readBoolean()&&(n.readUByte(),n.readUByte(),n.readUByte())),n.readBoolean()&&(n.readUEG(),n.readUEG()),n.readBoolean(),n.readBoolean(),n.readBoolean(),ne=n.readBoolean(),ne&&(n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG()),n.readBoolean()&&(V=n.readBits(32),U=n.readBits(32),n.readBoolean()&&n.readUEG(),n.readBoolean())){const Me=n.readBoolean(),we=n.readBoolean();let Be=!1;(Me||we)&&(Be=n.readBoolean(),Be&&(n.readUByte(),n.readBits(5),n.readBoolean(),n.readBits(5)),n.readBits(4),n.readBits(4),Be&&n.readBits(4),n.readBits(5),n.readBits(5),n.readBits(5));for(let Ve=0;Ve<=r;Ve++){W=n.readBoolean();const be=W||n.readBoolean();let Ze=!1;be?n.readEG():Ze=n.readBoolean();const Pe=Ze?1:n.readUEG()+1;if(Me)for(let Ke=0;Ke<Pe;Ke++)n.readUEG(),n.readUEG(),Be&&(n.readUEG(),n.readUEG()),n.skipBits(1);if(we)for(let Ke=0;Ke<Pe;Ke++)n.readUEG(),n.readUEG(),Be&&(n.readUEG(),n.readUEG()),n.skipBits(1)}}n.readBoolean()&&(n.readBoolean(),n.readBoolean(),n.readBoolean(),G=n.readUEG())}let re=S,fe=C;if(j){let ie=1,he=1;k===1?ie=he=2:k==2&&(ie=2),re=S-ie*N-ie*E,fe=C-he*_-he*A}const le=s?["A","B","C"][s]:"",q=l<<24|c<<16|d<<8|u;let Y=0;for(let ie=0;ie<32;ie++)Y=(Y|(q>>ie&1)<<31-ie)>>>0;let X=Y.toString(16);return o===1&&X==="2"&&(X="6"),{codecString:`hvc1.${le}${o}.${X}.${i?"H":"L"}${b}.B0`,params:{general_tier_flag:i,general_profile_idc:o,general_profile_space:s,general_profile_compatibility_flags:[l,c,d,u],general_constraint_indicator_flags:[h,m,f,p,g,v],general_level_idc:b,bit_depth:T+8,bit_depth_luma_minus8:T,bit_depth_chroma_minus8:R,min_spatial_segmentation_idc:G,chroma_format_idc:k,frame_rate:{fixed:W,fps:U/V}},width:re,height:fe,pixelRatio:[B,H]}}readPPS(e){const n=new p$(this.ebsp2rbsp(e));n.readUByte(),n.readUByte(),n.skipUEG(),n.skipUEG(),n.skipBits(2),n.skipBits(3),n.skipBits(2),n.skipUEG(),n.skipUEG(),n.skipEG(),n.skipBits(2),n.readBoolean()&&n.skipUEG(),n.skipEG(),n.skipEG(),n.skipBits(4);const s=n.readBoolean(),i=n.readBoolean();let o=1;return i&&s?o=0:i?o=3:s&&(o=2),{parallelismType:o}}matchSPS(e,n){return String.fromCharCode.apply(null,e).substr(3)===String.fromCharCode.apply(null,n).substr(3)}};const Ec=188;let fGn=class UC{constructor(e,n,r,s){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.observer=e,this.config=n,this.typeSupported=r,this.logger=s,this.videoParser=null}static probe(e,n){const r=UC.syncOffset(e);return r>0&&n.warn(`MPEG2-TS detected but first sync word found @ offset ${r}`),r!==-1}static syncOffset(e){const n=e.length;let r=Math.min(Ec*5,n-Ec)+1,s=0;for(;s<r;){let i=!1,o=-1,l=0;for(let c=s;c<n;c+=Ec)if(e[c]===71&&(n-c===Ec||e[c+Ec]===71)){if(l++,o===-1&&(o=c,o!==0&&(r=Math.min(o+Ec*99,e.length-Ec)+1)),i||(i=$be(e,c)===0),i&&l>1&&(o===0&&l>2||c+Ec>r))return o}else{if(l)return-1;break}s++}return-1}static createTrack(e,n){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:n0t[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?n:void 0}}resetInitSegment(e,n,r,s){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=UC.createTrack("video"),this._videoTrack.duration=s,this._audioTrack=UC.createTrack("audio",s),this._id3Track=UC.createTrack("id3"),this._txtTrack=UC.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=n,this.videoCodec=r}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:n,_id3Track:r}=this;e&&(e.pesData=null),n&&(n.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,n,r=!1,s=!1){r||(this.sampleAes=null);let i;const o=this._videoTrack,l=this._audioTrack,c=this._id3Track,d=this._txtTrack;let u=o.pid,h=o.pesData,m=l.pid,f=c.pid,p=l.pesData,g=c.pesData,v=null,b=this.pmtParsed,x=this._pmtId,w=e.length;if(this.remainderData&&(e=Gf(this.remainderData,e),w=e.length,this.remainderData=null),w<Ec&&!s)return this.remainderData=e,{audioTrack:l,videoTrack:o,id3Track:c,textTrack:d};const k=Math.max(0,UC.syncOffset(e));w-=(w-k)%Ec,w<e.byteLength&&!s&&(this.remainderData=new Uint8Array(e.buffer,w,e.buffer.byteLength-w));let S=0;for(let j=k;j<w;j+=Ec)if(e[j]===71){const E=!!(e[j+1]&64),N=$be(e,j),A=(e[j+3]&48)>>4;let _;if(A>1){if(_=j+5+e[j+4],_===j+Ec)continue}else _=j+4;switch(N){case u:E&&(h&&(i=gT(h,this.logger))&&(this.readyVideoParser(o.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(o,d,i,!1)),h={data:[],size:0}),h&&(h.data.push(e.subarray(_,j+Ec)),h.size+=j+Ec-_);break;case m:if(E){if(p&&(i=gT(p,this.logger)))switch(l.segmentCodec){case"aac":this.parseAACPES(l,i);break;case"mp3":this.parseMPEGPES(l,i);break;case"ac3":this.parseAC3PES(l,i);break}p={data:[],size:0}}p&&(p.data.push(e.subarray(_,j+Ec)),p.size+=j+Ec-_);break;case f:E&&(g&&(i=gT(g,this.logger))&&this.parseID3PES(c,i),g={data:[],size:0}),g&&(g.data.push(e.subarray(_,j+Ec)),g.size+=j+Ec-_);break;case 0:E&&(_+=e[_]+1),x=this._pmtId=pGn(e,_);break;case x:{E&&(_+=e[_]+1);const T=gGn(e,_,this.typeSupported,r,this.observer,this.logger);u=T.videoPid,u>0&&(o.pid=u,o.segmentCodec=T.segmentVideoCodec),m=T.audioPid,m>0&&(l.pid=m,l.segmentCodec=T.segmentAudioCodec),f=T.id3Pid,f>0&&(c.pid=f),v!==null&&!b&&(this.logger.warn(`MPEG-TS PMT found at ${j} after unknown PID '${v}'. Backtracking to sync byte @${k} to parse all TS packets.`),v=null,j=k-188),b=this.pmtParsed=!0;break}case 17:case 8191:break;default:v=N;break}}else S++;S>0&&Obe(this.observer,new Error(`Found ${S} TS packet/s that do not start with 0x47`),void 0,this.logger),o.pesData=h,l.pesData=p,c.pesData=g;const C={audioTrack:l,videoTrack:o,id3Track:c,textTrack:d};return s&&this.extractRemainingSamples(C),C}flush(){const{remainderData:e}=this;this.remainderData=null;let n;return e?n=this.demux(e,-1,!1,!0):n={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(n),this.sampleAes?this.decrypt(n,this.sampleAes):n}extractRemainingSamples(e){const{audioTrack:n,videoTrack:r,id3Track:s,textTrack:i}=e,o=r.pesData,l=n.pesData,c=s.pesData;let d;if(o&&(d=gT(o,this.logger))?(this.readyVideoParser(r.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(r,i,d,!0),r.pesData=null)):r.pesData=o,l&&(d=gT(l,this.logger))){switch(n.segmentCodec){case"aac":this.parseAACPES(n,d);break;case"mp3":this.parseMPEGPES(n,d);break;case"ac3":this.parseAC3PES(n,d);break}n.pesData=null}else l!=null&&l.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),n.pesData=l;c&&(d=gT(c,this.logger))?(this.parseID3PES(s,d),s.pesData=null):s.pesData=c}demuxSampleAes(e,n,r){const s=this.demux(e,r,!0,!this.config.progressive),i=this.sampleAes=new uGn(this.observer,this.config,n);return this.decrypt(s,i)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new hGn:e==="hevc"&&(this.videoParser=new mGn))}decrypt(e,n){return new Promise(r=>{const{audioTrack:s,videoTrack:i}=e;s.samples&&s.segmentCodec==="aac"?n.decryptAacSamples(s.samples,0,()=>{i.samples?n.decryptAvcSamples(i.samples,0,0,()=>{r(e)}):r(e)}):i.samples&&n.decryptAvcSamples(i.samples,0,0,()=>{r(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0}parseAACPES(e,n){let r=0;const s=this.aacOverFlow;let i=n.data;if(s){this.aacOverFlow=null;const h=s.missing,m=s.sample.unit.byteLength;if(h===-1)i=Gf(s.sample.unit,i);else{const f=m-h;s.sample.unit.set(i.subarray(0,h),f),e.samples.push(s.sample),r=s.missing}}let o,l;for(o=r,l=i.length;o<l-1&&!KQ(i,o);o++);if(o!==r){let h;const m=o<l-1;if(m?h=`AAC PES did not start with ADTS header,offset:${o}`:h="No ADTS header found in AAC PES",Obe(this.observer,new Error(h),m,this.logger),!m)return}B0t(e,this.observer,i,o,this.audioCodec);let c;if(n.pts!==void 0)c=n.pts;else if(s){const h=U0t(e.samplerate);c=s.sample.pts+h}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let d=0,u;for(;o<l;)if(u=z0t(e,i,o,c,d),o+=u.length,u.missing){this.aacOverFlow=u;break}else for(d++;o<l-1&&!KQ(i,o);o++);}parseMPEGPES(e,n){const r=n.data,s=r.length;let i=0,o=0;const l=n.pts;if(l===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<s;)if(q0t(r,o)){const c=G0t(e,r,o,l,i);if(c)o+=c.length,i++;else break}else o++}parseAC3PES(e,n){{const r=n.data,s=n.pts;if(s===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const i=r.length;let o=0,l=0,c;for(;l<i&&(c=Q0t(e,r,l,s,o++))>0;)l+=c}}parseID3PES(e,n){if(n.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const r=ra({},n,{type:this._videoTrack?lm.emsg:lm.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(r)}};function $be(t,e){return((t[e+1]&31)<<8)+t[e+2]}function pGn(t,e){return(t[e+10]&31)<<8|t[e+11]}function gGn(t,e,n,r,s,i){const o={audioPid:-1,videoPid:-1,id3Pid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},l=(t[e+1]&15)<<8|t[e+2],c=e+3+l-4,d=(t[e+10]&15)<<8|t[e+11];for(e+=12+d;e<c;){const u=$be(t,e),h=(t[e+3]&15)<<8|t[e+4];switch(t[e]){case 207:if(!r){Wce("ADTS AAC",i);break}case 15:o.audioPid===-1&&(o.audioPid=u);break;case 21:o.id3Pid===-1&&(o.id3Pid=u);break;case 219:if(!r){Wce("H.264",i);break}case 27:o.videoPid===-1&&(o.videoPid=u);break;case 3:case 4:!n.mpeg&&!n.mp3?i.log("MPEG audio found, not supported in this browser"):o.audioPid===-1&&(o.audioPid=u,o.segmentAudioCodec="mp3");break;case 193:if(!r){Wce("AC-3",i);break}case 129:n.ac3?o.audioPid===-1&&(o.audioPid=u,o.segmentAudioCodec="ac3"):i.log("AC-3 audio found, not supported in this browser");break;case 6:if(o.audioPid===-1&&h>0){let m=e+5,f=h;for(;f>2;){switch(t[m]){case 106:n.ac3!==!0?i.log("AC-3 audio found, not supported in this browser for now"):(o.audioPid=u,o.segmentAudioCodec="ac3");break}const g=t[m+1]+2;m+=g,f-=g}}break;case 194:case 135:return Obe(s,new Error("Unsupported EC-3 in M2TS found"),void 0,i),o;case 36:o.videoPid===-1&&(o.videoPid=u,o.segmentVideoCodec="hevc",i.log("HEVC in M2TS found"));break}e+=h+5}return o}function Obe(t,e,n,r){r.warn(`parsing error: ${e.message}`),t.emit(ue.ERROR,ue.ERROR,{type:ur.MEDIA_ERROR,details:dt.FRAG_PARSING_ERROR,fatal:!1,levelRetry:n,error:e,reason:e.message})}function Wce(t,e){e.log(`${t} with AES-128-CBC encryption found in unencrypted stream`)}function gT(t,e){let n=0,r,s,i,o,l;const c=t.data;if(!t||t.size===0)return null;for(;c[0].length<19&&c.length>1;)c[0]=Gf(c[0],c[1]),c.splice(1,1);if(r=c[0],(r[0]<<16)+(r[1]<<8)+r[2]===1){if(s=(r[4]<<8)+r[5],s&&s>t.size-6)return null;const u=r[7];u&192&&(o=(r[9]&14)*536870912+(r[10]&255)*4194304+(r[11]&254)*16384+(r[12]&255)*128+(r[13]&254)/2,u&64?(l=(r[14]&14)*536870912+(r[15]&255)*4194304+(r[16]&254)*16384+(r[17]&255)*128+(r[18]&254)/2,o-l>60*9e4&&(e.warn(`${Math.round((o-l)/9e4)}s delta between PTS and DTS, align them`),o=l)):l=o),i=r[8];let h=i+9;if(t.size<=h)return null;t.size-=h;const m=new Uint8Array(t.size);for(let f=0,p=c.length;f<p;f++){r=c[f];let g=r.byteLength;if(h)if(h>g){h-=g;continue}else r=r.subarray(h),g-=h,h=0;m.set(r,n),n+=g}return s&&(s-=i+3),{data:m,pts:o,dts:l,len:s}}return null}let vGn=class{static getSilentFrame(e,n){switch(e){case"mp4a.40.2":if(n===1)return new Uint8Array([0,200,0,128,35,128]);if(n===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(n===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(n===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(n===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(n===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(n===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(n===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(n===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}};const lw=Math.pow(2,32)-1;let hd=class vt{static init(){vt.types={avc1:[],avcC:[],hvc1:[],hvcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],dac3:[],"ac-3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};let e;for(e in vt.types)vt.types.hasOwnProperty(e)&&(vt.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);const n=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),r=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);vt.HDLR_TYPES={video:n,audio:r};const s=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),i=new Uint8Array([0,0,0,0,0,0,0,0]);vt.STTS=vt.STSC=vt.STCO=i,vt.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),vt.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),vt.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),vt.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);const o=new Uint8Array([105,115,111,109]),l=new Uint8Array([97,118,99,49]),c=new Uint8Array([0,0,0,1]);vt.FTYP=vt.box(vt.types.ftyp,o,c,o,l),vt.DINF=vt.box(vt.types.dinf,vt.box(vt.types.dref,s))}static box(e,...n){let r=8,s=n.length;const i=s;for(;s--;)r+=n[s].byteLength;const o=new Uint8Array(r);for(o[0]=r>>24&255,o[1]=r>>16&255,o[2]=r>>8&255,o[3]=r&255,o.set(e,4),s=0,r=8;s<i;s++)o.set(n[s],r),r+=n[s].byteLength;return o}static hdlr(e){return vt.box(vt.types.hdlr,vt.HDLR_TYPES[e])}static mdat(e){return vt.box(vt.types.mdat,e)}static mdhd(e,n){n*=e;const r=Math.floor(n/(lw+1)),s=Math.floor(n%(lw+1));return vt.box(vt.types.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,r>>24,r>>16&255,r>>8&255,r&255,s>>24,s>>16&255,s>>8&255,s&255,85,196,0,0]))}static mdia(e){return vt.box(vt.types.mdia,vt.mdhd(e.timescale||0,e.duration||0),vt.hdlr(e.type),vt.minf(e))}static mfhd(e){return vt.box(vt.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?vt.box(vt.types.minf,vt.box(vt.types.smhd,vt.SMHD),vt.DINF,vt.stbl(e)):vt.box(vt.types.minf,vt.box(vt.types.vmhd,vt.VMHD),vt.DINF,vt.stbl(e))}static moof(e,n,r){return vt.box(vt.types.moof,vt.mfhd(e),vt.traf(r,n))}static moov(e){let n=e.length;const r=[];for(;n--;)r[n]=vt.trak(e[n]);return vt.box.apply(null,[vt.types.moov,vt.mvhd(e[0].timescale||0,e[0].duration||0)].concat(r).concat(vt.mvex(e)))}static mvex(e){let n=e.length;const r=[];for(;n--;)r[n]=vt.trex(e[n]);return vt.box.apply(null,[vt.types.mvex,...r])}static mvhd(e,n){n*=e;const r=Math.floor(n/(lw+1)),s=Math.floor(n%(lw+1)),i=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,r>>24,r>>16&255,r>>8&255,r&255,s>>24,s>>16&255,s>>8&255,s&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return vt.box(vt.types.mvhd,i)}static sdtp(e){const n=e.samples||[],r=new Uint8Array(4+n.length);let s,i;for(s=0;s<n.length;s++)i=n[s].flags,r[s+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return vt.box(vt.types.sdtp,r)}static stbl(e){return vt.box(vt.types.stbl,vt.stsd(e),vt.box(vt.types.stts,vt.STTS),vt.box(vt.types.stsc,vt.STSC),vt.box(vt.types.stsz,vt.STSZ),vt.box(vt.types.stco,vt.STCO))}static avc1(e){let n=[],r=[],s,i,o;for(s=0;s<e.sps.length;s++)i=e.sps[s],o=i.byteLength,n.push(o>>>8&255),n.push(o&255),n=n.concat(Array.prototype.slice.call(i));for(s=0;s<e.pps.length;s++)i=e.pps[s],o=i.byteLength,r.push(o>>>8&255),r.push(o&255),r=r.concat(Array.prototype.slice.call(i));const l=vt.box(vt.types.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|e.sps.length].concat(n).concat([e.pps.length]).concat(r))),c=e.width,d=e.height,u=e.pixelRatio[0],h=e.pixelRatio[1];return vt.box(vt.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,c>>8&255,c&255,d>>8&255,d&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),l,vt.box(vt.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),vt.box(vt.types.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,h>>24,h>>16&255,h>>8&255,h&255])))}static esds(e){const n=e.config;return new Uint8Array([0,0,0,0,3,25,0,1,0,4,17,64,21,0,0,0,0,0,0,0,0,0,0,0,5,2,...n,6,1,2])}static audioStsd(e){const n=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,n>>8&255,n&255,0,0])}static mp4a(e){return vt.box(vt.types.mp4a,vt.audioStsd(e),vt.box(vt.types.esds,vt.esds(e)))}static mp3(e){return vt.box(vt.types[".mp3"],vt.audioStsd(e))}static ac3(e){return vt.box(vt.types["ac-3"],vt.audioStsd(e),vt.box(vt.types.dac3,e.config))}static stsd(e){const{segmentCodec:n}=e;if(e.type==="audio"){if(n==="aac")return vt.box(vt.types.stsd,vt.STSD,vt.mp4a(e));if(n==="ac3"&&e.config)return vt.box(vt.types.stsd,vt.STSD,vt.ac3(e));if(n==="mp3"&&e.codec==="mp3")return vt.box(vt.types.stsd,vt.STSD,vt.mp3(e))}else if(e.pps&&e.sps){if(n==="avc")return vt.box(vt.types.stsd,vt.STSD,vt.avc1(e));if(n==="hevc"&&e.vps)return vt.box(vt.types.stsd,vt.STSD,vt.hvc1(e))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${n}/${e.codec})`)}static tkhd(e){const n=e.id,r=(e.duration||0)*(e.timescale||0),s=e.width||0,i=e.height||0,o=Math.floor(r/(lw+1)),l=Math.floor(r%(lw+1));return vt.box(vt.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,n>>24&255,n>>16&255,n>>8&255,n&255,0,0,0,0,o>>24,o>>16&255,o>>8&255,o&255,l>>24,l>>16&255,l>>8&255,l&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>8&255,s&255,0,0,i>>8&255,i&255,0,0]))}static traf(e,n){const r=vt.sdtp(e),s=e.id,i=Math.floor(n/(lw+1)),o=Math.floor(n%(lw+1));return vt.box(vt.types.traf,vt.box(vt.types.tfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,s&255])),vt.box(vt.types.tfdt,new Uint8Array([1,0,0,0,i>>24,i>>16&255,i>>8&255,i&255,o>>24,o>>16&255,o>>8&255,o&255])),vt.trun(e,r.length+16+20+8+16+8+8),r)}static trak(e){return e.duration=e.duration||4294967295,vt.box(vt.types.trak,vt.tkhd(e),vt.mdia(e))}static trex(e){const n=e.id;return vt.box(vt.types.trex,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,n){const r=e.samples||[],s=r.length,i=12+16*s,o=new Uint8Array(i);let l,c,d,u,h,m;for(n+=8+i,o.set([e.type==="video"?1:0,0,15,1,s>>>24&255,s>>>16&255,s>>>8&255,s&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255],0),l=0;l<s;l++)c=r[l],d=c.duration,u=c.size,h=c.flags,m=c.cts,o.set([d>>>24&255,d>>>16&255,d>>>8&255,d&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,h.isLeading<<2|h.dependsOn,h.isDependedOn<<6|h.hasRedundancy<<4|h.paddingValue<<1|h.isNonSync,h.degradPrio&61440,h.degradPrio&15,m>>>24&255,m>>>16&255,m>>>8&255,m&255],12+16*l);return vt.box(vt.types.trun,o)}static initSegment(e){vt.types||vt.init();const n=vt.moov(e);return Gf(vt.FTYP,n)}static hvc1(e){const n=e.params,r=[e.vps,e.sps,e.pps],s=4,i=new Uint8Array([1,n.general_profile_space<<6|(n.general_tier_flag?32:0)|n.general_profile_idc,n.general_profile_compatibility_flags[0],n.general_profile_compatibility_flags[1],n.general_profile_compatibility_flags[2],n.general_profile_compatibility_flags[3],n.general_constraint_indicator_flags[0],n.general_constraint_indicator_flags[1],n.general_constraint_indicator_flags[2],n.general_constraint_indicator_flags[3],n.general_constraint_indicator_flags[4],n.general_constraint_indicator_flags[5],n.general_level_idc,240|n.min_spatial_segmentation_idc>>8,255&n.min_spatial_segmentation_idc,252|n.parallelismType,252|n.chroma_format_idc,248|n.bit_depth_luma_minus8,248|n.bit_depth_chroma_minus8,0,parseInt(n.frame_rate.fps),s-1|n.temporal_id_nested<<2|n.num_temporal_layers<<3|(n.frame_rate.fixed?64:0),r.length]);let o=i.length;for(let p=0;p<r.length;p+=1){o+=3;for(let g=0;g<r[p].length;g+=1)o+=2+r[p][g].length}const l=new Uint8Array(o);l.set(i,0),o=i.length;const c=r.length-1;for(let p=0;p<r.length;p+=1){l.set(new Uint8Array([32+p|(p===c?128:0),0,r[p].length]),o),o+=3;for(let g=0;g<r[p].length;g+=1)l.set(new Uint8Array([r[p][g].length>>8,r[p][g].length&255]),o),o+=2,l.set(r[p][g],o),o+=r[p][g].length}const d=vt.box(vt.types.hvcC,l),u=e.width,h=e.height,m=e.pixelRatio[0],f=e.pixelRatio[1];return vt.box(vt.types.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,u>>8&255,u&255,h>>8&255,h&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),d,vt.box(vt.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),vt.box(vt.types.pasp,new Uint8Array([m>>24,m>>16&255,m>>8&255,m&255,f>>24,f>>16&255,f>>8&255,f&255])))}};hd.types=void 0;hd.HDLR_TYPES=void 0;hd.STTS=void 0;hd.STSC=void 0;hd.STCO=void 0;hd.STSZ=void 0;hd.VMHD=void 0;hd.SMHD=void 0;hd.STSD=void 0;hd.FTYP=void 0;hd.DINF=void 0;const J0t=9e4;function kTe(t,e,n=1,r=!1){const s=t*e*n;return r?Math.round(s):s}function yGn(t,e,n=1,r=!1){return kTe(t,e,1/n,r)}function b3(t,e=!1){return kTe(t,1e3,1/J0t,e)}function bGn(t,e=1){return kTe(t,J0t,1/e)}function u9e(t){const{baseTime:e,timescale:n,trackId:r}=t;return`${e/n} (${e}/${n}) trackId: ${r}`}const xGn=10*1e3,wGn=1024,kGn=1152,SGn=1536;let vT=null,qce=null;function h9e(t,e,n,r){return{duration:e,size:n,cts:r,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:t?2:1,isNonSync:t?0:1}}}let HW=class extends tp{constructor(e,n,r,s){if(super("mp4-remuxer",s),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=n,this.typeSupported=r,this.ISGenerated=!1,vT===null){const o=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);vT=o?parseInt(o[1]):0}if(qce===null){const i=navigator.userAgent.match(/Safari\/(\d+)/i);qce=i?parseInt(i[1]):0}}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){const n=this._initPTS;(!n||!e||e.trackId!==n.trackId||e.baseTime!==n.baseTime||e.timescale!==n.timescale)&&this.log(`Reset initPTS: ${n&&u9e(n)} > ${e&&u9e(e)}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let n=!1;const r=e[0].pts,s=e.reduce((i,o)=>{let l=o.pts,c=l-i;return c<-4294967296&&(n=!0,l=Xh(l,r),c=l-i),c>0?i:l},r);return n&&this.debug("PTS rollover detected"),s}remux(e,n,r,s,i,o,l,c){let d,u,h,m,f,p,g=i,v=i;const b=e.pid>-1,x=n.pid>-1,w=n.samples.length,k=e.samples.length>0,S=l&&w>0||w>1;if((!b||k)&&(!x||S)||this.ISGenerated||l){if(this.ISGenerated){var j,E,N,A;const O=this.videoTrackConfig;(O&&(n.width!==O.width||n.height!==O.height||((j=n.pixelRatio)==null?void 0:j[0])!==((E=O.pixelRatio)==null?void 0:E[0])||((N=n.pixelRatio)==null?void 0:N[1])!==((A=O.pixelRatio)==null?void 0:A[1]))||!O&&S||this.nextAudioTs===null&&k)&&this.resetInitSegment()}this.ISGenerated||(h=this.generateIS(e,n,i,o));const _=this.isVideoContiguous;let T=-1,R;if(S&&(T=CGn(n.samples),!_&&this.config.forceKeyFrameOnDiscontinuity))if(p=!0,T>0){this.warn(`Dropped ${T} out of ${w} video samples due to a missing keyframe`);const O=this.getVideoStartPts(n.samples);n.samples=n.samples.slice(T),n.dropped+=T,v+=(n.samples[0].pts-O)/n.inputTimeScale,R=v}else T===-1&&(this.warn(`No keyframe found out of ${w} video samples`),p=!1);if(this.ISGenerated){if(k&&S){const O=this.getVideoStartPts(n.samples),D=(Xh(e.samples[0].pts,O)-O)/n.inputTimeScale;g+=Math.max(0,D),v+=Math.max(0,-D)}if(k){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),h=this.generateIS(e,n,i,o)),u=this.remuxAudio(e,g,this.isAudioContiguous,o,x||S||c===Yn.AUDIO?v:void 0),S){const O=u?u.endPTS-u.startPTS:0;n.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),h=this.generateIS(e,n,i,o)),d=this.remuxVideo(n,v,_,O)}}else S&&(d=this.remuxVideo(n,v,_,0));d&&(d.firstKeyFrame=T,d.independent=T!==-1,d.firstKeyFramePTS=R)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(r.samples.length&&(f=X0t(r,i,this._initPTS,this._initDTS)),s.samples.length&&(m=ewt(s,i,this._initPTS))),{audio:u,video:d,initSegment:h,independent:p,text:m,id3:f}}computeInitPts(e,n,r,s){const i=Math.round(r*n);let o=Xh(e,i);if(o<i+n)for(this.log(`Adjusting PTS for rollover in timeline near ${(i-o)/n} ${s}`);o<i+n;)o+=8589934592;return o-i}generateIS(e,n,r,s){const i=e.samples,o=n.samples,l=this.typeSupported,c={},d=this._initPTS;let u=!d||s,h="audio/mp4",m,f,p,g=-1;if(u&&(m=f=1/0),e.config&&i.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":l.mpeg?(h="audio/mpeg",e.codec=""):l.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}c.audio={id:"audio",container:h,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&l.mpeg?new Uint8Array(0):hd.initSegment([e]),metadata:{channelCount:e.channelCount}},u&&(g=e.id,p=e.inputTimeScale,!d||p!==d.timescale?m=f=this.computeInitPts(i[0].pts,p,r,"audio"):u=!1)}if(n.sps&&n.pps&&o.length){if(n.timescale=n.inputTimeScale,c.video={id:"main",container:"video/mp4",codec:n.codec,initSegment:hd.initSegment([n]),metadata:{width:n.width,height:n.height}},u)if(g=n.id,p=n.inputTimeScale,!d||p!==d.timescale){const v=this.getVideoStartPts(o),b=Xh(o[0].dts,v),x=this.computeInitPts(b,p,r,"video"),w=this.computeInitPts(v,p,r,"video");f=Math.min(f,x),m=Math.min(m,w)}else u=!1;this.videoTrackConfig={width:n.width,height:n.height,pixelRatio:n.pixelRatio}}if(Object.keys(c).length)return this.ISGenerated=!0,u?(d&&this.warn(`Timestamps at playlist time: ${s?"":"~"}${r} ${m/p} != initPTS: ${d.baseTime/d.timescale} (${d.baseTime}/${d.timescale}) trackId: ${d.trackId}`),this.log(`Found initPTS at playlist time: ${r} offset: ${m/p} (${m}/${p}) trackId: ${g}`),this._initPTS={baseTime:m,timescale:p,trackId:g},this._initDTS={baseTime:f,timescale:p,trackId:g}):m=p=void 0,{tracks:c,initPTS:m,timescale:p,trackId:g}}remuxVideo(e,n,r,s){const i=e.inputTimeScale,o=e.samples,l=[],c=o.length,d=this._initPTS,u=d.baseTime*i/d.timescale;let h=this.nextVideoTs,m=8,f=this.videoSampleDuration,p,g,v=Number.POSITIVE_INFINITY,b=Number.NEGATIVE_INFINITY,x=!1;if(!r||h===null){const G=u+n*i,B=o[0].pts-Xh(o[0].dts,o[0].pts);vT&&h!==null&&Math.abs(G-B-(h+u))<15e3?r=!0:h=G-B-u}const w=h+u;for(let G=0;G<c;G++){const B=o[G];B.pts=Xh(B.pts,w),B.dts=Xh(B.dts,w),B.dts<o[G>0?G-1:G].dts&&(x=!0)}x&&o.sort(function(G,B){const H=G.dts-B.dts,W=G.pts-B.pts;return H||W}),p=o[0].dts,g=o[o.length-1].dts;const k=g-p,S=k?Math.round(k/(c-1)):f||e.inputTimeScale/30;if(r){const G=p-w,B=G>S,H=G<-1;if((B||H)&&(B?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${b3(G,!0)} ms (${G}dts) hole between fragments detected at ${n.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${b3(-G,!0)} ms (${G}dts) overlapping between fragments detected at ${n.toFixed(3)}`),!H||w>=o[0].pts||vT)){p=w;const W=o[0].pts-G;if(B)o[0].dts=p,o[0].pts=W;else{let V=!0;for(let U=0;U<o.length&&!(o[U].dts>W&&V);U++){const ne=o[U].pts;if(o[U].dts-=G,o[U].pts-=G,U<o.length-1){const te=o[U+1].pts,re=o[U].pts,fe=te<=re,le=te<=ne;V=fe==le}}}this.log(`Video: Initial PTS/DTS adjusted: ${b3(W,!0)}/${b3(p,!0)}, delta: ${b3(G,!0)} ms`)}}p=Math.max(0,p);let C=0,j=0,E=p;for(let G=0;G<c;G++){const B=o[G],H=B.units,W=H.length;let V=0;for(let U=0;U<W;U++)V+=H[U].data.length;j+=V,C+=W,B.length=V,B.dts<E?(B.dts=E,E+=S/4|0||1):E=B.dts,v=Math.min(B.pts,v),b=Math.max(B.pts,b)}g=o[c-1].dts;const N=j+4*C+8;let A;try{A=new Uint8Array(N)}catch(G){this.observer.emit(ue.ERROR,ue.ERROR,{type:ur.MUX_ERROR,details:dt.REMUX_ALLOC_ERROR,fatal:!1,error:G,bytes:N,reason:`fail allocating video mdat ${N}`});return}const _=new DataView(A.buffer);_.setUint32(0,N),A.set(hd.types.mdat,4);let T=!1,R=Number.POSITIVE_INFINITY,O=Number.POSITIVE_INFINITY,F=Number.NEGATIVE_INFINITY,D=Number.NEGATIVE_INFINITY;for(let G=0;G<c;G++){const B=o[G],H=B.units;let W=0;for(let ne=0,te=H.length;ne<te;ne++){const re=H[ne],fe=re.data,le=re.data.byteLength;_.setUint32(m,le),m+=4,A.set(fe,m),m+=le,W+=4+le}let V;if(G<c-1)f=o[G+1].dts-B.dts,V=o[G+1].pts-B.pts;else{const ne=this.config,te=G>0?B.dts-o[G-1].dts:S;if(V=G>0?B.pts-o[G-1].pts:S,ne.stretchShortVideoTrack&&this.nextAudioTs!==null){const re=Math.floor(ne.maxBufferHole*i),fe=(s?v+s*i:this.nextAudioTs+u)-B.pts;fe>re?(f=fe-te,f<0?f=te:T=!0,this.log(`It is approximately ${fe/90} ms to the next segment; using duration ${f/90} ms for the last video frame.`)):f=te}else f=te}const U=Math.round(B.pts-B.dts);R=Math.min(R,f),F=Math.max(F,f),O=Math.min(O,V),D=Math.max(D,V),l.push(h9e(B.key,f,W,U))}if(l.length){if(vT){if(vT<70){const G=l[0].flags;G.dependsOn=2,G.isNonSync=0}}else if(qce&&D-O<F-R&&S/F<.025&&l[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let G=p;for(let B=0,H=l.length;B<H;B++){const W=G+l[B].duration,V=G+l[B].cts;if(B<H-1){const U=W+l[B+1].cts;l[B].duration=U-V}else l[B].duration=B?l[B-1].duration:S;l[B].cts=0,G=W}}}f=T||!f?S:f;const I=g+f;this.nextVideoTs=h=I-u,this.videoSampleDuration=f,this.isVideoContiguous=!0;const z={data1:hd.moof(e.sequenceNumber++,p,ra(e,{samples:l})),data2:A,startPTS:(v-u)/i,endPTS:(b+f-u)/i,startDTS:(p-u)/i,endDTS:h/i,type:"video",hasAudio:!1,hasVideo:!0,nb:l.length,dropped:e.dropped};return e.samples=[],e.dropped=0,z}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return kGn;case"ac3":return SGn;default:return wGn}}remuxAudio(e,n,r,s,i){const o=e.inputTimeScale,l=e.samplerate?e.samplerate:o,c=o/l,d=this.getSamplesPerFrame(e),u=d*c,h=this._initPTS,m=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,f=[],p=i!==void 0;let g=e.samples,v=m?0:8,b=this.nextAudioTs||-1;const x=h.baseTime*o/h.timescale,w=x+n*o;if(this.isAudioContiguous=r=r||g.length&&b>0&&(s&&Math.abs(w-(b+x))<9e3||Math.abs(Xh(g[0].pts,w)-(b+x))<20*u),g.forEach(function(D){D.pts=Xh(D.pts,w)}),!r||b<0){const D=g.length;if(g=g.filter(I=>I.pts>=0),D!==g.length&&this.warn(`Removed ${g.length-D} of ${D} samples (initPTS ${x} / ${o})`),!g.length)return;i===0?b=0:s&&!p?b=Math.max(0,w-x):b=g[0].pts-x}if(e.segmentCodec==="aac"){const D=this.config.maxAudioFramesDrift;for(let I=0,P=b+x;I<g.length;I++){const M=g[I],z=M.pts,G=z-P,B=Math.abs(1e3*G/o);if(G<=-D*u&&p)I===0&&(this.warn(`Audio frame @ ${(z/o).toFixed(3)}s overlaps marker by ${Math.round(1e3*G/o)} ms.`),this.nextAudioTs=b=z-x,P=z);else if(G>=D*u&&B<xGn&&p){let H=Math.round(G/u);for(P=z-H*u;P<0&&H&&u;)H--,P+=u;I===0&&(this.nextAudioTs=b=P-x),this.warn(`Injecting ${H} audio frames @ ${((P-x)/o).toFixed(3)}s due to ${Math.round(1e3*G/o)} ms gap.`);for(let W=0;W<H;W++){let V=vGn.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);V||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),V=M.unit.subarray()),g.splice(I,0,{unit:V,pts:P}),P+=u,I++}}M.pts=P,P+=u}}let k=null,S=null,C,j=0,E=g.length;for(;E--;)j+=g[E].unit.byteLength;for(let D=0,I=g.length;D<I;D++){const P=g[D],M=P.unit;let z=P.pts;if(S!==null){const B=f[D-1];B.duration=Math.round((z-S)/c)}else if(r&&e.segmentCodec==="aac"&&(z=b+x),k=z,j>0){j+=v;try{C=new Uint8Array(j)}catch(B){this.observer.emit(ue.ERROR,ue.ERROR,{type:ur.MUX_ERROR,details:dt.REMUX_ALLOC_ERROR,fatal:!1,error:B,bytes:j,reason:`fail allocating audio mdat ${j}`});return}m||(new DataView(C.buffer).setUint32(0,j),C.set(hd.types.mdat,4))}else return;C.set(M,v);const G=M.byteLength;v+=G,f.push(h9e(!0,d,G,0)),S=z}const N=f.length;if(!N)return;const A=f[f.length-1];b=S-x,this.nextAudioTs=b+c*A.duration;const _=m?new Uint8Array(0):hd.moof(e.sequenceNumber++,k/c,ra({},e,{samples:f}));e.samples=[];const T=(k-x)/o,R=this.nextAudioTs/o,F={data1:_,data2:C,startPTS:T,endPTS:R,startDTS:T,endDTS:R,type:"audio",hasAudio:!0,hasVideo:!1,nb:N};return this.isAudioContiguous=!0,F}};function Xh(t,e){let n;if(e===null)return t;for(e<t?n=-8589934592:n=8589934592;Math.abs(t-e)>4294967296;)t+=n;return t}function CGn(t){for(let e=0;e<t.length;e++)if(t[e].key)return e;return-1}function X0t(t,e,n,r){const s=t.samples.length;if(!s)return;const i=t.inputTimeScale;for(let l=0;l<s;l++){const c=t.samples[l];c.pts=Xh(c.pts-n.baseTime*i/n.timescale,e*i)/i,c.dts=Xh(c.dts-r.baseTime*i/r.timescale,e*i)/i}const o=t.samples;return t.samples=[],{samples:o}}function ewt(t,e,n){const r=t.samples.length;if(!r)return;const s=t.inputTimeScale;for(let o=0;o<r;o++){const l=t.samples[o];l.pts=Xh(l.pts-n.baseTime*s/n.timescale,e*s)/s}t.samples.sort((o,l)=>o.pts-l.pts);const i=t.samples;return t.samples=[],{samples:i}}let jGn=class extends tp{constructor(e,n,r,s){super("passthrough-remuxer",s),this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1}destroy(){}resetTimeStamp(e){this.lastEndTime=null;const n=this.initPTS;n&&e&&n.baseTime===e.baseTime&&n.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,n,r,s){this.audioCodec=n,this.videoCodec=r,this.generateInitSegment(e,s),this.emitInitSegment=!0}generateInitSegment(e,n){let{audioCodec:r,videoCodec:s}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:i,video:o}=this.initData=i0t(e);if(n)uVn(e,n);else{const c=i||o;c!=null&&c.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${c.codec}")!`)}i&&(r=m9e(i,pa.AUDIO,this)),o&&(s=m9e(o,pa.VIDEO,this));const l={};i&&o?l.audiovideo={container:"video/mp4",codec:r+","+s,supplemental:o.supplemental,encrypted:o.encrypted,initSegment:e,id:"main"}:i?l.audio={container:"audio/mp4",codec:r,encrypted:i.encrypted,initSegment:e,id:"audio"}:o?l.video={container:"video/mp4",codec:s,supplemental:o.supplemental,encrypted:o.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=l}remux(e,n,r,s,i,o){var l,c;let{initPTS:d,lastEndTime:u}=this;const h={audio:void 0,video:void 0,text:s,id3:r,initSegment:void 0};$n(u)||(u=this.lastEndTime=i||0);const m=n.samples;if(!m.length)return h;const f={initPTS:void 0,timescale:void 0,trackId:void 0};let p=this.initData;if((l=p)!=null&&l.length||(this.generateInitSegment(m),p=this.initData),!((c=p)!=null&&c.length))return this.warn("Failed to generate initSegment."),h;this.emitInitSegment&&(f.tracks=this.initTracks,this.emitInitSegment=!1);const g=mVn(m,p,this),v=p.audio?g[p.audio.id]:null,b=p.video?g[p.video.id]:null,x=Xz(b,1/0),w=Xz(v,1/0),k=Xz(b,0,!0),S=Xz(v,0,!0);let C=i,j=0;const E=v&&(!b||!d&&w<x||d&&d.trackId===p.audio.id),N=E?v:b;if(N){const P=N.timescale,M=N.start-i*P,z=E?p.audio.id:p.video.id;C=N.start/P,j=E?S-w:k-x,(o||!d)&&(EGn(d,C,i,j)||P!==d.timescale)&&(d&&this.warn(`Timestamps at playlist time: ${o?"":"~"}${i} ${M/P} != initPTS: ${d.baseTime/d.timescale} (${d.baseTime}/${d.timescale}) trackId: ${d.trackId}`),this.log(`Found initPTS at playlist time: ${i} offset: ${C-i} (${M}/${P}) trackId: ${z}`),d=null,f.initPTS=M,f.timescale=P,f.trackId=z)}else this.warn(`No audio or video samples found for initPTS at playlist time: ${i}`);d?(f.initPTS=d.baseTime,f.timescale=d.timescale,f.trackId=d.trackId):((!f.timescale||f.trackId===void 0||f.initPTS===void 0)&&(this.warn("Could not set initPTS"),f.initPTS=C,f.timescale=1,f.trackId=-1),this.initPTS=d={baseTime:f.initPTS,timescale:f.timescale,trackId:f.trackId});const A=C-d.baseTime/d.timescale,_=A+j;j>0?this.lastEndTime=_:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const T=!!p.audio,R=!!p.video;let O="";T&&(O+="audio"),R&&(O+="video");const F=(p.audio?p.audio.encrypted:!1)||(p.video?p.video.encrypted:!1),D={data1:m,startPTS:A,startDTS:A,endPTS:_,endDTS:_,type:O,hasAudio:T,hasVideo:R,nb:1,dropped:0,encrypted:F};h.audio=T&&!R?D:void 0,h.video=R?D:void 0;const I=b==null?void 0:b.sampleCount;if(I){const P=b.keyFrameIndex,M=P!==-1;D.nb=I,D.dropped=P===0||this.isVideoContiguous?0:M?P:I,D.independent=M,D.firstKeyFrame=P,M&&b.keyFrameStart&&(D.firstKeyFramePTS=(b.keyFrameStart-d.baseTime)/d.timescale),this.isVideoContiguous||(h.independent=M),this.isVideoContiguous||(this.isVideoContiguous=M),D.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${P}/${I} dropped: ${D.dropped} start: ${D.firstKeyFramePTS||"NA"}`)}return h.initSegment=f,h.id3=X0t(r,i,d,d),s.samples.length&&(h.text=ewt(s,i,d)),h}};function Xz(t,e,n=!1){return(t==null?void 0:t.start)!==void 0?(t.start+(n?t.duration:0))/t.timescale:e}function EGn(t,e,n,r){if(t===null)return!0;const s=Math.max(r,1),i=e-t.baseTime/t.timescale;return Math.abs(i-n)>s}function m9e(t,e,n){const r=t.codec;return r&&r.length>4?r:e===pa.AUDIO?r==="ec-3"||r==="ac-3"||r==="alac"?r:r==="fLaC"||r==="Opus"?FQ(r,!1):(n.warn(`Unhandled audio codec "${r}" in mp4 MAP`),r||"mp4a"):(n.warn(`Unhandled video codec "${r}" in mp4 MAP`),r||"avc1")}let $b;try{$b=self.performance.now.bind(self.performance)}catch{$b=Date.now}const GW=[{demux:dGn,remux:jGn},{demux:fGn,remux:HW},{demux:aGn,remux:HW},{demux:lGn,remux:HW}];GW.splice(2,0,{demux:oGn,remux:HW});let f9e=class{constructor(e,n,r,s,i,o){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=n,this.config=r,this.id=i,this.logger=o}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,n,r,s){const i=r.transmuxing;i.executeStart=$b();let o=new Uint8Array(e);const{currentTransmuxState:l,transmuxConfig:c}=this;s&&(this.currentTransmuxState=s);const{contiguous:d,discontinuity:u,trackSwitch:h,accurateTimeOffset:m,timeOffset:f,initSegmentChange:p}=s||l,{audioCodec:g,videoCodec:v,defaultInitPts:b,duration:x,initSegmentData:w}=c,k=NGn(o,n);if(k&&tP(k.method)){const E=this.getDecrypter(),N=mTe(k.method);if(E.isSync()){let A=E.softwareDecrypt(o,k.key.buffer,k.iv.buffer,N);if(r.part>-1){const T=E.flush();A=T&&T.buffer}if(!A)return i.executeEnd=$b(),Kce(r);o=new Uint8Array(A)}else return this.asyncResult=!0,this.decryptionPromise=E.webCryptoDecrypt(o,k.key.buffer,k.iv.buffer,N).then(A=>{const _=this.push(A,null,r);return this.decryptionPromise=null,_}),this.decryptionPromise}const S=this.needsProbing(u,h);if(S){const E=this.configureTransmuxer(o);if(E)return this.logger.warn(`[transmuxer] ${E.message}`),this.observer.emit(ue.ERROR,ue.ERROR,{type:ur.MEDIA_ERROR,details:dt.FRAG_PARSING_ERROR,fatal:!1,error:E,reason:E.message}),i.executeEnd=$b(),Kce(r)}(u||h||p||S)&&this.resetInitSegment(w,g,v,x,n),(u||p||S)&&this.resetInitialTimestamp(b),d||this.resetContiguity();const C=this.transmux(o,k,f,m,r);this.asyncResult=P6(C);const j=this.currentTransmuxState;return j.contiguous=!0,j.discontinuity=!1,j.trackSwitch=!1,i.executeEnd=$b(),C}flush(e){const n=e.transmuxing;n.executeStart=$b();const{decrypter:r,currentTransmuxState:s,decryptionPromise:i}=this;if(i)return this.asyncResult=!0,i.then(()=>this.flush(e));const o=[],{timeOffset:l}=s;if(r){const h=r.flush();h&&o.push(this.push(h.buffer,null,e))}const{demuxer:c,remuxer:d}=this;if(!c||!d){n.executeEnd=$b();const h=[Kce(e)];return this.asyncResult?Promise.resolve(h):h}const u=c.flush(l);return P6(u)?(this.asyncResult=!0,u.then(h=>(this.flushRemux(o,h,e),o))):(this.flushRemux(o,u,e),this.asyncResult?Promise.resolve(o):o)}flushRemux(e,n,r){const{audioTrack:s,videoTrack:i,id3Track:o,textTrack:l}=n,{accurateTimeOffset:c,timeOffset:d}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${r.sn}${r.part>-1?" part: "+r.part:""} of ${this.id===Yn.MAIN?"level":"track"} ${r.level}`);const u=this.remuxer.remux(s,i,o,l,d,c,!0,this.id);e.push({remuxResult:u,chunkMeta:r}),r.transmuxing.executeEnd=$b()}resetInitialTimestamp(e){const{demuxer:n,remuxer:r}=this;!n||!r||(n.resetTimeStamp(e),r.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:n}=this;!e||!n||(e.resetContiguity(),n.resetNextTimestamp())}resetInitSegment(e,n,r,s,i){const{demuxer:o,remuxer:l}=this;!o||!l||(o.resetInitSegment(e,n,r,s),l.resetInitSegment(e,n,r,i))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)}transmux(e,n,r,s,i){let o;return n&&n.method==="SAMPLE-AES"?o=this.transmuxSampleAes(e,n,r,s,i):o=this.transmuxUnencrypted(e,r,s,i),o}transmuxUnencrypted(e,n,r,s){const{audioTrack:i,videoTrack:o,id3Track:l,textTrack:c}=this.demuxer.demux(e,n,!1,!this.config.progressive);return{remuxResult:this.remuxer.remux(i,o,l,c,n,r,!1,this.id),chunkMeta:s}}transmuxSampleAes(e,n,r,s,i){return this.demuxer.demuxSampleAes(e,n,r).then(o=>({remuxResult:this.remuxer.remux(o.audioTrack,o.videoTrack,o.id3Track,o.textTrack,r,s,!1,this.id),chunkMeta:i}))}configureTransmuxer(e){const{config:n,observer:r,typeSupported:s}=this;let i;for(let h=0,m=GW.length;h<m;h++){var o;if((o=GW[h].demux)!=null&&o.probe(e,this.logger)){i=GW[h];break}}if(!i)return new Error("Failed to find demuxer by probing fragment data");const l=this.demuxer,c=this.remuxer,d=i.remux,u=i.demux;(!c||!(c instanceof d))&&(this.remuxer=new d(r,n,s,this.logger)),(!l||!(l instanceof u))&&(this.demuxer=new u(r,n,s,this.logger),this.probe=u.probe)}needsProbing(e,n){return!this.demuxer||!this.remuxer||e||n}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new uTe(this.config)),e}};function NGn(t,e){let n=null;return t.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(n=e),n}const Kce=t=>({remuxResult:{},chunkMeta:t});function P6(t){return"then"in t&&t.then instanceof Function}let TGn=class{constructor(e,n,r,s,i){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=n,this.initSegmentData=r,this.duration=s,this.defaultInitPts=i||null}},_Gn=class{constructor(e,n,r,s,i,o){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=n,this.accurateTimeOffset=r,this.trackSwitch=s,this.timeOffset=i,this.initSegmentChange=o}},p9e=0,twt=class{constructor(e,n,r,s){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=p9e++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=c=>{const d=c.data,u=this.hls;if(!(!u||!(d!=null&&d.event)||d.instanceNo!==this.instanceNo))switch(d.event){case"init":{var h;const m=(h=this.workerContext)==null?void 0:h.objectURL;m&&self.URL.revokeObjectURL(m);break}case"transmuxComplete":{this.handleTransmuxComplete(d.data);break}case"flush":{this.onFlush(d.data);break}case"workerLog":{u.logger[d.data.logType]&&u.logger[d.data.logType](d.data.message);break}default:{d.data=d.data||{},d.data.frag=this.frag,d.data.part=this.part,d.data.id=this.id,u.trigger(d.event,d.data);break}}},this.onWorkerError=c=>{if(!this.hls)return;const d=new Error(`${c.message}  (${c.filename}:${c.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(ue.ERROR,{type:ur.OTHER_ERROR,details:dt.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:d})};const i=e.config;this.hls=e,this.id=n,this.useWorker=!!i.enableWorker,this.onTransmuxComplete=r,this.onFlush=s;const o=(c,d)=>{d=d||{},d.frag=this.frag||void 0,c===ue.ERROR&&(d=d,d.parent=this.id,d.part=this.part,this.error=d.error),this.hls.trigger(c,d)};this.observer=new gTe,this.observer.on(ue.FRAG_DECRYPTED,o),this.observer.on(ue.ERROR,o);const l=ABe(i.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){const c=this.hls.logger;if(i.workerPath||RHn()){try{i.workerPath?(c.log(`loading Web Worker ${i.workerPath} for "${n}"`),this.workerContext=MHn(i.workerPath)):(c.log(`injecting Web Worker for "${n}"`),this.workerContext=IHn());const{worker:u}=this.workerContext;u.addEventListener("message",this.onWorkerMessage),u.addEventListener("error",this.onWorkerError),u.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:l,id:n,config:va(i)})}catch(u){c.warn(`Error setting up "${n}" Web Worker, fallback to inline`,u),this.terminateWorker(),this.error=null,this.transmuxer=new f9e(this.observer,l,i,"",n,e.logger)}return}}this.transmuxer=new f9e(this.observer,l,i,"",n,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=p9e++;const n=this.hls.config,r=ABe(n.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:r,id:this.id,config:va(n)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),LHn(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const n=this.transmuxer;n&&(n.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,n,r,s,i,o,l,c,d,u){var h,m;d.transmuxing.start=self.performance.now();const{instanceNo:f,transmuxer:p}=this,g=o?o.start:i.start,v=i.decryptdata,b=this.frag,x=!(b&&i.cc===b.cc),w=!(b&&d.level===b.level),k=b?d.sn-b.sn:-1,S=this.part?d.part-this.part.index:-1,C=k===0&&d.id>1&&d.id===(b==null?void 0:b.stats.chunkCount),j=!w&&(k===1||k===0&&(S===1||C&&S<=0)),E=self.performance.now();(w||k||i.stats.parsing.start===0)&&(i.stats.parsing.start=E),o&&(S||!j)&&(o.stats.parsing.start=E);const N=!(b&&((h=i.initSegment)==null?void 0:h.url)===((m=b.initSegment)==null?void 0:m.url)),A=new _Gn(x,j,c,w,g,N);if(!j||x||N){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${i.type} sn: ${d.sn}${d.part>-1?" part: "+d.part:""} ${this.id===Yn.MAIN?"level":"track"}: ${d.level} id: ${d.id}
        discontinuity: ${x}
        trackSwitch: ${w}
        contiguous: ${j}
        accurateTimeOffset: ${c}
        timeOffset: ${g}
        initSegmentChange: ${N}`);const _=new TGn(r,s,n,l,u);this.configureTransmuxer(_)}if(this.frag=i,this.part=o,this.workerContext)this.workerContext.worker.postMessage({instanceNo:f,cmd:"demux",data:e,decryptdata:v,chunkMeta:d,state:A},e instanceof ArrayBuffer?[e]:[]);else if(p){const _=p.push(e,v,d,A);P6(_)?_.then(T=>{this.handleTransmuxComplete(T)}).catch(T=>{this.transmuxerError(T,d,"transmuxer-interface push error")}):this.handleTransmuxComplete(_)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:n,transmuxer:r}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:n,cmd:"flush",chunkMeta:e});else if(r){const s=r.flush(e);P6(s)?s.then(i=>{this.handleFlushResult(i,e)}).catch(i=>{this.transmuxerError(i,e,"transmuxer-interface flush error")}):this.handleFlushResult(s,e)}}transmuxerError(e,n,r){this.hls&&(this.error=e,this.hls.trigger(ue.ERROR,{type:ur.MEDIA_ERROR,details:dt.FRAG_PARSING_ERROR,chunkMeta:n,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:r}))}handleFlushResult(e,n){e.forEach(r=>{this.handleTransmuxComplete(r)}),this.onFlush(n)}configureTransmuxer(e){const{instanceNo:n,transmuxer:r}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:n,cmd:"configure",config:e}):r&&r.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}};const g9e=100;let AGn=class extends pTe{constructor(e,n,r){super(e,n,r,"audio-stream-controller",Yn.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(ue.LEVEL_LOADED,this.onLevelLoaded,this),e.on(ue.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(ue.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(ue.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(ue.BUFFER_RESET,this.onBufferReset,this),e.on(ue.BUFFER_CREATED,this.onBufferCreated,this),e.on(ue.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(ue.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(ue.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(ue.FRAG_LOADING,this.onFragLoading,this),e.on(ue.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(ue.LEVEL_LOADED,this.onLevelLoaded,this),e.off(ue.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(ue.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(ue.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(ue.BUFFER_RESET,this.onBufferReset,this),e.off(ue.BUFFER_CREATED,this.onBufferCreated,this),e.off(ue.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(ue.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(ue.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(ue.FRAG_LOADING,this.onFragLoading,this),e.off(ue.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,{frag:n,id:r,initPTS:s,timescale:i,trackId:o}){if(r===Yn.MAIN){const l=n.cc,c=this.fragCurrent;if(this.initPTS[l]={baseTime:s,timescale:i,trackId:o},this.log(`InitPTS for cc: ${l} found from main: ${s/i} (${s}/${i}) trackId: ${o}`),this.mainAnchor=n,this.state===Mt.WAITING_INIT_PTS){const d=this.waitingData;(!d&&!this.loadingParts||d&&d.frag.cc!==l)&&this.syncWithAnchor(n,d==null?void 0:d.frag)}else!this.hls.hasEnoughToStart&&c&&c.cc!==l?(c.abortRequests(),this.syncWithAnchor(n,c)):this.state===Mt.IDLE&&this.tick()}}getLoadPosition(){return!this.startFragRequested&&this.nextLoadPosition>=0?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,n){var r;const s=((r=this.mainFragLoading)==null?void 0:r.frag)||null;if(n&&(s==null?void 0:s.cc)===n.cc)return;const i=(s||e).cc,o=this.getLevelDetails(),l=this.getLoadPosition(),c=g0t(o,i,l);c&&(this.log(`Syncing with main frag at ${c.start} cc ${c.cc}`),this.startFragRequested=!1,this.nextLoadPosition=c.start,this.resetLoadingState(),this.state===Mt.IDLE&&this.doTickIdle())}startLoad(e,n){if(!this.levels){this.startPosition=e,this.state=Mt.STOPPED;return}const r=this.lastCurrentTime;this.stopLoad(),this.setInterval(g9e),r>0&&e===-1?(this.log(`Override startPosition with lastCurrentTime @${r.toFixed(3)}`),e=r,this.state=Mt.IDLE):this.state=Mt.WAITING_TRACK,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=n?-1:e,this.tick()}doTick(){switch(this.state){case Mt.IDLE:this.doTickIdle();break;case Mt.WAITING_TRACK:{const{levels:e,trackId:n}=this,r=e==null?void 0:e[n],s=r==null?void 0:r.details;if(s&&!this.waitForLive(r)){if(this.waitForCdnTuneIn(s))break;this.state=Mt.WAITING_INIT_PTS}break}case Mt.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case Mt.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:n,part:r,cache:s,complete:i}=e,o=this.mainAnchor;if(this.initPTS[n.cc]!==void 0){this.waitingData=null,this.state=Mt.FRAG_LOADING;const l=s.flush().buffer,c={frag:n,part:r,payload:l,networkDetails:null};this._handleFragmentLoadProgress(c),i&&super._handleFragmentLoadComplete(c)}else o&&o.cc!==e.frag.cc&&this.syncWithAnchor(o,e.frag)}else this.state=Mt.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime)}doTickIdle(){var e;const{hls:n,levels:r,media:s,trackId:i}=this,o=n.config;if(!this.buffering||!s&&!this.primaryPrefetch&&(this.startFragRequested||!o.startFragPrefetch)||!(r!=null&&r[i]))return;const l=r[i],c=l.details;if(!c||this.waitForLive(l)||this.waitForCdnTuneIn(c)){this.state=Mt.WAITING_TRACK,this.startFragRequested=!1;return}const d=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&d&&(this.bufferFlushed=!1,this.afterBufferFlushed(d,pa.AUDIO,Yn.AUDIO));const u=this.getFwdBufferInfo(d,Yn.AUDIO);if(u===null)return;if(!this.switchingTrack&&this._streamEnded(u,c)){n.trigger(ue.BUFFER_EOS,{type:"audio"}),this.state=Mt.ENDED;return}const h=u.len,m=n.maxBufferLength,f=c.fragments,p=f[0].start,g=this.getLoadPosition(),v=this.flushing?g:u.end;if(this.switchingTrack&&s){const w=g;c.PTSKnown&&w<p&&(u.end>p||u.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),s.currentTime=p+.05)}if(h>=m&&!this.switchingTrack&&v<f[f.length-1].start)return;let b=this.getNextFragment(v,c);if(b&&this.isLoopLoading(b,v)&&(b=this.getNextFragmentLoopLoading(b,c,u,Yn.MAIN,m)),!b){this.bufferFlushed=!0;return}if(this.exceedsMaxBuffer(u,m,b))return;let x=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&x&&xl(b)&&!b.endList&&(!c.live||!this.loadingParts&&v<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(x)===hc.OK&&(this.mainFragLoading=x=null),x&&xl(x))){if(b.start>x.end){const k=this.fragmentTracker.getFragAtPos(v,Yn.MAIN);k&&k.end>x.end&&(x=k,this.mainFragLoading={frag:k,targetBufferTime:null})}if(b.start>x.end)return}this.loadFragment(b,l,v)}onMediaDetaching(e,n){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,n)}onAudioTracksUpdated(e,{audioTracks:n}){this.resetTransmuxer(),this.levels=n.map(r=>new T6(r))}onAudioTrackSwitching(e,n){const r=!!n.url;this.trackId=n.id;const{fragCurrent:s}=this;s&&(s.abortRequests(),this.removeUnbufferedFrags(s.start)),this.resetLoadingState(),r?(this.switchingTrack=n,this.flushAudioIfNeeded(n),this.state!==Mt.STOPPED&&(this.setInterval(g9e),this.state=Mt.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=n,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,n){this.mainDetails=n.details;const r=this.cachedTrackLoadedData;r&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(ue.AUDIO_TRACK_LOADED,r))}onAudioTrackLoaded(e,n){var r;const{levels:s}=this,{details:i,id:o,groupId:l,track:c}=n;if(!s){this.warn(`Audio tracks reset while loading track ${o} "${c.name}" of "${l}"`);return}const d=this.mainDetails;if(!d||i.endCC>d.endCC||d.expired){this.cachedTrackLoadedData=n,this.state!==Mt.STOPPED&&(this.state=Mt.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${o} "${c.name}" of "${l}" loaded [${i.startSN},${i.endSN}]${i.lastPartSn?`[part-${i.lastPartSn}-${i.lastPartIndex}]`:""},duration:${i.totalduration}`);const u=s[o];let h=0;if(i.live||(r=u.details)!=null&&r.live){if(this.checkLiveUpdate(i),i.deltaUpdateFailed)return;if(u.details){var m;h=this.alignPlaylists(i,u.details,(m=this.levelLastLoaded)==null?void 0:m.details)}i.alignedSliding||(L0t(i,d),i.alignedSliding||qQ(i,d),h=i.fragmentStart)}u.details=i,this.levelLastLoaded=u,this.startFragRequested||this.setStartPosition(d,h),this.hls.trigger(ue.AUDIO_TRACK_UPDATED,{details:i,id:o,groupId:n.groupId}),this.state===Mt.WAITING_TRACK&&!this.waitForCdnTuneIn(i)&&(this.state=Mt.IDLE),this.tick()}_handleFragmentLoadProgress(e){var n;const r=e.frag,{part:s,payload:i}=e,{config:o,trackId:l,levels:c}=this;if(!c){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${r.sn} of level ${r.level} will not be buffered`);return}const d=c[l];if(!d){this.warn("Audio track is undefined on fragment load progress");return}const u=d.details;if(!u){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(r.start);return}const h=o.defaultAudioCodec||d.audioCodec||"mp4a.40.2";let m=this.transmuxer;m||(m=this.transmuxer=new twt(this.hls,Yn.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const f=this.initPTS[r.cc],p=(n=r.initSegment)==null?void 0:n.data;if(f!==void 0){const v=s?s.index:-1,b=v!==-1,x=new hTe(r.level,r.sn,r.stats.chunkCount,i.byteLength,v,b);m.push(i,p,h,"",r,s,u.totalduration,!1,x,f)}else{this.log(`Unknown video PTS for cc ${r.cc}, waiting for video PTS before demuxing audio frag ${r.sn} of [${u.startSN} ,${u.endSN}],track ${l}`);const{cache:g}=this.waitingData=this.waitingData||{frag:r,part:s,cache:new D0t,complete:!1};g.push(new Uint8Array(i)),this.state!==Mt.STOPPED&&(this.state=Mt.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,n){this.bufferFlushed=this.flushing=!1;const r=n.tracks.audio;r&&(this.mediaBuffer=r.buffer||null)}onFragLoading(e,n){!this.audioOnly&&n.frag.type===Yn.MAIN&&xl(n.frag)&&(this.mainFragLoading=n,this.state===Mt.IDLE&&this.tick())}onFragBuffered(e,n){const{frag:r,part:s}=n;if(r.type!==Yn.AUDIO){!this.audioOnly&&r.type===Yn.MAIN&&!r.elementaryStreams.video&&!r.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(r)){this.warn(`Fragment ${r.sn}${s?" p: "+s.index:""} of level ${r.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(xl(r)){this.fragPrevious=r;const i=this.switchingTrack;i&&(this.bufferedTrack=i,this.switchingTrack=null,this.hls.trigger(ue.AUDIO_TRACK_SWITCHED,Bi({},i)))}this.fragBufferedComplete(r,s),this.media&&this.tick()}onError(e,n){var r;if(n.fatal){this.state=Mt.ERROR;return}switch(n.details){case dt.FRAG_GAP:case dt.FRAG_PARSING_ERROR:case dt.FRAG_DECRYPT_ERROR:case dt.FRAG_LOAD_ERROR:case dt.FRAG_LOAD_TIMEOUT:case dt.KEY_LOAD_ERROR:case dt.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Yn.AUDIO,n);break;case dt.AUDIO_TRACK_LOAD_ERROR:case dt.AUDIO_TRACK_LOAD_TIMEOUT:case dt.LEVEL_PARSING_ERROR:!n.levelRetry&&this.state===Mt.WAITING_TRACK&&((r=n.context)==null?void 0:r.type)===Us.AUDIO_TRACK&&(this.state=Mt.IDLE);break;case dt.BUFFER_ADD_CODEC_ERROR:case dt.BUFFER_APPEND_ERROR:if(n.parent!=="audio")return;this.reduceLengthAndFlushBuffer(n)||this.resetLoadingState();break;case dt.BUFFER_FULL_ERROR:if(n.parent!=="audio")return;this.reduceLengthAndFlushBuffer(n)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case dt.INTERNAL_EXCEPTION:this.recoverWorkerError(n);break}}onBufferFlushing(e,{type:n}){n!==pa.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:n}){if(n!==pa.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===Mt.ENDED&&(this.state=Mt.IDLE);const r=this.mediaBuffer||this.media;r&&(this.afterBufferFlushed(r,n,Yn.AUDIO),this.tick())}}_handleTransmuxComplete(e){var n;const r="audio",{hls:s}=this,{remuxResult:i,chunkMeta:o}=e,l=this.getCurrentContext(o);if(!l){this.resetWhenMissingContext(o);return}const{frag:c,part:d,level:u}=l,{details:h}=u,{audio:m,text:f,id3:p,initSegment:g}=i;if(this.fragContextChanged(c)||!h){this.fragmentTracker.removeFragment(c);return}if(this.state=Mt.PARSING,this.switchingTrack&&m&&this.completeAudioSwitch(this.switchingTrack),g!=null&&g.tracks){const v=c.initSegment||c;if(this.unhandledEncryptionError(g,c))return;this._bufferInitSegment(u,g.tracks,v,o),s.trigger(ue.FRAG_PARSING_INIT_SEGMENT,{frag:v,id:r,tracks:g.tracks})}if(m){const{startPTS:v,endPTS:b,startDTS:x,endDTS:w}=m;d&&(d.elementaryStreams[pa.AUDIO]={startPTS:v,endPTS:b,startDTS:x,endDTS:w}),c.setElementaryStreamInfo(pa.AUDIO,v,b,x,w),this.bufferFragmentData(m,c,d,o)}if(p!=null&&(n=p.samples)!=null&&n.length){const v=ra({id:r,frag:c,details:h},p);s.trigger(ue.FRAG_PARSING_METADATA,v)}if(f){const v=ra({id:r,frag:c,details:h},f);s.trigger(ue.FRAG_PARSING_USERDATA,v)}}_bufferInitSegment(e,n,r,s){if(this.state!==Mt.PARSING||(n.video&&delete n.video,n.audiovideo&&delete n.audiovideo,!n.audio))return;const i=n.audio;i.id=Yn.AUDIO;const o=e.audioCodec;this.log(`Init audio buffer, container:${i.container}, codecs[level/parsed]=[${o}/${i.codec}]`),o&&o.split(",").length===1&&(i.levelCodec=o),this.hls.trigger(ue.BUFFER_CODECS,n);const l=i.initSegment;if(l!=null&&l.byteLength){const c={type:"audio",frag:r,part:null,chunkMeta:s,parent:r.type,data:l};this.hls.trigger(ue.BUFFER_APPENDING,c)}this.tickImmediate()}loadFragment(e,n,r){const s=this.fragmentTracker.getState(e);if(this.switchingTrack||s===hc.NOT_LOADED||s===hc.PARTIAL){var i;if(!xl(e))this._loadInitSegment(e,n);else if((i=n.details)!=null&&i.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=Mt.WAITING_INIT_PTS;const o=this.mainDetails;o&&o.fragmentStart!==n.details.fragmentStart&&qQ(n.details,o)}else super.loadFragment(e,n,r)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack){const{name:n,lang:r,assocLang:s,characteristics:i,audioCodec:o,channels:l}=this.bufferedTrack;Jj({name:n,lang:r,assocLang:s,characteristics:i,audioCodec:o,channels:l},e,BC)||(UQ(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:n}=this;this.flushAudioIfNeeded(e),this.bufferedTrack=e,this.switchingTrack=null,n.trigger(ue.AUDIO_TRACK_SWITCHED,Bi({},e))}},STe=class extends tp{constructor(e,n){super(n,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.hls=e}destroy(){this.clearTimer(),this.hls=this.log=this.warn=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,n,r){const s=n==null?void 0:n.renditionReports;if(s){let i=-1;for(let o=0;o<s.length;o++){const l=s[o];let c;try{c=new self.URL(l.URI,n.url).href}catch(d){this.warn(`Could not construct new URL for Rendition Report: ${d}`),c=l.URI||""}if(c===e){i=o;break}else c===e.substring(0,c.length)&&(i=o)}if(i!==-1){const o=s[i],l=parseInt(o["LAST-MSN"])||n.lastPartSn;let c=parseInt(o["LAST-PART"])||n.lastPartIndex;if(this.hls.config.lowLatencyMode){const u=Math.min(n.age-n.partTarget,n.targetduration);c>=0&&u>n.partTarget&&(c+=1)}const d=r&&PBe(r);return new RBe(l,c>=0?c:void 0,d)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,n){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,n){if(n)try{return n.addDirectives(e)}catch(r){this.warn(`Could not construct new URL with HLS Delivery Directives: ${r}`)}return e}playlistLoaded(e,n,r){const{details:s,stats:i}=n,o=self.performance.now(),l=i.loading.first?Math.max(0,o-i.loading.first):0;s.advancedDateTime=Date.now()-l;const c=this.hls.config.timelineOffset;if(c!==s.appliedTimelineOffset){const u=Math.max(c||0,0);s.appliedTimelineOffset=u,s.fragments.forEach(h=>{h.setStart(h.playlistOffset+u)})}if(s.live||r!=null&&r.live){const u="levelInfo"in n?n.levelInfo:n.track;if(s.reloaded(r),r&&s.fragments.length>0){wHn(r,s,this);const x=s.playlistParsingError;if(x){this.warn(x);const w=this.hls;if(!w.config.ignorePlaylistParsingErrors){var d;const{networkDetails:k}=n;w.trigger(ue.ERROR,{type:ur.NETWORK_ERROR,details:dt.LEVEL_PARSING_ERROR,fatal:!1,url:s.url,error:x,reason:x.message,level:n.level||void 0,parent:(d=s.fragments[0])==null?void 0:d.type,networkDetails:k,stats:i});return}s.playlistParsingError=null}}s.requestScheduled===-1&&(s.requestScheduled=i.loading.start);const h=this.hls.mainForwardBufferInfo,m=h?h.end-h.len:0,f=(s.edge-m)*1e3,p=A0t(s,f);if(s.requestScheduled+p<o?s.requestScheduled=o:s.requestScheduled+=p,this.log(`live playlist ${e} ${s.advanced?"REFRESHED "+s.lastPartSn+"-"+s.lastPartIndex:s.updated?"UPDATED":"MISSED"}`),!this.canLoad||!s.live)return;let g,v,b;if(s.canBlockReload&&s.endSN&&s.advanced){const x=this.hls.config.lowLatencyMode,w=s.lastPartSn,k=s.endSN,S=s.lastPartIndex,C=S!==-1,j=w===k;C?j?(v=k+1,b=x?0:S):(v=w,b=x?S+1:s.maxPartIndex):v=k+1;const E=s.age,N=E+s.ageHeader;let A=Math.min(N-s.partTarget,s.targetduration*1.5);if(A>0){if(N>s.targetduration*3)this.log(`Playlist last advanced ${E.toFixed(2)}s ago. Omitting segment and part directives.`),v=void 0,b=void 0;else if(r!=null&&r.tuneInGoal&&N-s.partTarget>r.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${r.tuneInGoal} to: ${A} with playlist age: ${s.age}`),A=0;else{const _=Math.floor(A/s.targetduration);if(v+=_,b!==void 0){const T=Math.round(A%s.targetduration/s.partTarget);b+=T}this.log(`CDN Tune-in age: ${s.ageHeader}s last advanced ${E.toFixed(2)}s goal: ${A} skip sn ${_} to part ${b}`)}s.tuneInGoal=A}if(g=this.getDeliveryDirectives(s,n.deliveryDirectives,v,b),x||!j){s.requestScheduled=o,this.loadingPlaylist(u,g);return}}else(s.canBlockReload||s.canSkipUntil)&&(g=this.getDeliveryDirectives(s,n.deliveryDirectives,v,b));g&&v!==void 0&&s.canBlockReload&&(s.requestScheduled=i.loading.first+Math.max(p-l*2,p/2)),this.scheduleLoading(u,g,s)}else this.clearTimer()}scheduleLoading(e,n,r){const s=r||e.details;if(!s){this.loadingPlaylist(e,n);return}const i=self.performance.now(),o=s.requestScheduled;if(i>=o){this.loadingPlaylist(e,n);return}const l=o-i;this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(l)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,n),l)}getDeliveryDirectives(e,n,r,s){let i=PBe(e);return n!=null&&n.skip&&e.deltaUpdateFailed&&(r=n.msn,s=n.part,i=UW.No),new RBe(r,s,i)}checkRetry(e){const n=e.details,r=zQ(e),s=e.errorAction,{action:i,retryCount:o=0,retryConfig:l}=s||{},c=!!s&&!!l&&(i===ad.RetryRequest||!s.resolved&&i===ad.SendAlternateToPenaltyBox);if(c){var d;if(o>=l.maxNumRetry)return!1;if(r&&(d=e.context)!=null&&d.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${l.maxNumRetry} after "${n}" without delivery-directives`),this.loadPlaylist();else{const u=dTe(l,o);this.clearTimer(),this.timer=self.setTimeout(()=>this.loadPlaylist(),u),this.warn(`Retrying playlist loading ${o+1}/${l.maxNumRetry} after "${n}" in ${u}ms`)}e.levelRetry=!0,s.resolved=!0}return c}};function nwt(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!R6(t[n].attrs,e[n].attrs))return!1;return!0}function R6(t,e,n){const r=t["STABLE-RENDITION-ID"];return r&&!n?r===e["STABLE-RENDITION-ID"]:!(n||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(s=>t[s]!==e[s])}function Fbe(t,e){return e.label.toLowerCase()===t.name.toLowerCase()&&(!e.language||e.language.toLowerCase()===(t.lang||"").toLowerCase())}let PGn=class extends STe{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.on(ue.LEVEL_LOADING,this.onLevelLoading,this),e.on(ue.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(ue.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(ue.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.off(ue.LEVEL_LOADING,this.onLevelLoading,this),e.off(ue.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(ue.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(ue.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,n){this.tracks=n.audioTracks||[]}onAudioTrackLoaded(e,n){const{id:r,groupId:s,details:i}=n,o=this.tracksInGroup[r];if(!o||o.groupId!==s){this.warn(`Audio track with id:${r} and group:${s} not found in active group ${o==null?void 0:o.groupId}`);return}const l=o.details;o.details=n.details,this.log(`Audio track ${r} "${o.name}" lang:${o.lang} group:${s} loaded [${i.startSN}-${i.endSN}]`),r===this.trackId&&this.playlistLoaded(r,n,l)}onLevelLoading(e,n){this.switchLevel(n.level)}onLevelSwitching(e,n){this.switchLevel(n.level)}switchLevel(e){const n=this.hls.levels[e];if(!n)return;const r=n.audioGroups||null,s=this.groupIds;let i=this.currentTrack;if(!r||(s==null?void 0:s.length)!==(r==null?void 0:r.length)||r!=null&&r.some(l=>(s==null?void 0:s.indexOf(l))===-1)){this.groupIds=r,this.trackId=-1,this.currentTrack=null;const l=this.tracks.filter(m=>!r||r.indexOf(m.groupId)!==-1);if(l.length)this.selectDefaultTrack&&!l.some(m=>m.default)&&(this.selectDefaultTrack=!1),l.forEach((m,f)=>{m.id=f});else if(!i&&!this.tracksInGroup.length)return;this.tracksInGroup=l;const c=this.hls.config.audioPreference;if(!i&&c){const m=ny(c,l,BC);if(m>-1)i=l[m];else{const f=ny(c,this.tracks);i=this.tracks[f]}}let d=this.findTrackId(i);d===-1&&i&&(d=this.findTrackId(null));const u={audioTracks:l};this.log(`Updating audio tracks, ${l.length} track(s) found in group(s): ${r==null?void 0:r.join(",")}`),this.hls.trigger(ue.AUDIO_TRACKS_UPDATED,u);const h=this.trackId;if(d!==-1&&h===-1)this.setAudioTrack(d);else if(l.length&&h===-1){var o;const m=new Error(`No audio track selected for current audio group-ID(s): ${(o=this.groupIds)==null?void 0:o.join(",")} track count: ${l.length}`);this.warn(m.message),this.hls.trigger(ue.ERROR,{type:ur.MEDIA_ERROR,details:dt.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:m})}}}onError(e,n){n.fatal||!n.context||n.context.type===Us.AUDIO_TRACK&&n.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(n.context.groupId)!==-1)&&this.checkRetry(n)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}setAudioOption(e){const n=this.hls;if(n.config.audioPreference=e,e){const r=this.allAudioTracks;if(this.selectDefaultTrack=!1,r.length){const s=this.currentTrack;if(s&&Jj(e,s,BC))return s;const i=ny(e,this.tracksInGroup,BC);if(i>-1){const o=this.tracksInGroup[i];return this.setAudioTrack(i),o}else if(s){let o=n.loadLevel;o===-1&&(o=n.firstAutoLevel);const l=zVn(e,n.levels,r,o,BC);if(l===-1)return null;n.nextLoadLevel=l}if(e.channels||e.audioCodec){const o=ny(e,r);if(o>-1)return r[o]}}}return null}setAudioTrack(e){const n=this.tracksInGroup;if(e<0||e>=n.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const r=this.currentTrack,s=n[e],i=s.details&&!s.details.live;if(e===this.trackId&&s===r&&i||(this.log(`Switching to audio-track ${e} "${s.name}" lang:${s.lang} group:${s.groupId} channels:${s.channels}`),this.trackId=e,this.currentTrack=s,this.hls.trigger(ue.AUDIO_TRACK_SWITCHING,Bi({},s)),i))return;const o=this.switchParams(s.url,r==null?void 0:r.details,s.details);this.loadPlaylist(o)}findTrackId(e){const n=this.tracksInGroup;for(let r=0;r<n.length;r++){const s=n[r];if(!(this.selectDefaultTrack&&!s.default)&&(!e||Jj(e,s,BC)))return r}if(e){const{name:r,lang:s,assocLang:i,characteristics:o,audioCodec:l,channels:c}=e;for(let d=0;d<n.length;d++){const u=n[d];if(Jj({name:r,lang:s,assocLang:i,characteristics:o,audioCodec:l,channels:c},u,BC))return d}for(let d=0;d<n.length;d++){const u=n[d];if(R6(e.attrs,u.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return d}for(let d=0;d<n.length;d++){const u=n[d];if(R6(e.attrs,u.attrs,["LANGUAGE"]))return d}}return-1}loadPlaylist(e){super.loadPlaylist();const n=this.currentTrack;this.shouldLoadPlaylist(n)&&UQ(n.url,this.hls)&&this.scheduleLoading(n,e)}loadingPlaylist(e,n){super.loadingPlaylist(e,n);const r=e.id,s=e.groupId,i=this.getUrlWithDirectives(e.url,n),o=e.details,l=o==null?void 0:o.age;this.log(`Loading audio-track ${r} "${e.name}" lang:${e.lang} group:${s}${(n==null?void 0:n.msn)!==void 0?" at sn "+n.msn+" part "+n.part:""}${l&&o.live?" age "+l.toFixed(1)+(o.type&&" "+o.type||""):""} ${i}`),this.hls.trigger(ue.AUDIO_TRACK_LOADING,{url:i,id:r,groupId:s,deliveryDirectives:n||null,track:e})}},RGn=class{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,n,r){if(this.queues===null||this.tracks===null)return;const s=this.queues[n];s.push(e),s.length===1&&!r&&this.executeNext(n)}appendBlocker(e){return new Promise(n=>{const r={label:"async-blocker",execute:n,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(r,e)})}prependBlocker(e){return new Promise(n=>{if(this.queues){const r={label:"async-blocker-prepend",execute:n,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(r)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var n;const r=(n=e[0])==null?void 0:n.label;(r==="async-blocker"||r==="async-blocker-prepend")&&(e[0].execute(),e.splice(0,1))})}unblockAudio(e){if(this.queues===null)return;this.queues.audio[0]===e&&this.shiftAndExecuteNext("audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const n=this.queues[e];if(n.length){const s=n[0];try{s.execute()}catch(i){var r;if(s.onError(i),this.queues===null||this.tracks===null)return;const o=(r=this.tracks[e])==null?void 0:r.buffer;o!=null&&o.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var n;return((n=this.queues)==null?void 0:n[e][0])||null}toString(){const{queues:e,tracks:n}=this;return e===null||n===null?"<destroyed>":`
${this.list("video")}
${this.list("audio")}
${this.list("audiovideo")}}`}list(e){var n,r;return(n=this.queues)!=null&&n[e]||(r=this.tracks)!=null&&r[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var n;const r=(n=this.tracks)==null?void 0:n[e],s=r==null?void 0:r.buffer;return s?`SourceBuffer${s.updating?" updating":""}${r.ended?" ended":""}${r.ending?" ending":""}`:"none"}listOps(e){var n;return((n=this.queues)==null?void 0:n[e].map(r=>r.label).join(", "))||""}};const v9e=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,rwt="HlsJsTrackRemovedError";let IGn=class extends Error{constructor(e){super(e),this.name=rwt}},MGn=class extends tp{constructor(e,n){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.blockedAudioAppend=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=r=>{var s;this.hls&&((s=this.mediaSource)==null?void 0:s.readyState)==="open"&&this.hls.pauseBuffering()},this._onStartStreaming=r=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=r=>{const{media:s,mediaSource:i}=this;r&&this.log("Media source opened"),!(!s||!i)&&(i.removeEventListener("sourceopen",this._onMediaSourceOpen),s.removeEventListener("emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(ue.MEDIA_ATTACHED,{media:s,mediaSource:i}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{this.log("Media source closed")},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:r,_objectUrl:s}=this;r!==s&&this.error(`Media element src was set while attaching MediaSource (${s} > ${r})`)},this.hls=e,this.fragmentTracker=n,this.appendSource=tVn(Ok(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null}registerListeners(){const{hls:e}=this;e.on(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.on(ue.BUFFER_RESET,this.onBufferReset,this),e.on(ue.BUFFER_APPENDING,this.onBufferAppending,this),e.on(ue.BUFFER_CODECS,this.onBufferCodecs,this),e.on(ue.BUFFER_EOS,this.onBufferEos,this),e.on(ue.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(ue.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(ue.FRAG_PARSED,this.onFragParsed,this),e.on(ue.FRAG_CHANGED,this.onFragChanged,this),e.on(ue.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.off(ue.BUFFER_RESET,this.onBufferReset,this),e.off(ue.BUFFER_APPENDING,this.onBufferAppending,this),e.off(ue.BUFFER_CODECS,this.onBufferCodecs,this),e.off(ue.BUFFER_EOS,this.onBufferEos,this),e.off(ue.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(ue.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(ue.FRAG_PARSED,this.onFragParsed,this),e.off(ue.FRAG_CHANGED,this.onFragChanged,this),e.off(ue.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:n}=this;if(!e)return null;const r={};if(this.operationQueue){const i=this.isUpdating();i||this.operationQueue.removeBlockers();const o=this.isQueued();(i||o)&&this.warn(`Transfering MediaSource with${o?" operations in queue":""}${i?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const s=this.transferData;return!this.sourceBufferCount&&s&&s.mediaSource===n?ra(r,s.tracks):this.sourceBuffers.forEach(i=>{const[o]=i;o&&(r[o]=ra({},this.tracks[o]),this.removeBuffer(o)),i[0]=i[1]=null}),{media:e,mediaSource:n,tracks:r}}initTracks(){const e={};this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.resetAppendErrors(),this.lastMpegAudioChunk=this.blockedAudioAppend=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null}onManifestParsed(e,n){var r;let s=2;(n.audio&&!n.video||!n.altAudio)&&(s=1),this.bufferCodecEventsTotal=s,this.log(`${s} bufferCodec event(s) expected.`),(r=this.transferData)!=null&&r.mediaSource&&this.sourceBufferCount&&s&&this.bufferCreated()}onMediaAttaching(e,n){const r=this.media=n.media;this.transferData=this.overrides=void 0;const s=Ok(this.appendSource);if(s){const i=!!n.mediaSource;(i||n.overrides)&&(this.transferData=n,this.overrides=n.overrides);const o=this.mediaSource=n.mediaSource||new s;if(this.assignMediaSource(o),i)this._objectUrl=r.src,this.attachTransferred();else{const l=this._objectUrl=self.URL.createObjectURL(o);if(this.appendSource)try{r.removeAttribute("src");const c=self.ManagedMediaSource;r.disableRemotePlayback=r.disableRemotePlayback||c&&o instanceof c,y9e(r),LGn(r,l),r.load()}catch{r.src=l}else r.src=l}r.addEventListener("emptied",this._onMediaEmptied)}}assignMediaSource(e){var n,r;this.log(`${((n=this.transferData)==null?void 0:n.mediaSource)===e?"transferred":"created"} media source: ${(r=e.constructor)==null?void 0:r.name}`),e.addEventListener("sourceopen",this._onMediaSourceOpen),e.addEventListener("sourceended",this._onMediaSourceEnded),e.addEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(e.addEventListener("startstreaming",this._onStartStreaming),e.addEventListener("endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,n=this.transferData;if(!n||!e)return;const r=this.tracks,s=n.tracks,i=s?Object.keys(s):null,o=i?i.length:0,l=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(s&&i&&o){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})
required tracks: ${va(r,(c,d)=>c==="initSegment"?void 0:d)};
transfer tracks: ${va(s,(c,d)=>c==="initSegment"?void 0:d)}}`),!Jxt(s,r)){n.mediaSource=null,n.tracks=void 0;const c=e.currentTime,d=this.details,u=Math.max(c,(d==null?void 0:d.fragments[0].start)||0);if(u-c>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${c} -> ${u}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(s)}"->"${Object.keys(r)}") start time: ${u} currentTime: ${c}`),this.onMediaDetaching(ue.MEDIA_DETACHING,{}),this.onMediaAttaching(ue.MEDIA_ATTACHING,n),e.currentTime=u;return}this.transferData=void 0,i.forEach(c=>{const d=c,u=s[d];if(u){const h=u.buffer;if(h){const m=this.fragmentTracker,f=u.id;if(m.hasFragments(f)||m.hasParts(f)){const v=$s.getBuffered(h);m.detectEvictedFragments(d,v,f,null,!0)}const p=Yce(d),g=[d,h];this.sourceBuffers[p]=g,h.updating&&this.operationQueue&&this.operationQueue.prependBlocker(d),this.trackSourceBuffer(d,u)}}}),l(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),l()}get mediaSourceOpenOrEnded(){var e;const n=(e=this.mediaSource)==null?void 0:e.readyState;return n==="open"||n==="ended"}onMediaDetaching(e,n){const r=!!n.transferMedia;this.transferData=this.overrides=void 0;const{media:s,mediaSource:i,_objectUrl:o}=this;if(i){if(this.log(`media source ${r?"transferring":"detaching"}`),r)this.sourceBuffers.forEach(([l])=>{l&&this.removeBuffer(l)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const l=i.readyState==="open";try{const c=i.sourceBuffers;for(let d=c.length;d--;)l&&c[d].abort(),i.removeSourceBuffer(c[d]);l&&i.endOfStream()}catch(c){this.warn(`onMediaDetaching: ${c.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}i.removeEventListener("sourceopen",this._onMediaSourceOpen),i.removeEventListener("sourceended",this._onMediaSourceEnded),i.removeEventListener("sourceclose",this._onMediaSourceClose),this.appendSource&&(i.removeEventListener("startstreaming",this._onStartStreaming),i.removeEventListener("endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}s&&(s.removeEventListener("emptied",this._onMediaEmptied),r||(o&&self.URL.revokeObjectURL(o),this.mediaSrc===o?(s.removeAttribute("src"),this.appendSource&&y9e(s),s.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null),this.hls.trigger(ue.MEDIA_DETACHED,n)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var n;const r=(n=this.tracks[e])==null?void 0:n.buffer;if(this.removeBuffer(e),r)try{var s;(s=this.mediaSource)!=null&&s.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(r)}catch(i){this.warn(`onBufferReset ${e}`,i)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[Yce(e)]=[null,null];const n=this.tracks[e];n&&(n.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new RGn(this.tracks)}onBufferCodecs(e,n){var r;const s=this.tracks,i=Object.keys(n);this.log(`BUFFER_CODECS: "${i}" (current SB count ${this.sourceBufferCount})`);const o="audiovideo"in n&&(s.audio||s.video)||s.audiovideo&&("audio"in n||"video"in n),l=!o&&this.sourceBufferCount&&this.media&&i.some(c=>!s[c]);if(o||l){this.warn(`Unsupported transition between "${Object.keys(s)}" and "${i}" SourceBuffers`);return}i.forEach(c=>{var d,u;const h=n[c],{id:m,codec:f,levelCodec:p,container:g,metadata:v,supplemental:b}=h;let x=s[c];const w=(d=this.transferData)==null||(d=d.tracks)==null?void 0:d[c],k=w!=null&&w.buffer?w:x,S=(k==null?void 0:k.pendingCodec)||(k==null?void 0:k.codec),C=k==null?void 0:k.levelCodec;x||(x=s[c]={buffer:void 0,listeners:[],codec:f,supplemental:b,container:g,levelCodec:p,metadata:v,id:m});const j=BW(S,C),E=j==null?void 0:j.replace(v9e,"$1");let N=BW(f,p);const A=(u=N)==null?void 0:u.replace(v9e,"$1");N&&j&&E!==A&&(c.slice(0,5)==="audio"&&(N=FQ(N,this.appendSource)),this.log(`switching codec ${S} to ${N}`),N!==(x.pendingCodec||x.codec)&&(x.pendingCodec=N),x.container=g,this.appendChangeType(c,g,N))}),(this.tracksReady||this.sourceBufferCount)&&(n.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!n.video&&((r=n.audio)==null?void 0:r.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,n)=>{const r=this.tracks[n];return e[n]={id:r.id,container:r.container,codec:r.codec,levelCodec:r.levelCodec},e},{})}appendChangeType(e,n,r){const s=`${n};codecs=${r}`,i={label:`change-type=${s}`,execute:()=>{const o=this.tracks[e];if(o){const l=o.buffer;l!=null&&l.changeType&&(this.log(`changing ${e} sourceBuffer type to ${s}`),l.changeType(s),o.codec=r,o.container=n)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn(`Failed to change ${e} SourceBuffer type`,o)}};this.append(i,e,this.isPending(this.tracks[e]))}blockAudio(e){var n;const r=e.start,s=r+e.duration*.05;if(((n=this.fragmentTracker.getAppendedFrag(r,Yn.MAIN))==null?void 0:n.gap)===!0)return;const o={label:"block-audio",execute:()=>{var l;const c=this.tracks.video;(this.lastVideoAppendEnd>s||c!=null&&c.buffer&&$s.isBuffered(c.buffer,s)||((l=this.fragmentTracker.getAppendedFrag(s,Yn.MAIN))==null?void 0:l.gap)===!0)&&(this.blockedAudioAppend=null,this.shiftAndExecuteNext("audio"))},onStart:()=>{},onComplete:()=>{},onError:l=>{this.warn("Error executing block-audio operation",l)}};this.blockedAudioAppend={op:o,frag:e},this.append(o,"audio",!0)}unblockAudio(){const{blockedAudioAppend:e,operationQueue:n}=this;e&&n&&(this.blockedAudioAppend=null,n.unblockAudio(e.op))}onBufferAppending(e,n){const{tracks:r}=this,{data:s,type:i,parent:o,frag:l,part:c,chunkMeta:d,offset:u}=n,h=d.buffering[i],{sn:m,cc:f}=l,p=self.performance.now();h.start=p;const g=l.stats.buffering,v=c?c.stats.buffering:null;g.start===0&&(g.start=p),v&&v.start===0&&(v.start=p);const b=r.audio;let x=!1;i==="audio"&&(b==null?void 0:b.container)==="audio/mpeg"&&(x=!this.lastMpegAudioChunk||d.id===1||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const w=r.video,k=w==null?void 0:w.buffer;if(k&&m!=="initSegment"){const j=c||l,E=this.blockedAudioAppend;if(i==="audio"&&o!=="main"&&!this.blockedAudioAppend&&!(w.ending||w.ended)){const A=j.start+j.duration*.05,_=k.buffered,T=this.currentOp("video");!_.length&&!T?this.blockAudio(j):!T&&!$s.isBuffered(k,A)&&this.lastVideoAppendEnd<A&&this.blockAudio(j)}else if(i==="video"){const N=j.end;if(E){const A=E.frag.start;(N>A||N<this.lastVideoAppendEnd||$s.isBuffered(k,A))&&this.unblockAudio()}this.lastVideoAppendEnd=N}}const S=(c||l).start,C={label:`append-${i}`,execute:()=>{var j;h.executeStart=self.performance.now();const E=(j=this.tracks[i])==null?void 0:j.buffer;E&&(x?this.updateTimestampOffset(E,S,.1,i,m,f):u!==void 0&&$n(u)&&this.updateTimestampOffset(E,u,1e-6,i,m,f)),this.appendExecutor(s,i)},onStart:()=>{},onComplete:()=>{const j=self.performance.now();h.executeEnd=h.end=j,g.first===0&&(g.first=j),v&&v.first===0&&(v.first=j);const E={};this.sourceBuffers.forEach(([N,A])=>{N&&(E[N]=$s.getBuffered(A))}),this.appendErrors[i]=0,i==="audio"||i==="video"?this.appendErrors.audiovideo=0:(this.appendErrors.audio=0,this.appendErrors.video=0),this.hls.trigger(ue.BUFFER_APPENDED,{type:i,frag:l,part:c,chunkMeta:d,parent:l.type,timeRanges:E})},onError:j=>{var E;const N={type:ur.MEDIA_ERROR,parent:l.type,details:dt.BUFFER_APPEND_ERROR,sourceBufferName:i,frag:l,part:c,chunkMeta:d,error:j,err:j,fatal:!1},A=(E=this.media)==null?void 0:E.error;if(j.code===DOMException.QUOTA_EXCEEDED_ERR||j.name=="QuotaExceededError"||"quota"in j)N.details=dt.BUFFER_FULL_ERROR;else if(j.code===DOMException.INVALID_STATE_ERR&&this.mediaSourceOpenOrEnded&&!A)N.errorAction=eP(!0);else if(j.name===rwt&&this.sourceBufferCount===0)N.errorAction=eP(!0);else{const _=++this.appendErrors[i];this.warn(`Failed ${_}/${this.hls.config.appendErrorMaxRetry} times to append segment in "${i}" sourceBuffer (${A||"no media error"})`),(_>=this.hls.config.appendErrorMaxRetry||A)&&(N.fatal=!0)}this.hls.trigger(ue.ERROR,N)}};this.log(`queuing "${i}" append sn: ${m}${c?" p: "+c.index:""} of ${l.type===Yn.MAIN?"level":"track"} ${l.level} cc: ${f}`),this.append(C,i,this.isPending(this.tracks[i]))}getFlushOp(e,n,r){return this.log(`queuing "${e}" remove ${n}-${r}`),{label:"remove",execute:()=>{this.removeExecutor(e,n,r)},onStart:()=>{},onComplete:()=>{this.hls.trigger(ue.BUFFER_FLUSHED,{type:e})},onError:s=>{this.warn(`Failed to remove ${n}-${r} from "${e}" SourceBuffer`,s)}}}onBufferFlushing(e,n){const{type:r,startOffset:s,endOffset:i}=n;r?this.append(this.getFlushOp(r,s,i),r):this.sourceBuffers.forEach(([o])=>{o&&this.append(this.getFlushOp(o,s,i),o)})}onFragParsed(e,n){const{frag:r,part:s}=n,i=[],o=s?s.elementaryStreams:r.elementaryStreams;o[pa.AUDIOVIDEO]?i.push("audiovideo"):(o[pa.AUDIO]&&i.push("audio"),o[pa.VIDEO]&&i.push("video"));const l=()=>{const c=self.performance.now();r.stats.buffering.end=c,s&&(s.stats.buffering.end=c);const d=s?s.stats:r.stats;this.hls.trigger(ue.FRAG_BUFFERED,{frag:r,part:s,stats:d,id:r.type})};i.length===0&&this.warn(`Fragments must have at least one ElementaryStreamType set. type: ${r.type} level: ${r.level} sn: ${r.sn}`),this.blockBuffers(l,i).catch(c=>{this.warn(`Fragment buffered callback ${c}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,n){this.trimBuffers()}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){const n=this.tracks[e];if(n)return!n.ended||n.ending}return!1})}onBufferEos(e,n){var r;this.sourceBuffers.forEach(([o])=>{if(o){const l=this.tracks[o];(!n.type||n.type===o)&&(l.ending=!0,l.ended||(l.ended=!0,this.log(`${o} buffer reached EOS`)))}});const s=((r=this.overrides)==null?void 0:r.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([o])=>{var l;return o&&!((l=this.tracks[o])!=null&&l.ended)})?s?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:o}=this;if(!o||o.readyState!=="open"){o&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${o.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),o.endOfStream(),this.hls.trigger(ue.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(ue.BUFFERED_TO_END,void 0)):n.type==="video"&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const n=this.tracks[e];n&&(n.ending=!1)}})}onLevelUpdated(e,{details:n}){n.fragments.length&&(this.details=n,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,n){if(n.details===dt.BUFFER_APPEND_ERROR&&n.frag){var r;const s=(r=n.errorAction)==null?void 0:r.nextAutoLevel;$n(s)&&s!==n.frag.level&&this.resetAppendErrors()}}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0}}trimBuffers(){const{hls:e,details:n,media:r}=this;if(!r||n===null||!this.sourceBufferCount)return;const s=e.config,i=r.currentTime,o=n.levelTargetDuration,l=n.live&&s.liveBackBufferLength!==null?s.liveBackBufferLength:s.backBufferLength;if($n(l)&&l>=0){const d=Math.max(l,o),u=Math.floor(i/o)*o-d;this.flushBackBuffer(i,o,u)}const c=s.frontBufferFlushThreshold;if($n(c)&&c>0){const d=Math.max(s.maxBufferLength,c),u=Math.max(d,o),h=Math.floor(i/o)*o+u;this.flushFrontBuffer(i,o,h)}}flushBackBuffer(e,n,r){this.sourceBuffers.forEach(([s,i])=>{if(i){const l=$s.getBuffered(i);if(l.length>0&&r>l.start(0)){var o;this.hls.trigger(ue.BACK_BUFFER_REACHED,{bufferEnd:r});const c=this.tracks[s];if((o=this.details)!=null&&o.live)this.hls.trigger(ue.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r});else if(c!=null&&c.ended){this.log(`Cannot flush ${s} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(ue.BUFFER_FLUSHING,{startOffset:0,endOffset:r,type:s})}}})}flushFrontBuffer(e,n,r){this.sourceBuffers.forEach(([s,i])=>{if(i){const o=$s.getBuffered(i),l=o.length;if(l<2)return;const c=o.start(l-1),d=o.end(l-1);if(r>c||e>=c&&e<=d)return;this.hls.trigger(ue.BUFFER_FLUSHING,{startOffset:c,endOffset:1/0,type:s})}})}getDurationAndRange(){var e;const{details:n,mediaSource:r}=this;if(!n||!this.media||(r==null?void 0:r.readyState)!=="open")return null;const s=n.edge;if(n.live&&this.hls.config.liveDurationInfinity){if(n.fragments.length&&r.setLiveSeekableRange){const d=Math.max(0,n.fragmentStart),u=Math.max(d,s);return{duration:1/0,start:d,end:u}}return{duration:1/0}}const i=(e=this.overrides)==null?void 0:e.duration;if(i)return $n(i)?{duration:i}:null;const o=this.media.duration,l=$n(r.duration)?r.duration:0;return s>l&&s>o||!$n(o)?{duration:s}:null}updateMediaSource({duration:e,start:n,end:r}){const s=this.mediaSource;!this.media||!s||s.readyState!=="open"||(s.duration!==e&&($n(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),s.duration=e),n!==void 0&&r!==void 0&&(this.log(`MediaSource duration is set to ${s.duration}. Setting seekable range to ${n}-${r}.`),s.setLiveSeekableRange(n,r)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:n,tracks:r}=this;if(this.log(`checkPendingTracks (pending: ${n} codec events expected: ${e}) ${va(r)}`),this.tracksReady){var s;const i=(s=this.transferData)==null?void 0:s.tracks;i&&Object.keys(i).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([n,r])=>{if(n){const s=this.tracks[n];e[n]={buffer:r,container:s.container,codec:s.codec,supplemental:s.supplemental,levelCodec:s.levelCodec,id:s.id,metadata:s.metadata}}}),this.hls.trigger(ue.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([n])=>{this.executeNext(n)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(ue.ERROR,{type:ur.MEDIA_ERROR,details:dt.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:n,mediaSource:r}=this;if(!r)throw new Error("createSourceBuffers called when mediaSource was null");for(const i in e){const o=i,l=e[o];if(this.isPending(l)){const c=this.getTrackCodec(l,o),d=`${l.container};codecs=${c}`;l.codec=c,this.log(`creating sourceBuffer(${d})${this.currentOp(o)?" Queued":""} ${va(l)}`);try{const u=r.addSourceBuffer(d),h=Yce(o),m=[o,u];n[h]=m,l.buffer=u}catch(u){var s;this.error(`error while trying to add sourceBuffer: ${u.message}`),this.shiftAndExecuteNext(o),(s=this.operationQueue)==null||s.removeBlockers(),delete this.tracks[o],this.hls.trigger(ue.ERROR,{type:ur.MEDIA_ERROR,details:dt.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,sourceBufferName:o,mimeType:d,parent:l.id});return}this.trackSourceBuffer(o,l)}}this.bufferCreated()}getTrackCodec(e,n){const r=e.supplemental;let s=e.codec;r&&(n==="video"||n==="audiovideo")&&E6(r,"video")&&(s=SVn(s,r));const i=BW(s,e.levelCodec);return i?n.slice(0,5)==="audio"?FQ(i,this.appendSource):i:""}trackSourceBuffer(e,n){const r=n.buffer;if(!r)return;const s=this.getTrackCodec(n,e);this.tracks[e]={buffer:r,codec:s,container:n.container,levelCodec:n.levelCodec,supplemental:n.supplemental,metadata:n.metadata,id:n.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(i,o)=>{const l=o.removedRanges;l!=null&&l.length&&this.hls.trigger(ue.BUFFER_FLUSHED,{type:i})})}get mediaSrc(){var e,n;const r=((e=this.media)==null||(n=e.querySelector)==null?void 0:n.call(e,"source"))||this.media;return r==null?void 0:r.src}onSBUpdateStart(e){const n=this.currentOp(e);n&&n.onStart()}onSBUpdateEnd(e){var n;if(((n=this.mediaSource)==null?void 0:n.readyState)==="closed"){this.resetBuffer(e);return}const r=this.currentOp(e);r&&(r.onComplete(),this.shiftAndExecuteNext(e))}onSBUpdateError(e,n){var r;const s=new Error(`${e} SourceBuffer error. MediaSource readyState: ${(r=this.mediaSource)==null?void 0:r.readyState}`);this.error(`${s}`,n),this.hls.trigger(ue.ERROR,{type:ur.MEDIA_ERROR,details:dt.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:s,fatal:!1});const i=this.currentOp(e);i&&i.onError(s)}updateTimestampOffset(e,n,r,s,i,o){const l=n-e.timestampOffset;Math.abs(l)>=r&&(this.log(`Updating ${s} SourceBuffer timestampOffset to ${n} (sn: ${i} cc: ${o})`),e.timestampOffset=n)}removeExecutor(e,n,r){const{media:s,mediaSource:i}=this,o=this.tracks[e],l=o==null?void 0:o.buffer;if(!s||!i||!l){this.warn(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`),this.shiftAndExecuteNext(e);return}const c=$n(s.duration)?s.duration:1/0,d=$n(i.duration)?i.duration:1/0,u=Math.max(0,n),h=Math.min(r,c,d);h>u&&(!o.ending||o.ended)?(o.ended=!1,this.log(`Removing [${u},${h}] from the ${e} SourceBuffer`),l.remove(u,h)):this.shiftAndExecuteNext(e)}appendExecutor(e,n){const r=this.tracks[n],s=r==null?void 0:r.buffer;if(!s)throw new IGn(`Attempting to append to the ${n} SourceBuffer, but it does not exist`);r.ending=!1,r.ended=!1,s.appendBuffer(e)}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(n=>{this.warn(`SourceBuffer blocked callback ${n}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(n){this.warn(`Callback run without blocking ${this.operationQueue} ${n}`)}}isUpdating(){return this.sourceBuffers.some(([e,n])=>e&&n.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}blockBuffers(e,n=this.sourceBufferTypes){if(!n.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:r}=this,s=n.map(o=>this.appendBlocker(o));return n.length>1&&!!this.blockedAudioAppend&&this.unblockAudio(),Promise.all(s).then(o=>{r===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(n=>{var r;const s=(r=this.tracks[n])==null?void 0:r.buffer;!s||s.updating||this.shiftAndExecuteNext(n)})}append(e,n,r){this.operationQueue&&this.operationQueue.append(e,n,r)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,n)=>e+(this.isPending(this.tracks[n])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[n])=>e+(n?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,n,r){const s=this.tracks[e];if(!s)return;const i=s.buffer;if(!i)return;const o=r.bind(this,e);s.listeners.push({event:n,listener:o}),i.addEventListener(n,o)}removeBufferListeners(e){const n=this.tracks[e];if(!n)return;const r=n.buffer;r&&(n.listeners.forEach(s=>{r.removeEventListener(s.event,s.listener)}),n.listeners.length=0)}};function y9e(t){const e=t.querySelectorAll("source");[].slice.call(e).forEach(n=>{t.removeChild(n)})}function LGn(t,e){const n=self.document.createElement("source");n.type="video/mp4",n.src=e,t.appendChild(n)}function Yce(t){return t==="audio"?1:0}let DGn=class swt{constructor(e){this.hls=void 0,this.autoLevelCapping=void 0,this.firstLevel=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.firstLevel=-1,this.media=null,this.restrictedLevels=[],this.timer=void 0,this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),this.timer&&this.stopCapping(),this.media=null,this.clientRect=null,this.hls=this.streamController=null}registerListeners(){const{hls:e}=this;e.on(ue.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.on(ue.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(ue.BUFFER_CODECS,this.onBufferCodecs,this),e.on(ue.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListener(){const{hls:e}=this;e.off(ue.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.off(ue.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(ue.BUFFER_CODECS,this.onBufferCodecs,this),e.off(ue.MEDIA_DETACHING,this.onMediaDetaching,this)}onFpsDropLevelCapping(e,n){const r=this.hls.levels[n.droppedLevel];this.isLevelAllowed(r)&&this.restrictedLevels.push({bitrate:r.bitrate,height:r.height,width:r.width})}onMediaAttaching(e,n){this.media=n.media instanceof HTMLVideoElement?n.media:null,this.clientRect=null,this.timer&&this.hls.levels.length&&this.detectPlayerSize()}onManifestParsed(e,n){const r=this.hls;this.restrictedLevels=[],this.firstLevel=n.firstLevel,r.config.capLevelToPlayerSize&&n.video&&this.startCapping()}onLevelsUpdated(e,n){this.timer&&$n(this.autoLevelCapping)&&this.detectPlayerSize()}onBufferCodecs(e,n){this.hls.config.capLevelToPlayerSize&&n.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0){this.clientRect=null;return}const e=this.hls.levels;if(e.length){const n=this.hls,r=this.getMaxLevel(e.length-1);r!==this.autoLevelCapping&&n.logger.log(`Setting autoLevelCapping to ${r}: ${e[r].height}p@${e[r].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),n.autoLevelCapping=r,n.autoLevelEnabled&&n.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=n.autoLevelCapping}}}getMaxLevel(e){const n=this.hls.levels;if(!n.length)return-1;const r=n.filter((s,i)=>this.isLevelAllowed(s)&&i<=e);return this.clientRect=null,swt.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)}startCapping(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,n={width:0,height:0};if(e){const r=e.getBoundingClientRect();n.width=r.width,n.height=r.height,!n.width&&!n.height&&(n.width=r.right-r.left||e.width||0,n.height=r.bottom-r.top||e.height||0)}return this.clientRect=n,n}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls.config.ignoreDevicePixelRatio)try{e=self.devicePixelRatio}catch{}return Math.min(e,this.hls.config.maxDevicePixelRatio)}isLevelAllowed(e){return!this.restrictedLevels.some(r=>e.bitrate===r.bitrate&&e.width===r.width&&e.height===r.height)}static getMaxLevelByMediaSize(e,n,r){if(!(e!=null&&e.length))return-1;const s=(l,c)=>c?l.width!==c.width||l.height!==c.height:!0;let i=e.length-1;const o=Math.max(n,r);for(let l=0;l<e.length;l+=1){const c=e[l];if((c.width>=o||c.height>=o)&&s(c,e[l+1])){i=l;break}}return i}};const $Gn={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},Hu=$Gn,OGn={HLS:"h"},FGn=OGn;let H2=class Bbe{constructor(e,n){Array.isArray(e)&&(e=e.map(r=>r instanceof Bbe?r:new Bbe(r))),this.value=e,this.params=n}};const BGn="Dict";function UGn(t){return Array.isArray(t)?JSON.stringify(t):t instanceof Map?"Map{}":t instanceof Set?"Set{}":typeof t=="object"?JSON.stringify(t):String(t)}function zGn(t,e,n,r){return new Error(`failed to ${t} "${UGn(e)}" as ${n}`,{cause:r})}function Ry(t,e,n){return zGn("serialize",t,e,n)}let iwt=class{constructor(e){this.description=e}};const b9e="Bare Item",VGn="Boolean";function HGn(t){if(typeof t!="boolean")throw Ry(t,VGn);return t?"?1":"?0"}function GGn(t){return btoa(String.fromCharCode(...t))}const WGn="Byte Sequence";function qGn(t){if(ArrayBuffer.isView(t)===!1)throw Ry(t,WGn);return`:${GGn(t)}:`}const KGn="Integer";function YGn(t){return t<-999999999999999||999999999999999<t}function awt(t){if(YGn(t))throw Ry(t,KGn);return t.toString()}function QGn(t){return`@${awt(t.getTime()/1e3)}`}function owt(t,e){if(t<0)return-owt(-t,e);const n=Math.pow(10,e);if(Math.abs(t*n%1-.5)<Number.EPSILON){const s=Math.floor(t*n);return(s%2===0?s:s+1)/n}else return Math.round(t*n)/n}const ZGn="Decimal";function JGn(t){const e=owt(t,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Ry(t,ZGn);const n=e.toString();return n.includes(".")?n:`${n}.0`}const XGn="String",eWn=/[\x00-\x1f\x7f]+/;function tWn(t){if(eWn.test(t))throw Ry(t,XGn);return`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function nWn(t){return t.description||t.toString().slice(7,-1)}const rWn="Token";function x9e(t){const e=nWn(t);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Ry(e,rWn);return e}function Ube(t){switch(typeof t){case"number":if(!$n(t))throw Ry(t,b9e);return Number.isInteger(t)?awt(t):JGn(t);case"string":return tWn(t);case"symbol":return x9e(t);case"boolean":return HGn(t);case"object":if(t instanceof Date)return QGn(t);if(t instanceof Uint8Array)return qGn(t);if(t instanceof iwt)return x9e(t);default:throw Ry(t,b9e)}}const sWn="Key";function zbe(t){if(/^[a-z*][a-z0-9\-_.*]*$/.test(t)===!1)throw Ry(t,sWn);return t}function CTe(t){return t==null?"":Object.entries(t).map(([e,n])=>n===!0?`;${zbe(e)}`:`;${zbe(e)}=${Ube(n)}`).join("")}function lwt(t){return t instanceof H2?`${Ube(t.value)}${CTe(t.params)}`:Ube(t)}function iWn(t){return`(${t.value.map(lwt).join(" ")})${CTe(t.params)}`}function aWn(t,e={whitespace:!0}){if(typeof t!="object"||t==null)throw Ry(t,BGn);const n=t instanceof Map?t.entries():Object.entries(t),r=e!=null&&e.whitespace?" ":"";return Array.from(n).map(([s,i])=>{i instanceof H2||(i=new H2(i));let o=zbe(s);return i.value===!0?o+=CTe(i.params):(o+="=",Array.isArray(i.value)?o+=iWn(i):o+=lwt(i)),o}).join(`,${r}`)}function cwt(t,e){return aWn(t,e)}const mv="CMCD-Object",Wo="CMCD-Request",rC="CMCD-Session",cw="CMCD-Status",oWn={br:mv,ab:mv,d:mv,ot:mv,tb:mv,tpb:mv,lb:mv,tab:mv,lab:mv,url:mv,pb:Wo,bl:Wo,tbl:Wo,dl:Wo,ltc:Wo,mtp:Wo,nor:Wo,nrr:Wo,rc:Wo,sn:Wo,sta:Wo,su:Wo,ttfb:Wo,ttfbb:Wo,ttlb:Wo,cmsdd:Wo,cmsds:Wo,smrt:Wo,df:Wo,cs:Wo,ts:Wo,cid:rC,pr:rC,sf:rC,sid:rC,st:rC,v:rC,msd:rC,bs:cw,bsd:cw,cdn:cw,rtp:cw,bg:cw,pt:cw,ec:cw,e:cw},lWn={REQUEST:Wo};function cWn(t){return Object.keys(t).reduce((e,n)=>{var r;return(r=t[n])===null||r===void 0||r.forEach(s=>e[s]=n),e},{})}function dWn(t,e){const n={};if(!t)return n;const r=Object.keys(t),s=e?cWn(e):{};return r.reduce((i,o)=>{var l;const c=oWn[o]||s[o]||lWn.REQUEST,d=(l=i[c])!==null&&l!==void 0?l:i[c]={};return d[o]=t[o],i},n)}function uWn(t){return["ot","sf","st","e","sta"].includes(t)}function hWn(t){return typeof t=="number"?$n(t):t!=null&&t!==""&&t!==!1}const dwt="event";function mWn(t,e){const n=new URL(t),r=new URL(e);if(n.origin!==r.origin)return t;const s=n.pathname.split("/").slice(1),i=r.pathname.split("/").slice(1,-1);for(;s[0]===i[0];)s.shift(),i.shift();for(;i.length;)i.shift(),s.unshift("..");return s.join("/")+n.search+n.hash}const WW=t=>Math.round(t),Vbe=(t,e)=>Array.isArray(t)?t.map(n=>Vbe(n,e)):t instanceof H2&&typeof t.value=="string"?new H2(Vbe(t.value,e),t.params):(e.baseUrl&&(t=mWn(t,e.baseUrl)),e.version===1?encodeURIComponent(t):t),eV=t=>WW(t/100)*100,fWn=(t,e)=>{let n=t;return e.version>=2&&(t instanceof H2&&typeof t.value=="string"?n=new H2([t]):typeof t=="string"&&(n=[t])),Vbe(n,e)},pWn={br:WW,d:WW,bl:eV,dl:eV,mtp:eV,nor:fWn,rtp:eV,tb:WW},uwt="request",hwt="response",jTe=["ab","bg","bl","br","bs","bsd","cdn","cid","cs","df","ec","lab","lb","ltc","msd","mtp","pb","pr","pt","sf","sid","sn","st","sta","tab","tb","tbl","tpb","ts","v"],gWn=["e"],vWn=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function vre(t){return vWn.test(t)}function yWn(t){return jTe.includes(t)||gWn.includes(t)||vre(t)}const mwt=["d","dl","nor","ot","rtp","su"];function bWn(t){return jTe.includes(t)||mwt.includes(t)||vre(t)}const xWn=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"];function wWn(t){return jTe.includes(t)||mwt.includes(t)||xWn.includes(t)||vre(t)}const kWn=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"];function SWn(t){return kWn.includes(t)||vre(t)}const CWn={[hwt]:wWn,[dwt]:yWn,[uwt]:bWn};function fwt(t,e={}){const n={};if(t==null||typeof t!="object")return n;const r=e.version||t.v||1,s=e.reportingMode||uwt,i=r===1?SWn:CWn[s];let o=Object.keys(t).filter(i);const l=e.filter;typeof l=="function"&&(o=o.filter(l));const c=s===hwt||s===dwt;c&&!o.includes("ts")&&o.push("ts"),r>1&&!o.includes("v")&&o.push("v");const d=ra({},pWn,e.formatters),u={version:r,reportingMode:s,baseUrl:e.baseUrl};return o.sort().forEach(h=>{let m=t[h];const f=d[h];if(typeof f=="function"&&(m=f(m,u)),h==="v"){if(r===1)return;m=r}h=="pr"&&m===1||(c&&h==="ts"&&!$n(m)&&(m=Date.now()),hWn(m)&&(uWn(h)&&typeof m=="string"&&(m=new iwt(m)),n[h]=m))}),n}function jWn(t,e={}){const n={};if(!t)return n;const r=fwt(t,e),s=dWn(r,e==null?void 0:e.customHeaderMap);return Object.entries(s).reduce((i,[o,l])=>{const c=cwt(l,{whitespace:!1});return c&&(i[o]=c),i},n)}function EWn(t,e,n){return ra(t,jWn(e,n))}const NWn="CMCD";function TWn(t,e={}){return t?cwt(fwt(t,e),{whitespace:!1}):""}function _Wn(t,e={}){if(!t)return"";const n=TWn(t,e);return encodeURIComponent(n)}function AWn(t,e={}){if(!t)return"";const n=_Wn(t,e);return`${NWn}=${n}`}const w9e=/CMCD=[^&#]+/;function PWn(t,e,n){const r=AWn(e,n);if(!r)return t;if(w9e.test(t))return t.replace(w9e,r);const s=t.includes("?")?"&":"?";return`${t}${s}${r}`}let RWn=class{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.sid=void 0,this.cid=void 0,this.useHeaders=!1,this.includeKeys=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.audioBuffer=void 0,this.videoBuffer=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0),this.buffering=!0},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1},this.applyPlaylistData=s=>{try{this.apply(s,{ot:Hu.MANIFEST,su:!this.initialized})}catch(i){this.hls.logger.warn("Could not generate manifest CMCD data.",i)}},this.applyFragmentData=s=>{try{const{frag:i,part:o}=s,l=this.hls.levels[i.level],c=this.getObjectType(i),d={d:(o||i).duration*1e3,ot:c};(c===Hu.VIDEO||c===Hu.AUDIO||c==Hu.MUXED)&&(d.br=l.bitrate/1e3,d.tb=this.getTopBandwidth(c)/1e3,d.bl=this.getBufferLength(c));const u=o?this.getNextPart(o):this.getNextFrag(i);u!=null&&u.url&&u.url!==i.url&&(d.nor=u.url),this.apply(s,d)}catch(i){this.hls.logger.warn("Could not generate segment CMCD data.",i)}},this.hls=e;const n=this.config=e.config,{cmcd:r}=n;r!=null&&(n.pLoader=this.createPlaylistLoader(),n.fLoader=this.createFragmentLoader(),this.sid=r.sessionId||e.sessionId,this.cid=r.contentId,this.useHeaders=r.useHeaders===!0,this.includeKeys=r.includeKeys,this.registerListeners())}registerListeners(){const e=this.hls;e.on(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(ue.MEDIA_DETACHED,this.onMediaDetached,this),e.on(ue.BUFFER_CREATED,this.onBufferCreated,this)}unregisterListeners(){const e=this.hls;e.off(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(ue.MEDIA_DETACHED,this.onMediaDetached,this),e.off(ue.BUFFER_CREATED,this.onBufferCreated,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.hls=this.config=this.audioBuffer=this.videoBuffer=null,this.onWaiting=this.onPlaying=this.media=null}onMediaAttached(e,n){this.media=n.media,this.media.addEventListener("waiting",this.onWaiting),this.media.addEventListener("playing",this.onPlaying)}onMediaDetached(){this.media&&(this.media.removeEventListener("waiting",this.onWaiting),this.media.removeEventListener("playing",this.onPlaying),this.media=null)}onBufferCreated(e,n){var r,s;this.audioBuffer=(r=n.tracks.audio)==null?void 0:r.buffer,this.videoBuffer=(s=n.tracks.video)==null?void 0:s.buffer}createData(){var e;return{v:1,sf:FGn.HLS,sid:this.sid,cid:this.cid,pr:(e=this.media)==null?void 0:e.playbackRate,mtp:this.hls.bandwidthEstimate/1e3}}apply(e,n={}){ra(n,this.createData());const r=n.ot===Hu.INIT||n.ot===Hu.VIDEO||n.ot===Hu.MUXED;this.starved&&r&&(n.bs=!0,n.su=!0,this.starved=!1),n.su==null&&(n.su=this.buffering);const{includeKeys:s}=this;s&&(n=Object.keys(n).reduce((o,l)=>(s.includes(l)&&(o[l]=n[l]),o),{}));const i={baseUrl:e.url};this.useHeaders?(e.headers||(e.headers={}),EWn(e.headers,n,i)):e.url=PWn(e.url,n,i)}getNextFrag(e){var n;const r=(n=this.hls.levels[e.level])==null?void 0:n.details;if(r){const s=e.sn-r.startSN;return r.fragments[s+1]}}getNextPart(e){var n;const{index:r,fragment:s}=e,i=(n=this.hls.levels[s.level])==null||(n=n.details)==null?void 0:n.partList;if(i){const{sn:o}=s;for(let l=i.length-1;l>=0;l--){const c=i[l];if(c.index===r&&c.fragment.sn===o)return i[l+1]}}}getObjectType(e){const{type:n}=e;if(n==="subtitle")return Hu.TIMED_TEXT;if(e.sn==="initSegment")return Hu.INIT;if(n==="audio")return Hu.AUDIO;if(n==="main")return this.hls.audioTracks.length?Hu.VIDEO:Hu.MUXED}getTopBandwidth(e){let n=0,r;const s=this.hls;if(e===Hu.AUDIO)r=s.audioTracks;else{const i=s.maxAutoLevel,o=i>-1?i+1:s.levels.length;r=s.levels.slice(0,o)}return r.forEach(i=>{i.bitrate>n&&(n=i.bitrate)}),n>0?n:NaN}getBufferLength(e){const n=this.media,r=e===Hu.AUDIO?this.audioBuffer:this.videoBuffer;return!r||!n?NaN:$s.bufferInfo(r,n.currentTime,this.config.maxBufferHole).len*1e3}createPlaylistLoader(){const{pLoader:e}=this.config,n=this.applyPlaylistData,r=e||this.config.loader;return class{constructor(i){this.loader=void 0,this.loader=new r(i)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(i,o,l){n(i),this.loader.load(i,o,l)}}}createFragmentLoader(){const{fLoader:e}=this.config,n=this.applyFragmentData,r=e||this.config.loader;return class{constructor(i){this.loader=void 0,this.loader=new r(i)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(i,o,l){n(i),this.loader.load(i,o,l)}}}};const IWn=3e5;let MWn=class extends tp{constructor(e){super("content-steering",e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.on(ue.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.off(ue.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,n)=>(e.indexOf(n.pathwayId)===-1&&e.push(n.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const n=this.levels;n&&(this.levels=n.filter(r=>r!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,n){const{contentSteering:r}=n;r!==null&&(this.pathwayId=r.pathwayId,this.uri=r.uri,this.started&&this.startLoad())}onManifestParsed(e,n){this.audioTracks=n.audioTracks,this.subtitleTracks=n.subtitleTracks}onError(e,n){const{errorAction:r}=n;if((r==null?void 0:r.action)===ad.SendAlternateToPenaltyBox&&r.flags===Yh.MoveAllAlternatesMatchingHost){const s=this.levels;let i=this._pathwayPriority,o=this.pathwayId;if(n.context){const{groupId:l,pathwayId:c,type:d}=n.context;l&&s?o=this.getPathwayForGroupId(l,d,o):c&&(o=c)}o in this.penalizedPathways||(this.penalizedPathways[o]=performance.now()),!i&&s&&(i=this.pathways()),i&&i.length>1&&(this.updatePathwayPriority(i),r.resolved=this.pathwayId!==o),n.details===dt.BUFFER_APPEND_ERROR&&!n.fatal?r.resolved=!0:r.resolved||this.warn(`Could not resolve ${n.details} ("${n.error.message}") with content-steering for Pathway: ${o} levels: ${s&&s.length} priorities: ${va(i)} penalized: ${va(this.penalizedPathways)}`)}}filterParsedLevels(e){this.levels=e;let n=this.getLevelsForPathway(this.pathwayId);if(n.length===0){const r=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${r}"`),n=this.getLevelsForPathway(r),this.pathwayId=r}return n.length!==e.length&&this.log(`Found ${n.length}/${e.length} levels in Pathway "${this.pathwayId}"`),n}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(n=>e===n.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let n;const r=this.penalizedPathways,s=performance.now();Object.keys(r).forEach(i=>{s-r[i]>IWn&&delete r[i]});for(let i=0;i<e.length;i++){const o=e[i];if(o in r)continue;if(o===this.pathwayId)return;const l=this.hls.nextLoadLevel,c=this.hls.levels[l];if(n=this.getLevelsForPathway(o),n.length>0){this.log(`Setting Pathway to "${o}"`),this.pathwayId=o,I0t(n),this.hls.trigger(ue.LEVELS_UPDATED,{levels:n});const d=this.hls.levels[l];c&&d&&this.levels&&(d.attrs["STABLE-VARIANT-ID"]!==c.attrs["STABLE-VARIANT-ID"]&&d.bitrate!==c.bitrate&&this.log(`Unstable Pathways change from bitrate ${c.bitrate} to ${d.bitrate}`),this.hls.nextLoadLevel=l);break}}}getPathwayForGroupId(e,n,r){const s=this.getLevelsForPathway(r).concat(this.levels||[]);for(let i=0;i<s.length;i++)if(n===Us.AUDIO_TRACK&&s[i].hasAudioGroup(e)||n===Us.SUBTITLE_TRACK&&s[i].hasSubtitleGroup(e))return s[i].pathwayId;return r}clonePathways(e){const n=this.levels;if(!n)return;const r={},s={};e.forEach(i=>{const{ID:o,"BASE-ID":l,"URI-REPLACEMENT":c}=i;if(n.some(u=>u.pathwayId===o))return;const d=this.getLevelsForPathway(l).map(u=>{const h=new ml(u.attrs);h["PATHWAY-ID"]=o;const m=h.AUDIO&&`${h.AUDIO}_clone_${o}`,f=h.SUBTITLES&&`${h.SUBTITLES}_clone_${o}`;m&&(r[h.AUDIO]=m,h.AUDIO=m),f&&(s[h.SUBTITLES]=f,h.SUBTITLES=f);const p=pwt(u.uri,h["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",c),g=new T6({attrs:h,audioCodec:u.audioCodec,bitrate:u.bitrate,height:u.height,name:u.name,url:p,videoCodec:u.videoCodec,width:u.width});if(u.audioGroups)for(let v=1;v<u.audioGroups.length;v++)g.addGroupId("audio",`${u.audioGroups[v]}_clone_${o}`);if(u.subtitleGroups)for(let v=1;v<u.subtitleGroups.length;v++)g.addGroupId("text",`${u.subtitleGroups[v]}_clone_${o}`);return g});n.push(...d),k9e(this.audioTracks,r,c,o),k9e(this.subtitleTracks,s,c,o)})}loadSteeringManifest(e){const n=this.hls.config,r=n.loader;this.loader&&this.loader.destroy(),this.loader=new r(n);let s;try{s=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(s.protocol!=="data:"){const u=(this.hls.bandwidthEstimate||n.abrEwmaDefaultEstimate)|0;s.searchParams.set("_HLS_pathway",this.pathwayId),s.searchParams.set("_HLS_throughput",""+u)}const i={responseType:"json",url:s.href},o=n.steeringManifestLoadPolicy.default,l=o.errorRetry||o.timeoutRetry||{},c={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:l.maxNumRetry||0,retryDelay:l.retryDelayMs||0,maxRetryDelay:l.maxRetryDelayMs||0},d={onSuccess:(u,h,m,f)=>{this.log(`Loaded steering manifest: "${s}"`);const p=u.data;if((p==null?void 0:p.VERSION)!==1){this.log(`Steering VERSION ${p.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=p.TTL;const{"RELOAD-URI":g,"PATHWAY-CLONES":v,"PATHWAY-PRIORITY":b}=p;if(g)try{this.uri=new self.URL(g,s).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${g}`);return}this.scheduleRefresh(this.uri||m.url),v&&this.clonePathways(v);const x={steeringManifest:p,url:s.toString()};this.hls.trigger(ue.STEERING_MANIFEST_LOADED,x),b&&this.updatePathwayPriority(b)},onError:(u,h,m,f)=>{if(this.log(`Error loading steering manifest: ${u.code} ${u.text} (${h.url})`),this.stopLoad(),u.code===410){this.enabled=!1,this.log(`Steering manifest ${h.url} no longer available`);return}let p=this.timeToLoad*1e3;if(u.code===429){const g=this.loader;if(typeof(g==null?void 0:g.getResponseHeader)=="function"){const v=g.getResponseHeader("Retry-After");v&&(p=parseFloat(v)*1e3)}this.log(`Steering manifest ${h.url} rate limited`);return}this.scheduleRefresh(this.uri||h.url,p)},onTimeout:(u,h,m)=>{this.log(`Timeout loading steering manifest (${h.url})`),this.scheduleRefresh(this.uri||h.url)}};this.log(`Requesting steering manifest: ${s}`),this.loader.load(i,c,d)}scheduleRefresh(e,n=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var r;const s=(r=this.hls)==null?void 0:r.media;if(s&&!s.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},n)}};function k9e(t,e,n,r){t&&Object.keys(e).forEach(s=>{const i=t.filter(o=>o.groupId===s).map(o=>{const l=ra({},o);return l.details=void 0,l.attrs=new ml(l.attrs),l.url=l.attrs.URI=pwt(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",n),l.groupId=l.attrs["GROUP-ID"]=e[s],l.attrs["PATHWAY-ID"]=r,l});t.push(...i)})}function pwt(t,e,n,r){const{HOST:s,PARAMS:i,[n]:o}=r;let l;e&&(l=o==null?void 0:o[e],l&&(t=l));const c=new self.URL(t);return s&&!l&&(c.host=s),i&&Object.keys(i).sort().forEach(d=>{d&&c.searchParams.set(d,i[d])}),c.href}let gwt=class qW extends tp{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this._requestLicenseFailureCount=0,this.mediaKeySessions=[],this.keyIdToKeySessionPromise={},this.mediaKeys=null,this.setMediaKeysQueue=qW.CDMCleanupPromise?[qW.CDMCleanupPromise]:[],this.bannedKeyIds={},this.onMediaEncrypted=n=>{const{initDataType:r,initData:s}=n,i=`"${n.type}" event: init data type: "${r}"`;if(this.debug(i),s!==null){if(!this.keyFormatPromise){let o=Object.keys(this.keySystemAccessPromises);o.length||(o=q4(this.config));const l=o.map(Uce).filter(c=>!!c);this.keyFormatPromise=this.getKeyFormatPromise(l)}this.keyFormatPromise.then(o=>{const l=zW(o);if(r!=="sinf"||l!==Io.FAIRPLAY){this.log(`Ignoring "${n.type}" event with init data type: "${r}" for selected key-system ${l}`);return}let c;try{const f=cc(new Uint8Array(s)),p=fTe(JSON.parse(f).sinf),g=o0t(p);if(!g)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");c=new Uint8Array(g.subarray(8,24))}catch(f){this.warn(`${i} Failed to parse sinf: ${f}`);return}const d=cd(c),{keyIdToKeySessionPromise:u,mediaKeySessions:h}=this;let m=u[d];for(let f=0;f<h.length;f++){const p=h[f],g=p.decryptdata;if(!g.keyId)continue;const v=cd(g.keyId);if(HQ(c,g.keyId)||g.uri.replace(/-/g,"").indexOf(d)!==-1){if(m=u[v],!m)continue;if(g.pssh)break;delete u[v],g.pssh=new Uint8Array(s),g.keyId=c,m=u[d]=m.then(()=>this.generateRequestWithPreferredKeySession(p,r,s,"encrypted-event-key-match")),m.catch(b=>this.handleError(b));break}}m||this.handleError(new Error(`Key ID ${d} not encountered in playlist. Key-system sessions ${h.length}.`))}).catch(o=>this.handleError(o))}},this.onWaitingForKey=n=>{this.log(`"${n.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=this.keyIdToKeySessionPromise=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){this.hls.on(ue.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.on(ue.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.on(ue.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.on(ue.DESTROYING,this.onDestroying,this)}unregisterListeners(){this.hls.off(ue.MEDIA_ATTACHED,this.onMediaAttached,this),this.hls.off(ue.MEDIA_DETACHED,this.onMediaDetached,this),this.hls.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),this.hls.off(ue.MANIFEST_LOADED,this.onManifestLoaded,this),this.hls.off(ue.DESTROYING,this.onDestroying,this)}getLicenseServerUrl(e){const{drmSystems:n,widevineLicenseUrl:r}=this.config,s=n==null?void 0:n[e];if(s)return s.licenseUrl;if(e===Io.WIDEVINE&&r)return r}getLicenseServerUrlOrThrow(e){const n=this.getLicenseServerUrl(e);if(n===void 0)throw new Error(`no license server URL configured for key-system "${e}"`);return n}getServerCertificateUrl(e){const{drmSystems:n}=this.config,r=n==null?void 0:n[e];if(r)return r.serverCertificateUrl;this.log(`No Server Certificate in config.drmSystems["${e}"]`)}attemptKeySystemAccess(e){const n=this.hls.levels,r=(o,l,c)=>!!o&&c.indexOf(o)===l,s=n.map(o=>o.audioCodec).filter(r),i=n.map(o=>o.videoCodec).filter(r);return s.length+i.length===0&&i.push("avc1.42e01e"),new Promise((o,l)=>{const c=d=>{const u=d.shift();this.getMediaKeysPromise(u,s,i).then(h=>o({keySystem:u,mediaKeys:h})).catch(h=>{d.length?c(d):h instanceof Hh?l(h):l(new Hh({type:ur.KEY_SYSTEM_ERROR,details:dt.KEY_SYSTEM_NO_ACCESS,error:h,fatal:!0},h.message))})};c(e)})}requestMediaKeySystemAccess(e,n){const{requestMediaKeySystemAccessFunc:r}=this.config;if(typeof r!="function"){let s=`Configured requestMediaKeySystemAccess is not a function ${r}`;return j0t===null&&self.location.protocol==="http:"&&(s=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(s))}return r(e,n)}getMediaKeysPromise(e,n,r){var s;const i=hHn(e,n,r,this.config.drmSystemOptions||{});let o=this.keySystemAccessPromises[e],l=(s=o)==null?void 0:s.keySystemAccess;if(!l){this.log(`Requesting encrypted media "${e}" key-system access with config: ${va(i)}`),l=this.requestMediaKeySystemAccess(e,i);const c=o=this.keySystemAccessPromises[e]={keySystemAccess:l};return l.catch(d=>{this.log(`Failed to obtain access to key-system "${e}": ${d}`)}),l.then(d=>{this.log(`Access for key-system "${d.keySystem}" obtained`);const u=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const h=c.mediaKeys=d.createMediaKeys().then(m=>(this.log(`Media-keys created for "${e}"`),c.hasMediaKeys=!0,u.then(f=>f?this.setMediaKeysServerCertificate(m,e,f):m)));return h.catch(m=>{this.error(`Failed to create media-keys for "${e}"}: ${m}`)}),h})}return l.then(()=>o.mediaKeys)}createMediaKeySessionContext({decryptdata:e,keySystem:n,mediaKeys:r}){this.log(`Creating key-system session "${n}" keyId: ${cd(e.keyId||[])} keyUri: ${e.uri}`);const s=r.createSession(),i={decryptdata:e,keySystem:n,mediaKeys:r,mediaKeysSession:s,keyStatus:"status-pending"};return this.mediaKeySessions.push(i),i}renewKeySession(e){const n=e.decryptdata;if(n.pssh){const r=this.createMediaKeySessionContext(e),s=tV(n),i="cenc";this.keyIdToKeySessionPromise[s]=this.generateRequestWithPreferredKeySession(r,i,n.pssh.buffer,"expired")}else this.warn("Could not renew expired session. Missing pssh initData.");this.removeSession(e)}updateKeySession(e,n){const r=e.mediaKeysSession;return this.log(`Updating key-session "${r.sessionId}" for keyId ${cd(e.decryptdata.keyId||[])}
      } (data length: ${n.byteLength})`),r.update(n)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>Uce(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:n,mediaKeys:r})=>this.attemptSetMediaKeys(n,r))}selectKeySystem(e){return new Promise((n,r)=>{this.getKeySystemSelectionPromise(e).then(({keySystem:s})=>{const i=Uce(s);i?n(i):r(new Error(`Unable to find format for key-system "${s}"`))}).catch(r)})}selectKeySystemFormat(e){const n=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${n.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(n)),this.keyFormatPromise}getKeyFormatPromise(e){const n=q4(this.config),r=e.map(zW).filter(s=>!!s&&n.indexOf(s)!==-1);return this.selectKeySystem(r)}getKeyStatus(e){const{mediaKeySessions:n}=this;for(let r=0;r<n.length;r++){const s=LWn(e,n[r]);if(s)return s}}loadKey(e){const n=e.keyInfo.decryptdata,r=tV(n),s=this.bannedKeyIds[r];if(s||this.getKeyStatus(n)==="internal-error"){const l=S9e(s||"internal-error",n);return this.handleError(l,e.frag),Promise.reject(l)}const i=`(keyId: ${r} format: "${n.keyFormat}" method: ${n.method} uri: ${n.uri})`;this.log(`Starting session for key ${i}`);const o=this.keyIdToKeySessionPromise[r];if(!o){const l=this.getKeySystemForKeyPromise(n).then(({keySystem:c,mediaKeys:d})=>(this.throwIfDestroyed(),this.log(`Handle encrypted media sn: ${e.frag.sn} ${e.frag.type}: ${e.frag.level} using key ${i}`),this.attemptSetMediaKeys(c,d).then(()=>(this.throwIfDestroyed(),this.createMediaKeySessionContext({keySystem:c,mediaKeys:d,decryptdata:n}))))).then(c=>{const d="cenc",u=n.pssh?n.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(c,d,u,"playlist-key")});return l.catch(c=>this.handleError(c,e.frag)),this.keyIdToKeySessionPromise[r]=l,l}return o.catch(l=>{if(l instanceof Hh){const c=Bi({},l.data);this.getKeyStatus(n)==="internal-error"&&(c.decryptdata=n);const d=new Hh(c,l.message);this.handleError(d,e.frag)}}),o}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,n){if(this.hls)if(e instanceof Hh){n&&(e.data.frag=n);const r=e.data.decryptdata;this.error(`${e.message}${r?` (${cd(r.keyId||[])})`:""}`),this.hls.trigger(ue.ERROR,e.data)}else this.error(e.message),this.hls.trigger(ue.ERROR,{type:ur.KEY_SYSTEM_ERROR,details:dt.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}getKeySystemForKeyPromise(e){const n=tV(e),r=this.keyIdToKeySessionPromise[n];if(!r){const s=zW(e.keyFormat),i=s?[s]:q4(this.config);return this.attemptKeySystemAccess(i)}return r}getKeySystemSelectionPromise(e){if(e.length||(e=q4(this.config)),e.length===0)throw new Hh({type:ur.KEY_SYSTEM_ERROR,details:dt.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${va({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}attemptSetMediaKeys(e,n){if(this.mediaResolved=void 0,this.mediaKeys===n)return Promise.resolve();const r=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const s=Promise.all(r).then(()=>this.media?this.media.setMediaKeys(n):new Promise((i,o)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return o(new Error("Attempted to set mediaKeys without media element attached"));this.mediaKeys=n,this.media.setMediaKeys(n).then(i).catch(o)}}));return this.mediaKeys=n,this.setMediaKeysQueue.push(s),s.then(()=>{this.log(`Media-keys set for "${e}"`),r.push(s),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(i=>r.indexOf(i)===-1)})}generateRequestWithPreferredKeySession(e,n,r,s){var i;const o=(i=this.config.drmSystems)==null||(i=i[e.keySystem])==null?void 0:i.generateRequest;if(o)try{const p=o.call(this.hls,n,r,e);if(!p)throw new Error("Invalid response from configured generateRequest filter");n=p.initDataType,r=p.initData?p.initData:null,e.decryptdata.pssh=r?new Uint8Array(r):null}catch(p){if(this.warn(p.message),this.hls&&this.hls.config.debug)throw p}if(r===null)return this.log(`Skipping key-session request for "${s}" (no initData)`),Promise.resolve(e);const l=tV(e.decryptdata),c=e.decryptdata.uri;this.log(`Generating key-session request for "${s}" keyId: ${l} URI: ${c} (init data type: ${n} length: ${r.byteLength})`);const d=new gTe,u=e._onmessage=p=>{const g=e.mediaKeysSession;if(!g){d.emit("error",new Error("invalid state"));return}const{messageType:v,message:b}=p;this.log(`"${v}" message event for session "${g.sessionId}" message size: ${b.byteLength}`),v==="license-request"||v==="license-renewal"?this.renewLicense(e,b).catch(x=>{d.eventNames().length?d.emit("error",x):this.handleError(x)}):v==="license-release"?e.keySystem===Io.FAIRPLAY&&this.updateKeySession(e,Mbe("acknowledged")).then(()=>this.removeSession(e)).catch(x=>this.handleError(x)):this.warn(`unhandled media key message type "${v}"`)},h=(p,g)=>{g.keyStatus=p;let v;p.startsWith("usable")?d.emit("resolved"):p==="internal-error"||p==="output-restricted"||p==="output-downscaled"?v=S9e(p,g.decryptdata):p==="expired"?v=new Error(`key expired (keyId: ${l})`):p==="released"?v=new Error("key released"):p==="status-pending"||this.warn(`unhandled key status change "${p}" (keyId: ${l})`),v&&(d.eventNames().length?d.emit("error",v):this.handleError(v))},m=e._onkeystatuseschange=p=>{if(!e.mediaKeysSession){d.emit("error",new Error("invalid state"));return}const v=this.getKeyStatuses(e);if(!Object.keys(v).some(k=>v[k]!=="status-pending"))return;if(v[l]==="expired"){this.log(`Expired key ${va(v)} in key-session "${e.mediaKeysSession.sessionId}"`),this.renewKeySession(e);return}let x=v[l];if(x)h(x,e);else{var w;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(w=e.keyStatusTimeouts)[l]||(w[l]=self.setTimeout(()=>{if(!e.mediaKeysSession||!this.mediaKeys)return;const S=this.getKeyStatus(e.decryptdata);if(S&&S!=="status-pending")return this.log(`No status for keyId ${l} in key-session "${e.mediaKeysSession.sessionId}". Using session key-status ${S} from other session.`),h(S,e);this.log(`key status for ${l} in key-session "${e.mediaKeysSession.sessionId}" timed out after 1000ms`),x="internal-error",h(x,e)},1e3)),this.log(`No status for keyId ${l} (${va(v)}).`)}};Tu(e.mediaKeysSession,"message",u),Tu(e.mediaKeysSession,"keystatuseschange",m);const f=new Promise((p,g)=>{d.on("error",g),d.on("resolved",p)});return e.mediaKeysSession.generateRequest(n,r).then(()=>{this.log(`Request generated for key-session "${e.mediaKeysSession.sessionId}" keyId: ${l} URI: ${c}`)}).catch(p=>{throw new Hh({type:ur.KEY_SYSTEM_ERROR,details:dt.KEY_SYSTEM_NO_SESSION,error:p,decryptdata:e.decryptdata,fatal:!1},`Error generating key-session request: ${p}`)}).then(()=>f).catch(p=>(d.removeAllListeners(),this.removeSession(e).then(()=>{throw p}))).then(()=>(d.removeAllListeners(),e))}getKeyStatuses(e){const n={};return e.mediaKeysSession.keyStatuses.forEach((r,s)=>{if(typeof s=="string"&&typeof r=="object"){const l=s;s=r,r=l}const i="buffer"in s?new Uint8Array(s.buffer,s.byteOffset,s.byteLength):new Uint8Array(s);if(e.keySystem===Io.PLAYREADY&&i.length===16){const l=cd(i);n[l]=r,S0t(i)}const o=cd(i);r==="internal-error"&&(this.bannedKeyIds[o]=r),this.log(`key status change "${r}" for keyStatuses keyId: ${o} key-session "${e.mediaKeysSession.sessionId}"`),n[o]=r}),n}fetchServerCertificate(e){const n=this.config,r=n.loader,s=new r(n),i=this.getServerCertificateUrl(e);return i?(this.log(`Fetching server certificate for "${e}"`),new Promise((o,l)=>{const c={responseType:"arraybuffer",url:i},d=n.certLoadPolicy.default,u={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(m,f,p,g)=>{o(m.data)},onError:(m,f,p,g)=>{l(new Hh({type:ur.KEY_SYSTEM_ERROR,details:dt.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:p,response:Bi({url:c.url,data:void 0},m)},`"${e}" certificate request failed (${i}). Status: ${m.code} (${m.text})`))},onTimeout:(m,f,p)=>{l(new Hh({type:ur.KEY_SYSTEM_ERROR,details:dt.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:p,response:{url:c.url,data:void 0}},`"${e}" certificate request timed out (${i})`))},onAbort:(m,f,p)=>{l(new Error("aborted"))}};s.load(c,u,h)})):Promise.resolve()}setMediaKeysServerCertificate(e,n,r){return new Promise((s,i)=>{e.setServerCertificate(r).then(o=>{this.log(`setServerCertificate ${o?"success":"not supported by CDM"} (${r.byteLength}) on "${n}"`),s(e)}).catch(o=>{i(new Hh({type:ur.KEY_SYSTEM_ERROR,details:dt.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:o,fatal:!0},o.message))})})}renewLicense(e,n){return this.requestLicense(e,new Uint8Array(n)).then(r=>this.updateKeySession(e,new Uint8Array(r)).catch(s=>{throw new Hh({type:ur.KEY_SYSTEM_ERROR,details:dt.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:e.decryptdata,error:s,fatal:!1},s.message)}))}unpackPlayReadyKeyMessage(e,n){const r=String.fromCharCode.apply(null,new Uint16Array(n.buffer));if(!r.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),n;const s=new DOMParser().parseFromString(r,"application/xml"),i=s.querySelectorAll("HttpHeader");if(i.length>0){let u;for(let h=0,m=i.length;h<m;h++){var o,l;u=i[h];const f=(o=u.querySelector("name"))==null?void 0:o.textContent,p=(l=u.querySelector("value"))==null?void 0:l.textContent;f&&p&&e.setRequestHeader(f,p)}}const c=s.querySelector("Challenge"),d=c==null?void 0:c.textContent;if(!d)throw new Error("Cannot find <Challenge> in key message");return Mbe(atob(d))}setupLicenseXHR(e,n,r,s){const i=this.config.licenseXhrSetup;return i?Promise.resolve().then(()=>{if(!r.decryptdata)throw new Error("Key removed");return i.call(this.hls,e,n,r,s)}).catch(o=>{if(!r.decryptdata)throw o;return e.open("POST",n,!0),i.call(this.hls,e,n,r,s)}).then(o=>(e.readyState||e.open("POST",n,!0),{xhr:e,licenseChallenge:o||s})):(e.open("POST",n,!0),Promise.resolve({xhr:e,licenseChallenge:s}))}requestLicense(e,n){const r=this.config.keyLoadPolicy.default;return new Promise((s,i)=>{const o=this.getLicenseServerUrlOrThrow(e.keySystem);this.log(`Sending license request to URL: ${o}`);const l=new XMLHttpRequest;l.responseType="arraybuffer",l.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return i(new Error("invalid state"));if(l.readyState===4)if(l.status===200){this._requestLicenseFailureCount=0;let c=l.response;this.log(`License received ${c instanceof ArrayBuffer?c.byteLength:c}`);const d=this.config.licenseResponseCallback;if(d)try{c=d.call(this.hls,l,o,e)}catch(u){this.error(u)}s(c)}else{const c=r.errorRetry,d=c?c.maxNumRetry:0;if(this._requestLicenseFailureCount++,this._requestLicenseFailureCount>d||l.status>=400&&l.status<500)i(new Hh({type:ur.KEY_SYSTEM_ERROR,details:dt.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:e.decryptdata,fatal:!0,networkDetails:l,response:{url:o,data:void 0,code:l.status,text:l.statusText}},`License Request XHR failed (${o}). Status: ${l.status} (${l.statusText})`));else{const u=d-this._requestLicenseFailureCount+1;this.warn(`Retrying license request, ${u} attempts left`),this.requestLicense(e,n).then(s,i)}}},e.licenseXhr&&e.licenseXhr.readyState!==XMLHttpRequest.DONE&&e.licenseXhr.abort(),e.licenseXhr=l,this.setupLicenseXHR(l,o,e,n).then(({xhr:c,licenseChallenge:d})=>{e.keySystem==Io.PLAYREADY&&(d=this.unpackPlayReadyKeyMessage(c,d)),c.send(d)}).catch(i)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,n){if(!this.config.emeEnabled)return;const r=n.media;this.media=r,Tu(r,"encrypted",this.onMediaEncrypted),Tu(r,"waitingforkey",this.onWaitingForKey);const s=this.mediaResolved;s?s():this.mediaKeys=r.mediaKeys}onMediaDetached(){const e=this.media;e&&(fh(e,"encrypted",this.onMediaEncrypted),fh(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;this._requestLicenseFailureCount=0,this.keyIdToKeySessionPromise={},this.bannedKeyIds={};const n=this.mediaResolved;if(n&&n(),!this.mediaKeys&&!this.mediaKeySessions.length)return;const r=this.media,s=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,WQ.clearKeyUriToKeyIdMap();const i=s.length;qW.CDMCleanupPromise=Promise.all(s.map(o=>this.removeSession(o)).concat((r==null||(e=r.setMediaKeys(null))==null?void 0:e.catch(o=>{this.log(`Could not clear media keys: ${o}`),this.hls&&this.hls.trigger(ue.ERROR,{type:ur.OTHER_ERROR,details:dt.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${o}`)})}))||Promise.resolve())).catch(o=>{this.log(`Could not close sessions and clear media keys: ${o}`),this.hls&&this.hls.trigger(ue.ERROR,{type:ur.OTHER_ERROR,details:dt.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${o}`)})}).then(()=>{i&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this._clear()}onManifestLoaded(e,{sessionKeys:n}){if(!(!n||!this.config.emeEnabled)&&!this.keyFormatPromise){const r=n.reduce((s,i)=>(s.indexOf(i.keyFormat)===-1&&s.push(i.keyFormat),s),[]);this.log(`Selecting key-system from session-keys ${r.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(r)}}removeSession(e){const{mediaKeysSession:n,licenseXhr:r,decryptdata:s}=e;if(n){this.log(`Remove licenses and keys and close session "${n.sessionId}" keyId: ${cd((s==null?void 0:s.keyId)||[])}`),e._onmessage&&(n.removeEventListener("message",e._onmessage),e._onmessage=void 0),e._onkeystatuseschange&&(n.removeEventListener("keystatuseschange",e._onkeystatuseschange),e._onkeystatuseschange=void 0),r&&r.readyState!==XMLHttpRequest.DONE&&r.abort(),e.mediaKeysSession=e.decryptdata=e.licenseXhr=void 0;const i=this.mediaKeySessions.indexOf(e);i>-1&&this.mediaKeySessions.splice(i,1);const{keyStatusTimeouts:o}=e;o&&Object.keys(o).forEach(d=>self.clearTimeout(o[d]));const{drmSystemOptions:l}=this.config;return(fHn(l)?new Promise((d,u)=>{self.setTimeout(()=>u(new Error("MediaKeySession.remove() timeout")),8e3),n.remove().then(d).catch(u)}):Promise.resolve()).catch(d=>{this.log(`Could not remove session: ${d}`),this.hls&&this.hls.trigger(ue.ERROR,{type:ur.OTHER_ERROR,details:dt.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${d}`)})}).then(()=>n.close()).catch(d=>{this.log(`Could not close session: ${d}`),this.hls&&this.hls.trigger(ue.ERROR,{type:ur.OTHER_ERROR,details:dt.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${d}`)})})}return Promise.resolve()}};gwt.CDMCleanupPromise=void 0;function tV(t){if(!t)throw new Error("Could not read keyId of undefined decryptdata");if(t.keyId===null)throw new Error("keyId is null");return cd(t.keyId)}function LWn(t,e){if(t.keyId&&e.mediaKeysSession.keyStatuses.has(t.keyId))return e.mediaKeysSession.keyStatuses.get(t.keyId);if(t.matches(e.decryptdata))return e.keyStatus}let Hh=class extends Error{constructor(e,n){super(n),this.data=void 0,e.error||(e.error=new Error(n)),this.data=e,e.err=e.error}};function S9e(t,e){const n=t==="output-restricted",r=n?dt.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:dt.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new Hh({type:ur.KEY_SYSTEM_ERROR,details:r,fatal:!1,decryptdata:e},n?"HDCP level output restricted":`key status changed to "${t}"`)}let DWn=class{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(ue.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(ue.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,n){const r=this.hls.config;if(r.capLevelOnFPSDrop){const s=n.media instanceof self.HTMLVideoElement?n.media:null;this.media=s,s&&typeof s.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),r.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,n,r){const s=performance.now();if(n){if(this.lastTime){const i=s-this.lastTime,o=r-this.lastDroppedFrames,l=n-this.lastDecodedFrames,c=1e3*o/i,d=this.hls;if(d.trigger(ue.FPS_DROP,{currentDropped:o,currentDecoded:l,totalDroppedFrames:r}),c>0&&o>d.config.fpsDroppedMonitoringThreshold*l){let u=d.currentLevel;d.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(d.autoLevelCapping===-1||d.autoLevelCapping>=u)&&(u=u-1,d.trigger(ue.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:d.currentLevel}),d.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=r,this.lastDecodedFrames=n}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const n=e.getVideoPlaybackQuality();this.checkFPS(e,n.totalVideoFrames,n.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}};function vwt(t,e){let n;try{n=new Event("addtrack")}catch{n=document.createEvent("Event"),n.initEvent("addtrack",!1,!1)}n.track=t,e.dispatchEvent(n)}function ywt(t,e){const n=t.mode;if(n==="disabled"&&(t.mode="hidden"),t.cues&&!t.cues.getCueById(e.id))try{if(t.addCue(e),!t.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(r){Ui.debug(`[texttrack-utils]: ${r}`);try{const s=new self.TextTrackCue(e.startTime,e.endTime,e.text);s.id=e.id,t.addCue(s)}catch(s){Ui.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${s}`)}}n==="disabled"&&(t.mode=n)}function pA(t,e){const n=t.mode;if(n==="disabled"&&(t.mode="hidden"),t.cues)for(let r=t.cues.length;r--;)e&&t.cues[r].removeEventListener("enter",e),t.removeCue(t.cues[r]);n==="disabled"&&(t.mode=n)}function Hbe(t,e,n,r){const s=t.mode;if(s==="disabled"&&(t.mode="hidden"),t.cues&&t.cues.length>0){const i=OWn(t.cues,e,n);for(let o=0;o<i.length;o++)(!r||r(i[o]))&&t.removeCue(i[o])}s==="disabled"&&(t.mode=s)}function $Wn(t,e){if(e<=t[0].startTime)return 0;const n=t.length-1;if(e>t[n].endTime)return-1;let r=0,s=n,i;for(;r<=s;)if(i=Math.floor((s+r)/2),e<t[i].startTime)s=i-1;else if(e>t[i].startTime&&r<n)r=i+1;else return i;return t[r].startTime-e<e-t[s].startTime?r:s}function OWn(t,e,n){const r=[],s=$Wn(t,e);if(s>-1)for(let i=s,o=t.length;i<o;i++){const l=t[i];if(l.startTime>=e&&l.endTime<=n)r.push(l);else if(l.startTime>n)return r}return r}function KW(t){const e=[];for(let n=0;n<t.length;n++){const r=t[n];(r.kind==="subtitles"||r.kind==="captions")&&r.label&&e.push(t[n])}return e}let FWn=class extends STe{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let n=null;const r=KW(this.media.textTracks);for(let i=0;i<r.length;i++)if(r[i].mode==="hidden")n=r[i];else if(r[i].mode==="showing"){n=r[i];break}const s=this.findTrackForTextTrack(n);this.subtitleTrack!==s&&this.setSubtitleTrack(s)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.on(ue.LEVEL_LOADING,this.onLevelLoading,this),e.on(ue.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(ue.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(ue.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.off(ue.LEVEL_LOADING,this.onLevelLoading,this),e.off(ue.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(ue.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(ue.ERROR,this.onError,this)}onMediaAttached(e,n){this.media=n.media,this.media&&(this.queuedDefaultTrack>-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,n){const r=this.media;if(!r)return;const s=!!n.transferMedia;if(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||r.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),this.subtitleTrack=-1,this.media=null,s)return;KW(r.textTracks).forEach(o=>{pA(o)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,n){this.tracks=n.subtitleTracks}onSubtitleTrackLoaded(e,n){const{id:r,groupId:s,details:i}=n,o=this.tracksInGroup[r];if(!o||o.groupId!==s){this.warn(`Subtitle track with id:${r} and group:${s} not found in active group ${o==null?void 0:o.groupId}`);return}const l=o.details;o.details=n.details,this.log(`Subtitle track ${r} "${o.name}" lang:${o.lang} group:${s} loaded [${i.startSN}-${i.endSN}]`),r===this.trackId&&this.playlistLoaded(r,n,l)}onLevelLoading(e,n){this.switchLevel(n.level)}onLevelSwitching(e,n){this.switchLevel(n.level)}switchLevel(e){const n=this.hls.levels[e];if(!n)return;const r=n.subtitleGroups||null,s=this.groupIds;let i=this.currentTrack;if(!r||(s==null?void 0:s.length)!==(r==null?void 0:r.length)||r!=null&&r.some(o=>(s==null?void 0:s.indexOf(o))===-1)){this.groupIds=r,this.trackId=-1,this.currentTrack=null;const o=this.tracks.filter(u=>!r||r.indexOf(u.groupId)!==-1);if(o.length)this.selectDefaultTrack&&!o.some(u=>u.default)&&(this.selectDefaultTrack=!1),o.forEach((u,h)=>{u.id=h});else if(!i&&!this.tracksInGroup.length)return;this.tracksInGroup=o;const l=this.hls.config.subtitlePreference;if(!i&&l){this.selectDefaultTrack=!1;const u=ny(l,o);if(u>-1)i=o[u];else{const h=ny(l,this.tracks);i=this.tracks[h]}}let c=this.findTrackId(i);c===-1&&i&&(c=this.findTrackId(null));const d={subtitleTracks:o};this.log(`Updating subtitle tracks, ${o.length} track(s) found in "${r==null?void 0:r.join(",")}" group-id`),this.hls.trigger(ue.SUBTITLE_TRACKS_UPDATED,d),c!==-1&&this.trackId===-1&&this.setSubtitleTrack(c)}}findTrackId(e){const n=this.tracksInGroup,r=this.selectDefaultTrack;for(let s=0;s<n.length;s++){const i=n[s];if(!(r&&!i.default||!r&&!e)&&(!e||Jj(i,e)))return s}if(e){for(let s=0;s<n.length;s++){const i=n[s];if(R6(e.attrs,i.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return s}for(let s=0;s<n.length;s++){const i=n[s];if(R6(e.attrs,i.attrs,["LANGUAGE"]))return s}}return-1}findTrackForTextTrack(e){if(e){const n=this.tracksInGroup;for(let r=0;r<n.length;r++){const s=n[r];if(Fbe(s,e))return r}}return-1}onError(e,n){n.fatal||!n.context||n.context.type===Us.SUBTITLE_TRACK&&n.context.id===this.trackId&&(!this.groupIds||this.groupIds.indexOf(n.context.groupId)!==-1)&&this.checkRetry(n)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1),null;const n=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,n.length){const r=this.currentTrack;if(r&&Jj(e,r))return r;const s=ny(e,this.tracksInGroup);if(s>-1){const i=this.tracksInGroup[s];return this.setSubtitleTrack(s),i}else{if(r)return null;{const i=ny(e,n);if(i>-1)return n[i]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,n){super.loadingPlaylist(e,n);const r=e.id,s=e.groupId,i=this.getUrlWithDirectives(e.url,n),o=e.details,l=o==null?void 0:o.age;this.log(`Loading subtitle ${r} "${e.name}" lang:${e.lang} group:${s}${(n==null?void 0:n.msn)!==void 0?" at sn "+n.msn+" part "+n.part:""}${l&&o.live?" age "+l.toFixed(1)+(o.type&&" "+o.type||""):""} ${i}`),this.hls.trigger(ue.SUBTITLE_TRACK_LOADING,{url:i,id:r,groupId:s,deliveryDirectives:n||null,track:e})}toggleTrackModes(){const{media:e}=this;if(!e)return;const n=KW(e.textTracks),r=this.currentTrack;let s;if(r&&(s=n.filter(i=>Fbe(r,i))[0],s||this.warn(`Unable to find subtitle TextTrack with name "${r.name}" and language "${r.lang}"`)),[].slice.call(n).forEach(i=>{i.mode!=="disabled"&&i!==s&&(i.mode="disabled")}),s){const i=this.subtitleDisplay?"showing":"hidden";s.mode!==i&&(s.mode=i)}}setSubtitleTrack(e){const n=this.tracksInGroup;if(!this.media){this.queuedDefaultTrack=e;return}if(e<-1||e>=n.length||!$n(e)){this.warn(`Invalid subtitle track id: ${e}`);return}this.selectDefaultTrack=!1;const r=this.currentTrack,s=n[e]||null;if(this.trackId=e,this.currentTrack=s,this.toggleTrackModes(),!s){this.hls.trigger(ue.SUBTITLE_TRACK_SWITCH,{id:e});return}const i=!!s.details&&!s.details.live;if(e===this.trackId&&s===r&&i)return;this.log(`Switching to subtitle-track ${e}`+(s?` "${s.name}" lang:${s.lang} group:${s.groupId}`:""));const{id:o,groupId:l="",name:c,type:d,url:u}=s;this.hls.trigger(ue.SUBTITLE_TRACK_SWITCH,{id:o,groupId:l,name:c,type:d,url:u});const h=this.switchParams(s.url,r==null?void 0:r.details,s.details);this.loadPlaylist(h)}};function BWn(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),n=e.toString();return URL.revokeObjectURL(e),n.slice(n.lastIndexOf("/")+1)}catch{let n=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,s=>{const i=(n+Math.random()*16)%16|0;return n=Math.floor(n/16),(s=="x"?i:i&3|8).toString(16)})}}}function g$(t){let e=5381,n=t.length;for(;n;)e=e*33^t.charCodeAt(--n);return(e>>>0).toString()}const nP=.025;let YQ=function(t){return t[t.Point=0]="Point",t[t.Range=1]="Range",t}({});function UWn(t,e,n){return`${t.identifier}-${n+1}-${g$(e)}`}let zWn=class{constructor(e,n){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=n,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var n;if(e>0&&e>=this.assetList.length)return!0;const r=this.playoutLimit;return e<=0||isNaN(r)?!1:r===0?!0:(((n=this.assetList[e])==null?void 0:n.startOffset)||0)>r}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const n=this.dateRange.tagAnchor;if(n)return Qce(e,n)}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const n=this.dateRange.startTime,r=Qce(n,e);return n-r<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,n=$n(e)?e:this.duration;return this.cumulativeDuration+n}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const n=this.resumeAnchor;if(n)return Qce(e,n)}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<nP))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return this._timelineStart!==null?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let n;return this._duration!==null?n=this._duration:this.dateRange.duration?n=this.dateRange.duration:n=this.dateRange.plannedDuration||0,!isNaN(e)&&e<n&&(n=e),n}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?YQ.Range:YQ.Point}get supplementsPrimary(){return this.dateRange.attr["X-TIMELINE-STYLE"]==="PRIMARY"}get contentMayVary(){return this.dateRange.attr["X-CONTENT-MAY-VARY"]!=="NO"}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||this.assetListResponse!==null}toString(){return VWn(this)}};function Qce(t,e){return t-e.start<e.duration/2&&!(Math.abs(t-(e.start+e.duration))<nP)?e.start:e.start+e.duration}function bwt(t,e,n){const r=new self.URL(t,n);return r.protocol!=="data:"&&r.searchParams.set("_HLS_primary_id",e),r}function Zce(t,e){for(;(n=t.assetList[++e])!=null&&n.error;)var n;return e}function VWn(t){return`["${t.identifier}" ${t.cue.pre?"<pre>":t.cue.post?"<post>":""}${t.timelineStart.toFixed(2)}-${t.resumeTime.toFixed(2)}]`}function R_(t){const e=t.timelineStart,n=t.duration||0;return`["${t.identifier}" ${e.toFixed(2)}-${(e+n).toFixed(2)}]`}let HWn=class{constructor(e,n,r,s){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(ue.PLAYOUT_LIMIT_REACHED,{})};const i=this.hls=new e(n);this.interstitial=r,this.assetItem=s;const o=()=>{this.hasDetails=!0};i.once(ue.LEVEL_LOADED,o),i.once(ue.AUDIO_TRACK_LOADED,o),i.once(ue.SUBTITLE_TRACK_LOADED,o),i.on(ue.MEDIA_ATTACHING,(l,{media:c})=>{this.removeMediaListeners(),this.mediaAttached=c,this.interstitial.playoutLimit&&(c.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&i.on(ue.BUFFER_APPENDED,()=>{const u=this.bufferedEnd;this.reachedPlayout(u)&&(this._bufferedEosTime=u,i.trigger(ue.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let n=this.assetItem.uri;try{n=bwt(n,e.config.primarySessionId||"").href}catch{}e.loadSource(n)}}bufferedInPlaceToEnd(e){var n;if(!this.appendInPlace)return!1;if((n=this.hls)!=null&&n.bufferedToEnd)return!0;if(!e)return!1;const r=Math.min(this._bufferedEosTime||1/0,this.duration),s=this.timelineOffset,i=$s.bufferInfo(e,s,0);return this.getAssetTime(i.end)>=r-.02}reachedPlayout(e){const r=this.interstitial.playoutLimit;return this.startOffset+e>=r}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const n=$s.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(n.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const n=this.interstitial.playoutLimit;if(n){const r=n-this.startOffset;if(r>0&&r<e)return r}return e}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const n=this.timelineOffset;if(e!==n){const r=e-n;if(Math.abs(r)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const n=this.timelineOffset,r=this.duration;return Math.min(Math.max(0,e-n),r)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var n;this.loadSource(),(n=this.hls)==null||n.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const n=r=>delete r.details;e.levels.forEach(n),e.allAudioTracks.forEach(n),e.allSubtitleTracks.forEach(n),this.hasDetails=!1}}on(e,n,r){var s;(s=this.hls)==null||s.on(e,n)}once(e,n,r){var s;(s=this.hls)==null||s.once(e,n)}off(e,n,r){var s;(s=this.hls)==null||s.off(e,n)}toString(){var e;return`HlsAssetPlayer: ${R_(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}};const C9e=.033;let GWn=class extends tp{constructor(e,n){super("interstitials-sched",n),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,n){return this.events?this.events.reduce((r,s)=>e<=s.startOffset&&n>s.startOffset?(delete s.error,r+1):r,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,n){if(e.event)return this.findEventIndex(e.event.identifier);let r=-1;e.nextEvent?r=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(r=this.findEventIndex(e.previousEvent.identifier)+1);const s=this.items;if(s)for(s[r]||(n===void 0&&(n=e.start),r=this.findItemIndexAtTime(n));r>=0&&(i=s[r])!=null&&i.event;){var i;r--}return r}findItemIndexAtTime(e,n){const r=this.items;if(r)for(let s=0;s<r.length;s++){let i=r[s];if(n&&n!=="primary"&&(i=i[n]),e===i.start||e>i.start&&e<i.end)return s}return-1}findJumpRestrictedIndex(e,n){const r=this.items;if(r)for(let s=e;s<=n&&r[s];s++){const i=r[s].event;if(i!=null&&i.restrictions.jump&&!i.appendInPlace)return s}return-1}findEventIndex(e){const n=this.items;if(n)for(let s=n.length;s--;){var r;if(((r=n[s].event)==null?void 0:r.identifier)===e)return s}return-1}findAssetIndex(e,n){const r=e.assetList,s=r.length;if(s>1)for(let i=0;i<s;i++){const o=r[i];if(!o.error){const l=o.timelineStart;if(n===l||n>l&&(n<l+(o.duration||0)||i===s-1))return i}}return 0}get assetIdAtEnd(){var e;const n=(e=this.items)==null||(e=e[this.length-1])==null?void 0:e.event;if(n){const r=n.assetList,s=r[r.length-1];if(s)return s.identifier}return null}parseInterstitialDateRanges(e,n){const r=e.main.details,{dateRanges:s}=r,i=this.events,o=this.parseDateRanges(s,{url:r.url},n),l=Object.keys(s),c=i?i.filter(d=>!l.includes(d.identifier)):[];o.length&&o.sort((d,u)=>{const h=d.cue.pre,m=d.cue.post,f=u.cue.pre,p=u.cue.post;if(h&&!f)return-1;if(f&&!h||m&&!p)return 1;if(p&&!m)return-1;if(!h&&!f&&!m&&!p){const g=d.startTime,v=u.startTime;if(g!==v)return g-v}return d.dateRange.tagOrder-u.dateRange.tagOrder}),this.events=o,c.forEach(d=>{this.removeEvent(d)}),this.updateSchedule(e,c)}updateSchedule(e,n=[],r=!1){const s=this.events||[];if(s.length||n.length||this.length<2){const i=this.items,o=this.parseSchedule(s,e);(r||n.length||(i==null?void 0:i.length)!==o.length||o.some((c,d)=>Math.abs(c.playout.start-i[d].playout.start)>.005||Math.abs(c.playout.end-i[d].playout.end)>.005))&&(this.items=o,this.onScheduleUpdate(n,i))}}parseDateRanges(e,n,r){const s=[],i=Object.keys(e);for(let o=0;o<i.length;o++){const l=i[o],c=e[l];if(c.isInterstitial){let d=this.eventMap[l];d?d.setDateRange(c):(d=new zWn(c,n),this.eventMap[l]=d,r===!1&&(d.appendInPlace=r)),s.push(d)}}return s}parseSchedule(e,n){const r=[],s=n.main.details,i=s.live?1/0:s.edge;let o=0;if(e=e.filter(c=>!c.error&&!(c.cue.once&&c.hasPlayed)),e.length){this.resolveOffsets(e,n);let c=0,d=0;if(e.forEach((u,h)=>{const m=u.cue.pre,f=u.cue.post,p=e[h-1]||null,g=u.appendInPlace,v=f?i:u.startOffset,b=u.duration,x=u.timelineOccupancy===YQ.Range?b:0,w=u.resumptionOffset,k=(p==null?void 0:p.startTime)===v,S=v+u.cumulativeDuration;let C=g?S+b:v+w;if(m||!f&&v<=0){const E=d;d+=x,u.timelineStart=S;const N=o;o+=b,r.push({event:u,start:S,end:C,playout:{start:N,end:o},integrated:{start:E,end:d}})}else if(v<=i){if(!k){const A=v-c;if(A>C9e){const _=c,T=d;d+=A;const R=o;o+=A;const O={previousEvent:e[h-1]||null,nextEvent:u,start:_,end:_+A,playout:{start:R,end:o},integrated:{start:T,end:d}};r.push(O)}else A>0&&p&&(p.cumulativeDuration+=A,r[r.length-1].end=v)}f&&(C=S),u.timelineStart=S;const E=d;d+=x;const N=o;o+=b,r.push({event:u,start:S,end:C,playout:{start:N,end:o},integrated:{start:E,end:d}})}else return;const j=u.resumeTime;f||j>i?c=i:c=j}),c<i){var l;const u=c,h=d,m=i-c;d+=m;const f=o;o+=m,r.push({previousEvent:((l=r[r.length-1])==null?void 0:l.event)||null,nextEvent:null,start:c,end:u+m,playout:{start:f,end:o},integrated:{start:h,end:d}})}this.setDurations(i,o,d)}else r.push({previousEvent:null,nextEvent:null,start:0,end:i,playout:{start:0,end:i},integrated:{start:0,end:i}}),this.setDurations(i,i,i);return r}setDurations(e,n,r){this.durations={primary:e,playout:n,integrated:r}}resolveOffsets(e,n){const r=n.main.details,s=r.live?1/0:r.edge;let i=0,o=-1;e.forEach((l,c)=>{const d=l.cue.pre,u=l.cue.post,h=d?0:u?s:l.startTime;this.updateAssetDurations(l),o===h?l.cumulativeDuration=i:(i=0,o=h),!u&&l.snapOptions.in&&(l.resumeAnchor=V2(null,r.fragments,l.startOffset+l.resumptionOffset,0,0)||void 0),l.appendInPlace&&!l.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(l,n)||(l.appendInPlace=!1)),!l.appendInPlace&&c+1<e.length&&e[c+1].startTime-e[c].resumeTime<C9e&&(e[c+1].appendInPlace=!1,e[c+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${l}`));const f=$n(l.resumeOffset)?l.resumeOffset:l.duration;i+=f})}primaryCanResumeInPlaceAt(e,n){const r=e.resumeTime,s=e.startTime+e.resumptionOffset;return Math.abs(r-s)>nP?(this.log(`"${e.identifier}" resumption ${r} not aligned with estimated timeline end ${s}`),!1):!Object.keys(n).some(o=>{const l=n[o].details,c=l.edge;if(r>=c)return this.log(`"${e.identifier}" resumption ${r} past ${o} playlist end ${c}`),!1;const d=V2(null,l.fragments,r);if(!d)return this.log(`"${e.identifier}" resumption ${r} does not align with any fragments in ${o} playlist (${l.fragStart}-${l.fragmentEnd})`),!0;const u=o==="audio"?.175:0;return Math.abs(d.start-r)<nP+u||Math.abs(d.end-r)<nP+u?!1:(this.log(`"${e.identifier}" resumption ${r} not aligned with ${o} fragment bounds (${d.start}-${d.end} sn: ${d.sn} cc: ${d.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;const n=e.timelineStart;let r=0,s=!1,i=!1;for(let o=0;o<e.assetList.length;o++){const l=e.assetList[o],c=n+r;l.startOffset=r,l.timelineStart=c,s||(s=l.duration===null),i||(i=!!l.error);const d=l.error?0:l.duration||0;r+=d}s&&!i?e.duration=Math.max(r,e.duration):e.duration=r}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}};function vp(t){return`[${t.event?'"'+t.event.identifier+'"':"primary"}: ${t.start.toFixed(2)}-${t.end.toFixed(2)}]`}let WWn=class{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,n){const r=e.assetListUrl;let s;try{s=bwt(r,this.hls.sessionId,e.baseUrl)}catch(m){const f=this.assignAssetListError(e,dt.ASSET_LIST_LOAD_ERROR,m,r);this.hls.trigger(ue.ERROR,f);return}n&&s.protocol!=="data:"&&s.searchParams.set("_HLS_start_offset",""+n);const i=this.hls.config,o=i.loader,l=new o(i),c={responseType:"json",url:s.href},d=i.interstitialAssetListLoadPolicy.default,u={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(m,f,p,g)=>{const v=m.data,b=v==null?void 0:v.ASSETS;if(!Array.isArray(b)){const x=this.assignAssetListError(e,dt.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),p.url,f,g);this.hls.trigger(ue.ERROR,x);return}e.assetListResponse=v,this.hls.trigger(ue.ASSET_LIST_LOADED,{event:e,assetListResponse:v,networkDetails:g})},onError:(m,f,p,g)=>{const v=this.assignAssetListError(e,dt.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${m.code} ${m.text} (${f.url})`),f.url,g,p);this.hls.trigger(ue.ERROR,v)},onTimeout:(m,f,p)=>{const g=this.assignAssetListError(e,dt.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${f.url})`),f.url,m,p);this.hls.trigger(ue.ERROR,g)}};return l.load(c,u,h),this.hls.trigger(ue.ASSET_LIST_LOADING,{event:e}),l}assignAssetListError(e,n,r,s,i,o){return e.error=r,{type:ur.NETWORK_ERROR,details:n,fatal:!1,interstitial:e,url:s,error:r,networkDetails:o,stats:i}}};function j9e(t){var e;t==null||(e=t.play())==null||e.catch(()=>{})}function yT(t,e){return`[${t}] Advancing timeline position to ${e}`}let qWn=class extends tp{constructor(e,n){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const r=this.currentTime;if(r===void 0||this.playbackDisabled||!this.schedule)return;const s=r-this.timelinePos;if(Math.abs(s)<1/7056e5)return;const o=s<=-.01;this.timelinePos===-1&&!this.effectivePlayingItem&&this.checkStart(),this.timelinePos=r,this.bufferedPos=r;const l=this.playingItem;if(!l){this.checkBuffer();return}if(o&&this.schedule.resetErrorsInRange(r,r-s)&&this.updateSchedule(!0),this.checkBuffer(),o&&r<l.start||r>=l.end){var c;const f=this.findItemIndex(l);let p=this.schedule.findItemIndexAtTime(r);if(p===-1&&(p=f+(o?-1:1),this.log(`seeked ${o?"back ":""}to position not covered by schedule ${r} (resolving from ${f} to ${p})`)),!this.isInterstitial(l)&&(c=this.media)!=null&&c.paused&&(this.shouldPlay=!1),!o&&p>f){const g=this.schedule.findJumpRestrictedIndex(f+1,p);if(g>f){this.setSchedulePosition(g);return}}this.setSchedulePosition(p);return}const d=this.playingAsset;if(!d){if(this.playingLastItem&&this.isInterstitial(l)){const f=l.event.assetList[0];f&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(r,f))}return}const u=d.timelineStart,h=d.duration||0;if(o&&r<u||r>=u+h){var m;(m=l.event)!=null&&m.appendInPlace&&(this.clearAssetPlayers(l.event,l),this.flushFrontBuffer(r)),this.setScheduleToAssetAtTime(r,d)}},this.onTimeupdate=()=>{const r=this.currentTime;if(r===void 0||this.playbackDisabled)return;if(this.timelinePos===-1&&!this.effectivePlayingItem&&this.checkStart(),r>this.timelinePos)this.timelinePos=r,r>this.bufferedPos&&this.checkBuffer();else return;const s=this.playingItem;if(!s||this.playingLastItem)return;if(r>=s.end){this.timelinePos=s.end;const l=this.findItemIndex(s);this.setSchedulePosition(l+1)}const i=this.playingAsset;if(!i)return;const o=i.timelineStart+(i.duration||0);r>=o&&this.setScheduleToAssetAtTime(r,i)},this.onScheduleUpdate=(r,s)=>{const i=this.schedule;if(!i)return;const o=this.playingItem,l=i.events||[],c=i.items||[],d=i.durations,u=r.map(g=>g.identifier),h=!!(l.length||u.length);(h||s)&&this.log(`INTERSTITIALS_UPDATED (${l.length}): ${l}
Schedule: ${c.map(g=>vp(g))} pos: ${this.timelinePos}`),u.length&&this.log(`Removed events ${u}`);let m=null,f=null;o&&(m=this.updateItem(o,this.timelinePos),this.itemsMatch(o,m)?this.playingItem=m:this.waitingItem=this.endedItem=null),this.waitingItem=this.updateItem(this.waitingItem),this.endedItem=this.updateItem(this.endedItem);const p=this.bufferingItem;if(p&&(f=this.updateItem(p,this.bufferedPos),this.itemsMatch(p,f)?this.bufferingItem=f:p.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(p.event,null))),r.forEach(g=>{g.assetList.forEach(v=>{this.clearAssetPlayer(v.identifier,null)})}),this.playerQueue.forEach(g=>{if(g.interstitial.appendInPlace){const v=g.assetItem.timelineStart,b=g.timelineOffset-v;if(b)try{g.timelineOffset=v}catch(x){Math.abs(b)>nP&&this.warn(`${x} ("${g.assetId}" ${g.timelineOffset}->${v})`)}}}),h||s){if(this.hls.trigger(ue.INTERSTITIALS_UPDATED,{events:l.slice(0),schedule:c.slice(0),durations:d,removedIds:u}),this.isInterstitial(o)&&u.includes(o.event.identifier)){this.warn(`Interstitial "${o.event.identifier}" removed while playing`),this.primaryFallback(o.event);return}o&&this.trimInPlace(m,o),p&&f!==m&&this.trimInPlace(f,p),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=n,this.assetListLoader=new WWn(e),this.schedule=new GWn(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(ue.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(ue.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(ue.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(ue.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(ue.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(ue.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(ue.BUFFER_APPENDED,this.onBufferAppended,this),e.on(ue.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(ue.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(ue.MEDIA_ENDED,this.onMediaEnded,this),e.on(ue.ERROR,this.onError,this),e.on(ue.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(ue.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(ue.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(ue.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(ue.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(ue.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(ue.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(ue.BUFFER_CODECS,this.onBufferCodecs,this),e.off(ue.BUFFER_APPENDED,this.onBufferAppended,this),e.off(ue.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(ue.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(ue.MEDIA_ENDED,this.onMediaEnded,this),e.off(ue.ERROR,this.onError,this),e.off(ue.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=this.log=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){fh(e,"play",this.onPlay),fh(e,"pause",this.onPause),fh(e,"seeking",this.onSeeking),fh(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,n){const r=this.media=n.media;Tu(r,"seeking",this.onSeeking),Tu(r,"timeupdate",this.onTimeupdate),Tu(r,"play",this.onPlay),Tu(r,"pause",this.onPause)}onMediaAttached(e,n){const r=this.effectivePlayingItem,s=this.detachedData;if(this.detachedData=null,r===null)this.checkStart();else if(!s){this.clearScheduleState();const i=this.findItemIndex(r);this.setSchedulePosition(i)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,n){const r=!!n.transferMedia,s=this.media;if(this.media=null,!r&&(s&&this.removeMediaListeners(s),this.detachedData)){const i=this.getBufferingPlayer();i&&(this.log(`Removing schedule state for detachedData and ${i}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,i.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,n=()=>e.bufferingItem||e.waitingItem,r=h=>h&&e.getAssetPlayer(h.identifier),s=(h,m,f,p,g)=>{if(h){let v=h[m].start;const b=h.event;if(b){if(m==="playout"||b.timelineOccupancy!==YQ.Point){const x=r(f);(x==null?void 0:x.interstitial)===b&&(v+=x.assetItem.startOffset+x[g])}}else{const x=p==="bufferedPos"?o():e[p];v+=x-h.start}return v}return 0},i=(h,m)=>{var f;if(h!==0&&m!=="primary"&&(f=e.schedule)!=null&&f.length){var p;const g=e.schedule.findItemIndexAtTime(h),v=(p=e.schedule.items)==null?void 0:p[g];if(v){const b=v[m].start-v.start;return h+b}}return h},o=()=>{const h=e.bufferedPos;return h===Number.MAX_VALUE?l("primary"):Math.max(h,0)},l=h=>{var m,f;return(m=e.primaryDetails)!=null&&m.live?e.primaryDetails.edge:((f=e.schedule)==null?void 0:f.durations[h])||0},c=(h,m)=>{var f,p;const g=e.effectivePlayingItem;if(g!=null&&(f=g.event)!=null&&f.restrictions.skip||!e.schedule)return;e.log(`seek to ${h} "${m}"`);const v=e.effectivePlayingItem,b=e.schedule.findItemIndexAtTime(h,m),x=(p=e.schedule.items)==null?void 0:p[b],w=e.getBufferingPlayer(),k=w==null?void 0:w.interstitial,S=k==null?void 0:k.appendInPlace,C=v&&e.itemsMatch(v,x);if(v&&(S||C)){const j=r(e.playingAsset),E=(j==null?void 0:j.media)||e.primaryMedia;if(E){const N=m==="primary"?E.currentTime:s(v,m,e.playingAsset,"timelinePos","currentTime"),A=h-N,_=(S?N:E.currentTime)+A;if(_>=0&&(!j||S||_<=j.duration)){E.currentTime=_;return}}}if(x){let j=h;if(m!=="primary"){const N=x[m].start,A=h-N;j=x.start+A}const E=!e.isInterstitial(x);if((!e.isInterstitial(v)||v.event.appendInPlace)&&(E||x.event.appendInPlace)){const N=e.media||(S?w==null?void 0:w.media:null);N&&(N.currentTime=j)}else if(v){const N=e.findItemIndex(v);if(b>N){const _=e.schedule.findJumpRestrictedIndex(N+1,b);if(_>N){e.setSchedulePosition(_);return}}let A=0;if(E)e.timelinePos=j,e.checkBuffer();else{const _=x.event.assetList,T=h-(x[m]||x).start;for(let R=_.length;R--;){const O=_[R];if(O.duration&&T>=O.startOffset&&T<O.startOffset+O.duration){A=R;break}}}e.setSchedulePosition(b,A)}}},d=()=>{const h=e.effectivePlayingItem;if(e.isInterstitial(h))return h;const m=n();return e.isInterstitial(m)?m:null},u={get bufferedEnd(){const h=n(),m=e.bufferingItem;if(m&&m===h){var f;return s(m,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-m.playout.start||((f=e.bufferingAsset)==null?void 0:f.startOffset)||0}return 0},get currentTime(){const h=d(),m=e.effectivePlayingItem;return m&&m===h?s(m,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-m.playout.start:0},set currentTime(h){const m=d(),f=e.effectivePlayingItem;f&&f===m&&c(h+f.playout.start,"playout")},get duration(){const h=d();return h?h.playout.end-h.playout.start:0},get assetPlayers(){var h;const m=(h=d())==null?void 0:h.event.assetList;return m?m.map(f=>e.getAssetPlayer(f.identifier)):[]},get playingIndex(){var h;const m=(h=d())==null?void 0:h.event;return m&&e.effectivePlayingAsset?m.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return d()}};return this.manager={get events(){var h;return((h=e.schedule)==null||(h=h.events)==null?void 0:h.slice(0))||[]},get schedule(){var h;return((h=e.schedule)==null||(h=h.items)==null?void 0:h.slice(0))||[]},get interstitialPlayer(){return d()?u:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return n()},get bufferingIndex(){const h=n();return e.findItemIndex(h)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const h=e.effectivePlayingItem;return e.findItemIndex(h)},primary:{get bufferedEnd(){return o()},get currentTime(){const h=e.timelinePos;return h>0?h:0},set currentTime(h){c(h,"primary")},get duration(){return l("primary")},get seekableStart(){var h;return((h=e.primaryDetails)==null?void 0:h.fragmentStart)||0}},integrated:{get bufferedEnd(){return s(n(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return s(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(h){c(h,"integrated")},get duration(){return l("integrated")},get seekableStart(){var h;return i(((h=e.primaryDetails)==null?void 0:h.fragmentStart)||0,"integrated")}},skip:()=>{const h=e.effectivePlayingItem,m=h==null?void 0:h.event;if(m&&!m.restrictions.skip){const f=e.findItemIndex(h);if(m.appendInPlace){const p=h.playout.start+h.event.duration;c(p+.001,"playout")}else e.advanceAfterAssetEnded(m,f,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const n=this.playingItem,r=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!n||!r?!1:this.findItemIndex(n)===r.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,n;if(this.mediaSelection===null)return;const r=this.waitingItem||this.playingItem;if(this.isInterstitial(r)&&!r.event.appendInPlace)return;let s=this.media;!s&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(s=this.primaryMedia);const i=(n=s)==null?void 0:n.currentTime;if(!(i===void 0||!$n(i)))return i}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,n){const r=this.getAssetPlayer(e);r&&this.transferMediaFromPlayer(r,n)}transferMediaFromPlayer(e,n){const r=e.interstitial.appendInPlace,s=e.media;if(r&&s===this.primaryMedia){if(this.bufferingAsset=null,(!n||this.isInterstitial(n)&&!n.event.appendInPlace)&&n&&s){this.detachedData={media:s};return}const i=e.transferMedia();this.log(`transfer MediaSource from ${e} ${va(i)}`),this.detachedData=i}else n&&s&&(this.shouldPlay||(this.shouldPlay=!s.paused))}transferMediaTo(e,n){var r,s;if(e.media===n)return;let i=null;const o=this.hls,l=e!==o,c=l&&e.interstitial.appendInPlace,d=(r=this.detachedData)==null?void 0:r.mediaSource;let u;if(o.media)c&&(i=o.transferMedia(),this.detachedData=i),u="Primary";else if(d){const p=this.getBufferingPlayer();p?(i=p.transferMedia(),u=`${p}`):u="detached MediaSource"}else u="detached media";if(!i){if(d)i=this.detachedData,this.log(`using detachedData: MediaSource ${va(i)}`);else if(!this.detachedData||o.media===n){const p=this.playerQueue;p.length>1&&p.forEach(g=>{if(l&&g.interstitial.appendInPlace!==c){const v=g.interstitial;this.clearInterstitial(g.interstitial,null),v.appendInPlace=!1,v.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${v}`)}}),this.hls.detachMedia(),this.detachedData={media:n}}}const h=i&&"mediaSource"in i&&((s=i.mediaSource)==null?void 0:s.readyState)!=="closed",m=h&&i?i:n;this.log(`${h?"transfering MediaSource":"attaching media"} to ${l?e:"Primary"} from ${u} (media.currentTime: ${n.currentTime})`);const f=this.schedule;if(m===i&&f){const p=l&&e.assetId===f.assetIdAtEnd;m.overrides={duration:f.duration,endOfStream:!l||p,cueRemoval:!l}}e.attachMedia(m)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,n=e==null?void 0:e.events;if(!n||this.playbackDisabled||!this.media)return;this.bufferedPos===-1&&(this.bufferedPos=0);const r=this.timelinePos,s=this.effectivePlayingItem;if(r===-1){const i=this.hls.startPosition;if(this.timelinePos=i,n.length===0)this.setSchedulePosition(0);else if(n[0].cue.pre){this.log(yT("checkStart (preroll)",i));const o=e.findEventIndex(n[0].identifier);this.setSchedulePosition(o)}else if(i>=0||!this.primaryLive){this.log(yT("checkStart",i));const o=this.timelinePos=i>0?i:0,l=e.findItemIndexAtTime(o);this.setSchedulePosition(l)}else this.hls.liveSyncPosition===0?this.setSchedulePosition(0):this.log("[checkStart] waiting for live start")}else if(s&&!this.playingItem){this.log(yT("checkStart (playing item)",s.start));const i=e.findItemIndex(s);this.setSchedulePosition(i)}}advanceAssetBuffering(e,n){const r=e.event,s=r.findAssetIndex(n),i=Zce(r,s);if(!r.isAssetPastPlayoutLimit(i))this.bufferedToEvent(e,i);else if(this.schedule){var o;const l=(o=this.schedule.items)==null?void 0:o[this.findItemIndex(e)+1];l&&this.bufferedToItem(l)}}advanceAfterAssetEnded(e,n,r){const s=Zce(e,r);if(e.isAssetPastPlayoutLimit(s)){if(this.schedule){const i=this.schedule.items;if(i){const o=n+1,l=i.length;if(o>=l){this.setSchedulePosition(-1);return}const c=e.resumeTime;this.timelinePos<c&&(this.log(yT("advanceAfterAssetEnded",c)),this.timelinePos=c,e.appendInPlace&&this.advanceInPlace(c),this.checkBuffer(this.bufferedPos<c)),this.setSchedulePosition(o)}}}else{if(e.appendInPlace){const i=e.assetList[s];i&&this.advanceInPlace(i.timelineStart)}this.setSchedulePosition(n,s)}}setScheduleToAssetAtTime(e,n){const r=this.schedule;if(!r)return;const s=n.parentIdentifier,i=r.getEvent(s);if(i){const o=r.findEventIndex(s),l=r.findAssetIndex(i,e);this.advanceAfterAssetEnded(i,o,l-1)}}setSchedulePosition(e,n){var r;const s=(r=this.schedule)==null?void 0:r.items;if(!s||this.playbackDisabled)return;const i=e>=0?s[e]:null;this.log(`setSchedulePosition ${e}, ${n} (${i&&vp(i)}) pos: ${this.timelinePos}`);const o=this.waitingItem||this.playingItem,l=this.playingLastItem;if(this.isInterstitial(o)){const u=o.event,h=this.playingAsset,m=h==null?void 0:h.identifier,f=m?this.getAssetPlayer(m):null;if(f&&m&&(!this.eventItemsMatch(o,i)||n!==void 0&&m!==u.assetList[n].identifier)){var c;const p=u.findAssetIndex(h);if(this.log(`INTERSTITIAL_ASSET_ENDED ${p+1}/${u.assetList.length} ${R_(h)}`),this.endedAsset=h,this.playingAsset=null,this.hls.trigger(ue.INTERSTITIAL_ASSET_ENDED,{asset:h,assetListIndex:p,event:u,schedule:s.slice(0),scheduleIndex:e,player:f}),o!==this.playingItem){this.itemsMatch(o,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(u,this.findItemIndex(this.playingItem),p);return}this.retreiveMediaSource(m,i),f.media&&!((c=this.detachedData)!=null&&c.mediaSource)&&f.detachMedia()}if(!this.eventItemsMatch(o,i)&&(this.endedItem=o,this.playingItem=null,this.log(`INTERSTITIAL_ENDED ${u} ${vp(o)}`),u.hasPlayed=!0,this.hls.trigger(ue.INTERSTITIAL_ENDED,{event:u,schedule:s.slice(0),scheduleIndex:e}),u.cue.once)){var d;this.updateSchedule();const p=(d=this.schedule)==null?void 0:d.items;if(i&&p){const g=this.findItemIndex(i);this.advanceSchedule(g,p,n,o,l)}return}}this.advanceSchedule(e,s,n,o,l)}advanceSchedule(e,n,r,s,i){const o=this.schedule;if(!o)return;const l=n[e]||null,c=this.primaryMedia,d=this.playerQueue;if(d.length&&d.forEach(u=>{const h=u.interstitial,m=o.findEventIndex(h.identifier);(m<e||m>e+1)&&this.clearInterstitial(h,l)}),this.isInterstitial(l)){this.timelinePos=Math.min(Math.max(this.timelinePos,l.start),l.end);const u=l.event;if(r===void 0){r=o.findAssetIndex(u,this.timelinePos);const p=Zce(u,r-1);if(u.isAssetPastPlayoutLimit(p)||u.appendInPlace&&this.timelinePos===l.end){this.advanceAfterAssetEnded(u,e,r);return}r=p}const h=this.waitingItem;this.assetsBuffered(l,c)||this.setBufferingItem(l);let m=this.preloadAssets(u,r);if(this.eventItemsMatch(l,h||s)||(this.waitingItem=l,this.log(`INTERSTITIAL_STARTED ${vp(l)} ${u.appendInPlace?"append in place":""}`),this.hls.trigger(ue.INTERSTITIAL_STARTED,{event:u,schedule:n.slice(0),scheduleIndex:e})),!u.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${u}`);return}if(u.assetListLoader&&(u.assetListLoader.destroy(),u.assetListLoader=void 0),!c){this.log(`Waiting for attachMedia to start Interstitial ${u}`);return}this.waitingItem=this.endedItem=null,this.playingItem=l;const f=u.assetList[r];if(!f){this.advanceAfterAssetEnded(u,e,r||0);return}if(m||(m=this.getAssetPlayer(f.identifier)),m===null||m.destroyed){const p=u.assetList.length;this.warn(`asset ${r+1}/${p} player destroyed ${u}`),m=this.createAssetPlayer(u,f,r),m.loadSource()}if(!this.eventItemsMatch(l,this.bufferingItem)&&u.appendInPlace&&this.isAssetBuffered(f))return;this.startAssetPlayer(m,r,n,e,c),this.shouldPlay&&j9e(m.media)}else l?(this.resumePrimary(l,e,s),this.shouldPlay&&j9e(this.hls.media)):i&&this.isInterstitial(s)&&(this.endedItem=null,this.playingItem=s,s.event.appendInPlace||this.attachPrimary(o.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,n,r){var s,i;if(this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=this.endedItem=null,this.bufferedToItem(e),this.log(`resuming ${vp(e)}`),!((s=this.detachedData)!=null&&s.mediaSource)){let l=this.timelinePos;(l<e.start||l>=e.end)&&(l=this.getPrimaryResumption(e,n),this.log(yT("resumePrimary",l)),this.timelinePos=l),this.attachPrimary(l,e)}if(!r)return;const o=(i=this.schedule)==null?void 0:i.items;o&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${vp(e)}`),this.hls.trigger(ue.INTERSTITIALS_PRIMARY_RESUMED,{schedule:o.slice(0),scheduleIndex:n}),this.checkBuffer())}getPrimaryResumption(e,n){const r=e.start;if(this.primaryLive){const s=this.primaryDetails;if(n===0)return this.hls.startPosition;if(s&&(r<s.fragmentStart||r>s.edge))return this.hls.liveSyncPosition||-1}return r}isAssetBuffered(e){const n=this.getAssetPlayer(e.identifier);return n!=null&&n.hls?n.hls.bufferedToEnd:$s.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,n,r){n?this.setBufferingItem(n):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const s=this.primaryMedia;if(!s)return;const i=this.hls;i.media?this.checkBuffer():(this.transferMediaTo(i,s),r&&this.startLoadingPrimaryAt(e,r)),r||(this.log(yT("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,r))}startLoadingPrimaryAt(e,n){var r;const s=this.hls;!s.loadingEnabled||!s.media||Math.abs((((r=s.mainForwardBufferInfo)==null?void 0:r.start)||s.media.currentTime)-e)>.5?s.startLoad(e,n):s.bufferingEnabled||s.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(ue.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(ue.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,n){if(n.level===-1||!this.schedule)return;const r=this.hls.levels[n.level];if(!r.details)return;const s=Bi(Bi({},this.mediaSelection||this.altSelection),{},{main:r});this.mediaSelection=s,this.schedule.parseInterstitialDateRanges(s,this.hls.config.interstitialAppendInPlace),!this.effectivePlayingItem&&this.schedule.items&&this.checkStart()}onAudioTrackUpdated(e,n){const r=this.hls.audioTracks[n.id],s=this.mediaSelection;if(!s){this.altSelection=Bi(Bi({},this.altSelection),{},{audio:r});return}const i=Bi(Bi({},s),{},{audio:r});this.mediaSelection=i}onSubtitleTrackUpdated(e,n){const r=this.hls.subtitleTracks[n.id],s=this.mediaSelection;if(!s){this.altSelection=Bi(Bi({},this.altSelection),{},{subtitles:r});return}const i=Bi(Bi({},s),{},{subtitles:r});this.mediaSelection=i}onAudioTrackSwitching(e,n){const r=MBe(n);this.playerQueue.forEach(({hls:s})=>s&&(s.setAudioOption(n)||s.setAudioOption(r)))}onSubtitleTrackSwitch(e,n){const r=MBe(n);this.playerQueue.forEach(({hls:s})=>s&&(s.setSubtitleOption(n)||n.id!==-1&&s.setSubtitleOption(r)))}onBufferCodecs(e,n){const r=n.tracks;r&&(this.requiredTracks=r)}onBufferAppended(e,n){this.checkBuffer()}onBufferFlushed(e,n){const r=this.playingItem;if(r&&!this.itemsMatch(r,this.bufferingItem)&&!this.isInterstitial(r)){const s=this.timelinePos;this.bufferedPos=s,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const n=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&n){for(let s=0;s<n.length;s++){const i=n[s];if(i.cue.post){var r;const o=this.schedule.findEventIndex(i.identifier),l=(r=this.schedule.items)==null?void 0:r[o];this.isInterstitial(l)&&this.eventItemsMatch(l,this.bufferingItem)&&this.bufferedToItem(l,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const n=this.playingItem;if(!this.playingLastItem&&n){const r=this.findItemIndex(n);this.setSchedulePosition(r+1)}else this.shouldPlay=!1}updateItem(e,n){var r;const s=(r=this.schedule)==null?void 0:r.items;if(e&&s){const i=this.findItemIndex(e,n);return s[i]||null}return null}trimInPlace(e,n){if(this.isInterstitial(e)&&e.event.appendInPlace&&n.end-e.end>.25){e.event.assetList.forEach((i,o)=>{e.event.isAssetPastPlayoutLimit(o)&&this.clearAssetPlayer(i.identifier,null)});const r=e.end+.25,s=$s.bufferInfo(this.primaryMedia,r,0);(s.end>r||(s.nextStart||0)>r)&&(this.log(`trim buffered interstitial ${vp(e)} (was ${vp(n)})`),this.attachPrimary(r,null,!0),this.flushFrontBuffer(r))}}itemsMatch(e,n){return!!n&&(e===n||e.event&&n.event&&this.eventItemsMatch(e,n)||!e.event&&!n.event&&this.findItemIndex(e)===this.findItemIndex(n))}eventItemsMatch(e,n){var r;return!!n&&(e===n||e.event.identifier===((r=n.event)==null?void 0:r.identifier))}findItemIndex(e,n){return e&&this.schedule?this.schedule.findItemIndex(e,n):-1}updateSchedule(e=!1){var n;const r=this.mediaSelection;r&&((n=this.schedule)==null||n.updateSchedule(r,[],e))}checkBuffer(e){var n;const r=(n=this.schedule)==null?void 0:n.items;if(!r)return;const s=$s.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=s.len<1),this.updateBufferedPos(s.end,r,e)}updateBufferedPos(e,n,r){const s=this.schedule,i=this.bufferingItem;if(this.bufferedPos>e||!s)return;if(n.length===1&&this.itemsMatch(n[0],i)){this.bufferedPos=e;return}const o=this.playingItem,l=this.findItemIndex(o);let c=s.findItemIndexAtTime(e);if(this.bufferedPos<e){var d;const u=this.findItemIndex(i),h=Math.min(u+1,n.length-1),m=n[h];if((c===-1&&i&&e>=i.end||(d=m.event)!=null&&d.appendInPlace&&e+.01>=m.start)&&(c=h),this.isInterstitial(i)){const f=i.event;if(h-l>1&&f.appendInPlace===!1||f.assetList.length===0&&f.assetListLoader)return}if(this.bufferedPos=e,c>u&&c>l)this.bufferedToItem(m);else{const f=this.primaryDetails;this.primaryLive&&f&&e>f.edge-f.targetduration&&m.start<f.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(m)&&this.preloadAssets(m.event,0)}}else r&&o&&!this.itemsMatch(o,i)&&(c===l?this.bufferedToItem(o):c===l+1&&this.bufferedToItem(n[c]))}assetsBuffered(e,n){return e.event.assetList.length===0?!1:!e.event.assetList.some(s=>{const i=this.getAssetPlayer(s.identifier);return!(i!=null&&i.bufferedInPlaceToEnd(n))})}setBufferingItem(e){const n=this.bufferingItem,r=this.schedule;if(!this.itemsMatch(e,n)&&r){const{items:s,events:i}=r;if(!s||!i)return n;const o=this.isInterstitial(e),l=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const c=l?l.remaining:n?n.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${vp(e)}`+(n?` (${c.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(o){const d=r.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((u,h)=>{const m=this.getAssetPlayer(u.identifier);m&&(h===d&&m.loadSource(),m.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(d=>d.pauseBuffering());this.hls.trigger(ue.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:i.slice(0),schedule:s.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return n}bufferedToItem(e,n=0){const r=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,n);else if(r!==null){this.bufferingAsset=null;const s=this.detachedData;s?s.mediaSource?this.attachPrimary(e.start,e,!0):this.preloadPrimary(e):this.preloadPrimary(e)}}}preloadPrimary(e){const n=this.findItemIndex(e),r=this.getPrimaryResumption(e,n);this.startLoadingPrimaryAt(r)}bufferedToEvent(e,n){const r=e.event,s=r.assetList.length===0&&!r.assetListLoader,i=r.cue.once;if(s||!i){const o=this.preloadAssets(r,n);if(o!=null&&o.interstitial.appendInPlace){const l=this.primaryMedia;l&&this.bufferAssetPlayer(o,l)}}}preloadAssets(e,n){const r=e.assetUrl,s=e.assetList.length,i=s===0&&!e.assetListLoader,o=e.cue.once;if(i){const c=e.timelineStart;if(e.appendInPlace){var l;const m=this.playingItem;!this.isInterstitial(m)&&(m==null||(l=m.nextEvent)==null?void 0:l.identifier)===e.identifier&&this.flushFrontBuffer(c+.25)}let d,u=0;if(!this.playingItem&&this.primaryLive&&(u=this.hls.startPosition,u===-1&&(u=this.hls.liveSyncPosition||0)),u&&!(e.cue.pre||e.cue.post)){const m=u-c;m>0&&(d=Math.round(m*1e3)/1e3)}if(this.log(`Load interstitial asset ${n+1}/${r?1:s} ${e}${d?` live-start: ${u} start-offset: ${d}`:""}`),r)return this.createAsset(e,0,0,c,e.duration,r);const h=this.assetListLoader.loadAssetList(e,d);h&&(e.assetListLoader=h)}else if(!o&&s){for(let d=n;d<s;d++){const u=e.assetList[d],h=this.getAssetPlayerQueueIndex(u.identifier);(h===-1||this.playerQueue[h].destroyed)&&!u.error&&this.createAssetPlayer(e,u,d)}const c=e.assetList[n];if(c){const d=this.getAssetPlayer(c.identifier);return d&&d.loadSource(),d}}return null}flushFrontBuffer(e){const n=this.requiredTracks;if(!n)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(n).forEach(s=>{this.hls.trigger(ue.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:s})})}getAssetPlayerQueueIndex(e){const n=this.playerQueue;for(let r=0;r<n.length;r++)if(e===n[r].assetId)return r;return-1}getAssetPlayer(e){const n=this.getAssetPlayerQueueIndex(e);return this.playerQueue[n]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:n}=this;if(n){for(let r=0;r<e.length;r++)if(e[r].media===n)return e[r]}return null}createAsset(e,n,r,s,i,o){const l={parentIdentifier:e.identifier,identifier:UWn(e,o,n),duration:i,startOffset:r,timelineStart:s,uri:o};return this.createAssetPlayer(e,l,n)}createAssetPlayer(e,n,r){const s=this.hls,i=s.userConfig;let o=i.videoPreference;const l=s.loadLevelObj||s.levels[s.currentLevel];(o||l)&&(o=ra({},o),l.videoCodec&&(o.videoCodec=l.videoCodec),l.videoRange&&(o.allowedVideoRanges=[l.videoRange]));const c=s.audioTracks[s.audioTrack],d=s.subtitleTracks[s.subtitleTrack];let u=0;if(this.primaryLive||e.appendInPlace){const k=this.timelinePos-n.timelineStart;if(k>1){const S=n.duration;S&&k<S&&(u=k)}}const h=n.identifier,m=Bi(Bi({},i),{},{maxMaxBufferLength:Math.min(180,s.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:s.sessionId,assetPlayerId:h,abrEwmaDefaultEstimate:s.bandwidthEstimate,interstitialsController:void 0,startPosition:u,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:o,audioPreference:c||i.audioPreference,subtitlePreference:d||i.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,n.timelineStart&&(m.timelineOffset=n.timelineStart));const f=m.cmcd;f!=null&&f.sessionId&&f.contentId&&(m.cmcd=ra({},f,{contentId:g$(n.uri)})),this.getAssetPlayer(h)&&this.warn(`Duplicate date range identifier ${e} and asset ${h}`);const p=new HWn(this.HlsPlayerClass,m,e,n);this.playerQueue.push(p),e.assetList[r]=n;let g=!0;const v=k=>{if(k.live){var S;const E=new Error(`Interstitials MUST be VOD assets ${e}`),N={fatal:!0,type:ur.OTHER_ERROR,details:dt.INTERSTITIAL_ASSET_ITEM_ERROR,error:E},A=((S=this.schedule)==null?void 0:S.findEventIndex(e.identifier))||-1;this.handleAssetItemError(N,e,A,r,E.message);return}const C=k.edge-k.fragmentStart,j=n.duration;(g||j===null||C>j)&&(g=!1,this.log(`Interstitial asset "${h}" duration change ${j} > ${C}`),n.duration=C,this.updateSchedule())};p.on(ue.LEVEL_UPDATED,(k,{details:S})=>v(S)),p.on(ue.LEVEL_PTS_UPDATED,(k,{details:S})=>v(S)),p.on(ue.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const b=(k,S)=>{const C=this.getAssetPlayer(h);if(C&&S.tracks){C.off(ue.BUFFER_CODECS,b),C.tracks=S.tracks;const j=this.primaryMedia;this.bufferingAsset===C.assetItem&&j&&!C.media&&this.bufferAssetPlayer(C,j)}};p.on(ue.BUFFER_CODECS,b);const x=()=>{var k;const S=this.getAssetPlayer(h);if(this.log(`buffered to end of asset ${S}`),!S||!this.schedule)return;const C=this.schedule.findEventIndex(e.identifier),j=(k=this.schedule.items)==null?void 0:k[C];this.isInterstitial(j)&&this.advanceAssetBuffering(j,n)};p.on(ue.BUFFERED_TO_END,x);const w=k=>()=>{if(!this.getAssetPlayer(h)||!this.schedule)return;this.shouldPlay=!0;const C=this.schedule.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,C,k)};return p.once(ue.MEDIA_ENDED,w(r)),p.once(ue.PLAYOUT_LIMIT_REACHED,w(1/0)),p.on(ue.ERROR,(k,S)=>{if(!this.schedule)return;const C=this.getAssetPlayer(h);if(S.details===dt.BUFFER_STALLED_ERROR){if(C!=null&&C.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}this.handleAssetItemError(S,e,this.schedule.findEventIndex(e.identifier),r,`Asset player error ${S.error} ${e}`)}),p.on(ue.DESTROYING,()=>{if(!this.getAssetPlayer(h)||!this.schedule)return;const S=new Error(`Asset player destroyed unexpectedly ${h}`),C={fatal:!0,type:ur.OTHER_ERROR,details:dt.INTERSTITIAL_ASSET_ITEM_ERROR,error:S};this.handleAssetItemError(C,e,this.schedule.findEventIndex(e.identifier),r,S.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${R_(n)}`),this.hls.trigger(ue.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:n,assetListIndex:r,event:e,player:p}),p}clearInterstitial(e,n){this.clearAssetPlayers(e,n),e.reset()}clearAssetPlayers(e,n){e.assetList.forEach(r=>{this.clearAssetPlayer(r.identifier,n)})}resetAssetPlayer(e){const n=this.getAssetPlayerQueueIndex(e);if(n!==-1){this.log(`reset asset player "${e}" after error`);const r=this.playerQueue[n];this.transferMediaFromPlayer(r,null),r.resetDetails()}}clearAssetPlayer(e,n){const r=this.getAssetPlayerQueueIndex(e);if(r!==-1){const s=this.playerQueue[r];this.log(`clear ${s} toSegment: ${n&&vp(n)}`),this.transferMediaFromPlayer(s,n),this.playerQueue.splice(r,1),s.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,n,r,s,i){const{interstitial:o,assetItem:l,assetId:c}=e,d=o.assetList.length,u=this.playingAsset;this.endedAsset=null,this.playingAsset=l,(!u||u.identifier!==c)&&(u&&(this.clearAssetPlayer(u.identifier,r[s]),delete u.error),this.log(`INTERSTITIAL_ASSET_STARTED ${n+1}/${d} ${R_(l)}`),this.hls.trigger(ue.INTERSTITIAL_ASSET_STARTED,{asset:l,assetListIndex:n,event:o,schedule:r.slice(0),scheduleIndex:s,player:e})),this.bufferAssetPlayer(e,i)}bufferAssetPlayer(e,n){var r,s;if(!this.schedule)return;const{interstitial:i,assetItem:o}=e,l=this.schedule.findEventIndex(i.identifier),c=(r=this.schedule.items)==null?void 0:r[l];if(!c)return;e.loadSource(),this.setBufferingItem(c),this.bufferingAsset=o;const d=this.getBufferingPlayer();if(d===e)return;const u=i.appendInPlace;if(u&&(d==null?void 0:d.interstitial.appendInPlace)===!1)return;const h=(d==null?void 0:d.tracks)||((s=this.detachedData)==null?void 0:s.tracks)||this.requiredTracks;if(u&&o!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(h&&!Jxt(h,e.tracks)){const m=new Error(`Asset ${R_(o)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(h)}')`),f={fatal:!0,type:ur.OTHER_ERROR,details:dt.INTERSTITIAL_ASSET_ITEM_ERROR,error:m},p=i.findAssetIndex(o);this.handleAssetItemError(f,i,l,p,m.message);return}}this.transferMediaTo(e,n)}handleInPlaceStall(e){const n=this.schedule,r=this.primaryMedia;if(!n||!r)return;const s=r.currentTime,i=n.findAssetIndex(e,s),o=e.assetList[i];if(o){const l=this.getAssetPlayer(o.identifier);if(l){const c=l.currentTime||s-o.timelineStart,d=l.duration-c;if(this.warn(`Stalled at ${c} of ${c+d} in ${l} ${e} (media.currentTime: ${s})`),c&&(d/r.playbackRate<.5||l.bufferedInPlaceToEnd(r))&&l.hls){const u=n.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,u,i)}}}}advanceInPlace(e){const n=this.primaryMedia;n&&n.currentTime<e&&(n.currentTime=e)}handleAssetItemError(e,n,r,s,i){if(e.details===dt.BUFFER_STALLED_ERROR)return;const o=n.assetList[s]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${o&&R_(o)} ${e.error}`),!this.schedule)return;const l=(o==null?void 0:o.identifier)||"",c=this.getAssetPlayerQueueIndex(l),d=this.playerQueue[c]||null,u=this.schedule.items,h=ra({},e,{fatal:!1,errorAction:eP(!0),asset:o,assetListIndex:s,event:n,schedule:u,scheduleIndex:r,player:d});if(this.hls.trigger(ue.INTERSTITIAL_ASSET_ERROR,h),!e.fatal)return;const m=this.playingAsset,f=this.bufferingAsset,p=new Error(i);if(o&&(this.clearAssetPlayer(l,null),o.error=p),!n.assetList.some(g=>!g.error))n.error=p;else for(let g=s;g<n.assetList.length;g++)this.resetAssetPlayer(n.assetList[g].identifier);this.updateSchedule(!0),n.error?this.primaryFallback(n):m&&m.identifier===l?this.advanceAfterAssetEnded(n,r,s):f&&f.identifier===l&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,f)}primaryFallback(e){const n=e.timelineStart,r=this.effectivePlayingItem;let s=this.timelinePos;if(r){this.log(`Fallback to primary from event "${e.identifier}" start: ${n} pos: ${s} playing: ${vp(r)} error: ${e.error}`),s===-1&&(s=this.hls.startPosition);const o=this.updateItem(r,s);this.itemsMatch(r,o)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(n,null),this.flushFrontBuffer(n))}else if(s===-1){this.checkStart();return}if(!this.schedule)return;const i=this.schedule.findItemIndexAtTime(s);this.setSchedulePosition(i)}onAssetListLoaded(e,n){var r,s;const i=n.event,o=i.identifier,l=n.assetListResponse.ASSETS;if(!((r=this.schedule)!=null&&r.hasEvent(o)))return;const c=i.timelineStart,d=i.duration;let u=0;l.forEach((g,v)=>{const b=parseFloat(g.DURATION);this.createAsset(i,v,u,c+u,b,g.URI),u+=b}),i.duration=u,this.log(`Loaded asset-list with duration: ${u} (was: ${d}) ${i}`);const h=this.waitingItem,m=(h==null?void 0:h.event.identifier)===o;this.updateSchedule();const f=(s=this.bufferingItem)==null?void 0:s.event;if(m){var p;const g=this.schedule.findEventIndex(o),v=(p=this.schedule.items)==null?void 0:p[g];if(v){if(!this.playingItem&&this.timelinePos>v.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==g){i.error=new Error(`Interstitial ${l.length?"no longer within playback range":"asset-list is empty"} ${this.timelinePos} ${i}`),this.log(i.error.message),this.updateSchedule(!0),this.primaryFallback(i);return}this.setBufferingItem(v)}this.setSchedulePosition(g)}else if((f==null?void 0:f.identifier)===o){const g=i.assetList[0];if(g){const v=this.getAssetPlayer(g.identifier);if(f.appendInPlace){const b=this.primaryMedia;v&&b&&this.bufferAssetPlayer(v,b)}else v&&v.loadSource()}}}onError(e,n){if(this.schedule)switch(n.details){case dt.ASSET_LIST_PARSING_ERROR:case dt.ASSET_LIST_LOAD_ERROR:case dt.ASSET_LIST_LOAD_TIMEOUT:{const r=n.interstitial;r&&(this.updateSchedule(!0),this.primaryFallback(r));break}case dt.BUFFER_STALLED_ERROR:{const r=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(r)&&r.event.appendInPlace){this.handleInPlaceStall(r.event);return}this.log(`Primary player stall @${this.timelinePos} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}};const E9e=500;let KWn=class extends pTe{constructor(e,n,r){super(e,n,r,"subtitle-stream-controller",Yn.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(ue.LEVEL_LOADED,this.onLevelLoaded,this),e.on(ue.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(ue.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(ue.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(ue.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(ue.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(ue.LEVEL_LOADED,this.onLevelLoaded,this),e.off(ue.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(ue.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(ue.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(ue.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(ue.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,n){this.stopLoad(),this.state=Mt.IDLE,this.setInterval(E9e),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=n?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,n){this.tracksBuffered=[],super.onMediaDetaching(e,n)}onLevelLoaded(e,n){this.mainDetails=n.details}onSubtitleFragProcessed(e,n){const{frag:r,success:s}=n;if(this.fragContextChanged(r)||(xl(r)&&(this.fragPrevious=r),this.state=Mt.IDLE),!s)return;const i=this.tracksBuffered[this.currentTrackId];if(!i)return;let o;const l=r.start;for(let d=0;d<i.length;d++)if(l>=i[d].start&&l<=i[d].end){o=i[d];break}const c=r.start+r.duration;o?o.end=c:(o={start:l,end:c},i.push(o)),this.fragmentTracker.fragBuffered(r),this.fragBufferedComplete(r,null),this.media&&this.tick()}onBufferFlushing(e,n){const{startOffset:r,endOffset:s}=n;if(r===0&&s!==Number.POSITIVE_INFINITY){const i=s-1;if(i<=0)return;n.endOffsetSubtitles=Math.max(0,i),this.tracksBuffered.forEach(o=>{for(let l=0;l<o.length;){if(o[l].end<=i){o.shift();continue}else if(o[l].start<i)o[l].start=i;else break;l++}}),this.fragmentTracker.removeFragmentsInRange(r,i,Yn.SUBTITLE)}}onError(e,n){const r=n.frag;(r==null?void 0:r.type)===Yn.SUBTITLE&&(n.details===dt.FRAG_GAP&&this.fragmentTracker.fragBuffered(r,!0),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Mt.STOPPED&&(this.state=Mt.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:n}){if(this.levels&&nwt(this.levels,n)){this.levels=n.map(r=>new T6(r));return}this.tracksBuffered=[],this.levels=n.map(r=>{const s=new T6(r);return this.tracksBuffered[s.id]=[],s}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Yn.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,n){var r;if(this.currentTrackId=n.id,!((r=this.levels)!=null&&r.length)||this.currentTrackId===-1){this.clearInterval();return}const s=this.levels[this.currentTrackId];s!=null&&s.details?this.mediaBuffer=this.mediaBufferTimeRanges:this.mediaBuffer=null,s&&this.state!==Mt.STOPPED&&this.setInterval(E9e)}onSubtitleTrackLoaded(e,n){var r;const{currentTrackId:s,levels:i}=this,{details:o,id:l}=n;if(!i){this.warn(`Subtitle tracks were reset while loading level ${l}`);return}const c=i[l];if(l>=i.length||!c)return;this.log(`Subtitle track ${l} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""},duration:${o.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;let d=0;if(o.live||(r=c.details)!=null&&r.live){if(o.deltaUpdateFailed)return;const h=this.mainDetails;if(!h){this.startFragRequested=!1;return}const m=h.fragments[0];if(!c.details)o.hasProgramDateTime&&h.hasProgramDateTime?(qQ(o,h),d=o.fragmentStart):m&&(d=m.start,Dbe(o,d));else{var u;d=this.alignPlaylists(o,c.details,(u=this.levelLastLoaded)==null?void 0:u.details),d===0&&m&&(d=m.start,Dbe(o,d))}h&&!this.startFragRequested&&this.setStartPosition(h,d)}c.details=o,this.levelLastLoaded=c,l===s&&(this.hls.trigger(ue.SUBTITLE_TRACK_UPDATED,{details:o,id:l,groupId:n.groupId}),this.tick(),o.live&&!this.fragCurrent&&this.media&&this.state===Mt.IDLE&&(V2(null,o.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),c.details=void 0)))}_handleFragmentLoadComplete(e){const{frag:n,payload:r}=e,s=n.decryptdata,i=this.hls;if(!this.fragContextChanged(n)&&r&&r.byteLength>0&&s!=null&&s.key&&s.iv&&tP(s.method)){const o=performance.now();this.decrypter.decrypt(new Uint8Array(r),s.key.buffer,s.iv.buffer,mTe(s.method)).catch(l=>{throw i.trigger(ue.ERROR,{type:ur.MEDIA_ERROR,details:dt.FRAG_DECRYPT_ERROR,fatal:!1,error:l,reason:l.message,frag:n}),l}).then(l=>{const c=performance.now();i.trigger(ue.FRAG_DECRYPTED,{frag:n,payload:l,stats:{tstart:o,tdecrypt:c}})}).catch(l=>{this.warn(`${l.name}: ${l.message}`),this.state=Mt.IDLE})}}doTick(){if(!this.media){this.state=Mt.IDLE;return}if(this.state===Mt.IDLE){const{currentTrackId:e,levels:n}=this,r=n==null?void 0:n[e];if(!r||!n.length||!r.details||this.waitForLive(r))return;const{config:s}=this,i=this.getLoadPosition(),o=$s.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],i,s.maxBufferHole),{end:l,len:c}=o,d=r.details,u=this.hls.maxBufferLength+d.levelTargetDuration;if(c>u)return;const h=d.fragments,m=h.length,f=d.edge;let p=null;const g=this.fragPrevious;if(l<f){const x=s.maxFragLookUpTolerance,w=l>f-x?0:x;p=V2(g,h,Math.max(h[0].start,l),w),!p&&g&&g.start<h[0].start&&(p=h[0])}else p=h[m-1];if(p=this.filterReplacedPrimary(p,r.details),!p)return;const v=p.sn-d.startSN,b=h[v-1];if(b&&b.cc===p.cc&&this.fragmentTracker.getState(b)===hc.NOT_LOADED&&(p=b),this.fragmentTracker.getState(p)===hc.NOT_LOADED){const x=this.mapToInitFragWhenRequired(p);x&&this.loadFragment(x,r,l)}}}loadFragment(e,n,r){xl(e)?super.loadFragment(e,n,r):this._loadInitSegment(e,n)}get mediaBufferTimeRanges(){return new YWn(this.tracksBuffered[this.currentTrackId]||[])}},YWn=class{constructor(e){this.buffered=void 0;const n=(r,s,i)=>{if(s=s>>>0,s>i-1)throw new DOMException(`Failed to execute '${r}' on 'TimeRanges': The index provided (${s}) is greater than the maximum bound (${i})`);return e[s][r]};this.buffered={get length(){return e.length},end(r){return n("end",r,e.length)},start(r){return n("start",r,e.length)}}}};const QWn={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},xwt=t=>String.fromCharCode(QWn[t]||t),Fp=15,mb=100,ZWn={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},JWn={17:2,18:4,21:6,22:8,23:10,19:13,20:15},XWn={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},eqn={25:2,26:4,29:6,30:8,31:10,27:13,28:15},tqn=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];let nqn=class{constructor(){this.time=null,this.verboseLevel=0}log(e,n){if(this.verboseLevel>=e){const r=typeof n=="function"?n():n;Ui.log(`${this.time} [${e}] ${r}`)}}};const sC=function(e){const n=[];for(let r=0;r<e.length;r++)n.push(e[r].toString(16));return n};let wwt=class{constructor(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}reset(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}setStyles(e){const n=["foreground","underline","italics","background","flash"];for(let r=0;r<n.length;r++){const s=n[r];e.hasOwnProperty(s)&&(this[s]=e[s])}}isDefault(){return this.foreground==="white"&&!this.underline&&!this.italics&&this.background==="black"&&!this.flash}equals(e){return this.foreground===e.foreground&&this.underline===e.underline&&this.italics===e.italics&&this.background===e.background&&this.flash===e.flash}copy(e){this.foreground=e.foreground,this.underline=e.underline,this.italics=e.italics,this.background=e.background,this.flash=e.flash}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}},rqn=class{constructor(){this.uchar=" ",this.penState=new wwt}reset(){this.uchar=" ",this.penState.reset()}setChar(e,n){this.uchar=e,this.penState.copy(n)}setPenState(e){this.penState.copy(e)}equals(e){return this.uchar===e.uchar&&this.penState.equals(e.penState)}copy(e){this.uchar=e.uchar,this.penState.copy(e.penState)}isEmpty(){return this.uchar===" "&&this.penState.isDefault()}},sqn=class{constructor(e){this.chars=[],this.pos=0,this.currPenState=new wwt,this.cueStartTime=null,this.logger=void 0;for(let n=0;n<mb;n++)this.chars.push(new rqn);this.logger=e}equals(e){for(let n=0;n<mb;n++)if(!this.chars[n].equals(e.chars[n]))return!1;return!0}copy(e){for(let n=0;n<mb;n++)this.chars[n].copy(e.chars[n])}isEmpty(){let e=!0;for(let n=0;n<mb;n++)if(!this.chars[n].isEmpty()){e=!1;break}return e}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>mb&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=mb)}moveCursor(e){const n=this.pos+e;if(e>1)for(let r=this.pos+1;r<n+1;r++)this.chars[r].setPenState(this.currPenState);this.setCursor(n)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const n=xwt(e);if(this.pos>=mb){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+n+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(n,this.currPenState),this.moveCursor(1)}clearFromPos(e){let n;for(n=e;n<mb;n++)this.chars[n].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let n=!0;for(let r=0;r<mb;r++){const s=this.chars[r].uchar;s!==" "&&(n=!1),e.push(s)}return n?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}},Jce=class{constructor(e){this.rows=[],this.currRow=Fp-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let n=0;n<Fp;n++)this.rows.push(new sqn(e));this.logger=e}reset(){for(let e=0;e<Fp;e++)this.rows[e].clear();this.currRow=Fp-1}equals(e){let n=!0;for(let r=0;r<Fp;r++)if(!this.rows[r].equals(e.rows[r])){n=!1;break}return n}copy(e){for(let n=0;n<Fp;n++)this.rows[n].copy(e.rows[n])}isEmpty(){let e=!0;for(let n=0;n<Fp;n++)if(!this.rows[n].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+va(e));let n=e.row-1;if(this.nrRollUpRows&&n<this.nrRollUpRows-1&&(n=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==n){for(let l=0;l<Fp;l++)this.rows[l].clear();const i=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){const l=o.rows[i].cueStartTime,c=this.logger.time;if(l!==null&&c!==null&&l<c)for(let d=0;d<this.nrRollUpRows;d++)this.rows[n-this.nrRollUpRows+d+1].copy(o.rows[i+d])}}this.currRow=n;const r=this.rows[this.currRow];if(e.indent!==null){const i=e.indent,o=Math.max(i-1,0);r.setCursor(e.indent),e.color=r.chars[o].penState.foreground}const s={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(s)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+va(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,n=this.rows.splice(e,1)[0];n.clear(),this.rows.splice(this.currRow,0,n),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const n=[];let r="",s=-1;for(let i=0;i<Fp;i++){const o=this.rows[i].getTextString();o&&(s=i+1,e?n.push("Row "+s+": '"+o+"'"):n.push(o.trim()))}return n.length>0&&(e?r="["+n.join(" | ")+"]":r=n.join(`
`)),r}getTextAndFormat(){return this.rows}},N9e=class{constructor(e,n,r){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=n,this.mode=null,this.verbose=0,this.displayedMemory=new Jce(r),this.nonDisplayedMemory=new Jce(r),this.lastOutputScreen=new Jce(r),this.currRollUpRow=this.displayedMemory.rows[Fp-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=r}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Fp-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let r=0;r<e.length;r++)this.writeScreen.insertChar(e[r]);const n=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>n+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const n={flash:!1};if(n.underline=e%2===1,n.italics=e>=46,n.italics)n.foreground="white";else{const r=Math.floor(e/2)-16,s=["white","green","blue","cyan","red","yellow","magenta"];n.foreground=s[r]}this.logger.log(2,"MIDROW: "+va(n)),this.writeScreen.setPen(n)}outputDataUpdate(e=!1){const n=this.logger.time;n!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=n:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,n,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:n),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}},T9e=class{constructor(e,n,r){this.channels=void 0,this.currentChannel=0,this.cmdHistory=aqn(),this.logger=void 0;const s=this.logger=new nqn;this.channels=[null,new N9e(e,n,s),new N9e(e+1,r,s)]}getHandler(e){return this.channels[e].getHandler()}setHandler(e,n){this.channels[e].setHandler(n)}addData(e,n){this.logger.time=e;for(let r=0;r<n.length;r+=2){const s=n[r]&127,i=n[r+1]&127;let o=!1,l=null;if(s===0&&i===0)continue;this.logger.log(3,()=>"["+sC([n[r],n[r+1]])+"] -> ("+sC([s,i])+")");const c=this.cmdHistory;if(s>=16&&s<=31){if(iqn(s,i,c)){nV(null,null,c),this.logger.log(3,()=>"Repeated command ("+sC([s,i])+") is dropped");continue}nV(s,i,this.cmdHistory),o=this.parseCmd(s,i),o||(o=this.parseMidrow(s,i)),o||(o=this.parsePAC(s,i)),o||(o=this.parseBackgroundAttributes(s,i))}else nV(null,null,c);if(!o&&(l=this.parseChars(s,i),l)){const u=this.currentChannel;u&&u>0?this.channels[u].insertChars(l):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!o&&!l&&this.logger.log(2,()=>"Couldn't parse cleaned data "+sC([s,i])+" orig: "+sC([n[r],n[r+1]]))}}parseCmd(e,n){const r=(e===20||e===28||e===21||e===29)&&n>=32&&n<=47,s=(e===23||e===31)&&n>=33&&n<=35;if(!(r||s))return!1;const i=e===20||e===21||e===23?1:2,o=this.channels[i];return e===20||e===21||e===28||e===29?n===32?o.ccRCL():n===33?o.ccBS():n===34?o.ccAOF():n===35?o.ccAON():n===36?o.ccDER():n===37?o.ccRU(2):n===38?o.ccRU(3):n===39?o.ccRU(4):n===40?o.ccFON():n===41?o.ccRDC():n===42?o.ccTR():n===43?o.ccRTD():n===44?o.ccEDM():n===45?o.ccCR():n===46?o.ccENM():n===47&&o.ccEOC():o.ccTO(n-32),this.currentChannel=i,!0}parseMidrow(e,n){let r=0;if((e===17||e===25)&&n>=32&&n<=47){if(e===17?r=1:r=2,r!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const s=this.channels[r];return s?(s.ccMIDROW(n),this.logger.log(3,()=>"MIDROW ("+sC([e,n])+")"),!0):!1}return!1}parsePAC(e,n){let r;const s=(e>=17&&e<=23||e>=25&&e<=31)&&n>=64&&n<=127,i=(e===16||e===24)&&n>=64&&n<=95;if(!(s||i))return!1;const o=e<=23?1:2;n>=64&&n<=95?r=o===1?ZWn[e]:XWn[e]:r=o===1?JWn[e]:eqn[e];const l=this.channels[o];return l?(l.setPAC(this.interpretPAC(r,n)),this.currentChannel=o,!0):!1}interpretPAC(e,n){let r;const s={color:null,italics:!1,indent:null,underline:!1,row:e};return n>95?r=n-96:r=n-64,s.underline=(r&1)===1,r<=13?s.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(s.italics=!0,s.color="white"):s.indent=Math.floor((r-16)/2)*4,s}parseChars(e,n){let r,s=null,i=null;if(e>=25?(r=2,i=e-8):(r=1,i=e),i>=17&&i<=19){let o;i===17?o=n+80:i===18?o=n+112:o=n+144,this.logger.log(2,()=>"Special char '"+xwt(o)+"' in channel "+r),s=[o]}else e>=32&&e<=127&&(s=n===0?[e]:[e,n]);return s&&this.logger.log(3,()=>"Char codes =  "+sC(s).join(",")),s}parseBackgroundAttributes(e,n){const r=(e===16||e===24)&&n>=32&&n<=47,s=(e===23||e===31)&&n>=45&&n<=47;if(!(r||s))return!1;let i;const o={};e===16||e===24?(i=Math.floor((n-32)/2),o.background=tqn[i],n%2===1&&(o.background=o.background+"_semi")):n===45?o.background="transparent":(o.foreground="black",n===47&&(o.underline=!0));const l=e<=23?1:2;return this.channels[l].setBkgData(o),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const n=this.channels[e];n&&n.reset()}nV(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let n=0;n<this.channels.length;n++){const r=this.channels[n];r&&r.cueSplitAtTime(e)}}};function nV(t,e,n){n.a=t,n.b=e}function iqn(t,e,n){return n.a===t&&n.b===e}function aqn(){return{a:null,b:null}}var ETe=function(){if(GQ!=null&&GQ.VTTCue)return self.VTTCue;const t=["","lr","rl"],e=["start","middle","end","left","right"];function n(l,c){if(typeof c!="string"||!Array.isArray(l))return!1;const d=c.toLowerCase();return~l.indexOf(d)?d:!1}function r(l){return n(t,l)}function s(l){return n(e,l)}function i(l,...c){let d=1;for(;d<arguments.length;d++){const u=arguments[d];for(const h in u)l[h]=u[h]}return l}function o(l,c,d){const u=this,h={enumerable:!0};u.hasBeenReset=!1;let m="",f=!1,p=l,g=c,v=d,b=null,x="",w=!0,k="auto",S="start",C=50,j="middle",E=50,N="middle";Object.defineProperty(u,"id",i({},h,{get:function(){return m},set:function(A){m=""+A}})),Object.defineProperty(u,"pauseOnExit",i({},h,{get:function(){return f},set:function(A){f=!!A}})),Object.defineProperty(u,"startTime",i({},h,{get:function(){return p},set:function(A){if(typeof A!="number")throw new TypeError("Start time must be set to a number.");p=A,this.hasBeenReset=!0}})),Object.defineProperty(u,"endTime",i({},h,{get:function(){return g},set:function(A){if(typeof A!="number")throw new TypeError("End time must be set to a number.");g=A,this.hasBeenReset=!0}})),Object.defineProperty(u,"text",i({},h,{get:function(){return v},set:function(A){v=""+A,this.hasBeenReset=!0}})),Object.defineProperty(u,"region",i({},h,{get:function(){return b},set:function(A){b=A,this.hasBeenReset=!0}})),Object.defineProperty(u,"vertical",i({},h,{get:function(){return x},set:function(A){const _=r(A);if(_===!1)throw new SyntaxError("An invalid or illegal string was specified.");x=_,this.hasBeenReset=!0}})),Object.defineProperty(u,"snapToLines",i({},h,{get:function(){return w},set:function(A){w=!!A,this.hasBeenReset=!0}})),Object.defineProperty(u,"line",i({},h,{get:function(){return k},set:function(A){if(typeof A!="number"&&A!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");k=A,this.hasBeenReset=!0}})),Object.defineProperty(u,"lineAlign",i({},h,{get:function(){return S},set:function(A){const _=s(A);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");S=_,this.hasBeenReset=!0}})),Object.defineProperty(u,"position",i({},h,{get:function(){return C},set:function(A){if(A<0||A>100)throw new Error("Position must be between 0 and 100.");C=A,this.hasBeenReset=!0}})),Object.defineProperty(u,"positionAlign",i({},h,{get:function(){return j},set:function(A){const _=s(A);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");j=_,this.hasBeenReset=!0}})),Object.defineProperty(u,"size",i({},h,{get:function(){return E},set:function(A){if(A<0||A>100)throw new Error("Size must be between 0 and 100.");E=A,this.hasBeenReset=!0}})),Object.defineProperty(u,"align",i({},h,{get:function(){return N},set:function(A){const _=s(A);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");N=_,this.hasBeenReset=!0}})),u.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();let oqn=class{decode(e,n){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}};function kwt(t){function e(r,s,i,o){return(r|0)*3600+(s|0)*60+(i|0)+parseFloat(o||0)}const n=t.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return n?parseFloat(n[2])>59?e(n[2],n[3],0,n[4]):e(n[1],n[2],n[3],n[4]):null}let lqn=class{constructor(){this.values=Object.create(null)}set(e,n){!this.get(e)&&n!==""&&(this.values[e]=n)}get(e,n,r){return r?this.has(e)?this.values[e]:n[r]:this.has(e)?this.values[e]:n}has(e){return e in this.values}alt(e,n,r){for(let s=0;s<r.length;++s)if(n===r[s]){this.set(e,n);break}}integer(e,n){/^-?\d+$/.test(n)&&this.set(e,parseInt(n,10))}percent(e,n){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(n)){const r=parseFloat(n);if(r>=0&&r<=100)return this.set(e,r),!0}return!1}};function Swt(t,e,n,r){const s=r?t.split(r):[t];for(const i in s){if(typeof s[i]!="string")continue;const o=s[i].split(n);if(o.length!==2)continue;const l=o[0],c=o[1];e(l,c)}}const Gbe=new ETe(0,0,""),rV=Gbe.align==="middle"?"middle":"center";function cqn(t,e,n){const r=t;function s(){const l=kwt(t);if(l===null)throw new Error("Malformed timestamp: "+r);return t=t.replace(/^[^\sa-zA-Z-]+/,""),l}function i(l,c){const d=new lqn;Swt(l,function(m,f){let p;switch(m){case"region":for(let g=n.length-1;g>=0;g--)if(n[g].id===f){d.set(m,n[g].region);break}break;case"vertical":d.alt(m,f,["rl","lr"]);break;case"line":p=f.split(","),d.integer(m,p[0]),d.percent(m,p[0])&&d.set("snapToLines",!1),d.alt(m,p[0],["auto"]),p.length===2&&d.alt("lineAlign",p[1],["start",rV,"end"]);break;case"position":p=f.split(","),d.percent(m,p[0]),p.length===2&&d.alt("positionAlign",p[1],["start",rV,"end","line-left","line-right","auto"]);break;case"size":d.percent(m,f);break;case"align":d.alt(m,f,["start",rV,"end","left","right"]);break}},/:/,/\s/),c.region=d.get("region",null),c.vertical=d.get("vertical","");let u=d.get("line","auto");u==="auto"&&Gbe.line===-1&&(u=-1),c.line=u,c.lineAlign=d.get("lineAlign","start"),c.snapToLines=d.get("snapToLines",!0),c.size=d.get("size",100),c.align=d.get("align",rV);let h=d.get("position","auto");h==="auto"&&Gbe.position===50&&(h=c.align==="start"||c.align==="left"?0:c.align==="end"||c.align==="right"?100:50),c.position=h}function o(){t=t.replace(/^\s+/,"")}if(o(),e.startTime=s(),o(),t.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+r);t=t.slice(3),o(),e.endTime=s(),o(),i(t,e)}function Cwt(t){return t.replace(/<br(?: \/)?>/gi,`
`)}let dqn=class{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new oqn,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const n=this;e&&(n.buffer+=n.decoder.decode(e,{stream:!0}));function r(){let i=n.buffer,o=0;for(i=Cwt(i);o<i.length&&i[o]!=="\r"&&i[o]!==`
`;)++o;const l=i.slice(0,o);return i[o]==="\r"&&++o,i[o]===`
`&&++o,n.buffer=i.slice(o),l}function s(i){Swt(i,function(o,l){},/:/)}try{let i="";if(n.state==="INITIAL"){if(!/\r\n|\n/.test(n.buffer))return this;i=r();const l=i.match(/^(ï»¿)?WEBVTT([ \t].*)?$/);if(!(l!=null&&l[0]))throw new Error("Malformed WebVTT signature.");n.state="HEADER"}let o=!1;for(;n.buffer;){if(!/\r\n|\n/.test(n.buffer))return this;switch(o?o=!1:i=r(),n.state){case"HEADER":/:/.test(i)?s(i):i||(n.state="ID");continue;case"NOTE":i||(n.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){n.state="NOTE";break}if(!i)continue;if(n.cue=new ETe(0,0,""),n.state="CUE",i.indexOf("-->")===-1){n.cue.id=i;continue}case"CUE":if(!n.cue){n.state="BADCUE";continue}try{cqn(i,n.cue,n.regionList)}catch{n.cue=null,n.state="BADCUE";continue}n.state="CUETEXT";continue;case"CUETEXT":{const l=i.indexOf("-->")!==-1;if(!i||l&&(o=!0)){n.oncue&&n.cue&&n.oncue(n.cue),n.cue=null,n.state="ID";continue}if(n.cue===null)continue;n.cue.text&&(n.cue.text+=`
`),n.cue.text+=i}continue;case"BADCUE":i||(n.state="ID")}}}catch{n.state==="CUETEXT"&&n.cue&&n.oncue&&n.oncue(n.cue),n.cue=null,n.state=n.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`

`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(n){e.onparsingerror&&e.onparsingerror(n)}return e.onflush&&e.onflush(),this}};const uqn=/\r\n|\n\r|\n|\r/g,Xce=function(e,n,r=0){return e.slice(r,r+n.length)===n},hqn=function(e){let n=parseInt(e.slice(-3));const r=parseInt(e.slice(-6,-4)),s=parseInt(e.slice(-9,-7)),i=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!$n(n)||!$n(r)||!$n(s)||!$n(i))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return n+=1e3*r,n+=60*1e3*s,n+=60*60*1e3*i,n};function NTe(t,e,n){return g$(t.toString())+g$(e.toString())+g$(n)}const mqn=function(e,n,r){let s=e[n],i=e[s.prevCC];if(!i||!i.new&&s.new){e.ccOffset=e.presentationOffset=s.start,s.new=!1;return}for(;(o=i)!=null&&o.new;){var o;e.ccOffset+=s.start-i.start,s.new=!1,s=i,i=e[s.prevCC]}e.presentationOffset=r};function fqn(t,e,n,r,s,i,o){const l=new dqn,c=km(new Uint8Array(t)).trim().replace(uqn,`
`).split(`
`),d=[],u=e?bGn(e.baseTime,e.timescale):0;let h="00:00.000",m=0,f=0,p,g=!0;l.oncue=function(v){const b=n[r];let x=n.ccOffset;const w=(m-u)/9e4;if(b!=null&&b.new&&(f!==void 0?x=n.ccOffset=b.start:mqn(n,r,w)),w){if(!e){p=new Error("Missing initPTS for VTT MPEGTS");return}x=w-n.presentationOffset}const k=v.endTime-v.startTime,S=Xh((v.startTime+x-f)*9e4,s*9e4)/9e4;v.startTime=Math.max(S,0),v.endTime=Math.max(S+k,0);const C=v.text.trim();v.text=decodeURIComponent(encodeURIComponent(C)),v.id||(v.id=NTe(v.startTime,v.endTime,C)),v.endTime>0&&d.push(v)},l.onparsingerror=function(v){p=v},l.onflush=function(){if(p){o(p);return}i(d)},c.forEach(v=>{if(g)if(Xce(v,"X-TIMESTAMP-MAP=")){g=!1,v.slice(16).split(",").forEach(b=>{Xce(b,"LOCAL:")?h=b.slice(6):Xce(b,"MPEGTS:")&&(m=parseInt(b.slice(7)))});try{f=hqn(h)/1e3}catch(b){p=b}return}else v===""&&(g=!1);l.parse(v+`
`)}),l.flush()}const ede="stpp.ttml.im1t",jwt=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,Ewt=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,pqn={left:"start",center:"center",right:"end",start:"start",end:"end"};function _9e(t,e,n,r){const s=Ds(new Uint8Array(t),["mdat"]);if(s.length===0){r(new Error("Could not parse IMSC1 mdat"));return}const i=s.map(l=>km(l)),o=yGn(e.baseTime,1,e.timescale);try{i.forEach(l=>n(gqn(l,o)))}catch(l){r(l)}}function gqn(t,e){const s=new DOMParser().parseFromString(t,"text/xml").getElementsByTagName("tt")[0];if(!s)throw new Error("Invalid ttml");const i={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:0},o=Object.keys(i).reduce((h,m)=>(h[m]=s.getAttribute(`ttp:${m}`)||i[m],h),{}),l=s.getAttribute("xml:space")!=="preserve",c=A9e(tde(s,"styling","style")),d=A9e(tde(s,"layout","region")),u=tde(s,"body","[begin]");return[].map.call(u,h=>{const m=Nwt(h,l);if(!m||!h.hasAttribute("begin"))return null;const f=rde(h.getAttribute("begin"),o),p=rde(h.getAttribute("dur"),o);let g=rde(h.getAttribute("end"),o);if(f===null)throw P9e(h);if(g===null){if(p===null)throw P9e(h);g=f+p}const v=new ETe(f-e,g-e,m);v.id=NTe(v.startTime,v.endTime,v.text);const b=d[h.getAttribute("region")],x=c[h.getAttribute("style")],w=vqn(b,x,c),{textAlign:k}=w;if(k){const S=pqn[k];S&&(v.lineAlign=S),v.align=k}return ra(v,w),v}).filter(h=>h!==null)}function tde(t,e,n){const r=t.getElementsByTagName(e)[0];return r?[].slice.call(r.querySelectorAll(n)):[]}function A9e(t){return t.reduce((e,n)=>{const r=n.getAttribute("xml:id");return r&&(e[r]=n),e},{})}function Nwt(t,e){return[].slice.call(t.childNodes).reduce((n,r,s)=>{var i;return r.nodeName==="br"&&s?n+`
`:(i=r.childNodes)!=null&&i.length?Nwt(r,e):e?n+r.textContent.trim().replace(/\s+/g," "):n+r.textContent},"")}function vqn(t,e,n){const r="http://www.w3.org/ns/ttml#styling";let s=null;const i=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=t!=null&&t.hasAttribute("style")?t.getAttribute("style"):null;return o&&n.hasOwnProperty(o)&&(s=n[o]),i.reduce((l,c)=>{const d=nde(e,r,c)||nde(t,r,c)||nde(s,r,c);return d&&(l[c]=d),l},{})}function nde(t,e,n){return t&&t.hasAttributeNS(e,n)?t.getAttributeNS(e,n):null}function P9e(t){return new Error(`Could not parse ttml timestamp ${t}`)}function rde(t,e){if(!t)return null;let n=kwt(t);return n===null&&(jwt.test(t)?n=yqn(t,e):Ewt.test(t)&&(n=bqn(t,e))),n}function yqn(t,e){const n=jwt.exec(t),r=(n[4]|0)+(n[5]|0)/e.subFrameRate;return(n[1]|0)*3600+(n[2]|0)*60+(n[3]|0)+r/e.frameRate}function bqn(t,e){const n=Ewt.exec(t),r=Number(n[1]);switch(n[2]){case"h":return r*3600;case"m":return r*60;case"ms":return r*1e3;case"f":return r/e.frameRate;case"t":return r/e.tickRate}return r}let sV=class{constructor(e,n){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=n}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,n,r){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=n,this.screen=r,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}},xqn=class{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.textTracks=[],this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=I9e(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(ue.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(ue.FRAG_LOADING,this.onFragLoading,this),e.on(ue.FRAG_LOADED,this.onFragLoaded,this),e.on(ue.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(ue.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(ue.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(ue.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(ue.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(ue.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(ue.FRAG_LOADING,this.onFragLoading,this),e.off(ue.FRAG_LOADED,this.onFragLoaded,this),e.off(ue.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(ue.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(ue.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(ue.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(ue.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new sV(this,"textTrack1"),n=new sV(this,"textTrack2"),r=new sV(this,"textTrack3"),s=new sV(this,"textTrack4");this.cea608Parser1=new T9e(1,e,n),this.cea608Parser2=new T9e(3,r,s)}addCues(e,n,r,s,i){let o=!1;for(let l=i.length;l--;){const c=i[l],d=wqn(c[0],c[1],n,r);if(d>=0&&(c[0]=Math.min(c[0],n),c[1]=Math.max(c[1],r),o=!0,d/(r-n)>.5))return}if(o||i.push([n,r]),this.config.renderTextTracksNatively){const l=this.captionsTracks[e];this.Cues.newCue(l,n,r,s)}else{const l=this.Cues.newCue(null,n,r,s);this.hls.trigger(ue.CUES_PARSED,{type:"captions",cues:l,track:e})}}onInitPtsFound(e,{frag:n,id:r,initPTS:s,timescale:i,trackId:o}){const{unparsedVttFrags:l}=this;r===Yn.MAIN&&(this.initPTS[n.cc]={baseTime:s,timescale:i,trackId:o}),l.length&&(this.unparsedVttFrags=[],l.forEach(c=>{this.initPTS[c.frag.cc]?this.onFragLoaded(ue.FRAG_LOADED,c):this.hls.trigger(ue.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:c.frag,error:new Error("Subtitle discontinuity domain does not match main")})}))}getExistingTrack(e,n){const{media:r}=this;if(r)for(let s=0;s<r.textTracks.length;s++){const i=r.textTracks[s];if(R9e(i,{name:e,lang:n,characteristics:"transcribes-spoken-dialog,describes-music-and-sound"}))return i}return null}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:n,captionsTracks:r,media:s}=this,{label:i,languageCode:o}=n[e],l=this.getExistingTrack(i,o);if(l)r[e]=l,pA(r[e]),vwt(r[e],s);else{const c=this.createTextTrack("captions",i,o);c&&(c[e]=!0,r[e]=c)}}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const n=this.captionsProperties[e];if(!n)return;const r=n.label,s={_id:e,label:r,kind:"captions",default:n.media?!!n.media.default:!1,closedCaptions:n.media};this.nonNativeCaptionsTracks[e]=s,this.hls.trigger(ue.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[s]})}createTextTrack(e,n,r){const s=this.media;if(s)return s.addTextTrack(e,n,r)}onMediaAttaching(e,n){this.media=n.media,n.mediaSource||this._cleanTracks()}onMediaDetaching(e,n){const r=!!n.transferMedia;if(this.media=null,r)return;const{captionsTracks:s}=this;Object.keys(s).forEach(i=>{pA(s[i]),delete s[i]}),this.nonNativeCaptionsTracks={}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=I9e(),this._cleanTracks(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.textTracks=[],this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}_cleanTracks(){const{media:e}=this;if(!e)return;const n=e.textTracks;if(n)for(let r=0;r<n.length;r++)pA(n[r])}onSubtitleTracksUpdated(e,n){const r=n.subtitleTracks||[],s=r.some(i=>i.textCodec===ede);if(this.config.enableWebVTT||s&&this.config.enableIMSC1){if(nwt(this.tracks,r)){this.tracks=r;return}if(this.textTracks=[],this.tracks=r,this.config.renderTextTracksNatively){const o=this.media,l=o?KW(o.textTracks):null;if(this.tracks.forEach((c,d)=>{let u;if(l){let h=null;for(let m=0;m<l.length;m++)if(l[m]&&R9e(l[m],c)){h=l[m],l[m]=null;break}h&&(u=h)}if(u)pA(u);else{const h=Twt(c);u=this.createTextTrack(h,c.name,c.lang),u&&(u.mode="disabled")}u&&this.textTracks.push(u)}),l!=null&&l.length){const c=l.filter(d=>d!==null).map(d=>d.label);c.length&&this.hls.logger.warn(`Media element contains unused subtitle tracks: ${c.join(", ")}. Replace media element for each source to clear TextTracks and captions menu.`)}}else if(this.tracks.length){const o=this.tracks.map(l=>({label:l.name,kind:l.type.toLowerCase(),default:l.default,subtitleTrack:l}));this.hls.trigger(ue.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:o})}}}onManifestLoaded(e,n){this.config.enableCEA708Captions&&n.captions&&n.captions.forEach(r=>{const s=/(?:CC|SERVICE)([1-4])/.exec(r.instreamId);if(!s)return;const i=`textTrack${s[1]}`,o=this.captionsProperties[i];o&&(o.label=r.name,r.lang&&(o.languageCode=r.lang),o.media=r)})}closedCaptionsForLevel(e){const n=this.hls.levels[e.level];return n==null?void 0:n.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,n){if(this.enabled&&n.frag.type===Yn.MAIN){var r,s;const{cea608Parser1:i,cea608Parser2:o,lastSn:l}=this,{cc:c,sn:d}=n.frag,u=(r=(s=n.part)==null?void 0:s.index)!=null?r:-1;i&&o&&(d!==l+1||d===l&&u!==this.lastPartIndex+1||c!==this.lastCc)&&(i.reset(),o.reset()),this.lastCc=c,this.lastSn=d,this.lastPartIndex=u}}onFragLoaded(e,n){const{frag:r,payload:s}=n;if(r.type===Yn.SUBTITLE)if(s.byteLength){const i=r.decryptdata,o="stats"in n;if(i==null||!i.encrypted||o){const l=this.tracks[r.level],c=this.vttCCs;c[r.cc]||(c[r.cc]={start:r.start,prevCC:this.prevCC,new:!0},this.prevCC=r.cc),l&&l.textCodec===ede?this._parseIMSC1(r,s):this._parseVTTs(n)}}else this.hls.trigger(ue.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:new Error("Empty subtitle payload")})}_parseIMSC1(e,n){const r=this.hls;_9e(n,this.initPTS[e.cc],s=>{this._appendCues(s,e.level),r.trigger(ue.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:e})},s=>{r.logger.log(`Failed to parse IMSC1: ${s}`),r.trigger(ue.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:e,error:s})})}_parseVTTs(e){var n;const{frag:r,payload:s}=e,{initPTS:i,unparsedVttFrags:o}=this,l=i.length-1;if(!i[r.cc]&&l===-1){o.push(e);return}const c=this.hls,d=(n=r.initSegment)!=null&&n.data?Gf(r.initSegment.data,new Uint8Array(s)).buffer:s;fqn(d,this.initPTS[r.cc],this.vttCCs,r.cc,r.start,u=>{this._appendCues(u,r.level),c.trigger(ue.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:r})},u=>{const h=u.message==="Missing initPTS for VTT MPEGTS";h?o.push(e):this._fallbackToIMSC1(r,s),c.logger.log(`Failed to parse VTT cue: ${u}`),!(h&&l>r.cc)&&c.trigger(ue.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,error:u})})}_fallbackToIMSC1(e,n){const r=this.tracks[e.level];r.textCodec||_9e(n,this.initPTS[e.cc],()=>{r.textCodec=ede,this._parseIMSC1(e,n)},()=>{r.textCodec="wvtt"})}_appendCues(e,n){const r=this.hls;if(this.config.renderTextTracksNatively){const s=this.textTracks[n];if(!s||s.mode==="disabled")return;e.forEach(i=>ywt(s,i))}else{const s=this.tracks[n];if(!s)return;const i=s.default?"default":"subtitles"+n;r.trigger(ue.CUES_PARSED,{type:"subtitles",cues:e,track:i})}}onFragDecrypted(e,n){const{frag:r}=n;r.type===Yn.SUBTITLE&&this.onFragLoaded(ue.FRAG_LOADED,n)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,n){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:r,samples:s}=n;if(!(r.type===Yn.MAIN&&this.closedCaptionsForLevel(r)==="NONE"))for(let i=0;i<s.length;i++){const o=s[i].bytes;if(o){this.cea608Parser1||this.initCea608Parsers();const l=this.extractCea608Data(o);this.cea608Parser1.addData(s[i].pts,l[0]),this.cea608Parser2.addData(s[i].pts,l[1])}}}onBufferFlushing(e,{startOffset:n,endOffset:r,endOffsetSubtitles:s,type:i}){const{media:o}=this;if(!(!o||o.currentTime<r)){if(!i||i==="video"){const{captionsTracks:l}=this;Object.keys(l).forEach(c=>Hbe(l[c],n,r))}if(this.config.renderTextTracksNatively&&n===0&&s!==void 0){const{textTracks:l}=this;Object.keys(l).forEach(c=>Hbe(l[c],n,s))}}}extractCea608Data(e){const n=[[],[]],r=e[0]&31;let s=2;for(let i=0;i<r;i++){const o=e[s++],l=127&e[s++],c=127&e[s++];if(l===0&&c===0)continue;if((4&o)!==0){const u=3&o;(u===0||u===1)&&(n[u].push(l),n[u].push(c))}}return n}};function Twt(t){return t.characteristics&&/transcribes-spoken-dialog/gi.test(t.characteristics)&&/describes-music-and-sound/gi.test(t.characteristics)?"captions":"subtitles"}function R9e(t,e){return!!t&&t.kind===Twt(e)&&Fbe(e,t)}function wqn(t,e,n,r){return Math.min(e,r)-Math.max(t,n)}function I9e(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const kqn=/\s/,Sqn={newCue(t,e,n,r){const s=[];let i,o,l,c,d;const u=self.VTTCue||self.TextTrackCue;for(let m=0;m<r.rows.length;m++)if(i=r.rows[m],l=!0,c=0,d="",!i.isEmpty()){var h;for(let g=0;g<i.chars.length;g++)kqn.test(i.chars[g].uchar)&&l?c++:(d+=i.chars[g].uchar,l=!1);i.cueStartTime=e,e===n&&(n+=1e-4),c>=16?c--:c++;const f=Cwt(d.trim()),p=NTe(e,n,f);t!=null&&(h=t.cues)!=null&&h.getCueById(p)||(o=new u(e,n,f),o.id=p,o.line=m+1,o.align="left",o.position=10+Math.min(80,Math.floor(c*8/32)*10),s.push(o))}return t&&s.length&&(s.sort((m,f)=>m.line==="auto"||f.line==="auto"?0:m.line>8&&f.line>8?f.line-m.line:m.line-f.line),s.forEach(m=>ywt(t,m))),s}};function Cqn(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const jqn=/(\d+)-(\d+)\/(\d+)/;let M9e=class{constructor(e){this.fetchSetup=void 0,this.requestTimeout=void 0,this.request=null,this.response=null,this.controller=void 0,this.context=null,this.config=null,this.callbacks=null,this.stats=void 0,this.loader=null,this.fetchSetup=e.fetchSetup||_qn,this.controller=new self.AbortController,this.stats=new aTe}destroy(){this.loader=this.callbacks=this.context=this.config=this.request=null,this.abortInternal(),this.response=null,this.fetchSetup=this.controller=this.stats=null}abortInternal(){this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.response)}load(e,n,r){const s=this.stats;if(s.loading.start)throw new Error("Loader can only be used once.");s.loading.start=self.performance.now();const i=Eqn(e,this.controller.signal),o=e.responseType==="arraybuffer",l=o?"byteLength":"length",{maxTimeToFirstByteMs:c,maxLoadTimeMs:d}=n.loadPolicy;this.context=e,this.config=n,this.callbacks=r,this.request=this.fetchSetup(e,i),self.clearTimeout(this.requestTimeout),n.timeout=c&&$n(c)?c:d,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(s,e,this.response))},n.timeout),(P6(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(h=>{var m;this.response=this.loader=h;const f=Math.max(self.performance.now(),s.loading.start);if(self.clearTimeout(this.requestTimeout),n.timeout=d,this.requestTimeout=self.setTimeout(()=>{this.callbacks&&(this.abortInternal(),this.callbacks.onTimeout(s,e,this.response))},d-(f-s.loading.start)),!h.ok){const{status:g,statusText:v}=h;throw new Aqn(v||"fetch, bad network response",g,h)}s.loading.first=f,s.total=Tqn(h.headers)||s.total;const p=(m=this.callbacks)==null?void 0:m.onProgress;return p&&$n(n.highWaterMark)?this.loadProgressively(h,s,e,n.highWaterMark,p):o?h.arrayBuffer():e.responseType==="json"?h.json():h.text()}).then(h=>{var m,f;const p=this.response;if(!p)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),s.loading.end=Math.max(self.performance.now(),s.loading.first);const g=h[l];g&&(s.loaded=s.total=g);const v={url:p.url,data:h,code:p.status},b=(m=this.callbacks)==null?void 0:m.onProgress;b&&!$n(n.highWaterMark)&&b(s,e,h,p),(f=this.callbacks)==null||f.onSuccess(v,s,e,p)}).catch(h=>{var m;if(self.clearTimeout(this.requestTimeout),s.aborted)return;const f=h&&h.code||0,p=h?h.message:null;(m=this.callbacks)==null||m.onError({code:f,text:p},e,h?h.details:null,s)})}getCacheAge(){let e=null;if(this.response){const n=this.response.headers.get("age");e=n?parseFloat(n):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,n,r,s=0,i){const o=new D0t,l=e.body.getReader(),c=()=>l.read().then(d=>{if(d.done)return o.dataLength&&i(n,r,o.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const u=d.value,h=u.length;return n.loaded+=h,h<s||o.dataLength?(o.push(u),o.dataLength>=s&&i(n,r,o.flush().buffer,e)):i(n,r,u.buffer,e),c()}).catch(()=>Promise.reject());return c()}};function Eqn(t,e){const n={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(ra({},t.headers))};return t.rangeEnd&&n.headers.set("Range","bytes="+t.rangeStart+"-"+String(t.rangeEnd-1)),n}function Nqn(t){const e=jqn.exec(t);if(e)return parseInt(e[2])-parseInt(e[1])+1}function Tqn(t){const e=t.get("Content-Range");if(e){const r=Nqn(e);if($n(r))return r}const n=t.get("Content-Length");if(n)return parseInt(n)}function _qn(t,e){return new self.Request(t.url,e)}let Aqn=class extends Error{constructor(e,n,r){super(e),this.code=void 0,this.details=void 0,this.code=n,this.details=r}};const Pqn=/^age:\s*[\d.]+\s*$/im;let _wt=class{constructor(e){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=null,this.loader=null,this.stats=void 0,this.xhrSetup=e&&e.xhrSetup||null,this.stats=new aTe,this.retryDelay=0}destroy(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null,this.context=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)}load(e,n,r){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=e,this.config=n,this.callbacks=r,this.loadInternal()}loadInternal(){const{config:e,context:n}=this;if(!e||!n)return;const r=this.loader=new self.XMLHttpRequest,s=this.stats;s.loading.first=0,s.loaded=0,s.aborted=!1;const i=this.xhrSetup;i?Promise.resolve().then(()=>{if(!(this.loader!==r||this.stats.aborted))return i(r,n.url)}).catch(o=>{if(!(this.loader!==r||this.stats.aborted))return r.open("GET",n.url,!0),i(r,n.url)}).then(()=>{this.loader!==r||this.stats.aborted||this.openAndSendXhr(r,n,e)}).catch(o=>{var l;(l=this.callbacks)==null||l.onError({code:r.status,text:o.message},n,r,s)}):this.openAndSendXhr(r,n,e)}openAndSendXhr(e,n,r){e.readyState||e.open("GET",n.url,!0);const s=n.headers,{maxTimeToFirstByteMs:i,maxLoadTimeMs:o}=r.loadPolicy;if(s)for(const l in s)e.setRequestHeader(l,s[l]);n.rangeEnd&&e.setRequestHeader("Range","bytes="+n.rangeStart+"-"+(n.rangeEnd-1)),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=n.responseType,self.clearTimeout(this.requestTimeout),r.timeout=i&&$n(i)?i:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout),e.send()}readystatechange(){const{context:e,loader:n,stats:r}=this;if(!e||!n)return;const s=n.readyState,i=this.config;if(!r.aborted&&s>=2&&(r.loading.first===0&&(r.loading.first=Math.max(self.performance.now(),r.loading.start),i.timeout!==i.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),i.timeout=i.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.loadPolicy.maxLoadTimeMs-(r.loading.first-r.loading.start)))),s===4)){self.clearTimeout(this.requestTimeout),n.onreadystatechange=null,n.onprogress=null;const d=n.status,u=n.responseType==="text"?n.responseText:null;if(d>=200&&d<300){const p=u??n.response;if(p!=null){var o,l;r.loading.end=Math.max(self.performance.now(),r.loading.first);const g=n.responseType==="arraybuffer"?p.byteLength:p.length;r.loaded=r.total=g,r.bwEstimate=r.total*8e3/(r.loading.end-r.loading.first);const v=(o=this.callbacks)==null?void 0:o.onProgress;v&&v(r,e,p,n);const b={url:n.responseURL,data:p,code:d};(l=this.callbacks)==null||l.onSuccess(b,r,e,n);return}}const h=i.loadPolicy.errorRetry,m=r.retry,f={url:e.url,data:void 0,code:d};if(VQ(h,m,!1,f))this.retry(h);else{var c;Ui.error(`${d} while loading ${e.url}`),(c=this.callbacks)==null||c.onError({code:d,text:n.statusText},e,n,r)}}}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,n=this.stats.retry;if(VQ(e,n,!0))this.retry(e);else{var r;Ui.warn(`timeout while loading ${(r=this.context)==null?void 0:r.url}`);const s=this.callbacks;s&&(this.abortInternal(),s.onTimeout(this.stats,this.context,this.loader))}}retry(e){const{context:n,stats:r}=this;this.retryDelay=dTe(e,r.retry),r.retry++,Ui.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${n==null?void 0:n.url}, retrying ${r.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay)}loadprogress(e){const n=this.stats;n.loaded=e.loaded,e.lengthComputable&&(n.total=e.total)}getCacheAge(){let e=null;if(this.loader&&Pqn.test(this.loader.getAllResponseHeaders())){const n=this.loader.getResponseHeader("age");e=n?parseFloat(n):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}};const Rqn={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Iqn=Bi(Bi({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!0,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,startOnSegmentBoundary:!1,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,ignorePlaylistParsingErrors:!1,loader:_wt,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,abrController:VVn,bufferController:MGn,capLevelController:DGn,errorController:KVn,fpsController:DWn,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:j0t,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,useMediaCapabilities:!0,preserveManualLevelOnError:!1,certLoadPolicy:{default:Rqn},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3},Mqn()),{},{subtitleStreamController:KWn,subtitleTrackController:FWn,timelineController:xqn,audioStreamController:AGn,audioTrackController:PGn,emeController:gwt,cmcdController:RWn,contentSteeringController:MWn,interstitialsController:qWn});function Mqn(){return{cueHandler:Sqn,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function Lqn(t,e,n){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');const r=Wbe(t),s=["manifest","level","frag"],i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return s.forEach(o=>{const l=`${o==="level"?"playlist":o}LoadPolicy`,c=e[l]===void 0,d=[];i.forEach(u=>{const h=`${o}Loading${u}`,m=e[h];if(m!==void 0&&c){d.push(h);const f=r[l].default;switch(e[l]={default:f},u){case"TimeOut":f.maxLoadTimeMs=m,f.maxTimeToFirstByteMs=m;break;case"MaxRetry":f.errorRetry.maxNumRetry=m,f.timeoutRetry.maxNumRetry=m;break;case"RetryDelay":f.errorRetry.retryDelayMs=m,f.timeoutRetry.retryDelayMs=m;break;case"MaxRetryTimeout":f.errorRetry.maxRetryDelayMs=m,f.timeoutRetry.maxRetryDelayMs=m;break}}}),d.length&&n.warn(`hls.js config: "${d.join('", "')}" setting(s) are deprecated, use "${l}": ${va(e[l])}`)}),Bi(Bi({},r),e)}function Wbe(t){return t&&typeof t=="object"?Array.isArray(t)?t.map(Wbe):Object.keys(t).reduce((e,n)=>(e[n]=Wbe(t[n]),e),{}):t}function Dqn(t,e){const n=t.loader;n!==M9e&&n!==_wt?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),t.progressive=!1):Cqn()&&(t.loader=M9e,t.progressive=!0,t.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}const YW=2,$qn=.1,Oqn=.05,Fqn=100;let Bqn=class extends b0t{constructor(e,n){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var r;(r=this.media)!=null&&r.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var r;this.ended=((r=this.media)==null?void 0:r.currentTime)||1,this.hls.trigger(ue.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=n,this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(ue.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(ue.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,n){this.setInterval(Fqn),this.mediaSource=n.mediaSource;const r=this.media=n.media;Tu(r,"playing",this.onMediaPlaying),Tu(r,"waiting",this.onMediaWaiting),Tu(r,"ended",this.onMediaEnded)}onMediaDetaching(e,n){this.clearInterval();const{media:r}=this;r&&(fh(r,"playing",this.onMediaPlaying),fh(r,"waiting",this.onMediaWaiting),fh(r,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,n){this.buffered=n.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const n=this.media.currentTime;this.poll(n,this.lastCurrentTime),this.lastCurrentTime=n}poll(e,n){var r,s;const i=(r=this.hls)==null?void 0:r.config;if(!i)return;const o=this.media;if(!o)return;const{seeking:l}=o,c=this.seeking&&!l,d=!this.seeking&&l,u=o.paused&&!l||o.ended||o.playbackRate===0;if(this.seeking=l,e!==n){n&&(this.ended=0),this.moved=!0,l||(this.nudgeRetry=0,i.nudgeOnVideoHole&&!u&&e>n&&this.nudgeOnVideoHole(e,n)),this.waiting===0&&this.stallResolved(e);return}if(d||c){c&&this.stallResolved(e);return}if(u){this.nudgeRetry=0,this.stallResolved(e),!this.ended&&o.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(ue.MEDIA_ENDED,{stalled:!1}));return}if(!$s.getBuffered(o).length){this.nudgeRetry=0;return}const h=$s.bufferInfo(o,e,0),m=h.nextStart||0,f=this.fragmentTracker;if(l&&f&&this.hls){const C=L9e(this.hls.inFlightFragments,e),j=h.len>YW,E=!m||C||m-e>YW&&!f.getPartialFragment(e);if(j||E)return;this.moved=!1}const p=(s=this.hls)==null?void 0:s.latestLevelDetails;if(!this.moved&&this.stalled!==null&&f){if(!(h.len>0)&&!m)return;const j=Math.max(m,h.start||0)-e,N=!!(p!=null&&p.live)?p.targetduration*2:YW,A=iV(e,f);if(j>0&&(j<=N||A)){o.paused||this._trySkipBufferHole(A);return}}const g=i.detectStallWithCurrentTimeMs,v=self.performance.now(),b=this.waiting;let x=this.stalled;if(x===null)if(b>0&&v-b<g)x=this.stalled=b;else{this.stalled=v;return}const w=v-x;if(!l&&(w>=g||b)&&this.hls){var k;if(((k=this.mediaSource)==null?void 0:k.readyState)==="ended"&&!(p!=null&&p.live)&&Math.abs(e-((p==null?void 0:p.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(ue.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(h),!this.media||!this.hls)return}const S=$s.bufferInfo(o,e,i.maxBufferHole);this._tryFixBufferStall(S,w,e)}stallResolved(e){const n=this.stalled;if(n&&this.hls&&(this.stalled=null,this.stallReported)){const r=self.performance.now()-n;this.log(`playback not stuck anymore @${e}, after ${Math.round(r)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(ue.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,n){var r;const s=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(r=this.buffered.audio)!=null&&r.length&&s&&s.length>1&&e>s.end(0)){const i=$s.bufferedInfo($s.timeRangesToArray(this.buffered.audio),e,0);if(i.len>1&&n>=i.start){const o=$s.timeRangesToArray(s),l=$s.bufferedInfo(o,n,0).bufferedIndex;if(l>-1&&l<o.length-1){const c=$s.bufferedInfo(o,e,0).bufferedIndex,d=o[l].end,u=o[l+1].start;if((c===-1||c>l)&&u-d<1&&e-d<2){const h=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${d} -> ${u} buffered index: ${c}`);this.warn(h.message),this.media.currentTime+=1e-6;let m=iV(e,this.fragmentTracker);m&&"fragment"in m?m=m.fragment:m||(m=void 0);const f=$s.bufferInfo(this.media,e,0);this.hls.trigger(ue.ERROR,{type:ur.MEDIA_ERROR,details:dt.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:h,reason:h.message,frag:m,buffer:f.len,bufferInfo:f})}}}}}_tryFixBufferStall(e,n,r){var s,i;const{fragmentTracker:o,media:l}=this,c=(s=this.hls)==null?void 0:s.config;if(!l||!o||!c)return;const d=(i=this.hls)==null?void 0:i.latestLevelDetails,u=iV(r,o);if((u||d!=null&&d.live&&r<d.fragmentStart)&&(this._trySkipBufferHole(u)||!this.media))return;const h=e.buffered,m=this.adjacentTraversal(e,r);(h&&h.length>1&&e.len>c.maxBufferHole||e.nextStart&&(e.nextStart-r<c.maxBufferHole||m))&&(n>c.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,n){const r=this.fragmentTracker,s=e.nextStart;if(r&&s){const i=r.getFragAtPos(n,Yn.MAIN),o=r.getFragAtPos(s,Yn.MAIN);if(i&&o)return o.sn-i.sn<2}return!1}_reportStall(e){const{hls:n,media:r,stallReported:s,stalled:i}=this;if(!s&&i!==null&&r&&n){this.stallReported=!0;const o=new Error(`Playback stalling at @${r.currentTime} due to low buffer (${va(e)})`);this.warn(o.message),n.trigger(ue.ERROR,{type:ur.MEDIA_ERROR,details:dt.BUFFER_STALLED_ERROR,fatal:!1,error:o,buffer:e.len,bufferInfo:e,stalled:{start:i}})}}_trySkipBufferHole(e){var n;const{fragmentTracker:r,media:s}=this,i=(n=this.hls)==null?void 0:n.config;if(!s||!r||!i)return 0;const o=s.currentTime,l=$s.bufferInfo(s,o,0),c=o<l.start?l.start:l.nextStart;if(c&&this.hls){const u=l.len<=i.maxBufferHole,h=l.len>0&&l.len<1&&s.readyState<3,m=c-o;if(m>0&&(u||h)){if(m>i.maxBufferHole){let p=!1;if(o===0){const g=r.getAppendedFrag(0,Yn.MAIN);g&&c<g.end&&(p=!0)}if(!p&&e){var d;if(!((d=this.hls.loadLevelObj)!=null&&d.details)||L9e(this.hls.inFlightFragments,c))return 0;let v=!1,b=e.end;for(;b<c;){const x=iV(b,r);if(x)b+=x.duration;else{v=!0;break}}if(v)return 0}}const f=Math.max(c+Oqn,o+$qn);if(this.warn(`skipping hole, adjusting currentTime from ${o} to ${f}`),this.moved=!0,s.currentTime=f,!(e!=null&&e.gap)){const p=new Error(`fragment loaded with buffer holes, seeking from ${o} to ${f}`),g={type:ur.MEDIA_ERROR,details:dt.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:p,reason:p.message,buffer:l.len,bufferInfo:l};e&&("fragment"in e?g.part=e:g.frag=e),this.hls.trigger(ue.ERROR,g)}return f}}return 0}_tryNudgeBuffer(e){const{hls:n,media:r,nudgeRetry:s}=this,i=n==null?void 0:n.config;if(!r||!i)return 0;const o=r.currentTime;if(this.nudgeRetry++,s<i.nudgeMaxRetry){const l=o+(s+1)*i.nudgeOffset,c=new Error(`Nudging 'currentTime' from ${o} to ${l}`);this.warn(c.message),r.currentTime=l,n.trigger(ue.ERROR,{type:ur.MEDIA_ERROR,details:dt.BUFFER_NUDGE_ON_STALL,error:c,fatal:!1,buffer:e.len,bufferInfo:e})}else{const l=new Error(`Playhead still not moving while enough data buffered @${o} after ${i.nudgeMaxRetry} nudges`);this.error(l.message),n.trigger(ue.ERROR,{type:ur.MEDIA_ERROR,details:dt.BUFFER_STALLED_ERROR,error:l,fatal:!0,buffer:e.len,bufferInfo:e})}}};function L9e(t,e){const n=D9e(t.main);if(n&&n.start<=e)return n;const r=D9e(t.audio);return r&&r.start<=e?r:null}function D9e(t){if(!t)return null;switch(t.state){case Mt.IDLE:case Mt.STOPPED:case Mt.ENDED:case Mt.ERROR:return null}return t.frag}function iV(t,e){return e.getAppendedFrag(t,Yn.MAIN)||e.getPartialFragment(t)}const Uqn=.25;function qbe(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function sde(t,e,n,r,s){let i=new t(e,n,"");try{i.value=r,s&&(i.type=s)}catch{i=new t(e,n,va(s?Bi({type:s},r):r))}return i}const aV=(()=>{const t=qbe();try{t&&new t(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();let zqn=class{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(ue.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(ue.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(ue.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(ue.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(ue.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(ue.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(ue.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(ue.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,n){var r;this.media=n.media,((r=n.overrides)==null?void 0:r.cueRemoval)===!1&&(this.removeCues=!1)}onMediaAttached(){var e;const n=(e=this.hls)==null?void 0:e.latestLevelDetails;n&&this.updateDateRangeCues(n)}onMediaDetaching(e,n){this.media=null,!n.transferMedia&&(this.id3Track&&(this.removeCues&&pA(this.id3Track,this.onEventCueEnter),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){const n=this.getID3Track(e.textTracks);return n.mode="hidden",n}getID3Track(e){if(this.media){for(let n=0;n<e.length;n++){const r=e[n];if(r.kind==="metadata"&&r.label==="id3")return vwt(r,this.media),r}return this.media.addTextTrack("metadata","id3")}}onFragParsingMetadata(e,n){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:r,enableID3MetadataCues:s}=this.hls.config;if(!r&&!s)return;const{samples:i}=n;this.id3Track||(this.id3Track=this.createTrack(this.media));const o=qbe();if(o)for(let l=0;l<i.length;l++){const c=i[l].type;if(c===lm.emsg&&!r||!s)continue;const d=V0t(i[l].data),u=i[l].pts;let h=u+i[l].duration;h>aV&&(h=aV),h-u<=0&&(h=u+Uqn);for(let f=0;f<d.length;f++){const p=d[f];if(!H0t(p)){this.updateId3CueEnds(u,c);const g=sde(o,u,h,p,c);g&&this.id3Track.addCue(g)}}}}updateId3CueEnds(e,n){var r;const s=(r=this.id3Track)==null?void 0:r.cues;if(s)for(let i=s.length;i--;){const o=s[i];o.type===n&&o.startTime<e&&o.endTime===aV&&(o.endTime=e)}}onBufferFlushing(e,{startOffset:n,endOffset:r,type:s}){const{id3Track:i,hls:o}=this;if(!o)return;const{config:{enableEmsgMetadataCues:l,enableID3MetadataCues:c}}=o;if(i&&(l||c)){let d;s==="audio"?d=u=>u.type===lm.audioId3&&c:s==="video"?d=u=>u.type===lm.emsg&&l:d=u=>u.type===lm.audioId3&&c||u.type===lm.emsg&&l,Hbe(i,n,r,d)}}onLevelUpdated(e,{details:n}){this.updateDateRangeCues(n,!0)}onLevelPtsUpdated(e,n){Math.abs(n.drift)>.01&&this.updateDateRangeCues(n.details)}updateDateRangeCues(e,n){if(!this.hls||!this.media)return;const{assetPlayerId:r,timelineOffset:s,enableDateRangeMetadataCues:i,interstitialsController:o}=this.hls.config;if(!i)return;const l=qbe();if(r&&s&&!o){const{fragmentStart:g,fragmentEnd:v}=e;let b=this.assetCue;b?(b.startTime=g,b.endTime=v):l&&(b=this.assetCue=sde(l,g,v,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),b&&(b.id=r,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.addCue(b),b.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:c}=this,{dateRanges:d}=e,u=Object.keys(d);let h=this.dateRangeCuesAppended;if(c&&n){var m;if((m=c.cues)!=null&&m.length){const g=Object.keys(h).filter(v=>!u.includes(v));for(let v=g.length;v--;){var f;const b=g[v],x=(f=h[b])==null?void 0:f.cues;delete h[b],x&&Object.keys(x).forEach(w=>{const k=x[w];if(k){k.removeEventListener("enter",this.onEventCueEnter);try{c.removeCue(k)}catch{}}})}}else h=this.dateRangeCuesAppended={}}const p=e.fragments[e.fragments.length-1];if(!(u.length===0||!$n(p==null?void 0:p.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let g=0;g<u.length;g++){const v=u[g],b=d[v],x=b.startTime,w=h[v],k=(w==null?void 0:w.cues)||{};let S=(w==null?void 0:w.durationKnown)||!1,C=aV;const{duration:j,endDate:E}=b;if(E&&j!==null)C=x+j,S=!0;else if(b.endOnNext&&!S){const A=u.reduce((_,T)=>{if(T!==b.id){const R=d[T];if(R.class===b.class&&R.startDate>b.startDate&&(!_||b.startDate<_.startDate))return R}return _},null);A&&(C=A.startTime,S=!0)}const N=Object.keys(b.attr);for(let A=0;A<N.length;A++){const _=N[A];if(!oHn(_))continue;const T=k[_];if(T)S&&!(w!=null&&w.durationKnown)?T.endTime=C:Math.abs(T.startTime-x)>.01&&(T.startTime=x,T.endTime=C);else if(l){let R=b.attr[_];lHn(_)&&(R=Xxt(R));const F=sde(l,x,C,{key:_,data:R},lm.dateRange);F&&(F.id=v,this.id3Track.addCue(F),k[_]=F,o&&(_==="X-ASSET-LIST"||_==="X-ASSET-URL")&&F.addEventListener("enter",this.onEventCueEnter))}}h[v]={cues:k,dateRange:b,durationKnown:S}}}}},Vqn=class{constructor(e){this.hls=void 0,this.config=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{const{media:n}=this,r=this.levelDetails;if(!n||!r)return;this.currentTime=n.currentTime;const s=this.computeLatency();if(s===null)return;this._latency=s;const{lowLatencyMode:i,maxLiveSyncPlaybackRate:o}=this.config;if(!i||o===1||!r.live)return;const l=this.targetLatency;if(l===null)return;const c=s-l,d=Math.min(this.maxLatency,l+r.targetduration);if(c<d&&c>.05&&this.forwardBufferLength>1){const h=Math.min(2,Math.max(1,o)),m=Math.round(2/(1+Math.exp(-.75*c-this.edgeStalled))*20)/20,f=Math.min(h,Math.max(1,m));this.changeMediaPlaybackRate(n,f)}else n.playbackRate!==1&&n.playbackRate!==0&&this.changeMediaPlaybackRate(n,1)},this.hls=e,this.config=e.config,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){const{config:e}=this;if(e.liveMaxLatencyDuration!==void 0)return e.liveMaxLatencyDuration;const n=this.levelDetails;return n?e.liveMaxLatencyDurationCount*n.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||this.hls===null)return null;const{holdBack:n,partHoldBack:r,targetduration:s}=e,{liveSyncDuration:i,liveSyncDurationCount:o,lowLatencyMode:l}=this.config,c=this.hls.userConfig;let d=l&&r||n;(this._targetLatencyUpdated||c.liveSyncDuration||c.liveSyncDurationCount||d===0)&&(d=i!==void 0?i:o*s);const u=s;return d+Math.min(this.stallCount*this.config.liveSyncOnStallIncrease,u)}set targetLatency(e){this.stallCount=0,this.config.liveSyncDuration=e,this._targetLatencyUpdated=!0}get liveSyncPosition(){const e=this.estimateLiveEdge(),n=this.targetLatency;if(e===null||n===null)return null;const r=this.levelDetails;if(r===null)return null;const s=r.edge,i=e-n-this.edgeStalled,o=s-r.totalduration,l=s-(this.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(o,i),l)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null)return 0;const n=(this.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-n,0)}get forwardBufferLength(){const{media:e}=this,n=this.levelDetails;if(!e||!n)return 0;const r=e.buffered.length;return(r?e.buffered.end(r-1):n.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(ue.ERROR,this.onError,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(ue.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(ue.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(ue.ERROR,this.onError,this))}onMediaAttached(e,n){this.media=n.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:n}){n.advanced&&this.onTimeupdate(),!n.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onError(e,n){var r;n.details===dt.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(r=this.levelDetails)!=null&&r.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,n){var r,s;e.playbackRate!==n&&((r=this.hls)==null||r.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(s=this.targetLatency)==null?void 0:s.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${n}`),e.playbackRate=n)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}},Hqn=class extends STe{constructor(e,n){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.onParsedComplete=void 0,this.steering=n,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(ue.LEVEL_LOADED,this.onLevelLoaded,this),e.on(ue.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(ue.FRAG_BUFFERED,this.onFragBuffered,this),e.on(ue.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(ue.LEVEL_LOADED,this.onLevelLoaded,this),e.off(ue.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(ue.FRAG_BUFFERED,this.onFragBuffered,this),e.off(ue.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(n=>{n.loadError=0,n.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1}onManifestLoading(e,n){this.resetLevels()}onManifestLoaded(e,n){const r=this.hls.config.preferManagedMediaSource,s=[],i={},o={};let l=!1,c=!1,d=!1;n.levels.forEach(u=>{const h=u.attrs;let{audioCodec:m,videoCodec:f}=u;m&&(u.audioCodec=m=FQ(m,r)||void 0),f&&(f=u.videoCodec=CVn(f));const{width:p,height:g,unknownCodecs:v}=u,b=(v==null?void 0:v.length)||0;if(l||(l=!!(p&&g)),c||(c=!!f),d||(d=!!m),b||m&&!this.isAudioSupported(m)||f&&!this.isVideoSupported(f)){this.log(`Some or all CODECS not supported "${h.CODECS}"`);return}const{CODECS:x,"FRAME-RATE":w,"HDCP-LEVEL":k,"PATHWAY-ID":S,RESOLUTION:C,"VIDEO-RANGE":j}=h,N=`${`${S||"."}-`}${u.bitrate}-${C}-${w}-${x}-${j}-${k}`;if(i[N])if(i[N].uri!==u.url&&!u.attrs["PATHWAY-ID"]){const A=o[N]+=1;u.attrs["PATHWAY-ID"]=new Array(A+1).join(".");const _=this.createLevel(u);i[N]=_,s.push(_)}else i[N].addGroupId("audio",h.AUDIO),i[N].addGroupId("text",h.SUBTITLES);else{const A=this.createLevel(u);i[N]=A,o[N]=1,s.push(A)}}),this.filterAndSortMediaOptions(s,n,l,c,d)}createLevel(e){const n=new T6(e),r=e.supplemental;if(r!=null&&r.videoCodec&&!this.isVideoSupported(r.videoCodec)){const s=new Error(`SUPPLEMENTAL-CODECS not supported "${r.videoCodec}"`);this.log(s.message),n.supportedResult=u0t(s,[])}return n}isAudioSupported(e){return E6(e,"audio",this.hls.config.preferManagedMediaSource)}isVideoSupported(e){return E6(e,"video",this.hls.config.preferManagedMediaSource)}filterAndSortMediaOptions(e,n,r,s,i){var o;let l=[],c=[],d=e;const u=((o=n.stats)==null?void 0:o.parsing)||{};if((r||s)&&i&&(d=d.filter(({videoCodec:x,videoRange:w,width:k,height:S})=>(!!x||!!(k&&S))&&MVn(w))),d.length===0){Promise.resolve().then(()=>{if(this.hls){let x="no level with compatible codecs found in manifest",w=x;n.levels.length&&(w=`one or more CODECS in variant not supported: ${va(n.levels.map(S=>S.attrs.CODECS).filter((S,C,j)=>j.indexOf(S)===C))}`,this.warn(w),x+=` (${w})`);const k=new Error(x);this.hls.trigger(ue.ERROR,{type:ur.MEDIA_ERROR,details:dt.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:n.url,error:k,reason:w})}}),u.end=performance.now();return}n.audioTracks&&(l=n.audioTracks.filter(x=>!x.audioCodec||this.isAudioSupported(x.audioCodec)),$9e(l)),n.subtitles&&(c=n.subtitles,$9e(c));const h=d.slice(0);d.sort((x,w)=>{if(x.attrs["HDCP-LEVEL"]!==w.attrs["HDCP-LEVEL"])return(x.attrs["HDCP-LEVEL"]||"")>(w.attrs["HDCP-LEVEL"]||"")?1:-1;if(r&&x.height!==w.height)return x.height-w.height;if(x.frameRate!==w.frameRate)return x.frameRate-w.frameRate;if(x.videoRange!==w.videoRange)return BQ.indexOf(x.videoRange)-BQ.indexOf(w.videoRange);if(x.videoCodec!==w.videoCodec){const k=TBe(x.videoCodec),S=TBe(w.videoCodec);if(k!==S)return S-k}if(x.uri===w.uri&&x.codecSet!==w.codecSet){const k=OQ(x.codecSet),S=OQ(w.codecSet);if(k!==S)return S-k}return x.averageBitrate!==w.averageBitrate?x.averageBitrate-w.averageBitrate:0});let m=h[0];if(this.steering&&(d=this.steering.filterParsedLevels(d),d.length!==h.length)){for(let x=0;x<h.length;x++)if(h[x].pathwayId===d[0].pathwayId){m=h[x];break}}this._levels=d;for(let x=0;x<d.length;x++)if(d[x]===m){var f;this._firstLevel=x;const w=m.bitrate,k=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${d.length} level(s) found, first bitrate: ${w}`),((f=this.hls.userConfig)==null?void 0:f.abrEwmaDefaultEstimate)===void 0){const S=Math.min(w,this.hls.config.abrEwmaDefaultEstimateMax);S>k&&k===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=S)}break}const p=i&&!s,g=this.hls.config,v=!!(g.audioStreamController&&g.audioTrackController),b={levels:d,audioTracks:l,subtitleTracks:c,sessionData:n.sessionData,sessionKeys:n.sessionKeys,firstLevel:this._firstLevel,stats:n.stats,audio:i,video:s,altAudio:v&&!p&&l.some(x=>!!x.url)};u.end=performance.now(),this.hls.trigger(ue.MANIFEST_PARSED,b)}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const n=this._levels;if(n.length===0)return;if(e<0||e>=n.length){const u=new Error("invalid level idx"),h=e<0;if(this.hls.trigger(ue.ERROR,{type:ur.OTHER_ERROR,details:dt.LEVEL_SWITCH_ERROR,level:e,fatal:h,error:u,reason:u.message}),h)return;e=Math.min(e,n.length-1)}const r=this.currentLevelIndex,s=this.currentLevel,i=s?s.attrs["PATHWAY-ID"]:void 0,o=n[e],l=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,r===e&&s&&i===l)return;this.log(`Switching to level ${e} (${o.height?o.height+"p ":""}${o.videoRange?o.videoRange+" ":""}${o.codecSet?o.codecSet+" ":""}@${o.bitrate})${l?" with Pathway "+l:""} from level ${r}${i?" with Pathway "+i:""}`);const c={level:e,attrs:o.attrs,details:o.details,bitrate:o.bitrate,averageBitrate:o.averageBitrate,maxBitrate:o.maxBitrate,realBitrate:o.realBitrate,width:o.width,height:o.height,codecSet:o.codecSet,audioCodec:o.audioCodec,videoCodec:o.videoCodec,audioGroups:o.audioGroups,subtitleGroups:o.subtitleGroups,loaded:o.loaded,loadError:o.loadError,fragmentError:o.fragmentError,name:o.name,id:o.id,uri:o.uri,url:o.url,urlId:0,audioGroupIds:o.audioGroupIds,textGroupIds:o.textGroupIds};this.hls.trigger(ue.LEVEL_SWITCHING,c);const d=o.details;if(!d||d.live){const u=this.switchParams(o.uri,s==null?void 0:s.details,d);this.loadPlaylist(u)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const n=this.steering.pathways(),r=e.filter(s=>n.indexOf(s)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${n}`);return}this.steering.pathwayPriority=r}}onError(e,n){n.fatal||!n.context||n.context.type===Us.LEVEL&&n.context.level===this.level&&this.checkRetry(n)}onFragBuffered(e,{frag:n}){if(n!==void 0&&n.type===Yn.MAIN){const r=n.elementaryStreams;if(!Object.keys(r).some(i=>!!r[i]))return;const s=this._levels[n.level];s!=null&&s.loadError&&(this.log(`Resetting level error count of ${s.loadError} on frag buffered`),s.loadError=0)}}onLevelLoaded(e,n){var r;const{level:s,details:i}=n,o=n.levelInfo;if(!o){var l;this.warn(`Invalid level index ${s}`),(l=n.deliveryDirectives)!=null&&l.skip&&(i.deltaUpdateFailed=!0);return}if(o===this.currentLevel||n.withoutMultiVariant){o.fragmentError===0&&(o.loadError=0);let c=o.details;c===n.details&&c.advanced&&(c=void 0),this.playlistLoaded(s,n,c)}else(r=n.deliveryDirectives)!=null&&r.skip&&(i.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,n){super.loadingPlaylist(e,n);const r=this.getUrlWithDirectives(e.uri,n),s=this.currentLevelIndex,i=e.attrs["PATHWAY-ID"],o=e.details,l=o==null?void 0:o.age;this.log(`Loading level index ${s}${(n==null?void 0:n.msn)!==void 0?" at sn "+n.msn+" part "+n.part:""}${i?" Pathway "+i:""}${l&&o.live?" age "+l.toFixed(1)+(o.type&&" "+o.type||""):""} ${r}`),this.hls.trigger(ue.LEVEL_LOADING,{url:r,level:s,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:n||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var n;if(this._levels.length===1)return;const r=this._levels.filter((i,o)=>o!==e?!0:(this.steering&&this.steering.removeLevel(i),i===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,i.details&&i.details.fragments.forEach(l=>l.level=-1)),!1));I0t(r),this._levels=r,this.currentLevelIndex>-1&&(n=this.currentLevel)!=null&&n.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const s=r.length-1;this._firstLevel=Math.min(this._firstLevel,s),this._startLevel&&(this._startLevel=Math.min(this._startLevel,s)),this.hls.trigger(ue.LEVELS_UPDATED,{levels:r})}onLevelsUpdated(e,{levels:n}){this._levels=n}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:n,maxHdcpLevel:r}=this.hls;this._maxAutoLevel!==n&&(this._maxAutoLevel=n,this.hls.trigger(ue.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:n,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:r}))}};function $9e(t){const e={};t.forEach(n=>{const r=n.groupId||"";n.id=e[r]=e[r]||0,e[r]++})}function Awt(){return self.SourceBuffer||self.WebKitSourceBuffer}function Pwt(){if(!Ok())return!1;const e=Awt();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function Gqn(){if(!Pwt())return!1;const t=Ok();return typeof(t==null?void 0:t.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>t.isTypeSupported(N6(e,"video")))||["mp4a.40.2","fLaC"].some(e=>t.isTypeSupported(N6(e,"audio"))))}function Wqn(){var t;const e=Awt();return typeof(e==null||(t=e.prototype)==null?void 0:t.changeType)=="function"}const qqn=100;let Kqn=class extends pTe{constructor(e,n,r){super(e,n,r,"stream-controller",Yn.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=0,this.audioOnly=!1,this.fragPlaying=null,this.fragLastKbps=0,this.couldBacktrack=!1,this.backtrackFragment=null,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const s=this.media,i=s?s.currentTime:null;if(i===null||!$n(i)||(this.log(`Media seeked to ${i.toFixed(3)}`),!this.getBufferedFrag(i)))return;const o=this.getFwdBufferInfoAtPos(s,i,Yn.MAIN,0);if(o===null||o.len===0){this.warn(`Main forward buffer length at ${i} on "seeked" event ${o?o.len:"empty"})`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.on(ue.LEVEL_LOADING,this.onLevelLoading,this),e.on(ue.LEVEL_LOADED,this.onLevelLoaded,this),e.on(ue.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(ue.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(ue.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(ue.BUFFER_CREATED,this.onBufferCreated,this),e.on(ue.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(ue.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(ue.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(ue.MANIFEST_PARSED,this.onManifestParsed,this),e.off(ue.LEVEL_LOADED,this.onLevelLoaded,this),e.off(ue.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(ue.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(ue.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(ue.BUFFER_CREATED,this.onBufferCreated,this),e.off(ue.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(ue.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(ue.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,n){if(this.levels){const{lastCurrentTime:r,hls:s}=this;if(this.stopLoad(),this.setInterval(qqn),this.level=-1,!this.startFragRequested){let i=s.startLevel;i===-1&&(s.config.testBandwidth&&this.levels.length>1?(i=0,this.bitrateTest=!0):i=s.firstAutoLevel),s.nextLoadLevel=i,this.level=s.loadLevel,this._hasEnoughToStart=!!n}r>0&&e===-1&&!n&&(this.log(`Override startPosition with lastCurrentTime @${r.toFixed(3)}`),e=r),this.state=Mt.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=n?-1:e,this.tick()}else this._forceStartLoad=!0,this.state=Mt.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Mt.WAITING_LEVEL:{const{levels:e,level:n}=this,r=e==null?void 0:e[n],s=r==null?void 0:r.details;if(s&&(!s.live||this.levelLastLoaded===r&&!this.waitForLive(r))){if(this.waitForCdnTuneIn(s))break;this.state=Mt.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=Mt.IDLE;break}break}case Mt.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===Mt.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:n,levels:r,media:s}=this;if(n===null||!s&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const i=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(r!=null&&r[i]))return;const o=r[i],l=this.getMainFwdBufferInfo();if(l===null)return;const c=this.getLevelDetails();if(c&&this._streamEnded(l,c)){const g={};this.altAudio===2&&(g.type="video"),this.hls.trigger(ue.BUFFER_EOS,g),this.state=Mt.ENDED;return}if(!this.buffering)return;e.loadLevel!==i&&e.manualLevel===-1&&this.log(`Adapting to level ${i} from level ${this.level}`),this.level=e.nextLoadLevel=i;const d=o.details;if(!d||this.state===Mt.WAITING_LEVEL||this.waitForLive(o)){this.level=i,this.state=Mt.WAITING_LEVEL,this.startFragRequested=!1;return}const u=l.len,h=this.getMaxBufferLength(o.maxBitrate);if(u>=h)return;this.backtrackFragment&&this.backtrackFragment.start>l.end&&(this.backtrackFragment=null);const m=this.backtrackFragment?this.backtrackFragment.start:l.end;let f=this.getNextFragment(m,d);if(this.couldBacktrack&&!this.fragPrevious&&f&&xl(f)&&this.fragmentTracker.getState(f)!==hc.OK){var p;const v=((p=this.backtrackFragment)!=null?p:f).sn-d.startSN,b=d.fragments[v-1];b&&f.cc===b.cc&&(f=b,this.fragmentTracker.removeFragment(b))}else this.backtrackFragment&&l.len&&(this.backtrackFragment=null);if(f&&this.isLoopLoading(f,m)){if(!f.gap){const v=this.audioOnly&&!this.altAudio?pa.AUDIO:pa.VIDEO,b=(v===pa.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;b&&this.afterBufferFlushed(b,v,Yn.MAIN)}f=this.getNextFragmentLoopLoading(f,d,l,Yn.MAIN,h)}f&&(this.exceedsMaxBuffer(l,h,f)||(f.initSegment&&!f.initSegment.data&&!this.bitrateTest&&(f=f.initSegment),this.loadFragment(f,o,m)))}loadFragment(e,n,r){const s=this.fragmentTracker.getState(e);s===hc.NOT_LOADED||s===hc.PARTIAL?xl(e)?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,n)):super.loadFragment(e,n,r):this._loadInitSegment(e,n):this.clearTrackerIfNeeded(e)}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,Yn.MAIN)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}immediateLevelSwitch(){if(this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY),this.altAudio!==0){var e;(((e=this.getLevelDetails())==null?void 0:e.fragmentStart)||0)>this.lastCurrentTime&&super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio")}}nextLevelSwitch(){const{levels:e,media:n}=this;if(n!=null&&n.readyState){let r;const s=this.getAppendedFrag(n.currentTime);s&&s.start>1&&this.flushMainBuffer(0,s.start-1);const i=this.getLevelDetails();if(i!=null&&i.live){const l=this.getMainFwdBufferInfo();if(!l||l.len<i.targetduration*2)return}if(!n.paused&&e){const l=this.hls.nextLoadLevel,c=e[l],d=this.fragLastKbps;d&&this.fragCurrent?r=this.fragCurrent.duration*c.maxBitrate/(1e3*d)+1:r=0}else r=0;const o=this.getBufferedFrag(n.currentTime+r);if(o){const l=this.followingBufferedFrag(o);if(l){this.abortCurrentFrag();const c=l.maxStartPTS?l.maxStartPTS:l.start,d=l.duration,u=Math.max(o.end,c+Math.min(Math.max(d-this.config.maxFragLookUpTolerance,d*(this.couldBacktrack?.5:.125)),d*(this.couldBacktrack?.75:.25)));this.flushMainBuffer(u,Number.POSITIVE_INFINITY)}}}}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case Mt.KEY_LOADING:case Mt.FRAG_LOADING:case Mt.FRAG_LOADING_WAITING_RETRY:case Mt.PARSING:case Mt.PARSED:this.state=Mt.IDLE;break}this.nextLoadPosition=this.getLoadPosition()}flushMainBuffer(e,n){super.flushMainBuffer(e,n,this.altAudio===2?"video":null)}onMediaAttached(e,n){super.onMediaAttached(e,n);const r=n.media;Tu(r,"playing",this.onMediaPlaying),Tu(r,"seeked",this.onMediaSeeked)}onMediaDetaching(e,n){const{media:r}=this;r&&(fh(r,"playing",this.onMediaPlaying),fh(r,"seeked",this.onMediaSeeked)),this.videoBuffer=null,this.fragPlaying=null,super.onMediaDetaching(e,n),!n.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(ue.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.fragLastKbps=0,this.fragPlaying=this.backtrackFragment=null,this.altAudio=0,this.audioOnly=!1}onManifestParsed(e,n){let r=!1,s=!1;for(let i=0;i<n.levels.length;i++){const o=n.levels[i].audioCodec;o&&(r=r||o.indexOf("mp4a.40.2")!==-1,s=s||o.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=r&&s&&!Wqn(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=n.levels,this.startFragRequested=!1}onLevelLoading(e,n){const{levels:r}=this;if(!r||this.state!==Mt.IDLE)return;const s=n.levelInfo;(!s.details||s.details.live&&(this.levelLastLoaded!==s||s.details.expired)||this.waitForCdnTuneIn(s.details))&&(this.state=Mt.WAITING_LEVEL)}onLevelLoaded(e,n){var r;const{levels:s,startFragRequested:i}=this,o=n.level,l=n.details,c=l.totalduration;if(!s){this.warn(`Levels were reset while loading level ${o}`);return}this.log(`Level ${o} loaded [${l.startSN},${l.endSN}]${l.lastPartSn?`[part-${l.lastPartSn}-${l.lastPartIndex}]`:""}, cc [${l.startCC}, ${l.endCC}] duration:${c}`);const d=n.levelInfo,u=this.fragCurrent;u&&(this.state===Mt.FRAG_LOADING||this.state===Mt.FRAG_LOADING_WAITING_RETRY)&&u.level!==n.level&&u.loader&&this.abortCurrentFrag();let h=0;if(l.live||(r=d.details)!=null&&r.live){var m;if(this.checkLiveUpdate(l),l.deltaUpdateFailed)return;h=this.alignPlaylists(l,d.details,(m=this.levelLastLoaded)==null?void 0:m.details)}if(d.details=l,this.levelLastLoaded=d,i||this.setStartPosition(l,h),this.hls.trigger(ue.LEVEL_UPDATED,{details:l,level:o}),this.state===Mt.WAITING_LEVEL){if(this.waitForCdnTuneIn(l))return;this.state=Mt.IDLE}i&&l.live&&this.synchronizeToLiveEdge(l),this.tick()}synchronizeToLiveEdge(e){const{config:n,media:r}=this;if(!r)return;const s=this.hls.liveSyncPosition,i=this.getLoadPosition(),o=e.fragmentStart,l=e.edge,c=i>=o-n.maxFragLookUpTolerance&&i<=l;if(s!==null&&r.duration>s&&(i<s||!c)){const u=n.liveMaxLatencyDuration!==void 0?n.liveMaxLatencyDuration:n.liveMaxLatencyDurationCount*e.targetduration;if((!c&&r.readyState<4||i<l-u)&&(this._hasEnoughToStart||(this.nextLoadPosition=s),r.readyState))if(this.warn(`Playback: ${i.toFixed(3)} is located too far from the end of live sliding playlist: ${l}, reset currentTime to : ${s.toFixed(3)}`),this.config.liveSyncMode==="buffered"){var d;const h=$s.bufferInfo(r,s,0);if(!((d=h.buffered)!=null&&d.length)){r.currentTime=s;return}if(h.start<=i){r.currentTime=s;return}const{nextStart:f}=$s.bufferedInfo(h.buffered,i,0);f&&(r.currentTime=f)}else r.currentTime=s}}_handleFragmentLoadProgress(e){var n;const r=e.frag,{part:s,payload:i}=e,{levels:o}=this;if(!o){this.warn(`Levels were reset while fragment load was in progress. Fragment ${r.sn} of level ${r.level} will not be buffered`);return}const l=o[r.level];if(!l){this.warn(`Level ${r.level} not found on progress`);return}const c=l.details;if(!c){this.warn(`Dropping fragment ${r.sn} of level ${r.level} after level details were reset`),this.fragmentTracker.removeFragment(r);return}const d=l.videoCodec,u=c.PTSKnown||!c.live,h=(n=r.initSegment)==null?void 0:n.data,m=this._getAudioCodec(l),f=this.transmuxer=this.transmuxer||new twt(this.hls,Yn.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),p=s?s.index:-1,g=p!==-1,v=new hTe(r.level,r.sn,r.stats.chunkCount,i.byteLength,p,g),b=this.initPTS[r.cc];f.push(i,h,m,d,r,s,c.totalduration,u,v,b)}onAudioTrackSwitching(e,n){const r=this.hls,s=this.altAudio!==0;if(UQ(n.url,r))this.altAudio=1;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const o=this.fragCurrent;o&&(this.log("Switching to main audio track, cancel main fragment load"),o.abortRequests(),this.fragmentTracker.removeFragment(o)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(s){this.altAudio=0,this.fragmentTracker.removeAllFragments(),r.once(ue.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(ue.AUDIO_TRACK_SWITCHED,n)}),r.trigger(ue.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}r.trigger(ue.AUDIO_TRACK_SWITCHED,n)}}onAudioTrackSwitched(e,n){const r=UQ(n.url,this.hls);if(r){const s=this.videoBuffer;s&&this.mediaBuffer!==s&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=s)}this.altAudio=r?2:0,this.tick()}onBufferCreated(e,n){const r=n.tracks;let s,i,o=!1;for(const l in r){const c=r[l];if(c.id==="main"){if(i=l,s=c,l==="video"){const d=r[l];d&&(this.videoBuffer=d.buffer)}}else o=!0}o&&s?(this.log(`Alternate track found, use ${i}.buffered to schedule main fragment loading`),this.mediaBuffer=s.buffer):this.mediaBuffer=this.media}onFragBuffered(e,n){const{frag:r,part:s}=n,i=r.type===Yn.MAIN;if(i){if(this.fragContextChanged(r)){this.warn(`Fragment ${r.sn}${s?" p: "+s.index:""} of level ${r.level} finished buffering, but was aborted. state: ${this.state}`),this.state===Mt.PARSED&&(this.state=Mt.IDLE);return}const l=s?s.stats:r.stats;this.fragLastKbps=Math.round(8*l.total/(l.buffering.end-l.loading.first)),xl(r)&&(this.fragPrevious=r),this.fragBufferedComplete(r,s)}const o=this.media;o&&(!this._hasEnoughToStart&&$s.getBuffered(o).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),i&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,n){var r;if(n.fatal){this.state=Mt.ERROR;return}switch(n.details){case dt.FRAG_GAP:case dt.FRAG_PARSING_ERROR:case dt.FRAG_DECRYPT_ERROR:case dt.FRAG_LOAD_ERROR:case dt.FRAG_LOAD_TIMEOUT:case dt.KEY_LOAD_ERROR:case dt.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Yn.MAIN,n);break;case dt.LEVEL_LOAD_ERROR:case dt.LEVEL_LOAD_TIMEOUT:case dt.LEVEL_PARSING_ERROR:!n.levelRetry&&this.state===Mt.WAITING_LEVEL&&((r=n.context)==null?void 0:r.type)===Us.LEVEL&&(this.state=Mt.IDLE);break;case dt.BUFFER_ADD_CODEC_ERROR:case dt.BUFFER_APPEND_ERROR:if(n.parent!=="main")return;this.reduceLengthAndFlushBuffer(n)&&this.resetLoadingState();break;case dt.BUFFER_FULL_ERROR:if(n.parent!=="main")return;this.reduceLengthAndFlushBuffer(n)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case dt.INTERNAL_EXCEPTION:this.recoverWorkerError(n);break}}onFragLoadEmergencyAborted(){this.state=Mt.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:n}){if(n!==pa.AUDIO||!this.altAudio){const r=(n===pa.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;r&&(this.afterBufferFlushed(r,n,Yn.MAIN),this.tick())}}onLevelsUpdated(e,n){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=n.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const n=e.currentTime;let r=this.startPosition;if(r>=0&&n<r){if(e.seeking){this.log(`could not seek to ${r}, already seeking at ${n}`);return}const s=this.timelineOffset;s&&r&&(r+=s);const i=this.getLevelDetails(),o=$s.getBuffered(e),l=o.length?o.start(0):0,c=l-r,d=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||c>0&&(c<d||this.loadingParts&&c<2*((i==null?void 0:i.partTarget)||0)))&&(this.log(`adjusting start position by ${c} to match buffer start`),r+=c,this.startPosition=r),n<r&&(this.log(`seek to target start position ${r} from current time ${n} buffer start ${l}`),e.currentTime=r)}}_getAudioCodec(e){let n=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&n&&(this.log("Swapping audio codec"),n.indexOf("mp4a.40.5")!==-1?n="mp4a.40.2":n="mp4a.40.5"),n}_loadBitrateTestFrag(e,n){e.bitrateTest=!0,this._doFragLoad(e,n).then(r=>{const{hls:s}=this,i=r==null?void 0:r.frag;if(!i||this.fragContextChanged(i))return;n.fragmentError=0,this.state=Mt.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const o=i.stats;o.parsing.start=o.parsing.end=o.buffering.start=o.buffering.end=self.performance.now(),s.trigger(ue.FRAG_LOADED,r),i.bitrateTest=!1}).catch(r=>{this.state===Mt.STOPPED||this.state===Mt.ERROR||(this.warn(r),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const n=this.playlistType,{hls:r}=this,{remuxResult:s,chunkMeta:i}=e,o=this.getCurrentContext(i);if(!o){this.resetWhenMissingContext(i);return}const{frag:l,part:c,level:d}=o,{video:u,text:h,id3:m,initSegment:f}=s,{details:p}=d,g=this.altAudio?void 0:s.audio;if(this.fragContextChanged(l)){this.fragmentTracker.removeFragment(l);return}if(this.state=Mt.PARSING,f){const v=f.tracks;if(v){const k=l.initSegment||l;if(this.unhandledEncryptionError(f,l))return;this._bufferInitSegment(d,v,k,i),r.trigger(ue.FRAG_PARSING_INIT_SEGMENT,{frag:k,id:n,tracks:v})}const b=f.initPTS,x=f.timescale,w=this.initPTS[l.cc];if($n(b)&&(!w||w.baseTime!==b||w.timescale!==x)){const k=f.trackId;this.initPTS[l.cc]={baseTime:b,timescale:x,trackId:k},r.trigger(ue.INIT_PTS_FOUND,{frag:l,id:n,initPTS:b,timescale:x,trackId:k})}}if(u&&p){g&&u.type==="audiovideo"&&this.logMuxedErr(l);const v=p.fragments[l.sn-1-p.startSN],b=l.sn===p.startSN,x=!v||l.cc>v.cc;if(s.independent!==!1){const{startPTS:w,endPTS:k,startDTS:S,endDTS:C}=u;if(c)c.elementaryStreams[u.type]={startPTS:w,endPTS:k,startDTS:S,endDTS:C};else if(u.firstKeyFrame&&u.independent&&i.id===1&&!x&&(this.couldBacktrack=!0),u.dropped&&u.independent){const j=this.getMainFwdBufferInfo(),E=(j?j.end:this.getLoadPosition())+this.config.maxBufferHole,N=u.firstKeyFramePTS?u.firstKeyFramePTS:w;if(!b&&E<N-this.config.maxBufferHole&&!x){this.backtrack(l);return}else x&&(l.gap=!0);l.setElementaryStreamInfo(u.type,l.start,k,l.start,C,!0)}else b&&w-(p.appliedTimelineOffset||0)>YW&&(l.gap=!0);l.setElementaryStreamInfo(u.type,w,k,S,C),this.backtrackFragment&&(this.backtrackFragment=l),this.bufferFragmentData(u,l,c,i,b||x)}else if(b||x)l.gap=!0;else{this.backtrack(l);return}}if(g){const{startPTS:v,endPTS:b,startDTS:x,endDTS:w}=g;c&&(c.elementaryStreams[pa.AUDIO]={startPTS:v,endPTS:b,startDTS:x,endDTS:w}),l.setElementaryStreamInfo(pa.AUDIO,v,b,x,w),this.bufferFragmentData(g,l,c,i)}if(p&&m!=null&&m.samples.length){const v={id:n,frag:l,details:p,samples:m.samples};r.trigger(ue.FRAG_PARSING_METADATA,v)}if(p&&h){const v={id:n,frag:l,details:p,samples:h.samples};r.trigger(ue.FRAG_PARSING_USERDATA,v)}}logMuxedErr(e){this.warn(`${xl(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,n,r,s){if(this.state!==Mt.PARSING)return;this.audioOnly=!!n.audio&&!n.video,this.altAudio&&!this.audioOnly&&(delete n.audio,n.audiovideo&&this.logMuxedErr(r));const{audio:i,video:o,audiovideo:l}=n;if(i){const d=e.audioCodec;let u=BW(i.codec,d);u==="mp4a"&&(u="mp4a.40.5");const h=navigator.userAgent.toLowerCase();if(this.audioCodecSwitch){u&&(u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5");const m=i.metadata;m&&"channelCount"in m&&(m.channelCount||1)!==1&&h.indexOf("firefox")===-1&&(u="mp4a.40.5")}u&&u.indexOf("mp4a.40.5")!==-1&&h.indexOf("android")!==-1&&i.container!=="audio/mpeg"&&(u="mp4a.40.2",this.log(`Android: force audio codec to ${u}`)),d&&d!==u&&this.log(`Swapping manifest audio codec "${d}" for "${u}"`),i.levelCodec=u,i.id=Yn.MAIN,this.log(`Init audio buffer, container:${i.container}, codecs[selected/level/parsed]=[${u||""}/${d||""}/${i.codec}]`),delete n.audiovideo}if(o){o.levelCodec=e.videoCodec,o.id=Yn.MAIN;const d=o.codec;if((d==null?void 0:d.length)===4)switch(d){case"hvc1":case"hev1":o.codec="hvc1.1.6.L120.90";break;case"av01":o.codec="av01.0.04M.08";break;case"avc1":o.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${o.container}, codecs[level/parsed]=[${e.videoCodec||""}/${d}]${o.codec!==d?" parsed-corrected="+o.codec:""}${o.supplemental?" supplemental="+o.supplemental:""}`),delete n.audiovideo}l&&(this.log(`Init audiovideo buffer, container:${l.container}, codecs[level/parsed]=[${e.codecs}/${l.codec}]`),delete n.video,delete n.audio);const c=Object.keys(n);if(c.length){if(this.hls.trigger(ue.BUFFER_CODECS,n),!this.hls)return;c.forEach(d=>{const h=n[d].initSegment;h!=null&&h.byteLength&&this.hls.trigger(ue.BUFFER_APPENDING,{type:d,data:h,frag:r,part:null,chunkMeta:s,parent:r.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.mediaBuffer&&this.altAudio===2?this.mediaBuffer:this.media;return this.getFwdBufferInfo(e,Yn.MAIN)}get maxBufferLength(){const{levels:e,level:n}=this,r=e==null?void 0:e[n];return r?this.getMaxBufferLength(r.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=Mt.IDLE}checkFragmentChanged(){const e=this.media;let n=null;if(e&&e.readyState>1&&e.seeking===!1){const r=e.currentTime;if($s.isBuffered(e,r)?n=this.getAppendedFrag(r):$s.isBuffered(e,r+.1)&&(n=this.getAppendedFrag(r+.1)),n){this.backtrackFragment=null;const s=this.fragPlaying,i=n.level;(!s||n.sn!==s.sn||s.level!==i)&&(this.fragPlaying=n,this.hls.trigger(ue.FRAG_CHANGED,{frag:n}),(!s||s.level!==i)&&this.hls.trigger(ue.LEVEL_SWITCHED,{level:i}))}}}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const n=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return $n(n)?this.getAppendedFrag(n):null}get currentProgramDateTime(){var e;const n=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if($n(n)){const r=this.getLevelDetails(),s=this.currentFrag||(r?V2(null,r.fragments,n):null);if(s){const i=s.programDateTime;if(i!==null){const o=i+(n-s.start)*1e3;return new Date(o)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}},Yqn=class extends tp{constructor(e,n){super("key-loader",n),this.config=void 0,this.keyIdToKeyInfo={},this.emeController=null,this.config=e}abort(e){for(const r in this.keyIdToKeyInfo){const s=this.keyIdToKeyInfo[r].loader;if(s){var n;if(e&&e!==((n=s.context)==null?void 0:n.frag.type))return;s.abort()}}}detach(){for(const e in this.keyIdToKeyInfo){const n=this.keyIdToKeyInfo[e];(n.mediaKeySessionContext||n.decryptdata.isCommonEncryption)&&delete this.keyIdToKeyInfo[e]}}destroy(){this.detach();for(const e in this.keyIdToKeyInfo){const n=this.keyIdToKeyInfo[e].loader;n&&n.destroy()}this.keyIdToKeyInfo={}}createKeyLoadError(e,n=dt.KEY_LOAD_ERROR,r,s,i){return new Db({type:ur.NETWORK_ERROR,details:n,fatal:!1,frag:e,response:i,error:r,networkDetails:s})}loadClear(e,n,r){if(this.emeController&&this.config.emeEnabled&&!this.emeController.getSelectedKeySystemFormats().length){if(n.length)for(let s=0,i=n.length;s<i;s++){const o=n[s];if(e.cc<=o.cc&&(!xl(e)||!xl(o)||e.sn<o.sn)||!r&&s==i-1)return this.emeController.selectKeySystemFormat(o).then(l=>{if(!this.emeController)return;o.setKeyFormat(l);const c=zW(l);if(c)return this.emeController.getKeySystemAccess([c])})}if(this.config.requireKeySystemAccessOnStart){const s=q4(this.config);if(s.length)return this.emeController.getKeySystemAccess(s)}}return null}load(e){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(n=>this.loadInternal(e,n)):this.loadInternal(e)}loadInternal(e,n){var r,s;n&&e.setKeyFormat(n);const i=e.decryptdata;if(!i){const d=new Error(n?`Expected frag.decryptdata to be defined after setting format ${n}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(this.createKeyLoadError(e,dt.KEY_LOAD_ERROR,d))}const o=i.uri;if(!o)return Promise.reject(this.createKeyLoadError(e,dt.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${o}"`)));const l=ide(i);let c=this.keyIdToKeyInfo[l];if((r=c)!=null&&r.decryptdata.key)return i.key=c.decryptdata.key,Promise.resolve({frag:e,keyInfo:c});if(this.emeController&&(s=c)!=null&&s.keyLoadPromise)switch(this.emeController.getKeyStatus(c.decryptdata)){case"usable":case"usable-in-future":return c.keyLoadPromise.then(u=>{const{keyInfo:h}=u;return i.key=h.decryptdata.key,{frag:e,keyInfo:h}})}switch(this.log(`${this.keyIdToKeyInfo[l]?"Rel":"L"}oading${i.keyId?" keyId: "+cd(i.keyId):""} URI: ${i.uri} from ${e.type} ${e.level}`),c=this.keyIdToKeyInfo[l]={decryptdata:i,keyLoadPromise:null,loader:null,mediaKeySessionContext:null},i.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return i.keyFormat==="identity"?this.loadKeyHTTP(c,e):this.loadKeyEME(c,e);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(c,e);default:return Promise.reject(this.createKeyLoadError(e,dt.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${i.method}"`)))}}loadKeyEME(e,n){const r={frag:n,keyInfo:e};if(this.emeController&&this.config.emeEnabled){var s;if(!e.decryptdata.keyId&&(s=n.initSegment)!=null&&s.data){const o=hVn(n.initSegment.data);if(o.length){let l=o[0];l.some(c=>c!==0)?(this.log(`Using keyId found in init segment ${cd(l)}`),WQ.setKeyIdForUri(e.decryptdata.uri,l)):(l=WQ.addKeyIdForUri(e.decryptdata.uri),this.log(`Generating keyId to patch media ${cd(l)}`)),e.decryptdata.keyId=l}}if(!e.decryptdata.keyId&&!xl(n))return Promise.resolve(r);const i=this.emeController.loadKey(r);return(e.keyLoadPromise=i.then(o=>(e.mediaKeySessionContext=o,r))).catch(o=>{throw e.keyLoadPromise=null,"data"in o&&(o.data.frag=n),o})}return Promise.resolve(r)}loadKeyHTTP(e,n){const r=this.config,s=r.loader,i=new s(r);return n.keyLoader=e.loader=i,e.keyLoadPromise=new Promise((o,l)=>{const c={keyInfo:e,frag:n,responseType:"arraybuffer",url:e.decryptdata.uri},d=r.keyLoadPolicy.default,u={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(m,f,p,g)=>{const{frag:v,keyInfo:b}=p,x=ide(b.decryptdata);if(!v.decryptdata||b!==this.keyIdToKeyInfo[x])return l(this.createKeyLoadError(v,dt.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),g));b.decryptdata.key=v.decryptdata.key=new Uint8Array(m.data),v.keyLoader=null,b.loader=null,o({frag:v,keyInfo:b})},onError:(m,f,p,g)=>{this.resetLoader(f),l(this.createKeyLoadError(n,dt.KEY_LOAD_ERROR,new Error(`HTTP Error ${m.code} loading key ${m.text}`),p,Bi({url:c.url,data:void 0},m)))},onTimeout:(m,f,p)=>{this.resetLoader(f),l(this.createKeyLoadError(n,dt.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),p))},onAbort:(m,f,p)=>{this.resetLoader(f),l(this.createKeyLoadError(n,dt.INTERNAL_ABORTED,new Error("key loading aborted"),p))}};i.load(c,u,h)})}resetLoader(e){const{frag:n,keyInfo:r,url:s}=e,i=r.loader;n.keyLoader===i&&(n.keyLoader=null,r.loader=null);const o=ide(r.decryptdata)||s;delete this.keyIdToKeyInfo[o],i&&i.destroy()}};function ide(t){if(t.keyFormat!==ud.FAIRPLAY){const e=t.keyId;if(e)return cd(e)}return t.uri}function O9e(t){const{type:e}=t;switch(e){case Us.AUDIO_TRACK:return Yn.AUDIO;case Us.SUBTITLE_TRACK:return Yn.SUBTITLE;default:return Yn.MAIN}}function ade(t,e){let n=t.url;return(n===void 0||n.indexOf("data:")===0)&&(n=e.url),n}let Qqn=class{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.on(ue.LEVEL_LOADING,this.onLevelLoading,this),e.on(ue.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(ue.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(ue.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(ue.MANIFEST_LOADING,this.onManifestLoading,this),e.off(ue.LEVEL_LOADING,this.onLevelLoading,this),e.off(ue.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(ue.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(ue.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const n=this.hls.config,r=n.pLoader,s=n.loader,i=r||s,o=new i(n);return this.loaders[e.type]=o,o}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const n=this.loaders[e];n&&n.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,n){const{url:r}=n;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:Us.MANIFEST,url:r,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,n){const{id:r,level:s,pathwayId:i,url:o,deliveryDirectives:l,levelInfo:c}=n;this.load({id:r,level:s,pathwayId:i,responseType:"text",type:Us.LEVEL,url:o,deliveryDirectives:l,levelOrTrack:c})}onAudioTrackLoading(e,n){const{id:r,groupId:s,url:i,deliveryDirectives:o,track:l}=n;this.load({id:r,groupId:s,level:null,responseType:"text",type:Us.AUDIO_TRACK,url:i,deliveryDirectives:o,levelOrTrack:l})}onSubtitleTrackLoading(e,n){const{id:r,groupId:s,url:i,deliveryDirectives:o,track:l}=n;this.load({id:r,groupId:s,level:null,responseType:"text",type:Us.SUBTITLE_TRACK,url:i,deliveryDirectives:o,levelOrTrack:l})}onLevelsUpdated(e,n){const r=this.loaders[Us.LEVEL];if(r){const s=r.context;s&&!n.levels.some(i=>i===s.levelOrTrack)&&(r.abort(),delete this.loaders[Us.LEVEL])}}load(e){var n;const r=this.hls.config;let s=this.getInternalLoader(e);if(s){const d=this.hls.logger,u=s.context;if(u&&u.levelOrTrack===e.levelOrTrack&&(u.url===e.url||u.deliveryDirectives&&!e.deliveryDirectives)){u.url===e.url?d.log(`[playlist-loader]: ignore ${e.url} ongoing request`):d.log(`[playlist-loader]: ignore ${e.url} in favor of ${u.url}`);return}d.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),s.abort()}let i;if(e.type===Us.MANIFEST?i=r.manifestLoadPolicy.default:i=ra({},r.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),s=this.createInternalLoader(e),$n((n=e.deliveryDirectives)==null?void 0:n.part)){let d;if(e.type===Us.LEVEL&&e.level!==null?d=this.hls.levels[e.level].details:e.type===Us.AUDIO_TRACK&&e.id!==null?d=this.hls.audioTracks[e.id].details:e.type===Us.SUBTITLE_TRACK&&e.id!==null&&(d=this.hls.subtitleTracks[e.id].details),d){const u=d.partTarget,h=d.targetduration;if(u&&h){const m=Math.max(u*3,h*.8)*1e3;i=ra({},i,{maxTimeToFirstByteMs:Math.min(m,i.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(m,i.maxTimeToFirstByteMs)})}}}const o=i.errorRetry||i.timeoutRetry||{},l={loadPolicy:i,timeout:i.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},c={onSuccess:(d,u,h,m)=>{const f=this.getInternalLoader(h);this.resetInternalLoader(h.type);const p=d.data;u.parsing.start=performance.now(),K4.isMediaPlaylist(p)||h.type!==Us.MANIFEST?this.handleTrackOrLevelPlaylist(d,u,h,m||null,f):this.handleMasterPlaylist(d,u,h,m)},onError:(d,u,h,m)=>{this.handleNetworkError(u,h,!1,d,m)},onTimeout:(d,u,h)=>{this.handleNetworkError(u,h,!0,void 0,d)}};s.load(e,l,c)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:n},forceStartLoad:r}=this.hls;(e||r)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${n}`),this.hls.startLoad(n))}handleMasterPlaylist(e,n,r,s){const i=this.hls,o=e.data,l=ade(e,r),c=K4.parseMasterPlaylist(o,l);if(c.playlistParsingError){n.parsing.end=performance.now(),this.handleManifestParsingError(e,r,c.playlistParsingError,s,n);return}const{contentSteering:d,levels:u,sessionData:h,sessionKeys:m,startTimeOffset:f,variableList:p}=c;this.variableList=p,u.forEach(x=>{const{unknownCodecs:w}=x;if(w){const{preferManagedMediaSource:k}=this.hls.config;let{audioCodec:S,videoCodec:C}=x;for(let j=w.length;j--;){const E=w[j];E6(E,"audio",k)?(x.audioCodec=S=S?`${S},${E}`:E,DR.audio[S.substring(0,4)]=2,w.splice(j,1)):E6(E,"video",k)&&(x.videoCodec=C=C?`${C},${E}`:E,DR.video[C.substring(0,4)]=2,w.splice(j,1))}}});const{AUDIO:g=[],SUBTITLES:v,"CLOSED-CAPTIONS":b}=K4.parseMasterPlaylistMedia(o,l,c);g.length&&!g.some(w=>!w.url)&&u[0].audioCodec&&!u[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),g.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new ml({}),bitrate:0,url:""})),i.trigger(ue.MANIFEST_LOADED,{levels:u,audioTracks:g,subtitles:v,captions:b,contentSteering:d,url:l,stats:n,networkDetails:s,sessionData:h,sessionKeys:m,startTimeOffset:f,variableList:p})}handleTrackOrLevelPlaylist(e,n,r,s,i){const o=this.hls,{id:l,level:c,type:d}=r,u=ade(e,r),h=$n(c)?c:$n(l)?l:0,m=O9e(r),f=K4.parseLevelPlaylist(e.data,u,h,m,0,this.variableList);if(d===Us.MANIFEST){const p={attrs:new ml({}),bitrate:0,details:f,name:"",url:u};f.requestScheduled=n.loading.start+A0t(f,0),o.trigger(ue.MANIFEST_LOADED,{levels:[p],audioTracks:[],url:u,stats:n,networkDetails:s,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}n.parsing.end=performance.now(),r.levelDetails=f,this.handlePlaylistLoaded(f,e,n,r,s,i)}handleManifestParsingError(e,n,r,s,i){this.hls.trigger(ue.ERROR,{type:ur.NETWORK_ERROR,details:dt.MANIFEST_PARSING_ERROR,fatal:n.type===Us.MANIFEST,url:e.url,err:r,error:r,reason:r.message,response:e,context:n,networkDetails:s,stats:i})}handleNetworkError(e,n,r=!1,s,i){let o=`A network ${r?"timeout":"error"+(s?" (status "+s.code+")":"")} occurred while loading ${e.type}`;e.type===Us.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===Us.AUDIO_TRACK||e.type===Us.SUBTITLE_TRACK)&&(o+=` id: ${e.id} group-id: "${e.groupId}"`);const l=new Error(o);this.hls.logger.warn(`[playlist-loader]: ${o}`);let c=dt.UNKNOWN,d=!1;const u=this.getInternalLoader(e);switch(e.type){case Us.MANIFEST:c=r?dt.MANIFEST_LOAD_TIMEOUT:dt.MANIFEST_LOAD_ERROR,d=!0;break;case Us.LEVEL:c=r?dt.LEVEL_LOAD_TIMEOUT:dt.LEVEL_LOAD_ERROR,d=!1;break;case Us.AUDIO_TRACK:c=r?dt.AUDIO_TRACK_LOAD_TIMEOUT:dt.AUDIO_TRACK_LOAD_ERROR,d=!1;break;case Us.SUBTITLE_TRACK:c=r?dt.SUBTITLE_TRACK_LOAD_TIMEOUT:dt.SUBTITLE_LOAD_ERROR,d=!1;break}u&&this.resetInternalLoader(e.type);const h={type:ur.NETWORK_ERROR,details:c,fatal:d,url:e.url,loader:u,context:e,error:l,networkDetails:n,stats:i};if(s){const m=(n==null?void 0:n.url)||e.url;h.response=Bi({url:m,data:void 0},s)}this.hls.trigger(ue.ERROR,h)}handlePlaylistLoaded(e,n,r,s,i,o){const l=this.hls,{type:c,level:d,levelOrTrack:u,id:h,groupId:m,deliveryDirectives:f}=s,p=ade(n,s),g=O9e(s);let v=typeof s.level=="number"&&g===Yn.MAIN?d:void 0;const b=e.playlistParsingError;if(b){if(this.hls.logger.warn(`${b} ${e.url}`),!l.config.ignorePlaylistParsingErrors){l.trigger(ue.ERROR,{type:ur.NETWORK_ERROR,details:dt.LEVEL_PARSING_ERROR,fatal:!1,url:p,error:b,reason:b.message,response:n,context:s,level:v,parent:g,networkDetails:i,stats:r});return}e.playlistParsingError=null}if(!e.fragments.length){const x=e.playlistParsingError=new Error("No Segments found in Playlist");l.trigger(ue.ERROR,{type:ur.NETWORK_ERROR,details:dt.LEVEL_EMPTY_ERROR,fatal:!1,url:p,error:x,reason:x.message,response:n,context:s,level:v,parent:g,networkDetails:i,stats:r});return}switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),(!o.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),c){case Us.MANIFEST:case Us.LEVEL:if(v){if(!u)v=0;else if(u!==l.levels[v]){const x=l.levels.indexOf(u);x>-1&&(v=x)}}l.trigger(ue.LEVEL_LOADED,{details:e,levelInfo:u||l.levels[0],level:v||0,id:h||0,stats:r,networkDetails:i,deliveryDirectives:f,withoutMultiVariant:c===Us.MANIFEST});break;case Us.AUDIO_TRACK:l.trigger(ue.AUDIO_TRACK_LOADED,{details:e,track:u,id:h||0,groupId:m||"",stats:r,networkDetails:i,deliveryDirectives:f});break;case Us.SUBTITLE_TRACK:l.trigger(ue.SUBTITLE_TRACK_LOADED,{details:e,track:u,id:h||0,groupId:m||"",stats:r,networkDetails:i,deliveryDirectives:f});break}}},Fw=class I_{static get version(){return _6}static isMSESupported(){return Pwt()}static isSupported(){return Gqn()}static getMediaSource(){return Ok()}static get Events(){return ue}static get MetadataSchema(){return lm}static get ErrorTypes(){return ur}static get ErrorDetails(){return dt}static get DefaultConfig(){return I_.defaultConfig?I_.defaultConfig:Iqn}static set DefaultConfig(e){I_.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new gTe,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.streamController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._url=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const n=this.logger=eVn(e.debug||!1,"Hls instance",e.assetPlayerId),r=this.config=Lqn(I_.DefaultConfig,e,n);this.userConfig=e,r.progressive&&Dqn(r,n);const{abrController:s,bufferController:i,capLevelController:o,errorController:l,fpsController:c}=r,d=new l(this),u=this.abrController=new s(this),h=new YVn(this),m=r.interstitialsController,f=m?this.interstitialsController=new m(this,I_):null,p=this.bufferController=new i(this,h),g=this.capLevelController=new o(this),v=new c(this),b=new Qqn(this),x=r.contentSteeringController,w=x?new x(this):null,k=this.levelController=new Hqn(this,w),S=new zqn(this),C=new Yqn(this.config,this.logger),j=this.streamController=new Kqn(this,h,C),E=this.gapController=new Bqn(this,h);g.setStreamController(j),v.setStreamController(j);const N=[b,k,j];f&&N.splice(1,0,f),w&&N.splice(1,0,w),this.networkControllers=N;const A=[u,p,E,g,v,S,h];this.audioTrackController=this.createController(r.audioTrackController,N);const _=r.audioStreamController;_&&N.push(this.audioStreamController=new _(this,h,C)),this.subtitleTrackController=this.createController(r.subtitleTrackController,N);const T=r.subtitleStreamController;T&&N.push(this.subtititleStreamController=new T(this,h,C)),this.createController(r.timelineController,A),C.emeController=this.emeController=this.createController(r.emeController,A),this.cmcdController=this.createController(r.cmcdController,A),this.latencyController=this.createController(Vqn,A),this.coreComponents=A,N.push(d);const R=d.onErrorOut;typeof R=="function"&&this.on(ue.ERROR,R,d),this.on(ue.MANIFEST_LOADED,b.onManifestLoaded,b)}createController(e,n){if(e){const r=new e(this);return n&&n.push(r),r}return null}on(e,n,r=this){this._emitter.on(e,n,r)}once(e,n,r=this){this._emitter.once(e,n,r)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,n,r=this,s){this._emitter.off(e,n,r,s)}listeners(e){return this._emitter.listeners(e)}emit(e,n,r){return this._emitter.emit(e,n,r)}trigger(e,n){if(this.config.debug)return this.emit(e,e,n);try{return this.emit(e,e,n)}catch(r){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+r.message+'". Here is a stacktrace:',r),!this.triggeringException){this.triggeringException=!0;const s=e===ue.ERROR;this.trigger(ue.ERROR,{type:ur.OTHER_ERROR,details:dt.INTERNAL_EXCEPTION,fatal:s,event:e,error:r}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(ue.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(n=>n.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(n=>n.destroy()),this.coreComponents.length=0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const i=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(ue.ERROR,{type:ur.OTHER_ERROR,details:dt.ATTACH_MEDIA_ERROR,fatal:!0,error:i});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const n="media"in e,r=n?e.media:e,s=n?e:{media:r};this._media=r,this.trigger(ue.MEDIA_ATTACHING,s)}detachMedia(){this.logger.log("detachMedia"),this.trigger(ue.MEDIA_DETACHING,{}),this._media=null}transferMedia(){this._media=null;const e=this.bufferController.transferMedia();return this.trigger(ue.MEDIA_DETACHING,{transferMedia:e}),e}loadSource(e){this.stopLoad();const n=this.media,r=this._url,s=this._url=iTe.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${s}`),n&&r&&(r!==s||this.bufferController.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(n)),this.trigger(ue.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,n){this.logger.log(`startLoad(${e+(n?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let r=0;r<this.networkControllers.length&&(this.networkControllers[r].startLoad(e,n),!(!this.started||!this.networkControllers));r++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[Yn.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[Yn.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[Yn.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,n=e==null?void 0:e.currentTime;this.detachMedia(),e&&(this.attachMedia(e),n&&this.startLoad(n))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=BWn()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const n=!!e;n!==this.config.capLevelToPlayerSize&&(n?this.capLevelController.startCapping():(this.capLevelController.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=n)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){IVn(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:n}}=this;if(!e)return 0;const r=e.length;for(let s=0;s<r;s++)if(e[s].maxBitrate>=n)return s;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:n,maxHdcpLevel:r}=this;let s;if(n===-1&&e!=null&&e.length?s=e.length-1:s=n,r)for(let i=s;i--;){const o=e[i].attrs["HDCP-LEVEL"];if(o&&o<=r)return i}return s}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var n;return((n=this.audioTrackController)==null?void 0:n.setAudioOption(e))||null}setSubtitleOption(e){var n;return((n=this.subtitleTrackController)==null?void 0:n.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const n=this.audioTrackController;n&&(n.audioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const n=this.subtitleTrackController;n&&(n.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const n=this.subtitleTrackController;n&&(n.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){return this.latencyController.liveSyncPosition}get latency(){return this.latencyController.latency}get maxLatency(){return this.latencyController.maxLatency}get targetLatency(){return this.latencyController.targetLatency}set targetLatency(e){this.latencyController.targetLatency=e}get drift(){return this.latencyController.drift}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){var e;return((e=this.interstitialsController)==null?void 0:e.interstitialsManager)||null}getMediaDecodingInfo(e,n=this.allAudioTracks){const r=f0t(n);return h0t(e,r,navigator.mediaCapabilities)}};Fw.defaultConfig=void 0;function F9e(t){const e=Math.floor(t/3600),n=Math.floor(t%3600/60),r=Math.floor(t%60);return e>0?`${e}:${n.toString().padStart(2,"0")}:${r.toString().padStart(2,"0")}`:`${n}:${r.toString().padStart(2,"0")}`}const Zqn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;height:100%;max-height:100%;min-height:100%;width:100%;min-width:100%;max-width:100%;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}.player-container{position:relative;margin-left:var(--rtk-space-4, 16px);margin-right:var(--rtk-space-4, 16px);margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-0, 0px);display:flex;flex-grow:1;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-md, 8px)}.loader{position:absolute;z-index:10;height:100%;width:100%;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));display:flex;flex-direction:column;align-items:center;justify-content:center}p{margin-top:var(--rtk-space-1, 4px);margin-bottom:var(--rtk-space-1, 4px);font-size:16px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.unmute-popup{position:absolute;z-index:30 !important;display:flex;width:var(--rtk-space-72, 288px);flex-direction:column;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));padding:var(--rtk-space-4, 16px);text-align:center;max-width:70%}.unmute-popup h3{margin:var(--rtk-space-0, 0px);font-size:16px;font-weight:500}.unmute-popup p{margin-top:var(--rtk-space-3, 12px);margin-bottom:var(--rtk-space-3, 12px);font-size:14px}.control-bar{position:absolute;bottom:0;left:16px;right:16px;display:flex;height:auto;align-items:center;padding:12px 16px;z-index:30;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));border-radius:6px;border-radius:var(--rtk-border-radius-md, 8px);background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / 0.8);gap:12px}.timings{color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.control-btn{border:none;margin-right:var(--rtk-space-2, 8px);border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));cursor:pointer;font-size:24px;height:30px;width:30px}.fullscreen-btn{margin-right:20px;height:30px}.control-btn:hover{opacity:0.8}.control-btn:focus{outline:none}.control-groups{display:flex;align-items:center;gap:12px;flex-shrink:0}#livestream-video,.livestream-video{position:absolute;top:0;left:0;width:100% !important;height:100% !important;max-width:none !important;max-height:none !important;min-width:100% !important;min-height:100% !important;-o-object-fit:fill !important;object-fit:fill !important;z-index:10;border-radius:var(--rtk-border-radius-md, 8px);border-width:0px}:host:not(:fullscreen) .video-container{padding:16px 16px 0 16px}:host(:fullscreen) .video-container,:host(:-webkit-full-screen) .video-container,:host(:-moz-full-screen) .video-container{padding:0}.level-select{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));border:none;padding:5px 10px;font-size:14px;height:30px;cursor:pointer;border-radius:5px;margin-right:10px}.level-select:focus{outline:none}.level-select option{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)))}.volume-control-holder{display:flex;justify-content:center;align-items:center}.seekbar-container{flex:1;min-width:100px;padding:0 12px;display:flex;align-items:center}.seekbar{width:100%;height:20px;cursor:pointer;display:flex;align-items:center}.seekbar-track{position:relative;width:100%;height:4px;border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.seekbar-progress{position:absolute;top:0;left:0;height:100%;border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));transition:width 0.1s ease}.seekbar-handle{position:absolute;top:50%;width:12px;height:12px;border-radius:9999px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));transform:translate(-50%, -50%);transition:left 0.1s ease;opacity:0}.seekbar:hover .seekbar-handle{opacity:1}.seekbar:hover .seekbar-track{height:6px}.seekbar:hover .seekbar-handle{width:14px;height:14px}",Jqn=Zqn;var TTe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const kB=class{constructor(t){kt(this,t),this.apiError=Wt(this,"rtkApiError",7),this.statsIntervalTimer=null,this.t=It(),this.iconPack=Nt,this.isSupported=!0,this.playerState=uu.IDLE,this.livestreamState="IDLE",this.livestreamId=null,this.audioPlaybackError=!1,this.qualityLevels=[],this.selectedQuality=-1,this.currentTime=0,this.duration=0,this.hideControls=!0,this.isDragging=!1,this.seekPosition=0,this.isSeeking=!1,this.hideControlsTimeout=null,this.seekingTimeout=null,this.livestreamUpdateListener=e=>{this.playbackUrl=this.meeting.livestream.playbackUrl,this.livestreamState=e},this.updateProgress=()=>{this.isSeeking||(this.currentTime=this.videoRef.currentTime)},this.updateHlsStatsPeriodically=()=>{var e,n,r;!((e=this.videoRef)===null||e===void 0)&&e.seekable&&this.videoRef.seekable.length>0?this.duration=this.videoRef.seekable.end(this.videoRef.seekable.length-1):this.duration=(((n=this.videoRef)===null||n===void 0?void 0:n.currentTime)||0)+(((r=this.hls)===null||r===void 0?void 0:r.latency)||0)},this.fastForwardToLatest=()=>{var e;!((e=this.videoRef)===null||e===void 0)&&e.seekable&&this.videoRef.seekable.length>0?this.videoRef.currentTime=this.videoRef.seekable.end(this.videoRef.seekable.length-1)-1:this.videoRef.currentTime=this.duration-1},this.togglePlay=()=>{this.videoRef.paused?(this.videoRef.play(),this.playerState=uu.PLAYING):(this.videoRef.pause(),this.playerState=uu.IDLE)},this.changeQuality=e=>{this.selectedQuality=e,this.hls&&(this.hls.currentLevel=e)},this.cleanupPlayer=()=>{var e;this.playerState=uu.IDLE,this.videoRef&&((e=this.hls)===null||e===void 0||e.destroy(),this.hls=null)},this.onMouseMovePlayer=()=>{this.hideControls=!1,clearTimeout(this.hideControlsTimeout),this.hideControlsTimeout=setTimeout(()=>{this.hideControls=!0},5e3)},this.seekToPosition=e=>{if(!this.videoRef)return;const n=Math.max(0,Math.min(e,this.duration));this.isSeeking=!0,this.currentTime=n;try{this.videoRef.currentTime=n,this.seekingTimeout&&clearTimeout(this.seekingTimeout),this.seekingTimeout=setTimeout(()=>{this.isSeeking=!1,this.currentTime=this.videoRef.currentTime},200)}catch(r){this.isSeeking=!1,this.meeting.__internals__.logger.warn("rtk-livestream-player:: Seek failed",{error:r})}},this.onSeekbarMouseDown=e=>{e.preventDefault(),this.isDragging=!0,this.updateSeekPosition(e),document.addEventListener("mousemove",this.onSeekbarMouseMove),document.addEventListener("mouseup",this.onSeekbarMouseUp)},this.onSeekbarMouseMove=e=>{this.isDragging&&this.updateSeekPosition(e)},this.onSeekbarMouseUp=e=>{this.isDragging&&(this.isDragging=!1,this.updateSeekPosition(e),this.seekToPosition(this.seekPosition),document.removeEventListener("mousemove",this.onSeekbarMouseMove),document.removeEventListener("mouseup",this.onSeekbarMouseUp))},this.onSeekbarClick=e=>{this.isDragging||(this.updateSeekPosition(e),this.seekToPosition(this.seekPosition))},this.updateSeekPosition=e=>{const r=e.currentTarget.getBoundingClientRect(),s=e.clientX-r.left,i=Math.max(0,Math.min(1,s/r.width));this.seekPosition=i*this.duration},this.getSeekbarProgress=()=>this.isDragging?this.duration>0?this.seekPosition/this.duration:0:this.duration>0?this.currentTime/this.duration:0,this.getLoadingState=()=>{let e="",n=!1,r=!1;switch(this.livestreamState){case"IDLE":e=this.t("livestream.idle"),n=!0,r=!1;break;case"STARTING":e=this.t("livestream.starting"),n=!0,r=!0;break;case"STOPPING":e=this.t("livestream.stopping"),n=!0,r=!0;break;case"LIVESTREAMING":this.playerState!==uu.PLAYING&&this.playerState!==uu.PAUSED&&(e=this.t("livestream.starting"),r=!0,n=!0);break;default:n=!1,e=this.t(""),r=!0;break}return{isLoading:n,loadingMessage:e,showIcon:r}},this.getErrorState=()=>{var e,n;let r=!1,s="";return this.livestreamState!=="LIVESTREAMING"?(r=!1,s=this.t(""),{isError:r,errorMessage:s}):(this.isSupported||(r=!0,s=this.t("livestream.error.not_supported")),this.playbackUrl||(r=!0,s=this.t("livestream.error.not_found")),this.playerError&&(r=!0,s=this.t((n=(e=this.playerError)===null||e===void 0?void 0:e.message)!==null&&n!==void 0?n:"livestream.error.unknown")),{isError:r,errorMessage:s})},this.initialiseAndPlayStream=async()=>{try{this.meeting.__internals__.logger.info(`rtk-livestream-player:: About to initialise HLS. VideoRef? ${!!this.videoRef} playbackUrl: ${this.playbackUrl}`),Fw.isSupported()?(this.meeting.__internals__.logger.info("rtk-livestream-player:: Initialising HLS. HLS is Supported"),this.hls=new Fw({lowLatencyMode:!1}),window.rtk_hls=this.hls,this.meeting.__internals__.logger.info("rtk-livestream-player:: Loading source"),this.hls.loadSource(this.playbackUrl+"?dvrEnabled=true"),this.meeting.__internals__.logger.info("rtk-livestream-player:: Attaching video element to HLS"),this.hls.attachMedia(this.videoRef),this.meeting.__internals__.logger.info("rtk-livestream-player:: Waiting async for HLS manifest parsing"),this.hls.on(Fw.Events.ERROR,(e,n)=>{if(n.fatal){if(this.meeting.__internals__.logger.error(`rtk-livestream-player:: fatal error: ${n.details}`,{error:n.error}),this.playbackUrl&&this.livestreamState==="LIVESTREAMING"){setTimeout(()=>{this.playbackUrl&&this.livestreamState==="LIVESTREAMING"&&(this.meeting.__internals__.logger.info("rtk-livestream-player:: Retrying playbackUrl"),this.hls.loadSource(this.playbackUrl+"?dvrEnabled=true"))},5e3);return}}else this.meeting.__internals__.logger.warn(`rtk-livestream-player:: non-fatal error: ${n.details}`,{error:n.error})}),this.hls.on(Fw.Events.MEDIA_ATTACHED,()=>{this.meeting.__internals__.logger.info("rtk-livestream-player:: media attached")}),this.hls.on(Fw.Events.MEDIA_DETACHED,()=>{this.meeting.__internals__.logger.info("rtk-livestream-player:: media detached")}),this.hls.on(Fw.Events.DESTROYING,()=>{this.meeting.__internals__.logger.info("rtk-livestream-player:: hls is getting destroyed")}),this.hls.on(Fw.Events.MANIFEST_PARSED,async(e,n)=>{this.meeting.__internals__.logger.info("rtk-livestream-player:: HLS manifest parsed");const{levels:r,autoLevelChangeAllowed:s}=COn({meeting:this.meeting,hlsLevels:n.levels});this.qualityLevels=r.map((i,o)=>({level:o,resolution:i.height?`${i.height}p`:"auto"})),s&&(this.qualityLevels=[{level:-1,resolution:"Auto"},...this.qualityLevels]),this.hls.currentLevel=this.qualityLevels[0].level;try{this.meeting.__internals__.logger.info("rtk-livestream-player:: About to start video."),await this.videoRef.play(),this.meeting.__internals__.logger.info("rtk-livestream-player:: Video has started playing."),this.playerState=uu.PLAYING}catch(i){this.audioPlaybackError=!0,this.meeting.__internals__.logger.error("rtk-livestream-player:: Video couldn't start. Trying with user gesture again.",{error:i})}}),this.videoRef.addEventListener("timeupdate",this.updateProgress),this.statsIntervalTimer=setInterval(this.updateHlsStatsPeriodically,1e3)):this.isSupported=!1}catch(e){this.meeting.__internals__.logger.error("rtk-livestream-player:: HLS couldn't initialise.",{error:e})}}}async updateLivestreamId(){const t=this.meeting.livestream.playbackUrl;if(!t||this.livestreamState!=="LIVESTREAMING"){this.playbackUrl=null,this.livestreamId=null,this.cleanupPlayer();return}const e=t.split("/"),n=e.findIndex(s=>s==="manifest"),r=e[n-1];this.livestreamId=r,await this.conditionallyStartLivestreamViewer()}async conditionallyStartLivestreamViewer(){this.videoRef&&this.playbackUrl&&!this.hls&&await this.initialiseAndPlayStream()}async connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.meeting.livestream.removeListener("livestreamUpdate",this.livestreamUpdateListener),this.videoRef.removeEventListener("timeupdate",this.updateProgress),clearInterval(this.statsIntervalTimer),this.seekingTimeout&&clearTimeout(this.seekingTimeout),this.videoRef=null,this.hls&&this.hls.destroy(),window.rtk_hls=null}meetingChanged(t){t&&(this.playbackUrl=this.meeting.livestream.playbackUrl,this.livestreamState=this.meeting.livestream.state,this.meeting.livestream.on("livestreamUpdate",this.livestreamUpdateListener))}render(){if(!LI(this.meeting))return;const{isError:t,errorMessage:e}=this.getErrorState(),{isLoading:n,loadingMessage:r,showIcon:s}=this.getLoadingState();return $(mt,null,$("div",{class:"player-container h-full max-h-full min-h-full w-full min-w-full max-w-full"},$("div",{ref:async i=>{this.videoContainerRef=i},class:"video-container relative flex h-full w-full flex-col items-center justify-center"},$("video",{onMouseMove:this.onMouseMovePlayer,ref:async i=>{this.videoRef=i,await this.conditionallyStartLivestreamViewer()},id:"livestream-video",class:"livestream-video",controls:!1,onPlay:()=>{this.playerState===uu.PAUSED&&(this.playerState=uu.PLAYING)},onPause:()=>this.playerState=uu.PAUSED}),this.playerState!==uu.IDLE&&!this.hideControls&&$("div",{class:"control-bar"},$("div",{class:"control-groups"},$("rtk-icon",{id:"playPause",onClick:this.togglePlay,size:"lg",class:"control-btn",icon:this.playerState===uu.PLAYING?this.iconPack.pause:this.iconPack.play}),$("rtk-icon",{size:"lg",class:"control-btn",icon:this.iconPack.fastForward,onClick:this.fastForwardToLatest}),$("span",{class:"timings"},F9e(this.currentTime)," /"," ",F9e(this.duration))),$("div",{class:"seekbar-container"},$("div",{class:"seekbar",onMouseDown:this.onSeekbarMouseDown,onClick:this.onSeekbarClick},$("div",{class:"seekbar-track"},$("div",{class:"seekbar-progress",style:{width:`${this.getSeekbarProgress()*100}%`}}),$("div",{class:"seekbar-handle",style:{left:`${this.getSeekbarProgress()*100}%`}})))),$("div",{class:"control-groups"},$("select",{class:"level-select",onChange:i=>this.changeQuality(parseInt(i.target.value))},this.qualityLevels.map(i=>$("option",{value:i.level,selected:this.selectedQuality===i.level},i.resolution))),$("rtk-fullscreen-toggle",{id:"fullscreen",class:"control-btn fullscreen-btn",targetElement:this.videoContainerRef,size:"sm",iconPack:this.iconPack,t:this.t,ref:i=>{var o;const l=document.createElement("style");l.textContent=`
                        rtk-controlbar-button {
                          display: contents;
                          background-color: var(--bg-brand-500);
                          color: var(--text-text-on-brand);
                        }
                      `,(o=i==null?void 0:i.shadowRoot)===null||o===void 0||o.appendChild(l)}})))),this.audioPlaybackError&&$("div",{class:"unmute-popup"},$("h3",null,this.t("audio_playback.title")),$("p",null,this.t("audio_playback.description")),$("rtk-button",{kind:"wide",onClick:()=>{this.audioPlaybackError=!1,this.videoRef&&(this.videoRef.muted=!1,this.videoRef.play(),this.playerState=uu.PLAYING)},title:this.t("audio_playback")},this.t("audio_playback"))),t&&$("div",{class:"loader"},$("rtk-icon",{icon:this.iconPack.warning}),$("p",null,e)),!t&&n&&$("div",{class:"loader"},s&&$("rtk-spinner",{id:"icon",part:"spinner",iconPack:this.iconPack,size:"md"}),$("p",null,r))))}get el(){return Pl(this)}static get watchers(){return{livestreamState:["updateLivestreamId"],meeting:["meetingChanged"]}}};TTe([ge()],kB.prototype,"meeting",void 0);TTe([ge()],kB.prototype,"t",void 0);TTe([ge()],kB.prototype,"iconPack",void 0);kB.style=Jqn;const Xqn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:inline-flex;height:var(--rtk-space-10, 40px);-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center;font-size:14px}:host([data-hidden]){display:none}:host([size='sm']){font-size:12px}rtk-icon{margin-right:var(--rtk-space-1, 4px);height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}:host([size='sm']) rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}:host([variant='embedded']){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));opacity:0.5;margin-top:var(--rtk-space-1, 4px);margin-left:var(--rtk-space-1, 4px);height:var(--rtk-space-5, 20px);border-radius:var(--rtk-border-radius-sm, 4px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);font-size:12px}:host([variant='embedded']) rtk-icon{height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}",eKn=Xqn;var _Te=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const SB=class{constructor(t){kt(this,t),this.variant="primary",this.iconPack=Nt,this.t=It(),this.viewerCount=0,this.disconnectMeeting=e=>{var n;e!=null&&this.countListener!=null&&((n=e.livestream)===null||n===void 0||n.removeListener("viewerCountUpdate",this.countListener))}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.disconnectMeeting(this.meeting)}meetingChanged(t,e){var n;this.disconnectMeeting(e),t!=null&&(this.countListener=()=>{var r;this.viewerCount=(r=t.livestream)===null||r===void 0?void 0:r.viewerCount},this.countListener(),(n=t.livestream)===null||n===void 0||n.addListener("viewerCountUpdate",this.countListener))}render(){return LI(this.meeting)?$(mt,{tabIndex:0,role:"log","aria-label":`${this.viewerCount} ${this.t("viewers")}`},$("rtk-icon",{icon:this.iconPack.viewers,tabIndex:-1,"aria-hidden":!0,part:"icon"}),this.viewerCount," ",this.t("viewers")):$(mt,{"data-hidden":!0})}static get watchers(){return{meeting:["meetingChanged"]}}};_Te([ge()],SB.prototype,"meeting",void 0);_Te([ge()],SB.prototype,"iconPack",void 0);_Te([ge()],SB.prototype,"t",void 0);SB.style=eKn;var tKn=Object.freeze({__proto__:null,rtk_livestream_indicator:wB,rtk_livestream_player:kB,rtk_viewer_count:SB});const nKn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:inline-flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center;padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-1\\.5, 6px);font-size:14px;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}span.name{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}::slotted(rtk-audio-visualizer[slot='start']){margin-right:var(--rtk-space-1\\.5, 6px)}::slotted(rtk-audio-visualizer[slot='end']){margin-left:var(--rtk-space-1\\.5, 6px)}:host([size='sm']){font-size:12px;--tw-bg-opacity:0.6}:host([variant='text']){background-color:transparent;padding:var(--rtk-space-0, 0px)}",rKn=nKn;var ATe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const CB=class{constructor(e){kt(this,e),this.isScreenShare=!1,this.variant="default",this.iconPack=Nt,this.t=It(),this.length=13}sizeChanged(e){this.length=e==="sm"?8:13}formatNameTag(e,n){return this.isScreenShare?n?`${this.t("screen")} - ${pm(e,this.length-3)} (${this.t("you")})`:`${this.t("screen")} - ${pm(e,this.length)}`:n?`${pm(e,this.length-3)} (${this.t("you")})`:pm(e,this.length)}render(){var e,n,r;const s=Rf(((e=this.participant)===null||e===void 0?void 0:e.name)||""),i=((n=this.participant)===null||n===void 0?void 0:n.id)===((r=this.meeting)===null||r===void 0?void 0:r.self.id);return $(mt,{key:"9040aabe429bea4cfcdc7a6635eeb336f2154961",title:s},$("slot",{key:"f66091f5af1914e91e14415a4758f9bdc15c0c85",name:"start"}),$("span",{key:"241ca42f60b258c5b3c20f423e9ade272f8f5a8b",class:"name"},this.formatNameTag(s,i)),$("slot",{key:"7f6f9b8e5c2ea76042a0ff812458af6ed702b43d",name:"end"}))}static get watchers(){return{size:["sizeChanged"]}}};ATe([ge()],CB.prototype,"meeting",void 0);ATe([ge()],CB.prototype,"iconPack",void 0);ATe([ge()],CB.prototype,"t",void 0);CB.style=rKn;var sKn=Object.freeze({__proto__:null,rtk_name_tag:CB});const iKn=t=>$("a",{class:"link",href:t,target:"_blank",rel:"noopener noreferrer"},t),aKn=t=>typeof t=="string"?$("b",null,t):$("b",null,OR(t)),oKn=t=>typeof t=="string"?$("i",null,t):$("i",null,OR(t)),lKn=t=>typeof t=="string"?$("s",null,t):$("b",null,OR(t)),cKn=t=>typeof t=="string"?t:$("p",null,OR(t)),OR=t=>t.map(e=>{switch(e.type){case"a":if(typeof e.content=="string")return iKn(e.content);case"b":return aKn(e.content);case"i":return oKn(e.content);case"s":return lKn(e.content);case"q":return $("span",{class:"block-quote"});case"plain_text":default:return cKn(e.content)}}),Rwt=({message:t})=>{const e=t.slice(0,k6),n=ENe(e,!0),r=NNe(e);return $("p",null,n.length!==0&&$("blockquote",null,n.split(`
`).map(s=>{const i=gbe(s);return $("p",null,OR(i))})),r.split(`
`).map(s=>{const i=gbe(s);return $("p",null,OR(i))}))},dKn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{pointer-events:none;display:block;height:var(--rtk-space-10, 40px);color:rgb(var(--rtk-colors-text-1000, 255 255 255));animation:show 0.4s ease;transition:0.4s;z-index:100}.ctr{box-sizing:border-box;display:inline-flex;height:100%;min-width:var(--rtk-space-40, 160px);align-items:center;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-2, 8px);-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);--tw-shadow-color:rgb(var(--rtk-colors-background-1000, 8 8 8));--tw-shadow:var(--tw-shadow-colored);pointer-events:auto}img{margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-0, 0px);width:var(--rtk-space-0, 0px);border-radius:9999px}img.loaded{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}.message{margin-right:var(--rtk-space-2, 8px);max-width:var(--rtk-space-72, 288px) !important;font-size:14px !important;overflow:hidden !important;display:-webkit-box !important;-webkit-box-orient:vertical !important;-webkit-line-clamp:2 !important}.message p{margin:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-1, 4px)}.message blockquote{display:none}rtk-icon.icon{margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}button.dismiss{display:flex;height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px);align-items:center;justify-content:center;border-width:var(--rtk-border-width-none, 0);border-style:none;padding:var(--rtk-space-0, 0px);border-radius:var(--rtk-border-radius-sm, 4px);background-color:transparent;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));outline-width:1px;outline-color:rgb(var(--rtk-colors-text-1000, 255 255 255))}button.dismiss:hover{cursor:pointer;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}button.dismiss:focus-visible{outline-style:solid}button.dismiss{transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}.dismiss rtk-icon{height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px)}rtk-button{border-radius:var(--rtk-border-radius-sm, 4px)}.right{margin-left:auto;display:flex;align-items:center;gap:var(--rtk-space-2, 8px)}:host(.exit){animation:exit 0.4s ease}@keyframes show{0%{opacity:0;transform:translateX(-120px)}100%{opacity:1;transform:translateX(0px)}}@keyframes exit{0%{opacity:1;transform:translateX(0)}100%{opacity:0;transform:translateX(-120px)}}:host([size='sm']){font-size:14px}",uKn=dKn;var Iwt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const yre=class{constructor(t){kt(this,t),this.dismiss=Wt(this,"rtkNotificationDismiss",7),this.iconPack=Nt,this.t=It(),this.imageState="loading"}connectedCallback(){this.notificationChanged(this.notification)}pausedChanged(t){t?clearTimeout(this.timeout):this.notificationChanged(this.notification)}notificationChanged(t){t!=null&&typeof t.duration=="number"&&!this.paused&&(this.timeout=window.setTimeout(()=>{this.dismiss.emit(t.id)},t.duration))}render(){var t;return $(mt,{key:"f8ddbd9e32a05c36d3b7ea8d1589bba1b6009fab"},$("div",{key:"61fe82306da70295f9530edf9acdb28d891ae9d5",class:"ctr"},this.notification.icon!=null&&$("rtk-icon",{key:"59cb7c56120f3c3d52fc9d39c7e1c7066d7f5d72",class:"icon",icon:this.notification.icon,variant:(t=this.notification.iconVariant)!==null&&t!==void 0?t:"primary"}),this.notification.image!=null&&this.notification.icon==null&&this.imageState!=="errored"&&$("img",{key:"3dce9047059aa31989e0205f1fe20abade6b56f7",src:this.notification.image,class:{loaded:this.imageState==="loaded"},onLoad:()=>this.imageState="loaded",onError:()=>this.imageState="errored"}),$("p",{key:"eaf2809d755002b226552111f52e5d6ec35f1731",class:"message"},$(Rwt,{key:"5fc9377a438bcb3fe70d8ad85d753ed30123204c",message:this.notification.message})),$("div",{key:"5d4562cd5dd565b107f39b1eb0cbbd400281082b",class:"right"},this.notification.button!=null&&$("rtk-button",{key:"f21316499b4f85b4ab7b3b1194c8014b969f2358",size:"sm",variant:this.notification.button.variant,onClick:()=>this.notification.button.onClick()},this.notification.button.text),$("button",{key:"299be899a5cd4e7e23b9e0006e69d030b5f06b10",onClick:()=>this.dismiss.emit(this.notification.id),class:"dismiss"},$("rtk-icon",{key:"ef56fd50689c3166a3f6f7f8cebb2ed9d902dc3d","aria-label":this.t("dismiss"),icon:this.iconPack.dismiss})))))}static get watchers(){return{paused:["pausedChanged"],notification:["notificationChanged"]}}};Iwt([ge()],yre.prototype,"iconPack",void 0);Iwt([ge()],yre.prototype,"t",void 0);yre.style=uKn;var hKn=Object.freeze({__proto__:null,rtk_notification:yre});const mKn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;width:100%;flex-direction:column;font-size:14px}.participants-container{margin-bottom:var(--rtk-space-4, 16px);height:100%;width:100%}h3,.heading-count{margin:var(--rtk-space-0, 0px);display:flex;align-items:center;justify-content:center;padding:var(--rtk-space-0, 0px);font-size:16px;font-weight:400;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));text-align:center}.heading-count{font-size:14px}.participants{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.empty-stage-list{margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-4, 16px);text-align:center;font-size:12px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}rtk-participant{width:100%}",fKn=mKn;var jB=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const gN=class{constructor(t){kt(this,t),this.config=Os(),this.hideHeader=!1,this.iconPack=Nt,this.view="sidebar",this.t=It(),this.search="",this.participants=[],this.createParticipantNode=e=>{const n={meeting:this.meeting,view:this.view,t:this.t,config:this.config,states:this.states,size:this.size,iconPack:this.iconPack};return $("div",null,$(tc,{element:"rtk-participant",defaults:n,props:{role:"listitem",participant:e,key:e.id},childProps:Object.assign(Object.assign({},n),{participant:e,size:this.size}),deepProps:!0}))},this.updateStageList=()=>{this.getParticipants(this.search)}}connectedCallback(){this.meetingChanged(this.meeting),this.searchChanged(this.search)}disconnectedCallback(){if(!this.meeting)return;const{participants:t,stage:e}=this.meeting;this.participantJoinedListener&&this.meeting.participants.joined.removeListener("participantJoined",this.participantJoinedListener),this.participantLeftListener&&this.meeting.participants.joined.removeListener("participantLeft",this.participantLeftListener),t.joined.removeListener("stageStatusUpdate",this.updateStageList),e==null||e.removeListener("stageStatusUpdate",this.updateStageList)}meetingChanged(t){t&&(this.participantJoinedListener=e=>{if(e.stageStatus!=="ON_STAGE")return;const n=this.search.toLowerCase();!e.name.toLowerCase().includes(n)||!e.id.toLowerCase().includes(n)||(this.participants=[...this.participants.filter(r=>r.id!==e.id),e])},this.participantLeftListener=e=>{this.participants=this.participants.filter(n=>n.id!==e.id)},t.participants.joined.addListener("participantJoined",this.participantJoinedListener),t.participants.joined.addListener("participantLeft",this.participantLeftListener),this.updateStageList(),t==null||t.participants.joined.on("stageStatusUpdate",this.updateStageList),t==null||t.stage.on("stageStatusUpdate",this.updateStageList))}searchChanged(t){this.getParticipants(t)}getParticipants(t=this.search){let e=this.meeting.stage.status==="ON_STAGE"?[this.meeting.self]:[];e=[...e,...this.meeting.participants.joined.toArray().filter(n=>n.stageStatus==="ON_STAGE")],t===""?this.participants=e:this.participants=e.filter(n=>{var r;return((r=n.name)!==null&&r!==void 0?r:n.id).toLowerCase().includes(t.toLowerCase())})}render(){return $(mt,{key:"1beca8f05d4f78a269317b333a00946ac642af00"},$("div",{key:"7d54d4187eb8478ddfdc632b42af4875afd1a158",class:"participants-container"},!this.hideHeader&&$("div",{key:"ecaa9721738cc020fe4aa1f966d2450f0f9d8e01",class:"heading-count",part:"heading-count"},this.t("participants")," (",this.participants.length,")"),$("rtk-virtualized-participant-list",{key:"8d12273242c1f9081e199fd189060addf28c45a6",items:this.participants,renderItem:this.createParticipantNode,part:"participants",class:"participants",emptyListElement:$("div",{class:"empty-stage-list"},this.search.length>0?this.t("search.could_not_find"):this.t("search.empty"))})))}static get watchers(){return{meeting:["meetingChanged"],search:["searchChanged"]}}};jB([ge()],gN.prototype,"meeting",void 0);jB([ge()],gN.prototype,"states",void 0);jB([ge()],gN.prototype,"config",void 0);jB([ge()],gN.prototype,"iconPack",void 0);jB([ge()],gN.prototype,"t",void 0);gN.style=fKn;const pKn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{margin-top:var(--rtk-space-2, 8px);display:flex;width:100%;flex-direction:column;font-size:14px}.stage-requested-participants{margin-bottom:var(--rtk-space-8, 32px)}.stage-requested-participants .bulk-actions{display:flex;gap:var(--rtk-space-2, 8px)}.stage-requested-participants .bulk-actions .accept-all-button{--tw-text-opacity:1;color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-text-opacity))}.stage-requested-participants .bulk-actions rtk-button{flex:1 1 0%}h3,.heading-count{margin:var(--rtk-space-0, 0px);display:flex;align-items:center;justify-content:center;padding:var(--rtk-space-0, 0px);font-size:16px;font-weight:400;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));text-align:center}.heading-count{font-size:14px}.participants{margin-top:var(--rtk-space-2, 8px);padding:var(--rtk-space-0, 0px)}.waiting-participant{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);display:flex;align-items:center}.waiting-participant .participant-details{margin-right:auto;display:flex;align-items:center}.waiting-participant .participant-details rtk-avatar{margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);flex-shrink:0;font-size:14px}.waiting-participant .participant-details .name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}@media (min-width: 1080px){.waiting-participant .participant-details .name{max-width:var(--rtk-space-40, 160px)}}.waiting-participant .waitlist-controls{display:flex}.waiting-participant .waitlist-controls rtk-button{margin-left:var(--rtk-space-2, 8px);cursor:pointer;border-radius:var(--rtk-border-radius-sm, 4px)}.waiting-participant .waitlist-controls rtk-icon.accept{--tw-text-opacity:1;color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-text-opacity))}.waiting-participant .waitlist-controls rtk-icon.deny{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}",gKn=pKn;var bre=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const cM=class{constructor(t){kt(this,t),this.config=Os(),this.iconPack=Nt,this.view="sidebar",this.t=It(),this.stageRequestedParticipants=[],this.updateStageRequestedParticipants=()=>{this.stageRequestedParticipants=this.meeting.participants.joined.toArray().filter(e=>e.stageStatus==="REQUESTED_TO_JOIN_STAGE")},this.acceptStageRequest=async e=>{const{userId:n}=e;await this.meeting.stage.grantAccess([n])},this.rejectStageRequest=async e=>{const{userId:n}=e;await this.meeting.stage.denyAccess([n])},this.acceptAllStageRequest=async()=>{await this.meeting.stage.grantAccess(this.stageRequestedParticipants.map(e=>e.userId))},this.denyAllStageRequest=async()=>{var e;await((e=this.meeting.stage)===null||e===void 0?void 0:e.denyAccess(this.stageRequestedParticipants.map(n=>n.userId)))},this.shouldShowStageRequests=()=>this.meeting.self.permissions.stageEnabled&&this.meeting.self.permissions.acceptStageRequests&&this.stageRequestedParticipants.length>0,this.updateRequestList=async e=>{var n,r,s,i,o,l,c;if(!this.meeting.self.permissions.acceptStageRequests||!this.meeting.self.permissions.stageEnabled){this.stageRequestedParticipants=[];return}this.meeting.meta.viewType==="LIVESTREAM"||((s=(r=(n=this.meeting)===null||n===void 0?void 0:n.self)===null||r===void 0?void 0:r.permissions)===null||s===void 0?void 0:s.mediaRoomType)==="HIVE"?(e||(e=(l=(o=await((i=this.meeting.stage)===null||i===void 0?void 0:i.getAccessRequests()))===null||o===void 0?void 0:o.stageRequests)!==null&&l!==void 0?l:[]),this.stageRequestedParticipants=e.map(d=>Object.assign(Object.assign({},d),{name:d.displayName}))):this.stageRequestedParticipants=(c=[this.meeting.self,...this.meeting.participants.joined.toArray()])===null||c===void 0?void 0:c.filter(d=>d.stageStatus==="REQUESTED_TO_JOIN_STAGE")}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var t;const{stage:e}=this.meeting;e==null||e.removeListener("stageAccessRequestUpdate",this.updateRequestList),(t=this.meeting.participants.joined)===null||t===void 0||t.removeListener("stageStatusUpdate",this.updateStageRequestedParticipants)}meetingChanged(t){var e;t&&(this.updateRequestList(),t.participants.joined.on("stageStatusUpdate",this.updateStageRequestedParticipants),(e=t.stage)===null||e===void 0||e.on("stageAccessRequestUpdate",this.updateRequestList))}render(){if(!this.meeting)return null;if(!(this.view!=="sidebar"||!this.shouldShowStageRequests()))return $("div",{class:"stage-requested-participants"},$("div",{class:"heading-count",part:"staged-heading-count"},this.t("stage_request.header_title")," (",this.stageRequestedParticipants.length,")"),$("ul",{class:"participants",part:"staged-participants"},this.stageRequestedParticipants.map(t=>$("li",{class:"waiting-participant",key:t.id},$("div",{class:"participant-details"},$("rtk-avatar",{participant:t,size:"sm",iconPack:this.iconPack,t:this.t}),$("p",{class:"name",title:t.name},t.name)),$("div",{class:"waitlist-controls"},$("rtk-tooltip",{label:this.t("stage_request.deny_request"),variant:"secondary"},$("rtk-button",{variant:"secondary",kind:"icon",onClick:()=>this.rejectStageRequest(t)},$("rtk-icon",{class:"deny",icon:this.iconPack.dismiss}))),$("rtk-tooltip",{label:this.t("stage_request.accept_request"),variant:"secondary"},$("rtk-button",{variant:"secondary",kind:"icon",onClick:()=>this.acceptStageRequest(t)},$("rtk-icon",{class:"accept",icon:this.iconPack.checkmark}))))))),$("div",{class:"bulk-actions"},$("rtk-button",{class:"accept-all-button",variant:"secondary",onClick:this.acceptAllStageRequest},this.t("stage_request.accept_all")),$("rtk-button",{class:"deny-all-button",variant:"danger",onClick:this.denyAllStageRequest},this.t("stage_request.deny_all"))))}static get watchers(){return{meeting:["meetingChanged"]}}};bre([ge()],cM.prototype,"meeting",void 0);bre([ge()],cM.prototype,"config",void 0);bre([ge()],cM.prototype,"iconPack",void 0);bre([ge()],cM.prototype,"t",void 0);cM.style=gKn;const vKn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;height:100%;width:100%;flex-direction:column;font-size:14px}.list{margin-bottom:var(--rtk-space-4, 16px);display:flex;height:100%;flex-direction:column}h3,.heading-count{margin:var(--rtk-space-0, 0px);align-items:center;justify-content:center;padding:var(--rtk-space-0, 0px);font-size:16px;font-weight:400;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));text-align:center}.heading-count{font-size:14px}.participants{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.empty-viewers-list{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);text-align:center;font-size:12px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}",yKn=vKn;var xre=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const dM=class{constructor(t){kt(this,t),this.updateStageViewers=()=>{this.getViewers(this.search)},this.config=Os(),this.hideHeader=!1,this.iconPack=Nt,this.view="sidebar",this.search="",this.t=It(),this.stageViewers=[],this.createParticipantNode=e=>$("rtk-participant",{role:"listitem",key:e.id,meeting:this.meeting,participant:e,view:this.view,iconPack:this.iconPack,config:this.config,t:this.t}),this.shouldShowViewers=()=>{var e,n,r;return(r=(n=(e=this.meeting)===null||e===void 0?void 0:e.self)===null||n===void 0?void 0:n.permissions)===null||r===void 0?void 0:r.stageEnabled}}connectedCallback(){this.meetingChanged(this.meeting),this.searchChanged(this.search)}meetingChanged(t){t&&(this.participantJoinedListener=e=>{if(e.stageStatus==="ON_STAGE")return;const n=this.search.toLowerCase();n.length>0&&!e.name.toLowerCase().includes(n)||(this.stageViewers=[...this.stageViewers.filter(r=>r.id!==e.id),e])},this.participantLeftListener=e=>{this.stageViewers=this.stageViewers.filter(n=>n.id!==e.id)},t.participants.joined.addListener("participantJoined",this.participantJoinedListener),t.participants.joined.addListener("participantLeft",this.participantLeftListener),t.participants.joined.on("stageStatusUpdate",this.updateStageViewers),t.stage.on("stageStatusUpdate",this.updateStageViewers))}searchChanged(t){this.getViewers(t)}disconnectedCallback(){const{participants:t,stage:e}=this.meeting;this.participantJoinedListener&&this.meeting.participants.joined.removeListener("participantJoined",this.participantJoinedListener),this.participantLeftListener&&this.meeting.participants.joined.removeListener("participantLeft",this.participantLeftListener),t.joined.removeListener("stageStatusUpdate",this.updateStageViewers),e.removeListener("stageStatusUpdate",this.updateStageViewers)}getViewers(t){let e=this.meeting.stage.status==="ON_STAGE"?[]:[this.meeting.self];e=[...e,...this.meeting.participants.joined.toArray()].filter(n=>n.stageStatus!=="ON_STAGE"),t===""?this.stageViewers=e:this.stageViewers=e.filter(n=>{var r;return((r=n.name)!==null&&r!==void 0?r:n.id).toLowerCase().includes(t.toLowerCase())})}render(){if(!this.meeting)return null;if(!(this.view!=="sidebar"||!this.shouldShowViewers()))return $("div",{class:"list"},!this.hideHeader&&$("div",{class:"heading-count",part:"heading-count"},this.t("viewers")," (",this.stageViewers.length,")"),$("rtk-virtualized-participant-list",{items:this.stageViewers,renderItem:this.createParticipantNode,class:"participants",part:"participants",style:{height:"100%"},emptyListElement:$("div",{class:"empty-viewers-list"},this.search.length>0?this.t("participants.errors.empty_results"):this.t("participants.empty_list"))}))}static get watchers(){return{meeting:["meetingChanged"],search:["searchChanged"]}}};xre([ge()],dM.prototype,"meeting",void 0);xre([ge()],dM.prototype,"config",void 0);xre([ge()],dM.prototype,"iconPack",void 0);xre([ge()],dM.prototype,"t",void 0);dM.style=yKn;const bKn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{margin-top:var(--rtk-space-4, 16px);margin-bottom:calc(var(--rtk-space-2, 8px) * -1);display:flex;width:100%;flex-direction:column;font-size:14px}.waiting-participants{margin-bottom:var(--rtk-space-8, 32px)}.waiting-participants .accept-all-button{--tw-text-opacity:1;color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-text-opacity))}h3,.heading-count{margin:var(--rtk-space-0, 0px);display:flex;align-items:center;justify-content:center;padding:var(--rtk-space-0, 0px);font-size:16px;font-weight:400;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));text-align:center}.heading-count{font-size:14px}.participants{margin-top:var(--rtk-space-2, 8px);padding:var(--rtk-space-0, 0px)}.waiting-participant{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);display:flex;align-items:center}.waiting-participant .participant-details{margin-right:auto;display:flex;align-items:center}.waiting-participant .participant-details rtk-avatar{margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);flex-shrink:0;font-size:14px}.waiting-participant .participant-details .name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}@media (min-width: 1080px){.waiting-participant .participant-details .name{max-width:var(--rtk-space-40, 160px)}}.waiting-participant .waitlist-controls{display:flex}.waiting-participant .waitlist-controls rtk-button{margin-left:var(--rtk-space-2, 8px);cursor:pointer;border-radius:var(--rtk-border-radius-sm, 4px)}.waiting-participant .waitlist-controls rtk-icon.accept{--tw-text-opacity:1;color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-text-opacity))}.waiting-participant .waitlist-controls rtk-icon.deny{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}",xKn=bKn;var wre=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const uM=class{constructor(t){kt(this,t),this.config=Os(),this.iconPack=Nt,this.view="sidebar",this.t=It(),this.acceptWaitingRoomRequest=async e=>{await this.meeting.participants.acceptWaitingRoomRequest(e)},this.waitlistedParticipants=[],this.acceptAllWaitingRoomRequests=async()=>{await this.meeting.participants.acceptAllWaitingRoomRequest(this.waitlistedParticipants.map(e=>e.id))},this.rejectWaitingRoomRequest=async e=>{await this.meeting.participants.rejectWaitingRoomRequest(e)},this.shouldShowWaitlist=()=>this.meeting.meta.viewType==="LIVESTREAM"?!1:this.meeting.self.permissions.acceptWaitingRequests&&this.waitlistedParticipants.length!==0}disconnectedCallback(){const{participants:t}=this.meeting;this.waitlistedParticipantJoinedListener&&t.waitlisted.removeListener("participantJoined",this.waitlistedParticipantJoinedListener),this.waitlistedParticipantLeftListener&&t.waitlisted.removeListener("participantLeft",this.waitlistedParticipantLeftListener),this.waitlistedParticipantsClearedListener&&t.waitlisted.removeListener("participantsCleared",this.waitlistedParticipantsClearedListener)}connectedCallback(){this.meetingChanged(this.meeting)}meetingChanged(t){t&&(this.waitlistedParticipants=t.participants.waitlisted.toArray(),this.waitlistedParticipantJoinedListener=e=>{this.waitlistedParticipants.some(n=>n.id===e.id)||(this.waitlistedParticipants=[...this.waitlistedParticipants,e])},this.waitlistedParticipantLeftListener=e=>{this.waitlistedParticipants=this.waitlistedParticipants.filter(n=>n.id!==e.id)},this.waitlistedParticipantsClearedListener=()=>{this.waitlistedParticipants=[]},t.participants.waitlisted.addListener("participantJoined",this.waitlistedParticipantJoinedListener),t.participants.waitlisted.addListener("participantLeft",this.waitlistedParticipantLeftListener),t.participants.waitlisted.addListener("participantsCleared",this.waitlistedParticipantsClearedListener))}render(){if(!(this.view!=="sidebar"||!this.shouldShowWaitlist()))return $("div",{class:"waiting-participants"},$("div",{class:"heading-count",part:"waitlisted-heading-count"},this.t("waitlist.header_title")," (",this.waitlistedParticipants.length,")"),$("ul",{class:"participants",part:"waitlisted-participants"},this.waitlistedParticipants.map(t=>$("li",{class:"waiting-participant",key:t.id},$("div",{class:"participant-details"},$("rtk-avatar",{participant:t,size:"sm",iconPack:this.iconPack,t:this.t}),$("p",{class:"name",title:t.name},t.name)),$("div",{class:"waitlist-controls"},$("rtk-tooltip",{label:this.t("waitlist.deny_request"),variant:"secondary"},$("rtk-button",{variant:"secondary",kind:"icon",onClick:()=>this.rejectWaitingRoomRequest(t.id)},$("rtk-icon",{class:"deny",icon:this.iconPack.dismiss}))),$("rtk-tooltip",{label:this.t("waitlist.accept_request"),variant:"secondary"},$("rtk-button",{variant:"secondary",kind:"icon",onClick:()=>this.acceptWaitingRoomRequest(t.id)},$("rtk-icon",{class:"accept",icon:this.iconPack.checkmark}))))))),$("rtk-button",{class:"accept-all-button",variant:"secondary",kind:"wide",onClick:this.acceptAllWaitingRoomRequests},this.t("waitlist.accept_all")))}static get watchers(){return{meeting:["meetingChanged"]}}};wre([ge()],uM.prototype,"meeting",void 0);wre([ge()],uM.prototype,"config",void 0);wre([ge()],uM.prototype,"iconPack",void 0);wre([ge()],uM.prototype,"t",void 0);uM.style=xKn;var wKn=Object.freeze({__proto__:null,rtk_participants_stage_list:gN,rtk_participants_stage_queue:cM,rtk_participants_viewer_list:dM,rtk_participants_waiting_list:uM});const kKn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;height:100%;width:100%;flex-direction:column;overflow:hidden;border-radius:var(--rtk-border-radius-lg, 12px);color:rgb(var(--rtk-colors-text-1000, 255 255 255))}header{display:flex;height:var(--rtk-space-8, 32px);align-items:center;justify-content:space-between;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}header>div{display:flex;align-items:center}rtk-button{display:flex;height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px);flex-direction:column;align-items:center;border-radius:9999px}rtk-button rtk-icon{height:var(--rtk-space-3, 12px);width:var(--rtk-space-3, 12px)}.view-container{position:relative;height:100%;width:100%;overflow:hidden;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-video-bg, 24 24 24) / var(--tw-bg-opacity))}.view-container ::slotted(*){width:100%;height:100%;display:block}",SKn=kKn;var PTe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const EB=class{constructor(t){kt(this,t),this.iconPack=Nt,this.t=It(),this.canDeactivatePlugin=!1}connectedCallback(){this.pluginChanged(this.plugin)}pluginChanged(t){var e,n;t!=null&&(this.canDeactivatePlugin=(n=(e=t.permissions)===null||e===void 0?void 0:e.canDeactivate)!==null&&n!==void 0?n:!1,this.attachView(t))}attachView(t){const e=t.component;if(e instanceof HTMLElement&&this.host.firstElementChild!==e){for(;this.host.firstChild;)this.host.removeChild(this.host.firstChild);this.host.appendChild(e)}}disconnectedCallback(){for(;this.host.firstChild;)this.host.removeChild(this.host.firstChild)}render(){return this.plugin==null?null:$(mt,null,$("header",{part:"header"},$("div",null,this.plugin.name),this.canDeactivatePlugin&&$("div",null,$("rtk-button",{kind:"icon",onClick:()=>this.plugin.deactivate(),part:"button"},$("rtk-icon",{icon:this.iconPack.dismiss})))),$("div",{class:"view-container"},$("slot",null)))}get host(){return Pl(this)}static get watchers(){return{plugin:["pluginChanged"]}}};PTe([ge()],EB.prototype,"meeting",void 0);PTe([ge()],EB.prototype,"iconPack",void 0);PTe([ge()],EB.prototype,"t",void 0);EB.style=SKn;const CKn=`.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{box-sizing:border-box;display:flex;height:100%;width:var(--rtk-space-16, 64px);flex-direction:column;gap:var(--rtk-space-2, 8px);overflow-y:auto;font-family:var(--rtk-font-family, sans-serif)}rtk-button{z-index:10}.col{display:flex;flex-direction:column;align-items:center}.tab{display:flex;height:var(--rtk-space-16, 64px);width:var(--rtk-space-16, 64px);align-items:center;justify-content:center;margin-bottom:var(--rtk-space-2, 8px);font-size:12px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}.tab.active{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity))}.tab img{height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px);border-radius:var(--rtk-border-radius-sm, 4px)}.tab .name{margin-top:var(--rtk-space-0\\.5, 2px)}:host([size='sm']){flex-direction:column;margin-top:var(--rtk-space-4, 16px);height:var(--rtk-space-16, 64px);width:100%;flex-direction:row;gap:var(--rtk-space-2, 8px);overflow-x:auto}:host([size='sm']) .tab{margin:var(--rtk-space-0, 0px);text-overflow:clip;min-width:100px;height:40px}:host([size='sm']) .tab .col{display:flex;flex-direction:row;align-items:center;gap:var(--rtk-space-2, 8px)}:host([size='sm']) .tab .col img,:host([size='sm']) .tab .col rtk-icon{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}:host([size='sm']) .tab .col .name{gap:var(--rtk-space-1, 4px)}:host([layout='column']){flex-direction:column}:host([layout='column']) .aside{flex:2;max-width:100%;width:100%}@media (orientation: portrait){:host([size='sm']){margin-top:var(--rtk-space-2, 8px);height:var(--rtk-space-16, 64px);width:100%;flex-direction:row;transition:all 0.3s linear}:host([size='md']){height:var(--rtk-space-24, 96px);width:100%;flex-direction:row;transition:all 0.3s linear}:host .tab{margin:var(--rtk-space-0, 0px)}}@media (orientation: landscape){:host([size='sm']){margin-right:var(--rtk-space-4, 16px);height:100%;width:var(--rtk-space-14, 56px);flex-direction:row;gap:var(--rtk-space-2, 8px);overflow-y:auto;overflow-x:hidden;transition:all 0.3s linear}:host([size='md']){margin-right:var(--rtk-space-4, 16px);height:100%;width:var(--rtk-space-14, 56px);flex-direction:row;gap:var(--rtk-space-2, 8px);overflow-y:auto;overflow-x:hidden;transition:all 0.3s linear}:host .tab{margin:var(--rtk-space-0, 0px)}:host([size='sm']) .tab{margin:var(--rtk-space-0, 0px);width:100%;text-overflow:clip;min-width:0px;min-height:40px}:host([size='sm']) .tab .col{display:flex;flex-direction:column;align-items:center;gap:var(--rtk-space-2, 8px);font-size:10px}:host([size='sm']) .tab .col img,:host([size='sm']) .tab .col rtk-icon{height:var(--rtk-space-3, 12px);width:var(--rtk-space-3, 12px)}:host([size='sm']) .tab .col .name{gap:var(--rtk-space-1, 4px)}}`,jKn=CKn;var NB=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const vN=class{constructor(t){kt(this,t),this.tabChange=Wt(this,"tabChange",7),this.config=Os(),this.layout="row",this.iconPack=Nt,this.t=It(),this.tabs=[]}render(){return $(mt,{key:"1c4bce26c4c5baa19cd89be862922267c408ab97"},$("rtk-spotlight-indicator",{key:"496f3634771c4b9c94ff64e23fa5695e2e1532e2",meeting:this.meeting,iconPack:this.iconPack,t:this.t,size:this.size}),this.tabs.map(t=>{var e,n,r,s,i;let o=!1;if((((e=this.activeTab)===null||e===void 0?void 0:e.type)==="plugin"&&t.plugin&&((n=this.activeTab)===null||n===void 0?void 0:n.plugin.id)===t.plugin.id||((r=this.activeTab)===null||r===void 0?void 0:r.type)==="screenshare"&&t.participant&&((s=this.activeTab)===null||s===void 0?void 0:s.participant.id)===t.participant.id)&&(o=!0),t.type==="screenshare"){const l=t.participant,c=Rf(l.name);return $("rtk-button",{title:`${c}'s Screen Share`,key:t.participant.id,kind:"icon",variant:o?"primary":"secondary",class:{tab:!0,active:o},onClick:()=>this.tabChange.emit(t)},$("div",{class:"center col"},$("rtk-icon",{icon:this.iconPack.share_screen_person}),$("span",{class:"name"},l.id===((i=this.meeting)===null||i===void 0?void 0:i.self.id)?this.t("you"):pm(c,6))))}else if(t.type==="plugin"){const l=t.plugin;return $("rtk-button",{title:l.name,key:l.id,kind:"icon",variant:o?"primary":"secondary",class:{tab:!0,active:o},onClick:()=>this.tabChange.emit(t)},$("div",{class:"center col"},$("img",{src:l.icon,alt:l.name}),$("span",{class:"name"},pm(l.name,6))))}}))}};NB([ge()],vN.prototype,"meeting",void 0);NB([ge()],vN.prototype,"states",void 0);NB([ge()],vN.prototype,"config",void 0);NB([ge()],vN.prototype,"iconPack",void 0);NB([ge()],vN.prototype,"t",void 0);vN.style=jKn;var EKn=Object.freeze({__proto__:null,rtk_plugin_main:EB,rtk_tab_bar:vN});const NKn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;width:100%;flex-direction:column}audio{visibility:hidden}.group{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px)}.group>*{margin-bottom:var(--rtk-space-2, 8px)}.group>*:last-child{margin-bottom:var(--rtk-space-0, 0px)}.group select{flex:1 1 0%}.row{display:flex;align-items:center;justify-content:space-between;gap:var(--rtk-space-3, 12px)}rtk-audio-visualizer{flex-shrink:0}rtk-button{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));--tw-shadow:0 0 #0000;--tw-shadow-colored:0 0 #0000;box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow)}rtk-button rtk-icon{margin-right:var(--rtk-space-2, 8px)}",TKn=NKn;var kre=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const hM=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.iconPack=Nt,this.t=It()}render(){var t,e;if(!this.meeting)return null;const n={meeting:this.meeting,states:this.states,size:this.size,iconPack:this.iconPack,t:this.t},r=this.states,s=((t=r==null?void 0:r.prefs)===null||t===void 0?void 0:t.muteNotificationSounds)===!0||Rbt("mute-notification-sounds")==="true";return $(mt,null,$("rtk-microphone-selector",Object.assign({},n),$("rtk-audio-visualizer",{participant:(e=this.meeting)===null||e===void 0?void 0:e.self,iconPack:this.iconPack,t:this.t,slot:"indicator"})),$("rtk-speaker-selector",Object.assign({},n)),$("div",{class:"group",part:"notification-toggle"},$("div",{class:"row"},$("label",{htmlFor:"notification-toggle"},this.t("settings.notification_sound")),$("rtk-switch",{id:"notification-toggle",checked:!s,onRtkChange:i=>{const{checked:o}=i.target,l=!o;this.stateUpdate.emit({prefs:{muteNotificationSounds:l}}),Pbt("mute-notification-sounds",l)},iconPack:this.iconPack,t:this.t}))))}};kre([ge()],hM.prototype,"meeting",void 0);kre([ge()],hM.prototype,"states",void 0);kre([ge()],hM.prototype,"iconPack",void 0);kre([ge()],hM.prototype,"t",void 0);hM.style=TKn;const _Kn=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.rtk-select{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.rtk-select:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.rtk-select{display:block;border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:var(--rtk-space-3, 12px);font-size:16px;--icon-size:var(--rtk-select-chevron-size, var(--rtk-space-6, 24px));--icon-right-position:var(--rtk-select-chevron-right-position, var(--rtk-space-2, 8px));background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");background-position:right var(--icon-right-position) center;background-repeat:no-repeat;background-size:var(--icon-size) var(--icon-size);padding-right:calc(var(--icon-right-position) * 5)}:host{display:flex;width:100%;flex-direction:column}.rtk-select{width:100%;text-overflow:ellipsis}rtk-participant-tile{margin-left:auto;margin-right:auto;margin-bottom:var(--rtk-space-4, 16px);max-width:100%}#icon{padding-bottom:var(--rtk-space-1, 4px)}.apply-button{height:var(--rtk-space-10, 40px)}label{-webkit-user-select:none;-moz-user-select:none;user-select:none;font-size:14px}.group{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px)}.group>*{margin-bottom:var(--rtk-space-2, 8px)}.group>*:last-child{margin-bottom:var(--rtk-space-0, 0px)}.group select{flex:1 1 0%}.row{display:flex;align-items:center;justify-content:space-between;gap:var(--rtk-space-3, 12px)}.section{display:flex;flex-direction:column}@media only screen and (max-height: 480px) and (orientation: landscape){:host{flex-direction:row}:host([size='sm']){flex-direction:row}.section[part='tile-preview']{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);max-height:90%;max-width:40%;flex-shrink:1}.section[part='video-settings']{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);flex-grow:1}}`,AKn=_Kn;var Sre=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const mM=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.iconPack=Nt,this.t=It(),this.onVideoUpdate=e=>{this.videoEnabled=e.videoEnabled}}componentDidLoad(){this.meetingChanged(this.meeting)}meetingChanged(t){var e;t&&(this.videoEnabled=t.self.videoEnabled,(e=t.self)===null||e===void 0||e.addListener("videoUpdate",this.onVideoUpdate))}disconnectedCallback(){var t;(t=this.meeting.self)===null||t===void 0||t.removeListener("videoUpdate",this.onVideoUpdate)}render(){var t,e,n;if(!this.meeting)return null;const r={meeting:this.meeting,states:this.states,size:this.size,iconPack:this.iconPack,t:this.t},s=this.states,i=((t=s==null?void 0:s.prefs)===null||t===void 0?void 0:t.mirrorVideo)===!0||Rbt("mirror-video")==="true";return $(mt,null,$("div",{class:"section",part:"tile-preview"},$("div",{class:"group",part:"tile-preview"},this.videoEnabled===!0?$("rtk-participant-tile",{meeting:this.meeting,participant:(e=this.meeting)===null||e===void 0?void 0:e.self,iconPack:this.iconPack,t:this.t,states:s,size:this.size,isPreview:!0}):$("div",{class:"camera-off-helper"},$("rtk-participant-tile",{meeting:this.meeting,participant:(n=this.meeting)===null||n===void 0?void 0:n.self,size:this.size},$("div",null,$("rtk-icon",{id:"icon",icon:this.iconPack.video_off,tabIndex:-1,"aria-hidden":!0}),$("div",null,this.t("settings.camera_off"))))))),$("rtk-camera-selector",Object.assign({},r)),$("div",{class:"group",part:"mirror-toggle"},$("div",{class:"row"},$("label",{htmlFor:"mirror-toggle"},this.t("settings.mirror_video")),$("rtk-switch",{checked:i,iconPack:this.iconPack,t:this.t,onRtkChange:o=>{const{checked:l}=o.target;this.stateUpdate.emit({prefs:{mirrorVideo:l}}),Pbt("mirror-video",l)}}))))}static get watchers(){return{meeting:["meetingChanged"]}}};Sre([ge()],mM.prototype,"meeting",void 0);Sre([ge()],mM.prototype,"states",void 0);Sre([ge()],mM.prototype,"iconPack",void 0);Sre([ge()],mM.prototype,"t",void 0);mM.style=AKn;var PKn=Object.freeze({__proto__:null,rtk_settings_audio:hM,rtk_settings_video:mM});const RKn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{pointer-events:none;display:block;color:rgb(var(--rtk-colors-text-1000, 255 255 255));display:flex;justify-content:center;vertical-align:middle;animation:show 0.4s ease;transition:0.4s;z-index:5;width:100%}.ctr{box-sizing:border-box;display:inline-flex;height:100%;align-items:center;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));--tw-shadow:0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);--tw-shadow-colored:0 4px 6px -1px var(--tw-shadow-color), 0 2px 4px -2px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);--tw-shadow-color:rgb(var(--rtk-colors-background-1000, 8 8 8));--tw-shadow:var(--tw-shadow-colored);pointer-events:auto;padding:var(--rtk-space-3, 12px);overflow:auto;max-width:50%}.message{margin:var(--rtk-space-0, 0px);display:inline-block;justify-content:center;max-width:100%;text-wrap:wrap;line-height:1.5rem}.message .name{font-weight:bold}:host(.exit){animation:exit 0.4s ease}@keyframes show{0%{opacity:0;transform:translateY(120px)}100%{opacity:1;transform:translateY(0px)}}@keyframes exit{0%{opacity:1;transform:translateY(0)}100%{opacity:0;transform:translateY(-120px)}}:host([size='sm']){font-size:14px}",IKn=RKn;var MKn=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const RTe=class{constructor(t){kt(this,t),this.dismiss=Wt(this,"rtkTranscriptDismiss",7),this.t=It()}connectedCallback(){this.transcriptChanged(this.transcript)}transcriptChanged(t,e){if((e==null?void 0:e.renderedId)===t.renderedId&&(e==null?void 0:e.transcript)===t.transcript||(clearTimeout(this.timeout),!(t!=null&&t.name)||!(t!=null&&t.transcript)))return;const{id:n,renderedId:r}=t;this.timeout=setTimeout(()=>{this.dismiss.emit({id:n,renderedId:r})},1e4)}render(){return $(mt,{key:"0c5388d7f66dc55a13ccd85b83292bacfe4d1c7a"},$("div",{key:"3b1684efa2f6b9e5653cec33572ffe41654460e9",class:"ctr"},$("p",{key:"b055b2371877d999c7ac60ff67f1c7ece9e4ec42",class:"message"},$("span",{key:"283903c7e3cd282f6f377e93bd13faba265acdd8",class:"name"},this.transcript.name),": ",this.transcript.transcript)))}static get watchers(){return{transcript:["transcriptChanged"]}}};MKn([ge()],RTe.prototype,"t",void 0);RTe.style=IKn;var LKn=Object.freeze({__proto__:null,rtk_transcript:RTe});const Cre=({name:t,time:e,now:n})=>$("div",{class:"head"},$("div",{class:"name"},pm(Rf(t),20)),$("div",{class:"time",title:LNe(e)},kne(e,n))),DKn=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.head{display:flex;align-items:center}.head .name{margin-right:var(--rtk-space-4, 16px);font-size:12px;font-weight:700}.head .time{font-size:12px;color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}*{box-sizing:border-box;border-width:0;border-style:solid}:host{width:100%;display:flex;flex-direction:column}.processing{display:flex;flex:1 1 0%;flex-direction:column;align-items:center;justify-content:center}.content{box-sizing:border-box;display:flex;flex-direction:column;padding:var(--rtk-space-3, 12px);flex:1 0 0px;overflow-y:scroll}.started-message{margin-top:var(--rtk-space-5, 20px);margin-bottom:var(--rtk-space-5, 20px);text-align:center;font-size:12px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.search{position:sticky;box-sizing:border-box;display:flex;align-items:center;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));margin-left:var(--rtk-space-3, 12px);margin-right:var(--rtk-space-3, 12px);margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-4, 16px)}.search rtk-icon{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px);color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}.search input{box-sizing:border-box;height:var(--rtk-space-9, 36px);width:100%;padding-right:var(--rtk-space-2, 8px);border-width:var(--rtk-border-width-none, 0);border-style:none;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));outline:2px solid transparent;outline-offset:2px;border-radius:var(--rtk-border-radius-sm, 4px);font-size:14px}.search input::-moz-placeholder{color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.search input::placeholder{color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.caption-view{height:var(--rtk-space-12, 48px);width:100%;padding-left:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-3, 12px);padding-top:var(--rtk-space-3, 12px);padding-bottom:var(--rtk-space-3, 12px);border-bottom-width:var(--rtk-border-width-sm, 1px);border-style:solid;--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-border-opacity));display:flex;align-items:center;justify-content:space-between;font-size:14px}.message .body{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);font-size:14px;word-break:break-word}.message{margin-bottom:var(--rtk-space-3, 12px)}.message:last-child{margin-bottom:var(--rtk-space-0, 0px)}`,$Kn=DKn;var ITe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const TB=class{constructor(t){kt(this,t),this.searchQuery="",this.isProcessing=!1,this.iconPack=Nt,this.t=It(),this.transcriptions=[],this.autoScrollEnabled=!0,this.onScroll=e=>{const{scrollTop:n,clientHeight:r,scrollHeight:s}=e.target;n+r+10>=s?this.autoScrollEnabled=!0:this.autoScrollEnabled=!1},this.onTranscriptHandler=e=>{this.transcriptions=this.transcriptionsReducer(this.transcriptions,e)}}transcriptionsReducer(t,e){if(!t.length||t[t.length-1].peerId!==e.peerId)return t.concat(e);const n=t[t.length-1];return n.id===e.id?(n.transcript=e.transcript,t.pop(),t.concat(n)):t.concat(e)}connectedCallback(){this.meeting&&this.meetingChanged(this.meeting)}componentDidLoad(){var t;(t=this.contentContainer)===null||t===void 0||t.addEventListener("scroll",this.onScroll)}disconnectedCallback(){var t,e,n;(e=(t=this.meeting)===null||t===void 0?void 0:t.ai)===null||e===void 0||e.off("transcript",this.onTranscriptHandler),(n=this.contentContainer)===null||n===void 0||n.removeEventListener("scroll",this.onScroll)}meetingChanged(t){var e,n;this.transcriptions=SNe((e=t==null?void 0:t.ai)===null||e===void 0?void 0:e.transcripts),this.transcriptions=this.transcriptions.reduce(this.transcriptionsReducer,[]),(n=t==null?void 0:t.ai)===null||n===void 0||n.on("transcript",this.onTranscriptHandler)}transcriptionsChanged(){this.autoScrollEnabled&&setTimeout(()=>{m$(this.contentContainer,!1)},100)}renderContent(){const t=this.renderTranscripts();return $("div",{class:"content scrollbar",ref:e=>this.contentContainer=e},this.transcriptions.length===0&&$("div",{class:"started-message"},this.t("ai.transcriptions.no_transcripts_yet")),t,this.transcriptions.length>0&&this.searchQuery&&t.length===0&&$("div",{class:"started-message"},this.t("ai.transcriptions.no_transcripts_found")))}renderTranscripts(){var t;const e=(t=this.searchQuery)===null||t===void 0?void 0:t.toLowerCase(),n=this.transcriptions.filter(s=>{var i,o;return e?((i=s.name)===null||i===void 0?void 0:i.toLowerCase().includes(e))||((o=s.transcript)===null||o===void 0?void 0:o.toLowerCase().includes(e)):!0}),r=[];return n.forEach(s=>{const i={name:s.name,date:s.date,peerId:s.peerId,transcript:s.transcript};if(!r.length){r.push(i);return}const o=r[r.length-1];if(s.peerId!==o.peerId){r.push(i);return}o.transcript+=" "+s.transcript}),r.map(s=>$("div",{class:"message"},$(Cre,{name:s.name,time:new Date(s.date),now:new Date}),$("div",{class:"body"},s.transcript)))}render(){return $(mt,{key:"08b41c4274270f9df80881c0a1fee9cdb5621ed7"},$("div",{key:"debebf0ef34437b1d9266cf5470a3d47975a865b",class:"search"},$("rtk-icon",{key:"5a17bcacd6ee1813ca40f5d6d550cc7425060d14",icon:this.iconPack.search}),$("input",{key:"b36d618edaccca47d5a076bf28e2af4c08039929",type:"search",autocomplete:"off",placeholder:this.t("ai.transcriptions.search_placeholder"),value:this.searchQuery,onInput:t=>this.searchQuery=t.target.value})),this.isProcessing&&$("div",{key:"8a9a5fda23dec97e14faaacc6bbade22a711b137",class:"processing"},$("p",{key:"24385d63e55281e957bed28b5055560b9a860c63"},"Processing audio....")),!this.isProcessing&&this.renderContent())}static get watchers(){return{meeting:["meetingChanged"],transcriptions:["transcriptionsChanged"]}}};ITe([ge()],TB.prototype,"meeting",void 0);ITe([ge()],TB.prototype,"iconPack",void 0);ITe([ge()],TB.prototype,"t",void 0);TB.style=$Kn;var OKn=Object.freeze({__proto__:null,rtk_ai_transcriptions:TB});const ode=(t,e)=>{if(t==null)return;const n=3,r=Math.round(n/2),s=[...Array(n)].map((f,p)=>{let g=p;return g>r-1&&(g=n-g-1),Math.round((g+1)/(r+1)*e)}),{width:i,height:o}=t,l=t.getContext("2d");let c=2;const d=4,u=i*1/s.length,h=u-d;l.clearRect(0,0,i,o),l.fillStyle="rgb(0,0,0,0.0)",l.fillRect(0,0,i,o);const m=getComputedStyle(t).getPropertyValue("color");l.fillStyle=m,l.strokeStyle=m,l.lineCap="round",l.lineWidth=4,l.beginPath();for(const f of s){const p=Math.min(-Math.abs(f*1.2/10*o)+o/2,o/2-2.5),g=Math.max((o/2-p)*2,5);l.moveTo(c+h/2,p),l.lineTo(c+h/2,p+g),c+=u}l.stroke()},FKn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block;width:-moz-fit-content;width:fit-content}.audioActivePadding{padding:var(--rtk-space-1, 4px)}canvas,rtk-icon{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}:host([size='sm']){transform:scale(0.9)}canvas{display:none}canvas.visible{display:block}canvas.bars{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}",BKn=FKn;var Mwt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const jre=class{constructor(t){kt(this,t),this.variant="bars",this.iconPack=Nt,this.t=It(),this.hideMuted=!1,this.isScreenShare=!1,this.volume=0}connectedCallback(){this.participantChanged(this.participant)}componentDidLoad(){ode(this.visualizer,0)}disconnectedCallback(){var t,e,n;(t=this.hark)===null||t===void 0||t.stop(),this.audioUpdateListener&&((e=this.participant)===null||e===void 0||e.removeListener("audioUpdate",this.audioUpdateListener)),this.screenShareUpdateListener&&((n=this.participant)===null||n===void 0||n.removeListener("screenShareUpdate",this.screenShareUpdateListener))}participantChanged(t){t!=null&&(this.audioUpdateListener=({audioEnabled:e,audioTrack:n})=>{var r;if((r=this.hark)===null||r===void 0||r.stop(),e&&n!=null){this.audioEnabled=!0;const s=new MediaStream;s.addTrack(n),this.calcVolume(s),ode(this.visualizer,0)}else this.volume=0,this.audioEnabled=!1},this.isScreenShare?(this.screenShareUpdateListener=({screenShareEnabled:e,screenShareTracks:n})=>{this.audioUpdateListener({audioEnabled:e&&n.audio!=null,audioTrack:n.audio})},this.screenShareUpdateListener({screenShareEnabled:t.screenShareEnabled,screenShareTracks:{audio:t.screenShareTracks.audio,video:t.screenShareTracks.video}}),t.addListener("screenShareUpdate",this.screenShareUpdateListener)):(this.audioUpdateListener(t),t.addListener("audioUpdate",this.audioUpdateListener)))}calcVolume(t){this.hark=Ixt(t,{play:!1,interval:1e3/10}),this.hark.on("volume_change",e=>{const n=this.volume;let r=Math.round(10**(e/115)*10);r<3&&(r=0);let s=Math.round((n*2+r)/3);n!==s&&(this.volume=s,ode(this.visualizer,this.volume))})}render(){return this.hideMuted&&!this.audioEnabled?null:$(mt,null,$("div",{class:{audioActivePadding:this.hideMuted&&this.audioEnabled}},$("canvas",{width:"24",height:"24",class:{bars:!0,visible:this.audioEnabled},ref:t=>this.visualizer=t,part:"canvas"}),!this.isScreenShare&&!this.audioEnabled&&$("rtk-icon",{icon:this.iconPack.mic_off,part:"mic-off-icon"})))}static get watchers(){return{participant:["participantChanged"]}}};Mwt([ge()],jre.prototype,"iconPack",void 0);Mwt([ge()],jre.prototype,"t",void 0);jre.style=BKn;const UKn=`.rtk-select{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.rtk-select:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.rtk-select{display:block;border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:var(--rtk-space-3, 12px);font-size:16px;--icon-size:var(--rtk-select-chevron-size, var(--rtk-space-6, 24px));--icon-right-position:var(--rtk-select-chevron-right-position, var(--rtk-space-2, 8px));background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");background-position:right var(--icon-right-position) center;background-repeat:no-repeat;background-size:var(--icon-size) var(--icon-size);padding-right:calc(var(--icon-right-position) * 5);width:100%;max-width:100%;text-overflow:ellipsis}.inline .rtk-select{margin-top:var(--rtk-space-1, 4px);width:100%;padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-8, 32px);font-size:14px}.row{margin-bottom:var(--rtk-space-2, 8px);display:flex;width:100%;align-items:center;justify-content:space-between;gap:var(--rtk-space-3, 12px)}.group{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px)}.group>*{margin-bottom:var(--rtk-space-2, 8px)}.group>*:last-child{margin-bottom:var(--rtk-space-0, 0px)}.group select{flex:1 1 0%}.inline.group{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0\\.5, 2px)}.inline.group>*{margin-bottom:var(--rtk-space-0, 0px)}label{display:flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center;gap:var(--rtk-space-1, 4px);font-size:14px}.inline.container{display:flex;align-items:center;justify-content:flex-start;gap:var(--rtk-space-2, 8px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px)}`,zKn=UKn;var MTe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const _B=class{constructor(t){kt(this,t),this.iconPack=Nt,this.variant="full",this.t=It(),this.audioinputDevices=[],this.canProduceAudio=!0,this.currentDevices={audio:void 0},this.stageStateListener=()=>{this.canProduceAudio=this.meeting.self.permissions.canProduceAudio==="ALLOWED"},this.deviceListUpdateListener=async()=>{const e=await this.meeting.self.getAudioDevices();this.audioinputDevices=e},this.deviceUpdateListener=({device:e})=>{e.kind==="audioinput"&&(this.currentDevices={audio:e})},this.mediaPermissionUpdateListener=async({kind:e,message:n})=>{this.meeting&&e==="audio"&&n==="ACCEPTED"&&(this.audioinputDevices=await this.meeting.self.getAudioDevices())}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var t,e,n,r,s;(e=(t=this.meeting)===null||t===void 0?void 0:t.stage)===null||e===void 0||e.removeListener("stageStatusUpdate",this.stageStateListener),(n=this.meeting)===null||n===void 0||n.self.removeListener("deviceListUpdate",this.deviceListUpdateListener),(r=this.meeting)===null||r===void 0||r.self.removeListener("deviceUpdate",this.deviceUpdateListener),(s=this.meeting)===null||s===void 0||s.self.removeListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener)}meetingChanged(t){t&&Dc(async()=>{var e,n;const{self:r,stage:s}=t,i=await t.self.getAudioDevices(),o=(e=t.self.getCurrentDevices())===null||e===void 0?void 0:e.audio;this.currentDevices={audio:o},this.canProduceAudio=t.self.permissions.canProduceAudio==="ALLOWED",s==null||s.addListener("stageStatusUpdate",this.stageStateListener),r.addListener("deviceListUpdate",this.deviceListUpdateListener),r.addListener("deviceUpdate",this.deviceUpdateListener),r.addListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),o!=null?this.audioinputDevices=[(n=i.find(l=>l.deviceId===o.deviceId))!==null&&n!==void 0?n:o,...i.filter(l=>l.deviceId!==o.deviceId)]:this.audioinputDevices=i})}setDevice(t){var e;if(j6(this.meeting))return;const n=this.audioinputDevices.find(r=>r.deviceId===t);n!=null&&(this.currentDevices={audio:n},(e=this.meeting)===null||e===void 0||e.self.setDevice(n))}render(){if(!this.meeting)return null;let t=0;return $(mt,null,this.canProduceAudio&&$("div",{part:"microphone-selection",class:"group container "+this.variant},$("label",{slot:"label"},this.variant!=="inline"&&this.t("settings.microphone_input"),$("rtk-icon",{icon:this.iconPack.mic_on,size:"sm"})),$("div",{class:"row"},$("select",{class:"rtk-select",onChange:e=>this.setDevice(e.target.value)},this.audioinputDevices.map(({deviceId:e,label:n})=>{var r;return $("option",{value:e,selected:((r=this.currentDevices.audio)===null||r===void 0?void 0:r.deviceId)===e},n||`Microphone ${++t}`)})),$("slot",{name:"indicator"}))))}static get watchers(){return{meeting:["meetingChanged"]}}};MTe([ge()],_B.prototype,"meeting",void 0);MTe([ge()],_B.prototype,"iconPack",void 0);MTe([ge()],_B.prototype,"t",void 0);_B.style=zKn;const VKn=`.rtk-select{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.rtk-select:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.rtk-select{display:block;border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:var(--rtk-space-3, 12px);font-size:16px;--icon-size:var(--rtk-select-chevron-size, var(--rtk-space-6, 24px));--icon-right-position:var(--rtk-select-chevron-right-position, var(--rtk-space-2, 8px));background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");background-position:right var(--icon-right-position) center;background-repeat:no-repeat;background-size:var(--icon-size) var(--icon-size);padding-right:calc(var(--icon-right-position) * 5);width:100%;max-width:100%;text-overflow:ellipsis}.inline .rtk-select{margin-top:var(--rtk-space-1, 4px);width:100%;padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-8, 32px);font-size:14px}.row{display:flex;width:100%;align-items:center;justify-content:space-between;gap:var(--rtk-space-3, 12px)}.group{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px)}.group>*{margin-bottom:var(--rtk-space-2, 8px)}.group>*:last-child{margin-bottom:var(--rtk-space-0, 0px)}.group select{flex:1 1 0%}.inline.group{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0\\.5, 2px)}.inline.group>*{margin-bottom:var(--rtk-space-0, 0px)}label{display:flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center;gap:var(--rtk-space-1, 4px);font-size:14px}.inline .container{display:flex;align-items:center;justify-content:flex-start;gap:var(--rtk-space-2, 8px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px)}`,HKn=VKn;var Ere=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const fM=class{constructor(t){kt(this,t),this.variant="full",this.iconPack=Nt,this.t=It(),this.speakerDevices=[],this.currentDevices={speaker:void 0},this.deviceListUpdateListener=async()=>{const e=await this.meeting.self.getSpeakerDevices();this.speakerDevices=e},this.deviceUpdateListener=({device:e})=>{e.kind==="audiooutput"&&(this.currentDevices={speaker:e})},this.mediaPermissionUpdate=async({kind:e,message:n})=>{this.meeting&&e==="audio"&&n==="ACCEPTED"&&(this.speakerDevices=await this.meeting.self.getSpeakerDevices())}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var t,e,n;(t=this.meeting)===null||t===void 0||t.self.removeListener("deviceListUpdate",this.deviceListUpdateListener),(e=this.meeting)===null||e===void 0||e.self.removeListener("deviceUpdate",this.deviceUpdateListener),(n=this.meeting)===null||n===void 0||n.self.addListener("mediaPermissionUpdate",this.mediaPermissionUpdate)}meetingChanged(t){t&&Dc(async()=>{var e,n;const{self:r}=t,s=await t.self.getSpeakerDevices(),i=(e=t.self.getCurrentDevices())===null||e===void 0?void 0:e.speaker;this.currentDevices={speaker:i},r.addListener("deviceListUpdate",this.deviceListUpdateListener),r.addListener("deviceUpdate",this.deviceUpdateListener),r.addListener("mediaPermissionUpdate",this.mediaPermissionUpdate),i!=null?this.speakerDevices=[(n=s.find(o=>o.deviceId===i.deviceId))!==null&&n!==void 0?n:i,...s.filter(o=>o.deviceId!==i.deviceId)]:this.speakerDevices=s})}testAudio(){var t;(t=this.testAudioEl)===null||t===void 0||t.play()}setDevice(t){var e,n;if(j6(this.meeting))return;const r=this.speakerDevices.find(s=>s.deviceId===t);this.currentDevices={speaker:r},r!=null&&((e=this.meeting)===null||e===void 0||e.self.setDevice(r),(n=this.testAudioEl)===null||n===void 0||n.setSinkId(r.deviceId))}render(){if(!this.meeting)return null;let t=0;return $(mt,null,$("audio",{preload:"auto",src:"https://rtk-assets.realtime.cloudflare.com/ui-kit/speaker-test.mp3",ref:e=>this.testAudioEl=e}),$("div",{class:"group "+this.variant,part:"speaker-selection"},this.speakerDevices.length>0&&!j6(this.meeting)&&$("div",{class:"container"},$("label",null,this.variant!=="inline"&&this.t("settings.speaker_output"),$("rtk-icon",{icon:this.iconPack.speaker,size:"sm"})),$("div",{class:"row"},$("select",{class:"rtk-select",onChange:e=>this.setDevice(e.target.value)},this.speakerDevices.map(({deviceId:e,label:n})=>{var r;return $("option",{value:e,selected:((r=this.currentDevices.speaker)===null||r===void 0?void 0:r.deviceId)===e},n||`Speaker ${++t}`)})))),this.variant==="full"&&$("rtk-button",{variant:"secondary",onClick:()=>this.testAudio()},$("rtk-icon",{icon:this.iconPack.speaker,slot:"start"}),this.t("test"))))}static get watchers(){return{meeting:["meetingChanged"]}}};Ere([ge()],fM.prototype,"meeting",void 0);Ere([ge()],fM.prototype,"states",void 0);Ere([ge()],fM.prototype,"iconPack",void 0);Ere([ge()],fM.prototype,"t",void 0);fM.style=HKn;const GKn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{box-sizing:border-box;display:inline-flex;height:var(--rtk-space-6, 24px);width:var(--rtk-space-10, 40px);align-items:center;padding:var(--rtk-space-1, 4px);border-radius:9999px;background-color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));cursor:pointer}.switch{box-sizing:border-box;height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);background-color:rgb(var(--rtk-colors-text-on-brand-1000, var(--rtk-colors-text-1000, 255 255 255)));border-radius:9999px;transition-property:var(--rtk-transition-property, all);transition-duration:200ms}:host(.checked){--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity))}:host(.checked) .switch{transform:translateX(100%)}:host([readonly]),:host([disabled]){cursor:not-allowed;opacity:0.6}",WKn=GKn;var Lwt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const Nre=class{constructor(t){kt(this,t),this.onChange=Wt(this,"rtkChange",4),this.checked=!1,this.readonly=!1,this.disabled=!1,this.iconPack=Nt,this.t=It(),this.onClick=()=>{!this.readonly&&!this.disabled&&(this.checked=!this.checked)},this.onKeyPress=e=>{if(!this.readonly)switch(e.key){case"Enter":case" ":this.checked=!this.checked;break}}}connectedCallback(){this.checkedChange(this.checked)}checkedChange(t){this.checked=t,this.onChange.emit(t)}render(){return $(mt,{key:"af0bcf0202cda77f3ec27510b867ed149c478bdf",role:"switch",tabIndex:this.disabled&&0,"aria-readonly":this.readonly,"aria-checked":this.checked,"aria-disabled":this.disabled,class:{checked:this.checked},onClick:this.onClick,onKeyPress:this.onKeyPress},$("div",{key:"e6f5eeb8acf33e9f058b029423eddc099033053c",class:"switch",part:"switch"}))}static get watchers(){return{checked:["checkedChange"]}}};Lwt([ge()],Nre.prototype,"iconPack",void 0);Lwt([ge()],Nre.prototype,"t",void 0);Nre.style=WKn;var qKn=Object.freeze({__proto__:null,rtk_audio_visualizer:jre,rtk_microphone_selector:_B,rtk_speaker_selector:fM,rtk_switch:Nre});const KKn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));border-radius:var(--rtk-border-radius-sm, 4px)}@keyframes bg-glow{25%{background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / 0.2)}50%{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}75%{background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / 0.2)}}.glowing-card{animation:bg-glow 0.8s}.selector-mode,.assign-mode{display:flex;flex-direction:column;align-items:center;padding:var(--rtk-space-2, 8px);cursor:pointer}.selector:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.show-on-hover{display:none}.header{width:100%;display:flex;align-items:center}.header rtk-icon{margin-left:var(--rtk-space-2, 8px);height:var(--rtk-space-5, 20px);cursor:pointer}.header .danger{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}.header .hide{display:none}.header .rooms-container{display:flex;flex-grow:1;flex-direction:row;align-items:center;justify-content:flex-end}.header input{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));padding:var(--rtk-space-1, 4px);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));max-width:var(--rtk-space-36, 144px);font-size:14px;font-weight:500;border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;outline:2px solid transparent;outline-offset:2px;border-bottom-width:var(--rtk-border-width-sm, 1px);border-style:solid;--tw-border-opacity:1;border-bottom-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-border-opacity))}.header input:disabled{overflow-x:visible;border-radius:var(--rtk-border-radius-none, 0);border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent}.header input:invalid{border-bottom-width:var(--rtk-border-width-sm, 1px);border-style:dashed;--tw-border-opacity:1;border-bottom-color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-border-opacity))}.header input.editing-enabled{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity))}.header .participant-count{display:flex;align-items:center;font-size:14px;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}.header .participant-count rtk-icon{margin:var(--rtk-space-0, 0px);margin-right:var(--rtk-space-0\\.5, 2px);width:var(--rtk-space-3, 12px)}.header .assign-button{height:var(--rtk-space-6, 24px);--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity));text-decoration-line:underline}.header .assign-button:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.participant-list{display:grid;flex-grow:1;grid-template-columns:repeat(2, minmax(0, 1fr));gap:var(--rtk-space-2, 8px);margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px);width:100%;border-radius:var(--rtk-border-radius-sm, 4px)}.participant-list::-webkit-scrollbar{width:var(--rtk-space-1\\.5, 6px)}.participant-list::-webkit-scrollbar-thumb{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.participant-list::-webkit-scrollbar-track{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}.participant-item{display:flex;align-items:center;justify-content:space-between;margin-right:var(--rtk-space-2, 8px);height:-moz-fit-content;height:fit-content;padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px)}.participant-item:hover{border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.selector-mode:hover .show-on-hover{display:flex}.message-container{margin:var(--rtk-space-0, 0px);display:flex;width:100%;padding-top:var(--rtk-space-2, 8px);padding-bottom:var(--rtk-space-2, 8px)}.message-container p{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0, 0px);height:var(--rtk-space-20, 80px);display:flex;width:100%;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-sm, 4px);font-size:12px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));border-style:dashed;--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-border-opacity))}.message-container p:hover{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-border-opacity));background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / 0.25)}.message-container .drop-zone-active{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-border-opacity));background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / 0.25)}rtk-icon{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}.show-on-hover{margin-left:var(--rtk-space-4, 16px);height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);display:none}:host(:hover) .show-on-hover{display:flex}.peer-ui-container{position:relative;display:flex;align-items:center;gap:var(--rtk-space-2, 8px);height:var(--rtk-space-10, 40px);cursor:pointer;border-radius:var(--rtk-border-radius-sm, 4px);color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88))}.peer-ui-container rtk-avatar{height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px);font-size:14px;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.peer-ui-container .name{font-size:14px;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}",YKn=KKn;var Tre=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const B9e=3,pM=class{constructor(t){kt(this,t),this.onParticipantsAdd=Wt(this,"participantsAdd",7),this.onParticipantDelete=Wt(this,"participantDelete",7),this.onRoomJoin=Wt(this,"roomJoin",7),this.deleteRoom=Wt(this,"delete",7),this.updateRoom=Wt(this,"update",7),this.allowDelete=!0,this.iconPack=Nt,this.t=It(),this.isDragMode=!1,this.defaultExpanded=!1,this.editingTitleRoomId=null,this.newTitle=null,this.showExpandedCard=!1,this.glowingCard=!1,this.permissionsUpdateListener=()=>{this.permissions=this.meeting.self.permissions.connectedMeetings},this.reset=()=>{this.editingTitleRoomId=null,this.newTitle=null},this.onEditClick=()=>{if(this.editingTitleRoomId){if(this.newTitle.length<B9e)return;this.roomTitle=this.newTitle,this.updateRoom.emit({title:this.newTitle,id:this.editingTitleRoomId}),this.glowCard(),this.reset()}else this.editingTitleRoomId=this.room.id,Dc(()=>{this.inputTextEl.focus(),this.inputTextEl.select()})},this.onDrop=e=>{e.currentTarget instanceof HTMLParagraphElement&&(e.currentTarget.classList.remove("drop-zone-active"),this.onAssign())},this.onDragOver=e=>{e.currentTarget instanceof HTMLParagraphElement&&(e.currentTarget.classList.add("drop-zone-active"),e.preventDefault())}}connectedCallback(){var t;this.allParticipants=sbt(this.meeting),this.permissionsUpdateListener(),this.showExpandedCard=this.defaultExpanded,this.roomTitle=this.room.isParent?this.t("breakout_rooms.main_room"):(t=this.room)===null||t===void 0?void 0:t.title,this.canEditMeetingTitle=this.permissions.canAlterConnectedMeetings&&!this.room.isParent&&!this.meeting.connectedMeetings.isActive,this.meeting.self.permissions.on("permissionsUpdate",this.permissionsUpdateListener)}disconnectedCallback(){this.meeting.self.permissions.off("permissionsUpdate",this.permissionsUpdateListener)}onDragLeave(t){t.currentTarget instanceof HTMLParagraphElement&&t.currentTarget.classList.remove("drop-zone-active")}getAssignmentHint(){if(this.assigningParticipants&&this.isDragMode)return this.t("breakout_rooms.drag_drop_participants");if(this.assigningParticipants)return this.t("breakout_rooms.click_drop_participants");if(this.room.participants.length===0)return this.t("breakout_rooms.none_assigned")}toggleCardDisplay(){this.showExpandedCard=!this.showExpandedCard}glowCard(){this.glowingCard=!0,setTimeout(()=>{this.glowingCard=!1},2e3)}onAssign(){this.onParticipantsAdd.emit(),this.glowCard()}onJoin(){this.onRoomJoin.emit()}onTitleChanged(t){t.key==="Enter"&&(this.newTitle=t.target.value,this.onEditClick())}renderPeer(t){const{displayPictureUrl:e}=this.allParticipants.find(r=>bl(r)===bl(t)),n=Rf(t.displayName||"");return $("div",{class:"peer-ui-container"},$("rtk-avatar",{participant:{name:n,picture:e},size:"sm"}),$("p",{class:"name",title:n},pm(n,16),this.meeting.self.userId===t.id&&` (${this.t("you")})`))}renderExpandedCardMaybe(){if(this.showExpandedCard&&!this.room.isParent&&this.getAssignmentHint()&&this.permissions.canAlterConnectedMeetings)return $("div",{class:"message-container"},$("p",{class:{"compact-height":this.room.participants.length!==0},onClick:()=>this.onAssign(),onDragOver:this.onDragOver,onDragLeave:this.onDragLeave,onDrop:this.onDrop},this.getAssignmentHint()))}renderParticipantsMaybe(){if(this.showExpandedCard&&!this.room.isParent&&this.room.participants.length!==0)return $("div",{class:"participant-list",onClick:()=>{this.onAssign()}},this.room.participants.map(t=>$("div",{class:"participant-item",role:"listitem",key:t.id},this.renderPeer(t),this.permissions.canAlterConnectedMeetings&&$("rtk-icon",{class:"show-on-hover",icon:this.iconPack.dismiss,onClick:()=>{this.onParticipantDelete.emit(t)}}))))}render(){var t,e,n;if(!this.meeting||!this.room||!this.permissions)return null;const r=this.permissions.canAlterConnectedMeetings||this.permissions.canSwitchConnectedMeetings&&!this.room.isParent||this.permissions.canSwitchToParentMeeting&&this.room.isParent;return $(mt,null,$("div",{class:{"assign-mode":this.assigningParticipants,"selector-mode":!this.assigningParticipants,"glowing-card":this.glowingCard}},$("div",{class:"header"},$("input",{ref:s=>this.inputTextEl=s,placeholder:this.t("breakout_rooms.room_name"),disabled:this.editingTitleRoomId!==this.room.id,value:this.roomTitle,minlength:B9e,onChange:s=>{this.newTitle=s.target.value},onKeyPress:s=>this.onTitleChanged(s),class:{"editing-enabled":this.editingTitleRoomId===this.room.id},style:{width:`${this.roomTitle.length+1}ch`}}),this.editingTitleRoomId!==this.room.id&&$("span",{class:"participant-count"},"(",$("rtk-icon",{icon:this.iconPack.people}),(n=(e=(t=this.room)===null||t===void 0?void 0:t.participants)===null||e===void 0?void 0:e.length)!==null&&n!==void 0?n:"0",")"),this.canEditMeetingTitle&&$("rtk-tooltip",{label:this.editingTitleRoomId===this.room.id?this.t("breakout_rooms.save_room_name"):this.t("breakout_rooms.edit_room_name")},$("rtk-icon",{icon:this.editingTitleRoomId===this.room.id?this.iconPack.checkmark:this.iconPack.edit,class:"show-on-hover",onClick:this.onEditClick})),$("div",{class:"rooms-container"},this.permissions.canAlterConnectedMeetings&&!this.room.isParent&&this.allowDelete&&$("rtk-tooltip",{label:this.t("breakout_rooms.delete"),class:"danger"},$("rtk-icon",{icon:this.iconPack.delete,class:"show-on-hover",onClick:()=>{this.deleteRoom.emit()}})),this.assigningParticipants&&this.permissions.canAlterConnectedMeetings&&!this.room.isParent&&$("rtk-button",{kind:"button",variant:"ghost",class:"assign-button",size:"md",onClick:()=>this.onAssign()},this.t("breakout_rooms.assign")),this.mode==="edit"&&!this.assigningParticipants&&r&&$("rtk-button",{kind:"button",variant:"ghost",class:"assign-button",size:"md",disabled:this.room.id===this.meeting.meta.meetingId,onClick:()=>this.onJoin()},this.room.id===this.meeting.meta.meetingId?this.t("joined"):this.t("join")),!this.room.isParent&&$("rtk-icon",{icon:this.showExpandedCard?this.iconPack.chevron_up:this.iconPack.chevron_down,onClick:()=>this.toggleCardDisplay()}))),this.renderExpandedCardMaybe(),this.renderParticipantsMaybe()))}};Tre([ge()],pM.prototype,"meeting",void 0);Tre([ge()],pM.prototype,"states",void 0);Tre([ge()],pM.prototype,"iconPack",void 0);Tre([ge()],pM.prototype,"t",void 0);pM.style=YKn;const QKn=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{display:flex;height:100%;flex-direction:column;font-size:14px}:host input[type='checkbox']{margin:var(--rtk-space-0, 0px);cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none;border-radius:var(--rtk-border-radius-sm, 4px);position:relative;height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);border-width:var(--rtk-border-width-sm, 1px);border-style:solid;border-color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}:host input[type='checkbox']:checked{--tw-border-opacity:1;border-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-border-opacity));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity))}:host input[type='checkbox']:checked::before{position:absolute;top:1px;left:1px;height:var(--rtk-space-3, 12px);width:var(--rtk-space-3, 12px);background-color:rgb(var(--rtk-colors-text-1000, 255 255 255));content:'';clip-path:polygon(5% 60%, 35% 93%, 100% 19%, 86% 4%, 36% 62%, 19% 44%)}*{box-sizing:border-box}.participants{margin-top:var(--rtk-space-2, 8px);padding:var(--rtk-space-0, 0px)}.ctr{box-sizing:border-box;padding-top:var(--rtk-space-0, 0px);padding-bottom:var(--rtk-space-0, 0px);overflow-y:auto;flex-grow:1;flex-basis:0}.empty-message{margin-top:var(--rtk-space-10, 40px);margin-bottom:var(--rtk-space-10, 40px);text-align:center;font-size:14px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.empty-room{display:flex;flex-direction:column;align-items:center;justify-content:center;gap:var(--rtk-space-2, 8px);height:100%;text-align:center;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.empty-room rtk-icon{height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px)}.empty-room p{font-size:16px;font-weight:500;margin:var(--rtk-space-0, 0px)}.empty-room span{font-size:12px;color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}.search-wrapper{margin-bottom:var(--rtk-space-1, 4px);display:flex;align-items:center;gap:var(--rtk-space-2, 8px)}.search{position:sticky;box-sizing:border-box;display:flex;align-items:center;border-radius:var(--rtk-border-radius-sm, 4px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0, 0px);height:var(--rtk-space-8, 32px)}.search .search-icon{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-2, 8px);height:var(--rtk-space-5, 20px);width:var(--rtk-space-5, 20px);color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}.search input{box-sizing:border-box;width:100%;padding-right:var(--rtk-space-2, 8px);border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:inherit;color:rgb(var(--rtk-colors-text-1000, 255 255 255));outline:2px solid transparent;outline-offset:2px;border-radius:var(--rtk-border-radius-sm, 4px);font-size:14px}.search input::-moz-placeholder{color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.search input::placeholder{color:rgb(var(--rtk-colors-text-800, 255 255 255 / 0.76))}.header{margin-left:var(--rtk-space-2, 8px);margin-right:var(--rtk-space-1\\.5, 6px);height:var(--rtk-space-9, 36px);padding-top:var(--rtk-space-3, 12px);padding-bottom:var(--rtk-space-3, 12px);padding-right:var(--rtk-space-0\\.5, 2px);border-bottom-width:var(--rtk-border-width-sm, 1px);border-top-width:var(--rtk-border-width-none, 0);border-right-width:var(--rtk-border-width-none, 0);border-left-width:var(--rtk-border-width-none, 0);border-style:solid;--tw-border-opacity:1;border-bottom-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-border-opacity));font-size:12px;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));display:flex;align-items:center;justify-content:space-between}.title-wrapper{display:flex;align-items:center;gap:var(--rtk-space-2, 8px)}.participant-count{display:flex;align-items:center;font-size:14px}.participant-count rtk-icon{margin-right:var(--rtk-space-0\\.5, 2px);width:var(--rtk-space-3, 12px)}.participant-item{display:flex;align-items:center;justify-content:space-between;margin-top:var(--rtk-space-1, 4px);margin-bottom:var(--rtk-space-1, 4px);border-radius:var(--rtk-border-radius-sm, 4px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);cursor:pointer}.participant-item input.hide-checkbox{display:none}.participant-item input:checked{display:inline-block}.dragging input{display:none}.participant-item:hover{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.participant-item:hover input{display:inline-block}.peer-ui-container{position:relative;display:flex;align-items:center;gap:var(--rtk-space-2, 8px);height:var(--rtk-space-10, 40px);cursor:pointer;border-radius:var(--rtk-border-radius-sm, 4px);color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.peer-ui-container rtk-avatar{height:var(--rtk-space-7, 28px);width:var(--rtk-space-7, 28px);font-size:14px;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.peer-ui-container .name{font-size:14px;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}`,ZKn=QKn;var LTe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const AB=class{constructor(t){kt(this,t),this.onSelectedParticipantsUpdate=Wt(this,"selectedParticipantsUpdate",7),this.onAllToggled=Wt(this,"allParticipantsToggleUpdate",7),this.onParticipantsDragging=Wt(this,"participantsDragging",7),this.participantIds=[],this.iconPack=Nt,this.t=It(),this.search="",this.participantsToShow=[],this.selectedParticipantIds=[],this.isDragging=!1,this.onSearchInput=e=>{this.search=e.target.value},this.onDragStart=e=>{this.isDragging=!0,this.onParticipantsDragging.emit(!0),this.updateSelectedParticipants(e,!0)},this.onDragEnd=e=>{this.isDragging=!1,this.onParticipantsDragging.emit(!1),this.updateSelectedParticipants(e,!1)},this.onClick=e=>{const n=this.selectedParticipantIds.includes(bl(e));this.updateSelectedParticipants(e,!n)},this.onToggleAll=e=>{const n=e?this.participantsToShow.map(bl):[];this.onAllToggled.emit(n)}}connectedCallback(){this.meetingChanged(this.meeting),this.searchChanged(this.search)}disconnectedCallback(){this.meeting}updateSelectedParticipants(t,e){const n=bl(t);let r=[];e&&!this.selectedParticipantIds.includes(n)?r=[...this.selectedParticipantIds,n]:r=[...this.selectedParticipantIds.filter(s=>s!==n)],this.onSelectedParticipantsUpdate.emit(r)}meetingChanged(t){t&&this.getParticipants(this.search)}participantsChanged(){this.getParticipants(this.search)}searchChanged(t){this.getParticipants(t)}getParticipants(t){const e=sbt(this.meeting);this.participantsToShow=e.filter(n=>{var r;return this.participantIds.includes(bl(n))&&((r=n.displayName)!==null&&r!==void 0?r:"").toLowerCase().includes(t.toLowerCase())})}renderPeer(t){const e=Rf(t.displayName||"");return $("div",{class:"peer-ui-container"},$("rtk-avatar",{participant:{name:t.displayName,picture:t.displayPictureUrl},size:"sm"}),$("p",{class:"name",title:e},pm(e,16),this.meeting.self.userId===t.id&&` (${this.t("you")})`))}render(){return $(mt,{key:"94cb6d982e09320de84247ed54125112bd3e13d3"},$("div",{key:"209bf3e3aab27fa05592bb24242bd6b4d0311437",class:"search-wrapper"},$("div",{key:"a827dcb5f643d421e6974f37f61b9d491332467f",class:"search",part:"search"},$("rtk-icon",{key:"cf06dfdf881b67faeff7c99445eb96994e73c87f",icon:this.iconPack.search,part:"search-icon",class:"search-icon"}),$("input",{key:"d70fda9e533d770f1e03735ff7f1a69a49e8e8ad",type:"search",autocomplete:"off",placeholder:this.t("search"),onInput:this.onSearchInput,part:"search-input"})),$("slot",{key:"14ae3d89ee242081fdbc953b4c5b6416c873933f",name:"shuffle-button"})),$("div",{key:"c86217a6ccf23ce29d6cf366be8c401556f5b72e",class:"header"},$("div",{key:"217d658e89b4647628fb826d11dd05bcf9ac892f",class:"title-wrapper"},$("span",{key:"7fa37a9e42871c36543f2107a872f1e14fb03bb8"},this.t("breakout_rooms.main_room")),$("span",{key:"956a5b53d06dea779b1bd00df955f653ea26202f",class:"participant-count"},"(",$("rtk-icon",{key:"9f9de13fc327edc1f90beddbf1edefb70bcedbe0",icon:this.iconPack.people}),this.participantsToShow.length,")")),this.selectedParticipantIds.length!==0&&$("rtk-tooltip",{key:"abc39eba7b381b8beae1ecc6d6afda27ba37975a",label:this.t("breakout_rooms.select_all")},$("input",{key:"5e5dfa6c0f68a80b58d44d8b2be8d31c5c22bc69",type:"checkbox",checked:this.selectedParticipantIds.length===this.participantsToShow.length,onChange:t=>this.onToggleAll(!!t.target.checked)}))),$("div",{key:"fcb0a2ceac16b68948d3f93ddc0f6f9e2542d6d8",class:"ctr scrollbar",part:"container"},this.participantsToShow.length>0&&$("ul",{key:"19916d9d462370718445dfb01a23d2806a57f1ff",class:"participants",part:"participants"},this.participantsToShow.map(t=>$("li",{class:{"participant-item":!0,dragging:this.isDragging},onClick:()=>this.onClick(t),onDragStart:()=>this.onDragStart(t),onDragEnd:()=>this.onDragEnd(t),draggable:this.selectedParticipantIds.length===0,role:"listitem",key:t.id},this.renderPeer(t),!this.isDragging&&$("input",{type:"checkbox",class:{"hide-checkbox":this.selectedParticipantIds.length===0},checked:this.selectedParticipantIds.includes(bl(t))})))),this.participantsToShow.length===0&&this.search.length>0&&$("div",{key:"2b0898cb78599610406ff0ec2b2be0ef8c4615cf",class:"empty-message"},this.t("participants.errors.empty_results")),this.participantsToShow.length===0&&this.search.length===0&&$("div",{key:"f6bdab6034aa82bf26dfa1a08615d36dcd00dcf6",class:"empty-room"},$("rtk-icon",{key:"115e987588beb229aba15dffbd05ffbef71cb74c",icon:this.iconPack.people_checked,part:"search-icon",class:"search-icon"}),$("p",{key:"d8b6120c1361b97d1e73969d9da119aa7488a7b3"},this.t("breakout_rooms.all_assigned")),$("span",{key:"020aa6e5440976f89960b0972784c997a1f765a8"},this.t("breakout_rooms.empty_main_room")))))}static get watchers(){return{meeting:["meetingChanged"],participantIds:["participantsChanged"],search:["searchChanged"]}}};LTe([ge()],AB.prototype,"meeting",void 0);LTe([ge()],AB.prototype,"iconPack",void 0);LTe([ge()],AB.prototype,"t",void 0);AB.style=ZKn;const JKn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;flex-direction:row;align-items:center;justify-content:center;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));width:-moz-fit-content;width:fit-content;border-radius:var(--rtk-border-radius-sm, 4px);padding:var(--rtk-space-1, 4px)}p{margin:var(--rtk-space-0, 0px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px)}input{margin:var(--rtk-space-0, 0px);width:var(--rtk-space-6, 24px);padding:var(--rtk-space-2, 8px);border-width:var(--rtk-border-width-sm, 1px);border-style:solid;border-color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));text-align:center;color:rgb(var(--rtk-colors-text-900, 255 255 255 / 0.88));border-radius:var(--rtk-border-radius-sm, 4px);font-size:16px;outline:2px solid transparent;outline-offset:2px;transition-property:color, background-color, border-color, text-decoration-color, fill, stroke, opacity, box-shadow, transform, filter, backdrop-filter;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms}input::-webkit-outer-spin-button,input::-webkit-inner-spin-button{margin:var(--rtk-space-0, 0px);appearance:none;-webkit-appearance:none}input[type='number']{-moz-appearance:textfield}",XKn=JKn;var Dwt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const _re=class{constructor(t){kt(this,t),this.onChange=Wt(this,"valueChange",7),this.input="1",this.minValue=0,this.iconPack=Nt,this.t=It()}connectedCallback(){this.watchStateHandler(this.input),this.input=this.value.toString()}watchStateHandler(t){this.onChange.emit(t)}increment(){this.input=Math.max(parseInt(this.input)+1,this.minValue).toString()}decrement(){this.input=Math.max(this.minValue,parseInt(this.input)-1).toString()}render(){return $(mt,{key:"ded6fcf73ce9b011ca2a005cce767c9180d9fa7f"},$("rtk-button",{key:"29a016773f430a03572a58a21f61495baabcaae7",kind:"icon",variant:"ghost",onClick:()=>this.decrement()},$("rtk-icon",{key:"75dab16bd637f72e2ea1dc932e19b0e38d220caa",icon:this.iconPack.subtract})),$("input",{key:"335b77366096033514acb4421f3e6b774392b900",type:"number",value:this.input,min:this.minValue,onInput:t=>{const e=parseInt(t.target.value,10);isNaN(e)||e<this.minValue?this.input=this.minValue.toString():this.input=e.toString()}}),$("rtk-button",{key:"47d300cb7857a37467f7f2a4a5b5004b4fa91356",kind:"icon",variant:"ghost",onClick:()=>this.increment()},$("rtk-icon",{key:"4febc41d26a2c5afff18ec136f325e97a699b3f5",icon:this.iconPack.add})))}static get watchers(){return{input:["watchStateHandler"]}}};Dwt([ge()],_re.prototype,"iconPack",void 0);Dwt([ge()],_re.prototype,"t",void 0);_re.style=XKn;var eYn=Object.freeze({__proto__:null,rtk_breakout_room_manager:pM,rtk_breakout_room_participants:AB,rtk_counter:_re});function DTe({stats:t}){if(!t||!t.length)return null;let e="Good";const n=t.map(r=>r.verdict);return n.includes("Poor")?e="Poor":n.includes("Average")&&(e="Average"),e}function QQ({packetLossPercentage:t}){let e="Good";return t>4?e="Poor":t>=1&&t<=4&&(e="Average"),e}function ZQ({jitterInMS:t}){let e="Good";return t>100?e="Poor":t>=50&&t<=100&&(e="Average"),e}function JQ({bitrate:t}){let e="Good";return Math.round(t/1024)===0&&(e="Poor"),e}function tYn({stats:t}){if(!t||!t.length)return null;let e="Good";const n=t.map(r=>r.verdict);return n.includes("Poor")?e="Poor":n.includes("Average")&&(e="Average"),e}function nYn({batteryLevelPercentage:t}){let e="Good";return t<20?e="Poor":t<50&&(e="Average"),e}function rYn({charging:t,dischargingTimeInSeconds:e,batteryLevelPercentage:n}){return n<20?"Poor":t?"Good":e<1800?"Poor":"Average"}const sYn=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;display:flex;flex-direction:column;overflow:hidden;height:100%;width:100%;color:rgb(var(--rtk-colors-text-1000, 255 255 255));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.tab-body::-webkit-scrollbar{width:var(--rtk-space-1\\.5, 6px);border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}.tab-body::-webkit-scrollbar-thumb{border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}h3{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px);font-size:16px;font-weight:600}#header{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-5, 20px);display:flex;align-items:center;justify-content:space-evenly}.tab-body{margin:var(--rtk-space-4, 16px);display:flex;height:100%;flex-direction:column;justify-content:space-between;overflow-y:auto}.status-container{border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));border-radius:8px;padding:16px}.status-section{margin-bottom:12px}.section-header{display:flex;justify-content:space-between;align-items:center;font-weight:bold;padding:8px 0}.section-header.only-child{justify-content:center}.section-body.missing-stats{display:flex;text-align:center;justify-content:center}.section-header .status{color:rgba(var(--rtk-colors-success));font-weight:bold}.section-header .arrow{font-size:14px}.network-table{border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));border-radius:8px;margin-top:8px;overflow:hidden}.network-row{display:flex;justify-content:space-between;padding:12px;border-bottom:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60))}.network-row:last-child{border-bottom:none}.network-cell{display:flex;flex-direction:column}.network-cell.label strong{font-size:14px}.network-cell.label .description{font-size:12px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));margin-top:4px}.network-cell.value{text-align:right}.status.good{color:rgba(var(--rtk-colors-success))}.status.average{color:rgba(var(--rtk-colors-warning))}.status.poor{color:rgba(var(--rtk-colors-danger))}.value{font-size:14px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));margin-top:4px}rtk-settings-audio{display:flex;flex-direction:column}`,iYn=sYn;var Are=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const gM=class{constructor(t){kt(this,t),this.iconPack=Nt,this.t=It(),this.isNetworkOpen=!0,this.isDevicesOpen=!1,this.audioProducerFormattedStats=[],this.audioProducerScoreStats=null,this.networkBasedMediaHealth=null,this.devicesHealth=null,this.mediaScoreUpdateListener=({kind:e,isScreenshare:n,scoreStats:r})=>{e==="audio"&&!n&&(this.audioProducerScoreStats=r)},this.deviceListUpdateListener=async()=>{const e=await this.meeting.self.getAudioDevices();this.devicesHealth=(e==null?void 0:e.length)>0?"Good":"Poor"},this.audioUpdateListener=()=>{this.meeting.self.audioEnabled||(this.audioProducerScoreStats=null)}}async audioProducerScoreStatsChanged(t){if(!t){this.audioProducerFormattedStats=[];return}const e=t,n=[];n.push({name:this.t("debugger.stats.bitrate.label"),value:`${Math.round(e.bitrate/1024)} kbps`,description:this.t("debugger.stats.bitrate.description"),verdict:JQ({bitrate:e.bitrate})}),n.push({name:this.t("debugger.stats.packet_loss.label"),value:`${e.packetsLostPercentage}%`,description:this.t("debugger.stats.packet_loss.description"),verdict:QQ({packetLossPercentage:e.packetsLostPercentage})}),n.push({name:this.t("debugger.stats.jitter.label"),value:`${Math.round(e.jitter*1e3)} ms`,description:this.t("debugger.stats.jitter.description"),verdict:ZQ({jitterInMS:e.jitter*1e3})}),this.audioProducerFormattedStats=n,this.networkBasedMediaHealth=DTe({stats:n})}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.meeting&&(this.meeting.self.off("mediaScoreUpdate",this.mediaScoreUpdateListener),this.meeting.self.off("audioUpdate",this.audioUpdateListener),this.meeting.self.off("deviceListUpdate",this.deviceListUpdateListener))}async meetingChanged(t){t&&(t.self.on("mediaScoreUpdate",this.mediaScoreUpdateListener),t.self.on("audioUpdate",this.audioUpdateListener),t.self.on("deviceListUpdate",this.deviceListUpdateListener),await this.deviceListUpdateListener())}render(){var t,e;if(this.meeting)return $(mt,null,$("div",{id:"header"}),$("div",{class:"tab-body"},$("div",{class:"status-container"},$("div",{class:"status-section"},$("div",{class:`section-header ${this.networkBasedMediaHealth?"":"only-child"}`},$("span",null,this.t("debugger.audio.sections.network_media")),this.networkBasedMediaHealth&&$("span",{class:`status ${(t=this.networkBasedMediaHealth)===null||t===void 0?void 0:t.toLowerCase()}`},this.t(`debugger.quality.${(e=this.networkBasedMediaHealth)===null||e===void 0?void 0:e.toLowerCase()}`))),this.isNetworkOpen&&!this.audioProducerFormattedStats.length&&$("div",{class:"section-body missing-stats"},this.meeting.self.audioEnabled?$("span",null,this.t("debugger.audio.messages.generating_report")):$("span",null,this.t("debugger.audio.messages.enable_media"))),this.isNetworkOpen&&!!this.audioProducerFormattedStats.length&&$("div",{class:"section-body network-table"},this.audioProducerFormattedStats.map(n=>{var r,s;return $("div",{class:"network-row"},$("div",{class:"network-cell label"},$("strong",null,n.name),$("span",{class:"description"},n.description)),$("div",{class:"network-cell value"},$("span",{class:`status ${(r=n.verdict)===null||r===void 0?void 0:r.toLowerCase()}`},this.t(`debugger.quality.${(s=n.verdict)===null||s===void 0?void 0:s.toLowerCase()}`)),$("span",{class:"value"},n.value)))}))))))}static get watchers(){return{audioProducerScoreStats:["audioProducerScoreStatsChanged"],meeting:["meetingChanged"]}}};Are([ge()],gM.prototype,"meeting",void 0);Are([ge()],gM.prototype,"states",void 0);Are([ge()],gM.prototype,"iconPack",void 0);Are([ge()],gM.prototype,"t",void 0);gM.style=iYn;const aYn=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;display:flex;flex-direction:column;overflow:hidden;height:100%;width:100%;color:rgb(var(--rtk-colors-text-1000, 255 255 255));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.tab-body::-webkit-scrollbar{width:var(--rtk-space-1\\.5, 6px);border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}.tab-body::-webkit-scrollbar-thumb{border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}h3{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px);font-size:16px;font-weight:600}#header{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-5, 20px);display:flex;align-items:center;justify-content:space-evenly}.tab-body{margin:var(--rtk-space-4, 16px);display:flex;height:100%;flex-direction:column;justify-content:space-between;overflow-y:auto}.status-container{border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));border-radius:8px;padding:16px}.status-section{margin-bottom:12px}.section-header{display:flex;justify-content:space-between;align-items:center;font-weight:bold;padding:8px 0}.section-header.only-child{justify-content:center}.section-body.missing-stats{display:flex;text-align:center;justify-content:center}.section-header .status{color:rgba(var(--rtk-colors-success));font-weight:bold}.section-header .arrow{font-size:14px}.network-table{border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));border-radius:8px;margin-top:8px;overflow:hidden}.network-row{display:flex;justify-content:space-between;padding:12px;border-bottom:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60))}.network-row:last-child{border-bottom:none}.network-cell{display:flex;flex-direction:column}.network-cell.label strong{font-size:14px}.network-cell.label .description{font-size:12px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));margin-top:4px}.network-cell.value{text-align:right}.status.good{color:rgba(var(--rtk-colors-success))}.status.average{color:rgba(var(--rtk-colors-warning))}.status.poor{color:rgba(var(--rtk-colors-danger))}.value{font-size:14px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));margin-top:4px}`,oYn=aYn;var Pre=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const vM=class{constructor(t){kt(this,t),this.iconPack=Nt,this.t=It(),this.isNetworkOpen=!0,this.isDevicesOpen=!1,this.videoProducerFormattedStats=[],this.videoProducerScoreStats=null,this.audioProducerFormattedStats=[],this.audioProducerScoreStats=null,this.networkBasedMediaHealth=null,this.mediaScoreUpdateListener=({kind:e,isScreenshare:n,scoreStats:r})=>{e==="video"&&n&&(this.videoProducerScoreStats=r),e==="audio"&&n&&(this.audioProducerScoreStats=r)},this.screenShareUpdateListener=()=>{this.meeting.self.screenShareEnabled||(this.videoProducerScoreStats=null,this.audioProducerScoreStats=null)}}async videoProducerScoreStatsChanged(t){if(!t){this.videoProducerFormattedStats=[];return}const e=t,n=[];n.push({name:this.t("debugger.stats.cpu_limitations.label"),value:e.cpuLimitations?"Yes":"No",description:this.t("debugger.stats.cpu_limitations.description"),verdict:e.cpuLimitations?"Poor":"Good"}),n.push({name:this.t("debugger.stats.bandwidth_limitations.label"),value:e.bandwidthLimitations?"Yes":"No",description:this.t("debugger.stats.bandwidth_limitations.description"),verdict:e.bandwidthLimitations?"Poor":"Good"}),n.push({name:this.t("debugger.stats.bitrate.label"),value:`${Math.round(e.bitrate/1024)} kbps`,description:this.t("debugger.stats.bitrate.description"),verdict:JQ({bitrate:e.bitrate})}),n.push({name:this.t("debugger.stats.packet_loss.label"),value:`${e.packetsLostPercentage}%`,description:this.t("debugger.stats.packet_loss.description"),verdict:QQ({packetLossPercentage:e.packetsLostPercentage})}),n.push({name:this.t("debugger.stats.jitter.label"),value:`${Math.round(e.jitter*1e3)} ms`,description:this.t("debugger.stats.jitter.description"),verdict:ZQ({jitterInMS:e.jitter*1e3})}),this.videoProducerFormattedStats=n,this.networkBasedMediaHealth=DTe({stats:n})}async audioProducerScoreStatsChanged(t){if(!t){this.audioProducerFormattedStats=[];return}const e=t,n=[];n.push({name:this.t("debugger.stats.bitrate.label"),value:`${Math.round(e.bitrate/1024)} kbps`,description:this.t("debugger.stats.bitrate.description"),verdict:JQ({bitrate:e.bitrate})}),n.push({name:this.t("debugger.stats.packet_loss.label"),value:`${e.packetsLostPercentage}%`,description:this.t("debugger.stats.packet_loss.description"),verdict:QQ({packetLossPercentage:e.packetsLostPercentage})}),n.push({name:this.t("debugger.stats.jitter.label"),value:`${Math.round(e.jitter*1e3)} ms`,description:this.t("debugger.stats.jitter.description"),verdict:ZQ({jitterInMS:e.jitter*1e3})}),this.audioProducerFormattedStats=n}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.meeting&&(this.meeting.self.off("mediaScoreUpdate",this.mediaScoreUpdateListener),this.meeting.self.off("screenShareUpdate",this.screenShareUpdateListener))}async meetingChanged(t){t&&(t.self.on("mediaScoreUpdate",this.mediaScoreUpdateListener),t.self.on("screenShareUpdate",this.screenShareUpdateListener))}render(){var t,e;if(this.meeting)return $(mt,null,$("div",{id:"header"}),$("div",{class:"tab-body"},$("div",{class:"status-container"},$("div",{class:"status-section"},$("div",{class:`section-header ${this.networkBasedMediaHealth?"":"only-child"}`},$("span",null,this.t("debugger.screenshare.sections.network_media")),this.networkBasedMediaHealth&&$("span",{class:`status ${(t=this.networkBasedMediaHealth)===null||t===void 0?void 0:t.toLowerCase()}`},this.t(`debugger.quality.${(e=this.networkBasedMediaHealth)===null||e===void 0?void 0:e.toLowerCase()}`))),this.isNetworkOpen&&!this.videoProducerFormattedStats.length&&$("div",{class:"section-body missing-stats"},this.meeting.self.screenShareEnabled?$("span",null,this.t("debugger.screenshare.messages.generating_report")):$("span",null,this.t("debugger.screenshare.messages.enable_media"))),this.isNetworkOpen&&!!this.videoProducerFormattedStats.length&&$("div",{class:"section-body network-table"},this.videoProducerFormattedStats.map(n=>{var r,s;return $("div",{class:"network-row"},$("div",{class:"network-cell label"},$("strong",null,n.name),$("span",{class:"description"},n.description)),$("div",{class:"network-cell value"},$("span",{class:`status ${(r=n.verdict)===null||r===void 0?void 0:r.toLowerCase()}`},this.t(`debugger.quality.${(s=n.verdict)===null||s===void 0?void 0:s.toLowerCase()}`)),$("span",{class:"value"},n.value)))}))))))}static get watchers(){return{videoProducerScoreStats:["videoProducerScoreStatsChanged"],audioProducerScoreStats:["audioProducerScoreStatsChanged"],meeting:["meetingChanged"]}}};Pre([ge()],vM.prototype,"meeting",void 0);Pre([ge()],vM.prototype,"states",void 0);Pre([ge()],vM.prototype,"iconPack",void 0);Pre([ge()],vM.prototype,"t",void 0);vM.style=oYn;const lYn=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;display:flex;flex-direction:column;overflow:hidden;height:100%;width:100%;color:rgb(var(--rtk-colors-text-1000, 255 255 255));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.tab-body::-webkit-scrollbar{width:var(--rtk-space-1\\.5, 6px);border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}.tab-body::-webkit-scrollbar-thumb{border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}h3{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px);font-size:16px;font-weight:600}#header{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-5, 20px);display:flex;align-items:center;justify-content:space-evenly}.tab-body{margin:var(--rtk-space-4, 16px);display:flex;height:100%;flex-direction:column;justify-content:space-between;overflow-y:auto}.status-container{border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));border-radius:8px;padding:16px}.status-section{margin-bottom:12px}.section-header{display:flex;justify-content:space-between;align-items:center;font-weight:bold;padding:8px 0}.section-body.missing-stats{display:flex;text-align:center;justify-content:center}.section-header .status{color:rgba(var(--rtk-colors-success));font-weight:bold}.section-header .arrow{font-size:14px}.battery-table{border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));border-radius:8px;margin-top:8px;overflow:hidden}.battery-row{display:flex;justify-content:space-between;padding:12px;border-bottom:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60))}.battery-row:last-child{border-bottom:none}.battery-cell{display:flex;flex-direction:column}.battery-cell.label strong{font-size:14px}.battery-cell.label .description{font-size:12px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));margin-top:4px}.battery-cell.value{text-align:right}.status.good{color:rgba(var(--rtk-colors-success))}.status.average{color:rgba(var(--rtk-colors-warning))}.status.poor{color:rgba(var(--rtk-colors-danger))}.value{font-size:14px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));margin-top:4px}rtk-settings-video{display:flex;flex-direction:column}`,cYn=lYn;var Rre=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const yM=class{constructor(t){kt(this,t),this.iconPack=Nt,this.t=It(),this.isBatterySectionOpen=!0,this.batterySectionHealth=null,this.battery=null,this.batteryFormattedStats=[],this.batteryUpdateListener=()=>{const e=Math.round(this.battery.level*100),n=[];n.push({name:this.t("debugger.system.battery.level.label"),value:`${e}%`,description:this.t("debugger.system.battery.level.description"),verdict:nYn({batteryLevelPercentage:e})}),n.push({name:this.t("debugger.system.battery.charging.label"),value:`${this.battery.charging?this.t("debugger.system.battery.charging.is_charging"):this.t("debugger.system.battery.charging.is_not_charging")}`,description:this.t("debugger.system.battery.charging.description"),verdict:rYn({batteryLevelPercentage:e,chargingTimeInSeconds:this.battery.chargingTime,dischargingTimeInSeconds:this.battery.dischargingTime,charging:this.battery.charging})}),this.batterySectionHealth=tYn({stats:n}),this.batteryFormattedStats=n}}toggleSection(t){t==="battery"&&(this.isBatterySectionOpen=!this.isBatterySectionOpen)}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.meeting&&this.battery&&(this.battery.removeEventListener("levelchange",this.batteryUpdateListener),this.battery.removeEventListener("chargingchange",this.batteryUpdateListener))}async meetingChanged(t){t&&typeof navigator.getBattery<"u"&&(this.battery=await navigator.getBattery(),this.battery.addEventListener("levelchange",this.batteryUpdateListener),this.battery.addEventListener("chargingchange",this.batteryUpdateListener),this.batteryUpdateListener())}render(){var t,e;if(this.meeting)return $(mt,null,$("div",{id:"header"}),$("div",{class:"tab-body"},$("div",{class:"status-container"},$("div",{class:"status-section"},$("div",{class:"section-header",onClick:()=>this.toggleSection("battery")},$("span",null,this.t("debugger.system.sections.battery")),this.batterySectionHealth&&$("span",{class:`status ${(t=this.batterySectionHealth)===null||t===void 0?void 0:t.toLowerCase()}`},this.t(`debugger.quality.${(e=this.batterySectionHealth)===null||e===void 0?void 0:e.toLowerCase()}`))),this.isBatterySectionOpen&&!!this.batteryFormattedStats.length&&$("div",{class:"section-body battery-table"},this.batteryFormattedStats.map(n=>{var r,s;return $("div",{class:"battery-row"},$("div",{class:"battery-cell label"},$("strong",null,n.name),$("span",{class:"description"},n.description)),$("div",{class:"battery-cell value"},$("span",{class:`status ${(r=n.verdict)===null||r===void 0?void 0:r.toLowerCase()}`},this.t(`debugger.quality.${(s=n.verdict)===null||s===void 0?void 0:s.toLowerCase()}`)),$("span",{class:"value"},n.value)))}))))))}static get watchers(){return{meeting:["meetingChanged"]}}};Rre([ge()],yM.prototype,"meeting",void 0);Rre([ge()],yM.prototype,"states",void 0);Rre([ge()],yM.prototype,"iconPack",void 0);Rre([ge()],yM.prototype,"t",void 0);yM.style=cYn;const dYn=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}:host{position:relative;display:flex;flex-direction:column;overflow:hidden;height:100%;width:100%;color:rgb(var(--rtk-colors-text-1000, 255 255 255));--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity))}.tab-body::-webkit-scrollbar{width:var(--rtk-space-1\\.5, 6px);border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity))}.tab-body::-webkit-scrollbar-thumb{border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}h3{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px);font-size:16px;font-weight:600}#header{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-5, 20px);display:flex;align-items:center;justify-content:space-evenly}.tab-body{margin:var(--rtk-space-4, 16px);display:flex;height:100%;flex-direction:column;justify-content:space-between;overflow-y:auto}.status-container{border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));border-radius:8px;padding:16px}.status-section{margin-bottom:12px}.section-header{display:flex;justify-content:space-between;align-items:center;font-weight:bold;padding:8px 0}.section-header.only-child{justify-content:center}.section-body.missing-stats{display:flex;text-align:center;justify-content:center}.section-header .status{color:rgba(var(--rtk-colors-success));font-weight:bold}.section-header .arrow{font-size:14px}.network-table{border:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60));border-radius:8px;margin-top:8px;overflow:hidden}.network-row{display:flex;justify-content:space-between;padding:12px;border-bottom:var(--rtk-border-width-sm, 1px) solid rgb(var(--rtk-colors-background-600, 60 60 60))}.network-row:last-child{border-bottom:none}.network-cell{display:flex;flex-direction:column}.network-cell.label strong{font-size:14px}.network-cell.label .description{font-size:12px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));margin-top:4px}.network-cell.value{text-align:right}.status.good{color:rgba(var(--rtk-colors-success))}.status.average{color:rgba(var(--rtk-colors-warning))}.status.poor{color:rgba(var(--rtk-colors-danger))}.value{font-size:14px;color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));margin-top:4px}rtk-settings-video{display:flex;flex-direction:column}`,uYn=dYn;var Ire=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const bM=class{constructor(t){kt(this,t),this.iconPack=Nt,this.t=It(),this.isNetworkOpen=!0,this.isDevicesOpen=!1,this.videoProducerFormattedStats=[],this.videoProducerScoreStats=null,this.networkBasedMediaHealth=null,this.devicesHealth=null,this.mediaScoreUpdateListener=({kind:e,isScreenshare:n,scoreStats:r})=>{e==="video"&&!n&&(this.videoProducerScoreStats=r)},this.deviceListUpdateListener=async()=>{const e=await this.meeting.self.getVideoDevices();this.devicesHealth=(e==null?void 0:e.length)>0?"Good":"Poor"},this.videoUpdateListener=()=>{this.meeting.self.videoEnabled||(this.videoProducerScoreStats=null)}}async videoProducerScoreStatsChanged(t){if(!t){this.videoProducerFormattedStats=[];return}const e=t,n=[];n.push({name:this.t("debugger.stats.cpu_limitations.label"),value:e.cpuLimitations?"Yes":"No",description:this.t("debugger.stats.cpu_limitations.description"),verdict:e.cpuLimitations?"Poor":"Good"}),n.push({name:this.t("debugger.stats.bandwidth_limitations.label"),value:e.bandwidthLimitations?"Yes":"No",description:this.t("debugger.stats.bandwidth_limitations.description"),verdict:e.bandwidthLimitations?"Poor":"Good"}),n.push({name:this.t("debugger.stats.bitrate.label"),value:`${Math.round(e.bitrate/1024)} kbps`,description:this.t("debugger.stats.bitrate.description"),verdict:JQ({bitrate:e.bitrate})}),n.push({name:this.t("debugger.stats.packet_loss.label"),value:`${e.packetsLostPercentage}%`,description:this.t("debugger.stats.packet_loss.description"),verdict:QQ({packetLossPercentage:e.packetsLostPercentage})}),n.push({name:this.t("debugger.stats.jitter.label"),value:`${Math.round(e.jitter*1e3)} ms`,description:this.t("debugger.stats.jitter.description"),verdict:ZQ({jitterInMS:e.jitter*1e3})}),this.videoProducerFormattedStats=n,this.networkBasedMediaHealth=DTe({stats:n})}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){this.meeting&&(this.meeting.self.off("mediaScoreUpdate",this.mediaScoreUpdateListener),this.meeting.self.off("videoUpdate",this.videoUpdateListener),this.meeting.self.off("deviceListUpdate",this.deviceListUpdateListener))}async meetingChanged(t){t&&(t.self.on("mediaScoreUpdate",this.mediaScoreUpdateListener),t.self.on("videoUpdate",this.videoUpdateListener),t.self.on("deviceListUpdate",this.deviceListUpdateListener),await this.deviceListUpdateListener())}render(){var t,e;if(this.meeting)return $(mt,null,$("div",{id:"header"}),$("div",{class:"tab-body"},$("div",{class:"status-container"},$("div",{class:"status-section"},$("div",{class:`section-header ${this.networkBasedMediaHealth?"":"only-child"}`},$("span",null,this.t("debugger.video.sections.network_media")),this.networkBasedMediaHealth&&$("span",{class:`status ${(t=this.networkBasedMediaHealth)===null||t===void 0?void 0:t.toLowerCase()}`},this.t(`debugger.quality.${(e=this.networkBasedMediaHealth)===null||e===void 0?void 0:e.toLowerCase()}`))),this.isNetworkOpen&&!this.videoProducerFormattedStats.length&&$("div",{class:"section-body missing-stats"},this.meeting.self.videoEnabled?$("span",null,this.t("debugger.video.messages.generating_report")):$("span",null,this.t("debugger.video.messages.enable_media"))),this.isNetworkOpen&&!!this.videoProducerFormattedStats.length&&$("div",{class:"section-body network-table"},this.videoProducerFormattedStats.map(n=>{var r,s;return $("div",{class:"network-row"},$("div",{class:"network-cell label"},$("strong",null,n.name),$("span",{class:"description"},n.description)),$("div",{class:"network-cell value"},$("span",{class:`status ${(r=n.verdict)===null||r===void 0?void 0:r.toLowerCase()}`},this.t(`debugger.quality.${(s=n.verdict)===null||s===void 0?void 0:s.toLowerCase()}`)),$("span",{class:"value"},n.value)))}))))))}static get watchers(){return{videoProducerScoreStats:["videoProducerScoreStatsChanged"],meeting:["meetingChanged"]}}};Ire([ge()],bM.prototype,"meeting",void 0);Ire([ge()],bM.prototype,"states",void 0);Ire([ge()],bM.prototype,"iconPack",void 0);Ire([ge()],bM.prototype,"t",void 0);bM.style=uYn;var hYn=Object.freeze({__proto__:null,rtk_debugger_audio:gM,rtk_debugger_screenshare:vM,rtk_debugger_system:yM,rtk_debugger_video:bM});const mYn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{word-wrap:break-word;overflow-wrap:break-word}#dialog{position:relative;max-height:100%;max-width:100%;padding:var(--rtk-space-0, 0px);border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}#dialog::backdrop{background-color:rgba(var(--rtk-colors-background-600, 60 60 60) / 0.5);backdrop-filter:blur(12px) saturate(180%)}#dismiss-btn{position:absolute;top:var(--rtk-space-3, 12px);right:var(--rtk-space-3, 12px);z-index:50}::slotted(*){max-width:100%;height:auto;min-height:-moz-fit-content;min-height:fit-content}",fYn=mYn;var PB=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const yN=class{constructor(t){kt(this,t),this.onClose=Wt(this,"rtkDialogClose",7),this.hideCloseButton=!1,this.disableEscapeKey=!1,this.config=Os(),this.iconPack=Nt,this.t=It(),this.open=!0,this.close=()=>{this.open=!1,this.onClose.emit()},this.keydownListener=e=>{!this.disableEscapeKey&&e.key==="Escape"&&this.open&&this.close()}}connectedCallback(){document.addEventListener("keydown",this.keydownListener)}disconnectedCallback(){document.removeEventListener("keydown",this.keydownListener)}componentDidRender(){this.open&&!this.dialogEl.open&&this.dialogEl.showModal()}render(){return this.open?$(mt,null,$("dialog",{ref:t=>this.dialogEl=t,id:"dialog",part:"container",onClose:this.close,onClick:t=>{!this.disableEscapeKey&&t.target===this.dialogEl&&this.close()},onKeyDown:t=>{this.disableEscapeKey&&t.key==="Escape"&&t.preventDefault()}},$("slot",null),!this.hideCloseButton&&$("rtk-button",{part:"close-button",id:"dismiss-btn",kind:"icon",variant:"ghost",onClick:()=>this.close(),type:"button","aria-label":this.t("dialog.close"),role:"button"},$("rtk-icon",{icon:this.iconPack.dismiss})))):null}};PB([ge()],yN.prototype,"meeting",void 0);PB([ge()],yN.prototype,"config",void 0);PB([ge()],yN.prototype,"states",void 0);PB([ge()],yN.prototype,"iconPack",void 0);PB([ge()],yN.prototype,"t",void 0);yN.style=fYn;var pYn=Object.freeze({__proto__:null,rtk_dialog:yN}),$wt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const $Te=class{constructor(t){kt(this,t),this.now=new Date,this.isContinued=!1,this.iconPack=Nt,this.t=It(),this.showBubble=!1}render(){const t=D7(this.message.link);return $(mt,{key:"b10da5fd1c4c6d80a1e5bf5f35f4956abde0ed5d"},!this.isContinued&&$(Cre,{key:"fb1384ad8bfc73219b28c4500f78e6c6421ee848",name:this.message.displayName,time:this.message.time,now:this.now}),$("div",{key:"81a067a5567ad160e4398a6f16b21309f81a0c9b",class:{body:!0,bubble:this.showBubble},part:"body"},$("div",{key:"c6eb4b26b0090b7f9fd6af9e79d04c8b4e76a6d1",class:"file"},$("div",{key:"10e9b854fa0c1f311bb1bc76c90223220c9a10f3",class:"file-data"},$("div",{key:"ace6eeb050ad6c656cd215456b69f8b6e9529aec",class:"name"},this.message.name),$("div",{key:"562de08ebd242e92aeca1fae0aa4823612a60c1c",class:"file-data-split"},$("div",{key:"968eee3032f98a59da43c0b4604dc597c4bfd94c",class:"ext"},Fbt(this.message.name)),$("span",{key:"2cb436ffed86b9c3a73ff5feab9d3ec7c8e0ef3b",class:"divider"}),$("div",{key:"9cc1d37edf60fbd3d3538512539a79244ffd74de",class:"size"},Bbt(this.message.size)))),$("rtk-button",{key:"e4eb744391b8fe61bd4d58e3ac3d7d10ee748976",variant:"secondary",kind:"icon",onClick:()=>$7(t,{name:this.message.name,fallbackName:"file"}),part:"button"},$("rtk-icon",{key:"79efeb36257d970f243d1730d0ac4ad84bc6993d",icon:this.iconPack.download})))))}};$wt([ge()],$Te.prototype,"iconPack",void 0);$wt([ge()],$Te.prototype,"t",void 0);const gYn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.image-spinner{cursor:wait}.image-errored{cursor:not-allowed}",vYn=gYn;var Owt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const Mre=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.now=new Date,this.isContinued=!1,this.iconPack=Nt,this.t=It(),this.showBubble=!1,this.status="loading"}render(){return $(mt,{key:"8ac3f237a8d77254219f8b5763dd6b53d2cb764b"},!this.isContinued&&$(Cre,{key:"6eb17e16b4fd4e12d3b8a7ce8a5bcfd548930a50",name:this.message.displayName,time:this.message.time,now:this.now}),$("div",{key:"d5cce1675057a0378425452898fcbc4c738b7bb2",class:{body:!0,bubble:this.showBubble},part:"body"},$("div",{key:"45f073d8268c92aee4fec8b139fd325e668dab76",class:{image:!0,loaded:this.status==="loaded"}},$("img",{key:"28a206e34b791205e042233ee7f317f389f421da",src:D7(this.message.link),onLoad:()=>{this.status="loaded"},onError:()=>{this.status="errored"},onClick:()=>{this.status==="loaded"&&this.stateUpdate.emit({image:this.message})}}),this.status==="loading"&&$("div",{key:"b7862bff3f6c9df7042bdab2f6b0370e7c362f02",class:"image-spinner",title:this.t("chat.img.loading"),"aria-label":this.t("chat.img.loading")},$("rtk-spinner",{key:"460074eae700cd3f522019f967ba5955b9eb972e",iconPack:this.iconPack})),this.status==="errored"&&$("div",{key:"bdf48c8fdc5057d2c77d10b64d7af5576f478556",class:"image-errored",title:this.t("chat.error.img_not_found"),"aria-label":this.t("chat.error.img_not_found")},$("rtk-icon",{key:"523e5ff6dd4579082e5953346155df9b7b23862f",icon:this.iconPack.image_off})),this.status==="loaded"&&$("div",{key:"89e3679101615838ec6a0f521b98386454d25197",class:"actions"},$("rtk-button",{key:"ccaed0a3d70945d66e7b700e01bbc5289421f8ae",class:"action",variant:"secondary",kind:"icon",onClick:()=>{this.stateUpdate.emit({image:this.message})}},$("rtk-icon",{key:"ee20f5497dbb38590de65c4a404eda90b0d5c4e5",icon:this.iconPack.full_screen_maximize})),$("rtk-button",{key:"181d39cfd837e45d3da1aa0fa0f97226c50cb46a",class:"action",variant:"secondary",kind:"icon",onClick:()=>$7(this.message.link,{fallbackName:"image"})},$("rtk-icon",{key:"53c7e551ec4a2efb32d60d16eb2a4a02144abf4f",icon:this.iconPack.download}))))))}};Owt([ge()],Mre.prototype,"iconPack",void 0);Owt([ge()],Mre.prototype,"t",void 0);Mre.style=vYn;var Fwt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const OTe=class{constructor(t){kt(this,t),this.now=new Date,this.isContinued=!1,this.iconPack=Nt,this.t=It(),this.showBubble=!1}render(){return $(mt,{key:"a34dd007a87a134202e153f3d886102bbe6a685c"},!this.isContinued&&$(Cre,{key:"8505cee0d359b7449776ece2bbd7455811217a41",name:this.message.displayName,time:this.message.time,now:this.now}),$("div",{key:"00b2baca454b62e4984e82790580bac116a046a0",class:{body:!0,bubble:this.showBubble},part:"body"},$("div",{key:"ecc8de946011c9836cebfd626a27cb23f111d0cc",class:{text:!0,emoji:Lbt(this.message.message)}},$(Rwt,{key:"1efad576e6110986cb2abac7ff2c42b492c995aa",message:this.message.message}))))}};Fwt([ge()],OTe.prototype,"iconPack",void 0);Fwt([ge()],OTe.prototype,"t",void 0);var yYn=Object.freeze({__proto__:null,rtk_file_message:$Te,rtk_image_message:Mre,rtk_text_message:OTe});const bYn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:block}:host([data-hidden]){display:none}",xYn=bYn;var FTe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const RB=class{constructor(t){kt(this,t),this.stateUpdate=Wt(this,"rtkStateUpdate",7),this.variant="button",this.iconPack=Nt,this.t=It(),this.fullScreenActive=!1,this.isFullScreenSupported=!0,this.onFullScreenchange=()=>{this.fullScreenActive=qxt()},this.toggleFullScreen=()=>{let e=this.targetElement||document.querySelector("rtk-meeting");e&&(this.fullScreenActive?(Wxt(),this.fullScreenActive=!1):(Gxt(e),this.fullScreenActive=!0),this.stateUpdate.emit({activeMoreMenu:!1}))}}connectedCallback(){this.isFullScreenSupported=Kxt(),this.onFullScreenchange(),window.addEventListener("webkitfullscreenchange",this.onFullScreenchange),window.addEventListener("fullscreenchange",this.onFullScreenchange)}disconnectedCallback(){window.removeEventListener("webkitfullscreenchange",this.onFullScreenchange),window.removeEventListener("fullscreenchange",this.onFullScreenchange)}render(){return this.isFullScreenSupported?$(mt,{title:this.t("full_screen")},$("rtk-controlbar-button",{size:this.size,iconPack:this.iconPack,onClick:this.toggleFullScreen,icon:this.fullScreenActive?this.iconPack.full_screen_minimize:this.iconPack.full_screen_maximize,label:this.fullScreenActive?this.t("full_screen.exit"):this.t("full_screen"),variant:this.variant})):$(mt,{"data-hidden":!0})}};FTe([ge()],RB.prototype,"states",void 0);FTe([ge()],RB.prototype,"iconPack",void 0);FTe([ge()],RB.prototype,"t",void 0);RB.style=xYn;var wYn=Object.freeze({__proto__:null,rtk_fullscreen_toggle:RB});const kYn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{position:relative;display:flex;height:var(--rtk-space-14, 56px);align-items:center;justify-content:space-between;cursor:pointer;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}:host rtk-avatar{height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);font-size:14px}.left{display:flex;align-items:center}.left>*{margin-right:var(--rtk-space-2, 8px)}.left>*:last-child{margin-right:var(--rtk-space-0, 0px)}.right{display:flex;align-items:center;justify-content:flex-end}.right>*{margin-left:var(--rtk-space-2, 8px)}.right>*:first-child{margin-left:var(--rtk-space-0, 0px)}.name{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}rtk-icon{height:var(--rtk-space-6, 24px);width:var(--rtk-space-6, 24px)}rtk-icon.red{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}rtk-icon.more{cursor:pointer}.menu{position:relative;display:inline-block;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}#menu-list{position:absolute;z-index:20}",SYn=kYn;var IB=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const bN=class{constructor(t){kt(this,t),this.rtkSendNotification=Wt(this,"rtkSendNotification",7),this.pinnedListener=({isPinned:e})=>{this.isPinned=e},this.toggleTileListener=({hidden:e})=>{this.isHidden=e},this.stageListener=({stageStatus:e})=>{this.isOnStage=e==="ON_STAGE"},this.view="sidebar",this.iconPack=Nt,this.t=It(),this.config=Os(),this.audioEnabled=!1,this.videoEnabled=!1,this.isPinned=!1,this.isHidden=!1,this.isOnStage=!1,this.canDisableParticipantAudio=!1,this.canDisableParticipantVideo=!1,this.canKickParticipant=!1,this.canPinParticipant=!1,this.canAllowParticipantOnStage=!1,this.menuOpen=!1,this.permissionsUpdateListener=()=>{this.meetingChanged(this.meeting)},this.inviteToStageToggle=async()=>{const e=this.participant,{stage:n}=this.meeting;if(e.stageStatus==="ACCEPTED_TO_JOIN_STAGE"){this.rtkSendNotification.emit({message:`${e.name} ${this.t("stage.invited_notification")}`,trace:`join-stage-${e.id}`});return}this.isOnStage?(e.isPinned&&e.unpin(),await n.kick([e.userId])):(await n.grantAccess([e.userId]),this.rtkSendNotification.emit({message:`${e.name} ${this.t("stage.invited_notification")}`,trace:`join-stage-invite-${e.id}`})),this.isOnStage=e.stageStatus==="ON_STAGE"},this.handleOutsideClick=e=>{!e.composedPath().includes(this.host)&&this.menuOpen&&(this.menuOpen=!1)},this.update=()=>{const e=this.host.shadowRoot.getElementById("trigger"),n=this.host.shadowRoot.getElementById("menu-list");MNe(e,n,{placement:"bottom-end",middleware:[wFn({allowedPlacements:["bottom-end","top-end"],alignment:"end"}),RNe(4),INe({padding:8}),kFn()]}).then(({x:r,y:s,placement:i})=>{let o=null;i==="bottom-end"?o={right:`${r}px`,top:`${s}px`}:o={right:`${r}px`,bottom:`${s}px`},Object.assign(n.style,o)})},this.onMenuToggle=()=>{this.menuOpen=!this.menuOpen,this.menuOpen&&this.update()}}connectedCallback(){this.meetingChanged(this.meeting),this.participantChanged(this.participant),document.addEventListener("click",this.handleOutsideClick)}disconnectedCallback(){var t;document.removeEventListener("click",this.handleOutsideClick),(t=this.meeting)===null||t===void 0||t.self.permissions.removeListener("permissionsUpdate",this.permissionsUpdateListener),!(this.participant==null||this.participant.removeListener==null)&&(this.audioUpdateListener&&this.participant.removeListener("audioUpdate",this.audioUpdateListener),this.videoUpdateListener&&this.participant.removeListener("videoUpdate",this.videoUpdateListener),this.participant.removeListener("pinned",this.pinnedListener),this.participant.removeListener("unpinned",this.pinnedListener),this.participant.removeListener("stageStatusUpdate",this.stageListener),this.participant.removeListener("toggleTile",this.toggleTileListener))}meetingChanged(t){if(t!=null){const{self:e}=t;this.canDisableParticipantAudio=e.permissions.canAllowParticipantAudio||e.permissions.canDisableParticipantAudio,this.canDisableParticipantVideo=e.permissions.canAllowParticipantVideo||e.permissions.canDisableParticipantVideo,this.canKickParticipant=e.permissions.kickParticipant,this.canPinParticipant=e.permissions.pinParticipant,this.canAllowParticipantOnStage=e.permissions.acceptStageRequests&&e.permissions.stageEnabled,t.self.permissions.addListener("permissionsUpdate",this.permissionsUpdateListener)}}participantChanged(t){var e;if(t!=null){if(this.audioEnabled=t.audioEnabled,this.videoEnabled=t.videoEnabled,this.isPinned=t.isPinned,this.isHidden=(e=t.hidden)!==null&&e!==void 0?e:!1,this.isOnStage=t.stageStatus==="ON_STAGE",this.audioUpdateListener=({audioEnabled:n})=>{this.audioEnabled=n},this.videoUpdateListener=({videoEnabled:n})=>{this.videoEnabled=n},t.addListener==null)return;t.addListener("audioUpdate",this.audioUpdateListener),t.addListener("videoUpdate",this.videoUpdateListener),t.addListener("pinned",this.pinnedListener),t.addListener("unpinned",this.pinnedListener),t.addListener("stageStatusUpdate",this.stageListener),this.participant.addListener("toggleTile",this.toggleTileListener)}}render(){var t,e,n,r,s,i,o,l,c;const d=((t=this.meeting)===null||t===void 0?void 0:t.meta.viewType)==="AUDIO_ROOM",u=((e=this.meeting)===null||e===void 0?void 0:e.self.id)===this.participant.id,h=this.canDisableParticipantAudio&&this.audioEnabled||this.canDisableParticipantVideo&&this.videoEnabled&&!d||this.canKickParticipant||this.canPinParticipant&&this.isOnStage||this.canAllowParticipantOnStage,m=Rf(((n=this.participant)===null||n===void 0?void 0:n.name)||""),f=this.isOnStage||["GROUP_CALL","AUDIO_ROOM"].includes((r=this.meeting)===null||r===void 0?void 0:r.meta.viewType),p={meeting:this.meeting,size:"sm",states:this.states,config:this.config,iconPack:this.iconPack,t:this.t};return $(mt,{key:"72dec22593ebf143608cd671c2fdf533378acae2"},$("div",{class:"left",key:(s=this.participant)===null||s===void 0?void 0:s.id},$("rtk-avatar",{key:"e71b096c53fe07f425adf1e47d9adb6ee9e7c212",participant:this.participant,size:"sm",iconPack:this.iconPack,t:this.t}),$("p",{key:"492fe90030df26c000d2db3b0355d713e3a8ccf9",class:"name",title:m},pm(m,16)," ",((i=this.meeting)===null||i===void 0?void 0:i.self.id)===((o=this.participant)===null||o===void 0?void 0:o.id)&&this.t("(you)"))),this.view==="sidebar"&&$("div",{key:"66ef58575c0c27d7afe631a544a44cb37c526c4c",class:"right"},f&&$("rtk-icon",{key:"adbbf629c1a4f1034127be89c09f8003d3cfe3a7",class:{red:!this.audioEnabled},icon:this.audioEnabled?this.iconPack.mic_on:this.iconPack.mic_off}),f&&!d&&$("rtk-icon",{key:"ef0b24e9fb292968c96cb74be8d63f14fde38a44",class:{red:!this.videoEnabled},icon:this.videoEnabled?this.iconPack.video_on:this.iconPack.video_off}),(h||y6n({element:"rtk-participant",defaults:p,childProps:{participant:this.participant}})>0)&&$("div",{key:"38d52737db83f9c444211e3040cf09f5f47c1513",class:"menu"},$("span",{key:"f061992198025919d2bcf14cd1a6eee3f077beaf",id:"trigger",onClick:this.onMenuToggle},$("rtk-button",{key:"7eb863089acda3f9e20e5aedbcf55742c4b4eb64",variant:"ghost",kind:"icon",slot:"trigger"},$("rtk-icon",{key:"a7ff6d6dc9e1139f3b367ab662ad49b79e8258ff",class:"more",icon:this.iconPack.more_vertical}))),$("span",{key:"9188d1538accf4e4769f58580651e0ededa3dd75",id:"menu-list"},this.menuOpen&&$("rtk-menu-list",{key:"ef8b7d03841f4920dc7eb295456669975d06ee2f",iconPack:this.iconPack,t:this.t},this.canPinParticipant&&f&&!d&&$("rtk-menu-item",{key:"d82737dc1227c642ce9c3880fcbe373ff6e0ec0c",onClick:()=>{this.isPinned?this.participant.unpin():this.participant.pin()},iconPack:this.iconPack,t:this.t},$("rtk-icon",{key:"50e63cba1117df61588026b064046779a1e905fb",icon:this.isPinned?this.iconPack.pin_off:this.iconPack.pin,slot:"start"}),this.isPinned?this.t("unpin"):this.t("pin")),u&&$("rtk-menu-item",{key:"662d993d406bd00f014f41425ceb728ab4454ebd",iconPack:this.iconPack,t:this.t,onClick:()=>{this.isHidden?this.participant.show():this.participant.hide()}},$("rtk-icon",{key:"8b296bdb308c3a18a7ec13bca1047277a60b0887",icon:this.isHidden?this.iconPack.minimize:this.iconPack.maximize,slot:"start"}),this.meeting.self.hidden?this.t("maximize"):this.t("minimize")),this.canDisableParticipantAudio&&f&&this.audioEnabled&&$("rtk-menu-item",{key:"efea4ce4a51bbe2203635e0a95878d80cfe460e4",iconPack:this.iconPack,t:this.t,onClick:()=>{this.participant.disableAudio()}},$("rtk-icon",{key:"cdc27b2554c89ef5c3441de551c2bdbf4e91ed72",icon:this.iconPack.mic_off,slot:"start"}),this.t("mute")),this.canDisableParticipantVideo&&f&&this.videoEnabled&&$("rtk-menu-item",{key:"4f1f4e0610cb9fa7a993b824defc71af47711cb1",iconPack:this.iconPack,t:this.t,onClick:()=>{this.participant.disableVideo()}},$("rtk-icon",{key:"234d891a3ea80dbda3172e8e6a89d71a44676770",icon:this.iconPack.video_off,slot:"start"}),this.t("participants.turn_off_video")),this.canAllowParticipantOnStage&&((l=this.participant)===null||l===void 0?void 0:l.id)!==((c=this.meeting)===null||c===void 0?void 0:c.self.id)&&$("rtk-menu-item",{key:"90c465f0f66a792f160b6226714dd07e51c57616",iconPack:this.iconPack,t:this.t,class:this.isOnStage?"red":"",onClick:this.inviteToStageToggle},$("rtk-icon",{key:"a5605d8b2864e27817646fc585e6598cd547ca70",icon:this.isOnStage?this.iconPack.leave_stage:this.iconPack.join_stage,slot:"start"}),this.isOnStage?this.t("stage.remove_from_stage"):this.t("stage.add_to_stage")),!u&&this.canKickParticipant&&$("rtk-menu-item",{key:"0e5fe7c7f6e61599293843466c5b473226348d26",iconPack:this.iconPack,t:this.t,class:"red",onClick:()=>{var g,v,b;(b=(g=this.meeting)===null||g===void 0?void 0:g.participants.joined.get((v=this.participant)===null||v===void 0?void 0:v.id))===null||b===void 0||b.kick()}},$("rtk-icon",{key:"c7d370837be33a1a14fb32f64a35da3fdceafe28",icon:this.iconPack.dismiss,slot:"start"}),this.t("kick")),$("slot",{key:"ec5dea9563b71323776808d8ef1991cda87e625f"},$(tc,{key:"6c423497a1c2f31a7190305913dce0019cf943f1",element:"rtk-participant",defaults:p,childProps:{participant:this.participant},deepProps:!0,onlyChildren:!0})))))))}get host(){return Pl(this)}static get watchers(){return{meeting:["meetingChanged"],participant:["participantChanged"]}}};IB([ge()],bN.prototype,"meeting",void 0);IB([ge()],bN.prototype,"states",void 0);IB([ge()],bN.prototype,"iconPack",void 0);IB([ge()],bN.prototype,"t",void 0);IB([ge()],bN.prototype,"config",void 0);bN.style=SYn;const CYn=":host{height:100%;width:100%}",jYn=CYn,Bwt=class{constructor(t){kt(this,t),this.items=[],this.itemHeight=55,this.bufferedItemsCount=5,this.emptyListElement=null,this.visibleStart=0,this.visibleEnd=0,this.containerHeight=0,this.lastScrollTop=0,this.recalculatePositioning=()=>{this.updateContainerHeight(),requestAnimationFrame(()=>{this.updateItemHeight()})},this.updateContainerHeight=()=>{this.el.querySelector(".virtual-list-container").clientHeight&&(requestAnimationFrame(()=>{this.updateItemHeight()}),this.containerHeight=this.el.querySelector(".virtual-list-container").clientHeight,this.updateVisibleRange())},this.onScroll=Sne(()=>{const e=this.el.querySelector(".virtual-list-container").scrollTop;e>this.lastScrollTop&&this.visibleEnd===this.items.length||(this.lastScrollTop=e,this.updateVisibleRange())})}itemsChanged(){this.recalculatePositioning()}componentDidLoad(){this.recalculatePositioning(),this.el.querySelector(".virtual-list-container").addEventListener("scroll",this.onScroll),window.addEventListener("resize",this.recalculatePositioning)}componentDidUpdate(){this.updateItemHeight()}disconnectedCallback(){this.el.querySelector(".virtual-list-container").removeEventListener("scroll",this.onScroll),window.removeEventListener("resize",this.recalculatePositioning)}updateVisibleRange(){const t=this.el.querySelector(".virtual-list-container").scrollTop,e=Math.floor(t/this.itemHeight),n=Math.ceil(this.containerHeight/this.itemHeight),r=Math.min(this.items.length,e+n+this.bufferedItemsCount);this.visibleStart=e,this.visibleEnd=r,this.el.querySelector(".virtual-list-container").scrollTop=this.lastScrollTop}updateItemHeight(){const t=this.el.querySelector(".virtual-list-item");if(t){const e=t.style.height;t.style.height="auto";const n=t.getBoundingClientRect().height;e&&(t.style.height=e),n&&Math.floor(n)!==Math.floor(this.itemHeight)&&(this.itemHeight=n)}}renderItems(){return this.items.slice(this.visibleStart,this.visibleEnd).map((e,n)=>{const r=this.visibleStart+n;return $("div",{class:"virtual-list-item",key:e.id,style:{position:"absolute",top:`${r*this.itemHeight}px`,height:`${this.itemHeight}px`,width:"100%"}},this.renderItem(e,r))})}render(){var t;const e=this.items.length*this.itemHeight;return $("div",{key:"279498eedaa6605456a2fffc004bd0204179ffde",class:"virtual-list-container",style:{position:"relative",height:"100%",overflowX:"hidden",overflowY:"auto"}},$("div",{key:"debb114c51c7c229b72cfcd7e87aa845ab6647e1",style:{height:`${e}px`,position:"relative"}},!((t=this.items)===null||t===void 0)&&t.length?this.renderItems():this.emptyListElement),$("div",{key:"7a97a5dd632fe6d4227674e46e091a1466c725bf",style:{height:`${this.itemHeight}px`}}))}get el(){return Pl(this)}static get watchers(){return{items:["itemsChanged"]}}};Bwt.style=jYn;var EYn=Object.freeze({__proto__:null,rtk_participant:bN,rtk_virtualized_participant_list:Bwt});const NYn=`.rtk-select{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.rtk-select:focus{--tw-ring-offset-shadow:var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow:var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow, 0 0 #0000)}.rtk-select{display:block;border-radius:var(--rtk-border-radius-sm, 4px);border-width:var(--rtk-border-width-none, 0);border-style:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;padding:var(--rtk-space-3, 12px);font-size:16px;--icon-size:var(--rtk-select-chevron-size, var(--rtk-space-6, 24px));--icon-right-position:var(--rtk-select-chevron-right-position, var(--rtk-space-2, 8px));background-image:url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");background-position:right var(--icon-right-position) center;background-repeat:no-repeat;background-size:var(--icon-size) var(--icon-size);padding-right:calc(var(--icon-right-position) * 5);width:100%;max-width:100%;text-overflow:ellipsis}.inline .rtk-select{margin-top:var(--rtk-space-1, 4px);width:100%;padding-top:var(--rtk-space-1, 4px);padding-bottom:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-1\\.5, 6px);padding-right:var(--rtk-space-8, 32px);font-size:14px}.row{margin-bottom:var(--rtk-space-2, 8px);display:flex;width:100%;align-items:center;justify-content:space-between;gap:var(--rtk-space-3, 12px)}.group{margin-top:var(--rtk-space-2, 8px);margin-bottom:var(--rtk-space-2, 8px)}.group>*{margin-bottom:var(--rtk-space-2, 8px)}.group>*:last-child{margin-bottom:var(--rtk-space-0, 0px)}.group select{flex:1 1 0%}.group{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0, 0px)}.group>*{margin-bottom:var(--rtk-space-0, 0px)}label{display:flex;-webkit-user-select:none;-moz-user-select:none;user-select:none;align-items:center;gap:var(--rtk-space-1, 4px);font-size:14px}.inline.container{display:flex;align-items:center;justify-content:flex-start;gap:var(--rtk-space-2, 8px);padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px)}`,TYn=NYn;var BTe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const MB=class{constructor(t){kt(this,t),this.iconPack=Nt,this.variant="full",this.t=It(),this.videoDevices=[],this.canProduceVideo=!0,this.stageStateListener=()=>{this.canProduceVideo=this.meeting.self.permissions.canProduceVideo==="ALLOWED"},this.deviceListUpdateListener=({devices:e})=>{this.videoDevices=e.filter(n=>n.kind==="videoinput")},this.deviceUpdateListener=({device:e})=>{e.kind==="videoinput"&&(this.currentDevice=e)},this.mediaPermissionUpdateListener=async({kind:e,message:n})=>{this.meeting&&e==="video"&&n==="ACCEPTED"&&(this.videoDevices=await this.meeting.self.getVideoDevices())}}meetingChanged(t){var e,n,r;t&&((e=t.self)===null||e===void 0||e.addListener("deviceListUpdate",this.deviceListUpdateListener),(n=t.self)===null||n===void 0||n.addListener("deviceUpdate",this.deviceUpdateListener),(r=t.self)===null||r===void 0||r.addListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener),Dc(async()=>{var s,i;const o=await t.self.getVideoDevices(),l=(s=t.self.getCurrentDevices())===null||s===void 0?void 0:s.video;l!=null?this.videoDevices=[(i=o.find(c=>c.deviceId===l.deviceId))!==null&&i!==void 0?i:l,...o.filter(c=>c.deviceId!==l.deviceId)]:this.videoDevices=o}))}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var t,e,n,r,s;(e=(t=this.meeting)===null||t===void 0?void 0:t.stage)===null||e===void 0||e.removeListener("stageStatusUpdate",this.stageStateListener),(n=this.meeting)===null||n===void 0||n.self.removeListener("deviceListUpdate",this.deviceListUpdateListener),(r=this.meeting)===null||r===void 0||r.self.removeListener("deviceUpdate",this.deviceUpdateListener),(s=this.meeting)===null||s===void 0||s.self.removeListener("mediaPermissionUpdate",this.mediaPermissionUpdateListener)}async setDevice(t){var e;const n=this.videoDevices.find(r=>r.deviceId===t);this.currentDevice=n,n!=null&&await((e=this.meeting)===null||e===void 0?void 0:e.self.setDevice(n))}render(){if(!this.meeting)return null;let t=0;return $(mt,null,this.canProduceVideo&&$("div",{class:"group container "+this.variant,part:"camera-selection"},$("label",null,this.variant!=="inline"&&this.t("camera"),$("rtk-icon",{icon:this.iconPack.video_on,size:"sm"})),$("div",{class:"row"},$("select",{class:"rtk-select",onChange:e=>this.setDevice(e.target.value)},this.videoDevices.map(({deviceId:e,label:n})=>{var r;return $("option",{selected:((r=this.currentDevice)===null||r===void 0?void 0:r.deviceId)===e,value:e},n||`Camera ${++t}`)})))))}static get watchers(){return{meeting:["meetingChanged"]}}};BTe([ge()],MB.prototype,"meeting",void 0);BTe([ge()],MB.prototype,"iconPack",void 0);BTe([ge()],MB.prototype,"t",void 0);MB.style=TYn;const _Yn=`:host {
  line-height: initial;
  font-family: var(--rtk-font-family, sans-serif);

  font-feature-settings: normal;
  font-variation-settings: normal;
}

p {
  margin: var(--rtk-space-0, 0px);
  padding: var(--rtk-space-0, 0px);
}


:host {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
  height: var(--rtk-space-56, 224px);
  overflow: hidden;
  border-radius: var(--rtk-border-radius-lg, 12px);
  -webkit-user-select: none;
     -moz-user-select: none;
          user-select: none;
  --tw-bg-opacity: 1;
  background-color: rgba(var(--rtk-colors-video-bg, 24 24 24) / var(--tw-bg-opacity));

  transition-property: var(--rtk-transition-property, all);
  transition-duration: 150ms;
  container-type: inline-size;
  container-name: participanttile;
}

@media (prefers-reduced-motion) {
  /* No transitions when disabled */
  :host {
    --rtk-transition-property: none;
  }
}

rtk-avatar {
  z-index: -1;
}

/**
  NOTE: provided :slotted(rtk-name-tag) & rtk-name-tag separately
  because ::slotted isn't applied on default slots.
*/

::slotted(rtk-name-tag), 
rtk-name-tag {
  position: absolute;
  left: var(--rtk-space-3, 12px);
  bottom: var(--rtk-space-3, 12px);
}

:host([size='sm'][variant='solid']) ::slotted(rtk-name-tag), 
  :host([size='sm'][variant='solid']) rtk-name-tag {
  left: var(--rtk-space-2, 8px);
  bottom: var(--rtk-space-2, 8px);
  height: var(--rtk-space-4, 16px);
}

::slotted(rtk-network-indicator), 
rtk-network-indicator {
  position: absolute;
  right: var(--rtk-space-3, 12px);
  bottom: var(--rtk-space-3, 12px);
}

:host([size='sm']) ::slotted(rtk-network-indicator), 
  :host([size='sm']) rtk-network-indicator {
  right: var(--rtk-space-2, 8px);
  bottom: var(--rtk-space-2, 8px);
}

video {
  position: absolute;
  height: 100%;
  width: 100%;
  border-radius: var(--rtk-border-radius-lg, 12px);
}

video.contain {
  -o-object-fit: contain;
     object-fit: contain;
}

video.cover {
  -o-object-fit: cover;
     object-fit: cover;
}

video::-webkit-media-controls {
  display: none !important;
}

.pinned-icon {
  position: absolute;
  left: var(--rtk-space-3, 12px);
  top: var(--rtk-space-3, 12px);
  height: var(--rtk-space-5, 20px);
  width: var(--rtk-space-5, 20px);
  padding: var(--rtk-space-1, 4px);
  border-radius: var(--rtk-border-radius-md, 8px);
  --tw-bg-opacity: 1;
  background-color: rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));
}

.network-container {
  position: absolute;
  right: var(--rtk-space-3, 12px);
  bottom: var(--rtk-space-3, 12px);
  display: flex;
  flex-direction: row;
  align-items: center;
  padding: var(--rtk-space-2, 8px);
  font-size: 12px;
  border-radius: var(--rtk-border-radius-md, 8px);
  --tw-bg-opacity: 1;
  background-color: rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));
}
.network-icon {
  height: var(--rtk-space-5, 20px);
  width: var(--rtk-space-5, 20px);
  --tw-text-opacity: 1;
  color: rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity));
}

:host([size='sm']) .pinned-icon {
  top: var(--rtk-space-2, 8px);
  left: var(--rtk-space-2, 8px);
}

:host([variant='gradient']) ::slotted(rtk-audio-visualizer), 
  :host([variant='gradient']) rtk-audio-visualizer {
  position: absolute;
  top: var(--rtk-space-2, 8px);
  right: var(--rtk-space-2, 8px);
  border-radius: 9999px;
  --tw-bg-opacity: 1;
  background-color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));
  padding: var(--rtk-space-2, 8px);
}

:host([variant='gradient']) ::slotted(rtk-name-tag), 
  :host([variant='gradient']) rtk-name-tag {
  bottom: var(--rtk-space-0, 0px);
  left: var(--rtk-space-0, 0px);
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  text-align: center;
  background-color: transparent;
  background-image: linear-gradient(to top, var(--tw-gradient-stops));
  --tw-gradient-from: rgb(var(--rtk-colors-background-1000, 8 8 8));
  --tw-gradient-to: rgba(var(--rtk-colors-background-1000, 8 8 8) / 0);
  --tw-gradient-stops: var(--tw-gradient-from), var(--tw-gradient-to);
  --tw-gradient-to: transparent;
}

video.mirror {
  transform: scaleX(-1);
}

/** Name tag positions */

:host([name-tag-position='bottom-right']) ::slotted(rtk-name-tag), 
  :host([name-tag-position='bottom-right']) rtk-name-tag {
  left: auto;
  right: var(--rtk-space-3, 12px);
}

:host([name-tag-position='bottom-center']) ::slotted(rtk-name-tag), 
  :host([name-tag-position='bottom-center']) rtk-name-tag {
  left: auto;
  right: auto;
}

:host([name-tag-position='top-left']) ::slotted(rtk-name-tag), 
  :host([name-tag-position='top-left']) rtk-name-tag {
  top: var(--rtk-space-3, 12px);
  bottom: auto;
}

:host([name-tag-position='top-right']) ::slotted(rtk-name-tag), 
  :host([name-tag-position='top-right']) rtk-name-tag {
  top: var(--rtk-space-3, 12px);
  right: var(--rtk-space-3, 12px);
  left: auto;
  bottom: auto;
}

:host([name-tag-position='top-center']) ::slotted(rtk-name-tag), 
  :host([name-tag-position='top-center']) rtk-name-tag {
  left: auto;
  right: auto;
  bottom: auto;
  top: var(--rtk-space-3, 12px);
}

@media only screen and (max-height: 480px) and (orientation: landscape) {
  :host([size='sm']) {
    border-radius: var(--rtk-border-radius-sm, 4px);
  }

  :host([size='sm']) > video {
    border-radius: var(--rtk-border-radius-sm, 4px);
  }

  ::slotted(rtk-avatar), 
  rtk-avatar {
    height: var(--rtk-space-12, 48px);
    width: var(--rtk-space-12, 48px);
  }
    :host([size='sm'][variant='solid']) ::slotted(rtk-name-tag),
    :host([size='sm'][variant='solid']) rtk-name-tag {
      transform-origin: -2% 100%;
      transform: scale(0.6);
      z-index: 10;
      left: var(--rtk-space-0, 0px);
      bottom: var(--rtk-space-0, 0px);
      border-radius: var(--rtk-border-radius-none, 0);
    }
}

@media only screen and (max-width: 480px) and (orientation: portrait) {
  :host([size='sm']) {
    border-radius: var(--rtk-border-radius-sm, 4px);
  }

  :host([size='sm']) > video {
    border-radius: var(--rtk-border-radius-sm, 4px);
  }

  ::slotted(rtk-avatar), 
  rtk-avatar {
    height: var(--rtk-space-12, 48px);
    width: var(--rtk-space-12, 48px);
  }
    :host([size='sm'][variant='solid']) ::slotted(rtk-name-tag),
    :host([size='sm'][variant='solid']) rtk-name-tag {
      transform-origin: -5% 110%;
      transform: scale(0.6);
      z-index: 10;
      left: var(--rtk-space-0, 0px);
      bottom: var(--rtk-space-0, 0px);
      border-radius: var(--rtk-border-radius-none, 0);
    }
}

@container participanttile (max-width: 300px) {
  ::slotted(rtk-name-tag),
  rtk-name-tag {
    transform-origin: 0 100%;
    transform: scale(0.8);
  }

  ::slotted(rtk-avatar), 
  rtk-avatar {
    height: var(--rtk-space-8, 32px) !important;
    width: var(--rtk-space-8, 32px) !important;
  }
}

@container participanttile (max-width: 150px) {
  ::slotted(rtk-name-tag),
  rtk-name-tag[variant='solid'] {
    transform-origin: -10% 130%;
    transform: scale(0.6);
    z-index: 10;
    border-radius: 9999px;
  }

  ::slotted(rtk-avatar), 
  rtk-avatar {
    height: 6 !important;
    width: 6 !important;
  }
}
`,AYn=_Yn;var LB=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const xN=class{onVideoRef(e){!this.participant||!this.meeting||e===this.videoEl||(this.videoEl=e,this.participant.registerVideoElement(this.videoEl,this.isPreview),this.tileLoad.emit({participant:this.participant,videoElement:this.videoEl}))}connectedCallback(){this.meeting?this.meetingChanged(this.meeting):this.participantsChanged(this.participant)}constructor(e){kt(this,e),this.tileLoad=Wt(this,"tileLoad",7),this.tileUnload=Wt(this,"tileUnload",7),this.isPinned=!1,this.mediaConnectionError=!1,this.nameTagPosition="bottom-left",this.isPreview=!1,this.config=Os(),this.variant="solid",this.iconPack=Nt,this.t=It(),this.onPinned=({isPinned:n})=>{this.isPinned=n},this.isSelf=()=>{var n;return this.isPreview||this.participant.id===((n=this.meeting)===null||n===void 0?void 0:n.self.id)},this.onPlaying=()=>{this.playTimeout&&clearTimeout(this.playTimeout)},this.mediaConnectionUpdateListener=this.mediaConnectionUpdateListener.bind(this)}disconnectedCallback(){this.playTimeout&&clearTimeout(this.playTimeout),this.participant!=null&&(this.participant.deregisterVideoElement(this.videoEl,this.isPreview),this.participant.removeListener("pinned",this.onPinned),this.participant.removeListener("unpinned",this.onPinned),this.meeting.meta.off("mediaConnectionUpdate",this.mediaConnectionUpdateListener),this.tileUnload.emit(this.participant))}meetingChanged(e){e&&this.participantsChanged(this.participant)}participantsChanged(e){if(e){if(!this.meeting){this.isPreview&&this.videoEl&&this.participant.registerVideoElement(this.videoEl,this.isPreview);return}this.isPinned=e.isPinned,this.videoEl&&this.participant.registerVideoElement(this.videoEl,this.isPreview),e.addListener("pinned",this.onPinned),e.addListener("unpinned",this.onPinned),this.meeting.meta.off("mediaConnectionUpdate",this.mediaConnectionUpdateListener),this.meeting.meta.on("mediaConnectionUpdate",this.mediaConnectionUpdateListener)}}mediaConnectionUpdateListener(){var e,n,r;const{recv:s,send:i}=(r=(n=(e=this.meeting)===null||e===void 0?void 0:e.meta)===null||n===void 0?void 0:n.mediaState)!==null&&r!==void 0?r:{};(s==null?void 0:s.state)!=="connected"&&!this.isSelf()?this.mediaConnectionError=!0:(i==null?void 0:i.state)!=="connected"&&this.isSelf()?this.mediaConnectionError=!0:this.mediaConnectionError=!1}isMirrored(){var e;if(this.participant!=null&&this.isSelf()){const n=this.states,r=(e=n==null?void 0:n.prefs)===null||e===void 0?void 0:e.mirrorVideo;if(typeof r=="boolean")return r}return!1}render(){var e,n,r;if(!this.meeting)return null;const s={meeting:this.meeting,size:this.size,states:this.states,config:this.config,iconPack:this.iconPack,t:this.t};return $(mt,null,$("video",{ref:i=>this.onVideoRef(i),class:{mirror:this.isMirrored(),[(r=(n=(e=this.config)===null||e===void 0?void 0:e.config)===null||n===void 0?void 0:n.videoFit)!==null&&r!==void 0?r:"cover"]:!0},onPlaying:this.onPlaying,autoPlay:!0,playsInline:!0,muted:!0,part:"video"}),this.isPinned&&$("rtk-icon",{class:"pinned-icon",icon:this.iconPack.pin,"aria-label":this.t("pinned"),part:"pinned-icon"}),this.mediaConnectionError&&$("div",{class:"network-container",part:"network-indicator"},$("rtk-icon",{class:"network-icon",icon:this.iconPack.disconnected,"aria-label":this.t("pinned"),part:"pinned-icon"})),$("slot",null,!this.isPreview&&$(tc,{element:"rtk-participant-tile",defaults:s,childProps:{participant:this.participant},deepProps:!0,onlyChildren:!0})))}static get watchers(){return{meeting:["meetingChanged"],participant:["participantsChanged"]}}};LB([ge()],xN.prototype,"meeting",void 0);LB([ge()],xN.prototype,"states",void 0);LB([ge()],xN.prototype,"config",void 0);LB([ge()],xN.prototype,"iconPack",void 0);LB([ge()],xN.prototype,"t",void 0);xN.style=AYn;var PYn=Object.freeze({__proto__:null,rtk_camera_selector:MB,rtk_participant_tile:xN});const RYn=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}.ctr{margin-bottom:var(--rtk-space-3, 12px);display:flex;width:100%;flex-direction:column;color:rgb(var(--rtk-colors-text-1000, 255 255 255))}.poll-title{margin-top:var(--rtk-space-3, 12px);margin-bottom:var(--rtk-space-3, 12px);margin-right:var(--rtk-space-4, 16px);font-size:12px}.poll{border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity));display:flex;flex-direction:column;padding:var(--rtk-space-4, 16px)}.poll-question{padding-left:var(--rtk-space-2, 8px);padding-right:var(--rtk-space-2, 8px);font-size:14px;overflow-wrap:break-word}.poll-answers{display:flex;flex-direction:row;justify-content:space-between;font-size:12px;margin-top:var(--rtk-space-4, 16px);margin-bottom:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-1, 4px);padding-right:var(--rtk-space-3, 12px)}.poll-option{display:flex;flex-direction:column;margin-top:var(--rtk-space-2, 8px);border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity));padding:var(--rtk-space-2, 8px);word-break:break-word}.poll-option.open-vote:hover{cursor:pointer}.poll-option label{display:flex;flex-direction:row;cursor:inherit}.poll-option-header{display:flex;flex-direction:row;justify-content:space-between;padding:var(--rtk-space-1, 4px)}.poll-option-header[data-disabled='true']:hover{cursor:default}.poll-option-header input{margin-top:var(--rtk-space-0, 0px);margin-bottom:var(--rtk-space-0, 0px);margin-left:var(--rtk-space-0\\.5, 2px);margin-right:var(--rtk-space-2, 8px);cursor:inherit}.poll-option-header .counter{color:rgb(var(--rtk-colors-text-1000, 255 255 255));font-size:12px}.votes{margin-top:var(--rtk-space-1, 4px);display:flex;flex-direction:row;flex-wrap:wrap}.vote{margin-right:var(--rtk-space-1, 4px);height:var(--rtk-space-8, 32px);width:var(--rtk-space-8, 32px);display:flex;align-items:center;justify-content:center;border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-video-bg, 24 24 24) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-1000, 255 255 255));border-radius:var(--rtk-border-radius-none, 0);clip-path:circle()}.active{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-on-brand-900, var(--rtk-colors-text-900, 255 255 255 / 0.88)))}.active .counter{color:rgb(var(--rtk-colors-text-on-brand-900, var(--rtk-colors-text-900, 255 255 255 / 0.88)))}`,IYn=RYn;var Uwt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const Lre=class{constructor(t){kt(this,t),this.onVote=Wt(this,"rtkVotePoll",7),this.iconPack=Nt,this.t=It(),this.MAX_VOTES_RENDER=10}vote(t,e){this.poll.voted.includes(this.self)?t.preventDefault():this.onVote.emit({id:this.poll.id,index:e})}render(){const t=this.poll.voted.includes(this.self);return $(mt,{key:"69e61c49e0f7f2015538447a8862bdb7fd3b4840"},$("div",{key:"00dec58cb19f30a4fc01926dd383edb270cd61c3",class:"ctr"},$("p",{key:"04d88ddf1f20e1a7e5b017f058b585723498f474",class:"poll-title"},this.t("polls.by")," ",pm(Rf(this.poll.createdBy),20)),$("div",{key:"5432167291df04bc4a4bfa23117df79c8512027d",class:"poll"},$("p",{key:"bee55a8193f96f582cf1c3006393740ab652dea7",class:"poll-question"},this.poll.question),$("div",{key:"aefe01131512e992e756196b5b451d4423bb9635",class:"poll-answers"},$("span",{key:"973f566c9d84a6519f7ab307fd072215fe76f72d"},this.t("polls.answers")),$("span",{key:"2a87b4bd72b99916cf20070c792742d04c1a44ca"},this.poll.voted.length)),this.poll.options.map((e,n)=>$("div",{class:{active:e.votes.some(r=>r.id===this.self),"open-vote":this.permissions.polls.canVote&&!t,"poll-option":!0}},$("div",{class:"poll-option-header","data-disabled":!this.permissions.polls.canVote},$("label",null,!t&&$("input",{disabled:!this.permissions.polls.canVote,readOnly:t,type:"radio",checked:e.votes.some(r=>r.id===this.self),onClick:r=>this.vote(r,n)}),$("p",null,e.text)),$("span",{class:"counter"},e.count)),$("div",{class:"votes"},e.votes.slice(0,this.MAX_VOTES_RENDER).map(r=>{if(!(this.poll.anonymous&&this.self!==this.poll.createdByUserId))return $("rtk-tooltip",{label:r.name},$("div",{class:"vote"},Dbt(r.name)))}),e.votes.length>this.MAX_VOTES_RENDER&&$("rtk-tooltip",{label:`+${e.votes.length-this.MAX_VOTES_RENDER} more `},$("div",{class:"vote"},"+",e.votes.length-this.MAX_VOTES_RENDER))))))))}};Uwt([ge()],Lre.prototype,"iconPack",void 0);Uwt([ge()],Lre.prototype,"t",void 0);Lre.style=IYn;const MYn=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}.scrollbar{scrollbar-width:thin;scrollbar-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))
    var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar{height:var(--rtk-space-1\\.5, 6px);width:var(--rtk-space-1\\.5, 6px);border-radius:9999px;background-color:var(--rtk-scrollbar-background, transparent)}.scrollbar::-webkit-scrollbar-thumb{border-radius:9999px;background-color:var(--rtk-scrollbar-color, rgb(var(--rtk-colors-background-600, 60 60 60)))}.create-poll{margin-top:var(--rtk-space-3, 12px);margin-bottom:var(--rtk-space-3, 12px);display:flex;flex:1 1 0%;flex-direction:column;padding:var(--rtk-space-3, 12px);border-radius:var(--rtk-border-radius-md, 8px);--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}.create-poll p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px);text-align:center}.create-poll textarea{display:flex;border-radius:var(--rtk-border-radius-sm, 4px);padding:var(--rtk-space-2, 8px);font-family:var(--rtk-font-family, sans-serif);border-width:var(--rtk-border-width-none, 0);border-style:none;font-weight:500;outline:2px solid transparent;outline-offset:2px;margin-top:var(--rtk-space-3, 12px);margin-bottom:var(--rtk-space-3, 12px);resize:vertical;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.create-poll textarea:focus{outline-style:solid;outline-offset:2px;outline-color:rgb(var(--rtk-colors-background-600, 60 60 60))}.option{display:flex;flex-direction:row;align-items:center;margin-bottom:var(--rtk-space-3, 12px);width:100%}.option input{width:100%;border-radius:var(--rtk-border-radius-sm, 4px);padding:var(--rtk-space-2, 8px);border-width:var(--rtk-border-width-none, 0);border-style:none;outline:2px solid transparent;outline-offset:2px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));color:rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64))}.remove-option{margin-left:var(--rtk-space-2, 8px);width:var(--rtk-space-10, 40px);border-radius:var(--rtk-border-radius-sm, 4px)}.add-option{margin-bottom:var(--rtk-space-3, 12px)}label{margin-bottom:var(--rtk-space-3, 12px)}.error-text{margin-top:var(--rtk-space-3, 12px);text-align:center;font-size:12px;--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}`,LYn=MYn;var zwt=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const Dre=class{constructor(t){kt(this,t),this.onCreate=Wt(this,"rtkCreatePoll",7),this.iconPack=Nt,this.t=It(),this.options=["",""],this.anonymous=!1,this.hideVotes=!0}removeOption(t){var e;this.options=this.options.filter((n,r)=>r!==t),((e=this.error)===null||e===void 0?void 0:e.code)===1&&(this.error=void 0)}addOption(){this.options=[...this.options,""]}updateOption(t,e){var n;this.options[e]=t.target.value,((n=this.error)===null||n===void 0?void 0:n.code)===1&&(this.error=void 0)}handleSubmit(){const t={question:this.question.value,options:this.options,anonymous:this.anonymous,hideVotes:this.anonymous?!0:this.hideVotes};if(!t.question){this.error={code:0,message:this.t("polls.errors.question_required")};return}if(this.options.filter(e=>e.trim()==="").length>0){this.error={code:1,message:this.t("polls.errors.empty_option")};return}this.onCreate.emit(t)}render(){return $(mt,{key:"ff160dd70e52bfa8a0c5116acea73a16cb84b9b8"},$("div",{key:"2f14946249e12cbc38db8cca86d370030286dc8e",class:"create-poll"},$("p",{key:"a6e3704c58e3526aa2e0f517f529c7ee48627f30"},this.t("polls.question")),$("textarea",{key:"6b076d162f80cc4e08ecc9379e829f37d43d06bb",onInput:()=>{this.error&&this.error.code===0&&(this.error=void 0)},ref:t=>this.question=t,placeholder:this.t("polls.question.placeholder")}),this.options.map((t,e)=>$("div",{class:"option"},$("input",{placeholder:this.t("polls.option.placeholder"),value:t,onInput:n=>this.updateOption(n,e)}),e>1&&$("rtk-button",{kind:"icon",class:"auto remove-option",variant:"secondary",onClick:()=>this.removeOption(e)},$("rtk-icon",{icon:this.iconPack.subtract})))),$("rtk-button",{key:"be4055b21c6c810d0721fe2daf3308011b2c6d8f",class:"add-option",variant:"secondary",onClick:()=>this.addOption()},this.t("polls.option")),$("label",{key:"0e22f9da27289adf831d5a9458237aa11758fd41"},$("input",{key:"577da1d275259a4e9ebffedf153f52e799172c42",id:"anonymous",type:"checkbox",onChange:t=>this.anonymous=t.target.checked}),this.t("polls.results.anon")),$("label",{key:"c06bcbfb6d15125c614764002985d20713e672a4"},$("input",{key:"9e9bb29126ed51c0bbd06481b44f690d737fbb64",id:"hideVotes",type:"checkbox",disabled:this.anonymous,checked:this.anonymous?!0:this.hideVotes,onChange:t=>this.hideVotes=t.target.checked}),this.t("polls.results.hide")),$("rtk-button",{key:"ab48323f46db1f6e485bea960f6d7ec6bb684075",kind:"wide",onClick:()=>this.handleSubmit()},this.t("polls.create")),this.error&&$("span",{key:"1d61b167ee24001d0b66acdb361262bf7f2ffcc6",class:"error-text"},this.error.message)))}};zwt([ge()],Dre.prototype,"iconPack",void 0);zwt([ge()],Dre.prototype,"t",void 0);Dre.style=LYn;var DYn=Object.freeze({__proto__:null,rtk_poll:Lre,rtk_poll_form:Dre});const $Yn=`:host {
  line-height: initial;
  font-family: var(--rtk-font-family, sans-serif);

  font-feature-settings: normal;
  font-variation-settings: normal;
}

p {
  margin: var(--rtk-space-0, 0px);
  padding: var(--rtk-space-0, 0px);
}


:host {
  position: relative;
  height: 100%;
  width: 100%;
  font-family: var(--rtk-font-family, sans-serif);
  z-index: 50;
  display: flex;
  flex-direction: column;

  container-type: size;
  container-name: sidebarui;
}

@container sidebarui (height < 370px) {
  .main-header {
    height: var(--rtk-space-8, 32px) !important;
  }
  .close {
    top: var(--rtk-space-0\\.5, 2px) !important;
    left: var(--rtk-space-0, 0px) !important;
    color: rgba(var(--rtk-colors-danger, 255 45 45) / 0.6);
  }
}

:host([view='sidebar']) {
  --tw-bg-opacity: 1;
  background-color: rgba(var(--rtk-colors-background-900, 26 26 26) / var(--tw-bg-opacity));
}

:host([view='full-screen']) {
  position: absolute;
  top: var(--rtk-space-0, 0px);
  right: var(--rtk-space-0, 0px);
  bottom: var(--rtk-space-0, 0px);
  left: var(--rtk-space-0, 0px);
  max-width: 100%;
  border: none;
}

::slotted(*) {
  flex-grow: 1;
}

.close {
  position: absolute;
  top: var(--rtk-space-2, 8px);
  left: var(--rtk-space-2, 8px);
  z-index: 10;
}

.main-header {
  position: relative;
  display: flex;
  height: var(--rtk-space-12, 48px);
  place-items: center;
  justify-content: center;
}

.main-header, 
.mobile-tabs {
  flex-shrink: 0;
}

.mobile-tabs {
  display: flex;
  place-items: center;
  justify-content: space-evenly;
  border-bottom: 1px solid rgb(var(--rtk-colors-background-700, 44 44 44));
}

.mobile-tabs button {
  margin: var(--rtk-space-0, 0px);
  border-width: var(--rtk-border-width-none, 0);
  border-style: none;
  background-color: transparent;
  padding: var(--rtk-space-0, 0px);
  color: rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52));
  height: var(--rtk-space-10, 40px);
  cursor: pointer;
  padding-left: var(--rtk-space-4, 16px);
  padding-right: var(--rtk-space-4, 16px);
  font-weight: 500;
  border-bottom: 1px solid transparent;
}

.mobile-tabs button.active {
  --tw-border-opacity: 1;
  border-color: rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-border-opacity));
  --tw-text-opacity: 1;
  color: rgba(var(--rtk-colors-brand-300, 73 124 253) / var(--tw-text-opacity));
}

header h3 {
  font-size: 14px;
  font-weight: 500;
}

@media only screen and (max-device-height: 480px) and (orientation: landscape) {
  .main-header {
    display: none !important;
  }
}

.tab-participant-count-badge {
  display: inline-block;
  padding: 2px 5px;
  border-radius: 9999px;
  --tw-bg-opacity: 1;
  background-color: rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-bg-opacity));
  font-size: 12px;
  color: rgb(var(--rtk-colors-text-700, 255 255 255 / 0.64));
}

.tab-participant-count-badge:not(.selected-tab) {
  --tw-bg-opacity: 1;
  background-color: rgba(var(--rtk-colors-background-600, 60 60 60) / var(--tw-bg-opacity));
}

.tab-participant-count-badge.requests-pending{
  background-color: rgba(var(--rtk-colors-danger));
}
`,OYn=$Yn;var FYn=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const UTe=class{constructor(t){kt(this,t),this.tabChange=Wt(this,"tabChange",7),this.sidebarClose=Wt(this,"sidebarClose",7),this.view="sidebar",this.tabs=[],this.hideHeader=!1,this.hideCloseAction=!1,this.iconPack=Nt,this.focusCloseButton=!0,this.t=It(),this.onClose=()=>{var e;this.sidebarClose.emit(),document.activeElement instanceof HTMLElement&&(!((e=document.activeElement.tagName)===null||e===void 0)&&e.includes("RTK-"))&&document.activeElement.blur instanceof Function&&document.activeElement.blur()}}componentDidLoad(){this.keydownListener=t=>{t.key==="Escape"&&this.onClose()},this.hostEl.addEventListener("keydown",this.keydownListener),this.handleFocusCloseButton()}handleFocusCloseButton(){this.currentTab!=="chat"&&!this.hideCloseAction&&this.closeButton.focus()}disconnectedCallback(){this.hostEl.removeEventListener("keydown",this.keydownListener)}render(){const t=this.view==="full-screen",e=this.tabs.find(n=>n.id===this.currentTab);return $(mt,{key:"239f279ceccceeaa57181d4a71f3e04ede4132ce",ref:n=>this.hostEl=n,class:this.view},!this.hideCloseAction&&$("rtk-button",{key:"921847fd946de305dce6f1fc7fe8a9ff175e38ee",ref:n=>this.closeButton=n,variant:"ghost",kind:"icon",class:"close",onClick:this.onClose,"aria-label":this.t("close")},$("rtk-icon",{key:"1de9f1edf8ecce2d0390b7b8a1253de02affd9d1",icon:this.iconPack.dismiss})),e&&!this.hideHeader&&$("header",{key:"4cd288feeb658e62d3ad1efd47aea237119918e1",class:"main-header"},$("h3",{key:"d6c4129537b4e090f3c429c66057be9a1072a864"},e.name),$("slot",{key:"dfb1ea30cfa476b515a3a4b628c036083f1fe0a5",name:"pinned-state"})),t&&$("header",{key:"7dafb426628960ba26718530417854a533de3664",class:"mobile-tabs"},this.tabs.map(n=>$("button",{onClick:()=>{this.tabChange.emit(n.id)},class:{active:this.currentTab===n.id}},n.name))),$("slot",{key:"2696ccd9fcad418ad7738164cd5a9e6305320899",name:this.currentTab}))}static get watchers(){return{currentTab:["handleFocusCloseButton"]}}};FYn([ge()],UTe.prototype,"t",void 0);UTe.style=OYn;var BYn=Object.freeze({__proto__:null,rtk_sidebar_ui:UTe});const UYn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{font-size:12px}#sync-button{flex-direction:row;border-radius:var(--rtk-border-radius-sm, 4px);padding-left:var(--rtk-space-1, 4px);display:flex;align-items:center;justify-content:center;margin-bottom:var(--rtk-space-1, 4px);font-size:12px;--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-700, 44 44 44) / var(--tw-bg-opacity))}:host([size='sm']) rtk-tooltip,:host([size='md']) rtk-tooltip{width:100%}:host([size='sm'])>#sync-button{height:var(--rtk-space-8, 32px);width:var(--rtk-space-16, 64px);padding-left:var(--rtk-space-0, 0px)}:host([size='md'])>#sync-button{height:var(--rtk-space-8, 32px);width:var(--rtk-space-16, 64px)}:host([size='lg'])>#sync-button{flex-direction:row;height:var(--rtk-space-8, 32px);width:var(--rtk-space-16, 64px)}@media (orientation: portrait){:host([size='lg']) #sync-button{flex-direction:column-reverse;height:var(--rtk-space-16, 64px);width:var(--rtk-space-16, 64px)}:host([size='md']) #sync-button{height:var(--rtk-space-16, 64px);width:var(--rtk-space-16, 64px)}:host([size='sm']) #sync-button{height:var(--rtk-space-10, 40px);width:var(--rtk-space-16, 64px);flex-direction:row}}#sync-button>rtk-icon{max-height:14px}#sync-button rtk-icon{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}:host([size='sm']) #sync-button>rtk-icon{width:auto}#sync-button.active rtk-icon{color:rgb(var(--rtk-colors-text-1000, 255 255 255))}div{align-content:center;line-height:2rem}rtk-icon{height:var(--rtk-space-6, 24px);width:var(--rtk-space-8, 32px)}#sync-button.active{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-success, 98 165 4) / var(--tw-bg-opacity))}",zYn=UYn;var zTe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const DB=class{constructor(t){kt(this,t),this.iconPack=Nt,this.t=It(),this.permissionsUpdateListener=()=>{this.canSpotlight=this.meeting.self.permissions.canSpotlight}}connectedCallback(){this.meetingChanged(this.meeting)}disconnectedCallback(){var t;(t=this.meeting)===null||t===void 0||t.self.permissions.removeListener("permissionsUpdate",this.permissionsUpdateListener)}meetingChanged(t){var e,n;t!=null&&(this.canSpotlight=t.self.permissions.canSpotlight,this.isSpotlighted=(n=(e=t.meta)===null||e===void 0?void 0:e.broadcastTabChanges)!==null&&n!==void 0?n:!1,t.self.permissions.addListener("permissionsUpdate",this.permissionsUpdateListener))}updateSpotlightState(t){var e;try{(e=this.meeting.meta)===null||e===void 0||e.setBroadcastTabChanges(t),this.isSpotlighted=t}catch(n){console.error(n)}}render(){if(this.canSpotlight)return $(mt,null,$("rtk-tooltip",{size:"md",label:this.t("remote_access.indicator")},$("div",{id:"sync-button",class:{tab:!0,active:this.isSpotlighted},onClick:()=>this.updateSpotlightState(!this.isSpotlighted)},$("span",{class:"name"},"Sync"),$("rtk-icon",{id:"icon",icon:this.isSpotlighted?this.iconPack.checkmark:this.iconPack.warning,tabIndex:-1,"aria-hidden":!0}))))}static get watchers(){return{meeting:["meetingChanged"]}}};zTe([ge()],DB.prototype,"meeting",void 0);zTe([ge()],DB.prototype,"iconPack",void 0);zTe([ge()],DB.prototype,"t",void 0);DB.style=zYn;var VYn=Object.freeze({__proto__:null,rtk_spotlight_indicator:DB});const HYn=":host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{display:flex;flex-direction:column;align-items:center;justify-content:center;color:rgb(var(--rtk-colors-text-1000, 255 255 255));height:100%;width:auto}svg,img{height:100%;width:auto}.brand-color{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}",GYn=HYn;var VTe=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const $B=class{constructor(t){kt(this,t),this.config=Os(),this.t=It()}connectedCallback(){this.configChanged(this.config),this.meetingChanged(this.meeting)}configChanged(t){var e;if(t!=null){const n=(e=t==null?void 0:t.designTokens)===null||e===void 0?void 0:e.logo;n!=null&&this.logoUrl==null&&(this.logoUrl=n)}}meetingChanged(t){var e,n,r,s;if(t!=null){const i=(s=(r=(n=(e=t.self)===null||e===void 0?void 0:e.config)===null||n===void 0?void 0:n.header)===null||r===void 0?void 0:r.elements)===null||s===void 0?void 0:s.logo;i!=null&&this.logoUrl==null&&(this.logoUrl=i)}}render(){if(!this.logoUrl||this.logoUrl==="")return null;const t=this.logoUrl,e=this.t("logo");return $(mt,{class:"loaded"},$("img",{src:t,alt:e}))}static get watchers(){return{config:["configChanged"],meeting:["meetingChanged"]}}};VTe([ge()],$B.prototype,"config",void 0);VTe([ge()],$B.prototype,"meeting",void 0);VTe([ge()],$B.prototype,"t",void 0);$B.style=GYn;var WYn=Object.freeze({__proto__:null,rtk_logo:$B});const qYn=`:host{line-height:initial;font-family:var(--rtk-font-family, sans-serif);font-feature-settings:normal;font-variation-settings:normal}p{margin:var(--rtk-space-0, 0px);padding:var(--rtk-space-0, 0px)}:host{--background-color:var(
    --rtk-controlbar-button-background-color,
    rgb(var(--rtk-colors-background-1000, 8 8 8))
  );--icon-size:var(--rtk-controlbar-button-icon-size, var(--rtk-space-7, 28px));position:relative;box-sizing:border-box;display:inline-flex;height:100%;width:auto;min-width:var(--rtk-space-20, 80px);-webkit-user-select:none;-moz-user-select:none;user-select:none;border-radius:var(--rtk-border-radius-md, 8px);transition-property:color, background-color, border-color, text-decoration-color, fill, stroke;transition-timing-function:cubic-bezier(0.4, 0, 0.2, 1);transition-duration:150ms;color:rgb(var(--rtk-colors-text-1000, 255 255 255));background-color:var(--background-color)}button{padding:var(--rtk-space-1, 4px)}:host(.red-icon) #icon{--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}:host([disabled]){color:rgb(var(--rtk-colors-text-600, 255 255 255 / 0.52))}button{box-sizing:border-box;display:inline-flex;height:100%;width:100%;flex:1 1 0%;flex-direction:column;gap:var(--rtk-space-1, 4px);padding-left:var(--rtk-space-1, 4px);padding-right:var(--rtk-space-1, 4px);align-items:center;justify-content:center;cursor:pointer;border-radius:var(--rtk-border-radius-md, 8px);border-width:var(--rtk-border-width-none, 0);border-style:none;background-color:transparent;color:inherit;outline-offset:-2px;border:var(--rtk-border-width-md, 2px) solid transparent}.label{text-align:center;font-size:12px;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:1}#warning-indicator{position:absolute;top:var(--rtk-space-1, 4px);right:var(--rtk-space-2, 8px);height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px);--tw-text-opacity:1;color:rgba(var(--rtk-colors-warning, 255 205 7) / var(--tw-text-opacity))}:host([size='sm']) #warning-indicator{right:var(--rtk-space-0, 0px);top:var(--rtk-space-0, 0px);height:var(--rtk-space-3, 12px);width:var(--rtk-space-3, 12px)}:host(:hover) button{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-800, 30 30 30) / var(--tw-bg-opacity))}#icon{width:var(--icon-size);height:var(--icon-size)}:host(.leave:hover) button{--tw-bg-opacity:1;background-color:rgba(var(--rtk-colors-background-1000, 8 8 8) / var(--tw-bg-opacity));--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity));border:var(--rtk-border-width-md, 2px) solid rgb(var(--rtk-colors-danger, 255 45 45))}:host(.active) button{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-400, 53 110 253) / var(--tw-text-opacity));border:var(--rtk-border-width-md, 2px) solid rgb(var(--rtk-colors-brand-400, 53 110 253))}button:focus-visible{outline:2px solid rgb(var(--rtk-colors-brand-400, 53 110 253))}:host(.active-livestream){--tw-text-opacity:1;color:rgba(var(--rtk-colors-danger, 255 45 45) / var(--tw-text-opacity))}:host([size='sm']){min-width:var(--rtk-space-14, 56px)}:host([size='sm']) .label{display:none}:host([variant='horizontal']){width:100%}:host([variant='horizontal']) button{border-radius:7px;height:var(--rtk-space-12, 48px);width:100%;padding-left:var(--rtk-space-5, 20px);padding-right:var(--rtk-space-5, 20px);padding-top:var(--rtk-space-3, 12px);padding-bottom:var(--rtk-space-3, 12px);flex-direction:row;justify-content:flex-start;gap:var(--rtk-space-3, 12px)}:host([variant='horizontal']) #icon{width:var(--rtk-space-6, 24px)}:host([variant='horizontal']) .label{display:block;font-size:14px;line-height:1.25rem}:host([variant='horizontal']) #warning-indicator{right:auto;left:var(--rtk-space-4, 16px)}:host([brand-icon]) rtk-icon#icon{--tw-text-opacity:1;color:rgba(var(--rtk-colors-brand-500, 33 96 253) / var(--tw-text-opacity))}@media only screen and (max-device-height: 480px) and (orientation: landscape){:host .label{display:none}:slotted(rtk-icon){height:var(--rtk-space-4, 16px);width:var(--rtk-space-4, 16px)}}`,KYn=qYn;var YYn=function(t,e,n,r){var s=arguments.length,i=s<3?e:r,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,n,r);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(s<3?o(i):s>3?o(e,n,i):o(e,n))||i);return s>3&&i&&Object.defineProperty(e,n,i),i};const HTe=class{constructor(t){kt(this,t),this.variant="button",this.showWarning=!1,this.disabled=!1,this.iconPack=Nt,this.brandIcon=!1}render(){return $(mt,{key:"90cbc7f04dd7975ef7331aace992aeadd1fdba52"},$("button",{key:"36ea971cf7d69742346dd6a65b41ef57def59a40","aria-label":this.label,part:"button"},this.isLoading?$("rtk-spinner",{id:"icon",part:"spinner",iconPack:this.iconPack}):$("rtk-icon",{id:"icon",icon:this.icon,tabIndex:-1,"aria-hidden":!0,part:"icon"}),$("span",{key:"83dda2888c01eec119c1cc21921a682cc2111307",class:"label",part:"label"},this.label),this.showWarning&&$("rtk-icon",{key:"abddcd4d3c81f7ba09cc4595c98cb55c76d678ad",id:"warning-indicator",icon:this.iconPack.warning,part:"warning-indicator"})))}static get delegatesFocus(){return!0}};YYn([ge()],HTe.prototype,"iconPack",void 0);HTe.style=KYn;var QYn=Object.freeze({__proto__:null,rtk_controlbar_button:HTe});(function(){if(typeof window<"u"&&window.Reflect!==void 0&&window.customElements!==void 0){var t=HTMLElement;window.HTMLElement=function(){return Reflect.construct(t,[],this.constructor)},HTMLElement.prototype=t.prototype,HTMLElement.prototype.constructor=HTMLElement,Object.setPrototypeOf(HTMLElement,t)}})();j3n();const xM=R7("rtk-avatar"),$re=R7("rtk-name-tag"),by=R7("rtk-participant-tile"),Vwt=R7("rtk-participants-audio"),Hwt=R7("rtk-screenshare-view");var ZYn=y.createContext(void 0);function ES(t){const e=y.useContext(ZYn);return t||e||"ltr"}var lde="rovingFocusGroup.onEntryFocus",JYn={bubbles:!1,cancelable:!0},OB="RovingFocusGroup",[Kbe,Gwt,XYn]=lI(OB),[eQn,wM]=il(OB,[XYn]),[tQn,nQn]=eQn(OB),Wwt=y.forwardRef((t,e)=>a.jsx(Kbe.Provider,{scope:t.__scopeRovingFocusGroup,children:a.jsx(Kbe.Slot,{scope:t.__scopeRovingFocusGroup,children:a.jsx(rQn,{...t,ref:e})})}));Wwt.displayName=OB;var rQn=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,orientation:r,loop:s=!1,dir:i,currentTabStopId:o,defaultCurrentTabStopId:l,onCurrentTabStopIdChange:c,onEntryFocus:d,preventScrollOnEntryFocus:u=!1,...h}=t,m=y.useRef(null),f=Sr(e,m),p=ES(i),[g,v]=Sd({prop:o,defaultProp:l??null,onChange:c,caller:OB}),[b,x]=y.useState(!1),w=Lo(d),k=Gwt(n),S=y.useRef(!1),[C,j]=y.useState(0);return y.useEffect(()=>{const E=m.current;if(E)return E.addEventListener(lde,w),()=>E.removeEventListener(lde,w)},[w]),a.jsx(tQn,{scope:n,orientation:r,dir:p,loop:s,currentTabStopId:g,onItemFocus:y.useCallback(E=>v(E),[v]),onItemShiftTab:y.useCallback(()=>x(!0),[]),onFocusableItemAdd:y.useCallback(()=>j(E=>E+1),[]),onFocusableItemRemove:y.useCallback(()=>j(E=>E-1),[]),children:a.jsx(Sn.div,{tabIndex:b||C===0?-1:0,"data-orientation":r,...h,ref:f,style:{outline:"none",...t.style},onMouseDown:Kt(t.onMouseDown,()=>{S.current=!0}),onFocus:Kt(t.onFocus,E=>{const N=!S.current;if(E.target===E.currentTarget&&N&&!b){const A=new CustomEvent(lde,JYn);if(E.currentTarget.dispatchEvent(A),!A.defaultPrevented){const _=k().filter(D=>D.focusable),T=_.find(D=>D.active),R=_.find(D=>D.id===g),F=[T,R,..._].filter(Boolean).map(D=>D.ref.current);Ywt(F,u)}}S.current=!1}),onBlur:Kt(t.onBlur,()=>x(!1))})})}),qwt="RovingFocusGroupItem",Kwt=y.forwardRef((t,e)=>{const{__scopeRovingFocusGroup:n,focusable:r=!0,active:s=!1,tabStopId:i,children:o,...l}=t,c=el(),d=i||c,u=nQn(qwt,n),h=u.currentTabStopId===d,m=Gwt(n),{onFocusableItemAdd:f,onFocusableItemRemove:p,currentTabStopId:g}=u;return y.useEffect(()=>{if(r)return f(),()=>p()},[r,f,p]),a.jsx(Kbe.ItemSlot,{scope:n,id:d,focusable:r,active:s,children:a.jsx(Sn.span,{tabIndex:h?0:-1,"data-orientation":u.orientation,...l,ref:e,onMouseDown:Kt(t.onMouseDown,v=>{r?u.onItemFocus(d):v.preventDefault()}),onFocus:Kt(t.onFocus,()=>u.onItemFocus(d)),onKeyDown:Kt(t.onKeyDown,v=>{if(v.key==="Tab"&&v.shiftKey){u.onItemShiftTab();return}if(v.target!==v.currentTarget)return;const b=aQn(v,u.orientation,u.dir);if(b!==void 0){if(v.metaKey||v.ctrlKey||v.altKey||v.shiftKey)return;v.preventDefault();let w=m().filter(k=>k.focusable).map(k=>k.ref.current);if(b==="last")w.reverse();else if(b==="prev"||b==="next"){b==="prev"&&w.reverse();const k=w.indexOf(v.currentTarget);w=u.loop?oQn(w,k+1):w.slice(k+1)}setTimeout(()=>Ywt(w))}}),children:typeof o=="function"?o({isCurrentTabStop:h,hasTabStop:g!=null}):o})})});Kwt.displayName=qwt;var sQn={ArrowLeft:"prev",ArrowUp:"prev",ArrowRight:"next",ArrowDown:"next",PageUp:"first",Home:"first",PageDown:"last",End:"last"};function iQn(t,e){return e!=="rtl"?t:t==="ArrowLeft"?"ArrowRight":t==="ArrowRight"?"ArrowLeft":t}function aQn(t,e,n){const r=iQn(t.key,n);if(!(e==="vertical"&&["ArrowLeft","ArrowRight"].includes(r))&&!(e==="horizontal"&&["ArrowUp","ArrowDown"].includes(r)))return sQn[r]}function Ywt(t,e=!1){const n=document.activeElement;for(const r of t)if(r===n||(r.focus({preventScroll:e}),document.activeElement!==n))return}function oQn(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var GTe=Wwt,WTe=Kwt,Ybe=["Enter"," "],lQn=["ArrowDown","PageUp","Home"],Qwt=["ArrowUp","PageDown","End"],cQn=[...lQn,...Qwt],dQn={ltr:[...Ybe,"ArrowRight"],rtl:[...Ybe,"ArrowLeft"]},uQn={ltr:["ArrowLeft"],rtl:["ArrowRight"]},FB="Menu",[I6,hQn,mQn]=lI(FB),[wN,Zwt]=il(FB,[mQn,sS,wM]),BB=sS(),Jwt=wM(),[Xwt,NS]=wN(FB),[fQn,UB]=wN(FB),e1t=t=>{const{__scopeMenu:e,open:n=!1,children:r,dir:s,onOpenChange:i,modal:o=!0}=t,l=BB(e),[c,d]=y.useState(null),u=y.useRef(!1),h=Lo(i),m=ES(s);return y.useEffect(()=>{const f=()=>{u.current=!0,document.addEventListener("pointerdown",p,{capture:!0,once:!0}),document.addEventListener("pointermove",p,{capture:!0,once:!0})},p=()=>u.current=!1;return document.addEventListener("keydown",f,{capture:!0}),()=>{document.removeEventListener("keydown",f,{capture:!0}),document.removeEventListener("pointerdown",p,{capture:!0}),document.removeEventListener("pointermove",p,{capture:!0})}},[]),a.jsx(V8,{...l,children:a.jsx(Xwt,{scope:e,open:n,onOpenChange:h,content:c,onContentChange:d,children:a.jsx(fQn,{scope:e,onClose:y.useCallback(()=>h(!1),[h]),isUsingKeyboardRef:u,dir:m,modal:o,children:r})})})};e1t.displayName=FB;var pQn="MenuAnchor",qTe=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=BB(n);return a.jsx(H8,{...s,...r,ref:e})});qTe.displayName=pQn;var KTe="MenuPortal",[gQn,t1t]=wN(KTe,{forceMount:void 0}),n1t=t=>{const{__scopeMenu:e,forceMount:n,children:r,container:s}=t,i=NS(KTe,e);return a.jsx(gQn,{scope:e,forceMount:n,children:a.jsx(Rl,{present:n||i.open,children:a.jsx(CE,{asChild:!0,container:s,children:r})})})};n1t.displayName=KTe;var If="MenuContent",[vQn,YTe]=wN(If),r1t=y.forwardRef((t,e)=>{const n=t1t(If,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=NS(If,t.__scopeMenu),o=UB(If,t.__scopeMenu);return a.jsx(I6.Provider,{scope:t.__scopeMenu,children:a.jsx(Rl,{present:r||i.open,children:a.jsx(I6.Slot,{scope:t.__scopeMenu,children:o.modal?a.jsx(yQn,{...s,ref:e}):a.jsx(bQn,{...s,ref:e})})})})}),yQn=y.forwardRef((t,e)=>{const n=NS(If,t.__scopeMenu),r=y.useRef(null),s=Sr(e,r);return y.useEffect(()=>{const i=r.current;if(i)return tte(i)},[]),a.jsx(QTe,{...t,ref:s,trapFocus:n.open,disableOutsidePointerEvents:n.open,disableOutsideScroll:!0,onFocusOutside:Kt(t.onFocusOutside,i=>i.preventDefault(),{checkForDefaultPrevented:!1}),onDismiss:()=>n.onOpenChange(!1)})}),bQn=y.forwardRef((t,e)=>{const n=NS(If,t.__scopeMenu);return a.jsx(QTe,{...t,ref:e,trapFocus:!1,disableOutsidePointerEvents:!1,disableOutsideScroll:!1,onDismiss:()=>n.onOpenChange(!1)})}),xQn=Ck("MenuContent.ScrollLock"),QTe=y.forwardRef((t,e)=>{const{__scopeMenu:n,loop:r=!1,trapFocus:s,onOpenAutoFocus:i,onCloseAutoFocus:o,disableOutsidePointerEvents:l,onEntryFocus:c,onEscapeKeyDown:d,onPointerDownOutside:u,onFocusOutside:h,onInteractOutside:m,onDismiss:f,disableOutsideScroll:p,...g}=t,v=NS(If,n),b=UB(If,n),x=BB(n),w=Jwt(n),k=hQn(n),[S,C]=y.useState(null),j=y.useRef(null),E=Sr(e,j,v.onContentChange),N=y.useRef(0),A=y.useRef(""),_=y.useRef(0),T=y.useRef(null),R=y.useRef("right"),O=y.useRef(0),F=p?r7:y.Fragment,D=p?{as:xQn,allowPinchZoom:!0}:void 0,I=M=>{var ne,te;const z=A.current+M,G=k().filter(re=>!re.disabled),B=document.activeElement,H=(ne=G.find(re=>re.ref.current===B))==null?void 0:ne.textValue,W=G.map(re=>re.textValue),V=RQn(W,z,H),U=(te=G.find(re=>re.textValue===V))==null?void 0:te.ref.current;(function re(fe){A.current=fe,window.clearTimeout(N.current),fe!==""&&(N.current=window.setTimeout(()=>re(""),1e3))})(z),U&&setTimeout(()=>U.focus())};y.useEffect(()=>()=>window.clearTimeout(N.current),[]),ete();const P=y.useCallback(M=>{var G,B;return R.current===((G=T.current)==null?void 0:G.side)&&MQn(M,(B=T.current)==null?void 0:B.area)},[]);return a.jsx(vQn,{scope:n,searchRef:A,onItemEnter:y.useCallback(M=>{P(M)&&M.preventDefault()},[P]),onItemLeave:y.useCallback(M=>{var z;P(M)||((z=j.current)==null||z.focus(),C(null))},[P]),onTriggerLeave:y.useCallback(M=>{P(M)&&M.preventDefault()},[P]),pointerGraceTimerRef:_,onPointerGraceIntentChange:y.useCallback(M=>{T.current=M},[]),children:a.jsx(F,{...D,children:a.jsx(n7,{asChild:!0,trapped:s,onMountAutoFocus:Kt(i,M=>{var z;M.preventDefault(),(z=j.current)==null||z.focus({preventScroll:!0})}),onUnmountAutoFocus:o,children:a.jsx(SE,{asChild:!0,disableOutsidePointerEvents:l,onEscapeKeyDown:d,onPointerDownOutside:u,onFocusOutside:h,onInteractOutside:m,onDismiss:f,children:a.jsx(GTe,{asChild:!0,...w,dir:b.dir,orientation:"vertical",loop:r,currentTabStopId:S,onCurrentTabStopIdChange:C,onEntryFocus:Kt(c,M=>{b.isUsingKeyboardRef.current||M.preventDefault()}),preventScrollOnEntryFocus:!0,children:a.jsx(bee,{role:"menu","aria-orientation":"vertical","data-state":x1t(v.open),"data-radix-menu-content":"",dir:b.dir,...x,...g,ref:E,style:{outline:"none",...g.style},onKeyDown:Kt(g.onKeyDown,M=>{const G=M.target.closest("[data-radix-menu-content]")===M.currentTarget,B=M.ctrlKey||M.altKey||M.metaKey,H=M.key.length===1;G&&(M.key==="Tab"&&M.preventDefault(),!B&&H&&I(M.key));const W=j.current;if(M.target!==W||!cQn.includes(M.key))return;M.preventDefault();const U=k().filter(ne=>!ne.disabled).map(ne=>ne.ref.current);Qwt.includes(M.key)&&U.reverse(),AQn(U)}),onBlur:Kt(t.onBlur,M=>{M.currentTarget.contains(M.target)||(window.clearTimeout(N.current),A.current="")}),onPointerMove:Kt(t.onPointerMove,M6(M=>{const z=M.target,G=O.current!==M.clientX;if(M.currentTarget.contains(z)&&G){const B=M.clientX>O.current?"right":"left";R.current=B,O.current=M.clientX}}))})})})})})})});r1t.displayName=If;var wQn="MenuGroup",ZTe=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Sn.div,{role:"group",...r,ref:e})});ZTe.displayName=wQn;var kQn="MenuLabel",s1t=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Sn.div,{...r,ref:e})});s1t.displayName=kQn;var XQ="MenuItem",U9e="menu.itemSelect",Ore=y.forwardRef((t,e)=>{const{disabled:n=!1,onSelect:r,...s}=t,i=y.useRef(null),o=UB(XQ,t.__scopeMenu),l=YTe(XQ,t.__scopeMenu),c=Sr(e,i),d=y.useRef(!1),u=()=>{const h=i.current;if(!n&&h){const m=new CustomEvent(U9e,{bubbles:!0,cancelable:!0});h.addEventListener(U9e,f=>r==null?void 0:r(f),{once:!0}),_Se(h,m),m.defaultPrevented?d.current=!1:o.onClose()}};return a.jsx(i1t,{...s,ref:c,disabled:n,onClick:Kt(t.onClick,u),onPointerDown:h=>{var m;(m=t.onPointerDown)==null||m.call(t,h),d.current=!0},onPointerUp:Kt(t.onPointerUp,h=>{var m;d.current||(m=h.currentTarget)==null||m.click()}),onKeyDown:Kt(t.onKeyDown,h=>{const m=l.searchRef.current!=="";n||m&&h.key===" "||Ybe.includes(h.key)&&(h.currentTarget.click(),h.preventDefault())})})});Ore.displayName=XQ;var i1t=y.forwardRef((t,e)=>{const{__scopeMenu:n,disabled:r=!1,textValue:s,...i}=t,o=YTe(XQ,n),l=Jwt(n),c=y.useRef(null),d=Sr(e,c),[u,h]=y.useState(!1),[m,f]=y.useState("");return y.useEffect(()=>{const p=c.current;p&&f((p.textContent??"").trim())},[i.children]),a.jsx(I6.ItemSlot,{scope:n,disabled:r,textValue:s??m,children:a.jsx(WTe,{asChild:!0,...l,focusable:!r,children:a.jsx(Sn.div,{role:"menuitem","data-highlighted":u?"":void 0,"aria-disabled":r||void 0,"data-disabled":r?"":void 0,...i,ref:d,onPointerMove:Kt(t.onPointerMove,M6(p=>{r?o.onItemLeave(p):(o.onItemEnter(p),p.defaultPrevented||p.currentTarget.focus({preventScroll:!0}))})),onPointerLeave:Kt(t.onPointerLeave,M6(p=>o.onItemLeave(p))),onFocus:Kt(t.onFocus,()=>h(!0)),onBlur:Kt(t.onBlur,()=>h(!1))})})})}),SQn="MenuCheckboxItem",a1t=y.forwardRef((t,e)=>{const{checked:n=!1,onCheckedChange:r,...s}=t;return a.jsx(u1t,{scope:t.__scopeMenu,checked:n,children:a.jsx(Ore,{role:"menuitemcheckbox","aria-checked":eZ(n)?"mixed":n,...s,ref:e,"data-state":e_e(n),onSelect:Kt(s.onSelect,()=>r==null?void 0:r(eZ(n)?!0:!n),{checkForDefaultPrevented:!1})})})});a1t.displayName=SQn;var o1t="MenuRadioGroup",[CQn,jQn]=wN(o1t,{value:void 0,onValueChange:()=>{}}),l1t=y.forwardRef((t,e)=>{const{value:n,onValueChange:r,...s}=t,i=Lo(r);return a.jsx(CQn,{scope:t.__scopeMenu,value:n,onValueChange:i,children:a.jsx(ZTe,{...s,ref:e})})});l1t.displayName=o1t;var c1t="MenuRadioItem",d1t=y.forwardRef((t,e)=>{const{value:n,...r}=t,s=jQn(c1t,t.__scopeMenu),i=n===s.value;return a.jsx(u1t,{scope:t.__scopeMenu,checked:i,children:a.jsx(Ore,{role:"menuitemradio","aria-checked":i,...r,ref:e,"data-state":e_e(i),onSelect:Kt(r.onSelect,()=>{var o;return(o=s.onValueChange)==null?void 0:o.call(s,n)},{checkForDefaultPrevented:!1})})})});d1t.displayName=c1t;var JTe="MenuItemIndicator",[u1t,EQn]=wN(JTe,{checked:!1}),h1t=y.forwardRef((t,e)=>{const{__scopeMenu:n,forceMount:r,...s}=t,i=EQn(JTe,n);return a.jsx(Rl,{present:r||eZ(i.checked)||i.checked===!0,children:a.jsx(Sn.span,{...s,ref:e,"data-state":e_e(i.checked)})})});h1t.displayName=JTe;var NQn="MenuSeparator",m1t=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t;return a.jsx(Sn.div,{role:"separator","aria-orientation":"horizontal",...r,ref:e})});m1t.displayName=NQn;var TQn="MenuArrow",f1t=y.forwardRef((t,e)=>{const{__scopeMenu:n,...r}=t,s=BB(n);return a.jsx(xee,{...s,...r,ref:e})});f1t.displayName=TQn;var XTe="MenuSub",[_Qn,p1t]=wN(XTe),g1t=t=>{const{__scopeMenu:e,children:n,open:r=!1,onOpenChange:s}=t,i=NS(XTe,e),o=BB(e),[l,c]=y.useState(null),[d,u]=y.useState(null),h=Lo(s);return y.useEffect(()=>(i.open===!1&&h(!1),()=>h(!1)),[i.open,h]),a.jsx(V8,{...o,children:a.jsx(Xwt,{scope:e,open:r,onOpenChange:h,content:d,onContentChange:u,children:a.jsx(_Qn,{scope:e,contentId:el(),triggerId:el(),trigger:l,onTriggerChange:c,children:n})})})};g1t.displayName=XTe;var Q4="MenuSubTrigger",v1t=y.forwardRef((t,e)=>{const n=NS(Q4,t.__scopeMenu),r=UB(Q4,t.__scopeMenu),s=p1t(Q4,t.__scopeMenu),i=YTe(Q4,t.__scopeMenu),o=y.useRef(null),{pointerGraceTimerRef:l,onPointerGraceIntentChange:c}=i,d={__scopeMenu:t.__scopeMenu},u=y.useCallback(()=>{o.current&&window.clearTimeout(o.current),o.current=null},[]);return y.useEffect(()=>u,[u]),y.useEffect(()=>{const h=l.current;return()=>{window.clearTimeout(h),c(null)}},[l,c]),a.jsx(qTe,{asChild:!0,...d,children:a.jsx(i1t,{id:s.triggerId,"aria-haspopup":"menu","aria-expanded":n.open,"aria-controls":s.contentId,"data-state":x1t(n.open),...t,ref:Gx(e,s.onTriggerChange),onClick:h=>{var m;(m=t.onClick)==null||m.call(t,h),!(t.disabled||h.defaultPrevented)&&(h.currentTarget.focus(),n.open||n.onOpenChange(!0))},onPointerMove:Kt(t.onPointerMove,M6(h=>{i.onItemEnter(h),!h.defaultPrevented&&!t.disabled&&!n.open&&!o.current&&(i.onPointerGraceIntentChange(null),o.current=window.setTimeout(()=>{n.onOpenChange(!0),u()},100))})),onPointerLeave:Kt(t.onPointerLeave,M6(h=>{var f,p;u();const m=(f=n.content)==null?void 0:f.getBoundingClientRect();if(m){const g=(p=n.content)==null?void 0:p.dataset.side,v=g==="right",b=v?-5:5,x=m[v?"left":"right"],w=m[v?"right":"left"];i.onPointerGraceIntentChange({area:[{x:h.clientX+b,y:h.clientY},{x,y:m.top},{x:w,y:m.top},{x:w,y:m.bottom},{x,y:m.bottom}],side:g}),window.clearTimeout(l.current),l.current=window.setTimeout(()=>i.onPointerGraceIntentChange(null),300)}else{if(i.onTriggerLeave(h),h.defaultPrevented)return;i.onPointerGraceIntentChange(null)}})),onKeyDown:Kt(t.onKeyDown,h=>{var f;const m=i.searchRef.current!=="";t.disabled||m&&h.key===" "||dQn[r.dir].includes(h.key)&&(n.onOpenChange(!0),(f=n.content)==null||f.focus(),h.preventDefault())})})})});v1t.displayName=Q4;var y1t="MenuSubContent",b1t=y.forwardRef((t,e)=>{const n=t1t(If,t.__scopeMenu),{forceMount:r=n.forceMount,...s}=t,i=NS(If,t.__scopeMenu),o=UB(If,t.__scopeMenu),l=p1t(y1t,t.__scopeMenu),c=y.useRef(null),d=Sr(e,c);return a.jsx(I6.Provider,{scope:t.__scopeMenu,children:a.jsx(Rl,{present:r||i.open,children:a.jsx(I6.Slot,{scope:t.__scopeMenu,children:a.jsx(QTe,{id:l.contentId,"aria-labelledby":l.triggerId,...s,ref:d,align:"start",side:o.dir==="rtl"?"left":"right",disableOutsidePointerEvents:!1,disableOutsideScroll:!1,trapFocus:!1,onOpenAutoFocus:u=>{var h;o.isUsingKeyboardRef.current&&((h=c.current)==null||h.focus()),u.preventDefault()},onCloseAutoFocus:u=>u.preventDefault(),onFocusOutside:Kt(t.onFocusOutside,u=>{u.target!==l.trigger&&i.onOpenChange(!1)}),onEscapeKeyDown:Kt(t.onEscapeKeyDown,u=>{o.onClose(),u.preventDefault()}),onKeyDown:Kt(t.onKeyDown,u=>{var f;const h=u.currentTarget.contains(u.target),m=uQn[o.dir].includes(u.key);h&&m&&(i.onOpenChange(!1),(f=l.trigger)==null||f.focus(),u.preventDefault())})})})})})});b1t.displayName=y1t;function x1t(t){return t?"open":"closed"}function eZ(t){return t==="indeterminate"}function e_e(t){return eZ(t)?"indeterminate":t?"checked":"unchecked"}function AQn(t){const e=document.activeElement;for(const n of t)if(n===e||(n.focus(),document.activeElement!==e))return}function PQn(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function RQn(t,e,n){const s=e.length>1&&Array.from(e).every(d=>d===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let o=PQn(t,Math.max(i,0));s.length===1&&(o=o.filter(d=>d!==n));const c=o.find(d=>d.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function IQn(t,e){const{x:n,y:r}=t;let s=!1;for(let i=0,o=e.length-1;i<e.length;o=i++){const l=e[i],c=e[o],d=l.x,u=l.y,h=c.x,m=c.y;u>r!=m>r&&n<(h-d)*(r-u)/(m-u)+d&&(s=!s)}return s}function MQn(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return IQn(n,e)}function M6(t){return e=>e.pointerType==="mouse"?t(e):void 0}var LQn=e1t,DQn=qTe,$Qn=n1t,OQn=r1t,FQn=ZTe,BQn=s1t,UQn=Ore,zQn=a1t,VQn=l1t,HQn=d1t,GQn=h1t,WQn=m1t,qQn=f1t,KQn=g1t,YQn=v1t,QQn=b1t,Fre="DropdownMenu",[ZQn,ljs]=il(Fre,[Zwt]),nu=Zwt(),[JQn,w1t]=ZQn(Fre),k1t=t=>{const{__scopeDropdownMenu:e,children:n,dir:r,open:s,defaultOpen:i,onOpenChange:o,modal:l=!0}=t,c=nu(e),d=y.useRef(null),[u,h]=Sd({prop:s,defaultProp:i??!1,onChange:o,caller:Fre});return a.jsx(JQn,{scope:e,triggerId:el(),triggerRef:d,contentId:el(),open:u,onOpenChange:h,onOpenToggle:y.useCallback(()=>h(m=>!m),[h]),modal:l,children:a.jsx(LQn,{...c,open:u,onOpenChange:h,dir:r,modal:l,children:n})})};k1t.displayName=Fre;var S1t="DropdownMenuTrigger",C1t=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,disabled:r=!1,...s}=t,i=w1t(S1t,n),o=nu(n);return a.jsx(DQn,{asChild:!0,...o,children:a.jsx(Sn.button,{type:"button",id:i.triggerId,"aria-haspopup":"menu","aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":i.open?"open":"closed","data-disabled":r?"":void 0,disabled:r,...s,ref:Gx(e,i.triggerRef),onPointerDown:Kt(t.onPointerDown,l=>{!r&&l.button===0&&l.ctrlKey===!1&&(i.onOpenToggle(),i.open||l.preventDefault())}),onKeyDown:Kt(t.onKeyDown,l=>{r||(["Enter"," "].includes(l.key)&&i.onOpenToggle(),l.key==="ArrowDown"&&i.onOpenChange(!0),["Enter"," ","ArrowDown"].includes(l.key)&&l.preventDefault())})})})});C1t.displayName=S1t;var XQn="DropdownMenuPortal",j1t=t=>{const{__scopeDropdownMenu:e,...n}=t,r=nu(e);return a.jsx($Qn,{...r,...n})};j1t.displayName=XQn;var E1t="DropdownMenuContent",N1t=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=w1t(E1t,n),i=nu(n),o=y.useRef(!1);return a.jsx(OQn,{id:s.contentId,"aria-labelledby":s.triggerId,...i,...r,ref:e,onCloseAutoFocus:Kt(t.onCloseAutoFocus,l=>{var c;o.current||(c=s.triggerRef.current)==null||c.focus(),o.current=!1,l.preventDefault()}),onInteractOutside:Kt(t.onInteractOutside,l=>{const c=l.detail.originalEvent,d=c.button===0&&c.ctrlKey===!0,u=c.button===2||d;(!s.modal||u)&&(o.current=!0)}),style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});N1t.displayName=E1t;var eZn="DropdownMenuGroup",tZn=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=nu(n);return a.jsx(FQn,{...s,...r,ref:e})});tZn.displayName=eZn;var nZn="DropdownMenuLabel",T1t=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=nu(n);return a.jsx(BQn,{...s,...r,ref:e})});T1t.displayName=nZn;var rZn="DropdownMenuItem",_1t=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=nu(n);return a.jsx(UQn,{...s,...r,ref:e})});_1t.displayName=rZn;var sZn="DropdownMenuCheckboxItem",A1t=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=nu(n);return a.jsx(zQn,{...s,...r,ref:e})});A1t.displayName=sZn;var iZn="DropdownMenuRadioGroup",P1t=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=nu(n);return a.jsx(VQn,{...s,...r,ref:e})});P1t.displayName=iZn;var aZn="DropdownMenuRadioItem",R1t=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=nu(n);return a.jsx(HQn,{...s,...r,ref:e})});R1t.displayName=aZn;var oZn="DropdownMenuItemIndicator",I1t=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=nu(n);return a.jsx(GQn,{...s,...r,ref:e})});I1t.displayName=oZn;var lZn="DropdownMenuSeparator",M1t=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=nu(n);return a.jsx(WQn,{...s,...r,ref:e})});M1t.displayName=lZn;var cZn="DropdownMenuArrow",dZn=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=nu(n);return a.jsx(qQn,{...s,...r,ref:e})});dZn.displayName=cZn;var uZn=t=>{const{__scopeDropdownMenu:e,children:n,open:r,onOpenChange:s,defaultOpen:i}=t,o=nu(e),[l,c]=Sd({prop:r,defaultProp:i??!1,onChange:s,caller:"DropdownMenuSub"});return a.jsx(KQn,{...o,open:l,onOpenChange:c,children:n})},hZn="DropdownMenuSubTrigger",L1t=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=nu(n);return a.jsx(YQn,{...s,...r,ref:e})});L1t.displayName=hZn;var mZn="DropdownMenuSubContent",D1t=y.forwardRef((t,e)=>{const{__scopeDropdownMenu:n,...r}=t,s=nu(n);return a.jsx(QQn,{...s,...r,ref:e,style:{...t.style,"--radix-dropdown-menu-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-dropdown-menu-content-available-width":"var(--radix-popper-available-width)","--radix-dropdown-menu-content-available-height":"var(--radix-popper-available-height)","--radix-dropdown-menu-trigger-width":"var(--radix-popper-anchor-width)","--radix-dropdown-menu-trigger-height":"var(--radix-popper-anchor-height)"}})});D1t.displayName=mZn;var fZn=k1t,pZn=C1t,gZn=j1t,$1t=N1t,O1t=T1t,F1t=_1t,B1t=A1t,vZn=P1t,U1t=R1t,z1t=I1t,V1t=M1t,yZn=uZn,H1t=L1t,G1t=D1t;const Tr=fZn,_r=pZn,bZn=yZn,xZn=vZn,W1t=y.forwardRef(({className:t,inset:e,children:n,...r},s)=>a.jsxs(H1t,{ref:s,className:ee("flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[state=open]:bg-accent focus:bg-accent",e&&"pl-8",t),...r,children:[n,a.jsx(io,{className:"ml-auto h-4 w-4"})]}));W1t.displayName=H1t.displayName;const q1t=y.forwardRef(({className:t,...e},n)=>a.jsx(G1t,{ref:n,className:ee("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...e}));q1t.displayName=G1t.displayName;const Cr=y.forwardRef(({className:t,sideOffset:e=4,...n},r)=>a.jsx(gZn,{children:a.jsx($1t,{ref:r,sideOffset:e,className:ee("z-50 min-w-[8rem] overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",t),...n})}));Cr.displayName=$1t.displayName;const ot=y.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(F1t,{ref:r,className:ee("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",e&&"pl-8",t),...n}));ot.displayName=F1t.displayName;const wZn=y.forwardRef(({className:t,children:e,checked:n,...r},s)=>a.jsxs(B1t,{ref:s,className:ee("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),checked:n,...r,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(z1t,{children:a.jsx(Qn,{className:"h-4 w-4"})})}),e]}));wZn.displayName=B1t.displayName;const K1t=y.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(U1t,{ref:r,className:ee("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(z1t,{children:a.jsx(Ag,{className:"h-2 w-2 fill-current"})})}),e]}));K1t.displayName=U1t.displayName;const FR=y.forwardRef(({className:t,inset:e,...n},r)=>a.jsx(O1t,{ref:r,className:ee("px-2 py-1.5 text-sm font-semibold",e&&"pl-8",t),...n}));FR.displayName=O1t.displayName;const mi=y.forwardRef(({className:t,...e},n)=>a.jsx(V1t,{ref:n,className:ee("-mx-1 my-1 h-px bg-muted",t),...e}));mi.displayName=V1t.displayName;async function kZn(t,e){const n=e?`?userName=${encodeURIComponent(e)}`:"";return(await ae.get(`/dyte/join-meeting/${encodeURIComponent(t)}/json${n}`)).payload}async function SZn(t,e){await ae.post(`/dyte/meeting/${encodeURIComponent(t)}/toggle-recording/${encodeURIComponent(e)}`,{})}async function CZn(t,e){await ae.get(`/dyte/meeting/${encodeURIComponent(t)}/end/${encodeURIComponent(e)}`)}async function t_e(t,e=1,n="new"){const r=await ae.get(`/meeting/${encodeURIComponent(t)}/questions?page=${e}&sort=${n}`);return{questions:Array.isArray(r.questions)?r.questions:[],page:r.page??e,limit:r.limit??50,total:r.total??0,closed:!!r.closed,spotlight:r.spotlight??null}}const Y1t=(t,e)=>`/meeting/${encodeURIComponent(t)}/questions/${encodeURIComponent(e)}`;async function jZn(t,e,n){return(await ae.patch(Y1t(t,e),{question:n})).question}async function EZn(t,e){await ae.delete(Y1t(t,e))}async function NZn(t,e){return(await ae.post(`/meeting/${encodeURIComponent(t)}/questions/spotlight`,{questionId:e})).spotlight}async function TZn(t,e){return(await ae.post(`/meeting/${encodeURIComponent(t)}/questions/state`,{closed:e})).closed}async function _Zn(t,e,n){return(await ae.post(`/meeting/${encodeURIComponent(t)}/questions`,{question:e,userName:n})).question}async function AZn(t,e){return(await ae.patch(`/meeting/${encodeURIComponent(t)}/questions/${encodeURIComponent(e)}/answer`)).question}async function PZn(t,e=!1){await ae.post(`/meeting/${encodeURIComponent(t)}/attendance/heartbeat`,{},e?{skipAuth:!0}:void 0)}async function Q1t(t,e){return(await ae.post(`/meeting/${encodeURIComponent(t)}/questions/${encodeURIComponent(e)}/vote`,{})).question}const Qbe=t=>["meeting-polls",t],zB=t=>`/meeting/${encodeURIComponent(t)}/polls`;async function RZn(t){const e=await ae.get(zB(t));return{polls:Array.isArray(e.polls)?e.polls:[],canModerate:!!e.canModerate}}async function IZn(t,e){return(await ae.post(zB(t),e)).poll}async function MZn(t,e,n){return(await ae.post(`${zB(t)}/${encodeURIComponent(e)}/vote`,{optionIndex:n})).poll}async function LZn(t,e){return(await ae.post(`${zB(t)}/${encodeURIComponent(e)}/reveal`,{})).poll}async function DZn(t,e){await ae.delete(`${zB(t)}/${encodeURIComponent(e)}`)}async function $Zn(t,e){const r=await ae.get(`/meeting/${encodeURIComponent(t)}/chat`);return{messages:Array.isArray(r.messages)?r.messages:[],limit:r.limit??50,hasMore:!!r.hasMore,chatDisabled:!!r.chatDisabled}}async function OZn(t,e,n){return(await ae.post(`/meeting/${encodeURIComponent(t)}/removed`,{participantId:e,name:n})).removed}async function FZn(t){const e=await ae.get(`/meeting/${encodeURIComponent(t)}/removed`);return Array.isArray(e==null?void 0:e.removed)?e.removed:[]}async function BZn(t,e){await ae.delete(`/meeting/${encodeURIComponent(t)}/removed/${encodeURIComponent(e)}`)}const Z1t=t=>({chatDisabled:!!(t!=null&&t.chatDisabled),dmMode:(t==null?void 0:t.dmMode)==="host"||(t==null?void 0:t.dmMode)==="off"?t.dmMode:"everyone",hostParticipantIds:Array.isArray(t==null?void 0:t.hostParticipantIds)?t.hostParticipantIds.map(String):[]});async function UZn(t){return Z1t(await ae.get(`/meeting/${encodeURIComponent(t)}/chat/state`))}async function z9e(t,e){return Z1t(await ae.post(`/meeting/${encodeURIComponent(t)}/chat/state`,e))}async function zZn(t,e){return(await ae.post(`/meeting/${encodeURIComponent(t)}/chat`,{text:e})).message}const VZn=["like","love","clap","laugh","wow","fire"],cde={like:"👍",love:"❤️",clap:"👏",laugh:"😂",wow:"😮",fire:"🔥"};async function HZn(t,e){await ae.post(`/meeting/${encodeURIComponent(t)}/reactions`,{type:e})}function GZn(t,e,n){const r=y.useRef({chatVisible:e,docsVisible:n});r.current={chatVisible:e,docsVisible:n};const[s,i]=y.useState(!1),[o,l]=y.useState(!1);return y.useEffect(()=>{const c=new Set,d=({action:u,message:h})=>{u!=="add"||c.has(h.id)||(c.add(h.id),h.type==="text"&&!r.current.chatVisible&&i(!0),(h.type==="file"||h.type==="image")&&!r.current.docsVisible&&l(!0))};return t.on("chatUpdate",d),()=>{t.off("chatUpdate",d)}},[t]),y.useEffect(()=>{e&&i(!1),n&&l(!1)},[e,n]),{chatUnread:s,docsUnread:o}}const WZn={chatDisabled:!1,dmMode:"everyone",hostParticipantIds:[]},oV=t=>["meeting-chat-state",t],dde="chat:state",qZn=t=>({chat:{public:{canSend:t,text:t,files:t}}});function KZn(t,e,n){const r=rn(),{data:s=WZn}=lt({queryKey:oV(e),queryFn:()=>UZn(e),refetchInterval:3e4}),{chatDisabled:i,dmMode:o,hostParticipantIds:l}=s;y.useEffect(()=>{const m=({type:f})=>{f===dde&&r.invalidateQueries({queryKey:oV(e)})};return t.participants.on("broadcastedMessage",m),()=>{t.participants.off("broadcastedMessage",m)}},[t,e,r]);const c=y.useCallback(async(m,f)=>{const p=m.filter(g=>g&&g!==t.self.id);if(p.length!==0)try{await t.participants.updatePermissions(p,qZn(f))}catch{}},[t]),d=y.useRef(i);d.current=i,y.useEffect(()=>{if(!n)return;i&&c(t.participants.joined.toArray().map(f=>f.id),!1);const m=f=>{d.current&&c([f.id],!1)};return t.participants.joined.on("participantJoined",m),()=>{t.participants.joined.off("participantJoined",m)}},[c,n,i,t]);const u=y.useCallback(async m=>{const f=await z9e(e,{disabled:m});return r.setQueryData(oV(e),f),t.participants.broadcastMessage(dde,{at:Date.now()}),await c(t.participants.joined.toArray().map(p=>p.id),!f.chatDisabled),f.chatDisabled},[c,t,e,r]),h=y.useCallback(async m=>{const f=await z9e(e,{dmMode:m});return r.setQueryData(oV(e),f),t.participants.broadcastMessage(dde,{at:Date.now()}),f.dmMode},[t,e,r]);return{chatDisabled:i,setChatDisabled:u,dmMode:o,setDmMode:h,hostParticipantIds:l}}const xn=Number.isFinite||function(t){return typeof t=="number"&&isFinite(t)},YZn=Number.isSafeInteger||function(t){return typeof t=="number"&&Math.abs(t)<=QZn},QZn=Number.MAX_SAFE_INTEGER||9007199254740991;let er=function(t){return t.NETWORK_ERROR="networkError",t.MEDIA_ERROR="mediaError",t.KEY_SYSTEM_ERROR="keySystemError",t.MUX_ERROR="muxError",t.OTHER_ERROR="otherError",t}({}),rt=function(t){return t.KEY_SYSTEM_NO_KEYS="keySystemNoKeys",t.KEY_SYSTEM_NO_ACCESS="keySystemNoAccess",t.KEY_SYSTEM_NO_SESSION="keySystemNoSession",t.KEY_SYSTEM_NO_CONFIGURED_LICENSE="keySystemNoConfiguredLicense",t.KEY_SYSTEM_LICENSE_REQUEST_FAILED="keySystemLicenseRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED="keySystemServerCertificateRequestFailed",t.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED="keySystemServerCertificateUpdateFailed",t.KEY_SYSTEM_SESSION_UPDATE_FAILED="keySystemSessionUpdateFailed",t.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED="keySystemStatusOutputRestricted",t.KEY_SYSTEM_STATUS_INTERNAL_ERROR="keySystemStatusInternalError",t.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR="keySystemDestroyMediaKeysError",t.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR="keySystemDestroyCloseSessionError",t.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR="keySystemDestroyRemoveSessionError",t.MANIFEST_LOAD_ERROR="manifestLoadError",t.MANIFEST_LOAD_TIMEOUT="manifestLoadTimeOut",t.MANIFEST_PARSING_ERROR="manifestParsingError",t.MANIFEST_INCOMPATIBLE_CODECS_ERROR="manifestIncompatibleCodecsError",t.LEVEL_EMPTY_ERROR="levelEmptyError",t.PLAYLIST_UNCHANGED_ERROR="playlistUnchangedError",t.LEVEL_LOAD_ERROR="levelLoadError",t.LEVEL_LOAD_TIMEOUT="levelLoadTimeOut",t.LEVEL_PARSING_ERROR="levelParsingError",t.LEVEL_SWITCH_ERROR="levelSwitchError",t.AUDIO_TRACK_LOAD_ERROR="audioTrackLoadError",t.AUDIO_TRACK_LOAD_TIMEOUT="audioTrackLoadTimeOut",t.SUBTITLE_LOAD_ERROR="subtitleTrackLoadError",t.SUBTITLE_TRACK_LOAD_TIMEOUT="subtitleTrackLoadTimeOut",t.FRAG_LOAD_ERROR="fragLoadError",t.FRAG_LOAD_TIMEOUT="fragLoadTimeOut",t.FRAG_DECRYPT_ERROR="fragDecryptError",t.FRAG_PARSING_ERROR="fragParsingError",t.FRAG_GAP="fragGap",t.REMUX_ALLOC_ERROR="remuxAllocError",t.KEY_LOAD_ERROR="keyLoadError",t.KEY_LOAD_TIMEOUT="keyLoadTimeOut",t.BUFFER_ADD_CODEC_ERROR="bufferAddCodecError",t.BUFFER_INCOMPATIBLE_CODECS_ERROR="bufferIncompatibleCodecsError",t.BUFFER_APPEND_ERROR="bufferAppendError",t.BUFFER_APPENDING_ERROR="bufferAppendingError",t.BUFFER_APPEND_NO_PROGRESS="bufferAppendNoProgress",t.BUFFER_STALLED_ERROR="bufferStalledError",t.BUFFER_FULL_ERROR="bufferFullError",t.BUFFER_SEEK_OVER_HOLE="bufferSeekOverHole",t.BUFFER_NUDGE_ON_STALL="bufferNudgeOnStall",t.ASSET_LIST_LOAD_ERROR="assetListLoadError",t.ASSET_LIST_LOAD_TIMEOUT="assetListLoadTimeout",t.ASSET_LIST_PARSING_ERROR="assetListParsingError",t.INTERSTITIAL_ASSET_ITEM_ERROR="interstitialAssetItemError",t.INTERNAL_EXCEPTION="internalException",t.INTERNAL_ABORTED="aborted",t.ATTACH_MEDIA_ERROR="attachMediaError",t.MEDIA_SOURCE_REQUIRES_RESET="mediaSourceRequiresReset",t.UNKNOWN="unknown",t}({}),oe=function(t){return t.MEDIA_ATTACHING="hlsMediaAttaching",t.MEDIA_ATTACHED="hlsMediaAttached",t.MEDIA_DETACHING="hlsMediaDetaching",t.MEDIA_DETACHED="hlsMediaDetached",t.MEDIA_ENDED="hlsMediaEnded",t.STALL_RESOLVED="hlsStallResolved",t.BUFFER_RESET="hlsBufferReset",t.BUFFER_CODECS="hlsBufferCodecs",t.BUFFER_CREATED="hlsBufferCreated",t.BUFFER_APPENDING="hlsBufferAppending",t.BUFFER_APPENDED="hlsBufferAppended",t.BUFFER_EOS="hlsBufferEos",t.BUFFERED_TO_END="hlsBufferedToEnd",t.BUFFER_FLUSHING="hlsBufferFlushing",t.BUFFER_FLUSHED="hlsBufferFlushed",t.MANIFEST_LOADING="hlsManifestLoading",t.MANIFEST_LOADED="hlsManifestLoaded",t.MANIFEST_PARSED="hlsManifestParsed",t.LEVEL_SWITCHING="hlsLevelSwitching",t.LEVEL_SWITCHED="hlsLevelSwitched",t.LEVEL_LOADING="hlsLevelLoading",t.LEVEL_LOADED="hlsLevelLoaded",t.LEVEL_UPDATED="hlsLevelUpdated",t.LEVEL_PTS_UPDATED="hlsLevelPtsUpdated",t.LEVELS_UPDATED="hlsLevelsUpdated",t.AUDIO_TRACKS_UPDATED="hlsAudioTracksUpdated",t.AUDIO_TRACK_SWITCHING="hlsAudioTrackSwitching",t.AUDIO_TRACK_SWITCHED="hlsAudioTrackSwitched",t.AUDIO_TRACK_LOADING="hlsAudioTrackLoading",t.AUDIO_TRACK_LOADED="hlsAudioTrackLoaded",t.AUDIO_TRACK_UPDATED="hlsAudioTrackUpdated",t.SUBTITLE_TRACKS_UPDATED="hlsSubtitleTracksUpdated",t.SUBTITLE_TRACKS_CLEARED="hlsSubtitleTracksCleared",t.SUBTITLE_TRACK_SWITCH="hlsSubtitleTrackSwitch",t.SUBTITLE_TRACK_LOADING="hlsSubtitleTrackLoading",t.SUBTITLE_TRACK_LOADED="hlsSubtitleTrackLoaded",t.SUBTITLE_TRACK_UPDATED="hlsSubtitleTrackUpdated",t.SUBTITLE_FRAG_PROCESSED="hlsSubtitleFragProcessed",t.CUES_PARSED="hlsCuesParsed",t.NON_NATIVE_TEXT_TRACKS_FOUND="hlsNonNativeTextTracksFound",t.INIT_PTS_FOUND="hlsInitPtsFound",t.FRAG_LOADING="hlsFragLoading",t.FRAG_LOAD_EMERGENCY_ABORTED="hlsFragLoadEmergencyAborted",t.FRAG_LOADED="hlsFragLoaded",t.FRAG_DECRYPTED="hlsFragDecrypted",t.FRAG_PARSING_INIT_SEGMENT="hlsFragParsingInitSegment",t.FRAG_PARSING_USERDATA="hlsFragParsingUserdata",t.FRAG_PARSING_METADATA="hlsFragParsingMetadata",t.FRAG_PARSED="hlsFragParsed",t.FRAG_BUFFERED="hlsFragBuffered",t.FRAG_CHANGED="hlsFragChanged",t.FPS_DROP="hlsFpsDrop",t.FPS_DROP_LEVEL_CAPPING="hlsFpsDropLevelCapping",t.MAX_AUTO_LEVEL_UPDATED="hlsMaxAutoLevelUpdated",t.ERROR="hlsError",t.DESTROYING="hlsDestroying",t.KEY_LOADING="hlsKeyLoading",t.KEY_LOADED="hlsKeyLoaded",t.LIVE_BACK_BUFFER_REACHED="hlsLiveBackBufferReached",t.BACK_BUFFER_REACHED="hlsBackBufferReached",t.STEERING_MANIFEST_LOADED="hlsSteeringManifestLoaded",t.ASSET_LIST_LOADING="hlsAssetListLoading",t.ASSET_LIST_LOADED="hlsAssetListLoaded",t.INTERSTITIALS_UPDATED="hlsInterstitialsUpdated",t.INTERSTITIALS_BUFFERED_TO_BOUNDARY="hlsInterstitialsBufferedToBoundary",t.INTERSTITIAL_ASSET_PLAYER_CREATED="hlsInterstitialAssetPlayerCreated",t.INTERSTITIAL_STARTED="hlsInterstitialStarted",t.INTERSTITIAL_ASSET_STARTED="hlsInterstitialAssetStarted",t.INTERSTITIAL_ASSET_ENDED="hlsInterstitialAssetEnded",t.INTERSTITIAL_ASSET_ERROR="hlsInterstitialAssetError",t.INTERSTITIAL_ENDED="hlsInterstitialEnded",t.INTERSTITIALS_PRIMARY_RESUMED="hlsInterstitialsPrimaryResumed",t.PLAYOUT_LIMIT_REACHED="hlsPlayoutLimitReached",t.EVENT_CUE_ENTER="hlsEventCueEnter",t}({});function ZZn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ude={exports:{}},V9e;function JZn(){return V9e||(V9e=1,function(t,e){(function(n){var r=/^(?=((?:[a-zA-Z0-9+\-.]+:)?))\1(?=((?:\/\/[^\/?#]*)?))\2(?=((?:(?:[^?#\/]*\/)*[^;?#\/]*)?))\3((?:;[^?#]*)?)(\?[^#]*)?(#[^]*)?$/,s=/^(?=([^\/?#]*))\1([^]*)$/,i=/(?:\/|^)\.(?=\/)/g,o=/(?:\/|^)\.\.\/(?!\.\.\/)[^\/]*(?=\/)/g,l={buildAbsoluteURL:function(c,d,u){if(u=u||{},c=c.trim(),d=d.trim(),!d){if(!u.alwaysNormalize)return c;var h=l.parseURL(c);if(!h)throw new Error("Error trying to parse base URL.");return h.path=l.normalizePath(h.path),l.buildURLFromParts(h)}var m=l.parseURL(d);if(!m)throw new Error("Error trying to parse relative URL.");if(m.scheme)return u.alwaysNormalize?(m.path=l.normalizePath(m.path),l.buildURLFromParts(m)):d;var f=l.parseURL(c);if(!f)throw new Error("Error trying to parse base URL.");if(!f.netLoc&&f.path&&f.path[0]!=="/"){var p=s.exec(f.path);f.netLoc=p[1],f.path=p[2]}f.netLoc&&!f.path&&(f.path="/");var g={scheme:f.scheme,netLoc:m.netLoc,path:null,params:m.params,query:m.query,fragment:m.fragment};if(!m.netLoc&&(g.netLoc=f.netLoc,m.path[0]!=="/"))if(!m.path)g.path=f.path,m.params||(g.params=f.params,m.query||(g.query=f.query));else{var v=f.path,b=v.substring(0,v.lastIndexOf("/")+1)+m.path;g.path=l.normalizePath(b)}return g.path===null&&(g.path=u.alwaysNormalize?l.normalizePath(m.path):m.path),l.buildURLFromParts(g)},parseURL:function(c){var d=r.exec(c);return d?{scheme:d[1]||"",netLoc:d[2]||"",path:d[3]||"",params:d[4]||"",query:d[5]||"",fragment:d[6]||""}:null},normalizePath:function(c){for(c=c.split("").reverse().join("").replace(i,"");c.length!==(c=c.replace(o,"")).length;);return c.split("").reverse().join("")},buildURLFromParts:function(c){return c.scheme+c.netLoc+c.path+c.params+c.query+c.fragment}};t.exports=l})()}(ude)),ude.exports}var n_e=JZn();class r_e{constructor(){this.aborted=!1,this.loaded=0,this.retry=0,this.total=0,this.chunkCount=0,this.bwEstimate=0,this.loading={start:0,first:0,end:0},this.parsing={start:0,end:0},this.buffering={start:0,first:0,end:0}}}let ks=function(t){return t.MANIFEST="manifest",t.LEVEL="level",t.AUDIO_TRACK="audioTrack",t.SUBTITLE_TRACK="subtitleTrack",t.MEDIA_FRAGMENT="media-fragment",t.KEY="key",t.STEERING_MANIFEST="steering-manifest",t.SERVER_CERTIFICATE="server-certificate",t.INTERSTITIAL_ASSET_LIST="interstitial-asset-list",t}({}),Wn=function(t){return t.MAIN="main",t.AUDIO="audio",t.SUBTITLE="subtitle",t}({});var na={AUDIO:"audio",VIDEO:"video",AUDIOVIDEO:"audiovideo"};class J1t{constructor(e){this._byteRange=null,this._url=null,this._stats=null,this._streams=null,this.base=void 0,this.relurl=void 0,typeof e=="string"&&(e={url:e}),this.base=e,eJn(this,"stats")}setByteRange(e,n){const r=e.split("@",2);let s;r.length===1?s=(n==null?void 0:n.byteRangeEndOffset)||0:s=parseInt(r[1]),this._byteRange=[s,parseInt(r[0])+s]}get baseurl(){return this.base.url}get byteRange(){return this._byteRange===null?[]:this._byteRange}get byteRangeStartOffset(){return this.byteRange[0]}get byteRangeEndOffset(){return this.byteRange[1]}get elementaryStreams(){return this._streams===null&&(this._streams={[na.AUDIO]:null,[na.VIDEO]:null,[na.AUDIOVIDEO]:null}),this._streams}set elementaryStreams(e){this._streams=e}get hasStats(){return this._stats!==null}get hasStreams(){return this._streams!==null}get stats(){return this._stats===null&&(this._stats=new r_e),this._stats}set stats(e){this._stats=e}get url(){return!this._url&&this.relurl&&(this._url=n_e.buildAbsoluteURL(this.baseurl,this.relurl,{alwaysNormalize:!0})),this._url||""}set url(e){this._url=e}clearElementaryStreamInfo(){const{elementaryStreams:e}=this;e[na.AUDIO]=null,e[na.VIDEO]=null,e[na.AUDIOVIDEO]=null,this.url=null}}function Oo(t){return t.sn!=="initSegment"}function Z4(t,e){return t.sn===(e==null?void 0:e.sn)&&t.level===e.level}function Zbe(t,e){return t.sn===(e==null?void 0:e.sn)&&t.level===e.level&&t.cc===e.cc}class lV extends J1t{constructor(e,n){super(n),this._decryptdata=null,this._programDateTime=null,this._ref=null,this._bitrate=void 0,this.rawProgramDateTime=null,this.tagList=[],this.duration=0,this.sn=0,this.levelkeys=void 0,this.type=void 0,this.loader=null,this.keyLoader=null,this.level=-1,this.cc=0,this.startPTS=void 0,this.endPTS=void 0,this.startDTS=void 0,this.endDTS=void 0,this.start=0,this.playlistOffset=0,this.deltaPTS=void 0,this.maxStartPTS=void 0,this.minEndPTS=void 0,this.data=void 0,this.bitrateTest=!1,this.title=null,this.initSegment=null,this.endList=void 0,this.gap=void 0,this.urlId=0,this.type=e}get byteLength(){if(this.hasStats){const e=this.stats.total;if(e)return e}if(this.byteRange.length){const e=this.byteRange[0],n=this.byteRange[1];if(xn(e)&&xn(n))return n-e}return null}get bitrate(){return this.byteLength?this.byteLength*8/this.duration:this._bitrate?this._bitrate:null}set bitrate(e){this._bitrate=e}get decryptdata(){var e;const{levelkeys:n}=this;if(!n||n.NONE)return null;if(n.identity)this._decryptdata||(this._decryptdata=n.identity.getDecryptData(this.sn));else if(!((e=this._decryptdata)!=null&&e.keyId)){const r=Object.keys(n);if(r.length===1){const s=this._decryptdata=n[r[0]]||null;s&&(this._decryptdata=s.getDecryptData(this.sn,n))}}return this._decryptdata}get end(){return this.start+this.duration}get endProgramDateTime(){if(this.programDateTime===null)return null;const e=xn(this.duration)?this.duration:0;return this.programDateTime+e*1e3}get encrypted(){var e;if((e=this._decryptdata)!=null&&e.encrypted)return!0;if(this.levelkeys){var n;const r=Object.keys(this.levelkeys),s=r.length;if(s>1||s===1&&(n=this.levelkeys[r[0]])!=null&&n.encrypted)return!0}return!1}get programDateTime(){return this._programDateTime===null&&this.rawProgramDateTime&&(this.programDateTime=Date.parse(this.rawProgramDateTime)),this._programDateTime}set programDateTime(e){if(!xn(e)){this._programDateTime=this.rawProgramDateTime=null;return}this._programDateTime=e}get ref(){return Oo(this)?(this._ref||(this._ref={base:this.base,start:this.start,duration:this.duration,sn:this.sn,programDateTime:this.programDateTime}),this._ref):null}addStart(e){this.setStart(this.start+e)}setStart(e){this.start=e,this._ref&&(this._ref.start=e)}setDuration(e){this.duration=e,this._ref&&(this._ref.duration=e)}setKeyFormat(e){const n=this.levelkeys;if(n){var r;const s=n[e];s&&!((r=this._decryptdata)!=null&&r.keyId)&&(this._decryptdata=s.getDecryptData(this.sn,n))}}abortRequests(){var e,n;(e=this.loader)==null||e.abort(),(n=this.keyLoader)==null||n.abort()}setElementaryStreamInfo(e,n,r,s,i,o=!1){const{elementaryStreams:l}=this,c=l[e];if(!c){l[e]={startPTS:n,endPTS:r,startDTS:s,endDTS:i,partial:o};return}c.startPTS=Math.min(c.startPTS,n),c.endPTS=Math.max(c.endPTS,r),c.startDTS=Math.min(c.startDTS,s),c.endDTS=Math.max(c.endDTS,i)}}class XZn extends J1t{constructor(e,n,r,s,i){super(r),this.fragOffset=0,this.duration=0,this.independent=!1,this.relurl=void 0,this.fragment=void 0,this.index=void 0,this.gap=!1,this.duration=e.decimalFloatingPoint("DURATION"),this.gap=e.bool("GAP"),this.independent=e.bool("INDEPENDENT"),this.relurl=e.enumeratedString("URI"),this.fragment=n,this.index=s;const o=e.enumeratedString("BYTERANGE");o&&this.setByteRange(o,i),i&&(this.fragOffset=i.fragOffset+i.duration)}get start(){return this.fragment.start+this.fragOffset}get end(){return this.start+this.duration}get loaded(){const{elementaryStreams:e}=this;return!!(e.audio||e.video||e.audiovideo||this.fragment.type===Wn.SUBTITLE&&this.stats.loading.end>0)}}function X1t(t,e){const n=Object.getPrototypeOf(t);if(n){const r=Object.getOwnPropertyDescriptor(n,e);return r||X1t(n,e)}}function eJn(t,e){const n=X1t(t,e);n&&(n.enumerable=!0,Object.defineProperty(t,e,n))}function tJn(t,e,n){return(e=sJn(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Mi(){return Mi=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Mi.apply(null,arguments)}function H9e(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function rr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?H9e(Object(n),!0).forEach(function(r){tJn(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):H9e(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Bre(t,e){if(t==null)return{};var n,r,s=nJn(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function nJn(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function rJn(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function sJn(t){var e=rJn(t,"string");return typeof e=="symbol"?e:e+""}function tZ(t){switch(t.details){case rt.FRAG_LOAD_TIMEOUT:case rt.KEY_LOAD_TIMEOUT:case rt.LEVEL_LOAD_TIMEOUT:case rt.MANIFEST_LOAD_TIMEOUT:case rt.AUDIO_TRACK_LOAD_TIMEOUT:case rt.SUBTITLE_TRACK_LOAD_TIMEOUT:case rt.ASSET_LIST_LOAD_TIMEOUT:return!0}return!1}function ekt(t){return t.details.startsWith("key")}function tkt(t){return ekt(t)&&!!t.frag&&!t.frag.decryptdata}function G9e(t,e){const n=tZ(e);return t.default[`${n?"timeout":"error"}Retry`]}function s_e(t,e){const n=t.backoff==="linear"?1:Math.pow(2,e);return Math.min(n*t.retryDelayMs,t.maxRetryDelayMs)}function W9e(t){return rr(rr({},t),{errorRetry:null,timeoutRetry:null})}function L6(t,e,n,r){if(!t)return!1;const s=r==null?void 0:r.code,i=e<t.maxNumRetry&&(iJn(s)||!!n);return t.shouldRetry?t.shouldRetry(t,e,n,r,i):i}function iJn(t){return D6(t)||!!t&&(t<400||t>499)}function D6(t){return t===0&&navigator.onLine===!1}function nkt(t,e){return e>0&&t.loadError>0&&t.loadErrorTime!==0&&self.performance.now()-t.loadErrorTime>e}class bT{constructor(e,n=0,r=0){this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=e,this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=n,this.totalWeight_=r}sample(e,n){const r=Math.pow(this.alpha_,e);this.estimate_=n*(1-r)+r*this.estimate_,this.totalWeight_+=e}getTotalWeight(){return this.totalWeight_}getEstimate(){if(this.alpha_){const e=1-Math.pow(this.alpha_,this.totalWeight_);if(e)return this.estimate_/e}return this.estimate_}}class aJn{constructor(e,n,r,s=100){this.defaultEstimate_=void 0,this.minWeight_=void 0,this.minDelayMs_=void 0,this.slow_=void 0,this.fast_=void 0,this.defaultTTFB_=void 0,this.ttfb_=void 0,this.defaultEstimate_=r,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new bT(e),this.fast_=new bT(n),this.defaultTTFB_=s,this.ttfb_=new bT(e)}update(e,n){const{slow_:r,fast_:s,ttfb_:i}=this;r.halfLife!==e&&(this.slow_=new bT(e,r.getEstimate(),r.getTotalWeight())),s.halfLife!==n&&(this.fast_=new bT(n,s.getEstimate(),s.getTotalWeight())),i.halfLife!==e&&(this.ttfb_=new bT(e,i.getEstimate(),i.getTotalWeight()))}sample(e,n){if(n<=0)return;const r=Math.min(this.minDelayMs_,n/1e5),s=8*n,i=Math.max(e,r)/1e3,o=s/i;this.fast_.sample(i,o),this.slow_.sample(i,o)}sampleTTFB(e){const n=e/1e3,r=Math.sqrt(2)*Math.exp(-Math.pow(n,2)/2);this.ttfb_.sample(r,Math.max(e,5))}canEstimate(){return this.fast_.getTotalWeight()>=this.minWeight_}getEstimate(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}getEstimateTTFB(){return this.ttfb_.getTotalWeight()>=this.minWeight_?this.ttfb_.getEstimate():this.defaultTTFB_}get defaultEstimate(){return this.defaultEstimate_}destroy(){}}class Fm{constructor(e,n){this.trace=void 0,this.debug=void 0,this.log=void 0,this.warn=void 0,this.info=void 0,this.error=void 0;const r=`[${e}]:`;this.trace=Jw,this.debug=n.debug.bind(null,r),this.log=n.log.bind(null,r),this.warn=n.warn.bind(null,r),this.info=n.info.bind(null,r),this.error=n.error.bind(null,r)}}const Jw=function(){},oJn={trace:Jw,debug:Jw,log:Jw,warn:Jw,info:Jw,error:Jw};function Jbe(){return Mi({},oJn)}function lJn(t,e){const n=self.console[t];return n?n.bind(self.console,`${e?"["+e+"] ":""}[${t}] >`):Jw}function q9e(t,e,n){return e[t]?e[t].bind(e):lJn(t,n)}const Xbe=Jbe();function cJn(t,e,n){const r=Jbe();if(typeof console=="object"&&t===!0||typeof t=="object"){const s=["debug","log","info","warn","error"];s.forEach(i=>{r[i]=q9e(i,t,n)});try{r.log(`Debug logs enabled for "${e}" in hls.js version 1.7.3`)}catch{return Jbe()}s.forEach(i=>{Xbe[i]=q9e(i,t)})}else Mi(Xbe,r);return r}const hi=Xbe;function Bk(t=!0){return typeof self>"u"?void 0:(t||!self.MediaSource)&&self.ManagedMediaSource||self.MediaSource||self.WebKitMediaSource}function dJn(t){return typeof self<"u"&&t===self.ManagedMediaSource}function rkt(t,e){const n=Object.keys(t),r=Object.keys(e),s=n.length,i=r.length;return!s||!i||s===i&&!n.some(o=>r.indexOf(o)===-1)}function uJn(t){return btoa(String.fromCharCode(...t))}function Ure(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}const hJn="utf-16",hde="utf-16be",K9e="utf-16le",QW="utf-8";function mJn(t,e={}){let n;Ure(t)?n=new DataView(t):n=new DataView(t.buffer,t.byteOffset,t.byteLength);let r=0,{encoding:s}=e;if(!s){const d=n.getUint8(0),u=n.getUint8(1);d==239&&u==187&&n.getUint8(2)==191?(s=QW,r=3):d==254&&u==255?(s=hde,r=2):d==255&&u==254?(s=K9e,r=2):s=QW}if(typeof TextDecoder<"u")return new TextDecoder(s).decode(n);const{byteLength:i}=n,o=s!==hde;let l="",c;for(;r<i;){switch(s){case QW:if(c=n.getUint8(r),c<128)r++;else if(c>=194&&c<=223)if(r+1<i){const d=n.getUint8(r+1);d>=128&&d<=191?(c=(c&31)<<6|d&63,r+=2):r++}else r++;else if(c>=224&&c<=239)if(r+2<=i-1){const d=n.getUint8(r+1),u=n.getUint8(r+2);d>=128&&d<=191&&u>=128&&u<=191?(c=(c&15)<<12|(d&63)<<6|u&63,r+=3):r++}else r++;else if(c>=240&&c<=244)if(r+3<=i-1){const d=n.getUint8(r+1),u=n.getUint8(r+2),h=n.getUint8(r+3);d>=128&&d<=191&&u>=128&&u<=191&&h>=128&&h<=191?(c=(c&7)<<18|(d&63)<<12|(u&63)<<6|h&63,r+=4):r++}else r++;else r++;break;case hde:case hJn:case K9e:c=n.getUint16(r,o),r+=2;break}l+=String.fromCodePoint(c)}return l}function fJn(t){const e=typeof t=="string"?new URL(t):t;return e.origin+e.pathname.substring(0,e.pathname.lastIndexOf("/")+1)}function skt(t,e){if(t<0)return-skt(-t,e);const n=Math.pow(10,e);if(Math.abs(t*n%1-.5)<Number.EPSILON){const r=Math.floor(t*n);return(r%2===0?r:r+1)/n}else return Math.round(t*n)/n}function pJn(t,e){let n;try{n=new URL(t)}catch{return t}const r=new URL(e);if(n.origin!==r.origin)return t;const s=n.pathname.split("/").slice(1),i=r.pathname.split("/").slice(1,-1),o=Math.min(s.length,i.length);for(let l=0;l<o&&s[l]===i[l];l++)s.shift(),i.shift();for(;i.length;)i.shift(),s.unshift("..");return s.join("/")+n.search+n.hash}function ikt(){try{return crypto.randomUUID()}catch{try{const e=URL.createObjectURL(new Blob),n=e.toString();return URL.revokeObjectURL(e),n.slice(n.lastIndexOf("/")+1)}catch{let n=new Date().getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,r=>{const s=(n+Math.random()*16)%16|0;return n=Math.floor(n/16),(r=="x"?s:s&3|8).toString(16)})}}}function i_e(t,e){return e+10<=t.length&&t[e]===73&&t[e+1]===68&&t[e+2]===51&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128}function zre(t,e){let n=0;return n=(t[e]&127)<<21,n|=(t[e+1]&127)<<14,n|=(t[e+2]&127)<<7,n|=t[e+3]&127,n}function gJn(t,e){return i_e(t,e)&&zre(t,e+6)+10<=t.length-e}function akt(t,e){return e+10<=t.length&&t[e]===51&&t[e+1]===68&&t[e+2]===73&&t[e+3]<255&&t[e+4]<255&&t[e+6]<128&&t[e+7]<128&&t[e+8]<128&&t[e+9]<128}function $6(t,e){const n=e;let r=0;for(;i_e(t,e);){r+=10;const s=zre(t,e+6);r+=s,akt(t,e+10)&&(r+=10),e+=r}if(r>0)return t.subarray(n,n+r)}function vJn(t){return Ure(t)?t:t.byteOffset==0&&t.byteLength==t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer}function mde(t,e=0,n=1/0){return yJn(t,e,n,Uint8Array)}function yJn(t,e,n,r){const s=bJn(t);let i=1;"BYTES_PER_ELEMENT"in r&&(i=r.BYTES_PER_ELEMENT);const o=xJn(t)?t.byteOffset:0,l=(o+t.byteLength)/i,c=(o+e)/i,d=Math.floor(Math.max(0,Math.min(c,l)));return new r(s,d,Math.floor(Math.min(d+Math.max(n,0),l))-d)}function bJn(t){return Ure(t)?t:t.buffer}function xJn(t){return t&&Ure(t.buffer)&&t.byteLength!==void 0&&t.byteOffset!==void 0}function Sm(t,e=!1){const n=e?t.indexOf(0):t.length,r=mJn(new DataView(t.buffer,t.byteOffset,n),{encoding:QW});return e?r:r.replace(/\0/g,"")}function wJn(t){const e={key:t.type,description:"",data:"",mimeType:null,pictureType:null},n=3;if(t.size<2)return;if(t.data[0]!==n){console.log("Ignore frame with unrecognized character encoding");return}const r=t.data.subarray(1).indexOf(0);if(r===-1)return;const s=Sm(mde(t.data,1,r)),i=t.data[2+r],o=t.data.subarray(3+r).indexOf(0);if(o===-1)return;const l=Sm(mde(t.data,3+r,o));let c;return s==="-->"?c=Sm(mde(t.data,4+r+o)):c=vJn(t.data.subarray(4+r+o)),e.mimeType=s,e.pictureType=i,e.description=l,e.data=c,e}function kJn(t){if(t.size<2)return;const e=Sm(t.data,!0),n=new Uint8Array(t.data.subarray(e.length+1));return{key:t.type,info:e,data:n.buffer}}function SJn(t){if(t.size<2)return;if(t.type==="TXXX"){let n=1;const{data:r}=t,s=Sm(r.subarray(n),!0);n+=s.length+1;const i=Sm(r.subarray(n));return{key:t.type,info:s,data:i}}const e=Sm(t.data.subarray(1));return{key:t.type,info:"",data:e}}function CJn(t){if(t.type==="WXXX"){if(t.size<2)return;let n=1;const r=Sm(t.data.subarray(n),!0);n+=r.length+1;const s=Sm(t.data.subarray(n));return{key:t.type,info:r,data:s}}const e=Sm(t.data);return{key:t.type,info:"",data:e}}function jJn(t){return t.type==="PRIV"?kJn(t):t.type[0]==="W"?CJn(t):t.type==="APIC"?wJn(t):SJn(t)}function EJn(t){const e=String.fromCharCode(t[0],t[1],t[2],t[3]),n=zre(t,4),r=10;return{type:e,size:n,data:t.subarray(r,r+n)}}const cV=10,NJn=10;function okt(t){let e=0;const n=[];for(;i_e(t,e);){const r=zre(t,e+6);t[e+5]>>6&1&&(e+=cV),e+=cV;const s=e+r;for(;e+NJn<s;){const i=EJn(t.subarray(e)),o=jJn(i);o&&n.push(o),e+=i.size+cV}akt(t,e)&&(e+=cV)}return n}function lkt(t){return t&&t.key==="PRIV"&&t.info==="com.apple.streaming.transportStreamTimestamp"}function TJn(t){if(t.data.byteLength===8){const e=new Uint8Array(t.data),n=e[3]&1;let r=(e[4]<<23)+(e[5]<<15)+(e[6]<<7)+e[7];return r/=45,n&&(r+=4772185884e-2),Math.round(r)}}function a_e(t){const e=okt(t);for(const n of e)if(lkt(n))return TJn(n)}function Gl(t){let e="";for(let n=0;n<t.length;n++){let r=t[n].toString(16);r.length<2&&(r="0"+r),e+=r}return e}function ckt(t){return Uint8Array.from(t.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer}function o_e(t){return Uint8Array.from(atob(t),e=>e.charCodeAt(0))}function jg(t){return String.fromCharCode.apply(null,t)}const Rv=Math.pow(2,32)-1,Lr={avc1:1635148593,avcC:1635148611,hvc1:1752589105,hvcC:1752589123,btrt:1651798644,dinf:1684631142,dref:1685218662,esds:1702061171,free:1718773093,ftyp:1718909296,hdlr:1751411826,mdat:1835295092,mdhd:1835296868,mdia:1835297121,mfhd:1835427940,minf:1835626086,moof:1836019558,moov:1836019574,mp4a:1836069985,".mp3":778924083,dac3:1684103987,"ac-3":1633889587,mvex:1836475768,mvhd:1836476516,pasp:1885434736,sdtp:1935963248,stbl:1937007212,stco:1937007471,stsc:1937011555,stsd:1937011556,stsz:1937011578,stts:1937011827,tfdt:1952867444,tfhd:1952868452,traf:1953653094,trak:1953653099,trun:1953658222,trex:1953654136,tkhd:1953196132,vmhd:1986881636,smhd:1936549988},dkt={video:1,audio:2,id3:3,text:4};function ukt(t,e){const n=t[e]<<8|t[e+1];return n<0?65536+n:n}function Un(t,e){const n=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3];return n<0?4294967296+n:n}function Y9e(t,e){let n=Un(t,e);return n*=Math.pow(2,32),n+=Un(t,e+4),n}function dV(t,e){let n="";for(let r=e;r<t.length;r++)if(n+=String.fromCharCode(t[r]),t[r]===0)return n;return null}function exe(t,e){return t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function pl(t,e,n){t[e]=n>>24,t[e+1]=n>>16&255,t[e+2]=n>>8&255,t[e+3]=n&255}function Q9e(t,e,n){const r=e.byteOffset-t.byteOffset-8,s=8+n,i=e.byteLength+8-s;i<8||(pl(t,r,s),pl(t,r+s,i),pl(t,r+s+4,Lr.free))}function txe(t,e){return[t.byteOffset-e-8,t.byteOffset-e+t.byteLength]}function hkt(t,e){e.sort((l,c)=>l[0]-c[0]);const n=e.reduce((l,[c,d])=>l+d-c,0),r=new Uint8Array(t.byteLength-n);let s=0,i=0;for(let l=0;l<e.length;l++){const[c,d]=e[l];r.set(t.subarray(s,c),i),i+=c-s,s=d}return r.set(t.subarray(s),i),{result:r,dropped:n,droppedBefore:l=>e.reduce((c,[d,u])=>u<=l?c+u-d:c,0)}}function _Jn(t){const e=Gr(t,["moov"]);if(e.length!==1||Gr(t,["moof"]).length)return null;const n=t.byteOffset,r=[],s=[];let i=!1;const o=Gr(e[0],["trak"]);for(let f=0;f<o.length;f++){const p=o[f],g=Gr(p,["mdia","hdlr"])[0];if((g?jg(g.subarray(8,12)):"")==="vide"){i=!0;continue}const b=Gr(p,["tkhd"])[0];if(!b)return null;const x=b[0];s.push(Un(b,x===0?12:20)),r.push(txe(p,n))}if(!i||!r.length)return null;const l=Gr(e[0],["mvex"])[0];let c=0;if(l){const f=Gr(l,["trex"]);for(let p=0;p<f.length;p++){const g=f[p];s.indexOf(Un(g,4))!==-1&&(r.push(txe(g,n)),c+=g.byteLength+8)}}const{result:d,dropped:u,droppedBefore:h}=hkt(t,r),m=e[0].byteOffset-n-8;if(pl(d,m,e[0].byteLength+8-u),l&&c){const f=l.byteOffset-n-8;pl(d,f-h(f),l.byteLength+8-c)}return d}function AJn(t,e,n,r,s){if(n<1)return null;const i=Gr(t,["moof"]);if(i.length!==1)return null;const o=i[0],l=t.byteOffset,c=[],d=[],u=Gr(o,["traf"]);let h=!0;for(let g=0;g<u.length;g++){const v=u[g],b=Gr(v,["tfhd"])[0];if(!b)return null;Un(b,4)===e?(c.push(v),Un(b,0)&131072||(h=!1)):d.push(txe(v,l))}if(!c.length||d.length&&!h)return null;if(r!==void 0){let g=n;for(let b=0;b<c.length;b++){const x=c[b];let w=0;const k=Gr(x,["trun"]);for(let j=0;j<k.length;j++){const E=k[j],N=Math.min(g,Un(E,4));if(N){pl(t,E.byteOffset-l+4,N);const A=Un(E,0)&16777215,_=(A&256?4:0)+(A&512?4:0)+(A&1024?4:0)+(A&2048?4:0);Q9e(t,E,8+(A&1?4:0)+(A&4?4:0)+N*_)}else pl(t,E.byteOffset-l-4,Lr.free);g-=N,w+=N}const S=Gr(x,["senc"])[0];S&&pl(t,S.byteOffset-l+4,w);const C=Gr(x,["saiz"])[0];if(C){const j=C[1]<<16|C[2]<<8|C[3];let E=4;j&1&&(E+=8);const N=C[E];E+=1,pl(t,C.byteOffset-l+E,w),Q9e(t,C,E+4+(N===0?w:0))}}const v=Gr(t,["mdat"]);if(v.length===1){const b=v[0].byteOffset-l-8;pl(t,b,r-b)}}let m=t,f=0,p=()=>0;if(d.length){({result:m,dropped:f,droppedBefore:p}=hkt(t,d)),pl(m,o.byteOffset-l-8,o.byteLength+8-f);for(let g=0;g<c.length;g++){const v=c[g],b=p(v.byteOffset-l),x=Gr(v,["trun"]);for(let w=0;w<x.length;w++){const k=x[w];Un(k,0)&1&&pl(m,k.byteOffset-l-b+8,Un(k,8)-f)}if(b){const w=Gr(v,["saio"]);for(let k=0;k<w.length;k++){const S=w[k],C=S[0]===0?4:8;let j=Un(S,0)&1?12:4,E=Un(S,j);for(j+=4;E--;j+=C){const N=j+C-4;pl(m,S.byteOffset-l-b+N,Un(S,N)-b)}}}}}if(s){const{durationOffset:g,value:v}=s;pl(m,g-p(g),v)}return r!==void 0?m.subarray(0,r-f):m}function PJn(t,e){const n=t.byteLength;for(let r=0;r<n;){const s=Un(t,r);if(s>8&&Un(t,r+4)===Lr[e])return!0;r=s>1?r+s:n}return!1}function Gr(t,e){const n=[];return e.length&&mkt(t,e,0,0,t.byteLength,n),n}function mkt(t,e,n,r,s,i){const o=e[n];if((o==null?void 0:o.length)!==4)return;const l=o.charCodeAt(0),c=o.charCodeAt(1),d=o.charCodeAt(2),u=o.charCodeAt(3),h=e.length-1;for(let m=r;m<s;){const f=m+8<=s,p=m+4<=s?t[m]*16777216+(t[m+1]<<16|t[m+2]<<8|t[m+3]):Un(t,m),g=p>1?m+p:s;if(f&&t[m+4]===l&&t[m+5]===c&&t[m+6]===d&&t[m+7]===u){const v=Math.min(g,s);n===h?i.push(t.subarray(m+8,v)):mkt(t,e,n+1,m+8,v,i)}m=g}}function RJn(t){const e=[],n=t[0];let r=8;const s=Un(t,r);r+=4;let i=0,o=0;n===0?(i=Un(t,r),o=Un(t,r+4),r+=8):(i=Y9e(t,r),o=Y9e(t,r+8),r+=16),r+=2;let l=t.length+o;const c=ukt(t,r);r+=2;for(let d=0;d<c;d++){let u=r;const h=Un(t,u);u+=4;const m=h&2147483647;if((h&2147483648)>>>31===1)return hi.warn("SIDX has hierarchical references (not supported)"),null;const p=Un(t,u);u+=4,e.push({referenceSize:m,subsegmentDuration:p,info:{duration:p/s,start:l,end:l+m-1}}),l+=m,u+=4,r=u}return{earliestPresentationTime:i,timescale:s,version:n,referencesCount:c,references:e}}function fkt(t){const e=[],n=Gr(t,["moov","trak"]);for(let s=0;s<n.length;s++){const i=n[s],o=Gr(i,["tkhd"])[0];if(o){let l=o[0];const c=Un(o,l===0?12:20),d=Gr(i,["mdia","mdhd"])[0];if(d){l=d[0];const u=Un(d,l===0?12:20),h=Gr(i,["mdia","hdlr"])[0];if(h){const m=jg(h.subarray(8,12)),f={soun:na.AUDIO,vide:na.VIDEO}[m],p=Gr(i,["mdia","minf","stbl","stsd"])[0],g=IJn(p);f?(e[c]={timescale:u,type:f,stsd:g},e[f]=rr({timescale:u,id:c},g)):e[c]={timescale:u,type:m,stsd:g}}}}}return Gr(t,["moov","mvex","trex"]).forEach(s=>{const i=Un(s,4),o=e[i];o&&(o.default={duration:Un(s,12),sampleSize:Un(s,16),flags:Un(s,20)})}),e}function IJn(t){const e=t.subarray(8),n=e.subarray(86),r=jg(e.subarray(4,8));let s=r,i;const o=r==="enca"||r==="encv";if(o){const d=Gr(e,[r])[0].subarray(r==="enca"?28:78);Gr(d,["sinf"]).forEach(h=>{const m=Gr(h,["schm"])[0];if(m){const f=jg(m.subarray(4,8));if(f==="cbcs"||f==="cenc"){const p=Gr(h,["frma"])[0];p&&(s=jg(p))}}})}const l=s;switch(s){case"avc1":case"avc2":case"avc3":case"avc4":{const c=Gr(n,["avcC"])[0];c&&c.length>3&&(s+="."+hV(c[1])+hV(c[2])+hV(c[3]),i=uV(l==="avc1"?"dva1":"dvav",n));break}case"mp4a":{const c=Gr(e,[r])[0],d=Gr(c.subarray(28),["esds"])[0];if(d&&d.length>7){let u=4;if(d[u++]!==3)break;u=fde(d,u),u+=2;const h=d[u++];if(h&128&&(u+=2),h&64&&(u+=d[u++]),d[u++]!==4)break;u=fde(d,u);const m=d[u++];if(m===64)s+="."+hV(m);else break;if(u+=12,d[u++]!==5)break;u=fde(d,u);const f=d[u++];let p=(f&248)>>3;p===31&&(p+=1+((f&7)<<3)+((d[u]&224)>>5)),s+="."+p}break}case"hvc1":case"hev1":{const c=Gr(n,["hvcC"])[0];if(c&&c.length>12){const d=c[1],u=["","A","B","C"][d>>6],h=d&31,m=Un(c,2),f=(d&32)>>5?"H":"L",p=c[12],g=c.subarray(6,12);s+="."+u+h,s+="."+MJn(m).toString(16).toUpperCase(),s+="."+f+p;let v="";for(let b=g.length;b--;){const x=g[b];(x||v)&&(v="."+x.toString(16).toUpperCase()+v)}s+=v}i=uV(l=="hev1"?"dvhe":"dvh1",n);break}case"dvh1":case"dvhe":case"dvav":case"dva1":case"dav1":{s=uV(s,n)||s;break}case"vp09":{const c=Gr(n,["vpcC"])[0];if(c&&c.length>6){const d=c[4],u=c[5],h=c[6]>>4&15;s+="."+Iv(d)+"."+Iv(u)+"."+Iv(h)}break}case"av01":{const c=Gr(n,["av1C"])[0];if(c&&c.length>2){const d=c[1]>>>5,u=c[1]&31,h=c[2]>>>7?"H":"M",m=(c[2]&64)>>6,f=(c[2]&32)>>5,p=d===2&&m?f?12:10:m?10:8,g=(c[2]&16)>>4,v=(c[2]&8)>>3,b=(c[2]&4)>>2,x=c[2]&3;s+="."+d+"."+Iv(u)+h+"."+Iv(p)+"."+g+"."+v+b+x+"."+Iv(1)+"."+Iv(1)+"."+Iv(1)+"."+0,i=uV("dav1",n)}break}}return{codec:s,encrypted:o,supplemental:i}}function uV(t,e){const n=Gr(e,["dvvC"]),r=n.length?n[0]:Gr(e,["dvcC"])[0];if(r){const s=r[2]>>1&127,i=r[2]<<5&32|r[3]>>3&31;return t+"."+Iv(s)+"."+Iv(i)}}function MJn(t){let e=0;for(let n=0;n<32;n++)e|=(t>>n&1)<<31-n;return e>>>0}function fde(t,e){const n=e+5;for(;t[e++]&128&&e<n;);return e}function hV(t){return("0"+t.toString(16).toUpperCase()).slice(-2)}function Iv(t){return(t<10?"0":"")+t}function LJn(t,e){if(!t||!e)return;const n=e.keyId;(n==null?void 0:n.byteLength)===16&&e.isCommonEncryption&&pkt(t,(r,s)=>{const i=r.subarray(8,24);i.some(o=>o!==0)||(hi.log(`[eme] Patching keyId in 'enc${s?"a":"v"}>sinf>>tenc' box: ${Gl(i)} -> ${Gl(n)}`),r.set(n,8))})}function DJn(t){const e=[];return pkt(t,n=>e.push(n.subarray(8,24))),e}function pkt(t,e){Gr(t,["moov","trak"]).forEach(r=>{const s=Gr(r,["mdia","minf","stbl","stsd"])[0];if(!s)return;const i=s.subarray(8);let o=Gr(i,["enca"]);const l=o.length>0;l||(o=Gr(i,["encv"])),o.forEach(c=>{const d=l?c.subarray(28):c.subarray(78);Gr(d,["sinf"]).forEach(h=>{const m=gkt(h);m&&e(m,l)})})})}function gkt(t){const e=Gr(t,["schm"])[0];if(e){const n=jg(e.subarray(4,8));if(n==="cbcs"||n==="cenc"){const r=Gr(t,["schi","tenc"])[0];if(r)return r}}}let Z9e;function $Jn(t){return typeof TextDecoder>"u"?Sm(t):(Z9e||(Z9e=new TextDecoder("utf-8"))).decode(t).replace(/\0/g,"")}function OJn(t){const e=t.byteLength,n=[];for(let r=0;r<e;){const s=r+8<=e,i=r+4<=e?t[r]*16777216+(t[r+1]<<16|t[r+2]<<8|t[r+3]):Un(t,r),o=i>1?r+i:e;if(s&&t[r+4]===109&&t[r+5]===111&&t[r+6]===111&&t[r+7]===102){const l=Math.min(o,e);for(let c=r+8;c<l;){const d=c+8<=l,u=c+4<=l?t[c]*16777216+(t[c+1]<<16|t[c+2]<<8|t[c+3]):Un(t,c),h=u>1?c+u:l;if(d&&t[c+4]===116&&t[c+5]===114&&t[c+6]===97&&t[c+7]===102){const m=Math.min(h,l);let f,p;const g=[];for(let v=c+8;v<m;){const b=v+8<=m,x=v+4<=m?t[v]*16777216+(t[v+1]<<16|t[v+2]<<8|t[v+3]):Un(t,v),w=x>1?v+x:m;if(b&&t[v+4]===116){const k=Math.min(w,m);t[v+5]===102&&t[v+6]===104&&t[v+7]===100?p||(p=t.subarray(v+8,k)):t[v+5]===102&&t[v+6]===100&&t[v+7]===116?f||(f=t.subarray(v+8,k)):t[v+5]===114&&t[v+6]===117&&t[v+7]===110&&g.push(t.subarray(v+8,k))}v=w}n.push({moofOffset:t.byteOffset+r,tfdt:f,tfhd:p,truns:g})}c=h}}r=o}return n}function FJn(t,e,n,r,s=!0){return vkt(t,e,r,s)}function BJn(t,e,n,r,s=!1){const i=[],o=e.samples,l=vkt(o,n,r,s,{isHEVCFlavor:VB(e.codec),samples:i,timeOffset:t,timescale:e.timescale,trackId:e.id});return{samples:i,sampleData:{includeSampleDetails:s,tracks:l}}}function vkt(t,e,n,r,s){const i={};let o=!1;const l=OJn(t),c=t.byteLength;for(let h=0;h<l.length;h++){const{moofOffset:m,tfdt:f,tfhd:p,truns:g}=l[h],v=Un(p,4),b=e[v];if(!b)continue;const x=i[v]||(i[v]={start:NaN,duration:0,sampleCount:0,trun:[],timescale:b.timescale,type:b.type});let w;if(f){const I=f[0];w=Un(f,4),I===1&&(w===Rv?n.warn("[mp4-demuxer]: Ignoring assumed invalid signed 64-bit track fragment decode time"):(w*=Rv+1,w+=Un(f,8))),xn(w)&&(!xn(x.start)||w<x.start)&&(x.start=w),s&&xn(w)&&(s.timeOffset=w/s.timescale)}const k=(s==null?void 0:s.trackId)===v&&b.type===na.VIDEO,S=b.default,C=Un(p,0)&16777215;let j=(S==null?void 0:S.duration)||0,E,N=(S==null?void 0:S.sampleSize)||0,A=8;C&1&&(A+=8),C&2&&(A+=4),C&8&&(j=Un(p,A),E=p.byteOffset-t.byteOffset+A,A+=4),C&16&&(N=Un(p,A));let _=0;const T=(C&1)!==0,R=!T&&(C&131072)!==0;T?(_=Un(p,8),_*=Math.pow(2,32),_+=Un(p,12)):R&&(_=m);let O=w||0,F=0,D=j;for(let I=0;I<g.length;I++){const P=g[I],M=Un(P,4),z=x.sampleCount;x.sampleCount+=M;const G=P[3]&1;let B=0;const H=P[3]&4,W=P[2]&1,V=P[2]&2,U=P[2]&4,ne=P[2]&8;let te=8;G&&(B=exe(P,te),te+=4),H&&(!(P[te+1]&1)&&x.keyFrameIndex===void 0&&(x.keyFrameIndex=z),te+=4);let re=_+B;if(!r&&P[1]===0&&P[2]===6&&P[3]===1){var d,u;const Y=O,X=re,Q=te;let ie=-1,he=0,ye=0,J=(d=s==null?void 0:s.timeOffset)!=null?d:0;const K=j/((u=s==null?void 0:s.timescale)!=null?u:1),ce=(s==null?void 0:s.isHEVCFlavor)===!0,pe=ce?2:1;for(let Me=0;Me<M;Me++){const we=P[te]===0?P[te+1]<<16|P[te+2]<<8|P[te+3]:Un(P,te),Be=ie===-1&&x.keyFrameIndex===void 0&&(P[te+5]&1)===0;te+=8;const Ve=re+we;if(k){if(we>0){let be=re;do{const Ze=t[be]===0?t[be+1]<<16|t[be+2]<<8|t[be+3]:Un(t,be);be+=4;const Pe=t[be],Ke=ce?Pe>>1&63:Pe&31;(ce?Ke===39||Ke===40:Ke===6)&&O6(t.subarray(be,be+Ze),pe,J,s.samples),be+=Ze}while(be<Ve)}J+=K}re=Ve,Be&&(ie=Me,he=re)}if(re<=c)ye=M;else{let Me=X,we=Q;for(let Be=0;Be<M;Be++){const Ve=P[we]===0?P[we+1]<<16|P[we+2]<<8|P[we+3]:Un(P,we);if(Me+=Ve,Me>c)break;ye=Be+1,we+=8}}if(k&&(s.timeOffset=J),ie!==-1&&he<=c&&x.keyFrameIndex===void 0&&(x.keyFrameIndex=ie,x.keyFrameStart=Y+ie*j),ye){(!xn(x.ptsMin)||Y<x.ptsMin)&&(x.ptsMin=Y);const Me=Y+ye*j;(!xn(x.ptsMax)||Me>x.ptsMax)&&(x.ptsMax=Me)}const Ie=j*M;O=Y+Ie,F+=Ie;continue}let fe,le;r&&(fe=[],le={sampleOffset:re,samples:fe,defaultSampleDurationOffset:E},re<=c&&x.trun.push(le));let q;for(let Y=0;Y<M;Y++){let X;W?(r&&(X=P.byteOffset-t.byteOffset+te),D=Un(P,te),te+=4):D=j,V?(q=Un(P,te),te+=4):q=N;let Q,ie;U&&(ie=P[te+1]&1?1:0,r&&(Q={isNonSync:ie,dependsOn:(P[te]&3)===1?1:2}),te+=4);let he=0;if(ne&&(he=P[0]===0?Un(P,te):exe(P,te),te+=4),k){let ye=re,J=0;for(;J<q;){const K=Un(t,ye);ye+=4,ykt(s.isHEVCFlavor,t[ye])&&O6(t.subarray(ye,ye+K),s.isHEVCFlavor?2:1,s.timeOffset+he/s.timescale,s.samples),ye+=K,J+=K+4}s.timeOffset+=D/s.timescale}if(re+=q,re<=c){le&&X!==void 0&&(le.lastSampleDurationOffset=X),ie===0&&x.keyFrameIndex===void 0&&(x.keyFrameIndex=Y,x.keyFrameStart=O);const ye=O+he;(!xn(x.ptsMin)||ye<x.ptsMin)&&(x.ptsMin=ye),(!xn(x.ptsMax)||ye+D>x.ptsMax)&&(x.ptsMax=ye+D),fe&&(fe[Y]={cts:he,duration:D,flags:Q,size:q})}O+=D,F+=D}!F&&j&&(F+=j*M)}x.duration+=F,x.duration&&(o=!0)}if(!o){let h=1/0,m=0;const f=Gr(t,["sidx"]);for(let p=0;p<f.length;p++){const g=RJn(f[p]);if(g!=null&&g.references){h=Math.min(h,g.earliestPresentationTime/g.timescale);const v=g.references.reduce((b,x)=>b+x.info.duration||0,0);m=Math.max(m,v+g.earliestPresentationTime/g.timescale)}}m&&xn(m)&&Object.keys(i).forEach(p=>{i[p].duration||(i[p].duration=m*i[p].timescale-i[p].start)})}return i}function UJn(t){const e={valid:null,remainder:null},n=Gr(t,["moof"]);if(n.length<2)return e.remainder=t,e;const r=n[n.length-1];return e.valid=t.slice(0,r.byteOffset-8),e.remainder=t.slice(r.byteOffset-8),e}function Wf(t,e){const n=new Uint8Array(t.length+e.length);return n.set(t),n.set(e,t.length),n}function zJn(t,e){const n=[],r=e.samples,s=e.timescale,i=e.id;let o=!1;return Gr(r,["moof"]).map(c=>{const d=c.byteOffset-8;Gr(c,["traf"]).map(h=>{const m=Gr(h,["tfdt"]).map(f=>{const p=f[0];let g=Un(f,4);return p===1&&(g*=Math.pow(2,32),g+=Un(f,8)),g/s})[0];return m!==void 0&&(t=m),Gr(h,["tfhd"]).map(f=>{const p=Un(f,4),g=Un(f,0)&16777215,v=(g&1)!==0;let b=0;const x=(g&2)!==0,w=(g&8)!==0;let k=0;const S=(g&16)!==0;let C=0;const j=(g&32)!==0,E=!v&&(g&131072)!==0;let N=8;p===i&&(v?(b=Un(f,N),N+=4,b*=Math.pow(2,32),b+=Un(f,N),N+=4):E&&(b=d),x&&(N+=4),w&&(k=Un(f,N),N+=4),S&&(C=Un(f,N),N+=4),j&&(N+=4),e.type==="video"&&(o=VB(e.codec)),Gr(h,["trun"]).map(A=>{const _=A[0],T=Un(A,0)&16777215,R=(T&1)!==0;let O=0;const F=(T&4)!==0,D=(T&256)!==0;let I=0;const P=(T&512)!==0;let M=0;const z=(T&1024)!==0,G=(T&2048)!==0;let B=0;const H=Un(A,4);let W=8;R&&(O=Un(A,W),W+=4),F&&(W+=4);let V=b+O;for(let U=0;U<H;U++){if(D?(I=Un(A,W),W+=4):I=k,P?(M=Un(A,W),W+=4):M=C,z&&(W+=4),G&&(_===0?B=Un(A,W):B=exe(A,W),W+=4),e.type===na.VIDEO){let ne=0;for(;ne<M;){const te=Un(r,V);if(V+=4,ykt(o,r[V])){const re=r.subarray(V,V+te);O6(re,o?2:1,t+B/s,n)}V+=te,ne+=te+4}}t+=I/s}}))})})}),n}function VB(t){if(!t)return!1;const e=t.substring(0,4);return e==="hvc1"||e==="hev1"||e==="dvh1"||e==="dvhe"}function ykt(t,e){if(t){const n=e>>1&63;return n===39||n===40}else return(e&31)===6}function O6(t,e,n,r){const s=bkt(t);let i=0;i+=e;let o=0,l=0,c=0;for(;i<s.length;){o=0;do{if(i>=s.length)break;c=s[i++],o+=c}while(c===255);l=0;do{if(i>=s.length)break;c=s[i++],l+=c}while(c===255);const d=s.length-i;let u=i;if(l<d)i+=l;else if(l>d){hi.error(`Malformed SEI payload. ${l} is too small, only ${d} bytes left to parse.`);break}if(o===4){if(s[u++]===181){const m=ukt(s,u);if(u+=2,m===49){const f=Un(s,u);if(u+=4,f===1195456820){const p=s[u++];if(p===3){const g=s[u++],v=31&g,b=64&g,x=b?2+v*3:0,w=new Uint8Array(x);if(b){w[0]=g;for(let k=1;k<x;k++)w[k]=s[u++]}r.push({type:p,payloadType:o,pts:n,bytes:w})}}}}}else if(o===5&&l>16){const h=[];for(let p=0;p<16;p++){const g=s[u++].toString(16);h.push(g.length==1?"0"+g:g),(p===3||p===5||p===7||p===9)&&h.push("-")}const m=l-16,f=new Uint8Array(m);for(let p=0;p<m;p++)f[p]=s[u++];r.push({payloadType:o,pts:n,uuid:h.join(""),userData:$Jn(f),userDataBytes:f})}}}function bkt(t){const e=t.byteLength;let n,r=t.indexOf(3,3);for(;r!==-1;)t[r-1]===0&&t[r-2]===0&&(n||(n=[])).push(r),r=t.indexOf(3,r+1);if(!n)return t;const s=e-n.length,i=new Uint8Array(s);let o=0,l=0;for(let c=0;c<s;l++,c++)l===n[o]&&(l++,o++),i[c]=t[l];return i}function VJn(t){const e=t[0];let n="",r="",s=0,i=0,o,l=0,c=0,d=4;if(e===0){const h=dV(t,d),m=h!==null?dV(t,d+h.length):null;h!==null&&m!==null?(n=h,r=m,d+=h.length+m.length,s=Un(t,d),d+=4,i=Un(t,d),d+=4,l=Un(t,d),d+=4,c=Un(t,d),d+=4):(hi.warn(`Unterminated ${h===null?"scheme_id_uri":"value"} in parsing emsg box: version 0 box ends inside a string, dropping all of its fields`),d=t.length)}else if(e===1){s=Un(t,d),d+=4;const h=Un(t,d);d+=4;const m=Un(t,d);d+=4,o=2**32*h+m,YZn(o)||(o=Number.MAX_SAFE_INTEGER,hi.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),l=Un(t,d),d+=4,c=Un(t,d),d+=4;const f=dV(t,d),p=f!==null?dV(t,d+f.length):null;f!==null&&(n=f,d+=f.length),p!==null?(r=p,d+=p.length):(hi.warn(`Unterminated ${f===null?"scheme_id_uri":"value"} in parsing emsg box: version 1 box ends inside a string, dropping its ${f===null?"strings and payload":"value and payload"}`),d=t.length)}const u=t.subarray(d,t.byteLength);return{schemeIdUri:n,value:r,timeScale:s,presentationTime:o,presentationTimeDelta:i,eventDuration:l,id:c,payload:u}}function HJn(t,...e){const n=e.length;let r=8,s=n;for(;s--;)r+=e[s].byteLength;const i=new Uint8Array(r);for(i[0]=r>>24&255,i[1]=r>>16&255,i[2]=r>>8&255,i[3]=r&255,i.set(t,4),s=0,r=8;s<n;s++)i.set(e[s],r),r+=e[s].byteLength;return i}function GJn(t,e,n){if(t.byteLength!==16)throw new RangeError("Invalid system id");let r,s;r=0,s=new Uint8Array;let i;r>0?(i=new Uint8Array(4),e.length>0&&new DataView(i.buffer).setUint32(0,e.length,!1)):i=new Uint8Array;const o=new Uint8Array(4);return n.byteLength>0&&new DataView(o.buffer).setUint32(0,n.byteLength,!1),HJn([112,115,115,104],new Uint8Array([r,0,0,0]),t,i,s,o,n)}function xkt(t){const e=[];if(t instanceof ArrayBuffer){const n=t.byteLength;let r=0;for(;r+32<n;){const s=new DataView(t,r),i=qJn(s);e.push(i),r+=i.size}}return e}function WJn(t){const e=[];for(let n=0;n<t.length;){const r=t[n++],s=r&7;if(s===0){for(;t[n++]&128;);continue}if(s!==2){n+=s===1?8:4;continue}let i=0;for(let o=0,l=128;l&128;o+=7)i|=((l=t[n++])&127)<<o;if(r>>3===2)if(i===32){const o=new Uint8Array(16);for(let l=0;l<16;l++)o[l]=parseInt(String.fromCharCode(t[n+l*2],t[n+l*2+1]),16);e.push(o)}else i===16&&e.push(t.subarray(n,n+16));n+=i}return e}function qJn(t){const e=t.getUint32(0),n=t.byteOffset,r=t.byteLength;if(r<e)return{offset:n,size:r};if(t.getUint32(4)!==1886614376)return{offset:n,size:e};const i=t.getUint32(8)>>>24;if(i!==0&&i!==1)return{offset:n,size:e};const o=t.buffer,l=Gl(new Uint8Array(o,n+12,16));let c=null,d=null,u=0;if(i===0)u=28;else{const m=t.getUint32(28);if(!m||r<32+m*16)return{offset:n,size:e};c=[];for(let f=0;f<m;f++)c.push(new Uint8Array(o,n+32+f*16,16));u=32+m*16}if(!u)return{offset:n,size:e};const h=t.getUint32(u);return e-32<h?{offset:n,size:e}:(d=new Uint8Array(o,n+u+4,h),i===0&&(c=WJn(d)),{version:i,systemId:l,kids:c,data:d,offset:n,size:e})}const kM=wkt("userAgent"),KJn=wkt("vendor");let pde,gde,vde;function wkt(t){try{return navigator[t]||""}catch{}return""}function YJn(){if(vde===void 0){const t=kM.match(/Safari\/(\d+)/i);vde=t?parseInt(t[1]):0}return vde}function v$(){if(pde===void 0){const t=kM.match(/Chrome\/(\d+)/i);pde=t?parseInt(t[1]):0}return pde}function QJn(){if(gde===void 0){const t=kM.match(/Firefox\/(\d+)/i);gde=t?parseInt(t[1]):0}return gde}function kkt(){return/\(Windows.+Firefox\//i.test(kM)}function ZJn(){return KJn.indexOf("Apple")>-1||/iPhone|iPad|iPod/.test(kM)}function JJn(){return/Android/.test(kM)}const BR={audio:{a3ds:1,"ac-3":.95,"ac-4":1,alac:.9,alaw:1,dra1:1,"dts+":1,"dts-":1,dtsc:1,dtse:1,dtsh:1,"ec-3":.9,enca:1,fLaC:.9,flac:.9,FLAC:.9,g719:1,g726:1,m4ae:1,mha1:1,mha2:1,mhm1:1,mhm2:1,mlpa:1,mp4a:1,"raw ":1,Opus:1,opus:1,samr:1,sawb:1,sawp:1,sevc:1,sqcp:1,ssmv:1,twos:1,ulaw:1},video:{avc1:1,avc2:1,avc3:1,avc4:1,avcp:1,av01:.8,dav1:.8,drac:1,dva1:1,dvav:1,dvh1:.7,dvhe:.7,encv:1,hev1:.75,hvc1:.75,mjp2:1,mp4v:1,mvc1:1,mvc2:1,mvc3:1,mvc4:1,resv:1,rv60:1,s263:1,svc1:1,svc2:1,"vc-1":1,vp08:1,vp09:.9},text:{stpp:1,wvtt:1},image:{mjpg:1}};function l_e(t,e){const n=BR[e];return!!n&&!!n[t.slice(0,4)]}function F6(t,e,n=!0){return!t.split(",").some(r=>!c_e(r,e,n))}function c_e(t,e,n=!0){var r;const s=Bk(n);return(r=s==null?void 0:s.isTypeSupported(B6(t,e)))!=null?r:!1}function B6(t,e){return`${e}/mp4;codecs=${t}`}function J9e(t){if(t){const e=t.substring(0,4);return BR.video[e]}return 2}function nZ(t){const e=kkt();return t.split(",").reduce((n,r)=>{const i=e&&VB(r)?9:BR.video[r];return i?(i*2+n)/(n?3:2):(BR.audio[r]+n)/(n?2:1)},0)}const yde={};function XJn(t,e=!0){if(yde[t])return yde[t];const n={flac:["flac","fLaC","FLAC"],opus:["opus","Opus"],"mp4a.40.34":["mp3"]}[t];for(let s=0;s<n.length;s++){var r;if(c_e(n[s],"audio",e))return yde[t]=n[s],n[s];if(n[s]==="mp3"&&(r=Bk(e))!=null&&r.isTypeSupported("audio/mpeg"))return""}return t}const eXn=/flac|opus|mp4a\.40\.34/i;function rZ(t,e=!0){return t.replace(eXn,n=>XJn(n.toLowerCase(),e))}function tXn(t,e){const n=[];if(t){const r=t.split(",");for(let s=0;s<r.length;s++)l_e(r[s],"video")||n.push(r[s])}return e&&n.push(e),n.join(",")}function ZW(t,e){if(t&&(t.length>4||["ac-3","ec-3","alac","fLaC","Opus"].indexOf(t)!==-1)&&(X9e(t,"audio")||X9e(t,"video")))return t;if(e){const n=e.split(",");if(n.length>1){if(t){for(let r=n.length;r--;)if(n[r].substring(0,4)===t.substring(0,4))return n[r]}return n[0]}}return e||t}function X9e(t,e){return l_e(t,e)&&c_e(t,e)}function nXn(t){const e=t.split(",");for(let n=0;n<e.length;n++){const r=e[n].split(".");r.length>2&&r[0]==="avc1"&&(e[n]=`avc1.${parseInt(r[1]).toString(16)}${("000"+parseInt(r[2]).toString(16)).slice(-4)}`)}return e.join(",")}function rXn(t){if(t.startsWith("av01.")){const e=t.split("."),n=["0","111","01","01","01","0"];for(let r=e.length;r>4&&r<10;r++)e[r]=n[r-4];return e.join(".")}return t}function eUe(t){const e=Bk(t)||{isTypeSupported:()=>!1};return{mpeg:e.isTypeSupported("audio/mpeg"),mp3:e.isTypeSupported('audio/mp4; codecs="mp3"'),ac3:e.isTypeSupported('audio/mp4; codecs="ac-3"')}}function nxe(t){return t.replace(/^.+codecs=["']?([^"']+).*$/,"$1")}const sXn={supported:!0,powerEfficient:!0,smooth:!0},iXn={supported:!1,smooth:!1,powerEfficient:!1},Skt={supported:!0,configurations:[],decodingInfoResults:[sXn]};function Ckt(t,e){return{supported:!1,configurations:e,decodingInfoResults:[iXn],error:t}}function aXn(t,e,n,r,s,i){const o=t.videoCodec,l=t.audioCodec?t.audioGroups:null,c=i==null?void 0:i.audioCodec,d=i==null?void 0:i.channels,u=d?parseInt(d):c?1/0:2;let h=null;if(l!=null&&l.length)try{l.length===1&&l[0]?h=e.groups[l[0]].channels:h=l.reduce((m,f)=>{if(f){const p=e.groups[f];if(!p)throw new Error(`Audio track group ${f} not found`);Object.keys(p.channels).forEach(g=>{m[g]=(m[g]||0)+p.channels[g]})}return m},{2:0})}catch{return!0}return o!==void 0&&(o.split(",").some(m=>VB(m))||t.width>1920&&t.height>1088||t.height>1920&&t.width>1088||t.frameRate>Math.max(r,30)||t.videoRange!=="SDR"&&t.videoRange!==n||t.bitrate>Math.max(s,8e6))||!!h&&xn(u)&&Object.keys(h).some(m=>parseInt(m)>u)}function jkt(t,e,n,r={}){const s=t.videoCodec;if(!s&&!t.audioCodec||!n)return Promise.resolve(Skt);const i=[],o=oXn(t),l=o.length,c=lXn(t,e,l>0),d=c.length;for(let u=l||1*d||1;u--;){const h={type:"media-source"};if(l&&(h.video=o[u%l]),d){h.audio=c[u%d];const m=h.audio.bitrate;h.video&&m&&(h.video.bitrate-=m)}i.push(h)}if(s){const u=navigator.userAgent;if(s.split(",").some(h=>VB(h))&&kkt())return Promise.resolve(Ckt(new Error(`Overriding Windows Firefox HEVC MediaCapabilities result based on user-agent string: (${u})`),i))}return Promise.all(i.map(u=>{const h=cXn(u);return r[h]||(r[h]=n.decodingInfo(u))})).then(u=>({supported:!u.some(h=>!h.supported),configurations:i,decodingInfoResults:u})).catch(u=>({supported:!1,configurations:i,decodingInfoResults:[],error:u}))}function oXn(t){var e;const n=(e=t.videoCodec)==null?void 0:e.split(","),r=Nkt(t),s=t.width||640,i=t.height||480,o=t.frameRate||30,l=t.videoRange.toLowerCase();return n?n.map(c=>{const d={contentType:B6(rXn(c),"video"),width:s,height:i,bitrate:r,framerate:o};return l!=="sdr"&&(d.transferFunction=l),d}):[]}function lXn(t,e,n){var r;const s=(r=t.audioCodec)==null?void 0:r.split(","),i=Nkt(t);return s&&t.audioGroups?t.audioGroups.reduce((o,l)=>{var c;const d=l?(c=e.groups[l])==null?void 0:c.tracks:null;return d?d.reduce((u,h)=>{if(h.groupId===l){const m=parseFloat(h.channels||"");s.forEach(f=>{const p={contentType:B6(f,"audio"),bitrate:n?Ekt(f,i):i};m&&(p.channels=""+m),u.push(p)})}return u},o):o},[]):[]}function Ekt(t,e){if(e<=1)return 1;let n=128e3;return t==="ec-3"?n=768e3:t==="ac-3"&&(n=64e4),Math.min(e/2,n)}function Nkt(t){return Math.ceil(Math.max(t.bitrate*.9,t.averageBitrate)/1e3)*1e3||1}function cXn(t){let e="";const{audio:n,video:r}=t;if(r){const s=nxe(r.contentType);e+=`${s}_r${r.height}x${r.width}f${Math.ceil(r.framerate)}${r.transferFunction||"sd"}_${Math.ceil(r.bitrate/1e5)}`}if(n){const s=nxe(n.contentType);e+=`${r?"_":""}${s}_c${n.channels}`}return e}function sk(t,e,n){const r=encodeURIComponent(e),s=`${r}=${encodeURIComponent(n)}`;let i=!1;const o=[];t.search.substring(1).split("&").forEach(l=>{l===r||l.startsWith(r+"=")?i||(o.push(s),i=!0):l&&o.push(l)}),i||o.push(s),t.search=o.join("&")}const rxe=["NONE","TYPE-0","TYPE-1",null];function dXn(t){return rxe.indexOf(t)>-1}const sZ=["SDR","PQ","HLG"];function uXn(t){return!!t&&sZ.indexOf(t)>-1}var JW={No:"",Yes:"YES",v2:"v2"};function tUe(t){const{canSkipUntil:e,canSkipDateRanges:n,age:r}=t,s=r<e/2;return e&&s?n?JW.v2:JW.Yes:JW.No}class nUe{constructor(e,n,r){this.msn=void 0,this.part=void 0,this.skip=void 0,this.msn=e,this.part=n,this.skip=r}addDirectives(e){const n=new self.URL(e);return this.msn!==void 0&&sk(n,"_HLS_msn",this.msn.toString()),this.part!==void 0&&sk(n,"_HLS_part",this.part.toString()),this.skip&&sk(n,"_HLS_skip",this.skip),n.href}}class U6{constructor(e){if(this._attrs=void 0,this.audioCodec=void 0,this.bitrate=void 0,this.codecSet=void 0,this.url=void 0,this.frameRate=void 0,this.height=void 0,this.id=void 0,this.name=void 0,this.supplemental=void 0,this.videoCodec=void 0,this.width=void 0,this.imageCodec=void 0,this.iframes=void 0,this.details=void 0,this.fragmentError=0,this.loadError=0,this.loadErrorTime=0,this.loaded=void 0,this.realBitrate=0,this.supportedPromise=void 0,this.supportedResult=void 0,this._avgBitrate=0,this._audioGroups=void 0,this._subtitleGroups=void 0,this._urlId=0,this.url=[e.url],this._attrs=[e.attrs],this.bitrate=e.bitrate,e.details&&(this.details=e.details),this.id=e.id||0,this.name=e.name,this.width=e.width||0,this.height=e.height||0,this.frameRate=e.attrs.optionalFloat("FRAME-RATE",0),this._avgBitrate=e.attrs.decimalInteger("AVERAGE-BANDWIDTH"),this.audioCodec=e.audioCodec,this.videoCodec=e.videoCodec,"imageCodec"in e&&(this.imageCodec=e.imageCodec),this.codecSet=[e.videoCodec,e.audioCodec].filter(r=>!!r).map(r=>r.substring(0,4)).join(","),"supplemental"in e){var n;this.supplemental=e.supplemental;const r=(n=e.supplemental)==null?void 0:n.videoCodec;r&&r!==e.videoCodec&&(this.codecSet+=`,${r.substring(0,4)}`)}"iframes"in e&&e.iframes?this.iframes=!0:(this.addGroupId("audio",e.attrs.AUDIO),this.addGroupId("text",e.attrs.SUBTITLES))}get maxBitrate(){return Math.max(this.realBitrate,this.bitrate)}get averageBitrate(){return this._avgBitrate||this.realBitrate||this.bitrate}get attrs(){return this._attrs[0]}get codecs(){return this.attrs.CODECS||""}get pathwayId(){return this.attrs["PATHWAY-ID"]||"."}get videoRange(){return this.attrs["VIDEO-RANGE"]||"SDR"}get score(){return this.attrs.optionalFloat("SCORE",0)}get uri(){return this.url[0]||""}hasAudioGroup(e){return rUe(this._audioGroups,e)}hasSubtitleGroup(e){return rUe(this._subtitleGroups,e)}get audioGroups(){return this._audioGroups}get subtitleGroups(){return this._subtitleGroups}addGroupId(e,n){if(n){if(e==="audio"){let r=this._audioGroups;r||(r=this._audioGroups=[]),r.indexOf(n)===-1&&r.push(n)}else if(e==="text"){let r=this._subtitleGroups;r||(r=this._subtitleGroups=[]),r.indexOf(n)===-1&&r.push(n)}}}get urlId(){return 0}set urlId(e){}get audioGroupIds(){return this.audioGroups?[this.audioGroupId]:void 0}get textGroupIds(){return this.subtitleGroups?[this.textGroupId]:void 0}get audioGroupId(){var e;return(e=this.audioGroups)==null?void 0:e[0]}get textGroupId(){var e;return(e=this.subtitleGroups)==null?void 0:e[0]}addFallback(){}}function rUe(t,e){return!e||!t?!1:t.indexOf(e)!==-1}function hXn(){if(typeof matchMedia=="function"){const t=matchMedia("(dynamic-range: high)"),e=matchMedia("bad query");if(t.media!==e.media)return t.matches===!0}return!1}function mXn(t,e){let n=!1,r=[];if(t&&(n=t!=="SDR",r=[t]),e){r=e.allowedVideoRanges||sZ.slice(0);const s=r.join("")!=="SDR"&&!e.videoCodec;n=e.preferHDR!==void 0?e.preferHDR:s&&hXn(),n||(r=["SDR"])}return{preferHDR:n,allowedVideoRanges:r}}const fXn=t=>{const e=new WeakSet;return(n,r)=>{if(t&&(r=t(n,r)),typeof r=="object"&&r!==null){if(e.has(r))return;e.add(r)}return r}},ya=(t,e)=>JSON.stringify(t,fXn(e));function pXn(t,e,n,r,s){const i=Object.keys(t),o=r==null?void 0:r.channels,l=r==null?void 0:r.audioCodec,c=s==null?void 0:s.videoCodec,d=o&&parseInt(o)===2;let u=!1,h=!1,m=1/0,f=1/0,p=1/0,g=1/0,v=0,b=[];const{preferHDR:x,allowedVideoRanges:w}=mXn(e,s);for(let E=i.length;E--;){const N=t[i[E]];u||(u=N.channels[2]>0),m=Math.min(m,N.minHeight),f=Math.min(f,N.minFramerate),p=Math.min(p,N.minBitrate),w.filter(_=>N.videoRanges[_]>0).length>0&&(h=!0)}m=xn(m)?m:0,f=xn(f)?f:0;const k=Math.max(1080,m),S=Math.max(30,f);p=xn(p)?p:n,n=Math.max(p,n),h||(e=void 0);const C=i.length>1;return{codecSet:i.reduce((E,N)=>{const A=t[N];if(N===E)return E;if(b=h?w.filter(_=>A.videoRanges[_]>0):[],C){if(A.minBitrate>n)return fv(N,`min bitrate of ${A.minBitrate} > current estimate of ${n}`),E;if(!A.hasDefaultAudio)return fv(N,"no renditions with default or auto-select sound found"),E;if(l&&N.indexOf(l.substring(0,4))%5!==0)return fv(N,`audio codec preference "${l}" not found`),E;if(o&&!d){if(!A.channels[o])return fv(N,`no renditions with ${o} channel sound found (channels options: ${Object.keys(A.channels)})`),E}else if((!l||d)&&u&&A.channels[2]===0)return fv(N,"no renditions with stereo sound found"),E;if(A.minHeight>k)return fv(N,`min resolution of ${A.minHeight} > maximum of ${k}`),E;if(A.minFramerate>S)return fv(N,`min framerate of ${A.minFramerate} > maximum of ${S}`),E;if(!b.some(_=>A.videoRanges[_]>0))return fv(N,`no variants with VIDEO-RANGE of ${ya(b)} found`),E;if(c&&N.indexOf(c.substring(0,4))%5!==0)return fv(N,`video codec preference "${c}" not found`),E;if(A.maxScore<v)return fv(N,`max score of ${A.maxScore} < selected max of ${v}`),E}return E&&(nZ(N)>=nZ(E)||A.fragmentError>t[E].fragmentError)?E:(g=A.minIndex,v=A.maxScore,N)},void 0),videoRanges:b,preferHDR:x,minFramerate:f,minBitrate:p,minIndex:g}}function fv(t,e){hi.log(`[abr] start candidates with "${t}" ignored because ${e}`)}function Tkt(t){return t.reduce((e,n)=>{let r=e.groups[n.groupId];r||(r=e.groups[n.groupId]={tracks:[],channels:{2:0},hasDefault:!1,hasAutoSelect:!1}),r.tracks.push(n);const s=n.channels||"2";return r.channels[s]=(r.channels[s]||0)+1,r.hasDefault=r.hasDefault||n.default,r.hasAutoSelect=r.hasAutoSelect||n.autoselect,r.hasDefault&&(e.hasDefaultAudio=!0),r.hasAutoSelect&&(e.hasAutoSelectAudio=!0),e},{hasDefaultAudio:!1,hasAutoSelectAudio:!1,groups:{}})}function gXn(t,e,n,r){return t.slice(n,r+1).reduce((s,i,o)=>{if(!i.codecSet)return s;const l=i.audioGroups;let c=s[i.codecSet];c||(s[i.codecSet]=c={minBitrate:1/0,minHeight:1/0,minFramerate:1/0,minIndex:o,maxScore:0,videoRanges:{SDR:0},channels:{2:0},hasDefaultAudio:!l,fragmentError:0}),c.minBitrate=Math.min(c.minBitrate,i.bitrate);const d=Math.min(i.height,i.width);return c.minHeight=Math.min(c.minHeight,d),c.minFramerate=Math.min(c.minFramerate,i.frameRate),c.minIndex=Math.min(c.minIndex,o),c.maxScore=Math.max(c.maxScore,i.score),c.fragmentError+=i.fragmentError,c.videoRanges[i.videoRange]=(c.videoRanges[i.videoRange]||0)+1,l&&l.forEach(u=>{if(!u)return;const h=e.groups[u];h&&(c.hasDefaultAudio=c.hasDefaultAudio||e.hasDefaultAudio?h.hasDefault:h.hasAutoSelect||!e.hasDefaultAudio&&!e.hasAutoSelectAudio,Object.keys(h.channels).forEach(m=>{c.channels[m]=(c.channels[m]||0)+h.channels[m]}))}),s},{})}function sUe(t){if(!t)return t;const{lang:e,assocLang:n,characteristics:r,channels:s,audioCodec:i}=t;return{lang:e,assocLang:n,characteristics:r,channels:s,audioCodec:i}}function ry(t,e,n){if("attrs"in t){const r=e.indexOf(t);if(r!==-1)return r}for(let r=0;r<e.length;r++){const s=e[r];if(Xj(t,s,n))return r}return-1}function Xj(t,e,n){const{groupId:r,name:s,lang:i,assocLang:o,default:l}=t,c=t.forced;return(r===void 0||e.groupId===r)&&(s===void 0||e.name===s)&&(i===void 0||vXn(i,e.lang))&&(o===void 0||e.assocLang===o)&&(l===void 0||e.default===l)&&(c===void 0||e.forced===c)&&(!("characteristics"in t)||yXn(t.characteristics||"",e.characteristics))&&(n===void 0||n(t,e))}function vXn(t,e="--"){return t.length===e.length?t===e:t.startsWith(e)||e.startsWith(t)}function yXn(t,e=""){const n=t.split(","),r=e.split(",");return n.length===r.length&&!n.some(s=>r.indexOf(s)===-1)}function zC(t,e){const{audioCodec:n,channels:r}=t;return(n===void 0||(e.audioCodec||"").substring(0,4)===n.substring(0,4))&&(r===void 0||r===(e.channels||"2"))}function bXn(t,e,n,r,s){const i=e[r],l=e.reduce((m,f,p)=>{const g=f.uri;return(m[g]||(m[g]=[])).push(p),m},{})[i.uri];l.length>1&&(r=Math.max.apply(Math,l));const c=i.videoRange,d=i.frameRate,u=i.codecSet.substring(0,4),h=iUe(e,r,m=>{if(m.videoRange!==c||m.frameRate!==d||m.codecSet.substring(0,4)!==u)return!1;const f=m.audioGroups,p=n.filter(g=>z6(g.groupId,f));return ry(t,p,s)>-1});return h>-1?h:iUe(e,r,m=>{const f=m.audioGroups,p=n.filter(g=>z6(g.groupId,f));return ry(t,p,s)>-1})}function iUe(t,e,n){for(let r=e;r>-1;r--)if(n(t[r]))return r;for(let r=e+1;r<t.length;r++)if(n(t[r]))return r;return-1}function iZ(t,e){var n;return!!t&&t!==((n=e.loadLevelObj)==null?void 0:n.uri)}function z6(t,e){return e?e.indexOf(t)!==-1:!0}function _kt(t,e){if(e||t){const n=Mi({},e);return t&&(t.videoCodec&&(n.videoCodec=t.videoCodec),t.videoRange&&(n.allowedVideoRanges=[t.videoRange])),n}}class xXn extends Fm{constructor(e){super("abr",e.logger),this.hls=void 0,this.lastLevelLoadSec=0,this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.firstAutoFloor=-1,this._nextAutoLevel=-1,this.nextAutoLevelKey="",this.audioTracksByGroup=null,this.codecTiers=null,this.timer=-1,this.fragCurrent=null,this.partCurrent=null,this.bitrateTestDelay=0,this.rebufferNotice=-1,this.supportedCache={},this.bwEstimator=void 0,this._abandonRulesCheck=n=>{var r;const{fragCurrent:s,partCurrent:i,hls:o}=this;if(!o)return;const{autoLevelEnabled:l,media:c}=o;if(!s||!c)return;const d=performance.now(),u=i?i.stats:s.stats,h=i?i.duration:s.duration,m=d-u.loading.start,f=o.minAutoLevel,p=s.level,g=this._nextAutoLevel;if(u.aborted||u.loaded&&u.loaded===u.total||p<=f){this.clearTimer(),this._nextAutoLevel=-1;return}if(!l)return;const v=g>-1&&g!==p,b=!!n||v;if(!b&&(c.paused||!c.playbackRate||!c.readyState))return;const x=o.mainForwardBufferInfo;if(!b&&x===null)return;const w=this.bwEstimator.getEstimateTTFB(),k=Math.abs(c.playbackRate);if(m<=Math.max(w,1e3*(h/(k*2))))return;const S=x?x.len/k:0,C=u.loading.first?u.loading.first-u.loading.start:-1,j=u.loaded&&C>-1,E=this.getBwEstimate(),N=o.levels,A=N[p],_=Math.max(u.loaded,Math.round(h*(s.bitrate||A.averageBitrate)/8));let T=j?m-C:m;T<1&&j&&(T=Math.min(m,u.loaded*8/E));const R=j?u.loaded*1e3/T:0,O=w/1e3,F=R?(_-u.loaded)/R:_*8/E+O;if(F<=S)return;const D=R?R*8:E,I=((r=(n==null?void 0:n.details)||o.latestLevelDetails)==null?void 0:r.live)===!0,P=o.config.abrBandWidthUpFactor;let M=Number.POSITIVE_INFINITY,z;for(z=p-1;z>f;z--){const W=N[z].maxBitrate,V=!N[z].details||I;if(M=this.getTimeToLoadFrag(O,D,h*W,V),M<Math.min(S,h+O))break}if(M>=F||M>h*10)return;j?this.bwEstimator.sample(m-Math.min(w,C),u.loaded):this.bwEstimator.sampleTTFB(m);const G=N[z].maxBitrate;this.getBwEstimate()*P>G&&(this.firstAutoFloor=Math.min(z,o.firstLevel),this.resetEstimator(G));const B=this.findBestLevel(G,f,z,0,S,1,1);B>-1&&(z=B),this.warn(`Fragment ${s.sn}${i?" part "+i.index:""} of level ${p} is loading too slowly;
      Fragment duration: ${s.duration.toFixed(3)}
      Time to underbuffer: ${S.toFixed(3)} s
      Estimated load time for current fragment: ${F.toFixed(3)} s
      Estimated load time for down switch fragment: ${M.toFixed(3)} s
      TTFB estimate: ${C|0} ms
      Current BW estimate: ${xn(E)?E|0:"Unknown"} bps
      New BW estimate: ${this.getBwEstimate()|0} bps
      Switching to level ${z} @ ${G|0} bps`),o.nextLoadLevel=o.nextAutoLevel=z,this.clearTimer();const H=()=>{this.clearTimer();const W=this.hls;if(this.fragCurrent===s&&W.loadLevel===z&&z>0){const V=this.getStarvationDelay();if(this.warn(`Aborting inflight request ${z>0?"and switching down":""}
      Fragment duration: ${s.duration.toFixed(3)} s
      Time to underbuffer: ${V.toFixed(3)} s`),s.abortRequests(),this.fragCurrent=this.partCurrent=null,z>f){let U=this.findBestLevel(W.levels[f].bitrate,f,z,0,V,1,1);U===-1&&(U=f),W.nextLoadLevel=W.nextAutoLevel=U,this.firstAutoFloor=Math.min(U,W.firstLevel),this.resetEstimator(W.levels[U].bitrate)}}};v||F>M*2?H():this.timer=self.setInterval(H,M*1e3),o.trigger(oe.FRAG_LOAD_EMERGENCY_ABORTED,{frag:s,part:i,stats:u})},this.hls=e,this.bwEstimator=this.initEstimator(),this.registerListeners()}resetEstimator(e){this.hls&&(e&&(this.log(`setting initial bwe to ${e}`),this.hls.config.abrEwmaDefaultEstimate=e),this.firstSelection=-1,this.bwEstimator=this.initEstimator())}initEstimator(){const e=this.hls.config;return new aJn(e.abrEwmaSlowVoD,e.abrEwmaFastVoD,e.abrEwmaDefaultEstimate)}registerListeners(){const e=this.hls;e.on(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.on(oe.FRAG_LOADING,this.onFragLoading,this),e.on(oe.FRAG_LOADED,this.onFragLoaded,this),e.on(oe.FRAG_BUFFERED,this.onFragBuffered,this),e.on(oe.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(oe.LEVEL_LOADED,this.onLevelLoaded,this),e.on(oe.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(oe.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.on(oe.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e&&(e.off(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.off(oe.FRAG_LOADING,this.onFragLoading,this),e.off(oe.FRAG_LOADED,this.onFragLoaded,this),e.off(oe.FRAG_BUFFERED,this.onFragBuffered,this),e.off(oe.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(oe.LEVEL_LOADED,this.onLevelLoaded,this),e.off(oe.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(oe.MAX_AUTO_LEVEL_UPDATED,this.onMaxAutoLevelUpdated,this),e.off(oe.ERROR,this.onError,this))}destroy(){this.unregisterListeners(),this.clearTimer(),this.hls=this._abandonRulesCheck=this.supportedCache=null,this.audioTracksByGroup=this.codecTiers=this.fragCurrent=this.partCurrent=null}onManifestLoading(e,n){this.lastLoadedFragLevel=-1,this.firstSelection=-1,this.firstAutoFloor=-1,this.lastLevelLoadSec=0,this.supportedCache={},this.fragCurrent=this.partCurrent=null,this.onLevelsUpdated(),this.clearTimer()}onLevelsUpdated(){this.lastLoadedFragLevel>-1&&this.fragCurrent&&(this.lastLoadedFragLevel=this.fragCurrent.level),this._nextAutoLevel=-1,this.onMaxAutoLevelUpdated(),this.codecTiers=null,this.audioTracksByGroup=null}onMaxAutoLevelUpdated(){this.firstSelection=-1,this.nextAutoLevelKey=""}onFragLoading(e,n){const r=n.frag;if(!this.ignoreFragment(r)){if(!r.bitrateTest){var s;this.fragCurrent=r,this.partCurrent=(s=n.part)!=null?s:null}this.clearTimer(),this.timer=self.setInterval(this._abandonRulesCheck,100)}}onLevelSwitching(e,n){this.clearTimer()}onError(e,n){if(!n.fatal)switch(n.details){case rt.BUFFER_ADD_CODEC_ERROR:case rt.BUFFER_APPEND_ERROR:this.lastLoadedFragLevel=-1,this.firstSelection=-1;break;case rt.FRAG_LOAD_TIMEOUT:{const r=n.frag,{fragCurrent:s,partCurrent:i}=this;if(r&&Zbe(r,s)){const o=performance.now(),l=i?i.stats:r.stats,c=o-l.loading.start,d=l.loading.first?l.loading.first-l.loading.start:-1;if(l.loaded&&d>-1){const h=this.bwEstimator.getEstimateTTFB();this.bwEstimator.sample(c-Math.min(h,d),l.loaded)}else this.bwEstimator.sampleTTFB(c)}break}}}getTimeToLoadFrag(e,n,r,s){const i=e+r/n,o=s?e+this.lastLevelLoadSec:0;return i+o}onLevelLoaded(e,n){const r=this.hls.config,{loading:s}=n.stats,i=s.end-s.first;xn(i)&&(this.lastLevelLoadSec=i/1e3),n.details.live?this.bwEstimator.update(r.abrEwmaSlowLive,r.abrEwmaFastLive):this.bwEstimator.update(r.abrEwmaSlowVoD,r.abrEwmaFastVoD),this.timer>-1&&this._abandonRulesCheck(n.levelInfo)}onFragLoaded(e,n){var r;const{frag:s,part:i}=n,o=i?i.stats:s.stats;if(s.type===Wn.MAIN&&this.bwEstimator.sampleTTFB(o.loading.first-o.loading.start),!this.ignoreFragment(s)){if(this.clearTimer(),s.level===this._nextAutoLevel&&(this._nextAutoLevel=-1),this.firstSelection=-1,(r=this.hls)!=null&&r.config.abrMaxWithRealBitrate){const l=i?i.duration:s.duration,c=this.hls.levels[s.level],d=(c.loaded?c.loaded.bytes:0)+o.loaded,u=(c.loaded?c.loaded.duration:0)+l;c.loaded={bytes:d,duration:u},c.realBitrate=Math.round(8*d/u)}if(s.bitrateTest){const l={stats:o,frag:s,part:i,id:s.type};this.onFragBuffered(oe.FRAG_BUFFERED,l),s.bitrateTest=!1}else this.lastLoadedFragLevel=s.level}}onFragBuffered(e,n){const{frag:r,part:s}=n,i=s!=null&&s.stats.loaded?s.stats:r.stats;if(i.aborted||this.ignoreFragment(r))return;const l=((r.bitrate||0)>=1e5?i.parsing.end:i.loading.end)-i.loading.start-Math.min(i.loading.first-i.loading.start,this.bwEstimator.getEstimateTTFB());this.bwEstimator.sample(l,i.loaded),i.bwEstimate=this.getBwEstimate(),r.bitrateTest?this.bitrateTestDelay=l/1e3:(this.bitrateTestDelay=0,this.firstAutoFloor>-1&&this.bwEstimator.canEstimate()&&(this.firstAutoFloor=-1))}ignoreFragment(e){return e.type!==Wn.MAIN||e.sn==="initSegment"}clearTimer(){this.timer>-1&&(self.clearInterval(this.timer),this.timer=-1)}get firstAutoLevel(){const{hls:e}=this;if(!e)return 0;const{maxAutoLevel:n,minAutoLevel:r}=e,s=this.getBwEstimate(),i=this.getStarvationDelay(),o=e.config.maxStarvationDelay,l=this.findBestLevel(s,r,n,i/2,o,1,1);if(l>-1)return l;const c=e.firstLevel,d=this.firstAutoFloor===-1?1/0:this.firstAutoFloor,u=Math.min(Math.max(c,r),n,d);return this.warn(`Could not find best starting auto level. Defaulting to first in playlist ${c} clamped to ${u}`),u}get forcedAutoLevel(){return this.nextAutoLevelKey?-1:this._nextAutoLevel}get nextAutoLevel(){if(!this.hls)return-1;const e=this.forcedAutoLevel,r=this.bwEstimator.canEstimate(),s=this.lastLoadedFragLevel>-1;if(e!==-1&&(!r||!s||this.nextAutoLevelKey===this.getAutoLevelKey()))return e;const i=r&&s?this.getNextABRAutoLevel():this.firstAutoLevel;if(e!==-1){const o=this.hls.levels;if(o.length>Math.max(e,i)&&o[e].loadError<=o[i].loadError)return e}return this._nextAutoLevel=i,this.nextAutoLevelKey=this.getAutoLevelKey(),i}getAutoLevelKey(){return`${this.getBwEstimate()}_${this.getStarvationDelay().toFixed(2)}`}getNextABRAutoLevel(){const{fragCurrent:e,partCurrent:n,hls:r}=this;if(!r)return-1;if(r.levels.length<=1)return r.loadLevel;const{maxAutoLevel:s,config:i,minAutoLevel:o}=r,l=n?n.duration:e?e.duration:0,c=this.getBwEstimate(),d=this.getStarvationDelay();let u=i.abrBandWidthFactor,h=i.abrBandWidthUpFactor;if(d){const v=this.findBestLevel(c,o,s,d,0,u,h);if(v>=0)return this.rebufferNotice=-1,v}let m=l?Math.min(l,i.maxStarvationDelay):i.maxStarvationDelay;if(!d){const v=this.bitrateTestDelay;v&&(m=(l?Math.min(l,i.maxLoadingDelay):i.maxLoadingDelay)-v,this.info(`bitrate test took ${Math.round(1e3*v)}ms, set first fragment max fetchDuration to ${Math.round(1e3*m)} ms`),u=h=1)}const f=this.findBestLevel(c,o,s,d,m,u,h);if(this.rebufferNotice!==f&&(this.rebufferNotice=f,this.info(`${d?"rebuffering expected":"buffer is empty"}, optimal quality level ${f}`)),f>-1)return f;const p=r.levels[o],g=r.loadLevelObj;return g&&(p==null?void 0:p.bitrate)<g.bitrate?o:r.loadLevel}getStarvationDelay(){const e=this.hls,n=e==null?void 0:e.media;if(!n)return 1/0;const r=n&&n.playbackRate!==0?Math.abs(n.playbackRate):1,s=e.mainForwardBufferInfo;return(s?s.len:0)/r}getBwEstimate(){return this.bwEstimator.getEstimate()}findBestLevel(e,n,r,s,i,o,l){const{hls:c,lastLoadedFragLevel:d,fragCurrent:u,partCurrent:h}=this;if(!c)return-1;const m=s+i,f=d===-1?c.firstLevel:d,{levels:p,allAudioTracks:g,loadLevel:v,latestLevelDetails:b,config:x}=c;if(p.length===1)return 0;const w=p[f],k=!!(b!=null&&b.live),S=v===-1||d===-1;let C,j="SDR",E=(w==null?void 0:w.frameRate)||0;const{audioPreference:N,videoPreference:A}=x,_=this.audioTracksByGroup||(this.audioTracksByGroup=Tkt(g));let T=-1;if(S){if(this.firstSelection!==-1)return this.firstSelection;const I=this.codecTiers||(this.codecTiers=gXn(p,_,n,r)),P=pXn(I,j,e,N,A),{codecSet:M,videoRanges:z,minFramerate:G,minBitrate:B,minIndex:H,preferHDR:W}=P;T=H,C=M,j=W?z[z.length-1]:z[0],E=G,e=Math.max(e,B),this.log(`picked start tier ${ya(P)}`)}else C=w==null?void 0:w.codecSet,j=w==null?void 0:w.videoRange;const R=h?h.duration:u?u.duration:0,O=this.bwEstimator.getEstimateTTFB()/1e3,F=[];for(let I=r;I>=n;I--){var D;const P=p[I],M=I>f;if(!P)continue;if(x.useMediaCapabilities&&!P.supportedResult&&!P.supportedPromise){const U=navigator.mediaCapabilities;typeof(U==null?void 0:U.decodingInfo)=="function"&&aXn(P,_,j,E,e,N)?(P.supportedPromise=jkt(P,_,U,this.supportedCache),P.supportedPromise.then(ne=>{if(!this.hls)return;P.supportedResult=ne;const te=this.hls.levels,re=te.indexOf(P);ne.error?this.warn(`MediaCapabilities decodingInfo error: "${ne.error}" for level ${re} ${ya(ne)}`):ne.supported?ne.decodingInfoResults.some(fe=>fe.smooth===!1||fe.powerEfficient===!1)&&this.log(`MediaCapabilities decodingInfo for level ${re} not smooth or powerEfficient: ${ya(ne)}`):(this.warn(`Unsupported MediaCapabilities decodingInfo result for level ${re} ${ya(ne)}`),re>-1&&te.length>1&&(this.log(`Removing unsupported level ${re}`),this.hls.removeLevel(re),this.hls.loadLevel===-1&&(this.hls.nextLoadLevel=0)))}).catch(ne=>{this.warn(`Error handling MediaCapabilities decodingInfo: ${ne}`)})):P.supportedResult=Skt}if((C&&P.codecSet!==C||j&&P.videoRange!==j||M&&E>P.frameRate||!M&&E>0&&E<P.frameRate||(D=P.supportedResult)!=null&&(D=D.decodingInfoResults)!=null&&D.some(U=>U.smooth===!1))&&(!S||I!==T)){F.push(I);continue}const z=P.details,G=(h?z==null?void 0:z.partTarget:z==null?void 0:z.averagetargetduration)||R||1;let B;M?B=l*e:B=o*e;const H=R&&s>=R*2&&i===0?P.averageBitrate:P.maxBitrate,W=this.getTimeToLoadFrag(O,B,H*G,!z||z.live);if(B>=H&&(I===d||P.loadError===0&&P.fragmentError===0||nkt(P,x.errorPenaltyExpireMs))&&(W<=O||!xn(W)||k&&!this.bitrateTestDelay||W<m)){const U=this.forcedAutoLevel;return I!==v&&(U===-1||U!==v)&&(F.length&&this.trace(`Skipped level(s) ${F.join(",")} of ${r} max with CODECS and VIDEO-RANGE:"${p[F[0]].codecs}" ${p[F[0]].videoRange}; not compatible with "${C}" ${j}`),this.info(`switch candidate:${f}->${I} adjustedbw(${Math.round(B)})-bitrate=${Math.round(B-H)} ttfb:${O.toFixed(1)} avgDuration:${G.toFixed(1)} maxFetchDuration:${m.toFixed(1)} fetchDuration:${W.toFixed(1)} firstSelection:${S} codecSet:${P.codecSet} videoRange:${P.videoRange} hls.loadLevel:${v}`)),S&&(this.firstSelection=I),I}}return-1}set nextAutoLevel(e){const n=this.deriveNextAutoLevel(e);this._nextAutoLevel!==n&&(this.nextAutoLevelKey="",this._nextAutoLevel=n)}deriveNextAutoLevel(e){if(!this.hls)return-1;const{maxAutoLevel:n,minAutoLevel:r}=this.hls;return Math.min(Math.max(e,r),n)}}const Akt={search:function(t,e){let n=0,r=t.length-1,s=null,i=null;for(;n<=r;){s=(n+r)/2|0,i=t[s];const o=e(i);if(o>0)n=s+1;else if(o<0)r=s-1;else return i}return null}};function wXn(t,e,n){if(e===null||!Array.isArray(t)||!t.length||!xn(e))return null;const r=t[0].programDateTime;if(e<(r||0))return null;const s=t[t.length-1].endProgramDateTime;if(e>=(s||0))return null;for(let i=0;i<t.length;++i){const o=t[i];if(SXn(e,n,o))return o}return null}function UR(t,e,n=0,r=0,s=.005){let i=null;if(t){i=e[1+t.sn-e[0].sn]||null;const l=t.endDTS-n;l>0&&l<15e-7&&(n+=15e-7),i&&t.level!==i.level&&i.end<=t.end&&(i=e[2+t.sn-e[0].sn]||null)}else n===0&&e[0].start===0&&(i=e[0]);if(i&&((!t||t.level===i.level)&&aUe(n,r,i)===0||kXn(i,t,Math.min(s,r))))return i;const o=Akt.search(e,aUe.bind(null,n,r));return o&&(o!==t||!i)?o:i}function kXn(t,e,n){if((e==null?void 0:e.start)===0&&e.level<t.level&&(e.endPTS||0)>0){const r=e.tagList.reduce((s,i)=>(i[0]==="INF"&&(s+=parseFloat(i[1])),s),n);return t.start<=r}return!1}function aUe(t=0,e=0,n){if(n.start<=t&&n.start+n.duration>t)return 0;const r=Math.min(e,n.duration+(n.deltaPTS?n.deltaPTS:0));return n.start+n.duration-r<=t?1:n.start-r>t&&n.start?-1:0}function SXn(t,e,n){const r=Math.min(e,n.duration+(n.deltaPTS?n.deltaPTS:0))*1e3;return(n.endProgramDateTime||0)-r>t}function Pkt(t,e,n){if(t&&t.startCC<=e&&t.endCC>=e){let r=t.fragments;const{fragmentHint:s}=t;s&&(r=r.concat(s));let i;return Akt.search(r,o=>o.cc<e?1:o.cc>e?-1:(i=o,o.end<=n?1:o.start>n?-1:0)),i||null}return null}function Rkt(t,e){return e===t.endSN&&t.fragmentHint?t.fragmentHint:t.fragments[1+e-t.startSN]||null}var od={DoNothing:0,SendEndCallback:1,SendAlternateToPenaltyBox:2,RemoveAlternatePermanently:3,InsertDiscontinuity:4,RetryRequest:5},Ac={None:0,MoveAllAlternatesMatchingHost:1,MoveAllAlternatesMatchingHDCP:2,MoveAllAlternatesMatchingKey:4,SwitchToSDR:8,ResetMediaSource:16};class CXn extends Fm{constructor(e){super("error-controller",e.logger),this.hls=void 0,this.playlistError=0,this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(oe.ERROR,this.onError,this),e.on(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.on(oe.LEVEL_UPDATED,this.onLevelUpdated,this)}unregisterListeners(){const e=this.hls;e&&(e.off(oe.ERROR,this.onError,this),e.off(oe.ERROR,this.onErrorOut,this),e.off(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.off(oe.LEVEL_UPDATED,this.onLevelUpdated,this))}destroy(){this.unregisterListeners(),this.hls=null}startLoad(e){}stopLoad(){this.playlistError=0}getVariantLevelIndex(e){return(e==null?void 0:e.type)===Wn.MAIN?e.level:this.getVariantIndex()}getVariantIndex(){var e;const n=this.hls,r=n.currentLevel;return(e=n.loadLevelObj)!=null&&e.details||r===-1?n.loadLevel:r}variantHasKey(e,n){if(e){var r;if((r=e.details)!=null&&r.hasKey(n))return!0;const s=e.audioGroups;if(s)return this.hls.allAudioTracks.filter(o=>s.indexOf(o.groupId)>=0).some(o=>{var l;return(l=o.details)==null?void 0:l.hasKey(n)})}return!1}onManifestLoading(){this.playlistError=0}onLevelUpdated(){this.playlistError=0}onError(e,n){var r;if(n.fatal)return;const s=this.hls,i=n.context;switch(n.details){case rt.FRAG_LOAD_ERROR:case rt.FRAG_LOAD_TIMEOUT:case rt.KEY_LOAD_ERROR:case rt.KEY_LOAD_TIMEOUT:n.errorAction=this.getFragRetryOrSwitchAction(n);return;case rt.FRAG_PARSING_ERROR:if((r=n.frag)!=null&&r.gap){n.errorAction=y$();return}case rt.FRAG_GAP:case rt.FRAG_DECRYPT_ERROR:{n.errorAction=this.getFragRetryOrSwitchAction(n),n.errorAction.action=od.SendAlternateToPenaltyBox;return}case rt.PLAYLIST_UNCHANGED_ERROR:case rt.LEVEL_EMPTY_ERROR:case rt.LEVEL_PARSING_ERROR:{var o;const l=n.parent===Wn.MAIN?n.level:s.loadLevel;n.details===rt.LEVEL_EMPTY_ERROR&&((o=n.context)!=null&&(o=o.levelDetails)!=null&&o.live)?n.errorAction=this.getPlaylistRetryOrSwitchAction(n,l):(n.levelRetry=!1,n.errorAction=this.getLevelSwitchAction(n,l))}return;case rt.LEVEL_LOAD_ERROR:case rt.LEVEL_LOAD_TIMEOUT:typeof(i==null?void 0:i.level)=="number"&&(n.errorAction=this.getPlaylistRetryOrSwitchAction(n,i.level));return;case rt.AUDIO_TRACK_LOAD_ERROR:case rt.AUDIO_TRACK_LOAD_TIMEOUT:case rt.SUBTITLE_LOAD_ERROR:case rt.SUBTITLE_TRACK_LOAD_TIMEOUT:if(i){const l=s.loadLevelObj;if(l&&(i.type===ks.AUDIO_TRACK&&l.hasAudioGroup(i.groupId)||i.type===ks.SUBTITLE_TRACK&&l.hasSubtitleGroup(i.groupId))){n.errorAction=this.getPlaylistRetryOrSwitchAction(n,s.loadLevel),n.errorAction.action=od.SendAlternateToPenaltyBox,n.errorAction.flags=Ac.MoveAllAlternatesMatchingHost;return}}return;case rt.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:n.errorAction={action:od.SendAlternateToPenaltyBox,flags:Ac.MoveAllAlternatesMatchingHDCP};return;case rt.KEY_SYSTEM_SESSION_UPDATE_FAILED:case rt.KEY_SYSTEM_STATUS_INTERNAL_ERROR:case rt.KEY_SYSTEM_NO_SESSION:n.errorAction={action:od.SendAlternateToPenaltyBox,flags:Ac.MoveAllAlternatesMatchingKey};return;case rt.BUFFER_ADD_CODEC_ERROR:case rt.REMUX_ALLOC_ERROR:case rt.BUFFER_APPEND_ERROR:n.errorAction||(n.errorAction=this.getLevelSwitchAction(n,n.level));return;case rt.MEDIA_SOURCE_REQUIRES_RESET:n.errorAction||(n.errorAction=this.getLevelSwitchAction(n,n.level)),n.errorAction.flags|=Ac.ResetMediaSource|Ac.SwitchToSDR;return;case rt.INTERNAL_EXCEPTION:case rt.BUFFER_APPENDING_ERROR:case rt.BUFFER_APPEND_NO_PROGRESS:case rt.BUFFER_FULL_ERROR:case rt.LEVEL_SWITCH_ERROR:case rt.BUFFER_STALLED_ERROR:case rt.BUFFER_SEEK_OVER_HOLE:case rt.BUFFER_NUDGE_ON_STALL:n.errorAction=y$();return}n.type===er.KEY_SYSTEM_ERROR&&(n.levelRetry=!1,n.errorAction=y$())}getPlaylistRetryOrSwitchAction(e,n){const r=this.hls,s=G9e(r.config.playlistLoadPolicy,e),i=this.playlistError++;if(L6(s,i,tZ(e),e.response))return{action:od.RetryRequest,flags:Ac.None,retryConfig:s,retryCount:i};const l=this.getLevelSwitchAction(e,n);return s&&(l.retryConfig=s,l.retryCount=i),l}getFragRetryOrSwitchAction(e){const n=this.hls,r=this.getVariantLevelIndex(e.frag),s=n.levels[r],{fragLoadPolicy:i,keyLoadPolicy:o}=n.config,l=G9e(ekt(e)?o:i,e),c=n.levels.reduce((u,h)=>u+h.fragmentError,0);if(s&&(e.details!==rt.FRAG_GAP&&s.fragmentError++,!tkt(e)&&L6(l,c,tZ(e),e.response)))return{action:od.RetryRequest,flags:Ac.None,retryConfig:l,retryCount:c};const d=this.getLevelSwitchAction(e,r);return l&&(d.retryConfig=l,d.retryCount=c),d}getLevelSwitchAction(e,n){const r=this.hls;n==null&&(n=r.loadLevel);const s=this.hls.levels[n];if(s){var i,o;const d=e.details;s.loadError++,s.loadErrorTime=self.performance.now(),d===rt.BUFFER_APPEND_ERROR&&s.fragmentError++;let u=-1;const{levels:h,loadLevel:m,minAutoLevel:f,maxAutoLevel:p}=r;!r.autoLevelEnabled&&!r.config.preserveManualLevelOnError&&(r.loadLevel=-1);const g=(i=e.frag)==null?void 0:i.type,b=(g===Wn.AUDIO&&d===rt.FRAG_PARSING_ERROR||e.sourceBufferName==="audio"&&oUe(e))&&h.some(({audioCodec:C})=>s.audioCodec!==C),w=e.sourceBufferName==="video"&&oUe(e)&&h.some(({codecSet:C,audioCodec:j})=>s.codecSet!==C&&s.audioCodec===j),{type:k,groupId:S}=(o=e.context)!=null?o:{};for(let C=h.length;C--;){const j=(C+m)%h.length;if(j!==m&&j>=f&&j<=p&&(h[j].loadError===0||nkt(h[j],r.config.errorPenaltyExpireMs))){var l,c;const E=h[j];if(d===rt.FRAG_GAP&&g===Wn.MAIN&&e.frag){const N=h[j].details;if(N){const A=UR(e.frag,N.fragments,e.frag.start);if(A!=null&&A.gap)continue}}else{if(k===ks.AUDIO_TRACK&&E.hasAudioGroup(S)||k===ks.SUBTITLE_TRACK&&E.hasSubtitleGroup(S))continue;if(g===Wn.AUDIO&&(l=s.audioGroups)!=null&&l.some(N=>E.hasAudioGroup(N))||g===Wn.SUBTITLE&&(c=s.subtitleGroups)!=null&&c.some(N=>E.hasSubtitleGroup(N))||b&&s.audioCodec===E.audioCodec||w&&s.codecSet===E.codecSet||!b&&s.audioCodec!==E.audioCodec)continue}u=j;break}}if(u>-1&&r.loadLevel!==u)return e.levelRetry=!0,this.playlistError=0,{action:od.SendAlternateToPenaltyBox,flags:Ac.None,nextAutoLevel:u}}return{action:od.SendAlternateToPenaltyBox,flags:Ac.MoveAllAlternatesMatchingHost}}onErrorOut(e,n){var r,s;switch((r=n.errorAction)==null?void 0:r.action){case od.DoNothing:break;case od.SendAlternateToPenaltyBox:this.sendAlternateToPenaltyBox(n),!n.errorAction.resolved&&n.details!==rt.FRAG_GAP&&n.details!==rt.PLAYLIST_UNCHANGED_ERROR&&!Ikt(n)&&(n.fatal=!0);break}if((((s=n.errorAction)==null?void 0:s.flags)||0)&Ac.ResetMediaSource&&this.hls.recoverMediaError(),n.fatal){this.hls.stopLoad();return}}sendAlternateToPenaltyBox(e){const n=this.hls,r=e.errorAction;if(!r)return;let s=r.nextAutoLevel;if(r.flags===Ac.None)this.switchLevel(e,s);else if(r.flags&Ac.SwitchToSDR){const l=this.hls.levels,c=l.length;for(let d=c;d--;)l[d].videoRange!=="SDR"?(l[d].fragmentError++,l[d].loadError++):s===void 0&&(s=d)}else if(r.flags&Ac.MoveAllAlternatesMatchingHDCP){const l=this.getVariantLevelIndex(e.frag),c=n.levels[l],d=c==null?void 0:c.attrs["HDCP-LEVEL"];r.hdcpLevel=d;const u=d==="NONE";d&&!u?(n.maxHdcpLevel=rxe[rxe.indexOf(d)-1],r.resolved=!0,this.warn(`Restricting playback to HDCP-LEVEL of "${n.maxHdcpLevel}" or lower`)):(u&&this.warn("HDCP policy resticted output with HDCP-LEVEL=NONE"),r.flags|=Ac.MoveAllAlternatesMatchingKey)}if(r.flags&Ac.MoveAllAlternatesMatchingKey){const l=e.decryptdata;if(l){const c=this.hls.levels,d=c.length;for(let h=d;h--;)if(this.variantHasKey(c[h],l)){var i,o;this.log(`Banned key found in level ${h} (${c[h].bitrate}bps) or audio group "${(i=c[h].audioGroups)==null?void 0:i.join(",")}" (${(o=e.frag)==null?void 0:o.type} fragment) ${Gl(l.keyId||[])}`),c[h].fragmentError++,c[h].loadError++,this.log(`Removing level ${h} with key error (${e.error})`),this.hls.removeLevel(h)}const u=e.frag;if(this.hls.levels.length<d)r.resolved=!0;else if(u&&u.type!==Wn.MAIN){const h=u.decryptdata;h&&!l.matches(h)&&(r.resolved=!0)}}}r.resolved||this.switchLevel(e,s)}switchLevel(e,n){if(n!==void 0&&e.errorAction&&(this.warn(`switching to level ${n} after ${e.details}`),this.hls.nextAutoLevel=n,e.errorAction.resolved=!0,this.hls.nextLoadLevel=this.hls.nextAutoLevel,e.details===rt.BUFFER_ADD_CODEC_ERROR&&e.mimeType&&e.sourceBufferName!=="audiovideo")){const r=nxe(e.mimeType),s=this.hls.levels;for(let i=s.length;i--;)s[i][`${e.sourceBufferName}Codec`]===r&&(this.log(`Removing level ${i} for ${e.details} ("${r}" not supported)`),this.hls.removeLevel(i))}}}function oUe(t){const e=t.details;return e===rt.BUFFER_ADD_CODEC_ERROR||e===rt.MEDIA_SOURCE_REQUIRES_RESET||e===rt.BUFFER_APPEND_ERROR&&!Ikt(t)}function Ikt(t){return t.details===rt.BUFFER_APPEND_ERROR&&(t.error.name==="QuotaExceededError"||t.error.name==="InvalidStateError")}function y$(t){const e={action:od.DoNothing,flags:Ac.None};return t&&(e.resolved=!0),e}var po={NOT_LOADED:"NOT_LOADED",APPENDING:"APPENDING",PARTIAL:"PARTIAL",OK:"OK"};class jXn{constructor(e){this.activePartLists=Object.create(null),this.endListFragments=Object.create(null),this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hasGaps=!1,this.hls=e,this._registerListeners()}_registerListeners(){const{hls:e}=this;e&&(e.on(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.on(oe.BUFFER_APPENDED,this.onBufferAppended,this),e.on(oe.FRAG_BUFFERED,this.onFragBuffered,this),e.on(oe.FRAG_LOADED,this.onFragLoaded,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.off(oe.BUFFER_APPENDED,this.onBufferAppended,this),e.off(oe.FRAG_BUFFERED,this.onFragBuffered,this),e.off(oe.FRAG_LOADED,this.onFragLoaded,this))}destroy(){this._unregisterListeners(),this.hls=this.fragments=this.activePartLists=this.endListFragments=this.timeRanges=null}getAppendedFrag(e,n){const r=this.activePartLists[n];if(r)for(let s=r.length;s--;){const i=r[s];if(!i)break;if(i.start<=e&&e<=i.end&&i.loaded)return i}return this.getBufferedFrag(e,n)}getBufferedFrag(e,n){return this.getFragAtPos(e,n,!0)}getFragAtPos(e,n,r){const{fragments:s}=this,i=Object.keys(s);for(let o=i.length;o--;){const l=s[i[o]];if((l==null?void 0:l.body.type)===n&&(!r||l.buffered)){const c=l.body;if(c.start<=e&&e<=c.end)return c}}return null}detectEvictedFragments(e,n,r,s,i,o){this.timeRanges&&(this.timeRanges[e]=n);const l=(i==null?void 0:i.fragment.sn)||-1;Object.keys(this.fragments).forEach(c=>{const d=this.fragments[c];if(!d||!this.hls)return;const u=d.body;if(l>=u.sn)return;if(!d.buffered&&(!d.loaded||o)){u.type===r&&this.removeFragment(u);return}const h=d.range[e];if(h){if(h.time.length===0){this.removeFragment(u);return}if(h.time.some(m=>{const f=!this.isTimeBuffered(m.startPTS,m.endPTS,n);return f&&this.removeFragment(u),f}),s&&s!==u&&v$()){const m=s.endPTS,f=u.startPTS;if(m&&f&&d.range.video){const p=f-m;p<0&&p>-.1&&(this.removeFragment(u),this.hls.trigger(oe.BUFFER_FLUSHING,{startOffset:m+.004,endOffset:1/0,type:"video"}))}}}})}detectPartialFragments(e){const n=this.timeRanges,{frag:r,part:s,id:i}=e;if(!n||!Oo(r))return;const o=xT(r),l=this.fragments[o];if(!l||l.buffered&&r.gap)return;const c=!r.relurl;Object.keys(n).forEach(u=>{const h=r.elementaryStreams[u];if(!h)return;const m=n[u],f=c||h.partial===!0;l.range[u]=this.getBufferedTimes(r,s,f,m),this.detectEvictedFragments(u,m,i,r,s)}),l.loaded=null;const d=Object.keys(l.range);if(d.length){if(this.bufferedEnd(l,r),mV(l)||this.removeParts(r.sn-1,r.type),!s){const u=Math.min(.004,r.duration);d.some(h=>{var m;const f=(m=l.range[h])==null?void 0:m.time,p=f.length===0||f.length===1&&f[0].endPTS-f[0].startPTS<u;return p&&this.addAsGap(r),p})}}else this.removeFragment(r)}addAsGap(e){e.gap=!0,this.removeFragment(e),this.fragBuffered(e,!0)}bufferedEnd(e,n){e.buffered=!0,(e.body.endList=n.endList||e.body.endList)&&!n.gap&&(this.endListFragments[e.body.type]=e)}removeParts(e,n){const r=this.activePartLists[n];r&&(this.activePartLists[n]=lUe(r,s=>s.fragment.sn>=e))}fragBuffered(e,n){const r=xT(e);let s=this.fragments[r];return!s&&n&&(s=this.fragments[r]={body:e,appendedPTS:null,loaded:null,buffered:!1,range:Object.create(null)},e.gap&&(this.hasGaps=!0)),s&&(s.loaded=null,this.bufferedEnd(s,e)),s}getBufferedTimes(e,n,r,s){const i={time:[],partial:r},o=e.start,l=e.end,c=e.minEndPTS||l,d=e.maxStartPTS||o;for(let u=0;u<s.length;u++){const h=s.start(u)-this.bufferPadding,m=s.end(u)+this.bufferPadding;if(d>=h&&c<=m){i.time.push({startPTS:Math.max(o,s.start(u)),endPTS:Math.min(l,s.end(u))});break}else if(o<m&&l>h){const f=Math.max(o,s.start(u)),p=Math.min(l,s.end(u));p>f&&(i.partial=!0,i.time.push({startPTS:f,endPTS:p}))}else if(l<=h)break}return i}getPartialFragment(e){let n=null,r,s,i,o=0;const{bufferPadding:l,fragments:c}=this;return Object.keys(c).forEach(d=>{const u=c[d];u&&mV(u)&&(s=u.body.start-l,i=u.body.end+l,e>=s&&e<=i&&(r=Math.min(e-s,i-e),o<=r&&(n=u.body,o=r)))}),n}isEndListAppended(e){const n=this.endListFragments[e];return n!==void 0&&(n.buffered||mV(n))}getState(e){const n=xT(e),r=this.fragments[n];return r?r.buffered?mV(r)?po.PARTIAL:po.OK:po.APPENDING:po.NOT_LOADED}isTimeBuffered(e,n,r){let s,i;for(let o=0;o<r.length;o++){if(s=r.start(o)-this.bufferPadding,i=r.end(o)+this.bufferPadding,e>=s&&n<=i)return!0;if(n<=s)return!1}return!1}onManifestLoading(){this.removeAllFragments()}onFragLoaded(e,n){if(!Oo(n.frag)||n.frag.bitrateTest)return;const r=n.frag,s=n.part?null:n,i=xT(r);this.fragments[i]={body:r,appendedPTS:null,loaded:s,buffered:!1,range:Object.create(null)}}onBufferAppended(e,n){const{frag:r,part:s,timeRanges:i}=n;if(!Oo(r))return;const o=r.type;if(s){let l=this.activePartLists[o];l||(this.activePartLists[o]=l=[]),l.push(s)}this.timeRanges=i}onFragBuffered(e,n){this.detectPartialFragments(n)}hasFragment(e){const n=xT(e);return!!this.fragments[n]}hasFragments(e){const{fragments:n}=this,r=Object.keys(n);if(!e)return r.length>0;for(let s=r.length;s--;){const i=n[r[s]];if((i==null?void 0:i.body.type)===e)return!0}return!1}hasParts(e){var n;return!!((n=this.activePartLists[e])!=null&&n.length)}getBackBufferEvictionEnd(e,n,r){const{fragments:s}=this;let i=0,o=0;const l=Object.keys(s);for(let c=0;c<l.length;c++){const d=s[l[c]];if(!d||!d.buffered||d.body.type!==n)continue;const u=d.body;if(u.gap)return 0;const h=u.hasStats&&u.stats.loaded||u.byteLength||u.bitrate&&u.bitrate*8*u.duration;if(u.end<=e&&h&&(i+=h,o=Math.max(o,u.end),i>=r))return o}return o>0?o:0}removeFragmentsInRange(e,n,r,s,i){s&&!this.hasGaps||Object.keys(this.fragments).forEach(o=>{const l=this.fragments[o];if(!l)return;const c=l.body;c.type!==r||s&&!c.gap||c.start<n&&c.end>e&&(l.buffered||i)&&this.removeFragment(c)})}removeFragment(e){const n=xT(e);e.clearElementaryStreamInfo();const r=this.activePartLists[e.type];if(r){const s=e.sn;this.activePartLists[e.type]=lUe(r,i=>i.fragment.sn!==s)}delete this.fragments[n],e.endList&&delete this.endListFragments[e.type]}removeAllFragments(){var e;this.fragments=Object.create(null),this.endListFragments=Object.create(null),this.activePartLists=Object.create(null),this.hasGaps=!1;const n=(e=this.hls)==null||(e=e.latestLevelDetails)==null?void 0:e.partList;n&&n.forEach(r=>r.clearElementaryStreamInfo())}}function mV(t){var e,n,r,s;return t.buffered&&!!(t.body.gap||(e=t.range.video)!=null&&e.partial||(n=t.range.audio)!=null&&n.partial||(r=t.range.audiovideo)!=null&&r.partial||(s=t.range.subs)!=null&&s.partial)}function xT(t){return`${t.type}_${t.level}_${t.sn}`}function lUe(t,e){return t.filter(n=>{const r=e(n);return r||n.clearElementaryStreamInfo(),r})}var Uk={cbc:0,ctr:1};class EXn{constructor(e,n,r){this.subtle=void 0,this.aesIV=void 0,this.aesMode=void 0,this.subtle=e,this.aesIV=n,this.aesMode=r}decrypt(e,n){switch(this.aesMode){case Uk.cbc:return this.subtle.decrypt({name:"AES-CBC",iv:this.aesIV},n,e);case Uk.ctr:return this.subtle.decrypt({name:"AES-CTR",counter:this.aesIV,length:64},n,e);default:throw new Error(`[AESCrypto] invalid aes mode ${this.aesMode}`)}}}function NXn(t){const e=t.byteLength,n=e&&new DataView(t.buffer).getUint8(e-1);return n?t.slice(0,e-n):t}class TXn{constructor(){this.rcon=[0,1,2,4,8,16,32,64,128,27,54],this.subMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.invSubMix=[new Uint32Array(256),new Uint32Array(256),new Uint32Array(256),new Uint32Array(256)],this.sBox=new Uint32Array(256),this.invSBox=new Uint32Array(256),this.key=new Uint32Array(0),this.ksRows=0,this.keySize=0,this.keySchedule=void 0,this.invKeySchedule=void 0,this.initTable()}uint8ArrayToUint32Array_(e){const n=new DataView(e),r=new Uint32Array(4);for(let s=0;s<4;s++)r[s]=n.getUint32(s*4);return r}initTable(){const e=this.sBox,n=this.invSBox,r=this.subMix,s=r[0],i=r[1],o=r[2],l=r[3],c=this.invSubMix,d=c[0],u=c[1],h=c[2],m=c[3],f=new Uint32Array(256);let p=0,g=0,v=0;for(v=0;v<256;v++)v<128?f[v]=v<<1:f[v]=v<<1^283;for(v=0;v<256;v++){let b=g^g<<1^g<<2^g<<3^g<<4;b=b>>>8^b&255^99,e[p]=b,n[b]=p;const x=f[p],w=f[x],k=f[w];let S=f[b]*257^b*16843008;s[p]=S<<24|S>>>8,i[p]=S<<16|S>>>16,o[p]=S<<8|S>>>24,l[p]=S,S=k*16843009^w*65537^x*257^p*16843008,d[b]=S<<24|S>>>8,u[b]=S<<16|S>>>16,h[b]=S<<8|S>>>24,m[b]=S,p?(p=x^f[f[f[k^x]]],g^=f[f[g]]):p=g=1}}expandKey(e){const n=this.uint8ArrayToUint32Array_(e);let r=!0,s=0;for(;s<n.length&&r;)r=n[s]===this.key[s],s++;if(r)return;this.key=n;const i=this.keySize=n.length;if(i!==4&&i!==6&&i!==8)throw new Error("Invalid aes key size="+i);const o=this.ksRows=(i+6+1)*4;let l,c;const d=this.keySchedule=new Uint32Array(o),u=this.invKeySchedule=new Uint32Array(o),h=this.sBox,m=this.rcon,f=this.invSubMix,p=f[0],g=f[1],v=f[2],b=f[3];let x,w;for(l=0;l<o;l++){if(l<i){x=d[l]=n[l];continue}w=x,l%i===0?(w=w<<8|w>>>24,w=h[w>>>24]<<24|h[w>>>16&255]<<16|h[w>>>8&255]<<8|h[w&255],w^=m[l/i|0]<<24):i>6&&l%i===4&&(w=h[w>>>24]<<24|h[w>>>16&255]<<16|h[w>>>8&255]<<8|h[w&255]),d[l]=x=(d[l-i]^w)>>>0}for(c=0;c<o;c++)l=o-c,c&3?w=d[l]:w=d[l-4],c<4||l<=4?u[c]=w:u[c]=p[h[w>>>24]]^g[h[w>>>16&255]]^v[h[w>>>8&255]]^b[h[w&255]],u[c]=u[c]>>>0}networkToHostOrderSwap(e){return e<<24|(e&65280)<<8|(e&16711680)>>8|e>>>24}decrypt(e,n,r){const s=this.keySize+6,i=this.invKeySchedule,o=this.invSBox,l=this.invSubMix,c=l[0],d=l[1],u=l[2],h=l[3],m=this.uint8ArrayToUint32Array_(r);let f=m[0],p=m[1],g=m[2],v=m[3];const b=new Int32Array(e),x=new Int32Array(b.length);let w,k,S,C,j,E,N,A,_,T,R,O,F,D;const I=this.networkToHostOrderSwap;for(;n<b.length;){for(_=I(b[n]),T=I(b[n+1]),R=I(b[n+2]),O=I(b[n+3]),j=_^i[0],E=O^i[1],N=R^i[2],A=T^i[3],F=4,D=1;D<s;D++)w=c[j>>>24]^d[E>>16&255]^u[N>>8&255]^h[A&255]^i[F],k=c[E>>>24]^d[N>>16&255]^u[A>>8&255]^h[j&255]^i[F+1],S=c[N>>>24]^d[A>>16&255]^u[j>>8&255]^h[E&255]^i[F+2],C=c[A>>>24]^d[j>>16&255]^u[E>>8&255]^h[N&255]^i[F+3],j=w,E=k,N=S,A=C,F=F+4;w=o[j>>>24]<<24^o[E>>16&255]<<16^o[N>>8&255]<<8^o[A&255]^i[F],k=o[E>>>24]<<24^o[N>>16&255]<<16^o[A>>8&255]<<8^o[j&255]^i[F+1],S=o[N>>>24]<<24^o[A>>16&255]<<16^o[j>>8&255]<<8^o[E&255]^i[F+2],C=o[A>>>24]<<24^o[j>>16&255]<<16^o[E>>8&255]<<8^o[N&255]^i[F+3],x[n]=I(w^f),x[n+1]=I(C^p),x[n+2]=I(S^g),x[n+3]=I(k^v),f=_,p=T,g=R,v=O,n=n+4}return x.buffer}}class _Xn{constructor(e,n,r){this.subtle=void 0,this.key=void 0,this.aesMode=void 0,this.subtle=e,this.key=n,this.aesMode=r}expandKey(){const e=AXn(this.aesMode);return this.subtle.importKey("raw",this.key,{name:e},!1,["encrypt","decrypt"])}}function AXn(t){switch(t){case Uk.cbc:return"AES-CBC";case Uk.ctr:return"AES-CTR";default:throw new Error(`[FastAESKey] invalid aes mode ${t}`)}}const PXn=16;class d_e{constructor(e,n){if(this.logEnabled=!0,this.decryptRange=void 0,this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null,this.useSoftware=void 0,this.enableSoftwareAES=void 0,this.enableSoftwareAES=e.enableSoftwareAES,n!==!0)try{const r=self.crypto;r&&(this.subtle=r.subtle||r.webkitSubtle)}catch{}this.useSoftware=!this.subtle}destroy(){this.subtle=null,this.softwareDecrypter=null,this.key=null,this.fastAesKey=null,this.remainderData=null,this.currentIV=null,this.currentResult=null}isSync(){return this.useSoftware}flush(){const{currentResult:e,remainderData:n}=this;if(!e||n)return this.reset(),null;const r=new Uint8Array(e);this.reset();const s=this.decryptRange;return s?s.start===0&&s.end>=r.length?r:r.slice(s.start,s.end):NXn(r)}reset(){this.currentResult=null,this.currentIV=null,this.remainderData=null,this.softwareDecrypter&&(this.softwareDecrypter=null)}decrypt(e,n,r,s,i){return this.decryptRange=i,this.useSoftware||i?new Promise((o,l)=>{const c=ArrayBuffer.isView(e)?e:new Uint8Array(e);this.softwareDecrypt(c,n,r,s);const d=this.flush();d?o(d.buffer):l(new Error("[softwareDecrypt] Failed to decrypt data"))}):this.webCryptoDecrypt(new Uint8Array(e),n,r,s)}softwareDecrypt(e,n,r,s){const{currentIV:i,currentResult:o,remainderData:l}=this;if(s!==Uk.cbc||n.byteLength!==16)return hi.warn("SoftwareDecrypt: can only handle AES-128-CBC"),null;this.logOnce("JS AES decrypt"),l&&(e=Wf(l,e),this.remainderData=null);const c=this.getValidChunk(e);if(!c.length)return null;i&&(r=i);let d=this.softwareDecrypter;d||(d=this.softwareDecrypter=new TXn),d.expandKey(n);const u=o;return this.currentResult=d.decrypt(c.buffer,0,r),this.currentIV=c.slice(-16).buffer,u||null}webCryptoDecrypt(e,n,r,s){if(this.key!==n||!this.fastAesKey){if(!this.subtle)return Promise.resolve(this.onWebCryptoError(e,n,r,s));this.key=n,this.fastAesKey=new _Xn(this.subtle,n,s)}return this.fastAesKey.expandKey().then(i=>this.subtle?(this.logOnce("WebCrypto AES decrypt"),new EXn(this.subtle,new Uint8Array(r),s).decrypt(e.buffer,i)):Promise.reject(new Error("web crypto not initialized"))).catch(i=>(hi.warn(`[decrypter]: WebCrypto Error, disable WebCrypto API, ${i.name}: ${i.message}`),this.onWebCryptoError(e,n,r,s)))}onWebCryptoError(e,n,r,s){const i=this.enableSoftwareAES;if(i){this.useSoftware=!0,this.logEnabled=!0,this.softwareDecrypt(e,n,r,s);const o=this.flush();if(o)return o.buffer}throw new Error("WebCrypto"+(i?" and softwareDecrypt":"")+": failed to decrypt data")}getValidChunk(e){let n=e;const r=e.length-e.length%PXn;return r!==e.length&&(n=e.slice(0,r),this.remainderData=e.slice(r)),n}logOnce(e){this.logEnabled&&(hi.log(`[decrypter]: ${e}`),this.logEnabled=!1)}}const cUe=Math.pow(2,17);class dUe{constructor(e){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=e}destroy(){this.loader&&(this.loader.destroy(),this.loader=null)}abort(){this.loader&&this.loader.abort()}load(e,n,r,s){const i=e.url;if(!i)return Promise.reject(new Dv({type:er.NETWORK_ERROR,details:rt.FRAG_LOAD_ERROR,fatal:!1,frag:e,error:new Error(`Fragment does not have a ${i?"part list":"url"}`),networkDetails:null}));this.abort();const o=this.config,l=o.fLoader,c=o.loader;return new Promise((d,u)=>{if(this.loader&&this.loader.destroy(),e.gap)if(e.tagList.some(v=>v[0]==="GAP")){u(hUe(e));return}else e.gap=!1;const h=this.loader=l?new l(o):new c(o),m=uUe(e,null,n);e.loader=h;const f=W9e(o.fragLoadPolicy.default),p={loadPolicy:f,timeout:f.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:e.sn==="initSegment"?1/0:cUe};h.stats.retry=e.stats.retry,e.stats=h.stats;const g={onSuccess:(v,b,x,w)=>{this.resetLoader(e,h);let k=v.data;x.resetIV&&e.decryptdata&&(e.decryptdata.iv=new Uint8Array(k.slice(0,16)),k=k.slice(16)),d({frag:e,part:null,payload:k,networkDetails:w})},onError:(v,b,x,w)=>{this.resetLoader(e,h),u(new Dv({type:er.NETWORK_ERROR,details:rt.FRAG_LOAD_ERROR,fatal:!1,frag:e,response:rr({url:i,data:void 0},v),error:new Error(`HTTP Error ${v.code} ${v.text}`),networkDetails:x,stats:w}))},onAbort:(v,b,x)=>{this.resetLoader(e,h),u(new Dv({type:er.NETWORK_ERROR,details:rt.INTERNAL_ABORTED,fatal:!1,frag:e,error:new Error("Aborted"),networkDetails:x,stats:v}))},onTimeout:(v,b,x)=>{this.resetLoader(e,h),u(new Dv({type:er.NETWORK_ERROR,details:rt.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,error:new Error(`Timeout after ${p.timeout}ms`),networkDetails:x,stats:v}))}};if(r){const v=this.gateProgress(r,s);g.onProgress=(b,x,w,k)=>v({frag:e,part:null,payload:w,networkDetails:k})}h.load(m,p,g)})}gateProgress(e,n){let r=e;if(n){const s=[];let i=!1;n.then(()=>{i=!0,s.forEach(o=>e(o)),s.length=0}).catch(()=>{}),r=o=>{i?e(o):s.push(o)}}return r}loadPart(e,n,r){this.abort();const s=this.config,i=s.fLoader,o=s.loader;return new Promise((l,c)=>{if(this.loader&&this.loader.destroy(),e.gap||n.gap){c(hUe(e,n));return}const d=this.loader=i?new i(s):new o(s),u=uUe(e,n);e.loader=d;const h=W9e(s.fragLoadPolicy.default),m={loadPolicy:h,timeout:h.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0,highWaterMark:cUe};n.stats=d.stats,d.load(u,m,{onSuccess:(f,p,g,v)=>{this.resetLoader(e,d),this.updateStatsFromPart(e,n);const b={frag:e,part:n,payload:f.data,networkDetails:v};r(b),l(b)},onError:(f,p,g,v)=>{this.resetLoader(e,d),c(new Dv({type:er.NETWORK_ERROR,details:rt.FRAG_LOAD_ERROR,fatal:!1,frag:e,part:n,response:rr({url:u.url,data:void 0},f),error:new Error(`HTTP Error ${f.code} ${f.text}`),networkDetails:g,stats:v}))},onAbort:(f,p,g)=>{e.stats.aborted=n.stats.aborted,this.resetLoader(e,d),c(new Dv({type:er.NETWORK_ERROR,details:rt.INTERNAL_ABORTED,fatal:!1,frag:e,part:n,error:new Error("Aborted"),networkDetails:g,stats:f}))},onTimeout:(f,p,g)=>{this.resetLoader(e,d),c(new Dv({type:er.NETWORK_ERROR,details:rt.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e,part:n,error:new Error(`Timeout after ${m.timeout}ms`),networkDetails:g,stats:f}))}})})}updateStatsFromPart(e,n){const r=e.stats,s=n.stats,i=s.total;if(r.loaded+=s.loaded,i){const c=Math.round(e.duration/n.duration),d=Math.min(Math.round(r.loaded/i),c),h=(c-d)*Math.round(r.loaded/d);r.total=r.loaded+h}else r.total=Math.max(r.loaded,r.total);const o=r.loading,l=s.loading;o.start?o.first+=l.first-l.start:(o.start=l.start,o.first=l.first),o.end=l.end}resetLoader(e,n){e.loader=null,e.url=null,this.loader===n&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),n.destroy()}}function uUe(t,e=null,n){const r=e||t,s={type:ks.MEDIA_FRAGMENT,frag:t,part:e,responseType:"arraybuffer",url:r.url,headers:{},rangeStart:0,rangeEnd:0},i=aZ(t,e,n);return i.resetIV&&(s.resetIV=!0),i.byteRange&&(s.rangeStart=i.byteRange.start,s.rangeEnd=i.byteRange.end),s}function aZ(t,e=null,n){const r={},s=e||t,i=s.byteRangeStartOffset,o=s.byteRangeEndOffset;if(xn(i)&&xn(o)){var l;if((t.sn==="initSegment"||n)&&RXn((l=t.decryptdata)==null?void 0:l.method)){let c=Math.floor(i/16)*16;const d=Math.ceil(o/16)*16;r.decryptRange={start:i-c,end:o-c},c>=16&&(r.resetIV=!0,c=c-16),r.byteRange={start:c,end:d}}else r.byteRange={start:i,end:o}}return r}function hUe(t,e){const n=new Error(`GAP ${t.gap?"tag":"attribute"} found`),r={type:er.MEDIA_ERROR,details:rt.FRAG_GAP,fatal:!1,frag:t,error:n,networkDetails:null};return e&&(r.part=e),(e||t).stats.aborted=!0,new Dv(r)}function RXn(t){return t==="AES-128"||t==="AES-256"}class Dv extends Error{constructor(e){super(e.error.message),this.data=void 0,this.data=e}}class Mkt extends Fm{constructor(e,n){super(e,n),this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}destroy(){this.onHandlerDestroying(),this.onHandlerDestroyed()}onHandlerDestroying(){this.clearNextTick(),this.clearInterval()}onHandlerDestroyed(){}hasInterval(){return!!this._tickInterval}hasNextTick(){return!!this._tickTimer}setInterval(e){return this._tickInterval?!1:(this._tickCallCount=0,this._tickInterval=self.setInterval(this._boundTick,e),!0)}clearInterval(){return this._tickInterval?(self.clearInterval(this._tickInterval),this._tickInterval=null,!0):!1}clearNextTick(){return this._tickTimer?(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0):!1}tick(){this._tickCallCount++,this._tickCallCount===1?(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0):(this.log(`possible exception thrown in task-loop (${this.constructor.name}.doTick)`),this._tickCallCount=0)}tickImmediate(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)}doTick(){}}class u_e{constructor(e,n,r,s=0,i=-1,o=!1,l,c,d){this.level=void 0,this.sn=void 0,this.part=void 0,this.id=void 0,this.size=void 0,this.partial=void 0,this.iframe=void 0,this.duration=void 0,this.decryptRange=void 0,this.transmuxing=fV(),this.buffering={audio:fV(),video:fV(),audiovideo:fV()},this.level=e,this.sn=n,this.id=r,this.size=s,this.part=i,this.partial=o,this.duration=l||0,this.decryptRange=d,this.iframe=c||!1}}function fV(){return{start:0,executeStart:0,executeEnd:0,end:0}}const mUe={length:0,start:()=>0,end:()=>0};class Rr{static isBuffered(e,n){if(e){const r=Rr.getBuffered(e);for(let s=r.length;s--;)if(n>=r.start(s)&&n<=r.end(s))return!0}return!1}static bufferedRanges(e){if(e){const n=Rr.getBuffered(e);return Rr.timeRangesToArray(n)}return[]}static timeRangesToArray(e){const n=[];for(let r=0;r<e.length;r++)n.push({start:e.start(r),end:e.end(r)});return n}static bufferInfo(e,n,r){if(e){const s=Rr.bufferedRanges(e);if(s.length)return Rr.bufferedInfo(s,n,r)}return{len:0,start:n,end:n,bufferedIndex:-1}}static bufferedInfo(e,n,r){n=Math.max(0,n),e.length>1&&e.sort((u,h)=>u.start-h.start||h.end-u.end);let s=-1,i=[];if(r)for(let u=0;u<e.length;u++){n>=e[u].start&&n<=e[u].end&&(s=u);const h=i.length;if(h){const m=i[h-1].end;e[u].start-m<r?e[u].end>m&&(i[h-1].end=e[u].end):i.push(e[u])}else i.push(e[u])}else i=e;let o=0,l,c=n,d=n;for(let u=0;u<i.length;u++){const h=i[u].start,m=i[u].end;if(s===-1&&n>=h&&n<=m&&(s=u),n+r>=h&&n<m)c=h,d=m,o=d-n;else if(n+r<h){l=h;break}}return{len:o,start:c||0,end:d||0,nextStart:l,buffered:e,bufferedIndex:s}}static getBuffered(e){try{return e.buffered||mUe}catch(n){return hi.log("failed to get media.buffered",n),mUe}}}const sxe=/\{\$([a-zA-Z0-9-_]+)\}/g;function fUe(t){return sxe.lastIndex=0,sxe.test(t)}function h_e(t,e){if(t.variableList!==null||t.hasVariableRefs){const n=t.variableList;return e.replace(sxe,r=>{const s=r.substring(2,r.length-1),i=n==null?void 0:n[s];return i===void 0?(t.playlistParsingError||(t.playlistParsingError=new Error(`Missing preceding EXT-X-DEFINE tag for Variable Reference: "${s}"`)),r):i})}return e}function pUe(t,e,n){let r=t.variableList;r||(t.variableList=r={});let s,i;if("QUERYPARAM"in e){s=e.QUERYPARAM;try{const o=new self.URL(n).searchParams;if(o.has(s))i=o.get(s);else throw new Error(`"${s}" does not match any query parameter in URI: "${n}"`)}catch(o){t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE QUERYPARAM: ${o.message}`))}}else s=e.NAME,i=e.VALUE;s in r?t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE duplicate Variable Name declarations: "${s}"`)):r[s]=i||""}function IXn(t,e,n){const r=e.IMPORT;if(n&&r in n){let s=t.variableList;s||(t.variableList=s={}),s[r]=n[r]}else t.playlistParsingError||(t.playlistParsingError=new Error(`EXT-X-DEFINE IMPORT attribute not found in Multivariant Playlist: "${r}"`))}const MXn=/^(\d+)x(\d+)$/,gUe=/(.+?)=(".*?"|.*?)(?:,|$)/g;class mo{constructor(e,n){typeof e=="string"&&(e=mo.parseAttrList(e,n)),Mi(this,e)}get clientAttrs(){return Object.keys(this).filter(e=>e.substring(0,2)==="X-")}decimalInteger(e){const n=parseInt(this[e],10);return n>Number.MAX_SAFE_INTEGER?1/0:n}hexadecimalInteger(e){if(this[e]){let n=(this[e]||"0x").slice(2);n=(n.length&1?"0":"")+n;const r=new Uint8Array(n.length/2);for(let s=0;s<n.length/2;s++)r[s]=parseInt(n.slice(s*2,s*2+2),16);return r}return null}hexadecimalIntegerAsNumber(e){const n=parseInt(this[e],16);return n>Number.MAX_SAFE_INTEGER?1/0:n}decimalFloatingPoint(e){return parseFloat(this[e])}optionalFloat(e,n){const r=this[e];return r?parseFloat(r):n}enumeratedString(e){return this[e]}enumeratedStringList(e,n){const r=this[e];return(r?r.split(/[ ,]+/):[]).reduce((s,i)=>(s[i.toLowerCase()]=!0,s),n)}bool(e){return this[e]==="YES"}decimalResolution(e){const n=MXn.exec(this[e]);if(n!==null)return{width:parseInt(n[1],10),height:parseInt(n[2],10)}}static parseAttrList(e,n){let r;const s={},i='"';for(gUe.lastIndex=0;(r=gUe.exec(e))!==null;){const o=r[1].trim();let l=r[2];const c=l.indexOf(i)===0&&l.lastIndexOf(i)===l.length-1;let d=!1;if(c)l=l.slice(1,-1);else switch(o){case"IV":case"SCTE35-CMD":case"SCTE35-IN":case"SCTE35-OUT":d=!0}if(n&&(c||d))l=h_e(n,l);else if(!d&&!c)switch(o){case"CLOSED-CAPTIONS":if(l==="NONE")break;case"ALLOWED-CPC":case"CLASS":case"ASSOC-LANGUAGE":case"AUDIO":case"BYTERANGE":case"CHANNELS":case"CHARACTERISTICS":case"CODECS":case"DATA-ID":case"END-DATE":case"GROUP-ID":case"ID":case"IMPORT":case"INSTREAM-ID":case"KEYFORMAT":case"KEYFORMATVERSIONS":case"LANGUAGE":case"NAME":case"PATHWAY-ID":case"QUERYPARAM":case"RECENTLY-REMOVED-DATERANGES":case"SERVER-URI":case"STABLE-RENDITION-ID":case"STABLE-VARIANT-ID":case"START-DATE":case"SUBTITLES":case"SUPPLEMENTAL-CODECS":case"URI":case"VALUE":case"VIDEO":case"X-ASSET-LIST":case"X-ASSET-URI":hi.warn(`${e}: attribute ${o} is missing quotes`)}s[o]=l}return s}}const LXn="com.apple.hls.interstitial";function DXn(t){return t!=="ID"&&t!=="CLASS"&&t!=="CUE"&&t!=="START-DATE"&&t!=="DURATION"&&t!=="END-DATE"&&t!=="END-ON-NEXT"}function $Xn(t){return t==="SCTE35-OUT"||t==="SCTE35-IN"||t==="SCTE35-CMD"}class Lkt{constructor(e,n,r=0){var s;if(this.attr=void 0,this.tagAnchor=void 0,this.tagOrder=void 0,this._startDate=void 0,this._endDate=void 0,this._dateAtEnd=void 0,this._cue=void 0,this._badValueForSameId=void 0,this.tagAnchor=(n==null?void 0:n.tagAnchor)||null,this.tagOrder=(s=n==null?void 0:n.tagOrder)!=null?s:r,n){const i=n.attr;for(const o in i)if(Object.prototype.hasOwnProperty.call(e,o)&&e[o]!==i[o]){hi.warn(`DATERANGE tag attribute: "${o}" does not match for tags with ID: "${e.ID}"`),this._badValueForSameId=o;break}e=Mi(new mo({}),i,e)}if(this.attr=e,n?(this._startDate=n._startDate,this._cue=n._cue,this._endDate=n._endDate,this._dateAtEnd=n._dateAtEnd):this._startDate=new Date(e["START-DATE"]),"END-DATE"in e){const i=(n==null?void 0:n.endDate)||new Date(e["END-DATE"]);xn(i.getTime())&&(this._endDate=i)}}get id(){return this.attr.ID}get class(){return this.attr.CLASS}get cue(){const e=this._cue;return e===void 0?this._cue=this.attr.enumeratedStringList(this.attr.CUE?"CUE":"X-CUE",{pre:!1,post:!1,once:!1}):e}get startTime(){const{tagAnchor:e}=this;return e===null||e.programDateTime===null?(hi.warn(`Expected tagAnchor Fragment with PDT set for DateRange "${this.id}": ${e}`),NaN):e.start+(this.startDate.getTime()-e.programDateTime)/1e3}get startDate(){return this._startDate}get endDate(){const e=this._endDate||this._dateAtEnd;if(e)return e;const n=this.duration;return n!==null?this._dateAtEnd=new Date(this._startDate.getTime()+n*1e3):null}get duration(){if("DURATION"in this.attr){const e=this.attr.decimalFloatingPoint("DURATION");if(xn(e))return e}else if(this._endDate)return(this._endDate.getTime()-this._startDate.getTime())/1e3;return null}get plannedDuration(){return"PLANNED-DURATION"in this.attr?this.attr.decimalFloatingPoint("PLANNED-DURATION"):null}get endOnNext(){return this.attr.bool("END-ON-NEXT")}get isInterstitial(){return this.class===LXn}get isValid(){return!!this.id&&!this._badValueForSameId&&xn(this.startDate.getTime())&&(this.duration===null||this.duration>=0)&&(!this.endOnNext||!!this.class)&&(!this.attr.CUE||!this.cue.pre&&!this.cue.post||this.cue.pre!==this.cue.post)&&(!this.isInterstitial||"X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)}get invalidReason(){return this.id?this._badValueForSameId?`Date range ${this._badValueForSameId} mismatch`:xn(this.startDate.getTime())?this.isInterstitial&&!("X-ASSET-URI"in this.attr||"X-ASSET-LIST"in this.attr)?"Interstitial Date range missing X-ASSET-(LIST|URI)":this.isValid?null:"Unknown (check DURATION(|END|NEXT), CLASS, and CUE)":"Date range invalid start date":"Missing ID"}}const Dkt=10;class OXn{constructor(e){this.PTSKnown=!1,this.alignedSliding=!1,this.averagetargetduration=void 0,this.endCC=0,this.endSN=0,this.fragments=void 0,this.fragmentHint=void 0,this.partList=null,this.dateRanges=void 0,this.dateRangeTagCount=0,this.live=!0,this.iframesOnly=!1,this.requestScheduled=-1,this.ageHeader=0,this.advancedDateTime=void 0,this.updated=!0,this.advanced=!0,this.misses=0,this.startCC=0,this.startSN=0,this.startTimeOffset=null,this.targetduration=0,this.totalduration=0,this.type=null,this.url=void 0,this.m3u8="",this.version=null,this.canBlockReload=!1,this.canSkipUntil=0,this.canSkipDateRanges=!1,this.skippedSegments=0,this.recentlyRemovedDateranges=void 0,this.partHoldBack=0,this.holdBack=0,this.partTarget=0,this.preloadHint=void 0,this.renditionReports=void 0,this.tuneInGoal=0,this.deltaUpdateFailed=void 0,this.driftStartTime=0,this.driftEndTime=0,this.driftStart=0,this.driftEnd=0,this.encryptedFragments=void 0,this.playlistParsingError=null,this.variableList=null,this.hasVariableRefs=!1,this.appliedTimelineOffset=void 0,this.fragments=[],this.encryptedFragments=[],this.dateRanges={},this.url=e}reloaded(e){if(!e){this.advanced=!0,this.updated=!0;return}const n=this.lastPartSn-e.lastPartSn,r=this.lastPartIndex-e.lastPartIndex;this.updated=this.endSN!==e.endSN||!!r||!!n||!this.live,this.advanced=this.endSN>e.endSN||n>0||n===0&&r>0,this.updated||this.advanced?this.misses=0:this.misses=e.misses+1}hasKey(e){return this.encryptedFragments.some(n=>{let r=n.decryptdata;return r||(n.setKeyFormat(e.keyFormat),r=n.decryptdata),!!r&&e.matches(r)})}get hasProgramDateTime(){return this.fragments.length?xn(this.fragments[this.fragments.length-1].programDateTime):!1}get levelTargetDuration(){return this.averagetargetduration||this.targetduration||Dkt}get drift(){const e=this.driftEndTime-this.driftStartTime;return e>0?(this.driftEnd-this.driftStart)*1e3/e:1}get edge(){return this.partEnd||this.fragmentEnd}get partEnd(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].end:this.fragmentEnd}get fragmentEnd(){return this.fragments.length?this.fragments[this.fragments.length-1].end:0}get fragmentStart(){return this.fragments.length?this.fragments[0].start:0}get age(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}get lastPartIndex(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].index:-1}get maxPartIndex(){const e=this.partList;if(e){const n=this.lastPartIndex;if(n!==-1){for(let r=e.length;r--;)if(e[r].index>n)return e[r].index;return n}}return 0}get lastPartSn(){var e;return(e=this.partList)!=null&&e.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}get expired(){if(this.live&&this.age&&this.misses<3){const e=this.partEnd-this.fragmentStart;return this.age>Math.max(e,this.totalduration)+this.levelTargetDuration}return!1}}function oZ(t,e){return t.length===e.length?!t.some((n,r)=>n!==e[r]):!1}function vUe(t,e){return!t&&!e?!0:!t||!e?!1:oZ(t,e)}function rP(t){return t==="AES-128"||t==="AES-256"||t==="AES-256-CTR"}function m_e(t){switch(t){case"AES-128":case"AES-256":return Uk.cbc;case"AES-256-CTR":return Uk.ctr;default:throw new Error(`invalid full segment method ${t}`)}}function ixe(t){return Uint8Array.from(unescape(encodeURIComponent(t)),e=>e.charCodeAt(0))}function FXn(t){const e=ixe(t).subarray(0,16),n=new Uint8Array(16);return n.set(e,16-e.length),n}function $kt(t){const e=function(r,s,i){const o=r[s];r[s]=r[i],r[i]=o};e(t,0,3),e(t,1,2),e(t,4,5),e(t,6,7)}function Okt(t){const e=t.split(":");let n=null;if(e[0]==="data"&&e.length===2){const r=e[1].split(";"),s=r[r.length-1].split(",");if(s.length===2){const i=s[0]==="base64",o=s[1];i?(r.splice(-1,1),n=o_e(o)):n=FXn(o)}}return n}const lZ=typeof self<"u"?self:void 0;var Xa={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.fps",PLAYREADY:"com.microsoft.playready",WIDEVINE:"com.widevine.alpha"},md={CLEARKEY:"org.w3.clearkey",FAIRPLAY:"com.apple.streamingkeydelivery",PLAYREADY:"com.microsoft.playready",WIDEVINE:"urn:uuid:edef8ba9-79d6-4ace-a3c8-27dcd51d21ed"};function pV(t){switch(t){case md.FAIRPLAY:return Xa.FAIRPLAY;case md.PLAYREADY:return Xa.PLAYREADY;case md.WIDEVINE:return Xa.WIDEVINE;case md.CLEARKEY:return Xa.CLEARKEY}}var Fkt={WIDEVINE:"edef8ba979d64acea3c827dcd51d21ed"};function bde(t){switch(t){case Xa.FAIRPLAY:return md.FAIRPLAY;case Xa.PLAYREADY:return md.PLAYREADY;case Xa.WIDEVINE:return md.WIDEVINE;case Xa.CLEARKEY:return md.CLEARKEY}}function x3(t){const{drmSystems:e,widevineLicenseUrl:n}=t,r=e?[Xa.FAIRPLAY,Xa.WIDEVINE,Xa.PLAYREADY,Xa.CLEARKEY].filter(s=>!!e[s]):[];return!r[Xa.WIDEVINE]&&n&&r.push(Xa.WIDEVINE),r}const Bkt=function(t){return lZ!=null&&(t=lZ.navigator)!=null&&t.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null}();function BXn(t,e,n,r){let s;switch(t){case Xa.FAIRPLAY:s=["cenc","sinf"];break;case Xa.WIDEVINE:case Xa.PLAYREADY:s=["cenc"];break;case Xa.CLEARKEY:s=["cenc","keyids"];break;default:throw new Error(`Unknown key-system: ${t}`)}return UXn(s,e,n,r)}function UXn(t,e,n,r){return[{initDataTypes:t,persistentState:r.persistentState||"optional",distinctiveIdentifier:r.distinctiveIdentifier||"optional",sessionTypes:r.sessionTypes||[r.sessionType||"temporary"],audioCapabilities:e.map(i=>({contentType:`audio/mp4; codecs=${i}`,robustness:r.audioRobustness||"",encryptionScheme:r.audioEncryptionScheme||null})),videoCapabilities:n.map(i=>({contentType:`video/mp4; codecs=${i}`,robustness:r.videoRobustness||"",encryptionScheme:r.videoEncryptionScheme||null}))}]}function zXn(t){var e;return!!t&&(t.sessionType==="persistent-license"||!!((e=t.sessionTypes)!=null&&e.some(n=>n==="persistent-license")))}function f_e(t){const e=new Uint16Array(t.buffer,t.byteOffset,t.byteLength/2),n=jg(e),r=n.substring(n.indexOf("<"),n.length),o=new DOMParser().parseFromString(r,"text/xml").getElementsByTagName("KID")[0];if(o){const l=o.childNodes[0]?o.childNodes[0].nodeValue:o.getAttribute("VALUE");if(l){const c=o_e(l).subarray(0,16);return $kt(c),c}}return null}let wT={};class Tx{static clearKeyUriToKeyIdMap(){wT={}}static setKeyIdForUri(e,n){wT[e]=n}static addKeyIdForUri(e){const n=Object.keys(wT).length%Number.MAX_SAFE_INTEGER,r=new Uint8Array(16);return new DataView(r.buffer,12,4).setUint32(0,n),wT[e]=r,r}constructor(e,n,r,s=[1],i=null,o){this.uri=void 0,this.method=void 0,this.keyFormat=void 0,this.keyFormatVersions=void 0,this.encrypted=void 0,this.isCommonEncryption=void 0,this.iv=null,this.key=null,this.keyId=null,this.pssh=null,this.scheme=void 0,this.method=e,this.uri=n,this.keyFormat=r,this.keyFormatVersions=s,this.iv=i,this.encrypted=e?e!=="NONE":!1,this.isCommonEncryption=this.encrypted&&!rP(e),o!=null&&o.startsWith("0x")&&(this.keyId=new Uint8Array(ckt(o)))}matches(e){return e.uri===this.uri&&e.method===this.method&&e.encrypted===this.encrypted&&e.keyFormat===this.keyFormat&&oZ(e.keyFormatVersions,this.keyFormatVersions)&&vUe(e.iv,this.iv)&&vUe(e.keyId,this.keyId)}isSupported(){if(this.method){if(rP(this.method)||this.method==="NONE")return!0;if(this.keyFormat==="identity")return this.method==="SAMPLE-AES";switch(this.keyFormat){case md.FAIRPLAY:case md.WIDEVINE:case md.PLAYREADY:case md.CLEARKEY:return["SAMPLE-AES","SAMPLE-AES-CENC","SAMPLE-AES-CTR"].indexOf(this.method)!==-1}}return!1}getDecryptData(e,n){var r;if(!this.encrypted||!this.uri)return null;if(rP(this.method)){let o=this.iv;return o||(typeof e!="number"&&(hi.warn(`missing IV for initialization segment with method="${this.method}" - compliance issue`),e=0),o=HXn(e)),new Tx(this.method,this.uri,"identity",this.keyFormatVersions,o)}if(this.keyId){const o=wT[this.uri];if(o&&!oZ(this.keyId,o)&&Tx.setKeyIdForUri(this.uri,this.keyId),this.pssh)return this}const s=Okt(this.uri);if(s)switch(this.keyFormat){case md.WIDEVINE:if(this.pssh=s,!this.keyId){const o=xkt(s.buffer).filter(l=>l.systemId===Fkt.WIDEVINE);if(o.length){var i;const l=o[0];this.keyId=(i=l.kids)!=null&&i.length?l.kids[0]:null}}this.keyId||(this.keyId=yUe(n));break;case md.PLAYREADY:{const o=new Uint8Array([154,4,240,121,152,64,66,134,171,146,230,91,224,136,95,149]);this.pssh=GJn(o,null,s),this.keyId=f_e(s);break}default:{let o=s.subarray(0,16);if(o.length!==16){const l=new Uint8Array(16);l.set(o,16-o.length),o=l}this.keyId=o;break}}if(((r=this.keyId)==null?void 0:r.byteLength)!==16){let o;o=VXn(n),o||(o=yUe(n),o||(o=wT[this.uri])),o&&(this.keyId=o,Tx.setKeyIdForUri(this.uri,o))}return this}}function VXn(t){const e=t==null?void 0:t[md.WIDEVINE];return e?e.keyId:null}function yUe(t){const e=t==null?void 0:t[md.PLAYREADY];if(e){const n=Okt(e.uri);if(n)return f_e(n)}return null}function HXn(t){const e=new Uint8Array(16);for(let n=12;n<16;n++)e[n]=t>>8*(15-n)&255;return e}const bUe=/#EXT-X-STREAM-INF:([^\r\n]*)(?:[\r\n](?:#[^\r\n]*)?)*([^\r\n]+)|#EXT-X-(I-FRAME-STREAM-INF|SESSION-DATA|SESSION-KEY|DEFINE|CONTENT-STEERING|START):([^\r\n]*)(?:[\r\n]+|$)/g,xUe=/#EXT-X-MEDIA:(.*)/g,GXn=/^#EXT(?:INF|-X-TARGETDURATION):/m,xde=new RegExp([/#EXTINF:\s*(\d*(?:\.\d+)?)(?:,(.*)\s+)?/.source,/(?!#) *(\S[^\r\n]*)/.source,/#.*/.source].join("|"),"g"),WXn=new RegExp([/#EXT-X-(PROGRAM-DATE-TIME|BYTERANGE|DATERANGE|DEFINE|KEY|MAP|PART|PART-INF|PLAYLIST-TYPE|PRELOAD-HINT|RENDITION-REPORT|SERVER-CONTROL|SKIP|START):(.+)/.source,/#EXT-X-(BITRATE|DISCONTINUITY-SEQUENCE|MEDIA-SEQUENCE|TARGETDURATION|VERSION): *(\d+)/.source,/#EXT-X-(DISCONTINUITY|ENDLIST|GAP|INDEPENDENT-SEGMENTS|I-FRAMES-ONLY)/.source,/(#)([^:]*):(.*)/.source,/(#)(.*)(?:.*)\r?\n?/.source].join("|"));class sy{static findGroup(e,n){for(let r=0;r<e.length;r++){const s=e[r];if(s.id===n)return s}}static resolve(e,n){return n_e.buildAbsoluteURL(n,e,{alwaysNormalize:!0})}static isMediaPlaylist(e){return GXn.test(e)}static parseMasterPlaylist(e,n){const r=fUe(e),s={contentSteering:null,levels:[],iframeVariants:[],playlistParsingError:null,sessionData:null,sessionKeys:null,startTimeOffset:null,variableList:null,hasVariableRefs:r},i=[];if(bUe.lastIndex=0,!e.startsWith("#EXTM3U"))return s.playlistParsingError=new Error("no EXTM3U delimiter"),s;let o;for(;(o=bUe.exec(e))!=null;)if(o[1]){const c=new mo(o[1],s),d=wUe(c,o[2],n,s,i);d&&s.levels.push(d)}else if(o[3]){const c=o[3],d=o[4];switch(c){case"I-FRAME-STREAM-INF":{const u=new mo(d,s),h=wUe(u,u.URI,n,s,i,!0);h&&s.iframeVariants.push(h)}break;case"SESSION-DATA":{const u=new mo(d,s),h=u["DATA-ID"];h&&(s.sessionData===null&&(s.sessionData={}),s.sessionData[h]=u);break}case"SESSION-KEY":{const u=kUe(d,n,s);u.encrypted&&u.isSupported()?(s.sessionKeys===null&&(s.sessionKeys=[]),s.sessionKeys.push(u)):hi.warn(`[Keys] Ignoring invalid EXT-X-SESSION-KEY tag: "${d}"`);break}case"DEFINE":{{const u=new mo(d,s);pUe(s,u,n)}break}case"CONTENT-STEERING":{const u=new mo(d,s);s.contentSteering={uri:sy.resolve(u["SERVER-URI"],n),pathwayId:u["PATHWAY-ID"]||"."};break}case"START":{s.startTimeOffset=SUe(d);break}}}const l=i.length>0&&i.length<s.levels.length;return s.levels=l?i:s.levels,s.levels.length===0&&(s.playlistParsingError=new Error("no levels found in manifest")),s}static parseMasterPlaylistMedia(e,n,r){let s;const i={},o=r.levels,l={AUDIO:o.map(d=>({id:d.attrs.AUDIO,audioCodec:d.audioCodec})),SUBTITLES:o.map(d=>({id:d.attrs.SUBTITLES,textCodec:d.textCodec})),"CLOSED-CAPTIONS":[]};let c=0;for(xUe.lastIndex=0;(s=xUe.exec(e))!==null;){const d=new mo(s[1],r),u=d.TYPE;if(u){const h=l[u],m=i[u]||[];i[u]=m;const f=d.LANGUAGE,p=d["ASSOC-LANGUAGE"],g=d.CHANNELS,v=d.CHARACTERISTICS,b=d["INSTREAM-ID"],x={attrs:d,bitrate:0,id:c++,groupId:d["GROUP-ID"]||"",name:d.NAME||f||"",type:u,default:d.bool("DEFAULT"),autoselect:d.bool("AUTOSELECT"),forced:d.bool("FORCED"),lang:f,url:d.URI?sy.resolve(d.URI,n):""};if(p&&(x.assocLang=p),g&&(x.channels=g),v&&(x.characteristics=v),b&&(x.instreamId=b),h!=null&&h.length){const w=sy.findGroup(h,x.groupId)||h[0];jUe(x,w,"audioCodec"),jUe(x,w,"textCodec")}m.push(x)}}return i}static parseLevelPlaylist(e,n,r,s,i,o){var l;const c={url:n},d=new OXn(n),u=d.fragments,h=[];let m=null,f=0,p=0,g=0,v=0,b=0,x=null,w=new lV(s,c),k,S,C,j=-1,E=!1,N=null,A;if(xde.lastIndex=0,d.m3u8=e,d.hasVariableRefs=fUe(e),((l=xde.exec(e))==null?void 0:l[0])!=="#EXTM3U")return d.playlistParsingError=new Error("Missing format identifier #EXTM3U"),d;for(;(k=xde.exec(e))!==null;){E&&(E=!1,w=new lV(s,c),w.playlistOffset=g,w.setStart(g),w.sn=f,w.cc=v,b&&(w.bitrate=b),w.level=r,m&&(w.initSegment=m,m.rawProgramDateTime&&(w.rawProgramDateTime=m.rawProgramDateTime,m.rawProgramDateTime=null),N&&(w.setByteRange(N),N=null)));const F=k[1];if(F){w.duration=parseFloat(F);const D=(" "+k[2]).slice(1);w.title=D||null,w.tagList.push(D?["INF",F,D]:["INF",F])}else if(k[3]){if(xn(w.duration)){var _;w.playlistOffset=g,w.setStart(g),C&&NUe(w,C,d),w.sn=f,w.level=r,w.cc=v;const D=(" "+k[3]).slice(1);w.relurl=h_e(d,D),axe(w,x,h),x=w,g+=w.duration,f++,p=0;const I=w.byteRange;if(I.length===2&&(w.bitrate=(I[1]-I[0])*8/w.duration|0),d.iframesOnly&&I[0]&&((_=m)==null?void 0:_.cc)!==v){const P=new lV(s,c);P.relurl=w.relurl,P.setByteRange(`${Math.min(I[0],7*188)}@0`),P.level=r,P.sn="initSegment",C&&(P.levelkeys=C,C.identity&&(P._decryptdata=C.identity.getDecryptData(0))),m=P,w.initSegment=m}u.push(w),E=!0}}else{if(k=k[0].match(WXn),!k){hi.warn("No matches on slow regex match for level playlist!");continue}for(S=1;S<k.length&&k[S]===void 0;S++);const D=(" "+k[S]).slice(1),I=(" "+k[S+1]).slice(1),P=k[S+2]?(" "+k[S+2]).slice(1):null;switch(D){case"BYTERANGE":x?w.setByteRange(I,x):w.setByteRange(I);break;case"PROGRAM-DATE-TIME":w.rawProgramDateTime=I,w.tagList.push(["PROGRAM-DATE-TIME",I]),j===-1&&(j=u.length);break;case"PLAYLIST-TYPE":d.type&&fb(d,D,k),d.type=I.toUpperCase();break;case"MEDIA-SEQUENCE":d.startSN!==0?fb(d,D,k):x!==null&&YXn(d,D,k),d.startSN=parseInt(I),f=d.startSN+d.skippedSegments;break;case"SKIP":{d.skippedSegments&&fb(d,D,k);const M=new mo(I,d),z=M.decimalInteger("SKIPPED-SEGMENTS");if(xn(z)){d.skippedSegments+=z;for(let B=z;B--;)u.push(null);f+=z}const G=M.enumeratedString("RECENTLY-REMOVED-DATERANGES");G&&(d.recentlyRemovedDateranges=(d.recentlyRemovedDateranges||[]).concat(G.split("	")));break}case"TARGETDURATION":d.targetduration!==0&&fb(d,D,k),d.targetduration=Math.max(parseInt(I),1);break;case"VERSION":d.version!==null&&fb(d,D,k),d.version=parseInt(I);break;case"INDEPENDENT-SEGMENTS":break;case"I-FRAMES-ONLY":d.iframesOnly=!0;break;case"ENDLIST":d.live||fb(d,D,k),d.live=!1;break;case"#":(I||P)&&w.tagList.push(P?[I,P]:[I]);break;case"DISCONTINUITY":v++,w.tagList.push(["DIS"]);break;case"GAP":w.gap=!0,w.tagList.push([D]);break;case"BITRATE":w.tagList.push([D,I]),b=parseInt(I)*1e3,xn(b)?w.bitrate=b:b=0;break;case"DATERANGE":{const M=new mo(I,d),z=new Lkt(M,d.dateRanges[M.ID],d.dateRangeTagCount);d.dateRangeTagCount++,z.isValid||d.skippedSegments?d.dateRanges[z.id]=z:hi.log(`Ignoring invalid DATERANGE tag: ${z.invalidReason}: ${I}`),w.tagList.push(["EXT-X-DATERANGE",I]);break}case"DEFINE":{{const M=new mo(I,d);"IMPORT"in M?IXn(d,M,o):pUe(d,M,n)}break}case"DISCONTINUITY-SEQUENCE":d.startCC!==0&&fb(d,D,k),d.startCC=v=parseInt(I),u.forEach(M=>M&&(M.cc=v));break;case"KEY":{const M=kUe(I,n,d);if(M.isSupported()){if(M.method==="NONE"){C=void 0;break}C||(C={});const z=C[M.keyFormat];z!=null&&z.matches(M)||(z&&(C=Mi({},C)),C[M.keyFormat]=M)}else hi.warn(`[Keys] Ignoring unsupported EXT-X-KEY tag: "${I}"`);break}case"START":d.startTimeOffset=SUe(I);break;case"MAP":{const M=new mo(I,d);if(w.duration){const z=new lV(s,c);EUe(z,M,r,C),m=z,w.initSegment=m,m.rawProgramDateTime&&!w.rawProgramDateTime&&(w.rawProgramDateTime=m.rawProgramDateTime)}else{const z=w.byteRangeEndOffset;if(z){const G=w.byteRangeStartOffset;N=`${z-G}@${G}`}else N=null;EUe(w,M,r,C),m=w,E=!0}m.cc=v;break}case"SERVER-CONTROL":{A&&fb(d,D,k),A=new mo(I),d.canBlockReload=A.bool("CAN-BLOCK-RELOAD"),d.canSkipUntil=A.optionalFloat("CAN-SKIP-UNTIL",0),d.canSkipDateRanges=d.canSkipUntil>0&&A.bool("CAN-SKIP-DATERANGES"),d.partHoldBack=A.optionalFloat("PART-HOLD-BACK",0),d.holdBack=A.optionalFloat("HOLD-BACK",0);break}case"PART-INF":{d.partTarget&&fb(d,D,k);const M=new mo(I);d.partTarget=M.decimalFloatingPoint("PART-TARGET");break}case"PART":{let M=d.partList;M||(M=d.partList=[]);const z=p>0?M[M.length-1]:void 0,G=p++,B=new mo(I,d),H=new XZn(B,w,c,G,z);M.push(H),w.duration+=H.duration;break}case"PRELOAD-HINT":{const M=new mo(I,d);d.preloadHint=M;break}case"RENDITION-REPORT":{const M=new mo(I,d);d.renditionReports=d.renditionReports||[],d.renditionReports.push(M);break}default:hi.warn(`line parsed but not handled: ${k}`);break}}}x&&!x.relurl?(u.pop(),g-=x.duration,d.partList&&(d.fragmentHint=x)):d.partList&&(axe(w,x,h),w.cc=v,d.fragmentHint=w,C&&NUe(w,C,d)),d.targetduration||(d.playlistParsingError=new Error("Missing Target Duration"));const T=u.length,R=u[0],O=u[T-1];if(g+=d.skippedSegments*d.targetduration,g>0&&T&&O){d.averagetargetduration=g/T;const F=O.sn;d.endSN=F!=="initSegment"?F:0,d.live||(O.endList=!0),j>0&&(KXn(u,j,j>T-1?w:null),R&&h.unshift(R))}return d.fragmentHint&&(g+=d.fragmentHint.duration),d.totalduration=g,h.length&&d.dateRangeTagCount&&R&&Ukt(h,d),d.endCC=v,d}}function wUe(t,e,n,r,s,i){var o;if(e===void 0)return null;const l=h_e(r,e),c={attrs:t,bitrate:t.decimalInteger("BANDWIDTH")||t.decimalInteger("AVERAGE-BANDWIDTH"),name:t.NAME,url:sy.resolve(l,n)},d=t.decimalResolution("RESOLUTION");d&&(c.width=d.width,c.height=d.height),CUe(t.CODECS,c);const u=t["SUPPLEMENTAL-CODECS"];return u&&(c.supplemental={},CUe(u,c.supplemental)),(o=c.unknownCodecs)!=null&&o.length||s.push(c),i&&(c.iframes=!0),c}function Ukt(t,e){let n=t.length;if(!n)if(e.hasProgramDateTime){const l=e.fragments[e.fragments.length-1];t.push(l),n++}else return;const r=t[n-1],s=e.live?1/0:e.totalduration,i=Object.keys(e.dateRanges);for(let l=i.length;l--;){const c=e.dateRanges[i[l]],d=c.startDate.getTime();c.tagAnchor=r.ref;for(let u=n;u--;){var o;if(((o=t[u])==null?void 0:o.sn)<e.startSN)break;const h=qXn(e,d,t,u,s);if(h){c.tagAnchor=h.ref;break}}}}function qXn(t,e,n,r,s){const i=n[r];if(i){const l=i.programDateTime;if(e>=l||r===0){var o;const c=(((o=n[r+1])==null?void 0:o.start)||s)-i.start;if(e<=l+c*1e3){const d=i.sn-t.startSN,u=t.fragments;if(d>=0&&d<u.length){if(u.length>n.length){const h=n[r+1]||u[u.length-1],m=Math.min(h.sn-t.startSN,u.length-1);for(let f=m;f>d;f--){const p=u[f].programDateTime;if(e>=p&&e<p+u[f].duration*1e3)return u[f]}}return u[d]}}}}return null}function kUe(t,e,n){var r,s;const i=new mo(t,n),o=(r=i.METHOD)!=null?r:"",l=i.URI,c=i.hexadecimalInteger("IV"),d=i.KEYFORMATVERSIONS,u=(s=i.KEYFORMAT)!=null?s:"identity";l&&i.IV&&!c&&hi.error(`Invalid IV: ${i.IV}`);const h=l?sy.resolve(l,e):"",m=(d||"1").split("/").map(Number).filter(Number.isFinite);return new Tx(o,h,u,m,c,i.KEYID)}function SUe(t){const n=new mo(t).decimalFloatingPoint("TIME-OFFSET");return xn(n)?n:null}function CUe(t,e){let n=(t||"").split(/[ ,]+/).filter(r=>r);["video","audio","text","image"].forEach(r=>{const s=n.filter(i=>l_e(i,r));s.length&&(e[`${r}Codec`]=s.map(i=>i.split("/")[0]).join(","),n=n.filter(i=>s.indexOf(i)===-1))}),e.unknownCodecs=n}function jUe(t,e,n){const r=e[n];r&&(t[n]=r)}function KXn(t,e,n){if(n||(n=t[e]),!!n)for(let r=e;r--;){const s=t[r];if(!s)return;s.programDateTime=n.programDateTime-s.duration*1e3,n=s}}function axe(t,e,n){t.rawProgramDateTime?n.push(t):e!=null&&e.programDateTime&&(t.programDateTime=e.endProgramDateTime)}function EUe(t,e,n,r){t.relurl=e.URI,e.BYTERANGE&&t.setByteRange(e.BYTERANGE),t.level=n,t.sn="initSegment",r&&(t.levelkeys=r),t.initSegment=null}function NUe(t,e,n){t.levelkeys=e;const{encryptedFragments:r}=n;(!r.length||r[r.length-1].levelkeys!==e)&&Object.keys(e).some(s=>e[s].isCommonEncryption)&&r.push(t)}function fb(t,e,n){t.playlistParsingError=new Error(`#EXT-X-${e} must not appear more than once (${n[0]})`)}function YXn(t,e,n){t.playlistParsingError=new Error(`#EXT-X-${e} must appear before the first Media Segment (${n[0]})`)}function wde(t,e){const n=e.startPTS;if(xn(n)){let r=0,s;e.sn>t.sn?(r=n-t.start,s=t):(r=t.start-n,s=e),s.duration!==r&&s.setDuration(r)}else e.sn>t.sn?t.cc===e.cc&&t.minEndPTS?e.setStart(t.start+(t.minEndPTS-t.start)):e.setStart(t.start+t.duration):e.setStart(Math.max(t.start-e.duration,0))}function zkt(t,e,n,r,s,i,o,l){r-n<=0&&(l.warn("Fragment should have a positive duration",e),r=n+e.duration,i=s+e.duration);let d=n,u=r;const h=e.startPTS,m=e.endPTS;if(xn(h)){const x=Math.abs(h-n);t&&x>t.totalduration?l.warn(`media timestamps and playlist times differ by ${x}s for level ${e.level} ${t.url}`):xn(e.deltaPTS)?e.deltaPTS=Math.max(x,e.deltaPTS):e.deltaPTS=x,d=Math.max(n,h),n=Math.min(n,h),s=e.startDTS!==void 0?Math.min(s,e.startDTS):s,u=Math.min(r,m),r=Math.max(r,m),i=e.endDTS!==void 0?Math.max(i,e.endDTS):i}const f=n-e.start;e.start!==0&&e.setStart(n),e.setDuration(r-e.start),e.startPTS=n,e.maxStartPTS=d,e.startDTS=s,e.endPTS=r,e.minEndPTS=u,e.endDTS=i;const p=e.sn;if(!t||p<t.startSN||p>t.endSN)return 0;let g;const v=p-t.startSN,b=t.fragments;for(b[v]=e,g=v;g>0;g--)wde(b[g],b[g-1]);for(g=v;g<b.length-1;g++)wde(b[g],b[g+1]);return t.fragmentHint&&wde(b[b.length-1],t.fragmentHint),t.PTSKnown=t.alignedSliding=!0,f}function QXn(t,e,n){if(t===e)return;let r=null;const s=t.fragments;for(let u=s.length-1;u>=0;u--){const h=s[u].initSegment;if(h){r=h;break}}t.fragmentHint&&delete t.fragmentHint.endPTS;let i;XXn(t,e,(u,h,m,f)=>{if((!e.startCC||e.skippedSegments)&&h.cc!==u.cc){const p=u.cc-h.cc;for(let g=m;g<f.length;g++)f[g].cc+=p;e.endCC=f[f.length-1].cc}xn(u.startPTS)&&xn(u.endPTS)&&(h.setStart(h.startPTS=u.startPTS),h.startDTS=u.startDTS,h.maxStartPTS=u.maxStartPTS,h.endPTS=u.endPTS,h.endDTS=u.endDTS,h.minEndPTS=u.minEndPTS,h.setDuration(u.endPTS-u.startPTS),h.duration&&(i=h),e.PTSKnown=e.alignedSliding=!0),u.hasStreams&&(h.elementaryStreams=u.elementaryStreams),h.loader=u.loader,u.hasStats&&(h.stats=u.stats),u.initSegment&&(h.initSegment=u.initSegment,r=u.initSegment)});const o=e.fragments,l=e.fragmentHint?o.concat(e.fragmentHint):o;if(r&&l.forEach(u=>{var h;u&&(!u.initSegment||u.initSegment.relurl===((h=r)==null?void 0:h.relurl))&&(u.initSegment=r)}),e.skippedSegments){if(e.deltaUpdateFailed=o.some(u=>!u),e.deltaUpdateFailed){n.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(let u=e.skippedSegments;u--;)o.shift();e.startSN=o[0].sn}else{e.canSkipDateRanges&&(e.dateRanges=ZXn(t.dateRanges,e,n));const u=t.fragments.filter(h=>h.rawProgramDateTime);if(t.hasProgramDateTime&&!e.hasProgramDateTime)for(let h=1;h<l.length;h++)l[h].programDateTime===null&&axe(l[h],l[h-1],u);Ukt(u,e)}e.endCC=o[o.length-1].cc}if(!e.startCC){var c;const u=Gkt(t,e.startSN-1);e.startCC=(c=u==null?void 0:u.cc)!=null?c:o[0].cc}if(JXn(t.partList,e.partList,(u,h)=>{h.elementaryStreams=u.elementaryStreams,h.stats=u.stats,h.gap=u.gap||h.gap}),i){const u=e.iframesOnly&&i.type===Wn.MAIN;zkt(e,i,i.startPTS,i.endPTS,i.startDTS,i.endDTS,u,n)}else Vkt(t,e);o.length&&(e.totalduration=e.edge-o[0].start),e.driftStartTime=t.driftStartTime,e.driftStart=t.driftStart;const d=e.advancedDateTime;if(e.advanced&&d){const u=e.edge;e.driftStart||(e.driftStartTime=d,e.driftStart=u),e.driftEndTime=d,e.driftEnd=u}else e.driftEndTime=t.driftEndTime,e.driftEnd=t.driftEnd,e.advancedDateTime=t.advancedDateTime;e.requestScheduled===-1&&(e.requestScheduled=t.requestScheduled)}function ZXn(t,e,n){const{dateRanges:r,recentlyRemovedDateranges:s}=e,i=Mi({},t);s&&s.forEach(c=>{delete i[c]});const l=Object.keys(i).length;return l?(Object.keys(r).forEach(c=>{const d=i[c],u=new Lkt(r[c].attr,d);u.isValid?(i[c]=u,d||(u.tagOrder+=l)):n.warn(`Ignoring invalid Playlist Delta Update DATERANGE tag: "${ya(r[c].attr)}"`)}),i):r}function JXn(t,e,n){if(t&&e){let r=0;for(let s=0,i=t.length;s<i;s++){const o=t[s],l=e[s+r];o&&l&&o.index===l.index&&o.fragment.sn===l.fragment.sn?n(o,l):r--}}}function XXn(t,e,n){var r;const s=e.skippedSegments,i=Math.max(t.startSN,e.startSN)-e.startSN,o=(t.fragmentHint?1:0)+(s?e.endSN:Math.min(t.endSN,e.endSN))-e.startSN,l=e.startSN-t.startSN,c=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,d=(r=t.fragmentHint)!=null&&r.duration?t.fragments.concat(t.fragmentHint):t.fragments;for(let u=i;u<=o;u++){const h=d[l+u];let m=c[u];if(s&&!m&&h&&(m=e.fragments[u]=h),h&&m){n(h,m,u,c);const f=h.relurl,p=m.relurl;if(f&&ter(f,p)){e.playlistParsingError=TUe(`media sequence mismatch ${m.sn}:`,t,e,h,m);return}else if(h.cc!==m.cc){e.playlistParsingError=TUe(`discontinuity sequence mismatch (${h.cc}!=${m.cc})`,t,e,h,m);return}}}}function TUe(t,e,n,r,s){return new Error(`${t} ${s.url}
Playlist starting @${e.startSN}
${e.m3u8}

Playlist starting @${n.startSN}
${n.m3u8}`)}function Vkt(t,e,n=!0,r){const s=e.startSN+e.skippedSegments-t.startSN,i=t.fragments,o=s>=0;let l=0;if(o&&s<i.length)l=i[s].start,r==null||r.log(`Aligning playlists based on SN ${e.startSN} (diff: ${l})`);else if(o&&e.startSN===t.endSN+1)l=t.fragmentEnd,r==null||r.log(`Aligning playlists based on first/last SN ${e.startSN} (diff: ${l})`);else if(o&&n)l=t.fragmentStart+s*e.levelTargetDuration;else if(!e.skippedSegments&&e.fragmentStart===0)l=t.fragmentStart,r==null||r.log(`Aligning playlists based on first SN ${e.startSN} (diff: ${l})`);else return l;return eer(e,l),l}function eer(t,e){if(e){const n=t.fragments;for(let r=t.skippedSegments;r<n.length;r++)n[r].addStart(e);t.fragmentHint&&t.fragmentHint.addStart(e)}}function Hkt(t,e=1/0){let n=1e3*t.targetduration;if(t.updated){const r=t.fragments;if(r.length&&n*4>e){const i=r[r.length-1].duration*1e3;i>0&&i<n&&(n=i)}}else n/=2;return Math.round(n)}function Gkt(t,e,n){var r;if(!t)return null;let s=t.fragments[e-t.startSN];return s||(s=t.fragmentHint,((r=s)==null?void 0:r.sn)===e)?s:n&&e<t.startSN&&n.sn===e?n:null}function _Ue(t,e,n){return t?Wkt(t.partList,e,n):null}function Wkt(t,e,n){if(t)for(let r=t.length;r--;){const s=t[r];if(s.index===n&&s.fragment.sn===e)return s}return null}function qkt(t){t.forEach((e,n)=>{var r;(r=e.details)==null||r.fragments.forEach(s=>{s.level=n,s.initSegment&&(s.initSegment.level=n)})})}function ter(t,e){return t!==e&&e?AUe(t)!==AUe(e):!1}function AUe(t){return t.replace(/\?[^?]*$/,"")}function b$(t,e){for(let r=0,s=t.length;r<s;r++){var n;if(((n=t[r])==null?void 0:n.cc)===e)return t[r]}return null}function ner(t,e){return!!(t&&e.startCC<t.endCC&&e.endCC>t.startCC)}function PUe(t,e){const n=t.start+e;t.setStart(n)}function Kkt(t,e){const n=e.fragments;for(let r=0,s=n.length;r<s;r++)PUe(n[r],t);e.fragmentHint&&PUe(e.fragmentHint,t),e.alignedSliding=!0}function cZ(t,e,n){t&&(rer(e,t,n),e.alignedSliding||ser(e,t,n),!e.alignedSliding&&!e.skippedSegments&&Vkt(t,e,!1,n))}function rer(t,e,n){if(!ner(e,t))return;const r=Math.min(e.endCC,t.endCC),s=b$(e.fragments,r),i=b$(t.fragments,r);if(!s||!i)return;const o=s.start-i.start;n.log(`Aligning playlists using dicontinuity sequence ${r} (diff: ${o})`),Kkt(o,t)}function ser(t,e,n){if(!t.hasProgramDateTime||!e.hasProgramDateTime)return;const r=t.fragments,s=e.fragments;if(!r.length||!s.length)return;let i,o;const l=Math.min(e.endCC,t.endCC);e.startCC<l&&t.startCC<l&&(i=b$(s,l),o=b$(r,l)),(!i||!o)&&(i=s[Math.floor(s.length/2)]||s.filter(m=>!!m)[0],o=b$(r,i.cc)||r[Math.floor(r.length/2)]);const c=i.programDateTime,d=o.programDateTime;if(!c||!d)return;const u=(d-c)/1e3;if(Math.abs(u)>Math.max(60,t.totalduration)){n.log(`Cannot align playlists using PDT without overlap (${Math.abs(u)} > ${t.totalduration})`);return}const h=u-(o.start-i.start);n.log(`Aligning playlists using PDT (diff: ${h})`),Kkt(h,t)}function Si(t,e,n){pi(t,e,n),t.addEventListener(e,n)}function pi(t,e,n){t.removeEventListener(e,n)}function dZ(t){let e="";const n=t.length;for(let r=0;r<n;r++)e+=`[${t.start(r).toFixed(3)}-${t.end(r).toFixed(3)}]`;return e}const Ct={STOPPED:"STOPPED",IDLE:"IDLE",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR",WAITING_INIT_PTS:"WAITING_INIT_PTS",WAITING_LEVEL:"WAITING_LEVEL"};class p_e extends Mkt{constructor(e,n,r,s,i){super(s,e.logger),this.hls=void 0,this.fragPrevious=null,this.fragCurrent=null,this.fragPlaying=null,this.fragmentTracker=void 0,this.transmuxer=null,this._state=Ct.STOPPED,this.playlistType=void 0,this.media=null,this.mediaBuffer=null,this.config=void 0,this.bitrateTest=!1,this.lastCurrentTime=0,this.nextLoadPosition=0,this.startPosition=-1,this.startTimeOffset=null,this.retryDate=0,this.levels=null,this.fragmentLoader=void 0,this.initFragmentLoader=void 0,this.keyLoader=void 0,this.levelLastLoaded=null,this.startFragRequested=!1,this.decrypter=void 0,this.initPTS=[],this.buffering=!0,this.loadingParts=!1,this.loopSn=void 0,this.onMediaSeeking=()=>{const{config:o,fragCurrent:l,media:c,mediaBuffer:d,state:u}=this,h=c?c.currentTime:0,m=Rr.bufferInfo(d||c,h,o.maxBufferHole),f=m.len;if(this.log(`Media seeking to ${h}, state: ${u}, ${f?"in":"out of"} buffer`),this.state===Ct.ENDED)this.resetLoadingState();else if(l){const g=o.maxFragLookUpTolerance,v=l.start-g,b=l.start+l.duration+g;if(!f||b<m.start||v>m.end){const x=h<v,w=h>b;(x||w)&&(l.loader&&(w||!this.isFragmentNearlyDownloaded(l))?(this.log(`Cancelling fragment load for seek (sn: ${l.sn}) - ${x?"backward":"forward"} seek`),l.abortRequests(),this.resetLoadingState()):this.fragPrevious=null)}}if(c){this.fragmentTracker.removeFragmentsInRange(h,1/0,this.playlistType,!0);const g=this.lastCurrentTime;if(h>g&&(this.lastCurrentTime=h),!this.loadingParts){const v=Math.max(m.end,h),b=this.shouldLoadParts(this.getLevelDetails(),v);b&&(this.log(`LL-Part loading ON after seeking to ${h} with buffer @${v}`),this.loadingParts=b)}}const p=!Rr.isBuffered(c,h);(!this.hls.hasEnoughToStart||p)&&(this.log(`Setting ${p?"startPosition":"nextLoadPosition"} to ${h} for seek without enough to start`),this.nextLoadPosition=h,p&&(this.startPosition=h)),f<1&&this.state===Ct.IDLE&&this.tickImmediate()},this.onMediaEnded=()=>{this.log("setting startPosition to 0 because media ended"),this.startPosition=this.lastCurrentTime=0},this.playlistType=i,this.hls=e,this.fragmentLoader=new dUe(e.config),this.initFragmentLoader=new dUe(e.config),this.keyLoader=r,this.fragmentTracker=n,this.config=e.config,this.decrypter=new d_e(e.config)}registerListeners(){const{hls:e}=this;e.on(oe.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(oe.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.on(oe.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(oe.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(oe.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(oe.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.off(oe.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(oe.ERROR,this.onError,this)}doTick(){this.onTickEnd()}onTickEnd(){}startLoad(e){}stopLoad(){if(this.state===Ct.STOPPED)return;this.fragmentLoader.abort(),this.initFragmentLoader.abort(),this.keyLoader.abort(this.playlistType);const e=this.fragCurrent;e!=null&&e.loader&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.resetTransmuxer(),this.fragCurrent=null,this.fragPrevious=null,this.clearInterval(),this.clearNextTick(),this.state=Ct.STOPPED}get startPositionValue(){const{nextLoadPosition:e,startPosition:n}=this;if(n===-1&&e){const r=this.getLevelDetails();return r!=null&&r.live?(this.hls.liveSyncPosition||r.fragmentStart)+this.timelineOffset:e}return n}get bufferingEnabled(){return this.buffering}get backtrackFragment(){}set backtrackFragment(e){}get couldBacktrack(){return!1}set couldBacktrack(e){}pauseBuffering(){this.buffering=!1}resumeBuffering(){this.buffering=!0}get inFlightFrag(){return{frag:this.fragCurrent,state:this.state}}_streamEnded(e,n){if(n.live||!this.media)return!1;const r=e.end||0,s=this.config.timelineOffset||0;if(r<=s)return!1;const i=e.buffered;this.config.maxBufferHole&&i&&i.length>1&&(e=Rr.bufferedInfo(i,e.start,0));const o=e.nextStart;if(o&&o>s&&o<n.edge||this.media.currentTime<e.start)return!1;const c=n.partList;if(c!=null&&c.length){const u=c[c.length-1];return Rr.isBuffered(this.media,u.start+u.duration/2)}const d=n.fragments[n.fragments.length-1];return this.fragmentTracker.isEndListAppended(d.type)}getLevelDetails(){if(this.levels&&this.levelLastLoaded!==null)return this.levelLastLoaded.details}get timelineOffset(){const e=this.config.timelineOffset;if(e){var n;return((n=this.getLevelDetails())==null?void 0:n.appliedTimelineOffset)||e}return 0}onMediaAttached(e,n){const r=this.media=this.mediaBuffer=n.media;Si(r,"seeking",this.onMediaSeeking),Si(r,"ended",this.onMediaEnded);const s=this.config;this.levels&&s.autoStartLoad&&this.state===Ct.STOPPED&&this.startLoad(s.startPosition)}onMediaDetaching(e,n){this.fragPlaying=null;const r=!!n.transferMedia,s=this.media;if(s!==null){if(s.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),pi(s,"seeking",this.onMediaSeeking),pi(s,"ended",this.onMediaEnded),this.media=this.mediaBuffer=null,this.loopSn=void 0,r){this.resetLoadingState(),this.resetTransmuxer();return}this.loadingParts=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()}}onManifestLoading(){this.initPTS=[],this.fragPlaying=this.levels=this.levelLastLoaded=this.fragCurrent=null,this.lastCurrentTime=0,this.startPosition=-1,this.startFragRequested=!1}onError(e,n){}onManifestLoaded(e,n){this.startTimeOffset=n.startTimeOffset}onHandlerDestroying(){this.stopLoad(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),super.onHandlerDestroying(),this.hls=this.onMediaSeeking=this.onMediaEnded=null}onHandlerDestroyed(){this.state=Ct.STOPPED,this.fragmentLoader&&this.fragmentLoader.destroy(),this.initFragmentLoader&&this.initFragmentLoader.destroy(),this.keyLoader&&this.keyLoader.destroy(),this.decrypter&&this.decrypter.destroy(),this.hls=this.decrypter=this.keyLoader=null,this.fragmentLoader=this.initFragmentLoader=this.fragmentTracker=null,super.onHandlerDestroyed()}loadFragment(e,n,r){this.startFragRequested=!0,this._loadFragForPlayback(e,n,r)}_loadFragForPlayback(e,n,r){const s=i=>{const o=i.frag;if(this.fragContextChanged(o)){this.warn(`${o.type} sn: ${o.sn}${i.part?" part: "+i.part.index:""} of ${this.fragInfo(o,!1,i.part)} was dropped during download.`),this.fragmentTracker.removeFragment(o);return}const l=++o.stats.chunkCount;this.log(`load progress ${o.type} sn: ${o.sn}${i.part?" part: "+i.part.index:""} of ${this.fragInfo(o,!1,i.part)} chunk: ${l}`),this._handleFragmentLoadProgress(i)};this._doFragLoad(e,n,r,s).then(i=>{if(!i)return;const o=this.state,l=i.frag;if(this.fragContextChanged(l)){(o===Ct.FRAG_LOADING||!this.fragCurrent&&o===Ct.PARSING)&&(this.fragmentTracker.removeFragment(l),this.state=Ct.IDLE);return}"payload"in i&&(this.log(`Loaded ${l.type} sn: ${l.sn} of ${this.playlistLabel()} ${l.level} (bytes ${l.stats.loaded})`),this.hls.trigger(oe.FRAG_LOADED,i)),this._handleFragmentLoadComplete(i)}).catch(i=>{this.state===Ct.STOPPED||this.state===Ct.ERROR||(this.log(`Frag error ${e.type} sn:${e.sn} cc:${e.cc}: ${(i==null?void 0:i.message)||i}`),this.resetFragmentLoading(e))})}clearTrackerIfNeeded(e){var n;const{fragmentTracker:r}=this;if(r.getState(e)===po.APPENDING){const i=e.type,o=this.getFwdBufferInfo(this.mediaBuffer,i),l=Math.max(e.duration,o?o.len:this.config.maxBufferLength),c=this.backtrackFragment;((c?e.sn-c.sn:0)===1||this.reduceMaxBufferLength(l,e.duration))&&r.removeFragment(e)}else((n=this.mediaBuffer)==null?void 0:n.buffered.length)===0?r.removeAllFragments():r.hasParts(e.type)&&(r.detectPartialFragments({frag:e,part:null,stats:e.stats,id:e.type}),r.getState(e)===po.PARTIAL&&r.removeFragment(e))}checkLiveUpdate(e){if(e.updated&&!e.live){const n=this.fragmentTracker,r=e.fragments[e.fragments.length-1];if(r.endList&&!n.isEndListAppended(this.playlistType)){const s=n.getPartialFragment(r.end);s&&(n.removeFragment(s),n.fragBuffered(r,!0))}n.detectPartialFragments({frag:r,part:null,stats:r.stats,id:r.type})}e.fragments[0]||(e.deltaUpdateFailed=!0)}waitForLive(e){const n=e.details;return(n==null?void 0:n.live)&&n.type!=="EVENT"&&(this.levelLastLoaded!==e||n.expired)}flushMainBuffer(e,n,r=null){if(!(e-n))return;const s={startOffset:e,endOffset:n,type:r};this.hls.trigger(oe.BUFFER_FLUSHING,s)}_loadInitSegment(e){const{hls:n}=this;return this.initFragmentLoader.abort(),n.trigger(oe.FRAG_LOADING,{frag:e,targetBufferTime:0}),this.initFragmentLoader.load(e).then(r=>{var s;const i=r.frag;if(!this.levels||!Zbe(i,(s=this.fragCurrent)==null?void 0:s.initSegment))throw new Dv({type:er.NETWORK_ERROR,details:rt.INTERNAL_ABORTED,error:new Error("init load aborted"),fatal:!1,frag:i,networkDetails:null});return r}).then(r=>{const{frag:s,payload:i}=r,o=s.decryptdata;if(i&&i.byteLength>0&&o!=null&&o.key&&o.iv&&rP(o.method)){const l=self.performance.now(),{decryptRange:c}=aZ(s,null,this.iframesOnly);return this.decrypter.decrypt(new Uint8Array(i),o.key.buffer,o.iv.buffer,m_e(o.method),c).catch(d=>{throw n.trigger(oe.ERROR,{type:er.MEDIA_ERROR,details:rt.FRAG_DECRYPT_ERROR,fatal:!1,error:d,reason:d.message,frag:s}),this.fragmentLoader.abort(),d}).then(d=>{const u=self.performance.now();return n.trigger(oe.FRAG_DECRYPTED,{frag:s,part:null,payload:d,stats:{tstart:l,tdecrypt:u}}),r.payload=d,this.completeInitSegmentLoad(r)})}return this.completeInitSegmentLoad(r)})}completeInitSegmentLoad(e){const n=e.frag.stats;e.frag.data=new Uint8Array(e.payload),n.parsing.start=n.buffering.start=self.performance.now(),n.parsing.end=n.buffering.end=self.performance.now()}loadInitSegmentIfNeeded(e){const{initSegment:n}=e;if(!this.bitrateTest&&Oo(e)&&n&&!n.data){var r;return(n.encrypted&&!((r=n.decryptdata)!=null&&r.key)?this.keyLoader.load(n).then(()=>this._loadInitSegment(n)):this._loadInitSegment(n)).catch(i=>{throw this.state===Ct.STOPPED||this.state===Ct.ERROR||("data"in i&&(i.data.frag=e,this.fragmentLoader.abort(),this.handleFragLoadError(i)),this.resetFragmentLoading(e)),i})}}unhandledEncryptionError(e,n){var r,s;const i=e.tracks;if(i&&!n.encrypted&&((r=i.audio)!=null&&r.encrypted||(s=i.video)!=null&&s.encrypted)&&(!this.config.emeEnabled||!this.keyLoader.emeController)){const o=this.media,l=new Error(`Encrypted track with no key in ${this.fragInfo(n)} (media ${o?"attached mediaKeys: "+o.mediaKeys:"detached"})`);return this.warn(l.message),!o||o.mediaKeys?!1:(this.hls.trigger(oe.ERROR,{type:er.KEY_SYSTEM_ERROR,details:rt.KEY_SYSTEM_NO_KEYS,fatal:!1,error:l,frag:n}),this.resetTransmuxer(),!0)}return!1}fragContextChanged(e){const{fragCurrent:n}=this;return!e||!Zbe(e,n)}fragBufferedComplete(e,n){const r=this.mediaBuffer?this.mediaBuffer:this.media;if(this.log(`Buffered ${e.type} sn: ${e.sn}${n?" part: "+n.index:""} of ${this.fragInfo(e,!1,n)} > buffer:${r?dZ(Rr.getBuffered(r)):"(detached)"})`),Oo(e)){var s;if(e.type!==Wn.SUBTITLE){const o=e.elementaryStreams;if(!Object.keys(o).some(l=>!!o[l])){this.state=Ct.IDLE;return}}const i=(s=this.levels)==null?void 0:s[e.level];i!=null&&i.fragmentError&&(n||this.fragmentTracker.getState(e)!==po.PARTIAL)&&(this.log(`Resetting level fragment error count of ${i.fragmentError} on frag buffered`),i.fragmentError=0,e.stats.retry=0)}this.state=Ct.IDLE}_handleFragmentLoadComplete(e){const{transmuxer:n}=this;if(!n)return;const r=e.frag,{part:s,partsLoaded:i}=e,o=!i||i.length===0||i.some(d=>!d),{decryptRange:l}=aZ(r,s),c=new u_e(r.level,r.sn,r.stats.chunkCount+1,0,s?s.index:-1,!o,r.duration,this.iframesOnly,l);this.log(`load complete ${r.type} sn: ${r.sn}${s?" part: "+s.index:""} of ${this.fragInfo(r,!1,s)}`),n.flush(c)}_handleFragmentLoadProgress(e){}loadKeyFor(e,n,r){var s;let i=null;return e.encrypted&&!((s=e.decryptdata)!=null&&s.key)?(this.log(`Loading key for ${e.sn} of [${n.startSN}-${n.endSN}], ${this.playlistLabel()} ${e.level}`),this.state=Ct.KEY_LOADING,i=this.keyLoader.load(e,r).then(o=>{if(!this.fragContextChanged(o.frag))return this.hls.trigger(oe.KEY_LOADED,o),this.state===Ct.KEY_LOADING&&(this.state=Ct.IDLE),o}),this.hls.trigger(oe.KEY_LOADING,{frag:e})):e.encrypted||(i=this.keyLoader.loadClear(e,n.encryptedFragments,this.startFragRequested),i&&this.log(`[eme] blocking frag sn: ${e.sn} load until media-keys acquired`)),i}_doFragLoad(e,n,r=null,s){this.fragCurrent=e;const i=n.details;if(!this.levels||!i)throw new Error(`frag load aborted, missing level${i?"":" detail"}s`);const o=this.fragPrevious;if(!Z4(e,o)){const f=this.shouldLoadParts(n.details,e.end);f!==this.loadingParts&&(this.log(`LL-Part loading ${f?"ON":"OFF"} loading sn ${o==null?void 0:o.sn}->${e.sn}`),this.loadingParts=f)}if(r=Math.max(e.start,r||0),this.loadingParts){const f=i.partList;if(f&&s){r>i.fragmentEnd&&i.fragmentHint&&(e=i.fragmentHint);const p=this.getNextPart(f,e,r);if(p>-1){const g=f[p];if(e=this.fragCurrent=g.fragment,!Z4(e,o)&&!this.shouldLoadParts(n.details,e.end))return this.log(`LL-Part loading OFF @${this.playhead} next part: ${this.fragInfo(e,!1,g)}`),this.loadingParts=!1,Promise.resolve(null);if(!this.filterReplacedPrimary(g,n.details))return Promise.resolve(null);const v=this.loadKeyFor(e,i);if(this.fragContextChanged(e))return Promise.resolve(null);this.log(`Loading ${e.type} sn: ${e.sn} part: ${g.index} (${p}/${f.length-1}) of ${this.fragInfo(e,!1,g)} cc: ${e.cc} [${i.startSN}-${i.endSN}], target: ${r}${g.byteRange.length?` range:${g.byteRange.join("-")}`:""}`),this.nextLoadPosition=g.start+g.duration,this.state=Ct.FRAG_LOADING;let b;const x=this.loadInitSegmentIfNeeded(e);if(v||x){const w=!!v;b=Promise.all([v,x]).then(([k])=>w&&(!k||this.fragContextChanged(k.frag))?null:this.doFragPartsLoad(e,g,n,s)).catch(k=>this.handleFragLoadError(k))}else b=this.doFragPartsLoad(e,g,n,s).catch(w=>this.handleFragLoadError(w));return this.hls.trigger(oe.FRAG_LOADING,{frag:e,part:g,targetBufferTime:r}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING parts")):b}else if(!e.url||this.loadedEndOfParts(f,r))return Promise.resolve(null)}}if(this.loadingParts){var l;this.log(`LL-Part loading OFF after next part miss @${r} Check buffer at sn: ${e.sn} loaded parts: ${(l=i.partList)==null?void 0:l.filter(f=>f.loaded).map(f=>`[${f.start}-${f.end}]`)}`),this.loadingParts=!1}else if(!e.url)return Promise.resolve(null);if(!this.filterReplacedPrimary(e,n.details))return Promise.resolve(null);const c=this.loadInitSegmentIfNeeded(e),d=this.loadKeyFor(e,i,c);if(this.fragContextChanged(e)){var u;return this.log(`Context changed in KEY_LOADING sn: ${e.sn} ${e.relurl} > ${(u=this.fragCurrent)==null?void 0:u.relurl}`),c==null||c.catch(()=>null),d==null||d.catch(()=>null),Promise.resolve(null)}this.log(`Loading ${e.type} sn: ${e.sn} of ${this.fragInfo(e,!1)} cc: ${e.cc} ${"["+i.startSN+"-"+i.endSN+"]"}, target: ${r}${e.byteRange.length?` range:${e.byteRange.join("-")}`:""}`),xn(e.sn)&&!this.bitrateTest&&(this.nextLoadPosition=e.start+e.duration),this.state=Ct.FRAG_LOADING;const h=this.config.progressive&&e.type!==Wn.SUBTITLE;let m;return h&&d?m=d.then(f=>!f||this.fragContextChanged(f.frag)?null:this.fragmentLoader.load(e,this.iframesOnly,s,c)).catch(f=>this.handleFragLoadError(f)):m=Promise.all([this.fragmentLoader.load(e,this.iframesOnly,h?s:void 0,h?c:void 0),d,c]).then(([f])=>(!h&&s&&s(f),f)).catch(f=>this.handleFragLoadError(f)),this.hls.trigger(oe.FRAG_LOADING,{frag:e,targetBufferTime:r}),this.fragCurrent===null?Promise.reject(new Error("frag load aborted, context changed in FRAG_LOADING")):Promise.all([m,c]).then(([f])=>f)}doFragPartsLoad(e,n,r,s){return new Promise((i,o)=>{var l;const c=[],d=(l=r.details)==null?void 0:l.partList,u=h=>{this.fragmentLoader.loadPart(e,h,s).then(m=>{c[h.index]=m;const f=m.part;this.hls.trigger(oe.FRAG_LOADED,m);const p=_Ue(r.details,e.sn,h.index+1)||Wkt(d,e.sn,h.index+1);if(p)u(p);else return i({frag:e,part:f,partsLoaded:c})}).catch(o)};u(n)})}handleFragLoadError(e){if("data"in e){const n=e.data;n.frag&&n.details===rt.INTERNAL_ABORTED?this.handleFragLoadAborted(n.frag,n.part):n.frag&&n.type===er.KEY_SYSTEM_ERROR&&!n.fatal&&(n.frag.abortRequests(),this.resetStartWhenNotLoaded(),this.resetFragmentLoading(n.frag)),this.hls.trigger(oe.ERROR,n)}else this.hls.trigger(oe.ERROR,{type:er.OTHER_ERROR,details:rt.INTERNAL_EXCEPTION,err:e,error:e,fatal:!0});return null}_handleTransmuxerFlush(e){const n=this.getCurrentContext(e);if(!n||this.state!==Ct.PARSING){!this.fragCurrent&&this.state!==Ct.STOPPED&&this.state!==Ct.ERROR&&(this.state=Ct.IDLE);return}const{frag:r,part:s,level:i}=n,o=self.performance.now();r.stats.parsing.end=o,s&&(s.stats.parsing.end=o);const l=this.getLevelDetails(),d=l&&r.sn>l.endSN||this.shouldLoadParts(l,r.end);d!==this.loadingParts&&(this.log(`LL-Part loading ${d?"ON":"OFF"} after parsing segment ending @${r.end}`),this.loadingParts=d),this.updateLevelTiming(r,s,i,e)}shouldLoadParts(e,n){if(this.config.lowLatencyMode){if(!e)return this.loadingParts;if(e.partList&&!this.iframesOnly){var r;const s=e.partList[0],i=s.end+(((r=e.fragmentHint)==null?void 0:r.duration)||0);if(n>=i&&this.playhead>s.start-s.fragment.duration)return!0}}return!1}getCurrentContext(e){const{levels:n,fragCurrent:r}=this,{level:s,sn:i,part:o}=e;if(!(n!=null&&n[s]))return this.warn(`Levels object was unset while buffering fragment ${i} of ${this.playlistLabel()} ${s}. The current chunk will not be buffered.`),null;const l=n[s],c=l.details,d=o>-1?_Ue(c,i,o):null,u=d?d.fragment:Gkt(c,i,r);return u?(r&&r!==u&&(u.stats=r.stats),{frag:u,part:d,level:l}):null}bufferFragmentData(e,n,r,s,i){if(this.state!==Ct.PARSING)return;Oo(n)&&!this.fragContextChanged(n)&&(this.fragPrevious=n);const{data1:o,data2:l}=e;let c=o;if(l&&(c=Wf(o,l)),!c.length)return;const d=this.initPTS[n.cc],u=d?-d.baseTime/d.timescale:void 0,h={type:e.type,frag:n,part:r,chunkMeta:s,offset:u,parent:n.type,data:c};if(this.hls.trigger(oe.BUFFER_APPENDING,h),e.dropped&&e.independent&&!r){if(i)return;this.flushBufferGap(n)}}flushBufferGap(e){const n=this.media;if(!n)return;if(!Rr.isBuffered(n,n.currentTime)){this.flushMainBuffer(0,e.start);return}const r=n.currentTime,s=Rr.bufferInfo(n,r,0),i=e.duration,o=Math.min(this.config.maxFragLookUpTolerance*2,i*.25),l=Math.max(Math.min(e.start-o,s.end-o),r+o);e.start-l>o&&this.flushMainBuffer(l,e.start)}getFwdBufferInfo(e,n){var r;const s=this.playhead,o=this.lastCurrentTime>s||(r=this.media)!=null&&r.paused?0:this.config.maxBufferHole;return this.getFwdBufferInfoAtPos(e,s,n,o)}getFwdBufferInfoAtPos(e,n,r,s){const i=Rr.bufferInfo(e,n,s);if(i.len===0&&i.nextStart!==void 0){const o=this.fragmentTracker.getBufferedFrag(n,r);if(o&&(i.nextStart<=o.end||o.gap)){const l=Math.max(Math.min(i.nextStart,o.end)-n,s);return Rr.bufferInfo(e,n,l)}}return i}getMaxBufferLength(e){const{config:n}=this;let r;return e?r=Math.max(8*n.maxBufferSize/e,n.maxBufferLength):r=n.maxBufferLength,Math.min(r,n.maxMaxBufferLength)}exceedsMaxBuffer(e,n,r){const s=e.nextStart;if(s&&r.start>s){const i=e.buffered;if(i){let o=e.len;const l=e.bufferedIndex;for(let c=i.length-1;c>l;c--)i[c].start<r.start&&(o+=i[c].end-i[c].start);return o>=n}}return!1}reduceMaxBufferLength(e,n){const r=this.config,s=Math.max(Math.min(e-n,r.maxBufferLength),n/2),i=Math.max(e-n*3,r.maxMaxBufferLength/2,s);return i>=s?(r.maxMaxBufferLength=i,this.warn(`Reduce max buffer length to ${i}s`),!0):!1}getAppendedFrag(e){const n=this.fragmentTracker?this.fragmentTracker.getAppendedFrag(e,this.playlistType):null;return n&&"fragment"in n?n.fragment:n}getNextFragment(e,n){const r=n.fragments,s=r.length;if(!s)return null;const{config:i}=this,o=n.fragmentStart,l=i.lowLatencyMode&&!!n.partList;let c=null;if(n.live){const h=i.initialLiveManifestSize;if(s<h)return this.warn(`Not enough fragments to start playback (have: ${s}, need: ${h})`),null;if(!this.startFragRequested&&l&&!this.loadingParts&&(this.log("LL-Part loading ON for initial live fragment"),this.loadingParts=!0),!n.PTSKnown&&!this.startFragRequested&&this.startPosition===-1||e<o){var d;c=this.getInitialLiveFragment(n);const m=this.config.startPosition,f=this.hls.startPosition,p=this.hls.liveSyncPosition,g=((d=c)==null?void 0:d.start)||0;let v,b;if(f!==-1&&f>=o?(v=f,b=f===m?"config":"next load start"):p?(v=p,b="live edge"):(v=e,b="buffer pos"),v<g&&(v=g,b="live frag start"),v<o&&(v=o,b="playlist start"),this.startPosition!=v||this.nextLoadPosition!=v){const w=n.live&&!this.filterReplacedPrimary(c,n)?-1:v;this.log(`Setting startPosition to ${w} next load ${v} ${f===-1?"":`(from ${m}) `}based on ${b}. live edge: ${p} live frag start: ${g} playlist start: ${o} buffer pos: ${e}`),this.startPosition=w,this.nextLoadPosition=v}}}else e<=o&&(c=r[0]);if(!c){const h=this.loadingParts?n.partEnd:n.fragmentEnd;c=this.getFragmentAtPosition(e,h,n)}let u=this.filterReplacedPrimary(c,n);return!u&&c&&(u=Rkt(n,c.sn),u&&(this.nextLoadPosition=u.start)),u}isLoopLoading(e,n){if(this.nextLoadPosition<=n)return!1;const r=this.fragmentTracker.getState(e);return!!(r===po.OK||r===po.PARTIAL&&(e.gap||e.stats.retry>1))}getNextFragmentLoopLoading(e,n,r,s,i){let o=null;if(e.gap&&(o=this.getNextFragment(this.nextLoadPosition,n),o&&!o.gap&&r.nextStart)){const l=this.getFwdBufferInfoAtPos(this.mediaBuffer?this.mediaBuffer:this.media,r.nextStart,s,0);if(l!==null&&r.len+l.len>=i){const c=o.sn;return this.loopSn!==c&&(this.log(`buffer full after gaps in "${s}" playlist starting at sn: ${c}`),this.loopSn=c),null}}return this.loopSn=void 0,o}get primaryPrefetch(){if(uZ(this.config)){var e;if((e=this.hls.interstitialsManager)==null||(e=e.playingItem)==null?void 0:e.event)return!0}return!1}filterReplacedPrimary(e,n){if(!e)return e;if(uZ(this.config)&&("type"in e?e:e.fragment).type!==Wn.SUBTITLE){const r=this.hls.interstitialsManager,s=r==null?void 0:r.bufferingItem;if(s){const i=s.event;if(i){if(!i.appendInPlace&&(Math.abs(e.start-s.start)>1||s.start===0))return null}else if(e.end<=s.start&&(n==null?void 0:n.live)===!1||e.start>=s.end&&s.nextEvent&&(s.nextEvent.appendInPlace&&!s.nextEvent.hasPlayed||e.start-s.end>1))return null}if(Ykt(e,r==null?void 0:r.playerQueue,this.playhead))return null}return e}getNextPart(e,n,r){let s=-1,i=!1,o=!0;for(let c=0,d=e.length;c<d;c++){const u=e[c];if(o=o&&!u.independent,s>-1&&r<u.start)break;const h=u.loaded||u.gap;h?s=-1:(i||(u.independent||o)&&u.fragment===n)&&(s=c),i=h&&!u.gap}const l=e[s];return l&&l.fragment!==n&&this.log(`Need buffer at ${r} but next unloaded part starts at ${l.start} (sn: ${n.sn} -> ${l.fragment.sn})`),s}loadedEndOfParts(e,n){let r;for(let s=e.length;s--;){if(r=e[s],!r.loaded)return!1;if(n>r.start)return!0}return!1}getInitialLiveFragment(e){const n=e.fragments,r=this.fragPrevious;let s=null;if(r){if(e.hasProgramDateTime&&(s=wXn(n,r.endProgramDateTime,this.config.maxFragLookUpTolerance),s&&this.log(`Live playlist, switching playlist, load frag with same PDT: ${r.programDateTime}`)),!s){const i=r.sn+1;if(i>=e.startSN&&i<=e.endSN){const o=n[i-e.startSN];r.cc===o.cc&&(s=o,this.log(`Live playlist, switching playlist, load frag with next SN: ${s.sn}`))}s||(s=Pkt(e,r.cc,r.end),s&&this.log(`Live playlist, switching playlist, load frag with same CC: ${s.sn}`))}}else{const i=this.hls.liveSyncPosition;i!==null&&(s=this.getFragmentAtPosition(i,this.bitrateTest?e.fragmentEnd:e.edge,e))}return s}getFragmentAtPosition(e,n,r){const{config:s}=this;let{fragPrevious:i}=this,{fragments:o,endSN:l}=r;const{fragmentHint:c}=r,{maxFragLookUpTolerance:d}=s,u=r.partList,h=!!(this.loadingParts&&u!=null&&u.length&&c);h&&!this.bitrateTest&&u[u.length-1].fragment.sn===c.sn&&(o=o.concat(c),l=c.sn),i&&this.fragmentTracker.getState(i)===po.NOT_LOADED&&(i=null);let m;if(e<n){var f;const g=e<this.lastCurrentTime||e>n-d||(f=this.media)!=null&&f.paused||!this.startFragRequested?0:d;m=UR(i,o,e,g)}else m=o[o.length-1];if(m){const p=m.sn-r.startSN,g=this.fragmentTracker.getState(m);if((g===po.OK||g===po.PARTIAL&&m.gap)&&(i=m),Z4(m,i)&&(!h||u[0].fragment.sn>m.sn||!r.live)){const v=o[p+1];m.sn<l&&this.fragmentTracker.getState(v)!==po.OK?m=v:m=null}}return m}alignPlaylists(e,n,r){const s=e.fragments.length;if(!s)return this.warn("No fragments in live playlist"),0;const i=e.fragmentStart,o=!n,l=e.alignedSliding&&xn(i);if(o||!l&&!i){cZ(r,e,this);const c=e.fragmentStart;return this.log(`Live playlist sliding: ${c} start-sn: ${n?n.startSN:"na"}->${e.startSN} fragments: ${s}`),c}return i}waitForCdnTuneIn(e){return e.live&&e.canBlockReload&&e.partTarget&&e.tuneInGoal>Math.max(e.partHoldBack,e.partTarget*3)}setStartPosition(e,n){let r=this.startPosition;r<n&&(r=-1);const s=this.timelineOffset;if(r===-1){const i=this.startTimeOffset!==null,o=i?this.startTimeOffset:e.startTimeOffset;if(o!==null&&xn(o))r=n+o,o<0&&(r+=e.edge),r=Math.min(Math.max(n,r),n+e.totalduration),this.log(`Setting startPosition to ${r} for start time offset ${o} found in ${i?"multivariant":"media"} playlist`),this.startPosition=r;else if(e.live){const l=this.hls.liveSyncPosition;r=l||n,this.log(`Setting startPosition to -1 to start at ${l?"live edge":"playlist start"} ${r}`),this.startPosition=-1}else this.log("setting startPosition to 0 by default"),this.startPosition=r=0;this.lastCurrentTime=r+s}this.nextLoadPosition=r+s}getLoadPosition(){var e;const{media:n}=this;let r=0;return(e=this.hls)!=null&&e.hasEnoughToStart&&n&&!this.iframesOnly?r=n.currentTime:this.nextLoadPosition>=0&&(r=this.nextLoadPosition),r}get playhead(){var e;if((e=this.hls)!=null&&e.hasEnoughToStart){var n;const r=(n=this.media)==null?void 0:n.currentTime;return xn(r)?r:this.lastCurrentTime}return this.getLoadPosition()}get iframesOnly(){var e;if(this.playlistType!==Wn.MAIN)return!1;const n=this.getLevelDetails();return n?n.iframesOnly:(e=this.levelLastLoaded)==null?void 0:e.iframes}handleFragLoadAborted(e,n){this.transmuxer&&e.type===this.playlistType&&Oo(e)&&e.stats.aborted&&(this.log(`Fragment ${e.sn}${n?" part "+n.index:""} of ${this.playlistLabel()} ${e.level} was aborted`),this.resetFragmentLoading(e))}resetFragmentLoading(e){(!this.fragCurrent||!this.fragContextChanged(e)&&this.state!==Ct.FRAG_LOADING_WAITING_RETRY)&&(this.state=Ct.IDLE)}onFragmentOrKeyLoadError(e,n){if(n.chunkMeta&&!n.frag){const x=this.getCurrentContext(n.chunkMeta);x&&(n.frag=x.frag)}const{frag:r,part:s}=n;if(!r||!this.levels||r.type!==e)return;if(this.fragContextChanged(r)){var i;this.warn(`Frag load error must match current frag to retry ${r.relurl} > ${(i=this.fragCurrent)==null?void 0:i.relurl}`);return}const o=n.details===rt.FRAG_GAP;o&&this.fragmentTracker.addAsGap(r);const l=n.errorAction;if(!l){this.state=Ct.ERROR;return}const{action:c,flags:d,retryCount:u=0,retryConfig:h}=l,m=!!h,f=m&&c===od.RetryRequest,p=m&&!l.resolved&&d&Ac.MoveAllAlternatesMatchingHost,g=this.hls.latestLevelDetails,v=g==null?void 0:g.live;if(!f&&p&&Oo(r)&&v&&r.sn<g.endSN&&!tkt(n))this.resetFragmentErrors(e),s?s.gap=!0:this.treatAsGap(r),l.resolved=!0;else if((f||p)&&u<h.maxNumRetry){var b;const x=D6((b=n.response)==null?void 0:b.code),w=s_e(h,u);if(this.resetStartWhenNotLoaded(),this.retryDate=self.performance.now()+w,this.state=Ct.FRAG_LOADING_WAITING_RETRY,l.resolved=!0,x){this.log("Waiting for connection (offline)"),this.retryDate=1/0,n.reason="offline";return}this.warn(`Fragment ${r.sn} of ${e} ${r.level} errored with ${n.details}, retrying loading ${u+1}/${h.maxNumRetry} in ${w}ms`)}else if(h)if(this.resetFragmentErrors(e),u<h.maxNumRetry)!o&&c!==od.RemoveAlternatePermanently&&(l.resolved=!0);else{this.warn(`${n.details} reached or exceeded max retry (${u})`);return}else c===od.SendAlternateToPenaltyBox?this.state=Ct.WAITING_LEVEL:this.state=Ct.ERROR;this.tickImmediate()}checkRetryDate(){const e=self.performance.now(),n=this.retryDate,r=n===1/0;(!n||e>=n||r&&!D6(0))&&(r&&this.log("Connection restored (online)"),this.resetStartWhenNotLoaded(),this.state=Ct.IDLE)}reduceLengthAndFlushBuffer(e){if(this.state===Ct.PARSING||this.state===Ct.PARSED){const n=e.frag,r=e.parent,s=this.getFwdBufferInfo(this.mediaBuffer,r),i=s&&s.len>.5;i&&this.reduceMaxBufferLength(s.len,(n==null?void 0:n.duration)||10);const o=!i;return o?this.warn(`Buffer full error while media.currentTime (${this.playhead}) is not buffered, flush ${r} buffer`):s.nextStart&&n&&s.nextStart>n.start&&this.flushMainBuffer(s.nextStart,Number.POSITIVE_INFINITY,r===Wn.AUDIO?r:void 0),n&&(this.fragmentTracker.removeFragment(n),this.nextLoadPosition=n.start),this.resetLoadingState(),o}return!1}resetFragmentErrors(e){e===Wn.AUDIO&&(this.fragCurrent=null),this.hls.hasEnoughToStart||(this.startFragRequested=!1),this.state!==Ct.STOPPED&&(this.state=Ct.IDLE)}afterBufferFlushed(e,n){if(!e)return;const r=Rr.getBuffered(e);this.fragmentTracker.detectEvictedFragments(n,r,this.playlistType),this.state===Ct.ENDED&&this.resetLoadingState()}resetLoadingState(){this.log("Reset loading state"),this.fragCurrent=null,this.fragPrevious=null,this.state!==Ct.STOPPED&&(this.state=Ct.IDLE)}resetStartWhenNotLoaded(){if(!this.hls.hasEnoughToStart){this.startFragRequested=!1;const e=this.getLevelDetails();e!=null&&e.live?(this.log("resetting startPosition for live start"),this.startPosition=-1,this.setStartPosition(e,e.fragmentStart),this.resetLoadingState()):this.nextLoadPosition=this.startPosition}}resetWhenMissingContext(e){this.log(`Loading context changed while buffering sn ${e.sn} of ${this.playlistLabel()} ${e.level===-1?"<removed>":e.level}. This chunk will not be buffered.`),this.removeUnbufferedFrags(),this.resetStartWhenNotLoaded(),this.resetLoadingState()}removeUnbufferedFrags(e=0){this.fragmentTracker.removeFragmentsInRange(e,1/0,this.playlistType,!1,!0)}updateLevelTiming(e,n,r,s){const i=r.details;if(!i){this.warn("level.details undefined");return}if(this.log(`update level timing ${e.type} sn: ${e.sn}${n?" part: "+n.index:""} of ${this.fragInfo(e,!1,n)}`),!Object.keys(e.elementaryStreams).reduce((h,m)=>{const f=e.elementaryStreams[m];if(f){const p=f.endPTS-f.startPTS;if(p<=0)return this.warn(`Could not parse fragment ${e.sn} ${m} duration reliably (${p})`),h||!1;const g=s.partial?0:zkt(i,e,f.startPTS,f.endPTS,f.startDTS,f.endDTS,this.iframesOnly,this);return this.hls.trigger(oe.LEVEL_PTS_UPDATED,{details:i,level:r,drift:g,type:m,frag:e,start:f.startPTS,end:f.endPTS}),!0}return h},!1)){var l,c,d,u;const h=((l=this.transmuxer)==null?void 0:l.error)===null,m=((c=this.transmuxer)==null?void 0:c.error)!=null,f=((d=(u=this.levels)==null?void 0:u.length)!=null?d:0)>1;if((r.fragmentError===0||h&&(r.fragmentError<2||e.endList)||m&&f)&&this.treatAsGap(e,r),h){const p=new Error(`Found no media in ${this.playlistLabel()} ${e.level} ${n?`part: ${n.index} of `:""}sn: ${e.sn} at playlist time: ${e.start}. Resetting transmuxer to fallback to playlist timing`);if(this.warn(p.message),this.hls.trigger(oe.ERROR,{type:er.MEDIA_ERROR,details:rt.FRAG_PARSING_ERROR,fatal:!1,error:p,frag:e,reason:`Found no media in msn ${e.sn} of ${this.playlistLabel()} "${r.url}"`}),!this.hls)return;this.resetTransmuxer()}}this.state=Ct.PARSED,this.log(`Parsed ${e.type} sn: ${e.sn}${n?" part: "+n.index:""} of ${this.fragInfo(e,!1,n)}`),this.hls.trigger(oe.FRAG_PARSED,{frag:e,part:n,chunkMeta:s})}playlistLabel(){return`${this.playlistType} playlist`}fragInfo(e,n=!0,r){var s,i;return`${this.playlistLabel()} ${e.level} (${r?"part":"frag"}:[${(s=n&&!r?e.startPTS:(r||e).start)!=null?s:NaN}-${(i=n&&!r?e.endPTS:(r||e).end)!=null?i:NaN}]${r&&e.type==="main"?"INDEPENDENT="+(r.independent?"YES":"NO"):""})`}treatAsGap(e,n){n&&n.fragmentError++,this.fragmentTracker.addAsGap(e)}resetTransmuxer(){var e;(e=this.transmuxer)==null||e.reset()}isFragmentNearlyDownloaded(e){var n;const r=(n=e.loader)==null?void 0:n.stats;if(!r)return!1;const s=r.loading.first>0,o=(r.total-r.loaded)/(this.hls.bandwidthEstimate||this.hls.config.abrEwmaDefaultEstimate);return s&&o<=.15}recoverWorkerError(e){e.event==="demuxerWorker"&&(this.fragmentTracker.removeAllFragments(),this.transmuxer&&(this.transmuxer.destroy(),this.transmuxer=null),this.resetStartWhenNotLoaded(),this.resetLoadingState())}set state(e){const n=this._state;n!==e&&(this._state=e,this.log(`${n}->${e}`))}get state(){return this._state}calculateOptimalSwitchPoint(e,n){let r=0;const{hls:s,media:i,config:o,levels:l,playlistType:c}=this,d=this.getLevelDetails();if(i&&!i.paused&&l){var u;const f=c===Wn.AUDIO?Ekt(e.audioCodec,128e3):e.maxBitrate,p=1+s.ttfbEstimate/1e3,g=s.bandwidthEstimate*o.abrBandWidthUpFactor,v=d&&(this.loadingParts?d.partTarget:d.averagetargetduration)||((u=this.fragCurrent)==null?void 0:u.duration)||6;r=p+f*v/g,e.details||(r+=p)}const h=this.playhead,m=!(d!=null&&d.live)||n.end-h>r*1.5;return{fetchdelay:r,okToFlushForwardBuffer:m}}scheduleTrackSwitch(e,n,r){const{media:s,playlistType:i}=this;if(!s||!e)return;const o=r?this.getBufferedFrag(this.playhead+n):null;if(o){const c=this.followingBufferedFrag(o);if(c){var l;this.abortCurrentFrag();const d=c.maxStartPTS?c.maxStartPTS:c.start,u=c.duration,h=Math.max(o.end,d+Math.min(Math.max(u-this.config.maxFragLookUpTolerance,u*(this.couldBacktrack?.5:.125)),u*(this.couldBacktrack?.75:.25)));if((((l=this.getLevelDetails())==null?void 0:l.fragmentStart)||0)>h)return;const f=i===Wn.MAIN?null:"audio";this.flushMainBuffer(h,Number.POSITIVE_INFINITY,f),this.cleanupBackBuffer()}}}cleanupBackBuffer(){const{media:e,playlistType:n}=this;if(!e)return;const r=this.getAppendedFrag(this.playhead);if(r&&r.start>1){const s=n===Wn.AUDIO;this.flushMainBuffer(0,r.start-(s?0:1),s?"audio":null)}}getBufferedFrag(e){return this.fragmentTracker.getBufferedFrag(e,this.playlistType)}followingBufferedFrag(e){return e?this.getBufferedFrag(e.end+.5):null}abortCurrentFrag(){const e=this.fragCurrent;switch(this.fragCurrent=null,e&&(e.abortRequests(),this.fragmentTracker.removeFragment(e)),this.state){case Ct.KEY_LOADING:case Ct.FRAG_LOADING:case Ct.FRAG_LOADING_WAITING_RETRY:case Ct.PARSING:case Ct.PARSED:this.state=Ct.IDLE;break}this.nextLoadPosition=this.playhead}checkFragPlaying(){const e=this.media;let n=null;if(e&&e.readyState>1&&e.seeking===!1){const r=e.currentTime;if(Rr.isBuffered(e,r)?n=this.getAppendedFrag(r):Rr.isBuffered(e,r+.1)&&(n=this.getAppendedFrag(r+.1)),n&&(this.backtrackFragment=void 0,!Z4(n,this.fragPlaying)))return this.fragPlaying=n,!0}return!1}getBufferOutput(){return null}nextLevelSwitch(){const{levels:e,media:n,hls:r,config:s,playlistType:i}=this;if(n!=null&&n.readyState&&e&&r&&s){const o=this.getBufferOutput(),l=this.getFwdBufferInfo(o,i);if(!l)return;const c=i===Wn.AUDIO?r.nextAudioTrack:r.nextLoadLevel,d=e[c],{fetchdelay:u,okToFlushForwardBuffer:h}=this.calculateOptimalSwitchPoint(d,l);this.scheduleTrackSwitch(l,u,h)}this.tickImmediate()}}function Ykt(t,e,n){if(e)for(let r=e.length;r--;){const s=e[r].interstitial,i=s.startTime,o=Math.min(i+s.duration,s.resumeTime);if(s.appendInPlace&&(t.start>=i&&t.end<=o||n>t.start&&t.end>i&&t.start<o))return!0}return!1}function uZ(t){return!!t.interstitialsController&&t.enableInterstitialPlayback!==!1}class Qkt{constructor(){this.chunks=[],this.dataLength=0}push(e){this.chunks.push(e),this.dataLength+=e.length}flush(){const{chunks:e,dataLength:n}=this;let r;if(e.length)e.length===1?r=e[0]:r=ier(e,n);else return new Uint8Array(0);return this.reset(),r}reset(){this.chunks.length=0,this.dataLength=0}}function ier(t,e){const n=new Uint8Array(e);let r=0;for(let s=0;s<t.length;s++){const i=t[s];n.set(i,r),r+=i.length}return n}var kde={exports:{}},RUe;function aer(){return RUe||(RUe=1,function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(c,d,u){this.fn=c,this.context=d,this.once=u||!1}function i(c,d,u,h,m){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new s(u,h||c,m),p=n?n+d:d;return c._events[p]?c._events[p].fn?c._events[p]=[c._events[p],f]:c._events[p].push(f):(c._events[p]=f,c._eventsCount++),c}function o(c,d){--c._eventsCount===0?c._events=new r:delete c._events[d]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var d=[],u,h;if(this._eventsCount===0)return d;for(h in u=this._events)e.call(u,h)&&d.push(n?h.slice(1):h);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(u)):d},l.prototype.listeners=function(d){var u=n?n+d:d,h=this._events[u];if(!h)return[];if(h.fn)return[h.fn];for(var m=0,f=h.length,p=new Array(f);m<f;m++)p[m]=h[m].fn;return p},l.prototype.listenerCount=function(d){var u=n?n+d:d,h=this._events[u];return h?h.fn?1:h.length:0},l.prototype.emit=function(d,u,h,m,f,p){var g=n?n+d:d;if(!this._events[g])return!1;var v=this._events[g],b=arguments.length,x,w;if(v.fn){switch(v.once&&this.removeListener(d,v.fn,void 0,!0),b){case 1:return v.fn.call(v.context),!0;case 2:return v.fn.call(v.context,u),!0;case 3:return v.fn.call(v.context,u,h),!0;case 4:return v.fn.call(v.context,u,h,m),!0;case 5:return v.fn.call(v.context,u,h,m,f),!0;case 6:return v.fn.call(v.context,u,h,m,f,p),!0}for(w=1,x=new Array(b-1);w<b;w++)x[w-1]=arguments[w];v.fn.apply(v.context,x)}else{var k=v.length,S;for(w=0;w<k;w++)switch(v[w].once&&this.removeListener(d,v[w].fn,void 0,!0),b){case 1:v[w].fn.call(v[w].context);break;case 2:v[w].fn.call(v[w].context,u);break;case 3:v[w].fn.call(v[w].context,u,h);break;case 4:v[w].fn.call(v[w].context,u,h,m);break;default:if(!x)for(S=1,x=new Array(b-1);S<b;S++)x[S-1]=arguments[S];v[w].fn.apply(v[w].context,x)}}return!0},l.prototype.on=function(d,u,h){return i(this,d,u,h,!1)},l.prototype.once=function(d,u,h){return i(this,d,u,h,!0)},l.prototype.removeListener=function(d,u,h,m){var f=n?n+d:d;if(!this._events[f])return this;if(!u)return o(this,f),this;var p=this._events[f];if(p.fn)p.fn===u&&(!m||p.once)&&(!h||p.context===h)&&o(this,f);else{for(var g=0,v=[],b=p.length;g<b;g++)(p[g].fn!==u||m&&!p[g].once||h&&p[g].context!==h)&&v.push(p[g]);v.length?this._events[f]=v.length===1?v[0]:v:o(this,f)}return this},l.prototype.removeAllListeners=function(d){var u;return d?(u=n?n+d:d,this._events[u]&&o(this,u)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,t.exports=l}(kde)),kde.exports}var oer=aer(),g_e=ZZn(oer);const V6="1.7.3",zR={};function ler(){return typeof __HLS_WORKER_BUNDLE__=="function"}function cer(){const t=zR[V6];if(t)return t.clientCount++,t;const e=new self.Blob([`var exports={};var module={exports:exports};function define(f){f()};define.amd=true;(${__HLS_WORKER_BUNDLE__.toString()})(true);`],{type:"text/javascript"}),n=self.URL.createObjectURL(e),s={worker:new self.Worker(n),objectURL:n,clientCount:1};return zR[V6]=s,s}function der(t){const e=zR[t];if(e)return e.clientCount++,e;const n=new self.URL(t,self.location.href).href,s={worker:new self.Worker(n),scriptURL:n,clientCount:1};return zR[t]=s,s}function uer(t){const e=zR[t||V6];if(e&&e.clientCount--===1){const{worker:r,objectURL:s}=e;delete zR[t||V6],s&&self.URL.revokeObjectURL(s),r.terminate()}}function her(t,e,n,r){const s=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350],i=e[n+2],o=i>>2&15;if(o>12){const v=new Error(`invalid ADTS sampling index:${o}`);t.emit(oe.ERROR,oe.ERROR,{type:er.MEDIA_ERROR,details:rt.FRAG_PARSING_ERROR,fatal:!0,error:v,reason:v.message});return}const l=(i>>6&3)+1,c=e[n+3]>>6&3|(i&1)<<2,d=s[o];let u=o;(l===5||l===29)&&(u-=3);let h;const m=(u&14)>>1,f=(u&1)<<7|c<<3;let p=0;if(l===1&&o>=6){p=5;const v=o-3;h=[p<<3|m,f|(v&14)>>1,(v&1)<<7|8,0]}else h=[l<<3|m,f];const g="mp4a.40."+(p||l);return hi.log(`manifest codec:${r}, parsed codec:${g}, channels:${c}, rate:${d} (ADTS object type:${l} sampling index:${o} esds config:[${h.join(",")}])`),{config:h,samplerate:d,channelCount:c,codec:g,parsedCodec:g,manifestCodec:r}}function Zkt(t,e){return t[e]===255&&(t[e+1]&246)===240}function Jkt(t,e){return t[e+1]&1?7:9}function v_e(t,e){return(t[e+3]&3)<<11|t[e+4]<<3|(t[e+5]&224)>>>5}function mer(t,e){return e+5<t.length}function hZ(t,e){return e+1<t.length&&Zkt(t,e)}function fer(t,e){return mer(t,e)&&Zkt(t,e)&&v_e(t,e)<=t.length-e}function per(t,e){if(hZ(t,e)){const n=Jkt(t,e);if(e+n>=t.length)return!1;const r=v_e(t,e);if(r<=n)return!1;const s=e+r;return s===t.length||hZ(t,s)}return!1}function Xkt(t,e,n,r,s){if(!t.samplerate){const i=her(e,n,r,s);if(!i)return;Mi(t,i)}}function eSt(t){return 1024*9e4/t}function ger(t,e){const n=Jkt(t,e);if(e+n<=t.length){const r=v_e(t,e)-n;if(r>0)return{headerLength:n,frameLength:r}}}function tSt(t,e,n,r,s){const i=eSt(t.samplerate),o=r+s*i,l=ger(e,n);let c;if(l){const{frameLength:h,headerLength:m}=l,f=m+h,p=Math.max(0,n+f-e.length);p?(c=new Uint8Array(f-m),c.set(e.subarray(n+m,e.length),0)):c=e.subarray(n+m,n+f);const g={unit:c,pts:o};return p||t.samples.push(g),{sample:g,length:f,missing:p}}const d=e.length-n;return c=new Uint8Array(d),c.set(e.subarray(n,e.length),0),{sample:{unit:c,pts:o},length:d,missing:-1}}let xu=function(t){return t.audioId3="org.id3",t.dateRange="com.apple.quicktime.HLS",t.emsg="https://aomedia.org/emsg/ID3",t.misbklv="urn:misb:KLV:bin:1910.1",t}({});function Vv(t="",e=9e4){return{type:t,id:-1,pid:-1,inputTimeScale:e,sequenceNumber:-1,samples:[],dropped:0}}class y_e{constructor(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null,this.lastPTS=null}resetInitSegment(e,n,r,s){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}}resetTimeStamp(e){this.initPTS=e,this.resetContiguity()}resetContiguity(){this.basePTS=null,this.lastPTS=null,this.frameIndex=0}canParse(e,n){return!1}appendFrame(e,n,r){}demux(e,n){this.cachedData&&(e=Wf(this.cachedData,e),this.cachedData=null);let r=$6(e,0),s=r?r.length:0,i;const o=this._audioTrack,l=this._id3Track,c=r?a_e(r):void 0,d=e.length;for((this.basePTS===null||this.frameIndex===0&&xn(c))&&(this.basePTS=ver(c,n,this.initPTS),this.lastPTS=this.basePTS),this.lastPTS===null&&(this.lastPTS=this.basePTS),r&&r.length>0&&l.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:xu.audioId3,duration:Number.POSITIVE_INFINITY});s<d;){if(this.canParse(e,s)){const u=this.appendFrame(o,e,s);u?(this.frameIndex++,this.lastPTS=u.sample.pts,s+=u.length,i=s):s=d}else gJn(e,s)?(r=$6(e,s),l.samples.push({pts:this.lastPTS,dts:this.lastPTS,data:r,type:xu.audioId3,duration:Number.POSITIVE_INFINITY}),s+=r.length,i=s):s++;if(s===d&&i!==d){const u=e.slice(i);this.cachedData?this.cachedData=Wf(this.cachedData,u):this.cachedData=u}}return{audioTrack:o,videoTrack:Vv(),id3Track:l,textTrack:Vv()}}demuxSampleAes(e,n,r){return Promise.reject(new Error(`[${this}] This demuxer does not support Sample-AES decryption`))}flush(e){const n=this.cachedData;return n&&(this.cachedData=null,this.demux(n,0)),{audioTrack:this._audioTrack,videoTrack:Vv(),id3Track:this._id3Track,textTrack:Vv()}}destroy(){this.cachedData=null,this._audioTrack=this._id3Track=void 0}}const ver=(t,e,n)=>{if(xn(t))return t*90;const r=n?n.baseTime*9e4/n.timescale:0;return e*9e4+r},yer=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],ber=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],xer=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],wer=[0,1,1,4];function nSt(t,e,n,r,s){if(n+24>e.length)return;const i=rSt(e,n);if(i&&n+i.frameLength<=e.length){const o=i.samplesPerFrame*9e4/i.sampleRate,l=r+s*o,c={unit:e.subarray(n,n+i.frameLength),pts:l,dts:l};return t.config=[],t.channelCount=i.channelCount,t.samplerate=i.sampleRate,t.samples.push(c),{sample:c,length:i.frameLength,missing:0}}}function rSt(t,e){const n=t[e+1]>>3&3,r=t[e+1]>>1&3,s=t[e+2]>>4&15,i=t[e+2]>>2&3;if(n!==1&&s!==0&&s!==15&&i!==3){const o=t[e+2]>>1&1,l=t[e+3]>>6,c=n===3?3-r:r===3?3:4,d=yer[c*14+s-1]*1e3,h=ber[(n===3?0:n===2?1:2)*3+i],m=l===3?1:2,f=xer[n][r],p=wer[r],g=f*8*p,v=Math.floor(f*d/h+o)*p,b=v$();return!!b&&b<=87&&r===2&&d>=224e3&&l===0&&(t[e+3]=t[e+3]|128),{sampleRate:h,channelCount:m,frameLength:v,samplesPerFrame:g}}}function b_e(t,e){return t[e]===255&&(t[e+1]&224)===224&&(t[e+1]&6)!==0}function sSt(t,e){return e+1<t.length&&b_e(t,e)}function ker(t,e){return b_e(t,e)&&4<=t.length-e}function iSt(t,e){if(e+1<t.length&&b_e(t,e)){const r=rSt(t,e);let s=4;r!=null&&r.frameLength&&(s=r.frameLength);const i=e+s;return i===t.length||sSt(t,i)}return!1}class aSt{constructor(e,n,r){this.keyData=void 0,this.decrypter=void 0,this.keyData=r,this.decrypter=new d_e(n,!0)}decryptBuffer(e){return this.decrypter.decrypt(e,this.keyData.key.buffer,this.keyData.iv.buffer,Uk.cbc,{start:0,end:e.byteLength})}decryptAacSample(e,n,r){const s=e[n].unit;if(s.length<=16)return;const i=s.subarray(16,s.length-s.length%16),o=i.buffer.slice(i.byteOffset,i.byteOffset+i.length);this.decryptBuffer(o).then(l=>{const c=new Uint8Array(l);s.set(c,16),this.decrypter.isSync()||this.decryptAacSamples(e,n+1,r)}).catch(r)}decryptAacSamples(e,n,r){for(;;n++){if(n>=e.length){r();return}if(!(e[n].unit.length<32)&&(this.decryptAacSample(e,n,r),!this.decrypter.isSync()))return}}getAvcEncryptedData(e){const n=Math.floor((e.length-48)/160)*16+16,r=new Int8Array(n);let s=0;for(let i=32;i<e.length-16;i+=160,s+=16)r.set(e.subarray(i,i+16),s);return r}getAvcDecryptedUnit(e,n){const r=new Uint8Array(n);let s=0;for(let i=32;i<e.length-16;i+=160,s+=16)e.set(r.subarray(s,s+16),i);return e}decryptAvcSample(e,n,r,s,i){const o=bkt(i.data),l=this.getAvcEncryptedData(o);this.decryptBuffer(l.buffer).then(c=>{i.data=this.getAvcDecryptedUnit(o,c),this.decrypter.isSync()||this.decryptAvcSamples(e,n,r+1,s)}).catch(s)}decryptAvcSamples(e,n,r,s){if(e instanceof Uint8Array)throw new Error("Cannot decrypt samples of type Uint8Array");for(;;n++,r=0){if(n>=e.length){s();return}const i=e[n].units;for(;!(r>=i.length);r++){const o=i[r];if(!(o.data.length<=48||o.type!==1&&o.type!==5)&&(this.decryptAvcSample(e,n,r,s,o),!this.decrypter.isSync()))return}}}}class Ser extends y_e{constructor(e,n){super(),this.observer=void 0,this.config=void 0,this.sampleAes=null,this.observer=e,this.config=n}resetInitSegment(e,n,r,s){super.resetInitSegment(e,n,r,s),this._audioTrack={container:"audio/adts",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"aac",samples:[],manifestCodec:n,duration:s,inputTimeScale:9e4,dropped:0}}static probe(e,n){if(!e)return!1;const r=$6(e,0);let s=(r==null?void 0:r.length)||0;if(iSt(e,s))return!1;for(let i=e.length;s<i;s++)if(per(e,s))return n.log("ADTS sync word found !"),!0;return!1}canParse(e,n){return fer(e,n)}appendFrame(e,n,r){Xkt(e,this.observer,n,r,e.manifestCodec);const s=tSt(e,n,r,this.basePTS,this.frameIndex);if((s==null?void 0:s.missing)===0)return s}demuxSampleAes(e,n,r){const s=this.demux(e,r),i=this.sampleAes=new aSt(this.observer,this.config,n);return new Promise(o=>{i.decryptAacSamples(s.audioTrack.samples,0,()=>{o(s)})})}}const oSt=(t,e)=>{let n=0,r=5;e+=r;const s=new Uint32Array(1),i=new Uint32Array(1),o=new Uint8Array(1);for(;r>0;){o[0]=t[e];const l=Math.min(r,8),c=8-l;i[0]=4278190080>>>24+c<<c,s[0]=(o[0]&i[0])>>c,n=n?n<<l|s[0]:s[0],e+=1,r-=l}return n};class Cer extends y_e{constructor(e){super(),this.observer=void 0,this.observer=e}resetInitSegment(e,n,r,s){super.resetInitSegment(e,n,r,s),this._audioTrack={container:"audio/ac-3",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"ac3",samples:[],manifestCodec:n,duration:s,inputTimeScale:9e4,dropped:0}}canParse(e,n){return n+64<e.length}appendFrame(e,n,r){const s=lSt(e,n,r,this.basePTS,this.frameIndex);if(s!==-1)return{sample:e.samples[e.samples.length-1],length:s,missing:0}}static probe(e){if(!e)return!1;const n=$6(e,0);if(!n)return!1;const r=n.length;if(e[r]===11&&e[r+1]===119&&a_e(n)!==void 0){if(oSt(e,r)<16)return!0;throw new Error("Containerless ec-3 is not supported")}return!1}}function lSt(t,e,n,r,s){if(n+8>e.length||e[n]!==11||e[n+1]!==119)return-1;const i=e[n+4]>>6;if(i>=3)return-1;const l=[48e3,44100,32e3][i],c=e[n+4]&63,u=[64,69,96,64,70,96,80,87,120,80,88,120,96,104,144,96,105,144,112,121,168,112,122,168,128,139,192,128,140,192,160,174,240,160,175,240,192,208,288,192,209,288,224,243,336,224,244,336,256,278,384,256,279,384,320,348,480,320,349,480,384,417,576,384,418,576,448,487,672,448,488,672,512,557,768,512,558,768,640,696,960,640,697,960,768,835,1152,768,836,1152,896,975,1344,896,976,1344,1024,1114,1536,1024,1115,1536,1152,1253,1728,1152,1254,1728,1280,1393,1920,1280,1394,1920][c*3+i]*2;if(n+u>e.length)return-1;const h=e[n+6]>>5;let m=0;h===2?m+=2:(h&1&&h!==1&&(m+=2),h&4&&(m+=2));const f=(e[n+6]<<8|e[n+7])>>12-m&1,g=[2,1,2,3,3,4,4,5][h]+f,v=e[n+5]>>3,b=e[n+5]&7,x=new Uint8Array([i<<6|v<<1|b>>2,(b&3)<<6|h<<3|f<<2|c>>4,c<<4&224]),w=1536/l*9e4,k=r+s*w,S=e.subarray(n,n+u);return t.config=x,t.channelCount=g,t.samplerate=l,t.samples.push({unit:S,pts:k}),u}class jer extends y_e{resetInitSegment(e,n,r,s){super.resetInitSegment(e,n,r,s),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:n,duration:s,inputTimeScale:9e4,dropped:0}}static probe(e){if(!e)return!1;const n=$6(e,0);let r=(n==null?void 0:n.length)||0;if(n&&e[r]===11&&e[r+1]===119&&a_e(n)!==void 0&&oSt(e,r)<=16)return!1;for(let s=e.length;r<s;r++)if(iSt(e,r))return hi.log("MPEG Audio sync word found !"),!0;return!1}canParse(e,n){return ker(e,n)}appendFrame(e,n,r){if(this.basePTS!==null)return nSt(e,n,r,this.basePTS,this.frameIndex)}}const Eer=/\/emsg[-/]ID3/i;class Ner{constructor(e,n,r,s=hi){this.remainderData=null,this.timeOffset=0,this.config=void 0,this.videoTrack=void 0,this.audioTrack=void 0,this.id3Track=void 0,this.txtTrack=void 0,this.initData=void 0,this.logger=void 0,this.config=n,this.logger=s}resetTimeStamp(){}resetInitSegment(e,n,r,s){const i=this.videoTrack=Vv("video",1),o=this.audioTrack=Vv("audio",1),l=this.txtTrack=Vv("text",1);if(this.id3Track=Vv("id3",1),this.initData=void 0,this.timeOffset=0,!(e!=null&&e.byteLength))return;const c=this.initData=fkt(e);if(c.video){const{id:d,timescale:u,codec:h,supplemental:m}=c.video;i.id=d,i.timescale=l.timescale=u,i.codec=h,i.supplemental=m}if(c.audio){const{id:d,timescale:u,codec:h}=c.audio;o.id=d,o.timescale=u,o.codec=h}l.id=dkt.text,i.sampleDuration=0,i.duration=o.duration=s}resetContiguity(){this.remainderData=null}static probe(e){return PJn(e,"moof")}demux(e,n,r){this.timeOffset=n;let s=e;const i=this.videoTrack,o=this.txtTrack;if(this.config.progressive){this.remainderData&&(s=Wf(this.remainderData,e));const d=UJn(s);this.remainderData=d.remainder,i.samples=d.valid||new Uint8Array}else i.samples=s;const l=this.extractID3Track(i,n),c=this.parseFragment(i,o,n,r);return{videoTrack:i,audioTrack:this.audioTrack,id3Track:l,textTrack:this.txtTrack,initData:this.initData,sampleData:c}}flush(e,n){const r=this.timeOffset,s=this.videoTrack,i=this.txtTrack;s.samples=this.remainderData||new Uint8Array,this.remainderData=null;const o=this.extractID3Track(s,this.timeOffset),l=this.parseFragment(s,i,r,n);return{videoTrack:s,audioTrack:Vv(),id3Track:o,textTrack:Vv(),initData:this.initData,sampleData:l}}parseFragment(e,n,r,s){const i=this.initData;if(i&&s){const{samples:o,sampleData:l}=BJn(r,e,i,this.logger,s.iframe);return n.samples=o,l}n.samples=zJn(r,e)}extractID3Track(e,n){const r=this.id3Track;if(e.samples.length){const s=Gr(e.samples,["emsg"]);s&&s.forEach(i=>{const o=VJn(i);if(Eer.test(o.schemeIdUri)){const l=IUe(o,n);let c=o.eventDuration===4294967295?Number.POSITIVE_INFINITY:o.eventDuration/o.timeScale;c<=.001&&(c=Number.POSITIVE_INFINITY);const d=o.payload;r.samples.push({data:d,len:d.byteLength,dts:l,pts:l,type:xu.emsg,duration:c})}else if(this.config.enableEmsgKLVMetadata){const l=this.config.emsgKLVSchemaUri||xu.misbklv;if(o.schemeIdUri.startsWith(l)){const c=IUe(o,n);r.samples.push({data:o.payload,len:o.payload.byteLength,dts:c,pts:c,type:xu.misbklv,duration:Number.POSITIVE_INFINITY})}}})}return r}demuxSampleAes(e,n,r){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))}destroy(){this.config=null,this.remainderData=null,this.videoTrack=this.audioTrack=this.id3Track=this.txtTrack=void 0,this.initData=void 0}}function IUe(t,e){return xn(t.presentationTime)?t.presentationTime/t.timeScale:e+t.presentationTimeDelta/t.timeScale}const Ter=1,_er=2,w3=-1;class cSt{constructor(){this.VideoSample=null}createVideoSample(e,n,r){return{key:e,frame:!1,pts:n,dts:r,units:[],length:0}}getLastNalUnit(e){var n;let r=this.VideoSample,s;if((!r||r.units.length===0)&&(r=e[e.length-1]),(n=r)!=null&&n.units){const i=r.units;s=i[i.length-1]}return s}pushAccessUnit(e,n){if(e.units.length&&e.frame){if(e.pts===void 0){const r=n.samples,s=r.length;if(s){const i=r[s-1];e.pts=i.pts,e.dts=i.dts}else{n.dropped++;return}}n.samples.push(e)}}parseNALu(e,n,r){const s=n.byteLength;if(s===0)return[];const i=e.naluState||0,o=i===w3?0:i,l=[];let c=0,d=0,u=-1,h=0;for(i===w3&&(u=0,h=this.getNALuType(n,0),d=1);d<s;){const m=n.indexOf(Ter,d);if(m===-1)break;d=m+1;let f=m;for(;f>0&&n[f-1]===0;)f--;if(!(m-f+(f===0?o:0)<_er)){if(u>=0)l.push({data:n.subarray(u,f),type:h});else{const g=this.getLastNalUnit(e.samples);g&&(f>0?g.data=Wf(g.data,n.subarray(0,f)):o>0&&(g.data=g.data.subarray(0,g.data.byteLength-o)),g.state=0)}if(d<s)u=d,h=this.getNALuType(n,d);else{c=w3,u=-1;break}}}if(c!==w3){let m=s;for(;m>0&&n[m-1]===0;)m--;c=s-m+(m===0?o:0)}if(u>=0)l.push({data:n.subarray(u),type:h,state:c});else if(l.length===0&&c!==w3){const m=this.getLastNalUnit(e.samples);m&&(m.data=Wf(m.data,n),m.state=c)}return e.naluState=c,l}}class x${constructor(e){this.data=void 0,this.bytesAvailable=void 0,this.word=void 0,this.bitsAvailable=void 0,this.data=e,this.bytesAvailable=e.byteLength,this.word=0,this.bitsAvailable=0}loadWord(){const e=this.data,n=this.bytesAvailable,r=e.byteLength-n,s=new Uint8Array(4),i=Math.min(4,n);if(i===0)throw new Error("no bytes available");s.set(e.subarray(r,r+i)),this.word=new DataView(s.buffer).getUint32(0),this.bitsAvailable=i*8,this.bytesAvailable-=i}skipBits(e){let n;e=Math.min(e,this.bytesAvailable*8+this.bitsAvailable),this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,n=e>>3,e-=n<<3,this.bytesAvailable-=n,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}readBits(e){let n=Math.min(this.bitsAvailable,e);const r=this.word>>>32-n;if(e>32&&hi.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=n,this.bitsAvailable>0)this.word<<=n;else if(this.bytesAvailable>0)this.loadWord();else throw new Error("no bits available");return n=e-n,n>0&&this.bitsAvailable?r<<n|this.readBits(n):r}skipLZ(){let e;for(e=0;e<this.bitsAvailable;++e)if(this.word&2147483648>>>e)return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}skipUEG(){this.skipBits(1+this.skipLZ())}skipEG(){this.skipBits(1+this.skipLZ())}readUEG(){const e=this.skipLZ();return this.readBits(e+1)-1}readEG(){const e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}readBoolean(){return this.readBits(1)===1}readUByte(){return this.readBits(8)}}class Aer extends cSt{parsePES(e,n,r,s,i){const o=i.iframe,l=this.parseNALu(e,r.data,s);let c=this.VideoSample,d,u=!1;r.data=null,c&&l.length&&!e.audFound&&(this.pushAccessUnit(c,e),c=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts)),l.forEach(h=>{var m,f;switch(h.type){case 1:{if(o)break;let b=!1;d=!0;const x=h.data;if(u&&x.length>4){const w=this.readSliceType(x);(w===2||w===4||w===7||w===9)&&(b=!0)}if(b){var p;(p=c)!=null&&p.frame&&!c.key&&(this.pushAccessUnit(c,e),c=this.VideoSample=null)}c||(c=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts)),c.frame=!0,c.key=b;break}case 5:d=!0,(m=c)!=null&&m.frame&&!c.key&&(this.pushAccessUnit(c,e),c=this.VideoSample=null),c||(c=this.VideoSample=this.createVideoSample(!0,r.pts,r.dts)),c.key=!0,c.frame=!0;break;case 6:{if(o)break;d=!0,O6(h.data,1,r.pts,n.samples);break}case 7:{var g,v;d=!0,u=!0;const b=h.data,x=this.readSPS(b);if(!e.sps||e.width!==x.width||e.height!==x.height||((g=e.pixelRatio)==null?void 0:g[0])!==x.pixelRatio[0]||((v=e.pixelRatio)==null?void 0:v[1])!==x.pixelRatio[1]){e.width=x.width,e.height=x.height,e.pixelRatio=x.pixelRatio,e.sps=[b];const w=b.subarray(1,4);let k="avc1.";for(let S=0;S<3;S++){let C=w[S].toString(16);C.length<2&&(C="0"+C),k+=C}e.codec=k}break}case 8:d=!0,e.pps=[h.data];break;case 9:d=!0,e.audFound=!0,(f=c)!=null&&f.frame&&(this.pushAccessUnit(c,e),c=null),c||(c=this.VideoSample=this.createVideoSample(!1,r.pts,r.dts));break;case 12:d=!0;break;default:d=!1;break}c&&d&&c.units.push(h)}),s&&c&&(this.pushAccessUnit(c,e),this.VideoSample=null)}getNALuType(e,n){return e[n]&31}readSliceType(e){const n=new x$(e);return n.readUByte(),n.readUEG(),n.readUEG()}skipScalingList(e,n){let r=8,s=8,i;for(let o=0;o<e;o++)s!==0&&(i=n.readEG(),s=(r+i+256)%256),r=s===0?r:s}readSPS(e){const n=new x$(e);let r=0,s=0,i=0,o=0,l,c,d;const u=n.readUByte.bind(n),h=n.readBits.bind(n),m=n.readUEG.bind(n),f=n.readBoolean.bind(n),p=n.skipBits.bind(n),g=n.skipEG.bind(n),v=n.skipUEG.bind(n),b=this.skipScalingList.bind(this);u();const x=u();if(h(5),p(3),u(),v(),x===100||x===110||x===122||x===244||x===44||x===83||x===86||x===118||x===128){const E=m();if(E===3&&p(1),v(),v(),p(1),f())for(c=E!==3?8:12,d=0;d<c;d++)f()&&(d<6?b(16,n):b(64,n))}v();const w=m();if(w===0)m();else if(w===1)for(p(1),g(),g(),l=m(),d=0;d<l;d++)g();v(),p(1);const k=m(),S=m(),C=h(1);C===0&&p(1),p(1),f()&&(r=m(),s=m(),i=m(),o=m());let j=[1,1];if(f()&&f())switch(u()){case 1:j=[1,1];break;case 2:j=[12,11];break;case 3:j=[10,11];break;case 4:j=[16,11];break;case 5:j=[40,33];break;case 6:j=[24,11];break;case 7:j=[20,11];break;case 8:j=[32,11];break;case 9:j=[80,33];break;case 10:j=[18,11];break;case 11:j=[15,11];break;case 12:j=[64,33];break;case 13:j=[160,99];break;case 14:j=[4,3];break;case 15:j=[3,2];break;case 16:j=[2,1];break;case 255:{j=[u()<<8|u(),u()<<8|u()];break}}return{width:Math.ceil((k+1)*16-r*2-s*2),height:(2-C)*(S+1)*16-(C?2:4)*(i+o),pixelRatio:j}}}class Per extends cSt{constructor(...e){super(...e),this.initVPS=null}parsePES(e,n,r,s){const i=this.parseNALu(e,r.data,s);let o=this.VideoSample,l,c=!1;r.data=null;const d=u=>(o=this.VideoSample=this.createVideoSample(u,r.pts,r.dts),o);i.forEach((u,h)=>{var m,f;if(this.startsNewAccessUnit(o,e,u,h)){this.pushAccessUnit(o,e);const g=u.type>=16&&u.type<=23;o=d(g),c=!1}switch(u.type){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:o||(o=d(!1)),o.frame=!0,l=!0;break;case 16:case 17:case 18:case 21:case 22:case 23:if(l=!0,c){var p;(p=o)!=null&&p.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null)}o||(o=d(!0)),o.key=!0,o.frame=!0;break;case 19:case 20:l=!0,(m=o)!=null&&m.frame&&!o.key&&(this.pushAccessUnit(o,e),o=this.VideoSample=null),o||(o=d(!0)),o.key=!0,o.frame=!0;break;case 39:l=!0,O6(u.data,2,r.pts,n.samples);break;case 32:l=!0,e.vps||(typeof e.params!="object"&&(e.params={}),e.params=Mi(e.params,this.readVPS(u.data)),this.initVPS=u.data),e.vps=[u.data];break;case 33:if(l=!0,c=!0,e.vps!==void 0&&e.vps[0]!==this.initVPS&&e.sps!==void 0&&!this.matchSPS(e.sps[0],u.data)&&(this.initVPS=e.vps[0],e.sps=e.pps=void 0),!e.sps){const g=this.readSPS(u.data);e.width=g.width,e.height=g.height,e.pixelRatio=g.pixelRatio,e.codec=g.codecString,e.sps=[],typeof e.params!="object"&&(e.params={});for(const v in g.params)e.params[v]=g.params[v]}this.pushParameterSet(e.sps,u.data,e.vps),o||(o=d(!1));break;case 34:if(l=!0,typeof e.params=="object"){if(!e.pps){e.pps=[];const g=this.readPPS(u.data);for(const v in g)e.params[v]=g[v]}this.pushParameterSet(e.pps,u.data,e.vps)}break;case 35:l=!0,e.audFound=!0,(f=o)!=null&&f.frame&&(this.pushAccessUnit(o,e),o=null),o||(o=d(!1));break;default:l=!1;break}o&&l&&o.units.push(u)}),s&&o&&(this.pushAccessUnit(o,e),this.VideoSample=null)}pushParameterSet(e,n,r){(r&&r[0]===this.initVPS||!r&&!e.length)&&e.push(n)}startsNewAccessUnit(e,n,r,s){if(!e)return!1;if(!n.audFound&&s===0)return!0;if(!e.frame)return!1;const{type:i,data:o}=r;return i>=32&&i<=35||i===39||i>=41&&i<=44||i>=48&&i<=55?!0:i<=31&&o.length>2&&(o[2]&128)!==0}getNALuType(e,n){return(e[n]&126)>>>1}ebsp2rbsp(e){const n=new Uint8Array(e.byteLength);let r=0;for(let s=0;s<e.byteLength;s++)s>=2&&e[s]===3&&e[s-1]===0&&e[s-2]===0||(n[r]=e[s],r++);return new Uint8Array(n.buffer,0,r)}pushAccessUnit(e,n){super.pushAccessUnit(e,n),this.initVPS&&(this.initVPS=null)}readVPS(e){const n=new x$(e);n.readUByte(),n.readUByte(),n.readBits(4),n.skipBits(2),n.readBits(6);const r=n.readBits(3),s=n.readBoolean();return{numTemporalLayers:r+1,temporalIdNested:s}}readSPS(e){const n=new x$(this.ebsp2rbsp(e));n.readUByte(),n.readUByte(),n.readBits(4);const r=n.readBits(3);n.readBoolean();const s=n.readBits(2),i=n.readBoolean(),o=n.readBits(5),l=n.readUByte(),c=n.readUByte(),d=n.readUByte(),u=n.readUByte(),h=n.readUByte(),m=n.readUByte(),f=n.readUByte(),p=n.readUByte(),g=n.readUByte(),v=n.readUByte(),b=n.readUByte(),x=[],w=[];for(let ie=0;ie<r;ie++)x.push(n.readBoolean()),w.push(n.readBoolean());if(r>0)for(let ie=r;ie<8;ie++)n.readBits(2);for(let ie=0;ie<r;ie++)x[ie]&&(n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte(),n.readUByte()),w[ie]&&n.readUByte();n.readUEG();const k=n.readUEG();k==3&&n.skipBits(1);const S=n.readUEG(),C=n.readUEG(),j=n.readBoolean();let E=0,N=0,A=0,_=0;j&&(E+=n.readUEG(),N+=n.readUEG(),A+=n.readUEG(),_+=n.readUEG());const T=n.readUEG(),R=n.readUEG(),O=n.readUEG(),F=n.readBoolean();for(let ie=F?0:r;ie<=r;ie++)n.skipUEG(),n.skipUEG(),n.skipUEG();if(n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG(),n.readBoolean()&&n.readBoolean())for(let he=0;he<4;he++)for(let ye=0;ye<(he===3?2:6);ye++)if(!n.readBoolean())n.readUEG();else{const K=Math.min(64,1<<4+(he<<1));he>1&&n.readEG();for(let ce=0;ce<K;ce++)n.readEG()}n.readBoolean(),n.readBoolean(),n.readBoolean()&&(n.readUByte(),n.skipUEG(),n.skipUEG(),n.readBoolean());const P=n.readUEG();let M=0;for(let ie=0;ie<P;ie++){let he=!1;if(ie!==0&&(he=n.readBoolean()),he){ie===P&&n.readUEG(),n.readBoolean(),n.readUEG();let ye=0;for(let J=0;J<=M;J++){const K=n.readBoolean();let ce=!1;K||(ce=n.readBoolean()),(K||ce)&&ye++}M=ye}else{const ye=n.readUEG(),J=n.readUEG();M=ye+J;for(let K=0;K<ye;K++)n.readUEG(),n.readBoolean();for(let K=0;K<J;K++)n.readUEG(),n.readBoolean()}}if(n.readBoolean()){const ie=n.readUEG();for(let he=0;he<ie;he++){for(let ye=0;ye<O+4;ye++)n.readBits(1);n.readBits(1)}}let G=0,B=1,H=1,W=!0,V=1,U=0;n.readBoolean(),n.readBoolean();let ne=!1;if(n.readBoolean()){if(n.readBoolean()){const pe=n.readUByte(),Ie=[1,12,10,16,40,24,20,32,80,18,15,64,160,4,3,2],Me=[1,11,11,11,33,11,11,11,33,11,11,33,99,3,2,1];pe>0&&pe<16?(B=Ie[pe-1],H=Me[pe-1]):pe===255&&(B=n.readBits(16),H=n.readBits(16))}if(n.readBoolean()&&n.readBoolean(),n.readBoolean()&&(n.readBits(3),n.readBoolean(),n.readBoolean()&&(n.readUByte(),n.readUByte(),n.readUByte())),n.readBoolean()&&(n.readUEG(),n.readUEG()),n.readBoolean(),n.readBoolean(),n.readBoolean(),ne=n.readBoolean(),ne&&(n.skipUEG(),n.skipUEG(),n.skipUEG(),n.skipUEG()),n.readBoolean()&&(V=n.readBits(32),U=n.readBits(32),n.readBoolean()&&n.readUEG(),n.readBoolean())){const Me=n.readBoolean(),we=n.readBoolean();let Be=!1;(Me||we)&&(Be=n.readBoolean(),Be&&(n.readUByte(),n.readBits(5),n.readBoolean(),n.readBits(5)),n.readBits(4),n.readBits(4),Be&&n.readBits(4),n.readBits(5),n.readBits(5),n.readBits(5));for(let Ve=0;Ve<=r;Ve++){W=n.readBoolean();const be=W||n.readBoolean();let Ze=!1;be?n.readEG():Ze=n.readBoolean();const Pe=Ze?1:n.readUEG()+1;if(Me)for(let Ke=0;Ke<Pe;Ke++)n.readUEG(),n.readUEG(),Be&&(n.readUEG(),n.readUEG()),n.skipBits(1);if(we)for(let Ke=0;Ke<Pe;Ke++)n.readUEG(),n.readUEG(),Be&&(n.readUEG(),n.readUEG()),n.skipBits(1)}}n.readBoolean()&&(n.readBoolean(),n.readBoolean(),n.readBoolean(),G=n.readUEG())}let re=S,fe=C;if(j){let ie=1,he=1;k===1?ie=he=2:k==2&&(ie=2),re=S-ie*N-ie*E,fe=C-he*_-he*A}const le=s?["A","B","C"][s]:"",q=l<<24|c<<16|d<<8|u;let Y=0;for(let ie=0;ie<32;ie++)Y=(Y|(q>>ie&1)<<31-ie)>>>0;let X=Y.toString(16);return o===1&&X==="2"&&(X="6"),{codecString:`hvc1.${le}${o}.${X}.${i?"H":"L"}${b}.B0`,params:{general_tier_flag:i,general_profile_idc:o,general_profile_space:s,general_profile_compatibility_flags:[l,c,d,u],general_constraint_indicator_flags:[h,m,f,p,g,v],general_level_idc:b,bit_depth:T+8,bit_depth_luma_minus8:T,bit_depth_chroma_minus8:R,min_spatial_segmentation_idc:G,chroma_format_idc:k,frame_rate:{fixed:W,fps:U/V}},width:re,height:fe,pixelRatio:[B,H]}}readPPS(e){const n=new x$(this.ebsp2rbsp(e));n.readUByte(),n.readUByte(),n.skipUEG(),n.skipUEG(),n.skipBits(2),n.skipBits(3),n.skipBits(2),n.skipUEG(),n.skipUEG(),n.skipEG(),n.skipBits(2),n.readBoolean()&&n.skipUEG(),n.skipEG(),n.skipEG(),n.skipBits(4);const s=n.readBoolean(),i=n.readBoolean();let o=1;return i&&s?o=0:i?o=3:s&&(o=2),{parallelismType:o}}matchSPS(e,n){return jg(e).substring(3)===jg(n).substring(3)}}const Bl=188;class Wb{constructor(e,n,r,s){this.logger=void 0,this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.sampleAes=null,this.pmtParsed=!1,this.audioCodec=void 0,this.videoCodec=void 0,this._pmtId=-1,this._videoTrack=void 0,this._audioTrack=void 0,this._id3Track=void 0,this._txtTrack=void 0,this._klvPid=-1,this.aacOverFlow=null,this.remainderData=null,this.videoParser=void 0,this.videoIntegrityChecker=null,this.observer=e,this.config=n,this.typeSupported=r,this.logger=s,this.videoParser=null}static probe(e,n){const r=Wb.syncOffset(e);return r>0&&n.warn(`MPEG2-TS detected but first sync word found @ offset ${r}`),r!==-1}static syncOffset(e){const n=e.length;let r=Math.min(Bl*5,n-Bl)+1,s=0;for(;s<r;){let i=!1,o=-1,l=0;for(let c=s;c<n;c+=Bl)if(e[c]===71&&(n-c===Bl||e[c+Bl]===71)){if(l++,o===-1&&(o=c,o!==0&&(r=Math.min(o+Bl*99,e.length-Bl)+1)),i||(i=mZ(e,c)===0),i&&l>1&&(o===0&&l>2||c+Bl>r))return o}else{if(l)return-1;break}s++}return-1}static createTrack(e,n){return{container:e==="video"||e==="audio"?"video/mp2t":void 0,type:e,id:dkt[e],pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0,duration:e==="audio"?n:void 0}}resetInitSegment(e,n,r,s,i,o){this.pmtParsed=!1,this._pmtId=-1,this._videoTrack=Wb.createTrack("video"),this._videoTrack.duration=s,this.videoIntegrityChecker=this.config.handleMpegTsVideoIntegrityErrors==="skip"?new Mer(this.logger):null,this._audioTrack=Wb.createTrack("audio",s),this._id3Track=Wb.createTrack("id3"),this._txtTrack=Wb.createTrack("text"),this._audioTrack.segmentCodec="aac",this.videoParser=null,this.aacOverFlow=null,this.remainderData=null,this.audioCodec=n,this.videoCodec=r,e&&this.demux(e,0,o,(i==null?void 0:i.method)==="SAMPLE-AES")}resetTimeStamp(){}resetContiguity(){const{_audioTrack:e,_videoTrack:n,_id3Track:r}=this;e&&(e.pesData=null),n&&(n.pesData=null),r&&(r.pesData=null),this.aacOverFlow=null,this.remainderData=null}demux(e,n,r,s=!1,i=!1){s||(this.sampleAes=null);let o;const l=this._videoTrack,c=this.videoIntegrityChecker,d=this._audioTrack,u=this._id3Track,h=this._txtTrack,m=r.iframe;let f=l.pid,p=l.pesData,g=d.pid,v=u.pid,b=this._klvPid,x=d.pesData,w=u.pesData,k=null,S=null,C=this.pmtParsed,j=this._pmtId,E=e.length;if(this.remainderData&&(e=Wf(this.remainderData,e),E=e.length,this.remainderData=null),E<Bl&&!i)return this.remainderData=e,{audioTrack:d,videoTrack:l,id3Track:u,textTrack:h};const N=Math.max(0,Wb.syncOffset(e));E-=(E-N)%Bl,E<e.byteLength&&!i&&(this.remainderData=new Uint8Array(e.buffer,E,e.buffer.byteLength-E));let A=0;for(let T=N;T<E;T+=Bl)if(e[T]===71){const R=!!(e[T+1]&64),O=mZ(e,T),F=(e[T+3]&48)>>4;let D;if(F>1){if(D=T+5+e[T+4],D===T+Bl)continue}else D=T+4;switch(O){case f:R&&(p&&!(c!=null&&c.isCorrupted)&&(o=iC(p,this.logger))&&(this.readyVideoParser(l.segmentCodec),this.videoParser!==null&&this.videoParser.parsePES(l,h,o,!1,r)),p={data:[],size:0},c==null||c.reset(f)),c==null||c.handlePacket(e.subarray(T)),p&&(p.data.push(e.subarray(D,T+Bl)),p.size+=T+Bl-D);break;case g:if(m)break;if(R){if(x&&(o=iC(x,this.logger)))switch(d.segmentCodec){case"aac":this.parseAACPES(d,o,r);break;case"mp3":this.parseMPEGPES(d,o);break;case"ac3":this.parseAC3PES(d,o);break}x={data:[],size:0}}x&&(x.data.push(e.subarray(D,T+Bl)),x.size+=T+Bl-D);break;case v:if(m)break;R&&(w&&(o=iC(w,this.logger))&&this.parseID3PES(u,o),w={data:[],size:0}),w&&(w.data.push(e.subarray(D,T+Bl)),w.size+=T+Bl-D);break;case b:if(m)break;R&&(k&&(o=iC(k,this.logger))&&this.parseKlvPES(u,o),k={data:[],size:0}),k&&(k.data.push(e.subarray(D,T+Bl)),k.size+=T+Bl-D);break;case 0:R&&(D+=e[D]+1),j=this._pmtId=Rer(e,D);break;case j:{R&&(D+=e[D]+1);const I=Ier(e,D,this.typeSupported,s,this.observer,this.logger,this.config,r);f=I.videoPid,f>0&&(l.pid=f,l.segmentCodec=I.segmentVideoCodec),g=I.audioPid,g>0&&(d.pid=g,d.segmentCodec=I.segmentAudioCodec),v=I.id3Pid,v>0&&(u.pid=v),b=I.klvPid,b>0&&(this._klvPid=b),S!==null&&!C&&(this.logger.warn(`MPEG-TS PMT found at ${T} after unknown PID '${S}'. Backtracking to sync byte @${N} to parse all TS packets.`),S=null,T=N-188),C=this.pmtParsed=!0;break}case 17:case 8191:break;default:S=O;break}}else A++;A>0&&oxe(this.observer,new Error(`Found ${A} TS packet/s that do not start with 0x47`),r,void 0,this.logger),l.pesData=p,d.pesData=x,u.pesData=w;const _={audioTrack:d,videoTrack:l,id3Track:u,textTrack:h};return i&&this.extractRemainingSamples(_,r),_}flush(e,n){const{remainderData:r}=this;this.remainderData=null;let s;return r?s=this.demux(r,0,n,!1,!0):s={videoTrack:this._videoTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(s,n),this.sampleAes?this.decrypt(s,this.sampleAes):s}extractRemainingSamples(e,n){const{audioTrack:r,videoTrack:s,id3Track:i,textTrack:o}=e,l=s.pesData,c=r.pesData,d=i.pesData,u=this.videoIntegrityChecker;let h;if(l&&!(u!=null&&u.isCorrupted)&&(h=iC(l,this.logger))?(this.readyVideoParser(s.segmentCodec),this.videoParser!==null&&(this.videoParser.parsePES(s,o,h,!0,n),s.pesData=null)):s.pesData=l,c&&(h=iC(c,this.logger))){switch(r.segmentCodec){case"aac":this.parseAACPES(r,h,n);break;case"mp3":this.parseMPEGPES(r,h);break;case"ac3":this.parseAC3PES(r,h);break}r.pesData=null}else c!=null&&c.size&&this.logger.log("last AAC PES packet truncated,might overlap between fragments"),r.pesData=c;d&&(h=iC(d,this.logger))?(this.parseID3PES(i,h),i.pesData=null):i.pesData=d}demuxSampleAes(e,n,r,s){const i=this.demux(e,r,s,!0,!this.config.progressive),o=this.sampleAes=new aSt(this.observer,this.config,n);return this.decrypt(i,o)}readyVideoParser(e){this.videoParser===null&&(e==="avc"?this.videoParser=new Aer:e==="hevc"&&(this.videoParser=new Per))}decrypt(e,n){return new Promise(r=>{const{audioTrack:s,videoTrack:i}=e;s.samples&&s.segmentCodec==="aac"?n.decryptAacSamples(s.samples,0,()=>{i.samples?n.decryptAvcSamples(i.samples,0,0,()=>{r(e)}):r(e)}):i.samples&&n.decryptAvcSamples(i.samples,0,0,()=>{r(e)})})}destroy(){this.observer&&this.observer.removeAllListeners(),this.config=this.logger=this.observer=null,this.aacOverFlow=this.videoParser=this.remainderData=this.sampleAes=null,this._videoTrack=this._audioTrack=this._id3Track=this._txtTrack=void 0,this.videoIntegrityChecker=null}parseAACPES(e,n,r){let s=0;const i=this.aacOverFlow;let o=n.data;if(i){this.aacOverFlow=null;const m=i.missing,f=i.sample.unit.byteLength;if(m===-1)o=Wf(i.sample.unit,o);else{const p=f-m;i.sample.unit.set(o.subarray(0,m),p),e.samples.push(i.sample),s=i.missing}}let l,c;for(l=s,c=o.length;l<c-1&&!hZ(o,l);l++);if(l!==s){let m;const f=l<c-1;if(f?m=`AAC PES did not start with ADTS header,offset:${l}`:m="No ADTS header found in AAC PES",oxe(this.observer,new Error(m),r,f,this.logger),!f)return}Xkt(e,this.observer,o,l,this.audioCodec);let d;if(n.pts!==void 0)d=n.pts;else if(i){const m=eSt(e.samplerate);d=i.sample.pts+m}else{this.logger.warn("[tsdemuxer]: AAC PES unknown PTS");return}let u=0,h;for(;l<c;)if(h=tSt(e,o,l,d,u),l+=h.length,h.missing){this.aacOverFlow=h;break}else for(u++;l<c-1&&!hZ(o,l);l++);}parseMPEGPES(e,n){const r=n.data,s=r.length;let i=0,o=0;const l=n.pts;if(l===void 0){this.logger.warn("[tsdemuxer]: MPEG PES unknown PTS");return}for(;o<s;)if(sSt(r,o)){const c=nSt(e,r,o,l,i);if(c)o+=c.length,i++;else break}else o++}parseAC3PES(e,n){{const r=n.data,s=n.pts;if(s===void 0){this.logger.warn("[tsdemuxer]: AC3 PES unknown PTS");return}const i=r.length;let o=0,l=0,c;for(;l<i&&(c=lSt(e,r,l,s,o++))>0;)l+=c}}parseID3PES(e,n){if(n.pts===void 0){this.logger.warn("[tsdemuxer]: ID3 PES unknown PTS");return}const r=Mi({},n,{type:this._videoTrack?xu.emsg:xu.audioId3,duration:Number.POSITIVE_INFINITY});e.samples.push(r)}parseKlvPES(e,n){var r;const s=(r=n.pts)!=null?r:n.dts;if(s===void 0){this.logger.warn("[tsdemuxer]: KLV PES unknown PTS and DTS");return}const i=n.data;if(i.length<16){this.logger.warn("[tsdemuxer]: KLV PES payload too short");return}let o=0;for(;o<i.length;){var l;if(o+16>i.length)break;const c=o;if(o+=16,o>=i.length)break;const d=i[o];o+=1;let u=0;if(d&128){const p=d&127;if(p===0||p>4||o+p>i.length){this.logger.warn("[tsdemuxer]: Invalid KLV length encoding");break}for(let g=0;g<p;g++)u=u<<8|i[o+g];o+=p}else u=d;if(o+u>i.length){this.logger.warn("[tsdemuxer]: KLV value extends beyond PES payload");break}const h=o+u,m=i.subarray(c,h),f={data:m,len:m.byteLength,pts:s,dts:(l=n.dts)!=null?l:s,type:xu.misbklv,duration:Number.POSITIVE_INFINITY};e.samples.push(f),o=h}}}function mZ(t,e){return((t[e+1]&31)<<8)+t[e+2]}function Rer(t,e){return(t[e+10]&31)<<8|t[e+11]}function Ier(t,e,n,r,s,i,o,l){const c={audioPid:-1,videoPid:-1,id3Pid:-1,klvPid:-1,segmentVideoCodec:"avc",segmentAudioCodec:"aac"},d=(t[e+1]&15)<<8|t[e+2],u=e+3+d-4,h=(t[e+10]&15)<<8|t[e+11];for(e+=12+h;e<u;){const m=mZ(t,e),f=(t[e+3]&15)<<8|t[e+4];switch(t[e]){case 207:if(!r){Sde("ADTS AAC",i);break}case 15:c.audioPid===-1&&(c.audioPid=m);break;case 21:c.id3Pid===-1&&(c.id3Pid=m);break;case 219:if(!r){Sde("H.264",i);break}case 27:c.videoPid===-1&&(c.videoPid=m);break;case 3:case 4:!n.mpeg&&!n.mp3?i.log("MPEG audio found, not supported in this browser"):c.audioPid===-1&&(c.audioPid=m,c.segmentAudioCodec="mp3");break;case 193:if(!r){Sde("AC-3",i);break}case 129:n.ac3?c.audioPid===-1&&(c.audioPid=m,c.segmentAudioCodec="ac3"):i.log("AC-3 audio found, not supported in this browser");break;case 6:if(f>0){let p=e+5,g=f;for(;g>2;){switch(t[p]){case 106:c.audioPid===-1&&(n.ac3!==!0?i.log("AC-3 audio found, not supported in this browser for now"):(c.audioPid=m,c.segmentAudioCodec="ac3"));break;case 5:c.klvPid===-1&&o.enableEmsgKLVMetadata&&(c.klvPid=m,i.log(`KLV metadata PID found: ${m}`));break}const b=t[p+1]+2;p+=b,g-=b}}break;case 194:case 135:return oxe(s,new Error("Unsupported EC-3 in M2TS found"),l,void 0,i),c;case 36:c.videoPid===-1&&(c.videoPid=m,c.segmentVideoCodec="hevc",i.log("HEVC in M2TS found"));break}e+=f+5}return c}function oxe(t,e,n,r,s){s.warn(`parsing error: ${e.message}`),t.emit(oe.ERROR,oe.ERROR,{type:er.MEDIA_ERROR,details:rt.FRAG_PARSING_ERROR,fatal:!1,levelRetry:r,chunkMeta:n,error:e,reason:e.message})}function Sde(t,e){e.log(`${t} with AES-128-CBC encryption found in unencrypted stream`)}function iC(t,e){let n=0,r,s,i,o,l;const c=t.data;if(!t||t.size===0)return null;for(;c[0].length<19&&c.length>1;)c[0]=Wf(c[0],c[1]),c.splice(1,1);if(r=c[0],(r[0]<<16)+(r[1]<<8)+r[2]===1){if(s=(r[4]<<8)+r[5],s&&s>t.size-6)return null;const u=r[7];u&192&&(o=(r[9]&14)*536870912+(r[10]&255)*4194304+(r[11]&254)*16384+(r[12]&255)*128+(r[13]&254)/2,u&64?(l=(r[14]&14)*536870912+(r[15]&255)*4194304+(r[16]&254)*16384+(r[17]&255)*128+(r[18]&254)/2,o-l>60*9e4&&(e.warn(`${Math.round((o-l)/9e4)}s delta between PTS and DTS, align them`),o=l)):l=o),i=r[8];let h=i+9;if(t.size<=h)return null;t.size-=h;const m=new Uint8Array(t.size);for(let f=0,p=c.length;f<p;f++){r=c[f];let g=r.byteLength;if(h)if(h>g){h-=g;continue}else r=r.subarray(h),g-=h,h=0;m.set(r,n),n+=g}return s&&(s-=i+3),{data:m,pts:o,dts:l,len:s}}return null}class Mer{constructor(e){this.logger=void 0,this.pid=0,this.lastContinuityCounter=-1,this.integrityState="ok",this.logger=e}get isCorrupted(){return this.integrityState!=="ok"}reset(e){this.pid=e,this.lastContinuityCounter=-1,this.integrityState="ok"}handlePacket(e){if(e.byteLength<4)return;const n=mZ(e,0);if(n!==this.pid){this.logger.debug(`Packet PID mismatch, expected ${this.pid} got ${n}`);return}const r=(e[3]&48)>>4;if(r===0)return;const s=e[3]&15,i=this.lastContinuityCounter;this.lastContinuityCounter=s;const o=(r&1)!=0;if((r&2)!=0&&e[4]!=0&&(e[5]&128)!=0||i<0)return;const d=o?i+1&15:i;if(s!==d){this.logger.warn(`MPEG-TS Continuity Counter check failed for PID='${n}', CC=${s}, Expected-CC=${d} Last-CC=${i}`),this.integrityState="cc-failed";return}if(e[1]&128){this.logger.warn(`MPEG-TS Packet had TEI flag set for PID='${n}'`),this.integrityState="tei-bit";return}}}class Ler{static getSilentFrame(e,n){switch(e){case"mp4a.40.2":if(n===1)return new Uint8Array([0,200,0,128,35,128]);if(n===2)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(n===3)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(n===4)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(n===5)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(n===6)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]);break;default:if(n===1)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(n===2)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(n===3)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);break}}}var fZ;const Der={video:new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),audio:new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0])},Cde=new Uint8Array([0,0,0,0,0,0,0,0]),$er=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),Oer=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),Fer=new Uint8Array([0,0,0,0,0,0,0,0]),k3=new Uint8Array([0,0,0,0,0,0,0,1]),MUe=new Uint8Array([105,115,111,109]),Ber=new Uint8Array([97,118,99,49]),Uer=new Uint8Array([0,0,0,1]);class jn{static box(e,...n){let r=8,s=n.length;const i=s;for(;s--;)r+=n[s].byteLength;const o=new Uint8Array(r);for(pl(o,0,r),pl(o,4,e),s=0,r=8;s<i;s++)o.set(n[s],r),r+=n[s].byteLength;return o}static hdlr(e){return jn.box(Lr.hdlr,Der[e])}static mdat(e){return jn.box(Lr.mdat,e)}static mdhd(e,n){n*=e;const r=Math.floor(n/(Rv+1)),s=Math.floor(n%(Rv+1));return jn.box(Lr.mdhd,new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,r>>24,r>>16&255,r>>8&255,r&255,s>>24,s>>16&255,s>>8&255,s&255,85,196,0,0]))}static mdia(e){return jn.box(Lr.mdia,jn.mdhd(e.timescale||0,e.duration||0),jn.hdlr(e.type),jn.minf(e))}static mfhd(e){return jn.box(Lr.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,e&255]))}static minf(e){return e.type==="audio"?jn.box(Lr.minf,jn.box(Lr.smhd,Fer),jn.DINF,jn.stbl(e)):jn.box(Lr.minf,jn.box(Lr.vmhd,Oer),jn.DINF,jn.stbl(e))}static moof(e,n,r){return jn.box(Lr.moof,jn.mfhd(e),jn.traf(r,n))}static moov(e){let n=e.length;const r=[];for(;n--;)r[n]=jn.trak(e[n]);return jn.box.apply(null,[Lr.moov,jn.mvhd(e[0].timescale||0,e[0].duration||0)].concat(r).concat(jn.mvex(e)))}static mvex(e){let n=e.length;const r=[];for(;n--;)r[n]=jn.trex(e[n]);return jn.box.apply(null,[Lr.mvex,...r])}static mvhd(e,n){n*=e;const r=Math.floor(n/(Rv+1)),s=Math.floor(n%(Rv+1)),i=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,e&255,r>>24,r>>16&255,r>>8&255,r&255,s>>24,s>>16&255,s>>8&255,s&255,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return jn.box(Lr.mvhd,i)}static sdtp(e){const n=e.samples||[],r=new Uint8Array(4+n.length);let s,i;for(s=0;s<n.length;s++)i=n[s].flags,r[s+4]=i.dependsOn<<4|i.isDependedOn<<2|i.hasRedundancy;return jn.box(Lr.sdtp,r)}static stbl(e){return jn.box(Lr.stbl,jn.stsd(e),jn.box(Lr.stts,Cde),jn.box(Lr.stsc,Cde),jn.box(Lr.stsz,$er),jn.box(Lr.stco,Cde))}static avc1(e){let n=[],r=[],s,i,o;for(s=0;s<e.sps.length;s++)i=e.sps[s],o=i.byteLength,n.push(o>>>8&255),n.push(o&255),n=n.concat(Array.prototype.slice.call(i));for(s=0;s<e.pps.length;s++)i=e.pps[s],o=i.byteLength,r.push(o>>>8&255),r.push(o&255),r=r.concat(Array.prototype.slice.call(i));const l=jn.box(Lr.avcC,new Uint8Array([1,n[3],n[4],n[5],255,224|e.sps.length].concat(n).concat([e.pps.length]).concat(r))),c=e.width,d=e.height,u=e.pixelRatio[0],h=e.pixelRatio[1];return jn.box(Lr.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,c>>8&255,c&255,d>>8&255,d&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),l,jn.box(Lr.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),jn.box(Lr.pasp,new Uint8Array([u>>24,u>>16&255,u>>8&255,u&255,h>>24,h>>16&255,h>>8&255,h&255])))}static esds(e){const n=e.config,r=n.length;return new Uint8Array([0,0,0,0,3,23+r,0,1,0,4,15+r,64,21,0,0,0,0,0,0,0,0,0,0,0,5,r,...n,6,1,2])}static audioStsd(e){const n=e.samplerate||0;return new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount||0,0,16,0,0,0,0,n>>8&255,n&255,0,0])}static mp4a(e){return jn.box(Lr.mp4a,jn.audioStsd(e),jn.box(Lr.esds,jn.esds(e)))}static mp3(e){return jn.box(Lr[".mp3"],jn.audioStsd(e))}static ac3(e){return jn.box(Lr["ac-3"],jn.audioStsd(e),jn.box(Lr.dac3,e.config))}static stsd(e){const{segmentCodec:n}=e;if(e.type==="audio"){if(n==="aac")return jn.box(Lr.stsd,k3,jn.mp4a(e));if(n==="ac3"&&e.config)return jn.box(Lr.stsd,k3,jn.ac3(e));if(n==="mp3"&&e.codec==="mp3")return jn.box(Lr.stsd,k3,jn.mp3(e))}else if(e.pps&&e.sps){if(n==="avc")return jn.box(Lr.stsd,k3,jn.avc1(e));if(n==="hevc"&&e.vps)return jn.box(Lr.stsd,k3,jn.hvc1(e))}else throw new Error("video track missing pps or sps");throw new Error(`unsupported ${e.type} segment codec (${n}/${e.codec})`)}static tkhd(e){const n=e.id,r=(e.duration||0)*(e.timescale||0),s=e.width||0,i=e.height||0,o=Math.floor(r/(Rv+1)),l=Math.floor(r%(Rv+1));return jn.box(Lr.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,n>>24&255,n>>16&255,n>>8&255,n&255,0,0,0,0,o>>24,o>>16&255,o>>8&255,o&255,l>>24,l>>16&255,l>>8&255,l&255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,s>>8&255,s&255,0,0,i>>8&255,i&255,0,0]))}static traf(e,n){const r=jn.sdtp(e),s=e.id,i=Math.floor(n/(Rv+1)),o=Math.floor(n%(Rv+1));return jn.box(Lr.traf,jn.box(Lr.tfhd,new Uint8Array([0,0,0,0,s>>24,s>>16&255,s>>8&255,s&255])),jn.box(Lr.tfdt,new Uint8Array([1,0,0,0,i>>24,i>>16&255,i>>8&255,i&255,o>>24,o>>16&255,o>>8&255,o&255])),jn.trun(e,r.length+16+20+8+16+8+8),r)}static trak(e){return e.duration=e.duration||4294967295,jn.box(Lr.trak,jn.tkhd(e),jn.mdia(e))}static trex(e){const n=e.id;return jn.box(Lr.trex,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,n&255,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}static trun(e,n){const r=e.samples||[],s=r.length,i=12+16*s,o=new Uint8Array(i);let l,c,d,u,h,m;for(n+=8+i,o.set([e.type==="video"?1:0,0,15,1,s>>>24&255,s>>>16&255,s>>>8&255,s&255,n>>>24&255,n>>>16&255,n>>>8&255,n&255],0),l=0;l<s;l++)c=r[l],d=c.duration,u=c.size,h=c.flags,m=c.cts,o.set([d>>>24&255,d>>>16&255,d>>>8&255,d&255,u>>>24&255,u>>>16&255,u>>>8&255,u&255,h.isLeading<<2|h.dependsOn,h.isDependedOn<<6|h.hasRedundancy<<4|h.paddingValue<<1|h.isNonSync,h.degradPrio&61440,h.degradPrio&15,m>>>24&255,m>>>16&255,m>>>8&255,m&255],12+16*l);return jn.box(Lr.trun,o)}static initSegment(e){const n=jn.moov(e);return Wf(jn.FTYP,n)}static hvc1(e){const n=e.params,r=[e.vps,e.sps,e.pps],s=4,i=new Uint8Array([1,n.general_profile_space<<6|(n.general_tier_flag?32:0)|n.general_profile_idc,n.general_profile_compatibility_flags[0],n.general_profile_compatibility_flags[1],n.general_profile_compatibility_flags[2],n.general_profile_compatibility_flags[3],n.general_constraint_indicator_flags[0],n.general_constraint_indicator_flags[1],n.general_constraint_indicator_flags[2],n.general_constraint_indicator_flags[3],n.general_constraint_indicator_flags[4],n.general_constraint_indicator_flags[5],n.general_level_idc,240|n.min_spatial_segmentation_idc>>8,255&n.min_spatial_segmentation_idc,252|n.parallelismType,252|n.chroma_format_idc,248|n.bit_depth_luma_minus8,248|n.bit_depth_chroma_minus8,0,parseInt(n.frame_rate.fps),s-1|n.temporal_id_nested<<2|n.num_temporal_layers<<3|(n.frame_rate.fixed?64:0),r.length]);let o=i.length;for(let p=0;p<r.length;p+=1){o+=3;for(let g=0;g<r[p].length;g+=1)o+=2+r[p][g].length}const l=new Uint8Array(o);l.set(i,0),o=i.length;const c=r.length-1;for(let p=0;p<r.length;p+=1){l.set(new Uint8Array([32+p|(p===c?128:0),0,r[p].length]),o),o+=3;for(let g=0;g<r[p].length;g+=1)l.set(new Uint8Array([r[p][g].length>>8,r[p][g].length&255]),o),o+=2,l.set(r[p][g],o),o+=r[p][g].length}const d=jn.box(Lr.hvcC,l),u=e.width,h=e.height,m=e.pixelRatio[0],f=e.pixelRatio[1];return jn.box(Lr.hvc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,u>>8&255,u&255,h>>8&255,h&255,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),d,jn.box(Lr.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),jn.box(Lr.pasp,new Uint8Array([m>>24,m>>16&255,m>>8&255,m&255,f>>24,f>>16&255,f>>8&255,f&255])))}}fZ=jn;jn.FTYP=fZ.box(Lr.ftyp,MUe,Uer,MUe,Ber);jn.DINF=fZ.box(Lr.dinf,fZ.box(Lr.dref,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1])));const dSt=9e4;function x_e(t,e,n=1,r=!1){const s=t*e*n;return r?Math.round(s):s}function zer(t,e,n=1,r=!1){return x_e(t,e,1/n,r)}function S3(t,e=!1){return x_e(t,1e3,1/dSt,e)}function Ver(t,e=1){return x_e(t,dSt,1/e)}function LUe(t){const{baseTime:e,timescale:n,trackId:r}=t;return`${e/n} (${e}/${n}) trackId: ${r}`}const Her=10*1e3,Ger=1024,Wer=1152,qer=1536,lxe=8589934592;function DUe(t,e,n,r){return{duration:e,size:n,cts:r,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:t?2:1,isNonSync:t?0:1,paddingValue:0}}}class XW extends Fm{constructor(e,n,r,s){super("mp4-remuxer",s),this.observer=void 0,this.config=void 0,this.typeSupported=void 0,this.ISGenerated=!1,this._initPTS=null,this._initDTS=null,this.nextVideoTs=null,this.nextAudioTs=null,this.videoSampleDuration=null,this.isAudioContiguous=!1,this.isVideoContiguous=!1,this.videoTrackConfig=void 0,this.observer=e,this.config=n,this.typeSupported=r,this.ISGenerated=!1}destroy(){this.config=this.videoTrackConfig=this._initPTS=this._initDTS=null}resetTimeStamp(e){const n=this._initPTS;(!n||!e||e.trackId!==n.trackId||e.baseTime!==n.baseTime||e.timescale!==n.timescale)&&this.log(`Reset initPTS: ${n&&LUe(n)} > ${e&&LUe(e)}`),this._initPTS=this._initDTS=e}resetNextTimestamp(){this.log("reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1}resetInitSegment(){this.log("ISGenerated flag reset"),this.ISGenerated=!1,this.videoTrackConfig=void 0}getVideoStartPts(e){let n=!1;const r=e[0].pts,s=e.reduce((i,o)=>{let l=o.pts,c=l-i;return c<-4294967296&&(n=!0,l=em(l,r),c=l-i),c>0?i:l},r);return n&&this.debug("PTS rollover detected"),s}remux(e,n,r,s,i,o,l,c,d){let u,h,m,f,p,g,v=i,b=i;const w=!d.iframe&&e.pid>-1,k=n.pid>-1,S=n.samples.length,C=e.samples.length>0,j=l&&S>0||S>1;if((!w||C)&&(!k||j)||this.ISGenerated||l){if(this.ISGenerated){var N,A,_,T;const D=this.videoTrackConfig;(D&&(n.width!==D.width||n.height!==D.height||((N=n.pixelRatio)==null?void 0:N[0])!==((A=D.pixelRatio)==null?void 0:A[0])||((_=n.pixelRatio)==null?void 0:_[1])!==((T=D.pixelRatio)==null?void 0:T[1]))||!D&&j||this.nextAudioTs===null&&C)&&this.resetInitSegment()}this.ISGenerated||(m=this.generateIS(e,n,i,o));const R=this.isVideoContiguous;let O=-1,F;if(j&&(O=Ker(n.samples),!R&&this.config.forceKeyFrameOnDiscontinuity))if(g=!0,O>0){this.warn(`Dropped ${O} out of ${S} video samples due to a missing keyframe`);const D=this.getVideoStartPts(n.samples);n.samples=n.samples.slice(O),n.dropped+=O,b+=(n.samples[0].pts-D)/n.inputTimeScale,F=b}else O===-1&&(this.warn(`No keyframe found out of ${S} video samples`),g=!1);if(this.ISGenerated){if(C&&j&&i){const D=this.getVideoStartPts(n.samples),P=(em(e.samples[0].pts,D)-D)/n.inputTimeScale;v+=Math.max(0,P),b+=Math.max(0,-P)}if(C){if(e.samplerate||(this.warn("regenerate InitSegment as audio detected"),m=this.generateIS(e,n,i,o)),h=this.remuxAudio(e,v,this.isAudioContiguous,o,k||j||c===Wn.AUDIO?b:void 0,d),j){const D=h?h.endPTS-h.startPTS:0;n.inputTimeScale||(this.warn("regenerate InitSegment as video detected"),m=this.generateIS(e,n,i,o)),u=this.remuxVideo(n,b,R,D,d)}}else j&&(u=this.remuxVideo(n,b,R,0,d));u&&(u.firstKeyFrame=O,u.independent=O!==-1,u.firstKeyFramePTS=F)}}return this.ISGenerated&&this._initPTS&&this._initDTS&&(r.samples.length&&(p=uSt(r,i,this._initPTS,this._initDTS)),s.samples.length&&(f=hSt(s,i,this._initPTS))),{audio:h,video:u,initSegment:m,independent:g,text:f,id3:p}}computeInitPts(e,n,r,s){const i=Math.round(r*n);let o=em(e,i);if(o<i)for(this.log(`Adjusting PTS for rollover in timeline near ${(i-o)/n} ${s}`);o<i;)o+=lxe;return o-i}generateIS(e,n,r,s){const i=e.samples,o=n.samples,l=this.typeSupported,c={},d=this._initPTS,u=!d||s;let h="audio/mp4",m,f,p,g=-1;if(u&&(m=f=1/0),e.config&&i.length){switch(e.timescale=e.samplerate,e.segmentCodec){case"mp3":l.mpeg?(h="audio/mpeg",e.codec=""):l.mp3&&(e.codec="mp3");break;case"ac3":e.codec="ac-3";break}if(c.audio={id:"audio",container:h,codec:e.codec,initSegment:e.segmentCodec==="mp3"&&l.mpeg?new Uint8Array(0):jn.initSegment([e]),metadata:{channelCount:e.channelCount}},u){g=e.id,p=e.inputTimeScale;const v=this.computeInitPts(i[0].pts,p,r,"audio");(!d||p!==d.timescale||r===0&&v<d.baseTime)&&(m=f=v)}}if(n.sps&&n.pps&&o.length){if(n.timescale=n.inputTimeScale,c.video={id:"main",container:"video/mp4",codec:n.codec,initSegment:jn.initSegment([n]),metadata:{width:n.width,height:n.height}},u){g=n.id,p=n.inputTimeScale;const v=this.getVideoStartPts(o),b=em(o[0].dts,v),x=this.computeInitPts(b,p,r,"video"),w=this.computeInitPts(v,p,r,"video");(!d||p!==d.timescale||xn(m)||r===0&&w<d.baseTime)&&(f=Math.min(f,x),m=Math.min(m,x))}this.videoTrackConfig={width:n.width,height:n.height,pixelRatio:n.pixelRatio}}if(Object.keys(c).length)return this.ISGenerated=!0,u&&xn(m)?(d&&this.warn(`Timestamps at playlist time: ${s?"":"~"}${r} ${m/p} != initPTS: ${d.baseTime/d.timescale} (${d.baseTime}/${d.timescale}) trackId: ${d.trackId}`),this.log(`Found initPTS at playlist time: ${r} offset: ${m/p} (${m}/${p}) trackId: ${g}`),this._initPTS={baseTime:m,timescale:p,trackId:g},this._initDTS={baseTime:f,timescale:p,trackId:g}):m=p=void 0,{tracks:c,initPTS:m,timescale:p,trackId:g}}remuxVideo(e,n,r,s,i){const o=e.inputTimeScale,l=e.samples,c=[],d=l.length,u=this._initPTS,h=u.baseTime*o/u.timescale;let m=this.nextVideoTs,f=8,p=this.videoSampleDuration,g,v,b=Number.POSITIVE_INFINITY,x=Number.NEGATIVE_INFINITY,w=!1;if(!r||m===null){const G=h+n*o,B=l[0].pts-em(l[0].dts,l[0].pts);v$()&&m!==null&&Math.abs(G-B-(m+h))<15e3?r=!0:m=G-B-h}const k=m+h;for(let G=0;G<d;G++){const B=l[G];B.pts=em(B.pts,k),B.dts=em(B.dts,k),B.dts<l[G>0?G-1:G].dts&&(w=!0)}w&&l.sort(function(G,B){const H=G.dts-B.dts,W=G.pts-B.pts;return H||W}),g=l[0].dts,v=l[l.length-1].dts;const S=v-g,C=S?Math.round(S/(d-1)):p||e.inputTimeScale/30;if(r){const G=g-k,B=G>C,H=G<-1;if((B||H)&&(B?this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${S3(G,!0)} ms (${G}dts) hole between fragments detected at ${n.toFixed(3)}`):this.warn(`${(e.segmentCodec||"").toUpperCase()}: ${S3(-G,!0)} ms (${G}dts) overlapping between fragments detected at ${n.toFixed(3)}`),!H||k>=l[0].pts||v$())){g=k;const W=l[0].pts-G;if(B)l[0].dts=g,l[0].pts=W;else{let V=!0;for(let U=0;U<l.length&&!(l[U].dts>W&&V);U++){const ne=l[U].pts;if(l[U].dts-=G,l[U].pts-=G,U<l.length-1){const te=l[U+1].pts,re=l[U].pts,fe=te<=re,le=te<=ne;V=fe==le}}}this.log(`Video: Initial PTS/DTS adjusted: ${S3(W,!0)}/${S3(g,!0)}, delta: ${S3(G,!0)} ms`)}}g=Math.max(0,g);let j=0,E=0,N=g;for(let G=0;G<d;G++){const B=l[G],H=B.units,W=H.length;let V=0;for(let U=0;U<W;U++)V+=H[U].data.length;E+=V,j+=W,B.length=V,B.dts<N?(B.dts=N,N+=C/4|0||1):N=B.dts,b=Math.min(B.pts,b),x=Math.max(B.pts,x)}v=l[d-1].dts;const A=E+4*j+8;let _;try{_=new Uint8Array(A)}catch(G){this.observer.emit(oe.ERROR,oe.ERROR,{type:er.MUX_ERROR,details:rt.REMUX_ALLOC_ERROR,fatal:!1,chunkMeta:i,error:G,bytes:A,reason:`fail allocating video mdat ${A}`});return}pl(_,0,A),pl(_,4,Lr.mdat);let T=!1,R=Number.POSITIVE_INFINITY,O=Number.POSITIVE_INFINITY,F=Number.NEGATIVE_INFINITY,D=Number.NEGATIVE_INFINITY;for(let G=0;G<d;G++){const B=l[G],H=B.units;let W=0;for(let ne=0,te=H.length;ne<te;ne++){const re=H[ne],fe=re.data,le=re.data.byteLength;pl(_,f,le),f+=4,_.set(fe,f),f+=le,W+=4+le}let V;if(G<d-1)p=l[G+1].dts-B.dts,V=l[G+1].pts-B.pts;else{const ne=this.config,te=G>0?B.dts-l[G-1].dts:C;if(V=G>0?B.pts-l[G-1].pts:C,ne.stretchShortVideoTrack&&this.nextAudioTs!==null){const re=Math.floor(ne.maxBufferHole*o),fe=(s?b+s*o:this.nextAudioTs+h)-B.pts;fe>re?(p=fe-te,p<0?p=te:T=!0,this.log(`It is approximately ${fe/90} ms to the next segment; using duration ${p/90} ms for the last video frame.`)):p=te}else p=te}let U=Math.round(B.pts-B.dts);if(R=Math.min(R,p),F=Math.max(F,p),O=Math.min(O,V),D=Math.max(D,V),!r&&G===0&&U>p){const ne=Math.round(U/C)*C;ne-U===1&&(this.log(`pad first CTS ${U} -> ${ne} of sn: ${i.sn}`),U=ne)}c.push(DUe(B.key,p,W,U))}if(c.length){const G=v$();if(G){if(G<70){const B=c[0].flags;B.dependsOn=2,B.isNonSync=0}}else if(YJn()&&D-O<F-R&&C/F<.025&&c[0].cts===0){this.warn("Found irregular gaps in sample duration. Using PTS instead of DTS to determine MP4 sample duration.");let B=g;for(let H=0,W=c.length;H<W;H++){const V=B+c[H].duration,U=B+c[H].cts;if(H<W-1){const ne=V+c[H+1].cts;c[H].duration=ne-U}else c[H].duration=H?c[H-1].duration:C;c[H].cts=0,B=V}}}p=T||!p?C:p;const I=v+p;this.nextVideoTs=m=I-h,this.videoSampleDuration=p,this.isVideoContiguous=!0,i.iframe&&(c.length===1?(c[0].duration=p=i.duration*o,this.nextVideoTs=m=g+p-h):this.warn(`Not adjusting IFrame duration (sample count ${c.length})`));const z={data1:jn.moof(i.sn,g,Mi(e,{samples:c})),data2:_,startPTS:(b-h)/o,endPTS:(x+p-h)/o,startDTS:(g-h)/o,endDTS:m/o,type:"video",hasAudio:!1,hasVideo:!0,nb:c.length,dropped:e.dropped};return e.samples=[],e.dropped=0,z}getSamplesPerFrame(e){switch(e.segmentCodec){case"mp3":return Wer;case"ac3":return qer;default:return Ger}}remuxAudio(e,n,r,s,i,o){const l=e.inputTimeScale,c=e.samplerate?e.samplerate:l,d=l/c,u=this.getSamplesPerFrame(e),h=u*d,m=this._initPTS,f=e.segmentCodec==="mp3"&&this.typeSupported.mpeg,p=[],g=i!==void 0;let v=e.samples,b=f?0:8,x=this.nextAudioTs||-1;const w=m.baseTime*l/m.timescale,k=w+n*l;if(this.isAudioContiguous=r=r||v.length&&x>0&&(s&&Math.abs(k-(x+w))<9e3||Math.abs(em(v[0].pts,k)-(x+w))<20*h),v.forEach(function(I){I.pts=em(I.pts,k)}),!r||x<0){const I=v.length;if(v=v.filter(P=>P.pts>=0),I!==v.length&&this.warn(`Removed ${v.length-I} of ${I} samples (initPTS ${w} / ${l})`),!v.length)return;i===0?x=0:s&&!g?x=Math.max(0,k-w):x=v[0].pts-w}if(e.segmentCodec==="aac"){const I=this.config.maxAudioFramesDrift;for(let P=0,M=x+w;P<v.length;P++){const z=v[P],G=z.pts,B=G-M,H=Math.abs(1e3*B/l);if(B<=-I*h&&g)P===0&&(this.warn(`Audio frame @ ${(G/l).toFixed(3)}s overlaps marker by ${Math.round(1e3*B/l)} ms.`),this.nextAudioTs=x=G-w,M=G);else if(B>=I*h&&H<Her&&g){let W=Math.round(B/h);for(M=G-W*h;M<0&&W&&h;)W--,M+=h;P===0&&(this.nextAudioTs=x=M-w),this.warn(`Injecting ${W} audio frames @ ${((M-w)/l).toFixed(3)}s due to ${Math.round(1e3*B/l)} ms gap.`);for(let V=0;V<W;V++){let U=Ler.getSilentFrame(e.parsedCodec||e.manifestCodec||e.codec,e.channelCount);U||(this.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),U=z.unit.subarray()),v.splice(P,0,{unit:U,pts:M}),M+=h,P++}}z.pts=M,M+=h}}let S=null,C=null,j,E=0,N=v.length;for(;N--;)E+=v[N].unit.byteLength;for(let I=0,P=v.length;I<P;I++){const M=v[I],z=M.unit;let G=M.pts;if(C!==null){const H=p[I-1];H.duration=Math.round((G-C)/d)}else if(r&&e.segmentCodec==="aac"&&(G=x+w),S=G,E>0){E+=b;try{j=new Uint8Array(E)}catch(H){this.observer.emit(oe.ERROR,oe.ERROR,{type:er.MUX_ERROR,details:rt.REMUX_ALLOC_ERROR,fatal:!1,chunkMeta:o,error:H,bytes:E,reason:`fail allocating audio mdat ${E}`});return}f||(pl(j,0,E),pl(j,4,Lr.mdat))}else return;j&&j.set(z,b);const B=z.byteLength;b+=B,p.push(DUe(!0,u,B,0)),C=G}const A=p.length;if(!A)return;const _=p[p.length-1];x=C-w,this.nextAudioTs=x+d*_.duration;const T=f?new Uint8Array(0):jn.moof(e.sequenceNumber++,S/d,Mi({},e,{samples:p}));e.samples=[];const R=(S-w)/l,O=this.nextAudioTs/l,D={data1:T,data2:j,startPTS:R,endPTS:O,startDTS:R,endDTS:O,type:"audio",hasAudio:!0,hasVideo:!1,nb:A};return this.isAudioContiguous=!0,D}}function em(t,e){let n;if(e===null)return t;for(e<t?n=-lxe:n=lxe;Math.abs(t-e)>4294967296;)t+=n;return t}function Ker(t){for(let e=0;e<t.length;e++)if(t[e].key)return e;return-1}function uSt(t,e,n,r){const s=t.samples.length;if(!s)return;const i=t.inputTimeScale;for(let l=0;l<s;l++){const c=t.samples[l];c.pts=em(c.pts-n.baseTime*i/n.timescale,e*i)/i,c.dts=em(c.dts-r.baseTime*i/r.timescale,e*i)/i}const o=t.samples;return t.samples=[],{samples:o}}function hSt(t,e,n){const r=t.samples.length;if(!r)return;const s=t.inputTimeScale;for(let o=0;o<r;o++){const l=t.samples[o];l.pts=em(l.pts-n.baseTime*s/n.timescale,e*s)/s}t.samples.sort((o,l)=>o.pts-l.pts);const i=t.samples;return t.samples=[],{samples:i}}class Yer extends Fm{constructor(e,n,r,s){super("passthrough-remuxer",s),this.observer=void 0,this.emitInitSegment=!1,this.audioCodec=void 0,this.videoCodec=void 0,this.initData=void 0,this.initPTS=null,this.initTracks=void 0,this.lastEndTime=null,this.isVideoContiguous=!1,this.videoOnlyRemux=!1,this.decryptdata=null,this.pendingInitSegment=void 0,this.observer=e}destroy(){this.observer&&this.observer.removeAllListeners(),this.observer=null}resetTimeStamp(e){this.lastEndTime=null;const n=this.initPTS;n&&e&&n.baseTime===e.baseTime&&n.timescale===e.timescale||(this.initPTS=e)}resetNextTimestamp(){this.isVideoContiguous=!1,this.lastEndTime=null}resetInitSegment(e,n,r,s){this.audioCodec=n,this.videoCodec=r,this.decryptdata=s,this.pendingInitSegment=e,this.videoOnlyRemux=!1,this.initTracks=void 0,this.initData=void 0,this.emitInitSegment=!0}generateInitSegment(e,n,r){this.videoOnlyRemux=!1;let{audioCodec:s,videoCodec:i}=this;if(!(e!=null&&e.byteLength)){this.initTracks=void 0,this.initData=void 0;return}const{audio:o,video:l}=this.initData=r||fkt(e);if(n)LJn(e,n);else{const d=o||l;d!=null&&d.encrypted&&this.warn(`Init segment with encrypted track with has no key ("${d.codec}")!`)}o&&(s=$Ue(o,na.AUDIO,this)),l&&(i=$Ue(l,na.VIDEO,this));const c={};o&&l?c.audiovideo={container:"video/mp4",codec:s+","+i,supplemental:l.supplemental,encrypted:l.encrypted,initSegment:e,id:"main"}:o?c.audio={container:"audio/mp4",codec:s,encrypted:o.encrypted,initSegment:e,id:"audio"}:l?c.video={container:"video/mp4",codec:i,supplemental:l.supplemental,encrypted:l.encrypted,initSegment:e,id:"main"}:this.warn("initSegment does not contain moov or trak boxes."),this.initTracks=c}remux(e,n,r,s,i,o,l,c,d,u,h){var m,f;let{initPTS:p,lastEndTime:g}=this;const v={audio:void 0,video:void 0,text:void 0,id3:r,initSegment:void 0};xn(g)||(g=this.lastEndTime=i||0);const b=n.samples;if(!b.length)return v;const x=this.pendingInitSegment;x&&(this.pendingInitSegment=void 0,this.generateInitSegment(x,this.decryptdata,u));const w={initPTS:void 0,timescale:void 0,trackId:void 0};let k=this.initData;if((m=k)!=null&&m.length||(this.generateInitSegment(b),k=this.initData),!((f=k)!=null&&f.length))return this.warn("Failed to generate initSegment."),v;if(d.iframe&&k.audio&&k.video){var S;const ie=(S=this.initTracks)==null||(S=S.audiovideo)==null?void 0:S.initSegment,he=ie?_Jn(ie):null;if(he){var C;this.log("Converted muxed init segment to video-only for I-Frame playback"),this.generateInitSegment(he,this.decryptdata),(C=this.initData)!=null&&C.length&&(k=this.initData,this.emitInitSegment=!0,this.videoOnlyRemux=!0)}}this.emitInitSegment&&(w.tracks=this.initTracks,v.initSegment=w,this.emitInitSegment=!1);const j=d.iframe,E=h&&(!j||h.includeSampleDetails)?h.tracks:FJn(b,k,d,this,j),N=k.audio?E[k.audio.id]:null,A=k.video?E[k.video.id]:null,_=!!k.audio,T=!!k.video;let R="";_&&(R+="audio"),T&&(R+="video");const O=gV(A,1/0),F=gV(N,1/0),D=gV(A,0,!0),I=gV(N,0,!0);let P=i,M=0;A&&N&&k.audio&&(F>D||O>I)&&this.warn(`audio and video track sample timestamps do not overlap. v: ${O}-${D} a: ${F}-${I}}`,A,N);const z=!!N&&(!A||!p&&F<O||!!p&&p.trackId===k.audio.id),G=z?N:A;if(!G)return this.log(`No media samples found in ${c} ${d.level} ${d.part===-1?"":`part: ${d.part} of`} sn: ${d.sn} at playlist time: ${i}`),v;let B=b,H,W;if(A&&A.sampleCount>=1&&k.video&&d.iframe){const{trun:ie,start:he}=A,ye=ie.length===1,J=ie.length?ye?ie[0].samples:ie[0].samples.concat(...ie.slice(1).map(K=>K.samples)):[];if(J.length){const K=ie[0];let ce=K;for(let Ve=ie.length;Ve--;)if(ie[Ve].samples.length){ce=ie[Ve];break}const pe=ce.lastSampleDurationOffset,{defaultSampleDurationOffset:Ie}=K,Me=Math.abs(d.duration-(D-O))>.05,we=J.length<A.sampleCount;if(!(Me||we||this.videoOnlyRemux||!ye))M=D-O;else{const Ve=we?ce.sampleOffset+ce.samples.reduce((Ke,De)=>Ke+De.size,0):void 0,be=Me?d.duration:D-O,Ze=Zer(J,be*k.video.timescale,pe,Ie),Pe=AJn(b,k.video.id,J.length,Ve,Ze);Pe?(B=Pe,W=Qer(he,J)):this.warn(`IFrame remux skipped (sn ${d.sn}); using native sample duration`),M=Pe&&Ze?be:D-O}}else this.warn(`Could not remux IFrame track fragment (no samples in range, trun count ${ie.length})`),M=D-O}else M=z?I-F:D-O;if(this.videoOnlyRemux&&B===b)return this.warn(`Dropping muxed I-Frame fragment that could not be remuxed to video-only (sn: ${d.sn})`),v;const V=G.timescale,U=G.start-i*V,ne=z?k.audio.id:k.video.id;if(P=G.start/V,(o||!p)&&(Jer(p,P,i,M)||V!==p.timescale)){let ie=!1;const he=z?"audio":"video";if(p){const ye=i!==0?P/i:1+P/1;ie=P>=0&&Math.abs(1-ye)<.001,this.log(`${he} timestamps in track ${ne} at playlist time: ${o?"":"~"}${i} maps to ${P} with initPTS: ${p.baseTime/p.timescale} (${U/V-p.baseTime/p.timescale}s diff) (${R}) drift estimate: ${ye} ${ie?"(ignoring drift)":"remapping timestamps (initPTS)"}`)}ie||(this.log(`Found initPTS in ${he} track ${ne} at playlist time: ${i} offset: ${P-i} (${U}/${V})`),p=null,w.initPTS=U,w.timescale=V,w.trackId=ne)}p?(w.initPTS=p.baseTime,w.timescale=p.timescale,w.trackId=p.trackId):((!w.timescale||w.trackId===void 0||w.initPTS===void 0)&&(this.warn("Could not set initPTS"),w.initPTS=P,w.timescale=1,w.trackId=-1),this.initPTS=p={baseTime:w.initPTS,timescale:w.timescale,trackId:w.trackId});const te=P-p.baseTime/p.timescale,re=te+M,fe=T&&(G==null?void 0:G.ptsMin)!==void 0?G.ptsMin/G.timescale-p.baseTime/p.timescale:te,le=W!==void 0&&A?W/A.timescale-p.baseTime/p.timescale:T&&G!=null&&G.ptsMax?G.ptsMax/G.timescale-p.baseTime/p.timescale:re;M>0?this.lastEndTime=re:(this.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());const q=(k.audio?k.audio.encrypted:!1)||(k.video?k.video.encrypted:!1),Y={data1:B,data2:H,startPTS:fe,startDTS:te,endPTS:le,endDTS:re,type:R,hasAudio:_,hasVideo:T,nb:1,dropped:0,encrypted:q};v.audio=_&&!T?Y:void 0,v.video=T?Y:void 0;const X=this.isVideoContiguous,Q=A==null?void 0:A.sampleCount;if(Q){const ie=A.keyFrameIndex,he=ie!==-1;Y.nb=Q,Y.dropped=ie===0||X?0:he?ie:Q,Y.independent=he,Y.firstKeyFrame=ie,he&&A.keyFrameStart&&(Y.firstKeyFramePTS=(A.keyFrameStart-p.baseTime)/p.timescale),X||(v.independent=he),this.isVideoContiguous||(this.isVideoContiguous=he),Y.dropped&&this.warn(`fmp4 does not start with IDR: firstIDR ${ie}/${Q} dropped: ${Y.dropped} start: ${Y.firstKeyFramePTS||"NA"}`)}return v.initSegment=w,v.id3=uSt(r,i,p,p),s.samples.length&&(v.text=hSt(s,i,p)),v}}function gV(t,e,n=!1){return(t==null?void 0:t.start)!==void 0?(t.start+(n?t.duration:0))/t.timescale:e}function Qer(t,e){let n=t,r=t;for(let s=0;s<e.length;s++){const{cts:i,duration:o}=e[s];r=Math.max(r,n+(i||0)+o),n+=o}return r}function Zer(t,e,n,r){if(n!==void 0){const i=t[t.length-1];let o=e;for(let l=0;l<t.length-1;l++)o-=t[l].duration;return o<=0&&(o=i.duration),i.duration=o,{durationOffset:n,value:o}}if(r===void 0)return;const s=Math.round(e/t.length);for(let i=0;i<t.length;i++)t[i].duration=s;return{durationOffset:r,value:s}}function Jer(t,e,n,r){if(t===null)return!0;const s=Math.max(r,1),i=e-t.baseTime/t.timescale;return Math.abs(i-n)>=s}function $Ue(t,e,n){const r=t.codec;return r&&r.length>4?r:e===na.AUDIO?r==="ec-3"||r==="ac-3"||r==="alac"?r:r==="fLaC"||r==="Opus"?rZ(r,!1):(n.warn(`Unhandled audio codec "${r}" in mp4 MAP`),r||"mp4a"):r==="mjpg"?r:(n.warn(`Unhandled video codec "${r}" in mp4 MAP`),r||"avc1")}let Xw;try{Xw=self.performance.now.bind(self.performance)}catch{Xw=Date.now}const eq=[{demux:Ner,remux:Yer},{demux:Wb,remux:XW},{demux:Ser,remux:XW},{demux:jer,remux:XW}];eq.splice(2,0,{demux:Cer,remux:XW});class OUe{constructor(e,n,r,s,i,o){this.asyncResult=!1,this.logger=void 0,this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=e,this.typeSupported=n,this.config=r,this.id=i,this.logger=o}configure(e){this.transmuxConfig=e,this.decrypter&&this.decrypter.reset()}push(e,n,r,s){if(!this.observer)return vV(r);const i=r.transmuxing;i.executeStart=Xw();const o=new Uint8Array(e),{currentTransmuxState:l,transmuxConfig:c}=this;s&&(this.currentTransmuxState=s);const{contiguous:d,discontinuity:u,trackSwitch:h,accurateTimeOffset:m,timeOffset:f,initSegmentChange:p}=s||l,{audioCodec:g,videoCodec:v,defaultInitPts:b,duration:x,initSegmentData:w}=c,k=Xer(o,n);if(k&&rP(k.method)){const E=this.getDecrypter(),N=m_e(k.method);return this.asyncResult=!0,this.decryptionPromise=E.decrypt(o,k.key.buffer,k.iv.buffer,N,r.decryptRange).then(A=>{const _=this.push(A,null,r);return this.decryptionPromise=null,_}),this.decryptionPromise}const S=this.needsProbing(u,h);if(S){const E=r.iframe&&w&&Wb.probe(w,this.logger)?w:o,N=this.configureTransmuxer(E);if(N)return this.logger.warn(`[transmuxer] ${N.message}`),this.observer.emit(oe.ERROR,oe.ERROR,{type:er.MEDIA_ERROR,details:rt.FRAG_PARSING_ERROR,fatal:!1,error:N,reason:N.message}),i.executeEnd=Xw(),vV(r)}(u||h||p||S)&&this.resetInitSegment(w,g,v,x,n,r),(u||p||S)&&this.resetInitialTimestamp(b),d||this.resetContiguity();const C=this.transmux(o,k,f,m,r);this.asyncResult=H6(C);const j=this.currentTransmuxState;return j.contiguous=!0,j.discontinuity=!1,j.trackSwitch=!1,i.executeEnd=Xw(),C}flush(e){const n=e.transmuxing;n.executeStart=Xw();const{decrypter:r,currentTransmuxState:s,decryptionPromise:i}=this;if(i)return this.asyncResult=!0,i.then(()=>this.flush(e));const o=[],{timeOffset:l}=s;if(r){const h=r.flush();h&&o.push(this.push(h.buffer,null,e))}const{demuxer:c,remuxer:d}=this;if(!c||!d){n.executeEnd=Xw();const h=[vV(e)];return this.asyncResult?Promise.resolve(h):h}const u=c.flush(l,e);return H6(u)?(this.asyncResult=!0,u.then(h=>(this.flushRemux(o,h,e),o))):(this.flushRemux(o,u,e),this.asyncResult?Promise.resolve(o):o)}flushRemux(e,n,r){if(!this.remuxer)return;const{audioTrack:s,videoTrack:i,id3Track:o,textTrack:l}=n,{accurateTimeOffset:c,timeOffset:d}=this.currentTransmuxState;this.logger.log(`[transmuxer.ts]: Flushed ${this.id} sn: ${r.sn}${r.part>-1?" part: "+r.part:""} of ${this.id} playlist ${r.level}`);const u=this.remuxer.remux(s,i,o,l,d,c,!0,this.id,r,n.initData,n.sampleData);e.push({remuxResult:u,chunkMeta:r}),r.transmuxing.executeEnd=Xw()}resetInitialTimestamp(e){const{demuxer:n,remuxer:r}=this;!n||!r||(n.resetTimeStamp(e),r.resetTimeStamp(e))}resetContiguity(){const{demuxer:e,remuxer:n}=this;!e||!n||(e.resetContiguity(),n.resetNextTimestamp())}resetInitSegment(e,n,r,s,i,o){const{demuxer:l,remuxer:c}=this;!l||!c||(l.resetInitSegment(e,n,r,s,i,o),c.resetInitSegment(e,n,r,i))}destroy(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0),this.observer&&this.observer.removeAllListeners(),this.decryptionPromise=null,this.decrypter=this.observer=void 0,this.logger=this.config=this.probe=void 0}transmux(e,n,r,s,i){let o;return(n==null?void 0:n.method)==="SAMPLE-AES"?o=this.transmuxSampleAes(e,n,r,s,i):o=this.transmuxUnencrypted(e,r,s,i),o}transmuxUnencrypted(e,n,r,s){const{demuxer:i,remuxer:o}=this;if(!i||!o)return vV(s);const l=i.demux(e,n,s,!1,!this.config.progressive),{audioTrack:c,videoTrack:d,id3Track:u,textTrack:h}=l;return{remuxResult:o.remux(c,d,u,h,n,r,!1,this.id,s,l.initData,l.sampleData),chunkMeta:s}}transmuxSampleAes(e,n,r,s,i){return this.demuxer?this.demuxer.demuxSampleAes(e,n,r,i).then(o=>({remuxResult:this.remuxer.remux(o.audioTrack,o.videoTrack,o.id3Track,o.textTrack,r,s,!1,this.id,i,o.initData,o.sampleData),chunkMeta:i})):Promise.reject(new Error("no demuxer"))}configureTransmuxer(e){const{config:n,observer:r,typeSupported:s}=this;if(!r)return;let i;try{for(let h=0,m=eq.length;h<m;h++){var o;if((o=eq[h].demux)!=null&&o.probe(e,this.logger)){i=eq[h];break}}}catch(h){return h}if(!i)return new Error("Failed to find demuxer by probing fragment data");const l=this.demuxer,c=this.remuxer,d=i.demux,u=i.remux;(!l||!(l instanceof d))&&(this.logger.log(`Using ${d.name}`),this.demuxer=new d(r,n,s,this.logger),this.probe=d.probe),(!c||!(c instanceof u))&&(this.logger.log(`Using ${u.name}`),this.remuxer=new u(r,n,s,this.logger))}needsProbing(e,n){return!this.demuxer||!this.remuxer||e||n}getDecrypter(){let e=this.decrypter;return e||(e=this.decrypter=new d_e(this.config)),e}}function Xer(t,e){let n=null;return t.byteLength>0&&(e==null?void 0:e.key)!=null&&e.iv!==null&&e.method!=null&&(n=e),n}const vV=t=>({remuxResult:{},chunkMeta:t});function H6(t){return"then"in t&&t.then instanceof Function}class etr{constructor(e,n,r,s,i){this.audioCodec=void 0,this.videoCodec=void 0,this.initSegmentData=void 0,this.duration=void 0,this.defaultInitPts=void 0,this.audioCodec=e,this.videoCodec=n,this.initSegmentData=r,this.duration=s,this.defaultInitPts=i||null}}class ttr{constructor(e,n,r,s,i,o){this.discontinuity=void 0,this.contiguous=void 0,this.accurateTimeOffset=void 0,this.trackSwitch=void 0,this.timeOffset=void 0,this.initSegmentChange=void 0,this.discontinuity=e,this.contiguous=n,this.accurateTimeOffset=r,this.trackSwitch=s,this.timeOffset=i,this.initSegmentChange=o}}let FUe=0;class mSt{constructor(e,n,r,s){this.error=null,this.hls=void 0,this.id=void 0,this.instanceNo=FUe++,this.observer=void 0,this.frag=null,this.part=null,this.useWorker=void 0,this.workerContext=null,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.onWorkerMessage=c=>{const d=c.data,u=this.hls;if(!(!u||!(d!=null&&d.event)||d.instanceNo!==this.instanceNo))switch(d.event){case"init":{var h;const m=(h=this.workerContext)==null?void 0:h.objectURL;m&&self.URL.revokeObjectURL(m);break}case"transmuxComplete":{this.handleTransmuxComplete(d.data);break}case"flush":{this.onFlush(d.data);break}case"workerLog":{u.logger[d.data.logType]&&u.logger[d.data.logType](d.data.message);break}default:{d.data=d.data||{},d.data.frag=this.frag,d.data.part=this.part,d.data.id=this.id,u.trigger(d.event,d.data);break}}},this.onWorkerError=c=>{if(!this.hls)return;const d=new Error(`${c.message}  (${c.filename}:${c.lineno})`);this.hls.config.enableWorker=!1,this.hls.logger.warn(`Error in "${this.id}" Web Worker, fallback to inline`),this.hls.trigger(oe.ERROR,{type:er.OTHER_ERROR,details:rt.INTERNAL_EXCEPTION,fatal:!1,event:"demuxerWorker",error:d})};const i=e.config;this.hls=e,this.id=n,this.useWorker=!!i.enableWorker,this.onTransmuxComplete=r,this.onFlush=s;const o=(c,d)=>{d=d||{},d.frag=this.frag||void 0,c===oe.ERROR&&(d=d,d.parent=this.id,d.part=this.part,this.error=d.error),this.hls.trigger(c,d)};this.observer=new g_e,this.observer.on(oe.FRAG_DECRYPTED,o),this.observer.on(oe.ERROR,o);const l=eUe(i.preferManagedMediaSource);if(this.useWorker&&typeof Worker<"u"){const c=this.hls.logger;if(i.workerPath||ler()){try{i.workerPath?(c.log(`loading Web Worker ${i.workerPath} for "${n}"`),this.workerContext=der(i.workerPath)):(c.log(`injecting Web Worker for "${n}"`),this.workerContext=cer());const{worker:u}=this.workerContext;u.addEventListener("message",this.onWorkerMessage),u.addEventListener("error",this.onWorkerError),u.postMessage({instanceNo:this.instanceNo,cmd:"init",typeSupported:l,id:n,config:ya(i)})}catch(u){c.warn(`Error setting up "${n}" Web Worker, fallback to inline`,u),this.terminateWorker(),this.error=null,this.transmuxer=new OUe(this.observer,l,i,"",n,e.logger)}return}}this.transmuxer=new OUe(this.observer,l,i,"",n,e.logger)}reset(){if(this.frag=null,this.part=null,this.workerContext){const e=this.instanceNo;this.instanceNo=FUe++;const n=this.hls.config,r=eUe(n.preferManagedMediaSource);this.workerContext.worker.postMessage({instanceNo:this.instanceNo,cmd:"reset",resetNo:e,typeSupported:r,id:this.id,config:ya(n)})}}terminateWorker(){if(this.workerContext){const{worker:e}=this.workerContext;this.workerContext=null,e.removeEventListener("message",this.onWorkerMessage),e.removeEventListener("error",this.onWorkerError),uer(this.hls.config.workerPath)}}destroy(){if(this.workerContext)this.terminateWorker(),this.onWorkerMessage=this.onWorkerError=null;else{const n=this.transmuxer;n&&(n.destroy(),this.transmuxer=null)}const e=this.observer;e&&e.removeAllListeners(),this.frag=null,this.part=null,this.observer=null,this.hls=null}push(e,n,r,s,i,o,l,c,d,u){var h,m;d.transmuxing.start=self.performance.now();const{instanceNo:f,transmuxer:p}=this,g=o?o.start:i.start,v=i.decryptdata,b=this.frag,x=b?i.cc!==b.cc:!0,w=b?d.level!==b.level:!0,k=b?d.sn-b.sn:-1,S=this.part?d.part-this.part.index:-1,C=k===0&&d.id>1&&d.id===(b==null?void 0:b.stats.chunkCount),j=!w&&(k===1||k===0&&(S===1||C&&S<=0)),E=self.performance.now();(w||k||i.stats.parsing.start===0)&&(i.stats.parsing.start=E),o&&(S||!j)&&(o.stats.parsing.start=E);const N=!(b&&((h=i.initSegment)==null?void 0:h.url)===((m=b.initSegment)==null?void 0:m.url)),A=new ttr(x,j,c,w,g,N);if(!j||x||N){this.hls.logger.log(`[transmuxer-interface]: Starting new transmux session for ${i.type} sn: ${d.sn}${d.part>-1?" part: "+d.part:""} ${this.id} playlist: ${d.level} id: ${d.id}
        discontinuity: ${x}
        trackSwitch: ${w}
        contiguous: ${j}
        accurateTimeOffset: ${c}
        timeOffset: ${g}
        initSegmentChange: ${N}`);const _=new etr(r,s,n,l,u);this.configureTransmuxer(_)}if(this.frag=i,this.part=o,this.workerContext)this.workerContext.worker.postMessage({instanceNo:f,cmd:"demux",data:e,decryptdata:v,chunkMeta:d,state:A},e instanceof ArrayBuffer?[e]:[]);else if(p){const _=p.push(e,v,d,A);H6(_)?_.then(T=>{this.handleTransmuxComplete(T)}).catch(T=>{this.transmuxerError(T,d,"transmuxer-interface push error")}):this.handleTransmuxComplete(_)}}flush(e){e.transmuxing.start=self.performance.now();const{instanceNo:n,transmuxer:r}=this;if(this.workerContext)this.workerContext.worker.postMessage({instanceNo:n,cmd:"flush",chunkMeta:e});else if(r){const s=r.flush(e);H6(s)?s.then(i=>{this.handleFlushResult(i,e)}).catch(i=>{this.transmuxerError(i,e,"transmuxer-interface flush error")}):this.handleFlushResult(s,e)}}transmuxerError(e,n,r){this.hls&&(this.error=e,this.hls.trigger(oe.ERROR,{type:er.MEDIA_ERROR,details:rt.FRAG_PARSING_ERROR,chunkMeta:n,frag:this.frag||void 0,part:this.part||void 0,fatal:!1,error:e,err:e,reason:r}))}handleFlushResult(e,n){e.forEach(r=>{this.handleTransmuxComplete(r)}),this.onFlush(n)}configureTransmuxer(e){const{instanceNo:n,transmuxer:r}=this;this.workerContext?this.workerContext.worker.postMessage({instanceNo:n,cmd:"configure",config:e}):r&&r.configure(e)}handleTransmuxComplete(e){e.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(e)}}const BUe=100;class ntr extends p_e{constructor(e,n,r){super(e,n,r,"audio-stream-controller",Wn.AUDIO),this.mainAnchor=null,this.mainFragLoading=null,this.audioOnly=!1,this.bufferedTrack=null,this.switchingTrack=null,this.trackId=-1,this.nextTrackId=-1,this.waitingData=null,this.mainDetails=null,this.flushing=!1,this.bufferFlushed=!1,this.cachedTrackLoadedData=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.resetItem()}resetItem(){this.mainDetails=this.mainAnchor=this.mainFragLoading=this.bufferedTrack=this.switchingTrack=this.waitingData=this.cachedTrackLoadedData=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(oe.LEVEL_LOADED,this.onLevelLoaded,this),e.on(oe.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.on(oe.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(oe.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(oe.BUFFER_RESET,this.onBufferReset,this),e.on(oe.BUFFER_CREATED,this.onBufferCreated,this),e.on(oe.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(oe.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(oe.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(oe.FRAG_LOADING,this.onFragLoading,this),e.on(oe.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){const{hls:e}=this;e&&(super.unregisterListeners(),e.off(oe.LEVEL_LOADED,this.onLevelLoaded,this),e.off(oe.AUDIO_TRACKS_UPDATED,this.onAudioTracksUpdated,this),e.off(oe.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(oe.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(oe.BUFFER_RESET,this.onBufferReset,this),e.off(oe.BUFFER_CREATED,this.onBufferCreated,this),e.off(oe.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(oe.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(oe.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(oe.FRAG_LOADING,this.onFragLoading,this),e.off(oe.FRAG_BUFFERED,this.onFragBuffered,this))}onInitPtsFound(e,n){const{frag:r,id:s,initPTS:i,timescale:o,trackId:l,timestampOffsets:c}=n;if(s===Wn.MAIN){const d=r.cc,u=this.fragCurrent;if(this.initPTS=c,this.log(`InitPTS for cc: ${d} found from main: ${i/o} (${i}/${o}) trackId: ${l}`),this.mainAnchor=r,this.state===Ct.WAITING_INIT_PTS){const h=this.waitingData;(!h&&!this.loadingParts||h&&h.frag.cc!==d)&&this.syncWithAnchor(r,h==null?void 0:h.frag)}else!this.hls.hasEnoughToStart&&u&&u.cc!==d?(u.abortRequests(),this.syncWithAnchor(r,u)):this.state===Ct.IDLE&&this.tick()}}getLoadPosition(){var e;return!this.startFragRequested&&this.nextLoadPosition>=0&&((e=this.switchingTrack)==null?void 0:e.flushImmediate)!==!1?this.nextLoadPosition:super.getLoadPosition()}syncWithAnchor(e,n){var r;const s=((r=this.mainFragLoading)==null?void 0:r.frag)||null;if(n&&(s==null?void 0:s.cc)===n.cc)return;const i=(s||e).cc,o=this.getLevelDetails(),l=this.getLoadPosition(),c=Pkt(o,i,l);c&&(this.log(`Syncing with main frag at ${c.start} cc ${c.cc}`),this.startFragRequested=!1,this.nextLoadPosition=c.start,this.resetLoadingState(),this.state===Ct.IDLE&&this.doTickIdle())}startLoad(e,n){if(!this.levels){this.startPosition=e,this.state=Ct.STOPPED;return}const r=this.lastCurrentTime;this.stopLoad(),this.setInterval(BUe),r>0&&e===-1&&!n&&this.initPTS.length&&(this.log(`Override startPosition with lastCurrentTime @${r.toFixed(3)}`),e=r),this.state=Ct.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=n?-1:e,!n&&!this.fragmentTracker.hasFragments(this.playlistType)&&(this.startFragRequested=!1),this.tick()}doTick(){switch(this.state){case Ct.IDLE:this.doTickIdle();break;case Ct.WAITING_TRACK:{const{levels:e,trackId:n}=this,r=e==null?void 0:e[n],s=r==null?void 0:r.details;if(s&&!this.waitForLive(r)){if(this.waitForCdnTuneIn(s))break;this.state=Ct.WAITING_INIT_PTS}break}case Ct.FRAG_LOADING_WAITING_RETRY:{this.checkRetryDate();break}case Ct.WAITING_INIT_PTS:{const e=this.waitingData;if(e){const{frag:n,part:r,cache:s,complete:i}=e,o=this.mainAnchor;if(this.initPTS[n.cc]!==void 0){this.waitingData=null,this.state=Ct.FRAG_LOADING;const l=s.flush().buffer,c={frag:n,part:r,payload:l,networkDetails:null};this._handleFragmentLoadProgress(c),i&&super._handleFragmentLoadComplete(c)}else o&&o.cc!==e.frag.cc&&this.syncWithAnchor(o,e.frag)}else this.state=Ct.IDLE}}this.onTickEnd()}resetLoadingState(){const e=this.waitingData;e&&(this.fragmentTracker.removeFragment(e.frag),this.waitingData=null),super.resetLoadingState()}onTickEnd(){const{media:e}=this;e!=null&&e.readyState&&(this.lastCurrentTime=e.currentTime,this.checkFragmentChanged())}doTickIdle(){var e;const{hls:n,levels:r,media:s,trackId:i}=this,o=n.config;if(!this.buffering||!s&&!this.primaryPrefetch&&(this.startFragRequested||!o.startFragPrefetch)||!(r!=null&&r[i]))return;const l=r[i],c=l.details;if(!c||this.waitForLive(l)||this.waitForCdnTuneIn(c)){this.state=Ct.WAITING_TRACK,this.startFragRequested=!1;return}const d=this.getBufferOutput();this.bufferFlushed&&d&&(this.bufferFlushed=!1,this.afterBufferFlushed(d,na.AUDIO));const u=this.getFwdBufferInfo();if(u===null)return;if(!this.switchingTrack&&this._streamEnded(u,c)){n.trigger(oe.BUFFER_EOS,{type:"audio"}),this.state=Ct.ENDED;return}const h=u.len,m=n.maxBufferLength,f=c.fragments,p=f[0].start,g=this.getLoadPosition(),v=this.flushing||this.switchingTrack&&!this.switchingTrack.flushImmediate?g:u.end;if(this.switchingTrack&&s){const w=g;c.PTSKnown&&w<p&&w>=this.timelineOffset&&(u.end>p||u.nextStart)&&(this.log(`Alt audio track ahead of main track, seek to start of alt audio track ${w} -> ${p} + 0.05`),s.currentTime=p+.05)}if(h>=m&&!this.switchingTrack&&v<f[f.length-1].start)return;let b=this.getNextFragment(v,c);if(b&&this.isLoopLoading(b,v)&&(b=this.getNextFragmentLoopLoading(b,c,u,Wn.MAIN,m)),!b){this.bufferFlushed=!0;return}if(this.exceedsMaxBuffer(u,m,b))return;let x=((e=this.mainFragLoading)==null?void 0:e.frag)||null;if(!this.audioOnly&&this.startFragRequested&&x&&Oo(b)&&!b.endList&&(!c.live||!this.loadingParts&&v<this.hls.liveSyncPosition)&&(this.fragmentTracker.getState(x)===po.OK&&(this.mainFragLoading=x=null),x&&Oo(x))){if(b.start>x.end){const k=this.fragmentTracker.getFragAtPos(v,Wn.MAIN);k&&k.end>x.end&&(x=k,this.mainFragLoading={frag:k,targetBufferTime:null})}if(b.start>x.end)return}this.loadFragment(b,l,v)}onMediaDetaching(e,n){this.bufferFlushed=this.flushing=!1,super.onMediaDetaching(e,n)}onAudioTracksUpdated(e,{audioTracks:n}){this.resetTransmuxer(),this.levels=n.map(r=>new U6(r))}onAudioTrackSwitching(e,n){const r=!!n.url;this.trackId=n.id;const{fragCurrent:s}=this;s&&(s.abortRequests(),this.removeUnbufferedFrags(s.start)),this.resetLoadingState(),r?(this.switchingTrack=n,n.flushImmediate||(this.nextTrackId=n.id,this.nextLevelSwitch()),this.flushAudioIfNeeded(n),this.state!==Ct.STOPPED&&(this.setInterval(BUe),this.state=Ct.IDLE,this.tick())):(this.resetTransmuxer(),this.switchingTrack=null,this.bufferedTrack=n,this.clearInterval())}onManifestLoading(){super.onManifestLoading(),this.bufferFlushed=this.flushing=this.audioOnly=!1,this.resetItem(),this.trackId=-1}onLevelLoaded(e,n){this.mainDetails=n.details;const r=this.cachedTrackLoadedData;r&&(this.cachedTrackLoadedData=null,this.onAudioTrackLoaded(oe.AUDIO_TRACK_LOADED,r))}onAudioTrackLoaded(e,n){var r;const{levels:s}=this,{details:i,id:o,groupId:l,track:c}=n;if(!s){this.warn(`Audio tracks reset while loading track ${o} "${c.name}" of "${l}"`);return}const d=this.mainDetails;if(!d||i.endCC>d.endCC||d.expired){this.cachedTrackLoadedData=n,this.state!==Ct.STOPPED&&(this.state=Ct.WAITING_TRACK);return}this.cachedTrackLoadedData=null,this.log(`Audio track ${o} "${c.name}" of "${l}" loaded [${i.startSN},${i.endSN}]${i.lastPartSn?`[part-${i.lastPartSn}-${i.lastPartIndex}]`:""},duration:${i.totalduration}`);const u=s[o];let h=0;if(i.live||(r=u.details)!=null&&r.live){if(this.checkLiveUpdate(i),i.deltaUpdateFailed)return;if(u.details){var m;h=this.alignPlaylists(i,u.details,(m=this.levelLastLoaded)==null?void 0:m.details)}i.alignedSliding||(cZ(d,i,this),h=i.fragmentStart)}u.details=i,this.levelLastLoaded=u,this.startFragRequested||this.setStartPosition(d,h),this.hls.trigger(oe.AUDIO_TRACK_UPDATED,{details:i,id:o,groupId:n.groupId}),this.state===Ct.WAITING_TRACK&&!this.waitForCdnTuneIn(i)&&(this.state=Ct.IDLE),this.tick()}_handleFragmentLoadProgress(e){var n;const r=e.frag,{part:s,payload:i}=e,{config:o,trackId:l,levels:c}=this;if(!c){this.warn(`Audio tracks were reset while fragment load was in progress. Fragment ${r.sn} of level ${r.level} will not be buffered`);return}const d=c[l];if(!d){this.warn("Audio track is undefined on fragment load progress");return}const u=d.details;if(!u){this.warn("Audio track details undefined on fragment load progress"),this.removeUnbufferedFrags(r.start);return}const h=o.defaultAudioCodec||d.audioCodec||"mp4a.40.2";let m=this.transmuxer;m||(m=this.transmuxer=new mSt(this.hls,Wn.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));const f=this.initPTS[r.cc],p=(n=r.initSegment)==null?void 0:n.data;if(f!==void 0){const v=s?s.index:-1,b=v!==-1,x=new u_e(r.level,r.sn,r.stats.chunkCount,i.byteLength,v,b,r.duration);m.push(i,p,h,"",r,s,u.totalduration,!1,x,f)}else{this.log(`Unknown video PTS for cc ${r.cc}, waiting for video PTS before demuxing audio frag ${r.sn} of [${u.startSN} ,${u.endSN}],track ${l}`);const{cache:g}=this.waitingData=this.waitingData||{frag:r,part:s,cache:new Qkt,complete:!1};g.push(new Uint8Array(i)),this.state!==Ct.STOPPED&&(this.state=Ct.WAITING_INIT_PTS)}}_handleFragmentLoadComplete(e){if(this.waitingData){this.waitingData.complete=!0;return}super._handleFragmentLoadComplete(e)}onBufferReset(){this.mediaBuffer=null}onBufferCreated(e,n){this.bufferFlushed=this.flushing=!1;const r=n.tracks.audio;r&&(this.mediaBuffer=r.buffer||null)}onFragLoading(e,n){!this.audioOnly&&n.frag.type===Wn.MAIN&&Oo(n.frag)&&(this.mainFragLoading=n,this.state===Ct.IDLE&&this.tick())}onFragBuffered(e,n){const{frag:r,part:s}=n;if(r.type!==Wn.AUDIO){!this.audioOnly&&r.type===Wn.MAIN&&!r.elementaryStreams.video&&!r.elementaryStreams.audiovideo&&(this.audioOnly=!0,this.mainFragLoading=null);return}if(this.fragContextChanged(r)){this.warn(`Fragment ${r.sn}${s?" p: "+s.index:""} of level ${r.level} finished buffering, but was aborted. state: ${this.state}, audioSwitch: ${this.switchingTrack?this.switchingTrack.name:"false"}`);return}if(Oo(r)){const i=this.switchingTrack;i&&(this.bufferedTrack=i)}this.fragBufferedComplete(r,s),this.media&&this.tick()}getFwdBufferInfo(){const e=this.getBufferOutput();return super.getFwdBufferInfo(e,Wn.AUDIO)}getBufferOutput(){return this.mediaBuffer?this.mediaBuffer:this.media}checkFragmentChanged(){const e=this.fragPlaying;if(!this.checkFragPlaying())return!1;const r=this.fragPlaying,s=e==null?void 0:e.level;return(!r||r.level!==s)&&(e&&this.cleanupBackBuffer(),this.switchingTrack&&this.completeAudioSwitch(this.switchingTrack)),!0}onError(e,n){var r;if(n.fatal){this.state=Ct.ERROR;return}switch(n.details){case rt.FRAG_GAP:case rt.FRAG_PARSING_ERROR:case rt.FRAG_DECRYPT_ERROR:case rt.FRAG_LOAD_ERROR:case rt.FRAG_LOAD_TIMEOUT:case rt.KEY_LOAD_ERROR:case rt.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Wn.AUDIO,n);break;case rt.AUDIO_TRACK_LOAD_ERROR:case rt.AUDIO_TRACK_LOAD_TIMEOUT:case rt.LEVEL_PARSING_ERROR:!n.levelRetry&&this.state===Ct.WAITING_TRACK&&((r=n.context)==null?void 0:r.type)===ks.AUDIO_TRACK&&(this.state=Ct.IDLE);break;case rt.BUFFER_APPEND_NO_PROGRESS:if(n.parent!=="audio")return;n.frag&&(n.appendsWithoutProgress||0)>=this.config.appendErrorMaxRetry&&(this.warn(`Marking fragment ${n.frag.sn} of track ${n.frag.level} as a gap after ${n.appendsWithoutProgress} appends without buffered range growth, to prevent loop loading`),this.fragmentTracker.addAsGap(n.frag));break;case rt.BUFFER_ADD_CODEC_ERROR:case rt.BUFFER_APPEND_ERROR:if(n.parent!=="audio")return;this.reduceLengthAndFlushBuffer(n)||this.resetLoadingState();break;case rt.BUFFER_FULL_ERROR:if(n.parent!=="audio")return;this.reduceLengthAndFlushBuffer(n)&&(this.bufferedTrack=null,super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"));break;case rt.INTERNAL_EXCEPTION:this.recoverWorkerError(n);break}}onBufferFlushing(e,{type:n}){n!==na.VIDEO&&(this.flushing=!0)}onBufferFlushed(e,{type:n}){if(n!==na.VIDEO){this.flushing=!1,this.bufferFlushed=!0,this.state===Ct.ENDED&&(this.state=Ct.IDLE);const r=this.getBufferOutput();r&&(this.afterBufferFlushed(r,n),this.tick())}}_handleTransmuxComplete(e){var n;const r="audio",{hls:s}=this,{remuxResult:i,chunkMeta:o}=e,l=this.getCurrentContext(o);if(!l){this.resetWhenMissingContext(o);return}const{frag:c,part:d,level:u}=l,{details:h}=u,{audio:m,text:f,id3:p,initSegment:g}=i;if(this.fragContextChanged(c)||!h){this.fragmentTracker.removeFragment(c),g!=null&&g.tracks&&this.resetTransmuxer();return}if(this.state=Ct.PARSING,m&&this.switchingTrack&&!this.switchingTrack.flushImmediate){const{config:v}=this,b=v.nextAudioTrackBufferFlushForwardOffset,x=Math.max(this.getLoadPosition()+b,c.start);super.flushMainBuffer(x,Number.POSITIVE_INFINITY,Wn.AUDIO)}if(g!=null&&g.tracks){const v=c.initSegment||c;if(this.unhandledEncryptionError(g,c))return;this._bufferInitSegment(u,g.tracks,v,o),s.trigger(oe.FRAG_PARSING_INIT_SEGMENT,{frag:v,id:r,tracks:g.tracks})}if(m){const{startPTS:v,endPTS:b,startDTS:x,endDTS:w}=m;d&&(d.elementaryStreams[na.AUDIO]={startPTS:v,endPTS:b,startDTS:x,endDTS:w}),c.setElementaryStreamInfo(na.AUDIO,v,b,x,w),this.bufferFragmentData(m,c,d,o)}if(p!=null&&(n=p.samples)!=null&&n.length){const v=Mi({id:r,frag:c,details:h},p);s.trigger(oe.FRAG_PARSING_METADATA,v)}if(f){const v=Mi({id:r,frag:c,details:h},f);s.trigger(oe.FRAG_PARSING_USERDATA,v)}}_bufferInitSegment(e,n,r,s){if(this.state!==Ct.PARSING||(n.video&&delete n.video,n.audiovideo&&delete n.audiovideo,!n.audio))return;const i=n.audio;i.id=Wn.AUDIO;const o=e.audioCodec;this.log(`Init audio buffer, container:${i.container}, codecs[level/parsed]=[${o}/${i.codec}]`),(o==null?void 0:o.split(",").length)===1&&(i.levelCodec=o),this.hls.trigger(oe.BUFFER_CODECS,n);const l=i.initSegment;if(l!=null&&l.byteLength){const c={type:"audio",frag:r,part:null,chunkMeta:s,parent:r.type,data:l};this.hls.trigger(oe.BUFFER_APPENDING,c)}this.tickImmediate()}loadFragment(e,n,r){const s=this.fragmentTracker.getState(e);if(this.switchingTrack||s===po.NOT_LOADED||s===po.PARTIAL){var i;if((i=n.details)!=null&&i.live&&!this.initPTS[e.cc]){this.log(`Waiting for video PTS in continuity counter ${e.cc} of live stream before loading audio fragment ${e.sn} of level ${this.trackId}`),this.state=Ct.WAITING_INIT_PTS;const o=this.mainDetails;o&&o.fragmentStart!==n.details.fragmentStart&&cZ(o,n.details,this)}else super.loadFragment(e,n,r)}else this.clearTrackerIfNeeded(e)}flushAudioIfNeeded(e){if(this.media&&this.bufferedTrack&&e.flushImmediate){const{name:n,lang:r,assocLang:s,characteristics:i,audioCodec:o,channels:l}=this.bufferedTrack;Xj({name:n,lang:r,assocLang:s,characteristics:i,audioCodec:o,channels:l},e,zC)||(iZ(e.url,this.hls)?(this.log("Switching audio track : flushing all audio"),super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio"),this.bufferedTrack=null):this.bufferedTrack=e)}}completeAudioSwitch(e){const{hls:n}=this;this.bufferedTrack=e,this.switchingTrack=null,n.trigger(oe.AUDIO_TRACK_SWITCHED,rr({},e))}get nextAudioTrack(){return this.nextTrackId}}class w_e extends Fm{constructor(e,n){super(n,e.logger),this.hls=void 0,this.canLoad=!1,this.timer=-1,this.loadingSync=!1,this.hls=e}destroy(){this.clearTimer(),this.hls=null}clearTimer(){this.timer!==-1&&(self.clearTimeout(this.timer),this.timer=-1)}startLoad(){this.canLoad=!0,this.loadPlaylist()}stopLoad(){this.canLoad=!1,this.clearTimer()}switchParams(e,n,r){const s=n==null?void 0:n.renditionReports;if(s){let i=-1;for(let o=0;o<s.length;o++){const l=s[o];let c;try{c=new self.URL(l.URI,n.url).href}catch(d){this.warn(`Could not construct new URL for Rendition Report: ${d}`),c=l.URI||""}if(c===e){i=o;break}else c===e.substring(0,c.length)&&(i=o)}if(i!==-1){const o=s[i],l=parseInt(o["LAST-MSN"])||n.lastPartSn;let c=parseInt(o["LAST-PART"])||n.lastPartIndex;if(this.hls.config.lowLatencyMode){const u=Math.min(n.age-n.partTarget,n.targetduration);c>=0&&u>n.partTarget&&(c+=1)}const d=r&&tUe(r);return new nUe(l,c>=0?c:void 0,d)}}}loadPlaylist(e){this.clearTimer()}loadingPlaylist(e,n){this.clearTimer()}shouldLoadPlaylist(e){return this.canLoad&&!!e&&!!e.url&&(!e.details||e.details.live)}getUrlWithDirectives(e,n){if(n)try{return n.addDirectives(e)}catch(r){this.warn(`Could not construct new URL with HLS Delivery Directives: ${r}`)}return e}playlistLoaded(e,n,r){const{details:s,stats:i}=n,o=s.fragments,l=self.performance.now(),c=i.loading.first?Math.max(0,Math.floor(l-i.loading.first)):0;s.advancedDateTime=Date.now()-c;const d=this.hls.config.timelineOffset;if(d!==s.appliedTimelineOffset){const h=Math.max(d||0,0);s.appliedTimelineOffset=h,o.forEach(m=>{m==null||m.setStart(m.playlistOffset+h)})}if(s.live||r!=null&&r.live){var u;const h="levelInfo"in n?n.levelInfo:n.track;s.reloaded(r);const m=(u=o[o.length-1])==null?void 0:u.type;if(s.misses>=this.hls.config.liveMaxUnchangedPlaylistRefresh){const S=new Error(`${m} playlist ${h.id} hit max allowed unchanged reloads.`);this.warn(S);const{networkDetails:C,context:j}=n;this.hls.trigger(oe.ERROR,{type:er.NETWORK_ERROR,details:rt.PLAYLIST_UNCHANGED_ERROR,fatal:!1,url:s.url,error:S,reason:S.message,level:n.level,parent:m,context:j,networkDetails:C,stats:i});return}if(r){QXn(r,s,this);const S=s.playlistParsingError;if(S){this.warn(S);const C=this.hls;if(!C.config.ignorePlaylistParsingErrors){const{networkDetails:j}=n;C.trigger(oe.ERROR,{type:er.NETWORK_ERROR,details:rt.LEVEL_PARSING_ERROR,fatal:!1,url:s.url,error:S,reason:S.message,level:n.level,parent:m,networkDetails:j,stats:i});return}s.playlistParsingError=null}}s.requestScheduled===-1&&(s.requestScheduled=i.loading.start);const f=this.hls.mainForwardBufferInfo,p=f?f.end-f.len:0,g=(s.edge-p)*1e3,v=Hkt(s,g);s.requestScheduled+v<l?s.requestScheduled=l:s.requestScheduled<=l&&(s.requestScheduled+=v);const b=n.deliveryDirectives;if(this.log(`live playlist ${e} ${s.advanced?`REFRESHED ${s.lastPartSn} - ${s.lastPartIndex}`:s.updated?"UPDATED":`MISSED (received ${s.lastPartSn} - ${s.lastPartIndex}${b?` | requested ${b.msn} - ${b.part}`:""})`}`),!this.canLoad||!s.live)return;let x,w,k;if(s.canBlockReload&&s.advanced){const S=this.hls.config.lowLatencyMode,C=s.lastPartSn,j=s.endSN,E=s.lastPartIndex,N=E!==-1,A=C===j;N?A?(w=j+1,k=S?0:E):(w=C,k=S?E+1:s.maxPartIndex):w=j+1;const _=s.age,T=_+s.ageHeader;let R=Math.min(T-s.partTarget,s.targetduration*1.5);if(R>0){if(T>s.targetduration*3)this.log(`Playlist last advanced ${_.toFixed(2)}s ago. Omitting segment and part directives.`),w=void 0,k=void 0;else if(r!=null&&r.tuneInGoal&&T-s.partTarget>r.tuneInGoal)this.warn(`CDN Tune-in goal increased from: ${r.tuneInGoal} to: ${R} with playlist age: ${s.age}`),R=0;else{const O=Math.floor(R/s.targetduration);if(w+=O,k!==void 0){const F=Math.round(R%s.targetduration/s.partTarget);k+=F}this.log(`CDN Tune-in age: ${s.ageHeader}s last advanced ${_.toFixed(2)}s goal: ${R} skip sn ${O} to part ${k}`)}s.tuneInGoal=R}if(x=this.getDeliveryDirectives(s,n.deliveryDirectives,w,k),S||!A){s.requestScheduled=l,this.loadingPlaylist(h,x);return}}else(s.canBlockReload||s.canSkipUntil)&&(x=this.getDeliveryDirectives(s,n.deliveryDirectives,w,k));x&&w!==void 0&&s.canBlockReload&&(s.requestScheduled=i.loading.first+Math.max(v-c*2,v/2)),this.scheduleLoading(h,x,s)}else this.clearTimer()}scheduleLoading(e,n,r){const s=r||e.details;if(!s){this.loadingPlaylist(e,n);return}const i=self.performance.now(),o=s.requestScheduled;if(i>=o&&!this.loadingSync){this.loadingSync=!0,this.loadingPlaylist(e,n),this.loadingSync=!1;return}const l=Math.max(o-i,0);this.log(`reload live playlist ${e.name||e.bitrate+"bps"} in ${Math.round(l)} ms`),this.clearTimer(),this.timer=self.setTimeout(()=>this.loadingPlaylist(e,n),l)}getDeliveryDirectives(e,n,r,s){let i=tUe(e);return n!=null&&n.skip&&e.deltaUpdateFailed&&(r=n.msn,s=n.part,i=JW.No),new nUe(r,s,i)}checkRetry(e){const n=e.details,r=tZ(e),s=e.errorAction,{action:i,retryCount:o=0,retryConfig:l}=s||{},c=!!s&&!!l&&(i===od.RetryRequest||!s.resolved&&i===od.SendAlternateToPenaltyBox);if(c){var d;if(o>=l.maxNumRetry)return!1;if(r&&(d=e.context)!=null&&d.deliveryDirectives)this.warn(`Retrying playlist loading ${o+1}/${l.maxNumRetry} after "${n}" without delivery-directives`),this.loadPlaylist();else{var u;const h=D6((u=e.response)==null?void 0:u.code);if(this.clearTimer(),h)this.log("Waiting for connection (offline)"),e.reason="offline",this.timer=self.setTimeout(()=>this.checkOfflineStatus(),1e3);else{const m=s_e(l,o);this.warn(`Retrying playlist loading ${o+1}/${l.maxNumRetry} after "${n}" in ${m}ms`),this.timer=self.setTimeout(()=>this.loadPlaylist(),m)}}e.levelRetry=!0,s.resolved=!0}return c}checkOfflineStatus(){this.clearTimer(),D6(0)?this.timer=self.setTimeout(()=>this.checkOfflineStatus(),1e3):(this.log("Connection restored (online)"),this.loadPlaylist())}}function fSt(t,e){if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!G6(t[n].attrs,e[n].attrs))return!1;return!0}function G6(t,e,n){const r=t["STABLE-RENDITION-ID"];return r&&!n?r===e["STABLE-RENDITION-ID"]:!(n||["LANGUAGE","NAME","CHARACTERISTICS","AUTOSELECT","DEFAULT","FORCED","ASSOC-LANGUAGE"]).some(s=>t[s]!==e[s])}class rtr extends w_e{constructor(e){super(e,"audio-track-controller"),this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.registerListeners()}registerListeners(){const{hls:e}=this;e.on(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.on(oe.MANIFEST_PARSED,this.onManifestParsed,this),e.on(oe.LEVEL_LOADING,this.onLevelLoading,this),e.on(oe.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(oe.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.on(oe.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.off(oe.MANIFEST_PARSED,this.onManifestParsed,this),e.off(oe.LEVEL_LOADING,this.onLevelLoading,this),e.off(oe.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(oe.AUDIO_TRACK_LOADED,this.onAudioTrackLoaded,this),e.off(oe.ERROR,this.onError,this)}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,super.destroy()}onManifestLoading(){this.tracks=[],this.tracksInGroup=[],this.groupIds=null,this.currentTrack=null,this.trackId=-1,this.selectDefaultTrack=!0}onManifestParsed(e,n){this.tracks=n.audioTracks||[]}onAudioTrackLoaded(e,n){const{id:r,groupId:s,details:i}=n,o=this.tracksInGroup[r];if(!o||o.groupId!==s){this.warn(`Audio track with id:${r} and group:${s} not found in active group ${o==null?void 0:o.groupId}`);return}const l=o.details;o.details=n.details,this.log(`Audio track ${r} "${o.name}" lang:${o.lang} group:${s} loaded [${i.startSN}-${i.endSN}]`),r===this.trackId&&this.playlistLoaded(r,n,l)}onLevelLoading(e,n){this.switchLevel(n.level)}onLevelSwitching(e,n){this.switchLevel(n.level)}switchLevel(e){const n=this.hls.levels[e];if(!n)return;const r=n.audioGroups||null,s=this.groupIds;let i=this.currentTrack;if(!r||(s==null?void 0:s.length)!==(r==null?void 0:r.length)||r!=null&&r.some(l=>(s==null?void 0:s.indexOf(l))===-1)){this.groupIds=r,this.trackId=-1,this.currentTrack=null;const l=this.tracks.filter(m=>z6(m.groupId,r));if(l.length)this.selectDefaultTrack&&!l.some(m=>m.default)&&(this.selectDefaultTrack=!1),l.forEach((m,f)=>{m.id=f});else if(!i&&!this.tracksInGroup.length)return;this.tracksInGroup=l;const c=this.hls.config.audioPreference;if(!i&&c){const m=ry(c,l,zC);if(m>-1)i=l[m];else{const f=ry(c,this.tracks);i=this.tracks[f]}}let d=this.findTrackId(i);d===-1&&i&&(d=this.findTrackId(null));const u={audioTracks:l};this.log(`Updating audio tracks, ${l.length} track(s) found in group(s): ${r==null?void 0:r.join(",")}`),this.hls.trigger(oe.AUDIO_TRACKS_UPDATED,u);const h=this.trackId;if(d!==-1&&h===-1)this.setAudioTrack(d);else if(l.length&&h===-1){var o;const m=new Error(`No audio track selected for current audio group-ID(s): ${(o=this.groupIds)==null?void 0:o.join(",")} track count: ${l.length}`);this.warn(m.message),this.hls.trigger(oe.ERROR,{type:er.MEDIA_ERROR,details:rt.AUDIO_TRACK_LOAD_ERROR,fatal:!0,error:m})}}}onError(e,n){n.fatal||!n.context||n.context.type===ks.AUDIO_TRACK&&n.context.id===this.trackId&&z6(n.context.groupId,this.groupIds)&&this.checkRetry(n)}get allAudioTracks(){return this.tracks}get audioTracks(){return this.tracksInGroup}get audioTrack(){return this.trackId}set audioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e)}get nextAudioTrack(){return this.trackId}set nextAudioTrack(e){this.selectDefaultTrack=!1,this.setAudioTrack(e,!1)}setAudioOption(e){const n=this.hls;if(n.config.audioPreference=e,e){const r=this.allAudioTracks;if(this.selectDefaultTrack=!1,r.length){const s=this.currentTrack;if(s&&Xj(e,s,zC))return s;const i=ry(e,this.tracksInGroup,zC);if(i>-1){const o=this.tracksInGroup[i];return this.setAudioTrack(i,"flushImmediate"in e&&e.flushImmediate),o}else if(s){let o=n.loadLevel;o===-1&&(o=n.firstAutoLevel);const l=bXn(e,n.levels,r,o,zC);if(l===-1)return null;n.nextLoadLevel=l}if(e.channels||e.audioCodec){const o=ry(e,r);if(o>-1)return r[o]}}}return null}setAudioTrack(e,n=!0){const r=this.tracksInGroup;if(e<0||e>=r.length){this.warn(`Invalid audio track id: ${e}`);return}this.selectDefaultTrack=!1;const s=this.currentTrack,i=r[e],o=i.details&&!i.details.live;if(e===this.trackId&&i===s&&o||(this.log(`Switching to audio-track ${e} "${i.name}" lang:${i.lang} group:${i.groupId} channels:${i.channels}`),this.trackId=e,this.currentTrack=i,this.hls.trigger(oe.AUDIO_TRACK_SWITCHING,rr(rr({},i),{},{flushImmediate:n})),o))return;const l=this.switchParams(i.url,s==null?void 0:s.details,i.details);this.loadPlaylist(l)}findTrackId(e){const n=this.tracksInGroup;for(let r=0;r<n.length;r++){const s=n[r];if(!(this.selectDefaultTrack&&!s.default)&&(!e||Xj(e,s,zC)))return r}if(e){const{name:r,lang:s,assocLang:i,characteristics:o,audioCodec:l,channels:c}=e;for(let d=0;d<n.length;d++){const u=n[d];if(Xj({name:r,lang:s,assocLang:i,characteristics:o,audioCodec:l,channels:c},u,zC))return d}for(let d=0;d<n.length;d++){const u=n[d];if(G6(e.attrs,u.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return d}for(let d=0;d<n.length;d++){const u=n[d];if(G6(e.attrs,u.attrs,["LANGUAGE"]))return d}}return-1}loadPlaylist(e){super.loadPlaylist();const n=this.currentTrack;this.shouldLoadPlaylist(n)&&iZ(n.url,this.hls)&&this.scheduleLoading(n,e)}loadingPlaylist(e,n){super.loadingPlaylist(e,n);const r=e.id,s=e.groupId,i=this.getUrlWithDirectives(e.url,n),o=e.details,l=o==null?void 0:o.age;this.log(`Loading audio-track ${r} "${e.name}" lang:${e.lang} group:${s}${(n==null?void 0:n.msn)!==void 0?" at sn "+n.msn+" part "+n.part:""}${l&&o.live?" age "+l.toFixed(1)+(o.type&&" "+o.type||""):""} ${i}`),this.hls.trigger(oe.AUDIO_TRACK_LOADING,{url:i,id:r,groupId:s,deliveryDirectives:n||null,track:e})}}class str{constructor(e){this.tracks=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.tracks=e}destroy(){this.tracks=this.queues=null}append(e,n,r){if(this.queues===null||this.tracks===null)return;const s=this.queues[n];s.push(e),s.length===1&&!r&&this.executeNext(n)}appendBlocker(e){return new Promise(n=>{const r={label:"async-blocker",execute:n,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.append(r,e)})}prependBlocker(e){return new Promise(n=>{if(this.queues){const r={label:"async-blocker-prepend",execute:n,onStart:()=>{},onComplete:()=>{},onError:()=>{}};this.queues[e].unshift(r)}})}removeBlockers(){this.queues!==null&&[this.queues.video,this.queues.audio,this.queues.audiovideo].forEach(e=>{var n;const r=(n=e[0])==null?void 0:n.label;r==="async-blocker"||r==="async-blocker-prepend"?(e[0].execute(),e.splice(0,1)):r==="block-audio"&&e.splice(0,1)})}insertNext(e,n){this.queues!==null&&this.queues[n].splice(1,0,...e)}unblockAudio(){var e;this.queues!==null&&((e=this.current("audio"))==null?void 0:e.label)==="block-audio"&&this.shiftAndExecuteNext("audio")}audioBlocking(){return this.queues===null?!1:this.queues.audio.some(e=>e.label==="block-audio")}executeNext(e){if(this.queues===null||this.tracks===null)return;const n=this.queues[e];if(n.length){const s=n[0];try{s.execute()}catch(i){var r;if(s.onError(i),this.queues===null||this.tracks===null)return;const o=(r=this.tracks[e])==null?void 0:r.buffer;o!=null&&o.updating||this.shiftAndExecuteNext(e)}}}shiftAndExecuteNext(e){this.queues!==null&&(this.queues[e].shift(),this.executeNext(e))}current(e){var n;return((n=this.queues)==null?void 0:n[e][0])||null}toString(){const{queues:e,tracks:n}=this;return e===null||n===null?"<destroyed>":`
${this.list("video")}
${this.list("audio")}
${this.list("audiovideo")}}`}list(e){var n,r;return(n=this.queues)!=null&&n[e]||(r=this.tracks)!=null&&r[e]?`${e}: (${this.listSbInfo(e)}) ${this.listOps(e)}`:""}listSbInfo(e){var n;const r=(n=this.tracks)==null?void 0:n[e],s=r==null?void 0:r.buffer;return s?`SourceBuffer${s.updating?" updating":""}${r.ended?" ended":""}${r.ending?" ending":""}`:"none"}listOps(e){var n;return((n=this.queues)==null?void 0:n[e].map(r=>r.label).join(", "))||""}}const UUe=/(avc[1234]|hvc1|hev1|dvh[1e]|vp09|av01)(?:\.[^.,]+)+/,pSt="HlsJsTrackRemovedError",itr=.25,atr=.001;class otr extends Error{constructor(e){super(e),this.name=pSt}}class ltr extends Fm{constructor(e,n){super("buffer-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.fragmentAppendProgress=Object.create(null),this.appendsWithoutProgress=Object.create(null),this.details=null,this._objectUrl=null,this.operationQueue=null,this.bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.lastMpegAudioChunk=null,this.lastVideoAppendEnd=0,this.appendSource=void 0,this.transferData=void 0,this.overrides=void 0,this.appendErrors={audio:0,video:0,audiovideo:0},this.appendError=void 0,this._quotaEvictionPending={},this.tracks={},this.sourceBuffers=[[null,null],[null,null]],this._onEndStreaming=r=>{var s;this.hls&&((s=this.mediaSource)==null?void 0:s.readyState)==="open"&&(!this.media||this.media.seeking||this.hls.pauseBuffering())},this._onStartStreaming=r=>{this.hls&&this.hls.resumeBuffering()},this._onMediaSourceOpen=r=>{const{media:s,mediaSource:i}=this;r&&this.log("Media source opened"),!(!s||!i)&&(pi(i,"sourceopen",this._onMediaSourceOpen),pi(s,"emptied",this._onMediaEmptied),this.updateDuration(),this.hls.trigger(oe.MEDIA_ATTACHED,{media:s,mediaSource:i}),this.mediaSource!==null&&this.checkPendingTracks())},this._onMediaSourceClose=()=>{if(this.log("Media source closed"),this.media){const r=this.media.error,{appendError:s,appendErrors:i}=this;let o=!1;!s&&r&&(o=Math.max(++i.audio,++i.video,++i.audiovideo)>=this.hls.config.appendErrorMaxRetry);const l=new Error(`MediaSource closed while media attached${VUe(o,r)}`);this.warn(l),this.hls.trigger(oe.ERROR,Mi({fatal:o},s,{type:er.MEDIA_ERROR,details:rt.MEDIA_SOURCE_REQUIRES_RESET,error:l}))}},this._onMediaSourceEnded=()=>{this.log("Media source ended")},this._onMediaEmptied=()=>{const{mediaSrc:r,_objectUrl:s}=this;r!==s&&this.error(`Media element src was set while attaching MediaSource (${s} > ${r})`)},this._onMediaError=()=>{const{media:r}=this;if(r){var s,i;this.log(`Media error (code: ${(s=r.error)==null?void 0:s.code}): ${(i=r.error)==null?void 0:i.message}`)}},this.hls=e,this.fragmentTracker=n,this.appendSource=dJn(Bk(e.config.preferManagedMediaSource)),this.initTracks(),this.registerListeners()}hasSourceTypes(){return Object.keys(this.tracks).length>0}destroy(){this.unregisterListeners(),this.details=null,this.lastMpegAudioChunk=null,this.transferData=this.overrides=void 0,this.operationQueue&&(this.operationQueue.destroy(),this.operationQueue=null),this.hls=this.fragmentTracker=null,this._onMediaSourceOpen=this._onMediaSourceClose=null,this._onMediaSourceEnded=null,this._onStartStreaming=this._onEndStreaming=null,this._onMediaEmptied=this._onMediaError=null}registerListeners(){const{hls:e}=this;e.on(oe.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(oe.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.on(oe.MANIFEST_PARSED,this.onManifestParsed,this),e.on(oe.BUFFER_RESET,this.onBufferReset,this),e.on(oe.BUFFER_APPENDING,this.onBufferAppending,this),e.on(oe.BUFFER_CODECS,this.onBufferCodecs,this),e.on(oe.BUFFER_EOS,this.onBufferEos,this),e.on(oe.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(oe.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(oe.FRAG_PARSED,this.onFragParsed,this),e.on(oe.FRAG_CHANGED,this.onFragChanged,this),e.on(oe.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(oe.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(oe.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.off(oe.MANIFEST_PARSED,this.onManifestParsed,this),e.off(oe.BUFFER_RESET,this.onBufferReset,this),e.off(oe.BUFFER_APPENDING,this.onBufferAppending,this),e.off(oe.BUFFER_CODECS,this.onBufferCodecs,this),e.off(oe.BUFFER_EOS,this.onBufferEos,this),e.off(oe.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(oe.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(oe.FRAG_PARSED,this.onFragParsed,this),e.off(oe.FRAG_CHANGED,this.onFragChanged,this),e.off(oe.ERROR,this.onError,this)}transferMedia(){const{media:e,mediaSource:n}=this;if(!e)return null;const r={};if(this.operationQueue){const i=this.isUpdating();i||this.operationQueue.removeBlockers();const o=this.isQueued();(i||o)&&this.warn(`Transfering MediaSource with${o?" operations in queue":""}${i?" updating SourceBuffer(s)":""} ${this.operationQueue}`),this.operationQueue.destroy()}const s=this.transferData;return s&&!this.sourceBufferCount&&s.mediaSource===n?Mi(r,s.tracks):this.sourceBuffers.forEach(i=>{const[o]=i;o&&(r[o]=Mi({},this.tracks[o]),this.removeBuffer(o)),i[0]=i[1]=null}),{media:e,mediaSource:n,tracks:r}}initTracks(){const e={};this.resetAppendProgress(),this.sourceBuffers=[[null,null],[null,null]],this.tracks=e,this.resetQueue(),this.lastMpegAudioChunk=null,this.lastVideoAppendEnd=0}onManifestLoading(){this.bufferCodecEventsTotal=0,this.details=null,this.resetAppendErrors(),this.resetAppendProgress()}onManifestParsed(e,n){var r;let s=2;(n.audio&&!n.video||!n.altAudio)&&(s=1),this.bufferCodecEventsTotal=s,this.log(`${s} bufferCodec event(s) expected.`),(r=this.transferData)!=null&&r.mediaSource&&this.sourceBufferCount&&s&&this.bufferCreated()}onMediaAttaching(e,n){const r=this.media=n.media;this.transferData=this.overrides=void 0;const s=Bk(this.appendSource);if(s){const i=!!n.mediaSource;(i||n.overrides)&&(this.transferData=n,this.overrides=n.overrides);const o=this.mediaSource=n.mediaSource||new s;if(this.assignMediaSource(o),i)this._objectUrl=r.src,this.attachTransferred();else{const l=this._objectUrl=self.URL.createObjectURL(o);if(this.appendSource)try{r.removeAttribute("src");const c=self.ManagedMediaSource;r.disableRemotePlayback=r.disableRemotePlayback||c&&o instanceof c,zUe(r),ctr(r,l),r.load()}catch{r.src=l}else r.src=l}Si(r,"emptied",this._onMediaEmptied),Si(r,"error",this._onMediaError),this.appendSource&&Si(r,"seeking",this._onStartStreaming)}}assignMediaSource(e){var n,r;this.log(`${((n=this.transferData)==null?void 0:n.mediaSource)===e?"transferred":"created"} media source: ${(r=e.constructor)==null?void 0:r.name}`),Si(e,"sourceopen",this._onMediaSourceOpen),Si(e,"sourceended",this._onMediaSourceEnded),Si(e,"sourceclose",this._onMediaSourceClose),this.appendSource&&(Si(e,"startstreaming",this._onStartStreaming),Si(e,"endstreaming",this._onEndStreaming))}attachTransferred(){const e=this.media,n=this.transferData;if(!n||!e)return;const r=this.tracks,s=n.tracks,i=s?Object.keys(s):null,o=i?i.length:0,l=()=>{Promise.resolve().then(()=>{this.media&&this.mediaSourceOpenOrEnded&&this._onMediaSourceOpen()})};if(s&&i&&o){if(!this.tracksReady){this.hls.config.startFragPrefetch=!0,this.log("attachTransferred: waiting for SourceBuffer track info");return}if(this.log(`attachTransferred: (bufferCodecEventsTotal ${this.bufferCodecEventsTotal})
required tracks: ${ya(r,(c,d)=>c==="initSegment"?void 0:d)};
transfer tracks: ${ya(s,(c,d)=>c==="initSegment"?void 0:d)}}`),!rkt(s,r)){n.mediaSource=null,n.tracks=void 0;const c=e.currentTime,d=this.details,u=Math.max(c,(d==null?void 0:d.fragments[0].start)||0);if(u-c>1){this.log(`attachTransferred: waiting for playback to reach new tracks start time ${c} -> ${u}`);return}this.warn(`attachTransferred: resetting MediaSource for incompatible tracks ("${Object.keys(s)}"->"${Object.keys(r)}") start time: ${u} currentTime: ${c}`),this.onMediaDetaching(oe.MEDIA_DETACHING,{}),this.onMediaAttaching(oe.MEDIA_ATTACHING,n),e.currentTime=u;return}this.transferData=void 0,i.forEach(c=>{const d=c,u=s[d];if(u){const h=u.buffer;if(h){const m=this.fragmentTracker,f=u.id;if(m.hasFragments(f)||m.hasParts(f)){const v=Rr.getBuffered(h);m.detectEvictedFragments(d,v,f,null,null,!0)}const p=jde(d),g=[d,h];this.sourceBuffers[p]=g,h.updating&&this.operationQueue&&this.operationQueue.prependBlocker(d),this.trackSourceBuffer(d,u)}}}),l(),this.bufferCreated()}else this.log("attachTransferred: MediaSource w/o SourceBuffers"),l()}get mediaSourceOpenOrEnded(){var e;const n=(e=this.mediaSource)==null?void 0:e.readyState;return n==="open"||n==="ended"}onMediaDetaching(e,n){const r=!!n.transferMedia;this.transferData=this.overrides=void 0;const{media:s,mediaSource:i,_objectUrl:o}=this;if(i){if(this.log(`media source ${r?"transferring":"detaching"}`),r)this.sourceBuffers.forEach(([l])=>{l&&this.removeBuffer(l)}),this.resetQueue();else{if(this.mediaSourceOpenOrEnded){const l=i.readyState==="open";try{const c=i.sourceBuffers;for(let d=c.length;d--;)l&&c[d].abort(),i.removeSourceBuffer(c[d]);l&&i.endOfStream()}catch(c){this.warn(`onMediaDetaching: ${c.message} while calling endOfStream`)}}this.sourceBufferCount&&this.onBufferReset()}pi(i,"sourceopen",this._onMediaSourceOpen),pi(i,"sourceended",this._onMediaSourceEnded),pi(i,"sourceclose",this._onMediaSourceClose),this.appendSource&&(pi(i,"startstreaming",this._onStartStreaming),pi(i,"endstreaming",this._onEndStreaming)),this.mediaSource=null,this._objectUrl=null}s&&(pi(s,"emptied",this._onMediaEmptied),pi(s,"error",this._onMediaError),pi(s,"seeking",this._onStartStreaming),r||(o&&self.URL.revokeObjectURL(o),this.mediaSrc===o?(s.removeAttribute("src"),this.appendSource&&zUe(s),s.load()):this.warn("media|source.src was changed by a third party - skip cleanup")),this.media=null)}onBufferReset(){this.sourceBuffers.forEach(([e])=>{e&&this.resetBuffer(e)}),this.initTracks()}resetBuffer(e){var n;const r=(n=this.tracks[e])==null?void 0:n.buffer;if(this.removeBuffer(e),r)try{var s;(s=this.mediaSource)!=null&&s.sourceBuffers.length&&this.mediaSource.removeSourceBuffer(r)}catch(i){this.warn(`onBufferReset ${e}`,i)}delete this.tracks[e]}removeBuffer(e){this.removeBufferListeners(e),this.sourceBuffers[jde(e)]=[null,null];const n=this.tracks[e];n&&(this.clearBufferAppendTimeoutId(n),n.buffer=void 0)}resetQueue(){this.operationQueue&&this.operationQueue.destroy(),this.operationQueue=new str(this.tracks)}onBufferCodecs(e,n){var r;const s=this.tracks,i=Object.keys(n);this.log(`BUFFER_CODECS: "${i}" (current SB count ${this.sourceBufferCount})`);const o="audiovideo"in n&&(s.audio||s.video)||s.audiovideo&&("audio"in n||"video"in n),l=!o&&this.sourceBufferCount&&this.media&&i.some(c=>!s[c]);if(o||l){this.warn(`Unsupported transition between "${Object.keys(s)}" and "${i}" SourceBuffers`);return}i.forEach(c=>{var d,u;const h=n[c],{id:m,codec:f,levelCodec:p,container:g,metadata:v,supplemental:b}=h;let x=s[c];const w=(d=this.transferData)==null||(d=d.tracks)==null?void 0:d[c],k=w!=null&&w.buffer?w:x,S=(k==null?void 0:k.pendingCodec)||(k==null?void 0:k.codec),C=k==null?void 0:k.levelCodec;x||(x=s[c]={buffer:void 0,listeners:[],codec:f,supplemental:b,container:g,levelCodec:p,metadata:v,id:m});const j=ZW(S,C),E=j==null?void 0:j.replace(UUe,"$1");let N=ZW(f,p);const A=(u=N)==null?void 0:u.replace(UUe,"$1");N&&j&&E!==A&&(c.slice(0,5)==="audio"&&(N=rZ(N,this.appendSource)),this.log(`switching codec ${S} to ${N}`),N!==(x.pendingCodec||x.codec)&&(x.pendingCodec=N),x.container=g,this.appendChangeType(c,g,N))}),(this.tracksReady||this.sourceBufferCount)&&(n.tracks=this.sourceBufferTracks),!this.sourceBufferCount&&(this.bufferCodecEventsTotal>1&&!this.tracks.video&&!n.video&&((r=n.audio)==null?void 0:r.id)==="main"&&(this.log("Main audio-only"),this.bufferCodecEventsTotal=1),this.mediaSourceOpenOrEnded&&this.checkPendingTracks())}get sourceBufferTracks(){return Object.keys(this.tracks).reduce((e,n)=>{const r=this.tracks[n];return e[n]={id:r.id,container:r.container,codec:r.codec,levelCodec:r.levelCodec},e},{})}appendChangeType(e,n,r){const s=`${n};codecs=${r}`,i={label:`change-type=${s}`,execute:()=>{const o=this.tracks[e];if(o){const l=o.buffer;l!=null&&l.changeType&&(this.log(`changing ${e} sourceBuffer type to ${s}`),l.changeType(s),o.codec=r,o.container=n)}this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:o=>{this.warn(`Failed to change ${e} SourceBuffer type`,o)}};this.append(i,e,this.isPending(this.tracks[e]))}blockAudio(e){var n;const r=e.start,s=r+e.duration*.05;if(((n=this.fragmentTracker.getAppendedFrag(r,Wn.MAIN))==null?void 0:n.gap)===!0)return;const o={label:"block-audio",execute:()=>{var l,c;(this.lastVideoAppendEnd>s||Rr.isBuffered((l=this.tracks.video)==null?void 0:l.buffer,s)||((c=this.fragmentTracker.getAppendedFrag(s,Wn.MAIN))==null?void 0:c.gap)===!0)&&this.unblockAudio()},onStart:()=>{},onComplete:()=>{},onError:l=>{this.warn("Error executing block-audio operation",l)}};this.append(o,"audio",!0)}unblockAudio(){this.operationQueue&&this.operationQueue.unblockAudio()}onBufferAppending(e,n){const{tracks:r}=this,{data:s,type:i,parent:o,frag:l,part:c,chunkMeta:d,offset:u}=n,h=d.buffering[i],m=Oo(l)&&!c&&!l.gap&&!d.partial&&!d.iframe;let f=null,p=!1;const{sn:g,cc:v}=l,b=self.performance.now();h.start=b;const x=l.stats.buffering,w=c?c.stats.buffering:null;x.start===0&&(x.start=b),(w==null?void 0:w.start)===0&&(w.start=b);const k=r.audio;let S=!1;i==="audio"&&(k==null?void 0:k.container)==="audio/mpeg"&&(S=!this.lastMpegAudioChunk||d.id===1||this.lastMpegAudioChunk.sn!==d.sn,this.lastMpegAudioChunk=d);const C=r.video,j=C==null?void 0:C.buffer;if(j&&g!=="initSegment"&&u!==void 0){const A=k==null?void 0:k.buffer,_=c||l;if(i==="audio"&&o!=="main"&&!(C.ending||C.ended)&&A&&Rr.getBuffered(A).length){const R=_.start+_.duration*.05,O=Rr.getBuffered(j),F=this.currentOp("video");!O.length&&!F?this.blockAudio(_):!Rr.isBuffered(j,R)&&this.lastVideoAppendEnd<R&&this.blockAudio(_)}else if(i==="video"){const T=_.end,R=this.lastVideoAppendEnd-T;this.lastVideoAppendEnd=T,R<0||R>_.duration?this.unblockAudio():this.isAudioBlocked()&&this.executeNext("audio")}}const E=(c||l).start,N={label:`append-${i}`,execute:()=>{var A;h.executeStart=self.performance.now();const _=(A=this.tracks[i])==null?void 0:A.buffer;_&&(m&&(f=Rr.timeRangesToArray(Rr.getBuffered(_)),p=GUe(Ede(f,l),l)),S?this.updateTimestampOffset(_,E,.1,i,g,v):u!==void 0&&xn(u)&&this.updateTimestampOffset(_,u,1e-6,i,g,v)),this.appendExecutor(s,i)},onStart:()=>{},onComplete:()=>{this.clearBufferAppendTimeoutId(this.tracks[i]);const A=self.performance.now();h.executeEnd=h.end=A,x.first===0&&(x.first=A),(w==null?void 0:w.first)===0&&(w.first=A);const _={};if(this.sourceBuffers.forEach(([T,R])=>{T&&(_[T]=Rr.getBuffered(R))}),m){const T=this.getFragmentAppendProgress(l),R=_[i];if(R&&f){const O=Rr.timeRangesToArray(R),F=Ede(O,l);T.progressed||(T.progressed=F-Ede(f,l)>atr);const D=p&&GUe(F,l);T.fullyBuffered[i]=(T.fullyBuffered[i]===void 0||T.fullyBuffered[i])&&D}}this.hls.trigger(oe.BUFFER_APPENDED,{type:i,frag:l,part:c,chunkMeta:d,parent:o,timeRanges:_})},onError:A=>{var _;this.clearBufferAppendTimeoutId(this.tracks[i]);const T=A.code===DOMException.QUOTA_EXCEEDED_ERR||A.name=="QuotaExceededError"||"quota"in A;if(T&&!this._quotaEvictionPending[i]){const D=this.getBackBufferEvictionTarget(i,s.byteLength,l.type);if(D>0){this._quotaEvictionPending[i]=!0,this.log(`QuotaExceededError on "${i}" append sn: ${g} - evicting back buffer to ${D.toFixed(3)}s and retrying`);const I=this.getFlushOp(i,0,D),P=this.getClearEvictionPendingOp(i);this.insertNext([I,N,P],i);return}this.warn(`QuotaExceededError on "${i}" sn: ${g} - no back buffer available to evict`)}m&&(this.getFragmentAppendProgress(l).errored=!0);const R={type:er.MEDIA_ERROR,parent:o,details:rt.BUFFER_APPEND_ERROR,sourceBufferName:i,frag:l,part:c,chunkMeta:d,error:A,err:A,fatal:!1},O=(_=this.media)==null?void 0:_.error;if(A.name===pSt&&this.sourceBufferCount===0&&(!this.media||this.pendingTrackCount===0))R.errorAction=y$(!0);else{var F;T&&(R.details=rt.BUFFER_FULL_ERROR);const D=++this.appendErrors[i],I=this.hls.config.appendErrorMaxRetry;this.warn(`Failed ${D}/${I+1} times to append segment in "${i}" sourceBuffer with error: ${A.message}`),D>=I&&(R.fatal=!T);const P=(F=this.mediaSource)==null?void 0:F.readyState;(P==="ended"||P==="closed"||O)&&(this.warn(`MediaSource readyState "${P}" during SourceBuffer${VUe(R.fatal,O)}`),R.details=rt.MEDIA_SOURCE_REQUIRES_RESET)}this.appendError=R,this.hls.trigger(oe.ERROR,R),T&&this.hls&&this.trimBuffers(l.start,1)}};this.log(`queuing "${i}" append sn: ${g}${c?" p: "+c.index:""} of ${o} playlist ${l.level} cc: ${v} offset: ${u} bytes: ${s.byteLength}`),this.append(N,i,this.isPending(this.tracks[i]))}getClearEvictionPendingOp(e){return{label:"clear",execute:()=>{this._quotaEvictionPending[e]=!1,this.shiftAndExecuteNext(e)},onStart:()=>{},onComplete:()=>{},onError:()=>{}}}getFlushOp(e,n,r){return this.log(`queuing "${e}" remove ${n}-${r}`),{label:"remove",execute:()=>{this.removeExecutor(e,n,r)},onStart:()=>{},onComplete:()=>{var s;const i=(s=this.tracks[e])==null?void 0:s.buffer;this.log(`Remove request ${n}-${r} from ${e} Source Buffer complete > buffer: ${i?dZ(Rr.getBuffered(i)):"(detached)"}`),this.hls.trigger(oe.BUFFER_FLUSHED,{type:e,start:n,end:r})},onError:s=>{this.warn(`Failed to remove ${n}-${r} from "${e}" SourceBuffer`,s),this.hls.trigger(oe.BUFFER_FLUSHED,{type:e,start:0,end:0,error:s})}}}onBufferFlushing(e,n){const{type:r,startOffset:s,endOffset:i}=n;(!r||r==="audio")&&this.unblockAudio(),r?this.append(this.getFlushOp(r,s,i),r):this.sourceBuffers.forEach(([o])=>{o&&this.append(this.getFlushOp(o,s,i),o)})}onFragParsed(e,n){const{frag:r,part:s,chunkMeta:i}=n,o=[],l=s?s.elementaryStreams:r.elementaryStreams;l[na.AUDIOVIDEO]?o.push("audiovideo"):(l[na.AUDIO]&&o.push("audio"),l[na.VIDEO]&&o.push("video"));const c=()=>{const d=self.performance.now();r.stats.buffering.end=d,s&&(s.stats.buffering.end=d);const u=s?s.stats:r.stats;this.checkAppendProgress(r,s,i,o),this.hls&&(this.hls.trigger(oe.FRAG_BUFFERED,{frag:r,part:s,stats:u,id:r.type,chunkMeta:i}),!s&&r.gap&&u.retry&&this.log(`Nothing buffered for ${r.type} level: ${r.level} sn: ${r.sn} retries ${u.retry}`))};o.length===0&&this.log(`Fragments must have at least one ElementaryStreamType set. ${r.type} ${r.level} ${s?`part: ${s.index} of `:""}sn: ${r.sn}`),this.blockBuffers(c,o).catch(d=>{this.warn(`Fragment buffered callback ${d.message}`),this.stepOperationQueue(this.sourceBufferTypes)})}onFragChanged(e,n){var r,s;const i=(r=this.hls)==null?void 0:r.config;if(!i)return;const{backBufferLength:o,frontBufferFlushThreshold:l}=i;this.trimBuffers(l,o,n.frag,n.previousFrag);const c=n.frag.elementaryStreams,{appendErrors:d}=this,u=(s=this.appendError)==null?void 0:s.sourceBufferName;Object.keys(c).forEach(h=>{c[h]&&(d[h]=0,h===u&&(this.appendError=void 0),h==="audio"||h==="video"?(d.audiovideo=0,u==="audiovideo"&&(this.appendError=void 0)):(d.audio=0,d.video=0,u!=="audiovideo"&&(this.appendError=void 0)))})}get bufferedToEnd(){return this.sourceBufferCount>0&&!this.sourceBuffers.some(([e])=>{if(e){const n=this.tracks[e];if(n)return!n.ended||n.ending}return!1})}onBufferEos(e,n){var r;this.sourceBuffers.forEach(([o])=>{if(o){const l=this.tracks[o];(!n.type||n.type===o)&&(l.ending=!0,l.ended||(l.ended=!0,this.log(`${o} buffer reached EOS`)))}});const s=((r=this.overrides)==null?void 0:r.endOfStream)!==!1;this.sourceBufferCount>0&&!this.sourceBuffers.some(([o])=>{var l;return o&&!((l=this.tracks[o])!=null&&l.ended)})?(this.unblockAudio(),s?(this.log("Queueing EOS"),this.blockUntilOpen(()=>{this.tracksEnded();const{mediaSource:o}=this;if((o==null?void 0:o.readyState)!=="open"){o&&this.log(`Could not call mediaSource.endOfStream(). mediaSource.readyState: ${o.readyState}`);return}this.log("Calling mediaSource.endOfStream()"),o.endOfStream(),this.hls.trigger(oe.BUFFERED_TO_END,void 0)})):(this.tracksEnded(),this.hls.trigger(oe.BUFFERED_TO_END,void 0))):n.type==="video"&&this.unblockAudio()}tracksEnded(){this.sourceBuffers.forEach(([e])=>{if(e!==null){const n=this.tracks[e];n&&(n.ending=!1)}})}onLevelUpdated(e,{details:n}){n.fragments.length&&(this.details=n,this.updateDuration())}updateDuration(){this.blockUntilOpen(()=>{const e=this.getDurationAndRange();e&&this.updateMediaSource(e)})}onError(e,n){if(n.details===rt.BUFFER_APPEND_ERROR&&n.frag){var r;const s=(r=n.errorAction)==null?void 0:r.nextAutoLevel;xn(s)&&s!==n.frag.level&&this.resetAppendErrors()}}getBackBufferEvictionTarget(e,n,r){const{media:s}=this;return s?this.fragmentTracker.getBackBufferEvictionEnd(s.currentTime,r,n):0}getFragmentAppendProgress(e){var n;const r=HUe(e);let s=this.fragmentAppendProgress[r];return((n=s)==null?void 0:n.stats)!==e.stats&&(s={stats:e.stats,progressed:!1,errored:!1,fullyBuffered:Object.create(null)},this.fragmentAppendProgress[r]=s),s}checkAppendProgress(e,n,r,s){if(n||!Oo(e)||e.gap||r.iframe||r.partial)return;const i=HUe(e),o=this.fragmentAppendProgress[i];delete this.fragmentAppendProgress[i];const l=e.stats.buffering;if(l.start&&!l.first)return;const c=(o==null?void 0:o.stats)===e.stats?o:void 0;if(c!=null&&c.errored)return;const d=s.length>0&&s.every(f=>(c==null?void 0:c.fullyBuffered[f])===!0);if(c!=null&&c.progressed||d){delete this.appendsWithoutProgress[i];return}if(!c&&s.length===0)return;const u=(this.appendsWithoutProgress[i]||0)+1,h=this.hls;u>=h.config.appendErrorMaxRetry?delete this.appendsWithoutProgress[i]:this.appendsWithoutProgress[i]=u,this.warn(`Fragment ${e.sn} of ${e.type} playlist ${e.level} appended ${u} time${u>1?"s":""} without buffered range growth`),h.trigger(oe.ERROR,{type:er.MEDIA_ERROR,details:rt.BUFFER_APPEND_NO_PROGRESS,fatal:!1,frag:e,chunkMeta:r,parent:e.type,appendsWithoutProgress:u,error:new Error(`Fragment append did not increase buffered coverage (${u})`)})}resetAppendProgress(){this.fragmentAppendProgress=Object.create(null),this.appendsWithoutProgress=Object.create(null)}resetAppendErrors(){this.appendErrors={audio:0,video:0,audiovideo:0},this.appendError=void 0}trimBuffers(e,n,r,s){const{hls:i,details:o,media:l}=this;if(!l||o===null||!this.sourceBufferCount)return;const c=i.config,d=l.currentTime,u=o.levelTargetDuration;n=o.live&&c.liveBackBufferLength!==null?c.liveBackBufferLength:n;let h=-1/0;if(xn(n)&&n>=0){const m=Math.max(n,u);h=Math.floor(d/u)*u-m}if(r){const m=this.getLoopBackBufferFlushEnd(r,s??null);m>0&&(h=Math.max(h,m))}if(h>0&&this.flushBackBuffer(d,u,h),xn(e)&&e>0){const m=Math.max(c.maxBufferLength,e),f=Math.max(m,u),p=Math.floor(d/u)*u+f;this.flushFrontBuffer(d,u,p)}}getLoopBackBufferFlushEnd(e,n){var r;const{media:s}=this;if(((r=this.hls)==null?void 0:r.config.loopBackBufferFlush)===!1||!(s!=null&&s.loop)||!n||e.level<=n.level)return 0;const{video:i,audiovideo:o}=e.elementaryStreams;if(i!=null&&i.partial||o!=null&&o.partial)return 0;const l=this.getEarliestElementaryStreamStart(e)-itr;return l<=0?0:(this.log(`Flushing lower quality back buffer for loop: level ${e.level}, range [0-${l.toFixed(3)}]`),l)}getEarliestElementaryStreamStart(e){const{audio:n,video:r,audiovideo:s}=e.elementaryStreams;let i=e.start;return s?i=Math.min(i,s.startDTS):(n&&(i=Math.min(i,n.startDTS)),r&&(i=Math.min(i,r.startDTS))),i}flushBackBuffer(e,n,r){this.sourceBuffers.forEach(([s,i])=>{if(i){const d=Rr.getBuffered(i);if(d.length>0&&r>d.start(0)){var o,l,c;this.hls.trigger(oe.BACK_BUFFER_REACHED,{bufferEnd:r});const u=this.tracks[s];if((o=this.details)!=null&&o.live)this.hls.trigger(oe.LIVE_BACK_BUFFER_REACHED,{bufferEnd:r});else if(u!=null&&u.ended&&!((l=this.media)!=null&&l.loop&&((c=this.hls)==null?void 0:c.config.loopBackBufferFlush)!==!1)){this.log(`Cannot flush ${s} back buffer while SourceBuffer is in ended state`);return}this.hls.trigger(oe.BUFFER_FLUSHING,{startOffset:0,endOffset:r,type:s})}}})}flushFrontBuffer(e,n,r){this.sourceBuffers.forEach(([s,i])=>{if(i){const o=Rr.getBuffered(i),l=o.length;if(l<2)return;const c=o.start(l-1),d=o.end(l-1);if(r>c||e>=c&&e<=d)return;this.hls.trigger(oe.BUFFER_FLUSHING,{startOffset:c,endOffset:1/0,type:s})}})}getDurationAndRange(){var e;const{details:n,mediaSource:r}=this;if(!n||!this.media||(r==null?void 0:r.readyState)!=="open")return null;const s=n.edge;if(n.live&&this.hls.config.liveDurationInfinity){if(n.fragments.length&&r.setLiveSeekableRange){const d=Math.max(0,n.fragmentStart),u=Math.max(d,s);return{duration:1/0,start:d,end:u}}return{duration:1/0}}const i=(e=this.overrides)==null?void 0:e.duration;if(i)return xn(i)?{duration:i}:null;const o=this.media.duration,l=xn(r.duration)?r.duration:0;return s>l&&s>o||!xn(o)?{duration:s}:null}updateMediaSource({duration:e,start:n,end:r}){const s=this.mediaSource;!s||!this.media||s.readyState!=="open"||(s.duration!==e&&(xn(e)&&this.log(`Updating MediaSource duration to ${e.toFixed(3)}`),s.duration=e),n!==void 0&&r!==void 0&&(this.log(`MediaSource duration is set to ${s.duration}. Setting seekable range to ${n}-${r}.`),s.setLiveSeekableRange(n,r)))}get tracksReady(){const e=this.pendingTrackCount;return e>0&&(e>=this.bufferCodecEventsTotal||this.isPending(this.tracks.audiovideo))}checkPendingTracks(){const{bufferCodecEventsTotal:e,pendingTrackCount:n,tracks:r}=this;if(this.log(`checkPendingTracks (pending: ${n} codec events expected: ${e}) ${ya(r)}`),this.tracksReady){var s;const i=(s=this.transferData)==null?void 0:s.tracks;i&&Object.keys(i).length?this.attachTransferred():this.createSourceBuffers()}}bufferCreated(){if(this.sourceBufferCount){const e={};this.sourceBuffers.forEach(([n,r])=>{if(n){const s=this.tracks[n];e[n]={buffer:r,container:s.container,codec:s.codec,supplemental:s.supplemental,levelCodec:s.levelCodec,id:s.id,metadata:s.metadata}}}),this.hls.trigger(oe.BUFFER_CREATED,{tracks:e}),this.log(`SourceBuffers created. Running queue: ${this.operationQueue}`),this.sourceBuffers.forEach(([n])=>{this.executeNext(n)})}else{const e=new Error("could not create source buffer for media codec(s)");this.hls.trigger(oe.ERROR,{type:er.MEDIA_ERROR,details:rt.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,error:e,reason:e.message})}}createSourceBuffers(){const{tracks:e,sourceBuffers:n,mediaSource:r}=this;if(!r)throw new Error("createSourceBuffers called when mediaSource was null");for(const i in e){const o=i,l=e[o];if(this.isPending(l)){const c=this.getTrackCodec(l,o),d=`${l.container};codecs=${c}`;l.codec=c,this.log(`creating sourceBuffer(${d})${this.currentOp(o)?" Queued":""} ${ya(l)}`);try{const u=r.addSourceBuffer(d),h=jde(o),m=[o,u];n[h]=m,l.buffer=u}catch(u){var s;this.error(`error while trying to add sourceBuffer: ${u.message}`),this.shiftAndExecuteNext(o),(s=this.operationQueue)==null||s.removeBlockers(),delete this.tracks[o],this.hls.trigger(oe.ERROR,{type:er.MEDIA_ERROR,details:rt.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:u,sourceBufferName:o,mimeType:d,parent:l.id});return}this.trackSourceBuffer(o,l)}}this.bufferCreated()}clearBufferAppendTimeoutId(e){e&&(self.clearTimeout(e.bufferAppendTimeoutId),e.bufferAppendTimeoutId=void 0)}getTrackCodec(e,n){const r=e.supplemental;let s=e.codec;r&&(n==="video"||n==="audiovideo")&&F6(r,"video")&&(s=tXn(s,r));const i=ZW(s,e.levelCodec);return i?n.slice(0,5)==="audio"?rZ(i,this.appendSource):i:""}trackSourceBuffer(e,n){const r=n.buffer;if(!r)return;const s=this.getTrackCodec(n,e);this.tracks[e]={buffer:r,codec:s,container:n.container,levelCodec:n.levelCodec,supplemental:n.supplemental,metadata:n.metadata,id:n.id,listeners:[]},this.removeBufferListeners(e),this.addBufferListener(e,"updatestart",this.onSBUpdateStart),this.addBufferListener(e,"updateend",this.onSBUpdateEnd),this.addBufferListener(e,"error",this.onSBUpdateError),this.appendSource&&this.addBufferListener(e,"bufferedchange",(i,o)=>{const l=o.removedRanges;l!=null&&l.length&&(this.log(`${i} buffer removed ${dZ(l)}`),this.hls.trigger(oe.BUFFER_FLUSHED,{type:i,start:l.start(0),end:l.end(l.length-1)}))})}get mediaSrc(){var e,n;const r=((e=this.media)==null||(n=e.querySelector)==null?void 0:n.call(e,"source"))||this.media;return r==null?void 0:r.src}onSBUpdateStart(e){const n=this.currentOp(e);n&&n.onStart()}onSBUpdateEnd(e){var n,r;if(((n=this.mediaSource)==null?void 0:n.readyState)==="closed"){this.resetBuffer(e);return}const s=this.currentOp(e);if(!s)return;if(s.onComplete(),(r=this.tracks[e])==null||(r=r.buffer)==null?void 0:r.updating){this.log(`${e} SourceBuffer updating on "updateend"`),this.blockUntilOpen(()=>{this.shiftAndExecuteNext(e)});return}this.shiftAndExecuteNext(e)}onSBUpdateError(e,n){var r;const s=(r=this.mediaSource)==null?void 0:r.readyState,i=new Error(`${e} SourceBuffer error. MediaSource readyState: ${s}`);this.error(`${i.message}`,n),this.hls.trigger(oe.ERROR,{type:er.MEDIA_ERROR,details:rt.BUFFER_APPENDING_ERROR,sourceBufferName:e,error:i,fatal:!1});const o=this.currentOp(e);o&&o.onError(i)}updateTimestampOffset(e,n,r,s,i,o){const l=n-e.timestampOffset;Math.abs(l)>=r&&(this.log(`Updating ${s} SourceBuffer timestampOffset to ${n} (sn: ${i} cc: ${o})`),e.timestampOffset=n)}removeExecutor(e,n,r){const{media:s,mediaSource:i}=this,o=this.tracks[e],l=o==null?void 0:o.buffer;if(!s||!i||!l)throw new Error(`Attempting to remove from the ${e} SourceBuffer, but it does not exist`);const c=xn(s.duration)?s.duration:1/0,d=xn(i.duration)?i.duration:1/0,u=Math.max(0,n);if(u>=d){var h;(h=this.currentOp(e))==null||h.onComplete(),this.shiftAndExecuteNext(e);return}const m=Math.min(r,c,d);if(m>u&&(!o.ending||o.ended))o.ended=!1,this.log(`Removing [${u},${m}] from the ${e} SourceBuffer`),l.remove(u,m);else throw new Error(`Cannot remove ${m<=u?`invalid range (${u} >= ${m}) `:""}from the ${e} SourceBuffer${o.ending?" while track ending":""}`)}appendExecutor(e,n){const r=this.tracks[n],s=r==null?void 0:r.buffer;if(!s)throw new otr(`Attempting to append to the ${n} SourceBuffer, but it does not exist`);if(r.ending=!1,r.ended=!1,this.hls.config.appendTimeout!==1/0){const i=this.calculateAppendTimeoutTime(s);r.bufferAppendTimeoutId=self.setTimeout(()=>this.appendTimeoutHandler(n,s,i),i)}s.appendBuffer(e)}appendTimeoutHandler(e,n,r){this.log(`Received timeout after ${r}ms for append on ${e} source buffer. Aborting and triggering error.`);try{n.abort()}catch{this.log(`Failed to abort append on ${e} source buffer after timeout.`)}const s=this.currentOp(e);s&&s.onError(new Error(`${e}-append-timeout`))}calculateAppendTimeoutTime(e){let n=Dkt;this.details&&(n=this.details.levelTargetDuration);let r=2*n*1e3;if(this.media===null)return r;const s=Rr.bufferInfo(e,this.media.currentTime,0);return s.len?(r=Math.max(s.len*1e3,r),Math.max(this.hls.config.appendTimeout,r)):r}blockUntilOpen(e){if(this.isUpdating()||this.isQueued())this.blockBuffers(e).catch(n=>{this.warn(`SourceBuffer blocked callback ${n}`),this.stepOperationQueue(this.sourceBufferTypes)});else try{e()}catch(n){this.warn(`Callback run without blocking ${this.operationQueue} ${n}`)}}isUpdating(){return this.sourceBuffers.some(([e,n])=>e&&n.updating)}isQueued(){return this.sourceBuffers.some(([e])=>e&&!!this.currentOp(e))}isPending(e){return!!e&&!e.buffer}isAudioBlocked(){var e;return((e=this.currentOp("audio"))==null?void 0:e.label)==="block-audio"}isAudioBlocking(){return this.operationQueue?this.operationQueue.audioBlocking():!1}blockBuffers(e,n=this.sourceBufferTypes){if(!n.length)return this.log("Blocking operation requested, but no SourceBuffers exist"),Promise.resolve().then(e);const{operationQueue:r}=this,i=n.length===2&&this.isAudioBlocking()?[this.appendBlocker("video")]:n.map(o=>this.appendBlocker(o));return Promise.all(i).then(o=>{r===this.operationQueue&&(e(),this.stepOperationQueue(this.sourceBufferTypes))})}stepOperationQueue(e){e.forEach(n=>{var r;const s=(r=this.tracks[n])==null?void 0:r.buffer;!s||s.updating||n==="audio"&&this.isAudioBlocked()||this.shiftAndExecuteNext(n)})}append(e,n,r){this.operationQueue&&this.operationQueue.append(e,n,r)}insertNext(e,n){this.operationQueue&&this.operationQueue.insertNext(e,n)}appendBlocker(e){if(this.operationQueue)return this.operationQueue.appendBlocker(e)}currentOp(e){return this.operationQueue?this.operationQueue.current(e):null}executeNext(e){e&&this.operationQueue&&this.operationQueue.executeNext(e)}shiftAndExecuteNext(e){this.operationQueue&&this.operationQueue.shiftAndExecuteNext(e)}get pendingTrackCount(){return Object.keys(this.tracks).reduce((e,n)=>e+(this.isPending(this.tracks[n])?1:0),0)}get sourceBufferCount(){return this.sourceBuffers.reduce((e,[n])=>e+(n?1:0),0)}get sourceBufferTypes(){return this.sourceBuffers.map(([e])=>e).filter(e=>!!e)}addBufferListener(e,n,r){const s=this.tracks[e];if(!s)return;const i=s.buffer;if(!i)return;const o=r.bind(this,e);s.listeners.push({event:n,listener:o}),Si(i,n,o)}removeBufferListeners(e){const n=this.tracks[e];if(!n)return;const r=n.buffer;r&&(n.listeners.forEach(s=>{pi(r,s.event,s.listener)}),n.listeners.length=0)}}function zUe(t){const e=t.querySelectorAll("source");[].slice.call(e).forEach(n=>{t.removeChild(n)})}function ctr(t,e){const n=self.document.createElement("source");n.type="video/mp4",n.src=e,t.appendChild(n)}function jde(t){return t==="audio"?1:0}function VUe(t,e){return`${t?"":" - triggering recovery"}${e?" with HTMLMediaElement Error: "+e.message:""}`}function HUe(t){return`${t.type}_${t.sn}_${t.level}`}function Ede(t,e){const{start:n,end:r}=e;let s=0;for(let i=0;i<t.length;i++){const o=t[i];if(o.start>=r)break;const l=Math.max(n,o.start),c=Math.min(r,o.end);c>l&&(s+=c-l)}return s}function GUe(t,e){return e.duration-t<=.05}class k_e{constructor(e){this.hls=null,this.autoLevelCapping=void 0,this.media=void 0,this.restrictedLevels=void 0,this.timer=void 0,this.observer=void 0,this.clientRect=void 0,this.streamController=void 0,this.hls=e,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.media=null,this.restrictedLevels=[],this.clientRect=null,this.registerListeners()}setStreamController(e){this.streamController=e}destroy(){this.hls&&this.unregisterListener(),(this.timer||this.observer)&&this.stopCapping(),this.media=this.clientRect=this.hls=null,this.streamController=void 0}registerListeners(){const{hls:e}=this;e&&(e.on(oe.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.on(oe.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(oe.MANIFEST_PARSED,this.onManifestParsed,this),e.on(oe.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(oe.BUFFER_CODECS,this.onBufferCodecs,this),e.on(oe.MEDIA_DETACHING,this.onMediaDetaching,this))}unregisterListener(){const{hls:e}=this;e&&(e.off(oe.FPS_DROP_LEVEL_CAPPING,this.onFpsDropLevelCapping,this),e.off(oe.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(oe.MANIFEST_PARSED,this.onManifestParsed,this),e.off(oe.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(oe.BUFFER_CODECS,this.onBufferCodecs,this),e.off(oe.MEDIA_DETACHING,this.onMediaDetaching,this))}onFpsDropLevelCapping(e,n){if(!this.hls)return;const r=this.hls.levels[n.droppedLevel];this.isLevelAllowed(r)&&this.restrictedLevels.push({bitrate:r.bitrate,height:r.height,width:r.width})}onMediaAttaching(e,n){const r=n.media;this.clientRect=null,this.hls&&(r instanceof HTMLVideoElement?(this.media=r,this.hls.config.capLevelToPlayerSize&&this.observe()):this.media=null,(this.timer||this.observer)&&this.hls.levels.length>1&&this.detectPlayerSize())}onManifestParsed(e,n){this.restrictedLevels=[],n.video&&this.startCapping(),this.onLevelsUpdated()}onLevelsUpdated(){if(this.hls){if((this.timer||this.observer)&&(xn(this.autoLevelCapping)||this.clientRect))this.detectPlayerSize();else if(this.observer===void 0&&this.timer===void 0){const e=this.hls.levels;e.length>1&&e.some(n=>!!n.videoCodec)&&this.startCapping()}}}onBufferCodecs(e,n){n.video&&this.startCapping()}onMediaDetaching(){this.stopCapping(),this.media=null}detectPlayerSize(){if(this.media){if(this.mediaHeight<=0||this.mediaWidth<=0||!this.hls){this.clientRect=null;return}const e=this.hls.levels;if(e.length>1){const n=this.hls,r=this.getMaxLevel(e.length-1);r!==this.autoLevelCapping&&n.logger.log(`Setting autoLevelCapping to ${r}: ${e[r].height}p@${e[r].bitrate} for media ${this.mediaWidth}x${this.mediaHeight}`),n.autoLevelCapping=r,n.autoLevelEnabled&&n.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=n.autoLevelCapping}else e.length===1&&this.stopCapping()}}getMaxLevel(e){if(!this.hls)return-1;const n=this.hls.levels;if(!n.length)return-1;const r=n.filter((s,i)=>this.isLevelAllowed(s)&&i<=e);return this.observer||(this.clientRect=null),k_e.getMaxLevelByMediaSize(r,this.mediaWidth,this.mediaHeight)}observe(){const e=self.ResizeObserver;e&&(this.observer=new e(n=>{var r;const s=(r=n[0])==null?void 0:r.contentRect;s&&(this.clientRect=s,this.detectPlayerSize())})),this.observer&&this.media&&this.observer.observe(this.media)}startCapping(){var e;this.timer||this.observer||!((e=this.hls)!=null&&e.config.capLevelToPlayerSize)||(self.clearInterval(this.timer),this.timer=void 0,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.observe(),this.observer||(this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3)),this.detectPlayerSize())}stopCapping(){this.restrictedLevels=[],this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0),this.observer&&(this.observer.disconnect(),this.observer=void 0)}getDimensions(){if(this.clientRect)return this.clientRect;const e=this.media,n={width:0,height:0};if(e){const r=e.getBoundingClientRect();n.width=r.width,n.height=r.height,!n.width&&!n.height&&(n.width=r.right-r.left||e.width||0,n.height=r.bottom-r.top||e.height||0)}return this.clientRect=n,n}get mediaWidth(){return this.getDimensions().width*this.contentScaleFactor}get mediaHeight(){return this.getDimensions().height*this.contentScaleFactor}get contentScaleFactor(){let e=1;if(!this.hls)return e;const{ignoreDevicePixelRatio:n,maxDevicePixelRatio:r}=this.hls.config;if(!n)try{e=self.devicePixelRatio}catch{}return Math.min(e,r)}isLevelAllowed(e){return!this.restrictedLevels.some(r=>e.bitrate===r.bitrate&&e.width===r.width&&e.height===r.height)}static getMaxLevelByMediaSize(e,n,r){if(!(e!=null&&e.length))return-1;const s=(l,c)=>c?l.width!==c.width||l.height!==c.height:!0;let i=e.length-1;const o=Math.max(n,r);for(let l=0;l<e.length;l+=1){const c=e[l];if((c.width>=o||c.height>=o)&&s(c,e[l+1])){i=l;break}}return i}}var Ch=class cxe{constructor(e,n){Array.isArray(e)&&(e=e.map(r=>r instanceof cxe?r:new cxe(r))),this.value=e,this.params=n}};const dtr="Dict";function utr(t){return Array.isArray(t)?JSON.stringify(t):t instanceof Map?"Map{}":t instanceof Set?"Set{}":typeof t=="object"?JSON.stringify(t):String(t)}function htr(t,e,n,r){return new Error(`failed to ${t} "${utr(e)}" as ${n}`,{cause:r})}const WUe="Bare Item",mtr="Boolean",ftr="Byte Sequence",ptr="Decimal",gtr="Integer";function vtr(t){return t<-999999999999999||999999999999999<t}const ytr="String",btr=/[\x00-\x1f\x7f]+/;var gSt=class{constructor(t){this.description=t}};const xtr="Token",wtr="Key";function Iy(t,e,n){return htr("serialize",t,e,n)}function ktr(t){if(typeof t!="boolean")throw Iy(t,mtr);return t?"?1":"?0"}function Str(t){if(ArrayBuffer.isView(t)===!1)throw Iy(t,ftr);return`:${uJn(t)}:`}function vSt(t){if(vtr(t))throw Iy(t,gtr);return t.toString()}function Ctr(t){return`@${vSt(t.getTime()/1e3)}`}function jtr(t){const e=skt(t,3);if(Math.floor(Math.abs(e)).toString().length>12)throw Iy(t,ptr);const n=e.toString();return n.includes(".")?n:`${n}.0`}function Etr(t){if(btr.test(t))throw Iy(t,ytr);return`"${t.replace(/\\/g,"\\\\").replace(/"/g,'\\"')}"`}function Ntr(t){return t.description||t.toString().slice(7,-1)}function qUe(t){const e=Ntr(t);if(/^([a-zA-Z*])([!#$%&'*+\-.^_`|~\w:/]*)$/.test(e)===!1)throw Iy(e,xtr);return e}function dxe(t){switch(typeof t){case"number":if(!xn(t))throw Iy(t,WUe);return Number.isInteger(t)?vSt(t):jtr(t);case"string":return Etr(t);case"symbol":return qUe(t);case"boolean":return ktr(t);case"object":if(t instanceof Date)return Ctr(t);if(t instanceof Uint8Array)return Str(t);if(t instanceof gSt)return qUe(t);default:throw Iy(t,WUe)}}function uxe(t){if(/^[a-z*][a-z0-9\-_.*]*$/.test(t)===!1)throw Iy(t,wtr);return t}function S_e(t){return t==null?"":Object.entries(t).map(([e,n])=>n===!0?`;${uxe(e)}`:`;${uxe(e)}=${dxe(n)}`).join("")}function ySt(t){return t instanceof Ch?`${dxe(t.value)}${S_e(t.params)}`:dxe(t)}function Ttr(t){return`(${t.value.map(ySt).join(" ")})${S_e(t.params)}`}function _tr(t,e={whitespace:!0}){if(typeof t!="object"||t==null)throw Iy(t,dtr);const n=t instanceof Map?t.entries():Object.entries(t),r=e!=null&&e.whitespace?" ":"";return Array.from(n).map(([s,i])=>{i instanceof Ch||(i=new Ch(i));let o=uxe(s);return i.value===!0?o+=S_e(i.params):(o+="=",Array.isArray(i.value)?o+=Ttr(i):o+=ySt(i)),o}).join(`,${r}`)}function bSt(t,e){return _tr(t,e)}const Atr=["url"],Ptr=["version","eventTargets","sid","transmissionMode"],Rtr=["customData","headers"],KUe=t=>t instanceof Ch?new Ch(Math.round(t.value),t.params):Math.round(t),Nde=t=>Array.isArray(t)?t.map(KUe):KUe(t),hxe=(t,e)=>Array.isArray(t)?t.map(n=>hxe(n,e)):t instanceof Ch&&typeof t.value=="string"?new Ch(hxe(t.value,e),t.params):(e.baseUrl&&(t=pJn(t,fJn(e.baseUrl))),e.version===1?encodeURIComponent(t):t),YUe=t=>t instanceof Ch?new Ch(Math.round(t.value/100)*100,t.params):Math.round(t/100)*100,yV=t=>Array.isArray(t)?t.map(YUe):YUe(t),Itr=(t,e)=>{let n=t;return e.version>=2&&(t instanceof Ch&&typeof t.value=="string"?n=new Ch([t]):typeof t=="string"&&(n=[t])),hxe(n,e)},Mtr={br:Nde,d:Nde,bl:yV,dl:yV,mtp:yV,nor:Itr,rtp:yV,tb:Nde},W6=2,xSt="bc",Ltr="ps",wSt="pr",Dtr="e",QUe="t",$tr="c",kSt="b",C_e="rr",SSt="ce",bV={BITRATE_CHANGE:xSt,ERROR:Dtr,RESPONSE_RECEIVED:C_e,CUSTOM_EVENT:SSt},CSt=new Map([[Ltr,"sta"],[wSt,"pr"],[$tr,"cid"],[kSt,"bg"],[xSt,"br"]]),j_e="event",E_e="request",jSt=["cen","e","h","ts"],ESt=["ab","bg","bl","br","bs","bsa","bsd","bsda","cdn","cid","cs","d","dfa","dl","ec","lab","lb","ltc","msd","mtp","nor","nr","ot","pb","pr","pt","rtp","sf","sid","sn","st","sta","su","tab","tb","tbl","tpb","v"],Otr=/^[a-zA-Z0-9-.]+-[a-zA-Z0-9-.]+$/;function N_e(t){return Otr.test(t)}const Ftr=new Set(ESt);function NSt(t){return Ftr.has(t)||N_e(t)}const TSt=["cmsdd","cmsds","rc","smrt","ttfb","ttfbb","ttlb","url"],Btr=new Set(TSt);function _St(t){return Btr.has(t)}const Utr=new Set(jSt);function ztr(t){return NSt(t)||_St(t)||Utr.has(t)}const Vtr=new Set(["ab","bl","br","bsa","bsd","bsda","lab","lb","mtp","pb","tab","tb","tbl","tpb"]),Vre=["bl","br","bs","cid","d","dl","mtp","nor","nrr","ot","pr","rtp","sf","sid","st","su","tb","v"],Htr=new Set(Vre);function Gtr(t){return Htr.has(t)||N_e(t)}const Wtr=new Set(["ot","sf","st","e","sta"]);function qtr(t){return Wtr.has(t)}function Ktr(t){return typeof t=="number"?xn(t):t!=null&&t!==""&&t!==!1}const Ytr={[j_e]:ztr,[E_e]:NSt};function ASt(t,e){if(Array.isArray(t)){let n;return e&&(n=t.find(r=>{var s;return((s=r.params)==null?void 0:s.ot)===e})),n||(n=t[0]),ASt(n)}return t instanceof Ch?t.value:t}function Qtr(t){const e={};for(const[r,s]of Object.entries(t)){if(s==null){e[r]=s;continue}if(r==="nor"){const i=(Array.isArray(s)?s:[s])[0];if(i instanceof Ch){var n;e.nor=i.value,(n=i.params)!=null&&n.r&&(e.nrr=i.params.r)}else e.nor=i}else Vtr.has(r)?e[r]=ASt(s,t.ot):e[r]=s}return e}function PSt(t,e={}){const n={};if(t==null||typeof t!="object")return n;const r=e.version||t.v||W6,s=e.reportingMode||E_e,i=r===1?Qtr(t):t,o=r===1?Gtr:Ytr[s];let l=Object.keys(i).filter(o);i.e&&i.e!==C_e&&(l=l.filter(f=>!_St(f)));const c=e.filter;typeof c=="function"&&(l=l.filter(c));const d=s===j_e;if(d){const f=i.e;!l.includes("e")&&f!=null&&l.push("e"),l.includes("ts")||l.push("ts"),!l.includes("cen")&&i.cen!=null&&f===SSt&&l.push("cen");const p=f?CSt.get(f):void 0;p&&i[p]!=null&&!l.includes(p)&&l.push(p)}if(l.length===0)return n;r>1&&!l.includes("v")&&l.push("v");const u={version:r,reportingMode:s,baseUrl:e.baseUrl};l.sort();for(const f of l){var h,m;let p=i[f];const g=(h=(m=e.formatters)==null?void 0:m[f])!=null?h:Mtr[f];if(typeof g=="function"&&(p=g(p,u)),f==="v"){if(r===1)continue;p=r}if(f==="pr"&&p===1&&!(d&&i.e===wSt))continue;d&&f==="ts"&&!xn(p)&&(p=Date.now());const v=d&&p===!1&&f==="bg"&&i.e===kSt;!Ktr(p)&&!v||(qtr(f)&&typeof p=="string"&&(p=new gSt(p)),n[f]=p)}return n}const pb="CMCD-Object",Xu="CMCD-Request",kT="CMCD-Session",yp="CMCD-Status",Ztr={REQUEST:Xu},Jtr={ab:pb,br:pb,d:pb,lab:pb,lb:pb,ot:pb,tab:pb,tb:pb,tpb:pb,bl:Xu,cs:Xu,dfa:Xu,dl:Xu,ltc:Xu,mtp:Xu,nor:Xu,nrr:Xu,pb:Xu,sn:Xu,sta:Xu,su:Xu,tbl:Xu,cid:kT,msd:kT,sf:kT,sid:kT,st:kT,v:kT,bg:yp,bs:yp,bsa:yp,bsd:yp,bsda:yp,cdn:yp,ec:yp,nr:yp,pr:yp,pt:yp,rtp:yp};function Xtr(t){return Object.keys(t).reduce((e,n)=>{var r;return(r=t[n])==null||r.forEach(s=>e[s]=n),e},{})}function enr(t,e){const n={};if(!t)return n;const r=Object.keys(t),s=e?Xtr(e):{};for(const o of r){var i;const l=Jtr[o]||s[o]||Ztr.REQUEST,c=(i=n[l])!=null?i:n[l]={};c[o]=t[o]}return n}function tnr(t,e){const n={},r=enr(t,e);for(const[s,i]of Object.entries(r)){const o=bSt(i,{whitespace:!1});o&&(n[s]=o)}return n}const ZUe="CMCD";function RSt(t){return bSt(t,{whitespace:!1})}function nnr(t,e={}){return t?RSt(PSt(t,e)):""}const rnr=30,mxe=[...Vre,...ESt,...TSt,...jSt].filter((t,e,n)=>n.indexOf(t)===e),snr="application/cmcd",inr=1,Qc={MANIFEST:"m",AUDIO:"a",VIDEO:"v",MUXED:"av",INIT:"i",CAPTION:"c",TIMED_TEXT:"tt",KEY:"k",OTHER:"o"},bp={STARTING:"s",PLAYING:"p",SEEKING:"k",REBUFFERING:"r",PAUSED:"a",ENDED:"e",FATAL_ERROR:"f",PRELOADING:"d"},T_e="query",ISt="headers";function JUe(t,e,n){var r;const s=new Set((r=e.enabledKeys)!=null?r:[]);return{version:e.version||W6,reportingMode:t,filter:i=>s.has(i),baseUrl:n}}function anr(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++){const r=t[n],s=e[n];if(r===s)continue;if(typeof r=="number"||typeof s=="number"||r.value!==s.value)return!1;const i=r.params,o=s.params,l=i&&Object.keys(i)[0],c=o&&Object.keys(o)[0];if(l!==c||l!==void 0&&c!==void 0&&i&&o&&i[l]!==o[c])return!1}return!0}const onr=Object.is,lnr=t=>t,MSt=Array.from(CSt,([t,e])=>e==="br"?{event:t,field:e,equal:(n,r)=>n===void 0||r===void 0?n===r:anr(n,r),snapshot:n=>n.slice()}:{event:t,field:e,equal:onr,snapshot:lnr}),cnr=new Map(MSt.map(t=>[t.event,t]));function dnr(t){const{url:e}=t,n=Bre(t,Atr);return fetch(e,n)}function unr(t){const{version:e=W6,eventTargets:n=[],sid:r=ikt(),transmissionMode:s=T_e}=t,i=Bre(t,Ptr);return rr(rr({},i),{},{version:e,transmissionMode:s,sid:r,eventTargets:n.reduce((o,l)=>{var c,d,u;return l!=null&&l.url&&(c=l.events)!=null&&c.length&&o.push({version:l.version||W6,enabledKeys:((d=l.enabledKeys)==null?void 0:d.slice())||[],url:l.url,events:l.events.slice(),interval:(u=l.interval)!=null?u:rnr,batchSize:l.batchSize||1}),o},[])})}var hnr=class{constructor(t,e=dnr){var n;this.timeOrigin=performance.timeOrigin||((n=performance.timing)==null?void 0:n.fetchStart)||Date.now()-performance.now(),this.data={},this.msd=NaN,this.eventTargets=new Map,this.lastEmitted={},this.requestTarget={sn:0,msdSent:!1},this.config=unr(t),this.data={cid:this.config.cid,sid:this.config.sid,v:this.config.version},this.requester=e;for(const r of this.config.eventTargets)this.eventTargets.set(r,{intervalId:void 0,sn:0,msdSent:!1,queue:[]})}start(){this.eventTargets.forEach((t,e)=>{if(this.disarmInterval(t),e.interval===0||!e.events.includes(QUe))return;const n=()=>{this.recordTargetEvent(t,e,QUe),this.processEventTargets()};t.intervalId=setInterval(n,e.interval*1e3),n()})}stop(t=!1){t&&this.flush(),this.eventTargets.forEach(e=>{this.disarmInterval(e)})}flush(){this.processEventTargets(!0)}update(t){t.sid&&t.sid!==this.data.sid&&this.resetSession(),t.msd&&!isNaN(t.msd)&&(this.msd=t.msd),this.data=rr(rr(rr({},this.data),t),{},{msd:void 0});for(const e of MSt)e.field in t&&!e.equal(this.data[e.field],this.lastEmitted[e.field])&&this.recordEvent(e.event)}recordEvent(t,e={}){const n=cnr.get(t);if(n){const r=n.field,s=e[r];s!==void 0&&Mi(this.data,{[r]:s});const i=this.data[r];if(i===void 0||n.equal(i,this.lastEmitted[r]))return;Mi(this.lastEmitted,{[r]:n.snapshot(i)})}this.eventTargets.forEach((r,s)=>{this.recordTargetEvent(r,s,t,e)}),this.processEventTargets()}recordTargetEvent(t,e,n,r={}){var s;if(!e.events.includes(n))return;const i=rr(rr(rr({},this.data),r),{},{e:n,ts:(s=r.ts)!=null?s:Date.now(),sn:t.sn++});!isNaN(this.msd)&&!t.msdSent&&(i.msd=this.msd,t.msdSent=!0),t.queue.push(i)}recordResponseReceived(t,e={}){var n,r,s;const{request:i}=t,o=(n=e.url)!=null?n:i==null?void 0:i.url;if(!o)return;const l=new URL(o);l.searchParams.delete(ZUe);const c={url:l.toString(),rc:t.status},d=t.resourceTiming;d&&(d.startTime!=null&&(c.ts=Math.round(this.timeOrigin+d.startTime),d.responseStart!=null&&(c.ttfb=Math.round(d.responseStart-d.startTime))),d.duration!=null&&(c.ttlb=Math.round(d.duration)));const u=(r=(s=i.customData)==null?void 0:s.cmcd)!=null?r:{};this.recordEvent(C_e,rr(rr(rr({},u),c),e))}applyRequestReport(t){var e;return(e=this.createRequestReport(t))!=null?e:t}isRequestReportingEnabled(){var t;return!!((t=this.config.enabledKeys)!=null&&t.length)}createRequestReport(t,e){var n;const{customData:r={},headers:s={}}=t,i=Bre(t,Rtr),o=rr(rr({},i),{},{headers:rr({},s),customData:rr(rr({},r),{},{cmcd:{}})});if(!((n=this.config.enabledKeys)!=null&&n.length)||!o.url)return o;const l=new URL(o.url),c=rr(rr(rr({},this.data),e),{},{sn:this.requestTarget.sn++}),d=JUe(E_e,this.config,o.url);!isNaN(this.msd)&&!this.requestTarget.msdSent&&(c.msd=this.msd,this.requestTarget.msdSent=!0);const u=o.customData.cmcd=PSt(c,d);switch(this.config.transmissionMode){case T_e:const h=RSt(u);h&&(l.searchParams.set(ZUe,h),o.url=l.toString());break;case ISt:Mi(o.headers,tnr(u,d.customHeaderMap));break}return o}processEventTargets(t=!1){let e=!1;this.eventTargets.forEach((n,r)=>{const{queue:s}=n;if(!s.length||s.length<r.batchSize&&!t)return;const i=t?s.length:r.batchSize,o=s.splice(0,i);this.sendEventReport(r,o).catch(()=>{n.queue.unshift(...o)}),e||(e=s.length>0)}),e&&this.processEventTargets()}async sendEventReport(t,e){const n=JUe(j_e,t),{status:r}=await this.requester({url:t.url,method:"POST",headers:{"Content-Type":snr},body:e.map(s=>nnr(s,n)).join(`
`)+`
`});if(r===410)this.disposeEventTarget(t);else if(r===429||r>499&&r<600)throw new Error(`Event report failed with status ${r}`)}disarmInterval(t){clearInterval(t.intervalId),t.intervalId=void 0}disposeEventTarget(t){const e=this.eventTargets.get(t);e&&(this.disarmInterval(e),this.eventTargets.delete(t))}resetSession(){this.eventTargets.forEach(t=>t.sn=0),this.requestTarget.sn=0,this.lastEmitted={}}};const mnr={HLS:"h"},Tde={VOD:"v",LIVE:"l",LOW_LATENCY:"ll"};function fnr(t,e){return new Ch(t,e)}new Set(Vre);new Set(mxe);const pnr=["includeKeys"];function XUe(t){return Object.keys(t).every(N_e)}class gnr{constructor(e){this.hls=void 0,this.config=void 0,this.media=void 0,this.initialized=!1,this.starved=!1,this.buffering=!0,this.playerState=void 0,this.reporter=void 0,this.playheadLevel=void 0,this.onWaiting=()=>{this.initialized&&(this.starved=!0,this.setPlayerState(bp.REBUFFERING)),this.buffering=!0},this.onPlay=()=>{this.initialized||this.setPlayerState(bp.STARTING)},this.onPlaying=()=>{this.initialized||(this.initialized=!0),this.buffering=!1,this.setPlayerState(bp.PLAYING)},this.onPause=()=>{this.media&&!this.media.ended&&this.setPlayerState(bp.PAUSED)},this.onSeeking=()=>{this.initialized&&this.setPlayerState(bp.SEEKING)},this.onSeeked=()=>{var s;this.initialized&&(s=this.media)!=null&&s.paused&&this.setPlayerState(bp.PAUSED)},this.onRateChange=()=>{this.reporter&&this.media&&this.reporter.update({pr:this.media.playbackRate})},this.applyPlaylistData=s=>{try{this.apply(s,{ot:Qc.MANIFEST,su:!this.initialized})}catch(i){this.hls.logger.warn("Could not generate manifest CMCD data.",i)}},this.applyFragmentData=s=>{try{const{frag:l,part:c}=s,d=this.hls.levels[l.level],u=this.getObjectType(l,d),h={d:(c||l).duration*1e3,ot:u};if(u===Qc.VIDEO||u===Qc.AUDIO||u===Qc.MUXED||u==null&&(l.type==="main"||l.type==="audio")){var i;const f=d.bitrate/1e3;h.br=[f];const{cmcd:p}=this.config,g=(i=p==null?void 0:p.rtpSafetyFactor)!=null?i:5;if(h.rtp=Math.round(f*g/100)*100,u===Qc.MUXED||u==null&&l.type==="main"){const x=this.getTopBandwidth()/1e3;xn(x)&&(h.tb=[x]);const w=this.getLowestBandwidth()/1e3;xn(w)&&(h.lb=[w])}const v=this.getBufferLength(l);if(xn(v)){var o;h.bl=[v];const x=((o=this.media)==null?void 0:o.playbackRate)||1;h.dl=Math.round(v/x/100)*100}this.playheadLevel&&(h.pb=[this.playheadLevel.bitrate/1e3]);const b=this.hls.maxAutoLevel;if(b>=0){const x=this.hls.levels[b];x&&(h.tpb=[x.bitrate/1e3])}}const m=c?this.getNextPart(c):this.getNextFrag(l);m!=null&&m.url&&m.url!==l.url&&(m.byteRange.length>0?h.nor=[fnr(m.url,{r:`${m.byteRange[0]}-${m.byteRange[1]}`})]:h.nor=[m.url]),this.apply(s,h)}catch(l){this.hls.logger.warn("Could not generate segment CMCD data.",l)}},this.recordFragmentResponse=(s,i,o)=>{var l;const{cmcd:c}=this.config,d=c==null||(l=c.eventTargets)==null?void 0:l.some(u=>{var h;return(h=u.events)==null?void 0:h.includes(bV.RESPONSE_RECEIVED)});if(!(!this.reporter||!(o.loading.first>0)||!d))try{this.reporter.recordResponseReceived({request:{url:s},status:i.code,resourceTiming:{startTime:o.loading.start,responseStart:o.loading.first,duration:o.loading.end-o.loading.start,encodedBodySize:o.total}})}catch(u){this.hls.logger.warn("Could not record fragment response CMCD data.",u)}},this.hls=e;const n=this.config=e.config,{cmcd:r}=n;r!=null&&(n.pLoader=this.createPlaylistLoader(),n.fLoader=this.createFragmentLoader(),this.registerListeners())}createReporter(){var e,n;const{cmcd:r}=this.config;if(r==null)return;const s=r.version||inr;if(this.reporter=new hnr({sid:r.sessionId||this.hls.sessionId,cid:r.contentId,version:s,transmissionMode:r.useHeaders===!0?ISt:T_e,enabledKeys:(e=r.includeKeys)!=null?e:[...s>=W6?mxe:Vre],eventTargets:((n=r.eventTargets)!=null?n:[]).map(i=>{let{includeKeys:o}=i,l=Bre(i,pnr);return rr(rr({},l),{},{enabledKeys:o??mxe})})},r.loader),this.reporter.update({sf:mnr.HLS,sta:this.playerState}),r.reporterCallback){const i=this.reporter,o={updateCustomData:l=>{XUe(l)&&i.update(l)},recordCustomEvent:(l,c={})=>{XUe(c)&&i.recordEvent(bV.CUSTOM_EVENT,rr({cen:l},c))}};r.reporterCallback(o)}this.reporter.start()}registerListeners(){const e=this.hls;e.on(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.on(oe.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(oe.MEDIA_DETACHED,this.onMediaDetached,this),e.on(oe.MEDIA_ENDED,this.onMediaEnded,this),e.on(oe.ERROR,this.onError,this),e.on(oe.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(oe.LEVEL_SWITCHED,this.onLevelSwitched,this),e.on(oe.BUFFER_APPENDED,this.onBufferInfoChange,this),e.on(oe.BUFFER_FLUSHED,this.onBufferInfoChange,this)}unregisterListeners(){const e=this.hls;e.off(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.off(oe.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(oe.MEDIA_DETACHED,this.onMediaDetached,this),e.off(oe.MEDIA_ENDED,this.onMediaEnded,this),e.off(oe.ERROR,this.onError,this),e.off(oe.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(oe.LEVEL_SWITCHED,this.onLevelSwitched,this),e.off(oe.BUFFER_APPENDED,this.onBufferInfoChange,this),e.off(oe.BUFFER_FLUSHED,this.onBufferInfoChange,this)}destroy(){this.unregisterListeners(),this.onMediaDetached(),this.reporter&&(this.reporter.stop(!0),this.reporter=void 0),this.hls=this.config=null,this.onWaiting=this.onPlay=this.onPlaying=this.onPause=null,this.onSeeking=this.onSeeked=this.onRateChange=this.media=null}onMediaAttaching(e,n){const r=this.media=n.media;this.setPlayerState(this.media.autoplay?bp.STARTING:bp.PRELOADING),Si(r,"waiting",this.onWaiting),Si(r,"play",this.onPlay),Si(r,"playing",this.onPlaying),Si(r,"pause",this.onPause),Si(r,"seeking",this.onSeeking),Si(r,"seeked",this.onSeeked),Si(r,"ratechange",this.onRateChange)}onMediaDetached(){const e=this.media;e&&(pi(e,"waiting",this.onWaiting),pi(e,"play",this.onPlay),pi(e,"playing",this.onPlaying),pi(e,"pause",this.onPause),pi(e,"seeking",this.onSeeking),pi(e,"seeked",this.onSeeked),pi(e,"ratechange",this.onRateChange),this.media=null)}onMediaEnded(e,n){this.setPlayerState(bp.ENDED)}onManifestLoading(e,n){this.initialized=!1,this.starved=!1,this.buffering=!0,this.reporter&&(this.reporter.stop(!0),this.reporter=void 0),this.createReporter(),this.media||this.setPlayerState(bp.PRELOADING)}onError(e,n){n.fatal&&(this.setPlayerState(bp.FATAL_ERROR),this.reporter&&this.reporter.recordEvent(bV.ERROR,{ec:[n.details]}))}onLevelSwitching(e,n){var r;if(!this.reporter)return;const s={br:[n.bitrate/1e3]},i=(r=n.details)==null?void 0:r.fragments[0];i&&(s.ot=this.getObjectType(i,n)),this.reporter.recordEvent(bV.BITRATE_CHANGE,s)}onLevelSwitched(e,n){const r=this.hls.levels[n.level];r&&(this.playheadLevel=r)}setPlayerState(e){this.playerState=e,this.reporter&&this.reporter.update({sta:e})}getStreamType(){const e=this.hls.latestLevelDetails;if(e)return e.live?e.partList&&e.canBlockReload?Tde.LOW_LATENCY:Tde.LIVE:Tde.VOD}apply(e,n={}){var r;if(!this.reporter)return;this.reporter.update({mtp:[this.hls.bandwidthEstimate/1e3],pr:(r=this.media)==null?void 0:r.playbackRate,st:this.getStreamType()});const s=n.ot===Qc.INIT||n.ot===Qc.VIDEO||n.ot===Qc.MUXED;this.starved&&s&&(n.bs=!0,n.su=!0,this.starved=!1),n.su==null&&(n.su=this.buffering);const i=this.reporter.createRequestReport({url:e.url,headers:e.headers},n);e.url=i.url,e.headers=i.headers}getNextFrag(e){var n;const r=(n=this.hls.levels[e.level])==null?void 0:n.details;if(r){const s=e.sn-r.startSN;return r.fragments[s+1]}}getNextPart(e){var n;const{index:r,fragment:s}=e,i=(n=this.hls.levels[s.level])==null||(n=n.details)==null?void 0:n.partList;if(i){const{sn:o}=s;for(let l=i.length-1;l>=0;l--){const c=i[l];if(c.index===r&&c.fragment.sn===o)return i[l+1]}}}getObjectType(e,n){const{type:r}=e;if(r==="subtitle")return Qc.TIMED_TEXT;if(e.sn==="initSegment")return Qc.INIT;if(r==="audio")return Qc.AUDIO;if(r==="main"){if(e.hasStreams){const s=e.elementaryStreams;if(s.audiovideo)return Qc.MUXED;if(s.video)return Qc.VIDEO;if(s.audio)return Qc.AUDIO}if(n){const{audioCodec:s,videoCodec:i}=n;if(!this.hls.audioTracks.length){if(s&&i)return Qc.MUXED;if(s)return Qc.AUDIO}if(i)return Qc.VIDEO}}}getTopBandwidth(){let e=0;const n=this.hls,r=n.maxAutoLevel,s=r>-1?r+1:n.levels.length;return n.levels.slice(0,s).forEach(o=>{o.bitrate>e&&(e=o.bitrate)}),e>0?e:NaN}getLowestBandwidth(){let e=1/0;const n=this.hls,r=n.maxAutoLevel,s=r>-1?r+1:n.levels.length;return n.levels.slice(0,s).forEach(o=>{o.bitrate<e&&(e=o.bitrate)}),xn(e)?e:NaN}getBufferLength(e){if(!this.media)return NaN;const n=e.type==="audio"?this.hls.audioForwardBufferInfo:this.hls.mainForwardBufferInfo;return n?n.len*1e3:NaN}getEventBufferLength(){if(!this.media)return NaN;const e=this.hls.mainForwardBufferInfo,n=this.hls.audioForwardBufferInfo;if(e&&n)return Math.min(e.len,n.len)*1e3;const r=e||n;return r?r.len*1e3:NaN}onBufferInfoChange(e,n){if(!this.reporter)return;const r=this.getEventBufferLength();xn(r)&&this.reporter.update({bl:[r]})}createPlaylistLoader(){const{pLoader:e}=this.config,n=this.applyPlaylistData,r=e||this.config.loader;return class{constructor(i){this.loader=void 0,this.loader=new r(i)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(i,o,l){n(i),this.loader.load(i,o,l)}}}createFragmentLoader(){const{fLoader:e}=this.config,n=this.applyFragmentData,r=this.recordFragmentResponse,s=e||this.config.loader;return class{constructor(o){this.loader=void 0,this.loader=new s(o)}get stats(){return this.loader.stats}get context(){return this.loader.context}destroy(){this.loader.destroy()}abort(){this.loader.abort()}load(o,l,c){n(o);const{onSuccess:d}=c;this.loader.load(o,l,rr(rr({},c),{},{onSuccess:(u,h,m,f)=>{d(u,h,m,f),r(o.url,u,h)}}))}}}}const vnr=3e5;class ynr extends Fm{constructor(e){super("content-steering",e.logger),this.hls=void 0,this.loader=null,this.uri=null,this.pathwayId=".",this._pathwayPriority=null,this.timeToLoad=300,this.reloadTimer=-1,this.updated=0,this.started=!1,this.enabled=!0,this.levels=null,this.audioTracks=null,this.subtitleTracks=null,this.penalizedPathways={},this.hls=e,this.registerListeners()}registerListeners(){const e=this.hls;e.on(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.on(oe.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(oe.MANIFEST_PARSED,this.onManifestParsed,this),e.on(oe.ERROR,this.onError,this)}unregisterListeners(){const e=this.hls;e&&(e.off(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.off(oe.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(oe.MANIFEST_PARSED,this.onManifestParsed,this),e.off(oe.ERROR,this.onError,this))}pathways(){return(this.levels||[]).reduce((e,n)=>(e.indexOf(n.pathwayId)===-1&&e.push(n.pathwayId),e),[])}get pathwayPriority(){return this._pathwayPriority}set pathwayPriority(e){this.updatePathwayPriority(e)}startLoad(){if(this.started=!0,this.clearTimeout(),this.enabled&&this.uri){if(this.updated){const e=this.timeToLoad*1e3-(performance.now()-this.updated);if(e>0){this.scheduleRefresh(this.uri,e);return}}this.loadSteeringManifest(this.uri)}}stopLoad(){this.started=!1,this.loader&&(this.loader.destroy(),this.loader=null),this.clearTimeout()}clearTimeout(){this.reloadTimer!==-1&&(self.clearTimeout(this.reloadTimer),this.reloadTimer=-1)}destroy(){this.unregisterListeners(),this.stopLoad(),this.hls=null,this.levels=this.audioTracks=this.subtitleTracks=null}removeLevel(e){const n=this.levels;n&&(this.levels=n.filter(r=>r!==e))}onManifestLoading(){this.stopLoad(),this.enabled=!0,this.timeToLoad=300,this.updated=0,this.uri=null,this.pathwayId=".",this.levels=this.audioTracks=this.subtitleTracks=null}onManifestLoaded(e,n){const{contentSteering:r}=n;r!==null&&(this.pathwayId=r.pathwayId,this.uri=r.uri,this.started&&this.startLoad())}onManifestParsed(e,n){this.audioTracks=n.audioTracks,this.subtitleTracks=n.subtitleTracks}onError(e,n){const{errorAction:r}=n;if((r==null?void 0:r.action)===od.SendAlternateToPenaltyBox&&r.flags&Ac.MoveAllAlternatesMatchingHost){const s=this.levels;let i=this._pathwayPriority,o=this.pathwayId;if(n.context){const{groupId:l,pathwayId:c,type:d}=n.context;l&&s?o=this.getPathwayForGroupId(l,d,o):c&&(o=c)}o in this.penalizedPathways||(this.penalizedPathways[o]=performance.now()),!i&&s&&(i=this.pathways()),i&&i.length>1&&(this.updatePathwayPriority(i),r.resolved=this.pathwayId!==o,!r.resolved&&(n.details!==rt.BUFFER_APPEND_ERROR||n.fatal)&&this.warn(`Could not resolve ${n.details} ("${n.error.message}") with content-steering for Pathway: ${o} levels: ${s&&s.length} priorities: ${ya(i)} penalized: ${ya(this.penalizedPathways)}`))}}filterParsedLevels(e){this.levels=e;let n=this.getLevelsForPathway(this.pathwayId);if(n.length===0){const r=e[0].pathwayId;this.log(`No levels found in Pathway ${this.pathwayId}. Setting initial Pathway to "${r}"`),n=this.getLevelsForPathway(r),this.pathwayId=r}return n.length!==e.length&&this.log(`Found ${n.length}/${e.length} levels in Pathway "${this.pathwayId}"`),n}getLevelsForPathway(e){return this.levels===null?[]:this.levels.filter(n=>e===n.pathwayId)}updatePathwayPriority(e){this._pathwayPriority=e;let n;const r=this.penalizedPathways,s=performance.now();Object.keys(r).forEach(i=>{s-r[i]>vnr&&delete r[i]});for(let i=0;i<e.length;i++){const o=e[i];if(o in r)continue;if(o===this.pathwayId)return;const l=this.hls.nextLoadLevel,c=this.hls.levels[l];if(n=this.getLevelsForPathway(o),n.length>0){this.log(`Setting Pathway to "${o}"`),this.pathwayId=o,qkt(n),this.hls.trigger(oe.LEVELS_UPDATED,{levels:n});const d=this.hls.levels[l];c&&d&&this.levels&&(d.attrs["STABLE-VARIANT-ID"]!==c.attrs["STABLE-VARIANT-ID"]&&d.bitrate!==c.bitrate&&this.log(`Unstable Pathways change from bitrate ${c.bitrate} to ${d.bitrate}`),this.hls.nextLoadLevel=l);break}}}getPathwayForGroupId(e,n,r){const s=this.getLevelsForPathway(r).concat(this.levels||[]);for(let i=0;i<s.length;i++)if(n===ks.AUDIO_TRACK&&s[i].hasAudioGroup(e)||n===ks.SUBTITLE_TRACK&&s[i].hasSubtitleGroup(e))return s[i].pathwayId;return r}clonePathways(e){const n=this.levels;if(!n)return;const r={},s={};e.forEach(i=>{const{ID:o,"BASE-ID":l,"URI-REPLACEMENT":c}=i;if(n.some(u=>u.pathwayId===o))return;const d=this.getLevelsForPathway(l).map(u=>{const h=new mo(u.attrs);h["PATHWAY-ID"]=o;const m=h.AUDIO&&`${h.AUDIO}_clone_${o}`,f=h.SUBTITLES&&`${h.SUBTITLES}_clone_${o}`;m&&(r[h.AUDIO]=m,h.AUDIO=m),f&&(s[h.SUBTITLES]=f,h.SUBTITLES=f);const p=LSt(u.uri,h["STABLE-VARIANT-ID"],"PER-VARIANT-URIS",c),g=new U6({attrs:h,audioCodec:u.audioCodec,bitrate:u.bitrate,height:u.height,name:u.name,url:p,videoCodec:u.videoCodec,width:u.width});if(u.audioGroups)for(let v=1;v<u.audioGroups.length;v++)g.addGroupId("audio",`${u.audioGroups[v]}_clone_${o}`);if(u.subtitleGroups)for(let v=1;v<u.subtitleGroups.length;v++)g.addGroupId("text",`${u.subtitleGroups[v]}_clone_${o}`);return g});n.push(...d),eze(this.audioTracks,r,c,o),eze(this.subtitleTracks,s,c,o)})}loadSteeringManifest(e){const n=this.hls.config,r=n.loader;this.loader&&this.loader.destroy(),this.loader=new r(n);let s;try{s=new self.URL(e)}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest URI: ${e}`);return}if(s.protocol!=="data:"){const u=(this.hls.bandwidthEstimate||n.abrEwmaDefaultEstimate)|0;sk(s,"_HLS_pathway",this.pathwayId),sk(s,"_HLS_throughput",""+u)}const i={type:ks.STEERING_MANIFEST,responseType:"json",url:s.href},o=n.steeringManifestLoadPolicy.default,l=o.errorRetry||o.timeoutRetry||{},c={loadPolicy:o,timeout:o.maxLoadTimeMs,maxRetry:l.maxNumRetry||0,retryDelay:l.retryDelayMs||0,maxRetryDelay:l.maxRetryDelayMs||0},d={onSuccess:(u,h,m,f)=>{this.log(`Loaded steering manifest: "${s}"`);const p=u.data;if((p==null?void 0:p.VERSION)!==1){this.log(`Steering VERSION ${p.VERSION} not supported!`);return}this.updated=performance.now(),this.timeToLoad=p.TTL;const{"RELOAD-URI":g,"PATHWAY-CLONES":v,"PATHWAY-PRIORITY":b}=p;if(g)try{this.uri=new self.URL(g,s).href}catch{this.enabled=!1,this.log(`Failed to parse Steering Manifest RELOAD-URI: ${g}`);return}this.scheduleRefresh(this.uri||m.url),v&&this.clonePathways(v);const x={steeringManifest:p,url:s.toString()};this.hls.trigger(oe.STEERING_MANIFEST_LOADED,x),b&&this.updatePathwayPriority(b)},onError:(u,h,m,f)=>{if(this.log(`Error loading steering manifest: ${u.code} ${u.text} (${h.url})`),this.stopLoad(),u.code===410){this.enabled=!1,this.log(`Steering manifest ${h.url} no longer available`);return}let p=this.timeToLoad*1e3;if(u.code===429){const g=this.loader;if(typeof(g==null?void 0:g.getResponseHeader)=="function"){const v=g.getResponseHeader("Retry-After");v&&(p=parseFloat(v)*1e3)}this.log(`Steering manifest ${h.url} rate limited`);return}this.scheduleRefresh(this.uri||h.url,p)},onTimeout:(u,h,m)=>{this.log(`Timeout loading steering manifest (${h.url})`),this.scheduleRefresh(this.uri||h.url)}};this.log(`Requesting steering manifest: ${s}`),this.loader.load(i,c,d)}scheduleRefresh(e,n=this.timeToLoad*1e3){this.clearTimeout(),this.reloadTimer=self.setTimeout(()=>{var r;const s=(r=this.hls)==null?void 0:r.media;if(s&&!s.ended){this.loadSteeringManifest(e);return}this.scheduleRefresh(e,this.timeToLoad*1e3)},n)}}function eze(t,e,n,r){t&&Object.keys(e).forEach(s=>{const i=t.filter(o=>o.groupId===s).map(o=>{const l=Mi({},o);return l.details=void 0,l.attrs=new mo(l.attrs),l.url=l.attrs.URI=LSt(o.url,o.attrs["STABLE-RENDITION-ID"],"PER-RENDITION-URIS",n),l.groupId=l.attrs["GROUP-ID"]=e[s],l.attrs["PATHWAY-ID"]=r,l});t.push(...i)})}function LSt(t,e,n,r){if(e){const{[n]:l}=r;if(l){const c=l[e];if(c)return c}}const{HOST:s,PARAMS:i}=r,o=new self.URL(t);return s&&(o.hostname=s),i&&Object.keys(i).sort().forEach(l=>{l&&sk(o,l,i[l])}),o.href}class bnr{constructor(){this.status="initialized",this.requestErrors=[],this.licenseXhr=void 0,this.onmessage=void 0,this.onkeystatuseschange=void 0,this.emitter=new g_e,this.error=void 0,this.ok=void 0}get errored(){return this.error}set errored(e){this.error=e,this.emitter.eventNames().length&&this.emitter.emit("error",e)}get hasListeners(){return this.emitter.eventNames().length>0}get resolved(){return this.ok}resolve(){this.ok=!0,this.emitter.emit("resolved")}get useable(){return this.ok?Promise.resolve():this.error?Promise.reject(this.error):new Promise((e,n)=>{this.emitter.on("error",n),this.emitter.on("resolved",e)})}reset(){this.emitter.removeAllListeners();const e=this.licenseXhr;e&&(e.readyState!==XMLHttpRequest.DONE&&e.abort(),this.licenseXhr=void 0),this.onmessage=this.onkeystatuseschange=void 0}}class Ip extends Error{constructor(e,n){super(n),this.data=void 0,e.error||(e.error=new Error(n)),this.data=e,e.err=e.error}}class sP extends Fm{constructor(e){super("eme",e.logger),this.hls=void 0,this.config=void 0,this.media=null,this.mediaResolved=void 0,this.keyFormatPromise=null,this.keySystemAccessPromises={},this.sessionSetupByUri={},this.mediaKeySessions=[],this.activeKeys={},this.mediaKeys=null,this.setMediaKeysQueue=sP.CDMCleanupPromise?[sP.CDMCleanupPromise]:[],this.onMediaEncrypted=n=>{const{initDataType:r,initData:s}=n,i=`"${n.type}" event: init data type: "${r}"`;if(this.log(i),s!==null){if(!this.keyFormatPromise){let o=Object.keys(this.keySystemAccessPromises);o.length||(o=x3(this.config));const l=o.map(bde).filter(c=>!!c);this.keyFormatPromise=this.getKeyFormatPromise(l)}this.keyFormatPromise.then(o=>{let l;const c=pV(o),d=this.activeLevelKeys();if(c===Xa.FAIRPLAY&&r==="sinf")try{const p=jg(new Uint8Array(s)),g=o_e(JSON.parse(p).sinf),v=gkt(g);if(!v)throw new Error("'schm' box missing or not cbcs/cenc with schi > tenc");l=new Uint8Array(v.subarray(8,24))}catch(p){this.warn(`${i} Failed to parse sinf: ${p}`);return}else if(c===Xa.PLAYREADY)l=f_e(new Uint8Array(s));else if(c===Xa.WIDEVINE){const p=xkt(s).filter(g=>g.systemId===Fkt.WIDEVINE);if(p.length){var u;const g=p[0];l=(u=g.kids)!=null&&u.length?g.kids[0]:null}}let h;if(l){const p=Gl(l);for(let g=0;g<d.length;g++){const v=d[g];if(v.keyId&&(oZ(l,v.keyId)||v.uri.replace(/-/g,"").indexOf(p)!==-1)){v.pssh||(v.scheme=r,v.pssh=new Uint8Array(s),v.keyId=l,Tx.setKeyIdForUri(v.uri,l)),h=this.getSessionForKey(v,"encrypted-event-key-match");break}}}if(!h){if(d.length){var m,f;return(m=d[0]).scheme||(m.scheme=r),(f=d[0]).pssh||(f.pssh=new Uint8Array(s)),this.getSessionForKey(d[0],"encrypted-event-no-match")}if(l)throw new Error(`Key ID ${Gl(l)} not encountered in playlist`);this.log(`Ignoring "${n.type}" event - could not determine keyId`)}return h}).catch(o=>this.handleError(o))}},this.onWaitingForKey=n=>{this.log(`"${n.type}" event`)},this.hls=e,this.config=e.config,this.registerListeners()}destroy(){this.onDestroying(),this.onMediaDetached();const e=this.config;e.requestMediaKeySystemAccessFunc=null,e.licenseXhrSetup=e.licenseResponseCallback=void 0,e.drmSystems=e.drmSystemOptions={},this.hls=this.config=null,this.onMediaEncrypted=this.onWaitingForKey=null}registerListeners(){const{hls:e}=this;e&&(e.on(oe.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(oe.MEDIA_DETACHED,this.onMediaDetached,this),e.on(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.on(oe.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(oe.DESTROYING,this.onDestroying,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(oe.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(oe.MEDIA_DETACHED,this.onMediaDetached,this),e.off(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.off(oe.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(oe.DESTROYING,this.onDestroying,this))}attemptKeySystemAccess(e){if(!this.hls)return Promise.reject(new Error("destroyed"));const n=this.hls.levels,r=(o,l,c)=>!!o&&c.indexOf(o)===l,s=n.map(o=>o.audioCodec).filter(r),i=n.map(o=>o.videoCodec).filter(r);return s.length+i.length===0&&i.push("avc1.42e01e"),new Promise((o,l)=>{const c=d=>{const u=d.shift();this.getMediaKeysPromise(u,s,i).then(h=>o({keySystem:u,mediaKeys:h})).catch(h=>{d.length?c(d):h instanceof Ip?l(h):l(new Ip({type:er.KEY_SYSTEM_ERROR,details:rt.KEY_SYSTEM_NO_ACCESS,error:h,fatal:!0},h.message))})};c(e)})}requestMediaKeySystemAccess(e,n){const{requestMediaKeySystemAccessFunc:r}=this.config;if(typeof r!="function"){let s=`Configured requestMediaKeySystemAccess is not a function ${r}`;return Bkt===null&&self.location.protocol==="http:"&&(s=`navigator.requestMediaKeySystemAccess is not available over insecure protocol ${location.protocol}`),Promise.reject(new Error(s))}return r(e,n)}getMediaKeysPromise(e,n,r){var s;const i=BXn(e,n,r,this.config.drmSystemOptions||{});let o=this.keySystemAccessPromises[e],l=(s=o)==null?void 0:s.keySystemAccess;if(!l){this.log(`Requesting encrypted media "${e}" key-system access with config: ${ya(i)}`),l=this.requestMediaKeySystemAccess(e,i);const c=o=this.keySystemAccessPromises[e]={keySystemAccess:l};return l.catch(d=>{this.log(`Failed to obtain access to key-system "${e}": ${d}`)}),l.then(d=>{this.throwIfDestroyed(),this.log(`Access for key-system "${d.keySystem}" obtained`);const u=this.fetchServerCertificate(e);this.log(`Create media-keys for "${e}"`);const h=c.mediaKeys=d.createMediaKeys().then(m=>(this.log(`Media-keys created for "${e}"`),c.hasMediaKeys=!0,u.then(f=>f?this.setMediaKeysServerCertificate(m,e,f):m)));return h.catch(m=>{this.error(`Failed to create media-keys for "${e}"}: ${m}`)}),h})}return l.then(()=>o.mediaKeys)}getMediaKeySessionContext(e,n,r,s){const{mediaKeySessions:i}=this,o=` key-session "${e}" keyId: ${Gl(r.keyId||[])} keyUri: ${r.uri} for "${s}"`;for(let d=0;d<i.length;d++){const u=i[d];if(!u.initialized&&u.createdFor.levelKey.uri===r.uri)return this.log(`Reusing${o}`),u}this.log(`Creating${o}`);const l=n.createSession(),c={keySystem:e,mediaKeys:n,mediaKeysSession:l,keyRequests:{},keyStatuses:{},createdFor:{levelKey:r,reason:s},initialized:!1};return i.push(c),c}resetMediaKeys(){var e;const n=(e=this.mediaKeySessions[0])==null?void 0:e.keySystem,r=this.keySystemAccessPromises[n];r&&(this.log("reset mediaKeys"),this.mediaKeys=null,r.hasMediaKeys=!1,delete r.mediaKeys,delete this.keySystemAccessPromises[n])}updateKeySession(e,n,r){const s=e.mediaKeysSession;return this.log(`Updating key-session "${s.sessionId}" for keyId ${Gl(n.keyId||[])}
      } (data length: ${r.byteLength})`),s.update(r)}getSelectedKeySystemFormats(){return Object.keys(this.keySystemAccessPromises).map(e=>({keySystem:e,hasMediaKeys:this.keySystemAccessPromises[e].hasMediaKeys})).filter(({hasMediaKeys:e})=>!!e).map(({keySystem:e})=>bde(e)).filter(e=>!!e)}getKeySystemAccess(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:n,mediaKeys:r})=>this.attemptSetMediaKeys(n,r))}selectKeySystem(e){return this.getKeySystemSelectionPromise(e).then(({keySystem:n})=>{const r=bde(n);if(!r)throw new Error(`Unable to find format for key-system "${n}"`);return r})}selectKeySystemFormat(e){const n=Object.keys(e.levelkeys||{});return this.keyFormatPromise||(this.log(`Selecting key-system from fragment (sn: ${e.sn} ${e.type}: ${e.level}) key formats ${n.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(n)),this.keyFormatPromise}getKeyFormatPromise(e){const n=x3(this.config),r=e.map(pV).filter(s=>!!s&&n.indexOf(s)!==-1);return this.selectKeySystem(r)}loadClear(e,n,r){if(this.config.emeEnabled&&!this.getSelectedKeySystemFormats().length){if(n.length)for(let s=0,i=n.length;s<i;s++){const o=n[s];if(e.cc<=o.cc&&(!Oo(e)||!Oo(o)||e.sn<o.sn)||!r&&s==i-1)return this.selectKeySystemFormat(o).then(l=>{if(!this.hls)return;o.setKeyFormat(l);const c=pV(l);if(c)return this.getKeySystemAccess([c])})}if(this.config.requireKeySystemAccessOnStart){const s=x3(this.config);if(s.length)return this.getKeySystemAccess(s)}}return null}getKeyStatus(e){const{mediaKeySessions:n}=this;for(let r=0;r<n.length;r++){const s=_de(e,n[r]);if(s)return s}}loadKey(e){const n=e.decryptdata,r=this.getKeyStatus(n);if(r==="internal-error"){const l=tze(r,n);return l.data.frag=e,this.error(`${l.message} (${Gl(n.keyId||[])})`),Promise.reject(l)}const s=e.type,i=this.activeKeys,o=i[s];o&&!n.matches(o.decryptdata)&&(i.previous||(i.previous=[]),i.previous.push(o),delete i[s]),i[s]||(i[s]=e);for(let l=this.mediaKeySessions.length;l--;){const c=this.mediaKeySessions[l];if(n.keyId&&c.keyStatuses[Gl(n.keyId)]==="expired")return this.renewKeySession(n,c)}return this.updateUsablePromise(n,"playlist-key",e)}renewKeySession(e,n){return this.resetMediaKeys(),this.removeSession(n).then(()=>(this.throwIfDestroyed(),this.updateUsablePromise(e,"expired")))}updateUsablePromise(e,n,r){const s=this.getSessionForKey(e,n);return s.catch(i=>this.handleError(i,r)),s.then(i=>e)}getSessionForKey(e,n){const r=this.findContextForKey(e);if(r!==void 0)return Promise.resolve(r);const s=e.uri,i=this.sessionSetupByUri[s];let o;i===void 0?o=this.resolveSessionForKey(e,n):o=i.catch(()=>{}).then(()=>(this.throwIfDestroyed(),this.resolveSessionForKey(e,n))),this.sessionSetupByUri[s]=o;const l=()=>{this.sessionSetupByUri[s]===o&&delete this.sessionSetupByUri[s]};return o.then(l,l),o}findContextForKey(e){const{mediaKeySessions:n}=this;for(let r=n.length;r--;){const s=n[r];if(_de(e,s))return s}}resolveSessionForKey(e,n){return this.getKeySystemForKeyPromise(e).then(({keySystem:r,mediaKeys:s})=>{this.throwIfDestroyed();for(let i=this.mediaKeySessions.length;i--;){const o=this.mediaKeySessions[i];if(_de(e,o))return o;const l=this.getUsableKeyPromise(o,e,n);if(l)return l}return this.attemptSetMediaKeys(r,s).then(()=>(this.throwIfDestroyed(),this.getMediaKeySessionContext(r,s,e,n))).then(i=>{this.throwIfDestroyed();const o=e.scheme||"cenc",l=e.pssh?e.pssh.buffer:null;return this.generateRequestWithPreferredKeySession(i,e,o,l,n)})})}getUsableKeyPromise(e,n,r){const s=e.keyRequests[n.uri];if(s)return this.log(`Waiting for usable key (${r} keyId: ${knr(n)} format: "${n.keyFormat}" URI: ${n.uri})`),s.useable.then(()=>e)}throwIfDestroyed(e="Invalid state"){if(!this.hls)throw new Error("invalid state")}handleError(e,n){if(this.hls)if(e instanceof Ip){n&&(e.data.frag=n);const r=e.data.decryptdata;this.error(`${e.message}${r?` (${Gl(r.keyId||[])})`:""}`),this.hls.trigger(oe.ERROR,e.data)}else this.error(e.message),this.hls.trigger(oe.ERROR,{type:er.KEY_SYSTEM_ERROR,details:rt.KEY_SYSTEM_NO_KEYS,error:e,fatal:!0})}getKeySystemForKeyPromise(e){const n=pV(e.keyFormat),r=n?[n]:x3(this.config);return this.attemptKeySystemAccess(r)}getKeySystemSelectionPromise(e){if(e.length||(e=x3(this.config)),e.length===0)throw new Ip({type:er.KEY_SYSTEM_ERROR,details:rt.KEY_SYSTEM_NO_CONFIGURED_LICENSE,fatal:!0},`Missing key-system license configuration options ${ya({drmSystems:this.config.drmSystems})}`);return this.attemptKeySystemAccess(e)}activeLevelKeys(){const e=this.activeKeys,n=(e.previous||[]).map(r=>r.decryptdata);return e.audio&&n.unshift(e.audio.decryptdata),e.main&&n.unshift(e.main.decryptdata),n}attemptSetMediaKeys(e,n){if(this.mediaResolved=void 0,this.mediaKeys===n)return Promise.resolve();const r=this.setMediaKeysQueue.slice();this.log(`Setting media-keys for "${e}"`);const s=Promise.all(r).then(()=>this.media?this.media.setMediaKeys(n):new Promise((i,o)=>{this.mediaResolved=()=>{if(this.mediaResolved=void 0,!this.media)return o(new Error("Attempted to set mediaKeys without media element attached"));this.mediaKeys=n,this.media.setMediaKeys(n).then(i).catch(o)}}));return this.mediaKeys=n,this.setMediaKeysQueue.push(s),s.then(()=>{this.log(`Media-keys set for "${e}"`),r.push(s),this.setMediaKeysQueue=this.setMediaKeysQueue.filter(i=>r.indexOf(i)===-1)})}filterInitData(e,n,r,s,i){var o;const l=(o=this.config.drmSystems)==null||(o=o[e.keySystem])==null?void 0:o.generateRequest;if(l)try{const d=l.call(this.hls,r,s,Mi({},e,{decryptdata:n,reason:i}),i);if(!d)throw new Error("Invalid response from configured generateRequest filter");n.scheme=d.initDataType?d.initDataType:"cenc";const u=d.initData?d.initData:null;return n.pssh=u?new Uint8Array(u):null,d}catch(d){var c;if(this.warn(d.message),(c=this.hls)!=null&&c.config.debug)throw d}return{initDataType:r,initData:s}}generateRequestWithPreferredKeySession(e,n,r,s,i){const o=this.getUsableKeyPromise(e,n,i);if(o)return o;const l=this.filterInitData(e,n,r,s,i);if(l&&(s=l.initData?l.initData:null,r=l.initDataType),s===null)return i.startsWith("encrypted-event")?Promise.reject(new Error(`missing initialization data for "${i}"`)):(this.log(`Skipping key-session request for "${i}" (no initData)`),Promise.resolve(e));const c=n.uri,d=new bnr;e.keyRequests[c]=d;const u=m=>{const f=e.mediaKeysSession;if(!f){const v=new Error("invalid state");d.errored=v;return}const{messageType:p,message:g}=m;d.status=p,this.log(`"${p}" message event for session "${f.sessionId}" message size: ${g.byteLength}`),p==="license-request"||p==="license-renewal"?this.renewLicense(e,n,g).catch(v=>{d.errored=v,d.hasListeners||this.handleError(v),this.removeSession(e)}):p==="license-release"?e.keySystem===Xa.FAIRPLAY&&this.updateKeySession(e,n,ixe("acknowledged")).then(()=>this.removeSession(e)).catch(v=>this.handleError(v)):this.warn(`unhandled media key message type "${p}"`)};return d.onmessage=u,Si(e.mediaKeysSession,"message",u),this.generateRequest(e,n,r,s,i,!1)}generateRequest(e,n,r,s,i,o){if(o){const f=this.filterInitData(e,n,r,s,i);f&&(s=f.initData?f.initData:s,r=f.initDataType)}const l=n.uri,c=e.keyRequests[l],d=Gl(n.keyId||[]),u=f=>{let p;f.startsWith("usable")?c.resolve():f==="internal-error"||f==="output-restricted"||f==="output-downscaled"?p=tze(f,n):f==="expired"?p=new Error(`key expired (keyId: ${d})`):f==="released"?p=new Error("key released"):f==="status-pending"||this.warn(`unhandled key status change "${f}" (keyId: ${d})`),p&&(c.errored=p,c.hasListeners||this.handleError(p))},h=f=>{if(!e.mediaKeysSession){const S=new Error("invalid state");c.errored=S;return}const g=e.keyStatuses=this.getKeyStatuses(e);if(!Object.keys(g).some(S=>g[S]!=="status-pending"))return;const b=this.activeLevelKeys();for(let S=0;S<b.length;S++){const C=Gl(b[S].keyId||[]);if(g[C]==="expired"){var x;this.log(`Expired key ${ya(g)} in key-session "${(x=e.mediaKeysSession)==null?void 0:x.sessionId}"`),this.renewKeySession(n,e).catch(j=>this.handleError(j));break}}let w=g[d];if(w)u(w);else{var k;e.keyStatusTimeouts||(e.keyStatusTimeouts={}),(k=e.keyStatusTimeouts)[d]||(k[d]=self.setTimeout(()=>{var C;if(!e.mediaKeysSession)return;const j=this.getKeyStatus(n);if(j&&j!=="status-pending"){var E;return this.log(`No status for keyId ${d} in key-session "${(E=e.mediaKeysSession)==null?void 0:E.sessionId}". Using session key-status ${j} from other session.`),u(j)}this.log(`key status for ${d} in key-session "${(C=e.mediaKeysSession)==null?void 0:C.sessionId}" timed out after 1000ms`),w="internal-error",u(w)},1e3)),this.log(`No status for keyId ${d} (${ya(g)}).`)}};c.onkeystatuseschange=h,Si(e.mediaKeysSession,"keystatuseschange",h);const m=c.useable;return this.log(`Generating key-session request for "${i}" keyId: ${d} URI: ${l} (init data type: ${r} length: ${s.byteLength})`),c.status="started",e.initialized=!0,e.mediaKeysSession.generateRequest(r,s).then(()=>{var f;c.status="generated",this.log(`Request generated for key-session "${(f=e.mediaKeysSession)==null?void 0:f.sessionId}" keyId: ${d} URI: ${l}`)}).catch(f=>{throw this.log(`mediaKeysSession.generateRequest failed: ${f}`),new Ip({type:er.KEY_SYSTEM_ERROR,details:rt.KEY_SYSTEM_NO_SESSION,error:f,decryptdata:n,fatal:!1},`Error generating key-session request: ${f}`)}).then(()=>m).catch(f=>{var p;this.log(`mediaKeysSession.generateRequest failed: ${f}`);const g=(p=f.data)==null?void 0:p.details;return(g===rt.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED||g===rt.KEY_SYSTEM_STATUS_INTERNAL_ERROR)&&Object.keys(e.keyStatuses).some(v=>e.keyStatuses[v]==="usable")?(this.handleError(f),e):this.removeSession(e).then(()=>{throw f})}).then(()=>e)}getKeyStatuses(e){const n={},r=e.mediaKeysSession.sessionId;return e.mediaKeysSession.keyStatuses.forEach((s,i)=>{if(typeof i=="string"&&typeof s=="object"){const c=i;i=s,s=c}const o="buffer"in i?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):new Uint8Array(i);if(e.keySystem===Xa.PLAYREADY&&o.length===16){const c=Gl(o);n[c]=s,$kt(o)}const l=Gl(o);this.log(`key status change "${s}" for keyStatuses keyId: ${l} key-session "${r}"`),n[l]=s}),n}fetchServerCertificate(e){const n=this.config,r=n.loader,s=new r(n),i=wnr(e,n);return i?(this.log(`Fetching server certificate for "${e}"`),new Promise((o,l)=>{const c={type:ks.SERVER_CERTIFICATE,responseType:"arraybuffer",url:i},d=n.certLoadPolicy.default,u={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(m,f,p,g)=>{o(m.data)},onError:(m,f,p,g)=>{l(new Ip({type:er.KEY_SYSTEM_ERROR,details:rt.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:p,response:rr({url:c.url,data:void 0},m)},`"${e}" certificate request failed (${i}). Status: ${m.code} (${m.text})`))},onTimeout:(m,f,p)=>{l(new Ip({type:er.KEY_SYSTEM_ERROR,details:rt.KEY_SYSTEM_SERVER_CERTIFICATE_REQUEST_FAILED,fatal:!0,networkDetails:p,response:{url:c.url,data:void 0}},`"${e}" certificate request timed out (${i})`))},onAbort:(m,f,p)=>{l(new Error("aborted"))}};s.load(c,u,h)})):(this.log(`No Server Certificate in config.drmSystems["${e}"]`),Promise.resolve())}setMediaKeysServerCertificate(e,n,r){return new Promise((s,i)=>{e.setServerCertificate(r).then(o=>{this.log(`setServerCertificate ${o?"success":"not supported by CDM"} (${r.byteLength}) on "${n}"`),s(e)}).catch(o=>{i(new Ip({type:er.KEY_SYSTEM_ERROR,details:rt.KEY_SYSTEM_SERVER_CERTIFICATE_UPDATE_FAILED,error:o,fatal:!0},o.message))})})}renewLicense(e,n,r){return this.requestLicense(e,n,new Uint8Array(r)).then(s=>this.updateKeySession(e,n,new Uint8Array(s)).catch(i=>{throw new Ip({type:er.KEY_SYSTEM_ERROR,details:rt.KEY_SYSTEM_SESSION_UPDATE_FAILED,decryptdata:n,error:i,fatal:!1},i.message)}))}unpackPlayReadyKeyMessage(e,n){const r=jg(new Uint16Array(n.buffer));if(!r.includes("PlayReadyKeyMessage"))return e.setRequestHeader("Content-Type","text/xml; charset=utf-8"),n;const s=new DOMParser().parseFromString(r,"application/xml"),i=s.querySelectorAll("HttpHeader");if(i.length>0){let u;for(let h=0,m=i.length;h<m;h++){var o,l;u=i[h];const f=(o=u.querySelector("name"))==null?void 0:o.textContent,p=(l=u.querySelector("value"))==null?void 0:l.textContent;f&&p&&e.setRequestHeader(f,p)}}const c=s.querySelector("Challenge"),d=c==null?void 0:c.textContent;if(!d)throw new Error("Cannot find <Challenge> in key message");return ixe(atob(d))}setupLicenseXHR(e,n,r,s,i){const o=this.config.licenseXhrSetup;return o?Promise.resolve().then(()=>(this.throwIfDestroyed(),o.call(this.hls,e,n,rr(rr({},r),{},{decryptdata:s}),i))).catch(l=>{if(!r.mediaKeysSession)throw l;return e.open("POST",n,!0),o.call(this.hls,e,n,rr(rr({},r),{},{decryptdata:s}),i)}).then(l=>(e.readyState||e.open("POST",n,!0),{xhr:e,licenseChallenge:l||i})):(e.open("POST",n,!0),Promise.resolve({xhr:e,licenseChallenge:i}))}requestLicense(e,n,r){return new Promise((s,i)=>{const o=xnr(e.keySystem,this.config);if(!o)return i(new Error(`no license server URL configured for key-system "${e.keySystem}"`));const l=e.keyRequests[n.uri];if(!l)return i(new Error("License emitter removed"));this.log(`Sending license request to URL: ${o}`);const c=this.config.keyLoadPolicy.default,d=new XMLHttpRequest;d.responseType="arraybuffer",d.onreadystatechange=()=>{if(!this.hls||!e.mediaKeysSession)return i(new Error("invalid state"));if(d.readyState===4)if(d.status===200){l.requestErrors=[];let u=d.response;this.log(`License received ${u instanceof ArrayBuffer?u.byteLength:u}`);const h=this.config.licenseResponseCallback;if(h)try{u=h.call(this.hls,d,o,rr(rr({},e),{},{decryptdata:n}))}catch(m){this.error(m)}s(u)}else{const u=c.errorRetry,h=u?u.maxNumRetry:0;if(l.requestErrors.push({status:d.status,message:d.statusText}),l.requestErrors.length>h||d.status>=400&&d.status<500)i(new Ip({type:er.KEY_SYSTEM_ERROR,details:rt.KEY_SYSTEM_LICENSE_REQUEST_FAILED,decryptdata:n,fatal:!0,networkDetails:d,response:{url:o,data:void 0,code:d.status,text:d.statusText}},`License Request XHR failed (${o}). Status: ${d.status} (${d.statusText})`));else{const m=h-l.requestErrors.length;this.warn(`Retrying license request, ${m} attempts left`),this.requestLicense(e,n,r).then(s,i)}}},l.licenseXhr&&l.licenseXhr.readyState!==XMLHttpRequest.DONE&&l.licenseXhr.abort(),l.licenseXhr=d,this.setupLicenseXHR(d,o,e,n,r).then(({xhr:u,licenseChallenge:h})=>{e.keySystem==Xa.PLAYREADY&&(h=this.unpackPlayReadyKeyMessage(u,h)),u.send(h)}).catch(i)})}onDestroying(){this.unregisterListeners(),this._clear()}onMediaAttached(e,n){if(!this.config.emeEnabled)return;const r=n.media;this.media=r,Si(r,"encrypted",this.onMediaEncrypted),Si(r,"waitingforkey",this.onWaitingForKey);const s=this.mediaResolved;s?s():this.mediaKeys=r.mediaKeys}onMediaDetached(){const e=this.media;e&&(pi(e,"encrypted",this.onMediaEncrypted),pi(e,"waitingforkey",this.onWaitingForKey),this.media=null,this.mediaKeys=null)}_clear(){var e;this.keyFormatPromise=null,this.keySystemAccessPromises={},this.activeKeys={},this.sessionSetupByUri={};const n=this.mediaResolved;if(n&&n(),!this.mediaKeys&&!this.mediaKeySessions.length)return;const r=this.media,s=this.mediaKeySessions.slice();this.mediaKeySessions=[],this.mediaKeys=null,Tx.clearKeyUriToKeyIdMap();const i=s.length;sP.CDMCleanupPromise=Promise.all(s.map(o=>this.removeSession(o)).concat((r==null||(e=r.setMediaKeys(null))==null?void 0:e.catch(o=>{this.log(`Could not clear media keys: ${o}`),this.hls&&this.hls.trigger(oe.ERROR,{type:er.OTHER_ERROR,details:rt.KEY_SYSTEM_DESTROY_MEDIA_KEYS_ERROR,fatal:!1,error:new Error(`Could not clear media keys: ${o}`)})}))||Promise.resolve())).catch(o=>{this.log(`Could not close sessions and clear media keys: ${o}`),this.hls&&this.hls.trigger(oe.ERROR,{type:er.OTHER_ERROR,details:rt.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close sessions and clear media keys: ${o}`)})}).then(()=>{i&&this.log("finished closing key sessions and clearing media keys")})}onManifestLoading(){this._clear(),this.keyFormatPromise=null}onManifestLoaded(e,{sessionKeys:n}){if(!(!n||!this.config.emeEnabled)&&!this.keyFormatPromise){const r=n.reduce((s,i)=>(s.indexOf(i.keyFormat)===-1&&s.push(i.keyFormat),s),[]);this.log(`Selecting key-system from session-keys ${r.join(", ")}`),this.keyFormatPromise=this.getKeyFormatPromise(r),this.keyFormatPromise.catch(()=>{})}}removeSession(e){const{mediaKeysSession:n}=e;if(n){this.log(`Remove licenses and keys and close session "${n.sessionId}"`),Object.keys(e.keyRequests).forEach(l=>{const c=e.keyRequests[l];c.onmessage&&n.removeEventListener("message",c.onmessage),c.onkeystatuseschange&&n.removeEventListener("keystatuseschange",c.onkeystatuseschange),c.reset(),e.keyRequests[l]=void 0}),e.mediaKeysSession=void 0;const r=this.mediaKeySessions.indexOf(e);r>-1&&this.mediaKeySessions.splice(r,1);const{keyStatusTimeouts:s}=e;s&&Object.keys(s).forEach(l=>self.clearTimeout(s[l]));const{drmSystemOptions:i}=this.config;return(zXn(i)?new Promise((l,c)=>{self.setTimeout(()=>c(new Error("MediaKeySession.remove() timeout")),8e3),n.remove().then(l).catch(c)}):Promise.resolve()).catch(l=>{this.log(`Could not remove session: ${l}`),this.hls&&this.hls.trigger(oe.ERROR,{type:er.OTHER_ERROR,details:rt.KEY_SYSTEM_DESTROY_REMOVE_SESSION_ERROR,fatal:!1,error:new Error(`Could not remove session: ${l}`)})}).then(()=>n.close()).then(()=>n.closed).catch(l=>{this.log(`Could not close session: ${l}`),this.hls&&this.hls.trigger(oe.ERROR,{type:er.OTHER_ERROR,details:rt.KEY_SYSTEM_DESTROY_CLOSE_SESSION_ERROR,fatal:!1,error:new Error(`Could not close session: ${l}`)})})}return Promise.resolve()}}sP.CDMCleanupPromise=void 0;function xnr(t,e){const{drmSystems:n,widevineLicenseUrl:r}=e,s=n==null?void 0:n[t];if(s)return s.licenseUrl;if(t===Xa.WIDEVINE&&r)return r}function wnr(t,e){const{drmSystems:n}=e,r=n==null?void 0:n[t];if(r)return r.serverCertificateUrl}function knr(t){if(t.keyFormat===md.FAIRPLAY)return t.uri;if(t.keyId===null)throw new Error("keyId is null");return Gl(t.keyId)}function _de(t,e){const n=t.keyId,r=e.mediaKeysSession;if(n&&r){const s=e.mediaKeysSession.keyStatuses;if(s.size)return s.has(n)?s.get(n):e.keyStatuses[Gl(n)]}}function tze(t,e){const n=t==="output-restricted",r=n?rt.KEY_SYSTEM_STATUS_OUTPUT_RESTRICTED:rt.KEY_SYSTEM_STATUS_INTERNAL_ERROR;return new Ip({type:er.KEY_SYSTEM_ERROR,details:r,fatal:!1,decryptdata:e},n?"HDCP level output restricted":`key status changed to "${t}"`)}class Snr{constructor(e){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=e,this.registerListeners()}setStreamController(e){this.streamController=e}registerListeners(){this.hls.on(oe.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.on(oe.MEDIA_DETACHING,this.onMediaDetaching,this)}unregisterListeners(){this.hls.off(oe.MEDIA_ATTACHING,this.onMediaAttaching,this),this.hls.off(oe.MEDIA_DETACHING,this.onMediaDetaching,this)}destroy(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null}onMediaAttaching(e,n){const r=this.hls.config;if(r.capLevelOnFPSDrop){const s=n.media instanceof self.HTMLVideoElement?n.media:null;this.media=s,s&&typeof s.getVideoPlaybackQuality=="function"&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),r.fpsDroppedMonitoringPeriod)}}onMediaDetaching(){this.media=null}checkFPS(e,n,r){const s=performance.now();if(n){if(this.lastTime){const i=s-this.lastTime,o=r-this.lastDroppedFrames,l=n-this.lastDecodedFrames,c=1e3*o/i,d=this.hls;if(d.trigger(oe.FPS_DROP,{currentDropped:o,currentDecoded:l,totalDroppedFrames:r}),c>0&&o>d.config.fpsDroppedMonitoringThreshold*l){let u=d.currentLevel;d.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(d.autoLevelCapping===-1||d.autoLevelCapping>=u)&&(u=u-1,d.trigger(oe.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:d.currentLevel}),d.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=s,this.lastDroppedFrames=r,this.lastDecodedFrames=n}}checkFPSInterval(){const e=this.media;if(e)if(this.isVideoPlaybackQualityAvailable){const n=e.getVideoPlaybackQuality();this.checkFPS(e,n.totalVideoFrames,n.droppedVideoFrames)}else this.checkFPS(e,e.webkitDecodedFrameCount,e.webkitDroppedFrameCount)}}var __e=function(){if(lZ!=null&&lZ.VTTCue)return self.VTTCue;const t=["","lr","rl"],e=["start","middle","end","left","right"];function n(l,c){if(typeof c!="string"||!Array.isArray(l))return!1;const d=c.toLowerCase();return~l.indexOf(d)?d:!1}function r(l){return n(t,l)}function s(l){return n(e,l)}function i(l,...c){let d=1;for(;d<arguments.length;d++){const u=arguments[d];for(const h in u)l[h]=u[h]}return l}function o(l,c,d){const u=this,h={enumerable:!0};u.hasBeenReset=!1;let m="",f=!1,p=l,g=c,v=d,b=null,x="",w=!0,k="auto",S="start",C=50,j="middle",E=50,N="middle";Object.defineProperty(u,"id",i({},h,{get:function(){return m},set:function(A){m=""+A}})),Object.defineProperty(u,"pauseOnExit",i({},h,{get:function(){return f},set:function(A){f=!!A}})),Object.defineProperty(u,"startTime",i({},h,{get:function(){return p},set:function(A){if(typeof A!="number")throw new TypeError("Start time must be set to a number.");p=A,this.hasBeenReset=!0}})),Object.defineProperty(u,"endTime",i({},h,{get:function(){return g},set:function(A){if(typeof A!="number")throw new TypeError("End time must be set to a number.");g=A,this.hasBeenReset=!0}})),Object.defineProperty(u,"text",i({},h,{get:function(){return v},set:function(A){v=""+A,this.hasBeenReset=!0}})),Object.defineProperty(u,"region",i({},h,{get:function(){return b},set:function(A){b=A,this.hasBeenReset=!0}})),Object.defineProperty(u,"vertical",i({},h,{get:function(){return x},set:function(A){const _=r(A);if(_===!1)throw new SyntaxError("An invalid or illegal string was specified.");x=_,this.hasBeenReset=!0}})),Object.defineProperty(u,"snapToLines",i({},h,{get:function(){return w},set:function(A){w=!!A,this.hasBeenReset=!0}})),Object.defineProperty(u,"line",i({},h,{get:function(){return k},set:function(A){if(typeof A!="number"&&A!=="auto")throw new SyntaxError("An invalid number or illegal string was specified.");k=A,this.hasBeenReset=!0}})),Object.defineProperty(u,"lineAlign",i({},h,{get:function(){return S},set:function(A){const _=s(A);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");S=_,this.hasBeenReset=!0}})),Object.defineProperty(u,"position",i({},h,{get:function(){return C},set:function(A){if(A<0||A>100)throw new Error("Position must be between 0 and 100.");C=A,this.hasBeenReset=!0}})),Object.defineProperty(u,"positionAlign",i({},h,{get:function(){return j},set:function(A){const _=s(A);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");j=_,this.hasBeenReset=!0}})),Object.defineProperty(u,"size",i({},h,{get:function(){return E},set:function(A){if(A<0||A>100)throw new Error("Size must be between 0 and 100.");E=A,this.hasBeenReset=!0}})),Object.defineProperty(u,"align",i({},h,{get:function(){return N},set:function(A){const _=s(A);if(!_)throw new SyntaxError("An invalid or illegal string was specified.");N=_,this.hasBeenReset=!0}})),u.displayState=void 0}return o.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},o}();class Cnr{decode(e,n){if(!e)return"";if(typeof e!="string")throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(e))}}function DSt(t){function e(r,s,i,o){return(r|0)*3600+(s|0)*60+(i|0)+parseFloat(o||0)}const n=t.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return n?parseFloat(n[2])>59?e(n[2],n[3],0,n[4]):e(n[1],n[2],n[3],n[4]):null}class jnr{constructor(){this.values=Object.create(null)}set(e,n){!this.get(e)&&n!==""&&(this.values[e]=n)}get(e,n,r){return r?this.has(e)?this.values[e]:n[r]:this.has(e)?this.values[e]:n}has(e){return e in this.values}alt(e,n,r){for(let s=0;s<r.length;++s)if(n===r[s]){this.set(e,n);break}}integer(e,n){/^-?\d+$/.test(n)&&this.set(e,parseInt(n,10))}percent(e,n){if(/^([\d]{1,3})(\.[\d]*)?%$/.test(n)){const r=parseFloat(n);if(r>=0&&r<=100)return this.set(e,r),!0}return!1}}function $St(t,e,n,r){const s=r?t.split(r):[t];for(const i in s){if(typeof s[i]!="string")continue;const o=s[i].split(n);if(o.length!==2)continue;const l=o[0],c=o[1];e(l,c)}}const fxe=new __e(0,0,""),xV=fxe.align==="middle"?"middle":"center";function Enr(t,e,n){const r=t;function s(){const l=DSt(t);if(l===null)throw new Error("Malformed timestamp: "+r);return t=t.replace(/^[^\sa-zA-Z-]+/,""),l}function i(l,c){const d=new jnr;$St(l,function(m,f){let p;switch(m){case"region":for(let g=n.length-1;g>=0;g--)if(n[g].id===f){d.set(m,n[g].region);break}break;case"vertical":d.alt(m,f,["rl","lr"]);break;case"line":p=f.split(","),d.integer(m,p[0]),d.percent(m,p[0])&&d.set("snapToLines",!1),d.alt(m,p[0],["auto"]),p.length===2&&d.alt("lineAlign",p[1],["start",xV,"end"]);break;case"position":p=f.split(","),d.percent(m,p[0]),p.length===2&&d.alt("positionAlign",p[1],["start",xV,"end","line-left","line-right","auto"]);break;case"size":d.percent(m,f);break;case"align":d.alt(m,f,["start",xV,"end","left","right"]);break}},/:/,/\s/),c.region=d.get("region",null),c.vertical=d.get("vertical","");let u=d.get("line","auto");u==="auto"&&fxe.line===-1&&(u=-1),c.line=u,c.lineAlign=d.get("lineAlign","start"),c.snapToLines=d.get("snapToLines",!0),c.size=d.get("size",100),c.align=d.get("align",xV);let h=d.get("position","auto");h==="auto"&&fxe.position===50&&(h=c.align==="start"||c.align==="left"?0:c.align==="end"||c.align==="right"?100:50),c.position=h}function o(){t=t.replace(/^\s+/,"")}if(o(),e.startTime=s(),o(),t.slice(0,3)!=="-->")throw new Error("Malformed time stamp (time stamps must be separated by '-->'): "+r);t=t.slice(3),o(),e.endTime=s(),o(),i(t,e)}function OSt(t){return t.replace(/<br(?: \/)?>/gi,`
`)}class Nnr{constructor(){this.state="INITIAL",this.buffer="",this.decoder=new Cnr,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}parse(e){const n=this;e&&(n.buffer+=n.decoder.decode(e,{stream:!0}));function r(){let i=n.buffer,o=0;for(i=OSt(i);o<i.length&&i[o]!=="\r"&&i[o]!==`
`;)++o;const l=i.slice(0,o);return i[o]==="\r"&&++o,i[o]===`
`&&++o,n.buffer=i.slice(o),l}function s(i){$St(i,function(o,l){},/:/)}try{let i="";if(n.state==="INITIAL"){if(!/\r\n|\n/.test(n.buffer))return this;i=r();const l=i.match(/^(ï»¿)?WEBVTT([ \t].*)?$/);if(!(l!=null&&l[0]))throw new Error("Malformed WebVTT signature.");n.state="HEADER"}let o=!1;for(;n.buffer;){if(!/\r\n|\n/.test(n.buffer))return this;switch(o?o=!1:i=r(),n.state){case"HEADER":/:/.test(i)?s(i):i||(n.state="ID");continue;case"NOTE":i||(n.state="ID");continue;case"ID":if(/^NOTE($|[ \t])/.test(i)){n.state="NOTE";break}if(!i)continue;if(n.cue=new __e(0,0,""),n.state="CUE",i.indexOf("-->")===-1){n.cue.id=i;continue}case"CUE":if(!n.cue){n.state="BADCUE";continue}try{Enr(i,n.cue,n.regionList)}catch{n.cue=null,n.state="BADCUE";continue}n.state="CUETEXT";continue;case"CUETEXT":{const l=i.indexOf("-->")!==-1;if(!i||l&&(o=!0)){n.oncue&&n.cue&&n.oncue(n.cue),n.cue=null,n.state="ID";continue}if(n.cue===null)continue;n.cue.text&&(n.cue.text+=`
`),n.cue.text+=i}continue;case"BADCUE":i||(n.state="ID")}}}catch{n.state==="CUETEXT"&&n.cue&&n.oncue&&n.oncue(n.cue),n.cue=null,n.state=n.state==="INITIAL"?"BADWEBVTT":"BADCUE"}return this}flush(){const e=this;try{if((e.cue||e.state==="HEADER")&&(e.buffer+=`

`,e.parse()),e.state==="INITIAL"||e.state==="BADWEBVTT")throw new Error("Malformed WebVTT signature.")}catch(n){e.onparsingerror&&e.onparsingerror(n)}return e.onflush&&e.onflush(),this}}function w$(t){let e=5381,n=t.length;for(;n;)e=e*33^t.charCodeAt(--n);return(e>>>0).toString()}const Tnr=/\r\n|\n\r|\n|\r/g,nze="Missing initPTS for VTT ",_nr=function(e){let n=parseInt(e.slice(-3));const r=parseInt(e.slice(-6,-4)),s=parseInt(e.slice(-9,-7)),i=e.length>9?parseInt(e.substring(0,e.indexOf(":"))):0;if(!xn(n)||!xn(r)||!xn(s)||!xn(i))throw Error(`Malformed X-TIMESTAMP-MAP: Local:${e}`);return n+=1e3*r,n+=60*1e3*s,n+=60*60*1e3*i,n};function A_e(t,e,n){return w$(t.toString())+w$(e.toString())+w$(n)}function Anr(t,e,n,r,s,i,o){const l=new Nnr,c=Sm(new Uint8Array(t)).trim().replace(Tnr,`
`).split(`
`),d=[],u=e?Ver(e.baseTime,e.timescale):0;let h="00:00.000",m=0,f=0,p=!1,g,v=!0;l.oncue=function(b){const x=n[r];let w=n.ccOffset;const k=(m-u)/9e4;if(p){if(x!=null&&x.new&&(w=n.ccOffset=x.start),k){if(!e){g=new Error(nze+"MPEGTS");return}w=k-n.presentationOffset}}else if(e)w=-e.baseTime/e.timescale;else{g=new Error(nze+"without X-TIMESTAMP-MAP");return}const S=b.endTime-b.startTime,C=em((b.startTime+w-f)*9e4,s*9e4)/9e4;b.startTime=Math.max(C,0),b.endTime=Math.max(C+S,0);const j=b.text.trim();b.text=decodeURIComponent(encodeURIComponent(j)),b.id?r&&(b.id=`hlsjscc${r}_${b.id}`):b.id=A_e(b.startTime,b.endTime,j),b.endTime>0&&d.push(b)},l.onparsingerror=function(b){g=b},l.onflush=function(){if(g){o(g);return}i(d)},c.forEach(b=>{if(v)if(b.startsWith("X-TIMESTAMP-MAP=")){v=!1,p=!0,b.slice(16).split(",").forEach(x=>{x.startsWith("LOCAL:")?h=x.slice(6):x.startsWith("MPEGTS:")&&(m=parseInt(x.slice(7)))});try{f=_nr(h)/1e3}catch(x){g=x}return}else b===""&&(v=!1);l.parse(b+`
`)}),l.flush()}const pxe="stpp.ttml.im1t",FSt=/^(\d{2,}):(\d{2}):(\d{2}):(\d{2})\.?(\d+)?$/,BSt=/^(\d*(?:\.\d*)?)(h|m|s|ms|f|t)$/,Pnr={left:"start",center:"center",right:"end",start:"start",end:"end"};function rze(t,e,n,r){const s=Gr(new Uint8Array(t),["mdat"]);if(s.length===0){r(new Error("Could not parse IMSC1 mdat"));return}const i=s.map(l=>Sm(l)),o=zer(e.baseTime,1,e.timescale);try{i.forEach(l=>n(Rnr(l,o)))}catch(l){r(l)}}function Rnr(t,e){const s=new DOMParser().parseFromString(t,"text/xml").getElementsByTagName("tt")[0];if(!s)throw new Error("Invalid ttml");const i={frameRate:30,subFrameRate:1,frameRateMultiplier:0,tickRate:1},o=Object.keys(i).reduce((h,m)=>(h[m]=s.getAttribute(`ttp:${m}`)||i[m],h),{});!s.getAttribute("ttp:tickRate")&&s.getAttribute("ttp:frameRate")&&(o.tickRate=Number(o.frameRate)*Number(o.subFrameRate));const l=s.getAttribute("xml:space")!=="preserve",c=sze(Ade(s,"styling","style")),d=sze(Ade(s,"layout","region")),u=Ade(s,"body","[begin]");return[].map.call(u,h=>{const m=USt(h,l);if(!m||!h.hasAttribute("begin"))return null;const f=Rde(h.getAttribute("begin"),o),p=Rde(h.getAttribute("dur"),o);let g=Rde(h.getAttribute("end"),o);if(f===null)throw ize(h);if(g===null){if(p===null)throw ize(h);g=f+p}const v=new __e(f-e,g-e,m);v.id=A_e(v.startTime,v.endTime,v.text);const b=d[h.getAttribute("region")],x=c[h.getAttribute("style")],w=Inr(b,x,c),{textAlign:k}=w;if(k){const S=Pnr[k];S&&(v.lineAlign=S),v.align=k}return Mi(v,w),v}).filter(h=>h!==null)}function Ade(t,e,n){const r=t.getElementsByTagName(e)[0];return r?[].slice.call(r.querySelectorAll(n)):[]}function sze(t){return t.reduce((e,n)=>{const r=n.getAttribute("xml:id");return r&&(e[r]=n),e},{})}function USt(t,e){return[].slice.call(t.childNodes).reduce((n,r,s)=>{var i;return r.nodeName==="br"&&s?n+`
`:(i=r.childNodes)!=null&&i.length?USt(r,e):e?n+r.textContent.trim().replace(/\s+/g," "):n+r.textContent},"")}function Inr(t,e,n){const r="http://www.w3.org/ns/ttml#styling";let s=null;const i=["displayAlign","textAlign","color","backgroundColor","fontSize","fontFamily"],o=t!=null&&t.hasAttribute("style")?t.getAttribute("style"):null;return o&&n.hasOwnProperty(o)&&(s=n[o]),i.reduce((l,c)=>{const d=Pde(e,r,c)||Pde(t,r,c)||Pde(s,r,c);return d&&(l[c]=d),l},{})}function Pde(t,e,n){return t&&t.hasAttributeNS(e,n)?t.getAttributeNS(e,n):null}function ize(t){return new Error(`Could not parse ttml timestamp ${t}`)}function Rde(t,e){if(!t)return null;let n=DSt(t);return n===null&&(FSt.test(t)?n=Mnr(t,e):BSt.test(t)&&(n=Lnr(t,e))),n}function Mnr(t,e){const n=FSt.exec(t),r=(n[4]|0)+(n[5]|0)/e.subFrameRate;return(n[1]|0)*3600+(n[2]|0)*60+(n[3]|0)+r/e.frameRate}function Lnr(t,e){const n=BSt.exec(t),r=Number(n[1]);switch(n[2]){case"h":return r*3600;case"m":return r*60;case"ms":return r/1e3;case"f":return r/e.frameRate;case"t":return r/e.tickRate}return r}function P_e(t,e,n,r="",s="disabled"){const i=t.ownerDocument.createElement("track");return i.kind=e,i.label=n,r&&(i.srclang=r),i.src="data:,WEBVTT",i.track.mode=s,t.appendChild(i),i}function Dnr(t){return t.forced&&ZJn()?"forced":t.characteristics&&/transcribes-spoken-dialog/gi.test(t.characteristics)&&/describes-music-and-sound/gi.test(t.characteristics)?"captions":"subtitles"}function gxe(t,e){const n=t.mode;if(n==="disabled"&&(t.mode="hidden"),t.cues&&!t.cues.getCueById(e.id))try{if(t.addCue(e),!t.cues.getCueById(e.id))throw new Error(`addCue is failed for: ${e}`)}catch(r){hi.debug(`[texttrack-utils]: ${r}`);try{const s=new self.TextTrackCue(e.startTime,e.endTime,e.text);s.id=e.id,t.addCue(s)}catch(s){hi.debug(`[texttrack-utils]: Legacy TextTrackCue fallback failed: ${s}`)}}n==="disabled"&&(t.mode=n)}function vxe(t,e,n,r){const s=t.mode;if(s==="disabled"&&(t.mode="hidden"),t.cues&&t.cues.length>0){const i=Onr(t.cues,e,n);for(let o=0;o<i.length;o++)(!r||r(i[o]))&&t.removeCue(i[o])}s==="disabled"&&(t.mode=s)}function $nr(t,e){if(e<=t[0].startTime)return 0;const n=t.length-1;if(e>t[n].endTime)return-1;let r=0,s=n,i;for(;r<=s;)if(i=Math.floor((s+r)/2),e<t[i].startTime)s=i-1;else if(e>t[i].startTime&&r<n)r=i+1;else return i;return t[r].startTime-e<e-t[s].startTime?r:s}function Onr(t,e,n){const r=[],s=$nr(t,e);if(s>-1)for(let i=s,o=t.length;i<o;i++){const l=t[i];if(l.startTime>=e&&l.endTime<=n)r.push(l);else if(l.startTime>n)return r}return r}class Fnr extends w_e{constructor(e){super(e,"subtitle-track-controller"),this.media=null,this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0,this.queuedDefaultTrack=-1,this.useTextTrackPolling=!1,this.subtitlePollingInterval=-1,this._subtitleDisplay=!0,this.asyncPollTrackChange=()=>this.pollTrackChange(0),this.onTextTracksChanged=()=>{if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),!this.media||!this.hls.config.renderTextTracksNatively)return;let n=-1,r=!1;if(this.currentTrack){var s;const l=(s=this.currentTrack.trackNode)==null?void 0:s.track.mode;l==="showing"?(n=this.trackId,r=!0):l==="hidden"&&(n=this.trackId)}if(!r)for(let l=0;l<this.tracksInGroup.length;l++){var i;const c=(i=this.tracksInGroup[l].trackNode)==null?void 0:i.track.mode;if(c==="showing"){n=l;break}else n<0&&c==="hidden"&&(n=l)}if(n>-1){var o;this._subtitleDisplay=((o=this.tracksInGroup[n].trackNode)==null?void 0:o.track.mode)==="showing"}this.setSubtitleTrack(n,!0)},this.registerListeners()}destroy(){this.unregisterListeners(),this.tracks.length=0,this.tracksInGroup.length=0,this.currentTrack=null,this.onTextTracksChanged=this.asyncPollTrackChange=null,super.destroy()}get subtitleDisplay(){return this._subtitleDisplay}set subtitleDisplay(e){this._subtitleDisplay=e,this.trackId>-1&&this.toggleTrackModes()}registerListeners(){const{hls:e}=this;e.on(oe.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(oe.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.on(oe.MANIFEST_PARSED,this.onManifestParsed,this),e.on(oe.LEVEL_LOADING,this.onLevelLoading,this),e.on(oe.LEVEL_SWITCHING,this.onLevelSwitching,this),e.on(oe.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(oe.ERROR,this.onError,this)}unregisterListeners(){const{hls:e}=this;e.off(oe.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(oe.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.off(oe.MANIFEST_PARSED,this.onManifestParsed,this),e.off(oe.LEVEL_LOADING,this.onLevelLoading,this),e.off(oe.LEVEL_SWITCHING,this.onLevelSwitching,this),e.off(oe.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(oe.ERROR,this.onError,this)}createTracksInGroup(){var e;if(!this.media||!this.hls.config.renderTextTracksNatively)return;this.tracksInGroup.forEach(r=>{r.trackNode||(r.trackNode=P_e(this.media,Dnr(r),r.name,r.lang))});const n=(e=this.currentTrack)==null||(e=e.trackNode)==null?void 0:e.track;(n==null?void 0:n.mode)==="disabled"&&(n.mode=this._subtitleDisplay?"showing":"hidden")}onMediaAttached(e,n){const r=n.media;this.media=r;let s=this.trackId;this.queuedDefaultTrack>-1&&(s=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.setSubtitleTrack(s),this.createTracksInGroup(),this.useTextTrackPolling=!(r.textTracks&&"onchange"in r.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):r.textTracks.addEventListener("change",this.asyncPollTrackChange)}pollTrackChange(e){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.onTextTracksChanged,e)}onMediaDetaching(e,n){const r=this.media;if(!r)return;const s=!!n.transferMedia;self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||r.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId,this.setSubtitleTrack(-1)),this.media=null,!s&&this.hls.config.renderTextTracksNatively&&this.tracksInGroup.forEach(i=>{const o=i.trackNode;o&&(o.track.mode="hidden",o.remove(),i.trackNode=void 0)})}onManifestLoading(){this.tracks=[],this.groupIds=null,this.tracksInGroup=[],this.trackId=-1,this.currentTrack=null,this.selectDefaultTrack=!0}onManifestParsed(e,n){this.tracks=n.subtitleTracks}onSubtitleTrackLoaded(e,n){const{id:r,groupId:s,details:i}=n,o=this.tracksInGroup[r];if(!o||o.groupId!==s){this.warn(`Subtitle track with id:${r} and group:${s} not found in active group ${o==null?void 0:o.groupId}`);return}const l=o.details;o.details=n.details,this.log(`Subtitle track ${r} "${o.name}" lang:${o.lang} group:${s} loaded [${i.startSN}-${i.endSN}]`),r===this.trackId&&this.playlistLoaded(r,n,l)}onLevelLoading(e,n){this.switchLevel(n.level)}onLevelSwitching(e,n){this.switchLevel(n.level)}switchLevel(e){const n=this.hls.levels[e];if(!n)return;const r=n.subtitleGroups||null,s=this.groupIds;let i=this.currentTrack;if(!r||(s==null?void 0:s.length)!==(r==null?void 0:r.length)||r!=null&&r.some(o=>(s==null?void 0:s.indexOf(o))===-1)){this.groupIds=r;const o=[];if(this.tracks.forEach(u=>{(u.textCodec===pxe?this.hls.config.enableIMSC1:this.hls.config.enableWebVTT)&&(!r||r.indexOf(u.groupId)>-1?(u.id=o.length,o.push(u)):u.trackNode&&(u.trackNode.remove(),u.trackNode=void 0))}),o.length===this.tracksInGroup.length){let u=!1;for(let h=0;h<o.length;h++)if(o[h]!==this.tracksInGroup[h]){u=!0;break}if(!u)return}o.length&&this.selectDefaultTrack&&!o.some(u=>u.default)&&(this.selectDefaultTrack=!1),this.tracksInGroup=o,this.trackId=-1,this.currentTrack=null;const l=this.hls.config.subtitlePreference;if(!i&&l){this.selectDefaultTrack=!1;const u=ry(l,o);if(u>-1)i=o[u];else{const h=ry(l,this.tracks);i=this.tracks[h]}}let c=this.findTrackId(i);c===-1&&i&&(c=this.findTrackId(null));const d={subtitleTracks:o};this.log(`Updating subtitle tracks, ${o.length} track(s) found in "${r==null?void 0:r.join(",")}" group-id`),this.hls.trigger(oe.SUBTITLE_TRACKS_UPDATED,d),this.setSubtitleTrack(c),this.createTracksInGroup()}}findTrackId(e){const n=this.tracksInGroup,r=this.selectDefaultTrack;for(let s=0;s<n.length;s++){const i=n[s];if(!(r&&!i.default||!r&&!e)&&(!e||Xj(i,e)))return s}if(e){for(let s=0;s<n.length;s++){const i=n[s];if(G6(e.attrs,i.attrs,["LANGUAGE","ASSOC-LANGUAGE","CHARACTERISTICS"]))return s}for(let s=0;s<n.length;s++){const i=n[s];if(G6(e.attrs,i.attrs,["LANGUAGE"]))return s}}return-1}onError(e,n){n.fatal||!n.context||n.context.type===ks.SUBTITLE_TRACK&&n.context.id===this.trackId&&z6(n.context.groupId,this.groupIds)&&this.checkRetry(n)}get allSubtitleTracks(){return this.tracks}get subtitleTracks(){return this.tracksInGroup}get subtitleTrack(){return this.trackId}set subtitleTrack(e){this.selectDefaultTrack=!1,this.setSubtitleTrack(e,!0)}setSubtitleOption(e){if(this.hls.config.subtitlePreference=e,e){if(e.id===-1)return this.setSubtitleTrack(-1,!0),null;const n=this.allSubtitleTracks;if(this.selectDefaultTrack=!1,n.length){const r=this.currentTrack;if(r&&Xj(e,r))return r;const s=ry(e,this.tracksInGroup);if(s>-1){const i=this.tracksInGroup[s];return this.setSubtitleTrack(s,!0),i}else{if(r)return null;{const i=ry(e,n);if(i>-1)return n[i]}}}}return null}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentTrack)&&this.scheduleLoading(this.currentTrack,e)}loadingPlaylist(e,n){super.loadingPlaylist(e,n);const r=e.id,s=e.groupId,i=this.getUrlWithDirectives(e.url,n),o=e.details,l=o==null?void 0:o.age;this.log(`Loading subtitle ${r} "${e.name}" lang:${e.lang} group:${s}${(n==null?void 0:n.msn)!==void 0?" at sn "+n.msn+" part "+n.part:""}${l&&o.live?" age "+l.toFixed(1)+(o.type&&" "+o.type||""):""} ${i}`),this.hls.trigger(oe.SUBTITLE_TRACK_LOADING,{url:i,id:r,groupId:s,deliveryDirectives:n||null,track:e})}toggleTrackModes(){if(!this.media||!this.hls.config.renderTextTracksNatively)return;const e=this.currentTrack;this.tracksInGroup.forEach(n=>{if(n.trackNode){const r=n===e?this._subtitleDisplay?"showing":"hidden":"disabled",s=n.trackNode.track;s.mode!==r&&(s.mode=r)}})}setSubtitleTrack(e,n=!1){const r=this.tracksInGroup;if(this.media||(this.queuedDefaultTrack=e),e<-1||e>=r.length||!xn(e)){this.warn(`Invalid subtitle track id: ${e}`);return}const s=this.currentTrack,i=r[e]||null;if(this.trackId=e,this.currentTrack=i,n&&this.toggleTrackModes(),!i){s&&this.hls.trigger(oe.SUBTITLE_TRACK_SWITCH,{id:e});return}const o=!!i.details&&!i.details.live;if(i===s&&o)return;this.log(`Switching to subtitle-track ${e}`+(i?` "${i.name}" lang:${i.lang} group:${i.groupId}`:""));const{id:l,groupId:c="",name:d,type:u,url:h}=i;this.hls.trigger(oe.SUBTITLE_TRACK_SWITCH,{id:l,groupId:c,name:d,type:u,url:h});const m=this.switchParams(i.url,s==null?void 0:s.details,i.details);this.loadPlaylist(m)}}const tq=2,Bnr=100;class Unr extends Mkt{constructor(e,n){super("gap-controller",e.logger),this.hls=void 0,this.fragmentTracker=void 0,this.media=null,this.mediaSource=void 0,this.nudgeRetry=0,this.skipRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.buffered={},this.lastCurrentTime=void 0,this.ended=0,this.waiting=0,this.onMediaPlaying=()=>{this.ended=0,this.waiting=0},this.onMediaWaiting=()=>{var r;(r=this.media)!=null&&r.seeking||(this.waiting=self.performance.now(),this.tick())},this.onMediaEnded=()=>{if(this.hls){var r;this.ended=((r=this.media)==null?void 0:r.currentTime)||1,this.hls.trigger(oe.MEDIA_ENDED,{stalled:!1})}},this.hls=e,this.fragmentTracker=n,this.lastCurrentTime=this.getCurrentTime(),this.registerListeners()}registerListeners(){const{hls:e}=this;e&&(e.on(oe.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(oe.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(oe.BUFFER_APPENDED,this.onBufferAppended,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(oe.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(oe.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(oe.BUFFER_APPENDED,this.onBufferAppended,this))}destroy(){super.destroy(),this.unregisterListeners(),this.media=this.hls=this.fragmentTracker=null,this.mediaSource=void 0}onMediaAttached(e,n){this.setInterval(Bnr),this.mediaSource=n.mediaSource;const r=this.media=n.media;Si(r,"playing",this.onMediaPlaying),Si(r,"waiting",this.onMediaWaiting),Si(r,"ended",this.onMediaEnded)}onMediaDetaching(e,n){this.clearInterval();const{media:r}=this;r&&(pi(r,"playing",this.onMediaPlaying),pi(r,"waiting",this.onMediaWaiting),pi(r,"ended",this.onMediaEnded),this.media=null),this.mediaSource=void 0}onBufferAppended(e,n){this.buffered=n.timeRanges}get hasBuffered(){return Object.keys(this.buffered).length>0}getCurrentTime(){var e;const n=((e=this.hls)==null?void 0:e.config.timelineOffset)||0;return this.media?Math.max(this.media.currentTime,n):n}tick(){var e;if(!((e=this.media)!=null&&e.readyState)||!this.hasBuffered)return;const n=this.getCurrentTime();this.media.currentTime<n||(this.poll(n,this.lastCurrentTime),this.lastCurrentTime=n)}poll(e,n){var r,s;const i=(r=this.hls)==null?void 0:r.config;if(!i)return;const o=this.media;if(!o)return;const{seeking:l}=o,c=this.seeking&&!l,d=!this.seeking&&l,u=o.paused&&!l||o.ended||o.playbackRate===0;if(this.seeking=l,e!==n){n&&(this.ended=0),this.moved=!0,l||(this.skipRetry=this.nudgeRetry=0,i.nudgeOnVideoHole&&!u&&e>n&&this.nudgeOnVideoHole(e,n)),this.waiting===0&&this.stallResolved(e);return}if(d||c){c&&this.stallResolved(e);return}if(u){this.skipRetry=this.nudgeRetry=0,this.stallResolved(e),!this.ended&&o.ended&&this.hls&&(this.ended=e||1,this.hls.trigger(oe.MEDIA_ENDED,{stalled:!1}));return}if(!Rr.getBuffered(o).length){this.skipRetry=this.nudgeRetry=0;return}const h=Rr.bufferInfo(o,e,0),m=this.fragmentTracker;m&&this.hls&&lze(h,e,m,this.hls);const f=h.nextStart||0;if(l&&m&&this.hls){const C=aze(this.hls.inFlightFragments,e),j=h.len>tq,E=!f||C||f-e>tq&&!m.getPartialFragment(e);if(j||E)return;this.moved=!1}const p=(s=this.hls)==null?void 0:s.latestLevelDetails;if(!this.moved&&this.stalled!==null&&m){if(!(h.len>0)&&!f)return;const j=Math.max(f,h.start||0)-e,N=!!(p!=null&&p.live)?p.targetduration*2:tq,A=J4(e,m);if(j>0&&(j<=N||A)){o.paused||this._trySkipBufferHole(A);return}}const g=i.detectStallWithCurrentTimeMs,v=self.performance.now(),b=this.waiting;let x=this.stalled;if(x===null)if(b>0&&v-b<g)x=this.stalled=b;else{this.stalled=v;return}const w=v-x;if(!l&&(w>=g||b&&this.moved)&&this.hls){var k;if(((k=this.mediaSource)==null?void 0:k.readyState)==="ended"&&!(p!=null&&p.live)&&Math.abs(e-((p==null?void 0:p.edge)||0))<1){if(this.ended)return;this.ended=e||1,this.hls.trigger(oe.MEDIA_ENDED,{stalled:!0});return}if(this._reportStall(h),!this.media||!this.hls)return;if(o.currentTime!==e){const C=e;e=o.currentTime,this.moved=!0,this.log(`currentTime changed ${C} > ${e}`);return}}const S=Rr.bufferInfo(o,e,i.maxBufferHole);this._tryFixBufferStall(S,w,e)}stallResolved(e){const n=this.stalled;if(n&&this.hls&&(this.stalled=null,this.stallReported)){const r=self.performance.now()-n;this.log(`playback not stuck anymore @${e}, after ${Math.round(r)}ms`),this.stallReported=!1,this.waiting=0,this.hls.trigger(oe.STALL_RESOLVED,{})}}nudgeOnVideoHole(e,n){var r;const s=this.buffered.video;if(this.hls&&this.media&&this.fragmentTracker&&(r=this.buffered.audio)!=null&&r.length&&s&&s.length>1&&e>s.end(0)){const i=Rr.bufferedInfo(Rr.timeRangesToArray(this.buffered.audio),e,0);if(i.len>1&&n>=i.start){const o=Rr.timeRangesToArray(s),l=Rr.bufferedInfo(o,n,0).bufferedIndex;if(l>-1&&l<o.length-1){const c=Rr.bufferedInfo(o,e,0).bufferedIndex,d=o[l].end,u=o[l+1].start;if((c===-1||c>l)&&u-d<1&&e-d<2){const h=new Error(`nudging playhead to flush pipeline after video hole. currentTime: ${e} hole: ${d} -> ${u} buffered index: ${c}`);this.warn(h.message),this.media.currentTime+=1e-6;let m=J4(e,this.fragmentTracker);m&&"fragment"in m?m=m.fragment:m||(m=void 0);const f=Rr.bufferInfo(this.media,e,0);this.hls.trigger(oe.ERROR,{type:er.MEDIA_ERROR,details:rt.BUFFER_SEEK_OVER_HOLE,fatal:!1,error:h,reason:h.message,frag:m,buffer:f.len,bufferInfo:f})}}}}}_tryFixBufferStall(e,n,r){var s,i;const{fragmentTracker:o,media:l}=this,c=(s=this.hls)==null?void 0:s.config;if(!l||!o||!c)return;const d=(i=this.hls)==null?void 0:i.latestLevelDetails,u=J4(r,o);if((u||d!=null&&d.live&&r<d.fragmentStart)&&(this._trySkipBufferHole(u)||!this.media))return;const h=e.buffered,m=this.adjacentTraversal(e,r);(h&&h.length>1&&e.len>c.maxBufferHole||e.nextStart&&(e.nextStart-r<c.maxBufferHole||m))&&(n>c.highBufferWatchdogPeriod*1e3||this.waiting)&&(this.warn("Trying to nudge playhead over buffer-hole"),this._tryNudgeBuffer(e))}adjacentTraversal(e,n){const r=this.fragmentTracker,s=e.nextStart;if(r&&s){const i=r.getFragAtPos(n,Wn.MAIN),o=r.getFragAtPos(s,Wn.MAIN);if(i&&o)return o.sn-i.sn<2}return!1}_reportStall(e){const{hls:n,media:r,stallReported:s,stalled:i}=this;if(!s&&i!==null&&r&&n){this.stallReported=!0;const o=new Error(`Playback stalling at @${r.currentTime} due to low buffer (${ya(e)})`);this.warn(o.message),n.trigger(oe.ERROR,{type:er.MEDIA_ERROR,details:rt.BUFFER_STALLED_ERROR,fatal:!1,error:o,buffer:e.len,bufferInfo:e,stalled:{start:i}})}}_trySkipBufferHole(e){const{fragmentTracker:n,media:r,hls:s}=this,i=s==null?void 0:s.config;if(!r||!n||!i)return 0;const o=r.currentTime,l=Rr.bufferInfo(r,o,0);lze(l,o,n,s);const c=o<l.start?l.start:l.nextStart;if(c){const u=l.len<=i.maxBufferHole,h=l.len>0&&l.len<1&&r.readyState<3,m=c-o;if(m>0&&(u||h)){if(m>i.maxBufferHole){let b=!1;if(o===0){const x=n.getAppendedFrag(0,Wn.MAIN);x&&c<x.end&&(b=!0)}if(!b&&e){var d;if(!((d=s.loadLevelObj)!=null&&d.details)||aze(s.inFlightFragments,c))return 0;let w=!1,k=e.end;for(;k<c;){const S=J4(k,n),C=S?S.duration:0;if(C>0)k+=C;else{w=!0;break}}if(w)return 0}}const{nudgeMaxRetry:f,skipBufferHolePadding:p}=i,g=++this.skipRetry>f,v=Math.max(c,o)+p;if(g||(this.warn(`skipping hole, adjusting currentTime from ${o} to ${v}`),this.moved=!0,r.currentTime=v),!(e!=null&&e.gap)||g){const b=new Error(g?`Playhead still not moving after seeking over buffer hole from ${o} to ${v} after ${i.nudgeMaxRetry} attempts.`:`fragment loaded with buffer holes, seeking from ${o} to ${v}`),x={type:er.MEDIA_ERROR,details:rt.BUFFER_SEEK_OVER_HOLE,fatal:g,error:b,reason:b.message,buffer:l.len,bufferInfo:l};e&&("fragment"in e?x.part=e:x.frag=e),s.trigger(oe.ERROR,x)}return v}}return 0}_tryNudgeBuffer(e){const{hls:n,media:r,nudgeRetry:s}=this,i=n==null?void 0:n.config;if(!r||!i)return 0;const o=r.currentTime;if(this.nudgeRetry++,s<i.nudgeMaxRetry){const l=o+(s+1)*i.nudgeOffset,c=new Error(`Nudging 'currentTime' from ${o} to ${l}`);this.warn(c.message),r.currentTime=l,n.trigger(oe.ERROR,{type:er.MEDIA_ERROR,details:rt.BUFFER_NUDGE_ON_STALL,error:c,fatal:!1,buffer:e.len,bufferInfo:e})}else{const l=new Error(`Playhead still not moving while enough data buffered @${o} after ${i.nudgeMaxRetry} nudges`);this.error(l.message),n.trigger(oe.ERROR,{type:er.MEDIA_ERROR,details:rt.BUFFER_STALLED_ERROR,error:l,fatal:!0,buffer:e.len,bufferInfo:e})}}}function aze(t,e){const n=oze(t.main);if(n&&n.start<=e)return n;const r=oze(t.audio);return r&&r.start<=e?r:null}function oze(t){if(!t)return null;switch(t.state){case Ct.IDLE:case Ct.STOPPED:case Ct.ENDED:case Ct.ERROR:return null}return t.frag}function J4(t,e){return e.getAppendedFrag(t,Wn.MAIN)||e.getPartialFragment(t)}function lze(t,e,n,r){const s=r.latestLevelDetails,i=J4(e,n);if(uZ(r.config)&&!t.nextStart&&s&&i&&r.interstitialsManager){const o="type"in i?i:i.fragment,l=Rkt(s,o.sn);(l==null?void 0:l.level)===o.level&&Ykt(l,r.interstitialsManager.playerQueue,e)&&(t.nextStart=l.start)}}const znr=.25;function yxe(){if(!(typeof self>"u"))return self.VTTCue||self.TextTrackCue}function Ide(t,e,n,r,s){let i=new t(e,n,"");try{i.value=r,s&&(i.type=s)}catch{i=new t(e,n,ya(s?rr({type:s},r):r))}return i}const wV=(()=>{const t=yxe();try{t&&new t(0,Number.POSITIVE_INFINITY,"")}catch{return Number.MAX_VALUE}return Number.POSITIVE_INFINITY})();class Vnr{constructor(e){this.hls=void 0,this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.removeCues=!0,this.assetCue=void 0,this.onEventCueEnter=()=>{this.hls&&this.hls.trigger(oe.EVENT_CUE_ENTER,{})},this.hls=e,this._registerListeners()}destroy(){this._unregisterListeners(),this.id3Track=null,this.media=null,this.dateRangeCuesAppended={},this.hls=this.onEventCueEnter=null}_registerListeners(){const{hls:e}=this;e&&(e.on(oe.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(oe.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(oe.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.on(oe.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.on(oe.BUFFER_FLUSHING,this.onBufferFlushing,this),e.on(oe.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(oe.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}_unregisterListeners(){const{hls:e}=this;e&&(e.off(oe.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(oe.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(oe.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.off(oe.FRAG_PARSING_METADATA,this.onFragParsingMetadata,this),e.off(oe.BUFFER_FLUSHING,this.onBufferFlushing,this),e.off(oe.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(oe.LEVEL_PTS_UPDATED,this.onLevelPtsUpdated,this))}onMediaAttaching(e,n){this.media=n.media}onMediaAttached(){var e;const n=(e=this.hls)==null?void 0:e.latestLevelDetails;n&&this.updateDateRangeCues(n)}onMediaDetaching(e,n){this.media=null,!n.transferMedia&&(this.id3Track&&(this.id3Track.remove(),this.id3Track=null),this.dateRangeCuesAppended={})}onManifestLoading(){this.dateRangeCuesAppended={}}createTrack(e){return P_e(e,"metadata","id3","","hidden")}onFragParsingMetadata(e,n){if(!this.media||!this.hls)return;const{enableEmsgMetadataCues:r,enableID3MetadataCues:s}=this.hls.config;if(!r&&!s)return;const{samples:i}=n;this.id3Track||(this.id3Track=this.createTrack(this.media));const o=yxe();if(o)for(let l=0;l<i.length;l++){const c=i[l].type;if(c===xu.emsg&&!r||!s)continue;const d=okt(i[l].data),u=i[l].pts;let h=u+i[l].duration;h>wV&&(h=wV),h-u<=0&&(h=u+znr);for(let f=0;f<d.length;f++){const p=d[f];if(!lkt(p)){this.updateId3CueEnds(u,c);const g=Ide(o,u,h,p,c);g&&this.id3Track.track.addCue(g)}}}}updateId3CueEnds(e,n){var r;const s=(r=this.id3Track)==null?void 0:r.track.cues;if(s)for(let i=s.length;i--;){const o=s[i];o.type===n&&o.startTime<e&&o.endTime===wV&&(o.endTime=e)}}onBufferFlushing(e,{startOffset:n,endOffset:r,type:s}){const{id3Track:i,hls:o}=this;if(!o)return;const{config:{enableEmsgMetadataCues:l,enableID3MetadataCues:c}}=o;if(i&&(l||c)){let d;s==="audio"?d=u=>u.type===xu.audioId3&&c:s==="video"?d=u=>u.type===xu.emsg&&l:d=u=>u.type===xu.audioId3&&c||u.type===xu.emsg&&l,vxe(i.track,n,r,d)}}onLevelUpdated(e,{details:n}){this.updateDateRangeCues(n,!0)}onLevelPtsUpdated(e,n){Math.abs(n.drift)>.01&&this.updateDateRangeCues(n.details)}updateDateRangeCues(e,n){if(!this.hls||!this.media)return;const{assetPlayerId:r,timelineOffset:s,enableDateRangeMetadataCues:i,interstitialsController:o}=this.hls.config;if(!i)return;const l=yxe();if(r&&s&&!o){const{fragmentStart:g,fragmentEnd:v}=e;let b=this.assetCue;b?(b.startTime=g,b.endTime=v):l&&(b=this.assetCue=Ide(l,g,v,{assetPlayerId:this.hls.config.assetPlayerId},"hlsjs.interstitial.asset"),b&&(b.id=r,this.id3Track||(this.id3Track=this.createTrack(this.media)),this.id3Track.track.addCue(b),b.addEventListener("enter",this.onEventCueEnter)))}if(!e.hasProgramDateTime)return;const{id3Track:c}=this,{dateRanges:d}=e,u=Object.keys(d);let h=this.dateRangeCuesAppended;if(c&&n){var m;if((m=c.track.cues)!=null&&m.length){const g=Object.keys(h).filter(v=>u.indexOf(v)===-1);for(let v=g.length;v--;){var f;const b=g[v],x=(f=h[b])==null?void 0:f.cues;delete h[b],x&&Object.keys(x).forEach(w=>{const k=x[w];if(k){k.removeEventListener("enter",this.onEventCueEnter);try{c.track.removeCue(k)}catch{}}})}}else h=this.dateRangeCuesAppended={}}const p=e.fragments[e.fragments.length-1];if(!(u.length===0||!xn(p==null?void 0:p.programDateTime))){this.id3Track||(this.id3Track=this.createTrack(this.media));for(let g=0;g<u.length;g++){const v=u[g],b=d[v],x=b.startTime,w=h[v],k=(w==null?void 0:w.cues)||{};let S=(w==null?void 0:w.durationKnown)||!1,C=wV;const{duration:j,endDate:E}=b;if(E&&j!==null)C=x+j,S=!0;else if(b.endOnNext&&!S){const A=u.reduce((_,T)=>{if(T!==b.id){const R=d[T];if(R.class===b.class&&R.startDate>b.startDate&&(!_||b.startDate<_.startDate))return R}return _},null);A&&(C=A.startTime,S=!0)}const N=Object.keys(b.attr);for(let A=0;A<N.length;A++){const _=N[A];if(!DXn(_))continue;const T=k[_];if(T)S&&!(w!=null&&w.durationKnown)?T.endTime=C:Math.abs(T.startTime-x)>.01&&(T.startTime=x,T.endTime=C);else if(l){let R=b.attr[_];$Xn(_)&&(R=ckt(R));const F=Ide(l,x,C,{key:_,data:R},xu.dateRange);F&&(F.id=v,this.id3Track.track.addCue(F),k[_]=F,o&&(_==="X-ASSET-LIST"||_==="X-ASSET-URL")&&F.addEventListener("enter",this.onEventCueEnter))}}h[v]={cues:k,dateRange:b,durationKnown:S}}}}}function zSt(){return self.SourceBuffer||self.WebKitSourceBuffer}function VSt(){if(!Bk())return!1;const e=zSt();return!e||e.prototype&&typeof e.prototype.appendBuffer=="function"&&typeof e.prototype.remove=="function"}function Hnr(){if(!VSt())return!1;const t=Bk();return typeof(t==null?void 0:t.isTypeSupported)=="function"&&(["avc1.42E01E,mp4a.40.2","av01.0.01M.08","vp09.00.50.08"].some(e=>t.isTypeSupported(B6(e,"video")))||["mp4a.40.2","fLaC"].some(e=>t.isTypeSupported(B6(e,"audio"))))}function Gnr(){var t;const e=zSt();return typeof(e==null||(t=e.prototype)==null?void 0:t.changeType)=="function"}var pv={DISABLED:0,SWITCHING:1,SWITCHED:2};const Wnr=100;class HSt extends p_e{constructor(e,n,r){super(e,n,r,"stream-controller",Wn.MAIN),this.audioCodecSwap=!1,this.level=-1,this._forceStartLoad=!1,this._hasEnoughToStart=!1,this.altAudio=pv.DISABLED,this.audioOnly=!1,this._couldBacktrack=!1,this._backtrackFragment=void 0,this.audioCodecSwitch=!1,this.videoBuffer=null,this.onMediaPlaying=()=>{this.tick()},this.onMediaSeeked=()=>{const s=this.media,i=s?s.currentTime:null;if(i===null||!xn(i)||(this.log(`Media seeked to ${i}`),!this.getBufferedFrag(i)))return;const o=this.getFwdBufferInfoAtPos(s,i,Wn.MAIN,0);if(!o||o.len===0){this.log(`Main buffer empty at ${i} on "seeked" event: ${o&&o.len}`);return}this.tick()},this.registerListeners()}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(oe.MANIFEST_PARSED,this.onManifestParsed,this),e.on(oe.LEVEL_LOADING,this.onLevelLoading,this),e.on(oe.LEVEL_LOADED,this.onLevelLoaded,this),e.on(oe.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.on(oe.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(oe.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.on(oe.BUFFER_CREATED,this.onBufferCreated,this),e.on(oe.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(oe.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(oe.FRAG_BUFFERED,this.onFragBuffered,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(oe.MANIFEST_PARSED,this.onManifestParsed,this),e.off(oe.LEVEL_LOADED,this.onLevelLoaded,this),e.off(oe.FRAG_LOAD_EMERGENCY_ABORTED,this.onFragLoadEmergencyAborted,this),e.off(oe.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(oe.AUDIO_TRACK_SWITCHED,this.onAudioTrackSwitched,this),e.off(oe.BUFFER_CREATED,this.onBufferCreated,this),e.off(oe.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(oe.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(oe.FRAG_BUFFERED,this.onFragBuffered,this)}onHandlerDestroying(){this.onMediaPlaying=this.onMediaSeeked=null,this.unregisterListeners(),super.onHandlerDestroying()}startLoad(e,n){if(this.levels){const{lastCurrentTime:r,hls:s}=this;if(this.stopLoad(),this.setInterval(Wnr),this.level=-1,!this.startFragRequested){let i=s.startLevel;i===-1&&(s.config.testBandwidth&&this.levels.length>1?(i=0,this.bitrateTest=!0):i=s.firstAutoLevel),s.nextLoadLevel=i,this.level=s.loadLevel,this._hasEnoughToStart=!!n}r>0&&e===-1&&!n&&this.initPTS.length&&(this.log(`Override startPosition with lastCurrentTime @${r}`),e=r),this.state=Ct.IDLE,this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=n?-1:e,!n&&!this.fragmentTracker.hasFragments(this.playlistType)&&(this._hasEnoughToStart=this.startFragRequested=!1),this.tick()}else this._forceStartLoad=!0,this.state=Ct.STOPPED}stopLoad(){this._forceStartLoad=!1,super.stopLoad()}doTick(){switch(this.state){case Ct.WAITING_LEVEL:{const{levels:e,level:n}=this,r=e==null?void 0:e[n],s=r==null?void 0:r.details;if(s&&(!s.live||this.levelLastLoaded===r&&!this.waitForLive(r))){if(this.waitForCdnTuneIn(s))break;this.state=Ct.IDLE;break}else if(this.hls.nextLoadLevel!==this.level){this.state=Ct.IDLE;break}break}case Ct.FRAG_LOADING_WAITING_RETRY:this.checkRetryDate();break}this.state===Ct.IDLE&&this.doTickIdle(),this.onTickEnd()}onTickEnd(){var e;super.onTickEnd(),(e=this.media)!=null&&e.readyState&&this.media.seeking===!1&&(this.lastCurrentTime=this.media.currentTime),this.checkFragmentChanged()}doTickIdle(){const{hls:e,levelLastLoaded:n,levels:r,media:s}=this;if(n===null||!s&&!this.primaryPrefetch&&(this.startFragRequested||!e.config.startFragPrefetch)||this.altAudio&&this.audioOnly)return;const i=this.buffering?e.nextLoadLevel:e.loadLevel;if(!(r!=null&&r[i]))return;const o=r[i],l=this.getMainFwdBufferInfo();if(l===null)return;const c=this.getLevelDetails();if(c&&this._streamEnded(l,c)){const g={type:this.targetBufferType()};this.hls.trigger(oe.BUFFER_EOS,g),this.state=Ct.ENDED;return}if(!this.buffering)return;e.loadLevel!==i&&e.manualLevel===-1&&this.log(`Adapting to level ${i} from level ${this.level}`),this.level=e.nextLoadLevel=i;const d=o.details;if(!d||this.state===Ct.WAITING_LEVEL||this.waitForLive(o)){this.level=i,this.state=Ct.WAITING_LEVEL,this.startFragRequested=!1;return}const u=l.len,h=this.getMaxBufferLength(o.maxBitrate);if(u>=h)return;this.backtrackFragment&&this.backtrackFragment.start>l.end&&(this.backtrackFragment=void 0);const m=this.backtrackFragment?this.backtrackFragment.start:l.end;let f=this.getNextFragment(m,d);if(this.couldBacktrack&&!this.fragPrevious&&f&&Oo(f)&&this.fragmentTracker.getState(f)!==po.OK){var p;const v=((p=this.backtrackFragment)!=null?p:f).sn-d.startSN,b=d.fragments[v-1];b&&f.cc===b.cc&&(f=b,this.fragmentTracker.removeFragment(b))}else this.backtrackFragment&&l.len&&(this.backtrackFragment=void 0);if(f&&this.isLoopLoading(f,m)){if(!f.gap){const v=this.audioOnly&&!this.altAudio?na.AUDIO:na.VIDEO,b=(v===na.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;b&&this.afterBufferFlushed(b,v)}f=this.getNextFragmentLoopLoading(f,d,l,Wn.MAIN,h)}f&&(this.exceedsMaxBuffer(l,h,f)||this.loadFragment(f,o,m))}loadFragment(e,n,r){const s=this.fragmentTracker.getState(e);s===po.NOT_LOADED||s===po.PARTIAL?this.bitrateTest?(this.log(`Fragment ${e.sn} of level ${e.level} is being downloaded to test bitrate and will not be buffered`),this._loadBitrateTestFrag(e,n)):super.loadFragment(e,n,r):this.clearTrackerIfNeeded(e)}immediateLevelSwitch(){if(this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY),this.altAudio!==pv.DISABLED){var e;(((e=this.getLevelDetails())==null?void 0:e.fragmentStart)||0)>this.lastCurrentTime&&super.flushMainBuffer(0,Number.POSITIVE_INFINITY,"audio")}}getBufferOutput(){return this.mediaBuffer&&this.altAudio===pv.SWITCHED?this.mediaBuffer:this.media}checkFragmentChanged(){const e=this.fragPlaying;if(!this.checkFragPlaying())return!1;const r=this.fragPlaying;if(r){const s=r.level;this.hls.trigger(oe.FRAG_CHANGED,{frag:r,previousFrag:e}),(e==null?void 0:e.level)!==s&&this.hls.trigger(oe.LEVEL_SWITCHED,{level:s})}return!0}get backtrackFragment(){return this._backtrackFragment}set backtrackFragment(e){this._backtrackFragment=e}get couldBacktrack(){return this._couldBacktrack}set couldBacktrack(e){this._couldBacktrack=e}abortCurrentFrag(){this.backtrackFragment=void 0,super.abortCurrentFrag()}flushMainBuffer(e,n){super.flushMainBuffer(e,n,this.targetBufferType())}targetBufferType(){return this.altAudio===pv.SWITCHED&&!this.audioOnly?"video":null}onMediaAttached(e,n){super.onMediaAttached(e,n);const r=n.media;Si(r,"playing",this.onMediaPlaying),Si(r,"seeked",this.onMediaSeeked)}onMediaDetaching(e,n){const{media:r}=this;r&&(pi(r,"playing",this.onMediaPlaying),pi(r,"seeked",this.onMediaSeeked)),this.videoBuffer=null,super.onMediaDetaching(e,n),!n.transferMedia&&(this._hasEnoughToStart=!1)}onManifestLoading(){super.onManifestLoading(),this.log("Trigger BUFFER_RESET"),this.hls.trigger(oe.BUFFER_RESET,void 0),this.couldBacktrack=!1,this.backtrackFragment=void 0,this.altAudio=pv.DISABLED,this.audioOnly=!1}onManifestParsed(e,n){let r=!1,s=!1;for(let i=0;i<n.levels.length;i++){const o=n.levels[i].audioCodec;o&&(r=r||o.indexOf("mp4a.40.2")!==-1,s=s||o.indexOf("mp4a.40.5")!==-1)}this.audioCodecSwitch=r&&s&&!Gnr(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=n.levels,this.startFragRequested=!1}onLevelLoading(e,n){const{levels:r}=this;if(!r||this.state!==Ct.IDLE)return;const s=n.levelInfo;(!s.details||s.details.live&&(this.levelLastLoaded!==s||s.details.expired)||this.waitForCdnTuneIn(s.details))&&(this.state=Ct.WAITING_LEVEL)}onLevelLoaded(e,n){var r;const{levels:s,startFragRequested:i}=this,o=n.level,l=n.details,c=l.totalduration;if(!s){this.warn(`Levels were reset while loading level ${o}`);return}this.log(`Level ${o} loaded [${l.startSN},${l.endSN}]${l.lastPartSn?`[part-${l.lastPartSn}-${l.lastPartIndex}]`:""}, cc [${l.startCC}, ${l.endCC}] duration:${c}`);const d=n.levelInfo,u=this.fragCurrent;u&&(this.state===Ct.FRAG_LOADING||this.state===Ct.FRAG_LOADING_WAITING_RETRY)&&u.level!==n.level&&u.loader&&this.abortCurrentFrag();let h=0;if(l.live||(r=d.details)!=null&&r.live){var m;if(this.checkLiveUpdate(l),l.deltaUpdateFailed)return;h=this.alignPlaylists(l,d.details,(m=this.levelLastLoaded)==null?void 0:m.details)}if(d.details=l,this.levelLastLoaded=d,i||this.setStartPosition(l,h),this.hls.trigger(oe.LEVEL_UPDATED,{details:l,level:o}),this.state===Ct.WAITING_LEVEL){if(this.waitForCdnTuneIn(l))return;this.state=Ct.IDLE}i&&l.live&&this.synchronizeToLiveEdge(l),this.initPTS.some((f,p)=>{if(p>=l.startCC)return!0;delete this.initPTS[p]}),this.tick()}synchronizeToLiveEdge(e){const{config:n,media:r}=this;if(!r)return;const s=this.hls.liveSyncPosition,i=this.playhead,o=e.fragmentStart,l=e.edge,c=i>=o-n.maxFragLookUpTolerance&&i<=l;if(s!==null&&r.duration>s&&(i<s||!c)){const u=n.liveMaxLatencyDuration!==void 0?n.liveMaxLatencyDuration:n.liveMaxLatencyDurationCount*e.targetduration;if((!c&&r.readyState<4||i<l-u)&&(this._hasEnoughToStart||(this.nextLoadPosition=s),r.readyState))if(this.warn(`Playback: ${i} is located too far from the end of live sliding playlist: ${l}, reset currentTime to : ${s}`),this.config.liveSyncMode==="buffered"){var d;const h=Rr.bufferInfo(r,s,0);if(!((d=h.buffered)!=null&&d.length)){r.currentTime=s;return}if(h.start<=i){r.currentTime=s;return}const{nextStart:f}=Rr.bufferedInfo(h.buffered,i,0);f&&(r.currentTime=f)}else r.currentTime=s}}_handleFragmentLoadProgress(e){var n;const r=e.frag,{part:s,payload:i}=e,{levels:o}=this;if(!o){this.warn(`Levels were reset while fragment load was in progress. Fragment ${r.sn} of level ${r.level} will not be buffered`);return}const l=o[r.level];if(!l){this.warn(`Level ${r.level} not found on progress`);return}const c=l.details;if(!c){this.warn(`Dropping fragment ${r.sn} of level ${r.level} after level details were reset`),this.fragmentTracker.removeFragment(r);return}const d=l.videoCodec,u=c.PTSKnown||!c.live,h=(n=r.initSegment)==null?void 0:n.data,m=this._getAudioCodec(l),f=this.transmuxer=this.transmuxer||new mSt(this.hls,Wn.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),p=s?s.index:-1,g=p!==-1,{decryptRange:v,byteRange:b}=aZ(r,s,this.iframesOnly),x=new u_e(r.level,r.sn,r.stats.chunkCount,b?b.end-b.start:i.byteLength,p,g,r.duration,this.iframesOnly,v),w=this.initPTS[r.cc];f.push(i,h,m,d,r,s,c.totalduration,u,x,w)}onAudioTrackSwitching(e,n){const r=this.hls,s=this.altAudio!==pv.DISABLED;if(iZ(n.url,r))this.altAudio=pv.SWITCHING;else{if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;const o=this.fragCurrent;o&&(this.log("Switching to main audio track, cancel main fragment load"),o.abortRequests(),this.fragmentTracker.removeFragment(o)),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();if(s){this.altAudio=pv.DISABLED,this.fragmentTracker.removeAllFragments(),r.once(oe.BUFFER_FLUSHED,()=>{this.hls&&this.hls.trigger(oe.AUDIO_TRACK_SWITCHED,n)}),r.trigger(oe.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:null});return}r.trigger(oe.AUDIO_TRACK_SWITCHED,n)}}onAudioTrackSwitched(e,n){const r=iZ(n.url,this.hls);if(r){const s=this.videoBuffer;s&&this.mediaBuffer!==s&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=s)}this.altAudio=r?pv.SWITCHED:pv.DISABLED,this.tick()}onBufferCreated(e,n){const r=n.tracks;let s,i,o=!1;for(const l in r){const c=r[l];if(c.id==="main"){if(i=l,s=c,l==="video"){const d=r[l];d&&(this.videoBuffer=d.buffer)}}else o=!0}o&&s?(this.log(`Alternate track found, use ${i}.buffered to schedule main fragment loading`),this.mediaBuffer=s.buffer):this.mediaBuffer=this.media}onFragBuffered(e,n){const{frag:r,part:s}=n,i=r.type===Wn.MAIN;if(i){if(this.fragContextChanged(r)){this.warn(`Fragment ${r.sn}${s?" p: "+s.index:""} of level ${r.level} finished buffering, but was aborted. state: ${this.state}`),this.state===Ct.PARSED&&(this.state=Ct.IDLE);return}let c=!1;if(Oo(r)&&(c=!!r.gap&&!r.tagList.some(d=>d[0]==="GAP")),this.fragBufferedComplete(r,s),c){var o;r.stats.retry++;const d=(o=this.levels)==null?void 0:o[r.level];d&&d.fragmentError++}}const l=this.media;l&&(!this._hasEnoughToStart&&Rr.getBuffered(l).length&&(this._hasEnoughToStart=!0,this.seekToStartPos()),i&&this.tick())}get hasEnoughToStart(){return this._hasEnoughToStart}onError(e,n){var r;if(n.fatal){this.state=Ct.ERROR;return}switch(n.details){case rt.FRAG_GAP:case rt.FRAG_PARSING_ERROR:case rt.FRAG_DECRYPT_ERROR:case rt.FRAG_LOAD_ERROR:case rt.FRAG_LOAD_TIMEOUT:case rt.KEY_LOAD_ERROR:case rt.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(Wn.MAIN,n);break;case rt.LEVEL_LOAD_ERROR:case rt.LEVEL_LOAD_TIMEOUT:case rt.LEVEL_PARSING_ERROR:!n.levelRetry&&this.state===Ct.WAITING_LEVEL&&((r=n.context)==null?void 0:r.type)===ks.LEVEL&&(this.state=Ct.IDLE);break;case rt.BUFFER_APPEND_NO_PROGRESS:if(n.parent!=="main")return;n.frag&&(n.appendsWithoutProgress||0)>=this.config.appendErrorMaxRetry&&(this.warn(`Marking fragment ${n.frag.sn} of level ${n.frag.level} as a gap after ${n.appendsWithoutProgress} appends without buffered range growth, to prevent loop loading`),this.fragmentTracker.addAsGap(n.frag));break;case rt.BUFFER_ADD_CODEC_ERROR:case rt.BUFFER_APPEND_ERROR:if(n.parent!=="main")return;this.reduceLengthAndFlushBuffer(n)&&this.resetLoadingState();break;case rt.BUFFER_FULL_ERROR:if(n.parent!=="main")return;this.reduceLengthAndFlushBuffer(n)&&(!this.config.interstitialsController&&this.config.assetPlayerId?this._hasEnoughToStart=!0:this.flushMainBuffer(0,Number.POSITIVE_INFINITY));break;case rt.INTERNAL_EXCEPTION:this.recoverWorkerError(n);break}}onFragLoadEmergencyAborted(){this.state=Ct.IDLE,this._hasEnoughToStart||(this.startFragRequested=!1,this.nextLoadPosition=this.lastCurrentTime),this.tickImmediate()}onBufferFlushed(e,{type:n}){if(n!==na.AUDIO||!this.altAudio){const r=(n===na.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;r&&(this.afterBufferFlushed(r,n),this.tick())}}onLevelsUpdated(e,n){this.level>-1&&this.fragCurrent&&(this.level=this.fragCurrent.level,this.level===-1&&this.resetWhenMissingContext(this.fragCurrent)),this.levels=n.levels}swapAudioCodec(){this.audioCodecSwap=!this.audioCodecSwap}seekToStartPos(){const{media:e}=this;if(!e)return;const n=e.currentTime;let r=this.startPosition;if(r>=0&&n<r){if(e.seeking){this.log(`could not seek to ${r}, already seeking at ${n}`);return}const s=this.timelineOffset;s&&r&&(r+=s);const i=this.getLevelDetails(),o=Rr.getBuffered(e),l=o.length?o.start(0):0,c=l-r,d=Math.max(this.config.maxBufferHole,this.config.maxFragLookUpTolerance);(this.config.startOnSegmentBoundary||c>0&&(c<d||this.loadingParts&&c<2*((i==null?void 0:i.partTarget)||0)))&&(this.log(`adjusting start position by ${c} to match buffer start`),r+=c,this.startPosition=r),n<r&&(this.log(`seek to target start position ${r} from current time ${n} buffer start ${l}`),e.currentTime=r)}}_getAudioCodec(e){let n=this.config.defaultAudioCodec||e.audioCodec;return this.audioCodecSwap&&n&&(this.log("Swapping audio codec"),n.indexOf("mp4a.40.5")!==-1?n="mp4a.40.2":n="mp4a.40.5"),n}_loadBitrateTestFrag(e,n){e.bitrateTest=!0,this._doFragLoad(e,n).then(r=>{const{hls:s}=this,i=r==null?void 0:r.frag;if(!i||this.fragContextChanged(i))return;n.fragmentError=0,this.state=Ct.IDLE,this.startFragRequested=!1,this.bitrateTest=!1;const o=i.stats;o.parsing.start=o.parsing.end=o.buffering.start=o.buffering.end=self.performance.now(),s.trigger(oe.FRAG_LOADED,r),i.bitrateTest=!1}).catch(r=>{this.state===Ct.STOPPED||this.state===Ct.ERROR||(this.warn(r),this.resetFragmentLoading(e))})}_handleTransmuxComplete(e){const n=this.playlistType,{hls:r}=this,{remuxResult:s,chunkMeta:i}=e,o=this.getCurrentContext(i);if(!o){this.resetWhenMissingContext(i);return}const{frag:l,part:c,level:d}=o,{video:u,text:h,id3:m,initSegment:f}=s,{details:p}=d,g=this.altAudio?void 0:s.audio;if(this.fragContextChanged(l)){this.fragmentTracker.removeFragment(l);return}if(this.state=Ct.PARSING,f){const v=f.tracks;if(v){const k=l.initSegment||l;if(this.unhandledEncryptionError(f,l))return;this._bufferInitSegment(d,v,k,i),r.trigger(oe.FRAG_PARSING_INIT_SEGMENT,{frag:k,id:n,tracks:v})}const b=f.initPTS,x=f.timescale,w=this.initPTS[l.cc];if(xn(b)&&(!w||w.baseTime!==b||w.timescale!==x)){const k=f.trackId;this.initPTS[l.cc]={baseTime:b,timescale:x,trackId:k};const S=this.initPTS.slice(0);r.trigger(oe.INIT_PTS_FOUND,{timestampOffsets:S,frag:l,id:n,initPTS:b,timescale:x,trackId:k})}}if(u&&p){g&&u.type==="audiovideo"&&this.logMuxedErr(l);const v=p.fragments[l.sn-1-p.startSN],b=l.sn===p.startSN,x=!v||l.cc>v.cc;if(s.independent!==!1){const{startPTS:w,endPTS:k,startDTS:S,endDTS:C}=u;if(c)c.elementaryStreams[u.type]={startPTS:w,endPTS:k,startDTS:S,endDTS:C};else if(u.firstKeyFrame&&u.independent&&i.id===1&&!x&&(this.couldBacktrack=!0),u.dropped&&u.independent){const j=this.getMainFwdBufferInfo(),E=(j?j.end:this.getLoadPosition())+this.config.maxBufferHole,N=u.firstKeyFramePTS?u.firstKeyFramePTS:w;if(!b&&E<N-this.config.maxBufferHole&&!x){this.backtrack(l);return}else x&&(l.gap=!0);l.setElementaryStreamInfo(u.type,l.start,k,l.start,C,!0)}else b&&w-(p.appliedTimelineOffset||0)>tq&&(l.gap=!0);l.setElementaryStreamInfo(u.type,w,k,S,C),this.backtrackFragment&&(this.backtrackFragment=l),this.bufferFragmentData(u,l,c,i,b||x)}else if(b||x)l.gap=!0;else{this.backtrack(l);return}}if(g){const{startPTS:v,endPTS:b,startDTS:x,endDTS:w}=g;c&&(c.elementaryStreams[na.AUDIO]={startPTS:v,endPTS:b,startDTS:x,endDTS:w}),l.setElementaryStreamInfo(na.AUDIO,v,b,x,w),this.bufferFragmentData(g,l,c,i)}if(p&&m!=null&&m.samples.length){const v={id:n,frag:l,details:p,samples:m.samples};r.trigger(oe.FRAG_PARSING_METADATA,v)}if(p&&h){const v={id:n,frag:l,details:p,samples:h.samples};r.trigger(oe.FRAG_PARSING_USERDATA,v)}}logMuxedErr(e){this.warn(`${Oo(e)?"Media":"Init"} segment with muxed audiovideo where only video expected: ${e.url}`)}_bufferInitSegment(e,n,r,s){if(this.state!==Ct.PARSING)return;this.audioOnly=!!n.audio&&!n.video,this.altAudio&&!this.audioOnly&&(delete n.audio,n.audiovideo&&this.logMuxedErr(r));const{audio:i,video:o,audiovideo:l}=n;if(i){const d=e.audioCodec;let u=ZW(i.codec,d);if(u==="mp4a"&&(u="mp4a.40.5"),this.audioCodecSwitch){u&&(u.indexOf("mp4a.40.5")!==-1?u="mp4a.40.2":u="mp4a.40.5");const h=i.metadata;h&&"channelCount"in h&&(h.channelCount||1)!==1&&!QJn()&&(u="mp4a.40.5")}u&&u.indexOf("mp4a.40.5")!==-1&&JJn()&&i.container!=="audio/mpeg"&&(u="mp4a.40.2",this.log(`Android: force audio codec to ${u}`)),d&&d!==u&&this.log(`Swapping manifest audio codec "${d}" for "${u}"`),i.levelCodec=u,i.id=Wn.MAIN,this.log(`Init audio buffer, container:${i.container}, codecs[selected/level/parsed]=[${u||""}/${d||""}/${i.codec}]`),delete n.audiovideo}if(o){o.levelCodec=e.videoCodec,o.id=Wn.MAIN;const d=o.codec;if((d==null?void 0:d.length)===4)switch(d){case"hvc1":case"hev1":o.codec="hvc1.1.6.L120.90";break;case"av01":o.codec="av01.0.04M.08";break;case"avc1":o.codec="avc1.42e01e";break}this.log(`Init video buffer, container:${o.container}, codecs[level/parsed]=[${e.videoCodec||""}/${d}]${o.codec!==d?" parsed-corrected="+o.codec:""}${o.supplemental?" supplemental="+o.supplemental:""}`),delete n.audiovideo}l&&(this.iframesOnly&&this.logMuxedErr(r),this.log(`Init audiovideo buffer, container:${l.container}, codecs[level/parsed]=[${e.codecs}/${l.codec}]`),delete n.video,delete n.audio);const c=Object.keys(n);if(c.length){if(this.hls.trigger(oe.BUFFER_CODECS,n),!this.hls)return;c.forEach(d=>{const h=n[d].initSegment;h!=null&&h.byteLength&&this.hls.trigger(oe.BUFFER_APPENDING,{type:d,data:h,frag:r,part:null,chunkMeta:s,parent:r.type})})}this.tickImmediate()}getMainFwdBufferInfo(){const e=this.getBufferOutput();return this.getFwdBufferInfo(e,Wn.MAIN)}get maxBufferLength(){const{levels:e,level:n}=this,r=e==null?void 0:e[n];return r?this.getMaxBufferLength(r.maxBitrate):this.config.maxBufferLength}backtrack(e){this.couldBacktrack=!0,this.backtrackFragment=e,this.resetTransmuxer(),this.flushBufferGap(e),this.fragmentTracker.removeFragment(e),this.fragPrevious=null,this.nextLoadPosition=e.start,this.state=Ct.IDLE}get nextLevel(){const e=this.nextBufferedFrag;return e?e.level:-1}get currentFrag(){var e;if(this.fragPlaying)return this.fragPlaying;const n=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;return xn(n)?this.getAppendedFrag(n):null}get currentProgramDateTime(){var e;const n=((e=this.media)==null?void 0:e.currentTime)||this.lastCurrentTime;if(xn(n)){const r=this.getLevelDetails(),s=this.currentFrag||(r?UR(null,r.fragments,n):null);if(s){const i=s.programDateTime;if(i!==null){const o=i+(n-s.start)*1e3;return new Date(o)}}}return null}get currentLevel(){const e=this.currentFrag;return e?e.level:-1}get nextBufferedFrag(){const e=this.currentFrag;return e?this.followingBufferedFrag(e):null}get forceStartLoad(){return this._forceStartLoad}}class GSt extends HSt{constructor(...e){super(...e),this.currentOp=void 0,this.nextOp=void 0,this.cached=[],this.cachedSize=0,this.cacheFragmentData=!0,this.initDetails=void 0,this.onBufferedToEnd=()=>{const n=this.media;n!=null&&n.seeking&&(n.currentTime=n.currentTime)},this.onMediaSeeking=()=>{}}setInitPts(e){this.initPTS=e.slice()}loadMediaAt(e,n){if(!this.hls)return;const{seekOnAppend:r}=n,s=e+this.timelineOffset;switch(this.nextLoadPosition=this.lastCurrentTime=s,this.startPosition=e,this.state){case Ct.STOPPED:case Ct.ENDED:case Ct.ERROR:this.state=Ct.IDLE}this.state===Ct.IDLE?(this.hls.resumeBuffering(),this.tick(),this.currentOp=[s,n]):this.nextOp=[s,n],this.hls.off(oe.BUFFERED_TO_END,this.onBufferedToEnd);const i=this.media;r&&i&&this.seekTo(s)&&(this.currentOp=[s,n],this.nextOp=void 0,this.flushPipeline(s,!0))}seekTo(e){const n=this.media;if(n){var r;const s=(r=this.getLevelDetails())==null?void 0:r.edge,i=s!==void 0?s:n.duration;if(e>=i&&(e=i-.01),Rr.bufferInfo(n,e,0).len>0&&this.getBufferedAt(e))return n.currentTime=e,!0}return!1}getBufferedAt(e){return this.fragmentTracker.getBufferedFrag(e,Wn.MAIN)}cacheSet(e,n){if(!this.hls)return;e.data=n;const r=this.cached;r.push(e),this.cachedSize+=n.buffer.byteLength;const s=this.hls.config.iframeCacheLimit;for(;this.cachedSize>s&&r.length>1;){const i=r.shift();if(i.data)this.cachedSize-=i.data.byteLength,i.data=void 0;else{this.cached=r.filter(o=>!!o.data),this.cachedSize=r.reduce((o,{data:l})=>l?l.buffer.byteLength:0,0);break}}}onHandlerDestroying(){this.cached.length=0,this.cachedSize=0,super.onHandlerDestroying()}_handleFragmentLoadProgress(e){const n=e.frag,{part:r,payload:s}=e;this.cacheFragmentData&&!r&&s!=null&&s.byteLength&&!n.data&&Oo(n)&&this.cacheSet(n,new Uint8Array(s.slice(0))),super._handleFragmentLoadProgress(e)}loadFragment(e,n,r){const s=this.fragmentTracker.getState(e);if((s===po.NOT_LOADED||s===po.PARTIAL)&&this.canReplayCached(e)){this.replayCachedFragment(e);return}super.loadFragment(e,n,r)}canReplayCached(e){var n;if(!this.cacheFragmentData||!((n=e.data)!=null&&n.byteLength))return!1;const r=e.decryptdata;return(r==null?void 0:r.keyFormat)!=="identity"||!!r.key}replayCachedFragment(e){const n=e.data.slice().buffer;this.log(`Buffering cached ${e.type} sn: ${e.sn} of level ${e.level} (${n.byteLength} bytes)`),this.fragCurrent=e,this.startFragRequested=!0;const r=e.stats=new r_e;r.loading.start=r.loading.first=r.loading.end=self.performance.now(),r.loaded=r.total=n.byteLength,r.chunkCount=1,this.state=Ct.FRAG_LOADING;const s={frag:e,part:null,payload:n,networkDetails:null};this._handleFragmentLoadProgress(s),this.hls.trigger(oe.FRAG_LOADED,s),this._handleFragmentLoadComplete(s)}fragBufferedComplete(e,n){super.fragBufferedComplete(e,n);const{currentOp:r,nextOp:s}=this;this.currentOp=this.nextOp=void 0,this.state=Ct.STOPPED,r!=null&&r[1].seekOnAppend&&(this.flushPipeline(r[0],!s),this.seekTo(r[0])||this.log(`Could not seek to ${r[0]} after fragment buffered (superseded or flushed) buffer: ${this.media?dZ(Rr.getBuffered(this.media)):"none"}`)),s&&this.loadMediaAt.apply(this,s)}flushPipeline(e,n){if(n){const r=this.media;if(r){const s=Rr.bufferInfo(r,e,0),i=s.len?s.nextStart:0;i&&(this.fragmentTracker.removeFragmentsInRange(i,1/0,Wn.MAIN),this.flushMainBuffer(i,1/0))}this.hls.once(oe.BUFFERED_TO_END,this.onBufferedToEnd)}this.hls.trigger(oe.BUFFER_EOS,{type:"video"})}get playhead(){return this.nextLoadPosition}startLoad(){if(!this.startFragRequested){const e=this.hls;e.nextLoadLevel=e.startLevel===-1?0:e.firstAutoLevel}}seekToStartPos(){}setStartPosition(){}alignPlaylists(e,n,r){const s=this.initDetails;return this.initDetails=null,super.alignPlaylists(e,n,r||s||void 0)}getMainFwdBufferInfo(){const e=this.playhead,n=this.getBufferedAt(e);if(n){const r=n.duration;return{len:r,start:e,end:e+r,bufferedIndex:-1}}return{len:0,start:e,end:e,bufferedIndex:-1}}_streamEnded(){const e=this.playhead,n=this.fragmentTracker.getBufferedFrag(e,Wn.MAIN);return!!(n!=null&&n.endList)}}class qnr extends GSt{constructor(...e){super(...e),this._img=void 0,this.queued=void 0,this.cacheFragmentData=!1}get image(){return this._img}set image(e){var n;const r=(n=this._img)==null?void 0:n.src;r&&self.URL.revokeObjectURL(r),this._img=e}loadMediaAt(e){if(!this.hls)return;const n=e+this.timelineOffset;switch(this.nextLoadPosition=this.lastCurrentTime=n,this.startPosition=e,this.state){case Ct.STOPPED:case Ct.ENDED:case Ct.ERROR:this.state=Ct.IDLE}if(this.state===Ct.IDLE){if(this.hls.resumeBuffering(),this.media||(this.media={}),this.tick(),this.state===Ct.IDLE){const r=this.getBufferedAt(e);r&&(this.fragCurrent=r,this.updateImage(r,null))}}else{const r=this.fragCurrent;(!r||e>=r.start&&e<r.end)&&(this.queued=[n])}}updateImage(e,n,r){const s=e.data;s||this.fragmentTracker.removeFragment(e);const i=this._img;if(i&&s){const o=self.performance.now(),l=n?n.stats:e.stats;l.buffering.start=e.stats.buffering.start=o,i.onload=()=>{if(!this.hls)return;const u=this.hls.levels[e.level];u!=null&&u.fragmentError&&(u.fragmentError=0,e.stats.retry=0);const h=self.performance.now(),m=n?n.stats:e.stats;m.buffering.end=e.stats.buffering.end=h,this.hls.trigger(oe.FRAG_BUFFERED,{frag:e,part:n,stats:m,id:e.type,chunkMeta:r})},i.onerror=()=>{this.handleError("Image decode error",e,n,r)};const c=i.src;c&&self.URL.revokeObjectURL(c);const d=new Blob([s],{type:"image/jpeg"});i.src=self.URL.createObjectURL(d)}else this.state=Ct.STOPPED,this.processQueued()}processQueued(){const e=this.queued;this.queued=void 0,e&&this.loadMediaAt.apply(this,e)}handleError(e,n,r,s){if(!this.hls)return;const i=new Error(e);this.hls.trigger(oe.ERROR,{type:er.MEDIA_ERROR,details:rt.FRAG_PARSING_ERROR,chunkMeta:s,frag:n,part:r,fatal:!1,error:i,err:i})}_bufferInitSegment(){}bufferFragmentData(e,n,r,s){super.bufferFragmentData(e,n,r,s,!0);const i=Gr(new Uint8Array(e.data1),["mdat"]);if(i.length===0){this.handleError("Could not find I-Frame mdat",n,r,s);return}const o=n;this.cacheSet(o,i[0]),this.updateImage(o,r,s)}fragBufferedComplete(e,n){this.fragmentTracker.fragBuffered(e,!0),super.fragBufferedComplete(e,n),this.processQueued()}checkFragPlaying(){var e;const n=(e=this.fragPrevious)==null?void 0:e.start;if(n!==void 0){const r=this.getAppendedFrag(n);if(r&&!Z4(r,this.fragPlaying))return this.fragPlaying=r,!0}return!1}getMainFwdBufferInfo(){return{len:0,start:this.playhead,end:this.playhead,bufferedIndex:-1}}}const Knr=10,Ynr="Image I-Frame player does not accept HTMLMediaElements",cze={seekOnAppend:!0};let kV,Mde;class Qnr extends Fm{constructor(e,n){super("iframes",e.logger),this.hls=void 0,this.stats=void 0,this.variableList=null,this.initPTS=[],this.iframeInstances=void 0,this.instanceCounter=0,kV||(kV=Znr(n)),Mde||(Mde=Jnr(kV)),this.hls=e,this.iframeInstances=[],this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(oe.MANIFEST_LOADING,this.clearAsset,this),e.on(oe.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(oe.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(oe.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(oe.FRAG_BUFFERED,this.onFragBuffered,this),e.on(oe.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(oe.MANIFEST_LOADING,this.clearAsset,this),e.off(oe.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(oe.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(oe.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(oe.FRAG_BUFFERED,this.onFragBuffered,this),e.off(oe.DESTROYING,this.onDestroying,this))}clearAsset(){this.stats=void 0,this.variableList=null,this.initPTS=[],this.iframeInstances.forEach(e=>e.destroy()),this.iframeInstances.length=0}onDestroying(){this.unregisterListeners(),this.clearAsset(),this.hls=void 0}onManifestLoaded(e,n){this.stats=n.stats,this.variableList=n.variableList}onLevelsUpdated(e,{levels:n}){var r;const s=(r=this.hls)==null?void 0:r.pathwayPriority;n.length&&s&&this.iframeInstances.forEach(i=>{i.pathwayPriority=s})}onInitPtsFound(e,{id:n,timestampOffsets:r}){n===Wn.MAIN&&(this.initPTS=r)}onFragBuffered(e,n){var r;const s=this.hls;s&&s.hasEnoughToStart&&(((r=s.mainForwardBufferInfo)==null?void 0:r.len)||0)>Knr&&this.iframeInstances.forEach(i=>{if(!i.loadingEnabled){var o;i.startLoad(((o=this.hls)==null||(o=o.media)==null?void 0:o.currentTime)||0)}})}createIFramePlayer(e){var n;return this.createInstance(kV,(n=this.hls)==null?void 0:n.iframeVariants,e)}createImageIFramePlayer(e){var n;const r=(n=this.hls)==null?void 0:n.iframeVariants.filter(s=>s.imageCodec);return this.createInstance(Mde,r,e,"image-")}createInstance(e,n,r,s){const{hls:i}=this;if(!i)return null;const{url:o,userConfig:l,latestLevelDetails:c,loadLevelObj:d,loadLevel:u,bandwidthEstimate:h,sessionId:m}=i,{stats:f,variableList:p}=this;if(!(n!=null&&n.length)||!f||!o)return null;const g=`${s||""}iframe-player-${this.instanceCounter++}`,v=i.levels,b=d||v[u],x=_kt(b,l.videoPreference),w=(b==null?void 0:b.pathwayId)||".",k=rr(rr({},l),{},{loggerId:g,primarySessionId:m,videoPreference:x,abrEwmaDefaultEstimate:h,streamController:void 0,audioStreamController:void 0,audioTrackController:void 0,subtitleStreamController:void 0,subtitleTrackController:void 0,timelineController:void 0,id3TrackController:void 0,fpsController:void 0,gapController:void 0,iframeController:void 0,cmcd:void 0,interstitialsController:void 0,backBufferLength:1/0,maxMaxBufferLength:1,capLevelToPlayerSize:!0,enableWorker:!1,autoStartLoad:!1,startFragPrefetch:!1,testBandwidth:!1,progressive:!1},r),S=new e(k,o,this.initPTS,c);return this.iframeInstances=this.iframeInstances.filter(C=>!C.url),this.iframeInstances.push(S),S.trigger(oe.MANIFEST_LOADED,{levels:n,contentSteering:{uri:"",pathwayId:w},sessionKeys:null,audioTracks:[],iframeVariants:[],sessionData:null,startTimeOffset:null,stats:f,networkDetails:null,url:o,variableList:p}),S}}function Znr(t){return class extends t{constructor(n,r,s,i){n.streamController||(n.streamController=GSt),super(n),this._url=r,this.streamController.setInitPts(s),this.streamController.initDetails=i}loadSource(){}loadMediaAt(n,r=cze){if(n<0)return;const s=rr(rr({},cze),r);this.loadingEnabled||this.startLoad(n),this.streamController.loadMediaAt(n,s)}}}function Jnr(t){return class extends t{constructor(n,r,s,i){n.cmcdController=void 0,n.emeController=void 0,n.streamController||(n.streamController=qnr),n.capLevelController=void 0,n.bufferController=void 0,super(n,r,s,i)}attachImage(n){this.streamController.image=n}detachImage(){this.streamController.image=void 0}loadSource(){}attachMedia(){throw new Error(Ynr)}detachMedia(){}recoverMediaError(){}transferMedia(){return null}loadMediaAt(n){if(n<0)return null;this.loadingEnabled||this.startLoad(n),this.streamController.loadMediaAt(n)}}}const ik=.025;let pZ=function(t){return t[t.Point=0]="Point",t[t.Range=1]="Range",t}({});function Xnr(t,e,n){return`${t.identifier}-${n+1}-${w$(e)}`}class err{constructor(e,n){this.base=void 0,this._duration=null,this._timelineStart=null,this.appendInPlaceDisabled=void 0,this.appendInPlaceStarted=void 0,this.dateRange=void 0,this.hasPlayed=!1,this.cumulativeDuration=0,this.resumeOffset=NaN,this.playoutLimit=NaN,this.restrictions={skip:!1,jump:!1},this.snapOptions={out:!1,in:!1},this.assetList=[],this.assetListLoader=void 0,this.assetListResponse=null,this.resumeAnchor=void 0,this.error=void 0,this.resetOnResume=void 0,this.base=n,this.dateRange=e,this.setDateRange(e)}setDateRange(e){this.dateRange=e,this.resumeOffset=e.attr.optionalFloat("X-RESUME-OFFSET",this.resumeOffset),this.playoutLimit=e.attr.optionalFloat("X-PLAYOUT-LIMIT",this.playoutLimit),this.restrictions=e.attr.enumeratedStringList("X-RESTRICT",this.restrictions),this.snapOptions=e.attr.enumeratedStringList("X-SNAP",this.snapOptions)}reset(){var e;this.appendInPlaceStarted=!1,(e=this.assetListLoader)==null||e.destroy(),this.assetListLoader=void 0,this.supplementsPrimary||(this.assetListResponse=null,this.assetList=[],this._duration=null)}isAssetPastPlayoutLimit(e){var n;if(e>0&&e>=this.assetList.length)return!0;const r=this.playoutLimit;return e<=0||isNaN(r)?!1:r===0?!0:(((n=this.assetList[e])==null?void 0:n.startOffset)||0)>r}findAssetIndex(e){return this.assetList.indexOf(e)}get identifier(){return this.dateRange.id}get startDate(){return this.dateRange.startDate}get startTime(){const e=this.dateRange.startTime;if(this.snapOptions.out){const n=this.dateRange.tagAnchor;if(n)return dze(n,e)?nq(e,n):e}return e}get startOffset(){return this.cue.pre?0:this.startTime}get startIsAligned(){if(this.startTime===0||this.snapOptions.out)return!0;const e=this.dateRange.tagAnchor;if(e){const n=this.dateRange.startTime,r=nq(n,e);return n-r<.1}return!1}get resumptionOffset(){const e=this.resumeOffset,n=xn(e)?e:this.duration;return this.cumulativeDuration+n}get resumeTime(){const e=this.startOffset+this.resumptionOffset;if(this.snapOptions.in){const n=this.resumeAnchor;if(n)return dze(n,e)?nq(e,n):e}return e}get appendInPlace(){return this.appendInPlaceStarted?!0:this.appendInPlaceDisabled?!1:!!(!this.cue.once&&!this.cue.pre&&this.startIsAligned&&(isNaN(this.playoutLimit)&&isNaN(this.resumeOffset)||this.resumeOffset&&this.duration&&Math.abs(this.resumeOffset-this.duration)<ik))}set appendInPlace(e){if(this.appendInPlaceStarted){this.resetOnResume=!e;return}this.appendInPlaceDisabled=!e}get timelineStart(){return this._timelineStart!==null?this._timelineStart:this.startTime}set timelineStart(e){this._timelineStart=e}get duration(){const e=this.playoutLimit;let n;return this._duration!==null?n=this._duration:this.dateRange.duration?n=this.dateRange.duration:n=this.dateRange.plannedDuration||0,!isNaN(e)&&e<n&&(n=e),n}set duration(e){this._duration=e}get cue(){return this.dateRange.cue}get timelineOccupancy(){return this.dateRange.attr["X-TIMELINE-OCCUPIES"]==="RANGE"?pZ.Range:pZ.Point}get supplementsPrimary(){return this.dateRange.attr["X-TIMELINE-STYLE"]==="PRIMARY"}get contentMayVary(){return this.dateRange.attr["X-CONTENT-MAY-VARY"]!=="NO"}get assetUrl(){return this.dateRange.attr["X-ASSET-URI"]}get assetListUrl(){return this.dateRange.attr["X-ASSET-LIST"]}get baseUrl(){return this.base.url}get assetListLoaded(){return this.assetList.length>0||this.assetListResponse!==null}toString(){return trr(this)}}function nq(t,e){return t-e.start<e.duration/2&&!(Math.abs(t-(e.start+e.duration))<ik)?e.start:e.start+e.duration}function dze(t,e){return e>t.start-ik&&e<t.start+t.duration+ik}function WSt(t,e,n){const r=new self.URL(t,n);return r.protocol!=="data:"&&sk(r,"_HLS_primary_id",e),r}function Lde(t,e){for(;(n=t.assetList[++e])!=null&&n.error;)var n;return e}function trr(t){return`["${t.identifier}" ${t.cue.pre?"<pre>":t.cue.post?"<post>":""}${t.timelineStart.toFixed(2)}-${t.resumeTime.toFixed(2)}]`}function M_(t){const e=t.timelineStart,n=t.duration||0;return`["${t.identifier}" ${e.toFixed(2)}-${(e+n).toFixed(2)}]`}class nrr{constructor(e,n,r,s){this.hls=void 0,this.interstitial=void 0,this.assetItem=void 0,this.tracks=null,this.hasDetails=!1,this.mediaAttached=null,this._currentTime=void 0,this._bufferedEosTime=void 0,this.checkPlayout=()=>{this.reachedPlayout(this.currentTime)&&this.hls&&this.hls.trigger(oe.PLAYOUT_LIMIT_REACHED,{})};const i=this.hls=new e(n);this.interstitial=r,this.assetItem=s;const o=()=>{this.hasDetails=!0};i.once(oe.LEVEL_LOADED,o),i.once(oe.AUDIO_TRACK_LOADED,o),i.once(oe.SUBTITLE_TRACK_LOADED,o),i.on(oe.MEDIA_ATTACHING,(l,{media:c})=>{this.removeMediaListeners(),this.mediaAttached=c,this.interstitial.playoutLimit&&(c.addEventListener("timeupdate",this.checkPlayout),this.appendInPlace&&i.on(oe.BUFFER_APPENDED,()=>{const u=this.bufferedEnd;this.reachedPlayout(u)&&(this._bufferedEosTime=u,i.trigger(oe.BUFFERED_TO_END,void 0))}))})}get appendInPlace(){return this.interstitial.appendInPlace}loadSource(){const e=this.hls;if(e)if(e.url)e.levels.length&&!e.started&&e.startLoad(-1,!0);else{let n=this.assetItem.uri;try{n=WSt(n,e.config.primarySessionId||"").href}catch{}e.loadSource(n)}}bufferedInPlaceToEnd(e,n){var r;if(!this.appendInPlace)return!1;if((r=this.hls)!=null&&r.bufferedToEnd)return!0;if(!e)return!1;const s=Math.min(this._bufferedEosTime||1/0,this.duration),i=this.timelineOffset+(n||0),o=Rr.bufferInfo(e,i,.02);return this.getAssetTime(o.end)>=s-.02}reachedPlayout(e){const r=this.interstitial.playoutLimit;return this.startOffset+e>=r}get destroyed(){var e;return!((e=this.hls)!=null&&e.userConfig)}get assetId(){return this.assetItem.identifier}get interstitialId(){return this.assetItem.parentIdentifier}get media(){var e;return((e=this.hls)==null?void 0:e.media)||null}get bufferedEnd(){const e=this.media||this.mediaAttached;if(!e)return this._bufferedEosTime?this._bufferedEosTime:this.currentTime;const n=Rr.bufferInfo(e,e.currentTime,.001);return this.getAssetTime(n.end)}get currentTime(){const e=this.media||this.mediaAttached;return e?this.getAssetTime(e.currentTime):this._currentTime||0}get duration(){const e=this.assetItem.duration;if(!e)return 0;const n=this.interstitial.playoutLimit;if(n){const r=n-this.startOffset;if(r>0&&r<e)return r}return e}get remaining(){const e=this.duration;return e?Math.max(0,e-this.currentTime):0}get startOffset(){return this.assetItem.startOffset}get timelineOffset(){var e;return((e=this.hls)==null?void 0:e.config.timelineOffset)||0}set timelineOffset(e){const n=this.timelineOffset;if(e!==n){const r=e-n;if(Math.abs(r)>1/9e4&&this.hls){if(this.hasDetails)throw new Error("Cannot set timelineOffset after playlists are loaded");this.hls.config.timelineOffset=e}}}getAssetTime(e){const n=this.timelineOffset,r=this.duration;return Math.min(Math.max(0,e-n),r)}removeMediaListeners(){const e=this.mediaAttached;e&&(this._currentTime=e.currentTime,this.bufferSnapShot(),e.removeEventListener("timeupdate",this.checkPlayout))}bufferSnapShot(){if(this.mediaAttached){var e;(e=this.hls)!=null&&e.bufferedToEnd&&(this._bufferedEosTime=this.bufferedEnd)}}destroy(){this.removeMediaListeners(),this.hls&&this.hls.destroy(),this.hls=null,this.tracks=this.mediaAttached=this.checkPlayout=null}attachMedia(e){var n;this.loadSource(),(n=this.hls)==null||n.attachMedia(e)}detachMedia(){var e;this.removeMediaListeners(),this.mediaAttached=null,(e=this.hls)==null||e.detachMedia()}resumeBuffering(){var e;(e=this.hls)==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.hls)==null||e.pauseBuffering()}transferMedia(){var e;return this.bufferSnapShot(),((e=this.hls)==null?void 0:e.transferMedia())||null}resetDetails(){const e=this.hls;if(e&&this.hasDetails){e.stopLoad();const n=r=>delete r.details;e.levels.forEach(n),e.allAudioTracks.forEach(n),e.allSubtitleTracks.forEach(n),this.hasDetails=!1}}on(e,n,r){var s;(s=this.hls)==null||s.on(e,n)}once(e,n,r){var s;(s=this.hls)==null||s.once(e,n)}off(e,n,r){var s;(s=this.hls)==null||s.off(e,n)}toString(){var e;return`HlsAssetPlayer: ${M_(this.assetItem)} ${(e=this.hls)==null?void 0:e.sessionId} ${this.appendInPlace?"append-in-place":""}`}}const Dde=.033;class rrr extends Fm{constructor(e,n){super("interstitials-sched",n),this.onScheduleUpdate=void 0,this.eventMap={},this.events=null,this.items=null,this.durations={primary:0,playout:0,integrated:0},this.onScheduleUpdate=e}destroy(){this.reset(),this.onScheduleUpdate=null}reset(){this.eventMap={},this.setDurations(0,0,0),this.events&&this.events.forEach(e=>e.reset()),this.events=this.items=null}resetErrorsInRange(e,n){return this.events?this.events.reduce((r,s)=>e<=s.startOffset&&n>s.startOffset?(delete s.error,r+1):r,0):0}get duration(){const e=this.items;return e?e[e.length-1].end:0}get length(){return this.items?this.items.length:0}getEvent(e){return e&&this.eventMap[e]||null}hasEvent(e){return e in this.eventMap}findItemIndex(e,n){if(e.event)return this.findEventIndex(e.event.identifier);let r=-1;e.nextEvent?r=this.findEventIndex(e.nextEvent.identifier)-1:e.previousEvent&&(r=this.findEventIndex(e.previousEvent.identifier)+1);const s=this.items;if(s)for(s[r]||(n===void 0&&(n=e.start),r=this.findItemIndexAtTime(n));r>=0&&(i=s[r])!=null&&i.event;){var i;r--}return r}findItemIndexAtTime(e,n){const r=this.items;if(r)for(let s=0;s<r.length;s++){let i=r[s];n&&n!=="primary"&&(i=i[n]);const o=i.start,l=r[s].event,c=l!=null&&l.cue.pre?l.duration:i.end;if(e===o||e>o&&e<c)return s}return-1}findJumpRestrictedIndex(e,n){const r=this.items;if(r)for(let s=e;s<=n&&r[s];s++){const i=r[s].event;if(i!=null&&i.restrictions.jump&&!i.appendInPlace)return s}return-1}findEventIndex(e){const n=this.items;if(n)for(let s=n.length;s--;){var r;if(((r=n[s].event)==null?void 0:r.identifier)===e)return s}return-1}findAssetIndex(e,n){const r=e.assetList,s=r.length;if(s>1)for(let i=0;i<s;i++){const o=r[i];if(!o.error){const l=o.timelineStart;if(n===l||n>l&&(n<l+(o.duration||0)||i===s-1))return i}}return 0}get assetIdAtEnd(){var e;const n=(e=this.items)==null||(e=e[this.length-1])==null?void 0:e.event;if(n){const r=n.assetList,s=r[r.length-1];if(s)return s.identifier}return null}parseInterstitialDateRanges(e,n,r=0){const s=e.main.details,{dateRanges:i}=s,o=this.events,l=this.parseDateRanges(i,{url:s.url},n),c=Object.keys(i),d=o?o.filter(u=>c.indexOf(u.identifier)===-1):[];l.length&&l.sort((u,h)=>{const m=u.cue.pre,f=u.cue.post,p=h.cue.pre,g=h.cue.post;if(m&&!p)return-1;if(p&&!m||f&&!g)return 1;if(g&&!f)return-1;if(!m&&!p&&!f&&!g){const v=u.startTime,b=h.startTime;if(v!==b)return v-b}return u.dateRange.tagOrder-h.dateRange.tagOrder}),this.events=l,d.forEach(u=>{this.removeEvent(u)}),this.updateSchedule(e,d,r)}updateSchedule(e,n=[],r=0,s=!1){const i=this.events||[];if(i.length||n.length||this.length<2){const o=this.items,l=this.parseSchedule(i,e,r);(s||n.length||(o==null?void 0:o.length)!==l.length||l.some((d,u)=>Math.abs(d.playout.start-o[u].playout.start)>.005||Math.abs(d.playout.end-o[u].playout.end)>.005))&&(this.items=l,this.onScheduleUpdate(n,o))}}parseDateRanges(e,n,r){const s=[],i=Object.keys(e);for(let o=0;o<i.length;o++){const l=i[o],c=e[l];if(c.isInterstitial){let d=this.eventMap[l];d?d.setDateRange(c):(d=new err(c,n),this.eventMap[l]=d,r===!1&&(d.appendInPlace=r)),s.push(d)}}return s}parseSchedule(e,n,r=0){const s=[],i=n.main.details,o=i.live?1/0:i.edge;let l=0;if(e=e.filter(d=>!d.error&&!(d.cue.once&&d.hasPlayed)),e.length){this.resolveOffsets(e,n);let d=0,u=0;if(e.forEach((h,m)=>{const f=h.cue.pre,p=h.cue.post,g=e[m-1]||null,v=h.appendInPlace,b=p?o:h.startOffset,x=h.duration,w=h.timelineOccupancy===pZ.Range?x:0,k=f&&i.live?r+(h.resumeOffset||0):0,S=k||h.resumptionOffset,C=(g==null?void 0:g.startTime)===b,j=b+h.cumulativeDuration;let E=v?j+x:b+S;if(f||!p&&b<=0){const A=u;u+=w,h.timelineStart=j;const _=l;l+=x,s.push({event:h,start:j,end:E,playout:{start:_,end:l},integrated:{start:A,end:u}})}else if(b<=o){if(!C){const T=b-d;if(T>Dde){const R=d,O=u;u+=T;const F=l;l+=T;const D={previousEvent:e[m-1]||null,nextEvent:h,start:R,end:R+T,playout:{start:F,end:l},integrated:{start:O,end:u}};s.push(D)}else T>0&&g&&(g.cumulativeDuration+=T,s[s.length-1].end=b)}p&&(E=j),h.timelineStart=j;const A=u;u+=w;const _=l;l+=x,s.push({event:h,start:j,end:E,playout:{start:_,end:l},integrated:{start:A,end:u}})}else return;const N=k||h.resumeTime;p||N>o?d=o:!f&&E&&h.appendInPlaceStarted&&N-E>Dde?d=E:d=N}),d<o){var c;const h=d,m=u,f=o-d;u+=f;const p=l;l+=f,s.push({previousEvent:((c=s[s.length-1])==null?void 0:c.event)||null,nextEvent:null,start:d,end:h+f,playout:{start:p,end:l},integrated:{start:m,end:u}})}this.setDurations(o,l,u)}else s.push({previousEvent:null,nextEvent:null,start:0,end:o,playout:{start:0,end:o},integrated:{start:0,end:o}}),this.setDurations(o,o,o);return s}setDurations(e,n,r){this.durations={primary:e,playout:n,integrated:r}}resolveOffsets(e,n){const r=n.main.details,s=r.live?1/0:r.edge;let i=0,o=-1;e.forEach((l,c)=>{const d=l.cue.pre,u=l.cue.post,h=d?0:u?s:l.startTime;this.updateAssetDurations(l),o===h?l.cumulativeDuration=i:(i=0,o=h),!u&&l.snapOptions.in&&(l.resumeAnchor=UR(null,r.fragments,l.startOffset+l.resumptionOffset,0,0)||void 0),l.appendInPlace&&!l.appendInPlaceStarted&&(this.primaryCanResumeInPlaceAt(l,n)||(l.appendInPlace=!1)),!l.appendInPlace&&c+1<e.length&&e[c+1].startTime-e[c].resumeTime<Dde&&(e[c+1].appendInPlace=!1,e[c+1].appendInPlace&&this.warn(`Could not change append strategy for abutting event ${l}`));const f=xn(l.resumeOffset)?l.resumeOffset:l.duration;i+=f})}primaryCanResumeInPlaceAt(e,n){const r=e.resumeTime,s=e.startTime+e.resumptionOffset;return Math.abs(r-s)>ik?(this.log(`"${e.identifier}" resumption ${r} not aligned with estimated timeline end ${s}`),!1):!Object.keys(n).some(o=>{const l=n[o].details,c=l.edge;if(r>=c)return this.log(`"${e.identifier}" resumption ${r} past ${o} playlist end ${c}`),!1;const d=UR(null,l.fragments,r);if(!d)return this.log(`"${e.identifier}" resumption ${r} does not align with any fragments in ${o} playlist (${l.fragStart}-${l.fragmentEnd})`),!0;const u=o==="audio"?.175:0;return Math.abs(d.start-r)<ik+u||Math.abs(d.end-r)<ik+u?!1:(this.log(`"${e.identifier}" resumption ${r} not aligned with ${o} fragment bounds (${d.start}-${d.end} sn: ${d.sn} cc: ${d.cc})`),!0)})}updateAssetDurations(e){if(!e.assetListLoaded)return;const n=e.timelineStart;let r=0,s=!1,i=!1;for(let o=0;o<e.assetList.length;o++){const l=e.assetList[o],c=n+r;l.startOffset=r,l.timelineStart=c,s||(s=l.duration===null),i||(i=!!l.error);const d=l.error?0:l.duration||0;r+=d}s&&!i?e.duration=Math.max(r,e.duration):e.duration=r}removeEvent(e){e.reset(),delete this.eventMap[e.identifier]}}function Oh(t){return`[${t.event?'"'+t.event.identifier+'"':"primary"}: ${t.start.toFixed(2)}-${t.end.toFixed(2)}]`}class srr{constructor(e){this.hls=void 0,this.hls=e}destroy(){this.hls=null}loadAssetList(e,n){const r=e.assetListUrl;let s;try{s=WSt(r,this.hls.sessionId,e.baseUrl)}catch(m){const f=this.assignAssetListError(e,rt.ASSET_LIST_LOAD_ERROR,m,r);this.hls.trigger(oe.ERROR,f);return}n&&s.protocol!=="data:"&&sk(s,"_HLS_start_offset",""+n);const i=this.hls.config,o=i.loader,l=new o(i),c={type:ks.INTERSTITIAL_ASSET_LIST,responseType:"json",url:s.href},d=i.interstitialAssetListLoadPolicy.default,u={loadPolicy:d,timeout:d.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},h={onSuccess:(m,f,p,g)=>{const v=m.data,b=v==null?void 0:v.ASSETS;if(!Array.isArray(b)){const x=this.assignAssetListError(e,rt.ASSET_LIST_PARSING_ERROR,new Error("Invalid interstitial asset list"),p.url,f,g);this.hls.trigger(oe.ERROR,x);return}e.assetListResponse=v,this.hls.trigger(oe.ASSET_LIST_LOADED,{event:e,assetListResponse:v,networkDetails:g})},onError:(m,f,p,g)=>{const v=this.assignAssetListError(e,rt.ASSET_LIST_LOAD_ERROR,new Error(`Error loading X-ASSET-LIST: HTTP status ${m.code} ${m.text} (${f.url})`),f.url,g,p);this.hls.trigger(oe.ERROR,v)},onTimeout:(m,f,p)=>{const g=this.assignAssetListError(e,rt.ASSET_LIST_LOAD_TIMEOUT,new Error(`Timeout loading X-ASSET-LIST (${f.url})`),f.url,m,p);this.hls.trigger(oe.ERROR,g)}};return l.load(c,u,h),this.hls.trigger(oe.ASSET_LIST_LOADING,{event:e}),l}assignAssetListError(e,n,r,s,i,o){return e.error=r,{type:er.NETWORK_ERROR,details:n,fatal:!1,interstitial:e,url:s,error:r,networkDetails:o,stats:i}}}function uze(t){var e;t==null||(e=t.play())==null||e.catch(()=>{})}function aC(t,e){return`[${t}] Advancing timeline position to ${e}`}class irr extends Fm{constructor(e,n){super("interstitials",e.logger),this.HlsPlayerClass=void 0,this.hls=void 0,this.assetListLoader=void 0,this.mediaSelection=null,this.altSelection=null,this.media=null,this.detachedData=null,this.requiredTracks=null,this.manager=null,this.playerQueue=[],this.bufferedPos=-1,this.timelinePos=-1,this.schedule=void 0,this.playingItem=null,this.bufferingItem=null,this.waitingItem=null,this.endedItem=null,this.playingAsset=null,this.endedAsset=null,this.bufferingAsset=null,this.bufferPastEdge=!1,this.shouldPlay=!1,this.onPlay=()=>{this.shouldPlay=!0},this.onPause=()=>{this.shouldPlay=!1},this.onSeeking=()=>{const r=this.currentTime;if(r===void 0||this.playbackDisabled||!this.schedule)return;const s=r-this.timelinePos;if(Math.abs(s)<1/7056e5)return;const o=s<=-.01;this.timelinePos===-1&&!this.effectivePlayingItem&&this.checkStart(),this.timelinePos=r,this.bufferedPos=r;const l=this.playingItem;if(!l){this.checkBuffer();return}if(o&&this.schedule.resetErrorsInRange(r,r-s)&&this.updateSchedule(!0),this.checkBuffer(),o&&r<l.start||r>=l.end){var c;const f=this.findItemIndex(l);let p=this.schedule.findItemIndexAtTime(r);if(p===-1&&(p=f+(o?-1:1),this.log(`seeked ${o?"back ":""}to position not covered by schedule ${r} (resolving from ${f} to ${p})`)),!this.isInterstitial(l)&&(c=this.media)!=null&&c.paused&&(this.shouldPlay=!1),!o&&p>f){const g=this.schedule.findJumpRestrictedIndex(f+1,p);if(g>f){this.setSchedulePosition(g);return}}this.setSchedulePosition(p);return}const d=this.playingAsset;if(!d){if(this.playingLastItem&&this.isInterstitial(l)){const f=l.event.assetList[0];f&&(this.endedItem=this.playingItem,this.playingItem=null,this.setScheduleToAssetAtTime(r,f))}return}const u=d.timelineStart,h=d.duration||0;if(o&&r<u||r>=u+h){var m;(m=l.event)!=null&&m.appendInPlace&&(this.clearAssetPlayers(l.event,l),this.flushFrontBuffer(r)),this.setScheduleToAssetAtTime(r,d)}},this.onTimeupdate=()=>{const r=this.currentTime;if(r===void 0||this.playbackDisabled)return;if(this.timelinePos===-1&&!this.effectivePlayingItem&&this.checkStart(),r>this.timelinePos)this.timelinePos=r,r>this.bufferedPos&&this.checkBuffer();else return;const s=this.playingItem;if(!s||this.playingLastItem)return;if(r>=s.end){this.timelinePos=s.end;const l=this.findItemIndex(s);this.setSchedulePosition(l+1)}const i=this.playingAsset;if(!i)return;const o=i.timelineStart+(i.duration||0);r>=o&&this.setScheduleToAssetAtTime(r,i)},this.onScheduleUpdate=(r,s)=>{const i=this.schedule;if(!i)return;const o=this.playingItem,l=i.events||[],c=i.items||[],d=i.durations,u=r.map(g=>g.identifier),h=!!(l.length||u.length);(h||s)&&this.log(`INTERSTITIALS_UPDATED (${l.length}): ${l}
Schedule: ${c.map(g=>Oh(g))} pos: ${this.timelinePos}`),u.length&&this.log(`Removed events ${u}`);let m=null,f=null;o&&(m=this.updateItem(o,this.timelinePos),this.itemsMatch(o,m)?this.playingItem=m:this.waitingItem=null),this.waitingItem=this.updateItem(this.waitingItem);const p=this.bufferingItem;if(p&&(f=this.updateItem(p,this.bufferedPos),this.itemsMatch(p,f)?this.bufferingItem=f:p.event&&(this.bufferingItem=this.playingItem,this.clearInterstitial(p.event,null))),r.forEach(g=>{g.assetList.forEach(v=>{this.clearAssetPlayer(v.identifier,null)})}),this.playerQueue.forEach(g=>{if(g.interstitial.appendInPlace){const v=g.assetItem.timelineStart,b=g.timelineOffset-v;if(b)try{g.timelineOffset=v}catch(x){Math.abs(b)>ik&&this.warn(`${x} ("${g.assetId}" ${g.timelineOffset}->${v})`)}}}),h||s){if(this.hls.trigger(oe.INTERSTITIALS_UPDATED,{events:l.slice(0),schedule:c.slice(0),durations:d,removedIds:u}),this.isInterstitial(o)&&u.indexOf(o.event.identifier)>-1){this.warn(`Interstitial "${o.event.identifier}" removed while playing`),this.primaryFallback(o.event);return}o&&this.trimInPlace(m,o),p&&f!==m&&this.trimInPlace(f,p),this.checkBuffer()}},this.hls=e,this.HlsPlayerClass=n,this.assetListLoader=new srr(e),this.schedule=new rrr(this.onScheduleUpdate,e.logger),this.registerListeners()}registerListeners(){const e=this.hls;e&&(e.on(oe.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(oe.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(oe.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.on(oe.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(oe.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.on(oe.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.on(oe.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(oe.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.on(oe.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.on(oe.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.on(oe.BUFFER_APPENDED,this.onBufferAppended,this),e.on(oe.BUFFER_FLUSHED,this.onBufferFlushed,this),e.on(oe.BUFFERED_TO_END,this.onBufferedToEnd,this),e.on(oe.MEDIA_ENDED,this.onMediaEnded,this),e.on(oe.ERROR,this.onError,this),e.on(oe.DESTROYING,this.onDestroying,this))}unregisterListeners(){const e=this.hls;e&&(e.off(oe.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(oe.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(oe.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.off(oe.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(oe.AUDIO_TRACK_SWITCHING,this.onAudioTrackSwitching,this),e.off(oe.AUDIO_TRACK_UPDATED,this.onAudioTrackUpdated,this),e.off(oe.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(oe.SUBTITLE_TRACK_UPDATED,this.onSubtitleTrackUpdated,this),e.off(oe.EVENT_CUE_ENTER,this.onInterstitialCueEnter,this),e.off(oe.ASSET_LIST_LOADED,this.onAssetListLoaded,this),e.off(oe.BUFFER_CODECS,this.onBufferCodecs,this),e.off(oe.BUFFER_APPENDED,this.onBufferAppended,this),e.off(oe.BUFFER_FLUSHED,this.onBufferFlushed,this),e.off(oe.BUFFERED_TO_END,this.onBufferedToEnd,this),e.off(oe.MEDIA_ENDED,this.onMediaEnded,this),e.off(oe.ERROR,this.onError,this),e.off(oe.DESTROYING,this.onDestroying,this))}startLoad(){this.resumeBuffering()}stopLoad(){this.pauseBuffering()}resumeBuffering(){var e;(e=this.getBufferingPlayer())==null||e.resumeBuffering()}pauseBuffering(){var e;(e=this.getBufferingPlayer())==null||e.pauseBuffering()}destroy(){this.unregisterListeners(),this.stopLoad(),this.assetListLoader&&this.assetListLoader.destroy(),this.emptyPlayerQueue(),this.clearScheduleState(),this.schedule&&this.schedule.destroy(),this.media=this.detachedData=this.mediaSelection=this.requiredTracks=this.altSelection=this.schedule=this.manager=null,this.hls=this.HlsPlayerClass=null,this.assetListLoader=null,this.onPlay=this.onPause=this.onSeeking=this.onTimeupdate=null,this.onScheduleUpdate=null}onDestroying(){const e=this.primaryMedia||this.media;e&&this.removeMediaListeners(e)}removeMediaListeners(e){pi(e,"play",this.onPlay),pi(e,"pause",this.onPause),pi(e,"seeking",this.onSeeking),pi(e,"timeupdate",this.onTimeupdate)}onMediaAttaching(e,n){const r=this.media=n.media;Si(r,"seeking",this.onSeeking),Si(r,"timeupdate",this.onTimeupdate),Si(r,"play",this.onPlay),Si(r,"pause",this.onPause)}onMediaAttached(e,n){const r=this.effectivePlayingItem,s=this.detachedData;if(this.detachedData=null,r===null)this.checkStart();else if(!s){this.clearScheduleState();const i=this.findItemIndex(r);this.setSchedulePosition(i)}}clearScheduleState(){this.log("clear schedule state"),this.playingItem=this.bufferingItem=this.waitingItem=this.endedItem=this.playingAsset=this.endedAsset=this.bufferingAsset=null}onMediaDetaching(e,n){const r=!!n.transferMedia,s=this.media;if(this.media=null,!r&&(s&&this.removeMediaListeners(s),this.detachedData)){const i=this.getBufferingPlayer();i&&(this.log(`Removing schedule state for detachedData and ${i}`),this.playingAsset=this.endedAsset=this.bufferingAsset=this.bufferingItem=this.waitingItem=this.detachedData=null,i.detachMedia()),this.shouldPlay=!1}}get interstitialsManager(){if(!this.hls)return null;if(this.manager)return this.manager;const e=this,n=()=>e.bufferingItem||e.waitingItem,r=h=>h&&e.getAssetPlayer(h.identifier),s=(h,m,f,p,g)=>{if(h){let v=h[m].start;const b=h.event;if(b){if(m==="playout"||b.timelineOccupancy!==pZ.Point){const x=r(f);(x==null?void 0:x.interstitial)===b&&(v+=x.assetItem.startOffset+x[g])}}else{const x=p==="bufferedPos"?o():e[p];v+=x-h.start}return v}return 0},i=(h,m)=>{var f;if(h!==0&&m!=="primary"&&(f=e.schedule)!=null&&f.length){var p;const g=e.schedule.findItemIndexAtTime(h),v=(p=e.schedule.items)==null?void 0:p[g];if(v){const b=v[m].start-v.start;return h+b}}return h},o=()=>{const h=e.bufferedPos;return h===Number.MAX_VALUE?l("primary"):Math.max(h,0)},l=h=>{var m,f;return(m=e.primaryDetails)!=null&&m.live?e.primaryDetails.edge:((f=e.schedule)==null?void 0:f.durations[h])||0},c=(h,m)=>{var f,p;const g=e.effectivePlayingItem;if(g!=null&&(f=g.event)!=null&&f.restrictions.skip||!e.schedule)return;e.log(`seek to ${h} "${m}"`);const v=e.effectivePlayingItem,b=e.schedule.findItemIndexAtTime(h,m),x=(p=e.schedule.items)==null?void 0:p[b],w=e.getBufferingPlayer(),k=w==null?void 0:w.interstitial,S=k==null?void 0:k.appendInPlace,C=v&&e.itemsMatch(v,x);if(v&&(S||C)){const j=r(e.playingAsset),E=(j==null?void 0:j.media)||e.primaryMedia;if(E){const N=m==="primary"?E.currentTime:s(v,m,e.playingAsset,"timelinePos","currentTime"),A=h-N,_=(S?N:E.currentTime)+A;if(_>=0&&(!j||S||_<=j.duration)){E.currentTime=_;return}}}if(x){let j=h;if(m!=="primary"){const N=x[m].start,A=h-N;j=x.start+A}const E=!e.isInterstitial(x);if((!e.isInterstitial(v)||v.event.appendInPlace)&&(E||x.event.appendInPlace)){const N=e.media||(S?w==null?void 0:w.media:null);N&&(N.currentTime=j)}else if(v){const N=e.findItemIndex(v);if(b>N){const _=e.schedule.findJumpRestrictedIndex(N+1,b);if(_>N){e.setSchedulePosition(_);return}}let A=0;if(E)e.timelinePos=j,e.checkBuffer();else{const _=x.event.assetList,T=h-(x[m]||x).start;for(let R=_.length;R--;){const O=_[R];if(O.duration&&T>=O.startOffset&&T<O.startOffset+O.duration){A=R;break}}}e.setSchedulePosition(b,A)}}},d=()=>{const h=e.effectivePlayingItem;if(e.isInterstitial(h))return h;const m=n();return e.isInterstitial(m)?m:null},u={get bufferedEnd(){const h=n(),m=e.bufferingItem;if(m&&m===h){var f;return s(m,"playout",e.bufferingAsset,"bufferedPos","bufferedEnd")-m.playout.start||((f=e.bufferingAsset)==null?void 0:f.startOffset)||0}return 0},get currentTime(){const h=d(),m=e.effectivePlayingItem;return m&&m===h?s(m,"playout",e.effectivePlayingAsset,"timelinePos","currentTime")-m.playout.start:0},set currentTime(h){const m=d(),f=e.effectivePlayingItem;f&&f===m&&c(h+f.playout.start,"playout")},get duration(){const h=d();return h?h.playout.end-h.playout.start:0},get assetPlayers(){var h;const m=(h=d())==null?void 0:h.event.assetList;return m?m.map(f=>e.getAssetPlayer(f.identifier)):[]},get playingIndex(){var h;const m=(h=d())==null?void 0:h.event;return m&&e.effectivePlayingAsset?m.findAssetIndex(e.effectivePlayingAsset):-1},get scheduleItem(){return d()}};return this.manager={get events(){var h;return((h=e.schedule)==null||(h=h.events)==null?void 0:h.slice(0))||[]},get schedule(){var h;return((h=e.schedule)==null||(h=h.items)==null?void 0:h.slice(0))||[]},get interstitialPlayer(){return d()?u:null},get playerQueue(){return e.playerQueue.slice(0)},get bufferingAsset(){return e.bufferingAsset},get bufferingItem(){return n()},get bufferingIndex(){const h=n();return e.findItemIndex(h)},get playingAsset(){return e.effectivePlayingAsset},get playingItem(){return e.effectivePlayingItem},get playingIndex(){const h=e.effectivePlayingItem;return e.findItemIndex(h)},primary:{get bufferedEnd(){return o()},get currentTime(){const h=e.timelinePos;return h>0?h:0},set currentTime(h){c(h,"primary")},get duration(){return l("primary")},get seekableStart(){return e.seekableStart}},integrated:{get bufferedEnd(){return s(n(),"integrated",e.bufferingAsset,"bufferedPos","bufferedEnd")},get currentTime(){return s(e.effectivePlayingItem,"integrated",e.effectivePlayingAsset,"timelinePos","currentTime")},set currentTime(h){c(h,"integrated")},get duration(){return l("integrated")},get seekableStart(){return i(e.seekableStart,"integrated")}},skip:()=>{const h=e.effectivePlayingItem,m=h==null?void 0:h.event;if(m&&!m.restrictions.skip){const f=e.findItemIndex(h);if(m.appendInPlace){const p=h.playout.start+h.event.duration;c(p+.001,"playout")}else e.advanceAfterAssetEnded(m,f,1/0)}}}}get effectivePlayingItem(){return this.waitingItem||this.playingItem||this.endedItem}get effectivePlayingAsset(){return this.playingAsset||this.endedAsset}get playingLastItem(){var e;const n=this.playingItem,r=(e=this.schedule)==null?void 0:e.items;return!this.playbackStarted||!n||!r?!1:this.findItemIndex(n)===r.length-1}get playbackStarted(){return this.effectivePlayingItem!==null}get currentTime(){var e,n;if(this.mediaSelection===null)return;const r=this.waitingItem||this.playingItem;if(this.isInterstitial(r)&&!r.event.appendInPlace)return;let s=this.media;!s&&(e=this.bufferingItem)!=null&&(e=e.event)!=null&&e.appendInPlace&&(s=this.primaryMedia);const i=(n=s)==null?void 0:n.currentTime;if(!(i===void 0||!xn(i)))return i}get primaryMedia(){var e;return this.media||((e=this.detachedData)==null?void 0:e.media)||null}isInterstitial(e){return!!(e!=null&&e.event)}retreiveMediaSource(e,n){const r=this.getAssetPlayer(e);r&&this.transferMediaFromPlayer(r,n)}transferMediaFromPlayer(e,n){const r=e.interstitial.appendInPlace,s=e.media;if(r&&s===this.primaryMedia){if(this.bufferingAsset=null,(!n||this.isInterstitial(n)&&!n.event.appendInPlace)&&n&&s){this.detachedData={media:s};return}const i=e.transferMedia();this.log(`transfer MediaSource from ${e} ${ya(i)}`),this.detachedData=i}else n&&s&&(this.shouldPlay||(this.shouldPlay=!s.paused))}transferMediaTo(e,n){var r,s;if(e.media===n)return;let i=null;const o=this.hls,l=e!==o,c=l&&e.interstitial.appendInPlace,d=(r=this.detachedData)==null?void 0:r.mediaSource;let u;if(o.media)c&&(i=o.transferMedia(),this.detachedData=i),u="Primary";else{const p=this.getBufferingPlayer();p?(i=p.transferMedia(),this.detachedData=i,u=`${p}`):d?u="detached MediaSource":u="detached media"}if(!i){if(d)i=this.detachedData,this.log(`using detachedData: MediaSource ${ya(i)}`);else if(!this.detachedData||o.media===n){const p=this.playerQueue;p.length>1&&p.forEach(g=>{if(l&&g.interstitial.appendInPlace!==c){const v=g.interstitial;this.clearInterstitial(g.interstitial,null),v.appendInPlace=!1,v.appendInPlace&&this.warn(`Could not change append strategy for queued assets ${v}`)}}),this.hls.detachMedia(),this.detachedData={media:n}}}const h=i&&"mediaSource"in i&&((s=i.mediaSource)==null?void 0:s.readyState)!=="closed";if(this.log(`${h?"transfering MediaSource":"attaching media"} to ${l?e:"Primary"} from ${u} (media.currentTime: ${n.currentTime})`),!h&&!l){e.attachMedia(n);return}const m=h&&i?rr({},i):{media:n},f=this.schedule;if(f&&l){const p=e.assetId===f.assetIdAtEnd;m.overrides={duration:f.duration,endOfStream:p||e.appendInPlace===!1}}if(!h&&c){const p=e,g=p.assetItem.timelineStart;if(g){const v=p.hls,b=Math.max(this.timelinePos-g,Number.EPSILON);v.startPosition!==b&&(this.log(`Set ${p} startPosition: ${b}`),v.config.startPosition=b,v.loadingEnabled&&v.startLoad(b))}}e.attachMedia(m)}onInterstitialCueEnter(){this.onTimeupdate()}checkStart(){const e=this.schedule,n=e==null?void 0:e.events,r=this.hls;if(!n||this.playbackDisabled||!this.media||!r)return;this.bufferedPos===-1&&(this.bufferedPos=0);const s=this.timelinePos,i=this.effectivePlayingItem;if(s===-1){if(!r.loadingEnabled){this.log("waiting for startLoad( <startPosition> )");return}const o=r.startPosition;if(this.timelinePos=o,n.length===0)this.setSchedulePosition(0);else if(n[0].cue.pre){this.log(aC("checkStart (preroll)",o));const l=e.findEventIndex(n[0].identifier);this.setSchedulePosition(l)}else if(o>=0||!this.primaryLive){this.log(aC("checkStart",o));const l=this.timelinePos=o>0?o:0,c=e.findItemIndexAtTime(l);this.setSchedulePosition(c)}else r.liveSyncPosition===0?this.setSchedulePosition(0):this.log("[checkStart] waiting for live start")}else if(i&&!this.playingItem){this.log(aC("checkStart (playing item)",i.start));const o=e.findItemIndex(i);this.setSchedulePosition(o)}}advanceAssetBuffering(e,n){const r=e.event,s=r.findAssetIndex(n),i=Lde(r,s);if(!r.isAssetPastPlayoutLimit(i))this.bufferedToEvent(e,i);else if(this.schedule){var o;const l=this.getNextItemIndex(e,!0),c=(o=this.schedule.items)==null?void 0:o[l];c&&this.bufferedToItem(c)}}livePrerollResumption(e,n){if(e.cue.pre&&this.primaryLive&&!xn(e.resumeOffset)&&this.hls){const r=this.getLiveStartPos();if(n){const s=this.getBufferingPlayer(),i=s!=null&&s.interstitial.cue.pre?s.remaining:0;return r+i}return r}}getNextItemIndex(e,n){if(this.schedule){const r=this.livePrerollResumption(e.event,n);if(r!==void 0)return this.log(`find next item index @${r}`),this.schedule.findItemIndexAtTime(r)}return this.findItemIndex(e)+1}advanceAfterAssetEnded(e,n,r){const s=Lde(e,r);if(e.isAssetPastPlayoutLimit(s)){if(this.schedule){const i=this.schedule.items;if(i){const o=i[n],l=o.event?this.getNextItemIndex(o):n+1,c=i.length;if(l>=c){this.setSchedulePosition(-1);return}const d=e.resumeTime;this.timelinePos<d&&(this.log(aC("advanceAfterAssetEnded",d)),this.timelinePos=d,e.appendInPlace&&!i[l].event&&this.hls.startLoad(d+.01),this.checkBuffer(this.bufferedPos<d)),this.setSchedulePosition(l)}}}else{if(e.appendInPlace){const i=e.assetList[s];i&&this.advanceInPlace(i.timelineStart)}this.setSchedulePosition(n,s)}}setScheduleToAssetAtTime(e,n){const r=this.schedule;if(!r)return;const s=n.parentIdentifier,i=r.getEvent(s);if(i){const o=r.findEventIndex(s),l=r.findAssetIndex(i,e);this.advanceAfterAssetEnded(i,o,l-1)}}setSchedulePosition(e,n){var r;const s=(r=this.schedule)==null?void 0:r.items;if(!s||this.playbackDisabled)return;const i=e>=0?s[e]:null;this.log(`setSchedulePosition ${e}, ${n} (${i&&Oh(i)}) pos: ${this.timelinePos}`);const o=this.waitingItem||this.playingItem,l=this.playingLastItem;if(this.isInterstitial(o)){const h=o.event,m=this.playingAsset,f=m==null?void 0:m.identifier,p=f?this.getAssetPlayer(f):null;if(p&&f&&(!this.eventItemsMatch(o,i)||n!==void 0&&f!==h.assetList[n].identifier)){var c;const g=h.findAssetIndex(m);if(this.log(`INTERSTITIAL_ASSET_ENDED ${g+1}/${h.assetList.length} ${M_(m)}`),this.endedAsset=m,this.playingAsset=null,this.hls.trigger(oe.INTERSTITIAL_ASSET_ENDED,{asset:m,assetListIndex:g,event:h,schedule:s.slice(0),scheduleIndex:e,player:p}),o!==this.playingItem){this.itemsMatch(o,this.playingItem)&&!this.playingAsset&&this.advanceAfterAssetEnded(h,this.findItemIndex(this.playingItem),g);return}this.retreiveMediaSource(f,i),p.media&&!((c=this.detachedData)!=null&&c.mediaSource)&&p.detachMedia()}if(!this.eventItemsMatch(o,i)&&(this.endedItem=o,this.playingItem=this.waitingItem=null,this.log(`INTERSTITIAL_ENDED ${h} ${Oh(o)}`),h.hasPlayed=!0,this.hls.trigger(oe.INTERSTITIAL_ENDED,{event:h,schedule:s.slice(0),scheduleIndex:e}),h.cue.once&&this.hls)){var d;this.updateSchedule();const g=(d=this.schedule)==null?void 0:d.items;if(i&&g){const v=this.findItemIndex(i),b=this.livePrerollResumption(h);if(b!==void 0){let x=b;const w=this.getNextItemIndex(o);if(!this.isInterstitial(s[w])){var u;const k=(u=this.primaryDetails)==null?void 0:u.fragments;if(h.snapOptions.in&&k){const S=UR(null,k,b);S&&(x=Math.min(Math.max(s[w].start,nq(x,S)),s[w].end))}}if(this.log(aC("live join (preroll)",x)),this.timelinePos=x,w!==v&&(w||w===0)){this.advanceSchedule(w,g,void 0,o,l);return}}this.advanceSchedule(v,g,n,o,l)}return}}this.advanceSchedule(e,s,n,o,l)}advanceSchedule(e,n,r,s,i){const o=this.schedule;if(!o)return;const l=n[e]||null,c=this.primaryMedia,d=this.playerQueue;if(d.length&&d.forEach(u=>{const h=u.interstitial,m=o.findEventIndex(h.identifier);(m<e||m>e+1)&&this.clearInterstitial(h,l)}),this.isInterstitial(l)){this.timelinePos=Math.min(Math.max(this.timelinePos,l.start),l.end);const u=l.event;if(r===void 0){r=u.cue.pre?0:o.findAssetIndex(u,this.timelinePos);const p=Lde(u,r-1);if(u.isAssetPastPlayoutLimit(p)||u.appendInPlace&&this.timelinePos===l.end){this.advanceAfterAssetEnded(u,e,r);return}r=p}const h=this.waitingItem;this.assetsBuffered(l,c)||this.setBufferingItem(l);let m=this.preloadAssets(u,r);if(this.eventItemsMatch(l,h||s)||(this.waitingItem=l,this.log(`INTERSTITIAL_STARTED ${Oh(l)} ${u.appendInPlace?"append in place":""}`),u.hasPlayed=!1,this.hls.trigger(oe.INTERSTITIAL_STARTED,{event:u,schedule:n.slice(0),scheduleIndex:e})),!u.assetListLoaded){this.log(`Waiting for ASSET-LIST to complete loading ${u}`);return}if(u.assetListLoader&&(u.assetListLoader.destroy(),u.assetListLoader=void 0),!c){this.log(`Waiting for attachMedia to start Interstitial ${u}`);return}this.waitingItem=this.endedItem=null,this.playingItem=l;const f=u.assetList[r];if(!f){this.advanceAfterAssetEnded(u,e,r||0);return}if(m||(m=this.getAssetPlayer(f.identifier)),m===null||m.destroyed){const p=u.assetList.length;this.warn(`asset ${r+1}/${p} player destroyed ${u}`),m=this.createAssetPlayer(u,f,r),m.loadSource()}if(!this.eventItemsMatch(l,this.bufferingItem)&&u.appendInPlace&&this.isAssetBuffered(f))return;this.startAssetPlayer(m,r,n,e,c),this.shouldPlay&&uze(m.media)}else l?(this.resumePrimary(l,e,s),this.shouldPlay&&uze(this.hls.media)):i&&this.isInterstitial(s)&&(this.endedItem=null,this.playingItem=s,s.event.appendInPlace||this.attachPrimary(o.durations.primary,null))}get playbackDisabled(){return this.hls.config.enableInterstitialPlayback===!1}get primaryDetails(){var e;return(e=this.mediaSelection)==null?void 0:e.main.details}get primaryLive(){var e;return!!((e=this.primaryDetails)!=null&&e.live)}resumePrimary(e,n,r){var s,i;this.playingItem=e,this.playingAsset=this.endedAsset=null,this.waitingItem=null,this.bufferedToItem(e),this.endedItem=null,this.log(`resuming ${Oh(e)}`);let o=this.timelinePos;if((s=this.detachedData)!=null&&s.mediaSource?this.primaryLive&&this.startLoadingPrimaryAt(o):((o<e.start||o>=e.end||o<this.seekableStart)&&(o=this.getPrimaryResumption(e,n),this.log(aC("resumePrimary",o)),this.timelinePos=o),this.attachPrimary(o,e)),!r)return;const l=(i=this.schedule)==null?void 0:i.items;l&&(this.log(`INTERSTITIALS_PRIMARY_RESUMED ${Oh(e)}`),this.hls.trigger(oe.INTERSTITIALS_PRIMARY_RESUMED,{schedule:l.slice(0),scheduleIndex:n}),this.checkBuffer())}get seekableStart(){var e;return this.primaryLive&&((e=this.primaryDetails)==null?void 0:e.fragmentStart)||0}getPrimaryResumption(e,n,r){const s=e.start;if(this.primaryLive){if(n===0)return this.hls.startPosition;const i=this.endedItem||this.playingItem,o=i!=null&&i.event?this.livePrerollResumption(i.event,r):void 0;if(o!==void 0)return o;const l=this.primaryDetails;if(l){const{fragmentStart:c,edge:d}=l;if(s<c||s>d&&!r){const u=this.hls.liveSyncPosition;return this.log(`primary resumption out of bounds (${s} [${c}-${d}]) snapping to liveSync ${u}`),u||c}}}return this.log(`primary resumption itemStart: ${s}`),s}getLiveStartPos(){var e;const n=this.hls.startPosition,r=this.hls.liveSyncPosition||0,s=(((e=this.primaryDetails)==null?void 0:e.targetduration)||10)*3;return n===-1||r&&r-n<s?r||0:n}isAssetBuffered(e){const n=this.getAssetPlayer(e.identifier);return n!=null&&n.hls?n.hls.bufferedToEnd:Rr.bufferInfo(this.primaryMedia,this.timelinePos,0).end+1>=e.timelineStart+(e.duration||0)}attachPrimary(e,n,r){n?this.setBufferingItem(n):this.bufferingItem=this.playingItem,this.bufferingAsset=null;const s=this.primaryMedia;if(!s)return;const i=this.hls;i.media?this.checkBuffer():(this.transferMediaTo(i,s),r&&this.startLoadingPrimaryAt(e,r)),r||(this.log(aC("attachPrimary",e)),this.timelinePos=e,this.startLoadingPrimaryAt(e,r))}startLoadingPrimaryAt(e,n){const r=this.hls,{loadingEnabled:s,bufferingEnabled:i,startPosition:o}=r,l=r.hasEnoughToStart;if(this.log(`Start loading primary @${e} bufferedPos: ${this.bufferedPos} startPosition: ${o} skip seek: ${n} has enough ${l} loadingEnabled: ${s} bufferingEnabled: ${i}`),!n&&l||!s||Math.abs(o-e)>.1){const c=this.primaryDetails;if(c!=null&&c.live&&e+.5>=c.edge){const d=this.bufferingItem;this.log(`Resume primary loading when live passes ${e} buffering item: ${d?Oh(d):null}`),r.pauseBuffering(),this.bufferPastEdge=!0;return}r.startLoad(e,n)}else i||r.resumeBuffering()}onManifestLoading(){var e;this.stopLoad(),(e=this.schedule)==null||e.reset(),this.emptyPlayerQueue(),this.clearScheduleState(),this.shouldPlay=!1,this.bufferedPos=this.timelinePos=-1,this.mediaSelection=this.altSelection=this.manager=this.requiredTracks=null,this.hls.off(oe.BUFFER_CODECS,this.onBufferCodecs,this),this.hls.on(oe.BUFFER_CODECS,this.onBufferCodecs,this)}onLevelUpdated(e,n){if(n.level===-1||!this.schedule)return;const r=this.hls.levels[n.level];if(!r.details)return;const s=rr(rr({},this.mediaSelection||this.altSelection),{},{main:r});this.mediaSelection=s;const i=this.hls.startPosition;if(this.schedule.parseInterstitialDateRanges(s,this.hls.config.interstitialAppendInPlace,i===-1?0:i),!!this.schedule.items){if(!this.effectivePlayingItem)this.checkStart();else if(this.bufferPastEdge){const l=this.primaryDetails,c=this.bufferedPos;if(l!=null&&l.live&&c+.5<l.edge){this.bufferPastEdge=!1;const d=this.bufferingItem;if(this.log(`Live edge ${l.edge} passed buffer: ${c} buffering item: ${d?Oh(d):null}`),(d==null?void 0:d.end)===1/0){const h=this.playingItem,m=this.isInterstitial(h)&&h.event.appendInPlace;this.hls.startLoad(Math.max(c,d.start),m)}else{const h=this.getBufferingPlayer();h&&h.bufferedInPlaceToEnd(this.primaryMedia,h.currentTime)&&h.hls&&h.hls.trigger(oe.BUFFERED_TO_END,void 0)}}}}}onAudioTrackUpdated(e,n){const r=this.hls.audioTracks[n.id],s=this.mediaSelection;if(!s){this.altSelection=rr(rr({},this.altSelection),{},{audio:r});return}const i=rr(rr({},s),{},{audio:r});this.mediaSelection=i}onSubtitleTrackUpdated(e,n){const r=this.hls.subtitleTracks[n.id],s=this.mediaSelection;if(!s){this.altSelection=rr(rr({},this.altSelection),{},{subtitles:r});return}const i=rr(rr({},s),{},{subtitles:r});this.mediaSelection=i}onAudioTrackSwitching(e,n){const r=sUe(n);this.playerQueue.forEach(({hls:s})=>s&&(s.setAudioOption(n)||s.setAudioOption(r)))}onSubtitleTrackSwitch(e,n){const r=sUe(n);this.playerQueue.forEach(({hls:s})=>s&&(s.setSubtitleOption(n)||n.id!==-1&&s.setSubtitleOption(r)))}onBufferCodecs(e,n){const r=n.tracks;r&&(this.requiredTracks=r)}onBufferAppended(e,n){this.checkBuffer()}onBufferFlushed(e,n){const r=this.playingItem;if(r&&!this.itemsMatch(r,this.bufferingItem)&&!this.isInterstitial(r)){const s=this.timelinePos;this.bufferedPos=s,this.checkBuffer()}}onBufferedToEnd(e){if(!this.schedule)return;const n=this.schedule.events;if(this.bufferedPos<Number.MAX_VALUE&&n){for(let r=0;r<n.length;r++){const s=n[r];if(s.cue.post){const i=this.getEventItem(s.identifier);i&&this.eventItemsMatch(i,this.bufferingItem)&&this.bufferedToItem(i,0);break}}this.bufferedPos=Number.MAX_VALUE}}onMediaEnded(e){const n=this.playingItem;if(!this.playingLastItem&&n){const r=this.findItemIndex(n);this.setSchedulePosition(r+1)}else this.shouldPlay=!1}updateItem(e,n){var r;const s=(r=this.schedule)==null?void 0:r.items;if(e&&s){const i=this.findItemIndex(e,n);return s[i]||null}return null}trimInPlace(e,n){if(this.isInterstitial(e)&&e.event.appendInPlace&&n.end-e.end>.25){e.event.assetList.forEach((i,o)=>{e.event.isAssetPastPlayoutLimit(o)&&this.clearAssetPlayer(i.identifier,null)});const r=e.end+.25,s=Rr.bufferInfo(this.primaryMedia,r,0);(s.end>r||(s.nextStart||0)>r)&&(this.log(`trim buffered interstitial ${Oh(e)} (was ${Oh(n)})`),this.attachPrimary(r,null,!0),this.flushFrontBuffer(r))}}itemsMatch(e,n){return!!n&&(e===n||e.event&&n.event&&this.eventItemsMatch(e,n)||!e.event&&!n.event&&this.findItemIndex(e)===this.findItemIndex(n))}eventItemsMatch(e,n){var r;return!!n&&(e===n||e.event.identifier===((r=n.event)==null?void 0:r.identifier))}findEventIndex(e){return this.schedule?this.schedule.findEventIndex(e):-1}getEventItem(e){if(this.schedule){var n;const r=(n=this.schedule.items)==null?void 0:n[this.findEventIndex(e)];if(this.isInterstitial(r)&&r.event.identifier===e)return r}}findItemIndex(e,n){return e&&this.schedule?this.schedule.findItemIndex(e,n):-1}updateSchedule(e=!1){var n,r;const s=this.mediaSelection;if(!s)return;const i=((n=this.hls)==null?void 0:n.liveSyncPosition)||0;(r=this.schedule)==null||r.updateSchedule(s,[],i,e)}checkBuffer(e){var n;const r=(n=this.schedule)==null?void 0:n.items;if(!r)return;const s=Rr.bufferInfo(this.primaryMedia,this.timelinePos,0);e&&(this.bufferedPos=this.timelinePos),e||(e=s.len<1),this.updateBufferedPos(s.end,r,e)}updateBufferedPos(e,n,r){const s=this.schedule,i=this.bufferingItem;if(this.bufferedPos>e||!s)return;if(n.length===1&&this.itemsMatch(n[0],i)){this.bufferedPos=e;return}const o=this.playingItem,l=this.findItemIndex(o);let c=s.findItemIndexAtTime(e);if(this.bufferedPos<e){var d;const u=this.findItemIndex(i),h=Math.min(u+1,n.length-1),m=n[h];if((c===-1&&i&&e>=i.end||(d=m.event)!=null&&d.appendInPlace&&e+.01>=m.start)&&(c=h),this.isInterstitial(i)){const f=i.event;if(h-l>1&&f.appendInPlace===!1||f.assetList.length===0&&f.assetListLoader)return}if(this.bufferedPos=e,c>u&&c>l)this.bufferedToItem(m);else{const f=this.primaryDetails;this.primaryLive&&f&&e>f.edge-f.targetduration&&m.start<f.edge+this.hls.config.interstitialLiveLookAhead&&this.isInterstitial(m)&&this.preloadAssets(m.event,0)}}else r&&o&&!this.itemsMatch(o,i)&&(c===l?this.bufferedToItem(o):c===l+1&&this.bufferedToItem(n[c]))}assetsBuffered(e,n){return e.event.assetList.length===0?!1:!e.event.assetList.some(s=>{const i=this.getAssetPlayer(s.identifier);return!(i!=null&&i.bufferedInPlaceToEnd(n))})}setBufferingItem(e){const n=this.bufferingItem,r=this.schedule;if(!this.itemsMatch(e,n)&&r){const{items:s,events:i}=r;if(!s||!i)return n;const o=this.isInterstitial(e),l=this.getBufferingPlayer();this.bufferingItem=e,this.bufferedPos=Math.max(e.start,Math.min(e.end,this.timelinePos));const c=l?l.remaining:n?n.end-this.timelinePos:0;if(this.log(`INTERSTITIALS_BUFFERED_TO_BOUNDARY ${Oh(e)}`+(n?` (${c.toFixed(2)} remaining)`:"")),!this.playbackDisabled)if(o){const d=r.findAssetIndex(e.event,this.bufferedPos);e.event.assetList.forEach((u,h)=>{const m=this.getAssetPlayer(u.identifier);m&&(h===d&&m.loadSource(),m.resumeBuffering())})}else this.hls.resumeBuffering(),this.playerQueue.forEach(d=>d.pauseBuffering());this.hls.trigger(oe.INTERSTITIALS_BUFFERED_TO_BOUNDARY,{events:i.slice(0),schedule:s.slice(0),bufferingIndex:this.findItemIndex(e),playingIndex:this.findItemIndex(this.playingItem)})}else this.bufferingItem!==e&&(this.bufferingItem=e);return n}bufferedToItem(e,n=0){const r=this.setBufferingItem(e);if(!this.playbackDisabled){if(this.isInterstitial(e))this.bufferedToEvent(e,n);else if(r!==null){this.bufferingAsset=null;const s=this.getPrimaryResumption(e,this.findItemIndex(e),!0),i=this.bufferedPos=Math.max(s,Math.min(this.bufferedPos,e.end),this.timelinePos,e.start),o=this.detachedData;if(o)o.mediaSource?this.attachPrimary(i,e,!0):this.startLoadingPrimaryAt(i);else{const l=this.playingItem,c=this.isInterstitial(l)&&l.event.appendInPlace;this.startLoadingPrimaryAt(i,c)}}}}bufferedToEvent(e,n){const r=e.event,s=r.assetList.length===0&&!r.assetListLoader,i=r.cue.once;if(s||!i){const o=this.preloadAssets(r,n);if(o!=null&&o.interstitial.appendInPlace){const l=this.primaryMedia;l&&this.bufferAssetPlayer(o,l)}}}preloadAssets(e,n){const r=e.assetUrl,s=e.assetList.length,i=s===0&&!e.assetListLoader,o=e.cue.once;if(i){const c=e.timelineStart,d=this.playingItem,u=this.getBufferingPlayer();if(e.appendInPlace){var l;!this.isInterstitial(d)&&(d==null||(l=d.nextEvent)==null?void 0:l.identifier)===e.identifier&&this.flushFrontBuffer(c+.25)}let h,m=0;if((!u||u.interstitial.cue.pre)&&this.primaryLive&&(m=this.getLiveStartPos(),u&&(m+=u.remaining)),m&&!(e.cue.pre||e.cue.post)){const p=m-c;p>0&&(h=Math.round(p*1e3)/1e3)}if(this.log(`Load interstitial asset ${n+1}/${r?1:s} ${e}${m?` live-start: ${m} start-offset: ${h} (timeline-start: ${c})`:""}`),r)return this.createAsset(e,0,0,c,e.duration,r);const f=this.assetListLoader.loadAssetList(e,h);f&&(e.assetListLoader=f)}else if(!o&&s){for(let d=n;d<s;d++){const u=e.assetList[d],h=this.getAssetPlayerQueueIndex(u.identifier);(h===-1||this.playerQueue[h].destroyed)&&!u.error&&this.createAssetPlayer(e,u,d)}const c=e.assetList[n];if(c){const d=this.getAssetPlayer(c.identifier);return d&&d.loadSource(),d}}return null}flushFrontBuffer(e){const n=this.requiredTracks;if(!n)return;const r=this.primaryDetails;if(r&&e>=r.edge)return;this.log(`Removing front buffer starting at ${e}`),Object.keys(n).forEach(i=>{this.hls.trigger(oe.BUFFER_FLUSHING,{startOffset:e,endOffset:1/0,type:i})})}getAssetPlayerQueueIndex(e){const n=this.playerQueue;for(let r=0;r<n.length;r++)if(e===n[r].assetId)return r;return-1}getAssetPlayer(e){const n=this.getAssetPlayerQueueIndex(e);return this.playerQueue[n]||null}getBufferingPlayer(){const{playerQueue:e,primaryMedia:n}=this;if(n){for(let r=0;r<e.length;r++)if(e[r].media===n)return e[r]}return null}createAsset(e,n,r,s,i,o){const l={parentIdentifier:e.identifier,identifier:Xnr(e,o,n),duration:i,startOffset:r,timelineStart:s,uri:o};return this.createAssetPlayer(e,l,n)}createAssetPlayer(e,n,r){const s=this.hls,i=s.userConfig,o=s.loadLevelObj||s.levels[s.currentLevel],l=_kt(o,i.videoPreference),c=s.audioTracks[s.audioTrack],d=s.subtitleTracks[s.subtitleTrack];let u=0;if(this.primaryLive||e.appendInPlace){const k=this.timelinePos-n.timelineStart;if(k>=0){const S=n.duration;S&&k<S&&(u=k)}}const h=n.identifier,m=rr(rr({},i),{},{maxMaxBufferLength:Math.min(15,s.config.maxMaxBufferLength),autoStartLoad:!0,startFragPrefetch:!0,primarySessionId:s.sessionId,assetPlayerId:h,abrEwmaDefaultEstimate:s.bandwidthEstimate,interstitialsController:void 0,startPosition:u,liveDurationInfinity:!1,testBandwidth:!1,videoPreference:l,audioPreference:c||i.audioPreference,subtitlePreference:d||i.subtitlePreference});e.appendInPlace&&(e.appendInPlaceStarted=!0,n.timelineStart&&(m.timelineOffset=n.timelineStart));const f=m.cmcd;f!=null&&f.sessionId&&f.contentId&&(m.cmcd=Mi({},f,{contentId:w$(n.uri)})),this.getAssetPlayer(h)&&this.warn(`Duplicate date range identifier ${e} and asset ${h}`);const p=new nrr(this.HlsPlayerClass,m,e,n);this.playerQueue.push(p),e.assetList[r]=n;let g=!0;const v=k=>{if(k.live){const j=new Error(`Interstitials MUST be VOD assets ${e}`),E={fatal:!0,type:er.OTHER_ERROR,details:rt.INTERSTITIAL_ASSET_ITEM_ERROR,error:j},N=this.findEventIndex(e.identifier);this.handleAssetItemError(E,e,N,r,j.message);return}const S=k.edge-k.fragmentStart,C=n.duration;(g||C===null||S>C)&&(g=!1,this.log(`Interstitial asset "${h}" duration change ${C} > ${S}`),n.duration=S,this.updateSchedule())};p.on(oe.LEVEL_UPDATED,(k,{details:S})=>v(S)),p.on(oe.LEVEL_PTS_UPDATED,(k,{details:S})=>v(S)),p.on(oe.EVENT_CUE_ENTER,()=>this.onInterstitialCueEnter());const b=(k,S)=>{const C=this.getAssetPlayer(h);if(C&&S.tracks){C.off(oe.BUFFER_CODECS,b),C.tracks=S.tracks;const j=this.primaryMedia;this.bufferingAsset===C.assetItem&&j&&!C.media&&this.bufferAssetPlayer(C,j)}};p.on(oe.BUFFER_CODECS,b);const x=()=>{const k=this.getAssetPlayer(h);if(this.log(`buffered to end of asset ${k}`),!k||!this.schedule)return;const S=this.getEventItem(e.identifier);S&&this.advanceAssetBuffering(S,k.assetItem)};p.on(oe.BUFFERED_TO_END,x);const w=k=>()=>{if(!this.getAssetPlayer(h)||!this.schedule)return;this.shouldPlay=!0;const C=this.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,C,k)};return p.once(oe.MEDIA_ENDED,w(r)),p.once(oe.PLAYOUT_LIMIT_REACHED,w(1/0)),p.on(oe.ERROR,(k,S)=>{if(!this.schedule)return;const C=this.getAssetPlayer(h);if(S.details===rt.BUFFER_STALLED_ERROR){if(C!=null&&C.appendInPlace){this.handleInPlaceStall(e);return}this.onTimeupdate(),this.checkBuffer(!0);return}else if(S.details===rt.BUFFER_SEEK_OVER_HOLE)return;this.handleAssetItemError(S,e,this.findEventIndex(e.identifier),r,`Asset player error ${S.error} ${e}`)}),p.on(oe.DESTROYING,()=>{if(!this.getAssetPlayer(h)||!this.schedule)return;const S=new Error(`Asset player destroyed unexpectedly ${h}`),C={fatal:!0,type:er.OTHER_ERROR,details:rt.INTERSTITIAL_ASSET_ITEM_ERROR,error:S};this.handleAssetItemError(C,e,this.findEventIndex(e.identifier),r,S.message)}),this.log(`INTERSTITIAL_ASSET_PLAYER_CREATED ${M_(n)}`),this.hls.trigger(oe.INTERSTITIAL_ASSET_PLAYER_CREATED,{asset:n,assetListIndex:r,event:e,player:p}),p}clearInterstitial(e,n){this.clearAssetPlayers(e,n),e.reset()}clearAssetPlayers(e,n){e.assetList.forEach(r=>{this.clearAssetPlayer(r.identifier,n)})}resetAssetPlayer(e){const n=this.getAssetPlayerQueueIndex(e);if(n!==-1){this.log(`reset asset player "${e}" after error`);const r=this.playerQueue[n];this.transferMediaFromPlayer(r,null),r.resetDetails()}}clearAssetPlayer(e,n){const r=this.getAssetPlayerQueueIndex(e);if(r!==-1){const s=this.playerQueue[r];this.log(`clear ${s} toSegment: ${n&&Oh(n)}`),this.transferMediaFromPlayer(s,n),this.playerQueue.splice(r,1),s.destroy()}}emptyPlayerQueue(){let e;for(;e=this.playerQueue.pop();)e.destroy();this.playerQueue=[]}startAssetPlayer(e,n,r,s,i){const{interstitial:o,assetItem:l,assetId:c}=e,d=o.assetList.length,u=this.playingAsset;this.endedAsset=null,this.playingAsset=l,(u==null?void 0:u.identifier)!==c&&(u&&(this.clearAssetPlayer(u.identifier,r[s]),delete u.error),this.log(`INTERSTITIAL_ASSET_STARTED ${n+1}/${d} ${M_(l)}`),this.hls.trigger(oe.INTERSTITIAL_ASSET_STARTED,{asset:l,assetListIndex:n,event:o,schedule:r.slice(0),scheduleIndex:s,player:e})),this.bufferAssetPlayer(e,i)}bufferAssetPlayer(e,n){var r;if(!this.schedule)return;const{interstitial:s,assetItem:i}=e,o=this.getEventItem(s.identifier);if(!o)return;if(e.loadSource(),this.setBufferingItem(o),this.bufferingAsset=i,e.bufferedInPlaceToEnd(this.primaryMedia,e.currentTime)){this.advanceAssetBuffering(o,i);return}const l=this.getBufferingPlayer();if(l===e)return;const c=s.appendInPlace;if(c&&(l==null?void 0:l.interstitial.appendInPlace)===!1)return;const d=(l==null?void 0:l.tracks)||((r=this.detachedData)==null?void 0:r.tracks)||this.requiredTracks;if(c&&i!==this.playingAsset){if(!e.tracks){this.log(`Waiting for track info before buffering ${e}`);return}if(d&&!rkt(d,e.tracks)){const u=new Error(`Asset ${M_(i)} SourceBuffer tracks ('${Object.keys(e.tracks)}') are not compatible with primary content tracks ('${Object.keys(d)}')`),h={fatal:!0,type:er.OTHER_ERROR,details:rt.INTERSTITIAL_ASSET_ITEM_ERROR,error:u},m=s.findAssetIndex(i);this.handleAssetItemError(h,s,this.findEventIndex(s.identifier),m,u.message);return}}this.transferMediaTo(e,n)}handleInPlaceStall(e){const n=this.schedule,r=this.primaryMedia;if(!n||!r)return;const s=r.currentTime,i=n.findAssetIndex(e,s),o=e.assetList[i];if(o){const l=this.getAssetPlayer(o.identifier);if(l){const c=l.currentTime||s-o.timelineStart,d=l.duration-c;if(this.warn(`Stalled at ${c} of ${c+d} in ${l} ${e} (media.currentTime: ${s})`),c&&(d/r.playbackRate<.5||l.bufferedInPlaceToEnd(r,l.currentTime))&&l.hls){const u=n.findEventIndex(e.identifier);this.advanceAfterAssetEnded(e,u,i)}}}}advanceInPlace(e){const n=this.primaryMedia;if(n&&n.currentTime<e){const r=`advance currentTime to ${e}, duration: ${n.duration}`;n.duration>e?(this.log(r),n.currentTime=e):this.log(`Cannot ${r}`)}}handleAssetItemError(e,n,r,s,i){if(e.details===rt.BUFFER_STALLED_ERROR)return;const o=n.assetList[s]||null;if(this.warn(`INTERSTITIAL_ASSET_ERROR ${o&&M_(o)} ${e.error}`),!this.schedule)return;const l=(o==null?void 0:o.identifier)||"",c=this.getAssetPlayerQueueIndex(l),d=this.playerQueue[c]||null,u=this.schedule.items,h=Mi({},e,{fatal:!1,errorAction:y$(!0),asset:o,assetListIndex:s,event:n,schedule:u,scheduleIndex:r,player:d});if(this.hls.trigger(oe.INTERSTITIAL_ASSET_ERROR,h),!e.fatal)return;const m=this.playingAsset,f=this.bufferingAsset,p=new Error(i);if(o&&(this.clearAssetPlayer(l,null),o.error=p),!n.assetList.some(g=>!g.error))n.error=p;else for(let g=s;g<n.assetList.length;g++)this.resetAssetPlayer(n.assetList[g].identifier);this.updateSchedule(!0),n.error?this.primaryFallback(n):(m==null?void 0:m.identifier)===l?this.advanceAfterAssetEnded(n,r,s):(f==null?void 0:f.identifier)===l&&this.isInterstitial(this.bufferingItem)&&this.advanceAssetBuffering(this.bufferingItem,f)}primaryFallback(e){const n=e.timelineStart,r=this.effectivePlayingItem,s=this.playingItem,i=this.seekableStart,o=this.hls.startPosition;let l=this.timelinePos;if(this.isInterstitial(r)){this.log(`Fallback to primary from event "${e.identifier}" start: ${n} pos: ${l} playing: ${Oh(r)} startPosition: ${o} seekableStart: ${i} error: ${e.error}`),l===-1&&(l=o),l=Math.max(l,i);const d=this.updateItem(r,l);this.itemsMatch(r,d)&&this.clearInterstitial(e,null),e.appendInPlace&&(this.attachPrimary(n,null),this.flushFrontBuffer(n))}else if(l===-1){this.checkStart();return}if(!this.schedule||!this.isInterstitial(s))return;const c=this.schedule.findItemIndexAtTime(l);this.setSchedulePosition(c)}onAssetListLoaded(e,n){var r,s;const i=n.event,o=i.identifier,l=n.assetListResponse.ASSETS;if(!((r=this.schedule)!=null&&r.hasEvent(o)))return;const c=i.timelineStart,d=i.duration;let u=0;l.forEach((p,g)=>{const v=parseFloat(p.DURATION);this.createAsset(i,g,u,c+u,v,p.URI),u+=v}),i.duration=u,this.log(`Loaded asset-list with duration: ${u} (was: ${d}) ${i}`);const h=this.waitingItem,m=(h==null?void 0:h.event.identifier)===o;this.updateSchedule();const f=(s=this.bufferingItem)==null?void 0:s.event;if(m){const p=this.findEventIndex(o),g=this.getEventItem(o);if(g){if(!this.playingItem&&this.timelinePos>g.end&&this.schedule.findItemIndexAtTime(this.timelinePos)!==p){i.error=new Error(`Interstitial ${l.length?"no longer within playback range":"asset-list is empty"} ${this.timelinePos} ${i}`),this.log(i.error.message),this.updateSchedule(!0),this.primaryFallback(i);return}this.setBufferingItem(g)}this.setSchedulePosition(p)}else if((f==null?void 0:f.identifier)===o){const p=i.assetList[0];if(p){const g=this.getAssetPlayer(p.identifier);if(f.appendInPlace){const v=this.primaryMedia;g&&v&&this.bufferAssetPlayer(g,v)}else g&&g.loadSource()}}}onError(e,n){if(this.schedule)switch(n.details){case rt.ASSET_LIST_PARSING_ERROR:case rt.ASSET_LIST_LOAD_ERROR:case rt.ASSET_LIST_LOAD_TIMEOUT:{const r=n.interstitial;r&&(this.updateSchedule(!0),this.primaryFallback(r));break}case rt.BUFFER_STALLED_ERROR:{const r=this.endedItem||this.waitingItem||this.playingItem;if(this.isInterstitial(r)&&r.event.appendInPlace){this.handleInPlaceStall(r.event);return}const s=this.primaryMedia;this.log(`Primary player stall @${this.timelinePos} currentTime: ${s==null?void 0:s.currentTime} bufferedPos: ${this.bufferedPos}`),this.onTimeupdate(),this.checkBuffer(!0);break}}}}class arr{constructor(e){this.hls=void 0,this.media=null,this.currentTime=0,this.stallCount=0,this._latency=null,this._targetLatencyUpdated=!1,this.onTimeupdate=()=>{var n;const{media:r}=this,s=this.levelDetails;if(!r||!s||!this.hls)return;this.currentTime=r.currentTime;const i=this.hls.config,o=this.computeLatency();if(o===null)return;this._latency=o;const{lowLatencyMode:l,maxLiveSyncPlaybackRate:c}=i;if(!l||c===1||!s.live)return;const d=this.targetLatency;if(d===null)return;const u=o-d,h=Math.min(this.maxLatency,d+s.targetduration),m=u<h,f=uZ(i)&&!!((n=this.hls.interstitialsManager)!=null&&(n=n.playingItem)!=null&&n.event);if(m&&u>.05&&this.forwardBufferLength>1&&!f){const p=Math.min(2,Math.max(1,c)),g=Math.round(2/(1+Math.exp(-.75*u-this.edgeStalled))*20)/20,v=Math.min(p,Math.max(1,g));this.changeMediaPlaybackRate(r,v)}else r.playbackRate!==1&&r.playbackRate!==0&&this.changeMediaPlaybackRate(r,1)},this.hls=e,this.registerListeners()}get levelDetails(){var e;return((e=this.hls)==null?void 0:e.latestLevelDetails)||null}get latency(){return this._latency||0}get maxLatency(){var e;const n=(e=this.hls)==null?void 0:e.config;if(!n)return 0;if(n.liveMaxLatencyDuration!==void 0)return n.liveMaxLatencyDuration;const r=this.levelDetails;return r?n.liveMaxLatencyDurationCount*r.targetduration:0}get targetLatency(){const e=this.levelDetails;if(e===null||!this.hls)return null;const n=this.hls.config,{holdBack:r,partHoldBack:s,targetduration:i}=e,{liveSyncDuration:o,liveSyncDurationCount:l,lowLatencyMode:c}=n,d=this.hls.userConfig;let u=c&&s||r;(this._targetLatencyUpdated||d.liveSyncDuration||d.liveSyncDurationCount||u===0)&&(u=o!==void 0?o:l*i);const h=i;return u+Math.min(this.stallCount*n.liveSyncOnStallIncrease,h)}set targetLatency(e){this.hls&&(this.stallCount=0,this.hls.config.liveSyncDuration=e,this._targetLatencyUpdated=!0)}get liveSyncPosition(){const e=this.estimateLiveEdge(),n=this.targetLatency;if(e===null||n===null||!this.hls)return null;const r=this.levelDetails;if(r===null)return null;const s=r.edge,i=e-n-this.edgeStalled,o=s-r.totalduration,l=s-(this.hls.config.lowLatencyMode&&r.partTarget||r.targetduration);return Math.min(Math.max(o,i),l)}get drift(){const e=this.levelDetails;return e===null?1:e.drift}get edgeStalled(){const e=this.levelDetails;if(e===null||!this.hls)return 0;const n=(this.hls.config.lowLatencyMode&&e.partTarget||e.targetduration)*3;return Math.max(e.age-n,0)}get forwardBufferLength(){const{media:e}=this,n=this.levelDetails;if(!e||!n)return 0;const r=e.buffered.length;return(r?e.buffered.end(r-1):n.edge)-this.currentTime}destroy(){this.unregisterListeners(),this.onMediaDetaching(),this.hls=null}registerListeners(){const{hls:e}=this;e&&(e.on(oe.MEDIA_ATTACHED,this.onMediaAttached,this),e.on(oe.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.on(oe.LEVEL_UPDATED,this.onLevelUpdated,this),e.on(oe.ERROR,this.onError,this),e.on(oe.INTERSTITIAL_ASSET_STARTED,this.onAssetStarted,this))}unregisterListeners(){const{hls:e}=this;e&&(e.off(oe.MEDIA_ATTACHED,this.onMediaAttached,this),e.off(oe.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.off(oe.LEVEL_UPDATED,this.onLevelUpdated,this),e.off(oe.ERROR,this.onError,this),e.off(oe.INTERSTITIAL_ASSET_STARTED,this.onAssetStarted,this))}onMediaAttached(e,n){this.media=n.media,this.media.addEventListener("timeupdate",this.onTimeupdate)}onMediaDetaching(){this.media&&(this.media.removeEventListener("timeupdate",this.onTimeupdate),this.media=null)}onManifestLoading(){this._latency=null,this.stallCount=0}onLevelUpdated(e,{details:n}){n.advanced&&this.onTimeupdate(),!n.live&&this.media&&this.media.removeEventListener("timeupdate",this.onTimeupdate)}onAssetStarted(e,n){var r;const s=this.hls,i=this.media||n.event.appendInPlace&&(s==null||(r=s.interstitialsManager)==null?void 0:r.playerQueue.reduce((o,l)=>o||l.media,null));s&&i&&i.playbackRate>1&&i.playbackRate<=s.config.maxLiveSyncPlaybackRate&&this.changeMediaPlaybackRate(i,1)}onError(e,n){var r;n.details===rt.BUFFER_STALLED_ERROR&&(this.stallCount++,this.hls&&(r=this.levelDetails)!=null&&r.live&&this.hls.logger.warn("[latency-controller]: Stall detected, adjusting target latency"))}changeMediaPlaybackRate(e,n){var r,s;e.playbackRate!==n&&((r=this.hls)==null||r.logger.debug(`[latency-controller]: latency=${this.latency.toFixed(3)}, targetLatency=${(s=this.targetLatency)==null?void 0:s.toFixed(3)}, forwardBufferLength=${this.forwardBufferLength.toFixed(3)}: adjusting playback rate from ${e.playbackRate} to ${n}`),e.playbackRate=n)}estimateLiveEdge(){const e=this.levelDetails;return e===null?null:e.edge+e.age}computeLatency(){const e=this.estimateLiveEdge();return e===null?null:e-this.currentTime}}const hze=500;class orr extends p_e{constructor(e,n,r){super(e,n,r,"subtitle-stream-controller",Wn.SUBTITLE),this.currentTrackId=-1,this.tracksBuffered=[],this.mainDetails=null,this.registerListeners()}onHandlerDestroying(){this.unregisterListeners(),super.onHandlerDestroying(),this.mainDetails=null}registerListeners(){super.registerListeners();const{hls:e}=this;e.on(oe.LEVEL_LOADED,this.onLevelLoaded,this),e.on(oe.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(oe.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.on(oe.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.on(oe.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.on(oe.BUFFER_FLUSHING,this.onBufferFlushing,this)}unregisterListeners(){super.unregisterListeners();const{hls:e}=this;e.off(oe.LEVEL_LOADED,this.onLevelLoaded,this),e.off(oe.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(oe.SUBTITLE_TRACK_SWITCH,this.onSubtitleTrackSwitch,this),e.off(oe.SUBTITLE_TRACK_LOADED,this.onSubtitleTrackLoaded,this),e.off(oe.SUBTITLE_FRAG_PROCESSED,this.onSubtitleFragProcessed,this),e.off(oe.BUFFER_FLUSHING,this.onBufferFlushing,this)}startLoad(e,n){this.stopLoad(),this.state=Ct.IDLE,this.setInterval(hze),this.nextLoadPosition=this.lastCurrentTime=e+this.timelineOffset,this.startPosition=n?-1:e,this.tick()}onManifestLoading(){super.onManifestLoading(),this.mainDetails=null}onMediaDetaching(e,n){this.tracksBuffered=[],super.onMediaDetaching(e,n)}onLevelLoaded(e,n){this.mainDetails=n.details}onSubtitleFragProcessed(e,n){const{frag:r,part:s,success:i}=n;if(!i)return;const o=this.tracksBuffered[this.currentTrackId];if(!o)return;let l;const c=(s||r).start;for(let u=0;u<o.length;u++)if(c>=o[u].start&&c<=o[u].end){l=o[u];break}const d=c+(s||r).duration;if(l?l.end=d:(l={start:c,end:d},o.push(l)),!s||d>=r.end){const u=this.fragmentTracker.fragBuffered(r);s&&u&&(u.range.subs={time:[{startPTS:r.start,endPTS:d}],partial:!0}),Oo(r)&&!this.fragContextChanged(r)&&(this.fragPrevious=r),this.fragBufferedComplete(r,s),this.media&&this.tickImmediate()}}onBufferFlushing(e,n){const{startOffset:r,endOffset:s}=n;if(r===0&&s!==Number.POSITIVE_INFINITY){const i=s-1;if(i<=0)return;n.endOffsetSubtitles=Math.max(0,i),this.tracksBuffered.forEach(o=>{if(o)for(let l=0;l<o.length;){if(o[l].end<=i){o.shift();continue}else if(o[l].start<i)o[l].start=i;else break;l++}}),this.fragmentTracker.removeFragmentsInRange(r,i,Wn.SUBTITLE)}}onError(e,n){const r=n.frag;(r==null?void 0:r.type)===Wn.SUBTITLE&&(n.details===rt.FRAG_GAP&&this.fragmentTracker.addAsGap(r),this.fragCurrent&&this.fragCurrent.abortRequests(),this.state!==Ct.STOPPED&&(this.state=Ct.IDLE))}onSubtitleTracksUpdated(e,{subtitleTracks:n}){if(this.levels&&fSt(this.levels,n)){this.levels=n.map(r=>new U6(r));return}this.tracksBuffered=[],this.levels=n.map(r=>{const s=new U6(r);return this.tracksBuffered[s.id]=[],s}),this.fragmentTracker.removeFragmentsInRange(0,Number.POSITIVE_INFINITY,Wn.SUBTITLE),this.fragPrevious=null,this.mediaBuffer=null}onSubtitleTrackSwitch(e,n){var r;if(this.currentTrackId=n.id,this.abortCurrentFrag(),!((r=this.levels)!=null&&r.length)||this.currentTrackId===-1){this.clearInterval();return}const s=this.levels[this.currentTrackId];if(!(s!=null&&s.details)){this.mediaBuffer=null;return}this.mediaBuffer=this.mediaBufferTimeRanges,this.state!==Ct.STOPPED&&this.setInterval(hze)}onSubtitleTrackLoaded(e,n){var r;const{currentTrackId:s,levels:i}=this,{details:o,id:l}=n;if(!i){this.warn(`Subtitle tracks were reset while loading level ${l}`);return}const c=i[l];if(l>=i.length||!c)return;this.log(`Subtitle track ${l} loaded [${o.startSN},${o.endSN}]${o.lastPartSn?`[part-${o.lastPartSn}-${o.lastPartIndex}]`:""},duration:${o.totalduration}`),this.mediaBuffer=this.mediaBufferTimeRanges;const d=this.mainDetails;let u=0;if(o.live||(r=c.details)!=null&&r.live){if(o.deltaUpdateFailed)return;if(!d){this.startFragRequested=!1;return}if(c.details){var h;u=this.alignPlaylists(o,c.details,(h=this.levelLastLoaded)==null?void 0:h.details)}o.alignedSliding||(cZ(d,o,this),u=o.fragmentStart)}c.details=o,this.levelLastLoaded=c,d&&!this.startFragRequested&&this.setStartPosition(d,u),l===s&&(this.hls.trigger(oe.SUBTITLE_TRACK_UPDATED,{details:o,id:l,groupId:n.groupId}),this.tickImmediate())}_handleFragmentLoadProgress(e){const{frag:n,part:r,payload:s}=e;!r||!(s!=null&&s.byteLength)||!this.shouldDecrypt(n)||this.decryptPayload(s,n,r)}_handleFragmentLoadComplete(e){const{frag:n,payload:r}=e;this.fragContextChanged(n)||!(r!=null&&r.byteLength)||!this.shouldDecrypt(n)||this.decryptPayload(r,n,null)}shouldDecrypt(e){const n=e.decryptdata;return!!(n!=null&&n.key&&n.iv&&rP(n.method))}decryptPayload(e,n,r){const s=n.decryptdata,i=performance.now();this.decrypter.decrypt(new Uint8Array(e),s.key.buffer,s.iv.buffer,m_e(s.method)).then(o=>{this.fragContextChanged(n)||this.hls.trigger(oe.FRAG_DECRYPTED,{frag:n,part:r,payload:o,stats:{tstart:i,tdecrypt:performance.now()}})}).catch(o=>{this.hls.trigger(oe.ERROR,{type:er.MEDIA_ERROR,details:rt.FRAG_DECRYPT_ERROR,fatal:!1,error:o,reason:o.message,frag:n,part:r}),r||(this.warn(`${o.name}: ${o.message}`),this.state=Ct.IDLE)})}doTick(){if(this.state===Ct.IDLE&&this.levels){var e;if(!this.media&&!this.primaryPrefetch&&(this.startFragRequested||!this.config.startFragPrefetch))return;const{currentTrackId:r,levels:s}=this,i=s[r],o=i==null?void 0:i.details;if(!o||this.waitForLive(i)||this.waitForCdnTuneIn(o)){this.startFragRequested=!1;return}const{config:l}=this,c=this.playhead,d=Rr.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],c,l.maxBufferHole),{end:u,len:h}=d,m=Math.max(this.hls.maxBufferLength+o.levelTargetDuration,((e=this.hls.mainForwardBufferInfo)==null?void 0:e.len)||0);if(h>m||h&&!this.buffering)return;let f=this.getNextFragment(u,o);if(!f)return;if(Oo(f)){var n;const p=f.sn-o.startSN,g=o.fragments[p-1];f.cc===(g==null?void 0:g.cc)&&!((n=o.partList)!=null&&n.length)&&this.fragmentTracker.getState(g)===po.NOT_LOADED&&(f=g)}this.loadFragment(f,i,u)}}loadFragment(e,n,r){const s=this.fragmentTracker.getState(e);(s===po.NOT_LOADED||s===po.PARTIAL)&&super.loadFragment(e,n,r)}get mediaBufferTimeRanges(){return new lrr(this.tracksBuffered[this.currentTrackId]||[])}}class lrr{constructor(e){this.buffered=void 0;const n=(r,s,i)=>{if(s=s>>>0,s>i-1)throw new DOMException(`Failed to execute '${r}' on 'TimeRanges': The index provided (${s}) is greater than the maximum bound (${i})`);return e[s][r]};this.buffered={get length(){return e.length},end(r){return n("end",r,e.length)},start(r){return n("start",r,e.length)}}}}const crr={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},qSt=t=>String.fromCharCode(crr[t]||t),Bp=15,Mp=42,drr={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},urr={17:2,18:4,21:6,22:8,23:10,19:13,20:15},hrr={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},mrr={25:2,26:4,29:6,30:8,31:10,27:13,28:15},frr=["white","green","blue","cyan","red","yellow","magenta","black","transparent"];class prr{constructor(){this.time=null,this.verboseLevel=0}log(e,n){if(this.verboseLevel>=e){const r=typeof n=="function"?n():n;hi.log(`${this.time} [${e}] ${r}`)}}}const oC=function(e){const n=[];for(let r=0;r<e.length;r++)n.push(e[r].toString(16));return n},bxe=Object.freeze({foreground:"white",underline:!1,italics:!1,background:"black",flash:!1});class KSt{constructor(){this.styles=bxe}get foreground(){return this.styles.foreground}set foreground(e){const n=this.styles;this.styles={foreground:e,underline:n.underline,italics:n.italics,background:n.background,flash:n.flash}}get underline(){return this.styles.underline}set underline(e){const n=this.styles;this.styles={foreground:n.foreground,underline:e,italics:n.italics,background:n.background,flash:n.flash}}get italics(){return this.styles.italics}set italics(e){const n=this.styles;this.styles={foreground:n.foreground,underline:n.underline,italics:e,background:n.background,flash:n.flash}}get background(){return this.styles.background}set background(e){const n=this.styles;this.styles={foreground:n.foreground,underline:n.underline,italics:n.italics,background:e,flash:n.flash}}get flash(){return this.styles.flash}set flash(e){const n=this.styles;this.styles={foreground:n.foreground,underline:n.underline,italics:n.italics,background:n.background,flash:e}}reset(){this.styles=bxe}setStyles(e){const n=this.styles,r=Object.prototype.hasOwnProperty;this.styles={foreground:r.call(e,"foreground")?e.foreground:n.foreground,underline:r.call(e,"underline")?e.underline:n.underline,italics:r.call(e,"italics")?e.italics:n.italics,background:r.call(e,"background")?e.background:n.background,flash:r.call(e,"flash")?e.flash:n.flash}}toString(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}class grr{constructor(){this.uchar=" ",this.penState=new KSt}reset(){this.uchar=" ",this.penState.reset()}setChar(e,n){this.uchar=e,this.penState.styles=n.styles}setPenState(e){this.penState.styles=e.styles}copy(e){this.uchar=e.uchar,this.penState.styles=e.penState.styles}}let vrr=class{constructor(e){this.chars=[],this.pos=0,this.currPenState=new KSt,this.cueStartTime=null,this.logger=void 0;for(let n=0;n<Mp;n++)this.chars.push(new grr);this.logger=e}equals(e){const n=this.chars,r=e.chars;for(let s=0;s<Mp;s++){const i=n[s],o=r[s];if(i.uchar!==o.uchar)return!1;const l=i.penState.styles,c=o.penState.styles;if(l!==c&&(l.foreground!==c.foreground||l.underline!==c.underline||l.italics!==c.italics||l.background!==c.background||l.flash!==c.flash))return!1}return!0}copy(e){for(let n=0;n<Mp;n++)this.chars[n].copy(e.chars[n])}isEmpty(){const e=this.chars;for(let n=0;n<Mp;n++){const r=e[n];if(r.uchar!==" ")return!1;const s=r.penState.styles;if(s!==bxe&&(s.foreground!=="white"||s.underline||s.italics||s.background!=="black"||s.flash))return!1}return!0}setCursor(e){this.pos!==e&&(this.pos=e),this.pos<0?(this.logger.log(3,"Negative cursor position "+this.pos),this.pos=0):this.pos>=Mp&&(this.logger.log(3,"Too large cursor position "+this.pos),this.pos=Mp-1)}moveCursor(e){const n=Math.min(this.pos+e,Mp);if(e>1)for(let r=this.pos+1;r<n;r++)this.chars[r].setPenState(this.currPenState);this.setCursor(n)}backSpace(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}insertChar(e){e>=144&&this.backSpace();const n=qSt(e);if(this.pos>=Mp){this.logger.log(0,()=>"Cannot insert "+e.toString(16)+" ("+n+") at position "+this.pos+". Skipping it!");return}this.chars[this.pos].setChar(n,this.currPenState),this.moveCursor(1)}clearFromPos(e){let n;for(n=e;n<Mp;n++)this.chars[n].reset()}clear(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}clearToEndOfRow(){this.clearFromPos(this.pos)}getTextString(){const e=[];let n=!0;for(let r=0;r<Mp;r++){const s=this.chars[r].uchar;s!==" "&&(n=!1),e.push(s)}return n?"":e.join("")}setPenStyles(e){this.currPenState.setStyles(e),this.chars[this.pos].setPenState(this.currPenState)}};class $de{constructor(e){this.rows=[],this.currRow=Bp-1,this.nrRollUpRows=null,this.lastOutputScreen=null,this.logger=void 0;for(let n=0;n<Bp;n++)this.rows.push(new vrr(e));this.logger=e}reset(){for(let e=0;e<Bp;e++)this.rows[e].clear();this.currRow=Bp-1}equals(e){let n=!0;for(let r=0;r<Bp;r++)if(!this.rows[r].equals(e.rows[r])){n=!1;break}return n}copy(e){for(let n=0;n<Bp;n++){const r=this.rows[n].chars,s=e.rows[n].chars;for(let i=0;i<Mp;i++){const o=r[i],l=s[i];o.uchar=l.uchar,o.penState.styles=l.penState.styles}}}isEmpty(){let e=!0;for(let n=0;n<Bp;n++)if(!this.rows[n].isEmpty()){e=!1;break}return e}backSpace(){this.rows[this.currRow].backSpace()}clearToEndOfRow(){this.rows[this.currRow].clearToEndOfRow()}insertChar(e){this.rows[this.currRow].insertChar(e)}setPen(e){this.rows[this.currRow].setPenStyles(e)}moveCursor(e){this.rows[this.currRow].moveCursor(e)}setCursor(e){this.logger.log(2,"setCursor: "+e),this.rows[this.currRow].setCursor(e)}setPAC(e){this.logger.log(2,()=>"pacData = "+ya(e));let n=e.row-1;if(this.nrRollUpRows&&n<this.nrRollUpRows-1&&(n=this.nrRollUpRows-1),this.nrRollUpRows&&this.currRow!==n){for(let l=0;l<Bp;l++)this.rows[l].clear();const i=this.currRow+1-this.nrRollUpRows,o=this.lastOutputScreen;if(o){const l=o.rows[i].cueStartTime,c=this.logger.time;if(l!==null&&c!==null&&l<c)for(let d=0;d<this.nrRollUpRows;d++)this.rows[n-this.nrRollUpRows+d+1].copy(o.rows[i+d])}}this.currRow=n;const r=this.rows[this.currRow];if(e.indent!==null){const i=e.indent,o=Math.max(i-1,0);r.setCursor(e.indent),e.color=r.chars[o].penState.foreground}const s={foreground:e.color,underline:e.underline,italics:e.italics,background:"black",flash:!1};this.setPen(s)}setBkgData(e){this.logger.log(2,()=>"bkgData = "+ya(e)),this.backSpace(),this.setPen(e),this.insertChar(32)}setRollUpRows(e){this.nrRollUpRows=e}rollUp(){if(this.nrRollUpRows===null){this.logger.log(3,"roll_up but nrRollUpRows not set yet");return}this.logger.log(1,()=>this.getDisplayText());const e=this.currRow+1-this.nrRollUpRows,n=this.rows.splice(e,1)[0];n.clear(),this.rows.splice(this.currRow,0,n),this.logger.log(2,"Rolling up")}getDisplayText(e){e=e||!1;const n=[];let r="",s=-1;for(let i=0;i<Bp;i++){const o=this.rows[i].getTextString();o&&(s=i+1,e?n.push("Row "+s+": '"+o+"'"):n.push(o.trim()))}return n.length>0&&(e?r="["+n.join(" | ")+"]":r=n.join(`
`)),r}getTextAndFormat(){return this.rows}}class yrr{constructor(e,n,r){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=e,this.outputFilter=n,this.mode=null,this.verbose=0,this.displayedMemory=new $de(r),this.nonDisplayedMemory=new $de(r),this.lastOutputScreen=new $de(r),this.currRollUpRow=this.displayedMemory.rows[Bp-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=r}reset(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[Bp-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}getHandler(){return this.outputFilter}setHandler(e){this.outputFilter=e}setPAC(e){this.writeScreen.setPAC(e)}setBkgData(e){this.writeScreen.setBkgData(e)}setMode(e){e!==this.mode&&(this.mode=e,this.logger.log(2,()=>"MODE="+e),this.mode==="MODE_POP-ON"?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),this.mode!=="MODE_ROLL-UP"&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=e)}insertChars(e){for(let r=0;r<e.length;r++)this.writeScreen.insertChar(e[r]);const n=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";this.logger.log(2,()=>n+": "+this.writeScreen.getDisplayText(!0)),(this.mode==="MODE_PAINT-ON"||this.mode==="MODE_ROLL-UP")&&(this.logger.log(1,()=>"DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}ccRCL(){this.logger.log(2,"RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}ccBS(){this.logger.log(2,"BS - BackSpace"),this.mode!=="MODE_TEXT"&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}ccAOF(){}ccAON(){}ccDER(){this.logger.log(2,"DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}ccRU(e){this.logger.log(2,"RU("+e+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(e)}ccFON(){this.logger.log(2,"FON - Flash On"),this.writeScreen.setPen({flash:!0})}ccRDC(){this.logger.log(2,"RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}ccTR(){this.logger.log(2,"TR"),this.setMode("MODE_TEXT")}ccRTD(){this.logger.log(2,"RTD"),this.setMode("MODE_TEXT")}ccEDM(){this.logger.log(2,"EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate(!0)}ccCR(){this.logger.log(2,"CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate(!0)}ccENM(){this.logger.log(2,"ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}ccEOC(){if(this.logger.log(2,"EOC - End Of Caption"),this.mode==="MODE_POP-ON"){const e=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=e,this.writeScreen=this.nonDisplayedMemory,this.logger.log(1,()=>"DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate(!0)}ccTO(e){this.logger.log(2,"TO("+e+") - Tab Offset"),this.writeScreen.moveCursor(e)}ccMIDROW(e){const n={flash:!1};if(n.underline=e%2===1,n.italics=e>=46,n.italics)n.foreground="white";else{const r=Math.floor(e/2)-16,s=["white","green","blue","cyan","red","yellow","magenta"];n.foreground=s[r]}this.logger.log(2,"MIDROW: "+ya(n)),this.writeScreen.setPen(n)}outputDataUpdate(e=!1){const n=this.logger.time;n!==null&&this.outputFilter&&(this.cueStartTime===null&&!this.displayedMemory.isEmpty()?this.cueStartTime=n:this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,n,this.lastOutputScreen),e&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:n),this.lastOutputScreen.copy(this.displayedMemory))}cueSplitAtTime(e){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,e,this.displayedMemory),this.cueStartTime=e))}}class mze{constructor(e,n,r){this.channels=[null,null,null],this.currentChannel=0,this.cmdHistory=xrr(),this.logger=void 0,this.field=void 0,this.outputFilters=void 0,this.logger=new prr,this.field=e,this.outputFilters=[null,n,r]}getHandler(e){return this.outputFilters[e]}setHandler(e,n){var r;this.outputFilters[e]=n,(r=this.channels[e])==null||r.setHandler(n)}getChannel(e){let n=this.channels[e];return n||(n=this.channels[e]=new yrr(this.field+e-1,this.outputFilters[e],this.logger)),n}addData(e,n){this.logger.time=e;for(let r=0;r<n.length;r+=2){const s=n[r]&127,i=n[r+1]&127;let o=!1,l=null;if(s===0&&i===0)continue;this.logger.log(3,()=>"["+oC([n[r],n[r+1]])+"] -> ("+oC([s,i])+")");const c=this.cmdHistory;if(s>=16&&s<=31){if(brr(s,i,c)){SV(null,null,c),this.logger.log(3,()=>"Repeated command ("+oC([s,i])+") is dropped");continue}SV(s,i,this.cmdHistory),o=this.parseCmd(s,i),o||(o=this.parseMidrow(s,i)),o||(o=this.parsePAC(s,i)),o||(o=this.parseBackgroundAttributes(s,i))}else SV(null,null,c);if(!o&&(l=this.parseChars(s,i),l)){const u=this.currentChannel;u&&u>0?this.getChannel(u).insertChars(l):this.logger.log(2,"No channel found yet. TEXT-MODE?")}!o&&!l&&this.logger.log(2,()=>"Couldn't parse cleaned data "+oC([s,i])+" orig: "+oC([n[r],n[r+1]]))}}parseCmd(e,n){const r=(e===20||e===28||e===21||e===29)&&n>=32&&n<=47,s=(e===23||e===31)&&n>=33&&n<=35;if(!(r||s))return!1;const i=e===20||e===21||e===23?1:2,o=this.getChannel(i);return e===20||e===21||e===28||e===29?n===32?o.ccRCL():n===33?o.ccBS():n===34?o.ccAOF():n===35?o.ccAON():n===36?o.ccDER():n===37?o.ccRU(2):n===38?o.ccRU(3):n===39?o.ccRU(4):n===40?o.ccFON():n===41?o.ccRDC():n===42?o.ccTR():n===43?o.ccRTD():n===44?o.ccEDM():n===45?o.ccCR():n===46?o.ccENM():n===47&&o.ccEOC():o.ccTO(n-32),this.currentChannel=i,!0}parseMidrow(e,n){let r=0;if((e===17||e===25)&&n>=32&&n<=47){if(e===17?r=1:r=2,r!==this.currentChannel)return this.logger.log(0,"Mismatch channel in midrow parsing"),!1;const s=this.channels[r];return s?(s.ccMIDROW(n),this.logger.log(3,()=>"MIDROW ("+oC([e,n])+")"),!0):!1}return!1}parsePAC(e,n){let r;const s=(e>=17&&e<=23||e>=25&&e<=31)&&n>=64&&n<=127,i=(e===16||e===24)&&n>=64&&n<=95;if(!(s||i))return!1;const o=e<=23?1:2;return n>=64&&n<=95?r=o===1?drr[e]:hrr[e]:r=o===1?urr[e]:mrr[e],this.getChannel(o).setPAC(this.interpretPAC(r,n)),this.currentChannel=o,!0}interpretPAC(e,n){let r;const s={color:null,italics:!1,indent:null,underline:!1,row:e};return n>95?r=n-96:r=n-64,s.underline=(r&1)===1,r<=13?s.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(r/2)]:r<=15?(s.italics=!0,s.color="white"):s.indent=Math.floor((r-16)/2)*4,s}parseChars(e,n){let r,s=null,i=null;if(e>=25?(r=2,i=e-8):(r=1,i=e),i>=17&&i<=19){let o;i===17?o=n+80:i===18?o=n+112:o=n+144,this.logger.log(2,()=>"Special char '"+qSt(o)+"' in channel "+r),s=[o]}else e>=32&&e<=127&&(s=n===0?[e]:[e,n]);return s&&this.logger.log(3,()=>"Char codes =  "+oC(s).join(",")),s}parseBackgroundAttributes(e,n){const r=(e===16||e===24)&&n>=32&&n<=47,s=(e===23||e===31)&&n>=45&&n<=47;if(!(r||s))return!1;let i;const o={};e===16||e===24?(i=Math.floor((n-32)/2),o.background=frr[i],n%2===1&&(o.background=o.background+"_semi")):n===45?o.background="transparent":(o.foreground="black",n===47&&(o.underline=!0));const l=e<=23?1:2;return this.getChannel(l).setBkgData(o),!0}reset(){for(let e=0;e<Object.keys(this.channels).length;e++){const n=this.channels[e];n&&n.reset()}SV(null,null,this.cmdHistory)}cueSplitAtTime(e){for(let n=0;n<this.channels.length;n++){const r=this.channels[n];r&&r.cueSplitAtTime(e)}}}function SV(t,e,n){n.a=t,n.b=e}function brr(t,e,n){return n.a===t&&n.b===e}function xrr(){return{a:null,b:null}}class CV{constructor(e,n){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=e,this.trackName=n}dispatchCue(){this.startTime!==null&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)}newCue(e,n,r){(this.startTime===null||this.startTime>e)&&(this.startTime=e),this.endTime=n,this.screen=r,this.timelineController.createCaptionsTrack(this.trackName)}reset(){this.cueRanges=[],this.startTime=null}}class wrr{constructor(e){this.hls=void 0,this.media=null,this.config=void 0,this.enabled=!0,this.Cues=void 0,this.tracks=[],this.initPTS=[],this.unparsedVttFrags=[],this.captionsTracks={},this.cueCache={},this.nonNativeCaptionsTracks={},this.cea608Parser1=void 0,this.cea608Parser2=void 0,this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=fze(),this.captionsProperties=void 0,this.hls=e,this.config=e.config,this.Cues=e.config.cueHandler,this.cueCache={},this.captionsProperties={textTrack1:{label:this.config.captionsTextTrack1Label,languageCode:this.config.captionsTextTrack1LanguageCode},textTrack2:{label:this.config.captionsTextTrack2Label,languageCode:this.config.captionsTextTrack2LanguageCode},textTrack3:{label:this.config.captionsTextTrack3Label,languageCode:this.config.captionsTextTrack3LanguageCode},textTrack4:{label:this.config.captionsTextTrack4Label,languageCode:this.config.captionsTextTrack4LanguageCode}},e.on(oe.MEDIA_ATTACHING,this.onMediaAttaching,this),e.on(oe.MEDIA_DETACHING,this.onMediaDetaching,this),e.on(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.on(oe.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(oe.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.on(oe.FRAG_LOADING,this.onFragLoading,this),e.on(oe.FRAG_LOADED,this.onFragLoaded,this),e.on(oe.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.on(oe.FRAG_DECRYPTED,this.onFragDecrypted,this),e.on(oe.INIT_PTS_FOUND,this.onInitPtsFound,this),e.on(oe.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.on(oe.BUFFER_APPENDED,this.onBufferAppended,this),e.on(oe.BUFFER_FLUSHING,this.onBufferFlushing,this)}destroy(){const{hls:e}=this;e.off(oe.MEDIA_ATTACHING,this.onMediaAttaching,this),e.off(oe.MEDIA_DETACHING,this.onMediaDetaching,this),e.off(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.off(oe.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(oe.SUBTITLE_TRACKS_UPDATED,this.onSubtitleTracksUpdated,this),e.off(oe.FRAG_LOADING,this.onFragLoading,this),e.off(oe.FRAG_LOADED,this.onFragLoaded,this),e.off(oe.FRAG_PARSING_USERDATA,this.onFragParsingUserdata,this),e.off(oe.FRAG_DECRYPTED,this.onFragDecrypted,this),e.off(oe.INIT_PTS_FOUND,this.onInitPtsFound,this),e.off(oe.SUBTITLE_TRACKS_CLEARED,this.onSubtitleTracksCleared,this),e.off(oe.BUFFER_APPENDED,this.onBufferAppended,this),e.off(oe.BUFFER_FLUSHING,this.onBufferFlushing,this),this.hls=this.config=this.media=null,this.cea608Parser1=this.cea608Parser2=void 0}initCea608Parsers(){const e=new CV(this,"textTrack1"),n=new CV(this,"textTrack2"),r=new CV(this,"textTrack3"),s=new CV(this,"textTrack4");this.cea608Parser1=new mze(1,e,n),this.cea608Parser2=new mze(3,r,s)}addCues(e,n,r,s,i){let o=!1;for(let c=i.length;c--;){const d=i[c],u=krr(d[0],d[1],n,r);if(u>=0&&(d[0]=Math.min(d[0],n),d[1]=Math.max(d[1],r),o=!0,u/(r-n)>.5))return}if(o||i.push([n,r]),this.config.renderTextTracksNatively){const c=this.cueCache[e];if(c){const d=this.Cues.newCue(null,n,r,s);d.length&&c.push.apply(c,d)}else{const d=this.captionsTracks[e].track;this.Cues.newCue(d,n,r,s)}}else{var l;const c=this.Cues.newCue(null,n,r,s),d=(l=this.captionsProperties[e])==null?void 0:l.media;this.hls.trigger(oe.CUES_PARSED,{type:"captions",cues:c,track:e,closedCaptions:d})}}onInitPtsFound(e,{id:n,timestampOffsets:r}){const{unparsedVttFrags:s}=this;n===Wn.MAIN&&(this.initPTS=r),s.length&&(this.unparsedVttFrags=[],s.forEach(i=>{this.initPTS[i.frag.cc]?this.onFragLoaded(oe.FRAG_LOADED,i):this.hls.trigger(oe.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:i.frag,part:null,error:new Error("Subtitle discontinuity domain does not match main")})}))}createCaptionsTrack(e){this.config.renderTextTracksNatively?this.createNativeTrack(e):this.createNonNativeTrack(e)}createNativeTrack(e){if(this.captionsTracks[e])return;const{captionsProperties:n,captionsTracks:r,cueCache:s,media:i}=this,{label:o,languageCode:l}=n[e];i&&(s[e]=[],r[e]=P_e(i,"captions",o,l,"hidden"))}createNonNativeTrack(e){if(this.nonNativeCaptionsTracks[e])return;const n=this.captionsProperties[e];if(!n)return;const r=n.label,s={_id:e,label:r,kind:"captions",default:n.media?!!n.media.default:!1,closedCaptions:n.media};this.nonNativeCaptionsTracks[e]=s,this.hls.trigger(oe.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:[s]})}onMediaAttaching(e,n){this.media=n.media}onMediaDetaching(e,n){const r=!!n.transferMedia;if(this.media=null,!r){if(this.config.renderTextTracksNatively){const{captionsTracks:s,cueCache:i}=this;for(const o in s)s[o].remove(),delete i[o]}this.cueCache={},this.captionsTracks={},this.nonNativeCaptionsTracks={}}}onManifestLoading(){this.lastCc=-1,this.lastSn=-1,this.lastPartIndex=-1,this.prevCC=-1,this.vttCCs=fze(),this.tracks=[],this.captionsTracks={},this.nonNativeCaptionsTracks={},this.unparsedVttFrags=[],this.initPTS=[],this.cea608Parser1&&this.cea608Parser2&&(this.cea608Parser1.reset(),this.cea608Parser2.reset())}onSubtitleTracksUpdated(e,n){const r=n.subtitleTracks||[];if(r.length&&!this.config.renderTextTracksNatively&&!fSt(this.tracks,r)){const s=r.map(i=>({label:i.name,kind:i.type.toLowerCase(),default:i.default,subtitleTrack:i}));this.hls.trigger(oe.NON_NATIVE_TEXT_TRACKS_FOUND,{tracks:s})}this.tracks=r}onManifestLoaded(e,n){this.config.enableCEA708Captions&&n.captions&&n.captions.forEach(r=>{const s=/(?:CC|SERVICE)([1-4])/.exec(r.instreamId);if(!s)return;const i=`textTrack${s[1]}`,o=this.captionsProperties[i];o&&(o.label=r.name,r.lang&&(o.languageCode=r.lang),o.media=r)})}closedCaptionsForLevel(e){const n=this.hls.levels[e.level];return n==null?void 0:n.attrs["CLOSED-CAPTIONS"]}onFragLoading(e,n){if(this.enabled&&n.frag.type===Wn.MAIN){var r,s;const{cea608Parser1:i,cea608Parser2:o,lastSn:l}=this,{cc:c,sn:d}=n.frag,u=(r=(s=n.part)==null?void 0:s.index)!=null?r:-1;i&&o&&(d!==l+1||d===l&&u!==this.lastPartIndex+1||c!==this.lastCc)&&(i.reset(),o.reset()),this.lastCc=c,this.lastSn=d,this.lastPartIndex=u}}onFragLoaded(e,n){const{frag:r,payload:s}=n;if(r.level<this.tracks.length&&r.type===Wn.SUBTITLE){var i;if(s.byteLength||(i=r.initSegment)!=null&&(i=i.data)!=null&&i.byteLength){const o=r.decryptdata,l="stats"in n;if(o==null||!o.encrypted||l){const c=this.tracks[r.level],d=this.vttCCs;d[r.cc]||(d[r.cc]={start:r.start,prevCC:this.prevCC,new:!0},this.prevCC=r.cc),(c==null?void 0:c.textCodec)===pxe?this._parseIMSC1(n):this._parseVTTs(n)}}else{const o="part"in n?n.part:null;this.hls.trigger(oe.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,part:o,error:new Error("Empty subtitle payload")})}}}_parseIMSC1(e){const{frag:n,payload:r}=e,s="part"in e?e.part:null,i=this.hls;rze(r,this.initPTS[n.cc],o=>{this._appendCues(o,n.level),i.trigger(oe.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:n,part:s})},o=>{i.logger.log(`Cannot parse IMSC1 (sn: ${n.sn} @${n.start}): ${o}`),i.trigger(oe.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:n,part:s,error:o})})}_parseVTTs(e){var n;const{frag:r,payload:s}=e,i="part"in e?e.part:null,{initPTS:o,unparsedVttFrags:l}=this,c=o.length-1;if(!o[r.cc]&&c===-1){l.push(e);return}const d=this.hls,u=(n=r.initSegment)==null?void 0:n.data,h=u?Wf(u,new Uint8Array(s)).buffer:s;Anr(h,this.initPTS[r.cc],this.vttCCs,r.cc,(i&&!u?i:r).start,m=>{this._appendCues(m,r.level),d.trigger(oe.SUBTITLE_FRAG_PROCESSED,{success:!0,frag:r,part:i})},m=>{const f=m.message.startsWith("Missing initPTS");if(d.logger.log(`${f?"Deferred parsing of":"Cannot parse"} VTT cue (sn: ${r.sn} @${r.start}): ${m}`),f){l.push(e);return}else this.config.enableIMSC1&&this._fallbackToIMSC1(e);d.trigger(oe.SUBTITLE_FRAG_PROCESSED,{success:!1,frag:r,part:i,error:m})})}_fallbackToIMSC1(e){const{frag:n,payload:r}=e,s=this.tracks[n.level];s.textCodec||rze(r,this.initPTS[n.cc],()=>{s.textCodec=pxe,this._parseIMSC1(e)},()=>{s.textCodec="wvtt"})}_appendCues(e,n){const r=this.hls;if(this.config.renderTextTracksNatively){var s;const i=(s=this.tracks[n].trackNode)==null?void 0:s.track;if(!i||i.mode==="disabled")return;e.forEach(o=>gxe(i,o))}else{const i=this.tracks[n];if(!i)return;const o=i.default?"default":"subtitles"+n;r.trigger(oe.CUES_PARSED,{type:"subtitles",cues:e,track:o,subtitleTrack:i})}}onFragDecrypted(e,n){const{frag:r}=n;r.type===Wn.SUBTITLE&&this.onFragLoaded(oe.FRAG_LOADED,n)}onSubtitleTracksCleared(){this.tracks=[],this.captionsTracks={}}onFragParsingUserdata(e,n){if(!this.enabled||!this.config.enableCEA708Captions)return;const{frag:r,samples:s}=n;if(!(r.type===Wn.MAIN&&this.closedCaptionsForLevel(r)==="NONE"))for(let i=0;i<s.length;i++){const o=s[i].bytes;if(o){this.cea608Parser1||this.initCea608Parsers();const l=this.extractCea608Data(o);this.cea608Parser1.addData(s[i].pts,l[0]),this.cea608Parser2.addData(s[i].pts,l[1])}}}onBufferAppended(e,n){if(this.config.renderTextTracksNatively){var r;const{type:s,timeRanges:i}=n;if(s==="video"&&(r=i[s])!=null&&r.length){const{captionsTracks:o,cueCache:l}=this;Object.keys(l).forEach(c=>{var d;const u=(d=o[c])==null?void 0:d.track;if(u){const h=l[c];for(let m=0;m<h.length;m++)gxe(u,h[m])}delete l[c]})}}}onBufferFlushing(e,n){const{startOffset:r,endOffset:s,endOffsetSubtitles:i,type:o}=n,{media:l}=this;if(!(!l||l.currentTime<s)){if(!o||o==="video"){const{captionsTracks:c,cueCache:d}=this;Object.keys(c).forEach(u=>vxe(c[u].track,r,s)),Object.keys(d).forEach(u=>{const h=d[u];for(let m=h.length;m--;){const f=h[m];f.startTime>=r&&f.endTime<=s&&h.splice(m,1)}})}this.config.renderTextTracksNatively&&r===0&&i!==void 0&&this.tracks.forEach(c=>{var d;const u=(d=c.trackNode)==null?void 0:d.track;u&&vxe(u,r,i)})}}extractCea608Data(e){const n=[[],[]],r=e[0]&31;let s=2;for(let i=0;i<r;i++){const o=e[s++],l=127&e[s++],c=127&e[s++];if(l===0&&c===0)continue;if((4&o)!==0){const u=3&o;(u===0||u===1)&&(n[u].push(l),n[u].push(c))}}return n}}function krr(t,e,n,r){return Math.min(e,r)-Math.max(t,n)}function fze(){return{ccOffset:0,presentationOffset:0,0:{start:0,prevCC:-1,new:!0}}}const Srr=/\s/,Crr={newCue(t,e,n,r){const s=[];let i,o,l,c,d;const u=self.VTTCue||self.TextTrackCue;for(let m=0;m<r.rows.length;m++)if(i=r.rows[m],l=!0,c=0,d="",!i.isEmpty()){var h;for(let g=0;g<i.chars.length;g++)Srr.test(i.chars[g].uchar)&&l?c++:(d+=i.chars[g].uchar,l=!1);i.cueStartTime=e,e===n&&(n+=1e-4),c>=16?c--:c++;const f=OSt(d.trim()),p=A_e(e,n,f);t!=null&&(h=t.cues)!=null&&h.getCueById(p)||(o=new u(e,n,f),o.id=p,o.line=m+1,o.align="left",o.position=10+Math.min(80,Math.floor(c*8/32)*10),s.push(o))}return t&&s.length&&(s.sort((m,f)=>m.line==="auto"||f.line==="auto"?0:m.line>8&&f.line>8?f.line-m.line:m.line-f.line),s.forEach(m=>gxe(t,m))),s}};class YSt{constructor(){this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=0,this.config=null,this.callbacks=null,this.context=null,this.stats=new r_e}destroy(){this.callbacks=this.context=this.config=null,this.abortInternal(),this.stats=null}load(e,n,r){const s=this.stats;if(s.loading.start)throw new Error("Loader can only be used once.");s.loading.start=self.performance.now(),this.context=e,this.config=n,this.callbacks=r,this.loadInternal()}abort(){var e;this.abortInternal(),(e=this.callbacks)!=null&&e.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.getNetworkDetails())}loadtimeout(){if(!this.config)return;const e=this.config.loadPolicy.timeoutRetry,n=this.stats.retry;if(L6(e,n,!0))this.retry(e);else{var r;hi.warn(`timeout while loading ${(r=this.context)==null?void 0:r.url}`);const s=this.callbacks;s&&(this.abortInternal(),s.onTimeout(this.stats,this.context,this.getNetworkDetails()))}}retry(e){const{context:n,stats:r}=this;this.retryDelay=s_e(e,r.retry),r.retry++,hi.warn(`${status?"HTTP Status "+status:"Timeout"} while loading ${n==null?void 0:n.url}, retrying ${r.retry}/${e.maxNumRetry} in ${this.retryDelay}ms`),this.abortInternal(),this.resetInternalLoader(),self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(()=>this.loadInternal(),this.retryDelay)}}function jrr(){if(self.fetch&&self.AbortController&&self.ReadableStream&&self.Request)try{return new self.ReadableStream({}),!0}catch{}return!1}const Err=/(\d+)-(\d+)\/(\d+)/;class pze extends YSt{constructor(e){super(),this.fetchSetup=void 0,this.request=null,this.response=null,this.controller=null,this.fetchSetup=e.fetchSetup||Arr}destroy(){this.request=null,super.destroy(),this.response=null,this.controller=null,this.fetchSetup=null}abortInternal(){self.clearTimeout(this.retryTimeout),this.controller&&!this.stats.loading.end&&(this.stats.aborted=!0,this.controller.abort())}getNetworkDetails(){return this.response}resetInternalLoader(){this.response=null}loadInternal(){const{config:e,context:n,stats:r}=this;if(!e||!n)return;r.loading.first=0,r.loaded=0,r.aborted=!1,this.controller=new self.AbortController;const s=Nrr(n,this.controller.signal),i=n.responseType==="arraybuffer",o=i?"byteLength":"length",{maxTimeToFirstByteMs:l,maxLoadTimeMs:c}=e.loadPolicy;this.request=this.fetchSetup(n,s),self.clearTimeout(this.requestTimeout),e.timeout=l&&xn(l)?l:c,this.requestTimeout=self.setTimeout(()=>{this.loadtimeout()},e.timeout),(H6(this.request)?this.request.then(self.fetch):self.fetch(this.request)).then(u=>{var h;this.response=u;const m=Math.max(self.performance.now(),r.loading.start);if(self.clearTimeout(this.requestTimeout),e.timeout=c,this.requestTimeout=self.setTimeout(()=>{this.loadtimeout()},c-(m-r.loading.start)),!u.ok){const{status:p,statusText:g}=u;throw new Prr(g||"fetch, bad network response",p,u)}r.loading.first=m,r.total=_rr(u.headers)||r.total;const f=(h=this.callbacks)==null?void 0:h.onProgress;return f&&xn(e.highWaterMark)?this.loadProgressively(u,r,n,e.highWaterMark,f):i?u.arrayBuffer():n.responseType==="json"?u.json():u.text()}).then(u=>{var h,m;const f=this.response;if(!f)throw new Error("loader destroyed");self.clearTimeout(this.requestTimeout),r.loading.end=Math.max(self.performance.now(),r.loading.first);const p=u[o];p&&(r.loaded=r.total=p);const g={url:f.url,data:u,code:f.status},v=(h=this.callbacks)==null?void 0:h.onProgress;v&&!xn(e.highWaterMark)&&v(r,n,u,f),(m=this.callbacks)==null||m.onSuccess(g,r,n,f)}).catch(u=>{if(self.clearTimeout(this.requestTimeout),r.aborted)return;const h=u&&u.code||0,m=u?u.message:null,f=e.loadPolicy.errorRetry,p=r.retry,g={url:n.url,data:void 0,code:h};if(L6(f,p,!1,g))this.retry(f);else{var v;hi.error(`${h} while loading ${n.url}`),(v=this.callbacks)==null||v.onError({code:h,text:m},n,u?u.details:null,r)}})}getCacheAge(){let e=null;if(this.response){const n=this.response.headers.get("age");e=n?parseFloat(n):null}return e}getResponseHeader(e){return this.response?this.response.headers.get(e):null}loadProgressively(e,n,r,s=0,i){const o=new Qkt,l=e.body.getReader(),c=()=>l.read().then(d=>{if(d.done)return o.dataLength&&i(n,r,o.flush().buffer,e),Promise.resolve(new ArrayBuffer(0));const u=d.value,h=u.length;return n.loaded+=h,h<s||o.dataLength?(o.push(u),o.dataLength>=s&&i(n,r,o.flush().buffer,e)):i(n,r,u.buffer,e),c()}).catch(()=>Promise.reject());return c()}}function Nrr(t,e){const n={method:"GET",mode:"cors",credentials:"same-origin",signal:e,headers:new self.Headers(Mi({},t.headers))};return t.rangeEnd&&n.headers.set("Range","bytes="+t.rangeStart+"-"+String(t.rangeEnd-1)),n}function Trr(t){const e=Err.exec(t);if(e)return parseInt(e[2])-parseInt(e[1])+1}function _rr(t){const e=t.get("Content-Range");if(e){const r=Trr(e);if(xn(r))return r}const n=t.get("Content-Length");if(n)return parseInt(n)}function Arr(t,e){return new self.Request(t.url,e)}class Prr extends Error{constructor(e,n,r){super(e),this.code=void 0,this.details=void 0,this.code=n,this.details=r}}const Rrr=(t,e,n)=>Math.max(e,Math.min(t,n)),Irr=/^age:\s*[\d.]+\s*$/im;class QSt extends YSt{constructor(e){super(),this.xhrSetup=void 0,this.loader=null,this.xhrSetup=e.xhrSetup||null}destroy(){super.destroy(),this.loader=null,this.xhrSetup=null}abortInternal(){const e=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),e&&(e.onreadystatechange=null,e.onprogress=null,e.readyState!==4&&(this.stats.aborted=!0,e.abort()))}getNetworkDetails(){return this.loader}resetInternalLoader(){this.loader=null}loadInternal(){const{config:e,context:n}=this;if(!e||!n)return;const r=this.loader=new self.XMLHttpRequest,s=this.stats;s.loading.first=0,s.loaded=0,s.aborted=!1;const i=this.xhrSetup;i?Promise.resolve().then(()=>{if(!(this.loader!==r||this.stats.aborted))return i.call(this,r,n.url,n)}).catch(o=>{if(!(this.loader!==r||this.stats.aborted))return r.open("GET",n.url,!0),i.call(this,r,n.url,n)}).then(()=>{this.loader!==r||this.stats.aborted||this.openAndSendXhr(r,n,e)}).catch(o=>{var l;(l=this.callbacks)==null||l.onError({code:r.status,text:o.message},n,r,s)}):this.openAndSendXhr(r,n,e)}openAndSendXhr(e,n,r){e.readyState||e.open("GET",n.url,!0);const s=n.headers,{maxTimeToFirstByteMs:i,maxLoadTimeMs:o}=r.loadPolicy;if(s)for(const l in s)e.setRequestHeader(l,s[l]);n.rangeEnd&&e.setRequestHeader("Range",`bytes=${n.rangeStart}-${n.rangeEnd-1}`),e.onreadystatechange=this.readystatechange.bind(this),e.onprogress=this.loadprogress.bind(this),e.responseType=n.responseType,self.clearTimeout(this.requestTimeout),r.timeout=i&&xn(i)?i:o,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),r.timeout),e.send()}readystatechange(){const{context:e,loader:n,stats:r}=this;if(!e||!n)return;const s=n.readyState,i=this.config;if(!r.aborted&&s>=2&&(r.loading.first===0&&(r.loading.first=Math.max(self.performance.now(),r.loading.start),i.timeout!==i.loadPolicy.maxLoadTimeMs&&(self.clearTimeout(this.requestTimeout),i.timeout=i.loadPolicy.maxLoadTimeMs,this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),i.loadPolicy.maxLoadTimeMs-(r.loading.first-r.loading.start)))),s===4)){self.clearTimeout(this.requestTimeout),n.onreadystatechange=null,n.onprogress=null;const d=n.status,u=n.responseType==="text"?n.responseText:null;if(d>=200&&d<300){const p=u??n.response;if(p!=null){var o,l;r.loading.end=Math.max(self.performance.now(),r.loading.first);const g=n.responseType==="arraybuffer"?p.byteLength:p.length;r.loaded=r.total=g,r.bwEstimate=r.total*8e3/(r.loading.end-r.loading.first);const v=(o=this.callbacks)==null?void 0:o.onProgress;v&&v(r,e,p,n);const b={url:n.responseURL,data:p,code:d};e.rangeEnd&&g!==e.rangeEnd-e.rangeStart&&hi.warn(`Payload length ${g} does not match requested Range: bytes=${e.rangeStart}-${e.rangeEnd-1}`),(l=this.callbacks)==null||l.onSuccess(b,r,e,n);return}}const h=i.loadPolicy.errorRetry,m=r.retry,f={url:e.url,data:void 0,code:d};if(L6(h,m,!1,f))this.retry(h);else{var c;hi.error(`${d} while loading ${e.url}`),(c=this.callbacks)==null||c.onError({code:d,text:n.statusText},e,n,r)}}}loadprogress(e){const n=this.stats;n.loaded=e.loaded,e.lengthComputable&&(n.total=e.total)}getCacheAge(){let e=null;if(this.loader&&Irr.test(this.loader.getAllResponseHeaders())){const n=this.loader.getResponseHeader("age");e=n?parseFloat(n):null}return e}getResponseHeader(e){return this.loader&&new RegExp(`^${e}:\\s*[\\d.]+\\s*$`,"im").test(this.loader.getAllResponseHeaders())?this.loader.getResponseHeader(e):null}}const Mrr={maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:null,errorRetry:null},Lrr=rr(rr({autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,ignoreDevicePixelRatio:!1,maxDevicePixelRatio:Number.POSITIVE_INFINITY,preferManagedMediaSource:!1,initialLiveManifestSize:1,maxBufferLength:30,backBufferLength:1/0,frontBufferFlushThreshold:1/0,loopBackBufferFlush:void 0,startOnSegmentBoundary:!1,nextAudioTrackBufferFlushForwardOffset:.25,maxBufferSize:60*1e3*1e3,maxFragLookUpTolerance:.25,maxBufferHole:.1,detectStallWithCurrentTimeMs:1250,highBufferWatchdogPeriod:2,nudgeOffset:.1,nudgeMaxRetry:3,nudgeOnVideoHole:!0,skipBufferHolePadding:.1,liveSyncMode:"edge",liveSyncDurationCount:3,liveSyncOnStallIncrease:1,liveMaxLatencyDurationCount:1/0,liveMaxUnchangedPlaylistRefresh:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxLiveSyncPlaybackRate:1,liveDurationInfinity:!1,liveBackBufferLength:null,maxMaxBufferLength:600,enableWorker:!0,workerPath:null,enableSoftwareAES:!0,startLevel:void 0,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,appendTimeout:1/0,ignorePlaylistParsingErrors:!1,loader:QSt,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,licenseXhrSetup:void 0,licenseResponseCallback:void 0,stretchShortVideoTrack:!1,maxAudioFramesDrift:1,forceKeyFrameOnDiscontinuity:!0,handleMpegTsVideoIntegrityErrors:"process",abrEwmaFastLive:3,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrEwmaDefaultEstimateMax:5e6,abrBandWidthFactor:.95,abrBandWidthUpFactor:.7,abrMaxWithRealBitrate:!1,abrSwitchInterval:0,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0,emeEnabled:!1,widevineLicenseUrl:void 0,drmSystems:{},drmSystemOptions:{},requestMediaKeySystemAccessFunc:Bkt,requireKeySystemAccessOnStart:!1,testBandwidth:!0,progressive:!1,lowLatencyMode:!0,cmcd:void 0,enableDateRangeMetadataCues:!0,enableEmsgMetadataCues:!0,enableEmsgKLVMetadata:!1,enableID3MetadataCues:!0,emsgKLVSchemaUri:void 0,enableInterstitialPlayback:!0,interstitialAppendInPlace:!0,interstitialLiveLookAhead:10,iframeCacheLimit:2*1024*1024,useMediaCapabilities:!0,preserveManualLevelOnError:!1,errorPenaltyExpireMs:0,certLoadPolicy:{default:Mrr},keyLoadPolicy:{default:{maxTimeToFirstByteMs:8e3,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"},errorRetry:{maxNumRetry:8,retryDelayMs:1e3,maxRetryDelayMs:2e4,backoff:"linear"}}},manifestLoadPolicy:{default:{maxTimeToFirstByteMs:1/0,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},playlistLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:2,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},fragLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:12e4,timeoutRetry:{maxNumRetry:4,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:6,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},steeringManifestLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:2e4,timeoutRetry:{maxNumRetry:2,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:1,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},interstitialAssetListLoadPolicy:{default:{maxTimeToFirstByteMs:1e4,maxLoadTimeMs:3e4,timeoutRetry:{maxNumRetry:0,retryDelayMs:0,maxRetryDelayMs:0},errorRetry:{maxNumRetry:0,retryDelayMs:1e3,maxRetryDelayMs:8e3}}},manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,streamController:HSt,abrController:xXn,bufferController:ltr,capLevelController:k_e,errorController:CXn,fpsController:Snr,id3TrackController:Vnr,gapController:Unr,latencyController:arr},Drr()),{},{subtitleStreamController:orr,subtitleTrackController:Fnr,timelineController:wrr,audioStreamController:ntr,audioTrackController:rtr,emeController:sP,cmcdController:gnr,contentSteeringController:ynr,iframeController:Qnr,interstitialsController:irr});function Drr(){return{cueHandler:Crr,enableWebVTT:!0,enableIMSC1:!0,enableCEA708Captions:!0,captionsTextTrack1Label:"English",captionsTextTrack1LanguageCode:"en",captionsTextTrack2Label:"Spanish",captionsTextTrack2LanguageCode:"es",captionsTextTrack3Label:"Unknown CC",captionsTextTrack3LanguageCode:"",captionsTextTrack4Label:"Unknown CC",captionsTextTrack4LanguageCode:"",renderTextTracksNatively:!0}}function $rr(t,e,n){if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");if(e.liveMaxLatencyDurationCount!==void 0&&(e.liveSyncDurationCount===void 0||e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount))throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be greater than "liveSyncDurationCount"');if(e.liveMaxLatencyDuration!==void 0&&(e.liveSyncDuration===void 0||e.liveMaxLatencyDuration<=e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be greater than "liveSyncDuration"');if(e.liveMaxUnchangedPlaylistRefresh!==void 0){const o=e.liveMaxUnchangedPlaylistRefresh,l=Rrr(o,2,1/0);l!==o&&n.warn(`hls.js config: "liveMaxUnchangedPlaylistRefresh" clamped from ${o} to ${l}.`),e.liveMaxUnchangedPlaylistRefresh=l}const r=xxe(t),s=["manifest","level","frag"],i=["TimeOut","MaxRetry","RetryDelay","MaxRetryTimeout"];return s.forEach(o=>{const l=`${o==="level"?"playlist":o}LoadPolicy`,c=e[l]===void 0,d=[];i.forEach(u=>{const h=`${o}Loading${u}`,m=e[h];if(m!==void 0&&c){d.push(h);const f=r[l].default;switch(e[l]={default:f},u){case"TimeOut":f.maxLoadTimeMs=m,f.maxTimeToFirstByteMs=m;break;case"MaxRetry":f.errorRetry.maxNumRetry=m,f.timeoutRetry.maxNumRetry=m;break;case"RetryDelay":f.errorRetry.retryDelayMs=m,f.timeoutRetry.retryDelayMs=m;break;case"MaxRetryTimeout":f.errorRetry.maxRetryDelayMs=m,f.timeoutRetry.maxRetryDelayMs=m;break}}}),d.length&&n.warn(`hls.js config: "${d.join('", "')}" setting(s) are deprecated, use "${l}": ${ya(e[l])}`)}),rr(rr({},r),e)}function xxe(t){return t&&typeof t=="object"?Array.isArray(t)?t.map(xxe):Object.keys(t).reduce((e,n)=>(e[n]=xxe(t[n]),e),{}):t}function Orr(t,e){const n=t.loader;n!==pze&&n!==QSt?(e.log("[config]: Custom loader detected, cannot enable progressive streaming"),t.progressive=!1):jrr()&&(t.loader=pze,t.progressive=!0,t.enableSoftwareAES=!0,e.log("[config]: Progressive streaming enabled, using FetchLoader"))}class Frr extends w_e{constructor(e,n){super(e,"level-controller"),this._levels=[],this._firstLevel=-1,this._maxAutoLevel=-1,this._startLevel=void 0,this.currentLevel=null,this.currentLevelIndex=-1,this.manualLevelIndex=-1,this.steering=void 0,this.lastABRSwitchTime=-1,this._iframeVariants=[],this.onParsedComplete=void 0,this.steering=n,this._registerListeners()}_registerListeners(){const{hls:e}=this;e.on(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.on(oe.MANIFEST_LOADED,this.onManifestLoaded,this),e.on(oe.LEVEL_LOADED,this.onLevelLoaded,this),e.on(oe.LEVELS_UPDATED,this.onLevelsUpdated,this),e.on(oe.FRAG_BUFFERED,this.onFragBuffered,this),e.on(oe.ERROR,this.onError,this)}_unregisterListeners(){const{hls:e}=this;e.off(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.off(oe.MANIFEST_LOADED,this.onManifestLoaded,this),e.off(oe.LEVEL_LOADED,this.onLevelLoaded,this),e.off(oe.LEVELS_UPDATED,this.onLevelsUpdated,this),e.off(oe.FRAG_BUFFERED,this.onFragBuffered,this),e.off(oe.ERROR,this.onError,this)}destroy(){this._unregisterListeners(),this.steering=null,this.resetLevels(),super.destroy()}stopLoad(){this._levels.forEach(n=>{n.loadError=0,n.fragmentError=0}),super.stopLoad()}resetLevels(){this._startLevel=void 0,this.manualLevelIndex=-1,this.currentLevelIndex=-1,this.currentLevel=null,this._levels=[],this._maxAutoLevel=-1,this._iframeVariants=[]}onManifestLoading(e,n){this.resetLevels()}onManifestLoaded(e,n){const r=this.hls.config.preferManagedMediaSource,s=[],i={},o={};let l=!1,c=!1,d=!1,u=!1;n.levels.forEach(h=>{const m=h.attrs,f=gze(h,r),{audioCodec:p,videoCodec:g,imageCodec:v,width:b,height:x}=h;if(!f){this.log(`Some or all CODECS not supported "${m.CODECS}"`);return}l||(l=!!(b&&x)),c||(c=!!g),d||(d=!!p),u||(u=!!v);const{CODECS:w,"FRAME-RATE":k,"HDCP-LEVEL":S,"PATHWAY-ID":C,RESOLUTION:j,"VIDEO-RANGE":E}=m,A=`${`${C||"."}-`}${h.bitrate}-${j}-${k}-${w}-${E}-${S}`;if(i[A])if(i[A].uri!==h.url&&!h.attrs["PATHWAY-ID"]){const _=o[A]+=1;h.attrs["PATHWAY-ID"]=new Array(_+1).join(".");const T=this.createLevel(h);i[A]=T,s.push(T)}else h.iframes||(i[A].addGroupId("audio",m.AUDIO),i[A].addGroupId("text",m.SUBTITLES));else{const _=this.createLevel(h);i[A]=_,o[A]=1,s.push(_)}}),this.filterAndSortMediaOptions(s,n,l,c,d,u)}createLevel(e){const n=new U6(e),r=e.supplemental;if(r!=null&&r.videoCodec&&!JSt(r.videoCodec,this.hls.config.preferManagedMediaSource)){const s=new Error(`SUPPLEMENTAL-CODECS not supported "${r.videoCodec}"`);this.log(s.message),n.supportedResult=Ckt(s,[])}return n}filterAndSortMediaOptions(e,n,r,s,i,o){var l;let c=[],d=[],u=e;const h=((l=n.stats)==null?void 0:l.parsing)||{},m=this.hls.config.preferManagedMediaSource;if((r||s)&&i&&(u=u.filter(({videoCodec:S,videoRange:C,width:j,height:E})=>(!!S||!!(j&&E))&&uXn(C))),s&&o&&(u=u.filter(S=>!S.imageCodec)),u.length===0){Promise.resolve().then(()=>{if(this.hls){let S="no level with compatible codecs found in manifest",C=S;n.levels.length&&(C=`one or more CODECS in variant not supported: ${ya(n.levels.map(E=>E.attrs.CODECS).filter((E,N,A)=>A.indexOf(E)===N))}`,this.warn(C),S+=` (${C})`);const j=new Error(S);this.hls.trigger(oe.ERROR,{type:er.MEDIA_ERROR,details:rt.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:n.url,error:j,reason:C})}}),h.end=performance.now();return}n.audioTracks&&(c=n.audioTracks.filter(S=>!S.audioCodec||ZSt(S.audioCodec,m)),vze(c)),n.subtitles&&(d=n.subtitles,vze(d));const f=u.slice(0);u.sort((S,C)=>{if(S.attrs["HDCP-LEVEL"]!==C.attrs["HDCP-LEVEL"])return(S.attrs["HDCP-LEVEL"]||"")>(C.attrs["HDCP-LEVEL"]||"")?1:-1;if(r&&S.height!==C.height)return S.height-C.height;if(S.frameRate!==C.frameRate)return S.frameRate-C.frameRate;if(S.videoRange!==C.videoRange)return sZ.indexOf(S.videoRange)-sZ.indexOf(C.videoRange);if(S.videoCodec!==C.videoCodec){const j=J9e(S.videoCodec),E=J9e(C.videoCodec);if(j!==E)return E-j}if(S.uri===C.uri&&S.codecSet!==C.codecSet){const j=nZ(S.codecSet),E=nZ(C.codecSet);if(j!==E)return E-j}return S.averageBitrate!==C.averageBitrate?S.averageBitrate-C.averageBitrate:0});let p=f[0];if(this.steering&&(u=this.steering.filterParsedLevels(u),u.length!==f.length)){for(let S=0;S<f.length;S++)if(f[S].pathwayId===u[0].pathwayId){p=f[S];break}}this._levels=u;for(let S=0;S<u.length;S++)if(u[S]===p){var g;this._firstLevel=S;const C=p.bitrate,j=this.hls.bandwidthEstimate;if(this.log(`manifest loaded, ${u.length} level(s) found, first bitrate: ${C}`),((g=this.hls.userConfig)==null?void 0:g.abrEwmaDefaultEstimate)===void 0){const E=Math.min(C,this.hls.config.abrEwmaDefaultEstimateMax);E>j&&j===this.hls.abrEwmaDefaultEstimate&&(this.hls.bandwidthEstimate=E)}break}const v=n.iframeVariants.filter(S=>gze(S,m));this._iframeVariants=v;const b=i&&!s,x=this.hls.config,w=!!(x.audioStreamController&&x.audioTrackController),k={levels:u,audioTracks:c,subtitleTracks:d,iframeVariants:v,sessionData:n.sessionData,sessionKeys:n.sessionKeys,firstLevel:this._firstLevel,stats:n.stats,audio:i,video:s,altAudio:w&&!b&&c.some(S=>!!S.url)};h.end=performance.now(),this.hls.trigger(oe.MANIFEST_PARSED,k)}get iframeVariants(){return this._iframeVariants.length===0?null:this._iframeVariants}get levels(){return this._levels.length===0?null:this._levels}get loadLevelObj(){return this.currentLevel}get level(){return this.currentLevelIndex}set level(e){const n=this._levels;if(n.length===0)return;if(e<0||e>=n.length){const u=new Error("invalid level idx"),h=e<0;if(this.hls.trigger(oe.ERROR,{type:er.OTHER_ERROR,details:rt.LEVEL_SWITCH_ERROR,level:e,fatal:h,error:u,reason:u.message}),h)return;e=Math.min(e,n.length-1)}const r=this.currentLevelIndex,s=this.currentLevel,i=s?s.attrs["PATHWAY-ID"]:void 0,o=n[e],l=o.attrs["PATHWAY-ID"];if(this.currentLevelIndex=e,this.currentLevel=o,r===e&&s&&i===l)return;this.log(`Switching to level ${e} (${o.height?o.height+"p ":""}${o.videoRange?o.videoRange+" ":""}${o.codecSet?o.codecSet+" ":""}@${o.bitrate})${l?" with Pathway "+l:""} from level ${r}${i?" with Pathway "+i:""}`);const c={level:e,attrs:o.attrs,details:o.details,bitrate:o.bitrate,averageBitrate:o.averageBitrate,maxBitrate:o.maxBitrate,realBitrate:o.realBitrate,width:o.width,height:o.height,codecSet:o.codecSet,audioCodec:o.audioCodec,videoCodec:o.videoCodec,audioGroups:o.audioGroups,subtitleGroups:o.subtitleGroups,loaded:o.loaded,loadError:o.loadError,fragmentError:o.fragmentError,name:o.name,id:o.id,uri:o.uri,url:o.url,urlId:0,audioGroupIds:o.audioGroupIds,textGroupIds:o.textGroupIds};this.hls.trigger(oe.LEVEL_SWITCHING,c);const d=o.details;if(!d||d.live){const u=this.switchParams(o.uri,s==null?void 0:s.details,d);this.loadPlaylist(u)}}get manualLevel(){return this.manualLevelIndex}set manualLevel(e){this.manualLevelIndex=e,this._startLevel===void 0&&(this._startLevel=e),e!==-1&&(this.level=e)}get firstLevel(){return this._firstLevel}set firstLevel(e){this._firstLevel=e}get startLevel(){if(this._startLevel===void 0){const e=this.hls.config.startLevel;return e!==void 0?e:this.hls.firstAutoLevel}return this._startLevel}set startLevel(e){this._startLevel=e}get pathways(){return this.steering?this.steering.pathways():[]}get pathwayPriority(){return this.steering?this.steering.pathwayPriority:null}set pathwayPriority(e){if(this.steering){const n=this.steering.pathways(),r=e.filter(s=>n.indexOf(s)!==-1);if(e.length<1){this.warn(`pathwayPriority ${e} should contain at least one pathway from list: ${n}`);return}this.steering.pathwayPriority=r}}onError(e,n){n.fatal||!n.context||n.context.type===ks.LEVEL&&n.context.level===this.level&&this.checkRetry(n)}onFragBuffered(e,{frag:n}){if(n.type===Wn.MAIN){const r=n.elementaryStreams;if(!Object.keys(r).some(i=>!!r[i]))return;const s=this._levels[n.level];s!=null&&s.loadError&&(this.log(`Resetting level error count of ${s.loadError} on frag buffered`),s.loadError=0)}}onLevelLoaded(e,n){var r;const{level:s,details:i}=n,o=n.levelInfo;if(!o){var l;this.warn(`Invalid level index ${s}`),(l=n.deliveryDirectives)!=null&&l.skip&&(i.deltaUpdateFailed=!0);return}if(o===this.currentLevel||n.withoutMultiVariant){o.fragmentError===0&&(o.loadError=0);let c=o.details;c===n.details&&c.advanced&&(c=void 0),this.playlistLoaded(s,n,c)}else(r=n.deliveryDirectives)!=null&&r.skip&&(i.deltaUpdateFailed=!0)}loadPlaylist(e){super.loadPlaylist(),this.shouldLoadPlaylist(this.currentLevel)&&this.scheduleLoading(this.currentLevel,e)}loadingPlaylist(e,n){super.loadingPlaylist(e,n);const r=this.getUrlWithDirectives(e.uri,n),s=this.currentLevelIndex,i=e.attrs["PATHWAY-ID"],o=e.details,l=o==null?void 0:o.age;this.log(`Loading level index ${s}${(n==null?void 0:n.msn)!==void 0?" at sn "+n.msn+" part "+n.part:""}${i?" Pathway "+i:""}${l&&o.live?" age "+l.toFixed(1)+(o.type&&" "+o.type||""):""} ${r}`),this.hls.trigger(oe.LEVEL_LOADING,{url:r,level:s,levelInfo:e,pathwayId:e.attrs["PATHWAY-ID"],id:0,deliveryDirectives:n||null})}get nextLoadLevel(){return this.manualLevelIndex!==-1?this.manualLevelIndex:this.hls.nextAutoLevel}set nextLoadLevel(e){const n=this.currentLevelIndex;if(this.manualLevelIndex===-1&&e!==n&&e!==-1){const s=this.hls.config.abrSwitchInterval;if(s>0){const i=performance.now(),o=i-this.lastABRSwitchTime,l=s*1e3;if(this.lastABRSwitchTime>-1&&o<l){this.warn(`Preventing ABR level switch: ${n} -> ${e} (${Math.round(o)}ms < ${l}ms / ${s}s)`);return}this.lastABRSwitchTime=i,this.log(`Allowing ABR level switch: ${n} -> ${e} (${Math.round(o)}ms >= ${l}ms / ${s}s)`)}}this.level=e,this.manualLevelIndex===-1&&(this.hls.nextAutoLevel=e)}removeLevel(e){var n;if(this._levels.length===1)return;const r=this._levels.filter((i,o)=>o!==e?!0:(this.steering&&this.steering.removeLevel(i),i===this.currentLevel&&(this.currentLevel=null,this.currentLevelIndex=-1,i.details&&i.details.fragments.forEach(l=>l.level=-1)),!1));qkt(r),this._levels=r,this.currentLevelIndex>-1&&(n=this.currentLevel)!=null&&n.details&&(this.currentLevelIndex=this.currentLevel.details.fragments[0].level),this.manualLevelIndex>-1&&(this.manualLevelIndex=this.currentLevelIndex);const s=r.length-1;this._firstLevel=Math.min(this._firstLevel,s),this._startLevel&&(this._startLevel=Math.min(this._startLevel,s)),this.hls.trigger(oe.LEVELS_UPDATED,{levels:r})}onLevelsUpdated(e,{levels:n}){this._levels=n}checkMaxAutoUpdated(){const{autoLevelCapping:e,maxAutoLevel:n,maxHdcpLevel:r}=this.hls;this._maxAutoLevel!==n&&(this._maxAutoLevel=n,this.hls.trigger(oe.MAX_AUTO_LEVEL_UPDATED,{autoLevelCapping:e,levels:this.levels,maxAutoLevel:n,minAutoLevel:this.hls.minAutoLevel,maxHdcpLevel:r}))}}function ZSt(t,e){return F6(t,"audio",e)}function JSt(t,e){return F6(t,"video",e)}function gze(t,e){let{audioCodec:n,videoCodec:r}=t;n&&(t.audioCodec=n=rZ(n,e)||void 0),r&&(r=t.videoCodec=nXn(r));const{unknownCodecs:s}=t;return!((s==null?void 0:s.length)||0||n&&!ZSt(n,e)||r&&!JSt(r,e))}function vze(t){const e={};t.forEach(n=>{const r=n.groupId||"";n.id=e[r]=e[r]||0,e[r]++})}class Brr extends Fm{constructor(e,n){super("key-loader",n),this.config=void 0,this.keyLoaderInfo={},this.emeController=null,this.config=e}abort(e){for(const r in this.keyLoaderInfo){const s=this.keyLoaderInfo[r].loader;if(s){var n;if(e&&e!==((n=s.context)==null?void 0:n.frag.type))return;s.abort()}}}destroy(){for(const e in this.keyLoaderInfo){const n=this.keyLoaderInfo[e].loader;n&&n.destroy()}this.emeController=null,this.keyLoaderInfo={}}loadClear(e,n,r){return this.emeController?this.emeController.loadClear(e,n,r):null}load(e,n){return!e.decryptdata&&e.encrypted&&this.emeController&&this.config.emeEnabled?this.emeController.selectKeySystemFormat(e).then(r=>this.loadInternal(e,n,r)):this.loadInternal(e,n)}loadInternal(e,n,r){r&&e.setKeyFormat(r);const s=e.decryptdata;if(!s){const o=new Error(r?`Expected frag.decryptdata to be defined after setting format ${r}`:`Missing decryption data on fragment in onKeyLoading (emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`);return Promise.reject(dw(e,rt.KEY_LOAD_ERROR,o))}const i=e;switch(s.method){case"SAMPLE-AES":case"SAMPLE-AES-CENC":case"SAMPLE-AES-CTR":return s.keyFormat==="identity"?this.loadKeyHTTP(i):n?n.then(()=>this.loadKeyEME(i)):this.loadKeyEME(i);case"AES-128":case"AES-256":case"AES-256-CTR":return this.loadKeyHTTP(i);default:return Promise.reject(dw(e,rt.KEY_LOAD_ERROR,new Error(`Key supplied with unsupported METHOD: "${s.method}"`)))}}loadKeyEME(e){if(this.emeController&&this.config.emeEnabled){var n;if(!e.decryptdata.keyId&&(n=e.initSegment)!=null&&n.data){const r=DJn(e.initSegment.data);if(r.length){let s=r[0];const i=e.decryptdata.uri;if(s.some(o=>o!==0))this.log(`Using keyId found in init segment ${Gl(s)} keyUri: ${i}`),Tx.setKeyIdForUri(i,s);else{const o=Tx.addKeyIdForUri(i);this.log(`Patching empty keyId with ${Gl(o)} keyUri: ${i}`),s=o}e.decryptdata.keyId=s}}return this.emeController.loadKey(e).then(()=>({frag:e,keyInfo:{decryptdata:e.decryptdata}}))}return Promise.reject(dw(e,rt.KEY_LOAD_ERROR,new Error(`emeEnabled with controller: ${this.emeController&&this.config.emeEnabled})`)))}loadKeyHTTP(e){const n=e.decryptdata,r=n.uri;if(!r)return Promise.reject(dw(e,rt.KEY_LOAD_ERROR,new Error(`Invalid key URI: "${r}"`)));const s=this.keyLoaderInfo[r];if(s){if(s.decryptdata.key)return n.key=s.decryptdata.key,s.keyLoadPromise=null,Promise.resolve({frag:e,keyInfo:s});if(s.keyLoadPromise)return s.keyLoadPromise.then(d=>(n.key=s.decryptdata.key,rr(rr({},d),{},{frag:e})))}this.log(`Loading${n.keyId?" keyId: "+Gl(n.keyId):""} URI: ${n.uri} from ${e.type} ${e.level}`);const i=this.config,o=i.loader,l=new o(i);e.keyLoader=l;const c=this.keyLoaderInfo[r]={decryptdata:n,keyLoadPromise:null,loader:l};return c.keyLoadPromise=new Promise((d,u)=>{const h={type:ks.KEY,keyInfo:c,frag:e,responseType:"arraybuffer",url:r},m=i.keyLoadPolicy.default,f={loadPolicy:m,timeout:m.maxLoadTimeMs,maxRetry:0,retryDelay:0,maxRetryDelay:0},p={onSuccess:(g,v,b,x)=>{const{frag:w,keyInfo:k,url:S}=b;if(!w.decryptdata||k!==this.keyLoaderInfo[S])return u(dw(w,rt.KEY_LOAD_ERROR,new Error("after key load, decryptdata unset or changed"),x));k.decryptdata.key=w.decryptdata.key=new Uint8Array(g.data),w.keyLoader=k.loader=k.keyLoadPromise=null,d({frag:w,keyInfo:k})},onError:(g,v,b,x)=>{this.resetLoader(v),u(dw(e,rt.KEY_LOAD_ERROR,new Error(`HTTP Error ${g.code} loading key ${g.text}`),b,rr({url:r,data:void 0},g)))},onTimeout:(g,v,b)=>{this.resetLoader(v),u(dw(e,rt.KEY_LOAD_TIMEOUT,new Error("key loading timed out"),b))},onAbort:(g,v,b)=>{this.resetLoader(v),u(dw(e,rt.INTERNAL_ABORTED,new Error("key loading aborted"),b))}};l.load(h,f,p)})}resetLoader(e){const{frag:n,keyInfo:r,url:s}=e,i=r.loader;n.keyLoader===i&&(n.keyLoader=r.loader=r.keyLoadPromise=null),delete this.keyLoaderInfo[s],i&&i.destroy()}}function dw(t,e=rt.KEY_LOAD_ERROR,n,r,s){return new Dv({type:er.NETWORK_ERROR,details:e,fatal:!1,frag:t,response:s,error:n,networkDetails:r||null})}function yze(t){const{type:e}=t;switch(e){case ks.AUDIO_TRACK:return Wn.AUDIO;case ks.SUBTITLE_TRACK:return Wn.SUBTITLE;default:return Wn.MAIN}}function Ode(t,e){let n=t.url;return(n===void 0||n.indexOf("data:")===0)&&(n=e.url),n}class Urr{constructor(e){this.hls=void 0,this.loaders=Object.create(null),this.variableList=null,this.onManifestLoaded=this.checkAutostartLoad,this.hls=e,this.registerListeners()}startLoad(e){}stopLoad(){this.destroyInternalLoaders()}registerListeners(){const{hls:e}=this;e.on(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.on(oe.LEVEL_LOADING,this.onLevelLoading,this),e.on(oe.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.on(oe.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.on(oe.LEVELS_UPDATED,this.onLevelsUpdated,this)}unregisterListeners(){const{hls:e}=this;e.off(oe.MANIFEST_LOADING,this.onManifestLoading,this),e.off(oe.LEVEL_LOADING,this.onLevelLoading,this),e.off(oe.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),e.off(oe.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this),e.off(oe.LEVELS_UPDATED,this.onLevelsUpdated,this)}createInternalLoader(e){const n=this.hls.config,r=n.pLoader,s=n.loader,i=r||s,o=new i(n);return this.loaders[e.type]=o,o}getInternalLoader(e){return this.loaders[e.type]}resetInternalLoader(e){this.loaders[e]&&delete this.loaders[e]}destroyInternalLoaders(){for(const e in this.loaders){const n=this.loaders[e];n&&n.destroy(),this.resetInternalLoader(e)}}destroy(){this.variableList=null,this.unregisterListeners(),this.destroyInternalLoaders()}onManifestLoading(e,n){const{url:r}=n;this.variableList=null,this.load({id:null,level:0,responseType:"text",type:ks.MANIFEST,url:r,deliveryDirectives:null,levelOrTrack:null})}onLevelLoading(e,n){const{id:r,level:s,pathwayId:i,url:o,deliveryDirectives:l,levelInfo:c}=n;this.load({id:r,level:s,pathwayId:i,responseType:"text",type:ks.LEVEL,url:o,deliveryDirectives:l,levelOrTrack:c})}onAudioTrackLoading(e,n){const{id:r,groupId:s,url:i,deliveryDirectives:o,track:l}=n;this.load({id:r,groupId:s,level:null,responseType:"text",type:ks.AUDIO_TRACK,url:i,deliveryDirectives:o,levelOrTrack:l})}onSubtitleTrackLoading(e,n){const{id:r,groupId:s,url:i,deliveryDirectives:o,track:l}=n;this.load({id:r,groupId:s,level:null,responseType:"text",type:ks.SUBTITLE_TRACK,url:i,deliveryDirectives:o,levelOrTrack:l})}onLevelsUpdated(e,n){const r=this.loaders[ks.LEVEL];if(r){const s=r.context;s&&!n.levels.some(i=>i===s.levelOrTrack)&&(r.abort(),delete this.loaders[ks.LEVEL])}}load(e){var n;const r=this.hls.config;let s=this.getInternalLoader(e);if(s){const d=this.hls.logger,u=s.context;if((u==null?void 0:u.levelOrTrack)===e.levelOrTrack&&(u.url===e.url||u.deliveryDirectives&&!e.deliveryDirectives)){u.url===e.url?d.log(`[playlist-loader]: ignore ${e.url} ongoing request`):d.log(`[playlist-loader]: ignore ${e.url} in favor of ${u.url}`);return}d.log(`[playlist-loader]: aborting previous loader for type: ${e.type}`),s.abort()}let i;if(e.type===ks.MANIFEST?i=r.manifestLoadPolicy.default:i=Mi({},r.playlistLoadPolicy.default,{timeoutRetry:null,errorRetry:null}),s=this.createInternalLoader(e),xn((n=e.deliveryDirectives)==null?void 0:n.part)){let d;if(e.type===ks.LEVEL&&e.level!==null?d=this.hls.levels[e.level].details:e.type===ks.AUDIO_TRACK&&e.id!==null?d=this.hls.audioTracks[e.id].details:e.type===ks.SUBTITLE_TRACK&&e.id!==null&&(d=this.hls.subtitleTracks[e.id].details),d){const u=d.partTarget,h=d.targetduration;if(u&&h){const m=Math.max(u*3,h*.8)*1e3;i=Mi({},i,{maxTimeToFirstByteMs:Math.min(m,i.maxTimeToFirstByteMs),maxLoadTimeMs:Math.min(m,i.maxTimeToFirstByteMs)})}}}const o=i.errorRetry||i.timeoutRetry||{},l={loadPolicy:i,timeout:i.maxLoadTimeMs,maxRetry:o.maxNumRetry||0,retryDelay:o.retryDelayMs||0,maxRetryDelay:o.maxRetryDelayMs||0},c={onSuccess:(d,u,h,m)=>{const f=this.getInternalLoader(h);this.resetInternalLoader(h.type);const p=d.data;u.parsing.start=performance.now(),sy.isMediaPlaylist(p)||h.type!==ks.MANIFEST?this.handleTrackOrLevelPlaylist(d,u,h,m||null,f):this.handleMasterPlaylist(d,u,h,m)},onError:(d,u,h,m)=>{this.handleNetworkError(u,h,!1,d,m)},onTimeout:(d,u,h)=>{this.handleNetworkError(u,h,!0,void 0,d)}};s.load(e,l,c)}checkAutostartLoad(){if(!this.hls)return;const{config:{autoStartLoad:e,startPosition:n},forceStartLoad:r}=this.hls;(e||r)&&(this.hls.logger.log(`${e?"auto":"force"} startLoad with configured startPosition ${n}`),this.hls.startLoad(n))}handleMasterPlaylist(e,n,r,s){const i=this.hls,o=e.data,l=Ode(e,r),c=sy.parseMasterPlaylist(o,l);if(c.playlistParsingError){n.parsing.end=performance.now(),this.handleManifestParsingError(e,r,c.playlistParsingError,s,n);return}const{contentSteering:d,levels:u,iframeVariants:h,sessionData:m,sessionKeys:f,startTimeOffset:p,variableList:g}=c;this.variableList=g,u.forEach(w=>{const{unknownCodecs:k}=w;if(k){const{preferManagedMediaSource:S}=this.hls.config;let{audioCodec:C,videoCodec:j}=w;for(let E=k.length;E--;){const N=k[E];F6(N,"audio",S)?(w.audioCodec=C=C?`${C},${N}`:N,BR.audio[C.substring(0,4)]=2,k.splice(E,1)):F6(N,"video",S)&&(w.videoCodec=j=j?`${j},${N}`:N,BR.video[j.substring(0,4)]=2,k.splice(E,1))}}});const{AUDIO:v=[],SUBTITLES:b,"CLOSED-CAPTIONS":x}=sy.parseMasterPlaylistMedia(o,l,c);v.length&&!v.some(k=>!k.url)&&u[0].audioCodec&&!u[0].attrs.AUDIO&&(this.hls.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),v.unshift({type:"main",name:"main",groupId:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new mo({}),bitrate:0,url:""})),i.trigger(oe.MANIFEST_LOADED,{levels:u,audioTracks:v,subtitles:b,iframeVariants:h,captions:x,contentSteering:d,url:l,stats:n,networkDetails:s,sessionData:m,sessionKeys:f,startTimeOffset:p,variableList:g})}handleTrackOrLevelPlaylist(e,n,r,s,i){const o=this.hls,{id:l,level:c,type:d}=r,u=Ode(e,r),h=xn(c)?c:xn(l)?l:0,m=yze(r),f=sy.parseLevelPlaylist(e.data,u,h,m,0,this.variableList);if(d===ks.MANIFEST){const p={attrs:new mo({}),bitrate:0,details:f,name:"",url:u};f.requestScheduled=n.loading.start+Hkt(f,0),o.trigger(oe.MANIFEST_LOADED,{levels:[p],audioTracks:[],iframeVariants:[],url:u,stats:n,networkDetails:s,sessionData:null,sessionKeys:null,contentSteering:null,startTimeOffset:null,variableList:null})}n.parsing.end=performance.now(),r.levelDetails=f,this.handlePlaylistLoaded(f,e,n,r,s,i)}handleManifestParsingError(e,n,r,s,i){this.hls.trigger(oe.ERROR,{type:er.NETWORK_ERROR,details:rt.MANIFEST_PARSING_ERROR,fatal:n.type===ks.MANIFEST,url:e.url,err:r,error:r,reason:r.message,response:e,context:n,networkDetails:s,stats:i})}handleNetworkError(e,n,r=!1,s,i){let o=`A network ${r?"timeout":"error"+(s?" (status "+s.code+")":"")} occurred while loading ${e.type}`;e.type===ks.LEVEL?o+=`: ${e.level} id: ${e.id}`:(e.type===ks.AUDIO_TRACK||e.type===ks.SUBTITLE_TRACK)&&(o+=` id: ${e.id} group-id: "${e.groupId}"`);const l=new Error(o);this.hls.logger.warn(`[playlist-loader]: ${o}`);let c=rt.UNKNOWN,d=!1;const u=this.getInternalLoader(e);switch(e.type){case ks.MANIFEST:c=r?rt.MANIFEST_LOAD_TIMEOUT:rt.MANIFEST_LOAD_ERROR,d=!0;break;case ks.LEVEL:c=r?rt.LEVEL_LOAD_TIMEOUT:rt.LEVEL_LOAD_ERROR,d=!1;break;case ks.AUDIO_TRACK:c=r?rt.AUDIO_TRACK_LOAD_TIMEOUT:rt.AUDIO_TRACK_LOAD_ERROR,d=!1;break;case ks.SUBTITLE_TRACK:c=r?rt.SUBTITLE_TRACK_LOAD_TIMEOUT:rt.SUBTITLE_LOAD_ERROR,d=!1;break}u&&this.resetInternalLoader(e.type);const h={type:er.NETWORK_ERROR,details:c,fatal:d,url:e.url,loader:u,context:e,error:l,networkDetails:n,stats:i};if(s){let m=e.url;n&&"url"in n&&(m=n.url),h.response=rr({url:m,data:void 0},s)}this.hls.trigger(oe.ERROR,h)}handlePlaylistLoaded(e,n,r,s,i,o){const l=this.hls,{type:c,level:d,levelOrTrack:u,id:h,groupId:m,deliveryDirectives:f}=s,p=Ode(n,s),g=yze(s);let v=typeof s.level=="number"&&g===Wn.MAIN?d:void 0;u&&"iframes"in u&&u.iframes&&!e.iframesOnly&&(e.playlistParsingError=new Error("EXT-X-I-FRAME-STREAM-INF media playlist MUST contain an EXT-X-I-FRAMES-ONLY tag"),e.iframesOnly=!0);const b=e.playlistParsingError;if(b){if(this.hls.logger.warn(`${b} ${e.url}`),!l.config.ignorePlaylistParsingErrors){l.trigger(oe.ERROR,{type:er.NETWORK_ERROR,details:rt.LEVEL_PARSING_ERROR,fatal:!1,url:p,error:b,reason:b.message,response:n,context:s,level:v,parent:g,networkDetails:i,stats:r});return}e.playlistParsingError=null}if(!e.fragments.length){const x=e.playlistParsingError=new Error("No Segments found in Playlist");l.trigger(oe.ERROR,{type:er.NETWORK_ERROR,details:rt.LEVEL_EMPTY_ERROR,fatal:!1,url:p,error:x,reason:x.message,response:n,context:s,level:v,parent:g,networkDetails:i,stats:r});return}switch(e.live&&o&&(o.getCacheAge&&(e.ageHeader=o.getCacheAge()||0),(!o.getCacheAge||isNaN(e.ageHeader))&&(e.ageHeader=0)),c){case ks.MANIFEST:case ks.LEVEL:if(v){if(!u)v=0;else if(u!==l.levels[v]){const x=l.levels.indexOf(u);x>-1&&(v=x)}}l.trigger(oe.LEVEL_LOADED,{details:e,levelInfo:u||l.levels[0],level:v||0,id:h||0,stats:r,networkDetails:i,deliveryDirectives:f,withoutMultiVariant:c===ks.MANIFEST,context:s});break;case ks.AUDIO_TRACK:l.trigger(oe.AUDIO_TRACK_LOADED,{details:e,track:u,id:h||0,groupId:m||"",stats:r,networkDetails:i,deliveryDirectives:f,context:s});break;case ks.SUBTITLE_TRACK:l.trigger(oe.SUBTITLE_TRACK_LOADED,{details:e,track:u,id:h||0,groupId:m||"",stats:r,networkDetails:i,deliveryDirectives:f,context:s});break}}}class ch{static get version(){return V6}static isMSESupported(){return VSt()}static isSupported(){return Hnr()}static getMediaSource(){return Bk()}static get Events(){return oe}static get MetadataSchema(){return xu}static get ErrorTypes(){return er}static get ErrorDetails(){return rt}static get DefaultConfig(){return ch.defaultConfig?ch.defaultConfig:Lrr}static set DefaultConfig(e){ch.defaultConfig=e}constructor(e={}){this.config=void 0,this.userConfig=void 0,this.logger=void 0,this._url=null,this.streamController=void 0,this.coreComponents=void 0,this.networkControllers=void 0,this._emitter=new g_e,this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.abrController=void 0,this.bufferController=void 0,this.capLevelController=void 0,this.latencyController=void 0,this.levelController=void 0,this.audioStreamController=void 0,this.subtititleStreamController=void 0,this.audioTrackController=void 0,this.subtitleTrackController=void 0,this.interstitialsController=void 0,this.iframeController=void 0,this.gapController=void 0,this.emeController=void 0,this.cmcdController=void 0,this._media=null,this._sessionId=void 0,this.triggeringException=void 0,this.started=!1;const n=this.logger=cJn(e.debug||!1,"Hls instance",e.loggerId||e.assetPlayerId),r=this.config=$rr(ch.DefaultConfig,e,n);this.userConfig=e,r.progressive&&Orr(r,n);const{streamController:s,abrController:i,bufferController:o,capLevelController:l,errorController:c,fpsController:d,id3TrackController:u,iframeController:h,gapController:m}=r,f=new c(this),p=this.abrController=new i(this),g=new jXn(this),v=r.interstitialsController,b=v?this.interstitialsController=new v(this,ch):null,x=o?this.bufferController=new o(this,g):null,w=l?this.capLevelController=new l(this):null,k=d?new d(this):null,S=r.cmcdController,C=S?this.cmcdController=new S(this):null,j=new Urr(this),E=r.contentSteeringController,N=E?new E(this):null,A=this.levelController=new Frr(this,N),_=u?new u(this):void 0,T=new Brr(this.config,this.logger),R=this.streamController=new s(this,g,T),O=this.gapController=m?new m(this,g):void 0;w&&w.setStreamController(R);const F=[j,A,R];b&&F.splice(1,0,b),N&&F.splice(1,0,N),this.networkControllers=F;const D=[p];x&&D.push(x),O&&D.push(O),w&&D.push(w),k&&(k.setStreamController(R),D.push(k)),_&&D.push(_),D.push(g),this.audioTrackController=this.createController(r.audioTrackController,F);const I=r.audioStreamController;I&&F.push(this.audioStreamController=new I(this,g,T)),this.subtitleTrackController=this.createController(r.subtitleTrackController,F);const P=r.subtitleStreamController;P&&F.push(this.subtititleStreamController=new P(this,g,T)),this.createController(r.timelineController,D),T.emeController=this.emeController=this.createController(r.emeController,D),C&&D.push(C),this.latencyController=this.createController(r.latencyController,D),this.coreComponents=D,this.iframeController=h?new h(this,ch):void 0,F.push(f);const M=f.onErrorOut;typeof M=="function"&&this.on(oe.ERROR,M,f),this.on(oe.MANIFEST_LOADED,j.onManifestLoaded,j)}createController(e,n){if(e){const r=new e(this);return n&&n.push(r),r}return null}on(e,n,r=this){this._emitter.on(e,n,r)}once(e,n,r=this){this._emitter.once(e,n,r)}removeAllListeners(e){this._emitter.removeAllListeners(e)}off(e,n,r=this,s){this._emitter.off(e,n,r,s)}listeners(e){return this._emitter.listeners(e)}emit(e,n,r){return this._emitter.emit(e,n,r)}trigger(e,n){if(this.config.debug)return this.emit(e,e,n);try{return this.emit(e,e,n)}catch(r){if(this.logger.error("An internal error happened while handling event "+e+'. Error message: "'+r.message+'". Here is a stacktrace:',r),!this.triggeringException){this.triggeringException=!0;const s=e===oe.ERROR;this.trigger(oe.ERROR,{type:er.OTHER_ERROR,details:rt.INTERNAL_EXCEPTION,fatal:s,event:e,error:r}),this.triggeringException=!1}}return!1}listenerCount(e){return this._emitter.listenerCount(e)}destroy(){this.logger.log("destroy"),this.trigger(oe.DESTROYING,void 0),this.detachMedia(),this.removeAllListeners(),this._autoLevelCapping=-1,this._url=null,this.networkControllers.forEach(n=>n.destroy()),this.networkControllers.length=0,this.coreComponents.forEach(n=>n.destroy()),this.coreComponents.length=0,this.iframeController=void 0;const e=this.config;e.xhrSetup=e.fetchSetup=void 0,this.userConfig=null}attachMedia(e){if(!e||"media"in e&&!e.media){const i=new Error(`attachMedia failed: invalid argument (${e})`);this.trigger(oe.ERROR,{type:er.OTHER_ERROR,details:rt.ATTACH_MEDIA_ERROR,fatal:!0,error:i});return}this.logger.log("attachMedia"),this._media&&(this.logger.warn("media must be detached before attaching"),this.detachMedia());const n="media"in e,r=n?e.media:e,s=n?e:{media:r};this._media=r,this.trigger(oe.MEDIA_ATTACHING,s)}detachMedia(){this.logger.log("detachMedia");const e={};this.trigger(oe.MEDIA_DETACHING,e),this._media=null,this.trigger(oe.MEDIA_DETACHED,e)}transferMedia(){var e;this._media=null;const n=((e=this.bufferController)==null?void 0:e.transferMedia())||null,r={transferMedia:n};return this.trigger(oe.MEDIA_DETACHING,r),this.trigger(oe.MEDIA_DETACHED,r),n}loadSource(e){var n;this.stopLoad();const r=this.media,s=this._url,i=this._url=n_e.buildAbsoluteURL(self.location.href,e,{alwaysNormalize:!0});this._autoLevelCapping=-1,this._maxHdcpLevel=null,this.logger.log(`loadSource:${i}`),r&&s&&(s!==i||(n=this.bufferController)!=null&&n.hasSourceTypes())&&(this.detachMedia(),this.attachMedia(r)),this.trigger(oe.MANIFEST_LOADING,{url:e})}get url(){return this._url}get hasEnoughToStart(){return this.streamController.hasEnoughToStart}get startPosition(){return this.streamController.startPositionValue}startLoad(e=-1,n){this.logger.log(`startLoad(${e+(n?", <skip seek to start>":"")})`),this.started=!0,this.resumeBuffering();for(let r=0;r<this.networkControllers.length&&(this.networkControllers[r].startLoad(e,n),!(!this.started||!this.networkControllers));r++);}stopLoad(){this.logger.log("stopLoad"),this.started=!1;for(let e=0;e<this.networkControllers.length&&(this.networkControllers[e].stopLoad(),!(this.started||!this.networkControllers));e++);}get loadingEnabled(){return this.started&&this.streamController.state!==Ct.STOPPED}get bufferingEnabled(){return this.streamController.bufferingEnabled}resumeBuffering(){this.bufferingEnabled||(this.logger.log("resume buffering"),this.networkControllers.forEach(e=>{e.resumeBuffering&&e.resumeBuffering()}))}pauseBuffering(){this.bufferingEnabled&&(this.logger.log("pause buffering"),this.networkControllers.forEach(e=>{e.pauseBuffering&&e.pauseBuffering()}))}get inFlightFragments(){const e={[Wn.MAIN]:this.streamController.inFlightFrag};return this.audioStreamController&&(e[Wn.AUDIO]=this.audioStreamController.inFlightFrag),this.subtititleStreamController&&(e[Wn.SUBTITLE]=this.subtititleStreamController.inFlightFrag),e}swapAudioCodec(){this.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}recoverMediaError(){this.logger.log("recoverMediaError");const e=this._media,n=this.started,r=e==null?void 0:e.currentTime;this.detachMedia(),e&&(this.attachMedia(e),n&&(r?this.startLoad(r):this.config.autoStartLoad||this.startLoad()))}removeLevel(e){this.levelController.removeLevel(e)}get sessionId(){let e=this._sessionId;return e||(e=this._sessionId=ikt()),e}get levels(){const e=this.levelController.levels;return e||[]}get latestLevelDetails(){return this.streamController.getLevelDetails()||null}get loadLevelObj(){return this.levelController.loadLevelObj}get currentLevel(){return this.streamController.currentLevel}set currentLevel(e){this.logger.log(`set currentLevel:${e}`),this.levelController.manualLevel=e,this.streamController.immediateLevelSwitch()}get nextLevel(){return this.streamController.nextLevel}set nextLevel(e){this.logger.log(`set nextLevel:${e}`),this.levelController.manualLevel=e,this.streamController.nextLevelSwitch()}get loadLevel(){return this.levelController.level}set loadLevel(e){this.logger.log(`set loadLevel:${e}`),this.levelController.manualLevel=e}get nextLoadLevel(){return this.levelController.nextLoadLevel}set nextLoadLevel(e){this.levelController.nextLoadLevel=e}get firstLevel(){return Math.max(this.levelController.firstLevel,this.minAutoLevel)}set firstLevel(e){this.logger.log(`set firstLevel:${e}`),this.levelController.firstLevel=e}get startLevel(){const e=this.levelController.startLevel;return e===-1&&this.abrController.forcedAutoLevel>-1?this.abrController.forcedAutoLevel:e}set startLevel(e){this.logger.log(`set startLevel:${e}`),e!==-1&&(e=Math.max(e,this.minAutoLevel)),this.levelController.startLevel=e}get capLevelToPlayerSize(){return this.config.capLevelToPlayerSize}set capLevelToPlayerSize(e){const n=this.capLevelController,r=!!e;n&&r!==this.config.capLevelToPlayerSize&&(r?n.startCapping():(n.stopCapping(),this.autoLevelCapping=-1,this.streamController.nextLevelSwitch()),this.config.capLevelToPlayerSize=r)}get autoLevelCapping(){return this._autoLevelCapping}get bandwidthEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimate():NaN}set bandwidthEstimate(e){this.abrController.resetEstimator(e)}get abrEwmaDefaultEstimate(){const{bwEstimator:e}=this.abrController;return e?e.defaultEstimate:NaN}get ttfbEstimate(){const{bwEstimator:e}=this.abrController;return e?e.getEstimateTTFB():NaN}set autoLevelCapping(e){this._autoLevelCapping!==e&&(this.logger.log(`set autoLevelCapping:${e}`),this._autoLevelCapping=e,this.levelController.checkMaxAutoUpdated())}get maxHdcpLevel(){return this._maxHdcpLevel}set maxHdcpLevel(e){dXn(e)&&this._maxHdcpLevel!==e&&(this._maxHdcpLevel=e,this.levelController.checkMaxAutoUpdated())}get autoLevelEnabled(){return this.levelController.manualLevel===-1}get manualLevel(){return this.levelController.manualLevel}get minAutoLevel(){const{levels:e,config:{minAutoBitrate:n}}=this;if(!e)return 0;const r=e.length;for(let s=0;s<r;s++)if(e[s].maxBitrate>=n)return s;return 0}get maxAutoLevel(){const{levels:e,autoLevelCapping:n,maxHdcpLevel:r}=this;let s;if(n===-1&&e!=null&&e.length?s=e.length-1:s=n,r)for(let i=s;i--;){const o=e[i].attrs["HDCP-LEVEL"];if(o&&o<=r)return i}return s}get firstAutoLevel(){return this.abrController.firstAutoLevel}get nextAutoLevel(){return this.abrController.nextAutoLevel}set nextAutoLevel(e){this.abrController.nextAutoLevel=e}get playingDate(){return this.streamController.currentProgramDateTime}get mainForwardBufferInfo(){return this.streamController.getMainFwdBufferInfo()}get audioForwardBufferInfo(){var e;return((e=this.audioStreamController)==null?void 0:e.getFwdBufferInfo())||null}get maxBufferLength(){return this.streamController.maxBufferLength}setAudioOption(e){var n;return((n=this.audioTrackController)==null?void 0:n.setAudioOption(e))||null}setSubtitleOption(e){var n;return((n=this.subtitleTrackController)==null?void 0:n.setSubtitleOption(e))||null}get allAudioTracks(){const e=this.audioTrackController;return e?e.allAudioTracks:[]}get audioTracks(){const e=this.audioTrackController;return e?e.audioTracks:[]}get audioTrack(){const e=this.audioTrackController;return e?e.audioTrack:-1}set audioTrack(e){const n=this.audioTrackController;n&&(n.audioTrack=e)}get nextAudioTrack(){var e,n;return(e=(n=this.audioStreamController)==null?void 0:n.nextAudioTrack)!=null?e:-1}set nextAudioTrack(e){const{audioTrackController:n}=this;n&&(n.nextAudioTrack=e)}get allSubtitleTracks(){const e=this.subtitleTrackController;return e?e.allSubtitleTracks:[]}get subtitleTracks(){const e=this.subtitleTrackController;return e?e.subtitleTracks:[]}get subtitleTrack(){const e=this.subtitleTrackController;return e?e.subtitleTrack:-1}get media(){return this._media}set subtitleTrack(e){const n=this.subtitleTrackController;n&&(n.subtitleTrack=e)}get subtitleDisplay(){const e=this.subtitleTrackController;return e?e.subtitleDisplay:!1}set subtitleDisplay(e){const n=this.subtitleTrackController;n&&(n.subtitleDisplay=e)}get lowLatencyMode(){return this.config.lowLatencyMode}set lowLatencyMode(e){this.config.lowLatencyMode=e}get liveSyncPosition(){var e,n;return(e=(n=this.latencyController)==null?void 0:n.liveSyncPosition)!=null?e:null}get latency(){var e;return((e=this.latencyController)==null?void 0:e.latency)||0}get maxLatency(){var e;return((e=this.latencyController)==null?void 0:e.maxLatency)||0}get targetLatency(){var e;return((e=this.latencyController)==null?void 0:e.targetLatency)||null}set targetLatency(e){this.latencyController&&(this.latencyController.targetLatency=e)}get drift(){var e;return((e=this.latencyController)==null?void 0:e.drift)||null}get forceStartLoad(){return this.streamController.forceStartLoad}get pathways(){return this.levelController.pathways}get pathwayPriority(){return this.levelController.pathwayPriority}set pathwayPriority(e){this.levelController.pathwayPriority=e}get bufferedToEnd(){var e;return!!((e=this.bufferController)!=null&&e.bufferedToEnd)}get interstitialsManager(){return this.interstitialsController?this.interstitialsController.interstitialsManager:null}get iframeVariants(){const e=this.levelController.iframeVariants;return e||[]}createIFramePlayer(e){return this._url&&this.iframeController?this.iframeController.createIFramePlayer(e):null}createImageIFramePlayer(e){return this._url&&this.iframeController?this.iframeController.createImageIFramePlayer(e):null}getMediaDecodingInfo(e,n=this.allAudioTracks){const r=Tkt(n);return jkt(e,r,navigator.mediaCapabilities)}}ch.defaultConfig=void 0;function zrr({src:t,className:e,autoPlay:n=!0}){const r=y.useRef(null);return y.useEffect(()=>{const s=r.current;if(!(!s||!t)){if(s.canPlayType("application/vnd.apple.mpegurl"))return s.src=t,n&&s.play().catch(()=>{}),()=>{s.removeAttribute("src"),s.load()};if(ch.isSupported()){const i=new ch({lowLatencyMode:!0,backBufferLength:30});return i.loadSource(t),i.attachMedia(s),i.on(ch.Events.MANIFEST_PARSED,()=>{n&&s.play().catch(()=>{})}),i.on(ch.Events.ERROR,(o,l)=>{l.fatal&&(l.type===ch.ErrorTypes.NETWORK_ERROR?i.startLoad():l.type===ch.ErrorTypes.MEDIA_ERROR?i.recoverMediaError():i.destroy())}),()=>i.destroy()}}},[t,n]),a.jsx("video",{ref:r,className:e,controls:!0,playsInline:!0,muted:n})}const My=Object.create(null);My.open="0";My.close="1";My.ping="2";My.pong="3";My.message="4";My.upgrade="5";My.noop="6";const rq=Object.create(null);Object.keys(My).forEach(t=>{rq[My[t]]=t});const wxe={type:"error",data:"parser error"},XSt=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",eCt=typeof ArrayBuffer=="function",tCt=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,R_e=({type:t,data:e},n,r)=>XSt&&e instanceof Blob?n?r(e):bze(e,r):eCt&&(e instanceof ArrayBuffer||tCt(e))?n?r(e):bze(new Blob([e]),r):r(My[t]+(e||"")),bze=(t,e)=>{const n=new FileReader;return n.onload=function(){const r=n.result.split(",")[1];e("b"+(r||""))},n.readAsDataURL(t)};function xze(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let Fde;function Vrr(t,e){if(XSt&&t.data instanceof Blob)return t.data.arrayBuffer().then(xze).then(e);if(eCt&&(t.data instanceof ArrayBuffer||tCt(t.data)))return e(xze(t.data));R_e(t,!1,n=>{Fde||(Fde=new TextEncoder),e(Fde.encode(n))})}const wze="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",X4=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<wze.length;t++)X4[wze.charCodeAt(t)]=t;const Hrr=t=>{let e=t.length*.75,n=t.length,r,s=0,i,o,l,c;t[t.length-1]==="="&&(e--,t[t.length-2]==="="&&e--);const d=new ArrayBuffer(e),u=new Uint8Array(d);for(r=0;r<n;r+=4)i=X4[t.charCodeAt(r)],o=X4[t.charCodeAt(r+1)],l=X4[t.charCodeAt(r+2)],c=X4[t.charCodeAt(r+3)],u[s++]=i<<2|o>>4,u[s++]=(o&15)<<4|l>>2,u[s++]=(l&3)<<6|c&63;return d},Grr=typeof ArrayBuffer=="function",I_e=(t,e)=>{if(typeof t!="string")return{type:"message",data:nCt(t,e)};const n=t.charAt(0);return n==="b"?{type:"message",data:Wrr(t.substring(1),e)}:rq[n]?t.length>1?{type:rq[n],data:t.substring(1)}:{type:rq[n]}:wxe},Wrr=(t,e)=>{if(Grr){const n=Hrr(t);return nCt(n,e)}else return{base64:!0,data:t}},nCt=(t,e)=>{switch(e){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},rCt="",qrr=(t,e)=>{const n=t.length,r=new Array(n);let s=0;t.forEach((i,o)=>{R_e(i,!1,l=>{r[o]=l,++s===n&&e(r.join(rCt))})})},Krr=(t,e)=>{const n=t.split(rCt),r=[];for(let s=0;s<n.length;s++){const i=I_e(n[s],e);if(r.push(i),i.type==="error")break}return r};function Yrr(){return new TransformStream({transform(t,e){Vrr(t,n=>{const r=n.length;let s;if(r<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,r);else if(r<65536){s=new Uint8Array(3);const i=new DataView(s.buffer);i.setUint8(0,126),i.setUint16(1,r)}else{s=new Uint8Array(9);const i=new DataView(s.buffer);i.setUint8(0,127),i.setBigUint64(1,BigInt(r))}t.data&&typeof t.data!="string"&&(s[0]|=128),e.enqueue(s),e.enqueue(n)})}})}let Bde;function jV(t){return t.reduce((e,n)=>e+n.length,0)}function EV(t,e){if(t[0].length===e)return t.shift();const n=new Uint8Array(e);let r=0;for(let s=0;s<e;s++)n[s]=t[0][r++],r===t[0].length&&(t.shift(),r=0);return t.length&&r<t[0].length&&(t[0]=t[0].slice(r)),n}function Qrr(t,e){Bde||(Bde=new TextDecoder);const n=[];let r=0,s=-1,i=!1;return new TransformStream({transform(o,l){for(n.push(o);;){if(r===0){if(jV(n)<1)break;const c=EV(n,1);i=(c[0]&128)===128,s=c[0]&127,s<126?r=3:s===126?r=1:r=2}else if(r===1){if(jV(n)<2)break;const c=EV(n,2);s=new DataView(c.buffer,c.byteOffset,c.length).getUint16(0),r=3}else if(r===2){if(jV(n)<8)break;const c=EV(n,8),d=new DataView(c.buffer,c.byteOffset,c.length),u=d.getUint32(0);if(u>Math.pow(2,21)-1){l.enqueue(wxe);break}s=u*Math.pow(2,32)+d.getUint32(4),r=3}else{if(jV(n)<s)break;const c=EV(n,s);l.enqueue(I_e(i?c:Bde.decode(c),e)),r=0}if(s===0||s>t){l.enqueue(wxe);break}}}})}const sCt=4;function Yl(t){if(t)return Zrr(t)}function Zrr(t){for(var e in Yl.prototype)t[e]=Yl.prototype[e];return t}Yl.prototype.on=Yl.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(e),this};Yl.prototype.once=function(t,e){function n(){this.off(t,n),e.apply(this,arguments)}return n.fn=e,this.on(t,n),this};Yl.prototype.off=Yl.prototype.removeListener=Yl.prototype.removeAllListeners=Yl.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks["$"+t];if(!n)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var r,s=0;s<n.length;s++)if(r=n[s],r===e||r.fn===e){n.splice(s,1);break}return n.length===0&&delete this._callbacks["$"+t],this};Yl.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),n=this._callbacks["$"+t],r=1;r<arguments.length;r++)e[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,s=n.length;r<s;++r)n[r].apply(this,e)}return this};Yl.prototype.emitReserved=Yl.prototype.emit;Yl.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Yl.prototype.hasListeners=function(t){return!!this.listeners(t).length};const Hre=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,n)=>n(e,0),pf=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),Jrr="arraybuffer";function iCt(t,...e){return e.reduce((n,r)=>(t.hasOwnProperty(r)&&(n[r]=t[r]),n),{})}const Xrr=pf.setTimeout,esr=pf.clearTimeout;function Gre(t,e){e.useNativeTimers?(t.setTimeoutFn=Xrr.bind(pf),t.clearTimeoutFn=esr.bind(pf)):(t.setTimeoutFn=pf.setTimeout.bind(pf),t.clearTimeoutFn=pf.clearTimeout.bind(pf))}const tsr=1.33;function nsr(t){return typeof t=="string"?rsr(t):Math.ceil((t.byteLength||t.size)*tsr)}function rsr(t){let e=0,n=0;for(let r=0,s=t.length;r<s;r++)e=t.charCodeAt(r),e<128?n+=1:e<2048?n+=2:e<55296||e>=57344?n+=3:(r++,n+=4);return n}function aCt(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function ssr(t){let e="";for(let n in t)t.hasOwnProperty(n)&&(e.length&&(e+="&"),e+=encodeURIComponent(n)+"="+encodeURIComponent(t[n]));return e}function isr(t){let e={},n=t.split("&");for(let r=0,s=n.length;r<s;r++){let i=n[r].split("=");e[decodeURIComponent(i[0])]=decodeURIComponent(i[1])}return e}class asr extends Error{constructor(e,n,r){super(e),this.description=n,this.context=r,this.type="TransportError"}}class M_e extends Yl{constructor(e){super(),this.writable=!1,Gre(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,n,r){return super.emitReserved("error",new asr(e,n,r)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const n=I_e(e,this.socket.binaryType);this.onPacket(n)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,n={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(n)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const n=ssr(e);return n.length?"?"+n:""}}class osr extends M_e{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const n=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let r=0;this._polling&&(r++,this.once("pollComplete",function(){--r||n()})),this.writable||(r++,this.once("drain",function(){--r||n()}))}else n()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const n=r=>{if(this.readyState==="opening"&&r.type==="open"&&this.onOpen(),r.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(r)};Krr(e,this.socket.binaryType).forEach(n),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,qrr(e,n=>{this.doWrite(n,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",n=this.query||{};return this.opts.timestampRequests!==!1&&(n[this.opts.timestampParam]=aCt()),!this.supportsBinary&&!n.sid&&(n.b64=1),this.createUri(e,n)}}let oCt=!1;try{oCt=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const lsr=oCt;function csr(){}class dsr extends osr{constructor(e){if(super(e),typeof location<"u"){const n=location.protocol==="https:";let r=location.port;r||(r=n?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||r!==e.port}}doWrite(e,n){const r=this.request({method:"POST",data:e});r.on("success",n),r.on("error",(s,i)=>{this.onError("xhr post error",s,i)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(n,r)=>{this.onError("xhr poll error",n,r)}),this.pollXhr=e}}let iP=class sq extends Yl{constructor(e,n,r){super(),this.createRequest=e,Gre(this,r),this._opts=r,this._method=r.method||"GET",this._uri=n,this._data=r.data!==void 0?r.data:null,this._create()}_create(){var e;const n=iCt(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");n.xdomain=!!this._opts.xd;const r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let s in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(s)&&r.setRequestHeader(s,this._opts.extraHeaders[s])}}catch{}if(this._method==="POST")try{r.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{r.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(r),"withCredentials"in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var s;r.readyState===3&&((s=this._opts.cookieJar)===null||s===void 0||s.parseCookies(r.getResponseHeader("set-cookie"))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status=="number"?r.status:0)},0))},r.send(this._data)}catch(s){this.setTimeoutFn(()=>{this._onError(s)},0);return}typeof document<"u"&&(this._index=sq.requestsCount++,sq.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=csr,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete sq.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};iP.requestsCount=0;iP.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",kze);else if(typeof addEventListener=="function"){const t="onpagehide"in pf?"pagehide":"unload";addEventListener(t,kze,!1)}}function kze(){for(let t in iP.requests)iP.requests.hasOwnProperty(t)&&iP.requests[t].abort()}const usr=function(){const t=lCt({xdomain:!1});return t&&t.responseType!==null}();class hsr extends dsr{constructor(e){super(e);const n=e&&e.forceBase64;this.supportsBinary=usr&&!n}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new iP(lCt,this.uri(),e)}}function lCt(t){const e=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||lsr))return new XMLHttpRequest}catch{}if(!e)try{return new pf[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const cCt=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class msr extends M_e{get name(){return"websocket"}doOpen(){const e=this.uri(),n=this.opts.protocols,r=cCt?{}:iCt(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(r.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,n,r)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],s=n===e.length-1;R_e(r,this.supportsBinary,i=>{try{this.doWrite(r,i)}catch{}s&&Hre(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",n=this.query||{};return this.opts.timestampRequests&&(n[this.opts.timestampParam]=aCt()),this.supportsBinary||(n.b64=1),this.createUri(e,n)}}const Ude=pf.WebSocket||pf.MozWebSocket;class fsr extends msr{createSocket(e,n,r){return cCt?new Ude(e,n,r):n?new Ude(e,n):new Ude(e)}doWrite(e,n){this.ws.send(n)}}class psr extends M_e{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const n=Qrr(Number.MAX_SAFE_INTEGER,this.socket.binaryType),r=e.readable.pipeThrough(n).getReader(),s=Yrr();s.readable.pipeTo(e.writable),this._writer=s.writable.getWriter();const i=()=>{r.read().then(({done:l,value:c})=>{l||(this.onPacket(c),i())}).catch(l=>{})};i();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let n=0;n<e.length;n++){const r=e[n],s=n===e.length-1;this._writer.write(r).then(()=>{s&&Hre(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const gsr={websocket:fsr,webtransport:psr,polling:hsr},vsr=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,ysr=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function kxe(t){if(t.length>8e3)throw"URI too long";const e=t,n=t.indexOf("["),r=t.indexOf("]");n!=-1&&r!=-1&&(t=t.substring(0,n)+t.substring(n,r).replace(/:/g,";")+t.substring(r,t.length));let s=vsr.exec(t||""),i={},o=14;for(;o--;)i[ysr[o]]=s[o]||"";return n!=-1&&r!=-1&&(i.source=e,i.host=i.host.substring(1,i.host.length-1).replace(/;/g,":"),i.authority=i.authority.replace("[","").replace("]","").replace(/;/g,":"),i.ipv6uri=!0),i.pathNames=bsr(i,i.path),i.queryKey=xsr(i,i.query),i}function bsr(t,e){const n=/\/{2,9}/g,r=e.replace(n,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&r.splice(0,1),e.slice(-1)=="/"&&r.splice(r.length-1,1),r}function xsr(t,e){const n={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(r,s,i){s&&(n[s]=i)}),n}const Sxe=typeof addEventListener=="function"&&typeof removeEventListener=="function",iq=[];Sxe&&addEventListener("offline",()=>{iq.forEach(t=>t())},!1);class ak extends Yl{constructor(e,n){if(super(),this.binaryType=Jrr,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(n=e,e=null),e){const r=kxe(e);n.hostname=r.host,n.secure=r.protocol==="https"||r.protocol==="wss",n.port=r.port,r.query&&(n.query=r.query)}else n.host&&(n.hostname=kxe(n.host).host);Gre(this,n),this.secure=n.secure!=null?n.secure:typeof location<"u"&&location.protocol==="https:",n.hostname&&!n.port&&(n.port=this.secure?"443":"80"),this.hostname=n.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=n.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},n.transports.forEach(r=>{const s=r.prototype.name;this.transports.push(s),this._transportsByName[s]=r}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},n),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=isr(this.opts.query)),Sxe&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},iq.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const n=Object.assign({},this.opts.query);n.EIO=sCt,n.transport=e,this.id&&(n.sid=this.id);const r=Object.assign({},this.opts,{query:n,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](r)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&ak.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const n=this.createTransport(e);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",n=>this._onClose("transport close",n))}onOpen(){this.readyState="open",ak.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const n=new Error("server error");n.code=e.data,this._onError(n);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let n=1;for(let r=0;r<this.writeBuffer.length;r++){const s=this.writeBuffer[r].data;if(s&&(n+=nsr(s)),r>0&&n>this._maxPayload)return this.writeBuffer.slice(0,r);n+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,Hre(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,n,r){return this._sendPacket("message",e,n,r),this}send(e,n,r){return this._sendPacket("message",e,n,r),this}_sendPacket(e,n,r,s){if(typeof n=="function"&&(s=n,n=void 0),typeof r=="function"&&(s=r,r=null),this.readyState==="closing"||this.readyState==="closed")return;r=r||{},r.compress=r.compress!==!1;const i={type:e,data:n,options:r};this.emitReserved("packetCreate",i),this.writeBuffer.push(i),s&&this.once("flush",s),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},n=()=>{this.off("upgrade",n),this.off("upgradeError",n),e()},r=()=>{this.once("upgrade",n),this.once("upgradeError",n)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?r():e()}):this.upgrading?r():e()),this}_onError(e){if(ak.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,n){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),Sxe&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const r=iq.indexOf(this._offlineEventListener);r!==-1&&iq.splice(r,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,n),this.writeBuffer=[],this._prevBufferLen=0}}}ak.protocol=sCt;class wsr extends ak{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let n=this.createTransport(e),r=!1;ak.priorWebsocketSuccess=!1;const s=()=>{r||(n.send([{type:"ping",data:"probe"}]),n.once("packet",h=>{if(!r)if(h.type==="pong"&&h.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",n),!n)return;ak.priorWebsocketSuccess=n.name==="websocket",this.transport.pause(()=>{r||this.readyState!=="closed"&&(u(),this.setTransport(n),n.send([{type:"upgrade"}]),this.emitReserved("upgrade",n),n=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=n.name,this.emitReserved("upgradeError",m)}}))};function i(){r||(r=!0,u(),n.close(),n=null)}const o=h=>{const m=new Error("probe error: "+h);m.transport=n.name,i(),this.emitReserved("upgradeError",m)};function l(){o("transport closed")}function c(){o("socket closed")}function d(h){n&&h.name!==n.name&&i()}const u=()=>{n.removeListener("open",s),n.removeListener("error",o),n.removeListener("close",l),this.off("close",c),this.off("upgrading",d)};n.once("open",s),n.once("error",o),n.once("close",l),this.once("close",c),this.once("upgrading",d),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{r||n.open()},200):n.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const n=[];for(let r=0;r<e.length;r++)~this.transports.indexOf(e[r])&&n.push(e[r]);return n}}let ksr=class extends wsr{constructor(e,n={}){const r=typeof e=="object"?e:n;(!r.transports||r.transports&&typeof r.transports[0]=="string")&&(r.transports=(r.transports||["polling","websocket","webtransport"]).map(s=>gsr[s]).filter(s=>!!s)),super(e,r)}};function Ssr(t,e="",n){let r=t;n=n||typeof location<"u"&&location,t==null&&(t=n.protocol+"//"+n.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=n.protocol+t:t=n.host+t),/^(https?|wss?):\/\//.test(t)||(typeof n<"u"?t=n.protocol+"//"+t:t="https://"+t),r=kxe(t)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port="80":/^(http|ws)s$/.test(r.protocol)&&(r.port="443")),r.path=r.path||"/";const i=r.host.indexOf(":")!==-1?"["+r.host+"]":r.host;return r.id=r.protocol+"://"+i+":"+r.port+e,r.href=r.protocol+"://"+i+(n&&n.port===r.port?"":":"+r.port),r}const Csr=typeof ArrayBuffer=="function",jsr=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,dCt=Object.prototype.toString,Esr=typeof Blob=="function"||typeof Blob<"u"&&dCt.call(Blob)==="[object BlobConstructor]",Nsr=typeof File=="function"||typeof File<"u"&&dCt.call(File)==="[object FileConstructor]";function L_e(t){return Csr&&(t instanceof ArrayBuffer||jsr(t))||Esr&&t instanceof Blob||Nsr&&t instanceof File}function aq(t,e){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let n=0,r=t.length;n<r;n++)if(aq(t[n]))return!0;return!1}if(L_e(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return aq(t.toJSON(),!0);for(const n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&aq(t[n]))return!0;return!1}function Tsr(t){const e=[],n=t.data,r=t;return r.data=Cxe(n,e),r.attachments=e.length,{packet:r,buffers:e}}function Cxe(t,e){if(!t)return t;if(L_e(t)){const n={_placeholder:!0,num:e.length};return e.push(t),n}else if(Array.isArray(t)){const n=new Array(t.length);for(let r=0;r<t.length;r++)n[r]=Cxe(t[r],e);return n}else if(typeof t=="object"&&!(t instanceof Date)){const n={};for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=Cxe(t[r],e));return n}return t}function _sr(t,e){return t.data=jxe(t.data,e),delete t.attachments,t}function jxe(t,e){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<e.length)return e[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let n=0;n<t.length;n++)t[n]=jxe(t[n],e);else if(typeof t=="object")for(const n in t)Object.prototype.hasOwnProperty.call(t,n)&&(t[n]=jxe(t[n],e));return t}const uCt=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],Asr=5;var As;(function(t){t[t.CONNECT=0]="CONNECT",t[t.DISCONNECT=1]="DISCONNECT",t[t.EVENT=2]="EVENT",t[t.ACK=3]="ACK",t[t.CONNECT_ERROR=4]="CONNECT_ERROR",t[t.BINARY_EVENT=5]="BINARY_EVENT",t[t.BINARY_ACK=6]="BINARY_ACK"})(As||(As={}));class Psr{constructor(e){this.replacer=e}encode(e){return(e.type===As.EVENT||e.type===As.ACK)&&aq(e)?this.encodeAsBinary({type:e.type===As.EVENT?As.BINARY_EVENT:As.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let n=""+e.type;return(e.type===As.BINARY_EVENT||e.type===As.BINARY_ACK)&&(n+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(n+=e.nsp+","),e.id!=null&&(n+=e.id),e.data!=null&&(n+=JSON.stringify(e.data,this.replacer)),n}encodeAsBinary(e){const n=Tsr(e),r=this.encodeAsString(n.packet),s=n.buffers;return s.unshift(r),s}}class D_e extends Yl{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e=="function"?{reviver:e}:e)}add(e){let n;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");n=this.decodeString(e);const r=n.type===As.BINARY_EVENT;r||n.type===As.BINARY_ACK?(n.type=r?As.EVENT:As.ACK,this.reconstructor=new Rsr(n),n.attachments===0&&super.emitReserved("decoded",n)):super.emitReserved("decoded",n)}else if(L_e(e)||e.base64)if(this.reconstructor)n=this.reconstructor.takeBinaryData(e),n&&(this.reconstructor=null,super.emitReserved("decoded",n));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let n=0;const r={type:Number(e.charAt(0))};if(As[r.type]===void 0)throw new Error("unknown packet type "+r.type);if(r.type===As.BINARY_EVENT||r.type===As.BINARY_ACK){const i=n+1;for(;e.charAt(++n)!=="-"&&n!=e.length;);const o=e.substring(i,n);if(o!=Number(o)||e.charAt(n)!=="-")throw new Error("Illegal attachments");const l=Number(o);if(!hCt(l)||l<0)throw new Error("Illegal attachments");if(l>this.opts.maxAttachments)throw new Error("too many attachments");r.attachments=l}if(e.charAt(n+1)==="/"){const i=n+1;for(;++n&&!(e.charAt(n)===","||n===e.length););r.nsp=e.substring(i,n)}else r.nsp="/";const s=e.charAt(n+1);if(s!==""&&Number(s)==s){const i=n+1;for(;++n;){const o=e.charAt(n);if(o==null||Number(o)!=o){--n;break}if(n===e.length)break}r.id=Number(e.substring(i,n+1))}if(e.charAt(++n)){const i=this.tryParse(e.substr(n));if(D_e.isPayloadValid(r.type,i))r.data=i;else throw new Error("invalid payload")}return r}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,n){switch(e){case As.CONNECT:return gZ(n);case As.DISCONNECT:return n===void 0;case As.CONNECT_ERROR:return typeof n=="string"||gZ(n);case As.EVENT:case As.BINARY_EVENT:return Array.isArray(n)&&(typeof n[0]=="number"||typeof n[0]=="string"&&uCt.indexOf(n[0])===-1);case As.ACK:case As.BINARY_ACK:return Array.isArray(n)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class Rsr{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const n=_sr(this.reconPack,this.buffers);return this.finishedReconstruction(),n}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function Isr(t){return typeof t=="string"}const hCt=Number.isInteger||function(t){return typeof t=="number"&&isFinite(t)&&Math.floor(t)===t};function Msr(t){return t===void 0||hCt(t)}function gZ(t){return Object.prototype.toString.call(t)==="[object Object]"}function Lsr(t,e){switch(t){case As.CONNECT:return e===void 0||gZ(e);case As.DISCONNECT:return e===void 0;case As.EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&uCt.indexOf(e[0])===-1);case As.ACK:return Array.isArray(e);case As.CONNECT_ERROR:return typeof e=="string"||gZ(e);default:return!1}}function Dsr(t){return Isr(t.nsp)&&Msr(t.id)&&Lsr(t.type,t.data)}const $sr=Object.freeze(Object.defineProperty({__proto__:null,Decoder:D_e,Encoder:Psr,get PacketType(){return As},isPacketValid:Dsr,protocol:Asr},Symbol.toStringTag,{value:"Module"}));function Yp(t,e,n){return t.on(e,n),function(){t.off(e,n)}}const Osr=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class mCt extends Yl{constructor(e,n,r){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=n,r&&r.auth&&(this.auth=r.auth),this._opts=Object.assign({},r),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[Yp(e,"open",this.onopen.bind(this)),Yp(e,"packet",this.onpacket.bind(this)),Yp(e,"error",this.onerror.bind(this)),Yp(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...n){var r,s,i;if(Osr.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(n.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(n),this;const o={type:As.EVENT,data:n};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof n[n.length-1]=="function"){const u=this.ids++,h=n.pop();this._registerAckCallback(u,h),o.id=u}const l=(s=(r=this.io.engine)===null||r===void 0?void 0:r.transport)===null||s===void 0?void 0:s.writable,c=this.connected&&!(!((i=this.io.engine)===null||i===void 0)&&i._hasPingExpired());return this.flags.volatile&&!l||(c?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,n){var r;const s=(r=this.flags.timeout)!==null&&r!==void 0?r:this._opts.ackTimeout;if(s===void 0){this.acks[e]=n;return}const i=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let l=0;l<this.sendBuffer.length;l++)this.sendBuffer[l].id===e&&this.sendBuffer.splice(l,1);n.call(this,new Error("operation has timed out"))},s),o=(...l)=>{this.io.clearTimeoutFn(i),n.apply(this,l)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...n){return new Promise((r,s)=>{const i=(o,l)=>o?s(o):r(l);i.withError=!0,n.push(i),this.emit(e,...n)})}_addToQueue(e){let n;typeof e[e.length-1]=="function"&&(n=e.pop());const r={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((s,...i)=>(this._queue[0],s!==null?r.tryCount>this._opts.retries&&(this._queue.shift(),n&&n(s)):(this._queue.shift(),n&&n(null,...i)),r.pending=!1,this._drainQueue())),this._queue.push(r),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const n=this._queue[0];n.pending&&!e||(n.pending=!0,n.tryCount++,this.flags=n.flags,this.emit.apply(this,n.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:As.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,n){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,n),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(r=>String(r.id)===e)){const r=this.acks[e];delete this.acks[e],r.withError&&r.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case As.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case As.EVENT:case As.BINARY_EVENT:this.onevent(e);break;case As.ACK:case As.BINARY_ACK:this.onack(e);break;case As.DISCONNECT:this.ondisconnect();break;case As.CONNECT_ERROR:this.destroy();const r=new Error(e.data.message);r.data=e.data.data,this.emitReserved("connect_error",r);break}}onevent(e){const n=e.data||[];e.id!=null&&n.push(this.ack(e.id)),this.connected?this.emitEvent(n):this.receiveBuffer.push(Object.freeze(n))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const n=this._anyListeners.slice();for(const r of n)r.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const n=this;let r=!1;return function(...s){r||(r=!0,n.packet({type:As.ACK,id:e,data:s}))}}onack(e){const n=this.acks[e.id];typeof n=="function"&&(delete this.acks[e.id],n.withError&&e.data.unshift(null),n.apply(this,e.data))}onconnect(e,n){this.id=e,this.recovered=n&&this._pid===n,this._pid=n,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:As.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const n=this._anyListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const n=this._anyOutgoingListeners;for(let r=0;r<n.length;r++)if(e===n[r])return n.splice(r,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const n=this._anyOutgoingListeners.slice();for(const r of n)r.apply(this,e.data)}}}function SM(t){t=t||{},this.ms=t.min||100,this.max=t.max||1e4,this.factor=t.factor||2,this.jitter=t.jitter>0&&t.jitter<=1?t.jitter:0,this.attempts=0}SM.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=Math.floor(e*10)&1?t+n:t-n}return Math.min(t,this.max)|0};SM.prototype.reset=function(){this.attempts=0};SM.prototype.setMin=function(t){this.ms=t};SM.prototype.setMax=function(t){this.max=t};SM.prototype.setJitter=function(t){this.jitter=t};class Exe extends Yl{constructor(e,n){var r;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(n=e,e=void 0),n=n||{},n.path=n.path||"/socket.io",this.opts=n,Gre(this,n),this.reconnection(n.reconnection!==!1),this.reconnectionAttempts(n.reconnectionAttempts||1/0),this.reconnectionDelay(n.reconnectionDelay||1e3),this.reconnectionDelayMax(n.reconnectionDelayMax||5e3),this.randomizationFactor((r=n.randomizationFactor)!==null&&r!==void 0?r:.5),this.backoff=new SM({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(n.timeout==null?2e4:n.timeout),this._readyState="closed",this.uri=e;const s=n.parser||$sr;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=n.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var n;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(n=this.backoff)===null||n===void 0||n.setMin(e),this)}randomizationFactor(e){var n;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(n=this.backoff)===null||n===void 0||n.setJitter(e),this)}reconnectionDelayMax(e){var n;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(n=this.backoff)===null||n===void 0||n.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new ksr(this.uri,this.opts);const n=this.engine,r=this;this._readyState="opening",this.skipReconnect=!1;const s=Yp(n,"open",function(){r.onopen(),e&&e()}),i=l=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",l),e?e(l):this.maybeReconnectOnOpen()},o=Yp(n,"error",i);if(this._timeout!==!1){const l=this._timeout,c=this.setTimeoutFn(()=>{s(),i(new Error("timeout")),n.close()},l);this.opts.autoUnref&&c.unref(),this.subs.push(()=>{this.clearTimeoutFn(c)})}return this.subs.push(s),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(Yp(e,"ping",this.onping.bind(this)),Yp(e,"data",this.ondata.bind(this)),Yp(e,"error",this.onerror.bind(this)),Yp(e,"close",this.onclose.bind(this)),Yp(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(n){this.onclose("parse error",n)}}ondecoded(e){Hre(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,n){let r=this.nsps[e];return r?this._autoConnect&&!r.active&&r.connect():(r=new mCt(this,e,n),this.nsps[e]=r),r}_destroy(e){const n=Object.keys(this.nsps);for(const r of n)if(this.nsps[r].active)return;this._close()}_packet(e){const n=this.encoder.encode(e);for(let r=0;r<n.length;r++)this.engine.write(n[r],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,n){var r;this.cleanup(),(r=this.engine)===null||r===void 0||r.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,n),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const n=this.backoff.duration();this._reconnecting=!0;const r=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(s=>{s?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",s)):e.onreconnect()}))},n);this.opts.autoUnref&&r.unref(),this.subs.push(()=>{this.clearTimeoutFn(r)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const C3={};function oq(t,e){typeof t=="object"&&(e=t,t=void 0),e=e||{};const n=Ssr(t,e.path||"/socket.io"),r=n.source,s=n.id,i=n.path,o=C3[s]&&i in C3[s].nsps,l=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let c;return l?c=new Exe(r,e):(C3[s]||(C3[s]=new Exe(r,e)),c=C3[s]),n.query&&!e.query&&(e.query=n.queryKey),c.socket(n.path,e)}Object.assign(oq,{Manager:Exe,Socket:mCt,io:oq,connect:oq});const fCt=y.createContext(null);function Fsr({children:t}){const{community:e}=qe(),n=(e==null?void 0:e.id)??null,r=Nd(),[s,i]=y.useState(null),[o,l]=y.useState(!1),c=y.useRef(()=>{});y.useEffect(()=>{if(!n||!r||!wo.socketUrl){i(null),l(!1);return}const u=oq(wo.socketUrl,{transports:["websocket"],autoConnect:!0}),h=()=>u.emit("register-user",{token:r,communityId:n});return c.current=h,u.on("connect",h),u.on("registered-user",()=>l(!0)),u.on("disconnect",()=>l(!1)),i(u),()=>{u.off("connect",h),u.removeAllListeners(),u.disconnect(),l(!1)}},[n,r]);const d=y.useMemo(()=>({socket:s,registered:o}),[s,o]);return a.jsx(fCt.Provider,{value:d,children:t})}function Qg(){const t=y.useContext(fCt);if(!t)throw new Error("useSocket must be used within SocketProvider");return t}const Bsr=24;function Usr({meetingId:t,canPost:e,onViewerCount:n}){const{socket:r}=Qg(),{toast:s}=yt(),[i,o]=y.useState("chat"),[l,c]=y.useState([]),[d,u]=y.useState([]),[h,m]=y.useState([]),[f,p]=y.useState(""),[g,v]=y.useState(!1),[b,x]=y.useState(null),[w,k]=y.useState(!1),[S,C]=y.useState(!1),[j,E]=y.useState(null),[N,A]=y.useState("top"),[_,T]=y.useState(!1),R=y.useRef("chat"),O=y.useRef(null),F=y.useRef(new Set),D=y.useRef(new Set);y.useEffect(()=>{let H=!1;return(async()=>{try{const[W,V]=await Promise.all([$Zn(t),t_e(t)]);if(H)return;W.messages.forEach(U=>F.current.add(U.id)),V.questions.forEach(U=>D.current.add(U.id)),c(W.messages),C(!!W.chatDisabled),u(V.questions),k(V.closed),E(V.spotlight)}catch{}})(),()=>{H=!0}},[t]),y.useEffect(()=>{if(!r)return;const H=()=>r.emit("webinar:join",{meetingId:t});H(),r.on("connect",H);const W=re=>{const fe=re==null?void 0:re.message;!fe||F.current.has(fe.id)||(F.current.add(fe.id),c(le=>[...le,fe].slice(-200)))},V=re=>{const fe=re==null?void 0:re.question;if(fe){if(re.type==="state"){k(!!fe.closed);return}if(re.type==="spotlight"){E(fe.id?fe:null);return}if(re.type==="deleted"){u(le=>le.filter(q=>q.id!==fe.id)),E(le=>le&&le.id===fe.id?null:le);return}if(re.type==="updated"){u(le=>le.map(q=>q.id===fe.id?{...q,question:fe.question}:q)),E(le=>le&&le.id===fe.id?{...le,question:fe.question}:le);return}if(re.type==="voted"){u(le=>le.map(q=>q.id===fe.id?{...q,voteCount:fe.voteCount}:q));return}if(re.type==="answered"){u(le=>le.map(q=>q.id===fe.id?{...q,...fe}:q));return}D.current.has(fe.id)||(D.current.add(fe.id),R.current!=="qa"&&T(!0),u(le=>[fe,...le].slice(0,200)))}},U=re=>{const fe=(re==null?void 0:re.counts)||{},le=[];let q=Bsr;for(const[X,Q]of Object.entries(fe)){const ie=cde[X];if(!ie)continue;const he=Math.min(Q,q);for(let ye=0;ye<he;ye++)le.push({key:`${X}-${Date.now()}-${ye}-${Math.random()}`,emoji:ie,left:10+Math.random()*70});if(q-=he,q<=0)break}if(!le.length)return;m(X=>[...X,...le]);const Y=new Set(le.map(X=>X.key));setTimeout(()=>m(X=>X.filter(Q=>!Y.has(Q.key))),2600)},ne=re=>{typeof(re==null?void 0:re.count)=="number"&&(n==null||n(re.count))},te=re=>C(!!(re!=null&&re.chatDisabled));return r.on("webinar:chat",W),r.on("webinar:chat-state",te),r.on("webinar:qa",V),r.on("webinar:reactions",U),r.on("webinar:viewers",ne),()=>{r.emit("webinar:leave",{meetingId:t}),r.off("connect",H),r.off("webinar:chat",W),r.off("webinar:chat-state",te),r.off("webinar:qa",V),r.off("webinar:reactions",U),r.off("webinar:viewers",ne)}},[r,t,n]),y.useEffect(()=>{var H;i==="chat"&&((H=O.current)==null||H.scrollIntoView({block:"end"}))},[l,i]);const I=y.useCallback(async()=>{var W;const H=f.trim();if(!(!H||g)){v(!0);try{await zZn(t,H),p("")}catch(V){const U=(W=V==null?void 0:V.response)==null?void 0:W.status;s({title:U===429?"Slow down a little":"Couldn't send",description:U===429?"You're sending messages too quickly.":"Please try again.",variant:"destructive"})}finally{v(!1)}}},[f,g,t,s]),P=y.useMemo(()=>{const H=(V,U)=>(U.createdAt||"").localeCompare(V.createdAt||""),W=N==="top"?(V,U)=>(U.voteCount??0)-(V.voteCount??0)||H(V,U):H;return[...d.filter(V=>!V.isAnswered).sort(W),...d.filter(V=>V.isAnswered).sort(W)]},[d,N]),M=y.useCallback(async H=>{if(!b){x(H);try{const W=await Q1t(t,H);u(V=>V.map(U=>U.id===W.id?{...U,voteCount:W.voteCount,hasVoted:W.hasVoted}:U))}catch{s({title:"Couldn't record your vote",description:"Please try again.",variant:"destructive"})}finally{x(null)}}},[b,t,s]),z=y.useRef(0),G=y.useCallback(H=>{m(V=>[...V,{key:`me-${Date.now()}-${Math.random()}`,emoji:cde[H],left:10+Math.random()*70}]),setTimeout(()=>m(V=>V.slice(1)),2600);const W=Date.now();W-z.current<400||(z.current=W,HZn(t,H).catch(()=>{}))},[t]),B=y.useMemo(()=>VZn.map(H=>a.jsx("button",{type:"button",onClick:()=>G(H),className:"text-xl leading-none transition-transform hover:scale-125 active:scale-95","aria-label":`React ${H}`,children:cde[H]},H)),[G]);return a.jsxs("div",{className:"relative flex h-full min-h-0 flex-col bg-[hsl(230,22%,15%)] text-white",children:[a.jsx("div",{className:"pointer-events-none absolute inset-x-0 bottom-24 top-0 z-10 overflow-hidden",children:h.map(H=>a.jsx("span",{className:"webinar-float absolute bottom-0 text-2xl",style:{left:`${H.left}%`},children:H.emoji},H.key))}),a.jsx("div",{className:"flex shrink-0 border-b border-white/10",children:[["chat","Chat",Vi],["qa","Q&A",L8]].map(([H,W,V])=>a.jsxs("button",{type:"button",onClick:()=>{o(H),R.current=H,H==="qa"&&T(!1)},className:`flex flex-1 items-center justify-center gap-1.5 py-2.5 text-sm font-medium transition-colors ${i===H?"border-b-2 border-white text-white":"text-white/50 hover:text-white/80"}`,children:[a.jsx(V,{className:"h-4 w-4"})," ",W,H==="qa"&&_&&a.jsx("span",{className:"h-2 w-2 rounded-full bg-sky-400","aria-label":"New questions"})]},H))}),i==="chat"?a.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[a.jsxs("div",{className:"flex-1 space-y-2 overflow-y-auto px-3 py-3",children:[l.length===0&&a.jsx("p",{className:"mt-6 text-center text-sm text-white/40",children:"No messages yet. Say hello 👋"}),l.map(H=>a.jsxs("div",{className:"text-sm leading-snug",children:[a.jsx("span",{className:"font-semibold text-white/90",children:H.sentByName||"Member"})," ",a.jsx("span",{className:"text-white/80",children:H.text})]},H.id)),a.jsx("div",{ref:O})]}),a.jsxs("div",{className:"shrink-0 border-t border-white/10 px-3 py-2",children:[a.jsx("div",{className:"mb-2 flex items-center justify-center gap-3",children:B}),S?a.jsx("p",{role:"status",className:"text-center text-xs text-amber-300",children:"Chat is turned off by the host."}):e?a.jsxs("form",{className:"flex items-center gap-2",onSubmit:H=>{H.preventDefault(),I()},children:[a.jsx("input",{value:f,onChange:H=>p(H.target.value),maxLength:500,placeholder:"Message…",className:"min-w-0 flex-1 rounded-full bg-white/10 px-3 py-2 text-sm placeholder:text-white/40 focus:outline-none focus:ring-1 focus:ring-white/30"}),a.jsx("button",{type:"submit",disabled:g||!f.trim(),className:"inline-flex h-9 w-9 items-center justify-center rounded-full bg-white/15 hover:bg-white/25 disabled:opacity-40","aria-label":"Send message",children:a.jsx(_s,{className:"h-4 w-4"})})]}):a.jsx("p",{className:"text-center text-xs text-white/40",children:"Sign in to chat"})]})]}):a.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[a.jsxs("div",{className:"flex-1 space-y-2 overflow-y-auto px-3 py-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("div",{className:"flex rounded-full bg-white/10 p-0.5 text-xs",children:["top","new"].map(H=>a.jsx("button",{type:"button",onClick:()=>A(H),"aria-pressed":N===H,className:`rounded-full px-3 py-1 font-medium ${N===H?"bg-white/20 text-white":"text-white/50 hover:text-white/80"}`,children:H==="top"?"Top":"Newest"},H))}),w&&a.jsx("span",{className:"text-xs text-amber-300",children:"Q&A closed"})]}),j&&a.jsxs("div",{className:"rounded-md border border-sky-400/40 bg-sky-400/10 px-3 py-2",children:[a.jsx("div",{className:"text-[10px] font-semibold uppercase tracking-wide text-sky-300",children:"Now answering"}),a.jsx("div",{className:"text-sm text-white",children:j.question})]}),d.length===0&&a.jsx("p",{className:"mt-6 text-center text-sm text-white/40",children:"No questions yet — the host will post them here."}),P.map(H=>a.jsxs("div",{className:`rounded-md px-3 py-2 text-sm ${H.isAnswered?"bg-emerald-500/10":"bg-white/5"}`,children:[a.jsxs("div",{className:"flex items-start gap-2.5",children:[a.jsxs("button",{type:"button",disabled:!e||w||b===H.id,onClick:()=>void M(H.id),"aria-pressed":!!H.hasVoted,"aria-label":H.hasVoted?"Remove your upvote":"Upvote this question",className:`flex w-9 shrink-0 flex-col items-center rounded-md border py-1 text-xs font-semibold transition-colors ${H.hasVoted?"border-sky-400 bg-sky-400/20 text-sky-300":"border-white/15 text-white/70 hover:border-white/40"} disabled:cursor-default`,children:[a.jsx($8,{className:"h-3.5 w-3.5"}),H.voteCount??0]}),a.jsx("div",{className:"min-w-0 flex-1 text-white/85",children:H.question})]}),a.jsxs("div",{className:"mt-1 flex items-center gap-2 text-xs text-white/40",children:[a.jsx("span",{children:H.askedByName||"Guest"}),H.isAnswered&&a.jsx("span",{className:"rounded-full bg-emerald-500/20 px-1.5 py-0.5 text-emerald-300",children:"Answered"})]})]},H.id))]}),a.jsx("div",{className:"shrink-0 border-t border-white/10 px-3 py-2",children:a.jsx("p",{className:"text-center text-xs text-white/40",children:w?"Q&A is closed.":e?"Upvote the questions you want answered.":"Sign in to upvote questions"})})]}),a.jsx("style",{children:`
        @keyframes webinarFloatUp {
          0%   { transform: translateY(0) scale(0.8); opacity: 0; }
          15%  { opacity: 1; }
          100% { transform: translateY(-220px) scale(1.2); opacity: 0; }
        }
        .webinar-float { animation: webinarFloatUp 2.4s ease-out forwards; }
        @media (prefers-reduced-motion: reduce) { .webinar-float { animation-duration: 0.6s; } }
      `})]})}function zsr({count:t}){return t==null?null:a.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-white/10 px-2 py-0.5 text-[11px] font-medium text-white/80",children:[a.jsx(wr,{className:"h-3 w-3"})," ",t.toLocaleString()]})}const Vsr=6e4;function pCt(t,e,n=!1){y.useEffect(()=>{if(!t||!e)return;const r=()=>{PZn(t,n).catch(()=>{})};r();const s=setInterval(r,Vsr);return()=>clearInterval(s)},[t,e,n])}function Hsr({joinData:t,onLeave:e,onRefetch:n}){const r=t.livestreamPending||!t.playbackUrl,{user:s}=jr(),[i,o]=y.useState(null);pCt(t.meetingId,!!s&&!r);const l=y.useRef(n);return y.useEffect(()=>{l.current=n},[n]),y.useEffect(()=>{if(!r)return;const d=setInterval(()=>l.current(),8e3+Math.floor(Math.random()*4e3));return()=>clearInterval(d)},[r]),a.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col bg-[hsl(230,25%,12%)] text-white",children:[a.jsxs("header",{className:"flex items-center justify-between gap-3 px-4 py-3 border-b border-white/10",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[t.logo&&a.jsx("img",{src:t.logo,alt:"",className:"h-7 w-7 rounded object-cover"}),a.jsx("span",{className:"truncate text-sm font-semibold",children:t.communityName??"Live session"}),!r&&a.jsxs("span",{className:"ml-1 inline-flex items-center gap-1 rounded-full bg-red-500/20 px-2 py-0.5 text-[11px] font-semibold text-red-300",children:[a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-red-500 animate-pulse"})," LIVE"]}),a.jsx(zsr,{count:i})]}),t.guestInviteContext&&a.jsx(a2e,{className:"bg-white/10 border-white/20 text-white hover:bg-white/20 hover:text-white",communityId:t.guestInviteContext.communityId,eventId:t.guestInviteContext.eventId}),a.jsxs("button",{type:"button",onClick:e,className:"inline-flex items-center gap-1.5 rounded-md bg-white/10 px-3 py-1.5 text-sm font-medium hover:bg-white/20 transition-colors",children:[a.jsx(sI,{className:"h-4 w-4"})," Leave"]})]}),a.jsxs("main",{className:"flex min-h-0 flex-1 flex-col md:flex-row",children:[a.jsx("div",{className:"flex min-h-0 flex-1 items-center justify-center overflow-hidden p-2 sm:p-4",children:r?a.jsxs("div",{className:"flex flex-col items-center gap-3 text-white/70",children:[a.jsx(i9t,{className:"h-8 w-8 text-white/50"}),a.jsx(Ne,{className:"h-5 w-5 animate-spin"}),a.jsx("p",{className:"text-sm",children:"Waiting for the host to start the stream…"}),a.jsx("button",{type:"button",onClick:n,className:"text-xs text-white/60 underline hover:text-white/90",children:"Refresh"})]}):a.jsx(zrr,{src:t.playbackUrl,className:"h-full w-full max-h-full rounded-lg bg-black object-contain"})}),a.jsx("aside",{className:"h-[45%] min-h-0 shrink-0 border-t border-white/10 md:h-auto md:w-[340px] md:border-l md:border-t-0",children:a.jsx(Usr,{meetingId:t.meetingId,canPost:!!s,onViewerCount:o})})]})]})}function Wre(t,e){const n=t.votedOption;return n===e?t:{...t,options:t.options.map((r,s)=>s===e?{...r,votes:r.votes+1}:s===n?{...r,votes:Math.max(0,r.votes-1)}:r),totalVotes:n===null?t.totalVotes+1:t.totalVotes,votedOption:e}}function Gsr(t,e){return{...t,options:t.options.map((n,r)=>r===e?{...n,votes:Math.max(0,n.votes-1)}:n),totalVotes:Math.max(0,t.totalVotes-1),votedOption:null}}function gCt(t,e,n){return n===null?Gsr(t,e):Wre(t,n)}function jj(t){return!t.endsAt||new Date(t.endsAt).getTime()>Date.now()}function vCt(t){const e=t.map(i=>Math.max(0,Math.floor(Number(i)||0))),n=e.reduce((i,o)=>i+o,0);if(n===0)return e.map(()=>0);const r=e.map(i=>Math.floor(i*100/n)),s=100-r.reduce((i,o)=>i+o,0);return e.map((i,o)=>({index:o,count:i,remainder:i*100%n})).sort((i,o)=>o.remainder-i.remainder||o.count-i.count||i.index-o.index).slice(0,s).forEach(({index:i})=>{r[i]+=1}),r}function $_e(t,e){const n=t.options.map((r,s)=>s);return e?n.sort((r,s)=>(t.options[s].votes||0)-(t.options[r].votes||0)||r-s):n}function yCt(t){return vCt(t.options.map(e=>e.votes))}const k$=new Map,Nxe=new Set,O_e=t=>{var e;return`${((e=ro())==null?void 0:e.id)??""}:${t}`},bCt=()=>Nxe.forEach(t=>t()),Wsr=t=>(Nxe.add(t),()=>{Nxe.delete(t)});function qre(t,e){const n=O_e(t),r=k$.get(n);return k$.set(n,e),bCt(),()=>{k$.get(n)===e&&(r===void 0?qsr(t):qre(t,r))}}function qsr(t){k$.delete(O_e(t))&&bCt()}function xCt(t,e){const n=y.useSyncExternalStore(Wsr,()=>t?k$.get(O_e(t)):void 0);return y.useMemo(()=>e&&n!==void 0&&e.votedOption!==n&&e.options[n]?Wre(e,n):e,[e,n])}function Ksr({meetingId:t,canModerate:e,onChanged:n}){var d;const r=rn(),[s,i]=y.useState(!1),o=lt({queryKey:Qbe(t),queryFn:()=>RZn(t),refetchInterval:3e4}),l=(u="change")=>{r.invalidateQueries({queryKey:Qbe(t)}),n(u)},c=((d=o.data)==null?void 0:d.polls)??[];return a.jsx("div",{className:"flex h-full flex-col",children:a.jsxs("div",{className:"flex-1 space-y-3 overflow-y-auto p-4",children:[e&&!s&&a.jsxs("button",{type:"button",onClick:()=>i(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-lg bg-primary px-3 py-2 text-sm font-medium text-white hover:bg-primary/90",children:[a.jsx(Dn,{className:"h-4 w-4"})," Create poll"]}),e&&s&&a.jsx(Ysr,{meetingId:t,onCancel:()=>i(!1),onCreated:()=>{i(!1),l("new")}}),o.isLoading&&a.jsxs("div",{className:"flex items-center justify-center gap-2 pt-8 text-sm text-white/40",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"})," Loading polls…"]}),!o.isLoading&&c.length===0&&!s&&a.jsxs("div",{className:"pt-8 text-center",children:[a.jsx(Fc,{className:"mx-auto h-8 w-8 text-white/20"}),a.jsx("p",{className:"mt-2 text-sm text-white/40",children:e?"No polls yet — create one for the audience.":"No polls yet — the host will post them here."})]}),c.map(u=>a.jsx(Qsr,{meetingId:t,poll:u,canModerate:e,onChanged:l},u.id))]})})}function Ysr({meetingId:t,onCancel:e,onCreated:n}){const{toast:r}=yt(),[s,i]=y.useState(""),[o,l]=y.useState(["",""]),[c,d]=y.useState(null),[u,h]=y.useState(!1),m=o.map(b=>b.trim()).filter(Boolean),f=s.trim().length>0&&m.length>=2&&!u,p=(b,x)=>l(w=>w.map((k,S)=>S===b?x:k)),g=b=>{l(x=>x.filter((w,k)=>k!==b)),d(x=>x===null||x===b?null:x>b?x-1:x)},v=async()=>{if(!f)return;const b=o.map((w,k)=>({text:w.trim(),i:k})).filter(w=>w.text),x=c===null?null:b.findIndex(w=>w.i===c);h(!0);try{await IZn(t,{question:s.trim(),options:b.map(w=>w.text),correctOptionIndex:x===-1?null:x}),n()}catch(w){r({title:"Could not create the poll",description:Dt(w,"Please try again."),variant:"destructive"})}finally{h(!1)}};return a.jsxs("div",{className:"space-y-2.5 rounded-lg border border-white/10 bg-white/5 p-3",children:[a.jsx("textarea",{value:s,onChange:b=>i(b.target.value),placeholder:"Ask a question…",rows:2,maxLength:500,className:"w-full resize-none rounded-md bg-white/10 px-3 py-2 text-sm text-white placeholder:text-white/40 focus:outline-none focus:ring-1 focus:ring-primary"}),a.jsx("p",{className:"text-xs text-white/50",children:"Options — select the correct answer (optional)"}),o.map((b,x)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button",onClick:()=>d(w=>w===x?null:x),"aria-label":c===x?"Correct answer (click to unset)":"Mark as correct answer",title:c===x?"Correct answer":"Mark as correct answer",className:ee("flex h-5 w-5 shrink-0 items-center justify-center rounded-full border",c===x?"border-success bg-success text-white":"border-white/30 hover:border-white/60"),children:c===x&&a.jsx(Qn,{className:"h-3 w-3"})}),a.jsx("input",{value:b,onChange:w=>p(x,w.target.value),placeholder:`Option ${x+1}`,maxLength:200,className:"min-w-0 flex-1 rounded-md bg-white/10 px-3 py-1.5 text-sm text-white placeholder:text-white/40 focus:outline-none focus:ring-1 focus:ring-primary"}),o.length>2&&a.jsx("button",{type:"button",onClick:()=>g(x),"aria-label":`Remove option ${x+1}`,className:"rounded p-1 text-white/50 hover:bg-white/10 hover:text-white",children:a.jsx(nn,{className:"h-3.5 w-3.5"})})]},x)),o.length<10&&a.jsx("button",{type:"button",onClick:()=>l(b=>[...b,""]),className:"text-xs font-medium text-primary hover:underline",children:"+ Add option"}),a.jsxs("div",{className:"flex justify-end gap-2 pt-1",children:[a.jsx("button",{type:"button",onClick:e,className:"rounded-md px-3 py-1.5 text-sm text-white/70 hover:bg-white/10",children:"Cancel"}),a.jsxs("button",{type:"button",onClick:v,disabled:!f,className:"flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-sm font-medium text-white hover:bg-primary/90 disabled:opacity-50",children:[u&&a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"})," Post poll"]})]})]})}function Qsr({meetingId:t,poll:e,canModerate:n,onChanged:r}){const{toast:s}=yt(),[i,o]=y.useState(!1),[l,c]=y.useState(!1),d=e.myVote!==null,u=!n&&!d&&!e.answerRevealed,h=e.totalVotes!==null,m=e.totalVotes??0,f=vCt(e.options.map(v=>v.votes??0)),p=async(v,b,x="change")=>{o(!0);try{await v(),r(x)}catch(w){s({title:b,description:Dt(w,"Please try again."),variant:"destructive"})}finally{o(!1)}},g=e.answerRevealed&&e.isQuiz&&d&&!n?e.myVote===e.correctOptionIndex?"right":"wrong":null;return a.jsxs("div",{className:"rounded-lg border border-white/10 bg-white/5 p-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsx("p",{className:"break-words text-sm font-medium text-white/90",children:e.question}),e.isQuiz&&a.jsx("span",{className:"shrink-0 rounded-full bg-white/10 px-2 py-0.5 text-[10px] font-medium uppercase tracking-wide text-white/60",children:"Quiz"})]}),a.jsx("div",{className:"mt-2.5 space-y-1.5",children:e.options.map((v,b)=>{const x=e.correctOptionIndex===b,w=e.myVote===b,k=h&&m>0?f[b]:0;return a.jsxs("button",{type:"button",disabled:!u||i,onClick:()=>p(()=>MZn(t,e.id,b),"Could not record your vote"),className:ee("relative w-full overflow-hidden rounded-md border px-3 py-1.5 text-left text-sm transition-colors",u?"border-white/15 hover:border-primary hover:bg-primary/10":"cursor-default",!u&&(x?"border-success/60":w?"border-primary/60":"border-white/10")),children:[h&&a.jsx("span",{className:ee("absolute inset-y-0 left-0",x?"bg-success/25":"bg-white/10"),style:{width:`${k}%`},"aria-hidden":!0}),a.jsxs("span",{className:"relative flex items-center justify-between gap-2",children:[a.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-white/90",children:[x&&a.jsx(Qn,{className:"h-3.5 w-3.5 shrink-0 text-success"}),a.jsx("span",{className:"truncate",children:v.text}),w&&a.jsx("span",{className:"shrink-0 text-xs text-primary",children:"· your vote"})]}),h&&a.jsxs("span",{className:"shrink-0 text-xs text-white/60",children:[v.votes??0," · ",k,"%"]})]})]},b)})}),a.jsxs("div",{className:"mt-2 flex flex-wrap items-center justify-between gap-2 text-xs text-white/50",children:[a.jsxs("span",{children:[h?`${m} vote${m===1?"":"s"}`:u?"Pick an answer":"",n&&e.isQuiz&&e.correctCount!==null&&` · ${e.correctCount} correct`,!n&&d&&e.isQuiz&&!e.answerRevealed&&" · answer not revealed yet"]}),g&&a.jsx("span",{className:ee("font-medium",g==="right"?"text-success":"text-red-400"),children:g==="right"?"You got it right!":"Not quite — see the correct answer"})]}),n&&a.jsx("div",{className:"mt-2.5 flex items-center justify-end gap-2 border-t border-white/10 pt-2.5",children:l?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"mr-auto text-xs text-white/70",children:"Remove for everyone?"}),a.jsx("button",{type:"button",onClick:()=>c(!1),className:"rounded-md px-2 py-1 text-xs text-white/70 hover:bg-white/10",children:"Keep"}),a.jsx("button",{type:"button",disabled:i,onClick:()=>p(()=>DZn(t,e.id),"Could not remove the poll"),className:"rounded-md bg-destructive px-2 py-1 text-xs font-medium text-white hover:bg-destructive/90 disabled:opacity-50",children:"Remove"})]}):a.jsxs(a.Fragment,{children:[e.isQuiz&&!e.answerRevealed&&a.jsxs("button",{type:"button",disabled:i,onClick:()=>p(()=>LZn(t,e.id),"Could not reveal the answer","revealed"),className:"flex items-center gap-1 rounded-md bg-white/10 px-2 py-1 text-xs font-medium text-white hover:bg-white/20 disabled:opacity-50",children:[a.jsx(Oc,{className:"h-3.5 w-3.5"})," Reveal answer"]}),e.answerRevealed&&a.jsx("span",{className:"mr-auto text-xs text-success",children:"Answer revealed"}),a.jsxs("button",{type:"button",onClick:()=>c(!0),className:"flex items-center gap-1 rounded-md px-2 py-1 text-xs text-red-400 hover:bg-red-500/10",children:[a.jsx(qn,{className:"h-3.5 w-3.5"})," Remove"]})]})})]})}const Zsr=y.lazy(()=>wn(()=>import("./emoji-picker-react.esm-DVESESqv.js"),[]));function $g({onPick:t}){const e=y.useMemo(()=>typeof document<"u"&&document.documentElement.classList.contains("dark")?"dark":"light",[]),n=r=>{r.stopPropagation()};return a.jsx("div",{onWheel:n,onTouchMove:n,className:"max-w-[calc(100vw-2rem)]",children:a.jsx(y.Suspense,{fallback:a.jsx("div",{className:"h-[400px] w-[300px] max-w-full"}),children:a.jsx(Zsr,{onEmojiClick:r=>t(r.emoji),theme:e,emojiStyle:"native",lazyLoadEmojis:!0,skinTonesDisabled:!0,autoFocusSearch:!1,width:300,height:400,previewConfig:{showPreview:!1}})})})}const Sze="https://api.klipy.com/v2",Jsr="toi1PlFX5igmVbp972ISzbd0DxCy6vd2odGdhjhS4vDXqhVUXpSxTIlZgrnIMJmM";function wCt(t){var e;return t.media_formats||((e=t.media)==null?void 0:e[0])}function Xsr(t){var n,r,s,i;const e=wCt(t);return((n=e==null?void 0:e.tinygif)==null?void 0:n.url)||((r=e==null?void 0:e.nanogif)==null?void 0:r.url)||((s=e==null?void 0:e.mediumgif)==null?void 0:s.url)||((i=e==null?void 0:e.gif)==null?void 0:i.url)||""}function eir(t){var n,r,s;const e=wCt(t);return((n=e==null?void 0:e.gif)==null?void 0:n.url)||((r=e==null?void 0:e.mediumgif)==null?void 0:r.url)||((s=e==null?void 0:e.tinygif)==null?void 0:s.url)||""}function CM({onPick:t}){const[e,n]=y.useState(""),[r,s]=y.useState([]),[i,o]=y.useState(!1);return y.useEffect(()=>{let l=!1;const c=setTimeout(async()=>{o(!0);try{const d=new URLSearchParams({key:Jsr,limit:"20"});let u;e.trim()?(d.set("q",e.trim()),u=`${Sze}/search?${d.toString()}`):u=`${Sze}/featured?${d.toString()}`;const m=await(await fetch(u)).json();if(l)return;const f=(m.results??[]).map(p=>({id:p.id,preview:Xsr(p),url:eir(p)})).filter(p=>p.url&&p.preview);s(f)}catch{l||s([])}finally{l||o(!1)}},350);return()=>{l=!0,clearTimeout(c)}},[e]),a.jsxs("div",{className:"w-[320px]",children:[a.jsxs("div",{className:"relative mb-2",children:[a.jsx(hs,{className:"absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{autoFocus:!0,value:e,onChange:l=>n(l.target.value),placeholder:"Search GIFs…",className:"h-8 w-full rounded-md border border-input bg-background pl-8 pr-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]}),a.jsx("div",{className:"max-h-[min(16rem,55vh)] overflow-y-auto overscroll-contain",onWheel:l=>l.stopPropagation(),onTouchMove:l=>l.stopPropagation(),children:i?a.jsx("p",{className:"py-8 text-center text-xs text-muted-foreground",children:"Loading GIFs…"}):r.length===0?a.jsx("p",{className:"py-8 text-center text-xs text-muted-foreground",children:"No GIFs found"}):a.jsx("div",{className:"grid grid-cols-2 gap-1",children:r.map(l=>a.jsx("button",{type:"button",onClick:()=>t(l.url),className:"overflow-hidden rounded hover:opacity-80",children:a.jsx("img",{src:l.preview,alt:"",loading:"lazy",className:"h-24 w-full bg-muted object-cover"})},l.id))})}),a.jsxs("p",{className:"mt-1 text-right text-[10px] text-muted-foreground",children:["Powered by"," ",a.jsx("a",{href:"https://klipy.com",target:"_blank",rel:"noreferrer noopener",className:"hover:underline",children:"KLIPY"})]})]})}const tir=/^(You:\s*)/i,nir=/^https?:\/\/\S+$/i;function rir(t){return t.split(/[?#]/,1)[0]}function e2(t){var o;const e=(t==null?void 0:t.trim())??"";if(!e)return"";const n=((o=e.match(tir))==null?void 0:o[1])??"",r=n?e.slice(n.length).trim():e;if(!nir.test(r))return e;const s=rir(r);return/\.gif$/i.test(s)||/media\d*\.tenor\.com/i.test(r)||/(?:static|media)\.klipy\.com/i.test(r)?`${n}GIF`:/\.(?:png|jpe?g|webp|avif|bmp)$/i.test(s)?`${n}Photo`:e}function eD(t,e){return!!(t!=null&&t.customParticipantId&&e.includes(t.customParticipantId))}function kCt(t){var e;return(((e=t.targetUserIds)==null?void 0:e.length)??0)>0}function Txe(t,e,n){return e||t==="everyone"?!0:t==="host"?n:!1}function sir(t,e){return t.userId!==e.userId?t.userId:(t.targetUserIds??[]).find(n=>n!==e.userId&&n!==e.id)??null}function Cze(t,e){if(e)return t.find(n=>n.userId===e||n.id===e)}const iir=t=>{const e=t.time instanceof Date?t.time.getTime():new Date(t.time??0).getTime();return Number.isFinite(e)?e:0};function air(t,e,n,r,s,i=[]){const o=new Map;for(const l of t){if(l.type!=="text"||!kCt(l))continue;const c=sir(l,e);if(!c)continue;const d=Cze(n,c),u=l.userId===e.userId,h=eD(d??Cze(i,c),s);if(!(u?Txe(r,e.isHost,h):Txe(r,h,e.isHost)))continue;const f=(d==null?void 0:d.userId)??c;let p=o.get(f);p||(p={key:f,party:d,name:(d==null?void 0:d.name)??(u?"Participant":l.displayName??"Participant"),messages:[],lastAt:0},o.set(f,p)),!u&&l.displayName&&!d&&(p.name=l.displayName),p.messages.push(l),p.lastAt=Math.max(p.lastAt,iir(l))}return[...o.values()].sort((l,c)=>c.lastAt-l.lastAt)}function F_e(t){if(!t)return"";try{return new Date(t).toLocaleTimeString([],{hour:"numeric",minute:"2-digit"})}catch{return""}}function oir(t){const e=(t==null?void 0:t.trim())??"";if(!e)return null;const n=e2(e);return n==="GIF"||n==="Photo"?e:null}function SCt({value:t,onChange:e,onSubmit:n,placeholder:r,tools:s,disabled:i}){return a.jsxs("div",{className:"flex items-center gap-2 rounded-full bg-white/10 px-4 py-2",children:[a.jsx("input",{value:t,onChange:o=>e(o.target.value),onKeyDown:o=>o.key==="Enter"&&n(),placeholder:r,disabled:i,className:"min-w-0 flex-1 bg-transparent text-sm text-white placeholder:text-white/40 focus:outline-none disabled:opacity-50"}),s,a.jsx("button",{type:"button",onClick:n,disabled:i,className:"text-white/60 hover:text-white transition-colors disabled:opacity-40","aria-label":"Send",children:a.jsx(_s,{className:"h-4 w-4"})})]})}function jze({onSend:t,placeholder:e,disabled:n}){const[r,s]=y.useState(""),[i,o]=y.useState(null),l=()=>{const d=r.trim();!d||n||(t(d),s(""),o(null))},c=d=>ee("shrink-0 rounded-full p-0.5 transition-colors",d?"text-white":"text-white/60 hover:text-white");return a.jsxs("div",{className:"relative",children:[i&&!n&&a.jsx("div",{className:"absolute bottom-full left-0 right-0 z-30 mb-2 flex justify-center",children:a.jsx("div",{className:"max-w-full overflow-hidden rounded-lg border border-white/10 bg-popover p-2 text-popover-foreground shadow-xl",children:i==="emoji"?a.jsx($g,{onPick:d=>s(u=>u+d)}):a.jsx("div",{className:"w-[min(18rem,calc(100vw-3rem))] [&>div]:!w-full",children:a.jsx(CM,{onPick:d=>{t(d),o(null)}})})})}),a.jsx(SCt,{value:r,onChange:s,onSubmit:l,placeholder:e,disabled:n,tools:a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",disabled:n,onClick:()=>o(d=>d==="emoji"?null:"emoji"),className:c(i==="emoji"),"aria-label":"Add emoji","aria-expanded":i==="emoji",children:a.jsx(Hx,{className:"h-4 w-4"})}),a.jsx("button",{type:"button",disabled:n,onClick:()=>o(d=>d==="gif"?null:"gif"),className:c(i==="gif"),"aria-label":"Send a GIF","aria-expanded":i==="gif",children:a.jsx("span",{className:"rounded border border-current px-0.5 text-[9px] font-bold leading-none",children:"GIF"})})]})})]})}function Eze({msg:t,mine:e}){const n=oir(t.message);return a.jsxs("div",{className:"flex gap-2.5",children:[a.jsx("div",{className:"h-8 w-8 shrink-0 rounded-full bg-primary/20 flex items-center justify-center text-primary text-xs font-bold",children:(t.displayName??"?").slice(0,1).toUpperCase()}),a.jsxs("div",{className:"min-w-0",children:[a.jsxs("p",{className:"text-sm",children:[a.jsx("span",{className:"font-semibold text-white",children:e?"You":t.displayName})," ",a.jsx("span",{className:"text-white/40 text-xs",children:F_e(t.time)})]}),n?a.jsx("img",{src:n,alt:"",loading:"lazy",className:"mt-1 max-h-40 max-w-[200px] rounded-lg border border-white/10 object-contain"}):a.jsx("p",{className:"text-sm text-white/80 break-words",children:t.message})]})]})}const zde={everyone:"Everyone can DM",host:"DMs to hosts only",off:"DMs off"};function lir({canModerate:t,chatDisabled:e,onToggle:n,dmMode:r,onDmModeChange:s,hostParticipantIds:i,dmSeen:o,onDmSeen:l}){const{meeting:c}=Vc(),{toast:d}=yt(),[u,h]=y.useState(!1),[m,f]=y.useState("everyone"),[p,g]=y.useState(null),[v,b]=y.useState(!1),[x,w]=y.useState(""),k=e&&!t,S=Ns(le=>le.chat.messages),C=Ns(le=>le.participants.joined.toArray()),j=Ns(le=>{const q=le.self.permissions.chatPrivate;return!!(q!=null&&q.canSend&&(q!=null&&q.text))}),E=c.self,N=t||eD(E,i),A=y.useMemo(()=>C.filter(le=>le.id!==E.id),[C,E.id]),_=y.useRef(new Map),T=y.useMemo(()=>{for(const le of A)_.current.set(le.id,{...le});return[..._.current.values()]},[A]),R=S.filter(le=>le.type==="text"&&!kCt(le)),O=y.useMemo(()=>air(S,{id:E.id,userId:E.userId,isHost:N},A,r,i,T),[S,E.id,E.userId,N,A,r,i,T]),F=le=>{const q=O.find(X=>X.key===le),Y=q?q.messages.filter(X=>X.userId!==E.userId).length:0;return Math.max(0,Y-(o[le]??0))},D=O.some(le=>F(le.key)>0),I=O.find(le=>le.key===p),P=(I==null?void 0:I.party)??A.find(le=>le.userId===p),M=le=>!!le&&Txe(r,N,eD(le,i)),z=I?I.messages.filter(le=>le.userId!==E.userId).length:0;y.useEffect(()=>{m==="direct"&&p&&l(p,z)},[m,p,z,l]);const G=y.useRef(null),B=m==="everyone"?R.length:(I==null?void 0:I.messages.length)??0;y.useEffect(()=>{var le;(le=G.current)==null||le.scrollIntoView({behavior:"smooth"})},[B,m,p]);const H=(le,q)=>d({title:q,description:Dt(le,"Please try again."),variant:"destructive"}),W=le=>{k||c.chat.sendTextMessage(le).catch(q=>H(q,"Message not sent"))},V=le=>{!P||!M(P)||c.chat.sendTextMessage(le,[P.id]).catch(q=>H(q,"Direct message not sent"))},U=async()=>{h(!0);try{await n(!e)}catch(le){d({title:e?"Could not turn chat on":"Could not turn chat off",description:Dt(le,"Please try again."),variant:"destructive"})}finally{h(!1)}},ne=async le=>{h(!0);try{await s(le),d({title:zde[le]})}catch(q){d({title:"Could not change direct messages",description:Dt(q,"Please try again."),variant:"destructive"})}finally{h(!1)}},te=50,re=A.filter(le=>M(le)).filter(le=>!x.trim()||le.name.toLowerCase().includes(x.trim().toLowerCase())),fe=j?N?r==="everyone"?null:r==="host"?"Attendees can message hosts only. You can message anyone.":"Direct messages are off for attendees. You can still message anyone.":r==="host"?"The host allows direct messages to hosts only.":r==="off"?"The host has turned direct messages off.":null:"Direct messages aren't available in this meeting.";return a.jsxs(a.Fragment,{children:[t&&a.jsxs("div",{className:"flex flex-wrap items-center justify-end gap-2 border-b border-white/10 px-3 py-2",children:[a.jsxs("label",{className:"flex items-center gap-1 text-xs text-white/60",title:"Who attendees can send direct messages to. Hosts can always message anyone.",children:[a.jsx("span",{className:"sr-only",children:"Direct messages"}),a.jsx("select",{value:r,disabled:u,onChange:le=>void ne(le.target.value),className:"rounded-full border-0 bg-white/10 px-2.5 py-1 text-xs font-medium text-white/80 focus:outline-none focus:ring-1 focus:ring-primary disabled:opacity-60",children:Object.keys(zde).map(le=>a.jsx("option",{value:le,className:"bg-[hsl(230,20%,15%)] text-white",children:zde[le]},le))})]}),a.jsxs("button",{type:"button",disabled:u,onClick:()=>void U(),className:ee("flex items-center gap-1 rounded-full px-3 py-1 text-xs font-medium disabled:opacity-60",e?"bg-white/90 text-slate-900 hover:bg-white":"bg-white/10 text-white/70 hover:bg-white/20"),children:[e?a.jsx(Frt,{className:"h-3.5 w-3.5"}):a.jsx(wa,{className:"h-3.5 w-3.5"}),e?"Turn chat on":"Turn chat off"]})]}),a.jsx("div",{className:"flex gap-1 border-b border-white/10 px-3 py-2",role:"tablist","aria-label":"Chat",children:["everyone","direct"].map(le=>a.jsxs("button",{type:"button",role:"tab","aria-selected":m===le,onClick:()=>{f(le),le==="everyone"&&g(null)},className:ee("relative flex-1 rounded-full px-3 py-1 text-xs font-medium transition-colors",m===le?"bg-white/15 text-white":"text-white/50 hover:text-white/80"),children:[le==="everyone"?"Everyone":"Direct",le==="direct"&&D&&a.jsx("span",{className:"absolute right-2 top-1 h-1.5 w-1.5 rounded-full bg-primary",children:a.jsx("span",{className:"sr-only",children:"(new messages)"})})]},le))}),m==="everyone"&&a.jsxs(a.Fragment,{children:[e&&a.jsxs("p",{role:"status",className:"flex items-center justify-center gap-1.5 bg-amber-500/10 px-4 py-1.5 text-xs text-amber-300",children:[a.jsx(wa,{className:"h-3 w-3"}),t?"Chat is off for attendees. You can still post.":"Chat is turned off by the host."]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-5",children:[R.length===0&&a.jsx("p",{className:"text-sm text-white/40 text-center pt-8",children:"No messages yet — say hello!"}),R.map(le=>a.jsx(Eze,{msg:le,mine:le.userId===E.userId},le.id)),a.jsx("div",{ref:G})]}),!k&&a.jsx("div",{className:"p-3 border-t border-white/10",children:a.jsx(jze,{onSend:W,placeholder:"Contribute to the discussion!"})})]}),m==="direct"&&a.jsxs(a.Fragment,{children:[fe&&a.jsxs("p",{role:"status",className:"flex items-center justify-center gap-1.5 bg-amber-500/10 px-4 py-1.5 text-center text-xs text-amber-300",children:[a.jsx(wa,{className:"h-3 w-3 shrink-0"}),fe]}),p?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 border-b border-white/10 px-3 py-2",children:[a.jsx("button",{type:"button",onClick:()=>g(null),className:"rounded-full p-1 text-white/60 hover:bg-white/10 hover:text-white","aria-label":"Back to direct messages",children:a.jsx(no,{className:"h-4 w-4"})}),a.jsx("span",{className:"min-w-0 truncate text-sm font-medium text-white",children:(I==null?void 0:I.name)??(P==null?void 0:P.name)}),eD(P,i)&&a.jsx("span",{className:"shrink-0 rounded-full bg-primary/20 px-1.5 py-0.5 text-[10px] font-semibold text-primary",children:"Host"})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-5",children:[((I==null?void 0:I.messages.length)??0)===0&&a.jsx("p",{className:"text-sm text-white/40 text-center pt-8",children:"Only the two of you can see these messages."}),I==null?void 0:I.messages.map(le=>a.jsx(Eze,{msg:le,mine:le.userId===E.userId},le.id)),a.jsx("div",{ref:G})]}),a.jsx("div",{className:"p-3 border-t border-white/10",children:P?!j||!M(P)?a.jsx("p",{className:"text-center text-xs text-white/40",children:"You can't reply here under the host's direct message setting."}):a.jsx(jze,{onSend:V,placeholder:`Message ${P.name}`}):a.jsxs("p",{className:"text-center text-xs text-white/40",children:[(I==null?void 0:I.name)??"They"," left the meeting."]})})]}):v?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2 border-b border-white/10 px-3 py-2",children:[a.jsx("button",{type:"button",onClick:()=>{b(!1),w("")},className:"rounded-full p-1 text-white/60 hover:bg-white/10 hover:text-white","aria-label":"Back to direct messages",children:a.jsx(no,{className:"h-4 w-4"})}),a.jsxs("div",{className:"flex flex-1 items-center gap-2 rounded-full bg-white/10 px-3 py-1",children:[a.jsx(hs,{className:"h-3.5 w-3.5 text-white/40"}),a.jsx("input",{autoFocus:!0,value:x,onChange:le=>w(le.target.value),placeholder:"Search people in this meeting",className:"min-w-0 flex-1 bg-transparent text-xs text-white placeholder:text-white/40 focus:outline-none"})]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-2",children:[re.length===0&&a.jsx("p",{className:"px-2 pt-8 text-center text-sm text-white/40",children:x.trim()?"No one matches that name.":"There's no one you can message right now."}),re.slice(0,te).map(le=>a.jsxs("button",{type:"button",onClick:()=>{g(le.userId),b(!1),w("")},className:"flex w-full items-center gap-2.5 rounded-lg px-2 py-2 text-left hover:bg-white/10",children:[a.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary/20 text-xs font-bold text-primary",children:le.name.slice(0,1).toUpperCase()}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-white",children:le.name}),eD(le,i)&&a.jsx("span",{className:"shrink-0 rounded-full bg-primary/20 px-1.5 py-0.5 text-[10px] font-semibold text-primary",children:"Host"})]},le.id)),re.length>te&&a.jsxs("p",{className:"px-2 py-2 text-center text-xs text-white/40",children:["Showing ",te," of ",re.length,". Search to find someone else."]})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex-1 overflow-y-auto p-2",children:[O.length===0&&a.jsxs("div",{className:"px-4 pt-8 text-center",children:[a.jsx(wr,{className:"mx-auto h-6 w-6 text-white/30"}),a.jsx("p",{className:"mt-2 text-sm text-white/50",children:"No direct messages yet."}),a.jsx("p",{className:"mt-1 text-xs text-white/35",children:"Message someone in this meeting privately. Only the two of you see it."})]}),O.map(le=>{const q=le.messages[le.messages.length-1],Y=F(le.key);return a.jsxs("button",{type:"button",onClick:()=>g(le.key),className:"flex w-full items-center gap-2.5 rounded-lg px-2 py-2 text-left hover:bg-white/10",children:[a.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary/20 text-xs font-bold text-primary",children:le.name.slice(0,1).toUpperCase()}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"truncate text-sm font-medium text-white",children:le.name}),!le.party&&a.jsx("span",{className:"shrink-0 text-[10px] text-white/40",children:"left"})]}),a.jsxs("span",{className:ee("block truncate text-xs",Y?"font-medium text-white":"text-white/50"),children:[(q==null?void 0:q.userId)===E.userId?"You: ":"",e2(q==null?void 0:q.message)]})]}),Y>0&&a.jsx("span",{className:"flex h-5 min-w-[1.25rem] shrink-0 items-center justify-center rounded-full bg-primary px-1.5 text-[10px] font-semibold text-white",children:Y>99?"99+":Y})]},le.key)})]}),j&&(N||r!=="off")&&a.jsx("div",{className:"p-3 border-t border-white/10",children:a.jsxs("button",{type:"button",onClick:()=>b(!0),className:"flex w-full items-center justify-center gap-1.5 rounded-full bg-primary px-4 py-2 text-sm font-medium text-white hover:bg-primary/90",children:[a.jsx(pSe,{className:"h-4 w-4"}),"New direct message"]})})]})]})]})}const cir={audio:[],video:[],speaker:[]};function B_e(t=!0){const{meeting:e}=Vc(),[n,r]=y.useState(cir),[s,i]=y.useState({}),o=y.useCallback(()=>{var d,u,h;try{const m=e.self.getCurrentDevices();i({audio:(d=m.audio)==null?void 0:d.deviceId,video:(u=m.video)==null?void 0:u.deviceId,speaker:(h=m.speaker)==null?void 0:h.deviceId})}catch{}},[e]),l=y.useCallback(async()=>{try{const[d,u,h]=await Promise.all([e.self.getAudioDevices(),e.self.getVideoDevices(),e.self.getSpeakerDevices()]);r({audio:d,video:u,speaker:h})}catch{}o()},[e,o]);return y.useEffect(()=>{if(!t)return;l();const d=()=>void l();return e.self.on("deviceListUpdate",d),e.self.on("deviceUpdate",d),()=>{e.self.off("deviceListUpdate",d),e.self.off("deviceUpdate",d)}},[t,e,l]),{devices:n,current:s,refresh:l,setDevice:async(d,u)=>{const h=n[d].find(m=>m.deviceId===u);if(!h)return!1;try{return await e.self.setDevice(h),o(),!0}catch{return!1}}}}function dir(t,e){const[n,r]=y.useState(0);return y.useEffect(()=>{const s=typeof window<"u"?window.AudioContext:void 0;if(!e||!t||!s){r(0);return}let i,o;try{i=new s,o=i.createMediaStreamSource(new MediaStream([t]))}catch{return}const l=i.createAnalyser();l.fftSize=512,o.connect(l);const c=new Uint8Array(l.fftSize);let d=0;const u=()=>{l.getByteTimeDomainData(c);let h=0;for(const m of c){const f=(m-128)/128;h+=f*f}r(Math.round(Math.min(1,Math.sqrt(h/c.length)*4)*20)/20),d=requestAnimationFrame(u)};return u(),()=>{cancelAnimationFrame(d),o.disconnect(),i.close()}},[t,e]),n}async function uir(t){const e=new AudioContext,n=e.createMediaStreamDestination();[[660,0],[880,.25]].forEach(([s,i])=>{const o=e.createOscillator(),l=e.createGain();o.frequency.value=s;const c=e.currentTime+i;l.gain.setValueAtTime(1e-4,c),l.gain.exponentialRampToValueAtTime(.3,c+.02),l.gain.exponentialRampToValueAtTime(1e-4,c+.22),o.connect(l).connect(n),o.start(c),o.stop(c+.24)});const r=new Audio;r.srcObject=n.stream;try{t&&r.setSinkId&&await r.setSinkId(t),await r.play(),await new Promise(s=>setTimeout(s,700))}finally{r.pause(),e.close()}}function Vde({icon:t,label:e,devices:n,value:r,onChange:s,trailing:i,children:o}){const l=y.useId();return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{htmlFor:n.length?l:void 0,className:"block text-xs font-medium text-white/50",children:e}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2 rounded-xl border border-white/10 bg-white/5 px-3 py-2.5 focus-within:border-primary/60",children:[a.jsx("span",{className:"shrink-0 text-white/60 [&>svg]:h-4 [&>svg]:w-4",children:t}),n.length?a.jsxs("select",{id:l,value:r??"",onChange:c=>s(c.target.value),className:"min-w-0 flex-1 truncate bg-transparent text-sm text-white focus:outline-none [&>option]:bg-[hsl(230,20%,15%)]",children:[!r&&a.jsxs("option",{value:"",children:["Choose a ",e.toLowerCase()]}),n.map((c,d)=>a.jsx("option",{value:c.deviceId,children:c.label||`${e} ${d+1}`},c.deviceId||d))]}):a.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-white",children:"Default system device"})]}),i]}),o]})}function CCt({open:t,onClose:e,canUseCamera:n,canUseMic:r}){const{meeting:s}=Vc(),{toast:i}=yt(),o=Ns(w=>w.self.audioEnabled),l=Ns(w=>w.self.videoEnabled),c=Ns(w=>w.self.audioTrack),{devices:d,current:u,setDevice:h}=B_e(t),m=dir(c,t&&r&&o),[f,p]=y.useState(!1);if(y.useEffect(()=>{if(!t)return;const w=k=>k.key==="Escape"&&e();return window.addEventListener("keydown",w),()=>window.removeEventListener("keydown",w)},[t,e]),!t)return null;const g=async(w,k,S)=>{await h(w,k)||i({title:`Couldn't switch ${S}`,description:"It may be in use by another app. Try another one.",variant:"destructive"})},v=async()=>{p(!0);try{await uir(u.speaker)}catch{i({title:"Couldn't play the test sound",description:"Check that your speaker is connected and turned up.",variant:"destructive"})}finally{p(!1)}},b=20,x=Math.round(m*b);return a.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-3 sm:p-4",onClick:e,children:a.jsxs("div",{role:"dialog","aria-modal":"true","aria-labelledby":"device-settings-title",onClick:w=>w.stopPropagation(),className:"flex max-h-[calc(100dvh-1.5rem)] w-full max-w-3xl flex-col overflow-hidden rounded-2xl border border-white/10 bg-[hsl(230,20%,15%)] shadow-2xl",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3 border-b border-white/10 px-5 py-4",children:[a.jsx("h2",{id:"device-settings-title",className:"text-base font-semibold text-white",children:"Device settings"}),a.jsx("button",{type:"button",autoFocus:!0,onClick:e,className:"rounded-full p-1.5 text-white/60 transition-colors hover:bg-white/10 hover:text-white","aria-label":"Close device settings",children:a.jsx(nn,{className:"h-5 w-5"})})]}),a.jsxs("div",{className:"grid gap-5 overflow-y-auto p-5 md:grid-cols-[minmax(0,3fr)_minmax(0,2fr)]",children:[n&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"aspect-video w-full overflow-hidden rounded-xl border border-white/10 bg-black",children:a.jsx(by,{meeting:s,participant:s.self,className:"h-full w-full",children:a.jsx(xM,{participant:s.self,size:"md"})})}),!l&&a.jsx("p",{className:"text-xs text-white/50",children:"Your camera is off. Turn it on from the bar below to see yourself here."})]}),a.jsxs("div",{className:ee("space-y-4",!n&&"md:col-span-2"),children:[n&&a.jsx(Vde,{icon:a.jsx(Ca,{}),label:"Camera",devices:d.video,value:u.video,onChange:w=>void g("video",w,"camera")}),r&&a.jsx(Vde,{icon:a.jsx(Vx,{}),label:"Microphone",devices:d.audio,value:u.audio,onChange:w=>void g("audio",w,"microphone"),children:o?a.jsx("div",{className:"flex gap-0.5 px-1 pt-1",role:"meter","aria-label":"Microphone level","aria-valuemin":0,"aria-valuemax":b,"aria-valuenow":x,children:Array.from({length:b},(w,k)=>a.jsx("span",{className:ee("h-2 flex-1 rounded-full transition-colors",k<x?"bg-emerald-400":"bg-white/15")},k))}):a.jsx("p",{className:"px-1 pt-1 text-xs text-white/50",children:"You're muted. Unmute to check your microphone level."})}),a.jsx(Vde,{icon:a.jsx(NSe,{}),label:"Speaker",devices:d.speaker,value:u.speaker,onChange:w=>void g("speaker",w,"speaker"),trailing:a.jsxs("button",{type:"button",disabled:f,onClick:()=>void v(),className:"flex shrink-0 items-center gap-1.5 rounded-full border border-white/15 px-4 py-2 text-sm font-medium text-white transition-colors hover:bg-white/10 disabled:opacity-60","aria-label":"Play a test sound",children:[f&&a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"}),f?"Playing…":"Test"]}),children:d.speaker.length===0&&a.jsx("p",{className:"px-1 pt-1 text-xs text-white/50",children:"This browser plays meeting sound through your computer's default speaker. Change it in your system's sound settings."})})]})]})]})})}const hir=["Chat","Q&A","Poll","Docs"],mir=["🔥","❤️","👏","😂","🎉","⚽"],NV=9;function jCt({guestEntry:t}={}){var w,k,S,C,j,E,N;const{meetingId:e}=So(),n=(t==null?void 0:t.joinData.meetingId)||e,r=Nn(),s=Di(),{user:i}=jr(),[o,l]=qgt(),[c,d]=y.useState(null),[u,h]=y.useState(null),m=y.useRef(!1),f=(w=s.state)==null?void 0:w.returnTo,p=typeof f=="string"&&f.startsWith("/")&&!f.startsWith("//")?f:ve.dashboard,g=()=>r(p,{replace:!0}),v=!!t||!i,b=lt({queryKey:["meeting-join",n,u,t==null?void 0:t.inviteToken],queryFn:()=>t?But(t.inviteToken):kZn(n,v?u??void 0:void 0),initialData:t==null?void 0:t.joinData,enabled:!!n&&(!!t||!v||!!u),staleTime:1/0,gcTime:0,refetchOnWindowFocus:!1,retry:(A,_)=>!(_ instanceof ze&&_.status===403)&&A<1});y.useEffect(()=>{var T;const A=(T=b.data)==null?void 0:T.authToken;if(!A)return;let _=!1;return l({authToken:A,defaults:{audio:!1,video:!1}}).catch(R=>{if(_)return;const O=R;if((O==null?void 0:O.code)==="0001"&&fir(n)){window.location.reload();return}console.error("[meeting] init failed",R),d(dn(R,"We couldn't connect you to the meeting. Please try again."))}),()=>{_=!0}},[(k=b.data)==null?void 0:k.authToken,l,n]),y.useEffect(()=>{let A=null;return o&&"wakeLock"in navigator&&navigator.wakeLock.request("screen").then(_=>{A=_}).catch(()=>{}),()=>{A==null||A.release().catch(()=>{})}},[o]);const x=()=>{if(!m.current){m.current=!0;try{const A=o==null?void 0:o.leave();A&&typeof A.catch=="function"&&A.catch(()=>{})}catch{}t?t.onLeave():g()}};return b.isError||c?a.jsx(Air,{text:c??Dt(b.error,"This meeting is no longer live."),onClose:()=>t?t.onLeave():g()}):v&&!t&&!u?a.jsx(_ir,{onSubmit:h,onCancel:g}):((S=b.data)==null?void 0:S.mode)==="hls"?a.jsx(Hsr,{joinData:b.data,onLeave:g,onRefetch:()=>void b.refetch()}):o?a.jsx(Wgt,{value:o,children:a.jsx(pir,{title:((C=b.data)==null?void 0:C.communityName)??"Live session",meetingId:n,endingKey:((j=b.data)==null?void 0:j.endingKey)||null,initialRecording:!!((E=b.data)!=null&&E.isBeingRecorded),guestInviteContext:(N=b.data)==null?void 0:N.guestInviteContext,guestMode:!!t,onLeave:x})}):a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-[hsl(230,25%,12%)]",children:a.jsxs("div",{className:"flex items-center gap-3 text-white/70",children:[a.jsx(Ne,{className:"h-5 w-5 animate-spin"})," Joining meeting…"]})})}function fir(t){const e=`rtk-init-reloads:${t??""}`;try{const n=Date.now(),r=JSON.parse(sessionStorage.getItem(e)||"[]").filter(s=>n-s<6e4);return r.length>=2?!1:(sessionStorage.setItem(e,JSON.stringify([...r,n])),!0)}catch{return!1}}function pir(t){const e=Ns(s=>s.self.roomJoined),[n,r]=y.useState(!1);return y.useEffect(()=>{e&&r(!0)},[e]),!e&&!n?a.jsx(gir,{title:t.title,onCancel:t.onLeave}):a.jsx(vir,{...t})}function gir({title:t,onCancel:e}){const{meeting:n}=Vc(),r=Ns(p=>p.self.audioEnabled),s=Ns(p=>p.self.videoEnabled),[i,o]=y.useState(!1),[l,c]=y.useState(null),{devices:d,current:u,refresh:h,setDevice:m}=B_e();y.useEffect(()=>{h()},[r,s,h]);const f=async()=>{o(!0),c(null);try{await n.join()}catch(p){c((p==null?void 0:p.message)??"Could not join — please retry."),o(!1)}};return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-[hsl(230,25%,12%)] p-4",children:a.jsxs("div",{className:"w-full max-w-md space-y-5",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-white text-lg font-semibold",children:t}),a.jsx("p",{className:"text-white/50 text-sm mt-1",children:"Check your camera and mic before joining."})]}),a.jsx("div",{className:"aspect-video w-full rounded-xl overflow-hidden bg-[hsl(230,20%,16%)] border border-white/10",children:a.jsx(by,{meeting:n,participant:n.self,className:"h-full w-full",children:a.jsx(xM,{participant:n.self,size:"md"})})}),a.jsxs("div",{className:"flex items-center justify-center gap-3",children:[a.jsx(yZ,{active:s,onClick:()=>s?n.self.disableVideo():n.self.enableVideo(),onIcon:a.jsx(Ca,{className:"h-5 w-5"}),offIcon:a.jsx(S2,{className:"h-5 w-5"}),label:"Toggle camera"}),a.jsx(yZ,{active:r,onClick:()=>r?n.self.disableAudio():n.self.enableAudio(),onIcon:a.jsx(Vx,{className:"h-5 w-5"}),offIcon:a.jsx(yk,{className:"h-5 w-5"}),label:"Toggle microphone"})]}),(d.audio.length>0||d.video.length>0)&&a.jsxs("div",{className:"grid grid-cols-1 gap-2",children:[a.jsx(Hde,{label:"Microphone",devices:d.audio,value:u.audio,onSelect:p=>void m("audio",p)}),a.jsx(Hde,{label:"Camera",devices:d.video,value:u.video,onSelect:p=>void m("video",p)}),a.jsx(Hde,{label:"Speaker",devices:d.speaker,value:u.speaker,onSelect:p=>void m("speaker",p)})]}),l&&a.jsx("p",{className:"text-sm text-red-400 text-center",children:l}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button",onClick:e,className:"rounded-full bg-white/10 hover:bg-white/20 px-5 py-2.5 text-sm text-white/80 transition-colors",children:"Cancel"}),a.jsxs("button",{type:"button",disabled:i,onClick:f,className:"flex flex-1 items-center justify-center gap-2 rounded-full bg-primary hover:bg-primary/90 px-5 py-2.5 text-sm font-medium text-white transition-colors disabled:opacity-60",children:[i&&a.jsx(Ne,{className:"h-4 w-4 animate-spin"}),i?"Joining…":"Join meeting"]})]})]})})}function Hde({label:t,devices:e,value:n,onSelect:r}){var s;return e.length===0?null:a.jsxs("label",{className:"flex items-center gap-2 rounded-lg bg-white/5 border border-white/10 px-3 py-2",children:[a.jsx("span",{className:"w-24 shrink-0 text-xs text-white/50",children:t}),a.jsx("select",{value:n??((s=e[0])==null?void 0:s.deviceId),onChange:i=>r(i.target.value),className:"min-w-0 flex-1 bg-transparent text-sm text-white/90 focus:outline-none [&>option]:bg-[hsl(230,20%,15%)]",children:e.map((i,o)=>a.jsx("option",{value:i.deviceId,children:i.label||`${t} ${o+1}`},i.deviceId||o))})]})}function vir({title:t,meetingId:e,endingKey:n,initialRecording:r,guestInviteContext:s,guestMode:i,onLeave:o}){const{meeting:l}=Vc(),{toast:c}=yt(),[d,u]=y.useState(!0),[h,m]=y.useState("Chat"),[f,p]=y.useState(!1),g=y.useCallback(()=>p(!1),[]),{chatUnread:v,docsUnread:b}=GZn(l.chat,d&&h==="Chat",d&&h==="Docs"),[x,w]=y.useState(!1),k=y.useRef(!1),[S,C]=y.useState(!1),j=y.useRef(!1),E=rn();k.current=d&&h==="Q&A",j.current=d&&h==="Poll",y.useEffect(()=>{k.current&&w(!1),j.current&&C(!1)},[d,h]),y.useEffect(()=>{const $e=({type:wt,payload:Ee})=>{if(wt==="poll:update"){E.invalidateQueries({queryKey:Qbe(e)}),((Ee==null?void 0:Ee.kind)==="new"||(Ee==null?void 0:Ee.kind)==="revealed")&&!j.current&&C(!0);return}wt==="qa:update"&&(E.invalidateQueries({queryKey:vZ(e)}),(Ee==null?void 0:Ee.kind)==="new"&&!k.current&&w(!0))};return l.participants.on("broadcastedMessage",$e),()=>{l.participants.off("broadcastedMessage",$e)}},[l,e,E]);const[N,A]=y.useState(r),[_,T]=y.useState("stage"),[R,O]=y.useState(0),[F,D]=y.useState([]),I=y.useRef(0),P=y.useRef(new Set),M=y.useRef(null),[z,G]=y.useState(!1);y.useEffect(()=>{const $e=()=>G(!!document.fullscreenElement);return document.addEventListener("fullscreenchange",$e),()=>document.removeEventListener("fullscreenchange",$e)},[]);const B=()=>{var $e,wt,Ee;document.fullscreenElement?(Ee=document.exitFullscreen)==null||Ee.call(document).catch(()=>{}):(wt=($e=M.current)==null?void 0:$e.requestFullscreen)==null||wt.call($e).catch(()=>{})},H=Ns($e=>$e.self.roomJoined),W=Ns($e=>$e.participants.joined.toArray()),V=Ns($e=>$e.self.audioEnabled),U=Ns($e=>$e.self.videoEnabled),ne=Ns($e=>$e.self.screenShareEnabled),te=Ns($e=>$e.participants.lastActiveSpeaker),re=String(Ns($e=>$e.self.permissions.canProduceAudio))==="ALLOWED",fe=String(Ns($e=>$e.self.permissions.canProduceVideo))==="ALLOWED",le=String(Ns($e=>{var wt;return((wt=$e.stage)==null?void 0:wt.status)??"ON_STAGE"})),q=le==="REQUESTED_TO_JOIN_STAGE"||le==="ACCEPTED_TO_JOIN_STAGE",Y=!re&&!fe||q;y.useEffect(()=>{const $e=wt=>{(wt==null?void 0:wt.state)!=="disconnected"&&((wt==null?void 0:wt.state)==="kicked"&&c({title:"You were removed from this meeting by the host.",variant:"destructive"}),o())};return l.self.on("roomLeft",$e),()=>{l.self.off("roomLeft",$e)}},[l]);const{user:X}=jr();pCt(e,(!!X||!!i)&&H,!!i),y.useEffect(()=>{const $e=Date.now();return lh("meeting-joined",{meetingId:e}),()=>{lh("meeting-left",{meetingId:e,durationSeconds:Math.round((Date.now()-$e)/1e3)})}},[e]);const Q=($e,wt,Ee)=>{if(Ee&&P.current.has(Ee))return;Ee&&P.current.add(Ee);const Ge=Ee??`legacy:${++I.current}`,Pt=8+Math.random()*74;D(vn=>[...vn.slice(-24),{key:Ge,reactionId:Ee,emoji:$e,name:wt,x:Pt}]),setTimeout(()=>{D(vn=>vn.filter(Hn=>Hn.key!==Ge)),Ee&&P.current.delete(Ee)},3500)};y.useEffect(()=>{const $e=({type:wt,payload:Ee})=>{wt!=="reaction"||!(Ee!=null&&Ee.emoji)||Q(String(Ee.emoji),String(Ee.name??""),Ee.reactionId?String(Ee.reactionId):void 0)};return l.participants.on("broadcastedMessage",$e),()=>{l.participants.off("broadcastedMessage",$e)}},[l]);const ie=$e=>{const wt=`${l.self.id}:${Date.now()}:${++I.current}`;Q($e,"You",wt),l.participants.broadcastMessage("reaction",{emoji:$e,name:l.self.name,reactionId:wt})},he=y.useMemo(()=>[l.self,...W],[l.self,W]),ye=he.find($e=>$e.screenShareEnabled),J=he.find($e=>$e.id===te)??W[0]??l.self,K=!!n,ce=W.filter($e=>$e.audioEnabled).length,pe=async()=>{try{return await l.participants.disableAllAudio(!0),c({title:"All participants muted",description:"They can unmute themselves when they want to speak."}),!0}catch{return c({title:"Could not mute participants",description:"Try again in a moment.",variant:"destructive"}),!1}},{chatDisabled:Ie,setChatDisabled:Me,dmMode:we,setDmMode:Be,hostParticipantIds:Ve}=KZn(l,e,K),be=Ie&&!K,[Ze,Pe]=y.useState({}),Ke=y.useCallback(($e,wt)=>Pe(Ee=>Ee[$e]===wt?Ee:{...Ee,[$e]:wt}),[]),De=$e=>{be||l.chat.sendTextMessage($e).catch(wt=>c({title:"Message not sent",description:Dt(wt,"Please try again."),variant:"destructive"}))},xt=Math.max(1,Math.ceil(he.length/NV)),Xe=Math.min(R,xt-1),tt=he.slice(Xe*NV,Xe*NV+NV);return a.jsxs("div",{ref:M,className:"fixed inset-0 z-50 bg-[hsl(230,25%,12%)] flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 px-3 py-3 border-b border-white/10 sm:px-5",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2 sm:gap-4",children:[a.jsx("button",{type:"button",onClick:()=>T($e=>$e==="grid"?"stage":"grid"),className:ee("rounded-md p-1 transition-colors",_==="grid"?"bg-primary/20 text-primary":"text-white/60 hover:text-white"),"aria-label":"Toggle grid view",title:"Grid view",children:a.jsx(ABt,{className:"h-5 w-5"})}),a.jsx("span",{className:"text-white/40",children:"|"}),a.jsx("span",{className:"text-white font-medium text-sm",children:t}),a.jsxs("div",{className:"flex items-center gap-1.5 text-white/50 text-sm",children:[a.jsx(wr,{className:"h-4 w-4"}),a.jsx("span",{children:W.length+1})]}),N&&a.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-destructive/20 px-2.5 py-0.5 text-xs font-medium text-red-400",children:[a.jsx(Ag,{className:"h-2 w-2 fill-current animate-pulse"})," REC"]}),!H&&a.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-white/40",children:[a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"})," connecting…"]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[s&&a.jsx(a2e,{className:"bg-white/10 border-white/20 text-white hover:bg-white/20 hover:text-white",communityId:s.communityId,eventId:s.eventId}),K&&a.jsx(xir,{}),K&&a.jsx(wir,{meetingId:e}),a.jsx("button",{type:"button",onClick:()=>p(!0),className:"rounded-full bg-white/10 hover:bg-white/20 p-1.5 text-white/70 hover:text-white transition-colors","aria-label":"Device settings",title:"Device settings",children:a.jsx(w2,{className:"h-4 w-4"})})]})]}),a.jsx(CCt,{open:f,onClose:g,canUseCamera:fe&&!q,canUseMic:re&&!q}),a.jsx(Vwt,{meeting:l}),a.jsxs("div",{className:"relative flex flex-1 min-h-0",children:[!d&&a.jsxs("button",{type:"button",onClick:()=>u(!0),className:"absolute right-0 top-1/2 z-20 -translate-y-1/2 flex items-center gap-1 rounded-l-lg border border-r-0 border-white/10 bg-[hsl(230,20%,15%)] py-3 pl-2 pr-1.5 text-white/70 hover:text-white hover:bg-white/10 transition-colors","aria-label":"Show panel",title:"Show chat & Q&A",children:[a.jsx(gBt,{className:"h-4 w-4"}),a.jsx(wd,{className:"h-4 w-4"}),(v||b)&&a.jsx("span",{className:"h-2 w-2 rounded-full bg-primary","aria-label":"New chat or documents"})]}),_==="stage"&&a.jsx("div",{className:"hidden sm:block w-36 shrink-0 p-3 space-y-3 overflow-y-auto",children:he.map($e=>a.jsx(Nze,{participant:$e,isSelf:$e.id===l.self.id,isActiveSpeaker:$e.id===te,canModerate:K,meetingId:e,className:"aspect-square",avatarSize:"sm"},$e.id))}),a.jsxs("div",{className:"relative flex-1 flex flex-col items-center justify-center gap-4 p-4 min-w-0 min-h-0",children:[a.jsx(yir,{reactions:F}),a.jsx(Nir,{meetingId:e,canModerate:K}),_==="grid"?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"grid w-full flex-1 min-h-0 grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 auto-rows-fr gap-3",children:tt.map($e=>a.jsx(Nze,{participant:$e,isSelf:$e.id===l.self.id,isActiveSpeaker:$e.id===te,canModerate:K,meetingId:e,avatarSize:"md"},$e.id))}),xt>1&&a.jsxs("div",{className:"flex items-center gap-2 text-xs text-white/50",children:[a.jsx("button",{type:"button",disabled:Xe===0,onClick:()=>O($e=>Math.max(0,$e-1)),className:"rounded-md border border-white/10 p-1 hover:bg-white/10 disabled:opacity-40","aria-label":"Previous participants",children:a.jsx(nl,{className:"h-3.5 w-3.5"})}),a.jsxs("span",{children:[Xe+1," / ",xt]}),a.jsx("button",{type:"button",disabled:Xe>=xt-1,onClick:()=>O($e=>Math.min(xt-1,$e+1)),className:"rounded-md border border-white/10 p-1 hover:bg-white/10 disabled:opacity-40","aria-label":"Next participants",children:a.jsx(io,{className:"h-3.5 w-3.5"})})]})]}):a.jsxs("div",{className:ee("w-full rounded-xl overflow-hidden bg-[hsl(230,20%,16%)] border border-white/10 relative transition-all duration-300",d?"max-w-5xl aspect-video":"flex-1 min-h-0"),children:[ye?a.jsx(Hwt,{meeting:l,participant:ye,className:"h-full w-full"}):a.jsxs(by,{meeting:l,participant:J,className:"h-full w-full",children:[a.jsx(xM,{participant:J,size:"lg"}),a.jsx($re,{participant:J,meeting:l})]}),a.jsx("button",{type:"button",onClick:B,className:"absolute bottom-3 right-3 z-20 flex h-10 w-10 items-center justify-center rounded-full bg-black/40 text-white/80 backdrop-blur hover:bg-black/60 hover:text-white transition-colors","aria-label":z?"Exit fullscreen":"Enter fullscreen",title:z?"Exit fullscreen":"Fullscreen",children:z?a.jsx(Grt,{className:"h-5 w-5"}):a.jsx(Urt,{className:"h-5 w-5"})})]}),a.jsxs("div",{className:"relative flex flex-wrap items-center justify-center gap-2",children:[fe&&!q&&a.jsx(yZ,{active:U,onClick:()=>U?l.self.disableVideo():l.self.enableVideo(),onIcon:a.jsx(Ca,{className:"h-5 w-5"}),offIcon:a.jsx(S2,{className:"h-5 w-5"}),label:"Toggle camera"}),re&&!q&&a.jsx(yZ,{active:V,onClick:()=>V?l.self.disableAudio():l.self.enableAudio(),onIcon:a.jsx(Vx,{className:"h-5 w-5"}),offIcon:a.jsx(yk,{className:"h-5 w-5"}),label:"Toggle microphone"}),(re||fe)&&!q&&a.jsx("button",{type:"button",onClick:()=>ne?l.self.disableScreenShare():l.self.enableScreenShare(),className:ee("h-11 w-11 rounded-full flex items-center justify-center transition-colors",ne?"bg-primary text-white":"bg-white/10 hover:bg-white/20 text-white/70 hover:text-white"),"aria-label":"Toggle screen share",children:ne?a.jsx(YBt,{className:"h-5 w-5"}):a.jsx(vSe,{className:"h-5 w-5"})}),Y&&a.jsx(bir,{stageStatus:le}),a.jsx(kir,{onReact:ie,onSendMessage:be?void 0:De}),a.jsxs("button",{type:"button",onClick:()=>u($e=>!$e),className:ee("relative h-11 w-11 rounded-full flex items-center justify-center transition-colors",d?"bg-primary text-white":"bg-white/10 hover:bg-white/20 text-white/70 hover:text-white"),"aria-label":"Toggle side panel",children:[a.jsx(wd,{className:"h-5 w-5"}),!d&&(v||b)&&a.jsx("span",{className:"absolute right-1 top-1 h-2 w-2 rounded-full bg-primary","aria-label":"New chat or documents"})]}),K&&a.jsx(Sir,{unmutedCount:ce,onMuteAll:pe}),K&&a.jsx(Cir,{meetingId:e,endingKey:n,isRecording:N,onRecordingChange:A,onEnded:o,onLeave:o}),a.jsx("button",{type:"button",onClick:o,className:"h-11 w-11 rounded-full flex items-center justify-center bg-destructive/90 hover:bg-destructive text-white transition-colors","aria-label":"Leave meeting",title:"Leave",children:a.jsx(aI,{className:"h-5 w-5"})})]})]}),d&&a.jsxs("div",{className:"w-full sm:w-80 sm:shrink-0 border-l border-white/10 flex flex-col bg-[hsl(230,20%,15%)]",children:[a.jsxs("div",{className:"flex items-center border-b border-white/10",children:[hir.map($e=>a.jsx("button",{type:"button",onClick:()=>m($e),className:ee("flex-1 py-3 text-sm font-medium transition-colors",h===$e?"text-white border-b-2 border-primary":"text-white/50 hover:text-white/70"),children:a.jsxs("span",{className:"relative",children:[$e,$e==="Chat"&&v&&a.jsx("span",{className:"absolute -right-2 -top-0.5 h-2 w-2 rounded-full bg-primary","aria-label":"New chat messages"}),$e==="Docs"&&b&&a.jsx("span",{className:"absolute -right-2 -top-0.5 h-2 w-2 rounded-full bg-primary","aria-label":"New documents"}),$e==="Q&A"&&x&&a.jsx("span",{className:"absolute -right-2 -top-0.5 h-2 w-2 rounded-full bg-primary","aria-label":"New questions"}),$e==="Poll"&&S&&a.jsx("span",{className:"absolute -right-2 -top-0.5 h-2 w-2 rounded-full bg-primary","aria-label":"New poll activity"})]})},$e)),a.jsx("button",{type:"button",onClick:()=>u(!1),className:"px-2.5 py-3 text-white/40 hover:text-white transition-colors","aria-label":"Hide panel",title:"Hide panel",children:a.jsx(vBt,{className:"h-4 w-4"})})]}),h==="Chat"&&a.jsx(lir,{canModerate:K,chatDisabled:Ie,onToggle:Me,dmMode:we,onDmModeChange:Be,hostParticipantIds:Ve,dmSeen:Ze,onDmSeen:Ke}),h==="Q&A"&&a.jsx(Eir,{meetingId:e,canModerate:K}),h==="Poll"&&a.jsx(jir,{meetingId:e,canModerate:K}),h==="Docs"&&a.jsx(Tir,{locked:be})]})]})]})}function Nze({participant:t,isSelf:e,isActiveSpeaker:n,canModerate:r,meetingId:s,className:i,avatarSize:o="md"}){const{meeting:l}=Vc(),{toast:c}=yt(),d=rn(),u=async()=>{try{await t.disableAudio(),c({title:`${t.name??"Participant"} muted`})}catch{c({title:"Could not mute participant",variant:"destructive"})}},h=async()=>{if(!t.kick)return;let m=!1;try{t.customParticipantId&&(await OZn(s,t.customParticipantId,t.name),m=!0,d.invalidateQueries({queryKey:_xe(s)}))}catch{}try{await t.kick(),c(m?{title:`${t.name??"Participant"} removed`,description:"They can't rejoin this meeting unless you allow them back in."}:{title:`${t.name??"Participant"} removed`,description:"They could not be blocked from rejoining.",variant:"destructive"})}catch{c({title:"Could not remove participant",variant:"destructive"})}};return a.jsxs("div",{className:ee("group relative rounded-lg border-2 overflow-hidden bg-[hsl(230,20%,18%)] min-h-0",n?"border-amber-400":"border-primary/50",i),children:[a.jsxs(by,{meeting:l,participant:t,className:"h-full w-full",children:[a.jsx(xM,{participant:t,size:o}),a.jsx($re,{participant:t,meeting:l,size:"sm"})]}),r&&!e&&a.jsx("div",{className:"absolute right-1 top-1 opacity-0 transition-opacity group-hover:opacity-100",children:a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx("button",{type:"button",className:"rounded-md bg-black/60 p-1 text-white/80 hover:text-white","aria-label":`Moderate ${t.name??"participant"}`,children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",className:"w-44",children:[a.jsxs(ot,{onClick:u,children:[a.jsx(yk,{className:"mr-2 h-4 w-4"})," Mute mic"]}),a.jsx(mi,{}),a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:h,children:[a.jsx(F8,{className:"mr-2 h-4 w-4"})," Remove from meeting"]})]})]})})]})}function yir({reactions:t}){return a.jsx("div",{className:"pointer-events-none absolute inset-0 z-10 overflow-hidden",children:a.jsx(Al,{children:t.map(e=>a.jsxs(it.div,{initial:{opacity:0,y:0,scale:.6},animate:{opacity:1,y:-160,scale:1},exit:{opacity:0},transition:{duration:3,ease:"easeOut"},className:"absolute bottom-16 flex flex-col items-center",style:{left:`${e.x}%`},children:[a.jsx("span",{className:"text-3xl drop-shadow",children:e.emoji}),e.name&&a.jsx("span",{className:"mt-0.5 rounded-full bg-black/50 px-1.5 text-[10px] text-white/80",children:e.name})]},e.key))})})}function bir({stageStatus:t}){const{meeting:e}=Vc(),{toast:n}=yt(),r=async()=>{try{t==="REQUESTED_TO_JOIN_STAGE"?(await e.stage.cancelRequestAccess(),n({title:"Request withdrawn"})):t==="ACCEPTED_TO_JOIN_STAGE"?(await e.stage.join(),n({title:"You're on stage — mic and camera unlocked"})):(await e.stage.requestAccess(),n({title:"Hand raised",description:"The host has been asked to bring you on stage."}))}catch{n({title:"Stage request failed",variant:"destructive"})}},s=t==="REQUESTED_TO_JOIN_STAGE",i=t==="ACCEPTED_TO_JOIN_STAGE";return a.jsxs("button",{type:"button",onClick:r,className:ee("flex h-11 items-center gap-2 rounded-full px-4 text-sm font-medium transition-colors",i?"bg-success text-white":s?"bg-amber-500 text-white":"bg-white/10 hover:bg-white/20 text-white/70 hover:text-white"),"aria-label":"Raise hand",children:[a.jsx(Irt,{className:"h-4 w-4"}),i?"Join stage":s?"Hand raised":"Raise hand"]})}function xir(){const{meeting:t}=Vc(),{toast:e}=yt(),[n,r]=y.useState([]);y.useEffect(()=>{const i=()=>{try{const{stageRequests:l}=t.stage.getAccessRequests();r((l??[]).map(c=>({id:String(c.userId??c.id??""),name:c.displayName??c.name})).filter(c=>c.id))}catch{}};i();const o=setInterval(i,5e3);return()=>clearInterval(o)},[t]);const s=async(i,o)=>{try{o?await t.stage.grantAccess([i]):await t.stage.denyAccess([i]),r(l=>l.filter(c=>c.id!==i))}catch{e({title:"Could not update the stage request",variant:"destructive"})}};return n.length===0?null:a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-full bg-amber-500/20 px-3 py-1 text-xs font-medium text-amber-400 hover:bg-amber-500/30 transition-colors",children:[a.jsx(Irt,{className:"h-3.5 w-3.5"})," ",n.length," raised"]})}),a.jsx(Cr,{align:"end",className:"w-60",children:n.map(i=>a.jsxs("div",{className:"flex items-center justify-between gap-2 px-2 py-1.5",children:[a.jsx("span",{className:"truncate text-sm",children:i.name??"Member"}),a.jsxs("span",{className:"flex shrink-0 items-center gap-1",children:[a.jsx("button",{type:"button",onClick:()=>s(i.id,!0),className:"rounded-md bg-primary/15 px-2 py-0.5 text-xs font-medium text-primary hover:bg-primary/25",children:"Bring up"}),a.jsx("button",{type:"button",onClick:()=>s(i.id,!1),className:"rounded-md px-2 py-0.5 text-xs text-muted-foreground hover:bg-muted",children:"Deny"})]})]},i.id))})]})}const _xe=t=>["meeting-removed",t];function wir({meetingId:t}){const e=rn(),{toast:n}=yt(),{data:r=[]}=lt({queryKey:_xe(t),queryFn:()=>FZn(t),refetchInterval:6e4}),[s,i]=y.useState(null);if(r.length===0)return null;const o=async(l,c)=>{if(!s){i(l);try{await BZn(t,l),await e.invalidateQueries({queryKey:_xe(t)}),n({title:`${c} can rejoin`})}catch(d){n({title:"Could not allow them back in",description:Dt(d,"Please try again."),variant:"destructive"})}finally{i(null)}}};return a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsxs("button",{type:"button",className:"flex items-center gap-1.5 rounded-full bg-white/10 px-3 py-1.5 text-xs font-medium text-white/80 hover:bg-white/20",children:[a.jsx(F8,{className:"h-3.5 w-3.5"})," Removed (",r.length,")"]})}),a.jsx(Cr,{align:"end",className:"w-64",children:r.map(l=>a.jsxs("div",{className:"flex items-center justify-between gap-2 px-2 py-1.5 text-sm",children:[a.jsxs("span",{className:"min-w-0 truncate",children:[l.name,l.isGuest?" (guest)":""]}),a.jsx("button",{type:"button",disabled:s!==null,onClick:()=>void o(l.id,l.name),className:"shrink-0 rounded-md border border-border px-2 py-1 text-xs hover:bg-muted disabled:opacity-60",children:s===l.id?"Allowing…":"Allow back in"})]},l.id))})]})}function kir({onReact:t,onSendMessage:e}){const[n,r]=y.useState(!1),[s,i]=y.useState(""),o=()=>{const l=s.trim();!l||!e||(e(l),i(""),r(!1))};return a.jsxs("div",{className:"sm:relative",children:[n&&a.jsxs("div",{className:ee("absolute bottom-full left-1/2 z-20 mb-2 -translate-x-1/2 border border-white/10 bg-[hsl(230,20%,15%)] shadow-lg",e?"w-[min(19rem,calc(100vw-2rem))] rounded-2xl p-2":"rounded-full px-2 py-1.5"),children:[a.jsx("div",{className:"flex items-center justify-center gap-1",children:mir.map(l=>a.jsx("button",{type:"button",onClick:()=>{t(l),r(!1)},className:"rounded-full p-1 text-xl transition-transform hover:scale-125","aria-label":`React ${l}`,children:l},l))}),e&&a.jsxs("div",{className:"mt-2 flex items-center gap-2 rounded-full bg-white/10 px-3 py-1.5",children:[a.jsx("input",{value:s,onChange:l=>i(l.target.value),onKeyDown:l=>l.key==="Enter"&&o(),placeholder:"Type a message to everyone…","aria-label":"Message everyone",className:"min-w-0 flex-1 bg-transparent text-sm text-white placeholder:text-white/40 focus:outline-none"}),a.jsx("button",{type:"button",onClick:o,disabled:!s.trim(),className:"text-white/60 transition-colors hover:text-white disabled:opacity-40","aria-label":"Send to everyone",children:a.jsx(_s,{className:"h-4 w-4"})})]})]}),a.jsx("button",{type:"button",onClick:()=>r(l=>!l),className:ee("h-11 w-11 rounded-full flex items-center justify-center transition-colors",n?"bg-primary text-white":"bg-white/10 hover:bg-white/20 text-white/70 hover:text-white"),"aria-label":"Send a reaction",children:a.jsx(f9t,{className:"h-5 w-5"})})]})}function Sir({unmutedCount:t,onMuteAll:e}){const[n,r]=y.useState(!1),[s,i]=y.useState(!1),o=t===0,l=async()=>{i(!0);try{await e()}finally{i(!1),r(!1)}};return a.jsxs(a.Fragment,{children:[n&&a.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4",onKeyDown:c=>c.key==="Escape"&&!s&&r(!1),children:a.jsxs("div",{role:"alertdialog","aria-modal":"true","aria-labelledby":"mute-all-title","aria-describedby":"mute-all-description",className:"w-full max-w-md rounded-2xl border border-white/10 bg-[hsl(230,20%,15%)] p-5 shadow-2xl sm:p-6",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-white/10 text-white",children:a.jsx(yk,{className:"h-5 w-5","aria-hidden":!0})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{id:"mute-all-title",className:"text-base font-semibold text-white",children:"Mute everyone?"}),a.jsxs("p",{id:"mute-all-description",className:"mt-1.5 text-sm leading-relaxed text-white/60",children:[t===1?"The 1 person":`The ${t} people`," with their microphone on will be muted. They can unmute themselves when they want to speak."]})]})]}),a.jsxs("div",{className:"mt-5 flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",children:[a.jsx("button",{type:"button",autoFocus:!0,disabled:s,onClick:()=>r(!1),className:"rounded-full px-4 py-2.5 text-sm text-white/60 transition-colors hover:bg-white/5 hover:text-white disabled:opacity-60",children:"Cancel"}),a.jsxs("button",{type:"button",disabled:s,onClick:()=>void l(),className:"flex items-center justify-center gap-1.5 rounded-full bg-primary px-5 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-primary/90 disabled:opacity-60",children:[s&&a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"})," Mute everyone"]})]})]})}),a.jsxs("button",{type:"button",disabled:o||s,onClick:()=>r(!0),className:"relative h-11 w-11 rounded-full flex items-center justify-center bg-white/10 text-white/70 transition-colors hover:bg-white/20 hover:text-white disabled:opacity-40 disabled:hover:bg-white/10","aria-label":o?"Mute all participants (everyone is already muted)":`Mute all participants (${t} unmuted)`,title:o?"Everyone is already muted":"Mute all participants",children:[a.jsx(yk,{className:"h-5 w-5"}),!o&&a.jsx("span",{className:"absolute -right-0.5 -top-0.5 flex h-4 min-w-4 items-center justify-center rounded-full bg-primary px-1 text-[10px] font-semibold leading-none text-white","aria-hidden":!0,children:t>99?"99+":t})]})]})}function Cir({meetingId:t,endingKey:e,isRecording:n,onRecordingChange:r,onEnded:s,onLeave:i}){const{toast:o}=yt(),[l,c]=y.useState(!1),[d,u]=y.useState(!1),h=async()=>{c(!0);try{await SZn(t,e),r(!n),o({title:n?"Recording stopped":"Recording started"})}catch{o({title:"Could not toggle recording",variant:"destructive"})}finally{c(!1)}},m=async()=>{if(l)return;c(!0);let f=!1;try{await CZn(t,e),f=!0,o({title:"Meeting ended for everyone"})}catch{o({title:"Could not end the meeting",variant:"destructive"})}finally{c(!1),u(!1)}f&&s()};return a.jsxs(a.Fragment,{children:[d&&a.jsx("div",{className:"fixed inset-0 z-[60] flex items-center justify-center bg-black/60 p-4",onKeyDown:f=>f.key==="Escape"&&!l&&u(!1),children:a.jsxs("div",{role:"alertdialog","aria-modal":"true","aria-labelledby":"end-meeting-title","aria-describedby":"end-meeting-description",className:"w-full max-w-md rounded-2xl border border-white/10 bg-[hsl(230,20%,15%)] p-5 shadow-2xl sm:p-6",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-destructive/15 text-red-400",children:a.jsx(yO,{className:"h-5 w-5","aria-hidden":!0})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("h2",{id:"end-meeting-title",className:"text-base font-semibold text-white",children:"End this meeting for everyone?"}),a.jsx("p",{id:"end-meeting-description",className:"mt-1.5 text-sm leading-relaxed text-white/60",children:"Everyone in the meeting, including guests and viewers, will be disconnected right away and the session will close. This can't be undone."}),a.jsxs("p",{className:"mt-2 text-sm leading-relaxed text-white/60",children:["To step away and let the meeting carry on, choose ",a.jsx("span",{className:"font-medium text-white/80",children:"Leave meeting"})," instead."]})]})]}),a.jsxs("div",{className:"mt-5 flex flex-col gap-2",children:[a.jsxs("button",{type:"button",disabled:l,onClick:m,className:"flex w-full items-center justify-center gap-1.5 rounded-full bg-destructive px-4 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-destructive/90 disabled:opacity-60",children:[l&&a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"})," End for everyone"]}),a.jsx("button",{type:"button",disabled:l,onClick:()=>{u(!1),i()},className:"w-full rounded-full border border-white/15 px-4 py-2.5 text-sm font-medium text-white transition-colors hover:bg-white/10 disabled:opacity-60",children:"Leave meeting"}),a.jsx("button",{type:"button",autoFocus:!0,disabled:l,onClick:()=>u(!1),className:"w-full rounded-full px-4 py-2 text-sm text-white/60 transition-colors hover:bg-white/5 hover:text-white disabled:opacity-60",children:"Cancel"})]})]})}),a.jsx("button",{type:"button",disabled:l,onClick:()=>void h(),className:ee("h-11 w-11 rounded-full flex items-center justify-center transition-colors disabled:opacity-60",n?"bg-red-500/20 text-red-400 ring-1 ring-red-500/60 hover:bg-red-500/30":"bg-white/10 hover:bg-white/20 text-white/70 hover:text-white"),"aria-label":n?"Stop recording":"Start recording",title:n?"Stop recording":"Start recording",children:l?a.jsx(Ne,{className:"h-5 w-5 animate-spin"}):n?a.jsx(hee,{className:"h-4 w-4 fill-current animate-pulse"}):a.jsx(Ag,{className:"h-5 w-5 fill-red-500 text-red-500"})}),a.jsx("button",{type:"button",disabled:l,onClick:()=>u(!0),className:"h-11 w-11 rounded-full flex items-center justify-center bg-destructive/15 text-red-400 ring-1 ring-red-500/50 transition-colors hover:bg-destructive hover:text-white disabled:opacity-60","aria-label":"End meeting for everyone",title:"End meeting for everyone",children:a.jsx(yO,{className:"h-5 w-5"})})]})}function jir({meetingId:t,canModerate:e}){const{meeting:n}=Vc();return a.jsx(Ksr,{meetingId:t,canModerate:e,onChanged:r=>n.participants.broadcastMessage("poll:update",{at:Date.now(),kind:r})})}const vZ=t=>["meeting-qa",t];function Eir({meetingId:t,canModerate:e}){var A,_,T,R,O,F;const{meeting:n}=Vc(),r=rn(),{toast:s}=yt(),[i,o]=y.useState(""),[l,c]=y.useState(1),[d,u]=y.useState("top"),[h,m]=y.useState(!1),f=lt({queryKey:[...vZ(t),l,d],queryFn:()=>t_e(t,l,d),refetchInterval:3e4}),p=()=>r.invalidateQueries({queryKey:vZ(t)}),g=(D="change")=>n.participants.broadcastMessage("qa:update",{at:Date.now(),kind:D}),v=async(D,I,P="change")=>{try{return await D(),p(),g(P),!0}catch(M){return s({title:I,description:Dt(M,"Please try again."),variant:"destructive"}),!1}},b=async()=>{const D=i.trim();if(!D)return;o(""),await v(()=>_Zn(t,D,n.self.name),"Could not post the question","new")||o(D)},x=((A=f.data)==null?void 0:A.questions)??[],w=((_=f.data)==null?void 0:_.total)??0,k=((T=f.data)==null?void 0:T.limit)??50,S=!!((R=f.data)!=null&&R.closed),C=((F=(O=f.data)==null?void 0:O.spotlight)==null?void 0:F.id)??null,j=x.filter(D=>!D.isAnswered),E=x.filter(D=>D.isAnswered),N={meetingId:t,canModerate:e,closed:S,spotlightId:C,act:v};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 border-b border-white/10 px-4 py-2",children:[a.jsx("div",{className:"flex rounded-full bg-white/10 p-0.5 text-xs",role:"group","aria-label":"Sort questions",children:["top","new"].map(D=>a.jsx("button",{type:"button",onClick:()=>{u(D),c(1)},"aria-pressed":d===D,className:ee("rounded-full px-3 py-1 font-medium transition-colors",d===D?"bg-white/20 text-white":"text-white/50 hover:text-white/80"),children:D==="top"?"Top":"Newest"},D))}),e&&a.jsxs("button",{type:"button",onClick:()=>v(()=>TZn(t,!S),S?"Could not reopen Q&A":"Could not close Q&A"),className:ee("flex items-center gap-1 rounded-full px-3 py-1 text-xs font-medium",S?"bg-white/90 text-slate-900 hover:bg-white":"bg-white/10 text-white/70 hover:bg-white/20"),children:[S?a.jsx(Frt,{className:"h-3.5 w-3.5"}):a.jsx(wa,{className:"h-3.5 w-3.5"}),S?"Reopen Q&A":"Close Q&A"]})]}),S&&a.jsxs("p",{className:"flex items-center justify-center gap-1.5 bg-amber-500/10 px-4 py-1.5 text-xs text-amber-300",children:[a.jsx(wa,{className:"h-3.5 w-3.5"})," Q&A is closed",e?" — reopen to post or allow votes":" — voting has ended"]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-3",children:[f.isLoading&&a.jsxs("div",{className:"flex items-center justify-center gap-2 pt-8 text-sm text-white/40",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"})," Loading questions…"]}),!f.isLoading&&x.length===0&&a.jsxs("div",{className:"pt-8 text-center",children:[a.jsx(L8,{className:"mx-auto h-8 w-8 text-white/20"}),a.jsx("p",{className:"mt-2 text-sm text-white/40",children:e?"No questions yet — post one for the audience.":"No questions yet — the host will post them here."})]}),j.map(D=>a.jsx(Tze,{q:D,...N},D.id)),E.length>0&&a.jsxs("div",{className:"pt-1",children:[a.jsxs("button",{type:"button",onClick:()=>m(D=>!D),"aria-expanded":h,className:"flex w-full items-center gap-1.5 text-xs font-medium text-white/50 hover:text-white/80",children:[a.jsx(io,{className:ee("h-3.5 w-3.5 transition-transform",h&&"rotate-90")}),"Answered (",E.length,")"]}),h&&a.jsx("div",{className:"mt-2 space-y-3",children:E.map(D=>a.jsx(Tze,{q:D,...N},D.id))})]}),w>k&&a.jsxs("div",{className:"flex items-center justify-between pt-1 text-xs text-white/50",children:[a.jsxs("span",{children:[(l-1)*k+1,"–",Math.min(l*k,w)," of ",w]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",disabled:l<=1,onClick:()=>c(D=>Math.max(1,D-1)),className:"rounded-md border border-white/10 p-1 hover:bg-white/10 disabled:opacity-40","aria-label":"Previous page",children:a.jsx(nl,{className:"h-3.5 w-3.5"})}),a.jsx("button",{type:"button",disabled:l*k>=w,onClick:()=>c(D=>D+1),className:"rounded-md border border-white/10 p-1 hover:bg-white/10 disabled:opacity-40","aria-label":"Next page",children:a.jsx(io,{className:"h-3.5 w-3.5"})})]})]})]}),e&&!S?a.jsx("div",{className:"p-3 border-t border-white/10",children:a.jsx(SCt,{value:i,onChange:o,onSubmit:b,placeholder:"Post a question for the audience…"})}):e?null:a.jsx("p",{className:"border-t border-white/10 p-3 text-center text-xs text-white/40",children:S?"Q&A is closed.":"The host posts questions here — upvote the ones you want answered."})]})}function Tze({q:t,meetingId:e,canModerate:n,closed:r,spotlightId:s,act:i}){const[o,l]=y.useState(!1),[c,d]=y.useState(t.question),[u,h]=y.useState(!1),m=s===t.id,f=!n&&!r,p=async()=>{const b=c.trim();if(!b||b===t.question){l(!1),d(t.question);return}await i(()=>jZn(e,t.id,b),"Could not save the question")&&l(!1)},g="inline-flex h-7 shrink-0 items-center gap-1 whitespace-nowrap rounded-full border px-2.5 text-xs font-medium transition-colors",v="inline-flex h-7 w-7 items-center justify-center rounded-full transition-colors";return a.jsx("div",{className:ee("rounded-lg border px-3 py-2.5",m?"border-primary/60 bg-primary/10":t.isAnswered?"border-success/30 bg-success/5":"border-white/10 bg-white/5"),children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsxs("button",{type:"button",disabled:!f,onClick:()=>i(()=>Q1t(e,t.id),"Could not record your vote"),"aria-pressed":!!t.hasVoted,"aria-label":t.hasVoted?"Remove your upvote":"Upvote this question",title:n?"Upvotes from the audience":r?"Q&A is closed":t.hasVoted?"Remove your upvote":"Upvote",className:ee("flex w-9 shrink-0 flex-col items-center rounded-md border py-1 text-xs font-semibold transition-colors",t.hasVoted?"border-primary bg-primary/20 text-primary":"border-white/15 text-white/70",f&&!t.hasVoted&&"hover:border-primary hover:text-white",!f&&"cursor-default"),children:[a.jsx($8,{className:"h-3.5 w-3.5"}),t.voteCount??0]}),a.jsxs("div",{className:"min-w-0 flex-1",children:[m&&a.jsxs("p",{className:"mb-1 flex items-center gap-1 text-[10px] font-semibold uppercase tracking-wide text-primary",children:[a.jsx(tfe,{className:"h-3 w-3"})," Now answering"]}),o?a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("textarea",{value:c,onChange:b=>d(b.target.value),rows:2,maxLength:1e3,autoFocus:!0,className:"w-full resize-none rounded-md bg-white/10 px-2 py-1.5 text-sm text-white focus:outline-none focus:ring-1 focus:ring-primary"}),a.jsxs("div",{className:"flex justify-end gap-1.5",children:[a.jsx("button",{type:"button",onClick:()=>{l(!1),d(t.question)},className:ee(g,"border-white/15 text-white/70 hover:bg-white/10"),children:"Cancel"}),a.jsx("button",{type:"button",onClick:p,className:ee(g,"border-primary bg-primary text-white hover:bg-primary/90"),children:"Save"})]})]}):a.jsx("p",{className:"text-sm text-white/90 break-words",children:t.question}),a.jsxs("div",{className:"mt-1 flex items-center justify-between gap-2",children:[a.jsxs("p",{className:"truncate text-xs text-white/40",children:[t.askedByName??"Member"," · ",F_e(t.createdAt)]}),a.jsxs("span",{className:"flex shrink-0 items-center gap-0.5",children:[t.isAnswered&&a.jsxs("span",{className:"mr-1 flex items-center gap-1 text-xs font-medium text-success",children:[a.jsx(Qn,{className:"h-3.5 w-3.5"})," Answered"]}),n&&!o&&!u&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>l(!0),"aria-label":"Edit question",title:"Edit",className:ee(v,"h-6 w-6 text-white/50 hover:bg-white/10 hover:text-white"),children:a.jsx(Qs,{className:"h-3.5 w-3.5"})}),a.jsx("button",{type:"button",onClick:()=>h(!0),"aria-label":"Delete question",title:"Delete",className:ee(v,"h-6 w-6 text-red-400/70 hover:bg-red-500/10 hover:text-red-300"),children:a.jsx(qn,{className:"h-3.5 w-3.5"})})]})]})]}),n&&!o&&a.jsx("div",{className:"mt-2.5 flex flex-wrap items-center gap-1.5 border-t border-white/10 pt-2.5",children:u?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"mr-auto text-xs text-white/70",children:"Delete for everyone?"}),a.jsx("button",{type:"button",onClick:()=>h(!1),className:ee(g,"border-white/15 text-white/70 hover:bg-white/10"),children:"Keep"}),a.jsx("button",{type:"button",onClick:()=>i(()=>EZn(e,t.id),"Could not delete the question"),className:ee(g,"border-destructive bg-destructive text-white hover:bg-destructive/90"),children:"Delete"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",onClick:()=>i(()=>NZn(e,m?null:t.id),"Could not update the spotlight"),"aria-pressed":m,title:m?"Stop showing this to everyone":"Show this question to everyone as “Now answering”",className:ee(g,m?"border-primary bg-primary text-white hover:bg-primary/90":"border-primary/50 text-primary hover:bg-primary/15"),children:[a.jsx(tfe,{className:"h-3.5 w-3.5"}),m?"Spotlighted":"Spotlight"]}),!t.isAnswered&&a.jsxs("button",{type:"button",onClick:()=>i(()=>AZn(e,t.id),"Could not mark as answered"),title:"Mark answered",className:ee(g,"border-white/15 text-white/80 hover:border-success/60 hover:text-success"),children:[a.jsx(Qn,{className:"h-3.5 w-3.5"})," Answered"]})]})})]})]})})}function Nir({meetingId:t,canModerate:e}){const r=lt({queryKey:[...vZ(t),"spotlight"],queryFn:()=>t_e(t,1,"new"),refetchInterval:3e4,select:s=>s.spotlight}).data;return r?a.jsxs("div",{className:"absolute left-1/2 top-3 z-10 flex max-w-[min(90%,40rem)] -translate-x-1/2 items-start gap-2 rounded-xl border border-primary/40 bg-[hsl(230,20%,12%)]/95 px-4 py-2.5 shadow-lg backdrop-blur",children:[a.jsx(tfe,{className:"mt-0.5 h-4 w-4 shrink-0 text-primary"}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-[10px] font-semibold uppercase tracking-wide text-primary",children:"Now answering"}),a.jsx("p",{className:"text-sm text-white break-words",children:r.question})]}),e&&a.jsx("span",{className:"sr-only",children:"Stop the spotlight from the Q&A tab"})]}):null}function Tir({locked:t=!1}){const{meeting:e}=Vc(),n=Ns(d=>d.chat.messages),{toast:r}=yt(),s=y.useRef(null),[i,o]=y.useState(!1),l=n.filter(d=>d.type==="file"||d.type==="image").map(d=>{const u=d;return{id:u.id,name:u.name||(u.type==="image"?"Image":"File"),link:u.link,sharedBy:u.displayName??"Member",time:u.time}}).filter(d=>d.link),c=async d=>{o(!0);try{await e.chat.sendFileMessage(d),r({title:"Document shared"})}catch{r({title:"Could not share the document",variant:"destructive"})}finally{o(!1),s.current&&(s.current.value="")}};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex-1 overflow-y-auto p-4 space-y-2",children:[l.length===0&&a.jsxs("div",{className:"pt-8 text-center",children:[a.jsx(Ei,{className:"mx-auto h-8 w-8 text-white/20"}),a.jsx("p",{className:"mt-2 text-sm text-white/40",children:"Nothing shared yet. Documents shared in this session appear here for everyone."})]}),l.map(d=>a.jsxs("a",{href:d.link,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2.5 rounded-lg border border-white/10 bg-white/5 px-3 py-2.5 hover:bg-white/10 transition-colors",children:[a.jsx(Ei,{className:"h-4 w-4 shrink-0 text-white/50"}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-sm text-white/90",children:d.name}),a.jsxs("span",{className:"block text-xs text-white/40",children:[d.sharedBy," · ",F_e(d.time)]})]})]},d.id))]}),a.jsxs("div",{className:"p-3 border-t border-white/10",children:[a.jsx("input",{ref:s,type:"file",className:"hidden",onChange:d=>{var u;return((u=d.target.files)==null?void 0:u[0])&&c(d.target.files[0])}}),a.jsxs("button",{type:"button",disabled:i||t,title:t?"Sharing is turned off by the host":void 0,onClick:()=>{var d;return(d=s.current)==null?void 0:d.click()},className:"flex w-full items-center justify-center gap-2 rounded-full bg-white/10 hover:bg-white/20 px-4 py-2 text-sm text-white/80 hover:text-white transition-colors disabled:opacity-50",children:[i?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsx(Ff,{className:"h-4 w-4"}),"Share a document"]})]})]})}function yZ({active:t,onClick:e,onIcon:n,offIcon:r,label:s}){return a.jsx("button",{type:"button",onClick:e,className:ee("h-11 w-11 rounded-full flex items-center justify-center transition-colors",t?"bg-primary text-white":"bg-destructive/80 text-white"),"aria-label":s,children:t?n:r})}function _ir({onSubmit:t,onCancel:e}){const[n,r]=y.useState(""),s=n.trim().length>1;return a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-[hsl(230,25%,12%)] p-4",children:a.jsxs("div",{className:"w-full max-w-sm space-y-4 text-center",children:[a.jsx("h1",{className:"text-white text-lg font-semibold",children:"Join the live session"}),a.jsx("p",{className:"text-white/50 text-sm",children:"Enter your name so others know who you are."}),a.jsx("input",{value:n,onChange:i=>r(i.target.value),onKeyDown:i=>i.key==="Enter"&&s&&t(n.trim()),placeholder:"Your name",autoFocus:!0,className:"w-full rounded-full border border-white/10 bg-white/5 px-4 py-2.5 text-sm text-white placeholder:text-white/40 focus:outline-none focus:ring-1 focus:ring-primary"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button",onClick:e,className:"rounded-full bg-white/10 hover:bg-white/20 px-5 py-2.5 text-sm text-white/80 transition-colors",children:"Cancel"}),a.jsx("button",{type:"button",disabled:!s,onClick:()=>t(n.trim()),className:"flex-1 rounded-full bg-primary hover:bg-primary/90 px-5 py-2.5 text-sm font-medium text-white transition-colors disabled:opacity-50",children:"Continue"})]})]})})}function Air({text:t,onClose:e}){return a.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center gap-4 bg-[hsl(230,25%,12%)]",children:[a.jsx("p",{className:"text-white/80 text-sm",children:t}),a.jsx("button",{type:"button",onClick:e,className:"rounded-full bg-white/10 hover:bg-white/20 px-4 py-1.5 text-sm text-white transition-colors",children:"Back to community"})]})}function Pir(){const{hash:t}=Di(),e=new URLSearchParams(t.slice(1)).get("invite")||"",[n,r]=y.useState(""),[s,i]=y.useState(""),[o,l]=y.useState(""),[c,d]=y.useState(!1),[u,h]=y.useState(""),[m,f]=y.useState(null),p=lt({queryKey:["guest-event",e],queryFn:()=>Oan(e),retry:!1,refetchInterval:m?!1:15e3,refetchOnWindowFocus:!0});y.useEffect(()=>{const k=document.createElement("meta");return k.name="referrer",k.content="no-referrer",document.head.appendChild(k),()=>k.remove()},[]),y.useEffect(()=>{r(""),i(""),l(""),f(null),h("")},[e]);const g=p.data,v=async k=>{d(!0),h("");try{await k(),await p.refetch()}catch(S){h(Dt(S,"Couldn't complete this step.")),await p.refetch()}finally{d(!1)}};if(m)return a.jsx(jCt,{guestEntry:{inviteToken:e,joinData:m,onLeave:()=>{f(null),p.refetch()}}});const b=(g==null?void 0:g.state)==="live"?"Live now":(g==null?void 0:g.state)==="waiting"?"Waiting for the host":(g==null?void 0:g.state)==="ended"?"Event ended":"Upcoming event",x=(g==null?void 0:g.passwordRequired)&&!g.accessVerified,w=(g==null?void 0:g.state)==="ended"?"Thanks for your interest":x?"Enter your event passcode":g!=null&&g.registered?g.state==="live"?`Welcome${g.guestName?`, ${g.guestName}`:""}`:"You’re on the guest list":"Let’s get you ready";return a.jsx("main",{className:"min-h-screen bg-muted/30 px-4 py-12 sm:px-8 sm:py-20",children:a.jsxs("div",{className:"mx-auto max-w-5xl",children:[a.jsxs("div",{className:"mb-6 flex items-center gap-2 text-sm font-medium text-muted-foreground",children:[a.jsx(Ca,{className:"h-5 w-5 text-primary","aria-hidden":"true"})," Event guest invitation"]}),a.jsx(Gw,{className:"overflow-hidden rounded-2xl shadow-sm",children:a.jsxs("div",{className:"grid md:grid-cols-[1.15fr_1fr]",children:[a.jsxs("section",{className:"flex flex-col justify-between gap-10 border-b border-border bg-primary/5 p-6 sm:p-10 md:border-b-0 md:border-r","aria-label":"Event information",children:[a.jsxs("div",{className:"space-y-6",children:[g&&a.jsxs("div",{role:"status",className:"inline-flex items-center gap-2 rounded-full border border-primary/20 bg-background px-3 py-1.5 text-xs font-semibold text-primary",children:[g.state==="live"&&a.jsx("span",{className:"h-2 w-2 rounded-full bg-primary","aria-hidden":"true"}),b]}),a.jsx("h1",{className:"break-words text-3xl font-semibold leading-tight tracking-tight sm:text-4xl",children:(g==null?void 0:g.title)||"You’re invited"}),a.jsx("p",{className:"text-sm leading-relaxed text-muted-foreground",children:"A place to connect, listen and take part. Complete your guest entry here, then join the conversation."})]}),g&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(Ux,{className:"mt-1 h-5 w-5 shrink-0 text-primary","aria-hidden":"true"}),a.jsxs("div",{children:[a.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Event schedule · your local time"}),a.jsx("p",{className:"text-sm font-medium leading-relaxed",children:vte(g.startTime,g.endTime)})]})]}),a.jsx("p",{className:"text-sm leading-relaxed text-muted-foreground",children:g.state==="live"?"Already started. The event is live — you can join now.":g.state==="waiting"?"The scheduled start time has passed. Waiting for the host to start the event.":g.state==="ended"?"This session is now over.":"Join from this page when the host starts the event."})]})]}),a.jsxs(Ww,{className:"flex flex-col justify-center space-y-6 p-6 sm:p-10",children:[g&&!p.isError&&a.jsxs("div",{className:"space-y-3",children:[a.jsx("div",{className:"flex h-11 w-11 items-center justify-center rounded-xl bg-primary/10 text-primary",children:x?a.jsx(yK,{className:"h-5 w-5","aria-hidden":"true"}):g.registered?a.jsx(yo,{className:"h-5 w-5","aria-hidden":"true"}):a.jsx(Ca,{className:"h-5 w-5","aria-hidden":"true"})}),a.jsx("h2",{className:"break-words text-xl font-semibold",children:w}),g.state!=="ended"&&a.jsx("p",{className:"text-sm leading-relaxed text-muted-foreground",children:x?"Use the passcode shared by your host. Next, we’ll ask for your name and email.":g.registered?g.state==="live"?"Your guest entry is ready. Join whenever you’re ready.":"Keep this page open. We’ll update it automatically when the event begins.":"Tell us who’s joining. Your name will be shown in the meeting."})]}),p.isLoading?a.jsx(Ne,{"aria-label":"Loading event",className:"animate-spin"}):p.isError?a.jsx("p",{role:"alert",children:Dt(p.error,"This guest invitation is invalid or expired.")}):g&&a.jsx(a.Fragment,{children:g.state==="ended"?a.jsx("p",{children:"This event has ended."}):g.passwordRequired&&!g.accessVerified?a.jsxs("form",{className:"space-y-3",onSubmit:k=>{k.preventDefault(),v(async()=>{await u$e(e,n),r("")})},children:[a.jsx(_e,{htmlFor:"guest-passcode",children:"Event passcode"}),a.jsx(Oe,{id:"guest-passcode",type:"password",autoComplete:"off",required:!0,value:n,onChange:k=>r(k.target.value),disabled:c}),a.jsx(Z,{className:"w-full",disabled:c||!n,children:c?"Verifying…":"Continue"})]}):g.registered?g.state==="live"?a.jsxs(Z,{className:"w-full",disabled:c,onClick:()=>void v(async()=>f(await But(e))),children:[c?"Joining…":"Join event",a.jsx(xa,{className:"ml-2 h-4 w-4","aria-hidden":"true"})]}):a.jsxs("div",{role:"status",className:"space-y-2",children:[a.jsx("p",{children:g.state==="upcoming"?"You're registered. The event starts at the time shown above.":"The event will start shortly. Waiting for the host…"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"This page updates automatically."})]}):a.jsxs("form",{className:"space-y-3",onSubmit:k=>{k.preventDefault(),v(async()=>{g.accessVerified||await u$e(e),await Fan(e,s,o),i(""),l("")})},children:[a.jsx(_e,{htmlFor:"guest-name",children:"Your name"}),a.jsx(Oe,{id:"guest-name",autoComplete:"name",maxLength:80,required:!0,value:s,onChange:k=>i(k.target.value),disabled:c}),a.jsx(_e,{htmlFor:"guest-email",children:"Email address"}),a.jsx(Oe,{id:"guest-email",type:"email",autoComplete:"email",maxLength:254,required:!0,value:o,onChange:k=>l(k.target.value),disabled:c}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Your details identify you as a guest for this event."}),a.jsx(Z,{className:"w-full",disabled:c||!s.trim()||!o,children:c?"Saving…":"Continue to event"})]})}),u&&a.jsx("p",{role:"alert",className:"text-sm text-destructive",children:u})]})]})}),a.jsx("p",{className:"mt-5 text-center text-xs text-muted-foreground",children:"Guest access is for this event only."})]})})}const U_e="/assets/efclogo-BoTSyDyr.png";function Rir(){const t=Nn(),{user:e}=jr(),{toast:n}=yt(),[r,s]=y.useState(""),i=()=>{if(!r.trim()){n({title:"Please write an introduction",variant:"destructive"});return}if(e){const o=JSON.parse(localStorage.getItem("efc_onboarded")||"[]"),l=e.username||e.email.toLowerCase();o.includes(l)||(o.push(l),localStorage.setItem("efc_onboarded",JSON.stringify(o)))}n({title:"Introduction posted!",description:"Welcome to the community! Redirecting to dashboard…"}),t("/")};return a.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center px-4 relative overflow-hidden",style:{background:"linear-gradient(135deg, hsl(190, 90%, 55%), hsl(190, 80%, 60%) 30%, hsl(280, 40%, 65%) 60%, hsl(330, 70%, 55%))"},children:[a.jsx("div",{className:"absolute inset-0 overflow-hidden opacity-[0.08] pointer-events-none",children:a.jsx("svg",{className:"w-full h-full",viewBox:"0 0 1400 900",fill:"none",children:a.jsx("path",{d:"M-100 500 Q200 300 500 500 Q800 700 1100 400",stroke:"white",strokeWidth:"2"})})}),a.jsxs("div",{className:"relative z-10 w-full max-w-lg space-y-6 text-center",children:[a.jsx("img",{src:U_e,alt:"SpatialChat Communities logo",className:"h-36 w-36 mx-auto object-contain"}),a.jsx("h1",{className:"text-2xl font-bold text-gray-900",children:"Introduce yourself"}),a.jsxs("div",{className:"text-left space-y-3",children:[a.jsx("label",{className:"text-sm font-bold text-gray-900 block",children:"Write a short intro to the community"}),a.jsx("textarea",{rows:6,value:r,onChange:o=>s(o.target.value),placeholder:"Tell us your preferred name, role, your club category, your top 3 areas of focus (load management, return-to-play, nutrition, psychology, etc.). Additionally, share one professional question or insight you'd like to explore. This helps the community match you with relevant peers and content. You'll be surprised how quickly peers respond.",className:"w-full rounded-xl bg-white/90 p-5 text-sm text-neutral-900 placeholder:text-gray-500 focus:outline-none resize-none"})]}),a.jsx("button",{onClick:i,className:"w-full h-12 rounded-full bg-gray-900 text-white text-sm font-semibold tracking-wider hover:bg-gray-800 transition-colors",children:"POST"}),a.jsxs("p",{className:"text-sm font-bold text-gray-900 uppercase tracking-[0.2em] mt-4",children:["THE HEART",a.jsx("br",{}),"OF FOOTBALL"]})]})]})}const Iir=[{name:"Albania",region:"Southeast Europe",uefaRank:48},{name:"Andorra",region:"Iberia",uefaRank:54},{name:"Armenia",region:"Eurasian",uefaRank:37},{name:"Austria",region:"German-Speaking Core",uefaRank:10},{name:"Azerbaijan",region:"Eurasian",uefaRank:29},{name:"Belarus",region:"Eurasian",uefaRank:50},{name:"Belgium",region:"Benelux",uefaRank:8},{name:"Bosnia and Herzegovina",region:"Southeast Europe",uefaRank:40},{name:"Bulgaria",region:"Southeast Europe",uefaRank:27},{name:"Croatia",region:"Southeast Europe",uefaRank:20},{name:"Cyprus",region:"Southeast Europe",uefaRank:24},{name:"Czech Republic",region:"Central Europe",uefaRank:17},{name:"Denmark",region:"Scandinavia",uefaRank:16},{name:"England",region:"British Isles",uefaRank:1},{name:"Estonia",region:"Eastern Europe",uefaRank:43},{name:"Faroe Islands",region:"Scandinavia",uefaRank:41},{name:"Finland",region:"Scandinavia",uefaRank:33},{name:"France",region:"Central-South Europe",uefaRank:6},{name:"Georgia",region:"Eurasian",uefaRank:46},{name:"Germany",region:"German-Speaking Core",uefaRank:4},{name:"Gibraltar",region:"Iberia",uefaRank:51},{name:"Greece",region:"Southeast Europe",uefaRank:19},{name:"Hungary",region:"Central Europe",uefaRank:26},{name:"Iceland",region:"Scandinavia",uefaRank:47},{name:"Ireland",region:"British Isles",uefaRank:32},{name:"Israel",region:"Eurasian",uefaRank:18},{name:"Italy",region:"Central-South Europe",uefaRank:3},{name:"Kazakhstan",region:"Eurasian",uefaRank:38},{name:"Kosovo",region:"Southeast Europe",uefaRank:36},{name:"Latvia",region:"Eastern Europe",uefaRank:35},{name:"Liechtenstein",region:"German-Speaking Core",uefaRank:31},{name:"Lithuania",region:"Eastern Europe",uefaRank:42},{name:"Luxembourg",region:"Benelux",uefaRank:45},{name:"Malta",region:"Central-South Europe",uefaRank:44},{name:"Moldova",region:"Eastern Europe",uefaRank:30},{name:"Montenegro",region:"Southeast Europe",uefaRank:53},{name:"Netherlands",region:"Benelux",uefaRank:5},{name:"North Macedonia",region:"Southeast Europe",uefaRank:52},{name:"Northern Ireland",region:"British Isles",uefaRank:39},{name:"Norway",region:"Scandinavia",uefaRank:15},{name:"Poland",region:"Central Europe",uefaRank:23},{name:"Portugal",region:"Iberia",uefaRank:7},{name:"Romania",region:"Eastern Europe",uefaRank:25},{name:"Russia",region:"Eurasian",uefaRank:22},{name:"San Marino",region:"Central-South Europe",uefaRank:55},{name:"Scotland",region:"British Isles",uefaRank:9},{name:"Serbia",region:"Southeast Europe",uefaRank:13},{name:"Slovakia",region:"Central Europe",uefaRank:28},{name:"Slovenia",region:"Southeast Europe",uefaRank:34},{name:"Spain",region:"Iberia",uefaRank:2},{name:"Sweden",region:"Scandinavia",uefaRank:21},{name:"Switzerland",region:"German-Speaking Core",uefaRank:11},{name:"Turkey",region:"Eurasian",uefaRank:12},{name:"Ukraine",region:"Eastern Europe",uefaRank:14},{name:"Wales",region:"British Isles",uefaRank:49}],Mir=Iir.map(t=>t.name),z_e=[{name:"FK Apolonia",country:"Albania",gender:"Men"},{name:"FK Kukësi",country:"Albania",gender:"Men"},{name:"FK Partizani",country:"Albania",gender:"Men"},{name:"KF Erzeni",country:"Albania",gender:"Men"},{name:"KF Laçi",country:"Albania",gender:"Men"},{name:"KF Tirana",country:"Albania",gender:"Men"},{name:"FC Kinostudio",country:"Albania",gender:"Women"},{name:"KF Vllaznia Shkodra",country:"Albania",gender:"Women"},{name:"CE Carroi",country:"Andorra",gender:"Men"},{name:"CF Atletic America",country:"Andorra",gender:"Men"},{name:"CF Esperanca de Andorra",country:"Andorra",gender:"Men"},{name:"FC Ordino",country:"Andorra",gender:"Men"},{name:"FC Santa Coloma",country:"Andorra",gender:"Men"},{name:"FS La Massana",country:"Andorra",gender:"Men"},{name:"Inter Club d'Escaldes",country:"Andorra",gender:"Men"},{name:"Pas de la Casa",country:"Andorra",gender:"Men"},{name:"UE Sant Julià",country:"Andorra",gender:"Men"},{name:"UE Santa Coloma",country:"Andorra",gender:"Men"},{name:"Alashkert FC",country:"Armenia",gender:"Men"},{name:"FC Ararat",country:"Armenia",gender:"Men"},{name:"FC Ararat-Armenia",country:"Armenia",gender:"Men"},{name:"FC Gandzasar",country:"Armenia",gender:"Men"},{name:"FC Noah",country:"Armenia",gender:"Men"},{name:"FC Pyunik",country:"Armenia",gender:"Men"},{name:"FC Shirak",country:"Armenia",gender:"Men"},{name:"FC Urartu",country:"Armenia",gender:"Men"},{name:"FC West Armenia",country:"Armenia",gender:"Men"},{name:"FK Van",country:"Armenia",gender:"Men"},{name:"Syunik FC",country:"Armenia",gender:"Men"},{name:"Admira Wacker",country:"Austria",gender:"Men"},{name:"FC Blau-Weiss Linz",country:"Austria",gender:"Men"},{name:"FC Salzburg",country:"Austria",gender:"Men"},{name:"FK Austria Wien",country:"Austria",gender:"Men"},{name:"GAK 1902",country:"Austria",gender:"Men"},{name:"LASK",country:"Austria",gender:"Men"},{name:"SCR Altach",country:"Austria",gender:"Men"},{name:"SK Austria Klagenfurt",country:"Austria",gender:"Men"},{name:"SK Rapid",country:"Austria",gender:"Men"},{name:"SK Sturm Graz",country:"Austria",gender:"Men"},{name:"SV Oberbank Ried",country:"Austria",gender:"Men"},{name:"Wolfsberger AC",country:"Austria",gender:"Men"},{name:"SKN St. Pölten Frauen",country:"Austria",gender:"Women"},{name:"Araz-Nakhçhivan PFK",country:"Azerbaijan",gender:"Men"},{name:"FK Sabail",country:"Azerbaijan",gender:"Men"},{name:"Gabala SC",country:"Azerbaijan",gender:"Men"},{name:"Imishli PFC",country:"Azerbaijan",gender:"Men"},{name:"Käpäz PFK",country:"Azerbaijan",gender:"Men"},{name:"Karvan-Yevlax Football Club",country:"Azerbaijan",gender:"Men"},{name:"Neftçi PFK",country:"Azerbaijan",gender:"Men"},{name:"PFC Zire",country:"Azerbaijan",gender:"Men"},{name:"Qarabağ FK",country:"Azerbaijan",gender:"Men"},{name:"Sabah",country:"Azerbaijan",gender:"Men"},{name:"Sumqayıt FK",country:"Azerbaijan",gender:"Men"},{name:"Turan Tovuz PFK",country:"Azerbaijan",gender:"Men"},{name:"FC Arsenal Dzerzhinsk",country:"Belarus",gender:"Men"},{name:"FC BATE Borisov",country:"Belarus",gender:"Men"},{name:"FC Belshina",country:"Belarus",gender:"Men"},{name:"FC Dinamo Minsk",country:"Belarus",gender:"Men"},{name:"FC Dnepr Mogilev",country:"Belarus",gender:"Men"},{name:"FC Dynamo Brest",country:"Belarus",gender:"Men"},{name:"FC Energetik-BSU Minsk",country:"Belarus",gender:"Men"},{name:"FC Gomel",country:"Belarus",gender:"Men"},{name:"FC Isloch",country:"Belarus",gender:"Men"},{name:"FC ML Vitebsk",country:"Belarus",gender:"Men"},{name:"FC Neman Grodno",country:"Belarus",gender:"Men"},{name:"FC Shakhter Soligorsk",country:"Belarus",gender:"Men"},{name:"FC Smorgon",country:"Belarus",gender:"Men"},{name:"FC TORPEDO-BELAZ",country:"Belarus",gender:"Men"},{name:"FC Vitebsk",country:"Belarus",gender:"Men"},{name:"SFC Slutsk",country:"Belarus",gender:"Men"},{name:"FC Minsk",country:"Belarus",gender:"Women"},{name:"SKA-1938",country:"Belarus",gender:"Women"},{name:"WFC ABFF WU-19",country:"Belarus",gender:"Women"},{name:"WFC DUSSH-PolesSu",country:"Belarus",gender:"Women"},{name:"Cercle Brugge KSV",country:"Belgium",gender:"Men"},{name:"Club Brugge",country:"Belgium",gender:"Men"},{name:"FC Dender",country:"Belgium",gender:"Men"},{name:"KAA Gent",country:"Belgium",gender:"Men"},{name:"KAS Eupen",country:"Belgium",gender:"Men"},{name:"KRC Genk",country:"Belgium",gender:"Men"},{name:"KV Kortrijk (KVK)",country:"Belgium",gender:"Men"},{name:"KV Mechelen",country:"Belgium",gender:"Men"},{name:"KVC Westerlo",country:"Belgium",gender:"Men"},{name:"Oud-Heverlee Leuven",country:"Belgium",gender:"Men"},{name:"R. Standard de Liège",country:"Belgium",gender:"Men"},{name:"Royal Antwerp FC",country:"Belgium",gender:"Men"},{name:"Royal Charleroi SC",country:"Belgium",gender:"Men"},{name:"RWDM Brussels",country:"Belgium",gender:"Men"},{name:"Sint-Truidense VV (STVV)",country:"Belgium",gender:"Men"},{name:"RSC Anderlecht",country:"Belgium",gender:"Women"},{name:"FK Borac Banja Luka",country:"Bosnia and Herzegovina",gender:"Men"},{name:"FK Igman Konjic",country:"Bosnia and Herzegovina",gender:"Men"},{name:"FK Sloga Doboj",country:"Bosnia and Herzegovina",gender:"Men"},{name:"FK Tuzla City",country:"Bosnia and Herzegovina",gender:"Men"},{name:"FK Velež Mostar",country:"Bosnia and Herzegovina",gender:"Men"},{name:"FK Željezničar",country:"Bosnia and Herzegovina",gender:"Men"},{name:"FK Zvijezda 09",country:"Bosnia and Herzegovina",gender:"Men"},{name:"HŠK Posušje",country:"Bosnia and Herzegovina",gender:"Men"},{name:"HŠK Zrinjski",country:"Bosnia and Herzegovina",gender:"Men"},{name:"NK GOŠK Gabela",country:"Bosnia and Herzegovina",gender:"Men"},{name:"NK Široki Brijeg",country:"Bosnia and Herzegovina",gender:"Men"},{name:"FK Sarajevo",country:"Bosnia and Herzegovina",gender:"Women"},{name:"ŽF/NK Emina",country:"Bosnia and Herzegovina",gender:"Women"},{name:"ZFK Leotar Trebinje",country:"Bosnia and Herzegovina",gender:"Women"},{name:"CSKA 1948 Sofia",country:"Bulgaria",gender:"Men"},{name:"FC Dobrudja 1919",country:"Bulgaria",gender:"Men"},{name:"FC Etar VT",country:"Bulgaria",gender:"Men"},{name:"FC Hebar Pazardzhik",country:"Bulgaria",gender:"Men"},{name:"FC Lokomotiv Sofia 1929",country:"Bulgaria",gender:"Men"},{name:"FC Spartak Varna 1918",country:"Bulgaria",gender:"Men"},{name:"OFC Botev Vratsa",country:"Bulgaria",gender:"Men"},{name:"PFC Arda Kardzhali 1924",country:"Bulgaria",gender:"Men"},{name:"PFC Beroe Stara Zagora",country:"Bulgaria",gender:"Men"},{name:"PFC Botev Plovdiv",country:"Bulgaria",gender:"Men"},{name:"PFC Cherno More Varna",country:"Bulgaria",gender:"Men"},{name:"PFC CSKA Sofia",country:"Bulgaria",gender:"Men"},{name:"PFC Levski Sofia",country:"Bulgaria",gender:"Men"},{name:"PFC Lokomotiv Plovdiv 1926",country:"Bulgaria",gender:"Men"},{name:"PFC Ludogorets 1945",country:"Bulgaria",gender:"Men"},{name:"PFC Septemvri Sofia",country:"Bulgaria",gender:"Men"},{name:"PFC Slavia Sofia",country:"Bulgaria",gender:"Men"},{name:"Pirin Blagoevgrad",country:"Bulgaria",gender:"Men"},{name:"FC Dunav Ruse",country:"Bulgaria",gender:"Women"},{name:"FC NSA",country:"Bulgaria",gender:"Women"},{name:"FC Sevlievo Ladies",country:"Bulgaria",gender:"Women"},{name:"FC Sportika Blagoevgrad",country:"Bulgaria",gender:"Women"},{name:"FK Paldin Plovdiv",country:"Bulgaria",gender:"Women"},{name:"FK Svetkavitsa Gradezhnitsa",country:"Bulgaria",gender:"Women"},{name:"GNK Dinamo Zagreb",country:"Croatia",gender:"Men"},{name:"HNK Gorica",country:"Croatia",gender:"Men"},{name:"HNK Hajduk Split",country:"Croatia",gender:"Men"},{name:"HNK Rijeka",country:"Croatia",gender:"Men"},{name:"NK Istra 1961",country:"Croatia",gender:"Men"},{name:"NK Osijek",country:"Croatia",gender:"Men"},{name:"NK Rudeš",country:"Croatia",gender:"Men"},{name:"NK Slaven Belupo",country:"Croatia",gender:"Men"},{name:"NK Varaždin",country:"Croatia",gender:"Men"},{name:"ŽNK Agram",country:"Croatia",gender:"Women"},{name:"ZNK Dinamo Zagreb",country:"Croatia",gender:"Women"},{name:"ŽNK Donat-Zadar",country:"Croatia",gender:"Women"},{name:"ŽNK Medimurje",country:"Croatia",gender:"Women"},{name:"ZNK Split",country:"Croatia",gender:"Women"},{name:"AEK Larnaca FC",country:"Cyprus",gender:"Men"},{name:"AEL Limassol FC",country:"Cyprus",gender:"Men"},{name:"AEZ Zakakiou FC",country:"Cyprus",gender:"Men"},{name:"Akritas Chlorakas FC",country:"Cyprus",gender:"Men"},{name:"Anorthosis Famagusta FC",country:"Cyprus",gender:"Men"},{name:"APOEL FC",country:"Cyprus",gender:"Men"},{name:"Apollon Limassol FC",country:"Cyprus",gender:"Men"},{name:"Aris Limassol FC",country:"Cyprus",gender:"Men"},{name:"Ethnikos Achnas FC",country:"Cyprus",gender:"Men"},{name:"Karmiotissa FC",country:"Cyprus",gender:"Men"},{name:"Nea Salamis",country:"Cyprus",gender:"Men"},{name:"Olympiakos Nicosia",country:"Cyprus",gender:"Men"},{name:"Omonia Aradippou",country:"Cyprus",gender:"Men"},{name:"Omonoia FC",country:"Cyprus",gender:"Men"},{name:"PAC Omonia 29M",country:"Cyprus",gender:"Men"},{name:"Pafos FC",country:"Cyprus",gender:"Men"},{name:"Chrysomilia Agios Amvrosios Kyrenia",country:"Cyprus",gender:"Women"},{name:"Lakatamia FC",country:"Cyprus",gender:"Women"},{name:"Lefkothea",country:"Cyprus",gender:"Women"},{name:"1. FC Slovácko",country:"Czech Republic",gender:"Men"},{name:"AC Sparta Praha",country:"Czech Republic",gender:"Men"},{name:"Bohemians Praha 1905",country:"Czech Republic",gender:"Men"},{name:"FC Baník Ostrava",country:"Czech Republic",gender:"Men"},{name:"FC Hradec Králové",country:"Czech Republic",gender:"Men"},{name:"FC Slovan Liberec",country:"Czech Republic",gender:"Men"},{name:"FC Viktoria Plzeň",country:"Czech Republic",gender:"Men"},{name:"FC Zlin",country:"Czech Republic",gender:"Men"},{name:"FK Jablonec",country:"Czech Republic",gender:"Men"},{name:"FK Mladá Boleslav",country:"Czech Republic",gender:"Men"},{name:"FK Pardubice",country:"Czech Republic",gender:"Men"},{name:"FK Teplice",country:"Czech Republic",gender:"Men"},{name:"MFK Karviná",country:"Czech Republic",gender:"Men"},{name:"SK České Budějovice",country:"Czech Republic",gender:"Men"},{name:"SK Sigma Olomouc",country:"Czech Republic",gender:"Men"},{name:"SK Slavia Praha",country:"Czech Republic",gender:"Men"},{name:"Aalborg BK",country:"Denmark",gender:"Men"},{name:"AC Horsens",country:"Denmark",gender:"Men"},{name:"Brøndby IF",country:"Denmark",gender:"Men"},{name:"Esbjerg fB",country:"Denmark",gender:"Men"},{name:"FC Copenhagen",country:"Denmark",gender:"Men"},{name:"FC Midtjylland",country:"Denmark",gender:"Men"},{name:"FC Nordsjælland",country:"Denmark",gender:"Men"},{name:"Odense BK",country:"Denmark",gender:"Men"},{name:"Silkeborg IF",country:"Denmark",gender:"Men"},{name:"AGF Aarhus",country:"Denmark",gender:"Women"},{name:"Boldklubben af 1893",country:"Denmark",gender:"Women"},{name:"Fortuna Hjørring",country:"Denmark",gender:"Women"},{name:"HB Køge Women",country:"Denmark",gender:"Women"},{name:"AFC Bournemouth",country:"England",gender:"Men"},{name:"Arsenal FC",country:"England",gender:"Men"},{name:"Aston Villa FC",country:"England",gender:"Men"},{name:"Brentford FC",country:"England",gender:"Men"},{name:"Brighton & Hove Albion FC",country:"England",gender:"Men"},{name:"Chelsea FC",country:"England",gender:"Men"},{name:"Everton FC",country:"England",gender:"Men"},{name:"Fulham FC",country:"England",gender:"Men"},{name:"Leeds United FC",country:"England",gender:"Men"},{name:"Leicester City FC",country:"England",gender:"Men"},{name:"Liverpool FC",country:"England",gender:"Men"},{name:"Manchester City FC",country:"England",gender:"Men"},{name:"Manchester United FC",country:"England",gender:"Men"},{name:"Newcastle United FC",country:"England",gender:"Men"},{name:"Nottingham Forest FC",country:"England",gender:"Men"},{name:"Sunderland AFC",country:"England",gender:"Men"},{name:"Tottenham Hotspur",country:"England",gender:"Men"},{name:"West Ham United FC",country:"England",gender:"Men"},{name:"London City Lionesses",country:"England",gender:"Women"},{name:"FC Flora Tallinn",country:"Estonia",gender:"Men"},{name:"FC Kuressaare",country:"Estonia",gender:"Men"},{name:"FC Nõmme United",country:"Estonia",gender:"Men"},{name:"FCI Levadia Tallinn",country:"Estonia",gender:"Men"},{name:"Harju JK Laagri",country:"Estonia",gender:"Men"},{name:"JK Narva Trans",country:"Estonia",gender:"Men"},{name:"JK Tallinna Kalev",country:"Estonia",gender:"Men"},{name:"JK Tammeka Tartu",country:"Estonia",gender:"Men"},{name:"Nõmme Kalju FC",country:"Estonia",gender:"Men"},{name:"Paide Linnameeskond",country:"Estonia",gender:"Men"},{name:"Pärnu JK Vaprus",country:"Estonia",gender:"Men"},{name:"FC Ararat Tallinn",country:"Estonia",gender:"Women"},{name:"07 Vestur",country:"Faroe Islands",gender:"Men"},{name:"B36 Tórshavn",country:"Faroe Islands",gender:"Men"},{name:"B68 Toftir",country:"Faroe Islands",gender:"Men"},{name:"EB/Streymur",country:"Faroe Islands",gender:"Men"},{name:"HB Tórshavn",country:"Faroe Islands",gender:"Men"},{name:"KÍ Klaksvík",country:"Faroe Islands",gender:"Men"},{name:"NSÍ Runavík",country:"Faroe Islands",gender:"Men"},{name:"Víkingur",country:"Faroe Islands",gender:"Men"},{name:"FC Hoyvik",country:"Faroe Islands",gender:"Women"},{name:"AC Oulu",country:"Finland",gender:"Men"},{name:"Ekenäs Idrottsförening",country:"Finland",gender:"Men"},{name:"FC Haka",country:"Finland",gender:"Men"},{name:"FC Honka Espoo",country:"Finland",gender:"Men"},{name:"FC Inter Turku",country:"Finland",gender:"Men"},{name:"FC Lahti",country:"Finland",gender:"Men"},{name:"HJK Helsinki",country:"Finland",gender:"Men"},{name:"IF Gnistan",country:"Finland",gender:"Men"},{name:"IFK Mariehamn",country:"Finland",gender:"Men"},{name:"Ilves Tampere",country:"Finland",gender:"Men"},{name:"KuPS Kuopio",country:"Finland",gender:"Men"},{name:"SJK Seinäjoki",country:"Finland",gender:"Men"},{name:"VPS Vaasa",country:"Finland",gender:"Men"},{name:"AJ Auxerre",country:"France",gender:"Men"},{name:"Angers SCO",country:"France",gender:"Men"},{name:"AS Monaco FC",country:"France",gender:"Men"},{name:"AS Saint-Étienne",country:"France",gender:"Men"},{name:"Clermont Foot 63",country:"France",gender:"Men"},{name:"ESTAC Troyes",country:"France",gender:"Men"},{name:"FC Girondins de Bordeaux",country:"France",gender:"Men"},{name:"FC Lorient",country:"France",gender:"Men"},{name:"FC Metz",country:"France",gender:"Men"},{name:"FC Nantes",country:"France",gender:"Men"},{name:"LOSC Lille",country:"France",gender:"Men"},{name:"Montpellier Hérault SC",country:"France",gender:"Men"},{name:"OGC Nice",country:"France",gender:"Men"},{name:"Olympique de Marseille",country:"France",gender:"Men"},{name:"Olympique Lyonnais",country:"France",gender:"Men"},{name:"Paris Saint-Germain",country:"France",gender:"Men"},{name:"Racing Club de Strasbourg",country:"France",gender:"Men"},{name:"RC Lens",country:"France",gender:"Men"},{name:"Stade Brestois 29",country:"France",gender:"Men"},{name:"Stade de Reims",country:"France",gender:"Men"},{name:"Stade Rennais FC",country:"France",gender:"Men"},{name:"Toulouse FC",country:"France",gender:"Men"},{name:"Dijon FCO",country:"France",gender:"Women"},{name:"En Avant de Guingamp",country:"France",gender:"Women"},{name:"Fleury 91 Féminines",country:"France",gender:"Women"},{name:"Paris FC",country:"France",gender:"Women"},{name:"FC Chikhura Sachkhere",country:"Georgia",gender:"Men"},{name:"FC Dila Gori",country:"Georgia",gender:"Men"},{name:"FC Dinamo Batoumi",country:"Georgia",gender:"Men"},{name:"FC Dinamo Tbilisi",country:"Georgia",gender:"Men"},{name:"FC Gagra",country:"Georgia",gender:"Men"},{name:"FC Iberia 1999",country:"Georgia",gender:"Men"},{name:"FC Kakheti Telavi",country:"Georgia",gender:"Men"},{name:"FC Samtredia",country:"Georgia",gender:"Men"},{name:"FC Torpedo Kutaisi",country:"Georgia",gender:"Men"},{name:"FC Tskaltubo Samgurali",country:"Georgia",gender:"Men"},{name:"Kvartali FC",country:"Georgia",gender:"Women"},{name:"Lanchkhuti",country:"Georgia",gender:"Women"},{name:"WFC NIKE-LUSSO",country:"Georgia",gender:"Women"},{name:"1. FC Heidenheim 1846",country:"Germany",gender:"Men"},{name:"1. FC Köln",country:"Germany",gender:"Men"},{name:"1. FC Nürnberg",country:"Germany",gender:"Men"},{name:"1. FC Union Berlin",country:"Germany",gender:"Men"},{name:"1. FSV Mainz 05",country:"Germany",gender:"Men"},{name:"Bayer 04 Leverkusen",country:"Germany",gender:"Men"},{name:"Borussia Dortmund",country:"Germany",gender:"Men"},{name:"Borussia VfL 1900 Mönchengladbach",country:"Germany",gender:"Men"},{name:"Eintracht Frankfurt",country:"Germany",gender:"Men"},{name:"FC Augsburg",country:"Germany",gender:"Men"},{name:"FC Bayern München",country:"Germany",gender:"Men"},{name:"FC Schalke 04",country:"Germany",gender:"Men"},{name:"Hamburger SV",country:"Germany",gender:"Men"},{name:"Hertha BSC Berlin",country:"Germany",gender:"Men"},{name:"RB Leipzig",country:"Germany",gender:"Men"},{name:"SC Freiburg",country:"Germany",gender:"Men"},{name:"SV Darmstadt 98",country:"Germany",gender:"Men"},{name:"SV Werder Bremen",country:"Germany",gender:"Men"},{name:"VfB Stuttgart",country:"Germany",gender:"Men"},{name:"VfL Bochum 1848",country:"Germany",gender:"Men"},{name:"SGS Essen",country:"Germany",gender:"Women"},{name:"TSG 1899 Hoffenheim",country:"Germany",gender:"Women"},{name:"VfL Wolfsburg",country:"Germany",gender:"Women"},{name:"College 1975 FC",country:"Gibraltar",gender:"Men"},{name:"Europa FC",country:"Gibraltar",gender:"Men"},{name:"Europa Point FC",country:"Gibraltar",gender:"Men"},{name:"FC Hound Dogs",country:"Gibraltar",gender:"Men"},{name:"FC Magpies",country:"Gibraltar",gender:"Men"},{name:"Glacis United FC",country:"Gibraltar",gender:"Men"},{name:"Lincoln Red Imps FC",country:"Gibraltar",gender:"Men"},{name:"Lions Gibraltar FC",country:"Gibraltar",gender:"Men"},{name:"Lynx FC",country:"Gibraltar",gender:"Men"},{name:"Manchester 1962 FC",country:"Gibraltar",gender:"Men"},{name:"Mons Calpe SC",country:"Gibraltar",gender:"Men"},{name:"St Joseph's FC",country:"Gibraltar",gender:"Men"},{name:"Gibraltar Wave FC",country:"Gibraltar",gender:"Women"},{name:"Hercules FC",country:"Gibraltar",gender:"Women"},{name:"AEK Athens FC",country:"Greece",gender:"Men"},{name:"Aris FC",country:"Greece",gender:"Men"},{name:"Asteras Tripolis FC",country:"Greece",gender:"Men"},{name:"Athens Kallithea F.C.",country:"Greece",gender:"Men"},{name:"Atromitos FC",country:"Greece",gender:"Men"},{name:"Kifisia FC",country:"Greece",gender:"Men"},{name:"Levadiakos F.C.",country:"Greece",gender:"Men"},{name:"OFI Crete FC",country:"Greece",gender:"Men"},{name:"Olympiacos FC",country:"Greece",gender:"Men"},{name:"Panathinaikos FC",country:"Greece",gender:"Men"},{name:"Panetolikos FC",country:"Greece",gender:"Men"},{name:"Panserraikos FC",country:"Greece",gender:"Men"},{name:"PAOK FC",country:"Greece",gender:"Men"},{name:"PAS Giannina FC",country:"Greece",gender:"Men"},{name:"PAS Lamia",country:"Greece",gender:"Men"},{name:"Volos NFC",country:"Greece",gender:"Men"},{name:"AS Olimpiada Imittou",country:"Greece",gender:"Women"},{name:"Larissa Women",country:"Greece",gender:"Women"},{name:"Nees Atromitou",country:"Greece",gender:"Women"},{name:"Contoso Football Club",country:"Hungary",gender:"Men"},{name:"Budapest Honvéd FC",country:"Hungary",gender:"Men"},{name:"Debreceni VSC",country:"Hungary",gender:"Men"},{name:"Fehérvár FC",country:"Hungary",gender:"Men"},{name:"Ferencvárosi TC",country:"Hungary",gender:"Men"},{name:"Gyori ETO FC",country:"Hungary",gender:"Men"},{name:"MTK Budapest FC",country:"Hungary",gender:"Men"},{name:"Puskás Akadémia FC",country:"Hungary",gender:"Men"},{name:"Újpest FC",country:"Hungary",gender:"Men"},{name:"ZTE FC",country:"Hungary",gender:"Men"},{name:"Kisvárda FC",country:"Hungary",gender:"Women"},{name:"Breidablik",country:"Iceland",gender:"Men"},{name:"FH Hafnarfjördur",country:"Iceland",gender:"Men"},{name:"Fram Reykjavik FC",country:"Iceland",gender:"Men"},{name:"Fylkir",country:"Iceland",gender:"Men"},{name:"HK Kopavogs",country:"Iceland",gender:"Men"},{name:"ÍA Akranes",country:"Iceland",gender:"Men"},{name:"IBV Íþróttabandalag Vestmannaeyja",country:"Iceland",gender:"Men"},{name:"KA Akureyri",country:"Iceland",gender:"Men"},{name:"Keflavík",country:"Iceland",gender:"Men"},{name:"KR Reykjavík",country:"Iceland",gender:"Men"},{name:"Stjarnan",country:"Iceland",gender:"Men"},{name:"Ungmennafélagið Afturelding",country:"Iceland",gender:"Men"},{name:"Valur",country:"Iceland",gender:"Men"},{name:"Vestri",country:"Iceland",gender:"Men"},{name:"Víkingur Reykjavik",country:"Iceland",gender:"Men"},{name:"Thór/KA",country:"Iceland",gender:"Women"},{name:"Thróttur Reykjavík",country:"Iceland",gender:"Women"},{name:"Cork City FC",country:"Ireland",gender:"Men"},{name:"Derry City FC",country:"Ireland",gender:"Men"},{name:"Drogheda United FC",country:"Ireland",gender:"Men"},{name:"Dundalk FC",country:"Ireland",gender:"Men"},{name:"Galway United FC",country:"Ireland",gender:"Men"},{name:"Saint Patrick's Athletic FC",country:"Ireland",gender:"Men"},{name:"Shamrock Rovers FC",country:"Ireland",gender:"Men"},{name:"Shelbourne FC",country:"Ireland",gender:"Men"},{name:"Sligo Rovers FC",country:"Ireland",gender:"Men"},{name:"Waterford FC",country:"Ireland",gender:"Men"},{name:"DLR Waves",country:"Ireland",gender:"Women"},{name:"Peamount United FC",country:"Ireland",gender:"Women"},{name:"Beitar Jerusalem FC",country:"Israel",gender:"Men"},{name:"Bnei Sakhnin FC",country:"Israel",gender:"Men"},{name:"Bnei Yehuda Tel-Aviv FC",country:"Israel",gender:"Men"},{name:"FC Ashdod",country:"Israel",gender:"Men"},{name:"Hapoel Beer-Sheva FC",country:"Israel",gender:"Men"},{name:"Hapoel Hadera",country:"Israel",gender:"Men"},{name:"Hapoel Haifa FC",country:"Israel",gender:"Men"},{name:"Hapoel Jerusalem FC",country:"Israel",gender:"Men"},{name:"Hapoel Petah Tikva FC",country:"Israel",gender:"Men"},{name:"Hapoel Tel-Aviv FC",country:"Israel",gender:"Men"},{name:"Ironi Tiberias FC",country:"Israel",gender:"Men"},{name:"Maccabi Bnei Reineh",country:"Israel",gender:"Men"},{name:"Maccabi Haifa FC",country:"Israel",gender:"Men"},{name:"Maccabi Petah Tikva FC",country:"Israel",gender:"Men"},{name:"Maccabi Tel-Aviv FC",country:"Israel",gender:"Men"},{name:"ASA Tel-Aviv University SC",country:"Israel",gender:"Women"},{name:"Bnot Netanya FC",country:"Israel",gender:"Women"},{name:"Kiryat Gat W.F.C.",country:"Israel",gender:"Women"},{name:"Maccabi Kishronot Hadera",country:"Israel",gender:"Women"},{name:"Raanana Women's Soccer FC",country:"Israel",gender:"Women"},{name:"WFC Ramat Hasharon",country:"Israel",gender:"Women"},{name:"AC Milan",country:"Italy",gender:"Men"},{name:"AS Roma",country:"Italy",gender:"Men"},{name:"Atalanta BC",country:"Italy",gender:"Men"},{name:"Bologna FC",country:"Italy",gender:"Men"},{name:"Cagliari Calcio",country:"Italy",gender:"Men"},{name:"Como 1907",country:"Italy",gender:"Men"},{name:"Empoli FC",country:"Italy",gender:"Men"},{name:"FC Internazionale Milano",country:"Italy",gender:"Men"},{name:"Frosinone Calcio",country:"Italy",gender:"Men"},{name:"Genoa CFC",country:"Italy",gender:"Men"},{name:"Hellas Verona FC",country:"Italy",gender:"Men"},{name:"Juventus FC",country:"Italy",gender:"Men"},{name:"Monza",country:"Italy",gender:"Men"},{name:"Parma Calcio 1913",country:"Italy",gender:"Men"},{name:"Pisa SC",country:"Italy",gender:"Men"},{name:"SS Lazio",country:"Italy",gender:"Men"},{name:"SSC Napoli",country:"Italy",gender:"Men"},{name:"Torino FC",country:"Italy",gender:"Men"},{name:"Udinese Calcio",country:"Italy",gender:"Men"},{name:"US Cremonese",country:"Italy",gender:"Men"},{name:"US Lecce",country:"Italy",gender:"Men"},{name:"US Salernitana 1919",country:"Italy",gender:"Men"},{name:"US Sassuolo Calcio",country:"Italy",gender:"Men"},{name:"Venezia FC",country:"Italy",gender:"Men"},{name:"ACF Fiorentina",country:"Italy",gender:"Women"},{name:"FC Como Women",country:"Italy",gender:"Women"},{name:"UC Sampdoria",country:"Italy",gender:"Women"},{name:"FC Aktobe",country:"Kazakhstan",gender:"Men"},{name:"FC Akzhayik",country:"Kazakhstan",gender:"Men"},{name:"FC Astana",country:"Kazakhstan",gender:"Men"},{name:"FC Kairat Almaty",country:"Kazakhstan",gender:"Men"},{name:"FC Shakhter Karagandy",country:"Kazakhstan",gender:"Men"},{name:"FK Yelimay Semey",country:"Kazakhstan",gender:"Men"},{name:"FC Okzhetpes Kokshetau",country:"Kazakhstan",gender:"Women"},{name:"FC Ordabasy Shymkent",country:"Kazakhstan",gender:"Women"},{name:"WFC BIIK-Shymkent",country:"Kazakhstan",gender:"Women"},{name:"FC Ballkani",country:"Kosovo",gender:"Men"},{name:"FC Drita",country:"Kosovo",gender:"Men"},{name:"FC Ferizaj",country:"Kosovo",gender:"Men"},{name:"FC Malisheva",country:"Kosovo",gender:"Men"},{name:"FC Prishtina",country:"Kosovo",gender:"Men"},{name:"FC Suhareka",country:"Kosovo",gender:"Men"},{name:"KF Dukagjini",country:"Kosovo",gender:"Men"},{name:"KF Feronikeli",country:"Kosovo",gender:"Men"},{name:"KF Liria",country:"Kosovo",gender:"Men"},{name:"KF Llapi 1932",country:"Kosovo",gender:"Men"},{name:"KF Prishtina e Re",country:"Kosovo",gender:"Men"},{name:"SC Gjilani",country:"Kosovo",gender:"Men"},{name:"KFF 16 Qershori",country:"Kosovo",gender:"Women"},{name:"KFF Bazeli 2015",country:"Kosovo",gender:"Women"},{name:"KFF Llapi Women",country:"Kosovo",gender:"Women"},{name:"KFF Mitrovica",country:"Kosovo",gender:"Women"},{name:"KFF Presingu",country:"Kosovo",gender:"Women"},{name:"KFF Ulpiana 1992",country:"Kosovo",gender:"Women"},{name:"KFV Prishtina",country:"Kosovo",gender:"Women"},{name:"WFC Hajvalia",country:"Kosovo",gender:"Women"},{name:"FK Auda",country:"Latvia",gender:"Men"},{name:"FK Liepāja",country:"Latvia",gender:"Men"},{name:"Riga FC",country:"Latvia",gender:"Men"},{name:"Valmiera FC",country:"Latvia",gender:"Men"},{name:"FC Vaduz",country:"Liechtenstein",gender:"Men"},{name:"Džiugas Telsiai",country:"Lithuania",gender:"Men"},{name:"FK Dainava",country:"Lithuania",gender:"Men"},{name:"FK Kauno Žalgiris",country:"Lithuania",gender:"Men"},{name:"FK Panevėžys",country:"Lithuania",gender:"Men"},{name:"FK Riteriai",country:"Lithuania",gender:"Men"},{name:"FK Sūduva",country:"Lithuania",gender:"Men"},{name:"FK Žalgiris Vilnius",country:"Lithuania",gender:"Men"},{name:"FC Gintra",country:"Lithuania",gender:"Women"},{name:"FK Utenis Utena",country:"Lithuania",gender:"Women"},{name:"AS Jeunesse Esch",country:"Luxembourg",gender:"Men"},{name:"Atert Bissen",country:"Luxembourg",gender:"Men"},{name:"CS Fola Esch",country:"Luxembourg",gender:"Men"},{name:"F91 Diddeleng",country:"Luxembourg",gender:"Men"},{name:"FC Differdange 03",country:"Luxembourg",gender:"Men"},{name:"FC Jeunesse Canach",country:"Luxembourg",gender:"Men"},{name:"FC Mamer 32",country:"Luxembourg",gender:"Men"},{name:"FC Mondercange",country:"Luxembourg",gender:"Men"},{name:"FC Progrès Niederkorn",country:"Luxembourg",gender:"Men"},{name:"FC Rodange 91",country:"Luxembourg",gender:"Men"},{name:"FC Schifflange 95",country:"Luxembourg",gender:"Men"},{name:"FC Swift Hesperange",country:"Luxembourg",gender:"Men"},{name:"FC UNA Strassen",country:"Luxembourg",gender:"Men"},{name:"FC Victoria Rosport",country:"Luxembourg",gender:"Men"},{name:"FC Wiltz 71",country:"Luxembourg",gender:"Men"},{name:"Marisca Mersch",country:"Luxembourg",gender:"Men"},{name:"Racing FC Union Luxembourg",country:"Luxembourg",gender:"Men"},{name:"SC Bettembourg",country:"Luxembourg",gender:"Men"},{name:"UN Käerjéng 97",country:"Luxembourg",gender:"Men"},{name:"Union Titus Pétange",country:"Luxembourg",gender:"Men"},{name:"US Hostert",country:"Luxembourg",gender:"Men"},{name:"US Mondorf-les-Bains",country:"Luxembourg",gender:"Men"},{name:"Entente Hosingen Norden Women",country:"Luxembourg",gender:"Women"},{name:"Entente Wormeldange WMG",country:"Luxembourg",gender:"Women"},{name:"FC Jeunesse Jonglënster",country:"Luxembourg",gender:"Women"},{name:"Balzan FC",country:"Malta",gender:"Men"},{name:"Birkirkara FC",country:"Malta",gender:"Men"},{name:"Floriana FC",country:"Malta",gender:"Men"},{name:"Gzira United FC",country:"Malta",gender:"Men"},{name:"Hamrun Spartans FC",country:"Malta",gender:"Men"},{name:"Hibernians FC",country:"Malta",gender:"Men"},{name:"Mosta FC",country:"Malta",gender:"Men"},{name:"Sliema Wanderers FC",country:"Malta",gender:"Men"},{name:"Zabbar St Patrick FC",country:"Malta",gender:"Men"},{name:"Swieqi United",country:"Malta",gender:"Women"},{name:"Valletta FC",country:"Malta",gender:"Women"},{name:"CS Dacia-Buiucani",country:"Moldova",gender:"Men"},{name:"FC Balti",country:"Moldova",gender:"Men"},{name:"FC Floresti",country:"Moldova",gender:"Men"},{name:"FC Milsami Orhei",country:"Moldova",gender:"Men"},{name:"FC Petrocub-Hincesti",country:"Moldova",gender:"Men"},{name:"FC Sheriff Tiraspol",country:"Moldova",gender:"Men"},{name:"FC Zimbru Chisinau",country:"Moldova",gender:"Men"},{name:"FC Mladost Donja Gorica",country:"Montenegro",gender:"Men"},{name:"FK Budućnost Podgorica",country:"Montenegro",gender:"Men"},{name:"FK Dečić",country:"Montenegro",gender:"Men"},{name:"FK Jedinstvo Bijelo Polje",country:"Montenegro",gender:"Men"},{name:"FK Jezero",country:"Montenegro",gender:"Men"},{name:"FK Mornar Bar",country:"Montenegro",gender:"Men"},{name:"FK Otrant Olympic",country:"Montenegro",gender:"Men"},{name:"FK Rudar Pljevlja",country:"Montenegro",gender:"Men"},{name:"FK Sutjeska",country:"Montenegro",gender:"Men"},{name:"FK Zeta",country:"Montenegro",gender:"Men"},{name:"OFK Petrovac",country:"Montenegro",gender:"Men"},{name:"OFK Titograd",country:"Montenegro",gender:"Men"},{name:"FK Breznica Pljevlja",country:"Montenegro",gender:"Women"},{name:"ŽFK Zora",country:"Montenegro",gender:"Women"},{name:"AFC Ajax",country:"Netherlands",gender:"Men"},{name:"Almere City FC",country:"Netherlands",gender:"Men"},{name:"AZ Alkmaar",country:"Netherlands",gender:"Men"},{name:"Excelsior Rotterdam",country:"Netherlands",gender:"Men"},{name:"FC Utrecht",country:"Netherlands",gender:"Men"},{name:"Feyenoord",country:"Netherlands",gender:"Men"},{name:"Go Ahead Eagles",country:"Netherlands",gender:"Men"},{name:"Heracles Almelo",country:"Netherlands",gender:"Men"},{name:"NEC Nijmegen",country:"Netherlands",gender:"Men"},{name:"PEC Zwolle",country:"Netherlands",gender:"Men"},{name:"PSV Eindhoven",country:"Netherlands",gender:"Men"},{name:"RKC Waalwijk",country:"Netherlands",gender:"Men"},{name:"SC Fortuna Sittard",country:"Netherlands",gender:"Men"},{name:"SC Heerenveen",country:"Netherlands",gender:"Men"},{name:"SC Telstar VVNH",country:"Netherlands",gender:"Men"},{name:"Sparta Rotterdam",country:"Netherlands",gender:"Men"},{name:"FC Twente",country:"Netherlands",gender:"Women"},{name:"Hera United",country:"Netherlands",gender:"Women"},{name:"FC AP Brera Strumica",country:"North Macedonia",gender:"Men"},{name:"FC Bashkimi 1947 Kumanovo",country:"North Macedonia",gender:"Men"},{name:"FC Shkupi 1927",country:"North Macedonia",gender:"Men"},{name:"FC Struga",country:"North Macedonia",gender:"Men"},{name:"FK Aresimi-1973 AD",country:"North Macedonia",gender:"Men"},{name:"FK Bregalnica Stip",country:"North Macedonia",gender:"Men"},{name:"FK Gostivar",country:"North Macedonia",gender:"Men"},{name:"FK Makedonija GP Skopje",country:"North Macedonia",gender:"Men"},{name:"FK Rabotnicki",country:"North Macedonia",gender:"Men"},{name:"FK Sileks Kratovo",country:"North Macedonia",gender:"Men"},{name:"FK Tikvesh",country:"North Macedonia",gender:"Men"},{name:"FK Vardar",country:"North Macedonia",gender:"Men"},{name:"FK Voska Sport",country:"North Macedonia",gender:"Men"},{name:"Football Club Pelister Bitola",country:"North Macedonia",gender:"Men"},{name:"KF Shkëndija",country:"North Macedonia",gender:"Men"},{name:"Kamenica Sasa",country:"North Macedonia",gender:"Women"},{name:"ZFK Cevitana Prilep",country:"North Macedonia",gender:"Women"},{name:"ZFK Istatov",country:"North Macedonia",gender:"Women"},{name:"ŽFK Ljuboten",country:"North Macedonia",gender:"Women"},{name:"ZFK Recica",country:"North Macedonia",gender:"Women"},{name:"ZFK Tiverija",country:"North Macedonia",gender:"Women"},{name:"Ballymena United FC",country:"Northern Ireland",gender:"Men"},{name:"Bangor FC",country:"Northern Ireland",gender:"Men"},{name:"Cliftonville FC",country:"Northern Ireland",gender:"Men"},{name:"Coleraine FC",country:"Northern Ireland",gender:"Men"},{name:"Crusaders FC",country:"Northern Ireland",gender:"Men"},{name:"Dungannon Swifts FC",country:"Northern Ireland",gender:"Men"},{name:"Glenavon FC",country:"Northern Ireland",gender:"Men"},{name:"Glentoran FC",country:"Northern Ireland",gender:"Men"},{name:"Larne FC",country:"Northern Ireland",gender:"Men"},{name:"Linfield FC",country:"Northern Ireland",gender:"Men"},{name:"Bryne FK",country:"Norway",gender:"Men"},{name:"FK Bodø/Glimt",country:"Norway",gender:"Men"},{name:"FK Haugesund",country:"Norway",gender:"Men"},{name:"Fredrikstad FK",country:"Norway",gender:"Men"},{name:"Kristiansund BK",country:"Norway",gender:"Men"},{name:"Molde FK",country:"Norway",gender:"Men"},{name:"Odds BK",country:"Norway",gender:"Men"},{name:"Rosenborg BK",country:"Norway",gender:"Men"},{name:"Sandefjord Fotball",country:"Norway",gender:"Men"},{name:"SK Brann",country:"Norway",gender:"Men"},{name:"Stabæk Fotball",country:"Norway",gender:"Men"},{name:"Strømsgodset",country:"Norway",gender:"Men"},{name:"Tromsø IL",country:"Norway",gender:"Men"},{name:"Viking FK",country:"Norway",gender:"Men"},{name:"Kolbotn",country:"Norway",gender:"Women"},{name:"Lillestrøm SK",country:"Norway",gender:"Women"},{name:"Røa IL",country:"Norway",gender:"Women"},{name:"Vålerenga Fotball",country:"Norway",gender:"Women"},{name:"Jagiellonia Białystok",country:"Poland",gender:"Men"},{name:"KKS Lech Poznań",country:"Poland",gender:"Men"},{name:"Korona Kielce",country:"Poland",gender:"Men"},{name:"KS Cracovia SA",country:"Poland",gender:"Men"},{name:"KS Lechia Gdańsk",country:"Poland",gender:"Men"},{name:"Legia Warszawa",country:"Poland",gender:"Men"},{name:"MKS Pogoń Szczecin",country:"Poland",gender:"Men"},{name:"MKS Puszcza Niepolomice",country:"Poland",gender:"Men"},{name:"Radomiak Radom",country:"Poland",gender:"Men"},{name:"Raków Czestochowa",country:"Poland",gender:"Men"},{name:"RTS Widzew Łódź",country:"Poland",gender:"Men"},{name:"Warta Poznań",country:"Poland",gender:"Men"},{name:"Wisła Kraków",country:"Poland",gender:"Men"},{name:"WKS Śląsk Wrocław",country:"Poland",gender:"Men"},{name:"GKS Górnik Leczna",country:"Poland",gender:"Women"},{name:"AVS Futebol SAD",country:"Portugal",gender:"Men"},{name:"Boavista FC",country:"Portugal",gender:"Men"},{name:"Casa Pia AC",country:"Portugal",gender:"Men"},{name:"CF Estrela da Amadora",country:"Portugal",gender:"Men"},{name:"CS Marítimo",country:"Portugal",gender:"Men"},{name:"Estoril Praia",country:"Portugal",gender:"Men"},{name:"FC Famalicao",country:"Portugal",gender:"Men"},{name:"FC Porto",country:"Portugal",gender:"Men"},{name:"FC Vizela",country:"Portugal",gender:"Men"},{name:"Gil Vicente FC",country:"Portugal",gender:"Men"},{name:"Rio Ave FC",country:"Portugal",gender:"Men"},{name:"SC Braga",country:"Portugal",gender:"Men"},{name:"SC Farense",country:"Portugal",gender:"Men"},{name:"SL Benfica",country:"Portugal",gender:"Men"},{name:"Sporting Clube de Portugal",country:"Portugal",gender:"Men"},{name:"Vitória SC",country:"Portugal",gender:"Men"},{name:"SCU Torreense",country:"Portugal",gender:"Women"},{name:"Valadares Gaia FC",country:"Portugal",gender:"Women"},{name:"CFR 1907 Cluj",country:"Romania",gender:"Men"},{name:"CSM Politehnica Iași",country:"Romania",gender:"Men"},{name:"FC Botosani",country:"Romania",gender:"Men"},{name:"FC Dinamo Bucureşti",country:"Romania",gender:"Men"},{name:"FC Otelul Galati",country:"Romania",gender:"Men"},{name:"FC Petrolul Ploiesti",country:"Romania",gender:"Men"},{name:"FC Rapid București",country:"Romania",gender:"Men"},{name:"FC Universitatea Cluj",country:"Romania",gender:"Men"},{name:"FC Voluntari",country:"Romania",gender:"Men"},{name:"FCSB",country:"Romania",gender:"Men"},{name:"FCV Farul Constanţa",country:"Romania",gender:"Men"},{name:"AFK Csikszereda Miercurea Ciuc",country:"Romania",gender:"Women"},{name:"CS Atletic Olimpia Gherla",country:"Romania",gender:"Women"},{name:"AC Juvenes-Dogana",country:"San Marino",gender:"Men"},{name:"AC Libertas",country:"San Marino",gender:"Men"},{name:"FC Fiorentino",country:"San Marino",gender:"Men"},{name:"La Fiorita 1967",country:"San Marino",gender:"Men"},{name:"SC Faetano",country:"San Marino",gender:"Men"},{name:"SP Cailungo",country:"San Marino",gender:"Men"},{name:"SP Tre Fiori",country:"San Marino",gender:"Men"},{name:"SP Tre Penne",country:"San Marino",gender:"Men"},{name:"SS Cosmos",country:"San Marino",gender:"Men"},{name:"SS Folgore",country:"San Marino",gender:"Men"},{name:"SS Murata",country:"San Marino",gender:"Men"},{name:"SS San Giovanni",country:"San Marino",gender:"Men"},{name:"SS Virtus",country:"San Marino",gender:"Men"},{name:"Aberdeen FC",country:"Scotland",gender:"Men"},{name:"Celtic FC",country:"Scotland",gender:"Men"},{name:"Dundee FC",country:"Scotland",gender:"Men"},{name:"Dundee United",country:"Scotland",gender:"Men"},{name:"Falkirk Football Club",country:"Scotland",gender:"Men"},{name:"Heart of Midlothian FC",country:"Scotland",gender:"Men"},{name:"Hibernian FC",country:"Scotland",gender:"Men"},{name:"Kilmarnock FC",country:"Scotland",gender:"Men"},{name:"Livingston FC",country:"Scotland",gender:"Men"},{name:"Motherwell FC",country:"Scotland",gender:"Men"},{name:"Rangers FC",country:"Scotland",gender:"Men"},{name:"Ross County FC",country:"Scotland",gender:"Men"},{name:"Spartans FC",country:"Scotland",gender:"Men"},{name:"St Johnstone FC",country:"Scotland",gender:"Men"},{name:"St Mirren Football Club",country:"Scotland",gender:"Men"},{name:"Glasgow City FC",country:"Scotland",gender:"Women"},{name:"Hamilton Academical WFC",country:"Scotland",gender:"Women"},{name:"Montrose FC Women",country:"Scotland",gender:"Women"},{name:"Partick Thistle Women's Football Club",country:"Scotland",gender:"Women"},{name:"FK Crvena Zvezda",country:"Serbia",gender:"Men"},{name:"FK Čukarički",country:"Serbia",gender:"Men"},{name:"FK IMT Beograd",country:"Serbia",gender:"Men"},{name:"FK Javor-Matis",country:"Serbia",gender:"Men"},{name:"FK Jedinstvo Ub",country:"Serbia",gender:"Men"},{name:"FK Mladost Lučani",country:"Serbia",gender:"Men"},{name:"FK Novi Pazar",country:"Serbia",gender:"Men"},{name:"FK Partizan",country:"Serbia",gender:"Men"},{name:"FK Radnički Niš",country:"Serbia",gender:"Men"},{name:"FK Radnik Surdulica",country:"Serbia",gender:"Men"},{name:"FK Spartak Subotica",country:"Serbia",gender:"Men"},{name:"FK Tekstilac Odžaci",country:"Serbia",gender:"Men"},{name:"FK Vojvodina",country:"Serbia",gender:"Men"},{name:"FK Voždovac",country:"Serbia",gender:"Men"},{name:"FK Železničar Pančevo",country:"Serbia",gender:"Men"},{name:"OFK Beograd",country:"Serbia",gender:"Men"},{name:"TSC Backa Topola",country:"Serbia",gender:"Men"},{name:"FK Napredak",country:"Serbia",gender:"Women"},{name:"ZFK Crvena Zvezda",country:"Serbia",gender:"Women"},{name:"ZFK Masinac Nis",country:"Serbia",gender:"Women"},{name:"ŽFK Milutniac 2023 Zemun",country:"Serbia",gender:"Women"},{name:"ZFK Sloga Zemun",country:"Serbia",gender:"Women"},{name:"ZFK Spartak Subotica",country:"Serbia",gender:"Women"},{name:"ŽFK TSC Kanjiža",country:"Serbia",gender:"Women"},{name:"AS Trenčín",country:"Slovakia",gender:"Men"},{name:"FC DAC 1904 Dunajská Streda",country:"Slovakia",gender:"Men"},{name:"FC Spartak Trnava",country:"Slovakia",gender:"Men"},{name:"FC ViOn Zlaté Moravce",country:"Slovakia",gender:"Men"},{name:"MFK Ružomberok",country:"Slovakia",gender:"Men"},{name:"MŠK Žilina",country:"Slovakia",gender:"Men"},{name:"ŠK Slovan Bratislava",country:"Slovakia",gender:"Men"},{name:"NK Bravo",country:"Slovenia",gender:"Men"},{name:"NK Celje",country:"Slovenia",gender:"Men"},{name:"NK Domžale",country:"Slovenia",gender:"Men"},{name:"NK Maribor",country:"Slovenia",gender:"Men"},{name:"NK Nafta 1903",country:"Slovenia",gender:"Men"},{name:"NK Olimpija Ljubljana",country:"Slovenia",gender:"Men"},{name:"NK Radomlje",country:"Slovenia",gender:"Men"},{name:"Rogaska",country:"Slovenia",gender:"Men"},{name:"FC Koper",country:"Slovenia",gender:"Women"},{name:"NK Aluminij",country:"Slovenia",gender:"Women"},{name:"NK Gazon",country:"Slovenia",gender:"Women"},{name:"NŠ Mura",country:"Slovenia",gender:"Women"},{name:"ZNK Cerklje",country:"Slovenia",gender:"Women"},{name:"ZNK Olimpija Ljubljana",country:"Slovenia",gender:"Women"},{name:"ZNK Primorje Ajdovscina",country:"Slovenia",gender:"Women"},{name:"Athletic Club",country:"Spain",gender:"Men"},{name:"Club Atlético de Madrid",country:"Spain",gender:"Men"},{name:"FC Barcelona",country:"Spain",gender:"Men"},{name:"Getafe CF",country:"Spain",gender:"Men"},{name:"Girona FC",country:"Spain",gender:"Men"},{name:"RC Celta de Vigo",country:"Spain",gender:"Men"},{name:"RCD Espanyol",country:"Spain",gender:"Men"},{name:"Real Betis Balompié",country:"Spain",gender:"Men"},{name:"Real Sociedad de Fútbol",country:"Spain",gender:"Men"},{name:"Real Zaragoza",country:"Spain",gender:"Men"},{name:"Sevilla FC",country:"Spain",gender:"Men"},{name:"Valencia CF",country:"Spain",gender:"Men"},{name:"Villarreal CF",country:"Spain",gender:"Men"},{name:"CD Tenerife Femenino",country:"Spain",gender:"Women"},{name:"FC Badalona Women",country:"Spain",gender:"Women"},{name:"Levante UD",country:"Spain",gender:"Women"},{name:"Madrid CFF",country:"Spain",gender:"Women"},{name:"Real Club Deportivo de La Coruña",country:"Spain",gender:"Women"},{name:"AIK",country:"Sweden",gender:"Men"},{name:"Djurgårdens IF",country:"Sweden",gender:"Men"},{name:"GAIS",country:"Sweden",gender:"Men"},{name:"Hammarby Fotboll",country:"Sweden",gender:"Men"},{name:"IF Brommapojkarna",country:"Sweden",gender:"Men"},{name:"IF Elfsborg",country:"Sweden",gender:"Men"},{name:"IFK Göteborg",country:"Sweden",gender:"Men"},{name:"IFK Norrköping",country:"Sweden",gender:"Men"},{name:"Malmö FF",country:"Sweden",gender:"Men"},{name:"Mjällby AIF",country:"Sweden",gender:"Men"},{name:"BK Häcken",country:"Sweden",gender:"Women"},{name:"FC Rosengård",country:"Sweden",gender:"Women"},{name:"Kristianstads DFF",country:"Sweden",gender:"Women"},{name:"Linköpings FC",country:"Sweden",gender:"Women"},{name:"Vittsjö GIK",country:"Sweden",gender:"Women"},{name:"BSC Young Boys",country:"Switzerland",gender:"Men"},{name:"FC Basel 1893",country:"Switzerland",gender:"Men"},{name:"FC Lausanne-Sport",country:"Switzerland",gender:"Men"},{name:"FC Lugano",country:"Switzerland",gender:"Men"},{name:"FC Sion",country:"Switzerland",gender:"Men"},{name:"FC St. Gallen 1879",country:"Switzerland",gender:"Men"},{name:"FC Stade-Lausanne-Ouchy",country:"Switzerland",gender:"Men"},{name:"FC Thun",country:"Switzerland",gender:"Men"},{name:"Grasshopper Club Zürich",country:"Switzerland",gender:"Men"},{name:"Yverdon Sport FC",country:"Switzerland",gender:"Men"},{name:"FC Aarau Frauen",country:"Switzerland",gender:"Women"},{name:"FC Luzern",country:"Switzerland",gender:"Women"},{name:"FC Rapperswil-Jona",country:"Switzerland",gender:"Women"},{name:"FC Zürich",country:"Switzerland",gender:"Women"},{name:"Frauenteam Thun Berner-Oberland",country:"Switzerland",gender:"Women"},{name:"Servette FC",country:"Switzerland",gender:"Women"},{name:"Adana Demirspor AS",country:"Turkey",gender:"Men"},{name:"Alanyaspor",country:"Turkey",gender:"Men"},{name:"Antalyaspor",country:"Turkey",gender:"Men"},{name:"Beşiktaş JK",country:"Turkey",gender:"Men"},{name:"Bodrum FK",country:"Turkey",gender:"Men"},{name:"Eyüpspor",country:"Turkey",gender:"Men"},{name:"Fatih Karagümrük AŞ",country:"Turkey",gender:"Men"},{name:"Fenerbahçe SK",country:"Turkey",gender:"Men"},{name:"Galatasaray AŞ",country:"Turkey",gender:"Men"},{name:"Gaziantep Futbol Kulübü AŞ",country:"Turkey",gender:"Men"},{name:"Göztepe SK",country:"Turkey",gender:"Men"},{name:"Hatayspor",country:"Turkey",gender:"Men"},{name:"İstanbul Başakşehir",country:"Turkey",gender:"Men"},{name:"Kasımpaşa SK",country:"Turkey",gender:"Men"},{name:"Kayserispor",country:"Turkey",gender:"Men"},{name:"Konyaspor",country:"Turkey",gender:"Men"},{name:"MKE Ankaragücü",country:"Turkey",gender:"Men"},{name:"Pendikspor",country:"Turkey",gender:"Men"},{name:"Rizespor",country:"Turkey",gender:"Men"},{name:"Samsunspor",country:"Turkey",gender:"Men"},{name:"Sivasspor",country:"Turkey",gender:"Men"},{name:"Trabzonspor AŞ",country:"Turkey",gender:"Men"},{name:"ABB Fomget SK",country:"Turkey",gender:"Women"},{name:"ALG Spor Kulübü",country:"Turkey",gender:"Women"},{name:"Amed Sportif Faaliyeteler Kulubu",country:"Turkey",gender:"Women"},{name:"Beylerbeyispor",country:"Turkey",gender:"Women"},{name:"Fatih Vatan Spor Kulübü",country:"Turkey",gender:"Women"},{name:"FC Chornomorets Odesa",country:"Ukraine",gender:"Men"},{name:"FC Dynamo Kyiv",country:"Ukraine",gender:"Men"},{name:"FC Karpaty Lviv",country:"Ukraine",gender:"Men"},{name:"FC Kryvbas Kryvyi Rih",country:"Ukraine",gender:"Men"},{name:"FC Metalist 1925 Kharkiv",country:"Ukraine",gender:"Men"},{name:"FC Oleksandriya",country:"Ukraine",gender:"Men"},{name:"FC Shakhtar Donetsk",country:"Ukraine",gender:"Men"},{name:"FC Zorya Luhansk",country:"Ukraine",gender:"Men"},{name:"NK Veres Rivne",country:"Ukraine",gender:"Men"},{name:"Polissya Zhytomyr",country:"Ukraine",gender:"Men"},{name:"FC Vorskla Poltava",country:"Ukraine",gender:"Women"},{name:"Ipswich Town Football Club",country:"England",gender:"Men"},{name:"Cardiff Metropolitan University FC",country:"Wales",gender:"Men"},{name:"Connah's Quay Nomads FC",country:"Wales",gender:"Men"},{name:"Llanelli Town AFC",country:"Wales",gender:"Men"},{name:"Penybont FC",country:"Wales",gender:"Men"},{name:"The New Saints FC",country:"Wales",gender:"Men"},{name:"Cardiff City FC",country:"Wales",gender:"Women"},{name:"Wrexham AFC",country:"Wales",gender:"Women"}],Lir=z_e.map(t=>t.name),_ze={"AFC Ajax":"https://crests.football-data.org/678.png","AC Milan":"https://crests.football-data.org/98.png","FC Internazionale Milano":"https://crests.football-data.org/108.png","SL Benfica":"https://crests.football-data.org/1903.png","FC Porto":"https://crests.football-data.org/503.png","Arsenal FC":"https://crests.football-data.org/57.png","Chelsea FC":"https://crests.football-data.org/61.png","Manchester City FC":"https://crests.football-data.org/65.png","FC Bayern München":"https://crests.football-data.org/5.png","Liverpool FC":"https://crests.football-data.org/64.png","Juventus FC":"https://crests.football-data.org/109.png","AC Sparta Praha":"https://crests.football-data.org/747.png","Sevilla FC":"https://crests.football-data.org/559.png","RB Leipzig":"https://crests.football-data.org/721.png","Celtic FC":"https://crests.football-data.org/732.png","Paris Saint-Germain":"https://crests.football-data.org/524.png","Borussia Dortmund":"https://crests.football-data.org/4.png","Atlético de Madrid":"https://crests.football-data.org/78.png"},ECt={"Bayern Munich":"FC Bayern München","Bayern München":"FC Bayern München","FC Bayern Munich":"FC Bayern München","Manchester City":"Manchester City FC","Man City":"Manchester City FC",Juventus:"Juventus FC","Inter Milan":"FC Internazionale Milano",Internazionale:"FC Internazionale Milano",Inter:"FC Internazionale Milano"};Object.fromEntries(z_e.map(t=>[t.name.toLowerCase(),t]));const Dir=t=>{let e=0;for(let n=0;n<t.length;n++)e=e*31+t.charCodeAt(n)>>>0;return e%360},$ir=t=>{const e=t.replace(/\(.*?\)/g,"").trim(),n=e.split(/\s+/).filter(s=>!/^(FC|AC|FK|SK|SC|HC|HSK|HNK|NK|GNK|ZNK|ŽNK|KF|CF|UE|CE|FS|US|RC|RSC|KAA|KAS|KRC|KV|KVC|PFC|OFC|WFC|ZFK|SFC|HŠK|FF|FFK|MFK|MK|TFC|GFC)$/i.test(s));return(n.length?n:e.split(/\s+/)).slice(0,2).map(s=>s.charAt(0).toUpperCase()).join("")},Oir=t=>{const e=ECt[t]??t??"",n=Dir(e),r=$ir(e)||"FC",i=`<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'><circle cx='32' cy='32' r='30' fill='${`hsl(${n}, 65%, 45%)`}' stroke='white' stroke-width='2'/><text x='50%' y='52%' text-anchor='middle' dominant-baseline='middle' font-family='Inter,Arial,sans-serif' font-size='22' font-weight='700' fill='white'>${r}</text></svg>`;return`data:image/svg+xml;utf8,${encodeURIComponent(i)}`},Fir=t=>{if(!t)return"";const e=ECt[t]??t;return _ze[e]?_ze[e]:Oir(e)},Bir={sm:"max-w-sm",md:"max-w-md",lg:"max-w-lg"};function q6({title:t,children:e,maxWidth:n="md",containerClassName:r,brandLogo:s,brandName:i,privacyPolicyLink:o,termsAndConditionsLink:l}){return a.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center px-4 py-10 sm:py-14 relative overflow-hidden",style:{background:Wct},children:[a.jsx("div",{className:"absolute inset-0 overflow-hidden opacity-[0.08] pointer-events-none",children:a.jsxs("svg",{className:"w-full h-full",viewBox:"0 0 1400 900",fill:"none",children:[a.jsx("path",{d:"M-100 500 Q200 300 500 500 Q800 700 1100 400 Q1300 200 1500 350",stroke:"white",strokeWidth:"2"}),a.jsx("path",{d:"M-50 600 Q250 400 550 600 Q850 800 1150 500 Q1350 300 1550 450",stroke:"white",strokeWidth:"1.5"}),a.jsx("path",{d:"M1400 100 Q1100 300 800 200 Q500 100 200 300 Q0 400 -100 350",stroke:"white",strokeWidth:"2"}),a.jsx("path",{d:"M1500 200 Q1200 400 900 300 Q600 200 300 400 Q100 500 -50 450",stroke:"white",strokeWidth:"1.5"})]})}),a.jsxs("div",{className:ee("relative z-10 w-full space-y-8 text-center",Bir[n],r),children:[a.jsxs("div",{className:"flex flex-col items-center gap-3",children:[a.jsx(bI,{sources:[s],fallbackSrc:J8,alt:i||"SpatialChat Communities",className:"h-24 w-24 mx-auto rounded-2xl bg-white p-3 shadow-lg object-contain",fallbackClassName:"h-24 w-24 mx-auto object-contain drop-shadow-lg"}),a.jsx("p",{className:"text-lg font-semibold tracking-tight text-white capitalize",children:i||"SpatialChat Communities"})]}),a.jsx("h1",{className:"text-2xl font-bold text-white",children:t}),e,(o||l)&&a.jsxs("div",{className:"flex items-center justify-center gap-4 text-xs text-white/70",children:[o&&a.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"underline-offset-2 hover:text-white hover:underline",children:"Privacy Policy"}),l&&a.jsx("a",{href:l,target:"_blank",rel:"noopener noreferrer",className:"underline-offset-2 hover:text-white hover:underline",children:"Terms & Conditions"})]})]})]})}function Aze({label:t,className:e,id:n,...r}){const s=n??(t?t.toLowerCase().replace(/\s+/g,"-"):void 0);return a.jsxs("div",{children:[t?a.jsx(_e,{htmlFor:s,className:"text-sm font-bold text-gray-900 mb-1 block",children:t}):null,a.jsx(Oe,{id:s,className:ee("w-full h-12 rounded-full bg-white/90 px-6 text-sm text-gray-900 placeholder:text-gray-500 focus-visible:ring-0 focus-visible:ring-offset-0 border-0",e),...r})]})}function Gde({label:t,value:e,onChange:n,placeholder:r,options:s,className:i,id:o,disabled:l}){const c=o??(t?t.toLowerCase().replace(/\s+/g,"-"):void 0);return a.jsxs("div",{children:[t?a.jsx(_e,{htmlFor:c,className:"text-sm font-bold text-gray-900 mb-1 block",children:t}):null,a.jsxs("div",{className:"relative",children:[a.jsxs("select",{id:c,value:e,onChange:d=>n(d.target.value),disabled:l,className:ee("w-full h-12 rounded-full bg-white/90 px-6 text-sm appearance-none focus:outline-none",i),style:{color:e?"#111":"#9ca3af"},children:[a.jsx("option",{value:"",disabled:!0,children:r}),s.map(d=>a.jsx("option",{value:d.value,children:d.label},d.value))]}),a.jsx(li,{className:"absolute right-5 top-1/2 -translate-y-1/2 h-5 w-5 text-gray-400 pointer-events-none"})]})]})}function Uir({label:t="Interests (choose 3):",tags:e,value:n,onChange:r,max:s=3}){const i=o=>{r(n.includes(o)?n.filter(l=>l!==o):n.length<s?[...n,o]:n)};return a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-bold text-gray-900 mb-1 block",children:t}),a.jsx("div",{className:"flex flex-wrap gap-2",children:e.map(o=>a.jsx("button",{type:"button",onClick:()=>i(o),className:ee("rounded-full px-4 py-1.5 text-xs font-medium transition-colors border",n.includes(o)?"bg-gray-900 text-white border-gray-900":"bg-white/80 text-gray-600 border-gray-300 hover:bg-white"),children:o},o))})]})}const zir=Lir,Vir=["Sport & Exercise Science","Nutrition","Sport Psychology","Sports Medicine & Physiotherapy","Strength & Conditioning","Fitness & Exercise Physiology","Recovery & Regeneration","Performance Analytics","Athlete Monitoring","Load Management","Biomechanics","Performance Technology","Injury Prevention","Rehabilitation","Return to Play","Mental Performance","Player Wellbeing","Coaching","Talent Development","Leadership","Management","Communication","Career Development","Education","Research & Innovation","AI in Sport","Sports Technology","Networking","Knowledge Sharing","Mentorship","Case Discussions","Workshops & Webinars","Continuous Professional Development","Sports Business","Club Operations","Media & Broadcasting","Other"],Hir=Mir,Gir=["Sport & Exercise Science","Nutrition","Sport Psychology","Sports Medicine & Physiotherapy","Strength & Power","Fitness & Exercise Physiology","Recovery and Regeneration","Networking","Leadership","Management","Career Development","Coaching","Education","Communication"];function Wir(){const t=Nn(),{toast:e}=yt(),{user:n,updateProfile:r}=jr(),[s,i]=y.useState(n?`${n.firstName} ${n.lastName}`.trim():""),[o,l]=y.useState(""),[c,d]=y.useState(""),[u,h]=y.useState(""),[m,f]=y.useState(""),[p,g]=y.useState([]),v=()=>{if(!s){e({title:"Please enter your name",variant:"destructive"});return}if(!o){e({title:"Please select a club",variant:"destructive"});return}if(!c){e({title:"Please select a position",variant:"destructive"});return}if(!u){e({title:"Please select a country",variant:"destructive"});return}if(u==="Other"&&!m.trim()){e({title:"Please enter your country",variant:"destructive"});return}if(p.length<1){e({title:"Please select at least 1 interest",variant:"destructive"});return}const[b,...x]=s.trim().split(" "),w=x.join(" ");r({firstName:b||(n==null?void 0:n.firstName)||"",lastName:w||(n==null?void 0:n.lastName)||"",club:o,position:c,country:u==="Other"?m.trim():u,role:c,interests:p}),e({title:"Profile saved!",description:"Welcome to the community."}),t(ve.welcome)};return a.jsxs(q6,{title:"Tell us about yourself",maxWidth:"lg",containerClassName:"space-y-6",children:[a.jsxs("div",{className:"space-y-4 text-left px-2",children:[a.jsx(Aze,{label:"Name",type:"text",placeholder:"Name",value:s,onChange:b=>i(b.target.value)}),a.jsx(Gde,{label:"Club",value:o,placeholder:"Select club",options:zir.map(b=>({label:b,value:b})),onChange:b=>{l(b);const x=z_e.find(w=>w.name===b);x!=null&&x.country&&h(x.country)}}),a.jsx(Gde,{label:"Title",value:c,placeholder:"Select position",options:Vir.map(b=>({label:b,value:b})),onChange:d}),a.jsxs("div",{children:[a.jsx(Gde,{label:"Country",value:u,placeholder:"Select country",options:[...Hir.map(b=>({label:b,value:b})),{label:"Other",value:"Other"}],onChange:h}),u==="Other"&&a.jsx(Aze,{className:"mt-2",type:"text",placeholder:"Enter your country",value:m,onChange:b=>f(b.target.value)})]}),a.jsx(Uir,{tags:Gir,value:p,onChange:g,max:3}),a.jsx("button",{onClick:v,className:"w-full h-12 rounded-full bg-gray-900 text-white text-sm font-semibold hover:bg-gray-800 transition-colors mt-2",children:"Continue"})]}),a.jsxs("p",{className:"text-sm font-bold text-gray-900 uppercase tracking-[0.2em] mt-6",children:["THE HEART",a.jsx("br",{}),"OF FOOTBALL"]})]})}const qir=[{name:"Amanda Kim",role:"Head of Medical & Performance",flag:"🇫🇷",team:"AC Milan",image:"https://images.unsplash.com/photo-1494790108377-be9c29b29330?w=200&h=200&fit=crop&crop=face"},{name:"James Wilson",role:"Director of Sports Science",flag:"🇩🇪",team:"Bayern Munich",image:"https://images.unsplash.com/photo-1472099645785-5658abf4ff4e?w=200&h=200&fit=crop&crop=face"},{name:"Daniel Brown",role:"Lead Performance Physiologist",flag:"🇩🇰",team:"Chelsea FC",image:"https://images.unsplash.com/photo-1507003211169-0a1dd7228f2d?w=200&h=200&fit=crop&crop=face"},{name:"Sarah Johnson",role:"Head of Athlete Health & Rehabilitation",flag:"🇩🇪",team:"Liverpool FC",image:"https://images.unsplash.com/photo-1438761681033-6461ffad8d80?w=200&h=200&fit=crop&crop=face"}],Kir=["Optimising Injury Rehabilitation","Psychological Strategies in Recovery","Nutrition for Peak Performance"];function Yir(){const t=Nn(),{toast:e}=yt(),[n,r]=y.useState(new Set),[s,i]=y.useState(new Set),o=c=>{n.has(c)?(r(d=>{const u=new Set(d);return u.delete(c),u}),e({title:"Disconnected",description:`Removed connection with ${c}.`})):(r(d=>new Set(d).add(c)),e({title:"Connected!",description:`You connected with ${c}.`}))},l=c=>{if(s.has(c)){e({title:"Already registered",description:`You're already registered for "${c}".`});return}i(d=>new Set(d).add(c)),e({title:"Registered!",description:`You've registered for "${c}".`})};return a.jsxs("div",{className:"min-h-screen px-6 py-8 relative overflow-hidden",style:{background:"linear-gradient(135deg, hsl(190, 90%, 55%), hsl(190, 80%, 60%) 30%, hsl(280, 40%, 65%) 60%, hsl(330, 70%, 55%))"},children:[a.jsx("div",{className:"absolute inset-0 overflow-hidden opacity-[0.08] pointer-events-none",children:a.jsx("svg",{className:"w-full h-full",viewBox:"0 0 1400 900",fill:"none",children:a.jsx("path",{d:"M-100 500 Q200 300 500 500 Q800 700 1100 400",stroke:"white",strokeWidth:"2"})})}),a.jsxs("div",{className:"relative z-10 max-w-6xl mx-auto",children:[a.jsxs("div",{className:"flex items-center justify-between mb-8",children:[a.jsx("img",{src:U_e,alt:"SpatialChat Communities logo",className:"h-20 w-20 object-contain"}),a.jsxs("p",{className:"text-sm font-bold text-gray-900 uppercase tracking-[0.2em] text-right",children:["THE HEART",a.jsx("br",{}),"OF FOOTBALL"]})]}),a.jsxs("div",{className:"flex gap-8",children:[a.jsxs("div",{className:"flex-1",children:[a.jsxs("h2",{className:"text-2xl font-bold text-gray-900 mb-6 leading-tight",children:["Community members recommended for you",a.jsx("br",{}),"based on your interests"]}),a.jsx("div",{className:"grid grid-cols-2 gap-4",children:qir.map(c=>{const d=Fir(c.team);return a.jsxs("div",{className:"bg-white rounded-xl p-5 space-y-3",children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("img",{src:c.image,alt:c.name,className:"h-14 w-14 rounded-full object-cover bg-gray-200",onError:u=>{u.target.style.display="none"}}),a.jsx("span",{className:"text-lg",children:c.flag})]}),d?a.jsx("img",{src:d,alt:c.team,className:"h-8 w-8 object-contain",onError:u=>{u.target.style.display="none"}}):a.jsx("div",{className:"h-8 w-8 rounded-full bg-gray-200"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"font-bold text-gray-900",children:c.name}),a.jsx("p",{className:"text-sm text-gray-500",children:c.role})]}),a.jsx("button",{onClick:()=>o(c.name),className:`px-5 py-1.5 rounded-full text-xs font-semibold transition-colors ${n.has(c.name)?"bg-green-600 text-white hover:bg-green-700":"bg-gray-900 text-white hover:bg-gray-800"}`,children:n.has(c.name)?"✓ Connected":"Connect"})]},c.name)})}),a.jsx("button",{onClick:()=>t("/introduce"),className:"mt-6 w-full h-12 rounded-full bg-gray-900 text-white text-sm font-semibold tracking-wider hover:bg-gray-800 transition-colors",children:"CONTINUE"})]}),a.jsxs("div",{className:"w-72",children:[a.jsx("h3",{className:"text-sm font-bold text-gray-900 uppercase tracking-wider mb-4",children:"Recommended for you"}),a.jsx("div",{className:"space-y-3",children:Kir.map(c=>a.jsxs("div",{className:"bg-white rounded-xl p-4 space-y-2",children:[a.jsx("p",{className:"font-bold text-gray-900 text-sm",children:c}),a.jsx("button",{onClick:()=>l(c),className:`px-4 py-1.5 rounded-full text-xs font-semibold transition-colors ${s.has(c)?"bg-green-600 text-white":"bg-gray-900 text-white hover:bg-gray-800"}`,children:s.has(c)?"✓ Registered":"Register now"})]},c))})]})]})]})]})}function NCt({label:t="or continue with"}){return a.jsxs("div",{className:"flex items-center gap-3 px-4",children:[a.jsx("div",{className:"flex-1 h-px bg-white/30"}),a.jsx("span",{className:"text-sm text-white/80 whitespace-nowrap",children:t}),a.jsx("div",{className:"flex-1 h-px bg-white/30"})]})}var Qir=Object.defineProperty,Zir=Object.defineProperties,Jir=Object.getOwnPropertyDescriptors,bZ=Object.getOwnPropertySymbols,TCt=Object.prototype.hasOwnProperty,_Ct=Object.prototype.propertyIsEnumerable,Pze=(t,e,n)=>e in t?Qir(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Xir=(t,e)=>{for(var n in e||(e={}))TCt.call(e,n)&&Pze(t,n,e[n]);if(bZ)for(var n of bZ(e))_Ct.call(e,n)&&Pze(t,n,e[n]);return t},ear=(t,e)=>Zir(t,Jir(e)),tar=(t,e)=>{var n={};for(var r in t)TCt.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&bZ)for(var r of bZ(t))e.indexOf(r)<0&&_Ct.call(t,r)&&(n[r]=t[r]);return n};function nar(t){let e=setTimeout(t,0),n=setTimeout(t,10),r=setTimeout(t,50);return[e,n,r]}function rar(t){let e=y.useRef();return y.useEffect(()=>{e.current=t}),e.current}var sar=18,ACt=40,iar=`${ACt}px`,aar=["[data-lastpass-icon-root]","com-1password-button","[data-dashlanecreated]",'[style$="2147483647 !important;"]'].join(",");function oar({containerRef:t,inputRef:e,pushPasswordManagerStrategy:n,isFocused:r}){let[s,i]=y.useState(!1),[o,l]=y.useState(!1),[c,d]=y.useState(!1),u=y.useMemo(()=>n==="none"?!1:(n==="increase-width"||n==="experimental-no-flickering")&&s&&o,[s,o,n]),h=y.useCallback(()=>{let m=t.current,f=e.current;if(!m||!f||c||n==="none")return;let p=m,g=p.getBoundingClientRect().left+p.offsetWidth,v=p.getBoundingClientRect().top+p.offsetHeight/2,b=g-sar,x=v;document.querySelectorAll(aar).length===0&&document.elementFromPoint(b,x)===m||(i(!0),d(!0))},[t,e,c,n]);return y.useEffect(()=>{let m=t.current;if(!m||n==="none")return;function f(){let g=window.innerWidth-m.getBoundingClientRect().right;l(g>=ACt)}f();let p=setInterval(f,1e3);return()=>{clearInterval(p)}},[t,n]),y.useEffect(()=>{let m=r||document.activeElement===e.current;if(n==="none"||!m)return;let f=setTimeout(h,0),p=setTimeout(h,2e3),g=setTimeout(h,5e3),v=setTimeout(()=>{d(!0)},6e3);return()=>{clearTimeout(f),clearTimeout(p),clearTimeout(g),clearTimeout(v)}},[e,r,n,h]),{hasPWMBadge:s,willPushPWMBadge:u,PWM_BADGE_SPACE_WIDTH:iar}}var PCt=y.createContext({}),RCt=y.forwardRef((t,e)=>{var n=t,{value:r,onChange:s,maxLength:i,textAlign:o="left",pattern:l,placeholder:c,inputMode:d="numeric",onComplete:u,pushPasswordManagerStrategy:h="increase-width",pasteTransformer:m,containerClassName:f,noScriptCSSFallback:p=lar,render:g,children:v}=n,b=tar(n,["value","onChange","maxLength","textAlign","pattern","placeholder","inputMode","onComplete","pushPasswordManagerStrategy","pasteTransformer","containerClassName","noScriptCSSFallback","render","children"]),x,w,k,S,C;let[j,E]=y.useState(typeof b.defaultValue=="string"?b.defaultValue:""),N=r??j,A=rar(N),_=y.useCallback(X=>{s==null||s(X),E(X)},[s]),T=y.useMemo(()=>l?typeof l=="string"?new RegExp(l):l:null,[l]),R=y.useRef(null),O=y.useRef(null),F=y.useRef({value:N,onChange:_,isIOS:typeof window<"u"&&((w=(x=window==null?void 0:window.CSS)==null?void 0:x.supports)==null?void 0:w.call(x,"-webkit-touch-callout","none"))}),D=y.useRef({prev:[(k=R.current)==null?void 0:k.selectionStart,(S=R.current)==null?void 0:S.selectionEnd,(C=R.current)==null?void 0:C.selectionDirection]});y.useImperativeHandle(e,()=>R.current,[]),y.useEffect(()=>{let X=R.current,Q=O.current;if(!X||!Q)return;F.current.value!==X.value&&F.current.onChange(X.value),D.current.prev=[X.selectionStart,X.selectionEnd,X.selectionDirection];function ie(){if(document.activeElement!==X){B(null),W(null);return}let J=X.selectionStart,K=X.selectionEnd,ce=X.selectionDirection,pe=X.maxLength,Ie=X.value,Me=D.current.prev,we=-1,Be=-1,Ve;if(Ie.length!==0&&J!==null&&K!==null){let Ke=J===K,De=J===Ie.length&&Ie.length<pe;if(Ke&&!De){let xt=J;if(xt===0)we=0,Be=1,Ve="forward";else if(xt===pe)we=xt-1,Be=xt,Ve="backward";else if(pe>1&&Ie.length>1){let Xe=0;if(Me[0]!==null&&Me[1]!==null){Ve=xt<Me[1]?"backward":"forward";let tt=Me[0]===Me[1]&&Me[0]<pe;Ve==="backward"&&!tt&&(Xe=-1)}we=Xe+xt,Be=Xe+xt+1}}we!==-1&&Be!==-1&&we!==Be&&R.current.setSelectionRange(we,Be,Ve)}let be=we!==-1?we:J,Ze=Be!==-1?Be:K,Pe=Ve??ce;B(be),W(Ze),D.current.prev=[be,Ze,Pe]}if(document.addEventListener("selectionchange",ie,{capture:!0}),ie(),document.activeElement===X&&z(!0),!document.getElementById("input-otp-style")){let J=document.createElement("style");if(J.id="input-otp-style",document.head.appendChild(J),J.sheet){let K="background: transparent !important; color: transparent !important; border-color: transparent !important; opacity: 0 !important; box-shadow: none !important; -webkit-box-shadow: none !important; -webkit-text-fill-color: transparent !important;";j3(J.sheet,"[data-input-otp]::selection { background: transparent !important; color: transparent !important; }"),j3(J.sheet,`[data-input-otp]:autofill { ${K} }`),j3(J.sheet,`[data-input-otp]:-webkit-autofill { ${K} }`),j3(J.sheet,"@supports (-webkit-touch-callout: none) { [data-input-otp] { letter-spacing: -.6em !important; font-weight: 100 !important; font-stretch: ultra-condensed; font-optical-sizing: none !important; left: -1px !important; right: 1px !important; } }"),j3(J.sheet,"[data-input-otp] + * { pointer-events: all !important; }")}}let he=()=>{Q&&Q.style.setProperty("--root-height",`${X.clientHeight}px`)};he();let ye=new ResizeObserver(he);return ye.observe(X),()=>{document.removeEventListener("selectionchange",ie,{capture:!0}),ye.disconnect()}},[]);let[I,P]=y.useState(!1),[M,z]=y.useState(!1),[G,B]=y.useState(null),[H,W]=y.useState(null);y.useEffect(()=>{nar(()=>{var X,Q,ie,he;(X=R.current)==null||X.dispatchEvent(new Event("input"));let ye=(Q=R.current)==null?void 0:Q.selectionStart,J=(ie=R.current)==null?void 0:ie.selectionEnd,K=(he=R.current)==null?void 0:he.selectionDirection;ye!==null&&J!==null&&(B(ye),W(J),D.current.prev=[ye,J,K])})},[N,M]),y.useEffect(()=>{A!==void 0&&N!==A&&A.length<i&&N.length===i&&(u==null||u(N))},[i,u,A,N]);let V=oar({containerRef:O,inputRef:R,pushPasswordManagerStrategy:h,isFocused:M}),U=y.useCallback(X=>{let Q=X.currentTarget.value.slice(0,i);if(Q.length>0&&T&&!T.test(Q)){X.preventDefault();return}typeof A=="string"&&Q.length<A.length&&document.dispatchEvent(new Event("selectionchange")),_(Q)},[i,_,A,T]),ne=y.useCallback(()=>{var X;if(R.current){let Q=Math.min(R.current.value.length,i-1),ie=R.current.value.length;(X=R.current)==null||X.setSelectionRange(Q,ie),B(Q),W(ie)}z(!0)},[i]),te=y.useCallback(X=>{var Q,ie;let he=R.current;if(!m&&(!F.current.isIOS||!X.clipboardData||!he))return;let ye=X.clipboardData.getData("text/plain"),J=m?m(ye):ye;X.preventDefault();let K=(Q=R.current)==null?void 0:Q.selectionStart,ce=(ie=R.current)==null?void 0:ie.selectionEnd,pe=(K!==ce?N.slice(0,K)+J+N.slice(ce):N.slice(0,K)+J+N.slice(K)).slice(0,i);if(pe.length>0&&T&&!T.test(pe))return;he.value=pe,_(pe);let Ie=Math.min(pe.length,i-1),Me=pe.length;he.setSelectionRange(Ie,Me),B(Ie),W(Me)},[i,_,T,N]),re=y.useMemo(()=>({position:"relative",cursor:b.disabled?"default":"text",userSelect:"none",WebkitUserSelect:"none",pointerEvents:"none"}),[b.disabled]),fe=y.useMemo(()=>({position:"absolute",inset:0,width:V.willPushPWMBadge?`calc(100% + ${V.PWM_BADGE_SPACE_WIDTH})`:"100%",clipPath:V.willPushPWMBadge?`inset(0 ${V.PWM_BADGE_SPACE_WIDTH} 0 0)`:void 0,height:"100%",display:"flex",textAlign:o,opacity:"1",color:"transparent",pointerEvents:"all",background:"transparent",caretColor:"transparent",border:"0 solid transparent",outline:"0 solid transparent",boxShadow:"none",lineHeight:"1",letterSpacing:"-.5em",fontSize:"var(--root-height)",fontFamily:"monospace",fontVariantNumeric:"tabular-nums"}),[V.PWM_BADGE_SPACE_WIDTH,V.willPushPWMBadge,o]),le=y.useMemo(()=>y.createElement("input",ear(Xir({autoComplete:b.autoComplete||"one-time-code"},b),{"data-input-otp":!0,"data-input-otp-placeholder-shown":N.length===0||void 0,"data-input-otp-mss":G,"data-input-otp-mse":H,inputMode:d,pattern:T==null?void 0:T.source,"aria-placeholder":c,style:fe,maxLength:i,value:N,ref:R,onPaste:X=>{var Q;te(X),(Q=b.onPaste)==null||Q.call(b,X)},onChange:U,onMouseOver:X=>{var Q;P(!0),(Q=b.onMouseOver)==null||Q.call(b,X)},onMouseLeave:X=>{var Q;P(!1),(Q=b.onMouseLeave)==null||Q.call(b,X)},onFocus:X=>{var Q;ne(),(Q=b.onFocus)==null||Q.call(b,X)},onBlur:X=>{var Q;z(!1),(Q=b.onBlur)==null||Q.call(b,X)}})),[U,ne,te,d,fe,i,H,G,b,T==null?void 0:T.source,N]),q=y.useMemo(()=>({slots:Array.from({length:i}).map((X,Q)=>{var ie;let he=M&&G!==null&&H!==null&&(G===H&&Q===G||Q>=G&&Q<H),ye=N[Q]!==void 0?N[Q]:null,J=N[0]!==void 0?null:(ie=c==null?void 0:c[Q])!=null?ie:null;return{char:ye,placeholderChar:J,isActive:he,hasFakeCaret:he&&ye===null}}),isFocused:M,isHovering:!b.disabled&&I}),[M,I,i,H,G,b.disabled,N]),Y=y.useMemo(()=>g?g(q):y.createElement(PCt.Provider,{value:q},v),[v,q,g]);return y.createElement(y.Fragment,null,p!==null&&y.createElement("noscript",null,y.createElement("style",null,p)),y.createElement("div",{ref:O,"data-input-otp-container":!0,style:re,className:f},Y,y.createElement("div",{style:{position:"absolute",inset:0,pointerEvents:"none"}},le)))});RCt.displayName="Input";function j3(t,e){try{t.insertRule(e)}catch{console.error("input-otp could not insert CSS rule:",e)}}var lar=`
[data-input-otp] {
  --nojs-bg: white !important;
  --nojs-fg: black !important;

  background-color: var(--nojs-bg) !important;
  color: var(--nojs-fg) !important;
  caret-color: var(--nojs-fg) !important;
  letter-spacing: .25em !important;
  text-align: center !important;
  border: 1px solid var(--nojs-fg) !important;
  border-radius: 4px !important;
  width: 100% !important;
}
@media (prefers-color-scheme: dark) {
  [data-input-otp] {
    --nojs-bg: black !important;
    --nojs-fg: white !important;
  }
}`;function car({index:t}){const{slots:e}=y.useContext(PCt),{char:n,hasFakeCaret:r,isActive:s}=e[t],i=!!n;return a.jsxs("div",{className:ee("relative flex h-14 w-11 sm:w-12 items-center justify-center rounded-xl","border text-xl font-semibold tabular-nums tracking-widest transition-all duration-200 ease-out","border-white/20 bg-white/10 text-white shadow-[inset_0_1px_0_rgba(255,255,255,0.15)] backdrop-blur-md","hover:border-white/35 hover:bg-white/15",i&&"border-white/90 bg-white text-[hsl(217,91%,42%)] shadow-[0_8px_24px_rgba(0,0,0,0.12)] scale-[1.02]",s&&!i&&"border-white/50 bg-white/20 shadow-[0_0_0_3px_rgba(255,255,255,0.18)] scale-[1.03]"),children:[a.jsx("span",{className:ee("transition-opacity duration-150",i?"opacity-100":"opacity-90"),children:n}),r?a.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:a.jsx("div",{className:"h-6 w-0.5 animate-pulse rounded-full bg-white/90"})}):null]})}function dar({value:t,onChange:e,disabled:n,onComplete:r,autoFocus:s}){return a.jsx(RCt,{maxLength:4,value:t,onChange:e,disabled:n,onComplete:r,autoFocus:s,inputMode:"numeric",containerClassName:"flex items-center justify-center gap-3 sm:gap-4",className:"disabled:cursor-not-allowed disabled:opacity-60",children:a.jsx("div",{className:"flex items-center gap-3 sm:gap-4",children:[0,1,2,3].map(i=>a.jsx(car,{index:i},i))})})}function uar(t,e=window.location.hostname){const n=t.toLowerCase();return n===e.toLowerCase()||n==="localhost"||n.endsWith(".localhost")||Object.values(Fct).includes(n)?!0:Oct.some(r=>{if(!n.endsWith(`.${r}`))return!1;const s=n.slice(0,-(r.length+1));return s!==""&&s!=="www"&&!s.includes(".")})}function har(t){if(t.protocol==="https:")return!0;const e=t.hostname.toLowerCase();return t.protocol==="http:"&&(e==="localhost"||e==="127.0.0.1"||e.endsWith(".localhost"))}function ICt(t){const e=Nn(),{toast:n}=yt(),{clearCommunity:r}=qe();return y.useCallback(s=>{lh(t==="signup"?"signup":"login",{email:s});const i=()=>n({title:t==="signup"?"Welcome!":"Welcome back!"}),o=new URLSearchParams(window.location.search).get("redirect");if(o){if(o.startsWith("/")&&!o.startsWith("//")){i(),e(o,{replace:!0});return}try{const l=new URL(o);if(har(l)&&uar(l.hostname)){const c=Nd();c&&l.searchParams.set("token",c),window.location.href=l.toString();return}}catch{}}if(odt()||wo.devCommunitySubdomain){i(),e(ve.home,{replace:!0});return}r(),n({title:t==="signup"?"Welcome!":"Welcome back!",description:"Choose your community to continue."}),e(ve.communities,{replace:!0})},[t,e,n,r])}const mar=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function MCt(t){return mar.test(t.trim())}function far(){const t=new URLSearchParams(window.location.search).get("email");return t&&MCt(t)?t:""}function LCt({mode:t,onStepChange:e,communityId:n}){const[r,s]=y.useState("email"),[i,o]=y.useState(far),[l,c]=y.useState(""),[d,u]=y.useState(!1),[h,m]=y.useState(0),{requestEmailOtp:f,verifyEmailOtp:p}=jr(),{toast:g}=yt(),v=ICt(t),b=(S,C)=>g({title:S,description:C,variant:"destructive"});y.useEffect(()=>{e==null||e(r)},[r,e]),y.useEffect(()=>{if(h<=0)return;const S=setInterval(()=>m(C=>C-1),1e3);return()=>clearInterval(S)},[h>0]);const x=async()=>{const S=i.trim();if(!S){b("Please enter your email address");return}if(!MCt(S)){b("Please enter a valid email address");return}u(!0);try{await f(S,n??null),s("otp"),m(30),g({title:"Check your email",description:`We sent a 4-digit code to ${S}.`,duration:7e3})}catch(C){b("Couldn't send the code",dn(C,"We couldn't send your verification code. Please try again."))}finally{u(!1)}},w=async()=>{if(!d){u(!0);try{await f(i.trim(),n??null),c(""),m(30),g({title:"Code re-sent",description:`We sent a new 4-digit code to ${i.trim()}.`,duration:7e3})}catch(S){b("Couldn't resend the code",dn(S,"We couldn't send a new code. Please try again."))}finally{u(!1)}}},k=async(S=l)=>{if(!d){if(S.length!==4){b("Enter the 4-digit code from your email");return}u(!0);try{await p(i.trim(),S,n??null),v(i)}catch(C){b("Couldn't verify the code",dn(C,"That code didn't work. Please check it and try again."))}finally{u(!1)}}};return r==="otp"?a.jsx("div",{className:"px-2 sm:px-4",children:a.jsxs("div",{className:"space-y-6 rounded-2xl border border-white/20 bg-white/10 p-6 shadow-[0_12px_40px_rgba(0,55,150,0.15)] backdrop-blur-xl",children:[a.jsxs("div",{className:"space-y-2 text-center",children:[a.jsx("p",{className:"text-sm font-medium text-white/95",children:"Enter the verification code"}),a.jsx("p",{className:"inline-block max-w-full truncate rounded-full bg-white/15 px-3 py-1 text-xs text-white/80 backdrop-blur-sm",children:i})]}),a.jsx(dar,{value:l,onChange:c,disabled:d,onComplete:k,autoFocus:!0}),a.jsxs("div",{className:"space-y-3 pt-1",children:[a.jsx(Z,{type:"button",className:"h-12 w-full rounded-full border-0 bg-white font-semibold text-[hsl(217,91%,42%)] shadow-lg shadow-blue-900/20 transition-all duration-200 hover:bg-white/95 hover:shadow-xl active:scale-[0.99] disabled:opacity-50",onClick:()=>k(),disabled:d||l.length!==4,children:d?"Verifying…":"Verify & continue"}),a.jsx(Z,{type:"button",variant:"ghost",className:"h-10 w-full rounded-full text-sm text-white/75 hover:bg-white/10 hover:text-white",disabled:d||h>0,onClick:w,children:h>0?`Resend code in ${h}s`:"Resend code"}),a.jsx(Z,{type:"button",variant:"ghost",className:"h-10 w-full rounded-full text-sm text-white/75 hover:bg-white/10 hover:text-white",disabled:d,onClick:()=>{s("email"),c("")},children:"Use a different email"})]})]})}):a.jsxs("div",{className:"space-y-3 px-4 text-left",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"auth-email",className:"text-sm font-bold text-gray-900",children:"Email"}),a.jsx(Oe,{id:"auth-email",type:"email",inputMode:"email",autoComplete:"email",placeholder:"Email address",value:i,disabled:d,className:"h-12 rounded-full bg-white/90 px-6 border-0 text-gray-900 placeholder:text-gray-500",onChange:S=>o(S.target.value),onKeyDown:S=>S.key==="Enter"&&!d&&x()})]}),a.jsx(Z,{type:"button",className:"w-full h-12 rounded-full font-semibold tracking-wider",onClick:x,disabled:d,children:d?"Sending code…":"Continue with email"}),null]})}function par({className:t}){return a.jsxs("svg",{className:ee("h-5 w-5",t),viewBox:"0 0 24 24","aria-hidden":!0,children:[a.jsx("path",{fill:"#4285F4",d:"M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"}),a.jsx("path",{fill:"#34A853",d:"M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"}),a.jsx("path",{fill:"#FBBC05",d:"M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"}),a.jsx("path",{fill:"#EA4335",d:"M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"})]})}function gar({className:t}){return a.jsx("svg",{className:ee("h-5 w-5",t),viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":!0,children:a.jsx("path",{d:"M17.05 20.28c-.98.95-2.05.88-3.08.4-1.09-.5-2.08-.48-3.24 0-1.44.62-2.2.44-3.06-.4C2.79 15.25 3.51 7.59 9.05 7.31c1.35.07 2.29.74 3.08.8 1.18-.24 2.31-.93 3.57-.84 1.51.12 2.65.72 3.4 1.8-3.12 1.87-2.38 5.98.48 7.13-.57 1.5-1.31 2.99-2.54 4.09l.01-.01zM12.03 7.25c-.15-2.23 1.66-4.07 3.74-4.25.29 2.58-2.34 4.5-3.74 4.25z"})})}const yar={google:{label:"Continue with Google",className:"bg-white/90 text-gray-900 hover:bg-white",icon:a.jsx(par,{})},apple:{label:"Continue with Apple",className:"bg-gray-900 text-white hover:bg-gray-800",icon:a.jsx(gar,{})}};function Rze({provider:t,disabled:e,loading:n,onClick:r}){const s=yar[t];return a.jsxs("button",{type:"button",disabled:e||n,onClick:r,className:ee("w-full h-12 rounded-full flex items-center justify-center gap-3 px-6 text-sm font-semibold transition-colors disabled:opacity-60 disabled:cursor-not-allowed",s.className),children:[s.icon,a.jsx("span",{children:n?"Please wait…":s.label})]})}const Ize="google_code",Mze="google_error",DCt="Please try again, or continue with email instead.";function bar(t){switch(t){case"cancelled":return{title:"Google sign-in cancelled",description:"You can try again or use email instead."};case"expired":return{title:"Google sign-in timed out",description:"That took too long, or was opened in another browser. Please try again.",variant:"destructive"};case"unavailable":return{title:"Google sign-in unavailable",description:"Please continue with email instead.",variant:"destructive"};default:return{title:"Google sign-in failed",description:DCt,variant:"destructive"}}}function $Ct({mode:t,disabled:e,hideGoogle:n,hideApple:r,communityId:s}){const[i,o]=y.useState(!1),[l,c]=y.useState(!1),{startAppleLogin:d,startGoogleLogin:u,completeGoogleLogin:h}=jr(),{toast:m}=yt(),f=ICt(t),[,p]=xc();y.useEffect(()=>{const x=new URLSearchParams(window.location.search),w=x.get(Ize),k=x.get(Mze);if(!(!w&&!k)){if(x.delete(Ize),x.delete(Mze),p(x,{replace:!0}),!w){m(bar(k??""));return}c(!0),h(w).then(()=>{var S;return f(((S=ro())==null?void 0:S.email)??"")}).catch(S=>{c(!1),m({title:"Google sign-in failed",description:dn(S,DCt),variant:"destructive"})})}},[]),y.useEffect(()=>{const x=w=>{w.persisted&&(c(!1),o(!1))};return window.addEventListener("pageshow",x),()=>window.removeEventListener("pageshow",x)},[]);const g=()=>{c(!0),u(s??null,t)},v=()=>{o(!0),d(s??null)},b=e||i||l;return a.jsxs("div",{className:"space-y-3 px-4",children:[!n&&a.jsx(Rze,{provider:"google",loading:l,disabled:b,onClick:g}),!r&&a.jsx(Rze,{provider:"apple",loading:i,disabled:b,onClick:v})]})}function OCt(){return a.jsxs("p",{className:"text-sm font-medium text-white/90 leading-relaxed max-w-xs mx-auto",children:[NDe.line1,a.jsx("br",{}),NDe.line2]})}function FCt(){const t=odt()??wo.devCommunitySubdomain??null,e=lt({queryKey:["auth-page-community",t],queryFn:()=>Zee(t),enabled:!!t,select:n=>n.community,staleTime:5*6e4,retry:!1});return{community:e.data??null,loading:!!t&&e.isLoading}}function xar(){const[t,e]=y.useState("email"),n=Di(),{community:r,loading:s}=FCt(),i=typeof(r==null?void 0:r.authRedirectUrl)=="string"?r.authRedirectUrl:"";if(y.useEffect(()=>{i&&window.location.replace(i)},[i]),s||i)return a.jsx(q6,{title:"Sign in",maxWidth:"md",children:a.jsx("p",{className:"text-sm text-white/80",children:i?"Redirecting you to sign in…":"Loading…"})});const o=(r==null?void 0:r.configuration)??{},l=!!o.disableEmailLogin,c=!!o.disableGoogleLogin,d=!!o.disableAppleLogin;return a.jsxs(q6,{title:t==="otp"?"Verify email":"Sign in",maxWidth:"md",brandLogo:r==null?void 0:r.logo,brandName:r==null?void 0:r.name,privacyPolicyLink:r==null?void 0:r.privacyPolicyLink,termsAndConditionsLink:r==null?void 0:r.termsAndConditionsLink,children:[l&&c&&d?a.jsx("p",{className:"px-4 text-sm text-white/85",children:"Sign-in is disabled for this community. Please contact the community admin."}):a.jsxs(a.Fragment,{children:[l?null:a.jsx(LCt,{mode:"signin",onStepChange:e,communityId:(r==null?void 0:r.id)??null}),t==="email"?a.jsxs(a.Fragment,{children:[l?null:a.jsx(NCt,{}),c&&d?null:a.jsx($Ct,{mode:"signin",hideGoogle:c,hideApple:d,communityId:(r==null?void 0:r.id)??null})]}):null]}),t==="email"?a.jsxs(a.Fragment,{children:[a.jsx(OCt,{}),a.jsxs("p",{className:"text-sm text-white/80",children:["Don't have an account?"," ",a.jsx(vr,{to:{pathname:ve.signUp,search:n.search},className:"text-white underline font-medium",children:"Sign up"})]})]}):null]})}function war(){const[t,e]=y.useState("email"),n=Di(),{community:r,loading:s}=FCt(),i=typeof(r==null?void 0:r.authRedirectUrl)=="string"?r.authRedirectUrl:"";if(y.useEffect(()=>{i&&window.location.replace(i)},[i]),s||i)return a.jsx(q6,{title:"Sign up",maxWidth:"md",children:a.jsx("p",{className:"text-sm text-white/80",children:i?"Redirecting you to sign in…":"Loading…"})});const o=(r==null?void 0:r.configuration)??{},l=!!o.disableEmailLogin,c=!!o.disableGoogleLogin,d=!!o.disableAppleLogin;return a.jsxs(q6,{title:t==="otp"?"Verify email":"Sign up",maxWidth:"md",brandLogo:r==null?void 0:r.logo,brandName:r==null?void 0:r.name,privacyPolicyLink:r==null?void 0:r.privacyPolicyLink,termsAndConditionsLink:r==null?void 0:r.termsAndConditionsLink,children:[l&&c&&d?a.jsx("p",{className:"px-4 text-sm text-white/85",children:"Sign-up is disabled for this community. Please contact the community admin."}):a.jsxs(a.Fragment,{children:[l?null:a.jsx(LCt,{mode:"signup",onStepChange:e,communityId:(r==null?void 0:r.id)??null}),t==="email"?a.jsxs(a.Fragment,{children:[l?null:a.jsx(NCt,{}),c&&d?null:a.jsx($Ct,{mode:"signup",hideGoogle:c,hideApple:d,communityId:(r==null?void 0:r.id)??null})]}):null]}),t==="email"?a.jsxs(a.Fragment,{children:[a.jsx(OCt,{}),a.jsxs("p",{className:"text-sm text-white/80",children:["Already have an account?"," ",a.jsx(vr,{to:{pathname:ve.signIn,search:n.search},className:"text-white underline font-medium",children:"Sign in"})]})]}):null]})}function kar(){const t=Nn(),[e,n]=y.useState(!1),[r,s]=y.useState(null),{toast:i}=yt();return a.jsxs("div",{className:"min-h-screen flex flex-col items-center justify-center px-4 relative overflow-hidden",style:{background:"linear-gradient(135deg, hsl(190, 90%, 55%), hsl(190, 80%, 60%) 30%, hsl(280, 40%, 65%) 60%, hsl(330, 70%, 55%))"},children:[a.jsx("div",{className:"absolute inset-0 overflow-hidden opacity-[0.08] pointer-events-none",children:a.jsx("svg",{className:"w-full h-full",viewBox:"0 0 1400 900",fill:"none",children:a.jsx("path",{d:"M-100 500 Q200 300 500 500 Q800 700 1100 400 Q1300 200 1500 350",stroke:"white",strokeWidth:"2"})})}),a.jsxs("div",{className:"relative z-10 w-full max-w-md space-y-4 text-center",children:[a.jsxs("div",{onClick:()=>s("welcome"),className:"w-full h-24 rounded-xl bg-gradient-to-r from-gray-800 to-gray-700 flex items-center justify-center gap-3 cursor-pointer hover:opacity-90 transition-opacity",children:[a.jsx("span",{className:"text-cyan-300 text-xl font-bold tracking-wider",children:"WELCOME"}),a.jsx("div",{className:"h-10 w-10 rounded-full bg-white/20 flex items-center justify-center",children:a.jsx(fm,{className:"h-5 w-5 text-white fill-white"})}),a.jsx("img",{src:U_e,alt:"SpatialChat Communities",className:"h-12 w-12 object-contain opacity-60"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("button",{onClick:()=>s("conduct"),className:"h-24 rounded-xl flex flex-col items-center justify-center gap-2 cursor-pointer hover:opacity-90 transition-opacity",style:{background:"linear-gradient(135deg, hsl(190, 80%, 60%), hsl(330, 70%, 60%))"},children:[a.jsxs("span",{className:"text-white text-xs font-bold tracking-wider leading-tight",children:["CODE OF",a.jsx("br",{}),"CONDUCT"]}),a.jsx("div",{className:"h-7 w-7 rounded-full bg-white/20 flex items-center justify-center",children:a.jsx(fm,{className:"h-3.5 w-3.5 text-white fill-white"})})]}),a.jsxs("button",{onClick:()=>s("tour"),className:"h-24 rounded-xl flex flex-col items-center justify-center gap-2 cursor-pointer hover:opacity-90 transition-opacity",style:{background:"linear-gradient(135deg, hsl(190, 80%, 60%), hsl(330, 70%, 60%))"},children:[a.jsxs("span",{className:"text-white text-xs font-bold tracking-wider leading-tight",children:["TOUR OF THE",a.jsx("br",{}),"PLATFORM"]}),a.jsx("div",{className:"h-7 w-7 rounded-full bg-white/20 flex items-center justify-center",children:a.jsx(fm,{className:"h-3.5 w-3.5 text-white fill-white"})})]})]}),a.jsxs("label",{className:"flex items-center gap-2 text-left cursor-pointer",children:[a.jsx("input",{type:"checkbox",checked:e,onChange:o=>n(o.target.checked),className:"h-4 w-4 rounded border-gray-400"}),a.jsx("span",{className:"text-sm text-gray-900",children:"Accept code of conduct"})]}),a.jsx("button",{onClick:()=>t("/recommendations"),disabled:!e,className:"w-full h-12 rounded-full bg-gray-900 text-white text-sm font-semibold tracking-wider hover:bg-gray-800 transition-colors disabled:opacity-50 disabled:cursor-not-allowed",children:"CONTINUE"}),a.jsxs("p",{className:"text-sm font-bold text-gray-900 uppercase tracking-[0.2em] mt-4",children:["THE HEART",a.jsx("br",{}),"OF FOOTBALL"]})]}),a.jsx(Bt,{open:!!r,onOpenChange:o=>!o&&s(null),children:a.jsxs(Ft,{className:"sm:max-w-lg",children:[a.jsx(Vt,{children:a.jsxs(Ut,{children:[r==="welcome"&&"Welcome to SpatialChat Communities",r==="conduct"&&"Code of conduct",r==="tour"&&"Platform tour"]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"w-full h-64 rounded-lg bg-gray-900 flex items-center justify-center",children:a.jsxs("div",{className:"text-center",children:[a.jsx("div",{className:"h-16 w-16 rounded-full bg-white/10 flex items-center justify-center mx-auto mb-3",children:a.jsx(fm,{className:"h-8 w-8 text-white fill-white"})}),a.jsx("p",{className:"text-white/60 text-sm",children:"Video content would play here"})]})}),r==="conduct"&&a.jsxs("div",{className:"text-sm text-muted-foreground space-y-2",children:[a.jsx("p",{children:a.jsx("strong",{children:"Our community values:"})}),a.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[a.jsx("li",{children:"Treat all members with respect and professionalism"}),a.jsx("li",{children:"Share knowledge openly and constructively"}),a.jsx("li",{children:"Maintain confidentiality of sensitive information"}),a.jsx("li",{children:"Support evidence-based discussions"}),a.jsx("li",{children:"Report any inappropriate behaviour to moderators"})]})]}),r==="tour"&&a.jsxs("div",{className:"text-sm text-muted-foreground space-y-2",children:[a.jsx("p",{children:a.jsx("strong",{children:"Platform features:"})}),a.jsxs("ul",{className:"list-disc pl-5 space-y-1",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"Feed"})," — Share posts, research, and discussions"]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Course"})," — Access courses and learning materials"]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Networking"})," — Connect with professionals worldwide"]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Events"})," — Join webinars, workshops, and conferences"]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Leaderboard"})," — Track your MPU points and badges"]})]})]}),a.jsx("button",{onClick:()=>{r==="conduct"&&(n(!0),i({title:"Code of conduct viewed",description:"You can now proceed."})),s(null)},className:"w-full h-10 rounded-full bg-gray-900 text-white text-sm font-semibold hover:bg-gray-800 transition-colors",children:r==="conduct"?"Accept & close":"Close"})]})]})})]})}var HB=t=>t.type==="checkbox",Ej=t=>t instanceof Date,yu=t=>t==null;const BCt=t=>typeof t=="object";var Tl=t=>!yu(t)&&!Array.isArray(t)&&BCt(t)&&!Ej(t),UCt=t=>Tl(t)&&t.target?HB(t.target)?t.target.checked:t.target.value:t,Sar=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,zCt=(t,e)=>t.has(Sar(e)),Car=t=>{const e=t.constructor&&t.constructor.prototype;return Tl(e)&&e.hasOwnProperty("isPrototypeOf")},V_e=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function oc(t){let e;const n=Array.isArray(t),r=typeof FileList<"u"?t instanceof FileList:!1;if(t instanceof Date)e=new Date(t);else if(!(V_e&&(t instanceof Blob||r))&&(n||Tl(t)))if(e=n?[]:{},!n&&!Car(t))e=t;else for(const s in t)t.hasOwnProperty(s)&&(e[s]=oc(t[s]));else return t;return e}var Kre=t=>/^\w*$/.test(t),vl=t=>t===void 0,H_e=t=>Array.isArray(t)?t.filter(Boolean):[],G_e=t=>H_e(t.replace(/["|']|\]/g,"").split(/\.|\[/)),Mn=(t,e,n)=>{if(!e||!Tl(t))return n;const r=(Kre(e)?[e]:G_e(e)).reduce((s,i)=>yu(s)?s:s[i],t);return vl(r)||r===t?vl(t[e])?n:t[e]:r},am=t=>typeof t=="boolean",Oi=(t,e,n)=>{let r=-1;const s=Kre(e)?[e]:G_e(e),i=s.length,o=i-1;for(;++r<i;){const l=s[r];let c=n;if(r!==o){const d=t[l];c=Tl(d)||Array.isArray(d)?d:isNaN(+s[r+1])?{}:[]}if(l==="__proto__"||l==="constructor"||l==="prototype")return;t[l]=c,t=t[l]}};const xZ={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},hg={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},gb={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},W_e=se.createContext(null);W_e.displayName="HookFormContext";const Yre=()=>se.useContext(W_e),jar=t=>{const{children:e,...n}=t;return se.createElement(W_e.Provider,{value:n},e)};var VCt=(t,e,n,r=!0)=>{const s={defaultValues:e._defaultValues};for(const i in t)Object.defineProperty(s,i,{get:()=>{const o=i;return e._proxyFormState[o]!==hg.all&&(e._proxyFormState[o]=!r||hg.all),n&&(n[o]=!0),t[o]}});return s};const q_e=typeof window<"u"?se.useLayoutEffect:se.useEffect;function Ear(t){const e=Yre(),{control:n=e.control,disabled:r,name:s,exact:i}=t||{},[o,l]=se.useState(n._formState),c=se.useRef({isDirty:!1,isLoading:!1,dirtyFields:!1,touchedFields:!1,validatingFields:!1,isValidating:!1,isValid:!1,errors:!1});return q_e(()=>n._subscribe({name:s,formState:c.current,exact:i,callback:d=>{!r&&l({...n._formState,...d})}}),[s,r,i]),se.useEffect(()=>{c.current.isValid&&n._setValid(!0)},[n]),se.useMemo(()=>VCt(o,n,c.current,!1),[o,n])}var iy=t=>typeof t=="string",HCt=(t,e,n,r,s)=>iy(t)?(r&&e.watch.add(t),Mn(n,t,s)):Array.isArray(t)?t.map(i=>(r&&e.watch.add(i),Mn(n,i))):(r&&(e.watchAll=!0),n),Axe=t=>yu(t)||!BCt(t);function tx(t,e,n=new WeakSet){if(Axe(t)||Axe(e))return t===e;if(Ej(t)&&Ej(e))return t.getTime()===e.getTime();const r=Object.keys(t),s=Object.keys(e);if(r.length!==s.length)return!1;if(n.has(t)||n.has(e))return!0;n.add(t),n.add(e);for(const i of r){const o=t[i];if(!s.includes(i))return!1;if(i!=="ref"){const l=e[i];if(Ej(o)&&Ej(l)||Tl(o)&&Tl(l)||Array.isArray(o)&&Array.isArray(l)?!tx(o,l,n):o!==l)return!1}}return!0}function Nar(t){const e=Yre(),{control:n=e.control,name:r,defaultValue:s,disabled:i,exact:o,compute:l}=t||{},c=se.useRef(s),d=se.useRef(l),u=se.useRef(void 0);d.current=l;const h=se.useMemo(()=>n._getWatch(r,c.current),[n,r]),[m,f]=se.useState(d.current?d.current(h):h);return q_e(()=>n._subscribe({name:r,formState:{values:!0},exact:o,callback:p=>{if(!i){const g=HCt(r,n._names,p.values||n._formValues,!1,c.current);if(d.current){const v=d.current(g);tx(v,u.current)||(f(v),u.current=v)}else f(g)}}}),[n,i,r,o]),se.useEffect(()=>n._removeUnmounted()),m}function Tar(t){const e=Yre(),{name:n,disabled:r,control:s=e.control,shouldUnregister:i,defaultValue:o}=t,l=zCt(s._names.array,n),c=se.useMemo(()=>Mn(s._formValues,n,Mn(s._defaultValues,n,o)),[s,n,o]),d=Nar({control:s,name:n,defaultValue:c,exact:!0}),u=Ear({control:s,name:n,exact:!0}),h=se.useRef(t),m=se.useRef(s.register(n,{...t.rules,value:d,...am(t.disabled)?{disabled:t.disabled}:{}}));h.current=t;const f=se.useMemo(()=>Object.defineProperties({},{invalid:{enumerable:!0,get:()=>!!Mn(u.errors,n)},isDirty:{enumerable:!0,get:()=>!!Mn(u.dirtyFields,n)},isTouched:{enumerable:!0,get:()=>!!Mn(u.touchedFields,n)},isValidating:{enumerable:!0,get:()=>!!Mn(u.validatingFields,n)},error:{enumerable:!0,get:()=>Mn(u.errors,n)}}),[u,n]),p=se.useCallback(x=>m.current.onChange({target:{value:UCt(x),name:n},type:xZ.CHANGE}),[n]),g=se.useCallback(()=>m.current.onBlur({target:{value:Mn(s._formValues,n),name:n},type:xZ.BLUR}),[n,s._formValues]),v=se.useCallback(x=>{const w=Mn(s._fields,n);w&&x&&(w._f.ref={focus:()=>x.focus&&x.focus(),select:()=>x.select&&x.select(),setCustomValidity:k=>x.setCustomValidity(k),reportValidity:()=>x.reportValidity()})},[s._fields,n]),b=se.useMemo(()=>({name:n,value:d,...am(r)||u.disabled?{disabled:u.disabled||r}:{},onChange:p,onBlur:g,ref:v}),[n,r,u.disabled,p,g,v,d]);return se.useEffect(()=>{const x=s._options.shouldUnregister||i;s.register(n,{...h.current.rules,...am(h.current.disabled)?{disabled:h.current.disabled}:{}});const w=(k,S)=>{const C=Mn(s._fields,k);C&&C._f&&(C._f.mount=S)};if(w(n,!0),x){const k=oc(Mn(s._options.defaultValues,n));Oi(s._defaultValues,n,k),vl(Mn(s._formValues,n))&&Oi(s._formValues,n,k)}return!l&&s.register(n),()=>{(l?x&&!s._state.action:x)?s.unregister(n):w(n,!1)}},[n,s,l,i]),se.useEffect(()=>{s._setDisabledField({disabled:r,name:n})},[r,n,s]),se.useMemo(()=>({field:b,formState:u,fieldState:f}),[b,u,f])}const _ar=t=>t.render(Tar(t));var GCt=(t,e,n,r,s)=>e?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:s||!0}}:{},S$=t=>Array.isArray(t)?t:[t],Lze=()=>{let t=[];return{get observers(){return t},next:s=>{for(const i of t)i.next&&i.next(s)},subscribe:s=>(t.push(s),{unsubscribe:()=>{t=t.filter(i=>i!==s)}}),unsubscribe:()=>{t=[]}}},nh=t=>Tl(t)&&!Object.keys(t).length,K_e=t=>t.type==="file",mg=t=>typeof t=="function",wZ=t=>{if(!V_e)return!1;const e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},WCt=t=>t.type==="select-multiple",Y_e=t=>t.type==="radio",Aar=t=>Y_e(t)||HB(t),Wde=t=>wZ(t)&&t.isConnected;function Par(t,e){const n=e.slice(0,-1).length;let r=0;for(;r<n;)t=vl(t)?r++:t[e[r++]];return t}function Rar(t){for(const e in t)if(t.hasOwnProperty(e)&&!vl(t[e]))return!1;return!0}function Vl(t,e){const n=Array.isArray(e)?e:Kre(e)?[e]:G_e(e),r=n.length===1?t:Par(t,n),s=n.length-1,i=n[s];return r&&delete r[i],s!==0&&(Tl(r)&&nh(r)||Array.isArray(r)&&Rar(r))&&Vl(t,n.slice(0,-1)),t}var qCt=t=>{for(const e in t)if(mg(t[e]))return!0;return!1};function kZ(t,e={}){const n=Array.isArray(t);if(Tl(t)||n)for(const r in t)Array.isArray(t[r])||Tl(t[r])&&!qCt(t[r])?(e[r]=Array.isArray(t[r])?[]:{},kZ(t[r],e[r])):yu(t[r])||(e[r]=!0);return e}function KCt(t,e,n){const r=Array.isArray(t);if(Tl(t)||r)for(const s in t)Array.isArray(t[s])||Tl(t[s])&&!qCt(t[s])?vl(e)||Axe(n[s])?n[s]=Array.isArray(t[s])?kZ(t[s],[]):{...kZ(t[s])}:KCt(t[s],yu(e)?{}:e[s],n[s]):n[s]=!tx(t[s],e[s]);return n}var E3=(t,e)=>KCt(t,e,kZ(e));const Dze={value:!1,isValid:!1},$ze={value:!0,isValid:!0};var YCt=t=>{if(Array.isArray(t)){if(t.length>1){const e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!vl(t[0].attributes.value)?vl(t[0].value)||t[0].value===""?$ze:{value:t[0].value,isValid:!0}:$ze:Dze}return Dze},QCt=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>vl(t)?t:e?t===""?NaN:t&&+t:n&&iy(t)?new Date(t):r?r(t):t;const Oze={isValid:!1,value:null};var ZCt=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,Oze):Oze;function Fze(t){const e=t.ref;return K_e(e)?e.files:Y_e(e)?ZCt(t.refs).value:WCt(e)?[...e.selectedOptions].map(({value:n})=>n):HB(e)?YCt(t.refs).value:QCt(vl(e.value)?t.ref.value:e.value,t)}var Iar=(t,e,n,r)=>{const s={};for(const i of t){const o=Mn(e,i);o&&Oi(s,i,o._f)}return{criteriaMode:n,names:[...t],fields:s,shouldUseNativeValidation:r}},SZ=t=>t instanceof RegExp,N3=t=>vl(t)?t:SZ(t)?t.source:Tl(t)?SZ(t.value)?t.value.source:t.value:t,Bze=t=>({isOnSubmit:!t||t===hg.onSubmit,isOnBlur:t===hg.onBlur,isOnChange:t===hg.onChange,isOnAll:t===hg.all,isOnTouch:t===hg.onTouched});const Uze="AsyncFunction";var Mar=t=>!!t&&!!t.validate&&!!(mg(t.validate)&&t.validate.constructor.name===Uze||Tl(t.validate)&&Object.values(t.validate).find(e=>e.constructor.name===Uze)),Lar=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate),zze=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length))));const C$=(t,e,n,r)=>{for(const s of n||Object.keys(t)){const i=Mn(t,s);if(i){const{_f:o,...l}=i;if(o){if(o.refs&&o.refs[0]&&e(o.refs[0],s)&&!r)return!0;if(o.ref&&e(o.ref,o.name)&&!r)return!0;if(C$(l,e))break}else if(Tl(l)&&C$(l,e))break}}};function Vze(t,e,n){const r=Mn(t,n);if(r||Kre(n))return{error:r,name:n};const s=n.split(".");for(;s.length;){const i=s.join("."),o=Mn(e,i),l=Mn(t,i);if(o&&!Array.isArray(o)&&n!==i)return{name:n};if(l&&l.type)return{name:i,error:l};if(l&&l.root&&l.root.type)return{name:`${i}.root`,error:l.root};s.pop()}return{name:n}}var Dar=(t,e,n,r)=>{n(t);const{name:s,...i}=t;return nh(i)||Object.keys(i).length>=Object.keys(e).length||Object.keys(i).find(o=>e[o]===(!r||hg.all))},$ar=(t,e,n)=>!t||!e||t===e||S$(t).some(r=>r&&(n?r===e:r.startsWith(e)||e.startsWith(r))),Oar=(t,e,n,r,s)=>s.isOnAll?!1:!n&&s.isOnTouch?!(e||t):(n?r.isOnBlur:s.isOnBlur)?!t:(n?r.isOnChange:s.isOnChange)?t:!0,Far=(t,e)=>!H_e(Mn(t,e)).length&&Vl(t,e),Bar=(t,e,n)=>{const r=S$(Mn(t,n));return Oi(r,"root",e[n]),Oi(t,n,r),t},lq=t=>iy(t);function Hze(t,e,n="validate"){if(lq(t)||Array.isArray(t)&&t.every(lq)||am(t)&&!t)return{type:n,message:lq(t)?t:"",ref:e}}var ST=t=>Tl(t)&&!SZ(t)?t:{value:t,message:""},Gze=async(t,e,n,r,s,i)=>{const{ref:o,refs:l,required:c,maxLength:d,minLength:u,min:h,max:m,pattern:f,validate:p,name:g,valueAsNumber:v,mount:b}=t._f,x=Mn(n,g);if(!b||e.has(g))return{};const w=l?l[0]:o,k=T=>{s&&w.reportValidity&&(w.setCustomValidity(am(T)?"":T||""),w.reportValidity())},S={},C=Y_e(o),j=HB(o),E=C||j,N=(v||K_e(o))&&vl(o.value)&&vl(x)||wZ(o)&&o.value===""||x===""||Array.isArray(x)&&!x.length,A=GCt.bind(null,g,r,S),_=(T,R,O,F=gb.maxLength,D=gb.minLength)=>{const I=T?R:O;S[g]={type:T?F:D,message:I,ref:o,...A(T?F:D,I)}};if(i?!Array.isArray(x)||!x.length:c&&(!E&&(N||yu(x))||am(x)&&!x||j&&!YCt(l).isValid||C&&!ZCt(l).isValid)){const{value:T,message:R}=lq(c)?{value:!!c,message:c}:ST(c);if(T&&(S[g]={type:gb.required,message:R,ref:w,...A(gb.required,R)},!r))return k(R),S}if(!N&&(!yu(h)||!yu(m))){let T,R;const O=ST(m),F=ST(h);if(!yu(x)&&!isNaN(x)){const D=o.valueAsNumber||x&&+x;yu(O.value)||(T=D>O.value),yu(F.value)||(R=D<F.value)}else{const D=o.valueAsDate||new Date(x),I=z=>new Date(new Date().toDateString()+" "+z),P=o.type=="time",M=o.type=="week";iy(O.value)&&x&&(T=P?I(x)>I(O.value):M?x>O.value:D>new Date(O.value)),iy(F.value)&&x&&(R=P?I(x)<I(F.value):M?x<F.value:D<new Date(F.value))}if((T||R)&&(_(!!T,O.message,F.message,gb.max,gb.min),!r))return k(S[g].message),S}if((d||u)&&!N&&(iy(x)||i&&Array.isArray(x))){const T=ST(d),R=ST(u),O=!yu(T.value)&&x.length>+T.value,F=!yu(R.value)&&x.length<+R.value;if((O||F)&&(_(O,T.message,R.message),!r))return k(S[g].message),S}if(f&&!N&&iy(x)){const{value:T,message:R}=ST(f);if(SZ(T)&&!x.match(T)&&(S[g]={type:gb.pattern,message:R,ref:o,...A(gb.pattern,R)},!r))return k(R),S}if(p){if(mg(p)){const T=await p(x,n),R=Hze(T,w);if(R&&(S[g]={...R,...A(gb.validate,R.message)},!r))return k(R.message),S}else if(Tl(p)){let T={};for(const R in p){if(!nh(T)&&!r)break;const O=Hze(await p[R](x,n),w,R);O&&(T={...O,...A(R,O.message)},k(O.message),r&&(S[g]=T))}if(!nh(T)&&(S[g]={ref:w,...T},!r))return S}}return k(!0),S};const Uar={mode:hg.onSubmit,reValidateMode:hg.onChange,shouldFocusError:!0};function zar(t={}){let e={...Uar,...t},n={submitCount:0,isDirty:!1,isReady:!1,isLoading:mg(e.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},validatingFields:{},errors:e.errors||{},disabled:e.disabled||!1},r={},s=Tl(e.defaultValues)||Tl(e.values)?oc(e.defaultValues||e.values)||{}:{},i=e.shouldUnregister?{}:oc(s),o={action:!1,mount:!1,watch:!1},l={mount:new Set,disabled:new Set,unMount:new Set,array:new Set,watch:new Set},c,d=0;const u={isDirty:!1,dirtyFields:!1,validatingFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1};let h={...u};const m={array:Lze(),state:Lze()},f=e.criteriaMode===hg.all,p=K=>ce=>{clearTimeout(d),d=setTimeout(K,ce)},g=async K=>{if(!e.disabled&&(u.isValid||h.isValid||K)){const ce=e.resolver?nh((await j()).errors):await N(r,!0);ce!==n.isValid&&m.state.next({isValid:ce})}},v=(K,ce)=>{!e.disabled&&(u.isValidating||u.validatingFields||h.isValidating||h.validatingFields)&&((K||Array.from(l.mount)).forEach(pe=>{pe&&(ce?Oi(n.validatingFields,pe,ce):Vl(n.validatingFields,pe))}),m.state.next({validatingFields:n.validatingFields,isValidating:!nh(n.validatingFields)}))},b=(K,ce=[],pe,Ie,Me=!0,we=!0)=>{if(Ie&&pe&&!e.disabled){if(o.action=!0,we&&Array.isArray(Mn(r,K))){const Be=pe(Mn(r,K),Ie.argA,Ie.argB);Me&&Oi(r,K,Be)}if(we&&Array.isArray(Mn(n.errors,K))){const Be=pe(Mn(n.errors,K),Ie.argA,Ie.argB);Me&&Oi(n.errors,K,Be),Far(n.errors,K)}if((u.touchedFields||h.touchedFields)&&we&&Array.isArray(Mn(n.touchedFields,K))){const Be=pe(Mn(n.touchedFields,K),Ie.argA,Ie.argB);Me&&Oi(n.touchedFields,K,Be)}(u.dirtyFields||h.dirtyFields)&&(n.dirtyFields=E3(s,i)),m.state.next({name:K,isDirty:_(K,ce),dirtyFields:n.dirtyFields,errors:n.errors,isValid:n.isValid})}else Oi(i,K,ce)},x=(K,ce)=>{Oi(n.errors,K,ce),m.state.next({errors:n.errors})},w=K=>{n.errors=K,m.state.next({errors:n.errors,isValid:!1})},k=(K,ce,pe,Ie)=>{const Me=Mn(r,K);if(Me){const we=Mn(i,K,vl(pe)?Mn(s,K):pe);vl(we)||Ie&&Ie.defaultChecked||ce?Oi(i,K,ce?we:Fze(Me._f)):O(K,we),o.mount&&g()}},S=(K,ce,pe,Ie,Me)=>{let we=!1,Be=!1;const Ve={name:K};if(!e.disabled){if(!pe||Ie){(u.isDirty||h.isDirty)&&(Be=n.isDirty,n.isDirty=Ve.isDirty=_(),we=Be!==Ve.isDirty);const be=tx(Mn(s,K),ce);Be=!!Mn(n.dirtyFields,K),be?Vl(n.dirtyFields,K):Oi(n.dirtyFields,K,!0),Ve.dirtyFields=n.dirtyFields,we=we||(u.dirtyFields||h.dirtyFields)&&Be!==!be}if(pe){const be=Mn(n.touchedFields,K);be||(Oi(n.touchedFields,K,pe),Ve.touchedFields=n.touchedFields,we=we||(u.touchedFields||h.touchedFields)&&be!==pe)}we&&Me&&m.state.next(Ve)}return we?Ve:{}},C=(K,ce,pe,Ie)=>{const Me=Mn(n.errors,K),we=(u.isValid||h.isValid)&&am(ce)&&n.isValid!==ce;if(e.delayError&&pe?(c=p(()=>x(K,pe)),c(e.delayError)):(clearTimeout(d),c=null,pe?Oi(n.errors,K,pe):Vl(n.errors,K)),(pe?!tx(Me,pe):Me)||!nh(Ie)||we){const Be={...Ie,...we&&am(ce)?{isValid:ce}:{},errors:n.errors,name:K};n={...n,...Be},m.state.next(Be)}},j=async K=>{v(K,!0);const ce=await e.resolver(i,e.context,Iar(K||l.mount,r,e.criteriaMode,e.shouldUseNativeValidation));return v(K),ce},E=async K=>{const{errors:ce}=await j(K);if(K)for(const pe of K){const Ie=Mn(ce,pe);Ie?Oi(n.errors,pe,Ie):Vl(n.errors,pe)}else n.errors=ce;return ce},N=async(K,ce,pe={valid:!0})=>{for(const Ie in K){const Me=K[Ie];if(Me){const{_f:we,...Be}=Me;if(we){const Ve=l.array.has(we.name),be=Me._f&&Mar(Me._f);be&&u.validatingFields&&v([Ie],!0);const Ze=await Gze(Me,l.disabled,i,f,e.shouldUseNativeValidation&&!ce,Ve);if(be&&u.validatingFields&&v([Ie]),Ze[we.name]&&(pe.valid=!1,ce))break;!ce&&(Mn(Ze,we.name)?Ve?Bar(n.errors,Ze,we.name):Oi(n.errors,we.name,Ze[we.name]):Vl(n.errors,we.name))}!nh(Be)&&await N(Be,ce,pe)}}return pe.valid},A=()=>{for(const K of l.unMount){const ce=Mn(r,K);ce&&(ce._f.refs?ce._f.refs.every(pe=>!Wde(pe)):!Wde(ce._f.ref))&&ne(K)}l.unMount=new Set},_=(K,ce)=>!e.disabled&&(K&&ce&&Oi(i,K,ce),!tx(z(),s)),T=(K,ce,pe)=>HCt(K,l,{...o.mount?i:vl(ce)?s:iy(K)?{[K]:ce}:ce},pe,ce),R=K=>H_e(Mn(o.mount?i:s,K,e.shouldUnregister?Mn(s,K,[]):[])),O=(K,ce,pe={})=>{const Ie=Mn(r,K);let Me=ce;if(Ie){const we=Ie._f;we&&(!we.disabled&&Oi(i,K,QCt(ce,we)),Me=wZ(we.ref)&&yu(ce)?"":ce,WCt(we.ref)?[...we.ref.options].forEach(Be=>Be.selected=Me.includes(Be.value)):we.refs?HB(we.ref)?we.refs.forEach(Be=>{(!Be.defaultChecked||!Be.disabled)&&(Array.isArray(Me)?Be.checked=!!Me.find(Ve=>Ve===Be.value):Be.checked=Me===Be.value||!!Me)}):we.refs.forEach(Be=>Be.checked=Be.value===Me):K_e(we.ref)?we.ref.value="":(we.ref.value=Me,we.ref.type||m.state.next({name:K,values:oc(i)})))}(pe.shouldDirty||pe.shouldTouch)&&S(K,Me,pe.shouldTouch,pe.shouldDirty,!0),pe.shouldValidate&&M(K)},F=(K,ce,pe)=>{for(const Ie in ce){if(!ce.hasOwnProperty(Ie))return;const Me=ce[Ie],we=K+"."+Ie,Be=Mn(r,we);(l.array.has(K)||Tl(Me)||Be&&!Be._f)&&!Ej(Me)?F(we,Me,pe):O(we,Me,pe)}},D=(K,ce,pe={})=>{const Ie=Mn(r,K),Me=l.array.has(K),we=oc(ce);Oi(i,K,we),Me?(m.array.next({name:K,values:oc(i)}),(u.isDirty||u.dirtyFields||h.isDirty||h.dirtyFields)&&pe.shouldDirty&&m.state.next({name:K,dirtyFields:E3(s,i),isDirty:_(K,we)})):Ie&&!Ie._f&&!yu(we)?F(K,we,pe):O(K,we,pe),zze(K,l)&&m.state.next({...n,name:K}),m.state.next({name:o.mount?K:void 0,values:oc(i)})},I=async K=>{o.mount=!0;const ce=K.target;let pe=ce.name,Ie=!0;const Me=Mn(r,pe),we=be=>{Ie=Number.isNaN(be)||Ej(be)&&isNaN(be.getTime())||tx(be,Mn(i,pe,be))},Be=Bze(e.mode),Ve=Bze(e.reValidateMode);if(Me){let be,Ze;const Pe=ce.type?Fze(Me._f):UCt(K),Ke=K.type===xZ.BLUR||K.type===xZ.FOCUS_OUT,De=!Lar(Me._f)&&!e.resolver&&!Mn(n.errors,pe)&&!Me._f.deps||Oar(Ke,Mn(n.touchedFields,pe),n.isSubmitted,Ve,Be),xt=zze(pe,l,Ke);Oi(i,pe,Pe),Ke?(Me._f.onBlur&&Me._f.onBlur(K),c&&c(0)):Me._f.onChange&&Me._f.onChange(K);const Xe=S(pe,Pe,Ke),tt=!nh(Xe)||xt;if(!Ke&&m.state.next({name:pe,type:K.type,values:oc(i)}),De)return(u.isValid||h.isValid)&&(e.mode==="onBlur"?Ke&&g():Ke||g()),tt&&m.state.next({name:pe,...xt?{}:Xe});if(!Ke&&xt&&m.state.next({...n}),e.resolver){const{errors:$e}=await j([pe]);if(we(Pe),Ie){const wt=Vze(n.errors,r,pe),Ee=Vze($e,r,wt.name||pe);be=Ee.error,pe=Ee.name,Ze=nh($e)}}else v([pe],!0),be=(await Gze(Me,l.disabled,i,f,e.shouldUseNativeValidation))[pe],v([pe]),we(Pe),Ie&&(be?Ze=!1:(u.isValid||h.isValid)&&(Ze=await N(r,!0)));Ie&&(Me._f.deps&&M(Me._f.deps),C(pe,Ze,be,Xe))}},P=(K,ce)=>{if(Mn(n.errors,ce)&&K.focus)return K.focus(),1},M=async(K,ce={})=>{let pe,Ie;const Me=S$(K);if(e.resolver){const we=await E(vl(K)?K:Me);pe=nh(we),Ie=K?!Me.some(Be=>Mn(we,Be)):pe}else K?(Ie=(await Promise.all(Me.map(async we=>{const Be=Mn(r,we);return await N(Be&&Be._f?{[we]:Be}:Be)}))).every(Boolean),!(!Ie&&!n.isValid)&&g()):Ie=pe=await N(r);return m.state.next({...!iy(K)||(u.isValid||h.isValid)&&pe!==n.isValid?{}:{name:K},...e.resolver||!K?{isValid:pe}:{},errors:n.errors}),ce.shouldFocus&&!Ie&&C$(r,P,K?Me:l.mount),Ie},z=K=>{const ce={...o.mount?i:s};return vl(K)?ce:iy(K)?Mn(ce,K):K.map(pe=>Mn(ce,pe))},G=(K,ce)=>({invalid:!!Mn((ce||n).errors,K),isDirty:!!Mn((ce||n).dirtyFields,K),error:Mn((ce||n).errors,K),isValidating:!!Mn(n.validatingFields,K),isTouched:!!Mn((ce||n).touchedFields,K)}),B=K=>{K&&S$(K).forEach(ce=>Vl(n.errors,ce)),m.state.next({errors:K?n.errors:{}})},H=(K,ce,pe)=>{const Ie=(Mn(r,K,{_f:{}})._f||{}).ref,Me=Mn(n.errors,K)||{},{ref:we,message:Be,type:Ve,...be}=Me;Oi(n.errors,K,{...be,...ce,ref:Ie}),m.state.next({name:K,errors:n.errors,isValid:!1}),pe&&pe.shouldFocus&&Ie&&Ie.focus&&Ie.focus()},W=(K,ce)=>mg(K)?m.state.subscribe({next:pe=>"values"in pe&&K(T(void 0,ce),pe)}):T(K,ce,!0),V=K=>m.state.subscribe({next:ce=>{$ar(K.name,ce.name,K.exact)&&Dar(ce,K.formState||u,he,K.reRenderRoot)&&K.callback({values:{...i},...n,...ce,defaultValues:s})}}).unsubscribe,U=K=>(o.mount=!0,h={...h,...K.formState},V({...K,formState:h})),ne=(K,ce={})=>{for(const pe of K?S$(K):l.mount)l.mount.delete(pe),l.array.delete(pe),ce.keepValue||(Vl(r,pe),Vl(i,pe)),!ce.keepError&&Vl(n.errors,pe),!ce.keepDirty&&Vl(n.dirtyFields,pe),!ce.keepTouched&&Vl(n.touchedFields,pe),!ce.keepIsValidating&&Vl(n.validatingFields,pe),!e.shouldUnregister&&!ce.keepDefaultValue&&Vl(s,pe);m.state.next({values:oc(i)}),m.state.next({...n,...ce.keepDirty?{isDirty:_()}:{}}),!ce.keepIsValid&&g()},te=({disabled:K,name:ce})=>{(am(K)&&o.mount||K||l.disabled.has(ce))&&(K?l.disabled.add(ce):l.disabled.delete(ce))},re=(K,ce={})=>{let pe=Mn(r,K);const Ie=am(ce.disabled)||am(e.disabled);return Oi(r,K,{...pe||{},_f:{...pe&&pe._f?pe._f:{ref:{name:K}},name:K,mount:!0,...ce}}),l.mount.add(K),pe?te({disabled:am(ce.disabled)?ce.disabled:e.disabled,name:K}):k(K,!0,ce.value),{...Ie?{disabled:ce.disabled||e.disabled}:{},...e.progressive?{required:!!ce.required,min:N3(ce.min),max:N3(ce.max),minLength:N3(ce.minLength),maxLength:N3(ce.maxLength),pattern:N3(ce.pattern)}:{},name:K,onChange:I,onBlur:I,ref:Me=>{if(Me){re(K,ce),pe=Mn(r,K);const we=vl(Me.value)&&Me.querySelectorAll&&Me.querySelectorAll("input,select,textarea")[0]||Me,Be=Aar(we),Ve=pe._f.refs||[];if(Be?Ve.find(be=>be===we):we===pe._f.ref)return;Oi(r,K,{_f:{...pe._f,...Be?{refs:[...Ve.filter(Wde),we,...Array.isArray(Mn(s,K))?[{}]:[]],ref:{type:we.type,name:K}}:{ref:we}}}),k(K,!1,void 0,we)}else pe=Mn(r,K,{}),pe._f&&(pe._f.mount=!1),(e.shouldUnregister||ce.shouldUnregister)&&!(zCt(l.array,K)&&o.action)&&l.unMount.add(K)}}},fe=()=>e.shouldFocusError&&C$(r,P,l.mount),le=K=>{am(K)&&(m.state.next({disabled:K}),C$(r,(ce,pe)=>{const Ie=Mn(r,pe);Ie&&(ce.disabled=Ie._f.disabled||K,Array.isArray(Ie._f.refs)&&Ie._f.refs.forEach(Me=>{Me.disabled=Ie._f.disabled||K}))},0,!1))},q=(K,ce)=>async pe=>{let Ie;pe&&(pe.preventDefault&&pe.preventDefault(),pe.persist&&pe.persist());let Me=oc(i);if(m.state.next({isSubmitting:!0}),e.resolver){const{errors:we,values:Be}=await j();n.errors=we,Me=oc(Be)}else await N(r);if(l.disabled.size)for(const we of l.disabled)Vl(Me,we);if(Vl(n.errors,"root"),nh(n.errors)){m.state.next({errors:{}});try{await K(Me,pe)}catch(we){Ie=we}}else ce&&await ce({...n.errors},pe),fe(),setTimeout(fe);if(m.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:nh(n.errors)&&!Ie,submitCount:n.submitCount+1,errors:n.errors}),Ie)throw Ie},Y=(K,ce={})=>{Mn(r,K)&&(vl(ce.defaultValue)?D(K,oc(Mn(s,K))):(D(K,ce.defaultValue),Oi(s,K,oc(ce.defaultValue))),ce.keepTouched||Vl(n.touchedFields,K),ce.keepDirty||(Vl(n.dirtyFields,K),n.isDirty=ce.defaultValue?_(K,oc(Mn(s,K))):_()),ce.keepError||(Vl(n.errors,K),u.isValid&&g()),m.state.next({...n}))},X=(K,ce={})=>{const pe=K?oc(K):s,Ie=oc(pe),Me=nh(K),we=Me?s:Ie;if(ce.keepDefaultValues||(s=pe),!ce.keepValues){if(ce.keepDirtyValues){const Be=new Set([...l.mount,...Object.keys(E3(s,i))]);for(const Ve of Array.from(Be))Mn(n.dirtyFields,Ve)?Oi(we,Ve,Mn(i,Ve)):D(Ve,Mn(we,Ve))}else{if(V_e&&vl(K))for(const Be of l.mount){const Ve=Mn(r,Be);if(Ve&&Ve._f){const be=Array.isArray(Ve._f.refs)?Ve._f.refs[0]:Ve._f.ref;if(wZ(be)){const Ze=be.closest("form");if(Ze){Ze.reset();break}}}}if(ce.keepFieldsRef)for(const Be of l.mount)D(Be,Mn(we,Be));else r={}}i=e.shouldUnregister?ce.keepDefaultValues?oc(s):{}:oc(we),m.array.next({values:{...we}}),m.state.next({values:{...we}})}l={mount:ce.keepDirtyValues?l.mount:new Set,unMount:new Set,array:new Set,disabled:new Set,watch:new Set,watchAll:!1,focus:""},o.mount=!u.isValid||!!ce.keepIsValid||!!ce.keepDirtyValues,o.watch=!!e.shouldUnregister,m.state.next({submitCount:ce.keepSubmitCount?n.submitCount:0,isDirty:Me?!1:ce.keepDirty?n.isDirty:!!(ce.keepDefaultValues&&!tx(K,s)),isSubmitted:ce.keepIsSubmitted?n.isSubmitted:!1,dirtyFields:Me?{}:ce.keepDirtyValues?ce.keepDefaultValues&&i?E3(s,i):n.dirtyFields:ce.keepDefaultValues&&K?E3(s,K):ce.keepDirty?n.dirtyFields:{},touchedFields:ce.keepTouched?n.touchedFields:{},errors:ce.keepErrors?n.errors:{},isSubmitSuccessful:ce.keepIsSubmitSuccessful?n.isSubmitSuccessful:!1,isSubmitting:!1})},Q=(K,ce)=>X(mg(K)?K(i):K,ce),ie=(K,ce={})=>{const pe=Mn(r,K),Ie=pe&&pe._f;if(Ie){const Me=Ie.refs?Ie.refs[0]:Ie.ref;Me.focus&&(Me.focus(),ce.shouldSelect&&mg(Me.select)&&Me.select())}},he=K=>{n={...n,...K}},J={control:{register:re,unregister:ne,getFieldState:G,handleSubmit:q,setError:H,_subscribe:V,_runSchema:j,_focusError:fe,_getWatch:T,_getDirty:_,_setValid:g,_setFieldArray:b,_setDisabledField:te,_setErrors:w,_getFieldArray:R,_reset:X,_resetDefaultValues:()=>mg(e.defaultValues)&&e.defaultValues().then(K=>{Q(K,e.resetOptions),m.state.next({isLoading:!1})}),_removeUnmounted:A,_disableForm:le,_subjects:m,_proxyFormState:u,get _fields(){return r},get _formValues(){return i},get _state(){return o},set _state(K){o=K},get _defaultValues(){return s},get _names(){return l},set _names(K){l=K},get _formState(){return n},get _options(){return e},set _options(K){e={...e,...K}}},subscribe:U,trigger:M,register:re,handleSubmit:q,watch:W,setValue:D,getValues:z,reset:Q,resetField:Y,clearErrors:B,unregister:ne,setError:H,setFocus:ie,getFieldState:G};return{...J,formControl:J}}function jM(t={}){const e=se.useRef(void 0),n=se.useRef(void 0),[r,s]=se.useState({isDirty:!1,isValidating:!1,isLoading:mg(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},validatingFields:{},errors:t.errors||{},disabled:t.disabled||!1,isReady:!1,defaultValues:mg(t.defaultValues)?void 0:t.defaultValues});if(!e.current)if(t.formControl)e.current={...t.formControl,formState:r},t.defaultValues&&!mg(t.defaultValues)&&t.formControl.reset(t.defaultValues,t.resetOptions);else{const{formControl:o,...l}=zar(t);e.current={...l,formState:r}}const i=e.current.control;return i._options=t,q_e(()=>{const o=i._subscribe({formState:i._proxyFormState,callback:()=>s({...i._formState}),reRenderRoot:!0});return s(l=>({...l,isReady:!0})),i._formState.isReady=!0,o},[i]),se.useEffect(()=>i._disableForm(t.disabled),[i,t.disabled]),se.useEffect(()=>{t.mode&&(i._options.mode=t.mode),t.reValidateMode&&(i._options.reValidateMode=t.reValidateMode)},[i,t.mode,t.reValidateMode]),se.useEffect(()=>{t.errors&&(i._setErrors(t.errors),i._focusError())},[i,t.errors]),se.useEffect(()=>{t.shouldUnregister&&i._subjects.state.next({values:i._getWatch()})},[i,t.shouldUnregister]),se.useEffect(()=>{if(i._proxyFormState.isDirty){const o=i._getDirty();o!==r.isDirty&&i._subjects.state.next({isDirty:o})}},[i,r.isDirty]),se.useEffect(()=>{t.values&&!tx(t.values,n.current)?(i._reset(t.values,{keepFieldsRef:!0,...i._options.resetOptions}),n.current=t.values,s(o=>({...o}))):i._resetDefaultValues()},[i,t.values]),se.useEffect(()=>{i._state.mount||(i._setValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),e.current.formState=VCt(r,i),e.current}const Wze=(t,e,n)=>{if(t&&"reportValidity"in t){const r=Mn(n,e);t.setCustomValidity(r&&r.message||""),t.reportValidity()}},JCt=(t,e)=>{for(const n in e.fields){const r=e.fields[n];r&&r.ref&&"reportValidity"in r.ref?Wze(r.ref,n,t):r.refs&&r.refs.forEach(s=>Wze(s,n,t))}},Var=(t,e)=>{e.shouldUseNativeValidation&&JCt(t,e);const n={};for(const r in t){const s=Mn(e.fields,r),i=Object.assign(t[r]||{},{ref:s&&s.ref});if(Har(e.names||Object.keys(t),r)){const o=Object.assign({},Mn(n,r));Oi(o,"root",i),Oi(n,r,o)}else Oi(n,r,i)}return n},Har=(t,e)=>t.some(n=>n.startsWith(e+"."));var Gar=function(t,e){for(var n={};t.length;){var r=t[0],s=r.code,i=r.message,o=r.path.join(".");if(!n[o])if("unionErrors"in r){var l=r.unionErrors[0].errors[0];n[o]={message:l.message,type:l.code}}else n[o]={message:i,type:s};if("unionErrors"in r&&r.unionErrors.forEach(function(u){return u.errors.forEach(function(h){return t.push(h)})}),e){var c=n[o].types,d=c&&c[r.code];n[o]=GCt(o,e,n,s,d?[].concat(d,r.message):r.message)}t.shift()}return n},EM=function(t,e,n){return n===void 0&&(n={}),function(r,s,i){try{return Promise.resolve(function(o,l){try{var c=Promise.resolve(t[n.mode==="sync"?"parse":"parseAsync"](r,e)).then(function(d){return i.shouldUseNativeValidation&&JCt({},i),{errors:{},values:n.raw?r:d}})}catch(d){return l(d)}return c&&c.then?c.then(void 0,l):c}(0,function(o){if(function(l){return Array.isArray(l==null?void 0:l.errors)}(o))return{values:{},errors:Var(Gar(o.errors,!i.shouldUseNativeValidation&&i.criteriaMode==="all"),i)};throw o}))}catch(o){return Promise.reject(o)}}},gi;(function(t){t.assertEqual=s=>{};function e(s){}t.assertIs=e;function n(s){throw new Error}t.assertNever=n,t.arrayToEnum=s=>{const i={};for(const o of s)i[o]=o;return i},t.getValidEnumValues=s=>{const i=t.objectKeys(s).filter(l=>typeof s[s[l]]!="number"),o={};for(const l of i)o[l]=s[l];return t.objectValues(o)},t.objectValues=s=>t.objectKeys(s).map(function(i){return s[i]}),t.objectKeys=typeof Object.keys=="function"?s=>Object.keys(s):s=>{const i=[];for(const o in s)Object.prototype.hasOwnProperty.call(s,o)&&i.push(o);return i},t.find=(s,i)=>{for(const o of s)if(i(o))return o},t.isInteger=typeof Number.isInteger=="function"?s=>Number.isInteger(s):s=>typeof s=="number"&&Number.isFinite(s)&&Math.floor(s)===s;function r(s,i=" | "){return s.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}t.joinValues=r,t.jsonStringifyReplacer=(s,i)=>typeof i=="bigint"?i.toString():i})(gi||(gi={}));var qze;(function(t){t.mergeShapes=(e,n)=>({...e,...n})})(qze||(qze={}));const cr=gi.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),e1=t=>{switch(typeof t){case"undefined":return cr.undefined;case"string":return cr.string;case"number":return Number.isNaN(t)?cr.nan:cr.number;case"boolean":return cr.boolean;case"function":return cr.function;case"bigint":return cr.bigint;case"symbol":return cr.symbol;case"object":return Array.isArray(t)?cr.array:t===null?cr.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?cr.promise:typeof Map<"u"&&t instanceof Map?cr.map:typeof Set<"u"&&t instanceof Set?cr.set:typeof Date<"u"&&t instanceof Date?cr.date:cr.object;default:return cr.unknown}},fn=gi.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class a0 extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const n=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,n):this.__proto__=n,this.name="ZodError",this.issues=e}format(e){const n=e||function(i){return i.message},r={_errors:[]},s=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(s);else if(o.code==="invalid_return_type")s(o.returnTypeError);else if(o.code==="invalid_arguments")s(o.argumentsError);else if(o.path.length===0)r._errors.push(n(o));else{let l=r,c=0;for(;c<o.path.length;){const d=o.path[c];c===o.path.length-1?(l[d]=l[d]||{_errors:[]},l[d]._errors.push(n(o))):l[d]=l[d]||{_errors:[]},l=l[d],c++}}};return s(this),r}static assert(e){if(!(e instanceof a0))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,gi.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=n=>n.message){const n={},r=[];for(const s of this.issues)if(s.path.length>0){const i=s.path[0];n[i]=n[i]||[],n[i].push(e(s))}else r.push(e(s));return{formErrors:r,fieldErrors:n}}get formErrors(){return this.flatten()}}a0.create=t=>new a0(t);const Pxe=(t,e)=>{let n;switch(t.code){case fn.invalid_type:t.received===cr.undefined?n="Required":n=`Expected ${t.expected}, received ${t.received}`;break;case fn.invalid_literal:n=`Invalid literal value, expected ${JSON.stringify(t.expected,gi.jsonStringifyReplacer)}`;break;case fn.unrecognized_keys:n=`Unrecognized key(s) in object: ${gi.joinValues(t.keys,", ")}`;break;case fn.invalid_union:n="Invalid input";break;case fn.invalid_union_discriminator:n=`Invalid discriminator value. Expected ${gi.joinValues(t.options)}`;break;case fn.invalid_enum_value:n=`Invalid enum value. Expected ${gi.joinValues(t.options)}, received '${t.received}'`;break;case fn.invalid_arguments:n="Invalid function arguments";break;case fn.invalid_return_type:n="Invalid function return type";break;case fn.invalid_date:n="Invalid date";break;case fn.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(n=`Invalid input: must include "${t.validation.includes}"`,typeof t.validation.position=="number"&&(n=`${n} at one or more positions greater than or equal to ${t.validation.position}`)):"startsWith"in t.validation?n=`Invalid input: must start with "${t.validation.startsWith}"`:"endsWith"in t.validation?n=`Invalid input: must end with "${t.validation.endsWith}"`:gi.assertNever(t.validation):t.validation!=="regex"?n=`Invalid ${t.validation}`:n="Invalid";break;case fn.too_small:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at least":"more than"} ${t.minimum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at least":"over"} ${t.minimum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="bigint"?n=`Number must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${t.minimum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(t.minimum))}`:n="Invalid input";break;case fn.too_big:t.type==="array"?n=`Array must contain ${t.exact?"exactly":t.inclusive?"at most":"less than"} ${t.maximum} element(s)`:t.type==="string"?n=`String must contain ${t.exact?"exactly":t.inclusive?"at most":"under"} ${t.maximum} character(s)`:t.type==="number"?n=`Number must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="bigint"?n=`BigInt must be ${t.exact?"exactly":t.inclusive?"less than or equal to":"less than"} ${t.maximum}`:t.type==="date"?n=`Date must be ${t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(t.maximum))}`:n="Invalid input";break;case fn.custom:n="Invalid input";break;case fn.invalid_intersection_types:n="Intersection results could not be merged";break;case fn.not_multiple_of:n=`Number must be a multiple of ${t.multipleOf}`;break;case fn.not_finite:n="Number must be finite";break;default:n=e.defaultError,gi.assertNever(t)}return{message:n}};let War=Pxe;function qar(){return War}const Kar=t=>{const{data:e,path:n,errorMaps:r,issueData:s}=t,i=[...n,...s.path||[]],o={...s,path:i};if(s.message!==void 0)return{...s,path:i,message:s.message};let l="";const c=r.filter(d=>!!d).slice().reverse();for(const d of c)l=d(o,{data:e,defaultError:l}).message;return{...s,path:i,message:l}};function Gn(t,e){const n=qar(),r=Kar({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,n,n===Pxe?void 0:Pxe].filter(s=>!!s)});t.common.issues.push(r)}class _m{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,n){const r=[];for(const s of n){if(s.status==="aborted")return ys;s.status==="dirty"&&e.dirty(),r.push(s.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,n){const r=[];for(const s of n){const i=await s.key,o=await s.value;r.push({key:i,value:o})}return _m.mergeObjectSync(e,r)}static mergeObjectSync(e,n){const r={};for(const s of n){const{key:i,value:o}=s;if(i.status==="aborted"||o.status==="aborted")return ys;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||s.alwaysSet)&&(r[i.value]=o.value)}return{status:e.value,value:r}}}const ys=Object.freeze({status:"aborted"}),tD=t=>({status:"dirty",value:t}),np=t=>({status:"valid",value:t}),Kze=t=>t.status==="aborted",Yze=t=>t.status==="dirty",VR=t=>t.status==="valid",CZ=t=>typeof Promise<"u"&&t instanceof Promise;var mr;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(mr||(mr={}));class zk{constructor(e,n,r,s){this._cachedPath=[],this.parent=e,this.data=n,this._path=r,this._key=s}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Qze=(t,e)=>{if(VR(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const n=new a0(t.common.issues);return this._error=n,this._error}}};function Ws(t){if(!t)return{};const{errorMap:e,invalid_type_error:n,required_error:r,description:s}=t;if(e&&(n||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:s}:{errorMap:(o,l)=>{const{message:c}=t;return o.code==="invalid_enum_value"?{message:c??l.defaultError}:typeof l.data>"u"?{message:c??r??l.defaultError}:o.code!=="invalid_type"?{message:l.defaultError}:{message:c??n??l.defaultError}},description:s}}class fi{get description(){return this._def.description}_getType(e){return e1(e.data)}_getOrReturnCtx(e,n){return n||{common:e.parent.common,data:e.data,parsedType:e1(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new _m,ctx:{common:e.parent.common,data:e.data,parsedType:e1(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const n=this._parse(e);if(CZ(n))throw new Error("Synchronous parse encountered promise.");return n}_parseAsync(e){const n=this._parse(e);return Promise.resolve(n)}parse(e,n){const r=this.safeParse(e,n);if(r.success)return r.data;throw r.error}safeParse(e,n){const r={common:{issues:[],async:(n==null?void 0:n.async)??!1,contextualErrorMap:n==null?void 0:n.errorMap},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:e1(e)},s=this._parseSync({data:e,path:r.path,parent:r});return Qze(r,s)}"~validate"(e){var r,s;const n={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:e1(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:n});return VR(i)?{value:i.value}:{issues:n.common.issues}}catch(i){(s=(r=i==null?void 0:i.message)==null?void 0:r.toLowerCase())!=null&&s.includes("encountered")&&(this["~standard"].async=!0),n.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:n}).then(i=>VR(i)?{value:i.value}:{issues:n.common.issues})}async parseAsync(e,n){const r=await this.safeParseAsync(e,n);if(r.success)return r.data;throw r.error}async safeParseAsync(e,n){const r={common:{issues:[],contextualErrorMap:n==null?void 0:n.errorMap,async:!0},path:(n==null?void 0:n.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:e1(e)},s=this._parse({data:e,path:r.path,parent:r}),i=await(CZ(s)?s:Promise.resolve(s));return Qze(r,i)}refine(e,n){const r=s=>typeof n=="string"||typeof n>"u"?{message:n}:typeof n=="function"?n(s):n;return this._refinement((s,i)=>{const o=e(s),l=()=>i.addIssue({code:fn.custom,...r(s)});return typeof Promise<"u"&&o instanceof Promise?o.then(c=>c?!0:(l(),!1)):o?!0:(l(),!1)})}refinement(e,n){return this._refinement((r,s)=>e(r)?!0:(s.addIssue(typeof n=="function"?n(r,s):n),!1))}_refinement(e){return new GR({schema:this,typeName:ws.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:n=>this["~validate"](n)}}optional(){return ok.create(this,this._def)}nullable(){return WR.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xy.create(this)}promise(){return TZ.create(this,this._def)}or(e){return EZ.create([this,e],this._def)}and(e){return NZ.create(this,e,this._def)}transform(e){return new GR({...Ws(this._def),schema:this,typeName:ws.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const n=typeof e=="function"?e:()=>e;return new Lxe({...Ws(this._def),innerType:this,defaultValue:n,typeName:ws.ZodDefault})}brand(){return new yor({typeName:ws.ZodBranded,type:this,...Ws(this._def)})}catch(e){const n=typeof e=="function"?e:()=>e;return new Dxe({...Ws(this._def),innerType:this,catchValue:n,typeName:ws.ZodCatch})}describe(e){const n=this.constructor;return new n({...this._def,description:e})}pipe(e){return Q_e.create(this,e)}readonly(){return $xe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Yar=/^c[^\s-]{8,}$/i,Qar=/^[0-9a-z]+$/,Zar=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Jar=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Xar=/^[a-z0-9_-]{21}$/i,eor=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,tor=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,nor=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,ror="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let qde;const sor=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ior=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,aor=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,oor=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,lor=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,cor=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,XCt="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",dor=new RegExp(`^${XCt}$`);function ejt(t){let e="[0-5]\\d";t.precision?e=`${e}\\.\\d{${t.precision}}`:t.precision==null&&(e=`${e}(\\.\\d+)?`);const n=t.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${n}`}function uor(t){return new RegExp(`^${ejt(t)}$`)}function hor(t){let e=`${XCt}T${ejt(t)}`;const n=[];return n.push(t.local?"Z?":"Z"),t.offset&&n.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${n.join("|")})`,new RegExp(`^${e}$`)}function mor(t,e){return!!((e==="v4"||!e)&&sor.test(t)||(e==="v6"||!e)&&aor.test(t))}function por(t,e){if(!eor.test(t))return!1;try{const[n]=t.split(".");if(!n)return!1;const r=n.replace(/-/g,"+").replace(/_/g,"/").padEnd(n.length+(4-n.length%4)%4,"="),s=JSON.parse(atob(r));return!(typeof s!="object"||s===null||"typ"in s&&(s==null?void 0:s.typ)!=="JWT"||!s.alg||e&&s.alg!==e)}catch{return!1}}function gor(t,e){return!!((e==="v4"||!e)&&ior.test(t)||(e==="v6"||!e)&&oor.test(t))}class I1 extends fi{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==cr.string){const i=this._getOrReturnCtx(e);return Gn(i,{code:fn.invalid_type,expected:cr.string,received:i.parsedType}),ys}const r=new _m;let s;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(s=this._getOrReturnCtx(e,s),Gn(s,{code:fn.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="max")e.data.length>i.value&&(s=this._getOrReturnCtx(e,s),Gn(s,{code:fn.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),r.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,l=e.data.length<i.value;(o||l)&&(s=this._getOrReturnCtx(e,s),o?Gn(s,{code:fn.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):l&&Gn(s,{code:fn.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),r.dirty())}else if(i.kind==="email")nor.test(e.data)||(s=this._getOrReturnCtx(e,s),Gn(s,{validation:"email",code:fn.invalid_string,message:i.message}),r.dirty());else if(i.kind==="emoji")qde||(qde=new RegExp(ror,"u")),qde.test(e.data)||(s=this._getOrReturnCtx(e,s),Gn(s,{validation:"emoji",code:fn.invalid_string,message:i.message}),r.dirty());else if(i.kind==="uuid")Jar.test(e.data)||(s=this._getOrReturnCtx(e,s),Gn(s,{validation:"uuid",code:fn.invalid_string,message:i.message}),r.dirty());else if(i.kind==="nanoid")Xar.test(e.data)||(s=this._getOrReturnCtx(e,s),Gn(s,{validation:"nanoid",code:fn.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid")Yar.test(e.data)||(s=this._getOrReturnCtx(e,s),Gn(s,{validation:"cuid",code:fn.invalid_string,message:i.message}),r.dirty());else if(i.kind==="cuid2")Qar.test(e.data)||(s=this._getOrReturnCtx(e,s),Gn(s,{validation:"cuid2",code:fn.invalid_string,message:i.message}),r.dirty());else if(i.kind==="ulid")Zar.test(e.data)||(s=this._getOrReturnCtx(e,s),Gn(s,{validation:"ulid",code:fn.invalid_string,message:i.message}),r.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{s=this._getOrReturnCtx(e,s),Gn(s,{validation:"url",code:fn.invalid_string,message:i.message}),r.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(s=this._getOrReturnCtx(e,s),Gn(s,{validation:"regex",code:fn.invalid_string,message:i.message}),r.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(s=this._getOrReturnCtx(e,s),Gn(s,{code:fn.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),r.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(s=this._getOrReturnCtx(e,s),Gn(s,{code:fn.invalid_string,validation:{startsWith:i.value},message:i.message}),r.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(s=this._getOrReturnCtx(e,s),Gn(s,{code:fn.invalid_string,validation:{endsWith:i.value},message:i.message}),r.dirty()):i.kind==="datetime"?hor(i).test(e.data)||(s=this._getOrReturnCtx(e,s),Gn(s,{code:fn.invalid_string,validation:"datetime",message:i.message}),r.dirty()):i.kind==="date"?dor.test(e.data)||(s=this._getOrReturnCtx(e,s),Gn(s,{code:fn.invalid_string,validation:"date",message:i.message}),r.dirty()):i.kind==="time"?uor(i).test(e.data)||(s=this._getOrReturnCtx(e,s),Gn(s,{code:fn.invalid_string,validation:"time",message:i.message}),r.dirty()):i.kind==="duration"?tor.test(e.data)||(s=this._getOrReturnCtx(e,s),Gn(s,{validation:"duration",code:fn.invalid_string,message:i.message}),r.dirty()):i.kind==="ip"?mor(e.data,i.version)||(s=this._getOrReturnCtx(e,s),Gn(s,{validation:"ip",code:fn.invalid_string,message:i.message}),r.dirty()):i.kind==="jwt"?por(e.data,i.alg)||(s=this._getOrReturnCtx(e,s),Gn(s,{validation:"jwt",code:fn.invalid_string,message:i.message}),r.dirty()):i.kind==="cidr"?gor(e.data,i.version)||(s=this._getOrReturnCtx(e,s),Gn(s,{validation:"cidr",code:fn.invalid_string,message:i.message}),r.dirty()):i.kind==="base64"?lor.test(e.data)||(s=this._getOrReturnCtx(e,s),Gn(s,{validation:"base64",code:fn.invalid_string,message:i.message}),r.dirty()):i.kind==="base64url"?cor.test(e.data)||(s=this._getOrReturnCtx(e,s),Gn(s,{validation:"base64url",code:fn.invalid_string,message:i.message}),r.dirty()):gi.assertNever(i);return{status:r.value,value:e.data}}_regex(e,n,r){return this.refinement(s=>e.test(s),{validation:n,code:fn.invalid_string,...mr.errToObj(r)})}_addCheck(e){return new I1({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...mr.errToObj(e)})}url(e){return this._addCheck({kind:"url",...mr.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...mr.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...mr.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...mr.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...mr.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...mr.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...mr.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...mr.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...mr.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...mr.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...mr.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...mr.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...mr.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...mr.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...mr.errToObj(e)})}regex(e,n){return this._addCheck({kind:"regex",regex:e,...mr.errToObj(n)})}includes(e,n){return this._addCheck({kind:"includes",value:e,position:n==null?void 0:n.position,...mr.errToObj(n==null?void 0:n.message)})}startsWith(e,n){return this._addCheck({kind:"startsWith",value:e,...mr.errToObj(n)})}endsWith(e,n){return this._addCheck({kind:"endsWith",value:e,...mr.errToObj(n)})}min(e,n){return this._addCheck({kind:"min",value:e,...mr.errToObj(n)})}max(e,n){return this._addCheck({kind:"max",value:e,...mr.errToObj(n)})}length(e,n){return this._addCheck({kind:"length",value:e,...mr.errToObj(n)})}nonempty(e){return this.min(1,mr.errToObj(e))}trim(){return new I1({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new I1({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new I1({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxLength(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}I1.create=t=>new I1({checks:[],typeName:ws.ZodString,coerce:(t==null?void 0:t.coerce)??!1,...Ws(t)});function vor(t,e){const n=(t.toString().split(".")[1]||"").length,r=(e.toString().split(".")[1]||"").length,s=n>r?n:r,i=Number.parseInt(t.toFixed(s).replace(".","")),o=Number.parseInt(e.toFixed(s).replace(".",""));return i%o/10**s}class K6 extends fi{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==cr.number){const i=this._getOrReturnCtx(e);return Gn(i,{code:fn.invalid_type,expected:cr.number,received:i.parsedType}),ys}let r;const s=new _m;for(const i of this._def.checks)i.kind==="int"?gi.isInteger(e.data)||(r=this._getOrReturnCtx(e,r),Gn(r,{code:fn.invalid_type,expected:"integer",received:"float",message:i.message}),s.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),Gn(r,{code:fn.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),Gn(r,{code:fn.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),s.dirty()):i.kind==="multipleOf"?vor(e.data,i.value)!==0&&(r=this._getOrReturnCtx(e,r),Gn(r,{code:fn.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(r=this._getOrReturnCtx(e,r),Gn(r,{code:fn.not_finite,message:i.message}),s.dirty()):gi.assertNever(i);return{status:s.value,value:e.data}}gte(e,n){return this.setLimit("min",e,!0,mr.toString(n))}gt(e,n){return this.setLimit("min",e,!1,mr.toString(n))}lte(e,n){return this.setLimit("max",e,!0,mr.toString(n))}lt(e,n){return this.setLimit("max",e,!1,mr.toString(n))}setLimit(e,n,r,s){return new K6({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:mr.toString(s)}]})}_addCheck(e){return new K6({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:mr.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:mr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:mr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:mr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:mr.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:mr.toString(n)})}finite(e){return this._addCheck({kind:"finite",message:mr.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:mr.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:mr.toString(e)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&gi.isInteger(e.value))}get isFinite(){let e=null,n=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(n===null||r.value>n)&&(n=r.value):r.kind==="max"&&(e===null||r.value<e)&&(e=r.value)}return Number.isFinite(n)&&Number.isFinite(e)}}K6.create=t=>new K6({checks:[],typeName:ws.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1,...Ws(t)});class Y6 extends fi{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==cr.bigint)return this._getInvalidInput(e);let r;const s=new _m;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(r=this._getOrReturnCtx(e,r),Gn(r,{code:fn.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(r=this._getOrReturnCtx(e,r),Gn(r,{code:fn.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),s.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(r=this._getOrReturnCtx(e,r),Gn(r,{code:fn.not_multiple_of,multipleOf:i.value,message:i.message}),s.dirty()):gi.assertNever(i);return{status:s.value,value:e.data}}_getInvalidInput(e){const n=this._getOrReturnCtx(e);return Gn(n,{code:fn.invalid_type,expected:cr.bigint,received:n.parsedType}),ys}gte(e,n){return this.setLimit("min",e,!0,mr.toString(n))}gt(e,n){return this.setLimit("min",e,!1,mr.toString(n))}lte(e,n){return this.setLimit("max",e,!0,mr.toString(n))}lt(e,n){return this.setLimit("max",e,!1,mr.toString(n))}setLimit(e,n,r,s){return new Y6({...this._def,checks:[...this._def.checks,{kind:e,value:n,inclusive:r,message:mr.toString(s)}]})}_addCheck(e){return new Y6({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:mr.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:mr.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:mr.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:mr.toString(e)})}multipleOf(e,n){return this._addCheck({kind:"multipleOf",value:e,message:mr.toString(n)})}get minValue(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e}get maxValue(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e}}Y6.create=t=>new Y6({checks:[],typeName:ws.ZodBigInt,coerce:(t==null?void 0:t.coerce)??!1,...Ws(t)});class Rxe extends fi{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==cr.boolean){const r=this._getOrReturnCtx(e);return Gn(r,{code:fn.invalid_type,expected:cr.boolean,received:r.parsedType}),ys}return np(e.data)}}Rxe.create=t=>new Rxe({typeName:ws.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1,...Ws(t)});class jZ extends fi{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==cr.date){const i=this._getOrReturnCtx(e);return Gn(i,{code:fn.invalid_type,expected:cr.date,received:i.parsedType}),ys}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return Gn(i,{code:fn.invalid_date}),ys}const r=new _m;let s;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(s=this._getOrReturnCtx(e,s),Gn(s,{code:fn.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(s=this._getOrReturnCtx(e,s),Gn(s,{code:fn.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):gi.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new jZ({...this._def,checks:[...this._def.checks,e]})}min(e,n){return this._addCheck({kind:"min",value:e.getTime(),message:mr.toString(n)})}max(e,n){return this._addCheck({kind:"max",value:e.getTime(),message:mr.toString(n)})}get minDate(){let e=null;for(const n of this._def.checks)n.kind==="min"&&(e===null||n.value>e)&&(e=n.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const n of this._def.checks)n.kind==="max"&&(e===null||n.value<e)&&(e=n.value);return e!=null?new Date(e):null}}jZ.create=t=>new jZ({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:ws.ZodDate,...Ws(t)});class Zze extends fi{_parse(e){if(this._getType(e)!==cr.symbol){const r=this._getOrReturnCtx(e);return Gn(r,{code:fn.invalid_type,expected:cr.symbol,received:r.parsedType}),ys}return np(e.data)}}Zze.create=t=>new Zze({typeName:ws.ZodSymbol,...Ws(t)});class Jze extends fi{_parse(e){if(this._getType(e)!==cr.undefined){const r=this._getOrReturnCtx(e);return Gn(r,{code:fn.invalid_type,expected:cr.undefined,received:r.parsedType}),ys}return np(e.data)}}Jze.create=t=>new Jze({typeName:ws.ZodUndefined,...Ws(t)});class Xze extends fi{_parse(e){if(this._getType(e)!==cr.null){const r=this._getOrReturnCtx(e);return Gn(r,{code:fn.invalid_type,expected:cr.null,received:r.parsedType}),ys}return np(e.data)}}Xze.create=t=>new Xze({typeName:ws.ZodNull,...Ws(t)});class eVe extends fi{constructor(){super(...arguments),this._any=!0}_parse(e){return np(e.data)}}eVe.create=t=>new eVe({typeName:ws.ZodAny,...Ws(t)});class tVe extends fi{constructor(){super(...arguments),this._unknown=!0}_parse(e){return np(e.data)}}tVe.create=t=>new tVe({typeName:ws.ZodUnknown,...Ws(t)});class Vk extends fi{_parse(e){const n=this._getOrReturnCtx(e);return Gn(n,{code:fn.invalid_type,expected:cr.never,received:n.parsedType}),ys}}Vk.create=t=>new Vk({typeName:ws.ZodNever,...Ws(t)});class nVe extends fi{_parse(e){if(this._getType(e)!==cr.undefined){const r=this._getOrReturnCtx(e);return Gn(r,{code:fn.invalid_type,expected:cr.void,received:r.parsedType}),ys}return np(e.data)}}nVe.create=t=>new nVe({typeName:ws.ZodVoid,...Ws(t)});class xy extends fi{_parse(e){const{ctx:n,status:r}=this._processInputParams(e),s=this._def;if(n.parsedType!==cr.array)return Gn(n,{code:fn.invalid_type,expected:cr.array,received:n.parsedType}),ys;if(s.exactLength!==null){const o=n.data.length>s.exactLength.value,l=n.data.length<s.exactLength.value;(o||l)&&(Gn(n,{code:o?fn.too_big:fn.too_small,minimum:l?s.exactLength.value:void 0,maximum:o?s.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:s.exactLength.message}),r.dirty())}if(s.minLength!==null&&n.data.length<s.minLength.value&&(Gn(n,{code:fn.too_small,minimum:s.minLength.value,type:"array",inclusive:!0,exact:!1,message:s.minLength.message}),r.dirty()),s.maxLength!==null&&n.data.length>s.maxLength.value&&(Gn(n,{code:fn.too_big,maximum:s.maxLength.value,type:"array",inclusive:!0,exact:!1,message:s.maxLength.message}),r.dirty()),n.common.async)return Promise.all([...n.data].map((o,l)=>s.type._parseAsync(new zk(n,o,n.path,l)))).then(o=>_m.mergeArray(r,o));const i=[...n.data].map((o,l)=>s.type._parseSync(new zk(n,o,n.path,l)));return _m.mergeArray(r,i)}get element(){return this._def.type}min(e,n){return new xy({...this._def,minLength:{value:e,message:mr.toString(n)}})}max(e,n){return new xy({...this._def,maxLength:{value:e,message:mr.toString(n)}})}length(e,n){return new xy({...this._def,exactLength:{value:e,message:mr.toString(n)}})}nonempty(e){return this.min(1,e)}}xy.create=(t,e)=>new xy({type:t,minLength:null,maxLength:null,exactLength:null,typeName:ws.ZodArray,...Ws(e)});function L_(t){if(t instanceof Yo){const e={};for(const n in t.shape){const r=t.shape[n];e[n]=ok.create(L_(r))}return new Yo({...t._def,shape:()=>e})}else return t instanceof xy?new xy({...t._def,type:L_(t.element)}):t instanceof ok?ok.create(L_(t.unwrap())):t instanceof WR?WR.create(L_(t.unwrap())):t instanceof G2?G2.create(t.items.map(e=>L_(e))):t}class Yo extends fi{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),n=gi.objectKeys(e);return this._cached={shape:e,keys:n},this._cached}_parse(e){if(this._getType(e)!==cr.object){const d=this._getOrReturnCtx(e);return Gn(d,{code:fn.invalid_type,expected:cr.object,received:d.parsedType}),ys}const{status:r,ctx:s}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),l=[];if(!(this._def.catchall instanceof Vk&&this._def.unknownKeys==="strip"))for(const d in s.data)o.includes(d)||l.push(d);const c=[];for(const d of o){const u=i[d],h=s.data[d];c.push({key:{status:"valid",value:d},value:u._parse(new zk(s,h,s.path,d)),alwaysSet:d in s.data})}if(this._def.catchall instanceof Vk){const d=this._def.unknownKeys;if(d==="passthrough")for(const u of l)c.push({key:{status:"valid",value:u},value:{status:"valid",value:s.data[u]}});else if(d==="strict")l.length>0&&(Gn(s,{code:fn.unrecognized_keys,keys:l}),r.dirty());else if(d!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const d=this._def.catchall;for(const u of l){const h=s.data[u];c.push({key:{status:"valid",value:u},value:d._parse(new zk(s,h,s.path,u)),alwaysSet:u in s.data})}}return s.common.async?Promise.resolve().then(async()=>{const d=[];for(const u of c){const h=await u.key,m=await u.value;d.push({key:h,value:m,alwaysSet:u.alwaysSet})}return d}).then(d=>_m.mergeObjectSync(r,d)):_m.mergeObjectSync(r,c)}get shape(){return this._def.shape()}strict(e){return mr.errToObj,new Yo({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(n,r)=>{var i,o;const s=((o=(i=this._def).errorMap)==null?void 0:o.call(i,n,r).message)??r.defaultError;return n.code==="unrecognized_keys"?{message:mr.errToObj(e).message??s}:{message:s}}}:{}})}strip(){return new Yo({...this._def,unknownKeys:"strip"})}passthrough(){return new Yo({...this._def,unknownKeys:"passthrough"})}extend(e){return new Yo({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new Yo({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:ws.ZodObject})}setKey(e,n){return this.augment({[e]:n})}catchall(e){return new Yo({...this._def,catchall:e})}pick(e){const n={};for(const r of gi.objectKeys(e))e[r]&&this.shape[r]&&(n[r]=this.shape[r]);return new Yo({...this._def,shape:()=>n})}omit(e){const n={};for(const r of gi.objectKeys(this.shape))e[r]||(n[r]=this.shape[r]);return new Yo({...this._def,shape:()=>n})}deepPartial(){return L_(this)}partial(e){const n={};for(const r of gi.objectKeys(this.shape)){const s=this.shape[r];e&&!e[r]?n[r]=s:n[r]=s.optional()}return new Yo({...this._def,shape:()=>n})}required(e){const n={};for(const r of gi.objectKeys(this.shape))if(e&&!e[r])n[r]=this.shape[r];else{let i=this.shape[r];for(;i instanceof ok;)i=i._def.innerType;n[r]=i}return new Yo({...this._def,shape:()=>n})}keyof(){return tjt(gi.objectKeys(this.shape))}}Yo.create=(t,e)=>new Yo({shape:()=>t,unknownKeys:"strip",catchall:Vk.create(),typeName:ws.ZodObject,...Ws(e)});Yo.strictCreate=(t,e)=>new Yo({shape:()=>t,unknownKeys:"strict",catchall:Vk.create(),typeName:ws.ZodObject,...Ws(e)});Yo.lazycreate=(t,e)=>new Yo({shape:t,unknownKeys:"strip",catchall:Vk.create(),typeName:ws.ZodObject,...Ws(e)});class EZ extends fi{_parse(e){const{ctx:n}=this._processInputParams(e),r=this._def.options;function s(i){for(const l of i)if(l.result.status==="valid")return l.result;for(const l of i)if(l.result.status==="dirty")return n.common.issues.push(...l.ctx.common.issues),l.result;const o=i.map(l=>new a0(l.ctx.common.issues));return Gn(n,{code:fn.invalid_union,unionErrors:o}),ys}if(n.common.async)return Promise.all(r.map(async i=>{const o={...n,common:{...n.common,issues:[]},parent:null};return{result:await i._parseAsync({data:n.data,path:n.path,parent:o}),ctx:o}})).then(s);{let i;const o=[];for(const c of r){const d={...n,common:{...n.common,issues:[]},parent:null},u=c._parseSync({data:n.data,path:n.path,parent:d});if(u.status==="valid")return u;u.status==="dirty"&&!i&&(i={result:u,ctx:d}),d.common.issues.length&&o.push(d.common.issues)}if(i)return n.common.issues.push(...i.ctx.common.issues),i.result;const l=o.map(c=>new a0(c));return Gn(n,{code:fn.invalid_union,unionErrors:l}),ys}}get options(){return this._def.options}}EZ.create=(t,e)=>new EZ({options:t,typeName:ws.ZodUnion,...Ws(e)});function Ixe(t,e){const n=e1(t),r=e1(e);if(t===e)return{valid:!0,data:t};if(n===cr.object&&r===cr.object){const s=gi.objectKeys(e),i=gi.objectKeys(t).filter(l=>s.indexOf(l)!==-1),o={...t,...e};for(const l of i){const c=Ixe(t[l],e[l]);if(!c.valid)return{valid:!1};o[l]=c.data}return{valid:!0,data:o}}else if(n===cr.array&&r===cr.array){if(t.length!==e.length)return{valid:!1};const s=[];for(let i=0;i<t.length;i++){const o=t[i],l=e[i],c=Ixe(o,l);if(!c.valid)return{valid:!1};s.push(c.data)}return{valid:!0,data:s}}else return n===cr.date&&r===cr.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}class NZ extends fi{_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=(i,o)=>{if(Kze(i)||Kze(o))return ys;const l=Ixe(i.value,o.value);return l.valid?((Yze(i)||Yze(o))&&n.dirty(),{status:n.value,value:l.data}):(Gn(r,{code:fn.invalid_intersection_types}),ys)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([i,o])=>s(i,o)):s(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}NZ.create=(t,e,n)=>new NZ({left:t,right:e,typeName:ws.ZodIntersection,...Ws(n)});class G2 extends fi{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==cr.array)return Gn(r,{code:fn.invalid_type,expected:cr.array,received:r.parsedType}),ys;if(r.data.length<this._def.items.length)return Gn(r,{code:fn.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ys;!this._def.rest&&r.data.length>this._def.items.length&&(Gn(r,{code:fn.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),n.dirty());const i=[...r.data].map((o,l)=>{const c=this._def.items[l]||this._def.rest;return c?c._parse(new zk(r,o,r.path,l)):null}).filter(o=>!!o);return r.common.async?Promise.all(i).then(o=>_m.mergeArray(n,o)):_m.mergeArray(n,i)}get items(){return this._def.items}rest(e){return new G2({...this._def,rest:e})}}G2.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new G2({items:t,typeName:ws.ZodTuple,rest:null,...Ws(e)})};class rVe extends fi{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==cr.map)return Gn(r,{code:fn.invalid_type,expected:cr.map,received:r.parsedType}),ys;const s=this._def.keyType,i=this._def.valueType,o=[...r.data.entries()].map(([l,c],d)=>({key:s._parse(new zk(r,l,r.path,[d,"key"])),value:i._parse(new zk(r,c,r.path,[d,"value"]))}));if(r.common.async){const l=new Map;return Promise.resolve().then(async()=>{for(const c of o){const d=await c.key,u=await c.value;if(d.status==="aborted"||u.status==="aborted")return ys;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),l.set(d.value,u.value)}return{status:n.value,value:l}})}else{const l=new Map;for(const c of o){const d=c.key,u=c.value;if(d.status==="aborted"||u.status==="aborted")return ys;(d.status==="dirty"||u.status==="dirty")&&n.dirty(),l.set(d.value,u.value)}return{status:n.value,value:l}}}}rVe.create=(t,e,n)=>new rVe({valueType:e,keyType:t,typeName:ws.ZodMap,...Ws(n)});class Q6 extends fi{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.parsedType!==cr.set)return Gn(r,{code:fn.invalid_type,expected:cr.set,received:r.parsedType}),ys;const s=this._def;s.minSize!==null&&r.data.size<s.minSize.value&&(Gn(r,{code:fn.too_small,minimum:s.minSize.value,type:"set",inclusive:!0,exact:!1,message:s.minSize.message}),n.dirty()),s.maxSize!==null&&r.data.size>s.maxSize.value&&(Gn(r,{code:fn.too_big,maximum:s.maxSize.value,type:"set",inclusive:!0,exact:!1,message:s.maxSize.message}),n.dirty());const i=this._def.valueType;function o(c){const d=new Set;for(const u of c){if(u.status==="aborted")return ys;u.status==="dirty"&&n.dirty(),d.add(u.value)}return{status:n.value,value:d}}const l=[...r.data.values()].map((c,d)=>i._parse(new zk(r,c,r.path,d)));return r.common.async?Promise.all(l).then(c=>o(c)):o(l)}min(e,n){return new Q6({...this._def,minSize:{value:e,message:mr.toString(n)}})}max(e,n){return new Q6({...this._def,maxSize:{value:e,message:mr.toString(n)}})}size(e,n){return this.min(e,n).max(e,n)}nonempty(e){return this.min(1,e)}}Q6.create=(t,e)=>new Q6({valueType:t,minSize:null,maxSize:null,typeName:ws.ZodSet,...Ws(e)});class sVe extends fi{get schema(){return this._def.getter()}_parse(e){const{ctx:n}=this._processInputParams(e);return this._def.getter()._parse({data:n.data,path:n.path,parent:n})}}sVe.create=(t,e)=>new sVe({getter:t,typeName:ws.ZodLazy,...Ws(e)});class Mxe extends fi{_parse(e){if(e.data!==this._def.value){const n=this._getOrReturnCtx(e);return Gn(n,{received:n.data,code:fn.invalid_literal,expected:this._def.value}),ys}return{status:"valid",value:e.data}}get value(){return this._def.value}}Mxe.create=(t,e)=>new Mxe({value:t,typeName:ws.ZodLiteral,...Ws(e)});function tjt(t,e){return new HR({values:t,typeName:ws.ZodEnum,...Ws(e)})}class HR extends fi{_parse(e){if(typeof e.data!="string"){const n=this._getOrReturnCtx(e),r=this._def.values;return Gn(n,{expected:gi.joinValues(r),received:n.parsedType,code:fn.invalid_type}),ys}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const n=this._getOrReturnCtx(e),r=this._def.values;return Gn(n,{received:n.data,code:fn.invalid_enum_value,options:r}),ys}return np(e.data)}get options(){return this._def.values}get enum(){const e={};for(const n of this._def.values)e[n]=n;return e}get Values(){const e={};for(const n of this._def.values)e[n]=n;return e}get Enum(){const e={};for(const n of this._def.values)e[n]=n;return e}extract(e,n=this._def){return HR.create(e,{...this._def,...n})}exclude(e,n=this._def){return HR.create(this.options.filter(r=>!e.includes(r)),{...this._def,...n})}}HR.create=tjt;class iVe extends fi{_parse(e){const n=gi.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==cr.string&&r.parsedType!==cr.number){const s=gi.objectValues(n);return Gn(r,{expected:gi.joinValues(s),received:r.parsedType,code:fn.invalid_type}),ys}if(this._cache||(this._cache=new Set(gi.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const s=gi.objectValues(n);return Gn(r,{received:r.data,code:fn.invalid_enum_value,options:s}),ys}return np(e.data)}get enum(){return this._def.values}}iVe.create=(t,e)=>new iVe({values:t,typeName:ws.ZodNativeEnum,...Ws(e)});class TZ extends fi{unwrap(){return this._def.type}_parse(e){const{ctx:n}=this._processInputParams(e);if(n.parsedType!==cr.promise&&n.common.async===!1)return Gn(n,{code:fn.invalid_type,expected:cr.promise,received:n.parsedType}),ys;const r=n.parsedType===cr.promise?n.data:Promise.resolve(n.data);return np(r.then(s=>this._def.type.parseAsync(s,{path:n.path,errorMap:n.common.contextualErrorMap})))}}TZ.create=(t,e)=>new TZ({type:t,typeName:ws.ZodPromise,...Ws(e)});class GR extends fi{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ws.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:n,ctx:r}=this._processInputParams(e),s=this._def.effect||null,i={addIssue:o=>{Gn(r,o),o.fatal?n.abort():n.dirty()},get path(){return r.path}};if(i.addIssue=i.addIssue.bind(i),s.type==="preprocess"){const o=s.transform(r.data,i);if(r.common.async)return Promise.resolve(o).then(async l=>{if(n.value==="aborted")return ys;const c=await this._def.schema._parseAsync({data:l,path:r.path,parent:r});return c.status==="aborted"?ys:c.status==="dirty"||n.value==="dirty"?tD(c.value):c});{if(n.value==="aborted")return ys;const l=this._def.schema._parseSync({data:o,path:r.path,parent:r});return l.status==="aborted"?ys:l.status==="dirty"||n.value==="dirty"?tD(l.value):l}}if(s.type==="refinement"){const o=l=>{const c=s.refinement(l,i);if(r.common.async)return Promise.resolve(c);if(c instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l};if(r.common.async===!1){const l=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return l.status==="aborted"?ys:(l.status==="dirty"&&n.dirty(),o(l.value),{status:n.value,value:l.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(l=>l.status==="aborted"?ys:(l.status==="dirty"&&n.dirty(),o(l.value).then(()=>({status:n.value,value:l.value}))))}if(s.type==="transform")if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!VR(o))return ys;const l=s.transform(o.value,i);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:n.value,value:l}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>VR(o)?Promise.resolve(s.transform(o.value,i)).then(l=>({status:n.value,value:l})):ys);gi.assertNever(s)}}GR.create=(t,e,n)=>new GR({schema:t,typeName:ws.ZodEffects,effect:e,...Ws(n)});GR.createWithPreprocess=(t,e,n)=>new GR({schema:e,effect:{type:"preprocess",transform:t},typeName:ws.ZodEffects,...Ws(n)});class ok extends fi{_parse(e){return this._getType(e)===cr.undefined?np(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ok.create=(t,e)=>new ok({innerType:t,typeName:ws.ZodOptional,...Ws(e)});class WR extends fi{_parse(e){return this._getType(e)===cr.null?np(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}WR.create=(t,e)=>new WR({innerType:t,typeName:ws.ZodNullable,...Ws(e)});class Lxe extends fi{_parse(e){const{ctx:n}=this._processInputParams(e);let r=n.data;return n.parsedType===cr.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:n.path,parent:n})}removeDefault(){return this._def.innerType}}Lxe.create=(t,e)=>new Lxe({innerType:t,typeName:ws.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...Ws(e)});class Dxe extends fi{_parse(e){const{ctx:n}=this._processInputParams(e),r={...n,common:{...n.common,issues:[]}},s=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return CZ(s)?s.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new a0(r.common.issues)},input:r.data})})):{status:"valid",value:s.status==="valid"?s.value:this._def.catchValue({get error(){return new a0(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}Dxe.create=(t,e)=>new Dxe({innerType:t,typeName:ws.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...Ws(e)});class aVe extends fi{_parse(e){if(this._getType(e)!==cr.nan){const r=this._getOrReturnCtx(e);return Gn(r,{code:fn.invalid_type,expected:cr.nan,received:r.parsedType}),ys}return{status:"valid",value:e.data}}}aVe.create=t=>new aVe({typeName:ws.ZodNaN,...Ws(t)});class yor extends fi{_parse(e){const{ctx:n}=this._processInputParams(e),r=n.data;return this._def.type._parse({data:r,path:n.path,parent:n})}unwrap(){return this._def.type}}class Q_e extends fi{_parse(e){const{status:n,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?ys:i.status==="dirty"?(n.dirty(),tD(i.value)):this._def.out._parseAsync({data:i.value,path:r.path,parent:r})})();{const s=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return s.status==="aborted"?ys:s.status==="dirty"?(n.dirty(),{status:"dirty",value:s.value}):this._def.out._parseSync({data:s.value,path:r.path,parent:r})}}static create(e,n){return new Q_e({in:e,out:n,typeName:ws.ZodPipeline})}}class $xe extends fi{_parse(e){const n=this._def.innerType._parse(e),r=s=>(VR(s)&&(s.value=Object.freeze(s.value)),s);return CZ(n)?n.then(s=>r(s)):r(n)}unwrap(){return this._def.innerType}}$xe.create=(t,e)=>new $xe({innerType:t,typeName:ws.ZodReadonly,...Ws(e)});Yo.lazycreate;var ws;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(ws||(ws={}));const wl=I1.create,oVe=Rxe.create;Vk.create;xy.create;const NM=Yo.create;Yo.strictCreate;EZ.create;NZ.create;G2.create;const lVe=Mxe.create;HR.create;TZ.create;ok.create;WR.create;function Z_e({title:t,headerTitle:e,description:n,thumbnail:r,archiveHref:s,framed:i=!1,compact:o=!1,children:l}){const c=i||o,d=a.jsxs("div",{className:ee("relative isolate bg-background text-foreground",!c&&"flex min-h-[100svh] flex-col"),children:[a.jsx("div",{className:"pointer-events-none absolute inset-0 -z-10 bg-[radial-gradient(ellipse_at_top_left,hsl(var(--primary)/0.10),transparent_55%)]","aria-hidden":"true"}),!o&&a.jsxs("header",{className:ee("mx-auto flex w-full max-w-6xl items-center gap-3",i?"px-6 pt-6":"px-5 py-4 sm:px-8 sm:py-8"),children:[a.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-primary/15 bg-primary/10 text-primary",children:a.jsx(Ii,{className:"h-4 w-4","aria-hidden":"true"})}),a.jsx("p",{className:"min-w-0 flex-1 break-words text-sm font-semibold leading-snug",children:e||t||"Newsletter"}),s&&a.jsxs(vr,{to:s,className:"inline-flex min-h-11 shrink-0 items-center gap-2 rounded-full border border-border bg-card px-3 text-xs font-medium transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary sm:px-4",children:[a.jsx(Iu,{className:"h-4 w-4","aria-hidden":"true"}),a.jsx("span",{children:"Archive"})]})]}),a.jsx("main",{className:ee("mx-auto w-full max-w-6xl",o?"p-4":i?"px-6 py-8":"flex-1 px-5 pb-16 pt-3 sm:px-8 sm:pb-20 lg:flex lg:items-center lg:py-14"),children:a.jsxs("div",{className:ee("grid min-w-0 w-full gap-6",!c&&"lg:grid-cols-[minmax(0,1.2fr)_minmax(0,1fr)] lg:items-center lg:gap-14",o&&"gap-5"),children:[a.jsxs("section",{className:"min-w-0",children:[r&&a.jsx("div",{className:ee("relative aspect-video w-full overflow-hidden rounded-2xl border border-border/60 bg-card shadow-sm",o?"mb-4":c?"mb-7 sm:rounded-3xl":"mb-5 sm:mb-7 sm:rounded-3xl"),children:a.jsx("img",{src:r,alt:"",fetchPriority:"high",className:"absolute inset-0 h-full w-full object-cover object-center"})}),a.jsxs("p",{className:"mb-3 inline-flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.2em] text-primary sm:mb-4",children:[a.jsx("span",{className:"h-px w-6 bg-primary","aria-hidden":"true"})," The newsletter"]}),a.jsx("h1",{className:ee("break-words font-semibold tracking-tight text-foreground [text-wrap:balance]",o?"text-xl":c?"text-2xl":"text-3xl leading-[1.15] sm:text-4xl xl:text-5xl"),children:t||"Newsletter title"}),n&&a.jsx("p",{className:ee("mt-3 max-w-xl whitespace-pre-line break-words leading-relaxed text-muted-foreground sm:mt-4",o?"text-xs":c?"text-sm":"text-base sm:text-lg"),children:n}),s&&a.jsxs("div",{className:"mt-5 border-t border-border/70 pt-4 sm:mt-7 sm:pt-5",children:[a.jsxs(vr,{to:s,className:"group inline-flex min-h-11 items-center gap-3 rounded-lg text-sm font-semibold text-foreground hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:["Explore past issues ",a.jsx(xa,{className:"h-4 w-4 motion-safe:transition-transform motion-safe:group-hover:translate-x-1","aria-hidden":"true"})]}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Get a feel for the newsletter before you subscribe."})]})]}),a.jsx("section",{"aria-label":"Newsletter signup",className:ee("relative min-w-0 rounded-2xl border border-border/80 bg-card shadow-[0_24px_80px_-36px_hsl(var(--primary)/0.3)]",o?"p-4":"p-5 sm:rounded-3xl sm:p-9"),children:l})]})}),!o&&a.jsxs("footer",{className:ee("mx-auto flex w-full max-w-6xl flex-wrap items-center justify-between gap-3 text-xs text-muted-foreground",i?"px-6 pb-6":"px-5 pb-8 sm:px-8"),children:[a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[a.jsx(Ii,{className:"h-3.5 w-3.5","aria-hidden":"true"})," Delivered to your inbox"]}),a.jsxs("span",{children:["Powered by ",a.jsx("span",{className:"font-semibold text-foreground",children:"SpatialChat Communities"})]})]})]});return i?a.jsxs("div",{className:"overflow-hidden rounded-xl border border-border shadow-lg",children:[a.jsx("div",{className:"flex items-center gap-1.5 border-b border-border bg-muted/60 px-3 py-2","aria-hidden":"true",children:[0,1,2].map(u=>a.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-muted-foreground/30"},u))}),d]}):d}function njt(){return a.jsxs("div",{className:"space-y-3 text-left",children:[a.jsx("p",{className:"text-lg font-semibold",children:"Subscribe to the newsletter"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Enter your email to stay in the loop."}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"text-xs font-medium",children:"Email address"}),a.jsx("div",{className:"rounded-xl border border-border px-3 py-3 text-sm text-muted-foreground",children:"you@example.com"})]}),a.jsxs("div",{className:"flex items-center justify-center gap-2 rounded-xl bg-primary px-4 py-3 text-sm font-semibold text-primary-foreground",children:["Subscribe ",a.jsx(xa,{className:"h-4 w-4"})]}),a.jsx("p",{className:"text-center text-xs text-muted-foreground",children:"Unsubscribe anytime."})]})}const Jn=t=>encodeURIComponent(t);function dr(t){return`/email/community/${Jn(t)}`}function _h(t,e){const n=new URLSearchParams;Object.entries(e).forEach(([s,i])=>{i!=null&&String(i).trim()!==""&&n.set(s,String(i))});const r=n.toString();return r?`${t}?${r}`:t}function TM(t){return{data:Array.isArray(t.data)?t.data:[],page:t.page??1,limit:t.limit??10,total:t.total??0,message:t.message}}async function bor(t,e={}){const n=await ae.get(_h(`${dr(t)}/campaigns`,e));return TM(n)}async function xor(t,e){return(await ae.get(`${dr(t)}/campaigns/${Jn(e)}`)).campaign}async function wor(t,e){return(await ae.post(`${dr(t)}/campaigns`,e)).campaign}async function kor(t,e,n){return(await ae.patch(`${dr(t)}/campaigns/${Jn(e)}`,n)).campaign}async function Sor(t,e){return ae.delete(`${dr(t)}/campaigns/${Jn(e)}`)}async function Cor(t,e,n){return(await ae.post(`${dr(t)}/campaigns/${Jn(e)}/duplicate`,n?{title:n}:void 0)).campaign}async function jor(t,e,n){return(await ae.post(`${dr(t)}/campaigns/${Jn(e)}/folder`,{folderId:n})).campaign}async function Eor(t,e,n={}){return ae.post(`/email/campaigns/${Jn(e)}/send`,n)}async function Nor(t,e,n){return ae.post(`/email/campaigns/${Jn(e)}/test`,n)}async function Tor(t,e,n){return ae.post(`/email/campaigns/${Jn(e)}/schedule`,n)}async function _or(t,e){return ae.post(`/email/campaigns/${Jn(e)}/unschedule`)}async function Aor(t,e={}){const n=await ae.get(_h(`${dr(t)}/newsletters`,e));return TM(n)}async function Por(t){return ae.get(`${dr(t)}/newsletter-settings`)}async function Ror(t,e){return(await ae.post(`${dr(t)}/newsletters`,e)).newsletter}async function Ior(t,e,n){return(await ae.patch(`${dr(t)}/newsletters/${Jn(e)}`,n)).newsletter}async function Mor(t,e){return ae.delete(`${dr(t)}/newsletters/${Jn(e)}`)}async function rjt(t,e,n={}){const r=await ae.get(_h(`${dr(t)}/newsletters/${Jn(e)}/posts`,n));return TM({...r,data:r.data??r.posts})}async function Lor(t,e,n){return(await ae.post(`${dr(t)}/newsletters/${Jn(e)}/posts`,n)).post}async function Dor(t,e,n){return(await ae.patch(`${dr(t)}/posts/${Jn(e)}`,n)).post}async function $or(t,e,n){return(await ae.post(`/email/newsletters/${Jn(e)}/posts/${Jn(n)}/publish`)).post}async function Oor(t,e,n){return ae.post(`/email/newsletters/${Jn(t)}/posts/${Jn(e)}/test`,n?{email:n}:{})}async function For(t,e,n){return ae.post(`${dr(t)}/posts/${Jn(e)}/schedule`,{scheduledAt:n})}async function Bor(t,e){return ae.post(`${dr(t)}/posts/${Jn(e)}/unschedule`)}async function Uor(t,e){return ae.delete(`${dr(t)}/posts/${Jn(e)}`)}async function sjt(t,e,n={}){const r=await ae.get(_h(`${dr(t)}/newsletters/${Jn(e)}/subscribers`,n));return TM(r)}async function zor(t,e,n){return(await ae.post(`${dr(t)}/newsletters/${Jn(e)}/subscribers`,n)).subscriber}async function Vor(t,e,n){return(await ae.patch(`${dr(t)}/subscribers/${Jn(e)}`,n)).subscriber}async function Hor(t,e){return ae.delete(`${dr(t)}/subscribers/${Jn(e)}`)}async function Gor(t,e){return ae.post(`${dr(t)}/subscribers/${Jn(e)}/resend-confirmation`)}async function Wor(t,e){return ae.post(`${dr(t)}/newsletters/${Jn(e)}/subscribers/confirm-pending`,{consentAttested:!0})}async function qor(t,e,n={}){return ae.post(`${dr(t)}/newsletters/${Jn(e)}/subscribers/resend-confirmations`,n)}async function Kor(t,e,n){const r=new FormData;return r.set("csv",n),Ea(`${dr(t)}/newsletters/${Jn(e)}/subscribers/import`,r)}async function Yor(t,e,n={}){return ae.post(`${dr(t)}/newsletters/${Jn(e)}/subscribers/from-community`,n)}async function Qor(t,e={}){const n=await ae.get(_h(`${dr(t)}/audience`,e));return TM(n)}async function Zor(t,e){const{tags:n,...r}=e;return ae.get(_h(`${dr(t)}/audience/count`,{...r,tags:n==null?void 0:n.join(",")}))}async function Jor(t){const e=await ae.get(`${dr(t)}/audience/tags`);return Array.isArray(e.tags)?e.tags:[]}async function Xor(t,e,n){const r=new FormData;return r.set("csv",e),n!=null&&n.length&&r.set("tags",JSON.stringify(n)),Ea(`${dr(t)}/audience/import`,r)}async function elr(t,e){return ae.get(`${dr(t)}/audience/import/${Jn(e)}`)}async function tlr(t,e){return ae.post(`${dr(t)}/audience`,e)}async function nlr(t,e,n){return ae.put(`${dr(t)}/audience/${Jn(e)}/tags`,{tags:n})}async function rlr(t){return(await ae.get(`${dr(t)}/audience/settings`)).settings}async function slr(t,e){return await ae.put(`${dr(t)}/audience/settings`,e)}async function ilr(t,e){return(await ae.post(`${dr(t)}/contacts`,e)).contact}async function alr(t,e,n){return(await ae.patch(`${dr(t)}/contacts/${Jn(e)}`,n)).contact}async function olr(t,e){return ae.delete(`${dr(t)}/contacts/${Jn(e)}`)}async function llr(t,e={}){const n=await ae.get(_h(`${dr(t)}/segments`,e));return TM(n)}async function clr(t,e){return(await ae.post(`${dr(t)}/segments`,e)).segment}async function dlr(t,e,n){return(await ae.patch(`${dr(t)}/segments/${Jn(e)}`,n)).segment}async function ulr(t,e){return ae.delete(`${dr(t)}/segments/${Jn(e)}`)}async function hlr(t,e){return(await ae.post("/email/admin/spam-check",{communityId:t,...e})).data??{score:0,level:"low",warnings:[]}}async function mlr(t,e,n={}){return(await ae.post(`/email/campaigns/${Jn(e)}/resend-non-openers`,n)).data??{resendCampaignId:"",recipients:0}}async function flr(t){const e=await ae.get(`${dr(t)}/templates`);return Array.isArray(e.templates)?e.templates:[]}async function Qre(t,e){var i;const n=new FormData;n.append("images[]",e,e.name);const r=await Ea(`/community/${Jn(t)}/media/upload?attachmentType=image`,n),s=(i=r==null?void 0:r.publicUrls)==null?void 0:i[0];if(!s)throw new Error("Upload failed");return s}async function plr(t,e){var i;const n=new FormData;n.append("documents[]",e,e.name);const r=await Ea(`/community/${Jn(t)}/media/upload?attachmentType=document`,n),s=(i=r==null?void 0:r.publicUrls)==null?void 0:i[0];if(!s)throw new Error("Upload failed");return s}async function glr(t,e){const n=await ae.get(`/email/campaigns/${Jn(e)}/report`);if(!n.data)throw new Error("Campaign report unavailable");return n.data}async function ijt(t,e){const n="campaignId"in t?`/email/campaigns/${Jn(t.campaignId)}`:`/email/newsletters/${Jn(t.newsletterId)}/posts/${Jn(t.postId)}`,r=await ae.get(_h(`${n}/undelivered`,e));if(!r.data)throw new Error("List unavailable");return r.data}async function vlr(t,e,n){const r=await ae.get(`/email/newsletters/${Jn(e)}/posts/${Jn(n)}/report`);if(!r.data)throw new Error("Post report unavailable");return r.data}async function ylr(t,e,n="DORMANT"){return ae.post("/email/admin/suppressions",{communityId:t,email:e,reason:n,justification:"Toggled from the member directory"})}async function blr(t,e,n="DORMANT"){return ae.post("/email/admin/suppressions/release",{communityId:t,email:e,reason:n,justification:"Toggled from the member directory"})}async function xlr(t){return(await ae.get(`/email/newsletters/${Jn(t)}/public`,{skipAuth:!0})).newsletter}async function wlr(t,e){return ae.post(`/email/newsletters/${Jn(t)}/subscribe`,e,{skipAuth:!0})}async function cVe(t,e){return ae.post("/email/unsubscribe",e?{token:t,scope:e}:{token:t},{skipAuth:!0})}async function klr(t,e){return ae.post(`/email/newsletters/${Jn(t)}/confirm`,{token:e},{skipAuth:!0})}async function Slr(t){var n;return((n=(await ae.get(_h("/email/admin/sender-domains",{communityId:t}))).data)==null?void 0:n.domains)??[]}async function Clr(t,e){return(await ae.post("/email/admin/sender-domains",{communityId:t,domain:e})).data}async function jlr(t,e){return(await ae.patch(`/email/admin/sender-domains/${Jn(e)}/verify`,{communityId:t})).data}async function Elr(t){return ae.get(_h("/email/preferences",{token:t}),{skipAuth:!0})}async function Nlr(t,e){return ae.post("/email/preferences",{token:t,...e},{skipAuth:!0})}async function Tlr(t,e={}){return ae.get(_h(`/email/newsletters/${Jn(t)}/posts/public`,e),{skipAuth:!0})}async function _lr(t,e){return(await ae.post(`${dr(t)}/videos`,e)).video}async function ajt(t,e,n){return(await ae.put(`${dr(t)}/videos/${Jn(e)}/thumbnail`,{thumbnailUrl:n})).video}async function ojt(t){return(await ae.get(`/email/videos/${Jn(t)}/public`,{skipAuth:!0})).video}async function Alr(t){return ae.get(`/email/posts/${Jn(t)}/public`,{skipAuth:!0})}async function ljt(t,e){return(await ae.get(_h(`${dr(t)}/sequences`,{kind:e}))).sequences??[]}async function dVe(t,e){return(await ae.post(`${dr(t)}/sequences`,e)).sequence}async function Plr(t,e,n){return(await ae.patch(`${dr(t)}/sequences/${Jn(e)}`,n)).sequence}async function Rlr(t,e){return ae.delete(`${dr(t)}/sequences/${Jn(e)}`)}async function Ilr(t,e,n){return(await ae.post(`${dr(t)}/sequences/${Jn(e)}/${n}`,{})).sequence}async function Mlr(t,e={}){return await ae.get(_h(`${dr(t)}/forms`,e))}async function Llr(t,e){return(await ae.post(`${dr(t)}/forms`,e)).form}async function Dlr(t,e,n){return(await ae.patch(`${dr(t)}/forms/${Jn(e)}`,n)).form}async function $lr(t,e,n){return(await ae.post(`${dr(t)}/forms/${Jn(e)}/publish`,n?{status:n}:{})).form}async function Olr(t,e){return ae.delete(`${dr(t)}/forms/${Jn(e)}`)}async function Flr(t,e,n={}){const r=await ae.get(_h(`${dr(t)}/forms/${Jn(e)}/submissions`,n));return{submissions:Array.isArray(r.submissions)?r.submissions:[],total:r.total??0,page:r.page??1,limit:r.limit??20}}async function Blr(t){return(await ae.get(`/email/forms/${Jn(t)}/public`,{skipAuth:!0})).form}async function Ulr(t,e){return ae.post(`/email/forms/${Jn(t)}/submit`,e,{skipAuth:!0})}async function zlr(t){const e=await ae.get(`${dr(t)}/funnels`);return Array.isArray(e.funnels)?e.funnels:[]}async function Vlr(t,e){return(await ae.post(`${dr(t)}/funnels`,e)).funnel}async function Hlr(t,e,n){return(await ae.patch(`${dr(t)}/funnels/${Jn(e)}`,n)).funnel}async function Glr(t,e,n){return(await ae.post(`${dr(t)}/funnels/${Jn(e)}/activate`,n?{status:n}:{})).funnel}async function Wlr(t,e){return ae.delete(`${dr(t)}/funnels/${Jn(e)}`)}async function cjt(t){return ae.get(`/email/me/communities/${Jn(t)}/email-preferences`)}async function Oxe(t,e){return ae.put(`/email/me/communities/${Jn(t)}/email-preferences`,e)}const qlr=NM({name:wl().trim().min(1,"Enter your name.").max(120,"Name is too long."),email:wl().trim().min(1,"Email is required.").email("Enter a valid email address.")});function Klr(){var u,h,m,f,p,g;const{newsletterId:t=""}=So(),e=lt({queryKey:["public-newsletter",t],queryFn:()=>xlr(t),enabled:!!t,retry:!1}),n=jM({resolver:EM(qlr),defaultValues:{name:"",email:""}}),r=jt({mutationFn:v=>wlr(t,{email:v.email,name:v.name})}),s=e.data,i=((u=s==null?void 0:s.title)==null?void 0:u.trim())||"",o=((h=s==null?void 0:s.signup.headline)==null?void 0:h.trim())||i||"Join our newsletter",l=((m=s==null?void 0:s.signup.subtext)==null?void 0:m.trim())||((f=s==null?void 0:s.description)==null?void 0:f.trim())||"";y.useEffect(()=>{i&&(document.title=i)},[i]);const c=y.useMemo(()=>{const v=r.error;return v instanceof ze?v.message:v?"Something went wrong. Please try again.":null},[r.error]),d=e.error instanceof ze&&[404,410].includes(e.error.status);return e.isLoading?a.jsxs("div",{role:"status",className:"flex min-h-[100svh] flex-col items-center justify-center bg-background text-muted-foreground",children:[a.jsx(Ne,{className:"h-6 w-6 animate-spin"}),a.jsx("p",{className:"mt-3 text-sm",children:"Loading your newsletter…"})]}):e.isError?a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background px-4",children:a.jsxs("div",{className:"max-w-md py-8 text-center",children:[a.jsx(qBt,{className:"mx-auto mb-4 h-9 w-9 text-muted-foreground","aria-hidden":"true"}),a.jsx("h1",{className:"text-xl font-semibold text-foreground",children:d?"Newsletter unavailable":"Unable to load this newsletter"}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:d?"This link may have expired, or the newsletter is no longer published.":"Check your connection and try again. Your subscription has not been changed."}),!d&&a.jsx(Z,{variant:"outline",className:"mt-5",disabled:e.isFetching,onClick:()=>e.refetch(),children:e.isFetching?"Retrying…":"Try again"})]})}):a.jsx(Z_e,{title:o,headerTitle:i,thumbnail:s==null?void 0:s.thumbnail,description:l,archiveHref:ve.newsletterArchive(t),children:r.isSuccess?r.data.pending?a.jsx(uVe,{icon:a.jsx(gO,{className:"h-10 w-10 text-primary"}),title:r.data.confirmationSent===!1?"One more step":"Check your inbox",body:r.data.confirmationSent===!1?a.jsxs(a.Fragment,{children:["We added"," ",a.jsx("span",{className:"break-all font-medium text-foreground",children:((p=r.variables)==null?void 0:p.email)??"your inbox"}),", but the confirmation email didn't send. Try again in a moment, or ask the newsletter owner to resend it."]}):a.jsxs(a.Fragment,{children:["We've sent a confirmation link to"," ",a.jsx("span",{className:"font-medium text-foreground",children:((g=r.variables)==null?void 0:g.email)??"your inbox"}),". Click it to activate your subscription. You won't receive issues until you confirm."]}),extra:a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:"Didn't get it? Check your spam folder, or subscribe again with the same email to resend."}),a.jsx(Z,{type:"button",variant:"outline",className:"mt-5 min-h-11 w-full",onClick:()=>{r.reset(),requestAnimationFrame(()=>n.setFocus("email"))},children:"Edit email or try again"})]})}):a.jsx(uVe,{icon:a.jsx(yo,{className:"h-10 w-10 text-success"}),title:"You're subscribed!",body:r.data.message}):a.jsxs("form",{className:"space-y-4 text-left sm:space-y-5",noValidate:!0,"aria-busy":r.isPending,onSubmit:n.handleSubmit(v=>{r.isPending||r.mutate(v)}),children:[a.jsxs("div",{className:"mb-4 sm:mb-6",children:[a.jsx("span",{className:"mb-3 inline-flex h-10 w-10 items-center justify-center rounded-2xl bg-primary/10 text-primary sm:mb-5 sm:h-11 sm:w-11",children:a.jsx(gO,{className:"h-5 w-5","aria-hidden":"true"})}),a.jsx("h2",{className:"text-xl font-semibold tracking-tight sm:text-2xl",children:"A little closer to the story."}),a.jsx("p",{className:"mt-2 text-sm leading-relaxed text-muted-foreground",children:"Subscribe to get new issues delivered to your inbox."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{htmlFor:"signup-email",className:"text-sm font-medium",children:["Email address ",a.jsx("span",{className:"sr-only",children:"(required)"})]}),a.jsx(Oe,{id:"signup-email",type:"email",inputMode:"email",autoCapitalize:"none",spellCheck:!1,...n.register("email"),placeholder:"you@example.com",autoComplete:"email",required:!0,readOnly:r.isPending,"aria-invalid":!!n.formState.errors.email,"aria-describedby":n.formState.errors.email?"signup-email-error":void 0,className:"h-12 min-w-0 rounded-xl bg-background px-4 text-base md:text-base aria-[invalid=true]:border-destructive"}),n.formState.errors.email&&a.jsx("p",{id:"signup-email-error",role:"alert",className:"text-sm text-destructive",children:n.formState.errors.email.message})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{htmlFor:"signup-name",className:"text-sm font-medium",children:"Your name"}),a.jsx(Oe,{id:"signup-name",...n.register("name"),placeholder:"What should we call you?",autoComplete:"name",readOnly:r.isPending,maxLength:120,"aria-invalid":!!n.formState.errors.name,"aria-describedby":n.formState.errors.name?"signup-name-error":void 0,className:"h-12 rounded-xl bg-background px-4 text-base md:text-base"}),n.formState.errors.name&&a.jsx("p",{id:"signup-name-error",role:"alert",className:"text-sm text-destructive",children:n.formState.errors.name.message})]}),c&&a.jsx("p",{role:"alert",className:"rounded-xl border border-destructive/20 bg-destructive/5 p-3 text-sm text-destructive",children:c}),a.jsx(Z,{type:"submit",className:"h-12 w-full gap-2 rounded-xl text-base font-semibold shadow-sm",disabled:r.isPending,children:r.isPending?a.jsxs(a.Fragment,{children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin","aria-hidden":"true"})," Subscribing…"]}):a.jsxs(a.Fragment,{children:["Subscribe ",a.jsx(xa,{className:"h-4 w-4","aria-hidden":"true"})]})}),a.jsxs("div",{className:"flex items-start justify-center gap-2 border-t border-border/60 pt-4 text-xs leading-relaxed text-muted-foreground",children:[a.jsx(Sk,{className:"mt-0.5 h-4 w-4 shrink-0","aria-hidden":"true"}),a.jsxs("p",{className:"min-w-0 break-words",children:["We'll only email you about ",(i||"this newsletter").trim().replace(/[.]+$/,""),". Unsubscribe anytime."]})]})]})})}function uVe({icon:t,title:e,body:n,extra:r}){const s=y.useRef(null);return y.useEffect(()=>{var i;(i=s.current)==null||i.focus()},[]),a.jsxs("div",{ref:s,tabIndex:-1,role:"status",className:"break-words py-4 text-center outline-none",children:[a.jsx("div",{className:"flex justify-center",children:t}),a.jsx("h2",{className:"mt-4 text-xl font-semibold tracking-tight text-foreground",children:e}),a.jsx("p",{className:"mt-2 text-sm leading-relaxed text-muted-foreground",children:n}),r]})}function hVe(){var o;const{newsletterId:t=""}=So(),[e]=xc(),n=e.get("token")??"",r=lt({queryKey:["confirm-subscription",t,n],queryFn:()=>klr(t,n),enabled:!!(t&&n),retry:!1}),s=(()=>{const l=r.error;return l instanceof ze?Dt(l.body,l.message):"This confirmation link is invalid or has expired."})(),i=((o=r.data)==null?void 0:o.alreadyConfirmed)===!0;return a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gradient-to-b from-primary/5 to-background px-4 py-10",children:a.jsx("div",{className:"w-full max-w-md rounded-2xl border border-border bg-card p-8 text-center shadow-card",children:n?r.isLoading?a.jsxs("div",{className:"flex flex-col items-center gap-3 py-6 text-muted-foreground",children:[a.jsx(Ne,{className:"h-6 w-6 animate-spin"}),a.jsx("p",{className:"text-sm",children:"Confirming your subscription…"})]}):r.isError?a.jsxs(a.Fragment,{children:[a.jsx(oh,{className:"mx-auto h-12 w-12 text-destructive"}),a.jsx("h1",{className:"mt-4 text-xl font-bold text-foreground",children:"Confirmation failed"}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:s==="invalid_token"||s==="mismatch"?"This confirmation link is invalid or has expired. Try subscribing again to get a fresh link.":s==="not_found"?"We couldn't find this subscription. Try subscribing again.":s})]}):i?a.jsxs(a.Fragment,{children:[a.jsx(vk,{className:"mx-auto h-12 w-12 text-success"}),a.jsx("h1",{className:"mt-4 text-xl font-bold text-foreground",children:"Already confirmed"}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Your subscription is already active — you're all set. No further action needed."})]}):a.jsxs(a.Fragment,{children:[a.jsx(yo,{className:"mx-auto h-12 w-12 text-success"}),a.jsx("h1",{className:"mt-4 text-xl font-bold text-foreground",children:"Subscription confirmed!"}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Thanks for confirming — your subscription is now active and you'll start receiving emails."})]}):a.jsxs(a.Fragment,{children:[a.jsx(oh,{className:"mx-auto h-12 w-12 text-destructive"}),a.jsx("h1",{className:"mt-4 text-xl font-bold text-foreground",children:"Invalid confirmation link"}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"This link is missing its token. Please use the confirmation link from the email you received."})]})})})}function Ylr(){var c;const[t]=xc(),e=t.get("token")??"",[n,r]=y.useState(!1),s=lt({queryKey:["unsubscribe",e],queryFn:()=>cVe(e),enabled:!!e,retry:!1}),i=jt({mutationFn:()=>cVe(e,"all"),onSuccess:()=>r(!0)}),o=(d,u)=>d instanceof ze?Dt(d.body,d.message):u,l=n||((c=s.data)==null?void 0:c.scope)==="all";return a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gradient-to-b from-primary/5 to-background px-4 py-10",children:a.jsx("div",{className:"w-full max-w-md rounded-2xl border border-border bg-card p-8 text-center shadow-card",children:e?s.isLoading?a.jsxs("div",{className:"flex flex-col items-center gap-3 py-6 text-muted-foreground",children:[a.jsx(Ne,{className:"h-6 w-6 animate-spin"}),a.jsx("p",{className:"text-sm",children:"Processing your request…"})]}):s.isError?a.jsxs(a.Fragment,{children:[a.jsx(oh,{className:"mx-auto h-12 w-12 text-destructive"}),a.jsx("h1",{className:"mt-4 text-xl font-bold text-foreground",children:"Couldn't unsubscribe"}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:o(s.error,"This unsubscribe link is invalid or has expired.")})]}):a.jsxs(a.Fragment,{children:[a.jsx(yo,{className:"mx-auto h-12 w-12 text-success"}),a.jsx("h1",{className:"mt-4 text-xl font-bold text-foreground",children:"You've been unsubscribed"}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:l?"You won't receive any more newsletters or announcements from this community. Other communities you belong to are not affected.":"You won't receive any more emails from this newsletter. This community's other emails still reach you."}),!l&&a.jsxs("div",{className:"mt-6 border-t border-border pt-5",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Want to stop everything from this community?"}),a.jsx(Z,{variant:"outline",className:"mt-3 w-full",disabled:i.isPending,onClick:()=>i.mutate(),children:i.isPending?"Stopping…":"Unsubscribe from all emails from this community"}),i.isError&&a.jsx("p",{role:"alert",className:"mt-2 text-xs font-medium text-destructive",children:o(i.error,"Could not stop the rest. Please try again.")})]}),a.jsxs("p",{className:"mt-6 text-xs text-muted-foreground",children:["Prefer to keep some of them?"," ",a.jsx(vr,{className:"font-medium text-primary underline-offset-2 hover:underline",to:`${ve.preferences}?token=${encodeURIComponent(e)}`,children:"Manage your preferences"}),"."]})]}):a.jsxs(a.Fragment,{children:[a.jsx(oh,{className:"mx-auto h-12 w-12 text-destructive"}),a.jsx("h1",{className:"mt-4 text-xl font-bold text-foreground",children:"Invalid unsubscribe link"}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"This link is missing its token. Please use the unsubscribe link from the email you received."})]})})})}var J_e="Radio",[Qlr,djt]=il(J_e),[Zlr,Jlr]=Qlr(J_e),ujt=y.forwardRef((t,e)=>{const{__scopeRadio:n,name:r,checked:s=!1,required:i,disabled:o,value:l="on",onCheck:c,form:d,...u}=t,[h,m]=y.useState(null),f=Sr(e,v=>m(v)),p=y.useRef(!1),g=h?d||!!h.closest("form"):!0;return a.jsxs(Zlr,{scope:n,checked:s,disabled:o,children:[a.jsx(Sn.button,{type:"button",role:"radio","aria-checked":s,"data-state":pjt(s),"data-disabled":o?"":void 0,disabled:o,value:l,...u,ref:f,onClick:Kt(t.onClick,v=>{s||c==null||c(),g&&(p.current=v.isPropagationStopped(),p.current||v.stopPropagation())})}),g&&a.jsx(fjt,{control:h,bubbles:!p.current,name:r,value:l,checked:s,required:i,disabled:o,form:d,style:{transform:"translateX(-100%)"}})]})});ujt.displayName=J_e;var hjt="RadioIndicator",mjt=y.forwardRef((t,e)=>{const{__scopeRadio:n,forceMount:r,...s}=t,i=Jlr(hjt,n);return a.jsx(Rl,{present:r||i.checked,children:a.jsx(Sn.span,{"data-state":pjt(i.checked),"data-disabled":i.disabled?"":void 0,...s,ref:e})})});mjt.displayName=hjt;var Xlr="RadioBubbleInput",fjt=y.forwardRef(({__scopeRadio:t,control:e,checked:n,bubbles:r=!0,...s},i)=>{const o=y.useRef(null),l=Sr(o,i),c=i7(n),d=z8(e);return y.useEffect(()=>{const u=o.current;if(!u)return;const h=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(h,"checked").set;if(c!==n&&f){const p=new Event("click",{bubbles:r});f.call(u,n),u.dispatchEvent(p)}},[c,n,r]),a.jsx(Sn.input,{type:"radio","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:l,style:{...s.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});fjt.displayName=Xlr;function pjt(t){return t?"checked":"unchecked"}var ecr=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],Zre="RadioGroup",[tcr,pjs]=il(Zre,[wM,djt]),gjt=wM(),vjt=djt(),[ncr,rcr]=tcr(Zre),yjt=y.forwardRef((t,e)=>{const{__scopeRadioGroup:n,name:r,defaultValue:s,value:i,required:o=!1,disabled:l=!1,orientation:c,dir:d,loop:u=!0,onValueChange:h,...m}=t,f=gjt(n),p=ES(d),[g,v]=Sd({prop:i,defaultProp:s??null,onChange:h,caller:Zre});return a.jsx(ncr,{scope:n,name:r,required:o,disabled:l,value:g,onValueChange:v,children:a.jsx(GTe,{asChild:!0,...f,orientation:c,dir:p,loop:u,children:a.jsx(Sn.div,{role:"radiogroup","aria-required":o,"aria-orientation":c,"data-disabled":l?"":void 0,dir:p,...m,ref:e})})})});yjt.displayName=Zre;var bjt="RadioGroupItem",xjt=y.forwardRef((t,e)=>{const{__scopeRadioGroup:n,disabled:r,...s}=t,i=rcr(bjt,n),o=i.disabled||r,l=gjt(n),c=vjt(n),d=y.useRef(null),u=Sr(e,d),h=i.value===s.value,m=y.useRef(!1);return y.useEffect(()=>{const f=g=>{ecr.includes(g.key)&&(m.current=!0)},p=()=>m.current=!1;return document.addEventListener("keydown",f),document.addEventListener("keyup",p),()=>{document.removeEventListener("keydown",f),document.removeEventListener("keyup",p)}},[]),a.jsx(WTe,{asChild:!0,...l,focusable:!o,active:h,children:a.jsx(ujt,{disabled:o,required:i.required,checked:h,...c,...s,name:i.name,ref:u,onCheck:()=>i.onValueChange(s.value),onKeyDown:Kt(f=>{f.key==="Enter"&&f.preventDefault()}),onFocus:Kt(s.onFocus,()=>{var f;m.current&&((f=d.current)==null||f.click())})})})});xjt.displayName=bjt;var scr="RadioGroupIndicator",wjt=y.forwardRef((t,e)=>{const{__scopeRadioGroup:n,...r}=t,s=vjt(n);return a.jsx(mjt,{...s,...r,ref:e})});wjt.displayName=scr;var kjt=yjt,Sjt=xjt,icr=wjt;const TS=y.forwardRef(({className:t,...e},n)=>a.jsx(kjt,{className:ee("grid gap-2",t),...e,ref:n}));TS.displayName=kjt.displayName;const Ly=y.forwardRef(({className:t,...e},n)=>a.jsx(Sjt,{ref:n,className:ee("aspect-square h-4 w-4 rounded-full border border-primary text-primary ring-offset-background focus:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",t),...e,children:a.jsx(icr,{className:"flex items-center justify-center",children:a.jsx(Ag,{className:"h-2.5 w-2.5 fill-current text-current"})})}));Ly.displayName=Sjt.displayName;const acr=[{value:"all",label:"All emails",desc:"Every newsletter and update."},{value:"weekly",label:"Weekly digest",desc:"A summary once a week."},{value:"monthly",label:"Monthly digest",desc:"A summary once a month."},{value:"off",label:"Pause all emails",desc:"Don't send me anything for now."}];function ocr(){const[t]=xc(),e=t.get("token")??"",n=lt({queryKey:["email-preferences",e],queryFn:()=>Elr(e),enabled:!!e,retry:!1}),[r,s]=y.useState("all"),[i,o]=y.useState([]),[l,c]=y.useState("");y.useEffect(()=>{var m;(m=n.data)!=null&&m.ok&&(s(n.data.frequency??"all"),o(n.data.topics??[]))},[n.data]);const d=jt({mutationFn:()=>Nlr(e,{frequency:r,topics:i})}),u=()=>{const m=l.trim();if(!m||i.includes(m)){c("");return}o(f=>[...f,m]),c("")},h=(()=>{const m=n.error;return m instanceof ze?Dt(m.body,m.message):"This link is invalid or has expired."})();return a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gradient-to-b from-primary/5 to-background px-4 py-10",children:a.jsx("div",{className:"w-full max-w-lg rounded-2xl border border-border bg-card p-8 shadow-card",children:!e||n.isError?a.jsxs("div",{className:"py-6 text-center",children:[a.jsx(oh,{className:"mx-auto h-12 w-12 text-destructive"}),a.jsx("h1",{className:"mt-4 text-xl font-bold text-foreground",children:"Preferences unavailable"}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:e?h==="invalid_token"?"This preferences link is invalid or has expired. Use the link from a more recent email.":h:"This link is missing its token. Please use the preferences link from an email you received."})]}):n.isLoading?a.jsxs("div",{className:"flex flex-col items-center gap-3 py-10 text-muted-foreground",children:[a.jsx(Ne,{className:"h-6 w-6 animate-spin"}),a.jsx("p",{className:"text-sm",children:"Loading your preferences…"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Email preferences"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Choose how often you hear from us — no need to unsubscribe completely."})]}),a.jsxs("div",{className:"mt-6",children:[a.jsx(_e,{className:"text-sm font-semibold text-foreground",children:"How often?"}),a.jsx(TS,{className:"mt-3 gap-2",value:r,onValueChange:m=>s(m),children:acr.map(m=>a.jsxs("label",{htmlFor:`freq-${m.value}`,className:ee("flex cursor-pointer items-start gap-3 rounded-lg border p-3 transition-colors",r===m.value?"border-primary bg-primary/5":"border-border hover:bg-muted/60"),children:[a.jsx(Ly,{id:`freq-${m.value}`,value:m.value,className:"mt-0.5"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:m.label}),a.jsx("p",{className:"text-xs text-muted-foreground",children:m.desc})]})]},m.value))})]}),a.jsxs("div",{className:"mt-6",children:[a.jsx(_e,{className:"text-sm font-semibold text-foreground",children:"Topics you care about"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Optional — we'll prioritise emails matching these."}),a.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[i.length===0&&a.jsx("span",{className:"text-xs text-muted-foreground",children:"No topics selected."}),i.map(m=>a.jsxs(ga,{variant:"secondary",className:"gap-1 py-1",children:[m,a.jsx("button",{type:"button",onClick:()=>o(f=>f.filter(p=>p!==m)),className:"ml-0.5 rounded-full hover:text-destructive","aria-label":`Remove ${m}`,children:a.jsx(nn,{className:"h-3 w-3"})})]},m))]}),a.jsxs("div",{className:"mt-2 flex gap-2",children:[a.jsx(Oe,{value:l,onChange:m=>c(m.target.value),onKeyDown:m=>{m.key==="Enter"&&(m.preventDefault(),u())},placeholder:"Add a topic…",className:"h-9"}),a.jsx(Z,{type:"button",variant:"outline",size:"icon",className:"h-9 w-9 shrink-0",onClick:u,children:a.jsx(Dn,{className:"h-4 w-4"})})]})]}),d.isSuccess&&a.jsxs("div",{className:"mt-5 flex items-center gap-2 rounded-lg border border-success/20 bg-success/10 px-3 py-2 text-sm text-success",children:[a.jsx(yo,{className:"h-4 w-4"})," Your preferences have been saved."]}),d.isError&&a.jsx("p",{className:"mt-5 text-sm font-medium text-destructive",children:d.error instanceof ze?d.error.message:"Couldn't save. Please try again."}),a.jsx("div",{className:"mt-6 flex justify-end",children:a.jsxs(Z,{onClick:()=>d.mutate(),disabled:d.isPending,children:[d.isPending&&a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}),"Save preferences"]})})]})})})}const TV=10;function lcr(t){return!t||Number.isNaN(new Date(t).getTime())?"":new Date(t).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}function ccr(){var p,g,v;const{newsletterId:t=""}=So(),[e,n]=y.useState({newsletterId:t,page:1}),r=e.newsletterId===t?e.page:1,s=y.useRef(null),i=y.useRef(!1),o=lt({queryKey:["public-archive",t,r],queryFn:()=>Tlr(t,{page:r,limit:TV}),enabled:!!t,placeholderData:(b,x)=>(x==null?void 0:x.queryKey[1])===t?b:void 0,retry:!1}),l=(p=o.data)==null?void 0:p.newsletter,c=((g=o.data)==null?void 0:g.data)??[],d=((v=o.data)==null?void 0:v.total)??0,u=Math.max(1,Math.ceil(d/TV)),h=ve.newsletterSignup(t),m=o.error instanceof ze&&[404,410].includes(o.error.status);y.useEffect(()=>{l!=null&&l.title&&(document.title=`${l.title} — Archive`)},[l==null?void 0:l.title]),y.useEffect(()=>{var b,x;i.current&&!o.isFetching&&((b=s.current)==null||b.focus({preventScroll:!0}),(x=s.current)==null||x.scrollIntoView({block:"start"}),i.current=!1)},[o.isFetching]);function f(b){i.current=!0,n({newsletterId:t,page:b})}return a.jsxs("div",{className:"relative isolate flex min-h-[100svh] flex-col bg-background text-foreground",children:[a.jsx("div",{"aria-hidden":"true",className:"pointer-events-none absolute inset-0 -z-10 bg-[radial-gradient(ellipse_at_top_left,hsl(var(--primary)/0.10),transparent_55%)]"}),a.jsxs("header",{className:"mx-auto flex w-full max-w-6xl items-center justify-between gap-3 px-5 py-4 sm:gap-4 sm:px-8 sm:py-8",children:[a.jsxs(vr,{to:h,className:"flex min-w-0 items-center gap-3 rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:[a.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-primary/15 bg-primary/10 text-primary",children:a.jsx(Ii,{className:"h-4 w-4","aria-hidden":"true"})}),a.jsx("span",{className:"min-w-0 break-words text-sm font-semibold",children:(l==null?void 0:l.title)||"The newsletter"})]}),a.jsx(Z,{asChild:!0,className:"min-h-11 shrink-0 gap-2 rounded-full px-4 sm:px-5",children:a.jsxs(vr,{to:h,children:["Subscribe ",a.jsx(xa,{className:"h-4 w-4","aria-hidden":"true"})]})})]}),a.jsx("main",{className:"mx-auto w-full max-w-6xl flex-1 px-5 pb-16 sm:px-8",children:o.isLoading?a.jsxs("div",{role:"status",className:"flex flex-col items-center gap-3 py-24 text-muted-foreground",children:[a.jsx(Ne,{className:"h-6 w-6 animate-spin","aria-hidden":"true"}),a.jsx("p",{children:"Opening the archive…"})]}):o.isError?a.jsxs("div",{role:"alert",className:"mx-auto my-12 max-w-lg rounded-3xl border border-border bg-card p-8 text-center",children:[a.jsx(Iu,{className:"mx-auto mb-5 h-8 w-8 text-primary","aria-hidden":"true"}),a.jsx("h1",{className:"text-2xl font-semibold",children:m?"Archive unavailable":"We couldn’t load the archive"}),a.jsx("p",{className:"mt-3 text-sm leading-relaxed text-muted-foreground",children:m?"This newsletter may no longer be published.":"Please check your connection and try again."}),!m&&a.jsx(Z,{className:"mt-6",disabled:o.isFetching,onClick:()=>o.refetch(),children:"Try again"})]}):a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"border-b border-border/70 pb-8 pt-4 sm:pb-12 sm:pt-12",children:[a.jsxs("p",{className:"mb-4 flex items-center gap-2 text-[11px] font-semibold uppercase tracking-[0.2em] text-primary sm:mb-5",children:[a.jsx("span",{className:"h-px w-6 bg-primary","aria-hidden":"true"})," The archive"]}),a.jsxs("div",{className:"grid gap-6 md:grid-cols-[1.2fr_1fr] md:items-end md:gap-12",children:[a.jsxs("h1",{className:"max-w-xl text-4xl font-semibold leading-[1.08] tracking-tight [text-wrap:balance] sm:text-5xl lg:text-6xl",children:["Stories worth",a.jsx("br",{className:"hidden sm:block"})," coming back to."]}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"max-w-lg whitespace-pre-line break-words text-base leading-relaxed text-muted-foreground",children:(l==null?void 0:l.description)||"Explore past issues, discover something new, and pick up where you left off."}),a.jsxs("p",{className:"mt-5 text-xs font-medium text-muted-foreground",children:[d," published ",d===1?"issue":"issues",a.jsx("span",{className:"mx-2","aria-hidden":"true",children:"/"}),"Read at your own pace"]})]})]})]}),a.jsxs("section",{"aria-labelledby":"archive-issues","aria-busy":o.isFetching,className:"pt-8 sm:pt-10",children:[a.jsxs("div",{className:"mb-6 flex flex-wrap items-center justify-between gap-2 sm:gap-4",children:[a.jsx("h2",{id:"archive-issues",ref:s,tabIndex:-1,className:"scroll-mt-6 text-lg font-semibold tracking-tight outline-none",children:r===1?"Latest issues":"Past issues"}),a.jsx("span",{role:"status",className:"text-xs text-muted-foreground",children:o.isFetching?"Loading…":d>0?`Showing ${(r-1)*TV+1}–${Math.min(r*TV,d)} of ${d}`:"A new chapter starts here"})]}),c.length===0?a.jsxs("div",{className:"rounded-3xl border border-dashed border-primary/25 bg-card px-6 py-16 text-center",children:[a.jsx("span",{className:"mx-auto mb-5 flex h-14 w-14 items-center justify-center rounded-2xl bg-primary/10 text-primary",children:a.jsx(Iu,{className:"h-6 w-6","aria-hidden":"true"})}),a.jsx("h3",{className:"text-2xl font-semibold tracking-tight",children:"The first issue is still to come."}),a.jsx("p",{className:"mx-auto mt-3 max-w-sm text-sm leading-relaxed text-muted-foreground",children:"Subscribe now and get it in your inbox when it’s published."}),a.jsx(Z,{asChild:!0,className:"mt-6 min-h-11 rounded-full px-6",children:a.jsx(vr,{to:h,children:"Join the newsletter"})})]}):a.jsx("ul",{className:"grid gap-5 sm:grid-cols-2 lg:gap-6",children:c.map((b,x)=>a.jsx("li",{className:ee("min-w-0",r===1&&x===0&&"sm:col-span-2"),children:a.jsx(dcr,{post:b,newsletterId:t,featured:r===1&&x===0})},b.id))}),u>1&&a.jsxs("nav",{"aria-label":"Archive pages",className:"mt-8 flex items-center justify-between gap-2 border-t border-border pt-6",children:[a.jsxs(Z,{variant:"outline",className:"min-h-11 gap-2 rounded-full px-3 sm:px-4",disabled:r<=1||o.isFetching,onClick:()=>f(r-1),children:[a.jsx(no,{className:"h-4 w-4","aria-hidden":"true"})," Previous"]}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[r," / ",u]}),a.jsxs(Z,{variant:"outline",className:"min-h-11 gap-2 rounded-full px-3 sm:px-4",disabled:r>=u||o.isFetching,onClick:()=>f(r+1),children:["Next ",a.jsx(xa,{className:"h-4 w-4","aria-hidden":"true"})]})]})]}),c.length>0&&a.jsxs("aside",{className:"mt-12 flex flex-col items-start justify-between gap-6 rounded-3xl border border-primary/15 bg-primary/[0.06] p-6 sm:flex-row sm:items-center sm:p-9",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl font-semibold tracking-tight",children:"The next issue, straight to you."}),a.jsx("p",{className:"mt-2 text-sm leading-relaxed text-muted-foreground",children:"Stay in the loop. Subscribe and unsubscribe anytime."})]}),a.jsx(Z,{asChild:!0,className:"min-h-12 w-full shrink-0 gap-2 rounded-full px-6 sm:w-auto",children:a.jsxs(vr,{to:h,children:["Subscribe to the newsletter ",a.jsx(xa,{className:"h-4 w-4","aria-hidden":"true"})]})})]})]})}),a.jsxs("footer",{className:"mx-auto flex w-full max-w-6xl flex-wrap items-center justify-between gap-3 px-5 pb-8 text-xs text-muted-foreground sm:px-8",children:[a.jsxs("span",{className:"inline-flex items-center gap-2",children:[a.jsx(Iu,{className:"h-3.5 w-3.5","aria-hidden":"true"})," A home for every issue"]}),a.jsxs("span",{children:["Powered by ",a.jsx("span",{className:"font-semibold text-foreground",children:"SpatialChat Communities"})]})]})]})}function dcr({post:t,newsletterId:e,featured:n}){var s,i;const r=lcr(t.publishedAt);return a.jsx("article",{className:"h-full",children:a.jsxs(vr,{to:ve.newsletterPostPublic(e,t.id),className:ee("group flex h-full min-w-0 flex-col overflow-hidden rounded-3xl border border-border/80 bg-card transition-colors hover:border-primary/40 hover:shadow-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-4",n&&"sm:grid sm:grid-cols-2"),children:[a.jsxs("div",{className:ee("relative flex aspect-[16/9] items-center justify-center overflow-hidden bg-gradient-to-br from-primary/15 via-primary/5 to-muted",n&&"sm:aspect-auto sm:min-h-72"),children:[t.thumbnail?a.jsx("img",{src:t.thumbnail,alt:"",loading:n?"eager":"lazy",className:"absolute inset-0 h-full w-full object-cover motion-safe:transition-transform motion-safe:duration-500 motion-safe:group-hover:scale-105"}):a.jsx(Iu,{className:"h-16 w-16 text-primary/25",strokeWidth:1,"aria-hidden":"true"}),n&&a.jsx("span",{className:"absolute left-5 top-5 rounded-full border border-border/50 bg-card px-3 py-1.5 text-[10px] font-semibold uppercase tracking-widest text-foreground",children:"Latest issue"})]}),a.jsxs("div",{className:ee("flex min-w-0 flex-1 flex-col p-6",n&&"sm:justify-center sm:p-8 lg:p-10"),children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[r&&a.jsx("time",{dateTime:t.publishedAt,children:r}),(s=t.tags)==null?void 0:s.slice(0,2).map(o=>a.jsx("span",{className:"max-w-full break-words rounded-full bg-muted px-2.5 py-1",children:o},o))]}),a.jsx("h3",{className:ee("mt-3 break-words text-xl font-semibold leading-tight tracking-tight transition-colors group-hover:text-primary",n&&"sm:text-3xl"),children:t.title}),t.excerpt&&a.jsx("p",{className:"mt-3 line-clamp-3 break-words text-sm leading-relaxed text-muted-foreground",children:t.excerpt}),((i=t.authors)==null?void 0:i.length)>0&&a.jsxs("p",{className:"mt-4 break-words text-xs text-muted-foreground",children:["By ",t.authors.join(", ")]}),a.jsxs("span",{className:"mt-6 inline-flex items-center gap-2 text-sm font-semibold text-primary",children:["Read issue ",a.jsx(xa,{className:"h-4 w-4 motion-safe:transition-transform motion-safe:group-hover:translate-x-1","aria-hidden":"true"})]})]})]})})}const ucr=["bold","italic","underline","strikeThrough","insertUnorderedList","insertOrderedList","justifyCenter","justifyRight"];function X_e(t){const[e,n]=y.useState({}),r=y.useCallback(()=>{const s=t.current,i=window.getSelection(),o=(i==null?void 0:i.anchorNode)??null;if(!s||!o||!s.contains(o))return;const l={};for(const d of ucr)try{l[d]=document.queryCommandState(d)}catch{l[d]=!1}let c="";try{c=String(document.queryCommandValue("formatBlock")||"").toLowerCase()}catch{c=""}l["formatBlock:h1"]=c==="h1",l["formatBlock:h2"]=c==="h2",l["formatBlock:h3"]=c==="h3",l["formatBlock:blockquote"]=c==="blockquote",l["formatBlock:pre"]=c==="pre",n(d=>{const u=Object.keys(l);return u.length===Object.keys(d).length&&u.every(m=>d[m]===l[m])?d:l})},[t]);return y.useEffect(()=>{const s=()=>r();return document.addEventListener("selectionchange",s),()=>document.removeEventListener("selectionchange",s)},[r]),{formats:e,refresh:r}}function Cjt(t){const e=y.useRef(null);return y.useEffect(()=>{const n=()=>{const r=t.current,s=window.getSelection();if(!r||!(s!=null&&s.rangeCount))return;const i=s.getRangeAt(0);r.contains(i.commonAncestorContainer)&&(e.current={startNode:i.startContainer,startOffset:i.startOffset,endNode:i.endContainer,endOffset:i.endOffset})};return document.addEventListener("selectionchange",n),()=>document.removeEventListener("selectionchange",n)},[t]),y.useCallback(()=>{const n=t.current;if(!n)return;const r=window.getSelection(),s=r!=null&&r.rangeCount?r.getRangeAt(0):null,i=!!(s&&n.contains(s.commonAncestorContainer));if(n.focus(),!r||i)return;const o=document.createRange(),l=e.current;try{if(!l||!n.contains(l.startNode)||!n.contains(l.endNode))throw new Error("stale");o.setStart(l.startNode,l.startOffset),o.setEnd(l.endNode,l.endOffset)}catch{o.selectNodeContents(n),o.collapse(!1)}r.removeAllRanges(),r.addRange(o)},[t])}const Jre=/(^|[^\w@])@([a-zA-Z0-9_]+)(?![\w@])/g,hcr=/(^|[^\w@])@([a-zA-Z0-9._-]+)/g;function eAe(t,e=Jre){const n=[];for(const r of t.matchAll(new RegExp(e.source,"g"))){const s=(r.index??0)+r[1].length;n.push([s,s+1+r[2].length])}return n}function mcr(t,e=Jre){const n=[];let r=0;for(const[s,i]of eAe(t,e))s>r&&n.push({text:t.slice(r,s),mention:!1}),n.push({text:t.slice(s,i),mention:!0}),r=i;return r<t.length&&n.push({text:t.slice(r),mention:!1}),n}const mVe="mention";function jjt(){if(typeof CSS>"u"||typeof window>"u")return null;const t=CSS.highlights,e=window.Highlight;return t&&e?{registry:t,Highlight:e}:null}const Fxe=new Map;function fVe(){const t=jjt();if(!t)return;const e=[...Fxe.values()].flat();e.length===0?t.registry.delete(mVe):t.registry.set(mVe,new t.Highlight(...e))}function fcr(t,e){var s;const n=[],r=t.ownerDocument.createTreeWalker(t,NodeFilter.SHOW_TEXT);for(let i=r.nextNode();i;i=r.nextNode()){const o=i.nodeValue||"";if(!(!o.includes("@")||(s=i.parentElement)!=null&&s.closest("a, code, pre")))for(const[l,c]of eAe(o,e)){const d=t.ownerDocument.createRange();d.setStart(i,l),d.setEnd(i,c),n.push(d)}}return n}function Ejt(t,{enabled:e=!0,pattern:n=Jre}={}){y.useEffect(()=>{const r=t.current;if(!e||!r||!jjt())return;let s=0;const i=()=>{s=0,Fxe.set(r,fcr(r,n)),fVe()},o=()=>{s||(s=requestAnimationFrame(i))};i();const l=new MutationObserver(o);return l.observe(r,{childList:!0,subtree:!0,characterData:!0}),()=>{l.disconnect(),s&&cancelAnimationFrame(s),Fxe.delete(r),fVe()}},[t,e,n])}const fs={bold:"bold",italic:"italic",underline:"underline",strikeThrough:"strikeThrough",bulletList:"insertUnorderedList",numberedList:"insertOrderedList",alignCenter:"justifyCenter",alignRight:"justifyRight",heading1:"formatBlock:h1",heading:"formatBlock:h2",heading3:"formatBlock:h3",quote:"formatBlock:blockquote",code:"formatBlock:pre"};function pcr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t}function Bxe(t,e){return Array(e+1).join(t)}function Njt(t){return t.replace(/^\n*/,"")}function Tjt(t){for(var e=t.length;e>0&&t[e-1]===`
`;)e--;return t.substring(0,e)}function _jt(t){return Tjt(Njt(t))}var gcr=["ADDRESS","ARTICLE","ASIDE","AUDIO","BLOCKQUOTE","BODY","CANVAS","CENTER","DD","DIR","DIV","DL","DT","FIELDSET","FIGCAPTION","FIGURE","FOOTER","FORM","FRAMESET","H1","H2","H3","H4","H5","H6","HEADER","HGROUP","HR","HTML","ISINDEX","LI","MAIN","MENU","NAV","NOFRAMES","NOSCRIPT","OL","OUTPUT","P","PRE","SECTION","TABLE","TBODY","TD","TFOOT","TH","THEAD","TR","UL"];function tAe(t){return nAe(t,gcr)}var Ajt=["AREA","BASE","BR","COL","COMMAND","EMBED","HR","IMG","INPUT","KEYGEN","LINK","META","PARAM","SOURCE","TRACK","WBR"];function Pjt(t){return nAe(t,Ajt)}function vcr(t){return Ijt(t,Ajt)}var Rjt=["A","TABLE","THEAD","TBODY","TFOOT","TH","TD","IFRAME","SCRIPT","AUDIO","VIDEO"];function ycr(t){return nAe(t,Rjt)}function bcr(t){return Ijt(t,Rjt)}function nAe(t,e){return e.indexOf(t.nodeName)>=0}function Ijt(t,e){return t.getElementsByTagName&&e.some(function(n){return t.getElementsByTagName(n).length})}var xcr=[[/\\/g,"\\\\"],[/\*/g,"\\*"],[/^-/g,"\\-"],[/^\+ /g,"\\+ "],[/^(=+)/g,"\\$1"],[/^(#{1,6}) /g,"\\$1 "],[/`/g,"\\`"],[/^~~~/g,"\\~~~"],[/\[/g,"\\["],[/\]/g,"\\]"],[/^>/g,"\\>"],[/_/g,"\\_"],[/^(\d+)\. /g,"$1\\. "]];function Mjt(t){return xcr.reduce(function(e,n){return e.replace(n[0],n[1])},t)}var ru={};ru.paragraph={filter:"p",replacement:function(t){return`

`+t+`

`}};ru.lineBreak={filter:"br",replacement:function(t,e,n){return n.br+`
`}};ru.heading={filter:["h1","h2","h3","h4","h5","h6"],replacement:function(t,e,n){var r=Number(e.nodeName.charAt(1));if(n.headingStyle==="setext"&&r<3){var s=Bxe(r===1?"=":"-",t.length);return`

`+t+`
`+s+`

`}else return`

`+Bxe("#",r)+" "+t+`

`}};ru.blockquote={filter:"blockquote",replacement:function(t){return t=_jt(t).replace(/^/gm,"> "),`

`+t+`

`}};ru.list={filter:["ul","ol"],replacement:function(t,e){var n=e.parentNode;return n.nodeName==="LI"&&n.lastElementChild===e?`
`+t:`

`+t+`

`}};ru.listItem={filter:"li",replacement:function(t,e,n){var r=n.bulletListMarker+"   ",s=e.parentNode;if(s.nodeName==="OL"){var i=s.getAttribute("start"),o=Array.prototype.indexOf.call(s.children,e);r=(i?Number(i)+o:o+1)+".  "}var l=/\n$/.test(t);return t=_jt(t)+(l?`
`:""),t=t.replace(/\n/gm,`
`+" ".repeat(r.length)),r+t+(e.nextSibling?`
`:"")}};ru.indentedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="indented"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,n){return`

    `+e.firstChild.textContent.replace(/\n/g,`
    `)+`

`}};ru.fencedCodeBlock={filter:function(t,e){return e.codeBlockStyle==="fenced"&&t.nodeName==="PRE"&&t.firstChild&&t.firstChild.nodeName==="CODE"},replacement:function(t,e,n){for(var r=e.firstChild.getAttribute("class")||"",s=(r.match(/language-(\S+)/)||[null,""])[1],i=e.firstChild.textContent,o=n.fence.charAt(0),l=3,c=new RegExp("^"+o+"{3,}","gm"),d;d=c.exec(i);)d[0].length>=l&&(l=d[0].length+1);var u=Bxe(o,l);return`

`+u+s+`
`+i.replace(/\n$/,"")+`
`+u+`

`}};ru.horizontalRule={filter:"hr",replacement:function(t,e,n){return`

`+n.hr+`

`}};ru.inlineLink={filter:function(t,e){return e.linkStyle==="inlined"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e){var n=rAe(e.getAttribute("href")),r=sAe(_Z(e.getAttribute("title"))),s=r?' "'+r+'"':"";return"["+t+"]("+n+s+")"}};ru.referenceLink={filter:function(t,e){return e.linkStyle==="referenced"&&t.nodeName==="A"&&t.getAttribute("href")},replacement:function(t,e,n){var r=rAe(e.getAttribute("href")),s=_Z(e.getAttribute("title"));s&&(s=' "'+sAe(s)+'"');var i,o;switch(n.linkReferenceStyle){case"collapsed":i="["+t+"][]",o="["+t+"]: "+r+s;break;case"shortcut":i="["+t+"]",o="["+t+"]: "+r+s;break;default:var l=this.references.length+1;i="["+t+"]["+l+"]",o="["+l+"]: "+r+s}return this.references.push(o),i},references:[],append:function(t){var e="";return this.references.length&&(e=`

`+this.references.join(`
`)+`

`,this.references=[]),e}};ru.emphasis={filter:["em","i"],replacement:function(t,e,n){return t.trim()?n.emDelimiter+t+n.emDelimiter:""}};ru.strong={filter:["strong","b"],replacement:function(t,e,n){return t.trim()?n.strongDelimiter+t+n.strongDelimiter:""}};ru.code={filter:function(t){var e=t.previousSibling||t.nextSibling,n=t.parentNode.nodeName==="PRE"&&!e;return t.nodeName==="CODE"&&!n},replacement:function(t){if(!t)return"";t=t.replace(/\r?\n|\r/g," ");for(var e=/^`|^ .*?[^ ].* $|`$/.test(t)?" ":"",n="`",r=t.match(/`+/gm)||[];r.indexOf(n)!==-1;)n=n+"`";return n+e+t+e+n}};ru.image={filter:"img",replacement:function(t,e){var n=Mjt(_Z(e.getAttribute("alt"))),r=rAe(e.getAttribute("src")||""),s=_Z(e.getAttribute("title")),i=s?' "'+sAe(s)+'"':"";return r?"!["+n+"]("+r+i+")":""}};function _Z(t){return t?t.replace(/(\n+\s*)+/g,`
`):""}function rAe(t){var e=t.replace(/([<>()])/g,"\\$1");return e.indexOf(" ")>=0?"<"+e+">":e}function sAe(t){return t.replace(/"/g,'\\"')}function Ljt(t){this.options=t,this._keep=[],this._remove=[],this.blankRule={replacement:t.blankReplacement},this.keepReplacement=t.keepReplacement,this.defaultRule={replacement:t.defaultReplacement},this.array=[];for(var e in t.rules)this.array.push(t.rules[e])}Ljt.prototype={add:function(t,e){this.array.unshift(e)},keep:function(t){this._keep.unshift({filter:t,replacement:this.keepReplacement})},remove:function(t){this._remove.unshift({filter:t,replacement:function(){return""}})},forNode:function(t){if(t.isBlank)return this.blankRule;var e;return(e=Kde(this.array,t,this.options))||(e=Kde(this._keep,t,this.options))||(e=Kde(this._remove,t,this.options))?e:this.defaultRule},forEach:function(t){for(var e=0;e<this.array.length;e++)t(this.array[e],e)}};function Kde(t,e,n){for(var r=0;r<t.length;r++){var s=t[r];if(wcr(s,e,n))return s}}function wcr(t,e,n){var r=t.filter;if(typeof r=="string"){if(r===e.nodeName.toLowerCase())return!0}else if(Array.isArray(r)){if(r.indexOf(e.nodeName.toLowerCase())>-1)return!0}else if(typeof r=="function"){if(r.call(t,e,n))return!0}else throw new TypeError("`filter` needs to be a string, array, or function")}function kcr(t){var e=t.element,n=t.isBlock,r=t.isVoid,s=t.isPre||function(h){return h.nodeName==="PRE"};if(!(!e.firstChild||s(e))){for(var i=null,o=!1,l=null,c=pVe(l,e,s);c!==e;){if(c.nodeType===3||c.nodeType===4){var d=c.data.replace(/[ \r\n\t]+/g," ");if((!i||/ $/.test(i.data))&&!o&&d[0]===" "&&(d=d.substr(1)),!d){c=Yde(c);continue}c.data=d,i=c}else if(c.nodeType===1)n(c)||c.nodeName==="BR"?(i&&(i.data=i.data.replace(/ $/,"")),i=null,o=!1):r(c)||s(c)?(i=null,o=!0):i&&(o=!1);else{c=Yde(c);continue}var u=pVe(l,c,s);l=c,c=u}i&&(i.data=i.data.replace(/ $/,""),i.data||Yde(i))}}function Yde(t){var e=t.nextSibling||t.parentNode;return t.parentNode.removeChild(t),e}function pVe(t,e,n){return t&&t.parentNode===e||n(e)?e.nextSibling||e.parentNode:e.firstChild||e.nextSibling||e.parentNode}var iAe=typeof window<"u"?window:{};function Scr(){var t=iAe.DOMParser,e=!1;try{new t().parseFromString("","text/html")&&(e=!0)}catch{}return e}function Ccr(){var t=function(){};return jcr()?t.prototype.parseFromString=function(e){var n=new window.ActiveXObject("htmlfile");return n.designMode="on",n.open(),n.write(e),n.close(),n}:t.prototype.parseFromString=function(e){var n=document.implementation.createHTMLDocument("");return n.open(),n.write(e),n.close(),n},t}function jcr(){var t=!1;try{document.implementation.createHTMLDocument("").open()}catch{iAe.ActiveXObject&&(t=!0)}return t}var Ecr=Scr()?iAe.DOMParser:Ccr();function Ncr(t,e){var n;if(typeof t=="string"){var r=Tcr().parseFromString('<x-turndown id="turndown-root">'+t+"</x-turndown>","text/html");n=r.getElementById("turndown-root")}else n=t.cloneNode(!0);return kcr({element:n,isBlock:tAe,isVoid:Pjt,isPre:e.preformattedCode?_cr:null}),n}var Qde;function Tcr(){return Qde=Qde||new Ecr,Qde}function _cr(t){return t.nodeName==="PRE"||t.nodeName==="CODE"}function Acr(t,e){return t.isBlock=tAe(t),t.isCode=t.nodeName==="CODE"||t.parentNode.isCode,t.isBlank=Pcr(t),t.flankingWhitespace=Rcr(t,e),t}function Pcr(t){return!Pjt(t)&&!ycr(t)&&/^\s*$/i.test(t.textContent)&&!vcr(t)&&!bcr(t)}function Rcr(t,e){if(t.isBlock||e.preformattedCode&&t.isCode)return{leading:"",trailing:""};var n=Icr(t.textContent);return n.leadingAscii&&gVe("left",t,e)&&(n.leading=n.leadingNonAscii),n.trailingAscii&&gVe("right",t,e)&&(n.trailing=n.trailingNonAscii),{leading:n.leading,trailing:n.trailing}}function Icr(t){var e=t.match(/^(([ \t\r\n]*)(\s*))(?:(?=\S)[\s\S]*\S)?((\s*?)([ \t\r\n]*))$/);return{leading:e[1],leadingAscii:e[2],leadingNonAscii:e[3],trailing:e[4],trailingNonAscii:e[5],trailingAscii:e[6]}}function gVe(t,e,n){var r,s,i;return t==="left"?(r=e.previousSibling,s=/ $/):(r=e.nextSibling,s=/^ /),r&&(r.nodeType===3?i=s.test(r.nodeValue):n.preformattedCode&&r.nodeName==="CODE"?i=!1:r.nodeType===1&&!tAe(r)&&(i=s.test(r.textContent))),i}var Mcr=Array.prototype.reduce;function Z6(t){if(!(this instanceof Z6))return new Z6(t);var e={rules:ru,headingStyle:"setext",hr:"* * *",bulletListMarker:"*",codeBlockStyle:"indented",fence:"```",emDelimiter:"_",strongDelimiter:"**",linkStyle:"inlined",linkReferenceStyle:"full",br:"  ",preformattedCode:!1,blankReplacement:function(n,r){return r.isBlock?`

`:""},keepReplacement:function(n,r){return r.isBlock?`

`+r.outerHTML+`

`:r.outerHTML},defaultReplacement:function(n,r){return r.isBlock?`

`+n+`

`:n}};this.options=pcr({},e,t),this.rules=new Ljt(this.options)}Z6.prototype={turndown:function(t){if(!$cr(t))throw new TypeError(t+" is not a string, or an element/document/fragment node.");if(t==="")return"";var e=Djt.call(this,new Ncr(t,this.options));return Lcr.call(this,e)},use:function(t){if(Array.isArray(t))for(var e=0;e<t.length;e++)this.use(t[e]);else if(typeof t=="function")t(this);else throw new TypeError("plugin must be a Function or an Array of Functions");return this},addRule:function(t,e){return this.rules.add(t,e),this},keep:function(t){return this.rules.keep(t),this},remove:function(t){return this.rules.remove(t),this},escape:function(t){return Mjt(t)}};function Djt(t){var e=this;return Mcr.call(t.childNodes,function(n,r){r=new Acr(r,e.options);var s="";return r.nodeType===3?s=r.isCode?r.nodeValue:e.escape(r.nodeValue):r.nodeType===1&&(s=Dcr.call(e,r)),$jt(n,s)},"")}function Lcr(t){var e=this;return this.rules.forEach(function(n){typeof n.append=="function"&&(t=$jt(t,n.append(e.options)))}),t.replace(/^[\t\r\n]+/,"").replace(/[\t\r\n\s]+$/,"")}function Dcr(t){var e=this.rules.forNode(t),n=Djt.call(this,t),r=t.flankingWhitespace;return(r.leading||r.trailing)&&(n=n.trim()),r.leading+e.replacement(n,t,this.options)+r.trailing}function $jt(t,e){var n=Tjt(t),r=Njt(e),s=Math.max(t.length-n.length,e.length-r.length),i=`

`.substring(0,s);return n+i+r}function $cr(t){return t!=null&&(typeof t=="string"||t.nodeType&&(t.nodeType===1||t.nodeType===9||t.nodeType===11))}const Ocr=/(^|[^A-Za-z0-9_@])(@[A-Za-z0-9_]+)/g,Ojt="",Fjt="",Fcr=new RegExp(`${Ojt}(\\d+)${Fjt}`,"g");function Bcr(t){const e=t.escape.bind(t);return t.escape=n=>{if(!n||n.indexOf("@")===-1)return e(n);const r=[],s=n.replace(Ocr,(i,o,l)=>(r.push(l),`${o}${Ojt}${r.length-1}${Fjt}`));return e(s).replace(Fcr,(i,o)=>r[Number(o)]??"")},t}function Bjt({breaks:t=!1}={}){return Bcr(new Z6({headingStyle:"atx",bulletListMarker:"-",codeBlockStyle:"fenced",emDelimiter:"*",strongDelimiter:"**",...t?{br:""}:{}}))}function Zde(t,{breaks:e=!1}={}){return t.trim()?e?hte(vi.parse(t,{async:!1,gfm:!0,breaks:!0})):kan(t):""}function Ujt(t){let e="";const n=r=>{r.childNodes.forEach(s=>{s.nodeType===Node.TEXT_NODE?e+=s.textContent??"":s.nodeName==="BR"?e+=`
`:((s.nodeName==="DIV"||s.nodeName==="P")&&e&&!e.endsWith(`
`)&&(e+=`
`),n(s))})};return n(t),e}function zjt(t){return t.addRule("strikethrough",{filter:["del","s","strike"],replacement:e=>e?`~~${e}~~`:""}),t.addRule("preBlock",{filter:"pre",replacement:(e,n)=>`

\`\`\`
${Ujt(n).replace(/\n+$/,"")}
\`\`\`

`}),t}const Ucr=zjt(Bjt()),zcr=zjt(Bjt({breaks:!0}));function vVe(t){if(!t)return[];const e=Array.from(t.files??[]).filter(n=>n.type.startsWith("image/"));return e.length?e:Array.from(t.items??[]).filter(n=>n.kind==="file"&&n.type.startsWith("image/")).map(n=>n.getAsFile()).filter(n=>!!n)}const yVe="[&_p]:my-2 [&_h2]:my-3 [&_h2]:text-2xl [&_h2]:font-semibold [&_h3]:my-3 [&_h3]:text-xl [&_h3]:font-semibold [&_h4]:my-2 [&_h4]:text-base [&_h4]:font-semibold [&_ul]:my-3 [&_ul]:list-disc [&_ul]:pl-7 [&_ol]:my-3 [&_ol]:list-decimal [&_ol]:pl-7 [&_li]:my-1 [&_li]:pl-1 [&_blockquote]:my-3 [&_blockquote]:border-l-4 [&_blockquote]:border-border [&_blockquote]:pl-4 [&_blockquote]:italic [&_pre]:my-3 [&_pre]:overflow-x-auto [&_pre]:rounded-md [&_pre]:bg-muted [&_pre]:p-3 [&_pre]:font-mono [&_pre]:text-sm [&_s]:line-through [&_strike]:line-through [&_del]:line-through [&_a]:text-primary [&_a]:underline";function Vcr(t){var l;const e=window.getSelection();if(!(e!=null&&e.rangeCount)||!e.isCollapsed)return!1;const n=e.anchorNode,r=n instanceof Element?n:n==null?void 0:n.parentElement,s=r==null?void 0:r.closest("blockquote, pre");if(!s||!t.contains(s))return!1;const i=document.createElement("div");if(i.appendChild(document.createElement("br")),s.tagName==="BLOCKQUOTE"){const c=(r==null?void 0:r.closest("blockquote > div, blockquote > p"))??s;if((c.textContent??"").replace(/\u200b/g,"").trim()!=="")return!1;c===s?s.replaceWith(i):(c.remove(),s.after(i))}else{const c=document.createRange();if(c.setStart(e.anchorNode,e.anchorOffset),c.setEndAfter(s),c.toString()!=="")return!1;const d=s.textContent??"",u=((l=s.lastChild)==null?void 0:l.nodeName)==="CODE"?s.lastChild.lastChild:s.lastChild;if(!(d===""||d.endsWith(`
`)||(u==null?void 0:u.nodeName)==="BR"))return!1;(u==null?void 0:u.nodeName)==="BR"&&u.remove(),s.after(i)}const o=document.createRange();return o.setStart(i,0),o.collapse(!0),e.removeAllRanges(),e.addRange(o),!0}function bVe(t){t.querySelectorAll("span[style]").forEach(e=>{e.attributes.length===1&&e.replaceWith(...Array.from(e.childNodes))}),t.querySelectorAll("[style]").forEach(e=>{e!==t&&e.tagName!=="SPAN"&&e.removeAttribute("style")})}function Hcr(t){const e=t.cloneNode(!0);return e.querySelectorAll("ul > ul, ul > ol, ol > ul, ol > ol").forEach(n=>{const r=n.previousElementSibling;(r==null?void 0:r.tagName)==="LI"&&r.appendChild(n)}),e.innerHTML}const Gcr="div, p, li, ul, ol, blockquote, pre, h1, h2, h3, h4, h5, h6, br";function xVe(t){const e=window.getSelection();if(!(e!=null&&e.rangeCount)||!e.focusNode||!t.contains(e.focusNode))return"";const n=document.createRange();n.setStart(e.focusNode,e.focusOffset),n.collapse(!0);const r=document.createRange();return r.selectNodeContents(t),r.setEnd(e.focusNode,e.focusOffset),t.querySelectorAll(Gcr).forEach(s=>{if(s.contains(e.focusNode)&&s.nodeName!=="BR"){r.setStart(s,0);return}const i=s.parentNode;if(!i)return;const o=Array.prototype.indexOf.call(i.childNodes,s)+1;n.comparePoint(i,o)<=0&&r.setStart(i,o)}),r.toString()}function CT(t){return typeof t.innerText=="string"?t.innerText.replace(/\r\n/g,`
`).length:(t.textContent??"").replace(/\n$/,"").length}function wVe(t){const e=window.getSelection();return!(e!=null&&e.anchorNode)||!e.focusNode||!t.contains(e.anchorNode)||!t.contains(e.focusNode)?0:e.toString().length}const Du=y.forwardRef(function({value:e,onChange:n,readOnly:r=!1,placeholder:s="Write here…",className:i,editorClassName:o,editableClassName:l,onCaretContext:c,onKeyDown:d,onBlur:u,deferMarkdownSync:h=!1,highlightMentions:m=!1,plainTextPaste:f=!1,fill:p=!1,markdownBreaks:g=!1,onImageFiles:v,maxLength:b,onCharacterCountChange:x,onLimitExceeded:w},k){const S=y.useRef(null),C=y.useRef(!1),j=y.useRef(null),E=y.useRef(null),N=Cjt(S);Ejt(S,{enabled:m});const A=y.useRef(""),[_,T]=y.useState(!1),[R,O]=y.useState(""),[F,D]=y.useState(""),[I,P]=y.useState(""),{formats:M,refresh:z}=X_e(S),G=Y=>!!M[Y],B=Y=>ee("h-8 w-8",G(Y)&&"bg-primary/15 text-primary hover:bg-primary/20 hover:text-primary");y.useEffect(()=>{if(!S.current||C.current&&(C.current=!1,e===j.current))return;const Y=Zde(e,{breaks:g});S.current.innerHTML!==Y&&(S.current.innerHTML=Y),A.current=S.current.innerHTML,x==null||x(CT(S.current))},[e,g,x]);const H=y.useCallback(()=>S.current?(g?zcr:Ucr).turndown(Hcr(S.current)):"",[g]),W=y.useCallback(()=>{if(!S.current)return;const Y=H();j.current=Y,C.current=!0,n==null||n(Y)},[n,H]),V=()=>{!c||!S.current||c(xVe(S.current))};y.useImperativeHandle(k,()=>({insertText:Y=>{N(),document.execCommand("insertText",!1,Y),W()},replaceActiveMention:Y=>{const X=S.current;if(!X)return;X.focus();const ie=xVe(X).match(/@([\w.]*)$/);if(ie){for(let he=0;he<ie[0].length;he+=1)document.execCommand("delete");document.execCommand("insertText",!1,`@${Y} `),W()}},readMarkdown:H,clear:()=>{S.current&&(S.current.innerHTML="",j.current="",C.current=!0)},setMarkdown:Y=>{S.current&&(S.current.innerHTML=Zde(Y,{breaks:g}),A.current=S.current.innerHTML,j.current=Y,C.current=!0,x==null||x(CT(S.current)))}}),[N,H,W,g,x]);const U=(Y,X)=>{var Q;(Q=S.current)==null||Q.focus(),document.execCommand(Y,!1,X),W(),z()},ne=()=>{const Y=S.current;if(!Y)return;Y.focus();const X=window.getSelection(),Q=X==null?void 0:X.anchorNode,ie=Q instanceof Element?Q:Q==null?void 0:Q.parentElement,he=ie==null?void 0:ie.closest("pre");if(he&&Y.contains(he)){const ye=Ujt(he).replace(/\n+$/,"").split(`
`),J=document.createDocumentFragment();let K=null;for(const ce of ye)K=document.createElement("div"),ce?K.textContent=ce:K.appendChild(document.createElement("br")),J.appendChild(K);if(he.replaceWith(J),K&&X){const ce=document.createRange();ce.selectNodeContents(K),ce.collapse(!1),X.removeAllRanges(),X.addRange(ce)}W(),z();return}document.execCommand("formatBlock",!1,"pre"),Y.querySelector("pre")||document.execCommand("insertHTML",!1,"<pre><code><br></code></pre>"),Y.querySelectorAll("pre").forEach(ye=>{if(ye.querySelector("code"))return;const J=document.createElement("code");for(;ye.firstChild;)J.appendChild(ye.firstChild);ye.appendChild(J)}),W(),z()},te=()=>{var Q;const Y=window.getSelection(),X=Y!=null&&Y.rangeCount?Y.getRangeAt(0):null;E.current=X&&((Q=S.current)!=null&&Q.contains(X.commonAncestorContainer))?X.cloneRange():null,D(Y&&!Y.isCollapsed?Y.toString():""),O(""),P(""),T(!0)},re=()=>{let Y=R.trim();if(!Y){P("Enter a URL.");return}/^[a-z][a-z\d+.-]*:/i.test(Y)||(Y=`https://${Y}`);try{const K=new URL(Y);if(!["http:","https:"].includes(K.protocol))throw new Error("protocol")}catch{P("Enter a valid website URL.");return}const X=S.current;if(!X)return;let Q=E.current;(!Q||!X.contains(Q.commonAncestorContainer))&&(Q=document.createRange(),Q.selectNodeContents(X),Q.collapse(!1));const ie=document.createElement("a");ie.href=Y,ie.target="_blank",ie.rel="noopener noreferrer";const he=F.trim();he||Q.collapsed?(ie.textContent=he||Y,Q.deleteContents()):ie.appendChild(Q.extractContents()),Q.insertNode(ie);const ye=document.createRange();ye.setStartAfter(ie),ye.collapse(!0);const J=window.getSelection();J==null||J.removeAllRanges(),J==null||J.addRange(ye),W(),E.current=null,T(!1)},fe=Y=>{var ce;const X=S.current;if(!X)return;X.focus();const Q=Y?"ol":"ul",ie=Y?"insertOrderedList":"insertUnorderedList",he=window.getSelection(),ye=(he==null?void 0:he.anchorNode)??null,J=ye instanceof Element?ye:ye==null?void 0:ye.parentElement,K=J==null?void 0:J.closest("ul, ol");if(K&&X.contains(K)&&K.tagName.toLowerCase()!==Q){const pe=(he==null?void 0:he.anchorOffset)??0,Ie=document.createElement(Q);for(;K.firstChild;)Ie.appendChild(K.firstChild);if(K.replaceWith(Ie),ye&&he&&X.contains(ye)){const Me=document.createRange();Me.setStart(ye,Math.min(pe,ye.nodeType===Node.TEXT_NODE?(ye.textContent??"").length:ye.childNodes.length)),Me.collapse(!0),he.removeAllRanges(),he.addRange(Me)}W(),z();return}if(document.execCommand(ie,!1),bVe(X),!X.querySelector(Q)&&!((ce=X.textContent)!=null&&ce.trim())){X.innerHTML=`<${Q}><li><br></li></${Q}>`;const pe=X.querySelector("li");if(pe){const Ie=document.createRange();Ie.selectNodeContents(pe),Ie.collapse(!0);const Me=window.getSelection();Me==null||Me.removeAllRanges(),Me==null||Me.addRange(Ie)}}W(),z()},le=Y=>{if(v&&!Y.clipboardData.getData("text/plain").trim()){const X=vVe(Y.clipboardData);if(X.length){Y.preventDefault(),v(X);return}}if(f){Y.preventDefault();const X=Y.clipboardData.getData("text/plain").replace(/\r\n?/g,`
`),Q=S.current?CT(S.current):0,ie=S.current?wVe(S.current):0,he=b==null?X.length:Math.max(0,b-Q+ie);X.length>he&&(w==null||w()),document.execCommand("insertText",!1,X.slice(0,he))}},q=Y=>{if(!v)return;const X=vVe(Y.dataTransfer);X.length&&(Y.preventDefault(),v(X))};if(r){const Y=Zde(e,{breaks:g});return Y?a.jsx("div",{className:ee("max-w-none text-sm leading-7 text-foreground",yVe,i),dangerouslySetInnerHTML:{__html:Y}}):a.jsx("p",{className:"text-sm text-muted-foreground",children:"—"})}return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:ee("min-w-0 max-w-full rounded-md border border-border bg-background",p&&"flex h-full min-h-0 flex-col",i),children:[a.jsxs("div",{className:"flex min-w-0 shrink-0 flex-wrap gap-0.5 border-b border-border p-1",children:[a.jsxs("select",{"aria-label":"Text size",defaultValue:"p",onChange:Y=>{U("formatBlock",Y.target.value),Y.currentTarget.value="p"},className:"mr-1 h-8 rounded-md border-0 bg-transparent px-2 text-xs text-muted-foreground outline-none hover:bg-muted",children:[a.jsx("option",{value:"p",children:"Normal"}),a.jsx("option",{value:"h2",children:"Large"}),a.jsx("option",{value:"h3",children:"Medium"}),a.jsx("option",{value:"h4",children:"Small heading"})]}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:B(fs.bold),"aria-pressed":G(fs.bold),title:"Bold",onMouseDown:Y=>Y.preventDefault(),onClick:()=>U("bold"),children:a.jsx(aee,{className:"h-4 w-4"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:B(fs.italic),"aria-pressed":G(fs.italic),title:"Italic",onMouseDown:Y=>Y.preventDefault(),onClick:()=>U("italic"),children:a.jsx(cee,{className:"h-4 w-4"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:B(fs.strikeThrough),"aria-pressed":G(fs.strikeThrough),title:"Strikethrough",onMouseDown:Y=>Y.preventDefault(),onClick:()=>U("strikeThrough"),children:a.jsx(lst,{className:"h-4 w-4"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:B(fs.code),"aria-pressed":G(fs.code),title:"Code block",onMouseDown:Y=>Y.preventDefault(),onClick:ne,children:a.jsx(bBt,{className:"h-4 w-4"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:B(fs.bulletList),"aria-pressed":G(fs.bulletList),onMouseDown:Y=>Y.preventDefault(),onClick:()=>fe(!1),title:"Bulleted list",children:a.jsx(rI,{className:"h-4 w-4"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:B(fs.numberedList),"aria-pressed":G(fs.numberedList),onMouseDown:Y=>Y.preventDefault(),onClick:()=>fe(!0),title:"Numbered list",children:a.jsx(uee,{className:"h-4 w-4"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8",title:"Add link",onMouseDown:Y=>Y.preventDefault(),onClick:te,children:a.jsx(eu,{className:"h-4 w-4"})}),a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8",title:"More formatting",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"start",onCloseAutoFocus:Y=>{var X;Y.preventDefault(),(X=S.current)==null||X.focus()},children:[a.jsxs(ot,{onSelect:()=>U("formatBlock","blockquote"),children:[a.jsx(s9t,{className:"mr-2 h-4 w-4"}),"Quote"]}),a.jsxs(ot,{onSelect:()=>U("removeFormat"),children:[a.jsx(est,{className:"mr-2 h-4 w-4"}),"Clear formatting"]})]})]})]}),a.jsx("div",{ref:S,contentEditable:!0,role:"textbox","aria-multiline":!0,"data-placeholder":s,onBeforeInput:Y=>{var ye;if(!b)return;A.current=((ye=S.current)==null?void 0:ye.innerHTML)??"";const X=S.current?CT(S.current):0,Q=S.current?wVe(S.current):0,he=(Y.data??"").length;X-Q+he>b&&(Y.preventDefault(),w==null||w())},onInput:()=>{const Y=S.current;if(Y&&b&&CT(Y)>b){w==null||w(),Y.innerHTML=A.current;const X=window.getSelection(),Q=document.createRange();Q.selectNodeContents(Y),Q.collapse(!1),X==null||X.removeAllRanges(),X==null||X.addRange(Q)}else Y&&(A.current=Y.innerHTML);h||W(),x==null||x(S.current?CT(S.current):0),V()},onKeyUp:Y=>{(Y.key.startsWith("Arrow")||Y.key==="Home"||Y.key==="End")&&V()},onKeyDown:Y=>{var X,Q;if(d==null||d(Y),Y.key==="Enter"&&requestAnimationFrame(()=>z()),Y.key==="Tab"&&!Y.defaultPrevented&&!Y.altKey&&!Y.ctrlKey&&!Y.metaKey){const ie=window.getSelection(),he=(ie==null?void 0:ie.anchorNode)??null,ye=he instanceof Element?he:he==null?void 0:he.parentElement,J=ye==null?void 0:ye.closest("li");if(J&&((X=S.current)!=null&&X.contains(J))){Y.preventDefault(),document.execCommand(Y.shiftKey?"outdent":"indent",!1),S.current&&bVe(S.current),(Q=S.current)==null||Q.querySelectorAll("blockquote").forEach(K=>{var ce;K.children.length===1&&/^(UL|OL)$/.test(((ce=K.firstElementChild)==null?void 0:ce.tagName)??"")&&K.replaceWith(K.firstElementChild)}),h||W(),z();return}}Y.defaultPrevented||Y.key!=="Enter"||Y.shiftKey||S.current&&Vcr(S.current)&&(Y.preventDefault(),h||W(),z())},onPaste:f||v?le:void 0,onDragOver:v?Y=>{Array.from(Y.dataTransfer.types??[]).includes("Files")&&Y.preventDefault()}:void 0,onDrop:v?q:void 0,onBlur:()=>{W(),u==null||u()},onClick:Y=>{var ie,he;const X=(he=(ie=Y.target)==null?void 0:ie.closest)==null?void 0:he.call(ie,"a");if(!X||!(Y.metaKey||Y.ctrlKey))return;Y.preventDefault();const Q=X.getAttribute("href");Q&&window.open(Q,"_blank","noopener,noreferrer")},className:ee("themed-scrollbar min-h-[140px] min-w-0 max-h-64 max-w-full overflow-x-hidden overflow-y-auto break-words p-3 text-sm text-foreground outline-none [overflow-wrap:anywhere] empty:before:content-[attr(data-placeholder)] empty:before:text-muted-foreground",p&&"min-h-0 max-h-none flex-1",yVe,o,l)})]}),a.jsx(Bt,{open:_,onOpenChange:Y=>{T(Y),Y||(E.current=null)},children:a.jsxs(Ft,{className:"max-w-md",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Add a link"}),a.jsx(_n,{children:"Paste the destination and optionally choose the words readers will see."})]}),a.jsxs("div",{className:"space-y-4 py-2",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs(_e,{htmlFor:"rich-link-url",children:["URL ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Oe,{id:"rich-link-url",autoFocus:!0,value:R,onChange:Y=>{O(Y.target.value),P("")},onKeyDown:Y=>{Y.key==="Enter"&&(Y.preventDefault(),re())},placeholder:"https://example.com"}),I&&a.jsx("p",{className:"text-xs text-destructive",children:I})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(_e,{htmlFor:"rich-link-text",children:["Display text ",a.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),a.jsx(Oe,{id:"rich-link-text",value:F,onChange:Y=>D(Y.target.value),onKeyDown:Y=>{Y.key==="Enter"&&(Y.preventDefault(),re())},placeholder:"Words shown in the description"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave empty to show the URL, or keep your selected text."})]})]}),a.jsxs(ir,{children:[a.jsx(Z,{type:"button",variant:"ghost",onClick:()=>T(!1),children:"Cancel"}),a.jsx(Z,{type:"button",onClick:re,disabled:!R.trim(),children:"Add link"})]})]})})]})});function Wcr(t){return t?new Date(t).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}):""}function qcr(){var o,l;const{newsletterId:t="",postId:e=""}=So(),n=lt({queryKey:["public-post",e],queryFn:()=>Alr(e),enabled:!!e,retry:!1}),r=(o=n.data)==null?void 0:o.post,s=(l=n.data)==null?void 0:l.newsletter;y.useEffect(()=>{(r!=null&&r.seoTitle||r!=null&&r.title)&&(document.title=r.seoTitle||r.title)},[r==null?void 0:r.seoTitle,r==null?void 0:r.title]);const i=((r==null?void 0:r.content)??"").trim();return a.jsx("div",{className:"min-h-screen bg-background px-4 py-10",children:a.jsx("div",{className:"mx-auto w-full max-w-2xl",children:n.isLoading?a.jsxs("div",{className:"flex flex-col items-center gap-3 py-20 text-muted-foreground",children:[a.jsx(Ne,{className:"h-6 w-6 animate-spin"}),a.jsx("p",{className:"text-sm",children:"Loading…"})]}):n.isError||!r?a.jsxs("div",{className:"py-20 text-center",children:[a.jsx("h1",{className:"text-xl font-bold text-foreground",children:"Post not found"}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"This issue may be unpublished or no longer available on the web."})]}):a.jsxs("article",{children:[s&&a.jsxs(vr,{to:ve.newsletterArchive(t||r.newsletterId),className:"inline-flex items-center gap-1 text-sm font-medium text-primary hover:underline",children:[a.jsx(no,{className:"h-4 w-4"})," ",s.title]}),a.jsx("h1",{className:"mt-4 text-3xl font-bold tracking-tight text-foreground",children:r.title}),a.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground",children:[r.publishedAt&&a.jsx("span",{children:Wcr(r.publishedAt)}),r.authors.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("span",{"aria-hidden":!0,children:"·"}),a.jsx("span",{children:r.authors.join(", ")})]})]}),r.thumbnail?a.jsx("img",{src:r.thumbnail,alt:"",className:"mt-6 w-full rounded-2xl object-cover"}):null,i?a.jsx(Du,{value:i,readOnly:!0,className:"mt-8 text-[15px] leading-relaxed"}):a.jsx("p",{className:"mt-8 text-muted-foreground",children:"This issue has no content."}),r.tags.length>0&&a.jsx("div",{className:"mt-10 flex flex-wrap gap-2 border-t border-border pt-5",children:r.tags.map(c=>a.jsxs("span",{className:"rounded-full bg-muted px-2.5 py-0.5 text-xs font-medium text-muted-foreground",children:["#",c]},c))}),a.jsx("div",{className:"mt-8",children:a.jsx(vr,{to:ve.newsletterArchive(t||r.newsletterId),className:"text-sm font-medium text-primary hover:underline",children:"← Back to all issues"})})]})})})}const Kcr=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}-/i;function aAe(t,e){let n=String(t||"").trim();if(!n&&e)try{n=decodeURIComponent(new URL(e).pathname.split("/").filter(Boolean).pop()||"")}catch{n=""}return n=n.replace(Kcr,""),n||"file"}async function Ycr(t,e){const n=aAe(e,t);try{const r=await fetch(t);if(!r.ok)throw new Error(`HTTP ${r.status}`);const s=await r.blob(),i=URL.createObjectURL(s),o=document.createElement("a");o.href=i,o.download=n,document.body.appendChild(o),o.click(),o.remove(),URL.revokeObjectURL(i)}catch{window.open(t,"_blank","noopener,noreferrer")}}function o0(t){const e=String(t||"").trim();if(!e)return"";const n=/^[a-zA-Z][a-zA-Z0-9+.-]*:/.test(e)?e:`https://${e}`;try{const r=new URL(n);return r.protocol!=="http:"&&r.protocol!=="https:"?"":r.toString()}catch{return""}}function Qcr({url:t,fileName:e}){const[n,r]=y.useState(!1),s=aAe(e,t);return a.jsxs(Z,{type:"button",className:"mt-4 max-w-full overflow-hidden",disabled:n,onClick:()=>{r(!0),Ycr(t,s).finally(()=>r(!1))},children:[n?a.jsx(Ne,{className:"mr-2 h-4 w-4 shrink-0 animate-spin"}):a.jsx(bc,{className:"mr-2 h-4 w-4 shrink-0"}),a.jsx("span",{className:"min-w-0 truncate",children:n?"Downloading…":`Download ${s}`})]})}const Zcr=30;function Jcr({url:t,onRedirect:e}){const[n,r]=y.useState(Zcr),s=y.useRef(e);return y.useEffect(()=>{s.current=e},[e]),y.useEffect(()=>{if(n<=0){s.current(t);return}const i=setTimeout(()=>r(o=>o-1),1e3);return()=>clearTimeout(i)},[n,t]),a.jsxs("div",{className:"mt-5 flex flex-col items-center gap-2",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:["You will be redirected in"," ",a.jsx("span",{className:"font-semibold tabular-nums text-foreground",children:n})," ",n===1?"second":"seconds","."]}),a.jsxs(Z,{type:"button",onClick:()=>e(t),children:["Go to page",a.jsx(xa,{className:"ml-2 h-4 w-4"})]})]})}function kVe({label:t,required:e}){return a.jsxs(_e,{className:"text-sm font-medium text-foreground",children:[t,e?a.jsx("span",{className:"ml-0.5 text-destructive",children:"*"}):a.jsx("span",{className:"ml-1 font-normal text-muted-foreground",children:"(optional)"})]})}function Vjt({headline:t,offer:e,subtext:n,buttonText:r="Get access",fields:s,type:i="Landing page",mode:o="preview",email:l="",onEmailChange:c,values:d={},onValueChange:u,onSubmit:h,submitting:m,error:f,success:p,onRedirect:g}){var C,j,E,N;const v=o==="preview",b=(A,_)=>u==null?void 0:u(A,_),x=(t==null?void 0:t.trim())||(v?"Form headline":""),w=(n==null?void 0:n.trim())||(v?"A short line about what this form is for.":""),k=v?i==="Popup"?"Popup":i==="Inline"?"Inline form":"Form":"",S=i==="Landing page"?"rounded-2xl border border-border bg-card shadow-card":"rounded-xl border border-border bg-card shadow-sm";if(p){const A=o0((C=p.afterSubmit)==null?void 0:C.url),_=(j=p.afterSubmit)==null?void 0:j.type,T=((E=p.offer??e)==null?void 0:E.trim())||"";return a.jsx("div",{className:`${S} overflow-hidden`,children:a.jsxs("div",{className:"min-w-0 px-6 py-10 text-center",children:[a.jsx(yo,{className:"mx-auto h-11 w-11 text-success"}),T?a.jsx("h2",{className:"mt-3 text-xl font-semibold text-foreground",children:T}):null,a.jsx("p",{className:`${T?"mt-1":"mt-3"} text-lg font-semibold text-foreground`,children:"Thank you!"}),a.jsx("p",{className:"mt-1.5 text-sm text-muted-foreground",children:p.message}),_==="download"&&A?a.jsx(Qcr,{url:A,fileName:(N=p.afterSubmit)==null?void 0:N.fileName}):null,_==="redirect"&&A?g?a.jsx(Jcr,{url:A,onRedirect:g}):a.jsx(Z,{className:"mt-4",asChild:!0,children:a.jsxs("a",{href:A,children:["Go to page",a.jsx(xa,{className:"ml-2 h-4 w-4"})]})}):null]})})}return a.jsxs("div",{className:S,children:[k||x||w?a.jsxs("div",{className:i==="Landing page"?"border-b border-border bg-primary/5 px-6 py-5 text-center":"px-5 pt-5 text-center",children:[k?a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-widest text-primary",children:k}):null,x?a.jsx("h2",{className:`text-xl font-bold leading-tight text-foreground ${k?"mt-1":""}`,children:x}):null,w?a.jsx("p",{className:"mt-1.5 text-sm leading-relaxed text-muted-foreground",children:w}):null]}):null,a.jsx("div",{className:i==="Landing page"?"px-6 py-5":"px-5 pb-5 pt-4",children:a.jsxs("form",{className:"space-y-3.5",onSubmit:A=>{A.preventDefault(),v||h==null||h()},children:[s.map(A=>a.jsx("div",{className:"space-y-1.5",children:A.type==="checkbox"?a.jsxs("label",{className:"flex items-start gap-2.5 rounded-lg border border-border bg-background px-3 py-2.5 text-sm text-foreground",children:[a.jsx("input",{type:"checkbox",className:"mt-0.5 h-4 w-4 accent-primary",checked:d[A.key]===!0,onChange:_=>b(A.key,_.target.checked),required:A.required,disabled:v}),a.jsxs("span",{children:[A.label,A.required?a.jsx("span",{className:"ml-0.5 text-destructive",children:"*"}):null]})]}):a.jsxs(a.Fragment,{children:[a.jsx(kVe,{label:A.label,required:A.required}),A.type==="textarea"?a.jsx(us,{value:String(d[A.key]??""),onChange:_=>b(A.key,_.target.value),required:A.required,disabled:v,rows:3,placeholder:A.label}):A.type==="select"?a.jsxs("select",{className:"flex h-10 w-full rounded-md border border-input bg-background px-3 text-sm disabled:opacity-70",value:String(d[A.key]??""),onChange:_=>b(A.key,_.target.value),required:A.required,disabled:v,children:[a.jsx("option",{value:"",children:"Select…"}),(A.options||[]).map(_=>a.jsx("option",{value:_,children:_},_))]}):a.jsx(Oe,{type:A.type==="phone"?"tel":"text",value:String(d[A.key]??""),onChange:_=>b(A.key,_.target.value),placeholder:A.label,required:A.required,disabled:v})]})},A.key)),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(kVe,{label:"Email",required:!0}),a.jsx(Oe,{type:"email",value:l,onChange:A=>c==null?void 0:c(A.target.value),placeholder:"you@email.com",required:!0,disabled:v})]}),f&&a.jsx("p",{className:"text-sm font-medium text-destructive",children:f}),a.jsx(Z,{type:"submit",className:"w-full",disabled:v||m,children:r||"Get access"}),v&&a.jsx("p",{className:"text-center text-[11px] text-muted-foreground",children:"Preview — this is how visitors will see the form."})]})})]})}function Xcr(t){var e;return(e=t==null?void 0:t.fields)!=null&&e.length?t.fields:(t==null?void 0:t.collectName)===!1?[]:[{key:"name",type:"name",label:"Name",required:!1}]}function edr(){const{formId:t=""}=So(),[e,n]=y.useState({}),[r,s]=y.useState(""),[i,o]=y.useState(null),l=lt({queryKey:["public-optin-form",t],queryFn:()=>Blr(t),enabled:!!t,retry:!1}),c=l.data,d=jt({mutationFn:()=>Ulr(t,{email:r,name:typeof e.name=="string"?e.name:void 0,answers:e}),onSuccess:p=>{const g=p.afterSubmit?{...p.afterSubmit,url:o0(p.afterSubmit.url)}:void 0;o({message:p.message,afterSubmit:g,offer:p.offer||(c==null?void 0:c.settings.offer)})}}),u=Xcr(c),h=(i==null?void 0:i.afterSubmit)||(c==null?void 0:c.settings.afterSubmit),m=y.useCallback(p=>window.location.assign(p),[]),f=y.useMemo(()=>{const p=d.error;return p instanceof ze?p.message:p?"Something went wrong. Please try again.":null},[d.error]);return a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-gradient-to-b from-primary/10 via-background to-background px-4 py-12",children:a.jsx("div",{className:"w-full max-w-lg",children:l.isLoading?a.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-2xl border border-border bg-card py-16 text-muted-foreground",children:[a.jsx(Ne,{className:"h-6 w-6 animate-spin"}),a.jsx("p",{className:"text-sm",children:"Loading…"})]}):l.isError?a.jsxs("div",{className:"rounded-2xl border border-border bg-card px-8 py-12 text-center",children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Form not found"}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"This form link is invalid or the form is no longer published."})]}):a.jsx(Vjt,{mode:"live",type:c==null?void 0:c.type,headline:c==null?void 0:c.settings.headline,offer:c==null?void 0:c.settings.offer,subtext:c==null?void 0:c.settings.subtext,buttonText:c==null?void 0:c.settings.buttonText,fields:u,email:r,onEmailChange:s,values:e,onValueChange:(p,g)=>n(v=>({...v,[p]:g})),onSubmit:()=>d.mutate(),submitting:d.isPending,error:f,success:i?{message:i.message,afterSubmit:h,offer:i.offer||(c==null?void 0:c.settings.offer)}:null,onRedirect:m})})})}const AZ=/\.src\.[a-z0-9]+(?=$|[?#])/i;function tdr(t){return t&&AZ.test(t)?t.replace(AZ,".mp4"):null}const Hjt="pensil:video-renditions-missing",ndr=24*60*60*1e3,rdr=200;function sdr(){try{const t=JSON.parse(window.localStorage.getItem(Hjt)||"{}"),e=Date.now()-ndr;return new Map(Object.entries(t).filter(([,n])=>typeof n=="number"&&n>e))}catch{return new Map}}const Uxe=sdr();function idr(t){Uxe.set(t,Date.now());try{const e=[...Uxe.entries()].slice(-rdr);window.localStorage.setItem(Hjt,JSON.stringify(Object.fromEntries(e)))}catch{}}const adr=4;function odr(t){return(t==null?void 0:t.code)===adr&&window.navigator.onLine!==!1}const ldr=5e3;async function cdr(t){const e=new AbortController,n=window.setTimeout(()=>e.abort(),ldr);try{const r=await fetch(t.replace(/#.*$/,""),{method:"HEAD",cache:"no-store",signal:e.signal});return r.status===404||r.status===403?"missing":r.ok?"present":"unknown"}catch{return"unknown"}finally{window.clearTimeout(n)}}function SVe(t,e,n){e>0&&t.addEventListener("loadedmetadata",()=>{t.currentTime=e,n&&t.play().catch(()=>{})},{once:!0})}function ddr(t){return t&&AZ.test(t)?t.replace(AZ,".web.mp4"):null}function GB(t,{webCopy:e=!1}={}){const n=y.useMemo(()=>[e?ddr(t):null,tdr(t)].filter(c=>!!c),[t,e]),[r,s]=y.useState([]),i=y.useRef(new Set),o=y.useRef(t);o.current=t,y.useEffect(()=>(s([]),i.current=new Set,()=>{o.current=void 0}),[t]);const l=n.find(c=>!r.includes(c)&&!Uxe.has(c))??null;return{src:l??t??void 0,onError:c=>{if(!l)return;const d=(c==null?void 0:c.currentTarget)??null,u=d==null?void 0:d.error,h=(d==null?void 0:d.currentTime)??0,m=!!(d&&!d.paused&&h>0),f=t;cdr(l).then(p=>{if(o.current!==f)return;const g=p==="missing"||p==="unknown"&&odr(u);if(g&&idr(l),!g&&d&&!i.current.has(l)){i.current.add(l),SVe(d,h,m),d.load();return}d&&SVe(d,h,m),s(v=>[...v,l])})}}}async function kN(t){var n;const e=typeof navigator<"u"&&((n=navigator.clipboard)!=null&&n.writeText)?navigator.clipboard.writeText(t):null;if(typeof document<"u")try{const r=document.createElement("textarea");r.value=t,r.setAttribute("readonly",""),r.setAttribute("aria-hidden","true"),r.style.cssText="position:fixed;top:0;left:0;width:2em;height:2em;padding:0;border:0;outline:none;box-shadow:none;background:transparent",document.body.appendChild(r),r.select(),r.setSelectionRange(0,t.length);const s=document.execCommand("copy");if(document.body.removeChild(r),s)return!0}catch{}if(e)try{return await e,!0}catch{return!1}return!1}function D_(t){const e=Math.max(0,Math.floor(Number.isFinite(t)?t:0)),n=Math.floor(e/3600),r=Math.floor(e%3600/60),s=String(e%60).padStart(2,"0");return n?`${n}:${String(r).padStart(2,"0")}:${s}`:`${r}:${s}`}const _V=[.5,.75,1,1.25,1.5,2],udr=2500,Gjt="pensil:public-video:volume";function hdr(){try{const t=JSON.parse(window.localStorage.getItem(Gjt)||"null");if(t&&typeof t.volume=="number")return{volume:Math.min(1,Math.max(0,t.volume)),muted:!!t.muted}}catch{}return{volume:1,muted:!1}}function mdr({src:t,poster:e,title:n,onRatio:r,onSourceError:s,endScreen:i,startOverlay:o}){const l=y.useRef(null),c=y.useRef(null),d=y.useRef(),u=y.useRef(0),h=y.useRef({time:0,side:null}),[m,f]=y.useState(!1),[p,g]=y.useState(!1),[v,b]=y.useState(!1),[x,w]=y.useState(!1),[k,S]=y.useState(!1),[C,j]=y.useState(0),[E,N]=y.useState(0),[A,_]=y.useState(0),[T,R]=y.useState(0),[{volume:O,muted:F},D]=y.useState(hdr),[I,P]=y.useState(1),[M,z]=y.useState(!1),[G,B]=y.useState(!0),[H,W]=y.useState(!1),[V,U]=y.useState(null),[ne,te]=y.useState(!1),[re,fe]=y.useState(null),le=typeof document<"u"&&!!document.pictureInPictureEnabled,q=()=>c.current;y.useEffect(()=>{const Ee=q();if(Ee){Ee.volume=O,Ee.muted=F;try{window.localStorage.setItem(Gjt,JSON.stringify({volume:O,muted:F}))}catch{}}},[O,F,C,t]),y.useEffect(()=>{const Ee=q();Ee&&(Ee.playbackRate=I)},[I,C,t]);const Y=y.useCallback(()=>{B(!0),window.clearTimeout(d.current),d.current=window.setTimeout(()=>B(!1),udr)},[]);y.useEffect(()=>()=>window.clearTimeout(d.current),[]);const X=!m||!p||x||H||ne||G,Q=y.useRef(null);y.useEffect(()=>{if(!H)return;const Ee=Ge=>{var Pt;(Ge instanceof KeyboardEvent?Ge.key==="Escape":!((Pt=Q.current)!=null&&Pt.contains(Ge.target)))&&W(!1)};return document.addEventListener("pointerdown",Ee),document.addEventListener("keydown",Ee),()=>{document.removeEventListener("pointerdown",Ee),document.removeEventListener("keydown",Ee)}},[H]);const ie=Ee=>fe({id:Date.now(),text:Ee});y.useEffect(()=>{if(!re)return;const Ee=window.setTimeout(()=>fe(null),700);return()=>window.clearTimeout(Ee)},[re]);const he=y.useCallback(()=>{var Ge;const Ee=q();Ee&&(f(!0),Ee.ended&&(Ee.currentTime=0),(Ge=Ee.play())==null||Ge.catch(()=>g(!1)))},[]),ye=y.useCallback(()=>{const Ee=q();Ee&&(Ee.paused||Ee.ended?he():Ee.pause())},[he]),J=y.useCallback(Ee=>{const Ge=q();!Ge||!Number.isFinite(Ge.duration)||(Ge.currentTime=Math.min(Ge.duration,Math.max(0,Ee)),N(Ge.currentTime))},[]),K=y.useCallback(Ee=>{const Ge=q();Ge&&(J(Ge.currentTime+Ee),ie(Ee>0?`+${Ee}s`:`${Ee}s`))},[J]),ce=y.useCallback(Ee=>{const Ge=Math.round(Math.min(1,Math.max(0,Ee))*100)/100;D({volume:Ge,muted:Ge===0})},[]),pe=y.useCallback(()=>D(Ee=>({volume:Ee.volume||1,muted:!Ee.muted})),[]),Ie=y.useCallback(()=>{var vn,Hn,yr,br;const Ee=document;if(Ee.fullscreenElement||Ee.webkitFullscreenElement){((vn=Ee.exitFullscreen)==null?void 0:vn.call(Ee))??((Hn=Ee.webkitExitFullscreen)==null||Hn.call(Ee));return}const Pt=l.current;Pt!=null&&Pt.requestFullscreen?Pt.requestFullscreen().catch(()=>{}):Pt!=null&&Pt.webkitRequestFullscreen?Pt.webkitRequestFullscreen():(br=(yr=q())==null?void 0:yr.webkitEnterFullscreen)==null||br.call(yr)},[]);y.useEffect(()=>{const Ee=document,Ge=()=>z(!!(Ee.fullscreenElement||Ee.webkitFullscreenElement));return document.addEventListener("fullscreenchange",Ge),document.addEventListener("webkitfullscreenchange",Ge),()=>{document.removeEventListener("fullscreenchange",Ge),document.removeEventListener("webkitfullscreenchange",Ge)}},[]);const Me=y.useCallback(()=>{var Pt,vn;const Ee=q(),Ge=document;Ge.pictureInPictureElement?(Pt=Ge.exitPictureInPicture)==null||Pt.call(Ge).catch(()=>{}):(vn=Ee==null?void 0:Ee.requestPictureInPicture)==null||vn.call(Ee).catch(()=>{})},[]),we=y.useCallback(Ee=>{P(Ge=>{const Pt=_V.indexOf(Ge),vn=_V[Math.min(_V.length-1,Math.max(0,(Pt<0?2:Pt)+Ee))];return ie(`${vn}×`),vn})},[]);y.useEffect(()=>{const Ee=Ge=>{if(Ge.ctrlKey||Ge.metaKey||Ge.altKey||k)return;const Pt=Ge.target instanceof Element?Ge.target:null;if(Pt!=null&&Pt.closest("input, textarea, select, [contenteditable=true]"))return;const vn=!!(Pt!=null&&Pt.closest("button, a, [role=slider], [role=menu]")),Hn=Ge.key,yr=q();if(!yr)return;const br=Yt=>{Ge.preventDefault(),Yt(),Y()};if(!((Hn===" "||Hn==="Enter")&&vn)){if(Hn===" "||Hn.toLowerCase()==="k")return br(ye);if(!(Pt!=null&&Pt.closest("[role=slider]"))){if(Hn==="ArrowLeft")return br(()=>K(-5));if(Hn==="ArrowRight")return br(()=>K(5));if(Hn.toLowerCase()==="j")return br(()=>K(-10));if(Hn.toLowerCase()==="l")return br(()=>K(10));if(Hn==="ArrowUp")return br(()=>{ce(O+.1),ie(`${Math.round(Math.min(1,O+.1)*100)}%`)});if(Hn==="ArrowDown")return br(()=>{ce(O-.1),ie(`${Math.round(Math.max(0,O-.1)*100)}%`)});if(Hn.toLowerCase()==="m")return br(()=>{pe(),ie(F?"Sound on":"Muted")});if(Hn.toLowerCase()==="f")return br(Ie);if(Hn==="Home")return br(()=>J(0));if(Hn==="End")return br(()=>J(yr.duration));if(Hn===">"||Ge.shiftKey&&Hn===".")return br(()=>we(1));if(Hn==="<"||Ge.shiftKey&&Hn===",")return br(()=>we(-1));if(/^[0-9]$/.test(Hn)&&Number.isFinite(yr.duration))return br(()=>J(Number(Hn)/10*yr.duration))}}};return window.addEventListener("keydown",Ee),()=>window.removeEventListener("keydown",Ee)},[ce,k,F,J,Y,K,we,ye,Ie,pe,O]);const Be=Ee=>{if(!(Ee.nativeEvent.pointerType==="touch")){ye(),Y();return}const Pt=Ee.currentTarget.getBoundingClientRect(),vn=Ee.clientX<Pt.left+Pt.width/3?"left":Ee.clientX>Pt.right-Pt.width/3?"right":null,Hn=Date.now();if(vn&&h.current.side===vn&&Hn-h.current.time<300){K(vn==="left"?-10:10),h.current={time:0,side:null};return}h.current={time:Hn,side:vn},X&&ye(),Y()},Ve=(Ee,Ge)=>{const Pt=Ge.getBoundingClientRect(),vn=Pt.width?Math.min(1,Math.max(0,(Ee-Pt.left)/Pt.width)):0;return{share:vn,x:vn*Pt.width,time:vn*(A||0)}},be=Ee=>{var Ge,Pt;(Pt=(Ge=Ee.currentTarget).setPointerCapture)==null||Pt.call(Ge,Ee.pointerId),te(!0),J(Ve(Ee.clientX,Ee.currentTarget).time)},Ze=Ee=>{const Ge=Ve(Ee.clientX,Ee.currentTarget);U({x:Ge.x,time:Ge.time}),ne&&J(Ge.time)},Pe=Ee=>{var Ge,Pt;(Pt=(Ge=Ee.currentTarget).releasePointerCapture)==null||Pt.call(Ge,Ee.pointerId),te(!1)},Ke=Ee=>{const Ge={ArrowLeft:-5,ArrowRight:5,ArrowDown:-5,ArrowUp:5,PageDown:-10,PageUp:10};Ee.key in Ge?(Ee.preventDefault(),K(Ge[Ee.key])):Ee.key==="Home"?(Ee.preventDefault(),J(0)):Ee.key==="End"&&(Ee.preventDefault(),J(A))},De=()=>{var Ee;u.current=((Ee=q())==null?void 0:Ee.currentTime)||E,S(!1),b(!1),j(Ge=>Ge+1)},xt=Ee=>{s!=null&&s(Ee)||(S(!0),g(!1),b(!1))},Xe=A?E/A*100:0,tt=A?Math.min(100,T/A*100):0,$e=F||O===0?C9t:O<.5?S9t:NSe,wt=typeof navigator<"u"&&navigator.onLine===!1;return a.jsxs("div",{ref:l,className:ee("group/player relative h-full w-full overflow-hidden bg-black text-white",M?"rounded-none":"rounded-[inherit]",m&&p&&!X&&"cursor-none"),onPointerMove:Ee=>{Ee.pointerType!=="touch"&&Y()},onPointerLeave:()=>{p&&B(!1),U(null)},children:[!k&&a.jsx("video",{ref:c,src:t&&!e?`${t}#t=0.1`:t,poster:e??void 0,preload:"metadata",playsInline:!0,controlsList:"nodownload",disablePictureInPicture:!le,"aria-label":n||"Video",className:"absolute inset-0 h-full w-full object-contain",onLoadedMetadata:Ee=>{var Pt;const Ge=Ee.currentTarget;_(Number.isFinite(Ge.duration)?Ge.duration:0),Ge.videoWidth&&Ge.videoHeight&&(r==null||r(Ge.videoWidth/Ge.videoHeight,Number.isFinite(Ge.duration)?Ge.duration:null)),u.current&&(Ge.currentTime=u.current,u.current=0,m&&((Pt=Ge.play())==null||Pt.catch(()=>{})))},onDurationChange:Ee=>_(Number.isFinite(Ee.currentTarget.duration)?Ee.currentTarget.duration:0),onTimeUpdate:Ee=>{ne||N(Ee.currentTarget.currentTime)},onProgress:Ee=>{const Ge=Ee.currentTarget.buffered;Ge.length&&R(Ge.end(Ge.length-1))},onPlay:()=>{f(!0),g(!0),w(!1),Y()},onPause:()=>g(!1),onWaiting:()=>b(!0),onPlaying:()=>b(!1),onCanPlay:()=>b(!1),onSeeked:()=>b(!1),onEnded:()=>{g(!1),w(!0)},onVolumeChange:Ee=>{const Ge=Ee.currentTarget;(Ge.volume!==O||Ge.muted!==F)&&D({volume:Ge.volume,muted:Ge.muted})},onError:xt,children:"Your browser can't play this video."},C),m&&!k&&!x&&a.jsx("div",{className:"absolute inset-0",onClick:Be,onDoubleClick:Ee=>{Ee.nativeEvent.pointerType!=="touch"&&Ie()},"aria-hidden":!0}),m&&v&&p&&!k&&a.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",role:"status","aria-label":"Loading",children:a.jsx("span",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-black/50 backdrop-blur-sm",children:a.jsx(Ne,{className:"h-7 w-7 motion-safe:animate-spin","aria-hidden":!0})})}),re&&a.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-6 flex justify-center","aria-live":"polite",children:a.jsx("span",{className:"rounded-full bg-black/65 px-3 py-1 text-sm font-semibold tabular-nums backdrop-blur-sm motion-safe:animate-in motion-safe:fade-in",children:re.text})},re.id),!m&&!k&&a.jsxs("button",{type:"button",onClick:he,"aria-label":n?`Play ${n}`:"Play video",className:"group absolute inset-0 flex flex-col items-center justify-center gap-3 bg-gradient-to-t from-black/70 via-black/15 to-black/5 focus-visible:outline-none",children:[a.jsxs("span",{className:"relative flex h-16 w-16 items-center justify-center sm:h-20 sm:w-20",children:[a.jsx("span",{className:"absolute inset-0 rounded-full bg-white/25 motion-safe:animate-ping motion-safe:[animation-duration:2.4s]","aria-hidden":!0}),a.jsx("span",{className:"relative flex h-full w-full items-center justify-center rounded-full bg-white text-[#0b0d12] shadow-2xl ring-4 ring-white/20 transition-transform duration-200 motion-safe:group-hover:scale-105 group-focus-visible:ring-primary",children:a.jsx(fm,{className:"ml-1 h-7 w-7 fill-current sm:h-9 sm:w-9","aria-hidden":!0})})]}),a.jsx("span",{className:"rounded-full bg-black/45 px-3 py-1 text-xs font-medium backdrop-blur-sm sm:text-sm",children:"Tap to play with sound"}),o]}),x&&!k&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-black/70 p-4 backdrop-blur-[2px] motion-safe:animate-in motion-safe:fade-in",children:i?i(he):a.jsxs("button",{type:"button",onClick:he,className:"flex items-center gap-2 rounded-full bg-white px-5 py-2.5 text-sm font-semibold text-[#0b0d12]",children:[a.jsx(zP,{className:"h-4 w-4","aria-hidden":!0})," Watch again"]})}),k&&a.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-3 p-6 text-center",role:"alert",children:[a.jsx("span",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-white/10",children:a.jsx(tS,{className:"h-6 w-6 text-white/80","aria-hidden":!0})}),a.jsx("p",{className:"text-sm font-medium text-white/90",children:wt?"You're offline. Check your connection and try again.":"This video couldn't be played right now."}),a.jsxs("button",{type:"button",onClick:De,className:"flex items-center gap-1.5 rounded-full bg-white px-4 py-2 text-sm font-semibold text-[#0b0d12] transition-colors hover:bg-white/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:[a.jsx(zP,{className:"h-4 w-4","aria-hidden":!0})," Try again"]})]}),m&&!k&&a.jsxs("div",{className:ee("absolute inset-x-0 bottom-0 bg-gradient-to-t from-black/85 via-black/45 to-transparent px-3 pb-2 pt-10 transition-opacity duration-300 sm:px-4 sm:pb-3",X?"opacity-100":"pointer-events-none opacity-0"),onFocus:Y,children:[a.jsxs("div",{role:"slider",tabIndex:0,"aria-label":"Seek","aria-valuemin":0,"aria-valuemax":Math.round(A),"aria-valuenow":Math.round(E),"aria-valuetext":`${D_(E)} of ${D_(A)}`,className:"group/track relative flex h-5 cursor-pointer touch-none items-center focus-visible:outline-none",onPointerDown:be,onPointerMove:Ze,onPointerUp:Pe,onPointerLeave:()=>U(null),onKeyDown:Ke,children:[a.jsxs("div",{className:"relative h-1 w-full overflow-hidden rounded-full bg-white/25 transition-[height] group-hover/track:h-1.5 group-focus-visible/track:h-1.5",children:[a.jsx("div",{className:"absolute inset-y-0 left-0 bg-white/40",style:{width:`${tt}%`}}),a.jsx("div",{className:"absolute inset-y-0 left-0 bg-primary",style:{width:`${Xe}%`}})]}),a.jsx("span",{className:"pointer-events-none absolute top-1/2 h-3.5 w-3.5 -translate-x-1/2 -translate-y-1/2 scale-0 rounded-full bg-white shadow transition-transform group-hover/track:scale-100 group-focus-visible/track:scale-100 group-focus-visible/track:ring-2 group-focus-visible/track:ring-primary",style:{left:`${Xe}%`},"aria-hidden":!0}),V&&A>0&&a.jsx("span",{className:"pointer-events-none absolute -top-7 -translate-x-1/2 rounded bg-black/80 px-1.5 py-0.5 text-[11px] font-semibold tabular-nums",style:{left:V.x},"aria-hidden":!0,children:D_(V.time)})]}),a.jsxs("div",{className:"mt-1 flex items-center gap-0.5 sm:gap-1",children:[a.jsx(T3,{label:p?"Pause (k)":"Play (k)",onClick:ye,children:p?a.jsx(t9t,{className:"h-5 w-5 fill-current","aria-hidden":!0}):a.jsx(fm,{className:"h-5 w-5 fill-current","aria-hidden":!0})}),a.jsxs("div",{className:"group/vol flex items-center",children:[a.jsx(T3,{label:F||O===0?"Unmute (m)":"Mute (m)",onClick:pe,children:a.jsx($e,{className:"h-5 w-5","aria-hidden":!0})}),a.jsx("input",{type:"range",min:0,max:1,step:.05,value:F?0:O,onChange:Ee=>ce(Number(Ee.target.value)),"aria-label":"Volume",className:"hidden h-1 w-0 cursor-pointer accent-white opacity-0 transition-all duration-200 group-hover/vol:w-20 group-hover/vol:opacity-100 focus-visible:w-20 focus-visible:opacity-100 sm:block"})]}),a.jsxs("span",{className:"ml-1 text-xs font-medium tabular-nums text-white/90 sm:text-[13px]","aria-live":"off",children:[D_(E)," ",a.jsxs("span",{className:"text-white/50",children:["/ ",D_(A)]})]}),a.jsxs("div",{className:"ml-auto flex items-center gap-0.5 sm:gap-1",children:[a.jsxs("div",{className:"relative",ref:Q,children:[a.jsxs(T3,{label:"Playback speed",onClick:()=>W(Ee=>!Ee),expanded:H,children:[a.jsx(wSe,{className:"h-5 w-5","aria-hidden":!0}),I!==1&&a.jsxs("span",{className:"absolute -right-0.5 -top-0.5 rounded bg-primary px-1 text-[9px] font-bold leading-4",children:[I,"×"]})]}),H&&a.jsxs("div",{role:"menu","aria-label":"Playback speed",className:"absolute bottom-11 right-0 z-10 w-36 overflow-hidden rounded-xl bg-[#16181f]/95 py-1 shadow-2xl ring-1 ring-white/10 backdrop-blur motion-safe:animate-in motion-safe:fade-in motion-safe:slide-in-from-bottom-1",children:[a.jsx("p",{className:"px-3 pb-1 pt-1.5 text-[11px] font-semibold uppercase tracking-wide text-white/50",children:"Speed"}),_V.map(Ee=>a.jsxs("button",{type:"button",role:"menuitemradio","aria-checked":I===Ee,onClick:()=>{P(Ee),W(!1)},className:"flex w-full items-center justify-between px-3 py-1.5 text-left text-sm hover:bg-white/10 focus-visible:bg-white/10 focus-visible:outline-none",children:[Ee===1?"Normal":`${Ee}×`,I===Ee&&a.jsx(Qn,{className:"h-4 w-4 text-primary","aria-hidden":!0})]},Ee))]})]}),le&&a.jsx(T3,{label:"Picture in picture",onClick:Me,children:a.jsx(Xrt,{className:"h-5 w-5","aria-hidden":!0})}),a.jsx(T3,{label:M?"Exit full screen (f)":"Full screen (f)",onClick:Ie,children:M?a.jsx(Grt,{className:"h-5 w-5","aria-hidden":!0}):a.jsx(Urt,{className:"h-5 w-5","aria-hidden":!0})})]})]})]})]})}function T3({label:t,onClick:e,expanded:n,children:r}){return a.jsxs("button",{type:"button",onClick:e,"aria-label":t.replace(/ \(\w\)$/,""),"aria-expanded":n,className:"group/btn relative flex h-10 w-10 items-center justify-center rounded-full text-white/90 transition-colors hover:bg-white/15 hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:[r,a.jsx("span",{className:"pointer-events-none absolute bottom-full mb-2 hidden whitespace-nowrap rounded bg-black/85 px-2 py-1 text-[11px] font-medium opacity-0 transition-opacity [@media(hover:hover)]:block group-hover/btn:opacity-100 group-focus-visible/btn:opacity-100",children:t})]})}const fdr=/^[A-Za-z0-9]{12}$/;function pdr(){var o;const{publicId:t=""}=So(),e=fdr.test(t),n=lt({queryKey:["public-email-video",t],queryFn:()=>ojt(t),enabled:e,retry:(l,c)=>!(c instanceof ze&&c.status===404)&&l<2,staleTime:5*60*1e3});y.useEffect(()=>{const l=document.createElement("meta");return l.name="robots",l.content="noindex, nofollow",document.head.appendChild(l),()=>l.remove()},[]);const r=n.data;y.useEffect(()=>{var c;const l=document.title;return r!=null&&r.title&&(document.title=(c=r.sharedBy)!=null&&c.name?`${r.title} · ${r.sharedBy.name}`:r.title),()=>{document.title=l}},[r==null?void 0:r.title,(o=r==null?void 0:r.sharedBy)==null?void 0:o.name]);const s=!e||n.error instanceof ze&&n.error.status===404,i=r==null?void 0:r.thumbnailUrl;return a.jsxs("main",{className:"relative isolate flex min-h-[100svh] flex-col overflow-x-clip bg-[#0b0d12] text-white",children:[a.jsxs("div",{"aria-hidden":!0,className:"pointer-events-none fixed inset-0 -z-10 overflow-hidden",children:[i?a.jsx("img",{src:i,alt:"",className:"absolute inset-0 h-full w-full scale-125 object-cover opacity-25 blur-3xl saturate-150"}):a.jsx("div",{className:"absolute inset-0 bg-[radial-gradient(55%_45%_at_50%_30%,hsl(var(--primary)/0.16),transparent_70%)]"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-b from-[#0b0d12]/30 via-[#0b0d12]/70 to-[#0b0d12]"})]}),a.jsxs("header",{className:"mx-auto flex w-full max-w-6xl items-center gap-3 px-4 py-3 sm:px-8 sm:py-4",children:[r!=null&&r.sharedBy?a.jsx(ydr,{name:r.sharedBy.name,logo:r.sharedBy.logo}):a.jsx("span",{className:"h-8","aria-hidden":!0}),r&&a.jsx(zxe,{video:r,className:"ml-auto",compact:!0})]}),a.jsx("div",{className:"mx-auto flex w-full max-w-6xl flex-1 flex-col items-center justify-center px-4 pb-8 sm:px-8",children:s?a.jsx(jVe,{icon:a.jsx(S2,{className:"h-6 w-6"}),title:"This video isn't available",text:"The link may be incomplete, or the video was removed. Check the link you were sent."}):n.isLoading?a.jsxs("div",{className:"w-full max-w-5xl",role:"status","aria-label":"Loading video",children:[a.jsx("div",{className:"flex aspect-video w-full items-center justify-center rounded-xl bg-white/5 ring-1 ring-white/10 motion-safe:animate-pulse sm:rounded-2xl",children:a.jsx(Ne,{className:"h-8 w-8 text-white/50 motion-safe:animate-spin"})}),a.jsx("div",{className:"mt-5 h-6 w-2/3 max-w-md rounded-full bg-white/10 motion-safe:animate-pulse"}),a.jsx("div",{className:"mt-3 h-4 w-40 rounded-full bg-white/5 motion-safe:animate-pulse"})]}):n.isError||!r?a.jsx(jVe,{icon:a.jsx(tS,{className:"h-6 w-6"}),title:"We couldn't load this video",text:"Check your connection and try again.",action:a.jsxs(Z,{variant:"secondary",size:"sm",onClick:()=>void n.refetch(),children:[a.jsx(zP,{className:"mr-1.5 h-4 w-4"})," Try again"]})}):a.jsx(gdr,{video:r})}),a.jsxs("footer",{className:"mx-auto flex w-full max-w-6xl items-center justify-between gap-3 px-4 pb-5 text-[11px] text-white/40 sm:px-8",children:[a.jsx("span",{className:"tracking-wide",children:"Shared with SpatialChat Communities"}),r&&a.jsx(xdr,{})]})]})}function gdr({video:t}){var u;const e=GB(t.videoUrl,{webCopy:!0}),n=v7(),[r,s]=y.useState(t.width&&t.height?t.width/t.height:16/9),[i,o]=y.useState(t.durationSec),l=i?D_(i):null,c=(u=t.sharedBy)==null?void 0:u.name,d=h=>e.src===t.videoUrl?!1:(e.onError(h),!0);return a.jsx(it.article,{className:"flex w-full flex-col items-center",initial:n?!1:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.45,ease:"easeOut"},children:a.jsxs("div",{className:"w-full",style:{maxWidth:`calc(max(15rem, 100svh - 18.5rem) * ${r})`},children:[a.jsx("div",{className:"relative w-full overflow-hidden rounded-xl bg-black shadow-[0_40px_120px_-40px_rgba(0,0,0,0.95)] ring-1 ring-white/10 sm:rounded-2xl",style:{aspectRatio:String(r)},children:a.jsx(mdr,{src:e.src,poster:t.thumbnailUrl,title:t.title,onRatio:(h,m)=>{s(h),m&&o(m)},onSourceError:d,startOverlay:l&&a.jsxs("span",{className:"absolute bottom-3 right-3 flex items-center gap-1 rounded-md bg-black/60 px-2 py-0.5 text-[11px] font-semibold tabular-nums backdrop-blur-sm sm:bottom-4 sm:right-4 sm:text-xs",children:[a.jsx(ja,{className:"h-3 w-3","aria-hidden":!0}),l]}),endScreen:h=>a.jsxs("div",{className:"flex max-w-sm flex-col items-center gap-4 text-center",children:[a.jsxs("p",{className:"text-sm font-medium text-white/80 sm:text-base",children:["Thanks for watching",c?` — from ${c}`:""]}),a.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[a.jsxs("button",{type:"button",onClick:h,className:"flex items-center gap-2 rounded-full bg-white px-4 py-2 text-sm font-semibold text-[#0b0d12] transition-colors hover:bg-white/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:[a.jsx(zP,{className:"h-4 w-4","aria-hidden":!0})," Watch again"]}),a.jsx(zxe,{video:t,variant:"glass"})]}),c&&a.jsx(CVe,{name:c})]})})}),a.jsxs("div",{className:"mt-5 sm:mt-6",children:[t.title&&a.jsx("h1",{className:"break-words text-lg font-semibold leading-snug tracking-tight sm:text-2xl",children:t.title}),a.jsxs("div",{className:"mt-2 flex flex-wrap items-center gap-x-3 gap-y-1 text-[13px] text-white/60",children:[l&&a.jsxs("span",{className:"flex items-center gap-1.5 tabular-nums",children:[a.jsx(ja,{className:"h-3.5 w-3.5","aria-hidden":!0}),l]}),l&&c&&a.jsx("span",{"aria-hidden":!0,className:"text-white/25",children:"•"}),c&&a.jsxs("span",{children:["Shared by ",a.jsx("span",{className:"font-medium text-white/85",children:c})]})]}),a.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2",children:[a.jsx(zxe,{video:t,variant:"primary"}),a.jsx(vdr,{}),c&&a.jsx(CVe,{name:c,subtle:!0})]})]})]})})}const Wjt=()=>`${window.location.origin}${window.location.pathname}`;async function qjt(){const t=await kN(Wjt());wK(t?{title:"Link copied",description:"Paste it anywhere to share this video."}:{title:"Couldn't copy the link",description:"Copy it from your browser's address bar instead.",variant:"destructive"})}function zxe({video:t,variant:e="ghost",compact:n=!1,className:r}){const s=async()=>{const i=navigator;if(i.share)try{await i.share({title:t.title||"Video",url:Wjt()});return}catch(o){if((o==null?void 0:o.name)==="AbortError")return}await qjt()};return a.jsxs("button",{type:"button",onClick:()=>void s(),className:ee("flex h-10 sm:h-9 items-center gap-1.5 rounded-full px-4 text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary focus-visible:ring-offset-2 focus-visible:ring-offset-[#0b0d12]",e==="primary"&&"bg-primary text-primary-foreground hover:bg-primary/90",e==="ghost"&&"text-white/85 ring-1 ring-white/15 hover:bg-white/10 hover:text-white",e==="glass"&&"bg-white/15 text-white backdrop-blur hover:bg-white/25",n&&"px-3",r),children:[a.jsx(kk,{className:"h-4 w-4","aria-hidden":!0}),a.jsx("span",{className:ee(n&&"sr-only sm:not-sr-only"),children:"Share"})]})}function vdr(){return a.jsxs("button",{type:"button",onClick:()=>void qjt(),className:"flex h-10 sm:h-9 items-center gap-1.5 rounded-full px-4 text-sm font-semibold text-white/85 ring-1 ring-white/15 transition-colors hover:bg-white/10 hover:text-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",children:[a.jsx(eu,{className:"h-4 w-4","aria-hidden":!0})," Copy link"]})}function CVe({name:t,subtle:e=!1}){return a.jsxs("a",{href:"/",className:ee("flex h-10 sm:h-9 max-w-full items-center gap-1.5 rounded-full px-4 text-sm font-semibold transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",e?"text-white/70 hover:text-white sm:ml-auto":"text-white/80 underline-offset-4 hover:text-white hover:underline"),children:[a.jsxs("span",{className:"truncate",children:["Visit ",t]}),a.jsx(R8,{className:"h-4 w-4 shrink-0","aria-hidden":!0})]})}function ydr({name:t,logo:e}){const[n,r]=y.useState(!1),s=t.split(/\s+/).map(i=>i[0]).filter(Boolean).join("").slice(0,2).toUpperCase();return a.jsxs("a",{href:"/",className:"flex min-w-0 items-center gap-2.5 rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary","aria-label":`${t} home`,children:[e&&!n?a.jsx("img",{src:e,alt:"",onError:()=>r(!0),className:"h-8 w-8 shrink-0 rounded-lg bg-white object-contain p-0.5"}):a.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary text-xs font-bold text-primary-foreground","aria-hidden":!0,children:s}),a.jsx("span",{className:"truncate text-sm font-semibold text-white/90",children:t})]})}const bdr=[["Space / K","Play or pause"],["← / →","Back or forward 5 s"],["J / L","Back or forward 10 s"],["↑ / ↓","Volume"],["M","Mute"],["F","Full screen"],["0 – 9","Jump to 0 – 90%"],["Shift + , / .","Slower or faster"]];function xdr(){return a.jsxs(Ni,{children:[a.jsx(Ti,{asChild:!0,children:a.jsxs("button",{type:"button",className:"hidden items-center gap-1.5 rounded-md px-2 py-1 text-white/50 transition-colors hover:text-white/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary [@media(hover:hover)]:flex",children:[a.jsx(UBt,{className:"h-3.5 w-3.5","aria-hidden":!0})," Keyboard shortcuts"]})}),a.jsxs(yi,{align:"end",className:"w-64 border-white/10 bg-[#16181f] p-3 text-white",children:[a.jsx("p",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-white/50",children:"Keyboard shortcuts"}),a.jsx("dl",{className:"space-y-1.5 text-sm",children:bdr.map(([t,e])=>a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsx("dt",{className:"text-white/75",children:e}),a.jsx("dd",{children:a.jsx("kbd",{className:"rounded bg-white/10 px-1.5 py-0.5 font-mono text-[11px]",children:t})})]},t))})]})]})}function jVe({icon:t,title:e,text:n,action:r}){return a.jsxs("div",{className:"flex max-w-md flex-col items-center gap-3 rounded-2xl border border-white/10 bg-white/5 px-6 py-10 text-center backdrop-blur-sm",role:"alert",children:[a.jsx("span",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-white/10 text-white/80",children:t}),a.jsx("h1",{className:"text-lg font-semibold",children:e}),a.jsx("p",{className:"text-sm text-white/60",children:n}),r]})}const wdr=a.jsxs(y.Fragment,{children:[a.jsx(an,{path:"/guest-event",element:a.jsx(Pir,{})}),a.jsx(an,{path:ve.publicVideoPattern,element:a.jsx(pdr,{})}),a.jsx(an,{path:ve.signIn,element:a.jsx(d$e,{children:a.jsx(xar,{})})}),a.jsx(an,{path:ve.signUp,element:a.jsx(d$e,{children:a.jsx(war,{})})}),a.jsx(an,{path:ve.onboarding,element:a.jsx(Wir,{})}),a.jsx(an,{path:ve.welcome,element:a.jsx(kar,{})}),a.jsx(an,{path:ve.recommendations,element:a.jsx(Yir,{})}),a.jsx(an,{path:ve.introduce,element:a.jsx(Rir,{})}),a.jsx(an,{path:ve.newsletterSignupPattern,element:a.jsx(Klr,{})}),a.jsx(an,{path:ve.unsubscribe,element:a.jsx(Ylr,{})}),a.jsx(an,{path:ve.newsletterConfirmPattern,element:a.jsx(hVe,{})}),a.jsx(an,{path:ve.newsletterConfirmAliasPattern,element:a.jsx(hVe,{})}),a.jsx(an,{path:ve.preferences,element:a.jsx(ocr,{})}),a.jsx(an,{path:ve.newsletterArchivePattern,element:a.jsx(ccr,{})}),a.jsx(an,{path:ve.newsletterPostPublicPattern,element:a.jsx(qcr,{})}),a.jsx(an,{path:ve.formPublicPattern,element:a.jsx(edr,{})})]});async function kdr(t){return ae.get(`/community/${encodeURIComponent(t)}/groups`)}const Vxe=10;async function Kjt(t){const e=t?`?communityId=${encodeURIComponent(t)}`:"";return ae.get(`/user/counters${e}`)}const jh=t=>encodeURIComponent(t);async function Yjt(t){const{user:e}=await ae.get(`/user/${jh(t)}`);return e}async function Sdr(t){return(await ae.get(`/user/${jh(t)}/group`)).groups??[]}async function Qjt(t,e){return ae.get(`/community/${jh(t)}/user/${jh(e)}/follow-following-count`)}async function Cdr(t,e,n,r=1,s=5){const i=n==="followers"?"followers":"followeds",o=await ae.get(`/community/${jh(t)}/user/${jh(e)}/${i}?page=${r}&limit=${s}`),l=(n==="followers"?o.followers:o.followings)??[];return{users:l,total:o.total??l.length,page:o.page??r,hasMore:o.hasMore??!1}}async function Zjt(t,e,n=1,r){const s=await ae.get(`/community/${jh(t)}/user/${jh(e)}/posts?page=${n}${r?`&kind=${r}`:""}`);return Array.isArray(s==null?void 0:s.posts)?s.posts:[]}async function jdr(t,e,n=1,r=[]){const s=r.length?`&activityTypes=${encodeURIComponent(r.join(","))}`:"",i=await ae.get(`/community/${jh(t)}/user/${jh(e)}/activities?page=${n}${s}`);return Array.isArray(i==null?void 0:i.userActivities)?i.userActivities:[]}async function Edr(){const t=await ae.get("/user/followed-ids");return Array.isArray(t==null?void 0:t.followedIds)?t.followedIds.map(String):[]}async function Xre(t,e){await ae.get(`/community/${jh(t)}/user/${jh(e)}/follow`)}async function ese(t,e){await ae.get(`/community/${jh(t)}/user/${jh(e)}/unfollow`)}async function Ndr(){const t=await ae.get("/user/notifications");return Array.isArray(t==null?void 0:t.notifications)?t.notifications:[]}async function Tdr(t){await ae.post(`/user/notifications/${encodeURIComponent(t)}/mark-as-read`)}async function _dr(t){await ae.delete(`/user/notifications/${encodeURIComponent(t)}`)}async function Adr(){await ae.post("/user/notifications/mark-as-read")}async function Pdr(){await ae.post("/user/notifications/mark-as-received")}async function Rdr(t){const{preferences:e}=await ae.get(`/community/${encodeURIComponent(t)}/notification-preferences`);return e}async function tse(t,e){const{preferences:n}=await ae.post(`/community/${encodeURIComponent(t)}/notification-preferences`,e);return n}async function Idr(t,e){const{preferences:n}=await ae.post(`/community/${encodeURIComponent(t)}/notification-preferences/tab`,e);return n}async function Jjt(t){const{plans:e}=await ae.get(`/checkout/community/${encodeURIComponent(t)}/plans`);return Object.values(e??{}).sort((n,r)=>n.level-r.level)}async function Mdr(t){const{subscriptions:e}=await ae.get(`/community/${encodeURIComponent(t)}/subscriptions`);return Array.isArray(e)?e:[]}async function Ldr(t){const{subscription:e,subscriptions:n}=await ae.get(`/community/${encodeURIComponent(t)}/subscription/my`);return n??(e?[e]:[])}async function Ddr(t,e){const n=typeof window<"u"?window.location.origin:"",{redirectUrl:r}=await ae.get(`/checkout/community/${encodeURIComponent(t)}/${encodeURIComponent(e)}?communityURL=${encodeURIComponent(n)}`);return r}const rp=t=>encodeURIComponent(t),Bu=t=>`/community/${rp(t)}`;function $dr(t){return ae.get(`${Bu(t)}/subscriptions`)}function Odr(t){return ae.get(`${Bu(t)}/subscription/my`)}function Fdr(t,e){const n=e?`/${rp(e)}`:"";return ae.delete(`${Bu(t)}/subscription/my${n}`)}function Bdr(t,e){return ae.post(`${Bu(t)}/subscription/${rp(e)}/free-subscribe`,{})}function Udr(t,e,n={}){return ae.post(`${Bu(t)}/subscription/${rp(e)}/initiate-subscription`,n)}function zdr(t,e,n){return ae.post(`${Bu(t)}/subscription/${rp(e)}/complete-subscription`,{sessionId:n})}function Vdr(t,e,n=1){return ae.get(`${Bu(t)}/subscription/${rp(e)}/active-subscriptions?page=${n}`)}function Hdr(t,e,n=1){return ae.get(`${Bu(t)}/subscription/${rp(e)}/members?page=${n}`)}function Gdr(t,e,n){return ae.post(`${Bu(t)}/invoice-edit/${rp(e)}`,n)}function Wdr(t,e){return ae.post(`${Bu(t)}/invoice-resend/${rp(e)}`,{})}async function qdr(t,e){const n=Nd(),r=`${wo.apiBaseUrl.replace(/\/$/,"")}${Bu(t)}/invoice-download/${rp(e)}`,s=await fetch(r,{headers:n?{Authorization:`Bearer ${n}`}:{}});if(!s.ok)throw new Error("Could not download invoice");return s.blob()}function Kdr(t){return ae.get(`${Bu(t)}/subscriptions/admin`)}function Ydr(t,e){return ae.post(`${Bu(t)}/subscription`,e)}function Qdr(t,e){return ae.delete(`${Bu(t)}/subscription/${rp(e)}`)}function Zdr(t,e){return ae.post(`${Bu(t)}/subscription/${rp(e)}/activate`,{})}const Xjt=y.createContext(null);function Jdr({children:t}){const{community:e,setCommunity:n}=qe(),r=(e==null?void 0:e.id)??null,s=kje(),i=y.useRef(null),o=lt({queryKey:["community-groups",r],queryFn:()=>kdr(r),enabled:!!r,select:b=>b.groups??[],staleTime:6e4,refetchOnMount:"always",refetchOnWindowFocus:!0}),l=lt({queryKey:["user-counters",r],queryFn:()=>Kjt(r),enabled:!!r&&s,staleTime:3e4}),c=lt({queryKey:["community-detail",r],queryFn:()=>lR(r),enabled:!!r,select:b=>b.community,staleTime:6e4,refetchOnMount:"always",refetchOnWindowFocus:!0});y.useEffect(()=>{const b=c.data;!e||!b||e.myRole===b.myRole&&e.isByMe===b.isByMe||n({...e,myRole:b.myRole,isByMe:b.isByMe,joined:b.joined})},[e,c.data,n]);const d=lt({queryKey:["notification-preferences",r],queryFn:()=>Rdr(r),enabled:!!r&&s,staleTime:6e4}),u=lt({queryKey:["member-subscription-plans",r],queryFn:()=>Mdr(r),enabled:!!r&&s,staleTime:5*6e4}),h=lt({queryKey:["my-subscription",r],queryFn:()=>Ldr(r),enabled:!!r&&s,staleTime:6e4});y.useEffect(()=>{if(!r||!s||typeof window>"u")return;const b=new URL(window.location.href);if(b.searchParams.get("stripe_checkout")!=="success")return;const x=b.searchParams.get("session_id"),w=b.searchParams.get("subscription_plan");!x||!w||i.current===x||(i.current=x,zdr(r,w,x).then(()=>{b.searchParams.delete("stripe_checkout"),b.searchParams.delete("session_id"),b.searchParams.delete("subscription_plan"),window.history.replaceState({},"",`${b.pathname}${b.search}${b.hash}`),window.location.reload()}).catch(()=>{i.current=null}))},[s,r]);const m=y.useCallback(()=>{o.refetch()},[o]),f=y.useCallback(()=>{l.refetch()},[l]),p=y.useCallback(()=>{c.refetch()},[c]),g=y.useCallback(()=>{d.refetch()},[d]),v=y.useMemo(()=>{var b;return{groups:o.data??[],groupsLoading:o.isLoading,groupsError:o.error instanceof Error?o.error:null,refetchGroups:m,counters:l.data??null,countersLoading:l.isLoading,refetchCounters:f,communityDetail:c.data??null,communityDetailLoading:c.isLoading,refetchCommunityDetail:p,notificationPreferences:d.data??null,notificationPreferencesLoading:d.isLoading,refetchNotificationPreferences:g,subscriptionPlans:u.data??[],mySubscription:((b=h.data)==null?void 0:b[0])??null,mySubscriptions:h.data??[],mySubscriptionLoading:h.isLoading}},[o.data,o.isLoading,o.error,m,l.data,l.isLoading,f,c.data,c.isLoading,p,d.data,d.isLoading,g,u.data,h.data,h.isLoading]);return a.jsx(Xjt.Provider,{value:v,children:t})}function Ln(){const t=y.useContext(Xjt);if(!t)throw new Error("useCommunityBootstrap must be used within CommunityBootstrapProvider");return t}function Xdr(t){return t.toLowerCase().replace(/&/g,"").replace(/\s+/g,"-").replace(/-+/g,"-")}function qR(t){var n,r;const e=(r=(n=t.meta)==null?void 0:n.slug)==null?void 0:r.trim();return e||Xdr(t.name)}function M1(t){return ve.group(qR(t))}function _x(t,e){const n=M1(t),r=new URLSearchParams;return r.set("section",e.id),`${n}?${r.toString()}`}function Hxe(t,e){return!!(!t.isPrivate||t.isJoined||e.myRole==="admin"||e.myRole==="moderator")}function oAe(){return a.jsx("div",{className:"flex h-[60vh] items-center justify-center text-sm text-muted-foreground",children:"Opening…"})}function eur(){const{eventId:t=""}=So(),{search:e,hash:n}=Di();return a.jsx(Gs,{to:`${ve.eventDetail(t)}${e}${n}`,replace:!0})}function EVe(){return a.jsx(Gs,{to:`${ve.settings}?tab=notifications`,replace:!0})}function tur(){var o,l;const{slug:t=""}=So(),{community:e}=qe(),{data:n,isError:r,isLoading:s}=lt({queryKey:["legacy-post-slug",e==null?void 0:e.id,t],queryFn:()=>ae.get(`/community/${encodeURIComponent(e.id)}/post/${encodeURIComponent(t)}`),enabled:!!(e!=null&&e.id&&t),retry:!1,staleTime:1/0}),i=((o=n==null?void 0:n.post)==null?void 0:o.id)||((l=n==null?void 0:n.post)==null?void 0:l._id);return i?a.jsx(Gs,{to:`/post/${i}`,replace:!0}):r||!s&&(e!=null&&e.id)&&!i?a.jsx(Gs,{to:ve.dashboard,replace:!0}):a.jsx(oAe,{})}function e2t(t,e){var o;const{groups:n}=Ln(),r=n.find(l=>{var c;return l.id===t||qR(l)===t||((c=l.meta)==null?void 0:c.slug)===t});if(!r)return{ready:n.length>0,path:null};const s=e?(o=r.tabs)==null?void 0:o.find(l=>{var c;return l.id===e||((c=l.meta)==null?void 0:c.slug)===e}):void 0,i=M1(r);return{ready:!0,path:s?`${i}?section=${encodeURIComponent(s.id)}`:i}}function NVe(){const{slug:t="",sectionSlug:e}=So(),{ready:n,path:r}=e2t(t,e??null);return r?a.jsx(Gs,{to:r,replace:!0}):n?a.jsx(Gs,{to:ve.group(t),replace:!0}):a.jsx(oAe,{})}function nur(){const{groupId:t=""}=So(),{search:e}=Di(),n=new URLSearchParams(e).get("tab"),{ready:r,path:s}=e2t(t,n);return s?a.jsx(Gs,{to:s,replace:!0}):r?a.jsx(Gs,{to:ve.exploreGroups,replace:!0}):a.jsx(oAe,{})}const t2t=y.createContext(!1);function rur(){return y.useContext(t2t)}function Zy(){const{community:t}=qe(),{communityDetail:e}=Ln(),{isAdmin:n}=X8(),r=(e==null?void 0:e.myRole)??(t==null?void 0:t.myRole),s=(e==null?void 0:e.isByMe)??(t==null?void 0:t.isByMe),i=r==="admin"||!!s;return{isCommunityAdmin:i,isAdminView:i&&n}}function SN(){const{community:t}=qe(),e=(t==null?void 0:t.id)??null,{data:n,isLoading:r}=lt({queryKey:["community-pac",e],enabled:!!e,staleTime:6e4,queryFn:()=>xnn(e)});return{pac:(n==null?void 0:n.pac)??null,isLoading:r}}function l0(t,e){return!e||!t?!1:t[e]===!1}const KR=t=>encodeURIComponent(t),cq=20;function sur(t){var n,r,s,i;const e=new URLSearchParams({page:String(t.page??1),limit:String(t.limit??cq)});return t.duration&&t.duration!=="all"&&e.set("duration",t.duration),(n=t.from)!=null&&n.trim()&&e.set("from",t.from.trim()),(r=t.to)!=null&&r.trim()&&e.set("to",t.to.trim()),(s=t.groupId)!=null&&s.trim()&&e.set("groupId",t.groupId.trim()),(i=t.search)!=null&&i.trim()&&e.set("search",t.search.trim()),e}async function n2t(t,e={}){const n=await ae.get(`/leaderboard/community/${KR(t)}/paginated?${sur(e).toString()}`);return{entries:Array.isArray(n==null?void 0:n.activities)?n.activities:[],page:Number(n==null?void 0:n.page)||(e.page??1)}}async function iur(t,e={}){var s,i;const n=new URLSearchParams;e.duration&&e.duration!=="all"&&n.set("duration",e.duration),(s=e.from)!=null&&s.trim()&&n.set("from",e.from.trim()),(i=e.to)!=null&&i.trim()&&n.set("to",e.to.trim());const r=n.toString();return ae.get(`/leaderboard/community/${KR(t)}/my${r?`?${r}`:""}`)}async function aur(t,e,n,r){const s={points:n};return r!=null&&r.trim()&&(s.groupId=r.trim()),ae.post(`/leaderboard/community/${KR(t)}/user/${KR(e)}/add-custom-point`,s)}async function our(t){return(await ae.get(`/community/${KR(t)}/karma-points`)).karmaPoints??[]}async function lur(t,e){return(await ae.post(`/community/${KR(t)}/karma-points`,{karmaPoints:e})).karmaPoints??[]}function nse(t={}){const{community:e}=qe(),n=(e==null?void 0:e.id)??null,r=lt({queryKey:["leaderboard-my",n,t.duration,t.from,t.to],queryFn:()=>iur(n,t),enabled:!!n,staleTime:15e3});return{myScore:r.data??null,isLoading:r.isLoading}}function cur(t){const e=(t==null?void 0:t.trim())||"";return!e||e.includes("/")||e.includes(" ")||e.length>4?"":e.toUpperCase()}function Jd({src:t,name:e,className:n}){const[r,s]=y.useState(!1);y.useEffect(()=>s(!1),[t]);const i=!r&&RE(t||"")?t.trim():"",o=e!=null&&e.trim()?Gsn(e):"",l=o&&o!=="?"?o:cur(t)||o||"?";return i?a.jsx("img",{src:i,alt:e||"",onError:()=>s(!0),className:ee("rounded-full object-cover",n)}):a.jsx("div",{className:ee("flex items-center justify-center rounded-full bg-primary/10 font-semibold text-primary",n),"aria-label":e||l,children:l})}const dur=new Set(["post-like","post-create","post-comment","comment-reply","comment-reaction","reply-reaction","mention","post-impressions"]);function r2t(t){return dur.has(t??"")}function lAe(t,e){var r,s,i,o,l,c,d,u,h,m;const n=t.type??"";if(n==="member-field-import")return`${ve.settings}?tab=member-fields`;if(n==="subscription-purchase"){const f=(r=t.subscriptionPlan)==null?void 0:r.id;return`${ve.communityMembers}?tab=subscriptions${f?`&plan=${encodeURIComponent(f)}`:""}`}if((n==="follow"||n==="group:user-joined")&&((s=t.from)!=null&&s.id))return ve.member(t.from.id);if((n==="group:user-requested"||n==="group:user-joined"||n==="group:request-accepted")&&((i=t.group)!=null&&i.id)){const f=e.find(p=>p.id===t.group.id);return f?ve.group(qR(f)):null}if((n==="section:message"||n==="section:message-mention")&&((o=t.group)!=null&&o.id)){const f=e.find(g=>g.id===t.group.id);if(!f)return null;const p=ve.group(qR(f));return(l=t.tab)!=null&&l.id?`${p}?section=${encodeURIComponent(t.tab.id)}`:p}return n==="post-impressions"&&((c=t.post)!=null&&c.id)?`${ve.post(t.post.id)}?analytics=1`:(d=t.post)!=null&&d.id?ve.post(t.post.id):(u=t.knowledgeHubResource)!=null&&u.id?`${ve.knowledgeHub}?resource=${encodeURIComponent(t.knowledgeHubResource.id)}`:(h=t.course)!=null&&h.id?ve.knowledgeCourse(t.course.id):(m=t.event)!=null&&m.id?ve.eventDetail(t.event.id):null}function s2t(t,...e){const n=t.trim().toLowerCase().split(/\s+/).filter(Boolean);if(n.length===0)return!0;const r=e.filter(Boolean).join(" ").toLowerCase();return n.every(s=>r.includes(s))}const TVe=5e3,jT=new Map;function _Ve(t,e){t.setQueryData(["notifications"],n=>{if(!n||n.some(s=>s.id===e.id))return n;const r=s=>new Date(s.createdAt).getTime()||0;return[...n,e].sort((s,i)=>r(i)-r(s))})}function i2t(t){const e=rn(),n=lt({queryKey:["notifications"],queryFn:async()=>(await Ndr()).filter(o=>!jT.has(o.id)),enabled:t,staleTime:3e4}),r=y.useCallback(async o=>{var d;const l=u=>e.setQueryData(["notifications"],h=>h==null?void 0:h.map(m=>m.id===o?{...m,isViewed:u}:m)),c=(d=e.getQueryData(["notifications"]))==null?void 0:d.find(u=>u.id===o);if(!(c!=null&&c.isViewed)){l(!0);try{await Tdr(o)}catch{l(!1)}}},[e]),s=y.useCallback(async()=>{await Adr(),await e.invalidateQueries({queryKey:["notifications"]})},[e]),i=y.useCallback(o=>{var u;const l=(u=e.getQueryData(["notifications"]))==null?void 0:u.find(h=>h.id===o);if(!l||jT.has(o))return;e.setQueryData(["notifications"],h=>h==null?void 0:h.filter(m=>m.id!==o));const c=async()=>{jT.delete(o);try{await _dr(o),e.invalidateQueries({queryKey:["user-counters"]})}catch(h){_Ve(e,l),wK({title:"Couldn't delete this notification",description:dn(h,"It's back in your list. Please try again."),variant:"destructive"})}};jT.set(o,setTimeout(()=>void c(),TVe));const d=()=>{const h=jT.get(o);h!==void 0&&(clearTimeout(h),jT.delete(o),_Ve(e,l))};wK({title:"Notification deleted",duration:TVe,showProgress:!0,action:a.jsx(Wst,{altText:"Undo deleting the notification",onClick:d,children:"Undo"})})},[e]);return{notifications:n.data??[],isLoading:n.isLoading,markRead:r,markAllRead:s,remove:i}}function a2t({notification:t}){var n,r;if(t.type==="post-impressions"&&typeof t.impressionCount=="number"){const s=t.impressionCount;return a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-foreground/90",children:"Your post got "}),a.jsxs("span",{className:"font-semibold text-foreground",children:[s.toLocaleString("en-US")," impression",s===1?"":"s"]}),a.jsx("span",{className:"text-foreground/90",children:". View your analytics."})]})}const e=(r=(n=t.from)==null?void 0:n.name)==null?void 0:r.trim();return e&&t.title.startsWith(e)?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"font-semibold text-foreground",children:e}),a.jsx("span",{className:"text-foreground/90",children:t.title.slice(e.length)})]}):a.jsx("span",{className:"text-foreground",children:t.title})}const rse=10080;function uur(t){const e=Math.max(0,Math.round(t??0));if(!e)return"";if(e<60)return`${e} min`;const n=Math.floor(e/60),r=e%60;return r?`${n}h ${r}m`:`${n}h`}function lk(t){return uur(t)||"0 min"}function PZ(t){return t.durationMinutes&&t.durationMinutes>0?t.durationMinutes:t.autoDurationMinutes??0}function j$(t){const e=Number.parseInt(t,10);return!Number.isFinite(e)||e<0?0:Math.min(e,rse)}function J6(t){return(t??"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/<[^>]+>/g," ").replace(/[#>*_~`]+/g,"").replace(/^\s*[-+]\s+/gm,"").replace(/\s+/g," ").trim()}function yc(t){if(!t)return"";const e=new Date(t).getTime();if(Number.isNaN(e))return"";const n=Date.now()-e,r=Math.floor(n/1e3);if(r<45)return"Just now";const s=Math.floor(r/60);if(s<60)return`${s}m ago`;const i=Math.floor(s/60);if(i<24)return`${i}h ago`;const o=Math.floor(i/24);if(o<7)return`${o}d ago`;const l=Math.floor(o/7);return l<5?`${l}w ago`:new Date(e).toLocaleDateString(void 0,{month:"short",day:"numeric",year:new Date(e).getFullYear()===new Date().getFullYear()?void 0:"numeric"})}const AVe=[{key:"all",label:"All"},{key:"unread",label:"Unread"},{key:"mentions",label:"Mentions",empty:"No mentions yet."},{key:"comments",label:"Comments",empty:"No comments or replies yet."},{key:"posts",label:"Posts",empty:"No post notifications yet."},{key:"follows",label:"Follows",empty:"No new followers yet."}],hur=new Set(["post-comment","comment-reply"]),mur=new Set(["post-create","post-like","post-impressions"]);function o2t(t){return t.type==="post-impressions"}function fur(t){return/mention|tag/i.test(t.type??"")}const pur={mentions:fur,comments:t=>hur.has(t.type??""),posts:t=>mur.has(t.type??""),follows:t=>t.type==="follow"};function gur({notification:t}){var i,o;if(!((i=t.post)!=null&&i.id))return null;const e=J6(t.activityText),n=((o=t.post.title)==null?void 0:o.trim())||J6(t.post.description);if(o2t(t))return n?a.jsx("div",{className:"mt-1.5 rounded-md border border-border bg-muted/40 px-2.5 py-1.5",children:a.jsx("p",{className:"line-clamp-2 break-words text-xs text-muted-foreground [overflow-wrap:anywhere]",children:n})}):null;const r=t.post.likeCount??0,s=t.post.commentCount??0;return a.jsxs(a.Fragment,{children:[e&&a.jsx("p",{className:"mt-1 line-clamp-2 break-words border-l-2 border-border pl-2 text-xs text-foreground/80",children:e}),a.jsxs("p",{className:"mt-1 flex min-w-0 items-center gap-2 text-xs text-muted-foreground",children:[n&&a.jsx("span",{className:"min-w-0 truncate",children:n}),a.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",title:`${r} like${r===1?"":"s"}`,children:[a.jsx($8,{className:"h-3 w-3","aria-hidden":!0})," ",r,a.jsxs("span",{className:"sr-only",children:["like",r===1?"":"s"]})]}),a.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1",title:`${s} comment${s===1?"":"s"}`,children:[a.jsx(Vi,{className:"h-3 w-3","aria-hidden":!0})," ",s,a.jsxs("span",{className:"sr-only",children:["comment",s===1?"":"s"]})]})]})]})}function l2t({notifications:t,variant:e,onItemClick:n,onMarkAllRead:r,onOpenFull:s,onDelete:i,onMarkRead:o}){var x;const c=v7()?{initial:!1,exit:{opacity:0},transition:{duration:0}}:{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},transition:{duration:.2,ease:"easeOut"}},[d,u]=y.useState("all"),h=y.useRef(new Set),m=w=>{h.current=new Set,u(w)},f=w=>{d==="unread"&&h.current.add(w.id),n(w)},p=y.useMemo(()=>t.filter(w=>!w.isViewed).length,[t]),g=y.useMemo(()=>{const w=pur[d];return w?t.filter(w):d==="unread"?t.filter(k=>!k.isViewed||h.current.has(k.id)):t},[t,d]),v=p>0,b=e==="page";return a.jsxs("div",{className:ee("flex flex-col",b?"max-w-3xl mx-auto":""),children:[a.jsxs("div",{className:ee("flex items-center justify-between px-4",b?"pt-1 pb-3":"pt-4 pb-2"),children:[a.jsx("h2",{className:ee("font-bold text-foreground",b?"text-2xl":"text-lg"),children:"Notifications"}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",title:"Mark all as read",disabled:!v,onClick:r,className:"h-8 w-8 rounded-md flex items-center justify-center text-muted-foreground hover:bg-muted hover:text-foreground transition-colors disabled:opacity-40",children:a.jsx(lee,{className:"h-[18px] w-[18px]"})}),s&&a.jsx("button",{type:"button",title:"Open in full page",onClick:s,className:"h-8 w-8 rounded-md flex items-center justify-center text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",children:a.jsx(bo,{className:"h-[18px] w-[18px]"})})]})]}),a.jsx("div",{className:"flex items-center gap-5 overflow-x-auto overscroll-x-contain px-4 border-b border-border [scrollbar-width:none] [&::-webkit-scrollbar]:hidden",children:AVe.map(w=>a.jsxs("button",{type:"button",onClick:()=>m(w.key),className:ee("relative flex shrink-0 items-center gap-1.5 whitespace-nowrap pb-2.5 text-sm font-medium transition-colors",d===w.key?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[w.label,w.key==="unread"&&p>0&&a.jsx("span",{className:"rounded-full bg-muted px-1.5 py-0.5 text-[11px] font-semibold text-foreground",children:p}),d===w.key&&a.jsx("span",{className:"absolute bottom-0 left-0 right-0 h-0.5 rounded-full bg-foreground"})]},w.key))}),a.jsx("div",{className:ee("overflow-y-auto",b?"":"max-h-[28rem]"),children:g.length===0?a.jsx("p",{className:"px-4 py-12 text-center text-sm text-muted-foreground",children:((x=AVe.find(w=>w.key===d))==null?void 0:x.empty)??(d==="unread"&&t.length>0?"You're all caught up. Opened notifications are under All.":"No notifications yet.")}):a.jsx(Al,{initial:!1,children:g.map(w=>{var C,j,E,N,A;const k=!w.isViewed,S=o7((C=w.from)==null?void 0:C.picture,(j=w.from)==null?void 0:j.name);return a.jsxs(it.div,{...c,className:"group relative overflow-hidden border-b border-border last:border-0",children:[a.jsxs("button",{type:"button",onClick:()=>f(w),className:ee("w-full text-left flex items-center gap-3 px-4 py-3.5 hover:bg-muted/40 transition-colors",i&&"pr-12"),children:[o2t(w)?a.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-md bg-primary/10 text-primary","aria-hidden":!0,children:a.jsx(Fc,{className:"h-5 w-5"})}):a.jsxs(oo,{className:"h-10 w-10 shrink-0",children:[a.jsx(lo,{src:S,alt:((E=w.from)==null?void 0:E.name)||""}),a.jsx(co,{children:(A=(((N=w.from)==null?void 0:N.name)||"?")[0])==null?void 0:A.toUpperCase()})]}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"text-sm leading-snug line-clamp-2",children:a.jsx(a2t,{notification:w})}),w.description&&a.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1 mt-0.5",children:w.description}),a.jsx(gur,{notification:w}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:yc(w.createdAt)})]}),k&&a.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-primary shrink-0","aria-label":"Unread"})]}),i&&a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx("button",{type:"button",title:"More options","aria-label":"Notification options",className:"absolute right-2 top-1/2 flex h-8 w-8 -translate-y-1/2 items-center justify-center rounded-md text-muted-foreground transition-opacity hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring data-[state=open]:bg-muted [@media(hover:none)]:h-10 [@media(hover:none)]:w-10 [@media(hover:hover)]:opacity-0 [@media(hover:hover)]:group-hover:opacity-100 [@media(hover:hover)]:focus-visible:opacity-100 [@media(hover:hover)]:data-[state=open]:opacity-100",children:a.jsx(Ys,{className:"h-4 w-4","aria-hidden":!0})})}),a.jsxs(Cr,{align:"end",className:"z-[60] w-52 border border-border bg-popover shadow-lg",children:[k&&o&&a.jsxs(ot,{onClick:()=>o(w),children:[a.jsx(zx,{className:"mr-2 h-4 w-4","aria-hidden":!0})," Mark as read"]}),a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>i(w),children:[a.jsx(qn,{className:"mr-2 h-4 w-4","aria-hidden":!0})," Delete notification"]})]})]})]},w.id)})},d)})]})}const c2t="COMMUNITY_SHOW_ONBOARDING_LIST";async function vur(t){const{onboardingChecklist:e}=await ae.get(`/community/${encodeURIComponent(t)}/onboarding-list-config`);return e}async function Gxe(t,e){const{onboardingChecklist:n}=await ae.post(`/community/${encodeURIComponent(t)}/onboarding-list-config`,{onboardingChecklist:e});return n}async function yur(t){const{configurable:e}=await ae.get(`/community/${encodeURIComponent(t)}/configurable/${c2t}`);return e.configurableValue===!0||e.configurableValue==="true"}async function bur(t,e){await ae.post(`/community/${encodeURIComponent(t)}/configurable/${c2t}`,{configurableValue:e})}const d2t=t=>t!=null&&t.trim()?`&search=${encodeURIComponent(t.trim())}`:"";async function Wxe(t,e){const{users:n}=await ae.get(`/chats/direct?communityId=${encodeURIComponent(t)}${d2t(e)}`);return Array.isArray(n)?n:[]}async function qxe(t,e){const{users:n}=await ae.get(`/chats/direct/requests?communityId=${encodeURIComponent(t)}${d2t(e)}`);return Array.isArray(n)?n:[]}async function xur(t,e){await ae.post(`/chats/direct/requests/${encodeURIComponent(t)}/accept`,{communityId:e})}async function wur(t,e){await ae.post(`/chats/direct/requests/${encodeURIComponent(t)}/reject`,{communityId:e})}async function Kxe(t,e,n){const r=new URLSearchParams({communityId:e});n&&r.set("lastId",n);const{otherUser:s,messages:i,requestState:o}=await ae.get(`/chats/direct/${encodeURIComponent(t)}?${r.toString()}`);return{otherUser:s,messages:[...i??[]].reverse(),requestState:o}}async function cAe(t,e,n,r){return(await ae.post(`/chats/direct/${encodeURIComponent(t)}/send-message`,{message:e,communityId:n,...r?{clientNonce:r}:{}})).message}async function kur(t,e,n){return(await ae.post(`/chats/direct/edit-message/${encodeURIComponent(t)}`,{message:e,communityId:n})).message}async function u2t(t,e){const{forEveryone:n=!0,communityId:r}=e,s=new URLSearchParams({forEveryone:String(n),communityId:r});await ae.delete(`/chats/direct/delete-message/${encodeURIComponent(t)}?${s.toString()}`)}async function Sur(t,e){const n=new URLSearchParams({communityId:e});await ae.delete(`/chats/direct/${encodeURIComponent(t)}?${n.toString()}`)}async function Cur(t,e,n){const{settings:r}=await ae.patch(`/chats/direct/${encodeURIComponent(t)}/settings`,{communityId:e,...n});return r}async function Yxe(t,e){await ae.post(`/chats/direct/${encodeURIComponent(t)}/mark-all-read`,{communityId:e})}async function jur(t,e,n,r,s){const i=new FormData;i.append("communityId",n);for(const l of e)i.append("attachments",l);return r&&i.append("clientNonce",r),s&&i.append("message",s),(await Ea(`/chats/direct/${encodeURIComponent(t)}/upload-attachment`,i)).message}async function h2t(t,e,n){return(await ae.post(`/chats/direct/react-message/${encodeURIComponent(t)}`,{emoji:e,communityId:n})).message}async function Eur(t,e){const n=await ae.get(`/chats/direct/thread/${encodeURIComponent(t)}?communityId=${encodeURIComponent(e)}`);return{parent:n.parent,replies:Array.isArray(n.replies)?n.replies:[]}}async function Nur(t,e,n){return(await ae.post(`/chats/direct/reply-message/${encodeURIComponent(t)}`,{message:e,communityId:n})).reply}async function m2t(t,e){return(await ae.post(`/chats/direct/unreact-message/${encodeURIComponent(t)}`,{communityId:e})).message}async function RZ(t,e){const n=new URLSearchParams;t&&n.set("communityId",t),e!=null&&e.trim()&&n.set("search",e.trim());const r=n.toString(),s=r?`?${r}`:"",{conversations:i}=await ae.get(`/conversations${s}`);return Array.isArray(i)?i:[]}async function Tur(t){const{conversation:e}=await ae.post("/conversations",t);return e}async function _3(t,e){const{conversation:n}=await ae.patch(`/conversations/${encodeURIComponent(t)}`,e);return n}async function _ur(t,e){const n=new FormData;n.append("avatar",e,e.name);const{conversation:r}=await Ea(`/conversations/${encodeURIComponent(t)}/avatar`,n);return r}async function Aur(t){await ae.post(`/conversations/${encodeURIComponent(t)}/leave`,{})}async function PVe(t,e){const n=e?`?lastId=${encodeURIComponent(e)}`:"",{messages:r}=await ae.get(`/conversations/${encodeURIComponent(t)}/messages${n}`);return[...r??[]].reverse()}async function f2t(t,e,n){return(await ae.post(`/conversations/${encodeURIComponent(t)}/messages`,{message:e,...n?{clientNonce:n}:{}})).message}async function Pur(t,e,n){return(await ae.post(`/conversations/${encodeURIComponent(t)}/messages/${encodeURIComponent(e)}`,{message:n})).message}async function p2t(t,e){await ae.delete(`/conversations/${encodeURIComponent(t)}/messages/${encodeURIComponent(e)}`)}async function Rur(t,e){const{settings:n}=await ae.patch(`/conversations/${encodeURIComponent(t)}/settings`,e);return n}async function Qxe(t){await ae.post(`/conversations/${encodeURIComponent(t)}/read`,{})}async function Iur(t,e,n,r){const s=new FormData;for(const o of e)s.append("attachments",o);return n&&s.append("clientNonce",n),r&&s.append("message",r),(await Ea(`/conversations/${encodeURIComponent(t)}/upload-attachment`,s)).message}async function g2t(t,e,n){return(await ae.post(`/conversations/${encodeURIComponent(t)}/messages/${encodeURIComponent(e)}/react`,{emoji:n})).message}async function Mur(t,e){const n=await ae.get(`/conversations/${encodeURIComponent(t)}/messages/${encodeURIComponent(e)}/replies`);return{parent:n.parent,replies:Array.isArray(n.replies)?n.replies:[]}}async function Lur(t,e,n){return(await ae.post(`/conversations/${encodeURIComponent(t)}/messages/${encodeURIComponent(e)}/replies`,{message:n})).reply}async function v2t(t,e){return(await ae.post(`/conversations/${encodeURIComponent(t)}/messages/${encodeURIComponent(e)}/unreact`,{})).message}const dAe=250,y2t=`A group can have up to ${dAe} people, including you.`;function YR(t,e){if(t.name&&t.name.trim())return t.name.trim();const n=(t.participants??[]).filter(o=>o.id!==e);if(n.length===0)return"Group";const r=n.map(o=>{var l;return((l=o.name)==null?void 0:l.split(" ")[0])||o.name||"Someone"}),s=r.slice(0,2).join(", "),i=r.length-2;return i>0?`${s} +${i}`:s}const A3=t=>t?new Date(t).getTime():0;function b2t(t){var e;return{id:t.id,type:"dm",name:t.name,picture:t.picture??null,preview:(e=t.lastMessage)!=null&&e.trim()?e2(t.lastMessage):t.userId?`@${t.userId}`:"",unreadCount:t.unreadMessageCount,unread:t.unreadMessageCount>0||!!t.isMarkedUnread,searchNames:[t.name],chat:t}}function Dur(t,e){var o,l,c,d,u,h,m;const n=t.lastMessage;if(!n)return`${((o=t.participants)==null?void 0:o.length)??0} members`;const r=(l=n.message)!=null&&l.trim()?e2(n.message):(c=n.attachments)!=null&&c.length?"Attachment":"";if(!r)return`${((d=t.participants)==null?void 0:d.length)??0} members`;const s=(u=n.sender)==null?void 0:u.id,i=s&&s===e?"You":(m=(h=n.sender)==null?void 0:h.name)==null?void 0:m.split(" ")[0];return i?`${i}: ${r}`:r}function $ur(t,e,n){return[...t.filter(s=>!s.isArchived).map(s=>({row:b2t(s),pinnedAt:s.isPinned?A3(s.pinnedAt)||1:0,sortAt:A3(s.lastMessageAt)})),...e.filter(s=>!s.isArchived).map(s=>({row:{id:s.id,type:"group",name:YR(s,n),picture:s.avatar??null,preview:Dur(s,n),unreadCount:s.unreadCount??0,unread:(s.unreadCount??0)>0||!!s.isMarkedUnread,searchNames:[YR(s,n),...(s.participants??[]).filter(i=>i.id!==n).map(i=>i.name)]},pinnedAt:s.isPinned?A3(s.pinnedAt)||1:0,sortAt:A3(s.lastMessageAt)||A3(s.createdAt)}))].sort((s,i)=>i.pinnedAt-s.pinnedAt||i.sortAt-s.sortAt).map(s=>s.row)}function uAe({hint:t,children:e,side:n="top"}){return a.jsx(GSe,{children:a.jsxs(Nit,{delayDuration:200,children:[a.jsx(Tit,{asChild:!0,children:e}),a.jsx(jit,{children:a.jsx(WSe,{side:n,collisionPadding:12,className:"max-w-[260px] text-xs font-normal leading-relaxed",children:t})})]})})}function gn({label:t,children:e,side:n="top",className:r}){const[s,i]=y.useState(!1),o=Tn();return a.jsx(GSe,{children:a.jsxs(Nit,{open:s,onOpenChange:i,delayDuration:200,children:[a.jsx(Tit,{asChild:!0,children:a.jsx("button",{type:"button","aria-label":pn(o("About {label}"),{label:t}),onClick:()=>i(l=>!l),className:ee("inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-full align-middle text-muted-foreground/70 transition-colors hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40",r),children:a.jsx(nS,{className:"h-3.5 w-3.5","aria-hidden":"true"})})}),a.jsx(jit,{children:a.jsx(WSe,{side:n,collisionPadding:12,className:"z-[1000] max-w-[260px] text-xs font-normal leading-relaxed",children:e})})]})})}function X6({htmlFor:t,label:e,children:n,className:r}){return a.jsxs("div",{className:ee("flex items-center gap-1.5",r),children:[a.jsx("label",{htmlFor:t,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:e}),a.jsx(gn,{label:e,children:n})]})}function hAe(t){return{message:t.message,group:t.groups??t.group}}async function Our(t,e){const n=await ae.get(`/community/${encodeURIComponent(t)}/groups/${encodeURIComponent(e)}`);return hAe(n)}async function mAe(t){const e=await ae.get(`/group/${encodeURIComponent(t)}`);return hAe(e)}async function Fur(t,e,n=1,r,s){const i=new URLSearchParams;i.set("page",String(n)),r&&i.set("sort",r);const o=i.toString();return ae.get(`/group/${encodeURIComponent(t)}/section/${encodeURIComponent(e)}/posts${o?`?${o}`:""}`)}async function Bur(t,e){return ae.get(`/group/${encodeURIComponent(t)}/section/${encodeURIComponent(e)}/posts/pinned`)}async function Uur(t){return ae.get(`/group/${encodeURIComponent(t)}/trending-posts`)}async function zur(t,e={}){var r;const n=new URLSearchParams;return n.set("page",String(e.page??1)),e.limit&&n.set("limit",String(e.limit)),(r=e.query)!=null&&r.trim()&&n.set("query",e.query.trim()),e.tabId&&n.set("tabId",e.tabId),ae.get(`/group/${encodeURIComponent(t)}/members/paginated?${n.toString()}`)}async function Vur(t){return ae.post(`/group/${encodeURIComponent(t)}/accept-invite`,{})}async function Hur(t){return ae.post(`/group/${encodeURIComponent(t)}/reject-invite`,{})}async function x2t(t,e,n){return ae.post(`/group/${encodeURIComponent(t)}/members/${encodeURIComponent(e)}/update-role`,{role:n})}async function w2t(t){return ae.post(`/group/${encodeURIComponent(t)}/join`,{})}async function Gur(t){return ae.post(`/group/${encodeURIComponent(t)}/leave`,{})}async function Wur(t,e){return ae.post(`/group/${encodeURIComponent(t)}/join-request/${encodeURIComponent(e)}/accept`,{})}async function qur(t,e){return ae.post(`/group/${encodeURIComponent(t)}/join-request/${encodeURIComponent(e)}/reject`,{})}async function Kur(t,e){return ae.post(`/group/${encodeURIComponent(t)}/remove-user/${encodeURIComponent(e)}`,{})}async function Yur(t){return ae.post(`/group/${encodeURIComponent(t)}/cancel-join-request`,{})}async function Qur(t,e){return ae.post(`/group/${encodeURIComponent(t)}/section/${encodeURIComponent(e)}/join`,{})}async function Zur(t,e,n){return ae.post(`/group/${encodeURIComponent(t)}/section/${encodeURIComponent(e)}/join-request/${encodeURIComponent(n)}/accept`,{})}async function Jur(t,e,n){return ae.post(`/group/${encodeURIComponent(t)}/section/${encodeURIComponent(e)}/join-request/${encodeURIComponent(n)}/reject`,{})}async function Xur(t,e){return ae.post(`/group/${encodeURIComponent(t)}/tab`,e)}async function ehr(t,e,n){return ae.post(`/group/${encodeURIComponent(t)}/tab/${encodeURIComponent(e)}`,n)}async function thr(t,e){return ae.delete(`/group/${encodeURIComponent(t)}/tab/${encodeURIComponent(e)}`)}async function nhr(t,e){return ae.post(`/group/${encodeURIComponent(t)}`,e)}async function rhr(t,e){const n=new FormData;return n.append("banner",e),Ea(`/group/${encodeURIComponent(t)}/banner`,n)}async function shr(t,e){const n=new FormData;return n.append("icon",e),Ea(`/group/${encodeURIComponent(t)}/icon`,n)}async function ihr(t){return ae.delete(`/group/${encodeURIComponent(t)}/icon`)}async function ahr(t){return ae.delete(`/group/${encodeURIComponent(t)}`)}async function ohr(t){const e=await ae.post("/group",t);return hAe(e)}async function lhr(t,e){return ae.post(`/community/${encodeURIComponent(t)}/groups/sort`,{sortOrder:e})}async function chr(t,e,n){return ae.post(`/community/${encodeURIComponent(t)}/group/${encodeURIComponent(e)}/sort`,{sortOrder:n})}async function dhr(t,e,n={}){var s;const r=new URLSearchParams;return r.set("page",String(n.page??1)),n.limit&&r.set("limit",String(n.limit)),(s=n.query)!=null&&s.trim()&&r.set("search",n.query.trim()),ae.get(`/group/${encodeURIComponent(t)}/closed-tab/${encodeURIComponent(e)}/members/paginated?${r.toString()}`)}function Mu(t){return!!(t.myRole||t.joinStatus==="joined")}function sse(t){return t.myRole==="admin"}function ise(t){return t.myRole==="admin"||t.myRole==="moderator"}function WB(t){return t.joinStatus==="requested"||t.joinStatus==="pending"}function fAe(t){return t.joinStatus==="invited"}function pAe(t){return t.joinStatus==="declined"||t.joinStatus==="rejected"}function uhr(t){return t.groupType==="closed-free"||t.groupType==="closed-paid"}function hhr(t){return t.groupType==="closed-paid"}function mhr(t){return uhr(t)&&!Mu(t)}function k2t(t,e={}){return Mu(t)?"leave":fAe(t)?"accept":WB(t)||pAe(t)?"none":t.groupType==="closed-paid"||t.groupType==="closed-free"&&e.requiresPaidMembership?"buy":t.groupType==="closed-free"?"request":"join"}function S2t(t,e={}){return Mu(t)?"Joined":fAe(t)?"Accept invitation":WB(t)?"Requested":pAe(t)?"Request declined":t.groupType==="closed-paid"||t.groupType==="closed-free"&&e.requiresPaidMembership?"Buy access":t.groupType==="closed-free"?"Request access":"Join group"}function fhr(t,e){if(!t||t<=0)return null;const n=(e||"INR").toUpperCase(),r=t/100;try{return new Intl.NumberFormat(void 0,{style:"currency",currency:n,maximumFractionDigits:r%1===0?0:2}).format(r)}catch{return`${n} ${r}`}}function CN(t){switch(t){case"closed-free":return"Closed";case"closed-paid":return"Paid";case"personal":return"Personal";case"open":default:return"Open"}}const phr=!0;function Mf(t){return(t.sectionType??"generic")==="realtime"}function gAe(t,e){const n=t.myRole==="admin"||t.myRole==="moderator"||t.myRole==="user"||t.joinStatus==="joined";return!(t.groupType!=="open"&&!n||e.isClosed&&!e.isJoined&&t.myRole!=="admin"&&t.myRole!=="moderator")}function ghr(t,e){return gAe(t,e)?"viewable":(t.myRole==="admin"||t.myRole==="moderator"||t.myRole==="user"||t.joinStatus==="joined")&&e.isClosed?e.isPrivate?"private":e.status==="requested"?"requested":"request":"group-locked"}function qB(t){return(t.tabs??[]).filter(e=>Hxe(e,t))}function vAe(t,e){return[...qB(t).filter(s=>e==="realtime"?Mf(s):!Mf(s))].sort((s,i)=>(s.sortOrder??0)-(i.sortOrder??0))}function IZ(t){return vAe(t,"generic")}function C2t(t){return vAe(t,"realtime")}function RVe(t,e){if(!e)return null;const n=t.tabs??[];return n.find(r=>r.id===e)??n.find(r=>{var s;return((s=r.meta)==null?void 0:s.slug)&&r.meta.slug===e})??n.find(r=>r.name&&r.name.toLowerCase().replace(/\s+/g,"-")===e.toLowerCase())??null}function j2t(t){return qB(t).sort((n,r)=>(n.sortOrder??0)-(r.sortOrder??0))[0]??null}function IVe(t,e){return vAe(t,e)[0]??null}function vhr(t){return Mf(t)?"chat":"discussions"}function yhr(t,e){return e==="chat"?IVe(t,"realtime"):IVe(t,"generic")}var ase="Switch",[bhr,gjs]=il(ase),[xhr,whr]=bhr(ase),E2t=y.forwardRef((t,e)=>{const{__scopeSwitch:n,name:r,checked:s,defaultChecked:i,required:o,disabled:l,value:c="on",onCheckedChange:d,form:u,...h}=t,[m,f]=y.useState(null),p=Sr(e,w=>f(w)),g=y.useRef(!1),v=m?u||!!m.closest("form"):!0,[b,x]=Sd({prop:s,defaultProp:i??!1,onChange:d,caller:ase});return a.jsxs(xhr,{scope:n,checked:b,disabled:l,children:[a.jsx(Sn.button,{type:"button",role:"switch","aria-checked":b,"aria-required":o,"data-state":A2t(b),"data-disabled":l?"":void 0,disabled:l,value:c,...h,ref:p,onClick:Kt(t.onClick,w=>{x(k=>!k),v&&(g.current=w.isPropagationStopped(),g.current||w.stopPropagation())})}),v&&a.jsx(_2t,{control:m,bubbles:!g.current,name:r,value:c,checked:b,required:o,disabled:l,form:u,style:{transform:"translateX(-100%)"}})]})});E2t.displayName=ase;var N2t="SwitchThumb",T2t=y.forwardRef((t,e)=>{const{__scopeSwitch:n,...r}=t,s=whr(N2t,n);return a.jsx(Sn.span,{"data-state":A2t(s.checked),"data-disabled":s.disabled?"":void 0,...r,ref:e})});T2t.displayName=N2t;var khr="SwitchBubbleInput",_2t=y.forwardRef(({__scopeSwitch:t,control:e,checked:n,bubbles:r=!0,...s},i)=>{const o=y.useRef(null),l=Sr(o,i),c=i7(n),d=z8(e);return y.useEffect(()=>{const u=o.current;if(!u)return;const h=window.HTMLInputElement.prototype,f=Object.getOwnPropertyDescriptor(h,"checked").set;if(c!==n&&f){const p=new Event("click",{bubbles:r});f.call(u,n),u.dispatchEvent(p)}},[c,n,r]),a.jsx("input",{type:"checkbox","aria-hidden":!0,defaultChecked:n,...s,tabIndex:-1,ref:l,style:{...s.style,...d,position:"absolute",pointerEvents:"none",opacity:0,margin:0}})});_2t.displayName=khr;function A2t(t){return t?"checked":"unchecked"}var P2t=E2t,Shr=T2t;const Hs=y.forwardRef(({className:t,...e},n)=>a.jsx(P2t,{className:ee("peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50",t),...e,ref:n,children:a.jsx(Shr,{className:ee("pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0")})}));Hs.displayName=P2t.displayName;function eF(t,[e,n]){return Math.min(n,Math.max(e,t))}var Chr=[" ","Enter","ArrowUp","ArrowDown"],jhr=[" ","Enter"],W2="Select",[ose,lse,Ehr]=lI(W2),[_M,vjs]=il(W2,[Ehr,sS]),cse=sS(),[Nhr,_S]=_M(W2),[Thr,_hr]=_M(W2),R2t=t=>{const{__scopeSelect:e,children:n,open:r,defaultOpen:s,onOpenChange:i,value:o,defaultValue:l,onValueChange:c,dir:d,name:u,autoComplete:h,disabled:m,required:f,form:p}=t,g=cse(e),[v,b]=y.useState(null),[x,w]=y.useState(null),[k,S]=y.useState(!1),C=ES(d),[j,E]=Sd({prop:r,defaultProp:s??!1,onChange:i,caller:W2}),[N,A]=Sd({prop:o,defaultProp:l,onChange:c,caller:W2}),_=y.useRef(null),T=v?p||!!v.closest("form"):!0,[R,O]=y.useState(new Set),F=Array.from(R).map(D=>D.props.value).join(";");return a.jsx(V8,{...g,children:a.jsxs(Nhr,{required:f,scope:e,trigger:v,onTriggerChange:b,valueNode:x,onValueNodeChange:w,valueNodeHasChildren:k,onValueNodeHasChildrenChange:S,contentId:el(),value:N,onValueChange:A,open:j,onOpenChange:E,dir:C,triggerPointerDownPosRef:_,disabled:m,children:[a.jsx(ose.Provider,{scope:e,children:a.jsx(Thr,{scope:t.__scopeSelect,onNativeOptionAdd:y.useCallback(D=>{O(I=>new Set(I).add(D))},[]),onNativeOptionRemove:y.useCallback(D=>{O(I=>{const P=new Set(I);return P.delete(D),P})},[]),children:n})}),T?a.jsxs(rEt,{"aria-hidden":!0,required:f,tabIndex:-1,name:u,autoComplete:h,value:N,onChange:D=>A(D.target.value),disabled:m,form:p,children:[N===void 0?a.jsx("option",{value:""}):null,Array.from(R)]},F):null]})})};R2t.displayName=W2;var I2t="SelectTrigger",M2t=y.forwardRef((t,e)=>{const{__scopeSelect:n,disabled:r=!1,...s}=t,i=cse(n),o=_S(I2t,n),l=o.disabled||r,c=Sr(e,o.onTriggerChange),d=lse(n),u=y.useRef("touch"),[h,m,f]=iEt(g=>{const v=d().filter(w=>!w.disabled),b=v.find(w=>w.value===o.value),x=aEt(v,g,b);x!==void 0&&o.onValueChange(x.value)}),p=g=>{l||(o.onOpenChange(!0),f()),g&&(o.triggerPointerDownPosRef.current={x:Math.round(g.pageX),y:Math.round(g.pageY)})};return a.jsx(H8,{asChild:!0,...i,children:a.jsx(Sn.button,{type:"button",role:"combobox","aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":"none",dir:o.dir,"data-state":o.open?"open":"closed",disabled:l,"data-disabled":l?"":void 0,"data-placeholder":sEt(o.value)?"":void 0,...s,ref:c,onClick:Kt(s.onClick,g=>{g.currentTarget.focus(),u.current!=="mouse"&&p(g)}),onPointerDown:Kt(s.onPointerDown,g=>{u.current=g.pointerType;const v=g.target;v.hasPointerCapture(g.pointerId)&&v.releasePointerCapture(g.pointerId),g.button===0&&g.ctrlKey===!1&&g.pointerType==="mouse"&&(p(g),g.preventDefault())}),onKeyDown:Kt(s.onKeyDown,g=>{const v=h.current!=="";!(g.ctrlKey||g.altKey||g.metaKey)&&g.key.length===1&&m(g.key),!(v&&g.key===" ")&&Chr.includes(g.key)&&(p(),g.preventDefault())})})})});M2t.displayName=I2t;var L2t="SelectValue",D2t=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,children:i,placeholder:o="",...l}=t,c=_S(L2t,n),{onValueNodeHasChildrenChange:d}=c,u=i!==void 0,h=Sr(e,c.onValueNodeChange);return rl(()=>{d(u)},[d,u]),a.jsx(Sn.span,{...l,ref:h,style:{pointerEvents:"none"},children:sEt(c.value)?a.jsx(a.Fragment,{children:o}):i})});D2t.displayName=L2t;var Ahr="SelectIcon",$2t=y.forwardRef((t,e)=>{const{__scopeSelect:n,children:r,...s}=t;return a.jsx(Sn.span,{"aria-hidden":!0,...s,ref:e,children:r||"▼"})});$2t.displayName=Ahr;var Phr="SelectPortal",O2t=t=>a.jsx(CE,{asChild:!0,...t});O2t.displayName=Phr;var q2="SelectContent",F2t=y.forwardRef((t,e)=>{const n=_S(q2,t.__scopeSelect),[r,s]=y.useState();if(rl(()=>{s(new DocumentFragment)},[]),!n.open){const i=r;return i?Vg.createPortal(a.jsx(B2t,{scope:t.__scopeSelect,children:a.jsx(ose.Slot,{scope:t.__scopeSelect,children:a.jsx("div",{children:t.children})})}),i):null}return a.jsx(U2t,{...t,ref:e})});F2t.displayName=q2;var Up=10,[B2t,AS]=_M(q2),Rhr="SelectContentImpl",Ihr=Ck("SelectContent.RemoveScroll"),U2t=y.forwardRef((t,e)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:s,onEscapeKeyDown:i,onPointerDownOutside:o,side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:h,collisionBoundary:m,collisionPadding:f,sticky:p,hideWhenDetached:g,avoidCollisions:v,...b}=t,x=_S(q2,n),[w,k]=y.useState(null),[S,C]=y.useState(null),j=Sr(e,ne=>k(ne)),[E,N]=y.useState(null),[A,_]=y.useState(null),T=lse(n),[R,O]=y.useState(!1),F=y.useRef(!1);y.useEffect(()=>{if(w)return tte(w)},[w]),ete();const D=y.useCallback(ne=>{const[te,...re]=T().map(q=>q.ref.current),[fe]=re.slice(-1),le=document.activeElement;for(const q of ne)if(q===le||(q==null||q.scrollIntoView({block:"nearest"}),q===te&&S&&(S.scrollTop=0),q===fe&&S&&(S.scrollTop=S.scrollHeight),q==null||q.focus(),document.activeElement!==le))return},[T,S]),I=y.useCallback(()=>D([E,w]),[D,E,w]);y.useEffect(()=>{R&&I()},[R,I]);const{onOpenChange:P,triggerPointerDownPosRef:M}=x;y.useEffect(()=>{if(w){let ne={x:0,y:0};const te=fe=>{var le,q;ne={x:Math.abs(Math.round(fe.pageX)-(((le=M.current)==null?void 0:le.x)??0)),y:Math.abs(Math.round(fe.pageY)-(((q=M.current)==null?void 0:q.y)??0))}},re=fe=>{ne.x<=10&&ne.y<=10?fe.preventDefault():w.contains(fe.target)||P(!1),document.removeEventListener("pointermove",te),M.current=null};return M.current!==null&&(document.addEventListener("pointermove",te),document.addEventListener("pointerup",re,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",te),document.removeEventListener("pointerup",re,{capture:!0})}}},[w,P,M]),y.useEffect(()=>{const ne=()=>P(!1);return window.addEventListener("blur",ne),window.addEventListener("resize",ne),()=>{window.removeEventListener("blur",ne),window.removeEventListener("resize",ne)}},[P]);const[z,G]=iEt(ne=>{const te=T().filter(le=>!le.disabled),re=te.find(le=>le.ref.current===document.activeElement),fe=aEt(te,ne,re);fe&&setTimeout(()=>fe.ref.current.focus())}),B=y.useCallback((ne,te,re)=>{const fe=!F.current&&!re;(x.value!==void 0&&x.value===te||fe)&&(N(ne),fe&&(F.current=!0))},[x.value]),H=y.useCallback(()=>w==null?void 0:w.focus(),[w]),W=y.useCallback((ne,te,re)=>{const fe=!F.current&&!re;(x.value!==void 0&&x.value===te||fe)&&_(ne)},[x.value]),V=r==="popper"?Zxe:z2t,U=V===Zxe?{side:l,sideOffset:c,align:d,alignOffset:u,arrowPadding:h,collisionBoundary:m,collisionPadding:f,sticky:p,hideWhenDetached:g,avoidCollisions:v}:{};return a.jsx(B2t,{scope:n,content:w,viewport:S,onViewportChange:C,itemRefCallback:B,selectedItem:E,onItemLeave:H,itemTextRefCallback:W,focusSelectedItem:I,selectedItemText:A,position:r,isPositioned:R,searchRef:z,children:a.jsx(r7,{as:Ihr,allowPinchZoom:!0,children:a.jsx(n7,{asChild:!0,trapped:x.open,onMountAutoFocus:ne=>{ne.preventDefault()},onUnmountAutoFocus:Kt(s,ne=>{var te;(te=x.trigger)==null||te.focus({preventScroll:!0}),ne.preventDefault()}),children:a.jsx(SE,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:i,onPointerDownOutside:o,onFocusOutside:ne=>ne.preventDefault(),onDismiss:()=>x.onOpenChange(!1),children:a.jsx(V,{role:"listbox",id:x.contentId,"data-state":x.open?"open":"closed",dir:x.dir,onContextMenu:ne=>ne.preventDefault(),...b,...U,onPlaced:()=>O(!0),ref:j,style:{display:"flex",flexDirection:"column",outline:"none",...b.style},onKeyDown:Kt(b.onKeyDown,ne=>{const te=ne.ctrlKey||ne.altKey||ne.metaKey;if(ne.key==="Tab"&&ne.preventDefault(),!te&&ne.key.length===1&&G(ne.key),["ArrowUp","ArrowDown","Home","End"].includes(ne.key)){let fe=T().filter(le=>!le.disabled).map(le=>le.ref.current);if(["ArrowUp","End"].includes(ne.key)&&(fe=fe.slice().reverse()),["ArrowUp","ArrowDown"].includes(ne.key)){const le=ne.target,q=fe.indexOf(le);fe=fe.slice(q+1)}setTimeout(()=>D(fe)),ne.preventDefault()}})})})})})})});U2t.displayName=Rhr;var Mhr="SelectItemAlignedPosition",z2t=y.forwardRef((t,e)=>{const{__scopeSelect:n,onPlaced:r,...s}=t,i=_S(q2,n),o=AS(q2,n),[l,c]=y.useState(null),[d,u]=y.useState(null),h=Sr(e,j=>u(j)),m=lse(n),f=y.useRef(!1),p=y.useRef(!0),{viewport:g,selectedItem:v,selectedItemText:b,focusSelectedItem:x}=o,w=y.useCallback(()=>{if(i.trigger&&i.valueNode&&l&&d&&g&&v&&b){const j=i.trigger.getBoundingClientRect(),E=d.getBoundingClientRect(),N=i.valueNode.getBoundingClientRect(),A=b.getBoundingClientRect();if(i.dir!=="rtl"){const le=A.left-E.left,q=N.left-le,Y=j.left-q,X=j.width+Y,Q=Math.max(X,E.width),ie=window.innerWidth-Up,he=eF(q,[Up,Math.max(Up,ie-Q)]);l.style.minWidth=X+"px",l.style.left=he+"px"}else{const le=E.right-A.right,q=window.innerWidth-N.right-le,Y=window.innerWidth-j.right-q,X=j.width+Y,Q=Math.max(X,E.width),ie=window.innerWidth-Up,he=eF(q,[Up,Math.max(Up,ie-Q)]);l.style.minWidth=X+"px",l.style.right=he+"px"}const _=m(),T=window.innerHeight-Up*2,R=g.scrollHeight,O=window.getComputedStyle(d),F=parseInt(O.borderTopWidth,10),D=parseInt(O.paddingTop,10),I=parseInt(O.borderBottomWidth,10),P=parseInt(O.paddingBottom,10),M=F+D+R+P+I,z=Math.min(v.offsetHeight*5,M),G=window.getComputedStyle(g),B=parseInt(G.paddingTop,10),H=parseInt(G.paddingBottom,10),W=j.top+j.height/2-Up,V=T-W,U=v.offsetHeight/2,ne=v.offsetTop+U,te=F+D+ne,re=M-te;if(te<=W){const le=_.length>0&&v===_[_.length-1].ref.current;l.style.bottom="0px";const q=d.clientHeight-g.offsetTop-g.offsetHeight,Y=Math.max(V,U+(le?H:0)+q+I),X=te+Y;l.style.height=X+"px"}else{const le=_.length>0&&v===_[0].ref.current;l.style.top="0px";const Y=Math.max(W,F+g.offsetTop+(le?B:0)+U)+re;l.style.height=Y+"px",g.scrollTop=te-W+g.offsetTop}l.style.margin=`${Up}px 0`,l.style.minHeight=z+"px",l.style.maxHeight=T+"px",r==null||r(),requestAnimationFrame(()=>f.current=!0)}},[m,i.trigger,i.valueNode,l,d,g,v,b,i.dir,r]);rl(()=>w(),[w]);const[k,S]=y.useState();rl(()=>{d&&S(window.getComputedStyle(d).zIndex)},[d]);const C=y.useCallback(j=>{j&&p.current===!0&&(w(),x==null||x(),p.current=!1)},[w,x]);return a.jsx(Dhr,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:f,onScrollButtonChange:C,children:a.jsx("div",{ref:c,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:k},children:a.jsx(Sn.div,{...s,ref:h,style:{boxSizing:"border-box",maxHeight:"100%",...s.style}})})})});z2t.displayName=Mhr;var Lhr="SelectPopperPosition",Zxe=y.forwardRef((t,e)=>{const{__scopeSelect:n,align:r="start",collisionPadding:s=Up,...i}=t,o=cse(n);return a.jsx(bee,{...o,...i,ref:e,align:r,collisionPadding:s,style:{boxSizing:"border-box",...i.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Zxe.displayName=Lhr;var[Dhr,yAe]=_M(q2,{}),Jxe="SelectViewport",V2t=y.forwardRef((t,e)=>{const{__scopeSelect:n,nonce:r,...s}=t,i=AS(Jxe,n),o=yAe(Jxe,n),l=Sr(e,i.onViewportChange),c=y.useRef(0);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),a.jsx(ose.Slot,{scope:n,children:a.jsx(Sn.div,{"data-radix-select-viewport":"",role:"presentation",...s,ref:l,style:{position:"relative",flex:1,overflow:"hidden auto",...s.style},onScroll:Kt(s.onScroll,d=>{const u=d.currentTarget,{contentWrapper:h,shouldExpandOnScrollRef:m}=o;if(m!=null&&m.current&&h){const f=Math.abs(c.current-u.scrollTop);if(f>0){const p=window.innerHeight-Up*2,g=parseFloat(h.style.minHeight),v=parseFloat(h.style.height),b=Math.max(g,v);if(b<p){const x=b+f,w=Math.min(p,x),k=x-w;h.style.height=w+"px",h.style.bottom==="0px"&&(u.scrollTop=k>0?k:0,h.style.justifyContent="flex-end")}}}c.current=u.scrollTop})})})]})});V2t.displayName=Jxe;var H2t="SelectGroup",[$hr,Ohr]=_M(H2t),G2t=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=el();return a.jsx($hr,{scope:n,id:s,children:a.jsx(Sn.div,{role:"group","aria-labelledby":s,...r,ref:e})})});G2t.displayName=H2t;var W2t="SelectLabel",q2t=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=Ohr(W2t,n);return a.jsx(Sn.div,{id:s.id,...r,ref:e})});q2t.displayName=W2t;var MZ="SelectItem",[Fhr,K2t]=_M(MZ),Y2t=y.forwardRef((t,e)=>{const{__scopeSelect:n,value:r,disabled:s=!1,textValue:i,...o}=t,l=_S(MZ,n),c=AS(MZ,n),d=l.value===r,[u,h]=y.useState(i??""),[m,f]=y.useState(!1),p=Sr(e,x=>{var w;return(w=c.itemRefCallback)==null?void 0:w.call(c,x,r,s)}),g=el(),v=y.useRef("touch"),b=()=>{s||(l.onValueChange(r),l.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return a.jsx(Fhr,{scope:n,value:r,disabled:s,textId:g,isSelected:d,onItemTextChange:y.useCallback(x=>{h(w=>w||((x==null?void 0:x.textContent)??"").trim())},[]),children:a.jsx(ose.ItemSlot,{scope:n,value:r,disabled:s,textValue:u,children:a.jsx(Sn.div,{role:"option","aria-labelledby":g,"data-highlighted":m?"":void 0,"aria-selected":d&&m,"data-state":d?"checked":"unchecked","aria-disabled":s||void 0,"data-disabled":s?"":void 0,tabIndex:s?void 0:-1,...o,ref:p,onFocus:Kt(o.onFocus,()=>f(!0)),onBlur:Kt(o.onBlur,()=>f(!1)),onClick:Kt(o.onClick,()=>{v.current!=="mouse"&&b()}),onPointerUp:Kt(o.onPointerUp,()=>{v.current==="mouse"&&b()}),onPointerDown:Kt(o.onPointerDown,x=>{v.current=x.pointerType}),onPointerMove:Kt(o.onPointerMove,x=>{var w;v.current=x.pointerType,s?(w=c.onItemLeave)==null||w.call(c):v.current==="mouse"&&x.currentTarget.focus({preventScroll:!0})}),onPointerLeave:Kt(o.onPointerLeave,x=>{var w;x.currentTarget===document.activeElement&&((w=c.onItemLeave)==null||w.call(c))}),onKeyDown:Kt(o.onKeyDown,x=>{var k;((k=c.searchRef)==null?void 0:k.current)!==""&&x.key===" "||(jhr.includes(x.key)&&b(),x.key===" "&&x.preventDefault())})})})})});Y2t.displayName=MZ;var nD="SelectItemText",Q2t=y.forwardRef((t,e)=>{const{__scopeSelect:n,className:r,style:s,...i}=t,o=_S(nD,n),l=AS(nD,n),c=K2t(nD,n),d=_hr(nD,n),[u,h]=y.useState(null),m=Sr(e,b=>h(b),c.onItemTextChange,b=>{var x;return(x=l.itemTextRefCallback)==null?void 0:x.call(l,b,c.value,c.disabled)}),f=u==null?void 0:u.textContent,p=y.useMemo(()=>a.jsx("option",{value:c.value,disabled:c.disabled,children:f},c.value),[c.disabled,c.value,f]),{onNativeOptionAdd:g,onNativeOptionRemove:v}=d;return rl(()=>(g(p),()=>v(p)),[g,v,p]),a.jsxs(a.Fragment,{children:[a.jsx(Sn.span,{id:c.textId,...i,ref:m}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Vg.createPortal(i.children,o.valueNode):null]})});Q2t.displayName=nD;var Z2t="SelectItemIndicator",J2t=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return K2t(Z2t,n).isSelected?a.jsx(Sn.span,{"aria-hidden":!0,...r,ref:e}):null});J2t.displayName=Z2t;var Xxe="SelectScrollUpButton",X2t=y.forwardRef((t,e)=>{const n=AS(Xxe,t.__scopeSelect),r=yAe(Xxe,t.__scopeSelect),[s,i]=y.useState(!1),o=Sr(e,r.onScrollButtonChange);return rl(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollTop>0;i(d)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?a.jsx(tEt,{...t,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop-c.offsetHeight)}}):null});X2t.displayName=Xxe;var e0e="SelectScrollDownButton",eEt=y.forwardRef((t,e)=>{const n=AS(e0e,t.__scopeSelect),r=yAe(e0e,t.__scopeSelect),[s,i]=y.useState(!1),o=Sr(e,r.onScrollButtonChange);return rl(()=>{if(n.viewport&&n.isPositioned){let l=function(){const d=c.scrollHeight-c.clientHeight,u=Math.ceil(c.scrollTop)<d;i(u)};const c=n.viewport;return l(),c.addEventListener("scroll",l),()=>c.removeEventListener("scroll",l)}},[n.viewport,n.isPositioned]),s?a.jsx(tEt,{...t,ref:o,onAutoScroll:()=>{const{viewport:l,selectedItem:c}=n;l&&c&&(l.scrollTop=l.scrollTop+c.offsetHeight)}}):null});eEt.displayName=e0e;var tEt=y.forwardRef((t,e)=>{const{__scopeSelect:n,onAutoScroll:r,...s}=t,i=AS("SelectScrollButton",n),o=y.useRef(null),l=lse(n),c=y.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return y.useEffect(()=>()=>c(),[c]),rl(()=>{var u;const d=l().find(h=>h.ref.current===document.activeElement);(u=d==null?void 0:d.ref.current)==null||u.scrollIntoView({block:"nearest"})},[l]),a.jsx(Sn.div,{"aria-hidden":!0,...s,ref:e,style:{flexShrink:0,...s.style},onPointerDown:Kt(s.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:Kt(s.onPointerMove,()=>{var d;(d=i.onItemLeave)==null||d.call(i),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:Kt(s.onPointerLeave,()=>{c()})})}),Bhr="SelectSeparator",nEt=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t;return a.jsx(Sn.div,{"aria-hidden":!0,...r,ref:e})});nEt.displayName=Bhr;var t0e="SelectArrow",Uhr=y.forwardRef((t,e)=>{const{__scopeSelect:n,...r}=t,s=cse(n),i=_S(t0e,n),o=AS(t0e,n);return i.open&&o.position==="popper"?a.jsx(xee,{...s,...r,ref:e}):null});Uhr.displayName=t0e;var zhr="SelectBubbleInput",rEt=y.forwardRef(({__scopeSelect:t,value:e,...n},r)=>{const s=y.useRef(null),i=Sr(r,s),o=i7(e);return y.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLSelectElement.prototype,u=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==e&&u){const h=new Event("change",{bubbles:!0});u.call(l,e),l.dispatchEvent(h)}},[o,e]),a.jsx(Sn.select,{...n,style:{...yst,...n.style},ref:i,defaultValue:e})});rEt.displayName=zhr;function sEt(t){return t===""||t===void 0}function iEt(t){const e=Lo(t),n=y.useRef(""),r=y.useRef(0),s=y.useCallback(o=>{const l=n.current+o;e(l),function c(d){n.current=d,window.clearTimeout(r.current),d!==""&&(r.current=window.setTimeout(()=>c(""),1e3))}(l)},[e]),i=y.useCallback(()=>{n.current="",window.clearTimeout(r.current)},[]);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,s,i]}function aEt(t,e,n){const s=e.length>1&&Array.from(e).every(d=>d===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let o=Vhr(t,Math.max(i,0));s.length===1&&(o=o.filter(d=>d!==n));const c=o.find(d=>d.textValue.toLowerCase().startsWith(s.toLowerCase()));return c!==n?c:void 0}function Vhr(t,e){return t.map((n,r)=>t[(e+r)%t.length])}var Hhr=R2t,oEt=M2t,Ghr=D2t,Whr=$2t,qhr=O2t,lEt=F2t,Khr=V2t,Yhr=G2t,cEt=q2t,dEt=Y2t,Qhr=Q2t,Zhr=J2t,uEt=X2t,hEt=eEt,mEt=nEt;const zn=Hhr,n0e=Yhr,Vn=Ghr,On=y.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(oEt,{ref:r,className:ee("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...n,children:[e,a.jsx(Whr,{asChild:!0,children:a.jsx(li,{className:"h-4 w-4 opacity-50"})})]}));On.displayName=oEt.displayName;const fEt=y.forwardRef(({className:t,...e},n)=>a.jsx(uEt,{ref:n,className:ee("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(M8,{className:"h-4 w-4"})}));fEt.displayName=uEt.displayName;const pEt=y.forwardRef(({className:t,...e},n)=>a.jsx(hEt,{ref:n,className:ee("flex cursor-default items-center justify-center py-1",t),...e,children:a.jsx(li,{className:"h-4 w-4"})}));pEt.displayName=hEt.displayName;const Fn=y.forwardRef(({className:t,children:e,position:n="popper",...r},s)=>a.jsx(qhr,{children:a.jsxs(lEt,{ref:s,className:ee("relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:n,...r,children:[a.jsx(fEt,{}),a.jsx(Khr,{className:ee("p-1",n==="popper"&&"w-full min-w-[var(--radix-select-trigger-width)]"),children:e}),a.jsx(pEt,{})]})}));Fn.displayName=lEt.displayName;const LZ=y.forwardRef(({className:t,...e},n)=>a.jsx(cEt,{ref:n,className:ee("py-1.5 pl-8 pr-2 text-sm font-semibold",t),...e}));LZ.displayName=cEt.displayName;const pt=y.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(dEt,{ref:r,className:ee("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none data-[disabled]:pointer-events-none data-[disabled]:opacity-50 focus:bg-accent focus:text-accent-foreground",t),...n,children:[a.jsx("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:a.jsx(Zhr,{children:a.jsx(Qn,{className:"h-4 w-4"})})}),a.jsx(Qhr,{children:e})]}));pt.displayName=dEt.displayName;const gEt=y.forwardRef(({className:t,...e},n)=>a.jsx(mEt,{ref:n,className:ee("-mx-1 my-1 h-px bg-muted",t),...e}));gEt.displayName=mEt.displayName;function bAe({group:t,onGroupUpdated:e,refetchGroups:n}){const{community:r}=qe(),s=rn(),[i,o]=y.useState(!1),l=y.useCallback(async x=>{if(x)e==null||e(x);else if(t!=null&&t.id)try{const w=await mAe(t.id);e==null||e(w.group)}catch{}t!=null&&t.id&&s.invalidateQueries({queryKey:["group-detail",t.id]}),n==null||n()},[t==null?void 0:t.id,e,s,n]),c=y.useCallback(async x=>{if(!t)return{ok:!1,message:"Group not found"};o(!0);try{const w=await x(),k=w&&typeof w=="object"&&"group"in w?w.group:void 0;return await l(k??null),{ok:!0}}catch(w){return{ok:!1,message:w instanceof ze?Dt(w.body,w.message):"Something went wrong."}}finally{o(!1)}},[t,l]),d=y.useCallback(x=>c(()=>Xur(t.id,x)),[t,c]),u=y.useCallback((x,w)=>c(()=>ehr(t.id,x,w)),[t,c]),h=y.useCallback(x=>c(()=>thr(t.id,x)),[t,c]),m=y.useCallback(x=>c(()=>nhr(t.id,x)),[t,c]),f=y.useCallback(x=>{const w=r==null?void 0:r.id;return w?c(()=>chr(w,t.id,x)):Promise.resolve({ok:!1,message:"No community"})},[r==null?void 0:r.id,t,c]),p=y.useCallback(x=>c(()=>rhr(t.id,x)),[t,c]),g=y.useCallback(x=>c(()=>shr(t.id,x)),[t,c]),v=y.useCallback(()=>c(()=>ihr(t.id)),[t,c]),b=y.useCallback(async()=>{if(!t)return{ok:!1,message:"Group not found"};o(!0);try{return await ahr(t.id),s.invalidateQueries({queryKey:["group-detail",t.id]}),n==null||n(),{ok:!0}}catch(x){const w=x instanceof ze&&x.body&&typeof x.body=="object"?x.body:null;return{ok:!1,message:x instanceof ze?Dt(x.body,x.message):"Something went wrong.",code:typeof(w==null?void 0:w.code)=="string"?w.code:void 0,blockingSubscriptions:Array.isArray(w==null?void 0:w.subscriptions)?w.subscriptions:void 0}}finally{o(!1)}},[t,s,n]);return{isBusy:i,createChannel:d,editChannel:u,deleteChannel:h,saveSettings:m,reorderChannels:f,uploadBanner:p,uploadIcon:g,removeIcon:v,removeGroup:b}}function vEt({value:t,onChange:e,idPrefix:n="seo",slugHint:r="Used in the public URL. Leave blank to auto-generate from the name."}){const s=(i,o)=>e({...t,[i]:o});return a.jsxs("div",{className:"space-y-4 rounded-md border border-border p-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"SEO & sharing"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Controls the title, description, and preview image shown in search engines and link previews."})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:`${n}-slug`,children:"URL slug"}),a.jsx(Oe,{id:`${n}-slug`,value:t.slug??"",placeholder:"my-page",onChange:i=>s("slug",i.target.value.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,""))}),a.jsx("p",{className:"text-xs text-muted-foreground",children:r})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:`${n}-title`,children:"Meta title"}),a.jsx(Oe,{id:`${n}-title`,value:t.title??"",maxLength:70,placeholder:"Title shown in search results / link previews",onChange:i=>s("title",i.target.value)})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:`${n}-desc`,children:"Meta description"}),a.jsx(us,{id:`${n}-desc`,value:t.description??"",rows:2,maxLength:200,placeholder:"Short description shown under the title in search results",onChange:i=>s("description",i.target.value)})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:`${n}-og`,children:"Social preview image URL"}),a.jsx(Oe,{id:`${n}-og`,type:"url",value:t.ogImage??"",placeholder:"https://…/preview.png",onChange:i=>s("ogImage",i.target.value)}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Open Graph image used when the link is shared (1200×630 recommended)."})]})]})}function DZ({group:t,channel:e,open:n,onOpenChange:r,onGroupUpdated:s,refetchGroups:i}){const{toast:o}=yt(),l=bAe({group:t,onGroupUpdated:s,refetchGroups:i}),c=!!e,[d,u]=y.useState(""),[h,m]=y.useState("#"),[f,p]=y.useState("generic"),[g,v]=y.useState("anyone"),[b,x]=y.useState("latest"),[w,k]=y.useState("list"),[S,C]=y.useState(!1),[j,E]=y.useState(!1),[N,A]=y.useState("all"),[_,T]=y.useState(!0),[R,O]=y.useState(!1),[F,D]=y.useState({});y.useEffect(()=>{var P,M,z,G;n&&(u((e==null?void 0:e.name)??""),m((e==null?void 0:e.emoji)??"#"),p((e==null?void 0:e.sectionType)??"generic"),v((e==null?void 0:e.postLevel)??"anyone"),x((e==null?void 0:e.sortBy)??"latest"),k((e==null?void 0:e.sectionView)??"list"),C(!!(e!=null&&e.isClosed)),E(!!(e!=null&&e.isPrivate)),A((e==null?void 0:e.defaultNotificationLevel)??"all"),T(e?!!e.pushNotificationOnNewPost:!0),O(!!(e!=null&&e.emailNotificationOnNewPost)),D({slug:((P=e==null?void 0:e.meta)==null?void 0:P.slug)??"",title:((M=e==null?void 0:e.meta)==null?void 0:M.title)??"",description:((z=e==null?void 0:e.meta)==null?void 0:z.description)??"",ogImage:((G=e==null?void 0:e.meta)==null?void 0:G.openGraphImage)??""}))},[n,e]);const I=async()=>{var G,B,H,W;if(d.trim().length<2){o({title:"Name too short",description:"Channel name needs at least 2 characters.",variant:"destructive"});return}const P={title:((G=F.title)==null?void 0:G.trim())??"",description:((B=F.description)==null?void 0:B.trim())??"",openGraphImage:((H=F.ogImage)==null?void 0:H.trim())??""};(W=F.slug)!=null&&W.trim()&&(P.slug=F.slug.trim());const M={name:d.trim(),emoji:h.trim()||"#",sectionType:f,postLevel:g,sortBy:b,sectionView:f==="generic"?w:void 0,isClosed:S,isPrivate:S?j:!1,defaultNotificationLevel:N,pushNotificationOnNewPost:_,emailNotificationOnNewPost:R,meta:P},z=c?await l.editChannel(e.id,M):await l.createChannel(M);z.ok?(o({title:c?"Channel updated":"Channel created",description:d.trim()}),r(!1)):o({title:"Couldn't save channel",description:z.message,variant:"destructive"})};return a.jsx(Bt,{open:n,onOpenChange:r,children:a.jsxs(Ft,{className:"sm:max-w-md max-h-[90vh] grid-rows-[auto_1fr_auto] overflow-hidden",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:c?"Edit channel":"Create channel"}),a.jsx(_n,{children:c?"Update this channel's settings.":"Add a discussion feed or chat channel to this group."})]}),a.jsxs("div",{className:"space-y-4 overflow-y-auto -mx-1 px-1",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("div",{className:"w-16 space-y-1.5",children:[a.jsx(_e,{children:"Icon"}),a.jsxs(Ni,{children:[a.jsx(Ti,{asChild:!0,children:a.jsx("button",{type:"button",className:"flex h-10 w-full items-center justify-center rounded-md border border-input bg-background text-lg hover:bg-muted","aria-label":"Pick channel icon",children:h||"#"})}),a.jsx(yi,{className:"w-auto p-0",align:"start",children:a.jsx($g,{onPick:P=>m(P)})})]})]}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(_e,{htmlFor:"ch-name",children:"Name"}),a.jsx(Oe,{id:"ch-name",value:d,maxLength:100,placeholder:"e.g. Announcements",onChange:P=>u(P.target.value)})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Type"}),a.jsxs(zn,{value:f,onValueChange:P=>p(P),disabled:c,children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"generic",children:"Discussion (post feed)"}),a.jsx(pt,{value:"realtime",children:"Chat (realtime messages)"})]})]}),c&&a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Channel type can't be changed after creation."})]}),f==="generic"&&a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Who can post"}),a.jsxs(zn,{value:g,onValueChange:P=>v(P),children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"anyone",children:"All members"}),a.jsx(pt,{value:"admin",children:"Admins only"})]})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Sort by"}),a.jsxs(zn,{value:b,onValueChange:P=>x(P),children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"latest",children:"Newest first"}),a.jsx(pt,{value:"oldest",children:"Oldest first"})]})]})]}),a.jsxs("div",{className:"col-span-2 space-y-1.5",children:[a.jsx(_e,{children:"Layout"}),a.jsxs(zn,{value:w,onValueChange:P=>k(P),children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"list",children:"List (full posts)"}),a.jsx(pt,{value:"grid",children:"Grid (2 columns)"}),a.jsx(pt,{value:"compact",children:"Compact (dense)"})]})]})]})]}),a.jsxs("div",{className:"flex items-center justify-between rounded-md border border-border px-3 py-2.5",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Closed channel"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Members must request access."})]}),a.jsx(Hs,{checked:S,onCheckedChange:C})]}),S&&a.jsxs("div",{className:"flex items-center justify-between rounded-md border border-border px-3 py-2.5",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Private"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Hidden from non-members; invite only."})]}),a.jsx(Hs,{checked:j,onCheckedChange:E})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Default notifications for members"}),a.jsxs(zn,{value:N,onValueChange:P=>A(P),children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"all",children:"All activity"}),a.jsx(pt,{value:"admin",children:"Important only (admin posts)"}),a.jsx(pt,{value:"none",children:"Off"})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"flex items-center justify-between rounded-md border border-border px-3 py-2.5",children:[a.jsx("p",{className:"text-xs font-medium text-foreground",children:"Push on new post"}),a.jsx(Hs,{checked:_,onCheckedChange:T})]}),a.jsxs("div",{className:"flex items-center justify-between rounded-md border border-border px-3 py-2.5",children:[a.jsx("p",{className:"text-xs font-medium text-foreground",children:"Email on new post"}),a.jsx(Hs,{checked:R,onCheckedChange:O})]})]}),a.jsx(vEt,{value:F,onChange:D,idPrefix:"ch-seo"})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"outline",onClick:()=>r(!1),disabled:l.isBusy,children:"Cancel"}),a.jsxs(Z,{onClick:I,disabled:l.isBusy,children:[l.isBusy?a.jsx(Ne,{className:"h-4 w-4 mr-2 animate-spin"}):null,c?"Save changes":"Create channel"]})]})]})})}const yEt=y.createContext(null);function Jhr({children:t}){const{socket:e}=Qg(),{user:n}=jr(),{community:r}=qe(),s=(r==null?void 0:r.id)??null,i=(n==null?void 0:n.id)??null,[o,l]=y.useState({}),c=y.useRef(null),{data:d}=lt({queryKey:["user-counters",s],queryFn:()=>Kjt(s),enabled:!!i,staleTime:3e4});y.useEffect(()=>{const f=d==null?void 0:d.unreadSectionNotificationsCount;!f||typeof f!="object"||l(p=>{const g={...p};for(const[b,x]of Object.entries(f)){const w=Number(x)||0,k=Math.max(w,p[b]??0);k>0?g[b]=k:delete g[b]}const v=c.current;return v&&delete g[v],g})},[d]),y.useEffect(()=>{if(!e)return;const f=p=>{const g=p==null?void 0:p.sectionId;g&&(i&&p.messageSender===i||c.current!==g&&l(v=>({...v,[g]:(v[g]??0)+1})))};return e.on("new-section-message-badge",f),()=>{e.off("new-section-message-badge",f)}},[e,i]);const u=y.useCallback(f=>{l(p=>{if(!p[f])return p;const g={...p};return delete g[f],g})},[]),h=y.useCallback(f=>{c.current=f,f&&u(f)},[u]),m=y.useMemo(()=>({counts:o,clearSection:u,setActiveSection:h}),[o,u,h]);return a.jsx(yEt.Provider,{value:m,children:t})}function dse(){return y.useContext(yEt)??{counts:{},clearSection:()=>{},setActiveSection:()=>{}}}function Xhr(t){const e=t==null?void 0:t.configuration;return!e||typeof e!="object"?{}:e}function jN(t){return!!Xhr(t).isExploreCourseDisabled}function emr(t){return(t==null?void 0:t.myRole)==="admin"||(t==null?void 0:t.myRole)==="moderator"||!!(t!=null&&t.isByMe)}const tmr="GROUP_REQUIRED";function xAe(t){return t==="closed-paid"}function r0e(t){var e;return(e=t.paywall)!=null&&e.required&&t.paywall.entitled?!1:!!(t.isJoined&&t.group&&t.group.joinStatus!=="joined")}function bEt(t){var n;if(!(t instanceof ze)||!t.body||typeof t.body!="object")return null;const e=t.body;return e.code!==tmr||typeof((n=e.group)==null?void 0:n.id)!="string"?null:{id:e.group.id,name:typeof e.group.name=="string"?e.group.name:"Group",groupType:typeof e.group.groupType=="string"?e.group.groupType:void 0,joinStatus:typeof e.group.joinStatus=="string"?e.group.joinStatus:null}}function xEt(t,e){const n=ve.knowledgeCourse(e);return t===n||t.startsWith(`${n}/`)}function nmr(t,e={}){var r;const n=new Map;for(const s of t??[]){const i=(r=s.group)==null?void 0:r.id;if(!i||s.state==="draft"&&!e.includeDrafts)continue;const o=n.get(i)??[];o.push(s),n.set(i,o)}return n}const $Z=t=>encodeURIComponent(t),rmr=50*1024*1024,MVe=[1e3,3e3,8e3,15e3,3e4],smr=1500,imr=35*60*1e3,LVe=(t,e)=>new Promise((n,r)=>{if(e!=null&&e.aborted)return r(OA());const s=setTimeout(()=>{e==null||e.removeEventListener("abort",i),n()},t),i=()=>{clearTimeout(s),r(OA())};e==null||e.addEventListener("abort",i,{once:!0})});async function amr(t,e){var i;const n=new FormData;n.append("images[]",e,e.name);const r=await Ea(`/community/${$Z(t)}/media/upload?attachmentType=image`,n),s=(i=r==null?void 0:r.publicUrls)==null?void 0:i[0];if(!s)throw new Error("Upload did not return a URL");return s}function wEt(t){return t.size>rmr}async function wAe(t,e,n,r,s){var u,h,m;const i=`/community/${$Z(t)}/media/chunked-upload`,o=await ae.post(i,{attachmentType:e,fileName:n.name,mimeType:n.type,size:n.size},{signal:s});if(!(o!=null&&o.uploadId))throw new ze("Uploads in pieces are not available.",404);const l=`${i}/${$Z(o.uploadId)}`,c=o.chunkSize>0?o.chunkSize:16*1024*1024,d=f=>r==null?void 0:r(Math.min(99,Math.floor(f*100/n.size)));try{let f=0,p=0;for(;f<n.size;){const x=n.slice(f,f+c),w=new FormData;w.append("chunk",x,"chunk");try{const k=f;f=(await j0(`${l}/chunk?offset=${f}`,w,C=>d(k+x.size*C/100),s)).received,p=0}catch(k){if(kg(k))throw k;const S=k instanceof ze?k.status:null,C=k instanceof ze?(u=k.body)==null?void 0:u.received:void 0;if(S===409&&typeof C=="number")f=C;else if((S===0||S===409)&&p<MVe.length)await LVe(MVe[p],s),p+=1,f=((h=await ae.get(l,{signal:s}).catch(()=>null))==null?void 0:h.received)??f;else throw k}d(f)}let g=await ae.post(`${l}/complete`,{},{signal:s});const v=Date.now();for(;g.state==="storing";){if(Date.now()-v>imr)throw new Error("The upload took too long to finish. Please try again.");await LVe(smr,s),g=await ae.get(l,{signal:s}).catch(x=>{if(kg(x)||x instanceof ze&&x.status!==0)throw x;return null})??g}const b=g.state==="done"?(m=g.publicUrls)==null?void 0:m[0]:void 0;if(!b)throw new Error(g.message||"The file could not be stored. Please try again.");return r==null||r(100),b}catch(f){throw ae.delete(l).catch(()=>{}),kg(f)||s!=null&&s.aborted?OA():f}}function kEt(t){return t instanceof ze&&(t.status===404||t.status===405)}async function use(t,e,n,r,s,i){if(!wEt(n))return r();try{return await wAe(t,e,n,s,i)}catch(o){if(!kEt(o))throw o;return r()}}async function SEt(t,e,n,r,s){const i=e==="banner"?n.slice(0,1):n,o=async()=>{const l=new FormData;for(const u of i)l.append(`${e}s[]`,u,u.name);const c=await j0(`/community/${$Z(t)}/media/upload?attachmentType=${e}`,l,r,s),d=((c==null?void 0:c.publicUrls)??[]).filter(u=>typeof u=="string"&&u.length>0);if(d.length<i.length)throw new Error(`Some ${e==="banner"?"cover":e} uploads failed.`);return d};return(e==="video"||e==="document")&&i.length===1?[await use(t,e,i[0],async()=>(await o())[0],r,s)]:o()}const Eh=t=>encodeURIComponent(t),Td=(t,e)=>`/community/${Eh(t)}/courses/${Eh(e)}`,hse=(t,e,n)=>`${Td(t,e)}/section/${Eh(n)}`,sp=(t,e,n,r)=>`${hse(t,e,n)}/lessons/${Eh(r)}`,omr=50;function CEt(t,e={}){var s;const n=new URLSearchParams;e.q&&n.set("q",e.q),e.filter&&n.set("filter",e.filter),e.sort&&n.set("sort",e.sort),e.view&&n.set("view",e.view),e.saved&&n.set("saved","1"),e.from&&n.set("from",e.from),e.to&&n.set("to",e.to),(s=e.author)==null||s.forEach(i=>n.append("author",i)),e.page&&(n.set("page",String(e.page)),n.set("limit",String(omr)));const r=n.toString();return ae.get(`/community/${Eh(t)}/courses${r?`?${r}`:""}`)}const lmr=(t,e)=>["course-authors",t,e??"all"];function cmr(t,e="",n=1,r){const s=new URLSearchParams({page:String(n)});return e&&s.set("q",e),r&&s.set("view",r),ae.get(`/community/${Eh(t)}/courses/authors?${s.toString()}`)}function kAe(t,e,n){const r=n?Td(t,n):`/community/${Eh(t)}/courses`;return ae.post(r,e)}function jEt(t,e,n){const r=new FormData;return r.append("banner",n),Ea(`${Td(t,e)}/banner`,r)}function dmr(t,e){return ae.get(Td(t,e))}function umr(t,e){return ae.delete(Td(t,e))}function hmr(t,e,n){const r=`${Td(t,e)}/like`;return n?ae.post(r,{}):ae.delete(r)}function mmr(t,e,n){const r=`${Td(t,e)}/save`;return n?ae.post(r,{}):ae.delete(r)}const fmr=t=>`${window.location.origin}/course/${Eh(t)}`;function pmr(t,e){return ae.post(`${Td(t,e)}/duplicate`,{})}function EEt(t,e,n=1,r=10){const s=`?page=${n}&limit=${r}`;return ae.get(`${Td(t,e)}/members/paginated${s}`)}function gmr(t,e,n){return ae.post(`${Td(t,e)}/accept/${Eh(n)}`,{})}function NEt(t,e){return ae.post(`${Td(t,e)}/join`,{})}function vmr(t,e){return ae.post(`${Td(t,e)}/leave`,{})}function ymr(t,e,n){return ae.post(`${Td(t,e)}/reject/${Eh(n)}`,{})}function bmr(t,e,n,r){const s=r?hse(t,e,r):`${Td(t,e)}/section`;return ae.post(s,n)}function xmr(t,e,n){return ae.delete(hse(t,e,n))}function dq(t,e,n,r,s){const i=s?sp(t,e,n,s):`${hse(t,e,n)}/lessons`;return ae.post(i,r)}function wmr(t,e,n,r){return ae.delete(sp(t,e,n,r))}function kmr(t,e,n,r){return ae.post(`${sp(t,e,n,r)}/duplicate`,{})}function Smr(t,e,n,r,s,i,o){const l=s instanceof File?s:new File([s],"lecture-clip.webm",{type:s.type||"video/webm"}),c=`${sp(t,e,n,r)}/cover`,d=()=>{const u=new FormData;return u.append("coverMedia",l,l.name),i||o?j0(c,u,i,o):Ea(c,u)};return wEt(l)?wAe(t,"video",l,i,o).then(u=>ae.post(c,{coverMediaUrl:u}),u=>{if(!kEt(u))throw u;return d()}):d()}function Cmr(t,e,n,r){return ae.post(`${sp(t,e,n,r)}/cover`,{})}function TEt(t,e,n,r,s){return ae.post(`${sp(t,e,n,r)}/blocks`,s)}function jmr(t,e,n,r){return ae.post(`${sp(t,e,n,r)}/mark-complete`,{})}function Emr(t,e,n,r){return ae.post(`${sp(t,e,n,r)}/mark-incomplete`,{})}function Nmr(t,e,n,r){return ae.get(`${sp(t,e,n,r)}/quiz-attempts`)}function Tmr(t,e,n,r,s){return ae.post(`${sp(t,e,n,r)}/quiz`,s)}function _mr(t,e,n,r,s){return ae.post(`${sp(t,e,n,r)}/comment`,s)}function DVe(t,e,n,r,s=1){return ae.get(`${sp(t,e,n,r)}/comments?page=${s}`)}function Amr(t,e,n=1,r=10){const s=new URLSearchParams({page:String(n),limit:String(r)});return ae.get(`${Td(t,e)}/comments?${s.toString()}`)}function Pmr(t,e,n=1,r=10,s=""){const i=new URLSearchParams({page:String(n),limit:String(r)});return s.trim()&&i.set("search",s.trim()),ae.get(`${Td(t,e)}/quiz-results?${i.toString()}`)}function Rmr(t,e,n){return ae.get(`${Td(t,e)}/quiz-results/${Eh(n)}`)}function Imr(t,e){return ae.post(`/lesson-comments/${Eh(t)}`,e)}function Mmr(t){return ae.delete(`/lesson-comments/${Eh(t)}`)}function Lmr(t,e){return use(t,"document",e,async()=>{var i;const n=new FormData;n.append("documents[]",e,e.name);const s=(i=(await Ea(`/community/${Eh(t)}/media/upload?attachmentType=document`,n)).publicUrls)==null?void 0:i[0];if(!s)throw new Error("Upload did not return a URL");return s})}function Dmr(t){return[...t].sort((e,n)=>e.index-n.index).flatMap(e=>[...e.lessons].sort((n,r)=>n.index-r.index).filter(n=>n.state==="published"))}function $mr(t,e){const n=Dmr(t);return n.length===0||!n.some(r=>r.id===e)?!1:n.every(r=>r.isCompleted||r.id===e)}function Omr(t,e){if(e<=0)return 0;const n=Math.round(t/e*100);return Math.min(100,Math.max(0,n))}function Fmr(t){return t>=100?"completed":t>0?"in-progress":"todo"}function Bmr(t){return t===!0||t==="joined"?"joined":t==="requested"?"requested":"not-joined"}function Umr(t){return!!(t.isRealAdmin??t.isAdmin)||t.joinStatus==="joined"}function zmr(t){return t==="draft"||t==="published"||t==="closed-free"||t==="closed-paid"||t==="open"?t:"draft"}function Vmr(t){return t==="draft"?"draft":"published"}function Hmr(t){return t==="structured"||t==="scheduled"?t:"self-paced"}function Gmr(t,e){var n;return{id:t.id,title:((n=t.title)==null?void 0:n.trim())||"Untitled lesson",description:t.description,coverMedia:t.coverMedia??null,state:Vmr(t.state),index:t.index??0,isCompleted:!!t.isCompleted,isLocked:!!t.isLocked,lockedReason:t.lockedReason??null,commentsEnabled:t.commentsEnabled!==!1,durationMinutes:t.durationMinutes??0,autoDurationMinutes:t.autoDurationMinutes??0,sectionId:e??t.section,blocks:t.blocks??[]}}function Wmr(t){var n;const e=(t.lessons??[]).map(r=>Gmr(r,t.id)).sort((r,s)=>r.index-s.index);return{id:t.id,name:((n=t.name)==null?void 0:n.trim())||"Untitled section",emoji:t.emoji??"📚",index:t.index??0,unlockAfterDays:t.unlockAfterDays??0,releaseAt:t.releaseAt??null,unlockAt:t.unlockAt??null,isLocked:!!t.isLocked,lessons:e}}function _Et(t){var i,o,l,c,d,u;const e=Bmr(t.joinStatus),n=t.totalLessons,r=t.lessonsCompleted,s=n!=null&&r!=null?Omr(r,n):void 0;return{id:t.id,title:((i=t.title)==null?void 0:i.trim())||"Untitled course",banner:t.banner??null,state:zmr(t.state),joinStatus:e,isJoined:e==="joined",visibleToNonMembers:t.visibleToNonMembers!==!1,deliveryMode:Hmr(t.deliveryMode),enforceLessonOrder:!!t.enforceLessonOrder,meta:t.meta,totalLessons:n,lessonsCompleted:r,progressPercent:s,completedAt:t.completedAt??null,progressBucket:s!=null?Fmr(s):void 0,group:qmr(t.group),description:t.description??"",durationMinutes:t.durationMinutes??0,lessonCount:t.lessonCount??0,author:(o=t.author)!=null&&o.name?{id:t.author.id,name:t.author.name,picture:t.author.picture??null}:null,likeCount:t.likeCount??0,likedByMe:!!t.likedByMe,savedByMe:!!t.savedByMe,paywall:{required:!!((l=t.paywall)!=null&&l.required),entitled:!!((c=t.paywall)!=null&&c.entitled),fromPrice:((d=t.paywall)==null?void 0:d.fromPrice)??null,plans:((u=t.paywall)==null?void 0:u.plans)??[]}}}function qmr(t){var e;return t!=null&&t.id?{id:t.id,name:((e=t.name)==null?void 0:e.trim())||"Group",groupType:t.groupType,joinStatus:t.joinStatus??null}:null}function AEt(t,e=!1){return _Et(t)}function PEt(t){const e=!!t.isAdmin;return{isAdmin:e,courses:(t.courses??[]).map(n=>AEt(n,e))}}function Kmr(t){const e=t.course,n=(e.sections??[]).map(Wmr).sort((s,i)=>s.index-i.index),r=n.flatMap(s=>s.lessons);return{..._Et(e),description:e.description,durationMinutes:r.reduce((s,i)=>s+PZ(i),0),lessonCount:r.length,sections:n,folders:(e.folders??[]).map(s=>({name:s.name,links:s.links??[]})),links:e.links??[],isAdmin:!!t.isAdmin,subscriptionIds:e.subscriptionIds}}function Ymr(t,e){const n=t.isRealAdmin??t.isAdmin,r=n&&e,s=t.sections.flatMap(i=>i.lessons).filter(i=>r||i.state==="published");return{...t,isRealAdmin:n,isAdmin:r,durationMinutes:s.reduce((i,o)=>i+PZ(o),0),lessonCount:s.length}}function Qmr(t){var e;return{id:t.id,name:((e=t.name)==null?void 0:e.trim())||"Member",email:t.email??null,mobile:t.mobile??null,picture:t.picture??null,courseStatus:t.courseStatus??"joined",completedLessons:t.completedLessons??0,totalLessons:t.totalLessons??0,progressPercent:t.progressPercent??0,joinedAt:t.joinedAt??null,access:t.access??null}}function Zmr(t){var e;return{members:(t.members??[]).map(Qmr),page:t.page??1,limit:t.limit??20,total:t.total??((e=t.members)==null?void 0:e.length)??0}}function REt(){const{community:t}=qe(),e=t==null?void 0:t.id;return lt({queryKey:["knowledge-courses",e],queryFn:async()=>{const n=await CEt(e);return PEt(n)},enabled:!!e,staleTime:3e4})}function IEt({count:t}){return t<=0?null:a.jsx("span",{className:"ml-auto inline-flex h-4 min-w-4 shrink-0 items-center justify-center rounded-full bg-destructive px-1 text-[10px] font-semibold leading-none text-destructive-foreground","aria-label":`${t} unread ${t===1?"message":"messages"}`,children:t>99?"99+":t})}const QR="transition-colors duration-200 ease-linear",Jmr="flex flex-col bg-card border-[hsl(var(--circle-sidebar-border))] text-[hsl(var(--circle-sidebar-fg))]",MEt="text-[13px] lg:text-[length:var(--circle-sidebar-desktop-font-size,13px)]",LEt="text-[12.5px] lg:text-[length:calc(var(--circle-sidebar-desktop-font-size,13px)-0.5px)]",tF="focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring",DEt=t=>ee("group/nav flex min-h-9 w-full select-none items-center gap-3 rounded-lg px-3 py-1.5 leading-5",MEt,QR,tF,t?"bg-[hsl(var(--circle-sidebar-active))] font-medium text-[hsl(var(--circle-sidebar-active-fg))] hover:bg-[hsl(var(--circle-sidebar-active))]/90 dark:bg-[hsl(var(--circle-sidebar-active))]/20 dark:hover:bg-[hsl(var(--circle-sidebar-active))]/25":"text-[hsl(var(--circle-sidebar-fg))] hover:bg-[hsl(var(--circle-sidebar-hover))] hover:text-[hsl(var(--circle-sidebar-selected-fg))]"),KB=t=>ee("group/nav flex min-h-8 w-full select-none items-center gap-2.5 rounded-md px-2.5 py-1.5 leading-5",LEt,QR,tF,t?"bg-[hsl(var(--circle-sidebar-hover))] font-medium text-[hsl(var(--circle-sidebar-selected-fg))]":"text-[hsl(var(--circle-sidebar-fg))] hover:bg-[hsl(var(--circle-sidebar-hover))] hover:text-[hsl(var(--circle-sidebar-selected-fg))]"),$Et="flex flex-col gap-y-0.5 border-l border-[hsl(var(--circle-sidebar-border))] pl-2";function AV({label:t,collapsed:e,divider:n=!1}){return e?n?a.jsx("div",{className:"mx-1 my-2 h-px bg-[hsl(var(--circle-sidebar-border))]",role:"separator"}):null:a.jsx("div",{className:ee(n&&"mt-2 border-t border-[hsl(var(--circle-sidebar-border))] pt-3"),children:a.jsx("p",{className:"px-3 pb-1 pt-1 text-[11px] font-semibold uppercase tracking-[0.08em] text-[hsl(var(--circle-sidebar-fg))]/70",children:t})})}function Ev({active:t,icon:e,collapsed:n,title:r,children:s,unreadCount:i=0,...o}){return a.jsxs(vr,{title:r,className:ee(DEt(t),n&&"justify-center px-0"),...o,children:[a.jsxs("span",{className:"relative flex h-5 w-5 shrink-0 items-center justify-center [&>svg]:h-[18px] [&>svg]:w-[18px]",children:[e,n&&i>0&&a.jsx("span",{className:"absolute -right-0.5 -top-0.5 h-2 w-2 rounded-full bg-destructive","aria-label":`${i} unread`})]}),!n&&a.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-2",children:[a.jsx("span",{className:"min-w-0 break-words",children:s}),a.jsx(IEt,{count:i})]})]})}function nF({active:t,icon:e,children:n,title:r,...s}){return a.jsxs(vr,{title:r,className:KB(t),...s,children:[e?a.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center text-sm [&>svg]:h-4 [&>svg]:w-4",children:e}):null,a.jsx("span",{className:"min-w-0 flex-1 break-words",children:n})]})}function Xmr({title:t,expanded:e,onToggle:n,children:r,className:s,action:i,leading:o,titleReserveClassName:l="group-hover/space:max-w-[calc(100%-1.25rem)]"}){return a.jsxs("div",{className:ee("group/space relative",s),children:[a.jsx("button",{type:"button",onClick:n,"aria-expanded":e,className:ee("flex min-h-8 w-full select-none items-center justify-between rounded-md px-2.5 py-1.5 text-left",LEt,"font-medium leading-5 text-[hsl(var(--circle-sidebar-fg))]","hover:bg-[hsl(var(--circle-sidebar-hover))] hover:text-[hsl(var(--circle-sidebar-selected-fg))]",QR,tF),children:a.jsxs("span",{className:ee("flex min-w-0 flex-1 items-center gap-px",l),children:[o?a.jsx("span",{className:"mr-2.5 flex h-5 w-5 shrink-0 items-center justify-center",children:o}):null,a.jsx("span",{className:"min-w-0 truncate",title:t,children:t}),a.jsx("span",{className:ee("ml-1 mr-auto flex h-5 w-5 shrink-0 items-center justify-center rounded-sm opacity-50","group-hover/space:opacity-100 hover:bg-black/5",e&&"rotate-90",QR),"aria-hidden":!0,children:a.jsx(io,{className:"h-3.5 w-3.5"})})]})}),i?a.jsx("span",{className:"absolute right-1.5 top-1.5 z-20 hidden group-hover/space:flex",children:i}):null,e?a.jsx("div",{className:ee($Et,"ml-5 mt-0.5"),children:r}):null]})}function rF({title:t,expanded:e,onToggle:n,icon:r,collapsed:s,active:i,children:o,locked:l}){const c=y.useId();return s?a.jsx("button",{type:"button",title:t,onClick:n,"aria-label":t,className:ee("flex min-h-9 w-full items-center justify-center rounded-lg",QR,tF,i?"bg-[hsl(var(--circle-sidebar-active))] text-[hsl(var(--circle-sidebar-active-fg))] dark:bg-[hsl(var(--circle-sidebar-active))]/20":"text-[hsl(var(--circle-sidebar-fg))] hover:bg-[hsl(var(--circle-sidebar-hover))]"),children:a.jsx("span",{className:"flex h-5 w-5 items-center justify-center [&>svg]:h-[18px] [&>svg]:w-[18px]",children:r})}):a.jsxs("div",{className:"group/flat",children:[a.jsxs("button",{type:"button",onClick:n,"aria-expanded":e,"aria-controls":c,className:ee("flex min-h-9 w-full select-none items-center justify-between gap-2 rounded-lg px-3 py-1.5 text-left",MEt,"font-semibold leading-5",QR,tF,"text-[hsl(var(--circle-sidebar-selected-fg))] hover:bg-[hsl(var(--circle-sidebar-hover))]",i&&"bg-[hsl(var(--circle-sidebar-hover))]/60"),children:[a.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[r?a.jsx("span",{className:"flex h-5 w-5 shrink-0 items-center justify-center [&>svg]:h-[18px] [&>svg]:w-[18px]",children:r}):null,a.jsx("span",{className:"min-w-0 break-words",children:t}),l&&a.jsx(wa,{className:"h-3 w-3 shrink-0 opacity-60"})]}),a.jsx(li,{className:ee("h-4 w-4 shrink-0 opacity-60 transition-transform duration-200",e&&"rotate-180"),"aria-hidden":!0})]}),e?a.jsx("div",{id:c,className:ee($Et,"ml-[1.375rem] mt-0.5 pb-1"),children:o}):null]})}function $Ve({src:t}){return a.jsx("img",{src:t,alt:"",className:"h-4 w-4 shrink-0 rounded object-cover"})}const efr={none:{section:"",flat:""},add:{section:"group-hover/space:max-w-[calc(100%-1.25rem)]",flat:"group-hover/reorder:pr-3"},reorder:{section:"group-hover/space:max-w-[calc(100%-1.75rem)]",flat:"group-hover/reorder:pr-6"},both:{section:"group-hover/space:max-w-[calc(100%-3.25rem)]",flat:"group-hover/reorder:pr-12"}},tfr="group-hover/channel:flex group-focus-within/channel:flex [@media(hover:none)]:flex",nfr="group-hover/channel:pr-4 group-focus-within/channel:pr-4 [@media(hover:none)]:pr-4";function PV({color:t}){return t?a.jsx("span",{className:"h-2.5 w-2.5 shrink-0 rounded-full border border-black/10",style:{backgroundColor:t},"aria-hidden":!0}):a.jsx(nI,{className:"h-4 w-4 shrink-0 opacity-70"})}function rfr({courses:t,pathname:e}){return t.length===0?null:a.jsx(a.Fragment,{children:t.map(n=>a.jsx(nF,{to:ve.knowledgeCourse(n.id),title:n.title,icon:a.jsx(kE,{className:"h-4 w-4"}),active:xEt(e,n.id),children:n.title},n.id))})}function sfr({groups:t,isLoading:e,sidebarCollapsed:n}){const r=Di(),s=Tn(),[i,o]=y.useState({}),[l,c]=y.useState(!0),d=new URLSearchParams(r.search).get("section"),{counts:u}=dse(),{community:h}=qe(),{refetchGroups:m,communityDetail:f}=Ln(),p=jN(f),{data:g}=REt(),v=y.useMemo(()=>p?new Map:nmr(g==null?void 0:g.courses,{includeDrafts:!!(g!=null&&g.isAdmin)}),[p,g==null?void 0:g.courses,g==null?void 0:g.isAdmin]),b=(h==null?void 0:h.myRole)==="admin"||!!(h!=null&&h.isByMe),x=ql(f,"collapseSidebarGroupLinks"),[w,k]=y.useState(!1),[S,C]=y.useState(null),[j,E]=y.useState(null),N=async(A,_)=>{if(!(h!=null&&h.id)||w)return;const T=A+_;if(T<0||T>=t.length)return;const R=[...t];[R[A],R[T]]=[R[T],R[A]],k(!0);try{await lhr(h.id,R.map((O,F)=>({groupId:O.id,sortOrder:F}))),m()}finally{k(!1)}};return y.useEffect(()=>{t.length&&o(A=>{const _={...A};for(const T of t){const R=r.pathname===M1(T);((v.get(T.id)??[]).some(F=>xEt(r.pathname,F.id))||R&&_[T.id]===void 0)&&(_[T.id]=!0)}return _})},[t,r.pathname,d,v]),n?a.jsx("div",{className:"mt-2 flex flex-col gap-y-1 px-2",children:t.map(A=>{const _=M1(A),T=(A.tabs??[]).filter(F=>Hxe(F,A)),R=T[0]?_x(A,T[0]):_,O=T.reduce((F,D)=>F+(u[D.id]??0),0);return a.jsxs(vr,{to:R,title:A.name,className:ee("relative flex h-8 items-center justify-center rounded-md transition-colors duration-200",r.pathname===_?"bg-[hsl(var(--circle-sidebar-hover))]":"hover:bg-[hsl(var(--circle-sidebar-hover))]"),children:[a.jsx(PV,{color:A.color}),O>0&&a.jsx("span",{className:"absolute right-0.5 top-0.5 h-2 w-2 rounded-full bg-destructive","aria-hidden":!0})]},A.id)})}):!e&&t.length===0?null:a.jsxs("div",{className:ee("group-link-holder mt-1 px-3"),children:[a.jsxs(rF,{title:s("My Groups"),icon:a.jsx(wr,{}),expanded:l,onToggle:()=>c(A=>!A),active:t.some(A=>r.pathname===M1(A)),children:[e?a.jsx("p",{className:"px-2.5 py-1.5 text-[12.5px] text-[hsl(var(--circle-sidebar-fg))] opacity-70",children:s("Loading groups…")}):null,t.map((A,_)=>{const T=M1(A),R=(A.tabs??[]).filter(W=>Hxe(W,A)),O=R[0],F=O?_x(A,O):T,D=i[A.id]??!x,I=r.pathname===T,P=v.get(A.id)??[],z=R.length>0||P.length>0,G=sse(A),B=efr[b&&G?"both":b?"reorder":G?"add":"none"],H=b||G?a.jsxs("span",{className:"flex h-5 items-center gap-0.5",children:[b?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",title:"Move group up",disabled:w||_===0,onClick:W=>{W.preventDefault(),N(_,-1)},className:"flex h-5 w-4 items-center justify-center rounded-sm hover:bg-black/10 disabled:opacity-30",children:a.jsx(Zf,{className:"h-3 w-3"})}),a.jsx("button",{type:"button",title:"Move group down",disabled:w||_===t.length-1,onClick:W=>{W.preventDefault(),N(_,1)},className:"flex h-5 w-4 items-center justify-center rounded-sm hover:bg-black/10 disabled:opacity-30",children:a.jsx(w0,{className:"h-3 w-3"})})]}):null,G?a.jsx("button",{type:"button",title:"Add channel",onClick:W=>{W.preventDefault(),W.stopPropagation(),C(A)},className:"flex h-5 w-5 items-center justify-center rounded-sm hover:bg-black/10",children:a.jsx(Dn,{className:"h-3.5 w-3.5"})}):null]}):null;return z?a.jsx("div",{className:"group/reorder relative",children:a.jsxs(Xmr,{title:A.name,leading:A.icon?a.jsx($Ve,{src:A.icon}):a.jsx(PV,{color:A.color}),expanded:D,onToggle:()=>o(W=>({...W,[A.id]:!D})),action:H,titleReserveClassName:B.section,children:[R.map(W=>{const V=I&&d===W.id,U=u[W.id]??0;return a.jsxs("div",{className:"group/channel relative",children:[a.jsx(nF,{to:_x(A,W),title:W.name,icon:W.emoji?a.jsx("span",{className:"text-xs leading-none",children:W.emoji}):a.jsx(PV,{color:A.color}),active:V,children:a.jsxs("span",{className:ee("flex min-w-0 flex-1 items-center gap-2",G&&nfr),children:[a.jsx("span",{className:ee("min-w-0 truncate",U>0&&"font-semibold text-foreground"),children:W.name}),(W.isClosed||W.isPrivate)&&a.jsx(wa,{className:"h-3 w-3 shrink-0 opacity-50","aria-label":W.isPrivate?"Private channel":"Closed channel"}),Mf(W)?a.jsx("span",{className:"shrink-0 text-[10px] uppercase tracking-wide opacity-50",children:"chat"}):null,a.jsx(IEt,{count:U})]})}),G?a.jsx("button",{type:"button",title:"Edit channel","aria-label":`Edit channel ${W.name}`,onClick:()=>E({group:A,tab:W}),className:ee("absolute right-1.5 top-1.5 z-10 hidden h-5 w-5 items-center justify-center rounded-sm","text-[hsl(var(--circle-sidebar-fg))] hover:bg-black/10",tfr),children:a.jsx(Ys,{className:"h-3.5 w-3.5"})}):null]},W.id)}),a.jsx(rfr,{courses:P,pathname:r.pathname})]})},A.id):a.jsxs("div",{className:"group/reorder relative",children:[a.jsx(nF,{to:F,title:A.name,icon:A.icon?a.jsx($Ve,{src:A.icon}):a.jsx(PV,{color:A.color}),active:I,children:a.jsx("span",{className:ee("block truncate",B.flat),children:A.name})}),H?a.jsx("span",{className:"absolute right-1.5 top-1.5 z-20 hidden group-hover/reorder:flex",children:H}):null]},A.id)})]}),S&&a.jsx(DZ,{group:S,open:!!S,onOpenChange:A=>{A||C(null)},refetchGroups:m}),j&&a.jsx(DZ,{group:j.group,channel:j.tab,open:!0,onOpenChange:A=>{A||E(null)},refetchGroups:m})]})}const SAe=t=>encodeURIComponent(t),ifr=t=>ae.get(`/community/${SAe(t)}/spatial-room`),afr=t=>ae.get(`/community/${SAe(t)}/spatial-room/admin`),ofr=(t,e)=>ae.put(`/community/${SAe(t)}/spatial-room`,{items:e}),OEt=t=>["spatial-room",t];function lfr(t){let e;try{e=new URL(t.trim())}catch{return!1}return e.protocol==="https:"&&!e.username&&!e.password&&!e.port&&e.hostname.toLowerCase()==="app.spatial.chat"&&/^\/s\/[A-Za-z0-9_-]+\/?$/.test(e.pathname)}const OZ=(t,e)=>t.filter(n=>n.parent===e);function s0e(t,e){let n=0;const r=new Map(t.map(s=>[s.id,s]));for(let s=e?r.get(e):void 0;s;s=s.parent?r.get(s.parent):void 0)n++;return n}function gA(t,e){const n=new Set([e]);let r=!0;for(;r;){r=!1;for(const s of t)s.parent&&n.has(s.parent)&&!n.has(s.id)&&(n.add(s.id),r=!0)}return n}const cfr=t=>t.filter(e=>e.type==="link"&&e.url);function FEt(){const{community:t}=qe(),e=(t==null?void 0:t.id)??null;return lt({queryKey:OEt(e),queryFn:()=>ifr(e),enabled:!!e,staleTime:6e4,retry:1})}function dfr({item:t,items:e}){const[n,r]=y.useState(!1),s=y.useId();return a.jsxs("div",{children:[a.jsxs("button",{type:"button",onClick:()=>r(i=>!i),"aria-expanded":n,"aria-controls":s,title:t.name,className:KB(!1),children:[a.jsx(io,{className:ee("h-4 w-4 shrink-0 opacity-70 transition-transform duration-200",n&&"rotate-90"),"aria-hidden":!0}),a.jsx("span",{className:"min-w-0 flex-1 break-words text-left",children:t.name})]}),n&&a.jsx("div",{id:s,className:"ml-4 mt-0.5 flex flex-col gap-y-0.5 border-l border-[hsl(var(--circle-sidebar-border))] pl-2",children:a.jsx(BEt,{items:e,parent:t.id})})]})}function BEt({items:t,parent:e}){const n=Tn();return a.jsx(a.Fragment,{children:OZ(t,e).map(r=>r.type==="menu"?a.jsx(dfr,{item:r,items:t},r.id):a.jsxs("a",{href:r.url,target:"_blank",rel:"noopener noreferrer",title:n("Opens in a new tab"),className:KB(!1),children:[a.jsx(Qd,{className:"h-4 w-4 shrink-0"}),a.jsx("span",{className:"min-w-0 flex-1 break-words",children:r.name}),a.jsx(R8,{className:"h-3.5 w-3.5 shrink-0 opacity-50","aria-hidden":!0})]},r.id))})}function ufr({sidebarCollapsed:t,onExpandSidebar:e}){const n=Tn(),{data:r}=FEt(),[s,i]=y.useState(!0),o=r!=null&&r.enabled?r.items:[],l=cfr(o);return l.length?a.jsx("div",{className:ee("mt-1",t?"px-2":"px-3"),children:a.jsx(rF,{title:n("Spatial Room"),icon:a.jsx(Qd,{}),collapsed:t,expanded:s,onToggle:()=>{if(!t)return i(!s);l.length===1?window.open(l[0].url,"_blank","noopener,noreferrer"):(i(!0),e())},children:a.jsx(BEt,{items:o,parent:null})})}):null}const i0e="pensil.wa.session",OVe="pensil.wa.lastActivity",UEt=30*6e4;function zEt(){try{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID()}catch{}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}let qb=null;function VEt(t){const e=!qb||t-qb.last>UEt;return qb={id:e||!qb?zEt():qb.id,last:t},{id:qb.id,rotated:e}}function hfr(){try{return sessionStorage.getItem(i0e)||CAe().id}catch{return(qb==null?void 0:qb.id)||VEt(Date.now()).id}}function CAe(t=Date.now()){try{const e=sessionStorage.getItem(i0e),n=Number(sessionStorage.getItem(OVe)||0),r=!e||!n||t-n>UEt,s=r?zEt():e;return sessionStorage.setItem(i0e,s),sessionStorage.setItem(OVe,String(t)),{id:s,rotated:r}}catch{return VEt(t)}}const FVe="pensil.wa.visitor";function BVe(){return new Date().toISOString().slice(0,10)}function HEt(){try{if(typeof crypto<"u"&&crypto.randomUUID)return crypto.randomUUID()}catch{}return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,10)}`}function GEt(){try{const t=navigator,e=window,n=navigator.doNotTrack||e.doNotTrack||t.msDoNotTrack;return n==="1"||n==="yes"||n===!0}catch{return!1}}function mfr(){try{const e=localStorage.getItem(FVe);if(e){const n=JSON.parse(e);if(n!=null&&n.id&&n.day===BVe())return n.id}}catch{}const t=HEt();try{localStorage.setItem(FVe,JSON.stringify({id:t,day:BVe()}))}catch{}return t}let ck=null,a0e="",E$=null,UVe=!1;function WEt(t,e){try{const r=`${wo.apiBaseUrl.replace(/\/$/,"")}/community/${encodeURIComponent(t.communityId)}/analytics/web/collect`,s=new URLSearchParams(window.location.search),i=Nd();fetch(r,{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json",...i?{Authorization:`Bearer ${i}`}:{}},body:JSON.stringify({event:e,viewId:t.viewId,visitorId:t.visitorId,sessionId:t.sessionId,path:t.path,durationSec:e==="page-exit"?Math.max(0,Math.round((Date.now()-t.enteredAt)/1e3)):void 0,referrer:document.referrer||"",utmSource:s.get("utm_source")||void 0})}).catch(()=>{})}catch{}}function FZ(){ck&&(WEt(ck,"page-exit"),ck=null,a0e="")}function ffr(){UVe||(UVe=!0,document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"?FZ():E$&&jAe(E$.communityId,E$.path)}),window.addEventListener("pagehide",FZ))}function pfr(){return(ck==null?void 0:ck.viewId)||null}function zVe(){E$=null,FZ()}function jAe(t,e){if(!t||GEt())return;ffr();const n=e.split("?")[0].split("#")[0]||"/";E$={communityId:t,path:n};const r=CAe().id,s=`${t}:${r}:${n}`;s!==a0e&&(FZ(),a0e=s,ck={communityId:t,path:n,viewId:HEt(),visitorId:mfr(),sessionId:r,enteredAt:Date.now()},WEt(ck,"page-view"))}const gfr=6e4,vfr=9e4,yfr=1e3;function bfr(){try{const t=navigator.userAgent||"";return/mobile/i.test(t)?"Mobile":/tablet|ipad/i.test(t)?"Tablet":"Desktop"}catch{return"Unknown"}}let RV=null;function xfr(t){if(RV&&(RV(),RV=null),!t||GEt())return()=>{};let e=Date.now(),n=0,r=0;const s=()=>{if(e=Date.now(),r+=1,e-n<yfr)return;n=e,CAe(e).rotated&&jAe(t,window.location.pathname||"/")},i=["mousedown","mousemove","keydown","scroll","touchstart"];for(const u of i)window.addEventListener(u,s,{passive:!0});const o=()=>{try{if(document.visibilityState!=="visible"||Date.now()-e>vfr)return;const u=Nd();if(!u)return;const m=`${wo.apiBaseUrl.replace(/\/$/,"")}/community/${encodeURIComponent(t)}/sessions/heartbeat`,f={sessionId:hfr(),pageViewId:pfr(),path:window.location.pathname||"/",device:bfr(),meaningfulEventCount:r};r=0,fetch(m,{method:"POST",keepalive:!0,headers:{"Content-Type":"application/json",Authorization:`Bearer ${u}`},body:JSON.stringify(f)}).catch(()=>{})}catch{}};o();const l=window.setInterval(o,gfr),c=()=>{document.visibilityState==="visible"&&o()};document.addEventListener("visibilitychange",c);const d=()=>{window.clearInterval(l),document.removeEventListener("visibilitychange",c);for(const u of i)window.removeEventListener(u,s)};return RV=d,d}const wfr=6e4;let IV=null;function kfr(t){if(IV&&(IV(),IV=null),!t)return()=>{};const e=()=>{try{const i=Nd();if(!i)return;const o=wo.apiBaseUrl.replace(/\/$/,"");fetch(`${o}/community/${encodeURIComponent(t)}/presence`,{method:"POST",keepalive:!0,headers:{Authorization:`Bearer ${i}`}}).catch(()=>{})}catch{}},n=()=>{document.visibilityState==="visible"&&e()};n();const r=window.setInterval(n,wfr);document.addEventListener("visibilitychange",e),window.addEventListener("pagehide",e);const s=()=>{window.clearInterval(r),document.removeEventListener("visibilitychange",e),window.removeEventListener("pagehide",e)};return IV=s,s}const EAe="pensil.darkMode";function qEt(){return localStorage.getItem(EAe)==="1"}function Sfr(){return localStorage.getItem(EAe)!==null}function Cfr(){document.documentElement.classList.toggle("dark",qEt())}function jfr(){const t=!document.documentElement.classList.contains("dark");return document.documentElement.classList.toggle("dark",t),localStorage.setItem(EAe,t?"1":"0"),t}const KEt={groups:0,sections:0,posts:0,comments:0,replies:0,users:0,events:0,courses:0,resources:0},Efr={groups:[],sections:[],posts:[],comments:[],replies:[],users:[],events:[],courses:[],resources:[],counts:KEt,page:1,limit:15};async function Nfr(t,e,n={}){const r=new URLSearchParams({search:e});n.type&&r.set("type",n.type),n.page&&r.set("page",String(n.page)),n.limit&&r.set("limit",String(n.limit));const s=await ae.get(`/community/${encodeURIComponent(t)}/search?${r.toString()}`);return{...Efr,...Object.fromEntries(Object.entries(s??{}).filter(([,i])=>Array.isArray(i))),counts:{...KEt,...(s==null?void 0:s.counts)??{}},page:(s==null?void 0:s.page)??n.page??1,limit:(s==null?void 0:s.limit)??n.limit??15}}const P3=15,YEt=3,QEt=[{key:"all",label:"All",icon:hs},{key:"posts",label:"Posts",icon:Ei},{key:"users",label:"Members",icon:k2},{key:"groups",label:"Groups",icon:wr},{key:"sections",label:"Channels",icon:nI},{key:"comments",label:"Comments",icon:Vi},{key:"replies",label:"Replies",icon:bK},{key:"events",label:"Events",icon:I8},{key:"courses",label:"Courses",icon:kE},{key:"resources",label:"Knowledge Hub",icon:HBt}];function Tfr(){const{community:t}=qe(),e=(t==null?void 0:t.id)??null,n=Nn(),r=y.useRef(null),[s,i]=y.useState(""),[o,l]=y.useState(""),[c,d]=y.useState(!1),[u,h]=y.useState("all"),[m,f]=y.useState(1);y.useEffect(()=>{const k=setTimeout(()=>l(s.trim()),350);return()=>clearTimeout(k)},[s]),y.useEffect(()=>{h("all"),f(1)},[o]);const{data:p,isFetching:g}=lt({queryKey:["community-search",e,o,u,m],queryFn:()=>Nfr(e,o,u==="all"?{limit:YEt}:{type:u,page:m,limit:P3}),enabled:!!e&&o.length>=2,staleTime:3e4,placeholderData:Uy});y.useEffect(()=>{const k=S=>{r.current&&!r.current.contains(S.target)&&d(!1)};return document.addEventListener("mousedown",k),()=>document.removeEventListener("mousedown",k)},[]);const v=k=>{d(!1),i(""),n(k)},b=k=>{h(k),f(1)},x=p==null?void 0:p.counts,w=x?x.groups+x.sections+x.posts+x.comments+x.replies+x.users+x.events+x.courses+x.resources:0;return a.jsxs("div",{ref:r,className:"relative flex items-center",children:[a.jsx(hs,{className:"absolute left-3 h-4 w-4 text-muted-foreground pointer-events-none"}),a.jsx("input",{type:"text",placeholder:"Search",value:s,onChange:k=>{i(k.target.value),d(!0)},onFocus:()=>d(!0),onKeyDown:k=>k.key==="Escape"&&d(!1),className:"h-9 w-44 rounded-full border border-border bg-muted/50 pl-9 pr-4 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring focus:bg-background transition-colors focus:w-64"}),c&&o.length>=2&&a.jsxs("div",{className:"absolute right-0 top-11 z-50 w-[min(92vw,560px)] rounded-lg border border-border bg-card shadow-lg",children:[a.jsx("div",{className:"flex items-center gap-0.5 overflow-x-auto overflow-y-hidden border-b border-border px-2 pt-1.5 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",children:QEt.map(k=>{const S=k.key==="all"?w:(x==null?void 0:x[k.key])??0,C=u===k.key;return a.jsxs("button",{type:"button",onClick:()=>b(k.key),className:ee("relative flex shrink-0 items-center gap-1 px-2.5 py-1.5 text-xs transition-colors",C?"font-semibold text-foreground":"text-muted-foreground hover:text-foreground"),children:[k.label,x&&S>0&&a.jsx("span",{className:"rounded-full bg-muted px-1.5 text-[10px] text-muted-foreground",children:S}),C&&a.jsx("span",{className:"absolute inset-x-1 -bottom-px h-0.5 rounded bg-primary"})]},k.key)})}),a.jsxs("div",{className:"max-h-[60vh] overflow-y-auto",children:[g&&!p&&a.jsxs("div",{className:"flex items-center gap-2 px-4 py-3 text-sm text-muted-foreground",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"})," Searching…"]}),p&&(u==="all"?w===0:((x==null?void 0:x[u])??0)===0)&&!g&&a.jsxs("p",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:["No results for “",o,"”"]}),p&&u==="all"&&w>0&&a.jsxs(a.Fragment,{children:[x&&x.users>0&&a.jsx("p",{className:"px-4 pt-2 text-[11px] text-muted-foreground",children:"Includes posts, comments, events, courses and resources by the members found."}),a.jsx(_fr,{data:p,go:v,onViewAll:b})]}),p&&u!=="all"&&((x==null?void 0:x[u])??0)>0&&a.jsx("div",{className:"py-1",children:a.jsx(ZEt,{category:u,data:p,go:v})})]}),p&&u!=="all"&&((x==null?void 0:x[u])??0)>P3&&a.jsxs("div",{className:"flex items-center justify-between border-t border-border px-3 py-2 text-xs text-muted-foreground",children:[a.jsxs("span",{children:[(m-1)*P3+1,"–",Math.min(m*P3,x[u])," of ",x[u]]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button",disabled:m<=1||g,onClick:()=>f(k=>Math.max(1,k-1)),className:"rounded-md border border-border p-1 hover:bg-muted disabled:opacity-40","aria-label":"Previous page",children:a.jsx(nl,{className:"h-3.5 w-3.5"})}),a.jsx("button",{type:"button",disabled:m*P3>=x[u]||g,onClick:()=>f(k=>k+1),className:"rounded-md border border-border p-1 hover:bg-muted disabled:opacity-40","aria-label":"Next page",children:a.jsx(io,{className:"h-3.5 w-3.5"})})]})]})]})]})}function _fr({data:t,go:e,onViewAll:n}){return a.jsx("div",{className:"py-1",children:QEt.filter(r=>r.key!=="all").map(r=>{const s=r.key,i=t.counts[s];return i?a.jsxs("div",{className:"border-b border-border last:border-b-0",children:[a.jsxs("div",{className:"flex items-center justify-between px-4 pb-1 pt-2.5",children:[a.jsxs("p",{className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[a.jsx(r.icon,{className:"h-3.5 w-3.5"})," ",r.label]}),i>YEt&&a.jsxs("button",{type:"button",onClick:()=>n(r.key),className:"text-xs font-medium text-primary hover:underline",children:["View all ",i]})]}),a.jsx(ZEt,{category:s,data:t,go:e})]},r.key):null})})}function ZEt({category:t,data:e,go:n}){switch(t){case"groups":return a.jsx(a.Fragment,{children:e.groups.map(r=>a.jsx(uw,{label:r.name,onClick:()=>n(M1(r))},r.id))});case"sections":return a.jsx(a.Fragment,{children:e.sections.map(r=>r.group?a.jsx(uw,{label:`${r.emoji?`${r.emoji} `:""}${r.name??"Channel"}`,sub:r.group.name,onClick:()=>n(_x(r.group,{id:r.id}))},r.id):null)});case"posts":return a.jsx(a.Fragment,{children:e.posts.map(r=>{var s,i;return a.jsx(uw,{label:r.title||R3(r.description)||"Untitled post",sub:(s=r.preferences)!=null&&s.hideCreator||(i=r.createdBy)==null?void 0:i.name,onClick:()=>n(ve.post(r.id))},r.id)})});case"comments":case"replies":return a.jsx(a.Fragment,{children:e[t].map(r=>{var s,i;return(s=r.post)!=null&&s.id?a.jsx(uw,{label:R3(r.description)||(t==="replies"?"Reply":"Comment"),sub:VVe((i=r.createdBy)==null?void 0:i.name,r.post.title?`on ${R3(r.post.title)}`:void 0),onClick:()=>n(ve.post(r.post.id))},r.id):null})});case"users":return a.jsx(a.Fragment,{children:e.users.map(r=>a.jsx(uw,{label:r.name,onClick:()=>n(ve.member(r.id))},r.id))});case"events":return a.jsx(a.Fragment,{children:e.events.map(r=>{var s;return a.jsx(uw,{label:r.title??"Event",sub:(s=r.host)!=null&&s.name?`Hosted by ${r.host.name}`:void 0,onClick:()=>n(r.slug?ve.eventBySlug(r.slug):ve.eventDetail(r.id))},r.id)})});case"courses":return a.jsx(a.Fragment,{children:e.courses.map(r=>a.jsx(uw,{label:r.title,sub:VVe(r.authorName,R3(r.description))||"Course",onClick:()=>n(ve.knowledgeCourse(r.id))},r.id))});case"resources":return a.jsx(a.Fragment,{children:e.resources.map(r=>a.jsx(uw,{label:r.title,sub:r.authorName||R3(r.description)||"Knowledge Hub",onClick:()=>n(`${ve.knowledgeHub}?resource=${encodeURIComponent(r.id)}`)},r.id))});default:return null}}function uw({label:t,sub:e,onClick:n}){return a.jsxs("button",{type:"button",onClick:n,className:"block w-full px-4 py-2 text-left hover:bg-muted transition-colors",children:[a.jsx("span",{className:"block truncate text-sm text-foreground",children:t}),e?a.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:e}):null]})}function VVe(...t){return t.filter(Boolean).join(" · ")||void 0}function R3(t){return t?t.replace(/<[^>]+>/g,"").slice(0,80):""}function JEt(t){const e=t==null?void 0:t.configuration;return!e||typeof e!="object"?{}:e}function sF(t){return!!JEt(t).isEventsTabDisabled}function Afr(t,e=[]){return JEt(t).anyoneCanCreateEvent||(t==null?void 0:t.myRole)==="admin"?!0:e.some(n=>n.myRole==="admin"||n.myRole==="moderator")}const XEt="memberAnalyticsTrackingEnabled",HVe="community:member-analytics-tracking-updated",Pfr={configKey:XEt,label:"Member Analytics tracking",hint:"Record each member's active time and page journeys, and show Look up a user in Insights. This is off by default. Turning it off stops new collection while preserving existing history; re-enabling does not fill the disabled gap.",defaultValue:!1};function NAe(){const{communityDetail:t}=Ln(),{pac:e,isLoading:n}=SN(),r=ql(t,XEt,!1),s=!l0(e,"memberAnalytics");return{switchOn:r,included:s,active:r&&s&&!n,planLoading:!!n}}const ZR=t=>encodeURIComponent(t);async function Rfr(t){return(await ae.get(`/community/${ZR(t)}/links`)).links??[]}async function Ifr(t,e){return(await ae.post(`/community/${ZR(t)}/links`,e)).link}async function Mfr(t,e,n){return(await ae.post(`/community/${ZR(t)}/links/${ZR(e)}`,n)).link}async function Lfr(t,e){await ae.delete(`/community/${ZR(t)}/links/${ZR(e)}`)}function eNt(t){const e=t.trim();return/^https?:\/\//i.test(e)?e:`https://${e}`}function tNt(){const{community:t}=qe(),e=(t==null?void 0:t.id)??null,{data:n=[]}=lt({queryKey:["community-links",e],enabled:!!e,staleTime:6e4,queryFn:()=>Rfr(e)});return n}function Dfr({link:t,actions:e}){return a.jsxs("div",{className:"group/link relative",children:[a.jsxs("a",{href:eNt(t.url),target:"_blank",rel:"noopener noreferrer",title:t.label,className:ee(KB(!1),e&&"group-hover/link:pr-14"),children:[t.emoji?a.jsx("span",{className:"w-4 shrink-0 text-center leading-none",children:t.emoji}):a.jsx(bo,{className:"h-4 w-4 shrink-0 opacity-70"}),a.jsx("span",{className:"min-w-0 flex-1 break-words",children:t.label})]}),e&&a.jsx("div",{className:"absolute right-2 top-1/2 hidden -translate-y-1/2 items-center gap-1 group-hover/link:flex",children:e})]})}function $fr({sidebarCollapsed:t}){const{community:e}=qe(),n=(e==null?void 0:e.id)??null,r=(e==null?void 0:e.myRole)==="admin"||!!(e!=null&&e.isByMe),s=rn(),i=tNt(),o=Tn(),[l,c]=y.useState(!0),[d,u]=y.useState(null),[h,m]=y.useState(""),[f,p]=y.useState(""),[g,v]=y.useState(""),b=()=>s.invalidateQueries({queryKey:["community-links",n]}),x=jt({mutationFn:async()=>{const S={emoji:h.trim()||void 0,label:f.trim(),url:eNt(g)};return(d==null?void 0:d.mode)==="edit"?Mfr(n,d.link.id,S):Ifr(n,S)},onSuccess:()=>{b(),u(null),He.success((d==null?void 0:d.mode)==="edit"?"Link updated":"Link added")},onError:()=>He.error("Failed to save link")}),w=jt({mutationFn:S=>Lfr(n,S),onSuccess:()=>{b(),He.success("Link deleted")},onError:()=>He.error("Failed to delete link")}),k=S=>{m(S.mode==="edit"?S.link.emoji??"":""),p(S.mode==="edit"?S.link.label:""),v(S.mode==="edit"?S.link.url:""),u(S)};return!i.length&&!r?null:a.jsxs("div",{className:ee("mt-1",t?"px-2":"px-3"),children:[a.jsxs(rF,{title:o("Links"),icon:a.jsx(eu,{}),collapsed:t,expanded:l,onToggle:()=>c(!l),children:[i.map(S=>a.jsx(Dfr,{link:S,actions:r?a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",title:"Edit link",onClick:()=>k({mode:"edit",link:S}),className:"rounded p-1 text-[hsl(var(--circle-sidebar-fg))]/70 hover:bg-[hsl(var(--circle-sidebar-hover))] hover:text-[hsl(var(--circle-sidebar-fg))]",children:a.jsx(Qs,{className:"h-3 w-3"})}),a.jsx("button",{type:"button",title:"Delete link",onClick:()=>w.mutate(S.id),className:"rounded p-1 text-[hsl(var(--circle-sidebar-fg))]/70 hover:bg-[hsl(var(--circle-sidebar-hover))] hover:text-destructive",children:a.jsx(qn,{className:"h-3 w-3"})})]}):void 0},S.id)),r&&a.jsxs("button",{type:"button",onClick:()=>k({mode:"create"}),className:ee(KB(!1),"opacity-80 hover:opacity-100"),children:[a.jsx(Dn,{className:"h-4 w-4 shrink-0"}),a.jsx("span",{children:"Add link"})]})]}),a.jsx(Bt,{open:d!==null,onOpenChange:S=>!S&&u(null),children:a.jsxs(Ft,{className:"sm:max-w-md",children:[a.jsx(Vt,{children:a.jsx(Ut,{children:(d==null?void 0:d.mode)==="edit"?"Edit link":"Add link"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"link-label",children:"Label"}),a.jsx(Oe,{id:"link-label",value:f,onChange:S=>p(S.target.value),placeholder:"e.g. Club shop"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"link-url",children:"URL"}),a.jsx(Oe,{id:"link-url",value:g,onChange:S=>v(S.target.value),placeholder:"https://…"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"link-emoji",children:"Emoji (optional)"}),a.jsx(Oe,{id:"link-emoji",value:h,onChange:S=>m(S.target.value),placeholder:"e.g. ⚽",maxLength:4})]})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"outline",onClick:()=>u(null),children:"Cancel"}),a.jsx(Z,{disabled:!f.trim()||!g.trim()||x.isPending,onClick:()=>x.mutate(),children:(d==null?void 0:d.mode)==="edit"?"Save":"Add"})]})]})})]})}function YB(t){const e=Array.isArray(t)?t[0]:t;if(!(e!=null&&e.id))throw new ze("Embedded section not found",404);return e}async function Ofr(t,e=!1){return ae.get(`/community/${encodeURIComponent(t)}/embedded-sections?showAll=${e}`)}async function Ffr(t,e){const n=await ae.get(`/community/${encodeURIComponent(t)}/embedded-sections/${encodeURIComponent(e)}`);return YB(n.embeddedSection)}async function Bfr(t,e){const n=await ae.get(`/community/${encodeURIComponent(t)}/embedded-sections/${encodeURIComponent(e)}/admin`);return YB(n.embeddedSection)}async function Ufr(t,e){const n=await ae.post(`/community/${encodeURIComponent(t)}/embedded-sections`,e);return YB(n.embeddedSection)}async function zfr(t,e,n){const r=await ae.post(`/community/${encodeURIComponent(t)}/embedded-sections/${encodeURIComponent(e)}`,n);return YB(r.embeddedSection)}async function Vfr(t,e){await ae.delete(`/community/${encodeURIComponent(t)}/embedded-sections/${encodeURIComponent(e)}`)}async function Hfr(t,e){await ae.post(`/community/${encodeURIComponent(t)}/embedded-sections/update-sort`,{sectionIds:e})}async function Gfr(t,e,n){const r=await ae.post(`/community/${encodeURIComponent(t)}/embedded-sections/${encodeURIComponent(e)}/change-visibility`,{isActive:n});return YB(r.embeddedSection)}function nNt(t=!1){const{community:e}=qe(),n=(e==null?void 0:e.id)??null;return lt({queryKey:["embedded-sections",n,t],enabled:!!n,staleTime:6e4,queryFn:()=>Ofr(n,t),select:r=>r.embeddedSections??[]})}function Wfr({sidebarCollapsed:t}){const e=Di(),{pac:n}=SN(),{data:r=[],isLoading:s}=nNt(!1);return l0(n,"embedSection")||s||r.length===0?null:a.jsx("div",{className:"flex flex-col gap-y-0.5",children:r.map(i=>{const o=ve.embeddedSection(i.slug);return a.jsx(Ev,{to:o,title:i.name,icon:a.jsx(qrt,{}),collapsed:t,active:e.pathname===o,children:i.name},i.id)})})}function o0e(t){return t>99?"99+":String(t)}function GVe({count:t,variant:e="destructive",className:n}){if(t<=0)return null;const r=o0e(t);return a.jsx("span",{className:ee("absolute top-1 right-1 flex h-[1.125rem] min-w-[1.125rem] items-center justify-center rounded-full px-1 text-[10px] font-semibold leading-none text-primary-foreground ring-2 ring-background",e==="destructive"?"bg-destructive":"bg-primary",n),"aria-label":`${r} unread`,children:r})}const qfr={ai:{name:"SpatialChat AI",icon:xo,heroClass:"from-primary via-violet-600 to-fuchsia-500",nameClass:"from-primary to-fuchsia-500",buttonClass:"from-primary to-violet-600",intro:"Your community's own AI assistant is on its way. Here's what it will help you with:",preview:[{icon:x2,text:"Ask anything about your community"},{icon:Ei,text:"Catch up on long discussions in seconds"},{icon:iI,text:"Draft posts, replies and announcements"},{icon:hs,text:"Find the right members, posts and resources"}]},studio:{name:"SpatialChat Studio",icon:Trt,heroClass:"from-orange-500 via-rose-500 to-fuchsia-600",nameClass:"from-orange-500 to-fuchsia-600",buttonClass:"from-orange-500 to-rose-600",intro:"A studio for creating content for your community is on its way. Here's what it will help you with:",preview:[{icon:Ca,text:"Record polished videos and sessions"},{icon:l9t,text:"Turn recordings into short highlights"},{icon:bSe,text:"Give your content your community's look"},{icon:kk,text:"Publish straight to your community"}]}},Kfr=[[18,30,10,0],[80,24,14,.6],[28,72,8,1.1],[74,70,11,.3],[50,14,7,.9]];function Yfr({feature:t,onOpenChange:e}){const n=Tn(),r=v7(),s=y.useRef(t);t&&(s.current=t);const i=s.current?qfr[s.current]:null,o=(i==null?void 0:i.icon)??xo;return a.jsx(Bt,{open:!!t,onOpenChange:e,children:a.jsx(Ft,{className:"themed-scrollbar max-h-[calc(100dvh-2rem)] w-[calc(100vw-2rem)] max-w-md gap-0 overflow-y-auto overflow-x-hidden rounded-2xl p-0 sm:rounded-2xl [&>button:last-child]:rounded-full [&>button:last-child]:bg-white/20 [&>button:last-child]:p-1 [&>button:last-child]:text-white [&>button:last-child]:opacity-90",children:i&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:ee("relative flex h-44 items-center justify-center overflow-hidden bg-gradient-to-br",i.heroClass),children:[a.jsx("div",{className:"absolute -left-10 -top-12 h-40 w-40 rounded-full bg-white/20 blur-2xl","aria-hidden":!0}),a.jsx("div",{className:"absolute -bottom-16 -right-8 h-44 w-44 rounded-full bg-white/15 blur-2xl","aria-hidden":!0}),Kfr.map(([l,c,d,u])=>a.jsx(it.span,{"aria-hidden":!0,className:"absolute text-white",style:{left:`${l}%`,top:`${c}%`},animate:r?void 0:{opacity:[.2,1,.2],scale:[.8,1.15,.8]},transition:{duration:2.4,repeat:1/0,delay:u,ease:"easeInOut"},children:a.jsx(xo,{style:{width:d,height:d}})},`${l}-${c}`)),a.jsx(it.div,{className:"relative flex h-20 w-20 items-center justify-center rounded-3xl bg-white/15 shadow-lg ring-1 ring-white/40 backdrop-blur-md",animate:r?void 0:{y:[0,-6,0]},transition:{duration:3,repeat:1/0,ease:"easeInOut"},children:a.jsx(o,{className:"h-10 w-10 text-white drop-shadow"})}),a.jsx("span",{className:"absolute bottom-3 left-1/2 -translate-x-1/2 rounded-full bg-white/90 px-3 py-1 text-[11px] font-semibold uppercase tracking-wide text-foreground/80 shadow-sm",children:n("Coming soon")})]}),a.jsxs("div",{className:"space-y-5 px-6 pb-6 pt-5 text-center",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(Ut,{className:"text-xl font-bold",children:[n("Meet")," ",a.jsx("span",{className:ee("bg-gradient-to-r bg-clip-text text-transparent",i.nameClass),children:i.name})]}),a.jsx(_n,{children:n(i.intro)})]}),a.jsx("ul",{className:"space-y-2 text-left",children:i.preview.map(({icon:l,text:c},d)=>a.jsxs(it.li,{className:"flex items-center gap-3 rounded-xl border border-border/60 bg-muted/40 px-3 py-2.5",initial:r?!1:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:.12+d*.08,duration:.3},children:[a.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:a.jsx(l,{className:"h-4 w-4"})}),a.jsx("span",{className:"text-sm text-foreground",children:n(c)})]},c))}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(Z,{className:ee("w-full bg-gradient-to-r text-white hover:opacity-95",i.buttonClass),onClick:()=>e(!1),children:[a.jsx(xo,{className:"mr-1.5 h-4 w-4"}),n("Can't wait!")]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:n("You'll find it right here in the sidebar when it's ready.")})]})]})]})})})}function c0(t,e){t(ve.chat,{state:{openUserId:e.id,openUserName:e.name,openUserPicture:e.avatar??null,openUserHandle:e.userId,openCommunityId:e.communityId}})}function Qfr(t,e){t(ve.chat,{state:{openConversationId:e.id,openCommunityId:e.communityId}})}function Zfr({variant:t="menu",className:e,onNavigate:n}){const r=Nn(),{clearCommunity:s,community:i}=qe();if(i!=null&&i.isCommunitySwitcherDisabled)return null;const o=()=>{s(),n==null||n(),r(ve.communities)};return t==="button"?a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:ee("rounded-full",e),onClick:o,children:[a.jsx(LLe,{className:"mr-2 h-4 w-4"}),"Switch community"]}):a.jsxs("button",{type:"button",onClick:o,className:ee("flex w-full items-center gap-3 px-4 py-2.5 text-sm text-foreground hover:bg-muted transition-colors",e),children:[a.jsx(LLe,{className:"h-4 w-4 text-muted-foreground"}),"Switch community"]})}function rNt({community:t,isAdmin:e}){if(!e||!t||!t.planExpiryDate||!t.createdAt)return null;const n=new Date,r=kf(new Date(t.planExpiryDate),n),s=kf(n,new Date(t.createdAt));return Number.isNaN(r)||r>15||s>15?null:r}function Jfr({community:t,isAdmin:e}){const n=Nn(),r=rNt({community:t,isAdmin:e});if(r===null)return null;const s=r<=0?"Your trial has ended.":`${r} day${r===1?"":"s"} left in trial.`;return a.jsxs("div",{className:"fixed inset-x-0 bottom-0 z-[200] flex flex-wrap items-center justify-center gap-x-1.5 gap-y-1 border-t border-border bg-card px-4 py-3 text-center text-sm font-medium text-foreground shadow-[0_-2px_12px_rgba(0,0,0,0.06)]",role:"status",children:[a.jsx(xo,{className:"h-4 w-4 shrink-0 text-primary"}),a.jsxs("span",{children:["You're on a free trial of the Start plan. ",s]}),a.jsx("button",{type:"button",onClick:()=>n(`${ve.settings}?tab=billing`),className:"cursor-pointer font-semibold text-primary hover:underline",children:"Upgrade the plan"}),a.jsx("span",{className:"text-muted-foreground",children:"or"}),a.jsx("a",{href:"https://spatial.chat/book-a-demo",target:"_blank",rel:"noreferrer",className:"cursor-pointer font-semibold text-primary hover:underline",children:"Schedule a demo"})]})}var mse="Collapsible",[Xfr,sNt]=il(mse),[epr,TAe]=Xfr(mse),iNt=y.forwardRef((t,e)=>{const{__scopeCollapsible:n,open:r,defaultOpen:s,disabled:i,onOpenChange:o,...l}=t,[c,d]=Sd({prop:r,defaultProp:s??!1,onChange:o,caller:mse});return a.jsx(epr,{scope:n,disabled:i,contentId:el(),open:c,onOpenToggle:y.useCallback(()=>d(u=>!u),[d]),children:a.jsx(Sn.div,{"data-state":RAe(c),"data-disabled":i?"":void 0,...l,ref:e})})});iNt.displayName=mse;var aNt="CollapsibleTrigger",_Ae=y.forwardRef((t,e)=>{const{__scopeCollapsible:n,...r}=t,s=TAe(aNt,n);return a.jsx(Sn.button,{type:"button","aria-controls":s.contentId,"aria-expanded":s.open||!1,"data-state":RAe(s.open),"data-disabled":s.disabled?"":void 0,disabled:s.disabled,...r,ref:e,onClick:Kt(t.onClick,s.onOpenToggle)})});_Ae.displayName=aNt;var AAe="CollapsibleContent",PAe=y.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=TAe(AAe,t.__scopeCollapsible);return a.jsx(Rl,{present:n||s.open,children:({present:i})=>a.jsx(tpr,{...r,ref:e,present:i})})});PAe.displayName=AAe;var tpr=y.forwardRef((t,e)=>{const{__scopeCollapsible:n,present:r,children:s,...i}=t,o=TAe(AAe,n),[l,c]=y.useState(r),d=y.useRef(null),u=Sr(e,d),h=y.useRef(0),m=h.current,f=y.useRef(0),p=f.current,g=o.open||l,v=y.useRef(g),b=y.useRef(void 0);return y.useEffect(()=>{const x=requestAnimationFrame(()=>v.current=!1);return()=>cancelAnimationFrame(x)},[]),rl(()=>{const x=d.current;if(x){b.current=b.current||{transitionDuration:x.style.transitionDuration,animationName:x.style.animationName},x.style.transitionDuration="0s",x.style.animationName="none";const w=x.getBoundingClientRect();h.current=w.height,f.current=w.width,v.current||(x.style.transitionDuration=b.current.transitionDuration,x.style.animationName=b.current.animationName),c(r)}},[o.open,r]),a.jsx(Sn.div,{"data-state":RAe(o.open),"data-disabled":o.disabled?"":void 0,id:o.contentId,hidden:!g,...i,ref:u,style:{"--radix-collapsible-content-height":m?`${m}px`:void 0,"--radix-collapsible-content-width":p?`${p}px`:void 0,...t.style},children:g&&s})});function RAe(t){return t?"open":"closed"}var oNt=iNt,npr=_Ae,rpr=PAe;const spr=oNt,ipr=_Ae,apr=PAe;async function opr(t){const e=new FormData;return e.append("image",t),(await Ea("/product-feedback/attachments",e)).data}async function lpr(t){return(await ae.post("/product-feedback",t)).data}const MV=5,cpr=10*1024*1024,dpr=120,WVe=10,qVe=5e3,upr=/^image\/(png|jpe?g|webp|gif|heic|heif)$/i,l0e="pensil.feedbackDraft";function hpr(){try{const t=localStorage.getItem(l0e);return t?JSON.parse(t):null}catch{return null}}function KVe(t){try{t&&(t.title||t.description)?localStorage.setItem(l0e,JSON.stringify(t)):localStorage.removeItem(l0e)}catch{}}const mpr={error:"Console error",warn:"Console warning",crash:"Crash",rejection:"Unhandled error",api:"Failed request"};function fpr({open:t,onOpenChange:e}){const n=Tn(),{toast:r}=yt(),{community:s}=qe(),i=Di(),o=y.useRef(null),[l,c]=y.useState("bug"),[d,u]=y.useState(""),[h,m]=y.useState(""),[f,p]=y.useState([]),[g,v]=y.useState(!0),[b,x]=y.useState(!0),[w,k]=y.useState([]),[S,C]=y.useState(!1),[j,E]=y.useState(!1),[N,A]=y.useState(!1);y.useEffect(()=>{if(!t)return;k(QFt());const U=hpr();U&&(c(U.type==="idea"?"idea":"bug"),u(U.title||""),m(U.description||"")),A(!1)},[t]),y.useEffect(()=>{t&&KVe({type:l,title:d,description:h})},[t,l,d,h]);const _=y.useRef(f);_.current=f,y.useEffect(()=>()=>_.current.forEach(U=>URL.revokeObjectURL(U.previewUrl)),[]);const T=()=>{f.forEach(U=>URL.revokeObjectURL(U.previewUrl)),p([]),u(""),m(""),c("bug"),v(!0),x(!0),KVe(null)},R=y.useCallback(U=>{const ne=U.filter(re=>re.type.startsWith("image/"));if(!ne.length)return;const te=MV-_.current.length;if(te<=0){r({title:pn(n("You can attach up to {max} screenshots"),{max:MV}),variant:"destructive"});return}ne.length>te&&r({title:pn(n(te===1?"Only the first {count} screenshot was added":"Only the first {count} screenshots were added"),{count:te}),variant:"destructive"}),ne.slice(0,te).forEach(re=>{const fe=`${Date.now()}-${Math.random().toString(36).slice(2)}`,le=re.name||"pasted-screenshot.png",q=upr.test(re.type)?re.size>cpr?n("Larger than 10 MB"):null:n("Unsupported image type"),Y={localId:fe,previewUrl:URL.createObjectURL(re),name:le,status:q?"error":"uploading",error:q??void 0};if(p(Q=>[...Q,Y]),q)return;const X=re.name?re:new File([re],le,{type:re.type});opr(X).then(Q=>p(ie=>ie.map(he=>he.localId===fe?{...he,status:"done",attachment:Q}:he))).catch(Q=>p(ie=>ie.map(he=>he.localId===fe?{...he,status:"error",error:Q instanceof ze?Q.message:n("Upload failed")}:he)))})},[r,n]),O=U=>{p(ne=>{const te=ne.find(re=>re.localId===U);return te&&URL.revokeObjectURL(te.previewUrl),ne.filter(re=>re.localId!==U)})},F=U=>{const ne=Array.from(U.clipboardData.files);ne.some(te=>te.type.startsWith("image/"))&&(U.preventDefault(),R(ne))},D=U=>{U.preventDefault(),E(!1),R(Array.from(U.dataTransfer.files))},I=d.trim(),P=h.trim(),M=I?null:n("Add a short title."),z=P.length<WVe?pn(n("Please add a bit more detail ({min}+ characters)."),{min:WVe}):null,G=f.some(U=>U.status==="uploading"),B=f.filter(U=>U.status==="error").length,H=y.useMemo(()=>w.filter(U=>U.kind!=="warn").length,[w]),W=l==="bug"&&g,V=async()=>{if(M||z){A(!0);return}C(!0);try{await lpr({type:l,title:I,description:P,attachments:f.filter(U=>U.status==="done"&&U.attachment).map(U=>U.attachment),allowContact:b,communityId:s==null?void 0:s.id,context:W?{url:window.location.href,route:i.pathname,communityRole:s==null?void 0:s.myRole,userAgent:navigator.userAgent,viewport:`${window.innerWidth}x${window.innerHeight}`,language:navigator.language,timezone:Intl.DateTimeFormat().resolvedOptions().timeZone,appVersion:Dae()}:{route:i.pathname,appVersion:Dae()},diagnostics:W?w:[]}),r({title:n(l==="bug"?"Bug report sent":"Idea sent"),description:n("Thanks! The SpatialChat Communities team will take a look.")}),T(),e(!1)}catch(U){r({title:n("Couldn't send your feedback"),description:U instanceof ze?U.message:n("Please try again."),variant:"destructive"})}finally{C(!1)}};return a.jsx(Bt,{open:t,onOpenChange:U=>!S&&e(U),children:a.jsxs(Ft,{className:"sm:max-w-lg max-h-[90vh] overflow-y-auto",onPaste:F,onDragOver:U=>{U.preventDefault(),E(!0)},onDragLeave:U=>{U.currentTarget.contains(U.relatedTarget)||E(!1)},onDrop:D,children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:n("Send feedback")}),a.jsx(_n,{children:n("Report a problem or suggest an improvement to the SpatialChat Communities team.")})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"grid grid-cols-2 gap-2",role:"radiogroup","aria-label":n("Feedback type"),children:[{value:"bug",label:n("Report a bug"),Icon:mBt},{value:"idea",label:n("Suggest an idea"),Icon:GBt}].map(({value:U,label:ne,Icon:te})=>a.jsxs("button",{type:"button",role:"radio","aria-checked":l===U,onClick:()=>c(U),className:ee("flex items-center justify-center gap-2 rounded-lg border px-3 py-2.5 text-sm font-medium transition-colors",l===U?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground hover:bg-muted"),children:[a.jsx(te,{className:"h-4 w-4"})," ",ne]},U))}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"feedback-title",children:n("Title")}),a.jsx(Oe,{id:"feedback-title",value:d,maxLength:dpr,onChange:U=>u(U.target.value),placeholder:n(l==="bug"?"e.g. Verify code shows “Validation error!”":"e.g. Let me schedule posts"),"aria-invalid":N&&!!M,autoFocus:!0}),N&&M&&a.jsx("p",{className:"text-xs text-destructive",children:M})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"feedback-description",children:n(l==="bug"?"What happened?":"What would you like?")}),a.jsx(us,{id:"feedback-description",value:h,maxLength:qVe,onChange:U=>m(U.target.value),placeholder:n(l==="bug"?"What did you do, what did you expect, and what happened instead?":"What problem are you trying to solve? How would this help you?"),className:"min-h-[120px] resize-y","aria-invalid":N&&!!z}),a.jsxs("div",{className:"flex justify-between text-xs",children:[a.jsx("span",{className:"text-destructive",children:N?z:""}),a.jsxs("span",{className:"text-muted-foreground tabular-nums",children:[h.length,"/",qVe]})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(_e,{children:[n("Screenshots")," ",a.jsx("span",{className:"font-normal text-muted-foreground",children:pn(n("(optional, up to {max})"),{max:MV})})]}),a.jsxs("div",{className:ee("rounded-lg border border-dashed p-3 transition-colors",j?"border-primary bg-primary/5":"border-border"),children:[f.length>0&&a.jsx("ul",{className:"mb-3 flex flex-wrap gap-2",children:f.map(U=>a.jsxs("li",{className:"relative h-20 w-20 overflow-hidden rounded-md border border-border",children:[a.jsx("img",{src:U.previewUrl,alt:U.name,className:"h-full w-full object-cover"}),U.status==="uploading"&&a.jsx("div",{className:"absolute inset-0 flex items-center justify-center bg-background/70",children:a.jsx(Ne,{className:"h-5 w-5 animate-spin text-primary","aria-label":n("Uploading")})}),U.status==="error"&&a.jsxs("div",{className:"absolute inset-0 flex flex-col items-center justify-center gap-1 bg-destructive/80 p-1 text-center text-[10px] leading-tight text-destructive-foreground",title:U.error,children:[a.jsx(tS,{className:"h-4 w-4"}),U.error]}),a.jsx("button",{type:"button",onClick:()=>O(U.localId),className:"absolute right-0.5 top-0.5 rounded-full bg-background/90 p-0.5 text-foreground shadow hover:bg-background","aria-label":pn(n("Remove {name}"),{name:U.name}),children:a.jsx(nn,{className:"h-3 w-3"})})]},U.localId))}),a.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",onClick:()=>{var U;return(U=o.current)==null?void 0:U.click()},disabled:f.length>=MV,children:[a.jsx(jy,{className:"mr-1.5 h-4 w-4"})," ",n("Add screenshot")]}),a.jsx("span",{className:"text-xs text-muted-foreground",children:n("or drop / paste (Ctrl/⌘+V) an image")})]}),a.jsx("input",{ref:o,type:"file",accept:"image/png,image/jpeg,image/webp,image/gif,image/heic,image/heif",multiple:!0,className:"hidden",onChange:U=>{R(Array.from(U.target.files??[])),U.target.value=""}})]}),B>0&&a.jsx("p",{className:"text-xs text-muted-foreground",children:n("Screenshots that failed to upload won't be sent. Remove them or try again.")})]}),l==="bug"&&a.jsxs(spr,{className:"rounded-lg border border-border",children:[a.jsxs("div",{className:"flex items-start gap-3 p-3",children:[a.jsx(ji,{id:"feedback-diagnostics",checked:g,onCheckedChange:U=>v(U===!0),className:"mt-0.5"}),a.jsxs("div",{className:"flex-1 space-y-0.5",children:[a.jsxs(_e,{htmlFor:"feedback-diagnostics",className:"cursor-pointer",children:[n("Include technical details")," ",a.jsx("span",{className:"font-normal text-muted-foreground",children:n("(recommended)")})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:H===0?n("Page, browser, and no recent errors. Passwords, tokens and emails are removed."):pn(n(H===1?"Page, browser, and {count} recent error. Passwords, tokens and emails are removed.":"Page, browser, and {count} recent errors. Passwords, tokens and emails are removed."),{count:H})})]}),a.jsx(ipr,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",children:[n("Preview")," ",a.jsx(li,{className:"ml-1 h-3 w-3"})]})})]}),a.jsx(apr,{children:a.jsxs("div",{className:"max-h-48 overflow-y-auto border-t border-border bg-muted/40 p-3 font-mono text-[11px] leading-relaxed text-muted-foreground",children:[a.jsx("p",{children:pn(n("Page: {path}"),{path:i.pathname})}),a.jsx("p",{children:pn(n("Browser: {browser}"),{browser:navigator.userAgent})}),a.jsx("p",{children:pn(n("Screen: {width}x{height} · Build: {version}"),{width:window.innerWidth,height:window.innerHeight,version:Dae()})}),w.length===0?a.jsx("p",{className:"mt-2",children:n("No errors captured in this session.")}):a.jsx("ul",{className:"mt-2 space-y-1",children:w.map((U,ne)=>a.jsxs("li",{className:"break-words",children:[a.jsx("span",{className:"font-semibold",children:n(mpr[U.kind])})," · ",U.msg]},ne))})]})})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(ji,{id:"feedback-contact",checked:b,onCheckedChange:U=>x(U===!0)}),a.jsx(_e,{htmlFor:"feedback-contact",className:"cursor-pointer font-normal",children:n("The SpatialChat Communities team may contact me about this")})]}),a.jsxs("div",{className:"flex items-center justify-end gap-2 pt-1",children:[a.jsx(Z,{variant:"ghost",onClick:()=>e(!1),disabled:S,children:n("Cancel")}),a.jsxs(Z,{onClick:V,disabled:S||G,children:[(S||G)&&a.jsx(Ne,{className:"mr-1.5 h-4 w-4 animate-spin"}),n(G?"Uploading…":l==="bug"?"Send report":"Send idea")]})]})]})]})})}const Ah=t=>`/community/${encodeURIComponent(t)}/member-fields`,Hk=t=>["member-fields",t],lNt=t=>ae.get(`${Ah(t)}/manage`).then(e=>e.fields),ppr=t=>ae.get(Ah(t)).then(e=>e.fields),cNt=({field:t,logosNotCopied:e,storageFull:n})=>e?{...t,logosNotCopied:e,storageFull:n}:t,gpr=(t,e)=>ae.post(Ah(t),e).then(cNt),dNt=(t,e,n)=>ae.patch(`${Ah(t)}/${encodeURIComponent(e)}`,n).then(cNt),vpr=(t,e)=>ae.post(`${Ah(t)}/${encodeURIComponent(e)}/duplicate`,{}).then(n=>n.field),ypr=(t,e)=>ae.delete(`${Ah(t)}/${encodeURIComponent(e)}`),bpr=(t,e)=>ae.put(`${Ah(t)}/order`,{ids:e}),xpr=(t,e,n)=>ae.post(`${Ah(t)}/${encodeURIComponent(e)}/options/${encodeURIComponent(n)}/approve`,{}).then(r=>r.field),wpr=(t,e,n)=>ae.delete(`${Ah(t)}/${encodeURIComponent(e)}/options/${encodeURIComponent(n)}`).then(r=>r.field),L1=t=>["member-field-option-imports",t],IAe=t=>`${Ah(t)}/option-imports`,YVe=(t,e,n,r)=>{const s=new FormData;return s.append("rows",JSON.stringify(n.rows)),s.append("fileName",n.fileName),s.append("requestKey",n.requestKey),j0(`${Ah(t)}/${encodeURIComponent(e)}/options/imports`,s,r).then(i=>i.import)},kpr=(t,e)=>ae.get(`${IAe(t)}/${encodeURIComponent(e)}`).then(n=>n.import),uNt=(t,e={})=>{const n=new URLSearchParams;return e.fieldId&&n.set("fieldId",e.fieldId),e.active&&n.set("active","true"),n.set("page",String(e.page??1)),n.set("limit",String(e.limit??10)),ae.get(`${IAe(t)}?${n}`)},Spr=(t,e)=>ae.post(`${IAe(t)}/${encodeURIComponent(e)}/retry`,{}).then(n=>n.import),Cpr=t=>ae.get(`${Ah(t)}/me`),hNt=(t,e)=>ae.put(`${Ah(t)}/me`,e),jpr=(t,e)=>ae.get(`${Ah(t)}/users/${encodeURIComponent(e)}`),mNt=[{value:"text",label:"Short text",hint:"A word or a line, like a job title"},{value:"longText",label:"Long text",hint:"A few sentences, like a short bio"},{value:"select",label:"Dropdown",hint:"Members pick one option"},{value:"multiSelect",label:"Multi-select",hint:"Members pick any number of options"},{value:"number",label:"Number",hint:"Like a graduation year"},{value:"date",label:"Date",hint:"Like a start date"},{value:"boolean",label:"Yes / No",hint:"Like “Open to mentoring”"},{value:"url",label:"Link",hint:"A web address, like a portfolio"}],c0e=t=>{var e;return((e=mNt.find(n=>n.value===t))==null?void 0:e.label)??t},vA=t=>t==="select"||t==="multiSelect",K2="new:",Jde=t=>`${K2}${t.replace(/\s+/g," ").trim()}`,JR=t=>typeof t=="string"&&t.startsWith(K2);function PS(t){return t==null||t===""||Array.isArray(t)&&t.length===0}function MAe(t,e){if(PS(e))return"";switch(t.type){case"boolean":return e?"Yes":"No";case"date":{const n=new Date(`${String(e)}T00:00:00Z`);return Number.isNaN(n.getTime())?String(e):n.toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric",timeZone:"UTC"})}case"select":case"multiSelect":{const n=new Map(t.options.map(r=>[r.id,r.label]));return[].concat(e).map(r=>n.get(r)).filter(Boolean).join(", ")}default:return String(e)}}const LAe=t=>t.options.some(e=>!!e.logoUrl);function Epr(t,e){if(t.type!=="select"&&t.type!=="multiSelect"||PS(e))return[];const n=new Map(t.options.map(r=>[r.id,r]));return[].concat(e).map(r=>n.get(r)).filter(r=>!!r)}function uq(t,e){const n={};for(const r of t)n[r.id]=PS(e[r.id])?r.defaultValue??null:e[r.id];return n}function fNt(t,e){const n={},r={};for(const s of t){const i=e[s.id];if(vA(s.type)){const o=[].concat(i??[]),l=o.filter(JR).map(d=>d.slice(K2.length)),c=o.filter(d=>!JR(d));l.length&&(r[s.id]=l),n[s.id]=s.type==="select"?l.length?null:c[0]??null:c}else n[s.id]=i??null}return{answers:n,newOptions:r}}function Npr(t,e){return t.find(n=>n.required&&PS(e[n.id]))}const LV=1e3,d0e=60,Tpr=500,QVe=["image/png","image/jpeg","image/webp","image/gif"],_pr=2*1024*1024;function Apr(t){try{const e=new URL(t.trim());return(e.protocol==="https:"||e.protocol==="http:")&&e.href.length<=Tpr}catch{return!1}}const Ppr=["Option,Logo URL (optional)","Engineering,","Marketing,","Sales,"].join(`
`);function pNt(t){const e=[];let n=[],r="",s=!1;const i=t.replace(/^\uFEFF/,""),o=()=>{e.push([...n,r]),n=[],r=""};for(let l=0;l<i.length;l++){const c=i[l];s?c!=='"'?r+=c:i[l+1]==='"'?r+=i[++l]:s=!1:c==='"'&&r===""?s=!0:c===","?(n.push(r),r=""):c===`
`||c==="\r"?(c==="\r"&&i[l+1]===`
`&&l++,o()):r+=c}return(r||n.length)&&o(),e}const Rpr=t=>pNt(t).map(e=>({label:e[0]??"",logoUrl:(e[1]??"").trim()||void 0}));function ZVe(t,e,n){const r=new Set(e.map(o=>o.replace(/\s+/g," ").trim().toLowerCase())),s=new Set,i={added:[],logoUpdates:[],duplicates:0,tooLong:0,overLimit:0,badLogos:0};return t.forEach((o,l)=>{var h;const c=o.label.replace(/\s+/g," ").trim();if(!c||l===0&&/^options?$/i.test(c))return;let d=((h=o.logoUrl)==null?void 0:h.trim())||void 0;d&&!Apr(d)&&(i.badLogos++,d=void 0);const u=c.toLowerCase();s.has(u)?i.duplicates++:r.has(u)?(s.add(u),d?i.logoUpdates.push({label:c,logoUrl:d}):i.duplicates++):c.length>d0e?i.tooLong++:i.added.length>=n?i.overLimit++:(s.add(u),i.added.push(d?{label:c,logoUrl:d}:{label:c}))}),i}function gNt({logosNotCopied:t=0,storageFull:e=!1}){if(!t)return"";const n=`${t} logo${t===1?"":"s"}`;return e?`${n} couldn't be copied because your community's storage is full, so ${t===1?"it uses":"they use"} the original link.`:`${n} couldn't be copied to your community's storage (the site refused, or it isn't a PNG, JPG, WebP or GIF of up to 2 MB), so ${t===1?"it uses":"they use"} the original link.`}const QB=t=>t.status==="pending"||t.status==="processing",Xde=(t,e)=>`${t} ${e}${t===1?"":"s"}`;function Ipr(t){const e=[t.added?`${Xde(t.added,"option")} added`:"",t.logosUpdated?`${Xde(t.logosUpdated,"logo")} set`:""].filter(Boolean).join(", ")||"Nothing new to add",n=[t.duplicates?`${t.duplicates} already in the list`:"",t.tooLong?`${t.tooLong} too long`:"",t.overLimit?`${t.overLimit} over the option limit`:"",t.badLogos?`${Xde(t.badLogos,"logo link")} that ${t.badLogos===1?"isn't a web address":"aren't web addresses"}`:""].filter(Boolean).join(", "),r=gNt(t);return`${e}.${n?` Skipped: ${n}.`:""}${r?` ${r}`:""}`}const Mpr={text:"A short answer.",longText:"A few sentences.",select:"Pick one option.",multiSelect:"Pick any that apply.",number:"A number.",date:"A date.",boolean:"Yes or No.",url:"A web address, like https://example.com."};function Lpr(t){var n;const e=[((n=t.description)==null?void 0:n.trim())||Mpr[t.type]];return t.visibility==="admins"?e.push("Only this community's admins see your answer."):t.showInDirectory===!1?e.push("Shown on your profile, but not in the member directory."):e.push("Shown on your profile and in the member directory, so members can find you by it."),t.required&&e.push(t.showInOnboarding?"Required: needed to finish joining, and can't be left empty later.":"Required: once answered, it can't be left empty."),t.memberCanEdit||e.push("Once given, only an admin can change it."),e}const vNt=1500;function yNt(t){const e=rn();return jt({mutationFn:n=>Spr(t,n),onSuccess:n=>{e.setQueryData([...L1(t),"one",n.id],n),e.invalidateQueries({queryKey:L1(t)}),He.success("Upload restarted",{description:"It carries on from where it stopped."})},onError:n=>He.error("Couldn't retry the upload",{description:dn(n,"Please try again.")})})}function bNt(t,e,n){const r=rn(),s=y.useRef(new Set),i=y.useRef(n);i.current=n,y.useEffect(()=>{var l;let o=!1;for(const c of e)QB(c)?s.current.add(c.id):s.current.delete(c.id)&&(o=!0,(l=i.current)==null||l.call(i,c));o&&r.invalidateQueries({queryKey:Hk(t)})},[e,t,r])}function Dpr(t,e,n){const r=lt({queryKey:[...L1(t),"one",e],queryFn:()=>kpr(t,e),enabled:!!(t&&e),refetchInterval:i=>i.state.data&&QB(i.state.data)?vNt:!1}),s=y.useMemo(()=>r.data?[r.data]:[],[r.data]);return bNt(t,s,n),r}function xNt(t){return lt({queryKey:[...Hk(t??""),"list"],queryFn:()=>ppr(t),enabled:!!t,staleTime:6e4})}function DAe(t,e){return[...Hk(t),"me",e??""]}function wNt(t,e=!0){const{user:n}=jr();return lt({queryKey:DAe(t??"",n==null?void 0:n.id),queryFn:()=>Cpr(t),enabled:!!t&&e,staleTime:6e4,retry:!1})}function kNt(t){const e=rn(),{user:n}=jr(),{data:r,isLoading:s}=wNt(t),[i,o]=y.useState({}),[l,c]=y.useState({}),[d,u]=y.useState(!1),[h,m]=y.useState(!1),f=y.useMemo(()=>(r==null?void 0:r.fields)??[],[r]),p=y.useMemo(()=>new Set(f.filter(w=>!w.memberCanEdit&&!PS(r==null?void 0:r.answers[w.id])).map(w=>w.id)),[f,r]),g=y.useCallback(()=>{r&&(o(uq(r.fields,r.answers)),c({}))},[r]);y.useEffect(()=>{r&&!h&&(m(!0),g())},[r,h,g]);const v=y.useCallback((w,k)=>{o(S=>({...S,[w]:k})),c(({[w]:S,...C})=>C)},[]),b=!!r&&JSON.stringify(i)!==JSON.stringify(uq(r.fields,r.answers)),x=y.useCallback(async()=>{var w;if(!t||!r)return{ok:!0};u(!0),c({});try{const k=r.fields.filter(C=>!p.has(C.id)),S=await hNt(t,fNt(k,i));return e.setQueryData(DAe(t,n==null?void 0:n.id),S),e.invalidateQueries({queryKey:Hk(t)}),o(uq(S.fields,S.answers)),{ok:!0}}catch(k){const S=k instanceof ze?(w=k.body)==null?void 0:w.fieldId:void 0,C=dn(k,"Couldn't save your details. Please try again.");return S&&c({[S]:C}),{ok:!1,message:C,fieldId:S}}finally{u(!1)}},[t,r,p,i,e,n==null?void 0:n.id]);return{data:r,isLoading:s,fields:f,values:i,setValue:v,errors:l,locked:p,saving:d,dirty:b,reset:g,save:x}}const JVe={xs:"h-4 w-4 text-[9px]",sm:"h-5 w-5 text-[10px]",md:"h-9 w-9 text-xs"};function Gk({src:t,label:e,size:n="sm",fallback:r=!1,className:s}){const[i,o]=y.useState(null);return!t||i===t?r?a.jsx("span",{"aria-hidden":!0,className:ee("inline-flex shrink-0 items-center justify-center rounded bg-muted font-semibold uppercase text-muted-foreground",JVe[n],s),children:e.trim().charAt(0)}):null:a.jsx("img",{src:t,alt:"","aria-hidden":!0,loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",onError:()=>o(t),className:ee("shrink-0 rounded bg-white object-contain ring-1 ring-border",JVe[n],s)})}const BZ=15,DV=50,$pr=64;function $Ae({options:t,selected:e,onPick:n,multiple:r=!1,label:s,autoFocus:i=!1}){const[o,l]=y.useState(""),c=o.toLowerCase().trim(),d=y.useMemo(()=>{const g=c.split(/\s+/).filter(Boolean),v=new Set(e),b=t.filter(x=>g.every(w=>x.label.toLowerCase().includes(w)));return[...b.filter(x=>v.has(x.id)),...b.filter(x=>!v.has(x.id))]},[t,e,c]),[u,h]=y.useState(DV);y.useEffect(()=>h(DV),[c]);const m=d.slice(0,u),f=y.useMemo(()=>LAe({options:t}),[t]),p=g=>{u<d.length&&g.scrollTop+g.clientHeight>=g.scrollHeight-$pr&&h(v=>v+DV)};return a.jsxs("div",{className:"flex min-h-0 flex-col gap-1.5",children:[a.jsxs("div",{className:"relative shrink-0",children:[a.jsx(hs,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground","aria-hidden":!0}),a.jsx(Oe,{autoFocus:i,value:o,onChange:g=>l(g.target.value),placeholder:`Search ${t.length} options`,"aria-label":`Search ${s}`,className:"h-9 pl-8",onKeyDown:g=>{g.key==="Enter"&&(g.preventDefault(),m[0]&&n(m[0].id))}})]}),a.jsxs("ul",{role:"listbox","aria-label":s,"aria-multiselectable":r||void 0,onScroll:g=>p(g.currentTarget),className:"max-h-52 min-h-0 overflow-y-auto overscroll-contain py-0.5",children:[m.map(g=>{const v=e.includes(g.id);return a.jsx("li",{role:"option","aria-selected":v,children:a.jsxs("button",{type:"button",onClick:()=>n(g.id),className:ee("flex w-full items-center gap-2 rounded-md px-2.5 py-1 text-left text-sm hover:bg-muted focus-visible:bg-muted focus-visible:outline-none",v&&"font-medium text-primary"),children:[a.jsx(Qn,{className:ee("h-3.5 w-3.5 shrink-0",v?"opacity-100":"opacity-0"),"aria-hidden":!0}),f?a.jsx(Gk,{src:g.logoUrl,label:g.label,fallback:!0}):null,a.jsx("span",{className:"min-w-0 flex-1 [overflow-wrap:anywhere]",children:g.label}),g.status==="pending"?a.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"(waiting)"}):null]})},g.id)}),d.length===0?a.jsxs("li",{className:"px-2.5 py-2 text-xs text-muted-foreground",children:["No option matches “",o.trim(),"”."]}):null,d.length>m.length?a.jsx("li",{role:"presentation",className:"px-2.5 py-1.5 text-center text-[11px] text-muted-foreground",children:"Scroll for more…"}):null]}),d.length>DV?a.jsx("p",{className:"shrink-0 px-1 text-[11px] text-muted-foreground","aria-live":"polite",children:m.length<d.length?`${m.length} of ${d.length} loaded. Scroll for more, or type to search.`:`All ${d.length} loaded. Type to search.`}):null]})}const OAe="z-[1000]",SNt="flex max-h-[var(--radix-popover-content-available-height)] flex-col";function eue({onAdd:t,disabled:e,fieldLabel:n}){const[r,s]=y.useState(!1),[i,o]=y.useState(""),l=i.replace(/\s+/g," ").trim();if(!r)return a.jsxs("button",{type:"button",disabled:e,onClick:()=>s(!0),className:"inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline disabled:opacity-50",children:[a.jsx(Dn,{className:"h-3 w-3","aria-hidden":!0})," Not listed? Add your own"]});const c=()=>{l&&(t(l),o(""),s(!1))};return a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Oe,{autoFocus:!0,value:i,maxLength:60,placeholder:"Type an option","aria-label":`New option for ${n}`,onChange:d=>o(d.target.value),onKeyDown:d=>{d.key==="Enter"&&(d.preventDefault(),c()),d.key==="Escape"&&s(!1)},className:"h-9 min-w-0 flex-1"}),a.jsx(Z,{type:"button",size:"sm",onClick:c,disabled:!l,children:"Add"}),a.jsx(Z,{type:"button",size:"sm",variant:"ghost",onClick:()=>s(!1),"aria-label":"Cancel",children:a.jsx(nn,{className:"h-4 w-4"})})]})}function Opr({field:t,value:e,onChange:n,id:r,disabled:s,invalid:i,describedBy:o}){const[l,c]=y.useState(!1),d=JR(e)?e.slice(K2.length):null,u=typeof e=="string"?t.options.find(m=>m.id===e):void 0,h=(u==null?void 0:u.label)??(d?`${d} (new)`:"");return a.jsxs(Ni,{open:l,onOpenChange:c,children:[a.jsx(Ti,{asChild:!0,children:a.jsxs("button",{id:r,type:"button",disabled:s,"aria-haspopup":"listbox","aria-expanded":l,"aria-invalid":i||void 0,"aria-describedby":o,className:ee("flex h-10 w-full items-center justify-between gap-2 rounded-md border border-input bg-background px-3 py-2 text-left text-sm ring-offset-background focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",i&&"border-destructive"),children:[a.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[u!=null&&u.logoUrl?a.jsx(Gk,{src:u.logoUrl,label:u.label}):null,a.jsx("span",{className:ee("min-w-0 truncate",!h&&"text-muted-foreground"),children:h||t.placeholder||"Choose one"})]}),a.jsx(li,{className:"h-4 w-4 shrink-0 opacity-50","aria-hidden":!0})]})}),a.jsx(yi,{align:"start",collisionPadding:16,className:ee(OAe,SNt,"w-[min(22rem,calc(100vw-2rem))] p-2"),children:a.jsx($Ae,{autoFocus:!0,label:t.label,options:t.options,selected:typeof e=="string"?[e]:[],onPick:m=>{n(m),c(!1)}})})]})}function Fpr({field:t,value:e,onChange:n,id:r,disabled:s,invalid:i,describedBy:o}){const l=Array.isArray(e)?e:[],c=h=>n(l.includes(h)?l.filter(m=>m!==h):[...l,h]),d=h=>{var m;return JR(h)?`${h.slice(K2.length)} (new)`:((m=t.options.find(f=>f.id===h))==null?void 0:m.label)??""},u=h=>{var m;return(m=t.options.find(f=>f.id===h))==null?void 0:m.logoUrl};return a.jsxs("div",{id:r,role:"group","aria-labelledby":`${r}-label`,"aria-describedby":o,className:ee("flex flex-wrap items-center gap-1.5",i&&"rounded-lg ring-1 ring-destructive ring-offset-2"),children:[l.filter(d).map(h=>a.jsxs("span",{className:ee("inline-flex max-w-full items-center gap-1 rounded-full border border-primary bg-primary/10 py-0.5 pr-1 text-xs font-medium text-primary",u(h)?"pl-1":"pl-3"),children:[u(h)?a.jsx(Gk,{src:u(h),label:d(h),size:"xs",className:"rounded-full"}):null,a.jsx("span",{className:"min-w-0 truncate",children:d(h)}),a.jsx("button",{type:"button",disabled:s,onClick:()=>c(h),"aria-label":`Remove ${d(h)}`,className:"rounded-full p-0.5 hover:bg-primary/20 disabled:opacity-50",children:a.jsx(nn,{className:"h-3 w-3","aria-hidden":!0})})]},h)),a.jsxs(Ni,{children:[a.jsx(Ti,{asChild:!0,children:a.jsxs("button",{type:"button",disabled:s,"aria-haspopup":"listbox",className:"inline-flex items-center gap-1 rounded-full border border-dashed border-border px-3 py-1 text-xs text-foreground hover:bg-muted disabled:opacity-50",children:[a.jsx(Dn,{className:"h-3 w-3","aria-hidden":!0})," ",l.length?"Add more":`Choose ${t.label}`]})}),a.jsx(yi,{align:"start",collisionPadding:16,className:ee(OAe,SNt,"w-[min(22rem,calc(100vw-2rem))] p-2"),children:a.jsx($Ae,{autoFocus:!0,multiple:!0,label:t.label,options:t.options,selected:l,onPick:c})})]})]})}function Bpr({field:t,value:e,onChange:n,id:r,disabled:s,invalid:i,describedBy:o}){const l={id:r,disabled:s,"aria-invalid":i||void 0,"aria-describedby":o},c=i?"border-destructive focus-visible:ring-destructive":void 0;switch(t.type){case"longText":return a.jsx(us,{...l,value:e??"",placeholder:t.placeholder,maxLength:2e3,rows:3,onChange:d=>n(d.target.value),className:c});case"number":return a.jsx(Oe,{...l,type:"number",inputMode:"decimal",value:e==null?"":String(e),placeholder:t.placeholder,onChange:d=>n(d.target.value===""?null:Number(d.target.value)),className:c});case"date":return a.jsx(Oe,{...l,type:"date",value:e??"",onChange:d=>n(d.target.value||null),className:c});case"url":return a.jsx(Oe,{...l,type:"url",inputMode:"url",value:e??"",placeholder:t.placeholder||"https://",maxLength:500,onChange:d=>n(d.target.value),className:c});case"boolean":return a.jsx("div",{role:"radiogroup","aria-labelledby":`${r}-label`,"aria-describedby":o,className:"inline-flex rounded-lg border border-border p-0.5",children:[!0,!1].map(d=>a.jsx("button",{type:"button",role:"radio","aria-checked":e===d,disabled:s,onClick:()=>n(e===d?null:d),className:ee("min-w-16 rounded-md px-4 py-1.5 text-sm transition-colors disabled:opacity-50",e===d?"bg-primary text-primary-foreground":"text-foreground hover:bg-muted"),children:d?"Yes":"No"},String(d)))});case"select":{const d=JR(e)?e.slice(K2.length):null,u=LAe(t);return t.options.length>BZ?a.jsxs("div",{className:"space-y-2",children:[a.jsx(Opr,{field:t,value:e,onChange:n,id:r,disabled:s,invalid:i,describedBy:o}),t.allowMemberOptions?a.jsx(eue,{disabled:s,fieldLabel:t.label,onAdd:h=>n(Jde(h))}):null]}):a.jsxs("div",{className:"space-y-2",children:[a.jsxs(zn,{value:typeof e=="string"?e:"",onValueChange:h=>{h&&n(h)},disabled:s,children:[a.jsx(On,{id:r,"aria-invalid":i||void 0,"aria-describedby":o,className:c,children:a.jsx(Vn,{placeholder:t.placeholder||"Choose one"})}),a.jsxs(Fn,{className:OAe,children:[t.options.map(h=>a.jsxs(pt,{value:h.id,children:[a.jsxs("span",{className:"inline-flex items-center gap-2",children:[u?a.jsx(Gk,{src:h.logoUrl,label:h.label,fallback:!0}):null,h.label]}),h.status==="pending"?a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(waiting for approval)"}):null]},h.id)),d?a.jsxs(pt,{value:e,children:[d," ",a.jsx("span",{className:"ml-1 text-xs text-muted-foreground",children:"(new)"})]}):null]})]}),t.allowMemberOptions?a.jsx(eue,{disabled:s,fieldLabel:t.label,onAdd:h=>n(Jde(h))}):null]})}case"multiSelect":{const d=Array.isArray(e)?e:[],u=f=>n(d.includes(f)?d.filter(p=>p!==f):[...d,f]),h=d.filter(JR),m=t.allowMemberOptions?a.jsx(eue,{disabled:s,fieldLabel:t.label,onAdd:f=>{const p=t.options.find(v=>v.label.toLowerCase()===f.toLowerCase()),g=p?p.id:Jde(f);d.includes(g)||n([...d,g])}}):null;return t.options.length>BZ?a.jsxs("div",{className:"space-y-2",children:[a.jsx(Fpr,{field:t,value:e,onChange:n,id:r,disabled:s,invalid:i,describedBy:o}),m]}):a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{id:r,role:"group","aria-labelledby":`${r}-label`,"aria-describedby":o,className:ee("flex flex-wrap gap-1.5",i&&"rounded-lg ring-1 ring-destructive ring-offset-2"),children:[t.options.map(f=>{const p=d.includes(f.id);return a.jsxs("button",{type:"button","aria-pressed":p,disabled:s,onClick:()=>u(f.id),className:ee("inline-flex items-center gap-1 rounded-full border py-1 pr-3 text-xs transition-colors disabled:opacity-50",f.logoUrl?"pl-1":"pl-3",p?"border-primary bg-primary/10 font-medium text-primary":"border-border text-foreground hover:bg-muted"),children:[f.logoUrl?a.jsx(Gk,{src:f.logoUrl,label:f.label,size:"xs",className:"rounded-full"}):null,p?a.jsx(Qn,{className:"h-3 w-3","aria-hidden":!0}):null,f.label,f.status==="pending"?a.jsx("span",{className:"text-muted-foreground",children:"(waiting)"}):null]},f.id)}),h.map(f=>a.jsxs("button",{type:"button","aria-pressed":!0,disabled:s,onClick:()=>u(f),className:"inline-flex items-center gap-1 rounded-full border border-primary bg-primary/10 px-3 py-1 text-xs font-medium text-primary",children:[a.jsx(Qn,{className:"h-3 w-3","aria-hidden":!0}),f.slice(K2.length)," ",a.jsx("span",{className:"text-muted-foreground",children:"(new)"})]},f)),t.options.length===0&&h.length===0?a.jsx("span",{className:"text-xs text-muted-foreground",children:"No options yet."}):null]}),m]})}default:return a.jsx(Oe,{...l,value:e??"",placeholder:t.placeholder,maxLength:200,onChange:d=>n(d.target.value),className:c})}}function iF({fields:t,values:e,onChange:n,errors:r={},lockedIds:s=new Set,disabled:i,idPrefix:o="member-field"}){return a.jsx("div",{className:"space-y-4",children:t.map(l=>{const c=`${o}-${l.id}`,d=r[l.id],u=s.has(l.id),h=[l.description?`${c}-help`:"",d?`${c}-error`:""].filter(Boolean).join(" ")||void 0;return a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-start gap-1.5",children:[a.jsxs("label",{id:`${c}-label`,htmlFor:c,className:"flex flex-wrap items-center gap-1.5 text-sm font-medium text-foreground",children:[l.label,l.required?a.jsx("span",{className:"text-destructive","aria-hidden":!0,children:"*"}):a.jsx("span",{className:"text-xs font-normal text-muted-foreground",children:"(optional)"}),l.visibility==="admins"?a.jsx("span",{className:"text-xs font-normal text-muted-foreground",children:"· Only admins see this"}):null]}),a.jsx(gn,{label:l.label,children:Lpr(l).map(m=>a.jsx("span",{className:"block",children:m},m))})]}),l.description?a.jsx("p",{id:`${c}-help`,className:"text-xs text-muted-foreground",children:l.description}):null,a.jsx(Bpr,{field:l,id:c,value:e[l.id],onChange:m=>n(l.id,m),disabled:i||u,invalid:!!d,describedBy:h}),u?a.jsxs("p",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(wa,{className:"h-3 w-3","aria-hidden":!0})," Set at onboarding. Ask an admin if it needs changing."]}):null,d?a.jsx("p",{id:`${c}-error`,role:"alert",className:"text-xs text-destructive",children:d}):null]},l.id)})})}function Upr({communityId:t,communityName:e,enabled:n}){const{toast:r}=yt(),s=rn(),{user:i}=jr(),{data:o}=wNt(t,n),l=y.useMemo(()=>o?o.fields.filter(v=>o.onboarding.fieldIds.includes(v.id)):[],[o]),[c,d]=y.useState({}),[u,h]=y.useState({}),[m,f]=y.useState(!1);if(y.useEffect(()=>{o&&d(uq(l,o.answers))},[o,l]),!n||!t||!(o!=null&&o.onboarding.pending)||l.length===0)return null;const p=l.some(v=>v.required),g=async v=>{var b,x;if(!v){const w=Npr(l,c);if(w){h({[w.id]:"Please answer this to continue."}),(b=document.getElementById(`onboarding-field-${w.id}`))==null||b.focus();return}}f(!0),h({});try{const w=v?{answers:{},newOptions:{}}:fNt(l,c),k=await hNt(t,{...w,onboarding:!0});s.setQueryData(DAe(t,i==null?void 0:i.id),k),s.invalidateQueries({queryKey:Hk(t)}),r({title:v?"You can add these later":"Thanks!",description:v?"Your profile has a place for them.":"Your details are saved."})}catch(w){const k=w instanceof ze?(x=w.body)==null?void 0:x.fieldId:void 0,S=dn(w,"Couldn't save your details. Please try again.");k?h({[k]:S}):r({title:"Couldn't save your details",description:S,variant:"destructive"})}finally{f(!1)}};return a.jsx("div",{className:"fixed inset-0 z-[850] flex items-center justify-center bg-background/95 p-4 backdrop-blur-sm",role:"dialog","aria-modal":"true","aria-labelledby":"member-fields-onboarding-title",children:a.jsxs("div",{className:"flex max-h-[calc(100dvh-2rem)] w-full max-w-md flex-col overflow-hidden rounded-xl border border-border bg-card shadow-lg",children:[a.jsxs("div",{className:"shrink-0 border-b border-border px-5 pb-4 pt-5 sm:px-6",children:[a.jsxs("h2",{id:"member-fields-onboarding-title",className:"text-lg font-semibold text-foreground",children:["A few details",e?` for ${e}`:""]}),a.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["The admins ask new members for these. They show in the member directory",p?"; fields marked * are needed to continue.":"."]})]}),a.jsxs("form",{className:"flex min-h-0 flex-1 flex-col",onSubmit:v=>{v.preventDefault(),g(!1)},noValidate:!0,children:[a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto overscroll-contain px-5 py-4 sm:px-6",children:a.jsx(iF,{idPrefix:"onboarding-field",fields:l,values:c,errors:u,disabled:m,onChange:(v,b)=>{d(x=>({...x,[v]:b})),h(({[v]:x,...w})=>w)}})}),a.jsxs("div",{className:"flex shrink-0 flex-col-reverse gap-2 border-t border-border px-5 py-3 sm:flex-row sm:justify-end sm:px-6",children:[p?null:a.jsx(Z,{type:"button",variant:"ghost",disabled:m,onClick:()=>void g(!0),children:"Skip for now"}),a.jsxs(Z,{type:"submit",disabled:m,children:[m?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Continue"]})]})]})]})})}const zpr=6e3;function Vpr({label:t,onClick:e,raised:n=!1}){const r=v7(),[s,i]=y.useState(!r),[o,l]=y.useState(!1),c=s||o;return y.useEffect(()=>{if(!s)return;const d=window.setTimeout(()=>i(!1),zpr);return()=>window.clearTimeout(d)},[s]),a.jsxs(it.button,{type:"button",onClick:e,onMouseEnter:()=>l(!0),onMouseLeave:()=>l(!1),onFocus:()=>l(!0),onBlur:()=>l(!1),"aria-label":t,title:t,initial:r?!1:{opacity:0,y:24,scale:.8},animate:{opacity:1,y:0,scale:1},transition:{type:"spring",stiffness:260,damping:18,delay:.6},whileTap:{scale:.94},className:ee("fixed right-3 z-20 flex h-10 items-center rounded-full bg-primary text-primary-foreground shadow-lg transition-[bottom,box-shadow] hover:shadow-xl focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 sm:right-5 sm:h-11",n?"bottom-28 sm:bottom-16":"bottom-3 sm:bottom-5","max-xl:[body:has([data-chat-composer])_&]:hidden"),children:[s&&a.jsx("span",{"aria-hidden":!0,className:"absolute inset-0 rounded-full bg-primary/40 animate-ping motion-reduce:hidden"}),a.jsx("span",{className:"relative flex h-10 w-10 shrink-0 items-center justify-center sm:h-11 sm:w-11",children:a.jsx(zrt,{className:"h-5 w-5"})}),a.jsx(it.span,{"aria-hidden":!0,initial:!1,animate:{width:c?"auto":0,opacity:c?1:0},transition:{duration:r?0:.25,ease:"easeOut"},className:"relative overflow-hidden whitespace-nowrap text-sm font-medium",children:a.jsx("span",{className:"pr-4",children:t})})]})}async function Hpr(t){const e=await ae.get(`/community/${encodeURIComponent(t)}/live-call`);return Array.isArray(e==null?void 0:e.liveCalls)?e.liveCalls:[]}async function Gpr(t,e){const n=new FormData;return n.set("name",e.name),e.description&&n.set("description",e.description),n.set("type",e.type),n.set("invitedSections",JSON.stringify(e.invitedSections)),(await Ea(`/community/${encodeURIComponent(t)}/live-call`,n)).liveCall}function CNt({open:t,onOpenChange:e}){const{community:n}=qe(),{groups:r}=Ln(),s=Nn(),i=Di(),{toast:o}=yt(),[l,c]=y.useState(""),[d,u]=y.useState(""),[h,m]=y.useState("meeting"),[f,p]=y.useState(""),[g,v]=y.useState(!1),b=y.useMemo(()=>r.flatMap(k=>(k.tabs??[]).map(S=>({key:`${k.id}::${S.id}`,label:`${k.name} · ${S.name??"General"}`}))),[r]),x=l.trim().length>0&&!!f&&!g,w=async()=>{if(!x||!(n!=null&&n.id))return;const[k,S]=f.split("::");v(!0);try{const C=await Gpr(n.id,{name:l.trim(),description:d.trim()||void 0,type:h,invitedSections:[{groupId:k,sectionId:S}]});e(!1),C!=null&&C.meetingId?s(ve.meeting(C.meetingId),{state:{returnTo:`${i.pathname}${i.search}`}}):o({title:"Session started",description:"Members can join from the “Live now” banner."})}catch(C){o({title:"Could not go live",description:Dt(C,"Please try again."),variant:"destructive"})}finally{v(!1)}};return a.jsx(Bt,{open:t,onOpenChange:k=>!g&&e(k),children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg",children:[a.jsxs(Vt,{children:[a.jsxs(Ut,{className:"flex items-center gap-2",children:[a.jsx(wk,{className:"h-5 w-5 text-destructive"})," Go live"]}),a.jsx(_n,{children:"Start a live session — members see it on the “Live now” banner and in the section you pick."})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"live-title",children:"Title"}),a.jsx(Oe,{id:"live-title",value:l,onChange:k=>c(k.target.value),placeholder:"e.g. Match-day tactics review",autoFocus:!0})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"live-desc",children:"Description (optional)"}),a.jsx(us,{id:"live-desc",value:d,onChange:k=>u(k.target.value),placeholder:"What's this session about?",rows:2})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Type"}),a.jsxs(zn,{value:h,onValueChange:k=>m(k),children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"meeting",children:"Meeting — everyone on mic/camera"}),a.jsx(pt,{value:"webinar",children:"Webinar — hosts present, members watch"})]})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Announce in"}),a.jsxs(zn,{value:f,onValueChange:p,children:[a.jsx(On,{children:a.jsx(Vn,{placeholder:"Pick a section"})}),a.jsx(Fn,{children:b.map(k=>a.jsx(pt,{value:k.key,children:k.label},k.key))})]})]})]})]}),a.jsx(ir,{className:"items-center gap-2 sm:justify-end",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Z,{variant:"ghost",disabled:g,onClick:()=>e(!1),children:"Cancel"}),a.jsxs(Z,{disabled:!x,onClick:w,children:[g?a.jsx(Ne,{className:"mr-1.5 h-4 w-4 animate-spin"}):a.jsx(wk,{className:"mr-1.5 h-4 w-4"}),g?"Starting…":"Go live"]})]})})]})})}function u0e(t){var r,s;if(t.price==null)return"Custom";const e=((r=t.currency)==null?void 0:r.toLowerCase())==="usd"?"$":`${(s=t.currency)==null?void 0:s.toUpperCase()} `,n=t.interval==="year"?"/yr":"/mo";return`${e}${t.price}${n}`}function FAe(){var t;return typeof window<"u"&&((t=window.PensilNative)==null?void 0:t.platform)==="ios"}function fse(){const t=typeof window<"u"?window.PensilNative:void 0;if(!FAe()||!(t!=null&&t.appleIap)||t.appleIap.version!==1||!t.appId)throw new Error("Apple purchases are unavailable in this app version. Please update the app.");return{appId:t.appId,bridge:t.appleIap}}function BAe(t,e){return`/apple-iap/${encodeURIComponent(t)}/community/${encodeURIComponent(e)}`}async function Wpr(t){const{appId:e,bridge:n}=fse(),{products:r}=await ae.get(`${BAe(e,t)}/products`),s=await n.getProducts(r.map(i=>i.productId));return r.flatMap(i=>{const o=s.find(l=>l.id===i.productId);return o?[{...o,planCode:i.planCode}]:[]})}async function jNt(t,e,n,r){const s=await ae.post(`${BAe(t,e)}/verify`,{signedTransaction:r.signedTransaction});if(!s.verified||s.transactionId!==r.transactionId)throw new Error("Apple purchase could not be verified. Please restore purchases to retry.");return await n.finish(r.transactionId),s}async function qpr(t,e){const{appId:n,bridge:r}=fse(),{appAccountToken:s,attemptId:i,resumeOnly:o}=await ae.post(`${BAe(n,t)}/prepare`,{productId:e});if(o)throw new Error("An Apple purchase is pending. Use Restore purchases to reconcile it before buying again.");const l=await r.purchase({productId:e,appAccountToken:s});return l.status==="cancelled"&&await ae.post(`/billing/community/${encodeURIComponent(t)}/cancel-checkout`,{attemptId:i}),l.status!=="purchased"?{status:l.status,active:!1}:{status:"purchased",active:(await jNt(n,t,r,l.transaction)).active}}async function Kpr(t){const{appId:e,bridge:n}=fse(),r=await n.restore();let s=0,i=0;for(const o of r)try{(await jNt(e,t,n,o)).active&&s++}catch{i++}return{restored:s,failed:i}}const UZ={bulkEmailing:{icon:Ii,title:"Email Marketing",description:"Reach your members in their inbox with campaigns, newsletters, sequences, funnels and forms.",perks:["Send campaigns and newsletters to your audience","Automated sequences, funnels and sign-up forms","Audience management and delivery analytics"]},workflows:{icon:Ey,title:"Workflows",description:"Automate your community: act when members join, post or reach a milestone, without writing code.",perks:["Automations triggered by joins, posts, streaks and more","Multi-step actions: notify, tag, award points, send email","Ready-made templates to start in minutes"]},memberAnalytics:{icon:Fc,title:"Member Analytics",description:"See how each member uses your community: time spent, sessions and the pages they visit.",perks:["Time spent and sessions for every member","Page journeys: where members go and for how long","Look up any member in Insights"]}},ENt=`${ve.settings}?tab=billing`;function NNt({feature:t,className:e}){var r;const n=((r=UZ[t])==null?void 0:r.icon)??xo;return a.jsxs("div",{className:ee("relative flex h-14 w-14 shrink-0 items-center justify-center rounded-2xl bg-gradient-to-br from-primary/20 via-primary/10 to-transparent text-primary ring-1 ring-primary/20",e),children:[a.jsx(n,{className:"h-6 w-6","aria-hidden":!0}),a.jsx("span",{className:"absolute -bottom-1.5 -right-1.5 flex h-6 w-6 items-center justify-center rounded-full bg-primary text-primary-foreground shadow-sm ring-2 ring-background",children:a.jsx(wa,{className:"h-3 w-3","aria-hidden":!0})})]})}function TNt(){const t=Tn(),{community:e}=qe(),r=FAe()||e==null?void 0:e.id,{data:s}=lt({queryKey:["community-plans",r],queryFn:()=>Jjt(r),enabled:!!r,staleTime:5*6e4}),i=(s??[]).filter(o=>(o.interval??"month")==="month"&&o.price!=null&&o.price>0).sort((o,l)=>(o.price??0)-(l.price??0))[0];return a.jsx("p",{className:"text-xs text-muted-foreground",children:i?pn(t("Included in every paid plan, from {price}."),{price:u0e(i)}):t("Included in every paid plan.")})}function _Nt({perks:t}){const e=Tn();return a.jsx("ul",{className:"space-y-2.5 text-left",children:t.map(n=>a.jsxs("li",{className:"flex items-start gap-2.5 text-sm text-foreground",children:[a.jsx("span",{className:"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-primary/15 text-primary",children:a.jsx(Qn,{className:"h-3 w-3","aria-hidden":!0})}),a.jsx("span",{children:e(n)})]},n))})}function ANt({feature:t,embedded:e=!1}){const n=Tn(),r=Nn(),s=UZ[t];if(!s)return null;const i=e?"h3":"h1";return a.jsxs("div",{className:"mx-auto flex max-w-lg flex-col items-center px-4 py-12 text-center sm:py-16",children:[a.jsx(NNt,{feature:t,className:"mb-5"}),a.jsxs("span",{className:"mb-2 inline-flex items-center gap-1.5 rounded-full border border-primary/30 bg-primary/5 px-2.5 py-0.5 text-[11px] font-semibold uppercase tracking-wider text-primary",children:[a.jsx(xo,{className:"h-3 w-3","aria-hidden":!0})," ",n("Paid plan")]}),a.jsx(i,{className:"text-xl font-bold text-foreground",children:pn(n("Unlock {feature}"),{feature:n(s.title)})}),a.jsx("p",{className:"mt-2 max-w-md text-sm leading-relaxed text-muted-foreground",children:n(s.description)}),a.jsx("div",{className:"mt-6 w-full max-w-sm rounded-xl border bg-card p-4",children:a.jsx(_Nt,{perks:s.perks})}),a.jsxs(Z,{className:"mt-6",onClick:()=>r(ENt),children:[n("See plans")," ",a.jsx(xa,{className:"h-4 w-4","aria-hidden":!0})]}),a.jsx("div",{className:"mt-3",children:a.jsx(TNt,{})})]})}function Ypr({feature:t,onOpenChange:e}){const n=Tn(),r=Nn(),[s,i]=y.useState(t);t&&t!==s&&i(t);const o=s?UZ[s]:void 0,l=!!(t&&UZ[t]);return a.jsx(Bt,{open:l,onOpenChange:e,children:a.jsx(Ft,{className:"max-h-[90dvh] w-[calc(100vw-2rem)] gap-0 overflow-y-auto rounded-2xl p-0 sm:max-w-md",children:o&&s?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"rounded-t-2xl border-b bg-gradient-to-br from-primary/[0.08] via-card to-card px-6 pb-5 pt-6",children:a.jsxs(Vt,{className:"items-center space-y-3 text-center sm:text-center",children:[a.jsx(NNt,{feature:s}),a.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-primary/30 bg-primary/5 px-2.5 py-0.5 text-[11px] font-semibold uppercase tracking-wider text-primary",children:[a.jsx(xo,{className:"h-3 w-3","aria-hidden":!0})," ",n("Paid plan")]}),a.jsx(Ut,{className:"text-xl",children:pn(n("Unlock {feature}"),{feature:n(o.title)})}),a.jsxs(_n,{className:"text-sm leading-relaxed",children:[n(o.description)," ",n("Your current plan doesn't include it. Choose a plan to start using it.")]})]})}),a.jsxs("div",{className:"space-y-4 px-6 py-5",children:[a.jsx(_Nt,{perks:o.perks}),a.jsx(TNt,{})]}),a.jsxs(ir,{className:"gap-2 border-t px-6 py-4 sm:space-x-0",children:[a.jsx(Z,{variant:"ghost",onClick:()=>e(!1),children:n("Maybe later")}),a.jsxs(Z,{onClick:()=>{e(!1),r(ENt)},children:[n("See plans")," ",a.jsx(xa,{className:"h-4 w-4","aria-hidden":!0})]})]})]}):null})})}function PNt(t,e=12){return ae.get(`/community/${encodeURIComponent(t)}/online-members?limit=${e}`)}const RNt=50;function Qpr(t,e){const n=e.slice(0,RNt).map(encodeURIComponent).join(",");return ae.get(`/community/${encodeURIComponent(t)}/presence?userIds=${n}`)}function INt(){const{communityDetail:t}=Ln(),{isCommunityAdmin:e}=Zy();return ql(t,"hideOnlineMembersFromUsers")&&!e}const XVe="community:presence-changed",Zpr=1e3,$V=new Set;function UAe(){var c,d,u;const{community:t}=qe(),{socket:e,registered:n}=Qg(),r=rn(),s=(t==null?void 0:t.id)??null,i=INt(),o=lt({queryKey:["online-members",s],queryFn:()=>PNt(s),enabled:!!s&&!i,staleTime:3e4,refetchInterval:45e3,refetchOnWindowFocus:!0});y.useEffect(()=>{n&&s&&!i&&r.invalidateQueries({queryKey:["online-members",s]})},[n,s,i,r]),y.useEffect(()=>{if(!e||!s||i)return;let h=null;const m=f=>{f!=null&&f.communityId&&f.communityId!==s||h||$V.has(s)||($V.add(s),h=setTimeout(()=>{h=null,$V.delete(s),r.invalidateQueries({queryKey:["online-members",s]})},Math.random()*Zpr))};return e.on(XVe,m),()=>{e.off(XVe,m),h&&(clearTimeout(h),$V.delete(s))}},[e,s,i,r]);const l=i||!!((c=o.data)!=null&&c.hidden);return{count:l?0:((d=o.data)==null?void 0:d.count)??0,members:l?[]:((u=o.data)==null?void 0:u.members)??[],isLoading:o.isLoading,hidden:l}}function MNt(t,e=!0){var d;const{community:n}=qe(),r=(n==null?void 0:n.id)??null,s=INt(),i=y.useMemo(()=>[...new Set(t.filter(Boolean))].slice(0,RNt).sort().join(","),[t]),o=lt({queryKey:["member-presence",r,i],queryFn:()=>Qpr(r,i.split(",")),enabled:e&&!!r&&!!i&&!s,staleTime:3e4,refetchInterval:6e4,refetchOnWindowFocus:!0,retry:!1}),l=y.useMemo(()=>{var u;return new Map((((u=o.data)==null?void 0:u.presence)??[]).map(h=>[h.userId,h]))},[o.data]),c=s||!!((d=o.data)!=null&&d.hidden);return{presenceOf:u=>c||!u?void 0:l.get(u),hidden:c}}function Jpr(t){if(!t)return null;if(t.online)return"Online";const e=t.lastSeenAt?yc(t.lastSeenAt):"";return e?e==="Just now"?"Active just now":`Active ${e}`:"Offline"}function zAe({presence:t,className:e}){return t!=null&&t.online?a.jsx("span",{role:"img","aria-label":"Online",title:"Online",className:ee("absolute bottom-0 right-0 block h-2.5 w-2.5 rounded-full bg-emerald-500 ring-2 ring-card",e)}):null}function Xpr({presence:t}){const e=Jpr(t);return e?a.jsxs("span",{className:ee("flex items-center gap-1.5",(t==null?void 0:t.online)&&"font-medium text-emerald-600 dark:text-emerald-400"),children:[(t==null?void 0:t.online)&&a.jsx("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),e]}):null}function egr({presence:t}){return t!=null&&t.online?a.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-emerald-500/10 px-1.5 py-0.5 text-[10px] font-semibold leading-none text-emerald-700 dark:text-emerald-400",children:[a.jsx("span",{"aria-hidden":!0,className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),"Online"]}):null}const tgr=[{label:"Home",path:ve.dashboard},{label:"Courses",path:ve.knowledge},{label:"Knowledge Hub",path:ve.knowledgeHub},{label:"Member Directory",path:ve.community},{label:"Leaderboard",path:ve.leaderboard},{label:"Networking",path:ve.networking},{label:"Rewards",path:ve.redemption}],eHe="fixed inset-x-4 top-14 z-50 mt-1 rounded-xl border border-border bg-card shadow-elevated sm:absolute sm:inset-x-auto sm:right-0 sm:top-full sm:w-[30rem] sm:max-w-[calc(100vw-2rem)]",ngr=[{feature:"ai",label:"SpatialChat AI",Icon:xo},{feature:"studio",label:"SpatialChat Studio",Icon:Trt}];function rgr({children:t}){var lr;const e=Di(),n=y.useRef(null),r=nat(),s=y.useRef(r);s.current=r,y.useLayoutEffect(()=>{s.current!=="POP"&&n.current&&(n.current.scrollTop=0)},[e.pathname]);const i=Nn(),{viewMode:o,toggleViewMode:l}=X8(),{toast:c}=yt(),{user:d,logout:u}=jr(),{community:h}=qe(),{groups:m,groupsLoading:f,counters:p,communityDetail:g,refetchCounters:v}=Ln(),{active:b}=NAe(),{isCommunityAdmin:x,isAdminView:w}=Zy(),{pac:k}=SN(),S=l0(k,"workflows"),C=l0(k,"bulkEmailing"),[j,E]=y.useState(null),[N,A]=y.useState(null),_=ct=>Bn=>{Bn.preventDefault(),E(ct)},{myScore:T}=nse(),R=((lr=T==null?void 0:T.breakdown)==null?void 0:lr.grandTotal)??(T==null?void 0:T.score)??0;y.useEffect(()=>{if(d&&!b){zVe();return}jAe(h==null?void 0:h.id,e.pathname)},[h==null?void 0:h.id,e.pathname,b,d]),y.useEffect(()=>()=>zVe(),[]),y.useEffect(()=>xfr(b?h==null?void 0:h.id:null),[h==null?void 0:h.id,b]),y.useEffect(()=>kfr(d?h==null?void 0:h.id:null),[h==null?void 0:h.id,d]);const O=sF(g),F=jN(g),D=ql(g,"isImportDisabled",!0),I=!!(g!=null&&g.isDirectMessageDisabled),P=ql(g,"isMemberDirectoryDisabled")&&!x,M=ql(g,"hideHeaderCommunityLogo"),z=ql(g,"hideHeaderCommunityName"),G=ql(g,"disableHeaderDropdown"),B=ql(g,"disableMobileViewHeaderDropdown"),H=ql(g,"showPoweredByPensil"),W=ql(g,"showCommunityLinksInHeader"),V=tNt(),U=Tn(),ne=tgr.filter(ct=>!(F&&(ct.path===ve.knowledge||ct.path===ve.knowledgeHub))&&!(P&&ct.path===ve.community)),{data:te}=lt({queryKey:["show-onboarding-list",h==null?void 0:h.id],queryFn:()=>yur(h.id),enabled:!!(h!=null&&h.id)&&w}),{data:re=[],isLoading:fe}=lt({queryKey:["direct-messages",h==null?void 0:h.id],queryFn:()=>Wxe(h.id),enabled:!!(h!=null&&h.id)&&!!d,staleTime:3e4}),{data:le=[]}=lt({queryKey:["dm-requests",h==null?void 0:h.id],queryFn:()=>qxe(h.id),enabled:!!(h!=null&&h.id)&&!!d,staleTime:3e4}),q=(h==null?void 0:h.name)||"SpatialChat Communities",[Y,X]=y.useState(()=>e.pathname.startsWith("/email-marketing")),[Q,ie]=y.useState(()=>e.pathname.startsWith("/content")),[he,ye]=y.useState(!1);y.useEffect(()=>{ye(!1)},[e.pathname]);const[J,K]=y.useState(!1),{notifications:ce,markAllRead:pe,markRead:Ie,remove:Me}=i2t(J),we=()=>{const ct=!J;K(ct),be(!1),ct&&((p==null?void 0:p.unreadNotificationsCount)??0)>0&&Pdr().then(()=>v()).catch(()=>{})},Be=ct=>{Ie(ct.id),K(!1);const Bn=lAe(ct,m);Bn?i(Bn):r2t(ct.type)&&c({title:"Post not found",description:"It may have been deleted by the author."})},[Ve,be]=y.useState(!1),[Ze,Pe]=y.useState(!1),[Ke,De]=y.useState(!1),[xt,Xe]=y.useState(!1),{data:tt=[],isLoading:$e}=lt({queryKey:["conversations",h==null?void 0:h.id],queryFn:()=>RZ(h==null?void 0:h.id),enabled:!!(h!=null&&h.id)&&!!d&&xt&&!I,staleTime:3e4}),wt=y.useMemo(()=>[...re.filter(ct=>!ct.isArchived),...le].map(ct=>ct.id),[re,le]),{presenceOf:Ee}=MNt(wt,xt&&!I),[Ge,Pt]=y.useState("Inbox"),[vn,Hn]=y.useState(""),[yr,br]=y.useState(null),[Yt,nr]=y.useState(!1),[Kn,ms]=y.useState(!1);y.useState("chat");const is=y.useRef(null),ke=y.useRef(null),at=y.useRef(null),[Tt,An]=y.useState(!1),[Pn,yn]=y.useState(qEt),Is=h==null?void 0:h.name,js=g==null?void 0:g.favicon,Gt=((p==null?void 0:p.unreadNotificationsCount)??0)+((p==null?void 0:p.unreadMessagesCount)??0);return y.useEffect(()=>{const ct=Is||"SpatialChat Communities";document.title=Gt>0?`(${Gt}) ${ct}`:ct},[Is,Gt]),y.useEffect(()=>{if(!js)return;let ct=document.querySelector("link[rel~='icon']");ct||(ct=document.createElement("link"),ct.rel="icon",document.head.appendChild(ct)),ct.href=js},[js]),y.useEffect(()=>{const ct=Bn=>{var Ue,et;const Ms=(et=(Ue=Bn.target)==null?void 0:Ue.closest)==null?void 0:et.call(Ue,"[data-radix-popper-content-wrapper]");is.current&&!is.current.contains(Bn.target)&&!Ms&&K(!1),ke.current&&!ke.current.contains(Bn.target)&&be(!1),at.current&&!at.current.contains(Bn.target)&&!Ms&&Xe(!1)};return document.addEventListener("mousedown",ct),()=>document.removeEventListener("mousedown",ct)},[]),y.useEffect(()=>{Pt("Inbox"),Hn(""),Xe(!1)},[h==null?void 0:h.id]),a.jsxs("div",{className:"flex h-screen flex-col overflow-hidden bg-background",children:[a.jsx("header",{className:"sticky top-0 z-[45] border-b border-border bg-card/95 backdrop-blur-sm lg:z-30",children:a.jsxs("div",{className:"flex h-14 items-center justify-between px-4 lg:px-6",children:[a.jsxs("div",{className:"flex items-center gap-4 min-w-0 flex-1",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2 lg:shrink-0",children:[!M&&a.jsx(bI,{sources:[Pn?h==null?void 0:h.darkModeLogo:void 0,h==null?void 0:h.logo],fallbackSrc:J8,alt:"",className:"h-8 w-8 rounded-lg object-contain bg-white/80 p-0.5 shrink-0",fallbackClassName:"h-8 w-8 object-contain shrink-0"}),!z&&a.jsx("span",{title:q,className:"line-clamp-3 max-w-[180px] break-words text-[13px] font-semibold leading-[1.15] text-foreground sm:line-clamp-2 sm:text-sm sm:leading-tight",children:q})]}),a.jsxs("nav",{className:"hidden lg:flex items-center gap-0.5 ml-4 overflow-x-auto scrollbar-hide [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",children:[ne.map(ct=>{const Bn=e.pathname===ct.path;return a.jsx(vr,{to:ct.path,className:ee("px-2.5 py-1.5 text-[13px] rounded-md whitespace-nowrap transition-colors shrink-0",Bn?"bg-primary text-primary-foreground font-medium":"text-[hsl(var(--header-nav-fg))] hover:bg-muted hover:text-[hsl(var(--header-nav-hover-fg))]"),children:U(ct.label)},ct.path)}),W&&V.map(ct=>a.jsxs("a",{href:/^https?:\/\//i.test(ct.url)?ct.url:`https://${ct.url}`,target:"_blank",rel:"noopener noreferrer",title:ct.label,className:"px-2.5 py-1.5 text-[13px] rounded-md whitespace-nowrap transition-colors shrink-0 text-[hsl(var(--header-nav-fg))] hover:bg-muted hover:text-[hsl(var(--header-nav-hover-fg))]",children:[ct.emoji?`${ct.emoji} `:"",ct.label]},ct.id))]})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1",children:[x&&a.jsxs("button",{onClick:l,className:ee("hidden lg:flex items-center gap-2 rounded-full px-3 py-1.5 text-xs font-medium transition-colors mr-2",w?"bg-primary/10 text-primary border border-primary/20":"bg-muted text-muted-foreground border border-border"),children:[w?a.jsx(Oc,{className:"h-3.5 w-3.5"}):a.jsx(BP,{className:"h-3.5 w-3.5"}),w?"Admin View":"User View"]}),a.jsx("div",{className:"hidden sm:block",children:a.jsx(Tfr,{})}),!d&&a.jsx(Z,{size:"sm",className:"rounded-full px-4",onClick:()=>i(Sje()),children:"Sign in"}),d&&a.jsxs("div",{ref:is,className:"relative",children:[a.jsxs("button",{onClick:we,className:"relative rounded-md p-2 text-muted-foreground hover:bg-muted transition-colors",children:[a.jsx(Lm,{className:"h-5 w-5"}),a.jsx(GVe,{count:(p==null?void 0:p.unreadNotificationsCount)??0,variant:"destructive",className:"-top-1 -right-1"})]}),J&&a.jsx("div",{className:ee(eHe,"overflow-hidden"),children:a.jsx(l2t,{variant:"popup",notifications:ce,onItemClick:Be,onMarkAllRead:()=>pe(),onDelete:ct=>Me(ct.id),onMarkRead:ct=>void Ie(ct.id),onOpenFull:()=>{K(!1),i(ve.notifications)}})})]}),d&&!I&&a.jsxs("div",{ref:at,className:"relative",children:[a.jsxs("button",{onClick:()=>{Xe(!xt),K(!1),be(!1)},className:"relative rounded-md p-2 text-muted-foreground hover:bg-muted transition-colors",children:[a.jsx(wd,{className:"h-5 w-5"}),a.jsx(GVe,{count:(p==null?void 0:p.unreadMessagesCount)??0,variant:"primary",className:"-top-1 -right-1"})]}),xt&&a.jsxs("div",{className:ee(eHe,"flex flex-col overflow-hidden"),children:[a.jsxs("div",{className:"flex items-center justify-between p-4 border-b border-border",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Direct messages"}),a.jsx(gn,{label:"Direct messages",side:"bottom",children:"Your one-to-one chats and group chats, the newest message first. Open all messages to start a chat, see archived chats or change a chat's settings."})]}),a.jsx("button",{onClick:()=>Xe(!1),className:"text-muted-foreground hover:text-foreground",children:a.jsx(nn,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"flex items-center gap-4 px-4 pt-3 pb-2",children:["Inbox","Unread","Requests"].map(ct=>a.jsxs("button",{onClick:()=>Pt(ct),className:ee("inline-flex items-center gap-1 text-sm pb-1",Ge===ct?"text-foreground font-medium border-b-2 border-foreground":"text-muted-foreground"),children:[ct,ct==="Requests"&&le.length>0&&a.jsx("span",{className:"inline-flex h-4 min-w-[1rem] items-center justify-center rounded-full bg-primary px-1 text-[10px] font-semibold text-primary-foreground",children:le.length>99?"99+":le.length})]},ct))}),a.jsx("div",{className:"px-4 py-2",children:a.jsxs("div",{className:"relative",children:[a.jsx(hs,{className:"absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{type:"text",placeholder:"Search for a name",value:vn,onChange:ct=>Hn(ct.target.value),className:"h-8 w-full rounded-md border border-input bg-background pl-9 pr-3 text-xs placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]})}),a.jsx("div",{className:"overflow-y-auto max-h-[min(28rem,calc(100dvh-12rem))]",children:(()=>{var Ue;const Bn=(Ge==="Requests"?le.map(b2t).sort((et,Le)=>{var Ye,st;return+!!((Ye=Le.chat)!=null&&Ye.isPinned)-+!!((st=et.chat)!=null&&st.isPinned)}):$ur(re,tt,(Ue=ro())==null?void 0:Ue.id)).filter(et=>s2t(vn,...et.searchNames)),Ms=Ge==="Unread"?Bn.filter(et=>et.unread):Bn;return fe||Ge!=="Requests"&&$e?a.jsx("div",{className:"space-y-2 p-3",children:Array.from({length:4}).map((et,Le)=>a.jsxs("div",{className:"flex items-center gap-3 px-1 py-2",children:[a.jsx("div",{className:"h-9 w-9 rounded-full bg-muted animate-pulse shrink-0"}),a.jsx("div",{className:"h-3 w-32 rounded bg-muted animate-pulse"})]},Le))}):Ms.length===0?a.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:Ge==="Requests"?vn.trim()?"No requests found":"No message requests":vn.trim()||Ge==="Unread"?"No conversations found":"No direct messages yet"}):Ms.map(et=>a.jsxs("button",{onClick:()=>{var Le;if(Xe(!1),et.type==="group"){Qfr(i,{id:et.id,communityId:h==null?void 0:h.id});return}c0(i,{id:et.id,name:et.name,avatar:et.picture??void 0,userId:(Le=et.chat)==null?void 0:Le.userId,communityId:h==null?void 0:h.id})},className:"flex items-center gap-3 w-full px-4 py-3 text-left hover:bg-muted/50 transition-colors",children:[a.jsxs("span",{className:"relative shrink-0",children:[et.picture?a.jsx("img",{src:et.picture,alt:"",className:"h-9 w-9 rounded-full object-cover shrink-0"}):et.type==="group"?a.jsx("div",{className:"h-9 w-9 rounded-full bg-primary/10 flex items-center justify-center text-primary shrink-0","aria-label":"Group chat",children:a.jsx(wr,{className:"h-4 w-4","aria-hidden":!0})}):a.jsx("div",{className:"h-9 w-9 rounded-full bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0",children:et.name.split(" ").map(Le=>Le[0]).filter(Boolean).join("").slice(0,2).toUpperCase()}),et.type==="dm"&&a.jsx(zAe,{presence:Ee(et.id)})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("span",{className:"flex min-w-0 items-center gap-1.5",children:[a.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:et.name}),et.type==="dm"&&a.jsx(egr,{presence:Ee(et.id)})]}),et.preview&&a.jsx("p",{className:ee("text-xs truncate",et.unreadCount>0?"font-medium text-foreground":"text-muted-foreground"),children:et.preview})]}),et.unreadCount>0&&a.jsx("span",{className:"ml-1 inline-flex h-5 min-w-[1.25rem] items-center justify-center rounded-full bg-primary px-1.5 text-[10px] font-semibold text-primary-foreground shrink-0",children:et.unreadCount>99?"99+":et.unreadCount})]},et.id))})()}),a.jsx("div",{className:"p-3 border-t border-border",children:a.jsx("button",{onClick:()=>{Xe(!1),i(ve.chat)},className:"w-full text-center text-sm text-primary hover:underline font-medium",children:"Open all messages"})})]})]}),d&&!G&&a.jsxs("div",{ref:ke,className:ee("HeaderUserDropDownHolder relative ml-1",B&&"hidden sm:block"),children:[a.jsxs("button",{onClick:()=>{be(!Ve),K(!1)},className:"flex items-center gap-1 cursor-pointer",children:[a.jsx(Jd,{src:Pk(d),name:d?`${d.firstName} ${d.lastName}`:"Guest",className:"h-8 w-8"}),a.jsx(li,{className:"h-3 w-3 text-muted-foreground"})]}),Ve&&a.jsxs("div",{className:"absolute right-0 top-full mt-1 w-56 rounded-lg border border-border bg-card shadow-elevated z-50 py-3",children:[a.jsxs("div",{className:"flex flex-col items-center pb-3 border-b border-border px-4",children:[a.jsx(Jd,{src:Pk(d),name:d?`${d.firstName} ${d.lastName}`:"Guest",className:"mb-2 h-16 w-16 text-xl"}),a.jsx("p",{className:"text-sm font-semibold text-foreground",children:d?`${d.firstName} ${d.lastName}`:"Guest"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:(d==null?void 0:d.email)||""}),a.jsxs("div",{className:"mt-2 inline-flex items-center gap-1.5 rounded-full bg-warning/20 px-3 py-1 text-xs font-semibold text-warning",children:[a.jsx(D8,{className:"h-3 w-3"})," ",R]})]}),a.jsxs("div",{className:"py-1",children:[a.jsxs("button",{onClick:()=>{be(!1),i(ve.profile)},className:"flex items-center gap-3 w-full px-4 py-2.5 text-sm text-foreground hover:bg-muted transition-colors",children:[a.jsx(k2,{className:"h-4 w-4 text-muted-foreground"})," ",U("My profile")]}),a.jsxs("button",{onClick:()=>{be(!1),i(ve.settings)},className:"flex items-center gap-3 w-full px-4 py-2.5 text-sm text-foreground hover:bg-muted transition-colors",children:[a.jsx(w2,{className:"h-4 w-4 text-muted-foreground"})," Settings"]}),w&&a.jsxs("button",{onClick:()=>{be(!1),i(ve.communityMembers)},className:"flex items-center gap-3 w-full px-4 py-2.5 text-sm text-foreground hover:bg-muted transition-colors",children:[a.jsx(wr,{className:"h-4 w-4 text-muted-foreground"})," ",U("Community members")]}),a.jsxs("button",{onClick:()=>yn(jfr()),className:"flex items-center justify-between w-full px-4 py-2.5 text-sm text-foreground hover:bg-muted transition-colors",children:[a.jsxs("span",{className:"flex items-center gap-3",children:[a.jsx(Wrt,{className:"h-4 w-4 text-muted-foreground"})," ",U("Dark mode")]}),a.jsx("div",{className:`h-5 w-9 rounded-full relative transition-colors ${Pn?"bg-primary":"bg-muted"}`,children:a.jsx("div",{className:`absolute top-0.5 left-0.5 h-4 w-4 rounded-full bg-card shadow-sm transition-transform ${Pn?"translate-x-4":""}`})})]}),a.jsxs("button",{onClick:()=>{be(!1),Pe(!0)},className:"flex items-center gap-3 w-full px-4 py-2.5 text-sm text-foreground hover:bg-muted transition-colors",children:[a.jsx(zrt,{className:"h-4 w-4 text-muted-foreground"})," ",U("Send feedback")]}),a.jsx(Zfr,{onNavigate:()=>be(!1)}),a.jsx("div",{className:"border-t border-border mt-1 pt-1",children:a.jsxs("button",{onClick:()=>{be(!1),u(),i(ve.signIn)},className:"flex items-center gap-3 w-full px-4 py-2.5 text-sm text-destructive hover:bg-muted transition-colors",children:[a.jsx(nn,{className:"h-4 w-4"})," ",U("Log out")]})})]})]})]}),a.jsx("button",{type:"button",className:"lg:hidden rounded-md p-2 text-muted-foreground hover:bg-muted transition-colors ml-1",onClick:()=>ye(!he),"aria-label":he?"Close menu":"Open menu",children:he?a.jsx(nn,{className:"h-5 w-5"}):a.jsx(KBt,{className:"h-5 w-5"})})]})]})}),a.jsxs("div",{className:"flex min-h-0 flex-1",children:[he&&a.jsx("div",{className:"fixed inset-0 top-14 z-30 bg-black/40 lg:hidden",onClick:()=>ye(!1),"aria-hidden":"true"}),a.jsxs("aside",{className:ee("flex shrink-0 flex-col min-h-0 overflow-visible relative",Jmr,"fixed inset-y-0 left-0 top-14 z-40 w-[280px] max-w-[85vw] transition-transform duration-300",he?"translate-x-0":"-translate-x-full","lg:static lg:top-0 lg:z-auto lg:max-w-none lg:translate-x-0 lg:transition-[width]",Tt?"lg:w-14":"lg:w-[280px]"),style:{"--circle-sidebar-desktop-font-size":`${wo.sidebarDesktopFontSizePx}px`},children:[a.jsx("button",{onClick:()=>An(!Tt),title:Tt?"Expand sidebar":"Collapse sidebar","aria-label":Tt?"Expand sidebar":"Collapse sidebar",className:"absolute -right-3.5 top-1/2 z-10 hidden h-7 w-7 -translate-y-1/2 items-center justify-center rounded-full border border-[hsl(var(--circle-sidebar-border))] bg-card text-[hsl(var(--circle-sidebar-fg))] shadow-sm transition-colors hover:bg-[hsl(var(--circle-sidebar-hover))] lg:flex",children:Tt?a.jsx(io,{className:"h-4 w-4"}):a.jsx(nl,{className:"h-4 w-4"})}),a.jsxs("div",{className:"themed-scrollbar flex min-h-0 flex-1 flex-col overflow-y-auto overflow-x-hidden",children:[a.jsxs("nav",{"aria-label":"Main",className:ee("flex flex-col gap-y-0.5 pb-2 pt-3",Tt?"px-2":"px-3"),children:[a.jsxs("div",{className:"mb-2 flex flex-col gap-y-0.5 border-b border-[hsl(var(--circle-sidebar-border))] pb-2 lg:hidden",children:[a.jsx(AV,{label:U("Pages")}),ne.map(ct=>a.jsx(vr,{to:ct.path,className:DEt(e.pathname===ct.path),children:U(ct.label)},ct.path))]}),a.jsx(AV,{label:U("Menu"),collapsed:Tt}),a.jsx(Ev,{to:ve.dashboard,title:"Feed",icon:a.jsx(o9t,{}),collapsed:Tt,active:e.pathname==="/"||e.pathname===ve.dashboard,children:U("Feed")}),!I&&a.jsx(Ev,{to:ve.chat,title:U("Direct Message"),icon:a.jsx(_s,{}),collapsed:Tt,active:e.pathname==="/chat",unreadCount:(p==null?void 0:p.unreadMessagesCount)??0,children:U("Direct Message")}),a.jsx(Ev,{to:ve.saved,title:"Saved posts",icon:a.jsx(hO,{}),collapsed:Tt,active:e.pathname===ve.saved,children:U("Saved")}),a.jsx(AV,{label:U("Discover"),collapsed:Tt,divider:!0}),a.jsx(Ev,{to:ve.exploreGroups,title:"Explore Groups",icon:a.jsx(wBt,{}),collapsed:Tt,active:e.pathname==="/explore-groups",children:U("Explore Groups")}),!O&&a.jsx(Ev,{to:ve.calendar,title:"Calendar",icon:a.jsx(ym,{}),collapsed:Tt,active:e.pathname.startsWith("/calendar"),children:U("Calendar")}),a.jsx(Wfr,{sidebarCollapsed:Tt}),ngr.map(({feature:ct,label:Bn,Icon:Ms})=>a.jsx(Ev,{to:e.pathname+e.search,title:Bn,icon:a.jsx(Ms,{}),collapsed:Tt,onClick:Ue=>{Ue.preventDefault(),ye(!1),A(ct)},children:a.jsxs("span",{className:"flex flex-wrap items-center gap-x-1.5 gap-y-0.5",children:[a.jsx("span",{children:U(Bn)}),a.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-1.5 py-0.5 text-[10px] font-semibold leading-none text-primary",children:U("Soon")})]})},ct)),w&&a.jsxs(a.Fragment,{children:[a.jsx(AV,{label:U("Admin"),collapsed:Tt,divider:!0}),!D&&a.jsx(Ev,{to:ve.import,title:"Import",icon:a.jsx(efe,{}),collapsed:Tt,active:e.pathname.startsWith("/import"),children:U("Import")}),a.jsx(Ev,{to:ve.insights,title:"Analytics",icon:a.jsx(Fc,{}),collapsed:Tt,active:e.pathname.startsWith("/insights"),children:U("Analytics")}),a.jsx(Ev,{to:ve.workflows,title:"Workflows",icon:a.jsx(Ey,{}),collapsed:Tt,active:e.pathname.startsWith("/workflows"),onClick:S?_("workflows"):void 0,children:a.jsxs("span",{className:"flex items-center gap-1.5",children:[U("Workflows"),S&&a.jsx(wa,{className:"h-3 w-3 shrink-0 opacity-60"})]})}),a.jsx(rF,{title:U("Email Marketing"),icon:a.jsx(Ii,{}),locked:C,collapsed:Tt,expanded:Y,onToggle:()=>Tt?C?E("bulkEmailing"):i(ve.emailMarketing):X(!Y),active:e.pathname.startsWith("/email-marketing"),children:[{label:"Overview",path:ve.emailMarketing,icon:Lrt,exact:!0},{label:"Campaigns",path:ve.emailCampaigns,icon:Ii},{label:"Newsletters",path:ve.newsletter,icon:vO},{label:"Sequences",path:ve.emailSequences,icon:Pg},{label:"Funnels",path:ve.emailFunnels,icon:Rrt},{label:"Forms",path:ve.emailForms,icon:Ei},{label:"Templates",path:ve.emailTemplates,icon:hSe},{label:"Audience",path:ve.emailAudience,icon:oI}].map(ct=>{const Bn=ct.exact?e.pathname===ct.path:e.pathname.startsWith(ct.path);return a.jsx(nF,{to:ct.path,icon:a.jsx(ct.icon,{className:"h-4 w-4"}),active:Bn,onClick:C?_("bulkEmailing"):void 0,children:U(ct.label)},ct.path)})}),a.jsx(rF,{title:U("Content"),icon:a.jsx(_Bt,{}),collapsed:Tt,expanded:Q,onToggle:()=>Tt?i(ve.contentMedia):ie(!Q),active:e.pathname.startsWith("/content"),children:[{label:"Media",path:ve.contentMedia,icon:Jl},{label:"Posts",path:ve.contentPosts,icon:Ei},{label:"Spaces",path:ve.contentSpaces,icon:dee},{label:"Topics",path:ve.contentTopics,icon:CSe}].map(ct=>{const Bn=e.pathname.startsWith(ct.path);return a.jsx(nF,{to:ct.path,icon:a.jsx(ct.icon,{className:"h-4 w-4"}),active:Bn,children:ct.label},ct.path)})})]})]}),a.jsx("div",{role:"separator",className:"mx-3 mb-2 mt-1 h-px bg-[hsl(var(--circle-sidebar-border))]"}),!W&&a.jsx($fr,{sidebarCollapsed:Tt}),a.jsx(sfr,{groups:m,isLoading:f,sidebarCollapsed:Tt}),a.jsx(ufr,{sidebarCollapsed:Tt,onExpandSidebar:()=>An(!1)}),w&&te&&a.jsx("div",{className:ee("px-3 pt-4 mt-auto",Tt&&"px-2"),children:a.jsxs("button",{onClick:()=>i(ve.gettingStarted),title:"Get started",className:ee("flex w-full items-center justify-center gap-2.5 rounded-lg bg-[hsl(var(--circle-sidebar-active))]/10 px-3 py-3 text-sm font-medium text-[hsl(var(--circle-sidebar-active))] transition-colors hover:bg-[hsl(var(--circle-sidebar-active))]/15",Tt&&"px-0"),children:[a.jsx(bO,{className:"h-4 w-4 shrink-0"}),!Tt&&"Get started"]})}),w&&a.jsx("div",{className:ee("px-3 py-4",te?"":"mt-auto",Tt&&"px-2"),children:a.jsxs("button",{onClick:()=>De(!0),title:"Start live session",className:ee("flex w-full items-center justify-center gap-2.5 rounded-lg border border-dashed border-[hsl(var(--circle-sidebar-border))] px-3 py-3 text-sm font-medium text-[hsl(var(--circle-sidebar-fg))] transition-colors hover:border-[hsl(var(--circle-sidebar-active))]/40 hover:bg-[hsl(var(--circle-sidebar-hover))]",Tt&&"px-0"),children:[a.jsx(Ca,{className:"h-4 w-4 shrink-0"}),!Tt&&"Start live session"]})}),H&&!Tt&&a.jsx("div",{className:ee("px-3 pb-3 text-center",!w&&"mt-auto pt-4"),children:a.jsxs("span",{className:"text-[11px] text-[hsl(var(--circle-sidebar-fg))]/60",children:[U("Powered by")," SpatialChat Communities"]})})]})]}),a.jsx(t2t.Provider,{value:Tt,children:a.jsx("main",{ref:n,className:ee("min-h-0 flex-1 overflow-y-auto px-3 pb-6 pt-3 sm:px-4 lg:px-6",e.pathname===ve.emailCampaignCreate&&"email-editor-scrollbar overscroll-contain"),children:t})})]}),a.jsx(Jfr,{community:h,isAdmin:x}),a.jsx(Ypr,{feature:j,onOpenChange:ct=>!ct&&E(null)}),a.jsx(Yfr,{feature:N,onOpenChange:ct=>!ct&&A(null)}),a.jsx(CNt,{open:Ke,onOpenChange:De}),a.jsx(Al,{children:yr&&a.jsxs(it.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 bg-[hsl(230,25%,12%)] flex flex-col",children:[a.jsxs("div",{className:"flex items-center justify-between px-5 py-3 border-b border-white/10",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsx("span",{className:"text-white font-medium text-sm",children:"Spatial Event"}),a.jsxs("div",{className:"flex items-center gap-1.5 text-white/50 text-sm",children:[a.jsx(wr,{className:"h-4 w-4"}),a.jsx("span",{children:"120"})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("button",{className:"flex items-center gap-1.5 rounded-full bg-white/10 px-4 py-1.5 text-sm text-white/80 hover:bg-white/20 transition-colors",children:[a.jsx(wr,{className:"h-4 w-4"})," Invite"]}),a.jsxs("button",{className:"flex items-center gap-1.5 rounded-full bg-white/10 px-4 py-1.5 text-sm text-white/80 hover:bg-white/20 transition-colors",children:[a.jsx(Ca,{className:"h-4 w-4"})," Meet"]}),a.jsx("button",{onClick:()=>br(null),className:"rounded-full bg-destructive/80 hover:bg-destructive p-1.5 text-white transition-colors",children:a.jsx(nn,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"flex flex-1 min-h-0",children:[a.jsx("div",{className:"w-12 shrink-0 flex flex-col items-center py-4 gap-4 border-r border-white/10",children:[wr,Vi,Ei,VLe,HLe].map((ct,Bn)=>a.jsx("button",{className:"h-9 w-9 rounded-lg bg-white/5 hover:bg-white/15 flex items-center justify-center text-white/60 hover:text-white transition-colors",children:a.jsx(ct,{className:"h-4 w-4"})},Bn))}),a.jsxs("div",{className:"flex-1 relative overflow-hidden",children:[a.jsx("div",{className:"absolute inset-0 bg-cover bg-center",style:{backgroundImage:{"United Kingdom":"url('https://images.unsplash.com/photo-1585320806297-9794b3e4eeae?w=1920&h=1080&fit=crop')",DACH:"url('https://images.unsplash.com/photo-1600585154340-be6161a56a0c?w=1920&h=1080&fit=crop')"}[yr||""]||"url('https://images.unsplash.com/photo-1497366216548-37526070297c?w=1920&h=1080&fit=crop')"}}),a.jsx("div",{className:"absolute inset-0 bg-black/20"}),a.jsx("div",{className:"absolute inset-0 flex items-center justify-center pointer-events-none",children:a.jsx("span",{className:"text-white/10 text-[120px] font-black tracking-wider",children:"SpatialChat Communities"})}),a.jsx("div",{className:"absolute bottom-32 left-1/2 -translate-x-1/2 flex items-end gap-4",children:[{name:"Riddhik",color:"border-primary"},{name:"Dr. Rossi",color:"border-amber-400"},{name:"Sarah M.",color:"border-green-400"}].map((ct,Bn)=>a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsx("div",{className:`h-14 w-14 rounded-full border-2 ${ct.color} bg-[hsl(230,20%,18%)] flex items-center justify-center`,children:a.jsx("span",{className:"text-white text-xs font-bold",children:ct.name.split(" ").map(Ms=>Ms[0]).join("")})}),a.jsx("span",{className:"text-[10px] text-white/70 bg-black/40 rounded px-1.5 py-0.5",children:ct.name})]},Bn))}),a.jsxs("div",{className:"absolute bottom-6 left-1/2 -translate-x-1/2 flex items-center gap-2",children:[[Dn,VLe,vSe,Vi].map((ct,Bn)=>a.jsx("button",{className:"h-11 w-11 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center text-white/70 hover:text-white transition-colors backdrop-blur-sm",children:a.jsx(ct,{className:"h-5 w-5"})},Bn)),a.jsx("button",{onClick:()=>ms(!Kn),className:`h-11 w-11 rounded-full flex items-center justify-center transition-colors ${Kn?"bg-destructive/80 text-white":"bg-primary text-white"}`,children:Kn?a.jsx(S2,{className:"h-5 w-5"}):a.jsx(Ca,{className:"h-5 w-5"})}),a.jsx("button",{onClick:()=>nr(!Yt),className:`h-11 w-11 rounded-full flex items-center justify-center transition-colors ${Yt?"bg-destructive/80 text-white":"bg-primary text-white"}`,children:Yt?a.jsx(yk,{className:"h-5 w-5"}):a.jsx(Vx,{className:"h-5 w-5"})}),a.jsx("button",{className:"h-11 w-11 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center text-white/70 hover:text-white transition-colors backdrop-blur-sm",children:a.jsx(HLe,{className:"h-5 w-5"})}),a.jsx("button",{onClick:()=>br(null),className:"h-11 w-11 rounded-full bg-destructive/80 hover:bg-destructive flex items-center justify-center text-white transition-colors",children:a.jsx(nn,{className:"h-5 w-5"})})]}),a.jsx("div",{className:"absolute bottom-6 right-6 text-white/50 text-sm",children:"45%"}),a.jsxs("div",{className:"absolute bottom-6 left-6 flex gap-2",children:[a.jsx("button",{className:"h-9 w-9 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center text-white/60 hover:text-white transition-colors backdrop-blur-sm",children:a.jsx(L8,{className:"h-4 w-4"})}),a.jsx("button",{className:"h-9 w-9 rounded-full bg-white/10 hover:bg-white/20 flex items-center justify-center text-white/60 hover:text-white transition-colors backdrop-blur-sm",children:a.jsx(w2,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"w-64 shrink-0 bg-[hsl(230,20%,14%)] border-l border-white/10 flex flex-col",children:[a.jsxs("div",{className:"p-3 flex items-center justify-between border-b border-white/10",children:[a.jsx(hs,{className:"h-4 w-4 text-white/40"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{className:"h-7 w-7 rounded bg-primary flex items-center justify-center text-white",children:a.jsx(k2,{className:"h-3.5 w-3.5"})}),a.jsx("button",{className:"h-7 w-7 rounded bg-white/10 flex items-center justify-center text-white/60 hover:text-white",children:a.jsx(Vi,{className:"h-3.5 w-3.5"})})]})]}),a.jsxs("div",{className:"flex-1 overflow-y-auto p-2 space-y-0.5",children:[a.jsxs("div",{className:"rounded-md bg-primary/20 px-3 py-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-sm font-medium text-white flex items-center gap-2",children:[a.jsx("span",{className:"text-primary",children:"▼"})," SpatialChat Communities Welcome Lobby"]}),a.jsx("span",{className:"text-[10px] text-white/50",children:"1/50"})]}),a.jsxs("div",{className:"mt-2 flex items-center gap-2 ml-4",children:[a.jsx("div",{className:"h-6 w-6 rounded-full bg-primary/30 flex items-center justify-center text-[10px] text-white font-bold",children:"RK"}),a.jsx("span",{className:"text-xs text-white/80",children:"Riddhik"}),a.jsx("span",{className:"text-[10px] bg-primary/30 text-primary-foreground rounded px-1.5 py-0.5",children:"You"})]})]}),[{name:"SpatialChat Communities Networking Room",icon:"▶",capacity:"0/50"},{name:"Stage",icon:"▶",capacity:"0/5000",special:!0},{name:"Workshop Room",icon:"▶",capacity:"0/50"},{name:"Manchester City",icon:"📁",capacity:""},{name:"Networking Room",icon:"▶",capacity:"0/50"}].map(ct=>a.jsxs("button",{className:"flex items-center justify-between w-full rounded-md px-3 py-2 text-sm text-white/70 hover:bg-white/5 transition-colors",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-white/40 text-xs",children:ct.icon}),ct.name]}),ct.capacity&&a.jsx("span",{className:"text-[10px] text-white/40",children:ct.capacity})]},ct.name))]}),a.jsx("div",{className:"p-3 border-t border-white/10",children:a.jsxs("button",{className:"flex items-center justify-center gap-2 w-full rounded-md bg-white/5 hover:bg-white/10 px-3 py-2 text-sm text-white/60 hover:text-white transition-colors",children:[a.jsx(Dn,{className:"h-4 w-4"})," Add room"]})})]})]})]})}),a.jsx(Vpr,{label:U("Send feedback"),onClick:()=>Pe(!0),raised:rNt({community:h,isAdmin:x})!==null}),a.jsx(fpr,{open:Ze,onOpenChange:Pe}),a.jsx(Upr,{communityId:h==null?void 0:h.id,communityName:h==null?void 0:h.name,enabled:!!d})]})}function yA({children:t}){const{community:e}=qe(),{isCommunityAdmin:n}=Zy();return e?n?a.jsx(a.Fragment,{children:t}):a.jsx("div",{className:"flex min-h-[240px] flex-col items-center justify-center rounded-lg border border-border bg-card p-8 text-center",children:a.jsx("p",{className:"text-muted-foreground",children:"No page found"})}):null}function sgr(){const{communityDetail:t,communityDetailLoading:e}=Ln();return e||!t?null:ql(t,"isImportDisabled",!0)?a.jsx(Gs,{to:ve.home,replace:!0}):a.jsx(f4,{})}function zZ({feature:t,children:e,embedded:n=!1}){const{pac:r,isLoading:s}=SN();return s?a.jsx("div",{className:"flex min-h-[240px] items-center justify-center",role:"status","aria-busy":"true",children:a.jsx(Ne,{className:"h-6 w-6 animate-spin text-muted-foreground","aria-hidden":!0})}):l0(r,t)?a.jsx(ANt,{feature:t,embedded:n}):a.jsx(a.Fragment,{children:e})}function gm(t,e){return e==="sending"?!0:!!(t&&t.total>0&&t.queued>0)}const igr=24*60*60*1e3,agr=10*60*1e3;function LNt(t,e=Date.now()){const n=t?Date.parse(t):NaN;return Number.isFinite(n)&&e-n<igr?agr:!1}const ogr=[{id:"b_logo",type:"image",url:""},{id:"b_title",type:"heading",text:"Newsletter Title"},{id:"b_intro",type:"text",text:"Give a short introduction to your newsletter that highlights why it exists and teases the content you'll be sharing.",html:""},{id:"b_hero",type:"image",url:""},{id:"b_body",type:"text",text:"Newsletter content goes here. Give the most interesting tidbits to capture the reader's attention.",html:""},{id:"b_cta",type:"button",label:"Read more",url:"https://pensil.so"}];function lgr(t){switch(t){case"sent":case"active":case"published":case"Subscribed":return"bg-success/10 text-success border-success/20";case"scheduled":case"sending":return"bg-info/10 text-info border-info/20";case"pending":return"bg-warning/10 text-warning border-warning/20";case"paused":case"Unsubscribed":return"bg-muted text-muted-foreground border-border";case"Bounced":return"bg-destructive/10 text-destructive border-destructive/20";default:return"bg-muted text-muted-foreground border-border"}}const Er={all:t=>["email-marketing",t],campaigns:(t,e)=>[...Er.all(t),"campaigns",e??{}],campaign:(t,e)=>[...Er.all(t),"campaign",e],campaignReport:(t,e)=>[...Er.all(t),"campaign-report",e],undelivered:(t,e,n)=>[...Er.all(t),"undelivered",e,n],postReport:(t,e,n)=>[...Er.newsletter(t,e),"post-report",n],newsletters:(t,e)=>[...Er.all(t),"newsletters",e??{}],newsletterSettings:t=>[...Er.all(t),"newsletter-settings"],newsletter:(t,e)=>[...Er.all(t),"newsletter",e],posts:(t,e,n)=>[...Er.newsletter(t,e),"posts",n??{}],post:(t,e)=>[...Er.all(t),"post",e],subscribers:(t,e,n)=>[...Er.newsletter(t,e),"subscribers",n??{}],subscriber:(t,e)=>[...Er.all(t),"subscriber",e],contacts:(t,e)=>[...Er.all(t),"contacts",e??{}],audience:(t,e)=>[...Er.all(t),"audience",e??{}],audienceTags:t=>[...Er.all(t),"audience-tags"],audienceCount:(t,e)=>[...Er.all(t),"audience-count",e??{}],contact:(t,e)=>[...Er.all(t),"contact",e],segments:(t,e)=>[...Er.all(t),"segments",e??{}],segment:(t,e)=>[...Er.all(t),"segment",e],templates:t=>[...Er.all(t),"templates"],forms:(t,e)=>[...Er.all(t),"forms",e??{}],form:(t,e)=>[...Er.all(t),"form",e],formSubmissions:(t,e)=>[...Er.all(t),"form-submissions",e],funnels:t=>[...Er.all(t),"funnels"],funnel:(t,e)=>[...Er.all(t),"funnel",e],sequencesList:(t,e)=>[...Er.all(t),"sequences-list",e??"all"],suppressions:(t,e)=>[...Er.all(t),"suppressions",e??{}],senderDomains:t=>[...Er.all(t),"sender-domains"]};function Rs(t){const e=rn();return()=>e.invalidateQueries({queryKey:Er.all(t)})}function DNt(t,e={}){return lt({queryKey:Er.campaigns(t,e),queryFn:()=>bor(t,e),enabled:!!t,refetchInterval:n=>{var s;return(((s=n.state.data)==null?void 0:s.data)??[]).some(i=>gm(i.sendProgress,i.status))?4e3:!1}})}function $Nt(t,e){return lt({queryKey:Er.campaign(t,e),queryFn:()=>xor(t,e),enabled:!!(t&&e)})}function cgr(t){const e=Rs(t);return jt({mutationFn:n=>wor(t,n),onSuccess:()=>void e()})}function dgr(t){const e=Rs(t);return jt({mutationFn:({campaignId:n,body:r})=>kor(t,n,r),onSuccess:()=>void e()})}function ugr(t){const e=Rs(t);return jt({mutationFn:n=>Sor(t,n),onSuccess:()=>void e()})}function hgr(t){const e=Rs(t);return jt({mutationFn:({campaignId:n,title:r})=>Cor(t,n,r),onSuccess:()=>void e()})}function mgr(t){const e=Rs(t);return jt({mutationFn:({campaignId:n,folderId:r})=>jor(t,n,r),onSuccess:()=>void e()})}function ONt(t){const e=Rs(t);return jt({mutationFn:({campaignId:n,body:r})=>Eor(t,n,r),onSuccess:()=>void e()})}function fgr(t){return jt({mutationFn:({campaignId:e,body:n})=>Nor(t,e,n)})}function FNt(t){const e=Rs(t);return jt({mutationFn:({campaignId:n,body:r})=>Tor(t,n,r),onSuccess:()=>void e()})}function BNt(t){const e=Rs(t);return jt({mutationFn:n=>_or(t,n),onSuccess:()=>void e()})}function h0e(t,e,n){return lt({queryKey:Er.undelivered(t,e,n),queryFn:()=>ijt(e,n),enabled:!!t,placeholderData:Uy})}function pgr(t,e){var i;const n=rn(),r=y.useRef(null),s=lt({queryKey:Er.campaignReport(t,e),queryFn:()=>glr(t,e),enabled:!!(t&&e),refetchInterval:o=>{const l=o.state.data;return gm(l==null?void 0:l.sendProgress,l==null?void 0:l.status)||(l==null?void 0:l.status)==="sending"?4e3:(l==null?void 0:l.status)==="sent"?LNt(l.sentAt):!1}});return y.useEffect(()=>{var c;const o=((c=s.data)==null?void 0:c.status)??null,l=r.current;r.current=o,l==="sending"&&o==="sent"&&t&&(n.invalidateQueries({queryKey:Er.campaigns(t)}),n.invalidateQueries({queryKey:Er.campaign(t,e)}))},[e,t,(i=s.data)==null?void 0:i.status,n]),s}function UNt(t,e={}){return lt({queryKey:Er.newsletters(t,e),queryFn:()=>Aor(t,e),enabled:!!t})}function ggr(t){return lt({queryKey:Er.newsletterSettings(t),queryFn:()=>Por(t),enabled:!!t})}function vgr(t){const e=Rs(t);return jt({mutationFn:n=>Ror(t,n),onSuccess:()=>void e()})}function ygr(t){const e=Rs(t);return jt({mutationFn:({newsletterId:n,body:r})=>Ior(t,n,r),onSuccess:()=>void e()})}function bgr(t){const e=Rs(t);return jt({mutationFn:n=>Mor(t,n),onSuccess:()=>void e()})}function xgr(t,e,n={}){return lt({queryKey:Er.posts(t,e,n),queryFn:()=>rjt(t,e,n),enabled:!!(t&&e),refetchInterval:r=>{var i;return(((i=r.state.data)==null?void 0:i.data)??[]).some(o=>gm(o.sendProgress,o.status))?4e3:!1}})}function wgr(t){const e=Rs(t);return jt({mutationFn:({newsletterId:n,body:r})=>Lor(t,n,r),onSuccess:()=>void e()})}function kgr(t){const e=Rs(t);return jt({mutationFn:({postId:n,body:r})=>Dor(t,n,r),onSuccess:()=>void e()})}function Sgr(t){const e=Rs(t);return jt({mutationFn:({newsletterId:n,postId:r})=>$or(t,n,r),onSuccess:()=>void e()})}function Cgr(t){const e=Rs(t);return jt({mutationFn:n=>Uor(t,n),onSuccess:()=>void e()})}function tHe(t,e,n={}){return lt({queryKey:Er.subscribers(t,e,n),queryFn:()=>sjt(t,e,n),enabled:!!(t&&e)})}function zNt(t){const e=Rs(t);return jt({mutationFn:({subscriberId:n,body:r})=>Vor(t,n,r),onSuccess:()=>void e()})}function jgr(t){const e=Rs(t);return jt({mutationFn:n=>Hor(t,n),onSuccess:()=>void e()})}function Egr(t){return jt({mutationFn:e=>Gor(t,e)})}function Ngr(t,e){const n=Rs(t);return jt({mutationFn:()=>Wor(t,e),onSuccess:()=>void n()})}function Tgr(t,e){const n=Rs(t);return jt({mutationFn:async()=>{let r,s=0,i=0;do{const o=await qor(t,e,{afterId:r});if(s+=o.sent||0,i+=o.failed||0,!o.remaining||!o.nextAfterId||o.nextAfterId===r)break;r=o.nextAfterId}while(r);return{sent:s,failed:i}},onSuccess:()=>void n()})}function _gr(t,e){const n=Rs(t);return jt({mutationFn:r=>Kor(t,e,r),onSuccess:()=>void n()})}function Agr(t,e){const n=Rs(t);return jt({mutationFn:async r=>{let s,i=0,o=0;do{const l=await Yor(t,e,{afterId:s});if(i+=l.imported||0,o+=l.skipped||0,r==null||r({imported:i,skipped:o}),!l.remaining||!l.nextAfterId||l.nextAfterId===s)break;s=l.nextAfterId}while(s);return{imported:i,skipped:o,errors:[]}},onSuccess:()=>void n()})}function Pgr(t,e={}){return lt({queryKey:Er.audience(t,e),queryFn:()=>Qor(t,e),enabled:!!t})}function Rgr(t,e,n=!0){return lt({queryKey:Er.audienceCount(t,e),queryFn:()=>Zor(t,e),enabled:!!t&&n})}function VNt(t){return lt({queryKey:Er.audienceTags(t),queryFn:()=>Jor(t),enabled:!!t})}const Igr=1500,Mgr=30*60*1e3;function Lgr(t){const e=Rs(t);return jt({mutationFn:async({file:n,tags:r,onProgress:s})=>{let o=(await Xor(t,n,r)).import;s==null||s({processed:o.processed,total:o.total,imported:o.imported});const l=Date.now()+Mgr;for(;!o.finished;){if(Date.now()>l)throw new Error("This import is taking longer than expected. It is still running — check back shortly.");await new Promise(d=>setTimeout(d,Igr)),o=(await elr(t,o.importId)).import,s==null||s({processed:o.processed,total:o.total,imported:o.imported})}if(o.status==="failed")throw new Error(o.failureReason||"The import could not be completed.");return{imported:o.imported,skipped:o.skipped,skippedUnsubscribed:o.skippedUnsubscribed,skippedBlocked:o.skippedBlocked,skippedMembers:o.skippedMembers,total:o.total,processed:o.processed,errors:o.errors}},onSuccess:()=>void e()})}function Dgr(t){const e=Rs(t);return jt({mutationFn:n=>tlr(t,n),onSuccess:()=>void e()})}function $gr(t){const e=Rs(t);return jt({mutationFn:n=>nlr(t,n.memberId,n.tags),onSuccess:()=>void e()})}function Ogr(t){return lt({queryKey:["audience-settings",t],queryFn:()=>rlr(t),enabled:!!t})}function Fgr(t){const e=rn();return jt({mutationFn:n=>slr(t,n),onSuccess:n=>{e.setQueryData(["audience-settings",t],n.settings)}})}function Bgr(t){const e=Rs(t);return jt({mutationFn:n=>ilr(t,n),onSuccess:()=>void e()})}function Ugr(t){const e=Rs(t);return jt({mutationFn:({contactId:n,body:r})=>alr(t,n,r),onSuccess:()=>void e()})}function zgr(t){const e=Rs(t);return jt({mutationFn:n=>olr(t,n),onSuccess:()=>void e()})}function Vgr(t,e={}){return lt({queryKey:Er.segments(t,e),queryFn:()=>llr(t,e),enabled:!!t})}function Hgr(t){const e=Rs(t);return jt({mutationFn:n=>clr(t,n),onSuccess:()=>void e()})}function Ggr(t){const e=Rs(t);return jt({mutationFn:({segmentId:n,body:r})=>dlr(t,n,r),onSuccess:()=>void e()})}function Wgr(t){return jt({mutationFn:e=>hlr(t,e)})}function qgr(t){const e=Rs(t);return jt({mutationFn:({campaignId:n,subject:r})=>mlr(t,n,{subject:r}),onSuccess:()=>void e()})}function Kgr(t){const e=Rs(t);return jt({mutationFn:n=>ulr(t,n),onSuccess:()=>void e()})}function VAe(t){return lt({queryKey:Er.templates(t),queryFn:()=>flr(t),enabled:!!t})}function HAe(t,e={}){return lt({queryKey:Er.forms(t,e),queryFn:()=>Mlr(t,e),enabled:!!t})}function Ygr(t){const e=Rs(t);return jt({mutationFn:n=>Llr(t,n),onSuccess:()=>void e()})}function Qgr(t){const e=Rs(t);return jt({mutationFn:({formId:n,body:r})=>Dlr(t,n,r),onSuccess:()=>void e()})}function Zgr(t){const e=Rs(t);return jt({mutationFn:({formId:n,status:r})=>$lr(t,n,r),onSuccess:()=>void e()})}function Jgr(t,e){return lt({queryKey:Er.formSubmissions(t,e),queryFn:()=>Flr(t,e),enabled:!!(t&&e)})}function Xgr(t){const e=Rs(t);return jt({mutationFn:n=>Olr(t,n),onSuccess:()=>void e()})}function evr(t,e){return lt({queryKey:Er.sequencesList(t,e),queryFn:()=>ljt(t,e),enabled:!!t})}function tvr(t){return lt({queryKey:Er.funnels(t),queryFn:()=>zlr(t),enabled:!!t})}function nvr(t){const e=Rs(t);return jt({mutationFn:n=>Vlr(t,n),onSuccess:()=>void e()})}function rvr(t){const e=Rs(t);return jt({mutationFn:({funnelId:n,body:r})=>Hlr(t,n,r),onSuccess:()=>void e()})}function svr(t){const e=Rs(t);return jt({mutationFn:({funnelId:n,status:r})=>Glr(t,n,r),onSuccess:()=>void e()})}function ivr(t){const e=Rs(t);return jt({mutationFn:n=>Wlr(t,n),onSuccess:()=>void e()})}function avr(t){return lt({queryKey:Er.senderDomains(t),queryFn:()=>Slr(t),enabled:!!t})}function ovr(t){const e=Rs(t);return jt({mutationFn:n=>Clr(t,n),onSuccess:()=>void e()})}function lvr(t){const e=rn();return jt({mutationFn:n=>jlr(t,n),onSuccess:n=>{n&&e.setQueryData(Er.senderDomains(t),r=>r&&r.map(s=>s.id===n.id?n:s))}})}const GAe=64;function pse(t){return(String(t??"").split(/[,;|]/).map(n=>n.trim()).find(Boolean)??"").slice(0,GAe)}const cvr={"Manual enroll":"manual",Manual:"manual","On Signup Newsletter":"signup","On Confirm Newsletter":"confirm","On signup":"signup","On confirm":"confirm","Tag added":"tag_added","Opened a campaign":"opened_campaign","Clicked a campaign":"clicked_campaign","Contact created":"contact_created","Joined community":"joined"},dvr={manual:"Manual enroll",signup:"On Signup Newsletter",confirm:"On Confirm Newsletter",tag_added:"Tag added",opened_campaign:"Opened a campaign",clicked_campaign:"Clicked a campaign",contact_created:"Contact created",joined:"Joined community"};function uvr(t,e){const n=cvr[t??""]??"manual",r={type:n};return n==="tag_added"&&(r.tag=pse(e)||null),r}function hvr(t){return dvr[(t==null?void 0:t.type)??"manual"]??"Manual enroll"}function mvr(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function VZ(t){return(t.subject||t.email||"").trim()}function nHe(t,e=90){const n=String(t||"").replace(/<style[\s\S]*?<\/style>/gi," ").replace(/<[^>]+>/g," ").replace(/&nbsp;/gi," ").replace(/&amp;/gi,"&").replace(/&lt;/gi,"<").replace(/&gt;/gi,">").replace(/\s+/g," ").trim();return n?n.length>e?`${n.slice(0,e).trimEnd()}…`:n:""}function fvr(t){const e=[];return(t??[]).forEach((n,r)=>{const s=n.id||`st${r}`;if(n.type==="legacy"){n.raw&&e.push(n.raw);return}if(n.type==="email"){const i=VZ(n)||"Untitled email";e.push({id:s,type:"send_email",subject:i,html:(n.html||"").trim()||`<p>${mvr(i)}</p>`});return}if(n.type==="notify_admin"){e.push({id:s,type:"notify_admin",subject:(n.subject||"").trim()||void 0,html:(n.html||"").trim()||void 0});return}if(n.type==="add_tag"||n.type==="remove_tag"){const i=pse(n.tag);i&&e.push({id:s,type:n.type,tag:i});return}if(n.type==="enroll_in_sequence"){n.sequenceId&&e.push({id:s,type:"enroll_in_sequence",sequenceId:n.sequenceId});return}e.push({id:s,type:"wait",delayValue:n.delayValue??1,delayUnit:n.delayUnit??"days"})}),e}function pvr(t){var e,n;if(t.type==="condition"){const r=(e=t.condition)==null?void 0:e.kind;return r==="has_tag"?(n=t.condition)!=null&&n.tag?`Only if tagged "${t.condition.tag}"`:"Only if tagged":r==="opened_previous"?"Only if they opened the last campaign":r==="clicked_previous"?"Only if they clicked the last campaign":"Condition"}return t.type}function gvr(t){return(t??[]).map((e,n)=>{const r=e.id||`st${n}`;if(e.type==="send_email")return{id:r,type:"email",subject:e.subject??"",email:e.subject??"",html:e.html??""};if(e.type==="wait"){const s=["minutes","hours","days"].includes(String(e.delayUnit))?e.delayUnit:"days";return{id:r,type:"wait",delayValue:e.delayValue??1,delayUnit:s}}return e.type==="notify_admin"?{id:r,type:"notify_admin",subject:e.subject??"",html:e.html??""}:e.type==="enroll_in_sequence"?{id:r,type:"enroll_in_sequence",sequenceId:e.sequenceId}:e.type==="add_tag"||e.type==="remove_tag"?{id:r,type:e.type,tag:e.tag??""}:{id:r,type:"legacy",legacyLabel:pvr(e),raw:e}})}function rHe(t){var s,i,o;const e=gvr(t.steps),n=((s=t.stats)==null?void 0:s.enrolled)??0,r=((i=t.stats)==null?void 0:i.completed)??0;return{id:t.id,name:t.name,status:t.status,trigger:hvr(t.trigger),triggerTag:((o=t.trigger)==null?void 0:o.type)==="tag_added"?t.trigger.tag??"":"",steps:e.filter(l=>l.type==="email").length,stepList:e,enrolled:n,completionRate:n>0?Math.round(r/n*100):0,openRate:0}}function vvr(t){let e=String(t||"").trim();if(!e)return"Campaign";let n="";for(;e!==n;)n=e,e=e.replace(/^(?:copy of\s+)+/i,"").replace(/(?:\s*\(copy(?:\s+\d+)?\))+$/i,"").replace(/(?:\s*[—–-]\s*resend to non-openers(?:\s+\(\d+\))?)+$/i,"").trim();return e||"Campaign"}function yvr(t,e){const n=new Set((t||[]).map(i=>String(i||"").trim().toLowerCase()).filter(Boolean));let r=1,s=e(r);for(;n.has(s.toLowerCase());)r+=1,s=e(r);return s}function HNt(t,e=[]){const n=vvr(t);return yvr(e,r=>r===1?`${n} (copy)`:`${n} (copy ${r})`)}const GNt=y.createContext(null);function I3(t){const e=typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10);return`${t}_${e}`}function XR(t){return t||void 0}function bvr(t){const e=["217 91% 50%","152 55% 42%","38 92% 50%","270 70% 55%","0 72% 55%","210 80% 56%"];return e[t%e.length]}function HZ(t){var e,n,r;return{id:t.id,title:t.title,subject:t.subject,preheader:t.preheader,fromName:t.fromName,type:t.type,status:t.status==="sending"?"sending":t.status,audience:((e=t.audienceFilters)==null?void 0:e.kind)||t.audienceSegmentId||"Everyone",audienceSegmentId:t.audienceSegmentId??null,audienceFilters:t.audienceFilters??null,templateId:t.templateId??null,blocks:(t.blocks??[]).map((s,i)=>{var o,l;return{id:String(s._id||s.id||`b${i}`),type:s.type,text:s.text,html:s.html,url:s.url,label:s.label,left:s.left,right:s.right,data:Array.isArray((o=s.data)==null?void 0:o.images)||typeof((l=s.data)==null?void 0:l.videoId)=="string"?s.data:void 0}}),recipients:t.recipients??((n=t.stats)==null?void 0:n.recipients)??0,delivered:t.delivered??((r=t.stats)==null?void 0:r.delivered)??0,openRate:t.openRate??0,clickRate:t.clickRate??0,abTest:!!t.abTest,updatedAt:t.updatedAt||t.createdAt||new Date().toISOString(),sentAt:XR(t.sentAt),scheduledAt:XR(t.scheduledAt),folderId:t.folderId??null,sendProgress:t.sendProgress??null}}function sHe(t){var e,n,r,s,i;return{id:t.id,title:t.title,description:t.description||"",thumbnail:t.thumbnail||void 0,senderName:t.senderName||L2,senderEmail:t.senderEmail||"",replyTo:t.replyTo||"",frequency:t.frequency||"Weekly",frequencyPostId:t.frequencyPostId?String(t.frequencyPostId):null,nextSendAt:XR(t.nextSendAt),lastFrequencySentAt:XR(t.lastFrequencySentAt),published:!!t.published,autoSubscribeOnJoin:!!t.autoSubscribeOnJoin,signupHeadline:t.signupHeadline||((e=t.signup)==null?void 0:e.headline)||`Join ${t.title}`,signupSubtext:t.signupSubtext||((n=t.signup)==null?void 0:n.subtext)||"Subscribe to get the latest updates.",address:t.mailingAddress||"",welcomeEmail:{enabled:!!((r=t.welcomeEmail)!=null&&r.enabled),subject:((s=t.welcomeEmail)==null?void 0:s.subject)||"",html:((i=t.welcomeEmail)==null?void 0:i.html)||""},createdAt:t.createdAt||new Date().toISOString()}}function m0e(t){var e,n;return{id:t.id,newsletterId:t.newsletterId,title:t.title,content:t.content??"",status:t.status,recipients:t.recipients??((e=t.stats)==null?void 0:e.recipients)??0,delivered:((n=t.stats)==null?void 0:n.delivered)??t.delivered??0,openRate:t.openRate??0,clickRate:t.clickRate??0,createdAt:t.createdAt||new Date().toISOString(),updatedAt:t.updatedAt||t.createdAt||new Date().toISOString(),publishedAt:XR(t.publishedAt),scheduledAt:XR(t.scheduledAt),thumbnail:t.thumbnail||void 0,seoTitle:t.seoTitle||"",metaDescription:t.metaDescription||"",tags:t.tags||[],authors:t.authors||[],hideFromWeb:!!t.hideFromWeb,sendProgress:t.sendProgress??null}}function WNt(t){return{id:t.id,newsletterId:t.newsletterId,name:t.name||t.email,email:t.email,subscribedAt:(t.subscribedAt||t.createdAt||new Date().toISOString()).slice(0,10),status:t.status,source:t.source||"Manual",unsubscribedAt:t.unsubscribedAt??null,unsubscribeReason:t.unsubscribeReason??null}}function xvr(t,e){var n,r;return{id:t.id,name:t.name,count:t.count??((n=t.contactIds)==null?void 0:n.length)??0,color:bvr(e),contactIds:(r=t.contactIds)==null?void 0:r.map(String),autoAddNewMembers:!!t.autoAddNewMembers,rules:t.rules}}function tue(t){return{title:t.title,subject:t.subject,preheader:t.preheader,fromName:t.fromName,type:t.type,status:t.status&&t.status!=="draft"?"draft":t.status,folderId:t.folderId,audienceSegmentId:t.audienceSegmentId,audienceFilters:t.audienceFilters,templateId:t.templateId,blocks:t.blocks,scheduledAt:t.scheduledAt,sentAt:t.sentAt,stats:{recipients:t.recipients??0,delivered:t.delivered??0,opened:Math.round((t.openRate??0)/100*(t.delivered??0)),clicked:Math.round((t.clickRate??0)/100*(t.delivered??0))}}}function iHe(t){var n,r;const e={title:t.title,description:t.description,thumbnail:t.thumbnail,senderName:t.senderName,replyTo:t.replyTo,mailingAddress:t.address,welcomeEmail:t.welcomeEmail,frequency:t.frequency,frequencyPostId:t.frequencyPostId,published:t.published,autoSubscribeOnJoin:t.autoSubscribeOnJoin};return(t.signupHeadline!==void 0||t.signupSubtext!==void 0||t.signup)&&(e.signup={headline:t.signupHeadline??((n=t.signup)==null?void 0:n.headline)??"",subtext:t.signupSubtext??((r=t.signup)==null?void 0:r.subtext)??""},e.signupHeadline=t.signupHeadline,e.signupSubtext=t.signupSubtext),e}function nue(t){return{title:t.title,content:t.content,status:t.status,scheduledAt:t.scheduledAt,publishedAt:t.publishedAt,thumbnail:t.thumbnail,seoTitle:t.seoTitle,metaDescription:t.metaDescription,tags:t.tags,authors:t.authors,hideFromWeb:t.hideFromWeb}}function wvr({children:t}){var re,fe,le;const{community:e}=qe(),n=(e==null?void 0:e.id)??null,r=rn(),s=DNt(n,{page:1,limit:100}),i=UNt(n,{page:1,limit:100}),o=Vgr(n,{page:1,limit:100}),l=((re=i.data)==null?void 0:re.data)??[],c=$fe({queries:l.map(q=>({queryKey:Er.posts(n,q.id,{page:1,limit:100}),queryFn:()=>rjt(n,q.id,{page:1,limit:100}),enabled:!!(n&&q.id),refetchInterval:Y=>{var Q;return(((Q=Y.state.data)==null?void 0:Q.data)??[]).some(ie=>{var he;return ie.status==="published"&&(((he=ie.sendProgress)==null?void 0:he.queued)??0)>0})?4e3:!1}}))}),d=$fe({queries:l.map(q=>({queryKey:Er.subscribers(n,q.id,{page:1,limit:100}),queryFn:()=>sjt(n,q.id,{page:1,limit:100}),enabled:!!(n&&q.id)}))}),[u,h]=y.useState([]),[m,f]=y.useState([]),[p,g]=y.useState([]),v=y.useMemo(()=>[...Er.all(n),"sequences"],[n]),b=lt({queryKey:v,queryFn:()=>ljt(n),enabled:!!n}),x=y.useMemo(()=>b.data??[],[b.data]),w=y.useCallback((q,Y)=>{r.setQueryData(v,X=>(X??[]).map(Q=>Q.id===q?{...Q,...Y,trigger:Y.trigger??Q.trigger,steps:Y.steps??Q.steps}:Q))},[r,v]),k=y.useMemo(()=>x.map(rHe),[x]),S=cgr(n),C=dgr(n),j=hgr(n),E=ugr(n),N=mgr(n),A=ONt(n),_=fgr(n),T=FNt(n),R=BNt(n),O=vgr(n),F=ygr(n),D=bgr(n),I=wgr(n),P=kgr(n),M=Sgr(n),z=Cgr(n),G=zNt(n),B=jgr(n),H=Bgr(n);Ugr(n);const W=zgr(n),V=Hgr(n);Ggr(n),Kgr(n);const U=y.useCallback(()=>{n&&r.invalidateQueries({queryKey:Er.all(n)})},[n,r]),ne=y.useMemo(()=>{var q,Y;return{campaigns:(((q=s.data)==null?void 0:q.data)??[]).map(HZ),sequences:k,funnels:m,forms:p,contacts:[],contactsTotal:0,segments:(((Y=o.data)==null?void 0:Y.data)??[]).map(xvr),folders:u,newsletters:l.map(sHe),posts:c.flatMap(X=>{var Q;return(((Q=X.data)==null?void 0:Q.data)??[]).map(m0e)}),subscribers:d.flatMap(X=>{var Q;return(((Q=X.data)==null?void 0:Q.data)??[]).map(WNt)})}},[l,(fe=s.data)==null?void 0:fe.data,u,p,m,c,(le=o.data)==null?void 0:le.data,k,d]),te=y.useMemo(()=>({...ne,addCampaign:async q=>{const Y=await S.mutateAsync(tue(q));return q.status==="sent"&&await A.mutateAsync({campaignId:Y.id,body:{}}),q.status==="scheduled"&&q.scheduledAt&&await T.mutateAsync({campaignId:Y.id,body:{scheduledAt:q.scheduledAt}}),HZ(Y)},updateCampaign:async(q,Y)=>{if(Y.status==="sent"){await A.mutateAsync({campaignId:q,body:{}});return}if(Y.status==="scheduled"&&Y.scheduledAt){const{status:X,scheduledAt:Q,...ie}=tue(Y);await C.mutateAsync({campaignId:q,body:ie}),await T.mutateAsync({campaignId:q,body:{scheduledAt:Y.scheduledAt}});return}if(Y.status==="draft"&&Object.prototype.hasOwnProperty.call(Y,"scheduledAt")){await R.mutateAsync(q);return}await C.mutateAsync({campaignId:q,body:tue(Y)})},duplicateCampaign:async q=>{const Y=ne.campaigns.find(Q=>Q.id===q),X=Y?HNt(Y.title,ne.campaigns.map(Q=>Q.title)):void 0;await j.mutateAsync({campaignId:q,title:X})},deleteCampaign:async q=>{await E.mutateAsync(q)},moveCampaign:async(q,Y)=>{await N.mutateAsync({campaignId:q,folderId:Y})},sendTestCampaign:async(q,Y)=>{await _.mutateAsync({campaignId:q,body:Y?{email:Y}:{}})},addFolder:q=>{const Y={id:I3("fld"),name:q||"New folder"};return h(X=>[...X,Y]),Y},deleteFolder:q=>{h(Y=>Y.filter(X=>X.id!==q)),ne.campaigns.filter(Y=>Y.folderId===q).forEach(Y=>void N.mutateAsync({campaignId:Y.id,folderId:null}))},addNewsletter:async q=>{const Y=await O.mutateAsync({title:q.title||"Untitled newsletter",description:q.description||"",thumbnail:q.thumbnail,senderName:q.senderName||L2,replyTo:q.replyTo||"",mailingAddress:q.address||"",frequency:q.frequency||"Weekly",published:!1,signup:{headline:`Join ${q.title||"our newsletter"}`,subtext:"Subscribe to get our latest updates straight to your inbox."}});return sHe(Y)},updateNewsletter:async(q,Y)=>{await F.mutateAsync({newsletterId:q,body:iHe(Y)})},duplicateNewsletter:async q=>{const Y=ne.newsletters.find(X=>X.id===q);Y&&await O.mutateAsync(iHe({...Y,title:`${Y.title} (copy)`,published:!1,frequencyPostId:null,nextSendAt:void 0,lastFrequencySentAt:void 0}))},deleteNewsletter:async q=>{await D.mutateAsync(q)},addPost:async q=>{const Y=await I.mutateAsync({newsletterId:q.newsletterId,body:nue({title:q.title||"Untitled post",content:q.content??"",status:q.status||"draft",thumbnail:q.thumbnail,seoTitle:q.seoTitle,metaDescription:q.metaDescription,tags:q.tags||[],authors:q.authors||["Community"],hideFromWeb:q.hideFromWeb??!1})});return m0e(Y)},updatePost:async(q,Y)=>{if(Y.status==="published"){const X=ne.posts.find(ie=>ie.id===q),Q=(X==null?void 0:X.newsletterId)||Y.newsletterId;if(!Q)throw new Error("Couldn't find this post's newsletter. Refresh and try again.");await M.mutateAsync({newsletterId:Q,postId:q});return}await P.mutateAsync({postId:q,body:nue(Y)})},duplicatePost:async q=>{const Y=ne.posts.find(X=>X.id===q);Y&&await I.mutateAsync({newsletterId:Y.newsletterId,body:nue({...Y,title:`${Y.title} (copy)`,status:"draft",publishedAt:void 0,scheduledAt:void 0})})},deletePost:async q=>{await z.mutateAsync(q)},addSubscriber:async q=>{const Y={name:q.name,email:q.email,source:"Manual",status:"Subscribed"};n&&(await zor(n,q.newsletterId,Y),U())},unsubscribe:async q=>{await G.mutateAsync({subscriberId:q,body:{status:"Unsubscribed"}})},removeSubscriber:async q=>{await B.mutateAsync(q)},addSequence:async q=>{const Y=await dVe(n,{name:q||"Untitled sequence",kind:"sequence",trigger:{type:"signup"},steps:[]});return U(),rHe(Y)},updateSequence:async(q,Y)=>{if(!n)return;const X={};if(Y.name!==void 0&&(X.name=Y.name),Y.trigger!==void 0||Y.triggerTag!==void 0){const Q=k.find(ie=>ie.id===q);X.trigger=uvr(Y.trigger??(Q==null?void 0:Q.trigger),Y.triggerTag??(Q==null?void 0:Q.triggerTag))}if(Y.stepList!==void 0&&(X.steps=fvr(Y.stepList)),Object.keys(X).length&&(X.kind="sequence",w(q,X),await Plr(n,q,X)),Y.status!==void 0){const Q=k.find(ie=>ie.id===q);Y.status!==(Q==null?void 0:Q.status)&&Y.status!=="draft"&&await Ilr(n,q,Y.status==="active"?"activate":"pause")}U()},updateFunnel:(q,Y)=>f(X=>X.map(Q=>Q.id===q?{...Q,...Y}:Q)),duplicateSequence:async q=>{const Y=x.find(X=>X.id===q);!Y||!n||(await dVe(n,{name:`${Y.name} (copy)`,kind:"sequence",trigger:Y.trigger,steps:Y.steps}),U())},deleteSequence:async q=>{n&&(await Rlr(n,q),U())},addFunnel:q=>{const Y={id:I3("fnl"),name:q||"Untitled funnel",status:"draft",stages:[{name:"Landing page",visitors:0},{name:"Opt-in",visitors:0}],conversionRate:0,revenue:0};return f(X=>[Y,...X]),Y},duplicateFunnel:q=>f(Y=>{const X=Y.find(Q=>Q.id===q);return X?[{...X,id:I3("fnl"),name:`${X.name} (copy)`,status:"draft"},...Y]:Y}),deleteFunnel:q=>f(Y=>Y.filter(X=>X.id!==q)),addForm:(q,Y)=>{const X={id:I3("frm"),name:q||"Untitled form",type:Y,status:"draft",views:0,submissions:0};return g(Q=>[X,...Q]),X},toggleForm:q=>g(Y=>Y.map(X=>X.id===q?{...X,status:X.status==="published"?"draft":"published"}:X)),duplicateForm:q=>g(Y=>{const X=Y.find(Q=>Q.id===q);return X?[{...X,id:I3("frm"),name:`${X.name} (copy)`,status:"draft",views:0,submissions:0},...Y]:Y}),deleteForm:q=>g(Y=>Y.filter(X=>X.id!==q)),addContact:async q=>{await H.mutateAsync({name:q.name,email:q.email,tags:Array.isArray(q.tags)?q.tags:[],segmentId:q.segmentId,segmentIds:q.segmentIds})},deleteContact:async q=>{await W.mutateAsync(q)},addSegment:async q=>{await V.mutateAsync({name:q||"New segment",rules:[]})},reset:()=>{h([]),f([]),g([]),U()}}),[S,H,O,I,V,n,E,W,D,z,B,j,U,N,w,x,M,T,A,_,ne,R,C,F,P,G]);return a.jsx(GNt.Provider,{value:te,children:t})}function Jy(){const t=y.useContext(GNt);if(!t)throw new Error("useEmailMarketing must be used within EmailMarketingProvider");return t}const qNt=y.createContext(null);function kvr({children:t}){const{community:e}=qe(),n=y.useMemo(()=>({communityId:(e==null?void 0:e.id)??null}),[e==null?void 0:e.id]);return a.jsx(qNt.Provider,{value:n,children:t})}function Svr(){const t=y.useContext(qNt);if(!t)throw new Error("useContentContext must be used within ContentProvider");return t}function WAe({variant:t}){const e=t==="repost"?LA:iI;return a.jsxs("span",{className:"relative inline-flex shrink-0","aria-hidden":!0,children:[a.jsx("span",{className:ee("flex h-8 w-8 items-center justify-center rounded-xl sm:h-9 sm:w-9","bg-primary bg-[linear-gradient(135deg,rgba(255,255,255,0.28),rgba(255,255,255,0)_60%)] text-primary-foreground","shadow-md shadow-primary/30 ring-1 ring-inset ring-white/20"),children:a.jsx(e,{className:"h-4 w-4 sm:h-[18px] sm:w-[18px]",strokeWidth:2.25})}),t==="create"&&a.jsx("span",{className:"absolute -right-1.5 -top-1.5 flex h-4 w-4 items-center justify-center rounded-full bg-background shadow-sm ring-2 ring-background",children:a.jsx(Dn,{className:"h-2.5 w-2.5 text-primary",strokeWidth:3})})]})}function qAe(t){return ae.post("/post",t)}async function KNt(t,{page:e=1,sort:n="recent",duration:r=""}={}){const s=new URLSearchParams({sort:String(n),page:String(e),duration:r});return ae.get(`/post/directory/${encodeURIComponent(t)}?${s.toString()}`)}async function Cvr(){return ae.get("/bookmark")}async function jvr(t){return ae.get(`/community/${encodeURIComponent(t)}/highlighted-posts`)}async function GZ(t,e){const n=e?`?${new URLSearchParams({commentLimit:String(e.limit),commentSort:e.sort})}`:"";return ae.get(`/post/${encodeURIComponent(t)}${n}`)}const qr=t=>encodeURIComponent(t);function YNt(t,e){return ae.post(`/post/${qr(t)}/like`,e?{emoji:e}:void 0)}function QNt(t){return ae.post(`/post/${qr(t)}/dislike`)}function ZNt(t){return ae.post(`/post/${qr(t)}/bookmark`)}function JNt(t){return ae.delete(`/post/${qr(t)}/bookmark`)}function WZ(t,e){return ae.post(`/post/${qr(t)}/comment`,{description:e})}function XNt(t,e,n,r){return ae.post(`/post/${qr(t)}/comment/${qr(e)}`,{description:n,...r?{images:r}:{}})}function eTt(t,e,n){const r=new FormData;return n.forEach(s=>r.append("images[]",s)),Ea(`/post/${qr(t)}/comment/${qr(e)}/images`,r)}function tTt(t,e,n){const r=new FormData;return r.append("document",n),Ea(`/post/${qr(t)}/comment/${qr(e)}/document`,r)}function nTt(t,e){return ae.delete(`/post/${qr(t)}/comment/${qr(e)}`)}function rTt(t,e,n){return ae.post(`/post/${qr(t)}/comment/${qr(e)}/like`,{emoji:n})}function sTt(t,e){return ae.post(`/post/${qr(t)}/comment/${qr(e)}/dislike`)}const f0e="recent";function hq(t,e,n){const r=new URLSearchParams({page:String(e),sort:n});return ae.get(`/post/${qr(t)}/comments?${r}`)}function Evr(t,e){return ae.get(`/post/${qr(t)}/reposters?page=${e}`)}function Nvr(t,e,n){const r=new URLSearchParams({page:String(e)});return n!=null&&r.set("option",n),ae.get(`/post/${qr(t)}/poll-voters?${r}`)}function Tvr(t){return ae.get(`/post/${qr(t)}/analytics`)}function _vr(t){return ae.post("/post/impressions",{postIds:t})}function Avr(t,e,n){const r=new URLSearchParams({page:String(e)});return n&&r.set("emoji",n),ae.get(`/post/${qr(t)}/reaction-users?${r}`)}function Pvr(t,e,n,r){const s=new URLSearchParams({page:String(n)});return r&&s.set("emoji",r),ae.get(`/post/${qr(t)}/comment/${qr(e)}/reaction-users?${s}`)}function iTt(t,e,n,r=[]){if(r.length>0){const s=new FormData;return s.append("description",n),r.forEach(i=>s.append("images[]",i)),Ea(`/post/${qr(t)}/comment/${qr(e)}/reply`,s)}return ae.post(`/post/${qr(t)}/comment/${qr(e)}/reply`,{description:n})}function aTt(t,e,n,r){return ae.post(`/post/${qr(t)}/comment/${qr(e)}/reply/${qr(n)}`,{description:r})}function oTt(t,e,n){return ae.delete(`/post/${qr(t)}/comment/${qr(e)}/reply/${qr(n)}`)}function lTt(t,e,n,r){return ae.post(`/post/${qr(t)}/comment/${qr(e)}/reply/${qr(n)}/like`,{emoji:r})}function cTt(t,e,n){return ae.post(`/post/${qr(t)}/comment/${qr(e)}/reply/${qr(n)}/dislike`)}function Rvr(t,e,n,r,s){const i=new URLSearchParams({page:String(r)});return s&&i.set("emoji",s),ae.get(`/post/${qr(t)}/comment/${qr(e)}/reply/${qr(n)}/reaction-users?${i}`)}function KAe(t,e){return ae.post(`/post/${qr(t)}/vote`,{option:e})}function Ivr(t,e,n){return ae.post(`/post/${qr(t)}/answer-quiz`,{answers:e,...typeof n=="number"?{timeTaken:n}:{}})}function dTt(t){return ae.post(`/post/${qr(t)}/pin`)}function uTt(t){return ae.post(`/post/${qr(t)}/unpin`)}function hTt(t){return ae.delete(`/post/${qr(t)}`)}function p0e(t,e,n,r){return ae.post(`/community/${encodeURIComponent(t)}/post/move`,{postId:e,groupId:n,...r?{tabId:r}:{}})}function Mvr(t,e){return ae.post(`/post/${qr(t)}`,e)}function YAe(t,e){return ae.post(`/community/${encodeURIComponent(t)}/report-peer`,e)}function Lvr(t,e){return ae.post(`/community/${encodeURIComponent(t)}/highlighted-posts/${qr(e)}`)}function mTt(t,e){return ae.delete(`/community/${encodeURIComponent(t)}/highlighted-posts/${qr(e)}`)}function Dvr(t,e){return ae.post(`/community/${encodeURIComponent(t)}/highlighted-posts/sort`,{sortOrder:e})}function N$(t){return t.myRole==="admin"}function fTt(t){return t.myRole==="moderator"}function $vr(t){return t.myRole==="user"}function aHe(t){return N$(t)||fTt(t)||$vr(t)}function Ovr(t){return t.groupType==="open"}function oHe(t){return t.groupType==="closed-free"}function Fvr(t,e){return e.isClosed?e.postLevel==="admin"?N$(t):aHe(t)||!!e.isJoined:Ovr(t)&&e.postLevel==="anyone"?!0:oHe(t)&&e.postLevel==="anyone"?aHe(t):oHe(t)&&e.postLevel==="admin"?N$(t):N$(t)?!0:e.postLevel==="anyone"}function pTt(t){return t.joinStatus?t.joinStatus==="joined":!!t.myRole}function Bvr(t){return!!t.isJoined||t.status==="joined"}function Uvr(t,e){return e.sectionType==="realtime"?"chat sections don't take posts":pTt(t)?e.isClosed&&!Bvr(e)?"section is closed":e.postLevel==="admin"&&!N$(t)&&!fTt(t)?"only admin can post in this group":"":"user is not part of the group"}function QAe(t,e){return Uvr(t,e)===""}function zvr(t,e){return e.sectionType!=="realtime"?!1:Mu(t)&&Fvr(t,e)}function EN(t){const e=[];for(const n of t)for(const r of n.tabs??[])!r.id||!QAe(n,r)||e.push({id:`${n.id}:${r.id}`,label:`${n.name} · ${r.name}`,groupId:n.id,tabId:r.id,groupName:n.name,tabName:r.name,tabEmoji:r.emoji||void 0,canPost:!0});return e}function Vvr(t){const e=new Map(EN(t).map(r=>[r.id,r])),n=[];for(const r of t){const s=r.joinStatus==="joined"||!r.joinStatus&&!!r.myRole;for(const i of r.tabs??[]){if(!i.id||i.sectionType==="realtime")continue;const o=`${r.id}:${i.id}`,l=e.get(o);l?n.push(l):!s&&!i.isClosed&&!i.isPrivate&&(i.postLevel!=="admin"||r.myRole==="admin"||r.myRole==="moderator")&&n.push({id:o,label:`${r.name} · ${i.name}`,groupId:r.id,tabId:i.id,groupName:r.name,tabName:i.name,tabEmoji:i.emoji||void 0,canPost:!1})}}return n}function ZAe(t){const e=new Map;for(const n of t){let r=e.get(n.groupId);r||(r={groupId:n.groupId,groupName:n.groupName,destinations:[]},e.set(n.groupId,r)),r.destinations.push(n)}return[...e.values()]}function Hvr(t,e){return!(e!=null&&e.id)||t.some(n=>n.id===e.id)?t:[...t,e]}function JAe(t,e){const n=EN(t);if(n.length===0)return null;if(e){const r=n.find(s=>s.tabId===e);if(r)return r}return n[0]}function g0e(t,e){return t.find(n=>n.id===e)}function Gvr(t,{preferGroupId:e,preferTabId:n,defaultTabId:r}){const s=EN(t);if(s.length===0)return null;if(e&&n){const i=g0e(s,`${e}:${n}`);if(i)return i}if(e){const i=s.find(o=>o.groupId===e);if(i)return i}return JAe(t,r)}function lHe(t){return t?typeof t=="string"?t:t.id??"":""}function Wvr(t){const e={};if(!t)return e;for(const n of["slug","title","description","openGraphTitle","openGraphDescription","openGraphImage"]){const r=t[n];typeof r=="string"&&(e[n]=r)}return e}function cHe(t,e){const n=e.removedImageUrls??[],r=e.removedVideoUrls??[],s=(t.images??[]).filter(p=>!!p&&!n.includes(p)),i=(t.videos??[]).filter(p=>!!p&&!r.includes(p)),o=[...s,...(e.addedImageUrls??[]).filter(Boolean)],l=[...i,...(e.addedVideoUrls??[]).filter(Boolean)],c=!!e.newDocumentUrl&&!!t.document&&e.newDocumentUrl!==t.document,d=!!e.newBannerUrl&&!!t.banner&&e.newBannerUrl!==t.banner,u=e.newDocumentUrl||(e.removeDocument?"":t.document??""),h=e.newBannerUrl||(e.removeBanner?"":t.banner??""),m=Wvr(t.meta);e.meta&&(e.meta.slug!==void 0&&(m.slug=e.meta.slug),e.meta.ogTitle!==void 0&&(m.openGraphTitle=e.meta.ogTitle),e.meta.ogDescription!==void 0&&(m.openGraphDescription=e.meta.ogDescription),e.meta.ogImage!==void 0&&(m.openGraphImage=e.meta.ogImage));const f=[...n,...r,...(e.removeDocument||c)&&t.document?[t.document]:[],...(e.removeBanner||d)&&t.banner?[t.banner]:[]].filter((p,g,v)=>v.indexOf(p)===g).map(p=>({mediaItem:p}));return{groupId:lHe(t.group),tabId:lHe(t.tab),title:e.title,description:e.description,tags:(t.tags??[]).filter(p=>typeof p=="string"),images:o,videos:l,document:u?[u]:[],banner:h?[h]:[],embedCode:e.embedCode??t.embedCode??"",embedCodeHeight:e.embedCodeHeight??t.embedCodeHeight??"",buttons:(e.buttons??t.buttons??[]).map(p=>({label:p.label,url:p.url,position:p.position})),preferences:t.preferences??{},meta:m,removedMediaUploadsOnEdit:f,...e.publishNow?{publishNow:!0}:{},...!e.publishNow&&e.scheduledPublishAt?{scheduledPublishAt:e.scheduledPublishAt}:{}}}function qvr(t,e){return!!(t.title.trim()||t.description.trim()||t.images.length||t.videos.length||t.document.length||t.banner.length||t.embedCode.trim()||e.poll)}const Wk=t=>encodeURIComponent(t),hx=18;async function Dy(t,e={}){var s,i,o,l;const n=new URLSearchParams({page:String(e.page??1),limit:String(e.limit??hx)});(s=e.search)!=null&&s.trim()&&n.set("search",e.search.trim()),(i=e.groupId)!=null&&i.trim()&&n.set("group",e.groupId.trim()),(o=e.annotateGroupId)!=null&&o.trim()&&n.set("annotateGroup",e.annotateGroupId.trim()),(l=e.role)!=null&&l.trim()&&n.set("role",e.role.trim()),e.subscribed&&n.set("subscribed",e.subscribed),e.verified&&n.set("verified",e.verified),e.following&&n.set("following",e.following),e.sort&&n.set("sort",e.sort),e.fieldFilters&&n.set("fieldFilters",e.fieldFilters);const r=await ae.get(`/community/${Wk(t)}/subscribers/paginated?${n.toString()}`);return{users:Array.isArray(r==null?void 0:r.users)?MSe(r.users):[],page:(r==null?void 0:r.page)??1,limit:(r==null?void 0:r.limit)??hx,total:(r==null?void 0:r.total)??0,counts:r==null?void 0:r.counts}}async function Kvr(t,e){await ae.post(`/community/${Wk(t)}/user/${Wk(e)}/verify`,{})}async function dHe(t,e,n){await ae.post(`/community/${Wk(t)}/user/${Wk(e)}/remove-from-community`,n!=null&&n.trim()?{reason:n.trim()}:{})}async function Yvr(t,e){await ae.post(`/community/${Wk(t)}/user/${Wk(e)}/restore-to-community`,{})}async function uHe(t,e,n){await ae.post(`/community/${Wk(t)}/update-role`,{userId:e,role:n})}const Qvr=t=>encodeURIComponent(t);async function XAe(t,e){const n=e.trim();if(!n){const{users:s}=await Dy(t,{limit:12});return{users:s}}const r=await ae.get(`/mentions/search-community/${Qvr(t)}?query=${encodeURIComponent(n)}`);return{users:Array.isArray(r==null?void 0:r.users)?MSe(r.users):[]}}function gTt(){const t=Nn(),{community:e}=qe(),{toast:n}=yt(),r=(e==null?void 0:e.id)??null,s=y.useRef(new Map),i=y.useRef(!1);return y.useCallback(async o=>{const l=o.replace(/^@/,"").trim();if(!l||!r||i.current)return;const c=s.current.get(l.toLowerCase());if(c){t(ve.member(c));return}if(c===null){n({title:`@${l} isn't a member here`});return}i.current=!0;try{const{users:d}=await XAe(r,l),u=(d??[]).find(h=>String(h.userId||"").toLowerCase()===l.toLowerCase());s.current.set(l.toLowerCase(),(u==null?void 0:u.id)??null),u!=null&&u.id?t(ve.member(u.id)):n({title:`@${l} isn't a member here`})}catch{n({title:"Couldn't open that profile",variant:"destructive"})}finally{i.current=!1}},[r,t,n])}function Zvr({handle:t}){const e=gTt();return a.jsx("button",{type:"button",onClick:n=>{n.stopPropagation(),e(t)},className:"font-medium text-primary hover:underline",children:t.startsWith("@")?t:`@${t}`})}const Jvr=new $ut({gfm:!0,breaks:!0});$je.addHook("afterSanitizeAttributes",t=>{t.tagName==="A"&&(t.setAttribute("target","_blank"),t.setAttribute("rel","noopener noreferrer nofollow"))});function vTt(t){return/^\s*<([a-z][a-z0-9]*)\b[^>]*>/i.test(t)}const gse=new Z6({headingStyle:"atx",bulletListMarker:"-",codeBlockStyle:"fenced",emDelimiter:"*",strongDelimiter:"**"}),yTt=t=>{const e=(t||"").trim().replace(/\s/g,"%20");return/^https?:\/\/[^/?#]/i.test(e)?e:""};function Xvr(t){const e=t.match(/^https?:\/\/(?:www\.)?youtube(?:-nocookie)?\.com\/embed\/([\w-]{6,20})/i);if(e)return`https://www.youtube.com/watch?v=${e[1]}`;const n=t.match(/^https?:\/\/player\.vimeo\.com\/video\/(\d{5,12})/i);return n?`https://vimeo.com/${n[1]}`:t}gse.addRule("keepInlineImages",{filter:"img",replacement:(t,e)=>{const n=e,r=yTt(n.getAttribute("src"));return r?`![${(n.getAttribute("alt")||"").replace(/[[\]\\]/g,"").replace(/\s+/g," ").trim()}](${r.replace(/\(/g,"%28").replace(/\)/g,"%29")})`:""}});gse.addRule("keepEmbedsAsLinks",{filter:["iframe","video","audio"],replacement:(t,e)=>{var s;const n=e,r=yTt(n.getAttribute("src")||((s=n.querySelector("source[src]"))==null?void 0:s.getAttribute("src")));return r?`

${Xvr(r)}

`:""}});gse.addRule("dropMediaSources",{filter:["source"],replacement:()=>""});function v0e(t){const e=String(t||"").trim();return e?vTt(e)?gse.turndown(e).replace(/\n{3,}/g,`

`).trim():e:""}function eyr(t){var s;const e=t.ownerDocument,n=e.createTreeWalker(t,NodeFilter.SHOW_TEXT),r=[];for(let i=n.nextNode();i;i=n.nextNode())(i.nodeValue||"").includes("@")&&!((s=i.parentElement)!=null&&s.closest("a, code, pre"))&&r.push(i);for(const i of r){const o=i.nodeValue||"",l=e.createDocumentFragment();let c=0;for(const d of o.matchAll(Jre)){const u=(d.index??0)+d[1].length;l.append(o.slice(c,u));const h=e.createElement("span");h.className="post-mention",h.textContent=`@${d[2]}`,l.append(h),c=u+1+d[2].length}c!==0&&(l.append(o.slice(c)),i.replaceWith(l))}}function hHe(t){return t?t.nodeType===Node.TEXT_NODE?!(t.nodeValue||"").trim():t.nodeName==="BR":!0}function tyr(t){const e=Kje(t);return e?e.replace(/^https:\/\/www\.youtube\.com\/embed\//,"https://www.youtube-nocookie.com/embed/"):null}function nyr(t){var n;const e=t.ownerDocument;for(const r of Array.from(t.querySelectorAll("a[href]"))){const s=r.getAttribute("href")||"",i=(r.textContent||"").trim();if(!/^(https?:\/\/)?(www\.|m\.)?(youtube\.com|youtu\.be|vimeo\.com|player\.vimeo\.com)\//i.test(i)||(n=r.parentElement)!=null&&n.closest("li, blockquote, pre, code, table"))continue;let o=r.previousSibling;for(;o&&o.nodeType===Node.TEXT_NODE&&!(o.nodeValue||"").trim();)o=o.previousSibling;let l=r.nextSibling;for(;l&&l.nodeType===Node.TEXT_NODE&&!(l.nodeValue||"").trim();)l=l.nextSibling;if(!hHe(o)||!hHe(l))continue;const c=tyr(s);if(!c)continue;const d=e.createElement("span");d.className="post-embed";const u=e.createElement("iframe");u.setAttribute("src",c),u.setAttribute("title",c.includes("vimeo")?"Vimeo video":"YouTube video"),u.setAttribute("loading","lazy"),u.setAttribute("referrerpolicy","strict-origin-when-cross-origin"),u.setAttribute("allow","accelerometer; clipboard-write; encrypted-media; gyroscope; picture-in-picture; fullscreen"),u.setAttribute("allowfullscreen",""),u.setAttribute("sandbox","allow-scripts allow-same-origin allow-presentation allow-popups allow-popups-to-escape-sandbox"),d.append(u),l&&l.nodeName==="BR"&&l.remove(),r.after(d)}}function ePe(t,{embedVideos:e=!1}={}){const n=vTt(t)?t:Jvr.parse(t,{async:!1}),r=$je.sanitize(n,{USE_PROFILES:{html:!0},RETURN_DOM:!0});return eyr(r),e&&nyr(r),r.innerHTML}function ZB({text:t,className:e,embedVideos:n=!1}){const r=y.useMemo(()=>ePe(t,{embedVideos:n}),[t,n]),s=gTt();return a.jsx("div",{className:ee("post-markdown min-w-0 max-w-full break-words [overflow-wrap:anywhere]",e),onClick:i=>{var l,c;const o=(c=(l=i.target)==null?void 0:l.closest)==null?void 0:c.call(l,".post-mention");o&&(i.stopPropagation(),s(o.textContent||""))},dangerouslySetInnerHTML:{__html:r}})}function tPe(t,e){const n=Number.parseInt("",10);return Number.isSafeInteger(n)&&n>0?n:e}const dd=tPe(void 0,500),fa=tPe(void 0,4e3),M3=Math.max(120,dd),ET=Math.max(5e3,tPe(void 0,5e3));function bTt({form:t}){return t.showAdvancedOptions?a.jsxs("div",{className:"space-y-4 rounded-lg border border-border bg-muted/30 p-3",children:[t.canEmbed&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"embed-code",className:"text-xs",children:"Embed code"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Paste an iframe to show a video, form or page inside the post."}),a.jsx(us,{id:"embed-code",value:t.embedCode,onChange:e=>t.setEmbedCode(e.target.value),placeholder:"<iframe …></iframe>",className:"min-h-[72px] resize-none text-sm font-mono"}),a.jsx(Oe,{value:t.embedCodeHeight,onChange:e=>t.setEmbedCodeHeight(e.target.value),placeholder:"Embed height (px)",className:"h-8 text-sm"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{className:"text-xs",children:"Custom buttons"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Up to three links shown as buttons above or below the post."}),t.buttons.map((e,n)=>a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Oe,{value:e.label??"",onChange:r=>t.updateButton(n,{label:r.target.value}),placeholder:"Label",className:"h-8 text-sm flex-1"}),a.jsx(Oe,{value:e.url??"",onChange:r=>t.updateButton(n,{url:r.target.value}),placeholder:"https://",type:"url","aria-invalid":!!t.buttonErrors[n],className:ee("h-8 text-sm flex-1",t.buttonErrors[n]&&"border-destructive")}),a.jsxs("select",{value:e.position??"bottom",onChange:r=>t.updateButton(n,{position:r.target.value}),className:"h-8 rounded-md border border-input bg-background px-2 text-xs",title:"Button position",children:[a.jsx("option",{value:"top",children:"Top"}),a.jsx("option",{value:"bottom",children:"Bottom"})]}),t.buttons.length>1&&a.jsx("button",{type:"button",onClick:()=>t.removeButton(n),className:"text-muted-foreground hover:text-destructive",children:a.jsx(qn,{className:"h-4 w-4"})})]}),t.buttonErrors[n]&&a.jsx("p",{className:"text-xs text-destructive",children:t.buttonErrors[n]})]},n)),t.buttons.length<3&&a.jsxs("button",{type:"button",onClick:t.addButton,className:"flex items-center gap-1 text-xs font-medium text-primary",children:[a.jsx(Dn,{className:"h-3.5 w-3.5"})," Add button"]})]})]}):null}const xTt="link-meta",ryr=["youtube.com","youtu.be","localhost"],syr="5c6369751090deec8fdc4b34b6fe5c45";function wTt(t){if(!t)return!1;const e=(t["og:title"]??t.title??"").trim().toLowerCase(),n=t["og:image"]??"";return e==="something went wrong"||n.includes(syr)}const T$=new Map;function kTt(){try{const t=localStorage.getItem(xTt);return t?JSON.parse(t):{}}catch{return{}}}function iyr(t,e){try{const n=kTt();n[t]=e,localStorage.setItem(xTt,JSON.stringify(n))}catch{}}function JB(t){if(!t)return null;const e=t.match(/\[[^\]]*\]\((https?:\/\/[^\s)]+)\)/),n=e?null:t.match(/https?:\/\/[^\s<)\]]+/);return(e==null?void 0:e[1])??(n==null?void 0:n[0])??null}function STt(t){const e=JB(t);return!e||!CTt(e)?null:e}function CTt(t){return!ryr.some(e=>t.includes(e))}function jTt(t){if(!t)return[];const e=[],n=/\[[^\]]*\]\((https?:\/\/[^\s)]+)\)|(https?:\/\/[^\s<>"'`)\]]+)/gi;for(const r of t.matchAll(n)){const s=(r[1]??r[2]??"").replace(/\\([\\_*~[\]()#+\-.!])/g,"$1").replace(/[.,;:!?'"]+$/,"");try{const i=new URL(s);if(i.protocol!=="http:"&&i.protocol!=="https:")continue;i.hash="";const o=i.toString();e.includes(o)||e.push(o)}catch{}}return e}const aP={url:null,hidden:!1};function qZ(t,e){return t.hidden?{linkPreviewUrl:"",linkPreviewHidden:!0}:t.url&&jTt(e).includes(t.url)?{linkPreviewUrl:t.url,linkPreviewHidden:!1}:{}}function ETt(t){try{return new URL(t).hostname.replace(/^www\./i,"")}catch{return""}}function ayr(t,e){if(!e)return null;const n=e["og:title"]??e.title,r=e["og:image"];if(!n&&!r)return null;const s=e.domain||ETt(t);return{url:t,title:n||s,description:e["og:description"]??null,image:r??null,siteName:e["og:site_name"]??s,domain:s}}async function NTt(t){if(T$.has(t))return T$.get(t)??null;const e=kTt()[t];if(e!==void 0&&!wTt(e))return T$.set(t,e),e;const n=rue.get(t);if(n)return n;const r=oyr(t).finally(()=>rue.delete(t));return rue.set(t,r),r}const rue=new Map;async function oyr(t){try{const e=await ae.get(`/misc/link-preview?url=${encodeURIComponent(t)}`,{skipAuth:!0}),n=wTt(e.result??null)?null:e.result??null;return T$.set(t,n),iyr(t,n),n}catch(e){return e instanceof ze&&e.status===429||T$.set(t,null),null}}function TTt(t){const[e,n]=y.useState({url:t,preview:t?void 0:null});return y.useEffect(()=>{let r=!1;if(!t){n({url:t,preview:null});return}return n({url:t,preview:void 0}),NTt(t).then(s=>{r||n({url:t,preview:ayr(t,s)})}),()=>{r=!0}},[t]),e.url===t?e.preview:void 0}const _Tt="overflow-hidden rounded-xl border border-border bg-card";function y0e({preview:t,layout:e="large",onRemove:n,footer:r,className:s}){const[i,o]=y.useState(!1);y.useEffect(()=>o(!1),[t.image]);const l=t.domain||ETt(t.url),c=t.image&&!i?t.image:null,d=e==="compact";return a.jsxs("div",{className:ee("relative w-full",s),children:[a.jsxs("a",{href:t.url,target:"_blank",rel:"noopener noreferrer nofollow ugc",onClick:u=>u.stopPropagation(),"aria-label":`${t.title||l} (${l}, opens in a new tab)`,className:ee(_Tt,"group flex transition-colors hover:bg-muted/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",d?"flex-row items-stretch":"flex-col"),children:[c?a.jsx("span",{className:ee("block shrink-0 overflow-hidden bg-muted",d?"w-24 sm:w-32 border-r border-border":"aspect-[1.91/1] w-full border-b border-border"),children:a.jsx("img",{src:c,alt:"",loading:"lazy",referrerPolicy:"no-referrer",onError:()=>o(!0),className:"h-full w-full object-cover transition-transform duration-300 group-hover:scale-[1.02]"})}):d?a.jsx("span",{className:"flex w-16 shrink-0 items-center justify-center border-r border-border bg-muted/60 text-muted-foreground sm:w-20",children:a.jsx(Qd,{className:"h-5 w-5","aria-hidden":"true"})}):null,a.jsxs("span",{className:ee("flex min-w-0 flex-1 flex-col gap-1",d?"px-3 py-2.5":"px-4 py-3",n&&d&&"pr-10"),children:[a.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-xs text-muted-foreground",children:[(c||!d)&&a.jsx(Qd,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),a.jsx("span",{className:"truncate",children:l})]}),t.title&&a.jsx("span",{className:"line-clamp-2 break-words text-sm font-semibold leading-snug text-foreground",children:t.title}),t.description&&a.jsx("span",{className:ee("break-words text-xs leading-relaxed text-muted-foreground",d?"line-clamp-1 sm:line-clamp-2":"line-clamp-2"),children:t.description})]})]}),n&&a.jsx(ATt,{onRemove:n,className:"right-2 top-2"}),r]})}function ATt({onRemove:t,className:e}){const n=r=>{r.preventDefault(),r.stopPropagation(),t()};return a.jsx("button",{type:"button",onClick:n,"aria-label":"Remove link preview",title:"Remove preview (the link stays in your post)",className:ee("absolute z-10 flex h-7 w-7 items-center justify-center rounded-full border border-border bg-background/90 text-muted-foreground shadow-sm backdrop-blur transition-colors hover:bg-background hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",e),children:a.jsx(nn,{className:"h-3.5 w-3.5","aria-hidden":"true"})})}function PTt({layout:t="large",className:e}){const n=t==="compact";return a.jsxs("div",{role:"status","aria-label":"Loading link preview",className:ee(_Tt,"flex w-full",n?"flex-row":"flex-col",e),children:[a.jsx(sr,{className:ee("shrink-0 rounded-none",n?"h-auto min-h-[76px] w-24 sm:w-32":"aspect-[1.91/1] w-full")}),a.jsxs("div",{className:ee("flex flex-1 flex-col gap-2",n?"px-3 py-2.5":"px-4 py-3"),children:[a.jsx(sr,{className:"h-3 w-24"}),a.jsx(sr,{className:"h-4 w-3/4"}),a.jsx(sr,{className:"h-3 w-full"})]})]})}function RTt({body:t,linkPreview:e,linkPreviewHidden:n,layout:r="large",className:s}){const i=e!=null&&e.title||e!=null&&e.image?e:null,o=n||i?null:(e==null?void 0:e.url)??STt(t),l=TTt(o);return n?null:i?a.jsx(y0e,{preview:i,layout:r,className:s}):l===void 0&&o&&(e!=null&&e.url)?a.jsx(PTt,{layout:r,className:s}):l?a.jsx(y0e,{preview:l,layout:r,className:s}):null}function vse({liked:t,count:e,likeLabel:n,onToggle:r,className:s}){const i=Tn();return a.jsxs("button",{type:"button","aria-pressed":t,"aria-label":t?i("Remove your like"):n,title:t?i("You like this. Click to remove your like."):n,onClick:o=>{o.preventDefault(),o.stopPropagation(),r()},className:ee("inline-flex h-8 items-center gap-1.5 rounded-full border bg-background/95 px-3 text-xs font-medium shadow-sm transition hover:bg-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",t?"border-primary/40 text-primary":"border-border text-muted-foreground hover:text-foreground",s),children:[a.jsx(xx,{className:ee("h-3.5 w-3.5",t&&"fill-current"),"aria-hidden":!0}),a.jsx("span",{className:"tabular-nums",children:e})]})}function ITt({kicker:t,KickerIcon:e,title:n,description:r,imageUrl:s,details:i,like:o,onOpen:l,openLabel:c,className:d}){const u=Tn();return a.jsxs("div",{onClick:h=>h.stopPropagation(),className:ee("mt-2 flex w-full max-w-2xl flex-col overflow-hidden rounded-xl border border-border bg-card text-left text-foreground transition hover:border-primary/40 hover:shadow-sm sm:flex-row",d),children:[a.jsxs("button",{type:"button",onClick:l,className:"group flex min-w-0 flex-1 items-stretch text-left focus-visible:outline-none","aria-label":c,children:[s&&a.jsx("span",{className:"relative block w-24 shrink-0 overflow-hidden bg-muted sm:w-36",children:a.jsx("img",{src:s,alt:"",loading:"lazy",className:"absolute inset-0 h-full w-full object-cover transition duration-300 group-hover:scale-105"})}),a.jsxs("span",{className:"block min-w-0 flex-1 px-3 py-2.5 sm:px-4 sm:py-3",children:[a.jsxs("span",{className:"flex items-center gap-1.5 text-[10px] font-semibold uppercase tracking-[0.14em] text-primary",children:[a.jsx(e,{className:"h-3 w-3","aria-hidden":!0})," ",t]}),a.jsx("span",{className:"mt-0.5 line-clamp-1 text-sm font-semibold leading-snug [overflow-wrap:anywhere] group-hover:text-primary",title:n,children:n}),a.jsx("span",{className:"line-clamp-2 min-h-10 text-xs leading-5 text-muted-foreground [overflow-wrap:anywhere]",children:r}),a.jsx("span",{className:"mt-1 flex h-5 min-w-0 items-center gap-x-2 overflow-hidden text-[11px] text-muted-foreground",children:i})]})]}),a.jsxs("div",{className:"flex shrink-0 items-center justify-end gap-2 border-t border-border px-3 py-2 sm:border-l sm:border-t-0 sm:px-4",children:[o,a.jsxs("button",{type:"button",onClick:l,className:"inline-flex h-8 items-center gap-1 rounded-full bg-primary px-3 text-xs font-medium text-primary-foreground transition hover:bg-primary/90 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[u("Open")," ",a.jsx(xa,{className:"h-3.5 w-3.5","aria-hidden":!0})]})]})]})}function b0e({Icon:t,label:e}){return a.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-muted px-2 py-0.5 font-medium",children:[a.jsx(t,{className:"h-3 w-3","aria-hidden":!0})," ",e]})}function MTt({className:t}){return a.jsx("div",{className:ee("mt-2 h-[10.625rem] w-full max-w-2xl animate-pulse rounded-xl border border-border bg-muted/40 sm:h-[7.875rem]",t),"aria-hidden":!0})}function LTt({url:t}){return a.jsx("a",{href:t,target:"_blank",rel:"noreferrer",onClick:e=>e.stopPropagation(),className:"mt-2 block break-all text-sm text-primary hover:underline",children:t})}function DTt({patch:t,save:e,texts:n}){const{toast:r}=yt(),s=y.useRef(new Map);return y.useCallback(i=>{const o={likedByMe:!!i.likedByMe,likeCount:i.likeCount??0},l=!o.likedByMe,c=(s.current.get(i.id)??0)+1;s.current.set(i.id,c);const d=()=>s.current.get(i.id)===c;t(i.id,{likedByMe:l,likeCount:Math.max(0,o.likeCount+(l?1:-1))}),e(i.id,l).then(u=>{d()&&t(i.id,u)}).catch(u=>{d()&&(t(i.id,o),r({title:l?n.likeFailed:n.unlikeFailed,description:dn(u,n.tryAgain),variant:"destructive"}))})},[t,e,n,r])}function $Tt(t,e){const n=rn();return y.useCallback((r,s)=>{const i=o=>o.id===r?{...o,...s}:o;n.setQueriesData({queryKey:["knowledge-courses",t]},o=>{if(!o||typeof o!="object")return o;if("pages"in o){const l=o;return{...l,pages:l.pages.map(c=>({...c,courses:(c.courses??[]).map(i)}))}}if("courses"in o){const l=o;return{...l,courses:(l.courses??[]).map(i)}}return o}),n.setQueryData(["knowledge-course-detail",t,r],o=>o&&i(o)),e==null||e(r,s)},[n,t,e])}function nPe(t,e){const n=Tn(),r=$Tt(t,e),s=y.useCallback((o,l)=>hmr(t,o,l),[t]),i=y.useMemo(()=>({likeFailed:n("Couldn't like this course"),unlikeFailed:n("Couldn't remove your like"),tryAgain:n("Please try again.")}),[n]);return DTt({patch:r,save:s,texts:i})}function rPe(t,e={}){const{community:n}=qe(),r=n==null?void 0:n.id;return lt({queryKey:["knowledge-course-detail",r,t],queryFn:async()=>{const s=await dmr(r,t);return Kmr(s)},enabled:!!(r&&t),...e.retry===!1?{retry:!1}:{}})}function sPe(t){const{isAdmin:e}=X8();return y.useMemo(()=>t?Ymr(t,e):null,[t,e])}const OTt=/^[0-9a-f]{24}$/i;function iPe(t){if(!t)return null;try{const e=new URL(t);if(e.pathname.replace(/\/+$/,"")!=="/knowledge-hub")return null;const n=e.searchParams.get("resource");return n&&OTt.test(n)?n:null}catch{return null}}function aPe(t){if(!t)return null;try{const e=new URL(t).pathname.replace(/\/+$/,"").match(/^\/course\/([^/]+)$/);return e&&OTt.test(e[1])?e[1]:null}catch{return null}}function oPe(t){const e=JB(t);if(!e)return null;const n=iPe(e);if(n)return{kind:"resource",id:n,url:e};const r=aPe(e);return r?{kind:"course",id:r,url:e}:null}function FTt(t,e){var i;const n=t??"",r=e===void 0?(i=oPe(n))==null?void 0:i.url:e;if(!r)return n;const s=r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return n.replace(new RegExp(`\\[[^\\]]*\\]\\(${s}\\)|<${s}>|${s}`),"").replace(/\n{3,}/g,`

`).trim()}function lPe(t){return!!(iPe(t)||aPe(t))}function BTt(t){var n,r;if(t.linkPreviewHidden)return null;const e=(n=t.linkPreview)==null?void 0:n.url;return e?lPe(e)?e:null:((r=oPe(t.body))==null?void 0:r.url)??null}function lyr({text:t,className:e}){const n=JB(t),r=aPe(n);return n&&r?a.jsx(cyr,{courseId:r,url:n,className:e}):null}function cyr({courseId:t,url:e,className:n}){const r=Tn(),s=Nn(),{community:i}=qe(),{communityDetail:o}=Ln(),l=jN(o),c=nPe((i==null?void 0:i.id)??""),{data:d,isError:u}=rPe(l?void 0:t,{retry:!1}),h=sPe(d??null);if(l||u)return a.jsx(LTt,{url:e});if(!h)return a.jsx(MTt,{className:n});const m=h.lessonCount??0;return a.jsx(ITt,{kicker:r("Course"),KickerIcon:kE,title:h.title,description:J6(h.description),imageUrl:h.banner,details:a.jsxs(a.Fragment,{children:[h.author?a.jsx("span",{className:"min-w-0 basis-full truncate",children:pn(r("By {name}"),{name:h.author.name})}):null,a.jsx(b0e,{Icon:Iu,label:pn(r(m===1?"{count} lesson":"{count} lessons"),{count:m})}),a.jsx(b0e,{Icon:ja,label:lk(h.durationMinutes)})]}),like:a.jsx(vse,{liked:!!h.likedByMe,count:h.likeCount??0,likeLabel:r("Like this course"),onToggle:()=>c(h),className:"shadow-none"}),onOpen:()=>s(ve.knowledgeCourse(h.id)),openLabel:pn(r("Open the course {title}"),{title:h.title}),className:n})}function cPe({resource:t,onToggle:e,className:n}){const r=Tn();return a.jsx(vse,{liked:!!t.likedByMe,count:t.likeCount??0,likeLabel:r("Like this resource"),onToggle:()=>e(t),className:n})}const Uo=encodeURIComponent,dyr=50,uyr=(t,e={},n=1)=>{var i,o;const r=new URLSearchParams;r.set("page",String(n)),r.set("limit",String(dyr)),e.q&&r.set("q",e.q),(i=e.type)!=null&&i.length&&r.set("type",e.type.join(",")),e.period&&r.set("period",e.period),e.from&&r.set("from",e.from),e.to&&r.set("to",e.to),e.sort&&r.set("sort",e.sort);for(const l of e.category??[])r.append("category",l);(o=e.author)!=null&&o.length&&r.set("author",e.author.join(",")),e.saved&&r.set("saved","1");const s=r.toString();return ae.get(`/community/${Uo(t)}/knowledge-hub/resources${s?`?${s}`:""}`)},mHe=40,dPe=t=>["knowledge-hub-categories",t],UTt=20,hyr=(t,e="",n=1)=>{const r=new URLSearchParams({page:String(n),limit:String(UTt)});return e&&r.set("q",e),ae.get(`/community/${Uo(t)}/knowledge-hub/categories?${r.toString()}`)},uPe=t=>["knowledge-hub-authors",t],myr=(t,e="",n=1)=>{const r=new URLSearchParams({page:String(n),limit:String(UTt)});return e&&r.set("q",e),ae.get(`/community/${Uo(t)}/knowledge-hub/authors?${r.toString()}`)},zTt=(t,e)=>ae.get(`/community/${Uo(t)}/knowledge-hub/resources/${Uo(e)}`),fyr=(t,e,n)=>nWt(`/community/${Uo(t)}/knowledge-hub/resources/${Uo(e)}/attachments/${n}/download`),pyr=(t,e,n)=>{const r=`/community/${Uo(t)}/knowledge-hub/resources/${Uo(e)}/like`;return n?ae.post(r,{}):ae.delete(r)},gyr=(t,e,n)=>ae.put(`/community/${Uo(t)}/knowledge-hub/resources/${Uo(e)}/progress`,n),vyr=(t,e,n)=>{const r=`/community/${Uo(t)}/knowledge-hub/resources/${Uo(e)}/save`;return n?ae.post(r,{}):ae.delete(r)},yyr=t=>`${window.location.origin}/knowledge-hub?resource=${Uo(t)}`,byr=(t,e)=>ae.post(`/community/${Uo(t)}/knowledge-hub/resources`,e),xyr=(t,e)=>ae.delete(`/community/${Uo(t)}/knowledge-hub/resources/${Uo(e)}`),wyr=(t,e,n)=>ae.patch(`/community/${Uo(t)}/knowledge-hub/resources/${Uo(e)}`,n);async function kyr(t,e,n,r){var o;const s=new FormData;s.append("images[]",e,e.name);const i=await j0(`/community/${Uo(t)}/media/upload?attachmentType=image`,s,n,r);if(!((o=i.publicUrls)!=null&&o[0]))throw new Error("Cover image upload failed");return i.publicUrls[0]}async function Syr(t,e,n,r){var o;const s=new FormData;s.append("audios[]",e,e.name);const i=await j0(`/community/${Uo(t)}/media/upload?attachmentType=audio`,s,n,r);if(!((o=i.publicUrls)!=null&&o[0]))throw new Error("Audio upload failed");return i.publicUrls[0]}function Cyr(t,e,n,r){return use(t,"video",e,async()=>{var o;const s=new FormData;s.append("videos[]",e,e.name);const i=await j0(`/community/${Uo(t)}/media/upload?attachmentType=video`,s,n,r);if(!((o=i.publicUrls)!=null&&o[0]))throw new Error("Video upload failed");return i.publicUrls[0]},n,r)}async function jyr(t,e,n,r){const s=await use(t,"document",e,async()=>{var l;const i=new FormData;i.append("documents[]",e,e.name);const o=await j0(`/community/${Uo(t)}/media/upload?attachmentType=document`,i,n,r);if(!((l=o.publicUrls)!=null&&l[0]))throw new Error(`Could not upload ${e.name}`);return o.publicUrls[0]},n,r);return{name:e.name,url:s,mimeType:e.type||"application/octet-stream",size:e.size}}function VTt(t,e,n,r){const s=i=>i.id===n?{...i,...r}:i;t.setQueriesData({queryKey:["knowledge-hub",e]},i=>{if(!i||typeof i!="object")return i;if("pages"in i){const o=i;return{...o,pages:o.pages.map(l=>({...l,resources:(l.resources??[]).map(s)}))}}return"resource"in i?{...i,resource:s(i.resource)}:i})}function HTt(t){const e=rn();return y.useCallback((n,r)=>VTt(e,t,n,r),[e,t])}function GTt(t){const e=Tn(),n=HTt(t),r=y.useCallback((i,o)=>pyr(t,i,o),[t]),s=y.useMemo(()=>({likeFailed:e("Couldn't like this resource"),unlikeFailed:e("Couldn't remove your like"),tryAgain:e("Please try again.")}),[e]);return DTt({patch:n,save:r,texts:s})}const Eyr=["Research Paper","Article","Lecture/Talk","Opinion Piece","Other"];function Nyr(t){return t.replace(/\s+/g," ").trim().replace(/[^\s/-]+/g,e=>e===e.toLocaleLowerCase()?e.replace(new RegExp("^(\\p{P}*)(\\p{L})","u"),(n,r,s)=>r+s.toLocaleUpperCase()):e)}function Qv(t,e){return Eyr.includes(t)?e(t):t}function Tyr({text:t,className:e}){const n=JB(t),r=iPe(n);return n&&r?a.jsx(_yr,{resourceId:r,url:n,className:e}):null}function _yr({resourceId:t,url:e,className:n}){var m,f;const r=Tn(),{community:s}=qe(),i=(s==null?void 0:s.id)??"",o=Nn(),l=GTt(i),{data:c,isError:d}=lt({queryKey:["knowledge-hub",i,"resource",t],queryFn:()=>zTt(i,t),enabled:!!i,staleTime:6e4,retry:!1}),u=c==null?void 0:c.resource;if(d)return a.jsx(LTt,{url:e});if(!u)return a.jsx(MTt,{className:n});const h=[u.category&&{Icon:ka,label:Qv(u.category,r)},u.videoUrl&&{Icon:fm,label:r("Video")},u.audioUrl&&{Icon:UP,label:r("Audio")},((m=u.attachments)==null?void 0:m.length)>0&&{Icon:Ff,label:pn(u.attachments.length===1?r("{count} file"):r("{count} files"),{count:u.attachments.length})}].filter(Boolean);return a.jsx(ITt,{kicker:r("Knowledge Hub"),KickerIcon:Iu,title:u.title,description:J6(u.description),imageUrl:u.imageUrl,details:a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"min-w-0 truncate",children:pn(r("By {name}"),{name:((f=u.author)==null?void 0:f.name)||r("Community member")})}),h.map(({Icon:p,label:g})=>a.jsx(b0e,{Icon:p,label:g},g))]}),like:a.jsx(cPe,{resource:u,onToggle:l,className:"shadow-none"}),onOpen:()=>o(`${ve.knowledgeHub}?resource=${encodeURIComponent(u.id)}`),openLabel:pn(r("Open {title} in the Knowledge Hub"),{title:u.title}),className:n})}function hPe({text:t,className:e}){const n=oPe(t);return n?n.kind==="course"?a.jsx(lyr,{text:t,className:e}):a.jsx(Tyr,{text:t,className:e}):null}const Ayr=600;function Pyr(t){return jTt(t).filter(e=>lPe(e)||CTt(e))}function mPe({text:t,initial:e,onChange:n,className:r}){const[s,i]=y.useState(t);y.useEffect(()=>{const w=window.setTimeout(()=>i(t),Ayr);return()=>window.clearTimeout(w)},[t]);const o=y.useMemo(()=>Pyr(s),[s]),[l,c]=y.useState((e==null?void 0:e.hidden)??!1),[d,u]=y.useState((e==null?void 0:e.url)??null),h=d&&o.includes(d)?o.indexOf(d):0,m=!l&&o.length>0?o[h]:null,f=lPe(m),p=TTt(f?null:m),g=m&&(f||p!==null)?m:null,v=l&&o.length>0;if(y.useEffect(()=>{n({url:g,hidden:v})},[n,g,v]),o.length===0)return null;if(l)return a.jsxs("button",{type:"button",onClick:()=>c(!1),className:ee(r,"inline-flex items-center gap-1.5 rounded-full border border-dashed border-border px-3 py-1 text-xs text-muted-foreground transition-colors hover:border-primary/50 hover:text-foreground"),children:[a.jsx(eu,{className:"h-3.5 w-3.5","aria-hidden":"true"}),"Show link preview"]});const b=w=>u(o[(h+w+o.length)%o.length]),x=o.length>1&&a.jsxs("div",{className:"mt-1.5 flex items-center justify-end gap-1 text-xs text-muted-foreground",children:[a.jsxs("span",{className:"mr-1",children:["Previewing link ",h+1," of ",o.length]}),a.jsx("button",{type:"button",onClick:()=>b(-1),"aria-label":"Preview the previous link",className:"flex h-6 w-6 items-center justify-center rounded-full hover:bg-muted hover:text-foreground",children:a.jsx(nl,{className:"h-3.5 w-3.5","aria-hidden":"true"})}),a.jsx("button",{type:"button",onClick:()=>b(1),"aria-label":"Preview the next link",className:"flex h-6 w-6 items-center justify-center rounded-full hover:bg-muted hover:text-foreground",children:a.jsx(io,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]});return f&&m?a.jsxs("div",{className:ee("relative w-full",r),children:[a.jsx("div",{ref:w=>w==null?void 0:w.setAttribute("inert",""),className:"pointer-events-none select-none",children:a.jsx(hPe,{text:m})}),a.jsx(ATt,{onRemove:()=>c(!0),className:"-right-2 -top-2"}),x]}):p===void 0?a.jsx(PTt,{layout:"compact",className:r}):p?a.jsx(y0e,{preview:p,layout:"compact",onRemove:()=>c(!0),footer:x,className:r}):null}const Ryr=150;function Iyr(t,e){const n=e.trim().replace(/^@+/,"").trim().toLowerCase();if(!n)return!0;const r=n.split(/\s+/).filter(Boolean),s=(t.userId??"").toLowerCase(),i=(t.name??"").toLowerCase();return s.includes(r.join(""))||r.every(o=>i.includes(o))}function fPe(t,e){const[n,r]=y.useState(e);y.useEffect(()=>{if(e===null||e===""){r(e);return}const h=setTimeout(()=>r(e),Ryr);return()=>clearTimeout(h)},[e]);const s=e===null?null:n??"",i=lt({queryKey:["mention-candidates",t,s??""],queryFn:()=>XAe(t,s??""),placeholderData:(h,m)=>(m==null?void 0:m.queryKey[1])===t?h:void 0,staleTime:6e4,enabled:e!==null&&s!==null&&!!t}),o=i.data,l=y.useMemo(()=>e===null?[]:MSe((o==null?void 0:o.users)??[]).filter(h=>!!h.userId&&Iyr(h,e)),[o,e]),c=s===e&&!i.isPlaceholderData&&!i.isFetching,d=y.useRef([]),u=e!==null&&l.length===0&&!c?d.current:l;return y.useEffect(()=>{d.current=e===null?[]:u},[e,u]),{users:u,data:o}}function Myr(t){const e=typeof window<"u"?window.getSelection():null;if(e&&e.rangeCount>0&&(t!=null&&t.contains(e.anchorNode))){const r=e.getRangeAt(0).cloneRange();r.collapse(!0);const s=r.getClientRects()[0]??r.getBoundingClientRect();if(s&&(s.width||s.height||s.top||s.left))return{top:s.top,left:s.left,bottom:s.bottom,right:s.left,width:0,height:s.height,x:s.left,y:s.top};const i=e.anchorNode,o=i instanceof HTMLElement?i:i==null?void 0:i.parentElement;if(o){const l=o.getBoundingClientRect();return{top:l.top,left:l.left,bottom:l.top+20,right:l.left,width:0,height:20,x:l.left,y:l.top}}}if(!t)return null;const n=t.getBoundingClientRect();return{top:n.top,left:n.left,bottom:n.top+20,right:n.left,width:0,height:20,x:n.left,y:n.top}}function Lyr({open:t,caretRef:e,results:n,activeIndex:r,onHover:s,onPick:i,onDismiss:o}){const l=y.useRef({getBoundingClientRect:()=>e.current??{top:0,left:0,bottom:0,right:0,width:0,height:0,x:0,y:0}});return a.jsxs(Tje,{open:t,onOpenChange:c=>!c&&o(),children:[a.jsx(Ydt,{virtualRef:l}),a.jsx(_je,{children:a.jsx(ste,{side:"top",align:"start",sideOffset:6,collisionPadding:8,avoidCollisions:!0,onOpenAutoFocus:c=>c.preventDefault(),onCloseAutoFocus:c=>c.preventDefault(),role:"listbox","aria-label":"Mention suggestions",className:"z-[100] w-64 overflow-hidden rounded-md border border-border bg-popover shadow-md",children:n.map((c,d)=>a.jsxs("button",{type:"button",role:"option","aria-selected":d===r,onMouseDown:u=>u.preventDefault(),onMouseEnter:()=>s(d),onClick:()=>c.userId&&i(c.userId),className:ee("flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted",d===r&&"bg-muted"),children:[a.jsx(Jd,{src:c.picture??void 0,name:c.name,className:"h-6 w-6 text-[9px]"}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-sm font-medium text-foreground",children:c.name}),a.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:["@",c.userId]})]})]},c.id))})})]})}function yse(t){const{community:e}=qe(),n=(e==null?void 0:e.id)??null,[r,s]=y.useState(null),[i,o]=y.useState(0),l=y.useRef(null),c=y.useRef(null),d=fPe(n,r),u=d.users.slice(0,6),h=r!==null&&u.length>0;y.useEffect(()=>{o(0)},[r,d.data]);const m=g=>{const v=g.match(/(?:^|\s)@([\w.]*)$/);v&&(c.current=Myr(l.current)),s(v?v[1]:null)},f=g=>{var v;g&&((v=t.current)==null||v.replaceActiveMention(g),s(null))},p=g=>{if(h){if(g.key==="ArrowDown"){g.preventDefault(),o(v=>(v+1)%u.length);return}if(g.key==="ArrowUp"){g.preventDefault(),o(v=>(v-1+u.length)%u.length);return}if(g.key==="Enter"||g.key==="Tab"){g.preventDefault();const v=u[Math.min(i,u.length-1)];v!=null&&v.userId&&f(v.userId);return}g.key==="Escape"&&(g.preventDefault(),g.stopPropagation(),s(null))}};return{wrapRef:l,menu:a.jsx(Lyr,{open:h,caretRef:c,results:u,activeIndex:i,onHover:o,onPick:f,onDismiss:()=>s(null)}),editorProps:{onCaretContext:m,onKeyDown:p,onBlur:()=>setTimeout(()=>s(null),150)}}}function pPe(t,e,n,r){const s=(t==null?void 0:t.selectionStart)??e.length,i=(t==null?void 0:t.selectionEnd)??s,o=e.slice(0,s)+n+e.slice(i);return r!=null&&o.length>r?null:(requestAnimationFrame(()=>{t==null||t.focus(),t==null||t.setSelectionRange(s+n.length,s+n.length)}),o)}function WTt({open:t,title:e,setTitle:n,titleMaxLength:r,insertIntoBody:s}){const i=y.useRef(null),o=y.useRef("body");return y.useEffect(()=>{t&&(o.current="body")},[t]),{insert:c=>{const d=i.current;if(o.current!=="title"||!d){s(c);return}const u=pPe(d,e,c,r);u!==null&&n(u)},titleProps:{ref:i,onFocus:()=>{o.current="title"}},bodyProps:{onFocus:()=>{o.current="body"}}}}const Dyr=/^https:\/\/amityonline\.blob\.core\.windows\.net\/communitystorage\/images\/sample-[^/]+$/i;function d0(t){if(!t)return null;const e=t.trim();if(!e)return null;if(Dyr.test(e)){const r=(e.split("/").pop()??"placeholder").replace(/\.[^.]+$/,"");return`https://picsum.photos/seed/${encodeURIComponent(r)}/800/600`}return e}function mq(t){return(t??[]).map(e=>typeof e=="string"?d0(e):null).filter(e=>!!e)}const $yr=/^data:(image\/(png|jpe?g|gif|webp|avif|bmp)|video\/[\w.+-]+|audio\/[\w.+-]+|application\/pdf)[;,]/i;function qTt(t){try{return new URL(t,window.location.origin)}catch{return null}}function NN(t){const e=String(t??"").trim();if(!e)return null;if(/^data:/i.test(e))return $yr.test(e)?e:null;const n=qTt(e);return n&&(n.protocol==="http:"||n.protocol==="https:"||n.protocol==="blob:")?e:null}function qk(t){const e=NN(t);if(!e||/^(data|blob):/i.test(e))return e;const n=qTt(e);return n&&n.origin!==window.location.origin?e:null}const Oyr=new Set(["mp4","webm","ogv","mov","m4v"]),Fyr=new Set(["mp3","wav","m4a","aac","amr","ogg","oga","opus","flac","weba"]),Byr=new Set(["png","jpg","jpeg","gif","webp","bmp","svg","avif"]);function KZ(t){if(!t)return"";const e=t.split("?")[0].split("#")[0],r=(e.split("/").pop()??e).match(/\.([a-z0-9]+)$/i);return(r==null?void 0:r[1].toLowerCase())??""}function fHe(t){if(!t)return"";const e=t.split("?")[0].split("#")[0];return(e.split("/").pop()??e).toLowerCase()}function KTt(t,e){if(e!=null&&e.startsWith("data:audio/")||fHe(t).startsWith("voice-note-")||fHe(e).startsWith("voice-note-"))return!0;const n=KZ(t)||KZ(e);return Fyr.has(n)}function Uyr(t,e){if(e!=null&&e.startsWith("data:video/"))return"video";if(KTt(t,e))return"audio";if(e!=null&&e.startsWith("data:image/"))return"image";if(e!=null&&e.startsWith("data:application/pdf"))return"pdf";const n=KZ(t)||KZ(e);return Oyr.has(n)?"video":n==="pdf"?"pdf":Byr.has(n)?"image":"file"}function zyr({url:t,name:e,onRemove:n}){return a.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted/40 px-3 py-2.5",children:[a.jsx(Ei,{className:"h-5 w-5 shrink-0 text-primary"}),t?a.jsx("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"min-w-0 flex-1 truncate text-sm font-medium text-foreground hover:underline",children:e}):a.jsx("span",{className:"min-w-0 flex-1 truncate text-sm font-medium text-muted-foreground",children:e}),n&&a.jsx("button",{type:"button",onClick:n,className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-foreground/70 transition-colors hover:bg-foreground/90","aria-label":"Remove file",children:a.jsx(nn,{className:"h-3 w-3 text-background"})})]})}function x0e({url:t,name:e,kind:n,onRemove:r}){const[s,i]=y.useState(!1),o=(e==null?void 0:e.trim())||"Attached file",l=NN(t),c=qk(t),d=n??Uyr(e,l);return s||d==="file"||!l||d==="pdf"&&!c?a.jsx(zyr,{url:l,name:o,onRemove:r}):a.jsxs("div",{className:"relative space-y-2",children:[d==="video"&&a.jsx("video",{src:l,controls:!0,preload:"metadata",onError:()=>i(!0),className:"max-h-[70vh] w-full rounded-lg bg-black object-contain"}),d==="audio"&&a.jsx("audio",{src:l,controls:!0,preload:"metadata",onError:()=>i(!0),className:"w-full"}),d==="pdf"&&a.jsx("iframe",{title:o,src:c??void 0,className:"h-[min(70vh,480px)] w-full rounded-lg border border-border bg-muted"}),d==="image"&&a.jsx("img",{src:l,alt:o,onError:()=>i(!0),className:"max-h-[70vh] w-full rounded-lg object-contain"}),a.jsx("p",{className:"truncate px-1 text-xs text-muted-foreground",children:o}),r&&a.jsx("button",{type:"button",onClick:r,className:"absolute right-2 top-2 flex h-6 w-6 items-center justify-center rounded-full bg-foreground/70 transition-colors hover:bg-foreground/90","aria-label":"Remove file",children:a.jsx(nn,{className:"h-3 w-3 text-background"})})]})}function Vyr({src:t,poster:e,maxHeight:n}){const[r,s]=y.useState(null),[i,o]=y.useState(!1);y.useEffect(()=>{if(o(!1),!e)return;const u=new Image;return u.onload=()=>o(!0),u.src=e,()=>{u.onload=null}},[e]);const l=GB(t),c=l.src??t,d=c.includes("#")?c:`${c}#t=0.1`;return a.jsx("video",{src:d,poster:i?e:void 0,controls:!0,preload:"metadata",playsInline:!0,onError:l.onError,onLoadedMetadata:u=>{const{videoWidth:h,videoHeight:m}=u.currentTarget;h>0&&m>0&&s(h/m)},style:{aspectRatio:r??16/9},className:ee("w-full rounded-lg bg-black object-contain",n)})}function OV({className:t}){return a.jsxs("div",{role:"img","aria-label":"Image unavailable",className:ee("flex flex-col items-center justify-center gap-1.5 rounded-lg border border-border bg-muted/50 text-muted-foreground",t),children:[a.jsx(FBt,{className:"h-6 w-6"}),a.jsx("span",{className:"text-xs",children:"Image unavailable"})]})}function YTt(t){if(!t||typeof DOMParser>"u")return null;const e=new DOMParser().parseFromString(t,"text/html"),n=e.querySelectorAll("iframe");return n.length!==1||e.querySelector("script, object, embed, form")||(e.body.textContent??"").trim()?null:n[0].getAttribute("src")??""}function Hyr(t){const e=YTt(t);if(e===null)return null;let n;try{n=new URL(e.replace("youtube-nocookie.com","youtube.com"))}catch{return null}const r=Kje(n.toString());if(!r)return null;const s=n.searchParams.get("start");return s&&/^\d+$/.test(s)?`${r}?start=${s}`:r}function Gyr(t){var i;const e=YTt(t);if(e===null)return null;let n;try{n=new URL(e)}catch{return null}if(n.protocol!=="https:"||!/^(www\.)?linkedin\.com$/i.test(n.hostname))return null;const r=(i=n.pathname.match(/^\/embed\/feed\/update\/(urn:li:(?:share|ugcPost|activity):\d{5,25})\/?$/))==null?void 0:i[1];if(!r)return null;const s=n.searchParams.get("collapsed")==="1"?"?collapsed=1":"";return`https://www.linkedin.com/embed/feed/update/${r}${s}`}function QTt({images:t=[],videos:e=[],videoThumbnails:n=[],document:r,documentName:s,embedCode:i,embedCodeHeight:o,compact:l=!1,embedded:c=!1}){const[d,u]=y.useState({}),[h,m]=y.useState(null),f=N=>d0(N)??N,p=N=>{u(A=>A[N]?A:{...A,[N]:!0})},g=N=>m(N),v=()=>m(null),b=N=>m(A=>A===null?null:(A+N+t.length)%t.length);y.useEffect(()=>{if(h===null)return;const N=A=>{A.key==="Escape"?v():A.key==="ArrowRight"?b(1):A.key==="ArrowLeft"&&b(-1)};return window.addEventListener("keydown",N),()=>window.removeEventListener("keydown",N)},[h,t.length]);const x=y.useMemo(()=>i?Hyr(i):null,[i]),w=y.useMemo(()=>i&&!x?Gyr(i):null,[i,x]),k=Number(o)>0?`${Number(o)}px`:400;if(!(t.length>0||e.length>0||!!r||!!i))return null;const C=l?"max-h-48":"max-h-[70vh]",j=t.slice(0,4),E=t.length-j.length;return a.jsxs("div",{className:ee(c?"space-y-2":"px-4 pb-3 space-y-2"),children:[t.length===1?d[t[0]]?a.jsx(OV,{className:l?"h-48":"h-52"}):a.jsx("img",{src:f(t[0]),alt:"",onError:()=>p(t[0]),onClick:()=>g(0),className:ee("w-full rounded-lg object-contain object-center cursor-zoom-in",l?"max-h-48":"max-h-[70vh]")}):t.length===2?a.jsx("div",{className:"my-2 flex justify-between gap-2",children:t.map((N,A)=>d[N]?a.jsx(OV,{className:"h-52 w-1/2"},N):a.jsx("img",{src:f(N),alt:"",onError:()=>p(N),onClick:()=>g(A),className:"h-52 w-1/2 rounded-lg object-cover object-center cursor-zoom-in"},N))}):t.length>1?a.jsx("div",{className:"grid grid-cols-2 gap-2",children:j.map((N,A)=>a.jsxs("div",{className:"relative overflow-hidden rounded-lg cursor-zoom-in",onClick:()=>g(A),children:[d[N]?a.jsx(OV,{className:"h-52 w-full"}):a.jsx("img",{src:f(N),alt:"",onError:()=>p(N),className:"h-52 w-full object-cover object-center"}),A===3&&E>0&&a.jsxs("div",{className:"absolute inset-0 rounded-lg bg-black/55 flex items-center justify-center text-white text-lg font-semibold",children:["+",E]})]},N+A))}):null,e.map((N,A)=>KTt(null,N)?a.jsx("audio",{src:N,controls:!0,preload:"metadata",className:"w-full"},N+A):a.jsx(Vyr,{src:N,poster:n[A]||void 0,maxHeight:C},N+A)),r&&a.jsx(x0e,{url:r,name:s}),i&&x&&a.jsx("div",{className:"aspect-video w-full overflow-hidden rounded-lg border border-border bg-black",children:a.jsx("iframe",{title:"Embedded video",src:x,className:"h-full w-full",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",referrerPolicy:"strict-origin-when-cross-origin",sandbox:"allow-scripts allow-same-origin allow-presentation allow-popups allow-popups-to-escape-sandbox",allowFullScreen:!0})}),i&&w&&a.jsx("iframe",{title:"Embedded LinkedIn post",src:w,className:"w-full rounded-lg border border-border bg-background",style:{height:k},referrerPolicy:"strict-origin-when-cross-origin",sandbox:"allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox",allowFullScreen:!0}),i&&!x&&!w&&a.jsx("iframe",{title:"Embedded content",srcDoc:i,sandbox:"allow-scripts allow-popups allow-presentation allow-forms",className:"w-full rounded-lg border border-border",style:{height:k}}),h!==null&&t[h]&&Vg.createPortal(a.jsxs("div",{className:"fixed inset-0 z-[100] flex items-center justify-center bg-black/90 p-4",onClick:v,role:"dialog","aria-modal":"true",children:[a.jsx("button",{type:"button",onClick:v,"aria-label":"Close",className:"absolute top-4 right-4 h-10 w-10 rounded-full bg-white/10 text-white flex items-center justify-center hover:bg-white/20 transition-colors",children:a.jsx(nn,{className:"h-5 w-5"})}),t.length>1&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),b(-1)},"aria-label":"Previous image",className:"absolute left-4 h-10 w-10 rounded-full bg-white/10 text-white flex items-center justify-center hover:bg-white/20 transition-colors",children:a.jsx(nl,{className:"h-6 w-6"})}),a.jsx("button",{type:"button",onClick:N=>{N.stopPropagation(),b(1)},"aria-label":"Next image",className:"absolute right-4 h-10 w-10 rounded-full bg-white/10 text-white flex items-center justify-center hover:bg-white/20 transition-colors",children:a.jsx(io,{className:"h-6 w-6"})}),a.jsxs("span",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 text-xs font-medium text-white/80",children:[h+1," / ",t.length]})]}),d[t[h]]?a.jsx("div",{onClick:N=>N.stopPropagation(),children:a.jsx(OV,{className:"h-64 w-[min(90vw,480px)] border-white/20 bg-white/10 text-white/80"})}):a.jsx("img",{src:f(t[h]),alt:"",onError:()=>p(t[h]),onClick:N=>N.stopPropagation(),className:"max-h-[90vh] max-w-[90vw] rounded-lg object-contain"})]}),window.document.body)]})}function YZ({buttons:t,position:e}){const n=(t??[]).filter(r=>(r.position??"top")===e);return n.length?a.jsx("div",{className:"my-2 flex flex-wrap gap-2",children:n.map((r,s)=>{const i=NN(r.url);return i!=null&&/^https?:/i.test(i)?a.jsx("a",{href:i,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:r.label},`${r.url}-${s}`):a.jsx("span",{"aria-disabled":"true",title:"Invalid link",className:"inline-flex cursor-not-allowed items-center rounded-md bg-primary/40 px-3 py-1.5 text-xs font-medium text-primary-foreground",children:r.label},`${r.url}-${s}`)})}):null}function ZTt(){return a.jsx("span",{className:"shrink-0 rounded-md bg-primary/10 px-1.5 py-0.5 text-[11px] font-medium leading-none text-primary",title:"Community admin",children:"Admin"})}function JTt({headline:t,title:e,location:n,compact:r=!1}){const s=r?"text-[11px] leading-4":"text-xs leading-[18px]";return a.jsxs(a.Fragment,{children:[t&&a.jsx("p",{className:ee("truncate text-foreground/75",s),title:t,children:t}),(e||n)&&a.jsxs("p",{className:ee("flex min-w-0 items-center gap-1.5 text-muted-foreground",s),children:[e&&a.jsx("span",{className:"min-w-0 truncate",title:e,children:e}),n&&a.jsxs("span",{className:"flex min-w-0 max-w-[50%] shrink-0 items-center gap-1",title:n,children:[a.jsx(Jf,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),a.jsx("span",{className:"truncate",children:n})]})]})]})}function qd({userId:t,children:e,className:n,title:r}){return t?a.jsx(vr,{to:ve.member(t),title:r,onClick:s=>s.stopPropagation(),className:ee("cursor-pointer",n),children:e}):a.jsx(a.Fragment,{children:e})}function XB(t="Sign in to join the conversation"){const e=Nn();return y.useCallback(()=>kje()?!0:(He(t),e(Sje()),!1),[e,t])}const Wyr=2*365*24*60*60*1e3;function gPe(t,e=Date.now()){const n=t?Date.parse(t):NaN;return Number.isFinite(n)&&n-e>Wyr}const XTt=[{label:"1 Day",hours:24},{label:"3 Days",hours:72},{label:"1 Week",hours:168},{label:"2 Weeks",hours:336}],qyr=12,Kyr=[{label:"5 Mins",minutes:5},{label:"10 Mins",minutes:10},{label:"20 Mins",minutes:20},{label:"30 Mins",minutes:30},{label:"40 Mins",minutes:40},{label:"60 Mins",minutes:60}],w0e="Custom date",vPe=14,Yyr=t=>new Date(t.getFullYear(),t.getMonth(),t.getDate());function e_t(t=new Date){const e=Yyr(t),n=new Date(e);return n.setDate(n.getDate()+vPe),{first:e,last:n}}function Qyr(t,e=new Date){const n=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t??"");if(!n)return null;const r=new Date(Number(n[1]),Number(n[2])-1,Number(n[3])),{first:s,last:i}=e_t(e);if(Number.isNaN(r.getTime())||r<s||r>i)return null;const o=new Date(r.getFullYear(),r.getMonth(),r.getDate(),23,59,59,999);return{endTime:o.toISOString(),hours:Math.max(1,Math.ceil((o.getTime()-e.getTime())/36e5))}}const Zyr=Object.fromEntries(XTt.map(t=>[t.label,t.hours]));function Jyr(t){return Zyr[t]??24}function pHe(t){return new Date(Date.now()+t*60*60*1e3).toISOString()}function Xyr(){const t=new Date;return t.setMonth(t.getMonth()+1),t.toISOString()}function bse({post:t,readOnly:e=!1}){var N,A;const{toast:n}=yt(),r=XB(),{hideCreator:s=!1,hideDate:i=!1}=t.preferences??{},o=!s&&!i,[l,c]=y.useState(!1),[d,u]=y.useState(!1),[h,m]=y.useState(!1),f=y.useRef(null);y.useEffect(()=>{if(l)return;const _=f.current;if(!_)return;const T=!!_.querySelector(".post-embed");m(T);const R=()=>u(!T&&_.scrollHeight>_.clientHeight+1);if(R(),typeof ResizeObserver>"u")return window.addEventListener("resize",R),()=>window.removeEventListener("resize",R);const O=new ResizeObserver(R);return O.observe(_),()=>O.disconnect()},[t.body,l]);const p=(N=t.images)!=null&&N.length?t.images:t.image?[t.image]:[],g=BTt(t),v=t.embedCode?t.body:FTt(t.body,g),b=xCt(t.realId,t.poll),x=y.useMemo(()=>b?yCt(b):[],[b]),w=b?b.votedOption!==null:!1,k=b?jj(b):!1,S=w||!!b&&!k,C=y.useMemo(()=>b?$_e(b,S):[],[b,S]),j=k&&!e&&!!t.realId,E=_=>{var F;const T=(F=b==null?void 0:b.options[_])==null?void 0:F.text;if(!j||!t.realId||T==null||(b==null?void 0:b.votedOption)===_||!r())return;const R=t.realId,O=qre(R,_);KAe(R,T).catch(D=>{O(),n({title:w?"Couldn't change your vote":"Couldn't record your vote",description:D instanceof ze?Dt(D.body,"Please try again."):"Please try again.",variant:"destructive"})})};return a.jsxs("div",{className:"mb-3 overflow-hidden rounded-lg border border-border bg-muted/30",children:[t.banner&&a.jsx("img",{src:d0(t.banner)??t.banner,alt:"",className:"w-full object-contain object-center"}),a.jsxs("div",{className:"flex items-start gap-2 px-3 pt-3 pb-1",children:[!s&&a.jsx(qd,{userId:e?null:t.authorId,title:t.author,className:"shrink-0",children:a.jsx(Jd,{src:t.avatar,name:t.author,className:"h-7 w-7 text-[10px]"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[!s&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[a.jsx(qd,{userId:e?null:t.authorId,className:"block min-w-0 hover:underline",children:a.jsx("p",{className:"text-xs font-semibold text-foreground uppercase truncate",children:t.author})}),t.authorIsAdmin&&a.jsx(ZTt,{})]}),a.jsx(JTt,{headline:t.authorBio,title:t.authorTitle,location:t.authorLocation,compact:!0})]}),a.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Posted in ",t.channel,o?` • ${t.time}`:""]})]})]}),t.title&&a.jsx("h4",{className:"px-3 pt-1 text-sm font-semibold text-foreground",children:t.title}),t.quiz&&a.jsxs("p",{className:"px-3 pt-1 text-xs text-muted-foreground",children:["Quiz",t.quiz.title?`: ${t.quiz.title}`:""," · ",t.quiz.questions.length," question",t.quiz.questions.length===1?"":"s"," — open the original post to take it"]}),a.jsx("div",{className:"px-3 empty:hidden",children:a.jsx(YZ,{buttons:t.buttons,position:"top"})}),v&&a.jsxs("div",{className:"px-3 py-1",children:[a.jsx("div",{ref:f,className:ee("text-sm leading-relaxed text-muted-foreground",!l&&!h&&"line-clamp-4"),children:a.jsx(ZB,{text:v,embedVideos:!0})}),d&&a.jsx("button",{type:"button",onClick:_=>{_.stopPropagation(),c(T=>!T)},className:"read-more pointer-events-auto mt-1 cursor-pointer text-xs font-bold uppercase text-primary hover:underline",children:l?"show less":"read more…"})]}),a.jsx(QTt,{compact:!0,images:p,videos:t.videos,videoThumbnails:t.videoThumbnails,document:t.document,documentName:t.documentName,embedCode:t.embedCode,embedCodeHeight:t.embedCodeHeight}),!t.embedCode&&a.jsx("div",{className:"px-3 pb-2 empty:hidden",children:g?a.jsx(hPe,{text:g,className:"mt-1"}):a.jsx(RTt,{body:t.body,linkPreview:t.linkPreview,linkPreviewHidden:t.linkPreviewHidden,layout:"compact",className:"mt-1"})}),a.jsx("div",{className:"px-3 empty:hidden",children:a.jsx(YZ,{buttons:t.buttons,position:"bottom"})}),b&&a.jsxs("div",{className:"mx-3 mb-3 space-y-2 rounded-lg border border-primary/20 bg-primary/5 p-3",children:[a.jsxs("p",{className:"text-xs font-medium text-muted-foreground",children:["Poll • ",b.duration,S?` • ${b.totalVotes} vote${b.totalVotes!==1?"s":""}`:""]}),b.question&&b.question!==((A=t.title)==null?void 0:A.trim())&&a.jsx("p",{className:"text-sm font-semibold text-foreground",children:b.question}),a.jsx("ul",{className:"space-y-1.5",children:C.map(_=>{const T=b.options[_],R=ee("flex w-full items-center justify-between gap-2 rounded-md border border-border bg-background px-3 py-1.5 text-left text-sm text-foreground",b.votedOption===_&&"border-primary text-primary"),O=a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"min-w-0 break-words",children:T.text}),S&&b.totalVotes>0&&a.jsxs("span",{className:"shrink-0 text-xs font-semibold tabular-nums",children:[x[_],"%"]})]});return a.jsx(it.li,{layout:"position",transition:{duration:.35,ease:"easeOut"},children:j?a.jsx("button",{type:"button","aria-pressed":w?b.votedOption===_:void 0,onClick:F=>{F.stopPropagation(),E(_)},className:ee(R,b.votedOption!==_&&"cursor-pointer transition-colors hover:border-primary/50 hover:bg-primary/5"),children:O}):a.jsx("div",{className:R,children:O})},_)})}),!k&&!e&&a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"This poll has ended."}),j&&a.jsx("p",{className:"text-[11px] text-muted-foreground",children:w?gPe(b.endsAt)?"You can change your vote at any time.":"You can change your vote until the poll ends.":"Select an option to vote. Your vote counts on the original post."})]}),t.shared&&a.jsx("div",{className:"px-3",children:a.jsx(bse,{post:t.shared,readOnly:e})})]})}function ebr(){try{return Intl.DateTimeFormat().resolvedOptions().timeZone||"UTC"}catch{return"UTC"}}function tbr(t,e){var n;try{const s=(n=new Intl.DateTimeFormat(void 0,{timeZoneName:"short"}).formatToParts(t).find(i=>i.type==="timeZoneName"))==null?void 0:n.value;return s?`${e} (${s})`:e}catch{return e}}function nbr(t){const e=t.toLocaleDateString(void 0,{day:"numeric"}),n=t.toLocaleDateString(void 0,{month:"long"}),r=t.toLocaleDateString(void 0,{year:"numeric"});return`${e} ${n}, ${r}`}function rbr(t,e){const n=Math.max(0,Math.round((e-t)/6e4)),r=Math.floor(n/60),s=n%60;return r&&s?`${r}h ${s}m`:r?`${r}h`:`${s}m`}function sbr(t){return(t||"").trim().split(/\s+/).map(e=>e[0]).filter(Boolean).slice(0,2).join("").toUpperCase()}function gHe(t){var n;const e=(n=t==null?void 0:t.picture)==null?void 0:n.trim();return e&&RE(e)?e:""}function gg(t){var w,k,S,C,j,E,N;const e=t.liveCall??t.liveMeeting,n=new Date(t.startTime),r=new Date(t.endTime),s=n.getTime(),i=r.getTime(),o=ebr(),l=!!(t.isOnline??(t.liveCall||t.liveMeeting||t.webURL)),c=t.host||t.createdBy,d=((w=t.banner)==null?void 0:w.trim())||"",u=t.myRSVPStatus??"",h=t.myCommunityRole??"member",m=h==="admin",f=(k=ro())==null?void 0:k.id,p=!!f&&f===((S=t.createdBy)==null?void 0:S.id),g=s>Date.now(),v=((C=t.location)==null?void 0:C.trim())||(l?"Online":""),b=l?"webinar":"social",x=(t.participants??[]).map(A=>{var _,T;return{id:((_=A.user)==null?void 0:_.id)??"",name:((T=A.user)==null?void 0:T.name)??"Member",avatar:gHe(A.user),status:A.status??"going"}});return{id:t.id,realId:t.id,slug:(j=t.meta)==null?void 0:j.slug,title:t.title||"Untitled event",description:t.description||"",date:nbr(n),time:n.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}),timezone:tbr(n,o),month:n.toLocaleDateString(void 0,{month:"long"}),year:String(n.getFullYear()),duration:rbr(s,i),startTime:t.startTime,endTime:t.endTime,thumbnail:d,hasBanner:!!d,location:v,isOnline:l,isPrivate:!!t.isPrivate,hasInAppMeeting:!!(t.liveCall||t.liveMeeting),audienceRestricted:!!t.audienceRestricted,passwordRequired:!!t.passwordRequired,entryVerified:!!t.entryVerified,invitedSections:t.invitedSections??[],webURL:t.webURL||"",organiser:(c==null?void 0:c.name)||"Unknown",organizerAvatar:gHe(c)||sbr(c==null?void 0:c.name),organiserRole:(c==null?void 0:c.role)||"",attendees:t.participantCount??0,attendeesList:x,maximumRegistrations:t.maximumRegistrations??0,myRSVPStatus:u,myCommunityRole:h,canEdit:(t.audienceRestricted?!!t.canManage:m||p)&&g,canDelete:m||p,hostId:(c==null?void 0:c.id)??((E=t.createdBy)==null?void 0:E.id)??"",liveCallMeetingId:(N=t.liveCall)==null?void 0:N.meetingId,meetingUnavailable:t.meetingUnavailable===!0||(e==null?void 0:e.isEnded)===!0||(e==null?void 0:e.isLive)===!1,isRecurringParent:!!t.isRecurringParent,type:b}}function ibr(t){const e=(t||"").trim().split(/\s+/);return Rje(e[0]||"",e[1]||"")||"?"}function yPe(t){var n;const e=(n=t==null?void 0:t.picture)==null?void 0:n.trim();return e&&RE(e)?e:ibr(t==null?void 0:t.name)}function vHe(t){if(t&&typeof t!="string")return t.name}function yHe(t){if(t)return typeof t=="string"?t:t.id}function abr(t){const e=(t.topics??[]).map(r=>r.name).filter(Boolean),n=(t.tags??[]).filter(Boolean);return Array.from(new Set([...e,...n]))}function bPe(t){const e=((t==null?void 0:t.details)??[]).filter(n=>n==null?void 0:n.emoji);if(e.length!==0)return{total:(t==null?void 0:t.total)??e.reduce((n,r)=>n+(r.count??0),0),details:e.map(n=>({emoji:n.emoji,count:n.count??0,isByMe:!!n.isByMe}))}}function obr(t,e){var n,r;return{id:e,realId:t.id,author:((n=t.createdBy)==null?void 0:n.name)||"Member",authorId:(r=t.createdBy)==null?void 0:r.id,avatar:yPe(t.createdBy),text:t.description||"",images:(t.images??[]).map(d0),time:yc(t.createdAt),isByMe:!!t.isByMe,reactions:bPe(t.reactions)}}function t_t(t){return t.reduce((e,n)=>Math.max(e,n.id),0)+1}function oP(t,e){var n,r;return{id:e,realId:t.id,author:((n=t.createdBy)==null?void 0:n.name)||"Member",authorId:(r=t.createdBy)==null?void 0:r.id,avatar:yPe(t.createdBy),text:t.description||"",time:yc(t.createdAt),isByMe:!!t.isByMe,reactions:bPe(t.reactions),replies:(t.replies??[]).map((s,i)=>obr(s,i+1)),images:mq(t.images),document:d0(t.document),documentName:t.documentName}}function fq(t){return(t??[]).map((e,n)=>oP(e,n+1))}function lbr(t){var o,l,c;const e=(o=t==null?void 0:t.questions)==null?void 0:o[0];if(!t||t.isQuiz||!e||!Array.isArray(e.options))return;const n=t.voteCount??0,r=e.options.map(d=>{var u;return{text:d,votes:Math.round((((u=t.votes)==null?void 0:u[d])??0)*n)}}),s=(c=(l=t.myAnswer)==null?void 0:l[0])==null?void 0:c.option,i=s!=null?e.options.findIndex(d=>d===s):-1;return{question:(t.title||e.statement||"").trim(),options:r,totalVotes:n,votedOption:i>=0?i:null,duration:t.endTime?n_t(t.endTime):"",endsAt:t.endTime??null}}function n_t(t,e=Date.now()){const n=Date.parse(t);if(!Number.isFinite(n))return"";const r=n-e;if(r<=0)return"ended";if(gPe(t,e))return"no end date";const s=Math.round(r/6e4);if(s<60)return`ends in ${Math.max(1,s)}m`;const i=Math.round(s/60);if(i<48)return`ends in ${i}h`;const o=Math.round(i/24);return o<=14?`ends in ${o}d`:`ends ${new Date(n).toLocaleDateString(void 0,{day:"numeric",month:"short",year:o>300?"numeric":void 0})}`}function r_t(t){if(!(t!=null&&t.isQuiz))return;const e=(t.questions??[]).filter(r=>(r==null?void 0:r.id)&&Array.isArray(r.options)).map(r=>({id:String(r.id),statement:r.statement||"",options:r.options.filter(s=>typeof s=="string"),answer:r.answer||void 0}));if(e.length===0)return;let n=null;if(t.isAnsweredByMe||Array.isArray(t.myAnswer)&&t.myAnswer.length>0){n={};for(const r of t.myAnswer??[])r!=null&&r.question&&(n[String(r.question)]=r.option??null)}return{title:t.title||"",instructions:t.instructions||"",endTime:t.endTime||null,questions:e,myAnswers:n,answersCount:t.answersCount??0}}function cbr(t){if(!t)return;const e={hideComment:!!t.hideComment,hideLikes:!!t.hideLikes,hideCreator:!!t.hideCreator,hideDate:!!t.hideDate};return Object.values(e).some(Boolean)?e:void 0}function dbr(t){return(t??[]).filter(e=>(e==null?void 0:e.label)&&(e==null?void 0:e.url)).map(e=>({label:e.label,url:e.url,position:e.position==="bottom"?"bottom":"top"}))}function ubr(t){var r,s,i;const e=(s=(r=t==null?void 0:t.user)==null?void 0:r.name)==null?void 0:s.trim();return!t||!((i=t.user)!=null&&i.id)||!e?void 0:{kind:t.type==="comment"?"comment":t.reaction==="other"?"reaction":"like",userId:t.user.id,name:e,avatar:t.user.picture??""}}function hbr(t){return(t??[]).filter(e=>e==null?void 0:e.name).map(e=>({name:e.name,picture:e.picture??null}))}function mbr(t){if(t.isEnded)return!0;const e=t.endedAt?Date.parse(t.endedAt):NaN;return Number.isFinite(e)&&e<=Date.now()}function Am(t,e){var i,o,l,c,d,u,h,m,f,p,g;const n=t.latestComment,r=mq(t.images),s=d0(t.banner);return{id:e,realId:t.id,author:((i=t.createdBy)==null?void 0:i.name)||"Member",avatar:yPe(t.createdBy),authorId:(o=t.createdBy)==null?void 0:o.id,authorBio:((c=(l=t.createdBy)==null?void 0:l.shortBio)==null?void 0:c.trim())||"",authorTitle:((u=(d=t.createdBy)==null?void 0:d.title)==null?void 0:u.trim())||"",authorLocation:((m=(h=t.createdBy)==null?void 0:h.location)==null?void 0:m.trim())||"",authorIsAdmin:!!((f=t.createdBy)!=null&&f.isAdmin)||((p=t.createdBy)==null?void 0:p.groupRole)==="admin",time:yc(t.createdAt),channel:vHe(t.tab)||vHe(t.group)||"Feed",groupId:yHe(t.group),channelId:yHe(t.tab),tags:abr(t),topics:(t.topics??[]).filter(v=>v.id&&v.name).map(v=>({id:v.id,name:v.name})),title:t.title||"",body:t.description||"",image:r[0]||null,banner:s,likes:t.likeCount??0,comments:t.commentCount??0,views:t.viewCount??0,liked:!!t.isLikedByMe,saved:!!t.isBookmarkedByMe,following:!1,commentsList:n?[oP(n,1)]:[],commentsLoaded:!1,latestLikes:hbr(t.latestLikes),poll:lbr(t.poll),quiz:r_t(t.poll),preferences:cbr(t.preferences),images:r,videos:mq(t.videos),videoThumbnails:mq(t.videoThumbnails),document:d0(t.document),documentName:t.documentName,embedCode:t.embedCode||void 0,embedCodeHeight:t.embedCodeHeight||void 0,linkPreview:(g=t.linkPreview)!=null&&g.url?t.linkPreview:null,linkPreviewHidden:t.linkPreviewHidden===!0,buttons:dbr(t.buttons),shared:t.shared?Am(t.shared,e):null,reposts:t.shareCount??0,reposted:!!t.isRepostedByMe,followedActivity:ubr(t.followedActivity),reactions:bPe(t.reactions),scheduledPublishAt:t.scheduledPublishAt??null,event:t.event?gg(t.event):null,liveCall:t.liveCall?{id:t.liveCall.id,meetingId:t.liveCall.meetingId,name:t.liveCall.name||t.title||"Live session",isLive:!!t.liveCall.isLive&&!t.liveCall.isEnded,isEnded:mbr(t.liveCall),endedAt:t.liveCall.endedAt}:null,canEdit:!!t.canEdit,canDelete:!!t.canDelete,canDeleteComment:!!t.canDeleteComment,canDeleteReply:!!t.canDeleteReply,isByMe:!!t.isByMe,isPinned:!!t.isPinned}}const aF=t=>`/community/${encodeURIComponent(t)}/post-drafts`;function s_t(t,e=1){return ae.get(`${aF(t)}?page=${e}`)}async function fbr(t,e){return(await ae.get(`${aF(t)}/${encodeURIComponent(e)}`)).draft}async function pbr(t,e,n){const r=n?`${aF(t)}/${encodeURIComponent(n)}`:aF(t);return(await ae.post(r,e)).draft}function gbr(t,e){return ae.delete(`${aF(t)}/${encodeURIComponent(e)}`)}const e9=t=>`/community/${encodeURIComponent(t)}`;function xse(t){return ae.get(`${e9(t)}/topics`)}function vbr(t,e){return ae.post(`${e9(t)}/topic`,e)}function ybr(t,e,n){return ae.patch(`${e9(t)}/topic/${encodeURIComponent(e)}/edit`,n)}function bbr(t,e){return ae.patch(`${e9(t)}/topic/${encodeURIComponent(e)}/archive`,{})}function xbr(t,e){return ae.patch(`${e9(t)}/topic/${encodeURIComponent(e)}/delete`,{})}function t9(t){return new Date(t.getTime()-t.getTimezoneOffset()*6e4).toISOString().slice(0,16)}function oF(){return t9(new Date(Date.now()+6e4))}function xPe(t){const e=new Date(t).getTime();return Number.isFinite(e)&&e>Date.now()}function vd(t){const e=t instanceof Date?t:new Date(t);return Number.isNaN(e.getTime())?"":e.toLocaleString()}function i_t(t){const e=t instanceof Date?t:new Date(t);return Number.isNaN(e.getTime())?"":e.toLocaleString(void 0,{month:"short",day:"numeric",year:e.getFullYear()===new Date().getFullYear()?void 0:"numeric",hour:"numeric",minute:"2-digit"})}function lF(){return Intl.DateTimeFormat().resolvedOptions().timeZone||"local time"}const bHe=4;function sue(t){const e=new Set;for(const n of t){const r=n.trim().toLowerCase();if(e.has(r))return!0;e.add(r)}return!1}function NT(){return{statement:"",options:["","","",""],answer:""}}function a_t(t){const n=[...t.map(r=>r.trim())];for(;n.length<bHe;)n.push("");return n.slice(0,bHe)}function wbr(t){const e=t.map(n=>n.trim()).filter(Boolean);return e.length>=2?e:t.length>=2?t:["",""]}function iue(t,e,n){const r={statement:t.trim(),options:e};return n!=null&&n.trim()&&(r.answer=n.trim()),r}function kbr(t){const{kind:e,pollQuestion:n,pollOptions:r,pollAnswer:s,pollDurationLabel:i,quizTitle:o,quizInstructions:l,quizDurationMinutes:c,quizQuestions:d}=t;if(e==="quiz"){const p=o.trim();if(!p)return{ok:!1,message:"Quiz title is required."};if(d.length===0)return{ok:!1,message:"Add at least one quiz question."};const g=[];for(let v=0;v<d.length;v++){const b=d[v],x=b.statement.trim();if(!x)return{ok:!1,message:`Question ${v+1} text is required.`};const w=b.options.map(S=>S.trim());if(w.some(S=>!S))return{ok:!1,message:`All 4 options are required for question ${v+1}.`};if(sue(w))return{ok:!1,message:`Question ${v+1} has the same option twice.`};const k=b.answer.trim();if(!k||!w.includes(k))return{ok:!1,message:`Select a valid correct answer for question ${v+1}.`};g.push(iue(x,w,k))}return{ok:!0,metaTitle:p,payload:{isQuiz:!0,isQuestion:!1,title:p,instructions:l.trim()||void 0,questions:g,duration:c,endTime:Xyr()}}}const u=n.trim();if(!u)return{ok:!1,message:e==="question"?"Question text is required.":"Poll question is required."};if(e==="question"){const p=a_t(r).map(b=>b.trim());if(p.some(b=>!b))return{ok:!1,message:"All 4 options are required."};if(sue(p))return{ok:!1,message:"Each option must be different."};const g=s.trim();if(!g||!p.includes(g))return{ok:!1,message:"Select the correct answer."};const v=qyr;return{ok:!0,metaTitle:u,payload:{isQuiz:!1,isQuestion:!0,title:u,questions:[iue(u,p,g)],duration:v,endTime:pHe(v)}}}const h=r.map(p=>p.trim()).filter(Boolean);if(h.length<2)return{ok:!1,message:"At least 2 options are required."};if(sue(h))return{ok:!1,message:"Each option must be different."};let m,f;if(i===w0e){const p=Qyr(t.pollCustomEndDay);if(!p)return{ok:!1,message:`Pick the day the poll ends, up to ${vPe} days from today.`};({hours:m,endTime:f}=p)}else m=Jyr(i),f=pHe(m);return{ok:!0,metaTitle:u,payload:{isQuiz:!1,isQuestion:!1,title:u,questions:[iue(u,h)],duration:m,endTime:f}}}const Sbr="COMMUNITY_POST_TIMER_LIMIT";function Cbr({communityId:t,bypassTimer:e}){const n=lt({queryKey:["community-post-timer-limit",t],queryFn:()=>qj(t,Sbr),enabled:!!t,staleTime:6e4,select:h=>{var m;return Number((m=h.configurable)==null?void 0:m.configurableValue)||0}}),r=lt({queryKey:["community-last-post-time",t],queryFn:()=>jnn(t),enabled:!!t,staleTime:3e4,select:h=>h.lastPostCreatedTime??null}),s=n.data??0,i=r.data??null,[o,l]=y.useState(()=>Date.now());y.useEffect(()=>{if(!s||e||!i)return;const h=window.setInterval(()=>l(Date.now()),1e3);return()=>window.clearInterval(h)},[s,e,i]);const c=y.useMemo(()=>{if(!s||e||!i)return 0;const h=(o-new Date(i).getTime())/1e3;return Math.max(0,Math.floor(s-h))},[s,e,i,o]),d=c>0,u=()=>{r.refetch()};return{isBlocked:d,remainingSeconds:c,timerLimitSeconds:s,isLoading:n.isLoading||r.isLoading,invalidateAfterPublish:u}}const o_t=1024,l_t=o_t*1024*1024,dk=`${o_t/1024} GB`;function wse(t){return t.size>l_t}const QZ=25,c_t=QZ*1024*1024;function jbr(t){return t.type.startsWith("video/")?dk:`${QZ} MB`}function xHe(t){return t.size>(t.type.startsWith("video/")?l_t:c_t)}function Ebr(t){return t.size>c_t}const lP=t=>["post-drafts",t];function wHe(t){return t.trim().toLowerCase().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-").slice(0,255)}function kHe(t,e,n){var l,c,d,u;const r=((l=n==null?void 0:n.slug)==null?void 0:l.trim())||wHe(t||e.slice(0,60)||"post"),s=h=>h.slice(0,255),i=((c=n==null?void 0:n.ogTitle)==null?void 0:c.trim())||t,o=((d=n==null?void 0:n.ogDescription)==null?void 0:d.trim())||e;return{slug:wHe(r),title:s(t),description:s(e),openGraphTitle:s(i),openGraphDescription:s(o),openGraphImage:((u=n==null?void 0:n.ogImage)==null?void 0:u.trim())||""}}function Nbr(t){return t.split(",").map(e=>e.trim()).filter(Boolean)}const TT=5,SHe=2,d_t=20,nx={label:"",url:"",position:"bottom"},Tbr="Your post is in review as it may contain spam.";class FV extends Error{constructor(e,n){super(e),this.cause=n,this.name="PostMediaUploadError"}}function u_t(t){var r,s;const e=((r=t.label)==null?void 0:r.trim())??"",n=((s=t.url)==null?void 0:s.trim())??"";return!e&&!n?null:n?o0(n)?e?null:"Add a label for this button.":"Enter a valid http(s) link.":"Add a link for this button."}function h_t(t){return t.filter(e=>{var n,r;return((n=e.label)==null?void 0:n.trim())&&((r=e.url)==null?void 0:r.trim())}).map(e=>({...e,label:e.label.trim(),url:o0(e.url)})).filter(e=>e.url)}function _br(t){if(t instanceof ze){const e=t.body,n=typeof(e==null?void 0:e.reason)=="string"?e.reason.trim():"",r=Dt(t.body,t.message);if(n){const s=n.charAt(0).toUpperCase()+n.slice(1);return/[.!?]$/.test(s)?s:`${s}.`}return r}return dn(t,"We couldn't publish your post. Please try again.")}function m_t({communityId:t,groups:e,communityDetail:n,onPublish:r,onPublished:s,onDraftSaved:i,preferGroupId:o=null,preferTabId:l=null,preferGroup:c=null}){var wMe;const{toast:d}=yt(),u=rn(),h=y.useRef(null),m=y.useRef(null),f=y.useRef(null),p=y.useRef(null),g=y.useRef(null),v=y.useRef(null),b=y.useRef(null),x=y.useRef(null),w=y.useMemo(()=>{const bt=n==null?void 0:n.configurables;return(bt==null?void 0:bt.COMMUNITY_DEFAULT_POST_SECTION)??null},[n]),k=!!((wMe=n==null?void 0:n.configuration)!=null&&wMe.useMdEditorForCreatePostDescription),S=y.useMemo(()=>Hvr(e,c),[e,c]),C=y.useMemo(()=>EN(S),[S]),j=y.useMemo(()=>Vvr(S),[S]),E=C.length>0,A=lt({queryKey:["community-topics-create",t],queryFn:()=>xse(t),enabled:!!t,staleTime:6e4,select:bt=>(bt.topics??[]).filter(St=>(St.status??"ACTIVE")==="ACTIVE")}).data??[],[_,T]=y.useState("post"),[R,O]=y.useState(""),[F,D]=y.useState(""),[I,P]=y.useState([]),[M,z]=y.useState([]),[G,B]=y.useState("poll"),[H,W]=y.useState(""),[V,U]=y.useState(["",""]),[ne,te]=y.useState(""),[re,fe]=y.useState("1 Day"),[le,q]=y.useState(""),[Y,X]=y.useState(""),[Q,ie]=y.useState(""),[he,ye]=y.useState(10),[J,K]=y.useState([NT()]),[ce,pe]=y.useState(null),[Ie,Me]=y.useState(null),[we,Be]=y.useState(null),[Ve,be]=y.useState(null),[Ze,Pe]=y.useState([]),[Ke,De]=y.useState(""),[xt,Xe]=y.useState(!1),[tt,$e]=y.useState(!1),[wt,Ee]=y.useState(null),Ge=y.useRef(null),Pt=()=>{var bt;return(bt=Ge.current)==null?void 0:bt.abort()},[vn,Hn]=y.useState(!1),[yr,br]=y.useState(!1),[Yt,nr]=y.useState(!1),[Kn,ms]=y.useState(0),is=y.useRef(null),[ke,at]=y.useState(aP),[Tt,An]=y.useState(""),[Pn,yn]=y.useState(""),[Is,js]=y.useState("400"),[Gt,lr]=y.useState(!1),[ct,Bn]=y.useState(!1),[Ms,Ue]=y.useState(!1),[et,Le]=y.useState(!1),[Ye,st]=y.useState(""),[nt,Je]=y.useState(""),[Rt,Qt]=y.useState(!1),[Jt,Qe]=y.useState(!0),[Lt,Xt]=y.useState([{...nx}]),[xr,Ls]=y.useState(""),[xi,oa]=y.useState(""),[la,$i]=y.useState(""),[al,$l]=y.useState(""),[ou,Ih]=y.useState(null),[av,ov]=y.useState(!1),[Uu,K0]=y.useState(null),[lb,Y0]=y.useState(null),[cb,Mh]=y.useState(null),[db,bn]=y.useState(null),[Re,gt]=y.useState(!1),kn=()=>{K0(null),Y0(null),Mh(null),bn(null)};y.useEffect(()=>{if(C.length===0)return;const bt=`${o??""}:${l??""}#${Kn}`,St=is.current!==bt,qt=Gvr(S,{preferGroupId:o,preferTabId:l,defaultTabId:w});De(Bs=>!St&&Bs&&g0e(C,Bs)?Bs:(qt==null?void 0:qt.id)??C[0].id),(!o||(qt==null?void 0:qt.groupId)===o||S.some(Bs=>Bs.id===o))&&(is.current=bt)},[C,S,w,o,l,Kn]);const sn=g0e(C,Ke)??C[0]??null,Jr=y.useMemo(()=>S.find(bt=>bt.id===(sn==null?void 0:sn.groupId)),[S,sn==null?void 0:sn.groupId]),Ks=y.useMemo(()=>{var bt;return(bt=Jr==null?void 0:Jr.tabs)==null?void 0:bt.find(St=>St.id===(sn==null?void 0:sn.tabId))},[Jr,sn==null?void 0:sn.tabId]),ca=(n==null?void 0:n.myRole)==="admin"||!!(n!=null&&n.isByMe),Gc=(Jr==null?void 0:Jr.myRole)==="admin"||(Jr==null?void 0:Jr.myRole)==="moderator",Q0=ca||Gc,Cc=ca||Gc,HS=ca||Gc;y.useEffect(()=>{HS||Je("")},[HS]);const Tae=(Ks==null?void 0:Ks.pushNotificationOnNewPost)??!0,aL=Cbr({communityId:t,bypassTimer:ca||Gc});y.useEffect(()=>{Qt(!1),Qe(Tae)},[sn==null?void 0:sn.id,Tae]);const _ae=()=>{v.current=null,b.current=null,g.current=null},Aae=bt=>{for(const St of bt)URL.revokeObjectURL(St.preview)},oMe=()=>Ze.length+M.length,H6t=()=>{var bt;(bt=x.current)==null||bt.clear(),O(""),at(aP),D(""),P([]),W(""),U(["",""]),te(""),fe("1 Day"),q(""),B("poll"),X(""),ie(""),ye(10),K([NT()]),An(""),yn(""),js("400"),lr(!1),Bn(!1),Ue(!1),Le(!1),st(""),Je(""),Xt([{...nx}]),Ls(""),oa(""),$i(""),$l(""),T("post"),oL(null),Me(null),Be(null),be(null),Pe([]),z(St=>(Aae(St),[])),Ih(null),g.current=null,_ae(),ov(!1),Hn(!1),ms(St=>St+1),kn(),h.current&&(h.current.value=""),m.current&&(m.current.value=""),f.current&&(f.current.value=""),p.current&&(p.current.value="")},lMe=()=>{var bt;O(""),at(aP),D(""),P([]),z(St=>(Aae(St),[])),oL(null),Me(null),Be(null),be(null),Pe([]),W(""),U(["",""]),te(""),fe("1 Day"),q(""),B("poll"),X(""),ie(""),ye(10),K([NT()]),T("post"),An(""),yn(""),js("400"),lr(!1),Bn(!1),Ue(!1),Le(!1),st(""),Je(""),Xt([{...nx}]),Ls(""),oa(""),$i(""),$l(""),Ih(null),g.current=null,ov(!1),Hn(!1),ms(St=>St+1),kn(),(bt=x.current)==null||bt.clear(),_ae(),h.current&&(h.current.value=""),m.current&&(m.current.value=""),f.current&&(f.current.value=""),p.current&&(p.current.value="")},G6t=bt=>{bt==="question"&&G==="poll"?(U(a_t(V)),te("")):bt==="poll"&&G==="question"?(U(wbr(V)),te("")):bt==="quiz"&&J.length===0&&K([NT()]),B(bt)},W6t=()=>{G!=="question"&&V.length<d_t&&U([...V,""])},q6t=bt=>{G!=="question"&&V.length>SHe&&U(V.filter((St,qt)=>qt!==bt))},K6t=(bt,St)=>{U(qt=>{var Bs;const un=qt.map((da,Ai)=>Ai===bt?St:da);return G==="question"&&ne&&ne===((Bs=qt[bt])==null?void 0:Bs.trim())&&te(St.trim()),un})},Y6t=()=>{K(bt=>[...bt,NT()])},Q6t=bt=>{K(St=>St.length<=1?St:St.filter((qt,un)=>un!==bt))},Z6t=(bt,St)=>{K(qt=>qt.map((un,Bs)=>{if(Bs!==bt)return un;const da={...un,...St};if(St.options){const Ai=un.answer,Js=un.options.findIndex(ua=>ua.trim()===Ai);Js>=0&&St.options[Js]!==void 0&&(da.answer=St.options[Js].trim())}return da}))},cMe=bt=>{const St=bt.filter(da=>!da.type||da.type.startsWith("image/"));if(St.length===0)return;const qt=TT-oMe();if(qt<=0){d({title:"Image limit reached",description:`You can add up to ${TT} images or GIFs in total.`,variant:"destructive"});return}const Bs=St.slice(0,qt).map(da=>({id:crypto.randomUUID(),file:da,preview:URL.createObjectURL(da)}));z(da=>[...da,...Bs]),St.length>qt&&d({title:"Some images skipped",description:`Only ${TT} images or GIFs are allowed in total.`})},J6t=bt=>{const St=Array.from(bt.target.files??[]);St.length>0&&cMe(St),h.current&&(h.current.value="")},X6t=bt=>{z(St=>{const qt=St.find(un=>un.id===bt);return qt&&URL.revokeObjectURL(qt.preview),St.filter(un=>un.id!==bt)})},oL=bt=>pe(St=>(St&&URL.revokeObjectURL(St),bt)),eFt=bt=>{var qt;const St=(qt=bt.target.files)==null?void 0:qt[0];if(St){if(bt.target.value="",wse(St)){d({title:"Video too large",description:`Videos can be up to ${dk}.`,variant:"destructive"});return}v.current=St,Y0(null),Me(St.name),oL(URL.createObjectURL(St))}},dMe=bt=>{we&&URL.revokeObjectURL(we),b.current=bt,Mh(null),be(bt.name),Be(URL.createObjectURL(bt))},tFt=bt=>{var qt;const St=(qt=bt.target.files)==null?void 0:qt[0];St&&dMe(St)},uMe=bt=>{ou&&URL.revokeObjectURL(ou),g.current=bt,bn(null),Ih(URL.createObjectURL(bt))},nFt=bt=>{var qt;const St=(qt=bt.target.files)==null?void 0:qt[0];St&&uMe(St)},rFt=()=>{ou&&URL.revokeObjectURL(ou),Ih(null),g.current=null,bn(null),p.current&&(p.current.value="")},sFt=bt=>{if(oMe()>=TT){d({title:"Image limit reached",description:`You can add up to ${TT} images or GIFs in total.`,variant:"destructive"});return}Pe(St=>[...St,bt])},iFt=bt=>{Pe(St=>St.filter((qt,un)=>un!==bt))},aFt=bt=>{const St=x.current;if(!St){O(qt=>qt+bt);return}St.insertText(bt)},oFt=()=>{oL(null),Me(null),v.current=null,Y0(null),m.current&&(m.current.value="")},lFt=()=>{Be(null),be(null),b.current=null,Mh(null),f.current&&(f.current.value="")},cFt=bt=>{P(St=>St.includes(bt)?St.filter(qt=>qt!==bt):St.length>=3?(d({title:"Maximum 3 topics",variant:"destructive"}),St):[...St,bt])},dFt=()=>{Lt.length>=3||Xt(bt=>[...bt,{...nx}])},uFt=bt=>{Xt(St=>St.length<=1?St:St.filter((qt,un)=>un!==bt))},hFt=(bt,St)=>{Xt(qt=>qt.map((un,Bs)=>Bs===bt?{...un,...St}:un))},hMe=y.useMemo(()=>Lt.map(u_t),[Lt]),mFt=Q0&&hMe.some(Boolean),mMe=()=>{const bt=Cc?{sendEmailNotification:Rt,sendPushNotification:Jt}:{sendEmailNotification:!1,sendPushNotification:Tae};if(HS&&nt.trim()){const Bs=new Date(nt);Number.isNaN(Bs.getTime())||(bt.scheduledPublishAt=Bs.toISOString())}if(!Q0)return bt;bt.preferences={hideComment:Gt,hideLikes:ct,hideCreator:Ms,hideDate:et};const St=Nbr(Tt);St.length>0&&(bt.tags=St),Pn.trim()&&(bt.embedCode=Pn.trim(),bt.embedCodeHeight=Is.trim()||"400");const qt=h_t(Lt);qt.length>0&&(bt.buttons=qt);const un=Ye.trim();if(un){const Bs=new Date(un.includes("T")?un:`${un}T12:00:00`);Number.isNaN(Bs.getTime())||(bt.createdAt=Bs.toISOString())}return bt},fMe=async()=>{const bt=[];M.length>0&&bt.push({type:"image",files:M.map(Js=>Js.file)}),v.current&&bt.push({type:"video",files:[v.current]}),b.current&&bt.push({type:"document",files:[b.current]}),g.current&&bt.push({type:"banner",files:[g.current]});const St={};if(Ze.length>0&&(St.images=[...Ze]),lb&&!v.current&&(St.videos=[lb.url]),cb&&!b.current&&(St.document=[cb.url]),db&&!g.current&&(St.banner=[db]),bt.length===0)return St;if(!t)throw new FV("Couldn't upload attachments: no community selected.");const qt=bt.map(Js=>Js.files.reduce((ua,zu)=>ua+(zu.size||1),0)),un=qt.reduce((Js,ua)=>Js+ua,0)||1,Bs=bt.map(()=>0),da=()=>Ee(Math.min(100,Math.round(Bs.reduce((Js,ua)=>Js+ua,0)*100/un))),Ai=new AbortController;Ge.current=Ai,$e(!0),Ee(0);try{const Js=await Promise.all(bt.map((ua,zu)=>SEt(t,ua.type,ua.files,Um=>{Bs[zu]=qt[zu]*Um/100,da()},Ai.signal))).catch(ua=>{throw Ai.abort(),ua});return bt.forEach((ua,zu)=>{const Um=Js[zu];ua.type==="image"?St.images=[...Um,...Ze]:ua.type==="video"?St.videos=Um.slice(0,1):ua.type==="document"?St.document=Um.slice(0,1):St.banner=Um.slice(0,1)}),St}catch(Js){if(kg(Js))throw Js;const ua=Js instanceof ze?Dt(Js.body,Js.message):dn(Js,"");throw new FV(`Couldn't upload your attachments${ua?` (${ua})`:""}. Your post was not published — try again.`,Js)}finally{Ge.current=null,$e(!1),Ee(null)}},pMe=async bt=>{var un;const St=await fMe(),qt=await qAe({...bt,...St});return{post:qt.post,inReview:!!qt.inReview,reviewReason:qt.reviewReason,scheduled:!!qt.scheduled,scheduledPublishAt:qt.scheduledPublishAt??((un=qt.post)==null?void 0:un.scheduledPublishAt)??null}},gMe=(bt,St)=>{var qt;if(Uu&&u.invalidateQueries({queryKey:lP(t)}),lMe(),aL.invalidateAfterPublish(),s==null||s(),bt.inReview){d({title:"Post in review",description:((qt=bt.reviewReason)==null?void 0:qt.trim())||Tbr});return}if(r(bt.post),bt.scheduled){const un=bt.scheduledPublishAt?vd(bt.scheduledPublishAt):"";d({title:"Post scheduled",description:un?`It goes out on ${un}. Only you can see it until then — edit or delete it from the post menu.`:"Only you can see it until it goes out."});return}d(St)},vMe=()=>sn||(E?(Hn(!0),null):(nr(!0),null)),yMe=()=>aL.isBlocked?(d({title:"Please wait",description:"You need to wait before creating another post.",variant:"destructive"}),!1):HS&&nt.trim()&&!xPe(nt)?(d({title:"Pick a time in the future",description:"Choose when this post should go out, or clear the time to post it now.",variant:"destructive"}),!1):HS&&nt.trim()&&Ye.trim()?(ov(!0),d({title:"Pick one date, not two",description:"This post has both a publish time and a backdate. Clear one of them, then post.",variant:"destructive"}),!1):mFt?(ov(!0),d({title:"Check your custom buttons",description:"Each button needs a label and a valid http(s) link.",variant:"destructive"}),!1):!0,bMe=bt=>{if(kg(bt)){d({title:"Upload cancelled",description:"Your post was not published. Everything is still here."});return}if(bt instanceof FV){d({title:"Upload failed",description:bt.message,variant:"destructive"});return}d({title:"Could not publish",description:_br(bt),variant:"destructive"})},Pae=()=>{var St;const bt=((St=x.current)==null?void 0:St.readMarkdown())??R;return{title:F.trim(),description:bt.trim()}},Rae=(bt,St)=>bt.length>dd?(d({title:`Title must be ${dd} characters or fewer`,variant:"destructive"}),!1):St.length>fa?(d({title:`Description must be ${fa} characters or fewer`,variant:"destructive"}),!1):!0,lL=async(bt={})=>{if(!yMe())return;const St=bt.destination??vMe();if(!St)return;const qt=kbr({kind:G,pollQuestion:H,pollOptions:V,pollAnswer:ne,pollDurationLabel:re,pollCustomEndDay:le,quizTitle:Y,quizInstructions:Q,quizDurationMinutes:he,quizQuestions:J});if(qt.ok===!1){d({title:qt.message,variant:"destructive"});return}const{title:un,description:Bs}=Pae();if(!Rae(un,Bs))return;if(bt.confirmChannel){br(!0);return}const da={title:un,description:Bs,groupId:St.groupId,tabId:St.tabId,topics:I,poll:qt.payload,meta:kHe(un||qt.metaTitle,Bs,{slug:xr,ogTitle:xi,ogDescription:la,ogImage:al}),...mMe(),...qZ(ke,Bs),...Uu?{draftId:Uu}:{}};Xe(!0);try{const Ai=await pMe(da),Js=G==="quiz"?"Quiz":G==="question"?"Question":"Poll";gMe(Ai,{title:`${Js} published!`,description:`Your ${Js.toLowerCase()} is now live in ${St.tabName}.`})}catch(Ai){bMe(Ai)}finally{Xe(!1)}},cL=async(bt={})=>{if(!yMe())return;const{title:St,description:qt}=Pae(),un=!!(qt||St),Bs=!!(M.length>0||v.current||b.current||Ze.length>0||lb||cb);if(!un&&!Bs){d({title:"Post cannot be empty",variant:"destructive"});return}if(!Rae(St,qt))return;const da=bt.destination??vMe();if(!da)return;if(bt.confirmChannel){br(!0);return}const Ai={title:St,description:qt,groupId:da.groupId,tabId:da.tabId,topics:I,meta:kHe(St,qt,{slug:xr,ogTitle:xi,ogDescription:la,ogImage:al}),...mMe(),...qZ(ke,qt),...Uu?{draftId:Uu}:{}};Xe(!0);try{const Js=await pMe(Ai);gMe(Js,{title:"Post published!",description:`Your post is now live in ${da.label}.`})}catch(Js){bMe(Js)}finally{Xe(!1)}},fFt=async()=>{var un,Bs,da;if(!t||Re||xt)return;const{title:bt,description:St}=Pae();if(!!!(bt||St||_==="poll"||M.length||Ze.length||v.current||b.current||g.current||lb||cb||db)){d({title:"Nothing to save yet",description:"Write something first, then save it as a draft.",variant:"destructive"});return}if(Rae(bt,St)){gt(!0);try{const Ai=await fMe(),Js=Ai.images??[],ua=(un=Ai.videos)!=null&&un[0]?{url:Ai.videos[0],name:Ie||"Video"}:null,zu=(Bs=Ai.document)!=null&&Bs[0]?{url:Ai.document[0],name:Ve||"Document"}:null,Um=((da=Ai.banner)==null?void 0:da[0])??null,UN={description:St,topicIds:I,images:Js,video:ua,document:zu,banner:Um,..._==="poll"?{poll:{kind:G,question:H,options:V,answer:ne,duration:re,customEndDay:le,quizTitle:Y,quizInstructions:Q,quizDurationMinutes:he,quizQuestions:J}}:{},settings:{customTags:Tt,embedCode:Pn,embedCodeHeight:Is,hideComment:Gt,hideLike:ct,hideCreator:Ms,hideDate:et,customDate:Ye,scheduleAt:nt,buttons:Lt,customSlug:xr,ogTitle:xi,ogDescription:la,ogImage:al}};await pbr(t,{title:bt,mode:_,groupId:(sn==null?void 0:sn.groupId)??null,tabId:(sn==null?void 0:sn.tabId)??null,media:[...Js,ua==null?void 0:ua.url,zu==null?void 0:zu.url,Um].filter(bFt=>!!bFt),data:UN},Uu),u.invalidateQueries({queryKey:lP(t)}),lMe(),i==null||i(),d({title:"Draft saved",description:"Open Drafts in the post composer whenever you want to finish it."})}catch(Ai){if(kg(Ai))d({title:"Upload cancelled",description:"Your draft was not saved. Everything is still here."});else if(Ai instanceof FV)d({title:"Upload failed",description:"Couldn't upload your attachments, so the draft was not saved. Try again.",variant:"destructive"});else{const Js=Ai instanceof ze?Dt(Ai.body,Ai.message):dn(Ai,"");d({title:"Could not save draft",description:Js||"Please try again.",variant:"destructive"})}}finally{gt(!1)}}},pFt=bt=>{var Ai,Js,ua,zu,Um;const St=bt.data??{},qt=St.poll,un=St.settings;z(UN=>(Aae(UN),[])),_ae(),h.current&&(h.current.value=""),m.current&&(m.current.value=""),f.current&&(f.current.value=""),p.current&&(p.current.value=""),K0(bt.id),T(bt.mode==="poll"?"poll":"post"),D(bt.title??"");const Bs=St.description??"";(Ai=x.current)==null||Ai.setMarkdown(Bs),O(Bs),P(Array.isArray(St.topicIds)?St.topicIds.slice(0,3):[]),Pe(Array.isArray(St.images)?St.images.slice(0,TT):[]),Y0(St.video??null),oL(((Js=St.video)==null?void 0:Js.url)??null),Me(((ua=St.video)==null?void 0:ua.name)??null),Mh(St.document??null),Be(((zu=St.document)==null?void 0:zu.url)??null),be(((Um=St.document)==null?void 0:Um.name)??null),bn(St.banner??null),Ih(St.banner??null),B((qt==null?void 0:qt.kind)??"poll"),W((qt==null?void 0:qt.question)??""),U(Array.isArray(qt==null?void 0:qt.options)&&qt.options.length>=SHe?qt.options:["",""]),te((qt==null?void 0:qt.answer)??""),fe((qt==null?void 0:qt.duration)??"1 Day"),q((qt==null?void 0:qt.customEndDay)??""),X((qt==null?void 0:qt.quizTitle)??""),ie((qt==null?void 0:qt.quizInstructions)??""),ye((qt==null?void 0:qt.quizDurationMinutes)??10),K(Array.isArray(qt==null?void 0:qt.quizQuestions)&&qt.quizQuestions.length?qt.quizQuestions:[NT()]),An((un==null?void 0:un.customTags)??""),yn((un==null?void 0:un.embedCode)??""),js((un==null?void 0:un.embedCodeHeight)??"400"),lr(!!(un!=null&&un.hideComment)),Bn(!!(un!=null&&un.hideLike)),Ue(!!(un!=null&&un.hideCreator)),Le(!!(un!=null&&un.hideDate)),st((un==null?void 0:un.customDate)??""),Je((un==null?void 0:un.scheduleAt)??""),Xt(Array.isArray(un==null?void 0:un.buttons)&&un.buttons.length?un.buttons:[{...nx}]),Ls((un==null?void 0:un.customSlug)??""),oa((un==null?void 0:un.ogTitle)??""),$i((un==null?void 0:un.ogDescription)??""),$l((un==null?void 0:un.ogImage)??"");const da=C.find(UN=>UN.groupId===bt.groupId&&UN.tabId===bt.tabId);da?De(da.id):bt.groupId&&d({title:"Pick a channel",description:"The channel this draft was written for isn't available to you any more."})},gFt=()=>_==="poll"?lL({confirmChannel:!0}):cL({confirmChannel:!0}),[Iae,xMe]=y.useState(null),vFt=bt=>{var un;if(br(!1),bt.id===(sn==null?void 0:sn.id))return _==="poll"?lL({destination:bt}):cL({destination:bt});De(bt.id);const St=(un=S.find(Bs=>Bs.id===bt.groupId))==null?void 0:un.myRole;if(!ca&&(St==="admin"||St==="moderator")!==Gc){d({title:"Channel changed",description:`Check the post options for ${bt.label}, then post again.`});return}xMe(bt.id)};y.useEffect(()=>{!Iae||(sn==null?void 0:sn.id)!==Iae||(xMe(null),_==="poll"?lL({destination:sn}):cL({destination:sn}))},[Iae,sn,_,lL,cL]);const yFt=xt||tt||Re||aL.isBlocked;return{linkPreviewChoice:ke,setLinkPreviewChoice:at,composerEpoch:Kn,fileInputRef:h,videoInputRef:m,pdfInputRef:f,bannerInputRef:p,contentEditorRef:x,postMode:_,setPostMode:T,postContent:R,setPostContent:O,postTitle:F,setPostTitle:D,selectedTopicIds:I,localImages:M,removeLocalImage:X6t,attachedImageUrls:Ze,removeAttachedImageUrl:iFt,pollKind:G,setPollKind:G6t,pollQuestion:H,setPollQuestion:W,pollOptions:V,pollAnswer:ne,setPollAnswer:te,pollDuration:re,setPollDuration:fe,pollCustomEndDay:le,setPollCustomEndDay:q,quizTitle:Y,setQuizTitle:X,quizInstructions:Q,setQuizInstructions:ie,quizDurationMinutes:he,setQuizDurationMinutes:ye,quizQuestions:J,addQuizQuestion:Y6t,removeQuizQuestion:Q6t,updateQuizQuestion:Z6t,selectedVideo:ce,selectedVideoName:Ie,selectedPdf:we,selectedPdfName:Ve,clearSelectedVideo:oFt,clearSelectedPdf:lFt,destinations:C,destinationChoices:j,canPostAnywhere:E,joinPromptOpen:Yt,setJoinPromptOpen:nr,groups:S,destinationId:Ke,setDestinationId:De,selectedDestination:sn,destinationPickerOpen:vn,setDestinationPickerOpen:Hn,hasAnyJoinedGroup:S.some(pTt),availableTopics:A,isPublishing:xt,isUploading:tt,uploadProgress:wt,cancelUpload:Pt,resetMediaOnClose:H6t,addPollOption:W6t,removePollOption:q6t,updatePollOption:K6t,handleImageSelect:J6t,addImageFiles:cMe,handleVideoSelect:eFt,handlePdfSelect:tFt,applyDocumentFile:dMe,handleBannerSelect:nFt,applyBannerFile:uMe,clearBanner:rFt,bannerPreview:ou,addGifUrl:sFt,insertEmoji:aFt,toggleTopic:cFt,publishPost:cL,publishPoll:lL,publish:gFt,channelConfirmOpen:yr,setChannelConfirmOpen:br,confirmChannelAndPublish:vFt,communityId:t,draftId:Uu,saveDraft:fFt,loadDraft:pFt,forgetDraft:bt=>K0(St=>St===bt?null:St),isSavingDraft:Re,useMarkdownEditor:k,postTimerBlocked:aL.isBlocked,postTimerRemainingSeconds:aL.remainingSeconds,showAdvancedOptions:Q0,isCommunityAdmin:ca,canControlNotifications:Cc,canEmbed:Q0,advancedOpen:av,setAdvancedOpen:ov,customTags:Tt,setCustomTags:An,embedCode:Pn,setEmbedCode:yn,embedCodeHeight:Is,setEmbedCodeHeight:js,hideComment:Gt,setHideComment:lr,hideLike:ct,setHideLike:Bn,hideCreator:Ms,setHideCreator:Ue,hideDate:et,setHideDate:Le,customDate:Ye,scheduleAt:nt,setScheduleAt:Je,canSchedule:HS,isScheduled:HS&&!!nt.trim(),setCustomDate:st,sendEmailNotification:Rt,setSendEmailNotification:Qt,sendPushNotification:Jt,setSendPushNotification:Qe,buttons:Lt,addButton:dFt,removeButton:uFt,updateButton:hFt,buttonErrors:hMe,customSlug:xr,setCustomSlug:Ls,ogTitle:xi,setOgTitle:oa,ogDescription:la,setOgDescription:$i,ogImage:al,setOgImage:$l,publishDisabled:yFt}}var CHe=!1,oj,k0e,S0e,pq,gq,f_t,vq,C0e,j0e,E0e,p_t,N0e,T0e,g_t,v_t;function Gu(){if(!CHe){CHe=!0;var t=navigator.userAgent,e=/(?:MSIE.(\d+\.\d+))|(?:(?:Firefox|GranParadiso|Iceweasel).(\d+\.\d+))|(?:Opera(?:.+Version.|.)(\d+\.\d+))|(?:AppleWebKit.(\d+(?:\.\d+)?))|(?:Trident\/\d+\.\d+.*rv:(\d+\.\d+))/.exec(t),n=/(Mac OS X)|(Windows)|(Linux)/.exec(t);if(N0e=/\b(iPhone|iP[ao]d)/.exec(t),T0e=/\b(iP[ao]d)/.exec(t),E0e=/Android/i.exec(t),g_t=/FBAN\/\w+;/i.exec(t),v_t=/Mobile/i.exec(t),p_t=!!/Win64/.exec(t),e){oj=e[1]?parseFloat(e[1]):e[5]?parseFloat(e[5]):NaN,oj&&document&&document.documentMode&&(oj=document.documentMode);var r=/(?:Trident\/(\d+.\d+))/.exec(t);f_t=r?parseFloat(r[1])+4:oj,k0e=e[2]?parseFloat(e[2]):NaN,S0e=e[3]?parseFloat(e[3]):NaN,pq=e[4]?parseFloat(e[4]):NaN,pq?(e=/(?:Chrome\/(\d+\.\d+))/.exec(t),gq=e&&e[1]?parseFloat(e[1]):NaN):gq=NaN}else oj=k0e=S0e=gq=pq=NaN;if(n){if(n[1]){var s=/(?:Mac OS X (\d+(?:[._]\d+)?))/.exec(t);vq=s?parseFloat(s[1].replace("_",".")):!0}else vq=!1;C0e=!!n[2],j0e=!!n[3]}else vq=C0e=j0e=!1}}var _0e={ie:function(){return Gu()||oj},ieCompatibilityMode:function(){return Gu()||f_t>oj},ie64:function(){return _0e.ie()&&p_t},firefox:function(){return Gu()||k0e},opera:function(){return Gu()||S0e},webkit:function(){return Gu()||pq},safari:function(){return _0e.webkit()},chrome:function(){return Gu()||gq},windows:function(){return Gu()||C0e},osx:function(){return Gu()||vq},linux:function(){return Gu()||j0e},iphone:function(){return Gu()||N0e},mobile:function(){return Gu()||N0e||T0e||E0e||v_t},nativeApp:function(){return Gu()||g_t},android:function(){return Gu()||E0e},ipad:function(){return Gu()||T0e}},Abr=_0e,BV=!!(typeof window<"u"&&window.document&&window.document.createElement),Pbr={canUseDOM:BV,canUseWorkers:typeof Worker<"u",canUseEventListeners:BV&&!!(window.addEventListener||window.attachEvent),canUseViewport:BV&&!!window.screen,isInWorker:!BV},Rbr=Pbr,y_t=Rbr,b_t;y_t.canUseDOM&&(b_t=document.implementation&&document.implementation.hasFeature&&document.implementation.hasFeature("","")!==!0);/**
 * Checks if an event is supported in the current execution environment.
 *
 * NOTE: This will not work correctly for non-generic events such as `change`,
 * `reset`, `load`, `error`, and `select`.
 *
 * Borrows from Modernizr.
 *
 * @param {string} eventNameSuffix Event name, e.g. "click".
 * @param {?boolean} capture Check if the capture phase is supported.
 * @return {boolean} True if the event is supported.
 * @internal
 * @license Modernizr 3.0.0pre (Custom Build) | MIT
 */function Ibr(t,e){if(!y_t.canUseDOM||e&&!("addEventListener"in document))return!1;var n="on"+t,r=n in document;if(!r){var s=document.createElement("div");s.setAttribute(n,"return;"),r=typeof s[n]=="function"}return!r&&b_t&&t==="wheel"&&(r=document.implementation.hasFeature("Events.wheel","3.0")),r}var Mbr=Ibr,Lbr=Abr,Dbr=Mbr,jHe=10,EHe=40,NHe=800;function x_t(t){var e=0,n=0,r=0,s=0;return"detail"in t&&(n=t.detail),"wheelDelta"in t&&(n=-t.wheelDelta/120),"wheelDeltaY"in t&&(n=-t.wheelDeltaY/120),"wheelDeltaX"in t&&(e=-t.wheelDeltaX/120),"axis"in t&&t.axis===t.HORIZONTAL_AXIS&&(e=n,n=0),r=e*jHe,s=n*jHe,"deltaY"in t&&(s=t.deltaY),"deltaX"in t&&(r=t.deltaX),(r||s)&&t.deltaMode&&(t.deltaMode==1?(r*=EHe,s*=EHe):(r*=NHe,s*=NHe)),r&&!e&&(e=r<1?-1:1),s&&!n&&(n=s<1?-1:1),{spinX:e,spinY:n,pixelX:r,pixelY:s}}x_t.getEventType=function(){return Lbr.firefox()?"DOMMouseScroll":Dbr("wheel")?"wheel":"mousewheel"};var $br=x_t,Obr=$br;const Fbr=Fs(Obr);function cF(t){"@babel/helpers - typeof";return cF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cF(t)}function Bbr(t,e){if(cF(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(cF(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Ubr(t){var e=Bbr(t,"string");return cF(e)=="symbol"?e:e+""}function zbr(t,e,n){return(e=Ubr(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function THe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Tc(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?THe(Object(n),!0).forEach(function(r){zbr(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):THe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Vbr(t,e,n,r,s,i=0){const{width:o,height:l}=e5(t,e,i),c=Math.min(o,n),d=Math.min(l,r);return c>d*s?{width:d*s,height:d}:{width:c,height:c/s}}function Hbr(t){return t.width>t.height?t.width/t.naturalWidth:t.height/t.naturalHeight}function L3(t,e,n,r,s=0){const{width:i,height:o}=e5(e.width,e.height,s);return{x:_He(t.x,i,n.width,r),y:_He(t.y,o,n.height,r)}}function _He(t,e,n,r){const s=Math.abs(e*r/2-n/2);return kse(t,-s,s)}function AHe(t,e){return Math.sqrt(Math.pow(t.y-e.y,2)+Math.pow(t.x-e.x,2))}function PHe(t,e){return Math.atan2(e.y-t.y,e.x-t.x)*180/Math.PI}function Gbr(t,e,n,r,s,i=0,o=!0){const l=o?Wbr:qbr,c=e5(e.width,e.height,i),d=e5(e.naturalWidth,e.naturalHeight,i),u={x:l(100,((c.width-n.width/s)/2-t.x/s)/c.width*100),y:l(100,((c.height-n.height/s)/2-t.y/s)/c.height*100),width:l(100,n.width/c.width*100/s),height:l(100,n.height/c.height*100/s)},h=Math.round(l(d.width,u.width*d.width/100)),m=Math.round(l(d.height,u.height*d.height/100)),f=d.width>=d.height*r?{width:Math.round(m*r),height:m}:{width:h,height:Math.round(h/r)};return{croppedAreaPercentages:u,croppedAreaPixels:Tc(Tc({},f),{},{x:Math.round(l(d.width-f.width,u.x*d.width/100)),y:Math.round(l(d.height-f.height,u.y*d.height/100))})}}function Wbr(t,e){return Math.min(t,Math.max(0,e))}function qbr(t,e){return e}function Kbr(t,e,n,r,s,i){const o=e5(e.width,e.height,n),l=kse(r.width/o.width*(100/t.width),s,i);return{crop:{x:l*o.width/2-r.width/2-o.width*l*(t.x/100),y:l*o.height/2-r.height/2-o.height*l*(t.y/100)},zoom:l}}function Ybr(t,e,n){const r=Hbr(e);return n.height>n.width?n.height/(t.height*r):n.width/(t.width*r)}function Qbr(t,e,n=0,r,s,i){const o=e5(e.naturalWidth,e.naturalHeight,n),l=kse(Ybr(t,e,r),s,i),c=r.height>r.width?r.height/t.height:r.width/t.width;return{crop:{x:((o.width-t.width)/2-t.x)*c,y:((o.height-t.height)/2-t.y)*c},zoom:l}}function RHe(t,e){return{x:(e.x+t.x)/2,y:(e.y+t.y)/2}}function Zbr(t){return t*Math.PI/180}function e5(t,e,n){const r=Zbr(n);return{width:Math.abs(Math.cos(r)*t)+Math.abs(Math.sin(r)*e),height:Math.abs(Math.sin(r)*t)+Math.abs(Math.cos(r)*e)}}function kse(t,e,n){return Math.min(Math.max(t,e),n)}function UV(...t){return t.filter(e=>typeof e=="string"&&e.length>0).join(" ").trim()}var Jbr=`.reactEasyCrop_Container {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
  user-select: none;
  touch-action: none;
  cursor: move;
  display: flex;
  justify-content: center;
  align-items: center;
}

.reactEasyCrop_Image,
.reactEasyCrop_Video {
  will-change: transform; /* this improves performances and prevent painting issues on iOS Chrome */
  max-width: unset; /* prevent global img/video reset rules from constraining the cropper media */
}

.reactEasyCrop_Contain {
  max-width: 100%;
  max-height: 100%;
  margin: auto;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}
.reactEasyCrop_Cover_Horizontal {
  width: 100%;
  height: auto;
}
.reactEasyCrop_Cover_Vertical {
  width: auto;
  height: 100%;
}

.reactEasyCrop_CropArea {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-sizing: border-box;
  box-shadow: 0 0 0 9999em;
  color: rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

.reactEasyCrop_CropAreaRound {
  border-radius: 50%;
}

.reactEasyCrop_CropAreaGrid::before {
  content: ' ';
  box-sizing: border-box;
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.5);
  top: 0;
  bottom: 0;
  left: 33.33%;
  right: 33.33%;
  border-top: 0;
  border-bottom: 0;
}

.reactEasyCrop_CropAreaGrid::after {
  content: ' ';
  box-sizing: border-box;
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.5);
  top: 33.33%;
  bottom: 33.33%;
  left: 0;
  right: 0;
  border-left: 0;
  border-right: 0;
}
`;const Xbr=1,exr=3,txr=1;var Sse=class Lp extends y.Component{constructor(...e){super(...e),this.cropperRef=y.createRef(),this.imageRef=y.createRef(),this.videoRef=y.createRef(),this.containerPosition={x:0,y:0},this.containerRef=null,this.styleRef=null,this.containerRect=null,this.mediaSize={width:0,height:0,naturalWidth:0,naturalHeight:0},this.dragStartPosition={x:0,y:0},this.dragStartCrop={x:0,y:0},this.gestureZoomStart=0,this.gestureRotationStart=0,this.isTouching=!1,this.lastPinchDistance=0,this.lastPinchRotation=0,this.rafDragTimeout=null,this.rafPinchTimeout=null,this.wheelTimer=null,this.currentDoc=typeof document<"u"?document:null,this.currentWindow=typeof window<"u"?window:null,this.resizeObserver=null,this.previousCropSize=null,this.isInitialized=!1,this.state={cropSize:null,hasWheelJustStarted:!1,mediaObjectFit:void 0},this.initResizeObserver=()=>{if(typeof window.ResizeObserver>"u"||!this.containerRef)return;let n=!0;this.resizeObserver=new window.ResizeObserver(r=>{if(n){n=!1;return}this.computeSizes()}),this.resizeObserver.observe(this.containerRef)},this.preventZoomSafari=n=>n.preventDefault(),this.cleanEvents=()=>{this.currentDoc&&(this.currentDoc.removeEventListener("mousemove",this.onMouseMove),this.currentDoc.removeEventListener("mouseup",this.onDragStopped),this.currentDoc.removeEventListener("touchmove",this.onTouchMove),this.currentDoc.removeEventListener("touchend",this.onDragStopped),this.currentDoc.removeEventListener("gesturechange",this.onGestureChange),this.currentDoc.removeEventListener("gestureend",this.onGestureEnd),this.currentDoc.removeEventListener("scroll",this.onScroll))},this.clearScrollEvent=()=>{this.containerRef&&this.containerRef.removeEventListener("wheel",this.onWheel),this.wheelTimer&&clearTimeout(this.wheelTimer)},this.onMediaLoad=()=>{const n=this.computeSizes();n&&(this.previousCropSize=n,this.emitCropData(),this.setInitialCrop(n),this.isInitialized=!0),this.props.onMediaLoaded&&this.props.onMediaLoaded(this.mediaSize)},this.setInitialCrop=n=>{if(this.props.initialCroppedAreaPercentages){const{crop:r,zoom:s}=Kbr(this.props.initialCroppedAreaPercentages,this.mediaSize,this.props.rotation,n,this.props.minZoom,this.props.maxZoom);this.props.onCropChange(r),this.props.onZoomChange&&this.props.onZoomChange(s)}else if(this.props.initialCroppedAreaPixels){const{crop:r,zoom:s}=Qbr(this.props.initialCroppedAreaPixels,this.mediaSize,this.props.rotation,n,this.props.minZoom,this.props.maxZoom);this.props.onCropChange(r),this.props.onZoomChange&&this.props.onZoomChange(s)}},this.computeSizes=()=>{const n=this.imageRef.current||this.videoRef.current;if(n&&this.containerRef){var r,s,i,o,l,c;this.containerRect=this.containerRef.getBoundingClientRect(),this.saveContainerPosition();const d=this.containerRect.width/this.containerRect.height,u=((r=this.imageRef.current)===null||r===void 0?void 0:r.naturalWidth)||((s=this.videoRef.current)===null||s===void 0?void 0:s.videoWidth)||0,h=((i=this.imageRef.current)===null||i===void 0?void 0:i.naturalHeight)||((o=this.videoRef.current)===null||o===void 0?void 0:o.videoHeight)||0,m=n.offsetWidth<u||n.offsetHeight<h,f=u/h;let p;if(m)switch(this.state.mediaObjectFit){default:case"contain":p=d>f?{width:this.containerRect.height*f,height:this.containerRect.height}:{width:this.containerRect.width,height:this.containerRect.width/f};break;case"horizontal-cover":p={width:this.containerRect.width,height:this.containerRect.width/f};break;case"vertical-cover":p={width:this.containerRect.height*f,height:this.containerRect.height};break}else p={width:n.offsetWidth,height:n.offsetHeight};this.mediaSize=Tc(Tc({},p),{},{naturalWidth:u,naturalHeight:h}),this.props.setMediaSize&&this.props.setMediaSize(this.mediaSize);const g=this.props.cropSize?this.props.cropSize:Vbr(this.mediaSize.width,this.mediaSize.height,this.containerRect.width,this.containerRect.height,this.props.aspect,this.props.rotation);return(((l=this.state.cropSize)===null||l===void 0?void 0:l.height)!==g.height||((c=this.state.cropSize)===null||c===void 0?void 0:c.width)!==g.width)&&this.props.onCropSizeChange&&this.props.onCropSizeChange(g),this.setState({cropSize:g},this.recomputeCropPosition),this.props.setCropSize&&this.props.setCropSize(g),g}},this.saveContainerPosition=()=>{if(this.containerRef){const n=this.containerRef.getBoundingClientRect();this.containerPosition={x:n.left,y:n.top}}},this.onMouseDown=n=>{this.currentDoc&&(n.preventDefault(),this.currentDoc.addEventListener("mousemove",this.onMouseMove),this.currentDoc.addEventListener("mouseup",this.onDragStopped),this.saveContainerPosition(),this.onDragStart(Lp.getMousePoint(n)))},this.onMouseMove=n=>this.onDrag(Lp.getMousePoint(n)),this.onScroll=n=>{this.currentDoc&&(n.preventDefault(),this.saveContainerPosition())},this.onTouchStart=n=>{this.currentDoc&&(this.isTouching=!0,!(this.props.onTouchRequest&&!this.props.onTouchRequest(n))&&(this.currentDoc.addEventListener("touchmove",this.onTouchMove,{passive:!1}),this.currentDoc.addEventListener("touchend",this.onDragStopped),this.saveContainerPosition(),n.touches.length===2?this.onPinchStart(n):n.touches.length===1&&this.onDragStart(Lp.getTouchPoint(n.touches[0]))))},this.onTouchMove=n=>{n.preventDefault(),n.touches.length===2?this.onPinchMove(n):n.touches.length===1&&this.onDrag(Lp.getTouchPoint(n.touches[0]))},this.onGestureStart=n=>{this.currentDoc&&(n.preventDefault(),this.currentDoc.addEventListener("gesturechange",this.onGestureChange),this.currentDoc.addEventListener("gestureend",this.onGestureEnd),this.gestureZoomStart=this.props.zoom,this.gestureRotationStart=this.props.rotation)},this.onGestureChange=n=>{if(n.preventDefault(),this.isTouching)return;const r=Lp.getMousePoint(n),s=this.gestureZoomStart-1+n.scale;if(this.setNewZoom(s,r,{shouldUpdatePosition:!0}),this.props.onRotationChange){const i=this.gestureRotationStart+n.rotation;this.props.onRotationChange(i)}},this.onGestureEnd=n=>{this.cleanEvents()},this.onDragStart=({x:n,y:r})=>{var s,i;this.dragStartPosition={x:n,y:r},this.dragStartCrop=Tc({},this.props.crop),(s=(i=this.props).onInteractionStart)===null||s===void 0||s.call(i)},this.onDrag=({x:n,y:r})=>{this.currentWindow&&(this.rafDragTimeout&&this.currentWindow.cancelAnimationFrame(this.rafDragTimeout),this.rafDragTimeout=this.currentWindow.requestAnimationFrame(()=>{if(!this.state.cropSize||n===void 0||r===void 0)return;const s=n-this.dragStartPosition.x,i=r-this.dragStartPosition.y,o={x:this.dragStartCrop.x+s,y:this.dragStartCrop.y+i},l=this.props.restrictPosition?L3(o,this.mediaSize,this.state.cropSize,this.props.zoom,this.props.rotation):o;this.props.onCropChange(l)}))},this.onDragStopped=()=>{var n,r;this.isTouching=!1,this.cleanEvents(),this.emitCropData(),(n=(r=this.props).onInteractionEnd)===null||n===void 0||n.call(r)},this.onWheel=n=>{if(!this.currentWindow||this.props.onWheelRequest&&!this.props.onWheelRequest(n))return;n.preventDefault();const r=Lp.getMousePoint(n),{pixelY:s}=Fbr(n),i=this.props.zoom-s*this.props.zoomSpeed/200;this.setNewZoom(i,r,{shouldUpdatePosition:!0}),this.state.hasWheelJustStarted||this.setState({hasWheelJustStarted:!0},()=>{var o,l;return(o=(l=this.props).onInteractionStart)===null||o===void 0?void 0:o.call(l)}),this.wheelTimer&&clearTimeout(this.wheelTimer),this.wheelTimer=this.currentWindow.setTimeout(()=>this.setState({hasWheelJustStarted:!1},()=>{var o,l;return(o=(l=this.props).onInteractionEnd)===null||o===void 0?void 0:o.call(l)}),250)},this.getPointOnContainer=({x:n,y:r},s)=>{if(!this.containerRect)throw new Error("The Cropper is not mounted");return{x:this.containerRect.width/2-(n-s.x),y:this.containerRect.height/2-(r-s.y)}},this.getPointOnMedia=({x:n,y:r})=>{const{crop:s,zoom:i}=this.props;return{x:(n+s.x)/i,y:(r+s.y)/i}},this.setNewZoom=(n,r,{shouldUpdatePosition:s=!0}={})=>{if(!this.state.cropSize||!this.props.onZoomChange)return;const i=kse(n,this.props.minZoom,this.props.maxZoom);if(s){const o=this.getPointOnContainer(r,this.containerPosition),l=this.getPointOnMedia(o),c={x:l.x*i-o.x,y:l.y*i-o.y},d=this.props.restrictPosition?L3(c,this.mediaSize,this.state.cropSize,i,this.props.rotation):c;this.props.onCropChange(d)}this.props.onZoomChange(i)},this.getCropData=()=>this.state.cropSize?Gbr(this.props.restrictPosition?L3(this.props.crop,this.mediaSize,this.state.cropSize,this.props.zoom,this.props.rotation):this.props.crop,this.mediaSize,this.state.cropSize,this.getAspect(),this.props.zoom,this.props.rotation,this.props.restrictPosition):null,this.emitCropData=()=>{const n=this.getCropData();if(!n)return;const{croppedAreaPercentages:r,croppedAreaPixels:s}=n;this.props.onCropComplete&&this.props.onCropComplete(r,s),this.props.onCropAreaChange&&this.props.onCropAreaChange(r,s)},this.emitCropAreaChange=()=>{const n=this.getCropData();if(!n)return;const{croppedAreaPercentages:r,croppedAreaPixels:s}=n;this.props.onCropAreaChange&&this.props.onCropAreaChange(r,s)},this.recomputeCropPosition=()=>{var n,r;if(!this.state.cropSize)return;let s=this.props.crop;if(this.isInitialized&&(!((n=this.previousCropSize)===null||n===void 0)&&n.width)&&(!((r=this.previousCropSize)===null||r===void 0)&&r.height)&&(Math.abs(this.previousCropSize.width-this.state.cropSize.width)>1e-6||Math.abs(this.previousCropSize.height-this.state.cropSize.height)>1e-6)){const o=this.state.cropSize.width/this.previousCropSize.width,l=this.state.cropSize.height/this.previousCropSize.height;s={x:this.props.crop.x*o,y:this.props.crop.y*l}}const i=this.props.restrictPosition?L3(s,this.mediaSize,this.state.cropSize,this.props.zoom,this.props.rotation):s;this.previousCropSize=this.state.cropSize,this.props.onCropChange(i),this.emitCropData()},this.onKeyDown=n=>{const{crop:r,onCropChange:s,keyboardStep:i,zoom:o,rotation:l}=this.props;let c=i;if(!this.state.cropSize)return;n.shiftKey&&(c*=.2);let d=Tc({},r);switch(n.key){case"ArrowUp":d.y-=c,n.preventDefault();break;case"ArrowDown":d.y+=c,n.preventDefault();break;case"ArrowLeft":d.x-=c,n.preventDefault();break;case"ArrowRight":d.x+=c,n.preventDefault();break;default:return}if(this.props.restrictPosition&&(d=L3(d,this.mediaSize,this.state.cropSize,o,l)),!n.repeat){var u,h;(u=(h=this.props).onInteractionStart)===null||u===void 0||u.call(h)}s(d)},this.onKeyUp=n=>{var r,s;switch(n.key){case"ArrowUp":case"ArrowDown":case"ArrowLeft":case"ArrowRight":n.preventDefault();break;default:return}this.emitCropData(),(r=(s=this.props).onInteractionEnd)===null||r===void 0||r.call(s)}}componentDidMount(){!this.currentDoc||!this.currentWindow||(this.containerRef&&(this.containerRef.ownerDocument&&(this.currentDoc=this.containerRef.ownerDocument),this.currentDoc.defaultView&&(this.currentWindow=this.currentDoc.defaultView),this.initResizeObserver(),typeof window.ResizeObserver>"u"&&this.currentWindow.addEventListener("resize",this.computeSizes),this.props.zoomWithScroll&&this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}),this.containerRef.addEventListener("gesturestart",this.onGestureStart)),this.currentDoc.addEventListener("scroll",this.onScroll),this.props.disableAutomaticStylesInjection||(this.styleRef=this.currentDoc.createElement("style"),this.styleRef.setAttribute("type","text/css"),this.props.nonce&&this.styleRef.setAttribute("nonce",this.props.nonce),this.styleRef.innerHTML=Jbr,this.currentDoc.head.appendChild(this.styleRef)),this.imageRef.current&&this.imageRef.current.complete&&this.onMediaLoad(),this.props.setImageRef&&this.props.setImageRef(this.imageRef),this.props.setVideoRef&&this.props.setVideoRef(this.videoRef),this.props.setCropperRef&&this.props.setCropperRef(this.cropperRef))}componentWillUnmount(){var e;if(!(!this.currentDoc||!this.currentWindow)){if(typeof window.ResizeObserver>"u"&&this.currentWindow.removeEventListener("resize",this.computeSizes),(e=this.resizeObserver)===null||e===void 0||e.disconnect(),this.containerRef&&this.containerRef.removeEventListener("gesturestart",this.preventZoomSafari),this.styleRef){var n;(n=this.styleRef.parentNode)===null||n===void 0||n.removeChild(this.styleRef)}this.cleanEvents(),this.props.zoomWithScroll&&this.clearScrollEvent()}}componentDidUpdate(e){var n,r,s,i,o,l,c,d;if(e.rotation!==this.props.rotation?(this.computeSizes(),this.recomputeCropPosition()):e.aspect!==this.props.aspect?this.computeSizes():e.objectFit!==this.props.objectFit?this.computeSizes():e.zoom!==this.props.zoom?this.recomputeCropPosition():((n=e.cropSize)===null||n===void 0?void 0:n.height)!==((r=this.props.cropSize)===null||r===void 0?void 0:r.height)||((s=e.cropSize)===null||s===void 0?void 0:s.width)!==((i=this.props.cropSize)===null||i===void 0?void 0:i.width)?this.computeSizes():(((o=e.crop)===null||o===void 0?void 0:o.x)!==((l=this.props.crop)===null||l===void 0?void 0:l.x)||((c=e.crop)===null||c===void 0?void 0:c.y)!==((d=this.props.crop)===null||d===void 0?void 0:d.y))&&this.emitCropAreaChange(),e.zoomWithScroll!==this.props.zoomWithScroll&&this.containerRef&&(this.props.zoomWithScroll?this.containerRef.addEventListener("wheel",this.onWheel,{passive:!1}):this.clearScrollEvent()),e.video!==this.props.video){var u;(u=this.videoRef.current)===null||u===void 0||u.load()}const h=this.getObjectFit();h!==this.state.mediaObjectFit&&this.setState({mediaObjectFit:h},this.computeSizes)}getAspect(){const{cropSize:e,aspect:n}=this.props;return e?e.width/e.height:n}getObjectFit(){if(this.props.objectFit==="cover"){if((this.imageRef.current||this.videoRef.current)&&this.containerRef){var e,n,r,s;this.containerRect=this.containerRef.getBoundingClientRect();const i=this.containerRect.width/this.containerRect.height;return(((e=this.imageRef.current)===null||e===void 0?void 0:e.naturalWidth)||((n=this.videoRef.current)===null||n===void 0?void 0:n.videoWidth)||0)/(((r=this.imageRef.current)===null||r===void 0?void 0:r.naturalHeight)||((s=this.videoRef.current)===null||s===void 0?void 0:s.videoHeight)||0)<i?"horizontal-cover":"vertical-cover"}return"horizontal-cover"}return this.props.objectFit}onPinchStart(e){const n=Lp.getTouchPoint(e.touches[0]),r=Lp.getTouchPoint(e.touches[1]);this.lastPinchDistance=AHe(n,r),this.lastPinchRotation=PHe(n,r),this.onDragStart(RHe(n,r))}onPinchMove(e){if(!this.currentDoc||!this.currentWindow)return;const n=Lp.getTouchPoint(e.touches[0]),r=Lp.getTouchPoint(e.touches[1]),s=RHe(n,r);this.onDrag(s),this.rafPinchTimeout&&this.currentWindow.cancelAnimationFrame(this.rafPinchTimeout),this.rafPinchTimeout=this.currentWindow.requestAnimationFrame(()=>{const i=AHe(n,r),o=this.props.zoom*(i/this.lastPinchDistance);this.setNewZoom(o,s,{shouldUpdatePosition:!1}),this.lastPinchDistance=i;const l=PHe(n,r),c=this.props.rotation+(l-this.lastPinchRotation);this.props.onRotationChange&&this.props.onRotationChange(c),this.lastPinchRotation=l})}render(){var e;const{image:n,video:r,mediaProps:s,cropperProps:i,transform:o,crop:{x:l,y:c},rotation:d,zoom:u,cropShape:h,showGrid:m,roundCropAreaPixels:f,style:{containerStyle:p,cropAreaStyle:g,mediaStyle:v},classes:{containerClassName:b,cropAreaClassName:x,mediaClassName:w}}=this.props,k=(e=this.state.mediaObjectFit)!==null&&e!==void 0?e:this.getObjectFit();return y.createElement("div",{onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart,ref:S=>this.containerRef=S,"data-testid":"container",style:p,className:UV("reactEasyCrop_Container",b)},n?y.createElement("img",Tc(Tc({alt:"",className:UV("reactEasyCrop_Image",k==="contain"&&"reactEasyCrop_Contain",k==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",k==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",w)},s),{},{src:n,ref:this.imageRef,style:Tc(Tc({},v),{},{transform:o||`translate(${l}px, ${c}px) rotate(${d}deg) scale(${u})`}),onLoad:this.onMediaLoad})):r&&y.createElement("video",Tc(Tc({autoPlay:!0,playsInline:!0,loop:!0,muted:!0,className:UV("reactEasyCrop_Video",k==="contain"&&"reactEasyCrop_Contain",k==="horizontal-cover"&&"reactEasyCrop_Cover_Horizontal",k==="vertical-cover"&&"reactEasyCrop_Cover_Vertical",w)},s),{},{ref:this.videoRef,onLoadedMetadata:this.onMediaLoad,style:Tc(Tc({},v),{},{transform:o||`translate(${l}px, ${c}px) rotate(${d}deg) scale(${u})`}),controls:!1}),(Array.isArray(r)?r:[{src:r}]).map(S=>y.createElement("source",Tc({key:S.src},S)))),this.state.cropSize&&y.createElement("div",Tc({ref:this.cropperRef,style:Tc(Tc({},g),{},{width:f?Math.round(this.state.cropSize.width):this.state.cropSize.width,height:f?Math.round(this.state.cropSize.height):this.state.cropSize.height}),tabIndex:0,onKeyDown:this.onKeyDown,onKeyUp:this.onKeyUp,"data-testid":"cropper",className:UV("reactEasyCrop_CropArea",h==="round"&&"reactEasyCrop_CropAreaRound",m&&"reactEasyCrop_CropAreaGrid",x)},i)))}};Sse.defaultProps={zoom:1,rotation:0,aspect:4/3,maxZoom:exr,minZoom:Xbr,cropShape:"rect",objectFit:"contain",showGrid:!0,style:{},classes:{},mediaProps:{},cropperProps:{},zoomSpeed:1,restrictPosition:!0,zoomWithScroll:!0,keyboardStep:txr};Sse.getMousePoint=t=>({x:Number(t.clientX),y:Number(t.clientY)});Sse.getTouchPoint=t=>({x:Number(t.clientX),y:Number(t.clientY)});var nxr=Sse,w_t=["PageUp","PageDown"],k_t=["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"],S_t={"from-left":["Home","PageDown","ArrowDown","ArrowLeft"],"from-right":["Home","PageDown","ArrowDown","ArrowRight"],"from-bottom":["Home","PageDown","ArrowDown","ArrowLeft"],"from-top":["Home","PageDown","ArrowUp","ArrowLeft"]},AM="Slider",[A0e,rxr,sxr]=lI(AM),[C_t,yjs]=il(AM,[sxr]),[ixr,Cse]=C_t(AM),j_t=y.forwardRef((t,e)=>{const{name:n,min:r=0,max:s=100,step:i=1,orientation:o="horizontal",disabled:l=!1,minStepsBetweenThumbs:c=0,defaultValue:d=[r],value:u,onValueChange:h=()=>{},onValueCommit:m=()=>{},inverted:f=!1,form:p,...g}=t,v=y.useRef(new Set),b=y.useRef(0),w=o==="horizontal"?axr:oxr,[k=[],S]=Sd({prop:u,defaultProp:d,onChange:_=>{var R;(R=[...v.current][b.current])==null||R.focus(),h(_)}}),C=y.useRef(k);function j(_){const T=hxr(k,_);A(_,T)}function E(_){A(_,b.current)}function N(){const _=C.current[b.current];k[b.current]!==_&&m(k)}function A(_,T,{commit:R}={commit:!1}){const O=gxr(i),F=vxr(Math.round((_-r)/i)*i+r,O),D=eF(F,[r,s]);S((I=[])=>{const P=dxr(I,D,T);if(pxr(P,c*i)){b.current=P.indexOf(D);const M=String(P)!==String(I);return M&&R&&m(P),M?P:I}else return I})}return a.jsx(ixr,{scope:t.__scopeSlider,name:n,disabled:l,min:r,max:s,valueIndexToChangeRef:b,thumbs:v.current,values:k,orientation:o,form:p,children:a.jsx(A0e.Provider,{scope:t.__scopeSlider,children:a.jsx(A0e.Slot,{scope:t.__scopeSlider,children:a.jsx(w,{"aria-disabled":l,"data-disabled":l?"":void 0,...g,ref:e,onPointerDown:Kt(g.onPointerDown,()=>{l||(C.current=k)}),min:r,max:s,inverted:f,onSlideStart:l?void 0:j,onSlideMove:l?void 0:E,onSlideEnd:l?void 0:N,onHomeKeyDown:()=>!l&&A(r,0,{commit:!0}),onEndKeyDown:()=>!l&&A(s,k.length-1,{commit:!0}),onStepKeyDown:({event:_,direction:T})=>{if(!l){const F=w_t.includes(_.key)||_.shiftKey&&k_t.includes(_.key)?10:1,D=b.current,I=k[D],P=i*F*T;A(I+P,D,{commit:!0})}}})})})})});j_t.displayName=AM;var[E_t,N_t]=C_t(AM,{startEdge:"left",endEdge:"right",size:"width",direction:1}),axr=y.forwardRef((t,e)=>{const{min:n,max:r,dir:s,inverted:i,onSlideStart:o,onSlideMove:l,onSlideEnd:c,onStepKeyDown:d,...u}=t,[h,m]=y.useState(null),f=Sr(e,w=>m(w)),p=y.useRef(void 0),g=ES(s),v=g==="ltr",b=v&&!i||!v&&i;function x(w){const k=p.current||h.getBoundingClientRect(),S=[0,k.width],j=wPe(S,b?[n,r]:[r,n]);return p.current=k,j(w-k.left)}return a.jsx(E_t,{scope:t.__scopeSlider,startEdge:b?"left":"right",endEdge:b?"right":"left",direction:b?1:-1,size:"width",children:a.jsx(T_t,{dir:g,"data-orientation":"horizontal",...u,ref:f,style:{...u.style,"--radix-slider-thumb-transform":"translateX(-50%)"},onSlideStart:w=>{const k=x(w.clientX);o==null||o(k)},onSlideMove:w=>{const k=x(w.clientX);l==null||l(k)},onSlideEnd:()=>{p.current=void 0,c==null||c()},onStepKeyDown:w=>{const S=S_t[b?"from-left":"from-right"].includes(w.key);d==null||d({event:w,direction:S?-1:1})}})})}),oxr=y.forwardRef((t,e)=>{const{min:n,max:r,inverted:s,onSlideStart:i,onSlideMove:o,onSlideEnd:l,onStepKeyDown:c,...d}=t,u=y.useRef(null),h=Sr(e,u),m=y.useRef(void 0),f=!s;function p(g){const v=m.current||u.current.getBoundingClientRect(),b=[0,v.height],w=wPe(b,f?[r,n]:[n,r]);return m.current=v,w(g-v.top)}return a.jsx(E_t,{scope:t.__scopeSlider,startEdge:f?"bottom":"top",endEdge:f?"top":"bottom",size:"height",direction:f?1:-1,children:a.jsx(T_t,{"data-orientation":"vertical",...d,ref:h,style:{...d.style,"--radix-slider-thumb-transform":"translateY(50%)"},onSlideStart:g=>{const v=p(g.clientY);i==null||i(v)},onSlideMove:g=>{const v=p(g.clientY);o==null||o(v)},onSlideEnd:()=>{m.current=void 0,l==null||l()},onStepKeyDown:g=>{const b=S_t[f?"from-bottom":"from-top"].includes(g.key);c==null||c({event:g,direction:b?-1:1})}})})}),T_t=y.forwardRef((t,e)=>{const{__scopeSlider:n,onSlideStart:r,onSlideMove:s,onSlideEnd:i,onHomeKeyDown:o,onEndKeyDown:l,onStepKeyDown:c,...d}=t,u=Cse(AM,n);return a.jsx(Sn.span,{...d,ref:e,onKeyDown:Kt(t.onKeyDown,h=>{h.key==="Home"?(o(h),h.preventDefault()):h.key==="End"?(l(h),h.preventDefault()):w_t.concat(k_t).includes(h.key)&&(c(h),h.preventDefault())}),onPointerDown:Kt(t.onPointerDown,h=>{const m=h.target;m.setPointerCapture(h.pointerId),h.preventDefault(),u.thumbs.has(m)?m.focus():r(h)}),onPointerMove:Kt(t.onPointerMove,h=>{h.target.hasPointerCapture(h.pointerId)&&s(h)}),onPointerUp:Kt(t.onPointerUp,h=>{const m=h.target;m.hasPointerCapture(h.pointerId)&&(m.releasePointerCapture(h.pointerId),i(h))})})}),__t="SliderTrack",A_t=y.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=Cse(__t,n);return a.jsx(Sn.span,{"data-disabled":s.disabled?"":void 0,"data-orientation":s.orientation,...r,ref:e})});A_t.displayName=__t;var P0e="SliderRange",P_t=y.forwardRef((t,e)=>{const{__scopeSlider:n,...r}=t,s=Cse(P0e,n),i=N_t(P0e,n),o=y.useRef(null),l=Sr(e,o),c=s.values.length,d=s.values.map(m=>M_t(m,s.min,s.max)),u=c>1?Math.min(...d):0,h=100-Math.max(...d);return a.jsx(Sn.span,{"data-orientation":s.orientation,"data-disabled":s.disabled?"":void 0,...r,ref:l,style:{...t.style,[i.startEdge]:u+"%",[i.endEdge]:h+"%"}})});P_t.displayName=P0e;var R0e="SliderThumb",R_t=y.forwardRef((t,e)=>{const n=rxr(t.__scopeSlider),[r,s]=y.useState(null),i=Sr(e,l=>s(l)),o=y.useMemo(()=>r?n().findIndex(l=>l.ref.current===r):-1,[n,r]);return a.jsx(lxr,{...t,ref:i,index:o})}),lxr=y.forwardRef((t,e)=>{const{__scopeSlider:n,index:r,name:s,...i}=t,o=Cse(R0e,n),l=N_t(R0e,n),[c,d]=y.useState(null),u=Sr(e,x=>d(x)),h=c?o.form||!!c.closest("form"):!0,m=z8(c),f=o.values[r],p=f===void 0?0:M_t(f,o.min,o.max),g=uxr(r,o.values.length),v=m==null?void 0:m[l.size],b=v?mxr(v,p,l.direction):0;return y.useEffect(()=>{if(c)return o.thumbs.add(c),()=>{o.thumbs.delete(c)}},[c,o.thumbs]),a.jsxs("span",{style:{transform:"var(--radix-slider-thumb-transform)",position:"absolute",[l.startEdge]:`calc(${p}% + ${b}px)`},children:[a.jsx(A0e.ItemSlot,{scope:t.__scopeSlider,children:a.jsx(Sn.span,{role:"slider","aria-label":t["aria-label"]||g,"aria-valuemin":o.min,"aria-valuenow":f,"aria-valuemax":o.max,"aria-orientation":o.orientation,"data-orientation":o.orientation,"data-disabled":o.disabled?"":void 0,tabIndex:o.disabled?void 0:0,...i,ref:u,style:f===void 0?{display:"none"}:t.style,onFocus:Kt(t.onFocus,()=>{o.valueIndexToChangeRef.current=r})})}),h&&a.jsx(I_t,{name:s??(o.name?o.name+(o.values.length>1?"[]":""):void 0),form:o.form,value:f},r)]})});R_t.displayName=R0e;var cxr="RadioBubbleInput",I_t=y.forwardRef(({__scopeSlider:t,value:e,...n},r)=>{const s=y.useRef(null),i=Sr(s,r),o=i7(e);return y.useEffect(()=>{const l=s.current;if(!l)return;const c=window.HTMLInputElement.prototype,u=Object.getOwnPropertyDescriptor(c,"value").set;if(o!==e&&u){const h=new Event("input",{bubbles:!0});u.call(l,e),l.dispatchEvent(h)}},[o,e]),a.jsx(Sn.input,{style:{display:"none"},...n,ref:i,defaultValue:e})});I_t.displayName=cxr;function dxr(t=[],e,n){const r=[...t];return r[n]=e,r.sort((s,i)=>s-i)}function M_t(t,e,n){const i=100/(n-e)*(t-e);return eF(i,[0,100])}function uxr(t,e){return e>2?`Value ${t+1} of ${e}`:e===2?["Minimum","Maximum"][t]:void 0}function hxr(t,e){if(t.length===1)return 0;const n=t.map(s=>Math.abs(s-e)),r=Math.min(...n);return n.indexOf(r)}function mxr(t,e,n){const r=t/2,i=wPe([0,50],[0,r]);return(r-i(e)*n)*n}function fxr(t){return t.slice(0,-1).map((e,n)=>t[n+1]-e)}function pxr(t,e){if(e>0){const n=fxr(t);return Math.min(...n)>=e}return!0}function wPe(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function gxr(t){return(String(t).split(".")[1]||"").length}function vxr(t,e){const n=Math.pow(10,e);return Math.round(t*n)/n}var L_t=j_t,yxr=A_t,bxr=P_t,xxr=R_t;const D_t=y.forwardRef(({className:t,...e},n)=>a.jsxs(L_t,{ref:n,className:ee("relative flex w-full touch-none select-none items-center",t),...e,children:[a.jsx(yxr,{className:"relative h-2 w-full grow overflow-hidden rounded-full bg-secondary",children:a.jsx(bxr,{className:"absolute h-full bg-primary"})}),a.jsx(xxr,{className:"block h-5 w-5 rounded-full border-2 border-primary bg-background ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50"})]}));D_t.displayName=L_t.displayName;function wxr(t){return new Promise((e,n)=>{const r=new Image;r.addEventListener("load",()=>e(r)),r.addEventListener("error",()=>n(new Error("Could not load image"))),r.src=t})}async function kxr(t,e,n,r="image/jpeg",s){const i=await wxr(t),o=document.createElement("canvas"),l=s&&e.width>s?s/e.width:1;o.width=Math.max(1,Math.round(e.width*l)),o.height=Math.max(1,Math.round(e.height*l));const c=o.getContext("2d");if(!c)throw new Error("Canvas is not supported");r==="image/jpeg"&&(c.fillStyle="#ffffff",c.fillRect(0,0,o.width,o.height)),c.drawImage(i,e.x,e.y,e.width,e.height,0,0,o.width,o.height);const d=await new Promise(m=>o.toBlob(m,r,.92));if(!d)throw new Error("Could not crop image");const u=r==="image/png"?".png":".jpg",h=n.replace(/\.[^./\\]+$/,"")||"image";return new File([d],`${h}${u}`,{type:r})}function Nh({file:t,aspect:e,title:n="Adjust your image",cropShape:r="rect",maxWidth:s,aspectOptions:i,onAspectChange:o,keepPng:l=!1,onCancel:c,onCropped:d}){const[u,h]=y.useState(e),[m,f]=y.useState(null),[p,g]=y.useState({x:0,y:0}),[v,b]=y.useState(1),[x,w]=y.useState(null),[k,S]=y.useState(!1),[C,j]=y.useState("");y.useEffect(()=>{if(!t){f(null);return}const A=URL.createObjectURL(t);return f(A),g({x:0,y:0}),b(1),w(null),j(""),h(e),()=>URL.revokeObjectURL(A)},[t]);const E=y.useCallback((A,_)=>{w(_)},[]),N=async()=>{if(!(!t||!m||!x)){S(!0),j("");try{const A=l&&t.type==="image/png"?"image/png":"image/jpeg",_=await kxr(m,x,t.name,A,s);d(_)}catch{j("Couldn't crop this image. Try another one.")}finally{S(!1)}}};return a.jsx(Bt,{open:!!t,onOpenChange:A=>!A&&c(),children:a.jsxs(Ft,{className:"max-w-lg",children:[a.jsx(Vt,{children:a.jsx(Ut,{children:n})}),i&&i.length>1&&a.jsx("div",{role:"radiogroup","aria-label":"Crop shape",className:"flex flex-wrap gap-1.5",children:i.map(A=>{const _=Math.abs(A.value-u)<.001;return a.jsx("button",{type:"button",role:"radio","aria-checked":_,onClick:()=>{h(A.value),o==null||o(A.value)},className:ee("rounded-md border px-2.5 py-1 text-xs font-medium transition-colors",_?"border-primary bg-primary/5 text-foreground":"border-border text-muted-foreground hover:border-primary/40 hover:text-foreground"),children:A.label},A.label)})}),a.jsx("div",{className:"relative h-72 w-full overflow-hidden rounded-lg bg-muted",children:m&&a.jsx(nxr,{image:m,crop:p,zoom:v,aspect:u,cropShape:r,showGrid:r==="rect",onCropChange:g,onZoomChange:b,onCropComplete:E})}),a.jsxs("div",{className:"flex items-center gap-3 px-1",children:[a.jsx(E9t,{className:"h-4 w-4 text-muted-foreground shrink-0"}),a.jsx(D_t,{value:[v],min:1,max:3,step:.01,onValueChange:A=>b(A[0]),"aria-label":"Zoom"})]}),C&&a.jsx("p",{role:"alert",className:"px-1 text-xs font-medium text-destructive",children:C}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"outline",onClick:c,disabled:k,children:"Cancel"}),a.jsx(Z,{onClick:N,disabled:k||!x,children:k?"Applying…":"Apply"})]})]})})}const _T=5,Sxr=50*1024*1024;async function Cxr(t,e,n,r,s){const i=await SEt(t,e,n,r,s);if(i.length!==n.length)throw new Error("Upload did not return a URL");return i}const IHe="inline-flex cursor-pointer items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground hover:bg-muted transition-colors";function MHe(t,e,n){const r=t.filter(s=>{var i,o;return((i=s.label)==null?void 0:i.trim())||((o=s.url)==null?void 0:o.trim())}).map(s=>{var i,o;return[((i=s.label)==null?void 0:i.trim())??"",((o=s.url)==null?void 0:o.trim())??"",s.position??"bottom"]});return JSON.stringify([r,e.trim(),n.trim()])}function $_t({realId:t,onOpenChange:e,onSaved:n}){var Le,Ye,st,nt,Je,Rt,Qt,Jt;const{toast:r}=yt(),{community:s}=qe(),{groups:i}=Ln(),o=t!==null,[l,c]=y.useState(null),[d,u]=y.useState(""),[h,m]=y.useState(aP),[f,p]=y.useState(!1),[g,v]=y.useState(!1),[b,x]=y.useState(""),[w,k]=y.useState(""),[S,C]=y.useState(0),j=y.useRef(!1),E=y.useRef(null),N=yse(E),A=WTt({open:o,title:b,setTitle:x,titleMaxLength:dd,insertIntoBody:Qe=>{var Lt;return(Lt=E.current)==null?void 0:Lt.insertText(Qe)}}),_=y.useCallback(Qe=>{var xr;const Lt=((xr=E.current)==null?void 0:xr.readMarkdown())??"",Xt=Lt.trim().length;C(Xt),u(Lt),(Qe??Xt)<fa&&(j.current=!1)},[]),T=y.useCallback(()=>{j.current||(j.current=!0,r({title:`Description must be ${fa} characters or fewer`,variant:"destructive"}))},[r]),R=()=>{var Qe;return(((Qe=E.current)==null?void 0:Qe.readMarkdown())??w).trim()},O=y.useRef(null),[F,D]=y.useState(new Set),[I,P]=y.useState(new Set),[M,z]=y.useState(!1),[G,B]=y.useState([{...nx}]),[H,W]=y.useState(""),[V,U]=y.useState(""),[ne,te]=y.useState(!1),re=y.useRef(""),[fe,le]=y.useState(!1),[q,Y]=y.useState(null),[X,Q]=y.useState(null),[ie,he]=y.useState([]),[ye,J]=y.useState([]),[K,ce]=y.useState(!1),[pe,Ie]=y.useState(!1),[Me,we]=y.useState(null),[Be,Ve]=y.useState(null),[be,Ze]=y.useState(""),Pe=y.useRef(""),Ke=y.useRef(new Map),[De,xt]=y.useState(null),Xe=y.useRef(null);y.useEffect(()=>{if(!t)return;let Qe=!0;return p(!0),c(null),GZ(t).then(Lt=>{var oa;if(!Qe)return;const Xt=Lt.post;c(Xt),x(Xt.title??"");const xr=v0e(Xt.description??"");k(xr),u(xr),m({url:((oa=Xt.linkPreview)==null?void 0:oa.url)??null,hidden:Xt.linkPreviewHidden===!0}),C(xr.trim().length),D(new Set),P(new Set),z(!1);const Ls=(Xt.buttons??[]).map(la=>({label:la.label??"",url:la.url??"",position:la.position==="top"?"top":"bottom"}));B(Ls.length?Ls:[{...nx}]),W(Xt.embedCode??""),U(Xt.embedCodeHeight??""),re.current=MHe(Ls,Xt.embedCode??"",Xt.embedCodeHeight??""),te(Ls.length>0||!!Xt.embedCode),le(!1),Y(null),he([]),J([]),we(null),Ve(null);const xi=Xt.scheduledPublishAt&&new Date(Xt.scheduledPublishAt).getTime()>Date.now()?t9(new Date(Xt.scheduledPublishAt)):"";Ze(xi),Pe.current=xi,Ke.current=new Map,O.current=null}).catch(()=>{Qe&&(r({title:"Couldn't load the post to edit",variant:"destructive"}),e(!1))}).finally(()=>Qe&&p(!1)),()=>{Qe=!1}},[t,e,r]),y.useEffect(()=>{l&&!f&&O.current===null&&E.current&&(O.current=E.current.readMarkdown().trim(),C(O.current.length))},[l,f,w]);const tt=l!=null&&l.group?typeof l.group=="string"?l.group:l.group.id:"",$e=(l!=null&&l.community?typeof l.community=="string"?l.community:l.community.id:"")||(s==null?void 0:s.id)||"",wt=l!=null&&l.tab?typeof l.tab=="string"?l.tab:l.tab.id:"",Ee=!!(tt&&wt),Ge=`${tt}:${wt}`,Pt=(Le=l==null?void 0:l.createdBy)==null?void 0:Le.id,vn=!!Pt&&Pt!==((Ye=ro())==null?void 0:Ye.id),Hn=y.useMemo(()=>{var oa,la;const Qe=$i=>{var $l;const al=($l=i.find(ou=>ou.id===$i))==null?void 0:$l.myRole;return al==="admin"||al==="moderator"},Lt=EN(i).filter($i=>!vn||Qe($i.groupId));if(!Ee||Lt.some($i=>$i.id===Ge))return Lt;const Xt=i.find($i=>$i.id===tt),xr=(oa=Xt==null?void 0:Xt.tabs)==null?void 0:oa.find($i=>$i.id===wt),Ls=(Xt==null?void 0:Xt.name)??(typeof(l==null?void 0:l.group)=="object"?(la=l.group)==null?void 0:la.name:"")??"Current group",xi=(xr==null?void 0:xr.name)??"Current section";return[{id:Ge,label:`${Ls} · ${xi}`,groupId:tt,tabId:wt,groupName:Ls,tabName:xi,tabEmoji:(xr==null?void 0:xr.emoji)||void 0,canPost:!0},...Lt]},[i,Ee,Ge,tt,wt,l,vn]),[yr,br]=y.useState("");y.useEffect(()=>br(Ee?Ge:""),[Ee,Ge]);const Yt=Hn.find(Qe=>Qe.id===yr),nr=!!Yt&&yr!==Ge,Kn=(st=i.find(Qe=>Qe.id===tt))==null?void 0:st.myRole,ms=(s==null?void 0:s.myRole)==="admin"||!!(s!=null&&s.isByMe)||Kn==="admin"||Kn==="moderator",is=y.useMemo(()=>G.map(u_t),[G]),ke=ms&&MHe(G,H,V)!==re.current,at=((l==null?void 0:l.images)??[]).filter(Qe=>Qe&&!F.has(Qe)),Tt=((l==null?void 0:l.videos)??[]).filter(Qe=>Qe&&!I.has(Qe)),An=!!(l!=null&&l.document)&&!M&&!Be,Pn=at.length+ie.length+ye.length,yn=y.useMemo(()=>l?Am(l,0):null,[l]),Is=Tt.length===0&&!Me,js=!!(l!=null&&l.scheduledPublishAt&&new Date(l.scheduledPublishAt).getTime()>Date.now()),Gt=Qe=>{const Lt=Qe.filter(xr=>xr.type.startsWith("image/"));if(!Lt.length)return;const Xt=_T-Pn;if(Xt<=0){r({title:"Image limit reached",description:`You can add up to ${_T} images in total.`,variant:"destructive"});return}Lt.length>Xt&&r({title:"Some images weren't added",description:`Only ${_T} images are allowed in total.`}),he(xr=>[...xr,...Lt.slice(0,Xt).map(Ls=>({file:Ls,preview:URL.createObjectURL(Ls)}))])},lr=async(Qe,Lt,Xt,xr)=>{const Ls=Lt.filter(xi=>!Ke.current.has(xi));if(Ls.length){const xi=await Cxr($e,Qe,Ls,Xt,xr);Ls.forEach((oa,la)=>Ke.current.set(oa,xi[la]))}return Lt.map(xi=>Ke.current.get(xi))},ct=async()=>{const Qe=new AbortController;Xe.current=Qe;const Lt=new Map,Xt=(xr,Ls)=>{const xi=Ls.filter(oa=>!Ke.current.has(oa)).reduce((oa,la)=>oa+(la.size||1),0);return xi?(Lt.set(xr,{bytes:xi,percent:0}),xt(0),lr(xr,Ls,oa=>{Lt.set(xr,{bytes:xi,percent:oa});let la=0,$i=0;for(const al of Lt.values())la+=al.bytes,$i+=al.bytes*al.percent/100;xt(Math.min(100,Math.round($i*100/la)))},Qe.signal)):lr(xr,Ls)};try{return await Promise.all([Xt("image",ie.map(xr=>xr.file)),Xt("video",Me?[Me]:[]),Xt("document",Be?[Be]:[]),Xt("banner",q?[q.file]:[])])}catch(xr){throw Qe.abort(),xr}finally{Xe.current=null,xt(null)}},Bn=()=>{const Qe=O.current??v0e((l==null?void 0:l.description)??"").trim();return b.trim()!==((l==null?void 0:l.title)??"").trim()||R()!==Qe||F.size>0||I.size>0||M||fe||!!q||ie.length>0||ye.length>0||!!(Me||Be)||ke},Ms=async Qe=>{if(!(!l||!t)){v(!0);try{const Lt=await p0e($e,t,Qe.groupId,Qe.tabId);r({title:"Post moved",description:`It is now in ${Qe.label}.`}),n(Lt.post??l),e(!1)}catch(Lt){const Xt=Lt instanceof ze?Dt(Lt.body,Lt.message):"Please try again.";r({title:"Couldn't move the post",description:`It is still in its original place. ${Xt}`,variant:"destructive"})}finally{v(!1)}}},Ue=async(Qe=!1)=>{if(!l||!t||!Ee)return;if(nr&&Yt&&!Qe&&be===Pe.current&&!Bn())return Ms(Yt);if(js&&!Qe&&be.trim()&&!xPe(be)){r({title:"Pick a time in the future",description:"Choose when this post should go out, or publish it now.",variant:"destructive"});return}if(ke&&is.some(Boolean)){te(!0),r({title:"Check your custom buttons",description:"Each button needs a label and a valid http(s) link.",variant:"destructive"});return}const Lt=R();if(b.trim().length>dd){r({title:`Title must be ${dd} characters or fewer`,variant:"destructive"});return}if(Lt.length>fa){r({title:`Description must be ${fa} characters or fewer`,variant:"destructive"});return}const Xt={title:b.trim(),description:Lt,removedImageUrls:[...F],removedVideoUrls:[...I],removeDocument:M,removeBanner:fe&&!q,...ke?{buttons:h_t(G),embedCode:H.trim(),embedCodeHeight:H.trim()?V.trim()||"400":""}:{},...js&&be.trim()?{scheduledPublishAt:new Date(be).toISOString()}:{},...Qe?{publishNow:!0}:{}},xr=ie.length>0||ye.length>0||!!(Me||Be||q);if(!xr&&!qvr(cHe(l,Xt),l)){r({title:"Nothing to save",description:"Add a title, some text, or an attachment — a post can't be empty.",variant:"destructive"});return}if(xr&&!$e){r({title:"Couldn't upload the new media",description:"Reload the page and try again.",variant:"destructive"});return}v(!0);try{const[Ls,xi,oa,la]=await ct(),$i=cHe(l,{...Xt,addedImageUrls:[...Ls,...ye],addedVideoUrls:xi,newDocumentUrl:oa[0],newBannerUrl:la[0]}),al={...$i,...qZ(h,$i.description)};let ou=(await Mvr(t,al)).post,Ih="";if(nr&&Yt)try{ou=(await p0e($e,t,Yt.groupId,Yt.tabId)).post??ou}catch(av){Ih=av instanceof ze?Dt(av.body,av.message):"Please try again."}r(Ih?{title:"Post updated, but not moved",description:`It is still in its original place. ${Ih}`,variant:"destructive"}:nr&&Yt?{title:"Post updated and moved",description:`It is now in ${Yt.label}.`}:Qe?{title:"Post published",description:"It is now live in its section."}:js&&be.trim()?{title:"Post rescheduled",description:`It now goes out on ${vd(be)}.`}:{title:"Post updated"}),n(ou),e(!1)}catch(Ls){if(kg(Ls)){r({title:"Upload cancelled",description:"Nothing was saved. Your changes are still here."});return}const xi=Ls instanceof ze?Dt(Ls.body,Ls.message):"Something went wrong. Please try again.";r({title:"Couldn't update the post",description:xi,variant:"destructive"})}finally{v(!1)}},et=()=>{l&&(nr||Bn())&&!g&&!window.confirm("Discard your changes?")||e(!1)};return a.jsxs(a.Fragment,{children:[a.jsx(Bt,{open:o,onOpenChange:Qe=>!Qe&&et(),children:a.jsxs(Ft,{className:"flex max-h-[min(90vh,880px)] min-w-0 flex-col gap-0 overflow-hidden p-0 sm:max-w-lg",children:[a.jsx(Vt,{className:"shrink-0 border-b border-border px-6 pb-4 pt-6",children:a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-2 pr-8",children:[a.jsxs(Ut,{className:"flex items-center gap-2.5",children:[a.jsx(WAe,{variant:"edit"}),"Edit post",Ee&&Hn.length>0?" in":""]}),Ee&&Hn.length>0&&a.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsxs("button",{type:"button",disabled:g||Hn.length<2,"aria-label":`Post location: ${(Yt==null?void 0:Yt.label)??"select a channel"}`,className:"inline-flex min-w-0 max-w-[16rem] items-center gap-1.5 rounded-full bg-muted px-3 py-1.5 text-sm font-medium text-foreground transition-colors hover:bg-muted/80 disabled:opacity-70",children:[a.jsx("span",{className:"truncate",children:(Yt==null?void 0:Yt.label)??"Select channel"}),Hn.length>1&&a.jsx(li,{className:"h-3.5 w-3.5 shrink-0"})]})}),a.jsxs(Cr,{align:"end",className:"themed-scrollbar max-h-72 w-72 overflow-y-auto",children:[a.jsx(FR,{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Move to"}),ZAe(Hn).map((Qe,Lt)=>a.jsxs("div",{children:[Lt>0&&a.jsx(mi,{}),a.jsx(FR,{className:"truncate text-xs font-semibold text-foreground",children:Qe.groupName}),Qe.destinations.map(Xt=>a.jsxs(ot,{onClick:()=>br(Xt.id),className:ee("gap-2 pl-4",yr===Xt.id&&"bg-accent"),children:[a.jsx("span",{className:"w-4 shrink-0 text-center text-muted-foreground",children:Xt.tabEmoji||"#"}),a.jsx("span",{className:"truncate",children:Xt.tabName}),Xt.id===Ge&&a.jsx("span",{className:"ml-auto shrink-0 text-[10px] text-muted-foreground",children:"Current"})]},Xt.id))]},Qe.groupId))]})]}),a.jsxs(gn,{label:"Post location",children:["Where this post lives. Pick another group or section you can post in and Save: the post moves there with its comments and reactions. Nothing moves until you save.",vn?" This is someone else's post, so only groups you are an admin or moderator of are listed.":""]})]})]})}),a.jsx("div",{className:"themed-scrollbar min-h-0 min-w-0 flex-1 overflow-y-auto overflow-x-hidden px-6 py-4",children:f?a.jsx("div",{className:"flex items-center justify-center py-12 text-muted-foreground",children:a.jsx(Ne,{className:"h-5 w-5 animate-spin"})}):l?Ee?a.jsxs("div",{ref:N.wrapRef,className:"min-w-0 space-y-4",children:[a.jsx("input",{...A.titleProps,type:"text",placeholder:"Post title (optional)",value:b,maxLength:dd,onChange:Qe=>x(Qe.target.value),"aria-invalid":b.length>dd||void 0,className:ee("w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/30",b.length>dd&&"border-destructive focus:ring-destructive/30")}),a.jsxs("p",{className:ee("-mt-2 text-right text-xs text-muted-foreground",b.length>dd&&"text-destructive"),children:[b.length,"/",dd]}),N.menu,a.jsx("div",{...A.bodyProps,children:a.jsx(Du,{ref:E,placeholder:"Write something…",value:w,onChange:k,...N.editorProps,highlightMentions:!0,deferMarkdownSync:!0,plainTextPaste:!0,markdownBreaks:!0,maxLength:fa,onCharacterCountChange:_,onLimitExceeded:T,onImageFiles:Gt,className:"min-w-0 max-w-full overflow-hidden",editorClassName:"break-words [overflow-wrap:anywhere]"})}),a.jsx("div",{className:"-mt-2 flex justify-end",children:a.jsxs("p",{className:ee("text-right text-xs text-muted-foreground",S>fa&&"text-destructive"),children:[S,"/",fa]})}),l&&a.jsx(mPe,{text:d,initial:{url:((nt=l.linkPreview)==null?void 0:nt.url)??null,hidden:l.linkPreviewHidden===!0},onChange:m},l.id),Pn>0&&a.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[at.map(Qe=>a.jsxs("div",{className:"relative rounded-lg overflow-hidden border border-border",children:[a.jsx("img",{src:Qe,alt:"",className:"h-20 w-full object-cover"}),a.jsx("button",{type:"button","aria-label":"Remove image",onClick:()=>D(Lt=>new Set(Lt).add(Qe)),className:"absolute top-1 right-1 h-5 w-5 rounded-full bg-foreground/70 flex items-center justify-center hover:bg-foreground/90 transition-colors",children:a.jsx(nn,{className:"h-3 w-3 text-background"})})]},Qe)),ye.map((Qe,Lt)=>a.jsxs("div",{className:"relative rounded-lg overflow-hidden border border-border",children:[a.jsx("img",{src:Qe,alt:"",className:"h-20 w-full object-cover"}),a.jsx("button",{type:"button","aria-label":"Remove GIF",onClick:()=>J(Xt=>Xt.filter((xr,Ls)=>Ls!==Lt)),className:"absolute top-1 right-1 h-5 w-5 rounded-full bg-foreground/70 flex items-center justify-center hover:bg-foreground/90 transition-colors",children:a.jsx(nn,{className:"h-3 w-3 text-background"})})]},`${Qe}-${Lt}`)),ie.map(Qe=>a.jsxs("div",{className:"relative rounded-lg overflow-hidden border border-border",children:[a.jsx("img",{src:Qe.preview,alt:"",className:"h-20 w-full object-cover"}),a.jsx("button",{type:"button","aria-label":"Remove image",onClick:()=>{URL.revokeObjectURL(Qe.preview),he(Lt=>Lt.filter(Xt=>Xt!==Qe))},className:"absolute top-1 right-1 h-5 w-5 rounded-full bg-foreground/70 flex items-center justify-center hover:bg-foreground/90 transition-colors",children:a.jsx(nn,{className:"h-3 w-3 text-background"})})]},Qe.preview))]}),Tt.map(Qe=>a.jsx("div",{className:"relative rounded-lg border border-border bg-muted p-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ca,{className:"h-5 w-5 text-primary"}),a.jsx("span",{className:"text-sm text-foreground truncate flex-1",children:"Video attachment"}),a.jsx("button",{type:"button","aria-label":"Remove video",onClick:()=>P(Lt=>new Set(Lt).add(Qe)),className:"h-6 w-6 rounded-full bg-foreground/70 flex items-center justify-center hover:bg-foreground/90 transition-colors",children:a.jsx(nn,{className:"h-3 w-3 text-background"})})]})},Qe)),Me&&a.jsx("div",{className:"relative rounded-lg border border-border bg-muted p-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ca,{className:"h-5 w-5 text-primary"}),a.jsx("span",{className:"text-sm text-foreground truncate flex-1",children:Me.name}),a.jsx("button",{type:"button","aria-label":"Remove video",onClick:()=>we(null),className:"h-6 w-6 rounded-full bg-foreground/70 flex items-center justify-center hover:bg-foreground/90 transition-colors",children:a.jsx(nn,{className:"h-3 w-3 text-background"})})]})}),Be&&a.jsx("div",{className:"relative rounded-lg border border-border bg-muted p-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ei,{className:"h-5 w-5 text-destructive"}),a.jsx("span",{className:"text-sm text-foreground truncate flex-1",children:Be.name}),a.jsx("button",{type:"button","aria-label":"Remove document",onClick:()=>Ve(null),className:"h-6 w-6 rounded-full bg-foreground/70 flex items-center justify-center hover:bg-foreground/90 transition-colors",children:a.jsx(nn,{className:"h-3 w-3 text-background"})})]})}),An&&a.jsx("div",{className:"relative rounded-lg border border-border bg-muted p-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ei,{className:"h-5 w-5 text-destructive"}),a.jsx("span",{className:"text-sm text-foreground truncate flex-1",children:l.documentName||"Document"}),a.jsx("button",{type:"button","aria-label":"Remove document",onClick:()=>z(!0),className:"h-6 w-6 rounded-full bg-foreground/70 flex items-center justify-center hover:bg-foreground/90 transition-colors",children:a.jsx(nn,{className:"h-3 w-3 text-background"})})]})}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[Pn<_T&&a.jsxs("label",{className:"inline-flex cursor-pointer items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground hover:bg-muted transition-colors",children:[a.jsx(jy,{className:"h-3.5 w-3.5"}),"Add images",a.jsx("input",{type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:Qe=>{Gt(Array.from(Qe.target.files??[])),Qe.target.value=""}})]}),Pn<_T&&a.jsxs(Ni,{open:K,onOpenChange:ce,modal:!1,children:[a.jsx(Ti,{asChild:!0,children:a.jsx("button",{type:"button",className:IHe,"aria-label":"Add GIF",children:"GIF"})}),a.jsx(yi,{align:"start",side:"top",className:"z-[100] w-auto p-2",onWheel:Qe=>Qe.stopPropagation(),children:a.jsx(CM,{onPick:Qe=>{J(Lt=>[...Lt,Qe]),ce(!1)}})})]}),a.jsxs(Ni,{open:pe,onOpenChange:Ie,modal:!1,children:[a.jsx(Ti,{asChild:!0,children:a.jsxs("button",{type:"button",className:IHe,"aria-label":"Add emoji",children:[a.jsx(Hx,{className:"h-3.5 w-3.5"}),"Emoji"]})}),a.jsx(yi,{align:"start",side:"top",className:"z-[100] w-auto p-2",onWheel:Qe=>Qe.stopPropagation(),children:a.jsx($g,{onPick:Qe=>{A.insert(Qe),Ie(!1)}})})]}),Is&&a.jsxs("label",{className:"inline-flex cursor-pointer items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground hover:bg-muted transition-colors",children:[a.jsx(Ca,{className:"h-3.5 w-3.5"}),"Add video",a.jsx("input",{type:"file",accept:"video/*",className:"hidden",onChange:Qe=>{var Xt;const Lt=(Xt=Qe.target.files)==null?void 0:Xt[0];if(Qe.target.value="",!!Lt){if(wse(Lt)){r({title:"Video too large",description:`Videos can be up to ${dk}.`,variant:"destructive"});return}we(Lt)}}})]}),a.jsxs("label",{className:"inline-flex cursor-pointer items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground hover:bg-muted transition-colors",children:[a.jsx(jBt,{className:"h-3.5 w-3.5"}),An||Be?"Replace document":"Add document",a.jsx("input",{type:"file",accept:".pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.csv,.rtf,.odt,.ods,.odp,.zip,audio/*",className:"hidden",onChange:Qe=>{var Xt;const Lt=(Xt=Qe.target.files)==null?void 0:Xt[0];if(Qe.target.value="",!!Lt){if(Lt.size>Sxr){r({title:"File too large",description:"Documents can be up to 50 MB.",variant:"destructive"});return}Ve(Lt)}}})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-xs font-medium text-foreground",children:"Cover image"}),q?a.jsxs("div",{className:"relative",children:[a.jsx("img",{src:q.preview,alt:"",className:"aspect-[16/9] w-full rounded-lg border border-border object-cover"}),a.jsx("button",{type:"button","aria-label":"Remove cover",onClick:()=>{URL.revokeObjectURL(q.preview),Y(null)},className:"absolute top-1.5 right-1.5 h-6 w-6 rounded-full bg-foreground/70 flex items-center justify-center hover:bg-foreground/90 transition-colors",children:a.jsx(nn,{className:"h-3.5 w-3.5 text-background"})})]}):l.banner&&!fe?a.jsxs("div",{className:"relative",children:[a.jsx("img",{src:l.banner,alt:"",className:"aspect-[16/9] w-full rounded-lg border border-border object-cover"}),a.jsx("button",{type:"button","aria-label":"Remove cover",onClick:()=>le(!0),className:"absolute top-1.5 right-1.5 h-6 w-6 rounded-full bg-foreground/70 flex items-center justify-center hover:bg-foreground/90 transition-colors",children:a.jsx(nn,{className:"h-3.5 w-3.5 text-background"})})]}):null,a.jsxs("label",{className:"inline-flex cursor-pointer items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground hover:bg-muted transition-colors",children:[a.jsx(jy,{className:"h-3.5 w-3.5"}),l.banner||q?"Replace cover":"Add cover",a.jsx("input",{type:"file",accept:"image/*",className:"hidden",onChange:Qe=>{var Xt;const Lt=(Xt=Qe.target.files)==null?void 0:Xt[0];Lt&&Q(Lt),Qe.target.value=""}})]})]}),((yn==null?void 0:yn.poll)||(yn==null?void 0:yn.quiz))&&a.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-border bg-muted/30 p-3 text-xs text-muted-foreground",children:[a.jsx(Fc,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-primary"}),a.jsxs("p",{children:[a.jsxs("span",{className:"font-medium text-foreground",children:[yn.quiz?"Quiz":"Poll",(Je=yn.poll)!=null&&Je.question||(Rt=yn.quiz)!=null&&Rt.title?`: ${((Qt=yn.poll)==null?void 0:Qt.question)||((Jt=yn.quiz)==null?void 0:Jt.title)}`:""]}),a.jsx("br",{}),"It stays on the post as it is. Its questions and options can't be changed after posting, because the answers already given were given to them."]})]}),(yn==null?void 0:yn.shared)&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("p",{className:"flex items-center gap-1.5 text-xs font-medium text-foreground",children:[a.jsx(LA,{className:"h-3.5 w-3.5"}),"Reposted post",a.jsx("span",{className:"font-normal text-muted-foreground",children:"— shown as it is; only its author can change it"})]}),a.jsx("div",{className:"pointer-events-none rounded-lg border border-border/60 p-1",children:a.jsx(bse,{post:yn.shared,readOnly:!0})})]}),ms&&a.jsxs("div",{className:"space-y-2 border-t border-border pt-3",children:[a.jsx("button",{type:"button",onClick:()=>te(Qe=>!Qe),className:"text-xs font-medium text-primary hover:text-primary/80",children:ne?"Hide buttons & embed":"Add buttons or embed"}),ne&&a.jsx(bTt,{form:{showAdvancedOptions:!0,canEmbed:!0,embedCode:H,setEmbedCode:W,embedCodeHeight:V,setEmbedCodeHeight:U,buttons:G,buttonErrors:is,updateButton:(Qe,Lt)=>B(Xt=>Xt.map((xr,Ls)=>Ls===Qe?{...xr,...Lt}:xr)),addButton:()=>B(Qe=>Qe.length>=3?Qe:[...Qe,{...nx}]),removeButton:Qe=>B(Lt=>Lt.length<=1?[{...nx}]:Lt.filter((Xt,xr)=>xr!==Qe))}})]}),js&&a.jsxs("div",{className:"space-y-1.5 rounded-lg border border-primary/30 bg-primary/5 p-3",children:[a.jsxs("p",{className:"flex items-center gap-1.5 text-xs font-semibold text-primary",children:[a.jsx(ja,{className:"h-3.5 w-3.5 shrink-0"}),"Scheduled for ",vd(be||(l==null?void 0:l.scheduledPublishAt)||"")]}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Only you can see it until then."}),a.jsx("input",{type:"datetime-local","aria-label":"Publish date and time",value:be,min:oF(),onChange:Qe=>Ze(Qe.target.value),className:"h-9 w-full rounded-md border border-input bg-background px-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring/30"}),a.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Times are in ",lF(),'. Saving keeps it scheduled; use " Publish now " to send it straight away.']})]}),a.jsxs("p",{className:"break-words text-[11px] text-muted-foreground",children:["Tags and polls are kept as-is. Up to ",_T," images, 1 video and 1 document; new files upload when you save."]})]}):a.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"This post can't be edited here."}):null}),!f&&l&&Ee&&a.jsxs("div",{className:"flex shrink-0 flex-wrap items-center justify-end gap-2 border-t border-border px-6 pb-6 pt-4",children:[De!==null&&a.jsxs("p",{className:"mr-auto text-xs text-muted-foreground",role:"status","aria-live":"polite",children:["Uploading… ",De,"%"]}),De!==null?a.jsx(Z,{variant:"ghost",onClick:()=>{var Qe;return(Qe=Xe.current)==null?void 0:Qe.abort()},children:"Cancel upload"}):a.jsx(Z,{variant:"ghost",onClick:et,disabled:g,children:"Cancel"}),js&&a.jsx(Z,{variant:"outline",onClick:()=>void Ue(!0),disabled:g,className:"rounded-full",children:"Publish now"}),a.jsxs(Z,{onClick:()=>void Ue(),disabled:g,className:"rounded-full px-6",children:[g?a.jsx(Ne,{className:"h-4 w-4 mr-1 animate-spin"}):a.jsx(xK,{className:"h-4 w-4 mr-1"}),js?"Save schedule":"Save"]})]})]})}),a.jsx(Nh,{file:X,aspect:16/9,onCancel:()=>Q(null),onCropped:Qe=>{Y(Lt=>(Lt&&URL.revokeObjectURL(Lt.preview),{file:Qe,preview:URL.createObjectURL(Qe)})),le(!1),Q(null)}})]})}function O_t({post:t,communityId:e,onOpenChange:n}){const{toast:r}=yt(),s=t!==null,[i,o]=y.useState(""),[l,c]=y.useState(!1);y.useEffect(()=>{s&&o("")},[s]);const d=()=>{var h;if(!(t!=null&&t.realId)||!e)return;c(!0);const u=`${window.location.origin}${ve.post(t.realId)}`;YAe(e,{contentLink:u,content:t.title||((h=t.body)==null?void 0:h.slice(0,140))||"Post",reportType:"Post Report",reasonOfReporting:i.trim(),contentId:t.realId}).then(()=>{r({title:"Reported",description:"Thank you. Our team will review this post."}),n(!1)}).catch(()=>{r({title:"Couldn't submit your report",variant:"destructive"})}).finally(()=>c(!1))};return a.jsx(Bt,{open:s,onOpenChange:u=>!u&&n(!1),children:a.jsxs(Ft,{className:"sm:max-w-md",children:[a.jsx(Vt,{children:a.jsxs(Ut,{className:"flex items-center gap-2",children:[a.jsx(xd,{className:"h-5 w-5 text-destructive"}),"Report post"]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Tell us why you're reporting this post. Community admins will be notified."}),a.jsx(us,{placeholder:"Why are you reporting this?",value:i,onChange:u=>o(u.target.value),className:"min-h-[100px] resize-none",autoFocus:!0}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx(Z,{variant:"ghost",onClick:()=>n(!1),disabled:l,children:"Cancel"}),a.jsxs(Z,{variant:"destructive",onClick:d,disabled:l||!i.trim(),children:[l&&a.jsx(Ne,{className:"h-4 w-4 mr-1 animate-spin"}),"Send report"]})]})]})]})})}function n9({target:t,communityId:e,onOpenChange:n}){const{toast:r}=yt(),s=t!==null,[i,o]=y.useState(""),[l,c]=y.useState(!1);y.useEffect(()=>{s&&o("")},[s]);const d=()=>{if(!t||!e)return;c(!0);const u=`${window.location.origin}${ve.member(t.id)}`;YAe(e,{contentLink:u,content:t.name,reportType:"User Profile Report",reasonOfReporting:i.trim()}).then(()=>{r({title:"Reported",description:"Thank you. Our team will review this profile."}),n(!1)}).catch(()=>{r({title:"Couldn't submit your report",variant:"destructive"})}).finally(()=>c(!1))};return a.jsx(Bt,{open:s,onOpenChange:u=>!u&&n(!1),children:a.jsxs(Ft,{className:"sm:max-w-md",children:[a.jsx(Vt,{children:a.jsxs(Ut,{className:"flex items-center gap-2",children:[a.jsx(xd,{className:"h-5 w-5 text-destructive"}),"Report ",(t==null?void 0:t.name)??"user"]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Tell us why you're reporting this member. Community admins will be notified."}),a.jsx(us,{placeholder:"Why are you reporting this member?",value:i,onChange:u=>o(u.target.value),className:"min-h-[100px] resize-none",autoFocus:!0}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx(Z,{variant:"ghost",onClick:()=>n(!1),disabled:l,children:"Cancel"}),a.jsxs(Z,{variant:"destructive",onClick:d,disabled:l||!i.trim(),children:[l&&a.jsx(Ne,{className:"h-4 w-4 mr-1 animate-spin"}),"Send report"]})]})]})]})})}const LHe=10;function jxr(t,e){if(t!=null&&t.trim())return t.trim();const n=e.map(r=>r.name).filter(Boolean);return n.length?n.join(", "):"Group chat"}function kPe({post:t,open:e,onOpenChange:n,subject:r}){const{community:s}=qe(),{toast:i}=yt(),[o,l]=y.useState(""),[c,d]=y.useState(""),[u,h]=y.useState([]),[m,f]=y.useState([]),[p,g]=y.useState([]),[v,b]=y.useState(""),[x,w]=y.useState(!1),[k,S]=y.useState(!1),C=y.useRef(0),j=(r==null?void 0:r.noun)??"post",E=`${j[0].toUpperCase()}${j.slice(1)} sent`,N=(r==null?void 0:r.url)??(t!=null&&t.realId?`${window.location.origin}${ve.post(t.realId)}`:"");y.useEffect(()=>{e&&(l(""),d(""),g([]),b(""),C.current+=1)},[e,t==null?void 0:t.realId,r==null?void 0:r.url]),y.useEffect(()=>{const F=setTimeout(()=>d(o.trim()),250);return()=>clearTimeout(F)},[o]),y.useEffect(()=>{if(!e||!(s!=null&&s.id))return;let F=!1;return RZ(s.id).then(D=>{F||f(D.map(I=>({kind:"group",id:I.id,name:jxr(I.name,I.participants??[]),memberCount:(I.participants??[]).length})))}).catch(()=>{F||f([])}),()=>{F=!0}},[e,s==null?void 0:s.id]),y.useEffect(()=>{if(!e||!(s!=null&&s.id))return;const F=++C.current;w(!0),XAe(s.id,c).then(D=>{var P;if(C.current!==F)return;const I=(P=ro())==null?void 0:P.id;h((D.users??[]).filter(M=>M.id!==I).map(M=>({kind:"person",id:M.id,name:M.name||"Member",avatar:M.picture,handle:M.userId||void 0})))}).catch(()=>{C.current===F&&h([])}).finally(()=>{C.current===F&&w(!1)})},[e,s==null?void 0:s.id,c]);const A=y.useMemo(()=>{const F=c.toLowerCase();return(F?m.filter(I=>I.name.toLowerCase().includes(F)):m).slice(0,5)},[m,c]),_=F=>p.some(D=>D.kind===F.kind&&D.id===F.id),T=F=>{if(_(F)){g(D=>D.filter(I=>!(I.kind===F.kind&&I.id===F.id)));return}if(p.length>=LHe){i({title:`You can send to ${LHe} at a time`,variant:"destructive"});return}g(D=>[...D,F])};async function R(){if(!(s!=null&&s.id)||p.length===0)return;if(!N){i({title:"This post can't be sent yet",description:"It is still being published. Try again in a moment.",variant:"destructive"});return}S(!0);const F=[v.trim(),N].filter(Boolean).join(`

`);let D=0;const I=[];for(const P of p)try{P.kind==="group"?await f2t(P.id,F):await cAe(P.id,F,s.id),D+=1}catch{I.push(P.name)}if(S(!1),D>0){i({title:D===1?E:`${E} to ${D}`,description:I.length?`Couldn't reach ${I.join(", ")}.`:void 0}),n(!1);return}i({title:`Couldn't send the ${j}`,description:"Please try again.",variant:"destructive"})}const O=[...A,...u];return a.jsx(Bt,{open:e,onOpenChange:n,children:a.jsxs(Ft,{className:"sm:max-w-md",children:[a.jsxs(Vt,{children:[a.jsxs(Ut,{children:["Send this ",j]}),a.jsx(_n,{children:(r==null?void 0:r.description)??"Share it in a message. People who can't already see the post still won't be able to open it."})]}),p.length>0&&a.jsx("div",{className:"flex flex-wrap gap-1.5",children:p.map(F=>a.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-primary/10 py-1 pl-2.5 pr-1 text-xs font-medium text-foreground",children:[F.name,a.jsx("button",{type:"button","aria-label":`Remove ${F.name}`,onClick:()=>T(F),className:"rounded-full p-0.5 text-muted-foreground transition-colors hover:bg-background hover:text-foreground",children:a.jsx(nn,{className:"h-3 w-3"})})]},`${F.kind}-${F.id}`))}),a.jsxs("div",{className:"relative",children:[a.jsx(hs,{className:"absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Oe,{className:"pl-9",value:o,onChange:F=>l(F.target.value),placeholder:"Search for a person or group",autoFocus:!0})]}),a.jsx("div",{className:"themed-scrollbar max-h-56 min-h-[6rem] overflow-y-auto overscroll-contain pr-1 [scrollbar-gutter:stable]",children:x&&O.length===0?a.jsxs("p",{className:"flex items-center justify-center gap-2 py-8 text-xs text-muted-foreground",children:[a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"})," Searching…"]}):O.length===0?a.jsx("p",{className:"py-8 text-center text-xs text-muted-foreground",children:"No one matches that."}):a.jsx("div",{className:"space-y-0.5",children:O.map(F=>{const D=_(F);return a.jsxs("button",{type:"button",onClick:()=>T(F),"aria-pressed":D,className:ee("flex w-full items-center gap-3 rounded-lg px-2 py-2 text-left transition-colors",D?"bg-primary/10":"hover:bg-muted/60"),children:[F.kind==="group"?a.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-muted text-muted-foreground",children:a.jsx(wr,{className:"h-4 w-4"})}):a.jsx(Jd,{src:F.avatar??"",name:F.name,className:"h-9 w-9 shrink-0 text-xs"}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-sm font-medium text-foreground",children:F.name}),F.kind==="person"&&F.handle&&a.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:["@",F.handle]}),F.kind==="group"&&a.jsxs("span",{className:"block text-xs text-muted-foreground",children:[F.memberCount," ",F.memberCount===1?"member":"members"]})]}),D&&a.jsx(Qn,{className:"h-4 w-4 shrink-0 text-primary"})]},`${F.kind}-${F.id}`)})})}),a.jsx(us,{rows:2,value:v,onChange:F=>b(F.target.value),placeholder:"Write a message (optional)",className:"resize-none"}),a.jsxs(ir,{className:"sm:justify-between",children:[a.jsx(Z,{type:"button",variant:"ghost",onClick:()=>{kN(N).then(F=>i(F?{title:"Link copied"}:{title:"Couldn't copy link",variant:"destructive"}))},children:"Copy link"}),a.jsxs(Z,{disabled:p.length===0||k,onClick:()=>void R(),children:[k?a.jsx(Ne,{className:"mr-1.5 h-4 w-4 animate-spin"}):a.jsx(_s,{className:"mr-1.5 h-4 w-4"}),k?"Sending…":"Send"]})]})]})})}var F_t="AlertDialog",[Exr,bjs]=il(F_t,[iut]),O0=iut(),B_t=t=>{const{__scopeAlertDialog:e,...n}=t,r=O0(e);return a.jsx(ote,{...r,...n,modal:!0})};B_t.displayName=F_t;var Nxr="AlertDialogTrigger",Txr=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=O0(n);return a.jsx(wut,{...s,...r,ref:e})});Txr.displayName=Nxr;var _xr="AlertDialogPortal",U_t=t=>{const{__scopeAlertDialog:e,...n}=t,r=O0(e);return a.jsx(lte,{...r,...n})};U_t.displayName=_xr;var Axr="AlertDialogOverlay",z_t=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=O0(n);return a.jsx(xI,{...s,...r,ref:e})});z_t.displayName=Axr;var cP="AlertDialogContent",[Pxr,Rxr]=Exr(cP),Ixr=fst("AlertDialogContent"),V_t=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,children:r,...s}=t,i=O0(n),o=y.useRef(null),l=Sr(e,o),c=y.useRef(null);return a.jsx(nin,{contentName:cP,titleName:H_t,docsSlug:"alert-dialog",children:a.jsx(Pxr,{scope:n,cancelRef:c,children:a.jsxs(wI,{role:"alertdialog",...i,...s,ref:l,onOpenAutoFocus:Kt(s.onOpenAutoFocus,d=>{var u;d.preventDefault(),(u=c.current)==null||u.focus({preventScroll:!0})}),onPointerDownOutside:d=>d.preventDefault(),onInteractOutside:d=>d.preventDefault(),children:[a.jsx(Ixr,{children:r}),a.jsx(Lxr,{contentRef:o})]})})})});V_t.displayName=cP;var H_t="AlertDialogTitle",G_t=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=O0(n);return a.jsx(l7,{...s,...r,ref:e})});G_t.displayName=H_t;var W_t="AlertDialogDescription",q_t=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=O0(n);return a.jsx(c7,{...s,...r,ref:e})});q_t.displayName=W_t;var Mxr="AlertDialogAction",K_t=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,s=O0(n);return a.jsx(cte,{...s,...r,ref:e})});K_t.displayName=Mxr;var Y_t="AlertDialogCancel",Q_t=y.forwardRef((t,e)=>{const{__scopeAlertDialog:n,...r}=t,{cancelRef:s}=Rxr(Y_t,n),i=O0(n),o=Sr(e,s);return a.jsx(cte,{...i,...r,ref:o})});Q_t.displayName=Y_t;var Lxr=({contentRef:t})=>{const e=`\`${cP}\` requires a description for the component to be accessible for screen reader users.

You can add a description to the \`${cP}\` by passing a \`${W_t}\` component as a child, which also benefits sighted users by adding visible context to the dialog.

Alternatively, you can use your own component as a description by assigning it an \`id\` and passing the same value to the \`aria-describedby\` prop in \`${cP}\`. If the description is confusing or duplicative for sighted users, you can use the \`@radix-ui/react-visually-hidden\` primitive as a wrapper around your description component.

For more information, see https://radix-ui.com/primitives/docs/components/alert-dialog`;return y.useEffect(()=>{var r;document.getElementById((r=t.current)==null?void 0:r.getAttribute("aria-describedby"))||console.warn(e)},[e,t]),null},Dxr=B_t,$xr=U_t,Z_t=z_t,J_t=V_t,X_t=K_t,eAt=Q_t,tAt=G_t,nAt=q_t;const Kr=Dxr,Oxr=$xr,rAt=y.forwardRef(({className:t,...e},n)=>a.jsx(Z_t,{className:ee("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));rAt.displayName=Z_t.displayName;const Or=y.forwardRef(({className:t,...e},n)=>a.jsxs(Oxr,{children:[a.jsx(rAt,{}),a.jsx(J_t,{ref:n,className:ee("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",t),...e})]}));Or.displayName=J_t.displayName;const Fr=({className:t,...e})=>a.jsx("div",{className:ee("flex flex-col space-y-2 text-center sm:text-left",t),...e});Fr.displayName="AlertDialogHeader";const Br=({className:t,...e})=>a.jsx("div",{className:ee("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});Br.displayName="AlertDialogFooter";const Ur=y.forwardRef(({className:t,...e},n)=>a.jsx(tAt,{ref:n,className:ee("text-lg font-semibold",t),...e}));Ur.displayName=tAt.displayName;const zr=y.forwardRef(({className:t,...e},n)=>a.jsx(nAt,{ref:n,className:ee("text-sm text-muted-foreground",t),...e}));zr.displayName=nAt.displayName;const Yr=y.forwardRef(({className:t,...e},n)=>a.jsx(X_t,{ref:n,className:ee(GO(),t),...e}));Yr.displayName=X_t.displayName;const ts=y.forwardRef(({className:t,...e},n)=>a.jsx(eAt,{ref:n,className:ee(GO({variant:"outline"}),"mt-2 sm:mt-0",t),...e}));ts.displayName=eAt.displayName;function sAt({open:t,onOpenChange:e,destinations:n,destinationId:r,actionLabel:s,onConfirm:i}){const[o,l]=y.useState(""),c=y.useMemo(()=>ZAe(n),[n]),d=y.useRef(!1);y.useEffect(()=>{if(!t){d.current=!1;return}if(d.current&&n.some(m=>m.id===o))return;d.current=!0;const h=n.find(m=>m.id===r)??n[0];l((h==null?void 0:h.id)??"")},[t,r,n,o]);const u=n.find(h=>h.id===o)??null;return a.jsx(Kr,{open:t,onOpenChange:e,children:a.jsxs(Or,{className:"w-[calc(100vw-2rem)] max-w-md",children:[a.jsxs(Fr,{children:[a.jsxs(Ur,{className:"flex items-center gap-1.5",children:["Confirm channel",a.jsx(gn,{label:"Confirm channel",side:"bottom",children:"A post is seen by everyone who can open the channel it is in. Checking it here avoids sharing with the wrong audience. To post somewhere else, pick another channel below."})]}),a.jsx(zr,{children:"Please confirm this is the channel you want to post in. You can choose a different one below."})]}),a.jsxs(zn,{value:o,onValueChange:l,disabled:n.length===0,children:[a.jsx(On,{"aria-label":"Channel",className:"w-full text-left",children:a.jsx(Vn,{placeholder:"Select channel"})}),a.jsx(Fn,{className:"themed-scrollbar max-h-72",children:c.map((h,m)=>a.jsxs(n0e,{children:[m>0&&a.jsx(gEt,{}),a.jsx(LZ,{className:"truncate text-xs text-muted-foreground",children:h.groupName}),h.destinations.map(f=>a.jsxs(pt,{value:f.id,children:[a.jsx("span",{className:"mr-1.5 text-muted-foreground",children:f.tabEmoji||"#"}),f.label]},f.id))]},h.groupId))})]}),a.jsxs(Br,{className:"gap-2 sm:gap-0",children:[a.jsx(ts,{children:"Back to editing"}),a.jsxs(Yr,{disabled:!u,onClick:()=>u&&i(u),children:["Confirm & ",s.toLowerCase()]})]})]})})}const DHe="flex w-full items-start gap-3 rounded-lg border border-border p-4 text-left transition-colors hover:border-primary/40 hover:bg-muted/60 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-60";function iAt({post:t,onOpenChange:e,onReposted:n}){const{groups:r,communityDetail:s}=Ln(),{toast:i}=yt(),o=t!==null,l=y.useMemo(()=>EN(r),[r]),[c,d]=y.useState(null),[u,h]=y.useState(""),[m,f]=y.useState(!1),[p,g]=y.useState(!1),[v,b]=y.useState(!1),x=y.useRef(null),w=yse(x),[k,S]=y.useState(!1),[C,j]=y.useState(0),[E,N]=y.useState(null),[A,_]=y.useState(aP),T=y.useRef(!1),R=()=>{var B;return(((B=x.current)==null?void 0:B.readMarkdown())??u).trim()},O=y.useCallback(B=>{var V;const H=((V=x.current)==null?void 0:V.readMarkdown())??"",W=H.trim().length;j(W),N(H),(B??W)<fa&&(T.current=!1)},[]),F=y.useCallback(()=>{T.current||(T.current=!0,i({title:`Comment must be ${fa} characters or fewer`,variant:"destructive"}))},[i]),D=B=>{var H;(H=x.current)==null||H.insertText(B),S(!1)},I=y.useRef(!1);y.useEffect(()=>{var W;if(!o){I.current=!1;return}const B=!I.current;I.current=!0,B&&(h(""),j(0),N(null),_(aP),T.current=!1,S(!1),g(!1),b(!1));const H=((W=s==null?void 0:s.configurables)==null?void 0:W.COMMUNITY_DEFAULT_POST_SECTION)??null;d(V=>{var U;return!B&&V&&l.some(ne=>ne.id===V)?V:((U=JAe(r,H))==null?void 0:U.id)??null})},[o,r,s,l]);const P=l.find(B=>B.id===c)??null,M=B=>B.length<=fa?!1:(i({title:`Comment must be ${fa} characters or fewer`,variant:"destructive"}),!0),z=()=>{!(t!=null&&t.realId)||!P||M(R())||g(!0)},G=async(B,H=R())=>{if(g(!1),d(B.id),!!(t!=null&&t.realId)&&!M(H)){f(!0);try{const W=await qAe({sharedId:t.realId,description:H||void 0,groupId:B.groupId,tabId:B.tabId,...H?qZ(A,H):{}});W.inReview?i({title:"Repost in review",description:W.reviewReason||"An admin will review it before it appears."}):(i({title:"Reposted",description:`Shared to ${B.label}`}),n(W.post)),e(!1)}catch(W){i({title:"Couldn't repost",description:W instanceof ze?Dt(W.body,W.message||"Try again."):"Try again.",variant:"destructive"})}finally{f(!1)}}};return a.jsxs(Bt,{open:o,onOpenChange:B=>!B&&e(!1),children:[a.jsxs(Ft,{className:"flex max-h-[min(90vh,880px)] flex-col gap-0 overflow-hidden p-0 sm:max-w-lg",children:[a.jsxs(Vt,{className:"shrink-0 border-b border-border px-6 pb-4 pt-6",children:[a.jsxs(Ut,{className:"flex items-center gap-2.5",children:[a.jsx(WAe,{variant:"repost"}),"Repost"]}),a.jsx(_n,{children:v?"Share this post to one of your channels.":"How would you like to share this post?"})]}),!v&&a.jsxs("div",{className:"grid gap-3 px-6 py-5",children:[a.jsxs("button",{type:"button",onClick:()=>b(!0),disabled:m,className:DHe,children:[a.jsx(Qs,{className:"mt-0.5 h-5 w-5 shrink-0 text-primary"}),a.jsxs("span",{className:"min-w-0",children:[a.jsx("span",{className:"block text-sm font-semibold text-foreground",children:"Repost with your thoughts"}),a.jsx("span",{className:"block text-xs text-muted-foreground",children:"Add a comment and choose the channel before sharing."})]})]}),a.jsxs("button",{type:"button",onClick:()=>P&&void G(P,""),disabled:m||!P,className:DHe,children:[m?a.jsx(Ne,{className:"mt-0.5 h-5 w-5 shrink-0 animate-spin text-primary"}):a.jsx(LA,{className:"mt-0.5 h-5 w-5 shrink-0 text-primary"}),a.jsxs("span",{className:"min-w-0",children:[a.jsx("span",{className:"block text-sm font-semibold text-foreground",children:"Repost instantly"}),a.jsx("span",{className:"block break-words text-xs text-muted-foreground",children:P?`Shares it right away to ${P.label}.`:"There is no channel you can post in yet."})]})]})]}),v&&a.jsxs("div",{className:"themed-scrollbar min-h-0 flex-1 space-y-3 overflow-y-auto px-6 py-4",children:[a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{variant:"outline",className:"w-full justify-start",disabled:l.length===0,children:(P==null?void 0:P.label)??"Select channel"})}),a.jsx(Cr,{className:"max-h-64 w-[--radix-dropdown-menu-trigger-width] overflow-y-auto",children:l.map(B=>a.jsx(ot,{onClick:()=>d(B.id),className:B.id===c?"bg-accent":"",children:B.label},B.id))})]}),a.jsxs("div",{ref:w.wrapRef,className:"min-w-0 space-y-1.5",children:[w.menu,a.jsx(Du,{ref:x,placeholder:"Add a comment (optional)… Type @ to mention someone.",value:u,onChange:h,...w.editorProps,highlightMentions:!0,deferMarkdownSync:!0,plainTextPaste:!0,markdownBreaks:!0,maxLength:fa,onCharacterCountChange:O,onLimitExceeded:F,className:"min-w-0 max-w-full overflow-hidden",editableClassName:"min-h-[88px] max-h-48"}),a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs(Ni,{open:k,onOpenChange:S,modal:!1,children:[a.jsx(Ti,{asChild:!0,children:a.jsxs("button",{type:"button","aria-label":"Add emoji",className:"inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground transition-colors hover:bg-muted",children:[a.jsx(Hx,{className:"h-3.5 w-3.5"}),"Emoji"]})}),a.jsx(yi,{align:"start",side:"top",collisionPadding:8,className:"themed-scrollbar z-[100] max-h-[var(--radix-popover-content-available-height)] w-auto overflow-y-auto p-2",onWheel:B=>B.stopPropagation(),children:a.jsx($g,{onPick:D})})]}),a.jsxs("p",{className:ee("shrink-0 text-right text-xs text-muted-foreground",C>fa&&"text-destructive"),children:[C,"/",fa]})]}),o&&a.jsx(mPe,{text:E??u,onChange:_},t==null?void 0:t.realId)]}),t&&a.jsx("div",{className:"pointer-events-none rounded-lg border border-border/60 p-1",children:a.jsx(bse,{post:t,readOnly:!0})})]}),a.jsxs(ir,{className:"shrink-0 gap-2 border-t border-border px-6 pb-6 pt-4",children:[a.jsx(Z,{variant:"ghost",onClick:()=>e(!1),disabled:m,children:"Cancel"}),v&&a.jsxs(Z,{onClick:z,disabled:m||!P,children:[m&&a.jsx(Ne,{className:"h-4 w-4 mr-1 animate-spin"}),"Repost"]})]})]}),a.jsx(sAt,{open:p,onOpenChange:g,destinations:l,destinationId:c,actionLabel:"Repost",onConfirm:B=>void G(B)})]})}const jse=[{emoji:"👍",label:"Like"},{emoji:"🎉",label:"Celebrate"},{emoji:"🤝",label:"Support"},{emoji:"❤️",label:"Love"},{emoji:"💡",label:"Insightful"},{emoji:"😂",label:"Funny"}],Ese=jse[0].emoji,Fxr=new Map(jse.map(t=>[t.emoji,t.label]));function Nse(t){return t&&Fxr.get(t)||"Like"}function t2(t){var e;return((e=t==null?void 0:t.details.find(n=>n.isByMe))==null?void 0:e.emoji)??null}function Bxr(t,e=3){return[...(t==null?void 0:t.details)??[]].filter(n=>n.count>0).sort((n,r)=>r.count-n.count).slice(0,e).map(n=>n.emoji)}function Uxr(t,e,n=!1){var i,o;if(t<=0)return"";if(n){const l=t-1;return l<=0?"You":`You and ${l.toLocaleString()} ${l===1?"other":"others"}`}const r=(o=(i=e==null?void 0:e.find(l=>{var c;return(c=l.name)==null?void 0:c.trim()}))==null?void 0:i.name)==null?void 0:o.trim();if(!r)return`${t.toLocaleString()}`;if(t===1)return r;const s=t-1;return`${r} and ${s.toLocaleString()} ${s===1?"other":"others"}`}function aAt({postRealId:t,onOpenChange:e}){var o;const n=!!t,r=lt({queryKey:["post-analytics",t],queryFn:()=>Tvr(t),enabled:n}),s=(o=r.data)==null?void 0:o.analytics,i=((s==null?void 0:s.reactionBreakdown)??[]).filter(l=>l.count>0);return a.jsx(Bt,{open:n,onOpenChange:e,children:a.jsxs(Ft,{className:"max-w-md",children:[a.jsx(Vt,{children:a.jsxs(Ut,{className:"flex items-center gap-2",children:[a.jsx(Fc,{className:"h-5 w-5 shrink-0 text-primary"}),"Post analytics"]})}),r.isLoading?a.jsx("div",{className:"flex items-center justify-center py-10 text-muted-foreground",children:a.jsx(Ne,{className:"h-5 w-5 animate-spin"})}):r.isError?a.jsx("p",{className:"py-8 text-center text-sm text-destructive",children:"Couldn't load analytics for this post. Close this and try again."}):s?a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx(AT,{label:"Impressions",value:s.impressions,hint:"Times it appeared in a feed",explain:"Counted once each time the post is on screen for a full second while someone scrolls. A quick scroll past does not count, and your own views are never counted."}),a.jsx(AT,{label:"People reached",value:s.uniqueImpressions,hint:"How many saw it at least once",explain:"How many different people the impressions above came from. Seeing the post again does not add to this, so it is always the smaller of the two."}),a.jsx(AT,{label:"Views",value:s.views,hint:"Times the post was opened",explain:"Times the post page itself was opened. A stronger signal than an impression — someone chose to look rather than scrolled past."}),a.jsx(AT,{label:"Reactions",value:s.reactions,hint:"Across all six",explain:"Everyone who reacted, added up across the six reactions. One person counts once however many times they change which one they picked."}),a.jsx(AT,{label:"Comments",value:s.comments,explain:"Comments left on the post. Replies to a comment are not counted here."}),a.jsx(AT,{label:"Reposts",value:s.reposts,explain:"Posts that share this one. Only reposts you are allowed to see are counted, so a repost in a private section will not appear."})]}),i.length>0&&a.jsxs("div",{className:"space-y-2 rounded-lg border border-border bg-muted/30 p-3",children:[a.jsx("p",{className:"text-xs font-semibold text-foreground",children:"Reactions"}),a.jsx("div",{className:"flex flex-wrap gap-x-4 gap-y-1.5",children:i.map(l=>a.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[a.jsx("span",{"aria-hidden":!0,className:"text-sm leading-none",children:l.emoji}),a.jsx("span",{className:"font-medium text-foreground",children:l.count.toLocaleString()}),Nse(l.emoji)]},l.emoji))})]}),s.createdAt&&a.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Posted ",vd(s.createdAt),". Impressions are counted from when this was released, and your own views are not included."]})]}):null]})})}function AT({label:t,value:e,hint:n,explain:r}){return a.jsxs("div",{className:"rounded-lg border border-border bg-card p-3",children:[a.jsx("p",{className:"text-xl font-semibold text-foreground",children:e.toLocaleString()}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("p",{className:"text-xs font-medium text-foreground",children:t}),r&&a.jsx(gn,{label:t,children:r})]}),n&&a.jsx("p",{className:"mt-0.5 text-[11px] leading-snug text-muted-foreground",children:n})]})}const $y=t=>encodeURIComponent(t);async function zxr(t){const e=await ae.get(`/community/${$y(t)}/blocked-users`);return{blockedUsers:Array.isArray(e==null?void 0:e.blockedUsers)?e.blockedUsers:[]}}async function Vxr(t,e){await ae.post(`/community/${$y(t)}/blocked-users/${$y(e)}`,{})}async function Hxr(t,e){await ae.delete(`/community/${$y(t)}/blocked-users/${$y(e)}`)}async function Tse(t,e){await ae.post(`/community/${$y(t)}/block-peer/${$y(e)}`,{})}async function $He(t,e){await ae.delete(`/community/${$y(t)}/unblock-peer/${$y(e)}`)}async function Gxr(t){const e=await ae.get(`/community/${$y(t)}/blocked-peers`);return{blockedUsers:Array.isArray(e==null?void 0:e.blockedUser)?e.blockedUser:[]}}const oAt=t=>["followed-ids",t],lAt=(t,e,n)=>{const r=t.filter(s=>s!==e);return n?[...r,e]:r},cAt=new Set;function _se(t,e){var r;const n=oAt(((r=ro())==null?void 0:r.id)??null);for(const s of cAt)s.setQueryData(n,i=>i&&lAt(i,t,e)),s.isFetching({queryKey:n})&&s.cancelQueries({queryKey:n}).then(()=>s.invalidateQueries({queryKey:n}))}function dAt(t){var f;const{community:e}=qe(),n=(e==null?void 0:e.id)??null,{toast:r}=yt(),s=rn(),i=((f=ro())==null?void 0:f.id)??null,o=y.useMemo(()=>oAt(i),[i]),{data:l}=lt({queryKey:o,queryFn:Edr,enabled:!!(n&&i),retry:1,staleTime:0,refetchOnMount:!0,refetchOnWindowFocus:!0});y.useEffect(()=>{cAt.add(s)},[s]);const c=y.useMemo(()=>new Set(l??[]),[l]),d=y.useCallback((p,g)=>{s.setQueryData(o,(v=[])=>lAt(v,p,g))},[s,o]),u=y.useCallback(p=>!!(p&&c.has(p)),[c]),h=y.useCallback(async p=>{const g=p.authorId;if(!n||!g)return;const v=!c.has(g);await s.cancelQueries({queryKey:o}),d(g,v);try{await(v?Xre(n,g):ese(n,g)),_se(g,v),r({title:v?`Following ${p.author}`:`Unfollowed ${p.author}`})}catch{d(g,!v),r({title:"Couldn't update follow",variant:"destructive"})}},[n,c,s,o,d,r]),m=y.useCallback(async p=>{const g=p.authorId;if(!(!n||!g)){t==null||t(g);try{await Tse(n,g),r({title:`Blocked ${p.author}`,description:"You won't see their posts anymore."})}catch{r({title:"Couldn't block this user",variant:"destructive"})}}},[n,t,r]);return{isFollowing:u,toggleFollow:h,blockAuthor:m}}function Ase({onPostSaved:t,onReposted:e,onAuthorBlocked:n}={}){const{community:r}=qe(),[s,i]=y.useState(null),[o,l]=y.useState(null),[c,d]=y.useState(null),[u,h]=y.useState(null),[m,f]=y.useState(null),[p,g]=y.useState(null),{toggleFollow:v,isFollowing:b,blockAuthor:x}=dAt(n),w=y.useMemo(()=>({onEditPost:S=>S.realId&&i(S.realId),onReportPost:S=>l(S),onReportUser:S=>S.authorId&&d({id:S.authorId,name:S.author}),onToggleFollow:S=>void v(S),isFollowingAuthor:b,onBlockAuthor:S=>void x(S),onRepost:S=>h(S),onSend:S=>f(S),onViewAnalytics:S=>S.realId&&g(S.realId),commentAuthorActions:{onToggleFollow:S=>void v(S),isFollowing:b,onBlock:S=>void x(S)}}),[v,b,x]),k=a.jsxs(a.Fragment,{children:[a.jsx($_t,{realId:s,onOpenChange:S=>!S&&i(null),onSaved:S=>t==null?void 0:t(S)}),a.jsx(O_t,{post:o,communityId:r==null?void 0:r.id,onOpenChange:S=>!S&&l(null)}),a.jsx(n9,{target:c,communityId:r==null?void 0:r.id,onOpenChange:S=>!S&&d(null)}),a.jsx(kPe,{post:m,open:m!==null,onOpenChange:S=>{S||f(null)}}),a.jsx(aAt,{postRealId:p,onOpenChange:S=>!S&&g(null)}),a.jsx(iAt,{post:u,onOpenChange:S=>!S&&h(null),onReposted:S=>e==null?void 0:e(S)})]});return{listProps:w,dialogs:k,openEditPost:i}}function uAt({options:t,selected:e,onPick:n,trailing:r,pickerOpen:s=!1,children:i,className:o}){const[l,c]=y.useState(!1),[d,u]=y.useState(!1),h=y.useRef(null);y.useEffect(()=>{if(!l)return;const g=b=>{s||h.current&&!h.current.contains(b.target)&&c(!1)},v=b=>{b.key==="Escape"&&c(!1)};return document.addEventListener("pointerdown",g),document.addEventListener("keydown",v),()=>{document.removeEventListener("pointerdown",g),document.removeEventListener("keydown",v)}},[l,s]);const m=(g=!1)=>{c(!1),u(!0),g&&typeof document<"u"&&document.activeElement instanceof HTMLElement&&document.activeElement.blur()},f=g=>{n(g),m(!0)},p=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(hover: none)").matches?(c(v=>!v),!0):!1;return a.jsxs("div",{ref:h,onPointerEnter:()=>u(!1),onBlur:g=>{var v;(v=h.current)!=null&&v.contains(g.relatedTarget)||u(!1)},className:ee("group/reaction relative inline-flex",o),children:[a.jsx("div",{className:ee("invisible absolute bottom-full left-0 z-50 pb-2 opacity-0 transition-all duration-150",!d&&"[@media(hover:hover)]:group-hover/reaction:visible [@media(hover:hover)]:group-hover/reaction:opacity-100 [@media(hover:hover)]:group-focus-within/reaction:visible [@media(hover:hover)]:group-focus-within/reaction:opacity-100",!d&&l&&"visible opacity-100"),children:a.jsxs("div",{role:"toolbar","aria-label":"Choose a reaction",className:"flex items-center gap-0.5 rounded-full border border-border bg-popover px-1.5 py-1 shadow-lg",children:[t.map(g=>a.jsx("button",{type:"button","aria-label":`React with ${g.label}`,"aria-pressed":e===g.emoji,title:g.label,onClick:()=>f(g.emoji),className:ee("flex h-8 w-8 items-center justify-center rounded-full text-lg transition-transform hover:-translate-y-1 hover:scale-125 focus-visible:-translate-y-1 focus-visible:scale-125 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",e===g.emoji&&"bg-primary/10 ring-1 ring-primary/30"),children:g.emoji},g.emoji)),r]})}),i({openOnTouch:p,trayOpen:l,dismiss:()=>m(!1)})]})}function yq({open:t,onOpenChange:e,postRealId:n,likeCount:r,reactions:s,mode:i="reactions",poll:o,comment:l}){var b;const[c,d]=y.useState(null);y.useEffect(()=>{t&&d(null)},[t,n,l==null?void 0:l.commentId,l==null?void 0:l.replyId]);const u=i==="reposts",h=i==="votes",m=h?"votes":u?"reposts":"reactions",f=h?(o?$_e(o,!0).map(x=>o.options[x]):[]).map(x=>({key:x.text,label:`${x.text} ${x.votes.toLocaleString()}`,ariaLabel:`${x.text}, ${x.votes}`})):u?[]:((s==null?void 0:s.details)??[]).filter(x=>x.count>0).map(x=>({key:x.emoji,label:`${x.emoji} ${x.count.toLocaleString()}`,ariaLabel:`${Nse(x.emoji)}, ${x.count}`})),p=h?(o==null?void 0:o.totalVotes)??r:(s==null?void 0:s.total)??r,g=C0({queryKey:["post-people",i,n,l==null?void 0:l.commentId,l==null?void 0:l.replyId,c],initialPageParam:1,queryFn:({pageParam:x})=>{if(!n)throw new Error("Post is unavailable");return u?Evr(n,x):h?Nvr(n,x,c):l!=null&&l.replyId?Rvr(n,l.commentId,l.replyId,x,c):l?Pvr(n,l.commentId,x,c):Avr(n,x,c)},getNextPageParam:x=>x.nextPage??void 0,enabled:t&&!!n}),v=(((b=g.data)==null?void 0:b.pages)??[]).flatMap(x=>x.users.map((w,k)=>{var S,C;return{user:w,emoji:(S=x.emojis)==null?void 0:S[k],choice:(C=x.choices)==null?void 0:C[k]}}));return a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"max-w-sm p-0",children:[a.jsx(Vt,{className:"border-b border-border px-5 py-4",children:a.jsx(Ut,{children:h?"Poll votes":u?"Reposts":"Reactions"})}),f.length>0&&a.jsxs("div",{role:"tablist","aria-label":h?"Filter by option":"Filter by reaction",className:"themed-scrollbar flex items-center gap-1 overflow-x-auto border-b border-border px-3",children:[a.jsx(OHe,{active:c===null,onClick:()=>d(null),label:`All ${p.toLocaleString()}`,ariaLabel:`All ${m}, ${p}`}),f.map(x=>a.jsx(OHe,{active:c===x.key,onClick:()=>d(x.key),label:x.label,ariaLabel:x.ariaLabel},x.key))]}),a.jsxs("div",{className:"reaction-users-scrollbar max-h-[320px] min-h-32 overflow-y-auto overscroll-contain px-3 py-2",onScroll:x=>{const w=x.currentTarget;w.scrollTop>0&&w.scrollTop+w.clientHeight>=w.scrollHeight-24&&g.hasNextPage&&!g.isFetchingNextPage&&g.fetchNextPage()},children:[v.map(({user:x,emoji:w,choice:k})=>a.jsxs(qd,{userId:x.id,className:"flex items-center gap-3 rounded-md px-2 py-2 hover:bg-muted",children:[a.jsxs("span",{className:"relative shrink-0",children:[a.jsx(Jd,{src:x.picture??void 0,name:x.name,className:"h-9 w-9 text-xs"}),w&&a.jsx("span",{"aria-hidden":!0,className:"absolute -bottom-0.5 -right-0.5 flex h-4 w-4 items-center justify-center rounded-full bg-background text-[10px] leading-none ring-1 ring-border",children:w})]}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:x.name||"Member"}),x.userId&&a.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:["@",x.userId]})]}),k&&c===null&&a.jsx("span",{className:"ml-auto max-w-[45%] shrink-0 truncate rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",title:k,children:k})]},x.id)),(g.isLoading||g.isFetchingNextPage)&&a.jsx("div",{className:"flex justify-center py-4",children:a.jsx(Ne,{className:"h-5 w-5 animate-spin text-muted-foreground"})}),g.isError&&a.jsxs("p",{className:"px-2 py-4 text-center text-sm text-destructive",children:["Couldn't load ",m,". Close this and try again."]}),!g.isLoading&&!g.isError&&v.length===0&&a.jsx("p",{className:"px-2 py-4 text-center text-sm text-muted-foreground",children:h&&c!==null?"Nobody chose this option.":`No ${m} yet.`})]})]})})}function OHe({active:t,onClick:e,label:n,ariaLabel:r}){return a.jsx("button",{type:"button",role:"tab","aria-selected":t,"aria-label":r,onClick:e,className:ee("shrink-0 whitespace-nowrap border-b-2 px-3 py-2 text-xs font-medium transition-colors",t?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:n})}const Wxr=[{value:"recent",label:"Most recent",hint:"Newest comments first, in the order they were written. This is the order comments open in, so a comment you have just posted is at the top."},{value:"relevant",label:"Most relevant",hint:"Comments with the most reactions and replies come first. A reply counts for twice as much as a reaction, since it took more to write. Comments that tie are ordered newest first."}],hAt=4,mAt=t=>{if(!/^https?:\/\/\S+$/i.test(t))return!1;const e=t.replace(/[).,;:!?]+$/,"");return/\.(?:gif|png|jpe?g|webp|avif|bmp)(?:[?#].*)?$/i.test(e)||/media\d*\.tenor\.com/i.test(e)||/(?:static|media)\.klipy\.com/i.test(e)},Pse=y.forwardRef(function({value:e,placeholder:n,className:r,maxHeight:s=160,onChange:i,onKeyDown:o,onKeyUp:l,onBlur:c,onFocus:d,autoFocus:u},h){const m=y.useRef(null),f=y.useRef(null),p=e.includes("@")&&eAe(e).length>0,g=y.useCallback(b=>{const x=f.current;if(!b||!x)return;const w=Math.max(0,b.offsetWidth-b.clientWidth-2);x.style.paddingRight=w?`calc(0.75rem + ${w}px)`:"",x.style.height=`${b.offsetHeight}px`,x.scrollTop=b.scrollTop},[]),v=y.useCallback(b=>{b&&(b.style.height="auto",b.style.height=`${Math.min(b.scrollHeight,s)}px`,b.style.overflowY=b.scrollHeight>s?"auto":"hidden",g(b))},[s,g]);return y.useEffect(()=>v(m.current),[e,v,p]),a.jsxs("div",{className:"relative flex min-w-0 flex-1",children:[p&&a.jsxs("div",{ref:f,"aria-hidden":"true","data-mention-mirror":"",className:"pointer-events-none absolute inset-x-0 top-0 overflow-hidden whitespace-pre-wrap break-words rounded-2xl border border-transparent bg-background px-3 py-1.5 text-sm text-foreground",children:[mcr(e).map((b,x)=>b.mention?a.jsx("span",{className:"text-primary",children:b.text},x):b.text),"​"]}),a.jsx("textarea",{ref:b=>{m.current=b,typeof h=="function"?h(b):h&&(h.current=b)},rows:1,value:e,placeholder:n,onChange:b=>{v(b.currentTarget),i(b)},onKeyDown:o,onKeyUp:l,onBlur:c,onFocus:d,autoFocus:u,onScroll:b=>g(b.currentTarget),style:p?{position:"relative",color:"transparent",background:"transparent",caretColor:"hsl(var(--foreground))"}:void 0,className:ee("min-w-0 resize-none",r)})]})});function fAt({file:t,index:e,onRemove:n}){const[r,s]=y.useState(null);return y.useEffect(()=>{const i=URL.createObjectURL(t);return s(i),()=>URL.revokeObjectURL(i)},[t]),a.jsxs("div",{className:"relative overflow-hidden rounded-lg border border-border bg-muted/30",children:[r?a.jsx("img",{src:r,alt:`Selected image ${e+1}`,className:"max-h-52 max-w-full object-contain"}):a.jsx("div",{className:"h-20 w-20 animate-pulse bg-muted","aria-label":`Loading image ${e+1}`}),a.jsx("button",{type:"button","aria-label":`Remove image ${e+1}`,onClick:n,className:"absolute right-1.5 top-1.5 flex h-6 w-6 items-center justify-center rounded-full bg-black/70 text-white hover:bg-black/85",children:a.jsx(nn,{className:"h-3.5 w-3.5"})})]})}function dP(t){const e=[],n=[];return String(t??"").split(`
`).forEach(r=>{const s=r.trim();mAt(s)?e.push(s):n.push(r)}),{prose:n.join(`
`).trim(),media:e}}function ZZ(t,e){return[t.trim(),...e].filter(Boolean).join(`
`)}function I0e({urls:t,onRemove:e}){return t.length===0?null:a.jsx("div",{className:"flex flex-wrap gap-2",children:t.map((n,r)=>a.jsxs("div",{className:"relative",children:[a.jsx("img",{src:n,alt:"",className:"max-h-28 max-w-[160px] rounded-md border border-border object-contain"}),e&&a.jsx("button",{type:"button","aria-label":"Remove media",onClick:()=>e(n,r),className:"absolute top-1 right-1 h-5 w-5 rounded-full bg-foreground/70 flex items-center justify-center hover:bg-foreground/90 transition-colors",children:a.jsx(nn,{className:"h-3 w-3 text-background"})})]},`${n}-${r}`))})}function pAt(t){const e=t.split(`
`),n=[];let r=[];const s=i=>{const o=r.join(`
`).trim();r=[],o&&n.push(a.jsx(ZB,{text:o},i))};return e.forEach((i,o)=>{const l=i.trim();mAt(l)?(s(`t${o}`),n.push(a.jsx("a",{href:l,target:"_blank",rel:"noreferrer",className:"mt-1 block",children:a.jsx("img",{src:l,alt:"",className:"max-h-48 max-w-[220px] rounded-md border border-border object-contain"})},`img${o}`))):r.push(i)}),s("tail"),n}function r9({src:t,alt:e,size:n="md"}){const r=n==="sm"?"h-8 w-8 text-[10px]":"h-9 w-9 text-xs";return a.jsx(Jd,{src:t,name:e,className:ee(r,"shrink-0")})}function gAt({reactions:t,onReact:e}){var i;const n=(i=t==null?void 0:t.details.find(o=>o.isByMe))==null?void 0:i.emoji,r=Nse(n),s=(t==null?void 0:t.details.reduce((o,l)=>o+l.count,0))??0;return a.jsx(uAt,{options:jse,selected:n,onPick:e,children:({openOnTouch:o,trayOpen:l,dismiss:c})=>a.jsxs("button",{type:"button",onClick:()=>{o()||(e(n??Ese),c())},"aria-label":n?`Remove ${r} reaction`:"Like","aria-expanded":l,className:ee("inline-flex h-7 items-center gap-1.5 rounded-md px-1.5 text-xs font-medium transition-colors hover:bg-muted",n?"text-primary hover:text-primary":"text-muted-foreground hover:text-foreground"),children:[n?a.jsx("span",{"aria-hidden":!0,className:"flex h-4 w-4 shrink-0 items-center justify-center text-sm leading-none",children:n}):a.jsx($8,{className:"h-4 w-4 shrink-0"}),a.jsx("span",{children:r}),s>0&&a.jsx("span",{className:"tabular-nums",children:s})]})})}function vAt({reactions:t,onClick:e}){if(!t||t.details.length===0)return null;const n=t.details.reduce((r,s)=>r+s.count,0);return a.jsx("button",{type:"button",onClick:e,disabled:!e,title:"View who reacted",className:"flex items-center rounded-md px-1 py-0.5 text-[10px] text-muted-foreground transition-colors enabled:hover:bg-muted enabled:hover:text-foreground","aria-label":`View ${n} reactions`,children:a.jsx("span",{className:"flex -space-x-1",children:t.details.slice(0,3).map(r=>a.jsx("span",{className:"flex h-4 w-4 items-center justify-center rounded-full border border-background bg-muted text-[10px]",children:r.emoji},r.emoji))})})}function qxr(t,e){var r,s;if(!e)return;const n=t.find(i=>i.realId===e.commentId);if(n)return e.replyId?(s=(r=n.replies)==null?void 0:r.find(i=>i.realId===e.replyId))==null?void 0:s.reactions:n.reactions}function yAt({author:t,authorActions:e}){if(!e||!(t!=null&&t.authorId)||t.isByMe)return null;const n=e.isFollowing(t.authorId);return a.jsx("button",{type:"button",onClick:()=>e.onToggleFollow(t),"aria-label":n?`Unfollow ${t.author}`:`Follow ${t.author}`,className:ee("rounded px-1.5 py-0.5 text-xs font-semibold transition-colors",n?"text-muted-foreground hover:text-foreground":"text-primary hover:bg-primary/10"),children:n?"Following":"Follow"})}function bAt({onEdit:t,onDelete:e,onReport:n,author:r,authorActions:s,deleteDescription:i}){const[o,l]=y.useState(!1),[c,d]=y.useState(!1),[u,h]=y.useState(!1),m=!!(s&&(r!=null&&r.authorId)&&!r.isByMe),f=m?!!(s!=null&&s.isFollowing(r==null?void 0:r.authorId)):!1;return!t&&!e&&!n&&!m?null:a.jsxs(a.Fragment,{children:[a.jsxs(Ni,{open:o,onOpenChange:l,children:[a.jsx(Ti,{asChild:!0,children:a.jsx("button",{type:"button","aria-label":"More comment actions",className:"flex h-5 w-5 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:a.jsx(Ys,{className:"h-3.5 w-3.5"})})}),a.jsxs(yi,{align:"start",className:"w-44 p-1",children:[m&&a.jsxs("button",{type:"button",onClick:()=>{l(!1),s==null||s.onToggleFollow(r)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-foreground hover:bg-muted",children:[f?a.jsx(F8,{className:"h-3.5 w-3.5"}):a.jsx(Sa,{className:"h-3.5 w-3.5"}),a.jsx("span",{className:"truncate",children:f?`Unfollow ${r==null?void 0:r.author}`:`Follow ${r==null?void 0:r.author}`})]}),t&&a.jsxs("button",{type:"button",onClick:()=>{l(!1),t()},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-foreground hover:bg-muted",children:[a.jsx(Qs,{className:"h-3.5 w-3.5"})," Edit"]}),e&&a.jsxs("button",{type:"button",onClick:()=>{l(!1),d(!0)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-destructive hover:bg-destructive/10",children:[a.jsx(qn,{className:"h-3.5 w-3.5"})," Delete"]}),n&&a.jsxs("button",{type:"button",onClick:()=>{l(!1),n()},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-destructive hover:bg-destructive/10",children:[a.jsx(xd,{className:"h-3.5 w-3.5"})," Report"]}),m&&a.jsxs("button",{type:"button",onClick:()=>{l(!1),h(!0)},className:"flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-xs text-destructive hover:bg-destructive/10",children:[a.jsx(mm,{className:"h-3.5 w-3.5"}),a.jsxs("span",{className:"truncate",children:["Block ",r==null?void 0:r.author]})]})]})]}),a.jsx(Kr,{open:c,onOpenChange:d,children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Are you sure?"}),a.jsx(zr,{children:i})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:"Cancel"}),a.jsx(Yr,{onClick:e,children:"Delete"})]})]})}),a.jsx(Kr,{open:u,onOpenChange:h,children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsxs(Ur,{children:["Block ",r==null?void 0:r.author,"?"]}),a.jsx(zr,{children:"You won't see their posts or comments anymore, and they won't be able to message you. You can unblock them from your settings."})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:"Cancel"}),a.jsx(Yr,{onClick:()=>s==null?void 0:s.onBlock(r),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Block"})]})]})})]})}const xAt="flex min-w-0 flex-1 flex-wrap items-center gap-x-1.5 gap-y-0.5",wAt="text-sm font-semibold leading-5 text-foreground [overflow-wrap:anywhere] hover:underline",kAt="shrink-0 rounded bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",SAt="-mt-0.5 flex shrink-0 items-center gap-1",CAt="min-w-0",jAt="-ml-1.5 mt-0.5 flex items-center justify-between",JZ="sm:pr-[4.25rem]";function EAt({onClick:t}){return a.jsx("button",{type:"button","aria-label":"Reply",title:"Reply",onClick:t,className:"flex h-7 items-center justify-center rounded-md px-1 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:a.jsx(wd,{className:"h-4 w-4"})})}function Kxr({reply:t,commentId:e,isPostAuthor:n,onReply:r,onReact:s,onDelete:i,onEdit:o,onReport:l,canModerate:c,onViewReactions:d,authorActions:u}){var w;const[h,m]=y.useState(!1),[f,p]=y.useState(()=>dP(t.text).prose),[g,v]=y.useState(()=>dP(t.text).media),b=()=>{const k=dP(t.text);p(k.prose),v(k.media),m(!0)},x=()=>{const k=ZZ(f,g);k&&k!==t.text&&(o==null||o(e,t.id,k)),m(!1)};return a.jsxs("div",{id:t.realId?`reply-${t.realId}`:void 0,className:"flex scroll-mt-24 gap-2",children:[a.jsx(qd,{userId:t.authorId,title:t.author,className:"shrink-0",children:a.jsx(r9,{src:t.avatar,alt:t.author,size:"sm"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[h?a.jsxs("div",{className:"rounded-lg bg-muted/40 px-3 py-2 space-y-2",children:[a.jsx(qd,{userId:t.authorId,children:a.jsx("p",{className:"text-xs font-semibold text-foreground hover:underline",children:t.author})}),a.jsx(I0e,{urls:[...g,...t.images??[]]}),a.jsx("textarea",{value:f,onChange:k=>p(k.target.value),rows:3,autoFocus:!0,placeholder:g.length>0?"Add a message (optional)":void 0,className:"w-full rounded-md border border-input bg-background px-2 py-1.5 text-xs focus:outline-none focus:ring-2 focus:ring-ring/30 resize-none"}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx(Z,{size:"sm",variant:"ghost",className:"h-7 text-[11px]",onClick:()=>m(!1),children:"Cancel"}),a.jsx(Z,{size:"sm",className:"h-7 text-[11px]",onClick:x,disabled:!ZZ(f,g),children:"Save"})]})]}):a.jsxs("div",{className:CAt,children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsxs("div",{className:xAt,children:[a.jsx(qd,{userId:t.authorId,className:"min-w-0",children:a.jsx("p",{className:wAt,children:t.author})}),n&&a.jsx("span",{className:kAt,children:"Author"})]}),a.jsxs("div",{className:SAt,children:[a.jsx("span",{className:"whitespace-nowrap text-[10px] text-muted-foreground",children:t.time}),a.jsx(yAt,{author:{authorId:t.authorId,author:t.author,isByMe:t.isByMe},authorActions:u}),a.jsx(bAt,{onEdit:t.isByMe&&o?b:void 0,onDelete:t.isByMe||c?()=>i(e,t.id):void 0,onReport:!t.isByMe&&l?()=>l(e,t.id):void 0,author:{authorId:t.authorId,author:t.author,isByMe:t.isByMe},authorActions:u,deleteDescription:"This reply will be permanently removed. This can’t be undone."})]})]}),(((w=t.images)==null?void 0:w.length)??0)>0&&a.jsx("div",{className:ee("mb-2 flex flex-wrap gap-2",JZ),children:(t.images??[]).map((k,S)=>a.jsx("a",{href:k,target:"_blank",rel:"noreferrer",className:"block",children:a.jsx("img",{src:k,alt:"Reply attachment",className:"max-h-40 max-w-[200px] rounded-md border border-border object-contain"})},S))}),a.jsx("div",{className:ee("text-sm text-foreground/90",JZ),children:pAt(t.text)})]}),a.jsxs("div",{className:jAt,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(gAt,{reactions:t.reactions,onReact:k=>s(e,t.id,k)}),r&&a.jsx(EAt,{onClick:r})]}),a.jsx(vAt,{reactions:t.reactions,onClick:t.realId?()=>d==null?void 0:d(String(e),t.realId):void 0})]})]})]})}function Yxr({comment:t,currentUserAvatar:e,replyDraft:n,onReplyDraftChange:r,onSubmitReply:s,onReactComment:i,onDeleteComment:o,onReactReply:l,onDeleteReply:c,onEditReply:d,onEditComment:u,onReportComment:h,onReportReply:m,canDeleteAnyComment:f,canDeleteAnyReply:p,postAuthorId:g,onViewReactions:v,authorActions:b}){var I;const[x,w]=y.useState(!1),k=y.useRef(null),S=()=>{w(!0),requestAnimationFrame(()=>{var P,M;return(M=(P=k.current)==null?void 0:P.querySelector("textarea"))==null?void 0:M.focus()})},[C,j]=y.useState(!1),[E,N]=y.useState(()=>dP(t.text).prose),[A,_]=y.useState(()=>dP(t.text).media),[T,R]=y.useState(()=>t.images??[]),O=t.replies??[],F=()=>{const P=dP(t.text);N(P.prose),_(P.media),R(t.images??[]),j(!0)},D=()=>{var z;const P=ZZ(E,A),M=T.length!==(((z=t.images)==null?void 0:z.length)??0);(P||T.length>0)&&(P!==t.text||M)&&(u==null||u(t.id,P,T)),j(!1)};return a.jsxs("div",{id:t.realId?`comment-${t.realId}`:void 0,className:"flex scroll-mt-24 gap-2",children:[a.jsx(qd,{userId:t.authorId,title:t.author,className:"shrink-0",children:a.jsx(r9,{src:t.avatar,alt:t.author})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[C?a.jsxs("div",{className:"rounded-lg bg-muted/50 px-3 py-2 space-y-2",children:[a.jsx(qd,{userId:t.authorId,children:a.jsx("p",{className:"text-xs font-semibold text-foreground hover:underline",children:t.author})}),a.jsx(I0e,{urls:A,onRemove:P=>_(M=>M.filter(z=>z!==P))}),a.jsx(I0e,{urls:T,onRemove:P=>R(M=>M.filter(z=>z!==P))}),a.jsx("textarea",{value:E,onChange:P=>N(P.target.value),rows:3,autoFocus:!0,placeholder:A.length>0||T.length>0?"Add a message (optional)":void 0,className:"w-full rounded-md border border-input bg-background px-2 py-1.5 text-xs focus:outline-none focus:ring-2 focus:ring-ring/30 resize-none"}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx(Z,{size:"sm",variant:"ghost",className:"h-7 text-[11px]",onClick:()=>j(!1),children:"Cancel"}),a.jsx(Z,{size:"sm",className:"h-7 text-[11px]",onClick:D,disabled:!ZZ(E,A)&&T.length===0,children:"Save"})]})]}):a.jsxs("div",{className:CAt,children:[a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsxs("div",{className:xAt,children:[a.jsx(qd,{userId:t.authorId,className:"min-w-0",children:a.jsx("p",{className:wAt,children:t.author})}),g&&t.authorId===g&&a.jsx("span",{className:kAt,children:"Author"})]}),a.jsxs("div",{className:SAt,children:[a.jsx("span",{className:"whitespace-nowrap text-[10px] text-muted-foreground",children:t.time}),a.jsx(yAt,{author:{authorId:t.authorId,author:t.author,isByMe:t.isByMe},authorActions:b}),a.jsx(bAt,{onEdit:t.isByMe&&u?F:void 0,onDelete:t.isByMe||f?()=>o(t.id):void 0,onReport:!t.isByMe&&h?()=>h(t.id):void 0,author:{authorId:t.authorId,author:t.author,isByMe:t.isByMe},authorActions:b,deleteDescription:"This comment and its replies will be permanently removed. This can’t be undone."})]})]}),(((I=t.images)==null?void 0:I.length)??0)>0&&a.jsx("div",{className:ee("mb-2 flex flex-wrap gap-2",JZ),children:(t.images??[]).map((P,M)=>a.jsx("a",{href:P,target:"_blank",rel:"noreferrer",className:"block",children:a.jsx("img",{src:P,alt:"Comment attachment",className:"max-h-48 max-w-[220px] rounded-md object-contain border border-border"})},M))}),a.jsx("div",{className:ee("text-sm text-foreground/90",JZ),children:pAt(t.text)})]}),t.document&&!C&&a.jsx("div",{className:"mt-1.5 flex flex-wrap gap-2",children:a.jsxs("a",{href:t.document,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-2 rounded-md border border-border bg-muted/40 px-2.5 py-1.5 text-xs text-foreground hover:bg-muted transition-colors",children:[a.jsx(Ei,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"truncate max-w-[160px]",children:t.documentName||"Attached document"})]})}),a.jsxs("div",{className:jAt,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(gAt,{reactions:t.reactions,onReact:P=>i(t.id,P)}),a.jsx(EAt,{onClick:()=>w(P=>!P)})]}),a.jsx(vAt,{reactions:t.reactions,onClick:t.realId?()=>v==null?void 0:v(t.realId):void 0})]}),O.length>0&&a.jsx("div",{className:"mt-3 space-y-3 border-l border-border pl-3",children:O.map(P=>a.jsx(Kxr,{canModerate:p,reply:P,commentId:t.id,isPostAuthor:!!(g&&P.authorId===g),onReply:S,onReact:l,onDelete:c,onEdit:d,onReport:m,authorActions:b,onViewReactions:t.realId?(M,z)=>v==null?void 0:v(t.realId,z):void 0},P.id))}),x&&a.jsx("div",{ref:k,children:a.jsx(Qxr,{avatar:e,value:n,onChange:P=>r(t.id,P),onSubmit:(P,M)=>s(t.id,P,M)})})]})]})}function NAt(t,e,n){const{community:r}=qe(),s=(r==null?void 0:r.id)??null,[i,o]=y.useState(null),c=fPe(s,i).users.slice(0,6);return{mentionQuery:i,setMentionQuery:o,mentionResults:c,detectMention:(h,m)=>{const p=h.slice(0,m).match(/(?:^|\s)@([\w.]*)$/);o(p?p[1]:null)},insertMention:h=>{const m=n.current,f=(m==null?void 0:m.selectionStart)??t.length,p=t.slice(0,f).replace(/@([\w.]*)$/,`@${h} `),g=p+t.slice(f);e(g),o(null),requestAnimationFrame(()=>{m==null||m.focus();const v=p.length;m==null||m.setSelectionRange(v,v)})}}}function TAt({open:t,anchorRef:e,results:n,onPick:r}){return a.jsxs(Tje,{open:t,children:[a.jsx(Ydt,{virtualRef:e}),a.jsx(_je,{children:a.jsx(ste,{side:"top",align:"start",sideOffset:4,collisionPadding:8,onOpenAutoFocus:s=>s.preventDefault(),onCloseAutoFocus:s=>s.preventDefault(),className:"z-50 w-64 overflow-hidden rounded-md border border-border bg-popover shadow-md",children:n.map(s=>a.jsxs("button",{type:"button",onMouseDown:i=>i.preventDefault(),onClick:()=>r(s.userId||s.name),className:"flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted",children:[a.jsx(Jd,{src:s.picture??void 0,name:s.name,className:"h-6 w-6 text-[9px]"}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-sm font-medium text-foreground",children:s.name}),s.userId&&a.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:["@",s.userId]})]})]},s.id))})})]})}function Qxr({avatar:t,value:e,onChange:n,onSubmit:r}){const s=y.useRef(null),i=y.useRef(null),[o,l]=y.useState(!1),[c,d]=y.useState(!1),[u,h]=y.useState(null),[m,f]=y.useState([]),p=y.useRef(null),{mentionQuery:g,setMentionQuery:v,mentionResults:b,detectMention:x,insertMention:w}=NAt(e,n,s),k=E=>{n(pPe(s.current,e,E)??e),l(!1)},S=e.trim().length>0||!!u||m.length>0,C=()=>{if(!S)return;const E=[u,e.trim()].filter(Boolean).join(`
`);r(E,m),h(null),f([]),v(null)},j=E=>{if(!E)return;const N=Array.from(E).filter(A=>A.type.startsWith("image/"));f(A=>[...A,...N].slice(0,hAt))};return a.jsxs("div",{className:"mt-2 flex gap-2",children:[a.jsx(r9,{src:t,alt:"",size:"sm"}),a.jsxs("div",{className:"min-w-0 flex-1 space-y-1",children:[(u||m.length>0)&&a.jsxs("div",{className:"flex flex-wrap gap-2 pb-1","aria-label":"Reply media preview",children:[u&&a.jsxs("div",{className:"relative overflow-hidden rounded-lg border border-border bg-muted/30",children:[a.jsx("img",{src:u,alt:"Selected reply GIF",className:"max-h-44 max-w-full object-contain"}),a.jsx("button",{type:"button","aria-label":"Remove reply GIF",onClick:()=>h(null),className:"absolute right-1.5 top-1.5 flex h-6 w-6 items-center justify-center rounded-full bg-black/70 text-white hover:bg-black/85",children:a.jsx(nn,{className:"h-3.5 w-3.5"})})]}),m.map((E,N)=>a.jsx(fAt,{file:E,index:N,onRemove:()=>f(A=>A.filter((_,T)=>T!==N))},`${E.name}-${E.lastModified}-${N}`))]}),a.jsxs("div",{ref:i,className:"relative flex gap-2",children:[a.jsx(TAt,{open:g!==null&&b.length>0,anchorRef:i,results:b,onPick:w}),a.jsx(Pse,{ref:s,placeholder:"Write a reply…",value:e,autoFocus:!0,onChange:E=>{n(E.target.value),x(E.target.value,E.target.selectionStart??E.target.value.length)},onKeyUp:E=>x(E.currentTarget.value,E.currentTarget.selectionStart??0),onKeyDown:E=>{if(E.key==="Enter"&&!E.shiftKey&&g!==null&&b.length>0){E.preventDefault(),w(b[0].userId||b[0].name);return}E.key==="Escape"&&g!==null&&v(null)},onBlur:()=>setTimeout(()=>v(null),150),className:"flex-1 rounded-2xl border border-input bg-background px-3 py-1.5 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/30"}),a.jsx(Z,{size:"sm",className:"shrink-0 rounded-full",onClick:C,disabled:!S,"aria-label":"Send reply",children:a.jsx(_s,{className:"h-3.5 w-3.5"})})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs(Ni,{open:o,onOpenChange:l,children:[a.jsx(Ti,{asChild:!0,children:a.jsx("button",{type:"button",title:"Emoji",onMouseDown:E=>E.preventDefault(),className:"h-6 w-6 flex items-center justify-center rounded-full text-muted-foreground hover:bg-muted transition-colors",children:a.jsx(Hx,{className:"h-3.5 w-3.5"})})}),a.jsx(yi,{align:"start",className:"w-auto p-0",onCloseAutoFocus:E=>{var N;E.preventDefault(),(N=s.current)==null||N.focus()},children:a.jsx($g,{onPick:k})})]}),a.jsxs(Ni,{open:c,onOpenChange:d,children:[a.jsx(Ti,{asChild:!0,children:a.jsx("button",{type:"button",title:"GIF",onMouseDown:E=>E.preventDefault(),className:"h-6 px-1 flex items-center justify-center rounded-full text-muted-foreground hover:bg-muted transition-colors",children:a.jsx("span",{className:"rounded border border-muted-foreground/60 px-1 text-[9px] font-bold",children:"GIF"})})}),a.jsx(yi,{align:"start",className:"w-auto p-2",children:a.jsx(CM,{onPick:E=>{h(E),d(!1),requestAnimationFrame(()=>{var N;return(N=s.current)==null?void 0:N.focus()})}})})]}),a.jsx("button",{type:"button",title:"Add image to reply",onMouseDown:E=>E.preventDefault(),onClick:()=>{var E;return(E=p.current)==null?void 0:E.click()},className:"h-6 w-6 flex items-center justify-center rounded-full text-muted-foreground hover:bg-muted transition-colors",children:a.jsx(Jl,{className:"h-3.5 w-3.5"})}),a.jsx("input",{ref:p,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:E=>{j(E.target.files),E.target.value=""}})]})]})]})}function _At({avatar:t,value:e,onChange:n,onSubmit:r,revealActionsOnFocus:s=!1,autoFocus:i=!1}){const[o,l]=y.useState(i),c=y.useRef(null),d=()=>{c.current&&clearTimeout(c.current),c.current=null,l(!0)},u=()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>l(!1),250)};y.useEffect(()=>()=>{c.current&&clearTimeout(c.current)},[]);const[h,m]=y.useState([]),[f,p]=y.useState(null),[g,v]=y.useState(!1),[b,x]=y.useState(!1),w=y.useRef(null),k=y.useRef(null),S=y.useRef(null),{mentionQuery:C,setMentionQuery:j,mentionResults:E,detectMention:N,insertMention:A}=NAt(e,n,k),_=F=>{n(pPe(k.current,e,F)??e),v(!1)},T=e.trim().length>0||h.length>0||!!f,R=F=>{if(!F)return;const D=Array.from(F).filter(I=>I.type.startsWith("image/"));m(I=>[...I,...D].slice(0,hAt))},O=()=>{if(!T)return;const F=[f,e.trim()].filter(Boolean).join(`
`);r(F,{images:h,document:null}),m([]),p(null),j(null)};return a.jsxs("div",{className:"p-3 flex gap-2 border-b border-border",children:[a.jsx(r9,{src:t,alt:""}),a.jsxs("div",{className:"min-w-0 flex-1 space-y-2",children:[(f||h.length>0)&&a.jsxs("div",{className:"flex flex-wrap gap-2","aria-label":"Comment media preview",children:[f&&a.jsxs("div",{className:"relative overflow-hidden rounded-lg border border-border bg-muted/30",children:[a.jsx("img",{src:f,alt:"Selected GIF",className:"max-h-52 max-w-full object-contain"}),a.jsx("button",{type:"button","aria-label":"Remove GIF",onClick:()=>p(null),className:"absolute right-1.5 top-1.5 flex h-6 w-6 items-center justify-center rounded-full bg-black/70 text-white hover:bg-black/85",children:a.jsx(nn,{className:"h-3.5 w-3.5"})})]}),h.map((F,D)=>a.jsx(fAt,{file:F,index:D,onRemove:()=>m(I=>I.filter((P,M)=>M!==D))},`${F.name}-${F.lastModified}-${D}`))]}),a.jsxs("div",{ref:S,className:"relative flex gap-2",children:[a.jsx(TAt,{open:C!==null&&E.length>0,anchorRef:S,results:E,onPick:A}),a.jsx(Pse,{ref:k,placeholder:"Write a comment…",value:e,onChange:F=>{n(F.target.value),N(F.target.value,F.target.selectionStart??F.target.value.length)},onKeyUp:F=>N(F.currentTarget.value,F.currentTarget.selectionStart??0),onKeyDown:F=>{if(F.key==="Enter"&&!F.shiftKey&&C!==null&&E.length>0){F.preventDefault(),A(E[0].userId||E[0].name);return}F.key==="Escape"&&C!==null&&j(null)},autoFocus:i,onFocus:d,onBlur:()=>{setTimeout(()=>j(null),150),u()},className:"flex-1 rounded-2xl border border-input bg-background px-3 py-1.5 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/30"}),a.jsx(Z,{size:"sm",className:"shrink-0 rounded-full",onClick:O,disabled:!T,"aria-label":"Send comment",children:a.jsx(_s,{className:"h-3.5 w-3.5"})})]}),(!s||o||g||b||!!e||h.length>0||!!f)&&a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs(Ni,{open:g,onOpenChange:v,children:[a.jsx(Ti,{asChild:!0,children:a.jsx("button",{type:"button",title:"Emoji",onMouseDown:F=>F.preventDefault(),className:"h-7 w-7 flex items-center justify-center rounded-full text-muted-foreground hover:bg-muted transition-colors",children:a.jsx(Hx,{className:"h-4 w-4"})})}),a.jsx(yi,{align:"start",className:"w-auto p-0",onCloseAutoFocus:F=>{var D;F.preventDefault(),(D=k.current)==null||D.focus()},children:a.jsx($g,{onPick:_})})]}),a.jsxs(Ni,{open:b,onOpenChange:x,children:[a.jsx(Ti,{asChild:!0,children:a.jsx("button",{type:"button",title:"GIF",onMouseDown:F=>F.preventDefault(),className:"h-7 px-1.5 flex items-center justify-center rounded-full text-muted-foreground hover:bg-muted transition-colors",children:a.jsx("span",{className:"rounded border border-muted-foreground/60 px-1 text-[10px] font-bold",children:"GIF"})})}),a.jsx(yi,{align:"start",className:"w-auto p-2",children:a.jsx(CM,{onPick:F=>{p(F),x(!1),requestAnimationFrame(()=>{var D;return(D=k.current)==null?void 0:D.focus()})}})})]}),a.jsx("button",{type:"button",title:"Add image",onMouseDown:F=>F.preventDefault(),onClick:()=>{var F;return(F=w.current)==null?void 0:F.click()},className:"h-7 w-7 flex items-center justify-center rounded-full text-muted-foreground hover:bg-muted transition-colors",children:a.jsx(Jl,{className:"h-4 w-4"})})]}),a.jsx("input",{ref:w,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:F=>{R(F.target.files),F.target.value=""}})]})]})}function AAt({comments:t,postId:e,postAuthorId:n,currentUserAvatar:r,commentText:s,onCommentTextChange:i,onSubmitComment:o,onSubmitRichComment:l,replyDrafts:c,onReplyDraftChange:d,onSubmitReply:u,onReactComment:h,onDeleteComment:m,onReactReply:f,onDeleteReply:p,onEditReply:g,onEditComment:v,onReportComment:b,onReportReply:x,canDeleteAnyComment:w,canDeleteAnyReply:k,authorActions:S,hideComposer:C=!1,sort:j,onSortChange:E,totalComments:N,hasMoreComments:A=!1,isLoadingMoreComments:_=!1,onLoadMoreComments:T,onViewAllComments:R}){const[O,F]=y.useState(null);return a.jsxs("div",{className:"border-t border-border",children:[C?null:l?a.jsx(_At,{avatar:r,value:s,onChange:i,onSubmit:l}):a.jsxs("div",{className:"p-3 flex gap-2 border-b border-border",children:[a.jsx(r9,{src:r,alt:""}),a.jsxs("div",{className:"flex min-w-0 flex-1 gap-2",children:[a.jsx(Pse,{placeholder:"Write a comment…",value:s,onChange:D=>i(D.target.value),className:"flex-1 rounded-2xl border border-input bg-background px-3 py-1.5 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/30"}),a.jsx(Z,{size:"sm",className:"shrink-0 rounded-full",onClick:o,disabled:!s.trim(),children:a.jsx(_s,{className:"h-3.5 w-3.5"})})]})]}),E&&Math.max(t.length,N??0)>1&&a.jsx("div",{className:"flex items-center justify-end gap-1 px-3 pt-2",children:Wxr.map(D=>a.jsx(uAe,{hint:D.hint,side:"top",children:a.jsx("button",{type:"button","aria-pressed":j===D.value,onClick:()=>E(D.value),className:ee("rounded-md px-2 py-1 text-xs font-medium transition-colors",j===D.value?"bg-muted text-foreground":"text-muted-foreground hover:bg-muted hover:text-foreground"),children:D.label})},D.value))}),t.length===0?a.jsx("p",{className:"p-4 text-center text-xs text-muted-foreground",children:"No comments yet. Be the first to comment."}):a.jsxs("div",{className:"p-3 space-y-4",children:[t.map(D=>a.jsx(Yxr,{comment:D,postAuthorId:n,currentUserAvatar:r,replyDraft:c[D.id]??"",onReplyDraftChange:d,onSubmitReply:u,onReactComment:h,onDeleteComment:m,onReactReply:f,onDeleteReply:p,onEditReply:g,onEditComment:v,onReportComment:b,onReportReply:x,canDeleteAnyComment:w,canDeleteAnyReply:k,authorActions:S,onViewReactions:(I,P)=>F({commentId:I,replyId:P})},D.id)),A&&(T||R)&&a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-x-3 gap-y-1",children:[T&&a.jsxs("button",{type:"button",onClick:T,disabled:_,className:"flex items-center gap-1.5 px-2 py-1 text-xs font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-60",children:[_&&a.jsx(Ne,{className:"h-3 w-3 animate-spin"}),_?"Loading…":"Load more comments"]}),R&&N!==void 0&&N>t.length&&a.jsx("button",{type:"button",onClick:R,className:"px-2 py-1 text-xs font-medium text-primary hover:underline",children:`View all ${N} comment${N===1?"":"s"}`})]})]}),a.jsx(yq,{open:!!O,postRealId:e??null,comment:O,likeCount:0,reactions:qxr(t,O),onOpenChange:D=>{D||F(null)}})]})}function SPe({startTime:t,endTime:e,className:n,meetingUnavailable:r}){const s=_ge(t,e,r);return s?s==="live"?a.jsxs(ga,{variant:"secondary",className:ee("text-[10px] px-1.5 py-0 gap-1 bg-destructive/10 text-destructive",n),children:[a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-destructive animate-pulse"}),"Live now"]}):s==="ended"?a.jsx(ga,{variant:"secondary",className:ee("text-[10px] px-1.5 py-0 bg-[hsl(var(--warning))]/15 text-[hsl(var(--warning))]",n),children:"Ended"}):a.jsx(ga,{variant:"secondary",className:ee("text-[10px] px-1.5 py-0 bg-primary/10 text-primary",n),children:"Upcoming"}):null}function Zxr(t){return`${window.location.origin}${ve.meeting(t)}`}function M0e(t){return ve.meeting(t)}function Jxr(t){return t.split(" ").map(e=>e[0]).filter(Boolean).slice(0,2).join("").toUpperCase()}function Xxr({event:t,variant:e="feed"}){const n=Nn(),r=Nk(t),s=e==="feed",i=d0(t.thumbnail)??t.thumbnail,o=Date.now(),l=!t.meetingUnavailable&&new Date(t.startTime).getTime()<=o&&o<=new Date(t.endTime).getTime(),c=t.liveCallMeetingId?{kind:"meeting",to:M0e(t.liveCallMeetingId)}:t.webURL?{kind:"external",to:t.webURL}:null,d=l&&t.isOnline&&!!c,u=h=>{if(h.stopPropagation(),t.passwordRequired&&!t.entryVerified){n(r);return}c&&(c.kind==="meeting"?n(c.to):window.open(c.to,"_blank","noopener,noreferrer"))};return a.jsxs(it.div,{whileHover:s?void 0:{scale:1.005},onClick:()=>n(r),className:ee("cursor-pointer transition-all",s?"rounded-xl border border-border/60 bg-muted/20 hover:border-border hover:bg-muted/30":"mt-3 overflow-hidden rounded-lg border border-border bg-card hover:shadow-md hover:border-primary/20",e==="compact"&&"mt-2 overflow-hidden rounded-lg border border-border bg-card"),children:[t.hasBanner&&i&&a.jsx("div",{className:ee(s?"px-3 pt-3":"w-full overflow-hidden bg-muted"),children:a.jsx("div",{className:ee("overflow-hidden bg-muted",s?"aspect-[2/1] max-h-72 rounded-lg":"aspect-[2.6/1] max-h-36"),children:a.jsx("img",{src:i,alt:"",className:"h-full w-full rounded-lg object-cover"})})}),a.jsxs("div",{className:ee(s?"space-y-2.5 px-5 py-4":"space-y-2 p-4"),children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx(SPe,{startTime:t.startTime,endTime:t.endTime,meetingUnavailable:t.meetingUnavailable}),t.isPrivate&&a.jsx(ga,{variant:"outline",className:"text-[10px]",children:"Private"})]}),a.jsx("h3",{className:ee("font-semibold text-foreground leading-snug",s?"text-base":"text-sm"),children:t.title}),a.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1.5",children:[a.jsx(ym,{className:"h-3.5 w-3.5 shrink-0"}),vte(t.startTime,t.endTime)]}),t.location&&t.location!=="Online"&&a.jsxs("p",{className:"text-xs text-muted-foreground flex items-center gap-1.5",children:[a.jsx(Jf,{className:"h-3.5 w-3.5 shrink-0"}),t.location]}),a.jsxs("div",{className:"flex items-center justify-between pt-1",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(oo,{className:"h-6 w-6",children:[a.jsx(lo,{src:t.organizerAvatar}),a.jsx(co,{className:"text-[8px] bg-primary/10 text-primary",children:Jxr(t.organiser)})]}),a.jsx("span",{className:"text-xs text-muted-foreground",children:t.organiser})]}),t.attendees>0&&a.jsxs("span",{className:"text-xs text-muted-foreground flex items-center gap-1",children:[a.jsx(wr,{className:"h-3 w-3"}),t.attendees]})]}),d&&a.jsxs("button",{type:"button",onClick:u,className:"mt-1 inline-flex w-full items-center justify-center gap-1.5 rounded-md bg-destructive py-2 text-sm font-medium text-destructive-foreground hover:bg-destructive/90 transition-colors",children:[a.jsx(wk,{className:"h-4 w-4"})," Join now"]})]})]})}function e0r(t){if(!t)return!1;const e=new Date(t).getTime();return Number.isFinite(e)&&e<=Date.now()}const t0r=t=>t.charAt(0).toUpperCase()+t.slice(1);function n0r({quiz:t,postRealId:e}){const[n,r]=y.useState(t),[s,i]=y.useState({}),[o,l]=y.useState(!1),[c,d]=y.useState(null),u=y.useRef(Date.now()),h=e0r(n.endTime),m=n.myAnswers!==null,f=m||h,p=n.questions.length,g=Object.keys(s).length,v=m?n.questions.filter(w=>{var k;return w.answer!=null&&((k=n.myAnswers)==null?void 0:k[w.id])===w.answer}).length:0,b=async()=>{var k,S;if(!e||o||g===0)return;l(!0),d(null);const w=n.questions.filter(C=>s[C.id]!=null).map(C=>({question:C.id,option:s[C.id]}));try{const C=await Ivr(e,w,Math.round((Date.now()-u.current)/1e3)),j=r_t((k=C==null?void 0:C.post)==null?void 0:k.poll),E={};for(const _ of n.questions)E[_.id]=s[_.id]??null;const N=j&&j.myAnswers?j:{...n,myAnswers:E,answersCount:n.answersCount+1},A=new Map((((S=C==null?void 0:C.result)==null?void 0:S.answers)??[]).map(_=>[String(_.question),_.correctOption??void 0]));r({...N,questions:N.questions.map(_=>({..._,answer:_.answer??A.get(_.id)}))})}catch(C){d(C instanceof ze?C.message:"Could not submit your answers. Try again.")}finally{l(!1)}},x=h?"Ended":n.endTime?t0r(n_t(n.endTime)):"";return a.jsx("div",{className:"PostQuiz my-4",children:a.jsxs("div",{className:"space-y-4 rounded-xl border border-primary/20 bg-gradient-to-br from-primary/5 to-transparent p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[a.jsx(k0,{className:"h-3.5 w-3.5 text-primary"}),a.jsxs("span",{className:"font-medium",children:["Quiz • ",p," question",p===1?"":"s",x&&` • ${x}`]}),n.answersCount>0&&a.jsxs("span",{className:"ml-auto",children:[n.answersCount," attempt",n.answersCount===1?"":"s"]})]}),n.title&&a.jsx("p",{className:"text-sm font-semibold text-foreground",children:n.title}),n.instructions&&a.jsx("p",{className:"whitespace-pre-line text-xs text-muted-foreground",children:n.instructions}),m&&a.jsxs("div",{className:"rounded-lg bg-primary/10 px-3 py-2 text-sm font-semibold text-primary",role:"status",children:["You scored ",v," / ",p]}),!m&&h&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"This quiz has ended. Correct answers are shown below."}),a.jsx("ol",{className:"space-y-4",children:n.questions.map((w,k)=>{var C;const S=m?((C=n.myAnswers)==null?void 0:C[w.id])??null:null;return a.jsxs("li",{className:"space-y-2",children:[a.jsxs("p",{className:"text-sm font-medium text-foreground",children:[k+1,". ",w.statement]}),m&&S==null&&a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Skipped"}),a.jsx("div",{className:"space-y-1.5",role:f?void 0:"radiogroup",children:w.options.map((j,E)=>{const N=f?S===j:s[w.id]===j,A=f&&w.answer!=null&&j===w.answer,_=f&&N&&!A;return a.jsxs("button",{type:"button",role:f?void 0:"radio","aria-checked":f?void 0:N,disabled:f,onClick:()=>i(T=>({...T,[w.id]:j})),className:ee("flex w-full items-center gap-2 rounded-lg border px-3 py-2 text-left text-sm transition-colors",A?"border-green-500/60 bg-green-500/10 text-foreground":_?"border-destructive/60 bg-destructive/10 text-foreground":N?"border-primary bg-primary/10 text-primary":"border-border text-foreground",!f&&!N&&"cursor-pointer hover:border-primary/50 hover:bg-primary/5"),children:[a.jsx("span",{className:ee("flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 text-[10px]",N&&!f?"border-primary bg-primary text-primary-foreground":"border-muted-foreground/30"),children:String.fromCharCode(65+E)}),a.jsx("span",{className:"min-w-0 flex-1 break-words",children:j}),A&&a.jsx(Qn,{className:"h-4 w-4 shrink-0 text-green-600","aria-label":"Correct answer"}),_&&a.jsx(nn,{className:"h-4 w-4 shrink-0 text-destructive","aria-label":"Your answer"})]},E)})})]},w.id)})}),!f&&a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("span",{className:"text-[11px] text-muted-foreground",children:[g," / ",p," answered · one attempt only"]}),a.jsxs(Z,{size:"sm",onClick:()=>void b(),disabled:!e||o||g===0,children:[o&&a.jsx(Ne,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Submit answers"]})]}),c&&a.jsx("p",{className:"text-xs text-destructive",role:"alert",children:c})]})})}const r0r={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.05}}},Ph={hidden:{opacity:0,y:8},show:{opacity:1,y:0}},s0r=3e3,L0e=50,FHe=new Set;let _$=new Set,A$=null,BHe=!1;function i0r(t){t.length!==0&&_vr(t).catch(()=>{})}function XZ(){if(A$&&(clearTimeout(A$),A$=null),_$.size===0)return;const t=[..._$];_$=new Set;for(let e=0;e<t.length;e+=L0e)i0r(t.slice(e,e+L0e))}function a0r(){BHe||typeof document>"u"||(BHe=!0,document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&XZ()}),window.addEventListener("pagehide",XZ))}function o0r(t){if(!(!t||FHe.has(t))){if(FHe.add(t),_$.add(t),a0r(),_$.size>=L0e){XZ();return}A$||(A$=setTimeout(XZ,s0r))}}const D3="flex min-w-0 flex-1 flex-col items-center justify-center gap-0.5 rounded-lg px-1 py-1.5 text-[11px] font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground active:bg-muted/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/40 sm:flex-row sm:gap-1.5 sm:px-2.5 sm:text-xs";function PAt({post:t,variant:e="feed",hideMenu:n=!1,onOpen:r,commentSlot:s,expanded:i,isCommenting:o,commentText:l,currentUserAvatar:c,canPin:d,canFeature:u,isFeatured:h,isCommentsLoading:m,onToggleExpand:f,onLike:p,onReact:g,onViewAnalytics:v,onSave:b,onShare:x,onHide:w,onReport:k,onReportUser:S,onToggleFollow:C,isFollowingAuthor:j,onBlockAuthor:E,onRepost:N,onSend:A,onTopicClick:_,onChannelClick:T,onPin:R,onFeature:O,canMove:F,onMove:D,onEdit:I,onDelete:P,onLoadComments:M,onComment:z,onCommentTextChange:G,onSubmitComment:B,onSubmitRichComment:H,onVotePoll:W}){var ms,is,ke;const V=xCt(t.realId,t.poll),U=y.useMemo(()=>V?yCt(V):[],[V]),ne=y.useMemo(()=>V?$_e(V,V.votedOption!==null||!jj(V)):[],[V]),te=t.quiz,{hideComment:re=!1,hideLikes:fe=!1,hideCreator:le=!1,hideDate:q=!1}=t.preferences??{},Y=!le&&!q,X=le?"author":t.author,Q=t.event??((ms=t.shared)==null?void 0:ms.event)??null,ie=BTt(t),he=t.liveCall??((is=t.shared)==null?void 0:is.liveCall)??null,ye=e==="detail",[J,K]=y.useState(!1),[ce,pe]=y.useState(!1),[Ie,Me]=y.useState(!1),[we,Be]=y.useState(!1),Ve=t.scheduledPublishAt?new Date(t.scheduledPublishAt):null,be=Ve&&!Number.isNaN(Ve.getTime())?Ve.getTime():null,[Ze,Pe]=y.useState(()=>Date.now()),Ke=!!(be&&be>Ze);y.useEffect(()=>{if(!be||be<=Ze)return;const at=Math.min(be-Date.now()+500,2147483647),Tt=setTimeout(()=>Pe(Date.now()),Math.max(at,0));return()=>clearTimeout(Tt)},[be,Ze]);const De=t.reposts??0,xt=y.useRef(null),Xe=t.realId;y.useEffect(()=>{const at=xt.current;if(!Xe||!at||typeof IntersectionObserver>"u")return;let Tt=null;const An=new IntersectionObserver(Pn=>{var yn;(yn=Pn[0])!=null&&yn.isIntersecting?Tt||(Tt=setTimeout(()=>o0r(Xe),1e3)):Tt&&(clearTimeout(Tt),Tt=null)},{threshold:.5});return An.observe(at),()=>{Tt&&clearTimeout(Tt),An.disconnect()}},[Xe]);const tt=t2(t.reactions),$e=!!tt||t.liked,wt=tt?Nse(tt):"Like",Ee=Bxr(t.reactions),Ge=Uxr(t.likes,t.latestLikes,$e),Pt=[];!re&&t.comments>0&&Pt.push({key:"comments",label:t.comments===1?"1 comment":`${t.comments} comments`,onClick:z,expanded:o}),De>0&&Pt.push({key:"reposts",label:`${De} ${De===1?"repost":"reposts"}`,onClick:t.realId?()=>Me(!0):void 0});const vn=!fe&&t.likes>0,Hn=vn||Pt.length>0,yr=!!r&&!ye,br=at=>{yr&&(at.target.closest("a")||r==null||r())},Yt=t.images&&t.images.length>0?t.images:t.image?[t.image]:[],nr=!ye&&!i&&t.body.split(`
`).length>9,Kn=t.author;return a.jsxs(it.div,{ref:xt,variants:Ph,className:"mb-4","data-post-id":t.realId??String(t.id),children:[a.jsxs("div",{className:ee("overflow-hidden rounded-xl border border-border/60 bg-card shadow-sm",!t.banner&&!Q&&"pt-px"),children:[t.banner&&a.jsx("img",{src:d0(t.banner)??t.banner,alt:"",className:"w-full rounded-t-xl object-contain object-center"}),a.jsxs("div",{className:"px-6 pt-5 pb-4",children:[t.followedActivity&&a.jsxs("div",{className:"-mx-6 -mt-2 mb-3 flex min-w-0 items-center gap-2 border-b border-border/60 px-6 pb-2.5 text-xs text-muted-foreground",children:[a.jsx(qd,{userId:t.followedActivity.userId,title:t.followedActivity.name,className:"shrink-0",children:a.jsx(Jd,{src:t.followedActivity.avatar,name:t.followedActivity.name,className:"h-5 w-5 text-[8px]"})}),a.jsxs("p",{className:"min-w-0 truncate",children:[a.jsx(qd,{userId:t.followedActivity.userId,className:"font-semibold text-foreground hover:underline",children:t.followedActivity.name})," ",t.followedActivity.kind==="comment"?"commented on this":t.followedActivity.kind==="reaction"?"reacted to this":"likes this"]})]}),a.jsxs("div",{className:"mb-3 flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"flex min-w-0 flex-1 items-start gap-3 overflow-hidden",children:[!le&&a.jsx(qd,{userId:t.authorId,title:t.author,className:"shrink-0",children:a.jsx(Jd,{src:t.avatar,name:t.author,className:"h-10 w-10 shrink-0 cursor-pointer text-sm ring-2 ring-background"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[!le&&a.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[a.jsx(qd,{userId:t.authorId,className:"min-w-0",children:a.jsx("p",{className:"truncate text-sm font-semibold leading-5 text-foreground hover:underline",children:Kn})}),t.authorIsAdmin&&a.jsx(ZTt,{})]}),!le&&a.jsx(JTt,{headline:t.authorBio,title:t.authorTitle,location:t.authorLocation}),Ke&&(()=>{const at=a.jsxs(a.Fragment,{children:[a.jsx(ja,{className:"h-3 w-3 shrink-0"}),a.jsxs("span",{className:"truncate",children:["Scheduled · ",i_t(Ve)]})]}),Tt="mt-0.5 inline-flex items-center gap-1 rounded-full border border-primary/30 bg-primary/10 px-2 py-0.5 text-[10px] font-medium text-primary";return t.canEdit&&I?a.jsx("button",{type:"button",onClick:I,title:`Publishes ${vd(Ve)} — click to change`,"aria-label":`Scheduled for ${vd(Ve)}. Change the schedule`,className:ee(Tt,"transition-colors hover:bg-primary/20"),children:at}):a.jsx("span",{title:`Publishes ${vd(Ve)}`,className:Tt,children:at})})(),a.jsxs("p",{className:"flex min-w-0 flex-wrap items-center gap-x-1.5 text-xs leading-[18px] text-muted-foreground/90",children:[Y&&!Ke&&a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"shrink-0",children:t.time}),a.jsx("span",{"aria-hidden":!0,className:"shrink-0 text-muted-foreground/50",children:"·"})]}),a.jsxs("span",{className:"min-w-0 max-w-full truncate",title:t.channel,children:[t.shared&&a.jsxs("span",{className:"inline-flex items-center gap-1 font-medium text-foreground/70",children:[a.jsx(LA,{className:"h-3 w-3","aria-hidden":!0}),"Reposted"]}),t.shared?" in ":"in ",T?a.jsx("button",{type:"button",onClick:T,className:"cursor-pointer font-medium hover:text-primary hover:underline",children:t.channel}):a.jsx("span",{className:"cursor-pointer font-medium hover:text-primary",children:t.channel})]})]})]})]}),a.jsxs("div",{className:"PostMenuActions flex shrink-0 items-center gap-1 text-secondary-foreground",children:[!t.isByMe&&!le&&C&&a.jsxs("button",{type:"button",onClick:C,"aria-pressed":!!j,"aria-label":j?`Unfollow ${X}`:`Follow ${X}`,title:j?`Unfollow ${X}`:`Follow ${X}`,className:ee("flex items-center gap-1 rounded-full px-2.5 py-1 text-sm font-semibold transition-colors",j?"text-muted-foreground hover:bg-muted hover:text-foreground":"text-primary hover:bg-primary/10"),children:[j?a.jsx(Qn,{className:"h-4 w-4","aria-hidden":!0}):a.jsx(Dn,{className:"h-4 w-4","aria-hidden":!0}),j?a.jsx("span",{className:"hidden sm:inline",children:"Following"}):"Follow"]}),t.isPinned&&a.jsx("button",{type:"button",onClick:d?R:void 0,disabled:!d,title:d?"Unpin post":"Pinned",className:ee("flex h-8 w-8 items-center justify-center rounded bg-primary text-primary-foreground",d&&"hover:bg-primary/90"),children:a.jsx(xk,{className:"h-4 w-4 fill-current"})}),!n&&a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx("button",{type:"button",className:"text-muted-foreground hover:text-foreground transition-colors",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[a.jsxs(ot,{onClick:b,children:[a.jsx(hBt,{className:"h-4 w-4 mr-2"}),t.saved?"Unsave post":"Save post"]}),a.jsxs(ot,{onSelect:()=>x(),children:[a.jsx(kk,{className:"h-4 w-4 mr-2"}),"Copy link"]}),N&&!t.shared&&(Q||fe&&re)&&a.jsxs(ot,{onClick:N,disabled:t.reposted,children:[a.jsx(LA,{className:"h-4 w-4 mr-2"}),t.reposted?"Reposted":"Repost"]}),t.canEdit&&I&&a.jsxs(ot,{onClick:I,children:[a.jsx(Qs,{className:"h-4 w-4 mr-2"}),"Edit post"]}),v&&(t.isByMe||t.canEdit)&&a.jsxs(ot,{onClick:v,children:[a.jsx(Fc,{className:"h-4 w-4 mr-2"}),"View analytics"]}),d&&a.jsxs(ot,{onClick:R,children:[t.isPinned?a.jsx(xSe,{className:"h-4 w-4 mr-2"}):a.jsx(xk,{className:"h-4 w-4 mr-2"}),t.isPinned?"Unpin post":"Pin post"]}),u&&a.jsxs(ot,{onClick:O,children:[h?a.jsx(v9t,{className:"h-4 w-4 mr-2"}):a.jsx(SSe,{className:"h-4 w-4 mr-2"}),h?"Remove from featured posts":"Add to featured posts"]}),F&&D&&a.jsxs(ot,{onClick:D,children:[a.jsx(fO,{className:"h-4 w-4 mr-2"}),"Move post"]}),a.jsx(mi,{}),a.jsxs(ot,{onClick:w,children:[a.jsx(BP,{className:"h-4 w-4 mr-2"}),"Hide post"]}),!t.isByMe&&a.jsxs(ot,{onClick:k,className:"text-destructive focus:text-destructive",children:[a.jsx(xd,{className:"h-4 w-4 mr-2"}),"Report post"]}),!t.isByMe&&S&&a.jsxs(ot,{onClick:S,className:"text-destructive focus:text-destructive",children:[a.jsx(xd,{className:"h-4 w-4 mr-2"}),"Report user"]}),!t.isByMe&&E&&a.jsxs(ot,{onClick:E,className:"text-destructive focus:text-destructive",children:[a.jsx(mm,{className:"h-4 w-4 mr-2"}),"Block ",X]}),t.canDelete&&a.jsxs(ot,{onClick:()=>K(!0),className:"text-destructive focus:text-destructive",children:[a.jsx(qn,{className:"h-4 w-4 mr-2"}),"Delete post"]})]})]})]})]}),he&&a.jsxs("div",{className:ee("mb-3 flex items-center justify-between gap-3 rounded-lg border px-3 py-2",he.isEnded?"border-border bg-muted/40 text-muted-foreground":"border-destructive/20 bg-destructive/5 text-destructive"),children:[a.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-sm font-medium",children:[a.jsx(wk,{className:ee("h-4 w-4 shrink-0",he.isLive&&"animate-pulse")}),a.jsxs("span",{className:"truncate",children:[he.isEnded?"Live session ended":he.isLive?"Live now":"Live session",he.name?` · ${he.name}`:""]})]}),!he.isEnded&&he.meetingId&&a.jsx(vr,{to:ve.meeting(he.meetingId),className:"shrink-0 rounded-full bg-destructive px-3 py-1 text-xs font-semibold text-destructive-foreground hover:bg-destructive/90",children:"Join"})]}),Q?a.jsx(Xxr,{event:Q}):a.jsxs("div",{className:"space-y-3",children:[t.title&&(r&&!ye?a.jsx("button",{type:"button",onClick:r,className:"block scroll-m-20 text-left text-lg font-bold leading-snug tracking-tight text-foreground hover:text-primary transition-colors",children:t.title}):a.jsx("h3",{className:"scroll-m-20 text-lg font-bold leading-snug tracking-tight text-foreground",children:t.title})),a.jsx(QTt,{embedded:!0,images:Yt,videos:t.videos,videoThumbnails:t.videoThumbnails,document:t.document,documentName:t.documentName,embedCode:t.embedCode,embedCodeHeight:t.embedCodeHeight}),a.jsx(YZ,{buttons:t.buttons,position:"top"}),t.body&&a.jsxs("div",{className:ee("PostDescription text-secondary-foreground",nr&&!i&&"post-description has-more"),children:[a.jsx("div",{onClick:br,className:ee("post-description-body text-xs leading-relaxed",yr&&"cursor-pointer"),children:a.jsx(ZB,{text:t.embedCode||t.shared?t.body:FTt(t.body,ie),embedVideos:!0})}),nr&&!ye&&a.jsx("button",{type:"button",onClick:at=>{at.stopPropagation(),f()},className:"read-more mt-1 cursor-pointer text-xs font-bold uppercase text-primary hover:underline",children:i?"show less":"read more…"})]}),t.body&&!t.embedCode&&(ie?a.jsx(hPe,{text:ie}):a.jsx(RTt,{body:t.body,linkPreview:t.linkPreview,linkPreviewHidden:t.linkPreviewHidden})),(()=>{const at=t.topics??[],Tt=new Set(at.map(Pn=>Pn.name)),An=(t.tags??[]).filter(Pn=>!Tt.has(Pn));return at.length===0&&An.length===0?null:a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[at.map(Pn=>_?a.jsx("button",{type:"button",onClick:()=>_(Pn),className:"cursor-pointer rounded-full border border-border bg-muted/40 px-2.5 py-0.5 text-xs hover:border-primary/40 hover:bg-primary/10 hover:text-primary transition-colors",children:Pn.name.length>30?`${Pn.name.slice(0,30)}…`:Pn.name},Pn.id):a.jsx("span",{className:"rounded-full border border-border bg-muted/40 px-2.5 py-0.5 text-xs",children:Pn.name.length>30?`${Pn.name.slice(0,30)}…`:Pn.name},Pn.id)),An.map(Pn=>a.jsx("span",{className:"rounded-full border border-border bg-muted/40 px-2.5 py-0.5 text-xs",children:Pn.length>30?`${Pn.slice(0,30)}…`:Pn},Pn))]})})()]}),t.shared&&!Q&&a.jsx(bse,{post:t.shared}),Q?null:a.jsx(YZ,{buttons:t.buttons,position:"bottom"}),!Q&&te&&a.jsx(n0r,{quiz:te,postRealId:t.realId},`${t.realId??t.id}-${te.myAnswers?"done":"open"}`),Q?null:V&&a.jsx("div",{className:"my-4",children:a.jsxs("div",{className:"rounded-xl border border-primary/20 bg-gradient-to-br from-primary/5 to-transparent p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:[a.jsx(Fc,{className:"h-3.5 w-3.5 text-primary"}),a.jsxs("span",{className:"font-medium",children:["Poll • ",V.duration]}),(V.votedOption!==null||!jj(V))&&a.jsxs("span",{className:"ml-auto",children:[V.totalVotes," vote",V.totalVotes!==1?"s":""]})]}),V.question&&V.question!==((ke=t.title)==null?void 0:ke.trim())&&a.jsx("p",{className:"text-sm font-semibold text-foreground",children:V.question}),a.jsx("div",{className:"space-y-2",children:ne.map(at=>{const Tt=V.options[at],An=jj(V),Pn=V.votedOption!==null||!An,yn=Pn&&An,Is=Pn?U[at]:0,js=Pn&&V.totalVotes>0&&Tt.votes===Math.max(...V.options.map(Gt=>Gt.votes));return a.jsxs(it.button,{layout:"position",transition:{duration:.35,ease:"easeOut"},type:"button",onClick:()=>(!Pn||yn)&&V.votedOption!==at&&W(at),disabled:Pn&&!yn,"aria-pressed":V.votedOption!==null?V.votedOption===at:void 0,className:`relative w-full text-left rounded-lg border px-4 py-3 text-sm font-medium transition-all overflow-hidden ${Pn?V.votedOption===at?"border-primary bg-primary/10 text-primary":`border-border text-foreground ${yn?"hover:border-primary/50 cursor-pointer":""}`:"border-border hover:border-primary/50 hover:bg-primary/5 text-foreground cursor-pointer"}`,children:[Pn&&a.jsx(it.div,{initial:{width:0},animate:{width:`${Is}%`},transition:{duration:.6,ease:"easeOut"},className:`absolute left-0 top-0 bottom-0 rounded-lg ${js?"bg-primary/15":"bg-muted/50"}`}),a.jsxs("span",{className:"relative flex items-center justify-between",children:[a.jsxs("span",{className:"flex items-center gap-2",children:[!Pn&&a.jsx("span",{className:"h-5 w-5 rounded-full border-2 border-muted-foreground/30 flex items-center justify-center text-[10px]",children:String.fromCharCode(65+at)}),Pn&&V.votedOption===at&&a.jsx("span",{className:"h-5 w-5 rounded-full bg-primary flex items-center justify-center text-[10px] text-primary-foreground",children:"✓"}),Tt.text]}),Pn&&a.jsxs("span",{className:"shrink-0 pl-2 text-xs font-semibold tabular-nums",children:[Is,"%"]})]})]},at)})}),a.jsx("p",{className:"text-[10px] text-muted-foreground text-center",children:jj(V)?V.votedOption===null?"Select an option to vote":gPe(V.endsAt)?"You can change your vote at any time":"You can change your vote until the poll ends":"This poll has ended"}),t.isByMe&&t.realId&&V.totalVotes>0&&a.jsxs("button",{type:"button",onClick:()=>Be(!0),className:"mx-auto flex items-center gap-1.5 rounded-md px-2 py-1 text-xs font-medium text-primary hover:underline focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[a.jsx(wr,{className:"h-3.5 w-3.5","aria-hidden":!0}),"See who voted"]})]})}),!Q&&!(fe&&re)&&a.jsxs(a.Fragment,{children:[Hn&&a.jsxs("div",{className:"PostStats mt-4 flex flex-wrap items-center justify-between gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[vn?a.jsxs("button",{type:"button",onClick:()=>pe(!0),className:"group/summary flex min-w-0 items-center gap-1.5 transition-colors hover:text-foreground",children:[Ee.length>0&&a.jsx("span",{className:"flex shrink-0 items-center -space-x-1",children:Ee.map(at=>a.jsx("span",{"aria-hidden":!0,className:"flex h-[18px] w-[18px] items-center justify-center rounded-full bg-background text-[11px] leading-none ring-1 ring-border",children:at},at))}),a.jsx("span",{className:"truncate group-hover/summary:underline",children:Ge})]}):a.jsx("span",{}),Pt.length>0&&a.jsx("span",{className:"flex shrink-0 items-center gap-1.5",children:Pt.map((at,Tt)=>a.jsxs("span",{className:"flex items-center gap-1.5",children:[Tt>0&&a.jsx("span",{"aria-hidden":!0,className:"text-muted-foreground/40",children:"·"}),at.onClick?a.jsx("button",{type:"button",onClick:at.onClick,"aria-expanded":at.expanded,className:"transition-colors hover:text-foreground hover:underline",children:at.label}):a.jsx("span",{children:at.label})]},at.key))})]}),a.jsxs("div",{className:ee("PostActions flex items-center gap-1 border-t border-border/50 py-1.5",Hn?"mt-2":"mt-4"),children:[!fe&&a.jsx(uAt,{className:"flex-1",options:jse,selected:tt,onPick:at=>g?g(at):p(),children:({openOnTouch:at,trayOpen:Tt,dismiss:An})=>a.jsxs("button",{type:"button",onClick:()=>{at()||(p(),An())},"aria-label":$e?`Remove ${wt} reaction`:"Like","aria-expanded":Tt,className:ee(D3,"w-full",$e&&"text-primary hover:text-primary"),children:[$e?a.jsx("span",{"aria-hidden":!0,className:"flex h-[18px] w-[18px] shrink-0 items-center justify-center text-base leading-none",children:tt??Ese}):a.jsx($8,{className:"h-[18px] w-[18px] shrink-0"}),a.jsx("span",{className:"max-w-full truncate",children:wt})]})}),!re&&a.jsxs("button",{type:"button",onClick:z,"aria-label":"Comment","aria-expanded":o,className:ee(D3,o&&"text-primary hover:text-primary"),children:[a.jsx(wd,{className:"h-[18px] w-[18px] shrink-0"}),a.jsx("span",{children:"Comment"})]}),N&&!t.shared&&a.jsxs("button",{type:"button",onClick:N,disabled:t.reposted,"aria-label":t.reposted?"Reposted":"Repost",title:t.reposted?"You have already reposted this post":"Repost",className:ee(D3,t.reposted&&"cursor-not-allowed text-primary hover:bg-transparent hover:text-primary"),children:[a.jsx(LA,{className:"h-[18px] w-[18px] shrink-0"}),a.jsx("span",{className:"truncate",children:t.reposted?"Reposted":"Repost"})]}),A&&a.jsxs("button",{type:"button",onClick:A,"aria-label":"Send",title:"Send in a message",className:D3,children:[a.jsx(_s,{className:"h-[18px] w-[18px] shrink-0"}),a.jsx("span",{children:"Send"})]}),a.jsxs("button",{type:"button",onClick:x,"aria-label":"Copy link",className:ee(D3,"sm:hidden"),children:[a.jsx(kk,{className:"h-[18px] w-[18px] shrink-0"}),a.jsx("span",{children:"Share"})]})]})]}),a.jsx(Al,{children:o&&!re&&!ye&&!t.commentsLoaded&&a.jsx(it.div,{initial:{height:0,opacity:0},animate:{height:"auto",opacity:1},exit:{height:0,opacity:0},className:"overflow-hidden border-t border-border",children:H?a.jsx(_At,{avatar:c,value:l,onChange:G,onSubmit:H,revealActionsOnFocus:!0,autoFocus:!0}):a.jsxs("div",{className:"flex gap-2 py-3",children:[a.jsx("img",{src:c,alt:"",className:"h-9 w-9 shrink-0 rounded-full object-cover"}),a.jsxs("div",{className:"flex min-w-0 flex-1 gap-2",children:[a.jsx(Pse,{placeholder:"Write a comment…",value:l,onChange:at=>G(at.target.value),className:"min-w-0 flex-1 rounded-2xl border border-input bg-background px-3 py-1.5 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/30",autoFocus:!0}),a.jsx(Z,{size:"sm",className:"shrink-0 rounded-full",onClick:B,disabled:!l.trim(),children:a.jsx(_s,{className:"h-3.5 w-3.5"})})]})]})})}),!re&&(ye||o&&t.commentsLoaded)&&s,!re&&!ye&&o&&!t.commentsLoaded&&t.comments>0&&a.jsx("div",{className:"PostComments flex items-center gap-2 border-t border-border py-3 text-xs text-muted-foreground",role:"status",children:m?a.jsxs(a.Fragment,{children:[a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}),"Loading comments…"]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"Couldn't load the comments."}),a.jsx("button",{type:"button",onClick:M,className:"font-medium text-primary hover:underline",children:"Try again"})]})})]})]}),Ie&&a.jsx(yq,{open:!0,mode:"reposts",onOpenChange:Me,postRealId:t.realId??null,likeCount:De}),we&&V&&a.jsx(yq,{open:!0,mode:"votes",onOpenChange:Be,postRealId:t.realId??null,likeCount:V.totalVotes,poll:V}),ce&&!fe&&a.jsx(yq,{open:!0,onOpenChange:pe,postRealId:t.realId??null,likeCount:t.likes,reactions:t.reactions}),a.jsx(Kr,{open:J,onOpenChange:K,children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Delete this post?"}),a.jsx(zr,{children:"This permanently removes the post and its comments. This can't be undone."})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:"Cancel"}),a.jsx(Yr,{onClick:P,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}function RAt({comment:t,postRealId:e,communityId:n,contentKind:r="comment",onOpenChange:s}){const{toast:i}=yt(),o=t!==null,[l,c]=y.useState(""),[d,u]=y.useState(!1);y.useEffect(()=>{o&&c("")},[o]);const h=()=>{var g;if(!t||!n)return;u(!0);const m=e?`${window.location.origin}${ve.post(e)}`:window.location.href,f=t.realId?`${m}#${r}-${t.realId}`:m,p=r==="reply"?"Reply":"Comment";YAe(n,{contentLink:f,content:((g=t.text)==null?void 0:g.slice(0,200))||p,reportType:`${p} Report`,reasonOfReporting:l.trim(),contentId:t.realId,contentKind:r,reportedUserId:t.authorId}).then(()=>{i({title:"Reported",description:`Thank you. Our team will review this ${r}.`}),s(!1)}).catch(()=>{i({title:"Couldn't submit your report",variant:"destructive"})}).finally(()=>u(!1))};return a.jsx(Bt,{open:o,onOpenChange:m=>!m&&s(!1),children:a.jsxs(Ft,{className:"sm:max-w-md",children:[a.jsxs(Vt,{children:[a.jsxs(Ut,{className:"flex items-center gap-2",children:[a.jsx(xd,{className:"h-5 w-5 text-destructive"}),"Report ",r]}),a.jsxs(_n,{children:["Tell us why you're reporting this ",r,". Community admins will be notified."]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx(us,{placeholder:"Why are you reporting this?",value:l,onChange:m=>c(m.target.value),className:"min-h-[100px] resize-none",autoFocus:!0}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx(Z,{variant:"ghost",onClick:()=>s(!1),disabled:d,children:"Cancel"}),a.jsxs(Z,{variant:"destructive",onClick:h,disabled:d||!l.trim(),children:[d&&a.jsx(Ne,{className:"h-4 w-4 mr-1 animate-spin"}),"Send report"]})]})]})]})})}const l0r=40,c0r=30*6e4,lj=new Map,D0e=(t,e)=>`${t}\0${e}`;function Rse(t,e,n){const r=D0e(t,e);for(lj.delete(r),lj.set(r,{value:n,savedAt:Date.now()});lj.size>l0r;){const s=lj.keys().next().value;if(s===void 0)break;lj.delete(s)}}function Ise(t,e){const n=lj.get(D0e(t,e));if(n){if(Date.now()-n.savedAt>c0r){lj.delete(D0e(t,e));return}return n.value}}function Mse(){const{key:t}=Di(),e=nat(),[n]=y.useState(()=>e==="POP");return{entryKey:t,isReturn:n}}function Y2(t,e){const{entryKey:n,isReturn:r}=Mse(),[s,i]=y.useState(()=>{if(!r)return e;const o=Ise(n,t);return o?o.value:e});return y.useEffect(()=>{Rse(n,t,{value:s})},[n,t,s]),[s,i]}const d0r=2e3;function UHe(t){for(let e=(t==null?void 0:t.parentElement)??null;e;e=e.parentElement){const n=getComputedStyle(e).overflowY;if(n==="auto"||n==="scroll")return e}return document.scrollingElement??document.documentElement}const IAt=t=>t===document.scrollingElement||t===document.documentElement,MAt=t=>IAt(t)?0:t.getBoundingClientRect().top;function u0r(t){const e=MAt(t),n=t.querySelectorAll("[data-post-id]");for(const r of n){const s=r.getBoundingClientRect();if(s.bottom>e+1)return{postId:r.dataset.postId??null,offset:s.top-e,scrollTop:t.scrollTop}}return{postId:null,offset:0,scrollTop:t.scrollTop}}function h0r(t,e){for(const n of t.querySelectorAll("[data-post-id]"))if(n.dataset.postId===e)return n;return null}function m0r(t,e,n){const{entryKey:r,isReturn:s}=Mse(),i=`feed-scroll:${e}`,o=y.useRef(!1),l=y.useRef(r);l.current=r,y.useLayoutEffect(()=>{if(!e)return;const c=UHe(t.current),d=IAt(c)?window:c;let u=0;const h=()=>Rse(l.current,i,u0r(c)),m=()=>{u||(u=requestAnimationFrame(()=>{u=0,(o.current||!s)&&h()}))};return d.addEventListener("scroll",m,{passive:!0}),()=>{d.removeEventListener("scroll",m),u&&cancelAnimationFrame(u),(o.current||!s)&&h()}},[e,i,t,s]),y.useEffect(()=>{if(!e||o.current||!n)return;if(!s){o.current=!0;return}const c=Ise(r,i);if(o.current=!0,!c)return;const d=UHe(t.current),u=()=>{const b=c.postId?h0r(d,c.postId):null;if(!b){Math.abs(d.scrollTop-c.scrollTop)>1&&(d.scrollTop=c.scrollTop);return}const x=b.getBoundingClientRect().top-MAt(d)-c.offset;Math.abs(x)>1&&(d.scrollTop+=x)};let h=0,m=!1;const f=performance.now(),p=()=>{m=!0,h&&cancelAnimationFrame(h)},g=()=>{m||(u(),performance.now()-f<d0r&&(h=requestAnimationFrame(g)))};u(),h=requestAnimationFrame(g);const v=["wheel","touchstart","keydown","mousedown"];return v.forEach(b=>window.addEventListener(b,p,{passive:!0,once:!0})),()=>{p(),v.forEach(b=>window.removeEventListener(b,p))}},[e,i,n,s,r,t])}function Lse({posts:t,feed:e,currentUserAvatar:n,currentUserName:r,canFeature:s,getCanPin:i,featuredIds:o,onToggleFeatured:l,onEditPost:c,onReportPost:d,onReportUser:u,onToggleFollow:h,isFollowingAuthor:m,onBlockAuthor:f,commentAuthorActions:p,onRepost:g,onSend:v,onViewAnalytics:b,onTopicClick:x,onChannelClick:w,onReachEnd:k,isLoadingMore:S=!1,hasMore:C=!1,layout:j="list",restoreScrollScope:E}){const N=Nn(),{community:A}=qe(),[_,T]=y.useState(null),R=j==="grid"?"grid w-full grid-cols-1 gap-3 sm:grid-cols-2 [&>*]:mb-0":j==="compact"?"w-full space-y-1.5 [&_.mb-4]:mb-1.5":"w-full space-y-2 [&>*]:mb-0",O=P=>{const M={};for(const[z,G]of Object.entries(e.replyDrafts)){const[B,H]=z.split(":");Number(B)===P&&(M[Number(H)]=G)}return M},F=y.useRef(null);m0r(F,E,t.length>0);const D=y.useRef(null),I=y.useRef(k);return I.current=k,y.useEffect(()=>{if(!k||!C)return;const P=D.current;if(!P)return;const M=new IntersectionObserver(z=>{var G,B;(G=z[0])!=null&&G.isIntersecting&&((B=I.current)==null||B.call(I))},{root:null,rootMargin:"200px"});return M.observe(P),()=>M.disconnect()},[k,C]),a.jsxs("div",{ref:F,className:`${R} max-xl:pb-16`,children:[t.map(P=>{var M,z,G;return a.jsx(PAt,{post:P,expanded:e.expandedPosts.has(P.id),isCommenting:e.commentingPost===P.id,commentText:e.commentDraftFor(P.id),currentUserAvatar:n,currentUserName:r,canPin:i(P),canFeature:s,isFeatured:P.realId?o.has(P.realId):!1,isCommentsLoading:e.commentsLoadingId===P.id,onOpen:P.realId?()=>N(ve.post(P.realId)):void 0,onFeature:()=>l(P),onToggleExpand:()=>e.toggleExpand(P.id),onLike:()=>e.handleLike(P.id),onReact:B=>e.handleReactToPost(P.id,B),onSave:()=>e.handleSave(P.id),onShare:()=>e.handleShare(P.id),onHide:()=>e.handleHidePost(P.id),onReport:()=>d(P),onReportUser:u?()=>u(P):void 0,onToggleFollow:h?()=>h(P):void 0,isFollowingAuthor:m==null?void 0:m(P.authorId),onBlockAuthor:f?()=>f(P):void 0,onRepost:g?()=>g(P):void 0,onSend:v?()=>v(P):void 0,onViewAnalytics:b?()=>b(P):void 0,onTopicClick:x,onChannelClick:w?()=>w(P):void 0,onPin:()=>e.handlePin(P.id),onEdit:()=>c(P),onDelete:()=>e.handleDeletePost(P.id),onLoadComments:()=>e.loadComments(P.id),onComment:()=>e.handleComment(P.id),onCommentTextChange:B=>e.setCommentDraft(P.id,B),onSubmitComment:()=>e.submitComment(P.id),onSubmitRichComment:(B,H)=>e.submitRichComment(P.id,B,H),onVotePoll:B=>e.handleVotePoll(P.id,B),commentSlot:a.jsx(AAt,{comments:P.commentsList,postId:P.realId,postAuthorId:(M=P.preferences)!=null&&M.hideCreator?void 0:P.authorId,currentUserName:r,currentUserAvatar:n,commentText:e.commentDraftFor(P.id),onCommentTextChange:B=>e.setCommentDraft(P.id,B),onSubmitComment:()=>e.submitComment(P.id),onSubmitRichComment:(B,H)=>e.submitRichComment(P.id,B,H),replyDrafts:O(P.id),onReplyDraftChange:(B,H)=>e.setReplyDraft(P.id,B,H),onSubmitReply:(B,H,W)=>e.submitReplyInPost(P.id,B,H,W),onReactComment:(B,H)=>e.reactToCommentInPost(P.id,B,H),onDeleteComment:B=>e.deleteCommentInPost(P.id,B),onReactReply:(B,H,W)=>e.reactToReplyInPost(P.id,B,H,W),onDeleteReply:(B,H)=>e.deleteReplyInPost(P.id,B,H),onEditReply:(B,H,W)=>e.editReplyInPost(P.id,B,H,W),onEditComment:(B,H,W)=>e.editCommentInPost(P.id,B,H,W),onReportComment:B=>{const H=P.commentsList.find(W=>W.id===B);H&&T({content:H,contentKind:"comment",postRealId:P.realId})},onReportReply:(B,H)=>{var V,U;const W=(U=(V=P.commentsList.find(ne=>ne.id===B))==null?void 0:V.replies)==null?void 0:U.find(ne=>ne.id===H);W&&T({content:W,contentKind:"reply",postRealId:P.realId})},canDeleteAnyComment:P.canDeleteComment,canDeleteAnyReply:P.canDeleteReply,authorActions:p,sort:(z=e.commentSortFor)==null?void 0:z.call(e,P.id),totalComments:P.comments,onSortChange:e.setCommentSortInPost?B=>e.setCommentSortInPost(P.id,B):void 0,hasMoreComments:((G=e.commentsHasMoreFor)==null?void 0:G.call(e,P.id))??!1,isLoadingMoreComments:e.commentsLoadingId===P.id,onLoadMoreComments:e.loadMoreCommentsInPost?()=>e.loadMoreCommentsInPost(P.id):void 0,onViewAllComments:P.realId?()=>N(ve.post(P.realId)):void 0})},P.id)}),a.jsx(RAt,{comment:(_==null?void 0:_.content)??null,contentKind:_==null?void 0:_.contentKind,postRealId:_==null?void 0:_.postRealId,communityId:A==null?void 0:A.id,onOpenChange:P=>!P&&T(null)}),k&&C&&a.jsx("div",{ref:D,"aria-hidden":!0,className:"h-px"}),S&&a.jsx("div",{className:"flex items-center justify-center py-4 text-muted-foreground",children:a.jsx(Ne,{className:"h-4 w-4 animate-spin"})})]})}function CPe({showSidebar:t,banner:e,main:n,sidebar:r}){const s=rur(),i=a.jsx("div",{className:ee("flex w-full flex-col gap-4",s?"max-w-[720px]":"max-w-[640px]"),children:n});return a.jsxs(it.div,{variants:r0r,initial:"hidden",animate:"show",className:ee("w-full transition-all duration-500 ease-in-out",t?s?"mx-auto max-w-[66rem]":"mx-auto max-w-[60rem]":s?"mx-auto max-w-[720px]":"mx-auto max-w-[640px]"),children:[e&&a.jsx("div",{className:"mb-5",children:e}),t?a.jsxs("div",{className:"grid items-start gap-x-6 lg:grid-cols-[minmax(0,1fr)_18rem]",children:[a.jsx("div",{className:"flex min-w-0 justify-start",children:i}),a.jsx("aside",{className:"hidden min-w-0 lg:block",children:a.jsx("div",{className:"sticky top-0 flex flex-col gap-5",children:r})})]}):i]})}function uP(t,e){const n=((t==null?void 0:t.details)??[]).map(o=>({...o})),r=n.find(o=>o.isByMe);if(r&&(r.isByMe=!1,r.count=Math.max(0,r.count-1)),e){const o=n.find(l=>l.emoji===e);o?(o.isByMe=!0,o.count+=1):n.push({emoji:e,count:1,isByMe:!0})}const s=n.filter(o=>o.count>0),i=s.reduce((o,l)=>o+l.count,0);return s.length>0?{total:i,details:s}:void 0}function eJ(t,e,n){return n==="recent"?[e,...t]:[...t,e]}function tJ(t){return{id:t.id,author:t.author,authorId:t.authorId,avatar:t.avatar,text:t.text,time:"Just now",isByMe:!0,replies:[]}}function zHe(t,e){var r,s;if(!(e!=null&&e.commentId))return t;const n=(s=(r=e.post)==null?void 0:r.comments)==null?void 0:s.find(i=>i.id===e.commentId);return n?oP(n,t.id):{...t,realId:e.commentId}}const aue=10,f0r=50;function VHe(t,e){return e?t.map(n=>n.realId===e?{...n,reposts:(n.reposts??0)+1,reposted:!0}:n):t}function p0r(t,e){var r;const n=(r=e.shared)==null?void 0:r.realId;return n?t.map(s=>s.realId===n?{...s,reposts:Math.max(0,(s.reposts??0)-1),reposted:e.isByMe?!1:s.reposted}:s):t}function Dse({sort:t,duration:e,currentUserName:n,currentUserAvatar:r,currentUserId:s,loadPostsPage:i,enabled:o=!0,restoreScope:l}){const{toast:c}=yt(),{community:d}=qe(),u=(d==null?void 0:d.id)??null,h=rn(),{socket:m}=Qg(),f=XB(),p=()=>h.invalidateQueries({queryKey:["streak"]}),{entryKey:g,isReturn:v}=Mse(),b=`${u}|${t}|${e}`,[x]=y.useState(()=>{if(!l||!v)return null;const Ue=Ise(g,`feed:${l}`);return Ue&&Ue.params===b&&Ue.feedPosts.length>0?Ue:null}),w=y.useRef(!!x),[k,S]=y.useState(()=>(x==null?void 0:x.feedPosts)??[]),[C,j]=y.useState(!1),[E,N]=y.useState(!1),[A,_]=y.useState(()=>(x==null?void 0:x.hasMore)??!1),[T,R]=y.useState(null),[O,F]=y.useState(new Set),[D,I]=y.useState(null),[P,M]=y.useState(null),[z,G]=y.useState({}),B=Ue=>z[Ue]??"",H=(Ue,et)=>G(Le=>({...Le,[Ue]:et})),[W,V]=y.useState(0),[U,ne]=y.useState(null),te=y.useRef(new Set),[re,fe]=y.useState({}),[le,q]=y.useState({}),Y=Ue=>le[Ue]??f0e,[X,Q]=y.useState({}),ie=y.useRef((x==null?void 0:x.page)??0),he=y.useRef((x==null?void 0:x.idCounter)??0),ye=y.useRef(new Set((x==null?void 0:x.seenRealIds)??[])),J=y.useRef(0),K=y.useRef([]),ce=y.useRef({});y.useEffect(()=>{ce.current=le},[le]);const pe=y.useCallback(async(Ue,et)=>{var Ye;if(!o){S([]),_(!1),j(!1);return}if(!i&&!u){S([]),_(!1),j(!1);return}const Le=++J.current;et==="reset"?(j(!0),R(null),he.current=0,ye.current=new Set):N(!0);try{const st=i?await i(Ue):await KNt(u,{page:Ue,sort:t,duration:e});if(Le!==J.current)return;const nt=[];for(const Je of st.posts??[])Je!=null&&Je.id&&ye.current.has(Je.id)||(Je!=null&&Je.id&&ye.current.add(Je.id),nt.push(Am(Je,++he.current)));ie.current=Ue,_((((Ye=st.posts)==null?void 0:Ye.length)??0)>0),S(Je=>et==="reset"?nt:[...Je,...nt])}catch(st){if(Le!==J.current)return;const nt=dn(st,"Failed to load posts.");R(nt),et==="reset"&&S([]),_(!1)}finally{Le===J.current&&(j(!1),N(!1))}},[u,t,e,i,o]);y.useEffect(()=>{if(!o){w.current=!1,S([]),_(!1),j(!1),R(null);return}if(w.current){w.current=!1;return}ie.current=0,V(0),pe(1,"reset")},[pe,o]),y.useEffect(()=>{!l||C||Rse(g,`feed:${l}`,{params:b,feedPosts:k,hasMore:A,page:ie.current,idCounter:he.current,seenRealIds:[...ye.current]})},[l,g,b,k,A,C]),y.useEffect(()=>{K.current=k},[k]),y.useEffect(()=>{if(!m||!o)return;const Ue=et=>{const Le=et==null?void 0:et.liveCall;if(!(Le!=null&&Le.id)&&!(Le!=null&&Le.meetingId))return;const Ye=st=>st&&(Le.id&&st.id===Le.id||Le.meetingId&&st.meetingId===Le.meetingId?{...st,isLive:!1,isEnded:!0,endedAt:Le.endedAt}:st);S(st=>st.map(nt=>({...nt,liveCall:Ye(nt.liveCall),shared:nt.shared?{...nt.shared,liveCall:Ye(nt.shared.liveCall)}:nt.shared})))};return m.on("live-call:end",Ue),()=>{m.off("live-call:end",Ue)}},[m,o]),y.useEffect(()=>{if(!m||!o||i)return;const Ue=Je=>Je?K.current.find(Rt=>Rt.realId===Je):void 0,et=Je=>{!(Je!=null&&Je.postId)||ye.current.has(Je.postId)||V(Rt=>Rt+1)},Le=Je=>{const Rt=Ue(Je==null?void 0:Je.postId);Rt&&S(Qt=>Qt.filter(Jt=>Jt.id!==Rt.id))},Ye=Je=>{var Qt;if((Qt=Je==null?void 0:Je.user)!=null&&Qt.id&&s&&Je.user.id===s)return;const Rt=Ue(Je==null?void 0:Je.postId);!Rt||!(Je!=null&&Je.increment)||S(Jt=>Jt.map(Qe=>Qe.id===Rt.id?{...Qe,likes:Math.max(0,Qe.likes+Je.increment)}:Qe))},st=Je=>{var Qt,Jt;if((Jt=(Qt=Je==null?void 0:Je.comment)==null?void 0:Qt.createdBy)!=null&&Jt.id&&s&&Je.comment.createdBy.id===s)return;const Rt=Ue(Je==null?void 0:Je.postId);Rt&&(S(Qe=>Qe.map(Lt=>Lt.id===Rt.id?{...Lt,comments:Lt.comments+1}:Lt)),Rt.commentsLoaded&&nr(Rt.id))},nt=Je=>{const Rt=Ue(Je==null?void 0:Je.postId);Rt&&S(Qt=>Qt.map(Jt=>Jt.id!==Rt.id?Jt:{...Jt,comments:Math.max(0,Jt.comments-1),commentsList:Je!=null&&Je.postCommentId?Jt.commentsList.filter(Qe=>Qe.realId!==Je.postCommentId):Jt.commentsList}))};return m.on("REALTIME:POST_CREATE",et),m.on("REALTIME:POST_DELETE",Le),m.on("REALTIME:POST_LIKE",Ye),m.on("REALTIME:POST_COMMENT_ADD",st),m.on("REALTIME:POST_COMMENT_REMOVE",nt),()=>{m.off("REALTIME:POST_CREATE",et),m.off("REALTIME:POST_DELETE",Le),m.off("REALTIME:POST_LIKE",Ye),m.off("REALTIME:POST_COMMENT_ADD",st),m.off("REALTIME:POST_COMMENT_REMOVE",nt)}},[m,o,i,s]);const Ie=y.useCallback(()=>{V(0),ie.current=0,pe(1,"reset")},[pe]),Me=y.useCallback(()=>{C||E||!A||pe(ie.current+1,"append")},[C,E,A,pe]),we=y.useCallback(()=>{ie.current=0,pe(1,"reset")},[pe]),Be=k,Ve=Ue=>{S(et=>[Ue,...et])},be=y.useCallback(Ue=>{Ue&&S(et=>VHe(et,Ue))},[]),Ze=y.useCallback(Ue=>{if(Ue!=null&&Ue.id&&ye.current.has(Ue.id))return;Ue!=null&&Ue.id&&ye.current.add(Ue.id);const et=Am(Ue,++he.current);S(Le=>[et,...VHe(Le,Ue==null?void 0:Ue.sharedId)])},[]),Pe=Ue=>Ue instanceof ze&&Ue.status===404,Ke=Ue=>{S(et=>et.filter(Le=>Le.id!==Ue)),F(et=>{const Le=new Set(et);return Le.delete(Ue),Le}),I(et=>et===Ue?null:et),M(et=>et===Ue?null:et),c({title:"This post is no longer available",description:"It was removed, so we've taken it out of your feed."})},De=(Ue,et)=>{var Rt;if(!f())return;const Le=k.find(Qt=>Qt.id===Ue);if(!(Le!=null&&Le.poll))return;const Ye=Le.poll.votedOption;if(Ye===et||!jj(Le.poll))return;const st=(Rt=Le.poll.options[et])==null?void 0:Rt.text;if(S(Qt=>Qt.map(Jt=>Jt.id!==Ue||!Jt.poll||Jt.poll.votedOption!==Ye?Jt:{...Jt,poll:Wre(Jt.poll,et)})),!Le.realId||st==null)return;const nt=Le.realId,Je=qre(nt,et);KAe(nt,st).catch(Qt=>{if(Je(),Pe(Qt))return Ke(Ue);S(Jt=>Jt.map(Qe=>Qe.id!==Ue||!Qe.poll||Qe.poll.votedOption!==et?Qe:{...Qe,poll:gCt(Qe.poll,et,Ye)})),c({title:Ye===null?"Couldn't record your vote":"Couldn't change your vote",description:Dt(Qt instanceof ze?Qt.body:null,"Please try again."),variant:"destructive"})})},xt=(Ue,et)=>{if(!f())return;const Le=k.find(Rt=>Rt.id===Ue);if(!Le)return;const Ye={liked:Le.liked,likes:Le.likes,reactions:Le.reactions},st=!!(t2(Le.reactions)??Le.liked),nt=et&&!st?1:!et&&st?-1:0;if(S(Rt=>Rt.map(Qt=>Qt.id===Ue?{...Qt,liked:!!et,likes:Math.max(0,Qt.likes+nt),reactions:uP(Qt.reactions,et)}:Qt)),!Le.realId)return;(et?YNt(Le.realId,et):QNt(Le.realId)).then(()=>{et&&p()}).catch(Rt=>{if(Pe(Rt))return Ke(Ue);S(Qt=>Qt.map(Jt=>Jt.id===Ue?{...Jt,...Ye}:Jt)),c({title:"Couldn't update your reaction",variant:"destructive"})})},Xe=Ue=>{const et=k.find(Ye=>Ye.id===Ue);if(!et)return;const Le=!!(t2(et.reactions)??et.liked);xt(Ue,Le?null:Ese)},tt=(Ue,et)=>{const Le=k.find(Ye=>Ye.id===Ue);Le&&xt(Ue,t2(Le.reactions)===et?null:et)},$e=Ue=>{if(!f())return;const et=k.find(nt=>nt.id===Ue);if(!et)return;const Le=!et.saved,Ye=nt=>S(Je=>Je.map(Rt=>Rt.id===Ue?{...Rt,saved:nt}:Rt));if(Ye(Le),c({title:Le?"Post saved!":"Removed from saved"}),!et.realId)return;(Le?ZNt(et.realId):JNt(et.realId)).catch(nt=>{if(Pe(nt))return Ke(Ue);Ye(!Le),c({title:"Couldn't update saved posts",variant:"destructive"})})},wt=Ue=>{const et=k.find(Ye=>Ye.id===Ue),Le=et!=null&&et.realId?`${window.location.origin}${ve.post(et.realId)}`:window.location.href;kN(Le).then(Ye=>{c(Ye?{title:"Link copied!",description:"Post link copied to clipboard."}:{title:"Couldn't copy link",variant:"destructive"})})},Ee=Ue=>{const et=D!==Ue;I(et?Ue:null),H(Ue,""),et&&vn(Ue)},Ge=Ue=>{if(!f())return;const et=B(Ue).trim();if(!et)return;const Le=k.find(nt=>nt.id===Ue),Ye=tJ({id:Date.now(),author:n,avatar:r,text:et,authorId:s??void 0});if(S(nt=>nt.map(Je=>Je.id===Ue?{...Je,comments:Je.comments+1,commentsList:eJ(Je.commentsList,Ye,Y(Ue))}:Je)),H(Ue,""),c({title:"Comment posted!"}),!(Le!=null&&Le.realId))return;const st=Le.commentsLoaded;WZ(Le.realId,et).then(nt=>{if(p(),st)return nr(Ue);Yt(Ue,Ye.id,Je=>zHe(Je,nt))}).catch(nt=>{if(Pe(nt))return Ke(Ue);S(Je=>Je.map(Rt=>Rt.id===Ue?{...Rt,comments:Math.max(0,Rt.comments-1),commentsList:Rt.commentsList.filter(Qt=>Qt.id!==Ye.id)}:Rt)),c({title:"Couldn't post your comment",description:Dt(nt instanceof ze?nt.body:nt,"Please try again."),variant:"destructive"})})},Pt=(Ue,et,Le)=>{if(!f())return;const Ye=et.trim(),st=Le.images.length>0||!!Le.document;if(!Ye&&!st)return;const nt=k.find(Jt=>Jt.id===Ue),Je=tJ({id:Date.now(),author:n,avatar:r,text:Ye,authorId:s??void 0});if(S(Jt=>Jt.map(Qe=>Qe.id===Ue?{...Qe,comments:Qe.comments+1,commentsList:eJ(Qe.commentsList,Je,Y(Ue))}:Qe)),H(Ue,""),!(nt!=null&&nt.realId))return;const Rt=nt.realId,Qt=nt.commentsLoaded;WZ(Rt,Ye||" ").then(async Jt=>{const Qe=Jt==null?void 0:Jt.commentId;if(Qe&&Le.images.length>0&&await eTt(Rt,Qe,Le.images),Qe&&Le.document&&await tTt(Rt,Qe,Le.document),p(),Qt||st)return nr(Ue);Yt(Ue,Je.id,Lt=>zHe(Lt,Jt))}).catch(Jt=>{if(Pe(Jt))return Ke(Ue);S(Qe=>Qe.map(Lt=>Lt.id===Ue?{...Lt,comments:Math.max(0,Lt.comments-1),commentsList:Lt.commentsList.filter(Xt=>Xt.id!==Je.id)}:Lt)),c({title:"Couldn't post your comment",description:Dt(Jt instanceof ze?Jt.body:Jt,"Please try again."),variant:"destructive"})})},vn=Ue=>{const et=k.find(Le=>Le.id===Ue);if(!(!et||et.commentsLoaded||te.current.has(Ue))){if(!et.realId||et.comments===0){br(Ue,Le=>({...Le,commentsList:[],commentsLoaded:!0}));return}te.current.add(Ue),ne(Ue),hq(et.realId,1,Y(Ue)).then(Le=>{const Ye=Le.comments.map((st,nt)=>oP(st,nt+1));S(st=>st.map(nt=>nt.id===Ue?{...nt,commentsList:Ye,commentsLoaded:!0}:nt)),fe(st=>({...st,[Ue]:{hasMore:Le.hasMore,nextPage:Le.nextPage}}))}).catch(()=>{}).finally(()=>{te.current.delete(Ue),ne(Le=>Le===Ue?null:Le)})}},Hn=Ue=>{const et=k.find(Ye=>Ye.id===Ue),Le=re[Ue];!(et!=null&&et.realId)||!(Le!=null&&Le.nextPage)||te.current.has(Ue)||(te.current.add(Ue),ne(Ue),hq(et.realId,Le.nextPage,Y(Ue)).then(Ye=>{S(st=>st.map(nt=>{if(nt.id!==Ue)return nt;const Je=new Set(nt.commentsList.map(Jt=>Jt.realId).filter(Boolean)),Rt=t_t(nt.commentsList),Qt=Ye.comments.filter(Jt=>!Jt.id||!Je.has(Jt.id)).map((Jt,Qe)=>oP(Jt,Rt+Qe));return{...nt,commentsList:[...nt.commentsList,...Qt]}})),fe(st=>({...st,[Ue]:{hasMore:Ye.hasMore,nextPage:Ye.nextPage}}))}).catch(Ye=>{c({title:"Couldn't load more comments",description:dn(Ye,"Please try again."),variant:"destructive"})}).finally(()=>{te.current.delete(Ue),ne(Ye=>Ye===Ue?null:Ye)}))},yr=(Ue,et)=>{if(Y(Ue)===et)return;q(Ye=>({...Ye,[Ue]:et}));const Le=k.find(Ye=>Ye.id===Ue);Le!=null&&Le.realId&&(ne(Ue),hq(Le.realId,1,et).then(Ye=>{const st=Ye.comments.map((nt,Je)=>oP(nt,Je+1));S(nt=>nt.map(Je=>Je.id===Ue?{...Je,commentsList:st,commentsLoaded:!0}:Je)),fe(nt=>({...nt,[Ue]:{hasMore:Ye.hasMore,nextPage:Ye.nextPage}}))}).catch(()=>{c({title:"Couldn't re-order comments",variant:"destructive"})}).finally(()=>ne(Ye=>Ye===Ue?null:Ye)))},br=(Ue,et)=>S(Le=>Le.map(Ye=>Ye.id===Ue?et(Ye):Ye)),Yt=(Ue,et,Le)=>br(Ue,Ye=>({...Ye,commentsList:Ye.commentsList.map(st=>st.id===et?Le(st):st)})),nr=Ue=>{const et=K.current.find(Je=>Je.id===Ue)??k.find(Je=>Je.id===Ue);if(!(et!=null&&et.realId))return;const Le=ce.current[Ue]??f0e,Ye=et.commentsList.filter(Je=>Je.realId).length,st=Math.max(1,Math.ceil(Ye/aue)),nt=Math.min(st*aue,f0r);GZ(et.realId,{limit:nt,sort:Le}).then(Je=>{br(Ue,Qt=>{var Jt;return{...Qt,commentsList:fq((Jt=Je.post)==null?void 0:Jt.comments),commentsLoaded:!0}});const Rt=!!Je.commentsHasMore;fe(Qt=>({...Qt,[Ue]:{hasMore:Rt,nextPage:Rt?nt/aue+1:null}}))}).catch(()=>{})};return{feedPosts:k,setFeedPosts:S,displayedPosts:Be,isLoading:C,isLoadingMore:E,hasMore:A,error:T,loadMore:Me,refetch:we,newPostCount:W,refreshNewPosts:Ie,prependPost:Ve,addCreatedPost:Ze,bumpRepostCount:be,expandedPosts:O,commentingPost:D,showCommentsPost:P,commentDraftFor:B,setCommentDraft:H,commentsLoadingId:U,loadComments:vn,loadMoreCommentsInPost:Hn,setCommentSortInPost:yr,commentSortFor:Y,commentsHasMoreFor:Ue=>{var et;return!!((et=re[Ue])!=null&&et.hasMore)},replyDrafts:X,setReplyDraft:(Ue,et,Le)=>Q(Ye=>({...Ye,[`${Ue}:${et}`]:Le})),reactToCommentInPost:(Ue,et,Le)=>{var Qt;const Ye=k.find(Jt=>Jt.id===Ue),st=Ye==null?void 0:Ye.commentsList.find(Jt=>Jt.id===et);if(!Ye||!st)return;const nt=st.reactions,Je=((Qt=nt==null?void 0:nt.details.find(Jt=>Jt.isByMe))==null?void 0:Qt.emoji)===Le;if(Yt(Ue,et,Jt=>({...Jt,reactions:uP(nt,Je?null:Le)})),!Ye.realId||!st.realId)return;(Je?sTt(Ye.realId,st.realId):rTt(Ye.realId,st.realId,Le)).catch(()=>{Yt(Ue,et,Jt=>({...Jt,reactions:nt})),c({title:"Couldn't update reaction",variant:"destructive"})})},deleteCommentInPost:(Ue,et)=>{const Le=k.find(nt=>nt.id===Ue),Ye=Le==null?void 0:Le.commentsList.find(nt=>nt.id===et),st=(Le==null?void 0:Le.commentsList.findIndex(nt=>nt.id===et))??-1;if(!(!Le||!Ye)){if(!Le.realId||!Ye.realId){c({title:"Still saving this comment",description:"Try again in a moment.",variant:"destructive"});return}br(Ue,nt=>({...nt,comments:Math.max(0,nt.comments-1),commentsList:nt.commentsList.filter(Je=>Je.id!==et)})),c({title:"Comment deleted"}),nTt(Le.realId,Ye.realId).catch(nt=>{nt instanceof ze&&nt.status===404||(br(Ue,Je=>{const Rt=[...Je.commentsList];return Rt.splice(Math.min(st,Rt.length),0,Ye),{...Je,comments:Je.comments+1,commentsList:Rt}}),c({title:"Couldn't delete comment",variant:"destructive"}))})}},editCommentInPost:(Ue,et,Le,Ye)=>{const st=Le.trim(),nt=k.find(Qe=>Qe.id===Ue),Je=nt==null?void 0:nt.commentsList.find(Qe=>Qe.id===et);if(!nt||!Je)return;const Rt=Je.images??[],Qt=!!Ye&&Ye.length!==Rt.length;if(!st&&!(Ye&&Ye.length>0))return;const Jt=Je.text;st===Jt&&!Qt||(Yt(Ue,et,Qe=>({...Qe,text:st,...Ye?{images:Ye}:{}})),!(!nt.realId||!Je.realId)&&XNt(nt.realId,Je.realId,st,Ye).catch(()=>{Yt(Ue,et,Qe=>({...Qe,text:Jt,images:Rt})),c({title:"Couldn't update comment",variant:"destructive"})}))},submitReplyInPost:(Ue,et,Le,Ye=[])=>{const st=k.find(Qe=>Qe.id===Ue),nt=st==null?void 0:st.commentsList.find(Qe=>Qe.id===et),Je=`${Ue}:${et}`,Rt=(Le??X[Je]??"").trim();if(!st||!nt||!Rt&&Ye.length===0)return;const Qt=Date.now(),Jt={id:Qt,author:n,authorId:s??void 0,avatar:r,text:Rt,time:"Just now",isByMe:!0};Yt(Ue,et,Qe=>({...Qe,replies:[...Qe.replies??[],Jt]})),Q(Qe=>({...Qe,[Je]:""})),!(!st.realId||!nt.realId)&&iTt(st.realId,nt.realId,Rt,Ye).then(async()=>{p(),await nr(Ue)}).catch(Qe=>{Yt(Ue,et,Lt=>({...Lt,replies:(Lt.replies??[]).filter(Xt=>Xt.id!==Qt)})),c({title:"Couldn't post your reply",description:Dt(Qe instanceof ze?Qe.body:Qe,"Please try again."),variant:"destructive"})})},deleteReplyInPost:(Ue,et,Le)=>{var Je;const Ye=k.find(Rt=>Rt.id===Ue),st=Ye==null?void 0:Ye.commentsList.find(Rt=>Rt.id===et),nt=(Je=st==null?void 0:st.replies)==null?void 0:Je.find(Rt=>Rt.id===Le);if(!(!Ye||!st||!nt)){if(!Ye.realId||!st.realId||!nt.realId){c({title:"Still saving this reply",description:"Try again in a moment.",variant:"destructive"});return}Yt(Ue,et,Rt=>({...Rt,replies:(Rt.replies??[]).filter(Qt=>Qt.id!==Le)})),c({title:"Reply deleted"}),oTt(Ye.realId,st.realId,nt.realId).catch(Rt=>{Rt instanceof ze&&Rt.status===404||(Yt(Ue,et,Qt=>({...Qt,replies:[...Qt.replies??[],nt]})),c({title:"Couldn't delete reply",variant:"destructive"}))})}},editReplyInPost:(Ue,et,Le,Ye)=>{var Jt;const st=Ye.trim(),nt=k.find(Qe=>Qe.id===Ue),Je=nt==null?void 0:nt.commentsList.find(Qe=>Qe.id===et),Rt=(Jt=Je==null?void 0:Je.replies)==null?void 0:Jt.find(Qe=>Qe.id===Le);if(!nt||!Je||!Rt||!st||st===Rt.text)return;const Qt=Rt.text;Yt(Ue,et,Qe=>({...Qe,replies:(Qe.replies??[]).map(Lt=>Lt.id===Le?{...Lt,text:st}:Lt)})),!(!nt.realId||!Je.realId||!Rt.realId)&&aTt(nt.realId,Je.realId,Rt.realId,st).catch(()=>{Yt(Ue,et,Qe=>({...Qe,replies:(Qe.replies??[]).map(Lt=>Lt.id===Le?{...Lt,text:Qt}:Lt)})),c({title:"Couldn't update reply",variant:"destructive"})})},reactToReplyInPost:(Ue,et,Le,Ye)=>{var Qe,Lt;const st=k.find(Xt=>Xt.id===Ue),nt=st==null?void 0:st.commentsList.find(Xt=>Xt.id===et),Je=(Qe=nt==null?void 0:nt.replies)==null?void 0:Qe.find(Xt=>Xt.id===Le);if(!st||!nt||!Je)return;const Rt=Je.reactions,Qt=((Lt=Rt==null?void 0:Rt.details.find(Xt=>Xt.isByMe))==null?void 0:Lt.emoji)===Ye;if(Yt(Ue,et,Xt=>({...Xt,replies:(Xt.replies??[]).map(xr=>xr.id===Le?{...xr,reactions:uP(Rt,Qt?null:Ye)}:xr)})),!st.realId||!nt.realId||!Je.realId)return;(Qt?cTt(st.realId,nt.realId,Je.realId):lTt(st.realId,nt.realId,Je.realId,Ye)).catch(()=>{Yt(Ue,et,Xt=>({...Xt,replies:(Xt.replies??[]).map(xr=>xr.id===Le?{...xr,reactions:Rt}:xr)})),c({title:"Couldn't update reaction",variant:"destructive"})})},handleVotePoll:De,handleLike:Xe,handleReactToPost:tt,handleSave:$e,handleShare:wt,handleComment:Ee,submitComment:Ge,submitRichComment:Pt,handleHidePost:Ue=>{S(et=>et.filter(Le=>Le.id!==Ue)),c({title:"Post hidden from your feed."})},handleReportPost:Ue=>{c({title:"Post reported",description:"Thank you. Our team will review this post."})},removePostsByAuthor:Ue=>{S(et=>et.filter(Le=>Le.authorId!==Ue))},handlePin:Ue=>{const et=k.find(nt=>nt.id===Ue);if(!et)return;const Le=!et.isPinned,Ye=nt=>S(Je=>Je.map(Rt=>Rt.id===Ue?{...Rt,isPinned:nt}:Rt));if(Ye(Le),c({title:Le?"Post pinned":"Post unpinned"}),!et.realId)return;(Le?dTt(et.realId):uTt(et.realId)).catch(nt=>{if(Pe(nt))return Ke(Ue);Ye(!Le),c({title:Le?"Couldn't pin post":"Couldn't unpin post",variant:"destructive"})})},handleDeletePost:Ue=>{const et=k.findIndex(Ye=>Ye.id===Ue);if(et<0)return;const Le=k[et];S(Ye=>Ye.filter(st=>st.id!==Ue)),c({title:"Post deleted"}),Le.realId&&hTt(Le.realId).then(()=>S(Ye=>p0r(Ye,Le))).catch(Ye=>{Pe(Ye)||(S(st=>{const nt=st.filter(Je=>Je.id!==Ue);return nt.splice(Math.min(et,nt.length),0,Le),nt}),c({title:"Couldn't delete post",variant:"destructive"}))})},toggleExpand:Ue=>{F(et=>{const Le=new Set(et);return Le.has(Ue)?Le.delete(Ue):Le.add(Ue),Le})},toggleCommentsList:Ue=>{M(P===Ue?null:Ue)},openCommentWithList:Ue=>{Ee(Ue),P!==Ue&&M(Ue)}}}function LAt(){const{community:t}=qe(),e=(t==null?void 0:t.id)??null,n=lt({queryKey:["highlighted-posts",e],queryFn:()=>jvr(e),enabled:!!e,staleTime:6e4,select:r=>{var i;return[...((i=r.highlightedPosts)==null?void 0:i.posts)??[]].sort((o,l)=>(o.sortOrder??0)-(l.sortOrder??0)).map((o,l)=>{var h;const c=Am(o.postData,l),d=c.title.trim()||c.body.trim().slice(0,80)||"Featured post",u=c.image||c.banner||((h=c.event)!=null&&h.hasBanner?c.event.thumbnail:null)||null;return{id:c.realId??String(l),title:d,description:c.body.trim(),image:u,author:c.author,avatar:c.avatar}})}});return{items:n.data??[],isLoading:n.isLoading}}function s9(){const{community:t}=qe(),e=(t==null?void 0:t.id)??null,n=rn(),{toast:r}=yt(),{items:s}=LAt(),i=y.useMemo(()=>new Set(s.map(l=>l.id)),[s]),o=y.useCallback(async l=>{if(!e||!l.realId)return;const c=i.has(l.realId);try{c?await mTt(e,l.realId):await Lvr(e,l.realId),await n.invalidateQueries({queryKey:["highlighted-posts",e]}),r({title:c?"Removed from featured":"Added to featured posts"})}catch(d){const u=d instanceof ze&&(d.status===403||d.status===401);r({title:u?"Only community admins can feature posts":"Couldn't update featured posts",variant:"destructive"})}},[e,i,n,r]);return{featuredIds:i,toggleFeatured:o}}function i9(t,e){return t==="admin"||e}function a9(t){return t==="admin"||t==="moderator"}function g0r(){const{user:t}=jr(),{community:e}=qe(),{communityDetail:n,groups:r}=Ln(),s=Nn(),i=t?`${t.firstName} ${t.lastName}`:"Guest",o=t?Pk(t,40):"",l=(e==null?void 0:e.myRole)??(n==null?void 0:n.myRole),c=i9(l,!!((e==null?void 0:e.isByMe)??(n==null?void 0:n.isByMe))),d=y.useMemo(()=>{const b=new Map;for(const x of r)x.id&&x.myRole&&b.set(x.id,x.myRole);return b},[r]),u=y.useCallback(b=>a9(b.groupId?d.get(b.groupId):void 0),[d]),h=y.useCallback(async b=>b===1?await Cvr():{posts:[]},[]),m=Dse({sort:"recent",duration:"",currentUserName:i,currentUserAvatar:o,currentUserId:(t==null?void 0:t.id)??null,loadPostsPage:h}),{featuredIds:f,toggleFeatured:p}=s9(),g=Ase({onPostSaved:b=>m.setFeedPosts(x=>x.map(w=>w.realId===b.id?Am(b,w.id):w)),onReposted:m.addCreatedPost,onAuthorBlocked:m.removePostsByAuthor}),v=y.useCallback(b=>{var k;const x=r.find(S=>S.id===b.groupId),w=(k=x==null?void 0:x.tabs)==null?void 0:k.find(S=>S.id===b.channelId);x&&w&&s(_x(x,w))},[r,s]);return a.jsxs(a.Fragment,{children:[a.jsx(CPe,{showSidebar:!1,main:a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"mb-4 flex items-center gap-2",children:[a.jsx(hO,{className:"h-5 w-5 text-primary"}),a.jsx("h1",{className:"text-lg font-bold text-foreground",children:"Saved posts"})]}),m.isLoading?a.jsx("div",{className:"flex items-center justify-center py-16 text-muted-foreground",children:a.jsx(Ne,{className:"h-5 w-5 animate-spin"})}):m.error&&m.displayedPosts.length===0?a.jsxs("div",{className:"flex flex-col items-center gap-3 py-16 text-center",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:m.error}),a.jsx(Z,{variant:"outline",size:"sm",onClick:m.refetch,children:"Try again"})]}):m.displayedPosts.length===0?a.jsxs("div",{className:"rounded-lg border border-dashed border-border bg-card p-12 text-center",children:[a.jsx(hO,{className:"mx-auto mb-3 h-8 w-8 text-muted-foreground opacity-60"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"You haven't saved any posts yet. Tap “Save post” on a post to keep it here."})]}):a.jsx(Lse,{posts:m.displayedPosts,feed:m,currentUserAvatar:o,currentUserName:i,canFeature:c,getCanPin:u,featuredIds:f,onToggleFeatured:p,...g.listProps,onChannelClick:v})]})}),g.dialogs]})}function jPe({open:t,onOpenChange:e,title:n,description:r,participantCount:s=0,loading:i,onNotify:o,onSkip:l}){return a.jsx(Kr,{open:t,onOpenChange:e,children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:n}),a.jsxs(zr,{children:[r,s>0&&a.jsxs("span",{className:"block mt-2 text-foreground",children:[s," ",s===1?"person has":"people have"," registered for this event."]})]})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:i,onClick:l,children:"No, it's okay"}),a.jsx(Yr,{disabled:i,onClick:c=>{c.preventDefault(),o()},children:"Yes, notify them"})]})]})})}const Xd=t=>encodeURIComponent(t);function v0r(t,e){return ae.get(`/community/${Xd(t)}/events/${encodeURIComponent(e)}`)}function EPe(t,e){const n=e?`?timestamp=${encodeURIComponent(e)}`:"";return ae.get(`/community/${Xd(t)}/upcoming-events${n}`)}function y0r(t,e){const n=e?`?timestamp=${encodeURIComponent(e)}`:"";return ae.get(`/community/${Xd(t)}/previous-events${n}`)}function DAt(t,e){return ae.get(`/community/${Xd(t)}/event/${encodeURIComponent(e)}`)}function b0r(t,e){return ae.get(`/community/${Xd(t)}/latest-events/${encodeURIComponent(e)}`)}function x0r(t,e){return ae.get(`/community/${Xd(t)}/event/slug/${encodeURIComponent(e)}`)}function HHe(t,e,n){return ae.post(`/community/${Xd(t)}/event/${encodeURIComponent(e)}/update-rsvp`,{status:n})}function w0r(t,e){return ae.post(`/community/${Xd(t)}/event/${encodeURIComponent(e)}/reject-invitation`)}function GHe(t,e,n){return ae.post(`/community/${Xd(t)}/event/${Xd(e)}/entry`,{password:n})}function k0r(t,e){return ae.post(`/community/${Xd(t)}/event`,e)}function S0r(t,e,n){const r=`?recurringType=${encodeURIComponent(n.recurringType)}&recurringCount=${n.recurringCount}`;return ae.post(`/community/${Xd(t)}/event/recurring${r}`,e)}function C0r(t,e,n,r){const s=r!=null&&r.notifyUser?"?notifyUser=true":"";return ae.post(`/community/${Xd(t)}/event/${encodeURIComponent(e)}${s}`,n)}function $At(t,e,n){const r=new URLSearchParams;n!=null&&n.deleteAll&&r.set("deleteAll","true"),n!=null&&n.notifyUser&&r.set("notifyUser","true");const s=r.toString()?`?${r.toString()}`:"";return ae.delete(`/community/${Xd(t)}/event/${encodeURIComponent(e)}${s}`)}function j0r(t,e,n){return ae.post(`/community/${Xd(t)}/event/${encodeURIComponent(e)}/invite`,{groups:n})}function E0r(t,e,n){const r=new FormData;return r.append("banner",n),Ea(`/community/${Xd(t)}/event/${encodeURIComponent(e)}/banner`,r)}const N0r=2.6;function T0r(t){return t.toLowerCase().trim().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)||"event"}function WHe(t){const e=new Date(t);if(Number.isNaN(e.getTime()))return{date:"",time:""};const n=r=>String(r).padStart(2,"0");return{date:`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}`,time:`${n(e.getHours())}:${n(e.getMinutes())}`}}function OAt({open:t,onOpenChange:e,onSaved:n,event:r,defaultStartDate:s}){const{community:i}=qe(),o=(i==null?void 0:i.id)??null,l=!!r,[c,d]=y.useState(""),[u,h]=y.useState(""),[m,f]=y.useState(""),[p,g]=y.useState(""),[v,b]=y.useState(""),[x,w]=y.useState(""),[k,S]=y.useState("none"),[C,j]=y.useState(4),[E,N]=y.useState(!1),[A,_]=y.useState(!1),[T,R]=y.useState(!1),[O,F]=y.useState(""),[D,I]=y.useState(!1),[P,M]=y.useState(""),[z,G]=y.useState(!1),[B,H]=y.useState(""),[W,V]=y.useState(0),[U,ne]=y.useState(null),[te,re]=y.useState(""),[fe,le]=y.useState(null),q=y.useRef(null),[Y,X]=y.useState(!1),[Q,ie]=y.useState(!1),[he,ye]=y.useState(!1);y.useEffect(()=>{if(t)if(M(""),G(!1),r){d(r.title),h(r.description);const we=WHe(r.startTime),Be=WHe(r.endTime);f(we.date),g(we.time),b(Be.date),w(Be.time),S("none"),N(!1),_(!1),R(!!r.webURL),F(r.webURL||""),I(!!r.isPrivate),H(r.location==="Online"?"":r.location),V(r.maximumRegistrations||0),ne(null),le(null),re(r.hasBanner?r.thumbnail:"")}else J(s??void 0)},[t,r==null?void 0:r.realId,s==null?void 0:s.getTime()]);const J=we=>{if(d(""),h(""),we&&!Number.isNaN(we.getTime())){const Be=be=>String(be).padStart(2,"0"),Ve=`${we.getFullYear()}-${Be(we.getMonth()+1)}-${Be(we.getDate())}`;f(Ve),g("10:00"),b(Ve),w("11:00")}else f(""),g(""),b(""),w("");S("none"),j(4),N(!1),_(!1),R(!1),F(""),I(!1),H(""),V(0),ne(null),re(""),le(null)},K=we=>{if(we){if(!we.type.startsWith("image/")){He.error("Cover must be an image.");return}le(we)}},ce=we=>{ne(we),re(Be=>(Be.startsWith("blob:")&&URL.revokeObjectURL(Be),URL.createObjectURL(we))),le(null),q.current&&(q.current.value="")},pe=()=>{le(null),q.current&&(q.current.value="")},Ie=async(we=!1)=>{var Pe,Ke,De,xt;if(!o)return;if(!c.trim())return He.error("Please enter an event name");if(!m||!p)return He.error("Please set the start date and time");const Be=!l||!!(r!=null&&r.audienceRestricted);if(Be&&D&&(!l||!(r!=null&&r.passwordRequired)||P)&&(P.trim().length<8||new TextEncoder().encode(P).length>72))return He.error("Use a password of at least 8 characters and at most 72 bytes");const Ve=new Date(`${m}T${p}`),be=v&&x?new Date(`${v}T${x}`):new Date(Ve.getTime()+60*60*1e3);if(Number.isNaN(Ve.getTime()))return He.error("Invalid start date/time");if(Ve.getTime()<=Date.now())return He.error("Start time must be in the future");if(be.getTime()<=Ve.getTime())return He.error("End time must be after the start time");const Ze={title:c.trim(),description:u.trim(),startTime:Ve.toISOString(),endTime:be.toISOString(),isPrivate:D,...Be&&D&&P?{password:P}:{},maximumRegistrations:Math.max(0,Math.floor(W)||0),location:B.trim(),meta:{slug:l&&(r!=null&&r.slug)?r.slug:T0r(c),title:c.trim(),description:u.trim()}};T&&O.trim()?Ze.webURL=O.trim():!l&&(E||A)&&(Ze.createMeeting=!0,Ze.callType=A?"webinar":"meeting"),X(!0);try{let Xe=r==null?void 0:r.realId,tt;if(l&&Xe)await C0r(o,Xe,Ze,{notifyUser:we});else if(k!=="none"){const $e=await S0r(o,Ze,{recurringType:k,recurringCount:Math.max(2,Math.floor(C)||2)});Xe=(Ke=(Pe=$e.events)==null?void 0:Pe[0])==null?void 0:Ke.id,tt=$e.meetingWarning}else{const $e=await k0r(o,Ze);Xe=(xt=(De=$e.events)==null?void 0:De[0])==null?void 0:xt.id,tt=$e.meetingWarning}if(U&&Xe)try{await E0r(o,Xe,U)}catch{He.error("Event saved, but the cover image upload failed.")}tt?He.warning(tt):He.success(l?"Event updated":"Event created"),n(l?void 0:Xe),e(!1),l||J()}catch(Xe){He.error(Xe instanceof ze?Dt(Xe.body,Xe.message):"Couldn't save the event")}finally{X(!1),ye(!1)}},Me=()=>{if(l&&r&&r.attendees>0){ie(!0);return}Ie(!1)};return a.jsxs(a.Fragment,{children:[a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"sm:max-w-[560px] max-h-[90vh] overflow-y-auto p-0 gap-0",children:[a.jsx(Vt,{className:"p-6 pb-4",children:a.jsx(Ut,{className:"text-lg font-bold text-foreground",children:l?"Edit event":"Create event"})}),a.jsxs("div",{className:"px-6 pb-6 space-y-5",children:[a.jsx("input",{ref:q,type:"file",accept:"image/*",className:"hidden",onChange:we=>{var Be;return K(((Be=we.target.files)==null?void 0:Be[0])??null)}}),a.jsxs("div",{onClick:()=>{var we;return(we=q.current)==null?void 0:we.click()},className:"relative w-full aspect-[2.6/1] bg-muted rounded-lg border-2 border-dashed border-border flex flex-col items-center justify-center gap-2 cursor-pointer hover:border-primary/40 transition-colors group overflow-hidden",children:[te?a.jsx("img",{src:te,alt:"cover",className:"absolute inset-0 w-full h-full object-cover"}):a.jsxs(a.Fragment,{children:[a.jsx(kd,{className:"h-6 w-6 text-muted-foreground group-hover:text-primary transition-colors"}),a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Upload cover picture"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Crop it to the banner shown on the event."})]}),te&&a.jsx("span",{className:"absolute bottom-2 right-3 text-xs bg-background/90 text-foreground px-2 py-0.5 rounded",children:"Change"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(_e,{className:"text-sm font-semibold text-foreground",children:["Event name ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Oe,{placeholder:"Enter event name",value:c,onChange:we=>d(we.target.value),className:"bg-background"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{className:"text-sm font-semibold text-foreground",children:"Description"}),a.jsx(us,{placeholder:"Write here…",value:u,onChange:we=>h(we.target.value),className:"bg-background min-h-[100px] resize-none"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(_e,{className:"text-sm font-semibold text-foreground",children:"When"}),a.jsxs("div",{className:"rounded-lg border border-border p-4 space-y-4 bg-background",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(_e,{className:"text-xs font-medium text-primary",children:["From ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-[minmax(0,1fr)_8.5rem]",children:[a.jsx(Oe,{type:"date",value:m,onChange:we=>f(we.target.value),className:"bg-background text-sm min-w-0 w-full"}),a.jsx(Oe,{type:"time",step:"60",value:p,onChange:we=>g(we.target.value),className:"bg-background text-sm min-w-0 w-full"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{className:"text-xs font-medium text-primary",children:"To"}),a.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-[minmax(0,1fr)_8.5rem]",children:[a.jsx(Oe,{type:"date",value:v,onChange:we=>b(we.target.value),className:"bg-background text-sm min-w-0 w-full"}),a.jsx(Oe,{type:"time",step:"60",value:x,onChange:we=>w(we.target.value),className:"bg-background text-sm min-w-0 w-full"})]})]})]}),!l&&a.jsxs("div",{className:"flex items-end gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{className:"text-xs font-semibold text-foreground",children:"Repeats"}),a.jsxs(zn,{value:k,onValueChange:we=>S(we),children:[a.jsx(On,{className:"w-44 bg-background text-xs",children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"none",children:"Does not repeat"}),a.jsx(pt,{value:"Daily",children:"Daily"}),a.jsx(pt,{value:"Weekly",children:"Weekly"}),a.jsx(pt,{value:"Bi-Weekly",children:"Bi-weekly"})]})]})]}),k!=="none"&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{className:"text-xs font-semibold text-foreground",children:"Occurrences"}),a.jsx(Oe,{type:"number",min:2,value:C,onChange:we=>j(Number(we.target.value)),className:"w-24 bg-background text-xs"})]})]})]})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(_e,{className:"text-sm font-semibold text-foreground",children:"Online event"}),a.jsxs("div",{className:"flex flex-wrap gap-5",children:[!l&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ji,{id:"videoCall",checked:E,onCheckedChange:we=>{N(!!we),we&&(_(!1),R(!1))}}),a.jsx(_e,{htmlFor:"videoCall",className:"text-sm text-foreground cursor-pointer",children:"Video call"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ji,{id:"webinarLink",checked:A,onCheckedChange:we=>{_(!!we),we&&(N(!1),R(!1))}}),a.jsx(_e,{htmlFor:"webinarLink",className:"text-sm text-foreground cursor-pointer",children:"Webinar"})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ji,{id:"customLink",checked:T,onCheckedChange:we=>{R(!!we),we&&(N(!1),_(!1))},className:"data-[state=checked]:bg-primary data-[state=checked]:border-primary"}),a.jsx(_e,{htmlFor:"customLink",className:"text-sm text-foreground cursor-pointer",children:"Custom link"})]})]}),T&&a.jsx(Oe,{placeholder:"https://",value:O,onChange:we=>F(we.target.value),className:"bg-background text-sm"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{className:"text-sm font-semibold text-foreground",children:"Max registrations"}),a.jsx(Oe,{type:"number",min:0,value:W,onChange:we=>V(Number(we.target.value)),className:"bg-background",placeholder:"0 = unlimited"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{className:"text-sm font-semibold text-foreground",children:"Visibility"}),a.jsx(gn,{label:"Visibility",children:l&&!(r!=null&&r.audienceRestricted)?"This event was created before event passwords, so it keeps working as before: a private event needs no password and stays visible to members as it was.":"Public events are open to members of the channels you share to. Private events also ask those members for a password before they can register or join."})]}),(!l||(r==null?void 0:r.audienceRestricted))&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"Members will see this event only after an admin shares it to their channels."}),a.jsxs("div",{className:"flex gap-5 pt-2.5",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ji,{id:"public",checked:!D,onCheckedChange:()=>I(!1),className:"data-[state=checked]:bg-primary data-[state=checked]:border-primary"}),a.jsx(_e,{htmlFor:"public",className:"text-sm cursor-pointer",children:"Public"})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ji,{id:"private",checked:D,onCheckedChange:()=>I(!0)}),a.jsx(_e,{htmlFor:"private",className:"text-sm cursor-pointer",children:"Private"})]})]}),D&&(!l||(r==null?void 0:r.audienceRestricted))&&a.jsxs("div",{className:"space-y-1.5 pt-3",children:[a.jsx(_e,{htmlFor:"event-password",children:"Event password"}),a.jsxs("div",{className:"relative",children:[a.jsx(Oe,{id:"event-password",type:z?"text":"password",autoComplete:"new-password",value:P,onChange:we=>M(we.target.value),className:"pr-11","aria-describedby":"event-password-warning",placeholder:l&&(r!=null&&r.passwordRequired)?"Leave blank to keep the current password":"At least 8 characters"}),a.jsx("button",{type:"button",onClick:()=>G(we=>!we),"aria-label":z?"Hide event password":"Show event password","aria-pressed":z,className:"absolute right-1 top-1/2 -translate-y-1/2 rounded-md p-2 text-muted-foreground hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:z?a.jsx(BP,{className:"h-4 w-4"}):a.jsx(Oc,{className:"h-4 w-4"})})]}),a.jsxs("p",{id:"event-password-warning",className:"text-xs font-medium text-amber-700 dark:text-amber-400",children:["Save this password somewhere safe. You won’t be able to view or recover it after ",l?"saving":"creating"," the event."]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Only members of the channels you share to can enter, even with the password."})]})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{className:"text-sm font-semibold text-foreground",children:"Venue"}),a.jsxs("div",{className:"relative",children:[a.jsx(Jf,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Oe,{placeholder:"Enter address (optional)",value:B,onChange:we=>H(we.target.value),className:"pl-9 bg-background"})]})]}),a.jsxs("div",{className:"flex items-center justify-between pt-4 border-t border-border",children:[a.jsx(Z,{variant:"outline",onClick:()=>e(!1),className:"px-6",disabled:Y,children:"Cancel"}),a.jsxs(Z,{onClick:Me,className:"px-8",disabled:Y,children:[Y&&a.jsx(Ne,{className:"h-4 w-4 mr-2 animate-spin"}),l?"Save changes":"Create"]})]})]})]})}),a.jsx(jPe,{open:Q,onOpenChange:ie,title:"Notify attendees about these changes?",participantCount:r==null?void 0:r.attendees,loading:Y||he,onNotify:()=>{ye(!0),ie(!1),Ie(!0)},onSkip:()=>{ie(!1),Ie(!1)}}),a.jsx(Nh,{file:fe,aspect:N0r,title:"Adjust event banner",onCancel:pe,onCropped:ce})]})}function FAt({eventId:t,eventSlug:e,open:n,onOpenChange:r,invitedSections:s=[],audienceRestricted:i=!1,onShared:o}){const{community:l}=qe(),{groups:c}=Ln(),[d,u]=y.useState(new Set),[h,m]=y.useState(!1);y.useEffect(()=>{u(new Set)},[n,t]);const f=c.flatMap(k=>IZ(k).map(S=>S.id)).filter(k=>!s.includes(k)),p=f.length>0&&f.every(k=>d.has(k)),g=y.useMemo(()=>typeof window>"u"?"":`${window.location.origin}${Nk({realId:t,slug:e})}`,[t,e]),v=y.useMemo(()=>c.map(k=>({group:k,tabs:IZ(k)})).filter(k=>k.tabs.length>0),[c]),b=k=>{u(S=>{const C=new Set(S);return C.has(k)?C.delete(k):C.add(k),C})},x=async()=>{try{await navigator.clipboard.writeText(g),He.success("Event link copied")}catch{He.error("Couldn't copy link")}},w=async()=>{if(!(l!=null&&l.id)||d.size===0)return;const k=v.map(({group:S,tabs:C})=>({id:S.id,sections:C.filter(j=>d.has(j.id)).map(j=>j.id)})).filter(S=>S.sections.length>0);m(!0);try{await j0r(l.id,t,k),He.success("Event shared to the selected channels"),o==null||o(),u(new Set),r(!1)}catch(S){He.error(S instanceof ze?S.message:"Couldn't share the event")}finally{m(!1)}};return a.jsx(Bt,{open:n,onOpenChange:r,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] max-w-[480px] rounded-lg p-5 sm:p-6",children:[a.jsxs(Vt,{className:"pr-6 text-left",children:[a.jsx(Ut,{children:"Share to channels"}),a.jsx(_n,{children:i?"Share to channels to make this event visible to their members. Copying the link does not grant access.":"Copy the event link or post it into group channels. Members of those channels will be invited."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Share link"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Oe,{readOnly:!0,value:g,className:"text-xs"}),a.jsx(Z,{type:"button",variant:"outline",size:"icon",className:"shrink-0",onClick:()=>void x(),children:a.jsx(Zl,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"max-h-[45vh] overflow-y-auto space-y-4 py-1",children:[f.length>0&&a.jsxs("label",{className:"flex items-center gap-3 px-2 py-1.5 cursor-pointer",children:[a.jsx(ji,{checked:p?!0:d.size>0?"indeterminate":!1,disabled:h,onCheckedChange:()=>u(p?new Set:new Set(f))}),a.jsx("span",{className:"text-sm font-semibold",children:"Select all channels"})]}),v.length===0?a.jsx("p",{className:"text-sm text-muted-foreground text-center py-4",children:"No channels available to share into."}):v.map(({group:k,tabs:S})=>a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground mb-2",children:k.name}),a.jsx("div",{className:"space-y-1.5",children:S.map(C=>a.jsxs("label",{className:"flex items-center gap-3 px-2 py-1.5 rounded-md hover:bg-muted/60 cursor-pointer",children:[a.jsx(ji,{checked:s.includes(C.id)||d.has(C.id),disabled:h||s.includes(C.id),onCheckedChange:()=>b(C.id)}),a.jsx("span",{className:"text-sm text-foreground",children:C.name})]},C.id))})]},k.id))]}),a.jsxs(ir,{className:"gap-2 sm:gap-0",children:[a.jsx(Z,{variant:"outline",onClick:()=>r(!1),disabled:h,children:"Cancel"}),a.jsxs(Z,{onClick:w,disabled:h||d.size===0,children:[h?a.jsx(Ne,{className:"h-4 w-4 mr-2 animate-spin"}):a.jsx(_s,{className:"h-4 w-4 mr-2"}),"Share",d.size>0?` (${d.size})`:""]})]})]})})}function _0r({event:t,tab:e,isAdmin:n,onShare:r,onEdit:s,onDelete:i,onShowAttendees:o}){const l=Nn(),c=e==="upcoming",d=n||t.canEdit||!c&&t.canDelete,u=vte(t.startTime,t.endTime);return a.jsxs(it.div,{whileHover:{scale:1.005,y:-1},transition:{type:"spring",stiffness:400,damping:25},onClick:()=>l(Nk(t)),className:"group flex gap-4 p-3 rounded-lg border border-border bg-card hover:shadow-md hover:border-primary/20 cursor-pointer transition-all duration-200",children:[a.jsx("div",{className:"w-28 h-20 rounded-md overflow-hidden shrink-0 bg-muted",children:t.hasBanner?a.jsx("img",{src:t.thumbnail,alt:t.title,className:"w-full h-full object-contain"}):a.jsx("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-primary/20 to-primary/5",children:a.jsx(ym,{className:"h-7 w-7 text-primary/50"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-0.5",children:u}),a.jsxs("div",{className:"flex items-center gap-2 mb-1 flex-wrap",children:[a.jsx(SPe,{startTime:t.startTime,endTime:t.endTime,meetingUnavailable:t.meetingUnavailable}),t.isPrivate&&a.jsxs(ga,{variant:"outline",className:"text-[10px] px-1.5 py-0 gap-0.5",children:[a.jsx(wa,{className:"h-2.5 w-2.5"}),"Private"]}),a.jsx("h3",{className:"text-sm font-semibold text-foreground truncate",children:t.title})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Timezone: ",t.timezone]})]}),d&&a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx("button",{type:"button",onClick:h=>h.stopPropagation(),className:"shrink-0 p-1 rounded hover:bg-muted text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",onClick:h=>h.stopPropagation(),children:[n&&a.jsxs(ot,{onClick:()=>r(t),children:[a.jsx(_s,{className:"h-4 w-4 mr-2"}),"Share to channels"]}),c&&t.canEdit&&a.jsxs(ot,{onClick:()=>s(t),children:[a.jsx(Qs,{className:"h-4 w-4 mr-2"}),"Edit"]}),(c?t.canEdit:n||t.canDelete)&&a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>i(t),children:[a.jsx(qn,{className:"h-4 w-4 mr-2"}),"Delete"]}),c&&t.canEdit&&t.isRecurringParent&&a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>i(t,{deleteAll:!0}),children:[a.jsx(qn,{className:"h-4 w-4 mr-2"}),"Delete subsequent events"]}),!c&&n&&a.jsxs(a.Fragment,{children:[a.jsx(mi,{}),a.jsxs(ot,{onClick:()=>o(t),children:[a.jsx(Oc,{className:"h-4 w-4 mr-2"}),"Show attendees"]})]})]})]})]}),a.jsxs("div",{className:"flex items-center justify-between mt-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(oo,{className:"h-5 w-5",children:[a.jsx(lo,{src:t.organizerAvatar}),a.jsx(co,{className:"text-[8px] bg-primary/10 text-primary",children:t.organiser.split(" ").map(h=>h[0]).join("")})]}),a.jsx("span",{className:"text-xs text-muted-foreground",children:t.organiser})]}),a.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(wr,{className:"h-3 w-3"}),a.jsx("span",{children:t.attendees})]})]})]})]})}function Ts(){return Ts=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)({}).hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ts.apply(null,arguments)}function u0(t){"@babel/helpers - typeof";return u0=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},u0(t)}function A0r(t,e){if(u0(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(u0(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function BAt(t){var e=A0r(t,"string");return u0(e)=="symbol"?e:e+""}function fd(t,e,n){return(e=BAt(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function $se(t,e){if(t==null)return{};var n={};for(var r in t)if({}.hasOwnProperty.call(t,r)){if(e.indexOf(r)!==-1)continue;n[r]=t[r]}return n}function Oy(t,e){if(t==null)return{};var n,r,s=$se(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(r=0;r<i.length;r++)n=i[r],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(s[n]=t[n])}return s}function wc(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qHe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,BAt(r.key),r)}}function kc(t,e,n){return e&&qHe(t.prototype,e),n&&qHe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function P0r(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function su(t,e){if(e&&(u0(e)=="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return P0r(t)}function ci(t){return ci=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},ci(t)}function nJ(t,e){return nJ=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},nJ(t,e)}function iu(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&nJ(t,e)}function UAt(t){if(Array.isArray(t))return t}function R0r(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(u){d=!0,s=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function $0e(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function NPe(t,e){if(t){if(typeof t=="string")return $0e(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$0e(t,e):void 0}}function zAt(){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 Q2(t,e){return UAt(t)||R0r(t,e)||NPe(t,e)||zAt()}var VAt={exports:{}},I0r="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",M0r=I0r,L0r=M0r;function HAt(){}function GAt(){}GAt.resetWarningCache=HAt;var D0r=function(){function t(r,s,i,o,l,c){if(c!==L0r){var d=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw d.name="Invariant Violation",d}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:GAt,resetWarningCache:HAt};return n.PropTypes=n,n};VAt.exports=D0r();var $0r=VAt.exports;const $t=Fs($0r);var O0r=function(t,e,n,r,s,i,o,l){if(!t){var c;if(e===void 0)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var d=[n,r,s,i,o,l],u=0;c=new Error(e.replace(/%s/g,function(){return d[u++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}},F0r=O0r;const dF=Fs(F0r);var B0r=function(){};function U0r(t,e){var n={};return Object.keys(t).forEach(function(r){n[bq(r)]=B0r}),n}function KHe(t,e){return t[e]!==void 0}function bq(t){return"default"+t.charAt(0).toUpperCase()+t.substr(1)}function z0r(t){return!!t&&(typeof t!="function"||t.prototype&&t.prototype.isReactComponent)}function V0r(t,e){t.prototype=Object.create(e.prototype),t.prototype.constructor=t,nJ(t,e)}function WAt(){var t=this.constructor.getDerivedStateFromProps(this.props,this.state);t!=null&&this.setState(t)}function qAt(t){function e(n){var r=this.constructor.getDerivedStateFromProps(t,n);return r??null}this.setState(e.bind(this))}function KAt(t,e){try{var n=this.props,r=this.state;this.props=t,this.state=e,this.__reactInternalSnapshotFlag=!0,this.__reactInternalSnapshot=this.getSnapshotBeforeUpdate(n,r)}finally{this.props=n,this.state=r}}WAt.__suppressDeprecationWarning=!0;qAt.__suppressDeprecationWarning=!0;KAt.__suppressDeprecationWarning=!0;function H0r(t){var e=t.prototype;if(!e||!e.isReactComponent)throw new Error("Can only polyfill class components");if(typeof t.getDerivedStateFromProps!="function"&&typeof e.getSnapshotBeforeUpdate!="function")return t;var n=null,r=null,s=null;if(typeof e.componentWillMount=="function"?n="componentWillMount":typeof e.UNSAFE_componentWillMount=="function"&&(n="UNSAFE_componentWillMount"),typeof e.componentWillReceiveProps=="function"?r="componentWillReceiveProps":typeof e.UNSAFE_componentWillReceiveProps=="function"&&(r="UNSAFE_componentWillReceiveProps"),typeof e.componentWillUpdate=="function"?s="componentWillUpdate":typeof e.UNSAFE_componentWillUpdate=="function"&&(s="UNSAFE_componentWillUpdate"),n!==null||r!==null||s!==null){var i=t.displayName||t.name,o=typeof t.getDerivedStateFromProps=="function"?"getDerivedStateFromProps()":"getSnapshotBeforeUpdate()";throw Error(`Unsafe legacy lifecycles will not be called for components using new component APIs.

`+i+" uses "+o+" but also contains the following legacy lifecycles:"+(n!==null?`
  `+n:"")+(r!==null?`
  `+r:"")+(s!==null?`
  `+s:"")+`

The above lifecycles should be removed. Learn more about this warning here:
https://fb.me/react-async-component-lifecycle-hooks`)}if(typeof t.getDerivedStateFromProps=="function"&&(e.componentWillMount=WAt,e.componentWillReceiveProps=qAt),typeof e.getSnapshotBeforeUpdate=="function"){if(typeof e.componentDidUpdate!="function")throw new Error("Cannot polyfill getSnapshotBeforeUpdate() for components that do not define componentDidUpdate() on the prototype");e.componentWillUpdate=KAt;var l=e.componentDidUpdate;e.componentDidUpdate=function(d,u,h){var m=this.__reactInternalSnapshotFlag?this.__reactInternalSnapshot:h;l.call(this,d,u,m)}}return t}var G0r="/Users/jquense/src/uncontrollable/src/uncontrollable.js";function YAt(t,e,n){n===void 0&&(n=[]);var r=t.displayName||t.name||"Component",s=z0r(t),i=Object.keys(e),o=i.map(bq);s||!n.length||dF(!1);var l=function(d){V0r(u,d);function u(){for(var m,f=arguments.length,p=new Array(f),g=0;g<f;g++)p[g]=arguments[g];m=d.call.apply(d,[this].concat(p))||this,m.handlers=Object.create(null),i.forEach(function(b){var x=e[b],w=function(S){if(m.props[x]){var C;m._notifying=!0;for(var j=arguments.length,E=new Array(j>1?j-1:0),N=1;N<j;N++)E[N-1]=arguments[N];(C=m.props)[x].apply(C,[S].concat(E)),m._notifying=!1}m.unmounted||m.setState(function(A){var _,T=A.values;return{values:Ts(Object.create(null),T,(_={},_[b]=S,_))}})};m.handlers[x]=w}),n.length&&(m.attachRef=function(b){m.inner=b});var v=Object.create(null);return i.forEach(function(b){v[b]=m.props[bq(b)]}),m.state={values:v,prevProps:{}},m}var h=u.prototype;return h.shouldComponentUpdate=function(){return!this._notifying},u.getDerivedStateFromProps=function(f,p){var g=p.values,v=p.prevProps,b={values:Ts(Object.create(null),g),prevProps:{}};return i.forEach(function(x){b.prevProps[x]=f[x],!KHe(f,x)&&KHe(v,x)&&(b.values[x]=f[bq(x)])}),b},h.componentWillUnmount=function(){this.unmounted=!0},h.render=function(){var f=this,p=this.props,g=p.innerRef,v=$se(p,["innerRef"]);o.forEach(function(x){delete v[x]});var b={};return i.forEach(function(x){var w=f.props[x];b[x]=w!==void 0?w:f.state.values[x]}),se.createElement(t,Ts({},v,b,this.handlers,{ref:g||this.attachRef}))},u}(se.Component);H0r(l),l.displayName="Uncontrolled("+r+")",l.propTypes=Ts({innerRef:function(){}},U0r(e)),n.forEach(function(d){l.prototype[d]=function(){var h;return(h=this.inner)[d].apply(h,arguments)}});var c=l;return se.forwardRef&&(c=se.forwardRef(function(d,u){return se.createElement(l,Ts({},d,{innerRef:u,__source:{fileName:G0r,lineNumber:128},__self:this}))}),c.propTypes=l.propTypes),c.ControlledComponent=t,c.deferControlTo=function(d,u,h){return u===void 0&&(u={}),YAt(d,Ts({},e,u),h)},c}var rJ="milliseconds",uF="seconds",hF="minutes",mF="hours",Z2="day",t5="week",fF="month",J2="year",X2="decade",eE="century",QAt={milliseconds:1,seconds:1e3,minutes:60*1e3,hours:60*60*1e3,day:24*60*60*1e3,week:7*24*60*60*1e3},W0r={month:1,year:12,decade:10*12,century:100*12};function q0r(t){return[31,K0r(t),31,30,31,30,31,31,30,31,30,31]}function K0r(t){return t%4===0&&t%100!==0||t%400===0?29:28}function Og(t,e,n){switch(t=new Date(t),n){case rJ:case uF:case hF:case mF:case Z2:case t5:return Y0r(t,e*QAt[n]);case fF:case J2:case X2:case eE:return Q0r(t,e*W0r[n])}throw new TypeError('Invalid units: "'+n+'"')}function Y0r(t,e){var n=new Date(+t+e);return Z0r(t,n)}function Q0r(t,e){var n=t.getFullYear(),r=t.getMonth(),s=t.getDate(),i=n*12+r+e,o=Math.trunc(i/12),l=i%12,c=Math.min(s,q0r(o)[l]),d=new Date(t);return d.setFullYear(o),d.setDate(1),d.setMonth(l),d.setDate(c),d}function Z0r(t,e){var n=t.getTimezoneOffset(),r=e.getTimezoneOffset(),s=r-n;return new Date(+e+s*QAt.minutes)}function pF(t,e,n){return Og(t,-e,n)}function jd(t,e,n){switch(t=new Date(t),e){case eE:case X2:case J2:t=iJ(t,0);case fF:t=tPt(t,1);case t5:case Z2:t=yF(t,0);case mF:t=n5(t,0);case hF:t=vF(t,0);case uF:t=gF(t,0)}return e===X2&&(t=pF(t,tE(t)%10,"year")),e===eE&&(t=pF(t,tE(t)%100,"year")),e===t5&&(t=nPt(t,0,n)),t}function sJ(t,e,n){switch(t=new Date(t),t=jd(t,e,n),e){case eE:case X2:case J2:case fF:case t5:t=Og(t,1,e),t=pF(t,1,Z2),t.setHours(23,59,59,999);break;case Z2:t.setHours(23,59,59,999);break;case mF:case hF:case uF:t=Og(t,1,e),t=pF(t,1,rJ)}return t}var PM=IM(function(t,e){return t===e}),TPe=IM(function(t,e){return t!==e}),Ose=IM(function(t,e){return t>e}),o9=IM(function(t,e){return t>=e}),_Pe=IM(function(t,e){return t<e}),RM=IM(function(t,e){return t<=e});function ZAt(){return new Date(Math.min.apply(Math,arguments))}function JAt(){return new Date(Math.max.apply(Math,arguments))}function XAt(t,e,n,r){return r=r||"day",(!e||o9(t,e,r))&&(!n||RM(t,n,r))}var gF=RS("Milliseconds"),vF=RS("Seconds"),n5=RS("Minutes"),yF=RS("Hours"),ePt=RS("Day"),tPt=RS("Date"),iJ=RS("Month"),tE=RS("FullYear");function J0r(t,e){return e===void 0?tE(jd(t,X2)):Og(t,e+10,J2)}function X0r(t,e){return e===void 0?tE(jd(t,eE)):Og(t,e+100,J2)}function nPt(t,e,n){var r=(ePt(t)+7-(n||0))%7;return e===void 0?r:Og(t,e-r,Z2)}function ewr(t,e,n,r){var s,i,o;switch(n){case rJ:case uF:case hF:case mF:case Z2:case t5:s=e.getTime()-t.getTime();break;case fF:case J2:case X2:case eE:s=(tE(e)-tE(t))*12+iJ(e)-iJ(t);break;default:throw new TypeError('Invalid units: "'+n+'"')}switch(n){case rJ:i=1;break;case uF:i=1e3;break;case hF:i=1e3*60;break;case mF:i=1e3*60*60;break;case Z2:i=1e3*60*60*24;break;case t5:i=1e3*60*60*24*7;break;case fF:i=1;break;case J2:i=12;break;case X2:i=120;break;case eE:i=1200;break;default:throw new TypeError('Invalid units: "'+n+'"')}return o=s/i,r?o:Math.round(o)}function RS(t){var e=function(n){switch(n){case"Milliseconds":return 36e5;case"Seconds":return 3600;case"Minutes":return 60;case"Hours":return 1;default:return null}}(t);return function(n,r){if(r===void 0)return n["get"+t]();var s=new Date(n);return s["set"+t](r),e&&s["get"+t]()!=r&&(t==="Hours"||r>=e&&s.getHours()-n.getHours()<Math.floor(r/e))&&s["set"+t](r+e),s}}function IM(t){return function(e,n,r){return t(+jd(e,r),+jd(n,r))}}const YHe=Object.freeze(Object.defineProperty({__proto__:null,add:Og,century:X0r,date:tPt,day:ePt,decade:J0r,diff:ewr,endOf:sJ,eq:PM,gt:Ose,gte:o9,hours:yF,inRange:XAt,lt:_Pe,lte:RM,max:JAt,milliseconds:gF,min:ZAt,minutes:n5,month:iJ,neq:TPe,seconds:vF,startOf:jd,subtract:pF,weekday:nPt,year:tE},Symbol.toStringTag,{value:"Module"}));function twr(t){if(Array.isArray(t))return $0e(t)}function rPt(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function nwr(){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 xq(t){return twr(t)||rPt(t)||NPe(t)||nwr()}function rwr(t,e,n){var r=-1,s=t.length;e<0&&(e=-e>s?0:s+e),n=n>s?s:n,n<0&&(n+=s),s=e>n?0:n-e>>>0,e>>>=0;for(var i=Array(s);++r<s;)i[r]=t[r+e];return i}var APe=rwr;function swr(t,e){return t===e||t!==t&&e!==e}var l9=swr,iwr=typeof xf=="object"&&xf&&xf.Object===Object&&xf,sPt=iwr,awr=sPt,owr=typeof self=="object"&&self&&self.Object===Object&&self,lwr=awr||owr||Function("return this")(),Zg=lwr,cwr=Zg,dwr=cwr.Symbol,MM=dwr,QHe=MM,iPt=Object.prototype,uwr=iPt.hasOwnProperty,hwr=iPt.toString,$3=QHe?QHe.toStringTag:void 0;function mwr(t){var e=uwr.call(t,$3),n=t[$3];try{t[$3]=void 0;var r=!0}catch{}var s=hwr.call(t);return r&&(e?t[$3]=n:delete t[$3]),s}var fwr=mwr,pwr=Object.prototype,gwr=pwr.toString;function vwr(t){return gwr.call(t)}var ywr=vwr,ZHe=MM,bwr=fwr,xwr=ywr,wwr="[object Null]",kwr="[object Undefined]",JHe=ZHe?ZHe.toStringTag:void 0;function Swr(t){return t==null?t===void 0?kwr:wwr:JHe&&JHe in Object(t)?bwr(t):xwr(t)}var F0=Swr;function Cwr(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}var ip=Cwr;const LM=Fs(ip);var jwr=F0,Ewr=ip,Nwr="[object AsyncFunction]",Twr="[object Function]",_wr="[object GeneratorFunction]",Awr="[object Proxy]";function Pwr(t){if(!Ewr(t))return!1;var e=jwr(t);return e==Twr||e==_wr||e==Nwr||e==Awr}var Fse=Pwr;const Wr=Fs(Fse);var Rwr=9007199254740991;function Iwr(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=Rwr}var PPe=Iwr,Mwr=Fse,Lwr=PPe;function Dwr(t){return t!=null&&Lwr(t.length)&&!Mwr(t)}var DM=Dwr,$wr=9007199254740991,Owr=/^(?:0|[1-9]\d*)$/;function Fwr(t,e){var n=typeof t;return e=e??$wr,!!e&&(n=="number"||n!="symbol"&&Owr.test(t))&&t>-1&&t%1==0&&t<e}var RPe=Fwr,Bwr=l9,Uwr=DM,zwr=RPe,Vwr=ip;function Hwr(t,e,n){if(!Vwr(n))return!1;var r=typeof e;return(r=="number"?Uwr(n)&&zwr(e,n.length):r=="string"&&e in n)?Bwr(n[e],t):!1}var $M=Hwr,Gwr=/\s/;function Wwr(t){for(var e=t.length;e--&&Gwr.test(t.charAt(e)););return e}var qwr=Wwr,Kwr=qwr,Ywr=/^\s+/;function Qwr(t){return t&&t.slice(0,Kwr(t)+1).replace(Ywr,"")}var Zwr=Qwr;function Jwr(t){return t!=null&&typeof t=="object"}var Jg=Jwr,Xwr=F0,e1r=Jg,t1r="[object Symbol]";function n1r(t){return typeof t=="symbol"||e1r(t)&&Xwr(t)==t1r}var OM=n1r,r1r=Zwr,XHe=ip,s1r=OM,eGe=NaN,i1r=/^[-+]0x[0-9a-f]+$/i,a1r=/^0b[01]+$/i,o1r=/^0o[0-7]+$/i,l1r=parseInt;function c1r(t){if(typeof t=="number")return t;if(s1r(t))return eGe;if(XHe(t)){var e=typeof t.valueOf=="function"?t.valueOf():t;t=XHe(e)?e+"":e}if(typeof t!="string")return t===0?t:+t;t=r1r(t);var n=a1r.test(t);return n||o1r.test(t)?l1r(t.slice(2),n?2:8):i1r.test(t)?eGe:+t}var aPt=c1r,d1r=aPt,tGe=1/0,u1r=17976931348623157e292;function h1r(t){if(!t)return t===0?t:0;if(t=d1r(t),t===tGe||t===-tGe){var e=t<0?-1:1;return e*u1r}return t===t?t:0}var oPt=h1r,m1r=oPt;function f1r(t){var e=m1r(t),n=e%1;return e===e?n?e-n:e:0}var lPt=f1r,p1r=APe,g1r=$M,v1r=lPt,y1r=Math.ceil,b1r=Math.max;function x1r(t,e,n){(n?g1r(t,e,n):e===void 0)?e=1:e=b1r(v1r(e),0);var r=t==null?0:t.length;if(!r||e<1)return[];for(var s=0,i=0,o=Array(y1r(r/e));s<r;)o[i++]=p1r(t,s,s+=e);return o}var w1r=x1r;const k1r=Fs(w1r);function IPe(t){return t&&t.ownerDocument||document}function S1r(t){const e=IPe(t);return e&&e.defaultView||window}function C1r(t,e){return S1r(t).getComputedStyle(t,e)}const j1r=/([A-Z])/g;function E1r(t){return t.replace(j1r,"-$1").toLowerCase()}const N1r=/^ms-/;function zV(t){return E1r(t).replace(N1r,"-ms-")}const T1r=/^((translate|rotate|scale)(X|Y|Z|3d)?|matrix(3d)?|perspective|skew(X|Y)?)$/i;function _1r(t){return!!(t&&T1r.test(t))}function $_(t,e){let n="",r="";if(typeof e=="string")return t.style.getPropertyValue(zV(e))||C1r(t).getPropertyValue(zV(e));Object.keys(e).forEach(s=>{const i=e[s];!i&&i!==0?t.style.removeProperty(zV(s)):_1r(s)?r+=`${s}(${i}) `:n+=`${zV(s)}: ${i};`}),r&&(n+=`transform: ${r};`),t.style.cssText+=`;${n}`}function aJ(t,e){if(t.contains)return t.contains(e);if(t.compareDocumentPosition)return t===e||!!(t.compareDocumentPosition(e)&16)}function A1r(t){return"nodeType"in t&&t.nodeType===document.DOCUMENT_NODE}function MPe(t){return"window"in t&&t.window===t?t:A1r(t)&&t.defaultView||!1}function cPt(t){const e=t==="pageXOffset"?"scrollLeft":"scrollTop";function n(r,s){const i=MPe(r);if(s===void 0)return i?i[t]:r[e];i?i.scrollTo(i[t],s):r[e]=s}return n}const dPt=cPt("pageXOffset"),uPt=cPt("pageYOffset");function n2(t){const e=IPe(t);let n={top:0,left:0,height:0,width:0};const r=e&&e.documentElement;return!r||!aJ(r,t)||(t.getBoundingClientRect!==void 0&&(n=t.getBoundingClientRect()),n={top:n.top+uPt(r)-(r.clientTop||0),left:n.left+dPt(r)-(r.clientLeft||0),width:n.width,height:n.height}),n}const P1r=t=>!!t&&"offsetParent"in t;function R1r(t){const e=IPe(t);let n=t&&t.offsetParent;for(;P1r(n)&&n.nodeName!=="HTML"&&$_(n,"position")==="static";)n=n.offsetParent;return n||e.documentElement}const I1r=t=>t.nodeName&&t.nodeName.toLowerCase();function hPt(t,e){let n={top:0,left:0},r;if($_(t,"position")==="fixed")r=t.getBoundingClientRect();else{const o=e||R1r(t);r=n2(t),I1r(o)!=="html"&&(n=n2(o));const l=String($_(o,"borderTopWidth")||0);n.top+=parseInt(l,10)-uPt(o)||0;const c=String($_(o,"borderLeftWidth")||0);n.left+=parseInt(c,10)-dPt(o)||0}const s=String($_(t,"marginTop")||0),i=String($_(t,"marginLeft")||0);return{...r,top:r.top-n.top-(parseInt(s,10)||0),left:r.left-n.left-(parseInt(i,10)||0)}}const LPe=!!(typeof window<"u"&&window.document&&window.document.createElement);let nGe=new Date().getTime();function M1r(t){const e=new Date().getTime(),n=Math.max(0,16-(e-nGe)),r=setTimeout(t,n);return nGe=e,r}const L1r=["","webkit","moz","o","ms"];let O0e="clearTimeout",F0e=M1r;const rGe=(t,e)=>`${t+(t?e[0].toUpperCase()+e.substr(1):e)}AnimationFrame`;LPe&&L1r.some(t=>{const e=rGe(t,"request");return e in window&&(O0e=rGe(t,"cancel"),F0e=n=>window[e](n)),!!F0e});const sGe=t=>{typeof window[O0e]=="function"&&window[O0e](t)},mPt=F0e,D1r=!!(typeof window<"u"&&window.document&&window.document.createElement);var B0e=!1,U0e=!1;try{var oue={get passive(){return B0e=!0},get once(){return U0e=B0e=!0}};D1r&&(window.addEventListener("test",oue,oue),window.removeEventListener("test",oue,!0))}catch{}function $1r(t,e,n,r){if(r&&typeof r!="boolean"&&!U0e){var s=r.once,i=r.capture,o=n;!U0e&&s&&(o=n.__once||function l(c){this.removeEventListener(e,l,i),n.call(this,c)},n.__once=o),t.addEventListener(e,o,B0e?r:i)}t.addEventListener(e,n,r)}function O1r(t){const e=y.useRef(t);return y.useEffect(()=>{e.current=t},[t]),e}function iGe(t){const e=O1r(t);return y.useCallback(function(...n){return e.current&&e.current(...n)},[e])}function aGe(){return y.useState(null)}function F1r(){const t=y.useRef(!0),e=y.useRef(()=>t.current);return y.useEffect(()=>(t.current=!0,()=>{t.current=!1}),[]),e.current}function B1r(t){const e=F1r();return[t[0],y.useCallback(n=>{if(e())return t[1](n)},[e,t[1]])]}var xh="top",qf="bottom",Kf="right",wh="left",DPe="auto",c9=[xh,qf,Kf,wh],r5="start",bF="end",U1r="clippingParents",fPt="viewport",O3="popper",z1r="reference",oGe=c9.reduce(function(t,e){return t.concat([e+"-"+r5,e+"-"+bF])},[]),$Pe=[].concat(c9,[DPe]).reduce(function(t,e){return t.concat([e,e+"-"+r5,e+"-"+bF])},[]),V1r="beforeRead",H1r="read",G1r="afterRead",W1r="beforeMain",q1r="main",K1r="afterMain",Y1r="beforeWrite",Q1r="write",Z1r="afterWrite",J1r=[V1r,H1r,G1r,W1r,q1r,K1r,Y1r,Q1r,Z1r];function wy(t){return t.split("-")[0]}function Pm(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function nE(t){var e=Pm(t).Element;return t instanceof e||t instanceof Element}function ky(t){var e=Pm(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function OPe(t){if(typeof ShadowRoot>"u")return!1;var e=Pm(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}var r2=Math.max,oJ=Math.min,s5=Math.round;function z0e(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function pPt(){return!/^((?!chrome|android).)*safari/i.test(z0e())}function i5(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),s=1,i=1;e&&ky(t)&&(s=t.offsetWidth>0&&s5(r.width)/t.offsetWidth||1,i=t.offsetHeight>0&&s5(r.height)/t.offsetHeight||1);var o=nE(t)?Pm(t):window,l=o.visualViewport,c=!pPt()&&n,d=(r.left+(c&&l?l.offsetLeft:0))/s,u=(r.top+(c&&l?l.offsetTop:0))/i,h=r.width/s,m=r.height/i;return{width:h,height:m,top:u,right:d+h,bottom:u+m,left:d,x:d,y:u}}function FPe(t){var e=i5(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function gPt(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&OPe(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Kk(t){return t?(t.nodeName||"").toLowerCase():null}function h0(t){return Pm(t).getComputedStyle(t)}function X1r(t){return["table","td","th"].indexOf(Kk(t))>=0}function IS(t){return((nE(t)?t.ownerDocument:t.document)||window.document).documentElement}function Bse(t){return Kk(t)==="html"?t:t.assignedSlot||t.parentNode||(OPe(t)?t.host:null)||IS(t)}function lGe(t){return!ky(t)||h0(t).position==="fixed"?null:t.offsetParent}function ekr(t){var e=/firefox/i.test(z0e()),n=/Trident/i.test(z0e());if(n&&ky(t)){var r=h0(t);if(r.position==="fixed")return null}var s=Bse(t);for(OPe(s)&&(s=s.host);ky(s)&&["html","body"].indexOf(Kk(s))<0;){var i=h0(s);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||e&&i.willChange==="filter"||e&&i.filter&&i.filter!=="none")return s;s=s.parentNode}return null}function d9(t){for(var e=Pm(t),n=lGe(t);n&&X1r(n)&&h0(n).position==="static";)n=lGe(n);return n&&(Kk(n)==="html"||Kk(n)==="body"&&h0(n).position==="static")?e:n||ekr(t)||e}function BPe(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function P$(t,e,n){return r2(t,oJ(e,n))}function tkr(t,e,n){var r=P$(t,e,n);return r>n?n:r}function vPt(){return{top:0,right:0,bottom:0,left:0}}function yPt(t){return Object.assign({},vPt(),t)}function bPt(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var nkr=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,yPt(typeof e!="number"?e:bPt(e,c9))};function rkr(t){var e,n=t.state,r=t.name,s=t.options,i=n.elements.arrow,o=n.modifiersData.popperOffsets,l=wy(n.placement),c=BPe(l),d=[wh,Kf].indexOf(l)>=0,u=d?"height":"width";if(!(!i||!o)){var h=nkr(s.padding,n),m=FPe(i),f=c==="y"?xh:wh,p=c==="y"?qf:Kf,g=n.rects.reference[u]+n.rects.reference[c]-o[c]-n.rects.popper[u],v=o[c]-n.rects.reference[c],b=d9(i),x=b?c==="y"?b.clientHeight||0:b.clientWidth||0:0,w=g/2-v/2,k=h[f],S=x-m[u]-h[p],C=x/2-m[u]/2+w,j=P$(k,C,S),E=c;n.modifiersData[r]=(e={},e[E]=j,e.centerOffset=j-C,e)}}function skr(t){var e=t.state,n=t.options,r=n.element,s=r===void 0?"[data-popper-arrow]":r;s!=null&&(typeof s=="string"&&(s=e.elements.popper.querySelector(s),!s)||gPt(e.elements.popper,s)&&(e.elements.arrow=s))}const ikr={name:"arrow",enabled:!0,phase:"main",fn:rkr,effect:skr,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function a5(t){return t.split("-")[1]}var akr={top:"auto",right:"auto",bottom:"auto",left:"auto"};function okr(t,e){var n=t.x,r=t.y,s=e.devicePixelRatio||1;return{x:s5(n*s)/s||0,y:s5(r*s)/s||0}}function cGe(t){var e,n=t.popper,r=t.popperRect,s=t.placement,i=t.variation,o=t.offsets,l=t.position,c=t.gpuAcceleration,d=t.adaptive,u=t.roundOffsets,h=t.isFixed,m=o.x,f=m===void 0?0:m,p=o.y,g=p===void 0?0:p,v=typeof u=="function"?u({x:f,y:g}):{x:f,y:g};f=v.x,g=v.y;var b=o.hasOwnProperty("x"),x=o.hasOwnProperty("y"),w=wh,k=xh,S=window;if(d){var C=d9(n),j="clientHeight",E="clientWidth";if(C===Pm(n)&&(C=IS(n),h0(C).position!=="static"&&l==="absolute"&&(j="scrollHeight",E="scrollWidth")),C=C,s===xh||(s===wh||s===Kf)&&i===bF){k=qf;var N=h&&C===S&&S.visualViewport?S.visualViewport.height:C[j];g-=N-r.height,g*=c?1:-1}if(s===wh||(s===xh||s===qf)&&i===bF){w=Kf;var A=h&&C===S&&S.visualViewport?S.visualViewport.width:C[E];f-=A-r.width,f*=c?1:-1}}var _=Object.assign({position:l},d&&akr),T=u===!0?okr({x:f,y:g},Pm(n)):{x:f,y:g};if(f=T.x,g=T.y,c){var R;return Object.assign({},_,(R={},R[k]=x?"0":"",R[w]=b?"0":"",R.transform=(S.devicePixelRatio||1)<=1?"translate("+f+"px, "+g+"px)":"translate3d("+f+"px, "+g+"px, 0)",R))}return Object.assign({},_,(e={},e[k]=x?g+"px":"",e[w]=b?f+"px":"",e.transform="",e))}function lkr(t){var e=t.state,n=t.options,r=n.gpuAcceleration,s=r===void 0?!0:r,i=n.adaptive,o=i===void 0?!0:i,l=n.roundOffsets,c=l===void 0?!0:l,d={placement:wy(e.placement),variation:a5(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:s,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,cGe(Object.assign({},d,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:o,roundOffsets:c})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,cGe(Object.assign({},d,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const ckr={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:lkr,data:{}};var VV={passive:!0};function dkr(t){var e=t.state,n=t.instance,r=t.options,s=r.scroll,i=s===void 0?!0:s,o=r.resize,l=o===void 0?!0:o,c=Pm(e.elements.popper),d=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&d.forEach(function(u){u.addEventListener("scroll",n.update,VV)}),l&&c.addEventListener("resize",n.update,VV),function(){i&&d.forEach(function(u){u.removeEventListener("scroll",n.update,VV)}),l&&c.removeEventListener("resize",n.update,VV)}}const ukr={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:dkr,data:{}};var hkr={left:"right",right:"left",bottom:"top",top:"bottom"};function wq(t){return t.replace(/left|right|bottom|top/g,function(e){return hkr[e]})}var mkr={start:"end",end:"start"};function dGe(t){return t.replace(/start|end/g,function(e){return mkr[e]})}function UPe(t){var e=Pm(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function zPe(t){return i5(IS(t)).left+UPe(t).scrollLeft}function fkr(t,e){var n=Pm(t),r=IS(t),s=n.visualViewport,i=r.clientWidth,o=r.clientHeight,l=0,c=0;if(s){i=s.width,o=s.height;var d=pPt();(d||!d&&e==="fixed")&&(l=s.offsetLeft,c=s.offsetTop)}return{width:i,height:o,x:l+zPe(t),y:c}}function pkr(t){var e,n=IS(t),r=UPe(t),s=(e=t.ownerDocument)==null?void 0:e.body,i=r2(n.scrollWidth,n.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),o=r2(n.scrollHeight,n.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),l=-r.scrollLeft+zPe(t),c=-r.scrollTop;return h0(s||n).direction==="rtl"&&(l+=r2(n.clientWidth,s?s.clientWidth:0)-i),{width:i,height:o,x:l,y:c}}function VPe(t){var e=h0(t),n=e.overflow,r=e.overflowX,s=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+s+r)}function xPt(t){return["html","body","#document"].indexOf(Kk(t))>=0?t.ownerDocument.body:ky(t)&&VPe(t)?t:xPt(Bse(t))}function R$(t,e){var n;e===void 0&&(e=[]);var r=xPt(t),s=r===((n=t.ownerDocument)==null?void 0:n.body),i=Pm(r),o=s?[i].concat(i.visualViewport||[],VPe(r)?r:[]):r,l=e.concat(o);return s?l:l.concat(R$(Bse(o)))}function V0e(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function gkr(t,e){var n=i5(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function uGe(t,e,n){return e===fPt?V0e(fkr(t,n)):nE(e)?gkr(e,n):V0e(pkr(IS(t)))}function vkr(t){var e=R$(Bse(t)),n=["absolute","fixed"].indexOf(h0(t).position)>=0,r=n&&ky(t)?d9(t):t;return nE(r)?e.filter(function(s){return nE(s)&&gPt(s,r)&&Kk(s)!=="body"}):[]}function ykr(t,e,n,r){var s=e==="clippingParents"?vkr(t):[].concat(e),i=[].concat(s,[n]),o=i[0],l=i.reduce(function(c,d){var u=uGe(t,d,r);return c.top=r2(u.top,c.top),c.right=oJ(u.right,c.right),c.bottom=oJ(u.bottom,c.bottom),c.left=r2(u.left,c.left),c},uGe(t,o,r));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function wPt(t){var e=t.reference,n=t.element,r=t.placement,s=r?wy(r):null,i=r?a5(r):null,o=e.x+e.width/2-n.width/2,l=e.y+e.height/2-n.height/2,c;switch(s){case xh:c={x:o,y:e.y-n.height};break;case qf:c={x:o,y:e.y+e.height};break;case Kf:c={x:e.x+e.width,y:l};break;case wh:c={x:e.x-n.width,y:l};break;default:c={x:e.x,y:e.y}}var d=s?BPe(s):null;if(d!=null){var u=d==="y"?"height":"width";switch(i){case r5:c[d]=c[d]-(e[u]/2-n[u]/2);break;case bF:c[d]=c[d]+(e[u]/2-n[u]/2);break}}return c}function xF(t,e){e===void 0&&(e={});var n=e,r=n.placement,s=r===void 0?t.placement:r,i=n.strategy,o=i===void 0?t.strategy:i,l=n.boundary,c=l===void 0?U1r:l,d=n.rootBoundary,u=d===void 0?fPt:d,h=n.elementContext,m=h===void 0?O3:h,f=n.altBoundary,p=f===void 0?!1:f,g=n.padding,v=g===void 0?0:g,b=yPt(typeof v!="number"?v:bPt(v,c9)),x=m===O3?z1r:O3,w=t.rects.popper,k=t.elements[p?x:m],S=ykr(nE(k)?k:k.contextElement||IS(t.elements.popper),c,u,o),C=i5(t.elements.reference),j=wPt({reference:C,element:w,strategy:"absolute",placement:s}),E=V0e(Object.assign({},w,j)),N=m===O3?E:C,A={top:S.top-N.top+b.top,bottom:N.bottom-S.bottom+b.bottom,left:S.left-N.left+b.left,right:N.right-S.right+b.right},_=t.modifiersData.offset;if(m===O3&&_){var T=_[s];Object.keys(A).forEach(function(R){var O=[Kf,qf].indexOf(R)>=0?1:-1,F=[xh,qf].indexOf(R)>=0?"y":"x";A[R]+=T[F]*O})}return A}function bkr(t,e){e===void 0&&(e={});var n=e,r=n.placement,s=n.boundary,i=n.rootBoundary,o=n.padding,l=n.flipVariations,c=n.allowedAutoPlacements,d=c===void 0?$Pe:c,u=a5(r),h=u?l?oGe:oGe.filter(function(p){return a5(p)===u}):c9,m=h.filter(function(p){return d.indexOf(p)>=0});m.length===0&&(m=h);var f=m.reduce(function(p,g){return p[g]=xF(t,{placement:g,boundary:s,rootBoundary:i,padding:o})[wy(g)],p},{});return Object.keys(f).sort(function(p,g){return f[p]-f[g]})}function xkr(t){if(wy(t)===DPe)return[];var e=wq(t);return[dGe(t),e,dGe(e)]}function wkr(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var s=n.mainAxis,i=s===void 0?!0:s,o=n.altAxis,l=o===void 0?!0:o,c=n.fallbackPlacements,d=n.padding,u=n.boundary,h=n.rootBoundary,m=n.altBoundary,f=n.flipVariations,p=f===void 0?!0:f,g=n.allowedAutoPlacements,v=e.options.placement,b=wy(v),x=b===v,w=c||(x||!p?[wq(v)]:xkr(v)),k=[v].concat(w).reduce(function(W,V){return W.concat(wy(V)===DPe?bkr(e,{placement:V,boundary:u,rootBoundary:h,padding:d,flipVariations:p,allowedAutoPlacements:g}):V)},[]),S=e.rects.reference,C=e.rects.popper,j=new Map,E=!0,N=k[0],A=0;A<k.length;A++){var _=k[A],T=wy(_),R=a5(_)===r5,O=[xh,qf].indexOf(T)>=0,F=O?"width":"height",D=xF(e,{placement:_,boundary:u,rootBoundary:h,altBoundary:m,padding:d}),I=O?R?Kf:wh:R?qf:xh;S[F]>C[F]&&(I=wq(I));var P=wq(I),M=[];if(i&&M.push(D[T]<=0),l&&M.push(D[I]<=0,D[P]<=0),M.every(function(W){return W})){N=_,E=!1;break}j.set(_,M)}if(E)for(var z=p?3:1,G=function(V){var U=k.find(function(ne){var te=j.get(ne);if(te)return te.slice(0,V).every(function(re){return re})});if(U)return N=U,"break"},B=z;B>0;B--){var H=G(B);if(H==="break")break}e.placement!==N&&(e.modifiersData[r]._skip=!0,e.placement=N,e.reset=!0)}}const kkr={name:"flip",enabled:!0,phase:"main",fn:wkr,requiresIfExists:["offset"],data:{_skip:!1}};function hGe(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function mGe(t){return[xh,Kf,qf,wh].some(function(e){return t[e]>=0})}function Skr(t){var e=t.state,n=t.name,r=e.rects.reference,s=e.rects.popper,i=e.modifiersData.preventOverflow,o=xF(e,{elementContext:"reference"}),l=xF(e,{altBoundary:!0}),c=hGe(o,r),d=hGe(l,s,i),u=mGe(c),h=mGe(d);e.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:d,isReferenceHidden:u,hasPopperEscaped:h},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":h})}const Ckr={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:Skr};function jkr(t,e,n){var r=wy(t),s=[wh,xh].indexOf(r)>=0?-1:1,i=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,o=i[0],l=i[1];return o=o||0,l=(l||0)*s,[wh,Kf].indexOf(r)>=0?{x:l,y:o}:{x:o,y:l}}function Ekr(t){var e=t.state,n=t.options,r=t.name,s=n.offset,i=s===void 0?[0,0]:s,o=$Pe.reduce(function(u,h){return u[h]=jkr(h,e.rects,i),u},{}),l=o[e.placement],c=l.x,d=l.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=c,e.modifiersData.popperOffsets.y+=d),e.modifiersData[r]=o}const Nkr={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:Ekr};function Tkr(t){var e=t.state,n=t.name;e.modifiersData[n]=wPt({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}const _kr={name:"popperOffsets",enabled:!0,phase:"read",fn:Tkr,data:{}};function Akr(t){return t==="x"?"y":"x"}function Pkr(t){var e=t.state,n=t.options,r=t.name,s=n.mainAxis,i=s===void 0?!0:s,o=n.altAxis,l=o===void 0?!1:o,c=n.boundary,d=n.rootBoundary,u=n.altBoundary,h=n.padding,m=n.tether,f=m===void 0?!0:m,p=n.tetherOffset,g=p===void 0?0:p,v=xF(e,{boundary:c,rootBoundary:d,padding:h,altBoundary:u}),b=wy(e.placement),x=a5(e.placement),w=!x,k=BPe(b),S=Akr(k),C=e.modifiersData.popperOffsets,j=e.rects.reference,E=e.rects.popper,N=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,A=typeof N=="number"?{mainAxis:N,altAxis:N}:Object.assign({mainAxis:0,altAxis:0},N),_=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,T={x:0,y:0};if(C){if(i){var R,O=k==="y"?xh:wh,F=k==="y"?qf:Kf,D=k==="y"?"height":"width",I=C[k],P=I+v[O],M=I-v[F],z=f?-E[D]/2:0,G=x===r5?j[D]:E[D],B=x===r5?-E[D]:-j[D],H=e.elements.arrow,W=f&&H?FPe(H):{width:0,height:0},V=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:vPt(),U=V[O],ne=V[F],te=P$(0,j[D],W[D]),re=w?j[D]/2-z-te-U-A.mainAxis:G-te-U-A.mainAxis,fe=w?-j[D]/2+z+te+ne+A.mainAxis:B+te+ne+A.mainAxis,le=e.elements.arrow&&d9(e.elements.arrow),q=le?k==="y"?le.clientTop||0:le.clientLeft||0:0,Y=(R=_==null?void 0:_[k])!=null?R:0,X=I+re-Y-q,Q=I+fe-Y,ie=P$(f?oJ(P,X):P,I,f?r2(M,Q):M);C[k]=ie,T[k]=ie-I}if(l){var he,ye=k==="x"?xh:wh,J=k==="x"?qf:Kf,K=C[S],ce=S==="y"?"height":"width",pe=K+v[ye],Ie=K-v[J],Me=[xh,wh].indexOf(b)!==-1,we=(he=_==null?void 0:_[S])!=null?he:0,Be=Me?pe:K-j[ce]-E[ce]-we+A.altAxis,Ve=Me?K+j[ce]+E[ce]-we-A.altAxis:Ie,be=f&&Me?tkr(Be,K,Ve):P$(f?Be:pe,K,f?Ve:Ie);C[S]=be,T[S]=be-K}e.modifiersData[r]=T}}const Rkr={name:"preventOverflow",enabled:!0,phase:"main",fn:Pkr,requiresIfExists:["offset"]};function Ikr(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function Mkr(t){return t===Pm(t)||!ky(t)?UPe(t):Ikr(t)}function Lkr(t){var e=t.getBoundingClientRect(),n=s5(e.width)/t.offsetWidth||1,r=s5(e.height)/t.offsetHeight||1;return n!==1||r!==1}function Dkr(t,e,n){n===void 0&&(n=!1);var r=ky(e),s=ky(e)&&Lkr(e),i=IS(e),o=i5(t,s,n),l={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((Kk(e)!=="body"||VPe(i))&&(l=Mkr(e)),ky(e)?(c=i5(e,!0),c.x+=e.clientLeft,c.y+=e.clientTop):i&&(c.x=zPe(i))),{x:o.left+l.scrollLeft-c.x,y:o.top+l.scrollTop-c.y,width:o.width,height:o.height}}function $kr(t){var e=new Map,n=new Set,r=[];t.forEach(function(i){e.set(i.name,i)});function s(i){n.add(i.name);var o=[].concat(i.requires||[],i.requiresIfExists||[]);o.forEach(function(l){if(!n.has(l)){var c=e.get(l);c&&s(c)}}),r.push(i)}return t.forEach(function(i){n.has(i.name)||s(i)}),r}function Okr(t){var e=$kr(t);return J1r.reduce(function(n,r){return n.concat(e.filter(function(s){return s.phase===r}))},[])}function Fkr(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function Bkr(t){var e=t.reduce(function(n,r){var s=n[r.name];return n[r.name]=s?Object.assign({},s,r,{options:Object.assign({},s.options,r.options),data:Object.assign({},s.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var fGe={placement:"bottom",modifiers:[],strategy:"absolute"};function pGe(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return!e.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function Ukr(t){t===void 0&&(t={});var e=t,n=e.defaultModifiers,r=n===void 0?[]:n,s=e.defaultOptions,i=s===void 0?fGe:s;return function(l,c,d){d===void 0&&(d=i);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},fGe,i),modifiersData:{},elements:{reference:l,popper:c},attributes:{},styles:{}},h=[],m=!1,f={state:u,setOptions:function(b){var x=typeof b=="function"?b(u.options):b;g(),u.options=Object.assign({},i,u.options,x),u.scrollParents={reference:nE(l)?R$(l):l.contextElement?R$(l.contextElement):[],popper:R$(c)};var w=Okr(Bkr([].concat(r,u.options.modifiers)));return u.orderedModifiers=w.filter(function(k){return k.enabled}),p(),f.update()},forceUpdate:function(){if(!m){var b=u.elements,x=b.reference,w=b.popper;if(pGe(x,w)){u.rects={reference:Dkr(x,d9(w),u.options.strategy==="fixed"),popper:FPe(w)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(A){return u.modifiersData[A.name]=Object.assign({},A.data)});for(var k=0;k<u.orderedModifiers.length;k++){if(u.reset===!0){u.reset=!1,k=-1;continue}var S=u.orderedModifiers[k],C=S.fn,j=S.options,E=j===void 0?{}:j,N=S.name;typeof C=="function"&&(u=C({state:u,options:E,name:N,instance:f})||u)}}}},update:Fkr(function(){return new Promise(function(v){f.forceUpdate(),v(u)})}),destroy:function(){g(),m=!0}};if(!pGe(l,c))return f;f.setOptions(d).then(function(v){!m&&d.onFirstUpdate&&d.onFirstUpdate(v)});function p(){u.orderedModifiers.forEach(function(v){var b=v.name,x=v.options,w=x===void 0?{}:x,k=v.effect;if(typeof k=="function"){var S=k({state:u,name:b,instance:f,options:w}),C=function(){};h.push(S||C)}})}function g(){h.forEach(function(v){return v()}),h=[]}return f}}var zkr=Ukr({defaultModifiers:[Ckr,_kr,ckr,ukr,Nkr,kkr,Rkr,ikr]}),gGe=function(e){return{position:e,top:"0",left:"0",opacity:"0",pointerEvents:"none"}},Vkr={name:"applyStyles",enabled:!1},Hkr={name:"ariaDescribedBy",enabled:!0,phase:"afterWrite",effect:function(e){var n=e.state;return function(){var r=n.elements,s=r.reference,i=r.popper;if("removeAttribute"in s){var o=(s.getAttribute("aria-describedby")||"").split(",").filter(function(l){return l.trim()!==i.id});o.length?s.setAttribute("aria-describedby",o.join(",")):s.removeAttribute("aria-describedby")}}},fn:function(e){var n,r=e.state,s=r.elements,i=s.popper,o=s.reference,l=(n=i.getAttribute("role"))==null?void 0:n.toLowerCase();if(i.id&&l==="tooltip"&&"setAttribute"in o){var c=o.getAttribute("aria-describedby");if(c&&c.split(",").indexOf(i.id)!==-1)return;o.setAttribute("aria-describedby",c?c+","+i.id:i.id)}}},Gkr=[];function Wkr(t,e,n){var r=n===void 0?{}:n,s=r.enabled,i=s===void 0?!0:s,o=r.placement,l=o===void 0?"bottom":o,c=r.strategy,d=c===void 0?"absolute":c,u=r.modifiers,h=u===void 0?Gkr:u,m=$se(r,["enabled","placement","strategy","modifiers"]),f=y.useRef(),p=y.useCallback(function(){var k;(k=f.current)==null||k.update()},[]),g=y.useCallback(function(){var k;(k=f.current)==null||k.forceUpdate()},[]),v=B1r(y.useState({placement:l,update:p,forceUpdate:g,attributes:{},styles:{popper:gGe(d),arrow:{}}})),b=v[0],x=v[1],w=y.useMemo(function(){return{name:"updateStateModifier",enabled:!0,phase:"write",requires:["computeStyles"],fn:function(S){var C=S.state,j={},E={};Object.keys(C.elements).forEach(function(N){j[N]=C.styles[N],E[N]=C.attributes[N]}),x({state:C,styles:j,attributes:E,update:p,forceUpdate:g,placement:C.placement})}}},[p,g,x]);return y.useEffect(function(){!f.current||!i||f.current.setOptions({placement:l,strategy:d,modifiers:[].concat(h,[w,Vkr])})},[d,l,w,i]),y.useEffect(function(){if(!(!i||t==null||e==null))return f.current=zkr(t,e,Ts({},m,{placement:l,strategy:d,modifiers:[].concat(h,[Hkr,w])})),function(){f.current!=null&&(f.current.destroy(),f.current=void 0,x(function(k){return Ts({},k,{attributes:{},styles:{popper:gGe(d)}})}))}},[i,t,e]),b}function qkr(t,e){if(t.contains)return t.contains(e);if(t.compareDocumentPosition)return t===e||!!(t.compareDocumentPosition(e)&16)}function Kkr(t,e,n,r){var s=r&&typeof r!="boolean"?r.capture:r;t.removeEventListener(e,n,s),n.__once&&t.removeEventListener(e,n.__once,s)}function HV(t,e,n,r){return $1r(t,e,n,r),function(){Kkr(t,e,n,r)}}var Ykr=function(){},Qkr=Ykr;const Zkr=Fs(Qkr);function kPt(t){return t&&t.ownerDocument||document}function Jkr(t){return t&&"setState"in t?see.findDOMNode(t):t??null}const Xkr=function(t){return kPt(Jkr(t))};var eSr=27,vGe=function(){};function tSr(t){return t.button===0}function nSr(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}var yGe=function(e){return e&&("current"in e?e.current:e)};function rSr(t,e,n){var r=n===void 0?{}:n,s=r.disabled,i=r.clickTrigger,o=i===void 0?"click":i,l=y.useRef(!1),c=e||vGe,d=y.useCallback(function(m){var f,p=yGe(t);Zkr(!!p,"RootClose captured a close event but does not have a ref to compare it to. useRootClose(), should be passed a ref that resolves to a DOM node"),l.current=!p||nSr(m)||!tSr(m)||!!qkr(p,(f=m.composedPath==null?void 0:m.composedPath()[0])!=null?f:m.target)},[t]),u=iGe(function(m){l.current||c(m)}),h=iGe(function(m){m.keyCode===eSr&&c(m)});y.useEffect(function(){if(!(s||t==null)){var m=window.event,f=Xkr(yGe(t)),p=HV(f,o,d,!0),g=HV(f,o,function(x){if(x===m){m=void 0;return}u(x)}),v=HV(f,"keyup",function(x){if(x===m){m=void 0;return}h(x)}),b=[];return"ontouchstart"in f.documentElement&&(b=[].slice.call(f.body.children).map(function(x){return HV(x,"mousemove",vGe)})),function(){p(),g(),v(),b.forEach(function(x){return x()})}}},[t,s,o,d,u,h])}function sSr(t){var e={};return Array.isArray(t)?(t==null||t.forEach(function(n){e[n.name]=n}),e):t||e}function iSr(t){return t===void 0&&(t={}),Array.isArray(t)?t:Object.keys(t).map(function(e){return t[e].name=e,t[e]})}function aSr(t){var e,n,r,s,i=t.enabled,o=t.enableEvents,l=t.placement,c=t.flip,d=t.offset,u=t.fixed,h=t.containerPadding,m=t.arrowElement,f=t.popperConfig,p=f===void 0?{}:f,g=sSr(p.modifiers);return Ts({},p,{placement:l,enabled:i,strategy:u?"fixed":p.strategy,modifiers:iSr(Ts({},g,{eventListeners:{enabled:o},preventOverflow:Ts({},g.preventOverflow,{options:h?Ts({padding:h},(e=g.preventOverflow)==null?void 0:e.options):(n=g.preventOverflow)==null?void 0:n.options}),offset:{options:Ts({offset:d},(r=g.offset)==null?void 0:r.options)},arrow:Ts({},g.arrow,{enabled:!!m,options:Ts({},(s=g.arrow)==null?void 0:s.options,{element:m})}),flip:Ts({enabled:!!c},g.flip)}))})}var lue=function(e){var n;return typeof document>"u"?null:e==null?kPt().body:(typeof e=="function"&&(e=e()),e&&"current"in e&&(e=e.current),(n=e)!=null&&n.nodeType&&e||null)};function bGe(t,e){var n=y.useState(function(){return lue(t)}),r=n[0],s=n[1];if(!r){var i=lue(t);i&&s(i)}return y.useEffect(function(){},[e,r]),y.useEffect(function(){var o=lue(t);o!==r&&s(o)},[t,r]),r}const xGe=t=>!t||typeof t=="function"?t:e=>{t.current=e};function oSr(t,e){const n=xGe(t),r=xGe(e);return s=>{n&&n(s),r&&r(s)}}function lSr(t,e){return y.useMemo(()=>oSr(t,e),[t,e])}var HPe=se.forwardRef(function(t,e){var n=t.flip,r=t.offset,s=t.placement,i=t.containerPadding,o=i===void 0?5:i,l=t.popperConfig,c=l===void 0?{}:l,d=t.transition,u=aGe(),h=u[0],m=u[1],f=aGe(),p=f[0],g=f[1],v=lSr(m,e),b=bGe(t.container),x=bGe(t.target),w=y.useState(!t.show),k=w[0],S=w[1],C=Wkr(x,h,aSr({placement:s,enableEvents:!!t.show,containerPadding:o||5,flip:n,offset:r,arrowElement:p,popperConfig:c})),j=C.styles,E=C.attributes,N=$se(C,["styles","attributes"]);t.show?k&&S(!1):!t.transition&&!k&&S(!0);var A=function(){S(!0),t.onExited&&t.onExited.apply(t,arguments)},_=t.show||d&&!k;if(rSr(h,t.onHide,{disabled:!t.rootClose||t.rootCloseDisabled,clickTrigger:t.rootCloseEvent}),!_)return null;var T=t.children(Ts({},N,{show:!!t.show,props:Ts({},E.popper,{style:j.popper,ref:v}),arrowProps:Ts({},E.arrow,{style:j.arrow,ref:g})}));if(d){var R=t.onExit,O=t.onExiting,F=t.onEnter,D=t.onEntering,I=t.onEntered;T=se.createElement(d,{in:t.show,appear:!0,onExit:R,onExiting:O,onExited:A,onEnter:F,onEntering:D,onEntered:I},T)}return b?see.createPortal(T,b):null});HPe.displayName="Overlay";HPe.propTypes={show:$t.bool,placement:$t.oneOf($Pe),target:$t.any,container:$t.any,flip:$t.bool,children:$t.func.isRequired,containerPadding:$t.number,popperConfig:$t.object,rootClose:$t.bool,rootCloseEvent:$t.oneOf(["click","mousedown"]),rootCloseDisabled:$t.bool,onHide:function(e){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];if(e.rootClose){var i;return(i=$t.func).isRequired.apply(i,[e].concat(r))}return $t.func.apply($t,[e].concat(r))},transition:$t.elementType,onEnter:$t.func,onEntering:$t.func,onEntered:$t.func,onExit:$t.func,onExiting:$t.func,onExited:$t.func};function cSr(){this.__data__=[],this.size=0}var dSr=cSr,uSr=l9;function hSr(t,e){for(var n=t.length;n--;)if(uSr(t[n][0],e))return n;return-1}var Use=hSr,mSr=Use,fSr=Array.prototype,pSr=fSr.splice;function gSr(t){var e=this.__data__,n=mSr(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():pSr.call(e,n,1),--this.size,!0}var vSr=gSr,ySr=Use;function bSr(t){var e=this.__data__,n=ySr(e,t);return n<0?void 0:e[n][1]}var xSr=bSr,wSr=Use;function kSr(t){return wSr(this.__data__,t)>-1}var SSr=kSr,CSr=Use;function jSr(t,e){var n=this.__data__,r=CSr(n,t);return r<0?(++this.size,n.push([t,e])):n[r][1]=e,this}var ESr=jSr,NSr=dSr,TSr=vSr,_Sr=xSr,ASr=SSr,PSr=ESr;function FM(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}FM.prototype.clear=NSr;FM.prototype.delete=TSr;FM.prototype.get=_Sr;FM.prototype.has=ASr;FM.prototype.set=PSr;var zse=FM,RSr=zse;function ISr(){this.__data__=new RSr,this.size=0}var MSr=ISr;function LSr(t){var e=this.__data__,n=e.delete(t);return this.size=e.size,n}var DSr=LSr;function $Sr(t){return this.__data__.get(t)}var OSr=$Sr;function FSr(t){return this.__data__.has(t)}var BSr=FSr,USr=Zg,zSr=USr["__core-js_shared__"],VSr=zSr,cue=VSr,wGe=function(){var t=/[^.]+$/.exec(cue&&cue.keys&&cue.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}();function HSr(t){return!!wGe&&wGe in t}var GSr=HSr,WSr=Function.prototype,qSr=WSr.toString;function KSr(t){if(t!=null){try{return qSr.call(t)}catch{}try{return t+""}catch{}}return""}var SPt=KSr,YSr=Fse,QSr=GSr,ZSr=ip,JSr=SPt,XSr=/[\\^$.*+?()[\]{}|]/g,eCr=/^\[object .+?Constructor\]$/,tCr=Function.prototype,nCr=Object.prototype,rCr=tCr.toString,sCr=nCr.hasOwnProperty,iCr=RegExp("^"+rCr.call(sCr).replace(XSr,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");function aCr(t){if(!ZSr(t)||QSr(t))return!1;var e=YSr(t)?iCr:eCr;return e.test(JSr(t))}var oCr=aCr;function lCr(t,e){return t==null?void 0:t[e]}var cCr=lCr,dCr=oCr,uCr=cCr;function hCr(t,e){var n=uCr(t,e);return dCr(n)?n:void 0}var TN=hCr,mCr=TN,fCr=Zg,pCr=mCr(fCr,"Map"),GPe=pCr,gCr=TN,vCr=gCr(Object,"create"),Vse=vCr,kGe=Vse;function yCr(){this.__data__=kGe?kGe(null):{},this.size=0}var bCr=yCr;function xCr(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}var wCr=xCr,kCr=Vse,SCr="__lodash_hash_undefined__",CCr=Object.prototype,jCr=CCr.hasOwnProperty;function ECr(t){var e=this.__data__;if(kCr){var n=e[t];return n===SCr?void 0:n}return jCr.call(e,t)?e[t]:void 0}var NCr=ECr,TCr=Vse,_Cr=Object.prototype,ACr=_Cr.hasOwnProperty;function PCr(t){var e=this.__data__;return TCr?e[t]!==void 0:ACr.call(e,t)}var RCr=PCr,ICr=Vse,MCr="__lodash_hash_undefined__";function LCr(t,e){var n=this.__data__;return this.size+=this.has(t)?0:1,n[t]=ICr&&e===void 0?MCr:e,this}var DCr=LCr,$Cr=bCr,OCr=wCr,FCr=NCr,BCr=RCr,UCr=DCr;function BM(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}BM.prototype.clear=$Cr;BM.prototype.delete=OCr;BM.prototype.get=FCr;BM.prototype.has=BCr;BM.prototype.set=UCr;var zCr=BM,SGe=zCr,VCr=zse,HCr=GPe;function GCr(){this.size=0,this.__data__={hash:new SGe,map:new(HCr||VCr),string:new SGe}}var WCr=GCr;function qCr(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}var KCr=qCr,YCr=KCr;function QCr(t,e){var n=t.__data__;return YCr(e)?n[typeof e=="string"?"string":"hash"]:n.map}var Hse=QCr,ZCr=Hse;function JCr(t){var e=ZCr(this,t).delete(t);return this.size-=e?1:0,e}var XCr=JCr,ejr=Hse;function tjr(t){return ejr(this,t).get(t)}var njr=tjr,rjr=Hse;function sjr(t){return rjr(this,t).has(t)}var ijr=sjr,ajr=Hse;function ojr(t,e){var n=ajr(this,t),r=n.size;return n.set(t,e),this.size+=n.size==r?0:1,this}var ljr=ojr,cjr=WCr,djr=XCr,ujr=njr,hjr=ijr,mjr=ljr;function UM(t){var e=-1,n=t==null?0:t.length;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}UM.prototype.clear=cjr;UM.prototype.delete=djr;UM.prototype.get=ujr;UM.prototype.has=hjr;UM.prototype.set=mjr;var WPe=UM,fjr=zse,pjr=GPe,gjr=WPe,vjr=200;function yjr(t,e){var n=this.__data__;if(n instanceof fjr){var r=n.__data__;if(!pjr||r.length<vjr-1)return r.push([t,e]),this.size=++n.size,this;n=this.__data__=new gjr(r)}return n.set(t,e),this.size=n.size,this}var bjr=yjr,xjr=zse,wjr=MSr,kjr=DSr,Sjr=OSr,Cjr=BSr,jjr=bjr;function zM(t){var e=this.__data__=new xjr(t);this.size=e.size}zM.prototype.clear=wjr;zM.prototype.delete=kjr;zM.prototype.get=Sjr;zM.prototype.has=Cjr;zM.prototype.set=jjr;var qPe=zM,Ejr="__lodash_hash_undefined__";function Njr(t){return this.__data__.set(t,Ejr),this}var Tjr=Njr;function _jr(t){return this.__data__.has(t)}var Ajr=_jr,Pjr=WPe,Rjr=Tjr,Ijr=Ajr;function lJ(t){var e=-1,n=t==null?0:t.length;for(this.__data__=new Pjr;++e<n;)this.add(t[e])}lJ.prototype.add=lJ.prototype.push=Rjr;lJ.prototype.has=Ijr;var CPt=lJ;function Mjr(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(e(t[n],n,t))return!0;return!1}var jPt=Mjr;function Ljr(t,e){return t.has(e)}var EPt=Ljr,Djr=CPt,$jr=jPt,Ojr=EPt,Fjr=1,Bjr=2;function Ujr(t,e,n,r,s,i){var o=n&Fjr,l=t.length,c=e.length;if(l!=c&&!(o&&c>l))return!1;var d=i.get(t),u=i.get(e);if(d&&u)return d==e&&u==t;var h=-1,m=!0,f=n&Bjr?new Djr:void 0;for(i.set(t,e),i.set(e,t);++h<l;){var p=t[h],g=e[h];if(r)var v=o?r(g,p,h,e,t,i):r(p,g,h,t,e,i);if(v!==void 0){if(v)continue;m=!1;break}if(f){if(!$jr(e,function(b,x){if(!Ojr(f,x)&&(p===b||s(p,b,n,r,i)))return f.push(x)})){m=!1;break}}else if(!(p===g||s(p,g,n,r,i))){m=!1;break}}return i.delete(t),i.delete(e),m}var NPt=Ujr,zjr=Zg,Vjr=zjr.Uint8Array,TPt=Vjr;function Hjr(t){var e=-1,n=Array(t.size);return t.forEach(function(r,s){n[++e]=[s,r]}),n}var Gjr=Hjr;function Wjr(t){var e=-1,n=Array(t.size);return t.forEach(function(r){n[++e]=r}),n}var KPe=Wjr,CGe=MM,jGe=TPt,qjr=l9,Kjr=NPt,Yjr=Gjr,Qjr=KPe,Zjr=1,Jjr=2,Xjr="[object Boolean]",e2r="[object Date]",t2r="[object Error]",n2r="[object Map]",r2r="[object Number]",s2r="[object RegExp]",i2r="[object Set]",a2r="[object String]",o2r="[object Symbol]",l2r="[object ArrayBuffer]",c2r="[object DataView]",EGe=CGe?CGe.prototype:void 0,due=EGe?EGe.valueOf:void 0;function d2r(t,e,n,r,s,i,o){switch(n){case c2r:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case l2r:return!(t.byteLength!=e.byteLength||!i(new jGe(t),new jGe(e)));case Xjr:case e2r:case r2r:return qjr(+t,+e);case t2r:return t.name==e.name&&t.message==e.message;case s2r:case a2r:return t==e+"";case n2r:var l=Yjr;case i2r:var c=r&Zjr;if(l||(l=Qjr),t.size!=e.size&&!c)return!1;var d=o.get(t);if(d)return d==e;r|=Jjr,o.set(t,e);var u=Kjr(l(t),l(e),r,s,i,o);return o.delete(t),u;case o2r:if(due)return due.call(t)==due.call(e)}return!1}var u2r=d2r;function h2r(t,e){for(var n=-1,r=e.length,s=t.length;++n<r;)t[s+n]=e[n];return t}var YPe=h2r,m2r=Array.isArray,au=m2r,f2r=YPe,p2r=au;function g2r(t,e,n){var r=e(t);return p2r(t)?r:f2r(r,n(t))}var _Pt=g2r;function v2r(t,e){for(var n=-1,r=t==null?0:t.length,s=0,i=[];++n<r;){var o=t[n];e(o,n,t)&&(i[s++]=o)}return i}var y2r=v2r;function b2r(){return[]}var APt=b2r,x2r=y2r,w2r=APt,k2r=Object.prototype,S2r=k2r.propertyIsEnumerable,NGe=Object.getOwnPropertySymbols,C2r=NGe?function(t){return t==null?[]:(t=Object(t),x2r(NGe(t),function(e){return S2r.call(t,e)}))}:w2r,QPe=C2r;function j2r(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}var E2r=j2r,N2r=F0,T2r=Jg,_2r="[object Arguments]";function A2r(t){return T2r(t)&&N2r(t)==_2r}var P2r=A2r,TGe=P2r,R2r=Jg,PPt=Object.prototype,I2r=PPt.hasOwnProperty,M2r=PPt.propertyIsEnumerable,L2r=TGe(function(){return arguments}())?TGe:function(t){return R2r(t)&&I2r.call(t,"callee")&&!M2r.call(t,"callee")},ZPe=L2r,cJ={exports:{}};function D2r(){return!1}var $2r=D2r;cJ.exports;(function(t,e){var n=Zg,r=$2r,s=e&&!e.nodeType&&e,i=s&&!0&&t&&!t.nodeType&&t,o=i&&i.exports===s,l=o?n.Buffer:void 0,c=l?l.isBuffer:void 0,d=c||r;t.exports=d})(cJ,cJ.exports);var Gse=cJ.exports,O2r=F0,F2r=PPe,B2r=Jg,U2r="[object Arguments]",z2r="[object Array]",V2r="[object Boolean]",H2r="[object Date]",G2r="[object Error]",W2r="[object Function]",q2r="[object Map]",K2r="[object Number]",Y2r="[object Object]",Q2r="[object RegExp]",Z2r="[object Set]",J2r="[object String]",X2r="[object WeakMap]",eEr="[object ArrayBuffer]",tEr="[object DataView]",nEr="[object Float32Array]",rEr="[object Float64Array]",sEr="[object Int8Array]",iEr="[object Int16Array]",aEr="[object Int32Array]",oEr="[object Uint8Array]",lEr="[object Uint8ClampedArray]",cEr="[object Uint16Array]",dEr="[object Uint32Array]",Qa={};Qa[nEr]=Qa[rEr]=Qa[sEr]=Qa[iEr]=Qa[aEr]=Qa[oEr]=Qa[lEr]=Qa[cEr]=Qa[dEr]=!0;Qa[U2r]=Qa[z2r]=Qa[eEr]=Qa[V2r]=Qa[tEr]=Qa[H2r]=Qa[G2r]=Qa[W2r]=Qa[q2r]=Qa[K2r]=Qa[Y2r]=Qa[Q2r]=Qa[Z2r]=Qa[J2r]=Qa[X2r]=!1;function uEr(t){return B2r(t)&&F2r(t.length)&&!!Qa[O2r(t)]}var hEr=uEr;function mEr(t){return function(e){return t(e)}}var Wse=mEr,dJ={exports:{}};dJ.exports;(function(t,e){var n=sPt,r=e&&!e.nodeType&&e,s=r&&!0&&t&&!t.nodeType&&t,i=s&&s.exports===r,o=i&&n.process,l=function(){try{var c=s&&s.require&&s.require("util").types;return c||o&&o.binding&&o.binding("util")}catch{}}();t.exports=l})(dJ,dJ.exports);var JPe=dJ.exports,fEr=hEr,pEr=Wse,_Ge=JPe,AGe=_Ge&&_Ge.isTypedArray,gEr=AGe?pEr(AGe):fEr,XPe=gEr,vEr=E2r,yEr=ZPe,bEr=au,xEr=Gse,wEr=RPe,kEr=XPe,SEr=Object.prototype,CEr=SEr.hasOwnProperty;function jEr(t,e){var n=bEr(t),r=!n&&yEr(t),s=!n&&!r&&xEr(t),i=!n&&!r&&!s&&kEr(t),o=n||r||s||i,l=o?vEr(t.length,String):[],c=l.length;for(var d in t)(e||CEr.call(t,d))&&!(o&&(d=="length"||s&&(d=="offset"||d=="parent")||i&&(d=="buffer"||d=="byteLength"||d=="byteOffset")||wEr(d,c)))&&l.push(d);return l}var RPt=jEr,EEr=Object.prototype;function NEr(t){var e=t&&t.constructor,n=typeof e=="function"&&e.prototype||EEr;return t===n}var eRe=NEr;function TEr(t,e){return function(n){return t(e(n))}}var IPt=TEr,_Er=IPt,AEr=_Er(Object.keys,Object),PEr=AEr,REr=eRe,IEr=PEr,MEr=Object.prototype,LEr=MEr.hasOwnProperty;function DEr(t){if(!REr(t))return IEr(t);var e=[];for(var n in Object(t))LEr.call(t,n)&&n!="constructor"&&e.push(n);return e}var $Er=DEr,OEr=RPt,FEr=$Er,BEr=DM;function UEr(t){return BEr(t)?OEr(t):FEr(t)}var VM=UEr,zEr=_Pt,VEr=QPe,HEr=VM;function GEr(t){return zEr(t,HEr,VEr)}var MPt=GEr,PGe=MPt,WEr=1,qEr=Object.prototype,KEr=qEr.hasOwnProperty;function YEr(t,e,n,r,s,i){var o=n&WEr,l=PGe(t),c=l.length,d=PGe(e),u=d.length;if(c!=u&&!o)return!1;for(var h=c;h--;){var m=l[h];if(!(o?m in e:KEr.call(e,m)))return!1}var f=i.get(t),p=i.get(e);if(f&&p)return f==e&&p==t;var g=!0;i.set(t,e),i.set(e,t);for(var v=o;++h<c;){m=l[h];var b=t[m],x=e[m];if(r)var w=o?r(x,b,m,e,t,i):r(b,x,m,t,e,i);if(!(w===void 0?b===x||s(b,x,n,r,i):w)){g=!1;break}v||(v=m=="constructor")}if(g&&!v){var k=t.constructor,S=e.constructor;k!=S&&"constructor"in t&&"constructor"in e&&!(typeof k=="function"&&k instanceof k&&typeof S=="function"&&S instanceof S)&&(g=!1)}return i.delete(t),i.delete(e),g}var QEr=YEr,ZEr=TN,JEr=Zg,XEr=ZEr(JEr,"DataView"),eNr=XEr,tNr=TN,nNr=Zg,rNr=tNr(nNr,"Promise"),sNr=rNr,iNr=TN,aNr=Zg,oNr=iNr(aNr,"Set"),LPt=oNr,lNr=TN,cNr=Zg,dNr=lNr(cNr,"WeakMap"),uNr=dNr,H0e=eNr,G0e=GPe,W0e=sNr,q0e=LPt,K0e=uNr,DPt=F0,HM=SPt,RGe="[object Map]",hNr="[object Object]",IGe="[object Promise]",MGe="[object Set]",LGe="[object WeakMap]",DGe="[object DataView]",mNr=HM(H0e),fNr=HM(G0e),pNr=HM(W0e),gNr=HM(q0e),vNr=HM(K0e),VC=DPt;(H0e&&VC(new H0e(new ArrayBuffer(1)))!=DGe||G0e&&VC(new G0e)!=RGe||W0e&&VC(W0e.resolve())!=IGe||q0e&&VC(new q0e)!=MGe||K0e&&VC(new K0e)!=LGe)&&(VC=function(t){var e=DPt(t),n=e==hNr?t.constructor:void 0,r=n?HM(n):"";if(r)switch(r){case mNr:return DGe;case fNr:return RGe;case pNr:return IGe;case gNr:return MGe;case vNr:return LGe}return e});var qse=VC,uue=qPe,yNr=NPt,bNr=u2r,xNr=QEr,$Ge=qse,OGe=au,FGe=Gse,wNr=XPe,kNr=1,BGe="[object Arguments]",UGe="[object Array]",GV="[object Object]",SNr=Object.prototype,zGe=SNr.hasOwnProperty;function CNr(t,e,n,r,s,i){var o=OGe(t),l=OGe(e),c=o?UGe:$Ge(t),d=l?UGe:$Ge(e);c=c==BGe?GV:c,d=d==BGe?GV:d;var u=c==GV,h=d==GV,m=c==d;if(m&&FGe(t)){if(!FGe(e))return!1;o=!0,u=!1}if(m&&!u)return i||(i=new uue),o||wNr(t)?yNr(t,e,n,r,s,i):bNr(t,e,c,n,r,s,i);if(!(n&kNr)){var f=u&&zGe.call(t,"__wrapped__"),p=h&&zGe.call(e,"__wrapped__");if(f||p){var g=f?t.value():t,v=p?e.value():e;return i||(i=new uue),s(g,v,n,r,i)}}return m?(i||(i=new uue),xNr(t,e,n,r,s,i)):!1}var jNr=CNr,ENr=jNr,VGe=Jg;function $Pt(t,e,n,r,s){return t===e?!0:t==null||e==null||!VGe(t)&&!VGe(e)?t!==t&&e!==e:ENr(t,e,n,r,$Pt,s)}var tRe=$Pt,NNr=tRe;function TNr(t,e){return NNr(t,e)}var _Nr=TNr;const m0=Fs(_Nr);function hue(t,e){const n=MPe(t);return n?n.innerHeight:n2(t).height}const ANr=Function.prototype.bind.call(Function.prototype.call,[].slice);function PNr(t,e){return ANr(t.querySelectorAll(e))}let mue;function RNr(t,e){if(!mue){const n=document.body,r=n.matches||n.matchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector||n.msMatchesSelector;mue=(s,i)=>r.call(s,i)}return mue(t,e)}function OPt(t,e,n){t.closest&&!n&&t.closest(e);let r=t;do{if(RNr(r,e))return r;r=r.parentElement}while(r&&r!==n&&r.nodeType===document.ELEMENT_NODE);return null}let Y0e=!1,Q0e=!1;try{const t={get passive(){return Y0e=!0},get once(){return Q0e=Y0e=!0}};LPe&&(window.addEventListener("test",t,t),window.removeEventListener("test",t,!0))}catch{}function INr(t,e,n,r){if(r&&typeof r!="boolean"&&!Q0e){const{once:s,capture:i}=r;let o=n;!Q0e&&s&&(o=n.__once||function l(c){this.removeEventListener(e,l,i),n.call(this,c)},n.__once=o),t.addEventListener(e,o,Y0e?r:i)}t.addEventListener(e,n,r)}function MNr(t,e,n,r){const s=r&&typeof r!="boolean"?r.capture:r;t.removeEventListener(e,n,s),n.__once&&t.removeEventListener(e,n.__once,s)}function LNr(t,e,n,r){return INr(t,e,n,r),()=>{MNr(t,e,n,r)}}function DNr(t,e,n,r){for(var s=t.length,i=n+(r?1:-1);r?i--:++i<s;)if(e(t[i],i,t))return i;return-1}var FPt=DNr,$Nr=qPe,ONr=tRe,FNr=1,BNr=2;function UNr(t,e,n,r){var s=n.length,i=s,o=!r;if(t==null)return!i;for(t=Object(t);s--;){var l=n[s];if(o&&l[2]?l[1]!==t[l[0]]:!(l[0]in t))return!1}for(;++s<i;){l=n[s];var c=l[0],d=t[c],u=l[1];if(o&&l[2]){if(d===void 0&&!(c in t))return!1}else{var h=new $Nr;if(r)var m=r(d,u,c,t,e,h);if(!(m===void 0?ONr(u,d,FNr|BNr,r,h):m))return!1}}return!0}var zNr=UNr,VNr=ip;function HNr(t){return t===t&&!VNr(t)}var BPt=HNr,GNr=BPt,WNr=VM;function qNr(t){for(var e=WNr(t),n=e.length;n--;){var r=e[n],s=t[r];e[n]=[r,s,GNr(s)]}return e}var KNr=qNr;function YNr(t,e){return function(n){return n==null?!1:n[t]===e&&(e!==void 0||t in Object(n))}}var UPt=YNr,QNr=zNr,ZNr=KNr,JNr=UPt;function XNr(t){var e=ZNr(t);return e.length==1&&e[0][2]?JNr(e[0][0],e[0][1]):function(n){return n===t||QNr(n,t,e)}}var eTr=XNr,tTr=au,nTr=OM,rTr=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,sTr=/^\w*$/;function iTr(t,e){if(tTr(t))return!1;var n=typeof t;return n=="number"||n=="symbol"||n=="boolean"||t==null||nTr(t)?!0:sTr.test(t)||!rTr.test(t)||e!=null&&t in Object(e)}var nRe=iTr,zPt=WPe,aTr="Expected a function";function rRe(t,e){if(typeof t!="function"||e!=null&&typeof e!="function")throw new TypeError(aTr);var n=function(){var r=arguments,s=e?e.apply(this,r):r[0],i=n.cache;if(i.has(s))return i.get(s);var o=t.apply(this,r);return n.cache=i.set(s,o)||i,o};return n.cache=new(rRe.Cache||zPt),n}rRe.Cache=zPt;var VPt=rRe;const oTr=Fs(VPt);var lTr=VPt,cTr=500;function dTr(t){var e=lTr(t,function(r){return n.size===cTr&&n.clear(),r}),n=e.cache;return e}var uTr=dTr,hTr=uTr,mTr=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,fTr=/\\(\\)?/g,pTr=hTr(function(t){var e=[];return t.charCodeAt(0)===46&&e.push(""),t.replace(mTr,function(n,r,s,i){e.push(s?i.replace(fTr,"$1"):r||n)}),e}),gTr=pTr;function vTr(t,e){for(var n=-1,r=t==null?0:t.length,s=Array(r);++n<r;)s[n]=e(t[n],n,t);return s}var Kse=vTr,HGe=MM,yTr=Kse,bTr=au,xTr=OM,wTr=1/0,GGe=HGe?HGe.prototype:void 0,WGe=GGe?GGe.toString:void 0;function HPt(t){if(typeof t=="string")return t;if(bTr(t))return yTr(t,HPt)+"";if(xTr(t))return WGe?WGe.call(t):"";var e=t+"";return e=="0"&&1/t==-wTr?"-0":e}var kTr=HPt,STr=kTr;function CTr(t){return t==null?"":STr(t)}var GPt=CTr,jTr=au,ETr=nRe,NTr=gTr,TTr=GPt;function _Tr(t,e){return jTr(t)?t:ETr(t,e)?[t]:NTr(TTr(t))}var Yse=_Tr,ATr=OM,PTr=1/0;function RTr(t){if(typeof t=="string"||ATr(t))return t;var e=t+"";return e=="0"&&1/t==-PTr?"-0":e}var u9=RTr,ITr=Yse,MTr=u9;function LTr(t,e){e=ITr(e,t);for(var n=0,r=e.length;t!=null&&n<r;)t=t[MTr(e[n++])];return n&&n==r?t:void 0}var Qse=LTr,DTr=Qse;function $Tr(t,e,n){var r=t==null?void 0:DTr(t,e);return r===void 0?n:r}var WPt=$Tr;const Cm=Fs(WPt);function OTr(t,e){return t!=null&&e in Object(t)}var FTr=OTr,BTr=Yse,UTr=ZPe,zTr=au,VTr=RPe,HTr=PPe,GTr=u9;function WTr(t,e,n){e=BTr(e,t);for(var r=-1,s=e.length,i=!1;++r<s;){var o=GTr(e[r]);if(!(i=t!=null&&n(t,o)))break;t=t[o]}return i||++r!=s?i:(s=t==null?0:t.length,!!s&&HTr(s)&&VTr(o,s)&&(zTr(t)||UTr(t)))}var qTr=WTr,KTr=FTr,YTr=qTr;function QTr(t,e){return t!=null&&YTr(t,e,KTr)}var ZTr=QTr,JTr=tRe,XTr=WPt,e_r=ZTr,t_r=nRe,n_r=BPt,r_r=UPt,s_r=u9,i_r=1,a_r=2;function o_r(t,e){return t_r(t)&&n_r(e)?r_r(s_r(t),e):function(n){var r=XTr(n,t);return r===void 0&&r===e?e_r(n,t):JTr(e,r,i_r|a_r)}}var l_r=o_r;function c_r(t){return t}var GM=c_r;function d_r(t){return function(e){return e==null?void 0:e[t]}}var u_r=d_r,h_r=Qse;function m_r(t){return function(e){return h_r(e,t)}}var f_r=m_r,p_r=u_r,g_r=f_r,v_r=nRe,y_r=u9;function b_r(t){return v_r(t)?p_r(y_r(t)):g_r(t)}var x_r=b_r,w_r=eTr,k_r=l_r,S_r=GM,C_r=au,j_r=x_r;function E_r(t){return typeof t=="function"?t:t==null?S_r:typeof t=="object"?C_r(t)?k_r(t[0],t[1]):w_r(t):j_r(t)}var Xg=E_r,N_r=FPt,T_r=Xg,__r=lPt,A_r=Math.max;function P_r(t,e,n){var r=t==null?0:t.length;if(!r)return-1;var s=n==null?0:__r(n);return s<0&&(s=A_r(r+s,0)),N_r(t,T_r(e),s)}var qPt=P_r;const R_r=Fs(qPt);var I_r=Math.ceil,M_r=Math.max;function L_r(t,e,n,r){for(var s=-1,i=M_r(I_r((e-t)/(n||1)),0),o=Array(i);i--;)o[r?i:++s]=t,t+=n;return o}var D_r=L_r,$_r=D_r,O_r=$M,fue=oPt;function F_r(t){return function(e,n,r){return r&&typeof r!="number"&&O_r(e,n,r)&&(n=r=void 0),e=fue(e),n===void 0?(n=e,e=0):n=fue(n),r=r===void 0?e<n?1:-1:fue(r),$_r(e,n,r,t)}}var B_r=F_r,U_r=B_r,z_r=U_r(),V_r=z_r;const wF=Fs(V_r);var qGe=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function H_r(t,e){return!!(t===e||qGe(t)&&qGe(e))}function G_r(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!H_r(t[n],e[n]))return!1;return!0}function KPt(t,e){e===void 0&&(e=G_r);var n=null;function r(){for(var s=[],i=0;i<arguments.length;i++)s[i]=arguments[i];if(n&&n.lastThis===this&&e(s,n.lastArgs))return n.lastResult;var o=t.apply(this,s);return n={lastResult:o,lastArgs:s,lastThis:this},o}return r.clear=function(){n=null},r}function Z0e(t,e){const n=MPe(t);return n?n.innerWidth:n2(t).width}var KGe=MM,W_r=ZPe,q_r=au,YGe=KGe?KGe.isConcatSpreadable:void 0;function K_r(t){return q_r(t)||W_r(t)||!!(YGe&&t&&t[YGe])}var Y_r=K_r,Q_r=YPe,Z_r=Y_r;function YPt(t,e,n,r,s){var i=-1,o=t.length;for(n||(n=Z_r),s||(s=[]);++i<o;){var l=t[i];e>0&&n(l)?e>1?YPt(l,e-1,n,r,s):Q_r(s,l):r||(s[s.length]=l)}return s}var sRe=YPt;function J_r(t){return function(e,n,r){for(var s=-1,i=Object(e),o=r(e),l=o.length;l--;){var c=o[t?l:++s];if(n(i[c],c,i)===!1)break}return e}}var X_r=J_r,eAr=X_r,tAr=eAr(),nAr=tAr,rAr=nAr,sAr=VM;function iAr(t,e){return t&&rAr(t,e,sAr)}var iRe=iAr,aAr=DM;function oAr(t,e){return function(n,r){if(n==null)return n;if(!aAr(n))return t(n,r);for(var s=n.length,i=e?s:-1,o=Object(n);(e?i--:++i<s)&&r(o[i],i,o)!==!1;);return n}}var lAr=oAr,cAr=iRe,dAr=lAr,uAr=dAr(cAr),aRe=uAr,hAr=aRe,mAr=DM;function fAr(t,e){var n=-1,r=mAr(t)?Array(t.length):[];return hAr(t,function(s,i,o){r[++n]=e(s,i,o)}),r}var QPt=fAr;function pAr(t,e){var n=t.length;for(t.sort(e);n--;)t[n]=t[n].value;return t}var gAr=pAr,QGe=OM;function vAr(t,e){if(t!==e){var n=t!==void 0,r=t===null,s=t===t,i=QGe(t),o=e!==void 0,l=e===null,c=e===e,d=QGe(e);if(!l&&!d&&!i&&t>e||i&&o&&c&&!l&&!d||r&&o&&c||!n&&c||!s)return 1;if(!r&&!i&&!d&&t<e||d&&n&&s&&!r&&!i||l&&n&&s||!o&&s||!c)return-1}return 0}var yAr=vAr,bAr=yAr;function xAr(t,e,n){for(var r=-1,s=t.criteria,i=e.criteria,o=s.length,l=n.length;++r<o;){var c=bAr(s[r],i[r]);if(c){if(r>=l)return c;var d=n[r];return c*(d=="desc"?-1:1)}}return t.index-e.index}var wAr=xAr,pue=Kse,kAr=Qse,SAr=Xg,CAr=QPt,jAr=gAr,EAr=Wse,NAr=wAr,TAr=GM,_Ar=au;function AAr(t,e,n){e.length?e=pue(e,function(i){return _Ar(i)?function(o){return kAr(o,i.length===1?i[0]:i)}:i}):e=[TAr];var r=-1;e=pue(e,EAr(SAr));var s=CAr(t,function(i,o,l){var c=pue(e,function(d){return d(i)});return{criteria:c,index:++r,value:i}});return jAr(s,function(i,o){return NAr(i,o,n)})}var PAr=AAr;function RAr(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}var IAr=RAr,MAr=IAr,ZGe=Math.max;function LAr(t,e,n){return e=ZGe(e===void 0?t.length-1:e,0),function(){for(var r=arguments,s=-1,i=ZGe(r.length-e,0),o=Array(i);++s<i;)o[s]=r[e+s];s=-1;for(var l=Array(e+1);++s<e;)l[s]=r[s];return l[e]=n(o),MAr(t,this,l)}}var ZPt=LAr;function DAr(t){return function(){return t}}var $Ar=DAr,OAr=TN,FAr=function(){try{var t=OAr(Object,"defineProperty");return t({},"",{}),t}catch{}}(),JPt=FAr,BAr=$Ar,JGe=JPt,UAr=GM,zAr=JGe?function(t,e){return JGe(t,"toString",{configurable:!0,enumerable:!1,value:BAr(e),writable:!0})}:UAr,VAr=zAr,HAr=800,GAr=16,WAr=Date.now;function qAr(t){var e=0,n=0;return function(){var r=WAr(),s=GAr-(r-n);if(n=r,s>0){if(++e>=HAr)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}var KAr=qAr,YAr=VAr,QAr=KAr,ZAr=QAr(YAr),XPt=ZAr,JAr=GM,XAr=ZPt,ePr=XPt;function tPr(t,e){return ePr(XAr(t,e,JAr),t+"")}var eRt=tPr,nPr=sRe,rPr=PAr,sPr=eRt,XGe=$M,iPr=sPr(function(t,e){if(t==null)return[];var n=e.length;return n>1&&XGe(t,e[0],e[1])?e=[]:n>2&&XGe(e[0],e[1],e[2])&&(e=[e[0]]),rPr(t,nPr(e,1),[])}),aPr=iPr;const Zse=Fs(aPr);let WV;function oRe(t){if((!WV&&WV!==0||t)&&LPe){const e=document.createElement("div");e.style.position="absolute",e.style.top="-9999px",e.style.width="50px",e.style.height="50px",e.style.overflow="scroll",document.body.appendChild(e),WV=e.offsetWidth-e.clientWidth,document.body.removeChild(e)}return WV}function tRt(t){return UAt(t)||rPt(t)||NPe(t)||zAt()}function oPr(t,e){return t.classList?t.classList.contains(e):` ${t.className.baseVal||t.className} `.indexOf(` ${e} `)!==-1}function lPr(t,e){t.classList?t.classList.add(e):oPr(t,e)||(typeof t.className=="string"?t.className=`${t.className} ${e}`:t.setAttribute("class",`${t.className&&t.className.baseVal||""} ${e}`))}function eWe(t,e){return t.replace(new RegExp(`(^|\\s)${e}(?:\\s|$)`,"g"),"$1").replace(/\s+/g," ").replace(/^\s*|\s*$/g,"")}function cPr(t,e){t.classList?t.classList.remove(e):typeof t.className=="string"?t.className=eWe(t.className,e):t.setAttribute("class",eWe(t.className&&t.className.baseVal||"",e))}function dPr(t){var e=[];if(t!=null)for(var n in Object(t))e.push(n);return e}var uPr=dPr,hPr=ip,mPr=eRe,fPr=uPr,pPr=Object.prototype,gPr=pPr.hasOwnProperty;function vPr(t){if(!hPr(t))return fPr(t);var e=mPr(t),n=[];for(var r in t)r=="constructor"&&(e||!gPr.call(t,r))||n.push(r);return n}var yPr=vPr,bPr=RPt,xPr=yPr,wPr=DM;function kPr(t){return wPr(t)?bPr(t,!0):xPr(t)}var Jse=kPr,SPr=eRt,CPr=l9,jPr=$M,EPr=Jse,nRt=Object.prototype,NPr=nRt.hasOwnProperty,TPr=SPr(function(t,e){t=Object(t);var n=-1,r=e.length,s=r>2?e[2]:void 0;for(s&&jPr(e[0],e[1],s)&&(r=1);++n<r;)for(var i=e[n],o=EPr(i),l=-1,c=o.length;++l<c;){var d=o[l],u=t[d];(u===void 0||CPr(u,nRt[d])&&!NPr.call(t,d))&&(t[d]=i[d])}return t}),_Pr=TPr;const APr=Fs(_Pr);var tWe=JPt;function PPr(t,e,n){e=="__proto__"&&tWe?tWe(t,e,{configurable:!0,enumerable:!0,value:n,writable:!0}):t[e]=n}var lRe=PPr,RPr=lRe,IPr=iRe,MPr=Xg;function LPr(t,e){var n={};return e=MPr(e),IPr(t,function(r,s,i){RPr(n,s,e(r,s,i))}),n}var DPr=LPr;const rRt=Fs(DPr);function $Pr(t,e){for(var n=-1,r=t==null?0:t.length;++n<r&&e(t[n],n,t)!==!1;);return t}var sRt=$Pr,OPr=lRe,FPr=l9,BPr=Object.prototype,UPr=BPr.hasOwnProperty;function zPr(t,e,n){var r=t[e];(!(UPr.call(t,e)&&FPr(r,n))||n===void 0&&!(e in t))&&OPr(t,e,n)}var iRt=zPr,VPr=iRt,HPr=lRe;function GPr(t,e,n,r){var s=!n;n||(n={});for(var i=-1,o=e.length;++i<o;){var l=e[i],c=r?r(n[l],t[l],l,n,t):void 0;c===void 0&&(c=t[l]),s?HPr(n,l,c):VPr(n,l,c)}return n}var h9=GPr,WPr=h9,qPr=VM;function KPr(t,e){return t&&WPr(e,qPr(e),t)}var YPr=KPr,QPr=h9,ZPr=Jse;function JPr(t,e){return t&&QPr(e,ZPr(e),t)}var XPr=JPr,uJ={exports:{}};uJ.exports;(function(t,e){var n=Zg,r=e&&!e.nodeType&&e,s=r&&!0&&t&&!t.nodeType&&t,i=s&&s.exports===r,o=i?n.Buffer:void 0,l=o?o.allocUnsafe:void 0;function c(d,u){if(u)return d.slice();var h=d.length,m=l?l(h):new d.constructor(h);return d.copy(m),m}t.exports=c})(uJ,uJ.exports);var eRr=uJ.exports;function tRr(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}var nRr=tRr,rRr=h9,sRr=QPe;function iRr(t,e){return rRr(t,sRr(t),e)}var aRr=iRr,oRr=IPt,lRr=oRr(Object.getPrototypeOf,Object),Xse=lRr,cRr=YPe,dRr=Xse,uRr=QPe,hRr=APt,mRr=Object.getOwnPropertySymbols,fRr=mRr?function(t){for(var e=[];t;)cRr(e,uRr(t)),t=dRr(t);return e}:hRr,aRt=fRr,pRr=h9,gRr=aRt;function vRr(t,e){return pRr(t,gRr(t),e)}var yRr=vRr,bRr=_Pt,xRr=aRt,wRr=Jse;function kRr(t){return bRr(t,wRr,xRr)}var oRt=kRr,SRr=Object.prototype,CRr=SRr.hasOwnProperty;function jRr(t){var e=t.length,n=new t.constructor(e);return e&&typeof t[0]=="string"&&CRr.call(t,"index")&&(n.index=t.index,n.input=t.input),n}var ERr=jRr,nWe=TPt;function NRr(t){var e=new t.constructor(t.byteLength);return new nWe(e).set(new nWe(t)),e}var cRe=NRr,TRr=cRe;function _Rr(t,e){var n=e?TRr(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}var ARr=_Rr,PRr=/\w*$/;function RRr(t){var e=new t.constructor(t.source,PRr.exec(t));return e.lastIndex=t.lastIndex,e}var IRr=RRr,rWe=MM,sWe=rWe?rWe.prototype:void 0,iWe=sWe?sWe.valueOf:void 0;function MRr(t){return iWe?Object(iWe.call(t)):{}}var LRr=MRr,DRr=cRe;function $Rr(t,e){var n=e?DRr(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}var ORr=$Rr,FRr=cRe,BRr=ARr,URr=IRr,zRr=LRr,VRr=ORr,HRr="[object Boolean]",GRr="[object Date]",WRr="[object Map]",qRr="[object Number]",KRr="[object RegExp]",YRr="[object Set]",QRr="[object String]",ZRr="[object Symbol]",JRr="[object ArrayBuffer]",XRr="[object DataView]",e5r="[object Float32Array]",t5r="[object Float64Array]",n5r="[object Int8Array]",r5r="[object Int16Array]",s5r="[object Int32Array]",i5r="[object Uint8Array]",a5r="[object Uint8ClampedArray]",o5r="[object Uint16Array]",l5r="[object Uint32Array]";function c5r(t,e,n){var r=t.constructor;switch(e){case JRr:return FRr(t);case HRr:case GRr:return new r(+t);case XRr:return BRr(t,n);case e5r:case t5r:case n5r:case r5r:case s5r:case i5r:case a5r:case o5r:case l5r:return VRr(t,n);case WRr:return new r;case qRr:case QRr:return new r(t);case KRr:return URr(t);case YRr:return new r;case ZRr:return zRr(t)}}var d5r=c5r,u5r=ip,aWe=Object.create,h5r=function(){function t(){}return function(e){if(!u5r(e))return{};if(aWe)return aWe(e);t.prototype=e;var n=new t;return t.prototype=void 0,n}}(),lRt=h5r,m5r=lRt,f5r=Xse,p5r=eRe;function g5r(t){return typeof t.constructor=="function"&&!p5r(t)?m5r(f5r(t)):{}}var v5r=g5r,y5r=qse,b5r=Jg,x5r="[object Map]";function w5r(t){return b5r(t)&&y5r(t)==x5r}var k5r=w5r,S5r=k5r,C5r=Wse,oWe=JPe,lWe=oWe&&oWe.isMap,j5r=lWe?C5r(lWe):S5r,E5r=j5r,N5r=qse,T5r=Jg,_5r="[object Set]";function A5r(t){return T5r(t)&&N5r(t)==_5r}var P5r=A5r,R5r=P5r,I5r=Wse,cWe=JPe,dWe=cWe&&cWe.isSet,M5r=dWe?I5r(dWe):R5r,L5r=M5r,D5r=qPe,$5r=sRt,O5r=iRt,F5r=YPr,B5r=XPr,U5r=eRr,z5r=nRr,V5r=aRr,H5r=yRr,G5r=MPt,W5r=oRt,q5r=qse,K5r=ERr,Y5r=d5r,Q5r=v5r,Z5r=au,J5r=Gse,X5r=E5r,eIr=ip,tIr=L5r,nIr=VM,rIr=Jse,sIr=1,iIr=2,aIr=4,cRt="[object Arguments]",oIr="[object Array]",lIr="[object Boolean]",cIr="[object Date]",dIr="[object Error]",dRt="[object Function]",uIr="[object GeneratorFunction]",hIr="[object Map]",mIr="[object Number]",uRt="[object Object]",fIr="[object RegExp]",pIr="[object Set]",gIr="[object String]",vIr="[object Symbol]",yIr="[object WeakMap]",bIr="[object ArrayBuffer]",xIr="[object DataView]",wIr="[object Float32Array]",kIr="[object Float64Array]",SIr="[object Int8Array]",CIr="[object Int16Array]",jIr="[object Int32Array]",EIr="[object Uint8Array]",NIr="[object Uint8ClampedArray]",TIr="[object Uint16Array]",_Ir="[object Uint32Array]",Pa={};Pa[cRt]=Pa[oIr]=Pa[bIr]=Pa[xIr]=Pa[lIr]=Pa[cIr]=Pa[wIr]=Pa[kIr]=Pa[SIr]=Pa[CIr]=Pa[jIr]=Pa[hIr]=Pa[mIr]=Pa[uRt]=Pa[fIr]=Pa[pIr]=Pa[gIr]=Pa[vIr]=Pa[EIr]=Pa[NIr]=Pa[TIr]=Pa[_Ir]=!0;Pa[dIr]=Pa[dRt]=Pa[yIr]=!1;function kq(t,e,n,r,s,i){var o,l=e&sIr,c=e&iIr,d=e&aIr;if(n&&(o=s?n(t,r,s,i):n(t)),o!==void 0)return o;if(!eIr(t))return t;var u=Z5r(t);if(u){if(o=K5r(t),!l)return z5r(t,o)}else{var h=q5r(t),m=h==dRt||h==uIr;if(J5r(t))return U5r(t,l);if(h==uRt||h==cRt||m&&!s){if(o=c||m?{}:Q5r(t),!l)return c?H5r(t,B5r(o,t)):V5r(t,F5r(o,t))}else{if(!Pa[h])return s?t:{};o=Y5r(t,h,l)}}i||(i=new D5r);var f=i.get(t);if(f)return f;i.set(t,o),tIr(t)?t.forEach(function(v){o.add(kq(v,e,n,v,t,i))}):X5r(t)&&t.forEach(function(v,b){o.set(b,kq(v,e,n,b,t,i))});var p=d?c?W5r:G5r:c?rIr:nIr,g=u?void 0:p(t);return $5r(g||t,function(v,b){g&&(b=v,v=t[b]),O5r(o,b,kq(v,e,n,b,t,i))}),o}var AIr=kq;function PIr(t){var e=t==null?0:t.length;return e?t[e-1]:void 0}var hRt=PIr;const RIr=Fs(hRt);var IIr=Qse,MIr=APe;function LIr(t,e){return e.length<2?t:IIr(t,MIr(e,0,-1))}var DIr=LIr,$Ir=Yse,OIr=hRt,FIr=DIr,uWe=u9,BIr=Object.prototype,UIr=BIr.hasOwnProperty;function zIr(t,e){e=$Ir(e,t);var n=-1,r=e.length;if(!r)return!0;for(;++n<r;){var s=uWe(e[n]);if(s==="__proto__"&&!UIr.call(t,"__proto__")||(s==="constructor"||s==="prototype")&&n<r-1)return!1}var i=FIr(t,e);return i==null||delete i[uWe(OIr(e))]}var VIr=zIr,HIr=F0,GIr=Xse,WIr=Jg,qIr="[object Object]",KIr=Function.prototype,YIr=Object.prototype,mRt=KIr.toString,QIr=YIr.hasOwnProperty,ZIr=mRt.call(Object);function JIr(t){if(!WIr(t)||HIr(t)!=qIr)return!1;var e=GIr(t);if(e===null)return!0;var n=QIr.call(e,"constructor")&&e.constructor;return typeof n=="function"&&n instanceof n&&mRt.call(n)==ZIr}var fRt=JIr;const XIr=Fs(fRt);var eMr=fRt;function tMr(t){return eMr(t)?void 0:t}var nMr=tMr,rMr=sRe;function sMr(t){var e=t==null?0:t.length;return e?rMr(t,1):[]}var iMr=sMr,aMr=iMr,oMr=ZPt,lMr=XPt;function cMr(t){return lMr(oMr(t,void 0,aMr),t+"")}var dMr=cMr,uMr=Kse,hMr=AIr,mMr=VIr,fMr=Yse,pMr=h9,gMr=nMr,vMr=dMr,yMr=oRt,bMr=1,xMr=2,wMr=4,kMr=vMr(function(t,e){var n={};if(t==null)return n;var r=!1;e=uMr(e,function(i){return i=fMr(i,t),r||(r=i.length>1),i}),pMr(t,yMr(t),n),r&&(n=hMr(n,bMr|xMr|wMr,gMr));for(var s=e.length;s--;)mMr(n,e[s]);return n}),SMr=kMr;const CMr=Fs(SMr);var jMr=sRt,EMr=lRt,NMr=iRe,TMr=Xg,_Mr=Xse,AMr=au,PMr=Gse,RMr=Fse,IMr=ip,MMr=XPe;function LMr(t,e,n){var r=AMr(t),s=r||PMr(t)||MMr(t);if(e=TMr(e),n==null){var i=t&&t.constructor;s?n=r?new i:[]:IMr(t)?n=RMr(i)?EMr(_Mr(t)):{}:n={}}return(s?jMr:NMr)(t,function(o,l,c){return e(n,o,l,c)}),n}var DMr=LMr;const $Mr=Fs(DMr);var OMr={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(xf,function(){return function(n,r,s){r.prototype.isBetween=function(i,o,l,c){var d=s(i),u=s(o),h=(c=c||"()")[0]==="(",m=c[1]===")";return(h?this.isAfter(d,l):!this.isBefore(d,l))&&(m?this.isBefore(u,l):!this.isAfter(u,l))||(h?this.isBefore(d,l):!this.isAfter(d,l))&&(m?this.isAfter(u,l):!this.isBefore(u,l))}}})})(OMr);var FMr={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(xf,function(){return function(n,r){r.prototype.isSameOrAfter=function(s,i){return this.isSame(s,i)||this.isAfter(s,i)}}})})(FMr);var BMr={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(xf,function(){return function(n,r){r.prototype.isSameOrBefore=function(s,i){return this.isSame(s,i)||this.isBefore(s,i)}}})})(BMr);var UMr={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(xf,function(){return function(n,r,s){var i=r.prototype,o=function(h){return h&&(h.indexOf?h:h.s)},l=function(h,m,f,p,g){var v=h.name?h:h.$locale(),b=o(v[m]),x=o(v[f]),w=b||x.map(function(S){return S.slice(0,p)});if(!g)return w;var k=v.weekStart;return w.map(function(S,C){return w[(C+(k||0))%7]})},c=function(){return s.Ls[s.locale()]},d=function(h,m){return h.formats[m]||function(f){return f.replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(p,g,v){return g||v.slice(1)})}(h.formats[m.toUpperCase()])},u=function(){var h=this;return{months:function(m){return m?m.format("MMMM"):l(h,"months")},monthsShort:function(m){return m?m.format("MMM"):l(h,"monthsShort","months",3)},firstDayOfWeek:function(){return h.$locale().weekStart||0},weekdays:function(m){return m?m.format("dddd"):l(h,"weekdays")},weekdaysMin:function(m){return m?m.format("dd"):l(h,"weekdaysMin","weekdays",2)},weekdaysShort:function(m){return m?m.format("ddd"):l(h,"weekdaysShort","weekdays",3)},longDateFormat:function(m){return d(h.$locale(),m)},meridiem:this.$locale().meridiem,ordinal:this.$locale().ordinal}};i.localeData=function(){return u.bind(this)()},s.localeData=function(){var h=c();return{firstDayOfWeek:function(){return h.weekStart||0},weekdays:function(){return s.weekdays()},weekdaysShort:function(){return s.weekdaysShort()},weekdaysMin:function(){return s.weekdaysMin()},months:function(){return s.months()},monthsShort:function(){return s.monthsShort()},longDateFormat:function(m){return d(h,m)},meridiem:h.meridiem,ordinal:h.ordinal}},s.months=function(){return l(c(),"months")},s.monthsShort=function(){return l(c(),"monthsShort","months",3)},s.weekdays=function(h){return l(c(),"weekdays",null,null,h)},s.weekdaysShort=function(h){return l(c(),"weekdaysShort","weekdays",3,h)},s.weekdaysMin=function(h){return l(c(),"weekdaysMin","weekdays",2,h)}}})})(UMr);var zMr={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(xf,function(){var n={LTS:"h:mm:ss A",LT:"h:mm A",L:"MM/DD/YYYY",LL:"MMMM D, YYYY",LLL:"MMMM D, YYYY h:mm A",LLLL:"dddd, MMMM D, YYYY h:mm A"};return function(r,s,i){var o=s.prototype,l=o.format;i.en.formats=n,o.format=function(c){c===void 0&&(c="YYYY-MM-DDTHH:mm:ssZ");var d=this.$locale().formats,u=function(h,m){return h.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,function(f,p,g){var v=g&&g.toUpperCase();return p||m[g]||n[g]||m[v].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,function(b,x,w){return x||w.slice(1)})})}(c,d===void 0?{}:d);return l.call(this,u)}}})})(zMr);var VMr={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(xf,function(){return function(n,r,s){var i=function(o,l){if(!l||!l.length||l.length===1&&!l[0]||l.length===1&&Array.isArray(l[0])&&!l[0].length)return null;var c;l.length===1&&l[0].length>0&&(l=l[0]),c=(l=l.filter(function(u){return u}))[0];for(var d=1;d<l.length;d+=1)l[d].isValid()&&!l[d][o](c)||(c=l[d]);return c};s.max=function(){var o=[].slice.call(arguments,0);return i("isAfter",o)},s.min=function(){var o=[].slice.call(arguments,0);return i("isBefore",o)}}})})(VMr);var HMr={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(xf,function(){var n="minute",r=/[+-]\d\d(?::?\d\d)?/g,s=/([+-]|\d\d)/g;return function(i,o,l){var c=o.prototype;l.utc=function(g){var v={date:g,utc:!0,args:arguments};return new o(v)},c.utc=function(g){var v=l(this.toDate(),{locale:this.$L,utc:!0});return g?v.add(this.utcOffset(),n):v},c.local=function(){return l(this.toDate(),{locale:this.$L,utc:!1})};var d=c.parse;c.parse=function(g){g.utc&&(this.$u=!0),this.$utils().u(g.$offset)||(this.$offset=g.$offset),d.call(this,g)};var u=c.init;c.init=function(){if(this.$u){var g=this.$d;this.$y=g.getUTCFullYear(),this.$M=g.getUTCMonth(),this.$D=g.getUTCDate(),this.$W=g.getUTCDay(),this.$H=g.getUTCHours(),this.$m=g.getUTCMinutes(),this.$s=g.getUTCSeconds(),this.$ms=g.getUTCMilliseconds()}else u.call(this)};var h=c.utcOffset;c.utcOffset=function(g,v){var b=this.$utils().u;if(b(g))return this.$u?0:b(this.$offset)?h.call(this):this.$offset;if(typeof g=="string"&&(g=function(S){S===void 0&&(S="");var C=S.match(r);if(!C)return null;var j=(""+C[0]).match(s)||["-",0,0],E=j[0],N=60*+j[1]+ +j[2];return N===0?0:E==="+"?N:-N}(g),g===null))return this;var x=Math.abs(g)<=16?60*g:g;if(x===0)return this.utc(v);var w=this.clone();if(v)return w.$offset=x,w.$u=!1,w;var k=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(w=this.local().add(x+k,n)).$offset=x,w.$x.$localOffset=k,w};var m=c.format;c.format=function(g){var v=g||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return m.call(this,v)},c.valueOf=function(){var g=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*g},c.isUTC=function(){return!!this.$u},c.toISOString=function(){return this.toDate().toISOString()},c.toString=function(){return this.toDate().toUTCString()};var f=c.toDate;c.toDate=function(g){return g==="s"&&this.$offset?l(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():f.call(this)};var p=c.diff;c.diff=function(g,v,b){if(g&&this.$u===g.$u)return p.call(this,g,v,b);var x=this.local(),w=l(g).local();return p.call(x,w,v,b)}}})})(HMr);var GMr={exports:{}};(function(t,e){(function(n,r){t.exports=r()})(xf,function(){return function(n,r){r.prototype.isLeapYear=function(){return this.$y%4==0&&this.$y%100!=0||this.$y%400==0}}})})(GMr);function Mv(t){return t.children}var kh={PREVIOUS:"PREV",NEXT:"NEXT",TODAY:"TODAY",DATE:"DATE"},wu={MONTH:"month",WEEK:"week",WORK_WEEK:"work_week",DAY:"day",AGENDA:"agenda"},hWe=Object.keys(wu).map(function(t){return wu[t]});$t.oneOfType([$t.string,$t.func]);$t.any;$t.func;$t.oneOfType([$t.arrayOf($t.oneOf(hWe)),$t.objectOf(function(t,e){var n=hWe.indexOf(e)!==-1&&typeof t[e]=="boolean";if(n)return null;for(var r=arguments.length,s=new Array(r>2?r-2:0),i=2;i<r;i++)s[i-2]=arguments[i];return $t.elementType.apply($t,[t,e].concat(s))})]);$t.oneOfType([$t.oneOf(["overlap","no-overlap"]),$t.func]);var mWe={seconds:1e3,minutes:1e3*60,hours:1e3*60*60,day:1e3*60*60*24};function pRt(t,e){var n=jd(t,"month");return jd(n,"week",e.startOfWeek())}function gRt(t,e){var n=sJ(t,"month");return sJ(n,"week",e.startOfWeek())}function WMr(t,e){for(var n=pRt(t,e),r=gRt(t,e),s=[];RM(n,r,"day");)s.push(n),n=Og(n,1,"day");return s}function qMr(t,e){var n=jd(t,e);return PM(n,t)?n:Og(n,1,e)}function KMr(t,e){for(var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"day",r=t,s=[];RM(r,e,n);)s.push(r),r=Og(r,1,n);return s}function YMr(t,e){return e==null&&t==null?null:(e==null&&(e=new Date),t==null&&(t=new Date),t=jd(t,"day"),t=yF(t,yF(e)),t=n5(t,n5(e)),t=vF(t,vF(e)),gF(t,gF(e)))}function fWe(t){return yF(t)===0&&n5(t)===0&&vF(t)===0&&gF(t)===0}function QMr(t,e,n,r){return n==="day"&&(n="date"),Math.abs(YHe[n](t,void 0,r)-YHe[n](e,void 0,r))}function dRe(t,e,n){return!n||n==="milliseconds"?Math.abs(+t-+e):Math.round(Math.abs(+jd(t,n)/mWe[n]-+jd(e,n)/mWe[n]))}function pWe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function qV(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?pWe(Object(n),!0).forEach(function(r){fd(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):pWe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var ZMr=$t.oneOfType([$t.string,$t.func]);function JMr(t,e,n,r,s){var i=typeof r=="function"?r(n,s,t):e.call(t,n,r,s);return dF(i==null||typeof i=="string","`localizer format(..)` must return a string, null, or undefined"),i}function XMr(t,e,n){return new Date(t.getFullYear(),t.getMonth(),t.getDate(),0,e+n,0,0)}function uRe(t,e){return t.getTimezoneOffset()-e.getTimezoneOffset()}function eLr(t,e){return dRe(t,e,"minutes")+uRe(t,e)}function tLr(t){var e=jd(t,"day");return dRe(e,t,"minutes")+uRe(e,t)}function nLr(t,e){return _Pe(t,e,"day")}function rLr(t,e,n){var r=PM(t,e,"minutes");return r?o9(e,n,"minutes"):Ose(e,n,"minutes")}function J0e(t,e){return QMr(t,e,"day")}function sLr(t){var e=t.evtA,n=e.start,r=e.end,s=e.allDay,i=t.evtB,o=i.start,l=i.end,c=i.allDay,d=+jd(n,"day")-+jd(o,"day"),u=J0e(n,r),h=J0e(o,l);return d||h-u||!!c-!!s||+n-+o||+r-+l}function iLr(t){var e=t.event,n=e.start,r=e.end,s=t.range,i=s.start,o=s.end,l=jd(n,"day"),c=RM(l,o,"day"),d=TPe(l,r,"minutes"),u=d?Ose(r,i,"minutes"):o9(r,i,"minutes");return c&&u}function aLr(t,e){return PM(t,e,"day")}function oLr(t,e){return fWe(t)&&fWe(e)}var lLr=kc(function t(e){var n=this;wc(this,t),dF(typeof e.format=="function","date localizer `format(..)` must be a function"),dF(typeof e.firstOfWeek=="function","date localizer `firstOfWeek(..)` must be a function"),this.propType=e.propType||ZMr,this.formats=e.formats,this.format=function(){for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return JMr.apply(void 0,[n,e.format].concat(s))},this.startOfWeek=e.firstOfWeek,this.merge=e.merge||YMr,this.inRange=e.inRange||XAt,this.lt=e.lt||_Pe,this.lte=e.lte||RM,this.gt=e.gt||Ose,this.gte=e.gte||o9,this.eq=e.eq||PM,this.neq=e.neq||TPe,this.startOf=e.startOf||jd,this.endOf=e.endOf||sJ,this.add=e.add||Og,this.range=e.range||KMr,this.diff=e.diff||dRe,this.ceil=e.ceil||qMr,this.min=e.min||ZAt,this.max=e.max||JAt,this.minutes=e.minutes||n5,this.daySpan=e.daySpan||J0e,this.firstVisibleDay=e.firstVisibleDay||pRt,this.lastVisibleDay=e.lastVisibleDay||gRt,this.visibleDays=e.visibleDays||WMr,this.getSlotDate=e.getSlotDate||XMr,this.getTimezoneOffset=e.getTimezoneOffset||function(r){return r.getTimezoneOffset()},this.getDstOffset=e.getDstOffset||uRe,this.getTotalMin=e.getTotalMin||eLr,this.getMinutesFromMidnight=e.getMinutesFromMidnight||tLr,this.continuesPrior=e.continuesPrior||nLr,this.continuesAfter=e.continuesAfter||rLr,this.sortEvents=e.sortEvents||sLr,this.inEventRange=e.inEventRange||iLr,this.isSameDate=e.isSameDate||aLr,this.startAndEndAreDateOnly=e.startAndEndAreDateOnly||oLr,this.segmentOffset=e.browserTZOffset?e.browserTZOffset():0});function cLr(t,e,n,r){var s=qV(qV({},t.formats),n);return qV(qV({},t),{},{messages:r,startOfWeek:function(){return t.startOfWeek(e)},format:function(o,l){return t.format(o,s[l]||l,e)}})}function dLr(t,e,n){return e=ci(e),su(t,vRt()?Reflect.construct(e,n||[],ci(t).constructor):e.apply(t,n))}function vRt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(vRt=function(){return!!t})()}var yRt=function(t){function e(){var n;wc(this,e);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=dLr(this,e,[].concat(s)),n.navigate=function(o){n.props.onNavigate(o)},n.view=function(o){n.props.onView(o)},n}return iu(e,t),kc(e,[{key:"render",value:function(){var r=this.props,s=r.localizer.messages,i=r.label;return se.createElement("div",{className:"rbc-toolbar"},se.createElement("span",{className:"rbc-btn-group"},se.createElement("button",{type:"button",onClick:this.navigate.bind(null,kh.TODAY)},s.today),se.createElement("button",{type:"button",onClick:this.navigate.bind(null,kh.PREVIOUS)},s.previous),se.createElement("button",{type:"button",onClick:this.navigate.bind(null,kh.NEXT)},s.next)),se.createElement("span",{className:"rbc-toolbar-label"},i),se.createElement("span",{className:"rbc-btn-group"},this.viewNamesGroup(s)))}},{key:"viewNamesGroup",value:function(r){var s=this,i=this.props.views,o=this.props.view;if(i.length>1)return i.map(function(l){return se.createElement("button",{type:"button",key:l,className:Zn({"rbc-active":o===l}),onClick:s.view.bind(null,l)},r[l])})}}])}(se.Component);yRt.propTypes={};function Ja(t,e){t&&t.apply(null,[].concat(e))}function gWe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function vWe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?gWe(Object(n),!0).forEach(function(r){fd(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):gWe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var uLr={date:"Date",time:"Time",event:"Event",allDay:"All Day",week:"Week",work_week:"Work Week",day:"Day",month:"Month",previous:"Back",next:"Next",yesterday:"Yesterday",tomorrow:"Tomorrow",today:"Today",agenda:"Agenda",noEventsInRange:"There are no events in this range.",showMore:function(e){return"+".concat(e," more")}};function hLr(t){return vWe(vWe({},uLr),t)}function mLr(t){var e=t.ref,n=t.callback;y.useEffect(function(){var r=function(i){e.current&&!e.current.contains(i.target)&&n()};return document.addEventListener("mousedown",r),function(){document.removeEventListener("mousedown",r)}},[e,n])}var fLr=["style","className","event","selected","isAllDay","onSelect","onDoubleClick","onKeyPress","localizer","continuesPrior","continuesAfter","accessors","getters","children","components","slotStart","slotEnd"];function yWe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function bWe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?yWe(Object(n),!0).forEach(function(r){fd(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):yWe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function pLr(t,e,n){return e=ci(e),su(t,bRt()?Reflect.construct(e,n||[],ci(t).constructor):e.apply(t,n))}function bRt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(bRt=function(){return!!t})()}var hRe=function(t){function e(){return wc(this,e),pLr(this,e,arguments)}return iu(e,t),kc(e,[{key:"render",value:function(){var r=this.props,s=r.style,i=r.className,o=r.event,l=r.selected,c=r.isAllDay,d=r.onSelect,u=r.onDoubleClick,h=r.onKeyPress,m=r.localizer,f=r.continuesPrior,p=r.continuesAfter,g=r.accessors,v=r.getters,b=r.children,x=r.components,w=x.event,k=x.eventWrapper,S=r.slotStart,C=r.slotEnd,j=Oy(r,fLr);delete j.resizable;var E=g.title(o),N=g.tooltip(o),A=g.end(o),_=g.start(o),T=g.allDay(o),R=c||T||m.diff(_,m.ceil(A,"day"),"day")>1,O=v.eventProp(o,_,A,l),F=se.createElement("div",{className:"rbc-event-content",title:N||void 0},w?se.createElement(w,{event:o,continuesPrior:f,continuesAfter:p,title:E,isAllDay:T,localizer:m,slotStart:S,slotEnd:C}):E);return se.createElement(k,Ts({},this.props,{type:"date"}),se.createElement("div",Ts({},j,{style:bWe(bWe({},O.style),s),className:Zn("rbc-event",i,O.className,{"rbc-selected":l,"rbc-event-allday":R,"rbc-event-continues-prior":f,"rbc-event-continues-after":p}),onClick:function(I){return d&&d(o,I)},onDoubleClick:function(I){return u&&u(o,I)},onKeyDown:function(I){return h&&h(o,I)}}),typeof b=="function"?b(F):F))}}])}(se.Component);hRe.propTypes={};function eie(t,e){return!t||e==null?!1:m0(t,e)}function xRt(t,e){var n=t.right-t.left,r=n/e;return r}function wRt(t,e,n,r){var s=xRt(t,r);return n?r-1-Math.floor((e-t.left)/s):Math.floor((e-t.left)/s)}function gLr(t,e){var n=e.x,r=e.y;return r>=t.top&&r<=t.bottom&&n>=t.left&&n<=t.right}function vLr(t,e,n,r,s){var i=-1,o=-1,l=r-1,c=xRt(e,r),d=wRt(e,n.x,s,r),u=e.top<n.y&&e.bottom>n.y,h=e.top<t.y&&e.bottom>t.y,m=t.y>e.bottom,f=e.top>t.y,p=n.top<e.top&&n.bottom>e.bottom;return p&&(i=0,o=l),u&&(f?(i=0,o=d):m&&(i=d,o=l)),h&&(i=o=s?l-Math.floor((t.x-e.left)/c):Math.floor((t.x-e.left)/c),u?d<i?i=d:o=d:t.y<n.y?o=l:i=0),{startIdx:i,endIdx:o}}function yLr(t){var e=t.target,n=t.offset,r=t.container,s=t.box,i=n2(e),o=i.top,l=i.left,c=i.width,d=i.height,u=n2(r),h=u.top,m=u.left,f=u.width,p=u.height,g=n2(s),v=g.width,b=g.height,x=h+p,w=m+f,k=o+b,S=l+v,C=n.x,j=n.y,E=k>x?o-b-j:o+j+d,N=S>w?l+C-v+c:l+C;return{topOffset:E,leftOffset:N}}function bLr(t){var e=t.containerRef,n=t.accessors,r=t.getters,s=t.selected,i=t.components,o=t.localizer,l=t.position,c=t.show,d=t.events,u=t.slotStart,h=t.slotEnd,m=t.onSelect,f=t.onDoubleClick,p=t.onKeyPress,g=t.handleDragStart,v=t.popperRef,b=t.target,x=t.offset;mLr({ref:v,callback:c}),y.useLayoutEffect(function(){var S=yLr({target:b,offset:x,container:e.current,box:v.current}),C=S.topOffset,j=S.leftOffset;v.current.style.top="".concat(C,"px"),v.current.style.left="".concat(j,"px")},[x.x,x.y,b]);var w=l.width,k={minWidth:w+w/2};return se.createElement("div",{style:k,className:"rbc-overlay",ref:v},se.createElement("div",{className:"rbc-overlay-header"},o.format(u,"dayHeaderFormat")),d.map(function(S,C){return se.createElement(hRe,{key:C,type:"popup",localizer:o,event:S,getters:r,onSelect:m,accessors:n,components:i,onDoubleClick:f,onKeyPress:p,continuesPrior:o.lt(n.end(S),u,"day"),continuesAfter:o.gte(n.start(S),h,"day"),slotStart:u,slotEnd:h,selected:eie(S,s),draggable:!0,onDragStart:function(){return g(S)},onDragEnd:function(){return c()}})}))}var kRt=se.forwardRef(function(t,e){return se.createElement(bLr,Ts({},t,{popperRef:e}))});kRt.propTypes={accessors:$t.object.isRequired,getters:$t.object.isRequired,selected:$t.object,components:$t.object.isRequired,localizer:$t.object.isRequired,position:$t.object.isRequired,show:$t.func.isRequired,events:$t.array.isRequired,slotStart:$t.instanceOf(Date).isRequired,slotEnd:$t.instanceOf(Date),onSelect:$t.func,onDoubleClick:$t.func,onKeyPress:$t.func,handleDragStart:$t.func,style:$t.object,offset:$t.shape({x:$t.number,y:$t.number})};function xLr(t){var e=t.containerRef,n=t.popupOffset,r=n===void 0?5:n,s=t.overlay,i=t.accessors,o=t.localizer,l=t.components,c=t.getters,d=t.selected,u=t.handleSelectEvent,h=t.handleDoubleClickEvent,m=t.handleKeyPressEvent,f=t.handleDragStart,p=t.onHide,g=t.overlayDisplay,v=y.useRef(null);if(!s.position)return null;var b=r;isNaN(r)||(b={x:r,y:r});var x=s.position,w=s.events,k=s.date,S=s.end;return se.createElement(HPe,{rootClose:!0,flip:!0,show:!0,placement:"bottom",onHide:p,target:s.target},function(C){var j=C.props;return se.createElement(kRt,Ts({},j,{containerRef:e,ref:v,target:s.target,offset:b,accessors:i,getters:c,selected:d,components:l,localizer:o,position:x,show:g,events:w,slotStart:k,slotEnd:S,onSelect:u,onDoubleClick:h,onKeyPress:m,handleDragStart:f}))})}var mRe=se.forwardRef(function(t,e){return se.createElement(xLr,Ts({},t,{containerRef:e}))});mRe.propTypes={popupOffset:$t.oneOfType([$t.number,$t.shape({x:$t.number,y:$t.number})]),overlay:$t.shape({position:$t.object,events:$t.array,date:$t.instanceOf(Date),end:$t.instanceOf(Date)}),accessors:$t.object.isRequired,localizer:$t.object.isRequired,components:$t.object.isRequired,getters:$t.object.isRequired,selected:$t.object,handleSelectEvent:$t.func,handleDoubleClickEvent:$t.func,handleKeyPressEvent:$t.func,handleDragStart:$t.func,onHide:$t.func,overlayDisplay:$t.func};function Id(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:document;return LNr(n,t,e,{passive:!1})}function wLr(t,e,n){return!t||aJ(t,document.elementFromPoint(e,n))}function kLr(t,e){var n=e.clientX,r=e.clientY,s=document.elementFromPoint(n,r);return OPt(s,".rbc-event",t)}function SLr(t,e){var n=e.clientX,r=e.clientY,s=document.elementFromPoint(n,r);return OPt(s,".rbc-show-more",t)}function hJ(t,e){return!!kLr(t,e)}function CLr(t,e){return!!SLr(t,e)}function F3(t){var e=t;return t.touches&&t.touches.length&&(e=t.touches[0]),{clientX:e.clientX,clientY:e.clientY,pageX:e.pageX,pageY:e.pageY}}var xWe=5,jLr=250,SRt=function(){function t(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.global,s=r===void 0?!1:r,i=n.longPressThreshold,o=i===void 0?250:i,l=n.validContainers,c=l===void 0?[]:l;wc(this,t),this._initialEvent=null,this.selecting=!1,this.isDetached=!1,this.container=e,this.globalMouse=!e||s,this.longPressThreshold=o,this.validContainers=c,this._listeners=Object.create(null),this._handleInitialEvent=this._handleInitialEvent.bind(this),this._handleMoveEvent=this._handleMoveEvent.bind(this),this._handleTerminatingEvent=this._handleTerminatingEvent.bind(this),this._keyListener=this._keyListener.bind(this),this._dropFromOutsideListener=this._dropFromOutsideListener.bind(this),this._dragOverFromOutsideListener=this._dragOverFromOutsideListener.bind(this),this._removeTouchMoveWindowListener=Id("touchmove",function(){},window),this._removeKeyDownListener=Id("keydown",this._keyListener),this._removeKeyUpListener=Id("keyup",this._keyListener),this._removeDropFromOutsideListener=Id("drop",this._dropFromOutsideListener),this._removeDragOverFromOutsideListener=Id("dragover",this._dragOverFromOutsideListener),this._addInitialEventListener()}return kc(t,[{key:"on",value:function(n,r){var s=this._listeners[n]||(this._listeners[n]=[]);return s.push(r),{remove:function(){var o=s.indexOf(r);o!==-1&&s.splice(o,1)}}}},{key:"emit",value:function(n){for(var r=arguments.length,s=new Array(r>1?r-1:0),i=1;i<r;i++)s[i-1]=arguments[i];var o,l=this._listeners[n]||[];return l.forEach(function(c){o===void 0&&(o=c.apply(void 0,s))}),o}},{key:"teardown",value:function(){this._initialEvent=null,this._initialEventData=null,this._selectRect=null,this.selecting=!1,this._lastClickData=null,this.isDetached=!0,this._listeners=Object.create(null),this._removeTouchMoveWindowListener&&this._removeTouchMoveWindowListener(),this._removeInitialEventListener&&this._removeInitialEventListener(),this._removeEndListener&&this._removeEndListener(),this._onEscListener&&this._onEscListener(),this._removeMoveListener&&this._removeMoveListener(),this._removeKeyUpListener&&this._removeKeyUpListener(),this._removeKeyDownListener&&this._removeKeyDownListener(),this._removeDropFromOutsideListener&&this._removeDropFromOutsideListener(),this._removeDragOverFromOutsideListener&&this._removeDragOverFromOutsideListener()}},{key:"isSelected",value:function(n){var r=this._selectRect;return!r||!this.selecting?!1:wWe(r,rE(n))}},{key:"filter",value:function(n){var r=this._selectRect;return!r||!this.selecting?[]:n.filter(this.isSelected,this)}},{key:"_addLongPressListener",value:function(n,r){var s=this,i=null,o=null,l=null,c=function(m){i=setTimeout(function(){u(),n(m)},s.longPressThreshold),o=Id("touchmove",function(){return u()}),l=Id("touchend",function(){return u()})},d=Id("touchstart",c),u=function(){i&&clearTimeout(i),o&&o(),l&&l(),i=null,o=null,l=null};return r&&c(r),function(){u(),d()}}},{key:"_addInitialEventListener",value:function(){var n=this,r=Id("mousedown",function(i){n._removeInitialEventListener(),n._handleInitialEvent(i),n._removeInitialEventListener=Id("mousedown",n._handleInitialEvent)}),s=Id("touchstart",function(i){n._removeInitialEventListener(),n._removeInitialEventListener=n._addLongPressListener(n._handleInitialEvent,i)});this._removeInitialEventListener=function(){r(),s()}}},{key:"_dropFromOutsideListener",value:function(n){var r=F3(n),s=r.pageX,i=r.pageY,o=r.clientX,l=r.clientY;this.emit("dropFromOutside",{x:s,y:i,clientX:o,clientY:l}),n.preventDefault()}},{key:"_dragOverFromOutsideListener",value:function(n){var r=F3(n),s=r.pageX,i=r.pageY,o=r.clientX,l=r.clientY;this.emit("dragOverFromOutside",{x:s,y:i,clientX:o,clientY:l}),n.preventDefault()}},{key:"_handleInitialEvent",value:function(n){if(this._initialEvent=n,!this.isDetached){var r=F3(n),s=r.clientX,i=r.clientY,o=r.pageX,l=r.pageY,c=this.container(),d,u;if(!(n.which===3||n.button===2||!wLr(c,s,i))){if(!this.globalMouse&&c&&!aJ(c,n.target)){var h=ELr(0),m=h.top,f=h.left,p=h.bottom,g=h.right;if(u=rE(c),d=wWe({top:u.top-m,left:u.left-f,bottom:u.bottom+p,right:u.right+g},{top:l,left:o}),!d)return}var v=this.emit("beforeSelect",this._initialEventData={isTouch:/^touch/.test(n.type),x:o,y:l,clientX:s,clientY:i});if(v!==!1)switch(n.type){case"mousedown":this._removeEndListener=Id("mouseup",this._handleTerminatingEvent),this._onEscListener=Id("keydown",this._handleTerminatingEvent),this._removeMoveListener=Id("mousemove",this._handleMoveEvent);break;case"touchstart":this._handleMoveEvent(n),this._removeEndListener=Id("touchend",this._handleTerminatingEvent),this._removeMoveListener=Id("touchmove",this._handleMoveEvent);break}}}}},{key:"_isWithinValidContainer",value:function(n){var r=n.target,s=this.validContainers;return!s||!s.length||!r?!0:s.some(function(i){return!!r.closest(i)})}},{key:"_handleTerminatingEvent",value:function(n){var r=this.selecting,s=this._selectRect;if(!r&&n.type.includes("key")&&(n=this._initialEvent),this.selecting=!1,this._removeEndListener&&this._removeEndListener(),this._removeMoveListener&&this._removeMoveListener(),this._selectRect=null,this._initialEvent=null,this._initialEventData=null,!!n){var i=!this.container||aJ(this.container(),n.target),o=this._isWithinValidContainer(n);return n.key==="Escape"||!o?this.emit("reset"):!r&&i?this._handleClickEvent(n):r?this.emit("select",s):this.emit("reset")}}},{key:"_handleClickEvent",value:function(n){var r=F3(n),s=r.pageX,i=r.pageY,o=r.clientX,l=r.clientY,c=new Date().getTime();return this._lastClickData&&c-this._lastClickData.timestamp<jLr?(this._lastClickData=null,this.emit("doubleClick",{x:s,y:i,clientX:o,clientY:l})):(this._lastClickData={timestamp:c},this.emit("click",{x:s,y:i,clientX:o,clientY:l}))}},{key:"_handleMoveEvent",value:function(n){if(!(this._initialEventData===null||this.isDetached)){var r=this._initialEventData,s=r.x,i=r.y,o=F3(n),l=o.pageX,c=o.pageY,d=Math.abs(s-l),u=Math.abs(i-c),h=Math.min(l,s),m=Math.min(c,i),f=this.selecting,p=this.isClick(l,c);p&&!f&&!(d||u)||(!f&&!p&&this.emit("selectStart",this._initialEventData),p||(this.selecting=!0,this._selectRect={top:m,left:h,x:l,y:c,right:h+d,bottom:m+u},this.emit("selecting",this._selectRect)),n.preventDefault())}}},{key:"_keyListener",value:function(n){this.ctrl=n.metaKey||n.ctrlKey}},{key:"isClick",value:function(n,r){var s=this._initialEventData,i=s.x,o=s.y,l=s.isTouch;return!l&&Math.abs(n-i)<=xWe&&Math.abs(r-o)<=xWe}}])}();function ELr(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:0;return u0(t)!=="object"&&(t={top:t,left:t,right:t,bottom:t}),t}function wWe(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,r=rE(t),s=r.top,i=r.left,o=r.right,l=o===void 0?i:o,c=r.bottom,d=c===void 0?s:c,u=rE(e),h=u.top,m=u.left,f=u.right,p=f===void 0?m:f,g=u.bottom,v=g===void 0?h:g;return!(d-n<h||s+n>v||l-n<m||i+n>p)}function rE(t){if(!t.getBoundingClientRect)return t;var e=t.getBoundingClientRect(),n=e.left+kWe("left"),r=e.top+kWe("top");return{top:r,left:n,right:(t.offsetWidth||0)+n,bottom:(t.offsetHeight||0)+r}}function kWe(t){if(t==="left")return window.pageXOffset||document.body.scrollLeft||0;if(t==="top")return window.pageYOffset||document.body.scrollTop||0}function SWe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function CWe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?SWe(Object(n),!0).forEach(function(r){fd(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):SWe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function NLr(t,e,n){return e=ci(e),su(t,CRt()?Reflect.construct(e,n||[],ci(t).constructor):e.apply(t,n))}function CRt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(CRt=function(){return!!t})()}var jRt=function(t){function e(n,r){var s;return wc(this,e),s=NLr(this,e,[n,r]),s.state={selecting:!1},s.containerRef=y.createRef(),s}return iu(e,t),kc(e,[{key:"componentDidMount",value:function(){this.props.selectable&&this._selectable()}},{key:"componentWillUnmount",value:function(){this._teardownSelectable()}},{key:"componentDidUpdate",value:function(r){!r.selectable&&this.props.selectable&&this._selectable(),r.selectable&&!this.props.selectable&&this._teardownSelectable()}},{key:"render",value:function(){var r=this.props,s=r.range,i=r.getNow,o=r.getters,l=r.date,c=r.components.dateCellWrapper,d=r.localizer,u=this.state,h=u.selecting,m=u.startIdx,f=u.endIdx,p=i();return se.createElement("div",{className:"rbc-row-bg",ref:this.containerRef},s.map(function(g,v){var b=h&&v>=m&&v<=f,x=o.dayProp(g),w=x.className,k=x.style;return se.createElement(c,{key:v,value:g,range:s},se.createElement("div",{style:k,className:Zn("rbc-day-bg",w,b&&"rbc-selected-cell",d.isSameDate(g,p)&&"rbc-today",l&&d.neq(l,g,"month")&&"rbc-off-range-bg")}))}))}},{key:"_selectable",value:function(){var r=this,s=this.containerRef.current,i=this._selector=new SRt(this.props.container,{longPressThreshold:this.props.longPressThreshold}),o=function(c,d){if(!hJ(s,c)&&!CLr(s,c)){var u=rE(s),h=r.props,m=h.range,f=h.rtl;if(gLr(u,c)){var p=wRt(u,c.x,f,m.length);r._selectSlot({startIdx:p,endIdx:p,action:d,box:c})}}r._initial={},r.setState({selecting:!1})};i.on("selecting",function(l){var c=r.props,d=c.range,u=c.rtl,h=-1,m=-1;if(r.state.selecting||(Ja(r.props.onSelectStart,[l]),r._initial={x:l.x,y:l.y}),i.isSelected(s)){var f=rE(s),p=vLr(r._initial,f,l,d.length,u);h=p.startIdx,m=p.endIdx}r.setState({selecting:!0,startIdx:h,endIdx:m})}),i.on("beforeSelect",function(l){if(r.props.selectable==="ignoreEvents")return!hJ(r.containerRef.current,l)}),i.on("click",function(l){return o(l,"click")}),i.on("doubleClick",function(l){return o(l,"doubleClick")}),i.on("select",function(l){r._selectSlot(CWe(CWe({},r.state),{},{action:"select",bounds:l})),r._initial={},r.setState({selecting:!1}),Ja(r.props.onSelectEnd,[r.state])})}},{key:"_teardownSelectable",value:function(){this._selector&&(this._selector.teardown(),this._selector=null)}},{key:"_selectSlot",value:function(r){var s=r.endIdx,i=r.startIdx,o=r.action,l=r.bounds,c=r.box;s!==-1&&i!==-1&&this.props.onSelectSlot&&this.props.onSelectSlot({start:i,end:s,action:o,bounds:l,box:c,resourceId:this.props.resourceId})}}])}(se.Component);jRt.propTypes={};var hf={propTypes:{slotMetrics:$t.object.isRequired,selected:$t.object,isAllDay:$t.bool,accessors:$t.object.isRequired,localizer:$t.object.isRequired,components:$t.object.isRequired,getters:$t.object.isRequired,onSelect:$t.func,onDoubleClick:$t.func,onKeyPress:$t.func},defaultProps:{segments:[],selected:{}},renderEvent:function(e,n){var r=e.selected;e.isAllDay;var s=e.accessors,i=e.getters,o=e.onSelect,l=e.onDoubleClick,c=e.onKeyPress,d=e.localizer,u=e.slotMetrics,h=e.components,m=e.resizable,f=u.continuesPrior(n),p=u.continuesAfter(n);return se.createElement(hRe,{event:n,getters:i,localizer:d,accessors:s,components:h,onSelect:o,onDoubleClick:l,onKeyPress:c,continuesPrior:f,continuesAfter:p,slotStart:u.first,slotEnd:u.last,selected:eie(n,r),resizable:m})},renderSpan:function(e,n,r){var s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:" ",i=Math.abs(n)/e*100+"%";return se.createElement("div",{key:r,className:"rbc-row-segment",style:{WebkitFlexBasis:i,flexBasis:i,maxWidth:i}},s)}};function jWe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function TLr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?jWe(Object(n),!0).forEach(function(r){fd(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):jWe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function _Lr(t,e,n){return e=ci(e),su(t,ERt()?Reflect.construct(e,n||[],ci(t).constructor):e.apply(t,n))}function ERt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ERt=function(){return!!t})()}var fRe=function(t){function e(){return wc(this,e),_Lr(this,e,arguments)}return iu(e,t),kc(e,[{key:"render",value:function(){var r=this,s=this.props,i=s.segments,o=s.slotMetrics.slots,l=s.className,c=1;return se.createElement("div",{className:Zn(l,"rbc-row")},i.reduce(function(d,u,h){var m=u.event,f=u.left,p=u.right,g=u.span,v="_lvl_"+h,b=f-c,x=hf.renderEvent(r.props,m);return b&&d.push(hf.renderSpan(o,b,"".concat(v,"_gap"))),d.push(hf.renderSpan(o,g,v,x)),c=p+1,d},[]))}}])}(se.Component);fRe.propTypes={};fRe.defaultProps=TLr({},hf.defaultProps);function NRt(t){var e=t.dateRange,n=t.unit,r=n===void 0?"day":n,s=t.localizer;return{first:e[0],last:s.add(e[e.length-1],1,r)}}function ALr(t,e,n,r){var s=NRt({dateRange:e,localizer:r}),i=s.first,o=s.last,l=r.diff(i,o,"day"),c=r.max(r.startOf(n.start(t),"day"),i),d=r.min(r.ceil(n.end(t),"day"),o),u=R_r(e,function(m){return r.isSameDate(m,c)}),h=r.diff(c,d,"day");return h=Math.min(h,l),h=Math.max(h-r.segmentOffset,1),{event:t,span:h,left:u+1,right:Math.max(u+h,1)}}function X0e(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:1/0,n,r,s,i=[],o=[];for(n=0;n<t.length;n++){for(s=t[n],r=0;r<i.length&&PLr(s,i[r]);r++);r>=e?o.push(s):(i[r]||(i[r]=[])).push(s)}for(n=0;n<i.length;n++)i[n].sort(function(l,c){return l.left-c.left});return{levels:i,extra:o}}function kF(t,e,n,r,s){var i={start:r.start(t),end:r.end(t)},o={start:e,end:n};return s.inEventRange({event:i,range:o})}function PLr(t,e){return e.some(function(n){return n.left<=t.right&&n.right>=t.left})}function RLr(t,e,n){var r=xq(t),s=[],i=[];r.forEach(function(c){var d=e.start(c),u=e.end(c);n.daySpan(d,u)>1?s.push(c):i.push(c)});var o=s.sort(function(c,d){return ewe(c,d,e,n)}),l=i.sort(function(c,d){return ewe(c,d,e,n)});return[].concat(xq(o),xq(l))}function ewe(t,e,n,r){var s={start:n.start(t),end:n.end(t),allDay:n.allDay(t)},i={start:n.start(e),end:n.end(e),allDay:n.allDay(e)};return r.sortEvents({evtA:s,evtB:i})}function EWe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function ILr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?EWe(Object(n),!0).forEach(function(r){fd(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):EWe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function MLr(t,e,n){return e=ci(e),su(t,TRt()?Reflect.construct(e,n||[],ci(t).constructor):e.apply(t,n))}function TRt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(TRt=function(){return!!t})()}var twe=function(e,n){return e.left<=n&&e.right>=n},gue=function(e,n){return e.filter(function(r){return twe(r,n)}).map(function(r){return r.event})},pRe=function(t){function e(){return wc(this,e),MLr(this,e,arguments)}return iu(e,t),kc(e,[{key:"render",value:function(){for(var r=this.props,s=r.segments,i=r.slotMetrics.slots,o=X0e(s).levels[0],l=1,c=1,d=[];l<=i;){var u="_lvl_"+l,h=o.filter(function(k){return twe(k,l)})[0]||{},m=h.event,f=h.left,p=h.right,g=h.span;if(!m){var v=this.getHiddenEventsForSlot(s,l);if(v.length>0){var b=l-c;b&&d.push(hf.renderSpan(i,b,u+"_gap")),d.push(hf.renderSpan(i,1,u,this.renderShowMore(s,l))),c=l=l+1;continue}l++;continue}var x=Math.max(0,f-c);if(this.canRenderSlotEvent(f,g)){var w=hf.renderEvent(this.props,m);x&&d.push(hf.renderSpan(i,x,u+"_gap")),d.push(hf.renderSpan(i,g,u,w)),c=l=p+1}else x&&d.push(hf.renderSpan(i,x,u+"_gap")),d.push(hf.renderSpan(i,1,u,this.renderShowMore(s,l))),c=l=l+1}return se.createElement("div",{className:"rbc-row"},d)}},{key:"getHiddenEventsForSlot",value:function(r,s){var i=gue(r,s),o=X0e(r).levels[0],l=o.filter(function(c){return twe(c,s)}).map(function(c){return c.event});return i.filter(function(c){return!l.some(function(d){return d===c})})}},{key:"canRenderSlotEvent",value:function(r,s){var i=this.props.segments;return wF(r,r+s).every(function(o){var l=gue(i,o).length;return l===1})}},{key:"renderShowMore",value:function(r,s){var i=this,o=this.props,l=o.localizer,c=o.slotMetrics,d=o.components,u=c.getEventsForSlot(s),h=gue(r,s),m=h.length;if(d!=null&&d.showMore){var f=d.showMore,p=c.getDateForSlot(s-1);return m?se.createElement(f,{localizer:l,slotDate:p,slot:s,count:m,events:u,remainingEvents:h}):!1}return m?se.createElement("button",{type:"button",key:"sm_"+s,className:Zn("rbc-button-link","rbc-show-more"),onClick:function(v){return i.showMore(s,v)}},l.messages.showMore(m,h,u)):!1}},{key:"showMore",value:function(r,s){s.preventDefault(),s.stopPropagation(),this.props.onShowMore(r,s.target)}}])}(se.Component);pRe.propTypes={};pRe.defaultProps=ILr({},hf.defaultProps);var LLr=function(e){var n=e.children;return se.createElement("div",{className:"rbc-row-content-scroll-container"},n)};function NWe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function TWe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?NWe(Object(n),!0).forEach(function(r){fd(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):NWe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}var DLr=function(e,n){return e.left<=n&&e.right>=n},$Lr=function(e,n){return e[0].range===n[0].range&&e[0].events===n[0].events};function _Rt(){return KPt(function(t){for(var e=t.range,n=t.events,r=t.maxRows,s=t.minRows,i=t.accessors,o=t.localizer,l=NRt({dateRange:e,localizer:o}),c=l.first,d=l.last,u=n.map(function(g){return ALr(g,e,i,o)}),h=X0e(u,Math.max(r-1,1)),m=h.levels,f=h.extra,p=f.length>0?s-1:s;m.length<p;)m.push([]);return{first:c,last:d,levels:m,extra:f,range:e,slots:e.length,clone:function(v){var b=_Rt();return b(TWe(TWe({},t),v))},getDateForSlot:function(v){return e[v]},getSlotForDate:function(v){return e.find(function(b){return o.isSameDate(b,v)})},getEventsForSlot:function(v){return u.filter(function(b){return DLr(b,v)}).map(function(b){return b.event})},continuesPrior:function(v){return o.continuesPrior(i.start(v),c)},continuesAfter:function(v){var b=i.start(v),x=i.end(v);return o.continuesAfter(b,x,d)}}},$Lr)}function OLr(t,e,n){return e=ci(e),su(t,ARt()?Reflect.construct(e,n||[],ci(t).constructor):e.apply(t,n))}function ARt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ARt=function(){return!!t})()}var o5=function(t){function e(){var n;wc(this,e);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=OLr(this,e,[].concat(s)),n.handleSelectSlot=function(o){var l=n.props,c=l.range,d=l.onSelectSlot;d(c.slice(o.start,o.end+1),o)},n.handleShowMore=function(o,l){var c=n.props,d=c.range,u=c.onShowMore,h=n.slotMetrics(n.props),m=PNr(n.containerRef.current,".rbc-row-bg")[0],f;m&&(f=m.children[o-1]);var p=h.getEventsForSlot(o);u(p,d[o-1],f,o,l)},n.getContainer=function(){var o=n.props.container;return o?o():n.containerRef.current},n.renderHeadingCell=function(o,l){var c=n.props,d=c.renderHeader,u=c.getNow,h=c.localizer;return d({date:o,key:"header_".concat(l),className:Zn("rbc-date-cell",h.isSameDate(o,u())&&"rbc-now")})},n.renderDummy=function(){var o=n.props,l=o.className,c=o.range,d=o.renderHeader,u=o.showAllEvents;return se.createElement("div",{className:l,ref:n.containerRef},se.createElement("div",{className:Zn("rbc-row-content",u&&"rbc-row-content-scrollable")},d&&se.createElement("div",{className:"rbc-row",ref:n.headingRowRef},c.map(n.renderHeadingCell)),se.createElement("div",{className:"rbc-row",ref:n.eventRowRef},se.createElement("div",{className:"rbc-row-segment"},se.createElement("div",{className:"rbc-event"},se.createElement("div",{className:"rbc-event-content"}," "))))))},n.containerRef=y.createRef(),n.headingRowRef=y.createRef(),n.eventRowRef=y.createRef(),n.slotMetrics=_Rt(),n}return iu(e,t),kc(e,[{key:"getRowLimit",value:function(){var r,s=hue(this.eventRowRef.current),i=(r=this.headingRowRef)!==null&&r!==void 0&&r.current?hue(this.headingRowRef.current):0,o=hue(this.containerRef.current)-i;return Math.max(Math.floor(o/s),1)}},{key:"render",value:function(){var r=this.props,s=r.date,i=r.rtl,o=r.range,l=r.className,c=r.selected,d=r.selectable,u=r.renderForMeasure,h=r.accessors,m=r.getters,f=r.components,p=r.getNow,g=r.renderHeader,v=r.onSelect,b=r.localizer,x=r.onSelectStart,w=r.onSelectEnd,k=r.onDoubleClick,S=r.onKeyPress,C=r.resourceId,j=r.longPressThreshold,E=r.isAllDay,N=r.resizable,A=r.showAllEvents;if(u)return this.renderDummy();var _=this.slotMetrics(this.props),T=_.levels,R=_.extra,O=A?LLr:Mv,F=f.weekWrapper,D={selected:c,accessors:h,getters:m,localizer:b,components:f,onSelect:v,onDoubleClick:k,onKeyPress:S,resourceId:C,slotMetrics:_,resizable:N};return se.createElement("div",{className:l,role:"rowgroup",ref:this.containerRef},se.createElement(jRt,{localizer:b,date:s,getNow:p,rtl:i,range:o,selectable:d,container:this.getContainer,getters:m,onSelectStart:x,onSelectEnd:w,onSelectSlot:this.handleSelectSlot,components:f,longPressThreshold:j,resourceId:C}),se.createElement("div",{className:Zn("rbc-row-content",A&&"rbc-row-content-scrollable"),role:"row"},g&&se.createElement("div",{className:"rbc-row ",ref:this.headingRowRef},o.map(this.renderHeadingCell)),se.createElement(O,null,se.createElement(F,Ts({isAllDay:E},D,{rtl:this.props.rtl}),T.map(function(I,P){return se.createElement(fRe,Ts({key:P,segments:I},D))}),!!R.length&&se.createElement(pRe,Ts({segments:R,onShowMore:this.handleShowMore},D))))))}}])}(se.Component);o5.propTypes={};o5.defaultProps={minRows:0,maxRows:1/0};var tie=function(e){var n=e.label;return se.createElement("span",{role:"columnheader","aria-sort":"none"},n)};tie.propTypes={};var PRt=function(e){var n=e.label,r=e.drilldownView,s=e.onDrillDown;return r?se.createElement("button",{type:"button",className:"rbc-button-link",onClick:s},n):se.createElement("span",null,n)};PRt.propTypes={};var FLr=["date","className"];function BLr(t,e,n){return e=ci(e),su(t,RRt()?Reflect.construct(e,n||[],ci(t).constructor):e.apply(t,n))}function RRt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(RRt=function(){return!!t})()}var ULr=function(e,n,r,s,i){return e.filter(function(o){return kF(o,n,r,s,i)})},m9=function(t){function e(){var n;wc(this,e);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=BLr(this,e,[].concat(s)),n.getContainer=function(){return n.containerRef.current},n.renderWeek=function(o,l){var c=n.props,d=c.events,u=c.components,h=c.selectable,m=c.getNow,f=c.selected,p=c.date,g=c.localizer,v=c.longPressThreshold,b=c.accessors,x=c.getters,w=c.showAllEvents,k=n.state,S=k.needLimitMeasure,C=k.rowLimit,j=ULr(xq(d),o[0],o[o.length-1],b,g),E=RLr(j,b,g);return se.createElement(o5,{key:l,ref:l===0?n.slotRowRef:void 0,container:n.getContainer,className:"rbc-month-row",getNow:m,date:p,range:o,events:E,maxRows:w?1/0:C,selected:f,selectable:h,components:u,accessors:b,getters:x,localizer:g,renderHeader:n.readerDateHeading,renderForMeasure:S,onShowMore:n.handleShowMore,onSelect:n.handleSelectEvent,onDoubleClick:n.handleDoubleClickEvent,onKeyPress:n.handleKeyPressEvent,onSelectSlot:n.handleSelectSlot,longPressThreshold:v,rtl:n.props.rtl,resizable:n.props.resizable,showAllEvents:w})},n.readerDateHeading=function(o){var l=o.date,c=o.className,d=Oy(o,FLr),u=n.props,h=u.date,m=u.getDrilldownView,f=u.localizer,p=f.neq(h,l,"month"),g=f.isSameDate(l,h),v=m(l),b=f.format(l,"dateFormat"),x=n.props.components.dateHeader||PRt;return se.createElement("div",Ts({},d,{className:Zn(c,p&&"rbc-off-range",g&&"rbc-current"),role:"cell"}),se.createElement(x,{label:b,date:l,drilldownView:v,isOffRange:p,onDrillDown:function(k){return n.handleHeadingClick(l,v,k)}}))},n.handleSelectSlot=function(o,l){n._pendingSelection=n._pendingSelection.concat(o),clearTimeout(n._selectTimer),n._selectTimer=setTimeout(function(){return n.selectDates(l)})},n.handleHeadingClick=function(o,l,c){c.preventDefault(),n.clearSelection(),Ja(n.props.onDrillDown,[o,l])},n.handleSelectEvent=function(){n.clearSelection();for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];Ja(n.props.onSelectEvent,l)},n.handleDoubleClickEvent=function(){n.clearSelection();for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];Ja(n.props.onDoubleClickEvent,l)},n.handleKeyPressEvent=function(){n.clearSelection();for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];Ja(n.props.onKeyPressEvent,l)},n.handleShowMore=function(o,l,c,d,u){var h=n.props,m=h.popup,f=h.onDrillDown,p=h.onShowMore,g=h.getDrilldownView,v=h.doShowMoreDrillDown;if(n.clearSelection(),m){var b=hPt(c,n.containerRef.current);n.setState({overlay:{date:l,events:o,position:b,target:u}})}else v&&Ja(f,[l,g(l)||wu.DAY]);Ja(p,[o,l,d])},n.overlayDisplay=function(){n.setState({overlay:null})},n.state={rowLimit:5,needLimitMeasure:!0,date:null},n.containerRef=y.createRef(),n.slotRowRef=y.createRef(),n._bgRows=[],n._pendingSelection=[],n}return iu(e,t),kc(e,[{key:"componentDidMount",value:function(){var r=this,s;this.state.needLimitMeasure&&this.measureRowLimit(this.props),window.addEventListener("resize",this._resizeListener=function(){s||mPt(function(){s=!1,r.setState({needLimitMeasure:!0})})},!1)}},{key:"componentDidUpdate",value:function(){this.state.needLimitMeasure&&this.measureRowLimit(this.props)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this._resizeListener,!1)}},{key:"render",value:function(){var r=this.props,s=r.date,i=r.localizer,o=r.className,l=i.visibleDays(s,i),c=k1r(l,7);return this._weekCount=c.length,se.createElement("div",{className:Zn("rbc-month-view",o),role:"table","aria-label":"Month View",ref:this.containerRef},se.createElement("div",{className:"rbc-row rbc-month-header",role:"row"},this.renderHeaders(c[0])),c.map(this.renderWeek),this.props.popup&&this.renderOverlay())}},{key:"renderHeaders",value:function(r){var s=this.props,i=s.localizer,o=s.components,l=r[0],c=r[r.length-1],d=o.header||tie;return i.range(l,c,"day").map(function(u,h){return se.createElement("div",{key:"header_"+h,className:"rbc-header"},se.createElement(d,{date:u,localizer:i,label:i.format(u,"weekdayFormat")}))})}},{key:"renderOverlay",value:function(){var r,s,i=this,o=(r=(s=this.state)===null||s===void 0?void 0:s.overlay)!==null&&r!==void 0?r:{},l=this.props,c=l.accessors,d=l.localizer,u=l.components,h=l.getters,m=l.selected,f=l.popupOffset,p=l.handleDragStart,g=function(){return i.setState({overlay:null})};return se.createElement(mRe,{overlay:o,accessors:c,localizer:d,components:u,getters:h,selected:m,popupOffset:f,ref:this.containerRef,handleKeyPressEvent:this.handleKeyPressEvent,handleSelectEvent:this.handleSelectEvent,handleDoubleClickEvent:this.handleDoubleClickEvent,handleDragStart:p,show:!!o.position,overlayDisplay:this.overlayDisplay,onHide:g})}},{key:"measureRowLimit",value:function(){this.setState({needLimitMeasure:!1,rowLimit:this.slotRowRef.current.getRowLimit()})}},{key:"selectDates",value:function(r){var s=this._pendingSelection.slice();this._pendingSelection=[],s.sort(function(l,c){return+l-+c});var i=new Date(s[0]),o=new Date(s[s.length-1]);o.setDate(s[s.length-1].getDate()+1),Ja(this.props.onSelectSlot,{slots:s,start:i,end:o,action:r.action,bounds:r.bounds,box:r.box})}},{key:"clearSelection",value:function(){clearTimeout(this._selectTimer),this._pendingSelection=[]}}],[{key:"getDerivedStateFromProps",value:function(r,s){var i=r.date,o=r.localizer;return{date:i,needLimitMeasure:s.needLimitMeasure||o.neq(i,s.date,"month")}}}])}(se.Component);m9.propTypes={};m9.range=function(t,e){var n=e.localizer,r=n.firstVisibleDay(t,n),s=n.lastVisibleDay(t,n);return{start:r,end:s}};m9.navigate=function(t,e,n){var r=n.localizer;switch(e){case kh.PREVIOUS:return r.add(t,-1,"month");case kh.NEXT:return r.add(t,1,"month");default:return t}};m9.title=function(t,e){var n=e.localizer;return n.format(t,"monthHeaderFormat")};var _We=function(e){var n=e.min,r=e.max,s=e.step,i=e.slots,o=e.localizer;return"".concat(+o.startOf(n,"minutes"))+"".concat(+o.startOf(r,"minutes"))+"".concat(s,"-").concat(i)};function gRe(t){for(var e=t.min,n=t.max,r=t.step,s=t.timeslots,i=t.localizer,o=_We({step:r,localizer:i}),l=1+i.getTotalMin(e,n),c=i.getMinutesFromMidnight(e),d=Math.ceil((l-1)/(r*s)),u=d*s,h=new Array(d),m=new Array(u),f=0;f<d;f++){h[f]=new Array(s);for(var p=0;p<s;p++){var g=f*s+p,v=g*r;m[g]=h[f][p]=i.getSlotDate(e,c,v)}}var b=m.length*r;m.push(i.getSlotDate(e,c,b));function x(w){var k=i.diff(e,w,"minutes")+i.getDstOffset(e,w);return Math.min(k,l)}return{groups:h,update:function(k){return _We(k)!==o?gRe(k):this},dateIsInGroup:function(k,S){var C=h[S+1];return i.inRange(k,h[S][0],C?C[0]:n,"minutes")},nextSlot:function(k){var S=m[Math.min(m.findIndex(function(C){return C===k||i.eq(C,k)})+1,m.length-1)];return i.eq(S,k)&&(S=i.add(k,r,"minutes")),S},closestSlotToPosition:function(k){var S=Math.min(m.length-1,Math.max(0,Math.floor(k*u)));return m[S]},closestSlotFromPoint:function(k,S){var C=Math.abs(S.top-S.bottom);return this.closestSlotToPosition((k.y-S.top)/C)},closestSlotFromDate:function(k){var S=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;if(i.lt(k,e,"minutes"))return m[0];if(i.gt(k,n,"minutes"))return m[m.length-1];var C=i.diff(e,k,"minutes");return m[(C-C%r)/r+S]},startsBeforeDay:function(k){return i.lt(k,e,"day")},startsAfterDay:function(k){return i.gt(k,n,"day")},startsBefore:function(k){return i.lt(i.merge(e,k),e,"minutes")},startsAfter:function(k){return i.gt(i.merge(n,k),n,"minutes")},getRange:function(k,S,C,j){C||(k=i.min(n,i.max(e,k))),j||(S=i.min(n,i.max(e,S)));var E=x(k),N=x(S),A=N>r*u&&!i.eq(n,S)?(E-r)/(r*u)*100:E/(r*u)*100;return{top:A,height:N/(r*u)*100-A,start:x(k),startDate:k,end:x(S),endDate:S}},getCurrentTimePosition:function(k){var S=x(k),C=S/(r*u)*100;return C}}}var zLr=function(){function t(e,n){var r=n.accessors,s=n.slotMetrics;wc(this,t);var i=s.getRange(r.start(e),r.end(e)),o=i.start,l=i.startDate,c=i.end,d=i.endDate,u=i.top,h=i.height;this.start=o,this.end=c,this.startMs=+l,this.endMs=+d,this.top=u,this.height=h,this.data=e}return kc(t,[{key:"_width",get:function(){if(this.rows){var n=this.rows.reduce(function(s,i){return Math.max(s,i.leaves.length+1)},0)+1;return 100/n}if(this.leaves){var r=100-this.container._width;return r/(this.leaves.length+1)}return this.row._width}},{key:"width",get:function(){var n=this._width,r=Math.min(100,this._width*1.7);if(this.rows)return r;if(this.leaves)return this.leaves.length>0?r:n;var s=this.row.leaves,i=s.indexOf(this);return i===s.length-1?n:r}},{key:"xOffset",get:function(){if(this.rows)return 0;if(this.leaves)return this.container._width;var n=this.row,r=n.leaves,s=n.xOffset,i=n._width,o=r.indexOf(this)+1;return s+o*i}}])}();function VLr(t,e,n){return Math.abs(e.start-t.start)<n||e.start>t.start&&e.start<t.end}function HLr(t){for(var e=Zse(t,["startMs",function(l){return-l.endMs}]),n=[];e.length>0;){var r=e.shift();n.push(r);for(var s=0;s<e.length;s++){var i=e[s];if(!(r.endMs>i.startMs)){if(s>0){var o=e.splice(s,1)[0];n.push(o)}break}}}return n}function IRt(t){for(var e=t.events,n=t.minimumStartDifference,r=t.slotMetrics,s=t.accessors,i=e.map(function(u){return new zLr(u,{slotMetrics:r,accessors:s})}),o=HLr(i),l=[],c=function(){var h=o[d],m=l.find(function(g){return g.end>h.start||Math.abs(h.start-g.start)<n});if(!m)return h.rows=[],l.push(h),1;h.container=m;for(var f=null,p=m.rows.length-1;!f&&p>=0;p--)VLr(m.rows[p],h,n)&&(f=m.rows[p]);f?(f.leaves.push(h),h.row=f):(h.leaves=[],m.rows.push(h))},d=0;d<o.length;d++)c();return o.map(function(u){return{event:u.data,style:{top:u.top,height:u.height,width:u.width,xOffset:Math.max(0,u.xOffset)}}})}function MRt(t,e,n){for(var r=0;r<t.friends.length;++r)if(!(n.indexOf(t.friends[r])>-1)){e=e>t.friends[r].idx?e:t.friends[r].idx,n.push(t.friends[r]);var s=MRt(t.friends[r],e,n);e=e>s?e:s}return e}function GLr(t){var e=t.events,n=t.minimumStartDifference,r=t.slotMetrics,s=t.accessors,i=IRt({events:e,minimumStartDifference:n,slotMetrics:r,accessors:s});i.sort(function(F,D){return F=F.style,D=D.style,F.top!==D.top?F.top>D.top?1:-1:F.height!==D.height?F.top+F.height<D.top+D.height?1:-1:0});for(var o=0;o<i.length;++o)i[o].friends=[],delete i[o].style.left,delete i[o].style.left,delete i[o].idx,delete i[o].size;for(var l=0;l<i.length-1;++l)for(var c=i[l],d=c.style.top,u=c.style.top+c.style.height,h=l+1;h<i.length;++h){var m=i[h],f=m.style.top,p=m.style.top+m.style.height;(f>=d&&p<=u||p>d&&p<=u||f>=d&&f<u)&&(c.friends.push(m),m.friends.push(c))}for(var g=0;g<i.length;++g){for(var v=i[g],b=[],x=0;x<100;++x)b.push(1);for(var w=0;w<v.friends.length;++w)v.friends[w].idx!==void 0&&(b[v.friends[w].idx]=0);v.idx=b.indexOf(1)}for(var k=0;k<i.length;++k){var S=0;if(!i[k].size){var C=[],j=MRt(i[k],0,C);S=100/(j+1),i[k].size=S;for(var E=0;E<C.length;++E)C[E].size=S}}for(var N=0;N<i.length;++N){var A=i[N];A.style.left=A.idx*A.size;for(var _=0,T=0;T<A.friends.length;++T){var R=A.friends[T].idx;_=_>R?_:R}_<=A.idx&&(A.size=100-A.idx*A.size);var O=A.idx===0?0:3;A.style.width="calc(".concat(A.size,"% - ").concat(O,"px)"),A.style.height="calc(".concat(A.style.height,"% - 2px)"),A.style.xOffset="calc(".concat(A.style.left,"% + ").concat(O,"px)")}return i}var AWe={overlap:IRt,"no-overlap":GLr};function WLr(t){return!!(t&&t.constructor&&t.call&&t.apply)}function qLr(t){t.events,t.minimumStartDifference,t.slotMetrics,t.accessors;var e=t.dayLayoutAlgorithm,n=e;return e in AWe&&(n=AWe[e]),WLr(n)?n.apply(this,arguments):[]}function KLr(t,e,n){return e=ci(e),su(t,LRt()?Reflect.construct(e,n||[],ci(t).constructor):e.apply(t,n))}function LRt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(LRt=function(){return!!t})()}var vRe=function(t){function e(){return wc(this,e),KLr(this,e,arguments)}return iu(e,t),kc(e,[{key:"render",value:function(){var r=this.props,s=r.renderSlot,i=r.resource,o=r.group,l=r.getters,c=r.components,d=c===void 0?{}:c,u=d.timeSlotWrapper,h=u===void 0?Mv:u,m=l?l.slotGroupProp(o):{};return se.createElement("div",Ts({className:"rbc-timeslot-group"},m),o.map(function(f,p){var g=l?l.slotProp(f,i):{};return se.createElement(h,{key:p,value:f,resource:i},se.createElement("div",Ts({},g,{className:Zn("rbc-time-slot",g.className)}),s&&s(f,p)))}))}}])}(y.Component);vRe.propTypes={};function PWe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function RWe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?PWe(Object(n),!0).forEach(function(r){fd(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):PWe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function KV(t){return typeof t=="string"?t:t+"%"}function YLr(t){var e=t.style,n=t.className,r=t.event,s=t.accessors,i=t.rtl,o=t.selected,l=t.label,c=t.continuesPrior,d=t.continuesAfter,u=t.getters,h=t.onClick,m=t.onDoubleClick,f=t.isBackgroundEvent,p=t.onKeyPress,g=t.components,v=g.event,b=g.eventWrapper,x=s.title(r),w=s.tooltip(r),k=s.end(r),S=s.start(r),C=u.eventProp(r,S,k,o),j=[se.createElement("div",{key:"1",className:"rbc-event-label"},l),se.createElement("div",{key:"2",className:"rbc-event-content"},v?se.createElement(v,{event:r,title:x}):x)],E=e.height,N=e.top,A=e.width,_=e.xOffset,T=RWe(RWe({},C.style),{},fd({top:KV(N),height:KV(E),width:KV(A)},i?"right":"left",KV(_)));return se.createElement(b,Ts({type:"time"},t),se.createElement("div",{role:"button",tabIndex:0,onClick:h,onDoubleClick:m,style:T,onKeyDown:p,title:w?(typeof l=="string"?l+": ":"")+w:void 0,className:Zn(f?"rbc-background-event":"rbc-event",n,C.className,{"rbc-selected":o,"rbc-event-continues-earlier":c,"rbc-event-continues-later":d})},j))}var QLr=function(e){var n=e.children,r=e.className,s=e.style,i=e.innerRef;return se.createElement("div",{className:r,style:s,ref:i},n)},ZLr=se.forwardRef(function(t,e){return se.createElement(QLr,Ts({},t,{innerRef:e}))}),JLr=["dayProp"],XLr=["eventContainerWrapper","timeIndicatorWrapper"];function IWe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function lC(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?IWe(Object(n),!0).forEach(function(r){fd(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):IWe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function e3r(t,e,n){return e=ci(e),su(t,DRt()?Reflect.construct(e,n||[],ci(t).constructor):e.apply(t,n))}function DRt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(DRt=function(){return!!t})()}var yRe=function(t){function e(){var n;wc(this,e);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=e3r(this,e,[].concat(s)),n.state={selecting:!1,timeIndicatorPosition:null},n.intervalTriggered=!1,n.renderEvents=function(o){var l=o.events,c=o.isBackgroundEvent,d=n.props,u=d.rtl,h=d.selected,m=d.accessors,f=d.localizer,p=d.getters,g=d.components,v=d.step,b=d.timeslots,x=d.dayLayoutAlgorithm,w=d.resizable,k=n,S=k.slotMetrics,C=f.messages,j=qLr({events:l,accessors:m,slotMetrics:S,minimumStartDifference:Math.ceil(v*b/2),dayLayoutAlgorithm:x});return j.map(function(E,N){var A,_=E.event,T=E.style,R=m.end(_),O=m.start(_),F=(A=m.eventId(_))!==null&&A!==void 0?A:"evt_"+N,D="eventTimeRangeFormat",I,P=S.startsBeforeDay(O),M=S.startsAfterDay(R);P?D="eventTimeRangeEndFormat":M&&(D="eventTimeRangeStartFormat"),P&&M?I=C.allDay:I=f.format({start:O,end:R},D);var z=P||S.startsBefore(O),G=M||S.startsAfter(R);return se.createElement(YLr,{style:T,event:_,label:I,key:F,getters:p,rtl:u,components:g,continuesPrior:z,continuesAfter:G,accessors:m,resource:n.props.resource,selected:eie(_,h),onClick:function(H){return n._select(lC(lC(lC({},_),n.props.resource&&{sourceResource:n.props.resource}),c&&{isBackgroundEvent:!0}),H)},onDoubleClick:function(H){return n._doubleClick(_,H)},isBackgroundEvent:c,onKeyPress:function(H){return n._keyPress(_,H)},resizable:w})})},n._selectable=function(){var o=n.containerRef.current,l=n.props,c=l.longPressThreshold,d=l.localizer,u=n._selector=new SRt(function(){return o},{longPressThreshold:c}),h=function(g){var v=n.props.onSelecting,b=n.state||{},x=m(g),w=x.startDate,k=x.endDate;v&&(d.eq(b.startDate,w,"minutes")&&d.eq(b.endDate,k,"minutes")||v({start:w,end:k,resourceId:n.props.resource})===!1)||(n.state.start!==x.start||n.state.end!==x.end||n.state.selecting!==x.selecting)&&n.setState(x)},m=function(g){var v=n.slotMetrics.closestSlotFromPoint(g,rE(o));n.state.selecting||(n._initialSlot=v);var b=n._initialSlot;d.lte(b,v)?v=n.slotMetrics.nextSlot(v):d.gt(b,v)&&(b=n.slotMetrics.nextSlot(b));var x=n.slotMetrics.getRange(d.min(b,v),d.max(b,v));return lC(lC({},x),{},{selecting:!0,top:"".concat(x.top,"%"),height:"".concat(x.height,"%")})},f=function(g,v){if(!hJ(n.containerRef.current,g)){var b=m(g),x=b.startDate,w=b.endDate;n._selectSlot({startDate:x,endDate:w,action:v,box:g})}n.setState({selecting:!1})};u.on("selecting",h),u.on("selectStart",h),u.on("beforeSelect",function(p){if(n.props.selectable==="ignoreEvents")return!hJ(n.containerRef.current,p)}),u.on("click",function(p){return f(p,"click")}),u.on("doubleClick",function(p){return f(p,"doubleClick")}),u.on("select",function(p){n.state.selecting&&(n._selectSlot(lC(lC({},n.state),{},{action:"select",bounds:p})),n.setState({selecting:!1}))}),u.on("reset",function(){n.state.selecting&&n.setState({selecting:!1})})},n._teardownSelectable=function(){n._selector&&(n._selector.teardown(),n._selector=null)},n._selectSlot=function(o){for(var l=o.startDate,c=o.endDate,d=o.action,u=o.bounds,h=o.box,m=l,f=[];n.props.localizer.lte(m,c);)f.push(m),m=new Date(+m+n.props.step*60*1e3);Ja(n.props.onSelectSlot,{slots:f,start:l,end:c,resourceId:n.props.resource,action:d,bounds:u,box:h})},n._select=function(){for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];Ja(n.props.onSelectEvent,l)},n._doubleClick=function(){for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];Ja(n.props.onDoubleClickEvent,l)},n._keyPress=function(){for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];Ja(n.props.onKeyPressEvent,l)},n.slotMetrics=gRe(n.props),n.containerRef=y.createRef(),n}return iu(e,t),kc(e,[{key:"componentDidMount",value:function(){this.props.selectable&&this._selectable(),this.props.isNow&&this.setTimeIndicatorPositionUpdateInterval()}},{key:"componentWillUnmount",value:function(){this._teardownSelectable(),this.clearTimeIndicatorInterval()}},{key:"componentDidUpdate",value:function(r,s){this.props.selectable&&!r.selectable&&this._selectable(),!this.props.selectable&&r.selectable&&this._teardownSelectable();var i=this.props,o=i.getNow,l=i.isNow,c=i.localizer,d=i.date,u=i.min,h=i.max,m=c.neq(r.getNow(),o(),"minutes");if(r.isNow!==l||m){if(this.clearTimeIndicatorInterval(),l){var f=!m&&c.eq(r.date,d,"minutes")&&s.timeIndicatorPosition===this.state.timeIndicatorPosition;this.setTimeIndicatorPositionUpdateInterval(f)}}else l&&(c.neq(r.min,u,"minutes")||c.neq(r.max,h,"minutes"))&&this.positionTimeIndicator()}},{key:"setTimeIndicatorPositionUpdateInterval",value:function(){var r=this,s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;!this.intervalTriggered&&!s&&this.positionTimeIndicator(),this._timeIndicatorTimeout=window.setTimeout(function(){r.intervalTriggered=!0,r.positionTimeIndicator(),r.setTimeIndicatorPositionUpdateInterval()},6e4)}},{key:"clearTimeIndicatorInterval",value:function(){this.intervalTriggered=!1,window.clearTimeout(this._timeIndicatorTimeout)}},{key:"positionTimeIndicator",value:function(){var r=this.props,s=r.min,i=r.max,o=r.getNow,l=o();if(l>=s&&l<=i){var c=this.slotMetrics.getCurrentTimePosition(l);this.intervalTriggered=!0,this.setState({timeIndicatorPosition:c})}else this.clearTimeIndicatorInterval()}},{key:"render",value:function(){var r=this.props,s=r.date,i=r.max,o=r.rtl,l=r.isNow,c=r.resource,d=r.accessors,u=r.localizer,h=r.getters,m=h.dayProp,f=Oy(h,JLr),p=r.components,g=p.eventContainerWrapper,v=p.timeIndicatorWrapper,b=Oy(p,XLr);this.slotMetrics=this.slotMetrics.update(this.props);var x=this.slotMetrics,w=this.state,k=w.selecting,S=w.top,C=w.height,j=w.startDate,E=w.endDate,N={start:j,end:E},A=m(i,c),_=A.className,T=A.style,R={className:"rbc-current-time-indicator",style:{top:"".concat(this.state.timeIndicatorPosition,"%")}},O=b.dayColumnWrapper||ZLr;return se.createElement(O,{ref:this.containerRef,date:s,style:T,className:Zn(_,"rbc-day-slot","rbc-time-column",l&&"rbc-now",l&&"rbc-today",k&&"rbc-slot-selecting"),slotMetrics:x,resource:c},x.groups.map(function(F,D){return se.createElement(vRe,{key:D,group:F,resource:c,getters:f,components:b})}),se.createElement(g,{localizer:u,resource:c,accessors:d,getters:f,components:b,slotMetrics:x},se.createElement("div",{className:Zn("rbc-events-container",o&&"rtl")},this.renderEvents({events:this.props.backgroundEvents,isBackgroundEvent:!0}),this.renderEvents({events:this.props.events}))),k&&se.createElement("div",{className:"rbc-slot-selection",style:{top:S,height:C}},se.createElement("span",null,u.format(N,"selectRangeFormat"))),l&&this.intervalTriggered&&se.createElement(v,R,se.createElement("div",R)))}}])}(se.Component);yRe.propTypes={};yRe.defaultProps={dragThroughEvents:!0,timeslots:2};var bRe=function(e){var n=e.label;return se.createElement(se.Fragment,null,n)};bRe.propTypes={};function t3r(t,e,n){return e=ci(e),su(t,$Rt()?Reflect.construct(e,n||[],ci(t).constructor):e.apply(t,n))}function $Rt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return($Rt=function(){return!!t})()}var ORt=function(t){function e(){var n;wc(this,e);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=t3r(this,e,[].concat(s)),n.handleHeaderClick=function(o,l,c){c.preventDefault(),Ja(n.props.onDrillDown,[o,l])},n.renderRow=function(o){var l=n.props,c=l.events,d=l.rtl,u=l.selectable,h=l.getNow,m=l.range,f=l.getters,p=l.localizer,g=l.accessors,v=l.components,b=l.resizable,x=g.resourceId(o),w=o?c.filter(function(k){return g.resource(k)===x}):c;return se.createElement(o5,{isAllDay:!0,rtl:d,getNow:h,minRows:2,maxRows:n.props.allDayMaxRows+1,range:m,events:w,resourceId:x,className:"rbc-allday-cell",selectable:u,selected:n.props.selected,components:v,accessors:g,getters:f,localizer:p,onSelect:n.props.onSelectEvent,onShowMore:n.props.onShowMore,onDoubleClick:n.props.onDoubleClickEvent,onKeyPress:n.props.onKeyPressEvent,onSelectSlot:n.props.onSelectSlot,longPressThreshold:n.props.longPressThreshold,resizable:b})},n}return iu(e,t),kc(e,[{key:"renderHeaderCells",value:function(r){var s=this,i=this.props,o=i.localizer,l=i.getDrilldownView,c=i.getNow,d=i.getters.dayProp,u=i.components.header,h=u===void 0?tie:u,m=c();return r.map(function(f,p){var g=l(f),v=o.format(f,"dayFormat"),b=d(f),x=b.className,w=b.style,k=se.createElement(h,{date:f,label:v,localizer:o});return se.createElement("div",{key:p,style:w,className:Zn("rbc-header",x,o.isSameDate(f,m)&&"rbc-today")},g?se.createElement("button",{type:"button",className:"rbc-button-link",onClick:function(C){return s.handleHeaderClick(f,g,C)}},k):se.createElement("span",null,k))})}},{key:"render",value:function(){var r=this,s=this.props,i=s.width,o=s.rtl,l=s.resources,c=s.range,d=s.events,u=s.getNow,h=s.accessors,m=s.selectable,f=s.components,p=s.getters,g=s.scrollRef,v=s.localizer,b=s.isOverflowing,x=s.components,w=x.timeGutterHeader,k=x.resourceHeader,S=k===void 0?bRe:k,C=s.resizable,j={};b&&(j[o?"marginLeft":"marginRight"]="".concat(oRe()-1,"px"));var E=l.groupEvents(d);return se.createElement("div",{style:j,ref:g,className:Zn("rbc-time-header",b&&"rbc-overflowing")},se.createElement("div",{className:"rbc-label rbc-time-header-gutter",style:{width:i,minWidth:i,maxWidth:i}},w&&se.createElement(w,null)),l.map(function(N,A){var _=Q2(N,2),T=_[0],R=_[1];return se.createElement("div",{className:"rbc-time-header-content",key:T||A},R&&se.createElement("div",{className:"rbc-row rbc-row-resource",key:"resource_".concat(A)},se.createElement("div",{className:"rbc-header"},se.createElement(S,{index:A,label:h.resourceTitle(R),resource:R}))),se.createElement("div",{className:"rbc-row rbc-time-header-cell".concat(c.length<=1?" rbc-time-header-cell-single-day":"")},r.renderHeaderCells(c)),se.createElement(o5,{isAllDay:!0,rtl:o,getNow:u,minRows:2,maxRows:r.props.allDayMaxRows+1,range:c,events:E.get(T)||[],resourceId:R&&T,className:"rbc-allday-cell",selectable:m,selected:r.props.selected,components:f,accessors:h,getters:p,localizer:v,onSelect:r.props.onSelectEvent,onShowMore:r.props.onShowMore,onDoubleClick:r.props.onDoubleClickEvent,onKeyDown:r.props.onKeyPressEvent,onSelectSlot:r.props.onSelectSlot,longPressThreshold:r.props.longPressThreshold,resizable:C}))}))}}])}(se.Component);ORt.propTypes={};function n3r(t,e,n){return e=ci(e),su(t,FRt()?Reflect.construct(e,n||[],ci(t).constructor):e.apply(t,n))}function FRt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(FRt=function(){return!!t})()}var BRt=function(t){function e(){var n;wc(this,e);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=n3r(this,e,[].concat(s)),n.handleHeaderClick=function(o,l,c){c.preventDefault(),Ja(n.props.onDrillDown,[o,l])},n}return iu(e,t),kc(e,[{key:"renderHeaderCells",value:function(r){var s=this,i=this.props,o=i.localizer,l=i.getDrilldownView,c=i.getNow,d=i.getters.dayProp,u=i.components,h=u.header,m=h===void 0?tie:h,f=u.resourceHeader,p=f===void 0?bRe:f,g=i.resources,v=i.accessors,b=i.events,x=i.rtl,w=i.selectable,k=i.components,S=i.getters,C=i.resizable,j=c(),E=g.groupEvents(b);return r.map(function(N,A){var _=l(N),T=o.format(N,"dayFormat"),R=d(N),O=R.className,F=R.style,D=se.createElement(m,{date:N,label:T,localizer:o});return se.createElement("div",{key:A,className:"rbc-time-header-content rbc-resource-grouping"},se.createElement("div",{className:"rbc-row rbc-time-header-cell".concat(r.length<=1?" rbc-time-header-cell-single-day":"")},se.createElement("div",{style:F,className:Zn("rbc-header",O,o.isSameDate(N,j)&&"rbc-today")},_?se.createElement("button",{type:"button",className:"rbc-button-link",onClick:function(P){return s.handleHeaderClick(N,_,P)}},D):se.createElement("span",null,D))),se.createElement("div",{className:"rbc-row"},g.map(function(I,P){var M=Q2(I,2),z=M[0],G=M[1];return se.createElement("div",{key:"resource_".concat(z,"_").concat(P),className:Zn("rbc-header",O,o.isSameDate(N,j)&&"rbc-today")},se.createElement(p,{index:P,label:v.resourceTitle(G),resource:G}))})),se.createElement("div",{className:"rbc-row rbc-m-b-negative-3 rbc-h-full"},g.map(function(I,P){var M=Q2(I,2),z=M[0],G=M[1],B=(E.get(z)||[]).filter(function(H){return o.isSameDate(H.start,N)||o.isSameDate(H.end,N)});return se.createElement(o5,{key:"resource_".concat(z,"_").concat(P),isAllDay:!0,rtl:x,getNow:c,minRows:2,maxRows:s.props.allDayMaxRows+1,range:[N],events:B,resourceId:G&&z,className:"rbc-allday-cell",selectable:w,selected:s.props.selected,components:k,accessors:v,getters:S,localizer:o,onSelect:s.props.onSelectEvent,onShowMore:s.props.onShowMore,onDoubleClick:s.props.onDoubleClickEvent,onKeyDown:s.props.onKeyPressEvent,onSelectSlot:s.props.onSelectSlot,longPressThreshold:s.props.longPressThreshold,resizable:C})})))})}},{key:"render",value:function(){var r=this.props,s=r.width,i=r.rtl,o=r.range,l=r.scrollRef,c=r.isOverflowing,d=r.components.timeGutterHeader,u={};return c&&(u[i?"marginLeft":"marginRight"]="".concat(oRe()-1,"px")),se.createElement("div",{style:u,ref:l,className:Zn("rbc-time-header",c&&"rbc-overflowing")},se.createElement("div",{className:"rbc-label rbc-time-header-gutter",style:{width:s,minWidth:s,maxWidth:s}},d&&se.createElement(d,null)),this.renderHeaderCells(o))}}])}(se.Component);BRt.propTypes={};function r3r(t){var e=t.min,n=t.max,r=t.localizer;return r.getTimezoneOffset(e)!==r.getTimezoneOffset(n)?{start:r.add(e,-1,"day"),end:r.add(n,-1,"day")}:{start:e,end:n}}var URt=function(e){var n=e.min,r=e.max,s=e.timeslots,i=e.step,o=e.localizer,l=e.getNow,c=e.resource,d=e.components,u=e.getters,h=e.gutterRef,m=d.timeGutterWrapper,f=y.useMemo(function(){return r3r({min:n,max:r,localizer:o})},[n==null?void 0:n.toISOString(),r==null?void 0:r.toISOString(),o]),p=f.start,g=f.end,v=y.useState(gRe({min:p,max:g,timeslots:s,step:i,localizer:o})),b=Q2(v,2),x=b[0],w=b[1];y.useEffect(function(){x&&w(x.update({min:p,max:g,timeslots:s,step:i,localizer:o}))},[p==null?void 0:p.toISOString(),g==null?void 0:g.toISOString(),s,i]);var k=y.useCallback(function(S,C){if(C)return null;var j=x.dateIsInGroup(l(),C);return se.createElement("span",{className:Zn("rbc-label",j&&"rbc-now")},o.format(S,"timeGutterFormat"))},[x,o,l]);return se.createElement(m,{slotMetrics:x},se.createElement("div",{className:"rbc-time-gutter rbc-time-column",ref:h},x.groups.map(function(S,C){return se.createElement(vRe,{key:C,group:S,resource:c,components:d,renderSlot:k,getters:u})})))};URt.propTypes={};var s3r=se.forwardRef(function(t,e){return se.createElement(URt,Ts({gutterRef:e},t))}),vue={};function i3r(t,e){return{map:function(r){return t?t.map(function(s,i){return r([e.resourceId(s),s],i)}):[r([vue,null],0)]},groupEvents:function(r){var s=new Map;return t?(r.forEach(function(i){var o=e.resource(i)||vue;if(Array.isArray(o))o.forEach(function(c){var d=s.get(c)||[];d.push(i),s.set(c,d)});else{var l=s.get(o)||[];l.push(i),s.set(o,l)}}),s):(s.set(vue,r),s)}}}function MWe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function LWe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?MWe(Object(n),!0).forEach(function(r){fd(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):MWe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function a3r(t,e,n){return e=ci(e),su(t,zRt()?Reflect.construct(e,n||[],ci(t).constructor):e.apply(t,n))}function zRt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(zRt=function(){return!!t})()}var _N=function(t){function e(n){var r;return wc(this,e),r=a3r(this,e,[n]),r.handleScroll=function(s){r.scrollRef.current&&(r.scrollRef.current.scrollLeft=s.target.scrollLeft)},r.handleResize=function(){sGe(r.rafHandle),r.rafHandle=mPt(r.checkOverflow)},r.handleKeyPressEvent=function(){r.clearSelection();for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];Ja(r.props.onKeyPressEvent,i)},r.handleSelectEvent=function(){r.clearSelection();for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];Ja(r.props.onSelectEvent,i)},r.handleDoubleClickEvent=function(){r.clearSelection();for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];Ja(r.props.onDoubleClickEvent,i)},r.handleShowMore=function(s,i,o,l,c){var d=r.props,u=d.popup,h=d.onDrillDown,m=d.onShowMore,f=d.getDrilldownView,p=d.doShowMoreDrillDown;if(r.clearSelection(),u){var g=hPt(o,r.containerRef.current);r.setState({overlay:{date:i,events:s,position:LWe(LWe({},g),{},{width:"200px"}),target:c}})}else p&&Ja(h,[i,f(i)||wu.DAY]);Ja(m,[s,i,l])},r.handleSelectAllDaySlot=function(s,i){var o=r.props.onSelectSlot,l=new Date(s[0]),c=new Date(s[s.length-1]);c.setDate(s[s.length-1].getDate()+1),Ja(o,{slots:s,start:l,end:c,action:i.action,resourceId:i.resourceId})},r.overlayDisplay=function(){r.setState({overlay:null})},r.checkOverflow=function(){if(!r._updatingOverflow){var s=r.contentRef.current;if(s!=null&&s.scrollHeight){var i=s.scrollHeight>s.clientHeight;r.state.isOverflowing!==i&&(r._updatingOverflow=!0,r.setState({isOverflowing:i},function(){r._updatingOverflow=!1}))}}},r.memoizedResources=KPt(function(s,i){return i3r(s,i)}),r.state={gutterWidth:void 0,isOverflowing:null},r.scrollRef=se.createRef(),r.contentRef=se.createRef(),r.containerRef=se.createRef(),r._scrollRatio=null,r.gutterRef=y.createRef(),r}return iu(e,t),kc(e,[{key:"getSnapshotBeforeUpdate",value:function(){return this.checkOverflow(),null}},{key:"componentDidMount",value:function(){this.props.width==null&&this.measureGutter(),this.calculateScroll(),this.applyScroll(),window.addEventListener("resize",this.handleResize)}},{key:"componentWillUnmount",value:function(){window.removeEventListener("resize",this.handleResize),sGe(this.rafHandle),this.measureGutterAnimationFrameRequest&&window.cancelAnimationFrame(this.measureGutterAnimationFrameRequest)}},{key:"componentDidUpdate",value:function(){this.applyScroll()}},{key:"renderDayColumn",value:function(r,s,i,o,l,c,d,u,h,m){var f=this.props,p=f.min,g=f.max,v=(o.get(s)||[]).filter(function(x){return c.inRange(r,d.start(x),d.end(x),"day")}),b=(l.get(s)||[]).filter(function(x){return c.inRange(r,d.start(x),d.end(x),"day")});return se.createElement(yRe,Ts({},this.props,{localizer:c,min:c.merge(r,p),max:c.merge(r,g),resource:i&&s,components:u,isNow:c.isSameDate(r,m),key:"".concat(s,"-").concat(r),date:r,events:v,backgroundEvents:b,dayLayoutAlgorithm:h}))}},{key:"renderResourcesFirst",value:function(r,s,i,o,l,c,d,u,h){var m=this;return s.map(function(f){var p=Q2(f,2),g=p[0],v=p[1];return r.map(function(b){return m.renderDayColumn(b,g,v,i,o,l,c,u,h,d)})})}},{key:"renderRangeFirst",value:function(r,s,i,o,l,c,d,u,h){var m=this;return r.map(function(f){return se.createElement("div",{style:{display:"flex",minHeight:"100%",flex:1},key:f},s.map(function(p){var g=Q2(p,2),v=g[0],b=g[1];return se.createElement("div",{style:{flex:1},key:c.resourceId(b)},m.renderDayColumn(f,v,b,i,o,l,c,u,h,d))}))})}},{key:"renderEvents",value:function(r,s,i,o){var l=this.props,c=l.accessors,d=l.localizer,u=l.resourceGroupingLayout,h=l.components,m=l.dayLayoutAlgorithm,f=this.memoizedResources(this.props.resources,c),p=f.groupEvents(s),g=f.groupEvents(i);return u?this.renderRangeFirst(r,f,p,g,d,c,o,h,m):this.renderResourcesFirst(r,f,p,g,d,c,o,h,m)}},{key:"render",value:function(){var r,s=this.props,i=s.events,o=s.backgroundEvents,l=s.range,c=s.width,d=s.rtl,u=s.selected,h=s.getNow,m=s.resources,f=s.components,p=s.accessors,g=s.getters,v=s.localizer,b=s.min,x=s.max,w=s.showMultiDayTimes,k=s.longPressThreshold,S=s.resizable,C=s.resourceGroupingLayout;c=c||this.state.gutterWidth;var j=l[0],E=l[l.length-1];this.slots=l.length;var N=[],A=[],_=[];i.forEach(function(R){if(kF(R,j,E,p,v)){var O=p.start(R),F=p.end(R);p.allDay(R)||v.startAndEndAreDateOnly(O,F)||!w&&!v.isSameDate(O,F)?N.push(R):A.push(R)}}),o.forEach(function(R){kF(R,j,E,p,v)&&_.push(R)}),N.sort(function(R,O){return ewe(R,O,p,v)});var T={range:l,events:N,width:c,rtl:d,getNow:h,localizer:v,selected:u,allDayMaxRows:this.props.showAllEvents?1/0:(r=this.props.allDayMaxRows)!==null&&r!==void 0?r:1/0,resources:this.memoizedResources(m,p),selectable:this.props.selectable,accessors:p,getters:g,components:f,scrollRef:this.scrollRef,isOverflowing:this.state.isOverflowing,longPressThreshold:k,onSelectSlot:this.handleSelectAllDaySlot,onSelectEvent:this.handleSelectEvent,onShowMore:this.handleShowMore,onDoubleClickEvent:this.props.onDoubleClickEvent,onKeyPressEvent:this.props.onKeyPressEvent,onDrillDown:this.props.onDrillDown,getDrilldownView:this.props.getDrilldownView,resizable:S};return se.createElement("div",{className:Zn("rbc-time-view",m&&"rbc-time-view-resources"),ref:this.containerRef},m&&m.length>1&&C?se.createElement(BRt,T):se.createElement(ORt,T),this.props.popup&&this.renderOverlay(),se.createElement("div",{ref:this.contentRef,className:"rbc-time-content",onScroll:this.handleScroll},se.createElement(s3r,{date:j,ref:this.gutterRef,localizer:v,min:v.merge(j,b),max:v.merge(j,x),step:this.props.step,getNow:this.props.getNow,timeslots:this.props.timeslots,components:f,className:"rbc-time-gutter",getters:g}),this.renderEvents(l,A,_,h())))}},{key:"renderOverlay",value:function(){var r,s,i=this,o=(r=(s=this.state)===null||s===void 0?void 0:s.overlay)!==null&&r!==void 0?r:{},l=this.props,c=l.accessors,d=l.localizer,u=l.components,h=l.getters,m=l.selected,f=l.popupOffset,p=l.handleDragStart,g=function(){return i.setState({overlay:null})};return se.createElement(mRe,{overlay:o,accessors:c,localizer:d,components:u,getters:h,selected:m,popupOffset:f,ref:this.containerRef,handleKeyPressEvent:this.handleKeyPressEvent,handleSelectEvent:this.handleSelectEvent,handleDoubleClickEvent:this.handleDoubleClickEvent,handleDragStart:p,show:!!o.position,overlayDisplay:this.overlayDisplay,onHide:g})}},{key:"clearSelection",value:function(){clearTimeout(this._selectTimer),this._pendingSelection=[]}},{key:"measureGutter",value:function(){var r=this;this.measureGutterAnimationFrameRequest&&window.cancelAnimationFrame(this.measureGutterAnimationFrameRequest),this.measureGutterAnimationFrameRequest=window.requestAnimationFrame(function(){var s,i=(s=r.gutterRef)!==null&&s!==void 0&&s.current?Z0e(r.gutterRef.current):void 0;i&&r.state.gutterWidth!==i&&r.setState({gutterWidth:i})})}},{key:"applyScroll",value:function(){if(this._scrollRatio!=null&&this.props.enableAutoScroll===!0){var r=this.contentRef.current;r.scrollTop=r.scrollHeight*this._scrollRatio,this._scrollRatio=null}}},{key:"calculateScroll",value:function(){var r=arguments.length>0&&arguments[0]!==void 0?arguments[0]:this.props,s=r.min,i=r.max,o=r.scrollToTime,l=r.localizer,c=l.diff(l.merge(o,s),o,"milliseconds"),d=l.diff(s,i,"milliseconds");this._scrollRatio=c/d}}])}(y.Component);_N.propTypes={};_N.defaultProps={step:30,timeslots:2,resourceGroupingLayout:!1};var o3r=["date","localizer","min","max","scrollToTime","enableAutoScroll"];function l3r(t,e,n){return e=ci(e),su(t,VRt()?Reflect.construct(e,n||[],ci(t).constructor):e.apply(t,n))}function VRt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(VRt=function(){return!!t})()}var f9=function(t){function e(){return wc(this,e),l3r(this,e,arguments)}return iu(e,t),kc(e,[{key:"render",value:function(){var r=this.props,s=r.date,i=r.localizer,o=r.min,l=o===void 0?i.startOf(new Date,"day"):o,c=r.max,d=c===void 0?i.endOf(new Date,"day"):c,u=r.scrollToTime,h=u===void 0?i.startOf(new Date,"day"):u,m=r.enableAutoScroll,f=m===void 0?!0:m,p=Oy(r,o3r),g=e.range(s,{localizer:i});return se.createElement(_N,Ts({},p,{range:g,eventOffset:10,localizer:i,min:l,max:d,scrollToTime:h,enableAutoScroll:f}))}}])}(se.Component);f9.propTypes={};f9.range=function(t,e){var n=e.localizer;return[n.startOf(t,"day")]};f9.navigate=function(t,e,n){var r=n.localizer;switch(e){case kh.PREVIOUS:return r.add(t,-1,"day");case kh.NEXT:return r.add(t,1,"day");default:return t}};f9.title=function(t,e){var n=e.localizer;return n.format(t,"dayHeaderFormat")};var c3r=["date","localizer","min","max","scrollToTime","enableAutoScroll"];function d3r(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function u3r(t,e,n){return e=ci(e),su(t,HRt()?Reflect.construct(e,n||[],ci(t).constructor):e.apply(t,n))}function HRt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(HRt=function(){return!!t})()}var f0=function(t){function e(){return wc(this,e),u3r(this,e,arguments)}return iu(e,t),kc(e,[{key:"render",value:function(){var r=this.props,s=r.date,i=r.localizer,o=r.min,l=o===void 0?i.startOf(new Date,"day"):o,c=r.max,d=c===void 0?i.endOf(new Date,"day"):c,u=r.scrollToTime,h=u===void 0?i.startOf(new Date,"day"):u,m=r.enableAutoScroll,f=m===void 0?!0:m,p=Oy(r,c3r),g=e.range(s,this.props);return se.createElement(_N,Ts({},p,{range:g,eventOffset:15,localizer:i,min:l,max:d,scrollToTime:h,enableAutoScroll:f}))}}])}(se.Component);f0.propTypes={};f0.defaultProps=_N.defaultProps;f0.navigate=function(t,e,n){var r=n.localizer;switch(e){case kh.PREVIOUS:return r.add(t,-1,"week");case kh.NEXT:return r.add(t,1,"week");default:return t}};f0.range=function(t,e){var n=e.localizer,r=n.startOfWeek(),s=n.startOf(t,"week",r),i=n.endOf(t,"week",r);return n.range(s,i)};f0.title=function(t,e){var n=e.localizer,r=f0.range(t,{localizer:n}),s=tRt(r),i=s[0],o=d3r(s).slice(1);return n.format({start:i,end:o.pop()},"dayRangeHeaderFormat")};var h3r=["date","localizer","min","max","scrollToTime","enableAutoScroll"];function m3r(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function f3r(t,e,n){return e=ci(e),su(t,GRt()?Reflect.construct(e,n||[],ci(t).constructor):e.apply(t,n))}function GRt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(GRt=function(){return!!t})()}function xRe(t,e){return f0.range(t,e).filter(function(n){return[6,0].indexOf(n.getDay())===-1})}var WM=function(t){function e(){return wc(this,e),f3r(this,e,arguments)}return iu(e,t),kc(e,[{key:"render",value:function(){var r=this.props,s=r.date,i=r.localizer,o=r.min,l=o===void 0?i.startOf(new Date,"day"):o,c=r.max,d=c===void 0?i.endOf(new Date,"day"):c,u=r.scrollToTime,h=u===void 0?i.startOf(new Date,"day"):u,m=r.enableAutoScroll,f=m===void 0?!0:m,p=Oy(r,h3r),g=xRe(s,this.props);return se.createElement(_N,Ts({},p,{range:g,eventOffset:15,localizer:i,min:l,max:d,scrollToTime:h,enableAutoScroll:f}))}}])}(se.Component);WM.propTypes={};WM.defaultProps=_N.defaultProps;WM.range=xRe;WM.navigate=f0.navigate;WM.title=function(t,e){var n=e.localizer,r=xRe(t,{localizer:n}),s=tRt(r),i=s[0],o=m3r(s).slice(1);return n.format({start:i,end:o.pop()},"dayRangeHeaderFormat")};var nie=30;function p9(t){var e=t.accessors,n=t.components,r=t.date,s=t.events,i=t.getters,o=t.length,l=o===void 0?nie:o,c=t.localizer,d=t.onDoubleClickEvent,u=t.onSelectEvent,h=t.selected,m=y.useRef(null),f=y.useRef(null),p=y.useRef(null),g=y.useRef(null),v=y.useRef(null);y.useEffect(function(){w()});var b=function(E,N,A){var _=n.event,T=n.date;return N=N.filter(function(R){return kF(R,c.startOf(E,"day"),c.endOf(E,"day"),e,c)}),N.map(function(R,O){var F=e.title(R),D=e.end(R),I=e.start(R),P=i.eventProp(R,I,D,eie(R,h)),M=O===0&&c.format(E,"agendaDateFormat"),z=O===0?se.createElement("td",{rowSpan:N.length,className:"rbc-agenda-date-cell"},T?se.createElement(T,{day:E,label:M}):M):!1;return se.createElement("tr",{key:A+"_"+O,className:P.className,style:P.style},z,se.createElement("td",{className:"rbc-agenda-time-cell"},x(E,R)),se.createElement("td",{className:"rbc-agenda-event-cell",onClick:function(B){return u&&u(R,B)},onDoubleClick:function(B){return d&&d(R,B)}},_?se.createElement(_,{event:R,title:F}):F))},[])},x=function(E,N){var A="",_=n.time,T=c.messages.allDay,R=e.end(N),O=e.start(N);return e.allDay(N)||(c.eq(O,R)?T=c.format(O,"agendaTimeFormat"):c.isSameDate(O,R)?T=c.format({start:O,end:R},"agendaTimeRangeFormat"):c.isSameDate(E,O)?T=c.format(O,"agendaTimeFormat"):c.isSameDate(E,R)&&(T=c.format(R,"agendaTimeFormat"))),c.gt(E,O,"day")&&(A="rbc-continues-prior"),c.lt(E,R,"day")&&(A+=" rbc-continues-after"),se.createElement("span",{className:A.trim()},_?se.createElement(_,{event:N,day:E,label:T}):T)},w=function(){if(v.current){var E=m.current,N=v.current.firstChild;if(N){var A=g.current.scrollHeight>g.current.clientHeight,_=[],T=_;_=[Z0e(N.children[0]),Z0e(N.children[1])],(T[0]!==_[0]||T[1]!==_[1])&&(f.current.style.width=_[0]+"px",p.current.style.width=_[1]+"px"),A?(lPr(E,"rbc-header-overflowing"),E.style.marginRight=oRe()+"px"):cPr(E,"rbc-header-overflowing")}}},k=c.messages,S=c.add(r,l,"day"),C=c.range(r,S,"day");return s=s.filter(function(j){return kF(j,c.startOf(r,"day"),c.endOf(S,"day"),e,c)}),s.sort(function(j,E){return+e.start(j)-+e.start(E)}),se.createElement("div",{className:"rbc-agenda-view"},s.length!==0?se.createElement(se.Fragment,null,se.createElement("table",{ref:m,className:"rbc-agenda-table"},se.createElement("thead",null,se.createElement("tr",null,se.createElement("th",{className:"rbc-header",ref:f},k.date),se.createElement("th",{className:"rbc-header",ref:p},k.time),se.createElement("th",{className:"rbc-header"},k.event)))),se.createElement("div",{className:"rbc-agenda-content",ref:g},se.createElement("table",{className:"rbc-agenda-table"},se.createElement("tbody",{ref:v},C.map(function(j,E){return b(j,s,E)}))))):se.createElement("span",{className:"rbc-agenda-empty"},k.noEventsInRange))}p9.propTypes={};p9.range=function(t,e){var n=e.length,r=n===void 0?nie:n,s=e.localizer,i=s.add(t,r,"day");return{start:t,end:i}};p9.navigate=function(t,e,n){var r=n.length,s=r===void 0?nie:r,i=n.localizer;switch(e){case kh.PREVIOUS:return i.add(t,-s,"day");case kh.NEXT:return i.add(t,s,"day");default:return t}};p9.title=function(t,e){var n=e.length,r=n===void 0?nie:n,s=e.localizer,i=s.add(t,r,"day");return s.format({start:t,end:i},"agendaHeaderFormat")};var Sq=fd(fd(fd(fd(fd({},wu.MONTH,m9),wu.WEEK,f0),wu.WORK_WEEK,WM),wu.DAY,f9),wu.AGENDA,p9),p3r=["action","date","today"];function g3r(t,e){var n=e.action,r=e.date,s=e.today,i=Oy(e,p3r);switch(t=typeof t=="string"?Sq[t]:t,n){case kh.TODAY:r=s||new Date;break;case kh.DATE:break;default:dF(t&&typeof t.navigate=="function","Calendar View components must implement a static `.navigate(date, action)` method.s"),r=t.navigate(r,n,i)}return r}function v3r(t,e){var n=null;return typeof e=="function"?n=e(t):typeof e=="string"&&u0(t)==="object"&&t!=null&&e in t&&(n=t[e]),n}var vb=function(e){return function(n){return v3r(n,e)}},y3r=["view","date","getNow","onNavigate"],b3r=["view","toolbar","events","backgroundEvents","resourceGroupingLayout","style","className","elementProps","date","getNow","length","showMultiDayTimes","onShowMore","doShowMoreDrillDown","components","formats","messages","culture"];function DWe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function $We(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?DWe(Object(n),!0).forEach(function(r){fd(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):DWe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function x3r(t,e,n){return e=ci(e),su(t,WRt()?Reflect.construct(e,n||[],ci(t).constructor):e.apply(t,n))}function WRt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(WRt=function(){return!!t})()}function qRt(t){if(Array.isArray(t))return t;for(var e=[],n=0,r=Object.entries(t);n<r.length;n++){var s=Q2(r[n],2),i=s[0],o=s[1];o&&e.push(i)}return e}function w3r(t,e){var n=e.views,r=qRt(n);return r.indexOf(t)!==-1}var wRe=function(t){function e(){var n;wc(this,e);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=x3r(this,e,[].concat(s)),n.getViews=function(){var o=n.props.views;return Array.isArray(o)?$Mr(o,function(l,c){return l[c]=Sq[c]},{}):u0(o)==="object"?rRt(o,function(l,c){return l===!0?Sq[c]:l}):Sq},n.getView=function(){var o=n.getViews();return o[n.props.view]},n.getDrilldownView=function(o){var l=n.props,c=l.view,d=l.drilldownView,u=l.getDrilldownView;return u?u(o,c,Object.keys(n.getViews())):d},n.handleRangeChange=function(o,l,c){var d=n.props,u=d.onRangeChange,h=d.localizer;u&&l.range&&u(l.range(o,{localizer:h}),c)},n.handleNavigate=function(o,l){var c=n.props,d=c.view,u=c.date,h=c.getNow,m=c.onNavigate,f=Oy(c,y3r),p=n.getView(),g=h();u=g3r(p,$We($We({},f),{},{action:o,date:l||u||g,today:g})),m(u,d,o),n.handleRangeChange(u,p)},n.handleViewChange=function(o){o!==n.props.view&&w3r(o,n.props)&&n.props.onView(o);var l=n.getViews();n.handleRangeChange(n.props.date||n.props.getNow(),l[o],o)},n.handleSelectEvent=function(){for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];Ja(n.props.onSelectEvent,l)},n.handleDoubleClickEvent=function(){for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];Ja(n.props.onDoubleClickEvent,l)},n.handleKeyPressEvent=function(){for(var o=arguments.length,l=new Array(o),c=0;c<o;c++)l[c]=arguments[c];Ja(n.props.onKeyPressEvent,l)},n.handleSelectSlot=function(o){Ja(n.props.onSelectSlot,o)},n.handleDrillDown=function(o,l){var c=n.props.onDrillDown;if(c){c(o,l,n.drilldownView);return}l&&n.handleViewChange(l),n.handleNavigate(kh.DATE,o)},n.state={context:e.getContext(n.props)},n}return iu(e,t),kc(e,[{key:"render",value:function(){var r=this.props,s=r.view,i=r.toolbar,o=r.events,l=r.backgroundEvents,c=r.resourceGroupingLayout,d=r.style,u=r.className,h=r.elementProps,m=r.date,f=r.getNow,p=r.length,g=r.showMultiDayTimes,v=r.onShowMore,b=r.doShowMoreDrillDown;r.components,r.formats,r.messages,r.culture;var x=Oy(r,b3r);m=m||f();var w=this.getView(),k=this.state.context,S=k.accessors,C=k.components,j=k.getters,E=k.localizer,N=k.viewNames,A=C.toolbar||yRt,_=w.title(m,{localizer:E,length:p});return se.createElement("div",Ts({},h,{className:Zn(u,"rbc-calendar",x.rtl&&"rbc-rtl"),style:d}),i&&se.createElement(A,{date:m,view:s,views:N,label:_,onView:this.handleViewChange,onNavigate:this.handleNavigate,localizer:E}),se.createElement(w,Ts({},x,{events:o,backgroundEvents:l,date:m,getNow:f,length:p,localizer:E,getters:j,components:C,accessors:S,showMultiDayTimes:g,getDrilldownView:this.getDrilldownView,onNavigate:this.handleNavigate,onDrillDown:this.handleDrillDown,onSelectEvent:this.handleSelectEvent,onDoubleClickEvent:this.handleDoubleClickEvent,onKeyPressEvent:this.handleKeyPressEvent,onSelectSlot:this.handleSelectSlot,onShowMore:v,doShowMoreDrillDown:b,resourceGroupingLayout:c})))}}],[{key:"getDerivedStateFromProps",value:function(r){return{context:e.getContext(r)}}},{key:"getContext",value:function(r){var s=r.startAccessor,i=r.endAccessor,o=r.allDayAccessor,l=r.tooltipAccessor,c=r.titleAccessor,d=r.resourceAccessor,u=r.resourceIdAccessor,h=r.resourceTitleAccessor,m=r.eventIdAccessor,f=r.eventPropGetter,p=r.backgroundEventPropGetter,g=r.slotPropGetter,v=r.slotGroupPropGetter,b=r.dayPropGetter,x=r.view,w=r.views,k=r.localizer,S=r.culture,C=r.messages,j=C===void 0?{}:C,E=r.components,N=E===void 0?{}:E,A=r.formats,_=A===void 0?{}:A,T=qRt(w),R=hLr(j);return{viewNames:T,localizer:cLr(k,S,_,R),getters:{eventProp:function(){return f&&f.apply(void 0,arguments)||{}},backgroundEventProp:function(){return p&&p.apply(void 0,arguments)||{}},slotProp:function(){return g&&g.apply(void 0,arguments)||{}},slotGroupProp:function(){return v&&v.apply(void 0,arguments)||{}},dayProp:function(){return b&&b.apply(void 0,arguments)||{}}},components:APr(N[x]||{},CMr(N,T),{eventWrapper:Mv,backgroundEventWrapper:Mv,eventContainerWrapper:Mv,dateCellWrapper:Mv,weekWrapper:Mv,timeSlotWrapper:Mv,timeGutterWrapper:Mv,timeIndicatorWrapper:Mv}),accessors:{start:vb(s),end:vb(i),allDay:vb(o),tooltip:vb(l),title:vb(c),resource:vb(d),resourceId:vb(u),resourceTitle:vb(h),eventId:vb(m)}}}}])}(se.Component);wRe.defaultProps={events:[],backgroundEvents:[],elementProps:{},popup:!1,toolbar:!0,view:wu.MONTH,views:[wu.MONTH,wu.WEEK,wu.DAY,wu.AGENDA],step:30,length:30,allDayMaxRows:1/0,doShowMoreDrillDown:!0,drilldownView:wu.DAY,titleAccessor:"title",tooltipAccessor:"title",allDayAccessor:"allDay",startAccessor:"start",endAccessor:"end",resourceAccessor:"resourceId",resourceIdAccessor:"id",resourceTitleAccessor:"title",eventIdAccessor:"id",longPressThreshold:250,getNow:function(){return new Date},dayLayoutAlgorithm:"overlap"};wRe.propTypes={};var k3r=YAt(wRe,{view:"onView",date:"onNavigate",selected:"onSelectEvent"}),S3r=function(e,n,r){var s=e.start,i=e.end;return"".concat(r.format(s,"P",n)," – ").concat(r.format(i,"P",n))},yue=function(e,n,r){var s=e.start,i=e.end;return"".concat(r.format(s,"p",n)," – ").concat(r.format(i,"p",n))},C3r=function(e,n,r){var s=e.start;return"".concat(r.format(s,"h:mma",n)," – ")},j3r=function(e,n,r){var s=e.end;return" – ".concat(r.format(s,"h:mma",n))},E3r=function(e,n,r){var s=e.start,i=e.end;return"".concat(r.format(s,"MMMM dd",n)," – ").concat(r.format(i,PM(s,i,"month")?"dd":"MMMM dd",n))},N3r={dateFormat:"dd",dayFormat:"dd eee",weekdayFormat:"ccc",selectRangeFormat:yue,eventTimeRangeFormat:yue,eventTimeRangeStartFormat:C3r,eventTimeRangeEndFormat:j3r,timeGutterFormat:"p",monthHeaderFormat:"MMMM yyyy",dayHeaderFormat:"cccc MMM dd",dayRangeHeaderFormat:E3r,agendaHeaderFormat:S3r,agendaDateFormat:"ccc MMM dd",agendaTimeFormat:"p",agendaTimeRangeFormat:yue},T3r=function(e){var n=e.startOfWeek,r=e.getDay,s=e.format,i=e.locales;return new lLr({formats:N3r,firstOfWeek:function(l){return r(n(new Date,{locale:i[l]}))},format:function(l,c,d){return s(new Date(l),c,{locale:i[d]})}})};const _3r=T3r({format:fo,parse:(t,e,n)=>Kln(t,e,new Date,{locale:n}),startOfWeek:()=>0,getDay:Kon,locales:{"en-US":u7}});function A3r(t,e=18){return t.length<=e?t:`${t.slice(0,e-1)}…`}function P3r({label:t,onNavigate:e,date:n}){const r=s=>{const i=new Date(n),o=new Date(i.getFullYear(),i.getMonth()+(s==="next"?1:-1),1);e("DATE",o)};return a.jsxs("div",{className:"flex items-center justify-center gap-2 mb-4",children:[a.jsx(Z,{type:"button",variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>r("prev"),children:a.jsx(nl,{className:"h-4 w-4"})}),a.jsx("span",{className:"min-w-[10rem] text-center text-sm font-bold text-foreground",children:t}),a.jsx(Z,{type:"button",variant:"outline",size:"icon",className:"h-8 w-8",onClick:()=>r("next"),children:a.jsx(io,{className:"h-4 w-4"})})]})}function R3r({communityId:t,canCreate:e,onSelectEvent:n,onSelectDate:r}){const[s,i]=y.useState(()=>vc(new Date)),[o,l]=y.useState([]),[c,d]=y.useState(!0),u=fo(s,"yyyy-MM-dd"),h=y.useCallback(async()=>{d(!0);try{const p=await v0r(t,u);l((p.events??[]).map(gg))}catch{l([])}finally{d(!1)}},[t,u]);y.useEffect(()=>{h()},[h]);const m=y.useMemo(()=>o.map(p=>({id:p.realId,title:A3r(p.title),start:new Date(p.startTime),end:new Date(p.endTime),resource:p})),[o]),f=y.useCallback(({label:p,date:g})=>{const v=Rk(g)<Rk(new Date),b=e&&!v;return a.jsx("button",{type:"button",disabled:!b,onClick:()=>b&&r(g),className:b?"cursor-pointer text-foreground hover:text-primary":"text-muted-foreground cursor-default",children:p})},[e,r]);return a.jsxs("div",{className:"event-month-calendar rounded-lg border border-border bg-card p-4 shadow-card",children:[c&&a.jsx("div",{className:"flex items-center justify-center py-16 text-muted-foreground",children:a.jsx(Ne,{className:"h-6 w-6 animate-spin"})}),!c&&a.jsx("div",{style:{height:520},children:a.jsx(k3r,{localizer:_3r,events:m,date:s,onNavigate:p=>i(vc(p)),views:["month"],defaultView:"month",popup:!0,selectable:!1,components:{toolbar:P3r,month:{dateHeader:f}},onSelectEvent:p=>n(p.resource)})})]})}const I3r={going:"Yes",maybe:"Maybe","not-going":"No",invited:"Invited"};function M3r(t){return t.split(" ").map(e=>e[0]).filter(Boolean).slice(0,2).join("").toUpperCase()}function KRt({open:t,onOpenChange:e,title:n,attendees:r,loading:s}){const i=r.filter(o=>o.status!=="invited");return a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"sm:max-w-[480px] max-h-[80vh] flex flex-col",children:[a.jsx(Vt,{children:a.jsx(Ut,{children:n})}),s?a.jsx("div",{className:"flex justify-center py-10 text-muted-foreground",children:a.jsx(Ne,{className:"h-6 w-6 animate-spin"})}):i.length===0?a.jsx("p",{className:"text-sm text-muted-foreground py-6 text-center",children:"No attendees yet."}):a.jsxs("div",{className:"overflow-y-auto -mx-1 px-1 space-y-1",children:[a.jsxs("div",{className:"grid grid-cols-[1fr_auto] gap-2 px-2 py-1.5 text-xs font-semibold text-muted-foreground border-b border-border",children:[a.jsx("span",{children:"Member"}),a.jsx("span",{children:"RSVP"})]}),i.map(o=>a.jsxs("div",{className:"grid grid-cols-[1fr_auto] gap-2 items-center px-2 py-2.5 rounded-md hover:bg-muted/50",children:[a.jsxs("div",{className:"flex items-center gap-2 min-w-0",children:[a.jsxs(oo,{className:"h-8 w-8 shrink-0",children:[a.jsx(lo,{src:o.avatar}),a.jsx(co,{className:"text-[10px] bg-primary/10 text-primary",children:M3r(o.name)})]}),a.jsx("span",{className:"text-sm font-medium truncate",children:o.name})]}),a.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:I3r[o.status]??o.status})]},o.id))]})]})})}const L3r=10;function D3r(t){const{community:e}=qe(),n=(e==null?void 0:e.id)??null,[r,s]=y.useState([]),[i,o]=y.useState(!1),[l,c]=y.useState(!1),[d,u]=y.useState(!1),[h,m]=y.useState(null),f=y.useRef(void 0),p=y.useRef(new Set),g=y.useRef(0),v=y.useCallback(async x=>{if(!n){s([]),u(!1),o(!1);return}const w=++g.current;x==="reset"?(o(!0),m(null),f.current=void 0,p.current=new Set):c(!0);try{const S=await(t==="upcoming"?EPe:y0r)(n,f.current);if(w!==g.current)return;const C=S.events??[],j=[];for(const E of C)E!=null&&E.id&&p.current.has(E.id)||(E!=null&&E.id&&p.current.add(E.id),j.push(gg(E)));C.length>0&&(f.current=C[C.length-1].startTime),u(C.length===L3r),s(E=>x==="reset"?j:[...E,...j])}catch(k){if(w!==g.current)return;const S=k instanceof ze?k.message:"Failed to load events.";m(S),x==="reset"&&s([]),u(!1)}finally{w===g.current&&(o(!1),c(!1))}},[n,t]);y.useEffect(()=>{v("reset")},[v]);const b=y.useCallback(()=>{!i&&!l&&d&&v("append")},[i,l,d,v]);return{events:r,isLoading:i,isLoadingMore:l,hasMore:d,error:h,loadMore:b,refetch:()=>v("reset")}}function $3r(t){const{community:e}=qe(),n=(e==null?void 0:e.id)??null,[r,s]=y.useState([]),[i,o]=y.useState(!1),[l,c]=y.useState(null),d=y.useRef(0),u=y.useCallback(async()=>{if(!n||!t){s([]),o(!1);return}const h=++d.current;o(!0),c(null);try{const m=await b0r(n,t);if(h!==d.current)return;const f=new Set,p=[];for(const g of m.events??[])!(g!=null&&g.id)||f.has(g.id)||(f.add(g.id),p.push(gg(g)));s(p)}catch(m){if(h!==d.current)return;c(m instanceof ze?m.message:"Failed to load events."),s([])}finally{h===d.current&&o(!1)}},[n,t]);return y.useEffect(()=>{u()},[u]),{events:r,isLoading:i,error:l,refetch:u}}function O3r({id:t,slug:e}){const{community:n}=qe(),r=(n==null?void 0:n.id)??null,{toast:s}=yt(),[i,o]=y.useState(null),[l,c]=y.useState(!0),[d,u]=y.useState(null),[h,m]=y.useState(!1),f=y.useRef(0),p=y.useRef(null);p.current=i;const g=y.useCallback(()=>{f.current+=1,c(!1)},[]),v=y.useCallback(async C=>{const j=(C==null?void 0:C.silent)===!0&&p.current!==null;if(!r||!t&&!e){c(!1),o(null);return}const E=++f.current;j||(c(!0),u(null));try{const N=e?await x0r(r,e):await DAt(r,t);if(E!==f.current)return;o(N.event?gg(N.event):null)}catch(N){if(E!==f.current||j&&!(N instanceof ze&&N.status===404))return;const A=N instanceof ze&&N.status===404?"not-found":N instanceof ze?N.message:"Failed to load event.";u(A),o(null)}finally{E===f.current&&c(!1)}},[r,t,e]);y.useEffect(()=>{v()},[v]);const b=y.useCallback(()=>v(),[v]),x=y.useCallback(()=>v({silent:!0}),[v]),w=y.useCallback(async C=>{if(!r||!i||h)return;const j=i;g(),m(!0),o({...i,myRSVPStatus:C});try{const E=await HHe(r,i.realId,C);o(E.event?gg(E.event):j)}catch(E){o(j);const N=E instanceof ze&&E.status===400&&/full/i.test(E.message);s({title:N?"Event is full":"Couldn't update RSVP",description:N?"This event has reached its registration limit.":E instanceof ze?E.message:void 0,variant:"destructive"})}finally{m(!1)}},[r,i,h,s,g]),k=y.useCallback(async()=>{if(!(!r||!i||h)){g(),m(!0);try{const C=await HHe(r,i.realId,"going");o(C.event?gg(C.event):i),s({title:"You're going!",description:"Invitation accepted."})}catch(C){const j=C instanceof ze&&C.status===400&&/full/i.test(C.message);s({title:j?"Event is full":"Couldn't accept invitation",description:j?"This event has reached its registration limit.":C instanceof ze?C.message:void 0,variant:"destructive"})}finally{m(!1)}}},[r,i,h,s,g]),S=y.useCallback(async()=>{if(!(!r||!i||h)){g(),m(!0);try{const C=await w0r(r,i.realId),j=C.event?gg(C.event):i;o(j.myRSVPStatus==="invited"?{...j,myRSVPStatus:"not-going"}:j),s({title:"Invitation declined"})}catch(C){s({title:"Couldn't decline invitation",description:C instanceof ze?C.message:void 0,variant:"destructive"})}finally{m(!1)}}},[r,i,h,s,g]);return{event:i,isLoading:l,error:d,rsvpPending:h,setRsvp:w,acceptInvitation:k,rejectInvitation:S,refetch:b,refresh:x}}function F3r(t){const e={};return t.forEach(n=>{const r=`${n.month} ${n.year}`;e[r]||(e[r]=[]),e[r].push(n)}),e}function B3r(){const t=Nn(),{community:e}=qe(),{communityDetail:n,groups:r}=Ln(),[s,i]=y.useState("upcoming"),[o,l]=y.useState("list"),[c,d]=y.useState(!1),[u,h]=y.useState(null),[m,f]=y.useState(null),[p,g]=y.useState(null),[v,b]=y.useState(null),[x,w]=y.useState(!1),[k,S]=y.useState(null),[C,j]=y.useState(null),[E,N]=y.useState(!1),[A,_]=y.useState(!1),[T,R]=y.useState(!1),[O,F]=y.useState(!1),[D,I]=y.useState(null),[P,M]=y.useState(!1),[z,G]=y.useState(!1),{events:B,isLoading:H,isLoadingMore:W,hasMore:V,error:U,loadMore:ne,refetch:te}=D3r(s),re=F3r(B),fe=Afr(n,r),le=(n==null?void 0:n.myRole)==="admin",q=y.useRef(null);if(y.useEffect(()=>{const ye=q.current;if(!ye||!V)return;const J=new IntersectionObserver(K=>{var ce;(ce=K[0])!=null&&ce.isIntersecting&&ne()},{rootMargin:"200px"});return J.observe(ye),()=>J.disconnect()},[V,ne,B.length]),sF(n))return a.jsx(Gs,{to:ve.home,replace:!0});const Y=ye=>{i("upcoming"),te(),f(null),ye&&t(Nk({realId:ye}))},X=(ye,J)=>{j(ye),N(!!(J!=null&&J.deleteAll)),_(!0)},Q=async ye=>{if(!(!(e!=null&&e.id)||!C)){F(!0);try{await $At(e.id,C.realId,{deleteAll:E,notifyUser:ye}),He.success("Event deleted"),_(!1),R(!1),j(null),te()}catch(J){He.error(J instanceof ze?J.message:"Couldn't delete event")}finally{F(!1)}}},ie=()=>{if(!C)return;if(new Date(C.endTime).getTime()<Date.now()){Q(!1);return}_(!1),R(!0)},he=async ye=>{if(I(ye),M(!0),!!(e!=null&&e.id)){G(!0);try{const J=await DAt(e.id,ye.realId);J.event&&I(gg(J.event))}catch{He.error("Couldn't load attendees")}finally{G(!1)}}};return a.jsxs("div",{className:"max-w-4xl mx-auto py-6 px-4",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2 mb-6",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(ym,{className:"h-6 w-6 text-primary"}),a.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Events"}),a.jsx(Z,{type:"button",variant:"outline",size:"icon",className:"h-8 w-8",title:o==="list"?"Month view":"List view",onClick:()=>l(ye=>ye==="list"?"grid":"list"),children:o==="list"?a.jsx(ym,{className:"h-4 w-4"}):a.jsx(VBt,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[le&&a.jsxs(Z,{variant:"outline",size:"sm",className:"gap-1.5","aria-label":"Recordings",title:"Recordings of past live sessions",onClick:()=>t(`${ve.contentMedia}?category=recording`),children:[a.jsx(b2,{className:"h-4 w-4"}),a.jsx("span",{className:"hidden sm:inline",children:"Recordings"})]}),fe&&a.jsxs(Z,{onClick:()=>{f(null),h(null),d(!0)},size:"sm",className:"gap-1.5",children:[a.jsx(Dn,{className:"h-4 w-4"}),"Create event"]})]})]}),o==="grid"&&(e==null?void 0:e.id)&&a.jsx("div",{className:"mb-8",children:a.jsx(R3r,{communityId:e.id,canCreate:fe,onSelectEvent:ye=>t(Nk(ye)),onSelectDate:ye=>{f(null),h(ye),d(!0)}})}),o==="list"&&a.jsx("div",{className:"flex gap-1 border-b border-border mb-6",children:["upcoming","past"].map(ye=>a.jsxs("button",{onClick:()=>i(ye),className:`relative px-5 py-3 text-sm font-semibold uppercase tracking-wide transition-colors ${s===ye?"text-primary":"text-muted-foreground hover:text-foreground"}`,children:[ye,s===ye&&a.jsx(it.div,{layoutId:"calendar-tab-indicator",className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary rounded-full",transition:{type:"spring",stiffness:400,damping:30}})]},ye))}),o==="list"&&H&&a.jsx("div",{className:"flex items-center justify-center py-20 text-muted-foreground",children:a.jsx(Ne,{className:"h-6 w-6 animate-spin"})}),o==="list"&&!H&&U&&a.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[a.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:U}),a.jsx(Z,{variant:"outline",size:"sm",onClick:te,children:"Try again"})]}),o==="list"&&!H&&!U&&B.length===0&&a.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[a.jsx(ym,{className:"h-10 w-10 text-muted-foreground/40 mb-3"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["No ",s," events."]})]}),o==="list"&&!H&&!U&&B.length>0&&a.jsx(Al,{mode:"wait",children:a.jsxs(it.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,y:-12},transition:{duration:.25},children:[Object.entries(re).map(([ye,J])=>a.jsxs("div",{className:"mb-8",children:[a.jsx("h2",{className:"text-base font-bold text-foreground mb-4",children:ye}),a.jsx("div",{className:"space-y-3",children:J.map(K=>a.jsx(_0r,{event:K,tab:s,isAdmin:le,onShare:ce=>{S(ce),g(ce.realId),b(ce.slug||null),w(!0)},onEdit:ce=>{f(ce),d(!0)},onDelete:X,onShowAttendees:he},K.realId))})]},ye)),a.jsx("div",{ref:q,className:"h-6"}),W&&a.jsx("div",{className:"flex items-center justify-center py-4 text-muted-foreground",children:a.jsx(Ne,{className:"h-5 w-5 animate-spin"})})]},s)}),a.jsx(OAt,{open:c,onOpenChange:ye=>{d(ye),ye||(f(null),h(null))},event:m,defaultStartDate:u,onSaved:Y}),p&&a.jsx(FAt,{eventId:p,eventSlug:v,audienceRestricted:k==null?void 0:k.audienceRestricted,invitedSections:k!=null&&k.audienceRestricted?k.invitedSections:[],onShared:te,open:x,onOpenChange:ye=>{w(ye),ye||(S(null),g(null),b(null))}}),a.jsx(KRt,{open:P,onOpenChange:M,title:D?`${D.attendees} attendees`:"Attendees",attendees:(D==null?void 0:D.attendeesList)??[],loading:z}),a.jsx(Kr,{open:A,onOpenChange:_,children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Delete this event?"}),a.jsx(zr,{children:E?"This and all subsequent events in the series will be permanently removed.":`"${C==null?void 0:C.title}" will be permanently removed.`})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:O,children:"Cancel"}),a.jsx(Yr,{disabled:O,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:ye=>{ye.preventDefault(),ie()},children:"Delete"})]})]})}),a.jsx(jPe,{open:T,onOpenChange:R,title:"Notify attendees that the event is cancelled?",participantCount:C==null?void 0:C.attendees,loading:O,onNotify:()=>void Q(!0),onSkip:()=>void Q(!1)})]})}const OWe="h-8 w-full rounded-md border border-input bg-background pl-9 pr-3 text-xs placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring";function bue(t){return t.split(" ").map(e=>e[0]).filter(Boolean).join("").slice(0,2).toUpperCase()}function xue({src:t,name:e,className:n}){return t?a.jsx("img",{src:t,alt:e,className:ee("object-cover",n),onError:r=>{var s;r.currentTarget.style.display="none",(s=r.currentTarget.nextElementSibling)==null||s.classList.remove("hidden")}}):null}function U3r({contacts:t,activeContact:e,setActiveContact:n,dmTab:r,setDmTab:s,callsPanel:i,searchQuery:o,setSearchQuery:l,onNewGroup:c,onNewMessage:d,admins:u=[],onDeleteChat:h,onChatAction:m,onReportChat:f,onBlockChat:p,serverSearch:g,adminSearch:v,presenceOf:b}){const[x,w]=y.useState(null),[k,S]=y.useState(!1),[C,j]=y.useState(null),[E,N]=y.useState(!1),A=async()=>{if(!(!C||!p)){N(!0);try{await p(C),j(null)}finally{N(!1)}}},_=async()=>{if(!(!x||!h)){S(!0);try{await h(x),w(null)}finally{S(!1)}}},T=g?t:t.filter(M=>s2t(o,M.name,...(M.members??[]).map(z=>z.name))),R=o.trim().length>0,O=t.filter(M=>M.request).length,F=t.filter(M=>M.archived&&!M.request).length,D=["Inbox","Unread","Requests",...i?["Calls"]:[],...F>0||r==="Archived"?["Archived"]:[]],I=r==="Requests"?T.filter(M=>M.request):r==="Archived"?T.filter(M=>M.archived&&!M.request):r==="Unread"?T.filter(M=>M.unread&&!M.request&&!M.archived):T.filter(M=>!M.request&&!M.archived),P=!!(h||m||f||p);return a.jsxs("div",{className:"flex h-full w-full flex-col border-r border-border bg-card",children:[a.jsx("div",{className:"flex h-14 shrink-0 items-center border-b border-border px-4",children:a.jsx("h2",{className:"text-base font-semibold leading-none text-foreground",children:"Direct messages"})}),(d||c)&&a.jsxs("div",{className:"grid grid-cols-2 gap-2 px-4 pt-3",children:[d&&a.jsxs("button",{onClick:d,className:"inline-flex h-9 items-center justify-center gap-1.5 rounded-md bg-primary px-3 text-xs font-medium text-primary-foreground transition-colors hover:bg-primary/90",children:[a.jsx(pSe,{className:"h-3.5 w-3.5"})," New message"]}),c&&a.jsxs("button",{onClick:c,className:"inline-flex h-9 items-center justify-center gap-1.5 rounded-md border border-border px-3 text-xs font-medium text-foreground hover:bg-muted transition-colors",title:"New group",children:[a.jsx(wr,{className:"h-3.5 w-3.5"})," New group"]})]}),(u.length>0||v)&&a.jsxs("div",{className:"border-b border-border px-4 py-3",children:[a.jsx("p",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Message an admin"}),v&&a.jsxs("div",{className:"relative mb-2",children:[a.jsx(hs,{className:"absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{type:"text",placeholder:"Search admins","aria-label":"Search admins",value:v.value,onChange:M=>v.onChange(M.target.value),className:OWe})]}),v&&u.length===0&&a.jsx("p",{className:"py-2 text-center text-xs text-muted-foreground",role:"status",children:v.pending?"Searching…":v.failed?"Couldn't search admins. Please try again.":`No admin’s name starts with “${v.value.trim()}”.`}),a.jsx("div",{className:"themed-scrollbar max-h-40 space-y-0.5 overflow-y-auto overscroll-contain pr-1 [scrollbar-gutter:stable]",children:u.map(M=>a.jsxs("div",{className:"flex items-center justify-between gap-2 rounded-md px-1 py-1 hover:bg-muted/50",children:[a.jsxs("button",{onClick:()=>n(M.id),className:"flex min-w-0 flex-1 items-center gap-2 text-left",title:`Message ${M.name}`,children:[a.jsxs("div",{className:"relative h-7 w-7 shrink-0",children:[a.jsx(xue,{src:M.picture,name:M.name,className:"h-7 w-7 rounded-full"}),a.jsx("div",{className:ee("flex h-7 w-7 items-center justify-center rounded-full bg-primary/10 text-[10px] font-semibold text-primary",M.picture&&"hidden"),children:bue(M.name)})]}),a.jsx("span",{className:"truncate text-sm text-foreground",children:M.name})]}),a.jsx("button",{onClick:()=>n(M.id),className:"shrink-0 rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-primary",title:`Message ${M.name}`,"aria-label":`Message ${M.name}`,children:a.jsx(wd,{className:"h-4 w-4"})})]},M.id))})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1 px-4 pt-3 pb-2",children:[D.map(M=>a.jsxs("button",{onClick:()=>s(M),className:ee("inline-flex items-center gap-1 text-sm pb-1",r===M?"text-foreground font-medium border-b-2 border-foreground":"text-muted-foreground"),children:[M,M==="Requests"&&O>0&&a.jsx("span",{className:"inline-flex h-4 min-w-[1rem] items-center justify-center rounded-full bg-primary px-1 text-[10px] font-semibold text-primary-foreground",children:O>99?"99+":O})]},M)),r==="Archived"&&a.jsx(gn,{label:"Archived chats",side:"bottom",className:"mb-1",children:"Archived chats are moved out of your inbox. A new message brings the chat back, unless you also muted it. Only you see this; the other person is not told."})]}),r==="Calls"&&i?i:a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"px-4 py-2",children:a.jsxs("div",{className:"relative",children:[a.jsx(hs,{className:"absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{type:"text",placeholder:"Search for a name",value:o,onChange:M=>l(M.target.value),className:OWe})]})}),a.jsxs("div",{className:"themed-scrollbar flex-1 overflow-y-auto",children:[I.map(M=>{const z=M.type==="group",G=!M.request&&(z?!!m:P),B=!z&&!!(f||p||h),H={id:M.id,name:M.name},W={...H,type:z?"group":"dm"};return a.jsxs("div",{className:"group relative",children:[a.jsxs("button",{onClick:()=>n(M.id),className:ee("flex items-start gap-3 w-full px-4 py-3 text-left hover:bg-muted/50 transition-colors",P&&"pr-10",e===M.id&&"bg-muted/50"),children:[M.type==="group"&&!M.avatar&&M.members&&M.members.length>0?a.jsx("div",{className:"flex h-9 w-9 shrink-0 items-center -space-x-3",children:M.members.slice(0,3).map((V,U)=>a.jsxs("span",{className:"relative h-5 w-5 shrink-0",children:[a.jsx(xue,{src:V.picture,name:V.name,className:"h-5 w-5 rounded-full border border-card"}),a.jsx("span",{className:ee("flex h-5 w-5 items-center justify-center rounded-full border border-card bg-primary/10 text-[8px] font-semibold text-primary",V.picture&&"hidden"),children:bue(V.name)})]},U))}):a.jsxs("div",{className:"relative h-9 w-9 shrink-0",children:[!M.agent&&a.jsx(xue,{src:M.avatar,name:M.name,className:"h-9 w-9 rounded-full"}),a.jsx("div",{className:ee("h-9 w-9 rounded-full bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary",!M.agent&&M.avatar&&"hidden"),children:M.agent?"🤖":bue(M.name)}),M.type!=="group"&&!M.agent&&a.jsx(zAe,{presence:b==null?void 0:b(M.id)})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"grid grid-cols-[minmax(0,1fr)_3.5rem] items-center gap-2",children:[a.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[a.jsx("span",{className:ee("min-w-0 truncate text-sm",M.unread?"font-semibold text-foreground":"font-medium text-foreground"),children:M.name}),M.muted&&a.jsx(pK,{className:"h-3 w-3 shrink-0 text-muted-foreground","aria-label":"Muted"})]}),a.jsxs("span",{className:ee("inline-flex items-center justify-end gap-1 whitespace-nowrap text-right text-[10px] tabular-nums",M.unread&&!M.muted?"text-primary font-medium":"text-muted-foreground"),children:[M.pinned&&a.jsx(xk,{className:"h-3 w-3 shrink-0","aria-label":"Pinned"}),M.time]})]}),a.jsx("p",{className:ee("text-xs truncate",M.unread?"text-foreground font-medium":"text-muted-foreground"),children:M.preview})]}),M.unread&&a.jsx("span",{className:ee("ml-1 mt-0.5 flex h-5 min-w-[1.25rem] shrink-0 items-center justify-center rounded-full px-1.5 text-[10px] font-semibold",M.muted?"bg-muted-foreground/60 text-background":"bg-primary text-primary-foreground"),children:M.unreadCount&&M.unreadCount>0?M.unreadCount>99?"99+":M.unreadCount:""})]}),G&&a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx("button",{type:"button","aria-label":`Chat options for ${M.name}`,className:"absolute right-2 top-1/2 -translate-y-1/2 rounded-md p-1 text-muted-foreground transition-opacity hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring sm:opacity-0 sm:focus-visible:opacity-100 sm:group-hover:opacity-100 sm:data-[state=open]:opacity-100",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",className:"z-50 w-52 border border-border bg-popover shadow-lg",children:[m&&a.jsxs(a.Fragment,{children:[a.jsxs(ot,{onClick:()=>m(W,M.pinned?"unpin":"pin"),children:[M.pinned?a.jsx(xSe,{className:"mr-2 h-4 w-4"}):a.jsx(xk,{className:"mr-2 h-4 w-4"}),M.pinned?"Unpin":"Pin"]}),a.jsxs(ot,{onClick:()=>m(W,M.unread?"read":"unread"),children:[M.unread?a.jsx(zx,{className:"mr-2 h-4 w-4"}):a.jsx(Ii,{className:"mr-2 h-4 w-4"}),M.unread?"Mark as read":"Mark as unread"]}),a.jsxs(ot,{onClick:()=>m(W,M.muted?"unmute":"mute"),children:[M.muted?a.jsx(Lm,{className:"mr-2 h-4 w-4"}):a.jsx(pK,{className:"mr-2 h-4 w-4"}),M.muted?"Unmute":"Mute"]}),a.jsxs(ot,{onClick:()=>m(W,M.callsMuted?"unmuteCalls":"muteCalls"),children:[a.jsx(aI,{className:"mr-2 h-4 w-4"}),M.callsMuted?"Unmute calls":"Mute calls"]}),a.jsxs(ot,{onClick:()=>m(W,M.archived?"unarchive":"archive"),children:[M.archived?a.jsx(krt,{className:"mr-2 h-4 w-4"}):a.jsx(uSe,{className:"mr-2 h-4 w-4"}),M.archived?"Unarchive":"Archive"]})]}),B&&m&&a.jsx(mi,{}),!z&&f&&a.jsxs(ot,{onClick:()=>f(H),children:[a.jsx(xd,{className:"mr-2 h-4 w-4"}),a.jsxs("span",{className:"truncate",children:["Report ",M.name]})]}),!z&&p&&a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>j(H),children:[a.jsx(mm,{className:"mr-2 h-4 w-4"}),a.jsxs("span",{className:"truncate",children:["Block ",M.name]})]}),!z&&h&&a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>w(H),children:[a.jsx(qn,{className:"mr-2 h-4 w-4"})," Delete chat"]})]})]})]},M.id)}),I.length===0&&a.jsx("p",{className:"px-4 py-8 text-center text-xs text-muted-foreground",role:"status",children:R&&(g!=null&&g.pending)?"Searching…":R&&(g!=null&&g.failed)?"Couldn't search your conversations. Please try again.":R?a.jsxs(a.Fragment,{children:["No conversations match “",o.trim(),"”.",d&&r!=="Requests"&&a.jsxs(a.Fragment,{children:[" ",a.jsx("button",{type:"button",onClick:d,className:"font-medium text-primary hover:underline",children:"Start a new message"})," ","to find someone you have not chatted with yet."]})]}):r==="Archived"?"No archived chats. Archive a chat from its ⋯ menu to move it out of your inbox.":"No conversations found"})]})]}),a.jsx(Kr,{open:x!==null,onOpenChange:M=>!M&&!k&&w(null),children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsxs(Ur,{children:["Delete chat with ",x==null?void 0:x.name,"?"]}),a.jsxs(zr,{children:["This removes the conversation from your inbox only. ",x==null?void 0:x.name," keeps their copy, and the chat returns here if they message you again."]})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:k,children:"Cancel"}),a.jsx(Yr,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:k,onClick:M=>{M.preventDefault(),_()},children:k?"Deleting…":"Delete chat"})]})]})}),a.jsx(Kr,{open:C!==null,onOpenChange:M=>!M&&!E&&j(null),children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsxs(Ur,{children:["Block ",C==null?void 0:C.name,"?"]}),a.jsx(zr,{children:"You will no longer see their messages or content in this community, and this chat leaves your inbox. You can unblock them later from the Member Directory."})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:E,children:"Cancel"}),a.jsx(Yr,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:E,onClick:M=>{M.preventDefault(),A()},children:E?"Blocking…":"Block"})]})]})})]})}function z3r(t,e,n){return ae.post("/calls",{...t,media:e,communityId:n})}function V3r(t){return ae.post(`/calls/${encodeURIComponent(t)}/upgrade-video`)}function H3r(t){return ae.get(`/calls/conversation/${encodeURIComponent(t)}/active`)}function FWe(t,{before:e,missed:n}={}){const r=new URLSearchParams({communityId:t,limit:"30"});return e&&r.set("before",e),n&&r.set("missed","true"),ae.get(`/calls?${r.toString()}`)}function BWe(t,e){return ae.post(`/calls/${encodeURIComponent(t)}/accept`,{deviceId:e})}function wue(t){return ae.post(`/calls/${encodeURIComponent(t)}/join`)}function UWe(t){return ae.post(`/calls/${encodeURIComponent(t)}/decline`)}function zWe(t){return ae.post(`/calls/${encodeURIComponent(t)}/cancel`)}function YRt(t){return ae.post(`/calls/${encodeURIComponent(t)}/leave`)}function G3r(t){return ae.get(`/calls/${encodeURIComponent(t)}`)}function W3r(){return ae.get("/calls/active")}let kue=null,VWe=!1;function kRe(){if(typeof window>"u")return null;const t=window.AudioContext??window.webkitAudioContext;if(!t)return null;if(!kue)try{kue=new t}catch{return null}return kue}function q3r(){if(VWe||typeof window>"u")return;VWe=!0;const t=()=>{const e=kRe();e&&e.state==="suspended"&&e.resume().catch(()=>{})};window.addEventListener("pointerdown",t,{capture:!0}),window.addEventListener("keydown",t,{capture:!0})}function nwe(t,e,n,r,s){const i=t.createGain();i.gain.setValueAtTime(0,n),i.gain.linearRampToValueAtTime(s,n+.02),i.gain.setValueAtTime(s,n+r-.05),i.gain.linearRampToValueAtTime(0,n+r),i.connect(t.destination);for(const o of e){const l=t.createOscillator();l.type="sine",l.frequency.value=o,l.connect(i),l.start(n),l.stop(n+r)}}const K3r={freqs:[880,1320],on:.4,gap:.2,repeat:2,pause:1.8,volume:.18},Y3r={freqs:[440,480],on:1.5,gap:0,repeat:1,pause:3,volume:.08};function QRt(t){let e=!1,n=null;const r=t.repeat*t.on+(t.repeat-1)*t.gap+t.pause,s=()=>{if(e)return;const i=kRe();if(i&&i.state==="running"){let o=i.currentTime+.02;for(let l=0;l<t.repeat;l++)nwe(i,t.freqs,o,t.on,t.volume),o+=t.on+t.gap}n=setTimeout(s,r*1e3)};return s(),()=>{e=!0,n&&clearTimeout(n)}}const Q3r=()=>QRt(K3r),Z3r=()=>QRt(Y3r);function J3r(){const t=kRe();!t||t.state!=="running"||(nwe(t,[480],t.currentTime+.02,.18,.1),nwe(t,[360],t.currentTime+.24,.24,.1))}function rie(t){const e=Math.max(0,Math.floor(t)),n=Math.floor(e/3600),r=Math.floor(e%3600/60),s=e%60,i=n?String(r).padStart(2,"0"):String(r);return`${n?`${n}:`:""}${i}:${String(s).padStart(2,"0")}`}const SRe=y.createContext(null),dl={phase:"idle",call:null,token:null,minimized:!1,endedLabel:null},X3r=2200,YV=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():String(Math.random());function mJ(t,e){var r,s,i,o;if(!t)return{name:"",picture:null,isGroup:!1};const n=t.participants.filter(l=>l.user.id!==e).map(l=>l.user);if(t.kind==="group"){const l=n.map(d=>(d.name??"").split(" ")[0]).filter(Boolean),c=l.length>2?`${l.slice(0,2).join(", ")} +${l.length-2}`:l.join(", ");return{name:((r=t.group)==null?void 0:r.name)||c||"Group call",picture:((s=t.group)==null?void 0:s.avatar)??null,isGroup:!0}}return{name:((i=n[0])==null?void 0:i.name)??"",picture:((o=n[0])==null?void 0:o.picture)??null,isGroup:!1}}function HWe(t,e){var s;const n=t.caller.id===e,r=t.kind==="group"?"Everyone":((s=t.participants.find(i=>i.user.id!==e))==null?void 0:s.user.name)??"They";switch(t.status){case"ended":return t.durationSec?`Call ended · ${rie(t.durationSec)}`:"Call ended";case"busy":return n?`${r} ${t.kind==="group"?"else is":"is"} on another call`:"Missed call";case"missed":return n?"No answer":"Missed call";case"declined":return"Call declined";case"cancelled":return n?"Call cancelled":"Missed call";default:return"Call failed"}}const PT=(t,e)=>Dt(t instanceof ze?t.body:t,e);function e4r({children:t}){var O,F;const{socket:e,registered:n}=Qg(),{community:r}=qe(),s=(r==null?void 0:r.id)??"",{communityDetail:i}=Ln(),o=!!(i!=null&&i.isDmCallingDisabled),l=((O=ro())==null?void 0:O.id)??"",c=rn(),d=Di(),u=Nn(),[h,m]=y.useState(dl),f=y.useRef(h);f.current=h;const p=y.useRef(null);y.useEffect(()=>q3r(),[]);const g=y.useCallback(()=>{c.invalidateQueries({queryKey:["direct-messages"]})},[c]),v=y.useCallback((D,{silent:I=!1}={})=>{p.current&&clearTimeout(p.current);const P=f.current,M=P.phase!=="idle"&&P.phase!=="elsewhere"&&P.phase!=="rejoin";if(!D||I||!M||P.phase==="incoming"){m(dl);return}(P.phase==="in-call"||P.phase==="outgoing"||P.phase==="connecting")&&J3r(),lh("dm-call-ended",{kind:D.kind,media:D.media,status:D.status,durationSec:D.durationSec,endReason:D.endReason}),m({...P,phase:"ended",call:D,token:null,minimized:!1,endedLabel:HWe(D,l)}),p.current=setTimeout(()=>m(dl),X3r)},[l]);y.useEffect(()=>{if(!e)return;const D=P=>{var z;const M=f.current;M.phase!=="idle"&&M.phase!=="ended"&&((z=M.call)==null?void 0:z.id)!==P.call.id||(p.current&&clearTimeout(p.current),m({...dl,phase:"incoming",call:P.call}))},I=P=>{var B,H;const M=f.current,z=P.call,G=((B=M.call)==null?void 0:B.id)===z.id;if(P.event==="ended"){g(),G&&v(z);return}if(!G){const W=z.participants.find(V=>V.user.id===l);(W==null?void 0:W.state)==="joined"&&(M.phase==="idle"||M.phase==="rejoin")&&z.status!=="ended"&&m({...dl,phase:"elsewhere",call:z});return}if(P.event==="upgraded"&&M.token){if(m({...M,call:z}),wue(z.id).then(W=>m(V=>{var U;return((U=V.call)==null?void 0:U.id)===z.id&&V.token?{...V,call:W.call,token:W.token}:V})).catch(()=>He.error("Couldn't switch to video")),P.userId!==l){const W=((H=z.participants.find(V=>V.user.id===P.userId))==null?void 0:H.user.name)??"Someone";He.message(`${W} turned on video`)}return}if(M.phase==="incoming"){const W=z.participants.find(V=>V.user.id===l);if(W&&W.state!=="ringing"){m(W.state==="joined"&&P.deviceId!==YV?{...dl,phase:"elsewhere",call:z}:dl);return}}if(P.event==="accepted"){if(M.phase==="incoming"&&P.userId===l&&P.deviceId!==YV){m({...dl,phase:"elsewhere",call:z});return}if(M.phase==="outgoing"){m({...M,call:z,phase:"in-call"});return}}m({...M,call:z})};return e.on("call:incoming",D),e.on("call:update",I),()=>{e.off("call:incoming",D),e.off("call:update",I)}},[e,l,v,g]),y.useEffect(()=>{if(!n||!l)return;let D=!1;return W3r().then(({call:I})=>{if(D||!I||f.current.phase!=="idle")return;const P=I.participants.find(M=>M.user.id===l);I.status==="ringing"&&(P==null?void 0:P.state)==="ringing"?m({...dl,phase:"incoming",call:I}):(P==null?void 0:P.state)==="joined"&&m({...dl,phase:"rejoin",call:I})}).catch(()=>{}),()=>{D=!0}},[n,l]),y.useEffect(()=>{const D=new URLSearchParams(d.search),I=D.get("call");if(!I||!l)return;const P=D.get("answer")==="1",M=D.get("decline")==="1";D.delete("call"),D.delete("answer"),D.delete("decline");const z=D.toString();u({pathname:d.pathname,search:z?`?${z}`:""},{replace:!0}),G3r(I).then(async({call:G})=>{const B=G.participants.find(H=>H.user.id===l);if(G.status!=="ringing"||(B==null?void 0:B.state)!=="ringing"){G.status!=="ringing"&&G.status!=="ongoing"&&He.message(HWe(G,l));return}if(M){await UWe(G.id).catch(()=>{});return}if(m({...dl,phase:"incoming",call:G}),P){const H=await BWe(G.id,YV);m({...dl,phase:"connecting",call:H.call,token:H.token})}}).catch(G=>He.error(PT(G,"This call is no longer available")))},[d.search,l]);const b=t4r(h.phase==="incoming"?((F=h.call)==null?void 0:F.id)??null:null);y.useEffect(()=>{if(h.phase==="incoming"&&b)return Q3r();if(h.phase==="outgoing")return Z3r()},[h.phase,b]),y.useEffect(()=>{if(h.phase!=="incoming")return;const D=document.title,I=h.call?h.call.kind==="group"?`${h.call.caller.name??"Someone"} (${mJ(h.call,l).name})`:h.call.caller.name??"Someone":"Someone";let P=!1;const M=setInterval(()=>{P=!P,document.title=P?`📞 ${I} is calling…`:D},1e3);return()=>{clearInterval(M),document.title=D}},[h.phase,h.call,l]);const x=y.useCallback(async(D,I)=>{var z;if(!s)return;const P=f.current;if(P.phase!=="idle"&&P.phase!=="ended"){He.error("You're already on a call");return}p.current&&clearTimeout(p.current);const M={id:"",community:s,kind:D.kind,conversation:D.kind==="group"?D.conversation.id:null,group:D.kind==="group"?{id:D.conversation.id,name:D.conversation.name,avatar:D.conversation.avatar??null}:null,caller:{id:l,name:(z=ro())==null?void 0:z.name},media:I,status:"ringing",participants:[{user:{id:l},state:"joined",joinedAt:null,leftAt:null},...(D.kind==="group"?D.conversation.members.filter(G=>G.id!==l):[D.user]).map(G=>({user:G,state:"ringing",joinedAt:null,leftAt:null}))],startedAt:null,endedAt:null,durationSec:0,endReason:null,createdAt:new Date().toISOString()};m({...dl,phase:"outgoing",call:M});try{const G=await z3r(D.kind==="group"?{conversationId:D.conversation.id}:{receiverId:D.user.id},I,s);G.call.status==="ongoing"?m({...dl,phase:"connecting",call:G.call,token:G.token}):G.call.status!=="ringing"?(v(G.call),g()):f.current.phase==="outgoing"?(lh("dm-call-started",{kind:G.call.kind,media:G.call.media}),m(B=>({...B,call:G.call,token:G.token}))):zWe(G.call.id).catch(()=>{})}catch(G){m(dl),He.error(PT(G,"Couldn't start the call"))}},[s,l,v,g]),w=y.useCallback(async()=>{var I;const D=f.current.call;if(!(!D||f.current.phase!=="incoming")){m(P=>({...P,phase:"connecting"}));try{const P=await BWe(D.id,YV);lh("dm-call-answered",{kind:P.call.kind,media:P.call.media}),m(M=>({...M,phase:"connecting",call:P.call,token:P.token}))}catch(P){m(dl),(P instanceof ze?(I=P.body)==null?void 0:I.code:void 0)!=="elsewhere"&&He.error(PT(P,"This call has ended"))}}},[]),k=y.useCallback(async()=>{const D=f.current.call;m(dl),D!=null&&D.id&&(lh("dm-call-declined",{kind:D.kind,media:D.media}),await UWe(D.id).catch(()=>{}))},[]),S=y.useCallback(async()=>{const{call:D,phase:I}=f.current;if(!(D!=null&&D.id)){m(dl);return}try{const P=I==="outgoing"?await zWe(D.id):await YRt(D.id);v(P.call)}catch{v({...D,status:"ended"})}g()},[v,g]),C=y.useCallback(async()=>{const D=f.current.call;if(D)try{const I=await wue(D.id);m({...dl,phase:I.call.status==="ringing"?"outgoing":"connecting",call:I.call,token:I.token})}catch(I){m(dl),He.error(PT(I,"This call has ended"))}},[]),j=y.useCallback(async D=>{const I=f.current;if(I.phase!=="idle"&&I.phase!=="ended"&&I.phase!=="rejoin"){He.error("You're already on a call");return}p.current&&clearTimeout(p.current);try{const P=await wue(D);lh("dm-call-joined",{kind:P.call.kind,media:P.call.media}),m({...dl,phase:"connecting",call:P.call,token:P.token})}catch(P){He.error(PT(P,"This call has ended"))}},[]),E=y.useCallback(async()=>{const D=f.current.call;if(!(!(D!=null&&D.id)||D.media==="video"))try{await V3r(D.id),lh("dm-call-upgraded",{kind:D.kind})}catch(I){He.error(PT(I,"Couldn't switch to video"))}},[]),N=y.useCallback(D=>m(I=>({...I,minimized:D})),[]),A=y.useCallback(()=>m(D=>D.phase==="connecting"?{...D,phase:"in-call"}:D),[]),_=y.useMemo(()=>{var I;const D=(I=h.call)==null?void 0:I.participants.find(P=>P.user.id!==l);return(D==null?void 0:D.user)??null},[h.call,l]),T=y.useMemo(()=>mJ(h.call,l),[h.call,l]),R=y.useMemo(()=>({...h,myId:l,peer:_,display:T,startCall:x,joinCall:j,upgradeToVideo:E,accept:w,decline:k,hangUp:S,rejoin:C,setMinimized:N,markConnected:A,busy:h.phase!=="idle"&&h.phase!=="ended",callingDisabled:o}),[o,h,l,_,T,x,j,E,w,k,S,C,N,A]);return a.jsx(SRe.Provider,{value:R,children:t})}function ev(){const t=y.useContext(SRe);if(!t)throw new Error("useCall must be used within CallProvider");return t}function sie(){return y.useContext(SRe)}function t4r(t){const[e,n]=y.useState(!1);return y.useEffect(()=>{if(n(!1),!t)return;if(typeof BroadcastChannel>"u"){n(!0);return}const r=new BroadcastChannel("pensil-calls");let s=!1;r.onmessage=l=>{var c;((c=l.data)==null?void 0:c.callId)===t&&l.data.type==="ring-claim"&&(s=!0,n(!1))};const i=()=>{r.postMessage({type:"ring-claim",callId:t}),n(!0)};let o=null;return document.visibilityState==="visible"?i():o=setTimeout(()=>!s&&i(),350),()=>{o&&clearTimeout(o),r.close()}},[t]),e}function ZRt(t,e){if(t.caller.id===e)return!1;const n=t.participants.find(r=>r.user.id===e);return!!(n&&!n.joinedAt&&(n.state==="missed"||n.state==="busy"))}function n4r(t,e){const n=`${t.kind==="group"?"Group ":""}${t.media==="video"?"video":"audio"}`.replace(/^./,r=>r.toUpperCase());return t.status==="ended"?`${n} · ${rie(t.durationSec)}`:ZRt(t,e)?`Missed ${n.toLowerCase()} call`:t.status==="declined"?`${n} · Declined`:t.caller.id===e?`${n} · No answer`:`${n} call`}function r4r({communityId:t,onOpenChat:e}){const n=sie(),r=(n==null?void 0:n.myId)??"",[s,i]=y.useState("all"),[o,l]=y.useState([]),[c,d]=y.useState(!1),[u,h]=y.useState(!1),m=lt({queryKey:["call-log",t,s],queryFn:async()=>(await FWe(t,{missed:s==="missed"})).calls,enabled:!!t}),f=[...m.data??[],...o],p=b=>{i(b),l([]),h(!1)},g=async()=>{const b=f[f.length-1];if(!(!b||c)){d(!0);try{const{calls:x}=await FWe(t,{before:b.id,missed:s==="missed"});l(w=>[...w,...x]),x.length<30&&h(!0)}finally{d(!1)}}},v=b=>{var w,k;if(b.kind==="group"&&b.conversation)return{kind:"group",conversation:{id:b.conversation,name:mJ(b,r).name,avatar:((w=b.group)==null?void 0:w.avatar)??null,members:b.participants.map(S=>S.user)}};const x=(k=b.participants.find(S=>S.user.id!==r))==null?void 0:k.user;return x?{kind:"dm",user:{...x,name:x.name??""}}:null};return a.jsxs("div",{className:"flex min-h-0 flex-1 flex-col",children:[a.jsx("div",{className:"flex gap-2 px-4 pb-2",children:["all","missed"].map(b=>a.jsx("button",{type:"button",onClick:()=>p(b),className:ee("rounded-full px-3 py-1 text-xs font-medium transition-colors",s===b?"bg-foreground text-background":"bg-muted text-muted-foreground hover:text-foreground"),children:b==="all"?"All":"Missed"},b))}),a.jsxs("div",{className:"themed-scrollbar flex-1 overflow-y-auto",children:[m.isLoading&&a.jsx("p",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:"Loading calls…"}),!m.isLoading&&f.length===0&&a.jsx("p",{className:"px-4 py-6 text-center text-sm text-muted-foreground",children:s==="missed"?"No missed calls.":"No calls yet. Start one from the phone or camera icon in a chat."}),f.map(b=>{const x=mJ(b,r),w=ZRt(b,r),k=w?Zrt:b.caller.id===r?Jrt:Qrt,S=v(b);return a.jsxs("div",{role:"button",tabIndex:0,onClick:()=>e(b),onKeyDown:C=>C.key==="Enter"&&e(b),className:"flex cursor-pointer items-center gap-3 px-4 py-2.5 transition-colors hover:bg-muted/60",children:[x.picture?a.jsx("img",{src:x.picture,alt:"",className:"h-10 w-10 shrink-0 rounded-full object-cover"}):a.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:x.isGroup?a.jsx(wr,{className:"h-4 w-4"}):a.jsx("span",{className:"text-xs font-semibold",children:x.name.slice(0,2).toUpperCase()})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:ee("truncate text-sm font-medium",w?"text-destructive":"text-foreground"),children:x.name}),a.jsxs("p",{className:"flex items-center gap-1 truncate text-xs text-muted-foreground",children:[a.jsx(k,{className:ee("h-3 w-3 shrink-0",w&&"text-destructive")}),n4r(b,r)," · ",yc(b.createdAt)]})]}),n&&S&&!n.callingDisabled&&a.jsx("button",{type:"button","aria-label":`Call ${x.name} back`,title:"Call back",disabled:n.busy,onClick:C=>{C.stopPropagation(),n.startCall(S,b.media)},className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-primary transition-colors hover:bg-primary/10 disabled:opacity-40",children:b.media==="video"?a.jsx(Ca,{className:"h-4 w-4"}):a.jsx(rS,{className:"h-4 w-4"})})]},b.id)}),f.length>=30&&!u&&a.jsx("button",{type:"button",onClick:()=>void g(),disabled:c,className:"w-full py-3 text-center text-xs font-medium text-muted-foreground hover:text-foreground",children:c?"Loading…":"Load older calls"})]})]})}function Kb(t,e){return e?t==null||t===e:!1}const GWe=/^[0-9a-f]{24}$/i;function JRt(t,e){if(!(t!=null&&t.length)||!e.length)return e;const n=e[0].id.toLowerCase();if(!GWe.test(n))return e;const r=new Set(e.map(i=>i.id)),s=t.filter(i=>GWe.test(i.id)&&i.id.toLowerCase()<n&&!r.has(i.id));return s.length?[...s,...e]:e}const XRt="pending:";function s2(){try{return crypto.randomUUID()}catch{return`${Date.now()}-${Math.random().toString(36).slice(2,11)}`}}function SF(t){return`${XRt}${t}`}function uk(t){return t.startsWith(XRt)}const fJ=new Map;function CRe(t,e){const n=e.map(r=>r.type.startsWith("image/")?URL.createObjectURL(r):"");return fJ.set(t,{files:e,previews:n}),n}function l5(t){var e;return(e=fJ.get(t))==null?void 0:e.files}function c5(t){const e=fJ.get(t);if(e){for(const n of e.previews)if(n)try{URL.revokeObjectURL(n)}catch{}fJ.delete(t)}}function jRe(t,e){return t.map((n,r)=>({url:e[r]||"",name:n.name,mimeType:n.type,size:n.size,thumbnailUrl:null}))}function ERe(t,e){if(!(e!=null&&e.length))return t;const n=e.filter(o=>o.status&&uk(o.id));if(!n.length)return t;const r=new Set(t.map(o=>o.id)),s=new Set(t.map(o=>o.clientNonce).filter(Boolean)),i=n.filter(o=>!r.has(o.id)&&!(o.clientNonce&&s.has(o.clientNonce)));return i.length?[...t,...i]:t}function d5(t,e){t instanceof ze&&t.status>=400&&t.status<500&&He.error(Dt(t.body??t,e))}const e5t=["👍","❤️","😂","🎉","😮","😢"],s4r="(`[^`]+`|\\*\\*[^*]+\\*\\*|__[^_]+__|~~[^~]+~~|\\*[^*\\s][^*]*\\*|\\[[^\\]]+\\]\\([^)]+\\)|https?:\\/\\/[^\\s]+|www\\.[^\\s]+|@[a-zA-Z0-9._-]+)",i4r=/[).,;:!?]+$/;function Nj(t,e){const n=[];let r=0,s=0;const i=new RegExp(s4r,"g");let o;for(;(o=i.exec(t))!==null;){const l=o.index,c=o[0];l>r&&n.push(t.slice(r,l)),r=l+c.length;const d=`${e}-${s++}`;if(c.startsWith("`"))n.push(a.jsx("code",{className:"rounded bg-muted px-1 py-0.5 font-mono text-[0.85em]",children:c.slice(1,-1)},d));else if(c.startsWith("**"))n.push(a.jsx("strong",{children:Nj(c.slice(2,-2),d)},d));else if(c.startsWith("__"))n.push(a.jsx("u",{children:Nj(c.slice(2,-2),d)},d));else if(c.startsWith("~~"))n.push(a.jsx("s",{children:Nj(c.slice(2,-2),d)},d));else if(c.startsWith("*"))n.push(a.jsx("em",{children:Nj(c.slice(1,-1),d)},d));else if(c.startsWith("[")){const u=/^\[([^\]]+)\]\(([^)]+)\)$/.exec(c),h=(u==null?void 0:u[1])??c,m=(u==null?void 0:u[2])??"",f=/^https?:\/\//i.test(m)?m:`https://${m}`;n.push(a.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer nofollow",className:"text-primary hover:underline break-words",children:h},d))}else if(c.startsWith("@"))n.push(a.jsx(Zvr,{handle:c},d));else{let u=c,h="";const m=u.match(i4r);m&&(h=m[0],u=u.slice(0,u.length-h.length));const f=u.startsWith("http")?u:`https://${u}`;/\.(gif|png|jpe?g|webp)(\?|$)/i.test(u)||/media\d*\.tenor\.com/i.test(u)||/(static|media)\.klipy\.com/i.test(u)?n.push(a.jsx("img",{src:f,alt:"",loading:"lazy",className:"my-1 block h-auto max-h-52 w-full max-w-[260px] rounded-lg border border-border object-contain"},d)):n.push(a.jsx("a",{href:f,target:"_blank",rel:"noopener noreferrer nofollow",className:"text-primary hover:underline break-words",children:u},d)),h&&n.push(h)}}return r<t.length&&n.push(t.slice(r)),n}const Sue=/^\s*([-*•]|\d+\.)\s+(.*)$/;function NRe(t){if(!t)return null;const e=t.split(`
`),n=[];let r=0;for(;r<e.length;){const s=e[r];if(s.trim().startsWith("```")){const i=[];for(r++;r<e.length&&!e[r].trim().startsWith("```");)i.push(e[r]),r++;r++,n.push(a.jsx("pre",{className:"my-1 overflow-x-auto rounded-md bg-muted p-2 font-mono text-xs",children:a.jsx("code",{children:i.join(`
`)})},`b${n.length}`));continue}if(Sue.test(s)){const i=/^\s*\d+\.\s/.test(s),o=[];for(;r<e.length&&Sue.test(e[r]);){const l=Sue.exec(e[r]);o.push(a.jsx("li",{children:Nj(l[2],`li${r}`)},`li${r}`)),r++}n.push(i?a.jsx("ol",{className:"my-1 list-decimal pl-5",children:o},`b${n.length}`):a.jsx("ul",{className:"my-1 list-disc pl-5",children:o},`b${n.length}`));continue}if(/^\s*>\s?/.test(s)){const i=[];for(;r<e.length&&/^\s*>\s?/.test(e[r]);)i.push(a.jsx("div",{children:Nj(e[r].replace(/^\s*>\s?/,""),`q${r}`)},`q${r}`)),r++;n.push(a.jsx("blockquote",{className:"my-1 border-l-2 border-border pl-3 text-muted-foreground",children:i},`b${n.length}`));continue}n.push(a.jsxs("span",{children:[Nj(s,`p${r}`),r<e.length-1?a.jsx("br",{}):null]},`b${n.length}`)),r++}return n}function t5t({text:t,className:e}){const n=STt(t),[r,s]=y.useState(null);y.useEffect(()=>{let d=!1;if(s(null),!!n)return NTt(n).then(u=>{d||s(u)}),()=>{d=!0}},[n]);const i=r==null?void 0:r["og:image"],o=(r==null?void 0:r["og:title"])??(r==null?void 0:r.title),l=r==null?void 0:r["og:description"],c=r==null?void 0:r["og:site_name"];return!n||!r||!i||!o?null:a.jsxs("a",{href:n,target:"_blank",rel:"noreferrer",className:`mt-2 flex max-w-md overflow-hidden rounded-lg border border-border bg-muted/30 transition-colors hover:bg-muted/60 ${e??""}`,children:[a.jsx("img",{src:i,alt:"",className:"h-20 w-20 shrink-0 object-cover",onError:d=>{d.target.style.display="none"}}),a.jsxs("span",{className:"min-w-0 flex-1 px-3 py-2",children:[c&&a.jsx("span",{className:"block truncate text-[10px] uppercase tracking-wide text-muted-foreground",children:c}),a.jsx("span",{className:"block truncate text-xs font-semibold text-foreground",children:o}),l&&a.jsx("span",{className:"mt-0.5 block text-[11px] leading-4 text-muted-foreground [display:-webkit-box] [-webkit-box-orient:vertical] [-webkit-line-clamp:2] overflow-hidden",children:l})]})]})}function WWe(t){return t.split(" ").map(e=>e[0]).filter(Boolean).join("").slice(0,2).toUpperCase()}function TRe({activeContact:t,headerAvatar:e,subtitle:n,headerAvatarBadge:r,headerAction:s,topSlot:i,messages:o,currentUserId:l,onSend:c,onReact:d,onDelete:u,onAttach:h,onSendWithAttachments:m,onEdit:f,onOpenThread:p,onTogglePin:g,onLoadMore:v,loadingMore:b,unreadFromId:x,hideComposer:w,footerSlot:k,confirmDelete:S,onResend:C,onDiscardFailed:j}){const{user:E}=jr(),N=E?`${E.firstName} ${E.lastName}`:"Guest",[A,_]=y.useState(null),[T,R]=y.useState(null),[O,F]=y.useState(null),[D,I]=y.useState(null),[P,M]=y.useState(""),[z,G]=y.useState(!1),[B,H]=y.useState(!1),[W,V]=y.useState(!1),[U,ne]=y.useState(!1),[te,re]=y.useState(""),[fe,le]=y.useState(""),[q,Y]=y.useState(null),[X,Q]=y.useState([]),ie=y.useRef(null);Ejt(ie,{pattern:hcr});const{formats:he,refresh:ye}=X_e(ie),J=Cjt(ie),K=y.useRef(null),ce=y.useRef(null),{community:pe}=qe(),Ie=(pe==null?void 0:pe.id)??null,[Me,we]=y.useState(null),Ve=fPe(Ie,Me).users.slice(0,6),be=y.useRef(void 0),Ze=y.useRef(void 0),Pe=y.useRef(0),Ke=y.useRef(!1),De=y.useRef(!0);y.useEffect(()=>{const ke=K.current;ke&&v&&!b&&ke.scrollHeight-ke.clientHeight<120&&v()},[o,v,b]),y.useEffect(()=>{const ke=K.current;if(!ke)return;const at=()=>{De.current&&(ke.scrollTop=ke.scrollHeight)},Tt=Array.from(ke.querySelectorAll("img"));return Tt.forEach(An=>{An.complete||An.addEventListener("load",at,{once:!0})}),()=>Tt.forEach(An=>An.removeEventListener("load",at))},[o]),y.useLayoutEffect(()=>{var Pn,yn;const ke=K.current;if(!ke)return;const at=(Pn=o[0])==null?void 0:Pn.id,Tt=(yn=o[o.length-1])==null?void 0:yn.id,An=be.current!==void 0&&at!==be.current&&Tt===Ze.current;!Ke.current&&o.length>0?(Ke.current=!0,ke.scrollTop=ke.scrollHeight,De.current=!0):An?ke.scrollTop=ke.scrollHeight-Pe.current:De.current&&(ke.scrollTop=ke.scrollHeight),be.current=at,Ze.current=Tt,Pe.current=ke.scrollHeight},[o]);const xt=()=>{const ke=K.current;ke&&(De.current=ke.scrollHeight-ke.clientHeight-ke.scrollTop<100,v&&!b&&ke.scrollTop<60&&ke.scrollHeight-ke.clientHeight>120&&v())},Xe=()=>{const ke=window.getSelection();if(!ke||ke.rangeCount===0||!ie.current)return"";const at=ke.getRangeAt(0);if(!ie.current.contains(at.endContainer))return"";const Tt=at.cloneRange();return Tt.selectNodeContents(ie.current),Tt.setEnd(at.endContainer,at.endOffset),Tt.toString()},tt=/(?:^|\s)@([\w.]*)$/,$e=()=>{const ke=Xe().match(tt);we(ke?ke[1]:null)},wt=ke=>{var Tt;(Tt=ie.current)==null||Tt.focus();const at=((Me==null?void 0:Me.length)??0)+1;for(let An=0;An<at;An++)document.execCommand("delete",!1);document.execCommand("insertText",!1,`@${ke} `),we(null)},Ee=y.useCallback(()=>ie.current?ie.current.innerHTML==="<br>"?"":ie.current.innerHTML:"",[]),Ge=y.useCallback(()=>ie.current?ie.current.innerText.trim():"",[]),Pt=y.useCallback(()=>{ie.current&&(ie.current.innerHTML="")},[]),vn=y.useCallback(()=>{const ke=Ge(),at=Ee(),Tt=Hn(at);if(X.length&&m){const Pn=X;Q([]),Pt();const yn=m(Pn,Tt);yn&&typeof yn.then=="function"&&yn.then(Is=>{Is===!1&&(Q(Pn),ie.current&&(ie.current.innerHTML=at))}).catch(()=>{Q(Pn),ie.current&&(ie.current.innerHTML=at)});return}if(X.length&&h&&(h(X),Q([])),!ke)return;Pt();const An=c(Tt);An&&typeof An.then=="function"&&An.then(Pn=>{Pn===!1&&ie.current&&(ie.current.innerHTML=at)}).catch(()=>{ie.current&&(ie.current.innerHTML=at)})},[Ge,Ee,Pt,c,h,m,X]);function Hn(ke){let at=ke;return at=at.replace(/<strong>(.*?)<\/strong>/g,"**$1**"),at=at.replace(/<b>(.*?)<\/b>/g,"**$1**"),at=at.replace(/<em>(.*?)<\/em>/g,"*$1*"),at=at.replace(/<i>(.*?)<\/i>/g,"*$1*"),at=at.replace(/<u>(.*?)<\/u>/g,"__$1__"),at=at.replace(/<s>(.*?)<\/s>/g,"~~$1~~"),at=at.replace(/<strike>(.*?)<\/strike>/g,"~~$1~~"),at=at.replace(/<a[^>]*href="([^"]*)"[^>]*>(.*?)<\/a>/g,"[$2]($1)"),at=at.replace(/<li>(.*?)<\/li>/g,`• $1
`),at=at.replace(/<\/?[^>]+(>|$)/g,""),at=at.replace(/&nbsp;/g," "),at=at.replace(/&amp;/g,"&"),at=at.replace(/&lt;/g,"<"),at=at.replace(/&gt;/g,">"),at.trim()}const yr=(ke,at)=>{var Tt;(Tt=ie.current)==null||Tt.focus(),document.execCommand(ke,!1,at),ye()},br=()=>{if(fe){const ke=te||fe;J(),document.execCommand("insertHTML",!1,`<a href="${fe}" target="_blank" class="text-primary underline">${ke}</a>`)}ne(!1),re(""),le("")},Yt=ke=>{J(),document.execCommand("insertText",!1,ke),H(!1)},nr=ke=>{I(ke.id),M(ke.text)},Kn=()=>{I(null),M("")},ms=ke=>{const at=P.trim();at&&f&&f(ke,at),Kn()},is=ke=>{if(Me!==null&&Ve.length>0){if(ke.key==="Enter"){ke.preventDefault();const at=Ve[0];wt(at.userId||at.name);return}if(ke.key==="Escape"){ke.preventDefault(),we(null);return}}ke.key==="Enter"&&!ke.shiftKey&&(ke.preventDefault(),vn()),(ke.metaKey||ke.ctrlKey)&&(ke.key==="b"&&(ke.preventDefault(),yr("bold")),ke.key==="i"&&(ke.preventDefault(),yr("italic")),ke.key==="u"&&(ke.preventDefault(),yr("underline")))};return y.useEffect(()=>{if(!q)return;const ke=at=>{at.key==="Escape"&&Y(null)};return window.addEventListener("keydown",ke),()=>window.removeEventListener("keydown",ke)},[q]),a.jsxs("div",{className:"flex-1 flex flex-col min-h-0",children:[q&&a.jsxs("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/80 p-4",onClick:()=>Y(null),role:"dialog","aria-modal":"true",children:[a.jsx("button",{type:"button",onClick:()=>Y(null),className:"absolute right-4 top-4 flex h-9 w-9 items-center justify-center rounded-full bg-white/10 text-white hover:bg-white/20","aria-label":"Close",children:a.jsx(nn,{className:"h-5 w-5"})}),a.jsx("img",{src:q,alt:"",className:"max-h-[90vh] max-w-[90vw] rounded-lg object-contain",onClick:ke=>ke.stopPropagation()})]}),a.jsxs("div",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border px-4",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2.5",children:[e!==void 0&&a.jsxs("div",{className:"relative h-8 w-8 shrink-0",children:[e?a.jsx("img",{src:e,alt:t,className:"h-8 w-8 rounded-full object-cover",onError:ke=>{var at;ke.currentTarget.style.display="none",(at=ke.currentTarget.nextElementSibling)==null||at.classList.remove("hidden")}}):null,a.jsx("div",{className:`h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center text-[11px] font-semibold text-primary${e?" hidden":""}`,children:WWe(t)}),r]}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("h3",{className:"truncate text-base font-semibold leading-none text-foreground",children:t})}),n&&a.jsx("p",{className:"text-xs text-muted-foreground",children:n})]})]}),s]}),i,a.jsxs("div",{ref:K,onScroll:xt,className:"themed-scrollbar flex-1 min-h-0 overflow-y-auto px-5 py-4 space-y-4",children:[b&&a.jsx("p",{className:"text-center text-[11px] text-muted-foreground",children:"Loading earlier messages…"}),a.jsx(Al,{initial:!1,children:o.map((ke,at)=>{const Tt=o[at-1],An=!!(l&&ke.senderId===l),Pn=!!(Tt&&!Tt.customContent&&Tt.senderId&&Tt.senderId===ke.senderId&&!ke.date&&!ke.pinned&&x!==ke.id);return a.jsxs(it.div,{"data-msg-id":ke.id,"data-message-owner":An?"self":"other",initial:{opacity:0,y:12},animate:{opacity:1,y:0},exit:{opacity:0,scale:.96},transition:{duration:.22,ease:"easeOut"},onMouseEnter:()=>_(ke.id),onMouseLeave:()=>_(null),children:[x===ke.id&&a.jsxs("div",{className:"my-3 flex items-center gap-2",children:[a.jsx("div",{className:"h-px flex-1 bg-primary/30"}),a.jsx("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary",children:"New"}),a.jsx("div",{className:"h-px flex-1 bg-primary/30"})]}),ke.date&&a.jsx("div",{className:"flex items-center justify-center my-4",children:a.jsx("span",{className:"text-[10px] text-muted-foreground uppercase tracking-wider",children:ke.date})}),ke.customContent?a.jsx("div",{className:"flex justify-center py-1",children:ke.customContent}):a.jsxs("div",{className:ee("group relative flex items-start gap-2.5",An?"flex-row-reverse justify-start":"justify-start"),children:[Pn?a.jsx("div",{className:"h-9 w-9 shrink-0","aria-hidden":"true"}):ke.avatar?a.jsx("img",{src:ke.avatar,alt:ke.author,className:"h-9 w-9 rounded-full object-cover shrink-0",onError:yn=>{var Is;yn.currentTarget.style.display="none",(Is=yn.currentTarget.nextElementSibling)==null||Is.classList.remove("hidden")}}):null,!Pn&&a.jsx("div",{className:`h-9 w-9 rounded-full bg-primary/10 flex items-center justify-center text-xs font-semibold text-primary shrink-0${ke.avatar?" hidden":""}`,children:WWe(ke.author)}),a.jsxs("div",{className:ee("min-w-0 max-w-[min(78%,42rem)] overflow-hidden rounded-2xl px-3.5 py-2 shadow-sm",An?"rounded-tr-md bg-primary/10":"rounded-tl-md border border-border bg-muted/70"),children:[a.jsxs("div",{className:ee("flex items-center gap-2",An&&"justify-end"),children:[a.jsx("span",{className:"text-sm font-semibold text-foreground",children:ke.author}),ke.verified&&a.jsx("span",{className:"h-4 w-4 rounded-full bg-primary flex items-center justify-center text-[8px] text-primary-foreground",children:"✓"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:ke.time}),An&&!ke.status&&ke.readState==="read"&&a.jsx(lee,{className:"h-3.5 w-3.5 shrink-0 text-sky-500","aria-label":"Read"}),An&&!ke.status&&ke.readState==="sent"&&a.jsx(Qn,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground","aria-label":"Sent"}),ke.edited&&a.jsx("span",{className:"text-[10px] text-muted-foreground",children:"(edited)"}),ke.pinned&&a.jsxs("span",{className:"inline-flex items-center gap-0.5 text-[10px] text-amber-600",title:"Pinned message",children:[a.jsx(xk,{className:"h-3 w-3"})," Pinned"]})]}),ke.attachments&&ke.attachments.length>0&&a.jsx("div",{className:ee("mt-2 flex flex-wrap gap-2",ke.status==="sending"&&"opacity-60",ke.status==="failed"&&"opacity-70"),children:ke.attachments.map((yn,Is)=>{const js=yn.mimeType??"";return js.startsWith("image/")?a.jsx("button",{type:"button",onClick:()=>Y(yn.url),className:"block cursor-zoom-in",children:a.jsx("img",{src:yn.url,alt:yn.name??"",className:"block h-auto max-h-44 w-full max-w-[240px] rounded-lg border border-border object-contain"})},yn.id??Is):js.startsWith("video/")?a.jsx("video",{src:yn.url,controls:!0,preload:"metadata",className:"max-h-56 max-w-[280px] rounded-lg border border-border bg-black object-contain"},yn.id??Is):js.startsWith("audio/")?a.jsx("audio",{src:yn.url,controls:!0,preload:"metadata",className:"max-w-[280px]"},yn.id??Is):a.jsxs("a",{href:yn.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-2 rounded-md border border-border bg-muted/40 px-3 py-2 text-xs text-foreground hover:bg-muted transition-colors",children:[a.jsx(Ff,{className:"h-3.5 w-3.5 text-muted-foreground"}),a.jsx("span",{className:"truncate max-w-[180px]",children:yn.name??"Attachment"})]},yn.id??Is)})}),D===ke.id?a.jsxs("div",{className:"mt-1 space-y-1.5",children:[a.jsx("textarea",{value:P,onChange:yn=>M(yn.target.value),onKeyDown:yn=>{yn.key==="Enter"&&!yn.shiftKey&&(yn.preventDefault(),ms(ke.id)),yn.key==="Escape"&&(yn.preventDefault(),Kn())},autoFocus:!0,rows:2,className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>ms(ke.id),className:"h-7 rounded-md bg-primary px-3 text-xs text-primary-foreground hover:bg-primary/90 transition-colors",children:"Save"}),a.jsx("button",{onClick:Kn,className:"h-7 rounded-md border border-border px-3 text-xs text-foreground hover:bg-muted transition-colors",children:"Cancel"}),a.jsx("span",{className:"text-[10px] text-muted-foreground",children:"Enter to save · Esc to cancel"})]})]}):ke.text&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:ee("mt-0.5 break-words text-sm text-foreground",ke.status==="sending"&&"opacity-60",ke.status==="failed"&&"opacity-70"),children:NRe(ke.text)}),!ke.status&&a.jsx(t5t,{text:ke.text})]}),ke.status==="failed"&&a.jsxs("div",{className:"mt-1 flex items-center gap-2 text-[11px]",children:[a.jsxs("span",{className:"inline-flex items-center gap-1 font-medium text-destructive",children:[a.jsx(tS,{className:"h-3.5 w-3.5 shrink-0"}),"Not sent"]}),C&&ke.clientNonce&&a.jsxs("button",{type:"button",onClick:()=>C(ke.clientNonce),className:"inline-flex items-center gap-1 rounded text-destructive underline-offset-2 transition-colors hover:underline",children:[a.jsx(tst,{className:"h-3 w-3"})," Resend"]}),j&&ke.clientNonce&&a.jsx("button",{type:"button",onClick:()=>j(ke.clientNonce),className:"text-muted-foreground underline-offset-2 transition-colors hover:text-foreground hover:underline",children:"Discard"})]}),ke.reactions&&Object.keys(ke.reactions).length>0&&a.jsx("div",{className:"flex flex-wrap gap-1 mt-1.5",children:Object.entries(ke.reactions).map(([yn,Is])=>(()=>{const js=Array.isArray(Is)?Is:[];return a.jsxs("button",{onClick:()=>d(ke.id,yn),className:ee("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs transition-colors",js.includes(N)?"border-primary/50 bg-primary/10":"border-border hover:border-primary/30"),title:js.join(", "),children:[yn," ",js.length]},yn)})())}),p&&(ke.replyCount??0)>0&&a.jsxs("button",{onClick:()=>p(ke.id),className:"mt-1.5 inline-flex items-center gap-1.5 rounded-full border border-border px-2 py-0.5 text-xs font-medium text-primary hover:bg-primary/5 transition-colors",children:[a.jsx(Vi,{className:"h-3.5 w-3.5"}),ke.replyCount," ",ke.replyCount===1?"reply":"replies"]})]}),!ke.status&&(A===ke.id||T===ke.id)&&a.jsxs("div",{className:ee("absolute top-0 flex items-center gap-0.5 rounded-md border border-border bg-card p-0.5 shadow-sm",An?"left-0":"right-0"),children:[a.jsxs(Ni,{children:[a.jsx(Ti,{asChild:!0,children:a.jsx("button",{className:"h-7 w-7 flex items-center justify-center rounded hover:bg-muted transition-colors",title:"React",children:a.jsx(Hx,{className:"h-3.5 w-3.5 text-muted-foreground"})})}),a.jsxs(yi,{className:"w-auto p-2",side:"top",children:[a.jsx("div",{className:"mb-1.5 flex gap-1 border-b border-border pb-1.5",children:e5t.map(yn=>a.jsx("button",{onClick:()=>d(ke.id,yn),className:"h-8 w-8 flex items-center justify-center rounded hover:bg-muted text-base transition-colors",children:yn},yn))}),a.jsx($g,{onPick:yn=>d(ke.id,yn)})]})]}),p&&a.jsx("button",{onClick:()=>p(ke.id),className:"h-7 w-7 flex items-center justify-center rounded hover:bg-muted transition-colors",title:"Reply in thread",children:a.jsx(Vi,{className:"h-3.5 w-3.5 text-muted-foreground"})}),g&&a.jsx("button",{onClick:()=>g(ke.id,!ke.pinned),className:"h-7 w-7 flex items-center justify-center rounded hover:bg-muted transition-colors",title:ke.pinned?"Unpin message":"Pin message",children:ke.pinned?a.jsx(xSe,{className:"h-3.5 w-3.5 text-muted-foreground"}):a.jsx(xk,{className:"h-3.5 w-3.5 text-muted-foreground"})}),f&&ke.canEdit!==!1&&a.jsx("button",{onClick:()=>nr(ke),className:"h-7 w-7 flex items-center justify-center rounded hover:bg-muted transition-colors",title:"Edit",children:a.jsx(Qs,{className:"h-3.5 w-3.5 text-muted-foreground"})}),ke.canDelete!==!1&&(ke.canDeleteForEveryone?a.jsxs(Tr,{onOpenChange:yn=>R(yn?ke.id:null),children:[a.jsx(_r,{asChild:!0,children:a.jsx("button",{className:"h-7 w-7 flex items-center justify-center rounded hover:bg-destructive/10 transition-colors",title:"Delete",children:a.jsx(qn,{className:"h-3.5 w-3.5 text-destructive"})})}),a.jsxs(Cr,{align:"end",children:[a.jsx(ot,{onClick:()=>u(ke.id,!1),children:"Delete for me"}),a.jsx(ot,{className:"text-destructive focus:text-destructive",onClick:()=>u(ke.id,!0),children:"Delete for everyone"})]})]}):a.jsx("button",{onClick:()=>S?F(ke.id):u(ke.id,!1),className:"h-7 w-7 flex items-center justify-center rounded hover:bg-destructive/10 transition-colors",title:"Delete",children:a.jsx(qn,{className:"h-3.5 w-3.5 text-destructive"})}))]})]})]},ke.clientNonce?`${ke.senderId??"unknown"}:${ke.clientNonce}`:ke.id)})})]}),k,!k&&!w&&a.jsx("div",{"data-chat-composer":!0,className:"px-5 py-3 border-t border-border",children:a.jsxs("div",{className:"relative rounded-lg border border-border bg-background",children:[Me!==null&&Ve.length>0&&a.jsx("div",{className:"absolute bottom-full left-0 z-20 mb-1 w-64 overflow-hidden rounded-md border border-border bg-popover shadow-md",children:Ve.map(ke=>a.jsxs("button",{onClick:()=>wt(ke.userId||ke.name),className:"flex w-full items-center gap-2 px-3 py-2 text-left hover:bg-muted",children:[ke.picture?a.jsx("img",{src:ke.picture,alt:"",className:"h-6 w-6 rounded-full object-cover"}):a.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary/10 text-[9px] font-semibold text-primary",children:ke.name.split(" ").map(at=>at[0]).filter(Boolean).join("").slice(0,2).toUpperCase()}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-sm font-medium text-foreground",children:ke.name}),ke.userId&&a.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:["@",ke.userId]})]})]},ke.id))}),z&&a.jsxs("div",{className:"flex items-center gap-0.5 px-3 py-2 border-b border-border flex-wrap",children:[a.jsx("button",{onClick:()=>yr("bold"),"aria-pressed":!!he[fs.bold],className:ee("h-7 w-7 flex items-center justify-center rounded transition-colors",he[fs.bold]?"bg-primary/15 text-primary":"hover:bg-muted"),title:"Bold (Ctrl+B)",children:a.jsx(aee,{className:ee("h-4 w-4",he[fs.bold]?"text-primary":"text-muted-foreground")})}),a.jsx("button",{onClick:()=>yr("italic"),"aria-pressed":!!he[fs.italic],className:ee("h-7 w-7 flex items-center justify-center rounded transition-colors",he[fs.italic]?"bg-primary/15 text-primary":"hover:bg-muted"),title:"Italic (Ctrl+I)",children:a.jsx(cee,{className:ee("h-4 w-4",he[fs.italic]?"text-primary":"text-muted-foreground")})}),a.jsx("button",{onClick:()=>yr("underline"),"aria-pressed":!!he[fs.underline],className:ee("h-7 w-7 flex items-center justify-center rounded transition-colors",he[fs.underline]?"bg-primary/15 text-primary":"hover:bg-muted"),title:"Underline (Ctrl+U)",children:a.jsx(jSe,{className:ee("h-4 w-4",he[fs.underline]?"text-primary":"text-muted-foreground")})}),a.jsx("button",{onClick:()=>yr("strikeThrough"),"aria-pressed":!!he[fs.strikeThrough],className:ee("h-7 w-7 flex items-center justify-center rounded transition-colors",he[fs.strikeThrough]?"bg-primary/15 text-primary":"hover:bg-muted"),title:"Strikethrough",children:a.jsx(lst,{className:ee("h-4 w-4",he[fs.strikeThrough]?"text-primary":"text-muted-foreground")})}),a.jsx("div",{className:"w-px h-5 bg-border mx-1"}),a.jsx("button",{onClick:()=>ne(!0),className:"h-7 w-7 flex items-center justify-center rounded hover:bg-muted transition-colors",title:"Insert link",children:a.jsx(Drt,{className:"h-4 w-4 text-muted-foreground"})}),a.jsx("button",{onClick:()=>yr("insertOrderedList"),"aria-pressed":!!he[fs.numberedList],className:ee("h-7 w-7 flex items-center justify-center rounded transition-colors",he[fs.numberedList]?"bg-primary/15 text-primary":"hover:bg-muted"),title:"Numbered list",children:a.jsx(uee,{className:ee("h-4 w-4",he[fs.numberedList]?"text-primary":"text-muted-foreground")})}),a.jsx("button",{onClick:()=>yr("insertUnorderedList"),"aria-pressed":!!he[fs.bulletList],className:ee("h-7 w-7 flex items-center justify-center rounded transition-colors",he[fs.bulletList]?"bg-primary/15 text-primary":"hover:bg-muted"),title:"Bulleted list",children:a.jsx(rI,{className:ee("h-4 w-4",he[fs.bulletList]?"text-primary":"text-muted-foreground")})})]}),X.length>0&&a.jsx("div",{className:"flex flex-wrap gap-2 px-3 pt-3",children:X.map((ke,at)=>{const An=ke.type.startsWith("image/")?URL.createObjectURL(ke):null;return a.jsxs("div",{className:"group/att relative flex items-center gap-2 rounded-md border border-border bg-muted/40 p-1.5 pr-2",children:[An?a.jsx("img",{src:An,alt:ke.name,className:"h-10 w-10 rounded object-cover",onLoad:()=>URL.revokeObjectURL(An)}):a.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded bg-muted",children:a.jsx(Ff,{className:"h-4 w-4 text-muted-foreground"})}),a.jsx("span",{className:"max-w-[120px] truncate text-xs text-foreground",children:ke.name}),a.jsx("button",{type:"button",onClick:()=>Q(Pn=>Pn.filter((yn,Is)=>Is!==at)),className:"flex h-4 w-4 items-center justify-center rounded-full bg-foreground/70 text-background hover:bg-foreground","aria-label":`Remove ${ke.name}`,children:a.jsx(nn,{className:"h-2.5 w-2.5"})})]},`${ke.name}-${at}`)})}),a.jsx("div",{ref:ie,contentEditable:!0,onKeyDown:is,onInput:$e,onKeyUp:$e,onBlur:()=>setTimeout(()=>we(null),150),"data-placeholder":`Message ${t}…`,className:"w-full min-h-[40px] max-h-[120px] overflow-y-auto text-sm text-foreground px-4 py-3 focus:outline-none empty:before:content-[attr(data-placeholder)] empty:before:text-muted-foreground [&_ol]:my-1 [&_ol]:list-decimal [&_ol]:pl-5 [&_ul]:my-1 [&_ul]:list-disc [&_ul]:pl-5 [&_a]:text-primary [&_a]:underline"}),a.jsxs("div",{className:"flex items-center justify-between px-3 py-2 border-t border-border",children:[a.jsxs("div",{className:"flex items-center gap-1",children:[(h||m)&&a.jsx("button",{onClick:()=>{var ke;return(ke=ce.current)==null?void 0:ke.click()},className:"h-7 w-7 flex items-center justify-center rounded-full hover:bg-muted transition-colors",title:"Add attachment",children:a.jsx(Dn,{className:"h-4 w-4 text-muted-foreground"})}),(h||m)&&a.jsx("input",{ref:ce,type:"file",multiple:!0,className:"hidden",onChange:ke=>{const at=Array.from(ke.target.files??[]);at.length&&Q(Tt=>[...Tt,...at]),ke.target.value=""}}),a.jsx("button",{onClick:()=>G(ke=>!ke),className:ee("h-7 w-7 flex items-center justify-center rounded hover:bg-muted transition-colors text-xs font-bold",z&&"bg-muted text-foreground"),title:"Formatting",children:a.jsx("span",{className:"text-muted-foreground font-serif text-sm",children:"Aa"})}),a.jsxs(Ni,{open:B,onOpenChange:H,children:[a.jsx(Ti,{asChild:!0,children:a.jsx("button",{className:"h-7 w-7 flex items-center justify-center rounded hover:bg-muted transition-colors",title:"Emoji",children:a.jsx(Hx,{className:"h-4 w-4 text-muted-foreground"})})}),a.jsx(yi,{className:"w-auto p-2",side:"top",align:"start",children:a.jsx($g,{onPick:ke=>Yt(ke)})})]}),a.jsxs(Ni,{open:W,onOpenChange:V,children:[a.jsx(Ti,{asChild:!0,children:a.jsx("button",{className:"h-7 px-1.5 flex items-center justify-center rounded hover:bg-muted transition-colors",title:"GIF",children:a.jsx("span",{className:"rounded border border-muted-foreground/60 px-1 text-[10px] font-bold text-muted-foreground",children:"GIF"})})}),a.jsx(yi,{className:"w-auto p-2",side:"top",align:"start",children:a.jsx(CM,{onPick:ke=>{c(ke),V(!1)}})})]})]}),a.jsx("button",{onClick:vn,className:"h-8 px-3 rounded-md bg-primary flex items-center justify-center text-primary-foreground hover:bg-primary/90 transition-colors",children:a.jsx(_s,{className:"h-4 w-4"})})]})]})}),a.jsx(Bt,{open:U,onOpenChange:ne,children:a.jsxs(Ft,{className:"max-w-sm",children:[a.jsx(Vt,{children:a.jsx(Ut,{children:"Insert link"})}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Text"}),a.jsx("input",{type:"text",value:te,onChange:ke=>re(ke.target.value),placeholder:"Link text",className:"w-full h-9 mt-1 rounded-md border border-input bg-background px-3 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"URL"}),a.jsx("input",{type:"url",value:fe,onChange:ke=>le(ke.target.value),placeholder:"https://",className:"w-full h-9 mt-1 rounded-md border border-input bg-background px-3 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]}),a.jsx("button",{onClick:br,className:"w-full h-9 rounded-md bg-primary text-primary-foreground text-sm hover:bg-primary/90 transition-colors",children:"Insert"})]})]})}),a.jsx(Kr,{open:O!==null,onOpenChange:ke=>!ke&&F(null),children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Delete message?"}),a.jsx(zr,{children:"This removes the message for everyone in the chat. It can't be undone."})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:"Cancel"}),a.jsx(Yr,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{O&&u(O,!1),F(null)},children:"Delete"})]})]})})]})}function n5t({target:t,disabledReason:e}){const n=sie();if(!n||n.callingDisabled)return null;const r=!!e||n.busy,s=l=>e??(n.busy?"You're already on a call":l),i=t.kind==="group",o=(l,c,d)=>a.jsx("button",{type:"button",onClick:()=>void n.startCall(t,l),disabled:r,"aria-label":c,title:s(c),className:"flex h-9 w-9 items-center justify-center rounded-full text-foreground transition-colors hover:bg-muted disabled:cursor-not-allowed disabled:opacity-40",children:a.jsx(d,{className:"h-[18px] w-[18px]"})});return a.jsxs("div",{className:"flex items-center gap-1",children:[o("audio",i?"Start group audio call":"Start audio call",rS),o("video",i?"Start group video call":"Start video call",Ca)]})}function r5t({summary:t,iCalled:e,time:n,target:r}){const s=sie(),i=t.media==="video",l=`${r.kind==="group"?"Group ":""}${i?"video":"audio"} call`.replace(/^./,m=>m.toUpperCase()),c=t.status==="ended";let d;c?d=t.durationSec?`${l} · ${rie(t.durationSec)}`:l:t.status==="declined"?d=e?`${l} declined`:`Declined ${l.toLowerCase()}`:d=e?`${l} · No answer`:`Missed ${l.toLowerCase()}`;const u=!c&&!e&&t.status!=="declined",h=u?Zrt:c?e?Jrt:Qrt:i?Ca:rS;return a.jsxs("div",{className:ee("flex items-center gap-3 rounded-2xl border px-3.5 py-2",u?"border-destructive/30 bg-destructive/5":"border-border bg-muted/40"),children:[a.jsx("span",{className:ee("flex h-8 w-8 items-center justify-center rounded-full",u?"bg-destructive/10 text-destructive":"bg-primary/10 text-primary"),children:a.jsx(h,{className:"h-4 w-4"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:ee("text-sm font-medium",u?"text-destructive":"text-foreground"),children:d}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:n})]}),s&&!s.callingDisabled&&a.jsx("button",{type:"button",onClick:()=>void s.startCall(r,t.media),disabled:s.busy,className:"ml-2 rounded-full px-3 py-1 text-xs font-semibold text-primary transition-colors hover:bg-primary/10 disabled:opacity-40",children:"Call back"})]})}function a4r({call:t}){var i;const e=sie();if(!e)return null;const n=t.participants.filter(o=>o.state==="joined");if(n.some(o=>o.user.id===e.myId)||((i=e.call)==null?void 0:i.id)===t.id)return null;const s=t.media==="video";return a.jsxs("div",{className:"flex items-center gap-3 border-b border-border bg-emerald-500/10 px-4 py-2.5",children:[a.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-emerald-600 text-white",children:s?a.jsx(Ca,{className:"h-4 w-4"}):a.jsx(rS,{className:"h-4 w-4"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("p",{className:"truncate text-sm font-medium text-foreground",children:[s?"Video call":"Audio call"," in progress"]}),a.jsxs("p",{className:"flex items-center gap-1 truncate text-xs text-muted-foreground",children:[a.jsx(wr,{className:"h-3 w-3"}),n.length," in call · ",n.map(o=>(o.user.name??"").split(" ")[0]).filter(Boolean).join(", ")]})]}),a.jsx("button",{type:"button",onClick:()=>void e.joinCall(t.id),disabled:e.busy,className:"rounded-full bg-emerald-600 px-4 py-1.5 text-sm font-semibold text-white transition-colors hover:bg-emerald-500 disabled:opacity-50",children:"Join"})]})}function Cue(t){const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function o4r(t){const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric"})}function l4r({user:t,currentUserId:e,presence:n,onOpenThread:r}){var fe,le;const s=rn(),{socket:i}=Qg(),{community:o}=qe(),{user:l}=jr(),c=(o==null?void 0:o.id)??"",d=(o==null?void 0:o.myRole)==="admin"||!!(o!=null&&o.isByMe),u=l?`${l.firstName} ${l.lastName}`:"Guest",h=["dm-thread",c,t.id],m=lt({queryKey:h,queryFn:async()=>{const q=await Kxe(t.id,c),Y=s.getQueryData(h);return{...q,messages:JRt(Y==null?void 0:Y.messages,ERe(q.messages,Y==null?void 0:Y.messages))}},enabled:!!c}),[f,p]=y.useState(new Set),g=y.useMemo(()=>{var q;return(((q=m.data)==null?void 0:q.messages)??[]).filter(Y=>!f.has(Y.id))},[m.data,f]),v=y.useRef(null);v.current===null&&(v.current=t.unreadMessageCount??0);const b=y.useRef(void 0);if(b.current===void 0&&g.length>0){const q=v.current??0;if(q>0){const Y=g.filter(X=>X.sender.id!==e);b.current=Y.length>=q?Y[Y.length-q].id:((fe=Y[0])==null?void 0:fe.id)??null}else b.current=null}const x=b.current??null,[w,k]=y.useState(!1),[S,C]=y.useState(!0),j=y.useCallback(async()=>{var Y;const q=((Y=m.data)==null?void 0:Y.messages)??[];if(!(w||!S||!q.length)){k(!0);try{const X=await Kxe(t.id,c,q[0].id);X.messages.length&&N(Q=>{const ie=new Set(Q.messages.map(he=>he.id));return{...Q,messages:[...X.messages.filter(he=>!ie.has(he.id)),...Q.messages]}}),X.messages.length<10&&C(!1)}catch{}finally{k(!1)}}},[w,S,m.data,t.id,c]),E=y.useMemo(()=>{const q=new Map;return q.set(e,u),q.set(t.id,t.name),q},[e,u,t.id,t.name]),N=q=>{s.setQueryData(h,Y=>Y&&q(Y))},A=()=>{s.invalidateQueries({queryKey:["direct-messages",c]}),s.invalidateQueries({queryKey:["user-counters"]})};y.useEffect(()=>{c&&Yxe(t.id,c).then(A)},[t.id,c]),y.useEffect(()=>{if(!i)return;const q=ye=>{Kb(ye.message.community,c)&&(N(J=>{const K=ye.message,ce=J.messages.findIndex(Ie=>Ie.id===K.id||!!K.clientNonce&&Ie.clientNonce===K.clientNonce);if(ce===-1)return{...J,messages:[...J.messages,K]};const pe=[...J.messages];return pe[ce]={...pe[ce],...K,status:void 0},{...J,messages:pe}}),Yxe(t.id,c).then(A))},Y=ye=>{Kb(ye.message.community,c)&&N(J=>({...J,messages:J.messages.map(K=>K.id===ye.message.id?ye.message:K)}))},X=ye=>{var K,ce;if(!Kb(ye.communityId??((K=ye.message)==null?void 0:K.community),c))return;const J=ye.messageId??((ce=ye.message)==null?void 0:ce.id);J&&N(pe=>({...pe,messages:pe.messages.filter(Ie=>Ie.id!==J)}))},Q=ye=>{Kb(ye.communityId,c)&&N(J=>({...J,messages:J.messages.map(K=>K.id===ye.messageId?{...K,reactions:ye.reactions}:K)}))},ie=ye=>{Kb(ye.communityId,c)&&N(J=>({...J,messages:J.messages.map(K=>K.id===ye.parentId?{...K,replyCount:ye.parent.replyCount,replyParticipants:ye.parent.replyParticipants}:K)}))},he=ye=>{Kb(ye.community,c)&&N(J=>({...J,messages:J.messages.map(K=>K.sender.id===e&&!K.status?{...K,isRead:!0}:K)}))};return i.on(`direct-message:${t.id}:message-received`,q),i.on(`direct-message:${t.id}:message-edited`,Y),i.on(`direct-message:${t.id}:message-deleted`,X),i.on(`direct-message:${t.id}:reaction-updated`,Q),i.on(`direct-message:${t.id}:thread-reply`,ie),i.on(`direct-message:${t.id}:messages-read`,he),()=>{i.off(`direct-message:${t.id}:messages-read`,he),i.off(`direct-message:${t.id}:message-received`,q),i.off(`direct-message:${t.id}:message-edited`,Y),i.off(`direct-message:${t.id}:message-deleted`,X),i.off(`direct-message:${t.id}:reaction-updated`,Q),i.off(`direct-message:${t.id}:thread-reply`,ie)}},[i,t.id,c]);const _=(q,Y)=>({id:SF(q),community:c,clientNonce:q,status:"sending",message:"",createdAt:new Date().toISOString(),sender:{id:e,name:u,picture:null},reactions:{},...Y}),T=(q,Y)=>N(X=>{const Q=X.messages.findIndex(he=>he.clientNonce===q);if(Q===-1)return{...X,messages:[...X.messages,Y]};const ie=[...X.messages];return ie[Q]={...ie[Q],status:"sending"},{...X,messages:ie}}),R=(q,Y)=>N(X=>{const Q=X.messages.filter(J=>!(J.id===q.id&&J.clientNonce!==Y)),ie=Q.findIndex(J=>J.clientNonce===Y||J.id===q.id),he={...q,clientNonce:Y,status:void 0};if(ie===-1)return{...X,messages:[...Q,he]};const ye=[...Q];return ye[ie]=he,{...X,messages:ye}}),O=q=>N(Y=>({...Y,messages:Y.messages.map(X=>X.clientNonce===q&&uk(X.id)?{...X,status:"failed"}:X)})),F=jt({mutationFn:({text:q,nonce:Y})=>c?cAe(t.id,q,c,Y):Promise.reject(new Error("Community is required")),onMutate:({text:q,nonce:Y})=>T(Y,_(Y,{message:q})),onSuccess:(q,{nonce:Y})=>{R(q,Y),A()},onError:(q,{nonce:Y})=>{O(Y),d5(q,"Couldn't send message")}}),D=q=>{var Q;const Y=(((Q=s.getQueryData(h))==null?void 0:Q.messages)??[]).find(ie=>ie.clientNonce===q);if(!Y)return;const X=l5(q);X!=null&&X.length?B.mutate({files:X,nonce:q,text:Y.message??""}):F.mutate({text:Y.message??"",nonce:q})},I=q=>{c5(q),N(Y=>({...Y,messages:Y.messages.filter(X=>!(X.clientNonce===q&&uk(X.id)))}))},P=q=>p(Y=>{const X=new Set(Y);return X.delete(q),X}),M=jt({mutationFn:({id:q,forEveryone:Y})=>c?u2t(q,{forEveryone:Y,communityId:c}):Promise.reject(new Error("Community is required")),onSuccess:(q,{id:Y})=>{N(X=>({...X,messages:X.messages.filter(Q=>Q.id!==Y)})),A()},onError:(q,{id:Y})=>{P(Y),He.error(Dt(q instanceof ze?q.body:q,"Couldn't delete message"))}}),z=(q,Y)=>{p(ie=>new Set(ie).add(q));let X=!1;const Q=ie=>{X||(X=!0,ie())};He(Y?"Message deleted for everyone":"Message deleted for you",{duration:5e3,action:{label:"Undo",onClick:()=>Q(()=>P(q))},onAutoClose:()=>Q(()=>M.mutate({id:q,forEveryone:Y})),onDismiss:()=>Q(()=>M.mutate({id:q,forEveryone:Y}))})},G=jt({mutationFn:({id:q,text:Y})=>c?kur(q,Y,c):Promise.reject(new Error("Community is required")),onSuccess:q=>{N(Y=>({...Y,messages:Y.messages.map(X=>X.id===q.id?q:X)}))},onError:q=>He.error(Dt(q instanceof ze?q.body:q,"Couldn't edit message"))}),B=jt({mutationFn:({files:q,nonce:Y,text:X})=>c?jur(t.id,q,c,Y,X):Promise.reject(new Error("Community is required")),onMutate:({files:q,nonce:Y,text:X})=>{const Q=l5(Y)?void 0:CRe(Y,q);T(Y,_(Y,{message:X,attachments:jRe(q,Q??[])}))},onSuccess:(q,{nonce:Y})=>{R(q,Y),c5(Y),A()},onError:(q,{nonce:Y})=>{O(Y),d5(q,"Couldn't upload attachment")}}),H=((le=m.data)==null?void 0:le.requestState)??"none",W=()=>{s.invalidateQueries({queryKey:h}),s.invalidateQueries({queryKey:["dm-requests",c]}),A()},V=jt({mutationFn:()=>c?xur(t.id,c):Promise.reject(new Error("Community is required")),onSuccess:()=>{He.success("Request accepted"),W()},onError:q=>He.error(Dt(q instanceof ze?q.body:q,"Couldn't accept request"))}),U=jt({mutationFn:()=>c?wur(t.id,c):Promise.reject(new Error("Community is required")),onSuccess:()=>{He.success("Request rejected"),W()},onError:q=>He.error(Dt(q instanceof ze?q.body:q,"Couldn't reject request"))}),ne=y.useMemo(()=>{let q="";return g.map(Y=>{const X=o4r(Y.createdAt),Q=X&&X!==q?X:void 0;q=X||q;const ie={};for(const[he,ye]of Object.entries(Y.reactions??{}))ie[he]=ye.map(J=>E.get(J)??"Someone");return Y.messageType==="call"&&Y.call?{id:Y.id,senderId:Y.sender.id,author:Y.sender.name,time:Cue(Y.createdAt),text:Y.message,date:Q,canDelete:!1,canEdit:!1,customContent:a.jsx(r5t,{summary:Y.call,iCalled:Y.sender.id===e,time:Cue(Y.createdAt),target:{kind:"dm",user:t}})}:{id:Y.id,senderId:Y.sender.id,author:Y.sender.id===e?u:Y.sender.name,avatar:Y.sender.picture??null,time:Cue(Y.createdAt),text:Y.message,date:Q,verified:Y.sender.isVerifiedByPensil,edited:Y.isEdited,reactions:Object.keys(ie).length?ie:void 0,attachments:Y.attachments,clientNonce:Y.clientNonce??void 0,status:Y.status,canDelete:!Y.status&&(Y.sender.id===e||d),canDeleteForEveryone:!Y.status&&d,canEdit:!Y.status&&Y.sender.id===e&&!!Y.message,replyCount:Y.replyCount,replyParticipants:Y.replyParticipants,readState:Y.sender.id===e?Y.isRead?"read":"sent":void 0}})},[g,E,e,u,d,t]),te=async(q,Y)=>{if(!c)return;const X=g.find(he=>he.id===q),Q=X?Object.entries(X.reactions??{}).find(([,he])=>he.includes(e)):void 0,ie=(Q==null?void 0:Q[0])===Y;try{const he=ie?await m2t(q,c):await h2t(q,Y,c);N(ye=>({...ye,messages:ye.messages.map(J=>J.id===q?he:J)}))}catch{He.error("Couldn't update reaction")}};let re=null;return H==="incoming-pending"?re=a.jsxs("div",{className:"border-t border-border px-5 py-3",children:[a.jsxs("p",{className:"mb-2 text-sm text-muted-foreground",children:[a.jsx("span",{className:"font-medium text-foreground",children:t.name})," wants to send you a message. Accept to start chatting."]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{type:"button",onClick:()=>U.mutate(),disabled:U.isPending||V.isPending,className:"flex-1 rounded-md border border-border px-3 py-2 text-sm font-medium text-foreground transition-colors hover:bg-muted disabled:opacity-60",children:"Reject"}),a.jsx("button",{type:"button",onClick:()=>V.mutate(),disabled:V.isPending||U.isPending,className:"flex-1 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-60",children:"Accept"})]})]}):H==="outgoing-pending"?re=a.jsxs("div",{className:"border-t border-border px-5 py-4 text-center text-sm text-muted-foreground",children:["Message request sent — you can send more once ",a.jsx("span",{className:"font-medium text-foreground",children:t.name})," accepts."]}):H==="outgoing-rejected"&&(re=a.jsx("div",{className:"border-t border-border px-5 py-4 text-center text-sm text-muted-foreground",children:"Your message request was declined."})),a.jsx(TRe,{activeContact:t.name,headerAvatar:t.picture??null,subtitle:n?a.jsx(Xpr,{presence:n}):void 0,headerAvatarBadge:a.jsx(zAe,{presence:n}),headerAction:a.jsx(n5t,{target:{kind:"dm",user:t},disabledReason:H==="incoming-pending"?"Accept the message request to call":H==="outgoing-pending"||H==="outgoing-rejected"?"You can call once they've accepted your message request":null}),messages:ne,currentUserId:e,footerSlot:re,onSend:q=>(F.mutate({text:q,nonce:s2()}),Promise.resolve(!0)),onResend:D,onDiscardFailed:I,onReact:te,onDelete:z,onEdit:(q,Y)=>G.mutate({id:q,text:Y}),onSendWithAttachments:(q,Y)=>(B.mutate({files:q,text:Y,nonce:s2()}),Promise.resolve(!0)),onOpenThread:q=>r({kind:"dm",parentId:q,partnerId:t.id,nameById:Object.fromEntries(E)}),onLoadMore:S?j:void 0,loadingMore:w,unreadFromId:x})}const c4r=["ringing","ongoing"],B0=ote,d4r=wut,u4r=lte,s5t=y.forwardRef(({className:t,...e},n)=>a.jsx(xI,{className:ee("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",t),...e,ref:n}));s5t.displayName=xI.displayName;const h4r=cI("fixed z-50 gap-4 bg-background p-6 shadow-lg transition ease-in-out data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:duration-500",{variants:{side:{top:"inset-x-0 top-0 border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top",bottom:"inset-x-0 bottom-0 border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom",left:"inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm",right:"inset-y-0 right-0 h-full w-3/4  border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm"}},defaultVariants:{side:"right"}}),Xy=y.forwardRef(({side:t="right",className:e,children:n,...r},s)=>a.jsxs(u4r,{children:[a.jsx(s5t,{}),a.jsxs(wI,{ref:s,className:ee(h4r({side:t}),e),...r,children:[n,a.jsxs(cte,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity data-[state=open]:bg-secondary hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none",children:[a.jsx(nn,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:"Close"})]})]})]}));Xy.displayName=wI.displayName;const eb=({className:t,...e})=>a.jsx("div",{className:ee("flex flex-col space-y-2 text-center sm:text-left",t),...e});eb.displayName="SheetHeader";const _Re=({className:t,...e})=>a.jsx("div",{className:ee("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...e});_Re.displayName="SheetFooter";const tb=y.forwardRef(({className:t,...e},n)=>a.jsx(l7,{ref:n,className:ee("text-lg font-semibold text-foreground",t),...e}));tb.displayName=l7.displayName;const g9=y.forwardRef(({className:t,...e},n)=>a.jsx(c7,{ref:n,className:ee("text-sm text-muted-foreground",t),...e}));g9.displayName=c7.displayName;function qWe(t){return t.split(" ").map(e=>e[0]).filter(Boolean).join("").slice(0,2).toUpperCase()}const m4r=100,f4r=250,jue=12;function ARe({communityId:t,excludeIds:e=[],selected:n,onChange:r,allowSelectAll:s=!1,maxSelected:i,maxSelectedNote:o}){var _,T;const[l,c]=y.useState(""),[d,u]=y.useState(""),[h,m]=y.useState(!1),[f,p]=y.useState(!1);y.useEffect(()=>{const R=setTimeout(()=>u(l.trim()),300);return()=>clearTimeout(R)},[l]);const{data:g,isLoading:v}=lt({queryKey:["community-subscribers",t,d],queryFn:()=>Dy(t,{search:d}),enabled:!!t}),b=y.useMemo(()=>new Set([...e,...n.map(R=>R.id)]),[e,n]),x=((g==null?void 0:g.users)??[]).filter(R=>!b.has(R.id)),w=((g==null?void 0:g.total)??0)>(((_=g==null?void 0:g.users)==null?void 0:_.length)??0),k=Math.max(0,(d?0:(g==null?void 0:g.total)??0)-e.length),S=k>0&&n.length>=k,C=i??f4r,j=n.length>=C,E=i!==void 0&&n.length>=i,N=async()=>{m(!0);try{const R=new Set(e),O=new Map(n.map(I=>[I.id,I]));let F=!1,D=0;for(let I=1;!F;I+=1){const P=await Dy(t,{page:I,limit:m4r});D+=P.users.length;for(const M of P.users)if(!(R.has(M.id)||O.has(M.id))){if(O.size>=C){F=!0;break}O.set(M.id,M)}if(P.users.length===0||D>=P.total)break}r([...O.values()]),p(F)}catch{He.error("Couldn't select all members. Please try again.")}finally{m(!1)}},A=R=>{n.some(O=>O.id===R.id)?r(n.filter(O=>O.id!==R.id)):E||r([...n,R])};return a.jsxs("div",{className:"space-y-2",children:[s&&a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsxs("span",{className:"text-xs text-muted-foreground","aria-live":"polite",children:[n.length," selected"]}),a.jsxs("span",{className:"flex items-center gap-1.5",children:[n.length>0&&a.jsx("button",{type:"button",disabled:h,onClick:()=>r([]),className:"rounded-md px-2 py-1 text-xs font-medium text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50",children:"Clear"}),a.jsxs("button",{type:"button",disabled:h||S||j||!t,onClick:()=>void N(),className:"inline-flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground hover:bg-muted disabled:opacity-50",children:[h?a.jsx(Ne,{className:"h-3 w-3 animate-spin"}):a.jsx(Qn,{className:"h-3 w-3"}),h?"Selecting…":S?"All selected":"Select all"]}),a.jsxs(gn,{label:"Select all",children:["Selects every member of this community, not only the ones listed below, up to"," ",C," people. You can still remove individual people before creating the group."]})]})]}),E?a.jsxs("p",{className:"rounded-md bg-muted px-2.5 py-1.5 text-xs text-muted-foreground",role:"status",children:[o?`${o} `:"",f?"Not everyone in this community was selected. ":"",i===0?"There is no room to add anyone.":"Remove someone to add another."]}):s&&f&&j?a.jsxs("p",{className:"rounded-md bg-muted px-2.5 py-1.5 text-xs text-muted-foreground",role:"status",children:["Select all adds up to ",C," members, so not everyone in this community was selected. Search for anyone else you need and add them one by one."]}):null,n.length>0&&a.jsxs("div",{className:"themed-scrollbar flex max-h-24 flex-wrap gap-1.5 overflow-y-auto",children:[n.slice(0,jue).map(R=>a.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-primary/10 py-0.5 pl-1 pr-1.5 text-xs text-primary",children:[a.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-primary/20 text-[9px] font-semibold",children:qWe(R.name)}),R.name,a.jsx("button",{type:"button",onClick:()=>A(R),className:"rounded-full hover:bg-primary/20","aria-label":`Remove ${R.name}`,children:a.jsx(nn,{className:"h-3 w-3"})})]},R.id)),n.length>jue&&a.jsxs("span",{className:"inline-flex items-center rounded-full bg-muted px-2 py-0.5 text-xs text-muted-foreground",children:["+",n.length-jue," more"]})]}),a.jsxs("div",{className:"relative",children:[a.jsx(hs,{className:"absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{type:"text",value:l,onChange:R=>c(R.target.value),placeholder:"Search members…",className:"h-9 w-full rounded-md border border-input bg-background pl-9 pr-3 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]}),a.jsx("div",{className:"max-h-56 overflow-y-auto rounded-md border border-border",children:v?a.jsx("p",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"Loading…"}):x.length===0?a.jsx("p",{className:"px-3 py-6 text-center text-xs text-muted-foreground",children:"No members found"}):x.map(R=>{const O=n.some(F=>F.id===R.id);return a.jsxs("button",{type:"button",onClick:()=>A(R),disabled:E&&!O,className:ee("flex w-full items-center gap-3 px-3 py-2 text-left hover:bg-muted/50 transition-colors disabled:cursor-not-allowed disabled:opacity-50",O&&"bg-muted/40"),children:[R.picture?a.jsx("img",{src:R.picture,alt:"",className:"h-8 w-8 rounded-full object-cover"}):a.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-primary/10 text-[10px] font-semibold text-primary",children:qWe(R.name)}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-sm font-medium text-foreground",children:R.name}),R.userId&&a.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:["@",R.userId]})]}),O&&a.jsx(Qn,{className:"h-4 w-4 shrink-0 text-primary"})]},R.id)})}),w&&a.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Showing the first ",(T=g==null?void 0:g.users)==null?void 0:T.length,". Type to narrow the list."]})]})}function p4r(t){return t.split(" ").map(e=>e[0]).filter(Boolean).join("").slice(0,2).toUpperCase()}function g4r({open:t,onOpenChange:e,conversation:n,currentUserId:r,onLeft:s}){const i=rn(),o=n.createdBy===r,l=o||n.memberAddPolicy==="everyone",[c,d]=y.useState(n.name??""),[u,h]=y.useState([]),m=y.useRef(null),f=()=>i.invalidateQueries({queryKey:["conversations",n.community]}),p=jt({mutationFn:C=>_ur(n.id,C),onSuccess:()=>{f(),He.success("Group picture updated")},onError:()=>He.error("Couldn't update the group picture")}),g=jt({mutationFn:()=>_3(n.id,{avatar:""}),onSuccess:()=>{f(),He.success("Group picture removed")},onError:()=>He.error("Couldn't remove the group picture")}),v=jt({mutationFn:C=>_3(n.id,{memberAddPolicy:C}),onSuccess:()=>{f(),He.success("Permission updated")},onError:()=>He.error("Couldn't update permission")}),b=jt({mutationFn:()=>_3(n.id,{name:c.trim()}),onSuccess:()=>{f(),He.success("Group renamed")},onError:()=>He.error("Couldn't rename the group")}),x=jt({mutationFn:C=>_3(n.id,{remove:[C]}),onSuccess:()=>{f(),He.success("Member removed")},onError:()=>He.error("Couldn't remove member")}),w=jt({mutationFn:()=>_3(n.id,{add:u.map(C=>C.id)}),onSuccess:()=>{f(),h([]),He.success("Members added")},onError:C=>He.error(C instanceof ze&&C.status===422?C.message:"Couldn't add members")}),k=jt({mutationFn:()=>Aur(n.id),onSuccess:()=>{f(),He.success("You left the group"),e(!1),s()},onError:()=>He.error("Couldn't leave the group")}),S=c.trim()!==(n.name??"").trim();return a.jsx(B0,{open:t,onOpenChange:e,children:a.jsxs(Xy,{side:"right",className:"w-[360px] overflow-y-auto sm:max-w-[360px]",children:[a.jsx(eb,{children:a.jsx(tb,{children:"Group settings"})}),a.jsxs("div",{className:"mt-5 space-y-6",children:[a.jsxs("div",{className:"flex flex-col items-center gap-2",children:[a.jsxs("div",{className:"relative h-20 w-20",children:[n.avatar?a.jsx("img",{src:n.avatar,alt:"",className:"h-20 w-20 rounded-full object-cover"}):a.jsx("span",{className:"flex h-20 w-20 items-center justify-center rounded-full bg-primary/10 text-primary",children:a.jsx(wr,{className:"h-8 w-8"})}),o&&a.jsx("button",{onClick:()=>{var C;return(C=m.current)==null?void 0:C.click()},disabled:p.isPending,className:"absolute -bottom-0.5 -right-0.5 flex h-7 w-7 items-center justify-center rounded-full border-2 border-card bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50",title:"Change group picture",children:p.isPending?a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(FP,{className:"h-3.5 w-3.5"})}),a.jsx("input",{ref:m,type:"file",accept:"image/*",className:"hidden",onChange:C=>{var E;const j=(E=C.target.files)==null?void 0:E[0];j&&p.mutate(j),C.target.value=""}})]}),o&&(n.avatar?a.jsxs("button",{type:"button",onClick:()=>g.mutate(),disabled:g.isPending||p.isPending,className:"inline-flex items-center gap-1 text-[11px] text-muted-foreground transition-colors hover:text-destructive disabled:opacity-60",children:[a.jsx(qn,{className:"h-3 w-3"}),g.isPending?"Removing…":"Remove photo"]}):a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Tap the camera to set a group picture"}))]}),o&&a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Group name"}),a.jsxs("div",{className:"mt-1 flex gap-2",children:[a.jsx("input",{type:"text",value:c,onChange:C=>d(C.target.value),placeholder:"Unnamed group",className:"h-9 flex-1 rounded-md border border-input bg-background px-3 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),a.jsx("button",{disabled:!S||b.isPending,onClick:()=>b.mutate(),className:"h-9 rounded-md bg-primary px-3 text-sm text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50",children:"Save"})]})]}),a.jsxs("div",{children:[a.jsxs("h4",{className:"text-sm font-medium text-foreground",children:["Members ",a.jsxs("span",{className:"text-muted-foreground",children:["(",n.participants.length,")"]})]}),a.jsx("div",{className:"mt-2 space-y-1",children:n.participants.map(C=>{const j=C.id===n.createdBy,E=C.id===r;return a.jsxs("div",{className:"flex items-center gap-3 rounded-md px-1 py-1.5",children:[C.picture?a.jsx("img",{src:C.picture,alt:"",className:"h-8 w-8 rounded-full object-cover"}):a.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-primary/10 text-[10px] font-semibold text-primary",children:p4r(C.name)}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"flex items-center gap-1 text-sm font-medium text-foreground",children:[a.jsx("span",{className:"truncate",children:E?"You":C.name}),j&&a.jsx(_rt,{className:"h-3 w-3 shrink-0 text-amber-500","aria-label":"Creator"})]}),C.userId&&a.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:["@",C.userId]})]}),o&&!E&&a.jsx("button",{onClick:()=>x.mutate(C.id),disabled:x.isPending,className:"flex h-7 w-7 items-center justify-center rounded hover:bg-destructive/10 disabled:opacity-50",title:"Remove member",children:a.jsx(O8,{className:"h-4 w-4 text-destructive"})})]},C.id)})})]}),o&&a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Who can add members"}),a.jsxs("select",{value:n.memberAddPolicy??"creator",onChange:C=>v.mutate(C.target.value),disabled:v.isPending,className:"mt-1 h-9 w-full rounded-md border border-input bg-background px-3 text-sm focus:outline-none focus:ring-1 focus:ring-ring disabled:opacity-50",children:[a.jsx("option",{value:"creator",children:"Only me (creator)"}),a.jsx("option",{value:"everyone",children:"Any member"})]})]}),l&&a.jsxs("div",{children:[a.jsxs("h4",{className:"flex items-center gap-1.5 text-sm font-medium text-foreground",children:[a.jsx(Sa,{className:"h-4 w-4"})," Add members"]}),a.jsx("div",{className:"mt-2",children:a.jsx(ARe,{communityId:n.community,excludeIds:n.participants.map(C=>C.id),selected:u,onChange:h,maxSelected:Math.max(0,dAe-n.participants.length),maxSelectedNote:y2t})}),u.length>0&&a.jsx("button",{onClick:()=>w.mutate(),disabled:w.isPending,className:"mt-2 h-9 w-full rounded-md bg-primary text-sm text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50",children:w.isPending?"Adding…":`Add ${u.length} member${u.length>1?"s":""}`})]}),a.jsxs("div",{className:"border-t border-border pt-4",children:[a.jsxs("button",{onClick:()=>k.mutate(),disabled:k.isPending,className:"flex h-9 w-full items-center justify-center gap-2 rounded-md border border-destructive/40 text-sm font-medium text-destructive hover:bg-destructive/10 transition-colors disabled:opacity-50",children:[a.jsx(sI,{className:"h-4 w-4"}),k.isPending?"Leaving…":"Leave group"]}),o&&a.jsx("p",{className:"mt-1.5 text-[11px] text-muted-foreground",children:"As the creator, leaving transfers ownership to the oldest remaining member."})]})]})]})})}function Eue(t){const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function v4r(t){const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric"})}function y4r({conversation:t,currentUserId:e,onLeave:n,onOpenThread:r}){var W;const s=rn(),{community:i}=qe(),{socket:o}=Qg(),{user:l}=jr(),c=(i==null?void 0:i.id)??null,d=l?`${l.firstName} ${l.lastName}`:"You",[u,h]=y.useState(!1),m=t.id,f=["conversation-thread",m],p=lt({queryKey:f,queryFn:async()=>{const V=s.getQueryData(f);return JRt(V,ERe(await PVe(m),V))}}),g=y.useMemo(()=>p.data??[],[p.data]),v=["conversation-call",m],b=lt({queryKey:v,queryFn:async()=>(await H3r(m)).call});y.useEffect(()=>{if(!o)return;const V=ne=>{ne.call.conversation===m&&s.setQueryData(v,c4r.includes(ne.call.status)?ne.call:null)},U=ne=>{ne.call.conversation===m&&s.setQueryData(v,ne.call)};return o.on("call:update",V),o.on("call:incoming",U),()=>{o.off("call:update",V),o.off("call:incoming",U)}},[o,m,s]);const x=b.data&&b.data.status==="ongoing"?b.data:null,w=y.useMemo(()=>({kind:"group",conversation:{id:m,name:YR(t,e),avatar:t.avatar??null,members:t.participants}}),[m,t,e]),k=y.useRef(null);k.current===null&&(k.current=t.unreadCount??0);const S=y.useRef(void 0);if(S.current===void 0&&g.length>0){const V=k.current??0;if(V>0){const U=g.filter(ne=>ne.sender.id!==e);S.current=U.length>=V?U[U.length-V].id:((W=U[0])==null?void 0:W.id)??null}else S.current=null}const C=S.current??null,[j,E]=y.useState(!1),[N,A]=y.useState(!0),_=y.useCallback(async()=>{const V=p.data??[];if(!(j||!N||!V.length)){E(!0);try{const U=await PVe(m,V[0].id);U.length&&s.setQueryData(f,ne=>{const te=new Set((ne??[]).map(re=>re.id));return[...U.filter(re=>!te.has(re.id)),...ne??[]]}),U.length<10&&A(!1)}catch{}finally{E(!1)}}},[j,N,p.data,m]),T=V=>{s.setQueryData(f,U=>V(U??[]))},R=()=>{s.invalidateQueries({queryKey:["conversations",c]}),s.invalidateQueries({queryKey:["user-counters"]})},O=y.useMemo(()=>{const V=new Map;for(const U of t.participants)V.set(U.id,U.id===e?d:U.name);return V},[t.participants,e,d]);y.useEffect(()=>{(t.unreadCount>0||t.isMarkedUnread)&&Qxe(m).then(R)},[m]),y.useEffect(()=>{if(!o)return;const V=le=>{T(q=>{const Y=le.message,X=q.findIndex(ie=>ie.id===Y.id||Y.clientNonce&&ie.clientNonce===Y.clientNonce);if(X===-1)return[...q,Y];const Q=[...q];return Q[X]={...Q[X],...Y,status:void 0},Q}),Qxe(m).then(R)},U=le=>T(q=>q.map(Y=>Y.id===le.message.id?le.message:Y)),ne=le=>T(q=>q.filter(Y=>Y.id!==le.messageId)),te=le=>T(q=>q.map(Y=>Y.id===le.messageId?{...Y,reactions:le.reactions}:Y)),re=le=>T(q=>q.map(Y=>Y.id===le.parentId?{...Y,replyCount:le.parent.replyCount,replyParticipants:le.parent.replyParticipants}:Y)),fe=le=>T(q=>q.map(Y=>Y.status||(Y.readBy??[]).includes(le.userId)?Y:{...Y,readBy:[...Y.readBy??[],le.userId]}));return o.on(`conversation:${m}:message-received`,V),o.on(`conversation:${m}:message-edited`,U),o.on(`conversation:${m}:message-deleted`,ne),o.on(`conversation:${m}:reaction-updated`,te),o.on(`conversation:${m}:thread-reply`,re),o.on(`conversation:${m}:messages-read`,fe),()=>{o.off(`conversation:${m}:messages-read`,fe),o.off(`conversation:${m}:message-received`,V),o.off(`conversation:${m}:message-edited`,U),o.off(`conversation:${m}:message-deleted`,ne),o.off(`conversation:${m}:reaction-updated`,te),o.off(`conversation:${m}:thread-reply`,re)}},[o,m]);const F=jt({mutationFn:({text:V,nonce:U})=>f2t(m,V,U),onMutate:({text:V,nonce:U})=>{const ne={id:SF(U),clientNonce:U,status:"sending",message:V,createdAt:new Date().toISOString(),sender:{id:e,name:d,picture:null},reactions:{}};T(te=>{const re=te.findIndex(le=>le.clientNonce===U);if(re===-1)return[...te,ne];const fe=[...te];return fe[re]={...fe[re],status:"sending"},fe})},onSuccess:(V,{nonce:U})=>{T(ne=>{const te=ne.filter(q=>!(q.id===V.id&&q.clientNonce!==U)),re=te.findIndex(q=>q.clientNonce===U||q.id===V.id),fe={...V,clientNonce:U,status:void 0};if(re===-1)return[...te,fe];const le=[...te];return le[re]=fe,le}),R()},onError:(V,{nonce:U})=>{T(ne=>ne.map(te=>te.clientNonce===U&&uk(te.id)?{...te,status:"failed"}:te)),d5(V,"Couldn't send message")}}),D=V=>{const U=(s.getQueryData(f)??[]).find(te=>te.clientNonce===V);if(!U)return;const ne=l5(V);ne!=null&&ne.length?z.mutate({files:ne,nonce:V,text:U.message??""}):F.mutate({text:U.message??"",nonce:V})},I=V=>{c5(V),T(U=>U.filter(ne=>!(ne.clientNonce===V&&uk(ne.id))))},P=jt({mutationFn:({id:V,text:U})=>Pur(m,V,U),onSuccess:V=>{T(U=>U.map(ne=>ne.id===V.id?V:ne)),R()},onError:V=>He.error(Dt(V instanceof ze?V.body:V,"Couldn't edit message"))}),M=jt({mutationFn:V=>p2t(m,V),onSuccess:(V,U)=>{T(ne=>ne.filter(te=>te.id!==U)),R()},onError:()=>He.error("Couldn't delete message")}),z=jt({mutationFn:({files:V,nonce:U,text:ne})=>Iur(m,V,U,ne),onMutate:({files:V,nonce:U,text:ne})=>{const te=l5(U)?[]:CRe(U,V),re={id:SF(U),clientNonce:U,status:"sending",message:ne,attachments:jRe(V,te),createdAt:new Date().toISOString(),sender:{id:e,name:d,picture:null},reactions:{}};T(fe=>{const le=fe.findIndex(Y=>Y.clientNonce===U);if(le===-1)return[...fe,re];const q=[...fe];return q[le]={...q[le],status:"sending"},q})},onSuccess:(V,{nonce:U})=>{T(ne=>{const te=ne.filter(q=>!(q.id===V.id&&q.clientNonce!==U)),re=te.findIndex(q=>q.clientNonce===U||q.id===V.id),fe={...V,clientNonce:U,status:void 0};if(re===-1)return[...te,fe];const le=[...te];return le[re]=fe,le}),c5(U),R()},onError:(V,{nonce:U})=>{T(ne=>ne.map(te=>te.clientNonce===U&&uk(te.id)?{...te,status:"failed"}:te)),d5(V,"Couldn't upload attachment")}}),G=async(V,U)=>{const ne=g.find(fe=>fe.id===V),te=ne?Object.entries(ne.reactions??{}).find(([,fe])=>fe.includes(e)):void 0,re=(te==null?void 0:te[0])===U;try{const fe=re?await v2t(m,V):await g2t(m,V,U);T(le=>le.map(q=>q.id===V?fe:q))}catch{He.error("Couldn't update reaction")}},B=y.useMemo(()=>t.participants.map(V=>V.id).filter(V=>V!==e),[t.participants,e]),H=y.useMemo(()=>{let V="";return g.map(U=>{const ne=v4r(U.createdAt),te=ne&&ne!==V?ne:void 0;V=ne||V;const re={};for(const[fe,le]of Object.entries(U.reactions??{}))re[fe]=le.map(q=>O.get(q)??"Someone");return U.messageType==="call"&&U.call?{id:U.id,senderId:U.sender.id,author:U.sender.name,time:Eue(U.createdAt),text:U.message,date:te,canDelete:!1,canEdit:!1,customContent:a.jsx(r5t,{summary:U.call,iCalled:U.sender.id===e,time:Eue(U.createdAt),target:w})}:{id:U.id,senderId:U.sender.id,author:U.sender.id===e?d:U.sender.name,avatar:U.sender.picture??null,time:Eue(U.createdAt),text:U.message,date:te,verified:U.sender.isVerifiedByPensil,edited:U.isEdited,reactions:Object.keys(re).length?re:void 0,attachments:U.attachments,clientNonce:U.clientNonce??void 0,status:U.status,canDelete:!U.status&&U.sender.id===e,canEdit:!U.status&&U.sender.id===e&&!!U.message,replyCount:U.replyCount,replyParticipants:U.replyParticipants,readState:U.sender.id===e?B.length>0&&B.every(fe=>(U.readBy??[]).includes(fe))?"read":"sent":void 0}})},[g,O,e,d,B,w]);return a.jsxs(a.Fragment,{children:[a.jsx(TRe,{activeContact:YR(t,e),headerAvatar:t.avatar??null,subtitle:`${t.participants.length} members`,headerAction:a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(n5t,{target:w}),a.jsx("button",{onClick:()=>h(!0),className:"flex h-8 w-8 items-center justify-center rounded-md hover:bg-muted transition-colors",title:"Group settings",children:a.jsx(w2,{className:"h-4 w-4 text-muted-foreground"})})]}),topSlot:x?a.jsx(a4r,{call:x}):null,messages:H,currentUserId:e,onSend:V=>(F.mutate({text:V,nonce:s2()}),Promise.resolve(!0)),onResend:D,onDiscardFailed:I,onReact:G,onDelete:V=>M.mutate(V),confirmDelete:!0,onEdit:(V,U)=>P.mutate({id:V,text:U}),onSendWithAttachments:(V,U)=>(z.mutate({files:V,text:U,nonce:s2()}),Promise.resolve(!0)),onOpenThread:V=>r({kind:"group",parentId:V,conversationId:m,nameById:Object.fromEntries(O)}),onLoadMore:N?_:void 0,loadingMore:j,unreadFromId:C}),a.jsx(g4r,{open:u,onOpenChange:h,conversation:t,currentUserId:e,onLeft:()=>{h(!1),n()}})]})}function b4r({open:t,onOpenChange:e,communityId:n,currentUserId:r,canSelectAll:s=!1,onCreated:i}){const o=rn(),[l,c]=y.useState(""),[d,u]=y.useState([]),h=()=>{c(""),u([])},m=jt({mutationFn:()=>Tur({communityId:n,participantIds:d.map(p=>p.id),name:l.trim()||void 0}),onSuccess:p=>{o.invalidateQueries({queryKey:["conversations",n]}),He.success("Group created"),h(),e(!1),i(p)},onError:p=>He.error(p instanceof ze&&p.status===422?p.message:"Couldn't create the group")}),f=d.length>=2&&!m.isPending;return a.jsx(Bt,{open:t,onOpenChange:p=>{p||h(),e(p)},children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] max-w-md rounded-lg p-5 sm:p-6",children:[a.jsx(Vt,{className:"pr-6 text-left",children:a.jsxs(Ut,{className:"flex items-center gap-2",children:[a.jsx(wr,{className:"h-4 w-4"})," New group"]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Group name ",a.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),a.jsx("input",{type:"text",value:l,onChange:p=>c(p.target.value),placeholder:"e.g. Weekend Football",className:"mt-1 h-9 w-full rounded-md border border-input bg-background px-3 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Add members ",a.jsx("span",{className:"font-normal text-muted-foreground",children:"(at least 2)"})]}),a.jsx("div",{className:"mt-1",children:a.jsx(ARe,{communityId:n,excludeIds:[r],selected:d,onChange:u,allowSelectAll:s,maxSelected:dAe-1,maxSelectedNote:y2t})})]})]}),a.jsxs(ir,{className:"gap-2 sm:gap-0",children:[a.jsx("button",{onClick:()=>e(!1),className:"h-9 rounded-md border border-border px-4 text-sm text-foreground hover:bg-muted transition-colors",children:"Cancel"}),a.jsx("button",{disabled:!f,onClick:()=>m.mutate(),className:"h-9 rounded-md bg-primary px-4 text-sm text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50",children:m.isPending?"Creating…":"Create group"})]})]})})}function x4r(t){return t.split(" ").map(e=>e[0]).filter(Boolean).join("").slice(0,2).toUpperCase()}function w4r(t){return{id:t.id,name:t.name,userId:t.userId,picture:t.picture??null,unreadMessageCount:0}}function k4r({open:t,onOpenChange:e,communityId:n,currentUserId:r,onSelect:s}){var m,f,p;const[i,o]=y.useState(""),[l,c]=y.useState("");y.useEffect(()=>{const g=setTimeout(()=>c(i.trim()),250);return()=>clearTimeout(g)},[i]);const d=lt({queryKey:["direct-message-member-search",n,l],queryFn:()=>Dy(n,{search:l,limit:12}),enabled:t&&!!n,staleTime:3e4}),u=y.useMemo(()=>{var g;return(((g=d.data)==null?void 0:g.users)??[]).filter(v=>v.id!==r)},[(m=d.data)==null?void 0:m.users,r]),h=()=>{o(""),c(""),e(!1)};return a.jsx(Bt,{open:t,onOpenChange:g=>{g?e(!0):h()},children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] max-w-md rounded-lg p-5 sm:p-6",children:[a.jsxs(Vt,{className:"pr-6 text-left",children:[a.jsxs(Ut,{className:"flex items-center gap-2",children:[a.jsx(pSe,{className:"h-5 w-5"})," New message"]}),a.jsx(_n,{children:"Search for a community member and start a private conversation."})]}),a.jsxs("div",{className:"relative",children:[a.jsx(hs,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{type:"search",value:i,onChange:g=>o(g.target.value),placeholder:"Search by name or username…","aria-label":"Search community members",autoFocus:!0,className:"h-10 w-full rounded-md border border-input bg-background pl-9 pr-3 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"})]}),a.jsx("div",{className:"min-h-48 max-h-80 overflow-y-auto rounded-lg border border-border",children:d.isLoading?a.jsxs("div",{className:"flex h-48 items-center justify-center gap-2 text-sm text-muted-foreground",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"})," Loading members…"]}):d.isError?a.jsx("div",{className:"flex h-48 items-center justify-center px-6 text-center text-sm text-destructive",children:"Couldn't load community members. Please try again."}):u.length===0?a.jsxs("div",{className:"flex h-48 flex-col items-center justify-center px-6 text-center",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"No members found"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:l?"Try another name or username.":"There are no other members to message yet."})]}):u.map(g=>a.jsxs("button",{type:"button",onClick:()=>{s(g),h()},className:"flex w-full items-center gap-3 border-b border-border px-3 py-3 text-left transition-colors last:border-b-0 hover:bg-muted/60 focus-visible:bg-muted/60 focus-visible:outline-none",children:[g.picture?a.jsx("img",{src:g.picture,alt:"",className:"h-10 w-10 shrink-0 rounded-full object-cover"}):a.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-primary/10 text-xs font-semibold text-primary",children:x4r(g.name)}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-sm font-medium text-foreground",children:g.name}),a.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:g.userId?`@${g.userId}`:"Community member"})]}),a.jsx("span",{className:"text-xs font-medium text-primary",children:"Message"})]},g.id))}),(((f=d.data)==null?void 0:f.total)??0)>(((p=d.data)==null?void 0:p.users.length)??0)&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"Type more of the name or username to narrow the results."})]})})}function S4r(t){return t.split(" ").map(e=>e[0]).filter(Boolean).join("").slice(0,2).toUpperCase()}function C4r(t){const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function j4r({thread:t,currentUserId:e,onClose:n}){var _;const r=rn(),{socket:s}=Qg(),{community:i}=qe(),o=(i==null?void 0:i.id)??"",l=(i==null?void 0:i.myRole)==="admin"||!!(i!=null&&i.isByMe),[c,d]=y.useState(""),[u,h]=y.useState(null),m=y.useRef(null),f=["thread",o,t.parentId],p=t.kind==="group"?["conversation-thread",t.conversationId]:["dm-thread",o,t.partnerId],g=t.kind==="group"?`conversation:${t.conversationId}:thread-reply`:`direct-message:${t.partnerId}:thread-reply`,v=t.kind==="group"?`conversation:${t.conversationId}:reaction-updated`:`direct-message:${t.partnerId}:reaction-updated`,b=lt({queryKey:f,queryFn:async()=>{const T=t.kind==="group"?await Mur(t.conversationId,t.parentId):await Eur(t.parentId,o);return{parent:T.parent,replies:T.replies}},enabled:t.kind==="group"||!!o}),x=(_=b.data)==null?void 0:_.parent,w=y.useMemo(()=>{var T;return((T=b.data)==null?void 0:T.replies)??[]},[b.data]),k=T=>{r.setQueryData(f,R=>R&&T(R))},S=()=>r.invalidateQueries({queryKey:p});y.useEffect(()=>{m.current&&(m.current.scrollTop=m.current.scrollHeight)},[w.length]);const C=jt({mutationFn:async T=>{if(t.kind==="group")return await Lur(t.conversationId,t.parentId,T);if(!o)throw new Error("Community is required");return await Nur(t.parentId,T,o)},onSuccess:T=>{k(R=>({...R,replies:[...R.replies,T]})),S()},onError:T=>He.error(Dt(T instanceof ze?T.body:T,"Couldn't send reply"))}),j=jt({mutationFn:({id:T,forEveryone:R})=>t.kind==="group"?p2t(t.conversationId,T):o?u2t(T,{forEveryone:R,communityId:o}):Promise.reject(new Error("Community is required")),onSuccess:(T,{id:R})=>{k(O=>({...O,replies:O.replies.filter(F=>F.id!==R)})),S()},onError:T=>He.error(Dt(T instanceof ze?T.body:T,"Couldn't delete reply"))}),E=()=>{const T=c.trim();T&&(C.mutate(T),d(""))},N=async(T,R)=>{const F=[x,...w].filter(Boolean).find(P=>P.id===T),D=F?Object.entries(F.reactions??{}).find(([,P])=>P.includes(e)):void 0,I=(D==null?void 0:D[0])===R;try{const P=t.kind==="group"?I?await v2t(t.conversationId,T):await g2t(t.conversationId,T,R):I?await m2t(T,o):await h2t(T,R,o);k(M=>({parent:M.parent.id===T?P:M.parent,replies:M.replies.map(z=>z.id===T?P:z)}))}catch{He.error("Couldn't update reaction")}};y.useEffect(()=>{if(!s)return;const T=O=>{t.kind==="dm"&&!Kb(O.communityId,o)||O.parentId===t.parentId&&(O.reply?k(F=>F.replies.some(D=>D.id===O.reply.id)?F:{...F,replies:[...F.replies,O.reply]}):O.deletedReplyId&&k(F=>({...F,replies:F.replies.filter(D=>D.id!==O.deletedReplyId)})))},R=O=>{t.kind==="dm"&&!Kb(O.communityId,o)||k(F=>({parent:F.parent.id===O.messageId?{...F.parent,reactions:O.reactions}:F.parent,replies:F.replies.map(D=>D.id===O.messageId?{...D,reactions:O.reactions}:D)}))};return s.on(g,T),s.on(v,R),()=>{s.off(g,T),s.off(v,R)}},[s,o,t.parentId,g,v]);const A=(T,R)=>{const O=T.reactions??{};return a.jsxs("div",{className:ee("group/msg relative flex items-start gap-2.5",R&&"pb-3 border-b border-border"),children:[T.sender.picture?a.jsx("img",{src:T.sender.picture,alt:"",className:"h-7 w-7 rounded-full object-cover"}):a.jsx("div",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-primary/10 text-[10px] font-semibold text-primary shrink-0",children:S4r(T.sender.name)}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"text-xs font-semibold text-foreground",children:T.sender.id===e?"You":T.sender.name}),T.sender.isVerifiedByPensil&&a.jsx(vk,{className:"h-3 w-3 text-primary"}),a.jsx("span",{className:"text-[10px] text-muted-foreground",children:C4r(T.createdAt)}),T.isEdited&&a.jsx("span",{className:"text-[10px] text-muted-foreground",children:"(edited)"})]}),T.message&&a.jsx("div",{className:"mt-0.5 break-words text-sm text-foreground",children:NRe(T.message)}),T.attachments&&T.attachments.length>0&&a.jsx("div",{className:"mt-1.5 flex flex-wrap gap-2",children:T.attachments.map((F,D)=>(F.mimeType??"").startsWith("image/")?a.jsx("a",{href:F.url,target:"_blank",rel:"noreferrer",children:a.jsx("img",{src:F.url,alt:F.name??"",className:"max-h-32 rounded-lg border border-border object-cover"})},F.id??D):a.jsxs("a",{href:F.url,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1.5 rounded-md border border-border bg-muted/40 px-2 py-1 text-xs hover:bg-muted",children:[a.jsx(Ff,{className:"h-3 w-3 text-muted-foreground"}),a.jsx("span",{className:"max-w-[140px] truncate",children:F.name??"Attachment"})]},F.id??D))}),Object.keys(O).length>0&&a.jsx("div",{className:"mt-1.5 flex flex-wrap gap-1",children:Object.entries(O).map(([F,D])=>a.jsxs("button",{onClick:()=>N(T.id,F),className:ee("inline-flex items-center gap-1 rounded-full border px-1.5 py-0.5 text-xs transition-colors",D.includes(e)?"border-primary/50 bg-primary/10":"border-border hover:border-primary/30"),title:D.map(I=>t.nameById[I]??"Someone").join(", "),children:[F," ",D.length]},F))})]}),a.jsxs("div",{className:ee("absolute right-0 top-0 flex items-center gap-0.5 rounded-md border border-border bg-card p-0.5 shadow-sm",u===T.id?"opacity-100":"opacity-0 pointer-events-none group-hover/msg:opacity-100 group-hover/msg:pointer-events-auto"),children:[a.jsxs(Ni,{onOpenChange:F=>h(F?T.id:null),children:[a.jsx(Ti,{asChild:!0,children:a.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded hover:bg-muted",title:"React",children:a.jsx(Hx,{className:"h-3.5 w-3.5 text-muted-foreground"})})}),a.jsxs(yi,{className:"w-auto p-2",side:"bottom",align:"end",children:[a.jsx("div",{className:"mb-1.5 flex gap-1 border-b border-border pb-1.5",children:e5t.map(F=>a.jsx("button",{onClick:()=>N(T.id,F),className:"flex h-7 w-7 items-center justify-center rounded text-base hover:bg-muted",children:F},F))}),a.jsx($g,{onPick:F=>N(T.id,F)})]})]}),!R&&(t.kind!=="group"&&l?a.jsxs(Tr,{onOpenChange:F=>h(F?T.id:null),children:[a.jsx(_r,{asChild:!0,children:a.jsx("button",{className:"flex h-6 w-6 items-center justify-center rounded hover:bg-destructive/10",title:"Delete",children:a.jsx(qn,{className:"h-3.5 w-3.5 text-destructive"})})}),a.jsxs(Cr,{align:"end",side:"bottom",sideOffset:4,children:[a.jsx(ot,{onClick:()=>j.mutate({id:T.id,forEveryone:!1}),children:"Delete for me"}),a.jsx(ot,{className:"text-destructive focus:text-destructive",onClick:()=>j.mutate({id:T.id,forEveryone:!0}),children:"Delete for everyone"})]})]}):T.sender.id===e&&a.jsx("button",{onClick:()=>j.mutate({id:T.id,forEveryone:!0}),className:"flex h-6 w-6 items-center justify-center rounded hover:bg-destructive/10",title:"Delete",children:a.jsx(qn,{className:"h-3.5 w-3.5 text-destructive"})}))]})]},T.id)};return a.jsxs("div",{className:"flex w-96 shrink-0 flex-col border-l border-border bg-card",children:[a.jsxs("div",{className:"flex h-14 shrink-0 items-center justify-between border-b border-border px-4",children:[a.jsx("h3",{className:"text-base font-semibold leading-none text-foreground",children:"Thread"}),a.jsx("button",{onClick:n,className:"flex h-7 w-7 items-center justify-center rounded hover:bg-muted",title:"Close thread",children:a.jsx(nn,{className:"h-4 w-4 text-muted-foreground"})})]}),a.jsx("div",{ref:m,className:"flex-1 space-y-3 overflow-y-auto px-4 py-3",children:b.isLoading?a.jsx("p",{className:"py-8 text-center text-xs text-muted-foreground",children:"Loading thread…"}):x?a.jsxs(a.Fragment,{children:[A(x,!0),a.jsx("p",{className:"text-[11px] font-medium text-muted-foreground",children:w.length===0?"No replies yet":`${w.length} ${w.length===1?"reply":"replies"}`}),w.map(T=>A(T,!1))]}):a.jsx("p",{className:"py-8 text-center text-xs text-muted-foreground",children:"This message is no longer available."})}),a.jsx("div",{"data-chat-composer":!0,className:"border-t border-border p-3",children:a.jsxs("div",{className:"flex items-end gap-2 rounded-lg border border-border bg-background px-3 py-2",children:[a.jsx("textarea",{value:c,onChange:T=>d(T.target.value),onKeyDown:T=>{T.key==="Enter"&&!T.shiftKey&&(T.preventDefault(),E())},rows:1,placeholder:"Reply…",className:"max-h-28 flex-1 resize-none bg-transparent text-sm text-foreground placeholder:text-muted-foreground focus:outline-none"}),a.jsx("button",{onClick:E,disabled:!c.trim()||C.isPending,className:"flex h-8 w-8 items-center justify-center rounded-md bg-primary text-primary-foreground hover:bg-primary/90 disabled:opacity-50",title:"Send reply",children:a.jsx(_s,{className:"h-4 w-4"})})]})})]})}function E4r(t){return t.split(" ").map(e=>e[0]).filter(Boolean).join("").slice(0,2).toUpperCase()}function N4r({user:t}){return t?a.jsxs("div",{className:"flex flex-1 flex-col bg-background",children:[a.jsxs("div",{className:"flex h-14 shrink-0 items-center gap-2.5 border-b border-border px-4",children:[t.picture?a.jsx("img",{src:t.picture,alt:"",className:"h-9 w-9 rounded-full object-cover"}):a.jsx("div",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-primary/10 text-xs font-semibold text-primary",children:E4r(t.name)}),a.jsxs("div",{className:"min-w-0",children:[a.jsxs("span",{className:"flex items-center gap-1 text-base font-semibold leading-none text-foreground",children:[a.jsx("span",{className:"truncate",children:t.name}),t.isVerifiedByPensil&&a.jsx(vk,{className:"h-3.5 w-3.5 shrink-0 text-primary"})]}),t.userId&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["@",t.userId]})]})]}),a.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center px-6 text-center",children:[a.jsx(x2,{className:"h-10 w-10 text-muted-foreground/50"}),a.jsx("p",{className:"mt-3 text-sm font-medium text-foreground",children:"Messaging is coming soon"}),a.jsxs("p",{className:"mt-1 max-w-xs text-xs text-muted-foreground",children:["Your conversation with ",t.name.split(" ")[0]," will appear here once direct messaging is enabled."]})]})]}):a.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center bg-background text-center",children:[a.jsx(x2,{className:"h-10 w-10 text-muted-foreground/50"}),a.jsx("p",{className:"mt-3 text-sm font-medium text-foreground",children:"Select a conversation"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Choose someone from the list to view your messages."})]})}function CF({communityId:t,userId:e,emptyLabel:n="No posts yet.",variant:r="full",kind:s}){return r==="compact"?a.jsx(_4r,{communityId:t,userId:e,emptyLabel:n}):a.jsx(T4r,{communityId:t,userId:e,emptyLabel:n,kind:s})}function T4r({communityId:t,userId:e,emptyLabel:n,kind:r}){const s=Nn(),{user:i}=jr(),{community:o}=qe(),{communityDetail:l,groups:c}=Ln(),d=i?`${i.firstName} ${i.lastName}`:"Guest",u=i?Pk(i,40):"",h=(o==null?void 0:o.myRole)??(l==null?void 0:l.myRole),m=i9(h,!!((o==null?void 0:o.isByMe)??(l==null?void 0:l.isByMe))),f=y.useMemo(()=>{const S=new Map;for(const C of c)C.id&&C.myRole&&S.set(C.id,C.myRole);return S},[c]),p=y.useCallback(S=>a9(S.groupId?f.get(S.groupId):void 0),[f]),g=y.useCallback(async S=>!t||!e?{posts:[]}:{posts:await Zjt(t,e,S,r)},[t,e,r]),v=Dse({sort:"recent",duration:"",currentUserName:d,currentUserAvatar:u,currentUserId:(i==null?void 0:i.id)??null,loadPostsPage:g,enabled:!!(t&&e),restoreScope:`profile-posts:${e}${r?`:${r}`:""}`}),{featuredIds:b,toggleFeatured:x}=s9(),w=Ase({onPostSaved:S=>v.setFeedPosts(C=>C.map(j=>j.realId===S.id?Am(S,j.id):j)),onReposted:S=>v.bumpRepostCount(S.sharedId),onAuthorBlocked:v.removePostsByAuthor}),k=y.useCallback(S=>{var E;const C=c.find(N=>N.id===S.groupId),j=(E=C==null?void 0:C.tabs)==null?void 0:E.find(N=>N.id===S.channelId);C&&j&&s(_x(C,j))},[c,s]);return(v.isLoading||!t||!e)&&v.displayedPosts.length===0?a.jsx("div",{className:"space-y-3",children:[0,1,2].map(S=>a.jsx(sr,{className:"h-40 rounded-xl"},S))}):v.error&&v.displayedPosts.length===0?a.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-border bg-card p-8 text-center",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:v.error}),a.jsx(Z,{variant:"outline",size:"sm",onClick:v.refetch,children:"Try again"})]}):v.displayedPosts.length===0?a.jsx("div",{className:"rounded-xl border border-border bg-card p-5 text-sm text-muted-foreground",children:n}):a.jsxs(a.Fragment,{children:[a.jsx(Lse,{posts:v.displayedPosts,feed:v,currentUserAvatar:u,currentUserName:d,canFeature:m,getCanPin:p,featuredIds:b,onToggleFeatured:x,...w.listProps,onChannelClick:k,onReachEnd:v.loadMore,isLoadingMore:v.isLoadingMore,hasMore:v.hasMore,restoreScrollScope:`profile-posts:${e}`}),w.dialogs]})}function _4r({communityId:t,userId:e,emptyLabel:n}){const r=Nn(),[s,i]=y.useState([]),[o,l]=y.useState(1),[c,d]=y.useState(!1),[u,h]=y.useState(!1),[m,f]=y.useState(!1),p=y.useCallback(async g=>{if(!(!t||!e)){d(!0);try{const v=await Zjt(t,e,g),b=v.map((x,w)=>Am(x,(g-1)*Vxe+w+1));i(x=>g===1?b:[...x,...b]),v.length<Vxe&&h(!0),l(g)}finally{d(!1),f(!0)}}},[t,e]);return y.useEffect(()=>{i([]),l(1),h(!1),f(!1),p(1)},[t,e,p]),!m&&c?a.jsx("div",{className:"space-y-3",children:[0,1,2].map(g=>a.jsx(sr,{className:"h-28 rounded-xl"},g))}):m&&s.length===0?a.jsx("div",{className:"rounded-xl border border-border bg-card p-5 text-sm text-muted-foreground",children:n}):a.jsxs("div",{className:"space-y-3",children:[s.map(g=>{var w,k,S;const v=()=>{g.realId&&r(ve.post(g.realId))},b=C=>{C.target.closest("a")||v()},x=C=>{C.key!=="Enter"&&C.key!==" "||C.target.closest("a")||(C.preventDefault(),v())};return a.jsxs("div",{role:"link",tabIndex:0,onClick:b,onKeyDown:x,className:"w-full cursor-pointer rounded-xl border border-border bg-card p-4 text-left hover:shadow-sm transition-shadow",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:[g.channel,(w=g.preferences)!=null&&w.hideDate?null:g.time].filter(Boolean).join(" · ")}),g.title&&a.jsx("p",{className:"text-sm font-semibold text-foreground",children:g.title}),g.body&&a.jsx("div",{className:"mt-0.5 line-clamp-3 overflow-hidden text-sm text-foreground/75 [&_img]:hidden [&_video]:hidden",children:a.jsx(ZB,{text:g.body})})]}),g.image&&a.jsx("img",{src:g.image,alt:"",className:"h-16 w-16 rounded-lg object-cover shrink-0"})]}),a.jsxs("div",{className:"flex items-center gap-4 mt-3 text-xs text-muted-foreground",children:[!((k=g.preferences)!=null&&k.hideLikes)&&a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(xx,{className:"h-3.5 w-3.5"}),g.likes]}),!((S=g.preferences)!=null&&S.hideComment)&&a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(wd,{className:"h-3.5 w-3.5"}),g.comments]}),typeof g.views=="number"&&a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(Oc,{className:"h-3.5 w-3.5"}),g.views]})]})]},g.id)}),!u&&a.jsx("div",{className:"flex justify-center pt-1",children:a.jsx(Z,{variant:"outline",size:"sm",onClick:()=>p(o+1),disabled:c,children:c?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):"Load more"})})]})}const A4r={"post-create":{label:"created a post",icon:Ei},"post-comment":{label:"commented on",icon:wd},"post-like":{label:"liked",icon:xx},"comment-reply":{label:"replied on",icon:kBt},"reply-reaction":{label:"reacted to a reply on",icon:xx},"comment-reaction":{label:"reacted to a comment on",icon:xx}};function P4r(t){return A4r[t]||{label:t.replace(/-/g," "),icon:iee}}function rwe({communityId:t,userId:e,emptyLabel:n="No activity yet.",activityTypes:r=[]}){const s=Nn(),[i,o]=y.useState([]),[l,c]=y.useState(1),[d,u]=y.useState(!1),[h,m]=y.useState(!1),[f,p]=y.useState(!1),g=y.useCallback(async v=>{if(!(!t||!e)){u(!0);try{const b=await jdr(t,e,v,r);o(x=>v===1?b:[...x,...b]),b.length<Vxe&&m(!0),c(v)}finally{u(!1),p(!0)}}},[t,e,r.join(",")]);return y.useEffect(()=>{o([]),c(1),m(!1),p(!1),g(1)},[t,e,g]),!f&&d?a.jsx("div",{className:"space-y-2",children:[0,1,2].map(v=>a.jsx(sr,{className:"h-16 rounded-xl"},v))}):f&&i.length===0?a.jsx("div",{className:"rounded-xl border border-border bg-card p-5 text-sm text-muted-foreground",children:n}):a.jsxs("div",{className:"space-y-2",children:[i.map(v=>{var j,E,N,A,_;const{label:b,icon:x}=P4r(v.activityType),w=((E=(j=v.post)==null?void 0:j.title)==null?void 0:E.trim())||"a post",k=!!((N=v.post)!=null&&N.id),S=yc(v.createdAt),C=S?new Date(v.createdAt).toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"}):void 0;return a.jsxs("div",{onClick:()=>k&&s(ve.post(v.post.id)),className:R4r(k),children:[a.jsx("div",{className:"mt-0.5 h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center shrink-0",children:a.jsx(x,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("p",{className:"text-sm text-foreground",children:[a.jsx("span",{className:"font-medium",children:b})," ",a.jsxs("span",{className:"text-foreground/80",children:["“",w,"”"]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-0.5",children:[(A=v.group)==null?void 0:A.name,(_=v.group)!=null&&_.name&&S?" · ":"",S&&a.jsx("time",{dateTime:v.createdAt,title:C,children:S})]})]})]},v.id)}),!h&&a.jsx("div",{className:"flex justify-center pt-1",children:a.jsx(Z,{variant:"outline",size:"sm",onClick:()=>g(l+1),disabled:d,children:d?"Loading…":"Load more"})})]})}function R4r(t){return["flex items-start gap-3 rounded-xl border border-border bg-card p-3 transition-shadow",t?"cursor-pointer hover:shadow-sm":""].filter(Boolean).join(" ")}const I4r=["About","Posts","Comments","Spaces"];function KWe(t){return t.split(" ").map(e=>e[0]).filter(Boolean).slice(0,2).join("").toUpperCase()}function M4r({user:t,groupLabel:e,group:n,currentUserId:r}){var w,k,S,C;const s=Nn(),{community:i}=qe(),o=(i==null?void 0:i.id)??null,[l,c]=y.useState("About");y.useEffect(()=>{c("About")},[t==null?void 0:t.id]);const d=lt({queryKey:["user-profile",t==null?void 0:t.id],queryFn:()=>Yjt(t.id),enabled:!!(t!=null&&t.id),staleTime:6e4}),u=lt({queryKey:["user-groups",t==null?void 0:t.id],queryFn:()=>Sdr(t.id),enabled:!!(t!=null&&t.id)&&l==="Spaces",staleTime:6e4});if(!t)return a.jsxs("div",{className:"flex h-full min-h-0 w-72 shrink-0 flex-col border-l border-border bg-card",children:[a.jsx("div",{className:"flex h-14 shrink-0 items-center border-b border-border px-4",children:a.jsx("h3",{className:"text-base font-semibold leading-none text-foreground",children:"Profile"})}),a.jsx("div",{className:"themed-scrollbar min-h-0 flex-1 overflow-y-auto p-5",children:n?a.jsxs("div",{children:[a.jsxs("div",{className:"text-center py-2",children:[n.avatar?a.jsx("img",{src:n.avatar,alt:"",className:"h-16 w-16 rounded-full object-cover mx-auto mb-2"}):a.jsx("div",{className:"h-16 w-16 rounded-full bg-primary/10 flex items-center justify-center text-primary mx-auto mb-2",children:a.jsx(wr,{className:"h-7 w-7"})}),a.jsx("p",{className:"text-sm font-semibold text-foreground",children:((w=n.name)==null?void 0:w.trim())||e}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:[n.participants.length," members ·"," ",n.memberAddPolicy==="everyone"?"Anyone can add members":"Only the creator can add members"]})]}),a.jsxs("div",{className:"mt-4",children:[a.jsx("h4",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground mb-2",children:"Members"}),a.jsx("div",{className:"space-y-1",children:n.participants.map(j=>{const E=j.id===n.createdBy,N=j.id===r;return a.jsxs("div",{className:"flex items-center gap-2.5 rounded-md px-1 py-1.5",children:[j.picture?a.jsx("img",{src:j.picture,alt:"",className:"h-8 w-8 rounded-full object-cover shrink-0"}):a.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-primary/10 text-[10px] font-semibold text-primary",children:KWe(j.name)}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"flex items-center gap-1 text-sm font-medium text-foreground",children:[a.jsx("span",{className:"truncate",children:N?"You":j.name}),E&&a.jsx(_rt,{className:"h-3 w-3 shrink-0 text-amber-500","aria-label":"Creator"})]}),j.userId&&a.jsxs("span",{className:"block truncate text-xs text-muted-foreground",children:["@",j.userId]})]})]},j.id)})}),a.jsx("p",{className:"mt-3 text-[11px] text-muted-foreground",children:"Use the group-settings gear in the header to rename, set the picture, choose who can add members, or manage members."})]})]}):a.jsx("p",{className:"text-xs text-muted-foreground text-center py-8",children:"Select a conversation to see profile details."})})]});const h=d.data??null,m=(h==null?void 0:h.name)??t.name,f=(h==null?void 0:h.picture)??t.picture??"",p=((k=h==null?void 0:h.shortBio)==null?void 0:k.trim())||"Community member",g=((S=h==null?void 0:h.bio)==null?void 0:S.trim())||"",v=((C=h==null?void 0:h.location)==null?void 0:C.trim())||"",b=((h==null?void 0:h.additionalMetaDetails)??[]).filter(j=>{var E;return(E=j==null?void 0:j.value)==null?void 0:E.trim()}),x=(u.data??[]).filter(j=>{var N;const E=typeof j.community=="string"?j.community:(N=j.community)==null?void 0:N.id;return!o||!E||String(E)===String(o)});return a.jsxs("div",{className:"flex h-full min-h-0 w-72 shrink-0 flex-col border-l border-border bg-card",children:[a.jsx("div",{className:"flex h-14 shrink-0 items-center border-b border-border px-4",children:a.jsx("h3",{className:"text-base font-semibold leading-none text-foreground",children:"Profile"})}),a.jsxs("div",{className:"themed-scrollbar min-h-0 flex-1 overflow-y-auto p-5",children:[a.jsxs("div",{className:"text-center mb-4",children:[a.jsxs(oo,{className:"h-16 w-16 mx-auto mb-2",children:[a.jsx(lo,{src:f,alt:m}),a.jsx(co,{className:"text-xl font-semibold bg-primary/10 text-primary",children:KWe(m)})]}),a.jsx("p",{className:"text-sm font-semibold text-foreground",children:m}),(h==null?void 0:h.userId)&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["@",h.userId]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:p}),((h==null?void 0:h.followersCount)!=null||(h==null?void 0:h.followingCount)!=null)&&a.jsxs("p",{className:"text-[11px] text-muted-foreground mt-1",children:[(h==null?void 0:h.followersCount)??0," followers · ",(h==null?void 0:h.followingCount)??0," following"]})]}),a.jsx("div",{className:"flex items-center justify-center gap-3 mb-4",children:I4r.map(j=>a.jsx("button",{onClick:()=>c(j),className:ee("text-xs pb-0.5 transition-colors",l===j?"text-foreground font-medium border-b border-foreground":"text-muted-foreground hover:text-foreground"),children:j},j))}),l==="About"&&a.jsx("div",{className:"space-y-3 text-xs",children:d.isLoading?a.jsxs("div",{className:"space-y-2",children:[a.jsx(sr,{className:"h-4 w-full"}),a.jsx(sr,{className:"h-4 w-2/3"}),a.jsx(sr,{className:"h-16 w-full"})]}):a.jsxs(a.Fragment,{children:[v&&a.jsxs("p",{className:"text-muted-foreground flex items-center gap-1.5",children:[a.jsx(Jf,{className:"h-3.5 w-3.5 shrink-0"})," ",v]}),b.length>0&&a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-foreground mb-1",children:"Details"}),a.jsx("div",{className:"space-y-1",children:b.map((j,E)=>a.jsxs("p",{className:"text-muted-foreground",children:[j.label?`${j.label}: `:"",j.value]},E))})]}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-foreground mb-1",children:"Bio"}),a.jsx("p",{className:"text-muted-foreground leading-relaxed whitespace-pre-wrap",children:g||"No bio available yet."})]}),a.jsxs("button",{onClick:()=>s(ve.member(t.id)),className:"inline-flex items-center gap-1.5 text-primary hover:underline",children:[a.jsx(bo,{className:"h-3 w-3"})," View full profile"]})]})}),l==="Posts"&&a.jsx(CF,{communityId:o,userId:t.id,emptyLabel:"No posts yet.",variant:"compact"}),l==="Comments"&&a.jsx(rwe,{communityId:o,userId:t.id,activityTypes:["post-comment","comment-reply"],emptyLabel:"No comments yet."}),l==="Spaces"&&a.jsx("div",{className:"space-y-2",children:u.isLoading?[0,1,2].map(j=>a.jsx(sr,{className:"h-12 rounded-lg"},j)):x.length===0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"No shared spaces in this community."}):x.map(j=>{var E,N;return a.jsxs("div",{className:"flex items-center gap-2 p-2.5 rounded-lg border border-border",children:[a.jsx("div",{className:"h-7 w-7 rounded bg-primary/10 flex items-center justify-center text-xs text-primary font-semibold",style:j.color?{backgroundColor:`${j.color}20`,color:j.color}:void 0,children:((N=(E=j.name)==null?void 0:E[0])==null?void 0:N.toUpperCase())??"#"}),a.jsx("span",{className:"text-xs font-medium text-foreground truncate",children:j.name})]},j.id)})})]})]})}const YWe=300,L4r={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.04}}},D4r={pin:{change:{pinned:!0},patch:{isPinned:!0},done:t=>`Chat with ${t} pinned`},unpin:{change:{pinned:!1},patch:{isPinned:!1,pinnedAt:null},done:t=>`Chat with ${t} unpinned`},unread:{change:{unread:!0},patch:{isMarkedUnread:!0},done:t=>`Chat with ${t} marked as unread`},mute:{change:{muted:!0},patch:{isMuted:!0},done:t=>`${t} muted. You won't get notifications for this chat.`},unmute:{change:{muted:!1},patch:{isMuted:!1},done:t=>`${t} unmuted`},muteCalls:{change:{callsMuted:!0},patch:{isCallsMuted:!0},done:t=>`Calls from ${t} muted. They won't ring.`},unmuteCalls:{change:{callsMuted:!1},patch:{isCallsMuted:!1},done:t=>`Calls from ${t} unmuted`},archive:{change:{archived:!0},patch:{isArchived:!0},done:t=>`Chat with ${t} archived`},unarchive:{change:{archived:!1},patch:{isArchived:!1},done:t=>`Chat with ${t} moved back to your inbox`}};function $4r(){var Ze;const{community:t}=qe(),{communityDetail:e}=Ln(),{isCommunityAdmin:n}=Zy(),r=n||((e==null?void 0:e.myRole)??(t==null?void 0:t.myRole))==="moderator",i=Di().state??null,[o,l]=y.useState(null),[c,d]=y.useState("Inbox"),[u,h]=y.useState(""),[m,f]=y.useState(""),[p,g]=y.useState(""),[v,b]=y.useState("");y.useEffect(()=>{const Pe=setTimeout(()=>g(u.trim()),YWe);return()=>clearTimeout(Pe)},[u]),y.useEffect(()=>{const Pe=setTimeout(()=>b(m.trim()),YWe);return()=>clearTimeout(Pe)},[m]);const[x,w]=y.useState(!1),[k,S]=y.useState(!1),[C,j]=y.useState(null),[E,N]=y.useState(null),[A,_]=y.useState(null),T=((Ze=ro())==null?void 0:Ze.id)??"",R=y.useRef(void 0);y.useEffect(()=>{N(null)},[o]),y.useEffect(()=>{const Pe=R.current;R.current=t==null?void 0:t.id,!(!Pe||Pe===(t==null?void 0:t.id))&&(l(null),j(null),N(null),d("Inbox"),h(""),f(""))},[t==null?void 0:t.id]),y.useEffect(()=>{const Pe=(i==null?void 0:i.openUserId)??(i==null?void 0:i.openConversationId);Pe&&(i.openCommunityId&&(t!=null&&t.id)&&i.openCommunityId!==t.id||(l(Pe),d("Inbox")))},[i==null?void 0:i.openUserId,i==null?void 0:i.openConversationId,i==null?void 0:i.openCommunityId]);const O=rn(),F=async Pe=>{if(t!=null&&t.id)try{await Sur(Pe.id,t.id),o===Pe.id&&(l(null),j(null)),O.removeQueries({queryKey:["dm-thread",t.id,Pe.id]}),await O.invalidateQueries({queryKey:["direct-messages",t.id]}),O.invalidateQueries({queryKey:["user-counters"]}),He.success(`Chat with ${Pe.name} removed from your inbox`)}catch(Ke){He.error(Ke instanceof ze?Ke.message:"Could not delete this chat.")}},D=async(Pe,Ke)=>{if(!(t!=null&&t.id))return;const De=t.id,xt=Pe.type==="group",Xe=xt?["conversations",De]:["direct-messages",De];try{if(Ke==="read")await(xt?Qxe(Pe.id):Yxe(Pe.id,De)),O.invalidateQueries({queryKey:["user-counters"]}),He.success(`Chat with ${Pe.name} marked as read`);else{const{change:tt,patch:$e,done:wt}=D4r[Ke],Ee=Ke==="pin"?{...$e,pinnedAt:new Date().toISOString()}:$e;O.setQueriesData({queryKey:Xe},Ge=>Ge==null?void 0:Ge.map(Pt=>Pt.id===Pe.id?{...Pt,...Ee}:Pt)),Ke==="unread"&&o===Pe.id&&(l(null),j(null)),await(xt?Rur(Pe.id,tt):Cur(Pe.id,De,tt)),He.success(wt(Pe.name))}}catch(tt){He.error(tt instanceof ze?tt.message:"Could not update this chat. Please try again.")}finally{O.invalidateQueries({queryKey:Xe})}},I=async Pe=>{if(t!=null&&t.id)try{await Tse(t.id,Pe.id),o===Pe.id&&(l(null),j(null)),O.removeQueries({queryKey:["dm-thread",t.id,Pe.id]}),await O.invalidateQueries({queryKey:["direct-messages",t.id]}),O.invalidateQueries({queryKey:["user-counters"]}),He.success(`${Pe.name} blocked`,{description:"You will no longer see their messages or content."})}catch(Ke){He.error(Ke instanceof ze?Ke.message:`Couldn't block ${Pe.name}. Please try again.`)}},P=lt({queryKey:["direct-messages",t==null?void 0:t.id],queryFn:()=>Wxe(t.id),enabled:!!(t!=null&&t.id),staleTime:3e4}),M=lt({queryKey:["conversations",t==null?void 0:t.id],queryFn:()=>RZ(t==null?void 0:t.id),enabled:!!(t!=null&&t.id),staleTime:3e4}),z=lt({queryKey:["dm-requests",t==null?void 0:t.id],queryFn:()=>qxe(t.id),enabled:!!(t!=null&&t.id),staleTime:3e4}),G=lt({queryKey:["community-admins",t==null?void 0:t.id],queryFn:()=>Dy(t.id,{role:"admin",limit:50}),enabled:!!(t!=null&&t.id),staleTime:5*6e4}),B=p.length>0,H=lt({queryKey:["direct-messages",t==null?void 0:t.id,"search",p],queryFn:()=>Wxe(t.id,p),enabled:!!(t!=null&&t.id)&&B,staleTime:3e4}),W=lt({queryKey:["conversations",t==null?void 0:t.id,"search",p],queryFn:()=>RZ(t==null?void 0:t.id,p),enabled:!!(t!=null&&t.id)&&B,staleTime:3e4}),V=lt({queryKey:["dm-requests",t==null?void 0:t.id,"search",p],queryFn:()=>qxe(t.id,p),enabled:!!(t!=null&&t.id)&&B,staleTime:3e4}),U=B&&(H.isError||W.isError||V.isError),ne=u.trim()!==p||B&&(H.isFetching||W.isFetching||V.isFetching),te=v.length>0,re=lt({queryKey:["community-admins",t==null?void 0:t.id,"search",v],queryFn:()=>Dy(t.id,{role:"admin",limit:50,search:v}),enabled:!!(t!=null&&t.id)&&te,staleTime:6e4}),fe=y.useMemo(()=>P.data??[],[P.data]),le=y.useMemo(()=>M.data??[],[M.data]),q=y.useMemo(()=>z.data??[],[z.data]),Y=y.useMemo(()=>B?H.data??[]:fe,[B,H.data,fe]),X=y.useMemo(()=>B?W.data??[]:le,[B,W.data,le]),Q=y.useMemo(()=>B?V.data??[]:q,[B,V.data,q]),ie=y.useMemo(()=>{var Pe;return(((Pe=G.data)==null?void 0:Pe.users)??[]).filter(Ke=>Ke.id!==T).length},[G.data,T]),he=y.useMemo(()=>{var Pe;return(((Pe=te?re.data:G.data)==null?void 0:Pe.users)??[]).filter(Ke=>Ke.id!==T).map(Ke=>({id:Ke.id,name:Ke.name,picture:Ke.picture,userId:Ke.userId}))},[te,re.data,G.data,T]),ye=y.useMemo(()=>o?fe.find(Pe=>Pe.id===o)??null:null,[o,fe]),J=lt({queryKey:["dm-thread-bootstrap",t==null?void 0:t.id,o],queryFn:()=>Kxe(o,t.id),enabled:!!(t!=null&&t.id&&o&&!ye&&(C==null?void 0:C.id)!==o&&!((i==null?void 0:i.openUserId)===o&&i.openUserName)),staleTime:6e4}),K=y.useMemo(()=>{var Ke;if(!o)return null;if(ye)return ye;if((C==null?void 0:C.id)===o)return C;if((i==null?void 0:i.openUserId)===o&&i.openUserName)return{id:o,name:i.openUserName,userId:i.openUserHandle,picture:i.openUserPicture??null,unreadMessageCount:0};const Pe=(Ke=J.data)==null?void 0:Ke.otherUser;return Pe?{id:Pe.id,name:Pe.name,userId:Pe.userId,picture:Pe.picture??null,unreadMessageCount:0}:null},[o,ye,C,i,J.data]),ce=Pe=>{const Ke=w4r(Pe);j(Ke),l(Ke.id),d("Inbox")},pe=Pe=>{const Ke=he.find(De=>De.id===Pe);Ke?(j({id:Ke.id,name:Ke.name,picture:Ke.picture??null,userId:Ke.userId,unreadMessageCount:0}),d("Inbox")):(C==null?void 0:C.id)!==Pe&&j(null),l(Pe)},Ie=Pe=>{var De;if(Pe.kind==="group"&&Pe.conversation){j(null),l(Pe.conversation);return}const Ke=(De=Pe.participants.find(xt=>xt.user.id!==T))==null?void 0:De.user;Ke&&(j({id:Ke.id,name:Ke.name??"",picture:Ke.picture??null,userId:Ke.userId,unreadMessageCount:0}),l(Ke.id))},Me=le.find(Pe=>Pe.id===o)??null,we=!!(K||Me),Be=y.useMemo(()=>{const Pe=$e=>$e?new Date($e).getTime():0,Ke=X.map($e=>{var wt,Ee;return{id:$e.id,type:"group",name:YR($e,T),time:$e.lastMessageAt?yc($e.lastMessageAt):"",preview:(Ee=(wt=$e.lastMessage)==null?void 0:wt.message)!=null&&Ee.trim()?e2($e.lastMessage.message):`${$e.participants.length} members`,unread:$e.unreadCount>0||!!$e.isMarkedUnread,unreadCount:$e.unreadCount,agent:!1,avatar:$e.avatar??null,members:$e.participants.filter(Ge=>Ge.id!==T).slice(0,3).map(Ge=>({name:Ge.name,picture:Ge.picture})),sortAt:Pe($e.lastMessageAt)||Pe($e.createdAt),pinned:!!$e.isPinned,pinnedAt:Pe($e.pinnedAt),muted:!!$e.isMuted,callsMuted:!!$e.isCallsMuted,archived:!!$e.isArchived}}),De=Y.map($e=>{var wt;return{id:$e.id,type:"dm",name:$e.name,time:$e.lastMessageAt?yc($e.lastMessageAt):"",preview:(wt=$e.lastMessage)!=null&&wt.trim()?e2($e.lastMessage):$e.userId?`@${$e.userId}`:"",unread:$e.unreadMessageCount>0||!!$e.isMarkedUnread,unreadCount:$e.unreadMessageCount,agent:!1,avatar:$e.picture??null,sortAt:Pe($e.lastMessageAt),pinned:!!$e.isPinned,pinnedAt:Pe($e.pinnedAt),muted:!!$e.isMuted,callsMuted:!!$e.isCallsMuted,archived:!!$e.isArchived}}),xt=Q.map($e=>{var wt;return{id:$e.id,type:"dm",name:$e.name,time:$e.lastMessageAt?yc($e.lastMessageAt):"",preview:(wt=$e.lastMessage)!=null&&wt.trim()?e2($e.lastMessage):$e.userId?`@${$e.userId}`:"",unread:!0,unreadCount:$e.unreadMessageCount,agent:!1,request:!0,avatar:$e.picture??null,sortAt:Pe($e.lastMessageAt)}});let Xe=[...Ke,...De,...xt];!B&&K&&!Xe.some($e=>$e.id===K.id)&&(Xe=[{id:K.id,type:"dm",name:K.name,time:"",preview:K.userId?`@${K.userId}`:"",unread:!1,unreadCount:0,agent:!1,avatar:K.picture??null,sortAt:Date.now(),pinned:!1,pinnedAt:0,muted:!1,callsMuted:!1,archived:!1},...Xe]);const tt=$e=>"pinned"in $e&&$e.pinned?$e.pinnedAt||1:0;return Xe.sort(($e,wt)=>tt(wt)-tt($e)||wt.sortAt-$e.sortAt)},[X,Y,Q,T,K,B]),Ve=y.useMemo(()=>[...Be.filter(Pe=>Pe.type!=="group"&&!Pe.agent).map(Pe=>Pe.id),...K?[K.id]:[]],[Be,K]),{presenceOf:be}=MNt(Ve,!(e!=null&&e.isDirectMessageDisabled));return e!=null&&e.isDirectMessageDisabled?a.jsx(Gs,{to:ve.dashboard,replace:!0}):a.jsxs(it.div,{variants:L4r,initial:"hidden",animate:"show",className:"-mx-3 -mb-6 -mt-3 flex h-[calc(100dvh-3.5rem)] sm:-mx-4 lg:-mx-6",children:[a.jsx("div",{className:ee("w-full min-h-0 shrink-0 lg:w-80",we&&"hidden lg:flex"),children:a.jsx(U3r,{contacts:Be,presenceOf:be,activeContact:o??"",setActiveContact:pe,dmTab:c,setDmTab:d,callsPanel:t!=null&&t.id?a.jsx(r4r,{communityId:t.id,onOpenChat:Ie}):void 0,searchQuery:u,setSearchQuery:h,serverSearch:{pending:ne,failed:U},adminSearch:ie>1?{value:m,onChange:f,pending:m.trim()!==v||te&&re.isFetching,failed:te&&re.isError}:void 0,onNewMessage:()=>S(!0),onNewGroup:()=>w(!0),admins:he,onDeleteChat:F,onChatAction:D,onReportChat:_,onBlockChat:I})}),a.jsxs("div",{className:ee("min-h-0 min-w-0 flex-1 flex-col",we?"flex":"hidden lg:flex"),children:[we&&a.jsxs("button",{type:"button",onClick:()=>l(null),className:"flex items-center gap-1.5 border-b border-border bg-card px-4 py-2.5 text-sm font-medium text-muted-foreground lg:hidden",children:[a.jsx(nl,{className:"h-4 w-4"})," Back to conversations"]}),K?a.jsx(l4r,{user:K,currentUserId:T,presence:be(K.id),onOpenThread:N},`${(t==null?void 0:t.id)??""}:${K.id}`):Me?a.jsx(y4r,{conversation:Me,currentUserId:T,onLeave:()=>l(null),onOpenThread:N},`${(t==null?void 0:t.id)??""}:${Me.id}`):a.jsx(N4r,{user:null})]}),a.jsx("div",{className:"hidden h-full min-h-0 lg:flex",children:E?a.jsx(j4r,{thread:E,currentUserId:T,onClose:()=>N(null)},`${(t==null?void 0:t.id)??""}:${E.parentId}`):a.jsx(M4r,{user:K,groupLabel:Me?YR(Me,T):null,group:Me??null,currentUserId:T})}),(t==null?void 0:t.id)&&a.jsxs(a.Fragment,{children:[a.jsx(k4r,{open:k,onOpenChange:S,communityId:t.id,currentUserId:T,onSelect:ce}),a.jsx(b4r,{open:x,onOpenChange:w,communityId:t.id,currentUserId:T,canSelectAll:r,onCreated:Pe=>l(Pe.id)}),a.jsx(n9,{target:A,communityId:t.id,onOpenChange:Pe=>!Pe&&_(null)})]})]})}const pJ=t=>encodeURIComponent(t);async function O4r(t,e){const n=await ae.get(`/community/${pJ(t)}/user/${pJ(e)}/groups`);return Array.isArray(n==null?void 0:n.groups)?n.groups:[]}async function F4r(t,e,n){const r=await ae.post(`/community/${pJ(t)}/user/${pJ(e)}/groups`,{groupIds:n});return{added:Array.isArray(r==null?void 0:r.added)?r.added:[],removed:Array.isArray(r==null?void 0:r.removed)?r.removed:[]}}function B4r({target:t,busy:e=!1,onOpenChange:n,onConfirm:r}){const{community:s}=qe(),i=(s==null?void 0:s.id)??null,[o,l]=y.useState([]),[c,d]=y.useState([]),[u,h]=y.useState(!1),[m,f]=y.useState(null),p=y.useRef(0),g=y.useCallback(async()=>{if(!i||!t)return;const S=++p.current;h(!0),f(null);try{const C=await O4r(i,t.id);if(S!==p.current)return;l(C),d(C.filter(j=>j.isMember).map(j=>j.id))}catch(C){if(S!==p.current)return;f(C instanceof ze?C.message:"Couldn't load this member's groups."),l([]),d([])}finally{S===p.current&&h(!1)}},[i,t]);y.useEffect(()=>{if(!t){l([]),d([]),f(null);return}g()},[t,g]);const v=S=>d(C=>C.includes(S)?C.filter(j=>j!==S):[...C,S]),b=o.filter(S=>S.isMember).map(S=>S.id),x=c.filter(S=>!b.includes(S)).length,w=b.filter(S=>!c.includes(S)).length,k=x===0&&w===0;return a.jsx(Bt,{open:t!==null,onOpenChange:S=>!S&&n(!1),children:a.jsxs(Ft,{className:"max-w-md",children:[a.jsxs(Vt,{children:[a.jsxs(Ut,{children:["Groups for ",(t==null?void 0:t.name)||"member"]}),a.jsx(_n,{children:"Ticking a group adds them to it straight away; unticking removes them. No invite is sent either way."})]}),a.jsx("div",{className:"max-h-72 space-y-1 overflow-y-auto rounded-md border border-border p-2",children:u?Array.from({length:4}).map((S,C)=>a.jsxs("div",{className:"flex items-center gap-3 px-2 py-1.5",children:[a.jsx(sr,{className:"h-4 w-4"}),a.jsx(sr,{className:"h-4 w-40"})]},C)):m?a.jsxs("div",{className:"px-2 py-6 text-center",children:[a.jsx("p",{className:"text-sm text-destructive",children:m}),a.jsx(Z,{variant:"ghost",size:"sm",className:"mt-2",onClick:()=>void g(),children:"Try again"})]}):o.length===0?a.jsx("p",{className:"px-2 py-6 text-center text-sm text-muted-foreground",children:"This community has no groups yet."}):o.map(S=>a.jsxs("div",{className:"flex items-center gap-3 rounded px-2 py-1.5 hover:bg-muted/50",children:[a.jsx(ji,{id:`member-group-${S.id}`,checked:c.includes(S.id),onCheckedChange:()=>v(S.id)}),a.jsx(_e,{htmlFor:`member-group-${S.id}`,className:"cursor-pointer text-sm font-normal",children:S.name}),S.groupType==="closed-paid"&&a.jsx("span",{className:"ml-auto rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:"Paid"})]},S.id))}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"ghost",disabled:e,onClick:()=>n(!1),children:"Cancel"}),a.jsx(Z,{disabled:e||u||!!m||k,onClick:()=>r(c),children:e?"Saving…":k?"Save changes":`Save (${x} added, ${w} removed)`})]})]})})}function U4r(t){if(!t)return"—";const e=new Date(t);return Number.isNaN(e.getTime())?"—":e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function z4r({blocked:t,total:e,isLoading:n=!1,showEmail:r=!0,onUnblock:s}){return a.jsxs(it.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.2},className:"space-y-4",children:[a.jsx("div",{className:"flex items-center gap-3",children:a.jsx("span",{className:"text-sm font-semibold text-foreground",children:n?"Loading…":`${e} blocked`})}),a.jsx("div",{className:"rounded-lg border border-border bg-card overflow-hidden",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-muted/30",children:[a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Name"}),r?a.jsxs(a.Fragment,{children:[a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Email"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Blocked on"})]}):null,a.jsx("th",{className:"px-4 py-3"})]})}),a.jsxs("tbody",{className:"divide-y divide-border",children:[!n&&t.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:r?4:2,className:"px-4 py-12 text-center text-sm text-muted-foreground",children:"No blocked members."})}),t.map(i=>a.jsxs("tr",{className:"hover:bg-muted/20 transition-colors",children:[a.jsx("td",{className:"px-4 py-4 text-sm font-medium text-foreground",children:i.name}),r?a.jsxs(a.Fragment,{children:[a.jsx("td",{className:"px-4 py-4 text-sm text-muted-foreground",children:i.email||"—"}),a.jsx("td",{className:"px-4 py-4 text-sm text-muted-foreground whitespace-nowrap",children:U4r(i.blockedAt)})]}):null,a.jsx("td",{className:"px-4 py-4",children:a.jsx("button",{type:"button",onClick:()=>s(i),className:"text-xs font-medium text-primary hover:underline",children:"Unblock"})})]},i.id))]})]})})]})}const V4r={BOUNCE:"A previous email bounced",COMPLAINT:"Marked a previous email as spam",UNSUBSCRIBED:"Unsubscribed",DORMANT:"Inactive",VERIFICATION_RISK:"Failed verification",DUPLICATE:"Duplicate address in the audience",INVALID_EMAIL:"Invalid email address",SEND_CAP:"Over the send limit for this account",SAMPLE:"Held back until the sample send is approved",NOT_INCLUDED:"Not included in this send",SUPPRESSED:"On the do-not-send list",PREFERENCES:"Turned this kind of email off in their preferences"};function swe(t){return V4r[t]||t}function i5t(t){return t==="BOUNCED"?"Bounced — the address did not accept the email":t==="COMPLAINED"?"Marked the email as spam":t==="UNCERTAIN"?"Outcome unknown — not retried, to avoid sending twice":t==="HTTP_401"||t==="HTTP_403"?"The email provider refused the sender":t==="HTTP_429"?"The email provider's sending limit was reached":/^HTTP_4\d\d$/.test(t)?"The email provider rejected the message or address":/^HTTP_5\d\d$/.test(t)?"The email provider had an error":"Could not be sent"}function a5t(t){return(t??[]).map(e=>({name:e.name??"",email:e.email,reason:swe(e.reason),type:"Skipped"}))}const H4r=100;async function Nue(t,e){const n=e==="failed"?"Failed":"Bounced",r=[];for(let s=1;;s+=1){const i=await ijt(t,{type:e,page:s,limit:H4r});if(i.data.forEach(o=>{r.push({name:o.name??"",email:o.email,reason:i5t(o.reason),type:n})}),i.data.length===0||r.length>=i.total)return r}}function G4r(t){const e=String(t??"");return`"${(/^[=+\-@]/.test(e)?`'${e}`:e).replace(/"/g,'""')}"`}function o5t(t,e=!1){const n=e?["Type","Name","Email","Reason"]:["Name","Email","Reason"],r=t.map(s=>(e?[s.type??"",s.name,s.email,s.reason]:[s.name,s.email,s.reason]).map(G4r).join(","));return[n.join(","),...r].join(`
`)}function iie(t,e){const n=URL.createObjectURL(new Blob(["\uFEFF",e],{type:"text/csv;charset=utf-8"})),r=document.createElement("a");r.href=n,r.download=t,r.click(),URL.revokeObjectURL(n)}const I$=10,Tue=[{name:"",email:""}],l5t=/^[^\s@"]+@[^\s@"]+\.[^\s@"]+$/;function W4r(t){const e=t.map(o=>({name:o.name.trim(),email:o.email.trim()})).filter(o=>o.name||o.email);if(!e.length)return{error:"Add at least one name and email."};const n=e.findIndex(o=>!o.name||!o.email);if(n!==-1)return{error:`Person ${n+1} needs both a name and an email.`};const r=e.find(o=>!l5t.test(o.email));if(r)return{error:`"${r.email}" isn't a valid email address.`};const s=new Set,i=e.filter(o=>{const l=o.email.toLowerCase();return s.has(l)?!1:(s.add(l),!0)});return i.length>I$?{error:`You can invite up to ${I$} people at a time.`}:{members:i}}const iwe=1e3,q4r=2*1024*1024,K4r=["name","full name","fullname"],Y4r=["email","email address","e-mail","mail"];function Q4r(t){const e=pNt(t).filter(d=>d.some(u=>u.trim()));if(!e.length)return{error:"This file is empty."};const n=d=>(d??"").trim().replace(/^"(.*)"$/s,"$1").trim(),r=e[0].map(d=>n(d).toLowerCase()),s=r.findIndex(d=>K4r.includes(d)),i=r.findIndex(d=>Y4r.includes(d));if(s===-1||i===-1)return{error:'The first row needs a "name" column and an "email" column. Download the template to see the layout.'};const o=new Set,l=[];let c=0;for(const d of e.slice(1)){const u=n(d[s]),h=n(d[i]),m=h.toLowerCase();if(!u||!l5t.test(h)||o.has(m)){c+=1;continue}o.add(m),l.push({name:u,email:h})}return l.length?l.length>iwe?{error:`This file has ${l.length} people. Upload up to ${iwe} at a time.`}:{members:l,skipped:c}:{error:"No one in this file has both a name and a valid email address."}}function Z4r(t,e){return new File([c5t(t)],e.toLowerCase().endsWith(".csv")?e:`${e}.csv`,{type:"text/csv"})}function c5t(t){const e=n=>/[",\r\n]/.test(n)?`"${n.replace(/"/g,'""')}"`:n;return["name,email",...t.map(n=>`${e(n.name)},${e(n.email)}`)].join(`
`)}const J4r=[{name:"Jane Doe",email:"jane@example.com"},{name:"John Smith",email:"john@example.com"}];function d5t(){iie("invite-members-template.csv",c5t(J4r))}function X4r({open:t,onOpenChange:e,rows:n,onChange:r,onSubmit:s,onInviteCsv:i,isSubmitting:o=!1}){const l=y.useRef(null),[c,d]=y.useState(null),[u,h]=y.useState(null);y.useEffect(()=>{t&&(d(null),h(null))},[t]);const m=(k,S)=>r(n.map((C,j)=>j===k?{...C,...S}:C)),f=k=>r(n.filter((S,C)=>C!==k)),p=()=>r([...n,{name:"",email:""}]),g=n.length>=I$,v=n.filter(k=>k.name.trim()||k.email.trim()).length,b=async k=>{if(l.current&&(l.current.value=""),!!k){if(h(null),!/\.csv$/i.test(k.name)){h("Choose a .csv file. In Excel or Google Sheets, use Save as / Download → CSV.");return}if(k.size>q4r){h("This file is too large for an invite list. Split it into smaller files.");return}try{const S=Q4r(await k.text());if("error"in S){h(S.error);return}d({fileName:k.name,csv:S})}catch{h("This file couldn't be read. Check that it's a CSV file and try again.")}}},x=(c==null?void 0:c.csv.members.length)??0,w=()=>{c&&i?i(c.csv,c.fileName):s()};return a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"max-h-[calc(100dvh-2rem)] w-[calc(100vw-2rem)] overflow-y-auto sm:max-w-lg",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Invite New Members"}),a.jsx(_n,{children:c?"Everyone in your file gets an email invite.":`Each person gets an email invite. Add up to ${I$} at a time${i?", or upload a CSV":""}.`})]}),!c&&a.jsxs("form",{className:"space-y-3 py-1",onSubmit:k=>{k.preventDefault(),s()},children:[a.jsxs("div",{className:"grid grid-cols-[1fr_1.4fr_2rem] gap-2 text-sm font-medium",children:[a.jsx(_e,{children:"Name *"}),a.jsx(_e,{children:"Email *"}),a.jsx("span",{})]}),a.jsx("div",{className:"-m-1 max-h-[45vh] space-y-2 overflow-y-auto p-1",children:n.map((k,S)=>a.jsxs("div",{className:"grid grid-cols-[1fr_1.4fr_2rem] items-center gap-2",children:[a.jsx(Oe,{placeholder:"Full name","aria-label":`Name ${S+1}`,value:k.name,autoFocus:S===n.length-1&&n.length>1,onChange:C=>m(S,{name:C.target.value})}),a.jsx(Oe,{type:"email",placeholder:"email@example.com","aria-label":`Email ${S+1}`,value:k.email,onChange:C=>m(S,{email:C.target.value})}),n.length>1?a.jsx("button",{type:"button",onClick:()=>f(S),"aria-label":`Remove person ${S+1}`,className:"flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground",children:a.jsx(nn,{className:"h-4 w-4"})}):a.jsx("span",{})]},S))}),a.jsxs(Z,{type:"button",variant:"ghost",size:"sm",onClick:p,disabled:g,className:"px-2",children:[a.jsx(Dn,{className:"mr-1.5 h-4 w-4"}),g?`Up to ${I$} at a time`:"Add another person"]}),a.jsx("button",{type:"submit",className:"hidden","aria-hidden":!0,tabIndex:-1})]}),i&&a.jsxs("div",{className:"space-y-2",children:[!c&&a.jsxs("div",{className:"flex items-center gap-3 text-xs text-muted-foreground","aria-hidden":!0,children:[a.jsx("span",{className:"h-px flex-1 bg-border"}),"or",a.jsx("span",{className:"h-px flex-1 bg-border"})]}),c?a.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-primary/30 bg-primary/5 p-3",children:[a.jsx(EBt,{className:"mt-0.5 h-5 w-5 shrink-0 text-primary","aria-hidden":!0}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:c.fileName}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[x===1?"1 person":`${x} people`," to invite",c.csv.skipped>0&&` · ${c.csv.skipped} ${c.csv.skipped===1?"row":"rows"} skipped (no name, an invalid email, or a repeat)`]})]}),a.jsx("button",{type:"button",onClick:()=>d(null),disabled:o,"aria-label":"Remove file",className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md text-muted-foreground hover:bg-muted hover:text-foreground",children:a.jsx(nn,{className:"h-4 w-4"})})]}):a.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",onClick:()=>{var k;return(k=l.current)==null?void 0:k.click()},children:[a.jsx(kd,{className:"mr-1.5 h-4 w-4"}),"Upload a CSV"]}),a.jsx("button",{type:"button",onClick:d5t,className:"text-xs font-medium text-primary hover:underline",children:"Download template"}),a.jsxs(gn,{label:"Upload a CSV",children:["Invite everyone in a spreadsheet at once. The first row needs a name column and an email column; each person below gets the same email invite. Up to ",iwe," people per file; your plan's email limit still applies. Invites go out in the background and appear under Invited."]})]}),u&&a.jsx("p",{role:"alert",className:"text-xs text-destructive",children:u}),a.jsx("input",{ref:l,type:"file",accept:".csv,text/csv",className:"hidden","aria-label":"CSV file of people to invite",onChange:k=>{var S;return void b((S=k.target.files)==null?void 0:S[0])}})]}),a.jsxs(ir,{className:"gap-2 sm:gap-0",children:[a.jsx(Z,{variant:"outline",onClick:()=>e(!1),disabled:o,children:"Cancel"}),a.jsx(Z,{onClick:w,disabled:o,children:o?"Sending…":c?x===1?"Invite 1 person":`Invite ${x} people`:v>1?`Invite ${v} people`:"Invite"})]})]})})}function eDr({invited:t,total:e,isLoading:n=!1,showBanner:r,onDismissBanner:s,isAdmin:i,onExport:o,communityName:l="Community",groupNameById:c,selectedIds:d,onToggleSelect:u,onResendBulk:h,onCancelBulk:m,onResendSingle:f,onCancelSingle:p,resending:g=!1,cancelling:v=!1}){const b=d.length>0;return a.jsxs(it.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.2},className:"space-y-4",children:[r&&a.jsxs("div",{className:"flex items-start gap-3 rounded-lg border border-border bg-muted/30 px-4 py-3",children:[a.jsx(nS,{className:"h-4 w-4 text-muted-foreground mt-0.5 shrink-0"}),a.jsxs("div",{className:"flex-1",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Your pending invites are displayed here"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Members you invite by email appear here until they join the community."})]}),a.jsx("button",{type:"button",onClick:s,className:"text-muted-foreground hover:text-foreground shrink-0",children:a.jsx(nn,{className:"h-4 w-4"})})]}),b&&i?a.jsxs("div",{className:"flex justify-end gap-2",children:[a.jsx(Z,{size:"sm",variant:"secondary",disabled:g||v,onClick:h,children:g?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):"Resend invites"}),a.jsx(Z,{size:"sm",variant:"destructive",disabled:g||v,onClick:m,children:v?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):"Cancel invites"})]}):null,a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"text-sm font-semibold text-foreground",children:n?"Loading…":`${e} invited`}),a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1 rounded-full border border-border px-3 py-1 text-xs text-muted-foreground hover:bg-muted transition-colors",children:["More ",a.jsx(li,{className:"h-3 w-3"})]})}),a.jsx(Cr,{align:"start",className:"z-50 bg-popover border border-border shadow-lg",children:i&&a.jsxs(ot,{onClick:o,children:[a.jsx(bc,{className:"h-4 w-4 mr-2"})," Export invited"]})})]})]}),a.jsx("div",{className:"rounded-lg border border-border bg-card overflow-hidden overflow-x-auto",children:a.jsxs("table",{className:"w-full min-w-[720px]",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-muted/30",children:[i?a.jsx("th",{className:"w-10 px-2 py-3"}):null,a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Name"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Email"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Invited"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Status"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Invited to"}),i?a.jsx("th",{className:"w-10 px-2 py-3"}):null]})}),a.jsxs("tbody",{className:"divide-y divide-border",children:[!n&&t.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:i?7:5,className:"px-4 py-12 text-center text-sm text-muted-foreground",children:"No invite sent"})}),t.map(x=>{const w=!x.isAccepted,k=d.includes(x.id);return a.jsxs("tr",{className:"hover:bg-muted/20 transition-colors",children:[i?a.jsx("td",{className:"px-2 py-4 text-center",children:a.jsx(ji,{checked:k,disabled:!w,onCheckedChange:()=>u(x.id,x.isAccepted),className:ee(!w&&"opacity-50")})}):null,a.jsx("td",{className:"px-4 py-4 text-sm font-medium text-foreground",children:x.name||"—"}),a.jsx("td",{className:"px-4 py-4 text-sm text-muted-foreground",children:x.email||"—"}),a.jsx("td",{className:"px-4 py-4 text-sm text-muted-foreground whitespace-nowrap",children:x.invitedAt}),a.jsx("td",{className:"px-4 py-4",children:a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-sm",children:[a.jsx("span",{className:ee("h-2 w-2 rounded-full",x.isAccepted?"bg-emerald-500":"bg-amber-500")}),x.invitationStatus]})}),a.jsx("td",{className:"px-4 py-4 text-sm text-muted-foreground",children:x.groupId?c(x.groupId):l}),i?a.jsx("td",{className:"px-2 py-4",children:w?a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx("button",{type:"button",className:"inline-flex h-8 w-8 items-center justify-center rounded-md hover:bg-muted",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",className:"z-50 bg-popover",children:[a.jsx(ot,{onClick:()=>f(x),children:"Resend invite"}),a.jsx(ot,{className:"text-destructive focus:text-destructive",onClick:()=>p(x.id),children:"Cancel invite"})]})]}):null}):null]},x.id)})]})]})})]})}function tDr({kicked:t,total:e,isLoading:n=!1,onRestore:r}){const[s,i]=y.useState(null),o=async l=>{if(!(!r||!l.userId)){i(l.id);try{await r(l.userId,l.name||"Member")}finally{i(null)}}};return a.jsxs(it.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},transition:{duration:.2},className:"space-y-4",children:[a.jsx("div",{className:"flex items-center gap-3",children:a.jsx("span",{className:"text-sm font-semibold text-foreground",children:n?"Loading…":`${e} kicked`})}),a.jsx("div",{className:"rounded-lg border border-border bg-card overflow-x-auto",children:a.jsxs("table",{className:"w-full min-w-[720px]",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-muted/30",children:[a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Member"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Kicked by"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Reason"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium text-muted-foreground uppercase tracking-wider",children:"Kicked on"}),r&&a.jsx("th",{className:"px-4 py-3",children:a.jsx("span",{className:"sr-only",children:"Actions"})})]})}),a.jsxs("tbody",{className:"divide-y divide-border",children:[!n&&t.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:r?5:4,className:"px-4 py-12 text-center text-sm text-muted-foreground",children:"No kick history"})}),t.map(l=>a.jsxs("tr",{className:"hover:bg-muted/20 transition-colors",children:[a.jsx("td",{className:"px-4 py-4",children:l.isDeletedUser?a.jsx("span",{className:"text-sm italic text-muted-foreground",children:"Deleted user"}):a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-medium text-foreground",children:l.name||"—"}),l.email?a.jsx("div",{className:"text-xs text-muted-foreground",children:l.email}):null]})}),a.jsx("td",{className:"px-4 py-4",children:l.kickedByName||l.kickedByEmail?a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-medium text-foreground",children:l.kickedByName||"—"}),l.kickedByEmail?a.jsx("div",{className:"text-xs text-muted-foreground",children:l.kickedByEmail}):null]}):a.jsx("span",{className:"text-sm text-muted-foreground",children:"—"})}),a.jsx("td",{className:"px-4 py-4 text-sm text-muted-foreground",children:l.reason||"—"}),a.jsx("td",{className:"px-4 py-4 text-sm text-muted-foreground whitespace-nowrap",children:l.kickedOn}),r&&a.jsx("td",{className:"px-4 py-4 text-right whitespace-nowrap",children:l.userId&&!l.isDeletedUser?a.jsx(Z,{size:"sm",variant:"outline",disabled:s!==null,onClick:()=>void o(l),"aria-label":`Bring back ${l.name||"member"}`,children:s===l.id?a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"}):a.jsxs(a.Fragment,{children:[a.jsx(zP,{className:"mr-1.5 h-3.5 w-3.5"})," Bring back"]})}):null})]},l.id))]})]})})]})}const u5t="COMMUNITY_KARMA_POINTS_LABEL",nDr="Karma Points";function tv(){const{communityDetail:t}=Ln(),e=t==null?void 0:t.configurables,n=e==null?void 0:e[u5t];return(typeof n=="string"?n.trim():"")||nDr}const rDr=3;function v9({field:t,value:e,size:n="xs"}){const r=Epr(t,e).filter(s=>s.logoUrl).slice(0,rDr);return r.length?a.jsx("span",{className:"inline-flex shrink-0 -space-x-1",children:r.map(s=>a.jsx(Gk,{src:s.logoUrl,label:s.label,size:n},s.id))}):null}function h5t(t){return t.filter(e=>e.showInDirectory!==!1)}function PRe(t,e){return e?h5t(t).filter(n=>n.type!=="longText").map(n=>({field:n,text:MAe(n,e[n.id])})).filter(n=>n.text):[]}function m5t(t,e){return PRe(t,e).find(({field:n})=>(n.options??[]).some(r=>r.logoUrl))??null}function sDr(t,e){return t.type==="boolean"?e==="Yes"?t.label:`${t.label}: ${e}`:t.type==="number"||t.type==="date"?`${t.label}: ${e}`:e}function iDr({field:t,answers:e}){const n=MAe(t,e==null?void 0:e[t.id]);return n?a.jsxs("span",{className:"flex min-w-0 items-center gap-1.5 text-sm text-foreground/80",title:n,children:[a.jsx(v9,{field:t,value:e==null?void 0:e[t.id]}),a.jsx("span",{className:"min-w-0 truncate",children:n})]}):a.jsx("span",{className:"text-sm text-muted-foreground/60","aria-label":"No answer",children:"—"})}function aDr({fields:t,answers:e,className:n}){const r=PRe(t,e);return r.length?a.jsxs("ul",{className:ee("flex max-w-full flex-wrap justify-center gap-1",n),"aria-label":"Member details",children:[r.slice(0,3).map(({field:s,text:i})=>a.jsxs("li",{title:`${s.label}: ${i}`,"aria-label":`${s.label}: ${i}`,className:"inline-flex max-w-[10rem] items-center gap-1 rounded-full border border-border bg-background px-2 py-0.5 text-[11px] text-foreground/70",children:[a.jsx(v9,{field:s,value:e==null?void 0:e[s.id]}),a.jsx("span",{className:"min-w-0 truncate",children:sDr(s,i)})]},s.id)),r.length>3?a.jsxs("li",{className:"rounded-full border border-border bg-background px-2 py-0.5 text-[11px] text-muted-foreground",children:["+",r.length-3]}):null]}):null}const sE=["bg-primary/80","bg-accent/80","bg-destructive/40","bg-secondary","bg-muted-foreground/30","bg-primary/50","bg-accent/50"],fg={container:{hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.04}}},item:{hidden:{opacity:0,y:8},show:{opacity:1,y:0}}};function RRe(t){return{Germany:"🇩🇪",France:"🇫🇷",Italy:"🇮🇹",Netherlands:"🇳🇱",England:"🏴󠁧󠁢󠁥󠁮󠁧󠁿",Scotland:"🏴󠁧󠁢󠁳󠁣󠁴󠁿",Wales:"🏴󠁧󠁢󠁷󠁬󠁳󠁿","Northern Ireland":"🇬🇧",Spain:"🇪🇸",Portugal:"🇵🇹",Belgium:"🇧🇪",Denmark:"🇩🇰",Ireland:"🇮🇪","Czech Republic":"🇨🇿",Austria:"🇦🇹",Switzerland:"🇨🇭",Sweden:"🇸🇪",Norway:"🇳🇴",Poland:"🇵🇱",Greece:"🇬🇷",Turkey:"🇹🇷",Russia:"🇷🇺",Ukraine:"🇺🇦",Croatia:"🇭🇷",Serbia:"🇷🇸",Hungary:"🇭🇺"}[t]||"🏳️"}function u5(t){return t.split(" ").map(e=>e[0]).join("").toUpperCase()}function oDr(t){return t>=900?"bg-success text-success-foreground":t>=700?"bg-warning text-warning-foreground":"bg-muted text-muted-foreground"}const lDr=8,gv="whitespace-nowrap px-4 py-2.5 text-left text-[11px] font-semibold uppercase tracking-wide text-muted-foreground";function QWe({value:t,emptyLabel:e,clamp:n=!1}){const r=t==null?void 0:t.trim();return a.jsx("td",{className:"px-4 py-3 align-middle",children:r?a.jsx("span",{className:ee("block w-44 break-words text-sm font-medium leading-snug text-foreground/80",n&&"line-clamp-2"),title:n?r:void 0,children:r}):a.jsxs("span",{className:"block w-44 text-sm text-muted-foreground/60",children:[a.jsx("span",{"aria-hidden":!0,children:"—"}),a.jsx("span",{className:"sr-only",children:e})]})})}const ZWe={Admin:"bg-primary/10 text-primary",Moderator:"bg-amber-500/10 text-amber-700 dark:text-amber-400",Member:"bg-muted text-muted-foreground"};function cDr({fieldColumns:t=0}){return a.jsx(a.Fragment,{children:Array.from({length:lDr}).map((e,n)=>a.jsxs("tr",{"aria-hidden":"true","data-testid":"member-row-placeholder",children:[a.jsx("td",{className:"w-10 px-4 py-3",children:a.jsx(sr,{className:"h-4 w-4"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx(sr,{className:"h-8 w-8 shrink-0 rounded-full"}),a.jsx(sr,{className:"h-4 w-28"})]})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(sr,{className:"h-4 w-24"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(sr,{className:"h-4 w-24"})}),Array.from({length:t}).map((r,s)=>a.jsx("td",{className:"px-4 py-3",children:a.jsx(sr,{className:"h-4 w-24"})},s)),a.jsx("td",{className:"px-4 py-3",children:a.jsx(sr,{className:"h-4 w-20 rounded-full"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(sr,{className:"h-4 w-44"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(sr,{className:"h-4 w-8 rounded-full"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(sr,{className:"h-4 w-14"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(sr,{className:"h-4 w-20"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(sr,{className:"h-4 w-14"})}),a.jsx("td",{className:"px-4 py-3"})]},n))})}function dDr({members:t,selectedMembers:e,onToggleSelect:n,onToggleSelectAll:r,onToggleSubscription:s,onRemove:i,onAddToGroup:o,onChangeRole:l,dmDisabled:c=!1,onVerify:d,onBlock:u,onToggleFollow:h,isLoading:m=!1,currentUserId:f,memberFields:p=[]}){const g=tv(),v=Nn(),{community:b}=qe(),x=t.filter(C=>C.id!==f).length,w=h5t(p),k=C=>{v(ve.member(C.id))},S=C=>{c0(v,{id:C.id,name:C.name,avatar:C.avatar,userId:C.userId,communityId:b==null?void 0:b.id})};return a.jsx(it.div,{variants:fg.item,initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},className:"rounded-lg border border-border bg-card overflow-x-auto",children:a.jsxs("table",{className:"w-full min-w-[1160px]",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-muted/30",children:[a.jsx("th",{className:"w-10 px-4 py-2.5",children:a.jsx("input",{type:"checkbox","aria-label":"Select all members",checked:!m&&x>0&&e.length===x,disabled:m||x===0,onChange:r,className:"h-4 w-4 rounded border-border text-primary focus:ring-primary/20"})}),a.jsx("th",{className:gv,children:"Name"}),a.jsx("th",{className:gv,children:"Title"}),a.jsx("th",{className:gv,children:"Location"}),w.map(C=>a.jsx("th",{className:gv,title:C.label,children:a.jsx("span",{className:"block max-w-[12rem] truncate",children:C.label})},C.id)),a.jsx("th",{className:gv,children:"Email Marketing"}),a.jsx("th",{className:gv,children:"Email"}),a.jsx("th",{className:gv,children:g}),a.jsx("th",{className:gv,children:"Role"}),a.jsx("th",{className:gv,children:"Joined"}),a.jsx("th",{className:gv,children:"Last online"}),a.jsx("th",{className:"px-4 py-2.5"})]})}),a.jsx("tbody",{className:"divide-y divide-border","aria-busy":m,children:m?a.jsx(cDr,{fieldColumns:w.length}):t.map((C,j)=>{const E=C.id===f;return a.jsxs("tr",{className:ee("hover:bg-muted/20 transition-colors",e.includes(j)&&"bg-primary/5"),children:[a.jsx("td",{className:"w-10 px-4 py-3",children:a.jsx("input",{type:"checkbox","aria-label":`Select ${C.name}`,checked:e.includes(j),disabled:E,onChange:()=>n(j),className:"h-4 w-4 rounded border-border text-primary focus:ring-primary/20"})}),a.jsx("td",{className:"w-[14rem] max-w-[14rem] px-4 py-3",children:a.jsxs("button",{type:"button",onClick:()=>k(C),className:"flex w-full min-w-0 items-center gap-2.5 text-left",children:[a.jsxs(oo,{className:"h-8 w-8 shrink-0",children:[a.jsx(lo,{src:C.avatar,alt:C.name}),a.jsx(co,{className:"bg-primary/10 text-[11px] font-semibold text-primary",children:u5(C.name||"?")})]}),a.jsx("span",{className:"flex min-w-0 flex-1 flex-col",children:a.jsx("span",{className:"truncate text-sm font-medium text-foreground hover:underline",title:C.name,children:C.name})})]})}),a.jsx(QWe,{value:C.title,emptyLabel:"No job title",clamp:!0}),a.jsx(QWe,{value:C.location,emptyLabel:"No location"}),w.map(N=>a.jsx("td",{className:"max-w-[12rem] px-4 py-3",children:a.jsx(iDr,{field:N,answers:C.customFields})},N.id)),a.jsx("td",{className:"px-4 py-3",children:a.jsx("button",{type:"button",onClick:()=>s(j,C),className:ee("inline-flex items-center rounded-full px-2.5 py-0.5 text-[10px] font-semibold transition-colors cursor-pointer",C.subscribed?"bg-success/20 text-success hover:bg-success/30":"bg-muted text-muted-foreground hover:bg-muted/80"),children:C.subscribed?"Subscribed":"Unsubscribed"})}),a.jsx("td",{className:"max-w-[16rem] px-4 py-3 text-sm text-muted-foreground",children:a.jsx("span",{className:"block truncate",title:C.email,children:C.email})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:ee("inline-flex items-center rounded-full px-2 py-0.5 text-[10px] font-bold",oDr(C.mpu)),children:C.mpu})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:ee("inline-flex items-center rounded-full px-2.5 py-0.5 text-[10px] font-semibold",ZWe[C.role]??ZWe.Member),children:C.role})}),a.jsx("td",{className:"px-4 py-3 text-sm text-muted-foreground whitespace-nowrap",children:C.joined}),a.jsx("td",{className:"px-4 py-3 text-sm text-muted-foreground whitespace-nowrap",children:C.lastLogin??"—"}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx("button",{type:"button","aria-label":`Actions for ${C.name}`,className:"rounded-md p-1.5 text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",className:"z-50 bg-popover border border-border shadow-lg",children:[a.jsxs(ot,{onClick:()=>k(C),children:[a.jsx(k2,{className:"h-4 w-4 mr-2"})," View profile"]}),o&&a.jsxs(ot,{onClick:()=>o(C),children:[a.jsx(Sa,{className:"h-4 w-4 mr-2"})," Add to group"]}),h&&!E&&a.jsx(ot,{onClick:()=>h(C),children:C.isFollowedByMe?a.jsxs(a.Fragment,{children:[a.jsx(ESe,{className:"h-4 w-4 mr-2"})," Unfollow"]}):a.jsxs(a.Fragment,{children:[a.jsx(Sa,{className:"h-4 w-4 mr-2"})," Follow"]})}),!c&&a.jsxs(ot,{onClick:()=>S(C),children:[a.jsx(wd,{className:"h-4 w-4 mr-2"})," Send message"]}),l&&a.jsxs(bZn,{children:[a.jsxs(W1t,{children:[a.jsx(Sk,{className:"h-4 w-4 mr-2"})," Change role"]}),a.jsx(q1t,{className:"z-50 bg-popover border border-border shadow-lg",children:["Admin","Moderator","Member"].map(N=>a.jsx(ot,{disabled:C.role===N,onClick:()=>l(C,N),children:N},N))})]}),d&&a.jsxs(ot,{onClick:()=>d(C),children:[a.jsx(vk,{className:"h-4 w-4 mr-2"})," Verify member"]}),u&&!E&&a.jsxs(ot,{onClick:()=>u(C),className:"text-destructive focus:text-destructive",children:[a.jsx(mm,{className:"h-4 w-4 mr-2"})," Block"]}),!E&&a.jsxs(a.Fragment,{children:[a.jsx(mi,{}),a.jsxs(ot,{onClick:()=>i(j,C.name),className:"text-destructive focus:text-destructive",children:[a.jsx(qn,{className:"h-4 w-4 mr-2"})," Kick from community"]})]})]})]})})]},C.id)})})]})},"list")}function uDr({count:t,isAdmin:e,selectedCount:n,onClearSelection:r,onExport:s,onInvite:i,onBulkRoleChange:o,onBulkDelete:l,onBulkMessage:c}){return a.jsxs(a.Fragment,{children:[a.jsxs(it.div,{variants:fg.item,className:"flex items-center justify-between",children:[a.jsx("div",{className:"flex items-center gap-3",children:t===null?a.jsx(sr,{className:"h-4 w-16"}):a.jsxs("span",{className:"text-sm font-medium text-foreground",children:[t," people"]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[e&&a.jsxs("button",{type:"button",onClick:s,className:"inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-foreground hover:bg-muted transition-colors",children:[a.jsx(bc,{className:"h-3.5 w-3.5"})," Export"]}),a.jsxs("button",{type:"button",onClick:i,className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:[a.jsx(Dn,{className:"h-3.5 w-3.5"})," Invite Member"]})]})]}),e&&n>0&&a.jsxs(it.div,{initial:{opacity:0,y:-4},animate:{opacity:1,y:0},className:"flex items-center justify-between rounded-lg border border-primary/30 bg-primary/5 px-4 py-2.5",children:[a.jsxs("span",{className:"text-sm font-medium text-foreground",children:[n," selected"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("button",{type:"button",onClick:c,className:"inline-flex items-center gap-1.5 rounded-md border border-border bg-card px-3 py-1.5 text-xs font-medium text-foreground hover:bg-muted transition-colors",children:[a.jsx(wd,{className:"h-3.5 w-3.5"})," Message"]}),a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsxs("button",{type:"button",className:"inline-flex items-center gap-1.5 rounded-md border border-border bg-card px-3 py-1.5 text-xs font-medium text-foreground hover:bg-muted transition-colors",children:[a.jsx(d9t,{className:"h-3.5 w-3.5"})," Change role"]})}),a.jsx(Cr,{align:"end",className:"z-50 bg-popover border border-border shadow-lg",children:["Admin","Moderator","User"].map(d=>a.jsx(ot,{onClick:()=>o(d),children:d},d))})]}),a.jsxs("button",{type:"button",onClick:l,className:"inline-flex items-center gap-1.5 rounded-md border border-destructive/40 bg-card px-3 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/10 transition-colors",children:[a.jsx(qn,{className:"h-3.5 w-3.5"})," Kick"]}),a.jsxs("button",{type:"button",onClick:r,className:"inline-flex items-center gap-1 rounded-md px-2 py-1.5 text-xs text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(nn,{className:"h-3.5 w-3.5"})," Clear"]})]})]})]})}function hDr({title:t,location:e,variant:n,className:r}){const s=t==null?void 0:t.trim(),i=e==null?void 0:e.trim();return!s&&!i?null:n==="row"?a.jsxs("span",{className:ee("flex min-w-0 max-w-full flex-col leading-4",r),children:[s?a.jsx("span",{className:"truncate text-xs text-foreground/70",title:s,children:s}):null,i?a.jsx("span",{className:"truncate text-[11px] text-muted-foreground",title:i,children:i}):null]}):a.jsxs("span",{className:ee("flex min-w-0 flex-col items-center gap-0.5",r),children:[s?a.jsx("span",{className:"line-clamp-2 max-w-full text-center text-xs font-medium text-foreground/80 [overflow-wrap:anywhere]",title:s,children:s}):null,i?a.jsxs("span",{className:"flex min-w-0 max-w-full items-center justify-center gap-1 text-[11px] text-muted-foreground",title:i,children:[a.jsx(Jf,{className:"h-3 w-3 shrink-0 opacity-70","aria-hidden":!0}),a.jsx("span",{className:"min-w-0 truncate",children:i})]}):null]})}function mDr({member:t,index:e,isFollowed:n,onToggleFollow:r,dmDisabled:s=!1,isSelf:i=!1,memberFields:o=[],onReport:l,onBlock:c}){var g,v,b;const d=Nn(),{community:u}=qe(),h=()=>{d(ve.member(t.id))},m=()=>{c0(d,{id:t.id,name:t.name,avatar:t.avatar,userId:t.userId,communityId:u==null?void 0:u.id})},f=!!((g=t.title)!=null&&g.trim()||(v=t.location)!=null&&v.trim())||PRe(o,t.customFields).length>0,p=t.userId?`@${t.userId}`:((b=t.shortBio)==null?void 0:b.trim())||t.position||"";return a.jsxs("div",{role:"button",tabIndex:0,onClick:h,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),h())},className:"group relative h-full rounded-xl border border-border bg-card p-5 flex flex-col items-center text-center hover:shadow-md hover:border-primary/20 transition-all duration-300 cursor-pointer",children:[l||c?a.jsx("div",{className:"absolute right-2 top-2 opacity-0 transition-opacity group-hover:opacity-100 focus-within:opacity-100",onClick:x=>x.stopPropagation(),children:a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx("button",{type:"button",className:"rounded-md p-1.5 text-muted-foreground hover:bg-muted hover:text-foreground",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[l?a.jsxs(ot,{onClick:l,children:[a.jsx(xd,{className:"mr-2 h-4 w-4"})," Report user"]}):null,c?a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:c,children:[a.jsx(mm,{className:"mr-2 h-4 w-4"})," Block user"]}):null]})]})}):null,a.jsxs(oo,{className:"h-16 w-16 mb-3 ring-2 ring-border",children:[a.jsx(lo,{src:t.avatar,alt:t.name}),a.jsx(co,{className:ee("text-lg font-semibold text-primary-foreground",sE[e%sE.length]),children:u5(t.name)})]}),a.jsx("h3",{className:"max-w-full truncate text-sm font-semibold text-foreground",title:t.name,children:t.name}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 line-clamp-2 [overflow-wrap:anywhere]",children:p?`${t.role} · ${p}`:t.role}),f?a.jsxs("div",{className:"mt-3 flex w-full flex-col items-center gap-2 border-t border-border/60 pt-3",children:[a.jsx(hDr,{title:t.title,location:t.location,variant:"card",className:"w-full"}),a.jsx(aDr,{fields:o,answers:t.customFields,className:"w-full"})]}):null,a.jsxs("div",{className:"flex items-center gap-4 mt-auto pt-3 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-semibold text-foreground",children:t.followers}),a.jsx("span",{className:"text-muted-foreground ml-1",children:"Followers"})]}),a.jsx("div",{className:"w-px h-3 bg-border"}),a.jsxs("div",{children:[a.jsx("span",{className:"font-semibold text-foreground",children:t.following}),a.jsx("span",{className:"text-muted-foreground ml-1",children:"Following"})]})]}),i?a.jsx("p",{className:"mt-4 w-full rounded-lg bg-muted/50 px-4 py-2 text-xs font-medium text-muted-foreground",children:"This is you"}):a.jsxs("div",{className:"mt-4 w-full flex items-center gap-2",children:[a.jsxs("button",{type:"button",onClick:x=>{x.stopPropagation(),r()},className:ee("flex-1 flex items-center justify-center gap-2 rounded-lg px-4 py-2 text-xs font-medium transition-colors",n?"bg-primary text-primary-foreground hover:bg-primary/90":"border border-border text-foreground hover:bg-muted"),children:[a.jsx(Sa,{className:"h-3.5 w-3.5"}),n?"Following":"Follow"]}),!s&&a.jsxs("button",{type:"button",onClick:x=>{x.stopPropagation(),m()},className:"flex-1 flex items-center justify-center gap-2 rounded-lg border border-border px-4 py-2 text-xs font-medium text-foreground hover:bg-muted transition-colors",children:[a.jsx(wd,{className:"h-3.5 w-3.5"}),"Message"]})]})]})}function fDr({members:t,onToggleFollow:e,dmDisabled:n=!1,onReport:r,onBlock:s,currentUserId:i,memberFields:o=[]}){return a.jsx(it.div,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-10},transition:{duration:.2},className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:t.map((l,c)=>a.jsx(it.div,{initial:{opacity:0,scale:.95},animate:{opacity:1,scale:1},transition:{duration:.25,delay:c*.05},className:"h-full",children:a.jsx(mDr,{member:l,index:c,memberFields:o,isFollowed:!!l.isFollowedByMe,onToggleFollow:()=>e(l),dmDisabled:n,isSelf:!!i&&l.id===i,onReport:r&&l.id!==i?()=>r(l):void 0,onBlock:s&&l.id!==i?()=>s(l):void 0})},l.id))},"grid")}function pDr(){return a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:Array.from({length:6}).map((t,e)=>a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5 flex flex-col items-center animate-pulse",children:[a.jsx("div",{className:`h-16 w-16 rounded-full mb-3 ${sE[e%sE.length]}`}),a.jsx("div",{className:"h-4 w-32 bg-muted rounded mb-2"}),a.jsx("div",{className:"h-3 w-24 bg-muted rounded mb-4"}),a.jsx("div",{className:"h-8 w-full bg-muted rounded"})]},e))})}function gDr({isAdmin:t,onInvite:e}){return a.jsxs(it.div,{variants:fg.item,className:"flex items-center justify-between",children:[a.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:t?"Manage audience":"Member Directory"}),t&&a.jsx("div",{className:"flex items-center gap-3",children:a.jsx("button",{type:"button",onClick:e,className:"inline-flex items-center gap-1.5 rounded-full bg-foreground px-5 py-2 text-sm font-medium text-background hover:bg-foreground/90 transition-colors",children:"Invite"})})]})}function mx({page:t,totalPages:e,total:n,countLabel:r="members",isLoading:s=!1,onPageChange:i,className:o}){if(!s&&n<=0)return null;const l=e>1;return a.jsxs("div",{className:ee("flex items-center justify-between gap-3 rounded-lg border border-border bg-card px-4 py-3",o),children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:s?"Loading…":l?`Page ${t} of ${e} · ${n} ${r}`:`${n} ${r}`}),l&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 gap-1",disabled:t<=1||s,onClick:()=>i(t-1),children:[a.jsx(nl,{className:"h-4 w-4"}),"Previous"]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 gap-1",disabled:t>=e||s,onClick:()=>i(t+1),children:["Next",a.jsx(io,{className:"h-4 w-4"})]})]})]})}function QV({filters:t,onChange:e,onClearAll:n,activeCount:r,configs:s,children:i}){return a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[s.map(o=>a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsxs("button",{type:"button",className:ee("inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-xs transition-colors",t[o.key]?"border-primary bg-primary/10 text-primary font-medium":"border-border text-muted-foreground hover:bg-muted"),children:[t[o.key]||`+ ${o.label}`,a.jsx(li,{className:"h-3 w-3"})]})}),a.jsxs(Cr,{align:"start",className:"z-50 bg-popover border border-border shadow-lg max-h-64 overflow-y-auto",children:[t[o.key]&&a.jsxs(a.Fragment,{children:[a.jsxs(ot,{onClick:()=>e(o.key,""),className:"text-destructive focus:text-destructive",children:[a.jsx(nn,{className:"h-3.5 w-3.5 mr-2"})," Clear ",o.label]}),a.jsx(mi,{})]}),o.options.length===0?a.jsx(ot,{disabled:!0,className:"text-muted-foreground",children:"No options available"}):o.options.map(l=>a.jsx(ot,{onClick:()=>e(o.key,l),className:ee(t[o.key]===l&&"bg-primary/10 text-primary font-medium"),children:l},l))]})]},o.key)),i,r>0&&a.jsxs("button",{type:"button",onClick:n,className:"inline-flex items-center gap-1 rounded-full bg-destructive/10 px-3 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/20 transition-colors",children:[a.jsx(nn,{className:"h-3 w-3"})," Clear all (",r,")"]})]})}var os=function(){return os=Object.assign||function(e){for(var n,r=1,s=arguments.length;r<s;r++){n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},os.apply(this,arguments)};function vDr(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(t);s<r.length;s++)e.indexOf(r[s])<0&&Object.prototype.propertyIsEnumerable.call(t,r[s])&&(n[r[s]]=t[r[s]]);return n}function f5t(t,e,n){for(var r=0,s=e.length,i;r<s;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))}function y9(t){return t.mode==="multiple"}function b9(t){return t.mode==="range"}function aie(t){return t.mode==="single"}var yDr={root:"rdp",multiple_months:"rdp-multiple_months",with_weeknumber:"rdp-with_weeknumber",vhidden:"rdp-vhidden",button_reset:"rdp-button_reset",button:"rdp-button",caption:"rdp-caption",caption_start:"rdp-caption_start",caption_end:"rdp-caption_end",caption_between:"rdp-caption_between",caption_label:"rdp-caption_label",caption_dropdowns:"rdp-caption_dropdowns",dropdown:"rdp-dropdown",dropdown_month:"rdp-dropdown_month",dropdown_year:"rdp-dropdown_year",dropdown_icon:"rdp-dropdown_icon",months:"rdp-months",month:"rdp-month",table:"rdp-table",tbody:"rdp-tbody",tfoot:"rdp-tfoot",head:"rdp-head",head_row:"rdp-head_row",head_cell:"rdp-head_cell",nav:"rdp-nav",nav_button:"rdp-nav_button",nav_button_previous:"rdp-nav_button_previous",nav_button_next:"rdp-nav_button_next",nav_icon:"rdp-nav_icon",row:"rdp-row",weeknumber:"rdp-weeknumber",cell:"rdp-cell",day:"rdp-day",day_today:"rdp-day_today",day_outside:"rdp-day_outside",day_selected:"rdp-day_selected",day_disabled:"rdp-day_disabled",day_hidden:"rdp-day_hidden",day_range_start:"rdp-day_range_start",day_range_end:"rdp-day_range_end",day_range_middle:"rdp-day_range_middle"};function bDr(t,e){return fo(t,"LLLL y",e)}function xDr(t,e){return fo(t,"d",e)}function wDr(t,e){return fo(t,"LLLL",e)}function kDr(t){return"".concat(t)}function SDr(t,e){return fo(t,"cccccc",e)}function CDr(t,e){return fo(t,"yyyy",e)}var jDr=Object.freeze({__proto__:null,formatCaption:bDr,formatDay:xDr,formatMonthCaption:wDr,formatWeekNumber:kDr,formatWeekdayName:SDr,formatYearCaption:CDr}),EDr=function(t,e,n){return fo(t,"do MMMM (EEEE)",n)},NDr=function(){return"Month: "},TDr=function(){return"Go to next month"},_Dr=function(){return"Go to previous month"},ADr=function(t,e){return fo(t,"cccc",e)},PDr=function(t){return"Week n. ".concat(t)},RDr=function(){return"Year: "},IDr=Object.freeze({__proto__:null,labelDay:EDr,labelMonthDropdown:NDr,labelNext:TDr,labelPrevious:_Dr,labelWeekNumber:PDr,labelWeekday:ADr,labelYearDropdown:RDr});function MDr(){var t="buttons",e=yDr,n=u7,r={},s={},i=1,o={},l=new Date;return{captionLayout:t,classNames:e,formatters:jDr,labels:IDr,locale:n,modifiersClassNames:r,modifiers:s,numberOfMonths:i,styles:o,today:l,mode:"default"}}function LDr(t){var e=t.fromYear,n=t.toYear,r=t.fromMonth,s=t.toMonth,i=t.fromDate,o=t.toDate;return r?i=vc(r):e&&(i=new Date(e,0,1)),s?o=pte(s):n&&(o=new Date(n,11,31)),{fromDate:i?Rk(i):void 0,toDate:o?Rk(o):void 0}}var p5t=y.createContext(void 0);function DDr(t){var e,n=t.initialProps,r=MDr(),s=LDr(n),i=s.fromDate,o=s.toDate,l=(e=n.captionLayout)!==null&&e!==void 0?e:r.captionLayout;l!=="buttons"&&(!i||!o)&&(l="buttons");var c;(aie(n)||y9(n)||b9(n))&&(c=n.onSelect);var d=os(os(os({},r),n),{captionLayout:l,classNames:os(os({},r.classNames),n.classNames),components:os({},n.components),formatters:os(os({},r.formatters),n.formatters),fromDate:i,labels:os(os({},r.labels),n.labels),mode:n.mode||r.mode,modifiers:os(os({},r.modifiers),n.modifiers),modifiersClassNames:os(os({},r.modifiersClassNames),n.modifiersClassNames),onSelect:c,styles:os(os({},r.styles),n.styles),toDate:o});return a.jsx(p5t.Provider,{value:d,children:t.children})}function Fa(){var t=y.useContext(p5t);if(!t)throw new Error("useDayPicker must be used within a DayPickerProvider.");return t}function g5t(t){var e=Fa(),n=e.locale,r=e.classNames,s=e.styles,i=e.formatters.formatCaption;return a.jsx("div",{className:r.caption_label,style:s.caption_label,"aria-live":"polite",role:"presentation",id:t.id,children:i(t.displayMonth,{locale:n})})}function $Dr(t){return a.jsx("svg",os({width:"8px",height:"8px",viewBox:"0 0 120 120","data-testid":"iconDropdown"},t,{children:a.jsx("path",{d:"M4.22182541,48.2218254 C8.44222828,44.0014225 15.2388494,43.9273804 19.5496459,47.9996989 L19.7781746,48.2218254 L60,88.443 L100.221825,48.2218254 C104.442228,44.0014225 111.238849,43.9273804 115.549646,47.9996989 L115.778175,48.2218254 C119.998577,52.4422283 120.07262,59.2388494 116.000301,63.5496459 L115.778175,63.7781746 L67.7781746,111.778175 C63.5577717,115.998577 56.7611506,116.07262 52.4503541,112.000301 L52.2218254,111.778175 L4.22182541,63.7781746 C-0.0739418023,59.4824074 -0.0739418023,52.5175926 4.22182541,48.2218254 Z",fill:"currentColor",fillRule:"nonzero"})}))}function v5t(t){var e,n,r=t.onChange,s=t.value,i=t.children,o=t.caption,l=t.className,c=t.style,d=Fa(),u=(n=(e=d.components)===null||e===void 0?void 0:e.IconDropdown)!==null&&n!==void 0?n:$Dr;return a.jsxs("div",{className:l,style:c,children:[a.jsx("span",{className:d.classNames.vhidden,children:t["aria-label"]}),a.jsx("select",{name:t.name,"aria-label":t["aria-label"],className:d.classNames.dropdown,style:d.styles.dropdown,value:s,onChange:r,children:i}),a.jsxs("div",{className:d.classNames.caption_label,style:d.styles.caption_label,"aria-hidden":"true",children:[o,a.jsx(u,{className:d.classNames.dropdown_icon,style:d.styles.dropdown_icon})]})]})}function ODr(t){var e,n=Fa(),r=n.fromDate,s=n.toDate,i=n.styles,o=n.locale,l=n.formatters.formatMonthCaption,c=n.classNames,d=n.components,u=n.labels.labelMonthDropdown;if(!r)return a.jsx(a.Fragment,{});if(!s)return a.jsx(a.Fragment,{});var h=[];if(Nge(r,s))for(var m=vc(r),f=r.getMonth();f<=s.getMonth();f++)h.push(dle(m,f));else for(var m=vc(new Date),f=0;f<=11;f++)h.push(dle(m,f));var p=function(v){var b=Number(v.target.value),x=dle(vc(t.displayMonth),b);t.onChange(x)},g=(e=d==null?void 0:d.Dropdown)!==null&&e!==void 0?e:v5t;return a.jsx(g,{name:"months","aria-label":u(),className:c.dropdown_month,style:i.dropdown_month,onChange:p,value:t.displayMonth.getMonth(),caption:l(t.displayMonth,{locale:o}),children:h.map(function(v){return a.jsx("option",{value:v.getMonth(),children:l(v,{locale:o})},v.getMonth())})})}function FDr(t){var e,n=t.displayMonth,r=Fa(),s=r.fromDate,i=r.toDate,o=r.locale,l=r.styles,c=r.classNames,d=r.components,u=r.formatters.formatYearCaption,h=r.labels.labelYearDropdown,m=[];if(!s)return a.jsx(a.Fragment,{});if(!i)return a.jsx(a.Fragment,{});for(var f=s.getFullYear(),p=i.getFullYear(),g=f;g<=p;g++)m.push(v$e(Xje(new Date),g));var v=function(x){var w=v$e(vc(n),Number(x.target.value));t.onChange(w)},b=(e=d==null?void 0:d.Dropdown)!==null&&e!==void 0?e:v5t;return a.jsx(b,{name:"years","aria-label":h(),className:c.dropdown_year,style:l.dropdown_year,onChange:v,value:n.getFullYear(),caption:u(n,{locale:o}),children:m.map(function(x){return a.jsx("option",{value:x.getFullYear(),children:u(x,{locale:o})},x.getFullYear())})})}function BDr(t,e){var n=y.useState(t),r=n[0],s=n[1],i=e===void 0?r:e;return[i,s]}function UDr(t){var e=t.month,n=t.defaultMonth,r=t.today,s=e||n||r||new Date,i=t.toDate,o=t.fromDate,l=t.numberOfMonths,c=l===void 0?1:l;if(i&&hR(i,s)<0){var d=-1*(c-1);s=Uf(i,d)}return o&&hR(s,o)<0&&(s=o),vc(s)}function zDr(){var t=Fa(),e=UDr(t),n=BDr(e,t.month),r=n[0],s=n[1],i=function(o){var l;if(!t.disableNavigation){var c=vc(o);s(c),(l=t.onMonthChange)===null||l===void 0||l.call(t,c)}};return[r,i]}function VDr(t,e){for(var n=e.reverseMonths,r=e.numberOfMonths,s=vc(t),i=vc(Uf(s,r)),o=hR(i,s),l=[],c=0;c<o;c++){var d=Uf(s,c);l.push(d)}return n&&(l=l.reverse()),l}function HDr(t,e){if(!e.disableNavigation){var n=e.toDate,r=e.pagedNavigation,s=e.numberOfMonths,i=s===void 0?1:s,o=r?i:1,l=vc(t);if(!n)return Uf(l,o);var c=hR(n,t);if(!(c<i))return Uf(l,o)}}function GDr(t,e){if(!e.disableNavigation){var n=e.fromDate,r=e.pagedNavigation,s=e.numberOfMonths,i=s===void 0?1:s,o=r?i:1,l=vc(t);if(!n)return Uf(l,-o);var c=hR(l,n);if(!(c<=0))return Uf(l,-o)}}var y5t=y.createContext(void 0);function WDr(t){var e=Fa(),n=zDr(),r=n[0],s=n[1],i=VDr(r,e),o=HDr(r,e),l=GDr(r,e),c=function(h){return i.some(function(m){return gte(h,m)})},d=function(h,m){c(h)||(m&&qut(h,m)?s(Uf(h,1+e.numberOfMonths*-1)):s(h))},u={currentMonth:r,displayMonths:i,goToMonth:s,goToDate:d,previousMonth:l,nextMonth:o,isDateDisplayed:c};return a.jsx(y5t.Provider,{value:u,children:t.children})}function x9(){var t=y.useContext(y5t);if(!t)throw new Error("useNavigation must be used within a NavigationProvider");return t}function JWe(t){var e,n=Fa(),r=n.classNames,s=n.styles,i=n.components,o=x9().goToMonth,l=function(u){o(Uf(u,t.displayIndex?-t.displayIndex:0))},c=(e=i==null?void 0:i.CaptionLabel)!==null&&e!==void 0?e:g5t,d=a.jsx(c,{id:t.id,displayMonth:t.displayMonth});return a.jsxs("div",{className:r.caption_dropdowns,style:s.caption_dropdowns,children:[a.jsx("div",{className:r.vhidden,children:d}),a.jsx(ODr,{onChange:l,displayMonth:t.displayMonth}),a.jsx(FDr,{onChange:l,displayMonth:t.displayMonth})]})}function qDr(t){return a.jsx("svg",os({width:"16px",height:"16px",viewBox:"0 0 120 120"},t,{children:a.jsx("path",{d:"M69.490332,3.34314575 C72.6145263,0.218951416 77.6798462,0.218951416 80.8040405,3.34314575 C83.8617626,6.40086786 83.9268205,11.3179931 80.9992143,14.4548388 L80.8040405,14.6568542 L35.461,60 L80.8040405,105.343146 C83.8617626,108.400868 83.9268205,113.317993 80.9992143,116.454839 L80.8040405,116.656854 C77.7463184,119.714576 72.8291931,119.779634 69.6923475,116.852028 L69.490332,116.656854 L18.490332,65.6568542 C15.4326099,62.5991321 15.367552,57.6820069 18.2951583,54.5451612 L18.490332,54.3431458 L69.490332,3.34314575 Z",fill:"currentColor",fillRule:"nonzero"})}))}function KDr(t){return a.jsx("svg",os({width:"16px",height:"16px",viewBox:"0 0 120 120"},t,{children:a.jsx("path",{d:"M49.8040405,3.34314575 C46.6798462,0.218951416 41.6145263,0.218951416 38.490332,3.34314575 C35.4326099,6.40086786 35.367552,11.3179931 38.2951583,14.4548388 L38.490332,14.6568542 L83.8333725,60 L38.490332,105.343146 C35.4326099,108.400868 35.367552,113.317993 38.2951583,116.454839 L38.490332,116.656854 C41.5480541,119.714576 46.4651794,119.779634 49.602025,116.852028 L49.8040405,116.656854 L100.804041,65.6568542 C103.861763,62.5991321 103.926821,57.6820069 100.999214,54.5451612 L100.804041,54.3431458 L49.8040405,3.34314575 Z",fill:"currentColor"})}))}var gJ=y.forwardRef(function(t,e){var n=Fa(),r=n.classNames,s=n.styles,i=[r.button_reset,r.button];t.className&&i.push(t.className);var o=i.join(" "),l=os(os({},s.button_reset),s.button);return t.style&&Object.assign(l,t.style),a.jsx("button",os({},t,{ref:e,type:"button",className:o,style:l}))});function YDr(t){var e,n,r=Fa(),s=r.dir,i=r.locale,o=r.classNames,l=r.styles,c=r.labels,d=c.labelPrevious,u=c.labelNext,h=r.components;if(!t.nextMonth&&!t.previousMonth)return a.jsx(a.Fragment,{});var m=d(t.previousMonth,{locale:i}),f=[o.nav_button,o.nav_button_previous].join(" "),p=u(t.nextMonth,{locale:i}),g=[o.nav_button,o.nav_button_next].join(" "),v=(e=h==null?void 0:h.IconRight)!==null&&e!==void 0?e:KDr,b=(n=h==null?void 0:h.IconLeft)!==null&&n!==void 0?n:qDr;return a.jsxs("div",{className:o.nav,style:l.nav,children:[!t.hidePrevious&&a.jsx(gJ,{name:"previous-month","aria-label":m,className:f,style:l.nav_button_previous,disabled:!t.previousMonth,onClick:t.onPreviousClick,children:s==="rtl"?a.jsx(v,{className:o.nav_icon,style:l.nav_icon}):a.jsx(b,{className:o.nav_icon,style:l.nav_icon})}),!t.hideNext&&a.jsx(gJ,{name:"next-month","aria-label":p,className:g,style:l.nav_button_next,disabled:!t.nextMonth,onClick:t.onNextClick,children:s==="rtl"?a.jsx(b,{className:o.nav_icon,style:l.nav_icon}):a.jsx(v,{className:o.nav_icon,style:l.nav_icon})})]})}function XWe(t){var e=Fa().numberOfMonths,n=x9(),r=n.previousMonth,s=n.nextMonth,i=n.goToMonth,o=n.displayMonths,l=o.findIndex(function(p){return gte(t.displayMonth,p)}),c=l===0,d=l===o.length-1,u=e>1&&(c||!d),h=e>1&&(d||!c),m=function(){r&&i(r)},f=function(){s&&i(s)};return a.jsx(YDr,{displayMonth:t.displayMonth,hideNext:u,hidePrevious:h,nextMonth:s,previousMonth:r,onPreviousClick:m,onNextClick:f})}function QDr(t){var e,n=Fa(),r=n.classNames,s=n.disableNavigation,i=n.styles,o=n.captionLayout,l=n.components,c=(e=l==null?void 0:l.CaptionLabel)!==null&&e!==void 0?e:g5t,d;return s?d=a.jsx(c,{id:t.id,displayMonth:t.displayMonth}):o==="dropdown"?d=a.jsx(JWe,{displayMonth:t.displayMonth,id:t.id}):o==="dropdown-buttons"?d=a.jsxs(a.Fragment,{children:[a.jsx(JWe,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id}),a.jsx(XWe,{displayMonth:t.displayMonth,displayIndex:t.displayIndex,id:t.id})]}):d=a.jsxs(a.Fragment,{children:[a.jsx(c,{id:t.id,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),a.jsx(XWe,{displayMonth:t.displayMonth,id:t.id})]}),a.jsx("div",{className:r.caption,style:i.caption,children:d})}function ZDr(t){var e=Fa(),n=e.footer,r=e.styles,s=e.classNames.tfoot;return n?a.jsx("tfoot",{className:s,style:r.tfoot,children:a.jsx("tr",{children:a.jsx("td",{colSpan:8,children:n})})}):a.jsx(a.Fragment,{})}function JDr(t,e,n){for(var r=n?Jx(new Date):Em(new Date,{locale:t,weekStartsOn:e}),s=[],i=0;i<7;i++){var o=ld(r,i);s.push(o)}return s}function XDr(){var t=Fa(),e=t.classNames,n=t.styles,r=t.showWeekNumber,s=t.locale,i=t.weekStartsOn,o=t.ISOWeek,l=t.formatters.formatWeekdayName,c=t.labels.labelWeekday,d=JDr(s,i,o);return a.jsxs("tr",{style:n.head_row,className:e.head_row,children:[r&&a.jsx("td",{style:n.head_cell,className:e.head_cell}),d.map(function(u,h){return a.jsx("th",{scope:"col",className:e.head_cell,style:n.head_cell,"aria-label":c(u,{locale:s}),children:l(u,{locale:s})},h)})]})}function e$r(){var t,e=Fa(),n=e.classNames,r=e.styles,s=e.components,i=(t=s==null?void 0:s.HeadRow)!==null&&t!==void 0?t:XDr;return a.jsx("thead",{style:r.head,className:n.head,children:a.jsx(i,{})})}function t$r(t){var e=Fa(),n=e.locale,r=e.formatters.formatDay;return a.jsx(a.Fragment,{children:r(t.date,{locale:n})})}var IRe=y.createContext(void 0);function n$r(t){if(!y9(t.initialProps)){var e={selected:void 0,modifiers:{disabled:[]}};return a.jsx(IRe.Provider,{value:e,children:t.children})}return a.jsx(r$r,{initialProps:t.initialProps,children:t.children})}function r$r(t){var e=t.initialProps,n=t.children,r=e.selected,s=e.min,i=e.max,o=function(d,u,h){var m,f;(m=e.onDayClick)===null||m===void 0||m.call(e,d,u,h);var p=!!(u.selected&&s&&(r==null?void 0:r.length)===s);if(!p){var g=!!(!u.selected&&i&&(r==null?void 0:r.length)===i);if(!g){var v=r?f5t([],r):[];if(u.selected){var b=v.findIndex(function(x){return Gd(d,x)});v.splice(b,1)}else v.push(d);(f=e.onSelect)===null||f===void 0||f.call(e,v,d,u,h)}}},l={disabled:[]};r&&l.disabled.push(function(d){var u=i&&r.length>i-1,h=r.some(function(m){return Gd(m,d)});return!!(u&&!h)});var c={selected:r,onDayClick:o,modifiers:l};return a.jsx(IRe.Provider,{value:c,children:n})}function MRe(){var t=y.useContext(IRe);if(!t)throw new Error("useSelectMultiple must be used within a SelectMultipleProvider");return t}function s$r(t,e){var n=e||{},r=n.from,s=n.to;return r&&s?Gd(s,t)&&Gd(r,t)?void 0:Gd(s,t)?{from:s,to:void 0}:Gd(r,t)?void 0:Ege(r,t)?{from:t,to:s}:{from:r,to:t}:s?Ege(t,s)?{from:s,to:t}:{from:t,to:s}:r?qut(t,r)?{from:t,to:r}:{from:r,to:t}:{from:t,to:void 0}}var LRe=y.createContext(void 0);function i$r(t){if(!b9(t.initialProps)){var e={selected:void 0,modifiers:{range_start:[],range_end:[],range_middle:[],disabled:[]}};return a.jsx(LRe.Provider,{value:e,children:t.children})}return a.jsx(a$r,{initialProps:t.initialProps,children:t.children})}function a$r(t){var e=t.initialProps,n=t.children,r=e.selected,s=r||{},i=s.from,o=s.to,l=e.min,c=e.max,d=function(f,p,g){var v,b;(v=e.onDayClick)===null||v===void 0||v.call(e,f,p,g);var x=s$r(f,r);(b=e.onSelect)===null||b===void 0||b.call(e,x,f,p,g)},u={range_start:[],range_end:[],range_middle:[],disabled:[]};if(i?(u.range_start=[i],o?(u.range_end=[o],Gd(i,o)||(u.range_middle=[{after:i,before:o}])):u.range_end=[i]):o&&(u.range_start=[o],u.range_end=[o]),l&&(i&&!o&&u.disabled.push({after:ID(i,l-1),before:ld(i,l-1)}),i&&o&&u.disabled.push({after:i,before:ld(i,l-1)}),!i&&o&&u.disabled.push({after:ID(o,l-1),before:ld(o,l-1)})),c){if(i&&!o&&(u.disabled.push({before:ld(i,-c+1)}),u.disabled.push({after:ld(i,c-1)})),i&&o){var h=kf(o,i)+1,m=c-h;u.disabled.push({before:ID(i,m)}),u.disabled.push({after:ld(o,m)})}!i&&o&&(u.disabled.push({before:ld(o,-c+1)}),u.disabled.push({after:ld(o,c-1)}))}return a.jsx(LRe.Provider,{value:{selected:r,onDayClick:d,modifiers:u},children:n})}function DRe(){var t=y.useContext(LRe);if(!t)throw new Error("useSelectRange must be used within a SelectRangeProvider");return t}function Cq(t){return Array.isArray(t)?f5t([],t):t!==void 0?[t]:[]}function o$r(t){var e={};return Object.entries(t).forEach(function(n){var r=n[0],s=n[1];e[r]=Cq(s)}),e}var Fg;(function(t){t.Outside="outside",t.Disabled="disabled",t.Selected="selected",t.Hidden="hidden",t.Today="today",t.RangeStart="range_start",t.RangeEnd="range_end",t.RangeMiddle="range_middle"})(Fg||(Fg={}));var l$r=Fg.Selected,yb=Fg.Disabled,c$r=Fg.Hidden,d$r=Fg.Today,_ue=Fg.RangeEnd,Aue=Fg.RangeMiddle,Pue=Fg.RangeStart,u$r=Fg.Outside;function h$r(t,e,n){var r,s=(r={},r[l$r]=Cq(t.selected),r[yb]=Cq(t.disabled),r[c$r]=Cq(t.hidden),r[d$r]=[t.today],r[_ue]=[],r[Aue]=[],r[Pue]=[],r[u$r]=[],r);return t.fromDate&&s[yb].push({before:t.fromDate}),t.toDate&&s[yb].push({after:t.toDate}),y9(t)?s[yb]=s[yb].concat(e.modifiers[yb]):b9(t)&&(s[yb]=s[yb].concat(n.modifiers[yb]),s[Pue]=n.modifiers[Pue],s[Aue]=n.modifiers[Aue],s[_ue]=n.modifiers[_ue]),s}var b5t=y.createContext(void 0);function m$r(t){var e=Fa(),n=MRe(),r=DRe(),s=h$r(e,n,r),i=o$r(e.modifiers),o=os(os({},s),i);return a.jsx(b5t.Provider,{value:o,children:t.children})}function x5t(){var t=y.useContext(b5t);if(!t)throw new Error("useModifiers must be used within a ModifiersProvider");return t}function f$r(t){return!!(t&&typeof t=="object"&&"before"in t&&"after"in t)}function p$r(t){return!!(t&&typeof t=="object"&&"from"in t)}function g$r(t){return!!(t&&typeof t=="object"&&"after"in t)}function v$r(t){return!!(t&&typeof t=="object"&&"before"in t)}function y$r(t){return!!(t&&typeof t=="object"&&"dayOfWeek"in t)}function b$r(t,e){var n,r=e.from,s=e.to;if(r&&s){var i=kf(s,r)<0;i&&(n=[s,r],r=n[0],s=n[1]);var o=kf(t,r)>=0&&kf(s,t)>=0;return o}return s?Gd(s,t):r?Gd(r,t):!1}function x$r(t){return Jje(t)}function w$r(t){return Array.isArray(t)&&t.every(Jje)}function k$r(t,e){return e.some(function(n){if(typeof n=="boolean")return n;if(x$r(n))return Gd(t,n);if(w$r(n))return n.includes(t);if(p$r(n))return b$r(t,n);if(y$r(n))return n.dayOfWeek.includes(t.getDay());if(f$r(n)){var r=kf(n.before,t),s=kf(n.after,t),i=r>0,o=s<0,l=Ege(n.before,n.after);return l?o&&i:i||o}return g$r(n)?kf(t,n.after)>0:v$r(n)?kf(n.before,t)>0:typeof n=="function"?n(t):!1})}function $Re(t,e,n){var r=Object.keys(e).reduce(function(i,o){var l=e[o];return k$r(t,l)&&i.push(o),i},[]),s={};return r.forEach(function(i){return s[i]=!0}),n&&!gte(t,n)&&(s.outside=!0),s}function S$r(t,e){for(var n=vc(t[0]),r=pte(t[t.length-1]),s,i,o=n;o<=r;){var l=$Re(o,e),c=!l.disabled&&!l.hidden;if(!c){o=ld(o,1);continue}if(l.selected)return o;l.today&&!i&&(i=o),s||(s=o),o=ld(o,1)}return i||s}var C$r=365;function w5t(t,e){var n=e.moveBy,r=e.direction,s=e.context,i=e.modifiers,o=e.retry,l=o===void 0?{count:0,lastFocused:t}:o,c=s.weekStartsOn,d=s.fromDate,u=s.toDate,h=s.locale,m={day:ld,week:Sge,month:Uf,year:Han,startOfWeek:function(v){return s.ISOWeek?Jx(v):Em(v,{locale:h,weekStartsOn:c})},endOfWeek:function(v){return s.ISOWeek?Vut(v):e2e(v,{locale:h,weekStartsOn:c})}},f=m[n](t,r==="after"?1:-1);r==="before"&&d?f=Gan([d,f]):r==="after"&&u&&(f=Wan([u,f]));var p=!0;if(i){var g=$Re(f,i);p=!g.disabled&&!g.hidden}return p?f:l.count>C$r?l.lastFocused:w5t(f,{moveBy:n,direction:r,context:s,modifiers:i,retry:os(os({},l),{count:l.count+1})})}var k5t=y.createContext(void 0);function j$r(t){var e=x9(),n=x5t(),r=y.useState(),s=r[0],i=r[1],o=y.useState(),l=o[0],c=o[1],d=S$r(e.displayMonths,n),u=s??(l&&e.isDateDisplayed(l))?l:d,h=function(){c(s),i(void 0)},m=function(v){i(v)},f=Fa(),p=function(v,b){if(s){var x=w5t(s,{moveBy:v,direction:b,context:f,modifiers:n});Gd(s,x)||(e.goToDate(x,s),m(x))}},g={focusedDay:s,focusTarget:u,blur:h,focus:m,focusDayAfter:function(){return p("day","after")},focusDayBefore:function(){return p("day","before")},focusWeekAfter:function(){return p("week","after")},focusWeekBefore:function(){return p("week","before")},focusMonthBefore:function(){return p("month","before")},focusMonthAfter:function(){return p("month","after")},focusYearBefore:function(){return p("year","before")},focusYearAfter:function(){return p("year","after")},focusStartOfWeek:function(){return p("startOfWeek","before")},focusEndOfWeek:function(){return p("endOfWeek","after")}};return a.jsx(k5t.Provider,{value:g,children:t.children})}function ORe(){var t=y.useContext(k5t);if(!t)throw new Error("useFocusContext must be used within a FocusProvider");return t}function E$r(t,e){var n=x5t(),r=$Re(t,n,e);return r}var FRe=y.createContext(void 0);function N$r(t){if(!aie(t.initialProps)){var e={selected:void 0};return a.jsx(FRe.Provider,{value:e,children:t.children})}return a.jsx(T$r,{initialProps:t.initialProps,children:t.children})}function T$r(t){var e=t.initialProps,n=t.children,r=function(i,o,l){var c,d,u;if((c=e.onDayClick)===null||c===void 0||c.call(e,i,o,l),o.selected&&!e.required){(d=e.onSelect)===null||d===void 0||d.call(e,void 0,i,o,l);return}(u=e.onSelect)===null||u===void 0||u.call(e,i,i,o,l)},s={selected:e.selected,onDayClick:r};return a.jsx(FRe.Provider,{value:s,children:n})}function S5t(){var t=y.useContext(FRe);if(!t)throw new Error("useSelectSingle must be used within a SelectSingleProvider");return t}function _$r(t,e){var n=Fa(),r=S5t(),s=MRe(),i=DRe(),o=ORe(),l=o.focusDayAfter,c=o.focusDayBefore,d=o.focusWeekAfter,u=o.focusWeekBefore,h=o.blur,m=o.focus,f=o.focusMonthBefore,p=o.focusMonthAfter,g=o.focusYearBefore,v=o.focusYearAfter,b=o.focusStartOfWeek,x=o.focusEndOfWeek,w=function(I){var P,M,z,G;aie(n)?(P=r.onDayClick)===null||P===void 0||P.call(r,t,e,I):y9(n)?(M=s.onDayClick)===null||M===void 0||M.call(s,t,e,I):b9(n)?(z=i.onDayClick)===null||z===void 0||z.call(i,t,e,I):(G=n.onDayClick)===null||G===void 0||G.call(n,t,e,I)},k=function(I){var P;m(t),(P=n.onDayFocus)===null||P===void 0||P.call(n,t,e,I)},S=function(I){var P;h(),(P=n.onDayBlur)===null||P===void 0||P.call(n,t,e,I)},C=function(I){var P;(P=n.onDayMouseEnter)===null||P===void 0||P.call(n,t,e,I)},j=function(I){var P;(P=n.onDayMouseLeave)===null||P===void 0||P.call(n,t,e,I)},E=function(I){var P;(P=n.onDayPointerEnter)===null||P===void 0||P.call(n,t,e,I)},N=function(I){var P;(P=n.onDayPointerLeave)===null||P===void 0||P.call(n,t,e,I)},A=function(I){var P;(P=n.onDayTouchCancel)===null||P===void 0||P.call(n,t,e,I)},_=function(I){var P;(P=n.onDayTouchEnd)===null||P===void 0||P.call(n,t,e,I)},T=function(I){var P;(P=n.onDayTouchMove)===null||P===void 0||P.call(n,t,e,I)},R=function(I){var P;(P=n.onDayTouchStart)===null||P===void 0||P.call(n,t,e,I)},O=function(I){var P;(P=n.onDayKeyUp)===null||P===void 0||P.call(n,t,e,I)},F=function(I){var P;switch(I.key){case"ArrowLeft":I.preventDefault(),I.stopPropagation(),n.dir==="rtl"?l():c();break;case"ArrowRight":I.preventDefault(),I.stopPropagation(),n.dir==="rtl"?c():l();break;case"ArrowDown":I.preventDefault(),I.stopPropagation(),d();break;case"ArrowUp":I.preventDefault(),I.stopPropagation(),u();break;case"PageUp":I.preventDefault(),I.stopPropagation(),I.shiftKey?g():f();break;case"PageDown":I.preventDefault(),I.stopPropagation(),I.shiftKey?v():p();break;case"Home":I.preventDefault(),I.stopPropagation(),b();break;case"End":I.preventDefault(),I.stopPropagation(),x();break}(P=n.onDayKeyDown)===null||P===void 0||P.call(n,t,e,I)},D={onClick:w,onFocus:k,onBlur:S,onKeyDown:F,onKeyUp:O,onMouseEnter:C,onMouseLeave:j,onPointerEnter:E,onPointerLeave:N,onTouchCancel:A,onTouchEnd:_,onTouchMove:T,onTouchStart:R};return D}function A$r(){var t=Fa(),e=S5t(),n=MRe(),r=DRe(),s=aie(t)?e.selected:y9(t)?n.selected:b9(t)?r.selected:void 0;return s}function P$r(t){return Object.values(Fg).includes(t)}function R$r(t,e){var n=[t.classNames.day];return Object.keys(e).forEach(function(r){var s=t.modifiersClassNames[r];if(s)n.push(s);else if(P$r(r)){var i=t.classNames["day_".concat(r)];i&&n.push(i)}}),n}function I$r(t,e){var n=os({},t.styles.day);return Object.keys(e).forEach(function(r){var s;n=os(os({},n),(s=t.modifiersStyles)===null||s===void 0?void 0:s[r])}),n}function M$r(t,e,n){var r,s,i,o=Fa(),l=ORe(),c=E$r(t,e),d=_$r(t,c),u=A$r(),h=!!(o.onDayClick||o.mode!=="default");y.useEffect(function(){var C;c.outside||l.focusedDay&&h&&Gd(l.focusedDay,t)&&((C=n.current)===null||C===void 0||C.focus())},[l.focusedDay,t,n,h,c.outside]);var m=R$r(o,c).join(" "),f=I$r(o,c),p=!!(c.outside&&!o.showOutsideDays||c.hidden),g=(i=(s=o.components)===null||s===void 0?void 0:s.DayContent)!==null&&i!==void 0?i:t$r,v=a.jsx(g,{date:t,displayMonth:e,activeModifiers:c}),b={style:f,className:m,children:v,role:"gridcell"},x=l.focusTarget&&Gd(l.focusTarget,t)&&!c.outside,w=l.focusedDay&&Gd(l.focusedDay,t),k=os(os(os({},b),(r={disabled:c.disabled,role:"gridcell"},r["aria-selected"]=c.selected,r.tabIndex=w||x?0:-1,r)),d),S={isButton:h,isHidden:p,activeModifiers:c,selectedDays:u,buttonProps:k,divProps:b};return S}function L$r(t){var e=y.useRef(null),n=M$r(t.date,t.displayMonth,e);return n.isHidden?a.jsx("div",{role:"gridcell"}):n.isButton?a.jsx(gJ,os({name:"day",ref:e},n.buttonProps)):a.jsx("div",os({},n.divProps))}function D$r(t){var e=t.number,n=t.dates,r=Fa(),s=r.onWeekNumberClick,i=r.styles,o=r.classNames,l=r.locale,c=r.labels.labelWeekNumber,d=r.formatters.formatWeekNumber,u=d(Number(e),{locale:l});if(!s)return a.jsx("span",{className:o.weeknumber,style:i.weeknumber,children:u});var h=c(Number(e),{locale:l}),m=function(f){s(e,n,f)};return a.jsx(gJ,{name:"week-number","aria-label":h,className:o.weeknumber,style:i.weeknumber,onClick:m,children:u})}function $$r(t){var e,n,r=Fa(),s=r.styles,i=r.classNames,o=r.showWeekNumber,l=r.components,c=(e=l==null?void 0:l.Day)!==null&&e!==void 0?e:L$r,d=(n=l==null?void 0:l.WeekNumber)!==null&&n!==void 0?n:D$r,u;return o&&(u=a.jsx("td",{className:i.cell,style:s.cell,children:a.jsx(d,{number:t.weekNumber,dates:t.dates})})),a.jsxs("tr",{className:i.row,style:s.row,children:[u,t.dates.map(function(h){return a.jsx("td",{className:i.cell,style:s.cell,role:"presentation",children:a.jsx(c,{displayMonth:t.displayMonth,date:h})},Jon(h))})]})}function eqe(t,e,n){for(var r=n!=null&&n.ISOWeek?Vut(e):e2e(e,n),s=n!=null&&n.ISOWeek?Jx(t):Em(t,n),i=kf(r,s),o=[],l=0;l<=i;l++)o.push(ld(s,l));var c=o.reduce(function(d,u){var h=n!=null&&n.ISOWeek?t2e(u):r2e(u,n),m=d.find(function(f){return f.weekNumber===h});return m?(m.dates.push(u),d):(d.push({weekNumber:h,dates:[u]}),d)},[]);return c}function O$r(t,e){var n=eqe(vc(t),pte(t),e);if(e!=null&&e.useFixedWeeks){var r=eln(t,e);if(r<6){var s=n[n.length-1],i=s.dates[s.dates.length-1],o=Sge(i,6-r),l=eqe(Sge(i,1),o,e);n.push.apply(n,l)}}return n}function F$r(t){var e,n,r,s=Fa(),i=s.locale,o=s.classNames,l=s.styles,c=s.hideHead,d=s.fixedWeeks,u=s.components,h=s.weekStartsOn,m=s.firstWeekContainsDate,f=s.ISOWeek,p=O$r(t.displayMonth,{useFixedWeeks:!!d,ISOWeek:f,locale:i,weekStartsOn:h,firstWeekContainsDate:m}),g=(e=u==null?void 0:u.Head)!==null&&e!==void 0?e:e$r,v=(n=u==null?void 0:u.Row)!==null&&n!==void 0?n:$$r,b=(r=u==null?void 0:u.Footer)!==null&&r!==void 0?r:ZDr;return a.jsxs("table",{id:t.id,className:o.table,style:l.table,role:"grid","aria-labelledby":t["aria-labelledby"],children:[!c&&a.jsx(g,{}),a.jsx("tbody",{className:o.tbody,style:l.tbody,children:p.map(function(x){return a.jsx(v,{displayMonth:t.displayMonth,dates:x.dates,weekNumber:x.weekNumber},x.weekNumber)})}),a.jsx(b,{displayMonth:t.displayMonth})]})}function B$r(){return!!(typeof window<"u"&&window.document&&window.document.createElement)}var U$r=B$r()?y.useLayoutEffect:y.useEffect,Rue=!1,z$r=0;function tqe(){return"react-day-picker-".concat(++z$r)}function V$r(t){var e,n=t??(Rue?tqe():null),r=y.useState(n),s=r[0],i=r[1];return U$r(function(){s===null&&i(tqe())},[]),y.useEffect(function(){Rue===!1&&(Rue=!0)},[]),(e=t??s)!==null&&e!==void 0?e:void 0}function H$r(t){var e,n,r=Fa(),s=r.dir,i=r.classNames,o=r.styles,l=r.components,c=x9().displayMonths,d=V$r(r.id?"".concat(r.id,"-").concat(t.displayIndex):void 0),u=r.id?"".concat(r.id,"-grid-").concat(t.displayIndex):void 0,h=[i.month],m=o.month,f=t.displayIndex===0,p=t.displayIndex===c.length-1,g=!f&&!p;s==="rtl"&&(e=[f,p],p=e[0],f=e[1]),f&&(h.push(i.caption_start),m=os(os({},m),o.caption_start)),p&&(h.push(i.caption_end),m=os(os({},m),o.caption_end)),g&&(h.push(i.caption_between),m=os(os({},m),o.caption_between));var v=(n=l==null?void 0:l.Caption)!==null&&n!==void 0?n:QDr;return a.jsxs("div",{className:h.join(" "),style:m,children:[a.jsx(v,{id:d,displayMonth:t.displayMonth,displayIndex:t.displayIndex}),a.jsx(F$r,{id:u,"aria-labelledby":d,displayMonth:t.displayMonth})]},t.displayIndex)}function G$r(t){var e=Fa(),n=e.classNames,r=e.styles;return a.jsx("div",{className:n.months,style:r.months,children:t.children})}function W$r(t){var e,n,r=t.initialProps,s=Fa(),i=ORe(),o=x9(),l=y.useState(!1),c=l[0],d=l[1];y.useEffect(function(){s.initialFocus&&i.focusTarget&&(c||(i.focus(i.focusTarget),d(!0)))},[s.initialFocus,c,i.focus,i.focusTarget,i]);var u=[s.classNames.root,s.className];s.numberOfMonths>1&&u.push(s.classNames.multiple_months),s.showWeekNumber&&u.push(s.classNames.with_weeknumber);var h=os(os({},s.styles.root),s.style),m=Object.keys(r).filter(function(p){return p.startsWith("data-")}).reduce(function(p,g){var v;return os(os({},p),(v={},v[g]=r[g],v))},{}),f=(n=(e=r.components)===null||e===void 0?void 0:e.Months)!==null&&n!==void 0?n:G$r;return a.jsx("div",os({className:u.join(" "),style:h,dir:s.dir,id:s.id,nonce:r.nonce,title:r.title,lang:r.lang},m,{children:a.jsx(f,{children:o.displayMonths.map(function(p,g){return a.jsx(H$r,{displayIndex:g,displayMonth:p},g)})})}))}function q$r(t){var e=t.children,n=vDr(t,["children"]);return a.jsx(DDr,{initialProps:n,children:a.jsx(WDr,{children:a.jsx(N$r,{initialProps:n,children:a.jsx(n$r,{initialProps:n,children:a.jsx(i$r,{initialProps:n,children:a.jsx(m$r,{children:a.jsx(j$r,{children:e})})})})})})})}function K$r(t){return a.jsx(q$r,os({},t,{children:a.jsx(W$r,{initialProps:t})}))}function BRe({className:t,classNames:e,showOutsideDays:n=!0,...r}){return a.jsx(K$r,{showOutsideDays:n,className:ee("p-3",t),classNames:{months:"flex flex-col sm:flex-row space-y-4 sm:space-x-4 sm:space-y-0",month:"space-y-4",caption:"flex justify-center pt-1 relative items-center",caption_label:"text-sm font-medium",nav:"space-x-1 flex items-center",nav_button:ee(GO({variant:"outline"}),"h-7 w-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-y-1",head_row:"flex",head_cell:"text-muted-foreground rounded-md w-9 font-normal text-[0.8rem]",row:"flex w-full mt-2",cell:"h-9 w-9 text-center text-sm p-0 relative [&:has([aria-selected].day-range-end)]:rounded-r-md [&:has([aria-selected].day-outside)]:bg-accent/50 [&:has([aria-selected])]:bg-accent first:[&:has([aria-selected])]:rounded-l-md last:[&:has([aria-selected])]:rounded-r-md focus-within:relative focus-within:z-20",day:ee(GO({variant:"ghost"}),"h-9 w-9 p-0 font-normal aria-selected:opacity-100"),day_range_end:"day-range-end",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 opacity-50 aria-selected:bg-accent/50 aria-selected:text-muted-foreground aria-selected:opacity-30",day_disabled:"text-muted-foreground opacity-50",day_range_middle:"aria-selected:bg-accent aria-selected:text-accent-foreground",day_hidden:"invisible",...e},components:{IconLeft:({...s})=>a.jsx(nl,{className:"h-4 w-4"}),IconRight:({...s})=>a.jsx(io,{className:"h-4 w-4"})},...r})}BRe.displayName="Calendar";const Iue=768;function Y$r(){const[t,e]=y.useState(void 0);return y.useEffect(()=>{const n=window.matchMedia(`(max-width: ${Iue-1}px)`),r=()=>{e(window.innerWidth<Iue)};return n.addEventListener("change",r),e(window.innerWidth<Iue),()=>n.removeEventListener("change",r)},[]),!!t}const C5t=[{value:"today",label:"Today"},{value:"last-7-days",label:"Last 7 days"},{value:"last-4-weeks",label:"Last 4 weeks"},{value:"last-6-months",label:"Last 6 months"},{value:"last-12-months",label:"Last 12 months"},{value:"month-to-date",label:"Month to date"},{value:"quarter-to-date",label:"Quarter to date"},{value:"year-to-date",label:"Year to date"},{value:"all-time",label:"All time"}],jF=t=>fo(t,"yyyy-MM-dd");function Q$r(t,e=new Date){const n=jF(e),r={today:e,"last-7-days":ID(e,6),"last-4-weeks":ID(e,27),"last-6-months":Tge(e,6),"last-12-months":Tge(e,12),"month-to-date":vc(e),"quarter-to-date":ton(e),"year-to-date":Xje(e)};return t==="all-time"?{preset:t}:{from:jF(r[t]),to:n,preset:t}}const EF=t=>!!(t.from||t.to),i2=t=>t&&/^\d{4}-\d{2}-\d{2}$/.test(t)?Jut(t):void 0;function Mue(t,e){const n=i2(t.to)??i2(t.from)??new Date,r=vc(Tge(n,e-1)),s=i2(t.from);return s&&s<r?vc(s):r}const cj=t=>Jut(t).toLocaleDateString(void 0,{month:"short",day:"numeric",year:"numeric"});function Z$r(t,e){const n=C5t.find(r=>r.value===t.preset);return n?e(n.label):t.from&&t.to?t.from===t.to?cj(t.from):`${cj(t.from)} → ${cj(t.to)}`:t.from?`${cj(t.from)} →`:t.to?`→ ${cj(t.to)}`:e("All time")}const j5t="bg-primary text-primary-foreground hover:bg-primary hover:text-primary-foreground focus:bg-primary focus:text-primary-foreground !rounded-full";function J$r({value:t,onChange:e,earliest:n,latest:r,placeholder:s,ariaLabel:i,className:o}){const[l,c]=y.useState(!1),d=i2(t);return a.jsxs(Ni,{open:l,onOpenChange:c,children:[a.jsx(Ti,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",className:ee("min-w-0 justify-start gap-2 font-normal",o),"aria-label":`${i}: ${t?cj(t):s}`,children:[a.jsx(ym,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0}),a.jsx("span",{className:ee("truncate",t?"font-medium text-primary":"text-muted-foreground"),children:t?cj(t):s}),a.jsx(li,{className:"ml-auto h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0})]})}),a.jsx(yi,{align:"start",collisionPadding:16,className:"w-auto p-3",children:a.jsx(BRe,{mode:"single",showOutsideDays:!1,selected:d,defaultMonth:d??n,fromDate:n,toDate:r,disabled:[...n?[{before:n}]:[],...r?[{after:r}]:[]],onSelect:u=>{u&&(e(jF(u)),c(!1))},className:"p-0 pointer-events-auto",classNames:{day_selected:j5t}})})]})}function E5t({value:t,onApply:e,showPresets:n=!0,months:r,openEnded:s=!1}){const i=Tn(),o=Y$r(),l=y.useId(),c=r??(o?1:2),[d,u]=y.useState(t),[h,m]=y.useState(()=>Mue(t,c)),f=x=>{const w=Q$r(x);u(w),m(Mue(w,c))},p=x=>u({from:x!=null&&x.from?jF(x.from):void 0,to:x!=null&&x.to?jF(x.to):void 0}),g=(x,w)=>{const k={...d,preset:void 0,[x]:w||void 0};k.from&&k.to&&k.from>k.to&&(k[x==="from"?"to":"from"]=w),u(k),i2(w)&&m(Mue(k,c))},v=()=>{const x=!s&&d.from&&!d.to&&!d.preset?{...d,to:d.from}:d;e(EF(x)?x:{})},b=d.preset??(EF(d)?void 0:"all-time");return a.jsxs("div",{className:"flex flex-col md:flex-row",children:[n&&a.jsx("div",{className:"flex gap-1 overflow-x-auto border-b p-2 md:w-44 md:shrink-0 md:flex-col md:overflow-visible md:border-b-0 md:border-r md:p-3",role:"listbox","aria-label":i("Date range"),children:C5t.map(x=>a.jsx("button",{type:"button",role:"option","aria-selected":b===x.value,onClick:()=>f(x.value),className:ee("shrink-0 whitespace-nowrap rounded-md px-3 py-1.5 text-left text-sm transition-colors",b===x.value?"bg-primary/10 font-medium text-primary":"text-foreground hover:bg-muted"),children:i(x.label)},x.value))}),a.jsxs("div",{className:"min-w-0 flex-1 p-3",children:[a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx(_e,{htmlFor:`${l}-start`,className:"text-xs text-muted-foreground",children:i("Start")}),a.jsx(Oe,{id:`${l}-start`,type:"date",value:d.from??"",onChange:x=>g("from",x.target.value)})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(_e,{htmlFor:`${l}-end`,className:"text-xs text-muted-foreground",children:i("End")}),a.jsx(Oe,{id:`${l}-end`,type:"date",value:d.to??"",onChange:x=>g("to",x.target.value)})]})]}),a.jsx(BRe,{mode:"range",numberOfMonths:c,showOutsideDays:!1,month:h,onMonthChange:m,selected:{from:i2(d.from),to:i2(d.to)},onSelect:p,className:"mt-2 flex justify-center p-0 pointer-events-auto",classNames:{day_selected:j5t,day_range_middle:"aria-selected:bg-transparent aria-selected:text-primary !rounded-none",cell:"h-9 w-9 p-0 text-center text-sm relative [&:has([aria-selected])]:bg-primary/10 first:[&:has([aria-selected])]:rounded-l-full last:[&:has([aria-selected])]:rounded-r-full [&:has(.day-range-start)]:rounded-l-full [&:has(.day-range-end)]:rounded-r-full focus-within:relative focus-within:z-20",day_range_start:"day-range-start"}}),a.jsxs("div",{className:"mt-3 flex justify-end gap-2 border-t pt-3",children:[a.jsx(Z,{type:"button",variant:"outline",size:"sm",onClick:()=>u({}),children:i("Clear")}),a.jsx(Z,{type:"button",size:"sm",onClick:v,children:i("Apply")})]})]})]})}function URe({value:t,onChange:e,className:n,customOnly:r=!1}){const s=Tn(),[i,o]=y.useState(!1),l=EF(t),c=r&&!l?s("Custom range"):Z$r(t,s);return a.jsxs(Ni,{open:i,onOpenChange:o,children:[a.jsx(Ti,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",className:ee("min-w-0 justify-start gap-2 font-normal",n),"aria-label":`${s("Date range")}: ${c}`,children:[a.jsx(ym,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0}),!r&&a.jsx("span",{className:"shrink-0 text-muted-foreground lg:hidden 2xl:inline",children:s("Date range")}),a.jsx("span",{className:ee("truncate",l?"font-medium text-primary":r?"text-muted-foreground":"text-foreground"),children:c}),a.jsx(li,{className:"ml-auto h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0})]})}),a.jsx(yi,{align:"end",collisionPadding:16,className:ee("max-h-[var(--radix-popover-content-available-height)] overflow-y-auto p-0",r?"w-[min(36rem,calc(100vw-2rem))]":"w-[min(46rem,calc(100vw-2rem))]"),children:a.jsx(E5t,{value:t,showPresets:!r,onApply:d=>{e(d),o(!1)}})})]})}function X$r(t,e){if(!e)return`+ ${t.label}`;if("in"in e){const r=e.in.map(s=>{var i;return(i=t.options.find(o=>o.id===s))==null?void 0:i.label}).filter(Boolean);return`${t.label}: ${r[0]??"…"}${r.length>1?`, +${r.length-1}`:""}`}if("is"in e)return`${t.label}: ${e.is?"Yes":"No"}`;if("contains"in e)return`${t.label}: “${e.contains}”`;if("min"in e||"max"in e){const r=e,s=r.min===""||r.min==null?"":String(r.min),i=r.max===""||r.max==null?"":String(r.max);return`${t.label}: ${s&&i?`${s}–${i}`:s?`${s}+`:`up to ${i}`}`}const n=e;return`${t.label}: ${n.from&&n.to?`${n.from} → ${n.to}`:n.from?`from ${n.from}`:`until ${n.to}`}`}function eOr({field:t,filter:e,onChange:n,onDone:r}){const[s,i]=y.useState(e&&"contains"in e?e.contains:""),[o,l]=y.useState(e&&"min"in e?String(e.min??""):""),[c,d]=y.useState(e&&"max"in e?String(e.max??""):"");if(y.useEffect(()=>i(e&&"contains"in e?e.contains:""),[e]),t.type==="select"||t.type==="multiSelect"){const h=e&&"in"in e?e.in:[],m=g=>{const v=h.includes(g)?h.filter(b=>b!==g):[...h,g];n(v.length?{in:v}:null)},f=t.options.filter(g=>g.status==="active"),p=LAe({options:f});return f.length>BZ?a.jsx("div",{className:"flex min-h-0 flex-col p-1",children:a.jsx($Ae,{autoFocus:!0,multiple:!0,label:t.label,options:f,selected:h,onPick:m})}):a.jsxs("div",{className:"max-h-64 overflow-y-auto py-1",role:"group","aria-label":t.label,children:[f.length===0?a.jsx("p",{className:"px-3 py-2 text-xs text-muted-foreground",children:"No options yet."}):null,f.map(g=>{const v=h.includes(g.id);return a.jsxs("button",{type:"button",role:"menuitemcheckbox","aria-checked":v,onClick:()=>m(g.id),className:ee("flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-left text-sm hover:bg-muted",v&&"font-medium text-primary"),children:[a.jsx("span",{className:ee("flex h-4 w-4 shrink-0 items-center justify-center rounded border",v?"border-primary bg-primary text-primary-foreground":"border-border"),children:v?a.jsx(Qn,{className:"h-3 w-3"}):null}),p?a.jsx(Gk,{src:g.logoUrl,label:g.label,fallback:!0}):null,a.jsx("span",{className:"truncate",children:g.label})]},g.id)})]})}if(t.type==="boolean")return a.jsx("div",{className:"flex gap-2 p-2",children:[!0,!1].map(h=>{const m=!!(e&&"is"in e&&e.is===h);return a.jsx(Z,{size:"sm",variant:m?"default":"outline",className:"flex-1",onClick:()=>{n(m?null:{is:h}),r()},children:h?"Yes":"No"},String(h))})});const u=h=>{n(h),r()};if(t.type==="number")return a.jsxs("form",{className:"space-y-2 p-2",onSubmit:h=>{h.preventDefault(),u(o===""&&c===""?null:{min:o===""?"":Number(o),max:c===""?"":Number(c)})},children:[a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx(Oe,{type:"number",inputMode:"decimal",placeholder:"From","aria-label":`${t.label} from`,value:o,onChange:h=>l(h.target.value),className:"h-9"}),a.jsx(Oe,{type:"number",inputMode:"decimal",placeholder:"To","aria-label":`${t.label} to`,value:c,onChange:h=>d(h.target.value),className:"h-9"})]}),a.jsx(Z,{type:"submit",size:"sm",className:"w-full",children:"Apply"})]});if(t.type==="date"){const h=e&&("from"in e||"to"in e)?e:{};return a.jsx(E5t,{value:{from:h.from,to:h.to},showPresets:!1,months:1,openEnded:!0,onApply:m=>u(m.from||m.to?{from:m.from,to:m.to}:null)})}return a.jsxs("form",{className:"space-y-2 p-2",onSubmit:h=>{h.preventDefault();const m=s.replace(/\s+/g," ").trim();u(m?{contains:m}:null)},children:[a.jsx(Oe,{autoFocus:!0,placeholder:`${t.label} contains…`,"aria-label":`${t.label} contains`,value:s,maxLength:100,onChange:h=>i(h.target.value),className:"h-9"}),a.jsx(Z,{type:"submit",size:"sm",className:"w-full",children:"Apply"})]})}function tOr({fields:t,filters:e,onChange:n}){const[r,s]=y.useState(null),i=t.filter(o=>o.filterable&&o.active);return i.length?a.jsx(a.Fragment,{children:i.map(o=>{const l=e[o.id];return a.jsxs(Ni,{open:r===o.id,onOpenChange:c=>s(c?o.id:null),children:[a.jsx(Ti,{asChild:!0,children:a.jsxs("button",{type:"button",className:ee("inline-flex max-w-[16rem] items-center gap-1.5 rounded-full border px-3 py-1.5 text-xs transition-colors",l?"border-primary bg-primary/10 font-medium text-primary":"border-border text-muted-foreground hover:bg-muted"),children:[a.jsx("span",{className:"truncate",children:X$r(o,l)}),a.jsx(li,{className:"h-3 w-3 shrink-0","aria-hidden":!0})]})}),a.jsxs(yi,{align:"start",collisionPadding:16,className:ee("flex max-h-[var(--radix-popover-content-available-height)] flex-col overflow-y-auto p-1",o.type==="date"?"w-[min(20rem,calc(100vw-2rem))]":"w-64"),children:[l?a.jsxs("button",{type:"button",onClick:()=>{n(o.id,null),s(null)},className:"flex w-full items-center gap-2 rounded-md px-3 py-1.5 text-left text-sm text-destructive hover:bg-destructive/10",children:[a.jsx(nn,{className:"h-3.5 w-3.5"})," Clear ",o.label]}):null,a.jsx(eOr,{field:o,filter:l,onChange:c=>n(o.id,c),onDone:()=>s(null)})]})]},o.id)})}):null}function nOr({activeTab:t,searchQuery:e,onSearchChange:n,isInvitedTab:r,isBlockedTab:s,isKickedTab:i,memberFields:o=[],state:l}){const c=r?"invited":s?"blocked":i?"kicked":"members";return a.jsxs(it.div,{variants:fg.item,className:"space-y-3",children:[a.jsx("div",{className:"flex items-center gap-2 flex-wrap",children:a.jsxs("div",{className:"relative flex-1 max-w-sm",children:[a.jsx(hs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx(Oe,{placeholder:`Search ${c}…`,value:e,onChange:d=>n(d.target.value),className:"pl-9 h-9 text-sm"})]})}),!r&&!s&&!i&&a.jsx(QV,{filters:l.filters,onChange:(d,u)=>l.setFilters(h=>({...h,[d]:u})),onClearAll:l.clearFilters,activeCount:l.activeFilterCount,configs:[...t==="all"?[{key:"role",label:"Role",options:l.filterOptions.role}]:[],{key:"subscription",label:"Subscription",options:l.filterOptions.subscription},{key:"verified",label:"Verified",options:l.filterOptions.verified},{key:"following",label:"Following",options:l.filterOptions.following},{key:"sort",label:"Sort",options:l.filterOptions.sort}],children:a.jsx(tOr,{fields:o,filters:l.fieldFilters,onChange:l.setFieldFilter})}),r&&a.jsx(QV,{filters:l.invitedFilters,onChange:(d,u)=>l.setInvitedFilters(h=>({...h,[d]:u})),onClearAll:l.clearInvitedFilters,activeCount:l.invitedActiveFilterCount,configs:[{key:"invitationStatus",label:"Status",options:l.invitedFilterOptions.invitationStatus}]}),s&&a.jsx(QV,{filters:l.blockedFilters,onChange:(d,u)=>l.setBlockedFilters(h=>({...h,[d]:u})),onClearAll:l.clearBlockedFilters,activeCount:l.blockedActiveFilterCount,configs:[{key:"sort",label:"Sort",options:l.blockedFilterOptions.sort}]}),i&&a.jsx(QV,{filters:l.kickedFilters,onChange:(d,u)=>l.setKickedFilters(h=>({...h,[d]:u})),onClearAll:l.clearKickedFilters,activeCount:l.kickedActiveFilterCount,configs:[{key:"reason",label:"Reason",options:l.kickedFilterOptions.reason},{key:"sort",label:"Sort",options:l.kickedFilterOptions.sort}]})]})}function ZV({isLoading:t,error:e,isEmpty:n,onRetry:r,emptyLabel:s="No members found.",loadingLabel:i="Loading members…"}){return t?a.jsxs("div",{className:"flex items-center justify-center gap-2 py-16 text-sm text-muted-foreground",children:[a.jsx(Ne,{className:"h-5 w-5 animate-spin"}),i]}):e?a.jsxs("div",{className:"flex flex-col items-center justify-center gap-3 py-16 rounded-lg border border-border bg-card",children:[a.jsx("p",{className:"text-sm text-destructive",children:e}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",onClick:r,children:"Try again"})]}):n?a.jsx("div",{className:"flex items-center justify-center py-16 rounded-lg border border-border bg-card",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:s})}):null}function rOr({tabs:t,activeTab:e,onSelect:n}){return a.jsx(it.div,{variants:fg.item,className:"flex flex-wrap items-center gap-1 border-b border-border",children:t.map(r=>a.jsxs("button",{type:"button",onClick:()=>n(r.key),className:ee("relative px-3 py-2.5 text-sm font-medium transition-colors",e===r.key?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[a.jsxs("span",{className:"flex items-center gap-1.5",children:[r.label,a.jsx("span",{className:ee("text-xs",e===r.key?"text-foreground":"text-muted-foreground"),children:r.count}),r.isNew&&a.jsx("span",{className:"rounded-sm bg-primary px-1.5 py-0.5 text-[10px] font-bold text-primary-foreground uppercase",children:"New"})]}),e===r.key&&a.jsx(it.div,{layoutId:"activeTab",className:"absolute bottom-0 left-0 right-0 h-0.5 bg-foreground rounded-full",transition:{type:"spring",stiffness:500,damping:30}})]},r.key))})}const Lue=["Violation of community guidelines","Harassment or abusive behavior","Spamming the community","Sharing inappropriate content","Impersonation of another member","Repeated off-topic posts","Spreading misinformation","Using multiple accounts","Non-compliance with admin warnings","Other"],zRe="Other",sOr=300;function iOr(t,e){return t===zRe?e.trim():t}function aOr(t,e){return t?t!==zRe||e.trim().length>0:!1}function oOr({target:t,busy:e=!1,onOpenChange:n,onConfirm:r}){var u;const[s,i]=y.useState(Lue[0]),[o,l]=y.useState("");y.useEffect(()=>{t&&(i(Lue[0]),l(""))},[t]);const c=((t==null?void 0:t.count)??0)>1,d=c?`${t==null?void 0:t.count} members`:((u=t==null?void 0:t.name)==null?void 0:u.trim())||"this member";return a.jsx(Bt,{open:t!==null,onOpenChange:h=>!h&&n(!1),children:a.jsxs(Ft,{className:"max-w-md",children:[a.jsxs(Vt,{children:[a.jsxs(Ut,{children:["Kick ",d," from the community?"]}),a.jsx(_n,{children:c?"They lose access to every group in this community, and this reason is recorded against each of them in the kick log.":"They lose access to every group in this community, and the reason is recorded in the kick log."})]}),a.jsx(TS,{value:s,onValueChange:i,className:"max-h-64 overflow-y-auto pr-1",children:Lue.map(h=>a.jsxs("div",{className:"flex items-center gap-3 rounded px-2 py-1.5 hover:bg-muted/50",children:[a.jsx(Ly,{value:h,id:`kick-reason-${h}`}),a.jsx(_e,{htmlFor:`kick-reason-${h}`,className:"cursor-pointer text-sm font-normal",children:h})]},h))}),s===zRe&&a.jsx(us,{rows:3,maxLength:sOr,placeholder:"Please describe the reason…","aria-label":"Custom reason",value:o,onChange:h=>l(h.target.value)}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"ghost",disabled:e,onClick:()=>n(!1),children:"Cancel"}),a.jsx(Z,{variant:"destructive",disabled:e||!aOr(s,o),onClick:()=>r(iOr(s,o)),children:e?"Kicking…":c?`Kick ${t==null?void 0:t.count} members`:"Kick from community"})]})]})})}const N5t="COMMUNITY_INVITE_MAIL_BODY_KEY",T5t=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,vJ="__community_wide__";function _5t(t){if(!t)return"";const e=typeof t=="string"?new Date(t):t;return Number.isNaN(e.getTime())?"":e.toLocaleString(void 0,{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})}const w9=t=>encodeURIComponent(t),nqe=10;async function lOr(t,e={}){var s;const n=new URLSearchParams({page:String(e.page??1)});(s=e.search)!=null&&s.trim()&&n.set("search",e.search.trim()),e.status&&n.set("status",e.status);const r=await ae.get(`/community/${w9(t)}/invites/paginated?${n.toString()}`);return{invites:Array.isArray(r==null?void 0:r.invites)?r.invites:[],page:(r==null?void 0:r.page)??1,total:(r==null?void 0:r.total)??0}}async function NF(t,e,n={}){const r=await fat("invite");await ae.post(`/community/${w9(t)}/invite`,{memberData:e,captchaToken:r,...n.groupId?{groupId:n.groupId}:{},...n.additionalMessage?{additionalMessage:n.additionalMessage}:{}})}async function cOr(t,e){await ae.post(`/community/${w9(t)}/invite/batch-cancel`,{inviteIds:e})}async function dOr(t,e){await ae.post(`/community/${w9(t)}/invite/batch-reinvite`,{inviteIds:e})}async function A5t(t,e,n={},r){const s=await fat("invite"),i=new FormData;return i.append("memberDataCSV",e),i.append("captchaToken",s),n.groupId&&i.append("groupId",n.groupId),n.additionalMessage&&i.append("additionalMessage",n.additionalMessage),j0(`/community/${w9(t)}/invite/csv`,i,r)}async function uOr(t){var r;const n=(r=(await qj(t,N5t)).configurable)==null?void 0:r.configurableValue;return typeof n=="string"?n:""}async function hOr(t,e){await D2(t,N5t,e)}async function mOr(t,e,n={},r=10){for(let s=0;s<e.length;s+=r){const i=e.slice(s,s+r);await NF(t,i,n)}}const fOr=["Admin","Member","Moderator"];function pOr(t){if(t==="Admin")return"admin";if(t==="Moderator")return"moderator";if(t==="Member")return"user"}function gOr(t){return t==="admin"?"Admin":t==="moderator"?"Moderator":t==="user"?"Member":null}function P5t(t,e){if(t==="admins")return"admin";if(t==="moderators")return"moderator";if(t==="members")return"user";if(t==="all"&&e)return pOr(e)}function vOr(t,e,n){const r=P5t(e,n),s=r?gOr(r):null;return s?t.filter(i=>i.role===s):t}function yOr(t){return t.active&&t.searchActive&&!t.listLoading?t.listTotal:typeof t.exact=="number"?t.exact:t.active&&!t.listLoading?t.listTotal:0}function bOr(t,e){return t==="admins"||t==="all"&&e==="Admin"?"admins":t==="moderators"||t==="all"&&e==="Moderator"?"moderators":"members"}function xOr(t){const e={};return t.subscription==="Subscribed"?e.subscribed="true":t.subscription==="Unsubscribed"&&(e.subscribed="false"),t.verified==="Verified"?e.verified="true":t.verified==="Pending"&&(e.verified="false"),t.following==="Following"?e.following="true":t.following==="Not following"&&(e.following="false"),t.sort==="Oldest first"?e.sort="oldest":t.sort==="Name A–Z"?e.sort="name":t.sort==="Most followers"?e.sort="followers":t.sort==="Most points"?e.sort="points":t.sort==="Newest first"&&(e.sort="newest"),e}function wOr(t){if(t==="Pending")return"pending";if(t==="Joined")return"joined"}function kOr(t){if(!t)return"Member";const e=t.toLowerCase();return e==="admin"?"Admin":e==="moderator"?"Moderator":"Member"}function SOr(t){if(!t)return"—";const e=new Date(t);return Number.isNaN(e.getTime())?"—":e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function COr(t){var r,s,i;const e="—",n=t.lastSeenAt??t.lastLoginDate??null;return{id:t.id,name:t.name||"Member",userId:t.userId,email:t.email??"",shortBio:t.shortBio,interests:Array.isArray(t.interests)?t.interests:[],country:e,region:"—",discipline:"—",mpu:t.karmaPoints??0,role:kOr(t.communityRole),position:(r=t.shortBio)!=null&&r.trim()?t.shortBio.slice(0,40):"",title:((s=t.title)==null?void 0:s.trim())||"",location:((i=t.location)==null?void 0:i.trim())||"",customFields:t.customFields??{},joined:SOr(t.joinedAt),joinedAt:t.joinedAt??null,isVerifiedByAdmin:!!t.communityAdminVerified,lastLogin:n?yc(n):"—",lastActiveAt:n,flag:e!=="—"?RRe(e):"🏳️",followers:t.followers??0,following:t.following??0,avatar:t.picture??"",subscribed:t.subscribed!==!1,team:"—",format:"—",isFollowedByMe:!!t.isFollowedByMe,isNew:!!t.isNew}}function R5t(t){return t.map(COr)}function jOr(t,e){const[n,r]=y.useState(t);return y.useEffect(()=>{const s=setTimeout(()=>r(t),e);return()=>clearTimeout(s)},[t,e]),n}function EOr(t,e,n={},r){const{subscribed:s,verified:i,following:o,sort:l,fieldFilters:c}=n,{community:d}=qe(),u=(d==null?void 0:d.id)??null,[h,m]=y.useState([]),[f,p]=y.useState(1),[g,v]=y.useState(0),[b,x]=y.useState(null),[w,k]=y.useState(hx),[S,C]=y.useState(!1),[j,E]=y.useState(null),N=jOr(t.trim(),400),A=y.useRef(0),_=[u,f,N,r,e,s,i,o,l,c].join("|"),[T,R]=y.useState(null),O=y.useCallback(async()=>{if(!u){m([]),v(0),E(null),R(_);return}const M=++A.current;C(!0),E(null);try{const z=await Dy(u,{page:f,limit:hx,search:N||void 0,groupId:r,role:e,subscribed:s,verified:i,following:o,sort:l,fieldFilters:c});if(M!==A.current)return;m(R5t(z.users)),v(z.total),k(z.limit),z.counts&&x(z.counts)}catch(z){if(M!==A.current)return;const G=z instanceof ze?z.message:"Failed to load members.";E(G),m([]),v(0)}finally{M===A.current&&(C(!1),R(_))}},[u,f,N,r,e,s,i,o,l,c,_]);y.useEffect(()=>{p(1),m([])},[N,r,u,e,s,i,o,l,c]),y.useEffect(()=>{O()},[O]);const F=y.useCallback((M,z)=>{m(G=>G.map(B=>B.id===M?{...B,...z}:B))},[]),D=y.useCallback(()=>{O()},[O]),I=Math.max(1,Math.ceil(g/(w||hx))),P=f<I;return{members:h,page:f,setPage:p,total:g,counts:b,totalPages:I,hasMore:P,isLoading:S||T!==_,error:j,refetch:D,updateMember:F}}function NOr(t){if(!t)return"—";const e=new Date(t);return Number.isNaN(e.getTime())?"—":e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function TOr(t){var n,r,s;const e=NOr(t.createdAt);return{id:t.id,name:((n=t.name)==null?void 0:n.trim())||((r=t.email)==null?void 0:r.trim())||"—",email:((s=t.email)==null?void 0:s.trim())??"",invitationStatus:t.isAccepted?"Joined":"Pending",role:"Invited",dateAdded:e,invitedAt:e,isAccepted:!!t.isAccepted,groupId:t.group??null}}function _Or(t){return t.map(TOr)}function AOr(t,e){const[n,r]=y.useState(t);return y.useEffect(()=>{const s=setTimeout(()=>r(t),e);return()=>clearTimeout(s)},[t,e]),n}function POr(t,e,n){const{community:r}=qe(),s=(r==null?void 0:r.id)??null,[i,o]=y.useState([]),[l,c]=y.useState(1),[d,u]=y.useState(0),[h,m]=y.useState(!1),[f,p]=y.useState(null),g=AOr(t.trim(),400),v=y.useRef(0),b=[s,l,g,n].join("|"),[x,w]=y.useState(null),k=y.useCallback(async()=>{if(!s||!e){if(!e)return;o([]),u(0),p(null),w(b);return}const j=++v.current;m(!0),p(null);try{const E=await lOr(s,{page:l,search:g||void 0,status:n});if(j!==v.current)return;o(_Or(E.invites)),u(E.total)}catch(E){if(j!==v.current)return;const N=E instanceof ze?E.message:"Failed to load invites.";p(N),o([]),u(0)}finally{j===v.current&&(m(!1),w(b))}},[s,e,l,g,n,b]);y.useEffect(()=>{c(1),u(0),o([]),e||w(null)},[g,s,e,n]),y.useEffect(()=>{k()},[k]);const S=y.useCallback(()=>{k()},[k]),C=Math.max(1,Math.ceil(d/nqe));return{invited:i,page:l,setPage:c,total:d,totalPages:C,pageSize:nqe,isLoading:h||e&&x!==b,error:f,refetch:S}}function ROr(t){var e;return{id:t.id,name:t.name||"Member",email:((e=t.email)==null?void 0:e.trim())??"",avatar:t.picture??"",blockedAt:t.blockedAt??null}}function IOr(t){return t.filter(e=>e==null?void 0:e.id).map(ROr)}const MOr=["Recently blocked","Oldest first","Name A–Z"];function JV(t){const e=t.blockedAt?new Date(t.blockedAt).getTime():Number.NaN;return Number.isNaN(e)?0:e}function LOr(t,e){if(!e)return t;const n=[...t];return e==="Recently blocked"?n.sort((r,s)=>JV(s)-JV(r)):e==="Oldest first"?n.sort((r,s)=>JV(r)-JV(s)):e==="Name A–Z"&&n.sort((r,s)=>r.name.localeCompare(s.name)),n}function DOr(t,e,n="community",r={}){const s=r.sort??"",{community:i}=qe(),o=(i==null?void 0:i.id)??null,[l,c]=y.useState([]),[d,u]=y.useState(1),[h,m]=y.useState(!1),[f,p]=y.useState(null),g=y.useRef(0),v=t.trim().toLowerCase(),b=[o,n].join("|"),[x,w]=y.useState(null),k=y.useCallback(async()=>{if(!o||!e){if(!e)return;c([]),p(null),w(b);return}const T=++g.current;m(!0),p(null);try{const R=n==="peer"?await Gxr(o):await zxr(o);if(T!==g.current)return;c(IOr(R.blockedUsers))}catch(R){if(T!==g.current)return;const O=R instanceof ze?R.message:"Failed to load blocked members.";p(O),c([])}finally{T===g.current&&(m(!1),w(b))}},[o,e,n,b]);y.useEffect(()=>{u(1)},[v,s]),y.useEffect(()=>{u(1),c([]),e||w(null)},[o,e,n]),y.useEffect(()=>{k()},[k]);const S=y.useMemo(()=>v?l.filter(T=>T.name.toLowerCase().includes(v)||T.email.toLowerCase().includes(v)):l,[l,v]),C=y.useMemo(()=>LOr(S,s),[S,s]),j=C.length,E=Math.max(1,Math.ceil(j/hx)),N=y.useMemo(()=>{const T=(d-1)*hx;return C.slice(T,T+hx)},[C,d]);y.useEffect(()=>{d>E&&u(E)},[d,E]);const A=y.useCallback(()=>{k()},[k]),_=y.useCallback(T=>{c(R=>R.filter(O=>O.id!==T))},[]);return{blocked:N,allBlocked:S,page:d,setPage:u,total:j,totalPages:E,pageSize:hx,isLoading:h||e&&x!==b,error:f,refetch:A,removeBlocked:_}}const $Or=t=>encodeURIComponent(t),yJ=10,OOr="__none__";async function FOr(t,e={}){var s,i,o,l,c,d;const n=new URLSearchParams({page:String(e.page??1),limit:String(yJ)});(s=e.search)!=null&&s.trim()&&n.set("search",e.search.trim()),(i=e.reason)!=null&&i.trim()&&n.set("reason",e.reason.trim()),e.sort==="oldest"&&n.set("sort","oldest");const r=await ae.get(`/community/${$Or(t)}/kicked-users?${n.toString()}`);return{kickedUsers:Array.isArray(r==null?void 0:r.kickedUsers)?r.kickedUsers:[],reasons:Array.isArray(r==null?void 0:r.reasons)?r.reasons:[],pagination:{page:((o=r==null?void 0:r.pagination)==null?void 0:o.page)??1,limit:((l=r==null?void 0:r.pagination)==null?void 0:l.limit)??yJ,total:((c=r==null?void 0:r.pagination)==null?void 0:c.total)??0,hasMore:!!((d=r==null?void 0:r.pagination)!=null&&d.hasMore)}}}function BOr(t){if(!t)return"—";const e=new Date(t);return Number.isNaN(e.getTime())?"—":e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function UOr(t){var e,n,r,s,i,o,l,c,d,u;return{id:t.id,userId:((e=t.user)==null?void 0:e.id)??null,name:((r=(n=t.user)==null?void 0:n.name)==null?void 0:r.trim())||"",email:((i=(s=t.user)==null?void 0:s.email)==null?void 0:i.trim())||"",isDeletedUser:t.user===null,kickedByName:((l=(o=t.kickedBy)==null?void 0:o.name)==null?void 0:l.trim())||"",kickedByEmail:((d=(c=t.kickedBy)==null?void 0:c.email)==null?void 0:d.trim())||"",reason:((u=t.reason)==null?void 0:u.trim())||"",kickedOn:BOr(t.kickedAt),kickedAt:t.kickedAt??null}}function zOr(t){return t.map(UOr)}function VOr(t,e){const[n,r]=y.useState(t);return y.useEffect(()=>{const s=setTimeout(()=>r(t),e);return()=>clearTimeout(s)},[t,e]),n}function HOr(t,e,n={}){const{community:r}=qe(),s=(r==null?void 0:r.id)??null,i=n.reason??"",o=n.sort??"recent",[l,c]=y.useState([]),[d,u]=y.useState([]),[h,m]=y.useState(1),[f,p]=y.useState(0),[g,v]=y.useState(!1),[b,x]=y.useState(null),w=VOr(t.trim(),400),k=y.useRef(0),S=[s,h,w,i,o].join("|"),[C,j]=y.useState(null),E=y.useCallback(async()=>{if(!s||!e){if(!e)return;c([]),p(0),x(null),j(S);return}const _=++k.current;v(!0),x(null);try{const T=await FOr(s,{page:h,search:w||void 0,reason:i||void 0,sort:o});if(_!==k.current)return;c(zOr(T.kickedUsers)),p(T.pagination.total),u(T.reasons)}catch(T){if(_!==k.current)return;const R=T instanceof ze?T.message:"Failed to load kick history.";x(R),c([]),p(0)}finally{_===k.current&&(v(!1),j(S))}},[s,e,h,w,i,o,S]);y.useEffect(()=>{m(1),p(0),c([]),e||j(null)},[w,i,o,s,e]),y.useEffect(()=>{E()},[E]);const N=y.useCallback(()=>{E()},[E]),A=Math.max(1,Math.ceil(f/yJ));return{kicked:l,reasons:d,page:h,setPage:m,total:f,totalPages:A,pageSize:yJ,appliedSearch:w,isLoading:g||e&&C!==S,error:b,refetch:N}}const Due={role:"",subscription:"",verified:"",following:"",sort:""},$ue={invitationStatus:""},Oue={sort:""},Fue={reason:"",sort:""},rqe="No reason given",GOr=["Recently kicked","Oldest first"];function WOr(t=!1){var Gt,lr,ct,Bn,Ms,Ue,et;const{community:e}=qe(),n=(e==null?void 0:e.id)??null,{toast:r}=yt(),s=Nn(),[i,o]=y.useState([]),[l,c]=y.useState(!1),[d,u]=y.useState("all"),[h,m]=y.useState(!0),[f,p]=y.useState(""),[g,v]=y.useState(Tue),[b,x]=y.useState(Due),[w,k]=y.useState({}),[S,C]=y.useState($ue),[j,E]=y.useState(Oue),[N,A]=y.useState(Fue),[_,T]=y.useState(!1),[R,O]=y.useState([]),[F,D]=y.useState(!1),[I,P]=y.useState(!1),M=d==="invited",z=d==="blocked",G=d==="kicked",B=P5t(d,b.role),W=EOr(!M&&!z&&!G?f:"",B,{...xOr(b),fieldFilters:Object.keys(w).length?JSON.stringify(w):void 0});y.useEffect(()=>{o([])},[W.page,b,w,f,d]);const V=POr(M?f:"",M,wOr(S.invitationStatus)),U=DOr(z?f:"",t?z:!0,t?"community":"peer",{sort:j.sort}),ne=HOr(G?f:"",t&&G,{reason:N.reason===rqe?OOr:N.reason,sort:N.sort==="Oldest first"?"oldest":"recent"}),te=W.members,re={role:[...fOr],subscription:["Subscribed","Unsubscribed"],verified:["Verified","Pending"],following:["Following","Not following"],sort:["Newest first","Oldest first","Name A–Z","Most followers","Most points"]},fe={invitationStatus:["Pending","Joined"]},le={sort:[...MOr]},q={reason:[...ne.reasons,...ne.reasons.length?[rqe]:[]],sort:[...GOr]},Y=Object.values(b).filter(Boolean).length+Object.keys(w).length,X=(Le,Ye)=>k(({[Le]:st,...nt})=>Ye?{...nt,[Le]:Ye}:nt),Q=Object.values(S).filter(Boolean).length,ie=Object.values(j).filter(Boolean).length,he=Object.values(N).filter(Boolean).length,ye=()=>{x(Due),k({})},J=()=>C($ue),K=()=>E(Oue),ce=()=>A(Fue),pe=async()=>{const Le=W4r(g);if("error"in Le){r({title:"Check the invite list",description:Le.error,variant:"destructive"});return}if(!n)return;const{members:Ye}=Le;T(!0);try{await NF(n,Ye),v(Tue),c(!1),r({title:"Invited",description:Ye.length===1?`${Ye[0].name} has been invited to the community.`:`${Ye.length} people have been invited to the community.`}),M&&V.refetch(),W.refetch()}catch(st){const nt=st instanceof ze?st.message:"Could not send invites.";r({title:"Error",description:nt,variant:"destructive"})}finally{T(!1)}},Ie=async(Le,Ye)=>{if(!n)return!1;const st=Le.members.length;T(!0);try{return await A5t(n,Z4r(Le.members,Ye)),v(Tue),c(!1),r({title:"Invites are on their way",description:`Inviting ${st===1?"1 person":`${st} people`} from ${Ye}. They'll appear under Invited as the emails go out.`}),M&&V.refetch(),!0}catch(nt){return r({title:"Couldn't send the invites",description:nt instanceof ze?Dt(nt.body,nt.message||"Please try again."):"Please try again.",variant:"destructive"}),!1}finally{T(!1)}},Me=()=>{s(`${ve.communityMembers}?tab=invite`)},we=(Le,Ye)=>{Ye||O(st=>st.includes(Le)?st.filter(nt=>nt!==Le):[...st,Le])},Be=async Le=>{if(!(!n||Le.length===0)){D(!0);try{await dOr(n,Le),r({title:"Invite sent successfully"}),O([]),V.refetch()}catch(Ye){const st=Ye instanceof ze?Ye.message:"Couldn't send the invite. Please try again.";r({title:"Error",description:st,variant:"destructive"})}finally{D(!1)}}},Ve=async Le=>{if(!n||Le.length===0)return;const Ye=Le.length>1?"invites":"invite";if(window.confirm(`Are you sure you want to cancel ${Le.length} ${Ye}?`)){P(!0);try{await cOr(n,Le),r({title:"Invite cancelled successfully"}),O(st=>st.filter(nt=>!Le.includes(nt))),V.refetch(),W.refetch()}catch(st){const nt=st instanceof ze?st.message:"Couldn't cancel the invite. Please try again.";r({title:"Error",description:nt,variant:"destructive"})}finally{P(!1)}}},be=async Le=>{if(n)try{await NF(n,[{email:Le.email,name:Le.name}],{groupId:Le.groupId??void 0}),r({title:"Invite sent successfully"}),V.refetch()}catch(Ye){const st=Ye instanceof ze?Ye.message:"Couldn't send the invite. Please try again.";r({title:"Error",description:st,variant:"destructive"})}},Ze=()=>{if(M){const Je=Yt,Rt=[["Name","Email","Status","Invited at"].join(","),...Je.map(Lt=>[Lt.name,Lt.email,Lt.invitationStatus,Lt.invitedAt].join(","))].join(`
`),Qt=new Blob([Rt],{type:"text/csv"}),Jt=URL.createObjectURL(Qt),Qe=document.createElement("a");Qe.href=Jt,Qe.download="invited-members.csv",Qe.click(),URL.revokeObjectURL(Jt),r({title:"Exported",description:"Invited list exported as CSV."});return}if(z){const Je=nr,Rt=[["Name","Email","Blocked at"].join(","),...Je.map(Lt=>[Lt.name,Lt.email,Lt.blockedAt??""].join(","))].join(`
`),Qt=new Blob([Rt],{type:"text/csv"}),Jt=URL.createObjectURL(Qt),Qe=document.createElement("a");Qe.href=Jt,Qe.download="blocked-members.csv",Qe.click(),URL.revokeObjectURL(Jt),r({title:"Exported",description:"Blocked list exported as CSV."});return}if(G){const Je=Kn,Rt=[["Name","Email","Kicked by","Reason","Kicked on"].join(","),...Je.map(Lt=>[Lt.isDeletedUser?"Deleted user":Lt.name,Lt.email,Lt.kickedByName,Lt.reason,Lt.kickedAt??""].map(Xt=>`"${String(Xt??"").replace(/"/g,'""')}"`).join(","))].join(`
`),Qt=new Blob([Rt],{type:"text/csv"}),Jt=URL.createObjectURL(Qt),Qe=document.createElement("a");Qe.href=Jt,Qe.download="kicked-members.csv",Qe.click(),URL.revokeObjectURL(Jt),r({title:"Exported",description:"Current page of the kick log exported as CSV."});return}const Le=[["Name","Email","Role","Followers","Following"].join(","),...te.map(Je=>[Je.name,Je.email,Je.role,Je.followers,Je.following].join(","))].join(`
`),Ye=new Blob([Le],{type:"text/csv"}),st=URL.createObjectURL(Ye),nt=document.createElement("a");nt.href=st,nt.download="community-members.csv",nt.click(),URL.revokeObjectURL(st),r({title:"Exported",description:"Current page exported as CSV."})},Pe=async Le=>{if(i.length===0){r({title:"No selection",description:"Select members first using checkboxes.",variant:"destructive"});return}const Ye=i.map(Je=>br[Je]).filter(Je=>Je==null?void 0:Je.id);if(!n||Ye.length===0)return;const nt=(await Promise.allSettled(Ye.map(Je=>dHe(n,Je.id,Le)))).filter(Je=>Je.status==="rejected").length;r({title:nt?`Kicked ${Ye.length-nt}/${Ye.length} members`:`Kicked ${Ye.length} ${Ye.length===1?"member":"members"}`,variant:nt?"destructive":void 0}),o([]),W.refetch()},Ke=async Le=>{if(i.length===0){r({title:"No selection",description:"Select members first using checkboxes.",variant:"destructive"});return}const Ye=Le==="Admin"?"superadmin":Le.toLowerCase(),st=i.map(Rt=>br[Rt]).filter(Rt=>Rt==null?void 0:Rt.id);if(!n||st.length===0)return;const Je=(await Promise.allSettled(st.map(Rt=>uHe(n,Rt.id,Ye)))).filter(Rt=>Rt.status==="rejected").length;r({title:Je?`Updated ${st.length-Je}/${st.length} roles`:`Role changed to ${Le} for ${st.length} ${st.length===1?"member":"members"}`,variant:Je?"destructive":void 0}),o([]),W.refetch()},De=Le=>{if(Le){r({title:"Messages disabled",description:"Direct messages are turned off for this community.",variant:"destructive"});return}if(i.length===0){r({title:"No selection",description:"Select members first using checkboxes.",variant:"destructive"});return}const Ye=i.map(st=>br[st]).find(st=>st==null?void 0:st.id);Ye&&(c0(s,{id:Ye.id,name:Ye.name,avatar:Ye.avatar,userId:Ye.userId,communityId:n??void 0}),o([]))},xt=Le=>{o(Ye=>Ye.includes(Le)?Ye.filter(st=>st!==Le):[...Ye,Le])},Xe=Le=>{i.length===Le?o([]):o(Array.from({length:Le},(Ye,st)=>st))},tt=async Le=>{if(!n||!Le.id)return;const Ye=!!Le.isFollowedByMe;W.updateMember(Le.id,{isFollowedByMe:!Ye,followers:Math.max(0,Le.followers+(Ye?-1:1))});try{Ye?(await ese(n,Le.id),r({title:"Unfollowed",description:`You unfollowed ${Le.name}.`})):(await Xre(n,Le.id),r({title:"Followed",description:`You are now following ${Le.name}.`})),_se(Le.id,!Ye)}catch(st){W.updateMember(Le.id,{isFollowedByMe:Ye,followers:Le.followers});const nt=st instanceof ze?st.message:"Could not update follow status.";r({title:"Error",description:nt,variant:"destructive"})}},$e=async(Le,Ye,st)=>{const nt=br[Le];if(!(!n||!(nt!=null&&nt.id)))try{await dHe(n,nt.id,st),r({title:"Member kicked",description:`${Ye} has been kicked from the community.`}),W.refetch()}catch(Je){const Rt=Je instanceof ze?Je.message:"Could not kick member.";r({title:"Error",description:Rt,variant:"destructive"})}},wt=async(Le,Ye)=>{if(!(!n||!Le))try{await Yvr(n,Le),r({title:"Member brought back",description:`${Ye} is a member of the community again.`}),ne.refetch(),W.refetch()}catch(st){const nt=st instanceof ze?st.message:"Could not bring the member back.";r({title:"Error",description:nt,variant:"destructive"})}},Ee=Le=>Le==="Admin"?"superadmin":Le==="Moderator"?"moderator":"user",Ge=async(Le,Ye)=>{if(!(!n||!(Le!=null&&Le.id)))try{await uHe(n,Le.id,Ee(Ye)),r({title:"Role updated",description:`${Le.name} is now ${Ye}.`}),W.refetch()}catch(st){const nt=st instanceof ze?st.message:"Could not change this member's role.";r({title:"Error",description:nt,variant:"destructive"})}},Pt=async(Le,Ye)=>{if(!(!n||!(Le!=null&&Le.id)))try{const{added:st,removed:nt}=await F4r(n,Le.id,Ye),Je=[];st.length&&Je.push(`added to ${st.length} group${st.length===1?"":"s"}`),nt.length&&Je.push(`removed from ${nt.length}`),r({title:Je.length?`${Le.name} ${Je.join(", ")}`:"No group changes"})}catch(st){const nt=st instanceof ze?st.message:"Could not update group membership.";r({title:"Error",description:nt,variant:"destructive"})}},vn=async Le=>{if(n)try{t?await Promise.all([Hxr(n,Le.id),$He(n,Le.id)]):await $He(n,Le.id),U.removeBlocked(Le.id),W.refetch(),r({title:"Unblocked",description:`${Le.name} has been unblocked.`})}catch(Ye){const st=Ye instanceof ze?Ye.message:"Could not unblock member.";r({title:"Error",description:st,variant:"destructive"})}},Hn=async(Le,Ye)=>{const st=br[Le];if(!n||!(st!=null&&st.id)||!st.email){r({title:"No email on record for this member",variant:"destructive"});return}const nt=!!Ye.subscribed;W.updateMember(st.id,{subscribed:!nt});try{nt?(await ylr(n,st.email,"DORMANT"),r({title:"Unsubscribed",description:`${Ye.name} won't receive marketing emails.`})):(await blr(n,st.email),r({title:"Subscribed",description:`${Ye.name} can receive marketing emails again.`})),W.refetch()}catch(Je){W.updateMember(st.id,{subscribed:nt});const Rt=Je instanceof ze&&(Je.status===403||Je.status===404)?"This member unsubscribed themselves — compliance rules say only they can opt back in.":Je instanceof ze?Je.message:"Could not update subscription.";r({title:"Error",description:Rt,variant:"destructive"})}},yr=y.useMemo(()=>d==="contacts"?te.slice(0,Math.max(0,te.length-1)):te,[d,te]),br=y.useMemo(()=>vOr(yr,d,b.role),[yr,d,b.role]),Yt=V.invited,nr=U.blocked,Kn=ne.kicked,ms=f.trim().length>0,is=(Le,Ye,st=W.total,nt=W.isLoading)=>yOr({exact:Ye,active:d===Le,searchActive:ms,listTotal:st,listLoading:nt}),ke=is("all",(Gt=W.counts)==null?void 0:Gt.all),at={members:is("members",(lr=W.counts)==null?void 0:lr.members),admins:is("admins",(ct=W.counts)==null?void 0:ct.admins),moderators:is("moderators",(Bn=W.counts)==null?void 0:Bn.moderators)},Tt=is("invited",(Ms=W.counts)==null?void 0:Ms.invited,V.total,V.isLoading),An=is("blocked",t?(Ue=W.counts)==null?void 0:Ue.blocked:U.isLoading?void 0:U.total,U.total,U.isLoading),Pn=is("kicked",(et=W.counts)==null?void 0:et.kicked,ne.total,ne.isLoading),yn=M?"invited":z?"blocked":G?"kicked":bOr(d,b.role),Is=[{key:"all",label:"All",count:ke},{key:"contacts",label:"Contacts",count:Math.max(0,ke-1),isNew:!0},{key:"members",label:"Members",count:at.members},{key:"invited",label:"Invited",count:Tt,adminOnly:!0},{key:"admins",label:"Admins",count:at.admins,adminOnly:!0},{key:"moderators",label:"Moderators",count:at.moderators,adminOnly:!0},{key:"blocked",label:"Blocked",count:An},{key:"kicked",label:"Kicked",count:Pn,adminOnly:!0}];return{selectedMembers:i,setSelectedMembers:o,addMemberOpen:l,setAddMemberOpen:c,activeTab:d,showInviteBanner:h,setShowInviteBanner:m,searchQuery:f,setSearchQuery:p,inviteRows:g,setInviteRows:v,filters:b,setFilters:x,fieldFilters:w,setFieldFilter:X,invitedFilters:S,setInvitedFilters:C,blockedFilters:j,setBlockedFilters:E,kickedFilters:N,setKickedFilters:A,filterOptions:re,invitedFilterOptions:fe,blockedFilterOptions:le,kickedFilterOptions:q,activeFilterCount:Y,invitedActiveFilterCount:Q,blockedActiveFilterCount:ie,kickedActiveFilterCount:he,clearFilters:ye,clearInvitedFilters:J,clearBlockedFilters:K,clearKickedFilters:ce,handleAddMember:pe,handleInviteCsv:Ie,goToInvitePage:Me,handleExport:Ze,handleBulkDelete:Pe,handleBulkMessage:De,handleBulkRoleChange:Ke,toggleSelect:xt,toggleSelectAll:Xe,toggleFollow:tt,removeMemberAtIndex:$e,changeMemberRole:Ge,syncMemberGroups:Pt,unblockMember:vn,toggleMemberSubscription:Hn,filteredMembers:br,filteredInvited:Yt,filteredBlocked:nr,filteredKicked:Kn,isInvitedTab:M,isBlockedTab:z,isKickedTab:G,allTabs:Is,selectTab:Le=>{u(Le),o([]),O([]),p(""),x(Due),k({}),C($ue),E(Oue),A(Fue),W.setPage(1),V.setPage(1),U.setPage(1),ne.setPage(1)},toast:r,list:W,invitedList:V,blockedList:U,kickedList:ne,restoreKickedMember:wt,paginationCountLabel:yn,isInviting:_,selectedInvitedIds:R,toggleInvitedSelect:we,handleResendInvites:Be,handleCancelInvites:Ve,handleResendSingleInvite:be,resendingInvites:F,cancellingInvites:I}}function I5t(){const{communityDetail:t,groups:e}=Ln(),{community:n}=qe(),{user:r}=jr(),s=(r==null?void 0:r.id)??null,{isAdminView:i}=Zy(),o=xNt(n==null?void 0:n.id).data??[],{toast:l}=yt(),c=WOr(i),d=!!(t!=null&&t.isDirectMessageDisabled),[u,h]=y.useState(null),[m,f]=y.useState(null),[p,g]=y.useState(!1),[v,b]=y.useState(null),[x,w]=y.useState(!1),k=async V=>{if(v){w(!0);try{await c.syncMemberGroups(v,V),b(null)}finally{w(!1)}}},[S,C]=y.useState(null),[j,E]=y.useState(!1),N=async V=>{if(S){E(!0);try{S.index!==void 0?await c.removeMemberAtIndex(S.index,S.name??"",V):await c.handleBulkDelete(V),C(null)}finally{E(!1)}}},A=()=>{if(c.selectedMembers.length===0){c.handleBulkDelete();return}C({count:c.selectedMembers.length})},_=async V=>{if(n!=null&&n.id)try{await Kvr(n.id,V.id),l({title:`${V.name} verified`,description:"They now have full access."}),c.list.refetch()}catch{l({title:"Couldn't verify this member",variant:"destructive"})}},T=async()=>{if(!(!(n!=null&&n.id)||!m)){g(!0);try{i?await Vxr(n.id,m.id):await Tse(n.id,m.id),l({title:`Blocked ${m.name}`}),f(null),c.list.refetch(),c.blockedList.refetch()}catch{l({title:"Couldn't block this user",variant:"destructive"})}finally{g(!1)}}},R=V=>{var U;return V?((U=e.find(ne=>ne.id===V))==null?void 0:U.name)??"—":(t==null?void 0:t.name)??"Community"},O=c.allTabs.filter(V=>!V.adminOnly||i),{list:F,invitedList:D,blockedList:I,kickedList:P}=c,M=!c.isInvitedTab&&!c.isBlockedTab&&!c.isKickedTab,z=c.isInvitedTab?{page:D.page,totalPages:D.totalPages,total:D.total,isLoading:D.isLoading,onPageChange:D.setPage}:c.isBlockedTab?{page:I.page,totalPages:I.totalPages,total:I.total,isLoading:I.isLoading,onPageChange:I.setPage}:c.isKickedTab?{page:P.page,totalPages:P.totalPages,total:P.total,isLoading:P.isLoading,onPageChange:P.setPage}:{page:F.page,totalPages:F.totalPages,total:F.total,isLoading:F.isLoading,onPageChange:F.setPage},G=M&&!F.isLoading&&(!!F.error||c.filteredMembers.length===0),B=c.isInvitedTab&&(D.isLoading||D.error||c.filteredInvited.length===0),H=c.isBlockedTab&&(I.isLoading||I.error||c.filteredBlocked.length===0),W=c.isKickedTab&&(P.isLoading||P.error||c.filteredKicked.length===0);return a.jsxs(it.div,{variants:fg.container,initial:"hidden",animate:"show",className:"flex gap-0 -mx-3 -mb-6 -mt-3 sm:-mx-4 lg:-m-6",children:[a.jsxs("div",{className:"min-w-0 flex-1 space-y-5 p-3 sm:p-4 lg:p-6",children:[a.jsx(gDr,{isAdmin:i,onInvite:c.goToInvitePage}),a.jsx(rOr,{tabs:O,activeTab:c.activeTab,onSelect:c.selectTab}),a.jsx(nOr,{activeTab:c.activeTab,searchQuery:c.searchQuery,onSearchChange:c.setSearchQuery,isInvitedTab:c.isInvitedTab,isBlockedTab:c.isBlockedTab,isKickedTab:c.isKickedTab,memberFields:o,state:c}),c.isInvitedTab?a.jsxs(a.Fragment,{children:[B?a.jsx(ZV,{isLoading:D.isLoading,error:D.error,isEmpty:!D.isLoading&&!D.error&&c.filteredInvited.length===0,onRetry:D.refetch,emptyLabel:"No invites found.",loadingLabel:"Loading invites…"}):a.jsx(eDr,{invited:c.filteredInvited,total:D.total,isLoading:D.isLoading,showBanner:c.showInviteBanner,onDismissBanner:()=>c.setShowInviteBanner(!1),isAdmin:i,onExport:c.handleExport,communityName:t==null?void 0:t.name,groupNameById:R,selectedIds:c.selectedInvitedIds,onToggleSelect:c.toggleInvitedSelect,onResendBulk:()=>void c.handleResendInvites(c.selectedInvitedIds),onCancelBulk:()=>void c.handleCancelInvites(c.selectedInvitedIds),onResendSingle:V=>void c.handleResendSingleInvite(V),onCancelSingle:V=>void c.handleCancelInvites([V]),resending:c.resendingInvites,cancelling:c.cancellingInvites}),a.jsx(mx,{page:z.page,totalPages:z.totalPages,total:z.total,countLabel:c.paginationCountLabel,isLoading:z.isLoading,onPageChange:z.onPageChange})]}):c.isBlockedTab?a.jsxs(a.Fragment,{children:[H?a.jsx(ZV,{isLoading:I.isLoading,error:I.error,isEmpty:!I.isLoading&&!I.error&&c.filteredBlocked.length===0,onRetry:I.refetch,emptyLabel:"No blocked members.",loadingLabel:"Loading blocked members…"}):a.jsx(z4r,{blocked:c.filteredBlocked,total:I.total,isLoading:I.isLoading,showEmail:i,onUnblock:c.unblockMember}),a.jsx(mx,{page:z.page,totalPages:z.totalPages,total:z.total,countLabel:c.paginationCountLabel,isLoading:z.isLoading,onPageChange:z.onPageChange})]}):c.isKickedTab?a.jsxs(a.Fragment,{children:[W?a.jsx(ZV,{isLoading:P.isLoading,error:P.error,isEmpty:!P.isLoading&&!P.error&&c.filteredKicked.length===0,onRetry:P.refetch,emptyLabel:"No kick history",loadingLabel:"Loading kick history…"}):a.jsx(tDr,{kicked:c.filteredKicked,total:P.total,isLoading:P.isLoading,onRestore:i?c.restoreKickedMember:void 0}),a.jsx(mx,{page:z.page,totalPages:z.totalPages,total:z.total,countLabel:c.paginationCountLabel,isLoading:z.isLoading,onPageChange:z.onPageChange})]}):a.jsxs(a.Fragment,{children:[a.jsx(uDr,{count:F.isLoading?null:F.total,isAdmin:i,selectedCount:c.selectedMembers.length,onClearSelection:()=>c.setSelectedMembers([]),onExport:c.handleExport,onInvite:()=>c.setAddMemberOpen(!0),onBulkRoleChange:V=>void c.handleBulkRoleChange(V),onBulkDelete:A,onBulkMessage:()=>c.handleBulkMessage(d)}),F.isLoading&&!i?a.jsx(pDr,{}):G?a.jsx(ZV,{isLoading:F.isLoading,error:F.error,isEmpty:!F.isLoading&&!F.error&&c.filteredMembers.length===0,onRetry:F.refetch}):a.jsx(Al,{mode:"wait",children:i?a.jsx(dDr,{members:c.filteredMembers,selectedMembers:c.selectedMembers,onToggleSelect:c.toggleSelect,onToggleSelectAll:()=>{const V=c.filteredMembers.map((ne,te)=>ne.id!==s?te:null).filter(ne=>ne!==null),U=V.length>0&&V.every(ne=>c.selectedMembers.includes(ne));c.setSelectedMembers(U?[]:V)},onToggleSubscription:c.toggleMemberSubscription,onRemove:(V,U)=>C({count:1,name:U,index:V}),onAddToGroup:V=>b({id:V.id,name:V.name}),onChangeRole:(V,U)=>void c.changeMemberRole(V,U),dmDisabled:d,onVerify:_,onBlock:f,onToggleFollow:V=>void c.toggleFollow(V),currentUserId:s,isLoading:F.isLoading,memberFields:o}):a.jsx(fDr,{members:c.filteredMembers,onToggleFollow:c.toggleFollow,dmDisabled:d,onReport:V=>h({id:V.id,name:V.name}),onBlock:f,currentUserId:s,memberFields:o})}),a.jsx(mx,{page:z.page,totalPages:z.totalPages,total:z.total,countLabel:c.paginationCountLabel,isLoading:z.isLoading,onPageChange:z.onPageChange})]})]}),a.jsx(X4r,{open:c.addMemberOpen,onOpenChange:c.setAddMemberOpen,rows:c.inviteRows,onChange:c.setInviteRows,onSubmit:c.handleAddMember,onInviteCsv:c.handleInviteCsv,isSubmitting:c.isInviting}),a.jsx(B4r,{target:v,busy:x,onOpenChange:V=>!V&&b(null),onConfirm:V=>void k(V)}),a.jsx(oOr,{target:S,busy:j,onOpenChange:V=>!V&&C(null),onConfirm:V=>void N(V)}),a.jsx(n9,{target:u,communityId:n==null?void 0:n.id,onOpenChange:V=>!V&&h(null)}),a.jsx(Kr,{open:m!==null,onOpenChange:V=>!V&&f(null),children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsxs(Ur,{children:["Block ",m==null?void 0:m.name,"?"]}),a.jsx(zr,{children:i?"They will be blocked from this community and listed under Blocked. You can unblock them from that tab.":"You won't see their posts, comments or messages anymore. You can unblock them later from Settings."})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:p,children:"Cancel"}),a.jsx(Yr,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:p,onClick:V=>{V.preventDefault(),T()},children:p?"Blocking…":"Block user"})]})]})})]})}var VRe="Progress",HRe=100,[qOr,xjs]=il(VRe),[KOr,YOr]=qOr(VRe),M5t=y.forwardRef((t,e)=>{const{__scopeProgress:n,value:r=null,max:s,getValueLabel:i=QOr,...o}=t;(s||s===0)&&!sqe(s)&&console.error(ZOr(`${s}`,"Progress"));const l=sqe(s)?s:HRe;r!==null&&!iqe(r,l)&&console.error(JOr(`${r}`,"Progress"));const c=iqe(r,l)?r:null,d=bJ(c)?i(c,l):void 0;return a.jsx(KOr,{scope:n,value:c,max:l,children:a.jsx(Sn.div,{"aria-valuemax":l,"aria-valuemin":0,"aria-valuenow":bJ(c)?c:void 0,"aria-valuetext":d,role:"progressbar","data-state":$5t(c,l),"data-value":c??void 0,"data-max":l,...o,ref:e})})});M5t.displayName=VRe;var L5t="ProgressIndicator",D5t=y.forwardRef((t,e)=>{const{__scopeProgress:n,...r}=t,s=YOr(L5t,n);return a.jsx(Sn.div,{"data-state":$5t(s.value,s.max),"data-value":s.value??void 0,"data-max":s.max,...r,ref:e})});D5t.displayName=L5t;function QOr(t,e){return`${Math.round(t/e*100)}%`}function $5t(t,e){return t==null?"indeterminate":t===e?"complete":"loading"}function bJ(t){return typeof t=="number"}function sqe(t){return bJ(t)&&!isNaN(t)&&t>0}function iqe(t,e){return bJ(t)&&!isNaN(t)&&t<=e&&t>=0}function ZOr(t,e){return`Invalid prop \`max\` of value \`${t}\` supplied to \`${e}\`. Only numbers greater than 0 are valid max values. Defaulting to \`${HRe}\`.`}function JOr(t,e){return`Invalid prop \`value\` of value \`${t}\` supplied to \`${e}\`. The \`value\` prop must be:
  - a positive number
  - less than the value passed to \`max\` (or ${HRe} if no \`max\` prop is set)
  - \`null\` or \`undefined\` if the progress is indeterminate.

Defaulting to \`null\`.`}var O5t=M5t,XOr=D5t;const ap=y.forwardRef(({className:t,value:e,...n},r)=>a.jsx(O5t,{ref:r,className:ee("relative h-4 w-full overflow-hidden rounded-full bg-secondary",t),...n,children:a.jsx(XOr,{className:"h-full w-full flex-1 bg-primary transition-all",style:{transform:`translateX(-${100-(e||0)}%)`}})}));ap.displayName=O5t.displayName;function e6r(t){return ae.get(`/community/${encodeURIComponent(t)}/streak`)}function GRe(){const{community:t}=qe(),e=(t==null?void 0:t.id)??null,n=lt({queryKey:["streak",e],queryFn:()=>e6r(e),enabled:!!e,staleTime:3e4,refetchOnWindowFocus:!0});return{streak:n.data??null,isLoading:n.isLoading}}const Yk=t=>encodeURIComponent(t);async function t6r(t){const e=await ae.get(`/community/${Yk(t)}/badges`);return Array.isArray(e==null?void 0:e.badges)?e.badges:[]}async function n6r(t,e){const n=await ae.get(`/community/${Yk(t)}/user/${Yk(e)}/badges`);return Array.isArray(n==null?void 0:n.badges)?n.badges:[]}async function r6r(t,e){const n=await ae.post(`/community/${Yk(t)}/badges`,e);return(n==null?void 0:n.badge)??null}async function aqe(t,e,n){const r=await ae.patch(`/community/${Yk(t)}/badges/${Yk(e)}`,n);return(r==null?void 0:r.badge)??null}async function s6r(t,e){await ae.delete(`/community/${Yk(t)}/badges/${Yk(e)}`)}function WRe(){const{community:t}=qe(),e=(t==null?void 0:t.id)??null,n=lt({queryKey:["badges",e],queryFn:()=>t6r(e),enabled:!!e,staleTime:6e4});return{badges:n.data??[],isLoading:n.isLoading,refetch:n.refetch}}function qRe(t){const{community:e}=qe(),n=(e==null?void 0:e.id)??null,r=lt({queryKey:["user-badges",n,t],queryFn:()=>n6r(n,t),enabled:!!(n&&t),staleTime:3e4});return{earned:r.data??[],isLoading:r.isLoading}}const xJ=[{level:1,title:"Member",pointsRequired:0,badge:"⚽"},{level:2,title:"Silver",pointsRequired:50,badge:"🥈"},{level:3,title:"Gold",pointsRequired:150,badge:"🥇"},{level:4,title:"Platinum",pointsRequired:400,badge:"🏆"},{level:5,title:"Diamond",pointsRequired:800,badge:"💎"},{level:6,title:"Elite",pointsRequired:1500,badge:"👑"}];function k9(t){let e=xJ[0];for(const n of xJ)t>=n.pointsRequired&&(e=n);return e}function i6r(t){const e=k9(t),n=xJ.findIndex(r=>r.level===e.level);return xJ[n+1]??null}function a6r(t){const e=k9(t),n=i6r(t);if(!n)return{current:e,next:null,progress:100};const r=n.pointsRequired-e.pointsRequired,s=t-e.pointsRequired,i=r>0?Math.min(100,Math.max(0,s/r*100)):0;return{current:e,next:n,progress:i}}function F5t({periods:t,period:e,onSelectPeriod:n,from:r,to:s,onPickRange:i,onClearRange:o,className:l}){const c=!!(r||s);return a.jsxs("div",{className:ee("flex flex-wrap items-center gap-3",l),children:[a.jsx("div",{className:"flex items-center gap-1 rounded-lg bg-muted p-1",children:t.map(d=>a.jsx("button",{type:"button",onClick:()=>n(d.value),className:ee("rounded-md px-3 py-1 text-xs font-medium transition-all",!c&&e===d.value?"bg-card text-foreground shadow-sm":"text-muted-foreground"),children:d.label},d.value))}),a.jsxs("div",{className:"flex min-w-0 items-center gap-1.5",children:[a.jsx(URe,{customOnly:!0,value:{from:r,to:s},onChange:d=>i(d.from,d.to),className:"h-8 max-w-[16rem] text-xs"}),c&&a.jsx("button",{type:"button",onClick:o,className:"rounded-full p-1 text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Clear date range",children:a.jsx(nn,{className:"h-3.5 w-3.5"})})]})]})}function bb(t){return typeof t=="number"&&Number.isFinite(t)?t:0}function o6r(t,e){var u,h,m,f;const n=t.statistics??{},r=bb(t.grandTotal),s=bb(n.adminAssigned),i=bb(n.postComment),o=bb(n.postLike),l=bb(n.commentReply),c=bb(n.postCreate),d=bb(n.postLiked)+bb(n.postCommented)+bb(n.commentReplied);return{rank:e,userId:((u=t.user)==null?void 0:u.id)??t.id??String(e),name:((m=(h=t.user)==null?void 0:h.name)==null?void 0:m.trim())||"Unknown",picture:(f=t.user)==null?void 0:f.picture,karmaPoints:r,customPoints:s,comments:i,upvotes:o,replies:l,posts:c,received:d,other:r-(s+i+o+l+c+d),communityRole:t.communityRole,level:k9(r)}}function B5t(t,e){return t.map((n,r)=>o6r(n,e+r))}function l6r({groupId:t}={}){var k;const{community:e}=qe(),n=(e==null?void 0:e.id)??null,[r,s]=y.useState(1),[i,o]=y.useState("all"),[l,c]=y.useState(void 0),[d,u]=y.useState(void 0),[h,m]=y.useState(""),[f,p]=y.useState("");y.useEffect(()=>{const S=setTimeout(()=>p(h.trim()),700);return()=>clearTimeout(S)},[h]),y.useEffect(()=>{s(1)},[f]);const g=S=>{o(S),s(1)},v=(S,C)=>{c(S),u(C),s(1)},b=lt({queryKey:["leaderboard",n,t??null,r,i,l,d,f],queryFn:()=>n2t(n,{page:r,duration:i,from:l,to:d,groupId:t,search:f||void 0}),enabled:!!n,placeholderData:Uy,staleTime:15e3}),x=y.useMemo(()=>{var j;const S=((j=b.data)==null?void 0:j.entries)??[],C=(r-1)*cq+1;return B5t(S,C)},[b.data,r]),w=(((k=b.data)==null?void 0:k.entries.length)??0)===cq;return{rows:x,page:r,setPage:s,duration:i,setDuration:g,from:l,to:d,setRange:v,search:h,setSearch:m,pageSize:cq,hasNextPage:w,isLoading:b.isLoading,isFetching:b.isFetching,error:b.error,refetch:b.refetch}}const vv=t=>Number.isFinite(t)?t.toLocaleString():"0";function c6r(t){return t.trim().split(/\s+/).map(e=>e[0]).filter(Boolean).slice(0,2).join("")||"?"}const d6r=[{label:"All time",value:"all"},{label:"This month",value:"month"},{label:"This week",value:"week"}];function U5t({communityId:t,isAdmin:e,groupId:n,selectedUserId:r,onSelectRow:s}){const{toast:i}=yt(),o=rn(),l=tv(),{rows:c,page:d,setPage:u,duration:h,setDuration:m,from:f,to:p,setRange:g,search:v,setSearch:b,hasNextPage:x,pageSize:w,isLoading:k,isFetching:S,error:C,refetch:j}=l6r({groupId:n}),E=P=>{g(void 0,void 0),m(P)},[N,A]=y.useState(null),[_,T]=y.useState(""),[R,O]=y.useState(!1),F=async P=>{if(!N)return;const M=Number(_);if(!Number.isInteger(M)||M<=0){i({title:"Enter a whole number greater than 0",variant:"destructive"});return}if(P===-1&&M>N.customPoints){i({title:"Can't subtract more than current custom points",description:`${N.name} has ${N.customPoints} custom points.`,variant:"destructive"});return}O(!0);try{await aur(t,N.userId,M*P,n),await o.invalidateQueries({queryKey:["leaderboard"]}),await o.invalidateQueries({queryKey:["leaderboard-my"]}),i({title:`${P===1?"Added":"Subtracted"} ${M} ${M===1?"point":"points"}`,description:N.name}),A(null)}catch(z){const G=z instanceof ze&&z.status===403?"Only admins can assign custom points.":dn(z,"Failed to update points");i({title:G,variant:"destructive"})}finally{O(!1)}},D=c.some(P=>P.other!==0),I=(e?10:9)+(D?1:0);return a.jsxs("div",{className:"rounded-lg border border-border bg-card shadow-card",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between p-5 pb-3 gap-3",children:[a.jsxs("h2",{className:"font-semibold text-foreground flex items-center gap-2",children:[a.jsx(Hg,{className:"h-4 w-4 text-primary"})," Leaderboard",S&&!k&&a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin text-muted-foreground"})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3",children:[a.jsxs("div",{className:"relative",children:[a.jsx(hs,{className:"absolute left-2.5 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),a.jsx(Oe,{value:v,onChange:P=>b(P.target.value),placeholder:"Search member",className:"h-8 w-[160px] pl-8 text-xs"})]}),a.jsx(F5t,{periods:d6r,period:h,onSelectPeriod:E,from:f,to:p,onPickRange:(P,M)=>g(P,M),onClearRange:()=>E("all")})]})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:ee("w-full table-fixed",D?"min-w-[1040px]":"min-w-[900px]"),children:[a.jsxs("colgroup",{children:[a.jsx("col",{className:"w-[6%]"}),a.jsx("col",{className:D?"w-[20%]":"w-[22%]"}),a.jsx("col",{className:D?"w-[12%]":"w-[13%]"}),a.jsx("col",{className:"w-[8%]"}),a.jsx("col",{className:D?"w-[10%]":"w-[11%]"}),a.jsx("col",{className:D?"w-[9%]":"w-[10%]"}),a.jsx("col",{className:D?"w-[9%]":"w-[10%]"}),a.jsx("col",{className:"w-[8%]"}),a.jsx("col",{className:D?"w-[10%]":"w-[12%]"}),D&&a.jsx("col",{className:"w-[8%]"}),e&&a.jsx("col",{className:"w-[7%]"})]}),a.jsx("thead",{children:a.jsxs("tr",{className:"border-t border-border bg-muted/40",children:[a.jsx("th",{className:"px-3 py-3 text-left text-xs font-medium text-muted-foreground",children:"Rank"}),a.jsx("th",{className:"px-3 py-3 text-left text-xs font-medium text-muted-foreground",children:"Member"}),a.jsx("th",{className:"px-3 py-3 text-center text-xs font-medium text-muted-foreground",children:a.jsxs("span",{className:"inline-flex items-center gap-1",children:[l,a.jsx(gn,{label:l,children:"Total points for the selected period. It is the sum of every points column to the right."})]})}),a.jsx("th",{className:"px-3 py-3 text-center text-xs font-medium text-muted-foreground",children:"Custom"}),a.jsx("th",{className:"px-3 py-3 text-center text-xs font-medium text-muted-foreground",children:a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(wd,{className:"h-3 w-3"})," Comments"]})}),a.jsx("th",{className:"px-3 py-3 text-center text-xs font-medium text-muted-foreground",children:a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(xx,{className:"h-3 w-3"})," Likes"]})}),a.jsx("th",{className:"px-3 py-3 text-center text-xs font-medium text-muted-foreground",children:a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(bK,{className:"h-3 w-3"})," Replies"]})}),a.jsx("th",{className:"px-3 py-3 text-center text-xs font-medium text-muted-foreground",children:a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(Ei,{className:"h-3 w-3"})," Posts"]})}),a.jsx("th",{className:"px-3 py-3 text-center text-xs font-medium text-muted-foreground",children:a.jsxs("span",{className:"inline-flex items-center gap-1",children:["Received",a.jsx(gn,{label:"Received",children:"Points earned when other members like or comment on this member's posts, or reply to their comments. Comments, Likes and Replies count only what the member did themselves."})]})}),D&&a.jsx("th",{className:"px-3 py-3 text-center text-xs font-medium text-muted-foreground",children:a.jsxs("span",{className:"inline-flex items-center gap-1",children:["Other",a.jsx(gn,{label:"Other",children:"Points from everything else, such as gaining followers, joining groups and going live."})]})}),e&&a.jsx("th",{className:"px-3 py-3 text-center text-xs font-medium text-muted-foreground",children:"Points"})]})}),a.jsxs("tbody",{className:"divide-y divide-border",children:[k&&Array.from({length:8}).map((P,M)=>a.jsx("tr",{children:a.jsx("td",{colSpan:I,className:"px-3 py-3",children:a.jsx("div",{className:"h-7 w-full animate-pulse rounded bg-muted/50"})})},`sk-${M}`)),!k&&C&&a.jsx("tr",{children:a.jsxs("td",{colSpan:I,className:"px-3 py-10 text-center",children:[a.jsx("p",{className:"text-sm text-muted-foreground mb-3",children:"Couldn't load the leaderboard."}),a.jsx(Z,{variant:"outline",size:"sm",onClick:()=>j(),children:"Retry"})]})}),!k&&!C&&c.length===0&&a.jsx("tr",{children:a.jsx("td",{colSpan:I,className:"px-3 py-10 text-center text-sm text-muted-foreground",children:v.trim()?"No members match your search.":"No karma activity for this period yet."})}),!k&&!C&&c.map((P,M)=>{const z=r===P.userId;return a.jsxs("tr",{onClick:()=>s==null?void 0:s(P),className:ee("transition-colors",s&&"hover:bg-muted/30 cursor-pointer",M%2===0&&"bg-muted/10",z&&"bg-primary/5 ring-1 ring-inset ring-primary/20"),children:[a.jsx("td",{className:"px-3 py-3 text-sm",children:P.rank<=3?a.jsx("span",{className:ee("inline-flex h-7 w-7 items-center justify-center rounded-full text-xs font-bold",P.rank===1&&"bg-primary/20 text-primary",P.rank===2&&"bg-muted text-muted-foreground",P.rank===3&&"bg-accent text-accent-foreground"),children:P.rank}):a.jsxs("span",{className:"text-muted-foreground",children:["#",P.rank]})}),a.jsx("td",{className:"px-3 py-3",children:a.jsxs(qd,{userId:P.userId,className:"flex items-center gap-3 min-w-0",children:[a.jsxs(oo,{className:"h-8 w-8 shrink-0",children:[a.jsx(lo,{src:P.picture,alt:P.name}),a.jsx(co,{className:"bg-primary/10 text-primary text-xs font-semibold",children:c6r(P.name)})]}),a.jsx("span",{className:"text-sm font-medium text-foreground truncate hover:underline",children:P.name})]})}),a.jsx("td",{className:"px-3 py-3 text-sm text-foreground text-center font-semibold",children:vv(P.karmaPoints)}),a.jsx("td",{className:"px-3 py-3 text-sm text-muted-foreground text-center",children:vv(P.customPoints)}),a.jsx("td",{className:"px-3 py-3 text-sm text-muted-foreground text-center",children:vv(P.comments)}),a.jsx("td",{className:"px-3 py-3 text-sm text-muted-foreground text-center",children:vv(P.upvotes)}),a.jsx("td",{className:"px-3 py-3 text-sm text-muted-foreground text-center",children:vv(P.replies)}),a.jsx("td",{className:"px-3 py-3 text-sm text-muted-foreground text-center",children:vv(P.posts)}),a.jsx("td",{className:"px-3 py-3 text-sm text-muted-foreground text-center",children:vv(P.received)}),D&&a.jsx("td",{className:"px-3 py-3 text-sm text-muted-foreground text-center",children:vv(P.other)}),e&&a.jsx("td",{className:"px-3 py-3 text-center",children:a.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 px-2 text-xs",onClick:G=>{G.stopPropagation(),A(P),T("")},children:a.jsx(Bx,{className:"h-3.5 w-3.5"})})})]},P.userId)})]})]})}),!k&&!C&&(c.length>0||d>1)&&a.jsxs("div",{className:"flex items-center justify-between p-4 border-t border-border",children:[a.jsxs("span",{className:"text-xs text-muted-foreground",children:["Page ",d,c.length>0?` · showing ${c.length} of up to ${w}`:""]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(Z,{variant:"outline",size:"sm",disabled:d<=1||S,onClick:()=>u(Math.max(1,d-1)),children:[a.jsx(nl,{className:"h-3.5 w-3.5"})," Prev"]}),a.jsxs(Z,{variant:"outline",size:"sm",disabled:!x||S,onClick:()=>u(d+1),children:["Next ",a.jsx(io,{className:"h-3.5 w-3.5"})]})]})]}),a.jsx(Bt,{open:N!==null,onOpenChange:P=>!P&&A(null),children:a.jsxs(Ft,{className:"sm:max-w-[400px]",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Custom points"}),a.jsx(_n,{children:N?`${N.name} currently has ${vv(N.customPoints)} custom points (${vv(N.karmaPoints)} total).`:""})]}),a.jsx(Oe,{type:"number",min:1,step:1,value:_,onChange:P=>T(P.target.value),placeholder:"Number of points",autoFocus:!0}),a.jsxs(ir,{className:"gap-2 sm:gap-2",children:[a.jsxs(Z,{variant:"outline",onClick:()=>F(-1),disabled:R,children:[a.jsx(gSe,{className:"h-4 w-4 mr-1"})," Subtract"]}),a.jsxs(Z,{onClick:()=>F(1),disabled:R,children:[R?a.jsx(Ne,{className:"h-4 w-4 mr-1 animate-spin"}):a.jsx(Dn,{className:"h-4 w-4 mr-1"}),"Add"]})]})]})})]})}const XV=t=>Number.isFinite(t)?t.toLocaleString():"0";function u6r(t){return t.trim().split(/\s+/).map(e=>e[0]).filter(Boolean).slice(0,2).join("")||"?"}function h6r({earned:t,allBadges:e}){const n=new Set(t.map(i=>{var o;return(o=i.badge)==null?void 0:o.id}).filter(Boolean)),r=t.map(i=>i.badge).filter(i=>!!i),s=e.filter(i=>i.isEnabled&&!n.has(i.id));return r.length===0&&s.length===0?null:a.jsxs("div",{className:"mt-4",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground mb-2",children:"Earned badges"}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.map(i=>a.jsxs("div",{title:i.description,className:"inline-flex items-center gap-1.5 rounded-full border border-primary/30 bg-primary/10 px-2.5 py-1 text-xs font-medium text-foreground cursor-default",children:[a.jsx("span",{className:"text-sm",children:i.icon}),a.jsx("span",{children:i.name})]},i.id)),s.map(i=>a.jsxs("div",{title:`Locked — ${i.description}`,className:"inline-flex items-center gap-1.5 rounded-full border border-border bg-muted/40 px-2.5 py-1 text-xs font-medium text-muted-foreground opacity-60 cursor-default",children:[a.jsx("span",{className:"text-sm grayscale",children:i.icon}),a.jsx("span",{children:i.name})]},i.id))]})]})}function z5t(){const{user:t}=jr(),{community:e}=qe(),n=(e==null?void 0:e.myRole)==="admin",{myScore:r}=nse(),{streak:s}=GRe(),i=tv(),[o,l]=y.useState(null),c=y.useMemo(()=>{var C,j,E,N;const x=(r==null?void 0:r.breakdown)??null,w=(x==null?void 0:x.grandTotal)??(r==null?void 0:r.score)??0,k=((j=(C=x==null?void 0:x.user)==null?void 0:C.name)==null?void 0:j.trim())||[t==null?void 0:t.firstName,t==null?void 0:t.lastName].filter(Boolean).join(" ")||"You",S=RE((t==null?void 0:t.picture)??void 0)?t==null?void 0:t.picture:void 0;return{userId:((E=x==null?void 0:x.user)==null?void 0:E.id)??null,name:k,picture:((N=x==null?void 0:x.user)==null?void 0:N.picture)||S,karma:w,level:k9(w),rank:(r==null?void 0:r.rank)??null,streak:(s==null?void 0:s.currentStreak)??null}},[r,t,s]),d=o!==null,u=o?{userId:o.userId,name:o.name,picture:o.picture,karma:o.karmaPoints,level:o.level,rank:o.rank,streak:null}:c,{earned:h}=qRe(u.userId),{badges:m}=WRe(),{current:f,next:p,progress:g}=a6r(u.karma),v={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.04}}},b={hidden:{opacity:0,y:8},show:{opacity:1,y:0}};return a.jsxs(it.div,{variants:v,initial:"hidden",animate:"show",className:"space-y-6",children:[a.jsxs(it.div,{variants:b,children:[a.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:"Leaderboard"}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Earn ",i," through posts, likes, comments & replies. Level up and unlock badges!"]})]}),a.jsx(it.div,{variants:b,children:a.jsxs("div",{className:"rounded-lg border border-border bg-card p-6 shadow-card relative",children:[d&&a.jsx("button",{onClick:()=>l(null),className:"absolute top-3 right-3 p-1 rounded-full hover:bg-muted transition-colors text-muted-foreground hover:text-foreground","aria-label":"Back to your profile",children:a.jsx(nn,{className:"h-4 w-4"})}),a.jsxs("div",{className:"flex flex-col sm:flex-row sm:items-center gap-6",children:[a.jsxs("div",{className:"flex items-center gap-4",children:[a.jsxs("div",{className:"relative",children:[a.jsxs(oo,{className:"h-16 w-16 border-2 border-primary",children:[a.jsx(lo,{src:u.picture,alt:u.name}),a.jsx(co,{className:"bg-primary/10 text-primary text-lg font-bold",children:u6r(u.name)})]}),a.jsx("span",{className:"absolute -bottom-1 -right-1 h-6 w-6 rounded-full bg-primary text-primary-foreground text-xs font-bold flex items-center justify-center",children:u.level.level})]}),a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-foreground",children:u.name}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:[XV(u.karma)," ",i]})]})]}),a.jsxs("div",{className:"sm:ml-auto text-center sm:text-right",children:[a.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-primary/10 text-primary px-3 py-1 text-sm font-medium",children:[a.jsx(Bx,{className:"h-4 w-4"})," Level ",u.level.level," — ",u.level.title]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:u.rank!=null?`Rank #${u.rank}`:"Your standing"})]})]}),a.jsxs("div",{className:"mt-5 space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[a.jsxs("span",{children:["Level ",f.level]}),a.jsxs("span",{children:[XV(u.karma),p?` / ${XV(p.pointsRequired)}`:""," ",i]}),a.jsx("span",{children:p?`Level ${p.level}`:"Max"})]}),a.jsx(ap,{value:g,className:"h-2"})]}),a.jsx(h6r,{earned:h,allBadges:m})]})}),a.jsxs(it.div,{variants:b,className:"grid grid-cols-1 sm:grid-cols-3 gap-4",children:[a.jsxs("div",{className:"rounded-lg border border-border bg-card p-5 shadow-card",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-1",children:[a.jsx(SSe,{className:"h-4 w-4 text-warning"})," Total ",i]}),a.jsx("p",{className:"text-2xl font-semibold text-foreground",children:XV(u.karma)})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-card p-5 shadow-card",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-1",children:[a.jsx(HP,{className:"h-4 w-4 text-primary"})," ",d?"Their":"Your"," rank"]}),a.jsx("p",{className:"text-2xl font-semibold text-foreground",children:u.rank!=null?`#${u.rank}`:"—"})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-card p-5 shadow-card",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground mb-1",children:[a.jsx(D8,{className:"h-4 w-4 text-destructive"})," Streak"]}),a.jsx("p",{className:"text-2xl font-semibold text-foreground",children:u.streak!=null?`${u.streak} days`:"—"}),!d&&(s==null?void 0:s.streakLabel)&&a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:s.streakLabel})]})]}),a.jsx(it.div,{variants:b,children:a.jsx(U5t,{communityId:(e==null?void 0:e.id)??"",isAdmin:n,selectedUserId:o==null?void 0:o.userId,onSelectRow:l})})]})}async function V5t(t){return ae.get(`/community/${encodeURIComponent(t)}/get-remaining-mail-count`)}function m6r(t){if(!(!t||t===vJ))return t}function f6r(t){return!t||t===vJ?"":t}function p6r(){const{user:t}=jr(),{community:e}=qe(),{groups:n,communityDetail:r}=Ln(),s=e==null?void 0:e.id,i=typeof window<"u"?window.location.origin:"",[o,l]=y.useState(vJ),[c,d]=y.useState([{name:"",email:""}]),[u,h]=y.useState(""),[m,f]=y.useState(null),[p,g]=y.useState(0),[v,b]=y.useState(!1),[x,w]=y.useState(!1),[k,S]=y.useState(!1),[C,j]=y.useState(!1),E=lt({queryKey:["mail-quota",s],queryFn:()=>V5t(s),enabled:!!s,staleTime:6e4}),N=lt({queryKey:["invite-mail-template",s],queryFn:()=>uOr(s),enabled:!!s,staleTime:6e4}),A=y.useRef(!1);y.useEffect(()=>{N.isSuccess&&!A.current&&(A.current=!0,h(N.data??""))},[N.isSuccess,N.data]);const _=y.useMemo(()=>{var G,B;const M=(G=E.data)==null?void 0:G.dailyLimit,z=_5t((B=E.data)==null?void 0:B.dailyLimitReset);return M==null?null:`${M} invite email${M===1?"":"s"} remaining today${z?`. Resets at ${z}`:""}.`},[E.data]),T=y.useMemo(()=>[{id:vJ,name:i||"Whole community"},...n.map(M=>({id:M.id,name:M.name}))],[n,i]),R=y.useCallback(M=>{const z=M.filter(H=>H.email.trim()||H.name.trim());if(z.length===0)return{ok:!1,error:"Add at least one name and email."};const G=z.filter(H=>H.email.trim());return G.length!==z.length?{ok:!1,error:"Please enter a valid email address."}:G.filter(H=>!T5t.test(H.email.trim())).length>0?{ok:!1,error:"Please enter a valid email address."}:{ok:!0,members:G.map(H=>({name:H.name.trim(),email:H.email.trim()}))}},[]),O=y.useCallback(()=>({groupId:m6r(o),additionalMessage:u.trim()||void 0}),[o,u]),F=y.useCallback(async()=>{if(!s)return{ok:!1,error:"No community selected."};const M=R(c);if(!M.ok)return M;const z=M.members.length;if(!window.confirm(`Are you sure you want to send invite mail to ${z} ${z===1?"user":"users"}?`))return{ok:!1,cancelled:!0};b(!0);try{return await mOr(s,M.members,O()),d([{name:"",email:""}]),E.refetch(),{ok:!0}}catch(B){return{ok:!1,error:B instanceof ze?Dt(B.body,B.message):"Couldn't send the invitation."}}finally{b(!1)}},[s,c,O,E,R]),D=y.useCallback(async()=>{if(!s)return{ok:!1,error:"No community selected."};if(!m)return{ok:!1,error:"Please select a file."};if(!window.confirm("Are you sure you want to send invite mail?"))return{ok:!1,cancelled:!0};w(!0),g(0);try{return await A5t(s,m,{groupId:f6r(o),additionalMessage:u.trim()||void 0},g),f(null),E.refetch(),{ok:!0}}catch(z){return{ok:!1,error:z instanceof ze?Dt(z.body,z.message):"Couldn't send the invitation."}}finally{w(!1),g(0)}},[s,m,o,u,E]),I=y.useCallback(async()=>{if(!s||!(t!=null&&t.email))return{ok:!1,error:"Please link your email to your account."};S(!0);try{return await NF(s,[{email:t.email,name:t.name??t.email}],O()),{ok:!0}}catch(M){return{ok:!1,error:M instanceof ze?Dt(M.body,M.message):"Couldn't send the invitation."}}finally{S(!1)}},[s,t,O]),P=y.useCallback(async()=>{if(!s)return{ok:!1,error:"No community selected."};j(!0);try{return await hOr(s,u),N.refetch(),{ok:!0}}catch(M){return{ok:!1,error:M instanceof ze?Dt(M.body,M.message):"Error saving template"}}finally{j(!1)}},[s,u,N]);return{inviteLink:i,communityName:(r==null?void 0:r.name)??(e==null?void 0:e.name)??"Community",groupOptions:T,selectedGroupId:o,setSelectedGroupId:l,emailRows:c,setEmailRows:d,additionalMessage:u,setAdditionalMessage:h,csvFile:m,setCsvFile:f,csvUploadPercent:p,dailyQuotaLabel:_,quotaLoading:E.isLoading,sendingEmail:v,sendingCsv:x,sendingTestMail:k,savingTemplate:C,sendEmailInvites:F,sendCsvInvites:D,sendTestMail:I,saveTemplate:P}}function g6r(){const t=p6r(),e=async()=>{const i=await t.sendEmailInvites();"cancelled"in i&&i.cancelled||(i.ok?He.success("Invitation sent successfully"):i.error&&He.error(i.error))},n=async()=>{const i=await t.sendCsvInvites();"cancelled"in i&&i.cancelled||(i.ok?He.success("Invitation sent successfully"):i.error&&He.error(i.error))},r=async()=>{const i=await t.sendTestMail();i.ok?He.success("Invitation sent successfully"):i.error&&He.info(i.error)},s=async()=>{const i=await t.saveTemplate();i.ok?He.success("Template saved successfully"):i.error&&He.error(i.error)};return a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Invite Members"}),t.dailyQuotaLabel?a.jsx("p",{className:"text-xs text-muted-foreground",children:t.dailyQuotaLabel}):t.quotaLoading?a.jsx(Ne,{className:"h-4 w-4 animate-spin text-muted-foreground"}):null]}),a.jsxs("div",{className:"grid grid-cols-1 gap-5 lg:grid-cols-2",children:[a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2 text-sm",children:[a.jsx("span",{className:"text-muted-foreground shrink-0",children:"Invite your members to"}),a.jsxs(zn,{value:t.selectedGroupId,onValueChange:t.setSelectedGroupId,children:[a.jsx(On,{className:"h-9 max-w-full flex-1 text-primary",children:a.jsx(Vn,{})}),a.jsx(Fn,{className:"z-50 max-h-60 bg-popover",children:t.groupOptions.map(i=>a.jsx(pt,{value:i.id,children:i.name.length>48?`${i.name.slice(0,48)}…`:i.name},i.id))})]})]}),a.jsxs("div",{className:"space-y-3 rounded-lg border border-border bg-card p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[a.jsx(eu,{className:"h-4 w-4"})," Invite via link"]}),a.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border bg-muted/30 px-3 py-2",children:[a.jsx("span",{className:"flex-1 truncate text-sm text-foreground",children:t.inviteLink}),a.jsxs("button",{type:"button",onClick:()=>{navigator.clipboard.writeText(t.inviteLink),He.success("Link copied")},className:"inline-flex shrink-0 items-center gap-1 text-xs text-primary hover:underline",children:["copy ",a.jsx(Zl,{className:"h-3 w-3"})]})]})]}),a.jsxs("div",{className:"space-y-3 rounded-lg border border-border bg-card p-4",children:[a.jsx("div",{className:"text-sm font-medium text-foreground",children:"Invite via email"}),t.emailRows.map((i,o)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Oe,{placeholder:"Name",value:i.name,onChange:l=>t.setEmailRows(t.emailRows.map((c,d)=>d===o?{...c,name:l.target.value}:c))}),a.jsx(Oe,{placeholder:"Email ID",type:"email",value:i.email,onChange:l=>t.setEmailRows(t.emailRows.map((c,d)=>d===o?{...c,email:l.target.value}:c))}),t.emailRows.length>1?a.jsx("button",{type:"button",onClick:()=>t.setEmailRows(t.emailRows.filter((l,c)=>c!==o)),className:"text-muted-foreground hover:text-foreground",children:a.jsx(nn,{className:"h-4 w-4"})}):a.jsx("span",{className:"w-4"})]},o)),a.jsxs("button",{type:"button",onClick:()=>t.setEmailRows([...t.emailRows,{name:"",email:""}]),className:"inline-flex items-center gap-1 text-xs text-primary hover:underline",children:[a.jsx(Dn,{className:"h-3 w-3"})," Add more"]}),a.jsx(Z,{className:"w-full",disabled:t.sendingEmail,onClick:()=>void e(),children:t.sendingEmail?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):"Send invite"})]}),a.jsxs("div",{className:"space-y-3 rounded-lg border border-border bg-card p-4",children:[a.jsx("div",{className:"text-sm font-medium text-foreground",children:"Upload a CSV"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Upload a CSV file with name and email as headers."}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Here is a"," ",a.jsx("button",{type:"button",onClick:d5t,className:"text-primary hover:underline",children:"template CSV file"}),"."]}),a.jsxs("label",{className:"flex w-full cursor-pointer items-center justify-center gap-2 rounded-md border border-dashed border-border px-3 py-3 text-sm text-foreground hover:bg-muted",children:[a.jsx(kd,{className:"h-4 w-4"}),t.csvFile?t.csvFile.name:"Upload file",a.jsx("input",{type:"file",accept:".csv,text/csv",className:"sr-only",onChange:i=>{var o;return t.setCsvFile(((o=i.target.files)==null?void 0:o[0])??null)}})]}),t.sendingCsv&&t.csvUploadPercent>0?a.jsx(ap,{value:t.csvUploadPercent,className:"h-2"}):null,a.jsx(Z,{className:"w-full",disabled:t.sendingCsv,onClick:()=>void n(),children:t.sendingCsv?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):"Send invite"})]})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Mail template"}),a.jsx("button",{type:"button",className:"text-xs text-primary hover:underline disabled:opacity-50",disabled:t.sendingTestMail,onClick:()=>void r(),children:t.sendingTestMail?"Sending…":"Send test mail"})]}),a.jsxs("div",{className:"space-y-3 rounded-lg border border-border bg-card p-4 text-sm",children:[a.jsxs("p",{children:["Hey ","{name}",","]}),a.jsxs("p",{children:["{invited_by_name}"," has invited you to join the ","{community_name}"]}),a.jsx(Z,{variant:"secondary",className:"mt-2 pointer-events-none",type:"button",children:"Join"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Add custom message"}),a.jsx("button",{type:"button",className:"text-xs text-primary hover:underline disabled:opacity-50",disabled:t.savingTemplate,onClick:()=>void s(),children:t.savingTemplate?"Saving…":"Save"})]}),a.jsx(us,{placeholder:"Enter message here",value:t.additionalMessage,onChange:i=>t.setAdditionalMessage(i.target.value),rows:6})]}),a.jsxs("div",{className:"space-y-1 rounded-lg border border-border bg-card p-4 text-xs text-muted-foreground",children:[a.jsx("div",{className:"mb-2 text-sm font-semibold text-foreground",children:"Editor basics"}),a.jsxs("p",{children:["Use ","{name}"," for name of user"]}),a.jsxs("p",{children:["Use ","{email}"," for email of user"]}),a.jsxs("p",{children:["Use ","{invited_by_name}"," for invited by user name"]}),a.jsxs("p",{children:["Use ","{group_name}"," for group name"]}),a.jsxs("p",{children:["Use ","{community_name}"," for community name"]}),a.jsxs("p",{children:["Use ","{community_url}"," for community address"]}),a.jsxs("p",{children:["Do not use any space between ","{}"]})]})]})]})]})}const B3="everyone",oqe=120,v6r=10,y6r=[{token:"{name}",description:"Name of user"},{token:"{email}",description:"Email of user"},{token:"{group_name}",description:"Group name"},{token:"{community_name}",description:"Community name"},{token:"{community_url}",description:"Community address"},{token:"{invited_by_name}",description:"Sender name"}],H5t=t=>encodeURIComponent(t);async function b6r(t,e){return ae.post(`/community/${H5t(t)}/bulk-email`,e)}async function x6r(t,e={}){var s;const n=new URLSearchParams({page:String(e.page??1)});(s=e.search)!=null&&s.trim()&&n.set("search",e.search.trim());const r=await ae.get(`/community/${H5t(t)}/bulk-email/log?${n.toString()}`);return{data:Array.isArray(r==null?void 0:r.data)?r.data:[],page:(r==null?void 0:r.page)??1,limit:(r==null?void 0:r.limit)??10,total:(r==null?void 0:r.total)??0,message:r==null?void 0:r.message}}function w6r(t,e=!0){var o,l,c,d;const{community:n}=qe(),r=n==null?void 0:n.id,s=lt({queryKey:["bulk-mail-log",r,t],queryFn:()=>x6r(r,{page:t}),enabled:!!r&&e,staleTime:3e4}),i=Math.max(1,Math.ceil((((o=s.data)==null?void 0:o.total)??0)/v6r));return{entries:((l=s.data)==null?void 0:l.data)??[],page:((c=s.data)==null?void 0:c.page)??t,total:((d=s.data)==null?void 0:d.total)??0,totalPages:i,isLoading:s.isLoading,isError:s.isError,refetch:s.refetch}}function k6r(){const{community:t}=qe(),e=t==null?void 0:t.id,n=rn();return jt({mutationFn:r=>b6r(e,r),onSuccess:()=>{n.invalidateQueries({queryKey:["bulk-mail-log",e]}),n.invalidateQueries({queryKey:["mail-quota",e]})}})}function S6r(){const{community:t}=qe(),e=t==null?void 0:t.id,n=lt({queryKey:["mail-quota",e],queryFn:()=>V5t(e),enabled:!!e,staleTime:6e4});return{monthlyLabel:y.useMemo(()=>{var o,l;const s=(o=n.data)==null?void 0:o.monthlyLimit,i=_5t((l=n.data)==null?void 0:l.monthlyLimitReset);return s==null?null:`${s} bulk email${s===1?"":"s"} remaining this month${i?`. Resets at ${i}`:""}.`},[n.data]),isLoading:n.isLoading,refetch:n.refetch}}function C6r(){const[t,e]=y.useState("list"),[n,r]=y.useState(1),[s,i]=y.useState(null),o=w6r(n,t==="list"),l=k6r(),c=S6r();return{view:t,page:n,setPage:r,detailEntry:s,log:o,sendMutation:l,quota:c,openSend:()=>{i(null),e("send")},openDetail:f=>{i(f),e("detail")},backToList:()=>{i(null),e("list")},afterSend:()=>{r(1),i(null),e("list"),o.refetch()}}}function j6r(){return a.jsxs("div",{className:"h-fit rounded-lg border border-border bg-muted/20 p-5",children:[a.jsx("h3",{className:"mb-3 text-sm font-semibold text-foreground",children:"Editor basics"}),a.jsxs("ul",{className:"space-y-2 text-sm text-muted-foreground",children:[y6r.map(({token:t,description:e})=>a.jsxs("li",{children:["Use ",t," for ",e]},t)),a.jsxs("li",{children:["Do not use any space between ","{}"]})]})]})}function lqe({readOnly:t=!1,initial:e=null,monthlyLabel:n,quotaLoading:r,sending:s,onBack:i,onSend:o}){var S;const{groups:l,communityDetail:c}=Ln(),d=y.useMemo(()=>[{value:B3,label:"Everyone"},...l.map(C=>({value:C.id,label:C.name}))],[l]),u=e!=null&&e.group&&e.group!==B3?e.group:B3,[h,m]=y.useState(u),[f,p]=y.useState((e==null?void 0:e.subjectLine)??""),[g,v]=y.useState((e==null?void 0:e.emailBody)??"");y.useEffect(()=>{m(u),p((e==null?void 0:e.subjectLine)??""),v((e==null?void 0:e.emailBody)??"")},[e,u]);const b=((S=d.find(C=>C.value===h))==null?void 0:S.label)??"Everyone",x=f.length>oqe?`Subject must be ${oqe} characters or fewer.`:f.trim()?null:"Subject is required.",w=!!(f.trim()&&g.trim()&&!x),k=()=>{!w||!o||o({groupId:h===B3?null:h,subjectLine:f.trim(),emailBody:g,audienceName:b})};return a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsxs("button",{type:"button",onClick:i,className:"flex items-center gap-2 text-base font-semibold text-foreground hover:text-primary",children:[a.jsx(nl,{className:"h-5 w-5"}),t?"Mail details":"Send mail"]}),!t&&n?a.jsx("p",{className:"text-sm text-muted-foreground",children:n}):!t&&r?a.jsx(Ne,{className:"h-4 w-4 animate-spin text-muted-foreground"}):null]}),a.jsxs("div",{className:"grid grid-cols-1 gap-5 lg:grid-cols-3",children:[a.jsxs("div",{className:"space-y-5 rounded-lg border border-border bg-card p-6 lg:col-span-2",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"To:"}),t?a.jsx("p",{className:"mt-2 text-sm text-foreground",children:h===B3?(c==null?void 0:c.name)??"Everyone":b}):a.jsxs(zn,{value:h,onValueChange:m,children:[a.jsx(On,{className:"mt-2 h-11",children:a.jsx(Vn,{})}),a.jsx(Fn,{className:"z-50 max-h-60 bg-popover",children:d.map(C=>a.jsx(pt,{value:C.value,children:C.label},C.value))})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Subject"}),a.jsx("input",{value:f,onChange:C=>p(C.target.value),placeholder:"Enter mail subject",readOnly:t,className:"mt-2 h-11 w-full rounded-md border border-border bg-background px-3 text-sm read-only:opacity-80"}),x&&!t?a.jsx("p",{className:"mt-1 text-xs text-destructive",children:x}):null]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Write message"}),a.jsx(us,{value:g,onChange:C=>v(C.target.value),placeholder:"Enter message here",rows:9,readOnly:t,className:"mt-2 resize-none read-only:opacity-80"})]}),t?null:a.jsxs("div",{className:"flex items-center justify-between pt-2",children:[a.jsx("button",{type:"button",onClick:i,className:"text-sm text-muted-foreground hover:text-foreground",children:"Cancel"}),a.jsx(Z,{disabled:!w||s,onClick:k,children:s?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):"Send"})]})]}),a.jsx(j6r,{})]})]})}function E6r(){const{groups:t,communityDetail:e}=Ln(),n=C6r(),r=o=>{var l;return o?((l=t.find(c=>c.id===o))==null?void 0:l.name)??"—":(e==null?void 0:e.name)??"—"},s=async o=>{if(window.confirm(`Are you sure you want to send mail to ${o.audienceName}?`))try{await n.sendMutation.mutateAsync({groupId:o.groupId,subjectLine:o.subjectLine,emailBody:o.emailBody}),He.success("Mail sent successfully"),n.afterSend()}catch(c){const d=c instanceof ze?Dt(c.body,c.message):"Error sending mail";He.error(d)}};if(n.view==="send")return a.jsx(lqe,{monthlyLabel:n.quota.monthlyLabel,quotaLoading:n.quota.isLoading,sending:n.sendMutation.isPending,onBack:n.backToList,onSend:o=>void s(o)});if(n.view==="detail"&&n.detailEntry)return a.jsx(lqe,{readOnly:!0,initial:n.detailEntry,monthlyLabel:null,quotaLoading:!1,sending:!1,onBack:n.backToList});const{log:i}=n;return a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Bulk mail"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button",onClick:()=>void i.refetch(),disabled:i.isLoading,className:"inline-flex h-9 w-9 items-center justify-center rounded-md border border-border hover:bg-muted disabled:opacity-50","aria-label":"Refresh list",children:i.isLoading?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsx(Nl,{className:"h-4 w-4"})}),a.jsx("button",{type:"button",onClick:n.openSend,className:"inline-flex h-9 w-9 items-center justify-center rounded-md border border-border hover:bg-muted",title:"Send mail",children:a.jsx(Ii,{className:"h-4 w-4"})})]})]}),a.jsxs("button",{type:"button",onClick:n.openSend,className:"w-full rounded-lg border border-border bg-primary/5 p-6 text-center transition-colors hover:bg-primary/10",children:[a.jsx("p",{className:"text-sm font-semibold text-primary",children:"Send mail"}),a.jsx("p",{className:"mt-1 text-sm text-primary",children:"Send bulk mail to all the members of the community or to selected groups."})]}),a.jsx("div",{className:"overflow-hidden rounded-lg border border-border bg-card",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-muted/30 text-xs uppercase text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Date"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Subject"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Audience"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Recipients"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:i.isLoading?a.jsx("tr",{children:a.jsx("td",{colSpan:4,className:"px-4 py-10 text-center",children:a.jsx(Ne,{className:"mx-auto h-5 w-5 animate-spin text-muted-foreground"})})}):i.entries.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:4,className:"px-4 py-12 text-center text-muted-foreground",children:"No mail sent yet"})}):i.entries.map(o=>a.jsxs("tr",{className:"cursor-pointer hover:bg-muted/20",onClick:()=>n.openDetail(o),children:[a.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:o.createdAt?yc(o.createdAt):"—"}),a.jsx("td",{className:"px-4 py-4 text-foreground",children:o.subjectLine??"—"}),a.jsx("td",{className:"px-4 py-4 text-foreground",children:r(o.group)}),a.jsx("td",{className:"px-4 py-4 text-foreground",children:o.recipientCount&&o.recipientCount>0?`${o.recipientCount} user${o.recipientCount===1?"":"s"}`:"—"})]},o.id))})]})}),a.jsx(mx,{page:n.page,totalPages:i.totalPages,total:i.total,countLabel:"sent mails",isLoading:i.isLoading,onPageChange:n.setPage})]})}var oie="Tabs",[N6r,wjs]=il(oie,[wM]),G5t=wM(),[T6r,KRe]=N6r(oie),W5t=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,onValueChange:s,defaultValue:i,orientation:o="horizontal",dir:l,activationMode:c="automatic",...d}=t,u=ES(l),[h,m]=Sd({prop:r,onChange:s,defaultProp:i??"",caller:oie});return a.jsx(T6r,{scope:n,baseId:el(),value:h,onValueChange:m,orientation:o,dir:u,activationMode:c,children:a.jsx(Sn.div,{dir:u,"data-orientation":o,...d,ref:e})})});W5t.displayName=oie;var q5t="TabsList",K5t=y.forwardRef((t,e)=>{const{__scopeTabs:n,loop:r=!0,...s}=t,i=KRe(q5t,n),o=G5t(n);return a.jsx(GTe,{asChild:!0,...o,orientation:i.orientation,dir:i.dir,loop:r,children:a.jsx(Sn.div,{role:"tablist","aria-orientation":i.orientation,...s,ref:e})})});K5t.displayName=q5t;var Y5t="TabsTrigger",Q5t=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,disabled:s=!1,...i}=t,o=KRe(Y5t,n),l=G5t(n),c=X5t(o.baseId,r),d=eIt(o.baseId,r),u=r===o.value;return a.jsx(WTe,{asChild:!0,...l,focusable:!s,active:u,children:a.jsx(Sn.button,{type:"button",role:"tab","aria-selected":u,"aria-controls":d,"data-state":u?"active":"inactive","data-disabled":s?"":void 0,disabled:s,id:c,...i,ref:e,onMouseDown:Kt(t.onMouseDown,h=>{!s&&h.button===0&&h.ctrlKey===!1?o.onValueChange(r):h.preventDefault()}),onKeyDown:Kt(t.onKeyDown,h=>{[" ","Enter"].includes(h.key)&&o.onValueChange(r)}),onFocus:Kt(t.onFocus,()=>{const h=o.activationMode!=="manual";!u&&!s&&h&&o.onValueChange(r)})})})});Q5t.displayName=Y5t;var Z5t="TabsContent",J5t=y.forwardRef((t,e)=>{const{__scopeTabs:n,value:r,forceMount:s,children:i,...o}=t,l=KRe(Z5t,n),c=X5t(l.baseId,r),d=eIt(l.baseId,r),u=r===l.value,h=y.useRef(u);return y.useEffect(()=>{const m=requestAnimationFrame(()=>h.current=!1);return()=>cancelAnimationFrame(m)},[]),a.jsx(Rl,{present:s||u,children:({present:m})=>a.jsx(Sn.div,{"data-state":u?"active":"inactive","data-orientation":l.orientation,role:"tabpanel","aria-labelledby":c,hidden:!m,id:d,tabIndex:0,...o,ref:e,style:{...t.style,animationDuration:h.current?"0s":void 0},children:m&&i})})});J5t.displayName=Z5t;function X5t(t,e){return`${t}-trigger-${e}`}function eIt(t,e){return`${t}-content-${e}`}var _6r=W5t,tIt=K5t,nIt=Q5t,rIt=J5t;const U0=_6r,nb=y.forwardRef(({className:t,...e},n)=>a.jsx(tIt,{ref:n,className:ee("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",t),...e}));nb.displayName=tIt.displayName;const Xo=y.forwardRef(({className:t,...e},n)=>a.jsx(nIt,{ref:n,className:ee("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-background transition-all data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-sm focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",t),...e}));Xo.displayName=nIt.displayName;const pd=y.forwardRef(({className:t,...e},n)=>a.jsx(rIt,{ref:n,className:ee("mt-2 ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",t),...e}));pd.displayName=rIt.displayName;const lie=t=>`/community/${encodeURIComponent(t)}`;function sIt(t){return ae.get(`${lie(t)}/payment-preference`)}function A6r(t,e){return ae.post(`${lie(t)}/payment-preference`,e)}function P6r(t){return ae.get(`${lie(t)}/invoice-preference`)}function R6r(t,e){return ae.post(`${lie(t)}/invoice-preference`,e)}const I6r={oneMonthlySubscriptions:[],threeMonthlySubscriptions:[],sixMonthlySubscriptions:[],twelveMonthlySubscriptions:[],oneTimeSubscriptions:[]};function iIt(t,e){return(t.effectiveAccessibleGroups??t.accessibleGroups??[]).some(r=>(typeof r=="string"?r:r.id)===e)}function M6r(t,e){if(!t||!(e!=null&&e.length))return{...I6r};const n=e.filter(r=>!r.isDeleted&&r.isActive!==!1&&(r.effectiveAccessibleGroups??r.accessibleGroups??[]).some(s=>(typeof s=="string"?s:s.id)===t));return aIt(n)}function aIt(t){const e={oneMonthlySubscriptions:[],threeMonthlySubscriptions:[],sixMonthlySubscriptions:[],twelveMonthlySubscriptions:[],oneTimeSubscriptions:[]};for(const n of t)n.isRecurring&&n.recurringInterval===1?e.oneMonthlySubscriptions.push(n):n.isRecurring&&n.recurringInterval===3?e.threeMonthlySubscriptions.push(n):n.isRecurring&&n.recurringInterval===6?e.sixMonthlySubscriptions.push(n):n.isRecurring&&n.recurringInterval===12?e.twelveMonthlySubscriptions.push(n):n.isRecurring||e.oneTimeSubscriptions.push(n);return e}function cie(t){return[...t.oneMonthlySubscriptions,...t.threeMonthlySubscriptions,...t.sixMonthlySubscriptions,...t.twelveMonthlySubscriptions,...t.oneTimeSubscriptions]}function L6r(t){return cie(t).some(e=>(e.subscriptionAmount??0)>0)}function oIt(t,e){return(Array.isArray(t)?t:t?[t]:[]).some(r=>{const s=r.subscriptionPlan;return!!((r.hasAccess??r.isActive)&&s&&(s.subscriptionAmount??0)>0&&iIt(s,e))})}function AN(t){const e=die(t),n=(t.currency??"INR").toUpperCase(),r=n==="INR"?"₹":n==="USD"?"$":`${n} `,s=Number.isInteger(e)?String(e):e.toFixed(2);return`${r}${s}`}function Ax(t){if(!t.isRecurring)return"One-time";switch(t.recurringInterval){case 1:return"Monthly";case 3:return"Quarterly";case 6:return"Half-yearly";case 12:return"Yearly";default:return"Recurring"}}function D6r(t){if(!t.isRecurring)return null;switch(t.recurringInterval){case 1:return"per month";case 3:return"every 3 months";case 6:return"every 6 months";case 12:return"per year";default:return t.recurringInterval?`every ${t.recurringInterval} months`:null}}function lIt(t){const e=(t==null?void 0:t.trim())??"";return e?/imported from(?:\s+a)?\s+circle/i.test(e)||/recurring billing is not transferred/i.test(e)||/existing circle billing is not transferred/i.test(e):!1}function YRe(t){const e=new Set,n=[];for(const r of[...JRe(t),...B6r(t)])!r.name||e.has(r.id)||(e.add(r.id),n.push(r));return n}function hP(t){return(t.accessibleCourses??[]).filter(e=>typeof e!="string").filter(e=>!!e.title).map(e=>({id:e.id,title:e.title}))}function QRe(t){const e=AN({id:"price",subscriptionAmount:t.amount,taxPercentage:0,currency:t.currency}),n=t.isRecurring?t.recurringInterval===1?"/mo":t.recurringInterval===12?"/yr":` / ${t.recurringInterval} mo`:"";return`From ${e}${n}`}function cqe(t){return t.length===1?t[0]:t.length===2?`${t[0]} and ${t[1]}`:`${t.slice(0,-1).join(", ")}, and ${t[t.length-1]}`}function $6r(t,e){var i;const n=[...YRe(t).map(o=>o.name),...hP(t).map(o=>o.title)];if(e!=null&&e.complimentary)return n.length>0?`Complimentary access to ${cqe(n)}.`:"Complimentary access granted by a community admin.";const r=(i=t.description)==null?void 0:i.trim();if(r&&!lIt(r))return r;const s=t.isRecurring?`${Ax(t)} membership`:"One-time membership";return n.length>0?`${s} that includes ${cqe(n)}.`:`${s}.`}function a2(t){return!t.subscriptionAmount}function S9(t,e){const n=t||0;return Math.round(n+(e||0)/100*n)}function die(t){return S9(t.subscriptionAmount,t.taxPercentage)/100}function wJ(t){const e=t.trim();if(!e)return 0;if(!/^\d{1,3}(\.\d{1,2})?$/.test(e))return null;const n=Number(e);return n<=100?n:null}function O6r(t){return typeof t=="string"?t:t.id}function F6r(t){var e;return((e=t.accessibleGroups)==null?void 0:e.length)??0}function ZRe(t){return(t.effectiveAccessibleGroups??t.accessibleGroups??[]).map(n=>typeof n=="string"?{id:n}:{id:n.id,name:n.name,groupType:n.groupType})}function JRe(t){const e=ZRe(t),n=e.some(r=>!!r.groupType);return e.filter(r=>n?r.groupType==="closed-paid":!0).filter(r=>!!r.name).map(r=>({id:r.id,name:r.name}))}function B6r(t){const e=(t.linkedAccessGroups??[]).flatMap(s=>s.groups??[]),n=e.length>0?e:ZRe(t).filter(s=>s.groupType==="closed-free"),r=new Set;return n.filter(s=>s.name&&!r.has(s.id)&&r.add(s.id)).map(s=>({id:s.id,name:s.name}))}function U6r(t){const e=new Set;for(const n of t)if(!(!n.subscriptionAmount||n.isDeleted||n.isActive===!1))for(const r of ZRe(n))e.add(r.id);return e}function z6r(t,e){const n=[...new Set(e.flatMap(r=>JRe(r).map(s=>s.name)))];return n.length===1?`${t} is included with ${n[0]}. Buy that paid group to unlock both while the subscription is active.`:n.length>1?`${t} is included with ${n.join(" or ")}. Buy one of those paid groups to unlock this group.`:`Choose a membership plan that includes ${t}.`}function awe(t,e){return(t.accessibleGroups??[]).map(n=>{var s;const r=O6r(n);return typeof n!="string"&&n.name?n.name:((s=e.find(i=>i.id===r))==null?void 0:s.name)??r})}async function cIt(t){const{communityId:e,plan:n,billingDetails:r}=t;if(!n.id)throw new Error("Invalid plan");if(a2(n)){await Bdr(e,n.id);return}const s=await Udr(e,n.id,{billingDetails:r??{},returnUrl:(()=>{const i=new URL(window.location.href);return i.searchParams.set("subscription_plan",n.id),i.toString()})()});if(!s.checkoutUrl)throw new Error("Payment could not be started.");window.location.assign(s.checkoutUrl)}function dIt(t,e){return t instanceof ze?Dt(t.body,t.message):e}function uIt(t){return!(t instanceof ze)||!t.body||typeof t.body!="object"?!1:t.body.code==="PAYWALL_NOT_CONFIGURED"}function V6r(t){return(t==null?void 0:t.paymentMethod)==="stripe"&&(t==null?void 0:t.integrationStatus)==="completed"}function dqe(t,e){return e instanceof ze&&e.status>=400&&e.status<500?!1:t<2}function qM(){var m,f,p,g;const{community:t}=qe(),e=t==null?void 0:t.id,n=(t==null?void 0:t.myRole)==="admin"||(t==null?void 0:t.isByMe)===!0,r=rn(),s=lt({queryKey:["payment-preference",e],queryFn:()=>sIt(e),enabled:!!e,staleTime:1e4,refetchOnMount:"always",retry:dqe}),i=lt({queryKey:["invoice-preference",e],queryFn:()=>P6r(e),enabled:!!e&&n,staleTime:6e4,retry:dqe}),o=()=>{r.invalidateQueries({queryKey:["payment-preference",e]}),r.invalidateQueries({queryKey:["invoice-preference",e]})},l=jt({mutationFn:v=>A6r(e,v),onSuccess:o}),c=jt({mutationFn:v=>R6r(e,v),onSuccess:o}),d=(m=i.data)==null?void 0:m.invoicePreference,u=(f=s.data)==null?void 0:f.paymentPreference,h=y.useCallback(async()=>{await r.invalidateQueries({queryKey:["payment-preference",e]}),n&&await r.invalidateQueries({queryKey:["invoice-preference",e]})},[e,n,r]);return{paymentPreference:u,stripeWebhookEndpoint:(p=s.data)==null?void 0:p.stripeWebhookEndpoint,invoicePreference:d,taxPercentage:((g=d==null?void 0:d.sellerInformation)==null?void 0:g.taxPercentage)??0,isLoading:s.isLoading||n&&i.isLoading,isPaymentNotSet:!s.isError&&!V6r(u),refetch:h,updatePayment:l.mutateAsync,updateInvoice:c.mutateAsync,isUpdating:l.isPending||c.isPending,isUpdatingPayment:l.isPending,isUpdatingInvoice:c.isPending}}function uqe(t,e){const n=Number(t),r=(Number.isFinite(n)?n:0)+e;return String(r).padStart(5,"0")}function H6r({status:t}){return t?a.jsxs("span",{className:ee("inline-flex shrink-0 items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-semibold",t==="completed"?"border-emerald-200 bg-emerald-50 text-emerald-700 dark:border-emerald-900 dark:bg-emerald-950/50 dark:text-emerald-300":t==="pending"?"border-amber-200 bg-amber-50 text-amber-700 dark:border-amber-900 dark:bg-amber-950/50 dark:text-amber-300":"border-border bg-muted/50 text-muted-foreground"),children:[t==="completed"?a.jsx(yo,{className:"h-3.5 w-3.5"}):a.jsx("span",{className:"h-2 w-2 rounded-full bg-current"}),t==="completed"?"Connected":t==="pending"?"Pending":"Not connected"]}):null}function KM({open:t,onOpenChange:e,purpose:n="default",onConfigured:r}){var J,K;const{toast:s}=yt(),{paymentPreference:i,invoicePreference:o,stripeWebhookEndpoint:l,isLoading:c,updatePayment:d,updateInvoice:u,isUpdatingPayment:h,isUpdatingInvoice:m,refetch:f}=qM(),[p,g]=y.useState("invoice"),[v,b]=y.useState(!1),x=y.useRef("next"),w=y.useRef(!1),k=!!((J=i==null?void 0:i.stripe)!=null&&J.connected),[S,C]=y.useState(""),[j,E]=y.useState(""),[N,A]=y.useState(!1),[_,T]=y.useState(!1),[R,O]=y.useState(!1),[F,D]=y.useState(!1),[I,P]=y.useState(""),[M,z]=y.useState("11111"),[G,B]=y.useState(""),[H,W]=y.useState(""),[V,U]=y.useState(""),[ne,te]=y.useState(""),[re,fe]=y.useState(""),[le,q]=y.useState("");y.useEffect(()=>{const ce=t&&!w.current;w.current=t,ce&&(g("invoice"),b(!1),f())},[t,f]),y.useEffect(()=>{k?(C("**************************"),E("**************************")):(C(""),E(""))},[k]),y.useEffect(()=>{if(!o)return;D(o.autoSendInvoice??!1),P(o.invoicePrefix??""),z(o.invoiceSeries??"11111");const ce=o.sellerInformation;ce&&(B(ce.organisationName??""),W(ce.addressLine1??""),U(ce.addressLine2??""),te(ce.state??""),fe(ce.country??""),q(ce.email??""))},[o]);const Y=(ce,pe)=>ce instanceof ze?Dt(ce.body,ce.message):pe,X=async ce=>{ce.preventDefault();try{await d({paymentMethod:"stripe",stripeSecretKey:S.trim(),stripeWebhookSecret:j.trim()}),s({title:"Stripe connected",description:"Your Stripe credentials were validated successfully."}),r==null||r()}catch(pe){s({title:"Could not connect Stripe",description:Y(pe,"Check your keys and try again."),variant:"destructive"})}},Q=async()=>{try{await d({paymentMethod:"not-set"}),s({title:"Stripe disconnected"}),O(!1)}catch(ce){s({title:"Could not disconnect",description:Y(ce,"Something went wrong."),variant:"destructive"})}},ie=async ce=>{ce.preventDefault();try{await u({autoSendInvoice:F,invoicePrefix:I.trim(),invoiceSeries:M.trim(),sellerInformation:{organisationName:G.trim(),addressLine1:H.trim(),addressLine2:V.trim(),state:ne.trim(),country:re.trim(),email:le.trim(),taxPercentage:0}}),b(!0),x.current==="next"?(g("payment"),s({title:"Invoice details saved",description:"Now connect your Stripe account."})):s({title:"Invoice details saved"})}catch(pe){s({title:"Could not save invoice settings",description:Y(pe,"Check required fields and try again."),variant:"destructive"})}},he=async()=>{l&&(await navigator.clipboard.writeText(l),s({title:"Copied webhook URL"}))},ye=i==null?void 0:i.integrationStatus;return a.jsxs(a.Fragment,{children:[a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"h-[calc(100dvh-2rem)] w-[calc(100vw-2rem)] max-w-2xl grid-rows-[auto_minmax(0,1fr)] gap-0 overflow-hidden p-0 sm:h-[min(90dvh,800px)]",children:[a.jsx(Vt,{className:"border-b border-border bg-gradient-to-br from-primary/[0.08] via-background to-background px-4 py-5 pr-12 sm:px-6",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-primary",children:a.jsx(Sh,{className:"h-5 w-5"})}),a.jsxs("div",{className:"space-y-1",children:[a.jsx(Ut,{className:"text-xl",children:"Paywall settings"}),a.jsx(_n,{children:n==="import"?"Imported members keep access until their Circle paid-through date. Connect Stripe and add this community’s webhook so new purchases and later billing run on SpatialChat Communities.":"Connect payments and customise invoices for your memberships."})]})]})}),c?a.jsx("div",{className:"flex justify-center py-20",children:a.jsx(Ne,{className:"h-6 w-6 animate-spin text-muted-foreground"})}):a.jsxs(U0,{value:p,onValueChange:ce=>{const pe=ce;pe==="payment"&&!v||g(pe)},className:"flex min-h-0 flex-col overflow-hidden",children:[a.jsx("div",{className:"shrink-0 border-b border-border px-4 pt-4 sm:px-6",children:a.jsxs(nb,{className:"h-11 w-full rounded-xl bg-muted/70 p-1",children:[a.jsxs(Xo,{value:"invoice",className:"flex-1 gap-2 rounded-lg data-[state=active]:shadow-sm",children:[a.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-primary/10 text-[11px] font-bold text-primary",children:"1"}),a.jsx(Ei,{className:"h-4 w-4"})," Invoice details"]}),a.jsxs(Xo,{value:"payment",disabled:!v,className:"flex-1 gap-2 rounded-lg data-[state=active]:shadow-sm",children:[a.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-full bg-primary/10 text-[11px] font-bold text-primary",children:"2"}),a.jsx(Sh,{className:"h-4 w-4"})," Stripe payment"]})]})}),a.jsx(pd,{value:"payment",className:"m-0 min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-4 py-5 sm:px-6",children:a.jsxs("form",{onSubmit:ce=>void X(ce),className:"space-y-5",children:[a.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 shadow-sm",children:[a.jsxs("div",{className:"flex flex-col items-start gap-4 sm:flex-row sm:justify-between",children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[a.jsx("div",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-lg bg-[#635bff]/10 text-[#635bff]",children:a.jsx("span",{className:"text-lg font-bold",children:"S"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"font-semibold",children:"Stripe account"}),a.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"Membership revenue is paid directly to this account."})]})]}),a.jsx(H6r,{status:ye})]}),(K=i==null?void 0:i.stripe)!=null&&K.accountId?a.jsxs("div",{className:"mt-4 flex flex-wrap items-center gap-2 border-t border-border pt-3 text-xs",children:[a.jsx("span",{className:"font-mono text-muted-foreground",children:i.stripe.accountId}),a.jsx("span",{className:ee("rounded-full px-2 py-0.5 font-semibold",i.stripe.livemode?"bg-emerald-100 text-emerald-700 dark:bg-emerald-950 dark:text-emerald-300":"bg-amber-100 text-amber-700 dark:bg-amber-950 dark:text-amber-300"),children:i.stripe.livemode?"Live mode":"Test mode"})]}):null]}),a.jsxs("div",{className:"space-y-4 rounded-xl border border-border p-4",children:[a.jsxs("div",{className:"flex gap-3",children:[a.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary text-xs font-bold text-primary-foreground",children:"1"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold",children:"Add your Stripe credentials"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Use test keys while setting up your paywall."})]})]}),a.jsxs("div",{className:"space-y-2 sm:pl-10",children:[a.jsxs(_e,{htmlFor:"stripe-secret",className:"flex items-center gap-2",children:[a.jsx(pO,{className:"h-3.5 w-3.5 text-muted-foreground"})," Secret API key"]}),a.jsxs("div",{className:"relative",children:[a.jsx(Oe,{id:"stripe-secret",type:N?"text":"password",required:!0,readOnly:k,value:S,onChange:ce=>C(ce.target.value),placeholder:"sk_test_… or sk_live_…",autoComplete:"off",className:"h-11 pr-11 font-mono text-sm"}),k?null:a.jsx("button",{type:"button",onClick:()=>A(ce=>!ce),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground","aria-label":N?"Hide secret key":"Show secret key",children:N?a.jsx(BP,{className:"h-4 w-4"}):a.jsx(Oc,{className:"h-4 w-4"})})]}),a.jsxs("p",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[a.jsx(Sk,{className:"h-3.5 w-3.5 text-emerald-600"})," Encrypted before it is stored and never exposed to members."]})]}),a.jsxs("div",{className:"space-y-2 sm:pl-10",children:[a.jsxs(_e,{htmlFor:"stripe-webhook-secret",className:"flex items-center gap-2",children:[a.jsx(ife,{className:"h-3.5 w-3.5 text-muted-foreground"})," Webhook signing secret"]}),a.jsxs("div",{className:"relative",children:[a.jsx(Oe,{id:"stripe-webhook-secret",type:_?"text":"password",required:!0,readOnly:k,value:j,onChange:ce=>E(ce.target.value),placeholder:"whsec_…",autoComplete:"off",className:"h-11 pr-11 font-mono text-sm"}),k?null:a.jsx("button",{type:"button",onClick:()=>T(ce=>!ce),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground","aria-label":_?"Hide webhook secret":"Show webhook secret",children:_?a.jsx(BP,{className:"h-4 w-4"}):a.jsx(Oc,{className:"h-4 w-4"})})]})]})]}),l?a.jsxs("div",{className:"rounded-xl border border-border p-4",children:[a.jsxs("div",{className:"flex gap-3",children:[a.jsx("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary text-xs font-bold text-primary-foreground",children:"2"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold",children:"Create the Stripe webhook"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Paste this URL into Developers → Webhooks in Stripe."})]})]}),a.jsxs("div",{className:"mt-4 flex min-w-0 gap-2 sm:pl-10",children:[a.jsx("div",{className:"min-w-0 flex-1 truncate rounded-lg border border-border bg-muted/40 px-3 py-2.5 font-mono text-xs text-foreground",title:l,children:l}),a.jsx(Z,{type:"button",variant:"outline",size:"icon",className:"h-10 w-10 shrink-0",onClick:()=>void he(),title:"Copy webhook URL",children:a.jsx(Zl,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"mt-4 rounded-xl border-2 border-primary/35 bg-primary/5 p-3.5 sm:ml-10",children:[a.jsxs("div",{className:"flex items-start gap-2.5",children:[a.jsx("div",{className:"rounded-lg bg-primary/10 p-2 text-primary",children:a.jsx(ife,{className:"h-4 w-4"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-bold text-foreground",children:"Required Stripe webhook events"}),a.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"Select all five events so subscriptions, renewals, failed payments, and cancellations work properly."})]})]}),a.jsxs("div",{className:"mt-3 grid gap-2 text-xs",children:[a.jsxs("div",{className:"rounded-lg border border-border bg-background/90 p-3",children:[a.jsx("p",{className:"font-semibold text-foreground",children:"Checkout session"}),a.jsxs("p",{className:"mt-1.5 flex items-center gap-2 font-mono text-foreground",children:[a.jsx(Qn,{className:"h-3.5 w-3.5 shrink-0 text-emerald-600"})," checkout.session.completed"]})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-background/90 p-3",children:[a.jsx("p",{className:"font-semibold text-foreground",children:"Invoice"}),a.jsxs("p",{className:"mt-1.5 flex items-center gap-2 font-mono text-foreground",children:[a.jsx(Qn,{className:"h-3.5 w-3.5 shrink-0 text-emerald-600"})," invoice.paid"]}),a.jsxs("p",{className:"mt-1.5 flex items-center gap-2 font-mono text-foreground",children:[a.jsx(Qn,{className:"h-3.5 w-3.5 shrink-0 text-emerald-600"})," invoice.payment_failed"]})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-background/90 p-3",children:[a.jsxs("p",{className:"font-semibold text-foreground",children:["Customer subscription ",a.jsx("span",{className:"font-normal text-muted-foreground",children:"(not Invoice)"})]}),a.jsxs("p",{className:"mt-1.5 flex items-center gap-2 font-mono text-foreground",children:[a.jsx(Qn,{className:"h-3.5 w-3.5 shrink-0 text-emerald-600"})," customer.subscription.updated"]}),a.jsxs("p",{className:"mt-1.5 flex items-center gap-2 font-mono text-foreground",children:[a.jsx(Qn,{className:"h-3.5 w-3.5 shrink-0 text-emerald-600"})," customer.subscription.deleted"]})]})]})]})]}):null,a.jsxs("div",{className:"-mx-4 flex flex-wrap items-center justify-between gap-3 border-t border-border bg-background px-4 pb-1 pt-4 sm:-mx-6 sm:px-6",children:[k?a.jsx(Z,{type:"button",variant:"destructive",disabled:h,onClick:()=>O(!0),children:"Disconnect"}):a.jsxs(Z,{type:"submit",disabled:h,children:[h?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Sk,{className:"mr-2 h-4 w-4"}),h?"Validating…":"Validate & connect Stripe"]}),a.jsxs("a",{href:"https://docs.stripe.com/keys",target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1 text-xs text-primary hover:underline",children:["Find Stripe API keys",a.jsx(bo,{className:"h-3 w-3"})]})]})]})}),a.jsx(pd,{value:"invoice",className:"m-0 min-h-0 flex-1 overflow-x-hidden overflow-y-auto px-4 py-5 sm:px-6",children:a.jsxs("form",{onSubmit:ce=>void ie(ce),className:"space-y-5",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsx(_e,{htmlFor:"auto-invoice",className:"text-sm font-normal leading-snug",children:"Auto send invoice to billing email on membership purchase"}),a.jsx(Hs,{id:"auto-invoice",checked:F,onCheckedChange:D})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Invoice serial number"}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(_e,{className:"text-xs text-muted-foreground",children:["Prefix ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Oe,{required:!0,value:I,onChange:ce=>P(ce.target.value),placeholder:"ABC"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(_e,{className:"text-xs text-muted-foreground",children:["Series ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Oe,{required:!0,type:"number",value:M,onChange:ce=>z(ce.target.value),placeholder:"10000"})]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Next invoice numbers: ",I,uqe(M,1),", ",I,uqe(M,2)]})]}),a.jsxs("div",{className:"space-y-3 rounded-lg border border-border bg-muted/20 p-4",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("p",{className:"text-sm font-medium",children:"Seller information for invoice"}),a.jsx("a",{href:"https://storage.googleapis.com/pensil-storage/storage/documents/sample%20invoice%20pdf-9b20a8d6-036b-4043-a409-9437bb6f68ef.pdf",target:"_blank",rel:"noopener noreferrer",className:"text-xs text-primary hover:underline",children:"Sample invoice"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(_e,{children:["Organisation name ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Oe,{required:!0,value:G,onChange:ce=>B(ce.target.value),placeholder:"Community name"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(_e,{children:["Address line 1 ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Oe,{required:!0,value:H,onChange:ce=>W(ce.target.value),placeholder:"Enter address"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Address line 2"}),a.jsx(Oe,{value:V,onChange:ce=>U(ce.target.value),placeholder:"Enter address"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(_e,{children:["State ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Oe,{required:!0,value:ne,onChange:ce=>te(ce.target.value),placeholder:"Enter state"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(_e,{children:["Country ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Oe,{required:!0,value:re,onChange:ce=>fe(ce.target.value),placeholder:"Enter country"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(_e,{children:["Email ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Oe,{required:!0,type:"email",value:le,onChange:ce=>q(ce.target.value),placeholder:"Enter email"})]})]}),a.jsxs("div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",children:[a.jsx(Z,{type:"submit",variant:"outline",disabled:m,onClick:()=>{x.current="save"},children:m&&x.current==="save"?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):"Save"}),a.jsx(Z,{type:"submit",disabled:m,onClick:()=>{x.current="next"},children:m&&x.current==="next"?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):"Next"})]})]})})]})]})}),a.jsx(Kr,{open:R,onOpenChange:O,children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Disconnect Stripe?"}),a.jsx(zr,{children:"Existing memberships remain recorded, but members cannot purchase plans until Stripe is reconnected."})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:h,children:"Cancel"}),a.jsx(Yr,{disabled:h,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:ce=>{ce.preventDefault(),Q()},children:h?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):"Disconnect"})]})]})})]})}function G6r({open:t,onOpenChange:e,communityId:n,userSubscription:r,onUpdated:s}){var f,p;const{toast:i}=yt(),[o,l]=y.useState(((f=r.invoiceDetails)==null?void 0:f.invoicePrefix)??""),[c,d]=y.useState(String(((p=r.invoiceDetails)==null?void 0:p.invoiceNumber)??"")),[u,h]=y.useState(!1),m=async g=>{if(g.preventDefault(),!!r.id){h(!0);try{await Gdr(n,r.id,{invoicePrefix:o.trim(),invoiceNumber:c.trim()}),i({title:"Invoice updated"}),s==null||s({...r,invoiceDetails:{...r.invoiceDetails,invoicePrefix:o.trim(),invoiceNumber:c.trim()}}),e(!1)}catch(v){i({title:"Could not update invoice",description:v instanceof ze?Dt(v.body,v.message):"Try again.",variant:"destructive"})}finally{h(!1)}}};return a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"sm:max-w-sm",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Update invoice number"}),a.jsx(_n,{children:"Change the invoice prefix and number for this member."})]}),a.jsxs("form",{onSubmit:g=>void m(g),className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"inv-prefix",children:"Prefix"}),a.jsx(Oe,{id:"inv-prefix",value:o,onChange:g=>l(g.target.value),required:!0})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"inv-number",children:"Number"}),a.jsx(Oe,{id:"inv-number",value:c,onChange:g=>d(g.target.value),required:!0})]}),a.jsxs(ir,{children:[a.jsx(Z,{type:"button",variant:"outline",onClick:()=>e(!1),children:"Cancel"}),a.jsx(Z,{type:"submit",disabled:u,children:u?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):"Save"})]})]})]})})}const hqe=10;function XRe(t,e=!1){if(!t)return"—";const n=new Date(t);return Number.isNaN(n.getTime())?"—":n.toLocaleDateString("en-US",{day:"numeric",month:"short",year:"numeric",...e?{hour:"numeric",minute:"2-digit",hour12:!0}:{}})}function W6r(t,e){if(!e.isRecurring||!t.createdAt)return"—";const n=new Date(t.createdAt),r=e.recurringInterval??0;if(!r)return"—";const s=new Date(n);return s.setMonth(s.getMonth()+r),XRe(s.toISOString())}function q6r(t){const e=t.invoiceDetails;return e?`${e.invoicePrefix??""}${e.invoiceNumber??""}`:"—"}function mqe({sub:t,plan:e,communityId:n,showRenewal:r,onUpdated:s}){const{toast:i}=yt(),[o,l]=y.useState(!1),[c,d]=y.useState(!1),u=t.user,h=t.billingDetails,m=async()=>{if(t.id){l(!0);try{const p=await qdr(n,t.id),g=URL.createObjectURL(p),v=document.createElement("a");v.href=g,v.download=`invoice-${t.id}.pdf`,v.click(),URL.revokeObjectURL(g)}catch{i({title:"Download failed",variant:"destructive"})}finally{l(!1)}}},f=async()=>{if(t.id){l(!0);try{await Wdr(n,t.id),i({title:"Invoice sent"})}catch(p){i({title:"Could not send invoice",description:p instanceof ze?Dt(p.body,p.message):"Try again.",variant:"destructive"})}finally{l(!1)}}};return a.jsxs(a.Fragment,{children:[a.jsxs("tr",{className:"border-b border-border text-sm hover:bg-muted/20",children:[a.jsx("td",{className:"px-3 py-3",children:q6r(t)}),a.jsxs("td",{className:"px-3 py-3",children:[a.jsx("p",{className:"font-medium",children:(u==null?void 0:u.name)??"N/A"}),((u==null?void 0:u.email)||(u==null?void 0:u.mobile))&&a.jsx("p",{className:"text-xs text-muted-foreground",children:[u==null?void 0:u.email,u==null?void 0:u.mobile].filter(Boolean).join(" | ")})]}),a.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:(h==null?void 0:h.state)??"—"}),a.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:(h==null?void 0:h.country)??"—"}),a.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:XRe(t.createdAt,!r)}),r?a.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:W6r(t,e)}):null,a.jsx("td",{className:"px-3 py-2 text-right",children:o?a.jsx(Ne,{className:"ml-auto h-4 w-4 animate-spin"}):a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx("button",{type:"button",className:"inline-flex h-8 w-8 items-center justify-center rounded-md hover:bg-muted",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[a.jsxs(ot,{onClick:()=>void m(),children:[a.jsx(bc,{className:"mr-2 h-4 w-4"})," Download invoice"]}),r?a.jsx(ot,{onClick:()=>d(!0),children:"Edit invoice no."}):null,a.jsxs(ot,{onClick:()=>void f(),children:[a.jsx(_s,{className:"mr-2 h-4 w-4"})," Send invoice"]})]})]})})]}),r?a.jsx(G6r,{open:c,onOpenChange:d,communityId:n,userSubscription:t,onUpdated:s}):null]})}function K6r({plan:t,open:e,onOpenChange:n,groups:r}){const{community:s}=qe(),i=(s==null?void 0:s.id)??"",[o,l]=y.useState("members"),[c,d]=y.useState(1),[u,h]=y.useState(1),[m,f]=y.useState([]),[p,g]=y.useState([]),[v,b]=y.useState(0),[x,w]=y.useState(0),k=lt({queryKey:["subscription-active-members",i,t==null?void 0:t.id,c],queryFn:()=>Vdr(i,t.id,c),enabled:!!(e&&i&&(t!=null&&t.id)&&o==="members")}),S=lt({queryKey:["subscription-logs",i,t==null?void 0:t.id,u],queryFn:()=>Hdr(i,t.id,u),enabled:!!(e&&i&&(t!=null&&t.id)&&o==="logs")});y.useEffect(()=>{k.data&&(f(k.data.userSubscriptions??k.data.subscriptions??[]),b(k.data.total??0))},[k.data]),y.useEffect(()=>{S.data&&(g(S.data.userSubscriptions??S.data.subscriptions??[]),w(S.data.total??0))},[S.data]),y.useEffect(()=>{e||(l("members"),d(1),h(1))},[e]),y.useEffect(()=>{d(1)},[t==null?void 0:t.id]),y.useEffect(()=>{h(1)},[t==null?void 0:t.id]);const C=Math.max(1,Math.ceil(v/hqe)),j=Math.max(1,Math.ceil(x/hqe)),E=t?die(t):0,N=t?E>0?AN(t):"Free":"—",A=t?awe(t,r):[],_=t?hP(t):[],T=y.useMemo(()=>[{id:"members",label:"Active members"},{id:"access",label:"Access to"},{id:"details",label:"Details"},{id:"logs",label:"Logs"}],[]);return t?a.jsx(B0,{open:e,onOpenChange:n,children:a.jsxs(Xy,{side:"right",className:"w-full sm:max-w-2xl overflow-y-auto",children:[a.jsxs(eb,{className:"text-left pb-4 border-b border-border",children:[a.jsx(tb,{className:"text-xl",children:t.name??"Subscription"}),a.jsxs("div",{className:"flex flex-wrap items-baseline gap-2 text-sm text-muted-foreground",children:[a.jsx("span",{className:"text-lg font-semibold text-foreground",children:N}),t.isRecurring&&t.recurringInterval?a.jsxs("span",{children:["per ",t.recurringInterval," month",t.recurringInterval>1?"s":""]}):null,a.jsxs("span",{children:["· ",Ax(t)]})]})]}),a.jsx("div",{className:"flex gap-4 border-b border-border mt-4 overflow-x-auto",children:T.map(R=>a.jsx("button",{type:"button",onClick:()=>l(R.id),className:ee("-mb-px border-b-2 pb-2 text-sm font-medium whitespace-nowrap transition-colors",o===R.id?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:R.label},R.id))}),a.jsxs("div",{className:"mt-4",children:[o==="members"?k.isLoading?a.jsx("div",{className:"flex justify-center py-12",children:a.jsx(Ne,{className:"h-6 w-6 animate-spin"})}):a.jsxs("div",{className:"overflow-x-auto rounded-lg border border-border",children:[a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-muted/30 text-xs uppercase text-muted-foreground",children:[a.jsx("th",{className:"px-3 py-2 text-left",children:"Invoice"}),a.jsx("th",{className:"px-3 py-2 text-left",children:"Member"}),a.jsx("th",{className:"px-3 py-2 text-left",children:"State"}),a.jsx("th",{className:"px-3 py-2 text-left",children:"Country"}),a.jsx("th",{className:"px-3 py-2 text-left",children:"Started on"}),a.jsx("th",{className:"px-3 py-2 text-left",children:"Next renewal"}),a.jsx("th",{className:"px-3 py-2 text-right",children:"Actions"})]})}),a.jsx("tbody",{children:m.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"px-3 py-10 text-center text-muted-foreground",children:"No active members"})}):m.map(R=>a.jsx(mqe,{sub:R,plan:t,communityId:i,showRenewal:!0,onUpdated:O=>f(F=>F.map(D=>D.id===O.id?O:D))},R.id))})]}),a.jsx(mx,{page:c,totalPages:C,total:v,countLabel:"members",isLoading:k.isLoading,onPageChange:d,className:"border-0 rounded-none border-t border-border"})]}):null,o==="access"?a.jsxs("div",{className:"space-y-4 text-sm",children:[a.jsx("div",{children:a.jsxs("p",{className:"font-medium",children:[F6r(t)," groups · ",_.length," ",_.length===1?"course":"courses"]})}),A.length>0?a.jsxs("div",{children:[a.jsx("p",{className:"mb-2 font-medium",children:"Groups"}),a.jsx("ul",{className:"list-disc space-y-1 pl-5 text-muted-foreground",children:A.map(R=>a.jsx("li",{children:R},R))})]}):null,_.length>0?a.jsxs("div",{children:[a.jsx("p",{className:"mb-2 font-medium",children:"Courses"}),a.jsx("ul",{className:"list-disc space-y-1 pl-5 text-muted-foreground",children:_.map(R=>a.jsx("li",{children:a.jsx(vr,{to:ve.knowledgeCourse(R.id),className:"hover:text-foreground hover:underline",children:R.title})},R.id))})]}):null,A.length===0&&_.length===0?a.jsx("p",{className:"text-muted-foreground",children:"No access targets linked."}):null]}):null,o==="details"?a.jsxs("dl",{className:"grid gap-3 text-sm",children:[a.jsxs("div",{children:[a.jsx("dt",{className:"text-muted-foreground",children:"Name"}),a.jsx("dd",{className:"font-medium",children:t.name??"—"})]}),t.description&&!lIt(t.description)?a.jsxs("div",{children:[a.jsx("dt",{className:"text-muted-foreground",children:"Description"}),a.jsx("dd",{children:t.description})]}):null,a.jsxs("div",{children:[a.jsx("dt",{className:"text-muted-foreground",children:"Amount"}),a.jsx("dd",{children:N})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-muted-foreground",children:"Billing"}),a.jsx("dd",{children:Ax(t)})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-muted-foreground",children:"Currency"}),a.jsx("dd",{children:(t.currency??"USD").toUpperCase()})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-muted-foreground",children:"Tax"}),a.jsxs("dd",{children:[t.taxPercentage??0,"%"]})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-muted-foreground",children:"Status"}),a.jsx("dd",{children:t.activationStatus==="deactivating"?"Deactivating":t.activationStatus==="activating"?"Activating":t.isDeleted?"Deactivated":"Active"})]}),a.jsxs("div",{children:[a.jsx("dt",{className:"text-muted-foreground",children:"Created"}),a.jsx("dd",{children:XRe(t.createdAt)})]})]}):null,o==="logs"?S.isLoading?a.jsx("div",{className:"flex justify-center py-12",children:a.jsx(Ne,{className:"h-6 w-6 animate-spin"})}):a.jsxs("div",{className:"overflow-x-auto rounded-lg border border-border",children:[a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-muted/30 text-xs uppercase text-muted-foreground",children:[a.jsx("th",{className:"px-3 py-2 text-left",children:"Invoice"}),a.jsx("th",{className:"px-3 py-2 text-left",children:"Member"}),a.jsx("th",{className:"px-3 py-2 text-left",children:"State"}),a.jsx("th",{className:"px-3 py-2 text-left",children:"Country"}),a.jsx("th",{className:"px-3 py-2 text-left",children:"Payment on"}),a.jsx("th",{className:"px-3 py-2 text-right",children:"Actions"})]})}),a.jsx("tbody",{children:p.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"px-3 py-10 text-center text-muted-foreground",children:"No logs available"})}):p.map(R=>a.jsx(mqe,{sub:R,plan:t,communityId:i,showRenewal:!1,onUpdated:O=>g(F=>F.map(D=>D.id===O.id?O:D))},R.id))})]}),a.jsx(mx,{page:u,totalPages:j,total:x,countLabel:"entries",isLoading:S.isLoading,onPageChange:h,className:"border-0 rounded-none border-t border-border"})]}):null]})]})}):null}function PN(){const{community:t}=qe(),e=t==null?void 0:t.id,n=rn(),r=lt({queryKey:["member-subscriptions-admin",e],queryFn:()=>Kdr(e),enabled:!!e,staleTime:3e4,refetchInterval:c=>{var d,u;return(u=(d=c.state.data)==null?void 0:d.subscriptions)!=null&&u.some(h=>h.activationStatus==="activating"||h.activationStatus==="deactivating")?1e4:!1},select:c=>c.subscriptions??[]}),s=()=>{n.invalidateQueries({queryKey:["member-subscriptions-admin",e]}),n.invalidateQueries({queryKey:["knowledge-subscription-plans",e]}),n.invalidateQueries({queryKey:["member-subscriptions",e]})},i=jt({mutationFn:c=>Ydr(e,c),onSuccess:s}),o=jt({mutationFn:c=>Qdr(e,c),onSuccess:s}),l=jt({mutationFn:c=>Zdr(e,c),onSuccess:s});return{plans:r.data??[],isLoading:r.isLoading,isError:r.isError,refetch:r.refetch,createPlan:i.mutateAsync,isCreating:i.isPending,deletePlan:o.mutateAsync,isDeleting:o.isPending,activatePlan:l.mutateAsync,isActivating:l.isPending}}function Y6r(t){if(!t)return"—";const e=new Date(t);return Number.isNaN(e.getTime())?"—":e.toLocaleDateString("en-US",{day:"numeric",month:"short",year:"numeric"})}function Q6r(t){const e=new Date(t);return Number.isNaN(e.getTime())?t:e.toLocaleString(void 0,{day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"2-digit",timeZoneName:"short"})}function Z6r({plan:t,groups:e,onDeactivate:n,onActivate:r,onSelect:s}){const o=die(t)>0?AN(t):"Free",l=t.memberCount??0,c=l===1?"1 member":`${l} members`,d=t.activationStatus==="activating",u=t.activationStatus==="deactivating",h=t.isDeleted&&!d&&!u;return a.jsxs("tr",{className:"hover:bg-muted/20 cursor-pointer",onClick:()=>s(t),children:[a.jsx("td",{className:"px-4 py-3 font-medium text-foreground",children:t.name??"Untitled plan"}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:o}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:Y6r(t.createdAt)}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:c}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"max-w-xs text-muted-foreground",children:[awe(t,e).length>0?awe(t,e).join(", "):hP(t).length>0?null:"No group linked",hP(t).length>0?a.jsxs("div",{className:"mt-0.5 text-xs",children:["Courses: ",hP(t).map(m=>m.title).join(", ")]}):null]})}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:`h-2 w-2 rounded-full ${d?"animate-pulse bg-blue-500":u?"animate-pulse bg-amber-500":h?"bg-amber-500":"bg-emerald-500"}`}),d?"Activating":u?"Deactivating":h?"Deactivated":"Activated"]})}),a.jsx("td",{className:"px-4 py-3 text-right",children:a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx("button",{type:"button",className:"inline-flex h-8 w-8 items-center justify-center rounded-md hover:bg-muted",onClick:m=>m.stopPropagation(),children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsx(Cr,{align:"end",children:d?a.jsxs(ot,{disabled:!0,children:[a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}),"Activation in progress"]}):u?a.jsxs(ot,{disabled:!0,children:[a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}),"Deactivation in progress"]}):h?a.jsx(ot,{onClick:m=>{m.stopPropagation(),r(t)},children:"Activate"}):a.jsx(ot,{className:"text-destructive focus:text-destructive",onClick:m=>{m.stopPropagation(),n(t)},children:"Deactivate"})})]})})]})}function J6r(){const{toast:t}=yt(),{groups:e}=Ln(),{isPaymentNotSet:n}=qM(),{plans:r,isLoading:s,refetch:i,deletePlan:o,isDeleting:l,activatePlan:c,isActivating:d}=PN(),[u,h]=y.useState(!1),[m,f]=y.useState(null),[p,g]=xc(),v=p.get("plan");y.useEffect(()=>{if(!v||s)return;const D=r.find(I=>I.id===v);D&&f(D)},[v,r,s]);const b=()=>{if(f(null),v){const D=new URLSearchParams(p);D.delete("plan"),g(D,{replace:!0})}},[x,w]=y.useState(null),[k,S]=y.useState(null),[C,j]=y.useState(null),[E,N]=y.useState(""),[A,_]=y.useState(""),T=y.useMemo(()=>e.map(D=>({id:D.id,name:D.name})),[e]),R=(D,I)=>D instanceof ze?Dt(D.body,D.message):I,O=async()=>{var D,I,P,M,z,G;if(x!=null&&x.id)try{const B=await o(x.id),H=((D=B.lifecycle)==null?void 0:D.status)==="deactivating";t({title:H?"Subscription deactivation started":"Subscription deactivated",description:H?`${((I=B.lifecycle)==null?void 0:I.pendingCancellations)??((P=B.lifecycle)==null?void 0:P.cancellationsQueued)??0} billing cancellation${(((M=B.lifecycle)==null?void 0:M.pendingCancellations)??((z=B.lifecycle)==null?void 0:z.cancellationsQueued))===1?"":"s"} still pending. The status will change to Deactivated when all cancellations finish.`:(G=B.lifecycle)!=null&&G.cancellationsQueued?`${B.lifecycle.cancellationsQueued} renewal cancellation${B.lifecycle.cancellationsQueued===1?"":"s"} completed. Current members keep access through their paid end date.`:"The plan is hidden. Current entitled members keep their access."}),w(null),N("")}catch(B){t({title:"Unable to deactivate subscription",description:R(B,"Something went wrong. Please try again."),variant:"destructive"})}},F=async()=>{var D;if(k!=null&&k.id)try{const I=await c(k.id);t({title:"Subscription activation started",description:((D=I.lifecycle)==null?void 0:D.status)==="activating"?"Membership cleanup is running in the background. The status will change to Activated when it finishes.":"The paid access flow is available again."}),S(null),_("")}catch(I){if(I instanceof ze&&I.body&&typeof I.body=="object"){const P=I.body;if(P.code==="SUBSCRIPTION_GROUP_DELETED"){t({title:"Subscription cannot be activated",description:R(I,"A linked group has been deleted."),variant:"destructive"}),S(null),_("");return}if(P.code==="SUBSCRIPTION_REACTIVATION_COOLDOWN"&&typeof P.reactivationAllowedAt=="string"){j({planName:k.name??"This subscription",allowedAt:P.reactivationAllowedAt}),S(null);return}}t({title:"Unable to activate subscription",description:R(I,"Something went wrong. Please try again."),variant:"destructive"})}};return a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Subscriptions"}),a.jsx("div",{className:"flex items-center gap-2",children:a.jsx("button",{type:"button",onClick:()=>void i(),disabled:s,className:"inline-flex h-9 w-9 items-center justify-center rounded-md border border-border hover:bg-muted disabled:opacity-50",children:s?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsx(Nl,{className:"h-4 w-4"})})})]}),a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-lg border border-border bg-card p-4",children:[a.jsx("div",{className:"text-sm text-foreground",children:n?a.jsxs(a.Fragment,{children:[a.jsx("p",{children:"Connect Stripe to take new membership payments."}),a.jsx("p",{className:"mt-1 text-muted-foreground",children:"Imported members keep access until their paid-through date. Add the SpatialChat Communities webhook in Stripe so renewals and cancellations work after you connect."})]}):a.jsx("p",{children:"Your Stripe account is connected. Manage its API key and webhook settings below."})}),a.jsx(Z,{variant:"outline",onClick:()=>h(!0),children:"Paywall settings"})]}),a.jsx("div",{className:"overflow-x-auto rounded-lg border border-border bg-card",children:a.jsxs("table",{className:"w-full min-w-[900px] text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-muted/30 text-xs uppercase text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Subscription title"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Amount"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created on"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Current users"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Group"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Status"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:s?a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"px-4 py-10 text-center text-muted-foreground",children:a.jsx(Ne,{className:"mx-auto h-5 w-5 animate-spin"})})}):r.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:7,className:"px-4 py-10 text-center text-sm text-muted-foreground",children:"No subscriptions found"})}):r.map(D=>a.jsx(Z6r,{plan:D,groups:T,onDeactivate:I=>{N(""),w(I)},onActivate:I=>{if(I.reactivationBlocked&&I.reactivationAllowedAt){j({planName:I.name??"This subscription",allowedAt:I.reactivationAllowedAt});return}_(""),S(I)},onSelect:f},D.id))})]})}),a.jsx(KM,{open:u,onOpenChange:h}),a.jsx(K6r,{plan:m,open:m!=null,onOpenChange:D=>!D&&b(),groups:T}),a.jsx(Kr,{open:x!=null,onOpenChange:D=>{D||(w(null),N(""))},children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Deactivate subscription?"}),a.jsx(zr,{asChild:!0,children:a.jsxs("div",{className:"space-y-3 text-sm text-muted-foreground",children:[a.jsxs("p",{children:["Are you sure you want to deactivate"," ",a.jsx("span",{className:"font-medium text-foreground",children:x==null?void 0:x.name}),"?"]}),a.jsx("p",{className:"rounded-md border border-border bg-muted/40 p-3 text-xs",children:"Current members remain enrolled through their paid end date. Future renewals are cancelled, and linked groups temporarily become request-to-join spaces."}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{htmlFor:"deactivate-subscription-confirmation",className:"text-sm text-foreground",children:["Type ",a.jsx("span",{className:"font-semibold",children:"DEACTIVATE"})," to confirm."]}),a.jsx(Oe,{id:"deactivate-subscription-confirmation",value:E,onChange:D=>N(D.target.value),placeholder:"DEACTIVATE",autoComplete:"off",disabled:l})]})]})})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:l,children:"Cancel"}),a.jsx(Yr,{disabled:l||E!=="DEACTIVATE",className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:D=>{D.preventDefault(),O()},children:l?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):"Yes, deactivate"})]})]})}),a.jsx(Kr,{open:k!=null,onOpenChange:D=>{D||(S(null),_(""))},children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Activate subscription?"}),a.jsx(zr,{asChild:!0,children:a.jsxs("div",{className:"space-y-3 text-sm text-muted-foreground",children:[a.jsxs("p",{children:["Activate ",a.jsx("span",{className:"font-medium text-foreground",children:k==null?void 0:k.name})," and restore its purchase flow?"]}),a.jsx("p",{className:"rounded-md border border-border bg-muted/40 p-3 text-xs",children:"Cleanup runs in background batches. This subscription will show as Activating until expired members and free access added while it was deactivated have been reconciled."}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{htmlFor:"activate-subscription-confirmation",className:"text-sm text-foreground",children:["Type ",a.jsx("span",{className:"font-semibold",children:"ACTIVATE"})," to confirm."]}),a.jsx(Oe,{id:"activate-subscription-confirmation",value:A,onChange:D=>_(D.target.value),placeholder:"ACTIVATE",autoComplete:"off",disabled:d})]})]})})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:d,children:"Cancel"}),a.jsx(Yr,{disabled:d||A!=="ACTIVATE",onClick:D=>{D.preventDefault(),F()},children:d?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):"Yes, activate"})]})]})}),a.jsx(Kr,{open:C!=null,onOpenChange:D=>!D&&j(null),children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Activation temporarily unavailable"}),a.jsxs(zr,{children:[C==null?void 0:C.planName," can be activated after the 48-hour cooldown, on"," ",a.jsx("span",{className:"font-medium text-foreground",children:C?Q6r(C.allowedAt):""}),"."]})]}),a.jsx(Br,{children:a.jsx(Yr,{onClick:()=>j(null),children:"Got it"})})]})})]})}const hIt=t=>`/community/${encodeURIComponent(t)}`;function mIt(t){const e=new URLSearchParams;for(const[r,s]of Object.entries(t))s!==void 0&&s!==""&&e.set(r,String(s));const n=e.toString();return n?`?${n}`:""}function fqe(t,e,n=1,r=25){return ae.get(`${hIt(t)}/sales${mIt({...e,page:n,limit:r})}`)}async function X6r(t,e){return(await ae.get(`${hIt(t)}/sales/summary${mIt(e)}`)).summary}const jq={active:"Active",cancelling:"Cancelling",payment_failed:"Payment failed",ended:"Ended"},pqe=[{id:"7d",label:"Last 7 days"},{id:"30d",label:"Last 30 days"},{id:"90d",label:"Last 90 days"},{id:"year",label:"This year"},{id:"all",label:"All time"}];function eFr(t,e=new Date){if(t==="all")return{};const n=new Date(e);t==="year"?n.setMonth(0,1):n.setDate(n.getDate()-{"7d":6,"30d":29,"90d":89}[t]),n.setHours(0,0,0,0);const r=new Date(e);return r.setHours(23,59,59,999),{from:n.toISOString(),to:r.toISOString()}}function fIt(t,e){const n=(e||"USD").toUpperCase();try{return new Intl.NumberFormat(n==="INR"?"en-IN":"en-US",{style:"currency",currency:n}).format(t/100)}catch{return`${n} ${(t/100).toFixed(2)}`}}function gqe(t){return t.length?t.map(e=>fIt(e.amountMinor,e.currency)).join(" + "):"—"}function tFr(t){return!t.isRecurring||!t.intervalMonths?"":t.intervalMonths===1?"/mo":t.intervalMonths===12?"/yr":` / ${t.intervalMonths} mo`}function Bue(t){if(!t)return"—";const e=new Date(t);return Number.isNaN(e.getTime())?"—":e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function M$(t){if(!t)return"";const e=new Date(t);if(Number.isNaN(e.getTime()))return"";const n=r=>String(r).padStart(2,"0");return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}`}function nFr(t){const e=s=>`"${String(s??"").replace(/"/g,'""')}"`,n=["Member","Email","Plan","Includes","Amount","Currency","Billing","Status","Started","Next renewal","Access ends","Invoice","Country"],r=t.map(s=>{var i;return[s.member.name,s.member.email,((i=s.plan)==null?void 0:i.name)??"",s.includes,(s.amountMinor/100).toFixed(2),s.currency,s.isRecurring?`every ${s.intervalMonths} month${s.intervalMonths===1?"":"s"}`:"one-time",jq[s.status]??s.status,M$(s.startedAt),M$(s.nextRenewalAt),M$(s.endsAt),s.invoiceNumber,s.country]});return[n,...r].map(s=>s.map(e).join(",")).join(`
`)}const vqe=25,RT="all",rFr={active:"border-emerald-500/30 bg-emerald-500/10 text-emerald-600",cancelling:"border-amber-500/30 bg-amber-500/10 text-amber-600",payment_failed:"border-destructive/30 bg-destructive/10 text-destructive",ended:"border-border bg-muted/40 text-muted-foreground"};function U3({label:t,value:e,hint:n}){return a.jsxs("div",{className:"rounded-lg border border-border bg-card p-4",children:[a.jsx("p",{className:"text-xs font-medium uppercase text-muted-foreground",children:t}),a.jsx("p",{className:"mt-1 text-xl font-semibold text-foreground [overflow-wrap:anywhere]",children:e}),n?a.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:n}):null]})}function sFr(){var T,R,O;const{toast:t}=yt(),{community:e}=qe(),n=(e==null?void 0:e.id)??"",{plans:r}=PN(),[s,i]=y.useState("30d"),[o,l]=y.useState(RT),[c,d]=y.useState(RT),[u,h]=y.useState(""),[m,f]=y.useState(""),[p,g]=y.useState(1),[v,b]=y.useState(!1);y.useEffect(()=>{const F=window.setTimeout(()=>f(u.trim()),300);return()=>window.clearTimeout(F)},[u]);const x=y.useMemo(()=>eFr(s),[s]),w=y.useMemo(()=>({...x,planId:o===RT?void 0:o,status:c===RT?void 0:c,search:m||void 0}),[x,o,c,m]);y.useEffect(()=>g(1),[w]);const k=y.useMemo(()=>r.filter(F=>(F.subscriptionAmount??0)>0),[r]),S=lt({queryKey:["sales-summary",n,x],queryFn:()=>X6r(n,x),enabled:!!n}),C=lt({queryKey:["sales",n,w,p],queryFn:()=>fqe(n,w,p,vqe),enabled:!!n,placeholderData:Uy}),j=S.data,E=((T=C.data)==null?void 0:T.sales)??[],N=((R=C.data)==null?void 0:R.total)??0,A=((O=pqe.find(F=>F.id===s))==null?void 0:O.label)??"",_=async()=>{if(n){b(!0);try{const F=await fqe(n,w,1,5e3),D=URL.createObjectURL(new Blob([nFr(F.sales)],{type:"text/csv;charset=utf-8"})),I=document.createElement("a");I.href=D,I.download=x.from?`sales-${M$(x.from)}-to-${M$(x.to)}.csv`:"sales-all-time.csv",I.click(),URL.revokeObjectURL(D),t({title:"Sales exported",description:`${F.sales.length} sale${F.sales.length===1?"":"s"} in the CSV.`})}catch(F){const D=F instanceof ze?Dt(F.body,F.message):"Something went wrong.";t({title:"Could not export sales",description:D,variant:"destructive"})}finally{b(!1)}}};return a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Sales"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Every paid purchase of your plans. Refunds are made in your Stripe dashboard."})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(zn,{value:s,onValueChange:F=>i(F),children:[a.jsx(On,{className:"w-40","aria-label":"Period",children:a.jsx(Vn,{})}),a.jsx(Fn,{children:pqe.map(F=>a.jsx(pt,{value:F.id,children:F.label},F.id))})]}),a.jsxs(Z,{variant:"outline",disabled:v||N===0,onClick:()=>void _(),children:[v?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(bc,{className:"mr-2 h-4 w-4"}),"Export CSV"]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3 md:grid-cols-3 xl:grid-cols-5",children:[a.jsx(U3,{label:"Revenue",value:j?gqe(j.revenue):"…",hint:j?`${A}${j.renewals?` · incl. ${j.renewals} renewal${j.renewals===1?"":"s"}`:""}`:void 0}),a.jsx(U3,{label:"New sales",value:j?String(j.newSales):"…",hint:A}),a.jsx(U3,{label:"MRR",value:j?gqe(j.mrr):"…",hint:"Monthly, from active subscriptions"}),a.jsx(U3,{label:"Paying members",value:j?String(j.activeMembers):"…",hint:"With an active paid plan"}),a.jsx(U3,{label:"Cancellations",value:j?String(j.cancellations):"…",hint:A})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs("div",{className:"relative min-w-56 flex-1",children:[a.jsx(hs,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Oe,{value:u,onChange:F=>h(F.target.value),placeholder:"Search by member name or email",className:"pl-9","aria-label":"Search sales"})]}),a.jsxs(zn,{value:o,onValueChange:l,children:[a.jsx(On,{className:"w-48","aria-label":"Plan",children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:RT,children:"All plans"}),k.map(F=>a.jsx(pt,{value:F.id,children:F.name},F.id))]})]}),a.jsxs(zn,{value:c,onValueChange:F=>d(F),children:[a.jsx(On,{className:"w-44","aria-label":"Status",children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:RT,children:"All statuses"}),Object.keys(jq).map(F=>a.jsx(pt,{value:F,children:jq[F]},F))]})]})]}),a.jsx("div",{className:"overflow-x-auto rounded-lg border border-border bg-card",children:a.jsxs("table",{className:"w-full min-w-[860px] text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-muted/30 text-xs uppercase text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Member"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Plan"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Amount"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Status"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Bought"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Next renewal"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:C.isLoading?a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"px-4 py-10 text-center text-muted-foreground",children:a.jsx(Ne,{className:"mx-auto h-5 w-5 animate-spin"})})}):C.isError?a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"px-4 py-10 text-center text-destructive",children:"Could not load sales."})}):E.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"px-4 py-10 text-center text-muted-foreground",children:"No sales match. Try another period, plan or status."})}):E.map(F=>a.jsxs("tr",{children:[a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("p",{className:"font-medium text-foreground",children:F.member.name}),F.member.email?a.jsx("p",{className:"text-xs text-muted-foreground",children:F.member.email}):null]}),a.jsxs("td",{className:"px-4 py-3",children:[F.plan?a.jsx(vr,{to:`${ve.communityMembers}?tab=subscriptions&plan=${encodeURIComponent(F.plan.id)}`,className:"font-medium text-foreground hover:underline",children:F.plan.name}):a.jsx("span",{className:"text-muted-foreground",children:"Deleted plan"}),F.includes?a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Includes: ",F.includes]}):null]}),a.jsxs("td",{className:"whitespace-nowrap px-4 py-3 text-foreground",children:[fIt(F.amountMinor,F.currency),a.jsx("span",{className:"text-muted-foreground",children:tFr(F)||" one-time"})]}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`inline-flex whitespace-nowrap rounded-full border px-2 py-0.5 text-xs font-medium ${rFr[F.status]}`,children:jq[F.status]??F.status})}),a.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-muted-foreground",children:Bue(F.startedAt)}),a.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-muted-foreground",children:F.nextRenewalAt?Bue(F.nextRenewalAt):F.endsAt?`Ends ${Bue(F.endsAt)}`:"—"})]},F.id))})]})}),a.jsx(mx,{page:p,totalPages:Math.max(1,Math.ceil(N/vqe)),total:N,countLabel:N===1?"sale":"sales",isLoading:C.isFetching,onPageChange:g})]})}const z3="everyone",yqe=10,bqe=50,xqe=120,wqe=20,kqe=240,iFr=["#FF9090","#1F8A4C","#7AB8C4","#D9277A","#7BC142","#7E3FF2","#E58A7B","#C4621F","#0D0D0D","#E8C547","#27B1E6","#0F1F66","#8A1FB0","#D67BB0","#3A4FB8","#A8B8E8","#C42B3F"],aFr=["#FFFFFF","#000000","#1F8A4C","#D9277A","#7E3FF2","#E58A7B"];function Sqe({open:t,onOpenChange:e,mode:n,topic:r,onSubmit:s,isSubmitting:i}){const[o,l]=y.useState(""),[c,d]=y.useState("#FF9090"),[u,h]=y.useState("#FFFFFF");y.useEffect(()=>{t&&(n==="edit"&&r?(l(r.name??""),d(r.bgColor??"#FF9090"),h(r.textColor??"#FFFFFF")):(l(""),d("#FF9090"),h("#FFFFFF")))},[t,n,r]);const m=async()=>{o.trim()&&(await s({name:o.trim(),bgColor:c,textColor:u}),e(!1))};return a.jsx(B0,{open:t,onOpenChange:e,children:a.jsxs(Xy,{className:"sm:max-w-xl w-full flex flex-col p-0",children:[a.jsx(eb,{className:"px-6 py-4 border-b border-border",children:a.jsx(tb,{children:n==="edit"?"Edit topic":"Create topic"})}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-6",children:[a.jsxs("div",{children:[a.jsxs("label",{className:"text-sm font-medium",children:["Topic name ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx("input",{value:o,onChange:f=>l(f.target.value),placeholder:"Enter topic name",className:"mt-2 w-full h-11 rounded-md border border-border bg-background px-3 text-sm"})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"text-sm font-medium",children:["Select topic colour ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsxs("div",{className:"mt-2 flex items-center gap-3 rounded-md border border-border px-3 py-2.5",children:[a.jsx("input",{type:"color",value:c,onChange:f=>d(f.target.value.toUpperCase()),className:"h-6 w-6 rounded cursor-pointer border-none p-0 bg-transparent"}),a.jsx("input",{value:c,onChange:f=>d(f.target.value.toUpperCase()),className:"flex-1 bg-transparent text-sm outline-none"})]}),a.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:iFr.map(f=>a.jsx("button",{type:"button",onClick:()=>d(f),style:{backgroundColor:f},className:"h-6 w-6 rounded-full border border-border"},f))})]}),a.jsxs("div",{children:[a.jsxs("label",{className:"text-sm font-medium",children:["Select text colour ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsxs("div",{className:"mt-2 flex items-center gap-3 rounded-md border border-border px-3 py-2.5",children:[a.jsx("input",{type:"color",value:u,onChange:f=>h(f.target.value.toUpperCase()),className:"h-6 w-6 rounded cursor-pointer border-none p-0 bg-transparent"}),a.jsx("input",{value:u,onChange:f=>h(f.target.value.toUpperCase()),className:"flex-1 bg-transparent text-sm outline-none"})]}),a.jsx("div",{className:"mt-2 flex flex-wrap gap-2",children:aFr.map(f=>a.jsx("button",{type:"button",onClick:()=>h(f),style:{backgroundColor:f},className:"h-6 w-6 rounded-full border border-border"},f))})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Preview"}),a.jsx("div",{className:"mt-2 rounded-md border border-border min-h-[80px] flex items-center justify-center px-4 py-4",children:o.trim()?a.jsx("span",{className:"inline-block px-5 py-2 rounded-full text-sm font-medium",style:{backgroundColor:c,color:u},children:o}):a.jsx("span",{className:"text-xs text-muted-foreground",children:"Enter a topic name to see a preview"})})]})]}),a.jsxs(_Re,{className:"px-6 py-4 border-t border-border flex !flex-row !justify-between",children:[a.jsx(Z,{variant:"outline",onClick:()=>e(!1),disabled:i,children:"Cancel"}),a.jsx(Z,{onClick:()=>void m(),disabled:!o.trim()||i,children:i?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):n==="edit"?"Save":"Create topic"})]})]})})}function oFr(){const{community:t}=qe(),e=t==null?void 0:t.id,n=rn(),r=lt({queryKey:["admin-community-topics",e],queryFn:()=>xse(e),enabled:!!e,staleTime:3e4,select:d=>d.topics??[]}),s=()=>{n.invalidateQueries({queryKey:["admin-community-topics",e]}),n.invalidateQueries({queryKey:["community-topics",e]})},i=jt({mutationFn:d=>vbr(e,d),onSuccess:s}),o=jt({mutationFn:({topicId:d,body:u})=>ybr(e,d,u),onSuccess:s}),l=jt({mutationFn:d=>bbr(e,d),onSuccess:s}),c=jt({mutationFn:d=>xbr(e,d),onSuccess:s});return{topics:r.data??[],isLoading:r.isLoading,refetch:r.refetch,createTopic:i.mutateAsync,isCreating:i.isPending,editTopic:o.mutateAsync,isEditing:o.isPending,archiveTopic:l.mutateAsync,isArchiving:l.isPending,deleteTopic:c.mutateAsync,isDeleting:c.isPending}}function eH(t,e){return t instanceof ze?Dt(t.body,t.message):e}function lFr(){const{toast:t}=yt(),{topics:e,isLoading:n,refetch:r,createTopic:s,isCreating:i,editTopic:o,isEditing:l,archiveTopic:c,deleteTopic:d,isDeleting:u,isArchiving:h}=oFr(),[m,f]=y.useState(!1),[p,g]=y.useState(null),[v,b]=y.useState(null),x=async C=>{try{await s(C),t({title:"Topic created"})}catch(j){throw t({title:"Could not create topic",description:eH(j,"Try again."),variant:"destructive"}),j}},w=async C=>{if(p!=null&&p.id)try{await o({topicId:p.id,body:C}),t({title:"Topic updated"}),g(null)}catch(j){throw t({title:"Could not update topic",description:eH(j,"Try again."),variant:"destructive"}),j}},k=async C=>{var j;try{const N=((j=(await c(C.id)).archivedTopic)==null?void 0:j.status)??C.status;t({title:N==="ARCHIVED"?"Topic archived":"Topic unarchived"})}catch(E){t({title:"Could not update topic",description:eH(E,"Try again."),variant:"destructive"})}},S=async()=>{if(v!=null&&v.id)try{await d(v.id),t({title:"Topic deleted"}),b(null)}catch(C){t({title:"Could not delete topic",description:eH(C,"Try again."),variant:"destructive"})}};return a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Community topics"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button",onClick:()=>void r(),disabled:n,className:"inline-flex h-9 w-9 items-center justify-center rounded-md border border-border hover:bg-muted disabled:opacity-50",children:n?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsx(Nl,{className:"h-4 w-4"})}),a.jsxs(Z,{onClick:()=>f(!0),children:[a.jsx(Dn,{className:"h-4 w-4"})," Create topic"]})]})]}),a.jsx("div",{className:"rounded-lg border border-border bg-card overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-muted/30 text-xs text-muted-foreground uppercase",children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Topic name"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created by"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Created on"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Posts"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Status"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium",children:"Actions"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:n?a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"px-4 py-10 text-center",children:a.jsx(Ne,{className:"mx-auto h-5 w-5 animate-spin text-muted-foreground"})})}):e.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"px-4 py-10 text-center text-muted-foreground",children:"No topics available"})}):e.map(C=>{var j;return a.jsxs("tr",{className:"hover:bg-muted/20",children:[a.jsx("td",{className:"px-4 py-4",children:a.jsx("span",{className:"inline-block px-4 py-1.5 rounded-full text-sm font-medium",style:{backgroundColor:C.bgColor??"#64748b",color:C.textColor??"#fff"},children:C.name})}),a.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:((j=C.createdBy)==null?void 0:j.name)??"—"}),a.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:C.createdAt??"—"}),a.jsx("td",{className:"px-4 py-4 text-muted-foreground",children:C.postCount??0}),a.jsx("td",{className:"px-4 py-4",children:a.jsx("span",{className:C.status==="ACTIVE"?"text-primary font-medium":"text-muted-foreground",children:C.status??"ACTIVE"})}),a.jsx("td",{className:"px-4 py-4 text-right",children:a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx("button",{type:"button",className:"inline-flex h-8 w-8 items-center justify-center rounded-md hover:bg-muted",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[a.jsxs(ot,{onClick:()=>g(C),children:[a.jsx(Qs,{className:"mr-2 h-4 w-4"})," Edit topic"]}),a.jsxs(ot,{disabled:h,onClick:()=>void k(C),children:[a.jsx(uSe,{className:"mr-2 h-4 w-4"}),C.status==="ACTIVE"?"Archive topic":"Unarchive topic"]}),a.jsx(mi,{}),a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>b(C),children:[a.jsx(qn,{className:"mr-2 h-4 w-4"})," Delete topic"]})]})]})})]},C.id)})})]})}),a.jsx(Sqe,{open:m,onOpenChange:f,mode:"create",onSubmit:x,isSubmitting:i}),a.jsx(Sqe,{open:p!=null,onOpenChange:C=>!C&&g(null),mode:"edit",topic:p,onSubmit:w,isSubmitting:l}),a.jsx(Kr,{open:v!=null,onOpenChange:C=>!C&&b(null),children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Delete topic?"}),a.jsxs(zr,{children:["Are you sure you want to delete ",a.jsx("span",{className:"font-medium",children:v==null?void 0:v.name}),"? This cannot be undone."]})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:u,children:"Cancel"}),a.jsx(Yr,{disabled:u,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:C=>{C.preventDefault(),S()},children:u?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):"Delete"})]})]})})]})}function cFr(t){return t!=null&&t.trim()?hte(vi.parse(t,{async:!1})):""}const pIt=t=>`/community/${encodeURIComponent(t)}`;function dFr(t,e){return ae.post(`${pIt(t)}/custom-push`,e)}function uFr(t,e={}){const n=new URLSearchParams;e.page!=null&&n.set("page",String(e.page)),e.limit!=null&&n.set("limit",String(e.limit));const r=n.toString();return ae.get(`${pIt(t)}/custom-push/log${r?`?${r}`:""}`)}function hFr(t,e=!0){var o,l,c,d;const{community:n}=qe(),r=n==null?void 0:n.id,s=lt({queryKey:["custom-push-log",r,t],queryFn:()=>uFr(r,{page:t,limit:yqe}),enabled:!!r&&e,staleTime:3e4}),i=Math.max(1,Math.ceil((((o=s.data)==null?void 0:o.total)??0)/yqe));return{entries:((l=s.data)==null?void 0:l.pushes)??[],page:((c=s.data)==null?void 0:c.page)??t,total:((d=s.data)==null?void 0:d.total)??0,totalPages:i,isLoading:s.isLoading,isError:s.isError,refetch:s.refetch}}function mFr(){const{community:t}=qe(),e=t==null?void 0:t.id,n=rn();return jt({mutationFn:r=>dFr(e,r),onSuccess:()=>{n.invalidateQueries({queryKey:["custom-push-log",e]})}})}function fFr(){const[t,e]=y.useState("list"),[n,r]=y.useState(1),[s,i]=y.useState(null),o=hFr(n,t==="list"),l=mFr();return{view:t,page:n,setPage:r,detailEntry:s,log:o,sendMutation:l,openSend:()=>{i(null),e("send")},openDetail:m=>{i(m),e("detail")},backToList:()=>{i(null),e("list")},afterSend:()=>{r(1),i(null),e("list"),o.refetch()}}}const Cqe={URL:"URL",GROUP:"Group",SECTION:"Channel"};function pFr(t,e,n){var r;return t.isCommunityWidePush||!((r=t.groupsPushedTo)!=null&&r.length)?e:n(t.groupsPushedTo[0])}function jqe({readOnly:t=!1,initial:e=null,sending:n,onBack:r,onSend:s}){var U,ne,te;const{groups:i,communityDetail:o}=Ln(),{community:l}=qe(),c=y.useMemo(()=>[{value:z3,label:"Everyone"},...i.map(re=>({value:re.id,label:re.name}))],[i]),d=e!=null&&e.isCommunityWidePush||!((U=e==null?void 0:e.groupsPushedTo)!=null&&U.length)?z3:e.groupsPushedTo[0]??z3,[u,h]=y.useState(d),[m,f]=y.useState((e==null?void 0:e.title)??""),[p,g]=y.useState((e==null?void 0:e.description)??""),[v,b]=y.useState((e==null?void 0:e.content)??""),[x,w]=y.useState((e==null?void 0:e.buttonName)??""),[k,S]=y.useState(()=>e!=null&&e.section?"SECTION":e!=null&&e.group?"GROUP":"URL"),[C,j]=y.useState((e==null?void 0:e.webURL)??""),[E,N]=y.useState((e==null?void 0:e.group)??""),[A,_]=y.useState((e==null?void 0:e.section)??"");y.useEffect(()=>{h(d),f((e==null?void 0:e.title)??""),g((e==null?void 0:e.description)??""),b((e==null?void 0:e.content)??""),w((e==null?void 0:e.buttonName)??""),S(e!=null&&e.section?"SECTION":e!=null&&e.group?"GROUP":"URL"),j((e==null?void 0:e.webURL)??""),N((e==null?void 0:e.group)??""),_((e==null?void 0:e.section)??"")},[e,d]);const T=i.find(re=>re.id===E),R=(T==null?void 0:T.tabs)??[],O=((ne=c.find(re=>re.value===u))==null?void 0:ne.label)??"Everyone",F=m.trim()?m.length>bqe?`Title must be ${bqe} characters or fewer.`:null:"Title is required.",D=p.length>xqe?`Description must be ${xqe} characters or fewer.`:null,I=x.length>wqe?`Button name must be ${wqe} characters or fewer.`:null,P=k==="URL"&&C.length>kqe?`URL must be ${kqe} characters or fewer.`:null,M=(k==="GROUP"||k==="SECTION")&&!E?"Select a group.":null,z=k==="SECTION"&&!A?"Select a channel.":null,G=!t&&!!m.trim()&&!F&&!D&&!I&&!P&&!M&&!z,B=()=>{if(!G||!s)return;const re={title:m.trim(),description:p.trim()||void 0,content:v.trim()||void 0,buttonName:x.trim()||void 0,isCommunityWidePush:u===z3,groupsPushedTo:u===z3?[]:[u]};k==="URL"&&C.trim()&&(re.webURL=C.trim()),k==="GROUP"&&E&&(re.group=E),k==="SECTION"&&E&&A&&(re.group=E,re.section=A),s(re,O)},H=m.trim()||"New notification",W=p.trim()||"Some random description justifying how this notification is important.",V=v.trim()?cFr(v):"<p>Rich text here</p>";return a.jsxs("div",{className:"space-y-5",children:[a.jsxs("button",{type:"button",onClick:r,className:"flex items-center gap-2 text-base font-semibold text-foreground hover:text-primary",children:[a.jsx(nl,{className:"h-5 w-5"}),t?"Notification details":"New custom push notification"]}),t?a.jsx("p",{className:"text-sm text-muted-foreground",children:"Previewing a sent notification."}):null,a.jsxs("div",{className:"grid grid-cols-1 gap-5 lg:grid-cols-2",children:[a.jsxs("div",{className:"space-y-5 rounded-lg border border-border bg-card p-6",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"To:"}),t?a.jsx("p",{className:"mt-2 text-sm",children:O}):a.jsxs(zn,{value:u,onValueChange:h,children:[a.jsx(On,{className:"mt-2 h-11",children:a.jsx(Vn,{})}),a.jsx(Fn,{className:"z-50 max-h-60 bg-popover",children:c.map(re=>a.jsx(pt,{value:re.value,children:re.label},re.value))})]})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Title"}),a.jsx("input",{value:m,onChange:re=>f(re.target.value),placeholder:"Enter notification title",readOnly:t,className:"mt-2 h-11 w-full rounded-md border border-border bg-background px-3 text-sm read-only:opacity-80"}),F&&!t?a.jsx("p",{className:"mt-1 text-xs text-destructive",children:F}):null]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Write description"}),a.jsx(us,{value:p,onChange:re=>g(re.target.value),placeholder:"Enter description here",rows:3,readOnly:t,className:"mt-2 resize-none read-only:opacity-80"}),D&&!t?a.jsx("p",{className:"mt-1 text-xs text-destructive",children:D}):null]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Write rich text content"}),a.jsx("div",{className:"mt-2",children:t?a.jsx(Du,{value:v,onChange:()=>{},readOnly:!0}):a.jsx(Du,{value:v,onChange:b,placeholder:"Write here…"})})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"Button title"}),a.jsx("input",{value:x,onChange:re=>w(re.target.value),placeholder:"Enter button title",readOnly:t,className:"mt-2 h-11 w-full rounded-md border border-border bg-background px-3 text-sm read-only:opacity-80"}),I&&!t?a.jsx("p",{className:"mt-1 text-xs text-destructive",children:I}):null]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium",children:"CTA type"}),t?a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:Cqe[k]}):a.jsx("div",{className:"mt-2 flex flex-wrap items-center gap-6",children:["URL","GROUP","SECTION"].map(re=>a.jsxs("label",{className:"flex items-center gap-2 cursor-pointer text-sm",children:[a.jsx("input",{type:"radio",checked:k===re,onChange:()=>{S(re),j(""),N(""),_("")},className:"accent-primary"}),Cqe[re]]},re))})]}),k==="URL"?a.jsxs("div",{children:[a.jsx("input",{value:C,onChange:re=>j(re.target.value),placeholder:"https://",readOnly:t,className:"h-11 w-full rounded-md border border-border bg-background px-3 text-sm read-only:opacity-80"}),P&&!t?a.jsx("p",{className:"mt-1 text-xs text-destructive",children:P}):null]}):null,k==="GROUP"||k==="SECTION"?a.jsxs("div",{className:ee("grid gap-3",k==="SECTION"?"grid-cols-2":"grid-cols-1"),children:[t?a.jsx("p",{className:"text-sm",children:(T==null?void 0:T.name)??(E||"—")}):a.jsxs(zn,{value:E||void 0,onValueChange:N,children:[a.jsx(On,{className:"h-11",children:a.jsx(Vn,{placeholder:"Select group"})}),a.jsx(Fn,{className:"z-50 max-h-60 bg-popover",children:i.map(re=>a.jsx(pt,{value:re.id,children:re.name},re.id))})]}),k==="SECTION"?t?a.jsx("p",{className:"text-sm",children:((te=R.find(re=>re.id===A))==null?void 0:te.name)??(A||"—")}):a.jsxs(zn,{value:A||void 0,onValueChange:_,disabled:!E,children:[a.jsx(On,{className:"h-11",children:a.jsx(Vn,{placeholder:"Select channel"})}),a.jsx(Fn,{className:"z-50 max-h-60 bg-popover",children:R.map(re=>a.jsx(pt,{value:re.id,children:re.name},re.id))})]}):null,M&&!t?a.jsx("p",{className:"text-xs text-destructive col-span-full",children:M}):null,z&&!t?a.jsx("p",{className:"text-xs text-destructive col-span-full",children:z}):null]}):null,t?null:a.jsxs("div",{className:"flex items-center justify-between pt-2",children:[a.jsx("button",{type:"button",onClick:r,className:"text-sm text-muted-foreground hover:text-foreground",children:"Cancel"}),a.jsx(Z,{disabled:!G||n,onClick:B,children:n?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):"Send"})]})]}),a.jsxs("div",{className:"space-y-5",children:[a.jsx("div",{className:"rounded-lg border border-border bg-card p-5",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"h-7 w-7 rounded-md bg-primary/10 flex items-center justify-center text-primary text-xs font-bold shrink-0",children:((l==null?void 0:l.name)??"C").slice(0,3).toUpperCase()}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("p",{className:"text-sm font-medium",children:(o==null?void 0:o.name)??(l==null?void 0:l.name)??"Community"}),a.jsx("span",{className:"text-xs text-muted-foreground",children:"Now"})]}),a.jsx("p",{className:"text-sm font-semibold mt-1",children:H}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:W})]})]})}),a.jsxs("div",{className:"rounded-lg border border-border bg-card p-5",children:[a.jsx("h3",{className:"text-lg font-semibold",children:H}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Now"}),a.jsx("div",{className:"text-sm text-foreground mt-3 prose prose-sm max-w-none",dangerouslySetInnerHTML:{__html:V}}),x.trim()&&(C.trim()||E)?a.jsx(Z,{className:"mt-4",size:"sm",children:x}):null]})]})]})]})}function gFr(){const{groups:t,communityDetail:e}=Ln(),n=fFr(),r=l=>{var c;return l?((c=t.find(d=>d.id===l))==null?void 0:c.name)??l:(e==null?void 0:e.name)??"Everyone"},s=async(l,c)=>{if(window.confirm(`Send push notification to ${c}?`))try{await n.sendMutation.mutateAsync(l),He.success("Notification triggered"),n.afterSend()}catch(u){const h=u instanceof ze?Dt(u.body,u.message):"Something went wrong";He.error(h)}};if(n.view==="send")return a.jsx(jqe,{sending:n.sendMutation.isPending,onBack:n.backToList,onSend:(l,c)=>void s(l,c)});if(n.view==="detail"&&n.detailEntry)return a.jsx(jqe,{readOnly:!0,initial:n.detailEntry,onBack:n.backToList});const{log:i}=n,o=(e==null?void 0:e.name)??"Community";return a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Custom push notification"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button",onClick:()=>void i.refetch(),disabled:i.isLoading,className:"inline-flex h-9 w-9 items-center justify-center rounded-md border border-border hover:bg-muted disabled:opacity-50","aria-label":"Refresh list",children:i.isLoading?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsx(Nl,{className:"h-4 w-4"})}),a.jsx("button",{type:"button",onClick:n.openSend,className:"inline-flex h-9 w-9 items-center justify-center rounded-md border border-border hover:bg-muted",title:"Send push",children:a.jsx(Lm,{className:"h-4 w-4"})})]})]}),a.jsxs("button",{type:"button",onClick:n.openSend,className:"w-full rounded-lg border border-border bg-primary/5 p-6 text-center transition-colors hover:bg-primary/10",children:[a.jsx("p",{className:"text-sm font-semibold text-primary",children:"Send push"}),a.jsx("p",{className:"mt-1 text-sm text-primary",children:"Send a custom push to all the members of the community or to selected groups."})]}),a.jsx("div",{className:"overflow-hidden rounded-lg border border-border bg-card",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border bg-muted/30 text-xs uppercase text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Date"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Subject"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"To"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium",children:"Recipients"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:i.isLoading?a.jsx("tr",{children:a.jsx("td",{colSpan:4,className:"px-4 py-10 text-center",children:a.jsx(Ne,{className:"mx-auto h-5 w-5 animate-spin text-muted-foreground"})})}):i.entries.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:4,className:"px-4 py-12 text-center text-muted-foreground",children:"No notifications sent yet"})}):i.entries.map(l=>a.jsxs("tr",{className:"cursor-pointer hover:bg-muted/20",onClick:()=>n.openDetail(l),children:[a.jsx("td",{className:"px-4 py-4 text-muted-foreground whitespace-nowrap",children:l.createdAt?yc(l.createdAt):"—"}),a.jsx("td",{className:"px-4 py-4 text-foreground",children:l.title??"—"}),a.jsx("td",{className:"px-4 py-4 text-foreground",children:pFr(l,o,r)}),a.jsx("td",{className:"px-4 py-4 text-foreground",children:l.totalUsersPushedTo&&l.totalUsersPushedTo>0?`${l.totalUsersPushedTo} user${l.totalUsersPushedTo===1?"":"s"}`:"—"})]},l.id))})]})}),a.jsx(mx,{page:n.page,totalPages:i.totalPages,total:i.total,countLabel:"notifications",isLoading:i.isLoading,onPageChange:n.setPage})]})}const iE=t=>encodeURIComponent(t),RN=t=>`/community/${iE(t)}/access-groups`;async function vFr(t){return(await ae.get(RN(t))).accessGroups??[]}async function yFr(t,e){return(await ae.post(RN(t),e)).accessGroup}async function bFr(t,e,n){return(await ae.put(`${RN(t)}/${iE(e)}`,n)).accessGroup}async function xFr(t,e){await ae.post(`${RN(t)}/${iE(e)}/delete`,{confirmation:"DELETE ACCESS GROUP"})}async function wFr(t,e){return(await ae.get(`${RN(t)}/${iE(e)}/grants`)).grants??[]}async function kFr(t,e,n,r){return(await ae.post(`${RN(t)}/${iE(e)}/grants`,{userId:n,confirmation:"GRANT ACCESS",expiry:r})).grant}async function SFr(t,e,n,r){return(await ae.post(`${RN(t)}/${iE(e)}/grants/${iE(n)}/revoke`,{confirmation:"REVOKE ACCESS",reason:r})).grant}function CFr(t){const{community:e}=qe(),n=e==null?void 0:e.id,r=rn(),s=["access-groups",n],i=["access-group-grants",n,t],o=lt({queryKey:s,queryFn:()=>vFr(n),enabled:!!n}),l=lt({queryKey:i,queryFn:()=>wFr(n,t),enabled:!!(n&&t)}),c=async()=>{await Promise.all([r.invalidateQueries({queryKey:s}),r.invalidateQueries({queryKey:["access-group-grants",n]}),r.invalidateQueries({queryKey:["member-subscriptions-admin",n]}),r.invalidateQueries({queryKey:["community-bootstrap",n]}),r.invalidateQueries({queryKey:["my-membership",n]}),r.invalidateQueries({queryKey:["member-subscription-plans",n]}),r.invalidateQueries({queryKey:["group-subscription-plans",n]})])},d=jt({mutationFn:p=>yFr(n,p),onSuccess:c}),u=jt({mutationFn:({id:p,input:g})=>bFr(n,p,g),onSuccess:c}),h=jt({mutationFn:p=>xFr(n,p),onSuccess:c}),m=jt({mutationFn:({accessGroupId:p,userId:g,expiry:v})=>kFr(n,p,g,v),onSuccess:c}),f=jt({mutationFn:({accessGroupId:p,grantId:g})=>SFr(n,p,g),onSuccess:c});return{accessGroups:o.data??[],grants:l.data??[],isLoading:o.isLoading,isGrantsLoading:l.isLoading,createAccessGroup:d.mutateAsync,updateAccessGroup:u.mutateAsync,deleteAccessGroup:h.mutateAsync,grantAccess:m.mutateAsync,revokeAccess:f.mutateAsync,isSaving:d.isPending||u.isPending,isDeleting:h.isPending,isGranting:m.isPending,isRevoking:f.isPending}}const jFr=[7,15,30],tH=365;function EFr(t,e){return t.includes(e)?t.filter(n=>n!==e):[...t,e]}function IT(t){return NFr(S9(t.subscriptionAmount,t.taxPercentage),t.currency)}function NFr(t=0,e="USD"){try{return new Intl.NumberFormat(void 0,{style:"currency",currency:e}).format(t/100)}catch{return`${e} ${(t/100).toFixed(2)}`}}function TFr(t){return String(t||"Member").split(/\s+/).map(e=>e[0]).join("").slice(0,2).toUpperCase()}function Eqe(t){const e=/^(\d{4})-(\d{2})-(\d{2})$/.exec(t);if(!e)return null;const n=new Date(Number(e[1]),Number(e[2])-1,Number(e[3]),23,59,59,999);return Number.isNaN(n.getTime())?null:n}function owe(t){if(!t)return null;const e=t instanceof Date?t:new Date(t);return Number.isNaN(e.getTime())?null:e.toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}function Nqe(t){return t.status!=="active"?!1:t.expiresAt?new Date(t.expiresAt).getTime()>Date.now():!0}function _Fr(t){if(!t.expiresAt)return"Permanent";const e=owe(t.expiresAt),n=new Date(t.expiresAt).getTime()-Date.now();if(n<=0)return e?`Expired ${e}`:"Expired";const r=Math.ceil(n/(24*60*60*1e3));return r<=7?`Expires in ${r} day${r===1?"":"s"}${e?` · ${e}`:""}`:e?`Expires ${e}`:"Timed pass"}function Tqe(t){const e=new Date;e.setDate(e.getDate()+t);const n=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),s=String(e.getDate()).padStart(2,"0");return`${n}-${r}-${s}`}function Dp(t){return(t==null?void 0:t.isRecurring)===!0}function nH(t){return t?Dp(t)?"subscription":"one-time":null}function _qe(t,e){return(t.accessibleGroups??[]).map(r=>{var s;return typeof r=="string"?((s=e.find(i=>i.id===r))==null?void 0:s.name)||"Group":r.name||"Group"}).filter(Boolean).join(", ")||"No groups"}function AFr(){const{community:t}=qe(),{groups:e}=Ln(),{plans:n}=PN(),{toast:r}=yt(),[s,i]=y.useState(null),{accessGroups:o,grants:l,isLoading:c,isGrantsLoading:d,createAccessGroup:u,updateAccessGroup:h,deleteAccessGroup:m,grantAccess:f,revokeAccess:p,isSaving:g,isDeleting:v,isGranting:b,isRevoking:x}=CFr(s),w=o.find(De=>De.id===s)??null,k=y.useMemo(()=>e.filter(De=>De.groupType==="closed-free"),[e]),S=y.useMemo(()=>n.filter(De=>De.isDeleted!==!0&&De.isActive!==!1&&(!De.activationStatus||De.activationStatus==="active")),[n]),C=y.useMemo(()=>S.filter(De=>Dp(De)),[S]),j=y.useMemo(()=>S.filter(De=>!Dp(De)),[S]),[E,N]=y.useState(!1),[A,_]=y.useState(null),[T,R]=y.useState(""),[O,F]=y.useState(""),[D,I]=y.useState([]),[P,M]=y.useState([]),[z,G]=y.useState(!1),[B,H]=y.useState([]),[W,V]=y.useState(""),[U,ne]=y.useState("permanent"),[te,re]=y.useState("7"),[fe,le]=y.useState("14"),[q,Y]=y.useState(""),[X,Q]=y.useState(null),[ie,he]=y.useState(""),[ye,J]=y.useState(!1),[K,ce]=y.useState("");y.useEffect(()=>{if(o.length===0){i(null);return}(!s||!o.some(De=>De.id===s))&&i(o[0].id)},[o,s]);const pe=(De,xt)=>De instanceof ze?Dt(De.body,De.message):xt,Ie=()=>{H([]),V(""),ne("permanent"),re("7"),le("14"),Y("")},Me=y.useMemo(()=>{if(U==="permanent")return null;if(te==="custom"&&q)return Eqe(q);const De=Number(te==="custom"?fe:te);return!Number.isInteger(De)||De<1||De>tH?null:new Date(Date.now()+De*24*60*60*1e3)},[q,fe,te,U]),we=()=>{if(U==="permanent")return{mode:"permanent"};if(te==="custom"&&q){const xt=Eqe(q);return!xt||xt.getTime()<=Date.now()?null:{mode:"expires",expiresAt:xt.toISOString()}}const De=Number(te==="custom"?fe:te);return!Number.isInteger(De)||De<1||De>tH?null:{mode:"expires",days:De}},Be=()=>{_(null),R(""),F(""),I([]),M([]),N(!0)},Ve=De=>{_(De),R(De.name),F(De.description||""),I(De.directGroups.filter(xt=>xt.groupType==="closed-free").map(xt=>xt.id)),M(De.subscriptionPlans.filter(xt=>xt.isActive&&!xt.isDeleted&&xt.activationStatus==="active").map(xt=>xt.id).slice(0,1)),N(!0)},be=async()=>{const De=A?A.subscriptionPlans.map(Xe=>Xe.id).slice(0,1):P;if(!T.trim()||D.length===0&&De.length===0)return;const xt={name:T.trim(),description:O.trim(),directGroupIds:D,subscriptionPlanIds:De};try{const Xe=A?await h({id:A.id,input:xt}):await u(xt);i(Xe.id),N(!1),r({title:A?"Access group updated":"Access group created",description:"People who already bought this subscription or one-time payment, and complimentary member passes, now follow this configuration."})}catch(Xe){r({title:"Could not save access group",description:pe(Xe,"Check the selected groups, subscriptions, and one-time payments."),variant:"destructive"})}},Ze=async()=>{const De=B[0],xt=we();if(!(!w||!De||W!=="GRANT ACCESS"||!xt))try{await f({accessGroupId:w.id,userId:De.id,expiry:xt}),G(!1),Ie(),r({title:"Member pass granted",description:xt.mode==="permanent"?`${De.name} now has this pass until you revoke it.`:`${De.name} now has this pass until ${owe(Me)||"the expiry date"}. After that they lose these groups.`})}catch(Xe){r({title:"Could not grant access",description:pe(Xe,"Try again."),variant:"destructive"})}},Pe=async()=>{if(!(!w||!X||ie!=="REVOKE ACCESS"))try{await p({accessGroupId:w.id,grantId:X}),Q(null),he(""),r({title:"Member pass revoked",description:"Access from this pass was removed; unrelated manual or paid access was preserved."})}catch(De){r({title:"Could not revoke access",description:pe(De,"Try again."),variant:"destructive"})}},Ke=async()=>{if(!(!w||K!=="DELETE ACCESS GROUP"))try{await m(w.id),J(!1),ce(""),r({title:"Access group deleted",description:"Its active member passes were safely revoked."})}catch(De){r({title:"Could not delete access group",description:pe(De,"Try again."),variant:"destructive"})}};return c?a.jsx("div",{className:"flex min-h-64 items-center justify-center",children:a.jsx(Ne,{className:"h-6 w-6 animate-spin"})}):a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-xl font-semibold text-foreground",children:"Access groups"}),a.jsx("p",{className:"mt-1 max-w-3xl text-sm text-muted-foreground",children:"Extend a recurring subscription or a one-time payment to member-only groups. People who already bought that product receive the whole bundle; admins can still grant it as a complimentary pass. Courses remain group-based."})]}),a.jsxs(Z,{onClick:Be,children:[a.jsx(Dn,{className:"h-4 w-4"})," Create access group"]})]}),a.jsxs("div",{className:"grid gap-5 xl:grid-cols-[320px_minmax(0,1fr)]",children:[a.jsx("div",{className:"space-y-2 rounded-xl border border-border bg-card p-3",children:o.length===0?a.jsxs("div",{className:"px-3 py-12 text-center",children:[a.jsx(pO,{className:"mx-auto h-8 w-8 text-muted-foreground"}),a.jsx("p",{className:"mt-3 text-sm font-medium",children:"No access groups yet"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Create a reusable pass for groups, subscriptions, or one-time payments."})]}):o.map(De=>a.jsxs("button",{type:"button",onClick:()=>i(De.id),className:ee("w-full rounded-lg border px-3 py-3 text-left transition-colors",s===De.id?"border-primary/40 bg-primary/5":"border-transparent hover:border-border hover:bg-muted/40"),children:[a.jsxs("div",{className:"flex items-start justify-between gap-2",children:[a.jsx("p",{className:"min-w-0 flex-1 break-words font-medium leading-snug text-foreground",children:De.name}),a.jsxs("span",{className:"shrink-0 whitespace-nowrap rounded-full bg-muted px-2 py-0.5 text-[11px] leading-none text-muted-foreground",children:[De.activeGrantCount," ",De.activeGrantCount===1?"member":"members"]})]}),a.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:[De.directGroups.length," member-only group",De.directGroups.length===1?"":"s",De.subscriptionPlans[0]?` · ${Dp(De.subscriptionPlans[0])?"subscription":"one-time payment"}`:" · no paid product"]})]},De.id))}),w?a.jsxs("div",{className:"space-y-5 rounded-xl border border-border bg-card p-5",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Sk,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"text-lg font-semibold",children:w.name})]}),w.description?a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:w.description}):null]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>Ve(w),children:[a.jsx(Qs,{className:"h-4 w-4"})," Edit access"]}),a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>J(!0),children:[a.jsx(qn,{className:"h-4 w-4"})," Delete"]})]})]}),a.jsxs("div",{className:"grid gap-4 lg:grid-cols-2",children:[a.jsxs("div",{className:"rounded-lg border border-border p-4 lg:col-span-2",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[a.jsx(wr,{className:"h-4 w-4"})," Member-only group access"]}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"These groups are unlocked while the linked subscription, one-time purchase, or complimentary pass is active."}),a.jsx("div",{className:"mt-3 flex flex-wrap gap-2",children:w.directGroups.length?w.directGroups.map(De=>a.jsx("span",{className:"rounded-full border border-border bg-muted/40 px-2.5 py-1 text-xs",children:De.name},De.id)):a.jsx("span",{className:"text-xs text-muted-foreground",children:"No direct groups"})})]}),a.jsxs("div",{className:"rounded-lg border border-border p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[a.jsx(Sh,{className:"h-4 w-4"})," Recurring subscription"]}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Active subscribers unlock this plan's paid groups plus the member-only groups above. This bills on a cycle."}),a.jsx("div",{className:"mt-3 space-y-2",children:w.subscriptionPlans.filter(De=>Dp(De)).length?w.subscriptionPlans.filter(De=>Dp(De)).map(De=>a.jsxs("div",{className:"rounded-md bg-muted/40 px-3 py-2 text-xs",children:[a.jsxs("div",{className:"flex justify-between gap-3",children:[a.jsx("span",{className:"font-medium",children:De.name}),a.jsx("span",{children:IT(De)})]}),a.jsxs("p",{className:"mt-1 text-muted-foreground",children:[Ax(De)," · Groups: ",De.accessibleGroups.map(xt=>xt.name).join(", ")||"None"]})]},De.id)):a.jsx("span",{className:"text-xs text-muted-foreground",children:"No recurring subscription"})})]}),a.jsxs("div",{className:"rounded-lg border border-border p-4",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-semibold",children:[a.jsx(lBt,{className:"h-4 w-4"})," One-time payment"]}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"A single purchase, not a subscription. Buyers keep the paid groups and the member-only groups above. Admin passes stay complimentary."}),a.jsx("div",{className:"mt-3 space-y-2",children:w.subscriptionPlans.filter(De=>!Dp(De)).length?w.subscriptionPlans.filter(De=>!Dp(De)).map(De=>a.jsxs("div",{className:"rounded-md bg-muted/40 px-3 py-2 text-xs",children:[a.jsxs("div",{className:"flex justify-between gap-3",children:[a.jsx("span",{className:"font-medium",children:De.name}),a.jsx("span",{children:IT(De)})]}),a.jsxs("p",{className:"mt-1 text-muted-foreground",children:["One-time · Groups: ",De.accessibleGroups.map(xt=>xt.name).join(", ")||"None"]})]},De.id)):a.jsx("span",{className:"text-xs text-muted-foreground",children:"No one-time payment"})})]})]}),a.jsxs("div",{className:"rounded-lg border border-border",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-border px-4 py-3",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold",children:"Member passes"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Granting a pass is separate from configuring what it contains. Timed passes remove group access when they expire."})]}),a.jsxs(Z,{size:"sm",onClick:()=>G(!0),children:[a.jsx(Sa,{className:"h-4 w-4"})," Grant member pass"]})]}),d?a.jsx("div",{className:"flex justify-center py-10",children:a.jsx(Ne,{className:"h-5 w-5 animate-spin"})}):l.filter(Nqe).length===0?a.jsx("p",{className:"px-4 py-10 text-center text-sm text-muted-foreground",children:"No members have this pass."}):a.jsx("div",{className:"divide-y divide-border",children:l.filter(Nqe).map(De=>a.jsxs("div",{className:"flex items-center gap-3 px-4 py-3",children:[De.user.picture?a.jsx("img",{src:De.user.picture,alt:"",className:"h-9 w-9 rounded-full object-cover"}):a.jsx("span",{className:"flex h-9 w-9 items-center justify-center rounded-full bg-primary/10 text-xs font-semibold text-primary",children:TFr(De.user.name)}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"truncate text-sm font-medium",children:De.user.name||"Member"}),a.jsx("p",{className:"truncate text-xs text-muted-foreground",children:De.user.email||""}),a.jsxs("p",{className:"mt-1 flex items-center gap-1 text-[11px] text-muted-foreground",children:[De.expiresAt?a.jsx(ja,{className:"h-3 w-3"}):a.jsx(BBt,{className:"h-3 w-3"}),_Fr(De)]})]}),a.jsxs(Z,{variant:"ghost",size:"sm",onClick:()=>Q(De.id),children:[a.jsx(O8,{className:"h-4 w-4"})," Revoke"]})]},De.id))})]})]}):null]}),a.jsx(Bt,{open:E,onOpenChange:N,children:a.jsxs(Ft,{className:"max-h-[90vh] max-w-2xl overflow-y-auto",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:A?"Edit access group":"Create access group"}),a.jsx(_n,{children:A?nH(A.subscriptionPlans[0])==="one-time"?"You can change the member-only groups. The original one-time payment stays locked so current buyers are added to new groups and removed from groups you take off this access group.":nH(A.subscriptionPlans[0])==="subscription"?"You can change the member-only groups. The original subscription stays locked so current subscribers are added to new groups and removed from groups you take off this access group.":"You can change the member-only groups in this access group.":"Link member-only groups to one recurring subscription or one one-time payment — not both. Existing buyers are reconciled after saving; complimentary passes can be granted separately."})]}),a.jsxs("div",{className:"space-y-5 py-2",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"access-group-name",children:"Name"}),a.jsx(Oe,{id:"access-group-name",value:T,onChange:De=>R(De.target.value),placeholder:"Premium onboarding access",maxLength:80})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"access-group-description",children:"Description"}),a.jsx(us,{id:"access-group-description",value:O,onChange:De=>F(De.target.value),placeholder:"Explain when admins should grant this pass",maxLength:500})]}),a.jsxs("div",{className:"rounded-lg border border-border p-4",children:[a.jsx("h3",{className:"text-sm font-semibold",children:"1. Direct group access"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Only member-only groups appear here. Open/free groups remain freely joinable, and paid groups stay attached to their subscription."}),a.jsx("div",{className:"mt-3 max-h-48 space-y-1 overflow-y-auto",children:k.length===0?a.jsx("p",{className:"py-3 text-xs text-muted-foreground",children:"No eligible groups."}):k.map(De=>a.jsxs("label",{className:"flex cursor-pointer items-center justify-between gap-3 rounded-md px-2 py-2 hover:bg-muted/40",children:[a.jsxs("span",{className:"flex items-center gap-3",children:[a.jsx(ji,{checked:D.includes(De.id),onCheckedChange:()=>I(xt=>EFr(xt,De.id))}),a.jsx("span",{className:"text-sm",children:De.name})]}),a.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Member only"})]},De.id))})]}),a.jsxs("div",{className:"rounded-lg border border-border p-4",children:[a.jsx("h3",{className:"text-sm font-semibold",children:"2. Recurring subscription"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:A?nH(A.subscriptionPlans[0])==="subscription"?"This subscription was set when the access group was created and cannot be changed.":"This access group is not linked to a recurring subscription.":"Optional. Select one subscription. Active subscribers receive its paid groups plus the member-only groups above. Choosing a subscription clears a one-time payment."}),a.jsx("div",{className:"mt-3 max-h-56 space-y-2 overflow-y-auto",children:A?Dp(A.subscriptionPlans[0])?a.jsxs("div",{className:"rounded-md border border-border bg-muted/40 px-3 py-3",children:[a.jsxs("div",{className:"flex justify-between gap-3 text-sm font-medium",children:[a.jsx("span",{children:A.subscriptionPlans[0].name||"Subscription"}),a.jsx("span",{children:IT(A.subscriptionPlans[0])})]}),a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:[Ax(A.subscriptionPlans[0])," · Unlocks: ",A.subscriptionPlans[0].accessibleGroups.map(De=>De.name).join(", ")||"No groups"]})]}):a.jsx("p",{className:"py-3 text-xs text-muted-foreground",children:"This access group is not linked to a recurring subscription."}):C.length===0?a.jsx("p",{className:"py-3 text-xs text-muted-foreground",children:"No active recurring subscriptions."}):C.map(De=>a.jsxs("label",{className:"flex cursor-pointer items-start gap-3 rounded-md border border-border px-3 py-3 hover:bg-muted/40",children:[a.jsx(ji,{className:"mt-0.5",checked:P[0]===De.id,onCheckedChange:()=>M(xt=>xt[0]===De.id?[]:[De.id])}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"flex justify-between gap-3 text-sm font-medium",children:[a.jsx("span",{children:De.name||"Subscription"}),a.jsx("span",{children:IT(De)})]}),a.jsxs("span",{className:"mt-1 block text-xs text-muted-foreground",children:[Ax(De)," · Unlocks: ",_qe(De,e)]})]})]},De.id))})]}),a.jsxs("div",{className:"rounded-lg border border-border p-4",children:[a.jsx("h3",{className:"text-sm font-semibold",children:"3. One-time payment"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:A?nH(A.subscriptionPlans[0])==="one-time"?"This one-time payment was set when the access group was created and cannot be changed.":"This access group is not linked to a one-time payment.":"Optional. Select one one-time purchase. Buyers pay once — there is no recurring bill — and receive its paid groups plus the member-only groups above. Choosing this clears a subscription."}),a.jsx("div",{className:"mt-3 max-h-56 space-y-2 overflow-y-auto",children:A?!Dp(A.subscriptionPlans[0])&&A.subscriptionPlans[0]?a.jsxs("div",{className:"rounded-md border border-border bg-muted/40 px-3 py-3",children:[a.jsxs("div",{className:"flex justify-between gap-3 text-sm font-medium",children:[a.jsx("span",{children:A.subscriptionPlans[0].name||"One-time payment"}),a.jsx("span",{children:IT(A.subscriptionPlans[0])})]}),a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["One-time · Unlocks: ",A.subscriptionPlans[0].accessibleGroups.map(De=>De.name).join(", ")||"No groups"]})]}):a.jsx("p",{className:"py-3 text-xs text-muted-foreground",children:"This access group is not linked to a one-time payment."}):j.length===0?a.jsx("p",{className:"py-3 text-xs text-muted-foreground",children:"No active one-time payments."}):j.map(De=>a.jsxs("label",{className:"flex cursor-pointer items-start gap-3 rounded-md border border-border px-3 py-3 hover:bg-muted/40",children:[a.jsx(ji,{className:"mt-0.5",checked:P[0]===De.id,onCheckedChange:()=>M(xt=>xt[0]===De.id?[]:[De.id])}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsxs("span",{className:"flex justify-between gap-3 text-sm font-medium",children:[a.jsx("span",{children:De.name||"One-time payment"}),a.jsx("span",{children:IT(De)})]}),a.jsxs("span",{className:"mt-1 block text-xs text-muted-foreground",children:["One-time · Unlocks: ",_qe(De,e)]})]})]},De.id))})]})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"outline",onClick:()=>N(!1),disabled:g,children:"Cancel"}),a.jsxs(Z,{onClick:()=>void be(),disabled:g||!T.trim()||D.length===0&&(A?A.subscriptionPlans.length===0:P.length===0),children:[g?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):null," Save access group"]})]})]})}),a.jsx(Bt,{open:z,onOpenChange:De=>{G(De),De||Ie()},children:a.jsxs(Ft,{className:"max-h-[90vh] max-w-xl overflow-y-auto",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Grant member pass"}),a.jsx(_n,{children:"This joins the configured groups without charging the member. Choose whether access lasts until you revoke it, or until a set expiry."})]}),a.jsxs("div",{className:"space-y-4",children:[t!=null&&t.id?a.jsx(ARe,{communityId:t.id,selected:B,onChange:De=>H(De.length?[De[De.length-1]]:[])}):null,a.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-3 text-xs text-muted-foreground",children:[a.jsx("p",{className:"font-medium text-foreground",children:"This pass grants:"}),a.jsxs("p",{className:"mt-1",children:["Direct groups: ",(w==null?void 0:w.directGroups.map(De=>De.name).join(", "))||"None"]}),w!=null&&w.subscriptionPlans[0]?a.jsxs("p",{className:"mt-1",children:[Dp(w.subscriptionPlans[0])?"Subscription":"One-time payment",": ",w.subscriptionPlans[0].name]}):a.jsx("p",{className:"mt-1",children:"Paid product: None"})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsx(_e,{children:"Pass length"}),a.jsxs(TS,{value:U,onValueChange:De=>ne(De),className:"grid gap-2",children:[a.jsxs("label",{htmlFor:"grant-pass-permanent",className:ee("cursor-pointer rounded-lg border p-3",U==="permanent"?"border-primary bg-primary/5":"border-border"),children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ly,{value:"permanent",id:"grant-pass-permanent"}),a.jsx("span",{className:"text-sm font-medium",children:"Permanent"})]}),a.jsx("p",{className:"mt-1 pl-6 text-xs text-muted-foreground",children:"Access stays until an admin revokes this pass."})]}),a.jsxs("label",{htmlFor:"grant-pass-expires",className:ee("cursor-pointer rounded-lg border p-3",U==="expires"?"border-primary bg-primary/5":"border-border"),children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ly,{value:"expires",id:"grant-pass-expires"}),a.jsx("span",{className:"text-sm font-medium",children:"Expires"})]}),a.jsx("p",{className:"mt-1 pl-6 text-xs text-muted-foreground",children:"When the date is reached, the member loses these groups."})]})]}),U==="expires"?a.jsxs("div",{className:"space-y-3 rounded-lg border border-border p-3",children:[a.jsxs("div",{className:"flex flex-wrap gap-2",children:[jFr.map(De=>a.jsxs(Z,{type:"button",size:"sm",variant:te===String(De)?"default":"outline",onClick:()=>{re(String(De)),Y("")},children:[De," days"]},De)),a.jsx(Z,{type:"button",size:"sm",variant:te==="custom"?"default":"outline",onClick:()=>re("custom"),children:"Custom"})]}),te==="custom"?a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"grant-custom-days",children:"Number of days"}),a.jsx(Oe,{id:"grant-custom-days",type:"number",min:1,max:tH,value:fe,onChange:De=>{le(De.target.value),Y("")},placeholder:"14"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"grant-custom-date",children:"Or end date"}),a.jsx(Oe,{id:"grant-custom-date",type:"date",min:Tqe(0),max:Tqe(tH),value:q,onChange:De=>Y(De.target.value)})]})]}):null,a.jsx("p",{className:"text-xs text-muted-foreground",children:Me?`Access ends on ${owe(Me)}. After that this member loses the groups in this pass.`:"Choose 7, 15 or 30 days, or enter a custom length up to 365 days."})]}):null]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(_e,{htmlFor:"grant-access-confirmation",children:["Type ",a.jsx("span",{className:"font-semibold",children:"GRANT ACCESS"})," to confirm"]}),a.jsx(Oe,{id:"grant-access-confirmation",value:W,onChange:De=>V(De.target.value),placeholder:"GRANT ACCESS"})]})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"outline",onClick:()=>G(!1),disabled:b,children:"Cancel"}),a.jsxs(Z,{onClick:()=>void Ze(),disabled:b||B.length!==1||W!=="GRANT ACCESS"||!we(),children:[b?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsx(Sa,{className:"h-4 w-4"})," Grant member pass"]})]})]})}),a.jsx(Kr,{open:X!=null,onOpenChange:De=>{De||(Q(null),he(""))},children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Revoke member pass?"}),a.jsx(zr,{asChild:!0,children:a.jsxs("div",{className:"space-y-3 text-sm text-muted-foreground",children:[a.jsx("p",{children:"Only access supplied by this pass will be removed. Existing manual membership and other paid subscriptions are preserved."}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(_e,{htmlFor:"revoke-access-confirmation",children:["Type ",a.jsx("span",{className:"font-semibold text-foreground",children:"REVOKE ACCESS"})," to confirm"]}),a.jsx(Oe,{id:"revoke-access-confirmation",value:ie,onChange:De=>he(De.target.value),placeholder:"REVOKE ACCESS"})]})]})})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:x,children:"Cancel"}),a.jsx(Yr,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:x||ie!=="REVOKE ACCESS",onClick:De=>{De.preventDefault(),Pe()},children:x?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):"Revoke pass"})]})]})}),a.jsx(Kr,{open:ye,onOpenChange:De=>{J(De),De||ce("")},children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Delete access group?"}),a.jsx(zr,{asChild:!0,children:a.jsxs("div",{className:"space-y-3 text-sm text-muted-foreground",children:[a.jsx("p",{children:"All active member passes in this access group will be revoked first."}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(_e,{htmlFor:"delete-access-group-confirmation",children:["Type ",a.jsx("span",{className:"font-semibold text-foreground",children:"DELETE ACCESS GROUP"})," to confirm"]}),a.jsx(Oe,{id:"delete-access-group-confirmation",value:K,onChange:De=>ce(De.target.value),placeholder:"DELETE ACCESS GROUP"})]})]})})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:v,children:"Cancel"}),a.jsx(Yr,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:v||K!=="DELETE ACCESS GROUP",onClick:De=>{De.preventDefault(),Ke()},children:v?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):"Delete access group"})]})]})})]})}const Eq=[{id:"members",label:"Members",icon:wr,adminOnly:!1,hidden:!0},{id:"leaderboard",label:"Leaderboard",icon:Hg,adminOnly:!1,hidden:!0},{id:"invite",label:"Invite",icon:Sa,adminOnly:!0},{id:"bulkmail",label:"Send Bulk Mail",icon:Ii,adminOnly:!0,hidden:!0},{id:"subscriptions",label:"Subscriptions",icon:Sh,adminOnly:!0},{id:"sales",label:"Sales",icon:nfe,adminOnly:!0},{id:"access-groups",label:"Access Groups",icon:pO,adminOnly:!0},{id:"topics",label:"Community Topics",icon:nI,adminOnly:!0},{id:"push",label:"Custom Push Notification",icon:Lm,adminOnly:!0}];function Aqe(t){return Eq.some(e=>e.id===t)}function PFr(){var p;const{communityDetail:t}=Ln(),[e,n]=xc(),{isCommunityAdmin:r,isAdminView:s}=Zy(),i=ql(t,"isMemberDirectoryDisabled")&&!r,o=e.get("tab"),l=((p=Eq.find(g=>!("hidden"in g&&g.hidden)&&(!g.adminOnly||s)))==null?void 0:p.id)??"members",[c,d]=y.useState(Aqe(o)?o:l),u=Nn(),h=y.useMemo(()=>Eq.filter(g=>!("hidden"in g&&g.hidden)&&(!g.adminOnly||s)),[s]);y.useEffect(()=>{Aqe(o)&&o!==c&&d(o)},[o,c]),y.useEffect(()=>{const g=Eq.find(v=>v.id===c);g!=null&&g.adminOnly&&!s&&(d(l),n(l==="members"?{}:{tab:l},{replace:!0}))},[c,s,l,n]);const m=g=>{d(g),n(g===l?{}:{tab:g},{replace:!0})},f=()=>{const g=v=>a.jsx(yA,{children:v});switch(c){case"members":return a.jsx(I5t,{});case"leaderboard":return a.jsx(z5t,{});case"invite":return g(a.jsx(g6r,{}));case"bulkmail":return g(a.jsx(E6r,{}));case"subscriptions":return g(a.jsx(J6r,{}));case"sales":return g(a.jsx(sFr,{}));case"access-groups":return g(a.jsx(AFr,{}));case"topics":return g(a.jsx(lFr,{}));case"push":return g(a.jsx(gFr,{}));default:return null}};return i?a.jsx(Gs,{to:ve.dashboard,replace:!0}):a.jsxs(it.div,{initial:{opacity:0},animate:{opacity:1},className:"flex flex-col gap-4 lg:flex-row lg:gap-6 min-h-[calc(100vh-120px)]",children:[a.jsxs("div",{className:"space-y-3 lg:hidden",children:[a.jsxs("button",{type:"button",onClick:()=>u(ve.dashboard),className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground",children:[a.jsx(nl,{className:"h-4 w-4"})," Go back to community"]}),a.jsxs(zn,{value:c,onValueChange:g=>m(g),children:[a.jsx(On,{"aria-label":"Manage members section",className:"h-11 w-full",children:a.jsx(Vn,{placeholder:"Choose a section"})}),a.jsx(Fn,{children:h.map(g=>{const v=g.icon;return a.jsx(pt,{value:g.id,children:a.jsxs("span",{className:"flex items-center gap-2.5",children:[a.jsx(v,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),g.label]})},g.id)})})]})]}),a.jsxs("aside",{className:"hidden w-60 shrink-0 space-y-1 lg:block",children:[a.jsxs("button",{type:"button",onClick:()=>u(ve.dashboard),className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground mb-4 px-3",children:[a.jsx(nl,{className:"h-4 w-4"})," Go back to community"]}),a.jsx("h2",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wider px-3 mb-3",children:"Manage members"}),h.map(g=>{const v=g.icon,b=c===g.id;return a.jsxs("button",{type:"button",onClick:()=>m(g.id),className:ee("flex items-center gap-3 w-full rounded-lg px-3 py-2.5 text-sm transition-colors text-left",b?"bg-primary/10 text-primary font-medium":"text-muted-foreground hover:text-foreground hover:bg-muted/50"),children:[a.jsx(v,{className:"h-4 w-4 shrink-0"}),g.label]},g.id)})]}),a.jsx("div",{className:"flex-1 min-w-0",children:f()})]})}const RFr={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.04}}},rH={hidden:{opacity:0,y:8},show:{opacity:1,y:0}},IFr=[{question:"What feature would you like to see next?",responses:156,event:"Product Launch Webinar",options:[{label:"AI Networking",pct:40,votes:62},{label:"Mobile App",pct:35,votes:54},{label:"Advanced Analytics",pct:25,votes:40}]},{question:"How would you rate this session?",responses:89,event:"Q1 Team All-Hands",options:[{label:"Excellent",pct:58,votes:52},{label:"Good",pct:31,votes:28},{label:"Average",pct:10,votes:9}]}],MFr=[{q:"How does the new pricing model work?",votes:24,status:"Answered",author:"Sarah Johnson",time:"5 min ago",event:"Product Launch Webinar",answer:"Great question! The new pricing is based on active users per month..."},{q:"Will there be API documentation available?",votes:18,status:"Pending",author:"Michael Chen",time:"8 min ago",event:"Product Launch Webinar",answer:void 0},{q:"What are the system requirements?",votes:12,status:"Answered",author:"Emily Rodriguez",time:"15 min ago",event:"Customer Success Summit",answer:"The platform works on all modern browsers..."}];function LFr(){var j,E;const{toast:t}=yt(),[e,n]=y.useState(IFr),[r,s]=y.useState(MFr),[i,o]=y.useState(!1),[l,c]=y.useState(""),[d,u]=y.useState(["","",""]),[h,m]=y.useState(null),[f,p]=y.useState(""),[g,v]=y.useState(null),[b,x]=y.useState(!1),w=()=>{if(!l.trim()){t({title:"Question required",variant:"destructive"});return}const N=d.filter(A=>A.trim());if(N.length<2){t({title:"At least 2 options are required",variant:"destructive"});return}n([{question:l,responses:0,event:"Current Event",options:N.map(A=>({label:A,pct:0,votes:0}))},...e]),t({title:"Poll created",description:`"${l}" is now live.`}),c(""),u(["","",""]),o(!1)},k=()=>{if(h===null||!f.trim())return;const N=[...r];N[h]={...N[h],status:"Answered",answer:f},s(N),t({title:"Answer submitted",description:"Your answer has been posted."}),p(""),m(null)},S=N=>{const A=[...r];A[N]={...A[N],votes:A[N].votes+1},s(A)},C=[{icon:Vi,value:String(e.length),label:"Active polls",color:"text-primary"},{icon:CBt,value:String(r.length),label:"Q&A questions",color:"text-emerald-600"},{icon:Vi,value:"3",label:"Chat messages",color:"text-amber-600"},{icon:iee,value:"78%",label:"Avg. engagement",color:"text-primary"}];return a.jsxs(it.div,{variants:RFr,initial:"hidden",animate:"show",className:"space-y-6",children:[a.jsxs(it.div,{variants:rH,className:"flex items-center gap-3",children:[a.jsxs("button",{onClick:()=>x(!0),className:"inline-flex items-center gap-1.5 rounded-md border border-border px-3 py-1.5 text-xs font-medium text-primary hover:bg-muted transition-colors",children:[a.jsx(I8,{className:"h-3.5 w-3.5"})," View history"]}),a.jsxs("button",{onClick:()=>o(!0),className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-4 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:[a.jsx(Dn,{className:"h-3.5 w-3.5"})," Create poll"]})]}),a.jsx(it.div,{variants:rH,className:"grid grid-cols-4 gap-4",children:C.map(N=>a.jsx("div",{className:"rounded-lg border border-border bg-card p-5 shadow-sm",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(N.icon,{className:ee("h-6 w-6",N.color)}),a.jsxs("div",{children:[a.jsx("p",{className:"text-3xl font-bold text-foreground",children:N.value}),a.jsx("p",{className:"text-xs text-muted-foreground",children:N.label})]})]})},N.label))}),a.jsxs("div",{className:"grid grid-cols-3 gap-6",children:[a.jsxs("div",{className:"col-span-2 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Active polls"}),a.jsx("button",{onClick:()=>t({title:"All polls",description:`${e.length} total polls available.`}),className:"text-sm text-muted-foreground hover:text-foreground",children:"View all"})]}),e.map((N,A)=>a.jsxs(it.div,{variants:rH,className:"rounded-lg border border-border bg-card p-5 shadow-sm",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:N.question}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[N.responses," responses"]})]}),a.jsx("div",{className:"space-y-3",children:N.options.map(_=>a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between mb-1",children:[a.jsx("span",{className:"text-sm font-medium text-foreground",children:_.label}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[_.pct,"%"]})]}),a.jsx("div",{className:"w-full h-2 rounded-full bg-muted overflow-hidden mb-1",children:a.jsx("div",{className:"h-full rounded-full bg-primary",style:{width:`${_.pct}%`}})}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[_.votes," votes"]})]},_.label))}),a.jsxs("div",{className:"flex items-center justify-between mt-4 pt-3 border-t border-border",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:N.event}),a.jsx("button",{onClick:()=>v(A),className:"text-xs text-primary hover:underline",children:"View details"})]})]},N.question))]}),a.jsxs(it.div,{variants:rH,className:"rounded-lg border border-border bg-card p-5 shadow-sm",children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground mb-4",children:"Q&A questions"}),a.jsx("div",{className:"space-y-4",children:r.map((N,A)=>a.jsx("div",{className:"space-y-2",children:a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("div",{className:"flex flex-col items-center gap-1",children:[a.jsx("button",{onClick:()=>S(A),className:"hover:text-primary transition-colors",children:a.jsx(M8,{className:"h-4 w-4 text-muted-foreground hover:text-primary"})}),a.jsx("span",{className:"text-sm font-semibold text-foreground",children:N.votes})]}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h4",{className:"text-sm font-semibold text-foreground",children:N.q}),a.jsx("span",{className:ee("text-xs font-medium",N.status==="Answered"?"text-emerald-600":"text-destructive"),children:N.status==="Answered"?"✓ Answered":"Pending"})]}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Asked by ",N.author," • ",N.time," • ",N.event]}),N.answer&&a.jsx("div",{className:"mt-2 pl-3 border-l-2 border-emerald-500/30",children:a.jsxs("p",{className:"text-xs text-muted-foreground",children:[a.jsx("span",{className:"font-medium text-foreground",children:"Answer:"})," ",N.answer]})}),N.status==="Pending"&&a.jsx("button",{onClick:()=>{m(A),p("")},className:"mt-2 inline-flex items-center rounded-md bg-primary px-3 py-1 text-xs font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:"Answer question"})]})]})},N.q))})]})]}),a.jsx(Bt,{open:i,onOpenChange:o,children:a.jsxs(Ft,{className:"sm:max-w-md",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Create poll"}),a.jsx(_n,{children:"Create a new poll for your event attendees."})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Question"}),a.jsx("input",{type:"text",value:l,onChange:N=>c(N.target.value),placeholder:"What would you like to ask?",className:"mt-1 w-full h-10 rounded-md border border-input bg-background px-3 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/30"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Options"}),d.map((N,A)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"text",value:N,onChange:_=>{const T=[...d];T[A]=_.target.value,u(T)},placeholder:`Option ${A+1}`,className:"flex-1 h-10 rounded-md border border-input bg-background px-3 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/30"}),d.length>2&&a.jsx("button",{onClick:()=>u(d.filter((_,T)=>T!==A)),className:"text-muted-foreground hover:text-destructive",children:a.jsx(nn,{className:"h-4 w-4"})})]},A)),d.length<5&&a.jsx("button",{onClick:()=>u([...d,""]),className:"text-xs text-primary hover:underline",children:"+ Add option"})]}),a.jsxs("div",{className:"flex gap-3 pt-2",children:[a.jsx("button",{onClick:()=>o(!1),className:"flex-1 rounded-md border border-border px-4 py-2 text-sm hover:bg-muted transition-colors",children:"Cancel"}),a.jsx("button",{onClick:w,className:"flex-1 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors",children:"Create poll"})]})]})]})}),a.jsx(Bt,{open:h!==null,onOpenChange:()=>m(null),children:a.jsxs(Ft,{className:"sm:max-w-md",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Answer question"}),a.jsx(_n,{children:h!==null?(j=r[h])==null?void 0:j.q:""})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("textarea",{value:f,onChange:N=>p(N.target.value),placeholder:"Type your answer…",rows:4,className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/30 resize-none"}),a.jsxs("div",{className:"flex gap-3",children:[a.jsx("button",{onClick:()=>m(null),className:"flex-1 rounded-md border border-border px-4 py-2 text-sm hover:bg-muted transition-colors",children:"Cancel"}),a.jsxs("button",{onClick:k,className:"flex-1 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors flex items-center justify-center gap-1.5",children:[a.jsx(_s,{className:"h-4 w-4"})," Submit answer"]})]})]})]})}),a.jsx(Bt,{open:g!==null,onOpenChange:()=>v(null),children:a.jsxs(Ft,{className:"sm:max-w-md",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Poll details"}),a.jsx(_n,{children:g!==null?(E=e[g])==null?void 0:E.question:""})]}),g!==null&&a.jsxs("div",{className:"space-y-4",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Event: ",e[g].event]}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Total responses: ",e[g].responses]}),a.jsx("div",{className:"space-y-3",children:e[g].options.map(N=>a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm font-medium text-foreground",children:N.label}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[N.votes," votes (",N.pct,"%)"]})]},N.label))}),a.jsx("button",{onClick:()=>{v(null),t({title:"Poll closed",description:"This poll has been ended."})},className:"w-full rounded-md border border-destructive text-destructive px-4 py-2 text-sm hover:bg-destructive/10 transition-colors",children:"Close poll"})]})]})}),a.jsx(Bt,{open:b,onOpenChange:x,children:a.jsxs(Ft,{className:"sm:max-w-lg",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Engagement history"}),a.jsx(_n,{children:"Past engagement activity across events."})]}),a.jsx("div",{className:"space-y-3",children:[{event:"Q4 All-Hands",date:"Jan 15, 2026",polls:3,questions:12,messages:89},{event:"Product Demo Day",date:"Dec 10, 2025",polls:2,questions:8,messages:45},{event:"Year-End Review",date:"Dec 1, 2025",polls:5,questions:22,messages:156}].map(N=>a.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border p-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:N.event}),a.jsx("p",{className:"text-xs text-muted-foreground",children:N.date})]}),a.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[a.jsxs("span",{children:[N.polls," polls"]}),a.jsxs("span",{children:[N.questions," Q&A"]}),a.jsxs("span",{children:[N.messages," msgs"]})]})]},N.event))})]})})]})}function DFr(t){return t==null}var $Fr=DFr;const $r=Fs($Fr);var OFr=F0,FFr=au,BFr=Jg,UFr="[object String]";function zFr(t){return typeof t=="string"||!FFr(t)&&BFr(t)&&OFr(t)==UFr}var VFr=zFr;const aE=Fs(VFr);var gIt={exports:{}},Yi={};/**
 * @license React
 * react-is.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 e5e=Symbol.for("react.element"),t5e=Symbol.for("react.portal"),uie=Symbol.for("react.fragment"),hie=Symbol.for("react.strict_mode"),mie=Symbol.for("react.profiler"),fie=Symbol.for("react.provider"),pie=Symbol.for("react.context"),HFr=Symbol.for("react.server_context"),gie=Symbol.for("react.forward_ref"),vie=Symbol.for("react.suspense"),yie=Symbol.for("react.suspense_list"),bie=Symbol.for("react.memo"),xie=Symbol.for("react.lazy"),GFr=Symbol.for("react.offscreen"),vIt;vIt=Symbol.for("react.module.reference");function op(t){if(typeof t=="object"&&t!==null){var e=t.$$typeof;switch(e){case e5e:switch(t=t.type,t){case uie:case mie:case hie:case vie:case yie:return t;default:switch(t=t&&t.$$typeof,t){case HFr:case pie:case gie:case xie:case bie:case fie:return t;default:return e}}case t5e:return e}}}Yi.ContextConsumer=pie;Yi.ContextProvider=fie;Yi.Element=e5e;Yi.ForwardRef=gie;Yi.Fragment=uie;Yi.Lazy=xie;Yi.Memo=bie;Yi.Portal=t5e;Yi.Profiler=mie;Yi.StrictMode=hie;Yi.Suspense=vie;Yi.SuspenseList=yie;Yi.isAsyncMode=function(){return!1};Yi.isConcurrentMode=function(){return!1};Yi.isContextConsumer=function(t){return op(t)===pie};Yi.isContextProvider=function(t){return op(t)===fie};Yi.isElement=function(t){return typeof t=="object"&&t!==null&&t.$$typeof===e5e};Yi.isForwardRef=function(t){return op(t)===gie};Yi.isFragment=function(t){return op(t)===uie};Yi.isLazy=function(t){return op(t)===xie};Yi.isMemo=function(t){return op(t)===bie};Yi.isPortal=function(t){return op(t)===t5e};Yi.isProfiler=function(t){return op(t)===mie};Yi.isStrictMode=function(t){return op(t)===hie};Yi.isSuspense=function(t){return op(t)===vie};Yi.isSuspenseList=function(t){return op(t)===yie};Yi.isValidElementType=function(t){return typeof t=="string"||typeof t=="function"||t===uie||t===mie||t===hie||t===vie||t===yie||t===GFr||typeof t=="object"&&t!==null&&(t.$$typeof===xie||t.$$typeof===bie||t.$$typeof===fie||t.$$typeof===pie||t.$$typeof===gie||t.$$typeof===vIt||t.getModuleId!==void 0)};Yi.typeOf=op;gIt.exports=Yi;var WFr=gIt.exports,qFr=F0,KFr=Jg,YFr="[object Number]";function QFr(t){return typeof t=="number"||KFr(t)&&qFr(t)==YFr}var yIt=QFr;const ZFr=Fs(yIt);var JFr=yIt;function XFr(t){return JFr(t)&&t!=+t}var e8r=XFr;const YM=Fs(e8r);var _u=function(e){return e===0?0:e>0?1:-1},Tj=function(e){return aE(e)&&e.indexOf("%")===e.length-1},ln=function(e){return ZFr(e)&&!YM(e)},t8r=function(e){return $r(e)},gc=function(e){return ln(e)||aE(e)},n8r=0,MS=function(e){var n=++n8r;return"".concat(e||"").concat(n)},Au=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:0,s=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;if(!ln(e)&&!aE(e))return r;var i;if(Tj(e)){var o=e.indexOf("%");i=n*parseFloat(e.slice(0,o))/100}else i=+e;return YM(i)&&(i=r),s&&i>n&&(i=n),i},u1=function(e){if(!e)return null;var n=Object.keys(e);return n&&n.length?e[n[0]]:null},r8r=function(e){if(!Array.isArray(e))return!1;for(var n=e.length,r={},s=0;s<n;s++)if(!r[e[s]])r[e[s]]=!0;else return!0;return!1},Mo=function(e,n){return ln(e)&&ln(n)?function(r){return e+r*(n-e)}:function(){return n}};function kJ(t,e,n){return!t||!t.length?null:t.find(function(r){return r&&(typeof e=="function"?e(r):Cm(r,e))===n})}var s8r=function(e){if(!e||!e.length)return null;for(var n=e.length,r=0,s=0,i=0,o=0,l=1/0,c=-1/0,d=0,u=0,h=0;h<n;h++)d=e[h].cx||0,u=e[h].cy||0,r+=d,s+=u,i+=d*u,o+=d*d,l=Math.min(l,d),c=Math.max(c,d);var m=n*o!==r*r?(n*i-r*s)/(n*o-r*r):0;return{xmin:l,xmax:c,a:m,b:(s-m*r)/n}},i8r=function(e,n){return ln(e)&&ln(n)?e-n:aE(e)&&aE(n)?e.localeCompare(n):e instanceof Date&&n instanceof Date?e.getTime()-n.getTime():String(e).localeCompare(String(n))};function mP(t,e){for(var n in t)if({}.hasOwnProperty.call(t,n)&&(!{}.hasOwnProperty.call(e,n)||t[n]!==e[n]))return!1;for(var r in e)if({}.hasOwnProperty.call(e,r)&&!{}.hasOwnProperty.call(t,r))return!1;return!0}function lwe(t){"@babel/helpers - typeof";return lwe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},lwe(t)}var a8r=["viewBox","children"],o8r=["aria-activedescendant","aria-atomic","aria-autocomplete","aria-busy","aria-checked","aria-colcount","aria-colindex","aria-colspan","aria-controls","aria-current","aria-describedby","aria-details","aria-disabled","aria-errormessage","aria-expanded","aria-flowto","aria-haspopup","aria-hidden","aria-invalid","aria-keyshortcuts","aria-label","aria-labelledby","aria-level","aria-live","aria-modal","aria-multiline","aria-multiselectable","aria-orientation","aria-owns","aria-placeholder","aria-posinset","aria-pressed","aria-readonly","aria-relevant","aria-required","aria-roledescription","aria-rowcount","aria-rowindex","aria-rowspan","aria-selected","aria-setsize","aria-sort","aria-valuemax","aria-valuemin","aria-valuenow","aria-valuetext","className","color","height","id","lang","max","media","method","min","name","style","target","width","role","tabIndex","accentHeight","accumulate","additive","alignmentBaseline","allowReorder","alphabetic","amplitude","arabicForm","ascent","attributeName","attributeType","autoReverse","azimuth","baseFrequency","baselineShift","baseProfile","bbox","begin","bias","by","calcMode","capHeight","clip","clipPath","clipPathUnits","clipRule","colorInterpolation","colorInterpolationFilters","colorProfile","colorRendering","contentScriptType","contentStyleType","cursor","cx","cy","d","decelerate","descent","diffuseConstant","direction","display","divisor","dominantBaseline","dur","dx","dy","edgeMode","elevation","enableBackground","end","exponent","externalResourcesRequired","fill","fillOpacity","fillRule","filter","filterRes","filterUnits","floodColor","floodOpacity","focusable","fontFamily","fontSize","fontSizeAdjust","fontStretch","fontStyle","fontVariant","fontWeight","format","from","fx","fy","g1","g2","glyphName","glyphOrientationHorizontal","glyphOrientationVertical","glyphRef","gradientTransform","gradientUnits","hanging","horizAdvX","horizOriginX","href","ideographic","imageRendering","in2","in","intercept","k1","k2","k3","k4","k","kernelMatrix","kernelUnitLength","kerning","keyPoints","keySplines","keyTimes","lengthAdjust","letterSpacing","lightingColor","limitingConeAngle","local","markerEnd","markerHeight","markerMid","markerStart","markerUnits","markerWidth","mask","maskContentUnits","maskUnits","mathematical","mode","numOctaves","offset","opacity","operator","order","orient","orientation","origin","overflow","overlinePosition","overlineThickness","paintOrder","panose1","pathLength","patternContentUnits","patternTransform","patternUnits","pointerEvents","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","r","radius","refX","refY","renderingIntent","repeatCount","repeatDur","requiredExtensions","requiredFeatures","restart","result","rotate","rx","ry","seed","shapeRendering","slope","spacing","specularConstant","specularExponent","speed","spreadMethod","startOffset","stdDeviation","stemh","stemv","stitchTiles","stopColor","stopOpacity","strikethroughPosition","strikethroughThickness","string","stroke","strokeDasharray","strokeDashoffset","strokeLinecap","strokeLinejoin","strokeMiterlimit","strokeOpacity","strokeWidth","surfaceScale","systemLanguage","tableValues","targetX","targetY","textAnchor","textDecoration","textLength","textRendering","to","transform","u1","u2","underlinePosition","underlineThickness","unicode","unicodeBidi","unicodeRange","unitsPerEm","vAlphabetic","values","vectorEffect","version","vertAdvY","vertOriginX","vertOriginY","vHanging","vIdeographic","viewTarget","visibility","vMathematical","widths","wordSpacing","writingMode","x1","x2","x","xChannelSelector","xHeight","xlinkActuate","xlinkArcrole","xlinkHref","xlinkRole","xlinkShow","xlinkTitle","xlinkType","xmlBase","xmlLang","xmlns","xmlnsXlink","xmlSpace","y1","y2","y","yChannelSelector","z","zoomAndPan","ref","key","angle"],Pqe=["points","pathLength"],Uue={svg:a8r,polygon:Pqe,polyline:Pqe},n5e=["dangerouslySetInnerHTML","onCopy","onCopyCapture","onCut","onCutCapture","onPaste","onPasteCapture","onCompositionEnd","onCompositionEndCapture","onCompositionStart","onCompositionStartCapture","onCompositionUpdate","onCompositionUpdateCapture","onFocus","onFocusCapture","onBlur","onBlurCapture","onChange","onChangeCapture","onBeforeInput","onBeforeInputCapture","onInput","onInputCapture","onReset","onResetCapture","onSubmit","onSubmitCapture","onInvalid","onInvalidCapture","onLoad","onLoadCapture","onError","onErrorCapture","onKeyDown","onKeyDownCapture","onKeyPress","onKeyPressCapture","onKeyUp","onKeyUpCapture","onAbort","onAbortCapture","onCanPlay","onCanPlayCapture","onCanPlayThrough","onCanPlayThroughCapture","onDurationChange","onDurationChangeCapture","onEmptied","onEmptiedCapture","onEncrypted","onEncryptedCapture","onEnded","onEndedCapture","onLoadedData","onLoadedDataCapture","onLoadedMetadata","onLoadedMetadataCapture","onLoadStart","onLoadStartCapture","onPause","onPauseCapture","onPlay","onPlayCapture","onPlaying","onPlayingCapture","onProgress","onProgressCapture","onRateChange","onRateChangeCapture","onSeeked","onSeekedCapture","onSeeking","onSeekingCapture","onStalled","onStalledCapture","onSuspend","onSuspendCapture","onTimeUpdate","onTimeUpdateCapture","onVolumeChange","onVolumeChangeCapture","onWaiting","onWaitingCapture","onAuxClick","onAuxClickCapture","onClick","onClickCapture","onContextMenu","onContextMenuCapture","onDoubleClick","onDoubleClickCapture","onDrag","onDragCapture","onDragEnd","onDragEndCapture","onDragEnter","onDragEnterCapture","onDragExit","onDragExitCapture","onDragLeave","onDragLeaveCapture","onDragOver","onDragOverCapture","onDragStart","onDragStartCapture","onDrop","onDropCapture","onMouseDown","onMouseDownCapture","onMouseEnter","onMouseLeave","onMouseMove","onMouseMoveCapture","onMouseOut","onMouseOutCapture","onMouseOver","onMouseOverCapture","onMouseUp","onMouseUpCapture","onSelect","onSelectCapture","onTouchCancel","onTouchCancelCapture","onTouchEnd","onTouchEndCapture","onTouchMove","onTouchMoveCapture","onTouchStart","onTouchStartCapture","onPointerDown","onPointerDownCapture","onPointerMove","onPointerMoveCapture","onPointerUp","onPointerUpCapture","onPointerCancel","onPointerCancelCapture","onPointerEnter","onPointerEnterCapture","onPointerLeave","onPointerLeaveCapture","onPointerOver","onPointerOverCapture","onPointerOut","onPointerOutCapture","onGotPointerCapture","onGotPointerCaptureCapture","onLostPointerCapture","onLostPointerCaptureCapture","onScroll","onScrollCapture","onWheel","onWheelCapture","onAnimationStart","onAnimationStartCapture","onAnimationEnd","onAnimationEndCapture","onAnimationIteration","onAnimationIterationCapture","onTransitionEnd","onTransitionEndCapture"],SJ=function(e,n){if(!e||typeof e=="function"||typeof e=="boolean")return null;var r=e;if(y.isValidElement(e)&&(r=e.props),!LM(r))return null;var s={};return Object.keys(r).forEach(function(i){n5e.includes(i)&&(s[i]=n||function(o){return r[i](r,o)})}),s},l8r=function(e,n,r){return function(s){return e(n,r,s),null}},Qk=function(e,n,r){if(!LM(e)||lwe(e)!=="object")return null;var s=null;return Object.keys(e).forEach(function(i){var o=e[i];n5e.includes(i)&&typeof o=="function"&&(s||(s={}),s[i]=l8r(o,n,r))}),s},c8r=["children"],d8r=["children"];function Rqe(t,e){if(t==null)return{};var n=u8r(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function u8r(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function cwe(t){"@babel/helpers - typeof";return cwe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},cwe(t)}var Iqe={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"},Px=function(e){return typeof e=="string"?e:e?e.displayName||e.name||"Component":""},Mqe=null,zue=null,r5e=function t(e){if(e===Mqe&&Array.isArray(zue))return zue;var n=[];return y.Children.forEach(e,function(r){$r(r)||(WFr.isFragment(r)?n=n.concat(t(r.props.children)):n.push(r))}),zue=n,Mqe=e,n};function Lu(t,e){var n=[],r=[];return Array.isArray(e)?r=e.map(function(s){return Px(s)}):r=[Px(e)],r5e(t).forEach(function(s){var i=Cm(s,"type.displayName")||Cm(s,"type.name");r.indexOf(i)!==-1&&n.push(s)}),n}function im(t,e){var n=Lu(t,e);return n&&n[0]}var Lqe=function(e){if(!e||!e.props)return!1;var n=e.props,r=n.width,s=n.height;return!(!ln(r)||r<=0||!ln(s)||s<=0)},h8r=["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"],m8r=function(e){return e&&e.type&&aE(e.type)&&h8r.indexOf(e.type)>=0},bIt=function(e){return e&&cwe(e)==="object"&&"clipDot"in e},f8r=function(e,n,r,s){var i,o=(i=Uue==null?void 0:Uue[s])!==null&&i!==void 0?i:[];return n.startsWith("data-")||!Wr(e)&&(s&&o.includes(n)||o8r.includes(n))||r&&n5e.includes(n)},hr=function(e,n,r){if(!e||typeof e=="function"||typeof e=="boolean")return null;var s=e;if(y.isValidElement(e)&&(s=e.props),!LM(s))return null;var i={};return Object.keys(s).forEach(function(o){var l;f8r((l=s)===null||l===void 0?void 0:l[o],o,n,r)&&(i[o]=s[o])}),i},dwe=function t(e,n){if(e===n)return!0;var r=y.Children.count(e);if(r!==y.Children.count(n))return!1;if(r===0)return!0;if(r===1)return Dqe(Array.isArray(e)?e[0]:e,Array.isArray(n)?n[0]:n);for(var s=0;s<r;s++){var i=e[s],o=n[s];if(Array.isArray(i)||Array.isArray(o)){if(!t(i,o))return!1}else if(!Dqe(i,o))return!1}return!0},Dqe=function(e,n){if($r(e)&&$r(n))return!0;if(!$r(e)&&!$r(n)){var r=e.props||{},s=r.children,i=Rqe(r,c8r),o=n.props||{},l=o.children,c=Rqe(o,d8r);return s&&l?mP(i,c)&&dwe(s,l):!s&&!l?mP(i,c):!1}return!1},$qe=function(e,n){var r=[],s={};return r5e(e).forEach(function(i,o){if(m8r(i))r.push(i);else if(i){var l=Px(i.type),c=n[l]||{},d=c.handler,u=c.once;if(d&&(!u||!s[l])){var h=d(i,l,o);r.push(h),s[l]=!0}}}),r},p8r=function(e){var n=e&&e.type;return n&&Iqe[n]?Iqe[n]:null},g8r=function(e,n){return r5e(n).indexOf(e)},v8r=["children","width","height","viewBox","className","style","title","desc"];function uwe(){return uwe=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},uwe.apply(this,arguments)}function y8r(t,e){if(t==null)return{};var n=b8r(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function b8r(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function hwe(t){var e=t.children,n=t.width,r=t.height,s=t.viewBox,i=t.className,o=t.style,l=t.title,c=t.desc,d=y8r(t,v8r),u=s||{width:n,height:r,x:0,y:0},h=Zn("recharts-surface",i);return se.createElement("svg",uwe({},hr(d,!0,"svg"),{className:h,width:n,height:r,style:o,viewBox:"".concat(u.x," ").concat(u.y," ").concat(u.width," ").concat(u.height)}),se.createElement("title",null,l),se.createElement("desc",null,c),e)}var x8r=["children","className"];function mwe(){return mwe=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},mwe.apply(this,arguments)}function w8r(t,e){if(t==null)return{};var n=k8r(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function k8r(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var Cs=se.forwardRef(function(t,e){var n=t.children,r=t.className,s=w8r(t,x8r),i=Zn("recharts-layer",r);return se.createElement("g",mwe({className:i},hr(s,!0),{ref:e}),n)}),Eg=function(e,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),i=2;i<r;i++)s[i-2]=arguments[i]},S8r=APe;function C8r(t,e,n){var r=t.length;return n=n===void 0?r:n,!e&&n>=r?t:S8r(t,e,n)}var j8r=C8r,E8r="\\ud800-\\udfff",N8r="\\u0300-\\u036f",T8r="\\ufe20-\\ufe2f",_8r="\\u20d0-\\u20ff",A8r=N8r+T8r+_8r,P8r="\\ufe0e\\ufe0f",R8r="\\u200d",I8r=RegExp("["+R8r+E8r+A8r+P8r+"]");function M8r(t){return I8r.test(t)}var xIt=M8r;function L8r(t){return t.split("")}var D8r=L8r,wIt="\\ud800-\\udfff",$8r="\\u0300-\\u036f",O8r="\\ufe20-\\ufe2f",F8r="\\u20d0-\\u20ff",B8r=$8r+O8r+F8r,U8r="\\ufe0e\\ufe0f",z8r="["+wIt+"]",fwe="["+B8r+"]",pwe="\\ud83c[\\udffb-\\udfff]",V8r="(?:"+fwe+"|"+pwe+")",kIt="[^"+wIt+"]",SIt="(?:\\ud83c[\\udde6-\\uddff]){2}",CIt="[\\ud800-\\udbff][\\udc00-\\udfff]",H8r="\\u200d",jIt=V8r+"?",EIt="["+U8r+"]?",G8r="(?:"+H8r+"(?:"+[kIt,SIt,CIt].join("|")+")"+EIt+jIt+")*",W8r=EIt+jIt+G8r,q8r="(?:"+[kIt+fwe+"?",fwe,SIt,CIt,z8r].join("|")+")",K8r=RegExp(pwe+"(?="+pwe+")|"+q8r+W8r,"g");function Y8r(t){return t.match(K8r)||[]}var Q8r=Y8r,Z8r=D8r,J8r=xIt,X8r=Q8r;function e7r(t){return J8r(t)?X8r(t):Z8r(t)}var t7r=e7r,n7r=j8r,r7r=xIt,s7r=t7r,i7r=GPt;function a7r(t){return function(e){e=i7r(e);var n=r7r(e)?s7r(e):void 0,r=n?n[0]:e.charAt(0),s=n?n7r(n,1).join(""):e.slice(1);return r[t]()+s}}var o7r=a7r,l7r=o7r,c7r=l7r("toUpperCase"),d7r=c7r;const wie=Fs(d7r);function Ia(t){return function(){return t}}const NIt=Math.cos,CJ=Math.sin,nv=Math.sqrt,jJ=Math.PI,kie=2*jJ,gwe=Math.PI,vwe=2*gwe,HC=1e-6,u7r=vwe-HC;function TIt(t){this._+=t[0];for(let e=1,n=t.length;e<n;++e)this._+=arguments[e]+t[e]}function h7r(t){let e=Math.floor(t);if(!(e>=0))throw new Error(`invalid digits: ${t}`);if(e>15)return TIt;const n=10**e;return function(r){this._+=r[0];for(let s=1,i=r.length;s<i;++s)this._+=Math.round(arguments[s]*n)/n+r[s]}}class m7r{constructor(e){this._x0=this._y0=this._x1=this._y1=null,this._="",this._append=e==null?TIt:h7r(e)}moveTo(e,n){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}`}closePath(){this._x1!==null&&(this._x1=this._x0,this._y1=this._y0,this._append`Z`)}lineTo(e,n){this._append`L${this._x1=+e},${this._y1=+n}`}quadraticCurveTo(e,n,r,s){this._append`Q${+e},${+n},${this._x1=+r},${this._y1=+s}`}bezierCurveTo(e,n,r,s,i,o){this._append`C${+e},${+n},${+r},${+s},${this._x1=+i},${this._y1=+o}`}arcTo(e,n,r,s,i){if(e=+e,n=+n,r=+r,s=+s,i=+i,i<0)throw new Error(`negative radius: ${i}`);let o=this._x1,l=this._y1,c=r-e,d=s-n,u=o-e,h=l-n,m=u*u+h*h;if(this._x1===null)this._append`M${this._x1=e},${this._y1=n}`;else if(m>HC)if(!(Math.abs(h*c-d*u)>HC)||!i)this._append`L${this._x1=e},${this._y1=n}`;else{let f=r-o,p=s-l,g=c*c+d*d,v=f*f+p*p,b=Math.sqrt(g),x=Math.sqrt(m),w=i*Math.tan((gwe-Math.acos((g+m-v)/(2*b*x)))/2),k=w/x,S=w/b;Math.abs(k-1)>HC&&this._append`L${e+k*u},${n+k*h}`,this._append`A${i},${i},0,0,${+(h*f>u*p)},${this._x1=e+S*c},${this._y1=n+S*d}`}}arc(e,n,r,s,i,o){if(e=+e,n=+n,r=+r,o=!!o,r<0)throw new Error(`negative radius: ${r}`);let l=r*Math.cos(s),c=r*Math.sin(s),d=e+l,u=n+c,h=1^o,m=o?s-i:i-s;this._x1===null?this._append`M${d},${u}`:(Math.abs(this._x1-d)>HC||Math.abs(this._y1-u)>HC)&&this._append`L${d},${u}`,r&&(m<0&&(m=m%vwe+vwe),m>u7r?this._append`A${r},${r},0,1,${h},${e-l},${n-c}A${r},${r},0,1,${h},${this._x1=d},${this._y1=u}`:m>HC&&this._append`A${r},${r},0,${+(m>=gwe)},${h},${this._x1=e+r*Math.cos(i)},${this._y1=n+r*Math.sin(i)}`)}rect(e,n,r,s){this._append`M${this._x0=this._x1=+e},${this._y0=this._y1=+n}h${r=+r}v${+s}h${-r}Z`}toString(){return this._}}function s5e(t){let e=3;return t.digits=function(n){if(!arguments.length)return e;if(n==null)e=null;else{const r=Math.floor(n);if(!(r>=0))throw new RangeError(`invalid digits: ${n}`);e=r}return t},()=>new m7r(e)}function i5e(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function _It(t){this._context=t}_It.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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:this._context.lineTo(t,e);break}}};function Sie(t){return new _It(t)}function AIt(t){return t[0]}function PIt(t){return t[1]}function RIt(t,e){var n=Ia(!0),r=null,s=Sie,i=null,o=s5e(l);t=typeof t=="function"?t:t===void 0?AIt:Ia(t),e=typeof e=="function"?e:e===void 0?PIt:Ia(e);function l(c){var d,u=(c=i5e(c)).length,h,m=!1,f;for(r==null&&(i=s(f=o())),d=0;d<=u;++d)!(d<u&&n(h=c[d],d,c))===m&&((m=!m)?i.lineStart():i.lineEnd()),m&&i.point(+t(h,d,c),+e(h,d,c));if(f)return i=null,f+""||null}return l.x=function(c){return arguments.length?(t=typeof c=="function"?c:Ia(+c),l):t},l.y=function(c){return arguments.length?(e=typeof c=="function"?c:Ia(+c),l):e},l.defined=function(c){return arguments.length?(n=typeof c=="function"?c:Ia(!!c),l):n},l.curve=function(c){return arguments.length?(s=c,r!=null&&(i=s(r)),l):s},l.context=function(c){return arguments.length?(c==null?r=i=null:i=s(r=c),l):r},l}function sH(t,e,n){var r=null,s=Ia(!0),i=null,o=Sie,l=null,c=s5e(d);t=typeof t=="function"?t:t===void 0?AIt:Ia(+t),e=typeof e=="function"?e:Ia(e===void 0?0:+e),n=typeof n=="function"?n:n===void 0?PIt:Ia(+n);function d(h){var m,f,p,g=(h=i5e(h)).length,v,b=!1,x,w=new Array(g),k=new Array(g);for(i==null&&(l=o(x=c())),m=0;m<=g;++m){if(!(m<g&&s(v=h[m],m,h))===b)if(b=!b)f=m,l.areaStart(),l.lineStart();else{for(l.lineEnd(),l.lineStart(),p=m-1;p>=f;--p)l.point(w[p],k[p]);l.lineEnd(),l.areaEnd()}b&&(w[m]=+t(v,m,h),k[m]=+e(v,m,h),l.point(r?+r(v,m,h):w[m],n?+n(v,m,h):k[m]))}if(x)return l=null,x+""||null}function u(){return RIt().defined(s).curve(o).context(i)}return d.x=function(h){return arguments.length?(t=typeof h=="function"?h:Ia(+h),r=null,d):t},d.x0=function(h){return arguments.length?(t=typeof h=="function"?h:Ia(+h),d):t},d.x1=function(h){return arguments.length?(r=h==null?null:typeof h=="function"?h:Ia(+h),d):r},d.y=function(h){return arguments.length?(e=typeof h=="function"?h:Ia(+h),n=null,d):e},d.y0=function(h){return arguments.length?(e=typeof h=="function"?h:Ia(+h),d):e},d.y1=function(h){return arguments.length?(n=h==null?null:typeof h=="function"?h:Ia(+h),d):n},d.lineX0=d.lineY0=function(){return u().x(t).y(e)},d.lineY1=function(){return u().x(t).y(n)},d.lineX1=function(){return u().x(r).y(e)},d.defined=function(h){return arguments.length?(s=typeof h=="function"?h:Ia(!!h),d):s},d.curve=function(h){return arguments.length?(o=h,i!=null&&(l=o(i)),d):o},d.context=function(h){return arguments.length?(h==null?i=l=null:l=o(i=h),d):i},d}class IIt{constructor(e,n){this._context=e,this._x=n}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0}lineEnd(){(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line}point(e,n){switch(e=+e,n=+n,this._point){case 0:{this._point=1,this._line?this._context.lineTo(e,n):this._context.moveTo(e,n);break}case 1:this._point=2;default:{this._x?this._context.bezierCurveTo(this._x0=(this._x0+e)/2,this._y0,this._x0,n,e,n):this._context.bezierCurveTo(this._x0,this._y0=(this._y0+n)/2,e,this._y0,e,n);break}}this._x0=e,this._y0=n}}function f7r(t){return new IIt(t,!0)}function p7r(t){return new IIt(t,!1)}const a5e={draw(t,e){const n=nv(e/jJ);t.moveTo(n,0),t.arc(0,0,n,0,kie)}},g7r={draw(t,e){const n=nv(e/5)/2;t.moveTo(-3*n,-n),t.lineTo(-n,-n),t.lineTo(-n,-3*n),t.lineTo(n,-3*n),t.lineTo(n,-n),t.lineTo(3*n,-n),t.lineTo(3*n,n),t.lineTo(n,n),t.lineTo(n,3*n),t.lineTo(-n,3*n),t.lineTo(-n,n),t.lineTo(-3*n,n),t.closePath()}},MIt=nv(1/3),v7r=MIt*2,y7r={draw(t,e){const n=nv(e/v7r),r=n*MIt;t.moveTo(0,-n),t.lineTo(r,0),t.lineTo(0,n),t.lineTo(-r,0),t.closePath()}},b7r={draw(t,e){const n=nv(e),r=-n/2;t.rect(r,r,n,n)}},x7r=.8908130915292852,LIt=CJ(jJ/10)/CJ(7*jJ/10),w7r=CJ(kie/10)*LIt,k7r=-NIt(kie/10)*LIt,S7r={draw(t,e){const n=nv(e*x7r),r=w7r*n,s=k7r*n;t.moveTo(0,-n),t.lineTo(r,s);for(let i=1;i<5;++i){const o=kie*i/5,l=NIt(o),c=CJ(o);t.lineTo(c*n,-l*n),t.lineTo(l*r-c*s,c*r+l*s)}t.closePath()}},Vue=nv(3),C7r={draw(t,e){const n=-nv(e/(Vue*3));t.moveTo(0,n*2),t.lineTo(-Vue*n,-n),t.lineTo(Vue*n,-n),t.closePath()}},Wm=-.5,qm=nv(3)/2,ywe=1/nv(12),j7r=(ywe/2+1)*3,E7r={draw(t,e){const n=nv(e/j7r),r=n/2,s=n*ywe,i=r,o=n*ywe+n,l=-i,c=o;t.moveTo(r,s),t.lineTo(i,o),t.lineTo(l,c),t.lineTo(Wm*r-qm*s,qm*r+Wm*s),t.lineTo(Wm*i-qm*o,qm*i+Wm*o),t.lineTo(Wm*l-qm*c,qm*l+Wm*c),t.lineTo(Wm*r+qm*s,Wm*s-qm*r),t.lineTo(Wm*i+qm*o,Wm*o-qm*i),t.lineTo(Wm*l+qm*c,Wm*c-qm*l),t.closePath()}};function N7r(t,e){let n=null,r=s5e(s);t=typeof t=="function"?t:Ia(t||a5e),e=typeof e=="function"?e:Ia(e===void 0?64:+e);function s(){let i;if(n||(n=i=r()),t.apply(this,arguments).draw(n,+e.apply(this,arguments)),i)return n=null,i+""||null}return s.type=function(i){return arguments.length?(t=typeof i=="function"?i:Ia(i),s):t},s.size=function(i){return arguments.length?(e=typeof i=="function"?i:Ia(+i),s):e},s.context=function(i){return arguments.length?(n=i??null,s):n},s}function EJ(){}function NJ(t,e,n){t._context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+n)/6)}function DIt(t){this._context=t}DIt.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:NJ(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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);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:NJ(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function T7r(t){return new DIt(t)}function $It(t){this._context=t}$It.prototype={areaStart:EJ,areaEnd:EJ,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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._x2=t,this._y2=e;break;case 1:this._point=2,this._x3=t,this._y3=e;break;case 2:this._point=3,this._x4=t,this._y4=e,this._context.moveTo((this._x0+4*this._x1+t)/6,(this._y0+4*this._y1+e)/6);break;default:NJ(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function _7r(t){return new $It(t)}function OIt(t){this._context=t}OIt.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(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1;break;case 1:this._point=2;break;case 2:this._point=3;var n=(this._x0+4*this._x1+t)/6,r=(this._y0+4*this._y1+e)/6;this._line?this._context.lineTo(n,r):this._context.moveTo(n,r);break;case 3:this._point=4;default:NJ(this,t,e);break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e}};function A7r(t){return new OIt(t)}function FIt(t){this._context=t}FIt.prototype={areaStart:EJ,areaEnd:EJ,lineStart:function(){this._point=0},lineEnd:function(){this._point&&this._context.closePath()},point:function(t,e){t=+t,e=+e,this._point?this._context.lineTo(t,e):(this._point=1,this._context.moveTo(t,e))}};function P7r(t){return new FIt(t)}function Oqe(t){return t<0?-1:1}function Fqe(t,e,n){var r=t._x1-t._x0,s=e-t._x1,i=(t._y1-t._y0)/(r||s<0&&-0),o=(n-t._y1)/(s||r<0&&-0),l=(i*s+o*r)/(r+s);return(Oqe(i)+Oqe(o))*Math.min(Math.abs(i),Math.abs(o),.5*Math.abs(l))||0}function Bqe(t,e){var n=t._x1-t._x0;return n?(3*(t._y1-t._y0)/n-e)/2:e}function Hue(t,e,n){var r=t._x0,s=t._y0,i=t._x1,o=t._y1,l=(i-r)/3;t._context.bezierCurveTo(r+l,s+l*e,i-l,o-l*n,i,o)}function TJ(t){this._context=t}TJ.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:Hue(this,this._t0,Bqe(this,this._t0));break}(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line=1-this._line},point:function(t,e){var n=NaN;if(t=+t,e=+e,!(t===this._x1&&e===this._y1)){switch(this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;break;case 2:this._point=3,Hue(this,Bqe(this,n=Fqe(this,t,e)),n);break;default:Hue(this,this._t0,n=Fqe(this,t,e));break}this._x0=this._x1,this._x1=t,this._y0=this._y1,this._y1=e,this._t0=n}}};function BIt(t){this._context=new UIt(t)}(BIt.prototype=Object.create(TJ.prototype)).point=function(t,e){TJ.prototype.point.call(this,e,t)};function UIt(t){this._context=t}UIt.prototype={moveTo:function(t,e){this._context.moveTo(e,t)},closePath:function(){this._context.closePath()},lineTo:function(t,e){this._context.lineTo(e,t)},bezierCurveTo:function(t,e,n,r,s,i){this._context.bezierCurveTo(e,t,r,n,i,s)}};function R7r(t){return new TJ(t)}function I7r(t){return new BIt(t)}function zIt(t){this._context=t}zIt.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=[],this._y=[]},lineEnd:function(){var t=this._x,e=this._y,n=t.length;if(n)if(this._line?this._context.lineTo(t[0],e[0]):this._context.moveTo(t[0],e[0]),n===2)this._context.lineTo(t[1],e[1]);else for(var r=Uqe(t),s=Uqe(e),i=0,o=1;o<n;++i,++o)this._context.bezierCurveTo(r[0][i],s[0][i],r[1][i],s[1][i],t[o],e[o]);(this._line||this._line!==0&&n===1)&&this._context.closePath(),this._line=1-this._line,this._x=this._y=null},point:function(t,e){this._x.push(+t),this._y.push(+e)}};function Uqe(t){var e,n=t.length-1,r,s=new Array(n),i=new Array(n),o=new Array(n);for(s[0]=0,i[0]=2,o[0]=t[0]+2*t[1],e=1;e<n-1;++e)s[e]=1,i[e]=4,o[e]=4*t[e]+2*t[e+1];for(s[n-1]=2,i[n-1]=7,o[n-1]=8*t[n-1]+t[n],e=1;e<n;++e)r=s[e]/i[e-1],i[e]-=r,o[e]-=r*o[e-1];for(s[n-1]=o[n-1]/i[n-1],e=n-2;e>=0;--e)s[e]=(o[e]-s[e+1])/i[e];for(i[n-1]=(t[n]+s[n-1])/2,e=0;e<n-1;++e)i[e]=2*t[e+1]-s[e+1];return[s,i]}function M7r(t){return new zIt(t)}function Cie(t,e){this._context=t,this._t=e}Cie.prototype={areaStart:function(){this._line=0},areaEnd:function(){this._line=NaN},lineStart:function(){this._x=this._y=NaN,this._point=0},lineEnd:function(){0<this._t&&this._t<1&&this._point===2&&this._context.lineTo(this._x,this._y),(this._line||this._line!==0&&this._point===1)&&this._context.closePath(),this._line>=0&&(this._t=1-this._t,this._line=1-this._line)},point:function(t,e){switch(t=+t,e=+e,this._point){case 0:this._point=1,this._line?this._context.lineTo(t,e):this._context.moveTo(t,e);break;case 1:this._point=2;default:{if(this._t<=0)this._context.lineTo(this._x,e),this._context.lineTo(t,e);else{var n=this._x*(1-this._t)+t*this._t;this._context.lineTo(n,this._y),this._context.lineTo(n,e)}break}}this._x=t,this._y=e}};function L7r(t){return new Cie(t,.5)}function D7r(t){return new Cie(t,0)}function $7r(t){return new Cie(t,1)}function h5(t,e){if((o=t.length)>1)for(var n=1,r,s,i=t[e[0]],o,l=i.length;n<o;++n)for(s=i,i=t[e[n]],r=0;r<l;++r)i[r][1]+=i[r][0]=isNaN(s[r][1])?s[r][0]:s[r][1]}function bwe(t){for(var e=t.length,n=new Array(e);--e>=0;)n[e]=e;return n}function O7r(t,e){return t[e]}function F7r(t){const e=[];return e.key=t,e}function B7r(){var t=Ia([]),e=bwe,n=h5,r=O7r;function s(i){var o=Array.from(t.apply(this,arguments),F7r),l,c=o.length,d=-1,u;for(const h of i)for(l=0,++d;l<c;++l)(o[l][d]=[0,+r(h,o[l].key,d,i)]).data=h;for(l=0,u=i5e(e(o));l<c;++l)o[u[l]].index=l;return n(o,u),o}return s.keys=function(i){return arguments.length?(t=typeof i=="function"?i:Ia(Array.from(i)),s):t},s.value=function(i){return arguments.length?(r=typeof i=="function"?i:Ia(+i),s):r},s.order=function(i){return arguments.length?(e=i==null?bwe:typeof i=="function"?i:Ia(Array.from(i)),s):e},s.offset=function(i){return arguments.length?(n=i??h5,s):n},s}function U7r(t,e){if((r=t.length)>0){for(var n,r,s=0,i=t[0].length,o;s<i;++s){for(o=n=0;n<r;++n)o+=t[n][s][1]||0;if(o)for(n=0;n<r;++n)t[n][s][1]/=o}h5(t,e)}}function z7r(t,e){if((s=t.length)>0){for(var n=0,r=t[e[0]],s,i=r.length;n<i;++n){for(var o=0,l=0;o<s;++o)l+=t[o][n][1]||0;r[n][1]+=r[n][0]=-l/2}h5(t,e)}}function V7r(t,e){if(!(!((o=t.length)>0)||!((i=(s=t[e[0]]).length)>0))){for(var n=0,r=1,s,i,o;r<i;++r){for(var l=0,c=0,d=0;l<o;++l){for(var u=t[e[l]],h=u[r][1]||0,m=u[r-1][1]||0,f=(h-m)/2,p=0;p<l;++p){var g=t[e[p]],v=g[r][1]||0,b=g[r-1][1]||0;f+=v-b}c+=h,d+=f*h}s[r-1][1]+=s[r-1][0]=n,c&&(n-=d/c)}s[r-1][1]+=s[r-1][0]=n,h5(t,e)}}function TF(t){"@babel/helpers - typeof";return TF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},TF(t)}var H7r=["type","size","sizeType"];function xwe(){return xwe=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},xwe.apply(this,arguments)}function zqe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Vqe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?zqe(Object(n),!0).forEach(function(r){G7r(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):zqe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function G7r(t,e,n){return e=W7r(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function W7r(t){var e=q7r(t,"string");return TF(e)=="symbol"?e:e+""}function q7r(t,e){if(TF(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(TF(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function K7r(t,e){if(t==null)return{};var n=Y7r(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Y7r(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var VIt={symbolCircle:a5e,symbolCross:g7r,symbolDiamond:y7r,symbolSquare:b7r,symbolStar:S7r,symbolTriangle:C7r,symbolWye:E7r},Q7r=Math.PI/180,Z7r=function(e){var n="symbol".concat(wie(e));return VIt[n]||a5e},J7r=function(e,n,r){if(n==="area")return e;switch(r){case"cross":return 5*e*e/9;case"diamond":return .5*e*e/Math.sqrt(3);case"square":return e*e;case"star":{var s=18*Q7r;return 1.25*e*e*(Math.tan(s)-Math.tan(s*2)*Math.pow(Math.tan(s),2))}case"triangle":return Math.sqrt(3)*e*e/4;case"wye":return(21-10*Math.sqrt(3))*e*e/8;default:return Math.PI*e*e/4}},X7r=function(e,n){VIt["symbol".concat(wie(e))]=n},jie=function(e){var n=e.type,r=n===void 0?"circle":n,s=e.size,i=s===void 0?64:s,o=e.sizeType,l=o===void 0?"area":o,c=K7r(e,H7r),d=Vqe(Vqe({},c),{},{type:r,size:i,sizeType:l}),u=function(){var v=Z7r(r),b=N7r().type(v).size(J7r(i,l,r));return b()},h=d.className,m=d.cx,f=d.cy,p=hr(d,!0);return m===+m&&f===+f&&i===+i?se.createElement("path",xwe({},p,{className:Zn("recharts-symbols",h),transform:"translate(".concat(m,", ").concat(f,")"),d:u()})):null};jie.registerSymbol=X7r;function m5(t){"@babel/helpers - typeof";return m5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m5(t)}function wwe(){return wwe=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},wwe.apply(this,arguments)}function Hqe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function eBr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Hqe(Object(n),!0).forEach(function(r){_F(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Hqe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function tBr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nBr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,GIt(r.key),r)}}function rBr(t,e,n){return e&&nBr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function sBr(t,e,n){return e=_J(e),iBr(t,HIt()?Reflect.construct(e,n||[],_J(t).constructor):e.apply(t,n))}function iBr(t,e){if(e&&(m5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return aBr(t)}function aBr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function HIt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(HIt=function(){return!!t})()}function _J(t){return _J=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},_J(t)}function oBr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&kwe(t,e)}function kwe(t,e){return kwe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},kwe(t,e)}function _F(t,e,n){return e=GIt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function GIt(t){var e=lBr(t,"string");return m5(e)=="symbol"?e:e+""}function lBr(t,e){if(m5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(m5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Km=32,o5e=function(t){function e(){return tBr(this,e),sBr(this,e,arguments)}return oBr(e,t),rBr(e,[{key:"renderIcon",value:function(r){var s=this.props.inactiveColor,i=Km/2,o=Km/6,l=Km/3,c=r.inactive?s:r.color;if(r.type==="plainline")return se.createElement("line",{strokeWidth:4,fill:"none",stroke:c,strokeDasharray:r.payload.strokeDasharray,x1:0,y1:i,x2:Km,y2:i,className:"recharts-legend-icon"});if(r.type==="line")return se.createElement("path",{strokeWidth:4,fill:"none",stroke:c,d:"M0,".concat(i,"h").concat(l,`
            A`).concat(o,",").concat(o,",0,1,1,").concat(2*l,",").concat(i,`
            H`).concat(Km,"M").concat(2*l,",").concat(i,`
            A`).concat(o,",").concat(o,",0,1,1,").concat(l,",").concat(i),className:"recharts-legend-icon"});if(r.type==="rect")return se.createElement("path",{stroke:"none",fill:c,d:"M0,".concat(Km/8,"h").concat(Km,"v").concat(Km*3/4,"h").concat(-Km,"z"),className:"recharts-legend-icon"});if(se.isValidElement(r.legendIcon)){var d=eBr({},r);return delete d.legendIcon,se.cloneElement(r.legendIcon,d)}return se.createElement(jie,{fill:c,cx:i,cy:i,size:Km,sizeType:"diameter",type:r.type})}},{key:"renderItems",value:function(){var r=this,s=this.props,i=s.payload,o=s.iconSize,l=s.layout,c=s.formatter,d=s.inactiveColor,u={x:0,y:0,width:Km,height:Km},h={display:l==="horizontal"?"inline-block":"block",marginRight:10},m={display:"inline-block",verticalAlign:"middle",marginRight:4};return i.map(function(f,p){var g=f.formatter||c,v=Zn(_F(_F({"recharts-legend-item":!0},"legend-item-".concat(p),!0),"inactive",f.inactive));if(f.type==="none")return null;var b=Wr(f.value)?null:f.value;Eg(!Wr(f.value),`The name property is also required when using a function for the dataKey of a chart's cartesian components. Ex: <Bar name="Name of my Data"/>`);var x=f.inactive?d:f.color;return se.createElement("li",wwe({className:v,style:h,key:"legend-item-".concat(p)},Qk(r.props,f,p)),se.createElement(hwe,{width:o,height:o,viewBox:u,style:m},r.renderIcon(f)),se.createElement("span",{className:"recharts-legend-item-text",style:{color:x}},g?g(b,f,p):b))})}},{key:"render",value:function(){var r=this.props,s=r.payload,i=r.layout,o=r.align;if(!s||!s.length)return null;var l={padding:0,margin:0,textAlign:i==="horizontal"?o:"left"};return se.createElement("ul",{className:"recharts-default-legend",style:l},this.renderItems())}}])}(y.PureComponent);_F(o5e,"displayName","Legend");_F(o5e,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"middle",inactiveColor:"#ccc"});function cBr(t){return t!==t}var dBr=cBr;function uBr(t,e,n){for(var r=n-1,s=t.length;++r<s;)if(t[r]===e)return r;return-1}var hBr=uBr,mBr=FPt,fBr=dBr,pBr=hBr;function gBr(t,e,n){return e===e?pBr(t,e,n):mBr(t,fBr,n)}var vBr=gBr,yBr=vBr;function bBr(t,e){var n=t==null?0:t.length;return!!n&&yBr(t,e,0)>-1}var xBr=bBr;function wBr(t,e,n){for(var r=-1,s=t==null?0:t.length;++r<s;)if(n(e,t[r]))return!0;return!1}var kBr=wBr;function SBr(){}var CBr=SBr,Gue=LPt,jBr=CBr,EBr=KPe,NBr=1/0,TBr=Gue&&1/EBr(new Gue([,-0]))[1]==NBr?function(t){return new Gue(t)}:jBr,_Br=TBr,ABr=CPt,PBr=xBr,RBr=kBr,IBr=EPt,MBr=_Br,LBr=KPe,DBr=200;function $Br(t,e,n){var r=-1,s=PBr,i=t.length,o=!0,l=[],c=l;if(n)o=!1,s=RBr;else if(i>=DBr){var d=e?null:MBr(t);if(d)return LBr(d);o=!1,s=IBr,c=new ABr}else c=e?[]:l;e:for(;++r<i;){var u=t[r],h=e?e(u):u;if(u=n||u!==0?u:0,o&&h===h){for(var m=c.length;m--;)if(c[m]===h)continue e;e&&c.push(h),l.push(u)}else s(c,h,n)||(c!==l&&c.push(h),l.push(u))}return l}var OBr=$Br,FBr=Xg,BBr=OBr;function UBr(t,e){return t&&t.length?BBr(t,FBr(e)):[]}var zBr=UBr;const Gqe=Fs(zBr);function WIt(t,e,n){return e===!0?Gqe(t,n):Wr(e)?Gqe(t,e):t}function f5(t){"@babel/helpers - typeof";return f5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f5(t)}var VBr=["ref"];function Wqe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function xb(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Wqe(Object(n),!0).forEach(function(r){Eie(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Wqe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function HBr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qqe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,KIt(r.key),r)}}function GBr(t,e,n){return e&&qqe(t.prototype,e),n&&qqe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function WBr(t,e,n){return e=AJ(e),qBr(t,qIt()?Reflect.construct(e,n||[],AJ(t).constructor):e.apply(t,n))}function qBr(t,e){if(e&&(f5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return KBr(t)}function KBr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function qIt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(qIt=function(){return!!t})()}function AJ(t){return AJ=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},AJ(t)}function YBr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Swe(t,e)}function Swe(t,e){return Swe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Swe(t,e)}function Eie(t,e,n){return e=KIt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function KIt(t){var e=QBr(t,"string");return f5(e)=="symbol"?e:e+""}function QBr(t,e){if(f5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(f5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function ZBr(t,e){if(t==null)return{};var n=JBr(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function JBr(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function XBr(t){return t.value}function e9r(t,e){if(se.isValidElement(t))return se.cloneElement(t,e);if(typeof t=="function")return se.createElement(t,e);e.ref;var n=ZBr(e,VBr);return se.createElement(o5e,n)}var Kqe=1,o2=function(t){function e(){var n;HBr(this,e);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=WBr(this,e,[].concat(s)),Eie(n,"lastBoundingBox",{width:-1,height:-1}),n}return YBr(e,t),GBr(e,[{key:"componentDidMount",value:function(){this.updateBBox()}},{key:"componentDidUpdate",value:function(){this.updateBBox()}},{key:"getBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();return r.height=this.wrapperNode.offsetHeight,r.width=this.wrapperNode.offsetWidth,r}return null}},{key:"updateBBox",value:function(){var r=this.props.onBBoxUpdate,s=this.getBBox();s?(Math.abs(s.width-this.lastBoundingBox.width)>Kqe||Math.abs(s.height-this.lastBoundingBox.height)>Kqe)&&(this.lastBoundingBox.width=s.width,this.lastBoundingBox.height=s.height,r&&r(s)):(this.lastBoundingBox.width!==-1||this.lastBoundingBox.height!==-1)&&(this.lastBoundingBox.width=-1,this.lastBoundingBox.height=-1,r&&r(null))}},{key:"getBBoxSnapshot",value:function(){return this.lastBoundingBox.width>=0&&this.lastBoundingBox.height>=0?xb({},this.lastBoundingBox):{width:0,height:0}}},{key:"getDefaultPosition",value:function(r){var s=this.props,i=s.layout,o=s.align,l=s.verticalAlign,c=s.margin,d=s.chartWidth,u=s.chartHeight,h,m;if(!r||(r.left===void 0||r.left===null)&&(r.right===void 0||r.right===null))if(o==="center"&&i==="vertical"){var f=this.getBBoxSnapshot();h={left:((d||0)-f.width)/2}}else h=o==="right"?{right:c&&c.right||0}:{left:c&&c.left||0};if(!r||(r.top===void 0||r.top===null)&&(r.bottom===void 0||r.bottom===null))if(l==="middle"){var p=this.getBBoxSnapshot();m={top:((u||0)-p.height)/2}}else m=l==="bottom"?{bottom:c&&c.bottom||0}:{top:c&&c.top||0};return xb(xb({},h),m)}},{key:"render",value:function(){var r=this,s=this.props,i=s.content,o=s.width,l=s.height,c=s.wrapperStyle,d=s.payloadUniqBy,u=s.payload,h=xb(xb({position:"absolute",width:o||"auto",height:l||"auto"},this.getDefaultPosition(c)),c);return se.createElement("div",{className:"recharts-legend-wrapper",style:h,ref:function(f){r.wrapperNode=f}},e9r(i,xb(xb({},this.props),{},{payload:WIt(u,d,XBr)})))}}],[{key:"getWithHeight",value:function(r,s){var i=xb(xb({},this.defaultProps),r.props),o=i.layout;return o==="vertical"&&ln(r.props.height)?{height:r.props.height}:o==="horizontal"?{width:r.props.width||s}:null}}])}(y.PureComponent);Eie(o2,"displayName","Legend");Eie(o2,"defaultProps",{iconSize:14,layout:"horizontal",align:"center",verticalAlign:"bottom"});function AF(t){"@babel/helpers - typeof";return AF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},AF(t)}function Cwe(){return Cwe=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Cwe.apply(this,arguments)}function t9r(t,e){return i9r(t)||s9r(t,e)||r9r(t,e)||n9r()}function n9r(){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 r9r(t,e){if(t){if(typeof t=="string")return Yqe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Yqe(t,e)}}function Yqe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function s9r(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(u){d=!0,s=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function i9r(t){if(Array.isArray(t))return t}function Qqe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Wue(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Qqe(Object(n),!0).forEach(function(r){a9r(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Qqe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function a9r(t,e,n){return e=o9r(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function o9r(t){var e=l9r(t,"string");return AF(e)=="symbol"?e:e+""}function l9r(t,e){if(AF(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(AF(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function c9r(t){return Array.isArray(t)&&gc(t[0])&&gc(t[1])?t.join(" ~ "):t}var d9r=function(e){var n=e.separator,r=n===void 0?" : ":n,s=e.contentStyle,i=s===void 0?{}:s,o=e.itemStyle,l=o===void 0?{}:o,c=e.labelStyle,d=c===void 0?{}:c,u=e.payload,h=e.formatter,m=e.itemSorter,f=e.wrapperClassName,p=e.labelClassName,g=e.label,v=e.labelFormatter,b=e.accessibilityLayer,x=b===void 0?!1:b,w=function(){if(u&&u.length){var T={padding:0,margin:0},R=(m?Zse(u,m):u).map(function(O,F){if(O.type==="none")return null;var D=Wue({display:"block",paddingTop:4,paddingBottom:4,color:O.color||"#000"},l),I=O.formatter||h||c9r,P=O.value,M=O.name,z=P,G=M;if(I&&z!=null&&G!=null){var B=I(P,M,O,F,u);if(Array.isArray(B)){var H=t9r(B,2);z=H[0],G=H[1]}else z=B}return se.createElement("li",{className:"recharts-tooltip-item",key:"tooltip-item-".concat(F),style:D},gc(G)?se.createElement("span",{className:"recharts-tooltip-item-name"},G):null,gc(G)?se.createElement("span",{className:"recharts-tooltip-item-separator"},r):null,se.createElement("span",{className:"recharts-tooltip-item-value"},z),se.createElement("span",{className:"recharts-tooltip-item-unit"},O.unit||""))});return se.createElement("ul",{className:"recharts-tooltip-item-list",style:T},R)}return null},k=Wue({margin:0,padding:10,backgroundColor:"#fff",border:"1px solid #ccc",whiteSpace:"nowrap"},i),S=Wue({margin:0},d),C=!$r(g),j=C?g:"",E=Zn("recharts-default-tooltip",f),N=Zn("recharts-tooltip-label",p);C&&v&&u!==void 0&&u!==null&&(j=v(g,u));var A=x?{role:"status","aria-live":"assertive"}:{};return se.createElement("div",Cwe({className:E,style:k},A),se.createElement("p",{className:N,style:S},se.isValidElement(j)?j:"".concat(j)),w())};function PF(t){"@babel/helpers - typeof";return PF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},PF(t)}function iH(t,e,n){return e=u9r(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u9r(t){var e=h9r(t,"string");return PF(e)=="symbol"?e:e+""}function h9r(t,e){if(PF(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(PF(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var V3="recharts-tooltip-wrapper",m9r={visibility:"hidden"};function f9r(t){var e=t.coordinate,n=t.translateX,r=t.translateY;return Zn(V3,iH(iH(iH(iH({},"".concat(V3,"-right"),ln(n)&&e&&ln(e.x)&&n>=e.x),"".concat(V3,"-left"),ln(n)&&e&&ln(e.x)&&n<e.x),"".concat(V3,"-bottom"),ln(r)&&e&&ln(e.y)&&r>=e.y),"".concat(V3,"-top"),ln(r)&&e&&ln(e.y)&&r<e.y))}function Zqe(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.key,s=t.offsetTopLeft,i=t.position,o=t.reverseDirection,l=t.tooltipDimension,c=t.viewBox,d=t.viewBoxDimension;if(i&&ln(i[r]))return i[r];var u=n[r]-l-s,h=n[r]+s;if(e[r])return o[r]?u:h;if(o[r]){var m=u,f=c[r];return m<f?Math.max(h,c[r]):Math.max(u,c[r])}var p=h+l,g=c[r]+d;return p>g?Math.max(u,c[r]):Math.max(h,c[r])}function p9r(t){var e=t.translateX,n=t.translateY,r=t.useTranslate3d;return{transform:r?"translate3d(".concat(e,"px, ").concat(n,"px, 0)"):"translate(".concat(e,"px, ").concat(n,"px)")}}function g9r(t){var e=t.allowEscapeViewBox,n=t.coordinate,r=t.offsetTopLeft,s=t.position,i=t.reverseDirection,o=t.tooltipBox,l=t.useTranslate3d,c=t.viewBox,d,u,h;return o.height>0&&o.width>0&&n?(u=Zqe({allowEscapeViewBox:e,coordinate:n,key:"x",offsetTopLeft:r,position:s,reverseDirection:i,tooltipDimension:o.width,viewBox:c,viewBoxDimension:c.width}),h=Zqe({allowEscapeViewBox:e,coordinate:n,key:"y",offsetTopLeft:r,position:s,reverseDirection:i,tooltipDimension:o.height,viewBox:c,viewBoxDimension:c.height}),d=p9r({translateX:u,translateY:h,useTranslate3d:l})):d=m9r,{cssProperties:d,cssClasses:f9r({translateX:u,translateY:h,coordinate:n})}}function p5(t){"@babel/helpers - typeof";return p5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p5(t)}function Jqe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Xqe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Jqe(Object(n),!0).forEach(function(r){Ewe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Jqe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function v9r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function y9r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,QIt(r.key),r)}}function b9r(t,e,n){return e&&y9r(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function x9r(t,e,n){return e=PJ(e),w9r(t,YIt()?Reflect.construct(e,n||[],PJ(t).constructor):e.apply(t,n))}function w9r(t,e){if(e&&(p5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return k9r(t)}function k9r(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function YIt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(YIt=function(){return!!t})()}function PJ(t){return PJ=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},PJ(t)}function S9r(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&jwe(t,e)}function jwe(t,e){return jwe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},jwe(t,e)}function Ewe(t,e,n){return e=QIt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function QIt(t){var e=C9r(t,"string");return p5(e)=="symbol"?e:e+""}function C9r(t,e){if(p5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(p5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var eKe=1,j9r=function(t){function e(){var n;v9r(this,e);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=x9r(this,e,[].concat(s)),Ewe(n,"state",{dismissed:!1,dismissedAtCoordinate:{x:0,y:0},lastBoundingBox:{width:-1,height:-1}}),Ewe(n,"handleKeyDown",function(o){if(o.key==="Escape"){var l,c,d,u;n.setState({dismissed:!0,dismissedAtCoordinate:{x:(l=(c=n.props.coordinate)===null||c===void 0?void 0:c.x)!==null&&l!==void 0?l:0,y:(d=(u=n.props.coordinate)===null||u===void 0?void 0:u.y)!==null&&d!==void 0?d:0}})}}),n}return S9r(e,t),b9r(e,[{key:"updateBBox",value:function(){if(this.wrapperNode&&this.wrapperNode.getBoundingClientRect){var r=this.wrapperNode.getBoundingClientRect();(Math.abs(r.width-this.state.lastBoundingBox.width)>eKe||Math.abs(r.height-this.state.lastBoundingBox.height)>eKe)&&this.setState({lastBoundingBox:{width:r.width,height:r.height}})}else(this.state.lastBoundingBox.width!==-1||this.state.lastBoundingBox.height!==-1)&&this.setState({lastBoundingBox:{width:-1,height:-1}})}},{key:"componentDidMount",value:function(){document.addEventListener("keydown",this.handleKeyDown),this.updateBBox()}},{key:"componentWillUnmount",value:function(){document.removeEventListener("keydown",this.handleKeyDown)}},{key:"componentDidUpdate",value:function(){var r,s;this.props.active&&this.updateBBox(),this.state.dismissed&&(((r=this.props.coordinate)===null||r===void 0?void 0:r.x)!==this.state.dismissedAtCoordinate.x||((s=this.props.coordinate)===null||s===void 0?void 0:s.y)!==this.state.dismissedAtCoordinate.y)&&(this.state.dismissed=!1)}},{key:"render",value:function(){var r=this,s=this.props,i=s.active,o=s.allowEscapeViewBox,l=s.animationDuration,c=s.animationEasing,d=s.children,u=s.coordinate,h=s.hasPayload,m=s.isAnimationActive,f=s.offset,p=s.position,g=s.reverseDirection,v=s.useTranslate3d,b=s.viewBox,x=s.wrapperStyle,w=g9r({allowEscapeViewBox:o,coordinate:u,offsetTopLeft:f,position:p,reverseDirection:g,tooltipBox:this.state.lastBoundingBox,useTranslate3d:v,viewBox:b}),k=w.cssClasses,S=w.cssProperties,C=Xqe(Xqe({transition:m&&i?"transform ".concat(l,"ms ").concat(c):void 0},S),{},{pointerEvents:"none",visibility:!this.state.dismissed&&i&&h?"visible":"hidden",position:"absolute",top:0,left:0},x);return se.createElement("div",{tabIndex:-1,className:k,style:C,ref:function(E){r.wrapperNode=E}},d)}}])}(y.PureComponent),E9r=function(){return!(typeof window<"u"&&window.document&&window.document.createElement&&window.setTimeout)},Lf={isSsr:E9r(),get:function(e){return Lf[e]},set:function(e,n){if(typeof e=="string")Lf[e]=n;else{var r=Object.keys(e);r&&r.length&&r.forEach(function(s){Lf[s]=e[s]})}}};function g5(t){"@babel/helpers - typeof";return g5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},g5(t)}function tKe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function nKe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?tKe(Object(n),!0).forEach(function(r){l5e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tKe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function N9r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function T9r(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,JIt(r.key),r)}}function _9r(t,e,n){return e&&T9r(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function A9r(t,e,n){return e=RJ(e),P9r(t,ZIt()?Reflect.construct(e,n||[],RJ(t).constructor):e.apply(t,n))}function P9r(t,e){if(e&&(g5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return R9r(t)}function R9r(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ZIt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ZIt=function(){return!!t})()}function RJ(t){return RJ=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},RJ(t)}function I9r(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Nwe(t,e)}function Nwe(t,e){return Nwe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Nwe(t,e)}function l5e(t,e,n){return e=JIt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function JIt(t){var e=M9r(t,"string");return g5(e)=="symbol"?e:e+""}function M9r(t,e){if(g5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(g5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function L9r(t){return t.dataKey}function D9r(t,e){return se.isValidElement(t)?se.cloneElement(t,e):typeof t=="function"?se.createElement(t,e):se.createElement(d9r,e)}var bu=function(t){function e(){return N9r(this,e),A9r(this,e,arguments)}return I9r(e,t),_9r(e,[{key:"render",value:function(){var r=this,s=this.props,i=s.active,o=s.allowEscapeViewBox,l=s.animationDuration,c=s.animationEasing,d=s.content,u=s.coordinate,h=s.filterNull,m=s.isAnimationActive,f=s.offset,p=s.payload,g=s.payloadUniqBy,v=s.position,b=s.reverseDirection,x=s.useTranslate3d,w=s.viewBox,k=s.wrapperStyle,S=p??[];h&&S.length&&(S=WIt(p.filter(function(j){return j.value!=null&&(j.hide!==!0||r.props.includeHidden)}),g,L9r));var C=S.length>0;return se.createElement(j9r,{allowEscapeViewBox:o,animationDuration:l,animationEasing:c,isAnimationActive:m,active:i,coordinate:u,hasPayload:C,offset:f,position:v,reverseDirection:b,useTranslate3d:x,viewBox:w,wrapperStyle:k},D9r(d,nKe(nKe({},this.props),{},{payload:S})))}}])}(y.PureComponent);l5e(bu,"displayName","Tooltip");l5e(bu,"defaultProps",{accessibilityLayer:!1,allowEscapeViewBox:{x:!1,y:!1},animationDuration:400,animationEasing:"ease",contentStyle:{},coordinate:{x:0,y:0},cursor:!0,cursorStyle:{},filterNull:!0,isAnimationActive:!Lf.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 $9r=Zg,O9r=function(){return $9r.Date.now()},F9r=O9r,B9r=ip,que=F9r,rKe=aPt,U9r="Expected a function",z9r=Math.max,V9r=Math.min;function H9r(t,e,n){var r,s,i,o,l,c,d=0,u=!1,h=!1,m=!0;if(typeof t!="function")throw new TypeError(U9r);e=rKe(e)||0,B9r(n)&&(u=!!n.leading,h="maxWait"in n,i=h?z9r(rKe(n.maxWait)||0,e):i,m="trailing"in n?!!n.trailing:m);function f(C){var j=r,E=s;return r=s=void 0,d=C,o=t.apply(E,j),o}function p(C){return d=C,l=setTimeout(b,e),u?f(C):o}function g(C){var j=C-c,E=C-d,N=e-j;return h?V9r(N,i-E):N}function v(C){var j=C-c,E=C-d;return c===void 0||j>=e||j<0||h&&E>=i}function b(){var C=que();if(v(C))return x(C);l=setTimeout(b,g(C))}function x(C){return l=void 0,m&&r?f(C):(r=s=void 0,o)}function w(){l!==void 0&&clearTimeout(l),d=0,r=c=s=l=void 0}function k(){return l===void 0?o:x(que())}function S(){var C=que(),j=v(C);if(r=arguments,s=this,c=C,j){if(l===void 0)return p(c);if(h)return clearTimeout(l),l=setTimeout(b,e),f(c)}return l===void 0&&(l=setTimeout(b,e)),o}return S.cancel=w,S.flush=k,S}var G9r=H9r,W9r=G9r,q9r=ip,K9r="Expected a function";function Y9r(t,e,n){var r=!0,s=!0;if(typeof t!="function")throw new TypeError(K9r);return q9r(n)&&(r="leading"in n?!!n.leading:r,s="trailing"in n?!!n.trailing:s),W9r(t,e,{leading:r,maxWait:e,trailing:s})}var Q9r=Y9r;const XIt=Fs(Q9r);function RF(t){"@babel/helpers - typeof";return RF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},RF(t)}function sKe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function aH(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?sKe(Object(n),!0).forEach(function(r){Z9r(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):sKe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Z9r(t,e,n){return e=J9r(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function J9r(t){var e=X9r(t,"string");return RF(e)=="symbol"?e:e+""}function X9r(t,e){if(RF(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(RF(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function eUr(t,e){return sUr(t)||rUr(t,e)||nUr(t,e)||tUr()}function tUr(){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 nUr(t,e){if(t){if(typeof t=="string")return iKe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return iKe(t,e)}}function iKe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function rUr(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(u){d=!0,s=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function sUr(t){if(Array.isArray(t))return t}var QM=y.forwardRef(function(t,e){var n=t.aspect,r=t.initialDimension,s=r===void 0?{width:-1,height:-1}:r,i=t.width,o=i===void 0?"100%":i,l=t.height,c=l===void 0?"100%":l,d=t.minWidth,u=d===void 0?0:d,h=t.minHeight,m=t.maxHeight,f=t.children,p=t.debounce,g=p===void 0?0:p,v=t.id,b=t.className,x=t.onResize,w=t.style,k=w===void 0?{}:w,S=y.useRef(null),C=y.useRef();C.current=x,y.useImperativeHandle(e,function(){return Object.defineProperty(S.current,"current",{get:function(){return console.warn("The usage of ref.current.current is deprecated and will no longer be supported."),S.current},configurable:!0})});var j=y.useState({containerWidth:s.width,containerHeight:s.height}),E=eUr(j,2),N=E[0],A=E[1],_=y.useCallback(function(R,O){A(function(F){var D=Math.round(R),I=Math.round(O);return F.containerWidth===D&&F.containerHeight===I?F:{containerWidth:D,containerHeight:I}})},[]);y.useEffect(function(){var R=function(M){var z,G=M[0].contentRect,B=G.width,H=G.height;_(B,H),(z=C.current)===null||z===void 0||z.call(C,B,H)};g>0&&(R=XIt(R,g,{trailing:!0,leading:!1}));var O=new ResizeObserver(R),F=S.current.getBoundingClientRect(),D=F.width,I=F.height;return _(D,I),O.observe(S.current),function(){O.disconnect()}},[_,g]);var T=y.useMemo(function(){var R=N.containerWidth,O=N.containerHeight;if(R<0||O<0)return null;Eg(Tj(o)||Tj(c),`The width(%s) and height(%s) are both fixed numbers,
       maybe you don't need to use a ResponsiveContainer.`,o,c),Eg(!n||n>0,"The aspect(%s) must be greater than zero.",n);var F=Tj(o)?R:o,D=Tj(c)?O:c;n&&n>0&&(F?D=F/n:D&&(F=D*n),m&&D>m&&(D=m)),Eg(F>0||D>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.`,F,D,o,c,u,h,n);var I=!Array.isArray(f)&&Px(f.type).endsWith("Chart");return se.Children.map(f,function(P){return se.isValidElement(P)?y.cloneElement(P,aH({width:F,height:D},I?{style:aH({height:"100%",width:"100%",maxHeight:D,maxWidth:F},P.props.style)}:{})):P})},[n,f,c,m,h,u,N,o]);return se.createElement("div",{id:v?"".concat(v):void 0,className:Zn("recharts-responsive-container",b),style:aH(aH({},k),{},{width:o,height:c,minWidth:u,minHeight:h,maxHeight:m}),ref:S},T)}),C9=function(e){return null};C9.displayName="Cell";function IF(t){"@babel/helpers - typeof";return IF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},IF(t)}function aKe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Twe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?aKe(Object(n),!0).forEach(function(r){iUr(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):aKe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function iUr(t,e,n){return e=aUr(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function aUr(t){var e=oUr(t,"string");return IF(e)=="symbol"?e:e+""}function oUr(t,e){if(IF(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(IF(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var MT={widthCache:{},cacheCount:0},lUr=2e3,cUr={position:"absolute",top:"-20000px",left:0,padding:0,margin:0,border:"none",whiteSpace:"pre"},oKe="recharts_measurement_span";function dUr(t){var e=Twe({},t);return Object.keys(e).forEach(function(n){e[n]||delete e[n]}),e}var L$=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(e==null||Lf.isSsr)return{width:0,height:0};var r=dUr(n),s=JSON.stringify({text:e,copyStyle:r});if(MT.widthCache[s])return MT.widthCache[s];try{var i=document.getElementById(oKe);i||(i=document.createElement("span"),i.setAttribute("id",oKe),i.setAttribute("aria-hidden","true"),document.body.appendChild(i));var o=Twe(Twe({},cUr),r);Object.assign(i.style,o),i.textContent="".concat(e);var l=i.getBoundingClientRect(),c={width:l.width,height:l.height};return MT.widthCache[s]=c,++MT.cacheCount>lUr&&(MT.cacheCount=0,MT.widthCache={}),c}catch{return{width:0,height:0}}},uUr=function(e){return{top:e.top+window.scrollY-document.documentElement.clientTop,left:e.left+window.scrollX-document.documentElement.clientLeft}};function MF(t){"@babel/helpers - typeof";return MF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},MF(t)}function IJ(t,e){return pUr(t)||fUr(t,e)||mUr(t,e)||hUr()}function hUr(){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 mUr(t,e){if(t){if(typeof t=="string")return lKe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return lKe(t,e)}}function lKe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function fUr(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(u){d=!0,s=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function pUr(t){if(Array.isArray(t))return t}function gUr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function cKe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,yUr(r.key),r)}}function vUr(t,e,n){return e&&cKe(t.prototype,e),n&&cKe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function yUr(t){var e=bUr(t,"string");return MF(e)=="symbol"?e:e+""}function bUr(t,e){if(MF(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(MF(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var dKe=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([*/])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,uKe=/(-?\d+(?:\.\d+)?[a-zA-Z%]*)([+-])(-?\d+(?:\.\d+)?[a-zA-Z%]*)/,xUr=/^px|cm|vh|vw|em|rem|%|mm|in|pt|pc|ex|ch|vmin|vmax|Q$/,wUr=/(-?\d+(?:\.\d+)?)([a-zA-Z%]+)?/,eMt={cm:96/2.54,mm:96/25.4,pt:96/72,pc:96/6,in:96,Q:96/(2.54*40),px:1},kUr=Object.keys(eMt),bA="NaN";function SUr(t,e){return t*eMt[e]}var oH=function(){function t(e,n){gUr(this,t),this.num=e,this.unit=n,this.num=e,this.unit=n,Number.isNaN(e)&&(this.unit=""),n!==""&&!xUr.test(n)&&(this.num=NaN,this.unit=""),kUr.includes(n)&&(this.num=SUr(e,n),this.unit="px")}return vUr(t,[{key:"add",value:function(n){return this.unit!==n.unit?new t(NaN,""):new t(this.num+n.num,this.unit)}},{key:"subtract",value:function(n){return this.unit!==n.unit?new t(NaN,""):new t(this.num-n.num,this.unit)}},{key:"multiply",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new t(NaN,""):new t(this.num*n.num,this.unit||n.unit)}},{key:"divide",value:function(n){return this.unit!==""&&n.unit!==""&&this.unit!==n.unit?new t(NaN,""):new t(this.num/n.num,this.unit||n.unit)}},{key:"toString",value:function(){return"".concat(this.num).concat(this.unit)}},{key:"isNaN",value:function(){return Number.isNaN(this.num)}}],[{key:"parse",value:function(n){var r,s=(r=wUr.exec(n))!==null&&r!==void 0?r:[],i=IJ(s,3),o=i[1],l=i[2];return new t(parseFloat(o),l??"")}}])}();function tMt(t){if(t.includes(bA))return bA;for(var e=t;e.includes("*")||e.includes("/");){var n,r=(n=dKe.exec(e))!==null&&n!==void 0?n:[],s=IJ(r,4),i=s[1],o=s[2],l=s[3],c=oH.parse(i??""),d=oH.parse(l??""),u=o==="*"?c.multiply(d):c.divide(d);if(u.isNaN())return bA;e=e.replace(dKe,u.toString())}for(;e.includes("+")||/.-\d+(?:\.\d+)?/.test(e);){var h,m=(h=uKe.exec(e))!==null&&h!==void 0?h:[],f=IJ(m,4),p=f[1],g=f[2],v=f[3],b=oH.parse(p??""),x=oH.parse(v??""),w=g==="+"?b.add(x):b.subtract(x);if(w.isNaN())return bA;e=e.replace(uKe,w.toString())}return e}var hKe=/\(([^()]*)\)/;function CUr(t){for(var e=t;e.includes("(");){var n=hKe.exec(e),r=IJ(n,2),s=r[1];e=e.replace(hKe,tMt(s))}return e}function jUr(t){var e=t.replace(/\s+/g,"");return e=CUr(e),e=tMt(e),e}function EUr(t){try{return jUr(t)}catch{return bA}}function Kue(t){var e=EUr(t.slice(5,-1));return e===bA?"":e}var NUr=["x","y","lineHeight","capHeight","scaleToFit","textAnchor","verticalAnchor","fill"],TUr=["dx","dy","angle","className","breakAll"];function _we(){return _we=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},_we.apply(this,arguments)}function mKe(t,e){if(t==null)return{};var n=_Ur(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function _Ur(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function fKe(t,e){return IUr(t)||RUr(t,e)||PUr(t,e)||AUr()}function AUr(){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 PUr(t,e){if(t){if(typeof t=="string")return pKe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return pKe(t,e)}}function pKe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function RUr(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(t)).next,e===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(u){d=!0,s=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function IUr(t){if(Array.isArray(t))return t}var nMt=/[ \f\n\r\t\v\u2028\u2029]+/,rMt=function(e){var n=e.children,r=e.breakAll,s=e.style;try{var i=[];$r(n)||(r?i=n.toString().split(""):i=n.toString().split(nMt));var o=i.map(function(c){return{word:c,width:L$(c,s).width}}),l=r?0:L$(" ",s).width;return{wordsWithComputedWidth:o,spaceWidth:l}}catch{return null}},MUr=function(e,n,r,s,i){var o=e.maxLines,l=e.children,c=e.style,d=e.breakAll,u=ln(o),h=l,m=function(){var F=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];return F.reduce(function(D,I){var P=I.word,M=I.width,z=D[D.length-1];if(z&&(s==null||i||z.width+M+r<Number(s)))z.words.push(P),z.width+=M+r;else{var G={words:[P],width:M};D.push(G)}return D},[])},f=m(n),p=function(F){return F.reduce(function(D,I){return D.width>I.width?D:I})};if(!u)return f;for(var g="…",v=function(F){var D=h.slice(0,F),I=rMt({breakAll:d,style:c,children:D+g}).wordsWithComputedWidth,P=m(I),M=P.length>o||p(P).width>Number(s);return[M,P]},b=0,x=h.length-1,w=0,k;b<=x&&w<=h.length-1;){var S=Math.floor((b+x)/2),C=S-1,j=v(C),E=fKe(j,2),N=E[0],A=E[1],_=v(S),T=fKe(_,1),R=T[0];if(!N&&!R&&(b=S+1),N&&R&&(x=S-1),!N&&R){k=A;break}w++}return k||f},gKe=function(e){var n=$r(e)?[]:e.toString().split(nMt);return[{words:n}]},LUr=function(e){var n=e.width,r=e.scaleToFit,s=e.children,i=e.style,o=e.breakAll,l=e.maxLines;if((n||r)&&!Lf.isSsr){var c,d,u=rMt({breakAll:o,children:s,style:i});if(u){var h=u.wordsWithComputedWidth,m=u.spaceWidth;c=h,d=m}else return gKe(s);return MUr({breakAll:o,children:s,maxLines:l,style:i},c,d,n,r)}return gKe(s)},vKe="#808080",oE=function(e){var n=e.x,r=n===void 0?0:n,s=e.y,i=s===void 0?0:s,o=e.lineHeight,l=o===void 0?"1em":o,c=e.capHeight,d=c===void 0?"0.71em":c,u=e.scaleToFit,h=u===void 0?!1:u,m=e.textAnchor,f=m===void 0?"start":m,p=e.verticalAnchor,g=p===void 0?"end":p,v=e.fill,b=v===void 0?vKe:v,x=mKe(e,NUr),w=y.useMemo(function(){return LUr({breakAll:x.breakAll,children:x.children,maxLines:x.maxLines,scaleToFit:h,style:x.style,width:x.width})},[x.breakAll,x.children,x.maxLines,h,x.style,x.width]),k=x.dx,S=x.dy,C=x.angle,j=x.className,E=x.breakAll,N=mKe(x,TUr);if(!gc(r)||!gc(i))return null;var A=r+(ln(k)?k:0),_=i+(ln(S)?S:0),T;switch(g){case"start":T=Kue("calc(".concat(d,")"));break;case"middle":T=Kue("calc(".concat((w.length-1)/2," * -").concat(l," + (").concat(d," / 2))"));break;default:T=Kue("calc(".concat(w.length-1," * -").concat(l,")"));break}var R=[];if(h){var O=w[0].width,F=x.width;R.push("scale(".concat((ln(F)?F/O:1)/O,")"))}return C&&R.push("rotate(".concat(C,", ").concat(A,", ").concat(_,")")),R.length&&(N.transform=R.join(" ")),se.createElement("text",_we({},hr(N,!0),{x:A,y:_,className:Zn("recharts-text",j),textAnchor:f,fill:b.includes("url")?vKe:b}),w.map(function(D,I){var P=D.words.join(E?"":" ");return se.createElement("tspan",{x:A,dy:I===0?T:l,key:"".concat(P,"-").concat(I)},P)}))};function hk(t,e){return t==null||e==null?NaN:t<e?-1:t>e?1:t>=e?0:NaN}function DUr(t,e){return t==null||e==null?NaN:e<t?-1:e>t?1:e>=t?0:NaN}function c5e(t){let e,n,r;t.length!==2?(e=hk,n=(l,c)=>hk(t(l),c),r=(l,c)=>t(l)-c):(e=t===hk||t===DUr?t:$Ur,n=t,r=t);function s(l,c,d=0,u=l.length){if(d<u){if(e(c,c)!==0)return u;do{const h=d+u>>>1;n(l[h],c)<0?d=h+1:u=h}while(d<u)}return d}function i(l,c,d=0,u=l.length){if(d<u){if(e(c,c)!==0)return u;do{const h=d+u>>>1;n(l[h],c)<=0?d=h+1:u=h}while(d<u)}return d}function o(l,c,d=0,u=l.length){const h=s(l,c,d,u-1);return h>d&&r(l[h-1],c)>-r(l[h],c)?h-1:h}return{left:s,center:o,right:i}}function $Ur(){return 0}function sMt(t){return t===null?NaN:+t}function*OUr(t,e){for(let n of t)n!=null&&(n=+n)>=n&&(yield n)}const FUr=c5e(hk),j9=FUr.right;c5e(sMt).center;class yKe extends Map{constructor(e,n=zUr){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:n}}),e!=null)for(const[r,s]of e)this.set(r,s)}get(e){return super.get(bKe(this,e))}has(e){return super.has(bKe(this,e))}set(e,n){return super.set(BUr(this,e),n)}delete(e){return super.delete(UUr(this,e))}}function bKe({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):n}function BUr({_intern:t,_key:e},n){const r=e(n);return t.has(r)?t.get(r):(t.set(r,n),n)}function UUr({_intern:t,_key:e},n){const r=e(n);return t.has(r)&&(n=t.get(r),t.delete(r)),n}function zUr(t){return t!==null&&typeof t=="object"?t.valueOf():t}function VUr(t=hk){if(t===hk)return iMt;if(typeof t!="function")throw new TypeError("compare is not a function");return(e,n)=>{const r=t(e,n);return r||r===0?r:(t(n,n)===0)-(t(e,e)===0)}}function iMt(t,e){return(t==null||!(t>=t))-(e==null||!(e>=e))||(t<e?-1:t>e?1:0)}const HUr=Math.sqrt(50),GUr=Math.sqrt(10),WUr=Math.sqrt(2);function MJ(t,e,n){const r=(e-t)/Math.max(0,n),s=Math.floor(Math.log10(r)),i=r/Math.pow(10,s),o=i>=HUr?10:i>=GUr?5:i>=WUr?2:1;let l,c,d;return s<0?(d=Math.pow(10,-s)/o,l=Math.round(t*d),c=Math.round(e*d),l/d<t&&++l,c/d>e&&--c,d=-d):(d=Math.pow(10,s)*o,l=Math.round(t/d),c=Math.round(e/d),l*d<t&&++l,c*d>e&&--c),c<l&&.5<=n&&n<2?MJ(t,e,n*2):[l,c,d]}function Awe(t,e,n){if(e=+e,t=+t,n=+n,!(n>0))return[];if(t===e)return[t];const r=e<t,[s,i,o]=r?MJ(e,t,n):MJ(t,e,n);if(!(i>=s))return[];const l=i-s+1,c=new Array(l);if(r)if(o<0)for(let d=0;d<l;++d)c[d]=(i-d)/-o;else for(let d=0;d<l;++d)c[d]=(i-d)*o;else if(o<0)for(let d=0;d<l;++d)c[d]=(s+d)/-o;else for(let d=0;d<l;++d)c[d]=(s+d)*o;return c}function Pwe(t,e,n){return e=+e,t=+t,n=+n,MJ(t,e,n)[2]}function Rwe(t,e,n){e=+e,t=+t,n=+n;const r=e<t,s=r?Pwe(e,t,n):Pwe(t,e,n);return(r?-1:1)*(s<0?1/-s:s)}function xKe(t,e){let n;for(const r of t)r!=null&&(n<r||n===void 0&&r>=r)&&(n=r);return n}function wKe(t,e){let n;for(const r of t)r!=null&&(n>r||n===void 0&&r>=r)&&(n=r);return n}function aMt(t,e,n=0,r=1/0,s){if(e=Math.floor(e),n=Math.floor(Math.max(0,n)),r=Math.floor(Math.min(t.length-1,r)),!(n<=e&&e<=r))return t;for(s=s===void 0?iMt:VUr(s);r>n;){if(r-n>600){const c=r-n+1,d=e-n+1,u=Math.log(c),h=.5*Math.exp(2*u/3),m=.5*Math.sqrt(u*h*(c-h)/c)*(d-c/2<0?-1:1),f=Math.max(n,Math.floor(e-d*h/c+m)),p=Math.min(r,Math.floor(e+(c-d)*h/c+m));aMt(t,e,f,p,s)}const i=t[e];let o=n,l=r;for(H3(t,n,e),s(t[r],i)>0&&H3(t,n,r);o<l;){for(H3(t,o,l),++o,--l;s(t[o],i)<0;)++o;for(;s(t[l],i)>0;)--l}s(t[n],i)===0?H3(t,n,l):(++l,H3(t,l,r)),l<=e&&(n=l+1),e<=l&&(r=l-1)}return t}function H3(t,e,n){const r=t[e];t[e]=t[n],t[n]=r}function qUr(t,e,n){if(t=Float64Array.from(OUr(t)),!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return wKe(t);if(e>=1)return xKe(t);var r,s=(r-1)*e,i=Math.floor(s),o=xKe(aMt(t,i).subarray(0,i+1)),l=wKe(t.subarray(i+1));return o+(l-o)*(s-i)}}function KUr(t,e,n=sMt){if(!(!(r=t.length)||isNaN(e=+e))){if(e<=0||r<2)return+n(t[0],0,t);if(e>=1)return+n(t[r-1],r-1,t);var r,s=(r-1)*e,i=Math.floor(s),o=+n(t[i],i,t),l=+n(t[i+1],i+1,t);return o+(l-o)*(s-i)}}function YUr(t,e,n){t=+t,e=+e,n=(s=arguments.length)<2?(e=t,t=0,1):s<3?1:+n;for(var r=-1,s=Math.max(0,Math.ceil((e-t)/n))|0,i=new Array(s);++r<s;)i[r]=t+r*n;return i}function lp(t,e){switch(arguments.length){case 0:break;case 1:this.range(t);break;default:this.range(e).domain(t);break}return this}function z0(t,e){switch(arguments.length){case 0:break;case 1:{typeof t=="function"?this.interpolator(t):this.range(t);break}default:{this.domain(t),typeof e=="function"?this.interpolator(e):this.range(e);break}}return this}const Iwe=Symbol("implicit");function d5e(){var t=new yKe,e=[],n=[],r=Iwe;function s(i){let o=t.get(i);if(o===void 0){if(r!==Iwe)return r;t.set(i,o=e.push(i)-1)}return n[o%n.length]}return s.domain=function(i){if(!arguments.length)return e.slice();e=[],t=new yKe;for(const o of i)t.has(o)||t.set(o,e.push(o)-1);return s},s.range=function(i){return arguments.length?(n=Array.from(i),s):n.slice()},s.unknown=function(i){return arguments.length?(r=i,s):r},s.copy=function(){return d5e(e,n).unknown(r)},lp.apply(s,arguments),s}function LF(){var t=d5e().unknown(void 0),e=t.domain,n=t.range,r=0,s=1,i,o,l=!1,c=0,d=0,u=.5;delete t.unknown;function h(){var m=e().length,f=s<r,p=f?s:r,g=f?r:s;i=(g-p)/Math.max(1,m-c+d*2),l&&(i=Math.floor(i)),p+=(g-p-i*(m-c))*u,o=i*(1-c),l&&(p=Math.round(p),o=Math.round(o));var v=YUr(m).map(function(b){return p+i*b});return n(f?v.reverse():v)}return t.domain=function(m){return arguments.length?(e(m),h()):e()},t.range=function(m){return arguments.length?([r,s]=m,r=+r,s=+s,h()):[r,s]},t.rangeRound=function(m){return[r,s]=m,r=+r,s=+s,l=!0,h()},t.bandwidth=function(){return o},t.step=function(){return i},t.round=function(m){return arguments.length?(l=!!m,h()):l},t.padding=function(m){return arguments.length?(c=Math.min(1,d=+m),h()):c},t.paddingInner=function(m){return arguments.length?(c=Math.min(1,m),h()):c},t.paddingOuter=function(m){return arguments.length?(d=+m,h()):d},t.align=function(m){return arguments.length?(u=Math.max(0,Math.min(1,m)),h()):u},t.copy=function(){return LF(e(),[r,s]).round(l).paddingInner(c).paddingOuter(d).align(u)},lp.apply(h(),arguments)}function oMt(t){var e=t.copy;return t.padding=t.paddingOuter,delete t.paddingInner,delete t.paddingOuter,t.copy=function(){return oMt(e())},t}function D$(){return oMt(LF.apply(null,arguments).paddingInner(1))}function u5e(t,e,n){t.prototype=e.prototype=n,n.constructor=t}function lMt(t,e){var n=Object.create(t.prototype);for(var r in e)n[r]=e[r];return n}function E9(){}var DF=.7,LJ=1/DF,fP="\\s*([+-]?\\d+)\\s*",$F="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",Sy="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",QUr=/^#([0-9a-f]{3,8})$/,ZUr=new RegExp(`^rgb\\(${fP},${fP},${fP}\\)$`),JUr=new RegExp(`^rgb\\(${Sy},${Sy},${Sy}\\)$`),XUr=new RegExp(`^rgba\\(${fP},${fP},${fP},${$F}\\)$`),ezr=new RegExp(`^rgba\\(${Sy},${Sy},${Sy},${$F}\\)$`),tzr=new RegExp(`^hsl\\(${$F},${Sy},${Sy}\\)$`),nzr=new RegExp(`^hsla\\(${$F},${Sy},${Sy},${$F}\\)$`),kKe={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074};u5e(E9,lE,{copy(t){return Object.assign(new this.constructor,this,t)},displayable(){return this.rgb().displayable()},hex:SKe,formatHex:SKe,formatHex8:rzr,formatHsl:szr,formatRgb:CKe,toString:CKe});function SKe(){return this.rgb().formatHex()}function rzr(){return this.rgb().formatHex8()}function szr(){return cMt(this).formatHsl()}function CKe(){return this.rgb().formatRgb()}function lE(t){var e,n;return t=(t+"").trim().toLowerCase(),(e=QUr.exec(t))?(n=e[1].length,e=parseInt(e[1],16),n===6?jKe(e):n===3?new ph(e>>8&15|e>>4&240,e>>4&15|e&240,(e&15)<<4|e&15,1):n===8?lH(e>>24&255,e>>16&255,e>>8&255,(e&255)/255):n===4?lH(e>>12&15|e>>8&240,e>>8&15|e>>4&240,e>>4&15|e&240,((e&15)<<4|e&15)/255):null):(e=ZUr.exec(t))?new ph(e[1],e[2],e[3],1):(e=JUr.exec(t))?new ph(e[1]*255/100,e[2]*255/100,e[3]*255/100,1):(e=XUr.exec(t))?lH(e[1],e[2],e[3],e[4]):(e=ezr.exec(t))?lH(e[1]*255/100,e[2]*255/100,e[3]*255/100,e[4]):(e=tzr.exec(t))?TKe(e[1],e[2]/100,e[3]/100,1):(e=nzr.exec(t))?TKe(e[1],e[2]/100,e[3]/100,e[4]):kKe.hasOwnProperty(t)?jKe(kKe[t]):t==="transparent"?new ph(NaN,NaN,NaN,0):null}function jKe(t){return new ph(t>>16&255,t>>8&255,t&255,1)}function lH(t,e,n,r){return r<=0&&(t=e=n=NaN),new ph(t,e,n,r)}function izr(t){return t instanceof E9||(t=lE(t)),t?(t=t.rgb(),new ph(t.r,t.g,t.b,t.opacity)):new ph}function Mwe(t,e,n,r){return arguments.length===1?izr(t):new ph(t,e,n,r??1)}function ph(t,e,n,r){this.r=+t,this.g=+e,this.b=+n,this.opacity=+r}u5e(ph,Mwe,lMt(E9,{brighter(t){return t=t==null?LJ:Math.pow(LJ,t),new ph(this.r*t,this.g*t,this.b*t,this.opacity)},darker(t){return t=t==null?DF:Math.pow(DF,t),new ph(this.r*t,this.g*t,this.b*t,this.opacity)},rgb(){return this},clamp(){return new ph(l2(this.r),l2(this.g),l2(this.b),DJ(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:EKe,formatHex:EKe,formatHex8:azr,formatRgb:NKe,toString:NKe}));function EKe(){return`#${_j(this.r)}${_j(this.g)}${_j(this.b)}`}function azr(){return`#${_j(this.r)}${_j(this.g)}${_j(this.b)}${_j((isNaN(this.opacity)?1:this.opacity)*255)}`}function NKe(){const t=DJ(this.opacity);return`${t===1?"rgb(":"rgba("}${l2(this.r)}, ${l2(this.g)}, ${l2(this.b)}${t===1?")":`, ${t})`}`}function DJ(t){return isNaN(t)?1:Math.max(0,Math.min(1,t))}function l2(t){return Math.max(0,Math.min(255,Math.round(t)||0))}function _j(t){return t=l2(t),(t<16?"0":"")+t.toString(16)}function TKe(t,e,n,r){return r<=0?t=e=n=NaN:n<=0||n>=1?t=e=NaN:e<=0&&(t=NaN),new pg(t,e,n,r)}function cMt(t){if(t instanceof pg)return new pg(t.h,t.s,t.l,t.opacity);if(t instanceof E9||(t=lE(t)),!t)return new pg;if(t instanceof pg)return t;t=t.rgb();var e=t.r/255,n=t.g/255,r=t.b/255,s=Math.min(e,n,r),i=Math.max(e,n,r),o=NaN,l=i-s,c=(i+s)/2;return l?(e===i?o=(n-r)/l+(n<r)*6:n===i?o=(r-e)/l+2:o=(e-n)/l+4,l/=c<.5?i+s:2-i-s,o*=60):l=c>0&&c<1?0:o,new pg(o,l,c,t.opacity)}function ozr(t,e,n,r){return arguments.length===1?cMt(t):new pg(t,e,n,r??1)}function pg(t,e,n,r){this.h=+t,this.s=+e,this.l=+n,this.opacity=+r}u5e(pg,ozr,lMt(E9,{brighter(t){return t=t==null?LJ:Math.pow(LJ,t),new pg(this.h,this.s,this.l*t,this.opacity)},darker(t){return t=t==null?DF:Math.pow(DF,t),new pg(this.h,this.s,this.l*t,this.opacity)},rgb(){var t=this.h%360+(this.h<0)*360,e=isNaN(t)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*e,s=2*n-r;return new ph(Yue(t>=240?t-240:t+120,s,r),Yue(t,s,r),Yue(t<120?t+240:t-120,s,r),this.opacity)},clamp(){return new pg(_Ke(this.h),cH(this.s),cH(this.l),DJ(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 t=DJ(this.opacity);return`${t===1?"hsl(":"hsla("}${_Ke(this.h)}, ${cH(this.s)*100}%, ${cH(this.l)*100}%${t===1?")":`, ${t})`}`}}));function _Ke(t){return t=(t||0)%360,t<0?t+360:t}function cH(t){return Math.max(0,Math.min(1,t||0))}function Yue(t,e,n){return(t<60?e+(n-e)*t/60:t<180?n:t<240?e+(n-e)*(240-t)/60:e)*255}const h5e=t=>()=>t;function lzr(t,e){return function(n){return t+n*e}}function czr(t,e,n){return t=Math.pow(t,n),e=Math.pow(e,n)-t,n=1/n,function(r){return Math.pow(t+r*e,n)}}function dzr(t){return(t=+t)==1?dMt:function(e,n){return n-e?czr(e,n,t):h5e(isNaN(e)?n:e)}}function dMt(t,e){var n=e-t;return n?lzr(t,n):h5e(isNaN(t)?e:t)}const $J=function t(e){var n=dzr(e);function r(s,i){var o=n((s=Mwe(s)).r,(i=Mwe(i)).r),l=n(s.g,i.g),c=n(s.b,i.b),d=dMt(s.opacity,i.opacity);return function(u){return s.r=o(u),s.g=l(u),s.b=c(u),s.opacity=d(u),s+""}}return r.gamma=t,r}(1);function uzr(t,e){e||(e=[]);var n=t?Math.min(e.length,t.length):0,r=e.slice(),s;return function(i){for(s=0;s<n;++s)r[s]=t[s]*(1-i)+e[s]*i;return r}}function hzr(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function mzr(t,e){var n=e?e.length:0,r=t?Math.min(n,t.length):0,s=new Array(r),i=new Array(n),o;for(o=0;o<r;++o)s[o]=Rx(t[o],e[o]);for(;o<n;++o)i[o]=e[o];return function(l){for(o=0;o<r;++o)i[o]=s[o](l);return i}}function fzr(t,e){var n=new Date;return t=+t,e=+e,function(r){return n.setTime(t*(1-r)+e*r),n}}function cg(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function pzr(t,e){var n={},r={},s;(t===null||typeof t!="object")&&(t={}),(e===null||typeof e!="object")&&(e={});for(s in e)s in t?n[s]=Rx(t[s],e[s]):r[s]=e[s];return function(i){for(s in n)r[s]=n[s](i);return r}}var Lwe=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Que=new RegExp(Lwe.source,"g");function gzr(t){return function(){return t}}function vzr(t){return function(e){return t(e)+""}}function uMt(t,e){var n=Lwe.lastIndex=Que.lastIndex=0,r,s,i,o=-1,l=[],c=[];for(t=t+"",e=e+"";(r=Lwe.exec(t))&&(s=Que.exec(e));)(i=s.index)>n&&(i=e.slice(n,i),l[o]?l[o]+=i:l[++o]=i),(r=r[0])===(s=s[0])?l[o]?l[o]+=s:l[++o]=s:(l[++o]=null,c.push({i:o,x:cg(r,s)})),n=Que.lastIndex;return n<e.length&&(i=e.slice(n),l[o]?l[o]+=i:l[++o]=i),l.length<2?c[0]?vzr(c[0].x):gzr(e):(e=c.length,function(d){for(var u=0,h;u<e;++u)l[(h=c[u]).i]=h.x(d);return l.join("")})}function Rx(t,e){var n=typeof e,r;return e==null||n==="boolean"?h5e(e):(n==="number"?cg:n==="string"?(r=lE(e))?(e=r,$J):uMt:e instanceof lE?$J:e instanceof Date?fzr:hzr(e)?uzr:Array.isArray(e)?mzr:typeof e.valueOf!="function"&&typeof e.toString!="function"||isNaN(e)?pzr:cg)(t,e)}function m5e(t,e){return t=+t,e=+e,function(n){return Math.round(t*(1-n)+e*n)}}var AKe=180/Math.PI,Dwe={translateX:0,translateY:0,rotate:0,skewX:0,scaleX:1,scaleY:1};function hMt(t,e,n,r,s,i){var o,l,c;return(o=Math.sqrt(t*t+e*e))&&(t/=o,e/=o),(c=t*n+e*r)&&(n-=t*c,r-=e*c),(l=Math.sqrt(n*n+r*r))&&(n/=l,r/=l,c/=l),t*r<e*n&&(t=-t,e=-e,c=-c,o=-o),{translateX:s,translateY:i,rotate:Math.atan2(e,t)*AKe,skewX:Math.atan(c)*AKe,scaleX:o,scaleY:l}}var dH;function yzr(t){const e=new(typeof DOMMatrix=="function"?DOMMatrix:WebKitCSSMatrix)(t+"");return e.isIdentity?Dwe:hMt(e.a,e.b,e.c,e.d,e.e,e.f)}function bzr(t){return t==null||(dH||(dH=document.createElementNS("http://www.w3.org/2000/svg","g")),dH.setAttribute("transform",t),!(t=dH.transform.baseVal.consolidate()))?Dwe:(t=t.matrix,hMt(t.a,t.b,t.c,t.d,t.e,t.f))}function mMt(t,e,n,r){function s(d){return d.length?d.pop()+" ":""}function i(d,u,h,m,f,p){if(d!==h||u!==m){var g=f.push("translate(",null,e,null,n);p.push({i:g-4,x:cg(d,h)},{i:g-2,x:cg(u,m)})}else(h||m)&&f.push("translate("+h+e+m+n)}function o(d,u,h,m){d!==u?(d-u>180?u+=360:u-d>180&&(d+=360),m.push({i:h.push(s(h)+"rotate(",null,r)-2,x:cg(d,u)})):u&&h.push(s(h)+"rotate("+u+r)}function l(d,u,h,m){d!==u?m.push({i:h.push(s(h)+"skewX(",null,r)-2,x:cg(d,u)}):u&&h.push(s(h)+"skewX("+u+r)}function c(d,u,h,m,f,p){if(d!==h||u!==m){var g=f.push(s(f)+"scale(",null,",",null,")");p.push({i:g-4,x:cg(d,h)},{i:g-2,x:cg(u,m)})}else(h!==1||m!==1)&&f.push(s(f)+"scale("+h+","+m+")")}return function(d,u){var h=[],m=[];return d=t(d),u=t(u),i(d.translateX,d.translateY,u.translateX,u.translateY,h,m),o(d.rotate,u.rotate,h,m),l(d.skewX,u.skewX,h,m),c(d.scaleX,d.scaleY,u.scaleX,u.scaleY,h,m),d=u=null,function(f){for(var p=-1,g=m.length,v;++p<g;)h[(v=m[p]).i]=v.x(f);return h.join("")}}}var xzr=mMt(yzr,"px, ","px)","deg)"),wzr=mMt(bzr,", ",")",")"),kzr=1e-12;function PKe(t){return((t=Math.exp(t))+1/t)/2}function Szr(t){return((t=Math.exp(t))-1/t)/2}function Czr(t){return((t=Math.exp(2*t))-1)/(t+1)}const Nq=function t(e,n,r){function s(i,o){var l=i[0],c=i[1],d=i[2],u=o[0],h=o[1],m=o[2],f=u-l,p=h-c,g=f*f+p*p,v,b;if(g<kzr)b=Math.log(m/d)/e,v=function(j){return[l+j*f,c+j*p,d*Math.exp(e*j*b)]};else{var x=Math.sqrt(g),w=(m*m-d*d+r*g)/(2*d*n*x),k=(m*m-d*d-r*g)/(2*m*n*x),S=Math.log(Math.sqrt(w*w+1)-w),C=Math.log(Math.sqrt(k*k+1)-k);b=(C-S)/e,v=function(j){var E=j*b,N=PKe(S),A=d/(n*x)*(N*Czr(e*E+S)-Szr(S));return[l+A*f,c+A*p,d*N/PKe(e*E+S)]}}return v.duration=b*1e3*e/Math.SQRT2,v}return s.rho=function(i){var o=Math.max(.001,+i),l=o*o,c=l*l;return t(o,l,c)},s}(Math.SQRT2,2,4);function jzr(t,e){e===void 0&&(e=t,t=Rx);for(var n=0,r=e.length-1,s=e[0],i=new Array(r<0?0:r);n<r;)i[n]=t(s,s=e[++n]);return function(o){var l=Math.max(0,Math.min(r-1,Math.floor(o*=r)));return i[l](o-l)}}function Ezr(t){return function(){return t}}function OJ(t){return+t}var RKe=[0,1];function Pu(t){return t}function $we(t,e){return(e-=t=+t)?function(n){return(n-t)/e}:Ezr(isNaN(e)?NaN:.5)}function Nzr(t,e){var n;return t>e&&(n=t,t=e,e=n),function(r){return Math.max(t,Math.min(e,r))}}function Tzr(t,e,n){var r=t[0],s=t[1],i=e[0],o=e[1];return s<r?(r=$we(s,r),i=n(o,i)):(r=$we(r,s),i=n(i,o)),function(l){return i(r(l))}}function _zr(t,e,n){var r=Math.min(t.length,e.length)-1,s=new Array(r),i=new Array(r),o=-1;for(t[r]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++o<r;)s[o]=$we(t[o],t[o+1]),i[o]=n(e[o],e[o+1]);return function(l){var c=j9(t,l,1,r)-1;return i[c](s[c](l))}}function N9(t,e){return e.domain(t.domain()).range(t.range()).interpolate(t.interpolate()).clamp(t.clamp()).unknown(t.unknown())}function Nie(){var t=RKe,e=RKe,n=Rx,r,s,i,o=Pu,l,c,d;function u(){var m=Math.min(t.length,e.length);return o!==Pu&&(o=Nzr(t[0],t[m-1])),l=m>2?_zr:Tzr,c=d=null,h}function h(m){return m==null||isNaN(m=+m)?i:(c||(c=l(t.map(r),e,n)))(r(o(m)))}return h.invert=function(m){return o(s((d||(d=l(e,t.map(r),cg)))(m)))},h.domain=function(m){return arguments.length?(t=Array.from(m,OJ),u()):t.slice()},h.range=function(m){return arguments.length?(e=Array.from(m),u()):e.slice()},h.rangeRound=function(m){return e=Array.from(m),n=m5e,u()},h.clamp=function(m){return arguments.length?(o=m?!0:Pu,u()):o!==Pu},h.interpolate=function(m){return arguments.length?(n=m,u()):n},h.unknown=function(m){return arguments.length?(i=m,h):i},function(m,f){return r=m,s=f,u()}}function f5e(){return Nie()(Pu,Pu)}function Azr(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)}function FJ(t,e){if((n=(t=e?t.toExponential(e-1):t.toExponential()).indexOf("e"))<0)return null;var n,r=t.slice(0,n);return[r.length>1?r[0]+r.slice(2):r,+t.slice(n+1)]}function v5(t){return t=FJ(Math.abs(t)),t?t[1]:NaN}function Pzr(t,e){return function(n,r){for(var s=n.length,i=[],o=0,l=t[0],c=0;s>0&&l>0&&(c+l+1>r&&(l=Math.max(1,r-c)),i.push(n.substring(s-=l,s+l)),!((c+=l+1)>r));)l=t[o=(o+1)%t.length];return i.reverse().join(e)}}function Rzr(t){return function(e){return e.replace(/[0-9]/g,function(n){return t[+n]})}}var Izr=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function OF(t){if(!(e=Izr.exec(t)))throw new Error("invalid format: "+t);var e;return new p5e({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]})}OF.prototype=p5e.prototype;function p5e(t){this.fill=t.fill===void 0?" ":t.fill+"",this.align=t.align===void 0?">":t.align+"",this.sign=t.sign===void 0?"-":t.sign+"",this.symbol=t.symbol===void 0?"":t.symbol+"",this.zero=!!t.zero,this.width=t.width===void 0?void 0:+t.width,this.comma=!!t.comma,this.precision=t.precision===void 0?void 0:+t.precision,this.trim=!!t.trim,this.type=t.type===void 0?"":t.type+""}p5e.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 Mzr(t){e:for(var e=t.length,n=1,r=-1,s;n<e;++n)switch(t[n]){case".":r=s=n;break;case"0":r===0&&(r=n),s=n;break;default:if(!+t[n])break e;r>0&&(r=0);break}return r>0?t.slice(0,r)+t.slice(s+1):t}var fMt;function Lzr(t,e){var n=FJ(t,e);if(!n)return t+"";var r=n[0],s=n[1],i=s-(fMt=Math.max(-8,Math.min(8,Math.floor(s/3)))*3)+1,o=r.length;return i===o?r:i>o?r+new Array(i-o+1).join("0"):i>0?r.slice(0,i)+"."+r.slice(i):"0."+new Array(1-i).join("0")+FJ(t,Math.max(0,e+i-1))[0]}function IKe(t,e){var n=FJ(t,e);if(!n)return t+"";var r=n[0],s=n[1];return s<0?"0."+new Array(-s).join("0")+r:r.length>s+1?r.slice(0,s+1)+"."+r.slice(s+1):r+new Array(s-r.length+2).join("0")}const MKe={"%":(t,e)=>(t*100).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:Azr,e:(t,e)=>t.toExponential(e),f:(t,e)=>t.toFixed(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>IKe(t*100,e),r:IKe,s:Lzr,X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16)};function LKe(t){return t}var DKe=Array.prototype.map,$Ke=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];function Dzr(t){var e=t.grouping===void 0||t.thousands===void 0?LKe:Pzr(DKe.call(t.grouping,Number),t.thousands+""),n=t.currency===void 0?"":t.currency[0]+"",r=t.currency===void 0?"":t.currency[1]+"",s=t.decimal===void 0?".":t.decimal+"",i=t.numerals===void 0?LKe:Rzr(DKe.call(t.numerals,String)),o=t.percent===void 0?"%":t.percent+"",l=t.minus===void 0?"−":t.minus+"",c=t.nan===void 0?"NaN":t.nan+"";function d(h){h=OF(h);var m=h.fill,f=h.align,p=h.sign,g=h.symbol,v=h.zero,b=h.width,x=h.comma,w=h.precision,k=h.trim,S=h.type;S==="n"?(x=!0,S="g"):MKe[S]||(w===void 0&&(w=12),k=!0,S="g"),(v||m==="0"&&f==="=")&&(v=!0,m="0",f="=");var C=g==="$"?n:g==="#"&&/[boxX]/.test(S)?"0"+S.toLowerCase():"",j=g==="$"?r:/[%p]/.test(S)?o:"",E=MKe[S],N=/[defgprs%]/.test(S);w=w===void 0?6:/[gprs]/.test(S)?Math.max(1,Math.min(21,w)):Math.max(0,Math.min(20,w));function A(_){var T=C,R=j,O,F,D;if(S==="c")R=E(_)+R,_="";else{_=+_;var I=_<0||1/_<0;if(_=isNaN(_)?c:E(Math.abs(_),w),k&&(_=Mzr(_)),I&&+_==0&&p!=="+"&&(I=!1),T=(I?p==="("?p:l:p==="-"||p==="("?"":p)+T,R=(S==="s"?$Ke[8+fMt/3]:"")+R+(I&&p==="("?")":""),N){for(O=-1,F=_.length;++O<F;)if(D=_.charCodeAt(O),48>D||D>57){R=(D===46?s+_.slice(O+1):_.slice(O))+R,_=_.slice(0,O);break}}}x&&!v&&(_=e(_,1/0));var P=T.length+_.length+R.length,M=P<b?new Array(b-P+1).join(m):"";switch(x&&v&&(_=e(M+_,M.length?b-R.length:1/0),M=""),f){case"<":_=T+_+R+M;break;case"=":_=T+M+_+R;break;case"^":_=M.slice(0,P=M.length>>1)+T+_+R+M.slice(P);break;default:_=M+T+_+R;break}return i(_)}return A.toString=function(){return h+""},A}function u(h,m){var f=d((h=OF(h),h.type="f",h)),p=Math.max(-8,Math.min(8,Math.floor(v5(m)/3)))*3,g=Math.pow(10,-p),v=$Ke[8+p/3];return function(b){return f(g*b)+v}}return{format:d,formatPrefix:u}}var uH,g5e,pMt;$zr({thousands:",",grouping:[3],currency:["$",""]});function $zr(t){return uH=Dzr(t),g5e=uH.format,pMt=uH.formatPrefix,uH}function Ozr(t){return Math.max(0,-v5(Math.abs(t)))}function Fzr(t,e){return Math.max(0,Math.max(-8,Math.min(8,Math.floor(v5(e)/3)))*3-v5(Math.abs(t)))}function Bzr(t,e){return t=Math.abs(t),e=Math.abs(e)-t,Math.max(0,v5(e)-v5(t))+1}function gMt(t,e,n,r){var s=Rwe(t,e,n),i;switch(r=OF(r??",f"),r.type){case"s":{var o=Math.max(Math.abs(t),Math.abs(e));return r.precision==null&&!isNaN(i=Fzr(s,o))&&(r.precision=i),pMt(r,o)}case"":case"e":case"g":case"p":case"r":{r.precision==null&&!isNaN(i=Bzr(s,Math.max(Math.abs(t),Math.abs(e))))&&(r.precision=i-(r.type==="e"));break}case"f":case"%":{r.precision==null&&!isNaN(i=Ozr(s))&&(r.precision=i-(r.type==="%")*2);break}}return g5e(r)}function LS(t){var e=t.domain;return t.ticks=function(n){var r=e();return Awe(r[0],r[r.length-1],n??10)},t.tickFormat=function(n,r){var s=e();return gMt(s[0],s[s.length-1],n??10,r)},t.nice=function(n){n==null&&(n=10);var r=e(),s=0,i=r.length-1,o=r[s],l=r[i],c,d,u=10;for(l<o&&(d=o,o=l,l=d,d=s,s=i,i=d);u-- >0;){if(d=Pwe(o,l,n),d===c)return r[s]=o,r[i]=l,e(r);if(d>0)o=Math.floor(o/d)*d,l=Math.ceil(l/d)*d;else if(d<0)o=Math.ceil(o*d)/d,l=Math.floor(l*d)/d;else break;c=d}return t},t}function BJ(){var t=f5e();return t.copy=function(){return N9(t,BJ())},lp.apply(t,arguments),LS(t)}function vMt(t){var e;function n(r){return r==null||isNaN(r=+r)?e:r}return n.invert=n,n.domain=n.range=function(r){return arguments.length?(t=Array.from(r,OJ),n):t.slice()},n.unknown=function(r){return arguments.length?(e=r,n):e},n.copy=function(){return vMt(t).unknown(e)},t=arguments.length?Array.from(t,OJ):[0,1],LS(n)}function yMt(t,e){t=t.slice();var n=0,r=t.length-1,s=t[n],i=t[r],o;return i<s&&(o=n,n=r,r=o,o=s,s=i,i=o),t[n]=e.floor(s),t[r]=e.ceil(i),t}function OKe(t){return Math.log(t)}function FKe(t){return Math.exp(t)}function Uzr(t){return-Math.log(-t)}function zzr(t){return-Math.exp(-t)}function Vzr(t){return isFinite(t)?+("1e"+t):t<0?0:t}function Hzr(t){return t===10?Vzr:t===Math.E?Math.exp:e=>Math.pow(t,e)}function Gzr(t){return t===Math.E?Math.log:t===10&&Math.log10||t===2&&Math.log2||(t=Math.log(t),e=>Math.log(e)/t)}function BKe(t){return(e,n)=>-t(-e,n)}function v5e(t){const e=t(OKe,FKe),n=e.domain;let r=10,s,i;function o(){return s=Gzr(r),i=Hzr(r),n()[0]<0?(s=BKe(s),i=BKe(i),t(Uzr,zzr)):t(OKe,FKe),e}return e.base=function(l){return arguments.length?(r=+l,o()):r},e.domain=function(l){return arguments.length?(n(l),o()):n()},e.ticks=l=>{const c=n();let d=c[0],u=c[c.length-1];const h=u<d;h&&([d,u]=[u,d]);let m=s(d),f=s(u),p,g;const v=l==null?10:+l;let b=[];if(!(r%1)&&f-m<v){if(m=Math.floor(m),f=Math.ceil(f),d>0){for(;m<=f;++m)for(p=1;p<r;++p)if(g=m<0?p/i(-m):p*i(m),!(g<d)){if(g>u)break;b.push(g)}}else for(;m<=f;++m)for(p=r-1;p>=1;--p)if(g=m>0?p/i(-m):p*i(m),!(g<d)){if(g>u)break;b.push(g)}b.length*2<v&&(b=Awe(d,u,v))}else b=Awe(m,f,Math.min(f-m,v)).map(i);return h?b.reverse():b},e.tickFormat=(l,c)=>{if(l==null&&(l=10),c==null&&(c=r===10?"s":","),typeof c!="function"&&(!(r%1)&&(c=OF(c)).precision==null&&(c.trim=!0),c=g5e(c)),l===1/0)return c;const d=Math.max(1,r*l/e.ticks().length);return u=>{let h=u/i(Math.round(s(u)));return h*r<r-.5&&(h*=r),h<=d?c(u):""}},e.nice=()=>n(yMt(n(),{floor:l=>i(Math.floor(s(l))),ceil:l=>i(Math.ceil(s(l)))})),e}function bMt(){const t=v5e(Nie()).domain([1,10]);return t.copy=()=>N9(t,bMt()).base(t.base()),lp.apply(t,arguments),t}function UKe(t){return function(e){return Math.sign(e)*Math.log1p(Math.abs(e/t))}}function zKe(t){return function(e){return Math.sign(e)*Math.expm1(Math.abs(e))*t}}function y5e(t){var e=1,n=t(UKe(e),zKe(e));return n.constant=function(r){return arguments.length?t(UKe(e=+r),zKe(e)):e},LS(n)}function xMt(){var t=y5e(Nie());return t.copy=function(){return N9(t,xMt()).constant(t.constant())},lp.apply(t,arguments)}function VKe(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}function Wzr(t){return t<0?-Math.sqrt(-t):Math.sqrt(t)}function qzr(t){return t<0?-t*t:t*t}function b5e(t){var e=t(Pu,Pu),n=1;function r(){return n===1?t(Pu,Pu):n===.5?t(Wzr,qzr):t(VKe(n),VKe(1/n))}return e.exponent=function(s){return arguments.length?(n=+s,r()):n},LS(e)}function x5e(){var t=b5e(Nie());return t.copy=function(){return N9(t,x5e()).exponent(t.exponent())},lp.apply(t,arguments),t}function Kzr(){return x5e.apply(null,arguments).exponent(.5)}function HKe(t){return Math.sign(t)*t*t}function Yzr(t){return Math.sign(t)*Math.sqrt(Math.abs(t))}function wMt(){var t=f5e(),e=[0,1],n=!1,r;function s(i){var o=Yzr(t(i));return isNaN(o)?r:n?Math.round(o):o}return s.invert=function(i){return t.invert(HKe(i))},s.domain=function(i){return arguments.length?(t.domain(i),s):t.domain()},s.range=function(i){return arguments.length?(t.range((e=Array.from(i,OJ)).map(HKe)),s):e.slice()},s.rangeRound=function(i){return s.range(i).round(!0)},s.round=function(i){return arguments.length?(n=!!i,s):n},s.clamp=function(i){return arguments.length?(t.clamp(i),s):t.clamp()},s.unknown=function(i){return arguments.length?(r=i,s):r},s.copy=function(){return wMt(t.domain(),e).round(n).clamp(t.clamp()).unknown(r)},lp.apply(s,arguments),LS(s)}function kMt(){var t=[],e=[],n=[],r;function s(){var o=0,l=Math.max(1,e.length);for(n=new Array(l-1);++o<l;)n[o-1]=KUr(t,o/l);return i}function i(o){return o==null||isNaN(o=+o)?r:e[j9(n,o)]}return i.invertExtent=function(o){var l=e.indexOf(o);return l<0?[NaN,NaN]:[l>0?n[l-1]:t[0],l<n.length?n[l]:t[t.length-1]]},i.domain=function(o){if(!arguments.length)return t.slice();t=[];for(let l of o)l!=null&&!isNaN(l=+l)&&t.push(l);return t.sort(hk),s()},i.range=function(o){return arguments.length?(e=Array.from(o),s()):e.slice()},i.unknown=function(o){return arguments.length?(r=o,i):r},i.quantiles=function(){return n.slice()},i.copy=function(){return kMt().domain(t).range(e).unknown(r)},lp.apply(i,arguments)}function SMt(){var t=0,e=1,n=1,r=[.5],s=[0,1],i;function o(c){return c!=null&&c<=c?s[j9(r,c,0,n)]:i}function l(){var c=-1;for(r=new Array(n);++c<n;)r[c]=((c+1)*e-(c-n)*t)/(n+1);return o}return o.domain=function(c){return arguments.length?([t,e]=c,t=+t,e=+e,l()):[t,e]},o.range=function(c){return arguments.length?(n=(s=Array.from(c)).length-1,l()):s.slice()},o.invertExtent=function(c){var d=s.indexOf(c);return d<0?[NaN,NaN]:d<1?[t,r[0]]:d>=n?[r[n-1],e]:[r[d-1],r[d]]},o.unknown=function(c){return arguments.length&&(i=c),o},o.thresholds=function(){return r.slice()},o.copy=function(){return SMt().domain([t,e]).range(s).unknown(i)},lp.apply(LS(o),arguments)}function CMt(){var t=[.5],e=[0,1],n,r=1;function s(i){return i!=null&&i<=i?e[j9(t,i,0,r)]:n}return s.domain=function(i){return arguments.length?(t=Array.from(i),r=Math.min(t.length,e.length-1),s):t.slice()},s.range=function(i){return arguments.length?(e=Array.from(i),r=Math.min(t.length,e.length-1),s):e.slice()},s.invertExtent=function(i){var o=e.indexOf(i);return[t[o-1],t[o]]},s.unknown=function(i){return arguments.length?(n=i,s):n},s.copy=function(){return CMt().domain(t).range(e).unknown(n)},lp.apply(s,arguments)}const Zue=new Date,Jue=new Date;function Sc(t,e,n,r){function s(i){return t(i=arguments.length===0?new Date:new Date(+i)),i}return s.floor=i=>(t(i=new Date(+i)),i),s.ceil=i=>(t(i=new Date(i-1)),e(i,1),t(i),i),s.round=i=>{const o=s(i),l=s.ceil(i);return i-o<l-i?o:l},s.offset=(i,o)=>(e(i=new Date(+i),o==null?1:Math.floor(o)),i),s.range=(i,o,l)=>{const c=[];if(i=s.ceil(i),l=l==null?1:Math.floor(l),!(i<o)||!(l>0))return c;let d;do c.push(d=new Date(+i)),e(i,l),t(i);while(d<i&&i<o);return c},s.filter=i=>Sc(o=>{if(o>=o)for(;t(o),!i(o);)o.setTime(o-1)},(o,l)=>{if(o>=o)if(l<0)for(;++l<=0;)for(;e(o,-1),!i(o););else for(;--l>=0;)for(;e(o,1),!i(o););}),n&&(s.count=(i,o)=>(Zue.setTime(+i),Jue.setTime(+o),t(Zue),t(Jue),Math.floor(n(Zue,Jue))),s.every=i=>(i=Math.floor(i),!isFinite(i)||!(i>0)?null:i>1?s.filter(r?o=>r(o)%i===0:o=>s.count(0,o)%i===0):s)),s}const UJ=Sc(()=>{},(t,e)=>{t.setTime(+t+e)},(t,e)=>e-t);UJ.every=t=>(t=Math.floor(t),!isFinite(t)||!(t>0)?null:t>1?Sc(e=>{e.setTime(Math.floor(e/t)*t)},(e,n)=>{e.setTime(+e+n*t)},(e,n)=>(n-e)/t):UJ);UJ.range;const fx=1e3,Nf=fx*60,px=Nf*60,p0=px*24,w5e=p0*7,GKe=p0*30,Xue=p0*365,Aj=Sc(t=>{t.setTime(t-t.getMilliseconds())},(t,e)=>{t.setTime(+t+e*fx)},(t,e)=>(e-t)/fx,t=>t.getUTCSeconds());Aj.range;const k5e=Sc(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*fx)},(t,e)=>{t.setTime(+t+e*Nf)},(t,e)=>(e-t)/Nf,t=>t.getMinutes());k5e.range;const S5e=Sc(t=>{t.setUTCSeconds(0,0)},(t,e)=>{t.setTime(+t+e*Nf)},(t,e)=>(e-t)/Nf,t=>t.getUTCMinutes());S5e.range;const C5e=Sc(t=>{t.setTime(t-t.getMilliseconds()-t.getSeconds()*fx-t.getMinutes()*Nf)},(t,e)=>{t.setTime(+t+e*px)},(t,e)=>(e-t)/px,t=>t.getHours());C5e.range;const j5e=Sc(t=>{t.setUTCMinutes(0,0,0)},(t,e)=>{t.setTime(+t+e*px)},(t,e)=>(e-t)/px,t=>t.getUTCHours());j5e.range;const T9=Sc(t=>t.setHours(0,0,0,0),(t,e)=>t.setDate(t.getDate()+e),(t,e)=>(e-t-(e.getTimezoneOffset()-t.getTimezoneOffset())*Nf)/p0,t=>t.getDate()-1);T9.range;const Tie=Sc(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/p0,t=>t.getUTCDate()-1);Tie.range;const jMt=Sc(t=>{t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCDate(t.getUTCDate()+e)},(t,e)=>(e-t)/p0,t=>Math.floor(t/p0));jMt.range;function IN(t){return Sc(e=>{e.setDate(e.getDate()-(e.getDay()+7-t)%7),e.setHours(0,0,0,0)},(e,n)=>{e.setDate(e.getDate()+n*7)},(e,n)=>(n-e-(n.getTimezoneOffset()-e.getTimezoneOffset())*Nf)/w5e)}const _ie=IN(0),zJ=IN(1),Qzr=IN(2),Zzr=IN(3),y5=IN(4),Jzr=IN(5),Xzr=IN(6);_ie.range;zJ.range;Qzr.range;Zzr.range;y5.range;Jzr.range;Xzr.range;function MN(t){return Sc(e=>{e.setUTCDate(e.getUTCDate()-(e.getUTCDay()+7-t)%7),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCDate(e.getUTCDate()+n*7)},(e,n)=>(n-e)/w5e)}const Aie=MN(0),VJ=MN(1),eVr=MN(2),tVr=MN(3),b5=MN(4),nVr=MN(5),rVr=MN(6);Aie.range;VJ.range;eVr.range;tVr.range;b5.range;nVr.range;rVr.range;const E5e=Sc(t=>{t.setDate(1),t.setHours(0,0,0,0)},(t,e)=>{t.setMonth(t.getMonth()+e)},(t,e)=>e.getMonth()-t.getMonth()+(e.getFullYear()-t.getFullYear())*12,t=>t.getMonth());E5e.range;const N5e=Sc(t=>{t.setUTCDate(1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCMonth(t.getUTCMonth()+e)},(t,e)=>e.getUTCMonth()-t.getUTCMonth()+(e.getUTCFullYear()-t.getUTCFullYear())*12,t=>t.getUTCMonth());N5e.range;const g0=Sc(t=>{t.setMonth(0,1),t.setHours(0,0,0,0)},(t,e)=>{t.setFullYear(t.getFullYear()+e)},(t,e)=>e.getFullYear()-t.getFullYear(),t=>t.getFullYear());g0.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Sc(e=>{e.setFullYear(Math.floor(e.getFullYear()/t)*t),e.setMonth(0,1),e.setHours(0,0,0,0)},(e,n)=>{e.setFullYear(e.getFullYear()+n*t)});g0.range;const v0=Sc(t=>{t.setUTCMonth(0,1),t.setUTCHours(0,0,0,0)},(t,e)=>{t.setUTCFullYear(t.getUTCFullYear()+e)},(t,e)=>e.getUTCFullYear()-t.getUTCFullYear(),t=>t.getUTCFullYear());v0.every=t=>!isFinite(t=Math.floor(t))||!(t>0)?null:Sc(e=>{e.setUTCFullYear(Math.floor(e.getUTCFullYear()/t)*t),e.setUTCMonth(0,1),e.setUTCHours(0,0,0,0)},(e,n)=>{e.setUTCFullYear(e.getUTCFullYear()+n*t)});v0.range;function EMt(t,e,n,r,s,i){const o=[[Aj,1,fx],[Aj,5,5*fx],[Aj,15,15*fx],[Aj,30,30*fx],[i,1,Nf],[i,5,5*Nf],[i,15,15*Nf],[i,30,30*Nf],[s,1,px],[s,3,3*px],[s,6,6*px],[s,12,12*px],[r,1,p0],[r,2,2*p0],[n,1,w5e],[e,1,GKe],[e,3,3*GKe],[t,1,Xue]];function l(d,u,h){const m=u<d;m&&([d,u]=[u,d]);const f=h&&typeof h.range=="function"?h:c(d,u,h),p=f?f.range(d,+u+1):[];return m?p.reverse():p}function c(d,u,h){const m=Math.abs(u-d)/h,f=c5e(([,,v])=>v).right(o,m);if(f===o.length)return t.every(Rwe(d/Xue,u/Xue,h));if(f===0)return UJ.every(Math.max(Rwe(d,u,h),1));const[p,g]=o[m/o[f-1][2]<o[f][2]/m?f-1:f];return p.every(g)}return[l,c]}const[sVr,iVr]=EMt(v0,N5e,Aie,jMt,j5e,S5e),[aVr,oVr]=EMt(g0,E5e,_ie,T9,C5e,k5e);function ehe(t){if(0<=t.y&&t.y<100){var e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}function the(t){if(0<=t.y&&t.y<100){var e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}function G3(t,e,n){return{y:t,m:e,d:n,H:0,M:0,S:0,L:0}}function lVr(t){var e=t.dateTime,n=t.date,r=t.time,s=t.periods,i=t.days,o=t.shortDays,l=t.months,c=t.shortMonths,d=W3(s),u=q3(s),h=W3(i),m=q3(i),f=W3(o),p=q3(o),g=W3(l),v=q3(l),b=W3(c),x=q3(c),w={a:I,A:P,b:M,B:z,c:null,d:ZKe,e:ZKe,f:PVr,g:UVr,G:VVr,H:TVr,I:_Vr,j:AVr,L:NMt,m:RVr,M:IVr,p:G,q:B,Q:eYe,s:tYe,S:MVr,u:LVr,U:DVr,V:$Vr,w:OVr,W:FVr,x:null,X:null,y:BVr,Y:zVr,Z:HVr,"%":XKe},k={a:H,A:W,b:V,B:U,c:null,d:JKe,e:JKe,f:KVr,g:sHr,G:aHr,H:GVr,I:WVr,j:qVr,L:_Mt,m:YVr,M:QVr,p:ne,q:te,Q:eYe,s:tYe,S:ZVr,u:JVr,U:XVr,V:eHr,w:tHr,W:nHr,x:null,X:null,y:rHr,Y:iHr,Z:oHr,"%":XKe},S={a:A,A:_,b:T,B:R,c:O,d:YKe,e:YKe,f:CVr,g:KKe,G:qKe,H:QKe,I:QKe,j:xVr,L:SVr,m:bVr,M:wVr,p:N,q:yVr,Q:EVr,s:NVr,S:kVr,u:mVr,U:fVr,V:pVr,w:hVr,W:gVr,x:F,X:D,y:KKe,Y:qKe,Z:vVr,"%":jVr};w.x=C(n,w),w.X=C(r,w),w.c=C(e,w),k.x=C(n,k),k.X=C(r,k),k.c=C(e,k);function C(re,fe){return function(le){var q=[],Y=-1,X=0,Q=re.length,ie,he,ye;for(le instanceof Date||(le=new Date(+le));++Y<Q;)re.charCodeAt(Y)===37&&(q.push(re.slice(X,Y)),(he=WKe[ie=re.charAt(++Y)])!=null?ie=re.charAt(++Y):he=ie==="e"?" ":"0",(ye=fe[ie])&&(ie=ye(le,he)),q.push(ie),X=Y+1);return q.push(re.slice(X,Y)),q.join("")}}function j(re,fe){return function(le){var q=G3(1900,void 0,1),Y=E(q,re,le+="",0),X,Q;if(Y!=le.length)return null;if("Q"in q)return new Date(q.Q);if("s"in q)return new Date(q.s*1e3+("L"in q?q.L:0));if(fe&&!("Z"in q)&&(q.Z=0),"p"in q&&(q.H=q.H%12+q.p*12),q.m===void 0&&(q.m="q"in q?q.q:0),"V"in q){if(q.V<1||q.V>53)return null;"w"in q||(q.w=1),"Z"in q?(X=the(G3(q.y,0,1)),Q=X.getUTCDay(),X=Q>4||Q===0?VJ.ceil(X):VJ(X),X=Tie.offset(X,(q.V-1)*7),q.y=X.getUTCFullYear(),q.m=X.getUTCMonth(),q.d=X.getUTCDate()+(q.w+6)%7):(X=ehe(G3(q.y,0,1)),Q=X.getDay(),X=Q>4||Q===0?zJ.ceil(X):zJ(X),X=T9.offset(X,(q.V-1)*7),q.y=X.getFullYear(),q.m=X.getMonth(),q.d=X.getDate()+(q.w+6)%7)}else("W"in q||"U"in q)&&("w"in q||(q.w="u"in q?q.u%7:"W"in q?1:0),Q="Z"in q?the(G3(q.y,0,1)).getUTCDay():ehe(G3(q.y,0,1)).getDay(),q.m=0,q.d="W"in q?(q.w+6)%7+q.W*7-(Q+5)%7:q.w+q.U*7-(Q+6)%7);return"Z"in q?(q.H+=q.Z/100|0,q.M+=q.Z%100,the(q)):ehe(q)}}function E(re,fe,le,q){for(var Y=0,X=fe.length,Q=le.length,ie,he;Y<X;){if(q>=Q)return-1;if(ie=fe.charCodeAt(Y++),ie===37){if(ie=fe.charAt(Y++),he=S[ie in WKe?fe.charAt(Y++):ie],!he||(q=he(re,le,q))<0)return-1}else if(ie!=le.charCodeAt(q++))return-1}return q}function N(re,fe,le){var q=d.exec(fe.slice(le));return q?(re.p=u.get(q[0].toLowerCase()),le+q[0].length):-1}function A(re,fe,le){var q=f.exec(fe.slice(le));return q?(re.w=p.get(q[0].toLowerCase()),le+q[0].length):-1}function _(re,fe,le){var q=h.exec(fe.slice(le));return q?(re.w=m.get(q[0].toLowerCase()),le+q[0].length):-1}function T(re,fe,le){var q=b.exec(fe.slice(le));return q?(re.m=x.get(q[0].toLowerCase()),le+q[0].length):-1}function R(re,fe,le){var q=g.exec(fe.slice(le));return q?(re.m=v.get(q[0].toLowerCase()),le+q[0].length):-1}function O(re,fe,le){return E(re,e,fe,le)}function F(re,fe,le){return E(re,n,fe,le)}function D(re,fe,le){return E(re,r,fe,le)}function I(re){return o[re.getDay()]}function P(re){return i[re.getDay()]}function M(re){return c[re.getMonth()]}function z(re){return l[re.getMonth()]}function G(re){return s[+(re.getHours()>=12)]}function B(re){return 1+~~(re.getMonth()/3)}function H(re){return o[re.getUTCDay()]}function W(re){return i[re.getUTCDay()]}function V(re){return c[re.getUTCMonth()]}function U(re){return l[re.getUTCMonth()]}function ne(re){return s[+(re.getUTCHours()>=12)]}function te(re){return 1+~~(re.getUTCMonth()/3)}return{format:function(re){var fe=C(re+="",w);return fe.toString=function(){return re},fe},parse:function(re){var fe=j(re+="",!1);return fe.toString=function(){return re},fe},utcFormat:function(re){var fe=C(re+="",k);return fe.toString=function(){return re},fe},utcParse:function(re){var fe=j(re+="",!0);return fe.toString=function(){return re},fe}}}var WKe={"-":"",_:" ",0:"0"},Hc=/^\s*\d+/,cVr=/^%/,dVr=/[\\^$*+?|[\]().{}]/g;function bi(t,e,n){var r=t<0?"-":"",s=(r?-t:t)+"",i=s.length;return r+(i<n?new Array(n-i+1).join(e)+s:s)}function uVr(t){return t.replace(dVr,"\\$&")}function W3(t){return new RegExp("^(?:"+t.map(uVr).join("|")+")","i")}function q3(t){return new Map(t.map((e,n)=>[e.toLowerCase(),n]))}function hVr(t,e,n){var r=Hc.exec(e.slice(n,n+1));return r?(t.w=+r[0],n+r[0].length):-1}function mVr(t,e,n){var r=Hc.exec(e.slice(n,n+1));return r?(t.u=+r[0],n+r[0].length):-1}function fVr(t,e,n){var r=Hc.exec(e.slice(n,n+2));return r?(t.U=+r[0],n+r[0].length):-1}function pVr(t,e,n){var r=Hc.exec(e.slice(n,n+2));return r?(t.V=+r[0],n+r[0].length):-1}function gVr(t,e,n){var r=Hc.exec(e.slice(n,n+2));return r?(t.W=+r[0],n+r[0].length):-1}function qKe(t,e,n){var r=Hc.exec(e.slice(n,n+4));return r?(t.y=+r[0],n+r[0].length):-1}function KKe(t,e,n){var r=Hc.exec(e.slice(n,n+2));return r?(t.y=+r[0]+(+r[0]>68?1900:2e3),n+r[0].length):-1}function vVr(t,e,n){var r=/^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(e.slice(n,n+6));return r?(t.Z=r[1]?0:-(r[2]+(r[3]||"00")),n+r[0].length):-1}function yVr(t,e,n){var r=Hc.exec(e.slice(n,n+1));return r?(t.q=r[0]*3-3,n+r[0].length):-1}function bVr(t,e,n){var r=Hc.exec(e.slice(n,n+2));return r?(t.m=r[0]-1,n+r[0].length):-1}function YKe(t,e,n){var r=Hc.exec(e.slice(n,n+2));return r?(t.d=+r[0],n+r[0].length):-1}function xVr(t,e,n){var r=Hc.exec(e.slice(n,n+3));return r?(t.m=0,t.d=+r[0],n+r[0].length):-1}function QKe(t,e,n){var r=Hc.exec(e.slice(n,n+2));return r?(t.H=+r[0],n+r[0].length):-1}function wVr(t,e,n){var r=Hc.exec(e.slice(n,n+2));return r?(t.M=+r[0],n+r[0].length):-1}function kVr(t,e,n){var r=Hc.exec(e.slice(n,n+2));return r?(t.S=+r[0],n+r[0].length):-1}function SVr(t,e,n){var r=Hc.exec(e.slice(n,n+3));return r?(t.L=+r[0],n+r[0].length):-1}function CVr(t,e,n){var r=Hc.exec(e.slice(n,n+6));return r?(t.L=Math.floor(r[0]/1e3),n+r[0].length):-1}function jVr(t,e,n){var r=cVr.exec(e.slice(n,n+1));return r?n+r[0].length:-1}function EVr(t,e,n){var r=Hc.exec(e.slice(n));return r?(t.Q=+r[0],n+r[0].length):-1}function NVr(t,e,n){var r=Hc.exec(e.slice(n));return r?(t.s=+r[0],n+r[0].length):-1}function ZKe(t,e){return bi(t.getDate(),e,2)}function TVr(t,e){return bi(t.getHours(),e,2)}function _Vr(t,e){return bi(t.getHours()%12||12,e,2)}function AVr(t,e){return bi(1+T9.count(g0(t),t),e,3)}function NMt(t,e){return bi(t.getMilliseconds(),e,3)}function PVr(t,e){return NMt(t,e)+"000"}function RVr(t,e){return bi(t.getMonth()+1,e,2)}function IVr(t,e){return bi(t.getMinutes(),e,2)}function MVr(t,e){return bi(t.getSeconds(),e,2)}function LVr(t){var e=t.getDay();return e===0?7:e}function DVr(t,e){return bi(_ie.count(g0(t)-1,t),e,2)}function TMt(t){var e=t.getDay();return e>=4||e===0?y5(t):y5.ceil(t)}function $Vr(t,e){return t=TMt(t),bi(y5.count(g0(t),t)+(g0(t).getDay()===4),e,2)}function OVr(t){return t.getDay()}function FVr(t,e){return bi(zJ.count(g0(t)-1,t),e,2)}function BVr(t,e){return bi(t.getFullYear()%100,e,2)}function UVr(t,e){return t=TMt(t),bi(t.getFullYear()%100,e,2)}function zVr(t,e){return bi(t.getFullYear()%1e4,e,4)}function VVr(t,e){var n=t.getDay();return t=n>=4||n===0?y5(t):y5.ceil(t),bi(t.getFullYear()%1e4,e,4)}function HVr(t){var e=t.getTimezoneOffset();return(e>0?"-":(e*=-1,"+"))+bi(e/60|0,"0",2)+bi(e%60,"0",2)}function JKe(t,e){return bi(t.getUTCDate(),e,2)}function GVr(t,e){return bi(t.getUTCHours(),e,2)}function WVr(t,e){return bi(t.getUTCHours()%12||12,e,2)}function qVr(t,e){return bi(1+Tie.count(v0(t),t),e,3)}function _Mt(t,e){return bi(t.getUTCMilliseconds(),e,3)}function KVr(t,e){return _Mt(t,e)+"000"}function YVr(t,e){return bi(t.getUTCMonth()+1,e,2)}function QVr(t,e){return bi(t.getUTCMinutes(),e,2)}function ZVr(t,e){return bi(t.getUTCSeconds(),e,2)}function JVr(t){var e=t.getUTCDay();return e===0?7:e}function XVr(t,e){return bi(Aie.count(v0(t)-1,t),e,2)}function AMt(t){var e=t.getUTCDay();return e>=4||e===0?b5(t):b5.ceil(t)}function eHr(t,e){return t=AMt(t),bi(b5.count(v0(t),t)+(v0(t).getUTCDay()===4),e,2)}function tHr(t){return t.getUTCDay()}function nHr(t,e){return bi(VJ.count(v0(t)-1,t),e,2)}function rHr(t,e){return bi(t.getUTCFullYear()%100,e,2)}function sHr(t,e){return t=AMt(t),bi(t.getUTCFullYear()%100,e,2)}function iHr(t,e){return bi(t.getUTCFullYear()%1e4,e,4)}function aHr(t,e){var n=t.getUTCDay();return t=n>=4||n===0?b5(t):b5.ceil(t),bi(t.getUTCFullYear()%1e4,e,4)}function oHr(){return"+0000"}function XKe(){return"%"}function eYe(t){return+t}function tYe(t){return Math.floor(+t/1e3)}var LT,PMt,RMt;lHr({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 lHr(t){return LT=lVr(t),PMt=LT.format,LT.parse,RMt=LT.utcFormat,LT.utcParse,LT}function cHr(t){return new Date(t)}function dHr(t){return t instanceof Date?+t:+new Date(+t)}function T5e(t,e,n,r,s,i,o,l,c,d){var u=f5e(),h=u.invert,m=u.domain,f=d(".%L"),p=d(":%S"),g=d("%I:%M"),v=d("%I %p"),b=d("%a %d"),x=d("%b %d"),w=d("%B"),k=d("%Y");function S(C){return(c(C)<C?f:l(C)<C?p:o(C)<C?g:i(C)<C?v:r(C)<C?s(C)<C?b:x:n(C)<C?w:k)(C)}return u.invert=function(C){return new Date(h(C))},u.domain=function(C){return arguments.length?m(Array.from(C,dHr)):m().map(cHr)},u.ticks=function(C){var j=m();return t(j[0],j[j.length-1],C??10)},u.tickFormat=function(C,j){return j==null?S:d(j)},u.nice=function(C){var j=m();return(!C||typeof C.range!="function")&&(C=e(j[0],j[j.length-1],C??10)),C?m(yMt(j,C)):u},u.copy=function(){return N9(u,T5e(t,e,n,r,s,i,o,l,c,d))},u}function uHr(){return lp.apply(T5e(aVr,oVr,g0,E5e,_ie,T9,C5e,k5e,Aj,PMt).domain([new Date(2e3,0,1),new Date(2e3,0,2)]),arguments)}function hHr(){return lp.apply(T5e(sVr,iVr,v0,N5e,Aie,Tie,j5e,S5e,Aj,RMt).domain([Date.UTC(2e3,0,1),Date.UTC(2e3,0,2)]),arguments)}function Pie(){var t=0,e=1,n,r,s,i,o=Pu,l=!1,c;function d(h){return h==null||isNaN(h=+h)?c:o(s===0?.5:(h=(i(h)-n)*s,l?Math.max(0,Math.min(1,h)):h))}d.domain=function(h){return arguments.length?([t,e]=h,n=i(t=+t),r=i(e=+e),s=n===r?0:1/(r-n),d):[t,e]},d.clamp=function(h){return arguments.length?(l=!!h,d):l},d.interpolator=function(h){return arguments.length?(o=h,d):o};function u(h){return function(m){var f,p;return arguments.length?([f,p]=m,o=h(f,p),d):[o(0),o(1)]}}return d.range=u(Rx),d.rangeRound=u(m5e),d.unknown=function(h){return arguments.length?(c=h,d):c},function(h){return i=h,n=h(t),r=h(e),s=n===r?0:1/(r-n),d}}function DS(t,e){return e.domain(t.domain()).interpolator(t.interpolator()).clamp(t.clamp()).unknown(t.unknown())}function IMt(){var t=LS(Pie()(Pu));return t.copy=function(){return DS(t,IMt())},z0.apply(t,arguments)}function MMt(){var t=v5e(Pie()).domain([1,10]);return t.copy=function(){return DS(t,MMt()).base(t.base())},z0.apply(t,arguments)}function LMt(){var t=y5e(Pie());return t.copy=function(){return DS(t,LMt()).constant(t.constant())},z0.apply(t,arguments)}function _5e(){var t=b5e(Pie());return t.copy=function(){return DS(t,_5e()).exponent(t.exponent())},z0.apply(t,arguments)}function mHr(){return _5e.apply(null,arguments).exponent(.5)}function DMt(){var t=[],e=Pu;function n(r){if(r!=null&&!isNaN(r=+r))return e((j9(t,r,1)-1)/(t.length-1))}return n.domain=function(r){if(!arguments.length)return t.slice();t=[];for(let s of r)s!=null&&!isNaN(s=+s)&&t.push(s);return t.sort(hk),n},n.interpolator=function(r){return arguments.length?(e=r,n):e},n.range=function(){return t.map((r,s)=>e(s/(t.length-1)))},n.quantiles=function(r){return Array.from({length:r+1},(s,i)=>qUr(t,i/r))},n.copy=function(){return DMt(e).domain(t)},z0.apply(n,arguments)}function Rie(){var t=0,e=.5,n=1,r=1,s,i,o,l,c,d=Pu,u,h=!1,m;function f(g){return isNaN(g=+g)?m:(g=.5+((g=+u(g))-i)*(r*g<r*i?l:c),d(h?Math.max(0,Math.min(1,g)):g))}f.domain=function(g){return arguments.length?([t,e,n]=g,s=u(t=+t),i=u(e=+e),o=u(n=+n),l=s===i?0:.5/(i-s),c=i===o?0:.5/(o-i),r=i<s?-1:1,f):[t,e,n]},f.clamp=function(g){return arguments.length?(h=!!g,f):h},f.interpolator=function(g){return arguments.length?(d=g,f):d};function p(g){return function(v){var b,x,w;return arguments.length?([b,x,w]=v,d=jzr(g,[b,x,w]),f):[d(0),d(.5),d(1)]}}return f.range=p(Rx),f.rangeRound=p(m5e),f.unknown=function(g){return arguments.length?(m=g,f):m},function(g){return u=g,s=g(t),i=g(e),o=g(n),l=s===i?0:.5/(i-s),c=i===o?0:.5/(o-i),r=i<s?-1:1,f}}function $Mt(){var t=LS(Rie()(Pu));return t.copy=function(){return DS(t,$Mt())},z0.apply(t,arguments)}function OMt(){var t=v5e(Rie()).domain([.1,1,10]);return t.copy=function(){return DS(t,OMt()).base(t.base())},z0.apply(t,arguments)}function FMt(){var t=y5e(Rie());return t.copy=function(){return DS(t,FMt()).constant(t.constant())},z0.apply(t,arguments)}function A5e(){var t=b5e(Rie());return t.copy=function(){return DS(t,A5e()).exponent(t.exponent())},z0.apply(t,arguments)}function fHr(){return A5e.apply(null,arguments).exponent(.5)}const nYe=Object.freeze(Object.defineProperty({__proto__:null,scaleBand:LF,scaleDiverging:$Mt,scaleDivergingLog:OMt,scaleDivergingPow:A5e,scaleDivergingSqrt:fHr,scaleDivergingSymlog:FMt,scaleIdentity:vMt,scaleImplicit:Iwe,scaleLinear:BJ,scaleLog:bMt,scaleOrdinal:d5e,scalePoint:D$,scalePow:x5e,scaleQuantile:kMt,scaleQuantize:SMt,scaleRadial:wMt,scaleSequential:IMt,scaleSequentialLog:MMt,scaleSequentialPow:_5e,scaleSequentialQuantile:DMt,scaleSequentialSqrt:mHr,scaleSequentialSymlog:LMt,scaleSqrt:Kzr,scaleSymlog:xMt,scaleThreshold:CMt,scaleTime:uHr,scaleUtc:hHr,tickFormat:gMt},Symbol.toStringTag,{value:"Module"}));var pHr=OM;function gHr(t,e,n){for(var r=-1,s=t.length;++r<s;){var i=t[r],o=e(i);if(o!=null&&(l===void 0?o===o&&!pHr(o):n(o,l)))var l=o,c=i}return c}var Iie=gHr;function vHr(t,e){return t>e}var BMt=vHr,yHr=Iie,bHr=BMt,xHr=GM;function wHr(t){return t&&t.length?yHr(t,xHr,bHr):void 0}var kHr=wHr;const D1=Fs(kHr);function SHr(t,e){return t<e}var UMt=SHr,CHr=Iie,jHr=UMt,EHr=GM;function NHr(t){return t&&t.length?CHr(t,EHr,jHr):void 0}var THr=NHr;const Mie=Fs(THr);var _Hr=Kse,AHr=Xg,PHr=QPt,RHr=au;function IHr(t,e){var n=RHr(t)?_Hr:PHr;return n(t,AHr(e))}var MHr=IHr,LHr=sRe,DHr=MHr;function $Hr(t,e){return LHr(DHr(t,e),1)}var OHr=$Hr;const FHr=Fs(OHr);var ZM=1e9,BHr={precision:20,rounding:4,toExpNeg:-7,toExpPos:21,LN10:"2.302585092994045684017991454684364207601101488628772976033327900967572609677352480235997205089598298341967784042286"},R5e,vo=!0,Yf="[DecimalError] ",c2=Yf+"Invalid argument: ",P5e=Yf+"Exponent out of range: ",JM=Math.floor,GC=Math.pow,UHr=/^(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,dm,Ic=1e7,Za=7,zMt=9007199254740991,HJ=JM(zMt/Za),tr={};tr.absoluteValue=tr.abs=function(){var t=new this.constructor(this);return t.s&&(t.s=1),t};tr.comparedTo=tr.cmp=function(t){var e,n,r,s,i=this;if(t=new i.constructor(t),i.s!==t.s)return i.s||-t.s;if(i.e!==t.e)return i.e>t.e^i.s<0?1:-1;for(r=i.d.length,s=t.d.length,e=0,n=r<s?r:s;e<n;++e)if(i.d[e]!==t.d[e])return i.d[e]>t.d[e]^i.s<0?1:-1;return r===s?0:r>s^i.s<0?1:-1};tr.decimalPlaces=tr.dp=function(){var t=this,e=t.d.length-1,n=(e-t.e)*Za;if(e=t.d[e],e)for(;e%10==0;e/=10)n--;return n<0?0:n};tr.dividedBy=tr.div=function(t){return Ix(this,new this.constructor(t))};tr.dividedToIntegerBy=tr.idiv=function(t){var e=this,n=e.constructor;return ba(Ix(e,new n(t),0,1),n.precision)};tr.equals=tr.eq=function(t){return!this.cmp(t)};tr.exponent=function(){return Ql(this)};tr.greaterThan=tr.gt=function(t){return this.cmp(t)>0};tr.greaterThanOrEqualTo=tr.gte=function(t){return this.cmp(t)>=0};tr.isInteger=tr.isint=function(){return this.e>this.d.length-2};tr.isNegative=tr.isneg=function(){return this.s<0};tr.isPositive=tr.ispos=function(){return this.s>0};tr.isZero=function(){return this.s===0};tr.lessThan=tr.lt=function(t){return this.cmp(t)<0};tr.lessThanOrEqualTo=tr.lte=function(t){return this.cmp(t)<1};tr.logarithm=tr.log=function(t){var e,n=this,r=n.constructor,s=r.precision,i=s+5;if(t===void 0)t=new r(10);else if(t=new r(t),t.s<1||t.eq(dm))throw Error(Yf+"NaN");if(n.s<1)throw Error(Yf+(n.s?"NaN":"-Infinity"));return n.eq(dm)?new r(0):(vo=!1,e=Ix(FF(n,i),FF(t,i),i),vo=!0,ba(e,s))};tr.minus=tr.sub=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?GMt(e,t):VMt(e,(t.s=-t.s,t))};tr.modulo=tr.mod=function(t){var e,n=this,r=n.constructor,s=r.precision;if(t=new r(t),!t.s)throw Error(Yf+"NaN");return n.s?(vo=!1,e=Ix(n,t,0,1).times(t),vo=!0,n.minus(e)):ba(new r(n),s)};tr.naturalExponential=tr.exp=function(){return HMt(this)};tr.naturalLogarithm=tr.ln=function(){return FF(this)};tr.negated=tr.neg=function(){var t=new this.constructor(this);return t.s=-t.s||0,t};tr.plus=tr.add=function(t){var e=this;return t=new e.constructor(t),e.s==t.s?VMt(e,t):GMt(e,(t.s=-t.s,t))};tr.precision=tr.sd=function(t){var e,n,r,s=this;if(t!==void 0&&t!==!!t&&t!==1&&t!==0)throw Error(c2+t);if(e=Ql(s)+1,r=s.d.length-1,n=r*Za+1,r=s.d[r],r){for(;r%10==0;r/=10)n--;for(r=s.d[0];r>=10;r/=10)n++}return t&&e>n?e:n};tr.squareRoot=tr.sqrt=function(){var t,e,n,r,s,i,o,l=this,c=l.constructor;if(l.s<1){if(!l.s)return new c(0);throw Error(Yf+"NaN")}for(t=Ql(l),vo=!1,s=Math.sqrt(+l),s==0||s==1/0?(e=ay(l.d),(e.length+t)%2==0&&(e+="0"),s=Math.sqrt(e),t=JM((t+1)/2)-(t<0||t%2),s==1/0?e="5e"+t:(e=s.toExponential(),e=e.slice(0,e.indexOf("e")+1)+t),r=new c(e)):r=new c(s.toString()),n=c.precision,s=o=n+3;;)if(i=r,r=i.plus(Ix(l,i,o+2)).times(.5),ay(i.d).slice(0,o)===(e=ay(r.d)).slice(0,o)){if(e=e.slice(o-3,o+1),s==o&&e=="4999"){if(ba(i,n+1,0),i.times(i).eq(l)){r=i;break}}else if(e!="9999")break;o+=4}return vo=!0,ba(r,n)};tr.times=tr.mul=function(t){var e,n,r,s,i,o,l,c,d,u=this,h=u.constructor,m=u.d,f=(t=new h(t)).d;if(!u.s||!t.s)return new h(0);for(t.s*=u.s,n=u.e+t.e,c=m.length,d=f.length,c<d&&(i=m,m=f,f=i,o=c,c=d,d=o),i=[],o=c+d,r=o;r--;)i.push(0);for(r=d;--r>=0;){for(e=0,s=c+r;s>r;)l=i[s]+f[r]*m[s-r-1]+e,i[s--]=l%Ic|0,e=l/Ic|0;i[s]=(i[s]+e)%Ic|0}for(;!i[--o];)i.pop();return e?++n:i.shift(),t.d=i,t.e=n,vo?ba(t,h.precision):t};tr.toDecimalPlaces=tr.todp=function(t,e){var n=this,r=n.constructor;return n=new r(n),t===void 0?n:(Fy(t,0,ZM),e===void 0?e=r.rounding:Fy(e,0,8),ba(n,t+Ql(n)+1,e))};tr.toExponential=function(t,e){var n,r=this,s=r.constructor;return t===void 0?n=cE(r,!0):(Fy(t,0,ZM),e===void 0?e=s.rounding:Fy(e,0,8),r=ba(new s(r),t+1,e),n=cE(r,!0,t+1)),n};tr.toFixed=function(t,e){var n,r,s=this,i=s.constructor;return t===void 0?cE(s):(Fy(t,0,ZM),e===void 0?e=i.rounding:Fy(e,0,8),r=ba(new i(s),t+Ql(s)+1,e),n=cE(r.abs(),!1,t+Ql(r)+1),s.isneg()&&!s.isZero()?"-"+n:n)};tr.toInteger=tr.toint=function(){var t=this,e=t.constructor;return ba(new e(t),Ql(t)+1,e.rounding)};tr.toNumber=function(){return+this};tr.toPower=tr.pow=function(t){var e,n,r,s,i,o,l=this,c=l.constructor,d=12,u=+(t=new c(t));if(!t.s)return new c(dm);if(l=new c(l),!l.s){if(t.s<1)throw Error(Yf+"Infinity");return l}if(l.eq(dm))return l;if(r=c.precision,t.eq(dm))return ba(l,r);if(e=t.e,n=t.d.length-1,o=e>=n,i=l.s,o){if((n=u<0?-u:u)<=zMt){for(s=new c(dm),e=Math.ceil(r/Za+4),vo=!1;n%2&&(s=s.times(l),sYe(s.d,e)),n=JM(n/2),n!==0;)l=l.times(l),sYe(l.d,e);return vo=!0,t.s<0?new c(dm).div(s):ba(s,r)}}else if(i<0)throw Error(Yf+"NaN");return i=i<0&&t.d[Math.max(e,n)]&1?-1:1,l.s=1,vo=!1,s=t.times(FF(l,r+d)),vo=!0,s=HMt(s),s.s=i,s};tr.toPrecision=function(t,e){var n,r,s=this,i=s.constructor;return t===void 0?(n=Ql(s),r=cE(s,n<=i.toExpNeg||n>=i.toExpPos)):(Fy(t,1,ZM),e===void 0?e=i.rounding:Fy(e,0,8),s=ba(new i(s),t,e),n=Ql(s),r=cE(s,t<=n||n<=i.toExpNeg,t)),r};tr.toSignificantDigits=tr.tosd=function(t,e){var n=this,r=n.constructor;return t===void 0?(t=r.precision,e=r.rounding):(Fy(t,1,ZM),e===void 0?e=r.rounding:Fy(e,0,8)),ba(new r(n),t,e)};tr.toString=tr.valueOf=tr.val=tr.toJSON=tr[Symbol.for("nodejs.util.inspect.custom")]=function(){var t=this,e=Ql(t),n=t.constructor;return cE(t,e<=n.toExpNeg||e>=n.toExpPos)};function VMt(t,e){var n,r,s,i,o,l,c,d,u=t.constructor,h=u.precision;if(!t.s||!e.s)return e.s||(e=new u(t)),vo?ba(e,h):e;if(c=t.d,d=e.d,o=t.e,s=e.e,c=c.slice(),i=o-s,i){for(i<0?(r=c,i=-i,l=d.length):(r=d,s=o,l=c.length),o=Math.ceil(h/Za),l=o>l?o+1:l+1,i>l&&(i=l,r.length=1),r.reverse();i--;)r.push(0);r.reverse()}for(l=c.length,i=d.length,l-i<0&&(i=l,r=d,d=c,c=r),n=0;i;)n=(c[--i]=c[i]+d[i]+n)/Ic|0,c[i]%=Ic;for(n&&(c.unshift(n),++s),l=c.length;c[--l]==0;)c.pop();return e.d=c,e.e=s,vo?ba(e,h):e}function Fy(t,e,n){if(t!==~~t||t<e||t>n)throw Error(c2+t)}function ay(t){var e,n,r,s=t.length-1,i="",o=t[0];if(s>0){for(i+=o,e=1;e<s;e++)r=t[e]+"",n=Za-r.length,n&&(i+=t1(n)),i+=r;o=t[e],r=o+"",n=Za-r.length,n&&(i+=t1(n))}else if(o===0)return"0";for(;o%10===0;)o/=10;return i+o}var Ix=function(){function t(r,s){var i,o=0,l=r.length;for(r=r.slice();l--;)i=r[l]*s+o,r[l]=i%Ic|0,o=i/Ic|0;return o&&r.unshift(o),r}function e(r,s,i,o){var l,c;if(i!=o)c=i>o?1:-1;else for(l=c=0;l<i;l++)if(r[l]!=s[l]){c=r[l]>s[l]?1:-1;break}return c}function n(r,s,i){for(var o=0;i--;)r[i]-=o,o=r[i]<s[i]?1:0,r[i]=o*Ic+r[i]-s[i];for(;!r[0]&&r.length>1;)r.shift()}return function(r,s,i,o){var l,c,d,u,h,m,f,p,g,v,b,x,w,k,S,C,j,E,N=r.constructor,A=r.s==s.s?1:-1,_=r.d,T=s.d;if(!r.s)return new N(r);if(!s.s)throw Error(Yf+"Division by zero");for(c=r.e-s.e,j=T.length,S=_.length,f=new N(A),p=f.d=[],d=0;T[d]==(_[d]||0);)++d;if(T[d]>(_[d]||0)&&--c,i==null?x=i=N.precision:o?x=i+(Ql(r)-Ql(s))+1:x=i,x<0)return new N(0);if(x=x/Za+2|0,d=0,j==1)for(u=0,T=T[0],x++;(d<S||u)&&x--;d++)w=u*Ic+(_[d]||0),p[d]=w/T|0,u=w%T|0;else{for(u=Ic/(T[0]+1)|0,u>1&&(T=t(T,u),_=t(_,u),j=T.length,S=_.length),k=j,g=_.slice(0,j),v=g.length;v<j;)g[v++]=0;E=T.slice(),E.unshift(0),C=T[0],T[1]>=Ic/2&&++C;do u=0,l=e(T,g,j,v),l<0?(b=g[0],j!=v&&(b=b*Ic+(g[1]||0)),u=b/C|0,u>1?(u>=Ic&&(u=Ic-1),h=t(T,u),m=h.length,v=g.length,l=e(h,g,m,v),l==1&&(u--,n(h,j<m?E:T,m))):(u==0&&(l=u=1),h=T.slice()),m=h.length,m<v&&h.unshift(0),n(g,h,v),l==-1&&(v=g.length,l=e(T,g,j,v),l<1&&(u++,n(g,j<v?E:T,v))),v=g.length):l===0&&(u++,g=[0]),p[d++]=u,l&&g[0]?g[v++]=_[k]||0:(g=[_[k]],v=1);while((k++<S||g[0]!==void 0)&&x--)}return p[0]||p.shift(),f.e=c,ba(f,o?i+Ql(f)+1:i)}}();function HMt(t,e){var n,r,s,i,o,l,c=0,d=0,u=t.constructor,h=u.precision;if(Ql(t)>16)throw Error(P5e+Ql(t));if(!t.s)return new u(dm);for(e==null?(vo=!1,l=h):l=e,o=new u(.03125);t.abs().gte(.1);)t=t.times(o),d+=5;for(r=Math.log(GC(2,d))/Math.LN10*2+5|0,l+=r,n=s=i=new u(dm),u.precision=l;;){if(s=ba(s.times(t),l),n=n.times(++c),o=i.plus(Ix(s,n,l)),ay(o.d).slice(0,l)===ay(i.d).slice(0,l)){for(;d--;)i=ba(i.times(i),l);return u.precision=h,e==null?(vo=!0,ba(i,h)):i}i=o}}function Ql(t){for(var e=t.e*Za,n=t.d[0];n>=10;n/=10)e++;return e}function nhe(t,e,n){if(e>t.LN10.sd())throw vo=!0,n&&(t.precision=n),Error(Yf+"LN10 precision limit exceeded");return ba(new t(t.LN10),e)}function t1(t){for(var e="";t--;)e+="0";return e}function FF(t,e){var n,r,s,i,o,l,c,d,u,h=1,m=10,f=t,p=f.d,g=f.constructor,v=g.precision;if(f.s<1)throw Error(Yf+(f.s?"NaN":"-Infinity"));if(f.eq(dm))return new g(0);if(e==null?(vo=!1,d=v):d=e,f.eq(10))return e==null&&(vo=!0),nhe(g,d);if(d+=m,g.precision=d,n=ay(p),r=n.charAt(0),i=Ql(f),Math.abs(i)<15e14){for(;r<7&&r!=1||r==1&&n.charAt(1)>3;)f=f.times(t),n=ay(f.d),r=n.charAt(0),h++;i=Ql(f),r>1?(f=new g("0."+n),i++):f=new g(r+"."+n.slice(1))}else return c=nhe(g,d+2,v).times(i+""),f=FF(new g(r+"."+n.slice(1)),d-m).plus(c),g.precision=v,e==null?(vo=!0,ba(f,v)):f;for(l=o=f=Ix(f.minus(dm),f.plus(dm),d),u=ba(f.times(f),d),s=3;;){if(o=ba(o.times(u),d),c=l.plus(Ix(o,new g(s),d)),ay(c.d).slice(0,d)===ay(l.d).slice(0,d))return l=l.times(2),i!==0&&(l=l.plus(nhe(g,d+2,v).times(i+""))),l=Ix(l,new g(h),d),g.precision=v,e==null?(vo=!0,ba(l,v)):l;l=c,s+=2}}function rYe(t,e){var n,r,s;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;e.charCodeAt(r)===48;)++r;for(s=e.length;e.charCodeAt(s-1)===48;)--s;if(e=e.slice(r,s),e){if(s-=r,n=n-r-1,t.e=JM(n/Za),t.d=[],r=(n+1)%Za,n<0&&(r+=Za),r<s){for(r&&t.d.push(+e.slice(0,r)),s-=Za;r<s;)t.d.push(+e.slice(r,r+=Za));e=e.slice(r),r=Za-e.length}else r-=s;for(;r--;)e+="0";if(t.d.push(+e),vo&&(t.e>HJ||t.e<-HJ))throw Error(P5e+n)}else t.s=0,t.e=0,t.d=[0];return t}function ba(t,e,n){var r,s,i,o,l,c,d,u,h=t.d;for(o=1,i=h[0];i>=10;i/=10)o++;if(r=e-o,r<0)r+=Za,s=e,d=h[u=0];else{if(u=Math.ceil((r+1)/Za),i=h.length,u>=i)return t;for(d=i=h[u],o=1;i>=10;i/=10)o++;r%=Za,s=r-Za+o}if(n!==void 0&&(i=GC(10,o-s-1),l=d/i%10|0,c=e<0||h[u+1]!==void 0||d%i,c=n<4?(l||c)&&(n==0||n==(t.s<0?3:2)):l>5||l==5&&(n==4||c||n==6&&(r>0?s>0?d/GC(10,o-s):0:h[u-1])%10&1||n==(t.s<0?8:7))),e<1||!h[0])return c?(i=Ql(t),h.length=1,e=e-i-1,h[0]=GC(10,(Za-e%Za)%Za),t.e=JM(-e/Za)||0):(h.length=1,h[0]=t.e=t.s=0),t;if(r==0?(h.length=u,i=1,u--):(h.length=u+1,i=GC(10,Za-r),h[u]=s>0?(d/GC(10,o-s)%GC(10,s)|0)*i:0),c)for(;;)if(u==0){(h[0]+=i)==Ic&&(h[0]=1,++t.e);break}else{if(h[u]+=i,h[u]!=Ic)break;h[u--]=0,i=1}for(r=h.length;h[--r]===0;)h.pop();if(vo&&(t.e>HJ||t.e<-HJ))throw Error(P5e+Ql(t));return t}function GMt(t,e){var n,r,s,i,o,l,c,d,u,h,m=t.constructor,f=m.precision;if(!t.s||!e.s)return e.s?e.s=-e.s:e=new m(t),vo?ba(e,f):e;if(c=t.d,h=e.d,r=e.e,d=t.e,c=c.slice(),o=d-r,o){for(u=o<0,u?(n=c,o=-o,l=h.length):(n=h,r=d,l=c.length),s=Math.max(Math.ceil(f/Za),l)+2,o>s&&(o=s,n.length=1),n.reverse(),s=o;s--;)n.push(0);n.reverse()}else{for(s=c.length,l=h.length,u=s<l,u&&(l=s),s=0;s<l;s++)if(c[s]!=h[s]){u=c[s]<h[s];break}o=0}for(u&&(n=c,c=h,h=n,e.s=-e.s),l=c.length,s=h.length-l;s>0;--s)c[l++]=0;for(s=h.length;s>o;){if(c[--s]<h[s]){for(i=s;i&&c[--i]===0;)c[i]=Ic-1;--c[i],c[s]+=Ic}c[s]-=h[s]}for(;c[--l]===0;)c.pop();for(;c[0]===0;c.shift())--r;return c[0]?(e.d=c,e.e=r,vo?ba(e,f):e):new m(0)}function cE(t,e,n){var r,s=Ql(t),i=ay(t.d),o=i.length;return e?(n&&(r=n-o)>0?i=i.charAt(0)+"."+i.slice(1)+t1(r):o>1&&(i=i.charAt(0)+"."+i.slice(1)),i=i+(s<0?"e":"e+")+s):s<0?(i="0."+t1(-s-1)+i,n&&(r=n-o)>0&&(i+=t1(r))):s>=o?(i+=t1(s+1-o),n&&(r=n-s-1)>0&&(i=i+"."+t1(r))):((r=s+1)<o&&(i=i.slice(0,r)+"."+i.slice(r)),n&&(r=n-o)>0&&(s+1===o&&(i+="."),i+=t1(r))),t.s<0?"-"+i:i}function sYe(t,e){if(t.length>e)return t.length=e,!0}function WMt(t){var e,n,r;function s(i){var o=this;if(!(o instanceof s))return new s(i);if(o.constructor=s,i instanceof s){o.s=i.s,o.e=i.e,o.d=(i=i.d)?i.slice():i;return}if(typeof i=="number"){if(i*0!==0)throw Error(c2+i);if(i>0)o.s=1;else if(i<0)i=-i,o.s=-1;else{o.s=0,o.e=0,o.d=[0];return}if(i===~~i&&i<1e7){o.e=0,o.d=[i];return}return rYe(o,i.toString())}else if(typeof i!="string")throw Error(c2+i);if(i.charCodeAt(0)===45?(i=i.slice(1),o.s=-1):o.s=1,UHr.test(i))rYe(o,i);else throw Error(c2+i)}if(s.prototype=tr,s.ROUND_UP=0,s.ROUND_DOWN=1,s.ROUND_CEIL=2,s.ROUND_FLOOR=3,s.ROUND_HALF_UP=4,s.ROUND_HALF_DOWN=5,s.ROUND_HALF_EVEN=6,s.ROUND_HALF_CEIL=7,s.ROUND_HALF_FLOOR=8,s.clone=WMt,s.config=s.set=zHr,t===void 0&&(t={}),t)for(r=["precision","rounding","toExpNeg","toExpPos","LN10"],e=0;e<r.length;)t.hasOwnProperty(n=r[e++])||(t[n]=this[n]);return s.config(t),s}function zHr(t){if(!t||typeof t!="object")throw Error(Yf+"Object expected");var e,n,r,s=["precision",1,ZM,"rounding",0,8,"toExpNeg",-1/0,0,"toExpPos",0,1/0];for(e=0;e<s.length;e+=3)if((r=t[n=s[e]])!==void 0)if(JM(r)===r&&r>=s[e+1]&&r<=s[e+2])this[n]=r;else throw Error(c2+n+": "+r);if((r=t[n="LN10"])!==void 0)if(r==Math.LN10)this[n]=new this(r);else throw Error(c2+n+": "+r);return this}var R5e=WMt(BHr);dm=new R5e(1);const ea=R5e;function VHr(t){return qHr(t)||WHr(t)||GHr(t)||HHr()}function HHr(){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 GHr(t,e){if(t){if(typeof t=="string")return Owe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Owe(t,e)}}function WHr(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function qHr(t){if(Array.isArray(t))return Owe(t)}function Owe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var KHr=function(e){return e},qMt={"@@functional/placeholder":!0},KMt=function(e){return e===qMt},iYe=function(e){return function n(){return arguments.length===0||arguments.length===1&&KMt(arguments.length<=0?void 0:arguments[0])?n:e.apply(void 0,arguments)}},YHr=function t(e,n){return e===1?n:iYe(function(){for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];var o=s.filter(function(l){return l!==qMt}).length;return o>=e?n.apply(void 0,s):t(e-o,iYe(function(){for(var l=arguments.length,c=new Array(l),d=0;d<l;d++)c[d]=arguments[d];var u=s.map(function(h){return KMt(h)?c.shift():h});return n.apply(void 0,VHr(u).concat(c))}))})},Lie=function(e){return YHr(e.length,e)},Fwe=function(e,n){for(var r=[],s=e;s<n;++s)r[s-e]=s;return r},QHr=Lie(function(t,e){return Array.isArray(e)?e.map(t):Object.keys(e).map(function(n){return e[n]}).map(t)}),ZHr=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];if(!n.length)return KHr;var s=n.reverse(),i=s[0],o=s.slice(1);return function(){return o.reduce(function(l,c){return c(l)},i.apply(void 0,arguments))}},Bwe=function(e){return Array.isArray(e)?e.reverse():e.split("").reverse.join("")},YMt=function(e){var n=null,r=null;return function(){for(var s=arguments.length,i=new Array(s),o=0;o<s;o++)i[o]=arguments[o];return n&&i.every(function(l,c){return l===n[c]})||(n=i,r=e.apply(void 0,i)),r}};function JHr(t){var e;return t===0?e=1:e=Math.floor(new ea(t).abs().log(10).toNumber())+1,e}function XHr(t,e,n){for(var r=new ea(t),s=0,i=[];r.lt(e)&&s<1e5;)i.push(r.toNumber()),r=r.add(n),s++;return i}var eGr=Lie(function(t,e,n){var r=+t,s=+e;return r+n*(s-r)}),tGr=Lie(function(t,e,n){var r=e-+t;return r=r||1/0,(n-t)/r}),nGr=Lie(function(t,e,n){var r=e-+t;return r=r||1/0,Math.max(0,Math.min(1,(n-t)/r))});const Die={rangeStep:XHr,getDigitCount:JHr,interpolateNumber:eGr,uninterpolateNumber:tGr,uninterpolateTruncation:nGr};function Uwe(t){return iGr(t)||sGr(t)||QMt(t)||rGr()}function rGr(){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 sGr(t){if(typeof Symbol<"u"&&Symbol.iterator in Object(t))return Array.from(t)}function iGr(t){if(Array.isArray(t))return zwe(t)}function BF(t,e){return lGr(t)||oGr(t,e)||QMt(t,e)||aGr()}function aGr(){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 QMt(t,e){if(t){if(typeof t=="string")return zwe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return zwe(t,e)}}function zwe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function oGr(t,e){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(t)))){var n=[],r=!0,s=!1,i=void 0;try{for(var o=t[Symbol.iterator](),l;!(r=(l=o.next()).done)&&(n.push(l.value),!(e&&n.length===e));r=!0);}catch(c){s=!0,i=c}finally{try{!r&&o.return!=null&&o.return()}finally{if(s)throw i}}return n}}function lGr(t){if(Array.isArray(t))return t}function ZMt(t){var e=BF(t,2),n=e[0],r=e[1],s=n,i=r;return n>r&&(s=r,i=n),[s,i]}function JMt(t,e,n){if(t.lte(0))return new ea(0);var r=Die.getDigitCount(t.toNumber()),s=new ea(10).pow(r),i=t.div(s),o=r!==1?.05:.1,l=new ea(Math.ceil(i.div(o).toNumber())).add(n).mul(o),c=l.mul(s);return e?c:new ea(Math.ceil(c))}function cGr(t,e,n){var r=1,s=new ea(t);if(!s.isint()&&n){var i=Math.abs(t);i<1?(r=new ea(10).pow(Die.getDigitCount(t)-1),s=new ea(Math.floor(s.div(r).toNumber())).mul(r)):i>1&&(s=new ea(Math.floor(t)))}else t===0?s=new ea(Math.floor((e-1)/2)):n||(s=new ea(Math.floor(t)));var o=Math.floor((e-1)/2),l=ZHr(QHr(function(c){return s.add(new ea(c-o).mul(r)).toNumber()}),Fwe);return l(0,e)}function XMt(t,e,n,r){var s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:0;if(!Number.isFinite((e-t)/(n-1)))return{step:new ea(0),tickMin:new ea(0),tickMax:new ea(0)};var i=JMt(new ea(e).sub(t).div(n-1),r,s),o;t<=0&&e>=0?o=new ea(0):(o=new ea(t).add(e).div(2),o=o.sub(new ea(o).mod(i)));var l=Math.ceil(o.sub(t).div(i).toNumber()),c=Math.ceil(new ea(e).sub(o).div(i).toNumber()),d=l+c+1;return d>n?XMt(t,e,n,r,s+1):(d<n&&(c=e>0?c+(n-d):c,l=e>0?l:l+(n-d)),{step:i,tickMin:o.sub(new ea(l).mul(i)),tickMax:o.add(new ea(c).mul(i))})}function dGr(t){var e=BF(t,2),n=e[0],r=e[1],s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:6,i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=Math.max(s,2),l=ZMt([n,r]),c=BF(l,2),d=c[0],u=c[1];if(d===-1/0||u===1/0){var h=u===1/0?[d].concat(Uwe(Fwe(0,s-1).map(function(){return 1/0}))):[].concat(Uwe(Fwe(0,s-1).map(function(){return-1/0})),[u]);return n>r?Bwe(h):h}if(d===u)return cGr(d,s,i);var m=XMt(d,u,o,i),f=m.step,p=m.tickMin,g=m.tickMax,v=Die.rangeStep(p,g.add(new ea(.1).mul(f)),f);return n>r?Bwe(v):v}function uGr(t,e){var n=BF(t,2),r=n[0],s=n[1],i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,o=ZMt([r,s]),l=BF(o,2),c=l[0],d=l[1];if(c===-1/0||d===1/0)return[r,s];if(c===d)return[c];var u=Math.max(e,2),h=JMt(new ea(d).sub(c).div(u-1),i,0),m=[].concat(Uwe(Die.rangeStep(new ea(c),new ea(d).sub(new ea(.99).mul(h)),h)),[d]);return r>s?Bwe(m):m}var hGr=YMt(dGr),mGr=YMt(uGr),fGr="Invariant failed";function dE(t,e){throw new Error(fGr)}var pGr=["offset","layout","width","dataKey","data","dataPointFormatter","xAxis","yAxis"];function x5(t){"@babel/helpers - typeof";return x5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},x5(t)}function GJ(){return GJ=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},GJ.apply(this,arguments)}function gGr(t,e){return xGr(t)||bGr(t,e)||yGr(t,e)||vGr()}function vGr(){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 yGr(t,e){if(t){if(typeof t=="string")return aYe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return aYe(t,e)}}function aYe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function bGr(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(u){d=!0,s=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function xGr(t){if(Array.isArray(t))return t}function wGr(t,e){if(t==null)return{};var n=kGr(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function kGr(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function SGr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function CGr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,nLt(r.key),r)}}function jGr(t,e,n){return e&&CGr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function EGr(t,e,n){return e=WJ(e),NGr(t,eLt()?Reflect.construct(e,n||[],WJ(t).constructor):e.apply(t,n))}function NGr(t,e){if(e&&(x5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return TGr(t)}function TGr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function eLt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(eLt=function(){return!!t})()}function WJ(t){return WJ=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},WJ(t)}function _Gr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&Vwe(t,e)}function Vwe(t,e){return Vwe=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},Vwe(t,e)}function tLt(t,e,n){return e=nLt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function nLt(t){var e=AGr(t,"string");return x5(e)=="symbol"?e:e+""}function AGr(t,e){if(x5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(x5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var XM=function(t){function e(){return SGr(this,e),EGr(this,e,arguments)}return _Gr(e,t),jGr(e,[{key:"render",value:function(){var r=this.props,s=r.offset,i=r.layout,o=r.width,l=r.dataKey,c=r.data,d=r.dataPointFormatter,u=r.xAxis,h=r.yAxis,m=wGr(r,pGr),f=hr(m,!1);this.props.direction==="x"&&u.type!=="number"&&dE();var p=c.map(function(g){var v=d(g,l),b=v.x,x=v.y,w=v.value,k=v.errorVal;if(!k)return null;var S=[],C,j;if(Array.isArray(k)){var E=gGr(k,2);C=E[0],j=E[1]}else C=j=k;if(i==="vertical"){var N=u.scale,A=x+s,_=A+o,T=A-o,R=N(w-C),O=N(w+j);S.push({x1:O,y1:_,x2:O,y2:T}),S.push({x1:R,y1:A,x2:O,y2:A}),S.push({x1:R,y1:_,x2:R,y2:T})}else if(i==="horizontal"){var F=h.scale,D=b+s,I=D-o,P=D+o,M=F(w-C),z=F(w+j);S.push({x1:I,y1:z,x2:P,y2:z}),S.push({x1:D,y1:M,x2:D,y2:z}),S.push({x1:I,y1:M,x2:P,y2:M})}return se.createElement(Cs,GJ({className:"recharts-errorBar",key:"bar-".concat(S.map(function(G){return"".concat(G.x1,"-").concat(G.x2,"-").concat(G.y1,"-").concat(G.y2)}))},f),S.map(function(G){return se.createElement("line",GJ({},G,{key:"line-".concat(G.x1,"-").concat(G.x2,"-").concat(G.y1,"-").concat(G.y2)}))}))});return se.createElement(Cs,{className:"recharts-errorBars"},p)}}])}(se.Component);tLt(XM,"defaultProps",{stroke:"black",strokeWidth:1.5,width:5,offset:0,layout:"horizontal"});tLt(XM,"displayName","ErrorBar");function UF(t){"@babel/helpers - typeof";return UF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},UF(t)}function oYe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function cC(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?oYe(Object(n),!0).forEach(function(r){PGr(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):oYe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function PGr(t,e,n){return e=RGr(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function RGr(t){var e=IGr(t,"string");return UF(e)=="symbol"?e:e+""}function IGr(t,e){if(UF(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(UF(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var rLt=function(e){var n=e.children,r=e.formattedGraphicalItems,s=e.legendWidth,i=e.legendContent,o=im(n,o2);if(!o)return null;var l=o2.defaultProps,c=l!==void 0?cC(cC({},l),o.props):{},d;return o.props&&o.props.payload?d=o.props&&o.props.payload:i==="children"?d=(r||[]).reduce(function(u,h){var m=h.item,f=h.props,p=f.sectors||f.data||[];return u.concat(p.map(function(g){return{type:o.props.iconType||m.props.legendType,value:g.name,color:g.fill,payload:g}}))},[]):d=(r||[]).map(function(u){var h=u.item,m=h.type.defaultProps,f=m!==void 0?cC(cC({},m),h.props):{},p=f.dataKey,g=f.name,v=f.legendType,b=f.hide;return{inactive:b,dataKey:p,type:c.iconType||v||"square",color:I5e(h),value:g||p,payload:f}}),cC(cC(cC({},c),o2.getWithHeight(o,s)),{},{payload:d,item:o})};function zF(t){"@babel/helpers - typeof";return zF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},zF(t)}function lYe(t){return $Gr(t)||DGr(t)||LGr(t)||MGr()}function MGr(){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 LGr(t,e){if(t){if(typeof t=="string")return Hwe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Hwe(t,e)}}function DGr(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function $Gr(t){if(Array.isArray(t))return Hwe(t)}function Hwe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function cYe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Zo(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?cYe(Object(n),!0).forEach(function(r){pP(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):cYe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function pP(t,e,n){return e=OGr(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function OGr(t){var e=FGr(t,"string");return zF(e)=="symbol"?e:e+""}function FGr(t,e){if(zF(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(zF(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function eo(t,e,n){return $r(t)||$r(e)?n:gc(e)?Cm(t,e,n):Wr(e)?e(t):n}function $$(t,e,n,r){var s=FHr(t,function(l){return eo(l,e)});if(n==="number"){var i=s.filter(function(l){return ln(l)||parseFloat(l)});return i.length?[Mie(i),D1(i)]:[1/0,-1/0]}var o=r?s.filter(function(l){return!$r(l)}):s;return o.map(function(l){return gc(l)||l instanceof Date?l:""})}var BGr=function(e){var n,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[],s=arguments.length>2?arguments[2]:void 0,i=arguments.length>3?arguments[3]:void 0,o=-1,l=(n=r==null?void 0:r.length)!==null&&n!==void 0?n:0;if(l<=1)return 0;if(i&&i.axisType==="angleAxis"&&Math.abs(Math.abs(i.range[1]-i.range[0])-360)<=1e-6)for(var c=i.range,d=0;d<l;d++){var u=d>0?s[d-1].coordinate:s[l-1].coordinate,h=s[d].coordinate,m=d>=l-1?s[0].coordinate:s[d+1].coordinate,f=void 0;if(_u(h-u)!==_u(m-h)){var p=[];if(_u(m-h)===_u(c[1]-c[0])){f=m;var g=h+c[1]-c[0];p[0]=Math.min(g,(g+u)/2),p[1]=Math.max(g,(g+u)/2)}else{f=u;var v=m+c[1]-c[0];p[0]=Math.min(h,(v+h)/2),p[1]=Math.max(h,(v+h)/2)}var b=[Math.min(h,(f+h)/2),Math.max(h,(f+h)/2)];if(e>b[0]&&e<=b[1]||e>=p[0]&&e<=p[1]){o=s[d].index;break}}else{var x=Math.min(u,m),w=Math.max(u,m);if(e>(x+h)/2&&e<=(w+h)/2){o=s[d].index;break}}}else for(var k=0;k<l;k++)if(k===0&&e<=(r[k].coordinate+r[k+1].coordinate)/2||k>0&&k<l-1&&e>(r[k].coordinate+r[k-1].coordinate)/2&&e<=(r[k].coordinate+r[k+1].coordinate)/2||k===l-1&&e>(r[k].coordinate+r[k-1].coordinate)/2){o=r[k].index;break}return o},I5e=function(e){var n,r=e,s=r.type.displayName,i=(n=e.type)!==null&&n!==void 0&&n.defaultProps?Zo(Zo({},e.type.defaultProps),e.props):e.props,o=i.stroke,l=i.fill,c;switch(s){case"Line":c=o;break;case"Area":case"Radar":c=o&&o!=="none"?o:l;break;default:c=l;break}return c},UGr=function(e){var n=e.barSize,r=e.totalSize,s=e.stackGroups,i=s===void 0?{}:s;if(!i)return{};for(var o={},l=Object.keys(i),c=0,d=l.length;c<d;c++)for(var u=i[l[c]].stackGroups,h=Object.keys(u),m=0,f=h.length;m<f;m++){var p=u[h[m]],g=p.items,v=p.cateAxisId,b=g.filter(function(j){return Px(j.type).indexOf("Bar")>=0});if(b&&b.length){var x=b[0].type.defaultProps,w=x!==void 0?Zo(Zo({},x),b[0].props):b[0].props,k=w.barSize,S=w[v];o[S]||(o[S]=[]);var C=$r(k)?n:k;o[S].push({item:b[0],stackList:b.slice(1),barSize:$r(C)?void 0:Au(C,r,0)})}}return o},zGr=function(e){var n=e.barGap,r=e.barCategoryGap,s=e.bandSize,i=e.sizeList,o=i===void 0?[]:i,l=e.maxBarSize,c=o.length;if(c<1)return null;var d=Au(n,s,0,!0),u,h=[];if(o[0].barSize===+o[0].barSize){var m=!1,f=s/c,p=o.reduce(function(k,S){return k+S.barSize||0},0);p+=(c-1)*d,p>=s&&(p-=(c-1)*d,d=0),p>=s&&f>0&&(m=!0,f*=.9,p=c*f);var g=(s-p)/2>>0,v={offset:g-d,size:0};u=o.reduce(function(k,S){var C={item:S.item,position:{offset:v.offset+v.size+d,size:m?f:S.barSize}},j=[].concat(lYe(k),[C]);return v=j[j.length-1].position,S.stackList&&S.stackList.length&&S.stackList.forEach(function(E){j.push({item:E,position:v})}),j},h)}else{var b=Au(r,s,0,!0);s-2*b-(c-1)*d<=0&&(d=0);var x=(s-2*b-(c-1)*d)/c;x>1&&(x>>=0);var w=l===+l?Math.min(x,l):x;u=o.reduce(function(k,S,C){var j=[].concat(lYe(k),[{item:S.item,position:{offset:b+(x+d)*C+(x-w)/2,size:w}}]);return S.stackList&&S.stackList.length&&S.stackList.forEach(function(E){j.push({item:E,position:j[j.length-1].position})}),j},h)}return u},VGr=function(e,n,r,s){var i=r.children,o=r.width,l=r.margin,c=o-(l.left||0)-(l.right||0),d=rLt({children:i,legendWidth:c});if(d){var u=s||{},h=u.width,m=u.height,f=d.align,p=d.verticalAlign,g=d.layout;if((g==="vertical"||g==="horizontal"&&p==="middle")&&f!=="center"&&ln(e[f]))return Zo(Zo({},e),{},pP({},f,e[f]+(h||0)));if((g==="horizontal"||g==="vertical"&&f==="center")&&p!=="middle"&&ln(e[p]))return Zo(Zo({},e),{},pP({},p,e[p]+(m||0)))}return e},HGr=function(e,n,r){return $r(n)?!0:e==="horizontal"?n==="yAxis":e==="vertical"||r==="x"?n==="xAxis":r==="y"?n==="yAxis":!0},sLt=function(e,n,r,s,i){var o=n.props.children,l=Lu(o,XM).filter(function(d){return HGr(s,i,d.props.direction)});if(l&&l.length){var c=l.map(function(d){return d.props.dataKey});return e.reduce(function(d,u){var h=eo(u,r);if($r(h))return d;var m=Array.isArray(h)?[Mie(h),D1(h)]:[h,h],f=c.reduce(function(p,g){var v=eo(u,g,0),b=m[0]-Math.abs(Array.isArray(v)?v[0]:v),x=m[1]+Math.abs(Array.isArray(v)?v[1]:v);return[Math.min(b,p[0]),Math.max(x,p[1])]},[1/0,-1/0]);return[Math.min(f[0],d[0]),Math.max(f[1],d[1])]},[1/0,-1/0])}return null},GGr=function(e,n,r,s,i){var o=n.map(function(l){return sLt(e,l,r,i,s)}).filter(function(l){return!$r(l)});return o&&o.length?o.reduce(function(l,c){return[Math.min(l[0],c[0]),Math.max(l[1],c[1])]},[1/0,-1/0]):null},iLt=function(e,n,r,s,i){var o=n.map(function(c){var d=c.props.dataKey;return r==="number"&&d&&sLt(e,c,d,s)||$$(e,d,r,i)});if(r==="number")return o.reduce(function(c,d){return[Math.min(c[0],d[0]),Math.max(c[1],d[1])]},[1/0,-1/0]);var l={};return o.reduce(function(c,d){for(var u=0,h=d.length;u<h;u++)l[d[u]]||(l[d[u]]=!0,c.push(d[u]));return c},[])},aLt=function(e,n){return e==="horizontal"&&n==="xAxis"||e==="vertical"&&n==="yAxis"||e==="centric"&&n==="angleAxis"||e==="radial"&&n==="radiusAxis"},oLt=function(e,n,r,s){if(s)return e.map(function(c){return c.coordinate});var i,o,l=e.map(function(c){return c.coordinate===n&&(i=!0),c.coordinate===r&&(o=!0),c.coordinate});return i||l.push(n),o||l.push(r),l},gx=function(e,n,r){if(!e)return null;var s=e.scale,i=e.duplicateDomain,o=e.type,l=e.range,c=e.realScaleType==="scaleBand"?s.bandwidth()/2:2,d=(n||r)&&o==="category"&&s.bandwidth?s.bandwidth()/c:0;if(d=e.axisType==="angleAxis"&&(l==null?void 0:l.length)>=2?_u(l[0]-l[1])*2*d:d,n&&(e.ticks||e.niceTicks)){var u=(e.ticks||e.niceTicks).map(function(h){var m=i?i.indexOf(h):h;return{coordinate:s(m)+d,value:h,offset:d}});return u.filter(function(h){return!YM(h.coordinate)})}return e.isCategorical&&e.categoricalDomain?e.categoricalDomain.map(function(h,m){return{coordinate:s(h)+d,value:h,index:m,offset:d}}):s.ticks&&!r?s.ticks(e.tickCount).map(function(h){return{coordinate:s(h)+d,value:h,offset:d}}):s.domain().map(function(h,m){return{coordinate:s(h)+d,value:i?i[h]:h,index:m,offset:d}})},rhe=new WeakMap,hH=function(e,n){if(typeof n!="function")return e;rhe.has(e)||rhe.set(e,new WeakMap);var r=rhe.get(e);if(r.has(n))return r.get(n);var s=function(){e.apply(void 0,arguments),n.apply(void 0,arguments)};return r.set(n,s),s},lLt=function(e,n,r){var s=e.scale,i=e.type,o=e.layout,l=e.axisType;if(s==="auto")return o==="radial"&&l==="radiusAxis"?{scale:LF(),realScaleType:"band"}:o==="radial"&&l==="angleAxis"?{scale:BJ(),realScaleType:"linear"}:i==="category"&&n&&(n.indexOf("LineChart")>=0||n.indexOf("AreaChart")>=0||n.indexOf("ComposedChart")>=0&&!r)?{scale:D$(),realScaleType:"point"}:i==="category"?{scale:LF(),realScaleType:"band"}:{scale:BJ(),realScaleType:"linear"};if(aE(s)){var c="scale".concat(wie(s));return{scale:(nYe[c]||D$)(),realScaleType:nYe[c]?c:"point"}}return Wr(s)?{scale:s}:{scale:D$(),realScaleType:"point"}},dYe=1e-4,cLt=function(e){var n=e.domain();if(!(!n||n.length<=2)){var r=n.length,s=e.range(),i=Math.min(s[0],s[1])-dYe,o=Math.max(s[0],s[1])+dYe,l=e(n[0]),c=e(n[r-1]);(l<i||l>o||c<i||c>o)&&e.domain([n[0],n[r-1]])}},WGr=function(e,n){if(!e)return null;for(var r=0,s=e.length;r<s;r++)if(e[r].item===n)return e[r].position;return null},qGr=function(e,n){if(!n||n.length!==2||!ln(n[0])||!ln(n[1]))return e;var r=Math.min(n[0],n[1]),s=Math.max(n[0],n[1]),i=[e[0],e[1]];return(!ln(e[0])||e[0]<r)&&(i[0]=r),(!ln(e[1])||e[1]>s)&&(i[1]=s),i[0]>s&&(i[0]=s),i[1]<r&&(i[1]=r),i},KGr=function(e){var n=e.length;if(!(n<=0))for(var r=0,s=e[0].length;r<s;++r)for(var i=0,o=0,l=0;l<n;++l){var c=YM(e[l][r][1])?e[l][r][0]:e[l][r][1];c>=0?(e[l][r][0]=i,e[l][r][1]=i+c,i=e[l][r][1]):(e[l][r][0]=o,e[l][r][1]=o+c,o=e[l][r][1])}},YGr=function(e){var n=e.length;if(!(n<=0))for(var r=0,s=e[0].length;r<s;++r)for(var i=0,o=0;o<n;++o){var l=YM(e[o][r][1])?e[o][r][0]:e[o][r][1];l>=0?(e[o][r][0]=i,e[o][r][1]=i+l,i=e[o][r][1]):(e[o][r][0]=0,e[o][r][1]=0)}},QGr={sign:KGr,expand:U7r,none:h5,silhouette:z7r,wiggle:V7r,positive:YGr},ZGr=function(e,n,r){var s=n.map(function(l){return l.props.dataKey}),i=QGr[r],o=B7r().keys(s).value(function(l,c){return+eo(l,c,0)}).order(bwe).offset(i);return o(e)},JGr=function(e,n,r,s,i,o){if(!e)return null;var l=o?n.reverse():n,c={},d=l.reduce(function(h,m){var f,p=(f=m.type)!==null&&f!==void 0&&f.defaultProps?Zo(Zo({},m.type.defaultProps),m.props):m.props,g=p.stackId,v=p.hide;if(v)return h;var b=p[r],x=h[b]||{hasStack:!1,stackGroups:{}};if(gc(g)){var w=x.stackGroups[g]||{numericAxisId:r,cateAxisId:s,items:[]};w.items.push(m),x.hasStack=!0,x.stackGroups[g]=w}else x.stackGroups[MS("_stackId_")]={numericAxisId:r,cateAxisId:s,items:[m]};return Zo(Zo({},h),{},pP({},b,x))},c),u={};return Object.keys(d).reduce(function(h,m){var f=d[m];if(f.hasStack){var p={};f.stackGroups=Object.keys(f.stackGroups).reduce(function(g,v){var b=f.stackGroups[v];return Zo(Zo({},g),{},pP({},v,{numericAxisId:r,cateAxisId:s,items:b.items,stackedData:ZGr(e,b.items,i)}))},p)}return Zo(Zo({},h),{},pP({},m,f))},u)},dLt=function(e,n){var r=n.realScaleType,s=n.type,i=n.tickCount,o=n.originalDomain,l=n.allowDecimals,c=r||n.scale;if(c!=="auto"&&c!=="linear")return null;if(i&&s==="number"&&o&&(o[0]==="auto"||o[1]==="auto")){var d=e.domain();if(!d.length)return null;var u=hGr(d,i,l);return e.domain([Mie(u),D1(u)]),{niceTicks:u}}if(i&&s==="number"){var h=e.domain(),m=mGr(h,i,l);return{niceTicks:m}}return null};function w5(t){var e=t.axis,n=t.ticks,r=t.bandSize,s=t.entry,i=t.index,o=t.dataKey;if(e.type==="category"){if(!e.allowDuplicatedCategory&&e.dataKey&&!$r(s[e.dataKey])){var l=kJ(n,"value",s[e.dataKey]);if(l)return l.coordinate+r/2}return n[i]?n[i].coordinate+r/2:null}var c=eo(s,$r(o)?e.dataKey:o);return $r(c)?null:e.scale(c)}var uYe=function(e){var n=e.axis,r=e.ticks,s=e.offset,i=e.bandSize,o=e.entry,l=e.index;if(n.type==="category")return r[l]?r[l].coordinate+s:null;var c=eo(o,n.dataKey,n.domain[l]);return $r(c)?null:n.scale(c)-i/2+s},XGr=function(e){var n=e.numericAxis,r=n.scale.domain();if(n.type==="number"){var s=Math.min(r[0],r[1]),i=Math.max(r[0],r[1]);return s<=0&&i>=0?0:i<0?i:s}return r[0]},eWr=function(e,n){var r,s=(r=e.type)!==null&&r!==void 0&&r.defaultProps?Zo(Zo({},e.type.defaultProps),e.props):e.props,i=s.stackId;if(gc(i)){var o=n[i];if(o){var l=o.items.indexOf(e);return l>=0?o.stackedData[l]:null}}return null},tWr=function(e){return e.reduce(function(n,r){return[Mie(r.concat([n[0]]).filter(ln)),D1(r.concat([n[1]]).filter(ln))]},[1/0,-1/0])},uLt=function(e,n,r){return Object.keys(e).reduce(function(s,i){var o=e[i],l=o.stackedData,c=l.reduce(function(d,u){var h=tWr(u.slice(n,r+1));return[Math.min(d[0],h[0]),Math.max(d[1],h[1])]},[1/0,-1/0]);return[Math.min(c[0],s[0]),Math.max(c[1],s[1])]},[1/0,-1/0]).map(function(s){return s===1/0||s===-1/0?0:s})},hYe=/^dataMin[\s]*-[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,mYe=/^dataMax[\s]*\+[\s]*([0-9]+([.]{1}[0-9]+){0,1})$/,Gwe=function(e,n,r){if(Wr(e))return e(n,r);if(!Array.isArray(e))return n;var s=[];if(ln(e[0]))s[0]=r?e[0]:Math.min(e[0],n[0]);else if(hYe.test(e[0])){var i=+hYe.exec(e[0])[1];s[0]=n[0]-i}else Wr(e[0])?s[0]=e[0](n[0]):s[0]=n[0];if(ln(e[1]))s[1]=r?e[1]:Math.max(e[1],n[1]);else if(mYe.test(e[1])){var o=+mYe.exec(e[1])[1];s[1]=n[1]+o}else Wr(e[1])?s[1]=e[1](n[1]):s[1]=n[1];return s},qJ=function(e,n,r){if(e&&e.scale&&e.scale.bandwidth){var s=e.scale.bandwidth();if(!r||s>0)return s}if(e&&n&&n.length>=2){for(var i=Zse(n,function(h){return h.coordinate}),o=1/0,l=1,c=i.length;l<c;l++){var d=i[l],u=i[l-1];o=Math.min((d.coordinate||0)-(u.coordinate||0),o)}return o===1/0?0:o}return r?void 0:0},fYe=function(e,n,r){return!e||!e.length||m0(e,Cm(r,"type.defaultProps.domain"))?n:e},hLt=function(e,n){var r=e.type.defaultProps?Zo(Zo({},e.type.defaultProps),e.props):e.props,s=r.dataKey,i=r.name,o=r.unit,l=r.formatter,c=r.tooltipType,d=r.chartType,u=r.hide;return Zo(Zo({},hr(e,!1)),{},{dataKey:s,unit:o,formatter:l,name:i||s,color:I5e(e),value:eo(n,s),type:c,payload:n,chartType:d,hide:u})};function VF(t){"@babel/helpers - typeof";return VF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},VF(t)}function pYe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Ob(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?pYe(Object(n),!0).forEach(function(r){mLt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):pYe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function mLt(t,e,n){return e=nWr(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function nWr(t){var e=rWr(t,"string");return VF(e)=="symbol"?e:e+""}function rWr(t,e){if(VF(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(VF(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function sWr(t,e){return lWr(t)||oWr(t,e)||aWr(t,e)||iWr()}function iWr(){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 aWr(t,e){if(t){if(typeof t=="string")return gYe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return gYe(t,e)}}function gYe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function oWr(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(u){d=!0,s=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function lWr(t){if(Array.isArray(t))return t}var KJ=Math.PI/180,cWr=function(e){return e*180/Math.PI},$a=function(e,n,r,s){return{x:e+Math.cos(-KJ*s)*r,y:n+Math.sin(-KJ*s)*r}},fLt=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{top:0,right:0,bottom:0,left:0};return Math.min(Math.abs(e-(r.left||0)-(r.right||0)),Math.abs(n-(r.top||0)-(r.bottom||0)))/2},dWr=function(e,n,r,s,i){var o=e.width,l=e.height,c=e.startAngle,d=e.endAngle,u=Au(e.cx,o,o/2),h=Au(e.cy,l,l/2),m=fLt(o,l,r),f=Au(e.innerRadius,m,0),p=Au(e.outerRadius,m,m*.8),g=Object.keys(n);return g.reduce(function(v,b){var x=n[b],w=x.domain,k=x.reversed,S;if($r(x.range))s==="angleAxis"?S=[c,d]:s==="radiusAxis"&&(S=[f,p]),k&&(S=[S[1],S[0]]);else{S=x.range;var C=S,j=sWr(C,2);c=j[0],d=j[1]}var E=lLt(x,i),N=E.realScaleType,A=E.scale;A.domain(w).range(S),cLt(A);var _=dLt(A,Ob(Ob({},x),{},{realScaleType:N})),T=Ob(Ob(Ob({},x),_),{},{range:S,radius:p,realScaleType:N,scale:A,cx:u,cy:h,innerRadius:f,outerRadius:p,startAngle:c,endAngle:d});return Ob(Ob({},v),{},mLt({},b,T))},{})},uWr=function(e,n){var r=e.x,s=e.y,i=n.x,o=n.y;return Math.sqrt(Math.pow(r-i,2)+Math.pow(s-o,2))},hWr=function(e,n){var r=e.x,s=e.y,i=n.cx,o=n.cy,l=uWr({x:r,y:s},{x:i,y:o});if(l<=0)return{radius:l};var c=(r-i)/l,d=Math.acos(c);return s>o&&(d=2*Math.PI-d),{radius:l,angle:cWr(d),angleInRadian:d}},mWr=function(e){var n=e.startAngle,r=e.endAngle,s=Math.floor(n/360),i=Math.floor(r/360),o=Math.min(s,i);return{startAngle:n-o*360,endAngle:r-o*360}},fWr=function(e,n){var r=n.startAngle,s=n.endAngle,i=Math.floor(r/360),o=Math.floor(s/360),l=Math.min(i,o);return e+l*360},vYe=function(e,n){var r=e.x,s=e.y,i=hWr({x:r,y:s},n),o=i.radius,l=i.angle,c=n.innerRadius,d=n.outerRadius;if(o<c||o>d)return!1;if(o===0)return!0;var u=mWr(n),h=u.startAngle,m=u.endAngle,f=l,p;if(h<=m){for(;f>m;)f-=360;for(;f<h;)f+=360;p=f>=h&&f<=m}else{for(;f>h;)f-=360;for(;f<m;)f+=360;p=f>=m&&f<=h}return p?Ob(Ob({},n),{},{radius:o,angle:fWr(f,n)}):null},pLt=function(e){return!y.isValidElement(e)&&!Wr(e)&&typeof e!="boolean"?e.className:""};function HF(t){"@babel/helpers - typeof";return HF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},HF(t)}var pWr=["offset"];function gWr(t){return xWr(t)||bWr(t)||yWr(t)||vWr()}function vWr(){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 yWr(t,e){if(t){if(typeof t=="string")return Wwe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Wwe(t,e)}}function bWr(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function xWr(t){if(Array.isArray(t))return Wwe(t)}function Wwe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function wWr(t,e){if(t==null)return{};var n=kWr(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function kWr(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function yYe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function ac(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?yYe(Object(n),!0).forEach(function(r){SWr(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):yYe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function SWr(t,e,n){return e=CWr(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function CWr(t){var e=jWr(t,"string");return HF(e)=="symbol"?e:e+""}function jWr(t,e){if(HF(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(HF(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function GF(){return GF=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},GF.apply(this,arguments)}var EWr=function(e){var n=e.value,r=e.formatter,s=$r(e.children)?n:e.children;return Wr(r)?r(s):s},NWr=function(e,n){var r=_u(n-e),s=Math.min(Math.abs(n-e),360);return r*s},TWr=function(e,n,r){var s=e.position,i=e.viewBox,o=e.offset,l=e.className,c=i,d=c.cx,u=c.cy,h=c.innerRadius,m=c.outerRadius,f=c.startAngle,p=c.endAngle,g=c.clockWise,v=(h+m)/2,b=NWr(f,p),x=b>=0?1:-1,w,k;s==="insideStart"?(w=f+x*o,k=g):s==="insideEnd"?(w=p-x*o,k=!g):s==="end"&&(w=p+x*o,k=g),k=b<=0?k:!k;var S=$a(d,u,v,w),C=$a(d,u,v,w+(k?1:-1)*359),j="M".concat(S.x,",").concat(S.y,`
    A`).concat(v,",").concat(v,",0,1,").concat(k?0:1,`,
    `).concat(C.x,",").concat(C.y),E=$r(e.id)?MS("recharts-radial-line-"):e.id;return se.createElement("text",GF({},r,{dominantBaseline:"central",className:Zn("recharts-radial-bar-label",l)}),se.createElement("defs",null,se.createElement("path",{id:E,d:j})),se.createElement("textPath",{xlinkHref:"#".concat(E)},n))},_Wr=function(e){var n=e.viewBox,r=e.offset,s=e.position,i=n,o=i.cx,l=i.cy,c=i.innerRadius,d=i.outerRadius,u=i.startAngle,h=i.endAngle,m=(u+h)/2;if(s==="outside"){var f=$a(o,l,d+r,m),p=f.x,g=f.y;return{x:p,y:g,textAnchor:p>=o?"start":"end",verticalAnchor:"middle"}}if(s==="center")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"middle"};if(s==="centerTop")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"start"};if(s==="centerBottom")return{x:o,y:l,textAnchor:"middle",verticalAnchor:"end"};var v=(c+d)/2,b=$a(o,l,v,m),x=b.x,w=b.y;return{x,y:w,textAnchor:"middle",verticalAnchor:"middle"}},AWr=function(e){var n=e.viewBox,r=e.parentViewBox,s=e.offset,i=e.position,o=n,l=o.x,c=o.y,d=o.width,u=o.height,h=u>=0?1:-1,m=h*s,f=h>0?"end":"start",p=h>0?"start":"end",g=d>=0?1:-1,v=g*s,b=g>0?"end":"start",x=g>0?"start":"end";if(i==="top"){var w={x:l+d/2,y:c-h*s,textAnchor:"middle",verticalAnchor:f};return ac(ac({},w),r?{height:Math.max(c-r.y,0),width:d}:{})}if(i==="bottom"){var k={x:l+d/2,y:c+u+m,textAnchor:"middle",verticalAnchor:p};return ac(ac({},k),r?{height:Math.max(r.y+r.height-(c+u),0),width:d}:{})}if(i==="left"){var S={x:l-v,y:c+u/2,textAnchor:b,verticalAnchor:"middle"};return ac(ac({},S),r?{width:Math.max(S.x-r.x,0),height:u}:{})}if(i==="right"){var C={x:l+d+v,y:c+u/2,textAnchor:x,verticalAnchor:"middle"};return ac(ac({},C),r?{width:Math.max(r.x+r.width-C.x,0),height:u}:{})}var j=r?{width:d,height:u}:{};return i==="insideLeft"?ac({x:l+v,y:c+u/2,textAnchor:x,verticalAnchor:"middle"},j):i==="insideRight"?ac({x:l+d-v,y:c+u/2,textAnchor:b,verticalAnchor:"middle"},j):i==="insideTop"?ac({x:l+d/2,y:c+m,textAnchor:"middle",verticalAnchor:p},j):i==="insideBottom"?ac({x:l+d/2,y:c+u-m,textAnchor:"middle",verticalAnchor:f},j):i==="insideTopLeft"?ac({x:l+v,y:c+m,textAnchor:x,verticalAnchor:p},j):i==="insideTopRight"?ac({x:l+d-v,y:c+m,textAnchor:b,verticalAnchor:p},j):i==="insideBottomLeft"?ac({x:l+v,y:c+u-m,textAnchor:x,verticalAnchor:f},j):i==="insideBottomRight"?ac({x:l+d-v,y:c+u-m,textAnchor:b,verticalAnchor:f},j):LM(i)&&(ln(i.x)||Tj(i.x))&&(ln(i.y)||Tj(i.y))?ac({x:l+Au(i.x,d),y:c+Au(i.y,u),textAnchor:"end",verticalAnchor:"end"},j):ac({x:l+d/2,y:c+u/2,textAnchor:"middle",verticalAnchor:"middle"},j)},PWr=function(e){return"cx"in e&&ln(e.cx)};function Lc(t){var e=t.offset,n=e===void 0?5:e,r=wWr(t,pWr),s=ac({offset:n},r),i=s.viewBox,o=s.position,l=s.value,c=s.children,d=s.content,u=s.className,h=u===void 0?"":u,m=s.textBreakAll;if(!i||$r(l)&&$r(c)&&!y.isValidElement(d)&&!Wr(d))return null;if(y.isValidElement(d))return y.cloneElement(d,s);var f;if(Wr(d)){if(f=y.createElement(d,s),y.isValidElement(f))return f}else f=EWr(s);var p=PWr(i),g=hr(s,!0);if(p&&(o==="insideStart"||o==="insideEnd"||o==="end"))return TWr(s,f,g);var v=p?_Wr(s):AWr(s);return se.createElement(oE,GF({className:Zn("recharts-label",h)},g,v,{breakAll:m}),f)}Lc.displayName="Label";var gLt=function(e){var n=e.cx,r=e.cy,s=e.angle,i=e.startAngle,o=e.endAngle,l=e.r,c=e.radius,d=e.innerRadius,u=e.outerRadius,h=e.x,m=e.y,f=e.top,p=e.left,g=e.width,v=e.height,b=e.clockWise,x=e.labelViewBox;if(x)return x;if(ln(g)&&ln(v)){if(ln(h)&&ln(m))return{x:h,y:m,width:g,height:v};if(ln(f)&&ln(p))return{x:f,y:p,width:g,height:v}}return ln(h)&&ln(m)?{x:h,y:m,width:0,height:0}:ln(n)&&ln(r)?{cx:n,cy:r,startAngle:i||s||0,endAngle:o||s||0,innerRadius:d||0,outerRadius:u||c||l||0,clockWise:b}:e.viewBox?e.viewBox:{}},RWr=function(e,n){return e?e===!0?se.createElement(Lc,{key:"label-implicit",viewBox:n}):gc(e)?se.createElement(Lc,{key:"label-implicit",viewBox:n,value:e}):y.isValidElement(e)?e.type===Lc?y.cloneElement(e,{key:"label-implicit",viewBox:n}):se.createElement(Lc,{key:"label-implicit",content:e,viewBox:n}):Wr(e)?se.createElement(Lc,{key:"label-implicit",content:e,viewBox:n}):LM(e)?se.createElement(Lc,GF({viewBox:n},e,{key:"label-implicit"})):null:null},IWr=function(e,n){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!e||!e.children&&r&&!e.label)return null;var s=e.children,i=gLt(e),o=Lu(s,Lc).map(function(c,d){return y.cloneElement(c,{viewBox:n||i,key:"label-".concat(d)})});if(!r)return o;var l=RWr(e.label,n||i);return[l].concat(gWr(o))};Lc.parseViewBox=gLt;Lc.renderCallByParent=IWr;function WF(t){"@babel/helpers - typeof";return WF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},WF(t)}var MWr=["valueAccessor"],LWr=["data","dataKey","clockWise","id","textBreakAll"];function DWr(t){return BWr(t)||FWr(t)||OWr(t)||$Wr()}function $Wr(){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 OWr(t,e){if(t){if(typeof t=="string")return qwe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return qwe(t,e)}}function FWr(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function BWr(t){if(Array.isArray(t))return qwe(t)}function qwe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function YJ(){return YJ=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},YJ.apply(this,arguments)}function bYe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function xYe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?bYe(Object(n),!0).forEach(function(r){UWr(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):bYe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function UWr(t,e,n){return e=zWr(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function zWr(t){var e=VWr(t,"string");return WF(e)=="symbol"?e:e+""}function VWr(t,e){if(WF(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(WF(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function wYe(t,e){if(t==null)return{};var n=HWr(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function HWr(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var GWr=function(e){return Array.isArray(e.value)?RIr(e.value):e.value};function Ng(t){var e=t.valueAccessor,n=e===void 0?GWr:e,r=wYe(t,MWr),s=r.data,i=r.dataKey,o=r.clockWise,l=r.id,c=r.textBreakAll,d=wYe(r,LWr);return!s||!s.length?null:se.createElement(Cs,{className:"recharts-label-list"},s.map(function(u,h){var m=$r(i)?n(u,h):eo(u&&u.payload,i),f=$r(l)?{}:{id:"".concat(l,"-").concat(h)};return se.createElement(Lc,YJ({},hr(u,!0),d,f,{parentViewBox:u.parentViewBox,value:m,textBreakAll:c,viewBox:Lc.parseViewBox($r(o)?u:xYe(xYe({},u),{},{clockWise:o})),key:"label-".concat(h),index:h}))}))}Ng.displayName="LabelList";function WWr(t,e){return t?t===!0?se.createElement(Ng,{key:"labelList-implicit",data:e}):se.isValidElement(t)||Wr(t)?se.createElement(Ng,{key:"labelList-implicit",data:e,content:t}):LM(t)?se.createElement(Ng,YJ({data:e},t,{key:"labelList-implicit"})):null:null}function qWr(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;if(!t||!t.children&&n&&!t.label)return null;var r=t.children,s=Lu(r,Ng).map(function(o,l){return y.cloneElement(o,{data:e,key:"labelList-".concat(l)})});if(!n)return s;var i=WWr(t.label,e);return[i].concat(DWr(s))}Ng.renderCallByParent=qWr;function qF(t){"@babel/helpers - typeof";return qF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qF(t)}function Kwe(){return Kwe=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Kwe.apply(this,arguments)}function kYe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function SYe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?kYe(Object(n),!0).forEach(function(r){KWr(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):kYe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function KWr(t,e,n){return e=YWr(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function YWr(t){var e=QWr(t,"string");return qF(e)=="symbol"?e:e+""}function QWr(t,e){if(qF(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(qF(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var ZWr=function(e,n){var r=_u(n-e),s=Math.min(Math.abs(n-e),359.999);return r*s},mH=function(e){var n=e.cx,r=e.cy,s=e.radius,i=e.angle,o=e.sign,l=e.isExternal,c=e.cornerRadius,d=e.cornerIsExternal,u=c*(l?1:-1)+s,h=Math.asin(c/u)/KJ,m=d?i:i+o*h,f=$a(n,r,u,m),p=$a(n,r,s,m),g=d?i-o*h:i,v=$a(n,r,u*Math.cos(h*KJ),g);return{center:f,circleTangency:p,lineTangency:v,theta:h}},vLt=function(e){var n=e.cx,r=e.cy,s=e.innerRadius,i=e.outerRadius,o=e.startAngle,l=e.endAngle,c=ZWr(o,l),d=o+c,u=$a(n,r,i,o),h=$a(n,r,i,d),m="M ".concat(u.x,",").concat(u.y,`
    A `).concat(i,",").concat(i,`,0,
    `).concat(+(Math.abs(c)>180),",").concat(+(o>d),`,
    `).concat(h.x,",").concat(h.y,`
  `);if(s>0){var f=$a(n,r,s,o),p=$a(n,r,s,d);m+="L ".concat(p.x,",").concat(p.y,`
            A `).concat(s,",").concat(s,`,0,
            `).concat(+(Math.abs(c)>180),",").concat(+(o<=d),`,
            `).concat(f.x,",").concat(f.y," Z")}else m+="L ".concat(n,",").concat(r," Z");return m},JWr=function(e){var n=e.cx,r=e.cy,s=e.innerRadius,i=e.outerRadius,o=e.cornerRadius,l=e.forceCornerRadius,c=e.cornerIsExternal,d=e.startAngle,u=e.endAngle,h=_u(u-d),m=mH({cx:n,cy:r,radius:i,angle:d,sign:h,cornerRadius:o,cornerIsExternal:c}),f=m.circleTangency,p=m.lineTangency,g=m.theta,v=mH({cx:n,cy:r,radius:i,angle:u,sign:-h,cornerRadius:o,cornerIsExternal:c}),b=v.circleTangency,x=v.lineTangency,w=v.theta,k=c?Math.abs(d-u):Math.abs(d-u)-g-w;if(k<0)return l?"M ".concat(p.x,",").concat(p.y,`
        a`).concat(o,",").concat(o,",0,0,1,").concat(o*2,`,0
        a`).concat(o,",").concat(o,",0,0,1,").concat(-o*2,`,0
      `):vLt({cx:n,cy:r,innerRadius:s,outerRadius:i,startAngle:d,endAngle:u});var S="M ".concat(p.x,",").concat(p.y,`
    A`).concat(o,",").concat(o,",0,0,").concat(+(h<0),",").concat(f.x,",").concat(f.y,`
    A`).concat(i,",").concat(i,",0,").concat(+(k>180),",").concat(+(h<0),",").concat(b.x,",").concat(b.y,`
    A`).concat(o,",").concat(o,",0,0,").concat(+(h<0),",").concat(x.x,",").concat(x.y,`
  `);if(s>0){var C=mH({cx:n,cy:r,radius:s,angle:d,sign:h,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),j=C.circleTangency,E=C.lineTangency,N=C.theta,A=mH({cx:n,cy:r,radius:s,angle:u,sign:-h,isExternal:!0,cornerRadius:o,cornerIsExternal:c}),_=A.circleTangency,T=A.lineTangency,R=A.theta,O=c?Math.abs(d-u):Math.abs(d-u)-N-R;if(O<0&&o===0)return"".concat(S,"L").concat(n,",").concat(r,"Z");S+="L".concat(T.x,",").concat(T.y,`
      A`).concat(o,",").concat(o,",0,0,").concat(+(h<0),",").concat(_.x,",").concat(_.y,`
      A`).concat(s,",").concat(s,",0,").concat(+(O>180),",").concat(+(h>0),",").concat(j.x,",").concat(j.y,`
      A`).concat(o,",").concat(o,",0,0,").concat(+(h<0),",").concat(E.x,",").concat(E.y,"Z")}else S+="L".concat(n,",").concat(r,"Z");return S},XWr={cx:0,cy:0,innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,cornerRadius:0,forceCornerRadius:!1,cornerIsExternal:!1},yLt=function(e){var n=SYe(SYe({},XWr),e),r=n.cx,s=n.cy,i=n.innerRadius,o=n.outerRadius,l=n.cornerRadius,c=n.forceCornerRadius,d=n.cornerIsExternal,u=n.startAngle,h=n.endAngle,m=n.className;if(o<i||u===h)return null;var f=Zn("recharts-sector",m),p=o-i,g=Au(l,p,0,!0),v;return g>0&&Math.abs(u-h)<360?v=JWr({cx:r,cy:s,innerRadius:i,outerRadius:o,cornerRadius:Math.min(g,p/2),forceCornerRadius:c,cornerIsExternal:d,startAngle:u,endAngle:h}):v=vLt({cx:r,cy:s,innerRadius:i,outerRadius:o,startAngle:u,endAngle:h}),se.createElement("path",Kwe({},hr(n,!0),{className:f,d:v,role:"img"}))};function KF(t){"@babel/helpers - typeof";return KF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},KF(t)}function Ywe(){return Ywe=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Ywe.apply(this,arguments)}function CYe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function jYe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?CYe(Object(n),!0).forEach(function(r){eqr(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):CYe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function eqr(t,e,n){return e=tqr(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function tqr(t){var e=nqr(t,"string");return KF(e)=="symbol"?e:e+""}function nqr(t,e){if(KF(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(KF(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var EYe={curveBasisClosed:_7r,curveBasisOpen:A7r,curveBasis:T7r,curveBumpX:f7r,curveBumpY:p7r,curveLinearClosed:P7r,curveLinear:Sie,curveMonotoneX:R7r,curveMonotoneY:I7r,curveNatural:M7r,curveStep:L7r,curveStepAfter:$7r,curveStepBefore:D7r},fH=function(e){return e.x===+e.x&&e.y===+e.y},K3=function(e){return e.x},Y3=function(e){return e.y},rqr=function(e,n){if(Wr(e))return e;var r="curve".concat(wie(e));return(r==="curveMonotone"||r==="curveBump")&&n?EYe["".concat(r).concat(n==="vertical"?"Y":"X")]:EYe[r]||Sie},sqr=function(e){var n=e.type,r=n===void 0?"linear":n,s=e.points,i=s===void 0?[]:s,o=e.baseLine,l=e.layout,c=e.connectNulls,d=c===void 0?!1:c,u=rqr(r,l),h=d?i.filter(function(g){return fH(g)}):i,m;if(Array.isArray(o)){var f=d?o.filter(function(g){return fH(g)}):o,p=h.map(function(g,v){return jYe(jYe({},g),{},{base:f[v]})});return l==="vertical"?m=sH().y(Y3).x1(K3).x0(function(g){return g.base.x}):m=sH().x(K3).y1(Y3).y0(function(g){return g.base.y}),m.defined(fH).curve(u),m(p)}return l==="vertical"&&ln(o)?m=sH().y(Y3).x1(K3).x0(o):ln(o)?m=sH().x(K3).y1(Y3).y0(o):m=RIt().x(K3).y(Y3),m.defined(fH).curve(u),m(h)},mk=function(e){var n=e.className,r=e.points,s=e.path,i=e.pathRef;if((!r||!r.length)&&!s)return null;var o=r&&r.length?sqr(e):s;return y.createElement("path",Ywe({},hr(e,!1),SJ(e),{className:Zn("recharts-curve",n),d:o,ref:i}))},iqr=Object.getOwnPropertyNames,aqr=Object.getOwnPropertySymbols,oqr=Object.prototype.hasOwnProperty;function NYe(t,e){return function(r,s,i){return t(r,s,i)&&e(r,s,i)}}function pH(t){return function(n,r,s){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,s);var i=s.cache,o=i.get(n),l=i.get(r);if(o&&l)return o===r&&l===n;i.set(n,r),i.set(r,n);var c=t(n,r,s);return i.delete(n),i.delete(r),c}}function TYe(t){return iqr(t).concat(aqr(t))}var lqr=Object.hasOwn||function(t,e){return oqr.call(t,e)};function LN(t,e){return t===e||!t&&!e&&t!==t&&e!==e}var cqr="__v",dqr="__o",uqr="_owner",_Ye=Object.getOwnPropertyDescriptor,AYe=Object.keys;function hqr(t,e,n){var r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function mqr(t,e){return LN(t.getTime(),e.getTime())}function fqr(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function pqr(t,e){return t===e}function PYe(t,e,n){var r=t.size;if(r!==e.size)return!1;if(!r)return!0;for(var s=new Array(r),i=t.entries(),o,l,c=0;(o=i.next())&&!o.done;){for(var d=e.entries(),u=!1,h=0;(l=d.next())&&!l.done;){if(s[h]){h++;continue}var m=o.value,f=l.value;if(n.equals(m[0],f[0],c,h,t,e,n)&&n.equals(m[1],f[1],m[0],f[0],t,e,n)){u=s[h]=!0;break}h++}if(!u)return!1;c++}return!0}var gqr=LN;function vqr(t,e,n){var r=AYe(t),s=r.length;if(AYe(e).length!==s)return!1;for(;s-- >0;)if(!bLt(t,e,n,r[s]))return!1;return!0}function Q3(t,e,n){var r=TYe(t),s=r.length;if(TYe(e).length!==s)return!1;for(var i,o,l;s-- >0;)if(i=r[s],!bLt(t,e,n,i)||(o=_Ye(t,i),l=_Ye(e,i),(o||l)&&(!o||!l||o.configurable!==l.configurable||o.enumerable!==l.enumerable||o.writable!==l.writable)))return!1;return!0}function yqr(t,e){return LN(t.valueOf(),e.valueOf())}function bqr(t,e){return t.source===e.source&&t.flags===e.flags}function RYe(t,e,n){var r=t.size;if(r!==e.size)return!1;if(!r)return!0;for(var s=new Array(r),i=t.values(),o,l;(o=i.next())&&!o.done;){for(var c=e.values(),d=!1,u=0;(l=c.next())&&!l.done;){if(!s[u]&&n.equals(o.value,l.value,o.value,l.value,t,e,n)){d=s[u]=!0;break}u++}if(!d)return!1}return!0}function xqr(t,e){var n=t.length;if(e.length!==n)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function wqr(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function bLt(t,e,n,r){return(r===uqr||r===dqr||r===cqr)&&(t.$$typeof||e.$$typeof)?!0:lqr(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}var kqr="[object Arguments]",Sqr="[object Boolean]",Cqr="[object Date]",jqr="[object Error]",Eqr="[object Map]",Nqr="[object Number]",Tqr="[object Object]",_qr="[object RegExp]",Aqr="[object Set]",Pqr="[object String]",Rqr="[object URL]",Iqr=Array.isArray,IYe=typeof ArrayBuffer=="function"&&ArrayBuffer.isView?ArrayBuffer.isView:null,MYe=Object.assign,Mqr=Object.prototype.toString.call.bind(Object.prototype.toString);function Lqr(t){var e=t.areArraysEqual,n=t.areDatesEqual,r=t.areErrorsEqual,s=t.areFunctionsEqual,i=t.areMapsEqual,o=t.areNumbersEqual,l=t.areObjectsEqual,c=t.arePrimitiveWrappersEqual,d=t.areRegExpsEqual,u=t.areSetsEqual,h=t.areTypedArraysEqual,m=t.areUrlsEqual;return function(p,g,v){if(p===g)return!0;if(p==null||g==null)return!1;var b=typeof p;if(b!==typeof g)return!1;if(b!=="object")return b==="number"?o(p,g,v):b==="function"?s(p,g,v):!1;var x=p.constructor;if(x!==g.constructor)return!1;if(x===Object)return l(p,g,v);if(Iqr(p))return e(p,g,v);if(IYe!=null&&IYe(p))return h(p,g,v);if(x===Date)return n(p,g,v);if(x===RegExp)return d(p,g,v);if(x===Map)return i(p,g,v);if(x===Set)return u(p,g,v);var w=Mqr(p);return w===Cqr?n(p,g,v):w===_qr?d(p,g,v):w===Eqr?i(p,g,v):w===Aqr?u(p,g,v):w===Tqr?typeof p.then!="function"&&typeof g.then!="function"&&l(p,g,v):w===Rqr?m(p,g,v):w===jqr?r(p,g,v):w===kqr?l(p,g,v):w===Sqr||w===Nqr||w===Pqr?c(p,g,v):!1}}function Dqr(t){var e=t.circular,n=t.createCustomConfig,r=t.strict,s={areArraysEqual:r?Q3:hqr,areDatesEqual:mqr,areErrorsEqual:fqr,areFunctionsEqual:pqr,areMapsEqual:r?NYe(PYe,Q3):PYe,areNumbersEqual:gqr,areObjectsEqual:r?Q3:vqr,arePrimitiveWrappersEqual:yqr,areRegExpsEqual:bqr,areSetsEqual:r?NYe(RYe,Q3):RYe,areTypedArraysEqual:r?Q3:xqr,areUrlsEqual:wqr};if(n&&(s=MYe({},s,n(s))),e){var i=pH(s.areArraysEqual),o=pH(s.areMapsEqual),l=pH(s.areObjectsEqual),c=pH(s.areSetsEqual);s=MYe({},s,{areArraysEqual:i,areMapsEqual:o,areObjectsEqual:l,areSetsEqual:c})}return s}function $qr(t){return function(e,n,r,s,i,o,l){return t(e,n,l)}}function Oqr(t){var e=t.circular,n=t.comparator,r=t.createState,s=t.equals,i=t.strict;if(r)return function(c,d){var u=r(),h=u.cache,m=h===void 0?e?new WeakMap:void 0:h,f=u.meta;return n(c,d,{cache:m,equals:s,meta:f,strict:i})};if(e)return function(c,d){return n(c,d,{cache:new WeakMap,equals:s,meta:void 0,strict:i})};var o={cache:void 0,equals:s,meta:void 0,strict:i};return function(c,d){return n(c,d,o)}}var Fqr=$S();$S({strict:!0});$S({circular:!0});$S({circular:!0,strict:!0});$S({createInternalComparator:function(){return LN}});$S({strict:!0,createInternalComparator:function(){return LN}});$S({circular:!0,createInternalComparator:function(){return LN}});$S({circular:!0,createInternalComparator:function(){return LN},strict:!0});function $S(t){t===void 0&&(t={});var e=t.circular,n=e===void 0?!1:e,r=t.createInternalComparator,s=t.createState,i=t.strict,o=i===void 0?!1:i,l=Dqr(t),c=Lqr(l),d=r?r(c):$qr(c);return Oqr({circular:n,comparator:c,createState:s,equals:d,strict:o})}function Bqr(t){typeof requestAnimationFrame<"u"&&requestAnimationFrame(t)}function LYe(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=-1,r=function s(i){n<0&&(n=i),i-n>e?(t(i),n=-1):Bqr(s)};requestAnimationFrame(r)}function Qwe(t){"@babel/helpers - typeof";return Qwe=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qwe(t)}function Uqr(t){return Gqr(t)||Hqr(t)||Vqr(t)||zqr()}function zqr(){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 Vqr(t,e){if(t){if(typeof t=="string")return DYe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return DYe(t,e)}}function DYe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Hqr(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Gqr(t){if(Array.isArray(t))return t}function Wqr(){var t={},e=function(){return null},n=!1,r=function s(i){if(!n){if(Array.isArray(i)){if(!i.length)return;var o=i,l=Uqr(o),c=l[0],d=l.slice(1);if(typeof c=="number"){LYe(s.bind(null,d),c);return}s(c),LYe(s.bind(null,d));return}Qwe(i)==="object"&&(t=i,e(t)),typeof i=="function"&&i()}};return{stop:function(){n=!0},start:function(i){n=!1,r(i)},subscribe:function(i){return e=i,function(){e=function(){return null}}}}}function YF(t){"@babel/helpers - typeof";return YF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},YF(t)}function $Ye(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function OYe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?$Ye(Object(n),!0).forEach(function(r){xLt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$Ye(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function xLt(t,e,n){return e=qqr(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function qqr(t){var e=Kqr(t,"string");return YF(e)==="symbol"?e:String(e)}function Kqr(t,e){if(YF(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(YF(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Yqr=function(e,n){return[Object.keys(e),Object.keys(n)].reduce(function(r,s){return r.filter(function(i){return s.includes(i)})})},Qqr=function(e){return e},Zqr=function(e){return e.replace(/([A-Z])/g,function(n){return"-".concat(n.toLowerCase())})},O$=function(e,n){return Object.keys(n).reduce(function(r,s){return OYe(OYe({},r),{},xLt({},s,e(s,n[s])))},{})},FYe=function(e,n,r){return e.map(function(s){return"".concat(Zqr(s)," ").concat(n,"ms ").concat(r)}).join(",")};function Jqr(t,e){return tKr(t)||eKr(t,e)||wLt(t,e)||Xqr()}function Xqr(){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 eKr(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(u){d=!0,s=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function tKr(t){if(Array.isArray(t))return t}function nKr(t){return iKr(t)||sKr(t)||wLt(t)||rKr()}function rKr(){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 wLt(t,e){if(t){if(typeof t=="string")return Zwe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Zwe(t,e)}}function sKr(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function iKr(t){if(Array.isArray(t))return Zwe(t)}function Zwe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var QJ=1e-4,kLt=function(e,n){return[0,3*e,3*n-6*e,3*e-3*n+1]},SLt=function(e,n){return e.map(function(r,s){return r*Math.pow(n,s)}).reduce(function(r,s){return r+s})},BYe=function(e,n){return function(r){var s=kLt(e,n);return SLt(s,r)}},aKr=function(e,n){return function(r){var s=kLt(e,n),i=[].concat(nKr(s.map(function(o,l){return o*l}).slice(1)),[0]);return SLt(i,r)}},UYe=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var s=n[0],i=n[1],o=n[2],l=n[3];if(n.length===1)switch(n[0]){case"linear":s=0,i=0,o=1,l=1;break;case"ease":s=.25,i=.1,o=.25,l=1;break;case"ease-in":s=.42,i=0,o=1,l=1;break;case"ease-out":s=.42,i=0,o=.58,l=1;break;case"ease-in-out":s=0,i=0,o=.58,l=1;break;default:{var c=n[0].split("(");if(c[0]==="cubic-bezier"&&c[1].split(")")[0].split(",").length===4){var d=c[1].split(")")[0].split(",").map(function(v){return parseFloat(v)}),u=Jqr(d,4);s=u[0],i=u[1],o=u[2],l=u[3]}}}var h=BYe(s,o),m=BYe(i,l),f=aKr(s,o),p=function(b){return b>1?1:b<0?0:b},g=function(b){for(var x=b>1?1:b,w=x,k=0;k<8;++k){var S=h(w)-x,C=f(w);if(Math.abs(S-x)<QJ||C<QJ)return m(w);w=p(w-S/C)}return m(w)};return g.isStepper=!1,g},oKr=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},n=e.stiff,r=n===void 0?100:n,s=e.damping,i=s===void 0?8:s,o=e.dt,l=o===void 0?17:o,c=function(u,h,m){var f=-(u-h)*r,p=m*i,g=m+(f-p)*l/1e3,v=m*l/1e3+u;return Math.abs(v-h)<QJ&&Math.abs(g)<QJ?[h,0]:[v,g]};return c.isStepper=!0,c.dt=l,c},lKr=function(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var s=n[0];if(typeof s=="string")switch(s){case"ease":case"ease-in-out":case"ease-out":case"ease-in":case"linear":return UYe(s);case"spring":return oKr();default:if(s.split("(")[0]==="cubic-bezier")return UYe(s)}return typeof s=="function"?s:null};function QF(t){"@babel/helpers - typeof";return QF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},QF(t)}function zYe(t){return uKr(t)||dKr(t)||CLt(t)||cKr()}function cKr(){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 dKr(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function uKr(t){if(Array.isArray(t))return Xwe(t)}function VYe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function rd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?VYe(Object(n),!0).forEach(function(r){Jwe(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):VYe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Jwe(t,e,n){return e=hKr(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function hKr(t){var e=mKr(t,"string");return QF(e)==="symbol"?e:String(e)}function mKr(t,e){if(QF(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(QF(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function fKr(t,e){return vKr(t)||gKr(t,e)||CLt(t,e)||pKr()}function pKr(){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 CLt(t,e){if(t){if(typeof t=="string")return Xwe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Xwe(t,e)}}function Xwe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function gKr(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(u){d=!0,s=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function vKr(t){if(Array.isArray(t))return t}var ZJ=function(e,n,r){return e+(n-e)*r},e1e=function(e){var n=e.from,r=e.to;return n!==r},yKr=function t(e,n,r){var s=O$(function(i,o){if(e1e(o)){var l=e(o.from,o.to,o.velocity),c=fKr(l,2),d=c[0],u=c[1];return rd(rd({},o),{},{from:d,velocity:u})}return o},n);return r<1?O$(function(i,o){return e1e(o)?rd(rd({},o),{},{velocity:ZJ(o.velocity,s[i].velocity,r),from:ZJ(o.from,s[i].from,r)}):o},n):t(e,s,r-1)};const bKr=function(t,e,n,r,s){var i=Yqr(t,e),o=i.reduce(function(v,b){return rd(rd({},v),{},Jwe({},b,[t[b],e[b]]))},{}),l=i.reduce(function(v,b){return rd(rd({},v),{},Jwe({},b,{from:t[b],velocity:0,to:e[b]}))},{}),c=-1,d,u,h=function(){return null},m=function(){return O$(function(b,x){return x.from},l)},f=function(){return!Object.values(l).filter(e1e).length},p=function(b){d||(d=b);var x=b-d,w=x/n.dt;l=yKr(n,l,w),s(rd(rd(rd({},t),e),m())),d=b,f()||(c=requestAnimationFrame(h))},g=function(b){u||(u=b);var x=(b-u)/r,w=O$(function(S,C){return ZJ.apply(void 0,zYe(C).concat([n(x)]))},o);if(s(rd(rd(rd({},t),e),w)),x<1)c=requestAnimationFrame(h);else{var k=O$(function(S,C){return ZJ.apply(void 0,zYe(C).concat([n(1)]))},o);s(rd(rd(rd({},t),e),k))}};return h=n.isStepper?p:g,function(){return requestAnimationFrame(h),function(){cancelAnimationFrame(c)}}};function k5(t){"@babel/helpers - typeof";return k5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},k5(t)}var xKr=["children","begin","duration","attributeName","easing","isActive","steps","from","to","canBegin","onAnimationEnd","shouldReAnimate","onAnimationReStart"];function wKr(t,e){if(t==null)return{};var n=kKr(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function kKr(t,e){if(t==null)return{};var n={},r=Object.keys(t),s,i;for(i=0;i<r.length;i++)s=r[i],!(e.indexOf(s)>=0)&&(n[s]=t[s]);return n}function she(t){return EKr(t)||jKr(t)||CKr(t)||SKr()}function SKr(){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 CKr(t,e){if(t){if(typeof t=="string")return t1e(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return t1e(t,e)}}function jKr(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function EKr(t){if(Array.isArray(t))return t1e(t)}function t1e(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function HYe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function xp(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?HYe(Object(n),!0).forEach(function(r){rD(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):HYe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function rD(t,e,n){return e=jLt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function NKr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function TKr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,jLt(r.key),r)}}function _Kr(t,e,n){return e&&TKr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function jLt(t){var e=AKr(t,"string");return k5(e)==="symbol"?e:String(e)}function AKr(t,e){if(k5(t)!=="object"||t===null)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(k5(r)!=="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function PKr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&n1e(t,e)}function n1e(t,e){return n1e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},n1e(t,e)}function RKr(t){var e=IKr();return function(){var r=JJ(t),s;if(e){var i=JJ(this).constructor;s=Reflect.construct(r,arguments,i)}else s=r.apply(this,arguments);return r1e(this,s)}}function r1e(t,e){if(e&&(k5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return s1e(t)}function s1e(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function IKr(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}function JJ(t){return JJ=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},JJ(t)}var Qf=function(t){PKr(n,t);var e=RKr(n);function n(r,s){var i;NKr(this,n),i=e.call(this,r,s);var o=i.props,l=o.isActive,c=o.attributeName,d=o.from,u=o.to,h=o.steps,m=o.children,f=o.duration;if(i.handleStyleChange=i.handleStyleChange.bind(s1e(i)),i.changeStyle=i.changeStyle.bind(s1e(i)),!l||f<=0)return i.state={style:{}},typeof m=="function"&&(i.state={style:u}),r1e(i);if(h&&h.length)i.state={style:h[0].style};else if(d){if(typeof m=="function")return i.state={style:d},r1e(i);i.state={style:c?rD({},c,d):d}}else i.state={style:{}};return i}return _Kr(n,[{key:"componentDidMount",value:function(){var s=this.props,i=s.isActive,o=s.canBegin;this.mounted=!0,!(!i||!o)&&this.runAnimation(this.props)}},{key:"componentDidUpdate",value:function(s){var i=this.props,o=i.isActive,l=i.canBegin,c=i.attributeName,d=i.shouldReAnimate,u=i.to,h=i.from,m=this.state.style;if(l){if(!o){var f={style:c?rD({},c,u):u};this.state&&m&&(c&&m[c]!==u||!c&&m!==u)&&this.setState(f);return}if(!(Fqr(s.to,u)&&s.canBegin&&s.isActive)){var p=!s.canBegin||!s.isActive;this.manager&&this.manager.stop(),this.stopJSAnimation&&this.stopJSAnimation();var g=p||d?h:s.to;if(this.state&&m){var v={style:c?rD({},c,g):g};(c&&m[c]!==g||!c&&m!==g)&&this.setState(v)}this.runAnimation(xp(xp({},this.props),{},{from:g,begin:0}))}}}},{key:"componentWillUnmount",value:function(){this.mounted=!1;var s=this.props.onAnimationEnd;this.unSubscribe&&this.unSubscribe(),this.manager&&(this.manager.stop(),this.manager=null),this.stopJSAnimation&&this.stopJSAnimation(),s&&s()}},{key:"handleStyleChange",value:function(s){this.changeStyle(s)}},{key:"changeStyle",value:function(s){this.mounted&&this.setState({style:s})}},{key:"runJSAnimation",value:function(s){var i=this,o=s.from,l=s.to,c=s.duration,d=s.easing,u=s.begin,h=s.onAnimationEnd,m=s.onAnimationStart,f=bKr(o,l,lKr(d),c,this.changeStyle),p=function(){i.stopJSAnimation=f()};this.manager.start([m,u,p,c,h])}},{key:"runStepAnimation",value:function(s){var i=this,o=s.steps,l=s.begin,c=s.onAnimationStart,d=o[0],u=d.style,h=d.duration,m=h===void 0?0:h,f=function(g,v,b){if(b===0)return g;var x=v.duration,w=v.easing,k=w===void 0?"ease":w,S=v.style,C=v.properties,j=v.onAnimationEnd,E=b>0?o[b-1]:v,N=C||Object.keys(S);if(typeof k=="function"||k==="spring")return[].concat(she(g),[i.runJSAnimation.bind(i,{from:E.style,to:S,duration:x,easing:k}),x]);var A=FYe(N,x,k),_=xp(xp(xp({},E.style),S),{},{transition:A});return[].concat(she(g),[_,x,j]).filter(Qqr)};return this.manager.start([c].concat(she(o.reduce(f,[u,Math.max(m,l)])),[s.onAnimationEnd]))}},{key:"runAnimation",value:function(s){this.manager||(this.manager=Wqr());var i=s.begin,o=s.duration,l=s.attributeName,c=s.to,d=s.easing,u=s.onAnimationStart,h=s.onAnimationEnd,m=s.steps,f=s.children,p=this.manager;if(this.unSubscribe=p.subscribe(this.handleStyleChange),typeof d=="function"||typeof f=="function"||d==="spring"){this.runJSAnimation(s);return}if(m.length>1){this.runStepAnimation(s);return}var g=l?rD({},l,c):c,v=FYe(Object.keys(g),o,d);p.start([u,i,xp(xp({},g),{},{transition:v}),o,h])}},{key:"render",value:function(){var s=this.props,i=s.children;s.begin;var o=s.duration;s.attributeName,s.easing;var l=s.isActive;s.steps,s.from,s.to,s.canBegin,s.onAnimationEnd,s.shouldReAnimate,s.onAnimationReStart;var c=wKr(s,xKr),d=y.Children.count(i),u=this.state.style;if(typeof i=="function")return i(u);if(!l||d===0||o<=0)return i;var h=function(f){var p=f.props,g=p.style,v=g===void 0?{}:g,b=p.className,x=y.cloneElement(f,xp(xp({},c),{},{style:xp(xp({},v),u),className:b}));return x};return d===1?h(y.Children.only(i)):se.createElement("div",null,y.Children.map(i,function(m){return h(m)}))}}]),n}(y.PureComponent);Qf.displayName="Animate";Qf.defaultProps={begin:0,duration:1e3,from:"",to:"",attributeName:"",easing:"ease",isActive:!0,canBegin:!0,steps:[],onAnimationEnd:function(){},onAnimationStart:function(){}};Qf.propTypes={from:$t.oneOfType([$t.object,$t.string]),to:$t.oneOfType([$t.object,$t.string]),attributeName:$t.string,duration:$t.number,begin:$t.number,easing:$t.oneOfType([$t.string,$t.func]),steps:$t.arrayOf($t.shape({duration:$t.number.isRequired,style:$t.object.isRequired,easing:$t.oneOfType([$t.oneOf(["ease","ease-in","ease-out","ease-in-out","linear"]),$t.func]),properties:$t.arrayOf("string"),onAnimationEnd:$t.func})),children:$t.oneOfType([$t.node,$t.func]),isActive:$t.bool,canBegin:$t.bool,onAnimationEnd:$t.func,shouldReAnimate:$t.bool,onAnimationStart:$t.func,onAnimationReStart:$t.func};function ZF(t){"@babel/helpers - typeof";return ZF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ZF(t)}function XJ(){return XJ=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},XJ.apply(this,arguments)}function MKr(t,e){return OKr(t)||$Kr(t,e)||DKr(t,e)||LKr()}function LKr(){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 DKr(t,e){if(t){if(typeof t=="string")return GYe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return GYe(t,e)}}function GYe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function $Kr(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(u){d=!0,s=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function OKr(t){if(Array.isArray(t))return t}function WYe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function qYe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?WYe(Object(n),!0).forEach(function(r){FKr(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):WYe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function FKr(t,e,n){return e=BKr(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function BKr(t){var e=UKr(t,"string");return ZF(e)=="symbol"?e:e+""}function UKr(t,e){if(ZF(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(ZF(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var KYe=function(e,n,r,s,i){var o=Math.min(Math.abs(r)/2,Math.abs(s)/2),l=s>=0?1:-1,c=r>=0?1:-1,d=s>=0&&r>=0||s<0&&r<0?1:0,u;if(o>0&&i instanceof Array){for(var h=[0,0,0,0],m=0,f=4;m<f;m++)h[m]=i[m]>o?o:i[m];u="M".concat(e,",").concat(n+l*h[0]),h[0]>0&&(u+="A ".concat(h[0],",").concat(h[0],",0,0,").concat(d,",").concat(e+c*h[0],",").concat(n)),u+="L ".concat(e+r-c*h[1],",").concat(n),h[1]>0&&(u+="A ".concat(h[1],",").concat(h[1],",0,0,").concat(d,`,
        `).concat(e+r,",").concat(n+l*h[1])),u+="L ".concat(e+r,",").concat(n+s-l*h[2]),h[2]>0&&(u+="A ".concat(h[2],",").concat(h[2],",0,0,").concat(d,`,
        `).concat(e+r-c*h[2],",").concat(n+s)),u+="L ".concat(e+c*h[3],",").concat(n+s),h[3]>0&&(u+="A ".concat(h[3],",").concat(h[3],",0,0,").concat(d,`,
        `).concat(e,",").concat(n+s-l*h[3])),u+="Z"}else if(o>0&&i===+i&&i>0){var p=Math.min(o,i);u="M ".concat(e,",").concat(n+l*p,`
            A `).concat(p,",").concat(p,",0,0,").concat(d,",").concat(e+c*p,",").concat(n,`
            L `).concat(e+r-c*p,",").concat(n,`
            A `).concat(p,",").concat(p,",0,0,").concat(d,",").concat(e+r,",").concat(n+l*p,`
            L `).concat(e+r,",").concat(n+s-l*p,`
            A `).concat(p,",").concat(p,",0,0,").concat(d,",").concat(e+r-c*p,",").concat(n+s,`
            L `).concat(e+c*p,",").concat(n+s,`
            A `).concat(p,",").concat(p,",0,0,").concat(d,",").concat(e,",").concat(n+s-l*p," Z")}else u="M ".concat(e,",").concat(n," h ").concat(r," v ").concat(s," h ").concat(-r," Z");return u},zKr=function(e,n){if(!e||!n)return!1;var r=e.x,s=e.y,i=n.x,o=n.y,l=n.width,c=n.height;if(Math.abs(l)>0&&Math.abs(c)>0){var d=Math.min(i,i+l),u=Math.max(i,i+l),h=Math.min(o,o+c),m=Math.max(o,o+c);return r>=d&&r<=u&&s>=h&&s<=m}return!1},VKr={x:0,y:0,width:0,height:0,radius:0,isAnimationActive:!1,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},M5e=function(e){var n=qYe(qYe({},VKr),e),r=y.useRef(),s=y.useState(-1),i=MKr(s,2),o=i[0],l=i[1];y.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var k=r.current.getTotalLength();k&&l(k)}catch{}},[]);var c=n.x,d=n.y,u=n.width,h=n.height,m=n.radius,f=n.className,p=n.animationEasing,g=n.animationDuration,v=n.animationBegin,b=n.isAnimationActive,x=n.isUpdateAnimationActive;if(c!==+c||d!==+d||u!==+u||h!==+h||u===0||h===0)return null;var w=Zn("recharts-rectangle",f);return x?se.createElement(Qf,{canBegin:o>0,from:{width:u,height:h,x:c,y:d},to:{width:u,height:h,x:c,y:d},duration:g,animationEasing:p,isActive:x},function(k){var S=k.width,C=k.height,j=k.x,E=k.y;return se.createElement(Qf,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:v,duration:g,isActive:b,easing:p},se.createElement("path",XJ({},hr(n,!0),{className:w,d:KYe(j,E,S,C,m),ref:r})))}):se.createElement("path",XJ({},hr(n,!0),{className:w,d:KYe(c,d,u,h,m)}))},HKr=["points","className","baseLinePoints","connectNulls"];function xA(){return xA=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},xA.apply(this,arguments)}function GKr(t,e){if(t==null)return{};var n=WKr(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function WKr(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function YYe(t){return QKr(t)||YKr(t)||KKr(t)||qKr()}function qKr(){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 KKr(t,e){if(t){if(typeof t=="string")return i1e(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return i1e(t,e)}}function YKr(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function QKr(t){if(Array.isArray(t))return i1e(t)}function i1e(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var QYe=function(e){return e&&e.x===+e.x&&e.y===+e.y},ZKr=function(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=[[]];return e.forEach(function(r){QYe(r)?n[n.length-1].push(r):n[n.length-1].length>0&&n.push([])}),QYe(e[0])&&n[n.length-1].push(e[0]),n[n.length-1].length<=0&&(n=n.slice(0,-1)),n},F$=function(e,n){var r=ZKr(e);n&&(r=[r.reduce(function(i,o){return[].concat(YYe(i),YYe(o))},[])]);var s=r.map(function(i){return i.reduce(function(o,l,c){return"".concat(o).concat(c===0?"M":"L").concat(l.x,",").concat(l.y)},"")}).join("");return r.length===1?"".concat(s,"Z"):s},JKr=function(e,n,r){var s=F$(e,r);return"".concat(s.slice(-1)==="Z"?s.slice(0,-1):s,"L").concat(F$(n.reverse(),r).slice(1))},XKr=function(e){var n=e.points,r=e.className,s=e.baseLinePoints,i=e.connectNulls,o=GKr(e,HKr);if(!n||!n.length)return null;var l=Zn("recharts-polygon",r);if(s&&s.length){var c=o.stroke&&o.stroke!=="none",d=JKr(n,s,i);return se.createElement("g",{className:l},se.createElement("path",xA({},hr(o,!0),{fill:d.slice(-1)==="Z"?o.fill:"none",stroke:"none",d})),c?se.createElement("path",xA({},hr(o,!0),{fill:"none",d:F$(n,i)})):null,c?se.createElement("path",xA({},hr(o,!0),{fill:"none",d:F$(s,i)})):null)}var u=F$(n,i);return se.createElement("path",xA({},hr(o,!0),{fill:u.slice(-1)==="Z"?o.fill:"none",className:l,d:u}))};function a1e(){return a1e=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},a1e.apply(this,arguments)}var _9=function(e){var n=e.cx,r=e.cy,s=e.r,i=e.className,o=Zn("recharts-dot",i);return n===+n&&r===+r&&s===+s?y.createElement("circle",a1e({},hr(e,!1),SJ(e),{className:o,cx:n,cy:r,r:s})):null};function JF(t){"@babel/helpers - typeof";return JF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},JF(t)}var eYr=["x","y","top","left","width","height","className"];function o1e(){return o1e=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},o1e.apply(this,arguments)}function ZYe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function tYr(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ZYe(Object(n),!0).forEach(function(r){nYr(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ZYe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function nYr(t,e,n){return e=rYr(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function rYr(t){var e=sYr(t,"string");return JF(e)=="symbol"?e:e+""}function sYr(t,e){if(JF(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(JF(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function iYr(t,e){if(t==null)return{};var n=aYr(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function aYr(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var oYr=function(e,n,r,s,i,o){return"M".concat(e,",").concat(i,"v").concat(s,"M").concat(o,",").concat(n,"h").concat(r)},lYr=function(e){var n=e.x,r=n===void 0?0:n,s=e.y,i=s===void 0?0:s,o=e.top,l=o===void 0?0:o,c=e.left,d=c===void 0?0:c,u=e.width,h=u===void 0?0:u,m=e.height,f=m===void 0?0:m,p=e.className,g=iYr(e,eYr),v=tYr({x:r,y:i,top:l,left:d,width:h,height:f},g);return!ln(r)||!ln(i)||!ln(h)||!ln(f)||!ln(l)||!ln(d)?null:se.createElement("path",o1e({},hr(v,!0),{className:Zn("recharts-cross",p),d:oYr(r,i,h,f,l,d)}))},cYr=Iie,dYr=BMt,uYr=Xg;function hYr(t,e){return t&&t.length?cYr(t,uYr(e),dYr):void 0}var mYr=hYr;const fYr=Fs(mYr);var pYr=Iie,gYr=Xg,vYr=UMt;function yYr(t,e){return t&&t.length?pYr(t,gYr(e),vYr):void 0}var bYr=yYr;const xYr=Fs(bYr);var wYr=["cx","cy","angle","ticks","axisLine"],kYr=["ticks","tick","angle","tickFormatter","stroke"];function S5(t){"@babel/helpers - typeof";return S5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},S5(t)}function B$(){return B$=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},B$.apply(this,arguments)}function JYe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function dC(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?JYe(Object(n),!0).forEach(function(r){$ie(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):JYe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function XYe(t,e){if(t==null)return{};var n=SYr(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function SYr(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function CYr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function eQe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,NLt(r.key),r)}}function jYr(t,e,n){return e&&eQe(t.prototype,e),n&&eQe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function EYr(t,e,n){return e=eX(e),NYr(t,ELt()?Reflect.construct(e,n||[],eX(t).constructor):e.apply(t,n))}function NYr(t,e){if(e&&(S5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return TYr(t)}function TYr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ELt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ELt=function(){return!!t})()}function eX(t){return eX=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},eX(t)}function _Yr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&l1e(t,e)}function l1e(t,e){return l1e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},l1e(t,e)}function $ie(t,e,n){return e=NLt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function NLt(t){var e=AYr(t,"string");return S5(e)=="symbol"?e:e+""}function AYr(t,e){if(S5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(S5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Oie=function(t){function e(){return CYr(this,e),EYr(this,e,arguments)}return _Yr(e,t),jYr(e,[{key:"getTickValueCoord",value:function(r){var s=r.coordinate,i=this.props,o=i.angle,l=i.cx,c=i.cy;return $a(l,c,s,o)}},{key:"getTickTextAnchor",value:function(){var r=this.props.orientation,s;switch(r){case"left":s="end";break;case"right":s="start";break;default:s="middle";break}return s}},{key:"getViewBox",value:function(){var r=this.props,s=r.cx,i=r.cy,o=r.angle,l=r.ticks,c=fYr(l,function(u){return u.coordinate||0}),d=xYr(l,function(u){return u.coordinate||0});return{cx:s,cy:i,startAngle:o,endAngle:o,innerRadius:d.coordinate||0,outerRadius:c.coordinate||0}}},{key:"renderAxisLine",value:function(){var r=this.props,s=r.cx,i=r.cy,o=r.angle,l=r.ticks,c=r.axisLine,d=XYe(r,wYr),u=l.reduce(function(p,g){return[Math.min(p[0],g.coordinate),Math.max(p[1],g.coordinate)]},[1/0,-1/0]),h=$a(s,i,u[0],o),m=$a(s,i,u[1],o),f=dC(dC(dC({},hr(d,!1)),{},{fill:"none"},hr(c,!1)),{},{x1:h.x,y1:h.y,x2:m.x,y2:m.y});return se.createElement("line",B$({className:"recharts-polar-radius-axis-line"},f))}},{key:"renderTicks",value:function(){var r=this,s=this.props,i=s.ticks,o=s.tick,l=s.angle,c=s.tickFormatter,d=s.stroke,u=XYe(s,kYr),h=this.getTickTextAnchor(),m=hr(u,!1),f=hr(o,!1),p=i.map(function(g,v){var b=r.getTickValueCoord(g),x=dC(dC(dC(dC({textAnchor:h,transform:"rotate(".concat(90-l,", ").concat(b.x,", ").concat(b.y,")")},m),{},{stroke:"none",fill:d},f),{},{index:v},b),{},{payload:g});return se.createElement(Cs,B$({className:Zn("recharts-polar-radius-axis-tick",pLt(o)),key:"tick-".concat(g.coordinate)},Qk(r.props,g,v)),e.renderTickItem(o,x,c?c(g.value,v):g.value))});return se.createElement(Cs,{className:"recharts-polar-radius-axis-ticks"},p)}},{key:"render",value:function(){var r=this.props,s=r.ticks,i=r.axisLine,o=r.tick;return!s||!s.length?null:se.createElement(Cs,{className:Zn("recharts-polar-radius-axis",this.props.className)},i&&this.renderAxisLine(),o&&this.renderTicks(),Lc.renderCallByParent(this.props,this.getViewBox()))}}],[{key:"renderTickItem",value:function(r,s,i){var o;return se.isValidElement(r)?o=se.cloneElement(r,s):Wr(r)?o=r(s):o=se.createElement(oE,B$({},s,{className:"recharts-polar-radius-axis-tick-value"}),i),o}}])}(y.PureComponent);$ie(Oie,"displayName","PolarRadiusAxis");$ie(Oie,"axisType","radiusAxis");$ie(Oie,"defaultProps",{type:"number",radiusAxisId:0,cx:0,cy:0,angle:0,orientation:"right",stroke:"#ccc",axisLine:!0,tick:!0,tickCount:5,allowDataOverflow:!1,scale:"auto",allowDuplicatedCategory:!0});function C5(t){"@babel/helpers - typeof";return C5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},C5(t)}function dj(){return dj=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},dj.apply(this,arguments)}function tQe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function uC(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?tQe(Object(n),!0).forEach(function(r){Fie(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):tQe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function PYr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function nQe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,_Lt(r.key),r)}}function RYr(t,e,n){return e&&nQe(t.prototype,e),n&&nQe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function IYr(t,e,n){return e=tX(e),MYr(t,TLt()?Reflect.construct(e,n||[],tX(t).constructor):e.apply(t,n))}function MYr(t,e){if(e&&(C5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return LYr(t)}function LYr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function TLt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(TLt=function(){return!!t})()}function tX(t){return tX=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},tX(t)}function DYr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&c1e(t,e)}function c1e(t,e){return c1e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},c1e(t,e)}function Fie(t,e,n){return e=_Lt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _Lt(t){var e=$Yr(t,"string");return C5(e)=="symbol"?e:e+""}function $Yr(t,e){if(C5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(C5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var OYr=Math.PI/180,rQe=1e-5,Bie=function(t){function e(){return PYr(this,e),IYr(this,e,arguments)}return DYr(e,t),RYr(e,[{key:"getTickLineCoord",value:function(r){var s=this.props,i=s.cx,o=s.cy,l=s.radius,c=s.orientation,d=s.tickSize,u=d||8,h=$a(i,o,l,r.coordinate),m=$a(i,o,l+(c==="inner"?-1:1)*u,r.coordinate);return{x1:h.x,y1:h.y,x2:m.x,y2:m.y}}},{key:"getTickTextAnchor",value:function(r){var s=this.props.orientation,i=Math.cos(-r.coordinate*OYr),o;return i>rQe?o=s==="outer"?"start":"end":i<-rQe?o=s==="outer"?"end":"start":o="middle",o}},{key:"renderAxisLine",value:function(){var r=this.props,s=r.cx,i=r.cy,o=r.radius,l=r.axisLine,c=r.axisLineType,d=uC(uC({},hr(this.props,!1)),{},{fill:"none"},hr(l,!1));if(c==="circle")return se.createElement(_9,dj({className:"recharts-polar-angle-axis-line"},d,{cx:s,cy:i,r:o}));var u=this.props.ticks,h=u.map(function(m){return $a(s,i,o,m.coordinate)});return se.createElement(XKr,dj({className:"recharts-polar-angle-axis-line"},d,{points:h}))}},{key:"renderTicks",value:function(){var r=this,s=this.props,i=s.ticks,o=s.tick,l=s.tickLine,c=s.tickFormatter,d=s.stroke,u=hr(this.props,!1),h=hr(o,!1),m=uC(uC({},u),{},{fill:"none"},hr(l,!1)),f=i.map(function(p,g){var v=r.getTickLineCoord(p),b=r.getTickTextAnchor(p),x=uC(uC(uC({textAnchor:b},u),{},{stroke:"none",fill:d},h),{},{index:g,payload:p,x:v.x2,y:v.y2});return se.createElement(Cs,dj({className:Zn("recharts-polar-angle-axis-tick",pLt(o)),key:"tick-".concat(p.coordinate)},Qk(r.props,p,g)),l&&se.createElement("line",dj({className:"recharts-polar-angle-axis-tick-line"},m,v)),o&&e.renderTickItem(o,x,c?c(p.value,g):p.value))});return se.createElement(Cs,{className:"recharts-polar-angle-axis-ticks"},f)}},{key:"render",value:function(){var r=this.props,s=r.ticks,i=r.radius,o=r.axisLine;return i<=0||!s||!s.length?null:se.createElement(Cs,{className:Zn("recharts-polar-angle-axis",this.props.className)},o&&this.renderAxisLine(),this.renderTicks())}}],[{key:"renderTickItem",value:function(r,s,i){var o;return se.isValidElement(r)?o=se.cloneElement(r,s):Wr(r)?o=r(s):o=se.createElement(oE,dj({},s,{className:"recharts-polar-angle-axis-tick-value"}),i),o}}])}(y.PureComponent);Fie(Bie,"displayName","PolarAngleAxis");Fie(Bie,"axisType","angleAxis");Fie(Bie,"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 FYr=F0,BYr=Jg,UYr="[object Boolean]";function zYr(t){return t===!0||t===!1||BYr(t)&&FYr(t)==UYr}var VYr=zYr;const HYr=Fs(VYr);function XF(t){"@babel/helpers - typeof";return XF=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},XF(t)}function nX(){return nX=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},nX.apply(this,arguments)}function GYr(t,e){return YYr(t)||KYr(t,e)||qYr(t,e)||WYr()}function WYr(){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 qYr(t,e){if(t){if(typeof t=="string")return sQe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return sQe(t,e)}}function sQe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function KYr(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(u){d=!0,s=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function YYr(t){if(Array.isArray(t))return t}function iQe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function aQe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?iQe(Object(n),!0).forEach(function(r){QYr(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):iQe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function QYr(t,e,n){return e=ZYr(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function ZYr(t){var e=JYr(t,"string");return XF(e)=="symbol"?e:e+""}function JYr(t,e){if(XF(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(XF(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var oQe=function(e,n,r,s,i){var o=r-s,l;return l="M ".concat(e,",").concat(n),l+="L ".concat(e+r,",").concat(n),l+="L ".concat(e+r-o/2,",").concat(n+i),l+="L ".concat(e+r-o/2-s,",").concat(n+i),l+="L ".concat(e,",").concat(n," Z"),l},XYr={x:0,y:0,upperWidth:0,lowerWidth:0,height:0,isUpdateAnimationActive:!1,animationBegin:0,animationDuration:1500,animationEasing:"ease"},eQr=function(e){var n=aQe(aQe({},XYr),e),r=y.useRef(),s=y.useState(-1),i=GYr(s,2),o=i[0],l=i[1];y.useEffect(function(){if(r.current&&r.current.getTotalLength)try{var w=r.current.getTotalLength();w&&l(w)}catch{}},[]);var c=n.x,d=n.y,u=n.upperWidth,h=n.lowerWidth,m=n.height,f=n.className,p=n.animationEasing,g=n.animationDuration,v=n.animationBegin,b=n.isUpdateAnimationActive;if(c!==+c||d!==+d||u!==+u||h!==+h||m!==+m||u===0&&h===0||m===0)return null;var x=Zn("recharts-trapezoid",f);return b?se.createElement(Qf,{canBegin:o>0,from:{upperWidth:0,lowerWidth:0,height:m,x:c,y:d},to:{upperWidth:u,lowerWidth:h,height:m,x:c,y:d},duration:g,animationEasing:p,isActive:b},function(w){var k=w.upperWidth,S=w.lowerWidth,C=w.height,j=w.x,E=w.y;return se.createElement(Qf,{canBegin:o>0,from:"0px ".concat(o===-1?1:o,"px"),to:"".concat(o,"px 0px"),attributeName:"strokeDasharray",begin:v,duration:g,easing:p},se.createElement("path",nX({},hr(n,!0),{className:x,d:oQe(j,E,k,S,C),ref:r})))}):se.createElement("g",null,se.createElement("path",nX({},hr(n,!0),{className:x,d:oQe(c,d,u,h,m)})))},tQr=["option","shapeType","propTransformer","activeClassName","isActive"];function e8(t){"@babel/helpers - typeof";return e8=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e8(t)}function nQr(t,e){if(t==null)return{};var n=rQr(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function rQr(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function lQe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function rX(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?lQe(Object(n),!0).forEach(function(r){sQr(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):lQe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function sQr(t,e,n){return e=iQr(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function iQr(t){var e=aQr(t,"string");return e8(e)=="symbol"?e:e+""}function aQr(t,e){if(e8(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(e8(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function oQr(t,e){return rX(rX({},e),t)}function lQr(t,e){return t==="symbols"}function cQe(t){var e=t.shapeType,n=t.elementProps;switch(e){case"rectangle":return se.createElement(M5e,n);case"trapezoid":return se.createElement(eQr,n);case"sector":return se.createElement(yLt,n);case"symbols":if(lQr(e))return se.createElement(jie,n);break;default:return null}}function cQr(t){return y.isValidElement(t)?t.props:t}function sX(t){var e=t.option,n=t.shapeType,r=t.propTransformer,s=r===void 0?oQr:r,i=t.activeClassName,o=i===void 0?"recharts-active-shape":i,l=t.isActive,c=nQr(t,tQr),d;if(y.isValidElement(e))d=y.cloneElement(e,rX(rX({},c),cQr(e)));else if(Wr(e))d=e(c);else if(XIr(e)&&!HYr(e)){var u=s(e,c);d=se.createElement(cQe,{shapeType:n,elementProps:u})}else{var h=c;d=se.createElement(cQe,{shapeType:n,elementProps:h})}return l?se.createElement(Cs,{className:o},d):d}function Uie(t,e){return e!=null&&"trapezoids"in t.props}function zie(t,e){return e!=null&&"sectors"in t.props}function t8(t,e){return e!=null&&"points"in t.props}function dQr(t,e){var n,r,s=t.x===(e==null||(n=e.labelViewBox)===null||n===void 0?void 0:n.x)||t.x===e.x,i=t.y===(e==null||(r=e.labelViewBox)===null||r===void 0?void 0:r.y)||t.y===e.y;return s&&i}function uQr(t,e){var n=t.endAngle===e.endAngle,r=t.startAngle===e.startAngle;return n&&r}function hQr(t,e){var n=t.x===e.x,r=t.y===e.y,s=t.z===e.z;return n&&r&&s}function mQr(t,e){var n;return Uie(t,e)?n=dQr:zie(t,e)?n=uQr:t8(t,e)&&(n=hQr),n}function fQr(t,e){var n;return Uie(t,e)?n="trapezoids":zie(t,e)?n="sectors":t8(t,e)&&(n="points"),n}function pQr(t,e){if(Uie(t,e)){var n;return(n=e.tooltipPayload)===null||n===void 0||(n=n[0])===null||n===void 0||(n=n.payload)===null||n===void 0?void 0:n.payload}if(zie(t,e)){var r;return(r=e.tooltipPayload)===null||r===void 0||(r=r[0])===null||r===void 0||(r=r.payload)===null||r===void 0?void 0:r.payload}return t8(t,e)?e.payload:{}}function gQr(t){var e=t.activeTooltipItem,n=t.graphicalItem,r=t.itemData,s=fQr(n,e),i=pQr(n,e),o=r.filter(function(c,d){var u=m0(i,c),h=n.props[s].filter(function(p){var g=mQr(n,e);return g(p,e)}),m=n.props[s].indexOf(h[h.length-1]),f=d===m;return u&&f}),l=r.indexOf(o[o.length-1]);return l}var Tq;function j5(t){"@babel/helpers - typeof";return j5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},j5(t)}function wA(){return wA=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},wA.apply(this,arguments)}function dQe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Ra(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?dQe(Object(n),!0).forEach(function(r){bf(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):dQe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function vQr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function uQe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,PLt(r.key),r)}}function yQr(t,e,n){return e&&uQe(t.prototype,e),n&&uQe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function bQr(t,e,n){return e=iX(e),xQr(t,ALt()?Reflect.construct(e,n||[],iX(t).constructor):e.apply(t,n))}function xQr(t,e){if(e&&(j5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return wQr(t)}function wQr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ALt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ALt=function(){return!!t})()}function iX(t){return iX=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},iX(t)}function kQr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&d1e(t,e)}function d1e(t,e){return d1e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},d1e(t,e)}function bf(t,e,n){return e=PLt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function PLt(t){var e=SQr(t,"string");return j5(e)=="symbol"?e:e+""}function SQr(t,e){if(j5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(j5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var V0=function(t){function e(n){var r;return vQr(this,e),r=bQr(this,e,[n]),bf(r,"pieRef",null),bf(r,"sectorRefs",[]),bf(r,"id",MS("recharts-pie-")),bf(r,"handleAnimationEnd",function(){var s=r.props.onAnimationEnd;r.setState({isAnimationFinished:!0}),Wr(s)&&s()}),bf(r,"handleAnimationStart",function(){var s=r.props.onAnimationStart;r.setState({isAnimationFinished:!1}),Wr(s)&&s()}),r.state={isAnimationFinished:!n.isAnimationActive,prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,sectorToFocus:0},r}return kQr(e,t),yQr(e,[{key:"isActiveIndex",value:function(r){var s=this.props.activeIndex;return Array.isArray(s)?s.indexOf(r)!==-1:r===s}},{key:"hasActiveIndex",value:function(){var r=this.props.activeIndex;return Array.isArray(r)?r.length!==0:r||r===0}},{key:"renderLabels",value:function(r){var s=this.props.isAnimationActive;if(s&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.label,l=i.labelLine,c=i.dataKey,d=i.valueKey,u=hr(this.props,!1),h=hr(o,!1),m=hr(l,!1),f=o&&o.offsetRadius||20,p=r.map(function(g,v){var b=(g.startAngle+g.endAngle)/2,x=$a(g.cx,g.cy,g.outerRadius+f,b),w=Ra(Ra(Ra(Ra({},u),g),{},{stroke:"none"},h),{},{index:v,textAnchor:e.getTextAnchor(x.x,g.cx)},x),k=Ra(Ra(Ra(Ra({},u),g),{},{fill:"none",stroke:g.fill},m),{},{index:v,points:[$a(g.cx,g.cy,g.outerRadius,b),x]}),S=c;return $r(c)&&$r(d)?S="value":$r(c)&&(S=d),se.createElement(Cs,{key:"label-".concat(g.startAngle,"-").concat(g.endAngle,"-").concat(g.midAngle,"-").concat(v)},l&&e.renderLabelLineItem(l,k,"line"),e.renderLabelItem(o,w,eo(g,S)))});return se.createElement(Cs,{className:"recharts-pie-labels"},p)}},{key:"renderSectorsStatically",value:function(r){var s=this,i=this.props,o=i.activeShape,l=i.blendStroke,c=i.inactiveShape;return r.map(function(d,u){if((d==null?void 0:d.startAngle)===0&&(d==null?void 0:d.endAngle)===0&&r.length!==1)return null;var h=s.isActiveIndex(u),m=c&&s.hasActiveIndex()?c:null,f=h?o:m,p=Ra(Ra({},d),{},{stroke:l?d.fill:d.stroke,tabIndex:-1});return se.createElement(Cs,wA({ref:function(v){v&&!s.sectorRefs.includes(v)&&s.sectorRefs.push(v)},tabIndex:-1,className:"recharts-pie-sector"},Qk(s.props,d,u),{key:"sector-".concat(d==null?void 0:d.startAngle,"-").concat(d==null?void 0:d.endAngle,"-").concat(d.midAngle,"-").concat(u)}),se.createElement(sX,wA({option:f,isActive:h,shapeType:"sector"},p)))})}},{key:"renderSectorsWithAnimation",value:function(){var r=this,s=this.props,i=s.sectors,o=s.isAnimationActive,l=s.animationBegin,c=s.animationDuration,d=s.animationEasing,u=s.animationId,h=this.state,m=h.prevSectors,f=h.prevIsAnimationActive;return se.createElement(Qf,{begin:l,duration:c,isActive:o,easing:d,from:{t:0},to:{t:1},key:"pie-".concat(u,"-").concat(f),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(p){var g=p.t,v=[],b=i&&i[0],x=b.startAngle;return i.forEach(function(w,k){var S=m&&m[k],C=k>0?Cm(w,"paddingAngle",0):0;if(S){var j=Mo(S.endAngle-S.startAngle,w.endAngle-w.startAngle),E=Ra(Ra({},w),{},{startAngle:x+C,endAngle:x+j(g)+C});v.push(E),x=E.endAngle}else{var N=w.endAngle,A=w.startAngle,_=Mo(0,N-A),T=_(g),R=Ra(Ra({},w),{},{startAngle:x+C,endAngle:x+T+C});v.push(R),x=R.endAngle}}),se.createElement(Cs,null,r.renderSectorsStatically(v))})}},{key:"attachKeyboardHandlers",value:function(r){var s=this;r.onkeydown=function(i){if(!i.altKey)switch(i.key){case"ArrowLeft":{var o=++s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[o].focus(),s.setState({sectorToFocus:o});break}case"ArrowRight":{var l=--s.state.sectorToFocus<0?s.sectorRefs.length-1:s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[l].focus(),s.setState({sectorToFocus:l});break}case"Escape":{s.sectorRefs[s.state.sectorToFocus].blur(),s.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var r=this.props,s=r.sectors,i=r.isAnimationActive,o=this.state.prevSectors;return i&&s&&s.length&&(!o||!m0(o,s))?this.renderSectorsWithAnimation():this.renderSectorsStatically(s)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var r=this,s=this.props,i=s.hide,o=s.sectors,l=s.className,c=s.label,d=s.cx,u=s.cy,h=s.innerRadius,m=s.outerRadius,f=s.isAnimationActive,p=this.state.isAnimationFinished;if(i||!o||!o.length||!ln(d)||!ln(u)||!ln(h)||!ln(m))return null;var g=Zn("recharts-pie",l);return se.createElement(Cs,{tabIndex:this.props.rootTabIndex,className:g,ref:function(b){r.pieRef=b}},this.renderSectors(),c&&this.renderLabels(o),Lc.renderCallByParent(this.props,null,!1),(!f||p)&&Ng.renderCallByParent(this.props,o,!1))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return s.prevIsAnimationActive!==r.isAnimationActive?{prevIsAnimationActive:r.isAnimationActive,prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:[],isAnimationFinished:!0}:r.isAnimationActive&&r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curSectors:r.sectors,prevSectors:s.curSectors,isAnimationFinished:!0}:r.sectors!==s.curSectors?{curSectors:r.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(r,s){return r>s?"start":r<s?"end":"middle"}},{key:"renderLabelLineItem",value:function(r,s,i){if(se.isValidElement(r))return se.cloneElement(r,s);if(Wr(r))return r(s);var o=Zn("recharts-pie-label-line",typeof r!="boolean"?r.className:"");return se.createElement(mk,wA({},s,{key:i,type:"linear",className:o}))}},{key:"renderLabelItem",value:function(r,s,i){if(se.isValidElement(r))return se.cloneElement(r,s);var o=i;if(Wr(r)&&(o=r(s),se.isValidElement(o)))return o;var l=Zn("recharts-pie-label-text",typeof r!="boolean"&&!Wr(r)?r.className:"");return se.createElement(oE,wA({},s,{alignmentBaseline:"middle",className:l}),o)}}])}(y.PureComponent);Tq=V0;bf(V0,"displayName","Pie");bf(V0,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!Lf.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});bf(V0,"parseDeltaAngle",function(t,e){var n=_u(e-t),r=Math.min(Math.abs(e-t),360);return n*r});bf(V0,"getRealPieData",function(t){var e=t.data,n=t.children,r=hr(t,!1),s=Lu(n,C9);return e&&e.length?e.map(function(i,o){return Ra(Ra(Ra({payload:i},r),i),s&&s[o]&&s[o].props)}):s&&s.length?s.map(function(i){return Ra(Ra({},r),i.props)}):[]});bf(V0,"parseCoordinateOfPie",function(t,e){var n=e.top,r=e.left,s=e.width,i=e.height,o=fLt(s,i),l=r+Au(t.cx,s,s/2),c=n+Au(t.cy,i,i/2),d=Au(t.innerRadius,o,0),u=Au(t.outerRadius,o,o*.8),h=t.maxRadius||Math.sqrt(s*s+i*i)/2;return{cx:l,cy:c,innerRadius:d,outerRadius:u,maxRadius:h}});bf(V0,"getComposedData",function(t){var e=t.item,n=t.offset,r=e.type.defaultProps!==void 0?Ra(Ra({},e.type.defaultProps),e.props):e.props,s=Tq.getRealPieData(r);if(!s||!s.length)return null;var i=r.cornerRadius,o=r.startAngle,l=r.endAngle,c=r.paddingAngle,d=r.dataKey,u=r.nameKey,h=r.valueKey,m=r.tooltipType,f=Math.abs(r.minAngle),p=Tq.parseCoordinateOfPie(r,n),g=Tq.parseDeltaAngle(o,l),v=Math.abs(g),b=d;$r(d)&&$r(h)?(Eg(!1,`Use "dataKey" to specify the value of pie,
      the props "valueKey" will be deprecated in 1.1.0`),b="value"):$r(d)&&(Eg(!1,`Use "dataKey" to specify the value of pie,
      the props "valueKey" will be deprecated in 1.1.0`),b=h);var x=s.filter(function(E){return eo(E,b,0)!==0}).length,w=(v>=360?x:x-1)*c,k=v-x*f-w,S=s.reduce(function(E,N){var A=eo(N,b,0);return E+(ln(A)?A:0)},0),C;if(S>0){var j;C=s.map(function(E,N){var A=eo(E,b,0),_=eo(E,u,N),T=(ln(A)?A:0)/S,R;N?R=j.endAngle+_u(g)*c*(A!==0?1:0):R=o;var O=R+_u(g)*((A!==0?f:0)+T*k),F=(R+O)/2,D=(p.innerRadius+p.outerRadius)/2,I=[{name:_,value:A,payload:E,dataKey:b,type:m}],P=$a(p.cx,p.cy,D,F);return j=Ra(Ra(Ra({percent:T,cornerRadius:i,name:_,tooltipPayload:I,midAngle:F,middleRadius:D,tooltipPosition:P},E),p),{},{value:eo(E,b),startAngle:R,endAngle:O,payload:E,paddingAngle:_u(g)*c}),j})}return Ra(Ra({},p),{},{sectors:C,data:s})});function n8(t){"@babel/helpers - typeof";return n8=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n8(t)}function hQe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function mQe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?hQe(Object(n),!0).forEach(function(r){RLt(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):hQe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function RLt(t,e,n){return e=CQr(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function CQr(t){var e=jQr(t,"string");return n8(e)=="symbol"?e:e+""}function jQr(t,e){if(n8(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(n8(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var EQr=["Webkit","Moz","O","ms"],NQr=function(e,n){var r=e.replace(/(\w)/,function(i){return i.toUpperCase()}),s=EQr.reduce(function(i,o){return mQe(mQe({},i),{},RLt({},o+r,n))},{});return s[e]=n,s};function E5(t){"@babel/helpers - typeof";return E5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E5(t)}function aX(){return aX=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},aX.apply(this,arguments)}function fQe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function ihe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?fQe(Object(n),!0).forEach(function(r){Qh(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):fQe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function TQr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function pQe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,MLt(r.key),r)}}function _Qr(t,e,n){return e&&pQe(t.prototype,e),n&&pQe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function AQr(t,e,n){return e=oX(e),PQr(t,ILt()?Reflect.construct(e,n||[],oX(t).constructor):e.apply(t,n))}function PQr(t,e){if(e&&(E5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return RQr(t)}function RQr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ILt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ILt=function(){return!!t})()}function oX(t){return oX=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},oX(t)}function IQr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&u1e(t,e)}function u1e(t,e){return u1e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},u1e(t,e)}function Qh(t,e,n){return e=MLt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function MLt(t){var e=MQr(t,"string");return E5(e)=="symbol"?e:e+""}function MQr(t,e){if(E5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(E5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var LQr=function(e){var n=e.data,r=e.startIndex,s=e.endIndex,i=e.x,o=e.width,l=e.travellerWidth;if(!n||!n.length)return{};var c=n.length,d=D$().domain(wF(0,c)).range([i,i+o-l]),u=d.domain().map(function(h){return d(h)});return{isTextActive:!1,isSlideMoving:!1,isTravellerMoving:!1,isTravellerFocused:!1,startX:d(r),endX:d(s),scale:d,scaleValues:u}},gQe=function(e){return e.changedTouches&&!!e.changedTouches.length},N5=function(t){function e(n){var r;return TQr(this,e),r=AQr(this,e,[n]),Qh(r,"handleDrag",function(s){r.leaveTimer&&(clearTimeout(r.leaveTimer),r.leaveTimer=null),r.state.isTravellerMoving?r.handleTravellerMove(s):r.state.isSlideMoving&&r.handleSlideDrag(s)}),Qh(r,"handleTouchMove",function(s){s.changedTouches!=null&&s.changedTouches.length>0&&r.handleDrag(s.changedTouches[0])}),Qh(r,"handleDragEnd",function(){r.setState({isTravellerMoving:!1,isSlideMoving:!1},function(){var s=r.props,i=s.endIndex,o=s.onDragEnd,l=s.startIndex;o==null||o({endIndex:i,startIndex:l})}),r.detachDragEndListener()}),Qh(r,"handleLeaveWrapper",function(){(r.state.isTravellerMoving||r.state.isSlideMoving)&&(r.leaveTimer=window.setTimeout(r.handleDragEnd,r.props.leaveTimeOut))}),Qh(r,"handleEnterSlideOrTraveller",function(){r.setState({isTextActive:!0})}),Qh(r,"handleLeaveSlideOrTraveller",function(){r.setState({isTextActive:!1})}),Qh(r,"handleSlideDragStart",function(s){var i=gQe(s)?s.changedTouches[0]:s;r.setState({isTravellerMoving:!1,isSlideMoving:!0,slideMoveStartX:i.pageX}),r.attachDragEndListener()}),r.travellerDragStartHandlers={startX:r.handleTravellerDragStart.bind(r,"startX"),endX:r.handleTravellerDragStart.bind(r,"endX")},r.state={},r}return IQr(e,t),_Qr(e,[{key:"componentWillUnmount",value:function(){this.leaveTimer&&(clearTimeout(this.leaveTimer),this.leaveTimer=null),this.detachDragEndListener()}},{key:"getIndex",value:function(r){var s=r.startX,i=r.endX,o=this.state.scaleValues,l=this.props,c=l.gap,d=l.data,u=d.length-1,h=Math.min(s,i),m=Math.max(s,i),f=e.getIndexInRange(o,h),p=e.getIndexInRange(o,m);return{startIndex:f-f%c,endIndex:p===u?u:p-p%c}}},{key:"getTextOfTick",value:function(r){var s=this.props,i=s.data,o=s.tickFormatter,l=s.dataKey,c=eo(i[r],l,r);return Wr(o)?o(c,r):c}},{key:"attachDragEndListener",value:function(){window.addEventListener("mouseup",this.handleDragEnd,!0),window.addEventListener("touchend",this.handleDragEnd,!0),window.addEventListener("mousemove",this.handleDrag,!0)}},{key:"detachDragEndListener",value:function(){window.removeEventListener("mouseup",this.handleDragEnd,!0),window.removeEventListener("touchend",this.handleDragEnd,!0),window.removeEventListener("mousemove",this.handleDrag,!0)}},{key:"handleSlideDrag",value:function(r){var s=this.state,i=s.slideMoveStartX,o=s.startX,l=s.endX,c=this.props,d=c.x,u=c.width,h=c.travellerWidth,m=c.startIndex,f=c.endIndex,p=c.onChange,g=r.pageX-i;g>0?g=Math.min(g,d+u-h-l,d+u-h-o):g<0&&(g=Math.max(g,d-o,d-l));var v=this.getIndex({startX:o+g,endX:l+g});(v.startIndex!==m||v.endIndex!==f)&&p&&p(v),this.setState({startX:o+g,endX:l+g,slideMoveStartX:r.pageX})}},{key:"handleTravellerDragStart",value:function(r,s){var i=gQe(s)?s.changedTouches[0]:s;this.setState({isSlideMoving:!1,isTravellerMoving:!0,movingTravellerId:r,brushMoveStartX:i.pageX}),this.attachDragEndListener()}},{key:"handleTravellerMove",value:function(r){var s=this.state,i=s.brushMoveStartX,o=s.movingTravellerId,l=s.endX,c=s.startX,d=this.state[o],u=this.props,h=u.x,m=u.width,f=u.travellerWidth,p=u.onChange,g=u.gap,v=u.data,b={startX:this.state.startX,endX:this.state.endX},x=r.pageX-i;x>0?x=Math.min(x,h+m-f-d):x<0&&(x=Math.max(x,h-d)),b[o]=d+x;var w=this.getIndex(b),k=w.startIndex,S=w.endIndex,C=function(){var E=v.length-1;return o==="startX"&&(l>c?k%g===0:S%g===0)||l<c&&S===E||o==="endX"&&(l>c?S%g===0:k%g===0)||l>c&&S===E};this.setState(Qh(Qh({},o,d+x),"brushMoveStartX",r.pageX),function(){p&&C()&&p(w)})}},{key:"handleTravellerMoveKeyboard",value:function(r,s){var i=this,o=this.state,l=o.scaleValues,c=o.startX,d=o.endX,u=this.state[s],h=l.indexOf(u);if(h!==-1){var m=h+r;if(!(m===-1||m>=l.length)){var f=l[m];s==="startX"&&f>=d||s==="endX"&&f<=c||this.setState(Qh({},s,f),function(){i.props.onChange(i.getIndex({startX:i.state.startX,endX:i.state.endX}))})}}}},{key:"renderBackground",value:function(){var r=this.props,s=r.x,i=r.y,o=r.width,l=r.height,c=r.fill,d=r.stroke;return se.createElement("rect",{stroke:d,fill:c,x:s,y:i,width:o,height:l})}},{key:"renderPanorama",value:function(){var r=this.props,s=r.x,i=r.y,o=r.width,l=r.height,c=r.data,d=r.children,u=r.padding,h=y.Children.only(d);return h?se.cloneElement(h,{x:s,y:i,width:o,height:l,margin:u,compact:!0,data:c}):null}},{key:"renderTravellerLayer",value:function(r,s){var i,o,l=this,c=this.props,d=c.y,u=c.travellerWidth,h=c.height,m=c.traveller,f=c.ariaLabel,p=c.data,g=c.startIndex,v=c.endIndex,b=Math.max(r,this.props.x),x=ihe(ihe({},hr(this.props,!1)),{},{x:b,y:d,width:u,height:h}),w=f||"Min value: ".concat((i=p[g])===null||i===void 0?void 0:i.name,", Max value: ").concat((o=p[v])===null||o===void 0?void 0:o.name);return se.createElement(Cs,{tabIndex:0,role:"slider","aria-label":w,"aria-valuenow":r,className:"recharts-brush-traveller",onMouseEnter:this.handleEnterSlideOrTraveller,onMouseLeave:this.handleLeaveSlideOrTraveller,onMouseDown:this.travellerDragStartHandlers[s],onTouchStart:this.travellerDragStartHandlers[s],onKeyDown:function(S){["ArrowLeft","ArrowRight"].includes(S.key)&&(S.preventDefault(),S.stopPropagation(),l.handleTravellerMoveKeyboard(S.key==="ArrowRight"?1:-1,s))},onFocus:function(){l.setState({isTravellerFocused:!0})},onBlur:function(){l.setState({isTravellerFocused:!1})},style:{cursor:"col-resize"}},e.renderTraveller(m,x))}},{key:"renderSlide",value:function(r,s){var i=this.props,o=i.y,l=i.height,c=i.stroke,d=i.travellerWidth,u=Math.min(r,s)+d,h=Math.max(Math.abs(s-r)-d,0);return se.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:u,y:o,width:h,height:l})}},{key:"renderText",value:function(){var r=this.props,s=r.startIndex,i=r.endIndex,o=r.y,l=r.height,c=r.travellerWidth,d=r.stroke,u=this.state,h=u.startX,m=u.endX,f=5,p={pointerEvents:"none",fill:d};return se.createElement(Cs,{className:"recharts-brush-texts"},se.createElement(oE,aX({textAnchor:"end",verticalAnchor:"middle",x:Math.min(h,m)-f,y:o+l/2},p),this.getTextOfTick(s)),se.createElement(oE,aX({textAnchor:"start",verticalAnchor:"middle",x:Math.max(h,m)+c+f,y:o+l/2},p),this.getTextOfTick(i)))}},{key:"render",value:function(){var r=this.props,s=r.data,i=r.className,o=r.children,l=r.x,c=r.y,d=r.width,u=r.height,h=r.alwaysShowText,m=this.state,f=m.startX,p=m.endX,g=m.isTextActive,v=m.isSlideMoving,b=m.isTravellerMoving,x=m.isTravellerFocused;if(!s||!s.length||!ln(l)||!ln(c)||!ln(d)||!ln(u)||d<=0||u<=0)return null;var w=Zn("recharts-brush",i),k=se.Children.count(o)===1,S=NQr("userSelect","none");return se.createElement(Cs,{className:w,onMouseLeave:this.handleLeaveWrapper,onTouchMove:this.handleTouchMove,style:S},this.renderBackground(),k&&this.renderPanorama(),this.renderSlide(f,p),this.renderTravellerLayer(f,"startX"),this.renderTravellerLayer(p,"endX"),(g||v||b||x||h)&&this.renderText())}}],[{key:"renderDefaultTraveller",value:function(r){var s=r.x,i=r.y,o=r.width,l=r.height,c=r.stroke,d=Math.floor(i+l/2)-1;return se.createElement(se.Fragment,null,se.createElement("rect",{x:s,y:i,width:o,height:l,fill:c,stroke:"none"}),se.createElement("line",{x1:s+1,y1:d,x2:s+o-1,y2:d,fill:"none",stroke:"#fff"}),se.createElement("line",{x1:s+1,y1:d+2,x2:s+o-1,y2:d+2,fill:"none",stroke:"#fff"}))}},{key:"renderTraveller",value:function(r,s){var i;return se.isValidElement(r)?i=se.cloneElement(r,s):Wr(r)?i=r(s):i=e.renderDefaultTraveller(s),i}},{key:"getDerivedStateFromProps",value:function(r,s){var i=r.data,o=r.width,l=r.x,c=r.travellerWidth,d=r.updateId,u=r.startIndex,h=r.endIndex;if(i!==s.prevData||d!==s.prevUpdateId)return ihe({prevData:i,prevTravellerWidth:c,prevUpdateId:d,prevX:l,prevWidth:o},i&&i.length?LQr({data:i,width:o,x:l,travellerWidth:c,startIndex:u,endIndex:h}):{scale:null,scaleValues:null});if(s.scale&&(o!==s.prevWidth||l!==s.prevX||c!==s.prevTravellerWidth)){s.scale.range([l,l+o-c]);var m=s.scale.domain().map(function(f){return s.scale(f)});return{prevData:i,prevTravellerWidth:c,prevUpdateId:d,prevX:l,prevWidth:o,startX:s.scale(r.startIndex),endX:s.scale(r.endIndex),scaleValues:m}}return null}},{key:"getIndexInRange",value:function(r,s){for(var i=r.length,o=0,l=i-1;l-o>1;){var c=Math.floor((o+l)/2);r[c]>s?l=c:o=c}return s>=r[l]?l:o}}])}(y.PureComponent);Qh(N5,"displayName","Brush");Qh(N5,"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 DQr=aRe;function $Qr(t,e){var n;return DQr(t,function(r,s,i){return n=e(r,s,i),!n}),!!n}var OQr=$Qr,FQr=jPt,BQr=Xg,UQr=OQr,zQr=au,VQr=$M;function HQr(t,e,n){var r=zQr(t)?FQr:UQr;return n&&VQr(t,e,n)&&(e=void 0),r(t,BQr(e))}var GQr=HQr;const WQr=Fs(GQr);var Cy=function(e,n){var r=e.alwaysShow,s=e.ifOverflow;return r&&(s="extendDomain"),s===n};function qQr(t,e){for(var n=-1,r=t==null?0:t.length;++n<r;)if(!e(t[n],n,t))return!1;return!0}var KQr=qQr,YQr=aRe;function QQr(t,e){var n=!0;return YQr(t,function(r,s,i){return n=!!e(r,s,i),n}),n}var ZQr=QQr,JQr=KQr,XQr=ZQr,eZr=Xg,tZr=au,nZr=$M;function rZr(t,e,n){var r=tZr(t)?JQr:XQr;return n&&nZr(t,e,n)&&(e=void 0),r(t,eZr(e))}var sZr=rZr;const LLt=Fs(sZr);var iZr=["x","y"];function r8(t){"@babel/helpers - typeof";return r8=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r8(t)}function h1e(){return h1e=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},h1e.apply(this,arguments)}function vQe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Z3(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?vQe(Object(n),!0).forEach(function(r){aZr(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):vQe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function aZr(t,e,n){return e=oZr(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function oZr(t){var e=lZr(t,"string");return r8(e)=="symbol"?e:e+""}function lZr(t,e){if(r8(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(r8(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function cZr(t,e){if(t==null)return{};var n=dZr(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function dZr(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function uZr(t,e){var n=t.x,r=t.y,s=cZr(t,iZr),i="".concat(n),o=parseInt(i,10),l="".concat(r),c=parseInt(l,10),d="".concat(e.height||s.height),u=parseInt(d,10),h="".concat(e.width||s.width),m=parseInt(h,10);return Z3(Z3(Z3(Z3(Z3({},e),s),o?{x:o}:{}),c?{y:c}:{}),{},{height:u,width:m,name:e.name,radius:e.radius})}function yQe(t){return se.createElement(sX,h1e({shapeType:"rectangle",propTransformer:uZr,activeClassName:"recharts-active-bar"},t))}var hZr=function(e){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0;return function(r,s){if(typeof e=="number")return e;var i=ln(r)||t8r(r);return i?e(r,s):(i||dE(),n)}},mZr=["value","background"],DLt;function T5(t){"@babel/helpers - typeof";return T5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},T5(t)}function fZr(t,e){if(t==null)return{};var n=pZr(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function pZr(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function lX(){return lX=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},lX.apply(this,arguments)}function bQe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Hl(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?bQe(Object(n),!0).forEach(function(r){$1(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):bQe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function gZr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function xQe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,OLt(r.key),r)}}function vZr(t,e,n){return e&&xQe(t.prototype,e),n&&xQe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function yZr(t,e,n){return e=cX(e),bZr(t,$Lt()?Reflect.construct(e,n||[],cX(t).constructor):e.apply(t,n))}function bZr(t,e){if(e&&(T5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xZr(t)}function xZr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function $Lt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return($Lt=function(){return!!t})()}function cX(t){return cX=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},cX(t)}function wZr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&m1e(t,e)}function m1e(t,e){return m1e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},m1e(t,e)}function $1(t,e,n){return e=OLt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function OLt(t){var e=kZr(t,"string");return T5(e)=="symbol"?e:e+""}function kZr(t,e){if(T5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(T5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Bg=function(t){function e(){var n;gZr(this,e);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=yZr(this,e,[].concat(s)),$1(n,"state",{isAnimationFinished:!1}),$1(n,"id",MS("recharts-bar-")),$1(n,"handleAnimationEnd",function(){var o=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),o&&o()}),$1(n,"handleAnimationStart",function(){var o=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),o&&o()}),n}return wZr(e,t),vZr(e,[{key:"renderRectanglesStatically",value:function(r){var s=this,i=this.props,o=i.shape,l=i.dataKey,c=i.activeIndex,d=i.activeBar,u=hr(this.props,!1);return r&&r.map(function(h,m){var f=m===c,p=f?d:o,g=Hl(Hl(Hl({},u),h),{},{isActive:f,option:p,index:m,dataKey:l,onAnimationStart:s.handleAnimationStart,onAnimationEnd:s.handleAnimationEnd});return se.createElement(Cs,lX({className:"recharts-bar-rectangle"},Qk(s.props,h,m),{key:"rectangle-".concat(h==null?void 0:h.x,"-").concat(h==null?void 0:h.y,"-").concat(h==null?void 0:h.value,"-").concat(m)}),se.createElement(yQe,g))})}},{key:"renderRectanglesWithAnimation",value:function(){var r=this,s=this.props,i=s.data,o=s.layout,l=s.isAnimationActive,c=s.animationBegin,d=s.animationDuration,u=s.animationEasing,h=s.animationId,m=this.state.prevData;return se.createElement(Qf,{begin:c,duration:d,isActive:l,easing:u,from:{t:0},to:{t:1},key:"bar-".concat(h),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(f){var p=f.t,g=i.map(function(v,b){var x=m&&m[b];if(x){var w=Mo(x.x,v.x),k=Mo(x.y,v.y),S=Mo(x.width,v.width),C=Mo(x.height,v.height);return Hl(Hl({},v),{},{x:w(p),y:k(p),width:S(p),height:C(p)})}if(o==="horizontal"){var j=Mo(0,v.height),E=j(p);return Hl(Hl({},v),{},{y:v.y+v.height-E,height:E})}var N=Mo(0,v.width),A=N(p);return Hl(Hl({},v),{},{width:A})});return se.createElement(Cs,null,r.renderRectanglesStatically(g))})}},{key:"renderRectangles",value:function(){var r=this.props,s=r.data,i=r.isAnimationActive,o=this.state.prevData;return i&&s&&s.length&&(!o||!m0(o,s))?this.renderRectanglesWithAnimation():this.renderRectanglesStatically(s)}},{key:"renderBackground",value:function(){var r=this,s=this.props,i=s.data,o=s.dataKey,l=s.activeIndex,c=hr(this.props.background,!1);return i.map(function(d,u){d.value;var h=d.background,m=fZr(d,mZr);if(!h)return null;var f=Hl(Hl(Hl(Hl(Hl({},m),{},{fill:"#eee"},h),c),Qk(r.props,d,u)),{},{onAnimationStart:r.handleAnimationStart,onAnimationEnd:r.handleAnimationEnd,dataKey:o,index:u,className:"recharts-bar-background-rectangle"});return se.createElement(yQe,lX({key:"background-bar-".concat(u),option:r.props.background,isActive:u===l},f))})}},{key:"renderErrorBar",value:function(r,s){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.data,l=i.xAxis,c=i.yAxis,d=i.layout,u=i.children,h=Lu(u,XM);if(!h)return null;var m=d==="vertical"?o[0].height/2:o[0].width/2,f=function(v,b){var x=Array.isArray(v.value)?v.value[1]:v.value;return{x:v.x,y:v.y,value:x,errorVal:eo(v,b)}},p={clipPath:r?"url(#clipPath-".concat(s,")"):null};return se.createElement(Cs,p,h.map(function(g){return se.cloneElement(g,{key:"error-bar-".concat(s,"-").concat(g.props.dataKey),data:o,xAxis:l,yAxis:c,layout:d,offset:m,dataPointFormatter:f})}))}},{key:"render",value:function(){var r=this.props,s=r.hide,i=r.data,o=r.className,l=r.xAxis,c=r.yAxis,d=r.left,u=r.top,h=r.width,m=r.height,f=r.isAnimationActive,p=r.background,g=r.id;if(s||!i||!i.length)return null;var v=this.state.isAnimationFinished,b=Zn("recharts-bar",o),x=l&&l.allowDataOverflow,w=c&&c.allowDataOverflow,k=x||w,S=$r(g)?this.id:g;return se.createElement(Cs,{className:b},x||w?se.createElement("defs",null,se.createElement("clipPath",{id:"clipPath-".concat(S)},se.createElement("rect",{x:x?d:d-h/2,y:w?u:u-m/2,width:x?h:h*2,height:w?m:m*2}))):null,se.createElement(Cs,{className:"recharts-bar-rectangles",clipPath:k?"url(#clipPath-".concat(S,")"):null},p?this.renderBackground():null,this.renderRectangles()),this.renderErrorBar(k,S),(!f||v)&&Ng.renderCallByParent(this.props,i))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curData:r.data,prevData:s.curData}:r.data!==s.curData?{curData:r.data}:null}}])}(y.PureComponent);DLt=Bg;$1(Bg,"displayName","Bar");$1(Bg,"defaultProps",{xAxisId:0,yAxisId:0,legendType:"rect",minPointSize:0,hide:!1,data:[],layout:"vertical",activeBar:!1,isAnimationActive:!Lf.isSsr,animationBegin:0,animationDuration:400,animationEasing:"ease"});$1(Bg,"getComposedData",function(t){var e=t.props,n=t.item,r=t.barPosition,s=t.bandSize,i=t.xAxis,o=t.yAxis,l=t.xAxisTicks,c=t.yAxisTicks,d=t.stackedData,u=t.dataStartIndex,h=t.displayedData,m=t.offset,f=WGr(r,n);if(!f)return null;var p=e.layout,g=n.type.defaultProps,v=g!==void 0?Hl(Hl({},g),n.props):n.props,b=v.dataKey,x=v.children,w=v.minPointSize,k=p==="horizontal"?o:i,S=d?k.scale.domain():null,C=XGr({numericAxis:k}),j=Lu(x,C9),E=h.map(function(N,A){var _,T,R,O,F,D;d?_=qGr(d[u+A],S):(_=eo(N,b),Array.isArray(_)||(_=[C,_]));var I=hZr(w,DLt.defaultProps.minPointSize)(_[1],A);if(p==="horizontal"){var P,M=[o.scale(_[0]),o.scale(_[1])],z=M[0],G=M[1];T=uYe({axis:i,ticks:l,bandSize:s,offset:f.offset,entry:N,index:A}),R=(P=G??z)!==null&&P!==void 0?P:void 0,O=f.size;var B=z-G;if(F=Number.isNaN(B)?0:B,D={x:T,y:o.y,width:O,height:o.height},Math.abs(I)>0&&Math.abs(F)<Math.abs(I)){var H=_u(F||I)*(Math.abs(I)-Math.abs(F));R-=H,F+=H}}else{var W=[i.scale(_[0]),i.scale(_[1])],V=W[0],U=W[1];if(T=V,R=uYe({axis:o,ticks:c,bandSize:s,offset:f.offset,entry:N,index:A}),O=U-V,F=f.size,D={x:i.x,y:R,width:i.width,height:F},Math.abs(I)>0&&Math.abs(O)<Math.abs(I)){var ne=_u(O||I)*(Math.abs(I)-Math.abs(O));O+=ne}}return Hl(Hl(Hl({},N),{},{x:T,y:R,width:O,height:F,value:d?_:_[1],payload:N,background:D},j&&j[A]&&j[A].props),{},{tooltipPayload:[hLt(n,N)],tooltipPosition:{x:T+O/2,y:R+F/2}})});return Hl({data:E,layout:p},m)});function s8(t){"@babel/helpers - typeof";return s8=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},s8(t)}function SZr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function wQe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,FLt(r.key),r)}}function CZr(t,e,n){return e&&wQe(t.prototype,e),n&&wQe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function kQe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Qp(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?kQe(Object(n),!0).forEach(function(r){Vie(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):kQe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Vie(t,e,n){return e=FLt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function FLt(t){var e=jZr(t,"string");return s8(e)=="symbol"?e:e+""}function jZr(t,e){if(s8(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(s8(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var L5e=function(e,n,r,s,i){var o=e.width,l=e.height,c=e.layout,d=e.children,u=Object.keys(n),h={left:r.left,leftMirror:r.left,right:o-r.right,rightMirror:o-r.right,top:r.top,topMirror:r.top,bottom:l-r.bottom,bottomMirror:l-r.bottom},m=!!im(d,Bg);return u.reduce(function(f,p){var g=n[p],v=g.orientation,b=g.domain,x=g.padding,w=x===void 0?{}:x,k=g.mirror,S=g.reversed,C="".concat(v).concat(k?"Mirror":""),j,E,N,A,_;if(g.type==="number"&&(g.padding==="gap"||g.padding==="no-gap")){var T=b[1]-b[0],R=1/0,O=g.categoricalDomain.sort(i8r);if(O.forEach(function(W,V){V>0&&(R=Math.min((W||0)-(O[V-1]||0),R))}),Number.isFinite(R)){var F=R/T,D=g.layout==="vertical"?r.height:r.width;if(g.padding==="gap"&&(j=F*D/2),g.padding==="no-gap"){var I=Au(e.barCategoryGap,F*D),P=F*D/2;j=P-I-(P-I)/D*I}}}s==="xAxis"?E=[r.left+(w.left||0)+(j||0),r.left+r.width-(w.right||0)-(j||0)]:s==="yAxis"?E=c==="horizontal"?[r.top+r.height-(w.bottom||0),r.top+(w.top||0)]:[r.top+(w.top||0)+(j||0),r.top+r.height-(w.bottom||0)-(j||0)]:E=g.range,S&&(E=[E[1],E[0]]);var M=lLt(g,i,m),z=M.scale,G=M.realScaleType;z.domain(b).range(E),cLt(z);var B=dLt(z,Qp(Qp({},g),{},{realScaleType:G}));s==="xAxis"?(_=v==="top"&&!k||v==="bottom"&&k,N=r.left,A=h[C]-_*g.height):s==="yAxis"&&(_=v==="left"&&!k||v==="right"&&k,N=h[C]-_*g.width,A=r.top);var H=Qp(Qp(Qp({},g),B),{},{realScaleType:G,x:N,y:A,scale:z,width:s==="xAxis"?r.width:g.width,height:s==="yAxis"?r.height:g.height});return H.bandSize=qJ(H,B),!g.hide&&s==="xAxis"?h[C]+=(_?-1:1)*H.height:g.hide||(h[C]+=(_?-1:1)*H.width),Qp(Qp({},f),{},Vie({},p,H))},{})},BLt=function(e,n){var r=e.x,s=e.y,i=n.x,o=n.y;return{x:Math.min(r,i),y:Math.min(s,o),width:Math.abs(i-r),height:Math.abs(o-s)}},EZr=function(e){var n=e.x1,r=e.y1,s=e.x2,i=e.y2;return BLt({x:n,y:r},{x:s,y:i})},ULt=function(){function t(e){SZr(this,t),this.scale=e}return CZr(t,[{key:"domain",get:function(){return this.scale.domain}},{key:"range",get:function(){return this.scale.range}},{key:"rangeMin",get:function(){return this.range()[0]}},{key:"rangeMax",get:function(){return this.range()[1]}},{key:"bandwidth",get:function(){return this.scale.bandwidth}},{key:"apply",value:function(n){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=r.bandAware,i=r.position;if(n!==void 0){if(i)switch(i){case"start":return this.scale(n);case"middle":{var o=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+o}case"end":{var l=this.bandwidth?this.bandwidth():0;return this.scale(n)+l}default:return this.scale(n)}if(s){var c=this.bandwidth?this.bandwidth()/2:0;return this.scale(n)+c}return this.scale(n)}}},{key:"isInRange",value:function(n){var r=this.range(),s=r[0],i=r[r.length-1];return s<=i?n>=s&&n<=i:n>=i&&n<=s}}],[{key:"create",value:function(n){return new t(n)}}])}();Vie(ULt,"EPS",1e-4);var D5e=function(e){var n=Object.keys(e).reduce(function(r,s){return Qp(Qp({},r),{},Vie({},s,ULt.create(e[s])))},{});return Qp(Qp({},n),{},{apply:function(s){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},o=i.bandAware,l=i.position;return rRt(s,function(c,d){return n[d].apply(c,{bandAware:o,position:l})})},isInRange:function(s){return LLt(s,function(i,o){return n[o].isInRange(i)})}})};function NZr(t){return(t%180+180)%180}var TZr=function(e){var n=e.width,r=e.height,s=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,i=NZr(s),o=i*Math.PI/180,l=Math.atan(r/n),c=o>l&&o<Math.PI-l?r/Math.sin(o):n/Math.cos(o);return Math.abs(c)},_Zr=Xg,AZr=DM,PZr=VM;function RZr(t){return function(e,n,r){var s=Object(e);if(!AZr(e)){var i=_Zr(n);e=PZr(e),n=function(l){return i(s[l],l,s)}}var o=t(e,n,r);return o>-1?s[i?e[o]:o]:void 0}}var IZr=RZr,MZr=IZr,LZr=qPt,DZr=MZr(LZr),$Zr=DZr;const OZr=Fs($Zr);var FZr=oTr(function(t){return{x:t.left,y:t.top,width:t.width,height:t.height}},function(t){return["l",t.left,"t",t.top,"w",t.width,"h",t.height].join("")}),$5e=y.createContext(void 0),O5e=y.createContext(void 0),zLt=y.createContext(void 0),VLt=y.createContext({}),HLt=y.createContext(void 0),GLt=y.createContext(0),WLt=y.createContext(0),SQe=function(e){var n=e.state,r=n.xAxisMap,s=n.yAxisMap,i=n.offset,o=e.clipPathId,l=e.children,c=e.width,d=e.height,u=FZr(i);return se.createElement($5e.Provider,{value:r},se.createElement(O5e.Provider,{value:s},se.createElement(VLt.Provider,{value:i},se.createElement(zLt.Provider,{value:u},se.createElement(HLt.Provider,{value:o},se.createElement(GLt.Provider,{value:d},se.createElement(WLt.Provider,{value:c},l)))))))},BZr=function(){return y.useContext(HLt)},qLt=function(e){var n=y.useContext($5e);n==null&&dE();var r=n[e];return r==null&&dE(),r},UZr=function(){var e=y.useContext($5e);return u1(e)},zZr=function(){var e=y.useContext(O5e),n=OZr(e,function(r){return LLt(r.domain,Number.isFinite)});return n||u1(e)},KLt=function(e){var n=y.useContext(O5e);n==null&&dE();var r=n[e];return r==null&&dE(),r},VZr=function(){var e=y.useContext(zLt);return e},HZr=function(){return y.useContext(VLt)},F5e=function(){return y.useContext(WLt)},B5e=function(){return y.useContext(GLt)};function _5(t){"@babel/helpers - typeof";return _5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_5(t)}function GZr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function WZr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,QLt(r.key),r)}}function qZr(t,e,n){return e&&WZr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function KZr(t,e,n){return e=dX(e),YZr(t,YLt()?Reflect.construct(e,n||[],dX(t).constructor):e.apply(t,n))}function YZr(t,e){if(e&&(_5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return QZr(t)}function QZr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function YLt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(YLt=function(){return!!t})()}function dX(t){return dX=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},dX(t)}function ZZr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&f1e(t,e)}function f1e(t,e){return f1e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},f1e(t,e)}function CQe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function jQe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?CQe(Object(n),!0).forEach(function(r){U5e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):CQe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function U5e(t,e,n){return e=QLt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function QLt(t){var e=JZr(t,"string");return _5(e)=="symbol"?e:e+""}function JZr(t,e){if(_5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(_5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function XZr(t,e){return rJr(t)||nJr(t,e)||tJr(t,e)||eJr()}function eJr(){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 tJr(t,e){if(t){if(typeof t=="string")return EQe(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return EQe(t,e)}}function EQe(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function nJr(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(u){d=!0,s=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function rJr(t){if(Array.isArray(t))return t}function p1e(){return p1e=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},p1e.apply(this,arguments)}var sJr=function(e,n){var r;return se.isValidElement(e)?r=se.cloneElement(e,n):Wr(e)?r=e(n):r=se.createElement("line",p1e({},n,{className:"recharts-reference-line-line"})),r},iJr=function(e,n,r,s,i,o,l,c,d){var u=i.x,h=i.y,m=i.width,f=i.height;if(r){var p=d.y,g=e.y.apply(p,{position:o});if(Cy(d,"discard")&&!e.y.isInRange(g))return null;var v=[{x:u+m,y:g},{x:u,y:g}];return c==="left"?v.reverse():v}if(n){var b=d.x,x=e.x.apply(b,{position:o});if(Cy(d,"discard")&&!e.x.isInRange(x))return null;var w=[{x,y:h+f},{x,y:h}];return l==="top"?w.reverse():w}if(s){var k=d.segment,S=k.map(function(C){return e.apply(C,{position:o})});return Cy(d,"discard")&&WQr(S,function(C){return!e.isInRange(C)})?null:S}return null};function aJr(t){var e=t.x,n=t.y,r=t.segment,s=t.xAxisId,i=t.yAxisId,o=t.shape,l=t.className,c=t.alwaysShow,d=BZr(),u=qLt(s),h=KLt(i),m=VZr();if(!d||!m)return null;Eg(c===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var f=D5e({x:u.scale,y:h.scale}),p=gc(e),g=gc(n),v=r&&r.length===2,b=iJr(f,p,g,v,m,t.position,u.orientation,h.orientation,t);if(!b)return null;var x=XZr(b,2),w=x[0],k=w.x,S=w.y,C=x[1],j=C.x,E=C.y,N=Cy(t,"hidden")?"url(#".concat(d,")"):void 0,A=jQe(jQe({clipPath:N},hr(t,!0)),{},{x1:k,y1:S,x2:j,y2:E});return se.createElement(Cs,{className:Zn("recharts-reference-line",l)},sJr(o,A),Lc.renderCallByParent(t,EZr({x1:k,y1:S,x2:j,y2:E})))}var z5e=function(t){function e(){return GZr(this,e),KZr(this,e,arguments)}return ZZr(e,t),qZr(e,[{key:"render",value:function(){return se.createElement(aJr,this.props)}}])}(se.Component);U5e(z5e,"displayName","ReferenceLine");U5e(z5e,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,fill:"none",stroke:"#ccc",fillOpacity:1,strokeWidth:1,position:"middle"});function g1e(){return g1e=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},g1e.apply(this,arguments)}function A5(t){"@babel/helpers - typeof";return A5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},A5(t)}function NQe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function TQe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?NQe(Object(n),!0).forEach(function(r){Hie(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):NQe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function oJr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function lJr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,JLt(r.key),r)}}function cJr(t,e,n){return e&&lJr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function dJr(t,e,n){return e=uX(e),uJr(t,ZLt()?Reflect.construct(e,n||[],uX(t).constructor):e.apply(t,n))}function uJr(t,e){if(e&&(A5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return hJr(t)}function hJr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function ZLt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(ZLt=function(){return!!t})()}function uX(t){return uX=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},uX(t)}function mJr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v1e(t,e)}function v1e(t,e){return v1e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},v1e(t,e)}function Hie(t,e,n){return e=JLt(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function JLt(t){var e=fJr(t,"string");return A5(e)=="symbol"?e:e+""}function fJr(t,e){if(A5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(A5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var pJr=function(e){var n=e.x,r=e.y,s=e.xAxis,i=e.yAxis,o=D5e({x:s.scale,y:i.scale}),l=o.apply({x:n,y:r},{bandAware:!0});return Cy(e,"discard")&&!o.isInRange(l)?null:l},Gie=function(t){function e(){return oJr(this,e),dJr(this,e,arguments)}return mJr(e,t),cJr(e,[{key:"render",value:function(){var r=this.props,s=r.x,i=r.y,o=r.r,l=r.alwaysShow,c=r.clipPathId,d=gc(s),u=gc(i);if(Eg(l===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.'),!d||!u)return null;var h=pJr(this.props);if(!h)return null;var m=h.x,f=h.y,p=this.props,g=p.shape,v=p.className,b=Cy(this.props,"hidden")?"url(#".concat(c,")"):void 0,x=TQe(TQe({clipPath:b},hr(this.props,!0)),{},{cx:m,cy:f});return se.createElement(Cs,{className:Zn("recharts-reference-dot",v)},e.renderDot(g,x),Lc.renderCallByParent(this.props,{x:m-o,y:f-o,width:2*o,height:2*o}))}}])}(se.Component);Hie(Gie,"displayName","ReferenceDot");Hie(Gie,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#fff",stroke:"#ccc",fillOpacity:1,strokeWidth:1});Hie(Gie,"renderDot",function(t,e){var n;return se.isValidElement(t)?n=se.cloneElement(t,e):Wr(t)?n=t(e):n=se.createElement(_9,g1e({},e,{cx:e.cx,cy:e.cy,className:"recharts-reference-dot-dot"})),n});function y1e(){return y1e=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},y1e.apply(this,arguments)}function P5(t){"@babel/helpers - typeof";return P5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},P5(t)}function _Qe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function AQe(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?_Qe(Object(n),!0).forEach(function(r){Wie(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_Qe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function gJr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function vJr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,e3t(r.key),r)}}function yJr(t,e,n){return e&&vJr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function bJr(t,e,n){return e=hX(e),xJr(t,XLt()?Reflect.construct(e,n||[],hX(t).constructor):e.apply(t,n))}function xJr(t,e){if(e&&(P5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return wJr(t)}function wJr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function XLt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(XLt=function(){return!!t})()}function hX(t){return hX=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},hX(t)}function kJr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&b1e(t,e)}function b1e(t,e){return b1e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},b1e(t,e)}function Wie(t,e,n){return e=e3t(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function e3t(t){var e=SJr(t,"string");return P5(e)=="symbol"?e:e+""}function SJr(t,e){if(P5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(P5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var CJr=function(e,n,r,s,i){var o=i.x1,l=i.x2,c=i.y1,d=i.y2,u=i.xAxis,h=i.yAxis;if(!u||!h)return null;var m=D5e({x:u.scale,y:h.scale}),f={x:e?m.x.apply(o,{position:"start"}):m.x.rangeMin,y:r?m.y.apply(c,{position:"start"}):m.y.rangeMin},p={x:n?m.x.apply(l,{position:"end"}):m.x.rangeMax,y:s?m.y.apply(d,{position:"end"}):m.y.rangeMax};return Cy(i,"discard")&&(!m.isInRange(f)||!m.isInRange(p))?null:BLt(f,p)},qie=function(t){function e(){return gJr(this,e),bJr(this,e,arguments)}return kJr(e,t),yJr(e,[{key:"render",value:function(){var r=this.props,s=r.x1,i=r.x2,o=r.y1,l=r.y2,c=r.className,d=r.alwaysShow,u=r.clipPathId;Eg(d===void 0,'The alwaysShow prop is deprecated. Please use ifOverflow="extendDomain" instead.');var h=gc(s),m=gc(i),f=gc(o),p=gc(l),g=this.props.shape;if(!h&&!m&&!f&&!p&&!g)return null;var v=CJr(h,m,f,p,this.props);if(!v&&!g)return null;var b=Cy(this.props,"hidden")?"url(#".concat(u,")"):void 0;return se.createElement(Cs,{className:Zn("recharts-reference-area",c)},e.renderRect(g,AQe(AQe({clipPath:b},hr(this.props,!0)),v)),Lc.renderCallByParent(this.props,v))}}])}(se.Component);Wie(qie,"displayName","ReferenceArea");Wie(qie,"defaultProps",{isFront:!1,ifOverflow:"discard",xAxisId:0,yAxisId:0,r:10,fill:"#ccc",fillOpacity:.5,stroke:"none",strokeWidth:1});Wie(qie,"renderRect",function(t,e){var n;return se.isValidElement(t)?n=se.cloneElement(t,e):Wr(t)?n=t(e):n=se.createElement(M5e,y1e({},e,{className:"recharts-reference-area-rect"})),n});function t3t(t,e,n){if(e<1)return[];if(e===1&&n===void 0)return t;for(var r=[],s=0;s<t.length;s+=e)r.push(t[s]);return r}function jJr(t,e,n){var r={width:t.width+e.width,height:t.height+e.height};return TZr(r,n)}function EJr(t,e,n){var r=n==="width",s=t.x,i=t.y,o=t.width,l=t.height;return e===1?{start:r?s:i,end:r?s+o:i+l}:{start:r?s+o:i+l,end:r?s:i}}function mX(t,e,n,r,s){if(t*e<t*r||t*e>t*s)return!1;var i=n();return t*(e-t*i/2-r)>=0&&t*(e+t*i/2-s)<=0}function NJr(t,e){return t3t(t,e+1)}function TJr(t,e,n,r,s){for(var i=(r||[]).slice(),o=e.start,l=e.end,c=0,d=1,u=o,h=function(){var p=r==null?void 0:r[c];if(p===void 0)return{v:t3t(r,d)};var g=c,v,b=function(){return v===void 0&&(v=n(p,g)),v},x=p.coordinate,w=c===0||mX(t,x,b,u,l);w||(c=0,u=o,d+=1),w&&(u=x+t*(b()/2+s),c+=d)},m;d<=i.length;)if(m=h(),m)return m.v;return[]}function i8(t){"@babel/helpers - typeof";return i8=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},i8(t)}function PQe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Fd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?PQe(Object(n),!0).forEach(function(r){_Jr(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):PQe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function _Jr(t,e,n){return e=AJr(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function AJr(t){var e=PJr(t,"string");return i8(e)=="symbol"?e:e+""}function PJr(t,e){if(i8(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(i8(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function RJr(t,e,n,r,s){for(var i=(r||[]).slice(),o=i.length,l=e.start,c=e.end,d=function(m){var f=i[m],p,g=function(){return p===void 0&&(p=n(f,m)),p};if(m===o-1){var v=t*(f.coordinate+t*g()/2-c);i[m]=f=Fd(Fd({},f),{},{tickCoord:v>0?f.coordinate-v*t:f.coordinate})}else i[m]=f=Fd(Fd({},f),{},{tickCoord:f.coordinate});var b=mX(t,f.tickCoord,g,l,c);b&&(c=f.tickCoord-t*(g()/2+s),i[m]=Fd(Fd({},f),{},{isShow:!0}))},u=o-1;u>=0;u--)d(u);return i}function IJr(t,e,n,r,s,i){var o=(r||[]).slice(),l=o.length,c=e.start,d=e.end;if(i){var u=r[l-1],h=n(u,l-1),m=t*(u.coordinate+t*h/2-d);o[l-1]=u=Fd(Fd({},u),{},{tickCoord:m>0?u.coordinate-m*t:u.coordinate});var f=mX(t,u.tickCoord,function(){return h},c,d);f&&(d=u.tickCoord-t*(h/2+s),o[l-1]=Fd(Fd({},u),{},{isShow:!0}))}for(var p=i?l-1:l,g=function(x){var w=o[x],k,S=function(){return k===void 0&&(k=n(w,x)),k};if(x===0){var C=t*(w.coordinate-t*S()/2-c);o[x]=w=Fd(Fd({},w),{},{tickCoord:C<0?w.coordinate-C*t:w.coordinate})}else o[x]=w=Fd(Fd({},w),{},{tickCoord:w.coordinate});var j=mX(t,w.tickCoord,S,c,d);j&&(c=w.tickCoord+t*(S()/2+s),o[x]=Fd(Fd({},w),{},{isShow:!0}))},v=0;v<p;v++)g(v);return o}function V5e(t,e,n){var r=t.tick,s=t.ticks,i=t.viewBox,o=t.minTickGap,l=t.orientation,c=t.interval,d=t.tickFormatter,u=t.unit,h=t.angle;if(!s||!s.length||!r)return[];if(ln(c)||Lf.isSsr)return NJr(s,typeof c=="number"&&ln(c)?c:0);var m=[],f=l==="top"||l==="bottom"?"width":"height",p=u&&f==="width"?L$(u,{fontSize:e,letterSpacing:n}):{width:0,height:0},g=function(w,k){var S=Wr(d)?d(w.value,k):w.value;return f==="width"?jJr(L$(S,{fontSize:e,letterSpacing:n}),p,h):L$(S,{fontSize:e,letterSpacing:n})[f]},v=s.length>=2?_u(s[1].coordinate-s[0].coordinate):1,b=EJr(i,v,f);return c==="equidistantPreserveStart"?TJr(v,b,g,s,o):(c==="preserveStart"||c==="preserveStartEnd"?m=IJr(v,b,g,s,o,c==="preserveStartEnd"):m=RJr(v,b,g,s,o),m.filter(function(x){return x.isShow}))}var MJr=["viewBox"],LJr=["viewBox"],DJr=["ticks"];function R5(t){"@babel/helpers - typeof";return R5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},R5(t)}function kA(){return kA=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},kA.apply(this,arguments)}function RQe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function ic(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?RQe(Object(n),!0).forEach(function(r){H5e(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):RQe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function ahe(t,e){if(t==null)return{};var n=$Jr(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function $Jr(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function OJr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function IQe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r3t(r.key),r)}}function FJr(t,e,n){return e&&IQe(t.prototype,e),n&&IQe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function BJr(t,e,n){return e=fX(e),UJr(t,n3t()?Reflect.construct(e,n||[],fX(t).constructor):e.apply(t,n))}function UJr(t,e){if(e&&(R5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return zJr(t)}function zJr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function n3t(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(n3t=function(){return!!t})()}function fX(t){return fX=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},fX(t)}function VJr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&x1e(t,e)}function x1e(t,e){return x1e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},x1e(t,e)}function H5e(t,e,n){return e=r3t(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function r3t(t){var e=HJr(t,"string");return R5(e)=="symbol"?e:e+""}function HJr(t,e){if(R5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(R5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var eL=function(t){function e(n){var r;return OJr(this,e),r=BJr(this,e,[n]),r.state={fontSize:"",letterSpacing:""},r}return VJr(e,t),FJr(e,[{key:"shouldComponentUpdate",value:function(r,s){var i=r.viewBox,o=ahe(r,MJr),l=this.props,c=l.viewBox,d=ahe(l,LJr);return!mP(i,c)||!mP(o,d)||!mP(s,this.state)}},{key:"componentDidMount",value:function(){var r=this.layerReference;if(r){var s=r.getElementsByClassName("recharts-cartesian-axis-tick-value")[0];s&&this.setState({fontSize:window.getComputedStyle(s).fontSize,letterSpacing:window.getComputedStyle(s).letterSpacing})}}},{key:"getTickLineCoord",value:function(r){var s=this.props,i=s.x,o=s.y,l=s.width,c=s.height,d=s.orientation,u=s.tickSize,h=s.mirror,m=s.tickMargin,f,p,g,v,b,x,w=h?-1:1,k=r.tickSize||u,S=ln(r.tickCoord)?r.tickCoord:r.coordinate;switch(d){case"top":f=p=r.coordinate,v=o+ +!h*c,g=v-w*k,x=g-w*m,b=S;break;case"left":g=v=r.coordinate,p=i+ +!h*l,f=p-w*k,b=f-w*m,x=S;break;case"right":g=v=r.coordinate,p=i+ +h*l,f=p+w*k,b=f+w*m,x=S;break;default:f=p=r.coordinate,v=o+ +h*c,g=v+w*k,x=g+w*m,b=S;break}return{line:{x1:f,y1:g,x2:p,y2:v},tick:{x:b,y:x}}}},{key:"getTickTextAnchor",value:function(){var r=this.props,s=r.orientation,i=r.mirror,o;switch(s){case"left":o=i?"start":"end";break;case"right":o=i?"end":"start";break;default:o="middle";break}return o}},{key:"getTickVerticalAnchor",value:function(){var r=this.props,s=r.orientation,i=r.mirror,o="end";switch(s){case"left":case"right":o="middle";break;case"top":o=i?"start":"end";break;default:o=i?"end":"start";break}return o}},{key:"renderAxisLine",value:function(){var r=this.props,s=r.x,i=r.y,o=r.width,l=r.height,c=r.orientation,d=r.mirror,u=r.axisLine,h=ic(ic(ic({},hr(this.props,!1)),hr(u,!1)),{},{fill:"none"});if(c==="top"||c==="bottom"){var m=+(c==="top"&&!d||c==="bottom"&&d);h=ic(ic({},h),{},{x1:s,y1:i+m*l,x2:s+o,y2:i+m*l})}else{var f=+(c==="left"&&!d||c==="right"&&d);h=ic(ic({},h),{},{x1:s+f*o,y1:i,x2:s+f*o,y2:i+l})}return se.createElement("line",kA({},h,{className:Zn("recharts-cartesian-axis-line",Cm(u,"className"))}))}},{key:"renderTicks",value:function(r,s,i){var o=this,l=this.props,c=l.tickLine,d=l.stroke,u=l.tick,h=l.tickFormatter,m=l.unit,f=V5e(ic(ic({},this.props),{},{ticks:r}),s,i),p=this.getTickTextAnchor(),g=this.getTickVerticalAnchor(),v=hr(this.props,!1),b=hr(u,!1),x=ic(ic({},v),{},{fill:"none"},hr(c,!1)),w=f.map(function(k,S){var C=o.getTickLineCoord(k),j=C.line,E=C.tick,N=ic(ic(ic(ic({textAnchor:p,verticalAnchor:g},v),{},{stroke:"none",fill:d},b),E),{},{index:S,payload:k,visibleTicksCount:f.length,tickFormatter:h});return se.createElement(Cs,kA({className:"recharts-cartesian-axis-tick",key:"tick-".concat(k.value,"-").concat(k.coordinate,"-").concat(k.tickCoord)},Qk(o.props,k,S)),c&&se.createElement("line",kA({},x,j,{className:Zn("recharts-cartesian-axis-tick-line",Cm(c,"className"))})),u&&e.renderTickItem(u,N,"".concat(Wr(h)?h(k.value,S):k.value).concat(m||"")))});return se.createElement("g",{className:"recharts-cartesian-axis-ticks"},w)}},{key:"render",value:function(){var r=this,s=this.props,i=s.axisLine,o=s.width,l=s.height,c=s.ticksGenerator,d=s.className,u=s.hide;if(u)return null;var h=this.props,m=h.ticks,f=ahe(h,DJr),p=m;return Wr(c)&&(p=m&&m.length>0?c(this.props):c(f)),o<=0||l<=0||!p||!p.length?null:se.createElement(Cs,{className:Zn("recharts-cartesian-axis",d),ref:function(v){r.layerReference=v}},i&&this.renderAxisLine(),this.renderTicks(p,this.state.fontSize,this.state.letterSpacing),Lc.renderCallByParent(this.props))}}],[{key:"renderTickItem",value:function(r,s,i){var o,l=Zn(s.className,"recharts-cartesian-axis-tick-value");return se.isValidElement(r)?o=se.cloneElement(r,ic(ic({},s),{},{className:l})):Wr(r)?o=r(ic(ic({},s),{},{className:l})):o=se.createElement(oE,kA({},s,{className:"recharts-cartesian-axis-tick-value"}),i),o}}])}(y.Component);H5e(eL,"displayName","CartesianAxis");H5e(eL,"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 GJr=["x1","y1","x2","y2","key"],WJr=["offset"];function uE(t){"@babel/helpers - typeof";return uE=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},uE(t)}function MQe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Vd(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?MQe(Object(n),!0).forEach(function(r){qJr(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):MQe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function qJr(t,e,n){return e=KJr(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function KJr(t){var e=YJr(t,"string");return uE(e)=="symbol"?e:e+""}function YJr(t,e){if(uE(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(uE(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Pj(){return Pj=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Pj.apply(this,arguments)}function LQe(t,e){if(t==null)return{};var n=QJr(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function QJr(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}var ZJr=function(e){var n=e.fill;if(!n||n==="none")return null;var r=e.fillOpacity,s=e.x,i=e.y,o=e.width,l=e.height,c=e.ry;return se.createElement("rect",{x:s,y:i,ry:c,width:o,height:l,stroke:"none",fill:n,fillOpacity:r,className:"recharts-cartesian-grid-bg"})};function s3t(t,e){var n;if(se.isValidElement(t))n=se.cloneElement(t,e);else if(Wr(t))n=t(e);else{var r=e.x1,s=e.y1,i=e.x2,o=e.y2,l=e.key,c=LQe(e,GJr),d=hr(c,!1);d.offset;var u=LQe(d,WJr);n=se.createElement("line",Pj({},u,{x1:r,y1:s,x2:i,y2:o,fill:"none",key:l}))}return n}function JJr(t){var e=t.x,n=t.width,r=t.horizontal,s=r===void 0?!0:r,i=t.horizontalPoints;if(!s||!i||!i.length)return null;var o=i.map(function(l,c){var d=Vd(Vd({},t),{},{x1:e,y1:l,x2:e+n,y2:l,key:"line-".concat(c),index:c});return s3t(s,d)});return se.createElement("g",{className:"recharts-cartesian-grid-horizontal"},o)}function XJr(t){var e=t.y,n=t.height,r=t.vertical,s=r===void 0?!0:r,i=t.verticalPoints;if(!s||!i||!i.length)return null;var o=i.map(function(l,c){var d=Vd(Vd({},t),{},{x1:l,y1:e,x2:l,y2:e+n,key:"line-".concat(c),index:c});return s3t(s,d)});return se.createElement("g",{className:"recharts-cartesian-grid-vertical"},o)}function eXr(t){var e=t.horizontalFill,n=t.fillOpacity,r=t.x,s=t.y,i=t.width,o=t.height,l=t.horizontalPoints,c=t.horizontal,d=c===void 0?!0:c;if(!d||!e||!e.length)return null;var u=l.map(function(m){return Math.round(m+s-s)}).sort(function(m,f){return m-f});s!==u[0]&&u.unshift(0);var h=u.map(function(m,f){var p=!u[f+1],g=p?s+o-m:u[f+1]-m;if(g<=0)return null;var v=f%e.length;return se.createElement("rect",{key:"react-".concat(f),y:m,x:r,height:g,width:i,stroke:"none",fill:e[v],fillOpacity:n,className:"recharts-cartesian-grid-bg"})});return se.createElement("g",{className:"recharts-cartesian-gridstripes-horizontal"},h)}function tXr(t){var e=t.vertical,n=e===void 0?!0:e,r=t.verticalFill,s=t.fillOpacity,i=t.x,o=t.y,l=t.width,c=t.height,d=t.verticalPoints;if(!n||!r||!r.length)return null;var u=d.map(function(m){return Math.round(m+i-i)}).sort(function(m,f){return m-f});i!==u[0]&&u.unshift(0);var h=u.map(function(m,f){var p=!u[f+1],g=p?i+l-m:u[f+1]-m;if(g<=0)return null;var v=f%r.length;return se.createElement("rect",{key:"react-".concat(f),x:m,y:o,width:g,height:c,stroke:"none",fill:r[v],fillOpacity:s,className:"recharts-cartesian-grid-bg"})});return se.createElement("g",{className:"recharts-cartesian-gridstripes-vertical"},h)}var nXr=function(e,n){var r=e.xAxis,s=e.width,i=e.height,o=e.offset;return oLt(V5e(Vd(Vd(Vd({},eL.defaultProps),r),{},{ticks:gx(r,!0),viewBox:{x:0,y:0,width:s,height:i}})),o.left,o.left+o.width,n)},rXr=function(e,n){var r=e.yAxis,s=e.width,i=e.height,o=e.offset;return oLt(V5e(Vd(Vd(Vd({},eL.defaultProps),r),{},{ticks:gx(r,!0),viewBox:{x:0,y:0,width:s,height:i}})),o.top,o.top+o.height,n)},DT={horizontal:!0,vertical:!0,horizontalPoints:[],verticalPoints:[],stroke:"#ccc",fill:"none",verticalFill:[],horizontalFill:[]};function tL(t){var e,n,r,s,i,o,l=F5e(),c=B5e(),d=HZr(),u=Vd(Vd({},t),{},{stroke:(e=t.stroke)!==null&&e!==void 0?e:DT.stroke,fill:(n=t.fill)!==null&&n!==void 0?n:DT.fill,horizontal:(r=t.horizontal)!==null&&r!==void 0?r:DT.horizontal,horizontalFill:(s=t.horizontalFill)!==null&&s!==void 0?s:DT.horizontalFill,vertical:(i=t.vertical)!==null&&i!==void 0?i:DT.vertical,verticalFill:(o=t.verticalFill)!==null&&o!==void 0?o:DT.verticalFill,x:ln(t.x)?t.x:d.left,y:ln(t.y)?t.y:d.top,width:ln(t.width)?t.width:d.width,height:ln(t.height)?t.height:d.height}),h=u.x,m=u.y,f=u.width,p=u.height,g=u.syncWithTicks,v=u.horizontalValues,b=u.verticalValues,x=UZr(),w=zZr();if(!ln(f)||f<=0||!ln(p)||p<=0||!ln(h)||h!==+h||!ln(m)||m!==+m)return null;var k=u.verticalCoordinatesGenerator||nXr,S=u.horizontalCoordinatesGenerator||rXr,C=u.horizontalPoints,j=u.verticalPoints;if((!C||!C.length)&&Wr(S)){var E=v&&v.length,N=S({yAxis:w?Vd(Vd({},w),{},{ticks:E?v:w.ticks}):void 0,width:l,height:c,offset:d},E?!0:g);Eg(Array.isArray(N),"horizontalCoordinatesGenerator should return Array but instead it returned [".concat(uE(N),"]")),Array.isArray(N)&&(C=N)}if((!j||!j.length)&&Wr(k)){var A=b&&b.length,_=k({xAxis:x?Vd(Vd({},x),{},{ticks:A?b:x.ticks}):void 0,width:l,height:c,offset:d},A?!0:g);Eg(Array.isArray(_),"verticalCoordinatesGenerator should return Array but instead it returned [".concat(uE(_),"]")),Array.isArray(_)&&(j=_)}return se.createElement("g",{className:"recharts-cartesian-grid"},se.createElement(ZJr,{fill:u.fill,fillOpacity:u.fillOpacity,x:u.x,y:u.y,width:u.width,height:u.height,ry:u.ry}),se.createElement(JJr,Pj({},u,{offset:d,horizontalPoints:C,xAxis:x,yAxis:w})),se.createElement(XJr,Pj({},u,{offset:d,verticalPoints:j,xAxis:x,yAxis:w})),se.createElement(eXr,Pj({},u,{horizontalPoints:C})),se.createElement(tXr,Pj({},u,{verticalPoints:j})))}tL.displayName="CartesianGrid";var sXr=["type","layout","connectNulls","ref"],iXr=["key"];function I5(t){"@babel/helpers - typeof";return I5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},I5(t)}function DQe(t,e){if(t==null)return{};var n=aXr(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function aXr(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function U$(){return U$=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},U$.apply(this,arguments)}function $Qe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Gh(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?$Qe(Object(n),!0).forEach(function(r){Zp(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):$Qe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function $T(t){return dXr(t)||cXr(t)||lXr(t)||oXr()}function oXr(){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 lXr(t,e){if(t){if(typeof t=="string")return w1e(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return w1e(t,e)}}function cXr(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function dXr(t){if(Array.isArray(t))return w1e(t)}function w1e(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function uXr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function OQe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,a3t(r.key),r)}}function hXr(t,e,n){return e&&OQe(t.prototype,e),n&&OQe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function mXr(t,e,n){return e=pX(e),fXr(t,i3t()?Reflect.construct(e,n||[],pX(t).constructor):e.apply(t,n))}function fXr(t,e){if(e&&(I5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return pXr(t)}function pXr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function i3t(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(i3t=function(){return!!t})()}function pX(t){return pX=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},pX(t)}function gXr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&k1e(t,e)}function k1e(t,e){return k1e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},k1e(t,e)}function Zp(t,e,n){return e=a3t(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function a3t(t){var e=vXr(t,"string");return I5(e)=="symbol"?e:e+""}function vXr(t,e){if(I5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(I5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Tg=function(t){function e(){var n;uXr(this,e);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=mXr(this,e,[].concat(s)),Zp(n,"state",{isAnimationFinished:!0,totalLength:0}),Zp(n,"generateSimpleStrokeDasharray",function(o,l){return"".concat(l,"px ").concat(o-l,"px")}),Zp(n,"getStrokeDasharray",function(o,l,c){var d=c.reduce(function(b,x){return b+x});if(!d)return n.generateSimpleStrokeDasharray(l,o);for(var u=Math.floor(o/d),h=o%d,m=l-o,f=[],p=0,g=0;p<c.length;g+=c[p],++p)if(g+c[p]>h){f=[].concat($T(c.slice(0,p)),[h-g]);break}var v=f.length%2===0?[0,m]:[m];return[].concat($T(e.repeat(c,u)),$T(f),v).map(function(b){return"".concat(b,"px")}).join(", ")}),Zp(n,"id",MS("recharts-line-")),Zp(n,"pathRef",function(o){n.mainCurve=o}),Zp(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0}),n.props.onAnimationEnd&&n.props.onAnimationEnd()}),Zp(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1}),n.props.onAnimationStart&&n.props.onAnimationStart()}),n}return gXr(e,t),hXr(e,[{key:"componentDidMount",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();this.setState({totalLength:r})}}},{key:"componentDidUpdate",value:function(){if(this.props.isAnimationActive){var r=this.getTotalLength();r!==this.state.totalLength&&this.setState({totalLength:r})}}},{key:"getTotalLength",value:function(){var r=this.mainCurve;try{return r&&r.getTotalLength&&r.getTotalLength()||0}catch{return 0}}},{key:"renderErrorBar",value:function(r,s){if(this.props.isAnimationActive&&!this.state.isAnimationFinished)return null;var i=this.props,o=i.points,l=i.xAxis,c=i.yAxis,d=i.layout,u=i.children,h=Lu(u,XM);if(!h)return null;var m=function(g,v){return{x:g.x,y:g.y,value:g.value,errorVal:eo(g.payload,v)}},f={clipPath:r?"url(#clipPath-".concat(s,")"):null};return se.createElement(Cs,f,h.map(function(p){return se.cloneElement(p,{key:"bar-".concat(p.props.dataKey),data:o,xAxis:l,yAxis:c,layout:d,dataPointFormatter:m})}))}},{key:"renderDots",value:function(r,s,i){var o=this.props.isAnimationActive;if(o&&!this.state.isAnimationFinished)return null;var l=this.props,c=l.dot,d=l.points,u=l.dataKey,h=hr(this.props,!1),m=hr(c,!0),f=d.map(function(g,v){var b=Gh(Gh(Gh({key:"dot-".concat(v),r:3},h),m),{},{index:v,cx:g.x,cy:g.y,value:g.value,dataKey:u,payload:g.payload,points:d});return e.renderDotItem(c,b)}),p={clipPath:r?"url(#clipPath-".concat(s?"":"dots-").concat(i,")"):null};return se.createElement(Cs,U$({className:"recharts-line-dots",key:"dots"},p),f)}},{key:"renderCurveStatically",value:function(r,s,i,o){var l=this.props,c=l.type,d=l.layout,u=l.connectNulls;l.ref;var h=DQe(l,sXr),m=Gh(Gh(Gh({},hr(h,!0)),{},{fill:"none",className:"recharts-line-curve",clipPath:s?"url(#clipPath-".concat(i,")"):null,points:r},o),{},{type:c,layout:d,connectNulls:u});return se.createElement(mk,U$({},m,{pathRef:this.pathRef}))}},{key:"renderCurveWithAnimation",value:function(r,s){var i=this,o=this.props,l=o.points,c=o.strokeDasharray,d=o.isAnimationActive,u=o.animationBegin,h=o.animationDuration,m=o.animationEasing,f=o.animationId,p=o.animateNewValues,g=o.width,v=o.height,b=this.state,x=b.prevPoints,w=b.totalLength;return se.createElement(Qf,{begin:u,duration:h,isActive:d,easing:m,from:{t:0},to:{t:1},key:"line-".concat(f),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(k){var S=k.t;if(x){var C=x.length/l.length,j=l.map(function(T,R){var O=Math.floor(R*C);if(x[O]){var F=x[O],D=Mo(F.x,T.x),I=Mo(F.y,T.y);return Gh(Gh({},T),{},{x:D(S),y:I(S)})}if(p){var P=Mo(g*2,T.x),M=Mo(v/2,T.y);return Gh(Gh({},T),{},{x:P(S),y:M(S)})}return Gh(Gh({},T),{},{x:T.x,y:T.y})});return i.renderCurveStatically(j,r,s)}var E=Mo(0,w),N=E(S),A;if(c){var _="".concat(c).split(/[,\s]+/gim).map(function(T){return parseFloat(T)});A=i.getStrokeDasharray(N,w,_)}else A=i.generateSimpleStrokeDasharray(w,N);return i.renderCurveStatically(l,r,s,{strokeDasharray:A})})}},{key:"renderCurve",value:function(r,s){var i=this.props,o=i.points,l=i.isAnimationActive,c=this.state,d=c.prevPoints,u=c.totalLength;return l&&o&&o.length&&(!d&&u>0||!m0(d,o))?this.renderCurveWithAnimation(r,s):this.renderCurveStatically(o,r,s)}},{key:"render",value:function(){var r,s=this.props,i=s.hide,o=s.dot,l=s.points,c=s.className,d=s.xAxis,u=s.yAxis,h=s.top,m=s.left,f=s.width,p=s.height,g=s.isAnimationActive,v=s.id;if(i||!l||!l.length)return null;var b=this.state.isAnimationFinished,x=l.length===1,w=Zn("recharts-line",c),k=d&&d.allowDataOverflow,S=u&&u.allowDataOverflow,C=k||S,j=$r(v)?this.id:v,E=(r=hr(o,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},N=E.r,A=N===void 0?3:N,_=E.strokeWidth,T=_===void 0?2:_,R=bIt(o)?o:{},O=R.clipDot,F=O===void 0?!0:O,D=A*2+T;return se.createElement(Cs,{className:w},k||S?se.createElement("defs",null,se.createElement("clipPath",{id:"clipPath-".concat(j)},se.createElement("rect",{x:k?m:m-f/2,y:S?h:h-p/2,width:k?f:f*2,height:S?p:p*2})),!F&&se.createElement("clipPath",{id:"clipPath-dots-".concat(j)},se.createElement("rect",{x:m-D/2,y:h-D/2,width:f+D,height:p+D}))):null,!x&&this.renderCurve(C,j),this.renderErrorBar(C,j),(x||o)&&this.renderDots(C,F,j),(!g||b)&&Ng.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:s.curPoints}:r.points!==s.curPoints?{curPoints:r.points}:null}},{key:"repeat",value:function(r,s){for(var i=r.length%2!==0?[].concat($T(r),[0]):r,o=[],l=0;l<s;++l)o=[].concat($T(o),$T(i));return o}},{key:"renderDotItem",value:function(r,s){var i;if(se.isValidElement(r))i=se.cloneElement(r,s);else if(Wr(r))i=r(s);else{var o=s.key,l=DQe(s,iXr),c=Zn("recharts-line-dot",typeof r!="boolean"?r.className:"");i=se.createElement(_9,U$({key:o},l,{className:c}))}return i}}])}(y.PureComponent);Zp(Tg,"displayName","Line");Zp(Tg,"defaultProps",{xAxisId:0,yAxisId:0,connectNulls:!1,activeDot:!0,dot:!0,legendType:"line",stroke:"#3182bd",strokeWidth:1,fill:"#fff",points:[],isAnimationActive:!Lf.isSsr,animateNewValues:!0,animationBegin:0,animationDuration:1500,animationEasing:"ease",hide:!1,label:!1});Zp(Tg,"getComposedData",function(t){var e=t.props,n=t.xAxis,r=t.yAxis,s=t.xAxisTicks,i=t.yAxisTicks,o=t.dataKey,l=t.bandSize,c=t.displayedData,d=t.offset,u=e.layout,h=c.map(function(m,f){var p=eo(m,o);return u==="horizontal"?{x:w5({axis:n,ticks:s,bandSize:l,entry:m,index:f}),y:$r(p)?null:r.scale(p),value:p,payload:m}:{x:$r(p)?null:n.scale(p),y:w5({axis:r,ticks:i,bandSize:l,entry:m,index:f}),value:p,payload:m}});return Gh({points:h,layout:u},d)});var yXr=["layout","type","stroke","connectNulls","isRange","ref"],bXr=["key"],o3t;function M5(t){"@babel/helpers - typeof";return M5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},M5(t)}function l3t(t,e){if(t==null)return{};var n=xXr(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function xXr(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Rj(){return Rj=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},Rj.apply(this,arguments)}function FQe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function Bw(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?FQe(Object(n),!0).forEach(function(r){oy(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):FQe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function wXr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function BQe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,d3t(r.key),r)}}function kXr(t,e,n){return e&&BQe(t.prototype,e),n&&BQe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function SXr(t,e,n){return e=gX(e),CXr(t,c3t()?Reflect.construct(e,n||[],gX(t).constructor):e.apply(t,n))}function CXr(t,e){if(e&&(M5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return jXr(t)}function jXr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function c3t(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(c3t=function(){return!!t})()}function gX(t){return gX=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},gX(t)}function EXr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&S1e(t,e)}function S1e(t,e){return S1e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},S1e(t,e)}function oy(t,e,n){return e=d3t(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function d3t(t){var e=NXr(t,"string");return M5(e)=="symbol"?e:e+""}function NXr(t,e){if(M5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(M5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var OS=function(t){function e(){var n;wXr(this,e);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=SXr(this,e,[].concat(s)),oy(n,"state",{isAnimationFinished:!0}),oy(n,"id",MS("recharts-area-")),oy(n,"handleAnimationEnd",function(){var o=n.props.onAnimationEnd;n.setState({isAnimationFinished:!0}),Wr(o)&&o()}),oy(n,"handleAnimationStart",function(){var o=n.props.onAnimationStart;n.setState({isAnimationFinished:!1}),Wr(o)&&o()}),n}return EXr(e,t),kXr(e,[{key:"renderDots",value:function(r,s,i){var o=this.props.isAnimationActive,l=this.state.isAnimationFinished;if(o&&!l)return null;var c=this.props,d=c.dot,u=c.points,h=c.dataKey,m=hr(this.props,!1),f=hr(d,!0),p=u.map(function(v,b){var x=Bw(Bw(Bw({key:"dot-".concat(b),r:3},m),f),{},{index:b,cx:v.x,cy:v.y,dataKey:h,value:v.value,payload:v.payload,points:u});return e.renderDotItem(d,x)}),g={clipPath:r?"url(#clipPath-".concat(s?"":"dots-").concat(i,")"):null};return se.createElement(Cs,Rj({className:"recharts-area-dots"},g),p)}},{key:"renderHorizontalRect",value:function(r){var s=this.props,i=s.baseLine,o=s.points,l=s.strokeWidth,c=o[0].x,d=o[o.length-1].x,u=r*Math.abs(c-d),h=D1(o.map(function(m){return m.y||0}));return ln(i)&&typeof i=="number"?h=Math.max(i,h):i&&Array.isArray(i)&&i.length&&(h=Math.max(D1(i.map(function(m){return m.y||0})),h)),ln(h)?se.createElement("rect",{x:c<d?c:c-u,y:0,width:u,height:Math.floor(h+(l?parseInt("".concat(l),10):1))}):null}},{key:"renderVerticalRect",value:function(r){var s=this.props,i=s.baseLine,o=s.points,l=s.strokeWidth,c=o[0].y,d=o[o.length-1].y,u=r*Math.abs(c-d),h=D1(o.map(function(m){return m.x||0}));return ln(i)&&typeof i=="number"?h=Math.max(i,h):i&&Array.isArray(i)&&i.length&&(h=Math.max(D1(i.map(function(m){return m.x||0})),h)),ln(h)?se.createElement("rect",{x:0,y:c<d?c:c-u,width:h+(l?parseInt("".concat(l),10):1),height:Math.floor(u)}):null}},{key:"renderClipRect",value:function(r){var s=this.props.layout;return s==="vertical"?this.renderVerticalRect(r):this.renderHorizontalRect(r)}},{key:"renderAreaStatically",value:function(r,s,i,o){var l=this.props,c=l.layout,d=l.type,u=l.stroke,h=l.connectNulls,m=l.isRange;l.ref;var f=l3t(l,yXr);return se.createElement(Cs,{clipPath:i?"url(#clipPath-".concat(o,")"):null},se.createElement(mk,Rj({},hr(f,!0),{points:r,connectNulls:h,type:d,baseLine:s,layout:c,stroke:"none",className:"recharts-area-area"})),u!=="none"&&se.createElement(mk,Rj({},hr(this.props,!1),{className:"recharts-area-curve",layout:c,type:d,connectNulls:h,fill:"none",points:r})),u!=="none"&&m&&se.createElement(mk,Rj({},hr(this.props,!1),{className:"recharts-area-curve",layout:c,type:d,connectNulls:h,fill:"none",points:s})))}},{key:"renderAreaWithAnimation",value:function(r,s){var i=this,o=this.props,l=o.points,c=o.baseLine,d=o.isAnimationActive,u=o.animationBegin,h=o.animationDuration,m=o.animationEasing,f=o.animationId,p=this.state,g=p.prevPoints,v=p.prevBaseLine;return se.createElement(Qf,{begin:u,duration:h,isActive:d,easing:m,from:{t:0},to:{t:1},key:"area-".concat(f),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(b){var x=b.t;if(g){var w=g.length/l.length,k=l.map(function(E,N){var A=Math.floor(N*w);if(g[A]){var _=g[A],T=Mo(_.x,E.x),R=Mo(_.y,E.y);return Bw(Bw({},E),{},{x:T(x),y:R(x)})}return E}),S;if(ln(c)&&typeof c=="number"){var C=Mo(v,c);S=C(x)}else if($r(c)||YM(c)){var j=Mo(v,0);S=j(x)}else S=c.map(function(E,N){var A=Math.floor(N*w);if(v[A]){var _=v[A],T=Mo(_.x,E.x),R=Mo(_.y,E.y);return Bw(Bw({},E),{},{x:T(x),y:R(x)})}return E});return i.renderAreaStatically(k,S,r,s)}return se.createElement(Cs,null,se.createElement("defs",null,se.createElement("clipPath",{id:"animationClipPath-".concat(s)},i.renderClipRect(x))),se.createElement(Cs,{clipPath:"url(#animationClipPath-".concat(s,")")},i.renderAreaStatically(l,c,r,s)))})}},{key:"renderArea",value:function(r,s){var i=this.props,o=i.points,l=i.baseLine,c=i.isAnimationActive,d=this.state,u=d.prevPoints,h=d.prevBaseLine,m=d.totalLength;return c&&o&&o.length&&(!u&&m>0||!m0(u,o)||!m0(h,l))?this.renderAreaWithAnimation(r,s):this.renderAreaStatically(o,l,r,s)}},{key:"render",value:function(){var r,s=this.props,i=s.hide,o=s.dot,l=s.points,c=s.className,d=s.top,u=s.left,h=s.xAxis,m=s.yAxis,f=s.width,p=s.height,g=s.isAnimationActive,v=s.id;if(i||!l||!l.length)return null;var b=this.state.isAnimationFinished,x=l.length===1,w=Zn("recharts-area",c),k=h&&h.allowDataOverflow,S=m&&m.allowDataOverflow,C=k||S,j=$r(v)?this.id:v,E=(r=hr(o,!1))!==null&&r!==void 0?r:{r:3,strokeWidth:2},N=E.r,A=N===void 0?3:N,_=E.strokeWidth,T=_===void 0?2:_,R=bIt(o)?o:{},O=R.clipDot,F=O===void 0?!0:O,D=A*2+T;return se.createElement(Cs,{className:w},k||S?se.createElement("defs",null,se.createElement("clipPath",{id:"clipPath-".concat(j)},se.createElement("rect",{x:k?u:u-f/2,y:S?d:d-p/2,width:k?f:f*2,height:S?p:p*2})),!F&&se.createElement("clipPath",{id:"clipPath-dots-".concat(j)},se.createElement("rect",{x:u-D/2,y:d-D/2,width:f+D,height:p+D}))):null,x?null:this.renderArea(C,j),(o||x)&&this.renderDots(C,F,j),(!g||b)&&Ng.renderCallByParent(this.props,l))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,curBaseLine:r.baseLine,prevPoints:s.curPoints,prevBaseLine:s.curBaseLine}:r.points!==s.curPoints||r.baseLine!==s.curBaseLine?{curPoints:r.points,curBaseLine:r.baseLine}:null}}])}(y.PureComponent);o3t=OS;oy(OS,"displayName","Area");oy(OS,"defaultProps",{stroke:"#3182bd",fill:"#3182bd",fillOpacity:.6,xAxisId:0,yAxisId:0,legendType:"line",connectNulls:!1,points:[],dot:!1,activeDot:!0,hide:!1,isAnimationActive:!Lf.isSsr,animationBegin:0,animationDuration:1500,animationEasing:"ease"});oy(OS,"getBaseValue",function(t,e,n,r){var s=t.layout,i=t.baseValue,o=e.props.baseValue,l=o??i;if(ln(l)&&typeof l=="number")return l;var c=s==="horizontal"?r:n,d=c.scale.domain();if(c.type==="number"){var u=Math.max(d[0],d[1]),h=Math.min(d[0],d[1]);return l==="dataMin"?h:l==="dataMax"||u<0?u:Math.max(Math.min(d[0],d[1]),0)}return l==="dataMin"?d[0]:l==="dataMax"?d[1]:d[0]});oy(OS,"getComposedData",function(t){var e=t.props,n=t.item,r=t.xAxis,s=t.yAxis,i=t.xAxisTicks,o=t.yAxisTicks,l=t.bandSize,c=t.dataKey,d=t.stackedData,u=t.dataStartIndex,h=t.displayedData,m=t.offset,f=e.layout,p=d&&d.length,g=o3t.getBaseValue(e,n,r,s),v=f==="horizontal",b=!1,x=h.map(function(k,S){var C;p?C=d[u+S]:(C=eo(k,c),Array.isArray(C)?b=!0:C=[g,C]);var j=C[1]==null||p&&eo(k,c)==null;return v?{x:w5({axis:r,ticks:i,bandSize:l,entry:k,index:S}),y:j?null:s.scale(C[1]),value:C,payload:k}:{x:j?null:r.scale(C[1]),y:w5({axis:s,ticks:o,bandSize:l,entry:k,index:S}),value:C,payload:k}}),w;return p||b?w=x.map(function(k){var S=Array.isArray(k.value)?k.value[0]:null;return v?{x:k.x,y:S!=null&&k.y!=null?s.scale(S):null}:{x:S!=null?r.scale(S):null,y:k.y}}):w=v?s.scale(g):r.scale(g),Bw({points:x,baseLine:w,layout:f,isRange:b},m)});oy(OS,"renderDotItem",function(t,e){var n;if(se.isValidElement(t))n=se.cloneElement(t,e);else if(Wr(t))n=t(e);else{var r=Zn("recharts-area-dot",typeof t!="boolean"?t.className:""),s=e.key,i=l3t(e,bXr);n=se.createElement(_9,Rj({},i,{key:s,className:r}))}return n});function L5(t){"@babel/helpers - typeof";return L5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},L5(t)}function TXr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function _Xr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,m3t(r.key),r)}}function AXr(t,e,n){return e&&_Xr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function PXr(t,e,n){return e=vX(e),RXr(t,u3t()?Reflect.construct(e,n||[],vX(t).constructor):e.apply(t,n))}function RXr(t,e){if(e&&(L5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return IXr(t)}function IXr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u3t(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(u3t=function(){return!!t})()}function vX(t){return vX=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},vX(t)}function MXr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&C1e(t,e)}function C1e(t,e){return C1e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},C1e(t,e)}function h3t(t,e,n){return e=m3t(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function m3t(t){var e=LXr(t,"string");return L5(e)=="symbol"?e:e+""}function LXr(t,e){if(L5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(L5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Kie=function(t){function e(){return TXr(this,e),PXr(this,e,arguments)}return MXr(e,t),AXr(e,[{key:"render",value:function(){return null}}])}(y.Component);h3t(Kie,"displayName","ZAxis");h3t(Kie,"defaultProps",{zAxisId:0,range:[64,64],scale:"auto",type:"number"});var DXr=["option","isActive"];function z$(){return z$=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},z$.apply(this,arguments)}function $Xr(t,e){if(t==null)return{};var n=OXr(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function OXr(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function FXr(t){var e=t.option,n=t.isActive,r=$Xr(t,DXr);return typeof e=="string"?y.createElement(sX,z$({option:y.createElement(jie,z$({type:e},r)),isActive:n,shapeType:"symbols"},r)):y.createElement(sX,z$({option:e,isActive:n,shapeType:"symbols"},r))}function D5(t){"@babel/helpers - typeof";return D5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},D5(t)}function V$(){return V$=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},V$.apply(this,arguments)}function UQe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function tf(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?UQe(Object(n),!0).forEach(function(r){O1(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):UQe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function BXr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function zQe(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,p3t(r.key),r)}}function UXr(t,e,n){return e&&zQe(t.prototype,e),n&&zQe(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function zXr(t,e,n){return e=yX(e),VXr(t,f3t()?Reflect.construct(e,n||[],yX(t).constructor):e.apply(t,n))}function VXr(t,e){if(e&&(D5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return HXr(t)}function HXr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function f3t(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(f3t=function(){return!!t})()}function yX(t){return yX=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},yX(t)}function GXr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&j1e(t,e)}function j1e(t,e){return j1e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},j1e(t,e)}function O1(t,e,n){return e=p3t(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function p3t(t){var e=WXr(t,"string");return D5(e)=="symbol"?e:e+""}function WXr(t,e){if(D5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(D5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Yie=function(t){function e(){var n;BXr(this,e);for(var r=arguments.length,s=new Array(r),i=0;i<r;i++)s[i]=arguments[i];return n=zXr(this,e,[].concat(s)),O1(n,"state",{isAnimationFinished:!1}),O1(n,"handleAnimationEnd",function(){n.setState({isAnimationFinished:!0})}),O1(n,"handleAnimationStart",function(){n.setState({isAnimationFinished:!1})}),O1(n,"id",MS("recharts-scatter-")),n}return GXr(e,t),UXr(e,[{key:"renderSymbolsStatically",value:function(r){var s=this,i=this.props,o=i.shape,l=i.activeShape,c=i.activeIndex,d=hr(this.props,!1);return r.map(function(u,h){var m=c===h,f=m?l:o,p=tf(tf({},d),u);return se.createElement(Cs,V$({className:"recharts-scatter-symbol",key:"symbol-".concat(u==null?void 0:u.cx,"-").concat(u==null?void 0:u.cy,"-").concat(u==null?void 0:u.size,"-").concat(h)},Qk(s.props,u,h),{role:"img"}),se.createElement(FXr,V$({option:f,isActive:m,key:"symbol-".concat(h)},p)))})}},{key:"renderSymbolsWithAnimation",value:function(){var r=this,s=this.props,i=s.points,o=s.isAnimationActive,l=s.animationBegin,c=s.animationDuration,d=s.animationEasing,u=s.animationId,h=this.state.prevPoints;return se.createElement(Qf,{begin:l,duration:c,isActive:o,easing:d,from:{t:0},to:{t:1},key:"pie-".concat(u),onAnimationEnd:this.handleAnimationEnd,onAnimationStart:this.handleAnimationStart},function(m){var f=m.t,p=i.map(function(g,v){var b=h&&h[v];if(b){var x=Mo(b.cx,g.cx),w=Mo(b.cy,g.cy),k=Mo(b.size,g.size);return tf(tf({},g),{},{cx:x(f),cy:w(f),size:k(f)})}var S=Mo(0,g.size);return tf(tf({},g),{},{size:S(f)})});return se.createElement(Cs,null,r.renderSymbolsStatically(p))})}},{key:"renderSymbols",value:function(){var r=this.props,s=r.points,i=r.isAnimationActive,o=this.state.prevPoints;return i&&s&&s.length&&(!o||!m0(o,s))?this.renderSymbolsWithAnimation():this.renderSymbolsStatically(s)}},{key:"renderErrorBar",value:function(){var r=this.props.isAnimationActive;if(r&&!this.state.isAnimationFinished)return null;var s=this.props,i=s.points,o=s.xAxis,l=s.yAxis,c=s.children,d=Lu(c,XM);return d?d.map(function(u,h){var m=u.props,f=m.direction,p=m.dataKey;return se.cloneElement(u,{key:"".concat(f,"-").concat(p,"-").concat(i[h]),data:i,xAxis:o,yAxis:l,layout:f==="x"?"vertical":"horizontal",dataPointFormatter:function(v,b){return{x:v.cx,y:v.cy,value:f==="x"?+v.node.x:+v.node.y,errorVal:eo(v,b)}}})}):null}},{key:"renderLine",value:function(){var r=this.props,s=r.points,i=r.line,o=r.lineType,l=r.lineJointType,c=hr(this.props,!1),d=hr(i,!1),u,h;if(o==="joint")u=s.map(function(w){return{x:w.cx,y:w.cy}});else if(o==="fitting"){var m=s8r(s),f=m.xmin,p=m.xmax,g=m.a,v=m.b,b=function(k){return g*k+v};u=[{x:f,y:b(f)},{x:p,y:b(p)}]}var x=tf(tf(tf({},c),{},{fill:"none",stroke:c&&c.fill},d),{},{points:u});return se.isValidElement(i)?h=se.cloneElement(i,x):Wr(i)?h=i(x):h=se.createElement(mk,V$({},x,{type:l})),se.createElement(Cs,{className:"recharts-scatter-line",key:"recharts-scatter-line"},h)}},{key:"render",value:function(){var r=this.props,s=r.hide,i=r.points,o=r.line,l=r.className,c=r.xAxis,d=r.yAxis,u=r.left,h=r.top,m=r.width,f=r.height,p=r.id,g=r.isAnimationActive;if(s||!i||!i.length)return null;var v=this.state.isAnimationFinished,b=Zn("recharts-scatter",l),x=c&&c.allowDataOverflow,w=d&&d.allowDataOverflow,k=x||w,S=$r(p)?this.id:p;return se.createElement(Cs,{className:b,clipPath:k?"url(#clipPath-".concat(S,")"):null},x||w?se.createElement("defs",null,se.createElement("clipPath",{id:"clipPath-".concat(S)},se.createElement("rect",{x:x?u:u-m/2,y:w?h:h-f/2,width:x?m:m*2,height:w?f:f*2}))):null,o&&this.renderLine(),this.renderErrorBar(),se.createElement(Cs,{key:"recharts-scatter-symbols"},this.renderSymbols()),(!g||v)&&Ng.renderCallByParent(this.props,i))}}],[{key:"getDerivedStateFromProps",value:function(r,s){return r.animationId!==s.prevAnimationId?{prevAnimationId:r.animationId,curPoints:r.points,prevPoints:s.curPoints}:r.points!==s.curPoints?{curPoints:r.points}:null}}])}(y.PureComponent);O1(Yie,"displayName","Scatter");O1(Yie,"defaultProps",{xAxisId:0,yAxisId:0,zAxisId:0,legendType:"circle",lineType:"joint",lineJointType:"linear",data:[],shape:"circle",hide:!1,isAnimationActive:!Lf.isSsr,animationBegin:0,animationDuration:400,animationEasing:"linear"});O1(Yie,"getComposedData",function(t){var e=t.xAxis,n=t.yAxis,r=t.zAxis,s=t.item,i=t.displayedData,o=t.xAxisTicks,l=t.yAxisTicks,c=t.offset,d=s.props.tooltipType,u=Lu(s.props.children,C9),h=$r(e.dataKey)?s.props.dataKey:e.dataKey,m=$r(n.dataKey)?s.props.dataKey:n.dataKey,f=r&&r.dataKey,p=r?r.range:Kie.defaultProps.range,g=p&&p[0],v=e.scale.bandwidth?e.scale.bandwidth():0,b=n.scale.bandwidth?n.scale.bandwidth():0,x=i.map(function(w,k){var S=eo(w,h),C=eo(w,m),j=!$r(f)&&eo(w,f)||"-",E=[{name:$r(e.dataKey)?s.props.name:e.name||e.dataKey,unit:e.unit||"",value:S,payload:w,dataKey:h,type:d},{name:$r(n.dataKey)?s.props.name:n.name||n.dataKey,unit:n.unit||"",value:C,payload:w,dataKey:m,type:d}];j!=="-"&&E.push({name:r.name||r.dataKey,unit:r.unit||"",value:j,payload:w,dataKey:f,type:d});var N=w5({axis:e,ticks:o,bandSize:v,entry:w,index:k,dataKey:h}),A=w5({axis:n,ticks:l,bandSize:b,entry:w,index:k,dataKey:m}),_=j!=="-"?r.scale(j):g,T=Math.sqrt(Math.max(_,0)/Math.PI);return tf(tf({},w),{},{cx:N,cy:A,x:N-T,y:A-T,xAxis:e,yAxis:n,zAxis:r,width:2*T,height:2*T,size:_,node:{x:S,y:C,z:j},tooltipPayload:E,tooltipPosition:{x:N,y:A},payload:w},u&&u[k]&&u[k].props)});return tf({points:x},c)});function $5(t){"@babel/helpers - typeof";return $5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},$5(t)}function qXr(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function KXr(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,y3t(r.key),r)}}function YXr(t,e,n){return e&&KXr(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function QXr(t,e,n){return e=bX(e),ZXr(t,g3t()?Reflect.construct(e,n||[],bX(t).constructor):e.apply(t,n))}function ZXr(t,e){if(e&&($5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return JXr(t)}function JXr(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function g3t(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(g3t=function(){return!!t})()}function bX(t){return bX=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},bX(t)}function XXr(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&E1e(t,e)}function E1e(t,e){return E1e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},E1e(t,e)}function v3t(t,e,n){return e=y3t(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function y3t(t){var e=ees(t,"string");return $5(e)=="symbol"?e:e+""}function ees(t,e){if($5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if($5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function N1e(){return N1e=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},N1e.apply(this,arguments)}function tes(t){var e=t.xAxisId,n=F5e(),r=B5e(),s=qLt(e);return s==null?null:y.createElement(eL,N1e({},s,{className:Zn("recharts-".concat(s.axisType," ").concat(s.axisType),s.className),viewBox:{x:0,y:0,width:n,height:r},ticksGenerator:function(o){return gx(o,!0)}}))}var rb=function(t){function e(){return qXr(this,e),QXr(this,e,arguments)}return XXr(e,t),YXr(e,[{key:"render",value:function(){return y.createElement(tes,this.props)}}])}(y.Component);v3t(rb,"displayName","XAxis");v3t(rb,"defaultProps",{allowDecimals:!0,hide:!1,orientation:"bottom",width:0,height:30,mirror:!1,xAxisId:0,tickCount:5,type:"category",padding:{left:0,right:0},allowDataOverflow:!1,scale:"auto",reversed:!1,allowDuplicatedCategory:!0});function O5(t){"@babel/helpers - typeof";return O5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},O5(t)}function nes(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function res(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,w3t(r.key),r)}}function ses(t,e,n){return e&&res(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function ies(t,e,n){return e=xX(e),aes(t,b3t()?Reflect.construct(e,n||[],xX(t).constructor):e.apply(t,n))}function aes(t,e){if(e&&(O5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return oes(t)}function oes(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function b3t(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(b3t=function(){return!!t})()}function xX(t){return xX=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},xX(t)}function les(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&T1e(t,e)}function T1e(t,e){return T1e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},T1e(t,e)}function x3t(t,e,n){return e=w3t(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function w3t(t){var e=ces(t,"string");return O5(e)=="symbol"?e:e+""}function ces(t,e){if(O5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(O5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function _1e(){return _1e=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},_1e.apply(this,arguments)}var des=function(e){var n=e.yAxisId,r=F5e(),s=B5e(),i=KLt(n);return i==null?null:y.createElement(eL,_1e({},i,{className:Zn("recharts-".concat(i.axisType," ").concat(i.axisType),i.className),viewBox:{x:0,y:0,width:r,height:s},ticksGenerator:function(l){return gx(l,!0)}}))},Ug=function(t){function e(){return nes(this,e),ies(this,e,arguments)}return les(e,t),ses(e,[{key:"render",value:function(){return y.createElement(des,this.props)}}])}(y.Component);x3t(Ug,"displayName","YAxis");x3t(Ug,"defaultProps",{allowDuplicatedCategory:!0,allowDecimals:!0,hide:!1,orientation:"left",width:60,height:0,mirror:!1,yAxisId:0,tickCount:5,type:"number",padding:{top:0,bottom:0},allowDataOverflow:!1,scale:"auto",reversed:!1});function VQe(t){return fes(t)||mes(t)||hes(t)||ues()}function ues(){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 hes(t,e){if(t){if(typeof t=="string")return A1e(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return A1e(t,e)}}function mes(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function fes(t){if(Array.isArray(t))return A1e(t)}function A1e(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}var P1e=function(e,n,r,s,i){var o=Lu(e,z5e),l=Lu(e,Gie),c=[].concat(VQe(o),VQe(l)),d=Lu(e,qie),u="".concat(s,"Id"),h=s[0],m=n;if(c.length&&(m=c.reduce(function(g,v){if(v.props[u]===r&&Cy(v.props,"extendDomain")&&ln(v.props[h])){var b=v.props[h];return[Math.min(g[0],b),Math.max(g[1],b)]}return g},m)),d.length){var f="".concat(h,"1"),p="".concat(h,"2");m=d.reduce(function(g,v){if(v.props[u]===r&&Cy(v.props,"extendDomain")&&ln(v.props[f])&&ln(v.props[p])){var b=v.props[f],x=v.props[p];return[Math.min(g[0],b,x),Math.max(g[1],b,x)]}return g},m)}return i&&i.length&&(m=i.reduce(function(g,v){return ln(v)?[Math.min(g[0],v),Math.max(g[1],v)]:g},m)),m},k3t={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,n="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(n=!1));function s(c,d,u){this.fn=c,this.context=d,this.once=u||!1}function i(c,d,u,h,m){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new s(u,h||c,m),p=n?n+d:d;return c._events[p]?c._events[p].fn?c._events[p]=[c._events[p],f]:c._events[p].push(f):(c._events[p]=f,c._eventsCount++),c}function o(c,d){--c._eventsCount===0?c._events=new r:delete c._events[d]}function l(){this._events=new r,this._eventsCount=0}l.prototype.eventNames=function(){var d=[],u,h;if(this._eventsCount===0)return d;for(h in u=this._events)e.call(u,h)&&d.push(n?h.slice(1):h);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(u)):d},l.prototype.listeners=function(d){var u=n?n+d:d,h=this._events[u];if(!h)return[];if(h.fn)return[h.fn];for(var m=0,f=h.length,p=new Array(f);m<f;m++)p[m]=h[m].fn;return p},l.prototype.listenerCount=function(d){var u=n?n+d:d,h=this._events[u];return h?h.fn?1:h.length:0},l.prototype.emit=function(d,u,h,m,f,p){var g=n?n+d:d;if(!this._events[g])return!1;var v=this._events[g],b=arguments.length,x,w;if(v.fn){switch(v.once&&this.removeListener(d,v.fn,void 0,!0),b){case 1:return v.fn.call(v.context),!0;case 2:return v.fn.call(v.context,u),!0;case 3:return v.fn.call(v.context,u,h),!0;case 4:return v.fn.call(v.context,u,h,m),!0;case 5:return v.fn.call(v.context,u,h,m,f),!0;case 6:return v.fn.call(v.context,u,h,m,f,p),!0}for(w=1,x=new Array(b-1);w<b;w++)x[w-1]=arguments[w];v.fn.apply(v.context,x)}else{var k=v.length,S;for(w=0;w<k;w++)switch(v[w].once&&this.removeListener(d,v[w].fn,void 0,!0),b){case 1:v[w].fn.call(v[w].context);break;case 2:v[w].fn.call(v[w].context,u);break;case 3:v[w].fn.call(v[w].context,u,h);break;case 4:v[w].fn.call(v[w].context,u,h,m);break;default:if(!x)for(S=1,x=new Array(b-1);S<b;S++)x[S-1]=arguments[S];v[w].fn.apply(v[w].context,x)}}return!0},l.prototype.on=function(d,u,h){return i(this,d,u,h,!1)},l.prototype.once=function(d,u,h){return i(this,d,u,h,!0)},l.prototype.removeListener=function(d,u,h,m){var f=n?n+d:d;if(!this._events[f])return this;if(!u)return o(this,f),this;var p=this._events[f];if(p.fn)p.fn===u&&(!m||p.once)&&(!h||p.context===h)&&o(this,f);else{for(var g=0,v=[],b=p.length;g<b;g++)(p[g].fn!==u||m&&!p[g].once||h&&p[g].context!==h)&&v.push(p[g]);v.length?this._events[f]=v.length===1?v[0]:v:o(this,f)}return this},l.prototype.removeAllListeners=function(d){var u;return d?(u=n?n+d:d,this._events[u]&&o(this,u)):(this._events=new r,this._eventsCount=0),this},l.prototype.off=l.prototype.removeListener,l.prototype.addListener=l.prototype.on,l.prefixed=n,l.EventEmitter=l,t.exports=l})(k3t);var pes=k3t.exports;const ges=Fs(pes);var ohe=new ges,lhe="recharts.syncMouseEvents";function a8(t){"@babel/helpers - typeof";return a8=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},a8(t)}function ves(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function yes(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,S3t(r.key),r)}}function bes(t,e,n){return e&&yes(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function che(t,e,n){return e=S3t(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function S3t(t){var e=xes(t,"string");return a8(e)=="symbol"?e:e+""}function xes(t,e){if(a8(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(a8(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var wes=function(){function t(){ves(this,t),che(this,"activeIndex",0),che(this,"coordinateList",[]),che(this,"layout","horizontal")}return bes(t,[{key:"setDetails",value:function(n){var r,s=n.coordinateList,i=s===void 0?null:s,o=n.container,l=o===void 0?null:o,c=n.layout,d=c===void 0?null:c,u=n.offset,h=u===void 0?null:u,m=n.mouseHandlerCallback,f=m===void 0?null:m;this.coordinateList=(r=i??this.coordinateList)!==null&&r!==void 0?r:[],this.container=l??this.container,this.layout=d??this.layout,this.offset=h??this.offset,this.mouseHandlerCallback=f??this.mouseHandlerCallback,this.activeIndex=Math.min(Math.max(this.activeIndex,0),this.coordinateList.length-1)}},{key:"focus",value:function(){this.spoofMouse()}},{key:"keyboardEvent",value:function(n){if(this.coordinateList.length!==0)switch(n.key){case"ArrowRight":{if(this.layout!=="horizontal")return;this.activeIndex=Math.min(this.activeIndex+1,this.coordinateList.length-1),this.spoofMouse();break}case"ArrowLeft":{if(this.layout!=="horizontal")return;this.activeIndex=Math.max(this.activeIndex-1,0),this.spoofMouse();break}}}},{key:"setIndex",value:function(n){this.activeIndex=n}},{key:"spoofMouse",value:function(){var n,r;if(this.layout==="horizontal"&&this.coordinateList.length!==0){var s=this.container.getBoundingClientRect(),i=s.x,o=s.y,l=s.height,c=this.coordinateList[this.activeIndex].coordinate,d=((n=window)===null||n===void 0?void 0:n.scrollX)||0,u=((r=window)===null||r===void 0?void 0:r.scrollY)||0,h=i+c+d,m=o+this.offset.top+l/2+u;this.mouseHandlerCallback({pageX:h,pageY:m})}}}])}();function kes(t,e,n){if(n==="number"&&e===!0&&Array.isArray(t)){var r=t==null?void 0:t[0],s=t==null?void 0:t[1];if(r&&s&&ln(r)&&ln(s))return!0}return!1}function Ses(t,e,n,r){var s=r/2;return{stroke:"none",fill:"#ccc",x:t==="horizontal"?e.x-s:n.left+.5,y:t==="horizontal"?n.top+.5:e.y-s,width:t==="horizontal"?r:n.width-1,height:t==="horizontal"?n.height-1:r}}function C3t(t){var e=t.cx,n=t.cy,r=t.radius,s=t.startAngle,i=t.endAngle,o=$a(e,n,r,s),l=$a(e,n,r,i);return{points:[o,l],cx:e,cy:n,radius:r,startAngle:s,endAngle:i}}function Ces(t,e,n){var r,s,i,o;if(t==="horizontal")r=e.x,i=r,s=n.top,o=n.top+n.height;else if(t==="vertical")s=e.y,o=s,r=n.left,i=n.left+n.width;else if(e.cx!=null&&e.cy!=null)if(t==="centric"){var l=e.cx,c=e.cy,d=e.innerRadius,u=e.outerRadius,h=e.angle,m=$a(l,c,d,h),f=$a(l,c,u,h);r=m.x,s=m.y,i=f.x,o=f.y}else return C3t(e);return[{x:r,y:s},{x:i,y:o}]}function o8(t){"@babel/helpers - typeof";return o8=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o8(t)}function HQe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function gH(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?HQe(Object(n),!0).forEach(function(r){jes(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):HQe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function jes(t,e,n){return e=Ees(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Ees(t){var e=Nes(t,"string");return o8(e)=="symbol"?e:e+""}function Nes(t,e){if(o8(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(o8(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function Tes(t){var e,n,r=t.element,s=t.tooltipEventType,i=t.isActive,o=t.activeCoordinate,l=t.activePayload,c=t.offset,d=t.activeTooltipIndex,u=t.tooltipAxisBandSize,h=t.layout,m=t.chartName,f=(e=r.props.cursor)!==null&&e!==void 0?e:(n=r.type.defaultProps)===null||n===void 0?void 0:n.cursor;if(!r||!f||!i||!o||m!=="ScatterChart"&&s!=="axis")return null;var p,g=mk;if(m==="ScatterChart")p=o,g=lYr;else if(m==="BarChart")p=Ses(h,o,c,u),g=M5e;else if(h==="radial"){var v=C3t(o),b=v.cx,x=v.cy,w=v.radius,k=v.startAngle,S=v.endAngle;p={cx:b,cy:x,startAngle:k,endAngle:S,innerRadius:w,outerRadius:w},g=yLt}else p={points:Ces(h,o,c)},g=mk;var C=gH(gH(gH(gH({stroke:"#ccc",pointerEvents:"none"},c),p),hr(f,!1)),{},{payload:l,payloadIndex:d,className:Zn("recharts-tooltip-cursor",f.className)});return y.isValidElement(f)?y.cloneElement(f,C):y.createElement(g,C)}var _es=["item"],Aes=["children","className","width","height","style","compact","title","desc"];function F5(t){"@babel/helpers - typeof";return F5=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},F5(t)}function SA(){return SA=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},SA.apply(this,arguments)}function GQe(t,e){return Ies(t)||Res(t,e)||E3t(t,e)||Pes()}function Pes(){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 Res(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,s,i,o,l=[],c=!0,d=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(r=i.call(n)).done)&&(l.push(r.value),l.length!==e);c=!0);}catch(u){d=!0,s=u}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(d)throw s}}return l}}function Ies(t){if(Array.isArray(t))return t}function WQe(t,e){if(t==null)return{};var n=Mes(t,e),r,s;if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(s=0;s<i.length;s++)r=i[s],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function Mes(t,e){if(t==null)return{};var n={};for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r)){if(e.indexOf(r)>=0)continue;n[r]=t[r]}return n}function Les(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Des(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,N3t(r.key),r)}}function $es(t,e,n){return e&&Des(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function Oes(t,e,n){return e=wX(e),Fes(t,j3t()?Reflect.construct(e,n||[],wX(t).constructor):e.apply(t,n))}function Fes(t,e){if(e&&(F5(e)==="object"||typeof e=="function"))return e;if(e!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return Bes(t)}function Bes(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function j3t(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(j3t=function(){return!!t})()}function wX(t){return wX=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},wX(t)}function Ues(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&R1e(t,e)}function R1e(t,e){return R1e=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(r,s){return r.__proto__=s,r},R1e(t,e)}function B5(t){return Hes(t)||Ves(t)||E3t(t)||zes()}function zes(){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 E3t(t,e){if(t){if(typeof t=="string")return I1e(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return I1e(t,e)}}function Ves(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function Hes(t){if(Array.isArray(t))return I1e(t)}function I1e(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function qQe(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(s){return Object.getOwnPropertyDescriptor(t,s).enumerable})),n.push.apply(n,r)}return n}function At(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?qQe(Object(n),!0).forEach(function(r){es(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):qQe(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function es(t,e,n){return e=N3t(e),e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function N3t(t){var e=Ges(t,"string");return F5(e)=="symbol"?e:e+""}function Ges(t,e){if(F5(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e||"default");if(F5(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}var Wes={xAxis:["bottom","top"],yAxis:["left","right"]},qes={width:"100%",height:"100%"},T3t={x:0,y:0};function vH(t){return t}var Kes=function(e,n){return n==="horizontal"?e.x:n==="vertical"?e.y:n==="centric"?e.angle:e.radius},Yes=function(e,n,r,s){var i=n.find(function(u){return u&&u.index===r});if(i){if(e==="horizontal")return{x:i.coordinate,y:s.y};if(e==="vertical")return{x:s.x,y:i.coordinate};if(e==="centric"){var o=i.coordinate,l=s.radius;return At(At(At({},s),$a(s.cx,s.cy,l,o)),{},{angle:o,radius:l})}var c=i.coordinate,d=s.angle;return At(At(At({},s),$a(s.cx,s.cy,c,d)),{},{angle:d,radius:c})}return T3t},Qie=function(e,n){var r=n.graphicalItems,s=n.dataStartIndex,i=n.dataEndIndex,o=(r??[]).reduce(function(l,c){var d=c.props.data;return d&&d.length?[].concat(B5(l),B5(d)):l},[]);return o.length>0?o:e&&e.length&&ln(s)&&ln(i)?e.slice(s,i+1):[]};function _3t(t){return t==="number"?[0,"auto"]:void 0}var M1e=function(e,n,r,s){var i=e.graphicalItems,o=e.tooltipAxis,l=Qie(n,e);return r<0||!i||!i.length||r>=l.length?null:i.reduce(function(c,d){var u,h=(u=d.props.data)!==null&&u!==void 0?u:n;h&&e.dataStartIndex+e.dataEndIndex!==0&&e.dataEndIndex-e.dataStartIndex>=r&&(h=h.slice(e.dataStartIndex,e.dataEndIndex+1));var m;if(o.dataKey&&!o.allowDuplicatedCategory){var f=h===void 0?l:h;m=kJ(f,o.dataKey,s)}else m=h&&h[r]||l[r];return m?[].concat(B5(c),[hLt(d,m)]):c},[])},KQe=function(e,n,r,s){var i=s||{x:e.chartX,y:e.chartY},o=Kes(i,r),l=e.orderedTooltipTicks,c=e.tooltipAxis,d=e.tooltipTicks,u=BGr(o,l,d,c);if(u>=0&&d){var h=d[u]&&d[u].value,m=M1e(e,n,u,h),f=Yes(r,l,u,i);return{activeTooltipIndex:u,activeLabel:h,activePayload:m,activeCoordinate:f}}return null},Qes=function(e,n){var r=n.axes,s=n.graphicalItems,i=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,d=n.dataEndIndex,u=e.layout,h=e.children,m=e.stackOffset,f=aLt(u,i);return r.reduce(function(p,g){var v,b=g.type.defaultProps!==void 0?At(At({},g.type.defaultProps),g.props):g.props,x=b.type,w=b.dataKey,k=b.allowDataOverflow,S=b.allowDuplicatedCategory,C=b.scale,j=b.ticks,E=b.includeHidden,N=b[o];if(p[N])return p;var A=Qie(e.data,{graphicalItems:s.filter(function(B){var H,W=o in B.props?B.props[o]:(H=B.type.defaultProps)===null||H===void 0?void 0:H[o];return W===N}),dataStartIndex:c,dataEndIndex:d}),_=A.length,T,R,O;kes(b.domain,k,x)&&(T=Gwe(b.domain,null,k),f&&(x==="number"||C!=="auto")&&(O=$$(A,w,"category")));var F=_3t(x);if(!T||T.length===0){var D,I=(D=b.domain)!==null&&D!==void 0?D:F;if(w){if(T=$$(A,w,x),x==="category"&&f){var P=r8r(T);S&&P?(R=T,T=wF(0,_)):S||(T=fYe(I,T,g).reduce(function(B,H){return B.indexOf(H)>=0?B:[].concat(B5(B),[H])},[]))}else if(x==="category")S?T=T.filter(function(B){return B!==""&&!$r(B)}):T=fYe(I,T,g).reduce(function(B,H){return B.indexOf(H)>=0||H===""||$r(H)?B:[].concat(B5(B),[H])},[]);else if(x==="number"){var M=GGr(A,s.filter(function(B){var H,W,V=o in B.props?B.props[o]:(H=B.type.defaultProps)===null||H===void 0?void 0:H[o],U="hide"in B.props?B.props.hide:(W=B.type.defaultProps)===null||W===void 0?void 0:W.hide;return V===N&&(E||!U)}),w,i,u);M&&(T=M)}f&&(x==="number"||C!=="auto")&&(O=$$(A,w,"category"))}else f?T=wF(0,_):l&&l[N]&&l[N].hasStack&&x==="number"?T=m==="expand"?[0,1]:uLt(l[N].stackGroups,c,d):T=iLt(A,s.filter(function(B){var H=o in B.props?B.props[o]:B.type.defaultProps[o],W="hide"in B.props?B.props.hide:B.type.defaultProps.hide;return H===N&&(E||!W)}),x,u,!0);if(x==="number")T=P1e(h,T,N,i,j),I&&(T=Gwe(I,T,k));else if(x==="category"&&I){var z=I,G=T.every(function(B){return z.indexOf(B)>=0});G&&(T=z)}}return At(At({},p),{},es({},N,At(At({},b),{},{axisType:i,domain:T,categoricalDomain:O,duplicateDomain:R,originalDomain:(v=b.domain)!==null&&v!==void 0?v:F,isCategorical:f,layout:u})))},{})},Zes=function(e,n){var r=n.graphicalItems,s=n.Axis,i=n.axisType,o=n.axisIdKey,l=n.stackGroups,c=n.dataStartIndex,d=n.dataEndIndex,u=e.layout,h=e.children,m=Qie(e.data,{graphicalItems:r,dataStartIndex:c,dataEndIndex:d}),f=m.length,p=aLt(u,i),g=-1;return r.reduce(function(v,b){var x=b.type.defaultProps!==void 0?At(At({},b.type.defaultProps),b.props):b.props,w=x[o],k=_3t("number");if(!v[w]){g++;var S;return p?S=wF(0,f):l&&l[w]&&l[w].hasStack?(S=uLt(l[w].stackGroups,c,d),S=P1e(h,S,w,i)):(S=Gwe(k,iLt(m,r.filter(function(C){var j,E,N=o in C.props?C.props[o]:(j=C.type.defaultProps)===null||j===void 0?void 0:j[o],A="hide"in C.props?C.props.hide:(E=C.type.defaultProps)===null||E===void 0?void 0:E.hide;return N===w&&!A}),"number",u),s.defaultProps.allowDataOverflow),S=P1e(h,S,w,i)),At(At({},v),{},es({},w,At(At({axisType:i},s.defaultProps),{},{hide:!0,orientation:Cm(Wes,"".concat(i,".").concat(g%2),null),domain:S,originalDomain:k,isCategorical:p,layout:u})))}return v},{})},Jes=function(e,n){var r=n.axisType,s=r===void 0?"xAxis":r,i=n.AxisComp,o=n.graphicalItems,l=n.stackGroups,c=n.dataStartIndex,d=n.dataEndIndex,u=e.children,h="".concat(s,"Id"),m=Lu(u,i),f={};return m&&m.length?f=Qes(e,{axes:m,graphicalItems:o,axisType:s,axisIdKey:h,stackGroups:l,dataStartIndex:c,dataEndIndex:d}):o&&o.length&&(f=Zes(e,{Axis:i,graphicalItems:o,axisType:s,axisIdKey:h,stackGroups:l,dataStartIndex:c,dataEndIndex:d})),f},Xes=function(e){var n=u1(e),r=gx(n,!1,!0);return{tooltipTicks:r,orderedTooltipTicks:Zse(r,function(s){return s.coordinate}),tooltipAxis:n,tooltipAxisBandSize:qJ(n,r)}},YQe=function(e){var n=e.children,r=e.defaultShowTooltip,s=im(n,N5),i=0,o=0;return e.data&&e.data.length!==0&&(o=e.data.length-1),s&&s.props&&(s.props.startIndex>=0&&(i=s.props.startIndex),s.props.endIndex>=0&&(o=s.props.endIndex)),{chartX:0,chartY:0,dataStartIndex:i,dataEndIndex:o,activeTooltipIndex:-1,isTooltipActive:!!r}},ets=function(e){return!e||!e.length?!1:e.some(function(n){var r=Px(n&&n.type);return r&&r.indexOf("Bar")>=0})},QQe=function(e){return e==="horizontal"?{numericAxisName:"yAxis",cateAxisName:"xAxis"}:e==="vertical"?{numericAxisName:"xAxis",cateAxisName:"yAxis"}:e==="centric"?{numericAxisName:"radiusAxis",cateAxisName:"angleAxis"}:{numericAxisName:"angleAxis",cateAxisName:"radiusAxis"}},tts=function(e,n){var r=e.props,s=e.graphicalItems,i=e.xAxisMap,o=i===void 0?{}:i,l=e.yAxisMap,c=l===void 0?{}:l,d=r.width,u=r.height,h=r.children,m=r.margin||{},f=im(h,N5),p=im(h,o2),g=Object.keys(c).reduce(function(S,C){var j=c[C],E=j.orientation;return!j.mirror&&!j.hide?At(At({},S),{},es({},E,S[E]+j.width)):S},{left:m.left||0,right:m.right||0}),v=Object.keys(o).reduce(function(S,C){var j=o[C],E=j.orientation;return!j.mirror&&!j.hide?At(At({},S),{},es({},E,Cm(S,"".concat(E))+j.height)):S},{top:m.top||0,bottom:m.bottom||0}),b=At(At({},v),g),x=b.bottom;f&&(b.bottom+=f.props.height||N5.defaultProps.height),p&&n&&(b=VGr(b,s,r,n));var w=d-b.left-b.right,k=u-b.top-b.bottom;return At(At({brushBottom:x},b),{},{width:Math.max(w,0),height:Math.max(k,0)})},nts=function(e,n){if(n==="xAxis")return e[n].width;if(n==="yAxis")return e[n].height},Zie=function(e){var n=e.chartName,r=e.GraphicalChild,s=e.defaultTooltipEventType,i=s===void 0?"axis":s,o=e.validateTooltipEventTypes,l=o===void 0?["axis"]:o,c=e.axisComponents,d=e.legendContent,u=e.formatAxisMap,h=e.defaultProps,m=function(b,x){var w=x.graphicalItems,k=x.stackGroups,S=x.offset,C=x.updateId,j=x.dataStartIndex,E=x.dataEndIndex,N=b.barSize,A=b.layout,_=b.barGap,T=b.barCategoryGap,R=b.maxBarSize,O=QQe(A),F=O.numericAxisName,D=O.cateAxisName,I=ets(w),P=[];return w.forEach(function(M,z){var G=Qie(b.data,{graphicalItems:[M],dataStartIndex:j,dataEndIndex:E}),B=M.type.defaultProps!==void 0?At(At({},M.type.defaultProps),M.props):M.props,H=B.dataKey,W=B.maxBarSize,V=B["".concat(F,"Id")],U=B["".concat(D,"Id")],ne={},te=c.reduce(function(ce,pe){var Ie=x["".concat(pe.axisType,"Map")],Me=B["".concat(pe.axisType,"Id")];Ie&&Ie[Me]||pe.axisType==="zAxis"||dE();var we=Ie[Me];return At(At({},ce),{},es(es({},pe.axisType,we),"".concat(pe.axisType,"Ticks"),gx(we)))},ne),re=te[D],fe=te["".concat(D,"Ticks")],le=k&&k[V]&&k[V].hasStack&&eWr(M,k[V].stackGroups),q=Px(M.type).indexOf("Bar")>=0,Y=qJ(re,fe),X=[],Q=I&&UGr({barSize:N,stackGroups:k,totalSize:nts(te,D)});if(q){var ie,he,ye=$r(W)?R:W,J=(ie=(he=qJ(re,fe,!0))!==null&&he!==void 0?he:ye)!==null&&ie!==void 0?ie:0;X=zGr({barGap:_,barCategoryGap:T,bandSize:J!==Y?J:Y,sizeList:Q[U],maxBarSize:ye}),J!==Y&&(X=X.map(function(ce){return At(At({},ce),{},{position:At(At({},ce.position),{},{offset:ce.position.offset-J/2})})}))}var K=M&&M.type&&M.type.getComposedData;K&&P.push({props:At(At({},K(At(At({},te),{},{displayedData:G,props:b,dataKey:H,item:M,bandSize:Y,barPosition:X,offset:S,stackedData:le,layout:A,dataStartIndex:j,dataEndIndex:E}))),{},es(es(es({key:M.key||"item-".concat(z)},F,te[F]),D,te[D]),"animationId",C)),childIndex:g8r(M,b.children),item:M})}),P},f=function(b,x){var w=b.props,k=b.dataStartIndex,S=b.dataEndIndex,C=b.updateId;if(!Lqe({props:w}))return null;var j=w.children,E=w.layout,N=w.stackOffset,A=w.data,_=w.reverseStackOrder,T=QQe(E),R=T.numericAxisName,O=T.cateAxisName,F=Lu(j,r),D=JGr(A,F,"".concat(R,"Id"),"".concat(O,"Id"),N,_),I=c.reduce(function(B,H){var W="".concat(H.axisType,"Map");return At(At({},B),{},es({},W,Jes(w,At(At({},H),{},{graphicalItems:F,stackGroups:H.axisType===R&&D,dataStartIndex:k,dataEndIndex:S}))))},{}),P=tts(At(At({},I),{},{props:w,graphicalItems:F}),x==null?void 0:x.legendBBox);Object.keys(I).forEach(function(B){I[B]=u(w,I[B],P,B.replace("Map",""),n)});var M=I["".concat(O,"Map")],z=Xes(M),G=m(w,At(At({},I),{},{dataStartIndex:k,dataEndIndex:S,updateId:C,graphicalItems:F,stackGroups:D,offset:P}));return At(At({formattedGraphicalItems:G,graphicalItems:F,offset:P,stackGroups:D},z),I)},p=function(v){function b(x){var w,k,S;return Les(this,b),S=Oes(this,b,[x]),es(S,"eventEmitterSymbol",Symbol("rechartsEventEmitter")),es(S,"accessibilityManager",new wes),es(S,"handleLegendBBoxUpdate",function(C){if(C){var j=S.state,E=j.dataStartIndex,N=j.dataEndIndex,A=j.updateId;S.setState(At({legendBBox:C},f({props:S.props,dataStartIndex:E,dataEndIndex:N,updateId:A},At(At({},S.state),{},{legendBBox:C}))))}}),es(S,"handleReceiveSyncEvent",function(C,j,E){if(S.props.syncId===C){if(E===S.eventEmitterSymbol&&typeof S.props.syncMethod!="function")return;S.applySyncEvent(j)}}),es(S,"handleBrushChange",function(C){var j=C.startIndex,E=C.endIndex;if(j!==S.state.dataStartIndex||E!==S.state.dataEndIndex){var N=S.state.updateId;S.setState(function(){return At({dataStartIndex:j,dataEndIndex:E},f({props:S.props,dataStartIndex:j,dataEndIndex:E,updateId:N},S.state))}),S.triggerSyncEvent({dataStartIndex:j,dataEndIndex:E})}}),es(S,"handleMouseEnter",function(C){var j=S.getMouseInfo(C);if(j){var E=At(At({},j),{},{isTooltipActive:!0});S.setState(E),S.triggerSyncEvent(E);var N=S.props.onMouseEnter;Wr(N)&&N(E,C)}}),es(S,"triggeredAfterMouseMove",function(C){var j=S.getMouseInfo(C),E=j?At(At({},j),{},{isTooltipActive:!0}):{isTooltipActive:!1};S.setState(E),S.triggerSyncEvent(E);var N=S.props.onMouseMove;Wr(N)&&N(E,C)}),es(S,"handleItemMouseEnter",function(C){S.setState(function(){return{isTooltipActive:!0,activeItem:C,activePayload:C.tooltipPayload,activeCoordinate:C.tooltipPosition||{x:C.cx,y:C.cy}}})}),es(S,"handleItemMouseLeave",function(){S.setState(function(){return{isTooltipActive:!1}})}),es(S,"handleMouseMove",function(C){C.persist(),S.throttleTriggeredAfterMouseMove(C)}),es(S,"handleMouseLeave",function(C){S.throttleTriggeredAfterMouseMove.cancel();var j={isTooltipActive:!1};S.setState(j),S.triggerSyncEvent(j);var E=S.props.onMouseLeave;Wr(E)&&E(j,C)}),es(S,"handleOuterEvent",function(C){var j=p8r(C),E=Cm(S.props,"".concat(j));if(j&&Wr(E)){var N,A;/.*touch.*/i.test(j)?A=S.getMouseInfo(C.changedTouches[0]):A=S.getMouseInfo(C),E((N=A)!==null&&N!==void 0?N:{},C)}}),es(S,"handleClick",function(C){var j=S.getMouseInfo(C);if(j){var E=At(At({},j),{},{isTooltipActive:!0});S.setState(E),S.triggerSyncEvent(E);var N=S.props.onClick;Wr(N)&&N(E,C)}}),es(S,"handleMouseDown",function(C){var j=S.props.onMouseDown;if(Wr(j)){var E=S.getMouseInfo(C);j(E,C)}}),es(S,"handleMouseUp",function(C){var j=S.props.onMouseUp;if(Wr(j)){var E=S.getMouseInfo(C);j(E,C)}}),es(S,"handleTouchMove",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.throttleTriggeredAfterMouseMove(C.changedTouches[0])}),es(S,"handleTouchStart",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.handleMouseDown(C.changedTouches[0])}),es(S,"handleTouchEnd",function(C){C.changedTouches!=null&&C.changedTouches.length>0&&S.handleMouseUp(C.changedTouches[0])}),es(S,"handleDoubleClick",function(C){var j=S.props.onDoubleClick;if(Wr(j)){var E=S.getMouseInfo(C);j(E,C)}}),es(S,"handleContextMenu",function(C){var j=S.props.onContextMenu;if(Wr(j)){var E=S.getMouseInfo(C);j(E,C)}}),es(S,"triggerSyncEvent",function(C){S.props.syncId!==void 0&&ohe.emit(lhe,S.props.syncId,C,S.eventEmitterSymbol)}),es(S,"applySyncEvent",function(C){var j=S.props,E=j.layout,N=j.syncMethod,A=S.state.updateId,_=C.dataStartIndex,T=C.dataEndIndex;if(C.dataStartIndex!==void 0||C.dataEndIndex!==void 0)S.setState(At({dataStartIndex:_,dataEndIndex:T},f({props:S.props,dataStartIndex:_,dataEndIndex:T,updateId:A},S.state)));else if(C.activeTooltipIndex!==void 0){var R=C.chartX,O=C.chartY,F=C.activeTooltipIndex,D=S.state,I=D.offset,P=D.tooltipTicks;if(!I)return;if(typeof N=="function")F=N(P,C);else if(N==="value"){F=-1;for(var M=0;M<P.length;M++)if(P[M].value===C.activeLabel){F=M;break}}var z=At(At({},I),{},{x:I.left,y:I.top}),G=Math.min(R,z.x+z.width),B=Math.min(O,z.y+z.height),H=P[F]&&P[F].value,W=M1e(S.state,S.props.data,F),V=P[F]?{x:E==="horizontal"?P[F].coordinate:G,y:E==="horizontal"?B:P[F].coordinate}:T3t;S.setState(At(At({},C),{},{activeLabel:H,activeCoordinate:V,activePayload:W,activeTooltipIndex:F}))}else S.setState(C)}),es(S,"renderCursor",function(C){var j,E=S.state,N=E.isTooltipActive,A=E.activeCoordinate,_=E.activePayload,T=E.offset,R=E.activeTooltipIndex,O=E.tooltipAxisBandSize,F=S.getTooltipEventType(),D=(j=C.props.active)!==null&&j!==void 0?j:N,I=S.props.layout,P=C.key||"_recharts-cursor";return se.createElement(Tes,{key:P,activeCoordinate:A,activePayload:_,activeTooltipIndex:R,chartName:n,element:C,isActive:D,layout:I,offset:T,tooltipAxisBandSize:O,tooltipEventType:F})}),es(S,"renderPolarAxis",function(C,j,E){var N=Cm(C,"type.axisType"),A=Cm(S.state,"".concat(N,"Map")),_=C.type.defaultProps,T=_!==void 0?At(At({},_),C.props):C.props,R=A&&A[T["".concat(N,"Id")]];return y.cloneElement(C,At(At({},R),{},{className:Zn(N,R.className),key:C.key||"".concat(j,"-").concat(E),ticks:gx(R,!0)}))}),es(S,"renderPolarGrid",function(C){var j=C.props,E=j.radialLines,N=j.polarAngles,A=j.polarRadius,_=S.state,T=_.radiusAxisMap,R=_.angleAxisMap,O=u1(T),F=u1(R),D=F.cx,I=F.cy,P=F.innerRadius,M=F.outerRadius;return y.cloneElement(C,{polarAngles:Array.isArray(N)?N:gx(F,!0).map(function(z){return z.coordinate}),polarRadius:Array.isArray(A)?A:gx(O,!0).map(function(z){return z.coordinate}),cx:D,cy:I,innerRadius:P,outerRadius:M,key:C.key||"polar-grid",radialLines:E})}),es(S,"renderLegend",function(){var C=S.state.formattedGraphicalItems,j=S.props,E=j.children,N=j.width,A=j.height,_=S.props.margin||{},T=N-(_.left||0)-(_.right||0),R=rLt({children:E,formattedGraphicalItems:C,legendWidth:T,legendContent:d});if(!R)return null;var O=R.item,F=WQe(R,_es);return y.cloneElement(O,At(At({},F),{},{chartWidth:N,chartHeight:A,margin:_,onBBoxUpdate:S.handleLegendBBoxUpdate}))}),es(S,"renderTooltip",function(){var C,j=S.props,E=j.children,N=j.accessibilityLayer,A=im(E,bu);if(!A)return null;var _=S.state,T=_.isTooltipActive,R=_.activeCoordinate,O=_.activePayload,F=_.activeLabel,D=_.offset,I=(C=A.props.active)!==null&&C!==void 0?C:T;return y.cloneElement(A,{viewBox:At(At({},D),{},{x:D.left,y:D.top}),active:I,label:F,payload:I?O:[],coordinate:R,accessibilityLayer:N})}),es(S,"renderBrush",function(C){var j=S.props,E=j.margin,N=j.data,A=S.state,_=A.offset,T=A.dataStartIndex,R=A.dataEndIndex,O=A.updateId;return y.cloneElement(C,{key:C.key||"_recharts-brush",onChange:hH(S.handleBrushChange,C.props.onChange),data:N,x:ln(C.props.x)?C.props.x:_.left,y:ln(C.props.y)?C.props.y:_.top+_.height+_.brushBottom-(E.bottom||0),width:ln(C.props.width)?C.props.width:_.width,startIndex:T,endIndex:R,updateId:"brush-".concat(O)})}),es(S,"renderReferenceElement",function(C,j,E){if(!C)return null;var N=S,A=N.clipPathId,_=S.state,T=_.xAxisMap,R=_.yAxisMap,O=_.offset,F=C.type.defaultProps||{},D=C.props,I=D.xAxisId,P=I===void 0?F.xAxisId:I,M=D.yAxisId,z=M===void 0?F.yAxisId:M;return y.cloneElement(C,{key:C.key||"".concat(j,"-").concat(E),xAxis:T[P],yAxis:R[z],viewBox:{x:O.left,y:O.top,width:O.width,height:O.height},clipPathId:A})}),es(S,"renderActivePoints",function(C){var j=C.item,E=C.activePoint,N=C.basePoint,A=C.childIndex,_=C.isRange,T=[],R=j.props.key,O=j.item.type.defaultProps!==void 0?At(At({},j.item.type.defaultProps),j.item.props):j.item.props,F=O.activeDot,D=O.dataKey,I=At(At({index:A,dataKey:D,cx:E.x,cy:E.y,r:4,fill:I5e(j.item),strokeWidth:2,stroke:"#fff",payload:E.payload,value:E.value},hr(F,!1)),SJ(F));return T.push(b.renderActiveDot(F,I,"".concat(R,"-activePoint-").concat(A))),N?T.push(b.renderActiveDot(F,At(At({},I),{},{cx:N.x,cy:N.y}),"".concat(R,"-basePoint-").concat(A))):_&&T.push(null),T}),es(S,"renderGraphicChild",function(C,j,E){var N=S.filterFormatItem(C,j,E);if(!N)return null;var A=S.getTooltipEventType(),_=S.state,T=_.isTooltipActive,R=_.tooltipAxis,O=_.activeTooltipIndex,F=_.activeLabel,D=S.props.children,I=im(D,bu),P=N.props,M=P.points,z=P.isRange,G=P.baseLine,B=N.item.type.defaultProps!==void 0?At(At({},N.item.type.defaultProps),N.item.props):N.item.props,H=B.activeDot,W=B.hide,V=B.activeBar,U=B.activeShape,ne=!!(!W&&T&&I&&(H||V||U)),te={};A!=="axis"&&I&&I.props.trigger==="click"?te={onClick:hH(S.handleItemMouseEnter,C.props.onClick)}:A!=="axis"&&(te={onMouseLeave:hH(S.handleItemMouseLeave,C.props.onMouseLeave),onMouseEnter:hH(S.handleItemMouseEnter,C.props.onMouseEnter)});var re=y.cloneElement(C,At(At({},N.props),te));function fe(pe){return typeof R.dataKey=="function"?R.dataKey(pe.payload):null}if(ne)if(O>=0){var le,q;if(R.dataKey&&!R.allowDuplicatedCategory){var Y=typeof R.dataKey=="function"?fe:"payload.".concat(R.dataKey.toString());le=kJ(M,Y,F),q=z&&G&&kJ(G,Y,F)}else le=M==null?void 0:M[O],q=z&&G&&G[O];if(U||V){var X=C.props.activeIndex!==void 0?C.props.activeIndex:O;return[y.cloneElement(C,At(At(At({},N.props),te),{},{activeIndex:X})),null,null]}if(!$r(le))return[re].concat(B5(S.renderActivePoints({item:N,activePoint:le,basePoint:q,childIndex:O,isRange:z})))}else{var Q,ie=(Q=S.getItemByXY(S.state.activeCoordinate))!==null&&Q!==void 0?Q:{graphicalItem:re},he=ie.graphicalItem,ye=he.item,J=ye===void 0?C:ye,K=he.childIndex,ce=At(At(At({},N.props),te),{},{activeIndex:K});return[y.cloneElement(J,ce),null,null]}return z?[re,null,null]:[re,null]}),es(S,"renderCustomized",function(C,j,E){return y.cloneElement(C,At(At({key:"recharts-customized-".concat(E)},S.props),S.state))}),es(S,"renderMap",{CartesianGrid:{handler:vH,once:!0},ReferenceArea:{handler:S.renderReferenceElement},ReferenceLine:{handler:vH},ReferenceDot:{handler:S.renderReferenceElement},XAxis:{handler:vH},YAxis:{handler:vH},Brush:{handler:S.renderBrush,once:!0},Bar:{handler:S.renderGraphicChild},Line:{handler:S.renderGraphicChild},Area:{handler:S.renderGraphicChild},Radar:{handler:S.renderGraphicChild},RadialBar:{handler:S.renderGraphicChild},Scatter:{handler:S.renderGraphicChild},Pie:{handler:S.renderGraphicChild},Funnel:{handler:S.renderGraphicChild},Tooltip:{handler:S.renderCursor,once:!0},PolarGrid:{handler:S.renderPolarGrid,once:!0},PolarAngleAxis:{handler:S.renderPolarAxis},PolarRadiusAxis:{handler:S.renderPolarAxis},Customized:{handler:S.renderCustomized}}),S.clipPathId="".concat((w=x.id)!==null&&w!==void 0?w:MS("recharts"),"-clip"),S.throttleTriggeredAfterMouseMove=XIt(S.triggeredAfterMouseMove,(k=x.throttleDelay)!==null&&k!==void 0?k:1e3/60),S.state={},S}return Ues(b,v),$es(b,[{key:"componentDidMount",value:function(){var w,k;this.addListener(),this.accessibilityManager.setDetails({container:this.container,offset:{left:(w=this.props.margin.left)!==null&&w!==void 0?w:0,top:(k=this.props.margin.top)!==null&&k!==void 0?k:0},coordinateList:this.state.tooltipTicks,mouseHandlerCallback:this.triggeredAfterMouseMove,layout:this.props.layout}),this.displayDefaultTooltip()}},{key:"displayDefaultTooltip",value:function(){var w=this.props,k=w.children,S=w.data,C=w.height,j=w.layout,E=im(k,bu);if(E){var N=E.props.defaultIndex;if(!(typeof N!="number"||N<0||N>this.state.tooltipTicks.length-1)){var A=this.state.tooltipTicks[N]&&this.state.tooltipTicks[N].value,_=M1e(this.state,S,N,A),T=this.state.tooltipTicks[N].coordinate,R=(this.state.offset.top+C)/2,O=j==="horizontal",F=O?{x:T,y:R}:{y:T,x:R},D=this.state.formattedGraphicalItems.find(function(P){var M=P.item;return M.type.name==="Scatter"});D&&(F=At(At({},F),D.props.points[N].tooltipPosition),_=D.props.points[N].tooltipPayload);var I={activeTooltipIndex:N,isTooltipActive:!0,activeLabel:A,activePayload:_,activeCoordinate:F};this.setState(I),this.renderCursor(E),this.accessibilityManager.setIndex(N)}}}},{key:"getSnapshotBeforeUpdate",value:function(w,k){if(!this.props.accessibilityLayer)return null;if(this.state.tooltipTicks!==k.tooltipTicks&&this.accessibilityManager.setDetails({coordinateList:this.state.tooltipTicks}),this.props.layout!==w.layout&&this.accessibilityManager.setDetails({layout:this.props.layout}),this.props.margin!==w.margin){var S,C;this.accessibilityManager.setDetails({offset:{left:(S=this.props.margin.left)!==null&&S!==void 0?S:0,top:(C=this.props.margin.top)!==null&&C!==void 0?C:0}})}return null}},{key:"componentDidUpdate",value:function(w){dwe([im(w.children,bu)],[im(this.props.children,bu)])||this.displayDefaultTooltip()}},{key:"componentWillUnmount",value:function(){this.removeListener(),this.throttleTriggeredAfterMouseMove.cancel()}},{key:"getTooltipEventType",value:function(){var w=im(this.props.children,bu);if(w&&typeof w.props.shared=="boolean"){var k=w.props.shared?"axis":"item";return l.indexOf(k)>=0?k:i}return i}},{key:"getMouseInfo",value:function(w){if(!this.container)return null;var k=this.container,S=k.getBoundingClientRect(),C=uUr(S),j={chartX:Math.round(w.pageX-C.left),chartY:Math.round(w.pageY-C.top)},E=S.width/k.offsetWidth||1,N=this.inRange(j.chartX,j.chartY,E);if(!N)return null;var A=this.state,_=A.xAxisMap,T=A.yAxisMap,R=this.getTooltipEventType(),O=KQe(this.state,this.props.data,this.props.layout,N);if(R!=="axis"&&_&&T){var F=u1(_).scale,D=u1(T).scale,I=F&&F.invert?F.invert(j.chartX):null,P=D&&D.invert?D.invert(j.chartY):null;return At(At({},j),{},{xValue:I,yValue:P},O)}return O?At(At({},j),O):null}},{key:"inRange",value:function(w,k){var S=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1,C=this.props.layout,j=w/S,E=k/S;if(C==="horizontal"||C==="vertical"){var N=this.state.offset,A=j>=N.left&&j<=N.left+N.width&&E>=N.top&&E<=N.top+N.height;return A?{x:j,y:E}:null}var _=this.state,T=_.angleAxisMap,R=_.radiusAxisMap;if(T&&R){var O=u1(T);return vYe({x:j,y:E},O)}return null}},{key:"parseEventsOfWrapper",value:function(){var w=this.props.children,k=this.getTooltipEventType(),S=im(w,bu),C={};S&&k==="axis"&&(S.props.trigger==="click"?C={onClick:this.handleClick}:C={onMouseEnter:this.handleMouseEnter,onDoubleClick:this.handleDoubleClick,onMouseMove:this.handleMouseMove,onMouseLeave:this.handleMouseLeave,onTouchMove:this.handleTouchMove,onTouchStart:this.handleTouchStart,onTouchEnd:this.handleTouchEnd,onContextMenu:this.handleContextMenu});var j=SJ(this.props,this.handleOuterEvent);return At(At({},j),C)}},{key:"addListener",value:function(){ohe.on(lhe,this.handleReceiveSyncEvent)}},{key:"removeListener",value:function(){ohe.removeListener(lhe,this.handleReceiveSyncEvent)}},{key:"filterFormatItem",value:function(w,k,S){for(var C=this.state.formattedGraphicalItems,j=0,E=C.length;j<E;j++){var N=C[j];if(N.item===w||N.props.key===w.key||k===Px(N.item.type)&&S===N.childIndex)return N}return null}},{key:"renderClipPath",value:function(){var w=this.clipPathId,k=this.state.offset,S=k.left,C=k.top,j=k.height,E=k.width;return se.createElement("defs",null,se.createElement("clipPath",{id:w},se.createElement("rect",{x:S,y:C,height:j,width:E})))}},{key:"getXScales",value:function(){var w=this.state.xAxisMap;return w?Object.entries(w).reduce(function(k,S){var C=GQe(S,2),j=C[0],E=C[1];return At(At({},k),{},es({},j,E.scale))},{}):null}},{key:"getYScales",value:function(){var w=this.state.yAxisMap;return w?Object.entries(w).reduce(function(k,S){var C=GQe(S,2),j=C[0],E=C[1];return At(At({},k),{},es({},j,E.scale))},{}):null}},{key:"getXScaleByAxisId",value:function(w){var k;return(k=this.state.xAxisMap)===null||k===void 0||(k=k[w])===null||k===void 0?void 0:k.scale}},{key:"getYScaleByAxisId",value:function(w){var k;return(k=this.state.yAxisMap)===null||k===void 0||(k=k[w])===null||k===void 0?void 0:k.scale}},{key:"getItemByXY",value:function(w){var k=this.state,S=k.formattedGraphicalItems,C=k.activeItem;if(S&&S.length)for(var j=0,E=S.length;j<E;j++){var N=S[j],A=N.props,_=N.item,T=_.type.defaultProps!==void 0?At(At({},_.type.defaultProps),_.props):_.props,R=Px(_.type);if(R==="Bar"){var O=(A.data||[]).find(function(P){return zKr(w,P)});if(O)return{graphicalItem:N,payload:O}}else if(R==="RadialBar"){var F=(A.data||[]).find(function(P){return vYe(w,P)});if(F)return{graphicalItem:N,payload:F}}else if(Uie(N,C)||zie(N,C)||t8(N,C)){var D=gQr({graphicalItem:N,activeTooltipItem:C,itemData:T.data}),I=T.activeIndex===void 0?D:T.activeIndex;return{graphicalItem:At(At({},N),{},{childIndex:I}),payload:t8(N,C)?T.data[D]:N.props.data[D]}}}return null}},{key:"render",value:function(){var w=this;if(!Lqe(this))return null;var k=this.props,S=k.children,C=k.className,j=k.width,E=k.height,N=k.style,A=k.compact,_=k.title,T=k.desc,R=WQe(k,Aes),O=hr(R,!1);if(A)return se.createElement(SQe,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},se.createElement(hwe,SA({},O,{width:j,height:E,title:_,desc:T}),this.renderClipPath(),$qe(S,this.renderMap)));if(this.props.accessibilityLayer){var F,D;O.tabIndex=(F=this.props.tabIndex)!==null&&F!==void 0?F:0,O.role=(D=this.props.role)!==null&&D!==void 0?D:"application",O.onKeyDown=function(P){w.accessibilityManager.keyboardEvent(P)},O.onFocus=function(){w.accessibilityManager.focus()}}var I=this.parseEventsOfWrapper();return se.createElement(SQe,{state:this.state,width:this.props.width,height:this.props.height,clipPathId:this.clipPathId},se.createElement("div",SA({className:Zn("recharts-wrapper",C),style:At({position:"relative",cursor:"default",width:j,height:E},N)},I,{ref:function(M){w.container=M}}),se.createElement(hwe,SA({},O,{width:j,height:E,title:_,desc:T,style:qes}),this.renderClipPath(),$qe(S,this.renderMap)),this.renderLegend(),this.renderTooltip()))}}])}(y.Component);es(p,"displayName",n),es(p,"defaultProps",At({layout:"horizontal",stackOffset:"none",barCategoryGap:"10%",barGap:4,margin:{top:5,right:5,bottom:5,left:5},reverseStackOrder:!1,syncMethod:"index"},h)),es(p,"getDerivedStateFromProps",function(v,b){var x=v.dataKey,w=v.data,k=v.children,S=v.width,C=v.height,j=v.layout,E=v.stackOffset,N=v.margin,A=b.dataStartIndex,_=b.dataEndIndex;if(b.updateId===void 0){var T=YQe(v);return At(At(At({},T),{},{updateId:0},f(At(At({props:v},T),{},{updateId:0}),b)),{},{prevDataKey:x,prevData:w,prevWidth:S,prevHeight:C,prevLayout:j,prevStackOffset:E,prevMargin:N,prevChildren:k})}if(x!==b.prevDataKey||w!==b.prevData||S!==b.prevWidth||C!==b.prevHeight||j!==b.prevLayout||E!==b.prevStackOffset||!mP(N,b.prevMargin)){var R=YQe(v),O={chartX:b.chartX,chartY:b.chartY,isTooltipActive:b.isTooltipActive},F=At(At({},KQe(b,w,j)),{},{updateId:b.updateId+1}),D=At(At(At({},R),O),F);return At(At(At({},D),f(At({props:v},D),b)),{},{prevDataKey:x,prevData:w,prevWidth:S,prevHeight:C,prevLayout:j,prevStackOffset:E,prevMargin:N,prevChildren:k})}if(!dwe(k,b.prevChildren)){var I,P,M,z,G=im(k,N5),B=G&&(I=(P=G.props)===null||P===void 0?void 0:P.startIndex)!==null&&I!==void 0?I:A,H=G&&(M=(z=G.props)===null||z===void 0?void 0:z.endIndex)!==null&&M!==void 0?M:_,W=B!==A||H!==_,V=!$r(w),U=V&&!W?b.updateId:b.updateId+1;return At(At({updateId:U},f(At(At({props:v},b),{},{updateId:U,dataStartIndex:B,dataEndIndex:H}),b)),{},{prevChildren:k,dataStartIndex:B,dataEndIndex:H})}return null}),es(p,"renderActiveDot",function(v,b,x){var w;return y.isValidElement(v)?w=y.cloneElement(v,b):Wr(v)?w=v(b):w=se.createElement(_9,b),se.createElement(Cs,{className:"recharts-active-dot",key:x},w)});var g=y.forwardRef(function(b,x){return se.createElement(p,SA({},b,{ref:x}))});return g.displayName=p.displayName,g},rts=Zie({chartName:"LineChart",GraphicalChild:Tg,axisComponents:[{axisType:"xAxis",AxisComp:rb},{axisType:"yAxis",AxisComp:Ug}],formatAxisMap:L5e}),A3t=Zie({chartName:"BarChart",GraphicalChild:Bg,defaultTooltipEventType:"axis",validateTooltipEventTypes:["axis","item"],axisComponents:[{axisType:"xAxis",AxisComp:rb},{axisType:"yAxis",AxisComp:Ug}],formatAxisMap:L5e}),sts=Zie({chartName:"PieChart",GraphicalChild:V0,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:Bie},{axisType:"radiusAxis",AxisComp:Oie}],formatAxisMap:dWr,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}}),P3t=Zie({chartName:"ComposedChart",GraphicalChild:[Tg,OS,Bg,Yie],axisComponents:[{axisType:"xAxis",AxisComp:rb},{axisType:"yAxis",AxisComp:Ug},{axisType:"zAxis",AxisComp:Kie}],formatAxisMap:L5e});const U5=t=>encodeURIComponent(t);function R3t(t,e){const n=new URLSearchParams;t!=null&&t.period&&n.set("period",t.period),t!=null&&t.from&&n.set("from",t.from),t!=null&&t.to&&n.set("to",t.to);for(const[s,i]of Object.entries(e??{}))i&&n.set(s,i);const r=n.toString();return r?`?${r}`:""}async function H0(t,e,n,r){return(await ae.get(`/community/${U5(t)}/analytics/${e}${R3t(n,r)}`)).analytics}const its=(t,e,n)=>H0(t,"overview",e,n),ats=(t,e,n)=>H0(t,"members",e,n),ots=(t,e,n)=>H0(t,"spaces",e,n),lts=(t,e,n)=>H0(t,"posts",e,n),cts=(t,e)=>ae.get(`/community/${U5(t)}/analytics/live-sessions/${encodeURIComponent(e)}/attendees`),dts=(t,e,n)=>H0(t,"events",e,n),uts=(t,e,n)=>H0(t,"messages",e,n),hts=(t,e,n)=>H0(t,"courses",e,n),mts=(t,e,n)=>H0(t,"web",e,n),fts=(t,e,n)=>H0(t,"devices",e,n);async function pts(t,e,n){const r=new URLSearchParams;e!=null&&e.period&&r.set("period",e.period),e!=null&&e.from&&r.set("from",e.from),e!=null&&e.to&&r.set("to",e.to),n!=null&&n.search&&r.set("search",n.search),n!=null&&n.action&&r.set("action",n.action),n!=null&&n.actorRole&&r.set("actorRole",n.actorRole),n!=null&&n.page&&r.set("page",String(n.page)),n!=null&&n.limit&&r.set("limit",String(n.limit));const s=r.toString();return(await ae.get(`/community/${U5(t)}/analytics/audit${s?`?${s}`:""}`)).analytics}async function gts(t,e,n,r){const s=new URLSearchParams;n!=null&&n.period&&s.set("period",n.period),n!=null&&n.from&&s.set("from",n.from),n!=null&&n.to&&s.set("to",n.to);const i=s.toString();return(await ae.get(`/community/${U5(t)}/analytics/members/${U5(e)}${i?`?${i}`:""}`)).analytics}async function vts(t,e,n,r,s=1,i){const o=R3t(n,r),l=`status=${encodeURIComponent(e)}&page=${s}${i?`&snapshot=${encodeURIComponent(i)}`:""}`;return(await ae.get(`/community/${U5(t)}/analytics/members/activity-status${o?`${o}&${l}`:`?${l}`}`)).analytics}const yts=t=>{let e=t==null?"":String(t);return/^[=+\-@\t\r]/.test(e)&&(e=`'${e}`),`"${e.replace(/"/g,'""')}"`},ZQe=t=>t?new Date(t).toLocaleString():"";function bts({attendees:t}){return[["Name","Email","Type","Channels","RSVP","First joined","Last seen","Minutes attended"],...t.map(n=>[n.name,n.email,n.type,n.channels.join("; "),n.rsvp,ZQe(n.firstJoinedAt),ZQe(n.lastSeenAt),n.minutes])].map(n=>n.map(yts).join(",")).join(`
`)}function xts(t){return`${t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,60)||"session"}-attendees.csv`}function wts({meetingId:t,title:e}){const{community:n}=qe(),[r,s]=y.useState(!1);if(!t||!(n!=null&&n.id))return null;const i=async()=>{s(!0);try{const o=await cts(n.id,t),l=URL.createObjectURL(new Blob([bts(o)],{type:"text/csv;charset=utf-8"})),c=document.createElement("a");c.href=l,c.download=xts(o.session.title||e),document.body.appendChild(c),c.click(),c.remove(),URL.revokeObjectURL(l)}catch(o){He.error(Dt(o,"Could not download the attendee list"))}finally{s(!1)}};return a.jsxs("button",{type:"button",onClick:()=>void i(),disabled:r,title:"Download who attended this session",className:"inline-flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground hover:bg-muted disabled:opacity-60",children:[a.jsx(bc,{className:"h-3.5 w-3.5"}),r?"Preparing…":"CSV"]})}const Jie=6e4;function G0(t,e,n,r=!0,s){const{community:i}=qe(),o=(i==null?void 0:i.id)??null,l=(i==null?void 0:i.myRole)==="admin",c=Object.entries(s??{}).filter(([,d])=>d).sort(([d],[u])=>d.localeCompare(u)).map(([d,u])=>`${d}:${u}`).join("|");return lt({queryKey:["analytics",t,o,n.period,n.from??"",n.to??"",c],queryFn:()=>e(o,n,s),enabled:!!o&&l&&r,staleTime:Jie,placeholderData:Uy})}const kts=(t,e,n)=>G0("overview",its,t,e,n),Sts=(t,e,n)=>G0("members",ats,t,e,n),Cts=(t,e,n)=>G0("spaces",ots,t,e,n),jts=(t,e,n)=>G0("posts",lts,t,e,n),Ets=(t,e,n)=>G0("events",dts,t,e,n),Nts=(t,e,n)=>G0("messages",uts,t,e,n),Tts=(t,e,n)=>G0("courses",hts,t,e,n),_ts=(t,e,n)=>G0("web",mts,t,e,n),Ats=(t,e,n)=>G0("devices",fts,t,e,n);function Pts(t,e){const{community:n}=qe(),r=(n==null?void 0:n.id)??null,s=(n==null?void 0:n.myRole)==="admin",i=JSON.stringify(e??{});return lt({queryKey:["analytics","audit",r,t.period,t.from??"",t.to??"",i],queryFn:()=>pts(r,t,e),enabled:!!r&&s,staleTime:Jie,placeholderData:Uy})}function Rts(t,e,n){const{community:r}=qe(),s=(r==null?void 0:r.id)??null,i=(r==null?void 0:r.myRole)==="admin";return C0({queryKey:["analytics","activity-status-members",s,t,e.period,e.from??"",e.to??"",n??""],initialPageParam:{page:1},queryFn:({pageParam:o})=>vts(s,t,e,n?{role:n}:void 0,o.page,o.snapshot),getNextPageParam:o=>o.hasMore?{page:o.page+1,snapshot:o.snapshot}:void 0,enabled:!!(s&&t)&&i,staleTime:Jie})}function Its(t,e){const{community:n}=qe(),r=(n==null?void 0:n.id)??null,s=(n==null?void 0:n.myRole)==="admin";return lt({queryKey:["analytics","member-profile",r,t,e.period,e.from??"",e.to??""],queryFn:()=>gts(r,t,e),enabled:!!(r&&t)&&s,staleTime:Jie,placeholderData:Uy})}var rv="Accordion",Mts=["Home","End","ArrowDown","ArrowUp","ArrowLeft","ArrowRight"],[G5e,Lts,Dts]=lI(rv),[Xie,kjs]=il(rv,[Dts,sNt]),W5e=sNt(),I3t=se.forwardRef((t,e)=>{const{type:n,...r}=t,s=r,i=r;return a.jsx(G5e.Provider,{scope:t.__scopeAccordion,children:n==="multiple"?a.jsx(Bts,{...i,ref:e}):a.jsx(Fts,{...s,ref:e})})});I3t.displayName=rv;var[M3t,$ts]=Xie(rv),[L3t,Ots]=Xie(rv,{collapsible:!1}),Fts=se.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},collapsible:i=!1,...o}=t,[l,c]=Sd({prop:n,defaultProp:r??"",onChange:s,caller:rv});return a.jsx(M3t,{scope:t.__scopeAccordion,value:se.useMemo(()=>l?[l]:[],[l]),onItemOpen:c,onItemClose:se.useCallback(()=>i&&c(""),[i,c]),children:a.jsx(L3t,{scope:t.__scopeAccordion,collapsible:i,children:a.jsx(D3t,{...o,ref:e})})})}),Bts=se.forwardRef((t,e)=>{const{value:n,defaultValue:r,onValueChange:s=()=>{},...i}=t,[o,l]=Sd({prop:n,defaultProp:r??[],onChange:s,caller:rv}),c=se.useCallback(u=>l((h=[])=>[...h,u]),[l]),d=se.useCallback(u=>l((h=[])=>h.filter(m=>m!==u)),[l]);return a.jsx(M3t,{scope:t.__scopeAccordion,value:o,onItemOpen:c,onItemClose:d,children:a.jsx(L3t,{scope:t.__scopeAccordion,collapsible:!0,children:a.jsx(D3t,{...i,ref:e})})})}),[Uts,eae]=Xie(rv),D3t=se.forwardRef((t,e)=>{const{__scopeAccordion:n,disabled:r,dir:s,orientation:i="vertical",...o}=t,l=se.useRef(null),c=Sr(l,e),d=Lts(n),h=ES(s)==="ltr",m=Kt(t.onKeyDown,f=>{var E;if(!Mts.includes(f.key))return;const p=f.target,g=d().filter(N=>{var A;return!((A=N.ref.current)!=null&&A.disabled)}),v=g.findIndex(N=>N.ref.current===p),b=g.length;if(v===-1)return;f.preventDefault();let x=v;const w=0,k=b-1,S=()=>{x=v+1,x>k&&(x=w)},C=()=>{x=v-1,x<w&&(x=k)};switch(f.key){case"Home":x=w;break;case"End":x=k;break;case"ArrowRight":i==="horizontal"&&(h?S():C());break;case"ArrowDown":i==="vertical"&&S();break;case"ArrowLeft":i==="horizontal"&&(h?C():S());break;case"ArrowUp":i==="vertical"&&C();break}const j=x%b;(E=g[j].ref.current)==null||E.focus()});return a.jsx(Uts,{scope:n,disabled:r,direction:s,orientation:i,children:a.jsx(G5e.Slot,{scope:n,children:a.jsx(Sn.div,{...o,"data-orientation":i,ref:c,onKeyDown:r?void 0:m})})})}),kX="AccordionItem",[zts,q5e]=Xie(kX),$3t=se.forwardRef((t,e)=>{const{__scopeAccordion:n,value:r,...s}=t,i=eae(kX,n),o=$ts(kX,n),l=W5e(n),c=el(),d=r&&o.value.includes(r)||!1,u=i.disabled||t.disabled;return a.jsx(zts,{scope:n,open:d,disabled:u,triggerId:c,children:a.jsx(oNt,{"data-orientation":i.orientation,"data-state":V3t(d),...l,...s,ref:e,disabled:u,open:d,onOpenChange:h=>{h?o.onItemOpen(r):o.onItemClose(r)}})})});$3t.displayName=kX;var O3t="AccordionHeader",F3t=se.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,s=eae(rv,n),i=q5e(O3t,n);return a.jsx(Sn.h3,{"data-orientation":s.orientation,"data-state":V3t(i.open),"data-disabled":i.disabled?"":void 0,...r,ref:e})});F3t.displayName=O3t;var L1e="AccordionTrigger",B3t=se.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,s=eae(rv,n),i=q5e(L1e,n),o=Ots(L1e,n),l=W5e(n);return a.jsx(G5e.ItemSlot,{scope:n,children:a.jsx(npr,{"aria-disabled":i.open&&!o.collapsible||void 0,"data-orientation":s.orientation,id:i.triggerId,...l,...r,ref:e})})});B3t.displayName=L1e;var U3t="AccordionContent",z3t=se.forwardRef((t,e)=>{const{__scopeAccordion:n,...r}=t,s=eae(rv,n),i=q5e(U3t,n),o=W5e(n);return a.jsx(rpr,{role:"region","aria-labelledby":i.triggerId,"data-orientation":s.orientation,...o,...r,ref:e,style:{"--radix-accordion-content-height":"var(--radix-collapsible-content-height)","--radix-accordion-content-width":"var(--radix-collapsible-content-width)",...t.style}})});z3t.displayName=U3t;function V3t(t){return t?"open":"closed"}var Vts=I3t,Hts=$3t,Gts=F3t,H3t=B3t,G3t=z3t;const W3t=Vts,K5e=y.forwardRef(({className:t,...e},n)=>a.jsx(Hts,{ref:n,className:ee("border-b",t),...e}));K5e.displayName="AccordionItem";const Y5e=y.forwardRef(({className:t,children:e,...n},r)=>a.jsx(Gts,{className:"flex",children:a.jsxs(H3t,{ref:r,className:ee("flex flex-1 items-center justify-between py-4 font-medium transition-all hover:underline [&[data-state=open]>svg]:rotate-180",t),...n,children:[e,a.jsx(li,{className:"h-4 w-4 shrink-0 transition-transform duration-200"})]})}));Y5e.displayName=H3t.displayName;const Q5e=y.forwardRef(({className:t,children:e,...n},r)=>a.jsx(G3t,{ref:r,className:"overflow-hidden text-sm transition-all data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down",...n,children:a.jsx("div",{className:ee("pb-4 pt-0",t),children:e})}));Q5e.displayName=G3t.displayName;const JQe={session:"",page:"",action:"",device:""};function Wts({journey:t,member:e}){const[n,r]=y.useState(!1),s=y.useRef(null);return a.jsxs(B0,{open:n,onOpenChange:r,children:[a.jsx("section",{className:"rounded-lg border border-border bg-muted/10 p-3.5",children:a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[a.jsxs("div",{className:"flex min-w-0 items-start gap-3",children:[a.jsx("span",{className:"mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-primary/10 text-primary",children:a.jsx(nst,{className:"h-4 w-4"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("h5",{className:"text-sm font-semibold text-foreground",children:"User journey"}),a.jsx(gn,{label:"User journey",children:"Explore page engagement, session details, navigation steps, active time and meaningful actions for this member."})]}),a.jsx("p",{className:"mt-0.5 text-xs leading-relaxed text-muted-foreground",children:"Review session and page activity without leaving this member’s profile."})]})]}),a.jsx(d4r,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"shrink-0 sm:self-center",children:["View journey ",a.jsx(xa,{className:"ml-1.5 h-3.5 w-3.5"})]})})]})}),a.jsxs(Xy,{side:"right",className:"flex w-full flex-col gap-0 p-0 sm:max-w-3xl",onOpenAutoFocus:i=>{var o;i.preventDefault(),(o=s.current)==null||o.focus()},children:[a.jsxs(eb,{className:"shrink-0 border-b border-border px-5 py-4 pr-12 sm:px-6",children:[a.jsx(tb,{ref:s,tabIndex:-1,className:"text-left text-base focus:outline-none",children:"Journey details"}),a.jsxs(g9,{className:"truncate text-left",children:[e.name,e.email?` · ${e.email}`:""]})]}),a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-5 sm:px-6",children:a.jsx(qts,{journey:t})})]})]})}function qts({journey:t}){const[e,n]=y.useState(JQe),r=y.useMemo(()=>{const l=new Set,c=new Set;for(const d of(t==null?void 0:t.sessions)??[]){d.device&&c.add(d.device);for(const u of d.pages)for(const h of u.actions)l.add(h.type)}return{actions:[...l].sort(),devices:[...c].sort()}},[t]);if(!t||!t.sessions.length&&!t.pages.length)return a.jsxs("section",{children:[a.jsx(XQe,{}),a.jsx("p",{className:"rounded-md border border-dashed border-border p-4 text-center text-sm text-muted-foreground",children:"No page activity is available for this member in the selected period."})]});const s=t.sessions.filter(l=>!(e.session&&l.id!==e.session||e.device&&l.device!==e.device||e.page&&!l.pages.some(c=>c.pageKey===e.page)||e.action&&!l.pages.some(c=>c.actions.some(d=>d.type===e.action)))),i=e.page?t.pages.filter(l=>l.pageKey===e.page):t.pages,o=Object.values(e).some(Boolean);return a.jsxs("section",{className:"space-y-4",children:[a.jsx(XQe,{}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-3",children:[a.jsx(hC,{label:"Sessions",value:t.summary.totalSessions,hint:"A visit containing active page activity. A new session begins after 30 minutes without interaction."}),a.jsx(hC,{label:"Active time",value:uj(t.summary.totalActiveTimeSec),hint:"Time credited only while the page was visible and the member had recently interacted. Idle and background time is excluded."}),a.jsx(hC,{label:"Page visits",value:t.summary.pagesVisited}),a.jsx(hC,{label:"Unique pages",value:t.summary.uniquePages,hint:"Number of different page types visited by this member."}),a.jsx(hC,{label:"Actions",value:t.summary.totalActions,hint:"Meaningful recorded actions such as posting, commenting, replying, reacting, following, or going live."}),a.jsx(hC,{label:"Most visited",value:t.summary.mostVisitedPage||"—"}),a.jsx(hC,{label:"Most engaged",value:t.summary.mostEngagedPage||"—",hint:"The page with the most tracked active time; actions break a tie."})]}),a.jsxs("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:[a.jsx(eZe,{label:"First seen",value:t.summary.firstSeenAt,timezone:t.timezone}),a.jsx(eZe,{label:"Last active",value:t.summary.lastActiveAt,timezone:t.timezone})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-muted/10 p-3",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between gap-2",children:[a.jsx("h6",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Journey filters"}),o&&a.jsxs("button",{type:"button",onClick:()=>n(JQe),className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:[a.jsx(zP,{className:"h-3 w-3"})," Reset"]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:[a.jsx(yH,{label:"Session",value:e.session,onChange:l=>n(c=>({...c,session:l})),children:t.sessions.map((l,c)=>a.jsxs("option",{value:l.id,children:["Session ",t.sessions.length-c]},l.id))}),a.jsx(yH,{label:"Page",value:e.page,onChange:l=>n(c=>({...c,page:l})),children:t.pages.map(l=>a.jsx("option",{value:l.pageKey,children:l.page},l.pageKey))}),a.jsx(yH,{label:"Action",value:e.action,onChange:l=>n(c=>({...c,action:l})),children:r.actions.map(l=>a.jsx("option",{value:l,children:q3t(l)},l))}),a.jsx(yH,{label:"Device",value:e.device,onChange:l=>n(c=>({...c,device:l})),children:r.devices.map(l=>a.jsx("option",{value:l,children:l},l))})]})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"mb-2 flex items-center gap-1.5",children:[a.jsx("h6",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Page engagement"}),a.jsx(gn,{label:"Page engagement",children:"Visits and time recorded for each page in this member’s selected journey and date range."})]}),i.length?a.jsx("div",{className:"space-y-2",children:i.map(l=>a.jsxs("div",{className:"grid grid-cols-2 gap-2 rounded-lg border border-border bg-muted/10 p-3 text-xs sm:grid-cols-6",children:[a.jsx("div",{className:"col-span-2 font-medium text-foreground sm:col-span-1",children:l.page}),a.jsx(O_,{label:"Visits",value:l.visits.toLocaleString()}),a.jsx(O_,{label:"Unique users",value:(l.uniqueUsers??1).toLocaleString(),hint:"Distinct members represented by this page row. An individual member journey normally shows one."}),a.jsx(O_,{label:"Avg. time",value:uj(l.avgTimeSec),hint:"Average wall-clock time between entering and leaving this page across its visits."}),a.jsx(O_,{label:"Active time",value:uj(l.activeTimeSec),hint:"Interaction-qualified time while this page was visible. Idle and background time is excluded."}),a.jsx(O_,{label:"Actions",value:l.actions.toLocaleString(),hint:"Meaningful tracked actions recorded on this page, such as posting, commenting, replying, reacting, following, or going live."})]},l.pageKey))}):a.jsx(tZe,{})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"mb-2 flex items-center gap-1.5",children:[a.jsx("h6",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Sessions & page journey"}),a.jsx(gn,{label:"Exit page",children:"The last page visited before this tracked session ended."})]}),s.length?a.jsx(W3t,{type:"multiple",className:"space-y-2",children:s.map((l,c)=>a.jsxs(K5e,{value:l.id,className:"rounded-lg border border-border px-3",children:[a.jsx(Y5e,{className:"py-3 text-left hover:no-underline",children:a.jsxs("div",{className:"min-w-0 flex-1 pr-2",children:[a.jsxs("div",{className:"text-sm font-medium text-foreground",children:["Session ",t.sessions.length-c," · ",D1e(l.startedAt,t.timezone)]}),a.jsxs("div",{className:"mt-1 text-xs font-normal text-muted-foreground",children:[uj(l.durationSec)," duration · ",uj(l.activeDurationSec)," active · ",l.pagesVisited," pages · ",l.actions," actions"]})]})}),a.jsxs(Q5e,{className:"pb-3",children:[a.jsx("div",{className:"mb-3 flex flex-wrap items-center gap-1.5","aria-label":"Page journey",children:l.pages.map((d,u)=>a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[u>0&&a.jsx(io,{className:"h-3 w-3 text-muted-foreground"}),a.jsx("span",{className:"rounded-full border border-border bg-background px-2 py-1 text-xs",children:d.page})]},d.id))}),a.jsx("div",{className:"space-y-2 border-l border-border pl-3",children:l.pages.map(d=>a.jsx(Kts,{page:d,timezone:t.timezone},d.id))}),a.jsxs("div",{className:"mt-3 grid grid-cols-2 gap-2 text-xs text-muted-foreground",children:[a.jsxs("span",{children:["Entry: ",a.jsx("strong",{className:"font-medium text-foreground",children:l.entryPage})]}),a.jsxs("span",{children:["Exit: ",a.jsx("strong",{className:"font-medium text-foreground",children:l.exitPage})]}),a.jsxs("span",{children:["Device: ",a.jsx("strong",{className:"font-medium text-foreground",children:l.device})]}),a.jsxs("span",{children:["Ended: ",a.jsx("strong",{className:"font-medium text-foreground",children:D1e(l.endedAt,t.timezone)})]})]})]})]},l.id))}):a.jsx(tZe,{})]}),(t.partial.pageViews||t.partial.sessions||t.partial.actions)&&a.jsx("p",{className:"rounded-md border border-amber-300/50 bg-amber-50 px-3 py-2 text-xs text-amber-800 dark:bg-amber-500/10 dark:text-amber-200",children:"Showing the most recent journey details for this period. Summary totals remain available above."})]})}function XQe(){return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(nst,{className:"h-4 w-4 text-primary"}),a.jsx("h5",{className:"text-sm font-semibold text-foreground",children:"User journey"}),a.jsx(gn,{label:"User journey",children:"Shows where this member navigated, how long they stayed, and meaningful actions recorded during each visit."})]})}function Kts({page:t,timezone:e}){return a.jsxs("div",{className:"relative rounded-md bg-muted/20 p-2.5",children:[a.jsx("span",{className:"absolute -left-[17px] top-4 h-2 w-2 rounded-full bg-primary"}),a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("div",{className:"text-sm font-medium text-foreground",children:t.page}),a.jsxs("div",{className:"mt-0.5 text-[11px] text-muted-foreground",children:[dhe(t.enteredAt,e)," – ",t.exitedAt?dhe(t.exitedAt,e):"Open"]})]}),a.jsxs("div",{className:"text-right text-[11px] text-muted-foreground",children:[a.jsxs("div",{className:"inline-flex items-center gap-1",children:[a.jsx(x9t,{className:"h-3 w-3"}),uj(t.durationSec)]}),a.jsxs("div",{children:[uj(t.activeDurationSec)," active"]})]})]}),a.jsxs("div",{className:"mt-1 text-[11px] text-muted-foreground",children:["Previous: ",t.previousPage||"Session entry"," · Next: ",t.nextPage||"Session exit"]}),t.actions.length>0&&a.jsx("div",{className:"mt-2 space-y-1 border-t border-border pt-2",children:t.actions.map((n,r)=>a.jsxs("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[a.jsx(bk,{className:"h-3 w-3"})," ",q3t(n.type)," · ",dhe(n.at,e)]},`${n.at}-${r}`))})]})}function hC({label:t,value:e,hint:n}){return a.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-2.5 py-2",children:[a.jsxs("div",{className:"flex items-center gap-1 text-[11px] text-muted-foreground",children:[a.jsx("span",{children:t}),n&&a.jsx(gn,{label:t,children:n})]}),a.jsx("div",{className:"mt-0.5 truncate text-base font-semibold text-foreground",title:String(e),children:e})]})}function eZe({label:t,value:e,timezone:n}){return a.jsx(O_,{label:t,value:e?D1e(e,n):"—"})}function O_({label:t,value:e,hint:n}){return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-1 text-[10px] uppercase tracking-wide text-muted-foreground",children:[a.jsx("span",{children:t}),n&&a.jsx(gn,{label:t,children:n})]}),a.jsx("div",{className:"font-medium text-foreground",children:e})]})}function yH({label:t,value:e,onChange:n,children:r}){return a.jsxs("label",{className:"text-[11px] text-muted-foreground",children:[t,a.jsxs("select",{value:e,onChange:s=>n(s.target.value),className:"mt-1 w-full rounded-md border border-border bg-background px-2 py-1.5 text-xs text-foreground",children:[a.jsx("option",{value:"",children:"All"}),r]})]})}function tZe(){return a.jsx("p",{className:"rounded-md border border-dashed border-border p-3 text-center text-xs text-muted-foreground",children:"No activity matches these filters."})}function uj(t){const e=Math.max(0,Math.round(t||0));if(!e)return"0s";const n=Math.floor(e/3600),r=Math.floor(e%3600/60),s=e%60;return n?`${n}h ${r}m`:r?`${r}m ${s}s`:`${s}s`}function D1e(t,e){try{return new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeStyle:"short",timeZone:e}).format(new Date(t))}catch{return new Date(t).toLocaleString()}}function dhe(t,e){try{return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit",second:"2-digit",timeZone:e}).format(new Date(t))}catch{return new Date(t).toLocaleTimeString()}}function q3t(t){return{"post-create":"Created a post","post-like":"Reacted to a post","post-comment":"Commented on a post","comment-reply":"Replied to a comment",follow:"Followed a member","group:user-joined":"Joined a space","group:user-requested":"Requested to join a space","group:request-accepted":"Space request accepted","group:going-live":"Went live in a space","going-live":"Started a live session"}[t]||t.replace(/[-:]/g," ").replace(/^./,n=>n.toUpperCase())}function Yts({range:t,role:e}){var p;const{community:n}=qe(),r=(n==null?void 0:n.id)??null,[s,i]=y.useState(""),[o,l]=y.useState(""),[c,d]=y.useState(null),u=y.useRef(null);y.useEffect(()=>{const g=setTimeout(()=>l(s.trim()),300);return()=>clearTimeout(g)},[s]);const h=lt({queryKey:["insights-member-search",r,o],queryFn:()=>Dy(r,{search:o,limit:8}),enabled:!!r&&o.length>=2,staleTime:3e4,placeholderData:Uy}),m=Its(c,t),f=((p=h.data)==null?void 0:p.users)??[];return a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsx("div",{className:"mb-3 flex items-center justify-between",children:a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Look up a user"}),a.jsx(nZe,{range:t,role:e})]}),a.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"Search by name, email or username. Open any user to see their full activity, time spent and timeline."})]})}),a.jsxs("div",{className:"relative",children:[a.jsx(hs,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{value:s,onChange:g=>i(g.target.value),placeholder:"Name, email or username",className:"w-full rounded-lg border border-border bg-background py-2 pl-9 pr-9 text-sm text-foreground placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary"}),s&&a.jsx("button",{"aria-label":"Clear search",onClick:()=>i(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:a.jsx(nn,{className:"h-4 w-4"})})]}),o.length>=2&&a.jsx("div",{className:"mt-3",children:h.isLoading?a.jsx("div",{className:"space-y-2",children:Array.from({length:3}).map((g,v)=>a.jsx(sr,{className:"h-11 w-full"},v))}):f.length===0?a.jsxs("p",{className:"rounded-md border border-dashed border-border p-4 text-center text-sm text-muted-foreground",children:["No members match “",o,"”."]}):a.jsx("ul",{className:"divide-y divide-border overflow-hidden rounded-md border border-border",children:f.map(g=>a.jsx(Qts,{user:g,onOpen:()=>d(g.id)},g.id))})}),a.jsx(B0,{open:!!c,onOpenChange:g=>!g&&d(null),children:a.jsxs(Xy,{side:"right",className:"w-full overflow-y-auto p-0 sm:max-w-xl",onOpenAutoFocus:g=>{var v;g.preventDefault(),(v=u.current)==null||v.focus()},children:[a.jsx(eb,{className:"border-b border-border p-5",children:a.jsxs(tb,{ref:u,tabIndex:-1,className:"flex items-center gap-1.5 text-base font-semibold focus:outline-none",children:["Member activity ",a.jsx(nZe,{range:t,role:e})]})}),a.jsx("div",{className:"p-5",children:m.isLoading?a.jsxs("div",{className:"space-y-3",children:[a.jsx(sr,{className:"h-14 w-full"}),a.jsx(sr,{className:"h-28 w-full"}),a.jsx(sr,{className:"h-28 w-full"}),a.jsx(sr,{className:"h-40 w-full"})]}):m.isError||!m.data?a.jsx("p",{className:"text-sm text-muted-foreground",children:"Couldn’t load this member’s analytics."}):a.jsx(Zts,{data:m.data})})]})})]})}function nZe({range:t,role:e}){const n=t.period==="custom"?`${t.from||"start"} to ${t.to||"today"}`:{"7d":"last 7 days","30d":"last 30 days","90d":"last 90 days","12m":"last 12 months"}[t.period],r=e==="admin"?"admins":e==="moderator"?"moderators":e==="user"?"members":"all users";return a.jsx(gn,{label:"Member activity",side:"right",children:a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{children:"Tracks meaningful actions such as posts, comments, replies, reactions, follows and live activity."}),a.jsxs("p",{children:["Events and active days use the ",n," range. The cohort charts currently show ",r,"."]}),a.jsx("p",{children:"Active time comes from sessions with recent interaction while the page is visible; idle or background time is excluded. Named time cards such as Today and Lifetime use their displayed windows."})]})})}function Qts({user:t,onOpen:e}){const n=t.email||"";return a.jsx("li",{children:a.jsxs("button",{onClick:e,className:"flex w-full items-center justify-between gap-3 bg-card px-3 py-2.5 text-left transition-colors hover:bg-muted/50",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"truncate text-sm font-medium text-foreground",children:t.name||"Unknown"}),n&&a.jsx("div",{className:"truncate text-xs text-muted-foreground",children:n})]}),a.jsx("span",{className:"shrink-0 rounded-full border border-border bg-muted/30 px-2 py-0.5 text-[11px] uppercase tracking-wide text-muted-foreground",children:K3t(t.communityRole)})]})})}function K3t(t){return t==="admin"?"Admin":t==="moderator"?"Moderator":"Member"}function Zts({data:t}){const{profile:e,usage:n,engagement:r,moderation:s,timeline:i}=t,o=c=>c?new Date(c).toLocaleString():"—",l=c=>{if(!c)return"—";try{return`${h7(new Date(c))} ago`}catch{return"—"}};return a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("h4",{className:"truncate text-lg font-semibold text-foreground",children:e.name}),e.email&&a.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e.email})]}),a.jsx("span",{className:"shrink-0 rounded-full border border-border bg-muted/30 px-2 py-0.5 text-[11px] uppercase tracking-wide text-muted-foreground",children:K3t(e.role)})]}),a.jsxs("dl",{className:"mt-3 grid grid-cols-2 gap-2 text-xs",children:[a.jsx(bH,{label:"Joined",value:o(e.joinedAt)}),a.jsx(bH,{label:"Last login",value:l(e.lastLoginAt)}),a.jsx(bH,{label:"First activity",value:l(e.firstActivityAt)}),a.jsx(bH,{label:"Last activity",value:l(e.lastActivityAt)})]})]}),a.jsxs("section",{children:[a.jsx("h5",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Usage · this period"}),a.jsx(Jts,{events:n.windowActivity,activeDays:n.activeDays,lifetime:n.totalActivity})]}),n.timeSpent&&a.jsxs("section",{children:[a.jsx("h5",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Time spent"}),a.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[a.jsx(hw,{label:"Today",sec:n.timeSpent.today}),a.jsx(hw,{label:"This week",sec:n.timeSpent.week}),a.jsx(hw,{label:"This month",sec:n.timeSpent.month}),a.jsx(hw,{label:"Last 30 days",sec:n.timeSpent.last30}),a.jsx(hw,{label:"Last 90 days",sec:n.timeSpent.last90}),a.jsx(hw,{label:"Lifetime",sec:n.timeSpent.lifetime})]}),a.jsxs("div",{className:"mt-2 grid grid-cols-3 gap-2",children:[a.jsx(Vp,{label:"Sessions",value:n.timeSpent.sessions}),a.jsx(hw,{label:"Avg session",sec:n.timeSpent.avgSessionSec}),a.jsx(hw,{label:"Longest",sec:n.timeSpent.longestSessionSec})]})]}),a.jsx(Wts,{journey:t.journey,member:{name:e.name,email:e.email}}),a.jsxs("section",{children:[a.jsx("h5",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Engagement · this period"}),a.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[a.jsx(Vp,{label:"Posts",value:r.posts}),a.jsx(Vp,{label:"Comments",value:r.comments}),a.jsx(Vp,{label:"Replies",value:r.replies}),a.jsx(Vp,{label:"Reactions",value:r.likes}),a.jsx(Vp,{label:"Follows",value:r.follows}),a.jsx(Vp,{label:"Went live",value:r.goingLive})]})]}),(e.role==="admin"||e.role==="moderator")&&a.jsxs("section",{children:[a.jsx("h5",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:e.role==="admin"?"Admin · this period":"Moderation · this period"}),a.jsx("div",{className:"grid grid-cols-3 gap-2",children:a.jsx(Vp,{label:"Reports resolved",value:s.reportsResolved})})]}),a.jsxs("section",{children:[a.jsx("h5",{className:"mb-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Recent activity"}),i.rows.length===0?a.jsx("p",{className:"rounded-md border border-dashed border-border p-3 text-center text-xs text-muted-foreground",children:"No activity yet."}):a.jsx("ol",{className:"relative space-y-2 border-l border-border pl-4",children:i.rows.map(c=>a.jsxs("li",{className:"relative",children:[a.jsx("span",{className:"absolute -left-[21px] top-2 h-2 w-2 rounded-full bg-primary"}),a.jsxs("div",{className:"flex items-baseline justify-between gap-2",children:[a.jsx("span",{className:"text-sm text-foreground",children:ens(c.activityType)}),a.jsx("time",{className:"shrink-0 text-[11px] text-muted-foreground",title:o(c.at),children:l(c.at)})]})]},c.id))}),i.hasMore&&a.jsxs("p",{className:"mt-2 text-[11px] text-muted-foreground",children:["Showing recent ",i.rows.length,". Narrow the period for older events."]})]})]})}function bH({label:t,value:e}){return a.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-2.5 py-1.5",children:[a.jsx("dt",{className:"text-[10px] uppercase tracking-wide text-muted-foreground",children:t}),a.jsx("dd",{className:"truncate text-xs text-foreground",children:e})]})}function Jts({events:t,activeDays:e,lifetime:n}){return a.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[a.jsx(Vp,{label:"Events",value:t,hint:"Meaningful actions recorded during the selected period, including posts, comments, replies, reactions, follows and live activity."}),a.jsx(Vp,{label:"Active days",value:e,hint:"Distinct days in the selected period when this member recorded at least one meaningful activity."}),a.jsx(Vp,{label:"Lifetime",value:n,hint:"All meaningful activity events recorded for this member, including events outside the selected period."})]})}function Vp({label:t,value:e,hint:n}){return a.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-2.5 py-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx("span",{children:t}),n&&a.jsx(gn,{label:t,children:n})]}),a.jsx("div",{className:"text-base font-semibold text-foreground",children:e.toLocaleString()})]})}function hw({label:t,sec:e}){return a.jsxs("div",{className:"rounded-md border border-border bg-muted/20 px-2.5 py-1.5",children:[a.jsx("div",{className:"text-xs text-muted-foreground",children:t}),a.jsx("div",{className:"text-base font-semibold text-foreground",children:Xts(e)})]})}function Xts(t){const e=Math.max(0,Math.round(t||0));if(!e)return"—";const n=Math.floor(e/3600),r=Math.floor(e%3600/60);return n>=1?`${n}h ${r}m`:r>=1?`${r}m`:`${e}s`}function ens(t){switch(t){case"post-create":return"Created a post";case"post-like":return"Reacted to a post";case"post-liked":return"Received a reaction";case"post-comment":return"Commented on a post";case"post-commented":return"Received a comment";case"comment-reply":return"Replied to a comment";case"comment-replied":return"Received a reply";case"follow":return"Started following someone";case"group:user-joined":return"Joined a space";case"group:user-requested":return"Requested to join a space";case"group:request-accepted":return"Was accepted into a space";case"group:going-live":return"Went live in a space";case"going-live":return"Started a live session";default:return t}}function Z5e({hasMore:t,loading:e,onLoadMore:n,label:r="items"}){const s=Tn(),i=y.useRef(null),o=y.useRef(n);return o.current=n,y.useEffect(()=>{const l=i.current;if(!t||e||!l||typeof IntersectionObserver>"u")return;const c=new IntersectionObserver(d=>{var u;(u=d[0])!=null&&u.isIntersecting&&o.current()},{rootMargin:"300px"});return c.observe(l),()=>c.disconnect()},[t,e]),t?a.jsx("div",{ref:i,className:"flex justify-center py-4",children:a.jsxs(Z,{type:"button",variant:"outline",size:"sm",disabled:e,onClick:n,children:[e?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):null,pn(s(e?"Loading more {label}…":"Load more {label}"),{label:s(r)})]})}):null}const Y3t={highlyActive:"Highly active",active:"Active",lowActivity:"Low activity",atRisk:"At risk",inactive:"Inactive"},rx=(t,e,n=`${e}s`)=>`${t} ${t===1?e:n}`,rZe=t=>fo(new Date(t),"d MMM yyyy");function tns(t,e){switch(t){case"highlyActive":return`${e.highlyActive} or more actions in the period.`;case"active":return`${e.active} to ${e.highlyActive-1} actions in the period.`;case"lowActivity":return`${e.lowActivity} to ${e.active-1} actions in the period, or joined in the last ${e.newMemberDays} days with none yet.`;case"atRisk":return"No actions in the period, but some in the period before it.";case"inactive":return`No actions in this period or the one before, and a member for over ${e.newMemberDays} days.`}}function nns(t,e){const n=t.totalActions;switch(t.status){case"highlyActive":return`${rx(n,"action")} in this period — ${e.highlyActive} or more counts as highly active.`;case"active":return`${rx(n,"action")} in this period — ${e.active} to ${e.highlyActive-1} counts as active.`;case"lowActivity":return t.newMember?t.joinedAt?`Joined ${rZe(t.joinedAt)} and has no activity yet — new members aren't counted as inactive for their first ${e.newMemberDays} days.`:"New member with no activity yet.":`Only ${rx(n,"action")} in this period — fewer than ${e.active} counts as low activity.`;case"atRisk":return`No activity in this period, after ${rx(t.previousPeriodActions??0,"action")} in the period before.`;case"inactive":return t.lastActiveAt?`No activity in this period or the one before. Last active ${rZe(t.lastActiveAt)}.`:"No tracked activity in this community yet."}}function rns(t){const{posts:e,comments:n,replies:r,reactions:s,other:i}=t.metrics;return[e&&rx(e,"post"),n&&rx(n,"comment"),r&&rx(r,"reply","replies"),s&&rx(s,"reaction"),i&&rx(i,"other action")].filter(Boolean).join(" · ")}function sns({status:t,range:e,role:n,onClose:r}){var d;const s=Rts(t,e,n),i=((d=s.data)==null?void 0:d.pages)??[],o=i[0],l=[...new Map(i.flatMap(u=>u.members).map(u=>[u.id,u])).values()],c=t?Y3t[t]:"";return a.jsx(B0,{open:!!t,onOpenChange:u=>!u&&r(),children:a.jsxs(Xy,{side:"right",className:"w-full overflow-y-auto p-0 sm:max-w-lg",children:[a.jsxs(eb,{className:"border-b border-border p-5 text-left",children:[a.jsxs(tb,{className:"text-base font-semibold",children:[c,o?a.jsxs("span",{className:"ml-1.5 font-normal text-muted-foreground",children:["· ",o.total," ",o.total===1?"member":"members"]}):null]}),a.jsxs(g9,{className:"text-xs",children:[o&&t?tns(t,o.thresholds):"Members with this activity status."," ","Actions are posts, comments, replies, reactions and other tracked activity in this community."]})]}),a.jsx("div",{className:"p-5",children:s.isLoading?a.jsx("ul",{className:"space-y-3","aria-label":"Loading members",children:[0,1,2,3].map(u=>a.jsxs("li",{className:"flex items-start gap-3",children:[a.jsx(sr,{className:"h-9 w-9 rounded-full"}),a.jsxs("div",{className:"flex-1 space-y-2",children:[a.jsx(sr,{className:"h-3.5 w-1/3"}),a.jsx(sr,{className:"h-3 w-5/6"})]})]},u))}):s.isError&&l.length===0?a.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-xl border border-dashed border-border py-10 text-center",children:[a.jsx(tS,{className:"h-5 w-5 text-destructive","aria-hidden":!0}),a.jsx("p",{className:"text-sm text-foreground",children:"Couldn't load these members."}),a.jsx("p",{className:"text-xs text-muted-foreground",children:dn(s.error,"Please try again.")}),a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>void s.refetch(),children:[a.jsx(Nl,{className:"mr-1.5 h-3.5 w-3.5"})," Try again"]})]}):l.length===0?a.jsx("p",{className:"rounded-xl border border-dashed border-border py-10 text-center text-sm text-muted-foreground",children:"No members have this status in the selected period."}):a.jsxs(a.Fragment,{children:[a.jsx("ul",{className:"divide-y divide-border",children:l.map(u=>a.jsx(ins,{member:u,thresholds:o.thresholds},u.id))}),a.jsxs("p",{className:"mt-3 text-center text-xs text-muted-foreground",role:"status",children:["Showing ",l.length," of ",(o==null?void 0:o.total)??l.length]}),s.isFetchNextPageError?a.jsxs("div",{className:"mt-3 flex flex-wrap items-center justify-center gap-2 text-xs",role:"alert",children:[a.jsx("span",{className:"text-destructive",children:"Couldn't load more members."}),a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>void s.fetchNextPage(),disabled:s.isFetchingNextPage,children:[a.jsx(Nl,{className:"mr-1.5 h-3.5 w-3.5"})," Try again"]})]}):a.jsx(Z5e,{hasMore:!!s.hasNextPage,loading:s.isFetchingNextPage,onLoadMore:()=>void s.fetchNextPage(),label:"members"})]})})]})})}function ins({member:t,thresholds:e}){const n=rns(t);return a.jsxs("li",{className:"flex items-start gap-3 py-3",children:[a.jsx(Jd,{src:t.picture,name:t.name,className:"h-9 w-9 shrink-0 text-xs"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:t.name}),a.jsx("span",{className:"shrink-0 text-xs font-semibold tabular-nums text-foreground",title:"Actions in this period",children:t.totalActions})]}),a.jsx("p",{className:"mt-0.5 text-xs leading-5 text-muted-foreground",children:nns(t,e)}),n&&a.jsx("p",{className:"mt-0.5 text-xs text-foreground/80",children:n})]})]})}function ans({range:t}){var p,g,v;const[e,n]=y.useState(""),[r,s]=y.useState(""),[i,o]=y.useState(1),[l,c]=y.useState("");y.useEffect(()=>{const b=setTimeout(()=>{s(e.trim()),o(1)},300);return()=>clearTimeout(b)},[e]);const d=Pts(t,{search:r||void 0,actorRole:l||void 0,page:i,limit:20}),u=((p=d.data)==null?void 0:p.rows)??[],h=((g=d.data)==null?void 0:g.total)??0,m=!!((v=d.data)!=null&&v.hasMore),f=Math.max(1,Math.ceil(h/20));return a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsx("div",{className:"mb-3 flex items-start justify-between gap-3",children:a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Audit trail"}),a.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"Admin and moderation actions in this community: role changes, verifies, kicks, post moderation and resolved reports. Newest first."})]})}),a.jsxs("div",{className:"mb-3 flex flex-wrap items-center gap-2",children:[a.jsxs("div",{className:"relative flex-1 min-w-[220px]",children:[a.jsx(hs,{className:"absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{value:e,onChange:b=>n(b.target.value),placeholder:"Search actor, email or target",className:"w-full rounded-lg border border-border bg-background py-2 pl-9 pr-9 text-sm text-foreground placeholder:text-muted-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary"}),e&&a.jsx("button",{"aria-label":"Clear search",onClick:()=>n(""),className:"absolute right-3 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground",children:a.jsx(nn,{className:"h-4 w-4"})})]}),a.jsxs("select",{value:l,onChange:b=>{c(b.target.value),o(1)},"aria-label":"Filter by who took the action",className:"rounded-lg border border-border bg-background px-2.5 py-2 text-sm text-foreground focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary",children:[a.jsx("option",{value:"",children:"Actions by all roles"}),a.jsx("option",{value:"admin",children:"Actions by admins"}),a.jsx("option",{value:"moderator",children:"Actions by moderators"}),a.jsx("option",{value:"user",children:"Actions by members"})]})]}),d.isLoading?a.jsx("div",{className:"space-y-2",children:Array.from({length:5}).map((b,x)=>a.jsx(sr,{className:"h-12 w-full"},x))}):d.isError?a.jsx("p",{className:"rounded-md border border-dashed border-border p-4 text-center text-sm text-muted-foreground",children:"Couldn't load the audit trail."}):u.length===0?a.jsx("p",{className:"rounded-md border border-dashed border-border p-4 text-center text-sm text-muted-foreground",children:"No admin or moderation actions in this period."}):a.jsx("ul",{className:"divide-y divide-border overflow-hidden rounded-md border border-border",children:u.map(b=>a.jsxs("li",{className:"flex items-start justify-between gap-3 bg-card px-3 py-2.5",children:[a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("span",{className:"text-sm font-medium text-foreground",children:b.actor.name||"Unknown"}),a.jsx("span",{className:"rounded-full border border-border bg-muted/30 px-1.5 py-0.5 text-[10px] uppercase tracking-wide text-muted-foreground",children:ons(b.actor.role)}),a.jsx("span",{className:"text-xs text-muted-foreground",children:lns(b.action)}),b.targetSnapshot&&a.jsxs("span",{className:"truncate text-xs text-foreground",children:["· ",b.targetSnapshot]})]}),b.reason&&a.jsxs("p",{className:"mt-0.5 truncate text-xs italic text-muted-foreground",children:["“",b.reason,"”"]})]}),a.jsx("time",{className:"shrink-0 text-[11px] text-muted-foreground",title:new Date(b.at).toLocaleString(),children:cns(b.at)})]},b.id))}),f>1&&a.jsxs("div",{className:"mt-3 flex items-center justify-between text-xs text-muted-foreground",children:[a.jsxs("span",{children:["Showing page ",i," of ",f," · ",h.toLocaleString()," total"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("button",{onClick:()=>o(b=>Math.max(1,b-1)),disabled:i<=1||d.isFetching,className:"rounded-md border border-border px-2.5 py-1 text-foreground transition-colors hover:bg-muted/50 disabled:opacity-50",children:"Previous"}),a.jsx("button",{onClick:()=>o(b=>b+1),disabled:!m||d.isFetching,className:"rounded-md border border-border px-2.5 py-1 text-foreground transition-colors hover:bg-muted/50 disabled:opacity-50",children:"Next"})]})]})]})}function ons(t){return t==="admin"?"Admin":t==="moderator"?"Moderator":t==="platform-owner"?"Platform":"Member"}function lns(t){return{"member.verify":"verified a member","member.kick":"removed a member","member.restore":"restored a member","member.role.promote.admin":"promoted to admin","member.role.demote.admin":"demoted from admin","member.role.promote.moderator":"promoted to moderator","post.moderation.approve":"approved a post","post.moderation.reject":"rejected a post","report.resolve.approved":"resolved a report (approved)","report.resolve.rejected":"resolved a report (rejected)","report.resolve.deleted":"resolved a report (deleted content)","report.resolve.banned":"resolved a report (banned user)"}[t]||t}function cns(t){try{return`${h7(new Date(t))} ago`}catch{return"—"}}const Ci={primary:"hsl(var(--primary))",primaryLight:"hsl(217 91% 72%)",warning:"hsl(38 92% 50%)",axis:"hsl(var(--muted-foreground))",grid:"hsl(var(--border))"},xH=["hsl(var(--primary))","hsl(217 91% 72%)","hsl(217 24% 84%)","hsl(217 91% 60%)"],hE={tickLine:!1,axisLine:!1,tick:{fontSize:11,fill:Ci.axis}},J5e={...hE,interval:"preserveStartEnd",minTickGap:24};function A9({active:t,payload:e,label:n}){return!t||!(e!=null&&e.length)?null:a.jsxs("div",{className:"rounded-lg border border-border bg-popover px-3 py-2 text-xs shadow-md",children:[n!=null&&a.jsx("p",{className:"mb-1 font-medium text-foreground",children:n}),e.map(r=>a.jsxs("p",{className:"flex items-center gap-1.5 text-muted-foreground",children:[a.jsx("span",{className:"h-2 w-2 rounded-full",style:{background:r.color}}),r.name,": ",a.jsx("span",{className:"font-semibold text-foreground",children:Number(r.value).toLocaleString()})]},r.dataKey??r.name))]})}const Q3t=[{key:"7d",label:"Last 7 days",short:"7 days",badge:"7d"},{key:"30d",label:"Last 30 days",short:"30 days",badge:"30d"},{key:"90d",label:"Last 90 days",short:"90 days",badge:"90d"},{key:"12m",label:"Last 12 months",short:"12 months",badge:"12mo"}],X5e=t=>Q3t.find(e=>e.key===t),dns=Q3t.map(t=>({value:t.key,label:t.short})),_q="30d",uns=t=>t.period==="custom"?_q:t.period;function hns(t){if(!t)return;const e=new Date(`${t}T00:00:00`);return Number.isNaN(e.getTime())?void 0:e}function wH(t){const e=hns(t);return e?fo(e,"d MMM yyyy"):t}function mns(t){return t.period!=="custom"?X5e(t.period).label:t.from&&t.to?`${wH(t.from)} – ${wH(t.to)}`:t.from?`From ${wH(t.from)}`:t.to?`Until ${wH(t.to)}`:"Custom range"}function fns(t){if(t.period!=="custom")return X5e(t.period).badge;if(t.from&&t.to){const e=Math.round((Date.parse(t.to)-Date.parse(t.from))/864e5)+1;return`${Math.max(1,e)}d`}return"custom"}const pns={"7d":.25,"30d":1,"90d":2.7,"12m":9};function tae(t){return function(){t|=0,t=t+1831565813|0;let e=Math.imul(t^t>>>15,1|t);return e=e+Math.imul(e^e>>>7,61|e)^e,((e^e>>>14)>>>0)/4294967296}}function eIe(t){let e=2166136261;for(let n=0;n<t.length;n++)e^=t.charCodeAt(n),e=Math.imul(e,16777619);return e>>>0}function Z3t(t){return t==="12m"?["Jul","Aug","Sep","Oct","Nov","Dec","Jan","Feb","Mar","Apr","May","Jun"]:t==="90d"?Array.from({length:13},(e,n)=>`Wk ${n+1}`):t==="30d"?Array.from({length:30},(e,n)=>`${n+1}`):["Mon","Tue","Wed","Thu","Fri","Sat","Sun"]}function ku(t,e,n,r=.25){const s=Z3t(t),i=tae(eIe(t+":"+e));let o=n;return s.map(l=>{o=Math.max(n*.35,o*(1+(i()-.42)*r));const c=Math.round(o);return{x:l,value:c,prev:Math.round(c*(.68+i()*.45))}})}function z5(t,e,n=.26){const r=e.map(s=>ku(t,s.key,s.base,n));return r[0].map((s,i)=>{const o={x:r[0][i].x};return e.forEach((l,c)=>{o[l.key]=r[c][i].value,o[`${l.key}Prev`]=r[c][i].prev}),o})}function gns(t,e,n){const r=Z3t(t),s=tae(eIe(t+":pct:"+e));let i=n;return r.map(o=>(i=Math.min(92,Math.max(8,i*(1+(s()-.5)*.18))),{x:o,value:Math.round(i)}))}function kH(t,e,n){const r=tae(eIe(e+":"+n));return Math.round(t*pns[e]*(.85+r()*.3))}function nL(t,e){const n=t.reduce((r,s)=>r+s[e],0)||1;return t.map(r=>({...r,percent:Math.round(r[e]/n*1e3)/10}))}const uhe=["12-2 AM","2-4 AM","4-6 AM","6-8 AM","8-10 AM","10 AM-12 PM","12-2 PM","2-4 PM","4-6 PM","6-8 PM","8-10 PM","10 PM-12 AM"],sZe=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],vns=[[0,0,1,0,1,0,1],[0,0,0,0,0,0,0],[0,0,1,0,0,0,1],[0,0,1,0,0,0,0],[0,0,0,0,0,1,1],[0,0,0,0,0,0,0],[0,0,0,0,0,0,0],[0,0,0,0,1,0,0],[0,0,1,0,0,0,1],[0,0,1,0,0,0,0],[0,0,0,0,0,1,0],[0,0,1,0,0,0,0]],$1e={India:142,Germany:98,Spain:76,Netherlands:61,Italy:54,Sweden:43,France:38,"United Kingdom":34,Canada:18,Brazil:14,"United States of America":21,Australia:9,Japan:7},yns=[{name:"Desktop Web",value:52},{name:"Mobile Web",value:26},{name:"Circle iOS",value:14},{name:"Circle Android",value:8}],bns=[{name:"James Park",value:10},{name:"Honey User",value:7},{name:"Carlos Ramirez",value:6},{name:"Mei Wong",value:4},{name:"Robert Fox",value:3}],xns=[{name:"James Park",value:8},{name:"Mei Wong",value:5},{name:"Carlos Ramirez",value:4},{name:"Dianne Russell",value:2},{name:"Ravi Patel",value:1}],wns=[{name:"Carlos Ramirez",value:42},{name:"Mei Wong",value:38},{name:"Robert Fox",value:29},{name:"Dianne Russell",value:21},{name:"Ravi Patel",value:14}],kns=[{name:"Mei Wong",value:312},{name:"Carlos Ramirez",value:286},{name:"Robert Fox",value:214},{name:"Esther Howard",value:168},{name:"Kwame Adebayo",value:142}],Sns=nL([{source:"Direct",visitors:1280},{source:"Google",visitors:940},{source:"Twitter / X",visitors:420},{source:"Email",visitors:310},{source:"LinkedIn",visitors:180},{source:"Referral",visitors:118}],"visitors"),Cns=nL([{page:"/",visitors:1520},{page:"/spaces/general",visitors:860},{page:"/courses/acl-recovery",visitors:540},{page:"/events",visitors:430},{page:"/pricing",visitors:280},{page:"/c/welcome",visitors:160}],"visitors"),jns=nL(Object.entries($1e).map(([t,e])=>({country:t,visitors:Math.round(e*6+12)})).sort((t,e)=>e.visitors-t.visitors).slice(0,8),"visitors"),Ens=nL([{device:"Desktop",visitors:1820},{device:"Mobile",visitors:1060},{device:"Tablet",visitors:268}],"visitors"),Nns=nL([{browser:"Chrome",visitors:1980},{browser:"Safari",visitors:740},{browser:"Firefox",visitors:240},{browser:"Edge",visitors:148},{browser:"Other",visitors:40}],"visitors"),Tns=nL([{os:"macOS",visitors:1120},{os:"Windows",visitors:980},{os:"iOS",visitors:640},{os:"Android",visitors:380},{os:"Linux",visitors:28}],"visitors"),Aq=[{space:"General",group:"Welcome",posts:1840,comments:2210,likes:5400,score:98},{space:"Injury Prevention",group:"Community",posts:1420,comments:1680,likes:4120,score:91},{space:"Nutrition",group:"Learning",posts:1180,comments:1340,likes:3360,score:86},{space:"Sports Science",group:"Learning",posts:980,comments:1120,likes:2780,score:79},{space:"Strength & Power",group:"Community",posts:760,comments:880,likes:2100,score:72},{space:"Recovery",group:"Community",posts:540,comments:610,likes:1480,score:64}],_ns=[{post:"ACL Recovery Protocol: 6-Month Data Review",likes:248,comments:96,views:3820,score:98},{post:"Nutrition Periodization for Match-Day Performance",likes:221,comments:84,views:3540,score:96},{post:"GPS Load Monitoring — Are We Over-Relying on Data?",likes:198,comments:112,views:3120,score:94},{post:"Mental Resilience Training: Pre-Season Framework",likes:187,comments:73,views:2890,score:91},{post:"Hamstring Injury Prevention — Nordic Curl Variations",likes:176,comments:58,views:2740,score:89}],Ans=[{post:"Sleep Quality & Youth Player Development",likes:42,comments:18,views:640,score:71},{post:"Creatine in Elite Football — Meta Analysis",likes:38,comments:14,views:580,score:68},{post:"Return-to-Play: Who Has Final Say?",likes:31,comments:22,views:510,score:64},{post:"Hydration Strategies for Hot-Climate Matches",likes:27,comments:9,views:430,score:58}],Pns=[{comment:"This completely changed how we periodize the pre-season block.",likes:64},{comment:"Underrated point about eccentric load — we saw the same in U21s.",likes:41},{comment:"Do you have the raw GPS dataset? Would love to replicate this.",likes:33},{comment:"Bookmarking. The RTP decision matrix is gold.",likes:28}],Rns=[{name:"James Park",conversations:18,direct:12,group:6},{name:"Mei Wong",conversations:14,direct:9,group:5},{name:"Carlos Ramirez",conversations:11,direct:7,group:4},{name:"Dianne Russell",conversations:8,direct:5,group:3},{name:"Ravi Patel",conversations:5,direct:4,group:1}],Ins=[{name:"Mei Wong",ios:"2h ago",android:"—",sessions:142},{name:"Carlos Ramirez",ios:"5h ago",android:"1d ago",sessions:118},{name:"Kwame Adebayo",ios:"—",android:"3h ago",sessions:96},{name:"Ravi Patel",ios:"1d ago",android:"—",sessions:74},{name:"Esther Howard",ios:"—",android:"2d ago",sessions:52}],Mns=[{name:"SpatialChat Communities Injury Prevention Summit",date:"Jun 18, 2026",rsvps:312,attendees:248},{name:"Match-Day Nutrition Workshop",date:"Jun 04, 2026",rsvps:218,attendees:176},{name:"AMA: Return-to-Play Decisions",date:"May 22, 2026",rsvps:164,attendees:121},{name:"Strength & Power Meetup",date:"May 09, 2026",rsvps:132,attendees:98}],Lns=[{name:"Carlos Ramirez",attended:14,last:"Jun 18, 2026"},{name:"Mei Wong",attended:12,last:"Jun 18, 2026"},{name:"Robert Fox",attended:9,last:"Jun 04, 2026"},{name:"Dianne Russell",attended:7,last:"May 22, 2026"},{name:"Ravi Patel",attended:5,last:"May 09, 2026"}],Dns=[{paywall:"Pro Membership",amount:"$2,480",transactions:42},{paywall:"ACL Recovery Course",amount:"$1,260",transactions:28},{paywall:"Annual Plan",amount:"$980",transactions:11},{paywall:"Summit Ticket",amount:"$640",transactions:32},{paywall:"Coaching Add-on",amount:"$320",transactions:8}],$ns=[{course:"ACL Recovery",enrollments:312,started:286,completed:198,rate:"64%"},{course:"Periodization 101",enrollments:268,started:241,completed:162,rate:"60%"},{course:"Load Monitoring",enrollments:214,started:188,completed:119,rate:"56%"},{course:"Sport Psychology",enrollments:176,started:150,completed:92,rate:"52%"},{course:"Nutrition Basics",enrollments:142,started:121,completed:88,rate:"62%"}],Ons=[{student:"Carlos Ramirez",email:"carlos.r@pensil.so",lessons:24,enrollments:3,started:3,completed:2,rate:"71%",last:"2h ago"},{student:"Mei Wong",email:"mei.wong@pensil.so",lessons:21,enrollments:3,started:2,completed:2,rate:"68%",last:"5h ago"},{student:"Robert Fox",email:"robert.fox@pensil.so",lessons:18,enrollments:2,started:2,completed:1,rate:"55%",last:"1d ago"},{student:"Dianne Russell",email:"dianne.r@pensil.so",lessons:14,enrollments:2,started:1,completed:1,rate:"48%",last:"3d ago"}],Fns=[{student:"Floyd Miles",email:"floyd.miles@pensil.so",course:"Periodization 101",slug:"periodization-101",done:3,rate:"18%",last:"3w ago"},{student:"Theresa Webb",email:"theresa.webb@pensil.so",course:"Load Monitoring",slug:"load-monitoring",done:2,rate:"12%",last:"1mo ago"},{student:"Guy Hawkins",email:"guy.hawkins@pensil.so",course:"ACL Recovery",slug:"acl-recovery",done:4,rate:"22%",last:"2w ago"}],Bns=[{quiz:"ACL Return-to-Play Assessment",course:"ACL Recovery",attempts:142,avg:"82%",pass:"76%"},{quiz:"Periodization Fundamentals",course:"Periodization 101",attempts:118,avg:"78%",pass:"71%"},{quiz:"GPS Load Metrics",course:"Load Monitoring",attempts:96,avg:"74%",pass:"68%"}],Uns={Active:"bg-emerald-50 text-emerald-600 dark:bg-emerald-500/10",Inactive:"bg-muted text-muted-foreground",Invited:"bg-amber-50 text-amber-600 dark:bg-amber-500/10"},zns=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],Vns=[["just now",0],["2h ago",2],["5h ago",5],["1d ago",24],["3d ago",72],["1w ago",168],["2w ago",336],["1mo ago",720],["—",9999999]],iZe=["Carlos Ramirez","Mei Wong","Robert Fox","Dianne Russell","Kwame Adebayo","Ravi Patel","Esther Howard","Jenny Wilson","Cody Fisher","Albert Flores","Savannah Nguyen","Devon Lane","Jane Cooper","Ronald Richards","Kristin Watson","Cameron Williamson","Brooklyn Simmons","Leslie Alexander","Floyd Miles","Theresa Webb"],aZe=(()=>{const t=tae(987654);return iZe.map((e,n)=>{const r=n>=iZe.length-3?"Invited":t()<.22?"Inactive":"Active",s=r==="Invited"?8:Math.floor(t()*7),[i,o]=Vns[s],l=r==="Invited"?0:Math.round(20+t()*180),c=Math.floor(t()*12),d=1+Math.floor(t()*27),u=t()<.3?2025:2026;return{name:e,email:e.toLowerCase().replace(/[^a-z]+/g,".")+"@pensil.so",role:n===0?"Admin":n<3?"Moderator":"Member",joined:`${zns[c]} ${d}, ${u}`,joinedTs:u*1e4+c*100+d,lastActive:i,activeRank:o,posts:l,status:r}})})(),ha=t=>({value:t,dir:"up"}),SH=t=>({value:t,dir:"down"}),Hns=t=>({value:t,dir:"flat"}),Gns={overview:[{title:"Total members",value:"533"},{title:"Active members",period:!0,value:"2",delta:SH("60.0%")},{title:"MAU",period:!0,value:"0%",delta:SH("59.6%")},{title:"Daily active members",period:!0,value:"1",delta:Hns("0.0%")},{title:"Inactive members",period:!0,value:"531",delta:ha("0.4%")},{title:"Invitation pending",value:"19"}],members:[{title:"Total members",value:"533",delta:ha("3.2%")},{title:"Active members",period:!0,value:"2",delta:SH("60.0%")},{title:"New members",period:!0,value:"17",delta:ha("12.0%")}],website:[{title:"Unique visitors",period:!0,value:"3,148",delta:ha("8.4%")},{title:"Page views",period:!0,value:"9,420",delta:ha("6.1%")},{title:"Bounce rate",period:!0,value:"38%",delta:SH("2.3%")}],spaces:[],posts:[{title:"Total posts",period:!0,value:"486",delta:ha("7.5%")},{title:"Total comments",period:!0,value:"1,902",delta:ha("5.2%")},{title:"Member posts",period:!0,value:"461",delta:ha("6.8%")},{title:"Total post views",period:!0,value:"38,420",delta:ha("9.1%")},{title:"Unique member post views",period:!0,value:"12,180",delta:ha("4.5%")},{title:"Unique public post views",period:!0,value:"4,260",delta:ha("2.2%")}],messages:[{title:"Conversations",period:!0,value:"412",delta:ha("5.0%")},{title:"Chat messages",period:!0,value:"2,418",delta:ha("6.8%")},{title:"Message senders",period:!0,value:"96",delta:ha("3.1%")}],devices:[{title:"Mobile web devices",period:!0,value:"214",delta:ha("4.2%")},{title:"Total iOS devices",period:!0,value:"168",delta:ha("6.0%")},{title:"Total Android devices",period:!0,value:"92",delta:ha("1.8%")}],events:[{title:"Events completed",period:!0,value:"18",delta:ha("20.0%")},{title:"Total RSVPs",period:!0,value:"1,270",delta:ha("9.2%")},{title:"Live attendance",period:!0,value:"72%",delta:ha("3.0%")},{title:"Tickets sold",period:!0,value:"214",delta:ha("11.4%")},{title:"Event revenue",period:!0,value:"$3,240",delta:ha("15.6%")}],payments:[{title:"Transactions",period:!0,value:"121",delta:ha("9.0%")},{title:"Revenue",period:!0,value:"$5,040",delta:ha("14.2%")}],courses:[{title:"Course enrollments",period:!0,value:"1,112",delta:ha("8.1%")},{title:"Course completions",period:!0,value:"659",delta:ha("6.4%")},{title:"Completion rate",period:!0,value:"59%",delta:ha("2.5%")}]},V5={initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.25,ease:"easeOut"}};function Wns({value:t}){const e=t.match(/^([^\d-]*)(-?[\d,]*\.?\d+)(.*)$/),[n,r]=y.useState(e?0:NaN);if(y.useEffect(()=>{if(!e)return;const i=parseFloat(e[2].replace(/,/g,""));let o=0;const l=performance.now(),c=d=>{const u=Math.min(1,(d-l)/750);r(i*(1-Math.pow(1-u,3))),u<1&&(o=requestAnimationFrame(c))};return o=requestAnimationFrame(c),()=>cancelAnimationFrame(o)},[t]),!e)return a.jsx(a.Fragment,{children:t});const s=(e[2].split(".")[1]||"").length;return a.jsxs(a.Fragment,{children:[e[1],n.toLocaleString(void 0,{minimumFractionDigits:s,maximumFractionDigits:s}),e[3]]})}function qns({title:t,periodLabel:e,value:n,delta:r}){return a.jsxs(it.div,{...V5,className:"rounded-xl border border-border bg-card p-5 transition-shadow duration-150 ease-linear hover:shadow-card-hover",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm font-medium text-foreground",children:t}),e&&a.jsx("span",{className:"text-xs text-muted-foreground",children:e})]}),a.jsx("p",{className:"mt-3 text-3xl font-semibold tracking-tight text-foreground",children:a.jsx(Wns,{value:n})}),r&&a.jsxs("div",{className:ee("mt-2 inline-flex items-center gap-0.5 rounded-md px-1.5 py-0.5 text-xs font-medium",r.dir==="up"&&"bg-emerald-50 text-emerald-600 dark:bg-emerald-500/10",r.dir==="down"&&"bg-rose-50 text-rose-500 dark:bg-rose-500/10",r.dir==="flat"&&"bg-muted text-muted-foreground"),children:[r.dir==="up"&&a.jsx(R8,{className:"h-3 w-3"}),r.dir==="down"&&a.jsx(Srt,{className:"h-3 w-3"}),r.dir==="flat"&&a.jsx(xa,{className:"h-3 w-3"}),r.value]})]})}function cs({title:t,children:e,className:n,info:r}){return a.jsxs(it.div,{...V5,className:ee("rounded-xl border border-border bg-card p-5",n),children:[a.jsxs("div",{className:"mb-4 flex items-center gap-1.5",children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:t}),r&&a.jsx("span",{title:r,"aria-label":r,className:"inline-flex h-4 w-4 cursor-help items-center justify-center text-muted-foreground transition-colors hover:text-foreground",children:a.jsx(nS,{className:"h-3.5 w-3.5"})})]}),e]})}const hhe=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];function oZe(t){const e=Math.max(0,Math.round(t||0));if(!e)return"No tracked time";const n=Math.floor(e/3600),r=Math.floor(e%3600/60);return n?`${n}h ${r}m`:r?`${r}m`:`${e}s`}function Kns(t,e){if(!t)return"Selected date range";try{const n=new Intl.DateTimeFormat(void 0,{dateStyle:"medium",timeZone:e});return`${n.format(new Date(t.from))} – ${n.format(new Date(t.to))}`}catch{return`${t.from.slice(0,10)} – ${t.to.slice(0,10)}`}}function Yns({cells:t,period:e,timezone:n="Asia/Kolkata"}){if(!t||t.length===0)return a.jsx(Wh,{text:"No activity yet in this period."});const r=Array.from({length:7},(o,l)=>Array.from({length:24},(c,d)=>({dow:l,hour:d,value:0,activeUsers:0,timeSpentSec:0})));let s=0;for(const o of t)if(o.dow>=0&&o.dow<7&&o.hour>=0&&o.hour<24){const l={dow:o.dow,hour:o.hour,value:Number.isFinite(o.value)?Math.max(0,o.value):0,activeUsers:Number.isFinite(o.activeUsers)?Math.max(0,o.activeUsers):0,timeSpentSec:Number.isFinite(o.timeSpentSec)?Math.max(0,o.timeSpentSec):0};r[o.dow][o.hour]=l,l.value>s&&(s=l.value)}const i=Kns(e,n);return a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("div",{className:"min-w-[720px]",children:[a.jsx("div",{className:"mb-1 flex items-center gap-1 pl-9",children:a.jsx("div",{className:"grid flex-1 gap-[2px]",style:{gridTemplateColumns:"repeat(24, minmax(0, 1fr))"},children:Array.from({length:24}).map((o,l)=>a.jsx("span",{className:"text-center text-[9px] text-muted-foreground",children:l%3===0?l:""},l))})}),r.map((o,l)=>a.jsxs("div",{className:"mb-[2px] flex items-center gap-1",children:[a.jsx("span",{className:"w-8 shrink-0 pr-2 text-right text-[11px] text-muted-foreground",children:hhe[l].slice(0,3)}),a.jsx("div",{className:"grid flex-1 gap-[2px]",style:{gridTemplateColumns:"repeat(24, minmax(0, 1fr))"},children:o.map((c,d)=>{const u=s>0?c.value/s:0,h=c.value===0?"hsl(var(--muted))":`hsl(var(--primary) / ${(.15+.85*u).toFixed(2)})`,m=(d+1)%24,f=`${String(d).padStart(2,"0")}:00–${String(m).padStart(2,"0")}:00${d===23?" next day":""}`,p=`${hhe[l]} ${f}: ${c.value} activities, ${c.activeUsers} active users, ${oZe(c.timeSpentSec)}`;return a.jsx(uAe,{side:"top",hint:a.jsxs("div",{className:"space-y-1",children:[a.jsx("div",{className:"font-medium",children:c.value?`${c.value.toLocaleString()} activities`:"No activity"}),a.jsxs("div",{children:[hhe[l]," · ",f]}),a.jsxs("div",{children:["Date range: ",i]}),a.jsxs("div",{children:["Active users: ",c.activeUsers.toLocaleString()]}),a.jsxs("div",{children:["Time spent: ",oZe(c.timeSpentSec)]}),a.jsx("div",{className:"text-[10px] opacity-80",children:"For tracked sessions started in this hour"}),a.jsxs("div",{className:"text-[10px] opacity-80",children:["Timezone: ",n]})]}),children:a.jsx("button",{type:"button","aria-label":p,className:"h-6 w-full rounded-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",style:{backgroundColor:h}})},d)})})]},l)),a.jsxs("div",{className:"mt-3 flex items-center justify-end gap-1.5 text-[11px] text-muted-foreground",children:[a.jsx("span",{children:"Less"}),a.jsx("span",{className:"h-3 w-3 rounded-sm",style:{backgroundColor:"hsl(var(--muted))"}}),a.jsx("span",{className:"h-3 w-3 rounded-sm",style:{backgroundColor:"hsl(var(--primary) / 0.35)"}}),a.jsx("span",{className:"h-3 w-3 rounded-sm",style:{backgroundColor:"hsl(var(--primary) / 0.65)"}}),a.jsx("span",{className:"h-3 w-3 rounded-sm",style:{backgroundColor:"hsl(var(--primary))"}}),a.jsx("span",{children:"More"})]})]})})}function Qns({items:t,badge:e}){return t.length?a.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:t.map(n=>a.jsx(qns,{...n,periodLabel:n.period?e:void 0},n.title))}):null}function J3t({name:t}){return a.jsxs("div",{className:"flex items-center justify-end gap-4 pt-2 text-xs text-muted-foreground",children:[a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"h-0.5 w-4 rounded bg-primary"}),t]}),a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"h-0 w-4 border-t border-dashed border-muted-foreground"}),"Previous"]})]})}function X3t({period:t}){const e=X5e(t);return a.jsxs("div",{className:"flex flex-wrap items-center gap-4 pt-3 text-xs text-muted-foreground",children:[a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-primary"}),e.label]}),a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"h-2.5 w-2.5 rounded-full bg-primary/30"}),"Previous ",e.label.replace("Last ","")]})]})}function mc({data:t,name:e,compare:n}){const r=`g-${e.replace(/\W/g,"")}`;return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-72",children:a.jsx(QM,{width:"100%",height:"100%",children:a.jsxs(P3t,{data:t,margin:{top:8,right:8,left:-12,bottom:0},children:[a.jsx("defs",{children:a.jsxs("linearGradient",{id:r,x1:"0",y1:"0",x2:"0",y2:"1",children:[a.jsx("stop",{offset:"0%",stopColor:Ci.primary,stopOpacity:.22}),a.jsx("stop",{offset:"100%",stopColor:Ci.primary,stopOpacity:0})]})}),a.jsx(tL,{strokeDasharray:"3 3",vertical:!1,stroke:Ci.grid}),a.jsx(rb,{dataKey:"x",...J5e}),a.jsx(Ug,{...hE,width:44}),a.jsx(bu,{content:a.jsx(A9,{}),cursor:{stroke:Ci.grid}}),n&&a.jsx(Tg,{type:"monotone",dataKey:"prev",name:"Previous",stroke:Ci.axis,strokeWidth:1.5,strokeDasharray:"4 4",dot:!1,animationDuration:500}),a.jsx(OS,{type:"monotone",dataKey:"value",name:e,stroke:Ci.primary,strokeWidth:2,fill:`url(#${r})`,animationDuration:650})]})})}),n&&a.jsx(J3t,{name:e})]})}function H$({data:t,name:e,compare:n}){return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"h-72",children:a.jsx(QM,{width:"100%",height:"100%",children:a.jsxs(A3t,{data:t,margin:{top:8,right:8,left:-12,bottom:0},children:[a.jsx(tL,{strokeDasharray:"3 3",vertical:!1,stroke:Ci.grid}),a.jsx(rb,{dataKey:"name",...hE}),a.jsx(Ug,{...hE,width:44}),a.jsx(bu,{content:a.jsx(A9,{}),cursor:{fill:"hsl(var(--muted) / 0.5)"}}),n&&a.jsx(Bg,{dataKey:"prev",name:"Previous",fill:"hsl(var(--muted-foreground) / 0.3)",radius:[4,4,0,0],maxBarSize:18,animationDuration:500}),a.jsx(Bg,{dataKey:"value",name:e,fill:Ci.primary,radius:[6,6,0,0],maxBarSize:n?18:44,animationDuration:650})]})})}),n&&a.jsx(J3t,{name:e})]})}function mE({data:t,series:e,compare:n}){return a.jsx("div",{className:"h-72",children:a.jsx(QM,{width:"100%",height:"100%",children:a.jsxs(rts,{data:t,margin:{top:8,right:8,left:-12,bottom:0},children:[a.jsx(tL,{strokeDasharray:"3 3",vertical:!1,stroke:Ci.grid}),a.jsx(rb,{dataKey:"x",...J5e}),a.jsx(Ug,{...hE,width:44}),a.jsx(bu,{content:a.jsx(A9,{}),cursor:{stroke:Ci.grid}}),n&&e.map(r=>a.jsx(Tg,{type:"monotone",dataKey:`${r.key}Prev`,name:`${r.name} (prev)`,stroke:r.color,strokeOpacity:.35,strokeWidth:1.5,strokeDasharray:"4 4",dot:!1,animationDuration:500},`${r.key}-p`)),e.map(r=>a.jsx(Tg,{type:"monotone",dataKey:r.key,name:r.name,stroke:r.color,strokeWidth:2,dot:!1,animationDuration:650},r.key))]})})})}function Zns({data:t}){return a.jsx("div",{className:"h-72",children:a.jsx(QM,{width:"100%",height:"100%",children:a.jsxs(P3t,{data:t,margin:{top:8,right:8,left:-12,bottom:0},children:[a.jsx(tL,{strokeDasharray:"3 3",vertical:!1,stroke:Ci.grid}),a.jsx(rb,{dataKey:"x",...J5e}),a.jsx(Ug,{yAxisId:"l",...hE,width:44}),a.jsx(Ug,{yAxisId:"r",orientation:"right",...hE,width:38,tickFormatter:e=>`${e}%`}),a.jsx(bu,{content:a.jsx(A9,{}),cursor:{stroke:Ci.grid}}),a.jsx(Tg,{yAxisId:"l",type:"monotone",dataKey:"visitors",name:"Unique visitors",stroke:Ci.primary,strokeWidth:2,dot:!1}),a.jsx(Tg,{yAxisId:"l",type:"monotone",dataKey:"views",name:"Page views",stroke:Ci.primaryLight,strokeWidth:2,dot:!1}),a.jsx(Tg,{yAxisId:"r",type:"monotone",dataKey:"bounce",name:"Bounce rate %",stroke:Ci.warning,strokeWidth:2,strokeDasharray:"4 4",dot:!1})]})})})}function d2({data:t,unit:e="%",onSelect:n,selectLabel:r}){return a.jsxs("div",{className:"flex h-72 flex-col items-center gap-3 sm:flex-row sm:gap-0",children:[a.jsx("div",{className:"h-40 w-full min-w-0 shrink-0 sm:h-full sm:w-1/2",children:a.jsx(QM,{width:"100%",height:"100%",children:a.jsxs(sts,{children:[a.jsx(bu,{content:a.jsx(A9,{})}),a.jsx(V0,{data:t,dataKey:"value",nameKey:"name",innerRadius:"55%",outerRadius:"88%",paddingAngle:3,stroke:"none",onClick:n?(s,i)=>n(t[i]):void 0,className:n?"cursor-pointer focus:outline-none":void 0,children:t.map((s,i)=>a.jsx(C9,{fill:xH[i%xH.length]},i))})]})})}),a.jsx("ul",{className:"w-full flex-1 space-y-2.5 overflow-hidden",children:t.map((s,i)=>{const o=a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"flex min-w-0 items-center gap-2 text-muted-foreground",children:[a.jsx("span",{className:"h-2.5 w-2.5 shrink-0 rounded-full",style:{background:xH[i%xH.length]}}),a.jsx("span",{className:ee("truncate",n&&"group-hover:text-foreground group-hover:underline"),children:s.name})]}),a.jsxs("span",{className:"shrink-0 font-semibold text-foreground",children:[s.value,e]})]});return a.jsx("li",{className:"text-sm",children:n?a.jsx("button",{type:"button",onClick:()=>n(s),"aria-label":r==null?void 0:r(s),className:"group -mx-2 flex w-[calc(100%+1rem)] items-center justify-between gap-3 rounded-md px-2 py-0.5 text-left transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:o}):a.jsx("div",{className:"flex items-center justify-between gap-3",children:o})},s.name)})})]})}function tIe({period:t}){return a.jsxs("div",{className:"overflow-x-auto",children:[a.jsxs("div",{className:"min-w-[620px]",children:[vns.map((e,n)=>a.jsxs("div",{className:"mb-1 flex items-center gap-1",children:[a.jsx("span",{className:"w-24 shrink-0 pr-2 text-right text-[11px] text-muted-foreground",children:uhe[n]}),a.jsx("div",{className:"grid flex-1 gap-1",style:{gridTemplateColumns:"repeat(7, minmax(0, 1fr))"},children:e.map((r,s)=>a.jsx("div",{title:`${sZe[s]} · ${uhe[n]} — ${r}`,className:ee("flex h-9 items-center justify-center rounded-md text-xs tabular-nums transition-colors",r>0?"bg-primary font-medium text-primary-foreground":"bg-primary/[0.06] text-muted-foreground"),children:r},s))})]},uhe[n])),a.jsxs("div",{className:"mt-1 flex items-center gap-1",children:[a.jsx("span",{className:"w-24 shrink-0"}),a.jsx("div",{className:"grid flex-1 gap-1",style:{gridTemplateColumns:"repeat(7, minmax(0, 1fr))"},children:sZe.map(e=>a.jsx("span",{className:"text-center text-[11px] text-muted-foreground",children:e},e))})]})]}),a.jsx(X3t,{period:t})]})}const e4t=900,Jns=450,Xns=([t,e])=>[(t+180)/360*e4t,(90-e)/180*Jns],lZe=t=>t.map((e,n)=>{const[r,s]=Xns(e);return`${n?"L":"M"}${r.toFixed(1)} ${s.toFixed(1)}`}).join("")+"Z";function ers(t){return t.type==="Polygon"?t.coordinates.map(lZe).join(""):t.type==="MultiPolygon"?t.coordinates.map(e=>e.map(lZe).join("")).join(""):""}function nIe({period:t,label:e="Members"}){const[n,r]=y.useState([]);y.useEffect(()=>{let i=!0;return fetch("/world-countries.geo.json").then(o=>o.json()).then(o=>i&&r(o.features||[])).catch(()=>{}),()=>{i=!1}},[]);const s=Math.max(...Object.values($1e));return a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-start gap-4",children:[a.jsxs("div",{className:"hidden shrink-0 flex-col items-start gap-1 pt-2 sm:flex",children:[a.jsx("div",{className:"h-28 w-3 rounded-full",style:{background:"linear-gradient(to top, hsl(var(--primary) / 0.12), hsl(var(--primary)))"}}),a.jsx("span",{className:"text-[10px] text-muted-foreground",children:e})]}),n.length===0?a.jsx(sr,{className:"aspect-[900/372] w-full"}):a.jsx("svg",{viewBox:`0 0 ${e4t} 372`,className:"h-auto w-full",role:"img","aria-label":"Distribution by country",children:n.map((i,o)=>{var d,u,h;if(((d=i.properties)==null?void 0:d.name)==="Antarctica")return null;const l=$1e[(u=i.properties)==null?void 0:u.name]||0,c=l?`hsl(var(--primary) / ${(.25+.75*(l/s)).toFixed(2)})`:"hsl(var(--muted))";return a.jsx("path",{d:ers(i.geometry),fill:c,stroke:"hsl(var(--card))",strokeWidth:.5,children:a.jsx("title",{children:`${(h=i.properties)==null?void 0:h.name}: ${l}`})},o)})})]}),a.jsx(X3t,{period:t})]})}const trs=t=>t.split(" ").map(e=>e[0]).join("");function y0(t,e){return a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full bg-primary/10 text-[10px] font-semibold text-primary",children:trs(t)}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:t}),e&&a.jsx("p",{className:"truncate text-xs text-muted-foreground",children:e})]})]})}function SX(t){return a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx("div",{className:"h-1.5 w-16 overflow-hidden rounded-full bg-muted",children:a.jsx("div",{className:"h-full rounded-full bg-primary",style:{width:`${t}%`}})}),a.jsxs("span",{className:"w-10 text-right tabular-nums",children:[t,"%"]})]})}function ti({title:t,columns:e,rows:n,badge:r}){return a.jsxs(it.div,{...V5,className:"overflow-hidden rounded-xl border border-border bg-card",children:[a.jsxs("div",{className:"flex items-center gap-2 border-b border-border px-5 py-4",children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:t}),r!=null&&a.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:r})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsx("tr",{className:"bg-muted/40",children:e.map(s=>a.jsx("th",{className:ee("whitespace-nowrap px-5 py-3 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",s.align==="right"?"text-right":"text-left"),children:s.label},s.key))})}),a.jsx("tbody",{className:"divide-y divide-border",children:n.map((s,i)=>a.jsx("tr",{className:"transition-colors duration-150 ease-linear hover:bg-muted/40",children:e.map(o=>a.jsx("td",{className:ee("px-5 py-3 text-sm text-muted-foreground",o.align==="right"&&"text-right tabular-nums"),children:o.render?o.render(s):s[o.key]},o.key))},i))})]})})]})}function Ij(t,e,n){return a.jsx(ti,{title:t,columns:[{key:"name",label:"Member",render:r=>y0(r.name)},{key:"value",label:e,align:"right",render:r=>a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"font-semibold text-foreground",children:r.value}),a.jsx("span",{className:"ml-2 text-muted-foreground",children:"—"})]})}],rows:n})}const nrs={name:t=>t.name.toLowerCase(),role:t=>t.role,joined:t=>t.joinedTs,lastActive:t=>t.activeRank,posts:t=>t.posts,status:t=>t.status};function rrs(){const[t,e]=y.useState(""),[n,r]=y.useState("posts"),[s,i]=y.useState(!1),[o,l]=y.useState(8),c=y.useMemo(()=>{const m=t.trim().toLowerCase(),f=m?aZe.filter(g=>g.name.toLowerCase().includes(m)||g.email.includes(m)):aZe.slice(),p=nrs[n];return f.sort((g,v)=>{const b=p(g),x=p(v),w=typeof b=="number"&&typeof x=="number"?b-x:String(b).localeCompare(String(x));return s?w:-w}),f},[t,n,s]),d=c.slice(0,o),u=m=>{m===n?i(f=>!f):(r(m),i(m==="name"||m==="role"))},h=[{key:"name",label:"Member"},{key:"role",label:"Role"},{key:"joined",label:"Joined"},{key:"lastActive",label:"Last active"},{key:"posts",label:"Posts",align:"right"},{key:"status",label:"Status"}];return a.jsxs(it.div,{...V5,className:"overflow-hidden rounded-xl border border-border bg-card",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 border-b border-border p-5",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"All members"}),a.jsx("span",{className:"rounded-md bg-muted px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:c.length})]}),a.jsxs("div",{className:"relative",children:[a.jsx(hs,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{value:t,onChange:m=>{e(m.target.value),l(8)},placeholder:"Search members…",className:"h-8 w-52 rounded-lg border border-border bg-background pl-8 pr-3 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/30"})]})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsx("tr",{className:"bg-muted/40",children:h.map(m=>a.jsx("th",{className:ee("px-5 py-3 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",m.align==="right"?"text-right":"text-left"),children:a.jsxs("button",{onClick:()=>u(m.key),className:ee("inline-flex items-center gap-1 transition-colors hover:text-foreground",m.align==="right"&&"flex-row-reverse"),children:[m.label,n===m.key&&(s?a.jsx(M8,{className:"h-3 w-3"}):a.jsx(li,{className:"h-3 w-3"}))]})},m.key))})}),a.jsxs("tbody",{className:"divide-y divide-border",children:[d.map(m=>a.jsxs("tr",{className:"transition-colors duration-150 ease-linear hover:bg-muted/40",children:[a.jsx("td",{className:"px-5 py-3",children:y0(m.name,m.email)}),a.jsx("td",{className:"px-5 py-3 text-sm text-muted-foreground",children:m.role}),a.jsx("td",{className:"px-5 py-3 text-sm text-muted-foreground",children:m.joined}),a.jsx("td",{className:"px-5 py-3 text-sm text-muted-foreground",children:m.lastActive}),a.jsx("td",{className:"px-5 py-3 text-right text-sm font-medium tabular-nums text-foreground",children:m.posts.toLocaleString()}),a.jsx("td",{className:"px-5 py-3",children:a.jsx("span",{className:ee("rounded-md px-2 py-0.5 text-xs font-medium",Uns[m.status]),children:m.status})})]},m.email)),d.length===0&&a.jsx("tr",{children:a.jsxs("td",{colSpan:6,className:"px-5 py-10 text-center text-sm text-muted-foreground",children:["No members match “",t,"”."]})})]})]})}),a.jsxs("div",{className:"flex items-center justify-between gap-3 border-t border-border px-5 py-3 text-xs text-muted-foreground",children:[a.jsxs("span",{children:["Showing ",d.length," of ",c.length]}),o<c.length&&a.jsx("button",{onClick:()=>l(m=>m+8),className:"rounded-lg border border-border px-3 py-1.5 text-sm font-medium text-foreground transition-colors hover:bg-muted/50",children:"Load more"})]})]})}const Pq=[{key:"overview",label:"Overview",icon:Fc},{key:"members",label:"Members",icon:wr},{key:"website",label:"Website",icon:Qd},{key:"spaces",label:"Groups",icon:dee},{key:"posts",label:"Posts & Comments",icon:Vi},{key:"messages",label:"Messages",icon:Ii},{key:"devices",label:"Devices",icon:ZBt},{key:"events",label:"Events",icon:I8},{key:"courses",label:"Courses",icon:kE}],srs=Object.fromEntries(Pq.map(t=>[t.key,t.label])),Po="grid gap-4 lg:grid-cols-2";function irs({period:t,compare:e}){const n=y.useMemo(()=>ku(t,"mam",430,.1),[t]),r=y.useMemo(()=>ku(t,"mnm",60,.3),[t]),s=y.useMemo(()=>ku(t,"activity",260,.22),[t]);return a.jsxs(a.Fragment,{children:[a.jsx(cs,{title:"Activity scores",children:a.jsx(mc,{data:s,name:"Activity score",compare:e})}),a.jsx(cs,{title:"Popular day & time",children:a.jsx(tIe,{period:t})}),a.jsx(cs,{title:"Member distribution by country",children:a.jsx(nIe,{period:t})}),a.jsxs("div",{className:Po,children:[a.jsx(cs,{title:"Monthly active members",children:a.jsx(mc,{data:n,name:"Active members",compare:e})}),a.jsx(cs,{title:"Monthly new members",children:a.jsx(mc,{data:r,name:"New members",compare:e})})]}),a.jsx(ti,{title:"Popular spaces",columns:[{key:"space",label:"Space"},{key:"group",label:"Space group"},{key:"score",label:"Score",align:"right",render:i=>a.jsx("span",{className:"font-semibold text-foreground",children:i.score})}],rows:Aq})]})}function ars({period:t,compare:e}){const n=y.useMemo(()=>z5(t,[{key:"active",base:40},{key:"neu",base:60}]),[t]),r=y.useMemo(()=>ku(t,"memactivity",240,.22),[t]);return a.jsxs(a.Fragment,{children:[a.jsx(cs,{title:"Total members over time",children:a.jsx(mE,{data:n,compare:e,series:[{key:"active",name:"Active members",color:Ci.primary},{key:"neu",name:"New members",color:Ci.primaryLight}]})}),a.jsx(cs,{title:"Activity scores",children:a.jsx(mc,{data:r,name:"Activity score",compare:e})}),a.jsx(cs,{title:"Popular day & time",children:a.jsx(tIe,{period:t})}),a.jsx(cs,{title:"Member distribution by country",children:a.jsx(nIe,{period:t})}),a.jsxs("div",{className:Po,children:[Ij("Top members","Score",bns),Ij("Active commenters","Comments",xns)]}),a.jsxs("div",{className:Po,children:[Ij("Post starters","Posts",wns),Ij("Most appreciated","Likes",kns)]}),a.jsx(rrs,{})]})}function ors({period:t}){const e=y.useMemo(()=>{const s=z5(t,[{key:"visitors",base:1100},{key:"views",base:2800}]),i=gns(t,"bounce",40);return s.map((o,l)=>({...o,bounce:i[l].value}))},[t]),n={key:"percent",label:"Percent",align:"right",render:s=>SX(s.percent)},r={key:"visitors",label:"Visitors",align:"right",render:s=>a.jsx("span",{className:"font-medium text-foreground",children:s.visitors.toLocaleString()})};return a.jsxs(a.Fragment,{children:[a.jsx(cs,{title:"Activity",children:a.jsx(Zns,{data:e})}),a.jsxs("div",{className:Po,children:[a.jsx(ti,{title:"Traffic sources",columns:[{key:"source",label:"Source"},r,n],rows:Sns}),a.jsx(ti,{title:"Pages",columns:[{key:"page",label:"Page",render:s=>a.jsx("span",{className:"font-medium text-foreground",children:s.page})},r,n],rows:Cns})]}),a.jsxs("div",{className:Po,children:[a.jsx(ti,{title:"Countries",columns:[{key:"country",label:"Country"},r,n],rows:jns}),a.jsx(ti,{title:"Device",columns:[{key:"device",label:"Device"},r,n],rows:Ens})]}),a.jsxs("div",{className:Po,children:[a.jsx(ti,{title:"Browsers",columns:[{key:"browser",label:"Browser"},r,n],rows:Nns}),a.jsx(ti,{title:"Operating systems",columns:[{key:"os",label:"Operating system"},r,n],rows:Tns})]})]})}function lrs({period:t,compare:e}){const n=y.useMemo(()=>Aq.map(s=>({name:s.space,value:kH(s.posts,t,"psp"+s.space),prev:Math.round(kH(s.posts,t,"psp2"+s.space)*.9)})),[t]),r=y.useMemo(()=>Aq.map(s=>({name:s.space,value:kH(s.comments,t,"csp"+s.space),prev:Math.round(kH(s.comments,t,"csp2"+s.space)*.9)})),[t]);return a.jsxs(a.Fragment,{children:[a.jsx(ti,{title:"Popular spaces",columns:[{key:"space",label:"Space"},{key:"group",label:"Space group"},{key:"posts",label:"Posts",align:"right",render:s=>s.posts.toLocaleString()},{key:"comments",label:"Comments",align:"right",render:s=>s.comments.toLocaleString()},{key:"likes",label:"Likes",align:"right",render:s=>s.likes.toLocaleString()},{key:"score",label:"Score",align:"right",render:s=>a.jsx("span",{className:"font-semibold text-foreground",children:s.score})}],rows:Aq}),a.jsxs("div",{className:Po,children:[a.jsx(cs,{title:"Posts by space",children:a.jsx(H$,{data:n,name:"Posts",compare:e})}),a.jsx(cs,{title:"Comments by space",children:a.jsx(H$,{data:r,name:"Comments",compare:e})})]})]})}function crs({period:t,compare:e}){const n=y.useMemo(()=>z5(t,[{key:"total",base:1200},{key:"members",base:600},{key:"publicv",base:260}]),[t]),r=y.useMemo(()=>ku(t,"newposts",90,.3),[t]),s=y.useMemo(()=>ku(t,"newcomments",220,.3),[t]),i=[{key:"post",label:"Post",render:o=>a.jsx("span",{className:"font-medium text-foreground",children:o.post})},{key:"likes",label:"Likes",align:"right"},{key:"comments",label:"Comments",align:"right"},{key:"views",label:"Views",align:"right",render:o=>o.views.toLocaleString()},{key:"score",label:"Score",align:"right",render:o=>a.jsx("span",{className:"font-semibold text-foreground",children:o.score})}];return a.jsxs(a.Fragment,{children:[a.jsx(cs,{title:"Post views",children:a.jsx(mE,{data:n,compare:e,series:[{key:"total",name:"Total",color:Ci.primary},{key:"members",name:"Unique members",color:Ci.primaryLight},{key:"publicv",name:"Unique public",color:"hsl(217 24% 70%)"}]})}),a.jsxs("div",{className:Po,children:[a.jsx(cs,{title:"New posts",children:a.jsx(mc,{data:r,name:"New posts",compare:e})}),a.jsx(cs,{title:"New comments",children:a.jsx(mc,{data:s,name:"New comments",compare:e})})]}),a.jsx(ti,{title:"Popular posts",columns:i,rows:_ns}),a.jsx(ti,{title:"New posts",columns:i,rows:Ans}),a.jsx(ti,{title:"Popular comments",columns:[{key:"comment",label:"Comment",render:o=>a.jsx("span",{className:"text-foreground",children:o.comment})},{key:"likes",label:"Likes",align:"right"}],rows:Pns})]})}function drs({period:t,compare:e}){const n=y.useMemo(()=>ku(t,"dm",240,.24),[t]),r=y.useMemo(()=>ku(t,"newdm",60,.3),[t]),s=y.useMemo(()=>ku(t,"groupmsg",180,.24),[t]),i=y.useMemo(()=>ku(t,"newgroup",30,.3),[t]),o=y.useMemo(()=>ku(t,"spacemsg",120,.24),[t]),l=y.useMemo(()=>ku(t,"livemsg",80,.3),[t]);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:Po,children:[a.jsx(cs,{title:"Direct messages",children:a.jsx(mc,{data:n,name:"Direct messages",compare:e})}),a.jsx(cs,{title:"New DM conversations",children:a.jsx(mc,{data:r,name:"New DM conversations",compare:e})})]}),a.jsxs("div",{className:Po,children:[a.jsx(cs,{title:"Group chat messages",children:a.jsx(mc,{data:s,name:"Group chat messages",compare:e})}),a.jsx(cs,{title:"New group chat conversations",children:a.jsx(mc,{data:i,name:"New group conversations",compare:e})})]}),a.jsxs("div",{className:Po,children:[a.jsx(cs,{title:"Chat space messages",children:a.jsx(mc,{data:o,name:"Chat space messages",compare:e})}),a.jsx(cs,{title:"Live stream/room messages",children:a.jsx(mc,{data:l,name:"Live stream/room messages",compare:e})})]}),a.jsx(ti,{title:"Most active members",columns:[{key:"name",label:"Name",render:c=>y0(c.name)},{key:"conversations",label:"Conversations",align:"right"},{key:"direct",label:"Direct messages",align:"right"},{key:"group",label:"Group messages",align:"right"}],rows:Rns})]})}function urs({period:t,compare:e}){const n=y.useMemo(()=>z5(t,[{key:"desktop",base:120},{key:"mobile",base:70},{key:"ios",base:40},{key:"android",base:24}]),[t]),r=y.useMemo(()=>z5(t,[{key:"desktop",base:900},{key:"mobile",base:520},{key:"ios",base:300},{key:"android",base:180}]),[t]);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:Po,children:[a.jsx(cs,{title:"Active member by device",children:a.jsx(mE,{data:n,compare:!1,series:[{key:"desktop",name:"Desktop Web",color:Ci.primary},{key:"mobile",name:"Mobile Web",color:Ci.primaryLight},{key:"ios",name:"Circle iOS",color:"hsl(217 24% 72%)"},{key:"android",name:"Circle Android",color:"hsl(152 55% 50%)"}]})}),a.jsx(cs,{title:"Active members by device",children:a.jsx(d2,{data:yns})})]}),a.jsx(cs,{title:"Estimated session minutes",children:a.jsx(mE,{data:r,compare:!1,series:[{key:"desktop",name:"Desktop web",color:Ci.primary},{key:"mobile",name:"Mobile web",color:Ci.primaryLight},{key:"ios",name:"Circle iOS",color:"hsl(217 24% 72%)"},{key:"android",name:"Circle Android",color:"hsl(152 55% 50%)"}]})}),a.jsx(cs,{title:"Session distribution by country",children:a.jsx(nIe,{period:t,label:"Sessions"})}),a.jsx(ti,{title:"Most active on mobile",columns:[{key:"name",label:"Member",render:s=>y0(s.name)},{key:"ios",label:"Last active on iOS",align:"right"},{key:"android",label:"Last active on Android",align:"right"},{key:"sessions",label:"Total sessions",align:"right",render:s=>a.jsx("span",{className:"font-medium text-foreground",children:s.sessions})}],rows:Ins})]})}function hrs({period:t,compare:e}){const n=y.useMemo(()=>ku(t,"evactivity",60,.3),[t]);return a.jsxs(a.Fragment,{children:[a.jsx(cs,{title:"Event activity",children:a.jsx(mc,{data:n,name:"Events",compare:e})}),a.jsx(cs,{title:"Popular day & time",children:a.jsx(tIe,{period:t})}),a.jsx(ti,{title:"Popular events",columns:[{key:"name",label:"Name",render:r=>a.jsx("span",{className:"font-medium text-foreground",children:r.name})},{key:"date",label:"Date"},{key:"rsvps",label:"RSVPs",align:"right"},{key:"attendees",label:"Live attendees",align:"right"}],rows:Mns}),a.jsx(ti,{title:"Top attendees",columns:[{key:"name",label:"Member",render:r=>y0(r.name)},{key:"attended",label:"Events attended",align:"right"},{key:"last",label:"Last attended",align:"right"}],rows:Lns})]})}const cZe=["Subscriptions","One-time","Installments","Conversion","Upsells"];function mrs({period:t,compare:e}){const[n,r]=y.useState(cZe[0]),s=y.useMemo(()=>z5(t,[{key:"subs",base:1400},{key:"onetime",base:800},{key:"install",base:400},{key:"refunds",base:120}]),[t]),i=[{name:"Subscriptions",value:58},{name:"One-time",value:26},{name:"Installments",value:11},{name:"Refunds",value:5}];return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"flex flex-wrap gap-1 rounded-xl bg-muted/50 p-1",children:cZe.map(o=>a.jsx("button",{onClick:()=>r(o),className:ee("rounded-lg px-3 py-1.5 text-sm font-medium transition-colors duration-150 ease-linear",n===o?"bg-card text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:o},o))}),a.jsxs("div",{className:Po,children:[a.jsx(cs,{title:"Sales breakdown",children:a.jsx(d2,{data:i})}),a.jsx(cs,{title:"Revenue breakdown",children:a.jsx(d2,{data:i})})]}),a.jsx(cs,{title:`Revenue growth · ${n}`,children:a.jsx(mE,{data:s,compare:e,series:[{key:"subs",name:"Subscriptions",color:Ci.primary},{key:"onetime",name:"One-time",color:Ci.primaryLight},{key:"install",name:"Installments",color:"hsl(217 24% 72%)"},{key:"refunds",name:"Refunds",color:"hsl(0 72% 60%)"}]})}),a.jsx(ti,{title:"Highest grossing paywalls",columns:[{key:"paywall",label:"Paywall",render:o=>a.jsx("span",{className:"font-medium text-foreground",children:o.paywall})},{key:"amount",label:"Amount",align:"right",render:o=>a.jsx("span",{className:"font-semibold text-foreground",children:o.amount})},{key:"transactions",label:"Transactions",align:"right"}],rows:Dns})]})}function frs({period:t,compare:e}){const n=y.useMemo(()=>ku(t,"courseactivity",120,.26),[t]),r=[{name:"Completed",value:59},{name:"In progress",value:28},{name:"Not started",value:13}];return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:Po,children:[a.jsx(cs,{title:"Course activity",children:a.jsx(mc,{data:n,name:"Enrollments",compare:e})}),a.jsx(cs,{title:"Completion overview",children:a.jsx(d2,{data:r})})]}),a.jsx(ti,{title:"Popular courses",columns:[{key:"course",label:"Course",render:s=>a.jsx("span",{className:"font-medium text-foreground",children:s.course})},{key:"enrollments",label:"Enrollments",align:"right"},{key:"started",label:"Started",align:"right"},{key:"completed",label:"Completed",align:"right"},{key:"rate",label:"Completion rate %",align:"right",render:s=>a.jsx("span",{className:"font-semibold text-foreground",children:s.rate})}],rows:$ns}),a.jsx(ti,{title:"Active students",columns:[{key:"student",label:"Student",render:s=>y0(s.student,s.email)},{key:"lessons",label:"Lessons",align:"right"},{key:"enrollments",label:"Enrollments",align:"right"},{key:"started",label:"Started",align:"right"},{key:"completed",label:"Completed",align:"right"},{key:"rate",label:"Completion rate",align:"right"},{key:"last",label:"Last active",align:"right"}],rows:Ons}),a.jsx(ti,{title:"Dropout students",columns:[{key:"student",label:"Student",render:s=>y0(s.student,s.email)},{key:"course",label:"Course"},{key:"slug",label:"Slug"},{key:"done",label:"Lessons completed",align:"right"},{key:"rate",label:"Completion rate",align:"right"},{key:"last",label:"Last active",align:"right"}],rows:Fns}),a.jsx(ti,{title:"Quizzes",columns:[{key:"quiz",label:"Quiz",render:s=>a.jsx("span",{className:"font-medium text-foreground",children:s.quiz})},{key:"course",label:"Course"},{key:"attempts",label:"Attempts",align:"right"},{key:"avg",label:"Avg score",align:"right"},{key:"pass",label:"Pass rate",align:"right"}],rows:Bns})]})}function prs({tab:t,period:e,compare:n}){switch(t){case"overview":return a.jsx(irs,{period:e,compare:n});case"members":return a.jsx(ars,{period:e,compare:n});case"website":return a.jsx(ors,{period:e,compare:n});case"spaces":return a.jsx(lrs,{period:e,compare:n});case"posts":return a.jsx(crs,{period:e,compare:n});case"messages":return a.jsx(drs,{period:e,compare:n});case"devices":return a.jsx(urs,{period:e,compare:n});case"events":return a.jsx(hrs,{period:e,compare:n});case"payments":return a.jsx(mrs,{period:e,compare:n});case"courses":return a.jsx(frs,{period:e,compare:n});default:return null}}const grs=["overview","members","spaces","posts","messages","events","website","devices","courses"],OT=t=>grs.includes(t),ii=t=>(t??0).toLocaleString();function dZe(t){const e=Math.max(0,Math.round(t??0));if(!e)return"—";const n=Math.floor(e/3600),r=Math.floor(e%3600/60);return n>=1?`${n}h ${r}m`:r>=1?`${r}m`:`${e}s`}const Zc=t=>t?{value:t.value,dir:t.dir}:void 0;function vrs(t,e){if(!e)return[];const n=e.deltas??{};switch(t){case"overview":return[{title:"Total members",value:ii(e.totalMembers)},{title:"Active members",period:!0,value:ii(e.activeMembers),delta:Zc(n.activeMembers)},{title:"Monthly active (MAU)",period:!0,value:ii(e.mau),delta:Zc(n.mau)},{title:"Daily active members",period:!0,value:ii(e.dau),delta:Zc(n.dau)},{title:"Inactive members",period:!0,value:ii(e.inactiveMembers),delta:Zc(n.inactiveMembers)},{title:"Invitation pending",value:ii(e.invitationPending)}];case"members":{const r=e.timeSpent??{};return[{title:"Total members",value:ii(e.totalMembers)},{title:"Active members",period:!0,value:ii(e.activeMembers),delta:Zc(n.activeMembers)},{title:"New members",period:!0,value:ii(e.newMembers),delta:Zc(n.newMembers)},{title:"Daily active (DAU)",value:ii(e.dau)},{title:"Weekly active (WAU)",value:ii(e.wau)},{title:"Monthly active (MAU)",value:ii(e.mau)},{title:"Total time spent",period:!0,value:dZe(r.totalSec)},{title:"Avg time per user",period:!0,value:dZe(r.avgPerUserSec)},{title:"Sessions",period:!0,value:ii(r.sessions)}]}case"posts":return[{title:"Total posts",period:!0,value:ii(e.totalPosts),delta:Zc(n.totalPosts)},{title:"Total comments",period:!0,value:ii(e.totalComments),delta:Zc(n.totalComments)},{title:"Total post views",value:ii(e.totalPostViews)}];case"messages":return[{title:"Conversations",period:!0,value:ii(e.conversations),delta:Zc(n.conversations)},{title:"Chat messages",period:!0,value:ii(e.chatMessages),delta:Zc(n.chatMessages)},{title:"Message senders",period:!0,value:ii(e.messageSenders)}];case"events":return[{title:"Events completed",period:!0,value:ii(e.eventsCompleted)},{title:"Events in period",period:!0,value:ii(e.eventsInWindow)},{title:"Total RSVPs",period:!0,value:ii(e.totalRsvps),delta:Zc(n.totalRsvps)},{title:"Live sessions",period:!0,value:ii(e.liveSessions),delta:Zc(n.liveSessions)},{title:"Live attendees",period:!0,value:ii(e.uniqueAttendees),delta:Zc(n.uniqueAttendees)},{title:"Avg time per attendee",period:!0,value:`${ii(e.avgMinutesPerAttendee)} min`},{title:"Poll votes",period:!0,value:ii(e.pollVotes)},{title:"Quiz accuracy",period:!0,value:e.quizAccuracyPercent==null?"—":`${e.quizAccuracyPercent}%`},{title:"Q&A questions",period:!0,value:`${ii(e.qaQuestions)} · ${ii(e.qaUpvotes)} upvotes`}];case"website":return[{title:"Unique visitors",period:!0,value:ii(e.uniqueVisitors),delta:Zc(n.uniqueVisitors)},{title:"Page views",period:!0,value:ii(e.pageViews),delta:Zc(n.pageViews)},{title:"Bounce rate",period:!0,value:`${e.bounceRate??0}%`,delta:Zc(n.bounceRate)}];case"courses":return[{title:"Total courses",value:ii(e.totalCourses)},{title:"Total enrollments",value:ii(e.totalEnrollments)},{title:"New enrollments",period:!0,value:ii(e.newEnrollments),delta:Zc(n.newEnrollments)},{title:"Course completions",value:ii(e.completions)}];default:return[]}}const FT={key:"visitors",label:"Visitors",align:"right",render:t=>a.jsx("span",{className:"font-medium text-foreground",children:(t.visitors??0).toLocaleString()})},BT={key:"percent",label:"Percent",align:"right",render:t=>SX(t.percent??0)};function Wh({text:t}){return a.jsx("div",{className:"rounded-xl border border-dashed border-border bg-card/50 p-8 text-center text-sm text-muted-foreground",children:t})}function yrs({tab:t,data:e,range:n,filters:r,memberAnalyticsEnabled:s,memberAnalyticsIncluded:i=!0,memberAnalyticsPlanLoading:o=!1}){const l=(e==null?void 0:e.series)??{},c=(e==null?void 0:e.tables)??{},[d,u]=y.useState(null);if(t==="overview")return a.jsx(Wh,{text:"Headline metrics above. Open Members, Groups, Posts, Messages or Events for detailed breakdowns."});if(t==="members"){const m=((e==null?void 0:e.kpis)??{}).roleBreakdown??{admin:0,moderator:0,user:0},f=[{name:"Members",value:m.user||0},{name:"Moderators",value:m.moderator||0},{name:"Admins",value:m.admin||0}].filter(w=>w.value>0),p=(e==null?void 0:e.activityStatus)??{},v=(p.highlyActive??0)+(p.active??0)+(p.lowActivity??0)+(p.inactive??0)+(p.atRisk??0)>0?["highlyActive","active","lowActivity","atRisk","inactive"].map(w=>({key:w,name:Y3t[w],value:p[w]??0})).filter(w=>w.value>0):[],b=l.roleCompare??{},x=(b.user??[]).map((w,k)=>{var S,C,j,E;return{x:w.x,user:w.value,moderator:((C=(S=b.moderator)==null?void 0:S[k])==null?void 0:C.value)??0,admin:((E=(j=b.admin)==null?void 0:j[k])==null?void 0:E.value)??0}});return a.jsxs(a.Fragment,{children:[a.jsx(cs,{title:"New members over time",children:a.jsx(mc,{data:l.newMembers??[],name:"New members",compare:!1})}),a.jsxs("div",{className:Po,children:[a.jsx(cs,{title:"Role breakdown",info:"Current membership split across the three roles. Kicked members are excluded.",children:f.length?a.jsx(d2,{data:f,unit:""}):a.jsx(Wh,{text:"No members yet."})}),a.jsx(cs,{title:"Activity status",info:"Classifies each member of the selected role by their activity count in the period. Highly active ≥20 events, Active 5–19, Low 1–4, At risk had activity in the previous window but none now, Inactive otherwise. Click a status to see its members and why each one is there.",children:v.length?a.jsx(d2,{data:v,unit:"",onSelect:w=>u(w.key),selectLabel:w=>`Show the ${w.value} ${w.name.toLowerCase()} ${w.value===1?"member":"members"}`}):a.jsx(Wh,{text:"No activity yet in this period."})}),d&&a.jsx(sns,{status:d,range:n,role:r.role,onClose:()=>u(null)})]}),a.jsx(cs,{title:"Active users by role",info:"Distinct active users per bucket, split by role. Lets you compare how admin, moderator and member cohorts move over time.",children:a.jsx(mE,{data:x,series:[{key:"user",name:"Members",color:Ci.primary},{key:"moderator",name:"Moderators",color:Ci.primaryLight},{key:"admin",name:"Admins",color:Ci.warning}],compare:!1})}),a.jsx(cs,{title:"Activity heatmap",info:"When members of the selected role are most active, by day of week and hour of day (community timezone). Darker cells = more events.",children:a.jsx(Yns,{cells:(e==null?void 0:e.heatmap)??[],period:e==null?void 0:e.period,timezone:e==null?void 0:e.heatmapTimezone})}),s?a.jsx(Yts,{range:n,role:r.role}):o?null:i?a.jsxs("div",{className:"rounded-xl border border-dashed border-border bg-card/50 p-4 text-sm text-muted-foreground",children:["Time spent, sessions and individual member lookup are recorded only while Member Analytics Tracking is on."," ",a.jsx(vr,{to:"/settings?tab=analytics",className:"font-medium text-primary hover:underline",children:"Turn it on in Settings → Community Experience → Analytics"}),". Everything else on this page keeps updating either way."]}):a.jsxs("div",{className:"rounded-xl border border-dashed border-primary/30 bg-primary/5 p-4 text-sm text-muted-foreground",children:[a.jsx("span",{className:"font-medium text-foreground",children:"Member Analytics is part of paid plans."})," ","Time spent, sessions, page journeys and Look up a user are recorded on every paid plan."," ",a.jsx(vr,{to:"/settings?tab=billing",className:"font-medium text-primary hover:underline",children:"See plans"}),". Everything else on this page is included in your plan."]}),a.jsxs("div",{className:Po,children:[Ij("Top members","Score",c.topMembers??[]),Ij("Active commenters","Comments",c.activeCommenters??[])]}),Ij("Post starters","Posts",c.postStarters??[]),a.jsx(ans,{range:n})]})}if(t==="spaces"){const h=c.spaces??[];if(!h.length)return a.jsx(Wh,{text:"No groups with activity in this period."});const m=h.map(p=>({name:p.space,value:p.posts})),f=h.map(p=>({name:p.space,value:p.comments}));return a.jsxs(a.Fragment,{children:[a.jsx(ti,{title:"Groups",columns:[{key:"space",label:"Group"},{key:"members",label:"Members",align:"right",render:p=>p.members.toLocaleString()},{key:"posts",label:"Posts",align:"right",render:p=>p.posts.toLocaleString()},{key:"comments",label:"Comments",align:"right",render:p=>p.comments.toLocaleString()},{key:"score",label:"Score",align:"right",render:p=>a.jsx("span",{className:"font-semibold text-foreground",children:p.score.toLocaleString()})}],rows:h}),a.jsxs("div",{className:Po,children:[a.jsx(cs,{title:"Posts by group",children:a.jsx(H$,{data:m,name:"Posts",compare:!1})}),a.jsx(cs,{title:"Comments by group",children:a.jsx(H$,{data:f,name:"Comments",compare:!1})})]})]})}if(t==="posts")return a.jsxs(a.Fragment,{children:[a.jsx(cs,{title:"New posts over time",children:a.jsx(mc,{data:l.newPosts??[],name:"New posts",compare:!1})}),a.jsx(ti,{title:"Popular posts",columns:[{key:"post",label:"Post",render:h=>a.jsx("span",{className:"font-medium text-foreground",children:h.post})},{key:"likes",label:"Likes",align:"right"},{key:"comments",label:"Comments",align:"right"},{key:"views",label:"Views",align:"right",render:h=>h.views.toLocaleString()},{key:"score",label:"Score",align:"right",render:h=>a.jsx("span",{className:"font-semibold text-foreground",children:h.score})}],rows:c.popularPosts??[]})]});if(t==="messages")return a.jsx(cs,{title:"Group chat messages over time",children:a.jsx(mc,{data:l.groupMessages??[],name:"Messages",compare:!1})});if(t==="events"){const h=k=>k?new Date(k).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"}):"—",m=k=>k==null?"—":k>=60?`${Math.floor(k/60)}h ${k%60}m`:`${k}m`,f=(c.popularEvents??[]).map(k=>({...k,date:h(k.date)})),p=(c.liveSessions??[]).map(k=>({...k,date:h(k.date),duration:k.isLive?"Live now":m(k.durationMinutes),avg:m(k.avgMinutes)})),g=c.pollResults??[],v=c.topQuestions??[],b=(c.topLiveAttendees??[]).map(k=>({...k,time:m(k.minutes),last:h(k.last)})),x=(l.liveSessions??[]).some(k=>k.value)||(l.liveAttendees??[]).some(k=>k.value),w=k=>a.jsx("span",{className:"text-muted-foreground",children:k});return a.jsxs(a.Fragment,{children:[x&&a.jsxs("div",{className:Po,children:[a.jsx(cs,{title:"Live sessions over time",children:a.jsx(H$,{data:l.liveSessions??[],name:"Sessions",compare:!1})}),a.jsx(cs,{title:"Live attendees over time",children:a.jsx(mc,{data:l.liveAttendees??[],name:"Attendees",compare:!1})})]}),p.length?a.jsx(ti,{title:"Live sessions",columns:[{key:"session",label:"Session",render:k=>a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"truncate font-medium text-foreground",children:k.session}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[k.type," · ",k.host]})]})},{key:"date",label:"Date"},{key:"duration",label:"Duration",align:"right"},{key:"attendees",label:"Attendees",align:"right"},{key:"peak",label:"Peak",align:"right"},{key:"avg",label:"Avg time",align:"right"},{key:"polls",label:"Polls",align:"right"},{key:"questions",label:"Q&A",align:"right"},{key:"export",label:"Attendees",align:"right",render:k=>a.jsx(wts,{meetingId:k.meetingId,title:k.session})}],rows:p}):a.jsx(Wh,{text:"No live sessions in this period. Sessions started with Go Live show up here with attendance, polls and Q&A."}),(g.length>0||v.length>0)&&a.jsxs("div",{className:Po,children:[g.length?a.jsx(ti,{title:"Poll results",columns:[{key:"question",label:"Poll",render:k=>a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"truncate font-medium text-foreground",children:k.question}),a.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:[k.session," · top answer: ",k.topAnswer]})]})},{key:"votes",label:"Votes",align:"right"},{key:"accuracyPercent",label:"Correct",align:"right",render:k=>k.accuracyPercent==null?w("—"):SX(k.accuracyPercent)}],rows:g}):a.jsx(Wh,{text:"No polls in this period."}),v.length?a.jsx(ti,{title:"Top Q&A questions",columns:[{key:"question",label:"Question",render:k=>a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"truncate font-medium text-foreground",children:k.question}),a.jsx("p",{className:"truncate text-xs text-muted-foreground",children:k.session})]})},{key:"upvotes",label:"Upvotes",align:"right"},{key:"answered",label:"Status",align:"right",render:k=>k.answered?a.jsx("span",{className:"text-success",children:"Answered"}):w("Open")}],rows:v}):a.jsx(Wh,{text:"No Q&A questions in this period."})]}),a.jsxs("div",{className:Po,children:[b.length?a.jsx(ti,{title:"Top live attendees",columns:[{key:"name",label:"Member",render:k=>y0(k.name)},{key:"sessions",label:"Sessions",align:"right"},{key:"time",label:"Time spent",align:"right"},{key:"last",label:"Last attended",align:"right"}],rows:b}):a.jsx(Wh,{text:"No live attendance recorded in this period."}),f.length?a.jsx(ti,{title:"Popular events",columns:[{key:"name",label:"Event",render:k=>a.jsx("span",{className:"font-medium text-foreground",children:k.name})},{key:"date",label:"Date"},{key:"rsvps",label:"RSVPs",align:"right"}],rows:f}):a.jsx(Wh,{text:"No scheduled events in this period."})]})]})}if(t==="website"){const h=l.views??[],m=l.visitors??[],f=h.map((g,v)=>{var b;return{x:g.x,views:g.value,visitors:((b=m[v])==null?void 0:b.value)??0}});return f.some(g=>g.views||g.visitors)?a.jsxs(a.Fragment,{children:[a.jsx(cs,{title:"Visitors & page views",children:a.jsx(mE,{data:f,compare:!1,series:[{key:"visitors",name:"Unique visitors",color:Ci.primary},{key:"views",name:"Page views",color:Ci.primaryLight}]})}),a.jsxs("div",{className:Po,children:[a.jsx(ti,{title:"Traffic sources",columns:[{key:"name",label:"Source"},FT,BT],rows:c.trafficSources??[]}),a.jsx(ti,{title:"Pages",columns:[{key:"name",label:"Page",render:g=>a.jsx("span",{className:"font-medium text-foreground",children:g.name})},FT,BT],rows:c.topPages??[]})]}),a.jsx(ti,{title:"Countries",columns:[{key:"name",label:"Country"},FT,BT],rows:c.countries??[]})]}):a.jsx(Wh,{text:"No web traffic recorded yet. Visits are tracked as members browse the community."})}if(t==="courses"){const h=c.popularCourses??[],m=(c.laggingStudents??[]).map(f=>({...f,progress:`${f.done}/${f.lessons}`,rate:`${f.ratePercent}%`,last:f.lastActive?new Date(f.lastActive).toLocaleDateString(void 0,{day:"numeric",month:"short"}):"—"}));return h.length?a.jsxs(a.Fragment,{children:[a.jsx(cs,{title:"Enrollments over time",children:a.jsx(mc,{data:l.enrollments??[],name:"Enrollments",compare:!1})}),a.jsx(ti,{title:"Courses",columns:[{key:"course",label:"Course",render:f=>a.jsx("span",{className:"font-medium text-foreground",children:f.course})},{key:"lessons",label:"Lessons",align:"right"},{key:"enrollments",label:"Enrolled",align:"right"},{key:"started",label:"Started",align:"right"},{key:"completed",label:"Completed",align:"right"},{key:"ratePercent",label:"Completion rate",align:"right",render:f=>SX(f.ratePercent??0)}],rows:h}),m.length?a.jsx(ti,{title:"Students needing a nudge",columns:[{key:"student",label:"Student",render:f=>y0(f.student,f.email)},{key:"course",label:"Course"},{key:"progress",label:"Lessons done",align:"right"},{key:"rate",label:"Progress",align:"right"},{key:"last",label:"Last active",align:"right"}],rows:m}):null]}):a.jsx(Wh,{text:"No courses yet — create one on the Course page to see analytics here."})}if(t==="devices"){const h=(c.devices??[]).map(f=>({name:f.name,value:f.visitors}));return h.some(f=>f.value)?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:Po,children:[a.jsx(cs,{title:"Visitors by device",children:a.jsx(d2,{data:h,unit:""})}),a.jsx(ti,{title:"Browsers",columns:[{key:"name",label:"Browser"},FT,BT],rows:c.browsers??[]})]}),a.jsxs("div",{className:Po,children:[a.jsx(ti,{title:"Operating systems",columns:[{key:"name",label:"Operating system"},FT,BT],rows:c.operatingSystems??[]}),a.jsx(ti,{title:"Countries",columns:[{key:"name",label:"Country"},FT,BT],rows:c.countries??[]})]})]}):a.jsx(Wh,{text:"No device data recorded yet."})}return null}function brs(){return a.jsxs("div",{className:"flex items-center gap-2 rounded-xl border border-amber-300/40 bg-amber-50 px-4 py-2.5 text-xs font-medium text-amber-700 dark:bg-amber-500/10 dark:text-amber-400",children:[a.jsx(nS,{className:"h-3.5 w-3.5 shrink-0"}),"Sample data — this section isn’t connected to live analytics yet."]})}function xrs(){return a.jsxs("div",{className:"flex min-h-[40vh] flex-col items-center justify-center gap-2 text-center",children:[a.jsx(Fc,{className:"h-8 w-8 text-muted-foreground/50"}),a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Analytics is admin-only"}),a.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:"You need to be an admin of this community to view analytics."})]})}function wrs(){return a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3",children:Array.from({length:6}).map((t,e)=>a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsx(sr,{className:"h-4 w-24"}),a.jsx(sr,{className:"mt-3 h-8 w-20"}),a.jsx(sr,{className:"mt-2 h-4 w-14"})]},e))}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsx(sr,{className:"h-4 w-32"}),a.jsx(sr,{className:"mt-4 h-64 w-full"})]})]})}const krs={key:"role",label:"Member type",options:[{value:"user",label:"Member"},{value:"admin",label:"Admin"},{value:"moderator",label:"Moderator"}]},uZe={key:"device",label:"Device",options:[{value:"Desktop",label:"Desktop"},{value:"Mobile",label:"Mobile"},{value:"Tablet",label:"Tablet"}]},hZe={key:"visitor",label:"Visitor",options:[{value:"logged_in",label:"Logged in"},{value:"anonymous",label:"Anonymous"}]},Srs={key:"visibility",label:"Visibility",options:[{value:"public",label:"Public"},{value:"private",label:"Private"}]},Crs={},jrs={members:[krs],events:[Srs],website:[hZe,uZe],devices:[hZe,uZe]};function Ers(t,e,n){const s=[["Metric","Period","Value","Change"],...n.map(c=>[c.title,c.period?mns(e):"All time",c.value,c.delta?`${c.delta.dir==="down"?"-":c.delta.dir==="up"?"+":""}${c.delta.value}`:""])].map(c=>c.map(d=>`"${String(d).replace(/"/g,'""')}"`).join(",")).join(`
`),i=URL.createObjectURL(new Blob([s],{type:"text/csv;charset=utf-8"})),o=document.createElement("a"),l=e.period==="custom"?`${e.from??"start"}_${e.to??"today"}`:e.period;o.href=i,o.download=`${t}-analytics-${l}.csv`,document.body.appendChild(o),o.click(),o.remove(),URL.revokeObjectURL(i)}function Nrs(){const{community:t}=qe(),e=(t==null?void 0:t.myRole)==="admin",[n,r]=xc(),s=n.get("tab"),i=Pq.some(M=>M.key===s)?s:"overview",o=M=>r(M==="overview"?{}:{tab:M},{replace:!1}),[l,c]=y.useState({period:_q}),d=uns(l),u=(M,z)=>c(M||z?{period:"custom",from:M,to:z}:{period:_q}),[h,m]=y.useState({}),f=h[i]??Crs,p=(M,z)=>m(G=>{const B={...G[i]??{}};return z?B[M]=z:delete B[M],{...G,[i]:B}}),{groups:g}=Ln(),{active:v,included:b,planLoading:x}=NAe(),w=y.useMemo(()=>i==="posts"?g.length?[{key:"groupId",label:"Group",options:g.map(M=>({value:M.id,label:M.name}))}]:[]:jrs[i]??[],[i,g]),k=kts(l,i==="overview"),S=Sts(l,i==="members",f),C=Cts(l,i==="spaces"),j=jts(l,i==="posts",f),E=Nts(l,i==="messages"),N=Ets(l,i==="events",f),A=_ts(l,i==="website",f),_=Ats(l,i==="devices",f),T=Tts(l,i==="courses"),R={overview:k,members:S,spaces:C,posts:j,messages:E,events:N,website:A,devices:_,courses:T},O=OT(i)?R[i]:void 0,F=O==null?void 0:O.data,D=OT(i)?vrs(i,F==null?void 0:F.kpis):Gns[i],I=w.map(M=>{const z=f[M.key],G=M.options.find(B=>B.value===z);return G?{def:M,option:G}:null}).filter(M=>M!==null),P=w.filter(M=>!f[M.key]);return t&&!e?a.jsx("div",{className:"flex min-h-[calc(100vh-120px)] gap-8",children:a.jsx("div",{className:"min-w-0 flex-1",children:a.jsx(xrs,{})})}):a.jsxs("div",{className:"flex min-h-[calc(100vh-120px)] gap-8",children:[a.jsxs(it.nav,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:{duration:.25,ease:"easeOut"},className:"hidden w-52 shrink-0 lg:block",children:[a.jsx("h1",{className:"mb-4 px-2 text-2xl font-bold tracking-tight text-foreground",children:"Analytics"}),a.jsx("div",{className:"flex flex-col space-y-px",children:Pq.map(M=>{const z=i===M.key;return a.jsxs("button",{onClick:()=>o(M.key),className:ee("flex items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-left text-sm transition-colors duration-150 ease-linear",z?"bg-muted font-medium text-foreground":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),children:[a.jsx(M.icon,{className:"h-4 w-4 shrink-0"}),M.label]},M.key)})})]}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"mb-4 lg:hidden",children:a.jsxs(zn,{value:i,onValueChange:M=>o(M),children:[a.jsx(On,{"aria-label":"Analytics section",className:"h-11 w-full text-base font-semibold",children:a.jsx(Vn,{})}),a.jsx(Fn,{className:"max-h-[60vh]",children:Pq.map(M=>a.jsx(pt,{value:M.key,children:a.jsxs("span",{className:"flex items-center gap-2.5",children:[a.jsx(M.icon,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),M.label]})},M.key))})]})}),a.jsxs(it.div,{...V5,className:"mb-5 flex flex-wrap items-center justify-between gap-3",children:[a.jsx("h2",{className:"hidden text-2xl font-bold tracking-tight text-foreground lg:block",children:srs[i]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2 lg:flex-nowrap",children:[a.jsx(F5t,{periods:dns,period:d,onSelectPeriod:M=>c({period:M}),from:l.period==="custom"?l.from:void 0,to:l.period==="custom"?l.to:void 0,onPickRange:u,onClearRange:()=>c({period:_q})}),a.jsxs("button",{onClick:()=>Ers(i,l,D),className:"inline-flex items-center gap-1.5 rounded-lg border border-border bg-card px-3 py-1.5 text-sm font-medium text-foreground transition-colors duration-150 ease-linear hover:bg-muted/50",children:[a.jsx(bc,{className:"h-3.5 w-3.5"}),"CSV"]})]})]}),w.length>0&&a.jsxs(it.div,{...V5,className:"mb-5 flex flex-wrap items-center gap-2",children:[I.map(({def:M,option:z})=>a.jsxs(Tr,{children:[a.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-lg border border-primary/30 bg-primary/5 px-2.5 py-1.5 text-sm",children:[a.jsx("span",{className:"text-muted-foreground",children:M.label}),a.jsx(_r,{asChild:!0,children:a.jsxs("button",{className:"inline-flex items-center gap-1 font-medium text-foreground",children:[z.label,a.jsx(li,{className:"h-3 w-3 text-muted-foreground"})]})}),a.jsx("button",{onClick:()=>p(M.key,void 0),className:"ml-0.5 text-muted-foreground transition-colors hover:text-foreground","aria-label":`Remove ${M.label} filter`,children:a.jsx(nn,{className:"h-3.5 w-3.5"})})]}),a.jsx(Cr,{align:"start",className:"max-h-72 overflow-y-auto",children:a.jsx(xZn,{value:z.value,onValueChange:G=>p(M.key,G),children:M.options.map(G=>a.jsx(K1t,{value:G.value,children:G.label},G.value))})})]},M.key)),P.map(M=>a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsxs("button",{className:"inline-flex items-center gap-1.5 rounded-lg border border-dashed border-border px-2.5 py-1.5 text-sm text-muted-foreground transition-colors duration-150 ease-linear hover:bg-muted/50 hover:text-foreground",children:[a.jsx(Dn,{className:"h-3.5 w-3.5"}),M.label]})}),a.jsx(Cr,{align:"start",className:"max-h-72 overflow-y-auto",children:M.options.map(z=>a.jsx(ot,{onClick:()=>p(M.key,z.value),children:z.label},z.value))})]},M.key)),I.length>0&&a.jsx("button",{onClick:()=>m(M=>({...M,[i]:{}})),className:"px-1.5 text-sm text-muted-foreground underline-offset-2 transition-colors hover:text-foreground hover:underline",children:"Clear all"})]}),OT(i)&&(O!=null&&O.isLoading)&&!F?a.jsx(wrs,{}):OT(i)&&(O!=null&&O.isError)?a.jsx("div",{className:"rounded-xl border border-rose-300/40 bg-rose-50 p-6 text-sm text-rose-600 dark:bg-rose-500/10",children:"Couldn’t load analytics for this tab. Please try again."}):a.jsxs(it.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.22,ease:"easeOut"},className:"space-y-4 pb-10",children:[!OT(i)&&a.jsx(brs,{}),a.jsx(Qns,{items:D,badge:fns(l)}),OT(i)?a.jsx(yrs,{tab:i,data:F,range:l,filters:f,memberAnalyticsEnabled:v,memberAnalyticsIncluded:b,memberAnalyticsPlanLoading:x}):a.jsx(prs,{tab:i,period:d,compare:!1})]},i)]})]})}const t4t=new Set(["joined_community","inactive_member","published_post","tag_added","completed_course","subscription_ended","sub_scheduled_cancel","subscribed_paywall","post_flagged","post_approved","post_rejected"]),n4t=new Set(["send_email","send_dm","comment_on_post","add_tag","remove_tag","time_delay","reward_points"]),Trs=new Set(["published_post","post_approved"]);function r4t(t,e){return t.map(n=>({group:n.group,items:n.items.filter(r=>e.has(r.id))})).filter(n=>n.items.length>0)}const s4t=[{group:"Members",items:[{id:"joined_community",label:"Joined community",icon:Sa},{id:"profile_updated",label:"Profile field updated",icon:w9t},{id:"changed_email",label:"Changed email",icon:Crt},{id:"leveled_up",label:"Member leveled up",icon:yBt},{id:"leveled_down",label:"Member leveled down",icon:pBt},{id:"inactive_member",label:"Member became inactive",icon:F8}]},{group:"Email activity",items:[{id:"opened_email",label:"Opened email",icon:zx},{id:"clicked_link",label:"Clicked a link",icon:bk}]},{group:"Events",items:[{id:"rsvp_event",label:"RSVP'd to event",icon:bD},{id:"rsvp_recurring",label:"RSVP'd to recurring event",icon:a9t},{id:"event_ended",label:"Event ended for member",icon:MA},{id:"event_starts_hour",label:"Event starts in an hour",icon:Ux},{id:"published_event",label:"Published an event",icon:jrt},{id:"attended_live",label:"Attended live event",icon:Ca}]},{group:"Access Groups",items:[{id:"added_access_group",label:"Added to access group",icon:ist},{id:"removed_access_group",label:"Removed from access group",icon:sst}]},{group:"Spaces",items:[{id:"joined_space",label:"Joined space",icon:mSe},{id:"removed_space",label:"Removed from space",icon:sI}]},{group:"Space Groups",items:[{id:"joined_space_group",label:"Joined space group",icon:vK},{id:"removed_space_group",label:"Removed from space group",icon:vK}]},{group:"Paywalls",items:[{id:"charged_paywall",label:"Charged for a paywall",icon:Sh},{id:"subscribed_paywall",label:"Bought a paid plan",icon:nfe},{id:"sub_scheduled_cancel",label:"Subscription scheduled to cancel",icon:MA},{id:"trial_scheduled_cancel",label:"Trial scheduled to cancel",icon:MA},{id:"sub_canceled",label:"Subscription canceled",icon:oh},{id:"subscription_ended",label:"Paid subscription ended",icon:oh},{id:"sub_resumed",label:"Subscription resumed",icon:Nl},{id:"trial_resumed",label:"Trial resumed",icon:Nl},{id:"installment_completed",label:"Installment completed",icon:nfe},{id:"trial_not_converted",label:"Trial ended and not converted",icon:oh},{id:"trial_converted",label:"Trial converted",icon:HP},{id:"trial_started",label:"Trial started",icon:Sh},{id:"coupon_used",label:"Coupon used at checkout",icon:VP},{id:"coupon_added",label:"Coupon added",icon:VP},{id:"coupon_removed",label:"Coupon removed",icon:sfe},{id:"coupon_ended",label:"Coupon ended",icon:sfe},{id:"failed_payment",label:"Failed recurring payment",icon:oh},{id:"sub_changed",label:"Subscription changed",icon:Nl},{id:"upsell_accepted",label:"Upsell accepted",icon:HP},{id:"upsell_declined",label:"Upsell declined",icon:oh},{id:"upsell_abandoned",label:"Upsell abandoned",icon:oh},{id:"checkout_completed",label:"Checkout completed",icon:yo}]},{group:"Tags",items:[{id:"tag_added",label:"Tag added",icon:ka},{id:"tag_removed",label:"Tag removed",icon:ka}]},{group:"Posts & Comments",items:[{id:"published_post",label:"Published a post",icon:Ei},{id:"post_flagged",label:"Post was held for review",icon:xd},{id:"post_approved",label:"Post was approved",icon:Prt},{id:"post_rejected",label:"Post was rejected",icon:TBt},{id:"comment_rejected",label:"Comment was rejected",icon:Vrt}]},{group:"Courses",items:[{id:"completed_course",label:"Completed course",icon:kE},{id:"completed_lesson",label:"Completed lesson",icon:uBt},{id:"completed_section",label:"Completed section",icon:k0},{id:"passed_quiz",label:"Passed quiz",icon:yo},{id:"failed_quiz",label:"Failed quiz",icon:g9t},{id:"submits_quiz",label:"Submits quiz",icon:mO}]},{group:"Forms",items:[{id:"form_submitted",label:"Form submitted",icon:mO}]},{group:"Messaging",items:[{id:"admin_received_dm",label:"Admin received a direct message",icon:Vi}]}],i4t=[{group:"AI Actions",items:[{id:"agent_comments",label:"Agent comments on post",icon:DLe,accent:"ai"},{id:"ai_reports_post",label:"AI reports post",icon:xo,accent:"ai"},{id:"ai_reports_comment",label:"AI reports comment",icon:xo,accent:"ai"},{id:"ai_edits_topics",label:"AI edits topics",icon:xo,accent:"ai"},{id:"ai_renames_title",label:"AI renames post title",icon:n9t,accent:"ai"},{id:"agent_sends_dm",label:"Agent sends direct message",icon:DLe,accent:"ai"}]},{group:"Communication",items:[{id:"send_email",label:"Send an email",icon:Ii},{id:"send_dm",label:"Send a direct message",icon:x2},{id:"send_push",label:"Send mobile push notification",icon:Lm},{id:"unsubscribe_email",label:"Unsubscribe from email marketing",icon:Brt}]},{group:"Tags",items:[{id:"add_tag",label:"Add tag",icon:ka},{id:"remove_tag",label:"Remove tag",icon:CSe}]},{group:"Members",items:[{id:"remove_member",label:"Remove member(s) from community",icon:qn},{id:"enable_dm",label:"Enable direct messaging",icon:Vi},{id:"disable_dm",label:"Disable direct messaging",icon:Vrt}]},{group:"Space / Space groups",items:[{id:"add_to_space",label:"Add member(s) to space",icon:mSe},{id:"remove_from_space",label:"Remove member(s) from space",icon:sI},{id:"add_to_space_group",label:"Add member(s) to space group",icon:Jme},{id:"remove_from_space_group",label:"Remove member(s) from space group",icon:Jme}]},{group:"Access Groups",items:[{id:"add_access_group",label:"Add member(s) to access group",icon:ist},{id:"remove_access_group",label:"Remove member(s) from access group",icon:sst}]},{group:"Webhook",items:[{id:"send_webhook",label:"Send to webhook",icon:ife}]},{group:"Paywalls",items:[{id:"cancel_sub_period_end",label:"Cancel subscription at period end",icon:MA},{id:"cancel_sub_now",label:"Cancel subscription immediately",icon:oh},{id:"subscribe_trial",label:"Subscribe to paywall trial",icon:Sh},{id:"add_coupon_sub",label:"Add coupon to subscription",icon:VP},{id:"remove_coupon_sub",label:"Remove coupon from subscription",icon:sfe},{id:"change_sub",label:"Change subscription",icon:Nl}]},{group:"Posts",items:[{id:"comment_on_post",label:"Reply to the post",icon:Vi},{id:"edit_post_settings",label:"Edit post settings",icon:wSe}]},{group:"Events",items:[{id:"rsvp_invite",label:"RSVP or invite member(s) to event",icon:bD}]},{group:"Flow",items:[{id:"time_delay",label:"Time delay",icon:ja}]},{group:"Gamification",items:[{id:"reward_points",label:"Reward points",icon:Bx}]}],a4t=r4t(s4t,t4t),o4t=r4t(i4t,n4t),rIe=[{group:"Members",items:[{id:"all_members",label:"All members",icon:wr},{id:"space_members",label:"Members of a space",icon:mSe},{id:"inactive_members",label:"Inactive members",icon:F8}]}],_rs=new Set(rIe.flatMap(t=>t.items).map(t=>t.id)),l4t=Object.fromEntries([...s4t,...rIe].flatMap(t=>t.items).map(t=>[t.id,t])),sIe=Object.fromEntries(i4t.flatMap(t=>t.items).map(t=>[t.id,t])),mZe="A member is inactive when they have not posted, commented or reacted in this community for this many days. Someone who has never done any of those counts from the day they joined. Signing in or reading does not count as activity.",Ars={send_email:[{kind:"text",key:"subject",label:"Subject line",placeholder:"Welcome to the community!",max:140,mergeTags:!0},{kind:"email",key:"body",htmlKey:"bodyHtml",label:"Email body",hint:"Written in an editor with headings, bold, lists, links and quotes. It is sent from your community's email address, and members who unsubscribed from your emails are skipped."},{kind:"formLink",key:"formLink",label:"Form link",optional:!0,hint:"The link members open to answer, such as a Google Form or a form you built in Email Marketing. It replaces {{form_link}} in the email, as a link they can click. It is only required when the email contains {{form_link}}; without that variable the link is not used."}],send_dm:[{kind:"textarea",key:"message",label:"Message",placeholder:"Hi {{member.first_name}}, welcome!",mergeTags:!0,hint:"Sent as a direct message from the admin who created this workflow, and it appears in the member's inbox like a message that admin typed. It stays from them when another admin edits, switches on or runs the workflow. To send from a different admin, that admin creates their own workflow."}],comment_on_post:[{kind:"textarea",key:"comment",label:"Reply",placeholder:"Thanks for posting, {{member.first_name}}!",mergeTags:!0,hint:"Posted as a comment from the admin who created this workflow, on the post that started it, whichever admin edits or switches it on later. Everyone who can see the post sees the same reply, and the author is notified as for any comment. That admin's own posts are not replied to."}],add_tag:[{kind:"text",key:"tag",label:"Tag",placeholder:"e.g. onboarded",max:64,hint:"Added to the member in your email audience. Upper and lower case are treated the same."}],remove_tag:[{kind:"text",key:"tag",label:"Tag",placeholder:"e.g. new",max:64,hint:"Removed from the member if they have it."}],time_delay:[{kind:"duration",key:"delay",label:"Wait for"}],reward_points:[{kind:"number",key:"points",label:"Points to reward",placeholder:"e.g. 50",min:1,max:1e5}]},Prs={published_post:[{kind:"select",key:"every",label:"Run for",options:[{value:"first",label:"A member's first post only"},{value:"every",label:"Every post"}],hint:"First post only suits a one-off, such as rewarding or welcoming a new poster. Every post suits a reply to each post. A post held for review counts when it is approved."}],tag_added:[{kind:"text",key:"tag",label:"Tag",placeholder:"Any tag",max:64,optional:!0,hint:"Leave empty to run when any tag is added. The tag must match exactly, including upper and lower case."}],completed_course:[{kind:"course",key:"course",label:"Course",placeholder:"Any course",optional:!0}],subscribed_paywall:[{kind:"plan",key:"plan",label:"Plan",placeholder:"Any paid plan",optional:!0}],inactive_member:[{kind:"number",key:"days",label:"Inactive for",placeholder:"30",min:1,max:365,unit:"days",optional:!0,hint:`${mZe} Checked once an hour, and each member goes through this workflow once.`}],space_members:[{kind:"space",key:"space",label:"Space",hint:"Everyone who has joined this space when the workflow runs."}],inactive_members:[{kind:"number",key:"days",label:"Inactive for",placeholder:"30",min:1,max:365,unit:"days",optional:!0,hint:mZe}]},fZe={joined_community:"Runs once for each person when they join your community.",published_post:"Runs when a member's post goes live — their first post only, or every post, as you choose below.",post_flagged:"Runs for the author when automatic moderation holds their post for review, because it matched a restricted word or the profanity filter. The post is not visible to members until an admin approves it. Leave the post's title out of a message here: the title is often what was restricted, and a message containing a restricted word is not sent.",post_approved:"Runs for the author when an admin approves a post that was held for review.",post_rejected:"Runs for the author when an admin rejects a post that was held for review. Leave the post's title out of a message here: the title is often what was restricted, and a message containing a restricted word is not sent.",sub_scheduled_cancel:"Runs when a member cancels a paid subscription. They keep access until the period they paid for ends, so this is the moment to ask them to stay.",tag_added:"Runs when a tag is added to a member in your email audience.",completed_course:"Runs when a member finishes a course.",subscribed_paywall:"Runs when a member buys a paid plan — a group, a course or a bundle — once for each purchase. A step still waiting is skipped if that purchase has ended by then.",subscription_ended:"Runs when a member's paid subscription ends and they are left with no paid membership — because it was cancelled, a payment failed for good, or their access period ran out.",inactive_member:"Runs for a member once they have been inactive for the number of days you choose.",all_members:"Runs for every current member of your community.",space_members:"Runs for the members of one space.",inactive_members:"Runs for members who are inactive right now."},c4t=[{token:"{{member.first_name}}",label:"First name"},{token:"{{name}}",label:"Full name"},{token:"{{email}}",label:"Email address"},{token:"{{community}}",label:"Community name"},{token:"{{post}}",label:"Post title"}],Rrs={token:"{{form_link}}",label:"Form link"},Irs=[...c4t,Rrs],Mrs=new Set(["name","first_name","email","community","post","member.name","member.first_name","member.email"]),Lrs=new Set(["form_link"]);function d4t(t,{email:e=!1}={}){const n=new Set;for(const r of String(t??"").matchAll(/\{\{\s*([^{}]*?)\s*\}\}/g))!Mrs.has(r[1])&&!(e&&Lrs.has(r[1]))&&n.add(`{{${r[1]}}}`);return[...n]}const hj=t=>String(t??"").trim().length>0,Drs=/\{\{\s*form_link\s*\}\}/;function $rs(t){const e=String(t??"").trim();if(!e||e.length>2e3)return!1;try{const n=new URL(e);return n.protocol==="http:"||n.protocol==="https:"}catch{return!1}}function u4t(t){const e=hj(t.formLink);return e&&!$rs(t.formLink)?"needs a form link that is a full web address, starting with https://":[t.subject,t.body,t.bodyHtml].some(r=>Drs.test(r??""))&&!e?"uses {{form_link}}, so it needs a link to your form":null}function Ors(t,e){const n=t.config??{};if(!t.itemId)return"has no action chosen. Pick one, or remove the step";if(!n4t.has(t.itemId))return"uses an action that is not available. Choose another action";if(t.itemId==="send_email"&&!(hj(n.subject)&&hj(n.body)))return"needs a subject line and an email body";if(t.itemId==="send_email"){const r=u4t(n);if(r)return r}if(t.itemId==="send_dm"&&!hj(n.message))return"needs a message to send";if(t.itemId==="comment_on_post"){if(!hj(n.comment))return"needs a reply to post";if(!Trs.has((e==null?void 0:e.itemId)??""))return'replies to a post, so the workflow has to start from "Published a post" or "Post was approved"'}return(t.itemId==="add_tag"||t.itemId==="remove_tag")&&!hj(n.tag)?"needs a tag":t.itemId==="reward_points"&&!(parseInt(n.points??"",10)>0)?"needs a number of points greater than zero":null}function Frs(t,e){var s;const n=e.find(i=>i.kind==="trigger"),r=e.filter(i=>i.kind==="action");if(t==="automation"){if(!(n!=null&&n.itemId))return"Choose a trigger before activating an automation";if(!t4t.has(n.itemId))return"This trigger is not available. Choose another trigger"}else{if(!(n!=null&&n.itemId)||!_rs.has(n.itemId))return"Choose who this workflow should run for";if(n.itemId==="space_members"&&!hj((s=n.config)==null?void 0:s.space))return"Choose the space whose members this workflow should run for"}if(r.length===0)return"Add at least one action before activating";for(let i=0;i<r.length;i+=1){const o=Ors(r[i],n);if(o)return`Step ${i+1} ${o}`}return r.every(i=>i.itemId==="time_delay")?"Add an action for this workflow to do after the wait":null}const pZe=[{id:"automation",title:"Automation",desc:"Select an event trigger. Your workflow will run automatically whenever this event occurs."},{id:"bulk",title:"Bulk action",desc:"Select a list of your audience members and run a bulk action immediately."},{id:"scheduled",title:"Scheduled",desc:"Select a list of your audience members and schedule a bulk action to run once at a time you choose."}],Brs=[{id:"all",label:"All",badge:void 0},{id:"email_hub",label:"Email Hub",badge:"New"},{id:"ai",label:"AI",badge:"New"},{id:"moderation",label:"Moderation",badge:"New"},{id:"onboarding",label:"Onboarding",badge:void 0},{id:"engagement",label:"Engagement",badge:void 0},{id:"paywalls",label:"Paywalls",badge:void 0},{id:"administrative",label:"Administrative",badge:void 0}],Urs=[{id:"followup_open",title:"Follow-up on open",desc:"Send a 2-step follow-up to members who opened your marketing email.",icon:_s,emailHub:!0,isNew:!0,type:"Automation",tags:["Engagement"],category:"email_hub"},{id:"tag_on_open",title:"Tag on open",desc:"Tag a member when they open an email.",icon:ka,emailHub:!0,isNew:!0,type:"Automation",tags:["Engagement"],category:"email_hub"},{id:"followup_click",title:"Follow-up on click",desc:"Send a 2-step follow-up to members who clicked a link in a marketing email.",icon:_s,emailHub:!0,isNew:!0,type:"Automation",tags:["Engagement"],category:"email_hub"},{id:"tag_on_click",title:"Tag on click",desc:"Tag a member when they click a link in an email.",icon:ka,emailHub:!0,isNew:!0,type:"Automation",tags:["Engagement"],category:"email_hub"},{id:"email_space_members",title:"Email all space members",desc:"Send an important update or announcement by email to everyone in a space.",icon:_s,emailHub:!0,type:"Bulk Action",tags:["Engagement"],category:"engagement"},{id:"message_space_members",title:"Message all space members",desc:"Send an important update or announcement as a direct message to everyone in a space.",icon:_s,type:"Bulk Action",tags:["Engagement"],category:"engagement"},{id:"email_new_members",title:"Email new members",desc:"Send a welcome email to a new member joining your community.",icon:Ii,emailHub:!0,type:"Automation",tags:["Onboarding"],category:"onboarding"},{id:"message_new_members",title:"Message new members",desc:"Send a welcome message to a new member joining your community.",icon:x2,type:"Automation",tags:["Onboarding"],category:"onboarding"},{id:"gather_feedback",title:"Gather feedback via email",desc:"A week after someone joins, email them to ask how their first days went.",icon:mO,emailHub:!0,type:"Automation",tags:["Onboarding"],category:"onboarding"},{id:"email_inactive",title:"Email inactive members",desc:"Send a re-engagement email to members who have not posted, commented or reacted for 30 days.",icon:Ii,emailHub:!0,type:"Automation",tags:["Engagement"],category:"engagement"},{id:"agent_answers",title:"Reply to new posts",desc:"Post a reply from you on every new post, so no post goes unanswered.",icon:Vi,isNew:!0,type:"Automation",tags:["Engagement"],category:"engagement"},{id:"ai_moderate",title:"Tell authors when a post is held",desc:"Message a member when automatic moderation holds their post for review.",icon:xd,isNew:!0,type:"Automation",tags:["Moderation"],category:"moderation"},{id:"welcome_dm",title:"Welcome DM + tag",desc:"Send a welcome DM and tag new members on join.",icon:x2,type:"Automation",tags:["Onboarding"],category:"onboarding"},{id:"trial_winback",title:"Win back lapsed subscribers",desc:"Email a member when their paid subscription ends, tag them, and follow up a few days later unless they have come back.",icon:Ii,emailHub:!0,type:"Automation",tags:["Paywalls"],category:"paywalls"},{id:"reward_course",title:"Reward course completion",desc:"Award points when a member completes a course.",icon:Bx,type:"Automation",tags:["Engagement"],category:"engagement"}],zrs=new Set(["followup_open","tag_on_open","followup_click","tag_on_click"]),l8=Urs.filter(t=>!zrs.has(t.id)),mhe=Brs.filter(t=>t.id==="all"||l8.some(e=>e.category===t.id)),wp=(t,e={})=>({id:"n1",kind:"trigger",itemId:t,config:e}),Md=(t,e,n={})=>({id:`n${t}`,kind:"action",itemId:e,config:n}),Vrs={email_space_members:[wp("space_members"),Md(2,"send_email",{subject:"An update from {{community}}",body:`Hi {{member.first_name}},

Write your update here.

See you in the community!`})],message_space_members:[wp("space_members"),Md(2,"send_dm",{message:"Hi {{member.first_name}}, a quick update: "})],email_new_members:[wp("joined_community"),Md(2,"send_email",{subject:"Welcome to {{community}}, {{member.first_name}}!",body:`Hi {{member.first_name}},

Welcome to {{community}} — we're glad you're here.

A good first step is to introduce yourself and say hello.`})],message_new_members:[wp("joined_community"),Md(2,"send_dm",{message:"Hi {{member.first_name}}, welcome to {{community}}! Let me know if you have any questions."})],gather_feedback:[wp("joined_community"),Md(2,"time_delay",{delay:"7 days"}),Md(3,"send_email",{subject:"How is your first week in {{community}}?",body:`Hi {{member.first_name}},

You joined {{community}} a week ago. How is it going so far?

It takes two minutes to tell us here:
{{form_link}}

Anything that would have made your first week easier is useful to hear.`,formLink:""})],email_inactive:[wp("inactive_member",{days:"30"}),Md(2,"send_email",{subject:"We miss you in {{community}}",body:`Hi {{member.first_name}},

It has been a while since we saw you in {{community}}. Here is what you have missed:

- 

Come and say hello!`})],welcome_dm:[wp("joined_community"),Md(2,"send_dm",{message:"Hi {{member.first_name}}, welcome to {{community}}!"}),Md(3,"add_tag",{tag:"welcomed"})],trial_winback:[wp("subscription_ended"),Md(2,"send_email",{subject:"Come back to {{community}}",body:`Hi {{member.first_name}},

Your subscription to {{community}} has ended, and we'd love to have you back.

You can rejoin any time from the community.`}),Md(3,"add_tag",{tag:"win-back"}),Md(4,"time_delay",{delay:"3 days"}),Md(5,"send_email",{subject:"Still thinking it over, {{member.first_name}}?",body:`Hi {{member.first_name}},

Just a quick note in case you missed our last email. Your place in {{community}} is still here whenever you want it.

If something put you off, reply and tell us — we read every answer.`})],agent_answers:[wp("published_post",{every:"every"}),Md(2,"comment_on_post",{comment:"Thanks for posting, {{member.first_name}}! Someone from the team will be along shortly."})],ai_moderate:[wp("post_flagged"),Md(2,"send_dm",{message:"Hi {{member.first_name}}, your latest post is waiting for a quick review by our team before it goes live. This is automatic and usually nothing to worry about — we will get to it soon."})],reward_course:[wp("completed_course"),Md(2,"reward_points",{points:"50"})]};function Hrs(t){const e=Vrs[t];return e?e.map(n=>({...n,config:{...n.config}})):[{id:"n1",kind:"trigger",itemId:null}]}function G$(t,e){if(t!=="Reward course completion")return e;const n=e.find(o=>o.kind==="trigger");if(!n||n.itemId==="completed_course")return e;const r=e.find(o=>o.kind==="action"&&o.itemId==="reward_points"),s=e.find(o=>o.kind==="action"),i=e.filter(o=>{var l;return o.kind==="action"&&o.id!==((l=r??s)==null?void 0:l.id)});return[{...n,itemId:"completed_course",config:n.config??{}},r||{id:(s==null?void 0:s.id)??"n2",kind:"action",itemId:"reward_points",config:(s==null?void 0:s.config)??{points:"50"}},...i]}function h4t(t,e,n,r){const s=t[e];if(!s)throw new Error(`No recorded geometry for guide figure "${e}"`);if(s.markers.length!==r.labels.length)throw new Error(`Guide figure "${e}" has ${s.markers.length} highlights but ${r.labels.length} labels`);return{src:n,width:s.width,height:s.height,alt:r.alt,caption:r.caption,markers:s.markers.map((i,o)=>({...i,label:r.labels[o]}))}}function gZe({figure:t,large:e=!1}){return a.jsxs("div",{className:"relative overflow-hidden rounded-lg border border-border bg-muted/30",children:[a.jsx("img",{src:t.src,alt:t.alt,width:t.width,height:t.height,loading:"lazy",className:"block h-auto w-full"}),t.markers.map((n,r)=>a.jsx("span",{style:{left:`${n.x}%`,top:`${n.y}%`,width:`${n.w}%`,height:`${n.h}%`},className:"pointer-events-none absolute rounded-md border-2 border-primary shadow-[0_0_0_3px_hsl(var(--primary)/0.22)]","aria-hidden":"true",children:a.jsx("b",{className:ee("absolute flex items-center justify-center rounded-full bg-primary font-bold tabular-nums text-primary-foreground shadow-[0_0_0_2px_hsl(var(--background))]",e?"-left-3 -top-3 h-6 w-6 text-xs":"-left-2.5 -top-2.5 h-5 w-5 text-[10px]"),children:r+1})},n.label))]})}function vZe({figure:t,large:e=!1}){return a.jsx("ol",{className:"space-y-0.5",children:t.markers.map((n,r)=>a.jsxs("li",{className:ee("flex gap-2 leading-relaxed text-muted-foreground",e?"text-sm":"text-[11px]"),children:[a.jsx("span",{className:"mt-[2px] flex h-4 w-4 shrink-0 items-center justify-center rounded-full bg-primary/15 text-[10px] font-bold tabular-nums text-primary",children:r+1}),a.jsx("span",{children:n.label})]},n.label))})}function m4t({figure:t}){const[e,n]=y.useState(!1);return a.jsxs("figure",{className:"space-y-2",children:[a.jsxs("button",{type:"button",onClick:()=>n(!0),className:"group relative block w-full rounded-lg text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-ring","aria-label":`Enlarge screenshot: ${t.caption}`,children:[a.jsx(gZe,{figure:t}),a.jsxs("small",{className:"absolute bottom-2 right-2 flex items-center gap-1 rounded-md bg-foreground/80 px-2 py-1 text-[10px] font-medium text-background opacity-0 transition-opacity group-hover:opacity-100 group-focus-visible:opacity-100",children:[a.jsx(fSe,{className:"h-3 w-3","aria-hidden":"true"})," Click to enlarge"]})]}),a.jsxs("figcaption",{className:"space-y-1",children:[a.jsx("p",{className:"text-[11px] text-muted-foreground",children:t.caption}),a.jsx(vZe,{figure:t})]}),a.jsx(Bt,{open:e,onOpenChange:n,children:a.jsxs(Ft,{className:"flex max-h-[94vh] w-[min(96vw,1200px)] max-w-none flex-col gap-3 overflow-hidden p-4 sm:p-5",children:[a.jsxs(Vt,{className:"shrink-0 pr-8",children:[a.jsx(Ut,{className:"text-base",children:t.caption}),a.jsx(_n,{className:"sr-only",children:t.alt})]}),a.jsxs("div",{className:"themed-scrollbar min-h-0 flex-1 space-y-3 overflow-y-auto pr-1",children:[a.jsx(gZe,{figure:t,large:!0}),a.jsx(vZe,{figure:t,large:!0})]})]})})]})}function f4t({heading:t,flow:e}){return a.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4",children:[a.jsx("p",{className:"mb-3 text-xs font-medium text-muted-foreground",children:t}),a.jsx("ol",{className:"flex flex-col gap-2 sm:flex-row sm:items-stretch",children:e.map((n,r)=>a.jsxs("li",{className:"flex flex-1 items-center gap-2",children:[a.jsxs("div",{className:"flex min-w-0 flex-1 gap-2.5 rounded-md border border-border bg-card p-3 sm:flex-col sm:gap-1.5",children:[a.jsx("span",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-md bg-primary/10 text-primary",children:a.jsx(n.icon,{className:"h-4 w-4","aria-hidden":"true"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-xs font-semibold text-foreground",children:n.title}),n.lines.map(s=>a.jsx("p",{className:"text-[11px] leading-snug text-muted-foreground",children:s},s))]})]}),r<e.length-1&&a.jsx(xa,{className:"h-4 w-4 shrink-0 rotate-90 text-muted-foreground/60 sm:rotate-0","aria-hidden":"true"})]},n.title))})]})}function p4t({sections:t,defaultOpen:e,onGo:n}){return a.jsx(W3t,{type:"single",collapsible:!0,defaultValue:e,className:"w-full",children:t.map((r,s)=>{var i;return a.jsxs(K5e,{value:r.id,children:[a.jsx(Y5e,{className:"text-left hover:no-underline",children:a.jsxs("span",{className:"flex min-w-0 items-center gap-3",children:[a.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-primary/10 text-primary",children:a.jsx(r.icon,{className:"h-4 w-4","aria-hidden":"true"})}),a.jsxs("span",{className:"min-w-0",children:[a.jsxs("span",{className:"flex items-baseline gap-2",children:[a.jsx("span",{className:"text-[11px] font-semibold tabular-nums text-muted-foreground",children:s+1}),a.jsx("span",{className:"text-sm font-semibold text-foreground",children:r.title})]}),a.jsx("span",{className:"block text-xs font-normal text-muted-foreground",children:r.summary})]})]})}),a.jsxs(Q5e,{className:"space-y-3 pl-11 pr-1",children:[a.jsx("p",{className:"text-sm leading-relaxed text-muted-foreground",children:r.what}),a.jsxs("div",{className:"rounded-md border border-border bg-muted/30 p-3",children:[a.jsx("p",{className:"text-xs font-semibold text-foreground",children:"When to use it"}),a.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:r.when})]}),a.jsx("ol",{className:"space-y-2",children:r.steps.map((o,l)=>a.jsxs("li",{className:"flex gap-2.5",children:[a.jsx("span",{className:"mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-muted text-[11px] font-semibold tabular-nums text-muted-foreground",children:l+1}),a.jsx("span",{className:"text-xs leading-relaxed text-muted-foreground",children:o})]},o))}),(i=r.figures)==null?void 0:i.map(o=>a.jsx(m4t,{figure:o},o.src)),r.watchOut&&a.jsxs("div",{className:"flex gap-2.5 rounded-md border border-warning/30 bg-warning/10 p-3",children:[a.jsx(Bf,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-warning","aria-hidden":"true"}),a.jsx("p",{className:"text-xs leading-relaxed text-foreground",children:r.watchOut})]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:r.ctas.map(o=>a.jsxs(Z,{size:"sm",variant:"outline",onClick:()=>n(o.to),children:[o.label,a.jsx(xa,{className:"ml-1.5 h-3.5 w-3.5"})]},o.to))})]})]},r.id)})})}const Grs={"w1-gallery":{width:1240,height:760,markers:[{x:24.2,y:17,w:17.4,h:5.8},{x:24.2,y:23.9,w:17.4,h:23.2},{x:43.5,y:79.3,w:27.1,h:20.7}]},"w2-builder":{width:1240,height:760,markers:[{x:36.8,y:22.8,w:26.5,h:9.1},{x:36.8,y:42.5,w:26.5,h:28.9},{x:48.5,y:34.8,w:2.9,h:4.7},{x:91.1,y:1.3,w:7.7,h:5.8}]},"w3-trigger":{width:1240,height:760,markers:[{x:36.8,y:32.6,w:26.5,h:9.1},{x:92.8,y:20,w:6,h:4.4},{x:70.7,y:42.2,w:28,h:9.7},{x:90.9,y:92.6,w:8.1,h:5.8}]},"w4-action":{width:1240,height:760,markers:[{x:36.8,y:52.4,w:26.5,h:9.1},{x:70.7,y:34,w:28,h:6.3},{x:70.7,y:52.1,w:28,h:20.1},{x:90.9,y:92.6,w:8.1,h:5.8}]},"w4b-editor":{width:672,height:588,markers:[{x:3.1,y:22.3,w:93.8,h:8.2},{x:3.2,y:39.4,w:93.7,h:8.3},{x:3.8,y:47,w:92.5,h:34},{x:3.1,y:81.5,w:93.8,h:5.4},{x:80.2,y:88.3,w:16.7,h:8.2}]},"w5-bulk":{width:1240,height:760,markers:[{x:36.8,y:32.6,w:26.5,h:9.1},{x:70.7,y:43,w:28,h:6.3},{x:64,y:1.5,w:26.5,h:5.3},{x:90.8,y:1.3,w:7.9,h:5.8}]},"w6-run":{width:1240,height:760,markers:[{x:29.4,y:36.8,w:41.3,h:26.5},{x:61.1,y:54.2,w:7.9,h:6.3}]},"w7-list":{width:950,height:420,markers:[{x:81.7,y:3.5,w:16.2,h:10.5},{x:39.5,y:30,w:21.1,h:15.4},{x:60.6,y:30,w:10.6,h:15.4},{x:91.9,y:33.5,w:3.8,h:8.6}]}},Wrs="/assets/w1-gallery-BCI9L3mQ.webp",qrs="/assets/w2-builder-Ce_8tH7i.webp",Krs="/assets/w3-trigger-Dkr9TqOl.webp",Yrs="/assets/w4-action-CgdwKkju.webp",Qrs="/assets/w4b-editor-D9NcuYAz.webp",Zrs="/assets/w5-bulk-C3ako0S1.webp",Jrs="/assets/w6-run-Dg7y51Fh.webp",Xrs="/assets/w7-list-NttPV2dW.webp",mw=(t,e,n)=>h4t(Grs,t,e,n),ess=[{icon:hSe,title:"Start",lines:["Pick a template","or start from scratch"]},{icon:Ey,title:"Who or when",lines:["A trigger, for automations","An audience, for bulk runs"]},{icon:k0,title:"Steps",lines:["Email, message, tag,","wait, reply, points"]},{icon:fm,title:"Switch it on",lines:["Activate, Run now","or Schedule"]}],tss=[{id:"start",icon:hSe,title:"Start a workflow",summary:"From a template, or from a blank canvas",what:"A workflow does a set of steps for a member without you doing them by hand: welcome everyone who joins, follow up when a subscription ends, message a whole space. Templates are complete workflows you can switch on after a read-through.",when:"Start from a template whenever one is close to what you want — every step in it can be changed or removed. Start from scratch when none fits.",steps:["Open Workflows and choose New workflow.","Pick a template. It opens in the builder with its trigger and steps already filled in.","Or choose Start from scratch and pick the kind: an Automation runs each time something happens, a Bulk action runs once for a group of members when you press Run now, and a Scheduled workflow does the same at a time you set."],ctas:[{label:"Browse templates",to:ve.workflowTemplates},{label:"Start from scratch",to:ve.workflowSelectType}],figures:[mw("w1-gallery",Wrs,{alt:"The Create new workflow page of a new community, listing workflow templates with category tabs on the left.",caption:"Templates. Each card says whether it is an Automation or a Bulk action.",labels:["Start from scratch, for a workflow no template covers.","Narrow the templates by what they are for.","Click a template to open it in the builder, ready to edit."]})]},{id:"builder",icon:Pg,title:"The builder",summary:"What starts it at the top, the steps underneath",what:"The builder is a single column read from top to bottom. The first box is what starts the workflow. Every box under it is a step, and a member goes through the steps in that order.",when:"You are here whenever you create or edit a workflow. Nothing runs until you switch it on, so it is safe to explore.",steps:["Click any box to open its settings on the right.","Use the + between two boxes to add a step there.","A green tick on a box means a trigger or action has been chosen for it.","The button at the top right switches the workflow on. If something is missing, the text beside it says which step and what it needs."],watchOut:"Each member goes through a workflow once. Someone who leaves and rejoins is not welcomed twice. The exceptions are course rewards (once per course), post workflows (once per post) and subscription workflows (once per subscription).",ctas:[{label:"Open Workflows",to:ve.workflows}],figures:[mw("w2-builder",qrs,{alt:"The workflow builder showing a trigger box followed by a time delay step and a send an email step.",caption:'The "Gather feedback via email" template: someone joins, a week passes, an email goes out.',labels:["The trigger: what starts the workflow for a member.","The steps, run from top to bottom. Click one to edit it.","Add a step between two others.","Activate switches it on."]})]},{id:"trigger",icon:Ey,title:"Triggers",summary:"The event that starts an automation",what:"A trigger is the moment a workflow starts for one member. An automation has exactly one, and it runs every time that thing happens for anyone in your community.",when:"Pick the trigger that matches the moment you want to act on. Some have a setting of their own, shown under Inputs.",steps:["About the member: Joined community, or Member became inactive — no post, comment or reaction for the number of days you choose.","About posts: Published a post (their first post only, or every post), and Post was held for review, approved or rejected by moderation.","About learning and tags: Completed course, and Tag added.","About paid memberships: Bought a paid plan (any plan, or the one you choose), Subscription scheduled to cancel, and Paid subscription ended."],watchOut:"Inactivity is checked once an hour, and signing in or reading does not count as activity. A member who has never posted, commented or reacted counts from the day they joined.",ctas:[{label:"Browse templates",to:ve.workflowTemplates}],figures:[mw("w3-trigger",Krs,{alt:"The builder with the trigger box selected and its settings open on the right, showing an Inactive for field set to 30 days.",caption:"The trigger's settings open on the right when you click it.",labels:["Click the trigger box to open its settings.","Change swaps it for a different trigger.","The trigger's own setting — here, how many days without activity. The ⓘ beside it explains exactly what counts.","Continue closes the panel. Your changes are kept."]})]},{id:"actions",icon:Ii,title:"Steps and personalisation",summary:"What the workflow does, and how to address each member",what:"Each step is one action: send an email, send a direct message, reply to the post, add or remove a tag, reward points, or wait before the next step. Emails and messages can include the member's own details.",when:"Add a wait between two messages so they do not arrive together, and a tag when you want to find these members again in Email Marketing.",steps:["Click a step and fill in its fields. An email needs a subject line and a body; a message or reply needs its text; a tag step needs the tag.","For an email, press Edit email to write the body in an editor with headings, bold, lists and links.","To personalise, put your cursor where the detail should go and click a Personalise button: First name, Full name, Email address, Community name or Post title.","An email is sent from your community's address. A direct message and a reply to a post are sent from the admin who created the workflow, even when another admin edits or runs it."],watchOut:"Only the Personalise buttons' variables are filled in. Anything else typed in double braces is sent as nothing, and the builder warns you while you type. Members who unsubscribed from your emails are skipped by email steps.",ctas:[{label:"Open Workflows",to:ve.workflows}],figures:[mw("w4-action",Yrs,{alt:"The builder with the send an email step selected and its settings open, showing a subject line and a preview of the email body with an Edit email button.",caption:"An email step. The template's wording is a starting point to edit.",labels:["Click the step to open its settings.","The subject line your member sees in their inbox.","A preview of the email. Edit email opens it in the editor.","Continue when the step is complete."]}),mw("w4b-editor",Qrs,{alt:"The Write email dialog, with a subject field, a formatting toolbar, the email body and a row of personalise buttons.",caption:"The email editor, opened with Edit email.",labels:["The subject line.","The toolbar: headings, bold, italic, lists, links and more.","The body, shown as your member will read it.","Personalise: click one to add it where your cursor is, in the subject or the body.","Save email keeps your changes and returns to the step."]})]},{id:"bulk",icon:wr,title:"Bulk and scheduled workflows",summary:"Run the steps once for a group of members",what:"A bulk action has no trigger. Its first box is an audience instead — all members, the members of one space, or members who are inactive — and it runs for those people when you press Run now. A scheduled workflow is the same, run at a date and time you choose.",when:"Use one for an announcement or a one-off message to people who are already members. For something that should happen to each new member as they arrive, use an automation.",steps:["Click the Audience box and choose who the workflow runs for. For a space, pick which one.","Complete the steps, exactly as in an automation.","Press Run now and confirm, or for a scheduled workflow set Run on and press Schedule.","A message tells you how many members it started for. Their steps start straight away, a few members at a time."],watchOut:"A run cannot be undone: messages that have been sent stay sent. Members who have already been through this workflow are skipped, so running it twice does not message anyone twice. One run reaches at most 2,000 members; run it again to reach the rest.",ctas:[{label:"Browse templates",to:ve.workflowTemplates}],figures:[mw("w5-bulk",Zrs,{alt:"The builder for a bulk action, with an Audience box selected and a Space dropdown open on the right.",caption:'The "Email all space members" template. It cannot run until a space is chosen.',labels:["The Audience box takes the place of a trigger.","Choose the space whose members should receive it.","What is still missing, in words. It disappears when the workflow is ready.","Run now is enabled once nothing is missing."]}),mw("w6-run",Jrs,{alt:"A confirmation dialog asking whether to run the workflow now.",caption:"Run now always asks first.",labels:["What is about to happen, and that it cannot be recalled.","Run now starts it. Cancel sends nothing."]})]},{id:"manage",icon:k0,title:"Managing workflows",summary:"Pause, resume, copy and delete",what:"The Workflows page lists every workflow with its kind, whether it is on, and how many members it has run for.",when:"Come back here to pause a workflow, to check that one is running, or to copy one as the start of another.",steps:["Use the switch to pause or resume a workflow. While it is off, new members do not start it, and members part-way through wait where they are.","Runs counts the members it has started for.","The menu at the end of a row has Edit, Duplicate, Activate or Deactivate, and Delete."],watchOut:"If a switch flips back to off, the workflow is missing something. A message says what; open the workflow to fix it.",ctas:[{label:"Open Workflows",to:ve.workflows}],figures:[mw("w7-list",Xrs,{alt:"The Workflows page listing three workflows with their status switches, run counts and row menus.",caption:"Two automations switched on, and a bulk action still in draft.",labels:["New workflow opens the templates.","The switch turns a workflow on or off. Draft means it has never been switched on.","How many members it has run for.","Edit, Duplicate, Activate or Deactivate, and Delete."]})]}];function iIe({className:t}){const[e,n]=y.useState(!1);return a.jsxs(a.Fragment,{children:[a.jsxs(Z,{variant:"outline",onClick:()=>n(!0),className:t,children:[a.jsx(Iu,{className:"mr-1.5 h-4 w-4"}),"How it works"]}),a.jsx(nss,{open:e,onOpenChange:n})]})}function nss({open:t,onOpenChange:e}){const n=Nn(),r=s=>{e(!1),n(s)};return a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"flex max-h-[min(90vh,880px)] flex-col gap-0 overflow-hidden p-0 sm:max-w-3xl",children:[a.jsxs(Vt,{className:"shrink-0 border-b border-border px-6 pb-4 pt-6",children:[a.jsx(Ut,{children:"How Workflows work"}),a.jsx(_n,{children:"How to build one, what can start it, and what it can do. About three minutes."})]}),a.jsxs("div",{className:"themed-scrollbar min-h-0 flex-1 space-y-4 overflow-y-auto px-6 py-4",children:[a.jsx(f4t,{heading:"Every workflow is built in the same four moves",flow:ess}),a.jsx(p4t,{sections:tss,defaultOpen:"start",onGo:r}),a.jsxs("div",{className:"rounded-lg border border-primary/30 bg-primary/5 p-4",children:[a.jsxs("p",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[a.jsx(ja,{className:"h-4 w-4 text-primary","aria-hidden":"true"}),"New here? Start with a welcome"]}),a.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:'Open the "Email new members" template, read the email, and press Activate. From then on everyone who joins is welcomed, and you have seen every part of a workflow in two steps.'}),a.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[a.jsxs(Z,{size:"sm",onClick:()=>r(ve.workflowTemplates),children:[a.jsx(bO,{className:"mr-1.5 h-3.5 w-3.5"}),"Choose a template"]}),a.jsxs(Z,{size:"sm",variant:"outline",onClick:()=>r(ve.workflows),children:[a.jsx(k0,{className:"mr-1.5 h-3.5 w-3.5"}),"See my workflows"]})]})]})]})]})})}function g4t({template:t,onClick:e}){const n=t.icon;return a.jsxs("button",{onClick:e,className:"group flex flex-col rounded-xl border border-border bg-card p-4 text-left transition-all duration-150 ease-linear hover:border-foreground/20 hover:shadow-card-hover",children:[a.jsxs("div",{className:"mb-3 flex w-full items-start justify-between",children:[a.jsx("span",{className:"flex h-9 w-9 items-center justify-center rounded-lg bg-foreground text-background",children:a.jsx(n,{className:"h-4 w-4"})}),a.jsxs("div",{className:"flex items-center gap-2 pt-1",children:[t.emailHub&&a.jsxs("span",{className:"flex items-center gap-1 text-[11px] font-semibold uppercase tracking-wide text-primary",children:[a.jsx(_s,{className:"h-3 w-3"})," Email Hub"]}),t.isNew&&a.jsx("span",{className:"text-[11px] font-bold uppercase tracking-wide text-rose-500",children:"New"})]})]}),a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:t.title}),a.jsx("p",{className:"mt-1 line-clamp-2 text-xs text-muted-foreground",children:t.desc}),a.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[a.jsx("span",{className:ee("flex items-center gap-1 rounded-md px-2 py-0.5 text-[11px] font-medium",t.type==="Automation"?"bg-muted text-foreground":"bg-amber-50 text-amber-600 dark:bg-amber-500/10"),children:t.type}),t.tags.map(r=>a.jsx("span",{className:"rounded-md bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground",children:r},r))]})]})}const yZe=t=>t.reduce((e,n)=>e+n.items.length,0),rss=[{big:String(l8.length),small:"Ready-made templates to start from, or build your own from scratch"},{big:String(yZe(a4t)),small:"Member events that can start an automation by themselves"},{big:String(yZe(o4t)),small:"Things a workflow can do for each member it runs for"}],fhe=[{id:"automated",label:"Automated workflows",heading:"Save time without losing control",sub:"Let workflows handle the repetitive follow-ups so you can spend your time with members.",points:["Welcome new members with an email or a direct message the moment they join","Follow up when a subscription ends, a course is completed or a member goes quiet","Tell authors when their post is held for review, approved or rejected"]},{id:"personalized",label:"Personalised engagement",heading:"Make every member feel seen",sub:"Each member gets a message written for them, sent from you.",points:["Use each member's name, your community's name and the post title in any message","Write emails in a full editor, and link your feedback form","Tag members so your Email Marketing campaigns and sequences can pick up from there"]},{id:"scalable",label:"Bulk and scheduled",heading:"Reach a whole audience in one go",sub:"The same steps, run for many members at once.",points:["Email or message every member, one space, or members who have gone quiet","Run it now, or schedule it once for a time you choose","Watch progress live, and see who was skipped or failed and why"]}],sss=[{title:"Pick a starting point",text:"Choose a template that is close to what you need, or start with an empty workflow."},{title:"Set the trigger and the steps",text:"Say what starts it, or who it runs for, then add steps: an email, a message, a tag, a wait, points."},{title:"Activate and follow along",text:"Switch it on. The Workflows list shows how many members it has run for and what was sent."}],iss="inline-flex items-center justify-center rounded-lg bg-foreground px-4 py-2.5 text-sm font-medium text-background transition-colors duration-150 hover:bg-foreground/90";function ass(){return a.jsxs("div",{className:"relative mx-auto flex w-full max-w-sm flex-col items-center",children:[a.jsxs("span",{className:"mb-1 flex items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-medium text-primary",children:[a.jsx(Ey,{className:"h-3 w-3"})," Trigger"]}),a.jsxs("div",{className:"flex w-full items-center justify-between rounded-xl border border-border bg-card p-3 shadow-card",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[a.jsx(phe,{icon:Sa})," Joined community"]}),a.jsx(yo,{className:"h-4 w-4 text-emerald-500"})]}),a.jsx("div",{className:"h-6 w-px bg-border"}),a.jsx("span",{className:"mb-1 rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-medium text-primary",children:"Action"}),a.jsxs("div",{className:"flex w-full items-center justify-between rounded-xl border border-border bg-card p-3 shadow-card",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[a.jsx(phe,{icon:x2})," Send a direct message"]}),a.jsx(yo,{className:"h-4 w-4 text-emerald-500"})]}),a.jsx("div",{className:"h-6 w-px bg-border"}),a.jsx("span",{className:"mb-1 rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-medium text-primary",children:"Action"}),a.jsxs("div",{className:"flex w-full items-center justify-between rounded-xl border border-border bg-card p-3 shadow-card",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[a.jsx(phe,{icon:ka})," Add tag"]}),a.jsx(yo,{className:"h-4 w-4 text-emerald-500"})]}),a.jsx("div",{className:"h-6 w-px bg-border"}),a.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(xd,{className:"h-3.5 w-3.5"})," End"]})]})}function phe({icon:t}){return a.jsx("span",{className:"flex h-5 w-5 items-center justify-center rounded-md bg-primary/10",children:a.jsx(t,{className:"h-3 w-3 text-primary"})})}function oss({onCreate:t}){const[e,n]=y.useState(fhe[0].id),r=fhe.find(s=>s.id===e);return a.jsxs(it.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.3,ease:"easeOut"},className:"mx-auto max-w-5xl space-y-16 px-2 pb-16",children:[a.jsxs("div",{className:"grid items-center gap-8 pt-6 lg:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-4xl font-bold leading-tight tracking-tight text-foreground",children:"Automate manual tasks and scale your impact with Workflows"}),a.jsx("p",{className:"mt-4 max-w-md text-sm leading-relaxed text-muted-foreground",children:"Workflows take over the repetitive follow-ups: welcoming new members, checking in when someone goes quiet, messaging a whole space. Each member still gets a message written for them."}),a.jsxs("div",{className:"mt-6 flex flex-wrap items-center gap-2",children:[a.jsx("button",{onClick:t,className:iss,children:"Create your first workflow"}),a.jsx(iIe,{className:"h-10"})]})]}),a.jsx(ass,{})]}),a.jsx("div",{className:"grid gap-4 sm:grid-cols-3",children:rss.map(s=>a.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 text-center",children:[a.jsx("p",{className:"text-3xl font-bold text-foreground",children:s.big}),a.jsx("p",{className:"mx-auto mt-2 max-w-[200px] text-xs text-muted-foreground",children:s.small})]},s.big))}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-bold tracking-tight text-foreground",children:"What you get with Workflows"}),a.jsx("div",{className:"mt-4 flex flex-wrap items-center gap-1",children:fhe.map(s=>a.jsx("button",{onClick:()=>n(s.id),className:ee("rounded-lg px-3 py-1.5 text-sm font-medium transition-colors duration-150",e===s.id?"bg-card text-foreground shadow-card":"text-muted-foreground hover:text-foreground"),children:s.label},s.id))}),a.jsxs(it.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.2},className:"mt-4 grid items-center gap-8 rounded-2xl bg-muted/40 p-8 lg:grid-cols-2",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-xl font-bold text-foreground",children:r.heading}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:r.sub}),a.jsx("ul",{className:"mt-5 space-y-3",children:r.points.map(s=>a.jsxs("li",{className:"flex items-start gap-2 text-sm font-medium text-foreground",children:[a.jsx(yo,{className:"mt-0.5 h-4 w-4 shrink-0 text-emerald-500"}),s]},s))})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5 shadow-card",children:[a.jsxs("div",{className:"rounded-lg border border-border p-3",children:[a.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Member joins community"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Esther Howard · New York, USA"})]}),a.jsx("div",{className:"my-2 flex justify-center",children:a.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-foreground px-2.5 py-1 text-[11px] font-medium text-background",children:[a.jsx(Ey,{className:"h-3 w-3"})," Workflow triggered"]})}),a.jsxs("div",{className:"rounded-lg border border-border p-3",children:[a.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Direct message from you"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Hi Esther, welcome to the community! Let me know if you have any questions."})]}),a.jsx("div",{className:"mt-3 flex flex-wrap justify-center gap-2",children:["Send an email","Add a tag","Reward points"].map(s=>a.jsxs("span",{className:"flex items-center gap-1 rounded-full bg-foreground px-2.5 py-1 text-[11px] font-medium text-background",children:[a.jsx(Ey,{className:"h-3 w-3"})," ",s]},s))})]})]},r.id)]}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-bold tracking-tight text-foreground",children:"Three steps to your first workflow"}),a.jsx("ol",{className:"mt-4 grid gap-4 sm:grid-cols-3",children:sss.map((s,i)=>a.jsxs("li",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-primary/10 text-sm font-semibold text-primary",children:i+1}),a.jsx("p",{className:"mt-3 text-sm font-semibold text-foreground",children:s.title}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:s.text})]},s.title))})]}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-bold tracking-tight text-foreground",children:"Popular automations"}),a.jsx("div",{className:"mt-4 grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:l8.slice(0,3).map(s=>a.jsx(g4t,{template:s,onClick:t},s.id))})]})]})}function aIe(t){return!!(t&&(t.members.running>0||t.emails.queued>0))}function bZe(t){return!!(t&&(aIe(t)||t.members.waiting>0))}const sb=t=>encodeURIComponent(t);function sv(t){return`/workflow-engine/community/${sb(t)}/workflows`}async function lss(t,e){return(await ae.get(`${sv(t)}`)).workflows??[]}async function xZe(t,e){const n=e!=null&&e.length?`?ids=${e.map(sb).join(",")}`:"";return(await ae.get(`${sv(t)}/progress${n}`)).progress??{}}async function css(t,e,n){const r=n?`?before=${encodeURIComponent(n)}`:"",s=await ae.get(`${sv(t)}/${sb(e)}/issues${r}`);return{issues:s.issues??[],next:s.truncated?s.next??null:null}}async function dss(t,e){return(await ae.get(`${sv(t)}/${sb(e)}`)).workflow}async function wZe(t,e){return(await ae.post(sv(t),e)).workflow}async function kZe(t,e,n){return(await ae.patch(`${sv(t)}/${sb(e)}`,n)).workflow}async function uss(t,e){await ae.delete(`${sv(t)}/${sb(e)}`)}async function SZe(t,e){return(await ae.post(`${sv(t)}/${sb(e)}/activate`)).workflow}async function hss(t,e){return(await ae.post(`${sv(t)}/${sb(e)}/pause`)).workflow}async function mss(t,e){return ae.post(`${sv(t)}/${sb(e)}/run`)}async function fss(t,e,n){return(await ae.post(`${sv(t)}/${sb(e)}/schedule`,{scheduledAt:n})).workflow}const J3=(t,e)=>({ok:!1,message:dn(t,e)});let Ji=[];const O1e=new Set,Lv=()=>O1e.forEach(t=>t());let pss=0;const c8=(t="wf")=>`${t}_${Date.now().toString(36)}_${pss++}`,Mj=new Map,CZe=new Map;let jZe=null,ghe=!1;function Uw(){try{const t=sessionStorage.getItem(pY.activeCommunity);return t?JSON.parse(t).id??null:null}catch{return null}}const $p=t=>Mj.get(t)??t;function oIe(t){var e;return{id:t.id,name:t.name,kind:t.kind,status:t.status,nodes:G$(t.name,(t.nodes??[]).map(n=>({id:n.id,kind:n.kind,itemId:n.itemId??null,config:n.config}))),runs:((e=t.stats)==null?void 0:e.runs)??0,lastModified:yc(t.updatedAt)||"just now",scheduledAt:t.scheduledAt??null}}function CH(t,e){const n=oIe(e);Ji=Ji.map(r=>r.id===t?{...n,id:t}:r),Lv()}function UT(t,e){const n=(CZe.get(t)??Promise.resolve()).then(e,e);return CZe.set(t,n.catch(()=>{})),n}function gss(){const t=Uw();!t||ghe||jZe===t||(ghe=!0,lss(t).then(e=>{const n=e.map(oIe),r=new Set(n.map(o=>o.id)),s=Ji.filter(o=>{const l=Mj.get(o.id);return l?r.has(l):!r.has(o.id)}),i=new Set(s.map(o=>$p(o.id)));Ji=[...s.map(o=>{const l=Mj.get(o.id),c=l?n.find(d=>d.id===l):void 0;return c?{...c,id:o.id}:o}),...n.filter(o=>!i.has(o.id))],jZe=t,Lv()}).catch(e=>console.error("[workflows] fetch failed",e)).finally(()=>{ghe=!1}))}const fc={getAll:()=>Ji,serverId:t=>$p(t),get:t=>Ji.find(e=>e.id===t||e.id===Mj.get(t)),load(t){const e=Uw();return e?dss(e,t).then(n=>{const r=oIe(n);return Ji.some(s=>$p(s.id)===r.id)||(Ji=[r,...Ji],Lv()),r}).catch(n=>(console.error("[workflows] open failed",n),null)):Promise.resolve(null)},subscribe(t){return gss(),O1e.add(t),()=>O1e.delete(t)},add(t){const e={...t,nodes:G$(t.name,t.nodes)};Ji=[e,...Ji],Lv();const n=Uw();n&&UT(t.id,()=>wZe(n,{name:e.name,kind:e.kind,nodes:e.nodes}).then(r=>{Mj.set(t.id,r.id),CH(t.id,r)})).catch(r=>console.error("[workflows] create failed",r))},upsert(t){t={...t,nodes:G$(t.name,t.nodes)};const e=Ji.some(i=>i.id===t.id),n=Ji.find(i=>i.id===t.id);Ji=e?Ji.map(i=>i.id===t.id?t:i):[t,...Ji],Lv();const r=Uw();if(!r)return Promise.resolve({ok:!1,message:"Open a community first, then try again."});const s=t.status==="active"&&(n==null?void 0:n.status)!=="active";return UT(t.id,async()=>{let i;if(!e&&!Mj.has(t.id)&&!v4t(t.id)?(i=await wZe(r,{name:t.name,kind:t.kind,nodes:t.nodes}),Mj.set(t.id,i.id)):i=await kZe(r,$p(t.id),{name:t.name,kind:t.kind,nodes:t.nodes}),s)try{i=await SZe(r,$p(t.id))}catch(o){return Ji=Ji.map(l=>l.id===t.id?{...l,status:(n==null?void 0:n.status)??"draft"}:l),Lv(),console.error("[workflows] activate failed",o),J3(o,"This workflow could not be activated. Check each step and try again.")}return CH(t.id,i),{ok:!0,message:s?"Workflow activated":"Workflow saved"}}).catch(i=>(console.error("[workflows] save failed",i),J3(i,"Your changes could not be saved. Try again.")))},run(t){const e=Uw();return e?UT(t,async()=>{const n=await mss(e,$p(t));return Ji=Ji.map(r=>r.id===t?{...r,runs:r.runs+(n.enrolled??0)}:r),Lv(),{ok:!0,message:n.message}}).catch(n=>J3(n,"This workflow could not be started. Try again.")):Promise.resolve({ok:!1,message:"Open a community first, then try again."})},schedule(t,e){const n=Uw();return n?UT(t,async()=>(CH(t,await fss(n,$p(t),e)),{ok:!0,message:"Workflow scheduled"})).catch(r=>J3(r,"This workflow could not be scheduled. Try again.")):Promise.resolve({ok:!1,message:"Open a community first, then try again."})},remove(t){Ji=Ji.filter(n=>n.id!==t),Lv();const e=Uw();e&&UT(t,()=>uss(e,$p(t))).catch(n=>console.error("[workflows] delete failed",n))},duplicate(t){const e=Ji.find(r=>r.id===t);if(!e)return;const n={...e,id:c8(),name:`${e.name} (copy)`,status:"draft",runs:0,lastModified:"just now",nodes:e.nodes.map(r=>({...r}))};fc.add(n)},toggleStatus(t){const e=Ji.find(s=>s.id===t);if(!e)return Promise.resolve({ok:!1,message:"This workflow no longer exists."});const n=e.status!=="active";Ji=Ji.map(s=>s.id===t?{...s,status:n?"active":"inactive"}:s),Lv();const r=Uw();return r?UT(t,async()=>{try{const s=G$(e.name,e.nodes);n&&s.some((o,l)=>{var c;return o.itemId!==((c=e.nodes[l])==null?void 0:c.itemId)})&&await kZe(r,$p(t),{name:e.name,kind:e.kind,nodes:s});const i=n?await SZe(r,$p(t)):await hss(r,$p(t));return CH(t,i),{ok:!0,message:n?"Workflow activated":"Workflow paused"}}catch(s){return Ji=Ji.map(i=>i.id===t?{...i,status:e.status}:i),Lv(),console.error("[workflows] status change failed",s),J3(s,n?"This workflow could not be activated. Open it and check each step.":"This workflow could not be paused. Try again.")}}):Promise.resolve({ok:!1,message:"Open a community first, then try again."})}};function v4t(t){return/^[a-f0-9]{24}$/i.test(t)}function vss(){return y.useSyncExternalStore(fc.subscribe,fc.getAll,fc.getAll)}const yss={failed:{label:"Failed",icon:Bf,className:"bg-destructive/10 text-destructive"},skipped:{label:"Skipped",icon:Nrt,className:"bg-muted text-muted-foreground"}};function bss({issue:t}){var s;const e=yss[t.kind],n=t.step&&((s=sIe[t.step])==null?void 0:s.label)||"Step",r=t.name||t.email||"Unknown member";return a.jsxs("li",{className:"space-y-1 px-1 py-3",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:r}),t.name&&t.email&&a.jsx("p",{className:"truncate text-xs text-muted-foreground",children:t.email})]}),a.jsxs("span",{className:ee("inline-flex shrink-0 items-center gap-1 rounded-md px-1.5 py-0.5 text-[11px] font-medium",e.className),children:[a.jsx(e.icon,{className:"h-3 w-3","aria-hidden":"true"}),e.label]})]}),a.jsx("p",{className:"text-xs text-foreground",children:t.reason}),a.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[n," · ",new Date(t.at).toLocaleString()]})]})}function xss({workflowId:t,workflowName:e,open:n,onOpenChange:r}){const{community:s}=qe(),i=(s==null?void 0:s.id)??null,{data:o,isLoading:l,isError:c,refetch:d,hasNextPage:u,fetchNextPage:h,isFetchingNextPage:m,isFetchNextPageError:f}=C0({queryKey:["workflow-issues",i,t],initialPageParam:void 0,queryFn:({pageParam:v})=>css(i,t,v),getNextPageParam:v=>v.next??void 0,enabled:n&&!!i,staleTime:0}),p=(o==null?void 0:o.pages.flatMap(v=>v.issues))??[],g=c&&!f;return a.jsx(Bt,{open:n,onOpenChange:r,children:a.jsxs(Ft,{className:"max-w-lg",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Skipped and failed"}),a.jsxs(_n,{children:["Members a step of “",e,"” did not reach, and why. Skipped means the step did not apply to them; failed means it was tried and did not work."]})]}),l&&a.jsxs("p",{className:"flex items-center gap-2 py-6 text-sm text-muted-foreground",role:"status",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin","aria-hidden":"true"})," Loading…"]}),g&&a.jsxs("div",{className:"space-y-2 py-4",role:"alert",children:[a.jsx("p",{className:"text-sm text-destructive",children:"This list could not be loaded. Check your connection and try again."}),a.jsx("button",{onClick:()=>void d(),className:"rounded-md border border-border px-3 py-1.5 text-xs font-medium hover:bg-muted",children:"Try again"})]}),!l&&!g&&p.length===0&&a.jsx("p",{className:"py-6 text-sm text-muted-foreground",children:"Nothing was skipped or failed. Every step reached every member."}),p.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("ul",{className:"max-h-[60vh] divide-y divide-border overflow-y-auto",children:p.map((v,b)=>a.jsx(bss,{issue:v},`${v.at}-${v.email}-${v.step}-${b}`))}),f&&a.jsx("p",{className:"text-xs text-destructive",role:"alert",children:"Older ones could not be loaded. Check your connection and try again."}),u&&a.jsxs("button",{onClick:()=>void h(),disabled:m,className:"inline-flex items-center gap-2 justify-self-start rounded-md border border-border px-3 py-1.5 text-xs font-medium hover:bg-muted disabled:opacity-60",children:[m&&a.jsx(Ne,{className:"h-3 w-3 animate-spin","aria-hidden":"true"}),m?"Loading…":"Show older"]})]})]})})}const wss=4e3,kss=3e4;function Sss(){const{community:t}=qe(),e=rn(),n=(t==null?void 0:t.id)??null,r=["workflow-progress",n];return lt({queryKey:r,enabled:!!n,staleTime:0,refetchOnMount:"always",queryFn:async()=>{const i=e.getQueryData(r),o=i?Object.keys(i).filter(l=>bZe(i[l])):[];return o.length?{...i,...await xZe(n,o)}:xZe(n)},refetchInterval:i=>{if(i.state.status==="error")return!1;const o=Object.values(i.state.data??{});return o.some(aIe)?wss:o.some(bZe)?kss:!1}}).data??{}}const Css={success:"bg-emerald-50 text-emerald-700 dark:bg-emerald-500/10 dark:text-emerald-400",danger:"bg-destructive/10 text-destructive",muted:"bg-muted text-muted-foreground"};function zT({icon:t,tone:e,children:n}){return a.jsxs("span",{className:ee("inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[11px] font-medium tabular-nums",Css[e]),children:[a.jsx(t,{className:"h-3 w-3 shrink-0","aria-hidden":"true"}),n]})}const jss=(t,e)=>`${t.toLocaleString()} ${e}${t===1?"":"s"}`;function Ess({progress:t,onShowIssues:e}){if(!t||t.members.total===0)return null;const{members:n,emails:r,delivered:s,skipped:i,stepsFailed:o}=t,l=aIe(t),c=n.running>0,d=c?n.done:r.sent+r.failed,u=c?n.total:r.total,h=u?Math.round(d/u*100):0,m=!c&&r.total?r.failed/r.total*100:0,f=r.failed+o;return a.jsxs("div",{className:"mt-1.5 w-80 max-w-full space-y-1.5",role:"status","aria-live":"polite",children:[l&&a.jsxs("div",{className:"space-y-1",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs",children:[a.jsxs("span",{className:"flex items-center gap-1.5 whitespace-nowrap font-medium text-primary",children:[a.jsxs("span",{className:"relative flex h-2 w-2","aria-hidden":"true",children:[a.jsx("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-primary/60"}),a.jsx("span",{className:"relative inline-flex h-2 w-2 rounded-full bg-primary"})]}),c?"Running":"Sending emails"]}),a.jsxs("span",{className:"whitespace-nowrap tabular-nums text-muted-foreground",children:[d.toLocaleString()," of ",u.toLocaleString()," ",c?"members":"emails"]})]}),a.jsxs("div",{className:"flex h-1.5 overflow-hidden rounded-full bg-muted","aria-label":`${h}% done`,children:[a.jsx("div",{className:"h-full bg-primary transition-all duration-500",style:{width:`${Math.max(0,h-m)}%`}}),a.jsx("div",{className:"h-full bg-destructive transition-all duration-500",style:{width:`${m}%`}})]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-1",children:[r.sent>0&&a.jsxs(zT,{icon:Qn,tone:"success",children:[r.sent.toLocaleString()," sent"]}),s>0&&a.jsxs(zT,{icon:lee,tone:"success",children:[s.toLocaleString()," delivered"]}),f>0&&a.jsxs(zT,{icon:Bf,tone:"danger",children:[f.toLocaleString()," failed"]}),i>0&&a.jsxs(zT,{icon:Nrt,tone:"muted",children:[i.toLocaleString()," skipped"]}),n.waiting>0&&a.jsxs(zT,{icon:$Bt,tone:"muted",children:[n.waiting.toLocaleString()," waiting"]}),!l&&r.total===0&&f===0&&i===0&&n.waiting===0&&a.jsxs(zT,{icon:Qn,tone:"success",children:["Done for ",jss(n.done,"member")]}),a.jsx(gn,{label:"these numbers",children:"Sent means the email service accepted the email. Delivered means the member's mail server confirmed it arrived, which can follow a little later. Failed could not be sent. Skipped is a step that did not apply to a member: they unsubscribed or their address bounced, they have no email address, or they have left the community. Waiting members are part-way through, held by a delay step. While a workflow is running this updates by itself every few seconds."})]}),f+i>0&&a.jsxs("button",{onClick:e,className:"text-xs font-medium text-primary hover:underline",children:["See who was ",f>0&&i>0?"skipped or failed":f>0?"failed":"skipped",", and why"]})]})}const Nss={automation:{label:"Automation",icon:Ey},bulk:{label:"Bulk action",icon:vK},scheduled:{label:"Scheduled",icon:ja}},Tss={active:"bg-emerald-50 text-emerald-600 dark:bg-emerald-500/10",inactive:"bg-muted text-muted-foreground",draft:"bg-amber-50 text-amber-600 dark:bg-amber-500/10"};function _ss(){const t=Nn(),e=vss(),n=Sss(),r=()=>t(ve.workflowTemplates);return e.length===0?a.jsx(oss,{onCreate:r}):a.jsxs(it.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.25,ease:"easeOut"},className:"mx-auto max-w-5xl space-y-5 pb-10",children:[a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between sm:gap-4",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold tracking-tight text-foreground",children:"Workflows"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Automate repetitive tasks with triggers and actions."})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(iIe,{className:"h-9"}),a.jsxs("button",{onClick:r,className:"inline-flex items-center gap-1.5 rounded-lg bg-foreground px-3.5 py-2 text-sm font-medium text-background transition-colors duration-150 hover:bg-foreground/90",children:[a.jsx(Dn,{className:"h-4 w-4"})," New workflow"]})]})]}),a.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card",children:a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full",children:[a.jsx("thead",{children:a.jsx("tr",{className:"border-b border-border bg-muted/40",children:["Workflow","Status","Runs","Last modified",""].map((s,i)=>a.jsx("th",{className:ee("px-5 py-3 text-left text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",i===4&&"w-12"),children:s},i))})}),a.jsx("tbody",{className:"divide-y divide-border",children:e.map(s=>a.jsx(Ass,{wf:s,progress:n[fc.serverId(s.id)],onOpen:()=>t(ve.workflowBuilder(s.id))},s.id))})]})})})]})}function Ass({wf:t,progress:e,onOpen:n}){const r=Nss[t.kind],{toast:s}=yt(),i=async()=>{const c=await fc.toggleStatus(t.id);c.ok||s({title:"Workflow not changed",description:c.message,variant:"destructive"})},[o,l]=y.useState(!1);return a.jsxs("tr",{className:"transition-colors duration-150 ease-linear hover:bg-muted/40",children:[a.jsx("td",{className:"px-5 py-3.5",children:a.jsxs("button",{onClick:n,className:"flex items-center gap-3 text-left",children:[a.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-foreground text-background",children:a.jsx(r.icon,{className:"h-4 w-4"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"truncate text-sm font-medium text-foreground hover:underline",children:t.name}),a.jsx("p",{className:"text-xs text-muted-foreground",children:r.label})]})]})}),a.jsx("td",{className:"px-5 py-3.5",children:a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx(Hs,{checked:t.status==="active",onCheckedChange:()=>void i()}),a.jsx("span",{className:ee("rounded-md px-2 py-0.5 text-xs font-medium capitalize",Tss[t.status]),children:t.status})]})}),a.jsxs("td",{className:"px-5 py-3.5 text-sm text-muted-foreground",children:[a.jsxs("p",{children:[a.jsx("span",{className:"font-medium tabular-nums text-foreground",children:((e==null?void 0:e.members.total)??t.runs).toLocaleString()})," ",a.jsx("span",{className:"text-xs",children:((e==null?void 0:e.members.total)??t.runs)===1?"member":"members"})]}),a.jsx(Ess,{progress:e,onShowIssues:()=>l(!0)})]}),a.jsx("td",{className:"px-5 py-3.5 text-sm text-muted-foreground",children:t.lastModified}),a.jsxs("td",{className:"px-5 py-3.5",children:[a.jsxs(Tr,{children:[a.jsx(_r,{className:"flex h-7 w-7 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:a.jsx(Ys,{className:"h-4 w-4"})}),a.jsxs(Cr,{align:"end",className:"w-40",children:[a.jsx(ot,{onClick:n,children:"Edit"}),a.jsx(ot,{onClick:()=>fc.duplicate(t.id),children:"Duplicate"}),a.jsx(ot,{onClick:()=>void i(),children:t.status==="active"?"Deactivate":"Activate"}),e&&a.jsx(ot,{onClick:()=>l(!0),children:"Skipped and failed"}),a.jsx(mi,{}),a.jsx(ot,{onClick:()=>fc.remove(t.id),className:"text-destructive focus:text-destructive",children:"Delete"})]})]}),o&&a.jsx(xss,{workflowId:fc.serverId(t.id),workflowName:t.name,open:o,onOpenChange:l})]})]})}function Pss(){var d;const t=Nn(),[e,n]=y.useState("all"),[r,s]=y.useState("All"),[i,o]=y.useState(""),l=y.useMemo(()=>l8.filter(u=>e==="all"||u.category===e).filter(u=>r==="All"||u.type===r).filter(u=>u.title.toLowerCase().includes(i.toLowerCase())),[e,r,i]),c=u=>{const h=l8.find(f=>f.id===u),m=c8();fc.add({id:m,name:h?h.title:"Untitled workflow",kind:(h==null?void 0:h.type)==="Bulk Action"?"bulk":"automation",status:"draft",runs:0,lastModified:"just now",nodes:Hrs(u)}),t(ve.workflowBuilder(m))};return a.jsxs(it.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.25,ease:"easeOut"},className:"-mx-3 -mb-6 -mt-3 flex min-h-[calc(100vh-64px)] flex-col sm:-mx-4 lg:-m-6",children:[a.jsxs("div",{className:"flex items-center gap-3 border-b border-border px-6 py-4",children:[a.jsx("button",{onClick:()=>t(ve.workflows),className:"flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:a.jsx(no,{className:"h-4 w-4"})}),a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Create new workflow"}),a.jsx(iIe,{className:"ml-auto h-9"})]}),a.jsxs("div",{className:"flex flex-1 gap-8 px-6 py-6",children:[a.jsxs("aside",{className:"hidden w-52 shrink-0 lg:block",children:[a.jsx("button",{onClick:()=>t(ve.workflowSelectType),className:"mb-4 w-full rounded-lg bg-foreground px-3 py-2 text-sm font-medium text-background transition-colors hover:bg-foreground/90",children:"Start from scratch"}),a.jsx("nav",{className:"flex flex-col space-y-px",children:mhe.map(u=>a.jsxs("button",{onClick:()=>n(u.id),className:ee("flex items-center justify-between rounded-lg px-2.5 py-1.5 text-sm transition-colors duration-150 ease-linear",e===u.id?"bg-muted font-medium text-foreground":"text-muted-foreground hover:bg-muted/60 hover:text-foreground"),children:[u.label,u.badge&&a.jsx("span",{className:"rounded bg-primary/10 px-1.5 py-0.5 text-[10px] font-semibold text-primary",children:u.badge})]},u.id))})]}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"mb-5 flex gap-2 lg:hidden",children:[a.jsxs(zn,{value:e,onValueChange:u=>n(u),children:[a.jsx(On,{"aria-label":"Template category",className:"h-10 min-w-0 flex-1",children:a.jsx(Vn,{})}),a.jsx(Fn,{children:mhe.map(u=>a.jsx(pt,{value:u.id,children:u.label},u.id))})]}),a.jsx("button",{onClick:()=>t(ve.workflowSelectType),className:"shrink-0 rounded-lg bg-foreground px-3 py-2 text-sm font-medium text-background transition-colors hover:bg-foreground/90",children:"Start from scratch"})]}),a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("h2",{className:"text-xl font-bold tracking-tight text-foreground",children:[(d=mhe.find(u=>u.id===e))==null?void 0:d.label," templates"]}),a.jsxs("div",{className:"relative",children:[a.jsx(hs,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{value:i,onChange:u=>o(u.target.value),placeholder:"Search",className:"h-9 w-56 rounded-lg border border-border bg-card pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]})]}),a.jsxs("div",{className:"mt-3 flex items-center gap-3",children:[a.jsxs(Tr,{children:[a.jsxs(_r,{className:"inline-flex items-center gap-1.5 rounded-lg border border-border bg-card px-2.5 py-1.5 text-sm text-foreground transition-colors hover:bg-muted/50",children:["Type: ",a.jsx("span",{className:"font-medium",children:r})]}),a.jsx(Cr,{align:"start",children:["All","Automation","Bulk Action"].map(u=>a.jsx(ot,{onClick:()=>s(u),children:u},u))})]}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[l.length," workflow templates"]})]}),a.jsx("div",{className:"mt-5 grid gap-4 sm:grid-cols-2 xl:grid-cols-3",children:l.map(u=>a.jsx(g4t,{template:u,onClick:()=>c(u.id)},u.id))}),l.length===0&&a.jsx("p",{className:"mt-12 text-center text-sm text-muted-foreground",children:"No templates match your filters."})]})]})]})}function Rss(){const t=Nn(),[e,n]=y.useState("automation"),r=()=>{var l;const s=c8(),i=new Date,o=`${(l=pZe.find(c=>c.id===e))==null?void 0:l.title} ${i.toLocaleDateString(void 0,{month:"short",day:"numeric"})}`;fc.add({id:s,name:o,kind:e,status:"draft",runs:0,lastModified:"just now",nodes:[{id:"n1",kind:"trigger",itemId:null}]}),t(ve.workflowBuilder(s))};return a.jsxs(it.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.25,ease:"easeOut"},className:"-mx-3 -mb-6 -mt-3 flex min-h-[calc(100vh-64px)] flex-col sm:-mx-4 lg:-m-6",children:[a.jsxs("div",{className:"flex items-center gap-3 border-b border-border px-6 py-4",children:[a.jsx("button",{onClick:()=>t(ve.workflowTemplates),className:"flex h-8 w-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:a.jsx(no,{className:"h-4 w-4"})}),a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Custom workflow"})]}),a.jsxs("div",{className:"mx-auto w-full max-w-4xl px-6 py-12",children:[a.jsx("h2",{className:"text-2xl font-bold tracking-tight text-foreground",children:"Choose workflow type"}),a.jsx("div",{className:"mt-6 grid gap-4 md:grid-cols-3",children:pZe.map(s=>{const i=e===s.id;return a.jsxs("button",{onClick:()=>n(s.id),className:ee("rounded-xl border p-5 text-left transition-all duration-150",i?"border-foreground ring-1 ring-foreground":"border-border hover:border-foreground/30"),children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsx("h3",{className:"text-lg font-bold text-foreground",children:s.title}),a.jsx("span",{className:ee("mt-1 flex h-4 w-4 items-center justify-center rounded-full border",i?"border-foreground":"border-muted-foreground/40"),children:i&&a.jsx("span",{className:"h-2 w-2 rounded-full bg-foreground"})})]}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:s.desc})]},s.id)})}),a.jsxs("div",{className:"mt-8 flex items-center justify-end gap-3",children:[a.jsx("button",{onClick:()=>t(ve.workflows),className:"rounded-lg px-4 py-2 text-sm font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:"Cancel"}),a.jsx("button",{onClick:r,className:"rounded-lg bg-foreground px-4 py-2 text-sm font-medium text-background transition-colors hover:bg-foreground/90",children:"Create workflow"})]})]})]})}function nc(t){if(typeof t=="string"||typeof t=="number")return""+t;let e="";if(Array.isArray(t))for(let n=0,r;n<t.length;n++)(r=nc(t[n]))!==""&&(e+=(e&&" ")+r);else for(let n in t)t[n]&&(e+=(e&&" ")+n);return e}var Iss={value:()=>{}};function nae(){for(var t=0,e=arguments.length,n={},r;t<e;++t){if(!(r=arguments[t]+"")||r in n||/[\s.]/.test(r))throw new Error("illegal type: "+r);n[r]=[]}return new Rq(n)}function Rq(t){this._=t}function Mss(t,e){return t.trim().split(/^|\s+/).map(function(n){var r="",s=n.indexOf(".");if(s>=0&&(r=n.slice(s+1),n=n.slice(0,s)),n&&!e.hasOwnProperty(n))throw new Error("unknown type: "+n);return{type:n,name:r}})}Rq.prototype=nae.prototype={constructor:Rq,on:function(t,e){var n=this._,r=Mss(t+"",n),s,i=-1,o=r.length;if(arguments.length<2){for(;++i<o;)if((s=(t=r[i]).type)&&(s=Lss(n[s],t.name)))return s;return}if(e!=null&&typeof e!="function")throw new Error("invalid callback: "+e);for(;++i<o;)if(s=(t=r[i]).type)n[s]=EZe(n[s],t.name,e);else if(e==null)for(s in n)n[s]=EZe(n[s],t.name,null);return this},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new Rq(t)},call:function(t,e){if((s=arguments.length-2)>0)for(var n=new Array(s),r=0,s,i;r<s;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(i=this._[t],r=0,s=i.length;r<s;++r)i[r].value.apply(e,n)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var r=this._[t],s=0,i=r.length;s<i;++s)r[s].value.apply(e,n)}};function Lss(t,e){for(var n=0,r=t.length,s;n<r;++n)if((s=t[n]).name===e)return s.value}function EZe(t,e,n){for(var r=0,s=t.length;r<s;++r)if(t[r].name===e){t[r]=Iss,t=t.slice(0,r).concat(t.slice(r+1));break}return n!=null&&t.push({name:e,value:n}),t}var F1e="http://www.w3.org/1999/xhtml";const NZe={svg:"http://www.w3.org/2000/svg",xhtml:F1e,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function rae(t){var e=t+="",n=e.indexOf(":");return n>=0&&(e=t.slice(0,n))!=="xmlns"&&(t=t.slice(n+1)),NZe.hasOwnProperty(e)?{space:NZe[e],local:t}:t}function Dss(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===F1e&&e.documentElement.namespaceURI===F1e?e.createElement(t):e.createElementNS(n,t)}}function $ss(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}function y4t(t){var e=rae(t);return(e.local?$ss:Dss)(e)}function Oss(){}function lIe(t){return t==null?Oss:function(){return this.querySelector(t)}}function Fss(t){typeof t!="function"&&(t=lIe(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s<n;++s)for(var i=e[s],o=i.length,l=r[s]=new Array(o),c,d,u=0;u<o;++u)(c=i[u])&&(d=t.call(c,c.__data__,u,i))&&("__data__"in c&&(d.__data__=c.__data__),l[u]=d);return new Rm(r,this._parents)}function Bss(t){return t==null?[]:Array.isArray(t)?t:Array.from(t)}function Uss(){return[]}function b4t(t){return t==null?Uss:function(){return this.querySelectorAll(t)}}function zss(t){return function(){return Bss(t.apply(this,arguments))}}function Vss(t){typeof t=="function"?t=zss(t):t=b4t(t);for(var e=this._groups,n=e.length,r=[],s=[],i=0;i<n;++i)for(var o=e[i],l=o.length,c,d=0;d<l;++d)(c=o[d])&&(r.push(t.call(c,c.__data__,d,o)),s.push(c));return new Rm(r,s)}function x4t(t){return function(){return this.matches(t)}}function w4t(t){return function(e){return e.matches(t)}}var Hss=Array.prototype.find;function Gss(t){return function(){return Hss.call(this.children,t)}}function Wss(){return this.firstElementChild}function qss(t){return this.select(t==null?Wss:Gss(typeof t=="function"?t:w4t(t)))}var Kss=Array.prototype.filter;function Yss(){return Array.from(this.children)}function Qss(t){return function(){return Kss.call(this.children,t)}}function Zss(t){return this.selectAll(t==null?Yss:Qss(typeof t=="function"?t:w4t(t)))}function Jss(t){typeof t!="function"&&(t=x4t(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s<n;++s)for(var i=e[s],o=i.length,l=r[s]=[],c,d=0;d<o;++d)(c=i[d])&&t.call(c,c.__data__,d,i)&&l.push(c);return new Rm(r,this._parents)}function k4t(t){return new Array(t.length)}function Xss(){return new Rm(this._enter||this._groups.map(k4t),this._parents)}function CX(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}CX.prototype={constructor:CX,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};function eis(t){return function(){return t}}function tis(t,e,n,r,s,i){for(var o=0,l,c=e.length,d=i.length;o<d;++o)(l=e[o])?(l.__data__=i[o],r[o]=l):n[o]=new CX(t,i[o]);for(;o<c;++o)(l=e[o])&&(s[o]=l)}function nis(t,e,n,r,s,i,o){var l,c,d=new Map,u=e.length,h=i.length,m=new Array(u),f;for(l=0;l<u;++l)(c=e[l])&&(m[l]=f=o.call(c,c.__data__,l,e)+"",d.has(f)?s[l]=c:d.set(f,c));for(l=0;l<h;++l)f=o.call(t,i[l],l,i)+"",(c=d.get(f))?(r[l]=c,c.__data__=i[l],d.delete(f)):n[l]=new CX(t,i[l]);for(l=0;l<u;++l)(c=e[l])&&d.get(m[l])===c&&(s[l]=c)}function ris(t){return t.__data__}function sis(t,e){if(!arguments.length)return Array.from(this,ris);var n=e?nis:tis,r=this._parents,s=this._groups;typeof t!="function"&&(t=eis(t));for(var i=s.length,o=new Array(i),l=new Array(i),c=new Array(i),d=0;d<i;++d){var u=r[d],h=s[d],m=h.length,f=iis(t.call(u,u&&u.__data__,d,r)),p=f.length,g=l[d]=new Array(p),v=o[d]=new Array(p),b=c[d]=new Array(m);n(u,h,g,v,b,f,e);for(var x=0,w=0,k,S;x<p;++x)if(k=g[x]){for(x>=w&&(w=x+1);!(S=v[w])&&++w<p;);k._next=S||null}}return o=new Rm(o,r),o._enter=l,o._exit=c,o}function iis(t){return typeof t=="object"&&"length"in t?t:Array.from(t)}function ais(){return new Rm(this._exit||this._groups.map(k4t),this._parents)}function ois(t,e,n){var r=this.enter(),s=this,i=this.exit();return typeof t=="function"?(r=t(r),r&&(r=r.selection())):r=r.append(t+""),e!=null&&(s=e(s),s&&(s=s.selection())),n==null?i.remove():n(i),r&&s?r.merge(s).order():s}function lis(t){for(var e=t.selection?t.selection():t,n=this._groups,r=e._groups,s=n.length,i=r.length,o=Math.min(s,i),l=new Array(s),c=0;c<o;++c)for(var d=n[c],u=r[c],h=d.length,m=l[c]=new Array(h),f,p=0;p<h;++p)(f=d[p]||u[p])&&(m[p]=f);for(;c<s;++c)l[c]=n[c];return new Rm(l,this._parents)}function cis(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var r=t[e],s=r.length-1,i=r[s],o;--s>=0;)(o=r[s])&&(i&&o.compareDocumentPosition(i)^4&&i.parentNode.insertBefore(o,i),i=o);return this}function dis(t){t||(t=uis);function e(h,m){return h&&m?t(h.__data__,m.__data__):!h-!m}for(var n=this._groups,r=n.length,s=new Array(r),i=0;i<r;++i){for(var o=n[i],l=o.length,c=s[i]=new Array(l),d,u=0;u<l;++u)(d=o[u])&&(c[u]=d);c.sort(e)}return new Rm(s,this._parents).order()}function uis(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function his(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this}function mis(){return Array.from(this)}function fis(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],s=0,i=r.length;s<i;++s){var o=r[s];if(o)return o}return null}function pis(){let t=0;for(const e of this)++t;return t}function gis(){return!this.node()}function vis(t){for(var e=this._groups,n=0,r=e.length;n<r;++n)for(var s=e[n],i=0,o=s.length,l;i<o;++i)(l=s[i])&&t.call(l,l.__data__,i,s);return this}function yis(t){return function(){this.removeAttribute(t)}}function bis(t){return function(){this.removeAttributeNS(t.space,t.local)}}function xis(t,e){return function(){this.setAttribute(t,e)}}function wis(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}function kis(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttribute(t):this.setAttribute(t,n)}}function Sis(t,e){return function(){var n=e.apply(this,arguments);n==null?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}function Cis(t,e){var n=rae(t);if(arguments.length<2){var r=this.node();return n.local?r.getAttributeNS(n.space,n.local):r.getAttribute(n)}return this.each((e==null?n.local?bis:yis:typeof e=="function"?n.local?Sis:kis:n.local?wis:xis)(n,e))}function S4t(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView}function jis(t){return function(){this.style.removeProperty(t)}}function Eis(t,e,n){return function(){this.style.setProperty(t,e,n)}}function Nis(t,e,n){return function(){var r=e.apply(this,arguments);r==null?this.style.removeProperty(t):this.style.setProperty(t,r,n)}}function Tis(t,e,n){return arguments.length>1?this.each((e==null?jis:typeof e=="function"?Nis:Eis)(t,e,n??"")):H5(this.node(),t)}function H5(t,e){return t.style.getPropertyValue(e)||S4t(t).getComputedStyle(t,null).getPropertyValue(e)}function _is(t){return function(){delete this[t]}}function Ais(t,e){return function(){this[t]=e}}function Pis(t,e){return function(){var n=e.apply(this,arguments);n==null?delete this[t]:this[t]=n}}function Ris(t,e){return arguments.length>1?this.each((e==null?_is:typeof e=="function"?Pis:Ais)(t,e)):this.node()[t]}function C4t(t){return t.trim().split(/^|\s+/)}function cIe(t){return t.classList||new j4t(t)}function j4t(t){this._node=t,this._names=C4t(t.getAttribute("class")||"")}j4t.prototype={add:function(t){var e=this._names.indexOf(t);e<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function E4t(t,e){for(var n=cIe(t),r=-1,s=e.length;++r<s;)n.add(e[r])}function N4t(t,e){for(var n=cIe(t),r=-1,s=e.length;++r<s;)n.remove(e[r])}function Iis(t){return function(){E4t(this,t)}}function Mis(t){return function(){N4t(this,t)}}function Lis(t,e){return function(){(e.apply(this,arguments)?E4t:N4t)(this,t)}}function Dis(t,e){var n=C4t(t+"");if(arguments.length<2){for(var r=cIe(this.node()),s=-1,i=n.length;++s<i;)if(!r.contains(n[s]))return!1;return!0}return this.each((typeof e=="function"?Lis:e?Iis:Mis)(n,e))}function $is(){this.textContent=""}function Ois(t){return function(){this.textContent=t}}function Fis(t){return function(){var e=t.apply(this,arguments);this.textContent=e??""}}function Bis(t){return arguments.length?this.each(t==null?$is:(typeof t=="function"?Fis:Ois)(t)):this.node().textContent}function Uis(){this.innerHTML=""}function zis(t){return function(){this.innerHTML=t}}function Vis(t){return function(){var e=t.apply(this,arguments);this.innerHTML=e??""}}function His(t){return arguments.length?this.each(t==null?Uis:(typeof t=="function"?Vis:zis)(t)):this.node().innerHTML}function Gis(){this.nextSibling&&this.parentNode.appendChild(this)}function Wis(){return this.each(Gis)}function qis(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function Kis(){return this.each(qis)}function Yis(t){var e=typeof t=="function"?t:y4t(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})}function Qis(){return null}function Zis(t,e){var n=typeof t=="function"?t:y4t(t),r=e==null?Qis:typeof e=="function"?e:lIe(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),r.apply(this,arguments)||null)})}function Jis(){var t=this.parentNode;t&&t.removeChild(this)}function Xis(){return this.each(Jis)}function eas(){var t=this.cloneNode(!1),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function tas(){var t=this.cloneNode(!0),e=this.parentNode;return e?e.insertBefore(t,this.nextSibling):t}function nas(t){return this.select(t?tas:eas)}function ras(t){return arguments.length?this.property("__data__",t):this.node().__data__}function sas(t){return function(e){t.call(this,e,this.__data__)}}function ias(t){return t.trim().split(/^|\s+/).map(function(e){var n="",r=e.indexOf(".");return r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),{type:e,name:n}})}function aas(t){return function(){var e=this.__on;if(e){for(var n=0,r=-1,s=e.length,i;n<s;++n)i=e[n],(!t.type||i.type===t.type)&&i.name===t.name?this.removeEventListener(i.type,i.listener,i.options):e[++r]=i;++r?e.length=r:delete this.__on}}}function oas(t,e,n){return function(){var r=this.__on,s,i=sas(e);if(r){for(var o=0,l=r.length;o<l;++o)if((s=r[o]).type===t.type&&s.name===t.name){this.removeEventListener(s.type,s.listener,s.options),this.addEventListener(s.type,s.listener=i,s.options=n),s.value=e;return}}this.addEventListener(t.type,i,n),s={type:t.type,name:t.name,value:e,listener:i,options:n},r?r.push(s):this.__on=[s]}}function las(t,e,n){var r=ias(t+""),s,i=r.length,o;if(arguments.length<2){var l=this.node().__on;if(l){for(var c=0,d=l.length,u;c<d;++c)for(s=0,u=l[c];s<i;++s)if((o=r[s]).type===u.type&&o.name===u.name)return u.value}return}for(l=e?oas:aas,s=0;s<i;++s)this.each(l(r[s],e,n));return this}function T4t(t,e,n){var r=S4t(t),s=r.CustomEvent;typeof s=="function"?s=new s(e,n):(s=r.document.createEvent("Event"),n?(s.initEvent(e,n.bubbles,n.cancelable),s.detail=n.detail):s.initEvent(e,!1,!1)),t.dispatchEvent(s)}function cas(t,e){return function(){return T4t(this,t,e)}}function das(t,e){return function(){return T4t(this,t,e.apply(this,arguments))}}function uas(t,e){return this.each((typeof e=="function"?das:cas)(t,e))}function*has(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var r=t[e],s=0,i=r.length,o;s<i;++s)(o=r[s])&&(yield o)}var _4t=[null];function Rm(t,e){this._groups=t,this._parents=e}function P9(){return new Rm([[document.documentElement]],_4t)}function mas(){return this}Rm.prototype=P9.prototype={constructor:Rm,select:Fss,selectAll:Vss,selectChild:qss,selectChildren:Zss,filter:Jss,data:sis,enter:Xss,exit:ais,join:ois,merge:lis,selection:mas,order:cis,sort:dis,call:his,nodes:mis,node:fis,size:pis,empty:gis,each:vis,attr:Cis,style:Tis,property:Ris,classed:Dis,text:Bis,html:His,raise:Wis,lower:Kis,append:Yis,insert:Zis,remove:Xis,clone:nas,datum:ras,on:las,dispatch:uas,[Symbol.iterator]:has};function um(t){return typeof t=="string"?new Rm([[document.querySelector(t)]],[document.documentElement]):new Rm([[t]],_4t)}function fas(t){let e;for(;e=t.sourceEvent;)t=e;return t}function Jp(t,e){if(t=fas(t),e===void 0&&(e=t.currentTarget),e){var n=e.ownerSVGElement||e;if(n.createSVGPoint){var r=n.createSVGPoint();return r.x=t.clientX,r.y=t.clientY,r=r.matrixTransform(e.getScreenCTM().inverse()),[r.x,r.y]}if(e.getBoundingClientRect){var s=e.getBoundingClientRect();return[t.clientX-s.left-e.clientLeft,t.clientY-s.top-e.clientTop]}}return[t.pageX,t.pageY]}const pas={passive:!1},d8={capture:!0,passive:!1};function vhe(t){t.stopImmediatePropagation()}function gP(t){t.preventDefault(),t.stopImmediatePropagation()}function A4t(t){var e=t.document.documentElement,n=um(t).on("dragstart.drag",gP,d8);"onselectstart"in e?n.on("selectstart.drag",gP,d8):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")}function P4t(t,e){var n=t.document.documentElement,r=um(t).on("dragstart.drag",null);e&&(r.on("click.drag",gP,d8),setTimeout(function(){r.on("click.drag",null)},0)),"onselectstart"in n?r.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}const jH=t=>()=>t;function B1e(t,{sourceEvent:e,subject:n,target:r,identifier:s,active:i,x:o,y:l,dx:c,dy:d,dispatch:u}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},subject:{value:n,enumerable:!0,configurable:!0},target:{value:r,enumerable:!0,configurable:!0},identifier:{value:s,enumerable:!0,configurable:!0},active:{value:i,enumerable:!0,configurable:!0},x:{value:o,enumerable:!0,configurable:!0},y:{value:l,enumerable:!0,configurable:!0},dx:{value:c,enumerable:!0,configurable:!0},dy:{value:d,enumerable:!0,configurable:!0},_:{value:u}})}B1e.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};function gas(t){return!t.ctrlKey&&!t.button}function vas(){return this.parentNode}function yas(t,e){return e??{x:t.x,y:t.y}}function bas(){return navigator.maxTouchPoints||"ontouchstart"in this}function R4t(){var t=gas,e=vas,n=yas,r=bas,s={},i=nae("start","drag","end"),o=0,l,c,d,u,h=0;function m(k){k.on("mousedown.drag",f).filter(r).on("touchstart.drag",v).on("touchmove.drag",b,pas).on("touchend.drag touchcancel.drag",x).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(k,S){if(!(u||!t.call(this,k,S))){var C=w(this,e.call(this,k,S),k,S,"mouse");C&&(um(k.view).on("mousemove.drag",p,d8).on("mouseup.drag",g,d8),A4t(k.view),vhe(k),d=!1,l=k.clientX,c=k.clientY,C("start",k))}}function p(k){if(gP(k),!d){var S=k.clientX-l,C=k.clientY-c;d=S*S+C*C>h}s.mouse("drag",k)}function g(k){um(k.view).on("mousemove.drag mouseup.drag",null),P4t(k.view,d),gP(k),s.mouse("end",k)}function v(k,S){if(t.call(this,k,S)){var C=k.changedTouches,j=e.call(this,k,S),E=C.length,N,A;for(N=0;N<E;++N)(A=w(this,j,k,S,C[N].identifier,C[N]))&&(vhe(k),A("start",k,C[N]))}}function b(k){var S=k.changedTouches,C=S.length,j,E;for(j=0;j<C;++j)(E=s[S[j].identifier])&&(gP(k),E("drag",k,S[j]))}function x(k){var S=k.changedTouches,C=S.length,j,E;for(u&&clearTimeout(u),u=setTimeout(function(){u=null},500),j=0;j<C;++j)(E=s[S[j].identifier])&&(vhe(k),E("end",k,S[j]))}function w(k,S,C,j,E,N){var A=i.copy(),_=Jp(N||C,S),T,R,O;if((O=n.call(k,new B1e("beforestart",{sourceEvent:C,target:m,identifier:E,active:o,x:_[0],y:_[1],dx:0,dy:0,dispatch:A}),j))!=null)return T=O.x-_[0]||0,R=O.y-_[1]||0,function F(D,I,P){var M=_,z;switch(D){case"start":s[E]=F,z=o++;break;case"end":delete s[E],--o;case"drag":_=Jp(P||I,S),z=o;break}A.call(D,k,new B1e(D,{sourceEvent:I,subject:O,target:m,identifier:E,active:z,x:_[0]+T,y:_[1]+R,dx:_[0]-M[0],dy:_[1]-M[1],dispatch:A}),j)}}return m.filter=function(k){return arguments.length?(t=typeof k=="function"?k:jH(!!k),m):t},m.container=function(k){return arguments.length?(e=typeof k=="function"?k:jH(k),m):e},m.subject=function(k){return arguments.length?(n=typeof k=="function"?k:jH(k),m):n},m.touchable=function(k){return arguments.length?(r=typeof k=="function"?k:jH(!!k),m):r},m.on=function(){var k=i.on.apply(i,arguments);return k===i?m:k},m.clickDistance=function(k){return arguments.length?(h=(k=+k)*k,m):Math.sqrt(h)},m}var G5=0,sD=0,X3=0,I4t=1e3,jX,iD,EX=0,fE=0,sae=0,u8=typeof performance=="object"&&performance.now?performance:Date,M4t=typeof window=="object"&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(t){setTimeout(t,17)};function dIe(){return fE||(M4t(xas),fE=u8.now()+sae)}function xas(){fE=0}function NX(){this._call=this._time=this._next=null}NX.prototype=L4t.prototype={constructor:NX,restart:function(t,e,n){if(typeof t!="function")throw new TypeError("callback is not a function");n=(n==null?dIe():+n)+(e==null?0:+e),!this._next&&iD!==this&&(iD?iD._next=this:jX=this,iD=this),this._call=t,this._time=n,U1e()},stop:function(){this._call&&(this._call=null,this._time=1/0,U1e())}};function L4t(t,e,n){var r=new NX;return r.restart(t,e,n),r}function was(){dIe(),++G5;for(var t=jX,e;t;)(e=fE-t._time)>=0&&t._call.call(void 0,e),t=t._next;--G5}function TZe(){fE=(EX=u8.now())+sae,G5=sD=0;try{was()}finally{G5=0,Sas(),fE=0}}function kas(){var t=u8.now(),e=t-EX;e>I4t&&(sae-=e,EX=t)}function Sas(){for(var t,e=jX,n,r=1/0;e;)e._call?(r>e._time&&(r=e._time),t=e,e=e._next):(n=e._next,e._next=null,e=t?t._next=n:jX=n);iD=t,U1e(r)}function U1e(t){if(!G5){sD&&(sD=clearTimeout(sD));var e=t-fE;e>24?(t<1/0&&(sD=setTimeout(TZe,t-u8.now()-sae)),X3&&(X3=clearInterval(X3))):(X3||(EX=u8.now(),X3=setInterval(kas,I4t)),G5=1,M4t(TZe))}}function _Ze(t,e,n){var r=new NX;return e=e==null?0:+e,r.restart(s=>{r.stop(),t(s+e)},e,n),r}var Cas=nae("start","end","cancel","interrupt"),jas=[],D4t=0,AZe=1,z1e=2,Iq=3,PZe=4,V1e=5,Mq=6;function iae(t,e,n,r,s,i){var o=t.__transition;if(!o)t.__transition={};else if(n in o)return;Eas(t,n,{name:e,index:r,group:s,on:Cas,tween:jas,time:i.time,delay:i.delay,duration:i.duration,ease:i.ease,timer:null,state:D4t})}function uIe(t,e){var n=iv(t,e);if(n.state>D4t)throw new Error("too late; already scheduled");return n}function ib(t,e){var n=iv(t,e);if(n.state>Iq)throw new Error("too late; already running");return n}function iv(t,e){var n=t.__transition;if(!n||!(n=n[e]))throw new Error("transition not found");return n}function Eas(t,e,n){var r=t.__transition,s;r[e]=n,n.timer=L4t(i,0,n.time);function i(d){n.state=AZe,n.timer.restart(o,n.delay,n.time),n.delay<=d&&o(d-n.delay)}function o(d){var u,h,m,f;if(n.state!==AZe)return c();for(u in r)if(f=r[u],f.name===n.name){if(f.state===Iq)return _Ze(o);f.state===PZe?(f.state=Mq,f.timer.stop(),f.on.call("interrupt",t,t.__data__,f.index,f.group),delete r[u]):+u<e&&(f.state=Mq,f.timer.stop(),f.on.call("cancel",t,t.__data__,f.index,f.group),delete r[u])}if(_Ze(function(){n.state===Iq&&(n.state=PZe,n.timer.restart(l,n.delay,n.time),l(d))}),n.state=z1e,n.on.call("start",t,t.__data__,n.index,n.group),n.state===z1e){for(n.state=Iq,s=new Array(m=n.tween.length),u=0,h=-1;u<m;++u)(f=n.tween[u].value.call(t,t.__data__,n.index,n.group))&&(s[++h]=f);s.length=h+1}}function l(d){for(var u=d<n.duration?n.ease.call(null,d/n.duration):(n.timer.restart(c),n.state=V1e,1),h=-1,m=s.length;++h<m;)s[h].call(t,u);n.state===V1e&&(n.on.call("end",t,t.__data__,n.index,n.group),c())}function c(){n.state=Mq,n.timer.stop(),delete r[e];for(var d in r)return;delete t.__transition}}function Lq(t,e){var n=t.__transition,r,s,i=!0,o;if(n){e=e==null?null:e+"";for(o in n){if((r=n[o]).name!==e){i=!1;continue}s=r.state>z1e&&r.state<V1e,r.state=Mq,r.timer.stop(),r.on.call(s?"interrupt":"cancel",t,t.__data__,r.index,r.group),delete n[o]}i&&delete t.__transition}}function Nas(t){return this.each(function(){Lq(this,t)})}function Tas(t,e){var n,r;return function(){var s=ib(this,t),i=s.tween;if(i!==n){r=n=i;for(var o=0,l=r.length;o<l;++o)if(r[o].name===e){r=r.slice(),r.splice(o,1);break}}s.tween=r}}function _as(t,e,n){var r,s;if(typeof n!="function")throw new Error;return function(){var i=ib(this,t),o=i.tween;if(o!==r){s=(r=o).slice();for(var l={name:e,value:n},c=0,d=s.length;c<d;++c)if(s[c].name===e){s[c]=l;break}c===d&&s.push(l)}i.tween=s}}function Aas(t,e){var n=this._id;if(t+="",arguments.length<2){for(var r=iv(this.node(),n).tween,s=0,i=r.length,o;s<i;++s)if((o=r[s]).name===t)return o.value;return null}return this.each((e==null?Tas:_as)(n,t,e))}function hIe(t,e,n){var r=t._id;return t.each(function(){var s=ib(this,r);(s.value||(s.value={}))[e]=n.apply(this,arguments)}),function(s){return iv(s,r).value[e]}}function $4t(t,e){var n;return(typeof e=="number"?cg:e instanceof lE?$J:(n=lE(e))?(e=n,$J):uMt)(t,e)}function Pas(t){return function(){this.removeAttribute(t)}}function Ras(t){return function(){this.removeAttributeNS(t.space,t.local)}}function Ias(t,e,n){var r,s=n+"",i;return function(){var o=this.getAttribute(t);return o===s?null:o===r?i:i=e(r=o,n)}}function Mas(t,e,n){var r,s=n+"",i;return function(){var o=this.getAttributeNS(t.space,t.local);return o===s?null:o===r?i:i=e(r=o,n)}}function Las(t,e,n){var r,s,i;return function(){var o,l=n(this),c;return l==null?void this.removeAttribute(t):(o=this.getAttribute(t),c=l+"",o===c?null:o===r&&c===s?i:(s=c,i=e(r=o,l)))}}function Das(t,e,n){var r,s,i;return function(){var o,l=n(this),c;return l==null?void this.removeAttributeNS(t.space,t.local):(o=this.getAttributeNS(t.space,t.local),c=l+"",o===c?null:o===r&&c===s?i:(s=c,i=e(r=o,l)))}}function $as(t,e){var n=rae(t),r=n==="transform"?wzr:$4t;return this.attrTween(t,typeof e=="function"?(n.local?Das:Las)(n,r,hIe(this,"attr."+t,e)):e==null?(n.local?Ras:Pas)(n):(n.local?Mas:Ias)(n,r,e))}function Oas(t,e){return function(n){this.setAttribute(t,e.call(this,n))}}function Fas(t,e){return function(n){this.setAttributeNS(t.space,t.local,e.call(this,n))}}function Bas(t,e){var n,r;function s(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&Fas(t,i)),n}return s._value=e,s}function Uas(t,e){var n,r;function s(){var i=e.apply(this,arguments);return i!==r&&(n=(r=i)&&Oas(t,i)),n}return s._value=e,s}function zas(t,e){var n="attr."+t;if(arguments.length<2)return(n=this.tween(n))&&n._value;if(e==null)return this.tween(n,null);if(typeof e!="function")throw new Error;var r=rae(t);return this.tween(n,(r.local?Bas:Uas)(r,e))}function Vas(t,e){return function(){uIe(this,t).delay=+e.apply(this,arguments)}}function Has(t,e){return e=+e,function(){uIe(this,t).delay=e}}function Gas(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Vas:Has)(e,t)):iv(this.node(),e).delay}function Was(t,e){return function(){ib(this,t).duration=+e.apply(this,arguments)}}function qas(t,e){return e=+e,function(){ib(this,t).duration=e}}function Kas(t){var e=this._id;return arguments.length?this.each((typeof t=="function"?Was:qas)(e,t)):iv(this.node(),e).duration}function Yas(t,e){if(typeof e!="function")throw new Error;return function(){ib(this,t).ease=e}}function Qas(t){var e=this._id;return arguments.length?this.each(Yas(e,t)):iv(this.node(),e).ease}function Zas(t,e){return function(){var n=e.apply(this,arguments);if(typeof n!="function")throw new Error;ib(this,t).ease=n}}function Jas(t){if(typeof t!="function")throw new Error;return this.each(Zas(this._id,t))}function Xas(t){typeof t!="function"&&(t=x4t(t));for(var e=this._groups,n=e.length,r=new Array(n),s=0;s<n;++s)for(var i=e[s],o=i.length,l=r[s]=[],c,d=0;d<o;++d)(c=i[d])&&t.call(c,c.__data__,d,i)&&l.push(c);return new b0(r,this._parents,this._name,this._id)}function eos(t){if(t._id!==this._id)throw new Error;for(var e=this._groups,n=t._groups,r=e.length,s=n.length,i=Math.min(r,s),o=new Array(r),l=0;l<i;++l)for(var c=e[l],d=n[l],u=c.length,h=o[l]=new Array(u),m,f=0;f<u;++f)(m=c[f]||d[f])&&(h[f]=m);for(;l<r;++l)o[l]=e[l];return new b0(o,this._parents,this._name,this._id)}function tos(t){return(t+"").trim().split(/^|\s+/).every(function(e){var n=e.indexOf(".");return n>=0&&(e=e.slice(0,n)),!e||e==="start"})}function nos(t,e,n){var r,s,i=tos(e)?uIe:ib;return function(){var o=i(this,t),l=o.on;l!==r&&(s=(r=l).copy()).on(e,n),o.on=s}}function ros(t,e){var n=this._id;return arguments.length<2?iv(this.node(),n).on.on(t):this.each(nos(n,t,e))}function sos(t){return function(){var e=this.parentNode;for(var n in this.__transition)if(+n!==t)return;e&&e.removeChild(this)}}function ios(){return this.on("end.remove",sos(this._id))}function aos(t){var e=this._name,n=this._id;typeof t!="function"&&(t=lIe(t));for(var r=this._groups,s=r.length,i=new Array(s),o=0;o<s;++o)for(var l=r[o],c=l.length,d=i[o]=new Array(c),u,h,m=0;m<c;++m)(u=l[m])&&(h=t.call(u,u.__data__,m,l))&&("__data__"in u&&(h.__data__=u.__data__),d[m]=h,iae(d[m],e,n,m,d,iv(u,n)));return new b0(i,this._parents,e,n)}function oos(t){var e=this._name,n=this._id;typeof t!="function"&&(t=b4t(t));for(var r=this._groups,s=r.length,i=[],o=[],l=0;l<s;++l)for(var c=r[l],d=c.length,u,h=0;h<d;++h)if(u=c[h]){for(var m=t.call(u,u.__data__,h,c),f,p=iv(u,n),g=0,v=m.length;g<v;++g)(f=m[g])&&iae(f,e,n,g,m,p);i.push(m),o.push(u)}return new b0(i,o,e,n)}var los=P9.prototype.constructor;function cos(){return new los(this._groups,this._parents)}function dos(t,e){var n,r,s;return function(){var i=H5(this,t),o=(this.style.removeProperty(t),H5(this,t));return i===o?null:i===n&&o===r?s:s=e(n=i,r=o)}}function O4t(t){return function(){this.style.removeProperty(t)}}function uos(t,e,n){var r,s=n+"",i;return function(){var o=H5(this,t);return o===s?null:o===r?i:i=e(r=o,n)}}function hos(t,e,n){var r,s,i;return function(){var o=H5(this,t),l=n(this),c=l+"";return l==null&&(c=l=(this.style.removeProperty(t),H5(this,t))),o===c?null:o===r&&c===s?i:(s=c,i=e(r=o,l))}}function mos(t,e){var n,r,s,i="style."+e,o="end."+i,l;return function(){var c=ib(this,t),d=c.on,u=c.value[i]==null?l||(l=O4t(e)):void 0;(d!==n||s!==u)&&(r=(n=d).copy()).on(o,s=u),c.on=r}}function fos(t,e,n){var r=(t+="")=="transform"?xzr:$4t;return e==null?this.styleTween(t,dos(t,r)).on("end.style."+t,O4t(t)):typeof e=="function"?this.styleTween(t,hos(t,r,hIe(this,"style."+t,e))).each(mos(this._id,t)):this.styleTween(t,uos(t,r,e),n).on("end.style."+t,null)}function pos(t,e,n){return function(r){this.style.setProperty(t,e.call(this,r),n)}}function gos(t,e,n){var r,s;function i(){var o=e.apply(this,arguments);return o!==s&&(r=(s=o)&&pos(t,o,n)),r}return i._value=e,i}function vos(t,e,n){var r="style."+(t+="");if(arguments.length<2)return(r=this.tween(r))&&r._value;if(e==null)return this.tween(r,null);if(typeof e!="function")throw new Error;return this.tween(r,gos(t,e,n??""))}function yos(t){return function(){this.textContent=t}}function bos(t){return function(){var e=t(this);this.textContent=e??""}}function xos(t){return this.tween("text",typeof t=="function"?bos(hIe(this,"text",t)):yos(t==null?"":t+""))}function wos(t){return function(e){this.textContent=t.call(this,e)}}function kos(t){var e,n;function r(){var s=t.apply(this,arguments);return s!==n&&(e=(n=s)&&wos(s)),e}return r._value=t,r}function Sos(t){var e="text";if(arguments.length<1)return(e=this.tween(e))&&e._value;if(t==null)return this.tween(e,null);if(typeof t!="function")throw new Error;return this.tween(e,kos(t))}function Cos(){for(var t=this._name,e=this._id,n=F4t(),r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],l=o.length,c,d=0;d<l;++d)if(c=o[d]){var u=iv(c,e);iae(c,t,n,d,o,{time:u.time+u.delay+u.duration,delay:0,duration:u.duration,ease:u.ease})}return new b0(r,this._parents,t,n)}function jos(){var t,e,n=this,r=n._id,s=n.size();return new Promise(function(i,o){var l={value:o},c={value:function(){--s===0&&i()}};n.each(function(){var d=ib(this,r),u=d.on;u!==t&&(e=(t=u).copy(),e._.cancel.push(l),e._.interrupt.push(l),e._.end.push(c)),d.on=e}),s===0&&i()})}var Eos=0;function b0(t,e,n,r){this._groups=t,this._parents=e,this._name=n,this._id=r}function F4t(){return++Eos}var wb=P9.prototype;b0.prototype={constructor:b0,select:aos,selectAll:oos,selectChild:wb.selectChild,selectChildren:wb.selectChildren,filter:Xas,merge:eos,selection:cos,transition:Cos,call:wb.call,nodes:wb.nodes,node:wb.node,size:wb.size,empty:wb.empty,each:wb.each,on:ros,attr:$as,attrTween:zas,style:fos,styleTween:vos,text:xos,textTween:Sos,remove:ios,tween:Aas,delay:Gas,duration:Kas,ease:Qas,easeVarying:Jas,end:jos,[Symbol.iterator]:wb[Symbol.iterator]};function Nos(t){return((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2}var Tos={time:null,delay:0,duration:250,ease:Nos};function _os(t,e){for(var n;!(n=t.__transition)||!(n=n[e]);)if(!(t=t.parentNode))throw new Error(`transition ${e} not found`);return n}function Aos(t){var e,n;t instanceof b0?(e=t._id,t=t._name):(e=F4t(),(n=Tos).time=dIe(),t=t==null?null:t+"");for(var r=this._groups,s=r.length,i=0;i<s;++i)for(var o=r[i],l=o.length,c,d=0;d<l;++d)(c=o[d])&&iae(c,t,e,d,o,n||_os(c,e));return new b0(r,this._parents,t,e)}P9.prototype.interrupt=Nas;P9.prototype.transition=Aos;const EH=t=>()=>t;function Pos(t,{sourceEvent:e,target:n,transform:r,dispatch:s}){Object.defineProperties(this,{type:{value:t,enumerable:!0,configurable:!0},sourceEvent:{value:e,enumerable:!0,configurable:!0},target:{value:n,enumerable:!0,configurable:!0},transform:{value:r,enumerable:!0,configurable:!0},_:{value:s}})}function vx(t,e,n){this.k=t,this.x=e,this.y=n}vx.prototype={constructor:vx,scale:function(t){return t===1?this:new vx(this.k*t,this.x,this.y)},translate:function(t,e){return t===0&e===0?this:new vx(this.k,this.x+this.k*t,this.y+this.k*e)},apply:function(t){return[t[0]*this.k+this.x,t[1]*this.k+this.y]},applyX:function(t){return t*this.k+this.x},applyY:function(t){return t*this.k+this.y},invert:function(t){return[(t[0]-this.x)/this.k,(t[1]-this.y)/this.k]},invertX:function(t){return(t-this.x)/this.k},invertY:function(t){return(t-this.y)/this.k},rescaleX:function(t){return t.copy().domain(t.range().map(this.invertX,this).map(t.invert,t))},rescaleY:function(t){return t.copy().domain(t.range().map(this.invertY,this).map(t.invert,t))},toString:function(){return"translate("+this.x+","+this.y+") scale("+this.k+")"}};var aae=new vx(1,0,0);B4t.prototype=vx.prototype;function B4t(t){for(;!t.__zoom;)if(!(t=t.parentNode))return aae;return t.__zoom}function yhe(t){t.stopImmediatePropagation()}function e4(t){t.preventDefault(),t.stopImmediatePropagation()}function Ros(t){return(!t.ctrlKey||t.type==="wheel")&&!t.button}function Ios(){var t=this;return t instanceof SVGElement?(t=t.ownerSVGElement||t,t.hasAttribute("viewBox")?(t=t.viewBox.baseVal,[[t.x,t.y],[t.x+t.width,t.y+t.height]]):[[0,0],[t.width.baseVal.value,t.height.baseVal.value]]):[[0,0],[t.clientWidth,t.clientHeight]]}function RZe(){return this.__zoom||aae}function Mos(t){return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*(t.ctrlKey?10:1)}function Los(){return navigator.maxTouchPoints||"ontouchstart"in this}function Dos(t,e,n){var r=t.invertX(e[0][0])-n[0][0],s=t.invertX(e[1][0])-n[1][0],i=t.invertY(e[0][1])-n[0][1],o=t.invertY(e[1][1])-n[1][1];return t.translate(s>r?(r+s)/2:Math.min(0,r)||Math.max(0,s),o>i?(i+o)/2:Math.min(0,i)||Math.max(0,o))}function U4t(){var t=Ros,e=Ios,n=Dos,r=Mos,s=Los,i=[0,1/0],o=[[-1/0,-1/0],[1/0,1/0]],l=250,c=Nq,d=nae("start","zoom","end"),u,h,m,f=500,p=150,g=0,v=10;function b(O){O.property("__zoom",RZe).on("wheel.zoom",E,{passive:!1}).on("mousedown.zoom",N).on("dblclick.zoom",A).filter(s).on("touchstart.zoom",_).on("touchmove.zoom",T).on("touchend.zoom touchcancel.zoom",R).style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}b.transform=function(O,F,D,I){var P=O.selection?O.selection():O;P.property("__zoom",RZe),O!==P?S(O,F,D,I):P.interrupt().each(function(){C(this,arguments).event(I).start().zoom(null,typeof F=="function"?F.apply(this,arguments):F).end()})},b.scaleBy=function(O,F,D,I){b.scaleTo(O,function(){var P=this.__zoom.k,M=typeof F=="function"?F.apply(this,arguments):F;return P*M},D,I)},b.scaleTo=function(O,F,D,I){b.transform(O,function(){var P=e.apply(this,arguments),M=this.__zoom,z=D==null?k(P):typeof D=="function"?D.apply(this,arguments):D,G=M.invert(z),B=typeof F=="function"?F.apply(this,arguments):F;return n(w(x(M,B),z,G),P,o)},D,I)},b.translateBy=function(O,F,D,I){b.transform(O,function(){return n(this.__zoom.translate(typeof F=="function"?F.apply(this,arguments):F,typeof D=="function"?D.apply(this,arguments):D),e.apply(this,arguments),o)},null,I)},b.translateTo=function(O,F,D,I,P){b.transform(O,function(){var M=e.apply(this,arguments),z=this.__zoom,G=I==null?k(M):typeof I=="function"?I.apply(this,arguments):I;return n(aae.translate(G[0],G[1]).scale(z.k).translate(typeof F=="function"?-F.apply(this,arguments):-F,typeof D=="function"?-D.apply(this,arguments):-D),M,o)},I,P)};function x(O,F){return F=Math.max(i[0],Math.min(i[1],F)),F===O.k?O:new vx(F,O.x,O.y)}function w(O,F,D){var I=F[0]-D[0]*O.k,P=F[1]-D[1]*O.k;return I===O.x&&P===O.y?O:new vx(O.k,I,P)}function k(O){return[(+O[0][0]+ +O[1][0])/2,(+O[0][1]+ +O[1][1])/2]}function S(O,F,D,I){O.on("start.zoom",function(){C(this,arguments).event(I).start()}).on("interrupt.zoom end.zoom",function(){C(this,arguments).event(I).end()}).tween("zoom",function(){var P=this,M=arguments,z=C(P,M).event(I),G=e.apply(P,M),B=D==null?k(G):typeof D=="function"?D.apply(P,M):D,H=Math.max(G[1][0]-G[0][0],G[1][1]-G[0][1]),W=P.__zoom,V=typeof F=="function"?F.apply(P,M):F,U=c(W.invert(B).concat(H/W.k),V.invert(B).concat(H/V.k));return function(ne){if(ne===1)ne=V;else{var te=U(ne),re=H/te[2];ne=new vx(re,B[0]-te[0]*re,B[1]-te[1]*re)}z.zoom(null,ne)}})}function C(O,F,D){return!D&&O.__zooming||new j(O,F)}function j(O,F){this.that=O,this.args=F,this.active=0,this.sourceEvent=null,this.extent=e.apply(O,F),this.taps=0}j.prototype={event:function(O){return O&&(this.sourceEvent=O),this},start:function(){return++this.active===1&&(this.that.__zooming=this,this.emit("start")),this},zoom:function(O,F){return this.mouse&&O!=="mouse"&&(this.mouse[1]=F.invert(this.mouse[0])),this.touch0&&O!=="touch"&&(this.touch0[1]=F.invert(this.touch0[0])),this.touch1&&O!=="touch"&&(this.touch1[1]=F.invert(this.touch1[0])),this.that.__zoom=F,this.emit("zoom"),this},end:function(){return--this.active===0&&(delete this.that.__zooming,this.emit("end")),this},emit:function(O){var F=um(this.that).datum();d.call(O,this.that,new Pos(O,{sourceEvent:this.sourceEvent,target:b,type:O,transform:this.that.__zoom,dispatch:d}),F)}};function E(O,...F){if(!t.apply(this,arguments))return;var D=C(this,F).event(O),I=this.__zoom,P=Math.max(i[0],Math.min(i[1],I.k*Math.pow(2,r.apply(this,arguments)))),M=Jp(O);if(D.wheel)(D.mouse[0][0]!==M[0]||D.mouse[0][1]!==M[1])&&(D.mouse[1]=I.invert(D.mouse[0]=M)),clearTimeout(D.wheel);else{if(I.k===P)return;D.mouse=[M,I.invert(M)],Lq(this),D.start()}e4(O),D.wheel=setTimeout(z,p),D.zoom("mouse",n(w(x(I,P),D.mouse[0],D.mouse[1]),D.extent,o));function z(){D.wheel=null,D.end()}}function N(O,...F){if(m||!t.apply(this,arguments))return;var D=O.currentTarget,I=C(this,F,!0).event(O),P=um(O.view).on("mousemove.zoom",B,!0).on("mouseup.zoom",H,!0),M=Jp(O,D),z=O.clientX,G=O.clientY;A4t(O.view),yhe(O),I.mouse=[M,this.__zoom.invert(M)],Lq(this),I.start();function B(W){if(e4(W),!I.moved){var V=W.clientX-z,U=W.clientY-G;I.moved=V*V+U*U>g}I.event(W).zoom("mouse",n(w(I.that.__zoom,I.mouse[0]=Jp(W,D),I.mouse[1]),I.extent,o))}function H(W){P.on("mousemove.zoom mouseup.zoom",null),P4t(W.view,I.moved),e4(W),I.event(W).end()}}function A(O,...F){if(t.apply(this,arguments)){var D=this.__zoom,I=Jp(O.changedTouches?O.changedTouches[0]:O,this),P=D.invert(I),M=D.k*(O.shiftKey?.5:2),z=n(w(x(D,M),I,P),e.apply(this,F),o);e4(O),l>0?um(this).transition().duration(l).call(S,z,I,O):um(this).call(b.transform,z,I,O)}}function _(O,...F){if(t.apply(this,arguments)){var D=O.touches,I=D.length,P=C(this,F,O.changedTouches.length===I).event(O),M,z,G,B;for(yhe(O),z=0;z<I;++z)G=D[z],B=Jp(G,this),B=[B,this.__zoom.invert(B),G.identifier],P.touch0?!P.touch1&&P.touch0[2]!==B[2]&&(P.touch1=B,P.taps=0):(P.touch0=B,M=!0,P.taps=1+!!u);u&&(u=clearTimeout(u)),M&&(P.taps<2&&(h=B[0],u=setTimeout(function(){u=null},f)),Lq(this),P.start())}}function T(O,...F){if(this.__zooming){var D=C(this,F).event(O),I=O.changedTouches,P=I.length,M,z,G,B;for(e4(O),M=0;M<P;++M)z=I[M],G=Jp(z,this),D.touch0&&D.touch0[2]===z.identifier?D.touch0[0]=G:D.touch1&&D.touch1[2]===z.identifier&&(D.touch1[0]=G);if(z=D.that.__zoom,D.touch1){var H=D.touch0[0],W=D.touch0[1],V=D.touch1[0],U=D.touch1[1],ne=(ne=V[0]-H[0])*ne+(ne=V[1]-H[1])*ne,te=(te=U[0]-W[0])*te+(te=U[1]-W[1])*te;z=x(z,Math.sqrt(ne/te)),G=[(H[0]+V[0])/2,(H[1]+V[1])/2],B=[(W[0]+U[0])/2,(W[1]+U[1])/2]}else if(D.touch0)G=D.touch0[0],B=D.touch0[1];else return;D.zoom("touch",n(w(z,G,B),D.extent,o))}}function R(O,...F){if(this.__zooming){var D=C(this,F).event(O),I=O.changedTouches,P=I.length,M,z;for(yhe(O),m&&clearTimeout(m),m=setTimeout(function(){m=null},f),M=0;M<P;++M)z=I[M],D.touch0&&D.touch0[2]===z.identifier?delete D.touch0:D.touch1&&D.touch1[2]===z.identifier&&delete D.touch1;if(D.touch1&&!D.touch0&&(D.touch0=D.touch1,delete D.touch1),D.touch0)D.touch0[1]=this.__zoom.invert(D.touch0[0]);else if(D.end(),D.taps===2&&(z=Jp(z,this),Math.hypot(h[0]-z[0],h[1]-z[1])<v)){var G=um(this).on("dblclick.zoom");G&&G.apply(this,arguments)}}}return b.wheelDelta=function(O){return arguments.length?(r=typeof O=="function"?O:EH(+O),b):r},b.filter=function(O){return arguments.length?(t=typeof O=="function"?O:EH(!!O),b):t},b.touchable=function(O){return arguments.length?(s=typeof O=="function"?O:EH(!!O),b):s},b.extent=function(O){return arguments.length?(e=typeof O=="function"?O:EH([[+O[0][0],+O[0][1]],[+O[1][0],+O[1][1]]]),b):e},b.scaleExtent=function(O){return arguments.length?(i[0]=+O[0],i[1]=+O[1],b):[i[0],i[1]]},b.translateExtent=function(O){return arguments.length?(o[0][0]=+O[0][0],o[1][0]=+O[1][0],o[0][1]=+O[0][1],o[1][1]=+O[1][1],b):[[o[0][0],o[0][1]],[o[1][0],o[1][1]]]},b.constrain=function(O){return arguments.length?(n=O,b):n},b.duration=function(O){return arguments.length?(l=+O,b):l},b.interpolate=function(O){return arguments.length?(c=O,b):c},b.on=function(){var O=d.on.apply(d,arguments);return O===d?b:O},b.clickDistance=function(O){return arguments.length?(g=(O=+O)*O,b):Math.sqrt(g)},b.tapDistance=function(O){return arguments.length?(v=+O,b):v},b}const zg={error001:(t="react")=>`Seems like you have not used ${t==="svelte"?"SvelteFlowProvider":"ReactFlowProvider"} as an ancestor. Help: https://${t}flow.dev/error#001`,error002:()=>"It looks like you've created a new nodeTypes or edgeTypes object. If this wasn't on purpose please define the nodeTypes/edgeTypes outside of the component or memoize them.",error003:t=>`Node type "${t}" not found. Using fallback type "default".`,error004:()=>"The parent container needs a width and a height to render the graph.",error005:()=>"Only child nodes can use a parent extent.",error006:()=>"Can't create edge. An edge needs a source and a target.",error007:t=>`The old edge with id=${t} does not exist.`,error009:t=>`Marker type "${t}" doesn't exist.`,error008:(t,{id:e,sourceHandle:n,targetHandle:r})=>`Couldn't create edge for ${t} handle id: "${t==="source"?n:r}", edge id: ${e}.`,error010:()=>"Handle: No node id found. Make sure to only use a Handle inside a custom Node.",error011:t=>`Edge type "${t}" not found. Using fallback type "default".`,error012:t=>`Node with id "${t}" does not exist, it may have been removed. This can happen when a node is deleted before the "onNodeClick" handler is called.`,error013:(t="react")=>`It seems that you haven't loaded the styles. Please import '@xyflow/${t}/dist/style.css' or base.css to make sure everything is working properly.`,error014:()=>"useNodeConnections: No node ID found. Call useNodeConnections inside a custom Node or provide a node ID.",error015:()=>"It seems that you are trying to drag a node that is not initialized. Please use onNodesChange as explained in the docs.",error016:t=>`Edge with id "${t}" does not exist, it may have been removed. This can happen when an edge is deleted before the "onEdgeClick" handler is called.`},h8=[[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY],[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY]],z4t=["Enter"," ","Escape"],V4t={"node.a11yDescription.default":"Press enter or space to select a node. Press delete to remove it and escape to cancel.","node.a11yDescription.keyboardDisabled":"Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.","node.a11yDescription.ariaLiveMessage":({direction:t,x:e,y:n})=>`Moved selected node ${t}. New position, x: ${e}, y: ${n}`,"edge.a11yDescription.default":"Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.","controls.ariaLabel":"Control Panel","controls.zoomIn.ariaLabel":"Zoom In","controls.zoomOut.ariaLabel":"Zoom Out","controls.fitView.ariaLabel":"Fit View","controls.interactive.ariaLabel":"Toggle Interactivity","minimap.ariaLabel":"Mini Map","handle.ariaLabel":"Handle"};var W5;(function(t){t.Strict="strict",t.Loose="loose"})(W5||(W5={}));var u2;(function(t){t.Free="free",t.Vertical="vertical",t.Horizontal="horizontal"})(u2||(u2={}));var m8;(function(t){t.Partial="partial",t.Full="full"})(m8||(m8={}));const H4t={inProgress:!1,isValid:null,from:null,fromHandle:null,fromPosition:null,fromNode:null,to:null,toHandle:null,toPosition:null,toNode:null,pointer:null};var h1;(function(t){t.Bezier="default",t.Straight="straight",t.Step="step",t.SmoothStep="smoothstep",t.SimpleBezier="simplebezier"})(h1||(h1={}));var TX;(function(t){t.Arrow="arrow",t.ArrowClosed="arrowclosed"})(TX||(TX={}));var kr;(function(t){t.Left="left",t.Top="top",t.Right="right",t.Bottom="bottom"})(kr||(kr={}));const IZe={[kr.Left]:kr.Right,[kr.Right]:kr.Left,[kr.Top]:kr.Bottom,[kr.Bottom]:kr.Top};function G4t(t){return t===null?null:t?"valid":"invalid"}const W4t=t=>"id"in t&&"source"in t&&"target"in t,$os=t=>"id"in t&&"position"in t&&!("source"in t)&&!("target"in t),mIe=t=>"id"in t&&"internals"in t&&!("source"in t)&&!("target"in t),R9=(t,e=[0,0])=>{const{width:n,height:r}=W0(t),s=t.origin??e,i=n*s[0],o=r*s[1];return{x:t.position.x-i,y:t.position.y-o}},Oos=(t,e={nodeOrigin:[0,0]})=>{if(t.length===0)return{x:0,y:0,width:0,height:0};const n=t.reduce((r,s)=>{const i=typeof s=="string";let o=!e.nodeLookup&&!i?s:void 0;e.nodeLookup&&(o=i?e.nodeLookup.get(s):mIe(s)?s:e.nodeLookup.get(s.id));const l=o?_X(o,e.nodeOrigin):{x:0,y:0,x2:0,y2:0};return oae(r,l)},{x:1/0,y:1/0,x2:-1/0,y2:-1/0});return lae(n)},I9=(t,e={})=>{let n={x:1/0,y:1/0,x2:-1/0,y2:-1/0},r=!1;return t.forEach(s=>{(e.filter===void 0||e.filter(s))&&(n=oae(n,_X(s)),r=!0)}),r?lae(n):{x:0,y:0,width:0,height:0}},fIe=(t,e,[n,r,s]=[0,0,1],i=!1,o=!1)=>{const l=(e.x-n)/s,c=(e.y-r)/s,d=e.width/s,u=e.height/s,h=[];for(const m of t.values()){const{measured:f,selectable:p=!0,hidden:g=!1}=m;if(o&&!p||g)continue;const v=f.width??m.width??m.initialWidth??0,b=f.height??m.height??m.initialHeight??0,{x,y:w}=m.internals.positionAbsolute,k=Q4t(l,c,d,u,x,w,v,b),S=v*b,C=i&&k>0;(!m.internals.handleBounds||C||k>=S||m.dragging)&&h.push(m)}return h},Fos=(t,e)=>{const n=new Set;return t.forEach(r=>{n.add(r.id)}),e.filter(r=>n.has(r.source)||n.has(r.target))};function Bos(t,e){const n=new Map,r=e!=null&&e.nodes?new Set(e.nodes.map(s=>s.id)):null;return t.forEach(s=>{s.measured.width&&s.measured.height&&((e==null?void 0:e.includeHiddenNodes)||!s.hidden)&&(!r||r.has(s.id))&&n.set(s.id,s)}),n}async function Uos({nodes:t,width:e,height:n,panZoom:r,minZoom:s,maxZoom:i},o){if(t.size===0)return!0;const l=Bos(t,o),c=I9(l),d=gIe(c,e,n,(o==null?void 0:o.minZoom)??s,(o==null?void 0:o.maxZoom)??i,(o==null?void 0:o.padding)??.1);return await r.setViewport(d,{duration:o==null?void 0:o.duration,ease:o==null?void 0:o.ease,interpolate:o==null?void 0:o.interpolate}),!0}function q4t({nodeId:t,nextPosition:e,nodeLookup:n,nodeOrigin:r=[0,0],nodeExtent:s,onError:i}){const o=n.get(t),l=o.parentId?n.get(o.parentId):void 0,{x:c,y:d}=l?l.internals.positionAbsolute:{x:0,y:0},u=o.origin??r;let h=o.extent||s;if(o.extent==="parent"&&!o.expandParent)if(!l)i==null||i("005",zg.error005());else{const f=l.measured.width,p=l.measured.height;f&&p&&(h=[[c,d],[c+f,d+p]])}else l&&gE(o.extent)&&(h=[[o.extent[0][0]+c,o.extent[0][1]+d],[o.extent[1][0]+c,o.extent[1][1]+d]]);const m=gE(h)?pE(e,h,o.measured):e;return(o.measured.width===void 0||o.measured.height===void 0)&&(i==null||i("015",zg.error015())),{position:{x:m.x-c+(o.measured.width??0)*u[0],y:m.y-d+(o.measured.height??0)*u[1]},positionAbsolute:m}}async function zos({nodesToRemove:t=[],edgesToRemove:e=[],nodes:n,edges:r,onBeforeDelete:s}){const i=new Set(t.map(m=>m.id)),o=[];for(const m of n){if(m.deletable===!1)continue;const f=i.has(m.id),p=!f&&m.parentId&&o.find(g=>g.id===m.parentId);(f||p)&&o.push(m)}const l=new Set(e.map(m=>m.id)),c=r.filter(m=>m.deletable!==!1),u=Fos(o,c);for(const m of c)l.has(m.id)&&!u.find(p=>p.id===m.id)&&u.push(m);if(!s)return{edges:u,nodes:o};const h=await s({nodes:o,edges:u});return typeof h=="boolean"?h?{edges:u,nodes:o}:{edges:[],nodes:[]}:h}const q5=(t,e=0,n=1)=>Math.min(Math.max(t,e),n),pE=(t={x:0,y:0},e,n)=>({x:q5(t.x,e[0][0],e[1][0]-((n==null?void 0:n.width)??0)),y:q5(t.y,e[0][1],e[1][1]-((n==null?void 0:n.height)??0))});function K4t(t,e,n){const{width:r,height:s}=W0(n),{x:i,y:o}=n.internals.positionAbsolute;return pE(t,[[i,o],[i+r,o+s]],e)}const MZe=(t,e,n)=>t<e?q5(Math.abs(t-e),1,e)/e:t>n?-q5(Math.abs(t-n),1,e)/e:0,pIe=(t,e,n=15,r=40)=>{const s=MZe(t.x,r,e.width-r)*n,i=MZe(t.y,r,e.height-r)*n;return[s,i]},oae=(t,e)=>({x:Math.min(t.x,e.x),y:Math.min(t.y,e.y),x2:Math.max(t.x2,e.x2),y2:Math.max(t.y2,e.y2)}),H1e=({x:t,y:e,width:n,height:r})=>({x:t,y:e,x2:t+n,y2:e+r}),lae=({x:t,y:e,x2:n,y2:r})=>({x:t,y:e,width:n-t,height:r-e}),f8=(t,e=[0,0])=>{var s,i;const{x:n,y:r}=mIe(t)?t.internals.positionAbsolute:R9(t,e);return{x:n,y:r,width:((s=t.measured)==null?void 0:s.width)??t.width??t.initialWidth??0,height:((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0}},_X=(t,e=[0,0])=>{var s,i;const{x:n,y:r}=mIe(t)?t.internals.positionAbsolute:R9(t,e);return{x:n,y:r,x2:n+(((s=t.measured)==null?void 0:s.width)??t.width??t.initialWidth??0),y2:r+(((i=t.measured)==null?void 0:i.height)??t.height??t.initialHeight??0)}},Y4t=(t,e)=>lae(oae(H1e(t),H1e(e))),Q4t=(t,e,n,r,s,i,o,l)=>{const c=Math.max(0,Math.min(t+n,s+o)-Math.max(t,s)),d=Math.max(0,Math.min(e+r,i+l)-Math.max(e,i));return Math.ceil(c*d)},AX=(t,e)=>Q4t(t.x,t.y,t.width,t.height,e.x,e.y,e.width,e.height),LZe=t=>vg(t.width)&&vg(t.height)&&vg(t.x)&&vg(t.y),vg=t=>!isNaN(t)&&isFinite(t),Z4t=(t,e)=>(n,r)=>{},M9=(t,e=[1,1])=>({x:e[0]*Math.round(t.x/e[0]),y:e[1]*Math.round(t.y/e[1])}),L9=({x:t,y:e},[n,r,s],i=!1,o=[1,1])=>{const l={x:(t-n)/s,y:(e-r)/s};return i?M9(l,o):l},K5=({x:t,y:e},[n,r,s])=>({x:t*s+n,y:e*s+r});function VT(t,e){if(typeof t=="number")return Math.floor((e-e/(1+t))*.5);if(typeof t=="string"&&t.endsWith("px")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(n)}if(typeof t=="string"&&t.endsWith("%")){const n=parseFloat(t);if(!Number.isNaN(n))return Math.floor(e*n*.01)}return console.error(`The padding value "${t}" is invalid. Please provide a number or a string with a valid unit (px or %).`),0}function Vos(t,e,n){if(typeof t=="string"||typeof t=="number"){const r=VT(t,n),s=VT(t,e);return{top:r,right:s,bottom:r,left:s,x:s*2,y:r*2}}if(typeof t=="object"){const r=VT(t.top??t.y??0,n),s=VT(t.bottom??t.y??0,n),i=VT(t.left??t.x??0,e),o=VT(t.right??t.x??0,e);return{top:r,right:o,bottom:s,left:i,x:i+o,y:r+s}}return{top:0,right:0,bottom:0,left:0,x:0,y:0}}function Hos(t,e,n,r,s,i){const{x:o,y:l}=K5(t,[e,n,r]),{x:c,y:d}=K5({x:t.x+t.width,y:t.y+t.height},[e,n,r]),u=s-c,h=i-d;return{left:Math.floor(o),top:Math.floor(l),right:Math.floor(u),bottom:Math.floor(h)}}const gIe=(t,e,n,r,s,i)=>{const o=Vos(i,e,n),l=(e-o.x)/t.width,c=(n-o.y)/t.height,d=Math.min(l,c),u=q5(d,r,s),h=t.x+t.width/2,m=t.y+t.height/2,f=e/2-h*u,p=n/2-m*u,g=Hos(t,f,p,u,e,n),v={left:Math.min(g.left-o.left,0),top:Math.min(g.top-o.top,0),right:Math.min(g.right-o.right,0),bottom:Math.min(g.bottom-o.bottom,0)};return{x:f-v.left+v.right,y:p-v.top+v.bottom,zoom:u}},p8=()=>{var t;return typeof navigator<"u"&&((t=navigator==null?void 0:navigator.userAgent)==null?void 0:t.indexOf("Mac"))>=0};function gE(t){return t!=null&&t!=="parent"}function W0(t){var e,n;return{width:((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth??0,height:((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight??0}}function J4t(t){var e,n;return(((e=t.measured)==null?void 0:e.width)??t.width??t.initialWidth)!==void 0&&(((n=t.measured)==null?void 0:n.height)??t.height??t.initialHeight)!==void 0}function X4t(t,e={width:0,height:0},n,r,s){const i={...t},o=r.get(n);if(o){const l=o.origin||s;i.x+=o.internals.positionAbsolute.x-(e.width??0)*l[0],i.y+=o.internals.positionAbsolute.y-(e.height??0)*l[1]}return i}function DZe(t,e){if(t.size!==e.size)return!1;for(const n of t)if(!e.has(n))return!1;return!0}function Gos(){let t,e;return{promise:new Promise((r,s)=>{t=r,e=s}),resolve:t,reject:e}}function Wos(t){return{...V4t,...t||{}}}function W$(t,{snapGrid:e=[0,0],snapToGrid:n=!1,transform:r,containerBounds:s}){const{x:i,y:o}=yg(t),l=L9({x:i-((s==null?void 0:s.left)??0),y:o-((s==null?void 0:s.top)??0)},r),{x:c,y:d}=n?M9(l,e):l;return{xSnapped:c,ySnapped:d,...l}}const vIe=t=>({width:t.offsetWidth,height:t.offsetHeight}),eDt=t=>{var e;return((e=t==null?void 0:t.getRootNode)==null?void 0:e.call(t))||(window==null?void 0:window.document)},qos=["INPUT","SELECT","TEXTAREA"];function tDt(t){var r,s;const e=((s=(r=t.composedPath)==null?void 0:r.call(t))==null?void 0:s[0])||t.target;return(e==null?void 0:e.nodeType)!==1?!1:qos.includes(e.nodeName)||e.hasAttribute("contenteditable")||!!e.closest(".nokey")}const nDt=t=>"clientX"in t,yg=(t,e)=>{var i,o;const n=nDt(t),r=n?t.clientX:(i=t.touches)==null?void 0:i[0].clientX,s=n?t.clientY:(o=t.touches)==null?void 0:o[0].clientY;return{x:r-((e==null?void 0:e.left)??0),y:s-((e==null?void 0:e.top)??0)}},$Ze=(t,e,n,r,s)=>{const i=e.querySelectorAll(`.${t}`);return!i||!i.length?null:Array.from(i).map(o=>{const l=o.getBoundingClientRect();return{id:o.getAttribute("data-handleid"),type:t,nodeId:s,position:o.getAttribute("data-handlepos"),x:(l.left-n.left)/r,y:(l.top-n.top)/r,...vIe(o)}})};function rDt({sourceX:t,sourceY:e,targetX:n,targetY:r,sourceControlX:s,sourceControlY:i,targetControlX:o,targetControlY:l}){const c=t*.125+s*.375+o*.375+n*.125,d=e*.125+i*.375+l*.375+r*.125,u=Math.abs(c-t),h=Math.abs(d-e);return[c,d,u,h]}function NH(t,e){return t>=0?.5*t:e*25*Math.sqrt(-t)}function OZe({pos:t,x1:e,y1:n,x2:r,y2:s,c:i}){switch(t){case kr.Left:return[e-NH(e-r,i),n];case kr.Right:return[e+NH(r-e,i),n];case kr.Top:return[e,n-NH(n-s,i)];case kr.Bottom:return[e,n+NH(s-n,i)]}}function sDt({sourceX:t,sourceY:e,sourcePosition:n=kr.Bottom,targetX:r,targetY:s,targetPosition:i=kr.Top,curvature:o=.25}){const[l,c]=OZe({pos:n,x1:t,y1:e,x2:r,y2:s,c:o}),[d,u]=OZe({pos:i,x1:r,y1:s,x2:t,y2:e,c:o}),[h,m,f,p]=rDt({sourceX:t,sourceY:e,targetX:r,targetY:s,sourceControlX:l,sourceControlY:c,targetControlX:d,targetControlY:u});return[`M${t},${e} C${l},${c} ${d},${u} ${r},${s}`,h,m,f,p]}function iDt({sourceX:t,sourceY:e,targetX:n,targetY:r}){const s=Math.abs(n-t)/2,i=n<t?n+s:n-s,o=Math.abs(r-e)/2,l=r<e?r+o:r-o;return[i,l,s,o]}function Kos({sourceNode:t,targetNode:e,selected:n=!1,zIndex:r=0,elevateOnSelect:s=!1,zIndexMode:i="basic"}){if(i==="manual")return r;const o=s&&n?r+1e3:r,l=Math.max(t.parentId||s&&t.selected?t.internals.z:0,e.parentId||s&&e.selected?e.internals.z:0);return o+l}function Yos({sourceNode:t,targetNode:e,width:n,height:r,transform:s}){const i=oae(_X(t),_X(e));i.x===i.x2&&(i.x2+=1),i.y===i.y2&&(i.y2+=1);const o={x:-s[0]/s[2],y:-s[1]/s[2],width:n/s[2],height:r/s[2]};return AX(o,lae(i))>0}const Qos=({source:t,sourceHandle:e,target:n,targetHandle:r})=>`xy-edge__${t}${e||""}-${n}${r||""}`,Zos=(t,e)=>e.some(n=>n.source===t.source&&n.target===t.target&&(n.sourceHandle===t.sourceHandle||!n.sourceHandle&&!t.sourceHandle)&&(n.targetHandle===t.targetHandle||!n.targetHandle&&!t.targetHandle)),Jos=(t,e,n={})=>{var i;if(!t.source||!t.target)return(i=n.onError)==null||i.call(n,"006",zg.error006()),e;const r=n.getEdgeId||Qos;let s;return W4t(t)?s={...t}:s={...t,id:r(t)},Zos(s,e)?e:(s.sourceHandle===null&&delete s.sourceHandle,s.targetHandle===null&&delete s.targetHandle,e.concat(s))};function yIe({sourceX:t,sourceY:e,targetX:n,targetY:r}){const[s,i,o,l]=iDt({sourceX:t,sourceY:e,targetX:n,targetY:r});return[`M ${t},${e}L ${n},${r}`,s,i,o,l]}const FZe={[kr.Left]:{x:-1,y:0},[kr.Right]:{x:1,y:0},[kr.Top]:{x:0,y:-1},[kr.Bottom]:{x:0,y:1}},Xos=({source:t,sourcePosition:e=kr.Bottom,target:n})=>e===kr.Left||e===kr.Right?t.x<n.x?{x:1,y:0}:{x:-1,y:0}:t.y<n.y?{x:0,y:1}:{x:0,y:-1},BZe=(t,e)=>Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2));function els({source:t,sourcePosition:e=kr.Bottom,target:n,targetPosition:r=kr.Top,center:s,offset:i,stepPosition:o}){const l=FZe[e],c=FZe[r],d={x:t.x+l.x*i,y:t.y+l.y*i},u={x:n.x+c.x*i,y:n.y+c.y*i},h=Xos({source:d,sourcePosition:e,target:u}),m=h.x!==0?"x":"y",f=h[m];let p=[],g,v;const b={x:0,y:0},x={x:0,y:0},[,,w,k]=iDt({sourceX:t.x,sourceY:t.y,targetX:n.x,targetY:n.y});if(l[m]*c[m]===-1){m==="x"?(g=s.x??d.x+(u.x-d.x)*o,v=s.y??(d.y+u.y)/2):(g=s.x??(d.x+u.x)/2,v=s.y??d.y+(u.y-d.y)*o);const E=[{x:g,y:d.y},{x:g,y:u.y}],N=[{x:d.x,y:v},{x:u.x,y:v}];l[m]===f?p=m==="x"?E:N:p=m==="x"?N:E}else{const E=[{x:d.x,y:u.y}],N=[{x:u.x,y:d.y}];if(m==="x"?p=l.x===f?N:E:p=l.y===f?E:N,e===r){const O=Math.abs(t[m]-n[m]);if(O<=i){const F=Math.min(i-1,i-O);l[m]===f?b[m]=(d[m]>t[m]?-1:1)*F:x[m]=(u[m]>n[m]?-1:1)*F}}if(e!==r){const O=m==="x"?"y":"x",F=l[m]===c[O],D=d[O]>u[O],I=d[O]<u[O];(l[m]===1&&(!F&&D||F&&I)||l[m]!==1&&(!F&&I||F&&D))&&(p=m==="x"?E:N)}const A={x:d.x+b.x,y:d.y+b.y},_={x:u.x+x.x,y:u.y+x.y},T=Math.max(Math.abs(A.x-p[0].x),Math.abs(_.x-p[0].x)),R=Math.max(Math.abs(A.y-p[0].y),Math.abs(_.y-p[0].y));T>=R?(g=(A.x+_.x)/2,v=p[0].y):(g=p[0].x,v=(A.y+_.y)/2)}const S={x:d.x+b.x,y:d.y+b.y},C={x:u.x+x.x,y:u.y+x.y};return[[t,...S.x!==p[0].x||S.y!==p[0].y?[S]:[],...p,...C.x!==p[p.length-1].x||C.y!==p[p.length-1].y?[C]:[],n],g,v,w,k]}function tls(t,e,n,r){const s=Math.min(BZe(t,e)/2,BZe(e,n)/2,r),{x:i,y:o}=e;if(t.x===i&&i===n.x||t.y===o&&o===n.y)return`L${i} ${o}`;if(t.y===o){const d=t.x<n.x?-1:1,u=t.y<n.y?1:-1;return`L ${i+s*d},${o}Q ${i},${o} ${i},${o+s*u}`}const l=t.x<n.x?1:-1,c=t.y<n.y?-1:1;return`L ${i},${o+s*c}Q ${i},${o} ${i+s*l},${o}`}function G1e({sourceX:t,sourceY:e,sourcePosition:n=kr.Bottom,targetX:r,targetY:s,targetPosition:i=kr.Top,borderRadius:o=5,centerX:l,centerY:c,offset:d=20,stepPosition:u=.5}){const[h,m,f,p,g]=els({source:{x:t,y:e},sourcePosition:n,target:{x:r,y:s},targetPosition:i,center:{x:l,y:c},offset:d,stepPosition:u});let v=`M${h[0].x} ${h[0].y}`;for(let b=1;b<h.length-1;b++)v+=tls(h[b-1],h[b],h[b+1],o);return v+=`L${h[h.length-1].x} ${h[h.length-1].y}`,[v,m,f,p,g]}function UZe(t){var e;return t&&!!(t.internals.handleBounds||(e=t.handles)!=null&&e.length)&&!!(t.measured.width||t.width||t.initialWidth)}function nls(t){var h;const{sourceNode:e,targetNode:n}=t;if(!UZe(e)||!UZe(n))return null;const r=e.internals.handleBounds||zZe(e.handles),s=n.internals.handleBounds||zZe(n.handles),i=VZe((r==null?void 0:r.source)??[],t.sourceHandle),o=VZe(t.connectionMode===W5.Strict?(s==null?void 0:s.target)??[]:((s==null?void 0:s.target)??[]).concat((s==null?void 0:s.source)??[]),t.targetHandle);if(!i||!o)return(h=t.onError)==null||h.call(t,"008",zg.error008(i?"target":"source",{id:t.id,sourceHandle:t.sourceHandle,targetHandle:t.targetHandle})),null;const l=(i==null?void 0:i.position)||kr.Bottom,c=(o==null?void 0:o.position)||kr.Top,d=vE(e,i,l),u=vE(n,o,c);return{sourceX:d.x,sourceY:d.y,targetX:u.x,targetY:u.y,sourcePosition:l,targetPosition:c}}function zZe(t){if(!t)return null;const e=[],n=[];for(const r of t)r.width=r.width??1,r.height=r.height??1,r.type==="source"?e.push(r):r.type==="target"&&n.push(r);return{source:e,target:n}}function vE(t,e,n=kr.Left,r=!1){const s=((e==null?void 0:e.x)??0)+t.internals.positionAbsolute.x,i=((e==null?void 0:e.y)??0)+t.internals.positionAbsolute.y,{width:o,height:l}=e??W0(t);if(r)return{x:s+o/2,y:i+l/2};switch((e==null?void 0:e.position)??n){case kr.Top:return{x:s+o/2,y:i};case kr.Right:return{x:s+o,y:i+l/2};case kr.Bottom:return{x:s+o/2,y:i+l};case kr.Left:return{x:s,y:i+l/2}}}function VZe(t,e){return t&&(e?t.find(n=>n.id===e):t[0])||null}function W1e(t,e){return t?typeof t=="string"?t:`${e?`${e}__`:""}${Object.keys(t).sort().map(r=>`${r}=${t[r]}`).join("&")}`:""}function rls(t,{id:e,defaultColor:n,defaultMarkerStart:r,defaultMarkerEnd:s}){const i=new Set;return t.reduce((o,l)=>([l.markerStart||r,l.markerEnd||s].forEach(c=>{if(c&&typeof c=="object"){const d=W1e(c,e);i.has(d)||(o.push({id:d,color:c.color||n,...c}),i.add(d))}}),o),[]).sort((o,l)=>o.id.localeCompare(l.id))}const aDt=1e3,sls=10,bIe={nodeOrigin:[0,0],nodeExtent:h8,elevateNodesOnSelect:!0,zIndexMode:"basic",defaults:{}},ils={...bIe,checkEquality:!0};function xIe(t,e){const n={...t};for(const r in e)e[r]!==void 0&&(n[r]=e[r]);return n}function als(t,e,n){const r=xIe(bIe,n);for(const s of t.values())if(s.parentId)kIe(s,t,e,r);else{const i=R9(s,r.nodeOrigin),o=gE(s.extent)?s.extent:r.nodeExtent,l=pE(i,o,W0(s));s.internals.positionAbsolute=l}}function ols(t,e){if(!t.handles)return t.measured?e==null?void 0:e.internals.handleBounds:void 0;const n=[],r=[];for(const s of t.handles){const i={id:s.id,width:s.width??1,height:s.height??1,nodeId:t.id,x:s.x,y:s.y,position:s.position,type:s.type};s.type==="source"?n.push(i):s.type==="target"&&r.push(i)}return{source:n,target:r}}function wIe(t){return t==="manual"}function q1e(t,e,n,r={}){var u,h;const s=xIe(ils,r),i={i:0},o=new Map(e),l=s!=null&&s.elevateNodesOnSelect&&!wIe(s.zIndexMode)?aDt:0;let c=t.length>0,d=!1;e.clear(),n.clear();for(const m of t){let f=o.get(m.id);if(s.checkEquality&&m===(f==null?void 0:f.internals.userNode))e.set(m.id,f);else{const p=R9(m,s.nodeOrigin),g=gE(m.extent)?m.extent:s.nodeExtent,v=pE(p,g,W0(m));f={...s.defaults,...m,measured:{width:(u=m.measured)==null?void 0:u.width,height:(h=m.measured)==null?void 0:h.height},internals:{positionAbsolute:v,handleBounds:ols(m,f),z:oDt(m,l,s.zIndexMode),userNode:m}},e.set(m.id,f)}(f.measured===void 0||f.measured.width===void 0||f.measured.height===void 0)&&!f.hidden&&(c=!1),m.parentId&&kIe(f,e,n,r,i),d||(d=m.selected??!1)}return{nodesInitialized:c,hasSelectedNodes:d}}function lls(t,e){if(!t.parentId)return;const n=e.get(t.parentId);n?n.set(t.id,t):e.set(t.parentId,new Map([[t.id,t]]))}function kIe(t,e,n,r,s){const{elevateNodesOnSelect:i,nodeOrigin:o,nodeExtent:l,zIndexMode:c}=xIe(bIe,r),d=t.parentId,u=e.get(d);if(!u){console.warn(`Parent node ${d} not found. Please make sure that parent nodes are in front of their child nodes in the nodes array.`);return}lls(t,n),s&&!u.parentId&&u.internals.rootParentIndex===void 0&&c==="auto"&&(u.internals.rootParentIndex=++s.i,u.internals.z=u.internals.z+s.i*sls),s&&u.internals.rootParentIndex!==void 0&&(s.i=u.internals.rootParentIndex);const h=i&&!wIe(c)?aDt:0,{x:m,y:f,z:p}=cls(t,u,o,l,h,c),{positionAbsolute:g}=t.internals,v=m!==g.x||f!==g.y;(v||p!==t.internals.z)&&e.set(t.id,{...t,internals:{...t.internals,positionAbsolute:v?{x:m,y:f}:g,z:p}})}function oDt(t,e,n){const r=vg(t.zIndex)?t.zIndex:0;return wIe(n)?r:r+(t.selected?e:0)}function cls(t,e,n,r,s,i){const{x:o,y:l}=e.internals.positionAbsolute,c=W0(t),d=R9(t,n),u=gE(t.extent)?pE(d,t.extent,c):d;let h=pE({x:o+u.x,y:l+u.y},r,c);t.extent==="parent"&&(h=K4t(h,c,e));const m=oDt(t,s,i),f=e.internals.z??0;return{x:h.x,y:h.y,z:f>=m?f+1:m}}function SIe(t,e,n,r=[0,0]){var o;const s=[],i=new Map;for(const l of t){const c=e.get(l.parentId);if(!c)continue;const d=((o=i.get(l.parentId))==null?void 0:o.expandedRect)??f8(c),u=Y4t(d,l.rect);i.set(l.parentId,{expandedRect:u,parent:c})}return i.size>0&&i.forEach(({expandedRect:l,parent:c},d)=>{var w;const u=c.internals.positionAbsolute,h=W0(c),m=c.origin??r,f=l.x<u.x?Math.round(Math.abs(u.x-l.x)):0,p=l.y<u.y?Math.round(Math.abs(u.y-l.y)):0,g=Math.max(h.width,Math.round(l.width)),v=Math.max(h.height,Math.round(l.height)),b=(g-h.width)*m[0],x=(v-h.height)*m[1];(f>0||p>0||b||x)&&(s.push({id:d,type:"position",position:{x:c.position.x-f+b,y:c.position.y-p+x}}),(w=n.get(d))==null||w.forEach(k=>{t.some(S=>S.id===k.id)||s.push({id:k.id,type:"position",position:{x:k.position.x+f,y:k.position.y+p}})})),(h.width<l.width||h.height<l.height||f||p)&&s.push({id:d,type:"dimensions",setAttributes:!0,dimensions:{width:g+(f?m[0]*f-b:0),height:v+(p?m[1]*p-x:0)}})}),s}function dls(t,e,n,r,s,i,o){const l=r==null?void 0:r.querySelector(".xyflow__viewport");let c=!1;if(!l)return{changes:[],updatedInternals:c};const d=[],u=window.getComputedStyle(l),{m22:h}=new window.DOMMatrixReadOnly(u.transform),m=[];for(const f of t.values()){const p=e.get(f.id);if(!p)continue;if(p.hidden){e.set(p.id,{...p,internals:{...p.internals,handleBounds:void 0}}),c=!0;continue}const g=vIe(f.nodeElement),v=p.measured.width!==g.width||p.measured.height!==g.height;if(!!(g.width&&g.height&&(v||!p.internals.handleBounds||f.force))){const x=f.nodeElement.getBoundingClientRect(),w=gE(p.extent)?p.extent:i;let{positionAbsolute:k}=p.internals;p.parentId&&p.extent==="parent"?k=K4t(k,g,e.get(p.parentId)):w&&(k=pE(k,w,g));const S={...p,measured:g,internals:{...p.internals,positionAbsolute:k,handleBounds:{source:$Ze("source",f.nodeElement,x,h,p.id),target:$Ze("target",f.nodeElement,x,h,p.id)}}};e.set(p.id,S),p.parentId&&kIe(S,e,n,{nodeOrigin:s,zIndexMode:o}),c=!0,v&&(d.push({id:p.id,type:"dimensions",dimensions:g}),p.expandParent&&p.parentId&&m.push({id:p.id,parentId:p.parentId,rect:f8(S,s)}))}}if(m.length>0){const f=SIe(m,e,n,s);d.push(...f)}return{changes:d,updatedInternals:c}}async function uls({delta:t,panZoom:e,transform:n,translateExtent:r,width:s,height:i}){if(!e||!t.x&&!t.y)return!1;const o=await e.setViewportConstrained({x:n[0]+t.x,y:n[1]+t.y,zoom:n[2]},[[0,0],[s,i]],r);return!!o&&(o.x!==n[0]||o.y!==n[1]||o.k!==n[2])}function HZe(t,e,n,r,s,i){let o=s;const l=r.get(o)||new Map;r.set(o,l.set(n,e)),o=`${s}-${t}`;const c=r.get(o)||new Map;if(r.set(o,c.set(n,e)),i){o=`${s}-${t}-${i}`;const d=r.get(o)||new Map;r.set(o,d.set(n,e))}}function lDt(t,e,n){t.clear(),e.clear();for(const r of n){const{source:s,target:i,sourceHandle:o=null,targetHandle:l=null}=r,c={edgeId:r.id,source:s,target:i,sourceHandle:o,targetHandle:l},d=`${s}-${o}--${i}-${l}`,u=`${i}-${l}--${s}-${o}`;HZe("source",c,u,t,s,o),HZe("target",c,d,t,i,l),e.set(r.id,r)}}function cDt(t,e){if(!t.parentId)return!1;const n=e.get(t.parentId);return n?n.selected?!0:cDt(n,e):!1}function GZe(t,e,n){var s;let r=t;do{if((s=r==null?void 0:r.matches)!=null&&s.call(r,e))return!0;if(r===n)return!1;r=r==null?void 0:r.parentElement}while(r);return!1}function hls(t,e,n,r){const s=new Map;for(const[i,o]of t)if((o.selected||o.id===r)&&(!o.parentId||!cDt(o,t))&&(o.draggable||e&&typeof o.draggable>"u")){const l=t.get(i);l&&s.set(i,{id:i,position:l.position||{x:0,y:0},distance:{x:n.x-l.internals.positionAbsolute.x,y:n.y-l.internals.positionAbsolute.y},extent:l.extent,parentId:l.parentId,origin:l.origin,expandParent:l.expandParent,internals:{positionAbsolute:l.internals.positionAbsolute||{x:0,y:0}},measured:{width:l.measured.width??0,height:l.measured.height??0}})}return s}function bhe({nodeId:t,dragItems:e,nodeLookup:n,dragging:r=!0}){var o,l,c;const s=[];for(const[d,u]of e){const h=(o=n.get(d))==null?void 0:o.internals.userNode;h&&s.push({...h,position:u.position,dragging:r})}if(!t)return[s[0],s];const i=(l=n.get(t))==null?void 0:l.internals.userNode;return[i?{...i,position:((c=e.get(t))==null?void 0:c.position)||i.position,dragging:r}:s[0],s]}function mls({dragItems:t,snapGrid:e,x:n,y:r}){const s=t.values().next().value;if(!s)return null;const i={x:n-s.distance.x,y:r-s.distance.y},o=M9(i,e);return{x:o.x-i.x,y:o.y-i.y}}function fls({onNodeMouseDown:t,getStoreItems:e,onDragStart:n,onDrag:r,onDragStop:s}){let i={x:null,y:null},o=0,l=new Map,c=!1,d={x:0,y:0},u=null,h=!1,m=null,f=!1,p=!1,g=null;function v({noDragClassName:x,handleSelector:w,domNode:k,isSelectable:S,nodeId:C,nodeClickDistance:j=0}){m=um(k);function E({x:T,y:R}){const{nodeLookup:O,nodeExtent:F,snapGrid:D,snapToGrid:I,nodeOrigin:P,onNodeDrag:M,onSelectionDrag:z,onError:G,updateNodePositions:B}=e();i={x:T,y:R};let H=!1;const W=l.size>1,V=W&&F?H1e(I9(l)):null,U=W&&I?mls({dragItems:l,snapGrid:D,x:T,y:R}):null;for(const[ne,te]of l){if(!O.has(ne))continue;let re={x:T-te.distance.x,y:R-te.distance.y};I&&(re=U?{x:Math.round(re.x+U.x),y:Math.round(re.y+U.y)}:M9(re,D));let fe=null;if(W&&F&&!te.extent&&V){const{positionAbsolute:Y}=te.internals,X=Y.x-V.x+F[0][0],Q=Y.x+te.measured.width-V.x2+F[1][0],ie=Y.y-V.y+F[0][1],he=Y.y+te.measured.height-V.y2+F[1][1];fe=[[X,ie],[Q,he]]}const{position:le,positionAbsolute:q}=q4t({nodeId:ne,nextPosition:re,nodeLookup:O,nodeExtent:fe||F,nodeOrigin:P,onError:G});H=H||te.position.x!==le.x||te.position.y!==le.y,te.position=le,te.internals.positionAbsolute=q}if(p=p||H,!!H&&(B(l,!0),g&&(r||M||!C&&z))){const[ne,te]=bhe({nodeId:C,dragItems:l,nodeLookup:O});r==null||r(g,l,ne,te),M==null||M(g,ne,te),C||z==null||z(g,te)}}async function N(){if(!u)return;const{transform:T,panBy:R,autoPanSpeed:O,autoPanOnNodeDrag:F}=e();if(!F){c=!1,cancelAnimationFrame(o);return}const[D,I]=pIe(d,u,O);(D!==0||I!==0)&&(i.x=(i.x??0)-D/T[2],i.y=(i.y??0)-I/T[2],await R({x:D,y:I})&&E(i)),o=requestAnimationFrame(N)}function A(T){var W;const{nodeLookup:R,multiSelectionActive:O,nodesDraggable:F,transform:D,snapGrid:I,snapToGrid:P,selectNodesOnDrag:M,onNodeDragStart:z,onSelectionDragStart:G,unselectNodesAndEdges:B}=e();h=!0,(!M||!S)&&!O&&C&&((W=R.get(C))!=null&&W.selected||B()),S&&M&&C&&(t==null||t(C));const H=W$(T.sourceEvent,{transform:D,snapGrid:I,snapToGrid:P,containerBounds:u});if(i=H,l=hls(R,F,H,C),l.size>0&&(n||z||!C&&G)){const[V,U]=bhe({nodeId:C,dragItems:l,nodeLookup:R});n==null||n(T.sourceEvent,l,V,U),z==null||z(T.sourceEvent,V,U),C||G==null||G(T.sourceEvent,U)}}const _=R4t().clickDistance(j).on("start",T=>{const{domNode:R,nodeDragThreshold:O,transform:F,snapGrid:D,snapToGrid:I}=e();u=(R==null?void 0:R.getBoundingClientRect())||null,f=!1,p=!1,g=T.sourceEvent,O===0&&A(T),i=W$(T.sourceEvent,{transform:F,snapGrid:D,snapToGrid:I,containerBounds:u}),d=yg(T.sourceEvent,u)}).on("drag",T=>{const{autoPanOnNodeDrag:R,transform:O,snapGrid:F,snapToGrid:D,nodeDragThreshold:I,nodeLookup:P}=e(),M=W$(T.sourceEvent,{transform:O,snapGrid:F,snapToGrid:D,containerBounds:u});if(g=T.sourceEvent,(T.sourceEvent.type==="touchmove"&&T.sourceEvent.touches.length>1||C&&!P.has(C))&&(f=!0),!f){if(!c&&R&&h&&(c=!0,N()),!h){const z=yg(T.sourceEvent,u),G=z.x-d.x,B=z.y-d.y;Math.sqrt(G*G+B*B)>I&&A(T)}(i.x!==M.xSnapped||i.y!==M.ySnapped)&&l&&h&&(d=yg(T.sourceEvent,u),E(M))}}).on("end",T=>{if(!h||f){f&&l.size>0&&e().updateNodePositions(l,!1);return}if(c=!1,h=!1,cancelAnimationFrame(o),l.size>0){const{nodeLookup:R,updateNodePositions:O,onNodeDragStop:F,onSelectionDragStop:D}=e();if(p&&(O(l,!1),p=!1),s||F||!C&&D){const[I,P]=bhe({nodeId:C,dragItems:l,nodeLookup:R,dragging:!1});s==null||s(T.sourceEvent,l,I,P),F==null||F(T.sourceEvent,I,P),C||D==null||D(T.sourceEvent,P)}}}).filter(T=>{const R=T.target;return!T.button&&(!x||!GZe(R,`.${x}`,k))&&(!w||GZe(R,w,k))});m.call(_)}function b(){m==null||m.on(".drag",null)}return{update:v,destroy:b}}function pls(t,e,n){const r=[],s={x:t.x-n,y:t.y-n,width:n*2,height:n*2};for(const i of e.values())AX(s,f8(i))>0&&r.push(i);return r}const gls=250;function vls(t,e,n,r){var l,c;let s=[],i=1/0;const o=pls(t,n,e+gls);for(const d of o){const u=[...((l=d.internals.handleBounds)==null?void 0:l.source)??[],...((c=d.internals.handleBounds)==null?void 0:c.target)??[]];for(const h of u){if(r.nodeId===h.nodeId&&r.type===h.type&&r.id===h.id)continue;const{x:m,y:f}=vE(d,h,h.position,!0),p=Math.sqrt(Math.pow(m-t.x,2)+Math.pow(f-t.y,2));p>e||(p<i?(s=[{...h,x:m,y:f}],i=p):p===i&&s.push({...h,x:m,y:f}))}}if(!s.length)return null;if(s.length>1){const d=r.type==="source"?"target":"source";return s.find(u=>u.type===d)??s[0]}return s[0]}function dDt(t,e,n,r,s,i=!1){var d,u,h;const o=r.get(t);if(!o)return null;const l=s==="strict"?(d=o.internals.handleBounds)==null?void 0:d[e]:[...((u=o.internals.handleBounds)==null?void 0:u.source)??[],...((h=o.internals.handleBounds)==null?void 0:h.target)??[]],c=(n?l==null?void 0:l.find(m=>m.id===n):l==null?void 0:l[0])??null;return c&&i?{...c,...vE(o,c,c.position,!0)}:c}function uDt(t,e){return t||(e!=null&&e.classList.contains("target")?"target":e!=null&&e.classList.contains("source")?"source":null)}function yls(t,e){let n=null;return e?n=!0:t&&!e&&(n=!1),n}const hDt=()=>!0;function bls(t,{connectionMode:e,connectionRadius:n,handleId:r,nodeId:s,edgeUpdaterType:i,isTarget:o,domNode:l,nodeLookup:c,lib:d,autoPanOnConnect:u,flowId:h,panBy:m,cancelConnection:f,onConnectStart:p,onConnect:g,onConnectEnd:v,isValidConnection:b=hDt,onReconnectEnd:x,updateConnection:w,getTransform:k,getFromHandle:S,autoPanSpeed:C,dragThreshold:j=1,handleDomNode:E}){const N=eDt(t.target);let A=0,_;const{x:T,y:R}=yg(t),O=uDt(i,E),F=l==null?void 0:l.getBoundingClientRect();let D=!1;if(!F||!O)return;const I=dDt(s,O,r,c,e);if(!I)return;let P=yg(t,F),M=!1,z=null,G=!1,B=null;function H(){if(!u||!F)return;const[le,q]=pIe(P,F,C);m({x:le,y:q}),A=requestAnimationFrame(H)}const W={...I,nodeId:s,type:O,position:I.position},V=c.get(s);let ne={inProgress:!0,isValid:null,from:vE(V,W,kr.Left,!0),fromHandle:W,fromPosition:W.position,fromNode:V,to:P,toHandle:null,toPosition:IZe[W.position],toNode:null,pointer:P};function te(){D=!0,w(ne),p==null||p(t,{nodeId:s,handleId:r,handleType:O})}j===0&&te();function re(le){if(!D){const{x:he,y:ye}=yg(le),J=he-T,K=ye-R;if(!(J*J+K*K>j*j))return;te()}if(!S()||!W){fe(le);return}const q=k();P=yg(le,F),_=vls(L9(P,q,!1,[1,1]),n,c,W),M||(H(),M=!0);const Y=mDt(le,{handle:_,connectionMode:e,fromNodeId:s,fromHandleId:r,fromType:o?"target":"source",isValidConnection:b,doc:N,lib:d,flowId:h,nodeLookup:c});B=Y.handleDomNode,z=Y.connection,G=yls(!!_,Y.isValid);const X=c.get(s),Q=X?vE(X,W,kr.Left,!0):ne.from,ie={...ne,from:Q,isValid:G,to:Y.toHandle&&G?K5({x:Y.toHandle.x,y:Y.toHandle.y},q):P,toHandle:Y.toHandle,toPosition:G&&Y.toHandle?Y.toHandle.position:IZe[W.position],toNode:Y.toHandle?c.get(Y.toHandle.nodeId):null,pointer:P};w(ie),ne=ie}function fe(le){if(!("touches"in le&&le.touches.length>0)){if(D){(_||B)&&z&&G&&(g==null||g(z));const{inProgress:q,...Y}=ne,X={...Y,toPosition:ne.toHandle?ne.toPosition:null};v==null||v(le,X),i&&(x==null||x(le,X))}f(),cancelAnimationFrame(A),M=!1,G=!1,z=null,B=null,N.removeEventListener("mousemove",re),N.removeEventListener("mouseup",fe),N.removeEventListener("touchmove",re),N.removeEventListener("touchend",fe)}}N.addEventListener("mousemove",re),N.addEventListener("mouseup",fe),N.addEventListener("touchmove",re),N.addEventListener("touchend",fe)}function mDt(t,{handle:e,connectionMode:n,fromNodeId:r,fromHandleId:s,fromType:i,doc:o,lib:l,flowId:c,isValidConnection:d=hDt,nodeLookup:u}){const h=i==="target",m=e?o.querySelector(`.${l}-flow__handle[data-id="${c}-${e==null?void 0:e.nodeId}-${e==null?void 0:e.id}-${e==null?void 0:e.type}"]`):null,{x:f,y:p}=yg(t),g=o.elementFromPoint(f,p),v=g!=null&&g.classList.contains(`${l}-flow__handle`)?g:m,b={handleDomNode:v,isValid:!1,connection:null,toHandle:null};if(v){const x=uDt(void 0,v),w=v.getAttribute("data-nodeid"),k=v.getAttribute("data-handleid"),S=v.classList.contains("connectable"),C=v.classList.contains("connectableend");if(!w||!x)return b;const j={source:h?w:r,sourceHandle:h?k:s,target:h?r:w,targetHandle:h?s:k};b.connection=j;const N=S&&C&&(n===W5.Strict?h&&x==="source"||!h&&x==="target":w!==r||k!==s);b.isValid=N&&d(j),b.toHandle=dDt(w,x,k,u,n,!0)}return b}const K1e={onPointerDown:bls,isValid:mDt};function xls({domNode:t,panZoom:e,getTransform:n,getViewScale:r}){const s=um(t);function i({translateExtent:l,width:c,height:d,zoomStep:u=1,pannable:h=!0,zoomable:m=!0,inversePan:f=!1}){const p=w=>{if(w.sourceEvent.type!=="wheel"||!e)return;const k=n(),S=w.sourceEvent.ctrlKey&&p8()?10:1,C=-w.sourceEvent.deltaY*(w.sourceEvent.deltaMode===1?.05:w.sourceEvent.deltaMode?1:.002)*u,j=k[2]*Math.pow(2,C*S);e.scaleTo(j)};let g=[0,0];const v=w=>{(w.sourceEvent.type==="mousedown"||w.sourceEvent.type==="touchstart")&&(g=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY])},b=w=>{const k=n();if(w.sourceEvent.type!=="mousemove"&&w.sourceEvent.type!=="touchmove"||!e)return;const S=[w.sourceEvent.clientX??w.sourceEvent.touches[0].clientX,w.sourceEvent.clientY??w.sourceEvent.touches[0].clientY],C=[S[0]-g[0],S[1]-g[1]];g=S;const j=r()*Math.max(k[2],Math.log(k[2]))*(f?-1:1),E={x:k[0]-C[0]*j,y:k[1]-C[1]*j},N=[[0,0],[c,d]];e.setViewportConstrained({x:E.x,y:E.y,zoom:k[2]},N,l)},x=U4t().on("start",v).on("zoom",h?b:null).on("zoom.wheel",m?p:null);s.call(x,{})}function o(){s.on("zoom",null)}return{update:i,destroy:o,pointer:Jp}}const cae=t=>({x:t.x,y:t.y,zoom:t.k}),xhe=({x:t,y:e,zoom:n})=>aae.translate(t,e).scale(n),CA=(t,e)=>t.target.closest(`.${e}`),fDt=(t,e)=>e===2&&Array.isArray(t)&&t.includes(2),wls=t=>((t*=2)<=1?t*t*t:(t-=2)*t*t+2)/2,whe=(t,e=0,n=wls,r=()=>{})=>{const s=typeof e=="number"&&e>0;return s||r(),s?t.transition().duration(e).ease(n).on("end",r):t},pDt=t=>{const e=t.ctrlKey&&p8()?10:1;return-t.deltaY*(t.deltaMode===1?.05:t.deltaMode?1:.002)*e};function kls({zoomPanValues:t,noWheelClassName:e,d3Selection:n,d3Zoom:r,panOnScrollMode:s,panOnScrollSpeed:i,zoomOnPinch:o,onPanZoomStart:l,onPanZoom:c,onPanZoomEnd:d}){return u=>{if(CA(u,e))return u.ctrlKey&&u.preventDefault(),!1;u.preventDefault(),u.stopImmediatePropagation();const h=n.property("__zoom").k||1;if(u.ctrlKey&&o){const v=Jp(u),b=pDt(u),x=h*Math.pow(2,b);r.scaleTo(n,x,v,u);return}const m=u.deltaMode===1?20:1;let f=s===u2.Vertical?0:u.deltaX*m,p=s===u2.Horizontal?0:u.deltaY*m;!p8()&&u.shiftKey&&s!==u2.Vertical&&(f=u.deltaY*m,p=0),r.translateBy(n,-(f/h)*i,-(p/h)*i,{internal:!0});const g=cae(n.property("__zoom"));clearTimeout(t.panScrollTimeout),t.isPanScrolling?(c==null||c(u,g),t.panScrollTimeout=setTimeout(()=>{d==null||d(u,g),t.isPanScrolling=!1},150)):(t.isPanScrolling=!0,l==null||l(u,g))}}function Sls({noWheelClassName:t,preventScrolling:e,d3ZoomHandler:n}){return function(r,s){const i=r.type==="wheel",o=!e&&i&&!r.ctrlKey,l=CA(r,t);if(r.ctrlKey&&i&&l&&r.preventDefault(),o||l)return null;r.preventDefault(),n.call(this,r,s)}}function Cls({zoomPanValues:t,onDraggingChange:e,onPanZoomStart:n}){return r=>{var i,o,l;if((i=r.sourceEvent)!=null&&i.internal)return;const s=cae(r.transform);t.mouseButton=((o=r.sourceEvent)==null?void 0:o.button)||0,t.isZoomingOrPanning=!0,t.prevViewport=s,((l=r.sourceEvent)==null?void 0:l.type)==="mousedown"&&e(!0),n&&(n==null||n(r.sourceEvent,s))}}function jls({zoomPanValues:t,panOnDrag:e,onPaneContextMenu:n,onTransformChange:r,onPanZoom:s}){return i=>{var o,l;t.usedRightMouseButton=!!(n&&fDt(e,t.mouseButton??0)),(o=i.sourceEvent)!=null&&o.sync||r([i.transform.x,i.transform.y,i.transform.k]),s&&!((l=i.sourceEvent)!=null&&l.internal)&&(s==null||s(i.sourceEvent,cae(i.transform)))}}function Els({zoomPanValues:t,panOnDrag:e,panOnScroll:n,onDraggingChange:r,onPanZoomEnd:s,onPaneContextMenu:i}){return o=>{var l;if(!((l=o.sourceEvent)!=null&&l.internal)&&(t.isZoomingOrPanning=!1,i&&fDt(e,t.mouseButton??0)&&!t.usedRightMouseButton&&o.sourceEvent&&i(o.sourceEvent),t.usedRightMouseButton=!1,r(!1),s)){const c=cae(o.transform);t.prevViewport=c,clearTimeout(t.timerId),t.timerId=setTimeout(()=>{s==null||s(o.sourceEvent,c)},n?150:0)}}}function Nls({zoomActivationKeyPressed:t,zoomOnScroll:e,zoomOnPinch:n,panOnDrag:r,panOnScroll:s,zoomOnDoubleClick:i,userSelectionActive:o,noWheelClassName:l,noPanClassName:c,lib:d,connectionInProgress:u}){return h=>{var v;const m=t||e,f=n&&h.ctrlKey,p=h.type==="wheel";if(h.button===1&&h.type==="mousedown"&&(CA(h,`${d}-flow__node`)||CA(h,`${d}-flow__edge`)))return!0;if(!r&&!m&&!s&&!i&&!n||o||u&&!p||CA(h,l)&&p||CA(h,c)&&(!p||s&&p&&!t)||!n&&h.ctrlKey&&p)return!1;if(!n&&h.type==="touchstart"&&((v=h.touches)==null?void 0:v.length)>1)return h.preventDefault(),!1;if(!m&&!s&&!f&&p||!r&&(h.type==="mousedown"||h.type==="touchstart")||Array.isArray(r)&&!r.includes(h.button)&&h.type==="mousedown")return!1;const g=Array.isArray(r)&&r.includes(h.button)||!h.button||h.button<=1;return(!h.ctrlKey||p)&&g}}function Tls({domNode:t,minZoom:e,maxZoom:n,translateExtent:r,viewport:s,onPanZoom:i,onPanZoomStart:o,onPanZoomEnd:l,onDraggingChange:c}){const d={isZoomingOrPanning:!1,usedRightMouseButton:!1,prevViewport:{},mouseButton:0,timerId:void 0,panScrollTimeout:void 0,isPanScrolling:!1},u=t.getBoundingClientRect(),h=U4t().scaleExtent([e,n]).translateExtent(r),m=um(t).call(h);x({x:s.x,y:s.y,zoom:q5(s.zoom,e,n)},[[0,0],[u.width,u.height]],r);const f=m.on("wheel.zoom"),p=m.on("dblclick.zoom");h.wheelDelta(pDt);async function g(_,T){return m?new Promise(R=>{h==null||h.interpolate((T==null?void 0:T.interpolate)==="linear"?Rx:Nq).transform(whe(m,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>R(!0)),_)}):!1}function v({noWheelClassName:_,noPanClassName:T,onPaneContextMenu:R,userSelectionActive:O,panOnScroll:F,panOnDrag:D,panOnScrollMode:I,panOnScrollSpeed:P,preventScrolling:M,zoomOnPinch:z,zoomOnScroll:G,zoomOnDoubleClick:B,zoomActivationKeyPressed:H,lib:W,onTransformChange:V,connectionInProgress:U,paneClickDistance:ne,selectionOnDrag:te}){O&&!d.isZoomingOrPanning&&b();const re=F&&!H&&!O;h.clickDistance(te?1/0:!vg(ne)||ne<0?0:ne);const fe=re?kls({zoomPanValues:d,noWheelClassName:_,d3Selection:m,d3Zoom:h,panOnScrollMode:I,panOnScrollSpeed:P,zoomOnPinch:z,onPanZoomStart:o,onPanZoom:i,onPanZoomEnd:l}):Sls({noWheelClassName:_,preventScrolling:M,d3ZoomHandler:f});m.on("wheel.zoom",fe,{passive:!1});const le=Cls({zoomPanValues:d,onDraggingChange:c,onPanZoomStart:o});h.on("start",le);const q=jls({zoomPanValues:d,panOnDrag:D,onPaneContextMenu:!!R,onPanZoom:i,onTransformChange:V});h.on("zoom",q);const Y=Els({zoomPanValues:d,panOnDrag:D,panOnScroll:F,onPaneContextMenu:R,onPanZoomEnd:l,onDraggingChange:c});h.on("end",Y);const X=Nls({zoomActivationKeyPressed:H,panOnDrag:D,zoomOnScroll:G,panOnScroll:F,zoomOnDoubleClick:B,zoomOnPinch:z,userSelectionActive:O,noPanClassName:T,noWheelClassName:_,lib:W,connectionInProgress:U});h.filter(X),B?m.on("dblclick.zoom",p):m.on("dblclick.zoom",null)}function b(){h.on("zoom",null)}async function x(_,T,R){const O=xhe(_),F=h==null?void 0:h.constrain()(O,T,R);return F&&await g(F),F}async function w(_,T){const R=xhe(_);return await g(R,T),R}function k(_){if(m){const T=xhe(_),R=m.property("__zoom");(R.k!==_.zoom||R.x!==_.x||R.y!==_.y)&&(h==null||h.transform(m,T,null,{sync:!0}))}}function S(){const _=m?B4t(m.node()):{x:0,y:0,k:1};return{x:_.x,y:_.y,zoom:_.k}}async function C(_,T){return m?new Promise(R=>{h==null||h.interpolate((T==null?void 0:T.interpolate)==="linear"?Rx:Nq).scaleTo(whe(m,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>R(!0)),_)}):!1}async function j(_,T){return m?new Promise(R=>{h==null||h.interpolate((T==null?void 0:T.interpolate)==="linear"?Rx:Nq).scaleBy(whe(m,T==null?void 0:T.duration,T==null?void 0:T.ease,()=>R(!0)),_)}):!1}function E(_){h==null||h.scaleExtent(_)}function N(_){h==null||h.translateExtent(_)}function A(_){const T=!vg(_)||_<0?0:_;h==null||h.clickDistance(T)}return{update:v,destroy:b,setViewport:w,setViewportConstrained:x,getViewport:S,scaleTo:C,scaleBy:j,setScaleExtent:E,setTranslateExtent:N,syncViewport:k,setClickDistance:A}}var Y5;(function(t){t.Line="line",t.Handle="handle"})(Y5||(Y5={}));function _ls({width:t,prevWidth:e,height:n,prevHeight:r,affectsX:s,affectsY:i}){const o=t-e,l=n-r,c=[o>0?1:o<0?-1:0,l>0?1:l<0?-1:0];return o&&s&&(c[0]=c[0]*-1),l&&i&&(c[1]=c[1]*-1),c}function WZe(t){const e=t.includes("right")||t.includes("left"),n=t.includes("bottom")||t.includes("top"),r=t.includes("left"),s=t.includes("top");return{isHorizontal:e,isVertical:n,affectsX:r,affectsY:s}}function fw(t,e){return Math.max(0,e-t)}function pw(t,e){return Math.max(0,t-e)}function TH(t,e,n){return Math.max(0,e-t,t-n)}function qZe(t,e){return t?!e:e}function Als(t,e,n,r,s,i,o,l){let{affectsX:c,affectsY:d}=e;const{isHorizontal:u,isVertical:h}=e,m=u&&h,{xSnapped:f,ySnapped:p}=n,{minWidth:g,maxWidth:v,minHeight:b,maxHeight:x}=r,{x:w,y:k,width:S,height:C,aspectRatio:j}=t;let E=Math.floor(u?f-t.pointerX:0),N=Math.floor(h?p-t.pointerY:0);const A=S+(c?-E:E),_=C+(d?-N:N),T=-i[0]*S,R=-i[1]*C;let O=TH(A,g,v),F=TH(_,b,x);if(o){let P=0,M=0;c&&E<0?P=fw(w+E+T,o[0][0]):!c&&E>0&&(P=pw(w+A+T,o[1][0])),d&&N<0?M=fw(k+N+R,o[0][1]):!d&&N>0&&(M=pw(k+_+R,o[1][1])),O=Math.max(O,P),F=Math.max(F,M)}if(l){let P=0,M=0;c&&E>0?P=pw(w+E,l[0][0]):!c&&E<0&&(P=fw(w+A,l[1][0])),d&&N>0?M=pw(k+N,l[0][1]):!d&&N<0&&(M=fw(k+_,l[1][1])),O=Math.max(O,P),F=Math.max(F,M)}if(s){if(u){const P=TH(A/j,b,x)*j;if(O=Math.max(O,P),o){let M=0;!c&&!d||c&&!d&&m?M=pw(k+R+A/j,o[1][1])*j:M=fw(k+R+(c?E:-E)/j,o[0][1])*j,O=Math.max(O,M)}if(l){let M=0;!c&&!d||c&&!d&&m?M=fw(k+A/j,l[1][1])*j:M=pw(k+(c?E:-E)/j,l[0][1])*j,O=Math.max(O,M)}}if(h){const P=TH(_*j,g,v)/j;if(F=Math.max(F,P),o){let M=0;!c&&!d||d&&!c&&m?M=pw(w+_*j+T,o[1][0])/j:M=fw(w+(d?N:-N)*j+T,o[0][0])/j,F=Math.max(F,M)}if(l){let M=0;!c&&!d||d&&!c&&m?M=fw(w+_*j,l[1][0])/j:M=pw(w+(d?N:-N)*j,l[0][0])/j,F=Math.max(F,M)}}}N=N+(N<0?F:-F),E=E+(E<0?O:-O),s&&(m?A>_*j?N=(qZe(c,d)?-E:E)/j:E=(qZe(c,d)?-N:N)*j:u?(N=E/j,d=c):(E=N*j,c=d));const D=c?w+E:w,I=d?k+N:k;return{width:S+(c?-E:E),height:C+(d?-N:N),x:i[0]*E*(c?-1:1)+D,y:i[1]*N*(d?-1:1)+I}}const gDt={width:0,height:0,x:0,y:0},Pls={...gDt,pointerX:0,pointerY:0,aspectRatio:1};function Rls(t,e,n){const r=e.position.x+t.position.x,s=e.position.y+t.position.y,i=t.measured.width??0,o=t.measured.height??0,l=n[0]*i,c=n[1]*o;return[[r-l,s-c],[r+i-l,s+o-c]]}function Ils({domNode:t,nodeId:e,getStoreItems:n,onChange:r,onEnd:s}){const i=um(t);let o={controlDirection:WZe("bottom-right"),boundaries:{minWidth:0,minHeight:0,maxWidth:Number.MAX_VALUE,maxHeight:Number.MAX_VALUE},resizeDirection:void 0,keepAspectRatio:!1};function l({controlPosition:d,boundaries:u,keepAspectRatio:h,resizeDirection:m,onResizeStart:f,onResize:p,onResizeEnd:g,shouldResize:v}){let b={...gDt},x={...Pls};o={boundaries:u,resizeDirection:m,keepAspectRatio:h,controlDirection:WZe(d)};let w,k=null,S=[],C,j,E,N=!1;const A=R4t().on("start",_=>{const{nodeLookup:T,transform:R,snapGrid:O,snapToGrid:F,nodeOrigin:D,paneDomNode:I}=n();if(w=T.get(e),!w)return;k=(I==null?void 0:I.getBoundingClientRect())??null;const{xSnapped:P,ySnapped:M}=W$(_.sourceEvent,{transform:R,snapGrid:O,snapToGrid:F,containerBounds:k});b={width:w.measured.width??0,height:w.measured.height??0,x:w.position.x??0,y:w.position.y??0},x={...b,pointerX:P,pointerY:M,aspectRatio:b.width/b.height},C=void 0,j=gE(w.extent)?w.extent:void 0,w.parentId&&(w.extent==="parent"||w.expandParent)&&(C=T.get(w.parentId)),C&&w.extent==="parent"&&(j=[[0,0],[C.measured.width,C.measured.height]]),S=[],E=void 0;for(const[z,G]of T)if(G.parentId===e&&(S.push({id:z,position:{...G.position},extent:G.extent}),G.extent==="parent"||G.expandParent)){const B=Rls(G,w,G.origin??D);E?E=[[Math.min(B[0][0],E[0][0]),Math.min(B[0][1],E[0][1])],[Math.max(B[1][0],E[1][0]),Math.max(B[1][1],E[1][1])]]:E=B}f==null||f(_,{...b})}).on("drag",_=>{const{transform:T,snapGrid:R,snapToGrid:O,nodeOrigin:F}=n(),D=W$(_.sourceEvent,{transform:T,snapGrid:R,snapToGrid:O,containerBounds:k}),I=[];if(!w)return;const{x:P,y:M,width:z,height:G}=b,B={},H=w.origin??F,{width:W,height:V,x:U,y:ne}=Als(x,o.controlDirection,D,o.boundaries,o.keepAspectRatio,H,j,E),te=W!==z,re=V!==G,fe=U!==P&&te,le=ne!==M&&re;if(!fe&&!le&&!te&&!re)return;if((fe||le||H[0]===1||H[1]===1)&&(B.x=fe?U:b.x,B.y=le?ne:b.y,b.x=B.x,b.y=B.y,S.length>0)){const Q=U-P,ie=ne-M;for(const he of S)he.position={x:he.position.x-Q+H[0]*(W-z),y:he.position.y-ie+H[1]*(V-G)},I.push(he)}if((te||re)&&(B.width=te&&(!o.resizeDirection||o.resizeDirection==="horizontal")?W:b.width,B.height=re&&(!o.resizeDirection||o.resizeDirection==="vertical")?V:b.height,b.width=B.width,b.height=B.height),C&&w.expandParent){const Q=H[0]*(B.width??0);B.x&&B.x<Q&&(b.x=Q,x.x=x.x-(B.x-Q));const ie=H[1]*(B.height??0);B.y&&B.y<ie&&(b.y=ie,x.y=x.y-(B.y-ie))}const q=_ls({width:b.width,prevWidth:z,height:b.height,prevHeight:G,affectsX:o.controlDirection.affectsX,affectsY:o.controlDirection.affectsY}),Y={...b,direction:q};(v==null?void 0:v(_,Y))!==!1&&(N=!0,p==null||p(_,Y),r(B,I))}).on("end",_=>{N&&(g==null||g(_,{...b}),s==null||s({...b}),N=!1)});i.call(A)}function c(){i.on(".drag",null)}return{update:l,destroy:c}}var vDt={exports:{}},yDt={};/**
 * @license React
 * use-sync-external-store-shim/with-selector.production.js
 *
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */var dae=y,Mls=vdt;function Lls(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Dls=typeof Object.is=="function"?Object.is:Lls,$ls=Mls.useSyncExternalStore,Ols=dae.useRef,Fls=dae.useEffect,Bls=dae.useMemo,Uls=dae.useDebugValue;yDt.useSyncExternalStoreWithSelector=function(t,e,n,r,s){var i=Ols(null);if(i.current===null){var o={hasValue:!1,value:null};i.current=o}else o=i.current;i=Bls(function(){function c(f){if(!d){if(d=!0,u=f,f=r(f),s!==void 0&&o.hasValue){var p=o.value;if(s(p,f))return h=p}return h=f}if(p=h,Dls(u,f))return p;var g=r(f);return s!==void 0&&s(p,g)?(u=f,p):(u=f,h=g)}var d=!1,u,h,m=n===void 0?null:n;return[function(){return c(e())},m===null?void 0:function(){return c(m())}]},[e,n,r,s]);var l=$ls(t,i[0],i[1]);return Fls(function(){o.hasValue=!0,o.value=l},[l]),Uls(l),l};vDt.exports=yDt;var zls=vDt.exports;const Vls=Fs(zls),Hls={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_API_BASE_URL:"https://api.pensil.so/api/v2",VITE_APPLE_IAP_ENABLED:"true",VITE_APP_ENV:"production",VITE_COMMUNITY_PUBLIC_DOMAIN:"spatial.community",VITE_COMMUNITY_URL_TEMPLATE:"https://{subdomain}.spatial.community",VITE_FIREBASE_API_KEY:"AIzaSyC6izmHjXbXaYKnA0Jv72bB1mmhTT3Wc_s",VITE_FIREBASE_APP_ID:"1:347515749020:web:1abc51839b60c85e53e359",VITE_FIREBASE_MESSAGING_SENDER_ID:"347515749020",VITE_FIREBASE_PROJECT_ID:"pensil-may-2025",VITE_FIREBASE_VAPID_KEY:"BEF5vFNAnltm-DKs7OhbzWvvBoo8E3Dp5IzxrRQUyaY2I2TonAo5xipzRJGWUWCywJj5NLvHP0BykNCfWh7hlvY",VITE_GOOGLE_CLIENT_ID:"347515749020-pln6u6c46bpb4obubq0frmgd6qp0scm2.apps.googleusercontent.com",VITE_HELPSCOUT_BEACON_ID:"",VITE_KLIPY_API_KEY:"",VITE_MIXPANEL_TOKEN:"",VITE_RECAPTCHA_SITE_KEY:"6LcyIqAsAAAAAK5fADf37D77KHTKokoJ57GExr9G",VITE_SIDEBAR_DESKTOP_FONT_SIZE:"13"},KZe=t=>{let e;const n=new Set,r=(u,h)=>{const m=typeof u=="function"?u(e):u;if(!Object.is(m,e)){const f=e;e=h??(typeof m!="object"||m===null)?m:Object.assign({},e,m),n.forEach(p=>p(e,f))}},s=()=>e,c={setState:r,getState:s,getInitialState:()=>d,subscribe:u=>(n.add(u),()=>n.delete(u)),destroy:()=>{(Hls?"production":void 0)!=="production"&&console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),n.clear()}},d=e=t(r,s,c);return c},Gls=t=>t?KZe(t):KZe,{useDebugValue:Wls}=se,{useSyncExternalStoreWithSelector:qls}=Vls,Kls=t=>t;function bDt(t,e=Kls,n){const r=qls(t.subscribe,t.getState,t.getServerState||t.getInitialState,e,n);return Wls(r),r}const YZe=(t,e)=>{const n=Gls(t),r=(s,i=e)=>bDt(n,s,i);return Object.assign(r,n),r},Yls=(t,e)=>t?YZe(t,e):YZe;function ko(t,e){if(Object.is(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;if(t instanceof Map&&e instanceof Map){if(t.size!==e.size)return!1;for(const[r,s]of t)if(!Object.is(s,e.get(r)))return!1;return!0}if(t instanceof Set&&e instanceof Set){if(t.size!==e.size)return!1;for(const r of t)if(!e.has(r))return!1;return!0}const n=Object.keys(t);if(n.length!==Object.keys(e).length)return!1;for(const r of n)if(!Object.prototype.hasOwnProperty.call(e,r)||!Object.is(t[r],e[r]))return!1;return!0}const uae=y.createContext(null),Qls=uae.Provider,xDt=zg.error001("react");function si(t,e){const n=y.useContext(uae);if(n===null)throw new Error(xDt);return bDt(n,t,e)}function To(){const t=y.useContext(uae);if(t===null)throw new Error(xDt);return y.useMemo(()=>({getState:t.getState,setState:t.setState,subscribe:t.subscribe}),[t])}const QZe={display:"none"},Zls={position:"absolute",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0px, 0px, 0px, 0px)",clipPath:"inset(100%)"},wDt="react-flow__node-desc",kDt="react-flow__edge-desc",Jls="react-flow__aria-live",Xls=t=>t.ariaLiveMessage,ecs=t=>t.ariaLabelConfig;function tcs({rfId:t}){const e=si(Xls);return a.jsx("div",{id:`${Jls}-${t}`,"aria-live":"assertive","aria-atomic":"true",style:Zls,children:e})}function ncs({rfId:t,disableKeyboardA11y:e}){const n=si(ecs);return a.jsxs(a.Fragment,{children:[a.jsx("div",{id:`${wDt}-${t}`,style:QZe,children:e?n["node.a11yDescription.default"]:n["node.a11yDescription.keyboardDisabled"]}),a.jsx("div",{id:`${kDt}-${t}`,style:QZe,children:n["edge.a11yDescription.default"]}),!e&&a.jsx(tcs,{rfId:t})]})}const hae=y.forwardRef(({position:t="top-left",children:e,className:n,style:r,...s},i)=>{const o=`${t}`.split("-");return a.jsx("div",{className:nc(["react-flow__panel",n,...o]),style:r,ref:i,...s,children:e})});hae.displayName="Panel";const ZZe="https://reactflow.dev?utm_source=attribution";function rcs({proOptions:t,position:e="bottom-right"}){return t!=null&&t.hideAttribution?null:a.jsx(hae,{position:e,className:"react-flow__attribution","data-message":`Please only hide this attribution when you are subscribed to React Flow Pro: ${ZZe}`,children:a.jsx("a",{href:ZZe,target:"_blank",rel:"noopener noreferrer","aria-label":"React Flow attribution",children:"React Flow"})})}const scs=t=>{const e=[],n=[];for(const[,r]of t.nodeLookup)r.selected&&e.push(r.internals.userNode);for(const[,r]of t.edgeLookup)r.selected&&n.push(r);return{selectedNodes:e,selectedEdges:n}},_H=t=>t.id;function ics(t,e){return ko(t.selectedNodes.map(_H),e.selectedNodes.map(_H))&&ko(t.selectedEdges.map(_H),e.selectedEdges.map(_H))}function acs({onSelectionChange:t}){const e=To(),{selectedNodes:n,selectedEdges:r}=si(scs,ics);return y.useEffect(()=>{const s={nodes:n,edges:r};t==null||t(s),e.getState().onSelectionChangeHandlers.forEach(i=>i(s))},[n,r,t]),null}const ocs=t=>!!t.onSelectionChangeHandlers;function lcs({onSelectionChange:t}){const e=si(ocs);return t||e?a.jsx(acs,{onSelectionChange:t}):null}const SDt=[0,0],ccs={x:0,y:0,zoom:1},dcs=["nodes","edges","defaultNodes","defaultEdges","onConnect","onConnectStart","onConnectEnd","onClickConnectStart","onClickConnectEnd","nodesDraggable","autoPanOnNodeFocus","nodesConnectable","nodesFocusable","edgesFocusable","edgesReconnectable","elevateNodesOnSelect","elevateEdgesOnSelect","minZoom","maxZoom","nodeExtent","onNodesChange","onEdgesChange","elementsSelectable","connectionMode","snapGrid","snapToGrid","translateExtent","connectOnClick","defaultEdgeOptions","fitView","fitViewOptions","onNodesDelete","onEdgesDelete","onDelete","onNodeDrag","onNodeDragStart","onNodeDragStop","onSelectionDrag","onSelectionDragStart","onSelectionDragStop","onMoveStart","onMove","onMoveEnd","noPanClassName","nodeOrigin","autoPanOnConnect","autoPanOnNodeDrag","onError","connectionRadius","isValidConnection","selectNodesOnDrag","nodeDragThreshold","connectionDragThreshold","onBeforeDelete","debug","autoPanSpeed","ariaLabelConfig","zIndexMode"],JZe=[...dcs,"rfId"],ucs=t=>({setNodes:t.setNodes,setEdges:t.setEdges,setMinZoom:t.setMinZoom,setMaxZoom:t.setMaxZoom,setTranslateExtent:t.setTranslateExtent,setNodeExtent:t.setNodeExtent,reset:t.reset,setDefaultNodesAndEdges:t.setDefaultNodesAndEdges}),XZe={translateExtent:h8,nodeOrigin:SDt,minZoom:.5,maxZoom:2,elementsSelectable:!0,noPanClassName:"nopan",rfId:"1"};function hcs(t){const{setNodes:e,setEdges:n,setMinZoom:r,setMaxZoom:s,setTranslateExtent:i,setNodeExtent:o,reset:l,setDefaultNodesAndEdges:c}=si(ucs,ko),d=To();y.useEffect(()=>(c(t.defaultNodes,t.defaultEdges),()=>{u.current=XZe,l()}),[]);const u=y.useRef(XZe);return y.useEffect(()=>{for(const h of JZe){const m=t[h],f=u.current[h];m!==f&&(typeof t[h]>"u"||(h==="nodes"?e(m):h==="edges"?n(m):h==="minZoom"?r(m):h==="maxZoom"?s(m):h==="translateExtent"?i(m):h==="nodeExtent"?o(m):h==="ariaLabelConfig"?d.setState({ariaLabelConfig:Wos(m)}):h==="fitView"?d.setState({fitViewQueued:m}):h==="fitViewOptions"?d.setState({fitViewOptions:m}):d.setState({[h]:m})))}u.current=t},JZe.map(h=>t[h])),null}function eJe(){return typeof window>"u"||!window.matchMedia?null:window.matchMedia("(prefers-color-scheme: dark)")}function mcs(t){var r;const[e,n]=y.useState(t==="system"?null:t);return y.useEffect(()=>{if(t!=="system"){n(t);return}const s=eJe(),i=()=>n(s!=null&&s.matches?"dark":"light");return i(),s==null||s.addEventListener("change",i),()=>{s==null||s.removeEventListener("change",i)}},[t]),e!==null?e:(r=eJe())!=null&&r.matches?"dark":"light"}const tJe=typeof document<"u"?document:null;function g8(t=null,e={target:tJe,actInsideInputWithModifier:!0}){const[n,r]=y.useState(!1),s=y.useRef(!1),i=y.useRef(new Set([])),[o,l]=y.useMemo(()=>{if(t!==null){const d=(Array.isArray(t)?t:[t]).filter(h=>typeof h=="string").map(h=>h.replace("+",`
`).replace(`

`,`
+`).split(`
`)),u=d.reduce((h,m)=>h.concat(...m),[]);return[d,u]}return[[],[]]},[t]);return y.useEffect(()=>{const c=(e==null?void 0:e.target)??tJe,d=(e==null?void 0:e.actInsideInputWithModifier)??!0;if(t!==null){const u=f=>{var v,b;if(s.current=f.ctrlKey||f.metaKey||f.shiftKey||f.altKey,(!s.current||s.current&&!d)&&tDt(f))return!1;const g=rJe(f.code,l);if(i.current.add(f[g]),nJe(o,i.current,!1)){const x=((b=(v=f.composedPath)==null?void 0:v.call(f))==null?void 0:b[0])||f.target,w=(x==null?void 0:x.nodeName)==="BUTTON"||(x==null?void 0:x.nodeName)==="A";e.preventDefault!==!1&&(s.current||!w)&&f.preventDefault(),r(!0)}},h=f=>{const p=rJe(f.code,l);nJe(o,i.current,!0)?(r(!1),i.current.clear()):i.current.delete(f[p]),f.key==="Meta"&&i.current.clear(),s.current=!1},m=()=>{i.current.clear(),r(!1)};return c==null||c.addEventListener("keydown",u),c==null||c.addEventListener("keyup",h),window.addEventListener("blur",m),window.addEventListener("contextmenu",m),()=>{c==null||c.removeEventListener("keydown",u),c==null||c.removeEventListener("keyup",h),window.removeEventListener("blur",m),window.removeEventListener("contextmenu",m)}}},[t,r]),n}function nJe(t,e,n){return t.filter(r=>n||r.length===e.size).some(r=>r.every(s=>e.has(s)))}function rJe(t,e){return e.includes(t)?"code":"key"}const fcs=()=>{const t=To();return y.useMemo(()=>({zoomIn:async e=>{const{panZoom:n}=t.getState();return n?n.scaleBy(1.2,e):!1},zoomOut:async e=>{const{panZoom:n}=t.getState();return n?n.scaleBy(1/1.2,e):!1},zoomTo:async(e,n)=>{const{panZoom:r}=t.getState();return r?r.scaleTo(e,n):!1},getZoom:()=>t.getState().transform[2],setViewport:async(e,n)=>{const{transform:[r,s,i],panZoom:o}=t.getState();return o?(await o.setViewport({x:e.x??r,y:e.y??s,zoom:e.zoom??i},n),!0):!1},getViewport:()=>{const[e,n,r]=t.getState().transform;return{x:e,y:n,zoom:r}},setCenter:async(e,n,r)=>t.getState().setCenter(e,n,r),fitBounds:async(e,n)=>{const{width:r,height:s,minZoom:i,maxZoom:o,panZoom:l}=t.getState(),c=gIe(e,r,s,i,o,(n==null?void 0:n.padding)??.1);return l?(await l.setViewport(c,{duration:n==null?void 0:n.duration,ease:n==null?void 0:n.ease,interpolate:n==null?void 0:n.interpolate}),!0):!1},screenToFlowPosition:(e,n={})=>{const{transform:r,snapGrid:s,snapToGrid:i,domNode:o}=t.getState();if(!o)return e;const{x:l,y:c}=o.getBoundingClientRect(),d={x:e.x-l,y:e.y-c},u=n.snapGrid??s,h=n.snapToGrid??i;return L9(d,r,h,u)},flowToScreenPosition:e=>{const{transform:n,domNode:r}=t.getState();if(!r)return e;const{x:s,y:i}=r.getBoundingClientRect(),o=K5(e,n);return{x:o.x+s,y:o.y+i}}}),[])};function CDt(t,e){const n=[],r=new Map,s=[];for(const i of t)if(i.type==="add"){s.push(i);continue}else if(i.type==="remove"||i.type==="replace")r.set(i.id,[i]);else{const o=r.get(i.id);o?o.push(i):r.set(i.id,[i])}for(const i of e){const o=r.get(i.id);if(!o){n.push(i);continue}if(o[0].type==="remove")continue;if(o[0].type==="replace"){n.push({...o[0].item});continue}const l={...i};for(const c of o)pcs(c,l);n.push(l)}return s.length&&s.forEach(i=>{i.index!==void 0?n.splice(i.index,0,{...i.item}):n.push({...i.item})}),n}function pcs(t,e){switch(t.type){case"select":{e.selected=t.selected;break}case"position":{typeof t.position<"u"&&(e.position=t.position),typeof t.dragging<"u"&&(e.dragging=t.dragging);break}case"dimensions":{typeof t.dimensions<"u"&&(e.measured={...t.dimensions},t.setAttributes&&((t.setAttributes===!0||t.setAttributes==="width")&&(e.width=t.dimensions.width),(t.setAttributes===!0||t.setAttributes==="height")&&(e.height=t.dimensions.height))),typeof t.resizing=="boolean"&&(e.resizing=t.resizing);break}}}function gcs(t,e){return CDt(t,e)}function vcs(t,e){return CDt(t,e)}function WC(t,e){return{id:t,type:"select",selected:e}}function jA(t,e=new Set,n=!1){const r=[];for(const[s,i]of t){const o=e.has(s);!(i.selected===void 0&&!o)&&i.selected!==o&&(n&&(i.selected=o),r.push(WC(i.id,o)))}return r}function sJe({items:t=[],lookup:e}){var s;const n=[],r=new Map(t.map(i=>[i.id,i]));for(const[i,o]of t.entries()){const l=e.get(o.id),c=((s=l==null?void 0:l.internals)==null?void 0:s.userNode)??l;c!==void 0&&c!==o&&n.push({id:o.id,item:o,type:"replace"}),c===void 0&&n.push({item:o,type:"add",index:i})}for(const[i]of e)r.get(i)===void 0&&n.push({id:i,type:"remove"});return n}function iJe(t){return{id:t.id,type:"remove"}}const ycs=Z4t();function bcs(t,e,n={}){return Jos(t,e,{...n,onError:n.onError??ycs})}const aJe=t=>$os(t),xcs=t=>W4t(t);function jDt(t){return y.forwardRef(t)}const wcs=typeof window<"u"?y.useLayoutEffect:y.useEffect;function oJe(t){const[e,n]=y.useState(BigInt(0)),[r]=y.useState(()=>kcs(()=>n(s=>s+BigInt(1))));return wcs(()=>{const s=r.get();s.length&&(t(s),r.reset())},[e]),r}function kcs(t){let e=[];return{get:()=>e,reset:()=>{e=[]},push:n=>{e.push(n),t()}}}const EDt=y.createContext(null);function Scs({children:t}){const e=To(),n=y.useCallback(l=>{const{nodes:c=[],setNodes:d,hasDefaultNodes:u,onNodesChange:h,nodeLookup:m,fitViewQueued:f,onNodesChangeMiddlewareMap:p}=e.getState();let g=c;for(const b of l)g=typeof b=="function"?b(g):b;let v=sJe({items:g,lookup:m});for(const b of p.values())v=b(v);u&&d(g),v.length>0?h==null||h(v):f&&window.requestAnimationFrame(()=>{const{fitViewQueued:b,nodes:x,setNodes:w}=e.getState();b&&w(x)})},[]),r=oJe(n),s=y.useCallback(l=>{const{edges:c=[],setEdges:d,hasDefaultEdges:u,onEdgesChange:h,edgeLookup:m}=e.getState();let f=c;for(const p of l)f=typeof p=="function"?p(f):p;u?d(f):h&&h(sJe({items:f,lookup:m}))},[]),i=oJe(s),o=y.useMemo(()=>({nodeQueue:r,edgeQueue:i}),[]);return a.jsx(EDt.Provider,{value:o,children:t})}function Ccs(){const t=y.useContext(EDt);if(!t)throw new Error("useBatchContext must be used within a BatchProvider");return t}const jcs=t=>!!t.panZoom;function CIe(){const t=fcs(),e=To(),n=Ccs(),r=si(jcs),s=y.useMemo(()=>{const i=h=>e.getState().nodeLookup.get(h),o=h=>{n.nodeQueue.push(h)},l=h=>{n.edgeQueue.push(h)},c=h=>{var b,x;const{nodeLookup:m,nodeOrigin:f}=e.getState(),p=aJe(h)?h:m.get(h.id),g=p.parentId?X4t(p.position,p.measured,p.parentId,m,f):p.position,v={...p,position:g,width:((b=p.measured)==null?void 0:b.width)??p.width,height:((x=p.measured)==null?void 0:x.height)??p.height};return f8(v)},d=(h,m,f={replace:!1})=>{o(p=>p.map(g=>{if(g.id===h){const v=typeof m=="function"?m(g):m;return f.replace&&aJe(v)?v:{...g,...v}}return g}))},u=(h,m,f={replace:!1})=>{l(p=>p.map(g=>{if(g.id===h){const v=typeof m=="function"?m(g):m;return f.replace&&xcs(v)?v:{...g,...v}}return g}))};return{getNodes:()=>e.getState().nodes.map(h=>({...h})),getNode:h=>{var m;return(m=i(h))==null?void 0:m.internals.userNode},getInternalNode:i,getEdges:()=>{const{edges:h=[]}=e.getState();return h.map(m=>({...m}))},getEdge:h=>e.getState().edgeLookup.get(h),setNodes:o,setEdges:l,addNodes:h=>{const m=Array.isArray(h)?h:[h];n.nodeQueue.push(f=>[...f,...m])},addEdges:h=>{const m=Array.isArray(h)?h:[h];n.edgeQueue.push(f=>[...f,...m])},toObject:()=>{const{nodes:h=[],edges:m=[],transform:f}=e.getState(),[p,g,v]=f;return{nodes:h.map(b=>({...b})),edges:m.map(b=>({...b})),viewport:{x:p,y:g,zoom:v}}},deleteElements:async({nodes:h=[],edges:m=[]})=>{const{nodes:f,edges:p,onNodesDelete:g,onEdgesDelete:v,triggerNodeChanges:b,triggerEdgeChanges:x,onDelete:w,onBeforeDelete:k}=e.getState(),{nodes:S,edges:C}=await zos({nodesToRemove:h,edgesToRemove:m,nodes:f,edges:p,onBeforeDelete:k}),j=C.length>0,E=S.length>0;if(j){const N=C.map(iJe);v==null||v(C),x(N)}if(E){const N=S.map(iJe);g==null||g(S),b(N)}return(E||j)&&(w==null||w({nodes:S,edges:C})),{deletedNodes:S,deletedEdges:C}},getIntersectingNodes:(h,m=!0,f)=>{const p=LZe(h),g=p?h:c(h),v=f!==void 0;return g?(f||e.getState().nodes).filter(b=>{const x=e.getState().nodeLookup.get(b.id);if(x&&!p&&(b.id===h.id||!x.internals.positionAbsolute))return!1;const w=f8(v?b:x),k=AX(w,g);return m&&k>0||k>=w.width*w.height||k>=g.width*g.height}):[]},isNodeIntersecting:(h,m,f=!0)=>{const g=LZe(h)?h:c(h);if(!g)return!1;const v=AX(g,m);return f&&v>0||v>=m.width*m.height||v>=g.width*g.height},updateNode:d,updateNodeData:(h,m,f={replace:!1})=>{d(h,p=>{const g=typeof m=="function"?m(p):m;return f.replace?{...p,data:g}:{...p,data:{...p.data,...g}}},f)},updateEdge:u,updateEdgeData:(h,m,f={replace:!1})=>{u(h,p=>{const g=typeof m=="function"?m(p):m;return f.replace?{...p,data:g}:{...p,data:{...p.data,...g}}},f)},getNodesBounds:h=>{const{nodeLookup:m,nodeOrigin:f}=e.getState();return Oos(h,{nodeLookup:m,nodeOrigin:f})},getHandleConnections:({type:h,id:m,nodeId:f})=>{var p;return Array.from(((p=e.getState().connectionLookup.get(`${f}-${h}${m?`-${m}`:""}`))==null?void 0:p.values())??[])},getNodeConnections:({type:h,handleId:m,nodeId:f})=>{var p;return Array.from(((p=e.getState().connectionLookup.get(`${f}${h?m?`-${h}-${m}`:`-${h}`:""}`))==null?void 0:p.values())??[])},fitView:async h=>{const m=e.getState().fitViewResolver??Gos();return e.setState({fitViewQueued:!0,fitViewOptions:h,fitViewResolver:m}),n.nodeQueue.push(f=>[...f]),m.promise}}},[]);return y.useMemo(()=>({...s,...t,viewportInitialized:r}),[r])}const lJe=t=>t.selected,Ecs=typeof window<"u"?window:void 0;function Ncs({deleteKeyCode:t,multiSelectionKeyCode:e}){const n=To(),{deleteElements:r}=CIe(),s=g8(t,{actInsideInputWithModifier:!1}),i=g8(e,{target:Ecs});y.useEffect(()=>{if(s){const{edges:o,nodes:l}=n.getState();r({nodes:l.filter(lJe),edges:o.filter(lJe)}),n.setState({nodesSelectionActive:!1})}},[s]),y.useEffect(()=>{n.setState({multiSelectionActive:i})},[i])}function Tcs(t){const e=To();y.useEffect(()=>{const n=()=>{var s,i,o,l;if(!t.current||!(((i=(s=t.current).checkVisibility)==null?void 0:i.call(s))??!0))return!1;const r=vIe(t.current);(r.height===0||r.width===0)&&((l=(o=e.getState()).onError)==null||l.call(o,"004",zg.error004())),e.setState({width:r.width||500,height:r.height||500})};if(t.current){n(),window.addEventListener("resize",n);const r=new ResizeObserver(()=>n());return r.observe(t.current),()=>{window.removeEventListener("resize",n),r&&t.current&&r.unobserve(t.current)}}},[])}const mae={position:"absolute",width:"100%",height:"100%",top:0,left:0},_cs=t=>({userSelectionActive:t.userSelectionActive,lib:t.lib,connectionInProgress:t.connection.inProgress});function Acs({onPaneContextMenu:t,zoomOnScroll:e=!0,zoomOnPinch:n=!0,panOnScroll:r=!1,panOnScrollSpeed:s=.5,panOnScrollMode:i=u2.Free,zoomOnDoubleClick:o=!0,panOnDrag:l=!0,defaultViewport:c,translateExtent:d,minZoom:u,maxZoom:h,zoomActivationKeyCode:m,preventScrolling:f=!0,children:p,noWheelClassName:g,noPanClassName:v,onViewportChange:b,isControlledViewport:x,paneClickDistance:w,selectionOnDrag:k}){const S=To(),C=y.useRef(null),{userSelectionActive:j,lib:E,connectionInProgress:N}=si(_cs,ko),A=g8(m),_=y.useRef();Tcs(C);const T=y.useCallback(R=>{b==null||b({x:R[0],y:R[1],zoom:R[2]}),x||S.setState({transform:R})},[b,x]);return y.useEffect(()=>{if(C.current){_.current=Tls({domNode:C.current,minZoom:u,maxZoom:h,translateExtent:d,viewport:c,onDraggingChange:D=>S.setState(I=>I.paneDragging===D?I:{paneDragging:D}),onPanZoomStart:(D,I)=>{const{onViewportChangeStart:P,onMoveStart:M}=S.getState();M==null||M(D,I),P==null||P(I)},onPanZoom:(D,I)=>{const{onViewportChange:P,onMove:M}=S.getState();M==null||M(D,I),P==null||P(I)},onPanZoomEnd:(D,I)=>{const{onViewportChangeEnd:P,onMoveEnd:M}=S.getState();M==null||M(D,I),P==null||P(I)}});const{x:R,y:O,zoom:F}=_.current.getViewport();return S.setState({panZoom:_.current,transform:[R,O,F],domNode:C.current.closest(".react-flow")}),()=>{var D;(D=_.current)==null||D.destroy()}}},[]),y.useEffect(()=>{var R;(R=_.current)==null||R.update({onPaneContextMenu:t,zoomOnScroll:e,zoomOnPinch:n,panOnScroll:r,panOnScrollSpeed:s,panOnScrollMode:i,zoomOnDoubleClick:o,panOnDrag:l,zoomActivationKeyPressed:A,preventScrolling:f,noPanClassName:v,userSelectionActive:j,noWheelClassName:g,lib:E,onTransformChange:T,connectionInProgress:N,selectionOnDrag:k,paneClickDistance:w})},[t,e,n,r,s,i,o,l,A,f,v,j,g,E,T,N,k,w]),a.jsx("div",{className:"react-flow__renderer",ref:C,style:mae,children:p})}const Pcs=t=>({userSelectionActive:t.userSelectionActive,userSelectionRect:t.userSelectionRect});function Rcs(){const{userSelectionActive:t,userSelectionRect:e}=si(Pcs,ko);return t&&e?a.jsx("div",{className:"react-flow__selection react-flow__container",style:{width:e.width,height:e.height,transform:`translate(${e.x}px, ${e.y}px)`}}):null}const khe=(t,e)=>n=>{n.target===e.current&&(t==null||t(n))},Ics=t=>({userSelectionActive:t.userSelectionActive,elementsSelectable:t.elementsSelectable,dragging:t.paneDragging,panBy:t.panBy,autoPanSpeed:t.autoPanSpeed});function Mcs({isSelecting:t,selectionKeyPressed:e,selectionMode:n=m8.Full,panOnDrag:r,autoPanOnSelection:s,paneClickDistance:i,selectionOnDrag:o,onSelectionStart:l,onSelectionEnd:c,onPaneClick:d,onPaneContextMenu:u,onPaneScroll:h,onPaneMouseEnter:m,onPaneMouseMove:f,onPaneMouseLeave:p,children:g}){const v=y.useRef(0),b=To(),{userSelectionActive:x,elementsSelectable:w,dragging:k,panBy:S,autoPanSpeed:C}=si(Ics,ko),j=w&&(t||x),E=y.useRef(null),N=y.useRef(),A=y.useRef(new Set),_=y.useRef(new Set),T=y.useRef(!1),R=y.useRef(!1),O=y.useRef({x:0,y:0}),F=y.useRef(!1),D=te=>{if(R.current||T.current||b.getState().connection.inProgress){R.current=!1,T.current=!1;return}d==null||d(te),b.getState().resetSelectedElements(),b.setState({nodesSelectionActive:!1})},I=te=>{if(Array.isArray(r)&&(r!=null&&r.includes(2))){te.preventDefault();return}u==null||u(te)},P=h?te=>h(te):void 0,M=te=>{R.current&&(te.stopPropagation(),R.current=!1)},z=te=>{var he,ye;const{domNode:re,transform:fe}=b.getState();if(N.current=re==null?void 0:re.getBoundingClientRect(),!N.current)return;const le=te.target===E.current;if(!le&&!!te.target.closest(".nokey")||!t||!(o&&le||e)||te.button!==0||!te.isPrimary)return;(ye=(he=te.target)==null?void 0:he.setPointerCapture)==null||ye.call(he,te.pointerId),R.current=!1;const{x:X,y:Q}=yg(te.nativeEvent,N.current),ie=L9({x:X,y:Q},fe);b.setState({userSelectionRect:{width:0,height:0,startX:ie.x,startY:ie.y,x:X,y:Q}}),le||(te.stopPropagation(),te.preventDefault())};function G(te,re){const{userSelectionRect:fe}=b.getState();if(!fe)return;const{transform:le,nodeLookup:q,edgeLookup:Y,connectionLookup:X,triggerNodeChanges:Q,triggerEdgeChanges:ie,defaultEdgeOptions:he}=b.getState(),ye={x:fe.startX,y:fe.startY},{x:J,y:K}=K5(ye,le),ce={startX:ye.x,startY:ye.y,x:te<J?te:J,y:re<K?re:K,width:Math.abs(te-J),height:Math.abs(re-K)},pe=A.current,Ie=_.current;A.current=new Set(fIe(q,ce,le,n===m8.Partial,!0).map(we=>we.id)),_.current=new Set;const Me=(he==null?void 0:he.selectable)??!0;for(const we of A.current){const Be=X.get(we);if(Be)for(const{edgeId:Ve}of Be.values()){const be=Y.get(Ve);be&&(be.selectable??Me)&&_.current.add(Ve)}}if(!DZe(pe,A.current)){const we=jA(q,A.current,!0);Q(we)}if(!DZe(Ie,_.current)){const we=jA(Y,_.current);ie(we)}b.setState({userSelectionRect:ce,userSelectionActive:!0,nodesSelectionActive:!1})}function B(){if(!s||!N.current)return;const[te,re]=pIe(O.current,N.current,C);S({x:te,y:re}).then(fe=>{if(!R.current||!fe){v.current=requestAnimationFrame(B);return}const{x:le,y:q}=O.current;G(le,q),v.current=requestAnimationFrame(B)})}const H=()=>{cancelAnimationFrame(v.current),v.current=0,F.current=!1};y.useEffect(()=>()=>H(),[]);const W=te=>{const{userSelectionRect:re,transform:fe,resetSelectedElements:le}=b.getState();if(!N.current||!re)return;const{x:q,y:Y}=yg(te.nativeEvent,N.current);O.current={x:q,y:Y};const X=K5({x:re.startX,y:re.startY},fe);if(!R.current){const Q=e?0:i;if(Math.hypot(q-X.x,Y-X.y)<=Q)return;le(),l==null||l(te)}R.current=!0,F.current||(B(),F.current=!0),G(q,Y)},V=te=>{var re,fe;if(!j){te.target===E.current&&b.getState().connection.inProgress&&(T.current=!0);return}te.button===0&&((fe=(re=te.target)==null?void 0:re.releasePointerCapture)==null||fe.call(re,te.pointerId),!x&&te.target===E.current&&b.getState().userSelectionRect&&(D==null||D(te)),b.setState({userSelectionActive:!1,userSelectionRect:null}),R.current&&(c==null||c(te),b.setState({nodesSelectionActive:A.current.size>0})),H())},U=te=>{var re,fe;(fe=(re=te.target)==null?void 0:re.releasePointerCapture)==null||fe.call(re,te.pointerId),H()},ne=r===!0||Array.isArray(r)&&r.includes(0);return a.jsxs("div",{className:nc(["react-flow__pane",{draggable:ne,dragging:k,selection:t}]),onClick:j?void 0:khe(D,E),onContextMenu:khe(I,E),onWheel:khe(P,E),onPointerEnter:j?void 0:m,onPointerMove:j?W:f,onPointerUp:V,onPointerCancel:j?U:void 0,onPointerDownCapture:j?z:void 0,onClickCapture:j?M:void 0,onPointerLeave:p,ref:E,style:mae,children:[g,a.jsx(Rcs,{})]})}function Y1e({id:t,store:e,unselect:n=!1,nodeRef:r}){const{addSelectedNodes:s,unselectNodesAndEdges:i,multiSelectionActive:o,nodeLookup:l,onError:c}=e.getState(),d=l.get(t);if(!d){c==null||c("012",zg.error012(t));return}e.setState({nodesSelectionActive:!1}),d.selected?(n||d.selected&&o)&&(i({nodes:[d],edges:[]}),requestAnimationFrame(()=>{var u;return(u=r==null?void 0:r.current)==null?void 0:u.blur()})):s([t])}function NDt({nodeRef:t,disabled:e=!1,noDragClassName:n,handleSelector:r,nodeId:s,isSelectable:i,nodeClickDistance:o}){const l=To(),[c,d]=y.useState(!1),u=y.useRef();return y.useEffect(()=>{u.current=fls({getStoreItems:()=>l.getState(),onNodeMouseDown:h=>{Y1e({id:h,store:l,nodeRef:t})},onDragStart:()=>{d(!0)},onDragStop:()=>{d(!1)}})},[]),y.useEffect(()=>{if(!(e||!t.current||!u.current))return u.current.update({noDragClassName:n,handleSelector:r,domNode:t.current,isSelectable:i,nodeId:s,nodeClickDistance:o}),()=>{var h;(h=u.current)==null||h.destroy()}},[n,r,e,i,t,s,o]),c}const Lcs=t=>e=>e.selected&&(e.draggable||t&&typeof e.draggable>"u");function TDt(){const t=To();return y.useCallback(n=>{const{nodeExtent:r,snapToGrid:s,snapGrid:i,nodesDraggable:o,onError:l,updateNodePositions:c,nodeLookup:d,nodeOrigin:u}=t.getState(),h=new Map,m=Lcs(o),f=s?i[0]:5,p=s?i[1]:5,g=n.direction.x*f*n.factor,v=n.direction.y*p*n.factor;for(const[,b]of d){if(!m(b))continue;let x={x:b.internals.positionAbsolute.x+g,y:b.internals.positionAbsolute.y+v};s&&(x=M9(x,i));const{position:w,positionAbsolute:k}=q4t({nodeId:b.id,nextPosition:x,nodeLookup:d,nodeExtent:r,nodeOrigin:u,onError:l});b.position=w,b.internals.positionAbsolute=k,h.set(b.id,b)}c(h)},[])}const jIe=y.createContext(null),Dcs=jIe.Provider;jIe.Consumer;const _Dt=()=>y.useContext(jIe),$cs=t=>({connectOnClick:t.connectOnClick,noPanClassName:t.noPanClassName,rfId:t.rfId}),ADt=y.createContext(null);function Ocs({children:t}){const e=si($cs,ko);return a.jsx(ADt.Provider,{value:e,children:t})}function Fcs(){const t=y.useContext(ADt);if(!t)throw new Error("useHandleConfig must be used within a HandleConfigProvider");return t}const Bcs={connectingFrom:!1,connectingTo:!1,clickConnecting:!1,isPossibleEndHandle:!0,connectionInProcess:!1,clickConnectionInProcess:!1,valid:!1},Ucs=(t,e,n)=>r=>{const{connectionClickStartHandle:s,connectionMode:i,connection:o}=r,{fromHandle:l,toHandle:c,isValid:d}=o;if(!l&&!s)return Bcs;const u=(c==null?void 0:c.nodeId)===t&&(c==null?void 0:c.id)===e&&(c==null?void 0:c.type)===n;return{connectingFrom:(l==null?void 0:l.nodeId)===t&&(l==null?void 0:l.id)===e&&(l==null?void 0:l.type)===n,connectingTo:u,clickConnecting:(s==null?void 0:s.nodeId)===t&&(s==null?void 0:s.id)===e&&(s==null?void 0:s.type)===n,isPossibleEndHandle:i===W5.Strict?(l==null?void 0:l.type)!==n:t!==(l==null?void 0:l.nodeId)||e!==(l==null?void 0:l.id),connectionInProcess:!!l,clickConnectionInProcess:!!s,valid:u&&d}};function zcs({type:t="source",position:e=kr.Top,isValidConnection:n,isConnectable:r=!0,isConnectableStart:s=!0,isConnectableEnd:i=!0,id:o,onConnect:l,children:c,className:d,onMouseDown:u,onTouchStart:h,...m},f){var F,D;const p=o||null,g=t==="target",v=To(),b=_Dt(),{connectOnClick:x,noPanClassName:w,rfId:k}=Fcs(),{connectingFrom:S,connectingTo:C,clickConnecting:j,isPossibleEndHandle:E,connectionInProcess:N,clickConnectionInProcess:A,valid:_}=si(Ucs(b,p,t),ko);b||(D=(F=v.getState()).onError)==null||D.call(F,"010",zg.error010());const T=I=>{const{defaultEdgeOptions:P,onConnect:M,hasDefaultEdges:z}=v.getState(),G={...P,...I};if(z){const{edges:B,setEdges:H,onError:W}=v.getState();H(bcs(G,B,{onError:W}))}M==null||M(G),l==null||l(G)},R=I=>{if(!b)return;const P=nDt(I.nativeEvent);if(s&&(P&&I.button===0||!P)){const M=v.getState();K1e.onPointerDown(I.nativeEvent,{handleDomNode:I.currentTarget,autoPanOnConnect:M.autoPanOnConnect,connectionMode:M.connectionMode,connectionRadius:M.connectionRadius,domNode:M.domNode,nodeLookup:M.nodeLookup,lib:M.lib,isTarget:g,handleId:p,nodeId:b,flowId:M.rfId,panBy:M.panBy,cancelConnection:M.cancelConnection,onConnectStart:M.onConnectStart,onConnectEnd:(...z)=>{var G,B;return(B=(G=v.getState()).onConnectEnd)==null?void 0:B.call(G,...z)},updateConnection:M.updateConnection,onConnect:T,isValidConnection:n||((...z)=>{var G,B;return((B=(G=v.getState()).isValidConnection)==null?void 0:B.call(G,...z))??!0}),getTransform:()=>v.getState().transform,getFromHandle:()=>v.getState().connection.fromHandle,autoPanSpeed:M.autoPanSpeed,dragThreshold:M.connectionDragThreshold})}P?u==null||u(I):h==null||h(I)},O=I=>{const{onClickConnectStart:P,onClickConnectEnd:M,connectionClickStartHandle:z,connectionMode:G,isValidConnection:B,lib:H,rfId:W,nodeLookup:V,connection:U}=v.getState();if(!b||!z&&!s)return;if(!z){P==null||P(I.nativeEvent,{nodeId:b,handleId:p,handleType:t}),v.setState({connectionClickStartHandle:{nodeId:b,type:t,id:p}});return}const ne=eDt(I.target),te=n||B,{connection:re,isValid:fe}=K1e.isValid(I.nativeEvent,{handle:{nodeId:b,id:p,type:t},connectionMode:G,fromNodeId:z.nodeId,fromHandleId:z.id||null,fromType:z.type,isValidConnection:te,flowId:W,doc:ne,lib:H,nodeLookup:V});fe&&re&&T(re);const le=structuredClone(U);delete le.inProgress,le.toPosition=le.toHandle?le.toHandle.position:null,M==null||M(I,le),v.setState({connectionClickStartHandle:null})};return a.jsx("div",{"data-handleid":p,"data-nodeid":b,"data-handlepos":e,"data-id":`${k}-${b}-${p}-${t}`,className:nc(["react-flow__handle",`react-flow__handle-${e}`,"nodrag",w,d,{source:!g,target:g,connectable:r,connectablestart:s,connectableend:i,clickconnecting:j,connectingfrom:S,connectingto:C,valid:_,connectionindicator:r&&(!N||E)&&(N||A?i:s)}]),onMouseDown:R,onTouchStart:R,onClick:x?O:void 0,ref:f,...m,children:c})}const yE=y.memo(jDt(zcs));function Vcs({data:t,isConnectable:e,sourcePosition:n=kr.Bottom}){return a.jsxs(a.Fragment,{children:[t==null?void 0:t.label,a.jsx(yE,{type:"source",position:n,isConnectable:e})]})}function Hcs({data:t,isConnectable:e,targetPosition:n=kr.Top,sourcePosition:r=kr.Bottom}){return a.jsxs(a.Fragment,{children:[a.jsx(yE,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label,a.jsx(yE,{type:"source",position:r,isConnectable:e})]})}function Gcs(){return null}function Wcs({data:t,isConnectable:e,targetPosition:n=kr.Top}){return a.jsxs(a.Fragment,{children:[a.jsx(yE,{type:"target",position:n,isConnectable:e}),t==null?void 0:t.label]})}const PX={ArrowUp:{x:0,y:-1},ArrowDown:{x:0,y:1},ArrowLeft:{x:-1,y:0},ArrowRight:{x:1,y:0}},cJe={input:Vcs,default:Hcs,output:Wcs,group:Gcs};function qcs(t){var e,n,r,s;return t.internals.handleBounds===void 0?{width:t.width??t.initialWidth??((e=t.style)==null?void 0:e.width),height:t.height??t.initialHeight??((n=t.style)==null?void 0:n.height)}:{width:t.width??((r=t.style)==null?void 0:r.width),height:t.height??((s=t.style)==null?void 0:s.height)}}const Kcs=t=>{const{width:e,height:n,x:r,y:s}=I9(t.nodeLookup,{filter:i=>!!i.selected});return{width:vg(e)?e:null,height:vg(n)?n:null,userSelectionActive:t.userSelectionActive,transformString:`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]}) translate(${r}px,${s}px)`}};function Ycs({onSelectionContextMenu:t,noPanClassName:e,disableKeyboardA11y:n}){const r=To(),{width:s,height:i,transformString:o,userSelectionActive:l}=si(Kcs,ko),c=TDt(),d=y.useRef(null);y.useEffect(()=>{var f;n||(f=d.current)==null||f.focus({preventScroll:!0})},[n]);const u=!l&&s!==null&&i!==null;if(NDt({nodeRef:d,disabled:!u}),!u)return null;const h=t?f=>{const p=r.getState().nodes.filter(g=>g.selected);t(f,p)}:void 0,m=f=>{Object.prototype.hasOwnProperty.call(PX,f.key)&&(f.preventDefault(),c({direction:PX[f.key],factor:f.shiftKey?4:1}))};return a.jsx("div",{className:nc(["react-flow__nodesselection","react-flow__container",e]),style:{transform:o},children:a.jsx("div",{ref:d,className:"react-flow__nodesselection-rect",onContextMenu:h,tabIndex:n?void 0:-1,onKeyDown:n?void 0:m,style:{width:s,height:i}})})}const dJe=typeof window<"u"?window:void 0,Qcs=t=>({nodesSelectionActive:t.nodesSelectionActive,userSelectionActive:t.userSelectionActive});function PDt({children:t,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,paneClickDistance:l,deleteKeyCode:c,selectionKeyCode:d,selectionOnDrag:u,selectionMode:h,onSelectionStart:m,onSelectionEnd:f,multiSelectionKeyCode:p,panActivationKeyCode:g,zoomActivationKeyCode:v,elementsSelectable:b,zoomOnScroll:x,zoomOnPinch:w,panOnScroll:k,panOnScrollSpeed:S,panOnScrollMode:C,zoomOnDoubleClick:j,panOnDrag:E,autoPanOnSelection:N,defaultViewport:A,translateExtent:_,minZoom:T,maxZoom:R,preventScrolling:O,onSelectionContextMenu:F,noWheelClassName:D,noPanClassName:I,disableKeyboardA11y:P,onViewportChange:M,isControlledViewport:z}){const{nodesSelectionActive:G,userSelectionActive:B}=si(Qcs,ko),H=g8(d,{target:dJe}),W=g8(g,{target:dJe}),V=W||E,U=W||k,ne=u&&V!==!0,te=H||B||ne;return Ncs({deleteKeyCode:c,multiSelectionKeyCode:p}),a.jsx(Acs,{onPaneContextMenu:i,elementsSelectable:b,zoomOnScroll:x,zoomOnPinch:w,panOnScroll:U,panOnScrollSpeed:S,panOnScrollMode:C,zoomOnDoubleClick:j,panOnDrag:!H&&V,defaultViewport:A,translateExtent:_,minZoom:T,maxZoom:R,zoomActivationKeyCode:v,preventScrolling:O,noWheelClassName:D,noPanClassName:I,onViewportChange:M,isControlledViewport:z,paneClickDistance:l,selectionOnDrag:ne,children:a.jsxs(Mcs,{onSelectionStart:m,onSelectionEnd:f,onPaneClick:e,onPaneMouseEnter:n,onPaneMouseMove:r,onPaneMouseLeave:s,onPaneContextMenu:i,onPaneScroll:o,panOnDrag:V,autoPanOnSelection:N,isSelecting:!!te,selectionMode:h,selectionKeyPressed:H,paneClickDistance:l,selectionOnDrag:ne,children:[t,G&&a.jsx(Ycs,{onSelectionContextMenu:F,noPanClassName:I,disableKeyboardA11y:P})]})})}PDt.displayName="FlowRenderer";const Zcs=y.memo(PDt),Jcs=t=>e=>t?fIe(e.nodeLookup,{x:0,y:0,width:e.width,height:e.height},e.transform,!0).map(n=>n.id):Array.from(e.nodeLookup.keys());function Xcs(t){return si(y.useCallback(Jcs(t),[t]),ko)}const eds=t=>t.updateNodeInternals;function tds(){const t=si(eds),[e]=y.useState(()=>typeof ResizeObserver>"u"?null:new ResizeObserver(n=>{const r=new Map;n.forEach(s=>{const i=s.target.getAttribute("data-id");r.set(i,{id:i,nodeElement:s.target,force:!0})}),t(r)}));return y.useEffect(()=>()=>{e==null||e.disconnect()},[e]),e}function nds({node:t,nodeType:e,hasDimensions:n,resizeObserver:r}){const s=To(),i=y.useRef(null),o=y.useRef(null),l=y.useRef(t.sourcePosition),c=y.useRef(t.targetPosition),d=y.useRef(e),u=n&&!!t.internals.handleBounds;return y.useEffect(()=>{i.current&&!t.hidden&&(!u||o.current!==i.current)&&(o.current&&(r==null||r.unobserve(o.current)),r==null||r.observe(i.current),o.current=i.current)},[u,t.hidden]),y.useEffect(()=>()=>{o.current&&(r==null||r.unobserve(o.current),o.current=null)},[]),y.useEffect(()=>{if(i.current){const h=d.current!==e,m=l.current!==t.sourcePosition,f=c.current!==t.targetPosition;(h||m||f)&&(d.current=e,l.current=t.sourcePosition,c.current=t.targetPosition,s.getState().updateNodeInternals(new Map([[t.id,{id:t.id,nodeElement:i.current,force:!0}]])))}},[t.id,e,t.sourcePosition,t.targetPosition]),i}function rds({id:t,onClick:e,onMouseEnter:n,onMouseMove:r,onMouseLeave:s,onContextMenu:i,onDoubleClick:o,nodesDraggable:l,elementsSelectable:c,nodesConnectable:d,nodesFocusable:u,resizeObserver:h,noDragClassName:m,noPanClassName:f,disableKeyboardA11y:p,rfId:g,nodeTypes:v,nodeClickDistance:b,onError:x}){const{node:w,internals:k,isParent:S}=si(te=>{const re=te.nodeLookup.get(t),fe=te.parentLookup.has(t);return{node:re,internals:re.internals,isParent:fe}},ko);let C=w.type||"default",j=(v==null?void 0:v[C])||cJe[C];j===void 0&&(x==null||x("003",zg.error003(C)),C="default",j=(v==null?void 0:v.default)||cJe.default);const E=!!(w.draggable||l&&typeof w.draggable>"u"),N=!!(w.selectable||c&&typeof w.selectable>"u"),A=!!(w.connectable||d&&typeof w.connectable>"u"),_=!!(w.focusable||u&&typeof w.focusable>"u"),T=To(),R=J4t(w),O=nds({node:w,nodeType:C,hasDimensions:R,resizeObserver:h}),F=NDt({nodeRef:O,disabled:w.hidden||!E,noDragClassName:m,handleSelector:w.dragHandle,nodeId:t,isSelectable:N,nodeClickDistance:b}),D=TDt();if(w.hidden)return null;const I=W0(w),P=qcs(w),M=N||E||e||n||r||s,z=n?te=>n(te,{...k.userNode}):void 0,G=r?te=>r(te,{...k.userNode}):void 0,B=s?te=>s(te,{...k.userNode}):void 0,H=i?te=>i(te,{...k.userNode}):void 0,W=o?te=>o(te,{...k.userNode}):void 0,V=te=>{const{selectNodesOnDrag:re,nodeDragThreshold:fe}=T.getState();N&&(!re||!E||fe>0)&&Y1e({id:t,store:T,nodeRef:O}),e&&e(te,{...k.userNode})},U=te=>{if(!(tDt(te.nativeEvent)||p)){if(z4t.includes(te.key)&&N){const re=te.key==="Escape";Y1e({id:t,store:T,unselect:re,nodeRef:O})}else if(E&&w.selected&&Object.prototype.hasOwnProperty.call(PX,te.key)){te.preventDefault();const{ariaLabelConfig:re}=T.getState();T.setState({ariaLiveMessage:re["node.a11yDescription.ariaLiveMessage"]({direction:te.key.replace("Arrow","").toLowerCase(),x:~~k.positionAbsolute.x,y:~~k.positionAbsolute.y})}),D({direction:PX[te.key],factor:te.shiftKey?4:1})}}},ne=()=>{var X;if(p||!((X=O.current)!=null&&X.matches(":focus-visible")))return;const{transform:te,width:re,height:fe,autoPanOnNodeFocus:le,setCenter:q}=T.getState();if(!le)return;fIe(new Map([[t,w]]),{x:0,y:0,width:re,height:fe},te,!0).length>0||q(w.position.x+I.width/2,w.position.y+I.height/2,{zoom:te[2]})};return a.jsx("div",{className:nc(["react-flow__node",`react-flow__node-${C}`,{[f]:E},w.className,{selected:w.selected,selectable:N,parent:S,draggable:E,dragging:F}]),ref:O,style:{zIndex:k.z,transform:`translate(${k.positionAbsolute.x}px,${k.positionAbsolute.y}px)`,pointerEvents:M?"all":"none",visibility:R?"visible":"hidden",...w.style,...P},"data-id":t,"data-testid":`rf__node-${t}`,onMouseEnter:z,onMouseMove:G,onMouseLeave:B,onContextMenu:H,onClick:V,onDoubleClick:W,onKeyDown:_?U:void 0,tabIndex:_?0:void 0,onFocus:_?ne:void 0,role:w.ariaRole??(_?"group":void 0),"aria-roledescription":"node","aria-describedby":p?void 0:`${wDt}-${g}`,"aria-label":w.ariaLabel,...w.domAttributes,children:a.jsx(Dcs,{value:t,children:a.jsx(j,{id:t,data:w.data,type:C,positionAbsoluteX:k.positionAbsolute.x,positionAbsoluteY:k.positionAbsolute.y,selected:w.selected??!1,selectable:N,draggable:E,deletable:w.deletable??!0,isConnectable:A,sourcePosition:w.sourcePosition,targetPosition:w.targetPosition,dragging:F,dragHandle:w.dragHandle,zIndex:k.z,parentId:w.parentId,...I})})})}var sds=y.memo(rds);const ids=t=>({nodesDraggable:t.nodesDraggable,nodesConnectable:t.nodesConnectable,nodesFocusable:t.nodesFocusable,elementsSelectable:t.elementsSelectable,onError:t.onError});function RDt(t){const{nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,onError:i}=si(ids,ko),o=Xcs(t.onlyRenderVisibleElements),l=tds();return a.jsx("div",{className:"react-flow__nodes",style:mae,children:o.map(c=>a.jsx(sds,{id:c,nodeTypes:t.nodeTypes,nodeExtent:t.nodeExtent,onClick:t.onNodeClick,onMouseEnter:t.onNodeMouseEnter,onMouseMove:t.onNodeMouseMove,onMouseLeave:t.onNodeMouseLeave,onContextMenu:t.onNodeContextMenu,onDoubleClick:t.onNodeDoubleClick,noDragClassName:t.noDragClassName,noPanClassName:t.noPanClassName,rfId:t.rfId,disableKeyboardA11y:t.disableKeyboardA11y,resizeObserver:l,nodesDraggable:e,nodesConnectable:n,nodesFocusable:r,elementsSelectable:s,nodeClickDistance:t.nodeClickDistance,onError:i},c))})}RDt.displayName="NodeRenderer";const ads=y.memo(RDt);function ods(t){return si(y.useCallback(n=>{if(!t)return n.edges.map(s=>s.id);const r=[];if(n.width&&n.height)for(const s of n.edges){const i=n.nodeLookup.get(s.source),o=n.nodeLookup.get(s.target);i&&o&&Yos({sourceNode:i,targetNode:o,width:n.width,height:n.height,transform:n.transform})&&r.push(s.id)}return r},[t]),ko)}const lds=({color:t="none",strokeWidth:e=1})=>{const n={strokeWidth:e,...t&&{stroke:t}};return a.jsx("polyline",{className:"arrow",style:n,strokeLinecap:"round",fill:"none",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4"})},cds=({color:t="none",strokeWidth:e=1})=>{const n={strokeWidth:e,...t&&{stroke:t,fill:t}};return a.jsx("polyline",{className:"arrowclosed",style:n,strokeLinecap:"round",strokeLinejoin:"round",points:"-5,-4 0,0 -5,4 -5,-4"})},uJe={[TX.Arrow]:lds,[TX.ArrowClosed]:cds};function dds(t){const e=To();return y.useMemo(()=>{var s,i;return Object.prototype.hasOwnProperty.call(uJe,t)?uJe[t]:((i=(s=e.getState()).onError)==null||i.call(s,"009",zg.error009(t)),null)},[t])}const uds=({id:t,type:e,color:n,width:r=12.5,height:s=12.5,markerUnits:i="strokeWidth",strokeWidth:o,orient:l="auto-start-reverse"})=>{const c=dds(e);return c?a.jsx("marker",{className:"react-flow__arrowhead",id:t,markerWidth:`${r}`,markerHeight:`${s}`,viewBox:"-10 -10 20 20",markerUnits:i,orient:l,refX:"0",refY:"0",children:a.jsx(c,{color:n,strokeWidth:o})}):null},IDt=({defaultColor:t,rfId:e})=>{const n=si(i=>i.edges),r=si(i=>i.defaultEdgeOptions),s=y.useMemo(()=>rls(n,{id:e,defaultColor:t,defaultMarkerStart:r==null?void 0:r.markerStart,defaultMarkerEnd:r==null?void 0:r.markerEnd}),[n,r,e,t]);return s.length?a.jsx("svg",{className:"react-flow__marker","aria-hidden":"true",children:a.jsx("defs",{children:s.map(i=>a.jsx(uds,{id:i.id,type:i.type,color:i.color,width:i.width,height:i.height,markerUnits:i.markerUnits,strokeWidth:i.strokeWidth,orient:i.orient},i.id))})}):null};IDt.displayName="MarkerDefinitions";var hds=y.memo(IDt);function MDt({x:t,y:e,label:n,labelStyle:r,labelShowBg:s=!0,labelBgStyle:i,labelBgPadding:o=[2,4],labelBgBorderRadius:l=2,children:c,className:d,...u}){const[h,m]=y.useState({x:1,y:0,width:0,height:0}),f=nc(["react-flow__edge-textwrapper",d]),p=y.useRef(null);return y.useEffect(()=>{if(p.current){const g=p.current.getBBox();m({x:g.x,y:g.y,width:g.width,height:g.height})}},[n]),n?a.jsxs("g",{transform:`translate(${t-h.width/2} ${e-h.height/2})`,className:f,visibility:h.width?"visible":"hidden",...u,children:[s&&a.jsx("rect",{width:h.width+2*o[0],x:-o[0],y:-o[1],height:h.height+2*o[1],className:"react-flow__edge-textbg",style:i,rx:l,ry:l}),a.jsx("text",{className:"react-flow__edge-text",y:h.height/2,dy:"0.3em",ref:p,style:r,children:n}),c]}):null}MDt.displayName="EdgeText";const mds=y.memo(MDt);function D9({path:t,labelX:e,labelY:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c,interactionWidth:d=20,...u}){return a.jsxs(a.Fragment,{children:[a.jsx("path",{...u,d:t,fill:"none",className:nc(["react-flow__edge-path",u.className])}),d?a.jsx("path",{d:t,fill:"none",strokeOpacity:0,strokeWidth:d,className:"react-flow__edge-interaction"}):null,r&&vg(e)&&vg(n)?a.jsx(mds,{x:e,y:n,label:r,labelStyle:s,labelShowBg:i,labelBgStyle:o,labelBgPadding:l,labelBgBorderRadius:c}):null]})}function hJe({pos:t,x1:e,y1:n,x2:r,y2:s}){return t===kr.Left||t===kr.Right?[.5*(e+r),n]:[e,.5*(n+s)]}function LDt({sourceX:t,sourceY:e,sourcePosition:n=kr.Bottom,targetX:r,targetY:s,targetPosition:i=kr.Top}){const[o,l]=hJe({pos:n,x1:t,y1:e,x2:r,y2:s}),[c,d]=hJe({pos:i,x1:r,y1:s,x2:t,y2:e}),[u,h,m,f]=rDt({sourceX:t,sourceY:e,targetX:r,targetY:s,sourceControlX:o,sourceControlY:l,targetControlX:c,targetControlY:d});return[`M${t},${e} C${o},${l} ${c},${d} ${r},${s}`,u,h,m,f]}function DDt(t){return y.memo(({id:e,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o,targetPosition:l,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:f,style:p,markerEnd:g,markerStart:v,interactionWidth:b})=>{const[x,w,k]=LDt({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:l}),S=t.isInternal?void 0:e;return a.jsx(D9,{id:S,path:x,labelX:w,labelY:k,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:f,style:p,markerEnd:g,markerStart:v,interactionWidth:b})})}const fds=DDt({isInternal:!1}),$Dt=DDt({isInternal:!0});fds.displayName="SimpleBezierEdge";$Dt.displayName="SimpleBezierEdgeInternal";function ODt(t){return y.memo(({id:e,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:m,sourcePosition:f=kr.Bottom,targetPosition:p=kr.Top,markerEnd:g,markerStart:v,pathOptions:b,interactionWidth:x})=>{const[w,k,S]=G1e({sourceX:n,sourceY:r,sourcePosition:f,targetX:s,targetY:i,targetPosition:p,borderRadius:b==null?void 0:b.borderRadius,offset:b==null?void 0:b.offset,stepPosition:b==null?void 0:b.stepPosition}),C=t.isInternal?void 0:e;return a.jsx(D9,{id:C,path:w,labelX:k,labelY:S,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:m,markerEnd:g,markerStart:v,interactionWidth:x})})}const FDt=ODt({isInternal:!1}),BDt=ODt({isInternal:!0});FDt.displayName="SmoothStepEdge";BDt.displayName="SmoothStepEdgeInternal";function UDt(t){return y.memo(({id:e,...n})=>{var s;const r=t.isInternal?void 0:e;return a.jsx(FDt,{...n,id:r,pathOptions:y.useMemo(()=>{var i;return{borderRadius:0,offset:(i=n.pathOptions)==null?void 0:i.offset}},[(s=n.pathOptions)==null?void 0:s.offset])})})}const pds=UDt({isInternal:!1}),zDt=UDt({isInternal:!0});pds.displayName="StepEdge";zDt.displayName="StepEdgeInternal";function VDt(t){return y.memo(({id:e,sourceX:n,sourceY:r,targetX:s,targetY:i,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:m,markerEnd:f,markerStart:p,interactionWidth:g})=>{const[v,b,x]=yIe({sourceX:n,sourceY:r,targetX:s,targetY:i}),w=t.isInternal?void 0:e;return a.jsx(D9,{id:w,path:v,labelX:b,labelY:x,label:o,labelStyle:l,labelShowBg:c,labelBgStyle:d,labelBgPadding:u,labelBgBorderRadius:h,style:m,markerEnd:f,markerStart:p,interactionWidth:g})})}const gds=VDt({isInternal:!1}),HDt=VDt({isInternal:!0});gds.displayName="StraightEdge";HDt.displayName="StraightEdgeInternal";function GDt(t){return y.memo(({id:e,sourceX:n,sourceY:r,targetX:s,targetY:i,sourcePosition:o=kr.Bottom,targetPosition:l=kr.Top,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:f,style:p,markerEnd:g,markerStart:v,pathOptions:b,interactionWidth:x})=>{const[w,k,S]=sDt({sourceX:n,sourceY:r,sourcePosition:o,targetX:s,targetY:i,targetPosition:l,curvature:b==null?void 0:b.curvature}),C=t.isInternal?void 0:e;return a.jsx(D9,{id:C,path:w,labelX:k,labelY:S,label:c,labelStyle:d,labelShowBg:u,labelBgStyle:h,labelBgPadding:m,labelBgBorderRadius:f,style:p,markerEnd:g,markerStart:v,interactionWidth:x})})}const vds=GDt({isInternal:!1}),WDt=GDt({isInternal:!0});vds.displayName="BezierEdge";WDt.displayName="BezierEdgeInternal";const mJe={default:WDt,straight:HDt,step:zDt,smoothstep:BDt,simplebezier:$Dt},fJe={sourceX:null,sourceY:null,targetX:null,targetY:null,sourcePosition:null,targetPosition:null,zIndex:void 0},yds=(t,e,n)=>n===kr.Left?t-e:n===kr.Right?t+e:t,bds=(t,e,n)=>n===kr.Top?t-e:n===kr.Bottom?t+e:t,pJe="react-flow__edgeupdater";function gJe({position:t,centerX:e,centerY:n,radius:r=10,onMouseDown:s,onMouseEnter:i,onMouseOut:o,type:l}){return a.jsx("circle",{onMouseDown:s,onMouseEnter:i,onMouseOut:o,className:nc([pJe,`${pJe}-${l}`]),cx:yds(e,r,t),cy:bds(n,r,t),r,stroke:"transparent",fill:"transparent"})}function xds({isReconnectable:t,reconnectRadius:e,edge:n,sourceX:r,sourceY:s,targetX:i,targetY:o,sourcePosition:l,targetPosition:c,onReconnect:d,onReconnectStart:u,onReconnectEnd:h,setReconnecting:m,setUpdateHover:f}){const p=To(),g=(k,S)=>{if(k.button!==0)return;const{autoPanOnConnect:C,domNode:j,connectionMode:E,connectionRadius:N,lib:A,onConnectStart:_,cancelConnection:T,nodeLookup:R,rfId:O,panBy:F,updateConnection:D}=p.getState(),I=S.type==="target",P=(G,B)=>{m(!1),h==null||h(G,n,S.type,B)},M=G=>d==null?void 0:d(n,G),z=(G,B)=>{m(!0),u==null||u(k,n,S.type),_==null||_(G,B)};K1e.onPointerDown(k.nativeEvent,{autoPanOnConnect:C,connectionMode:E,connectionRadius:N,domNode:j,handleId:S.id,nodeId:S.nodeId,nodeLookup:R,isTarget:I,edgeUpdaterType:S.type,lib:A,flowId:O,cancelConnection:T,panBy:F,isValidConnection:(...G)=>{var B,H;return((H=(B=p.getState()).isValidConnection)==null?void 0:H.call(B,...G))??!0},onConnect:M,onConnectStart:z,onConnectEnd:(...G)=>{var B,H;return(H=(B=p.getState()).onConnectEnd)==null?void 0:H.call(B,...G)},onReconnectEnd:P,updateConnection:D,getTransform:()=>p.getState().transform,getFromHandle:()=>p.getState().connection.fromHandle,dragThreshold:p.getState().connectionDragThreshold,handleDomNode:k.currentTarget})},v=k=>g(k,{nodeId:n.target,id:n.targetHandle??null,type:"target"}),b=k=>g(k,{nodeId:n.source,id:n.sourceHandle??null,type:"source"}),x=()=>f(!0),w=()=>f(!1);return a.jsxs(a.Fragment,{children:[(t===!0||t==="source")&&a.jsx(gJe,{position:l,centerX:r,centerY:s,radius:e,onMouseDown:v,onMouseEnter:x,onMouseOut:w,type:"source"}),(t===!0||t==="target")&&a.jsx(gJe,{position:c,centerX:i,centerY:o,radius:e,onMouseDown:b,onMouseEnter:x,onMouseOut:w,type:"target"})]})}function wds({id:t,edgesFocusable:e,edgesReconnectable:n,elementsSelectable:r,onClick:s,onDoubleClick:i,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:d,reconnectRadius:u,onReconnect:h,onReconnectStart:m,onReconnectEnd:f,rfId:p,edgeTypes:g,noPanClassName:v,onError:b,disableKeyboardA11y:x}){let w=si(q=>q.edgeLookup.get(t));const k=si(q=>q.defaultEdgeOptions);w=k?{...k,...w}:w;let S=w.type||"default",C=(g==null?void 0:g[S])||mJe[S];C===void 0&&(b==null||b("011",zg.error011(S)),S="default",C=(g==null?void 0:g.default)||mJe.default);const j=!!(w.focusable||e&&typeof w.focusable>"u"),E=typeof h<"u"&&(w.reconnectable||n&&typeof w.reconnectable>"u"),N=!!(w.selectable||r&&typeof w.selectable>"u"),A=y.useRef(null),[_,T]=y.useState(!1),[R,O]=y.useState(!1),F=To(),{zIndex:D=w.zIndex,sourceX:I,sourceY:P,targetX:M,targetY:z,sourcePosition:G,targetPosition:B}=si(y.useCallback(q=>{const Y=q.nodeLookup.get(w.source),X=q.nodeLookup.get(w.target);if(!Y||!X)return fJe;const Q=nls({id:t,sourceNode:Y,targetNode:X,sourceHandle:w.sourceHandle||null,targetHandle:w.targetHandle||null,connectionMode:q.connectionMode,onError:b}),ie=Kos({selected:w.selected,zIndex:w.zIndex,sourceNode:Y,targetNode:X,elevateOnSelect:q.elevateEdgesOnSelect,zIndexMode:q.zIndexMode});return{...Q||fJe,zIndex:ie}},[w.source,w.target,w.sourceHandle,w.targetHandle,w.selected,w.zIndex]),ko),H=y.useMemo(()=>w.markerStart?`url('#${W1e(w.markerStart,p)}')`:void 0,[w.markerStart,p]),W=y.useMemo(()=>w.markerEnd?`url('#${W1e(w.markerEnd,p)}')`:void 0,[w.markerEnd,p]);if(w.hidden||I===null||P===null||M===null||z===null)return null;const V=q=>{var ie;const{addSelectedEdges:Y,unselectNodesAndEdges:X,multiSelectionActive:Q}=F.getState();N&&(F.setState({nodesSelectionActive:!1}),w.selected&&Q?(X({nodes:[],edges:[w]}),(ie=A.current)==null||ie.blur()):Y([t])),s&&s(q,w)},U=i?q=>{i(q,{...w})}:void 0,ne=o?q=>{o(q,{...w})}:void 0,te=l?q=>{l(q,{...w})}:void 0,re=c?q=>{c(q,{...w})}:void 0,fe=d?q=>{d(q,{...w})}:void 0,le=q=>{var Y;if(!x&&z4t.includes(q.key)&&N){const{unselectNodesAndEdges:X,addSelectedEdges:Q}=F.getState();q.key==="Escape"?((Y=A.current)==null||Y.blur(),X({edges:[w]})):Q([t])}};return a.jsx("svg",{style:{zIndex:D},children:a.jsxs("g",{className:nc(["react-flow__edge",`react-flow__edge-${S}`,w.className,v,{selected:w.selected,animated:w.animated,inactive:!N&&!s,updating:_,selectable:N}]),onClick:V,onDoubleClick:U,onContextMenu:ne,onMouseEnter:te,onMouseMove:re,onMouseLeave:fe,onKeyDown:j?le:void 0,tabIndex:j?0:void 0,role:w.ariaRole??(j?"group":"img"),"aria-roledescription":"edge","data-id":t,"data-testid":`rf__edge-${t}`,"aria-label":w.ariaLabel===null?void 0:w.ariaLabel||`Edge from ${w.source} to ${w.target}`,"aria-describedby":j?`${kDt}-${p}`:void 0,ref:A,...w.domAttributes,children:[!R&&a.jsx(C,{id:t,source:w.source,target:w.target,type:w.type,selected:w.selected,animated:w.animated,selectable:N,deletable:w.deletable??!0,label:w.label,labelStyle:w.labelStyle,labelShowBg:w.labelShowBg,labelBgStyle:w.labelBgStyle,labelBgPadding:w.labelBgPadding,labelBgBorderRadius:w.labelBgBorderRadius,sourceX:I,sourceY:P,targetX:M,targetY:z,sourcePosition:G,targetPosition:B,data:w.data,style:w.style,sourceHandleId:w.sourceHandle,targetHandleId:w.targetHandle,markerStart:H,markerEnd:W,pathOptions:"pathOptions"in w?w.pathOptions:void 0,interactionWidth:w.interactionWidth}),E&&a.jsx(xds,{edge:w,isReconnectable:E,reconnectRadius:u,onReconnect:h,onReconnectStart:m,onReconnectEnd:f,sourceX:I,sourceY:P,targetX:M,targetY:z,sourcePosition:G,targetPosition:B,setUpdateHover:T,setReconnecting:O})]})})}var kds=y.memo(wds);const Sds=t=>({edgesFocusable:t.edgesFocusable,edgesReconnectable:t.edgesReconnectable,elementsSelectable:t.elementsSelectable,connectionMode:t.connectionMode,onError:t.onError});function qDt({defaultMarkerColor:t,onlyRenderVisibleElements:e,rfId:n,edgeTypes:r,noPanClassName:s,onReconnect:i,onEdgeContextMenu:o,onEdgeMouseEnter:l,onEdgeMouseMove:c,onEdgeMouseLeave:d,onEdgeClick:u,reconnectRadius:h,onEdgeDoubleClick:m,onReconnectStart:f,onReconnectEnd:p,disableKeyboardA11y:g}){const{edgesFocusable:v,edgesReconnectable:b,elementsSelectable:x,onError:w}=si(Sds,ko),k=ods(e);return a.jsxs("div",{className:"react-flow__edges",children:[a.jsx(hds,{defaultColor:t,rfId:n}),k.map(S=>a.jsx(kds,{id:S,edgesFocusable:v,edgesReconnectable:b,elementsSelectable:x,noPanClassName:s,onReconnect:i,onContextMenu:o,onMouseEnter:l,onMouseMove:c,onMouseLeave:d,onClick:u,reconnectRadius:h,onDoubleClick:m,onReconnectStart:f,onReconnectEnd:p,rfId:n,onError:w,edgeTypes:r,disableKeyboardA11y:g},S))]})}qDt.displayName="EdgeRenderer";const Cds=y.memo(qDt),jds=t=>`translate(${t.transform[0]}px,${t.transform[1]}px) scale(${t.transform[2]})`;function Eds({children:t}){const e=si(jds);return a.jsx("div",{className:"react-flow__viewport xyflow__viewport react-flow__container",style:{transform:e},children:t})}function Nds(t){const e=CIe(),n=y.useRef(!1);y.useEffect(()=>{!n.current&&e.viewportInitialized&&t&&(setTimeout(()=>t(e),1),n.current=!0)},[t,e.viewportInitialized])}const Tds=t=>{var e;return(e=t.panZoom)==null?void 0:e.syncViewport};function _ds(t){const e=si(Tds),n=To();return y.useEffect(()=>{t&&(e==null||e(t),n.setState({transform:[t.x,t.y,t.zoom]}))},[t,e]),null}function Ads(t){return t.connection.inProgress?{...t.connection,to:L9(t.connection.to,t.transform)}:{...t.connection}}function Pds(t){return Ads}function Rds(t){const e=Pds();return si(e,ko)}const Ids=t=>({nodesConnectable:t.nodesConnectable,isValid:t.connection.isValid,inProgress:t.connection.inProgress,width:t.width,height:t.height});function Mds({containerStyle:t,style:e,type:n,component:r}){const{nodesConnectable:s,width:i,height:o,isValid:l,inProgress:c}=si(Ids,ko);return!(i&&s&&c)?null:a.jsx("svg",{style:t,width:i,height:o,className:"react-flow__connectionline react-flow__container",children:a.jsx("g",{className:nc(["react-flow__connection",G4t(l)]),children:a.jsx(KDt,{style:e,type:n,CustomComponent:r,isValid:l})})})}const KDt=({style:t,type:e=h1.Bezier,CustomComponent:n,isValid:r})=>{const{inProgress:s,from:i,fromNode:o,fromHandle:l,fromPosition:c,to:d,toNode:u,toHandle:h,toPosition:m,pointer:f}=Rds();if(!s)return;if(n)return a.jsx(n,{connectionLineType:e,connectionLineStyle:t,fromNode:o,fromHandle:l,fromX:i.x,fromY:i.y,toX:d.x,toY:d.y,fromPosition:c,toPosition:m,connectionStatus:G4t(r),toNode:u,toHandle:h,pointer:f});let p="";const g={sourceX:i.x,sourceY:i.y,sourcePosition:c,targetX:d.x,targetY:d.y,targetPosition:m};switch(e){case h1.Bezier:[p]=sDt(g);break;case h1.SimpleBezier:[p]=LDt(g);break;case h1.Step:[p]=G1e({...g,borderRadius:0});break;case h1.SmoothStep:[p]=G1e(g);break;default:[p]=yIe(g)}return a.jsx("path",{d:p,fill:"none",className:"react-flow__connection-path",style:t})};KDt.displayName="ConnectionLine";const Lds={};function vJe(t=Lds){y.useRef(t),To(),y.useEffect(()=>{},[t])}function Dds(){To(),y.useRef(!1),y.useEffect(()=>{},[])}function YDt({nodeTypes:t,edgeTypes:e,onInit:n,onNodeClick:r,onEdgeClick:s,onNodeDoubleClick:i,onEdgeDoubleClick:o,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:d,onNodeContextMenu:u,onSelectionContextMenu:h,onSelectionStart:m,onSelectionEnd:f,connectionLineType:p,connectionLineStyle:g,connectionLineComponent:v,connectionLineContainerStyle:b,selectionKeyCode:x,selectionOnDrag:w,selectionMode:k,multiSelectionKeyCode:S,panActivationKeyCode:C,zoomActivationKeyCode:j,deleteKeyCode:E,onlyRenderVisibleElements:N,elementsSelectable:A,defaultViewport:_,translateExtent:T,minZoom:R,maxZoom:O,preventScrolling:F,defaultMarkerColor:D,zoomOnScroll:I,zoomOnPinch:P,panOnScroll:M,panOnScrollSpeed:z,panOnScrollMode:G,zoomOnDoubleClick:B,panOnDrag:H,autoPanOnSelection:W,onPaneClick:V,onPaneMouseEnter:U,onPaneMouseMove:ne,onPaneMouseLeave:te,onPaneScroll:re,onPaneContextMenu:fe,paneClickDistance:le,nodeClickDistance:q,onEdgeContextMenu:Y,onEdgeMouseEnter:X,onEdgeMouseMove:Q,onEdgeMouseLeave:ie,reconnectRadius:he,onReconnect:ye,onReconnectStart:J,onReconnectEnd:K,noDragClassName:ce,noWheelClassName:pe,noPanClassName:Ie,disableKeyboardA11y:Me,nodeExtent:we,rfId:Be,viewport:Ve,onViewportChange:be}){return vJe(t),vJe(e),Dds(),Nds(n),_ds(Ve),a.jsx(Zcs,{onPaneClick:V,onPaneMouseEnter:U,onPaneMouseMove:ne,onPaneMouseLeave:te,onPaneContextMenu:fe,onPaneScroll:re,paneClickDistance:le,deleteKeyCode:E,selectionKeyCode:x,selectionOnDrag:w,selectionMode:k,onSelectionStart:m,onSelectionEnd:f,multiSelectionKeyCode:S,panActivationKeyCode:C,zoomActivationKeyCode:j,elementsSelectable:A,zoomOnScroll:I,zoomOnPinch:P,zoomOnDoubleClick:B,panOnScroll:M,panOnScrollSpeed:z,panOnScrollMode:G,panOnDrag:H,autoPanOnSelection:W,defaultViewport:_,translateExtent:T,minZoom:R,maxZoom:O,onSelectionContextMenu:h,preventScrolling:F,noDragClassName:ce,noWheelClassName:pe,noPanClassName:Ie,disableKeyboardA11y:Me,onViewportChange:be,isControlledViewport:!!Ve,children:a.jsxs(Eds,{children:[a.jsx(Cds,{edgeTypes:e,onEdgeClick:s,onEdgeDoubleClick:o,onReconnect:ye,onReconnectStart:J,onReconnectEnd:K,onlyRenderVisibleElements:N,onEdgeContextMenu:Y,onEdgeMouseEnter:X,onEdgeMouseMove:Q,onEdgeMouseLeave:ie,reconnectRadius:he,defaultMarkerColor:D,noPanClassName:Ie,disableKeyboardA11y:Me,rfId:Be}),a.jsx(Mds,{style:g,type:p,component:v,containerStyle:b}),a.jsx("div",{className:"react-flow__edgelabel-renderer"}),a.jsx(ads,{nodeTypes:t,onNodeClick:r,onNodeDoubleClick:i,onNodeMouseEnter:l,onNodeMouseMove:c,onNodeMouseLeave:d,onNodeContextMenu:u,nodeClickDistance:q,onlyRenderVisibleElements:N,noPanClassName:Ie,noDragClassName:ce,disableKeyboardA11y:Me,nodeExtent:we,rfId:Be}),a.jsx("div",{className:"react-flow__viewport-portal"})]})})}YDt.displayName="GraphView";const $ds=y.memo(YDt),Ods=Z4t(),yJe=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,fitViewOptions:l,minZoom:c=.5,maxZoom:d=2,nodeOrigin:u,nodeExtent:h,zIndexMode:m="basic"}={})=>{const f=new Map,p=new Map,g=new Map,v=new Map,b=r??e??[],x=n??t??[],w=u??[0,0],k=h??h8;lDt(g,v,b);const{nodesInitialized:S}=q1e(x,f,p,{nodeOrigin:w,nodeExtent:k,zIndexMode:m});let C=[0,0,1];if(o&&s&&i){const j=I9(f,{filter:_=>!!((_.width||_.initialWidth)&&(_.height||_.initialHeight))}),{x:E,y:N,zoom:A}=gIe(j,s,i,c,d,(l==null?void 0:l.padding)??.1);C=[E,N,A]}return{rfId:"1",width:s??0,height:i??0,transform:C,nodes:x,nodesInitialized:S,nodeLookup:f,parentLookup:p,edges:b,edgeLookup:v,connectionLookup:g,onNodesChange:null,onEdgesChange:null,hasDefaultNodes:n!==void 0,hasDefaultEdges:r!==void 0,panZoom:null,minZoom:c,maxZoom:d,translateExtent:h8,nodeExtent:k,nodesSelectionActive:!1,userSelectionActive:!1,userSelectionRect:null,connectionMode:W5.Strict,domNode:null,paneDragging:!1,noPanClassName:"nopan",nodeOrigin:w,nodeDragThreshold:1,connectionDragThreshold:1,snapGrid:[15,15],snapToGrid:!1,nodesDraggable:!0,nodesConnectable:!0,nodesFocusable:!0,edgesFocusable:!0,edgesReconnectable:!0,elementsSelectable:!0,elevateNodesOnSelect:!0,elevateEdgesOnSelect:!0,selectNodesOnDrag:!0,multiSelectionActive:!1,fitViewQueued:o??!1,fitViewOptions:l,fitViewResolver:null,connection:{...H4t},connectionClickStartHandle:null,connectOnClick:!0,ariaLiveMessage:"",autoPanOnConnect:!0,autoPanOnNodeDrag:!0,autoPanOnNodeFocus:!0,autoPanSpeed:15,connectionRadius:20,onError:Ods,isValidConnection:void 0,onSelectionChangeHandlers:[],lib:"react",debug:!1,ariaLabelConfig:V4t,zIndexMode:m,onNodesChangeMiddlewareMap:new Map,onEdgesChangeMiddlewareMap:new Map}},Fds=({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:d,nodeOrigin:u,nodeExtent:h,zIndexMode:m})=>Yls((f,p)=>{async function g(){const{nodeLookup:v,panZoom:b,fitViewOptions:x,fitViewResolver:w,width:k,height:S,minZoom:C,maxZoom:j}=p();b&&(await Uos({nodes:v,width:k,height:S,panZoom:b,minZoom:C,maxZoom:j},x),w==null||w.resolve(!0),f({fitViewResolver:null}))}return{...yJe({nodes:t,edges:e,width:s,height:i,fitView:o,fitViewOptions:l,minZoom:c,maxZoom:d,nodeOrigin:u,nodeExtent:h,defaultNodes:n,defaultEdges:r,zIndexMode:m}),setNodes:v=>{const{nodeLookup:b,parentLookup:x,nodeOrigin:w,elevateNodesOnSelect:k,fitViewQueued:S,zIndexMode:C,nodesSelectionActive:j}=p(),{nodesInitialized:E,hasSelectedNodes:N}=q1e(v,b,x,{nodeOrigin:w,nodeExtent:h,elevateNodesOnSelect:k,checkEquality:!0,zIndexMode:C}),A=j&&N;S&&E?(g(),f({nodes:v,nodesInitialized:E,fitViewQueued:!1,fitViewOptions:void 0,nodesSelectionActive:A})):f({nodes:v,nodesInitialized:E,nodesSelectionActive:A})},setEdges:v=>{const{connectionLookup:b,edgeLookup:x}=p();lDt(b,x,v),f({edges:v})},setDefaultNodesAndEdges:(v,b)=>{if(v){const{setNodes:x}=p();x(v),f({hasDefaultNodes:!0})}if(b){const{setEdges:x}=p();x(b),f({hasDefaultEdges:!0})}},updateNodeInternals:v=>{const{triggerNodeChanges:b,nodeLookup:x,parentLookup:w,domNode:k,nodeOrigin:S,nodeExtent:C,debug:j,fitViewQueued:E,zIndexMode:N}=p(),{changes:A,updatedInternals:_}=dls(v,x,w,k,S,C,N);_&&(als(x,w,{nodeOrigin:S,nodeExtent:C,zIndexMode:N}),E?(g(),f({fitViewQueued:!1,fitViewOptions:void 0})):f({}),(A==null?void 0:A.length)>0&&(j&&console.log("React Flow: trigger node changes",A),b==null||b(A)))},updateNodePositions:(v,b=!1)=>{const x=[];let w=[];const{nodeLookup:k,triggerNodeChanges:S,connection:C,updateConnection:j,onNodesChangeMiddlewareMap:E}=p();for(const[N,A]of v){const _=k.get(N),T=!!(_!=null&&_.expandParent&&(_!=null&&_.parentId)&&(A!=null&&A.position)),R={id:N,type:"position",position:T?{x:Math.max(0,A.position.x),y:Math.max(0,A.position.y)}:A.position,dragging:b};if(_&&C.inProgress&&C.fromNode.id===_.id){const O=vE(_,C.fromHandle,kr.Left,!0);j({...C,from:O})}T&&_.parentId&&x.push({id:N,parentId:_.parentId,rect:{...A.internals.positionAbsolute,width:A.measured.width??0,height:A.measured.height??0}}),w.push(R)}if(x.length>0){const{parentLookup:N,nodeOrigin:A}=p(),_=SIe(x,k,N,A);w.push(..._)}for(const N of E.values())w=N(w);S(w)},triggerNodeChanges:v=>{const{onNodesChange:b,setNodes:x,nodes:w,hasDefaultNodes:k,debug:S}=p();if(v!=null&&v.length){if(k){const C=gcs(v,w);x(C)}S&&console.log("React Flow: trigger node changes",v),b==null||b(v)}},triggerEdgeChanges:v=>{const{onEdgesChange:b,setEdges:x,edges:w,hasDefaultEdges:k,debug:S}=p();if(v!=null&&v.length){if(k){const C=vcs(v,w);x(C)}S&&console.log("React Flow: trigger edge changes",v),b==null||b(v)}},addSelectedNodes:v=>{const{multiSelectionActive:b,edgeLookup:x,nodeLookup:w,triggerNodeChanges:k,triggerEdgeChanges:S}=p();if(b){const C=v.map(j=>WC(j,!0));k(C);return}k(jA(w,new Set([...v]),!0)),S(jA(x))},addSelectedEdges:v=>{const{multiSelectionActive:b,edgeLookup:x,nodeLookup:w,triggerNodeChanges:k,triggerEdgeChanges:S}=p();if(b){const C=v.map(j=>WC(j,!0));S(C);return}S(jA(x,new Set([...v]))),k(jA(w,new Set,!0))},unselectNodesAndEdges:({nodes:v,edges:b}={})=>{const{edges:x,nodes:w,nodeLookup:k,triggerNodeChanges:S,triggerEdgeChanges:C}=p(),j=v||w,E=b||x,N=[];for(const _ of j){if(!_.selected)continue;const T=k.get(_.id);T&&(T.selected=!1),N.push(WC(_.id,!1))}const A=[];for(const _ of E)_.selected&&A.push(WC(_.id,!1));S(N),C(A)},setMinZoom:v=>{const{panZoom:b,maxZoom:x}=p();b==null||b.setScaleExtent([v,x]),f({minZoom:v})},setMaxZoom:v=>{const{panZoom:b,minZoom:x}=p();b==null||b.setScaleExtent([x,v]),f({maxZoom:v})},setTranslateExtent:v=>{var b;(b=p().panZoom)==null||b.setTranslateExtent(v),f({translateExtent:v})},resetSelectedElements:()=>{const{edges:v,nodes:b,triggerNodeChanges:x,triggerEdgeChanges:w,elementsSelectable:k}=p();if(!k)return;const S=b.reduce((j,E)=>E.selected?[...j,WC(E.id,!1)]:j,[]),C=v.reduce((j,E)=>E.selected?[...j,WC(E.id,!1)]:j,[]);x(S),w(C)},setNodeExtent:v=>{const{nodes:b,nodeLookup:x,parentLookup:w,nodeOrigin:k,elevateNodesOnSelect:S,nodeExtent:C,zIndexMode:j}=p();v[0][0]===C[0][0]&&v[0][1]===C[0][1]&&v[1][0]===C[1][0]&&v[1][1]===C[1][1]||(q1e(b,x,w,{nodeOrigin:k,nodeExtent:v,elevateNodesOnSelect:S,checkEquality:!1,zIndexMode:j}),f({nodeExtent:v}))},panBy:v=>{const{transform:b,width:x,height:w,panZoom:k,translateExtent:S}=p();return uls({delta:v,panZoom:k,transform:b,translateExtent:S,width:x,height:w})},setCenter:async(v,b,x)=>{const{width:w,height:k,maxZoom:S,panZoom:C}=p();if(!C)return!1;const j=typeof(x==null?void 0:x.zoom)<"u"?x.zoom:S;return await C.setViewport({x:w/2-v*j,y:k/2-b*j,zoom:j},{duration:x==null?void 0:x.duration,ease:x==null?void 0:x.ease,interpolate:x==null?void 0:x.interpolate}),!0},cancelConnection:()=>{f({connection:{...H4t}})},updateConnection:v=>{f({connection:v})},reset:()=>f({...yJe()})}},Object.is);function Bds({initialNodes:t,initialEdges:e,defaultNodes:n,defaultEdges:r,initialWidth:s,initialHeight:i,initialMinZoom:o,initialMaxZoom:l,initialFitViewOptions:c,fitView:d,nodeOrigin:u,nodeExtent:h,zIndexMode:m,children:f}){const[p]=y.useState(()=>Fds({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,width:s,height:i,fitView:d,minZoom:o,maxZoom:l,fitViewOptions:c,nodeOrigin:u,nodeExtent:h,zIndexMode:m}));return a.jsx(Qls,{value:p,children:a.jsx(Scs,{children:a.jsx(Ocs,{children:f})})})}function Uds({children:t,nodes:e,edges:n,defaultNodes:r,defaultEdges:s,width:i,height:o,fitView:l,fitViewOptions:c,minZoom:d,maxZoom:u,nodeOrigin:h,nodeExtent:m,zIndexMode:f}){return y.useContext(uae)?a.jsx(a.Fragment,{children:t}):a.jsx(Bds,{initialNodes:e,initialEdges:n,defaultNodes:r,defaultEdges:s,initialWidth:i,initialHeight:o,fitView:l,initialFitViewOptions:c,initialMinZoom:d,initialMaxZoom:u,nodeOrigin:h,nodeExtent:m,zIndexMode:f,children:t})}const zds={width:"100%",height:"100%",overflow:"hidden",position:"relative",zIndex:0};function Vds({nodes:t,edges:e,defaultNodes:n,defaultEdges:r,className:s,nodeTypes:i,edgeTypes:o,onNodeClick:l,onEdgeClick:c,onInit:d,onMove:u,onMoveStart:h,onMoveEnd:m,onConnect:f,onConnectStart:p,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:b,onNodeMouseEnter:x,onNodeMouseMove:w,onNodeMouseLeave:k,onNodeContextMenu:S,onNodeDoubleClick:C,onNodeDragStart:j,onNodeDrag:E,onNodeDragStop:N,onNodesDelete:A,onEdgesDelete:_,onDelete:T,onSelectionChange:R,onSelectionDragStart:O,onSelectionDrag:F,onSelectionDragStop:D,onSelectionContextMenu:I,onSelectionStart:P,onSelectionEnd:M,onBeforeDelete:z,connectionMode:G,connectionLineType:B=h1.Bezier,connectionLineStyle:H,connectionLineComponent:W,connectionLineContainerStyle:V,deleteKeyCode:U="Backspace",selectionKeyCode:ne="Shift",selectionOnDrag:te=!1,selectionMode:re=m8.Full,panActivationKeyCode:fe="Space",multiSelectionKeyCode:le=p8()?"Meta":"Control",zoomActivationKeyCode:q=p8()?"Meta":"Control",snapToGrid:Y,snapGrid:X,onlyRenderVisibleElements:Q=!1,selectNodesOnDrag:ie,nodesDraggable:he,autoPanOnNodeFocus:ye,nodesConnectable:J,nodesFocusable:K,nodeOrigin:ce=SDt,edgesFocusable:pe,edgesReconnectable:Ie,elementsSelectable:Me=!0,defaultViewport:we=ccs,minZoom:Be=.5,maxZoom:Ve=2,translateExtent:be=h8,preventScrolling:Ze=!0,nodeExtent:Pe,defaultMarkerColor:Ke="#b1b1b7",zoomOnScroll:De=!0,zoomOnPinch:xt=!0,panOnScroll:Xe=!1,panOnScrollSpeed:tt=.5,panOnScrollMode:$e=u2.Free,zoomOnDoubleClick:wt=!0,panOnDrag:Ee=!0,onPaneClick:Ge,onPaneMouseEnter:Pt,onPaneMouseMove:vn,onPaneMouseLeave:Hn,onPaneScroll:yr,onPaneContextMenu:br,paneClickDistance:Yt=1,nodeClickDistance:nr=0,children:Kn,onReconnect:ms,onReconnectStart:is,onReconnectEnd:ke,onEdgeContextMenu:at,onEdgeDoubleClick:Tt,onEdgeMouseEnter:An,onEdgeMouseMove:Pn,onEdgeMouseLeave:yn,reconnectRadius:Is=10,onNodesChange:js,onEdgesChange:Gt,noDragClassName:lr="nodrag",noWheelClassName:ct="nowheel",noPanClassName:Bn="nopan",fitView:Ms,fitViewOptions:Ue,connectOnClick:et,attributionPosition:Le,proOptions:Ye,defaultEdgeOptions:st,elevateNodesOnSelect:nt=!0,elevateEdgesOnSelect:Je=!1,disableKeyboardA11y:Rt=!1,autoPanOnConnect:Qt,autoPanOnNodeDrag:Jt,autoPanOnSelection:Qe=!0,autoPanSpeed:Lt,connectionRadius:Xt,isValidConnection:xr,onError:Ls,style:xi,id:oa,nodeDragThreshold:la,connectionDragThreshold:$i,viewport:al,onViewportChange:$l,width:ou,height:Ih,colorMode:av="light",debug:ov,onScroll:Uu,ariaLabelConfig:K0,zIndexMode:lb="basic",...Y0},cb){const Mh=oa||"1",db=mcs(av),bn=y.useCallback(Re=>{Re.currentTarget.scrollTo({top:0,left:0,behavior:"instant"}),Uu==null||Uu(Re)},[Uu]);return a.jsx("div",{"data-testid":"rf__wrapper",...Y0,onScroll:bn,style:{...xi,...zds},ref:cb,className:nc(["react-flow",s,db]),id:oa,role:"application",children:a.jsxs(Uds,{nodes:t,edges:e,width:ou,height:Ih,fitView:Ms,fitViewOptions:Ue,minZoom:Be,maxZoom:Ve,nodeOrigin:ce,nodeExtent:Pe,zIndexMode:lb,children:[a.jsx(hcs,{nodes:t,edges:e,defaultNodes:n,defaultEdges:r,onConnect:f,onConnectStart:p,onConnectEnd:g,onClickConnectStart:v,onClickConnectEnd:b,nodesDraggable:he,autoPanOnNodeFocus:ye,nodesConnectable:J,nodesFocusable:K,edgesFocusable:pe,edgesReconnectable:Ie,elementsSelectable:Me,elevateNodesOnSelect:nt,elevateEdgesOnSelect:Je,minZoom:Be,maxZoom:Ve,nodeExtent:Pe,onNodesChange:js,onEdgesChange:Gt,snapToGrid:Y,snapGrid:X,connectionMode:G,translateExtent:be,connectOnClick:et,defaultEdgeOptions:st,fitView:Ms,fitViewOptions:Ue,onNodesDelete:A,onEdgesDelete:_,onDelete:T,onNodeDragStart:j,onNodeDrag:E,onNodeDragStop:N,onSelectionDrag:F,onSelectionDragStart:O,onSelectionDragStop:D,onMove:u,onMoveStart:h,onMoveEnd:m,noPanClassName:Bn,nodeOrigin:ce,rfId:Mh,autoPanOnConnect:Qt,autoPanOnNodeDrag:Jt,autoPanSpeed:Lt,onError:Ls,connectionRadius:Xt,isValidConnection:xr,selectNodesOnDrag:ie,nodeDragThreshold:la,connectionDragThreshold:$i,onBeforeDelete:z,debug:ov,ariaLabelConfig:K0,zIndexMode:lb}),a.jsx($ds,{onInit:d,onNodeClick:l,onEdgeClick:c,onNodeMouseEnter:x,onNodeMouseMove:w,onNodeMouseLeave:k,onNodeContextMenu:S,onNodeDoubleClick:C,nodeTypes:i,edgeTypes:o,connectionLineType:B,connectionLineStyle:H,connectionLineComponent:W,connectionLineContainerStyle:V,selectionKeyCode:ne,selectionOnDrag:te,selectionMode:re,deleteKeyCode:U,multiSelectionKeyCode:le,panActivationKeyCode:fe,zoomActivationKeyCode:q,onlyRenderVisibleElements:Q,defaultViewport:we,translateExtent:be,minZoom:Be,maxZoom:Ve,preventScrolling:Ze,zoomOnScroll:De,zoomOnPinch:xt,zoomOnDoubleClick:wt,panOnScroll:Xe,panOnScrollSpeed:tt,panOnScrollMode:$e,panOnDrag:Ee,autoPanOnSelection:Qe,onPaneClick:Ge,onPaneMouseEnter:Pt,onPaneMouseMove:vn,onPaneMouseLeave:Hn,onPaneScroll:yr,onPaneContextMenu:br,paneClickDistance:Yt,nodeClickDistance:nr,onSelectionContextMenu:I,onSelectionStart:P,onSelectionEnd:M,onReconnect:ms,onReconnectStart:is,onReconnectEnd:ke,onEdgeContextMenu:at,onEdgeDoubleClick:Tt,onEdgeMouseEnter:An,onEdgeMouseMove:Pn,onEdgeMouseLeave:yn,reconnectRadius:Is,defaultMarkerColor:Ke,noDragClassName:lr,noWheelClassName:ct,noPanClassName:Bn,rfId:Mh,disableKeyboardA11y:Rt,nodeExtent:Pe,viewport:al,onViewportChange:$l}),a.jsx(lcs,{onSelectionChange:R}),Kn,a.jsx(rcs,{proOptions:Ye,position:Le}),a.jsx(ncs,{rfId:Mh,disableKeyboardA11y:Rt})]})})}var Hds=jDt(Vds);const Gds=t=>{var e;return(e=t.domNode)==null?void 0:e.querySelector(".react-flow__edgelabel-renderer")};function Wds({children:t}){const e=si(Gds);return e?Vg.createPortal(t,e):null}function qds({dimensions:t,lineWidth:e,variant:n,className:r}){return a.jsx("path",{strokeWidth:e,d:`M${t[0]/2} 0 V${t[1]} M0 ${t[1]/2} H${t[0]}`,className:nc(["react-flow__background-pattern",n,r])})}function Kds({radius:t,className:e}){return a.jsx("circle",{cx:t,cy:t,r:t,className:nc(["react-flow__background-pattern","dots",e])})}var Mx;(function(t){t.Lines="lines",t.Dots="dots",t.Cross="cross"})(Mx||(Mx={}));const Yds={[Mx.Dots]:1,[Mx.Lines]:1,[Mx.Cross]:6},Qds=t=>({transform:t.transform,patternId:`pattern-${t.rfId}`});function QDt({id:t,variant:e=Mx.Dots,gap:n=20,size:r,lineWidth:s=1,offset:i=0,color:o,bgColor:l,style:c,className:d,patternClassName:u}){const h=y.useRef(null),{transform:m,patternId:f}=si(Qds,ko),p=r||Yds[e],g=e===Mx.Dots,v=e===Mx.Cross,b=Array.isArray(n)?n:[n,n],x=[b[0]*m[2]||1,b[1]*m[2]||1],w=p*m[2],k=Array.isArray(i)?i:[i,i],S=v?[w,w]:x,C=[k[0]*m[2]||1+S[0]/2,k[1]*m[2]||1+S[1]/2],j=`${f}${t||""}`;return a.jsxs("svg",{className:nc(["react-flow__background",d]),style:{...c,...mae,"--xy-background-color-props":l,"--xy-background-pattern-color-props":o},ref:h,"data-testid":"rf__background",children:[a.jsx("pattern",{id:j,x:m[0]%x[0],y:m[1]%x[1],width:x[0],height:x[1],patternUnits:"userSpaceOnUse",patternTransform:`translate(-${C[0]},-${C[1]})`,children:g?a.jsx(Kds,{radius:w/2,className:u}):a.jsx(qds,{dimensions:S,lineWidth:s,variant:e,className:u})}),a.jsx("rect",{x:"0",y:"0",width:"100%",height:"100%",fill:`url(#${j})`})]})}QDt.displayName="Background";const Zds=y.memo(QDt);function Jds(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 32",children:a.jsx("path",{d:"M32 18.133H18.133V32h-4.266V18.133H0v-4.266h13.867V0h4.266v13.867H32z"})})}function Xds(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 5",children:a.jsx("path",{d:"M0 0h32v4.2H0z"})})}function eus(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 30",children:a.jsx("path",{d:"M3.692 4.63c0-.53.4-.938.939-.938h5.215V0H4.708C2.13 0 0 2.054 0 4.63v5.216h3.692V4.631zM27.354 0h-5.2v3.692h5.17c.53 0 .984.4.984.939v5.215H32V4.631A4.624 4.624 0 0027.354 0zm.954 24.83c0 .532-.4.94-.939.94h-5.215v3.768h5.215c2.577 0 4.631-2.13 4.631-4.707v-5.139h-3.692v5.139zm-23.677.94c-.531 0-.939-.4-.939-.94v-5.138H0v5.139c0 2.577 2.13 4.707 4.708 4.707h5.138V25.77H4.631z"})})}function tus(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0 8 0 4.571 3.429 4.571 7.619v3.048H3.048A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047zm4.724-13.866H7.467V7.619c0-2.59 2.133-4.724 4.723-4.724 2.591 0 4.724 2.133 4.724 4.724v3.048z"})})}function nus(){return a.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 25 32",children:a.jsx("path",{d:"M21.333 10.667H19.81V7.619C19.81 3.429 16.38 0 12.19 0c-4.114 1.828-1.37 2.133.305 2.438 1.676.305 4.42 2.59 4.42 5.181v3.048H3.047A3.056 3.056 0 000 13.714v15.238A3.056 3.056 0 003.048 32h18.285a3.056 3.056 0 003.048-3.048V13.714a3.056 3.056 0 00-3.048-3.047zM12.19 24.533a3.056 3.056 0 01-3.047-3.047 3.056 3.056 0 013.047-3.048 3.056 3.056 0 013.048 3.048 3.056 3.056 0 01-3.048 3.047z"})})}function AH({children:t,className:e,...n}){return a.jsx("button",{type:"button",className:nc(["react-flow__controls-button",e]),...n,children:t})}const rus=t=>({isInteractive:t.nodesDraggable||t.nodesConnectable||t.elementsSelectable,minZoomReached:t.transform[2]<=t.minZoom,maxZoomReached:t.transform[2]>=t.maxZoom,ariaLabelConfig:t.ariaLabelConfig});function ZDt({style:t,showZoom:e=!0,showFitView:n=!0,showInteractive:r=!0,fitViewOptions:s,onZoomIn:i,onZoomOut:o,onFitView:l,onInteractiveChange:c,className:d,children:u,position:h="bottom-left",orientation:m="vertical","aria-label":f}){const p=To(),{isInteractive:g,minZoomReached:v,maxZoomReached:b,ariaLabelConfig:x}=si(rus,ko),{zoomIn:w,zoomOut:k,fitView:S}=CIe(),C=()=>{w(),i==null||i()},j=()=>{k(),o==null||o()},E=()=>{S(s),l==null||l()},N=()=>{p.setState({nodesDraggable:!g,nodesConnectable:!g,elementsSelectable:!g}),c==null||c(!g)},A=m==="horizontal"?"horizontal":"vertical";return a.jsxs(hae,{className:nc(["react-flow__controls",A,d]),position:h,style:t,"data-testid":"rf__controls","aria-label":f??x["controls.ariaLabel"],children:[e&&a.jsxs(a.Fragment,{children:[a.jsx(AH,{onClick:C,className:"react-flow__controls-zoomin",title:x["controls.zoomIn.ariaLabel"],"aria-label":x["controls.zoomIn.ariaLabel"],disabled:b,children:a.jsx(Jds,{})}),a.jsx(AH,{onClick:j,className:"react-flow__controls-zoomout",title:x["controls.zoomOut.ariaLabel"],"aria-label":x["controls.zoomOut.ariaLabel"],disabled:v,children:a.jsx(Xds,{})})]}),n&&a.jsx(AH,{className:"react-flow__controls-fitview",onClick:E,title:x["controls.fitView.ariaLabel"],"aria-label":x["controls.fitView.ariaLabel"],children:a.jsx(eus,{})}),r&&a.jsx(AH,{className:"react-flow__controls-interactive",onClick:N,title:x["controls.interactive.ariaLabel"],"aria-label":x["controls.interactive.ariaLabel"],children:g?a.jsx(nus,{}):a.jsx(tus,{})}),u]})}ZDt.displayName="Controls";y.memo(ZDt);function sus({id:t,x:e,y:n,width:r,height:s,style:i,color:o,strokeColor:l,strokeWidth:c,className:d,borderRadius:u,shapeRendering:h,selected:m,onClick:f}){const{background:p,backgroundColor:g}=i||{},v=o||p||g;return a.jsx("rect",{className:nc(["react-flow__minimap-node",{selected:m},d]),x:e,y:n,rx:u,ry:u,width:r,height:s,style:{fill:v,stroke:l,strokeWidth:c},shapeRendering:h,onClick:f?b=>f(b,t):void 0})}const ius=y.memo(sus),aus=t=>t.nodes.map(e=>e.id),She=t=>t instanceof Function?t:()=>t;function ous({nodeStrokeColor:t,nodeColor:e,nodeClassName:n="",nodeBorderRadius:r=5,nodeStrokeWidth:s,nodeComponent:i=ius,onClick:o}){const l=si(aus,ko),c=She(e),d=She(t),u=She(n),h=typeof window>"u"||window.chrome?"crispEdges":"geometricPrecision";return a.jsx(a.Fragment,{children:l.map(m=>a.jsx(cus,{id:m,nodeColorFunc:c,nodeStrokeColorFunc:d,nodeClassNameFunc:u,nodeBorderRadius:r,nodeStrokeWidth:s,NodeComponent:i,onClick:o,shapeRendering:h},m))})}function lus({id:t,nodeColorFunc:e,nodeStrokeColorFunc:n,nodeClassNameFunc:r,nodeBorderRadius:s,nodeStrokeWidth:i,shapeRendering:o,NodeComponent:l,onClick:c}){const{node:d,x:u,y:h,width:m,height:f}=si(p=>{const g=p.nodeLookup.get(t);if(!g)return{node:void 0,x:0,y:0,width:0,height:0};const v=g.internals.userNode,{x:b,y:x}=g.internals.positionAbsolute,{width:w,height:k}=W0(v);return{node:v,x:b,y:x,width:w,height:k}},ko);return!d||d.hidden||!J4t(d)?null:a.jsx(l,{x:u,y:h,width:m,height:f,style:d.style,selected:!!d.selected,className:r(d),color:e(d),borderRadius:s,strokeColor:n(d),strokeWidth:i,shapeRendering:o,onClick:c,id:d.id})}const cus=y.memo(lus);var dus=y.memo(ous);const uus=200,hus=150,mus=t=>!t.hidden,fus=t=>{const e={x:-t.transform[0]/t.transform[2],y:-t.transform[1]/t.transform[2],width:t.width/t.transform[2],height:t.height/t.transform[2]};return{viewBB:e,boundingRect:t.nodeLookup.size>0?Y4t(I9(t.nodeLookup,{filter:mus}),e):e,rfId:t.rfId,panZoom:t.panZoom,translateExtent:t.translateExtent,flowWidth:t.width,flowHeight:t.height,ariaLabelConfig:t.ariaLabelConfig}},pus="react-flow__minimap-desc";function JDt({style:t,className:e,nodeStrokeColor:n,nodeColor:r,nodeClassName:s="",nodeBorderRadius:i=5,nodeStrokeWidth:o,nodeComponent:l,bgColor:c,maskColor:d,maskStrokeColor:u,maskStrokeWidth:h,position:m="bottom-right",onClick:f,onNodeClick:p,pannable:g=!1,zoomable:v=!1,ariaLabel:b,inversePan:x,zoomStep:w=1,offsetScale:k=5}){const S=To(),C=y.useRef(null),{boundingRect:j,viewBB:E,rfId:N,panZoom:A,translateExtent:_,flowWidth:T,flowHeight:R,ariaLabelConfig:O}=si(fus,ko),F=(t==null?void 0:t.width)??uus,D=(t==null?void 0:t.height)??hus,I=j.width/F,P=j.height/D,M=Math.max(I,P),z=M*F,G=M*D,B=k*M,H=j.x-(z-j.width)/2-B,W=j.y-(G-j.height)/2-B,V=z+B*2,U=G+B*2,ne=`${pus}-${N}`,te=y.useRef(0),re=y.useRef();te.current=M,y.useEffect(()=>{if(C.current&&A)return re.current=xls({domNode:C.current,panZoom:A,getTransform:()=>S.getState().transform,getViewScale:()=>te.current}),()=>{var Y;(Y=re.current)==null||Y.destroy()}},[A]),y.useEffect(()=>{var Y;(Y=re.current)==null||Y.update({translateExtent:_,width:T,height:R,inversePan:x,pannable:g,zoomStep:w,zoomable:v})},[g,v,x,w,_,T,R]);const fe=f?Y=>{var ie;const[X,Q]=((ie=re.current)==null?void 0:ie.pointer(Y))||[0,0];f(Y,{x:X,y:Q})}:void 0,le=p?y.useCallback((Y,X)=>{const Q=S.getState().nodeLookup.get(X).internals.userNode;p(Y,Q)},[]):void 0,q=b??O["minimap.ariaLabel"];return a.jsx(hae,{position:m,style:{...t,"--xy-minimap-background-color-props":typeof c=="string"?c:void 0,"--xy-minimap-mask-background-color-props":typeof d=="string"?d:void 0,"--xy-minimap-mask-stroke-color-props":typeof u=="string"?u:void 0,"--xy-minimap-mask-stroke-width-props":typeof h=="number"?h*M:void 0,"--xy-minimap-node-background-color-props":typeof r=="string"?r:void 0,"--xy-minimap-node-stroke-color-props":typeof n=="string"?n:void 0,"--xy-minimap-node-stroke-width-props":typeof o=="number"?o:void 0},className:nc(["react-flow__minimap",e]),"data-testid":"rf__minimap",children:a.jsxs("svg",{width:F,height:D,viewBox:`${H} ${W} ${V} ${U}`,className:"react-flow__minimap-svg",role:"img","aria-labelledby":ne,ref:C,onClick:fe,children:[q&&a.jsx("title",{id:ne,children:q}),a.jsx(dus,{onClick:le,nodeColor:r,nodeStrokeColor:n,nodeBorderRadius:i,nodeClassName:s,nodeStrokeWidth:o,nodeComponent:l}),a.jsx("path",{className:"react-flow__minimap-mask",d:`M${H-B},${W-B}h${V+B*2}v${U+B*2}h${-V-B*2}z
        M${E.x},${E.y}h${E.width}v${E.height}h${-E.width}z`,fillRule:"evenodd",pointerEvents:"none"})]})})}JDt.displayName="MiniMap";y.memo(JDt);const gus=t=>e=>t?`${Math.max(1/e.transform[2],1)}`:void 0,vus={[Y5.Line]:"right",[Y5.Handle]:"bottom-right"};function yus({nodeId:t,position:e,variant:n=Y5.Handle,className:r,style:s=void 0,children:i,color:o,minWidth:l=10,minHeight:c=10,maxWidth:d=Number.MAX_VALUE,maxHeight:u=Number.MAX_VALUE,keepAspectRatio:h=!1,resizeDirection:m,autoScale:f=!0,shouldResize:p,onResizeStart:g,onResize:v,onResizeEnd:b}){const x=_Dt(),w=typeof t=="string"?t:x,k=To(),S=y.useRef(null),C=n===Y5.Handle,j=si(y.useCallback(gus(C&&f),[C,f]),ko),E=y.useRef(null),N=e??vus[n];y.useEffect(()=>{if(!(!S.current||!w))return E.current||(E.current=Ils({domNode:S.current,nodeId:w,getStoreItems:()=>{const{nodeLookup:_,transform:T,snapGrid:R,snapToGrid:O,nodeOrigin:F,domNode:D}=k.getState();return{nodeLookup:_,transform:T,snapGrid:R,snapToGrid:O,nodeOrigin:F,paneDomNode:D}},onChange:(_,T)=>{const{triggerNodeChanges:R,nodeLookup:O,parentLookup:F,nodeOrigin:D}=k.getState(),I=[],P={x:_.x,y:_.y},M=O.get(w);if(M&&M.expandParent&&M.parentId){const z=M.origin??D,G=_.width??M.measured.width??0,B=_.height??M.measured.height??0,H={id:M.id,parentId:M.parentId,rect:{width:G,height:B,...X4t({x:_.x??M.position.x,y:_.y??M.position.y},{width:G,height:B},M.parentId,O,z)}},W=SIe([H],O,F,D);I.push(...W),P.x=_.x?Math.max(z[0]*G,_.x):void 0,P.y=_.y?Math.max(z[1]*B,_.y):void 0}if(P.x!==void 0&&P.y!==void 0){const z={id:w,type:"position",position:{...P}};I.push(z)}if(_.width!==void 0&&_.height!==void 0){const G={id:w,type:"dimensions",resizing:!0,setAttributes:m?m==="horizontal"?"width":"height":!0,dimensions:{width:_.width,height:_.height}};I.push(G)}for(const z of T){const G={...z,type:"position"};I.push(G)}R(I)},onEnd:({width:_,height:T})=>{const R={id:w,type:"dimensions",resizing:!1,dimensions:{width:_,height:T}};k.getState().triggerNodeChanges([R])}})),E.current.update({controlPosition:N,boundaries:{minWidth:l,minHeight:c,maxWidth:d,maxHeight:u},keepAspectRatio:h,resizeDirection:m,onResizeStart:g,onResize:v,onResizeEnd:b,shouldResize:p}),()=>{var _;(_=E.current)==null||_.destroy()}},[N,l,c,d,u,h,g,v,b,p]);const A=N.split("-");return a.jsx("div",{className:nc(["react-flow__resize-control","nodrag",...A,n,r]),ref:S,style:{...s,scale:j,...o&&{[C?"backgroundColor":"borderColor"]:o}},children:i})}y.memo(yus);const bus={initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:-8,transition:{duration:.15}}},rL={initial:{opacity:0,x:-8},animate:{opacity:1,x:0},exit:{opacity:0,x:8,height:0,transition:{duration:.18}}};function Cl({open:t,onOpenChange:e,title:n,description:r,confirmLabel:s="Delete",onConfirm:i,destructive:o=!0}){return a.jsx(Kr,{open:t,onOpenChange:e,children:a.jsxs(Or,{className:"w-[calc(100vw-2rem)] rounded-lg",children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:n}),a.jsx(zr,{children:r})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:"Cancel"}),a.jsx(Yr,{onClick:i,className:o?"bg-destructive text-destructive-foreground hover:bg-destructive/90":"",children:s})]})]})})}function Bm({title:t,description:e,actions:n}){return a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-foreground",children:t}),e&&a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:e})]}),n&&a.jsx("div",{className:"flex flex-wrap items-center gap-2",children:n})]})}function sx({label:t,value:e,delta:n,hint:r,icon:s}){const i=(n??0)>=0;return a.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 shadow-card",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:t}),s&&a.jsx(s,{className:"h-4 w-4 text-muted-foreground"})]}),a.jsxs("div",{className:"mt-2 flex items-end justify-between",children:[a.jsx("span",{className:"text-2xl font-semibold text-foreground",children:e}),n!==void 0&&a.jsxs("span",{className:ee("flex items-center gap-0.5 text-xs font-medium",i?"text-success":"text-destructive"),children:[i?a.jsx(R8,{className:"h-3.5 w-3.5"}):a.jsx(Srt,{className:"h-3.5 w-3.5"}),Math.abs(n),"%"]})]}),r&&a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:r})]})}function q0({status:t}){return a.jsx("span",{className:ee("inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium capitalize",lgr(t)),children:t})}const xus={unsubscribe_link:"via unsubscribe link",settings:"in their settings",admin:"removed by an admin",left_community:"left the community",bounce:"email bounced",complaint:"marked as spam"};function wus({status:t,reason:e,at:n}){const r=e?xus[e]:null,s=n?new Date(n):null,i=s&&!Number.isNaN(s.getTime())?s.toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"}):null;return a.jsxs("span",{className:"inline-flex flex-col items-end gap-0.5",children:[a.jsx(q0,{status:t}),t==="Unsubscribed"&&(r||i)?a.jsx("span",{className:"text-[11px] text-muted-foreground",children:[r,i].filter(Boolean).join(" · ")}):null]})}function sL({progress:t,status:e,className:n}){const r=Number(t==null?void 0:t.total)||0;if(r<=0)return null;const s=Number(t==null?void 0:t.sent)||0;Number(t==null?void 0:t.queued);const i=Number(t==null?void 0:t.failed)||0,o=Number(t==null?void 0:t.percent)||0,l=gm(t,e);return a.jsxs("div",{className:ee("min-w-[10rem] space-y-1",n),children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs text-muted-foreground",children:[a.jsxs("span",{children:[l?"Sending":"Sent"," ",s.toLocaleString()," of ",r.toLocaleString()]}),a.jsxs("span",{className:"tabular-nums",children:[Math.round(o),"%"]})]}),a.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:a.jsx("div",{className:"h-full rounded-full bg-primary transition-all duration-500",style:{width:`${Math.min(100,Math.max(0,o))}%`}})}),i>0&&a.jsxs("p",{className:"text-[11px] text-destructive",children:[i.toLocaleString()," failed"]})]})}function Df({icon:t,title:e,description:n,action:r}){return a.jsxs("div",{className:"flex flex-col items-center justify-center rounded-xl border border-dashed border-border bg-card px-6 py-16 text-center",children:[a.jsx("div",{className:"flex h-14 w-14 items-center justify-center rounded-full bg-accent",children:a.jsx(t,{className:"h-7 w-7 text-accent-foreground"})}),a.jsx("h3",{className:"mt-4 text-base font-semibold text-foreground",children:e}),a.jsx("p",{className:"mt-1 max-w-sm text-sm text-muted-foreground",children:n}),r&&a.jsx("div",{className:"mt-5",children:r})]})}function FS({rows:t=6,columns:e=5}){return a.jsx("div",{className:"space-y-2 p-4",children:Array.from({length:t}).map((n,r)=>a.jsx("div",{className:"grid gap-3 rounded-lg border border-border/60 p-3",style:{gridTemplateColumns:`repeat(${e}, minmax(0, 1fr))`},children:Array.from({length:e}).map((s,i)=>a.jsx(sr,{className:ee("h-4",i===0?"w-4/5":"w-2/3 justify-self-end")},i))},r))})}function BS({title:t="Could not load this list",description:e="Something went wrong while loading the latest data.",onRetry:n}){return a.jsxs("div",{className:"flex flex-col items-center justify-center rounded-xl border border-dashed border-destructive/30 bg-destructive/5 px-6 py-12 text-center",children:[a.jsx("div",{className:"flex h-12 w-12 items-center justify-center rounded-full bg-destructive/10",children:a.jsx(tS,{className:"h-6 w-6 text-destructive"})}),a.jsx("h3",{className:"mt-3 text-sm font-semibold text-foreground",children:t}),a.jsx("p",{className:"mt-1 max-w-sm text-sm text-muted-foreground",children:e}),n&&a.jsxs(Z,{variant:"outline",size:"sm",className:"mt-4",onClick:n,children:[a.jsx(Nl,{className:"mr-1.5 h-4 w-4"})," Retry"]})]})}function US({page:t,limit:e,total:n,onPageChange:r}){const s=Math.max(1,e||10),i=Math.max(1,Math.ceil((n||0)/s)),o=n===0?0:(t-1)*s+1,l=Math.min(n,t*s);return a.jsxs("div",{className:"flex flex-col gap-2 border-t border-border px-4 py-3 text-xs text-muted-foreground sm:flex-row sm:items-center sm:justify-between",children:[a.jsx("span",{children:n===0?"No results":`Showing ${o}-${l} of ${n}`}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(Z,{variant:"outline",size:"sm",disabled:t<=1,onClick:()=>r(t-1),children:[a.jsx(no,{className:"mr-1.5 h-4 w-4"})," Previous"]}),a.jsxs("span",{className:"min-w-16 text-center",children:["Page ",t," of ",i]}),a.jsxs(Z,{variant:"outline",size:"sm",disabled:t>=i,onClick:()=>r(t+1),children:["Next ",a.jsx(xa,{className:"ml-1.5 h-4 w-4"})]})]})]})}function kus({data:t,height:e=220}){const r=e,s=36,i=24,o=(Math.max(...t.flatMap(h=>[h.current,h.previous]))||1)*1.15,l=Math.min(...t.flatMap(h=>[h.current,h.previous]))*.8,c=h=>s+h*(720-s*2)/(t.length-1),d=h=>i+(r-i*2)*(1-(h-l)/(o-l)),u=h=>t.map((m,f)=>`${f===0?"M":"L"} ${c(f)} ${d(m[h])}`).join(" ");return a.jsxs("svg",{viewBox:`0 0 720 ${r}`,className:"w-full",role:"img","aria-label":"Open rate trend",children:[a.jsx("defs",{children:a.jsxs("linearGradient",{id:"emArea",x1:"0",y1:"0",x2:"0",y2:"1",children:[a.jsx("stop",{offset:"0%",stopColor:"hsl(var(--primary))",stopOpacity:"0.18"}),a.jsx("stop",{offset:"100%",stopColor:"hsl(var(--primary))",stopOpacity:"0"})]})}),[0,.25,.5,.75,1].map(h=>a.jsx("line",{x1:s,x2:720-s,y1:i+h*(r-i*2),y2:i+h*(r-i*2),stroke:"hsl(var(--border))",strokeWidth:"1"},h)),a.jsx("path",{d:`${u("current")} L ${c(t.length-1)} ${r-i} L ${c(0)} ${r-i} Z`,fill:"url(#emArea)"}),a.jsx("path",{d:u("previous"),fill:"none",stroke:"hsl(var(--muted-foreground))",strokeWidth:"2",strokeDasharray:"4 4",opacity:"0.6"}),a.jsx("path",{d:u("current"),fill:"none",stroke:"hsl(var(--primary))",strokeWidth:"2.5"}),t.map((h,m)=>a.jsxs("g",{children:[a.jsx("circle",{cx:c(m),cy:d(h.current),r:"3.5",fill:"hsl(var(--primary))"}),a.jsx("text",{x:c(m),y:r-6,textAnchor:"middle",className:"fill-muted-foreground",fontSize:"11",children:h.day})]},h.day))]})}function Sus(t){const e=String(t||"").trim();if(!e)return"";const n=e.match(/<body[^>]*>([\s\S]*)<\/body>/i);return v0e((n?n[1]:e).trim())}function XDt({open:t,step:e,readOnly:n,onOpenChange:r,onSave:s,subjectHint:i="This is the inbox subject, not the sequence name.",title:o="Write email",description:l="Recipients see the subject in their inbox and the body as the message. Personalise with {{name}}, {{email}}, {{newsletter}}, {{campaign}} or {{tag}}.",variables:c,personalisationHint:d}){const[u,h]=y.useState(""),[m,f]=y.useState(""),[p,g]=y.useState(""),[v,b]=y.useState(""),x=u.trim().length,w=y.useRef(null),k=y.useRef(null),S=y.useRef("body"),C=y.useRef(null),j=y.useRef(null),E=()=>{const R=k.current;S.current="subject",R&&(C.current={start:R.selectionStart??R.value.length,end:R.selectionEnd??R.value.length})},N=R=>{var P;if(S.current==="body"){(P=w.current)==null||P.insertText(R);return}const O=C.current??{start:u.length,end:u.length},F=Math.min(O.start,u.length),D=Math.min(Math.max(O.end,F),u.length),I=u.slice(0,F)+R+u.slice(D);I.length>200||(j.current=F+R.length,C.current={start:j.current,end:j.current},h(I),p&&g(""))};y.useEffect(()=>{j.current===null||!k.current||(k.current.focus(),k.current.setSelectionRange(j.current,j.current),j.current=null)},[u]);const A=e?VZ(e):"",_=(e==null?void 0:e.html)??"";y.useEffect(()=>{t&&(h(A),f(Sus(_)),g(""),b(""))},[t,A,_]);const T=()=>{const R=u.trim();if(!R){g("Add a subject line.");return}if(!m.trim()){b("Write the email body.");return}s({subject:R,email:R,html:ePe(m)})};return a.jsx(Bt,{open:t,onOpenChange:r,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg max-h-[90vh] max-w-2xl overflow-y-auto",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:n?"Email":o}),a.jsx(_n,{children:l})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"email-step-subject",children:"Subject"}),a.jsx(Oe,{id:"email-step-subject",ref:k,onSelect:E,onKeyUp:E,onClick:E,onFocus:E,value:u,onChange:R=>{h(R.target.value),p&&g("")},placeholder:"What this email is about",autoFocus:!0,readOnly:n,maxLength:200}),p?a.jsx("p",{className:"text-xs font-medium text-destructive",children:p}):a.jsx("p",{className:"text-xs text-muted-foreground",children:x>60?"Getting long — most inboxes show about 50–60 characters.":x>=1?`${x} characters`:i})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{children:"Body"}),a.jsx(gn,{label:"Personalisation",children:d??a.jsxs(a.Fragment,{children:["Type these in the subject or the body and each person sees their own value."," {{name}}"," and ","{{email}}"," are the person. ","{{newsletter}}"," is the newsletter they signed up to. ","{{campaign}}"," is the campaign they opened or clicked. ","{{tag}}",' is the tag that started this sequence, or the tag an earlier "Add tag" step gave them. One that does not apply to this sequence shows as a dash.']})})]}),a.jsx("div",{onFocusCapture:()=>{S.current="body"},children:a.jsx(Du,{ref:w,value:m,onChange:R=>{f(R),v&&b("")},readOnly:n,placeholder:"Write the email they will receive…",editorClassName:"min-h-[200px] max-h-[320px]"})}),v&&a.jsx("p",{className:"text-xs font-medium text-destructive",children:v}),c&&!n&&a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5 pt-0.5",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:"Personalise:"}),c.map(R=>a.jsx("button",{type:"button",title:`Add ${R.token} at the cursor`,onMouseDown:O=>O.preventDefault(),onClick:()=>N(R.token),className:"rounded border border-border px-1.5 py-0.5 text-[11px] text-muted-foreground transition-colors hover:border-primary/40 hover:text-foreground",children:R.label},R.token))]})]})]}),a.jsxs(ir,{children:[a.jsx(Z,{type:"button",variant:"ghost",onClick:()=>r(!1),children:n?"Close":"Cancel"}),!n&&a.jsx(Z,{type:"button",onClick:T,children:"Save email"})]})]})})}function Cus({data:t}){var r;const e=(r=t.item)==null?void 0:r.icon,n=t.kind==="action"?"Add an action":t.audience?"Choose who it runs for":"Add a trigger";return a.jsxs("div",{className:"relative",children:[a.jsx(yE,{type:"target",position:kr.Top,className:"!opacity-0"}),a.jsx("span",{className:ee("absolute -top-6 left-1/2 -translate-x-1/2 rounded-full px-2 py-0.5 text-[11px] font-medium","bg-primary/10 text-primary"),children:t.kind==="action"?"Action":t.audience?"Audience":"⚡ Trigger"}),a.jsxs("button",{onClick:t.onClick,className:ee("flex w-[320px] items-center justify-between rounded-xl border bg-card px-4 py-3.5 text-left shadow-card transition-colors duration-150","border-border hover:border-primary/50"),children:[a.jsxs("span",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-muted text-foreground",children:e?a.jsx(e,{className:"h-4 w-4"}):a.jsx(Dn,{className:"h-4 w-4 text-muted-foreground"})}),a.jsx("span",{className:ee("text-sm font-medium",t.item?"text-foreground":"text-muted-foreground"),children:t.item?t.item.label:n})]}),t.configured&&a.jsx(yo,{className:"h-4 w-4 text-emerald-500"})]}),t.onRemove&&a.jsx("button",{type:"button",onClick:s=>{var i;s.stopPropagation(),(i=t.onRemove)==null||i.call(t)},"aria-label":`Remove step: ${t.item?t.item.label:"empty action"}`,title:"Remove this step",className:"nodrag absolute -right-10 top-1/2 flex h-7 w-7 -translate-y-1/2 items-center justify-center rounded-full border border-border bg-card text-muted-foreground shadow-sm transition-colors hover:border-destructive/50 hover:text-destructive",children:a.jsx(qn,{className:"h-3.5 w-3.5"})}),a.jsx(yE,{type:"source",position:kr.Bottom,className:"!opacity-0"})]})}function jus(){return a.jsxs("div",{className:"relative",children:[a.jsx(yE,{type:"target",position:kr.Top,className:"!opacity-0"}),a.jsxs("span",{className:"flex items-center gap-1.5 text-sm text-muted-foreground",children:[a.jsx(xd,{className:"h-4 w-4"})," End"]})]})}function Eus({id:t,sourceX:e,sourceY:n,targetX:r,targetY:s,data:i}){const[o]=yIe({sourceX:e,sourceY:n,targetX:r,targetY:s}),l=(e+r)/2,c=(n+s)/2;return a.jsxs(a.Fragment,{children:[a.jsx(D9,{id:t,path:o,style:{stroke:"hsl(var(--border))",strokeWidth:1.5}}),a.jsx(Wds,{children:a.jsx("button",{onClick:d=>{var u;d.stopPropagation(),(u=i==null?void 0:i.onInsert)==null||u.call(i)},style:{position:"absolute",transform:`translate(-50%, -50%) translate(${l}px, ${c}px)`,pointerEvents:"all"},className:"flex h-6 w-6 items-center justify-center rounded-full border border-border bg-card text-muted-foreground shadow-sm transition-colors hover:border-primary/50 hover:text-primary",children:a.jsx(Dn,{className:"h-3.5 w-3.5"})})})]})}const Nus={flow:Cus,end:jus},Tus={insert:Eus};function _us(){const t=Nn(),{workflowId:e}=So(),[n,r]=y.useState(()=>!e||fc.get(e)||!v4t(e)?"ready":"loading");return y.useEffect(()=>{if(n!=="loading"||!e)return;let s=!0;return fc.load(e).then(i=>{s&&r(i?"ready":"failed")}),()=>{s=!1}},[n,e]),n==="ready"?a.jsx(Aus,{}):a.jsx("div",{className:"fixed inset-0 z-50 flex flex-col items-center justify-center gap-4 bg-background px-6 text-center",children:n==="loading"?a.jsxs("p",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin","aria-hidden":"true"})," Opening workflow…"]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"max-w-sm text-sm text-muted-foreground",children:"This workflow could not be opened. It may have been deleted, or the connection dropped. Nothing was changed."}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{onClick:()=>r("loading"),className:"rounded-md border border-border px-3 py-1.5 text-sm font-medium text-foreground transition-colors hover:bg-muted",children:"Try again"}),a.jsx("button",{onClick:()=>t(ve.workflows),className:"rounded-md border border-border px-3 py-1.5 text-sm font-medium text-foreground transition-colors hover:bg-muted",children:"Back to workflows"})]})]})})}function Aus(){var G;const t=Nn(),{workflowId:e}=So(),n=e?fc.get(e):void 0,[r]=y.useState(()=>{const B=n??{id:e??"wf_new",name:"Automation",kind:"automation",status:"draft",runs:0,lastModified:"just now",nodes:[{id:"n1",kind:"trigger",itemId:null}]};return{...B,nodes:G$(B.name,B.nodes)}}),{toast:s}=yt(),[i,o]=y.useState(r.name),[l,c]=y.useState(r.nodes),[d,u]=y.useState(null),[h,m]=y.useState(!1),f=y.useRef(!1),[p,g]=y.useState(!1),[v,b]=y.useState(null),[x,w]=y.useState(()=>wJe(r.scheduledAt)),k=r.kind!=="automation",S=((G=l[0])==null?void 0:G.itemId)!=null,C=r.kind!=="scheduled"?null:x?new Date(x).getTime()<=Date.now()?"Choose a time in the future":null:"Choose when this workflow should run",j=Frs(r.kind,l)??C,E=!j&&!h;y.useEffect(()=>{S&&!l.some(B=>B.kind==="action")&&c(B=>[...B,{id:c8("n"),kind:"action",itemId:null}])},[S,l]);const N=y.useCallback(B=>{c(H=>{const W=H.findIndex(ne=>ne.id===B),V=[...H],U={id:c8("n"),kind:"action",itemId:null};return V.splice(W+1,0,U),V})},[]),A=y.useCallback(B=>{c(H=>H.filter(W=>W.id!==B)),u(H=>(H==null?void 0:H.stepId)===B?null:H)},[]),_=y.useCallback(B=>{B.itemId?b(B.id):A(B.id)},[A]),T=y.useCallback((B,H)=>{c(W=>W.map(V=>V.id===B?{...V,itemId:H}:V)),u({mode:"config",stepId:B})},[]),R=y.useCallback(B=>{u(B.itemId?{mode:"config",stepId:B.id}:{mode:"picker",stepId:B.id})},[]),{nodes:O,edges:F}=y.useMemo(()=>{const H=l.map((U,ne)=>({id:U.id,type:"flow",position:{x:0,y:ne*150},data:{kind:U.kind,audience:k,item:U.itemId?(U.kind==="trigger"?l4t[U.itemId]:sIe[U.itemId])??null:null,configured:U.itemId!=null,onClick:()=>R(U),onRemove:U.kind==="action"?()=>_(U):void 0},draggable:!1})),W="end";H.push({id:W,type:"end",position:{x:130,y:l.length*150},data:{},draggable:!1});const V=[];for(let U=0;U<l.length;U++){const ne=U<l.length-1?l[U+1].id:W;V.push({id:`e-${l[U].id}`,source:l[U].id,target:ne,type:"insert",data:{onInsert:()=>N(l[U].id)}})}return{nodes:H,edges:V}},[l,R,N,_,k]),D=B=>({...r,name:i,nodes:l,status:B,lastModified:"just now"}),I=()=>{fc.upsert(D(r.status))},P=async()=>{if(!f.current){f.current=!0,m(!0);try{const B=W=>s({title:"Not done yet",description:W,variant:"destructive"});if(r.kind==="scheduled"){const W=await fc.upsert(D(r.status));if(!W.ok)return B(W.message);const V=await fc.schedule(r.id,new Date(x).toISOString());if(!V.ok)return B(V.message)}const H=await fc.upsert(D("active"));if(!H.ok)return B(H.message);if(r.kind==="bulk"){const W=await fc.run(r.id);if(!W.ok)return B(W.message);s({title:"Workflow running",description:W.message})}else r.kind==="scheduled"?s({title:"Workflow scheduled",description:`It will run on ${new Date(x).toLocaleString()}.`}):s({title:"Workflow activated",description:"It will run each time its trigger happens."});t(ve.workflows)}finally{f.current=!1,m(!1)}}},M=r.kind==="bulk"?"Run now":r.kind==="scheduled"?"Schedule":"Activate",z=d?l.find(B=>B.id===d.stepId):void 0;return a.jsxs("div",{className:"fixed inset-0 z-50 flex flex-col bg-background",children:[a.jsxs("header",{className:"flex min-h-16 shrink-0 flex-wrap items-center justify-between gap-x-3 gap-y-2 border-b border-border px-3 py-2 sm:px-5 lg:h-16 lg:flex-nowrap lg:py-0",children:[a.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3 lg:flex-none",children:[a.jsx("button",{onClick:()=>{I(),t(ve.workflows)},className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-muted hover:text-foreground",children:a.jsx(no,{className:"h-4 w-4"})}),a.jsx("input",{value:i,onChange:B=>o(B.target.value),className:"min-w-0 flex-1 rounded-md bg-transparent px-1 text-lg font-semibold text-foreground outline-none focus:bg-muted/50 lg:w-[420px] lg:flex-none"})]}),a.jsxs("div",{className:"flex w-full items-center gap-3 lg:w-auto",children:[j&&a.jsx("p",{className:"max-w-xs text-xs text-muted-foreground lg:text-right",role:"status",children:j}),r.kind==="scheduled"&&a.jsxs("label",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:["Run on",a.jsx("input",{type:"datetime-local",value:x,min:wJe(new Date().toISOString()),onChange:B=>w(B.target.value),"aria-label":"When this workflow should run",className:"h-9 rounded-lg border border-border bg-card px-2 text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]}),a.jsx("button",{onClick:()=>r.kind==="bulk"?g(!0):void P(),disabled:!E,className:ee("ml-auto shrink-0 rounded-lg px-4 py-2 text-sm font-medium transition-colors",E?"bg-foreground text-background hover:bg-foreground/90":"cursor-not-allowed bg-muted text-muted-foreground"),children:h?"Working…":M})]})]}),a.jsx(Cl,{open:p,onOpenChange:g,title:"Run this workflow now?",description:"It starts straight away for everyone it is aimed at, and messages that have been sent cannot be recalled. Members who have already been through this workflow are skipped.",confirmLabel:"Run now",destructive:!1,onConfirm:()=>{g(!1),P()}}),a.jsx(Cl,{open:v!==null,onOpenChange:B=>{B||b(null)},title:"Remove this step?",description:"The step and what you set up in it, such as its email or message, are removed from this workflow. Nothing changes for members until you save.",confirmLabel:"Remove step",onConfirm:()=>{v&&A(v),b(null)}}),a.jsxs("div",{className:"relative flex-1",children:[a.jsx(Hds,{nodes:O,edges:F,nodeTypes:Nus,edgeTypes:Tus,fitView:!0,fitViewOptions:{padding:.4,maxZoom:1},nodesDraggable:!1,nodesConnectable:!1,selectNodesOnDrag:!1,onNodeClick:(B,H)=>{const W=l.find(V=>V.id===H.id);W&&R(W)},proOptions:{hideAttribution:!0},minZoom:.4,maxZoom:1.5,children:a.jsx(Zds,{variant:Mx.Dots,gap:20,size:1.5,color:"hsl(var(--border))"})}),a.jsx(Al,{children:d&&z&&a.jsx(it.aside,{initial:{x:"100%"},animate:{x:0},exit:{x:"100%"},transition:{type:"tween",duration:.22,ease:"easeOut"},className:"absolute right-0 top-0 flex h-full w-full max-w-[380px] flex-col border-l border-border bg-card shadow-xl",children:d.mode==="picker"?a.jsx(Pus,{kind:z.kind,audience:k,onClose:()=>u(null),onPick:B=>T(z.id,B)}):a.jsx(Rus,{step:z,audience:k,onClose:()=>u(null),onChange:()=>u({mode:"picker",stepId:z.id}),onDelete:z.kind==="action"?()=>_(z):void 0,onContinue:()=>u(null),onSetConfig:B=>c(H=>H.map(W=>W.id===z.id?{...W,config:B}:W))})},d.mode+d.stepId)})]})]})}function Pus({kind:t,audience:e,onClose:n,onPick:r}){const[s,i]=y.useState(""),o=t==="action"?o4t:e?rIe:a4t,l=t==="action"?"action":e?"audience":"trigger",c=o.map(d=>({...d,items:d.items.filter(u=>u.label.toLowerCase().includes(s.toLowerCase()))})).filter(d=>d.items.length);return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-start justify-between border-b border-border p-5",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:l==="audience"?"Who it runs for":`Workflow ${l}s`}),a.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:l==="audience"?"Choose the members this workflow should run for.":`Select ${l==="action"?"an action":"a trigger"} from the below list to get started.`})]}),a.jsx("button",{onClick:n,className:"text-muted-foreground hover:text-foreground",children:a.jsx(nn,{className:"h-4 w-4"})})]}),a.jsx("div",{className:"border-b border-border p-4",children:a.jsxs("div",{className:"relative",children:[a.jsx(hs,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx("input",{value:s,onChange:d=>i(d.target.value),placeholder:`Search ${l}s`,className:"h-9 w-full rounded-lg border border-border bg-card pl-9 pr-3 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"})]})}),a.jsxs("div",{className:"flex-1 space-y-5 overflow-y-auto p-4",children:[c.map(d=>a.jsxs("div",{children:[a.jsx("p",{className:"mb-1.5 text-xs text-muted-foreground",children:d.group}),a.jsx("div",{className:"space-y-1",children:d.items.map(u=>a.jsxs("button",{onClick:()=>r(u.id),className:"flex w-full items-center gap-3 rounded-lg border border-transparent px-2 py-2 text-left transition-colors duration-150 hover:border-border hover:bg-muted/50",children:[a.jsx("span",{className:ee("flex h-8 w-8 shrink-0 items-center justify-center rounded-lg",u.accent==="ai"?"bg-primary/10 text-primary":"bg-muted text-foreground"),children:a.jsx(u.icon,{className:"h-4 w-4"})}),a.jsx("span",{className:"text-sm font-medium text-foreground",children:u.label})]},u.id))})]},d.group)),c.length===0&&a.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No matches."})]})]})}function Rus({step:t,audience:e,onClose:n,onChange:r,onDelete:s,onContinue:i,onSetConfig:o}){const l=t.itemId?t.kind==="trigger"?l4t[t.itemId]:sIe[t.itemId]:null,c=(t.kind==="trigger"?Prs[t.itemId??""]:Ars[t.itemId??""])??[],[d,u]=y.useState(t.config??{}),h=f=>{const p={...d,...f};u(p),o(p)},m=(f,p)=>h({[f]:p});return l?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-border p-5",children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:t.kind==="action"?"Action details":e?"Audience details":"Trigger details"}),a.jsxs("div",{className:"flex items-center gap-2",children:[s&&a.jsx("button",{onClick:s,"aria-label":"Remove this step",title:"Remove this step",className:"text-muted-foreground hover:text-destructive",children:a.jsx(qn,{className:"h-4 w-4"})}),a.jsx("button",{onClick:n,className:"text-muted-foreground hover:text-foreground",children:a.jsx(nn,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"flex-1 space-y-6 overflow-y-auto p-5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"flex items-center gap-2.5",children:[a.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-lg bg-muted text-foreground",children:a.jsx(l.icon,{className:"h-4 w-4"})}),a.jsx("span",{className:"text-sm font-medium text-foreground",children:l.label})]}),a.jsx("button",{onClick:r,className:"rounded-md border border-border px-2.5 py-1 text-xs font-medium text-foreground transition-colors hover:bg-muted/50",children:"Change"})]}),t.kind==="trigger"&&t.itemId&&fZe[t.itemId]&&a.jsx("p",{className:"rounded-lg bg-muted/50 p-3 text-sm text-muted-foreground",children:fZe[t.itemId]}),a.jsxs("div",{children:[a.jsx("p",{className:"mb-2 text-sm font-semibold text-foreground",children:"Inputs"}),c.length===0?a.jsx("div",{className:"rounded-lg bg-muted/50 p-3 text-sm text-muted-foreground",children:"Nothing to set up here."}):a.jsx("div",{className:"space-y-4",children:c.map(f=>a.jsx(Ius,{field:f,value:d[f.key]??"",onChange:p=>m(f.key,p),config:d,onPatch:h},f.key))})]})]}),a.jsxs("div",{className:"flex items-center justify-end gap-3 border-t border-border p-4",children:[a.jsx("button",{onClick:n,className:"rounded-lg px-4 py-2 text-sm font-medium text-muted-foreground hover:bg-muted hover:text-foreground",children:"Cancel"}),a.jsx("button",{onClick:i,className:"rounded-lg bg-foreground px-4 py-2 text-sm font-medium text-background hover:bg-foreground/90",children:"Continue"})]})]}):null}function Ius({field:t,value:e,onChange:n,config:r,onPatch:s}){const i=a.jsxs("div",{className:"mb-1.5 flex items-center justify-between",children:[a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsxs("label",{className:"text-sm font-medium text-foreground",children:[t.label,"optional"in t&&t.optional&&a.jsx("span",{className:"text-muted-foreground",children:" (Optional)"})]}),"hint"in t&&t.hint&&a.jsx(gn,{label:t.label,children:t.hint})]}),t.kind==="text"&&t.max&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:[e.length," / ",t.max]})]});return t.kind==="course"?a.jsx(Uus,{field:t,value:e,onChange:n}):t.kind==="plan"?a.jsx(zus,{field:t,value:e,onChange:n}):t.kind==="email"?a.jsx(Dus,{field:t,label:i,config:r,onPatch:s}):t.kind==="formLink"?a.jsx($us,{label:i,value:e,onChange:n,config:r}):t.kind==="space"?a.jsx(Bus,{label:i,value:e,onChange:n}):t.kind==="duration"?a.jsx(Fus,{label:i,value:e,onChange:n}):t.kind==="select"?a.jsxs("div",{children:[i,a.jsx("select",{value:e||t.options[0].value,onChange:o=>n(o.target.value),"aria-label":t.label,className:"h-10 w-full rounded-lg border border-border bg-card px-3 text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-ring",children:t.options.map(o=>a.jsx("option",{value:o.value,children:o.label},o.value))})]}):t.kind==="number"?a.jsxs("div",{children:[i,a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"number",inputMode:"numeric",min:t.min,max:t.max,value:e,placeholder:t.placeholder,onChange:o=>{const l=o.target.value.replace(/\D/g,"");n(l===""?"":String(Math.min(Number(l),t.max)))},"aria-label":t.label,className:"h-10 w-32 rounded-lg border border-border bg-card px-3 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),t.unit&&a.jsx("span",{className:"text-sm text-muted-foreground",children:t.unit})]})]}):a.jsx(Mus,{field:t,label:i,value:e,onChange:n})}function Mus({field:t,label:e,value:n,onChange:r}){const s=y.useRef(null),i=y.useRef(null),o=y.useRef(null),l=()=>{const h=s.current;h&&(i.current={start:h.selectionStart??h.value.length,end:h.selectionEnd??h.value.length})},c=h=>{const m=i.current??{start:n.length,end:n.length},f=Math.min(m.start,n.length),p=Math.min(Math.max(m.end,f),n.length),g=n.slice(0,f)+h+n.slice(p);t.kind==="text"&&t.max&&g.length>t.max||(o.current=f+h.length,i.current={start:o.current,end:o.current},r(g))};y.useLayoutEffect(()=>{o.current===null||!s.current||(s.current.focus(),s.current.setSelectionRange(o.current,o.current),o.current=null)},[n]);const d={ref:s,value:n,placeholder:t.placeholder,"aria-label":t.label,onChange:h=>r(h.target.value),onSelect:l,onKeyUp:l,onClick:l,onBlur:l},u="w-full rounded-lg border border-border bg-card px-3 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring";return a.jsxs("div",{children:[e,t.kind==="textarea"?a.jsx("textarea",{...d,rows:6,className:ee(u,"py-2")}):a.jsx("input",{...d,maxLength:t.max,className:ee(u,"h-10")}),t.mergeTags&&a.jsx(Ous,{value:n,onInsert:c})]})}function Lus(t){const e=t.replace(/>\s+</g,"><").replace(/<br\s*\/?>|<\/li>/gi,`$&
`).replace(/<\/(p|div|h[1-6]|blockquote|pre|ul|ol)>/gi,`$&

`);return(new DOMParser().parseFromString(e,"text/html").body.textContent??"").replace(/[ \t]+\n/g,`
`).replace(/\n{3,}/g,`

`).trim()}function Dus({field:t,label:e,config:n,onPatch:r}){const[s,i]=y.useState(!1),o=n[t.key]??"",l=n[t.htmlKey]||(o?ePe(o):""),c=d4t(`${n.subject??""} ${o}`,{email:!0});return a.jsxs("div",{children:[e,a.jsxs("div",{className:"rounded-lg border border-border bg-card p-3",children:[o.trim()?a.jsx("p",{className:"line-clamp-4 whitespace-pre-line text-sm text-foreground",children:o}):a.jsx("p",{className:"text-sm text-muted-foreground",children:"No email written yet."}),a.jsxs("button",{type:"button",onClick:()=>i(!0),className:"mt-2.5 inline-flex items-center gap-1.5 rounded-md border border-border px-2.5 py-1.5 text-xs font-medium text-foreground transition-colors hover:bg-muted/50",children:[a.jsx(Qs,{className:"h-3.5 w-3.5"}),o.trim()?"Edit email":"Write email"]})]}),c.length>0&&a.jsxs("p",{className:"mt-1.5 text-xs font-medium text-destructive",role:"alert",children:[c.join(", ")," ",c.length===1?"is not a variable":"are not variables"," we can fill in, so"," ",c.length===1?"it":"they"," will be left blank. Open the email and use a Personalise button."]}),a.jsx(XDt,{open:s,step:s?{subject:n.subject??"",html:l}:null,readOnly:!1,title:"Write email",description:"Members see the subject in their inbox and the body as the message. Format it with the toolbar, and add a member's own details with the Personalise buttons.",subjectHint:"What members see in their inbox.",variables:Irs,personalisationHint:a.jsx(a.Fragment,{children:"Click a Personalise button to add a variable where your cursor is, in the subject or the body. Each member sees their own value: their first name, full name or email address, your community's name, or the title of the post in a workflow that starts from a post. Form link becomes the link you set on this step, under the email body. These are the only ones available; anything else in double braces is left blank."}),onOpenChange:i,onSave:d=>{const u=d.html??"";r({subject:d.subject??"",[t.htmlKey]:u,[t.key]:Lus(u)}),i(!1)}})]})}function $us({label:t,value:e,onChange:n,config:r}){var d,u;const{community:s}=qe(),i=(((d=HAe((s==null?void 0:s.id)??null).data)==null?void 0:d.data)??[]).filter(h=>h.status==="published"),o=h=>`${window.location.origin}${ve.formPublic(h)}`,l=((u=i.find(h=>o(h.id)===e.trim()))==null?void 0:u.id)??"",c=u4t(r);return a.jsxs("div",{children:[t,a.jsx("input",{type:"url",inputMode:"url",value:e,maxLength:2e3,onChange:h=>n(h.target.value),placeholder:"https://forms.gle/…","aria-label":"Form link","aria-invalid":!!c,className:"h-10 w-full rounded-lg border border-border bg-card px-3 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),i.length>0&&a.jsxs("select",{value:l,onChange:h=>h.target.value&&n(o(h.target.value)),"aria-label":"Use one of your Email Marketing forms",className:"mt-2 h-9 w-full rounded-lg border border-border bg-card px-3 text-xs text-foreground focus:outline-none focus:ring-1 focus:ring-ring",children:[a.jsx("option",{value:"",children:"Or use one of your Email Marketing forms…"}),i.map(h=>a.jsx("option",{value:h.id,children:h.name},h.id))]}),c&&a.jsxs("p",{className:"mt-1.5 text-xs font-medium text-destructive",role:"alert",children:["This email ",c,"."]})]})}function Ous({value:t,onInsert:e}){const n=d4t(t);return a.jsxs("div",{className:"mt-1.5 space-y-1.5",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-1.5",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:"Personalise:"}),c4t.map(r=>a.jsx("button",{type:"button",title:`Add ${r.token} at the cursor`,onMouseDown:s=>s.preventDefault(),onClick:()=>e(r.token),className:"rounded border border-border px-1.5 py-0.5 text-[11px] text-muted-foreground transition-colors hover:border-primary/40 hover:text-foreground",children:r.label},r.token)),a.jsxs(gn,{label:"Personalisation",children:["Click a button to add its variable where your cursor is. Each member sees their own value in place of a variable: ","{{member.first_name}}"," becomes their first name, ","{{name}}"," their full name, ","{{email}}"," their email address and"," {{community}}"," your community's name. ","{{post}}"," is the title of the post, in a workflow that starts from a post, and blank otherwise. These are the only ones available."]})]}),n.length>0&&a.jsxs("p",{className:"text-xs font-medium text-destructive",role:"alert",children:[n.join(", ")," ",n.length===1?"is not a variable":"are not variables"," we can fill in, so"," ",n.length===1?"it":"they"," will be left blank. Use one of the buttons above."]})]})}const bJe=["minutes","hours","days","weeks"],xJe="1 days";function Fus({label:t,value:e,onChange:n}){const[r,s]=(e||xJe).split(" ");return y.useEffect(()=>{e||n(xJe)},[e,n]),a.jsxs("div",{children:[t,a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{type:"number",min:1,value:r,onChange:i=>n(`${Math.max(1,Number(i.target.value.replace(/\D/g,""))||1)} ${s}`),"aria-label":"How long to wait",className:"h-10 w-20 rounded-lg border border-border bg-card px-3 text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),a.jsx("select",{value:bJe.includes(s)?s:"days",onChange:i=>n(`${r} ${i.target.value}`),"aria-label":"Unit of time",className:"h-10 flex-1 rounded-lg border border-border bg-card px-3 text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-ring",children:bJe.map(i=>a.jsx("option",{value:i,children:i},i))})]})]})}function Bus({label:t,value:e,onChange:n}){const{groups:r,groupsLoading:s}=Ln();return a.jsxs("div",{children:[t,a.jsxs("select",{value:e,onChange:i=>n(i.target.value),disabled:s,"aria-label":"Space",className:"h-10 w-full rounded-lg border border-border bg-card px-3 text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-ring",children:[a.jsx("option",{value:"",children:s?"Loading spaces…":"Choose a space"}),r.map(i=>a.jsx("option",{value:i.id,children:i.name},i.id))]}),!s&&r.length===0&&a.jsx("p",{className:"mt-1.5 text-xs text-muted-foreground",children:"This community has no spaces yet."})]})}function Uus({field:t,value:e,onChange:n}){const{data:r,isLoading:s}=REt(),i=(r==null?void 0:r.courses)??[];return a.jsxs("div",{children:[a.jsx("div",{className:"mb-1.5 flex items-center justify-between",children:a.jsxs("label",{className:"text-sm font-medium text-foreground",children:[t.label,t.optional?a.jsx("span",{className:"text-muted-foreground",children:" (Optional)"}):null]})}),a.jsxs("select",{value:e,onChange:o=>n(o.target.value),disabled:s,className:"h-10 w-full rounded-lg border border-border bg-card px-3 text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-ring",children:[a.jsx("option",{value:"",children:t.placeholder??"Any course"}),i.map(o=>a.jsx("option",{value:o.id,children:o.title},o.id))]}),a.jsx("p",{className:"mt-1.5 text-xs text-muted-foreground",children:"Leave blank to reward every course once. Pick a course to reward that course only."})]})}function zus({field:t,value:e,onChange:n}){const{plans:r,isLoading:s}=PN(),i=r.filter(o=>(o.subscriptionAmount??0)>0&&(!o.isDeleted||o.id===e));return a.jsxs("div",{children:[a.jsx("div",{className:"mb-1.5 flex items-center justify-between",children:a.jsxs("label",{className:"text-sm font-medium text-foreground",children:[t.label,t.optional?a.jsx("span",{className:"text-muted-foreground",children:" (Optional)"}):null]})}),a.jsxs("select",{value:e,onChange:o=>n(o.target.value),disabled:s,"aria-label":t.label,className:"h-10 w-full rounded-lg border border-border bg-card px-3 text-sm text-foreground focus:outline-none focus:ring-1 focus:ring-ring",children:[a.jsx("option",{value:"",children:t.placeholder??"Any paid plan"}),i.map(o=>a.jsx("option",{value:o.id,children:o.name},o.id))]}),a.jsx("p",{className:"mt-1.5 text-xs text-muted-foreground",children:"Leave blank to run for every paid plan. Pick a plan to run only when that plan is bought."})]})}function wJe(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":new Date(e.getTime()-e.getTimezoneOffset()*6e4).toISOString().slice(0,16)}function Vus(t){const e=t.trim().toLowerCase();return e.startsWith("<!doctype")||e.startsWith("<html")}function Hus(t){return/^\s*<iframe\b/i.test(t)}function Gus(t){const e=t.trim();if(!e)return"";if(Vus(e))return e;const n="<style>html,body{margin:0;height:100%;}iframe{border:0;width:100%;height:100%;}</style>";if(Hus(e))return`<!DOCTYPE html><html><head><meta charset="utf-8">${n}</head><body>${e}</body></html>`;if(/^https?:\/\//i.test(e)){const r=e.replace(/"/g,"&quot;");return`<!DOCTYPE html><html><head><meta charset="utf-8">${n}</head><body><iframe src="${r}" title="Embedded content" allowfullscreen></iframe></body></html>`}return`<!DOCTYPE html><html><head><meta charset="utf-8"><style>html,body{margin:0;}</style></head><body>${e}</body></html>`}function Wus({embedCode:t="",user:e,communityRole:n,hasAuthTokenEmbedEnabled:r=!1}){if(!t)return"";let s=t;return e&&(s=s.replace(/\{\{userFullName\}\}/g,e.name??"").replace(/\{\{userEmail\}\}/g,e.email??"").replace(/\{\{userId\}\}/g,e.id??"").replace(/\{\{userMobile\}\}/g,e.mobile??"").replace(/\{\{countryCode\}\}/g,e.countryCode??"").replace(/\{\{communityRole\}\}/g,n??""),r&&e.token&&(s=s.replace(/\{\{authToken\}\}/g,e.token))),Gus(s)}function e$t({embeddedSection:t,className:e}){var i;const{community:n}=qe(),{communityDetail:r}=Ln(),s=y.useMemo(()=>{const o=ro();return Wus({embedCode:t.embedCode,user:o,communityRole:(n==null?void 0:n.myRole)??null,hasAuthTokenEmbedEnabled:ql(r,"hasAuthTokenEmbedEnabled")})},[n==null?void 0:n.myRole,r,t.embedCode]);return(i=t.embedCode)!=null&&i.trim()?a.jsx("iframe",{title:t.name,srcDoc:s,className:e??"w-full rounded-lg border border-border bg-background",style:{width:"100%",height:"calc(100vh - 150px)",minHeight:320}}):a.jsx("div",{className:"flex min-h-[240px] items-center justify-center rounded-lg border border-dashed border-border bg-muted/30 p-8 text-center text-sm text-muted-foreground",children:"No embed code configured for this channel."})}function qus(){var l;const{slug:t}=So(),{community:e}=qe(),{isAuthenticated:n}=jr(),r=(e==null?void 0:e.id)??null,{data:s,isPending:i,isError:o}=lt({queryKey:["embedded-section",r,t],enabled:!!(r&&t),queryFn:()=>Ffr(r,t)});return n?!r||i?a.jsx("div",{className:"flex min-h-[40vh] items-center justify-center text-muted-foreground",children:a.jsx(Ne,{className:"h-5 w-5 animate-spin"})}):o||!((l=s==null?void 0:s.embedCode)!=null&&l.trim())?a.jsx("div",{className:"flex min-h-[40vh] items-center justify-center text-sm text-muted-foreground",children:"This embedded channel could not be loaded."}):a.jsxs("div",{className:"mx-auto w-full max-w-5xl",children:[a.jsx("h1",{className:"mb-4 text-lg font-semibold text-foreground",children:s.name}),a.jsx(e$t,{embeddedSection:s})]}):a.jsx("div",{className:"flex min-h-[40vh] items-center justify-center text-sm text-muted-foreground",children:"Please sign in to view this channel."})}function t$t(t=1e3,e=!0){const[n,r]=y.useState(()=>Date.now());return y.useEffect(()=>{if(!e)return;const s=()=>r(Date.now());s();const i=window.setInterval(s,t),o=()=>{document.visibilityState==="visible"&&s()};return document.addEventListener("visibilitychange",o),()=>{window.clearInterval(i),document.removeEventListener("visibilitychange",o)}},[t,e]),n}function EIe(t){return Out(t,{mentions:!0})}const Kus={webinar:"bg-destructive/10 text-destructive border-destructive/20",match:"bg-primary/10 text-primary border-primary/20",training:"bg-[hsl(var(--success))]/10 text-[hsl(var(--success))] border-[hsl(var(--success))]/20",social:"bg-[hsl(var(--warning))]/10 text-[hsl(var(--warning))] border-[hsl(var(--warning))]/20"},Yus={webinar:"🔴 Online",match:"⚽ Match Day",training:"🏋️ Training",social:"📍 In person"};function kJe(t){return t.split(" ").map(e=>e[0]).filter(Boolean).slice(0,2).join("")}function SJe(){const{eventId:t,slug:e}=So(),n=Nn(),{toast:r}=yt(),{community:s}=qe(),{user:i}=jr(),{communityDetail:o}=Ln(),{event:l,isLoading:c,error:d,rsvpPending:u,setRsvp:h,acceptInvitation:m,rejectInvitation:f,refetch:p,refresh:g}=O3r({id:t,slug:e}),[v,b]=y.useState(!1),[x,w]=y.useState(!1),[k,S]=y.useState(!1),[C,j]=y.useState(!1),[E,N]=y.useState(!1),[A,_]=y.useState(!1),[T,R]=y.useState(!1),[O,F]=y.useState(""),[D,I]=y.useState(!1);y.useEffect(()=>{F("")},[t,e]);const P=XB("Sign in to register for this event"),M=l?_ge(l.startTime,l.endTime,l.meetingUnavailable):null,z=t$t(1e3,!!l&&M!=="ended"),G=l?_ge(l.startTime,l.endTime,l.meetingUnavailable,z):null,B=y.useRef(G);if(y.useEffect(()=>{B.current&&G&&B.current!==G&&g(),B.current=G},[G,g]),y.useEffect(()=>{const Pe=()=>{document.visibilityState==="visible"&&g()};return document.addEventListener("visibilitychange",Pe),()=>document.removeEventListener("visibilitychange",Pe)},[g]),c)return a.jsx("div",{className:"flex items-center justify-center py-24 text-muted-foreground",children:a.jsx(Ne,{className:"h-6 w-6 animate-spin"})});if(!l||d)return a.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[a.jsx("h2",{className:"text-xl font-semibold text-foreground mb-2",children:"Event not found"}),a.jsx("p",{className:"text-muted-foreground mb-4",children:d&&d!=="not-found"?d:"The event you're looking for doesn't exist."}),a.jsx(Z,{onClick:()=>n("/calendar"),children:"Back to Events"})]});const H=G,W=H==="ended",V=l.isOnline&&H==="live",U=l.myCommunityRole==="admin",ne=l.myRSVPStatus,te=ne==="going",re=ne==="maybe",fe=ne==="invited",le=!!(i!=null&&i.id&&l.hostId&&i.id===l.hostId),q=te||re||le||U||l.passwordRequired&&l.entryVerified,Y=W?"":hcn(l.startTime,z),X=l.maximumRegistrations>0&&l.attendees>=l.maximumRegistrations&&!te,Q=async()=>{const Pe=l.slug?`${window.location.origin}/e/${l.slug}`:window.location.href;await kN(Pe)?r({title:"Link copied",description:"Event link copied to clipboard."}):r({title:"Couldn't copy link",description:Pe,variant:"destructive"})},ie=()=>{if(l.liveCallMeetingId){n(M0e(l.liveCallMeetingId));return}l.webURL&&window.open(l.webURL,"_blank","noopener,noreferrer")},he=Pe=>{P()&&h(Pe)},ye=()=>{P()&&m()},J=()=>{P()&&f()},K=async()=>{var Pe,Ke;if(P()){if(!l.audienceRestricted)return ie();if(s!=null&&s.id){I(!0);try{const{event:De}=await GHe(s.id,l.realId),xt=((Pe=De.liveCall)==null?void 0:Pe.meetingId)||((Ke=De.liveMeeting)==null?void 0:Ke.meetingId);xt?n(M0e(xt)):De.webURL&&window.open(De.webURL,"_blank","noopener,noreferrer")}catch(De){r({title:"Couldn't join event",description:De instanceof ze?De.message:"Please verify event access again.",variant:"destructive"}),p()}finally{I(!1)}}}},ce=async()=>{if(!(!(s!=null&&s.id)||!P())){I(!0);try{await GHe(s.id,l.realId,O),F(""),await p()}catch(Pe){r({title:"Couldn't verify password",description:Pe instanceof ze?Pe.message:"Please try again.",variant:"destructive"})}finally{I(!1)}}},pe=()=>{const Pe=(o==null?void 0:o.timezone)||l.timezone.split(" ")[0],Ke=l.liveCallMeetingId?Zxr(l.liveCallMeetingId):l.webURL;window.open(mcn({title:l.title,description:l.description,startTime:l.startTime,endTime:l.endTime,location:l.location,timezone:Pe,meetingUrl:Ke}),"_blank","noopener,noreferrer")},Ie=async Pe=>{if(s!=null&&s.id){N(!0);try{await $At(s.id,l.realId,{deleteAll:C,notifyUser:Pe}),r({title:"Event deleted"}),n("/calendar")}catch(Ke){r({title:"Couldn't delete event",description:Ke instanceof ze?Ke.message:void 0,variant:"destructive"}),N(!1),w(!1),S(!1)}}},Me=()=>{if(W){Ie(!1);return}w(!1),S(!0)},we=()=>Me(),Be=[{icon:ym,label:"Date",value:l.date},{icon:ja,label:"Time",value:`${l.time} · ${l.timezone}`},{icon:Jf,label:"Location",value:l.location||"—"},{icon:ja,label:"Duration",value:l.duration}],Ve=l.attendeesList.slice(0,12),be=Math.max(0,l.attendees-Ve.length),Ze=l.maximumRegistrations>0?`${l.attendees} / ${l.maximumRegistrations} registered`:`${l.attendees} registered`;return a.jsxs(it.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.3},className:"max-w-5xl mx-auto py-6 px-4",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("button",{onClick:()=>n("/calendar"),className:"flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors",children:[a.jsx(no,{className:"h-4 w-4"}),"Back to Events"]}),(U||l.canEdit||l.canDelete)&&a.jsxs("div",{className:"flex items-center gap-2",children:[U&&a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>_(!0),disabled:l.audienceRestricted&&!U,children:[a.jsx(_s,{className:"h-3.5 w-3.5 mr-1.5"}),"Share to channels"]}),l.canEdit&&a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>b(!0),children:[a.jsx(Qs,{className:"h-3.5 w-3.5 mr-1.5"}),"Edit"]}),l.canDelete&&a.jsxs(Z,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>{j(!1),w(!0)},children:[a.jsx(qn,{className:"h-3.5 w-3.5 mr-1.5"}),"Delete"]}),l.canEdit&&l.isRecurringParent&&a.jsx(Z,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>{j(!0),w(!0)},children:"Delete series"})]})]}),a.jsxs(it.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.1},className:"relative rounded-xl overflow-hidden mb-4 aspect-[2.6/1] bg-muted",children:[l.hasBanner?a.jsx("img",{src:l.thumbnail,alt:l.title,className:"w-full h-full object-cover"}):a.jsx("div",{className:"w-full h-full bg-gradient-to-br from-primary/30 via-primary/10 to-background"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/70 via-black/10 to-transparent"}),a.jsxs("div",{className:"absolute bottom-4 left-5 right-5",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2 mb-2",children:[a.jsx(ga,{className:Kus[l.type],children:Yus[l.type]}),l.isPrivate&&a.jsxs(ga,{variant:"outline",className:"bg-black/30 text-white border-white/30",children:[a.jsx(wa,{className:"h-3 w-3 mr-1"}),"Private"]})]}),a.jsx("h1",{className:"text-2xl md:text-3xl font-bold text-white leading-tight max-w-3xl",children:l.title})]})]}),a.jsx(it.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{delay:.15},className:"grid grid-cols-2 md:grid-cols-4 gap-3 mb-6",children:Be.map(({icon:Pe,label:Ke,value:De})=>a.jsx(Gw,{className:"border-border/70",children:a.jsxs(Ww,{className:"p-3.5 flex items-center gap-3",children:[a.jsx("div",{className:"w-9 h-9 rounded-lg bg-primary/10 flex items-center justify-center shrink-0",children:a.jsx(Pe,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-[11px] uppercase tracking-wide text-muted-foreground",children:Ke}),a.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:De})]})]})},Ke))}),a.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[a.jsxs(it.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.2},className:"md:col-span-2 space-y-6",children:[a.jsx(Gw,{children:a.jsxs(Ww,{className:"p-5",children:[a.jsx("h2",{className:"text-base font-semibold text-foreground mb-3",children:"About this event"}),l.description?a.jsx("div",{className:"text-sm text-muted-foreground leading-relaxed [&_a]:text-primary [&_a]:hover:underline [&_iframe]:rounded-lg [&_iframe]:w-full [&_p]:mb-2",dangerouslySetInnerHTML:{__html:EIe(l.description)}}):a.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No description provided."})]})}),a.jsx(Gw,{children:a.jsxs(Ww,{className:"p-5",children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Attendees"}),l.attendeesList.length>0?a.jsxs("button",{type:"button",onClick:()=>R(!0),className:"text-xs font-medium text-primary hover:underline",children:[Ze," · View all"]}):a.jsx("span",{className:"text-xs text-muted-foreground",children:Ze})]}),Ve.length>0?a.jsxs("div",{className:"flex flex-wrap gap-3",children:[Ve.map(Pe=>a.jsxs("div",{className:"flex flex-col items-center gap-1 w-16 text-center",children:[a.jsxs(oo,{className:"h-11 w-11",children:[a.jsx(lo,{src:Pe.avatar}),a.jsx(co,{className:"bg-primary/10 text-primary text-xs",children:kJe(Pe.name)})]}),a.jsx("span",{className:"text-[11px] text-muted-foreground truncate w-full",children:Pe.name})]},Pe.id)),be>0&&a.jsxs("button",{type:"button",onClick:()=>R(!0),className:"flex flex-col items-center gap-1 w-16 text-center group","aria-label":`View all ${l.attendees} attendees`,children:[a.jsxs("div",{className:"h-11 w-11 rounded-full bg-muted flex items-center justify-center text-xs font-medium text-muted-foreground group-hover:bg-primary/10 group-hover:text-primary transition-colors",children:["+",be]}),a.jsx("span",{className:"text-[11px] text-muted-foreground group-hover:text-primary",children:"more"})]})]}):a.jsxs("div",{className:"flex items-center gap-3 text-muted-foreground",children:[a.jsx(wr,{className:"h-5 w-5"}),a.jsx("p",{className:"text-sm",children:W?"No one attended.":"Be the first to register."})]})]})})]}),a.jsxs(it.div,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},transition:{delay:.3},className:"space-y-4",children:[l.passwordRequired&&!l.entryVerified&&a.jsx(Gw,{children:a.jsxs(Ww,{className:"pt-6 space-y-3",children:[a.jsx(_e,{htmlFor:"entry-password",children:"Enter event password"}),a.jsx(Oe,{id:"entry-password",type:"password",autoComplete:"off",value:O,onChange:Pe=>F(Pe.target.value),onKeyDown:Pe=>{Pe.key==="Enter"&&O&&!D&&ce()}}),a.jsx(Z,{className:"w-full",disabled:D||!O,onClick:()=>void ce(),children:D?"Verifying…":"Verify password"})]})}),a.jsx(Gw,{children:a.jsxs(Ww,{className:"p-5 space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(wr,{className:"h-4 w-4 text-primary"}),a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Registration"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:Ze}),W?a.jsx("p",{className:"text-sm text-muted-foreground",children:"Registration has closed."}):fe?a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"You've been invited to this event."}),a.jsxs(Z,{className:"w-full",size:"lg",disabled:u||X||l.passwordRequired&&!l.entryVerified,onClick:ye,children:[u?a.jsx(Ne,{className:"h-4 w-4 mr-2 animate-spin"}):a.jsx(bD,{className:"h-4 w-4 mr-2"}),"Accept invitation"]}),a.jsx(Z,{variant:"outline",className:"w-full",size:"sm",disabled:u,onClick:J,children:"Decline"})]}):te?a.jsxs("div",{className:"space-y-2",children:[a.jsxs(Z,{className:"w-full",size:"lg",disabled:!0,variant:"secondary",children:[a.jsx(bD,{className:"h-4 w-4 mr-2"}),"You're going"]}),(i==null?void 0:i.email)&&a.jsxs("p",{className:"text-xs text-muted-foreground text-center",children:["Confirmation sent to ",i.email]}),Y&&a.jsxs("p",{className:"text-xs text-center text-muted-foreground border border-border rounded-md py-2",children:["Event starts ",Y]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Z,{variant:"outline",className:"flex-1",size:"sm",disabled:u||l.passwordRequired&&!l.entryVerified,onClick:()=>he("maybe"),children:"Maybe"}),a.jsx(Z,{variant:"outline",className:"flex-1",size:"sm",disabled:u,onClick:()=>he("not-going"),children:"Cancel RSVP"})]}),a.jsxs(Z,{variant:"outline",className:"w-full",size:"sm",onClick:pe,children:[a.jsx(jrt,{className:"h-3.5 w-3.5 mr-1.5"}),"Add to calendar"]})]}):a.jsxs("div",{className:"space-y-2",children:[a.jsxs(Z,{className:"w-full",size:"lg",disabled:u||X||l.passwordRequired&&!l.entryVerified,onClick:()=>he("going"),children:[u?a.jsx(Ne,{className:"h-4 w-4 mr-2 animate-spin"}):a.jsx(bD,{className:"h-4 w-4 mr-2"}),X?"Event is full":"Register"]}),a.jsx(Z,{variant:re?"secondary":"outline",className:"w-full",size:"sm",disabled:u||!re&&l.passwordRequired&&!l.entryVerified,onClick:()=>he(re?"not-going":"maybe"),children:re?"Going as Maybe — tap to cancel":"Maybe"})]}),l.isOnline&&q&&a.jsxs(Z,{className:"w-full",disabled:!V||D||l.passwordRequired&&!l.entryVerified,onClick:()=>void K(),children:[a.jsx(Ca,{className:"h-4 w-4 mr-2"}),W?"Event ended":V?"Join event":"Not started yet"]}),a.jsxs(Z,{variant:"outline",className:"w-full",size:"sm",onClick:Q,children:[a.jsx(kk,{className:"h-3.5 w-3.5 mr-1.5"}),"Share"]}),U&&!W&&l.hasInAppMeeting&&(s==null?void 0:s.id)&&a.jsx(a2e,{className:"w-full",communityId:s.id,eventId:l.realId})]})}),a.jsx(Gw,{children:a.jsxs(Ww,{className:"p-5",children:[a.jsx("h3",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-3",children:"Organised by"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs(oo,{className:"h-10 w-10",children:[a.jsx(lo,{src:l.organizerAvatar}),a.jsx(co,{className:"bg-primary/10 text-primary text-xs",children:kJe(l.organiser)})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:l.organiser}),a.jsx("p",{className:"text-xs text-muted-foreground capitalize",children:l.organiserRole||"Host"})]})]})]})})]})]}),a.jsx(OAt,{open:v,onOpenChange:b,event:l,onSaved:p}),a.jsx(FAt,{eventId:l.realId,eventSlug:l.slug,open:A,onOpenChange:_,audienceRestricted:l.audienceRestricted,invitedSections:l.audienceRestricted?l.invitedSections:[],onShared:p}),a.jsx(Kr,{open:x,onOpenChange:w,children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Delete this event?"}),a.jsx(zr,{children:C?"This and all subsequent events in the series will be permanently removed.":`"${l.title}" will be permanently removed and registrants will lose access.`})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:E,children:"Cancel"}),a.jsx(Yr,{onClick:Pe=>{Pe.preventDefault(),we()},disabled:E,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:E?"Deleting…":"Delete"})]})]})}),a.jsx(jPe,{open:k,onOpenChange:S,title:"Notify attendees that the event is cancelled?",participantCount:l.attendees,loading:E,onNotify:()=>void Ie(!0),onSkip:()=>void Ie(!1)}),a.jsx(KRt,{open:T,onOpenChange:R,title:`Attendees · ${Ze}`,attendees:l.attendeesList})]})}const CJe=["from-emerald-400 to-teal-500","from-blue-400 to-indigo-500","from-orange-400 to-red-500","from-purple-400 to-pink-500","from-cyan-400 to-blue-500","from-amber-400 to-orange-500","from-rose-400 to-red-500"];function Qus(t){let e=0;for(let n=0;n<t.length;n+=1)e=e*31+t.charCodeAt(n)|0;return Math.abs(e)}function NIe(t){return t.filter(e=>e.groupType!=="personal")}function fae(t){const e=j2t(t);return e?_x(t,e):M1(t)}function Zus(t){const e=t.id||t.name;return CJe[Qus(e)%CJe.length]}function Jus(t,e){var s,i;const n=e.trim().toLowerCase();return n?[t.name,t.description,(s=t.meta)==null?void 0:s.title,(i=t.meta)==null?void 0:i.description].filter(Boolean).join(" ").toLowerCase().includes(n):!0}function n$t({amount:t=0,taxPercentage:e=0,currency:n=""}){const r=t>0&&e>0,s=r?t:100,i=r?e:18,o=S9(s*100,i)/100,l=r&&n?`${n} `:"";return a.jsxs(Ni,{children:[a.jsx(Ti,{asChild:!0,children:a.jsx("button",{type:"button",className:"inline-flex h-5 w-5 items-center justify-center rounded-full bg-muted text-muted-foreground hover:bg-muted/80","aria-label":"How tax is calculated",children:a.jsx(nS,{className:"h-3 w-3"})})}),a.jsxs(yi,{className:"w-72 text-xs",align:"start",children:[a.jsx("p",{className:"font-medium text-foreground",children:"How tax is calculated"}),a.jsx("p",{className:"mt-2 text-muted-foreground",children:"Tax is added on top of the amount you enter. It is the sales tax, VAT or GST you need to collect, as a percentage."}),a.jsxs("div",{className:"mt-2 space-y-1 rounded-md bg-muted p-2 text-muted-foreground",children:[a.jsxs("p",{children:[a.jsx("span",{className:"font-semibold text-foreground",children:"Tax"})," = Amount × Tax % ÷ 100"]}),a.jsxs("p",{children:[a.jsx("span",{className:"font-semibold text-foreground",children:"Total"})," = Amount + Tax"]})]}),a.jsxs("div",{className:"mt-2 space-y-1 rounded-md bg-muted p-2 text-muted-foreground",children:[a.jsx("p",{className:"font-medium text-foreground",children:r?"With your values":"Example"}),a.jsxs("p",{children:["Tax: ",l,s," × ",i," ÷ 100 = ",l,(o-s).toFixed(2)]}),a.jsxs("p",{children:["Total: ",l,s," + ",l,(o-s).toFixed(2)," ="," ",a.jsxs("span",{className:"font-semibold text-foreground",children:[l,o.toFixed(2)]})]})]}),a.jsx("p",{className:"mt-2 text-muted-foreground",children:"The total is rounded to the nearest cent and is what members pay at checkout, on every renewal for subscriptions. Their invoice and receipt show the tax as its own line."}),a.jsx("p",{className:"mt-2 text-muted-foreground",children:"Leave it blank if you don't charge tax. Like the price, it can't be changed once created."})]})]})}const jJe="#6366f1",Xus=["USD","INR","EUR","GBP","AUD","CAD","SGD"];function ehs({open:t,onOpenChange:e}){const{toast:n}=yt(),r=Nn(),{community:s}=qe(),{refetchGroups:i}=Ln(),{taxPercentage:o,isPaymentNotSet:l,isLoading:c}=qM(),[d,u]=y.useState(""),[h,m]=y.useState(""),[f,p]=y.useState(jJe),[g,v]=y.useState(""),[b,x]=y.useState("open"),[w,k]=y.useState(!1),[S,C]=y.useState(""),[j,E]=y.useState(""),[N,A]=y.useState(""),[_,T]=y.useState(""),[R,O]=y.useState("USD"),[F,D]=y.useState(1),[I,P]=y.useState(!1),[M,z]=y.useState(!1),[G,B]=y.useState(!1),[H,W]=y.useState(!1);y.useEffect(()=>{t&&(u(""),m(""),p(jJe),v(""),x("open"),k(!1),C(""),E(""),A(""),T(""),O("USD"),D(1),P(!1))},[t]),y.useEffect(()=>{t&&o&&T(te=>te||String(o))},[t,o]);const V=Number(N),U=wJ(_),ne=async()=>{if(!(s!=null&&s.id)){n({title:"No community",description:"Couldn't determine the community.",variant:"destructive"});return}if(!d.trim()){n({title:"Name required",description:"Give the group a name.",variant:"destructive"});return}if(b==="closed-paid"&&l){B(!0);return}if(b==="closed-paid"&&!w){k(!0);return}const te=Number(N);if(b==="closed-paid"&&(!S.trim()||!Number.isInteger(te)||te<=0)){n({title:"Subscription details required",description:"Enter a subscription name and a valid amount greater than zero.",variant:"destructive"});return}const re=wJ(_);if(b==="closed-paid"&&re===null){n({title:"Check the tax percentage",description:"Enter a tax between 0 and 100 with up to two decimals, or leave it blank if you don't charge tax.",variant:"destructive"});return}const fe={communityId:s.id,name:d.trim(),description:h.trim(),color:f,tags:g.split(",").map(le=>le.trim()).filter(Boolean),groupType:b,isOnlyVisibleToMembers:I,subscriptionIds:[],...b==="closed-paid"?{subscriptionName:S.trim(),subscriptionDescription:j.trim(),subscriptionAmount:te*100,subscriptionTaxPercentage:re??0,subscriptionCurrency:R,subscriptionIsRecurring:F>0,subscriptionRecurringInterval:F}:{}};z(!0);try{const{group:le}=await ohr(fe);await i(),n({title:"Group created",description:d.trim()}),e(!1),r(fae(le))}catch(le){n({title:"Couldn't create group",description:le instanceof ze?Dt(le.body,le.message):"Something went wrong. Please try again.",variant:"destructive"})}finally{z(!1)}};return a.jsxs(a.Fragment,{children:[a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"sm:max-w-lg max-h-[85vh] overflow-y-auto",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:w?"Add subscription details":"Create group"}),a.jsx(_n,{children:w?"Set the price members will pay to join this group.":"Add a new group to your community."})]}),w?a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"cg-sub-name",children:"Subscription name"}),a.jsx(Oe,{id:"cg-sub-name",value:S,onChange:te=>C(te.target.value),placeholder:"e.g. Premium Group Access",autoFocus:!0})]}),a.jsxs("div",{className:"grid grid-cols-[120px_1fr] gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Currency"}),a.jsxs(zn,{value:R,onValueChange:O,children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsx(Fn,{children:Xus.map(te=>a.jsx(pt,{value:te,children:te},te))})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"cg-sub-amount",children:"Amount"}),a.jsx(Oe,{id:"cg-sub-amount",type:"number",min:"1",step:"1",value:N,onChange:te=>A(te.target.value.replace(/[.,]/g,"")),placeholder:"99"})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:"cg-sub-tax",children:"Tax (%)"}),a.jsx(n$t,{amount:V,taxPercentage:U??0,currency:R})]}),a.jsx(Oe,{id:"cg-sub-tax",inputMode:"decimal",value:_,onChange:te=>T(te.target.value),placeholder:"0"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:U===null?"Enter a value between 0 and 100.":U>0&&Number.isInteger(V)&&V>0?`Members pay ${R} ${(S9(V*100,U)/100).toFixed(2)} (${R} ${V} + ${U}% tax).`:"Optional. Added on top of the amount at checkout."})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Payment frequency"}),a.jsxs(zn,{value:String(F),onValueChange:te=>D(Number(te)),children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"1",children:"Monthly"}),a.jsx(pt,{value:"3",children:"3 months"}),a.jsx(pt,{value:"6",children:"6 months"}),a.jsx(pt,{value:"12",children:"1 year"}),a.jsx(pt,{value:"0",children:"One time"})]})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"cg-sub-description",children:"Description"}),a.jsx(us,{id:"cg-sub-description",value:j,rows:3,onChange:te=>E(te.target.value),placeholder:"What members receive with this subscription"})]})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"cg-color",children:"Color"}),a.jsx("input",{id:"cg-color",type:"color",value:f,onChange:te=>p(te.target.value),className:"h-9 w-12 cursor-pointer rounded-md border border-input bg-background p-1"})]}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(_e,{htmlFor:"cg-name",children:"Name"}),a.jsx(Oe,{id:"cg-name",value:d,placeholder:"e.g. Product Feedback",onChange:te=>u(te.target.value),autoFocus:!0})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"cg-desc",children:"Description"}),a.jsx(us,{id:"cg-desc",value:h,rows:3,onChange:te=>m(te.target.value)})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"cg-tags",children:"Tags"}),a.jsx(Oe,{id:"cg-tags",value:g,placeholder:"Comma-separated",onChange:te=>v(te.target.value)})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Access"}),a.jsxs(zn,{value:b,onValueChange:te=>{x(te),k(!1)},children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"open",children:"Open — anyone can join"}),a.jsx(pt,{value:"closed-free",children:"Closed — request to join"}),a.jsx(pt,{value:"closed-paid",children:"Paid — pay to join"})]})]})]}),b!=="open"&&a.jsxs("div",{className:"flex items-center justify-between rounded-md border border-border px-3 py-2.5",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Hide from non-members"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Only members can see this group at all."})]}),a.jsx(Hs,{checked:I,onCheckedChange:P})]})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"outline",onClick:()=>w?k(!1):e(!1),disabled:M,children:w?"Back":"Cancel"}),a.jsxs(Z,{onClick:ne,disabled:M||b==="closed-paid"&&c,children:[M?a.jsx(Ne,{className:"h-4 w-4 mr-2 animate-spin"}):null,b==="closed-paid"&&!w?"Next":"Create group"]})]})]})}),a.jsx(Kr,{open:G,onOpenChange:B,children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Configure payments before creating a paid group"}),a.jsx(zr,{children:"Connect Stripe and complete the paywall setup before adding subscription details to this group."})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:"Cancel"}),a.jsx(Yr,{onClick:()=>{B(!1),e(!1),W(!0)},children:"Configure paywall"})]})]})}),a.jsx(KM,{open:H,onOpenChange:W})]})}const v8=[{iso:"IN",name:"India",dialCode:"+91",phoneLengths:[10],postalPattern:/^\d{6}$/,postalHint:"Enter a 6-digit PIN code."},{iso:"US",name:"United States",dialCode:"+1",phoneLengths:[10],postalPattern:/^\d{5}(?:-\d{4})?$/,postalHint:"Enter a 5-digit ZIP code."},{iso:"CA",name:"Canada",dialCode:"+1",phoneLengths:[10],postalPattern:/^[A-Z]\d[A-Z][ -]?\d[A-Z]\d$/i,postalHint:"Enter a valid Canadian postal code."},{iso:"GB",name:"United Kingdom",dialCode:"+44",phoneLengths:[10],postalPattern:/^[A-Z]{1,2}\d[A-Z\d]? ?\d[A-Z]{2}$/i,postalHint:"Enter a valid UK postcode."},{iso:"AU",name:"Australia",dialCode:"+61",phoneLengths:[9],postalPattern:/^\d{4}$/,postalHint:"Enter a 4-digit postcode."},{iso:"SG",name:"Singapore",dialCode:"+65",phoneLengths:[8],postalPattern:/^\d{6}$/,postalHint:"Enter a 6-digit postal code."},{iso:"AE",name:"United Arab Emirates",dialCode:"+971",phoneLengths:[9]},{iso:"SA",name:"Saudi Arabia",dialCode:"+966",phoneLengths:[9]},{iso:"DE",name:"Germany",dialCode:"+49",phoneLengths:[10,11]},{iso:"FR",name:"France",dialCode:"+33",phoneLengths:[9]},{iso:"IT",name:"Italy",dialCode:"+39",phoneLengths:[9,10]},{iso:"ES",name:"Spain",dialCode:"+34",phoneLengths:[9]},{iso:"NL",name:"Netherlands",dialCode:"+31",phoneLengths:[9]},{iso:"BE",name:"Belgium",dialCode:"+32",phoneLengths:[9]},{iso:"CH",name:"Switzerland",dialCode:"+41",phoneLengths:[9]},{iso:"AT",name:"Austria",dialCode:"+43",phoneLengths:[10,11]},{iso:"IE",name:"Ireland",dialCode:"+353",phoneLengths:[9]},{iso:"PT",name:"Portugal",dialCode:"+351",phoneLengths:[9]},{iso:"SE",name:"Sweden",dialCode:"+46",phoneLengths:[9]},{iso:"NO",name:"Norway",dialCode:"+47",phoneLengths:[8]},{iso:"DK",name:"Denmark",dialCode:"+45",phoneLengths:[8]},{iso:"FI",name:"Finland",dialCode:"+358",phoneLengths:[9,10]},{iso:"PL",name:"Poland",dialCode:"+48",phoneLengths:[9]},{iso:"CZ",name:"Czech Republic",dialCode:"+420",phoneLengths:[9]},{iso:"RO",name:"Romania",dialCode:"+40",phoneLengths:[9]},{iso:"GR",name:"Greece",dialCode:"+30",phoneLengths:[10]},{iso:"BR",name:"Brazil",dialCode:"+55",phoneLengths:[10,11]},{iso:"MX",name:"Mexico",dialCode:"+52",phoneLengths:[10]},{iso:"AR",name:"Argentina",dialCode:"+54",phoneLengths:[10]},{iso:"ZA",name:"South Africa",dialCode:"+27",phoneLengths:[9]},{iso:"NG",name:"Nigeria",dialCode:"+234",phoneLengths:[10]},{iso:"KE",name:"Kenya",dialCode:"+254",phoneLengths:[9]},{iso:"EG",name:"Egypt",dialCode:"+20",phoneLengths:[10]},{iso:"IL",name:"Israel",dialCode:"+972",phoneLengths:[9]},{iso:"TR",name:"Türkiye",dialCode:"+90",phoneLengths:[10]},{iso:"RU",name:"Russia",dialCode:"+7",phoneLengths:[10]},{iso:"CN",name:"China",dialCode:"+86",phoneLengths:[11]},{iso:"JP",name:"Japan",dialCode:"+81",phoneLengths:[10]},{iso:"KR",name:"South Korea",dialCode:"+82",phoneLengths:[9,10]},{iso:"ID",name:"Indonesia",dialCode:"+62",phoneLengths:[9,10,11,12]},{iso:"MY",name:"Malaysia",dialCode:"+60",phoneLengths:[9,10]},{iso:"PH",name:"Philippines",dialCode:"+63",phoneLengths:[10]},{iso:"TH",name:"Thailand",dialCode:"+66",phoneLengths:[9]},{iso:"VN",name:"Vietnam",dialCode:"+84",phoneLengths:[9]},{iso:"NZ",name:"New Zealand",dialCode:"+64",phoneLengths:[8,9,10]}].sort((t,e)=>t.name.localeCompare(e.name)),Q5=t=>v8.find(e=>e.iso===t);function TIe(t){return t.replace(/\D/g,"").replace(/^0+/,"")}function ths(t,e){const n=Q5(t),r=TIe(e);return n&&r?`${n.dialCode}${r}`:r}function EJe(t,e){const n=Q5(t);if(!n)return"Select a calling code.";const r=TIe(e);if(!r)return"Enter a phone number.";if(!n.phoneLengths.includes(r.length)){const s=n.phoneLengths.join(" or ");return`Enter a valid ${n.name} number (${s} digits).`}}function nhs(t,e){const n=e.trim();if(!n)return"Enter a PIN / ZIP code.";const r=Q5(t);if(r!=null&&r.postalPattern&&!r.postalPattern.test(n))return r.postalHint;if(!(r!=null&&r.postalPattern)&&!/^[A-Z0-9][A-Z0-9 -]{2,9}$/i.test(n))return"Enter a valid postal code."}const NJe=t=>String.fromCodePoint(...t.split("").map(e=>127397+e.charCodeAt(0))),rhs=t=>{var e;return((e=v8.find(n=>n.name===t||n.iso===t))==null?void 0:e.iso)??""};function shs(t,e){const n=t.trim().replace(/[\s()-]/g,""),r=Q5(e??"");if(r&&n.startsWith(r.dialCode))return{iso:r.iso,national:n.slice(r.dialCode.length)};const s=[...v8].sort((i,o)=>o.dialCode.length-i.dialCode.length).find(i=>n.startsWith(i.dialCode));return s?{iso:s.iso,national:n.slice(s.dialCode.length)}:{iso:e||"IN",national:n}}function mC({id:t,message:e}){return e?a.jsx("p",{id:t,className:"text-xs text-destructive",children:e}):null}function r$t({open:t,onOpenChange:e,planName:n,initial:r,user:s,onSubmit:i}){const[o,l]=y.useState(""),[c,d]=y.useState(""),[u,h]=y.useState(""),[m,f]=y.useState("IN"),[p,g]=y.useState(""),[v,b]=y.useState(""),[x,w]=y.useState(""),[k,S]=y.useState(""),[C,j]=y.useState(""),[E,N]=y.useState({}),[A,_]=y.useState(!1),T=y.useMemo(()=>Q5(m),[m]),R=y.useRef(!1);y.useEffect(()=>{if(!t){R.current=!1;return}if(R.current){s!=null&&s.email&&l(M=>M||(r==null?void 0:r.email)||s.email||""),s!=null&&s.name&&d(M=>M||(r==null?void 0:r.fullName)||s.name||"");return}R.current=!0;const I=rhs(r==null?void 0:r.country),P=shs((r==null?void 0:r.mobile)??(s==null?void 0:s.mobile)??"",I);l((r==null?void 0:r.email)??(s==null?void 0:s.email)??""),d((r==null?void 0:r.fullName)??(s==null?void 0:s.name)??""),h(TIe(P.national)),f(P.iso),g((r==null?void 0:r.addressLine1)??""),b((r==null?void 0:r.addressLine2)??""),w((r==null?void 0:r.state)??""),S(I),j((r==null?void 0:r.pinCode)??""),N({})},[t,r,s]);const O=I=>N(P=>({...P,[I]:void 0})),F=()=>{const I={};return/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/.test(o.trim())||(I.email="Enter a valid email address."),c.trim().length<2&&(I.fullName="Enter your full name."),I.mobile=EJe(m,u),k||(I.country="Select your billing country."),x.trim().length<2&&(I.state="Enter a state or province."),p.trim().length<5&&(I.addressLine1="Enter a complete street address."),I.pinCode=nhs(k,C),Object.fromEntries(Object.entries(I).filter(([,P])=>P))},D=async I=>{I.preventDefault();const P=F();if(N(P),!Object.keys(P).length){_(!0);try{await i({email:o.trim().toLowerCase(),fullName:c.trim().replace(/\s+/g," "),mobile:ths(m,u),country:Q5(k).name,state:x.trim(),addressLine1:p.trim(),addressLine2:v.trim()||void 0,pinCode:C.trim().toUpperCase()}),e(!1)}finally{_(!1)}}};return a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"max-h-[90vh] overflow-y-auto sm:max-w-lg",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Billing details"}),a.jsx(_n,{children:n?`Enter billing information for ${n}.`:"Enter your billing information to continue."})]}),a.jsxs("form",{onSubmit:I=>void D(I),className:"space-y-4",noValidate:!0,children:[a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"billing-name",children:"Full name"}),a.jsx(Oe,{id:"billing-name",autoComplete:"name",value:c,"aria-invalid":!!E.fullName,onChange:I=>{d(I.target.value),O("fullName")}}),a.jsx(mC,{id:"billing-name-error",message:E.fullName})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"billing-email",children:"Email"}),a.jsx(Oe,{id:"billing-email",type:"email",value:o,disabled:!0,readOnly:!0,className:"disabled:cursor-not-allowed disabled:opacity-75"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Payments and invoices use your account email."}),a.jsx(mC,{id:"billing-email-error",message:E.email})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"billing-mobile",children:"Phone number"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("select",{"aria-label":"Calling code",value:m,onChange:I=>{f(I.target.value),O("mobile")},className:"h-10 w-[145px] shrink-0 rounded-md border border-input bg-background px-2 text-sm",children:v8.map(I=>a.jsxs("option",{value:I.iso,children:[NJe(I.iso)," ",I.dialCode]},I.iso))}),a.jsx(Oe,{id:"billing-mobile",type:"tel",inputMode:"numeric",autoComplete:"tel-national",placeholder:m==="IN"?"9876543210":"Phone number",value:u,maxLength:12,"aria-invalid":!!E.mobile,onChange:I=>{h(I.target.value.replace(/\D/g,"")),O("mobile")}})]}),a.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[u&&!EJe(m,u)?a.jsx(yo,{className:"h-3 w-3 text-emerald-600"}):null,"Saved as ",T==null?void 0:T.dialCode,u||"…"]}),a.jsx(mC,{id:"billing-mobile-error",message:E.mobile})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"billing-country",children:"Country"}),a.jsxs("select",{id:"billing-country",autoComplete:"country",value:k,"aria-invalid":!!E.country,onChange:I=>{const P=I.target.value;S(P),u||f(P||"IN"),O("country"),O("pinCode")},className:"h-10 w-full rounded-md border border-input bg-background px-3 text-sm",children:[a.jsx("option",{value:"",children:"Select country"}),v8.map(I=>a.jsxs("option",{value:I.iso,children:[NJe(I.iso)," ",I.name]},I.iso))]}),a.jsx(mC,{id:"billing-country-error",message:E.country})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"billing-state",children:"State / province"}),a.jsx(Oe,{id:"billing-state",autoComplete:"address-level1",value:x,"aria-invalid":!!E.state,onChange:I=>{w(I.target.value),O("state")}}),a.jsx(mC,{id:"billing-state-error",message:E.state})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"billing-line1",children:"Street address"}),a.jsx(Oe,{id:"billing-line1",autoComplete:"address-line1",placeholder:"House number and street",value:p,"aria-invalid":!!E.addressLine1,onChange:I=>{g(I.target.value),O("addressLine1")}}),a.jsx(mC,{id:"billing-address-error",message:E.addressLine1})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(_e,{htmlFor:"billing-line2",children:["Apartment, suite ",a.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),a.jsx(Oe,{id:"billing-line2",autoComplete:"address-line2",value:v,onChange:I=>b(I.target.value)})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"billing-pin",children:"PIN / ZIP code"}),a.jsx(Oe,{id:"billing-pin",autoComplete:"postal-code",value:C,"aria-invalid":!!E.pinCode,onChange:I=>{j(I.target.value),O("pinCode")}}),a.jsx(mC,{id:"billing-pin-error",message:E.pinCode})]})]}),a.jsxs(ir,{className:"pt-2",children:[a.jsx(Z,{type:"button",variant:"outline",onClick:()=>e(!1),disabled:A,children:"Cancel"}),a.jsx(Z,{type:"submit",disabled:A,children:A?a.jsxs(a.Fragment,{children:[a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}),"Validating…"]}):"Continue to payment"})]})]})]})})}function _Ie({isAdmin:t=!1,onConfigure:e}){return a.jsxs("div",{className:"space-y-3 rounded-lg border border-border bg-muted/40 p-4 text-sm",children:[a.jsx("p",{className:"font-medium text-foreground",children:"Stripe is not connected yet"}),a.jsx("p",{className:"text-muted-foreground",children:"People who already have access keep it until their paid-through date. New purchases need Stripe and the SpatialChat Communities webhook on this community."}),t?a.jsx(Z,{type:"button",size:"sm",onClick:e,children:"Connect Stripe"}):a.jsx("p",{className:"text-xs text-muted-foreground",children:"Ask a community admin to open Paywall Settings and connect Stripe."})]})}function ihs({open:t,onOpenChange:e,group:n,groupedPlans:r,onSubscribed:s}){const{toast:i}=yt(),{user:o}=jr(),{community:l}=qe(),{isPaymentNotSet:c,isLoading:d,refetch:u}=qM(),[h,m]=y.useState(!1),[f,p]=y.useState(!1),g=(l==null?void 0:l.myRole)==="admin"||(l==null?void 0:l.isByMe)===!0,[v,b]=y.useState(null),[x,w]=y.useState(null),k=c||f;y.useEffect(()=>{t&&(p(!1),u())},[t,u]);const S=cie(r),C=async(E,N)=>{if(!(!(l!=null&&l.id)||!E.id)){b(E.id);try{await cIt({communityId:l.id,communityName:l.name,plan:E,billingDetails:N,user:{name:(o==null?void 0:o.name)??void 0,email:(o==null?void 0:o.email)??void 0,mobile:(o==null?void 0:o.mobile)??void 0},description:`${E.name??"Membership"} — ${n.name}`}),i({title:a2(E)?"Subscribed":"Payment successful",description:`You can now access ${n.name}.`}),e(!1),s==null||s()}catch(A){if(uIt(A)){p(!0);return}const _=dIt(A,"Something went wrong. Please try again.");_&&i({title:"Checkout failed",description:_,variant:"destructive"})}finally{b(null),w(null)}}},j=async E=>{if(k){g&&m(!0);return}if(a2(E)){await C(E);return}w(E)};return a.jsxs(a.Fragment,{children:[a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"sm:max-w-md",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Buy group access"}),a.jsx(_n,{children:z6r(n.name,S)})]}),a.jsx("div",{className:"space-y-2 max-h-[50vh] overflow-y-auto",children:d?a.jsx("div",{className:"flex justify-center py-8",children:a.jsx(Ne,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):k?a.jsx(_Ie,{isAdmin:g,onConfigure:()=>m(!0)}):S.length===0?a.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No membership plans are linked to this group yet."}):S.map(E=>{const N=JRe(E);return a.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-border p-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:E.name??"Membership plan"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:Ax(E)}),N.length>0?a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Buy ",N.map(A=>A.name).join(", ")]}):null]}),a.jsx(Z,{size:"sm",disabled:v!=null,onClick:()=>void j(E),children:v===E.id?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a2(E)?"Subscribe free":a.jsxs(a.Fragment,{children:[a.jsx(Sh,{className:"mr-1.5 h-3.5 w-3.5"}),AN(E)]})})]},E.id)})})]})}),a.jsx(r$t,{open:x!=null,onOpenChange:E=>!E&&w(null),planName:x==null?void 0:x.name,user:{name:(o==null?void 0:o.name)??void 0,email:(o==null?void 0:o.email)??void 0,mobile:(o==null?void 0:o.mobile)??void 0},onSubmit:async E=>{x&&await C(x,E)}}),a.jsx(KM,{open:h,onOpenChange:m,purpose:"import",onConfigured:()=>{p(!1),u()}})]})}function s$t({group:t,onGroupUpdated:e,refetchGroups:n}){const r=rn(),[s,i]=y.useState(!1),o=y.useCallback(()=>{t!=null&&t.id&&(r.invalidateQueries({queryKey:["group-detail",t.id]}),r.invalidateQueries({queryKey:["group-members",t.id]}),n==null||n())},[t==null?void 0:t.id,r,n]),l=y.useCallback(async w=>{if(w)e==null||e(w);else if(t!=null&&t.id)try{const k=await mAe(t.id);e==null||e(k.group)}catch{}o()},[t==null?void 0:t.id,o,e]),c=y.useCallback(async w=>{if(!t)return{ok:!1,message:"Group not found"};i(!0);try{const k=await w();return await l(k.group??null),{ok:!0}}catch(k){return{ok:!1,message:k instanceof ze?Dt(k.body,k.message):"Something went wrong."}}finally{i(!1)}},[l,t]),d=y.useCallback(()=>c(()=>w2t(t.id)),[t,c]),u=y.useCallback(()=>c(()=>Gur(t.id)),[t,c]),h=y.useCallback(()=>c(()=>Vur(t.id)),[t,c]),m=y.useCallback(()=>c(()=>Hur(t.id)),[t,c]),f=y.useCallback(()=>c(()=>Yur(t.id)),[t,c]),p=y.useCallback(w=>c(()=>Qur(t.id,w)),[t,c]),g=t?k2t(t):"none",v=t?S2t(t):"Join group",b=t?Mu(t):!1,x=t?fAe(t):!1;return{isBusy:s,actionKind:g,label:v,joined:b,invited:x,join:d,leave:u,acceptInvite:h,rejectInvite:m,cancelRequest:f,requestSectionAccess:p,refresh:l,invalidate:o}}function ahs(t,e=!0){var c;const{community:n}=qe(),r=n==null?void 0:n.id,s=lt({queryKey:["group-subscription-plans",r,t],queryFn:()=>$dr(r),enabled:!!(r&&t&&e),staleTime:6e4}),i=M6r(t??"",(c=s.data)==null?void 0:c.subscriptions),o=cie(i),l=L6r(i);return{groupedPlans:i,plans:o,requiresPaidMembership:l,isLoading:s.isLoading,refetch:s.refetch}}function AIe({group:t,onGroupUpdated:e,refetchGroups:n,onActionResult:r,className:s,size:i="sm",variantOnJoined:o="outline",lightOnDark:l=!1}){const{toast:c}=yt(),[d,u]=y.useState(!1),[h,m]=y.useState(!1),f=s$t({group:t,onGroupUpdated:e,refetchGroups:n}),{mySubscriptions:p}=Ln(),g=t.myRole==="admin",v=t.accessSource==="payment"||t.accessSource==="subscription"||t.accessSource==="access-group"||oIt(p,t.id),b=WB(t)||pAe(t),x=t.groupType==="closed-free"||t.groupType==="closed-paid",{groupedPlans:w,plans:k,requiresPaidMembership:S,isLoading:C}=ahs(x?t.id:void 0,x),j=k.length>0,E=k2t(t,{requiresPaidMembership:S}),N=S2t(t,{requiresPaidMembership:S}),A=async()=>{if(f.joined){if(g||v)return;u(!0);return}if(b||x&&C)return;if(E==="buy"&&j){m(!0);return}if(E==="buy"){c({title:"Subscription plan required",description:"This group is attached to a paid group. Buy that paid membership to get access.",variant:"destructive"}),r==null||r({ok:!1,message:"No Stripe subscription plan is linked to this group.",action:"buy"});return}if(f.actionKind==="accept"){const R=await f.acceptInvite();r==null||r({...R,action:"accept"});return}const T=await f.join();r==null||r({...T,action:E})},_=async()=>{const T=await f.leave();u(!1),r==null||r({...T,action:"leave"})};return a.jsxs(a.Fragment,{children:[a.jsx(Z,{variant:f.joined?o:"default",size:i,disabled:f.isBusy||b||x&&C&&!f.joined||f.joined&&(g||v),title:f.joined&&g?"Group admins cannot leave the group":f.joined&&v?"Access is included with your active paid subscription":void 0,onClick:A,className:ee("rounded-full",l&&f.joined&&"bg-white/20 border-white/30 text-white hover:bg-white/30",s),children:f.isBusy?a.jsxs(a.Fragment,{children:[a.jsx(Ne,{className:"h-3.5 w-3.5 mr-1 animate-spin"}),"Working…"]}):N}),a.jsx(Kr,{open:d,onOpenChange:u,children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsxs(Ur,{children:["Leave ",t.name,"?"]}),a.jsx(zr,{children:"You will lose access to group channels and member-only content until you join again."})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:"Cancel"}),a.jsx(Yr,{onClick:_,disabled:f.isBusy,children:"Leave group"})]})]})}),x&&j&&a.jsx(ihs,{group:t,groupedPlans:w,open:h,onOpenChange:m,onSubscribed:()=>{f.refresh(),r==null||r({ok:!0,action:"buy-membership"})}})]})}const ohs={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.06}}},lhs={hidden:{opacity:0,y:16},show:{opacity:1,y:0}};function chs({groupType:t,hasPaidPaywall:e=!1}){const n=e?"Paid":CN(t),r=t==="open"||!t,s=e||t==="closed-paid";return a.jsxs(ga,{variant:"outline",className:`text-[10px] px-2 py-0 ${r?"border-emerald-500/30 text-emerald-600":s?"border-violet-500/30 text-violet-600":"border-amber-500/30 text-amber-600"}`,children:[r?a.jsx(Qd,{className:"h-2.5 w-2.5 mr-1"}):s?a.jsx(Sh,{className:"h-2.5 w-2.5 mr-1"}):a.jsx(wa,{className:"h-2.5 w-2.5 mr-1"}),n]})}function dhs({group:t}){const e=Zus(t),n=t.color?{background:`linear-gradient(135deg, ${t.color} 0%, ${t.color}99 100%)`}:void 0;return a.jsxs("div",{className:`h-36 relative overflow-hidden ${t.banner||t.color?"":`bg-gradient-to-br ${e}`}`,children:[t.banner?a.jsx("img",{src:t.banner,alt:t.name,className:"w-full h-full object-cover opacity-90 group-hover/card:scale-105 transition-transform duration-300"}):a.jsx("div",{className:"w-full h-full",style:n}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/40 to-transparent"})]})}const uhs=()=>{const[t,e]=y.useState(""),[n,r]=y.useState(!1),{toast:s}=yt(),{community:i}=qe(),{groups:o,groupsLoading:l,groupsError:c,refetchGroups:d,subscriptionPlans:u}=Ln(),h=(i==null?void 0:i.myRole)==="admin"||!!(i!=null&&i.isByMe),m=y.useMemo(()=>NIe(o),[o]),f=y.useMemo(()=>m.filter(g=>Jus(g,t)),[m,t]),p=y.useMemo(()=>U6r(u),[u]);return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"flex flex-col gap-3 md:flex-row md:items-center md:justify-between",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold text-foreground",children:"Explore Groups"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Discover and join communities that match your interests."})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"relative min-w-0 flex-1 md:w-72 md:flex-initial",children:[a.jsx(hs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx("input",{type:"text",placeholder:"Search groups…",value:t,onChange:g=>e(g.target.value),className:"w-full rounded-lg border border-input bg-background pl-9 pr-4 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/30"})]}),h&&a.jsxs(Z,{className:"shrink-0",onClick:()=>r(!0),children:[a.jsx(Dn,{className:"h-4 w-4 mr-1"})," New group"]})]})]}),h&&a.jsx(ehs,{open:n,onOpenChange:r}),l&&a.jsxs("div",{className:"flex items-center justify-center py-16 text-muted-foreground gap-2",children:[a.jsx(Ne,{className:"h-5 w-5 animate-spin"}),a.jsx("span",{className:"text-sm",children:"Loading groups…"})]}),c&&!l&&a.jsxs("div",{className:"rounded-lg border border-destructive/30 bg-destructive/5 p-6 text-center space-y-3",children:[a.jsxs("p",{className:"text-sm text-destructive",children:["Could not load groups. ",c.message]}),a.jsx(Z,{variant:"outline",size:"sm",onClick:()=>d(),children:"Try again"})]}),!l&&!c&&a.jsx(it.div,{variants:ohs,initial:"hidden",animate:"show",className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-5",children:f.map(g=>{var x,w,k;const v=Number(g.userCount??0),b=fae(g);return a.jsxs(it.div,{variants:lhs,className:"rounded-xl border border-border bg-card shadow-sm overflow-hidden hover:shadow-md transition-shadow group/card",children:[a.jsx(vr,{to:b,children:a.jsx(dhs,{group:g})}),a.jsxs("div",{className:"p-4 space-y-3",children:[a.jsxs(vr,{to:b,className:"flex items-center gap-2",children:[g.icon?a.jsx("img",{src:g.icon,alt:"",className:"h-7 w-7 shrink-0 rounded-md object-cover"}):null,a.jsx("h3",{className:"text-sm font-bold text-foreground hover:text-primary transition-colors",children:g.name})]}),a.jsx("p",{className:"text-xs text-muted-foreground line-clamp-2 leading-relaxed",children:((x=g.description)==null?void 0:x.trim())||((k=(w=g.meta)==null?void 0:w.description)==null?void 0:k.trim())||"No description yet."}),a.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(wr,{className:"h-3.5 w-3.5"}),v.toLocaleString()]}),a.jsx(chs,{groupType:g.groupType,hasPaidPaywall:p.has(g.id)})]}),a.jsx(AIe,{group:g,refetchGroups:d,className:"w-full text-xs rounded-md",onActionResult:({ok:S,message:C,action:j})=>{const E=!S;s({title:E?j==="leave"?"Could not leave group":"Could not join group":j==="leave"?`Left ${g.name}`:`Access updated for ${g.name}`,description:C,variant:E?"destructive":"default"})}})]})]},g.id)})}),!l&&!c&&f.length===0&&a.jsxs("div",{className:"text-center py-12 text-muted-foreground",children:[a.jsx(wr,{className:"h-10 w-10 mx-auto mb-3 opacity-40"}),a.jsx("p",{className:"text-sm",children:t?`No groups found matching "${t}".`:"No groups available to explore yet."})]})]})},aD=[{key:"customiseCommunity",label:"Customise community",blurb:"Start by giving your community its own look and feel.",icon:bSe,items:[{key:"communityLogo",label:"Upload logo and favicon",description:"Upload the logo for your community, shown in the top bar. Add a favicon too — it appears on the browser tab.",linkText:"Settings → Basic Info",to:"/settings?tab=basic"},{key:"communityTheme",label:"Pick your theme and brand colour",description:"Switch between a light or dark community theme, and set a brand colour that matches your identity.",linkText:"Settings → Appearance",to:"/settings?tab=appearance"},{key:"communityFont",label:"Pick your community font",description:"Choose a font for your community from the available font options.",linkText:"Settings → Appearance",to:"/settings?tab=appearance"},{key:"communityBanner",label:"Community banner & title",description:"Upload a banner and write a heading shown on the community homepage and explore page.",linkText:"Settings → Homepage",to:"/settings?tab=homepage"}]},{key:"setGroupsAndChannels",label:"Set up groups & channels",blurb:"Organise where your members talk, post, and share.",icon:Jme,items:[{key:"createGroup",label:"Create a group",description:"Create a group for your community — pick from open, closed, or private. Learn more about groups here:",linkText:"Knowledge base → Groups",href:"https://help-centre.pensil.in/p/how-to-create-group"},{key:"createChannel",label:"Create channels in a group",description:"Create post or chat channels and define how each is used. Learn more about channels here:",linkText:"Knowledge base → Channels",href:"https://help-centre.pensil.in/p/how-to-setup-sections"},{key:"createQuickLinks",label:"Create quick links",description:"Add quick links to the sidebar for fast access to important pages. Learn more here:",linkText:"Knowledge base → Quick links",href:"https://help-centre.pensil.in/p/how-to-create-quick-links-in-the-community"}]},{key:"inviteUsers",label:"Invite users",blurb:"Bring your people in to get the conversation going.",icon:Sa,items:[{key:"inviteUsersWithCustomMail",label:"Invite users with a custom mail",description:"Invite people to your community directly — add a name and email and send them an invite.",linkText:"Settings → Team",to:"/settings?tab=team"}]}],hhs={customiseCommunity:{communityLogo:!1,communityTheme:!1,communityFont:!1,communityBanner:!1},setGroupsAndChannels:{createGroup:!1,createChannel:!1,createQuickLinks:!1},inviteUsers:{inviteUsersWithCustomMail:!1}};function i$t(t,e){const n=t[e];return Object.values(n).every(Boolean)}function mhs(t,e,n){return!!t[e][n]}function fhs(t){return aD.every(e=>i$t(t,e.key))}function phs(t){let e=0,n=0;for(const r of Object.values(t))for(const s of Object.values(r))n+=1,s&&(e+=1);return{done:e,total:n}}function ghs(){const t=Nn(),e=rn(),{toast:n}=yt(),{community:r}=qe(),{isAdminView:s}=Zy(),i=r==null?void 0:r.id,[o,l]=y.useState(aD[0].key),[c,d]=y.useState(!1),[u,h]=y.useState(!1),m=lt({queryKey:["onboarding-checklist",i],queryFn:()=>vur(i),enabled:!!i&&s}),f=m.data??hhs,p=jt({mutationFn:({section:w,itemKey:k})=>Gxe(i,{[w]:{[k]:!0}}),onSuccess:w=>{e.setQueryData(["onboarding-checklist",i],w),n({title:"Marked as complete"}),fhs(w)&&h(!0)},onError:()=>n({title:"Couldn't update the checklist",variant:"destructive"})}),g=jt({mutationFn:()=>bur(i,!1),onSuccess:()=>{e.invalidateQueries({queryKey:["show-onboarding-list",i]}),d(!1),h(!1),t(ve.dashboard,{replace:!0})},onError:()=>n({title:"Couldn't dismiss the checklist",variant:"destructive"})}),{done:v,total:b}=y.useMemo(()=>phs(f),[f]),x=aD.find(w=>w.key===o)??aD[0];return s?a.jsxs(it.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:"mx-auto w-full max-w-5xl pb-12",children:[a.jsxs("div",{className:"relative overflow-hidden rounded-2xl bg-gradient-to-br from-primary to-primary/70 p-7 text-primary-foreground",children:[a.jsx("div",{className:"absolute -right-8 -top-10 opacity-10",children:a.jsx(bO,{className:"h-44 w-44"})}),a.jsxs("div",{className:"relative flex items-center gap-3",children:[a.jsx("div",{className:"flex h-11 w-11 items-center justify-center rounded-xl bg-white/20",children:a.jsx(bO,{className:"h-6 w-6"})}),a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-bold",children:"Get started"}),a.jsxs("p",{className:"text-sm text-primary-foreground/80",children:["A few quick steps to set up ",(r==null?void 0:r.name)||"your community","."]})]})]}),a.jsxs("div",{className:"relative mt-6 max-w-md",children:[a.jsxs("div",{className:"mb-1.5 flex items-center justify-between text-xs font-medium text-primary-foreground/90",children:[a.jsx("span",{children:"Setup progress"}),a.jsxs("span",{children:[v," / ",b," done"]})]}),a.jsx("div",{className:"h-2 w-full overflow-hidden rounded-full bg-white/25",children:a.jsx("div",{className:"h-full rounded-full bg-white transition-all duration-500",style:{width:`${b?v/b*100:0}%`}})})]})]}),a.jsxs("div",{className:"mt-5 flex flex-col gap-3 rounded-xl border border-border bg-card p-5 sm:flex-row sm:items-center sm:justify-between",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"This checklist is only visible to admins — your members won't see it."}),a.jsx(Z,{variant:"outline",className:"shrink-0",onClick:()=>d(!0),disabled:g.isPending,children:"Dismiss checklist"})]}),a.jsxs("div",{className:"mt-5 grid gap-5 md:grid-cols-[18rem_1fr]",children:[a.jsx("nav",{className:"space-y-2",children:aD.map(w=>{const k=i$t(f,w.key),S=w.key===o,C=w.icon;return a.jsxs("button",{onClick:()=>l(w.key),className:ee("flex w-full items-center gap-3 rounded-xl border p-3 text-left transition-colors",S?"border-primary bg-primary/5":"border-border bg-card hover:bg-muted/50"),children:[a.jsx("div",{className:ee("flex h-9 w-9 shrink-0 items-center justify-center rounded-lg",k?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),children:k?a.jsx(Qn,{className:"h-4 w-4"}):a.jsx(C,{className:"h-4 w-4"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("div",{className:"truncate text-sm font-semibold text-foreground",children:w.label}),a.jsx("div",{className:"truncate text-xs text-muted-foreground",children:w.blurb})]})]},w.key)})}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsx("h2",{className:"text-base font-semibold text-foreground",children:x.label}),a.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground",children:x.blurb}),a.jsx("div",{className:"mt-5 space-y-3",children:m.isLoading?Array.from({length:3}).map((w,k)=>a.jsx(sr,{className:"h-24 w-full rounded-lg"},k)):x.items.map(w=>{var k;return a.jsx(vhs,{item:w,complete:mhs(f,x.key,w.key),marking:p.isPending&&((k=p.variables)==null?void 0:k.itemKey)===w.key,onMark:()=>p.mutate({section:x.key,itemKey:w.key})},w.key)})})]})]}),a.jsx(Kr,{open:c,onOpenChange:d,children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Dismiss onboarding checklist?"}),a.jsx(zr,{children:"Are you sure you want to dismiss the onboarding checklist? This cannot be undone."})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:g.isPending,children:"Cancel"}),a.jsx(Yr,{onClick:w=>{w.preventDefault(),g.mutate()},disabled:g.isPending,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:g.isPending?"Dismissing…":"Dismiss"})]})]})}),a.jsx(Bt,{open:u,onOpenChange:h,children:a.jsxs(Ft,{className:"sm:max-w-md",children:[a.jsxs(Vt,{children:[a.jsx("div",{className:"mx-auto mb-2 flex h-14 w-14 items-center justify-center rounded-full bg-primary/10",children:a.jsx(Yrt,{className:"h-7 w-7 text-primary"})}),a.jsx(Ut,{className:"text-center",children:"All done!"}),a.jsx(_n,{className:"text-center",children:"Congrats — you've completed the onboarding checklist. If you missed anything or need a hand, reach out to us any time."})]}),a.jsx("div",{className:"mt-2",children:a.jsx(Z,{className:"w-full",onClick:()=>g.mutate(),disabled:g.isPending,children:g.isPending?"Finishing…":"Go to community"})})]})})]}):a.jsx(Gs,{to:ve.dashboard,replace:!0})}function vhs({item:t,complete:e,marking:n,onMark:r}){return a.jsx("div",{className:ee("rounded-lg border p-4 transition-colors",e?"border-primary/30 bg-primary/[0.04]":"border-border bg-background"),children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:ee("mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full border",e?"border-primary bg-primary text-primary-foreground":"border-muted-foreground/40"),children:e&&a.jsx(Qn,{className:"h-3 w-3"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("h3",{className:ee("text-sm font-semibold text-foreground",e&&"text-muted-foreground line-through"),children:t.label}),a.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:[t.description," ",t.to?a.jsxs(vr,{to:t.to,className:"inline-flex items-center gap-0.5 font-medium text-primary hover:underline",children:[t.linkText,a.jsx(R8,{className:"h-3.5 w-3.5"})]}):a.jsxs("a",{href:t.href,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-0.5 font-medium text-primary hover:underline",children:[t.linkText,a.jsx(bo,{className:"h-3 w-3"})]})]}),!e&&a.jsx(Z,{variant:"outline",size:"sm",className:"mt-3",onClick:r,disabled:n,children:n?"Marking…":"Mark as complete"})]})]})})}const yhs=[{id:"poll",label:"Poll"},{id:"question",label:"Question"},{id:"quiz",label:"Quiz"}];function bhs({form:t}){const e=t.pollKind==="question",n=!e&&t.pollOptions.length>2;return a.jsxs("div",{className:"space-y-2",children:[a.jsxs("p",{className:"text-xs font-semibold text-muted-foreground flex items-center gap-1",children:[a.jsx(Fc,{className:"h-3 w-3"})," ",e?"Options (pick one correct)":"Poll options"]}),t.pollOptions.map((r,s)=>a.jsxs("div",{className:"flex items-center gap-2",children:[e?a.jsx("button",{type:"button",title:"Mark as correct answer",onClick:()=>t.setPollAnswer(r.trim()),className:"shrink-0 text-primary",children:t.pollAnswer===r.trim()&&r.trim()?a.jsx(Ert,{className:"h-5 w-5"}):a.jsx(Ag,{className:"h-5 w-5 text-muted-foreground"})}):a.jsx("div",{className:"h-6 w-6 rounded-full border-2 border-primary/30 flex items-center justify-center text-[10px] font-bold text-primary shrink-0",children:String.fromCharCode(65+s)}),a.jsx("input",{type:"text",placeholder:`Option ${s+1}`,value:r,onChange:i=>t.updatePollOption(s,i.target.value),className:"flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/30"}),n&&a.jsx("button",{type:"button",onClick:()=>t.removePollOption(s),"aria-label":`Remove option ${s+1}`,className:"text-muted-foreground hover:text-destructive transition-colors",children:a.jsx(qn,{className:"h-4 w-4"})})]},s)),!e&&t.pollOptions.length<d_t&&a.jsxs("button",{type:"button",onClick:t.addPollOption,className:"flex items-center gap-1.5 text-xs font-medium text-primary hover:text-primary/80 transition-colors mt-1",children:[a.jsx(Dn,{className:"h-3.5 w-3.5"})," Add option"]})]})}function xhs({form:t}){const e=e_t();return a.jsxs("div",{className:"space-y-4 rounded-lg border border-border p-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-xs font-semibold text-muted-foreground flex items-center gap-1",children:[a.jsx(Fc,{className:"h-3 w-3"})," Poll"]}),a.jsxs("button",{type:"button",onClick:()=>t.setPostMode("post"),className:"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",title:"Remove poll",children:[a.jsx(nn,{className:"h-3.5 w-3.5"})," Remove poll"]})]}),a.jsx("div",{className:"flex rounded-lg border border-border p-1 bg-muted/40",children:yhs.map(({id:n,label:r})=>a.jsx("button",{type:"button",onClick:()=>t.setPollKind(n),className:`flex-1 rounded-md px-3 py-1.5 text-xs font-medium transition-colors ${t.pollKind===n?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"}`,children:r},n))}),t.pollKind==="quiz"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground mb-1.5",children:"Quiz title"}),a.jsx("input",{type:"text",placeholder:"Enter quiz title…",value:t.quizTitle,onChange:n=>t.setQuizTitle(n.target.value),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/30"})]}),t.quizQuestions.map((n,r)=>a.jsxs("div",{className:"space-y-2 rounded-lg border border-border p-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("p",{className:"text-xs font-semibold text-muted-foreground",children:["Question ",r+1]}),r>0&&a.jsx("button",{type:"button",onClick:()=>t.removeQuizQuestion(r),"aria-label":`Remove question ${r+1}`,className:"text-muted-foreground hover:text-destructive",children:a.jsx(qn,{className:"h-4 w-4"})})]}),a.jsx("input",{type:"text",placeholder:"Enter question…",value:n.statement,onChange:s=>t.updateQuizQuestion(r,{statement:s.target.value}),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/30"}),n.options.map((s,i)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button",title:"Mark as correct answer",onClick:()=>t.updateQuizQuestion(r,{answer:s.trim()}),className:"shrink-0 text-primary",children:n.answer===s.trim()&&s.trim()?a.jsx(Ert,{className:"h-5 w-5"}):a.jsx(Ag,{className:"h-5 w-5 text-muted-foreground"})}),a.jsx("input",{type:"text",placeholder:`Option ${i+1}`,value:s,onChange:o=>{const l=[...n.options];l[i]=o.target.value,t.updateQuizQuestion(r,{options:l})},className:"flex-1 rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/30"})]},i))]},r)),a.jsxs("button",{type:"button",onClick:t.addQuizQuestion,className:"flex items-center gap-1.5 text-xs font-medium text-primary hover:text-primary/80 transition-colors",children:[a.jsx(Dn,{className:"h-3.5 w-3.5"})," Add question"]}),a.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground mb-1.5",children:"Instructions (optional)"}),a.jsx("input",{type:"text",placeholder:"Enter instructions…",value:t.quizInstructions,onChange:n=>t.setQuizInstructions(n.target.value),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/30"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground mb-1.5",children:"Duration"}),a.jsx("select",{value:t.quizDurationMinutes,onChange:n=>t.setQuizDurationMinutes(Number(n.target.value)),className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring/30",children:Kyr.map(n=>a.jsx("option",{value:n.minutes,children:n.label},n.minutes))})]})]})]}):a.jsxs(a.Fragment,{children:[a.jsx(us,{placeholder:t.pollKind==="question"?"Enter your question…":"Ask your question…",value:t.pollQuestion,onChange:n=>t.setPollQuestion(n.target.value),className:"min-h-[80px] resize-none text-base font-medium"}),a.jsx(bhs,{form:t}),t.pollKind==="poll"&&a.jsxs("div",{children:[a.jsxs("p",{className:"mb-1.5 flex items-center gap-1.5 text-xs font-semibold text-muted-foreground",children:["Poll expires",a.jsx(gn,{label:"Poll expires",children:"When voting closes. After that, members can still see the results but can no longer vote."})]}),a.jsxs("select",{value:t.pollDuration,onChange:n=>t.setPollDuration(n.target.value),"aria-label":"Poll expires",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring/30",children:[XTt.map(n=>a.jsx("option",{value:n.label,children:n.label},n.label)),a.jsx("option",{value:w0e,children:"Custom date…"})]}),t.pollDuration===w0e&&a.jsxs("div",{className:"mt-2 space-y-1",children:[a.jsx(J$r,{value:t.pollCustomEndDay,onChange:t.setPollCustomEndDay,earliest:e.first,latest:e.last,placeholder:"Pick the day it ends",ariaLabel:"Poll ends on",className:"w-full sm:w-auto"}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Voting closes at the end of that day. Pick any day in the next ",vPe," days."]})]})]})]})]})}function whs(t){const e=Math.floor(t/60),n=t%60,r=n<10?`0${n}`:`${n}`;return`${e}m ${r}s`}function khs({remainingSeconds:t}){return t<=0?null:a.jsxs("div",{className:"rounded-lg border border-border bg-muted/50 px-3 py-2 text-center text-sm text-muted-foreground",children:["You can create your next post in"," ",a.jsx("span",{className:"font-semibold text-primary",children:whs(t)})]})}function Shs({open:t,onOpenChange:e}){const n=Nn();return a.jsx(Kr,{open:t,onOpenChange:e,children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsxs(Ur,{className:"flex items-center gap-2",children:[a.jsx(wr,{className:"h-5 w-5 shrink-0 text-primary"}),"Join a group first"]}),a.jsx(zr,{children:"Posts live inside a group's sections, so you'll need to join one before you can write anything. Have a look at what's available and join whichever fits."})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:"Cancel"}),a.jsx(Yr,{onClick:()=>n(ve.exploreGroups),children:"Explore groups"})]})]})})}const Chs={"audio/webm":"weba","video/webm":"weba","audio/ogg":"ogg","audio/mp4":"m4a","audio/x-m4a":"m4a","audio/aac":"aac","audio/mpeg":"mp3","audio/wav":"wav","audio/x-wav":"wav"};function jhs(t){const e=Math.floor(t/60),n=t%60;return`${e}:${n.toString().padStart(2,"0")}`}function Ehs({open:t,onOpenChange:e,onRecorded:n}){const{toast:r}=yt(),[s,i]=y.useState(!1),[o,l]=y.useState(!1),[c,d]=y.useState(0),[u,h]=y.useState(null),m=y.useRef(null),f=y.useRef([]),p=y.useRef(null),g=y.useRef(null),v=y.useRef(null),b=()=>{var C;(C=p.current)==null||C.getTracks().forEach(j=>j.stop()),p.current=null,v.current&&window.clearInterval(v.current),v.current=null};y.useEffect(()=>{var C;return t||(((C=m.current)==null?void 0:C.state)==="recording"&&m.current.stop(),b(),i(!1),d(0),g.current=null,h(j=>(j&&URL.revokeObjectURL(j),null))),()=>b()},[t]);const x=async()=>{l(!0);try{const C=await navigator.mediaDevices.getUserMedia({audio:!0});p.current=C,f.current=[];const j=new MediaRecorder(C);j.ondataavailable=E=>{E.data.size>0&&f.current.push(E.data)},j.onstop=()=>{const E=new Blob(f.current,{type:j.mimeType||"audio/webm"});g.current=E,h(N=>(N&&URL.revokeObjectURL(N),URL.createObjectURL(E)))},j.start(),m.current=j,i(!0),d(0),v.current=window.setInterval(()=>d(E=>E+1),1e3)}catch{r({title:"Microphone unavailable",description:"Allow microphone access to record a voice clip.",variant:"destructive"})}finally{l(!1)}},w=()=>{var C;((C=m.current)==null?void 0:C.state)==="recording"&&m.current.stop(),b(),i(!1)},k=()=>{g.current=null,h(C=>(C&&URL.revokeObjectURL(C),null)),d(0)},S=()=>{if(!g.current)return;const C=(g.current.type||"audio/webm").split(";")[0].trim().toLowerCase(),j=Chs[C]??"weba",E=C.startsWith("audio/")?C:"audio/webm",N=new File([g.current],`voice-note-${c}s.${j}`,{type:E});n(N),e(!1)};return a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"sm:max-w-sm",children:[a.jsx(Vt,{children:a.jsx(Ut,{children:"Record audio"})}),a.jsxs("div",{className:"flex flex-col items-center gap-4 py-4",children:[a.jsx("div",{className:`flex h-20 w-20 items-center justify-center rounded-full ${s?"bg-destructive/10 text-destructive animate-pulse":"bg-primary/10 text-primary"}`,children:a.jsx(Vx,{className:"h-8 w-8"})}),a.jsx("p",{className:"text-2xl font-mono tabular-nums text-foreground",children:jhs(c)}),u&&!s&&a.jsx("audio",{src:u,controls:!0,className:"w-full"}),a.jsxs("div",{className:"flex items-center gap-2",children:[!s&&!u&&a.jsxs(Z,{onClick:x,disabled:o,children:[o?a.jsx(Ne,{className:"h-4 w-4 mr-1.5 animate-spin"}):a.jsx(Vx,{className:"h-4 w-4 mr-1.5"}),"Start recording"]}),s&&a.jsxs(Z,{variant:"destructive",onClick:w,children:[a.jsx(hee,{className:"h-4 w-4 mr-1.5"})," Stop"]}),u&&!s&&a.jsxs(a.Fragment,{children:[a.jsxs(Z,{variant:"outline",onClick:k,children:[a.jsx(qn,{className:"h-4 w-4 mr-1.5"})," Discard"]}),a.jsx(Z,{onClick:S,children:"Use recording"})]})]})]})]})})}function Nhs({open:t,onOpenChange:e,communityId:n,destinations:r,currentDraftId:s,onContinue:i,onDeleted:o}){var k,S,C;const l=rn(),[c,d]=y.useState(null),[u,h]=y.useState(null),[m,f]=y.useState(!1),p=C0({queryKey:[...lP(n),"list"],initialPageParam:1,queryFn:({pageParam:j})=>s_t(n,j),getNextPageParam:j=>j.nextPage??void 0,enabled:t&&!!n}),g=(((k=p.data)==null?void 0:k.pages)??[]).flatMap(j=>j.drafts),v=((C=(S=p.data)==null?void 0:S.pages[0])==null?void 0:C.total)??0,b=j=>{var E;return((E=r.find(N=>N.groupId===j.groupId&&N.tabId===j.tabId))==null?void 0:E.label)??null},x=async j=>{if(!(!n||c)){d(j.id);try{i(await fbr(n,j.id)),e(!1)}catch(E){He.error(dn(E,"Couldn't open this draft. Please try again.")),l.invalidateQueries({queryKey:lP(n)})}finally{d(null)}}},w=async()=>{if(!(!n||!u||m)){f(!0);try{await gbr(n,u.id),o(u.id),He.success("Draft deleted"),h(null)}catch(j){He.error(dn(j,"Couldn't delete this draft. Please try again."))}finally{f(!1),l.invalidateQueries({queryKey:lP(n)})}}};return a.jsxs(a.Fragment,{children:[a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"flex max-h-[min(85vh,640px)] w-[calc(100vw-2rem)] max-w-lg flex-col gap-0 p-0",onOpenAutoFocus:j=>{j.preventDefault(),j.currentTarget.focus()},children:[a.jsxs(Vt,{className:"border-b border-border px-5 py-4 text-left",children:[a.jsxs(Ut,{className:"flex items-center gap-1.5",children:["Drafts",v>0?` (${v})`:"",a.jsx(gn,{label:"Drafts",children:"Save a post you are not ready to publish and finish it later, on any device. Only you can see your drafts. Photos and files are uploaded when you save. Publishing a draft removes it from this list. You can keep up to 50 drafts in each community."})]}),a.jsx(_n,{className:"sr-only",children:"Your saved posts in this community."})]}),a.jsxs("div",{className:"themed-scrollbar min-h-32 flex-1 overflow-y-auto px-3 py-2",children:[p.isLoading?a.jsx("div",{className:"flex justify-center py-10",role:"status","aria-label":"Loading drafts",children:a.jsx(Ne,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):p.isError?a.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-center text-sm text-muted-foreground",children:[a.jsx("p",{children:"Couldn't load your drafts."}),a.jsx(Z,{variant:"outline",size:"sm",onClick:()=>void p.refetch(),children:"Try again"})]}):g.length===0?a.jsxs("div",{className:"flex flex-col items-center gap-2 px-4 py-10 text-center",children:[a.jsx(Ei,{className:"h-8 w-8 text-muted-foreground/60"}),a.jsx("p",{className:"text-sm font-medium text-foreground",children:"No drafts yet"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Use Save draft in the composer to keep a post for later."})]}):a.jsx("ul",{className:"divide-y divide-border",children:g.map(j=>{const E=b(j),N=j.title||j.preview||(j.mode==="poll"?"Untitled poll":"Untitled post");return a.jsxs("li",{className:"flex flex-col gap-2 py-3 sm:flex-row sm:items-center sm:gap-3",children:[a.jsxs("div",{className:"min-w-0 flex-1 px-2",children:[a.jsxs("p",{className:"flex items-center gap-1.5 truncate text-sm font-medium text-foreground",children:[j.mode==="poll"&&a.jsx(Fc,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground","aria-label":"Poll"}),a.jsx("span",{className:"truncate",children:N}),j.id===s&&a.jsx("span",{className:"shrink-0 rounded-full bg-primary/10 px-2 py-0.5 text-[10px] font-semibold text-primary",children:"Open"})]}),j.title&&j.preview&&a.jsx("p",{className:"truncate text-xs text-muted-foreground",children:j.preview}),a.jsxs("p",{className:"mt-0.5 flex flex-wrap items-center gap-x-2 text-[11px] text-muted-foreground",children:[a.jsxs("span",{children:["Saved ",h7(new Date(j.updatedAt))," ago"]}),E&&a.jsxs("span",{className:"truncate",children:["· ",E]}),j.mediaCount>0&&a.jsxs("span",{className:"inline-flex items-center gap-0.5",children:["· ",a.jsx(Ff,{className:"h-3 w-3","aria-hidden":!0})," ",j.mediaCount]})]})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-1 px-2 sm:px-0",children:[a.jsxs(Z,{size:"sm",className:"flex-1 rounded-full sm:flex-none",disabled:!!c,onClick:()=>void x(j),children:[c===j.id&&a.jsx(Ne,{className:"mr-1 h-3.5 w-3.5 animate-spin"}),"Continue"]}),a.jsx(Z,{size:"icon",variant:"ghost",className:"h-9 w-9 text-muted-foreground hover:text-destructive","aria-label":`Delete draft ${N}`,onClick:()=>h(j),children:a.jsx(qn,{className:"h-4 w-4"})})]})]},j.id)})}),p.hasNextPage&&a.jsx("div",{className:"flex justify-center py-2",children:a.jsxs(Z,{variant:"ghost",size:"sm",disabled:p.isFetchingNextPage,onClick:()=>void p.fetchNextPage(),children:[p.isFetchingNextPage&&a.jsx(Ne,{className:"mr-1 h-3.5 w-3.5 animate-spin"}),"Load more"]})})]})]})}),a.jsx(Kr,{open:!!u,onOpenChange:j=>!j&&!m&&h(null),children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Delete this draft?"}),a.jsx(zr,{children:"It will be gone for good. This can't be undone."})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:m,children:"Cancel"}),a.jsxs(Yr,{disabled:m,onClick:j=>{j.preventDefault(),w()},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[m&&a.jsx(Ne,{className:"mr-1 h-3.5 w-3.5 animate-spin"}),"Delete"]})]})]})})]})}function a$t({open:t,onOpenChange:e,currentUserName:n,currentUserAvatar:r,form:s}){var le,q,Y,X;const i=Nn(),[o,l]=y.useState(!1),[c,d]=y.useState(!1),[u,h]=y.useState(null),[m,f]=y.useState(!1),[p,g]=y.useState(!1),[v,b]=y.useState(!1),w=lt({queryKey:[...lP(s.communityId),"count"],queryFn:()=>s_t(s.communityId,1),enabled:t&&!!s.communityId,staleTime:3e4,select:Q=>Q.total}).data??0,[k,S]=y.useState(!1),[C,j]=y.useState(!1),[E,N]=y.useState(!1),A=y.useRef(!1),[_,T]=y.useState(null),[R,O]=y.useState(s.postContent.trim().length),[F,D]=y.useState(null),I=s.contentEditorRef,P=y.useCallback(()=>{A.current||(A.current=!0,He.error(`Description must be ${fa} characters or fewer`))},[]),M=y.useCallback(Q=>{var ye;const ie=((ye=I.current)==null?void 0:ye.readMarkdown())??"",he=ie.trim().length;O(he),D(ie),(Q??he)<fa&&(A.current=!1)},[I]),z=yse(s.contentEditorRef),G=WTt({open:t,title:s.postTitle,setTitle:s.setPostTitle,titleMaxLength:dd,insertIntoBody:s.insertEmoji}),B=ZAe(s.destinationChoices),H=()=>{if(!_)return;const Q=s.groups.find(ie=>ie.id===_.groupId);Q&&(T(null),i(_x(Q,{id:_.tabId})))},W=s.isScheduled?"Schedule":s.postMode==="poll"?s.pollKind==="quiz"?"Post quiz":s.pollKind==="question"?"Post question":"Post poll":"Post",V=()=>{var Q;return!!((((Q=s.contentEditorRef.current)==null?void 0:Q.readMarkdown())??s.postContent).trim()||s.postTitle.trim()||s.localImages.length||s.attachedImageUrls.length||s.selectedVideo||s.selectedPdf||s.bannerPreview||s.postMode==="poll"||s.embedCode.trim()||s.customTags.trim()||s.selectedTopicIds.length||s.buttons.some(ie=>ie.label.trim()||ie.url.trim()))},U=Q=>{if(!(!Q&&(s.isPublishing||s.isSavingDraft))){if(!Q&&V()){b(!0);return}Q?e(!0):ne()}},ne=()=>{b(!1),e(!1),A.current=!1,s.resetMediaOnClose()},te=()=>{b(!1),s.saveDraft()},re=s.useMarkdownEditor?s.postContent.trim().length:R,fe=Q=>{V()&&!window.confirm("Replace what you've written with this draft? Your current changes won't be saved.")||s.loadDraft(Q)};return a.jsxs(a.Fragment,{children:[a.jsx(Bt,{open:t,onOpenChange:U,children:a.jsxs(Ft,{className:ee("flex flex-col gap-0 overflow-hidden p-0 transition-[width,max-width,height] duration-200",C?"h-[96vh] max-h-[96vh] w-[96vw] max-w-[96vw] sm:max-w-[96vw]":"max-h-[min(90vh,880px)] sm:max-w-2xl"),children:[a.jsx("button",{type:"button",onClick:()=>j(Q=>!Q),title:C?"Restore":"Maximize","aria-label":C?"Restore dialog":"Maximize dialog",className:"absolute right-11 top-4 z-10 rounded-sm text-muted-foreground opacity-70 transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",children:C?a.jsx(Hrt,{className:"h-4 w-4"}):a.jsx(fSe,{className:"h-4 w-4"})}),a.jsx(Vt,{className:"shrink-0 space-y-0 border-b border-border px-6 pb-4 pt-6",children:a.jsxs("div",{className:"flex items-center justify-between pr-16",children:[a.jsxs(Ut,{className:"flex items-center gap-2.5",children:[a.jsx(WAe,{variant:"create"}),"Create post in"]}),a.jsxs(Tr,{open:s.destinationPickerOpen,onOpenChange:s.setDestinationPickerOpen,children:[a.jsx(_r,{asChild:!0,children:a.jsxs("button",{type:"button",disabled:s.isPublishing,"aria-label":`Post to: ${((le=s.selectedDestination)==null?void 0:le.label)??"select a channel"}`,className:"inline-flex max-w-[60%] items-center gap-1.5 rounded-full bg-muted px-3 py-1.5 text-sm font-medium text-foreground hover:bg-muted/80 transition-colors disabled:opacity-50",children:[a.jsx("span",{className:"truncate",children:((q=s.selectedDestination)==null?void 0:q.label)??"Select channel"}),a.jsx(li,{className:"h-3.5 w-3.5 shrink-0"})]})}),a.jsxs(Cr,{align:"end",className:"themed-scrollbar max-h-72 w-72 overflow-y-auto",children:[a.jsx(FR,{className:"text-xs uppercase tracking-wide text-muted-foreground",children:"Select channel"}),!s.hasAnyJoinedGroup&&B.length>0&&a.jsxs("div",{className:"mx-2 mb-2 flex items-center gap-2 rounded-md bg-muted/60 px-3 py-2 text-xs text-muted-foreground",children:[a.jsx(yK,{className:"h-3.5 w-3.5 shrink-0 text-primary"}),a.jsx("span",{children:"Join a group first to send a post."})]}),B.length===0?a.jsx("p",{className:"px-2 py-3 text-sm text-muted-foreground",children:s.hasAnyJoinedGroup?"No section available to post in.":"You are not part of any group or channel — join a group to create a post."}):B.map((Q,ie)=>a.jsxs("div",{children:[ie>0&&a.jsx(mi,{}),a.jsx(FR,{className:"truncate text-xs font-semibold text-foreground",children:Q.groupName}),Q.destinations.map(he=>a.jsxs(ot,{onClick:()=>{if(he.canPost===!1){T(he);return}s.setDestinationId(he.id)},className:ee("gap-2 pl-4",s.destinationId===he.id&&"bg-accent"),children:[a.jsx("span",{className:"w-4 shrink-0 text-center text-muted-foreground",children:he.tabEmoji||"#"}),a.jsx("span",{className:"truncate",children:he.tabName}),he.canPost===!1&&a.jsxs(ga,{variant:"outline",className:"ml-auto shrink-0 gap-1 border-primary/30 bg-primary/10 text-[10px] font-semibold text-primary",children:[a.jsx(yK,{className:"h-3 w-3"}),"Join required"]})]},he.id))]},Q.groupId))]})]})]})}),a.jsx("div",{className:"themed-scrollbar min-h-0 flex-1 overflow-y-auto px-6 py-4",children:a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("img",{src:r,alt:n,className:"h-10 w-10 rounded-full object-cover shrink-0"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("p",{className:"flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[a.jsx("span",{className:"truncate",children:n}),s.draftId&&a.jsx(ga,{variant:"outline",className:"shrink-0 border-primary/30 bg-primary/10 text-[10px] font-semibold text-primary",children:"Draft"})]}),a.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:["Posting to ",((Y=s.selectedDestination)==null?void 0:Y.label)??"…"]})]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"shrink-0 gap-1.5 rounded-full",onClick:()=>g(!0),disabled:s.isPublishing||s.isSavingDraft,"aria-label":w>0?`Drafts, ${w} saved`:"Drafts",children:[a.jsx(Ei,{className:"h-4 w-4"}),"Drafts",w>0&&a.jsx("span",{className:"min-w-5 rounded-full bg-primary px-1.5 text-center text-[11px] font-semibold leading-5 text-primary-foreground",children:w>99?"99+":w})]})]}),s.bannerPreview&&a.jsxs("div",{className:"relative rounded-lg overflow-hidden border border-border",children:[a.jsx("img",{src:s.bannerPreview,alt:"Cover",className:"w-full max-h-44 object-cover"}),a.jsx("button",{type:"button",onClick:s.clearBanner,className:"absolute top-2 right-2 h-6 w-6 rounded-full bg-foreground/70 flex items-center justify-center hover:bg-foreground/90 transition-colors",title:"Remove cover",children:a.jsx(nn,{className:"h-3 w-3 text-background"})})]}),a.jsx("input",{...G.titleProps,type:"text",placeholder:s.postMode==="poll"?"Title (optional)":"Post title (optional)",value:s.postTitle,onChange:Q=>s.setPostTitle(Q.target.value.slice(0,dd)),maxLength:dd,"aria-label":"Post title","aria-invalid":s.postTitle.length>dd||void 0,className:ee("w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/30",s.postTitle.length>dd&&"border-destructive focus:ring-destructive/30")}),a.jsxs("p",{className:"-mt-2 text-right text-xs text-muted-foreground",children:[s.postTitle.length,"/",dd]}),a.jsxs("div",{ref:z.wrapRef,className:"relative",...G.bodyProps,onPasteCapture:Q=>{Q.clipboardData.getData("text/plain").replace(/\r\n?/g,`
`).length>fa&&P()},children:[z.menu,s.useMarkdownEditor?a.jsxs("div",{className:"space-y-2",children:[a.jsx(us,{value:s.postContent,onChange:Q=>{const ie=Q.target.value.slice(0,fa);s.setPostContent(ie),ie.length<fa&&(A.current=!1)},onBeforeInput:Q=>{const ie=Q.nativeEvent.data??"",he=Q.currentTarget.selectionEnd-Q.currentTarget.selectionStart;s.postContent.length-he+ie.length>fa&&P()},onPaste:Q=>{const ie=Q.clipboardData.getData("text/plain").replace(/\r\n?/g,`
`).length,he=Q.currentTarget.selectionEnd-Q.currentTarget.selectionStart;s.postContent.length-he+ie>fa&&P()},maxLength:fa,placeholder:"Write in Markdown…",spellCheck:!0,className:ee("themed-scrollbar min-h-[180px] resize-y font-mono text-sm",C&&"min-h-[45vh]"),"aria-label":"Post description (Markdown)"}),a.jsxs("label",{className:"flex w-fit cursor-pointer items-center gap-2 text-xs text-muted-foreground",children:[a.jsx("input",{type:"checkbox",checked:E,onChange:Q=>N(Q.target.checked),className:"h-3.5 w-3.5 accent-primary"}),"Show preview"]}),E&&a.jsx("div",{className:"rounded-md border border-border bg-muted/20 px-3 py-2 text-sm",children:s.postContent.trim()?a.jsx(ZB,{text:s.postContent,embedVideos:!0}):a.jsx("p",{className:"text-muted-foreground",children:"Nothing to preview yet."})})]}):a.jsx(Du,{ref:s.contentEditorRef,placeholder:"Write something…",value:s.postContent,onChange:s.setPostContent,...z.editorProps,highlightMentions:!0,deferMarkdownSync:!0,plainTextPaste:!0,markdownBreaks:!0,maxLength:fa,onCharacterCountChange:M,onLimitExceeded:P,onImageFiles:s.addImageFiles,editableClassName:C?"min-h-[45vh] max-h-none":void 0}),a.jsx("div",{className:"mt-1 flex min-h-6 justify-end",children:a.jsxs("p",{className:ee("shrink-0 py-1 text-right text-xs text-muted-foreground",re>fa&&"text-destructive"),children:[re,"/",fa]})}),a.jsx(mPe,{text:s.useMarkdownEditor?s.postContent:F??s.postContent,onChange:s.setLinkPreviewChoice,className:"mt-2"},s.composerEpoch)]}),s.postMode==="poll"&&a.jsx(xhs,{form:s}),s.postTimerBlocked&&a.jsx(khs,{remainingSeconds:s.postTimerRemainingSeconds}),s.localImages.length>0&&a.jsx("div",{className:"grid grid-cols-2 gap-2",children:s.localImages.map(Q=>a.jsxs("div",{className:"relative rounded-lg overflow-hidden border border-border",children:[a.jsx("img",{src:Q.preview,alt:"Selected",className:"w-full max-h-48 object-cover"}),a.jsx("button",{type:"button",onClick:()=>s.removeLocalImage(Q.id),className:"absolute top-2 right-2 h-6 w-6 rounded-full bg-foreground/70 flex items-center justify-center hover:bg-foreground/90 transition-colors",children:a.jsx(nn,{className:"h-3 w-3 text-background"})})]},Q.id))}),s.selectedVideo&&a.jsx(x0e,{url:s.selectedVideo,name:s.selectedVideoName,kind:"video",onRemove:s.clearSelectedVideo}),s.selectedPdf&&a.jsx(x0e,{url:s.selectedPdf,name:s.selectedPdfName,onRemove:s.clearSelectedPdf}),s.attachedImageUrls.length>0&&a.jsx("div",{className:"grid grid-cols-2 gap-2",children:s.attachedImageUrls.map((Q,ie)=>a.jsxs("div",{className:"relative rounded-lg overflow-hidden border border-border",children:[a.jsx("img",{src:Q,alt:"GIF",className:"w-full max-h-48 object-cover"}),a.jsx("button",{type:"button",onClick:()=>s.removeAttachedImageUrl(ie),className:"absolute top-2 right-2 h-6 w-6 rounded-full bg-foreground/70 flex items-center justify-center hover:bg-foreground/90 transition-colors",children:a.jsx(nn,{className:"h-3 w-3 text-background"})})]},`${Q}-${ie}`))}),s.availableTopics.length>0&&a.jsxs("div",{children:[a.jsxs("p",{className:"text-xs font-semibold text-muted-foreground mb-2 flex items-center gap-1",children:[a.jsx(ka,{className:"h-3 w-3"})," Select topics"]}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:s.availableTopics.map(Q=>a.jsx("button",{type:"button","aria-pressed":s.selectedTopicIds.includes(Q.id),onClick:()=>s.toggleTopic(Q.id),className:"rounded-full focus:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:a.jsx(ga,{variant:s.selectedTopicIds.includes(Q.id)?"default":"outline",className:"cursor-pointer text-xs transition-colors",children:Q.name})},Q.id))})]}),s.showAdvancedOptions&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("button",{type:"button",onClick:()=>s.setAdvancedOpen(!s.advancedOpen),className:"text-xs font-medium text-primary hover:text-primary/80",children:s.advancedOpen?"Hide buttons & embed":"Add buttons or embed"}),s.advancedOpen&&a.jsx(bTt,{form:s})]})]})}),a.jsxs("div",{className:"shrink-0 border-t border-border bg-background px-6 py-4",children:[s.isUploading&&a.jsxs("div",{className:"mb-3 space-y-1",role:"status","aria-live":"polite",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Uploading attachments… ",s.uploadProgress??0,"%"]}),a.jsx("button",{type:"button",onClick:s.cancelUpload,className:"shrink-0 text-xs font-medium text-foreground underline-offset-2 hover:underline",children:"Cancel upload"})]}),a.jsx("div",{className:"h-1 w-full overflow-hidden rounded-full bg-muted",children:a.jsx("div",{className:"h-full bg-primary transition-[width] duration-200",style:{width:`${s.uploadProgress??0}%`}})})]}),a.jsxs("div",{className:"flex flex-col gap-3",children:[a.jsxs("div",{className:"-mx-1 flex min-w-0 flex-wrap items-center gap-x-0.5 gap-y-1",children:[a.jsx("input",{ref:s.fileInputRef,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:s.handleImageSelect}),a.jsx("input",{ref:s.videoInputRef,type:"file",accept:"video/*",className:"hidden",onChange:s.handleVideoSelect}),a.jsx("input",{ref:s.pdfInputRef,type:"file",accept:".pdf,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.txt,.csv,.rtf,.odt,.ods,.odp,.zip,audio/*",className:"hidden",onChange:s.handlePdfSelect}),a.jsx("input",{ref:s.bannerInputRef,type:"file",accept:"image/*",className:"hidden",onChange:Q=>{var he;const ie=(he=Q.target.files)==null?void 0:he[0];ie&&h(ie),Q.target.value=""}}),a.jsxs("button",{type:"button",onClick:()=>{var Q;return(Q=s.fileInputRef.current)==null?void 0:Q.click()},className:"h-9 shrink-0 rounded-full flex items-center justify-center gap-1.5 px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",title:"Add image","aria-label":"Add image",children:[a.jsx(jy,{className:"h-[18px] w-[18px]"}),a.jsx("span",{className:"text-xs font-medium",children:"Photo"})]}),a.jsxs("button",{type:"button",onClick:()=>{var Q;return(Q=s.bannerInputRef.current)==null?void 0:Q.click()},className:"h-9 shrink-0 rounded-full flex items-center justify-center gap-1.5 px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",title:"Add cover image","aria-label":"Add cover image",children:[a.jsx(Jl,{className:"h-[18px] w-[18px]"}),a.jsx("span",{className:"text-xs font-medium",children:"Cover"})]}),a.jsxs("button",{type:"button",onClick:()=>{var Q;return(Q=s.videoInputRef.current)==null?void 0:Q.click()},className:"h-9 shrink-0 rounded-full flex items-center justify-center gap-1.5 px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",title:"Add video","aria-label":"Add video",children:[a.jsx(Ca,{className:"h-[18px] w-[18px]"}),a.jsx("span",{className:"text-xs font-medium",children:"Video"})]}),a.jsxs("button",{type:"button",onClick:()=>{var Q;return(Q=s.pdfInputRef.current)==null?void 0:Q.click()},className:"h-9 shrink-0 rounded-full flex items-center justify-center gap-1.5 px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",title:"Attach file","aria-label":"Attach file",children:[a.jsx(Ff,{className:"h-[18px] w-[18px]"}),a.jsx("span",{className:"text-xs font-medium",children:"File"})]}),a.jsxs("button",{type:"button",onClick:()=>f(!0),className:"h-9 shrink-0 rounded-full flex items-center justify-center gap-1.5 px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",title:"Record audio","aria-label":"Record audio",children:[a.jsx(Vx,{className:"h-[18px] w-[18px]"}),a.jsx("span",{className:"text-xs font-medium",children:"Audio"})]}),a.jsxs("button",{type:"button",onClick:()=>s.setPostMode(s.postMode==="poll"?"post":"poll"),className:ee("h-9 shrink-0 rounded-full flex items-center justify-center gap-1.5 px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",s.postMode==="poll"&&"bg-muted text-foreground"),title:s.postMode==="poll"?"Remove poll":"Create poll","aria-label":s.postMode==="poll"?"Remove poll":"Create poll","aria-pressed":s.postMode==="poll",children:[a.jsx(Fc,{className:"h-[18px] w-[18px]"}),a.jsx("span",{className:"text-xs font-medium",children:"Poll"})]}),a.jsxs(Ni,{open:k,onOpenChange:S,modal:!1,children:[a.jsx(Ti,{asChild:!0,children:a.jsx("button",{type:"button",className:"h-9 shrink-0 rounded-full flex items-center justify-center gap-1.5 px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",title:"Add GIF","aria-label":"Add GIF",children:a.jsx("span",{className:"text-xs font-medium",children:"GIF"})})}),a.jsx(yi,{align:"start",side:"top",className:"z-[100] w-auto p-2",onWheel:Q=>Q.stopPropagation(),children:a.jsx(CM,{onPick:Q=>{s.addGifUrl(Q),S(!1)}})})]}),a.jsxs(Ni,{open:o,onOpenChange:l,modal:!1,children:[a.jsx(Ti,{asChild:!0,children:a.jsxs("button",{type:"button",className:"h-9 shrink-0 rounded-full flex items-center justify-center gap-1.5 px-2.5 text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",title:"Add emoji","aria-label":"Add emoji",children:[a.jsx(Hx,{className:"h-[18px] w-[18px]"}),a.jsx("span",{className:"text-xs font-medium",children:"Emoji"})]})}),a.jsx(yi,{align:"start",side:"top",className:"z-[100] w-auto p-2",onWheel:Q=>Q.stopPropagation(),children:a.jsx($g,{onPick:Q=>{G.insert(Q),l(!1)}})})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(Z,{type:"button",variant:"outline",onClick:()=>void s.saveDraft(),disabled:s.publishDisabled,title:"Save as a draft and finish it later — only you can see it","aria-label":s.draftId?"Save draft changes":"Save draft",className:"mr-auto rounded-full px-3 sm:px-4",children:[s.isSavingDraft?a.jsx(Ne,{className:"mr-1.5 h-4 w-4 animate-spin"}):a.jsx(xK,{className:"mr-1.5 h-4 w-4"}),s.isSavingDraft?"Saving…":"Save draft"]}),s.canSchedule&&a.jsxs(Ni,{open:c,onOpenChange:d,children:[a.jsx(Ti,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:s.isScheduled?"ghost":"outline",title:s.scheduleAt?`Publishes ${vd(s.scheduleAt)}`:"Schedule for later","aria-label":s.isScheduled?`Scheduled for ${vd(s.scheduleAt)}. Change the time`:"Schedule for later",className:ee("rounded-full px-3 sm:px-4",s.isScheduled&&"px-3 font-medium text-primary hover:bg-primary/10 hover:text-primary"),children:[!s.isScheduled&&a.jsx(ja,{className:"h-4 w-4 shrink-0 sm:mr-1.5"}),s.isScheduled?i_t(s.scheduleAt):a.jsx("span",{className:"hidden sm:inline",children:"Schedule"})]})}),a.jsxs(yi,{align:"end",side:"top",className:"z-[100] w-72 space-y-2 p-3",children:[a.jsx("p",{className:"text-xs font-semibold text-foreground",children:"Schedule this post"}),a.jsx("input",{type:"datetime-local","aria-label":"Publish date and time",value:s.scheduleAt,min:oF(),onChange:Q=>s.setScheduleAt(Q.target.value),className:"h-9 w-full rounded-md border border-input bg-background px-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring/30"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:s.isScheduled?`Only you can see it until it goes out (${lF()}).`:`Leave this empty to post right away. Times are in ${lF()}.`}),s.isScheduled&&a.jsx(Z,{variant:"ghost",size:"sm",className:"h-7 w-full text-xs",onClick:()=>{s.setScheduleAt(""),d(!1)},children:"Clear and post now"})]})]}),a.jsxs(Z,{onClick:()=>void s.publish(),disabled:s.publishDisabled,className:"rounded-full px-6",children:[s.isPublishing?a.jsx(Ne,{className:"h-4 w-4 mr-1 animate-spin"}):s.isScheduled?a.jsx(ja,{className:"h-4 w-4 mr-1"}):s.postMode==="poll"?a.jsx(Fc,{className:"h-4 w-4 mr-1"}):a.jsx(_s,{className:"h-4 w-4 mr-1"}),s.isUploading?"Uploading…":W]})]})]})]})]})}),a.jsx(Shs,{open:s.joinPromptOpen,onOpenChange:s.setJoinPromptOpen}),a.jsx(sAt,{open:s.channelConfirmOpen,onOpenChange:s.setChannelConfirmOpen,destinations:s.destinations,destinationId:((X=s.selectedDestination)==null?void 0:X.id)??null,actionLabel:W,onConfirm:Q=>void s.confirmChannelAndPublish(Q)}),a.jsx(Kr,{open:!!_,onOpenChange:Q=>!Q&&T(null),children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Join this group to post"}),a.jsxs(zr,{children:["You are not a member of ",(_==null?void 0:_.groupName)??"this group",". Join the group before posting in this channel."]})]}),a.jsxs(Br,{children:[a.jsx(ts,{onClick:()=>T(null),children:"Cancel"}),a.jsx(Yr,{onClick:H,children:"Continue"})]})]})}),a.jsx(Nh,{file:u,aspect:16/9,onCancel:()=>h(null),onCropped:Q=>{s.applyBannerFile(Q),h(null)}}),a.jsx(Ehs,{open:m,onOpenChange:f,onRecorded:Q=>s.applyDocumentFile(Q)}),a.jsx(Kr,{open:v,onOpenChange:b,children:a.jsxs(Or,{className:"w-[calc(100vw-2rem)] max-w-md",children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:s.draftId?"Save your changes to this draft?":"Save this post as a draft?"}),a.jsx(zr,{children:s.draftId?"Your draft keeps its last saved version if you discard these changes.":"Finish it later from Drafts — only you can see it. If you discard it, what you've written is lost."})]}),a.jsxs(Br,{className:"gap-2 sm:gap-0",children:[a.jsx(ts,{children:"Keep editing"}),a.jsx(Z,{variant:"outline",className:"text-destructive hover:text-destructive",onClick:ne,children:s.draftId?"Discard changes":"Discard"}),a.jsxs(Yr,{onClick:te,children:[a.jsx(xK,{className:"mr-1.5 h-4 w-4"}),"Save draft"]})]})]})}),a.jsx(Nhs,{open:p,onOpenChange:g,communityId:s.communityId,destinations:s.destinations,currentDraftId:s.draftId,onContinue:fe,onDeleted:s.forgetDraft})]})}function Ths(){return a.jsxs("div",{className:"max-w-4xl mx-auto space-y-5 animate-pulse",children:[a.jsxs("div",{className:"rounded-xl border border-border bg-card overflow-hidden",children:[a.jsx("div",{className:"h-64 bg-muted"}),a.jsx("div",{className:"flex gap-4 px-6 py-4 border-t border-border",children:Array.from({length:5}).map((t,e)=>a.jsx("div",{className:"h-8 w-24 rounded-md bg-muted"},e))})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-6 space-y-3",children:[a.jsx("div",{className:"h-4 w-32 rounded bg-muted"}),a.jsx("div",{className:"h-3 w-full max-w-md rounded bg-muted"}),a.jsx("div",{className:"flex gap-2",children:Array.from({length:3}).map((t,e)=>a.jsx("div",{className:"h-8 w-28 rounded-full bg-muted"},e))})]}),a.jsxs("div",{className:"flex flex-col items-center py-12 text-muted-foreground",children:[a.jsx(wr,{className:"h-8 w-8 mb-2 opacity-40"}),a.jsx("p",{className:"text-sm",children:"Loading group…"})]})]})}function RX({tabs:t,activeTabId:e,onSelect:n,kind:r="all",className:s}){const{counts:i}=dse(),o=r==="all"?t:t.filter(l=>r==="realtime"?Mf(l):!Mf(l));return o.length===0?a.jsxs("p",{className:ee("text-xs text-muted-foreground",s),children:["No ",r==="realtime"?"chat":"discussion"," channels in this group yet."]}):o.length===1&&r!=="all"?a.jsxs("p",{className:ee("text-xs text-muted-foreground",s),children:["Channel: ",a.jsx("span",{className:"font-medium text-foreground",children:o[0].name})]}):a.jsx("div",{className:ee("flex flex-wrap gap-2",s),children:o.map(l=>{const c=l.id===e,d=Mf(l);return a.jsxs("button",{type:"button",onClick:()=>n(l.id),className:ee("inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-xs font-medium transition-colors",c?"bg-primary text-primary-foreground border-primary":"bg-background text-foreground border-border hover:bg-muted"),children:[l.emoji?a.jsx("span",{className:"text-xs leading-none shrink-0",children:l.emoji}):d?a.jsx(Vi,{className:"h-3 w-3 shrink-0 opacity-80"}):a.jsx(nI,{className:"h-3 w-3 shrink-0 opacity-80"}),a.jsx("span",{className:"truncate max-w-[160px]",children:l.name}),!c&&(i[l.id]??0)>0&&a.jsx("span",{className:"inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-destructive px-1 text-[10px] font-semibold leading-none text-destructive-foreground",children:(i[l.id]??0)>99?"99+":i[l.id]})]},l.id)})})}const _hs={hidden:{opacity:0,y:8},show:{opacity:1,y:0}};function o$t({group:t,section:e,context:n,onGroupUpdated:r,refetchGroups:s}){const{toast:i}=yt(),o=s$t({group:t,onGroupUpdated:r,refetchGroups:s}),l=ghr(t,e);if(l==="viewable")return null;const c=async()=>{const p=await o.requestSectionAccess(e.id);p.ok?i({title:"Request sent",description:`Your request to join ${e.name} is awaiting approval.`}):i({title:"Couldn't request access",description:p.message??"Please try again.",variant:"destructive"})},d=n==="chat"?"read and send messages":"see discussions";let u=a.jsx(wa,{className:"mx-auto h-8 w-8 text-muted-foreground opacity-60"}),h="This channel is private",m="You don't have access to this channel.",f=null;return l==="request"?(h="This is a closed channel",m=`Request access to ${d} in ${e.name}.`,f=a.jsxs(Z,{size:"sm",className:"rounded-full",onClick:c,disabled:o.isBusy,children:[o.isBusy?a.jsx(Ne,{className:"mr-1.5 h-4 w-4 animate-spin"}):null,"Request access"]})):l==="requested"?(u=a.jsx(ja,{className:"mx-auto h-8 w-8 text-muted-foreground opacity-60"}),h="Request awaiting approval",m="An admin will review your request to join this channel."):l==="private"?(h="This is a private channel",m="Only invited members can access this channel."):l==="group-locked"&&(h="Join the group first",m=`Join this group to ${d} in its channels.`),a.jsxs(it.div,{variants:_hs,className:"space-y-3 rounded-lg border border-dashed border-border bg-card p-10 text-center",children:[u,a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:h}),a.jsx("p",{className:"mx-auto max-w-md text-sm text-muted-foreground",children:m}),f]})}const Che=[{value:"all",label:"All activity",hint:"Every new post and message"},{value:"admin",label:"Important only",hint:"Admin posts and mentions"},{value:"none",label:"Off",hint:"No notifications from this channel"}];function l$t({group:t,section:e}){var m;const{community:n}=qe(),r=(n==null?void 0:n.id)??null,{notificationPreferences:s,refetchNotificationPreferences:i}=Ln(),{toast:o}=yt(),[l,c]=y.useState(!1),d=y.useMemo(()=>{const f=((s==null?void 0:s.tabs)??[]).find(p=>p.tabId===e.id&&p.groupId===t.id);return(f==null?void 0:f.notificationLevel)??e.defaultNotificationLevel??"all"},[s==null?void 0:s.tabs,e.id,e.defaultNotificationLevel,t.id]),u=async f=>{var p;if(!(!r||l||f===d)){c(!0);try{await Idr(r,{tabId:e.id,groupId:t.id,notificationLevel:f}),i(),o({title:"Notifications updated",description:`${e.name}: ${((p=Che.find(g=>g.value===f))==null?void 0:p.label)??f}`})}catch(g){o({title:"Couldn't update notifications",description:g instanceof ze?Dt(g.body,g.message):"Something went wrong.",variant:"destructive"})}finally{c(!1)}}},h=d==="none"?pK:d==="admin"?dBt:Lm;return a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:l,title:`Channel notifications: ${(m=Che.find(f=>f.value===d))==null?void 0:m.label}`,children:a.jsx(h,{className:"h-3.5 w-3.5"})})}),a.jsxs(Cr,{align:"end",className:"w-56",children:[a.jsxs(FR,{className:"text-xs",children:["#",e.name," notifications"]}),a.jsx(mi,{}),Che.map(f=>a.jsxs(ot,{onClick:()=>void u(f.value),className:"flex items-start gap-2",children:[a.jsx("span",{className:"mt-0.5 flex h-4 w-4 items-center justify-center",children:d===f.value&&a.jsx(Qn,{className:"h-3.5 w-3.5"})}),a.jsxs("span",{children:[a.jsx("span",{className:"block text-sm",children:f.label}),a.jsx("span",{className:"block text-xs text-muted-foreground",children:f.hint})]})]},f.value))]})]})}function DN(t){if(!t||typeof t!="object")return null;const e=t,n=e.messages??e.messageBody??e.messagebody;return n&&typeof n=="object"?n:null}async function TJe(t,e,n){const r=new URLSearchParams;n&&r.set("lastId",n);const s=r.toString();return(await ae.get(`/group/${encodeURIComponent(t)}/section/${encodeURIComponent(e)}/messages/timestamped${s?`?${s}`:""}`)).messages??[]}async function Ahs(t,e){return(await ae.get(`/group/${encodeURIComponent(t)}/section/${encodeURIComponent(e)}/messages/pinned`)).pinnedMessages??[]}async function Phs(t){const e=await ae.post(`/message/${encodeURIComponent(t)}/pin`,{}),n=DN(e)??e;if(!(n!=null&&n.id))throw new Error("Pin failed");return n}async function Rhs(t){const e=await ae.delete(`/message/${encodeURIComponent(t)}/pin`),n=DN(e)??e;if(!(n!=null&&n.id))throw new Error("Unpin failed");return n}async function Ihs(t){const e=await ae.post("/message",t),n=DN(e)??e;if(!(n!=null&&n.id))throw new Error("Message was not created");return n}async function Mhs(t,e){const n=await ae.put(`/message/${encodeURIComponent(t)}`,e),r=DN(n)??n;if(!(r!=null&&r.id))throw new Error("Message was not updated");return r}async function Lhs(t){await ae.delete(`/message/${encodeURIComponent(t)}`)}async function Dhs(t,e){const n=await ae.post(`/message/${encodeURIComponent(t)}/react`,{emoji:e}),r=DN(n)??n;if(!(r!=null&&r.id))throw new Error("Reaction failed");return r}async function $hs(t,e){const n=await ae.post(`/message/${encodeURIComponent(t)}/unreact`,{emoji:e}),r=DN(n)??n;if(!(r!=null&&r.id))throw new Error("Reaction failed");return r}async function Ohs(t,e,n){const r=new FormData;e.forEach(o=>r.append("attachments",o,o.name)),r.append("groupId",t.groupId),r.append("tabId",t.tabId),t.parentId&&r.append("parentId",t.parentId),n&&r.append("clientNonce",n);const s=await Ea("/message/upload-attachment",r),i=DN(s)??s;if(!(i!=null&&i.id))throw new Error("Attachment upload failed");return i}async function c$t(t,e){await ae.get(`/community/${encodeURIComponent(t)}/section-message-mark-read/${encodeURIComponent(e)}`)}function Fhs({groupId:t,sectionId:e,enabled:n=!0,currentUserName:r,currentUserAvatar:s,topicId:i,trending:o=!1}){const{socket:l}=Qg(),c=`section:${t}:${e}:${i??"all"}:${o}`,{entryKey:d,isReturn:u}=Mse(),[h]=y.useState(()=>u?Ise(d,`pinned:${c}`)??null:null),m=y.useRef(!!h),[f,p]=y.useState(()=>h??[]),[g,v]=y.useState(!1),[b,x]=y.useState(0),w=y.useCallback(async A=>o?A>1?{posts:[]}:{posts:(await Uur(t)).posts??[]}:{posts:(await Fur(t,e,A,i??void 0)).posts??[]},[t,e,i,o]),k=Dse({sort:"recent",duration:"",currentUserName:r,currentUserAvatar:s,loadPostsPage:w,enabled:n&&!!(t&&e),restoreScope:c}),S=y.useCallback(async()=>{if(!t||!e||!n||o){p([]);return}v(!0);try{const _=((await Bur(t,e)).posts??[]).map((T,R)=>Am({...T,isPinned:!0},-(R+1)));p(_)}catch{p([])}finally{v(!1)}},[n,t,e,o]);y.useEffect(()=>{if(m.current){m.current=!1;return}S()},[S]),y.useEffect(()=>{g||Rse(d,`pinned:${c}`,f)},[d,c,f,g]);const C=y.useMemo(()=>new Set(f.map(A=>A.realId).filter(Boolean)),[f]),j=y.useMemo(()=>k.displayedPosts.filter(A=>!A.realId||!C.has(A.realId)),[k.displayedPosts,C]),E=y.useRef(new Set);y.useEffect(()=>{E.current=new Set(k.displayedPosts.map(A=>A.realId).filter(Boolean))},[k.displayedPosts]),y.useEffect(()=>{if(!l||!n||!e)return;const A=T=>{(T==null?void 0:T.sectionId)===e&&(T.postId&&E.current.has(T.postId)||x(R=>R+1))},_=T=>{(T==null?void 0:T.sectionId)===e&&(k.refetch(),S())};return l.on("REALTIME:POST_CREATE",A),l.on("REALTIME:POST_DELETE",_),()=>{l.off("REALTIME:POST_CREATE",A),l.off("REALTIME:POST_DELETE",_)}},[l,n,e,k.refetch,S]),y.useEffect(()=>{x(0)},[e,i,o]);const N=y.useCallback(()=>{x(0),k.refetch(),S()},[k,S]);return{feed:k,pinnedPosts:f,regularPosts:j,pinnedLoading:g,refetchAll:N,newPostCount:b}}const gw={hidden:{opacity:0,y:8},show:{opacity:1,y:0}};function Bhs({group:t,activeSection:e,onSectionSelect:n,onCreatePost:r,currentUserName:s,currentUserAvatar:i,canFeature:o,getCanPin:l,featuredIds:c,onToggleFeatured:d,postActions:u,onFeedReady:h,onGroupUpdated:m,refetchGroups:f}){var H;const p=qB(t),g=p.filter(W=>!Mf(W)),v=e&&!Mf(e)?e:g[0]??null,b=v?gAe(t,v):!1,x=v&&Mu(t)?QAe(t,v):!1,{community:w}=qe(),k=rn(),{setActiveSection:S}=dse(),C=(v==null?void 0:v.id)??null,j=(w==null?void 0:w.id)??null;y.useEffect(()=>{if(!(!C||!b))return S(C),j&&c$t(j,C).then(()=>k.invalidateQueries({queryKey:["user-counters"]})).catch(()=>{}),()=>S(null)},[C,b,j,S,k]);const[E,N]=Y2("section-feed:topic","all"),[A,_]=Y2("section-feed:trending",!1),T=lt({queryKey:["community-topics",w==null?void 0:w.id],queryFn:()=>xse(w.id),enabled:!!(w!=null&&w.id),staleTime:5*6e4}),R=(v==null?void 0:v.topics)??[],O=(((H=T.data)==null?void 0:H.topics)??[]).filter(W=>R.includes(W.id)&&(W.status?W.status==="ACTIVE":!0)&&(W.postCount??0)>0),F=y.useRef(v==null?void 0:v.id);y.useEffect(()=>{F.current!==(v==null?void 0:v.id)&&(F.current=v==null?void 0:v.id,N("all"),_(!1))},[v==null?void 0:v.id,N,_]);const{feed:D,pinnedPosts:I,regularPosts:P,pinnedLoading:M,refetchAll:z,newPostCount:G}=Fhs({groupId:t.id,sectionId:v==null?void 0:v.id,enabled:b&&!!(v!=null&&v.id),currentUserName:s,currentUserAvatar:i,topicId:E==="all"?null:E,trending:A});if(y.useEffect(()=>{h==null||h({addCreatedPost:D.addCreatedPost,refetch:z})},[D.addCreatedPost,h,z]),!v)return a.jsxs(it.div,{variants:gw,className:"rounded-lg border border-dashed border-border bg-card p-10 text-center",children:[a.jsx(Vi,{className:"h-8 w-8 mx-auto text-muted-foreground opacity-60 mb-3"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"No discussion channels in this group yet."})]});if(!b)return a.jsxs("div",{className:"space-y-4",children:[g.length>1&&a.jsx(it.div,{variants:gw,className:"rounded-lg border border-border bg-card p-4",children:a.jsx(RX,{tabs:p,activeTabId:v.id,onSelect:n,kind:"generic"})}),a.jsx(o$t,{group:t,section:v,context:"discussions",onGroupUpdated:m,refetchGroups:f})]});const B=[...I,...P];return a.jsxs("div",{className:"space-y-4",children:[a.jsxs(it.div,{variants:gw,className:"rounded-lg border border-border bg-card p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Discussion channel"}),Mu(t)&&a.jsx(l$t,{group:t,section:v})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"inline-flex rounded-full border border-border p-0.5",children:[a.jsx("button",{type:"button",onClick:()=>_(!1),className:`rounded-full px-3 py-1 text-xs font-medium transition-colors ${A?"text-muted-foreground hover:text-foreground":"bg-primary text-primary-foreground"}`,children:"Recent"}),a.jsxs("button",{type:"button",onClick:()=>{_(!0),N("all")},className:`inline-flex items-center gap-1 rounded-full px-3 py-1 text-xs font-medium transition-colors ${A?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"}`,children:[a.jsx(Hg,{className:"h-3 w-3"})," Trending"]})]}),!A&&O.length>0&&a.jsxs(zn,{value:E,onValueChange:N,children:[a.jsx(On,{className:"h-8 w-[150px] text-xs",children:a.jsxs("span",{className:"flex items-center gap-1.5 truncate",children:[a.jsx(ka,{className:"h-3 w-3 shrink-0 opacity-70"}),a.jsx(Vn,{placeholder:"All topics"})]})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"all",children:"All topics"}),O.map(W=>a.jsx(pt,{value:W.id,children:W.name},W.id))]})]}),x&&a.jsxs(Z,{size:"sm",className:"rounded-full sm:hidden",onClick:r,children:[a.jsx(Dn,{className:"h-4 w-4 mr-1"})," Post"]})]})]}),g.length>1&&a.jsx(RX,{tabs:p,activeTabId:v.id,onSelect:n,kind:"generic"})]}),Mu(t)&&v.postLevel==="admin"&&!x&&a.jsxs(it.div,{variants:gw,className:"flex items-center gap-2 rounded-lg border border-border bg-muted/40 px-4 py-2.5 text-xs text-muted-foreground",children:[a.jsx(wa,{className:"h-3.5 w-3.5 shrink-0 opacity-70"}),a.jsx("span",{children:"Only admins can post in this channel. You can still read and react to posts."})]}),G>0&&a.jsx(it.div,{variants:gw,className:"sticky top-2 z-10 flex justify-center",children:a.jsxs("button",{onClick:()=>{z(),window.scrollTo({top:0,behavior:"smooth"})},className:"inline-flex items-center gap-1.5 rounded-full bg-primary px-4 py-1.5 text-xs font-semibold text-primary-foreground shadow-md transition-colors hover:bg-primary/90",children:[a.jsx(Zf,{className:"h-3.5 w-3.5"}),G===1?"1 new post":`${G} new posts`]})}),x&&a.jsx(it.div,{variants:gw,className:"flex items-center justify-end gap-2",children:a.jsxs(Z,{onClick:r,className:"rounded-full hidden sm:inline-flex",children:[a.jsx(Dn,{className:"h-4 w-4 mr-1"})," Create post"]})}),(D.isLoading||M)&&B.length===0&&a.jsxs("div",{className:"flex items-center justify-center py-16 text-muted-foreground gap-2",children:[a.jsx(Ne,{className:"h-5 w-5 animate-spin"}),a.jsx("span",{className:"text-sm",children:"Loading discussions…"})]}),D.error&&B.length===0&&!D.isLoading&&a.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 text-center space-y-3",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:D.error}),a.jsx(Z,{variant:"outline",size:"sm",onClick:z,children:"Try again"})]}),!D.isLoading&&!D.error&&B.length===0&&a.jsxs(it.div,{variants:gw,className:"rounded-lg border border-border bg-card p-8 text-center space-y-3",children:[a.jsx(Vi,{className:"h-8 w-8 text-muted-foreground mx-auto opacity-60"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["No posts in ",a.jsx("span",{className:"font-medium text-foreground",children:v.name})," yet."]}),x&&a.jsx(Z,{size:"sm",className:"rounded-full",onClick:r,children:"Start a discussion"})]}),B.length>0&&a.jsxs(it.div,{variants:gw,className:"space-y-4",children:[I.length>0&&a.jsxs("div",{className:"flex items-center gap-1.5 px-1 text-xs text-primary font-medium",children:[a.jsx(xk,{className:"h-3 w-3"}),"Pinned in ",v.name]}),a.jsx(Lse,{posts:B,feed:D,currentUserAvatar:i,currentUserName:s,canFeature:o,getCanPin:l,featuredIds:c,onToggleFeatured:d,...u,onReachEnd:D.loadMore,isLoadingMore:D.isLoadingMore,hasMore:D.hasMore,restoreScrollScope:`section:${t.id}:${v.id}:${E}:${A}`,layout:A?"list":v.sectionView==="grid"?"grid":v.sectionView==="compact"?"compact":"list"})]})]})}function Uhs(t){var n,r;const e=(t.description??"").replace(/\s+/g," ").trim();return e||((n=t.images)!=null&&n.length?"📷 Image":(r=t.attachments)!=null&&r.length?"📎 Attachment":"Message")}function zhs({messages:t,canUnpin:e,onUnpin:n,className:r}){const[s,i]=y.useState(!1);if(!t.length)return null;const o=s?t:t.slice(0,1);return a.jsxs("div",{className:ee("border-b border-border bg-amber-500/5",r),children:[o.map(l=>{var c;return a.jsxs("div",{className:"flex items-center gap-2 px-4 py-1.5",children:[a.jsx(xk,{className:"h-3.5 w-3.5 shrink-0 text-amber-600"}),a.jsxs("p",{className:"min-w-0 flex-1 truncate text-xs text-foreground",children:[a.jsxs("span",{className:"font-semibold",children:[((c=l.createdBy)==null?void 0:c.name)??"Member",": "]}),Uhs(l)]}),e&&a.jsx("button",{onClick:()=>n(l.id),className:"flex h-5 w-5 shrink-0 items-center justify-center rounded hover:bg-muted",title:"Unpin",children:a.jsx(nn,{className:"h-3 w-3 text-muted-foreground"})})]},l.id)}),t.length>1&&a.jsxs("button",{onClick:()=>i(l=>!l),className:"flex w-full items-center justify-center gap-1 px-4 pb-1.5 text-[11px] font-medium text-muted-foreground hover:text-foreground",children:[a.jsx(li,{className:ee("h-3 w-3 transition-transform",s&&"rotate-180")}),s?"Show less":`${t.length-1} more pinned`]})]})}function Vhs(t){return(t??"?").split(" ").map(e=>e[0]).filter(Boolean).join("").slice(0,2).toUpperCase()}function Hhs(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function _Je({message:t}){var e,n,r;return a.jsxs("div",{className:"flex items-start gap-2.5",children:[(e=t.createdBy)!=null&&e.picture?a.jsx("img",{src:t.createdBy.picture,alt:"",className:"h-8 w-8 rounded-full object-cover shrink-0"}):a.jsx("div",{className:"h-8 w-8 rounded-full bg-primary/10 flex items-center justify-center text-[10px] font-semibold text-primary shrink-0",children:Vhs((n=t.createdBy)==null?void 0:n.name)}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-baseline gap-2",children:[a.jsx("span",{className:"text-sm font-semibold text-foreground",children:((r=t.createdBy)==null?void 0:r.name)??"Member"}),a.jsx("span",{className:"text-[11px] text-muted-foreground",children:Hhs(t.createdAt)}),t.isEdited&&a.jsx("span",{className:"text-[10px] text-muted-foreground",children:"(edited)"})]}),t.description&&a.jsx("div",{className:"mt-0.5 break-words text-sm text-foreground",children:NRe(t.description)}),a.jsx(t5t,{text:t.description}),(t.images??[]).map(s=>a.jsx("img",{src:s,alt:"",className:"mt-2 max-h-44 max-w-[220px] rounded-lg border border-border object-cover"},s))]})]})}function Ghs({message:t,sectionName:e,canReply:n,onClose:r,onReply:s}){const[i,o]=y.useState(""),l=y.useRef(null),c=(t==null?void 0:t.replies)??[];y.useEffect(()=>{const u=l.current;u&&(u.scrollTop=u.scrollHeight)},[t==null?void 0:t.id,c.length]);const d=()=>{const u=i.trim();!u||!t||(s(t.id,u),o(""))};return a.jsx(B0,{open:!!t,onOpenChange:u=>!u&&r(),children:a.jsxs(Xy,{side:"right",className:"flex w-full flex-col gap-0 p-0 sm:max-w-md",children:[a.jsxs(eb,{className:"border-b border-border px-4 py-3 text-left",children:[a.jsx(tb,{className:"text-sm",children:"Thread"}),a.jsxs(g9,{className:"text-xs",children:["#",e]})]}),t&&a.jsxs("div",{ref:l,className:"flex-1 min-h-0 space-y-4 overflow-y-auto px-4 py-4",children:[a.jsx(_Je,{message:t}),c.length>0&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"text-[11px] font-medium text-muted-foreground",children:[c.length," ",c.length===1?"reply":"replies"]}),a.jsx("div",{className:"h-px flex-1 bg-border"})]}),a.jsx("div",{className:"space-y-4 pl-2 border-l-2 border-border/60",children:c.map(u=>a.jsx(_Je,{message:u},u.id))})]}),n?a.jsx("div",{className:"border-t border-border p-3",children:a.jsxs("div",{className:"flex items-end gap-2",children:[a.jsx("textarea",{value:i,onChange:u=>o(u.target.value),onKeyDown:u=>{u.key==="Enter"&&!u.shiftKey&&(u.preventDefault(),d())},placeholder:"Reply in thread…",rows:2,className:"flex-1 resize-none rounded-md border border-input bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),a.jsx("button",{onClick:d,disabled:!i.trim(),className:"h-9 rounded-md bg-primary px-3 text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-50",title:"Send reply",children:a.jsx(_s,{className:"h-4 w-4"})})]})}):a.jsx("p",{className:"border-t border-border px-4 py-3 text-center text-xs text-muted-foreground",children:"You can't reply in this channel."})]})})}function Q1e(t){if(!t)return[];if(Array.isArray(t))return t.map(e=>{if(typeof e=="string")return e;if(typeof e=="object"&&e!==null){const n=e;if(typeof n.name=="string")return n.name;if(typeof n.userId=="string")return n.userId;if(typeof n.id=="string")return n.id}return null}).filter(e=>!!e);if(typeof t=="object"){const e=t;if(Array.isArray(e.users))return Q1e(e.users);if(Array.isArray(e.userIds))return Q1e(e.userIds)}return[]}function Whs(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"})}function qhs(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toLocaleDateString(void 0,{weekday:"long",month:"short",day:"numeric"})}function Khs(t){const e=t.attachments??[],n=(t.images??[]).map((r,s)=>({id:`image-${s}`,url:r,mimeType:"image/*"}));return[...e,...n]}function Yhs(t,e){let n="";return t.map(r=>{var d,u,h,m,f;const s=qhs(r.createdAt),i=s&&s!==n?s:void 0;n=s||n;const o=((d=r.createdBy)==null?void 0:d.id)??"",l=o&&e.currentUserId&&o===e.currentUserId?e.currentUserName??"You":((u=r.createdBy)==null?void 0:u.name)??"Member",c={};for(const[p,g]of Object.entries(r.reactions??{})){const v=Q1e(g);v.length&&(c[p]=v)}return{id:r.id,senderId:o,author:l,avatar:((h=r.createdBy)==null?void 0:h.picture)??null,time:Whs(r.createdAt),text:r.description??"",date:i,verified:(m=r.createdBy)==null?void 0:m.isVerifiedByPensil,edited:r.isEdited,reactions:Object.keys(c).length?c:void 0,attachments:Khs(r),clientNonce:r.clientNonce??void 0,status:r.status,canDelete:!r.status&&!!(e.canModerate||o&&e.currentUserId&&o===e.currentUserId),canEdit:!r.status&&!!(o&&e.currentUserId&&o===e.currentUserId&&r.description),replyCount:r.replyCount??((f=r.replies)==null?void 0:f.length),pinned:!!r.isPinned}})}function AJe(t){return[...t].reverse()}const PJe=10;function Qhs({groupId:t,sectionId:e,enabled:n=!0,currentUser:r}){const s=rn(),{community:i}=qe(),{socket:o}=Qg(),l=(i==null?void 0:i.id)??null,[c,d]=y.useState(!0),[u,h]=y.useState(!1),m=y.useMemo(()=>["section-messages",t,e],[t,e]),f=lt({queryKey:m,queryFn:async()=>{const _=await TJe(t,e);d(_.length>=PJe);const T=s.getQueryData(m);return ERe(AJe(_),T)},enabled:n&&!!(t&&e),staleTime:15e3}),p=f.data??[],g=y.useMemo(()=>["section-pinned-messages",t,e],[t,e]),b=lt({queryKey:g,queryFn:()=>Ahs(t,e),enabled:n&&!!(t&&e),staleTime:3e4}).data??[],x=y.useCallback(_=>{s.setQueryData(g,T=>_(T??[]))},[s,g]),w=y.useCallback(_=>{s.setQueryData(m,T=>_(T??[]))},[s,m]),k=y.useCallback(async()=>{var _;if(!(!t||!e||u||!c||!p.length)){h(!0);try{const T=await TJe(t,e,(_=p[0])==null?void 0:_.id),R=AJe(T);R.length&&w(O=>{const F=new Set(O.map(I=>I.id));return[...R.filter(I=>!F.has(I.id)),...O]}),T.length<PJe&&d(!1)}catch{He.error("Couldn't load older messages")}finally{h(!1)}}},[t,e,c,u,p,w]);y.useEffect(()=>{!l||!e||!n||c$t(l,e).then(()=>s.invalidateQueries({queryKey:["user-counters"]})).catch(()=>{})},[l,e,n,s]),y.useEffect(()=>{if(!o||!e||!n)return;const _=I=>{var M;if(!((M=I.message)!=null&&M.id))return;const P=I.message;if(P.parent){w(z=>z.map(G=>{if(G.id!==P.parent)return G;const B=G.replies??[];return B.some(H=>H.id===P.id)?G:{...G,replies:[...B,P],replyCount:(G.replyCount??B.length)+1}}));return}w(z=>{const G=z.findIndex(H=>H.id===P.id||P.clientNonce&&H.clientNonce===P.clientNonce);if(G===-1)return[...z,P];const B=[...z];return B[G]={...B[G],...P,status:void 0},B})},T=I=>{var P;(P=I.message)!=null&&P.id&&w(M=>M.map(z=>z.id===I.message.id?{...z,...I.message}:z))},R=I=>{I.messageId&&w(P=>P.filter(M=>M.id!==I.messageId))},O=I=>{var P;!I.messageId||!I.emoji||!((P=I.user)!=null&&P.id)||w(M=>M.map(z=>{if(z.id!==I.messageId)return z;const G={...z.reactions??{}},B=[...G[I.emoji]??[]],H=B.indexOf(I.user.id),W=I.status==="updated"||I.status==="added"||I.status==="reacted",V=I.status==="unreacted"||I.status==="removed";return W&&H<0&&B.push(I.user.id),V&&H>=0&&B.splice(H,1),B.length?G[I.emoji]=B:delete G[I.emoji],{...z,reactions:G}}))},F=I=>{var M;const P=((M=I.message)==null?void 0:M.id)??I.messageId;P&&(w(z=>z.map(G=>G.id===P?{...G,isPinned:!0}:G)),I.message?x(z=>z.some(G=>G.id===I.message.id)?z:[I.message,...z]):s.invalidateQueries({queryKey:g}))},D=I=>{var M;const P=((M=I.message)==null?void 0:M.id)??I.messageId;P&&(w(z=>z.map(G=>G.id===P?{...G,isPinned:!1}:G)),x(z=>z.filter(G=>G.id!==P)))};return o.on(`section:${e}:message-received`,_),o.on(`section:${e}:message-edited`,T),o.on(`section:${e}:message-deleted`,R),o.on(`section:${e}:message-reaction`,O),o.on(`section:${e}:message-pinned`,F),o.on(`section:${e}:message-unpinned`,D),()=>{o.off(`section:${e}:message-received`,_),o.off(`section:${e}:message-edited`,T),o.off(`section:${e}:message-deleted`,R),o.off(`section:${e}:message-reaction`,O),o.off(`section:${e}:message-pinned`,F),o.off(`section:${e}:message-unpinned`,D)}},[o,e,n,w,x,g,s]);const S=jt({mutationFn:({text:_,parentId:T,nonce:R})=>Ihs({description:_,groupId:t,tabId:e,parentId:T??void 0,clientNonce:R}),onMutate:({text:_,parentId:T,nonce:R})=>{if(T)return;const O={id:SF(R),clientNonce:R,status:"sending",description:_,createdAt:new Date().toISOString(),createdBy:{id:(r==null?void 0:r.id)??"",name:(r==null?void 0:r.name)??"You",picture:(r==null?void 0:r.picture)??null}};w(F=>{const D=F.findIndex(P=>P.clientNonce===R);if(D===-1)return[...F,O];const I=[...F];return I[D]={...I[D],status:"sending"},I})},onError:(_,{nonce:T,parentId:R})=>{if(R){He.error(Dt(_ instanceof ze?_.body:_,"Couldn't send reply"));return}d5(_,"Couldn't send message"),w(O=>O.map(F=>F.clientNonce===T&&uk(F.id)?{...F,status:"failed"}:F))},onSuccess:(_,T)=>{if(T.parentId){w(R=>R.map(O=>{if(O.id!==T.parentId)return O;const F=O.replies??[];return F.some(D=>D.id===_.id)?O:{...O,replies:[...F,_],replyCount:(O.replyCount??F.length)+1}}));return}w(R=>{const O=R.filter(P=>!(P.id===_.id&&P.clientNonce!==T.nonce)),F=O.findIndex(P=>P.clientNonce===T.nonce||P.id===_.id),D={..._,clientNonce:T.nonce,status:void 0};if(F===-1)return[...O,D];const I=[...O];return I[F]=D,I})}}),C=jt({mutationFn:({id:_,pin:T})=>T?Phs(_):Rhs(_),onSuccess:(_,{pin:T})=>{w(R=>R.map(O=>O.id===_.id?{...O,isPinned:T}:O)),x(T?R=>R.some(O=>O.id===_.id)?R:[_,...R]:R=>R.filter(O=>O.id!==_.id))},onError:()=>He.error("Couldn't update pin")}),j=jt({mutationFn:({id:_,text:T})=>Mhs(_,{description:T,groupId:t,tabId:e}),onSuccess:_=>{w(T=>T.map(R=>R.id===_.id?_:R))},onError:_=>He.error(Dt(_ instanceof ze?_.body:_,"Couldn't edit message"))}),E=jt({mutationFn:_=>Lhs(_),onSuccess:(_,T)=>w(R=>R.filter(O=>O.id!==T)),onError:()=>He.error("Couldn't delete message")}),N=jt({mutationFn:({files:_,nonce:T})=>Ohs({groupId:t,tabId:e},_,T),onMutate:({files:_,nonce:T})=>{const R=l5(T)?[]:CRe(T,_),O={id:SF(T),clientNonce:T,status:"sending",description:"",attachments:jRe(_,R),createdAt:new Date().toISOString(),createdBy:{id:(r==null?void 0:r.id)??"",name:(r==null?void 0:r.name)??"You",picture:(r==null?void 0:r.picture)??null}};w(F=>{const D=F.findIndex(P=>P.clientNonce===T);if(D===-1)return[...F,O];const I=[...F];return I[D]={...I[D],status:"sending"},I})},onSuccess:(_,{nonce:T})=>{w(R=>{const O=R.filter(P=>!(P.id===_.id&&P.clientNonce!==T)),F=O.findIndex(P=>P.clientNonce===T||P.id===_.id),D={..._,clientNonce:T,status:void 0};if(F===-1)return[...O,D];const I=[...O];return I[F]=D,I}),c5(T)},onError:(_,{nonce:T})=>{d5(_,"Couldn't upload attachment"),w(R=>R.map(O=>O.clientNonce===T&&uk(O.id)?{...O,status:"failed"}:O))}}),A=async(_,T,R)=>{const O=p.find(I=>I.id===_),F=O?Object.entries(O.reactions??{}).find(([,I])=>R&&I.includes(R)):void 0,D=(F==null?void 0:F[0])===T;try{const I=D?await $hs(_,T):await Dhs(_,T);w(P=>P.map(M=>M.id===_?I:M))}catch{He.error("Couldn't update reaction")}};return{messages:p,pinnedMessages:b,isLoading:f.isLoading,isError:f.isError,error:f.error,refetch:f.refetch,loadMore:k,loadingMore:u,hasMore:c,sendMessage:_=>S.mutate({text:_,nonce:s2()}),sendReply:(_,T)=>S.mutate({text:T,parentId:_,nonce:s2()}),resendMessage:_=>{const T=(s.getQueryData(m)??[]).find(O=>O.clientNonce===_);if(!T)return;w(O=>O.map(F=>F.clientNonce===_?{...F,status:"sending"}:F));const R=l5(_);R!=null&&R.length?N.mutate({files:R,nonce:_}):S.mutate({text:T.description??"",nonce:_})},discardFailed:_=>{c5(_),w(T=>T.filter(R=>!(R.clientNonce===_&&R.status==="failed")))},editMessage:(_,T)=>j.mutate({id:_,text:T}),deleteMessage:E.mutate,uploadAttachments:_=>N.mutate({files:_,nonce:s2()}),handleReact:A,togglePin:(_,T)=>C.mutate({id:_,pin:T}),isSending:S.isPending||N.isPending}}const PH={hidden:{opacity:0,y:8},show:{opacity:1,y:0}};function Zhs({group:t,activeSection:e,onSectionSelect:n,onGroupUpdated:r,refetchGroups:s}){var U;const{user:i}=jr(),o=((U=ro())==null?void 0:U.id)??(i==null?void 0:i.id)??"",l=i?`${i.firstName} ${i.lastName}`:"You",c=qB(t),d=c.filter(ne=>Mf(ne)),u=e&&Mf(e)?e:d[0]??null,h=u?gAe(t,u):!1,m=u?zvr(t,u):!1,{counts:f,setActiveSection:p}=dse(),g=y.useRef({});u!=null&&u.id&&g.current[u.id]===void 0&&(g.current[u.id]=f[u.id]??0);const v=u!=null&&u.id?g.current[u.id]??0:0;y.useEffect(()=>{if(!(!(u!=null&&u.id)||!h))return p(u.id),()=>p(null)},[u==null?void 0:u.id,h,p]);const[b,x]=y.useState(null),w=sse(t);y.useEffect(()=>{let ne=0;const te=window.setInterval(()=>{ne+=1;const re=document.querySelector('[data-placeholder^="Message "]');if(re){re.scrollIntoView({block:"end"}),window.clearInterval(te);return}ne>=10&&window.clearInterval(te)},150);return()=>window.clearInterval(te)},[u==null?void 0:u.id]);const{messages:k,pinnedMessages:S,isLoading:C,isError:j,refetch:E,loadMore:N,loadingMore:A,hasMore:_,sendMessage:T,sendReply:R,editMessage:O,deleteMessage:F,uploadAttachments:D,handleReact:I,togglePin:P,isSending:M,resendMessage:z,discardFailed:G}=Qhs({groupId:t.id,sectionId:u==null?void 0:u.id,enabled:h&&!!(u!=null&&u.id),currentUser:{id:o,name:l}}),B=ise(t),H=y.useMemo(()=>Yhs(k,{currentUserId:o,currentUserName:l,canModerate:B}),[k,o,l,B]),W=y.useMemo(()=>{var ne;return!v||v>=k.length?null:((ne=k[k.length-v])==null?void 0:ne.id)??null},[v,k]),V=y.useMemo(()=>b?k.find(ne=>ne.id===b)??null:null,[b,k]);return u?h?a.jsxs("div",{className:"space-y-4",children:[a.jsxs(it.div,{variants:PH,className:"rounded-lg border border-border bg-card p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 flex-wrap",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:"Chat channel"}),Mu(t)&&a.jsx(l$t,{group:t,section:u})]}),a.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Group channel chat — for DMs see"," ",a.jsx(vr,{to:ve.chat,className:"text-primary hover:underline font-medium",children:"Messages"})]})]}),d.length>1&&a.jsx(RX,{tabs:c,activeTabId:u.id,onSelect:n,kind:"realtime"})]}),a.jsxs(it.div,{variants:PH,className:"sticky top-0 z-10 rounded-lg border border-border bg-card overflow-hidden flex flex-col min-h-0 h-[calc(100dvh-5.5rem)]",children:[C&&H.length===0?a.jsxs("div",{className:"flex flex-1 items-center justify-center gap-2 text-muted-foreground",children:[a.jsx(Ne,{className:"h-5 w-5 animate-spin"}),a.jsx("span",{className:"text-sm",children:"Loading messages…"})]}):j&&H.length===0?a.jsxs("div",{className:"flex flex-1 flex-col items-center justify-center gap-3 p-8 text-center",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Couldn't load messages for this channel."}),a.jsx(Z,{variant:"outline",size:"sm",onClick:()=>E(),children:"Try again"})]}):a.jsxs(a.Fragment,{children:[a.jsx(zhs,{messages:S,canUnpin:w,onUnpin:ne=>P(ne,!1)}),a.jsx(TRe,{activeContact:u.name,subtitle:`${t.name} · channel chat`,messages:H,onSend:ne=>{m&&T(ne)},onResend:z,onDiscardFailed:G,onReact:(ne,te)=>void I(ne,te,o),onDelete:ne=>F(ne),confirmDelete:!0,onEdit:(ne,te)=>O(ne,te),onAttach:m?ne=>D(ne):void 0,onOpenThread:ne=>x(ne),onTogglePin:w?(ne,te)=>P(ne,te):void 0,onLoadMore:_?N:void 0,loadingMore:A,unreadFromId:W,hideComposer:!m})]}),!m&&!C&&a.jsx("p",{className:"border-t border-border px-5 py-3 text-center text-xs text-muted-foreground bg-muted/30",children:Mu(t)?`You don't have permission to send messages in ${u.name}.`:`Join this group to send messages in ${u.name}.`})]}),a.jsx(Ghs,{message:V,sectionName:u.name,canReply:m,onClose:()=>x(null),onReply:(ne,te)=>R(ne,te)})]}):a.jsxs("div",{className:"space-y-4",children:[d.length>1&&a.jsx(it.div,{variants:PH,className:"rounded-lg border border-border bg-card p-4",children:a.jsx(RX,{tabs:c,activeTabId:u.id,onSelect:n,kind:"realtime"})}),a.jsx(o$t,{group:t,section:u,context:"chat",onGroupUpdated:r,refetchGroups:s})]}):a.jsxs(it.div,{variants:PH,className:"rounded-lg border border-dashed border-border bg-card p-10 text-center",children:[a.jsx(Vi,{className:"h-8 w-8 mx-auto text-muted-foreground opacity-60 mb-3"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"No chat channels in this group yet."})]})}function Jhs(t){return t?t.charAt(0).toUpperCase()+t.slice(1):"Member"}function Xhs({group:t}){var o,l,c,d,u;const e=Number(t.userCount??0),n=IZ(t),r=C2t(t),s=((o=t.description)==null?void 0:o.trim())||((c=(l=t.meta)==null?void 0:l.description)==null?void 0:c.trim())||"No description yet.",i=((d=t.tags)==null?void 0:d.filter(Boolean))??[];return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"rounded-lg border border-border bg-card p-5 shadow-card space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-bold text-foreground mb-2",children:"About this group"}),a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed whitespace-pre-wrap",children:s})]}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2 text-sm",children:[a.jsxs("div",{className:"rounded-md border border-border/70 px-3 py-2.5",children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Privacy"}),a.jsxs("p",{className:"font-medium text-foreground flex items-center gap-1.5",children:[a.jsx(Qd,{className:"h-3.5 w-3.5 text-muted-foreground"}),CN(t.groupType)]})]}),t.myRole&&a.jsxs("div",{className:"rounded-md border border-border/70 px-3 py-2.5",children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Your role"}),a.jsx("p",{className:"font-medium text-foreground",children:Jhs(t.myRole)})]}),((u=t.webUrl)==null?void 0:u.trim())&&a.jsxs("div",{className:"rounded-md border border-border/70 px-3 py-2.5 sm:col-span-2",children:[a.jsx("p",{className:"text-xs text-muted-foreground mb-1",children:"Website"}),a.jsxs("a",{href:t.webUrl,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-primary inline-flex items-center gap-1.5 hover:underline break-all",children:[t.webUrl,a.jsx(bo,{className:"h-3.5 w-3.5 shrink-0"})]})]})]}),i.length>0&&a.jsxs("div",{children:[a.jsxs("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide mb-2 flex items-center gap-1.5",children:[a.jsx(ka,{className:"h-3.5 w-3.5"}),"Tags"]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:i.map(h=>a.jsx(ga,{variant:"secondary",className:"text-xs",children:h},h))})]})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-card p-5 shadow-card",children:[a.jsx("h3",{className:"text-sm font-bold text-foreground mb-3",children:"Stats"}),a.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-4 text-center",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl font-bold text-foreground",children:e||"—"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Members"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl font-bold text-foreground",children:n.length}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Discussions"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl font-bold text-foreground",children:r.length}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Chat channels"})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl font-bold text-foreground",children:t.notesCount??"—"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Posts"})]})]})]})]})}function ems({group:t}){const e=Nn(),{events:n,isLoading:r,error:s}=$3r(t.id);return r?a.jsx("div",{className:"flex items-center justify-center py-16 text-muted-foreground",children:a.jsx(Ne,{className:"h-6 w-6 animate-spin"})}):s?a.jsx("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:s})}):n.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center",children:[a.jsx(ym,{className:"h-10 w-10 text-muted-foreground/40 mb-3"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"No events shared in this group yet."})]}):a.jsx(it.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:"rounded-xl border border-border bg-card shadow-card p-4 sm:p-5 space-y-3",children:n.map(i=>a.jsxs("div",{onClick:()=>e(Nk(i)),className:"group flex gap-4 p-3 rounded-lg border border-border bg-background hover:shadow-md hover:border-primary/20 cursor-pointer transition-all duration-200",children:[a.jsx("div",{className:"w-24 h-16 rounded-md overflow-hidden shrink-0 bg-muted",children:i.hasBanner?a.jsx("img",{src:i.thumbnail,alt:i.title,className:"w-full h-full object-cover group-hover:scale-105 transition-transform duration-300"}):a.jsx("div",{className:"w-full h-full flex items-center justify-center bg-gradient-to-br from-primary/20 to-primary/5",children:a.jsx(ym,{className:"h-6 w-6 text-primary/50"})})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("p",{className:"text-xs text-muted-foreground mb-0.5",children:[i.date,", ",i.time]}),a.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[a.jsx(SPe,{startTime:i.startTime,endTime:i.endTime,meetingUnavailable:i.meetingUnavailable}),a.jsx("h3",{className:"text-sm font-semibold text-foreground truncate",children:i.title})]}),a.jsxs("p",{className:"flex items-center gap-1 text-xs text-muted-foreground mb-1 truncate",children:[i.isOnline?a.jsx(wk,{className:"h-3 w-3 shrink-0 opacity-70"}):a.jsx(Jf,{className:"h-3 w-3 shrink-0 opacity-70"}),a.jsx("span",{className:"truncate",children:i.isOnline?"Online":i.location||"In person"})]}),a.jsxs("div",{className:"flex items-center justify-between mt-1.5",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(oo,{className:"h-5 w-5",children:[a.jsx(lo,{src:i.organizerAvatar}),a.jsx(co,{className:"text-[8px] bg-primary/10 text-primary",children:i.organiser.split(" ").map(o=>o[0]).join("")})]}),a.jsx("span",{className:"text-xs text-muted-foreground",children:i.organiser})]}),a.jsxs("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(wr,{className:"h-3 w-3"}),a.jsx("span",{children:i.attendees})]})]})]})]},i.realId))})}function tms({group:t,open:e,onOpenChange:n,onCopied:r}){const{community:s}=qe(),i=(s==null?void 0:s.myRole)==="admin",o=s==null?void 0:s.id,[l,c]=y.useState([{name:"",email:""}]),[d,u]=y.useState(!1),h=fae(t),m=`${window.location.origin}${h}`,f=async()=>{await navigator.clipboard.writeText(m),r==null||r()},p=()=>c([{name:"",email:""}]),g=async()=>{if(!o)return;const v=l.filter(x=>x.email.trim()).map(x=>({name:x.name.trim(),email:x.email.trim()}));if(v.length===0){He.error("Add at least one email");return}if(v.some(x=>!T5t.test(x.email))){He.error("Please enter a valid email address");return}if(window.confirm(`Are you sure you want to send an invite email to ${v.length} ${v.length===1?"user":"users"}?`)){u(!0);try{await NF(o,v,{groupId:t.id}),He.success(v.length===1?"Invitation sent":"Invitations sent"),p()}catch(x){const w=x instanceof ze?Dt(x.body,x.message):"Couldn't send the invitation";He.error(w)}finally{u(!1)}}};return a.jsx(Bt,{open:e,onOpenChange:v=>{v||p(),n(v)},children:a.jsxs(Ft,{className:"max-w-md",children:[a.jsxs(Vt,{children:[a.jsxs(Ut,{children:["Invite to ",t.name]}),a.jsx(_n,{children:"Share a link or invite people by email to join this group."})]}),a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[a.jsx(eu,{className:"h-4 w-4 text-muted-foreground"}),"Invite via link"]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Oe,{readOnly:!0,value:m,className:"text-xs"}),a.jsx(Z,{type:"button",variant:"outline",size:"icon",onClick:f,"aria-label":"Copy invite link",children:a.jsx(Zl,{className:"h-4 w-4"})})]})]}),i?a.jsxs("div",{className:"space-y-3 border-t border-border pt-4",children:[a.jsx("div",{className:"text-sm font-medium text-foreground",children:"Invite via email"}),l.map((v,b)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Oe,{placeholder:"Name",value:v.name,onChange:x=>c(l.map((w,k)=>k===b?{...w,name:x.target.value}:w))}),a.jsx(Oe,{placeholder:"Email",type:"email",value:v.email,onChange:x=>c(l.map((w,k)=>k===b?{...w,email:x.target.value}:w))}),l.length>1?a.jsx("button",{type:"button",onClick:()=>c(l.filter((x,w)=>w!==b)),className:"text-muted-foreground hover:text-foreground",children:a.jsx(nn,{className:"h-4 w-4"})}):a.jsx("span",{className:"w-4"})]},b)),a.jsxs("button",{type:"button",onClick:()=>c([...l,{name:"",email:""}]),className:"inline-flex items-center gap-1 text-xs text-primary hover:underline",children:[a.jsx(Dn,{className:"h-3 w-3"})," Add more"]}),a.jsx(Z,{className:"w-full",disabled:d,onClick:()=>void g(),children:d?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):"Send invite"})]}):null]})]})})}const RJe=20,nms=400,rms=120;function sms(t){return t.trim().split(/\s+/).map(e=>e[0]).filter(Boolean).slice(0,2).join("").toUpperCase()||"?"}function ims({open:t,onOpenChange:e,groupId:n,groupName:r,onMemberAdded:s}){const{community:i}=qe(),o=(i==null?void 0:i.id)??null,{toast:l}=yt(),c=rn(),[d,u]=y.useState(""),[h,m]=y.useState(""),[f,p]=y.useState([]),[g,v]=y.useState(1),[b,x]=y.useState(!0),[w,k]=y.useState(!1),[S,C]=y.useState(!1),[j,E]=y.useState(!1),[N,A]=y.useState(null),[_,T]=y.useState(new Set),R=y.useRef(null),O=y.useRef(!1);y.useEffect(()=>{const z=setTimeout(()=>m(d.trim()),nms);return()=>clearTimeout(z)},[d]);const F=y.useCallback(async(z,G,B)=>{if(!(!o||O.current)){O.current=!0,B?k(!0):C(!0),E(!1);try{const H=await Dy(o,{page:z,limit:RJe,search:G||void 0,annotateGroupId:n});p(W=>{if(B)return H.users;const V=new Set(W.map(U=>U.id));return[...W,...H.users.filter(U=>!V.has(U.id))]}),x(H.users.length>=RJe),v(z)}catch{E(!0),x(!1)}finally{O.current=!1,k(!1),C(!1)}}},[o,n]);y.useEffect(()=>{t&&(p([]),x(!0),R.current&&(R.current.scrollTop=0),F(1,h,!0))},[t,h,F]),y.useEffect(()=>{t||(u(""),m(""),T(new Set))},[t]);const D=()=>{const z=R.current;!z||w||S||!b||z.scrollTop+z.clientHeight>=z.scrollHeight-rms&&F(g+1,h,!1)},I=async z=>{A(z.id);try{await x2t(n,z.id,"user"),T(G=>new Set(G).add(z.id)),l({title:`${z.name} added to ${r}`}),c.invalidateQueries({queryKey:["group-members",n]}),s==null||s()}catch(G){l({title:"Couldn't add member",description:Dt(G instanceof ze?G.body:G,"Please try again."),variant:"destructive"})}finally{A(null)}},P=z=>_.has(z.id)||!!z.groupRole,M=y.useMemo(()=>w?null:j?"Couldn't load members. Please try again.":f.length?null:h?"No members match your search.":"No members to add.",[w,j,f.length,h]);return a.jsx(B0,{open:t,onOpenChange:e,children:a.jsxs(Xy,{side:"right",className:"flex w-full flex-col gap-0 p-0 sm:max-w-md",children:[a.jsxs(eb,{className:"space-y-1 border-b border-border px-5 py-4 text-left",children:[a.jsx(tb,{children:"Add members"}),a.jsxs(g9,{children:["Add existing community members to ",r,"."]})]}),a.jsx("div",{className:"border-b border-border px-5 py-3",children:a.jsxs("div",{className:"relative",children:[a.jsx(hs,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Oe,{value:d,onChange:z=>u(z.target.value),placeholder:"Search by name or username",className:"pl-9",autoFocus:!0})]})}),a.jsxs("div",{ref:R,onScroll:D,className:"min-h-0 flex-1 overflow-y-auto",children:[w?a.jsxs("div",{className:"flex items-center justify-center py-10 text-sm text-muted-foreground",children:[a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"})," Loading members…"]}):M?a.jsx("p",{className:"px-5 py-10 text-center text-sm text-muted-foreground",children:M}):a.jsx("ul",{className:"divide-y divide-border/60",children:f.map(z=>{const G=P(z);return a.jsxs("li",{className:"flex items-center gap-3 px-5 py-3",children:[a.jsxs(oo,{className:"h-9 w-9 shrink-0",children:[z.picture?a.jsx(lo,{src:z.picture,alt:""}):null,a.jsx(co,{className:"text-xs",children:sms(z.name)})]}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:z.name}),z.userId&&a.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:["@",z.userId]})]}),G?a.jsxs("span",{className:ee("inline-flex shrink-0 items-center gap-1 text-xs font-medium",_.has(z.id)?"text-emerald-600":"text-muted-foreground"),children:[a.jsx(Qn,{className:"h-3.5 w-3.5"}),_.has(z.id)?"Added":"Member"]}):a.jsx(Z,{size:"sm",variant:"outline",className:"shrink-0",disabled:N===z.id,onClick:()=>void I(z),children:N===z.id?a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"}):a.jsxs(a.Fragment,{children:[a.jsx(Sa,{className:"mr-1 h-3.5 w-3.5"})," Add"]})})]},z.id)})}),S&&a.jsxs("div",{className:"flex items-center justify-center py-4 text-xs text-muted-foreground",children:[a.jsx(Ne,{className:"mr-2 h-3.5 w-3.5 animate-spin"})," Loading more…"]}),!w&&!S&&!b&&f.length>0&&a.jsx("p",{className:"py-4 text-center text-xs text-muted-foreground",children:"No more members"})]})]})})}function ams(t,e,n){const[r,s]=y.useState([]),[i,o]=y.useState(0),[l,c]=y.useState(!1),[d,u]=y.useState(null),[h,m]=y.useState(null),f=y.useCallback(async()=>{if(!t||!e||!n){s([]);return}c(!0),u(null);try{const g=await dhr(t,e,{limit:50});s(g.members??[]),o(g.joinedUserCount??0)}catch(g){u(g instanceof ze?Dt(g.body,g.message):"Couldn't load members.")}finally{c(!1)}},[t,e,n]);y.useEffect(()=>{f()},[f]);const p=y.useCallback(async(g,v)=>{if(!e)return{ok:!1,message:"No section"};m(v);try{return g==="accept"?await Zur(t,e,v):await Jur(t,e,v),await f(),{ok:!0}}catch(b){return{ok:!1,message:b instanceof ze?Dt(b.body,b.message):"Action failed."}}finally{m(null)}},[t,e,f]);return{members:r,requested:r.filter(g=>g.tabStatus==="requested"),joinedCount:i,loading:l,error:d,actingId:h,accept:g=>p("accept",g),reject:g=>p("reject",g),reload:f}}function oms({group:t}){var p;const{toast:e}=yt(),n=y.useMemo(()=>(t.tabs??[]).filter(g=>g.isClosed),[t.tabs]),[r,s]=y.useState(((p=n[0])==null?void 0:p.id)??null),i=ise(t),{requested:o,joinedCount:l,loading:c,error:d,actingId:u,accept:h,reject:m}=ams(t.id,r,i);if(!i||n.length===0)return null;const f=async(g,v,b)=>{const x=g==="accept"?await h(v):await m(v);x.ok?e({title:g==="accept"?"Request approved":"Request rejected",description:`${b??"Member"}'s access request was ${g==="accept"?"approved":"rejected"}.`}):e({title:"Action failed",description:x.message??"Try again.",variant:"destructive"})};return a.jsxs("div",{className:"rounded-lg border border-border bg-card shadow-card overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2 border-b border-border p-4",children:[a.jsx(wa,{className:"h-4 w-4 text-muted-foreground"}),a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Closed channel access"})]}),a.jsx("div",{className:"flex flex-wrap gap-2 p-4 pb-0",children:n.map(g=>a.jsx("button",{onClick:()=>s(g.id),className:`rounded-full border px-3 py-1 text-xs font-medium transition-colors ${r===g.id?"border-primary bg-primary text-primary-foreground":"border-border bg-background text-muted-foreground hover:bg-muted"}`,children:g.name},g.id))}),a.jsx("div",{className:"p-4",children:c?a.jsxs("div",{className:"flex items-center gap-2 py-4 text-sm text-muted-foreground",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"})," Loading requests…"]}):d?a.jsx("p",{className:"py-4 text-sm text-destructive",children:d}):a.jsxs(a.Fragment,{children:[a.jsxs("p",{className:"mb-3 text-xs text-muted-foreground",children:[l," member",l===1?"":"s"," ·"," ",o.length," pending request",o.length===1?"":"s"]}),o.length===0?a.jsx("p",{className:"py-2 text-sm text-muted-foreground",children:"No pending requests."}):a.jsx("div",{className:"space-y-2",children:o.map(g=>{const v=u===g.id;return a.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-border/70 px-3 py-2",children:[a.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:g.name??"Member"}),a.jsxs("div",{className:"flex shrink-0 gap-2",children:[a.jsx(Z,{size:"sm",variant:"outline",className:"h-7 px-2",disabled:v,onClick:()=>f("accept",g.id,g.name),children:v?a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(Qn,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{size:"sm",variant:"ghost",className:"h-7 px-2 text-destructive hover:text-destructive",disabled:v,onClick:()=>f("reject",g.id,g.name),children:a.jsx(nn,{className:"h-3.5 w-3.5"})})]})]},g.id)})})]})})]})}const IJe=20;function lms(t){return t.groupMembers??t.members??[]}function cms(t,e=!0){const n=rn(),[r,s]=y.useState(""),[i,o]=y.useState(""),[l,c]=y.useState(1),[d,u]=y.useState([]);y.useEffect(()=>{const x=window.setTimeout(()=>o(r.trim()),400);return()=>window.clearTimeout(x)},[r]),y.useEffect(()=>{c(1),u([])},[t,i]);const h=lt({queryKey:["group-members",t,l,i],queryFn:()=>zur(t,{page:l,limit:IJe,query:i||void 0}),enabled:!!t&&e,staleTime:3e4}),m=y.useMemo(()=>h.data?lms(h.data):[],[h.data]);y.useEffect(()=>{h.data&&u(x=>{if(l===1)return m;const w=new Set(x.map(S=>S.id)),k=m.filter(S=>!w.has(S.id));return[...x,...k]})},[h.data,l,m]);const f=m.length>=IJe,p=y.useCallback(()=>{!f||h.isFetching||c(x=>x+1)},[f,h.isFetching]),g=y.useCallback(()=>{c(1),u([]),n.invalidateQueries({queryKey:["group-members",t]})},[t,n]),v=y.useCallback(x=>{u(w=>w.map(k=>k.id===x.id?{...k,...x}:k))},[]),b=y.useCallback(x=>{u(w=>w.filter(k=>k.id!==x))},[]);return{members:d,searchQuery:r,setSearchQuery:s,isLoading:h.isLoading&&l===1,isFetching:h.isFetching,isError:h.isError,error:h.error,hasMore:f,loadMore:p,refresh:g,updateMemberLocally:v,removeMemberLocally:b}}function MJe(t){return!t||t==="user"?"Member":t.charAt(0).toUpperCase()+t.slice(1)}function LJe(t){var n;const e=(t??"?").trim().split(/\s+/).filter(Boolean);return e.length>=2?`${e[0][0]??""}${e[e.length-1][0]??""}`.toUpperCase():(((n=e[0])==null?void 0:n.slice(0,2))??"?").toUpperCase()}function DJe(t){return!!(t!=null&&t.startsWith("http"))}function dms(t){return t==="admin"?"default":t==="moderator"?"secondary":"outline"}function ums({group:t}){var P;const e=Nn(),{toast:n}=yt(),[r,s]=y.useState(null),[i,o]=y.useState(null),l=Mu(t)||t.groupType==="open",c=ise(t),d=sse(t),{community:u}=qe(),{communityDetail:h}=Ln(),m=!!(h!=null&&h.isDirectMessageDisabled),f=((P=jr().user)==null?void 0:P.id)??null,{members:p,searchQuery:g,setSearchQuery:v,isLoading:b,isFetching:x,isError:w,error:k,hasMore:S,loadMore:C,refresh:j,updateMemberLocally:E,removeMemberLocally:N}=cms(t.id,l),A=y.useMemo(()=>c?p.filter(M=>M.groupStatus==="requested"):[],[c,p]),{members:_}=UAe(),T=y.useMemo(()=>new Set(_.map(M=>M.id)),[_]),R=y.useMemo(()=>new Set(_.map(M=>M.name.trim().toLowerCase())),[_]),O=M=>{var G;if(M.userId&&T.has(M.userId)||T.has(M.id))return!0;const z=(G=M.name)==null?void 0:G.trim().toLowerCase();return!!(z&&R.has(z))},F=async(M,z)=>{s(M.id);try{await x2t(t.id,M.id,z),E({...M,groupRole:z}),n({title:"Role updated",description:`${M.name??"Member"} is now ${MJe(z)}.`})}catch(G){const B=G instanceof ze?Dt(G.body,G.message):"Could not update role.";n({title:"Update failed",description:B,variant:"destructive"})}finally{s(null)}},D=async(M,z)=>{s(M.id);try{z==="accept"?(await Wur(t.id,M.id),E({...M,groupStatus:"joined"}),n({title:"Request approved",description:`${M.name??"Member"} joined the group.`})):(await qur(t.id,M.id),N(M.id),n({title:"Request rejected",description:`${M.name??"Member"}'s request was rejected.`}))}catch(G){const B=G instanceof ze?Dt(G.body,G.message):"Could not update request.";n({title:"Action failed",description:B,variant:"destructive"})}finally{s(null)}},I=async M=>{s(M.id);try{await Kur(t.id,M.id),N(M.id),n({title:"Member removed",description:`${M.name??"Member"} was removed from the group.`})}catch(z){const G=z instanceof ze?Dt(z.body,z.message):"Could not remove member.";n({title:"Remove failed",description:G,variant:"destructive"})}finally{s(null),o(null)}};return l?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"space-y-4",children:[A.length>0&&a.jsxs("div",{className:"rounded-lg border border-amber-500/40 bg-amber-500/5 shadow-card overflow-hidden",children:[a.jsxs("div",{className:"px-4 py-3 border-b border-amber-500/30 flex items-center gap-2",children:[a.jsx(Sa,{className:"h-4 w-4 text-amber-600"}),a.jsxs("h3",{className:"text-sm font-semibold text-foreground",children:["Join requests",a.jsxs("span",{className:"ml-2 text-xs font-normal text-muted-foreground",children:[A.length," pending"]})]})]}),a.jsx("div",{className:"divide-y divide-border",children:A.map(M=>{const z=r===M.id,G=DJe(M.picture)?M.picture:null;return a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 gap-3",children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[G?a.jsx("img",{src:G,alt:M.name??"Member",className:"h-9 w-9 rounded-full object-cover shrink-0"}):a.jsx("div",{className:"h-9 w-9 rounded-full bg-primary/10 flex items-center justify-center text-primary text-xs font-semibold shrink-0",children:LJe(M.name)}),a.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:M.name??"Member"})]}),a.jsxs("div",{className:"flex items-center gap-2 shrink-0",children:[a.jsxs(Z,{size:"sm",className:"h-8",disabled:z,onClick:()=>D(M,"accept"),children:[z?a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(Qn,{className:"h-3.5 w-3.5 mr-1"}),"Approve"]}),a.jsxs(Z,{size:"sm",variant:"outline",className:"h-8",disabled:z,onClick:()=>D(M,"reject"),children:[a.jsx(nn,{className:"h-3.5 w-3.5 mr-1"})," Reject"]})]})]},M.id)})})]}),a.jsx(oms,{group:t}),a.jsxs("div",{className:"rounded-lg border border-border bg-card shadow-card overflow-hidden",children:[a.jsx("div",{className:"p-4 border-b border-border",children:a.jsxs("div",{className:"relative",children:[a.jsx(hs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted-foreground"}),a.jsx("input",{type:"text",placeholder:"Search members…",value:g,onChange:M=>v(M.target.value),className:"w-full h-9 rounded-md border border-input bg-background pl-9 pr-3 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/30"})]})}),b&&a.jsxs("div",{className:"flex items-center justify-center py-12 text-muted-foreground gap-2",children:[a.jsx(Ne,{className:"h-5 w-5 animate-spin"}),a.jsx("span",{className:"text-sm",children:"Loading members…"})]}),w&&!b&&a.jsxs("div",{className:"p-6 text-center space-y-3",children:[a.jsxs("p",{className:"text-sm text-destructive",children:["Could not load members. ",dn(k,"Please try again.")]}),a.jsx(Z,{variant:"outline",size:"sm",onClick:j,children:"Try again"})]}),!b&&!w&&a.jsx("div",{className:"divide-y divide-border",children:p.filter(M=>!c||M.groupStatus!=="requested").map(M=>{const z=r===M.id,G=O(M),B=DJe(M.picture)?M.picture:null;return a.jsxs("div",{className:"flex items-center justify-between px-4 py-3 hover:bg-muted/50 transition-colors",children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[a.jsxs("div",{className:"relative shrink-0",children:[B?a.jsx("img",{src:B,alt:M.name??"Member",className:"h-10 w-10 rounded-full object-cover"}):a.jsx("div",{className:"h-10 w-10 rounded-full bg-primary/10 flex items-center justify-center text-primary text-xs font-semibold",children:LJe(M.name)}),G&&a.jsx("span",{className:"absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full bg-emerald-500 border-2 border-card"})]}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:M.name??"Member"}),a.jsxs("div",{className:"flex items-center gap-2 flex-wrap",children:[a.jsx(ga,{variant:dms(M.groupRole),className:"text-[10px] px-1.5 py-0",children:MJe(M.groupRole)}),G&&a.jsx("span",{className:"text-[10px] text-emerald-500",children:"Online"}),!G&&M.groupStatus&&M.groupStatus!=="joined"&&a.jsx("span",{className:"text-[10px] text-amber-600 capitalize",children:M.groupStatus})]})]})]}),a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",disabled:z,children:z?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[M.name&&a.jsx(ot,{onClick:()=>e(ve.member(M.id)),children:"View profile"}),!m&&M.id!==f&&a.jsxs(ot,{onClick:()=>c0(e,{id:M.id,name:M.name??"",avatar:M.picture??void 0,userId:M.userId??void 0,communityId:u==null?void 0:u.id}),children:[a.jsx(Vi,{className:"h-4 w-4 mr-2"}),"Message"]}),d&&M.groupRole!=="admin"&&a.jsxs(a.Fragment,{children:[a.jsx(mi,{}),a.jsx(ot,{onClick:()=>F(M,"admin"),children:"Make admin"}),a.jsx(ot,{onClick:()=>F(M,"moderator"),children:"Make moderator"}),M.groupRole==="moderator"&&a.jsx(ot,{onClick:()=>F(M,"user"),children:"Make member"})]}),c&&M.groupRole!=="admin"&&a.jsxs(a.Fragment,{children:[a.jsx(mi,{}),a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>o(M),children:[a.jsx(O8,{className:"h-4 w-4 mr-2"}),"Remove from group"]})]})]})]})]},M.id)})}),!b&&!w&&p.length===0&&a.jsx("div",{className:"py-12 text-center text-sm text-muted-foreground",children:"No members found."}),!b&&!w&&S&&a.jsx("div",{className:"p-4 border-t border-border text-center",children:a.jsx(Z,{variant:"outline",size:"sm",onClick:C,disabled:x,children:x?a.jsxs(a.Fragment,{children:[a.jsx(Ne,{className:"h-3.5 w-3.5 mr-1.5 animate-spin"}),"Loading…"]}):"Load more"})})]})]}),a.jsx(Kr,{open:!!i,onOpenChange:M=>!M&&o(null),children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Remove member?"}),a.jsxs(zr,{children:[(i==null?void 0:i.name)??"This member"," will be removed from “",t.name,"”. They can rejoin later if the group allows it."]})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:"Cancel"}),a.jsx(Yr,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>i&&void I(i),children:"Remove"})]})]})})]}):a.jsxs("div",{className:"rounded-lg border border-dashed border-border bg-card p-10 text-center space-y-3",children:[a.jsx(wr,{className:"h-8 w-8 mx-auto text-muted-foreground opacity-60"}),a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Members are private"}),a.jsx("p",{className:"text-sm text-muted-foreground max-w-md mx-auto",children:"Join this group to see the member list."})]})}function hms({group:t}){const{community:e}=qe(),n=tv(),r=(e==null?void 0:e.myRole)==="admin";return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:[a.jsx(Hg,{className:"h-5 w-5 text-primary"})," Group leaderboard"]}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-1",children:["Top contributors in ",t.name,", ranked by ",n," earned in this group."]})]}),a.jsx(U5t,{communityId:(e==null?void 0:e.id)??"",isAdmin:r,groupId:t.id})]})}function $Je(t){return[...t.tabs??[]].sort((e,n)=>(e.sortOrder??0)-(n.sortOrder??0))}function mms({group:t,open:e,onOpenChange:n,onGroupUpdated:r,refetchGroups:s}){const{toast:i}=yt(),o=bAe({group:t,onGroupUpdated:r,refetchGroups:s}),[l,c]=y.useState($Je(t)),[d,u]=y.useState(!1),[h,m]=y.useState(null),[f,p]=y.useState(!1),[g,v]=y.useState(null);y.useEffect(()=>{c($Je(t)),u(!1)},[t]);const b=(k,S)=>{const C=[...l],j=k+S;j<0||j>=C.length||([C[k],C[j]]=[C[j],C[k]],c(C),u(!0))},x=async()=>{const k=l.map((C,j)=>({tabId:C.id,sortOrder:j})),S=await o.reorderChannels(k);S.ok?i({title:"Order saved"}):i({title:"Couldn't save order",description:S.message,variant:"destructive"})},w=async()=>{if(!g)return;const k=await o.deleteChannel(g.id);k.ok?i({title:"Channel deleted",description:g.name}):i({title:"Couldn't delete",description:k.message,variant:"destructive"}),v(null)};return a.jsxs(a.Fragment,{children:[a.jsx(Bt,{open:e,onOpenChange:n,children:a.jsxs(Ft,{className:"sm:max-w-md max-h-[85vh] overflow-y-auto",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Manage channels"}),a.jsx(_n,{children:"Create, edit, reorder, or remove this group's channels."})]}),a.jsxs("div",{className:"space-y-2",children:[l.map((k,S)=>a.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border px-3 py-2",children:[a.jsx("span",{className:"text-base leading-none",children:k.emoji&&k.emoji!=="#"?k.emoji:a.jsx(nI,{className:"h-4 w-4 text-muted-foreground"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:k.name}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(ga,{variant:"secondary",className:"text-[10px] px-1.5 py-0",children:k.sectionType==="realtime"?"Chat":"Discussion"}),k.isPrivate?a.jsx("span",{className:"text-[10px] text-amber-600",children:"Private"}):k.isClosed?a.jsx("span",{className:"text-[10px] text-amber-600",children:"Closed"}):null]})]}),a.jsxs("div",{className:"flex shrink-0 items-center",children:[a.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:S===0,onClick:()=>b(S,-1),children:a.jsx(Zf,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7",disabled:S===l.length-1,onClick:()=>b(S,1),children:a.jsx(w0,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>m(k),children:a.jsx(Qs,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive hover:text-destructive",onClick:()=>v(k),children:a.jsx(qn,{className:"h-3.5 w-3.5"})})]})]},k.id)),l.length===0&&a.jsx("p",{className:"py-4 text-center text-sm text-muted-foreground",children:"No channels yet."})]}),a.jsxs("div",{className:"flex items-center justify-between gap-2 pt-2",children:[a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>p(!0),children:[a.jsx(Dn,{className:"h-4 w-4 mr-1"})," Add channel"]}),d&&a.jsxs(Z,{size:"sm",onClick:x,disabled:o.isBusy,children:[o.isBusy?a.jsx(Ne,{className:"h-4 w-4 mr-1 animate-spin"}):null,"Save order"]})]})]})}),a.jsx(DZ,{group:t,open:f,onOpenChange:p,onGroupUpdated:r,refetchGroups:s}),a.jsx(DZ,{group:t,channel:h,open:!!h,onOpenChange:k=>!k&&m(null),onGroupUpdated:r,refetchGroups:s}),a.jsx(Kr,{open:!!g,onOpenChange:k=>!k&&v(null),children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsxs(Ur,{children:["Delete “",g==null?void 0:g.name,"”?"]}),a.jsx(zr,{children:"This permanently removes the channel and its content. This can't be undone."})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:"Cancel"}),a.jsx(Yr,{onClick:w,disabled:o.isBusy,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete channel"})]})]})})]})}function d$t({selectedIds:t,onChange:e}){const{plans:n,isLoading:r}=PN(),s=n.filter(i=>!i.isDeleted&&i.isActive!==!1);return r?a.jsxs("div",{className:"flex items-center gap-2 rounded-md border border-border p-3 text-sm text-muted-foreground",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"})," Loading subscription paywalls…"]}):s.length===0?a.jsxs("div",{className:"rounded-md border border-amber-500/30 bg-amber-500/5 p-3 text-sm",children:[a.jsx("p",{className:"font-medium text-foreground",children:"No subscription paywalls available"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Create a subscription under Community Members → Subscriptions, then return here."})]}):a.jsx("div",{className:"max-h-52 space-y-2 overflow-y-auto rounded-md border border-border p-2",children:s.map(i=>{const o=t.includes(i.id);return a.jsxs("label",{className:"flex cursor-pointer items-center gap-3 rounded-md p-2 hover:bg-muted/50",children:[a.jsx(ji,{checked:o,onCheckedChange:()=>e(o?t.filter(l=>l!==i.id):[...t,i.id])}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block truncate text-sm font-medium",children:i.name||"Untitled paywall"}),a.jsxs("span",{className:"block text-xs text-muted-foreground",children:[AN(i)," · ",Ax(i)]})]})]},i.id)})})}function fms(t,e){return iIt(t,e)}function pms(t){return t.activationStatus?t.activationStatus!=="inactive":t.isDeleted!==!0&&t.isActive!==!1}function gms(t,e){return t.filter(n=>fms(n,e)&&pms(n))}const vms=56/13;function yms({group:t,open:e,onOpenChange:n,onGroupUpdated:r,refetchGroups:s}){const{toast:i}=yt(),o=Nn(),l=bAe({group:t,onGroupUpdated:r,refetchGroups:s}),{plans:c}=PN(),d=y.useRef(null),[u,h]=y.useState(!1),m=y.useRef(null),[f,p]=y.useState(null),[g,v]=y.useState(!1),[b,x]=y.useState(null),[w,k]=y.useState(!1),[S,C]=y.useState(!1),[j,E]=y.useState(""),[N,A]=y.useState([]),[_,T]=y.useState(""),[R,O]=y.useState(""),[F,D]=y.useState(""),[I,P]=y.useState(""),[M,z]=y.useState("open"),[G,B]=y.useState([]),[H,W]=y.useState(!1),[V,U]=y.useState({}),ne=gms(c,t.id),te=N.length>0?N:ne.map(J=>J.name??"Unnamed subscription");y.useEffect(()=>{var J,K,ce,pe;e&&(T(t.name??""),O(t.description??""),D(t.webUrl??""),P((t.tags??[]).join(", ")),z(t.groupType??"open"),B(c.filter(Ie=>(Ie.accessibleGroups??[]).some(Me=>(typeof Me=="string"?Me:Me.id)===t.id)).map(Ie=>Ie.id)),W(!!t.isOnlyVisibleToMembers),U({slug:((J=t.meta)==null?void 0:J.slug)??"",title:((K=t.meta)==null?void 0:K.title)??"",description:((ce=t.meta)==null?void 0:ce.description)??"",ogImage:((pe=t.meta)==null?void 0:pe.openGraphImage)??""}))},[e,t,c]);const re=async()=>{var pe,Ie,Me,we;if(!_.trim()){i({title:"Name required",description:"Give the group a name.",variant:"destructive"});return}if(M==="closed-paid"&&G.length===0){i({title:"Paywall required",description:"Select at least one subscription paywall.",variant:"destructive"});return}const J={title:((pe=V.title)==null?void 0:pe.trim())??"",description:((Ie=V.description)==null?void 0:Ie.trim())??"",openGraphImage:((Me=V.ogImage)==null?void 0:Me.trim())??""};(we=V.slug)!=null&&we.trim()&&(J.slug=V.slug.trim());const K={name:_.trim(),description:R.trim(),webUrl:F.trim(),tags:I.split(",").map(Be=>Be.trim()).filter(Boolean),groupType:M,isOnlyVisibleToMembers:H,meta:J,subscriptionIds:M==="closed-paid"?G:[]};t.banner&&(K.banner=t.banner);const ce=await l.saveSettings(K);ce.ok?(i({title:"Group updated",description:_.trim()}),n(!1)):i({title:"Couldn't save",description:ce.message,variant:"destructive"})},fe=J=>{if(J){if(!J.type.startsWith("image/")){i({title:"Invalid file",description:"Banner must be an image.",variant:"destructive"}),d.current&&(d.current.value="");return}x(J)}},le=()=>{x(null),d.current&&(d.current.value="")},q=async J=>{x(null),d.current&&(d.current.value=""),h(!0);const K=await l.uploadBanner(J);h(!1),K.ok?i({title:"Banner updated"}):i({title:"Upload failed",description:K.message,variant:"destructive"}),d.current&&(d.current.value="")},Y=()=>{m.current&&(m.current.value="")},X=J=>{if(J){if(!J.type.startsWith("image/")){i({title:"Invalid file",description:"Group picture must be an image.",variant:"destructive"}),Y();return}p(J)}},Q=async J=>{p(null),Y(),v(!0);const K=await l.uploadIcon(J);v(!1),K.ok?i({title:"Group picture updated"}):i({title:"Upload failed",description:K.message,variant:"destructive"})},ie=async()=>{v(!0);const J=await l.removeIcon();v(!1),J.ok?i({title:"Group picture removed"}):i({title:"Couldn't remove picture",description:J.message,variant:"destructive"})},he=async()=>{const J=await l.removeGroup();k(!1),J.ok?(i({title:"Group deleted",description:t.name}),n(!1),o(ve.dashboard)):J.code==="GROUP_HAS_ACTIVE_SUBSCRIPTION"?(E(J.message??"Deactivate the linked subscription before deleting this group."),A((J.blockingSubscriptions??[]).map(K=>K.name).filter(K=>!!K)),C(!0)):i({title:"Couldn't delete",description:J.message,variant:"destructive"})},ye=()=>{if(ne.length>0){E("Deactivate the linked subscription before deleting this group. The group can be deleted after the subscription reaches Deactivated status."),A([]),C(!0);return}k(!0)};return a.jsxs(a.Fragment,{children:[a.jsxs(Bt,{open:e,onOpenChange:n,children:[a.jsxs(Ft,{className:"sm:max-w-lg max-h-[85vh] overflow-y-auto",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Group settings"}),a.jsx(_n,{children:"Edit this group's details and access."})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Banner"}),a.jsxs("button",{type:"button",onClick:()=>{var J;return(J=d.current)==null?void 0:J.click()},disabled:u||l.isBusy,"aria-label":t.banner?"Change banner":"Upload banner",className:ee("relative aspect-[56/13] w-full rounded-md border overflow-hidden group/banner transition-colors",t.banner?"border-border":"border-dashed border-border bg-muted/40 hover:border-primary/50"),children:[t.banner?a.jsx("img",{src:t.banner,alt:"Group banner",className:"absolute inset-0 h-full w-full object-cover"}):null,a.jsx("span",{className:ee("absolute inset-0 flex items-center justify-center gap-2 text-xs font-medium transition-opacity",t.banner?"bg-black/45 text-white opacity-0 group-hover/banner:opacity-100 group-focus-visible/banner:opacity-100":"bg-background/60 text-foreground opacity-90 group-hover/banner:opacity-100",u&&"opacity-100"),children:u?a.jsxs(a.Fragment,{children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"})," Uploading…"]}):a.jsxs(a.Fragment,{children:[a.jsx(jy,{className:"h-4 w-4"}),t.banner?"Change banner":"Upload banner"]})})]}),a.jsx("input",{ref:d,type:"file",accept:"image/*",className:"hidden",onChange:J=>{var K;return fe((K=J.target.files)==null?void 0:K[0])}})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Group picture"}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsxs("button",{type:"button",onClick:()=>{var J;return(J=m.current)==null?void 0:J.click()},disabled:g||l.isBusy,"aria-label":t.icon?"Change group picture":"Upload group picture",className:ee("relative flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-xl text-lg font-bold text-white","focus:outline-none focus-visible:ring-2 focus-visible:ring-ring"),style:t.icon?void 0:{backgroundColor:t.color??"hsl(var(--primary))"},children:[t.icon?a.jsx("img",{src:t.icon,alt:"",className:"absolute inset-0 h-full w-full object-cover"}):t.name.slice(0,2).toUpperCase(),g&&a.jsx("span",{className:"absolute inset-0 flex items-center justify-center bg-black/45",children:a.jsx(Ne,{className:"h-4 w-4 animate-spin text-white"})})]}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",onClick:()=>{var J;return(J=m.current)==null?void 0:J.click()},disabled:g||l.isBusy,children:[a.jsx(jy,{className:"mr-1.5 h-3.5 w-3.5"}),t.icon?"Change picture":"Upload picture"]}),t.icon&&a.jsx(Z,{type:"button",variant:"ghost",size:"sm",onClick:()=>void ie(),disabled:g||l.isBusy,children:"Remove"})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Square image shown on the group page and in lists. Without one, the group's initials are used."}),a.jsx("input",{ref:m,type:"file",accept:"image/*",className:"hidden",onChange:J=>{var K;return X((K=J.target.files)==null?void 0:K[0])}})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"g-name",children:"Name"}),a.jsx(Oe,{id:"g-name",value:_,onChange:J=>T(J.target.value)})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"g-desc",children:"Description"}),a.jsx(us,{id:"g-desc",value:R,rows:3,onChange:J=>O(J.target.value)})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"g-url",children:"Website"}),a.jsx(Oe,{id:"g-url",value:F,placeholder:"https://…",onChange:J=>D(J.target.value)})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"g-tags",children:"Tags"}),a.jsx(Oe,{id:"g-tags",value:I,placeholder:"Comma-separated",onChange:J=>P(J.target.value)})]}),a.jsx(vEt,{value:V,onChange:U,idPrefix:"g-seo"}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Access"}),a.jsxs(zn,{value:M,onValueChange:J=>z(J),children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"open",children:"Open — anyone can join"}),a.jsx(pt,{value:"closed-free",children:"Closed — request to join"}),a.jsx(pt,{value:"closed-paid",children:"Paid — pay to join"})]})]})]}),M==="closed-paid"&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Subscription paywall"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose the plans that grant members access to this group."}),a.jsx(d$t,{selectedIds:G,onChange:B})]}),M!=="open"&&a.jsxs("div",{className:"flex items-center justify-between rounded-md border border-border px-3 py-2.5",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Hide from non-members"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Only members can see this group at all."})]}),a.jsx(Hs,{checked:H,onCheckedChange:W})]}),a.jsxs("div",{className:"rounded-md border border-destructive/30 bg-destructive/5 px-3 py-2.5 flex items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Delete group"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Permanently removes the group, its channels, posts and messages."})]}),a.jsxs(Z,{variant:"destructive",size:"sm",disabled:l.isBusy,onClick:ye,children:[a.jsx(qn,{className:"h-3.5 w-3.5 mr-1"})," Delete"]})]})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"outline",onClick:()=>n(!1),disabled:l.isBusy,children:"Cancel"}),a.jsxs(Z,{onClick:re,disabled:l.isBusy,children:[l.isBusy?a.jsx(Ne,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Save changes"]})]})]}),a.jsx(Kr,{open:w,onOpenChange:k,children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsxs(Ur,{children:["Delete “",t.name,"”?"]}),a.jsx(zr,{children:"This permanently deletes the group with all of its channels, posts and messages. This cannot be undone."})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:l.isBusy,children:"Cancel"}),a.jsxs(Yr,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>void he(),children:[l.isBusy?a.jsx(Ne,{className:"h-4 w-4 mr-2 animate-spin"}):null,"Delete group"]})]})]})}),a.jsx(Kr,{open:S,onOpenChange:C,children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Deactivate subscription before deleting"}),a.jsx(zr,{asChild:!0,children:a.jsxs("div",{className:"space-y-3 text-sm text-muted-foreground",children:[a.jsx("p",{children:j}),te.length>0?a.jsxs("div",{className:"rounded-md border border-border bg-muted/40 p-3",children:[a.jsxs("p",{className:"mb-1 font-medium text-foreground",children:["Blocking subscription",te.length===1?"":"s"]}),a.jsx("ul",{className:"list-disc space-y-1 pl-5",children:te.map((J,K)=>a.jsx("li",{children:J},`${J}-${K}`))})]}):null]})})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:"Close"}),a.jsx(Yr,{onClick:()=>{C(!1),n(!1),o(`${ve.communityMembers}?tab=subscriptions`)},children:"View subscriptions"})]})]})})]}),a.jsx(Nh,{file:b,aspect:vms,title:"Adjust group banner",onCancel:le,onCropped:J=>void q(J)}),a.jsx(Nh,{file:f,aspect:1,title:"Adjust group picture",onCancel:()=>{p(null),Y()},onCropped:J=>void Q(J)})]})}function bms({tabs:t,activeTab:e,onTabChange:n}){return a.jsx("div",{className:"flex overflow-x-auto border-t border-border px-4 [scrollbar-width:none] [-ms-overflow-style:none] sm:px-6 [&::-webkit-scrollbar]:hidden",children:t.map(r=>a.jsxs("button",{type:"button",onClick:()=>n(r.key),className:ee("flex items-center gap-1.5 px-4 py-3 text-sm font-medium border-b-2 transition-colors whitespace-nowrap shrink-0",e===r.key?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:[a.jsx(r.icon,{className:"h-3.5 w-3.5"}),r.label,r.count!==void 0&&a.jsx(ga,{variant:"secondary",className:"text-[10px] px-1.5 py-0 ml-1",children:r.count})]},r.key))})}function xms(t){const{community:e}=qe(),n=(e==null?void 0:e.id)??null,{notificationPreferences:r,refetchNotificationPreferences:s}=Ln(),i=rn(),{toast:o}=yt(),[l,c]=y.useState(!1),d=y.useMemo(()=>(t.tabs??[]).filter(f=>f.isJoined||!f.isClosed).map(f=>f.id),[t.tabs]),u=y.useMemo(()=>{if(!d.length)return!1;const f=(r==null?void 0:r.tabs)??[];return d.every(p=>{const g=f.find(v=>v.tabId===p&&v.groupId===t.id);return(g==null?void 0:g.notificationLevel)==="none"})},[d,r==null?void 0:r.tabs,t.id]),h=d.length>0&&!!n;return{isMuted:u,canMute:h,busy:l,toggle:async()=>{if(!n||!d.length||l)return;c(!0);const f=u?"all":"none",p=((r==null?void 0:r.tabs)??[]).filter(v=>v.groupId!==t.id),g=d.map(v=>({groupId:t.id,tabId:v,notificationLevel:f}));try{const v=await tse(n,{tabs:[...p,...g]});i.setQueryData(["notification-preferences",n],v),s(),o({title:f==="none"?"Notifications muted":"Notifications unmuted",description:f==="none"?`You won't be notified about activity in ${t.name}.`:`You'll be notified about activity in ${t.name} again.`})}catch(v){o({title:"Couldn't update notifications",description:v instanceof ze?Dt(v.body,v.message):"Something went wrong. Please try again.",variant:"destructive"})}finally{c(!1)}}}}const wms={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.05}}},HT={hidden:{opacity:0,y:8},show:{opacity:1,y:0}};function kms({group:t,activeSection:e,activeTab:n,onTabChange:r,onSectionSelect:s,onCreatePost:i,onShare:o,onGroupUpdated:l,refetchGroups:c,currentUserName:d,currentUserAvatar:u,canFeature:h,getCanPin:m,featuredIds:f,onToggleFeatured:p,postActions:g,onSectionFeedReady:v}){const{toast:b}=yt(),[x,w]=y.useState(!1),[k,S]=y.useState(!1),[C,j]=y.useState(!1),[E,N]=y.useState(!1),A=xms(t),_=Mu(t),T=sse(t),R=Number(t.userCount??0),O=qB(t),F=IZ(t),D=C2t(t),I=CN(t.groupType),P=t.groupType==="closed-free"||t.groupType==="closed-paid",M=_&&ise(t),z=[{key:"discussions",label:"Discussions",icon:Vi,count:F.length||void 0},{key:"chat",label:"Group chat",icon:Vi,count:D.length||void 0},{key:"events",label:"Events",icon:ym},{key:"members",label:"Members",icon:wr,count:R||void 0},{key:"leaderboard",label:"Leaderboard",icon:Hg},{key:"about",label:"About",icon:nS}],G=_&&e&&!Mf(e)&&QAe(t,e)&&(n==="discussions"||n==="about"),B=H=>{if(H.ok){H.action==="leave"?b({title:`Left ${t.name}`,description:"You have left this group."}):H.action==="accept"?b({title:`Joined ${t.name}`,description:"Invitation accepted."}):H.action==="request"?b({title:"Request sent",description:`Your request to join ${t.name} is pending approval.`}):b({title:`Joined ${t.name}`,description:"You are now a member of this group."});return}b({title:"Action failed",description:H.message,variant:"destructive"})};return a.jsxs(it.div,{variants:wms,initial:"hidden",animate:"show",className:"max-w-4xl mx-auto space-y-5",children:[a.jsxs(it.div,{variants:HT,className:"rounded-xl border border-border bg-card shadow-card overflow-hidden",children:[a.jsx("div",{className:"h-44 overflow-hidden bg-muted sm:h-52",children:t.banner?a.jsx("img",{src:t.banner,alt:"",className:"h-full w-full object-cover"}):a.jsx("div",{className:"h-full w-full",style:{background:t.color?`linear-gradient(135deg, ${t.color}33 0%, ${t.color}11 100%)`:"linear-gradient(135deg, hsl(var(--primary) / 0.25) 0%, hsl(var(--primary) / 0.05) 100%)"}})}),a.jsxs("div",{className:"flex flex-wrap items-end gap-3 px-4 pb-4",children:[a.jsxs("div",{className:"flex min-w-0 flex-1 basis-[17rem] items-end gap-3",children:[a.jsx("div",{className:"-mt-8 flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-xl border-4 border-card text-lg font-bold text-white shadow-md",style:{backgroundColor:t.icon?"hsl(var(--card))":t.color??"hsl(var(--primary))"},children:t.icon?a.jsx("img",{src:t.icon,alt:"",className:"h-full w-full object-cover"}):t.name.slice(0,2).toUpperCase()}),a.jsxs("div",{className:"min-w-0 pb-1 pt-3",children:[a.jsxs("div",{className:"mb-1 flex flex-wrap items-center gap-2",children:[a.jsx("h1",{className:"truncate text-xl font-bold text-foreground",children:t.name}),a.jsxs(ga,{variant:"outline",className:ee("text-[10px]",P?"border-amber-500/30 text-amber-600":"border-emerald-500/30 text-emerald-600"),children:[P?a.jsx(wa,{className:"mr-1 h-2.5 w-2.5"}):a.jsx(Qd,{className:"mr-1 h-2.5 w-2.5"}),I]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground",children:[R>0&&a.jsxs("span",{className:"inline-flex items-center gap-1 whitespace-nowrap",children:[a.jsx(wr,{className:"h-3 w-3 shrink-0"})," ",R.toLocaleString()," ",R===1?"member":"members"]}),a.jsxs("span",{className:"whitespace-nowrap",children:[O.length," ",O.length===1?"channel":"channels"]}),t.myRole&&a.jsxs("span",{className:"inline-flex items-center gap-2 whitespace-nowrap",children:[a.jsx("span",{"aria-hidden":"true",children:"•"}),a.jsx("span",{className:"capitalize",children:t.myRole})]})]})]})]}),a.jsxs("div",{className:"flex max-w-full flex-wrap items-center gap-1.5 sm:ml-auto",children:[G&&a.jsxs(Z,{size:"sm",onClick:i,className:"hidden gap-1 rounded-full px-2 text-xs sm:inline-flex",children:[a.jsx(Dn,{className:"h-3.5 w-3.5"})," Create post"]}),M&&a.jsxs(Z,{size:"sm",variant:"outline",className:"hidden gap-1 rounded-full px-2 text-xs md:inline-flex",onClick:()=>S(!0),children:[a.jsx(Sa,{className:"h-3.5 w-3.5"})," Add member"]}),a.jsx(AIe,{group:t,className:"px-2 text-xs",onGroupUpdated:l,refetchGroups:c,onActionResult:B}),a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[a.jsxs(ot,{onClick:o,children:[a.jsx(kk,{className:"h-4 w-4 mr-2"})," Share group"]}),M&&a.jsxs(ot,{onClick:()=>w(!0),children:[a.jsx(Sa,{className:"h-4 w-4 mr-2"})," Invite people"]}),M&&a.jsxs(ot,{className:"md:hidden",onClick:()=>S(!0),children:[a.jsx(Sa,{className:"h-4 w-4 mr-2"})," Add member"]}),_&&A.canMute&&a.jsxs(ot,{onClick:()=>void A.toggle(),disabled:A.busy,children:[A.isMuted?a.jsx(Lm,{className:"h-4 w-4 mr-2"}):a.jsx(pK,{className:"h-4 w-4 mr-2"}),A.isMuted?"Unmute notifications":"Mute notifications"]}),T&&a.jsxs(a.Fragment,{children:[a.jsx(mi,{}),a.jsxs(ot,{onClick:()=>j(!0),children:[a.jsx(ast,{className:"h-4 w-4 mr-2"})," Manage channels"]}),a.jsxs(ot,{onClick:()=>N(!0),children:[a.jsx(w2,{className:"h-4 w-4 mr-2"})," Group settings"]})]})]})]})]})]}),a.jsx(bms,{tabs:z,activeTab:n,onTabChange:r})]}),n==="discussions"&&a.jsx(Bhs,{group:t,activeSection:e,onSectionSelect:s,onCreatePost:i,currentUserName:d,currentUserAvatar:u,canFeature:h,getCanPin:m,featuredIds:f,onToggleFeatured:p,postActions:g,onFeedReady:v,onGroupUpdated:l,refetchGroups:c},`${t.id}:${_}`),n==="chat"&&a.jsx(it.div,{variants:HT,className:"min-h-0",children:a.jsx(Zhs,{group:t,activeSection:e,onSectionSelect:s,onGroupUpdated:l,refetchGroups:c})}),n==="events"&&a.jsx(it.div,{variants:HT,children:a.jsx(ems,{group:t})}),n==="members"&&a.jsx(it.div,{variants:HT,children:a.jsx(ums,{group:t})}),n==="leaderboard"&&a.jsx(it.div,{variants:HT,children:a.jsx(hms,{group:t})}),n==="about"&&a.jsx(it.div,{variants:HT,children:a.jsx(Xhs,{group:t})}),a.jsx(tms,{group:t,open:x,onOpenChange:w,onCopied:()=>b({title:"Invite link copied"})}),a.jsx(ims,{open:k,onOpenChange:S,groupId:t.id,groupName:t.name,onMemberAdded:()=>c==null?void 0:c()}),T&&a.jsxs(a.Fragment,{children:[a.jsx(mms,{group:t,open:C,onOpenChange:j,onGroupUpdated:l,refetchGroups:c}),a.jsx(yms,{group:t,open:E,onOpenChange:N,onGroupUpdated:l,refetchGroups:c})]})]})}function Sms({group:t,onGroupUpdated:e,refetchGroups:n,onActionResult:r}){var u,h,m,f,p;const s=Number(t.userCount??0),i=((u=t.description)==null?void 0:u.trim())||((m=(h=t.meta)==null?void 0:h.description)==null?void 0:m.trim())||"No description yet.",o=((f=t.tags)==null?void 0:f.filter(Boolean))??[],l=hhr(t),c=fhr(t.price,t.currency),d=WB(t);return a.jsx(it.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:"mx-auto max-w-2xl space-y-5",children:a.jsxs("div",{className:"overflow-hidden rounded-xl border border-border bg-card shadow-card",children:[a.jsxs("div",{className:"relative h-40",children:[t.banner?a.jsx("img",{src:t.banner,alt:t.name,className:"h-full w-full object-cover"}):a.jsx("div",{className:"h-full w-full",style:{background:t.color?`linear-gradient(135deg, ${t.color} 0%, ${t.color}99 100%)`:"linear-gradient(135deg, hsl(var(--primary)) 0%, hsl(var(--primary)/0.6) 100%)"}}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/50 to-transparent"})]}),a.jsxs("div",{className:"space-y-4 p-5",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-lg font-bold text-foreground",children:t.name}),a.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:[a.jsxs(ga,{variant:"outline",className:"gap-1 text-[10px]",children:[l?a.jsx(Sh,{className:"h-3 w-3"}):a.jsx(wa,{className:"h-3 w-3"}),CN(t.groupType)]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(wr,{className:"h-3.5 w-3.5"}),s.toLocaleString()," members"]}),l&&c&&a.jsx("span",{className:"font-semibold text-foreground",children:c})]})]}),a.jsx(AIe,{group:t,size:"default",onGroupUpdated:e,refetchGroups:n,onActionResult:r})]}),a.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-dashed border-border bg-muted/40 p-3 text-sm text-muted-foreground",children:[a.jsx(wa,{className:"mt-0.5 h-4 w-4 shrink-0"}),a.jsx("p",{children:d?"Your request to join is awaiting approval. You'll get access to channels once an admin approves it.":l?"This is a paid group. Purchase access to unlock its discussions and chat channels.":"This is a closed group. Join or request access to see its discussions and chat channels."})]}),a.jsxs("div",{children:[a.jsx("h3",{className:"mb-1.5 text-sm font-bold text-foreground",children:"About"}),a.jsx("p",{className:"whitespace-pre-wrap text-sm leading-relaxed text-muted-foreground",children:i})]}),((p=t.webUrl)==null?void 0:p.trim())&&a.jsxs("a",{href:t.webUrl,target:"_blank",rel:"noopener noreferrer",className:"inline-flex items-center gap-1.5 text-sm font-medium text-primary hover:underline",children:[a.jsx(Qd,{className:"h-3.5 w-3.5"}),t.webUrl]}),o.length>0&&a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(ka,{className:"h-3.5 w-3.5 text-muted-foreground"}),o.map(g=>a.jsx(ga,{variant:"secondary",className:"text-xs",children:g},g))]})]})]})})}function PIe({widget:t}){if(!(t.title.trim().length>0))return null;const n=()=>{t.url&&window.open(t.url,"_blank","noopener,noreferrer")};return a.jsxs(it.div,{variants:Ph,className:"rounded-lg border border-border bg-card shadow-card overflow-hidden",children:[t.cover&&a.jsx("img",{src:t.cover,alt:"",className:"w-full aspect-square object-cover"}),a.jsxs("div",{className:"p-4 space-y-2",children:[a.jsx("h3",{className:"text-sm font-bold text-foreground",children:t.title}),t.description&&a.jsx("p",{className:"text-xs text-muted-foreground line-clamp-3",children:t.description}),t.buttonTitle&&a.jsxs("button",{type:"button",onClick:n,className:"inline-flex items-center gap-1.5 text-xs font-semibold text-primary hover:underline mt-1",children:[t.buttonTitle,a.jsx(bo,{className:"h-3 w-3"})]})]})]})}function u$t({widgets:t}){const{addCustomWidgetOpen:e,customWidget:n,setCustomWidget:r,widgetCoverInputRef:s,addCustomWidgetFromForm:i,editingWidgetId:o,closeCustomWidgetDialog:l,isSavingCustomWidget:c}=t,d=!!o;return a.jsx(Bt,{open:e,onOpenChange:u=>!u&&l(),children:a.jsxs(Ft,{className:"max-w-lg max-h-[90vh] overflow-y-auto",children:[a.jsx(Vt,{children:a.jsx(Ut,{children:d?"Edit widget":"Add widget to home feed"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsx("input",{ref:s,type:"file",accept:"image/*",className:"hidden",onChange:u=>{var f;const h=(f=u.target.files)==null?void 0:f[0];if(!h)return;const m=new FileReader;m.onload=p=>r(g=>{var v;return{...g,cover:(v=p.target)==null?void 0:v.result,coverFile:h}}),m.readAsDataURL(h)}}),d&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave the cover as-is to keep the current picture; choosing a new one replaces it."}),n.cover?a.jsxs("div",{className:"relative rounded-lg overflow-hidden border border-border aspect-square",children:[a.jsx("img",{src:n.cover,alt:"Cover",className:"w-full h-full object-cover"}),a.jsx("button",{type:"button",onClick:()=>r(u=>({...u,cover:null,coverFile:null})),className:"absolute top-2 right-2 h-8 w-8 rounded-full bg-background/90 border border-border flex items-center justify-center hover:bg-background",children:a.jsx(nn,{className:"h-4 w-4"})})]}):a.jsxs("button",{type:"button",onClick:()=>{var u;return(u=s.current)==null?void 0:u.click()},className:"w-full rounded-lg border-2 border-dashed border-border bg-muted/30 hover:border-primary/40 hover:bg-muted/50 transition-colors aspect-square flex flex-col items-center justify-center gap-2",children:[a.jsx("div",{className:"h-12 w-12 rounded-full bg-primary/10 text-primary flex items-center justify-center",children:a.jsx(Jl,{className:"h-5 w-5"})}),a.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Upload cover picture"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"1:1 aspect ratio (recommended)"}),a.jsxs("span",{className:"mt-1 inline-flex items-center gap-1.5 text-xs font-medium text-primary",children:[a.jsx(kd,{className:"h-3.5 w-3.5"})," Choose image"]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-sm font-semibold text-foreground",children:"Card title"}),a.jsx("input",{type:"text",value:n.title,onChange:u=>r(h=>({...h,title:u.target.value})),placeholder:"Enter widget name",className:"w-full h-10 rounded-md border border-input bg-background px-3 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/30"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("label",{className:"text-sm font-semibold text-foreground",children:["Small description"," ",a.jsx("span",{className:"font-normal text-muted-foreground",children:"(try to keep it under 50 words)"})]}),a.jsx("textarea",{value:n.description,onChange:u=>r(h=>({...h,description:u.target.value})),placeholder:"Enter description",rows:3,className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/30 resize-none"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-sm font-semibold text-foreground",children:"Button title"}),a.jsx("input",{type:"text",value:n.buttonTitle,onChange:u=>r(h=>({...h,buttonTitle:u.target.value})),placeholder:"Enter button title",className:"w-full h-10 rounded-md border border-input bg-background px-3 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/30"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Suggestions: Know more, Join, Apply…"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("label",{className:"text-sm font-semibold text-foreground",children:"URL"}),a.jsx("input",{type:"url",value:n.url,onChange:u=>r(h=>({...h,url:u.target.value})),placeholder:"https://",className:"w-full h-10 rounded-md border border-input bg-background px-3 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring/30"})]})]}),a.jsxs(ir,{className:"flex-row justify-between sm:justify-between gap-3",children:[a.jsx(Z,{variant:"ghost",onClick:l,disabled:c,children:"Cancel"}),a.jsx(Z,{onClick:i,disabled:c,children:c?"Saving…":d?"Save changes":"Create custom widget"})]})]})})}const jhe={quickActions:{user:!0,admin:!0},stats:{user:!0,admin:!0},onlineMembers:{user:!0,admin:!0},leaderboard:{user:!0,admin:!0},trendingNews:{user:!0,admin:!0},upcomingEvents:{user:!0,admin:!0}},RIe=[{id:"quickActions",label:"Quick Actions"},{id:"stats",label:"Your Stats"},{id:"onlineMembers",label:"Online Members"},{id:"leaderboard",label:"Community Leaderboard"},{id:"trendingNews",label:"Trending News"},{id:"upcomingEvents",label:"Upcoming Events"}],pae={onlineMembers:"community-members",leaderboard:"community-leaderboard",trendingNews:"top-posts",upcomingEvents:"upcoming-events"},h$t=Object.fromEntries(Object.entries(pae).map(([t,e])=>[e,t]));function Cms(t){return!!pae[t]}function jms(t,e,n){const r=t[e];return r?n?r.admin:r.user:!0}const Ems=Object.fromEntries(RIe.map(t=>[t.id,t.label])),Nms=RIe.filter(t=>!pae[t.id]);function m$t({widgets:t,onAddCustom:e,scope:n="community"}){const r=n==="group",{toast:s}=yt(),{customizeWidgetsOpen:i,setCustomizeWidgetsOpen:o,flagsFor:l,setWidgetFlag:c,saveWidgetPreferences:d,orderedServerWidgets:u,flagsForServerId:h,setServerFlag:m,moveWidget:f,openEditCustomWidget:p,removeCustomWidget:g}=t,[v,b]=y.useState(!1),[x,w]=y.useState(null),k=u.filter(C=>r?C.type==="custom":!0).map(C=>{var j,E;return{widget:C,label:C.type==="custom"?((E=(j=C.details)==null?void 0:j.title)==null?void 0:E.trim())||"Untitled widget":Ems[h$t[C.type]]}}).filter(C=>!!C.label),S=k.map(C=>C.widget.id);return a.jsx(B0,{open:i,onOpenChange:o,children:a.jsxs(Xy,{side:"right",className:"w-full sm:max-w-md flex flex-col p-0",children:[a.jsx(eb,{className:"px-6 py-4 border-b border-border",children:a.jsx(tb,{children:"Customise widgets"})}),a.jsxs("div",{className:"flex-1 overflow-y-auto px-6 py-5 space-y-5",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Note: A widget is hidden when it has no data to show."}),a.jsxs("div",{className:"space-y-3",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:r?"Group widgets — order applies to everyone":"Community widgets — order applies to everyone"}),k.map((C,j)=>{var _;const E=C.widget,N=h(E.id),A=E.type==="custom";return a.jsxs("div",{className:"rounded-lg border border-border bg-card overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2 px-3 py-3 border-b border-border",children:[a.jsxs("div",{className:"flex flex-col",children:[a.jsx(Z,{variant:"ghost",size:"icon",className:"h-5 w-6",title:"Move up",disabled:j===0,onClick:()=>f(E.id,-1,S),children:a.jsx(M8,{className:"h-4 w-4"})}),a.jsx(Z,{variant:"ghost",size:"icon",className:"h-5 w-6",title:"Move down",disabled:j===k.length-1,onClick:()=>f(E.id,1,S),children:a.jsx(li,{className:"h-4 w-4"})})]}),A&&((_=E.details)==null?void 0:_.picture)&&a.jsx("img",{src:E.details.picture,alt:"",className:"h-10 w-10 rounded object-cover shrink-0"}),a.jsx("p",{className:"flex-1 text-sm font-semibold text-foreground line-clamp-2",children:C.label}),A&&a.jsxs("div",{className:"flex shrink-0 gap-1",children:[a.jsx(Z,{variant:"ghost",size:"icon",title:"Edit widget",onClick:()=>p(E.id),children:a.jsx(Qs,{className:"h-4 w-4"})}),a.jsx(Z,{variant:"ghost",size:"icon",title:"Delete widget",onClick:()=>w(E.id),children:a.jsx(qn,{className:"h-4 w-4"})})]})]}),x===E.id?a.jsxs("div",{className:"flex items-center justify-between gap-2 bg-destructive/10 px-4 py-3",children:[a.jsx("span",{className:"text-xs text-foreground",children:"Delete this widget for everyone?"}),a.jsxs("span",{className:"flex gap-2",children:[a.jsx(Z,{variant:"outline",size:"sm",onClick:()=>w(null),children:"Cancel"}),a.jsx(Z,{variant:"destructive",size:"sm",onClick:()=>{g(E.id),w(null)},children:"Delete"})]})]}):a.jsxs("div",{className:"grid grid-cols-2 divide-x divide-border bg-muted/30",children:[a.jsxs("label",{className:"flex items-center justify-between gap-2 px-4 py-3 cursor-pointer",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:"Visible to user"}),a.jsx(ji,{checked:N.user,onCheckedChange:T=>m(E.id,"user",!!T)})]}),a.jsxs("label",{className:"flex items-center justify-between gap-2 px-4 py-3 cursor-pointer",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:"Visible to admin"}),a.jsx(ji,{checked:N.admin,onCheckedChange:T=>m(E.id,"admin",!!T)})]})]})]},E.id)}),a.jsx("button",{type:"button",onClick:e,className:"w-full rounded-md border border-primary/40 bg-transparent px-4 py-2.5 text-sm font-semibold text-primary hover:bg-primary/5 transition-colors",children:"+ Add custom"})]}),a.jsxs("div",{className:r?"hidden":"space-y-3",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"On this device only"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"These cards aren't stored on the community yet, so they always sit at the top and their setting applies only to your browser."}),Nms.map(C=>{const j=l(C.id);return a.jsxs("div",{className:"rounded-lg border border-border bg-card overflow-hidden",children:[a.jsx("div",{className:"px-4 py-3 border-b border-border",children:a.jsx("p",{className:"text-sm font-semibold text-foreground",children:C.label})}),a.jsxs("div",{className:"grid grid-cols-2 divide-x divide-border bg-muted/30",children:[a.jsxs("label",{className:"flex items-center justify-between gap-2 px-4 py-3 cursor-pointer",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:"Visible to user"}),a.jsx(ji,{checked:j.user,onCheckedChange:E=>c(C.id,"user",!!E)})]}),a.jsxs("label",{className:"flex items-center justify-between gap-2 px-4 py-3 cursor-pointer",children:[a.jsx("span",{className:"text-xs text-muted-foreground",children:"Visible to admin"}),a.jsx(ji,{checked:j.admin,onCheckedChange:E=>c(C.id,"admin",!!E)})]})]})]},C.id)})]})]}),a.jsxs(_Re,{className:"px-6 py-4 border-t border-border flex-row sm:justify-between gap-3",children:[a.jsx(Z,{variant:"outline",className:"flex-1",onClick:()=>o(!1),children:"Cancel"}),a.jsx(Z,{className:"flex-1",disabled:v,onClick:async()=>{b(!0);let C=!1;try{C=await d()}finally{b(!1)}C&&(s({title:"Widgets saved",description:"Updated for everyone in this community."}),o(!1))},children:v?"Saving…":"Save widgets"})]})]})})}function f$t({onClick:t}){return a.jsxs(it.button,{type:"button",variants:Ph,onClick:t,className:"w-full rounded-lg border-2 border-dashed border-border bg-transparent px-4 py-3.5 text-sm font-medium text-foreground hover:border-primary/50 hover:bg-muted/40 transition-colors flex items-center justify-center gap-2",children:[a.jsx(wSe,{className:"h-4 w-4 text-muted-foreground"}),"Select widgets"]})}function Tms(){try{const t=localStorage.getItem(tdt);return t?{...jhe,...JSON.parse(t)}:jhe}catch{return jhe}}function _ms(t){localStorage.setItem(tdt,JSON.stringify(t))}async function Ams(t,e){const n=e?`?groupId=${encodeURIComponent(e)}`:"";return ae.get(`/community/${encodeURIComponent(t)}/widgets${n}`)}async function Pms(t,e){return ae.post(`/community/${encodeURIComponent(t)}/widgets`,e)}async function Rms(t,e,n){return ae.post(`/community/${encodeURIComponent(t)}/widgets/${encodeURIComponent(e)}`,n)}async function OJe(t,e,n){const r=new FormData;return r.append("picture",n,n.name),Ea(`/community/${encodeURIComponent(t)}/widgets/${encodeURIComponent(e)}/upload-picture`,r)}async function Ims(t,e,n){return ae.post(`/community/${encodeURIComponent(t)}/widgets/sort`,{sortOrder:e,groupId:n??""})}async function Mms(t,e){return ae.delete(`/community/${encodeURIComponent(t)}/widgets/${encodeURIComponent(e)}`)}const Ehe={cover:null,coverFile:null,title:"",description:"",buttonTitle:"",url:""};function FJe(t){var e,n,r,s,i;return{id:t.id,cover:((e=t.details)==null?void 0:e.picture)??null,title:((n=t.details)==null?void 0:n.title)??"",description:((r=t.details)==null?void 0:r.description)??"",buttonTitle:((s=t.details)==null?void 0:s.buttonLabel)??"",url:((i=t.details)==null?void 0:i.buttonURL)??""}}function p$t(t={}){const{groupId:e,isAdmin:n}=t,{community:r}=qe(),{communityDetail:s}=Ln(),{toast:i}=yt(),o=rn(),l=(r==null?void 0:r.id)??(s==null?void 0:s.id)??null,c=n??(((r==null?void 0:r.myRole)??(s==null?void 0:s.myRole))==="admin"||!!((r==null?void 0:r.isByMe)??(s==null?void 0:s.isByMe))),[d,u]=y.useState(!1),[h,m]=y.useState(!1),[f,p]=y.useState(null),[g,v]=y.useState(Tms),[b,x]=y.useState({}),[w,k]=y.useState([]),[S,C]=y.useState(Ehe),j=y.useRef(null),E=lt({queryKey:["community-widgets",l,e??null],queryFn:()=>Ams(l,e),enabled:!!l,staleTime:6e4}),N=y.useMemo(()=>{var q;return((q=E.data)==null?void 0:q.widgets)??[]},[E.data]);y.useEffect(()=>{x(Object.fromEntries(N.map(q=>[q.id,{isVisible:q.isVisible,isVisibleToAdmin:q.isVisibleToAdmin}]))),k([...N].sort((q,Y)=>(q.sortOrder??0)-(Y.sortOrder??0)).map(q=>q.id))},[N]);const A=y.useMemo(()=>{const q=new Map(N.map(Q=>[Q.id,Q])),Y=w.map(Q=>q.get(Q)).filter(Boolean),X=N.filter(Q=>!w.includes(Q.id));return[...Y,...X]},[N,w]),_=y.useCallback((q,Y,X)=>{const Q=X.indexOf(q),ie=X[Q+Y];Q<0||!ie||k(he=>{const ye=he.indexOf(q),J=he.indexOf(ie);if(ye<0||J<0)return he;const K=[...he];return[K[ye],K[J]]=[K[J],K[ye]],K})},[]),T=y.useCallback(q=>{const Y=pae[q];return Y?N.find(X=>X.type===Y)??null:null},[N]),R=y.useCallback(q=>{const Y=N.find(Q=>Q.id===q),X=b[q];return{user:(X==null?void 0:X.isVisible)??(Y==null?void 0:Y.isVisible)??!0,admin:(X==null?void 0:X.isVisibleToAdmin)??(Y==null?void 0:Y.isVisibleToAdmin)??!0}},[N,b]),O=y.useCallback((q,Y,X)=>x(Q=>{const ie=N.find(ye=>ye.id===q),he=Q[q]??{isVisible:(ie==null?void 0:ie.isVisible)??!0,isVisibleToAdmin:(ie==null?void 0:ie.isVisibleToAdmin)??!0};return{...Q,[q]:{...he,...Y==="user"?{isVisible:X}:{isVisibleToAdmin:X}}}}),[N]),F=y.useMemo(()=>N.filter(q=>q.type==="custom").sort((q,Y)=>(q.sortOrder??0)-(Y.sortOrder??0)),[N]),D=y.useMemo(()=>{var Y;return(((Y=E.data)==null?void 0:Y.widgets)??[]).filter(X=>X.type==="custom").filter(X=>c?X.isVisibleToAdmin:X.isVisible).sort((X,Q)=>(X.sortOrder??0)-(Q.sortOrder??0)).map(FJe)},[E.data,c]),I=y.useMemo(()=>[...N].sort((q,Y)=>(q.sortOrder??0)-(Y.sortOrder??0)).flatMap(q=>{if(q.type==="custom")return[{kind:"custom",serverId:q.id,widget:FJe(q)}];const Y=h$t[q.type];return Y?[{kind:"builtin",serverId:q.id,id:Y}]:[]}),[N]),P=y.useCallback(()=>o.invalidateQueries({queryKey:["community-widgets",l,e??null]}),[o,l,e]),M=()=>C(Ehe),z=y.useCallback(q=>{const Y=T(q);if(Y){const Q=b[Y.id];return{user:(Q==null?void 0:Q.isVisible)??Y.isVisible,admin:(Q==null?void 0:Q.isVisibleToAdmin)??Y.isVisibleToAdmin,backedByServer:!0}}const X=g[q];return{user:(X==null?void 0:X.user)??!0,admin:(X==null?void 0:X.admin)??!0,backedByServer:!1}},[T,b,g]),G=y.useCallback((q,Y)=>{if(!T(q))return jms(g,q,Y);const Q=z(q);return Y?Q.admin:Q.user},[T,g,z]),B=y.useCallback((q,Y,X)=>{const Q=T(q);if(Q){O(Q.id,Y,X);return}v(ie=>({...ie,[q]:{...ie[q],[Y]:X}}))},[T,O]),H=y.useCallback(q=>RIe.some(Y=>G(Y.id,q))||D.length>0,[G,D.length]),W=y.useCallback(async()=>{if(_ms(g),!l||N.length===0)return!0;try{return await Ims(l,A.map((q,Y)=>{const X=b[q.id];return{widgetId:q.id,sortOrder:Y,isVisible:(X==null?void 0:X.isVisible)??q.isVisible,isVisibleToAdmin:(X==null?void 0:X.isVisibleToAdmin)??q.isVisibleToAdmin}}),e),await P(),!0}catch(q){return i({title:"Couldn't save widgets",description:dn(q,"Please try again."),variant:"destructive"}),!1}},[g,l,e,N,A,b,P,i]),V=jt({mutationFn:async({form:q,editingId:Y})=>{var ie,he;if(!l)throw new Error("No community");const X={title:q.title,description:q.description,buttonLabel:q.buttonTitle,buttonURL:q.url};if(Y){const ye=N.find(K=>K.id===Y),J=R(Y);return await Rms(l,Y,{details:X,isVisible:J.user,isVisibleToAdmin:J.admin,sortOrder:(ye==null?void 0:ye.sortOrder)??0,...e?{groupId:e}:{}}),q.coverFile&&await OJe(l,Y,q.coverFile),Y}const Q=await Pms(l,{details:X,...e?{groupId:e}:{}});return q.coverFile&&((ie=Q.widget)!=null&&ie.id)&&await OJe(l,Q.widget.id,q.coverFile),((he=Q.widget)==null?void 0:he.id)??null},onSuccess:async(q,Y)=>{await P(),M(),p(null),m(!1),i({title:Y.editingId?"Widget updated":"Widget added"})},onError:q=>i({title:"Couldn't save widget",description:dn(q,"Please try again."),variant:"destructive"})}),U=jt({mutationFn:q=>{if(!l)throw new Error("No community");return Mms(l,q)},onSuccess:async()=>{await P(),i({title:"Widget removed"})},onError:q=>i({title:"Couldn't remove widget",description:dn(q,"Please try again."),variant:"destructive"})}),ne=y.useCallback(()=>V.mutate({form:S,editingId:f}),[V,S,f]),te=y.useCallback(q=>{var X,Q,ie,he,ye;const Y=N.find(J=>J.id===q);Y&&(C({cover:((X=Y.details)==null?void 0:X.picture)??null,coverFile:null,title:((Q=Y.details)==null?void 0:Q.title)??"",description:((ie=Y.details)==null?void 0:ie.description)??"",buttonTitle:((he=Y.details)==null?void 0:he.buttonLabel)??"",url:((ye=Y.details)==null?void 0:ye.buttonURL)??""}),p(q),m(!0))},[N]),re=y.useCallback(()=>{C(Ehe),p(null),m(!0)},[]),fe=y.useCallback(()=>{m(!1),p(null),M()},[]),le=y.useCallback(q=>U.mutate(q),[U]);return{customizeWidgetsOpen:d,setCustomizeWidgetsOpen:u,addCustomWidgetOpen:h,setAddCustomWidgetOpen:m,widgetVisibility:g,setWidgetVisibility:v,flagsFor:z,setWidgetFlag:B,isServerBackedWidget:Cms,customWidgets:D,customServerWidgets:F,orderedServerWidgets:A,sidebarOrder:I,moveWidget:_,flagsForServerId:R,setServerFlag:O,editingWidgetId:f,openEditCustomWidget:te,openCreateCustomWidget:re,closeCustomWidgetDialog:fe,customWidget:S,setCustomWidget:C,widgetCoverInputRef:j,resetCustomWidget:M,isVisible:G,hasVisibleSidebarWidgets:H,saveWidgetPreferences:W,addCustomWidgetFromForm:ne,removeCustomWidget:le,isSavingCustomWidget:V.isPending,isLoadingWidgets:E.isLoading}}function Lms({groupId:t,isGroupAdmin:e}){const n=p$t({groupId:t,isAdmin:e}),{customWidgets:r}=n;return r.length===0&&!e?null:a.jsxs("aside",{className:"hidden w-72 shrink-0 flex-col gap-4 xl:flex",children:[r.map(s=>a.jsx(PIe,{widget:s},s.id)),e&&a.jsx(f$t,{onClick:()=>n.setCustomizeWidgetsOpen(!0)}),a.jsx(m$t,{widgets:n,scope:"group",onAddCustom:n.openCreateCustomWidget}),a.jsx(u$t,{widgets:n})]})}function Dms({groupSlug:t,groups:e,resolvedGroup:n=null}){const[r,s]=xc(),i=r.get("section"),o=y.useMemo(()=>t?e.find(u=>qR(u)===t)??null:null,[e,t]),l=n??o,c=y.useMemo(()=>l?RVe(l,i)??j2t(l):null,[l,i]),d=u=>{s(h=>{const m=new URLSearchParams(h);return m.set("section",u),m},{replace:!0})};return y.useEffect(()=>{!l||!c||i!==c.id&&(i&&RVe(l,i)||d(c.id))},[l,c,i]),{group:l,activeTabId:i,activeTab:c,setActiveTabId:d}}function $ms(){const{slug:t}=So(),{toast:e}=yt(),{user:n}=jr(),{community:r}=qe(),{groups:s,communityDetail:i,refetchGroups:o}=Ln(),l=y.useRef(null),c=n?`${n.firstName} ${n.lastName}`:"Guest",d=n?a7(n.firstName,n.lastName,40):"?",u=(r==null?void 0:r.myRole)??(i==null?void 0:i.myRole),h=i9(u,!!((r==null?void 0:r.isByMe)??(i==null?void 0:i.isByMe))),m=y.useMemo(()=>{const M=new Map;for(const z of s)z.id&&z.myRole&&M.set(z.id,z.myRole);return M},[s]),f=y.useCallback(M=>a9(M.groupId?m.get(M.groupId):void 0),[m]),{featuredIds:p,toggleFeatured:g}=s9(),v=Ase({onPostSaved:()=>{var M;return(M=l.current)==null?void 0:M.refetch()},onReposted:M=>{var z;return(z=l.current)==null?void 0:z.addCreatedPost(M)}}),[b,x]=y.useState(!1),w=y.useMemo(()=>t?s.find(M=>qR(M)===t)??null:null,[s,t]),k=lt({queryKey:["group-by-slug",r==null?void 0:r.id,t],queryFn:()=>Our(r.id,t),enabled:!!(!w&&(r!=null&&r.id)&&t),staleTime:6e4,select:M=>M.group}),S=w??k.data??null,C=lt({queryKey:["group-detail",S==null?void 0:S.id],queryFn:()=>mAe(S.id),enabled:!!(S!=null&&S.id),staleTime:3e4,select:M=>M.group}),[j,E]=y.useState(null);y.useEffect(()=>{E(null)},[S==null?void 0:S.id]);const N=j??C.data??S,A=N?m.get(N.id)??N.myRole:void 0,_=A==="admin"||A==="moderator"||u==="admin"||!!((r==null?void 0:r.isByMe)??(i==null?void 0:i.isByMe)),{activeTab:T,setActiveTabId:R}=Dms({groupSlug:t,groups:s,resolvedGroup:N}),[O,F]=y.useState("discussions");y.useEffect(()=>{T&&F(vhr(T))},[T]);const D=M=>{if(!(M==="events"&&!phr)&&(F(M),!!N&&(M==="discussions"||M==="chat"))){const z=yhr(N,M);z&&R(z.id)}},I=()=>{if(!N||!t)return;const M=`${window.location.origin}/groups/${t}${T?`?section=${T.id}`:""}`;navigator.clipboard.writeText(M),e({title:"Link copied!",description:"Group link copied to clipboard."})},P=m_t({communityId:(r==null?void 0:r.id)??null,groups:s,communityDetail:i,preferGroupId:(N==null?void 0:N.id)??null,preferTabId:(T==null?void 0:T.id)??null,preferGroup:N,onPublish:M=>{var G,B;const z=M.tabId??(typeof M.tab=="string"?M.tab:(G=M.tab)==null?void 0:G.id);T!=null&&T.id&&z&&String(z)===T.id&&((B=l.current)==null||B.addCreatedPost(M))},onPublished:()=>x(!1),onDraftSaved:()=>x(!1)});return k.isLoading&&!S?a.jsx(Ths,{}):k.isError&&!S?a.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[a.jsx(wr,{className:"h-12 w-12 text-muted-foreground mb-4"}),a.jsx("h2",{className:"text-xl font-bold text-foreground mb-2",children:"Could not load group"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"Please try again in a moment."}),a.jsx(vr,{to:"/home",children:a.jsx(Z,{variant:"outline",children:"Back to Home"})})]}):N?mhr(N)?a.jsx(Sms,{group:N,onGroupUpdated:E,refetchGroups:o,onActionResult:M=>{!M.ok&&M.message&&e({title:"Couldn't complete",description:M.message,variant:"destructive"})}}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex w-full justify-center gap-5",children:[a.jsx("div",{className:"min-w-0 flex-1",children:a.jsx(kms,{group:N,activeSection:T,activeTab:O,onTabChange:D,onSectionSelect:R,onCreatePost:()=>x(!0),onShare:I,onGroupUpdated:E,refetchGroups:o,currentUserName:c,currentUserAvatar:d,canFeature:h,getCanPin:f,featuredIds:p,onToggleFeatured:g,postActions:v.listProps,onSectionFeedReady:M=>{l.current=M}})}),a.jsx(Lms,{groupId:N.id,isGroupAdmin:_})]}),a.jsx(a$t,{open:b,onOpenChange:x,currentUserName:c,currentUserAvatar:d,form:P}),v.dialogs]}):a.jsxs("div",{className:"flex flex-col items-center justify-center py-20 text-center",children:[a.jsx(wr,{className:"h-12 w-12 text-muted-foreground mb-4"}),a.jsx("h2",{className:"text-xl font-bold text-foreground mb-2",children:"Group not found"}),a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:"The group you're looking for doesn't exist."}),a.jsx(vr,{to:"/",children:a.jsx(Z,{variant:"outline",children:"Back to Home"})})]})}function Oms({avatarUrl:t,placeholderName:e,avatarName:n,onClick:r}){return a.jsx(it.div,{variants:Ph,className:"rounded-lg border border-border bg-card p-4 shadow-card",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Jd,{src:t,name:n||e,className:"h-10 w-10 shrink-0 text-sm"}),a.jsxs("div",{className:"flex-1 relative cursor-pointer",onClick:r,children:[a.jsx("input",{type:"text",placeholder:`What's on your mind, ${e}?`,readOnly:!0,className:"w-full h-10 rounded-full border border-input bg-background px-4 pr-10 text-sm placeholder:text-muted-foreground cursor-pointer"}),a.jsx(Qs,{className:"absolute right-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"})]})]})})}const Fms="linear-gradient(135deg, hsl(190, 80%, 55%), hsl(280, 60%, 60%), hsl(330, 70%, 55%))";function Bms({canManage:t=!1}){const e=Nn(),n=Tn(),{items:r,isLoading:s}=LAt(),i=y.useRef(null),[o,l]=y.useState(!1);if(s||r.length===0)return null;const c=d=>{var u;(u=i.current)==null||u.scrollBy({left:d*300,behavior:"smooth"})};return a.jsxs(it.div,{variants:Ph,className:"rounded-lg border border-border bg-card shadow-card overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between p-4 pb-3",children:[a.jsx("h2",{className:"text-sm font-bold text-foreground uppercase tracking-wide",children:n("Featured posts")}),a.jsxs("div",{className:"flex items-center gap-1",children:[t&&a.jsxs("button",{type:"button",onClick:()=>l(!0),className:"h-7 px-2.5 rounded-full border border-border flex items-center gap-1 text-xs text-muted-foreground hover:bg-muted hover:text-foreground transition-colors",children:[a.jsx(Qs,{className:"h-3 w-3"})," Edit"]}),r.length>1&&a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",onClick:()=>c(-1),className:"h-7 w-7 rounded-full border border-border flex items-center justify-center hover:bg-muted transition-colors","aria-label":"Scroll left",children:a.jsx(nl,{className:"h-4 w-4 text-foreground"})}),a.jsx("button",{type:"button",onClick:()=>c(1),className:"h-7 w-7 rounded-full border border-border flex items-center justify-center hover:bg-muted transition-colors","aria-label":"Scroll right",children:a.jsx(io,{className:"h-4 w-4 text-foreground"})})]})]})]}),a.jsx("div",{ref:i,className:"flex gap-3 overflow-x-auto px-4 pb-4 snap-x scroll-pl-4 [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",children:r.map(d=>a.jsx(Ums,{item:d,onOpen:()=>e(ve.post(d.id))},d.id))}),o&&a.jsx(zms,{open:o,onClose:()=>l(!1),items:r})]})}function Ums({item:t,onOpen:e}){var n,r;return a.jsxs("button",{type:"button",onClick:e,className:"snap-start shrink-0 w-64 text-left rounded-xl border border-border overflow-hidden bg-background hover:shadow-md transition-shadow",children:[t.image&&a.jsx("div",{className:"relative h-32 w-full",children:a.jsx("img",{src:t.image,alt:"",className:"absolute inset-0 w-full h-full object-cover"})}),a.jsxs("div",{className:"p-3 space-y-1.5",children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground leading-snug line-clamp-2",children:t.title}),t.description&&a.jsx("p",{className:"text-xs text-muted-foreground line-clamp-1",children:t.description}),a.jsxs("div",{className:"flex items-center gap-1.5 pt-0.5",children:[a.jsxs(oo,{className:"h-5 w-5",children:[a.jsx(lo,{src:t.avatar,alt:t.author}),a.jsx(co,{className:"text-[9px]",children:((r=(n=t.author)==null?void 0:n[0])==null?void 0:r.toUpperCase())||"?"})]}),a.jsx("span",{className:"text-xs text-muted-foreground truncate",children:t.author})]})]})]})}function zms({open:t,onClose:e,items:n}){const{community:r}=qe(),s=(r==null?void 0:r.id)??null,i=rn(),{toast:o}=yt(),[l,c]=y.useState(n),[d,u]=y.useState(!1);y.useEffect(()=>{c(n)},[n]);const h=(p,g)=>{const v=p+g;if(v<0||v>=l.length)return;const b=[...l];[b[p],b[v]]=[b[v],b[p]],c(b)},m=async p=>{if(s)try{await mTt(s,p.id),c(g=>g.filter(v=>v.id!==p.id)),await i.invalidateQueries({queryKey:["highlighted-posts",s]}),o({title:"Removed from featured"})}catch{o({title:"Couldn't remove post",variant:"destructive"})}},f=async()=>{if(s){u(!0);try{await Dvr(s,l.map(p=>p.id)),await i.invalidateQueries({queryKey:["highlighted-posts",s]}),o({title:"Featured order updated"}),e()}catch{o({title:"Couldn't save order",variant:"destructive"})}finally{u(!1)}}};return a.jsx(Bt,{open:t,onOpenChange:p=>!p&&e(),children:a.jsxs(Ft,{className:"max-w-md",children:[a.jsx(Vt,{children:a.jsx(Ut,{children:"Edit featured posts"})}),l.length===0?a.jsx("p",{className:"text-sm text-muted-foreground py-4",children:"No featured posts. Use a post's menu to feature it."}):a.jsx("div",{className:"space-y-2 max-h-[60vh] overflow-y-auto",children:l.map((p,g)=>a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border p-2",children:[a.jsx("div",{className:"h-10 w-14 rounded-md overflow-hidden shrink-0 bg-muted",children:p.image?a.jsx("img",{src:p.image,alt:"",className:"h-full w-full object-cover"}):a.jsx("div",{className:"h-full w-full",style:{background:Fms}})}),a.jsx("p",{className:"flex-1 text-sm font-medium text-foreground truncate",children:p.title}),a.jsxs("div",{className:"flex items-center gap-0.5",children:[a.jsx("button",{type:"button",onClick:()=>h(g,-1),disabled:g===0,className:"h-7 w-7 rounded-md flex items-center justify-center hover:bg-muted disabled:opacity-30","aria-label":"Move up",children:a.jsx(Zf,{className:"h-4 w-4"})}),a.jsx("button",{type:"button",onClick:()=>h(g,1),disabled:g===l.length-1,className:"h-7 w-7 rounded-md flex items-center justify-center hover:bg-muted disabled:opacity-30","aria-label":"Move down",children:a.jsx(w0,{className:"h-4 w-4"})}),a.jsx("button",{type:"button",onClick:()=>m(p),className:"h-7 w-7 rounded-md flex items-center justify-center text-destructive hover:bg-destructive/10","aria-label":"Remove from featured",children:a.jsx(nn,{className:"h-4 w-4"})})]})]},p.id))}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"outline",onClick:e,disabled:d,children:"Cancel"}),a.jsx(Z,{onClick:f,disabled:d||l.length===0,children:d?"Saving…":"Save order"})]})]})})}function Vms({onClearFilters:t,message:e="No posts found for this filter."}){return a.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 text-center shadow-card",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:e}),a.jsx(Z,{variant:"outline",size:"sm",className:"mt-3",onClick:t,children:"Clear filters"})]})}const BJe=[{label:"24 hrs",value:"24-hours"},{label:"1 wk",value:"1-week"},{label:"1 mo",value:"1-month"},{label:"1 yr",value:"1-year"},{label:"All time",value:""}],t4=t=>`inline-flex items-center gap-1.5 rounded-full px-4 py-1.5 text-xs font-medium transition-colors ${t?"bg-primary text-primary-foreground":"border border-border bg-card text-foreground hover:bg-muted"}`;function Hms({sortKey:t,duration:e,selectedTopic:n,topics:r,onSortKeyChange:s,onDurationChange:i,onTopicSelect:o,onTopicClear:l}){var h;const c=Tn(),d=m=>!n&&t===m,u=(h=BJe.find(m=>m.value===e))==null?void 0:h.label;return a.jsxs(it.div,{variants:Ph,className:"flex items-center gap-2 flex-wrap",children:[a.jsxs("button",{type:"button",onClick:()=>s("recent"),className:t4(d("recent")),children:[a.jsx(ja,{className:"h-3.5 w-3.5"}),c("Recent")]}),a.jsxs("button",{type:"button",onClick:()=>s("top"),className:t4(d("top")),children:[a.jsx(Zf,{className:"h-3.5 w-3.5"}),c("Top posts")]}),a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsxs("button",{type:"button",className:t4(d("trending")),children:[a.jsx(D8,{className:"h-3.5 w-3.5"}),c("Trending"),d("trending")&&u?`: ${u}`:"",a.jsx(li,{className:"h-3 w-3"})]})}),a.jsx(Cr,{align:"start",children:BJe.map(m=>a.jsx(ot,{onClick:()=>i(m.value),children:m.label},m.value||"all"))})]}),a.jsxs("button",{type:"button",onClick:()=>s("following"),className:t4(d("following")),children:[a.jsx(ESe,{className:"h-3.5 w-3.5"}),c("Following")]}),a.jsx(gn,{label:c("How posts are ordered"),children:c("Recent: newest first. Top posts: the most likes, of all time; comments don't change the order. Trending: the most likes and comments together, within the period you pick. Following: posts by people you follow.")}),n?a.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full px-4 py-1.5 text-xs font-medium border border-primary/40 bg-primary/10 text-primary",style:n.bgColor?{backgroundColor:n.bgColor,color:n.textColor||"#fff",borderColor:"transparent"}:void 0,children:[a.jsx(ka,{className:"h-3.5 w-3.5"}),n.name,a.jsx("button",{type:"button",onClick:l,"aria-label":"Clear topic",className:"ml-0.5 hover:opacity-70",children:a.jsx(nn,{className:"h-3.5 w-3.5"})})]}):r.length>0?a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsxs("button",{type:"button",className:t4(!1),children:[a.jsx(ka,{className:"h-3.5 w-3.5"}),c("Select topic"),a.jsx(li,{className:"h-3 w-3"})]})}),a.jsx(Cr,{align:"start",className:"max-h-72 overflow-y-auto",children:r.map(m=>a.jsxs(ot,{onClick:()=>o(m),children:[m.name,typeof m.postCount=="number"&&a.jsx("span",{className:"ml-auto pl-3 text-xs text-muted-foreground",children:m.postCount})]},m.id))})]}):null]})}const Gms=/(https?:\/\/[^\s]+|www\.[^\s]+)/gi;function Wms(t,e){const n=[],r=new RegExp(Gms);let s=0,i=0,o;for(;(o=r.exec(t))!==null;){o.index>s&&n.push(t.slice(s,o.index));let l=o[0],c="";const d=l.match(/[.,!?;:)\]]+$/);d&&(c=d[0],l=l.slice(0,-c.length));const u=l.startsWith("http")?l:`https://${l}`;n.push(a.jsx("a",{href:u,target:"_blank",rel:"noopener noreferrer",className:e,onClick:h=>h.stopPropagation(),children:l},i++)),c&&n.push(c),s=o.index+o[0].length}return s<t.length&&n.push(t.slice(s)),n}const Nhe=20,UJe=.02,zJe=t=>Math.min(1,Math.max(0,t));function Dq(t){const e=t.trim();if(!e)return!1;const n=/^[a-z][a-z0-9+.-]*:/i.test(e)?e:`https://${e}`;try{const{protocol:r,hostname:s}=new URL(n);return(r==="http:"||r==="https:")&&s.includes(".")}catch{return!1}}function qms({communityId:t,coverImage:e,bannerTitle:n,bannerDescription:r,initialLinks:s,onClose:i,onSaved:o}){const{toast:l}=yt(),c=y.useRef(null),[d,u]=y.useState(()=>s.map((_,T)=>({..._,key:_.id??`existing-${T}`}))),[h,m]=y.useState(null),[f,p]=y.useState(null),g=y.useRef(null),[v,b]=y.useState(!1),x=y.useCallback((_,T)=>{var O;const R=(O=c.current)==null?void 0:O.getBoundingClientRect();return!R||R.width===0||R.height===0?null:{x:zJe((_-R.left)/R.width),y:zJe((T-R.top)/R.height)}},[]),w=_=>{if(_.target.dataset.area)return;if(d.length>=Nhe){l({title:`You can add up to ${Nhe} areas`,variant:"destructive"});return}const T=x(_.clientX,_.clientY);T&&(_.currentTarget.setPointerCapture(_.pointerId),g.current=T,p({...T,w:0,h:0}),m(null))},k=_=>{if(!g.current)return;const T=x(_.clientX,_.clientY);if(!T)return;const R=g.current;p({x:Math.min(R.x,T.x),y:Math.min(R.y,T.y),w:Math.abs(T.x-R.x),h:Math.abs(T.y-R.y)})},S=()=>{const _=f;if(g.current=null,p(null),!_||_.w<UJe||_.h<UJe)return;const T=`new-${Date.now()}-${Math.random().toString(36).slice(2,7)}`;u(R=>[...R,{..._,url:"",key:T}]),m(T)},C=(_,T)=>u(R=>R.map(O=>O.key===_?{...O,...T}:O)),j=_=>{u(T=>T.filter(R=>R.key!==_)),m(T=>T===_?null:T)},E=y.useMemo(()=>d.filter(_=>!Dq(_.url)).length,[d]),N=async()=>{if(E>0){l({title:`${E} area${E>1?"s need":" needs"} a valid link`,description:"Use a web address like https://amityonline.com — or delete the area.",variant:"destructive"});return}b(!0);try{await vje(t,{bannerTitle:n,bannerDescription:r,bannerLinks:d.map(({key:_,id:T,...R})=>R)}),l({title:d.length?"Banner links saved":"Banner links cleared"}),o()}catch(_){l({title:"Couldn't save banner links",description:dn(_,"Please try again."),variant:"destructive"})}finally{b(!1)}},A=_=>({left:`${_.x*100}%`,top:`${_.y*100}%`,width:`${_.w*100}%`,height:`${_.h*100}%`});return a.jsx(Bt,{open:!0,onOpenChange:_=>!_&&i(),children:a.jsxs(Ft,{className:"max-w-4xl",children:[a.jsx(Vt,{children:a.jsx(Ut,{children:"Banner links"})}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Drag on the banner to draw a clickable area, then paste the link it should open. Draw as many as you need."}),a.jsxs("div",{ref:c,onPointerDown:w,onPointerMove:k,onPointerUp:S,className:"relative aspect-[16/6] w-full cursor-crosshair select-none overflow-hidden rounded-xl border touch-none",children:[e?a.jsx("img",{src:e,alt:"",draggable:!1,className:"pointer-events-none h-full w-full object-cover"}):a.jsx("div",{className:"h-full w-full",style:{background:"linear-gradient(135deg, hsl(190, 80%, 60%), hsl(280, 60%, 65%), hsl(330, 70%, 60%))"}}),d.map((_,T)=>a.jsx("button",{type:"button","data-area":"1",onPointerDown:R=>R.stopPropagation(),onClick:()=>m(_.key),style:A(_),className:`absolute flex items-start justify-start rounded-md border-2 text-left transition-colors ${h===_.key?"border-primary bg-primary/25":Dq(_.url)?"border-white/90 bg-black/25 hover:bg-black/35":"border-destructive bg-destructive/25"}`,children:a.jsx("span",{className:"m-1 rounded bg-black/70 px-1.5 py-0.5 text-[11px] font-semibold text-white",children:T+1})},_.key)),f&&a.jsx("div",{style:A(f),className:"pointer-events-none absolute rounded-md border-2 border-dashed border-primary bg-primary/20"})]}),a.jsx("div",{className:"max-h-64 space-y-2 overflow-y-auto",children:d.length===0?a.jsx("p",{className:"py-4 text-center text-sm text-muted-foreground",children:"No areas yet — drag a rectangle on the banner above."}):d.map((_,T)=>a.jsxs("div",{onFocusCapture:()=>m(_.key),className:`flex items-center gap-2 rounded-lg border p-2 ${h===_.key?"border-primary":"border-transparent"}`,children:[a.jsx("span",{className:"w-6 shrink-0 text-center text-xs font-semibold text-muted-foreground",children:T+1}),a.jsx(Oe,{value:_.url,onChange:R=>C(_.key,{url:R.target.value}),placeholder:"https://amityonline.com/apply",className:!Dq(_.url)&&_.url.trim()?"border-destructive":""}),a.jsx(Oe,{value:_.label??"",onChange:R=>C(_.key,{label:R.target.value}),placeholder:"Label (optional)",className:"max-w-[180px]"}),a.jsx(Z,{variant:"ghost",size:"icon",onClick:()=>j(_.key),title:"Delete area",children:a.jsx(qn,{className:"h-4 w-4"})})]},_.key))}),a.jsxs(ir,{className:"items-center gap-2 sm:justify-between",children:[a.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[a.jsx(eu,{className:"h-3.5 w-3.5"}),d.length," of ",Nhe," areas"]}),a.jsxs("span",{className:"flex gap-2",children:[a.jsx(Z,{variant:"outline",onClick:i,disabled:v,children:"Cancel"}),a.jsx(Z,{onClick:N,disabled:v,children:v?"Saving…":"Save"})]})]})]})})}const Kms=16/6;function Yms(){var N,A;const{communityDetail:t,refetchCommunityDetail:e}=Ln(),{community:n}=qe(),{isAdmin:r}=X8(),{toast:s}=yt(),i=y.useRef(null),[o,l]=y.useState(!1),[c,d]=y.useState(null),[u,h]=y.useState(!1),[m,f]=y.useState(!1),p=((N=t==null?void 0:t.bannerTitle)==null?void 0:N.trim())||"",g=((A=t==null?void 0:t.bannerDescription)==null?void 0:A.trim())||"",v=(t==null?void 0:t.banner)??null,b=((t==null?void 0:t.bannerLinks)??[]).filter(_=>Dq(_.url)),w=(((n==null?void 0:n.myRole)??(t==null?void 0:t.myRole))==="admin"||!!((n==null?void 0:n.isByMe)??(t==null?void 0:t.isByMe)))&&r,k=(n==null?void 0:n.id)??(t==null?void 0:t.id)??null,S=_=>{var R;const T=(R=_.target.files)==null?void 0:R[0];_.target.value="",T&&d(T)},C=async _=>{if(d(null),!!k){l(!0);try{await Qct(k,_),e(),s({title:"Cover updated"})}catch(T){s({title:"Couldn't update cover",description:dn(T,"Please try again."),variant:"destructive"})}finally{l(!1)}}},j=async()=>{if(k){l(!0);try{await Zct(k),e(),s({title:"Cover removed"})}catch(_){s({title:"Couldn't remove cover",description:dn(_,"Please try again."),variant:"destructive"})}finally{l(!1)}}},E=!!(p||g);return a.jsxs(it.div,{variants:Ph,children:[a.jsxs("div",{className:ee("relative overflow-hidden rounded-2xl",w&&"group"),children:[v?a.jsx("img",{src:v,alt:"",className:"aspect-[16/6] w-full object-cover"}):a.jsx("div",{className:"aspect-[16/6] w-full",style:{background:"linear-gradient(135deg, hsl(190, 80%, 60%), hsl(280, 60%, 65%), hsl(330, 70%, 60%))"}}),b.map((_,T)=>a.jsx("a",{href:_.url,target:"_blank",rel:"noopener noreferrer",title:_.label||void 0,"aria-label":_.label||`Banner link ${T+1}`,style:{left:`${_.x*100}%`,top:`${_.y*100}%`,width:`${_.w*100}%`,height:`${_.h*100}%`},className:"absolute rounded-md ring-0 ring-white/0 transition-all hover:ring-2 hover:ring-white/70 focus-visible:ring-2 focus-visible:ring-white"},_.id??T)),w&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"absolute top-3 right-3 flex gap-2 opacity-0 transition-opacity group-hover:opacity-100",children:[a.jsxs("button",{type:"button",onClick:()=>f(!0),title:"Draw clickable areas on the banner",className:"inline-flex items-center gap-1.5 rounded-full bg-white/90 px-3 py-1.5 text-xs font-medium text-neutral-900 shadow hover:bg-white",children:[a.jsx(eu,{className:"h-3 w-3"})," Links",b.length?` (${b.length})`:""]}),a.jsxs("button",{type:"button",onClick:()=>h(!0),title:E?"Edit banner text":"Add banner title & description",className:"inline-flex items-center gap-1.5 rounded-full bg-white/90 px-3 py-1.5 text-xs font-medium text-neutral-900 shadow hover:bg-white",children:[a.jsx(Qs,{className:"h-3 w-3"})," ",E?"Edit text":"Add text"]})]}),a.jsxs("div",{className:"absolute inset-0 flex items-center justify-center gap-2 opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:[a.jsxs("button",{type:"button",onClick:()=>{var _;return(_=i.current)==null?void 0:_.click()},disabled:o,className:"pointer-events-auto inline-flex items-center gap-1.5 rounded-full bg-white/95 px-4 py-2 text-sm font-medium text-neutral-900 shadow hover:bg-white disabled:opacity-60",children:[a.jsx(FP,{className:"h-4 w-4"}),"Change cover"]}),v&&a.jsx("button",{type:"button",onClick:j,disabled:o,className:"pointer-events-auto rounded-full bg-white/95 px-4 py-2 text-sm font-medium text-neutral-900 shadow hover:bg-white disabled:opacity-60",children:"Remove"})]}),a.jsx("input",{ref:i,type:"file",accept:"image/*",className:"hidden",onChange:S})]})]}),E&&a.jsxs("div",{className:"pt-3",children:[p&&a.jsx("h2",{className:"text-2xl font-bold leading-tight text-foreground",children:p}),g&&a.jsx("p",{className:"mt-1 max-w-3xl whitespace-pre-line text-sm text-muted-foreground",children:Wms(g,"text-primary underline underline-offset-2 hover:opacity-80")})]}),a.jsx(Nh,{file:c,aspect:Kms,title:"Adjust community cover",onCancel:()=>d(null),onCropped:C}),m&&k&&w&&a.jsx(qms,{communityId:k,coverImage:v,bannerTitle:p,bannerDescription:g,initialLinks:(t==null?void 0:t.bannerLinks)??[],onClose:()=>f(!1),onSaved:()=>{e(),f(!1)}}),u&&k&&w&&a.jsx(Qms,{communityId:k,initialTitle:p,initialDescription:g,onClose:()=>h(!1),onSaved:()=>{e(),h(!1)}})]})}function Qms({communityId:t,initialTitle:e,initialDescription:n,onClose:r,onSaved:s}){const{toast:i}=yt(),[o,l]=y.useState(e),[c,d]=y.useState(n),[u,h]=y.useState(!1),m=async()=>{h(!0);try{await vje(t,{bannerTitle:o.trim(),bannerDescription:c.trim()}),i({title:"Banner updated"}),s()}catch(f){i({title:"Couldn't save banner",description:dn(f,"Please try again."),variant:"destructive"})}finally{h(!1)}};return a.jsx(Bt,{open:!0,onOpenChange:f=>!f&&r(),children:a.jsxs(Ft,{className:"max-w-lg",children:[a.jsx(Vt,{children:a.jsx(Ut,{children:"Edit banner"})}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Title"}),a.jsx(Oe,{value:o,onChange:f=>l(f.target.value),placeholder:"Banner title",maxLength:120})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:"Description"}),a.jsx(us,{value:c,onChange:f=>d(f.target.value),rows:4,placeholder:"Banner description — links are automatically clickable"}),a.jsx("p",{className:"text-[11px] text-muted-foreground mt-1",children:"URLs in the description become clickable links."})]})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"outline",onClick:r,disabled:u,children:"Cancel"}),a.jsx(Z,{onClick:m,disabled:u,children:u?"Saving…":"Save"})]})]})})}function Zms({liveCall:t,moreCount:e=0,onJoin:n}){var i,o;const r=(o=(i=t.createdBy)==null?void 0:i.name)==null?void 0:o.trim(),s=[r&&`Hosted by ${r}`,t.defaultSectionName,t.createdAt&&`Started ${yc(t.createdAt)}`].filter(Boolean).join(" • ");return a.jsx(it.div,{variants:Ph,className:"rounded-lg border border-destructive/30 bg-destructive/5 p-4 shadow-card",children:a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{className:"flex items-center gap-3 min-w-0",children:[a.jsx("div",{className:"h-10 w-10 rounded-full bg-destructive/10 flex items-center justify-center shrink-0",children:a.jsx("span",{className:"h-3 w-3 rounded-full bg-destructive animate-pulse"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("span",{className:"text-xs font-semibold text-destructive uppercase tracking-wide",children:"● Live now"}),a.jsx("p",{className:"text-sm font-semibold text-foreground truncate",children:t.name}),s&&a.jsx("p",{className:"text-xs text-muted-foreground truncate",children:s}),e>0&&a.jsxs("p",{className:"text-xs text-destructive/80",children:["+",e," more live now"]})]})]}),a.jsx("button",{type:"button",onClick:n,className:"inline-flex items-center gap-2 rounded-full bg-primary px-5 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors shrink-0",children:"Join now"})]})})}function Jms({canGoLive:t,onGoLive:e,onCreatePost:n}){const r=Tn();return a.jsxs(it.div,{variants:Ph,className:"flex gap-2",children:[t&&a.jsxs("button",{type:"button",onClick:e,className:"flex-1 flex items-center justify-center gap-2 rounded-lg bg-destructive px-3 py-2.5 text-sm font-semibold text-destructive-foreground hover:bg-destructive/90 transition-colors",children:[a.jsx(Ca,{className:"h-4 w-4"}),r("Go live")]}),a.jsxs("button",{type:"button",onClick:n,className:"flex-1 flex items-center justify-center gap-2 rounded-lg bg-primary px-3 py-2.5 text-sm font-semibold text-primary-foreground hover:bg-primary/90 transition-colors",children:[a.jsx(Dn,{className:"h-4 w-4"}),r("Create post")]})]})}function Xms({entries:t,onViewLeaderboard:e}){return a.jsxs(it.div,{variants:Ph,className:"rounded-lg border border-border bg-card p-4 shadow-card",children:[a.jsxs("h3",{className:"text-sm font-bold text-foreground mb-3 flex items-center gap-2",children:[a.jsx(Hg,{className:"h-4 w-4 text-amber-400"}),"Leaderboard"]}),a.jsx("div",{className:"space-y-2.5",children:t.map(n=>a.jsxs("div",{className:"flex items-center gap-2.5",children:[a.jsx("span",{className:`text-xs font-bold w-4 text-center ${n.rank<=3?"text-amber-400":"text-muted-foreground"}`,children:n.rank}),a.jsxs(qd,{userId:n.userId,className:"flex flex-1 min-w-0 items-center gap-2.5",children:[a.jsx("img",{src:n.image,alt:"",className:"h-7 w-7 rounded-full object-cover"}),a.jsx("div",{className:"flex-1 min-w-0",children:a.jsx("p",{className:"text-xs font-medium text-foreground truncate hover:underline",children:n.name})})]}),a.jsx("span",{className:"text-[10px] font-semibold text-muted-foreground",children:n.points})]},n.rank))}),a.jsxs("button",{type:"button",onClick:e,className:"flex items-center justify-center gap-1.5 mt-3 pt-3 border-t border-border text-xs font-medium text-primary hover:underline w-full",children:[a.jsx(bo,{className:"h-3 w-3"}),"View leaderboard"]})]})}function efs({stats:t}){const e=tv();return a.jsxs(it.div,{variants:Ph,className:"space-y-3",children:[a.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 shadow-card",children:[a.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[a.jsx(SSe,{className:"h-4 w-4 text-amber-400"}),a.jsxs("span",{className:"text-sm",children:["Your ",e]})]}),a.jsx("p",{className:"text-2xl font-bold text-foreground",children:t.points.toLocaleString()}),t.pointsDelta&&a.jsx("p",{className:"text-xs text-emerald-500 font-medium",children:t.pointsDelta})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 shadow-card",children:[a.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[a.jsx(HP,{className:"h-4 w-4 text-emerald-500"}),a.jsx("span",{className:"text-sm",children:"Your rank"})]}),a.jsx("p",{className:"text-2xl font-bold text-foreground",children:t.rank!=null?`#${t.rank}`:"—"}),t.rankDelta&&a.jsx("p",{className:"text-xs text-emerald-500 font-medium",children:t.rankDelta})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 shadow-card",children:[a.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground mb-1",children:[a.jsx(D8,{className:"h-4 w-4 text-destructive"}),a.jsx("span",{className:"text-sm",children:"Streak"})]}),a.jsxs("p",{className:"text-2xl font-bold text-foreground",children:[t.streakDays," days"]}),a.jsx("p",{className:"text-xs text-muted-foreground font-medium",children:t.streakLabel})]})]})}function tfs({count:t,avatars:e,onViewAll:n}){const r=Math.max(0,t-e.length);return a.jsxs(it.div,{variants:Ph,className:"rounded-lg border border-border bg-card p-4 shadow-card",children:[a.jsxs("div",{className:"flex items-center justify-between mb-3",children:[a.jsx("h3",{className:"text-sm font-bold text-foreground",children:"Online now"}),a.jsxs("button",{type:"button",onClick:n,className:"inline-flex items-center gap-1.5 rounded-full bg-emerald-500/10 px-2.5 py-0.5 text-xs font-semibold text-emerald-500 hover:bg-emerald-500/20 transition-colors cursor-pointer",children:[a.jsx("span",{className:"h-2 w-2 rounded-full bg-emerald-500 animate-pulse"}),t," online"]})]}),a.jsxs("div",{className:"flex -space-x-2",children:[e.map((s,i)=>a.jsx(Jd,{src:s.image,name:s.name,className:"h-8 w-8 border-2 border-card text-[10px]"},i)),r>0&&a.jsxs("button",{type:"button",onClick:n,className:"h-8 w-8 rounded-full border-2 border-card bg-muted flex items-center justify-center text-[10px] font-medium text-muted-foreground hover:bg-accent transition-colors cursor-pointer",children:["+",r]})]})]})}const nfs=5;function g$t(){const{community:t}=qe(),e=(t==null?void 0:t.id)??null,n=Nn(),{data:r}=lt({queryKey:["trending-posts",e],queryFn:()=>KNt(e,{sort:"trending",duration:"week"}),enabled:!!e,staleTime:5*6e4,select:s=>(s.posts??[]).slice(0,nfs)});return r!=null&&r.length?a.jsxs(it.div,{variants:Ph,className:"rounded-lg border border-border bg-card p-4 shadow-card",children:[a.jsxs("h3",{className:"text-sm font-bold text-foreground mb-3 flex items-center gap-2",children:[a.jsx(HP,{className:"h-4 w-4 text-primary"}),"Trending"]}),a.jsx("div",{className:"space-y-3",children:r.map(s=>a.jsxs("div",{className:"group cursor-pointer",onClick:()=>n(ve.post(s.id)),children:[a.jsx("p",{className:"text-xs font-medium text-foreground line-clamp-2 group-hover:text-primary transition-colors",children:s.title||rfs(s.description)||"Untitled post"}),a.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:yc(s.createdAt)})]},s.id))})]}):null}function rfs(t){return t?t.replace(/<[^>]+>/g,"").slice(0,100):""}function sfs(t=5){const{community:e}=qe(),{communityDetail:n}=Ln(),[r,s]=y.useState([]),[i,o]=y.useState(!0);return y.useEffect(()=>{const l=e==null?void 0:e.id;if(!l||sF(n)){s([]),o(!1);return}let c=!1;return o(!0),EPe(l).then(d=>{c||s((d.events??[]).slice(0,t).map(gg))}).catch(()=>{c||s([])}).finally(()=>{c||o(!1)}),()=>{c=!0}},[e==null?void 0:e.id,n,t]),{events:r,loading:i,disabled:sF(n)}}function v$t(){const t=Nn(),{events:e,loading:n,disabled:r}=sfs(5);return r||!n&&e.length===0?null:a.jsxs(it.div,{variants:Ph,className:"rounded-lg border border-border bg-card p-4 shadow-card",children:[a.jsxs("h3",{className:"text-sm font-bold text-foreground mb-3 flex items-center gap-2",children:[a.jsx(ym,{className:"h-4 w-4 text-primary"}),"Upcoming events"]}),n?a.jsx("p",{className:"text-xs text-muted-foreground py-2",children:"Loading events…"}):a.jsx("div",{className:"space-y-3",children:e.map(s=>a.jsxs("button",{type:"button",onClick:()=>t(Nk(s)),className:"w-full text-left rounded-md px-1 py-1 hover:bg-muted/60 transition-colors",children:[a.jsx("p",{className:"text-xs font-semibold text-foreground truncate",children:s.title}),a.jsx("p",{className:"text-[10px] text-muted-foreground mt-0.5",children:vte(s.startTime,s.endTime)})]},s.realId))}),a.jsxs("button",{type:"button",onClick:()=>t(ve.calendar),className:"flex items-center justify-center gap-1.5 mt-3 pt-3 border-t border-border text-xs font-medium text-primary hover:underline w-full",children:[a.jsx(bo,{className:"h-3 w-3"}),"View all events"]})]})}const VJe=5;function ifs(){const{community:t}=qe(),e=(t==null?void 0:t.id)??null,n=lt({queryKey:["leaderboard",e,"top",VJe],queryFn:()=>n2t(e,{page:1,limit:VJe,duration:"all"}),enabled:!!e,staleTime:6e4});return{entries:y.useMemo(()=>{var i;const s=((i=n.data)==null?void 0:i.entries)??[];return B5t(s,1).map(o=>({rank:o.rank,userId:o.userId,name:o.name,points:o.karmaPoints.toLocaleString(),image:o.picture??""}))},[n.data]),isLoading:n.isLoading}}function afs(t){const{user:e}=jr();return e?a.jsx(lfs,{...t}):a.jsx(ofs,{widgets:t.widgets})}function ofs({widgets:t}){const{isVisible:e,sidebarOrder:n,flagsForServerId:r}=t;return a.jsx(a.Fragment,{children:n.map(s=>s.kind==="custom"?r(s.serverId).user?a.jsx(PIe,{widget:s.widget},s.serverId):null:e(s.id,!1)?s.id==="trendingNews"?a.jsx(g$t,{},s.serverId):s.id==="upcomingEvents"?a.jsx(v$t,{},s.serverId):null:null)})}function lfs({widgets:t,isAdminView:e,canGoLive:n,onGoLive:r,onCreatePost:s,onViewAllOnline:i,onViewLeaderboard:o,onCustomizeWidgets:l}){var w;const{isVisible:c,sidebarOrder:d,flagsForServerId:u}=t,{user:h}=jr(),{streak:m}=GRe(),{count:f,members:p,hidden:g}=UAe(),{entries:v}=ifs(),{myScore:b}=nse(),x={points:((w=b==null?void 0:b.breakdown)==null?void 0:w.grandTotal)??(b==null?void 0:b.score)??0,rank:(b==null?void 0:b.rank)??null,streakDays:(m==null?void 0:m.currentStreak)??0,streakLabel:(m==null?void 0:m.streakLabel)??""};return a.jsxs(a.Fragment,{children:[c("quickActions",e)&&a.jsx(Jms,{canGoLive:n,onGoLive:r,onCreatePost:s}),c("stats",e)&&a.jsx(efs,{stats:x}),c("onlineMembers",e)&&!g&&a.jsx(tfs,{count:f,avatars:p.slice(0,5).map(k=>({image:h&&k.id===h.id?Pk(h):k.picture,name:k.name})),onViewAll:i}),d.map(k=>{if(k.kind==="custom"){const S=u(k.serverId);return(e?S.admin:S.user)?a.jsx(PIe,{widget:k.widget},k.serverId):null}if(!c(k.id,e))return null;switch(k.id){case"onlineMembers":return null;case"leaderboard":return v.length>0?a.jsx(Xms,{entries:v,onViewLeaderboard:o},k.serverId):null;case"trendingNews":return a.jsx(g$t,{},k.serverId);case"upcomingEvents":return a.jsx(v$t,{},k.serverId);default:return null}}),e&&a.jsx(f$t,{onClick:l})]})}function cfs({open:t,onOpenChange:e}){const n=Nn(),{count:r,members:s}=UAe(),{user:i}=jr(),{community:o}=qe(),{communityDetail:l}=Ln(),c=!!(l!=null&&l.isDirectMessageDisabled),d=h=>{e(!1),n(ve.member(h))},u=h=>{e(!1),c0(n,{id:h.id,name:h.name,avatar:h.picture,communityId:o==null?void 0:o.id})};return a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"max-w-md max-h-[80vh]",children:[a.jsx(Vt,{children:a.jsxs(Ut,{className:"flex items-center gap-2",children:[a.jsx(wr,{className:"h-5 w-5 text-primary"}),"Online now",a.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-emerald-500/10 px-2 py-0.5 text-xs font-semibold text-emerald-500",children:[a.jsx("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse"}),r," online"]})]})}),a.jsxs("div",{className:"space-y-2 overflow-y-auto max-h-[60vh] pr-1",children:[s.map(h=>a.jsxs("div",{className:"flex items-center gap-3 p-2 rounded-lg hover:bg-accent/50 transition-colors",children:[a.jsxs("div",{className:"relative cursor-pointer",onClick:()=>d(h.id),children:[a.jsx(Jd,{src:i&&h.id===i.id?Pk(i):h.picture,name:h.name,className:"h-10 w-10"}),a.jsx("span",{className:"absolute bottom-0 right-0 h-2.5 w-2.5 rounded-full bg-emerald-500 border-2 border-card"})]}),a.jsxs("div",{className:"flex-1 min-w-0 cursor-pointer",onClick:()=>d(h.id),children:[a.jsx("p",{className:"text-sm font-medium text-foreground truncate hover:underline",children:h.name}),a.jsx("p",{className:"text-xs text-muted-foreground truncate capitalize",children:h.role})]}),!c&&h.id!==(i==null?void 0:i.id)&&a.jsx(Z,{size:"sm",variant:"outline",className:"text-xs h-7",onClick:()=>u(h),children:"Message"})]},h.id)),s.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground text-center py-6",children:"No one is online right now."})]})]})})}const HJe=t=>t.liveAfter?new Date(t.liveAfter).getTime():NaN;function dfs(){const{community:t}=qe(),e=(t==null?void 0:t.id)??null,n=lt({queryKey:["live-calls",e],queryFn:()=>Hpr(e),enabled:!!e,staleTime:2e4,refetchInterval:3e5,refetchOnWindowFocus:!0}),[r,s]=y.useState(()=>Date.now()),i=n.data??[],o=i.map(HJe).filter(c=>c>r).sort((c,d)=>c-d)[0];return y.useEffect(()=>{if(!o)return;const c=setTimeout(()=>s(Date.now()),Math.min(Math.max(o-Date.now(),0)+250,2147e6));return()=>clearTimeout(c)},[o]),{liveCalls:i.filter(c=>!(HJe(c)>r)),isLoading:n.isLoading}}function ufs(){const{community:t}=qe(),e=(t==null?void 0:t.id)??null,n=lt({queryKey:["community-topics",e],queryFn:()=>xse(e),enabled:!!e&&kje(),staleTime:6e4,select:r=>(r.topics??[]).filter(s=>(s.postCount??0)>0&&(s.status??"ACTIVE")==="ACTIVE")});return{topics:n.data??[],isLoading:n.isLoading}}const hfs="pensil:community-email-opt-in-dismissed",mfs=24*60*60*1e3;function y$t(t,e){return`${hfs}:${t}:${e}`}function ffs(t,e,n=window.localStorage,r=Date.now()){try{const s=n.getItem(y$t(t,e));if(!s)return!1;const i=Number(s);return Number.isFinite(i)?r-i<mfs:!1}catch{return!1}}function pfs(t,e,n=window.localStorage,r=Date.now()){try{n.setItem(y$t(t,e),String(r))}catch{}}function gfs(t){return t.dismissed?!1:typeof t.shouldAsk=="boolean"?t.shouldAsk:t.inAudience===!1}function vfs({communityId:t,userId:e}){var v,b;const{toast:n}=yt(),r=rn(),s=v7(),i=["community-email-preferences",t],[o,l]=y.useState(!0),[c,d]=y.useState(!1);y.useEffect(()=>{l(!t||!e?!0:ffs(e,t))},[t,e]);const u=lt({queryKey:i,queryFn:()=>cjt(t),enabled:!!(t&&e&&!o),staleTime:15e3,retry:!1}),h=jt({mutationFn:()=>Oxe(t,{optIn:!0}),onSuccess:x=>{d(!0),n({title:"Email updates turned on",description:`You'll receive updates from ${x.community.name}.`}),window.setTimeout(()=>r.setQueryData(i,x),1400)},onError:x=>{n({title:"Couldn't turn on email updates",description:x instanceof ze?x.message:"Please try again.",variant:"destructive"})}}),m=jt({mutationFn:()=>Oxe(t,{dismissOptInPrompt:!0}),onError:x=>{n({title:"Hidden for now",description:x instanceof ze?x.message:"We couldn't save this, so you may see it again on another device."})}}),f=()=>{t&&e&&pfs(e,t),l(!0),t&&m.mutate()},p=!!(t&&e&&u.data&&gfs({inAudience:u.data.preferences.inAudience,shouldAsk:(v=u.data.optInPrompt)==null?void 0:v.shouldAsk,dismissed:o})),g=h.isPending||m.isPending;return a.jsx(Al,{initial:!1,children:p&&a.jsx(it.div,{initial:s?{opacity:0}:{opacity:0,y:-6,height:0},animate:s?{opacity:1}:{opacity:1,y:0,height:"auto"},exit:s?{opacity:0}:{opacity:0,y:-6,height:0},transition:{duration:s?.15:.28,ease:[.22,1,.36,1]},className:"overflow-hidden",children:a.jsxs("div",{role:"region","aria-label":"Community email updates",className:ee("group relative mb-3 overflow-hidden rounded-xl border shadow-sm transition-colors duration-300",c?"border-success/30 bg-success/5":"border-primary/25 bg-gradient-to-r from-primary/[0.08] via-card to-card"),children:[a.jsx("span",{"aria-hidden":"true",className:ee("absolute inset-y-0 left-0 w-1 transition-colors duration-300",c?"bg-success/70":"bg-primary/70")}),a.jsxs("div",{className:"flex flex-col gap-3 py-3 pl-5 pr-4 sm:flex-row sm:items-center",children:[a.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-3",children:[a.jsx("span",{"aria-hidden":"true",className:ee("flex h-9 w-9 shrink-0 items-center justify-center rounded-full ring-1 transition-colors duration-300",c?"bg-success/15 text-success ring-success/25":"bg-primary/10 text-primary ring-primary/20"),children:c?a.jsx(Qn,{className:"h-4 w-4"}):a.jsx(Ii,{className:"h-4 w-4"})}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-sm leading-snug text-foreground",children:c?"You're on the list — thanks!":(b=u.data)==null?void 0:b.consentText}),!c&&a.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"No spam, and one click to stop."})]})]}),!c&&a.jsxs("div",{className:"flex shrink-0 items-center gap-1.5 self-end sm:self-auto",children:[a.jsxs(Z,{size:"sm",className:"shadow-sm transition-transform active:scale-95",disabled:g,onClick:()=>h.mutate(),children:[h.isPending&&a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}),h.isPending?"Turning on…":"Yes, email me"]}),a.jsx(Z,{type:"button",size:"icon",variant:"ghost",className:"h-8 w-8 text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":"Dismiss email updates prompt",title:"Not now",disabled:h.isPending,onClick:f,children:a.jsx(nn,{className:"h-4 w-4","aria-hidden":"true"})})]})]})]})},"community-email-opt-in")})}const yfs=["recent","top","trending","following"],bfs=()=>{const{isAdminView:t}=Zy(),{user:e}=jr(),{community:n}=qe(),{communityDetail:r,groups:s}=Ln(),i=Nn(),o=Di(),l=n==null?void 0:n.id;y.useEffect(()=>{l&&lh("homepage-loaded",{communityId:l})},[l]);const c=e?`${e.firstName} ${e.lastName}`:"Guest",d=e?Pk(e,40):"",u=(n==null?void 0:n.myRole)??(r==null?void 0:r.myRole),h=i9(u,!!((n==null?void 0:n.isByMe)??(r==null?void 0:r.isByMe))),m=h,f=y.useMemo(()=>{const le=new Map;for(const q of s)q.id&&q.myRole&&le.set(q.id,q.myRole);return le},[s]),p=y.useCallback(le=>a9(le.groupId?f.get(le.groupId):void 0),[f]),[g,v]=y.useState(!1),[b,x]=y.useState(!1),[w,k]=y.useState(!1),S=XB(),C=()=>{if(S()){if(!re.canPostAnywhere){re.setJoinPromptOpen(!0);return}k(!0)}},[j,E]=xc(),N=j.get("sort"),A=yfs.includes(N)?N:"recent",[_,T]=Y2("home-feed:duration",""),[R,O]=Y2("home-feed:topic",null),{topics:F}=ufs(),{featuredIds:D,toggleFeatured:I}=s9(),{liveCalls:P}=dfs(),M=y.useCallback(le=>{E(q=>{const Y=new URLSearchParams(q);return le==="recent"?Y.delete("sort"):Y.set("sort",le),Y},{replace:!0})},[E]),z=y.useCallback(le=>{M(le),O(null),le!=="trending"&&T("")},[M,O,T]),G=y.useCallback(le=>{T(le),M("trending"),O(null)},[M,O,T]),B=R?R.id:A,H=!R&&A==="trending"?_:"",W=Dse({sort:B,duration:H,currentUserName:c,currentUserAvatar:d,currentUserId:(e==null?void 0:e.id)??null,restoreScope:"home"}),V=Ase({onPostSaved:le=>W.setFeedPosts(q=>q.map(Y=>Y.realId===le.id?Am(le,Y.id):Y)),onReposted:W.addCreatedPost,onAuthorBlocked:W.removePostsByAuthor}),U=y.useCallback(le=>{const q=F.find(Y=>Y.id===le.id);O(q??{id:le.id,name:le.name}),window.scrollTo({top:0,behavior:"smooth"})},[F,O]),ne=y.useCallback(le=>{var X;const q=s.find(Q=>Q.id===le.groupId),Y=(X=q==null?void 0:q.tabs)==null?void 0:X.find(Q=>Q.id===le.channelId);q&&Y&&i(_x(q,Y))},[s,i]),te=p$t(),re=m_t({communityId:(n==null?void 0:n.id)??null,groups:s,communityDetail:r,onPublish:W.addCreatedPost,onPublished:()=>k(!1),onDraftSaved:()=>k(!1)}),fe=te.hasVisibleSidebarWidgets(t);return a.jsxs(a.Fragment,{children:[a.jsx(CPe,{showSidebar:fe,banner:a.jsx(Yms,{}),main:a.jsxs(a.Fragment,{children:[a.jsx(vfs,{communityId:n==null?void 0:n.id,userId:e==null?void 0:e.id}),P.length>0&&a.jsx(Zms,{liveCall:P[0],moreCount:P.length-1,onJoin:()=>P[0].eventEntryId?i(ve.eventDetail(P[0].eventEntryId)):P[0].meetingId?i(ve.meeting(P[0].meetingId),{state:{returnTo:`${o.pathname}${o.search}`}}):He.error("This live session isn't ready yet — please try again in a moment.")}),a.jsx(Bms,{canManage:h}),a.jsx(Oms,{avatarUrl:d,placeholderName:(e==null?void 0:e.firstName)||"Guest",avatarName:c,onClick:C}),a.jsx(CNt,{open:b,onOpenChange:x}),a.jsx(a$t,{open:w,onOpenChange:k,currentUserName:c,currentUserAvatar:d,form:re}),a.jsx("div",{className:"sticky top-0 z-20 -mx-1 bg-transparent px-1 pb-1",children:a.jsx(Hms,{sortKey:A,duration:_,selectedTopic:R,topics:F,onSortKeyChange:z,onDurationChange:G,onTopicSelect:O,onTopicClear:()=>O(null)})}),W.newPostCount>0&&a.jsx("div",{className:"sticky top-12 z-10 flex justify-center",children:a.jsxs("button",{onClick:()=>{W.refreshNewPosts(),window.scrollTo({top:0,behavior:"smooth"})},className:"inline-flex items-center gap-1.5 rounded-full bg-primary px-4 py-1.5 text-xs font-semibold text-primary-foreground shadow-md transition-colors hover:bg-primary/90",children:[a.jsx(Zf,{className:"h-3.5 w-3.5"}),W.newPostCount===1?"1 new post":`${W.newPostCount} new posts`]})}),W.isLoading?a.jsx("div",{className:"flex items-center justify-center py-16 text-muted-foreground",children:a.jsx(Ne,{className:"h-5 w-5 animate-spin"})}):W.error&&W.displayedPosts.length===0?a.jsxs("div",{className:"flex flex-col items-center gap-3 py-16 text-center",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:W.error}),a.jsx(Z,{variant:"outline",size:"sm",onClick:W.refetch,children:"Try again"})]}):W.displayedPosts.length===0?a.jsx(Vms,{onClearFilters:()=>z("recent")}):a.jsx(Lse,{posts:W.displayedPosts,feed:W,currentUserAvatar:d,currentUserName:c,canFeature:h,getCanPin:p,featuredIds:D,onToggleFeatured:I,...V.listProps,onTopicClick:U,onChannelClick:ne,onReachEnd:W.loadMore,isLoadingMore:W.isLoadingMore,hasMore:W.hasMore,restoreScrollScope:`home:${B}:${H}`})]}),sidebar:fe?a.jsx(afs,{widgets:te,isAdminView:t,canGoLive:m,onGoLive:()=>x(!0),onCreatePost:C,onViewAllOnline:()=>v(!0),onViewLeaderboard:()=>i(ve.leaderboard),onCustomizeWidgets:()=>te.setCustomizeWidgetsOpen(!0)}):void 0}),V.dialogs,a.jsx(cfs,{open:g,onOpenChange:v}),a.jsx(m$t,{widgets:te,onAddCustom:te.openCreateCustomWidget}),a.jsx(u$t,{widgets:te})]})},xfs=[["general","general-dressing-room","Dressing room","1676012088690-d2197f76db9b"],["general","general-kit-room","Kit room","1655089131279-8029e8a21ac6"],["general","general-coach-on-the-touchline","Coach on the touchline","1788369235608-b607512542ef"],["general","general-coach-talk","Coach talk","1654000758272-7cccdb725a50"],["general","general-matchday-broadcast","Matchday broadcast","1641135698530-8d919344c0e5"],["general","general-pitch-side-camera","Pitch-side camera","1703168947722-c4fab57650c8"],["general","general-video-analysis","Video analysis","1634433480471-147fe911ba6b"],["general","general-hands-in","Hands in","1542323228-002ac256e7b8"],["general","general-supporters-with-flags","Supporters with flags","1779449607184-cb5b6c9b8174"],["general","general-boots-on-the-line","Boots on the line","1529900748604-07564a03e7a6"],["football","football-packed-stadium","Packed stadium","1629217855633-79a6925d6c47"],["football","football-touchline","Touchline","1459865264687-595d652de67e"],["football","football-match-balls","Match balls","1551958219-acbc608c6377"],["football","football-squad-training","Squad training","1739550635585-484633b21450"],["football","football-training-balls","Training balls","1599747130279-e05a79d13958"],["football","football-drills-with-cones","Drills with cones","1600551778275-0f76a4f1fa39"],["football","football-on-the-ball","On the ball","1638027611086-3b1b8f63611d"],["football","football-ball-in-the-sun","Ball in the sun","1586084039069-a42a1d8bf8f9"],["football","football-free-kick","Free kick","1630270395856-9c85ab98a75c"],["football","football-team-huddle","Team huddle","1641159009736-8a5fd4e52fef"],["education","education-lecture","Lecture","1606761568499-6d2451b23c66"],["education","education-empty-lecture-hall","Empty lecture hall","1541829070764-84a7d30dd3f3"],["education","education-students-listening","Students listening","1758270705067-0d7edee57af0"],["education","education-question-time","Question time","1758270704021-361c165d68fd"],["education","education-seminar","Seminar","1758270704226-db897b180243"],["education","education-classmates","Classmates","1758270704524-596810e891b5"],["education","education-auditorium","Auditorium","1640416639872-93aabd8d91d3"],["education","education-library-from-above","Library from above","1514513452089-17f8a9771ee8"],["education","education-library-study","Library study","1741699428220-65f37f3fbbcb"],["education","education-reading-room","Reading room","1718327453695-4d32b94c90a4"],["physiotherapy","physiotherapy-knee-assessment","Knee assessment","1649751361457-01d3a696c7e6"],["physiotherapy","physiotherapy-shoulder-treatment","Shoulder treatment","1706353399656-210cca727a33"],["physiotherapy","physiotherapy-band-rehab","Band rehab","1645005512942-a17817fb7c11"],["physiotherapy","physiotherapy-massage-gun","Massage gun","1768508236664-3f294aaf7d41"],["physiotherapy","physiotherapy-injury-on-the-pitch","Injury on the pitch","1713711437257-0232e837f40c"],["physiotherapy","physiotherapy-shoulder-check","Shoulder check","1645005512968-0c1fe99f0093"],["physiotherapy","physiotherapy-guided-rehab","Guided rehab","1751456357793-9f626e986113"],["physiotherapy","physiotherapy-leg-stretch-therapy","Leg stretch therapy","1540206235220-7590996b7a5a"],["physiotherapy","physiotherapy-clinic-consultation","Clinic consultation","1663053978108-428cc6355aef"],["physiotherapy","physiotherapy-pitch-side-care","Pitch-side care","1652107990078-71ac8b908302"],["health","health-hamstring-stretch","Hamstring stretch","1600026453194-11ae289732b8"],["health","health-park-stretch","Park stretch","1791774706624-b10412909e26"],["health","health-cool-down-on-the-track","Cool-down on the track","1761839257789-20147513121a"],["health","health-seated-stretch","Seated stretch","1791531962422-6a74f6b3f237"],["health","health-warm-up","Warm-up","1791532350432-01274967600f"],["health","health-restful-sleep","Restful sleep","1658928784381-6f68bbcf92f6"],["health","health-mindfulness","Mindfulness","1602192509154-0b900ee1f851"],["health","health-hydration","Hydration","1624948465121-96e87ae34a87"],["health","health-morning-walk","Morning walk","1477332552946-cfb384aeaf1c"],["health","health-evening-walk","Evening walk","1556833232-52da3e4bd5d8"],["cars","cars-open-road","Open road","1568605117036-5fe5e7bab0b7"],["cars","cars-sunset-drive","Sunset drive","1765446647632-cf6ee5c9ad7a"],["cars","cars-highway-from-above","Highway from above","1572401611152-cf63d874b019"],["cars","cars-desert-road","Desert road","1504887764023-6f27056d186c"],["cars","cars-hill-road","Hill road","1469423910081-3488183dd77e"],["cars","cars-forest-road","Forest road","1593382805742-7c1cd5bdeb36"],["cars","cars-on-the-move","On the move","1507882690564-a51298183825"],["cars","cars-country-road","Country road","1669941060931-6912c4538ba3"],["cars","cars-supercar","Supercar","1542362567-b07e54358753"],["cars","cars-mountain-pass","Mountain pass","1603584173870-7f23fdae1b7a"],["entertainment","entertainment-concert-lights","Concert lights","1729553199933-c897fea4f41f"],["entertainment","entertainment-live-stage","Live stage","1602369944529-c237ca143d09"],["entertainment","entertainment-crowd-and-lights","Crowd and lights","1577648875929-894904f7b051"],["entertainment","entertainment-band-on-stage","Band on stage","1577042816206-2e85c23f2392"],["entertainment","entertainment-festival-stage","Festival stage","1598588436316-1e65ffcffc0a"],["entertainment","entertainment-arena-show","Arena show","1684679493212-6adfaf58c388"],["entertainment","entertainment-at-the-cinema","At the cinema","1608170825938-a8ea0305d46c"],["entertainment","entertainment-cinema-seats","Cinema seats","1668890094751-6986d0ca9dfc"],["entertainment","entertainment-big-screen","Big screen","1640127249305-793865c2efe1"],["entertainment","entertainment-movie-theatre","Movie theatre","1563381013529-1c922c80ac8d"],["programming","programming-code-close-up","Code close-up","1542831371-29b0f74f9713"],["programming","programming-laptop-at-work","Laptop at work","1587620962725-abab7fe55159"],["programming","programming-dual-screens","Dual screens","1534972195531-d756b9bfa9f2"],["programming","programming-glasses-and-code","Glasses and code","1504639725590-34d0984388bd"],["programming","programming-night-coding","Night coding","1571171637578-41bc2dd41cd2"],["programming","programming-syntax-highlighting","Syntax highlighting","1627398242454-45a1465c2479"],["programming","programming-python-script","Python script","1624953587687-daf255b6b80a"],["programming","programming-desk-setup","Desk setup","1484417894907-623942c8ee29"],["programming","programming-code-by-the-window","Code by the window","1555099962-4199c345e5dd"],["programming","programming-developer-at-work","Developer at work","1510915228340-29c85a43dcfe"],["technology","technology-circuit-board","Circuit board","1562408590-e32931084e23"],["technology","technology-red-circuitry","Red circuitry","1580584126903-c17d41830450"],["technology","technology-microchip","Microchip","1640955785023-1854685dae05"],["technology","technology-electronics-kit","Electronics kit","1555664424-778a1e5e1b48"],["technology","technology-components","Components","1557701197-2f99da0922dd"],["technology","technology-glowing-traces","Glowing traces","1631375937044-6dd5beac01d2"],["technology","technology-server-rack","Server rack","1695668548342-c0c1ad479aee"],["technology","technology-network-cables","Network cables","1683322499436-f4383dd59f5a"],["technology","technology-data-centre-aisle","Data centre aisle","1580106815433-a5b1d1d53d85"],["technology","technology-data-centre","Data centre","1573164713988-8665fc963095"],["business","business-team-meeting","Team meeting","1517048676732-d65bc937f952"],["business","business-office-discussion","Office discussion","1758691737543-09a1b2b715fa"],["business","business-city-towers","City towers","1486406146926-c627a92ad1ab"],["business","business-workshop","Workshop","1542744173-8e7e53415bb0"],["business","business-client-meeting","Client meeting","1758518731706-be5d5230e5a5"],["business","business-pitching","Pitching","1517245386807-bb43f82c33c4"],["business","business-planning-notes","Planning notes","1454165804606-c3d57bc86b40"],["business","business-high-five","High five","1600880292203-757bb62b4baf"],["business","business-team-at-work","Team at work","1758691737138-7b9b1884b1db"],["business","business-open-plan-office","Open-plan office","1560264280-88b68371db39"],["science","science-pipetting","Pipetting","1614935151651-0bea6508db6b"],["science","science-laboratory","Laboratory","1602052577122-f73b9710adba"],["science","science-sample-tubes","Sample tubes","1606206591513-adbfbdd7a177"],["science","science-lab-work","Lab work","1579165466991-467135ad3110"],["science","science-microscope-lens","Microscope lens","1572884267966-02340ebc90ac"],["science","science-research-team","Research team","1631556759511-6ce895fbf0ad"],["science","science-at-the-microscope","At the microscope","1630959305790-4c956ce6c0b6"],["science","science-beaker","Beaker","1617155093730-a8bf47be792d"],["science","science-plant-cells","Plant cells","1714844437236-de8ef1c7286f"],["science","science-petri-dish","Petri dish","1535127022272-dbe7ee35cf33"],["engineering","engineering-rebar-grid","Rebar grid","1768677903496-becc4be07258"],["engineering","engineering-site-plans","Site plans","1716037991590-c975184b37df"],["engineering","engineering-tower-crane","Tower crane","1655975719898-8f3432eed322"],["engineering","engineering-site-engineers","Site engineers","1694521787193-9293daeddbaa"],["engineering","engineering-steel-beam","Steel beam","1705242056484-213173456790"],["engineering","engineering-earthworks","Earthworks","1783753445220-58f16296ca61"],["engineering","engineering-crane-at-sunset","Crane at sunset","1777138389158-2b5981869bd7"],["engineering","engineering-technical-drawing","Technical drawing","1542621334-a254cf47733d"],["engineering","engineering-blueprint","Blueprint","1721244654392-9c912a6eb236"],["engineering","engineering-reviewing-plans","Reviewing plans","1581094488379-6a10d04c0f04"],["sports","sports-sprint-start","Sprint start","1461896836934-ffe607ba8211"],["sports","sports-sprinters-from-above","Sprinters from above","1502904550040-7534597429ae"],["sports","sports-hurdles","Hurdles","1538146888063-3ecf5e002d7c"],["sports","sports-starting-blocks","Starting blocks","1516487200032-8532cb603261"],["sports","sports-track-bend","Track bend","1528900398979-99eb5b7f057d"],["sports","sports-night-sprint","Night sprint","1726195221456-7e104a23bbff"],["sports","sports-clay-court-tennis","Clay court tennis","1554068865-24cecd4e34b8"],["sports","sports-cycling-race","Cycling race","1758300672856-56ae203cefc6"],["sports","sports-butterfly-stroke","Butterfly stroke","1530549387789-4c1017266635"],["sports","sports-rowing-eight","Rowing eight","1569406125624-98ee19b01d4a"],["arts","arts-brushes","Brushes","1459908676235-d5f02a50184b"],["arts","arts-painting-class","Painting class","1609174112693-52fdcebffd89"],["arts","arts-easels","Easels","1747311585699-d7a659864cac"],["arts","arts-at-the-canvas","At the canvas","1664482017668-91158897414c"],["arts","arts-spray-paints","Spray paints","1499237882915-ce9a55013b83"],["arts","arts-studio-table","Studio table","1732175678215-613bb7f32ee0"],["arts","arts-gallery-wall","Gallery wall","1606819717115-9159c900370b"],["arts","arts-white-gallery","White gallery","1518998053901-5348d3961a04"],["arts","arts-exhibition","Exhibition","1569783721854-33a99b4c0bae"],["arts","arts-classic-gallery","Classic gallery","1554907984-15263bfd63bd"],["travel","travel-desert-highway","Desert highway","1494783367193-149034c05e8f"],["travel","travel-mountain-road","Mountain road","1637139498630-9a580b24fa75"],["travel","travel-canyon-road","Canyon road","1685502659056-65e26934742e"],["travel","travel-causeway","Causeway","1610123598147-f632aa18b275"],["travel","travel-valley-lookout","Valley lookout","1559246082-db96ed0eae0f"],["travel","travel-alpine-road","Alpine road","1672849282385-87583894cf5b"],["travel","travel-winding-road","Winding road","1536420100273-cabfa8e5b67a"],["travel","travel-above-the-clouds","Above the clouds","1715262437769-d5a52db0d1dd"],["travel","travel-plane-windows","Plane windows","1771694583915-78f9b39fd6d1"],["travel","travel-wing-at-sunset","Wing at sunset","1729350038150-495c628bd695"],["food","food-rainbow-bowl","Rainbow bowl","1512621776951-a57141f2eefd"],["food","food-poke-bowl","Poke bowl","1555243896-c709bfa0b564"],["food","food-berry-bowl","Berry bowl","1654923064926-be7e64267a31"],["food","food-tofu-salad","Tofu salad","1546069901-5ec6a79120b0"],["food","food-salmon-bowl","Salmon bowl","1604259597308-5321e8e4789c"],["food","food-fruit-bowl","Fruit bowl","1498507297833-5373e346b4e0"],["food","food-fresh-salmon","Fresh salmon","1633862472152-e3873eb1b3ff"],["food","food-market-produce","Market produce","1591189863430-ab87e120f312"],["food","food-vegetable-basket","Vegetable basket","1631021967261-c57ee4dfa9bb"],["food","food-chopping","Chopping","1779240564443-cd08c849d968"],["resources","resources-books-and-notes","Books and notes","1517673132405-a56a62b18caf"],["resources","resources-open-books","Open books","1456513080510-7bf3a84b82f8"],["resources","resources-book-pile","Book pile","1594312915251-48db9280c8f1"],["resources","resources-bookshelf","Bookshelf","1528208079124-a2387f039c99"],["resources","resources-stack-of-books","Stack of books","1589946766796-8239e06fdaa7"],["resources","resources-leather-books","Leather books","1423592707957-3b212afa6733"],["resources","resources-fountain-pen","Fountain pen","1471107340929-a87cd0f5b5f3"],["resources","resources-open-notebook","Open notebook","1501618669935-18b6ecb13d6d"],["resources","resources-notebook-and-pen","Notebook and pen","1601321268954-22646044f7d0"],["resources","resources-desk-flat-lay","Desk flat lay","1488998427799-e3362cec87c3"],["medicine","medicine-team-doctor","Team doctor","1532938911079-1b06ac7ceec7"],["medicine","medicine-stethoscope","Stethoscope","1655313719493-16ebe4906441"],["medicine","medicine-wrist-x-ray","Wrist X-ray","1564725075388-cc8338732289"],["medicine","medicine-reviewing-scans","Reviewing scans","1758691463110-697a814b2033"],["medicine","medicine-x-ray-consultation","X-ray consultation","1631563018856-81be9c118283"],["medicine","medicine-mri-scanner","MRI scanner","1666214280352-db292c05fd80"],["medicine","medicine-mri-scan","MRI scan","1666214275172-ccc3b98e5519"],["medicine","medicine-examination-room","Examination room","1766299892549-b56b257d1ddd"],["medicine","medicine-doctor-consultation","Doctor consultation","1758691462878-6edc3d3da1be"],["medicine","medicine-blood-pressure-check","Blood pressure check","1615486511484-92e172cc4fe0"],["strength","strength-gym-floor","Gym floor","1689877020200-403d8542d95d"],["strength","strength-dumbbells","Dumbbells","1603077492579-39ff927823db"],["strength","strength-coached-deadlift","Coached deadlift","1758875569256-f37c438cac65"],["strength","strength-training-hall","Training hall","1689876593463-6678f2e8d4f2"],["strength","strength-sled-push","Sled push","1533681904393-9ab6eee7e408"],["strength","strength-battle-ropes","Battle ropes","1758875569136-9936939e6179"],["strength","strength-kettlebell-rack","Kettlebell rack","1632077804406-188472f1a810"],["strength","strength-kettlebells-on-the-track","Kettlebells on the track","1562771242-7d077824055a"],["strength","strength-rope-conditioning","Rope conditioning","1599058918144-1ffabb6ab9a0"],["strength","strength-box-jumps","Box jumps","1536922246289-88c42f957773"],["nutrition","nutrition-recovery-bowl","Recovery bowl","1547592180-85f173990554"],["nutrition","nutrition-breakfast-fuel","Breakfast fuel","1467453678174-768ec283a940"],["nutrition","nutrition-post-training-meal","Post-training meal","1539137071648-943c78fcbc84"],["nutrition","nutrition-meal-prep","Meal prep","1668838289210-e7665d947145"],["nutrition","nutrition-protein-plate","Protein plate","1573691843386-8b311aefa811"],["nutrition","nutrition-protein-scoop","Protein scoop","1693996046865-19217d179161"],["nutrition","nutrition-recovery-smoothie","Recovery smoothie","1579954115545-a95591f28bfc"],["nutrition","nutrition-mixing-a-shake","Mixing a shake","1581269631444-9c6cc00df0b6"],["nutrition","nutrition-team-bottles","Team bottles","1516116189403-10c54c714a28"],["nutrition","nutrition-omega-3-capsules","Omega-3 capsules","1565071783280-719b01b29912"],["recovery","recovery-ice-bath","Ice bath","1548236339-55676e0726e0"],["recovery","recovery-cold-plunge","Cold plunge","1570877441418-a00651b562ef"],["recovery","recovery-ice-bucket","Ice bucket","1654146218080-40d0ec9cce46"],["recovery","recovery-foam-rolling","Foam rolling","1738524108491-9a0db4067897"],["recovery","recovery-foam-roller","Foam roller","1653617748437-895c016e88b1"],["recovery","recovery-compression-boots","Compression boots","1598979073157-69186ee3338b"],["recovery","recovery-compression-therapy","Compression therapy","1706777280252-5de52771cf13"],["recovery","recovery-back-massage","Back massage","1519824145371-296894a0daa9"],["recovery","recovery-sports-massage","Sports massage","1611073615452-4889cb93422e"],["recovery","recovery-massage-table","Massage table","1650044252595-cacd425982ff"],["coaching","coaching-tactics-board","Tactics board","1585757318177-0570a997dc3a"],["coaching","coaching-one-to-one-coaching","One-to-one coaching","1529932398402-e0b30f66a559"],["coaching","coaching-academy-session","Academy session","1526232761682-d26e03ac148e"],["coaching","coaching-session-notes","Session notes","1693683223469-e3da9e2a723d"],["coaching","coaching-staff-on-the-pitch","Staff on the pitch","1528036788076-c031f7707270"],["coaching","coaching-coaching-with-data","Coaching with data","1649029476766-3dce4bf23b3f"],["coaching","coaching-game-plan","Game plan","1759747410647-98d79e6d3f30"],["coaching","coaching-strategy","Strategy","1736349294274-1ab8532c5978"],["coaching","coaching-boots-tied","Boots tied","1526494661200-9d7cfd4b2404"],["coaching","coaching-touchline-instructions","Touchline instructions","1630521301804-84bed5b0288a"],["sports-science","sports-science-training-bibs","Training bibs","1599204606472-2aa892d4b26c"],["sports-science","sports-science-bibs-on-the-pitch","Bibs on the pitch","1655856609558-5d058861511e"],["sports-science","sports-science-heart-rate-watch","Heart rate watch","1659366100463-9e29a63adcc2"],["sports-science","sports-science-activity-tracking","Activity tracking","1596236100223-f3c656de3038"],["sports-science","sports-science-running-test","Running test","1535571638417-bc38e1002ccc"],["sports-science","sports-science-wrist-sensor","Wrist sensor","1730732862505-b2bc3eb21468"],["sports-science","sports-science-race-data","Race data","1509010636466-2292663e132f"],["sports-science","sports-science-bike-session-data","Bike session data","1730732862462-da1c2134fa8d"],["sports-science","sports-science-treadmill-test","Treadmill test","1638183395699-2c0db5b6afbb"],["sports-science","sports-science-treadmill-row","Treadmill row","1578763363228-6e8428de69b2"]],GJe=1280,WJe=720,wfs=.9,b$t=[{id:"general",label:"General"},{id:"football",label:"Football"},{id:"coaching",label:"Coaching"},{id:"physiotherapy",label:"Physiotherapy"},{id:"medicine",label:"Medicine"},{id:"sports-science",label:"Sports Science"},{id:"strength",label:"Strength & Conditioning"},{id:"recovery",label:"Recovery"},{id:"nutrition",label:"Nutrition"},{id:"health",label:"Health"},{id:"education",label:"Education"},{id:"cars",label:"Cars"},{id:"entertainment",label:"Entertainment"},{id:"programming",label:"Programming"},{id:"technology",label:"Technology"},{id:"business",label:"Business"},{id:"science",label:"Science"},{id:"engineering",label:"Engineering"},{id:"sports",label:"Sports"},{id:"arts",label:"Arts"},{id:"travel",label:"Travel"},{id:"food",label:"Food"},{id:"resources",label:"Resources"}],qJe=b$t.map(t=>t.id),The=xfs.map(([t,e,n])=>{const r=`/covers/${t}/${e.slice(t.length+1)}`;return{id:e,name:n,category:t,src:`${r}.webp`,thumb:`${r}-thumb.webp`}}).sort((t,e)=>qJe.indexOf(t.category)-qJe.indexOf(e.category));function x$t(t){return new Promise((e,n)=>{const r=()=>n(new Error("The cover could not be prepared")),s=new Image;s.onerror=r,s.onload=()=>{const i=document.createElement("canvas");i.width=GJe,i.height=WJe;const o=i.getContext("2d");if(!o)return r();o.drawImage(s,0,0,GJe,WJe),i.toBlob(l=>l?e(new File([l],`cover-${t.id}.jpg`,{type:"image/jpeg"})):r(),"image/jpeg",wfs)},s.src=t.src})}function IIe({selectedId:t,disabled:e,onPick:n}){const r=Tn(),[s,i]=y.useState("all"),o=y.useMemo(()=>s==="all"?The:The.filter(d=>d.category===s),[s]),l=y.useRef(null),c=d=>{var h;const u=l.current;(h=u==null?void 0:u.scrollBy)==null||h.call(u,{left:d*u.clientWidth*.8,behavior:"smooth"})};return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:r("No picture to hand? Use a ready-made cover")}),a.jsx("div",{className:"themed-scrollbar flex gap-1.5 overflow-x-auto p-1",role:"group","aria-label":r("Cover subjects"),children:[{id:"all",label:""},...b$t].map(d=>a.jsx("button",{type:"button","aria-pressed":s===d.id,onClick:()=>{var u,h;i(d.id),(h=(u=l.current)==null?void 0:u.scrollTo)==null||h.call(u,{left:0})},className:ee("shrink-0 rounded-full border px-3 py-1 text-xs font-medium transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary",s===d.id?"border-primary bg-primary/10 text-primary":"border-border text-muted-foreground hover:bg-muted hover:text-foreground"),children:d.id==="all"?pn(r("All ({count})"),{count:The.length}):r(d.label)},d.id))}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("button",{type:"button","aria-label":r("Earlier covers"),onClick:()=>c(-1),className:"hidden h-7 w-7 shrink-0 items-center justify-center rounded-full border border-border text-muted-foreground transition hover:bg-muted hover:text-foreground sm:flex",children:a.jsx(nl,{className:"h-4 w-4"})}),a.jsx("div",{ref:l,className:"themed-scrollbar flex min-w-0 flex-1 snap-x gap-2 overflow-x-auto p-1",role:"group","aria-label":r("Ready-made covers"),children:o.map(d=>a.jsx("button",{type:"button",title:d.name,"aria-label":pn(r("Use the {name} cover"),{name:d.name}),"aria-pressed":t===d.id,disabled:e,onClick:()=>n(d),className:ee("aspect-[16/9] w-24 shrink-0 snap-start overflow-hidden rounded-md border border-border transition hover:ring-2 hover:ring-primary/40 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary disabled:opacity-60 sm:w-28",t===d.id&&"ring-2 ring-primary"),children:a.jsx("img",{src:d.thumb,alt:"",loading:"lazy",className:"h-full w-full object-cover"})},d.id))}),a.jsx("button",{type:"button","aria-label":r("More covers"),onClick:()=>c(1),className:"hidden h-7 w-7 shrink-0 items-center justify-center rounded-full border border-border text-muted-foreground transition hover:bg-muted hover:text-foreground sm:flex",children:a.jsx(io,{className:"h-4 w-4"})})]})]})}function w$t(t){const e=Tn(),{toast:n}=yt(),[r,s]=y.useState(!1);return{pick:y.useCallback(async o=>{s(!0);try{t(await x$t(o),o)}catch{n({title:e("Couldn't use that cover"),description:e("Pick another one, or choose a picture of your own."),variant:"destructive"})}finally{s(!1)}},[t,e,n]),preparing:r}}const kfs=16/6,Sfs=[{value:"self-paced",label:"Self-paced",description:"All published sections are available immediately."},{value:"structured",label:"Structured",description:"Release each section a number of days after enrollment."},{value:"scheduled",label:"Scheduled",description:"Release each section on a specific date and time."}];function Cfs({open:t,onOpenChange:e,onCreated:n}){const{toast:r}=yt(),s=rn(),{community:i}=qe(),{groups:o}=Ln(),l=Nn(),[c,d]=y.useState(""),[u,h]=y.useState(""),[m,f]=y.useState(""),[p,g]=y.useState(null),[v,b]=y.useState(null),[x,w]=y.useState(null),k=y.useRef(null),[S,C]=y.useState(null),j=y.useRef(null),E=w$t(y.useCallback((X,Q)=>{j.current=Q.id,b(X)},[])),[N,A]=y.useState("self-paced"),[_,T]=y.useState(!1),[R,O]=y.useState(""),[F,D]=y.useState(!0),[I,P]=y.useState(1),[M,z]=y.useState(0),[G,B]=y.useState(!1),H=y.useMemo(()=>NIe(o),[o]),W=H.find(X=>X.id===R)??null,V=xAe(W==null?void 0:W.groupType);y.useEffect(()=>{t&&(d(""),h(""),f(""),g(null),b(null),C(null),j.current=null,w(null),A("self-paced"),T(!1),O(""),D(!0),P(1),z(0))},[t]),y.useEffect(()=>{if(!p){w(null);return}const X=URL.createObjectURL(p);return w(X),()=>URL.revokeObjectURL(X)},[p]);const U=()=>{k.current&&(k.current.value="")},ne=X=>{g(X),b(null),C(j.current),j.current=null,U()},te=()=>{b(null),j.current=null,U()},re=X=>X.trim()?X.length>80?(f("Course title must be 80 characters or fewer"),!1):(f(""),!0):(f("Course title is required"),!1),fe=()=>{re(c)&&P(2)},le=async()=>{if(!(i!=null&&i.id)){r({title:"No community",description:"Couldn't determine the community.",variant:"destructive"});return}if(re(c)){if(!R){r({title:"Select a group",description:"Choose the group this course belongs to.",variant:"destructive"});return}B(!0),z(0);try{const{course:X}=await kAe(i.id,{title:c.trim(),description:u.trim(),deliveryMode:N,enforceLessonOrder:_,groupId:R,enrollGroupMembers:F});if(!(X!=null&&X.id))throw new Error("Course was created but no id was returned");let Q=!1;if(p){z(35);try{await jEt(i.id,X.id,p)}catch{Q=!0}z(100)}r({title:"Course created",description:V?`"${c.trim()}" was added. Because ${W==null?void 0:W.name} is paid, enrollment will use join through request when you publish.`:`"${c.trim()}" was added.`}),Q&&r({title:"Cover image not uploaded",description:"The course was created without its cover. Add one from Edit course.",variant:"destructive"}),await s.invalidateQueries({queryKey:["knowledge-courses",i.id]}),e(!1),n==null||n(X.id),l(ve.knowledgeCourse(X.id))}catch(X){const Q=X instanceof ze?Dt(X.body,X.message):"Something went wrong. Please try again.";r({title:"Could not create course",description:Q,variant:"destructive"})}finally{B(!1),z(0)}}},q=I===1?"Add new course":I===2?"Choose a learning path":"Attach to a group",Y=I===1?"Name the course, then continue to set how learners receive content.":I===2?`How should “${c.trim()}” become available to learners?`:"Assign this course to a community group. Learners must join that group before they can enroll.";return a.jsxs(a.Fragment,{children:[a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"flex max-h-[min(85dvh,720px)] w-[calc(100vw-2rem)] max-w-md flex-col gap-0 overflow-hidden p-0 sm:max-w-md",children:[a.jsxs(Vt,{className:"shrink-0 border-b border-border px-5 py-4 pr-12",children:[a.jsx(Ut,{children:q}),a.jsx(_n,{children:Y})]}),a.jsx("div",{className:"themed-scrollbar min-h-0 flex-1 overflow-x-hidden overflow-y-auto overscroll-contain px-5 py-4 pr-4 [scrollbar-gutter:stable]",children:I===1?a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"course-banner",children:"Banner (optional)"}),a.jsx("div",{className:"overflow-hidden rounded-lg border border-border bg-muted/40",children:x?a.jsx("img",{src:x,alt:"",className:"aspect-[16/6] w-full object-cover"}):a.jsx("div",{className:"flex aspect-[16/6] items-center justify-center text-xs text-muted-foreground",children:"Recommended ratio 16:6"})}),a.jsx(Oe,{ref:k,id:"course-banner",type:"file",accept:"image/*",disabled:G,onChange:X=>{var Q;return b(((Q=X.target.files)==null?void 0:Q[0])??null)}}),a.jsx(IIe,{selectedId:S,disabled:G||E.preparing,onPick:X=>void E.pick(X)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(_e,{htmlFor:"course-title",children:["Course name ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsx(Oe,{id:"course-title",value:c,disabled:G,placeholder:"Enter course name",onChange:X=>{d(X.target.value),m&&re(X.target.value)},onKeyDown:X=>{X.key==="Enter"&&(X.preventDefault(),fe())}}),m?a.jsx("p",{className:"text-xs text-destructive",children:m}):null]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Course description"}),a.jsx(Du,{value:u,onChange:h,placeholder:"Describe what learners will gain from this course…",className:"rounded-xl",plainTextPaste:!0,markdownBreaks:!0})]})]}):I===2?a.jsxs("div",{className:"space-y-3",children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Choose when sections become available. You can set each section's timing after the course is created."}),a.jsx(TS,{value:N,onValueChange:X=>A(X),className:"grid gap-2",disabled:G,children:Sfs.map(X=>a.jsxs("label",{htmlFor:`create-delivery-${X.value}`,className:`cursor-pointer rounded-lg border p-3 ${N===X.value?"border-primary bg-primary/5":"border-border"}`,children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ly,{value:X.value,id:`create-delivery-${X.value}`}),a.jsx("span",{className:"text-sm font-medium",children:X.label})]}),a.jsx("p",{className:"mt-1 pl-6 text-xs text-muted-foreground",children:X.description})]},X.value))}),a.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border p-3",children:[a.jsxs("div",{children:[a.jsx(_e,{className:"font-medium",children:"Enforce lesson order"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Learners must complete each published lesson before opening the next one."})]}),a.jsx(Hs,{checked:_,disabled:G,onCheckedChange:T})]})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs(_e,{htmlFor:"course-group",children:["Group ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsxs(zn,{value:R,onValueChange:O,disabled:G,children:[a.jsx(On,{id:"course-group",children:a.jsx(Vn,{placeholder:"Select a group"})}),a.jsx(Fn,{children:H.map(X=>a.jsxs(pt,{value:X.id,children:[X.name," · ",CN(X.groupType)]},X.id))})]})]}),W?a.jsxs(a.Fragment,{children:[V?a.jsxs("p",{className:"rounded-lg border border-border bg-muted/40 p-3 text-xs text-muted-foreground",children:[W.name," is a paid group. This course will automatically use join through request when you publish — learners ask to enroll and wait for admin approval."]}):null,a.jsxs("label",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[a.jsx(ji,{id:"enroll-group-members",checked:F,disabled:G,onCheckedChange:X=>D(X===!0),className:"mt-0.5"}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"enroll-group-members",className:"font-medium cursor-pointer",children:"Enroll current members and moderators"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"People already in this group (who have also joined the community) will be added to the course now."})]})]})]}):a.jsx("p",{className:"text-xs text-muted-foreground",children:"Select the group this course belongs to before creating it."}),G&&M>0?a.jsxs("div",{className:"space-y-1",children:[a.jsx(ap,{value:M,className:"h-1.5"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Uploading banner…"})]}):null]})}),a.jsx(ir,{className:"shrink-0 border-t border-border px-5 py-4",children:I===1?a.jsxs(a.Fragment,{children:[a.jsx(Z,{variant:"outline",disabled:G,onClick:()=>e(!1),children:"Cancel"}),a.jsx(Z,{disabled:!c.trim(),onClick:fe,children:"Next"})]}):I===2?a.jsxs(a.Fragment,{children:[a.jsx(Z,{variant:"outline",disabled:G,onClick:()=>P(1),children:"Back"}),a.jsx(Z,{disabled:G,onClick:()=>P(3),children:"Next"})]}):a.jsxs(a.Fragment,{children:[a.jsx(Z,{variant:"outline",disabled:G,onClick:()=>P(2),children:"Back"}),a.jsxs(Z,{disabled:G||!R,onClick:()=>void le(),children:[G?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Create"]})]})})]})}),a.jsx(Nh,{file:v,aspect:kfs,title:"Crop course banner",onCancel:te,onCropped:ne})]})}const k$t=y.forwardRef(({...t},e)=>a.jsx("nav",{ref:e,"aria-label":"breadcrumb",...t}));k$t.displayName="Breadcrumb";const S$t=y.forwardRef(({className:t,...e},n)=>a.jsx("ol",{ref:n,className:ee("flex flex-wrap items-center gap-1.5 break-words text-sm text-muted-foreground sm:gap-2.5",t),...e}));S$t.displayName="BreadcrumbList";const C$t=y.forwardRef(({className:t,...e},n)=>a.jsx("li",{ref:n,className:ee("inline-flex items-center gap-1.5",t),...e}));C$t.displayName="BreadcrumbItem";const j$t=y.forwardRef(({asChild:t,className:e,...n},r)=>{const s=t?TSe:"a";return a.jsx(s,{ref:r,className:ee("transition-colors hover:text-foreground",e),...n})});j$t.displayName="BreadcrumbLink";const E$t=y.forwardRef(({className:t,...e},n)=>a.jsx("span",{ref:n,role:"link","aria-disabled":"true","aria-current":"page",className:ee("font-normal text-foreground",t),...e}));E$t.displayName="BreadcrumbPage";const N$t=({children:t,className:e,...n})=>a.jsx("li",{role:"presentation","aria-hidden":"true",className:ee("[&>svg]:size-3.5",e),...n,children:t??a.jsx(io,{})});N$t.displayName="BreadcrumbSeparator";function MIe({items:t,className:e}){return t.length===0?null:a.jsx(k$t,{className:e,children:a.jsx(S$t,{children:t.map((n,r)=>{const s=r===t.length-1;return a.jsxs(y.Fragment,{children:[a.jsx(C$t,{children:s||!n.href?a.jsx(E$t,{className:"max-w-[200px] truncate sm:max-w-xs",children:n.label}):a.jsx(j$t,{asChild:!0,children:a.jsx(vr,{to:n.href,className:"max-w-[160px] truncate sm:max-w-xs",children:n.label})})}),s?null:a.jsx(N$t,{})]},`${n.label}-${r}`)})})})}function T$t({communityId:t,value:e,onChange:n,id:r,className:s,source:i}){const o=Tn(),[l,c]=y.useState(!1),[d,u]=y.useState(""),[h,m]=y.useState("");y.useEffect(()=>{const w=window.setTimeout(()=>m(d.trim()),250);return()=>window.clearTimeout(w)},[d]),y.useEffect(()=>{l||u("")},[l]);const f=C0({queryKey:[...(i==null?void 0:i.queryKey)??uPe(t),h],initialPageParam:1,queryFn:({pageParam:w})=>i?i.fetch(h,w):myr(t,h,w),getNextPageParam:w=>w.hasMore?w.page+1:void 0,enabled:l&&!!t,staleTime:3e4}),p=y.useMemo(()=>{var w;return(((w=f.data)==null?void 0:w.pages)??[]).flatMap(k=>k.authors)},[f.data]),g=w=>e.some(k=>k.id===w),v=w=>n(g(w.id)?e.filter(k=>k.id!==w.id):[...e,w]),b=e.length===0?o("All authors"):e.length===1?e[0].name:pn(o("{name} +{count}"),{name:e[0].name,count:e.length-1}),x="flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent focus-visible:bg-accent focus-visible:outline-none";return a.jsxs(Ni,{open:l,onOpenChange:c,children:[a.jsx(Ti,{asChild:!0,children:a.jsxs("button",{id:r,type:"button",role:"combobox","aria-expanded":l,"aria-label":o("Filter by author"),className:ee("flex h-10 w-full items-center justify-between gap-2 rounded-md border border-input bg-background px-3 text-left text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",s),children:[a.jsxs("span",{className:ee("flex min-w-0 items-center gap-2",e.length===0&&"text-muted-foreground"),children:[a.jsx(k9t,{className:"h-4 w-4 shrink-0 opacity-70","aria-hidden":!0}),a.jsx("span",{className:"truncate",children:b})]}),a.jsx(li,{className:"h-4 w-4 shrink-0 opacity-50","aria-hidden":!0})]})}),a.jsxs(yi,{align:"start",className:"w-[var(--radix-popover-trigger-width)] min-w-[16rem] p-0",children:[a.jsxs("div",{className:"relative border-b",children:[a.jsx(hs,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground","aria-hidden":!0}),a.jsx("input",{autoFocus:!0,value:d,maxLength:120,onChange:w=>u(w.target.value),onKeyDown:w=>{w.key==="Enter"&&(w.preventDefault(),p[0]&&v({id:p[0].id,name:p[0].name}))},placeholder:o("Search authors"),"aria-label":o("Search authors"),className:"h-10 w-full bg-transparent pl-9 pr-3 text-sm outline-none placeholder:text-muted-foreground"})]}),a.jsxs("div",{role:"listbox","aria-multiselectable":"true","aria-label":o("Authors"),className:"themed-scrollbar max-h-64 overflow-y-auto p-1",children:[a.jsxs("button",{type:"button",role:"option","aria-selected":e.length===0,onClick:()=>n([]),className:x,children:[a.jsx(Qn,{className:ee("h-4 w-4 shrink-0",e.length===0?"opacity-100":"opacity-0"),"aria-hidden":!0}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-muted-foreground",children:o("All authors")})]}),p.map(w=>a.jsxs("button",{type:"button",role:"option","aria-selected":g(w.id),onClick:()=>v({id:w.id,name:w.name}),className:x,children:[a.jsx(Qn,{className:ee("h-4 w-4 shrink-0",g(w.id)?"opacity-100":"opacity-0"),"aria-hidden":!0}),w.picture?a.jsx("img",{src:w.picture,alt:"",className:"h-6 w-6 shrink-0 rounded-full object-cover"}):a.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded-full bg-primary/10 text-[11px] font-semibold text-primary","aria-hidden":!0,children:w.name[0]||"M"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:w.name}),a.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:w.count})]},w.id)),f.isFetching&&!f.isFetchingNextPage&&a.jsxs("p",{className:"flex items-center gap-2 px-2 py-1.5 text-xs text-muted-foreground",children:[a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}),o("Loading…")]}),f.isError&&a.jsx("p",{className:"px-2 py-1.5 text-xs text-destructive",children:o("Couldn't load authors. Try again.")}),!f.isFetching&&!f.isError&&p.length===0&&a.jsx("p",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:h?o("No authors match."):(i==null?void 0:i.emptyText)??o("No resources have been shared yet.")}),f.hasNextPage&&a.jsxs("button",{type:"button",onClick:()=>void f.fetchNextPage(),disabled:f.isFetchingNextPage,className:"mt-1 flex w-full items-center justify-center gap-2 rounded-sm px-2 py-1.5 text-xs font-medium text-primary hover:bg-accent disabled:opacity-60",children:[f.isFetchingNextPage&&a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}),o("Show more")]})]})]})]})}function Z1e(t,e){return t.state==="draft"?!1:e||t.visibleToNonMembers||t.isJoined}function jfs(t){const e=t?new Date(t):null;return e&&!Number.isNaN(e.getTime())?e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}):null}function _$t({completedAt:t,hint:e,children:n,className:r}){const s=Tn(),i=jfs(t);return a.jsxs("div",{className:ee("flex min-w-0 items-center gap-1.5 text-sm text-muted-foreground",r),title:e,children:[a.jsx(yo,{className:"h-4 w-4 shrink-0 text-success","aria-hidden":!0}),a.jsx("span",{className:"min-w-0 truncate",children:i?pn(s("Completed {date}"),{date:i}):s("Completed")}),n]})}function LIe({progress:t,detailed:e=!1,hint:n,className:r}){const s=Tn(),i=Math.min(100,Math.max(0,Math.round(t.percent))),o=e?a.jsx(gn,{label:s("Your progress"),children:s("Only you see your progress. Each part of this resource counts equally: how far you have watched the video, how far you have listened to the audio, and how many of its files you have viewed or downloaded. Going back to the start never lowers it. A resource with only a description is complete once you open it.")}):null;if(t.completed)return a.jsx(_$t,{completedAt:t.completedAt,hint:n,className:r,children:o});const l=t.started&&i>0?pn(s("{percent}% complete"),{percent:i}):s("Not started"),c=[t.videoPercent!=null&&pn(s("Video {percent}%"),{percent:t.videoPercent}),t.audioPercent!=null&&pn(s("Audio {percent}%"),{percent:t.audioPercent}),(t.attachmentsTotal??0)>0&&pn(s("Files {done}/{total}"),{done:t.attachmentsOpened??0,total:t.attachmentsTotal??0})].filter(Boolean);return a.jsxs("div",{className:ee("min-w-0",r),title:n,children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(ap,{value:i,"aria-label":s("Your progress"),className:"h-1.5 flex-1 bg-muted"}),a.jsx("span",{className:"inline-flex shrink-0 items-center gap-1 text-xs tabular-nums text-muted-foreground",children:l}),o]}),e&&c.length>1&&a.jsx("p",{className:"mt-1.5 text-xs text-muted-foreground",children:c.join(" · ")})]})}function gae({saved:t,saveLabel:e,onToggle:n,className:r}){const s=Tn();return a.jsx("button",{type:"button","aria-pressed":t,"aria-label":t?s("Remove from saved"):e,title:t?s("Saved. Click to remove it from your saved list."):e,onClick:i=>{i.preventDefault(),i.stopPropagation(),n()},className:ee("inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-full border bg-background/95 shadow-sm transition hover:bg-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",t?"border-primary/40 text-primary":"border-border text-muted-foreground hover:text-foreground",r),children:a.jsx(hO,{className:ee("h-3.5 w-3.5",t&&"fill-current"),"aria-hidden":!0})})}function Efs(t){switch(t){case"draft":return{label:"Draft",className:"border-amber-500/30 text-amber-600"};case"closed-free":return{label:"Members",className:"border-violet-500/30 text-violet-600"};case"closed-paid":return{label:"Paid",className:"border-violet-500/30 text-violet-600"};default:return null}}function Nfs({course:t,isAdmin:e=!1,onToggleLike:n,onToggleSave:r}){var b,x,w;const s=Tn(),i=!!((b=t.paywall)!=null&&b.required),o=i&&t.state!=="draft"?null:Efs(t.state),l=!e,c=i&&(e||!((x=t.paywall)!=null&&x.entitled)&&!t.isJoined),d=J6(t.description),u=lk(t.durationMinutes),h=t.lessonCount??0,m=l&&t.isJoined&&t.progressPercent!=null,f=t.lessonsCompleted??0,p=Z1e(t,e),g=!!t.savedByMe&&t.state!=="draft",v=!!o||c||l&&(t.joinStatus==="requested"||t.isJoined);return a.jsxs("div",{className:"relative flex",children:[a.jsxs(vr,{to:ve.knowledgeCourse(t.id),className:"group flex w-full flex-col overflow-hidden rounded-xl border bg-card text-left shadow-sm transition duration-200 hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md",children:[a.jsx("div",{className:"relative aspect-[16/9] overflow-hidden bg-muted",children:t.banner?a.jsx("img",{src:t.banner,alt:"",loading:"lazy",className:"h-full w-full object-cover transition duration-300 group-hover:scale-[1.025]"}):a.jsx("div",{className:"flex h-full items-center justify-center bg-primary/10 text-3xl font-semibold text-primary/40",children:t.title.charAt(0).toUpperCase()})}),a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col p-4",children:[v?a.jsxs("div",{className:"mb-2 flex flex-wrap gap-1",children:[o?a.jsx(ga,{variant:"outline",className:`text-[10px] bg-card/90 ${o.className}`,children:s(o.label)}):null,c?a.jsx(ga,{variant:"outline",className:"text-[10px] bg-card/90 border-violet-500/30 text-violet-600",children:(w=t.paywall)!=null&&w.fromPrice?QRe(t.paywall.fromPrice):s("Paid")}):null,l&&t.joinStatus==="requested"?a.jsx(ga,{variant:"outline",className:"text-[10px] bg-card/90 border-amber-500/30 text-amber-600",children:s("Requested")}):null,l&&t.isJoined?a.jsx(ga,{variant:"outline",className:"text-[10px] bg-card/90 border-emerald-500/30 text-emerald-600",children:s("Enrolled")}):null]}):null,a.jsx("h3",{className:"line-clamp-2 font-semibold leading-snug [overflow-wrap:anywhere] group-hover:text-primary",children:t.title}),d?a.jsx("p",{className:"mt-2 line-clamp-2 text-sm leading-5 text-muted-foreground [overflow-wrap:anywhere]",children:d}):null,a.jsxs("div",{className:"mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 text-xs text-muted-foreground",children:[a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(Iu,{className:"h-3.5 w-3.5"}),pn(s(h===1?"{count} lesson":"{count} lessons"),{count:h})]}),a.jsxs("span",{className:"inline-flex items-center gap-1",title:s("Total time to complete"),children:[a.jsx(ja,{className:"h-3.5 w-3.5"}),u]})]}),m?a.jsx(LIe,{className:"mt-3",progress:{percent:t.progressPercent??0,started:f>0,completed:(t.totalLessons??0)>0&&f>=(t.totalLessons??0),completedAt:t.completedAt},hint:pn(s("{done} of {total} lessons completed"),{done:f,total:t.totalLessons??0})}):null,t.author?a.jsx("div",{className:"mt-auto pt-4",children:a.jsxs("div",{className:"flex min-w-0 items-center gap-2 border-t pt-3 text-xs text-muted-foreground",children:[a.jsx(Jd,{src:t.author.picture,name:t.author.name,className:"h-6 w-6 shrink-0 text-[10px]"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:t.author.name})]})}):null]})]}),p&&(n||r)||g&&r?a.jsxs("div",{className:"absolute right-3 top-3 flex items-center gap-1.5",children:[r&&(p||g)?a.jsx(gae,{saved:!!t.savedByMe,saveLabel:s("Save this course"),onToggle:()=>r(t)}):null,n&&p?a.jsx(vse,{liked:!!t.likedByMe,count:t.likeCount??0,likeLabel:s("Like this course"),onToggle:()=>n(t)}):null]}):null]})}function Tfs(){return a.jsxs("div",{className:"animate-pulse overflow-hidden rounded-xl border border-border",children:[a.jsx("div",{className:"aspect-[16/9] bg-muted"}),a.jsxs("div",{className:"space-y-2 p-4",children:[a.jsx("div",{className:"h-4 w-3/4 rounded bg-muted"}),a.jsx("div",{className:"h-3 w-1/2 rounded bg-muted"})]})]})}function _fs({count:t=8}){return a.jsx("div",{className:"grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:Array.from({length:t},(e,n)=>a.jsx(Tfs,{},n))})}function Afs(t){const{community:e}=qe(),n=e==null?void 0:e.id;return C0({queryKey:["knowledge-courses",n,"paged",t],initialPageParam:1,queryFn:async({pageParam:r})=>{var i;const s=await CEt(n,{...t,page:r});return{...PEt(s),page:s.page??r,hasMore:!!s.hasMore,total:s.total??((i=s.courses)==null?void 0:i.length)??0,hasSaved:!!s.hasSaved}},getNextPageParam:r=>r.hasMore?r.page+1:void 0,enabled:!!n,placeholderData:Uy,staleTime:3e4})}function A$t({patch:t,save:e,onHasSaved:n,texts:r}){const{toast:s}=yt(),i=y.useRef(new Map);return y.useCallback(o=>{const l=!!o.savedByMe,c=!l,d=(i.current.get(o.id)??0)+1;i.current.set(o.id,d);const u=()=>i.current.get(o.id)===d;t(o.id,c),e(o.id,c).then(h=>{u()&&(t(o.id,h.savedByMe),n(h.hasSaved),h.savedByMe&&s({title:r.saved,description:r.savedHint}))}).catch(h=>{u()&&(t(o.id,l),s({title:c?r.saveFailed:r.unsaveFailed,description:dn(h,r.tryAgain),variant:"destructive"}))})},[t,e,n,r,s])}function P$t(t,e){const n=Tn(),r=rn(),s=$Tt(t,e),i=y.useCallback((d,u)=>s(d,{savedByMe:u}),[s]),o=y.useCallback((d,u)=>mmr(t,d,u),[t]),l=y.useCallback(d=>{r.setQueriesData({queryKey:["knowledge-courses",t,"paged"]},u=>{if(!u||typeof u!="object"||!("pages"in u))return u;const h=u;return{...h,pages:h.pages.map(m=>({...m,hasSaved:d}))}}),r.invalidateQueries({queryKey:["knowledge-courses",t,"paged"],predicate:u=>{var h;return!!((h=u.queryKey[3])!=null&&h.saved)},refetchType:"none"})},[r,t]),c=y.useMemo(()=>({saved:n("Saved"),savedHint:n("Find it any time under Saved on the Courses page."),saveFailed:n("Couldn't save this course"),unsaveFailed:n("Couldn't remove it from saved"),tryAgain:n("Please try again.")}),[n]);return A$t({patch:i,save:o,onHasSaved:l,texts:c})}function R$t({savedOnly:t,onChange:e,allLabel:n}){const r=Tn(),s=i=>ee("inline-flex flex-1 items-center justify-center gap-1.5 rounded-md px-3 py-1.5 text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring sm:flex-none",i?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground");return a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{role:"tablist","aria-label":r("Show"),className:"flex w-full gap-1 rounded-lg bg-muted/70 p-1 sm:inline-flex sm:w-auto",children:[a.jsx("button",{type:"button",role:"tab","aria-selected":!t,onClick:()=>e(!1),className:s(!t),children:n}),a.jsxs("button",{type:"button",role:"tab","aria-selected":t,onClick:()=>e(!0),className:s(t),children:[a.jsx(hO,{className:ee("h-3.5 w-3.5",t&&"fill-current text-primary"),"aria-hidden":!0}),r("Saved")]})]}),a.jsx(gn,{label:r("Saved"),children:r("Press the bookmark on anything to save it here for later. Only you can see what you saved.")})]})}function KJe(t){return t?[{value:"all",label:"All courses"},{value:"published",label:"Published"},{value:"draft",label:"Drafts"}]:[{value:"all",label:"All courses"},{value:"enrolled",label:"Enrolled"},{value:"requested",label:"Requested"},{value:"not-enrolled",label:"Not enrolled"}]}const Pfs=[{value:"default",label:"Default order"},{value:"title",label:"Title A–Z"},{value:"shortest",label:"Shortest first"},{value:"longest",label:"Longest first"},{value:"most-lessons",label:"Most lessons"},{value:"most-liked",label:"Most liked"}],Rfs={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.04}}},fC={hidden:{opacity:0,y:8},show:{opacity:1,y:0}};function Ifs(){const t=Tn(),e=rn(),{community:n}=qe(),{communityDetail:r}=Ln(),[s,i]=y.useState(!1),[o,l]=y.useState(""),[c,d]=y.useState(""),[u,h]=y.useState("all"),[m,f]=y.useState("default"),[p,g]=y.useState(!1),[v,b]=y.useState({}),[x,w]=y.useState([]);y.useEffect(()=>{const U=window.setTimeout(()=>d(o.trim()),350);return()=>window.clearTimeout(U)},[o]);const{isAdmin:k}=X8(),S=y.useMemo(()=>({q:c||void 0,filter:u==="all"?void 0:u,sort:m==="default"?void 0:m,view:k?void 0:"member",from:v.from,to:v.to,author:x.length?x.map(U=>U.id):void 0,saved:p||void 0}),[c,u,m,k,v,x,p]),C=y.useMemo(()=>{if(!(n!=null&&n.id))return;const U=k?void 0:"member";return{queryKey:lmr(n.id,U),fetch:(ne,te)=>cmr(n.id,ne,te,U),emptyText:t("No courses have been made yet.")}},[n==null?void 0:n.id,k,t]),{data:j,isLoading:E,isError:N,error:A,refetch:_,isFetching:T,hasNextPage:R,isFetchingNextPage:O,fetchNextPage:F}=Afs(S),D=j==null?void 0:j.pages[0],I=((D==null?void 0:D.isAdmin)??emr(r))&&k,P=y.useMemo(()=>{const U=new Set;return((j==null?void 0:j.pages)??[]).flatMap(ne=>ne.courses).filter(ne=>U.has(ne.id)?!1:(U.add(ne.id),!0))},[j]),M=nPe((n==null?void 0:n.id)??""),z=P$t((n==null?void 0:n.id)??""),G=!!(D!=null&&D.hasSaved);y.useEffect(()=>{p&&D&&!D.hasSaved&&g(!1)},[p,D]);const B=(D==null?void 0:D.total)??P.length,H=!!c||u!=="all"||m!=="default"||EF(v)||x.length>0,W=()=>{l(""),d(""),h("all"),f("default"),b({}),w([])};if(y.useEffect(()=>{KJe(I).some(U=>U.value===u)||h("all")},[I,u]),jN(r))return a.jsx(Gs,{to:ve.dashboard,replace:!0});const V=U=>{n!=null&&n.id?e.invalidateQueries({queryKey:["knowledge-courses",n.id]}):_()};return a.jsxs(it.div,{variants:Rfs,initial:"hidden",animate:"show",className:"space-y-6",children:[a.jsx(MIe,{items:[{label:t("Courses")}]}),a.jsxs(it.div,{variants:fC,className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:t("Courses")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:t("Explore courses and learning paths in your community.")})]}),I?a.jsxs(Z,{onClick:()=>i(!0),children:[a.jsx(Dn,{className:"mr-2 h-4 w-4"}),t("Add course")]}):null]}),!E&&!N&&(P.length>0||H||p)?a.jsxs(it.div,{variants:fC,className:"rounded-xl border bg-card p-4 shadow-sm",children:[G||p?a.jsx("div",{className:"mb-3",children:a.jsx(R$t,{savedOnly:p,onChange:g,allLabel:t("All courses")})}):null,a.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row lg:flex-wrap",children:[a.jsxs("div",{className:"relative min-w-0 flex-1 lg:min-w-[12rem]",children:[a.jsx(hs,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Oe,{value:o,onChange:U=>l(U.target.value),placeholder:t("Search title, description, or creator…"),"aria-label":t("Search courses"),className:"pl-9 pr-9"}),o?a.jsx("button",{type:"button",onClick:()=>{l(""),d("")},className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":t("Clear search"),children:a.jsx(nn,{className:"h-4 w-4"})}):null]}),a.jsx(URe,{value:v,onChange:b,className:"w-full lg:w-auto lg:max-w-[16rem] lg:shrink-0"}),n!=null&&n.id&&C?a.jsx(T$t,{communityId:n.id,value:x,onChange:w,source:C,className:"lg:w-44 lg:shrink-0"}):null,a.jsxs(zn,{value:u,onValueChange:U=>h(U),children:[a.jsx(On,{className:"w-full lg:w-40","aria-label":t("Filter courses"),children:a.jsx(Vn,{})}),a.jsx(Fn,{children:KJe(I).map(U=>a.jsx(pt,{value:U.value,children:t(U.label)},U.value))})]}),a.jsxs(zn,{value:m,onValueChange:U=>f(U),children:[a.jsx(On,{className:"w-full lg:w-40","aria-label":t("Sort courses"),children:a.jsx(Vn,{})}),a.jsx(Fn,{children:Pfs.map(U=>a.jsx(pt,{value:U.value,children:t(U.label)},U.value))})]}),H?a.jsx(Z,{type:"button",variant:"ghost",onClick:W,className:"shrink-0",children:t("Clear filters")}):null]}),a.jsxs("p",{className:"mt-3 flex items-center gap-2 text-xs text-muted-foreground",role:"status",children:[pn(t(B===1?"{count} course":"{count} courses"),{count:B}),T&&!O?a.jsx(Ne,{className:"h-3 w-3 animate-spin","aria-label":t("Updating")}):null]})]}):null,E?a.jsx(it.div,{variants:fC,children:a.jsx(_fs,{})}):N?a.jsxs(it.div,{variants:fC,className:"flex flex-col items-center justify-center rounded-xl border border-dashed border-border py-16 text-center",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:t("Could not load courses")}),a.jsx("p",{className:"mt-1 max-w-md text-sm text-muted-foreground",children:dn(A,t("Something went wrong. Please try again."))}),a.jsxs(Z,{variant:"outline",className:"mt-4",onClick:()=>_(),disabled:T,children:[T?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Nl,{className:"mr-2 h-4 w-4"}),t("Retry")]})]}):P.length===0&&H?a.jsxs(it.div,{variants:fC,className:"flex flex-col items-center rounded-xl border border-dashed bg-muted/20 py-14 text-center",children:[a.jsx(hs,{className:"mb-3 h-6 w-6 text-muted-foreground"}),a.jsx("p",{className:"font-medium",children:t("No courses found")}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:t("Try another search term or change the filter.")}),a.jsx(Z,{variant:"outline",className:"mt-4",onClick:W,children:t("Clear filters")})]}):P.length===0?a.jsxs(it.div,{variants:fC,className:"flex flex-col items-center justify-center rounded-xl border border-dashed border-border py-16 text-center",children:[a.jsx(Iu,{className:"mb-3 h-10 w-10 text-muted-foreground/60"}),a.jsx("p",{className:"text-sm font-medium text-foreground",children:t("No courses available")}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:t(I?"Create the first course for your community.":"Check back when new courses are published.")}),I?a.jsxs(Z,{className:"mt-4",onClick:()=>i(!0),children:[a.jsx(Dn,{className:"mr-2 h-4 w-4"}),t("Add course")]}):null]}):a.jsxs(it.div,{variants:fC,children:[a.jsx("div",{className:"grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:P.map(U=>a.jsx(Nfs,{course:U,isAdmin:I,onToggleLike:M,onToggleSave:z},U.id))}),a.jsx("p",{className:"mt-4 text-center text-xs text-muted-foreground",children:pn(t(B===1?"Showing {shown} of {total} course":"Showing {shown} of {total} courses"),{shown:P.length,total:B})}),a.jsx(Z5e,{hasMore:!!R,loading:O,onLoadMore:()=>void F(),label:"courses"})]}),a.jsx(Cfs,{open:s,onOpenChange:i,onCreated:V})]})}const Mfs=16/6;function Lfs({course:t,open:e,onOpenChange:n,onUpdated:r}){const{toast:s}=yt(),{community:i}=qe(),[o,l]=y.useState(t.title),[c,d]=y.useState(t.description??""),[u,h]=y.useState(""),[m,f]=y.useState(null),[p,g]=y.useState(null),[v,b]=y.useState(t.banner??null),x=y.useRef(null),[w,k]=y.useState(null),S=y.useRef(null),C=w$t(y.useCallback((D,I)=>{S.current=I.id,g(D)},[])),[j,E]=y.useState(0),[N,A]=y.useState(!1);y.useEffect(()=>{e&&(l(t.title),d(t.description??""),h(""),f(null),g(null),k(null),S.current=null,b(t.banner??null),E(0))},[e,t]),y.useEffect(()=>{if(!m)return;const D=URL.createObjectURL(m);return b(D),()=>URL.revokeObjectURL(D)},[m]);const _=()=>{x.current&&(x.current.value="")},T=D=>{f(D),g(null),k(S.current),S.current=null,_()},R=()=>{g(null),S.current=null,_()},O=D=>D.trim()?D.length>80?(h("Course title must be 80 characters or fewer"),!1):(h(""),!0):(h("Course title is required"),!1),F=async()=>{if(i!=null&&i.id&&O(o)){A(!0),E(0);try{await kAe(i.id,{title:o.trim(),description:c.trim()},t.id),m&&(E(35),await jEt(i.id,t.id,m),E(100)),s({title:"Course updated"}),n(!1),r==null||r()}catch(D){const I=D instanceof ze?Dt(D.body,D.message):"Something went wrong.";s({title:"Could not update course",description:I,variant:"destructive"})}finally{A(!1),E(0)}}};return a.jsxs(a.Fragment,{children:[a.jsx(Bt,{open:e,onOpenChange:n,children:a.jsxs(Ft,{className:"flex max-h-[min(90vh,880px)] w-[calc(100vw-2rem)] flex-col gap-0 overflow-hidden rounded-lg p-0 sm:max-w-2xl",children:[a.jsxs(Vt,{className:"shrink-0 border-b border-border px-4 pb-4 pt-6 pr-12 sm:px-6",children:[a.jsx(Ut,{children:"Edit course"}),a.jsx(_n,{children:"Update the course title, description, or banner image."})]}),a.jsxs("div",{className:"themed-scrollbar min-h-0 min-w-0 flex-1 space-y-4 overflow-y-auto overflow-x-hidden px-4 py-4 sm:px-6",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"edit-course-banner",children:"Banner"}),a.jsx("div",{className:"overflow-hidden rounded-lg border border-border bg-muted/40",children:v?a.jsx("img",{src:v,alt:"",className:"aspect-[16/6] w-full object-cover"}):a.jsx("div",{className:"flex aspect-[16/6] items-center justify-center text-xs text-muted-foreground",children:"No banner"})}),a.jsx(Oe,{ref:x,id:"edit-course-banner",type:"file",accept:"image/*",disabled:N,onChange:D=>{var I;return g(((I=D.target.files)==null?void 0:I[0])??null)}}),a.jsx(IIe,{selectedId:w,disabled:N||C.preparing,onPick:D=>void C.pick(D)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"edit-course-title",children:"Course name"}),a.jsx(Oe,{id:"edit-course-title",value:o,disabled:N,onChange:D=>{l(D.target.value),u&&O(D.target.value)}}),u?a.jsx("p",{className:"text-xs text-destructive",children:u}):null]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Course description"}),a.jsx(Du,{value:c,onChange:d,placeholder:"Describe what learners will gain from this course…",className:"min-w-0 max-w-full overflow-hidden rounded-xl",editorClassName:"break-words [overflow-wrap:anywhere]",plainTextPaste:!0,markdownBreaks:!0})]}),N&&j>0?a.jsx(ap,{value:j,className:"h-1.5"}):null]}),a.jsxs(ir,{className:"shrink-0 gap-2 border-t border-border px-4 py-4 sm:px-6",children:[a.jsx(Z,{variant:"outline",disabled:N,onClick:()=>n(!1),children:"Cancel"}),a.jsxs(Z,{disabled:N||!o.trim(),onClick:F,children:[N?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save"]})]})]})}),a.jsx(Nh,{file:p,aspect:Mfs,title:"Crop course banner",onCancel:R,onCropped:T})]})}function Dfs(t){return!t.groupType||t.groupType==="open"}function DIe({open:t,group:e,onOpenChange:n,onJoined:r,onRequested:s,courseMoved:i=!1}){const{toast:o}=yt(),l=Tn(),c=Nn(),[d,u]=y.useState(!1);if(!e)return null;const h=WB(e),m=Mu(e),f=xAe(e.groupType),p=Dfs(e),g=()=>{n(!1),c("tabs"in e?fae(e):ve.exploreGroups)},v=async()=>{if(f){g();return}u(!0);try{if(await w2t(e.id),p||m){o({title:l("Joined group"),description:pn(l("You're now in {group}. Enrolling you in the course…"),{group:e.name})}),n(!1),await r();return}o({title:l("Request sent"),description:l("An admin will review your group request. After you're accepted you can enroll in the course.")}),n(!1),s()}catch(b){if(b instanceof ze&&/already part of this group/i.test(b.message)){n(!1),await r();return}const w=b instanceof ze?Dt(b.body,b.message):l("Something went wrong.");o({title:l("Could not join group"),description:w,variant:"destructive"})}finally{u(!1)}};return a.jsx(Bt,{open:t,onOpenChange:n,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg overflow-hidden p-0 sm:max-w-[460px]",children:[a.jsxs(Vt,{className:"relative space-y-4 border-b border-border/60 bg-gradient-to-br from-primary/10 via-background to-background px-6 pb-5 pt-6 text-left",children:[a.jsx("div",{className:"flex h-11 w-11 items-center justify-center rounded-2xl bg-primary/10 text-primary ring-1 ring-primary/15",children:f?a.jsx(yK,{className:"h-5 w-5"}):a.jsx(Qn,{className:"h-5 w-5"})}),a.jsxs("div",{className:"space-y-2 pr-6",children:[a.jsx(Ut,{className:"text-xl leading-tight",children:pn(l(i?"This course moved to {group}":"Join {group} first"),{group:e.name})}),a.jsx(_n,{className:"leading-relaxed",children:pn(l(i?"This course is now part of “{group}”. Join its new group to continue accessing the course.":"This course belongs to “{group}”. Join the group before enrolling and starting the course."),{group:e.name})})]})]}),a.jsxs("div",{className:"space-y-4 px-6 py-5",children:[f?a.jsx("div",{className:"rounded-xl border border-primary/15 bg-primary/[0.04] p-4",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-lg bg-background text-primary shadow-sm ring-1 ring-border",children:a.jsx(Sh,{className:"h-4 w-4"})}),a.jsxs("div",{className:"min-w-0 space-y-1",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("p",{className:"font-medium text-foreground",children:l("Paid group access")}),a.jsx("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 text-[11px] font-medium text-primary",children:l("Membership required")})]}),a.jsx("p",{className:"text-sm leading-relaxed text-muted-foreground",children:pn(l("Explore the available plans for {group}, choose the one that suits you, and return here after purchase to begin learning."),{group:e.name})})]})]})}):null,h?a.jsx("div",{className:"rounded-xl border border-border bg-muted/40 p-4 text-sm leading-relaxed text-muted-foreground",children:l("Your request to join this group is already pending. You'll be able to enroll after an admin accepts it.")}):null,!f&&!h?a.jsx("p",{className:"text-sm leading-relaxed text-muted-foreground",children:pn(l(p?"This is a {type} group. Continue to join instantly.":"This is a {type} group. Continue to send a request to the group admins."),{type:l(CN(e.groupType)).toLowerCase()})}):null]}),a.jsxs(ir,{className:"gap-2 border-t border-border/60 bg-muted/20 px-6 py-4 sm:space-x-0",children:[a.jsx(Z,{className:"sm:min-w-24",variant:"ghost",disabled:d,onClick:()=>n(!1),children:l("Cancel")}),i?a.jsxs(Z,{className:"group sm:min-w-44",disabled:d,onClick:g,children:[l("Explore group"),a.jsx(xa,{className:"ml-2 h-4 w-4 transition-transform duration-200 group-hover:translate-x-0.5"})]}):h?null:a.jsxs(Z,{className:"group sm:min-w-44",disabled:d,onClick:()=>void v(),children:[d?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):null,l(f?"Explore group":p?"Join group":"Request to join group"),f?a.jsx(xa,{className:"ml-2 h-4 w-4 transition-transform duration-200 group-hover:translate-x-0.5"}):null]})]})]})})}function n4(t){const e=n=>String(n).padStart(2,"0");return`${t.getFullYear()}-${e(t.getMonth()+1)}-${e(t.getDate())}T${e(t.getHours())}:${e(t.getMinutes())}`}function $Ie({open:t,onOpenChange:e,courseId:n,deliveryMode:r,section:s,onSaved:i}){const{toast:o}=yt(),{community:l}=qe(),c=!!s,[d,u]=y.useState((s==null?void 0:s.name)??""),[h,m]=y.useState((s==null?void 0:s.emoji)??"📚"),[f,p]=y.useState((s==null?void 0:s.unlockAfterDays)??0),[g,v]=y.useState(s!=null&&s.releaseAt?n4(new Date(s.releaseAt)):""),[b,x]=y.useState(()=>n4(new Date)),[w,k]=y.useState(!1),[S,C]=y.useState(!1);y.useEffect(()=>{if(!t||(u((s==null?void 0:s.name)??""),m((s==null?void 0:s.emoji)??"📚"),p((s==null?void 0:s.unlockAfterDays)??0),v(s!=null&&s.releaseAt?n4(new Date(s.releaseAt)):""),x(n4(new Date)),r!=="scheduled"))return;const E=window.setInterval(()=>{x(n4(new Date))},3e4);return()=>window.clearInterval(E)},[t,s,r]);const j=async()=>{var E;if(l!=null&&l.id){if(!d.trim()){o({title:"Section name required",variant:"destructive"});return}if(r==="scheduled"&&!g){o({title:"Release date required",variant:"destructive"});return}if(r==="scheduled"){const N=new Date(g).getTime(),A=s!=null&&s.releaseAt?new Date(s.releaseAt).getTime():null,_=A!=null&&Math.abs(N-A)<6e4;if(N<Date.now()&&!_){o({title:"Pick a future date and time",description:"A scheduled section cannot be released in the past.",variant:"destructive"});return}}k(!0);try{const N=await bmr(l.id,n,{name:d.trim(),emoji:h.trim()||"📚",unlockAfterDays:r==="structured"?Math.max(0,f):0,...r==="scheduled"?{releaseAt:new Date(g).toISOString()}:{}},s==null?void 0:s.id);if(!N.section)throw new Error("No section returned");const A={id:N.section.id,name:((E=N.section.name)==null?void 0:E.trim())||d.trim(),emoji:N.section.emoji??h,index:N.section.index??(s==null?void 0:s.index)??0,lessons:(s==null?void 0:s.lessons)??[],unlockAfterDays:N.section.unlockAfterDays??0,releaseAt:N.section.releaseAt??null,unlockAt:(s==null?void 0:s.unlockAt)??null,isLocked:(s==null?void 0:s.isLocked)??!1};i(A),e(!1),o({title:c?"Section updated":"Section added"})}catch(N){const A=N instanceof ze?Dt(N.body,N.message):"Something went wrong.";o({title:"Could not save section",description:A,variant:"destructive"})}finally{k(!1)}}};return a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg sm:max-w-md",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:c?"Edit section":"Add section"}),a.jsx(_n,{children:"Organize lessons into sections."})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"section-emoji",children:"Emoji"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(Ni,{open:S,onOpenChange:C,children:[a.jsx(Ti,{asChild:!0,children:a.jsx("button",{type:"button",disabled:w,"aria-label":"Choose an emoji",className:"flex h-10 w-12 shrink-0 items-center justify-center rounded-md border border-input bg-background text-lg hover:bg-muted disabled:opacity-50",children:h||"📚"})}),a.jsx(yi,{align:"start",collisionPadding:8,className:"themed-scrollbar z-[100] max-h-[var(--radix-popover-content-available-height)] w-auto overflow-y-auto p-0",onWheel:E=>E.stopPropagation(),children:a.jsx($g,{onPick:E=>{m(E),C(!1)}})})]}),a.jsx(Oe,{id:"section-emoji",value:h,maxLength:4,disabled:w,placeholder:"📚",onChange:E=>m(E.target.value)})]})]}),r==="structured"?a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"section-delay",children:"Release after enrollment"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Oe,{id:"section-delay",type:"number",min:0,value:f,disabled:w,onChange:E=>p(Math.max(0,Number(E.target.value)||0))}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"days"})]})]}):null,r==="scheduled"?a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"section-release",children:"Release date and time"}),a.jsx(Oe,{id:"section-release",type:"datetime-local",min:b,value:g,disabled:w,onChange:E=>v(E.target.value)})]}):null,a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"section-name",children:"Section name"}),a.jsx(Oe,{id:"section-name",value:d,disabled:w,placeholder:"Getting started",onChange:E=>u(E.target.value)})]})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"outline",disabled:w,onClick:()=>e(!1),children:"Cancel"}),a.jsxs(Z,{disabled:w||!d.trim(),onClick:j,children:[w?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):null,c?"Save":"Add"]})]})]})})}function I$t({courseId:t,section:e,isAdmin:n,deliveryMode:r,onSectionChange:s,onSectionDelete:i,onLessonDeleted:o}){const{toast:l}=yt(),c=Tn(),{community:d}=qe(),[u,h]=y.useState(!0),[m,f]=y.useState(!1),[p,g]=y.useState(!1),[v,b]=y.useState(!1),[x,w]=y.useState(null),[k,S]=y.useState(!1),[C,j]=y.useState(null),[E,N]=y.useState(!1),[A,_]=y.useState(null),T=e.isLocked&&e.unlockAt?pn(c("Unlocks {date}"),{date:new Date(e.unlockAt).toLocaleString()}):r==="structured"&&e.unlockAfterDays>0?pn(e.unlockAfterDays===1?c("{count} day after enrollment"):c("{count} days after enrollment"),{count:e.unlockAfterDays}):r==="scheduled"&&e.releaseAt?pn(c("Releases {date}"),{date:new Date(e.releaseAt).toLocaleString()}):null,R=n?e.lessons:e.lessons.filter(M=>M.state==="published"),O=lk(R.reduce((M,z)=>M+PZ(z),0)),F=async()=>{if(d!=null&&d.id){b(!0);try{await xmr(d.id,t,e.id),i(e.id),l({title:c("Section deleted")}),g(!1)}catch(M){const z=M instanceof ze?Dt(M.body,M.message):c("Something went wrong.");l({title:c("Could not delete section"),description:z,variant:"destructive"})}finally{b(!1)}}},D=async()=>{var M,z,G;if(!(!(d!=null&&d.id)||!(x!=null&&x.title.trim()))){S(!0);try{const B=await dq(d.id,t,e.id,{title:x.title.trim(),durationMinutes:j$(x.minutes),index:x.lessonId?((M=e.lessons.find(V=>V.id===x.lessonId))==null?void 0:M.index)??100:(((z=e.lessons.at(-1))==null?void 0:z.index)??0)+1},x.lessonId);if(!B.lesson)throw new Error("No lesson returned");const H={id:B.lesson.id,title:((G=B.lesson.title)==null?void 0:G.trim())||x.title.trim(),state:B.lesson.state==="draft"?"draft":"published",index:B.lesson.index??0,isCompleted:!!B.lesson.isCompleted,isLocked:!1,commentsEnabled:B.lesson.commentsEnabled!==!1,durationMinutes:B.lesson.durationMinutes??j$(x.minutes),sectionId:e.id};H.autoDurationMinutes=B.lesson.autoDurationMinutes??0;const W=x.lessonId?e.lessons.map(V=>V.id===H.id?{...V,...H}:V):[...e.lessons,H];s({...e,lessons:W}),w(null),l({title:x.lessonId?c("Lesson updated"):c("Lesson added")})}catch(B){const H=B instanceof ze?Dt(B.body,B.message):c("Something went wrong.");l({title:c("Could not save lesson"),description:H,variant:"destructive"})}finally{S(!1)}}},I=async()=>{if(!(!(d!=null&&d.id)||!C)){N(!0);try{await wmr(d.id,t,e.id,C.id),s({...e,lessons:e.lessons.filter(M=>M.id!==C.id)}),o==null||o(C.id),l({title:c("Lesson deleted")}),j(null)}catch(M){const z=M instanceof ze?Dt(M.body,M.message):c("Something went wrong.");l({title:c("Could not delete lesson"),description:z,variant:"destructive"})}finally{N(!1)}}},P=async M=>{var z;if(d!=null&&d.id){_(M.id);try{const G=await kmr(d.id,t,e.id,M.id);if(!G.lesson)throw new Error("No lesson returned");const B={id:G.lesson.id,title:((z=G.lesson.title)==null?void 0:z.trim())||`Copy of ${M.title}`,state:"draft",index:G.lesson.index??M.index+1,isCompleted:!1,isLocked:!1,commentsEnabled:G.lesson.commentsEnabled!==!1,sectionId:e.id,description:G.lesson.description,coverMedia:G.lesson.coverMedia??null,blocks:G.lesson.blocks??[]};s({...e,lessons:[...e.lessons,B]}),l({title:c("Lesson duplicated as draft")})}catch(G){const B=G instanceof ze?Dt(G.body,G.message):c("Something went wrong.");l({title:c("Could not duplicate lesson"),description:B,variant:"destructive"})}finally{_(null)}}};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"w-full min-w-0 overflow-hidden rounded-lg border border-border bg-card",children:[a.jsxs("div",{className:"flex min-w-0 items-center justify-between gap-2 px-3 py-2",children:[a.jsxs("button",{type:"button",className:"flex min-w-0 flex-1 items-center gap-2 text-left",onClick:()=>h(M=>!M),children:[u?a.jsx(li,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):a.jsx(io,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),a.jsx("span",{className:"shrink-0 text-base",children:e.emoji}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block whitespace-normal text-sm font-semibold leading-snug text-foreground [overflow-wrap:anywhere]",children:e.name}),a.jsxs("span",{className:"mt-0.5 flex flex-wrap items-center gap-x-1.5 gap-y-0.5 text-xs font-normal text-muted-foreground",children:[a.jsx("span",{children:pn(R.length===1?c("{count} lesson"):c("{count} lessons"),{count:R.length})}),a.jsx("span",{"aria-hidden":!0,children:"·"}),a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(ja,{className:"h-3.5 w-3.5"}),a.jsx("span",{title:c("Total time for this section"),children:O})]}),T?a.jsxs(a.Fragment,{children:[a.jsx("span",{"aria-hidden":!0,children:"·"}),a.jsx("span",{children:T})]}):null]})]})]}),n?a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[a.jsx(ot,{onClick:()=>f(!0),children:c("Edit section")}),a.jsx(ot,{className:"text-destructive",onClick:()=>g(!0),children:c("Delete section")})]})]}):null]}),u?a.jsxs("div",{className:"min-w-0 space-y-1 border-t border-border px-2 py-2",children:[R.length===0&&!n?a.jsx("p",{className:"px-2 py-3 text-xs text-muted-foreground",children:c("Lessons will appear here once added.")}):null,R.map(M=>(x==null?void 0:x.lessonId)===M.id?a.jsx(YJe,{value:x.title,saving:k,minutes:x.minutes,onChange:z=>w({...x,lessonId:M.id,title:z}),onMinutesChange:z=>w({...x,minutes:z}),onCancel:()=>w(null),onSave:D,submitLabel:c("Update")},M.id):a.jsxs("div",{className:"group flex min-w-0 items-center gap-2 rounded-md px-2 py-1.5 hover:bg-muted/60",children:[a.jsx($fs,{isAdmin:n,lesson:M}),M.isLocked&&!n?a.jsx("span",{className:"min-w-0 flex-1 whitespace-normal text-sm leading-snug text-muted-foreground [overflow-wrap:anywhere]",title:M.lockedReason==="drip"?c("Not released yet"):c("Complete the previous lesson first"),children:M.title}):a.jsx(vr,{to:ve.knowledgeLearn(t,e.id,M.id),className:"min-w-0 flex-1 whitespace-normal text-sm leading-snug text-foreground [overflow-wrap:anywhere] hover:text-primary",children:M.title}),a.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 text-xs text-muted-foreground",title:c("Time to complete"),children:[a.jsx(ja,{className:"h-3.5 w-3.5"}),lk(PZ(M))]}),n?a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 opacity-70 transition-opacity hover:opacity-100","aria-label":pn(c("Actions for {title}"),{title:M.title}),children:A===M.id?a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[a.jsx(ot,{onClick:()=>w({lessonId:M.id,title:M.title,minutes:M.durationMinutes?String(M.durationMinutes):""}),children:c("Edit lesson")}),a.jsx(ot,{disabled:A===M.id,onClick:()=>void P(M),children:c("Duplicate lesson")}),a.jsx(ot,{className:"text-destructive",onClick:()=>j(M),children:c("Delete lesson")})]})]}):null]},M.id)),n?x&&!x.lessonId?a.jsx(YJe,{value:x.title,saving:k,minutes:x.minutes,onChange:M=>w({...x,title:M}),onMinutesChange:M=>w({...x,minutes:M}),onCancel:()=>w(null),onSave:D,submitLabel:c("Add")}):a.jsxs("button",{type:"button",className:"flex w-full items-center gap-2 rounded-md border border-dashed border-border px-2 py-2 text-xs text-muted-foreground hover:bg-muted/40",onClick:()=>w({title:"",minutes:""}),children:[a.jsx(Dn,{className:"h-3.5 w-3.5"}),c("Add lesson")]}):null]}):null]}),a.jsx($Ie,{open:m,onOpenChange:f,courseId:t,deliveryMode:r,section:e,onSaved:M=>s({...M,lessons:e.lessons})}),a.jsx(Kr,{open:p,onOpenChange:g,children:a.jsxs(Or,{className:"w-[calc(100vw-2rem)] rounded-lg",children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:c("Delete section?")}),a.jsx(zr,{children:pn(c('This removes "{name}" and all lessons inside it.'),{name:e.name})})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:c("Cancel")}),a.jsx(Yr,{onClick:F,disabled:v,children:v?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):c("Delete")})]})]})}),a.jsx(Kr,{open:!!C,onOpenChange:M=>!M&&j(null),children:a.jsxs(Or,{className:"w-[calc(100vw-2rem)] rounded-lg",children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:c("Delete lesson?")}),a.jsx(zr,{children:pn(c('This removes "{title}" permanently.'),{title:(C==null?void 0:C.title)??""})})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:c("Cancel")}),a.jsx(Yr,{onClick:I,disabled:E,children:E?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):c("Delete")})]})]})})]})}function $fs({isAdmin:t,lesson:e}){return t?e.state==="published"?a.jsx(Prt,{className:"h-4 w-4 shrink-0 text-primary"}):a.jsx(Ag,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):e.isLocked?a.jsx(wa,{className:"h-4 w-4 shrink-0 text-muted-foreground"}):e.isCompleted?a.jsx(yo,{className:"h-4 w-4 shrink-0 text-emerald-600"}):a.jsx(Ag,{className:"h-4 w-4 shrink-0 text-muted-foreground"})}function YJe({value:t,minutes:e,saving:n,onChange:r,onMinutesChange:s,onCancel:i,onSave:o,submitLabel:l}){const c=Tn();return a.jsxs("div",{className:"flex flex-wrap items-center gap-2 px-2 py-1",children:[a.jsx(Oe,{value:t,placeholder:c("Lesson title"),disabled:n,className:"min-w-[10rem] flex-1",onChange:d=>r(d.target.value),onKeyDown:d=>{d.key==="Enter"&&o(),d.key==="Escape"&&i()}}),a.jsxs("div",{className:"relative w-28 shrink-0",children:[a.jsx(ja,{className:"pointer-events-none absolute left-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Oe,{type:"number",inputMode:"numeric",min:0,max:rse,value:e,placeholder:c("Minutes"),"aria-label":c("Time to complete, in minutes"),title:c("How long this lesson takes, in minutes"),disabled:n,className:"pl-8",onChange:d=>s(d.target.value),onKeyDown:d=>{d.key==="Enter"&&o(),d.key==="Escape"&&i()}})]}),a.jsx(Z,{size:"sm",disabled:n||!t.trim(),onClick:o,children:n?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):l}),a.jsx(Z,{size:"sm",variant:"ghost",disabled:n,onClick:i,children:c("Cancel")})]})}function QJe({course:t,onCourseChange:e}){const n=Tn(),[r,s]=y.useState(!1),i=t.isAdmin,o=!i&&t.state==="closed-free"&&t.joinStatus!=="joined",l=u=>{e({...t,sections:t.sections.map(h=>h.id===u.id?u:h)})},c=u=>{e({...t,sections:t.sections.filter(h=>h.id!==u)})},d=u=>{e({...t,sections:[...t.sections,u]})};return o?a.jsxs(vI,{className:"mt-4",children:[a.jsx(t7,{children:n("Not enrolled")}),a.jsx(yI,{children:n("Course content unlocks once you are enrolled. Request access or purchase membership if required.")})]}):a.jsxs("div",{className:"space-y-4 pt-2",children:[i?a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>s(!0),children:[a.jsx(Dn,{className:"mr-2 h-4 w-4"}),n("Add section")]}):null,t.sections.length===0?a.jsxs("div",{className:"rounded-lg border border-dashed border-border py-12 text-center",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:n("No content yet")}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:n(i?"Add a section to start building this course.":"Content will be available when the course starts.")})]}):t.sections.map(u=>a.jsx(I$t,{courseId:t.id,section:u,isAdmin:i,deliveryMode:t.deliveryMode,onSectionChange:l,onSectionDelete:c},u.id)),a.jsx($Ie,{open:r,onOpenChange:s,courseId:t.id,deliveryMode:t.deliveryMode,onSaved:d})]})}function Ofs(t,e,n=1,r=10){const{community:s}=qe(),i=s==null?void 0:s.id;return lt({queryKey:["knowledge-course-members",i,t,n,r],queryFn:async()=>{const o=await EEt(i,t,n,r);return Zmr(o)},enabled:!!(i&&t&&e),staleTime:3e4})}function ZJe(t){var n;const e=(n=t==null?void 0:t.name)==null?void 0:n.trim();switch(t==null?void 0:t.source){case"subscription":return{label:e?`Paid · ${e}`:"Paid",tone:"paid",since:t.since??null};case"payment":return{label:"Paid",tone:"paid",since:null};case"access-group":return{label:e?`Pass · ${e}`:"Pass",tone:"pass",since:null};default:return{label:"Free access",tone:"free",since:null}}}const Ffs={paid:"border-violet-500/30 bg-violet-500/10 text-violet-600",pass:"border-sky-500/30 bg-sky-500/10 text-sky-600",free:"border-border bg-muted/40 text-muted-foreground"};function RH(t){if(!t)return"—";const e=new Date(t);return Number.isNaN(e.getTime())?"—":e.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})}function Bfs({course:t}){const{toast:e}=yt(),{community:n}=qe(),[r,s]=y.useState(1),[i,o]=y.useState(null),[l,c]=y.useState(!1),d=t.isAdmin&&t.state!=="draft",{data:u,isLoading:h,refetch:m}=Ofs(t.id,d,r,10);if(t.state==="draft")return a.jsxs(vI,{className:"mt-4",children:[a.jsx(t7,{children:"Course is in draft"}),a.jsx(yI,{children:"Members can join once the course is published."})]});const f=(u==null?void 0:u.members)??[],p=(u==null?void 0:u.total)??0,g=Math.max(1,Math.ceil(p/10)),v=async w=>{if(n!=null&&n.id){o(w);try{await gmr(n.id,t.id,w),e({title:"Member accepted"}),await m()}catch(k){const S=k instanceof ze?Dt(k.body,k.message):"Something went wrong.";e({title:"Could not accept member",description:S,variant:"destructive"})}finally{o(null)}}},b=async w=>{if(n!=null&&n.id){o(w);try{await ymr(n.id,t.id,w),e({title:"Member removed"}),await m()}catch(k){const S=k instanceof ze?Dt(k.body,k.message):"Something went wrong.";e({title:"Could not remove member",description:S,variant:"destructive"})}finally{o(null)}}},x=async()=>{if(n!=null&&n.id){c(!0);try{const k=(await EEt(n.id,t.id,1,Math.max(p,1e3))).members??[],S=N=>`"${String(N??"").replace(/"/g,'""')}"`,C=[["Name","Email","Status","Access","Bought on","Completed lessons","Total lessons","Progress","Joined at"],...k.map(N=>{var A;return[N.name,N.email,N.courseStatus,ZJe(N.access).label,(A=N.access)!=null&&A.since?RH(N.access.since):"",N.completedLessons??0,N.totalLessons??0,`${N.progressPercent??0}%`,RH(N.joinedAt)]})].map(N=>N.map(S).join(",")).join(`
`),j=URL.createObjectURL(new Blob([C],{type:"text/csv;charset=utf-8"})),E=document.createElement("a");E.href=j,E.download=`${t.title.replace(/[^a-z0-9]+/gi,"-").toLowerCase()}-progress.csv`,E.click(),URL.revokeObjectURL(j),e({title:"Progress report downloaded"})}catch(w){const k=w instanceof ze?Dt(w.body,w.message):"Something went wrong.";e({title:"Could not export progress",description:k,variant:"destructive"})}finally{c(!1)}}};return a.jsxs("div",{className:"mt-4 rounded-lg border border-border bg-card overflow-hidden",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-border px-4 py-3",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Learner progress"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Completion is calculated from published lessons."})]}),a.jsxs(Z,{variant:"outline",size:"sm",disabled:l||p===0,onClick:()=>void x(),children:[l?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(bc,{className:"mr-2 h-4 w-4"}),"Export CSV"]})]}),a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"border-b border-border bg-muted/40",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3 text-left font-medium text-muted-foreground",children:"Name"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium text-muted-foreground",children:"Status"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium text-muted-foreground",children:"Access"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium text-muted-foreground",children:"Enrolled"}),a.jsx("th",{className:"px-4 py-3 text-left font-medium text-muted-foreground",children:"Progress"}),a.jsx("th",{className:"px-4 py-3 text-right font-medium text-muted-foreground",children:"Actions"})]})}),a.jsx("tbody",{children:h?a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"px-4 py-10 text-center text-muted-foreground",children:a.jsx(Ne,{className:"mx-auto h-5 w-5 animate-spin"})})}):f.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:6,className:"px-4 py-10 text-center text-muted-foreground",children:"No members have joined this course yet."})}):f.map(w=>a.jsxs("tr",{className:"border-b border-border last:border-0",children:[a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("p",{className:"font-medium text-foreground",children:w.name}),w.email?a.jsx("p",{className:"text-xs text-muted-foreground",children:w.email}):null]}),a.jsx("td",{className:"px-4 py-3 capitalize text-muted-foreground",children:w.courseStatus==="requested"?"Requested":"Joined"}),a.jsx("td",{className:"px-4 py-3",children:(()=>{const k=ZJe(w.access);return a.jsxs(a.Fragment,{children:[a.jsx("span",{className:`inline-flex whitespace-nowrap rounded-full border px-2 py-0.5 text-xs font-medium ${Ffs[k.tone]}`,children:k.label}),k.since?a.jsxs("p",{className:"mt-1 whitespace-nowrap text-xs text-muted-foreground",children:["Bought ",RH(k.since)]}):null]})})()}),a.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-muted-foreground",children:w.courseStatus==="joined"?RH(w.joinedAt):"—"}),a.jsx("td",{className:"min-w-44 px-4 py-3",children:w.courseStatus==="joined"?a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ap,{value:w.progressPercent,className:"h-2 w-24"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:[w.completedLessons,"/",w.totalLessons," (",w.progressPercent,"%)"]})]}):a.jsx("span",{className:"text-xs text-muted-foreground",children:"Not started"})}),a.jsx("td",{className:"px-4 py-3 text-right",children:i===w.id?a.jsx(Ne,{className:"ml-auto h-4 w-4 animate-spin"}):w.courseStatus==="requested"?a.jsxs("div",{className:"flex justify-end gap-1",children:[a.jsx(Z,{size:"icon",variant:"outline",className:"h-8 w-8 text-destructive",onClick:()=>b(w.id),children:a.jsx(nn,{className:"h-4 w-4"})}),a.jsx(Z,{size:"icon",className:"h-8 w-8",onClick:()=>v(w.id),children:a.jsx(Qn,{className:"h-4 w-4"})})]}):a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsx(Cr,{align:"end",children:a.jsx(ot,{className:"text-destructive",onClick:()=>b(w.id),children:"Remove member"})})]})})]},w.id))})]})}),g>1?a.jsxs("div",{className:"flex items-center justify-between border-t border-border px-4 py-3",children:[a.jsx(Z,{variant:"outline",size:"sm",disabled:r<=1,onClick:()=>s(w=>w-1),children:"Previous"}),a.jsxs("span",{className:"text-xs text-muted-foreground",children:["Page ",r," of ",g]}),a.jsx(Z,{variant:"outline",size:"sm",disabled:r>=g,onClick:()=>s(w=>w+1),children:"Next"})]}):null]})}function Ufs(t,e,n=1,r=10){const{community:s}=qe(),i=s==null?void 0:s.id;return lt({queryKey:["knowledge-course-comments",i,t,n,r],queryFn:()=>Amr(i,t,n,r),enabled:!!(i&&t&&e),staleTime:15e3})}function zfs(t,e,n=1,r=10,s=""){const{community:i}=qe(),o=i==null?void 0:i.id;return lt({queryKey:["knowledge-course-quiz-results",o,t,n,r,s],queryFn:()=>Pmr(o,t,n,r,s),enabled:!!(o&&t&&e),staleTime:15e3})}const M$t=t=>t;function Vfs(t,e=M$t){var n;return t&&typeof t=="object"?{id:String(t._id??t.id??""),name:((n=t.name)==null?void 0:n.trim())||e("Member"),picture:t.picture??null}:{id:typeof t=="string"?t:"",name:e("Member"),picture:null}}function L$t(t,e=M$t){if(!t)return"—";const n=new Date(t);if(Number.isNaN(n.getTime()))return"—";const r=n.toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"}),s=n.toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!0});return pn(e("{day} at {time}"),{day:r,time:s})}function Hfs(t){if(!t)return"";const e=new Date(t);return Number.isNaN(e.getTime())?"":e.toLocaleDateString("en-US",{month:"numeric",day:"numeric",year:"numeric"})}function OIe({name:t,picture:e,className:n}){const r=(t.trim()[0]||"?").toUpperCase();return a.jsxs(oo,{className:ee("h-9 w-9",n),children:[e&&RE(e)?a.jsx(lo,{src:e,alt:t}):null,a.jsx(co,{className:"bg-violet-600 text-sm font-semibold text-white",children:r})]})}const IH=10;function Gfs({course:t}){const e=Tn(),[n,r]=y.useState(1),{data:s,isLoading:i}=Ufs(t.id,t.isAdmin,n,IH),o=(s==null?void 0:s.comments)??[],l=(s==null?void 0:s.total)??0,c=Math.max(1,Math.ceil(l/IH)),d=l===0?0:(n-1)*IH+1,u=Math.min(n*IH,l),h=y.useMemo(()=>Wfs(o,e),[o,e]);return a.jsxs("div",{className:"mt-4 space-y-5",children:[a.jsx("h2",{className:"text-sm font-semibold text-foreground",children:pn(e(l===1?"{count} comment":"{count} comments"),{count:l})}),i?a.jsx("div",{className:"flex justify-center py-12 text-muted-foreground",children:a.jsx(Ne,{className:"h-5 w-5 animate-spin"})}):o.length===0?a.jsx("p",{className:"rounded-lg border border-dashed border-border px-4 py-10 text-center text-sm text-muted-foreground",children:e("No comments on this course yet.")}):a.jsx("div",{className:"space-y-8",children:h.map(m=>a.jsxs("section",{children:[a.jsx("h3",{className:"mb-3 text-sm font-semibold text-foreground",children:m.lessonTitle}),a.jsx("ul",{className:"space-y-4",children:m.comments.map(f=>{var g;const p=Vfs(f.user,e);return a.jsxs("li",{className:"flex gap-3",children:[a.jsx(OIe,{name:p.name,picture:p.picture}),a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex flex-wrap items-baseline gap-2",children:[a.jsx("span",{className:"text-sm font-semibold text-foreground",children:p.name}),a.jsx("span",{className:"text-xs text-muted-foreground",children:Hfs(f.createdAt)})]}),a.jsx("p",{className:"mt-0.5 whitespace-pre-wrap text-sm text-foreground/90",children:((g=f.description)==null?void 0:g.trim())||"—"})]})]},f.id)})})]},m.lessonTitle))}),a.jsxs("div",{className:"flex items-center justify-between border-t border-border pt-3 text-xs text-muted-foreground",children:[a.jsx("p",{children:pn(e("Showing {from}-{to} of {total} comments"),{from:d,to:u,total:l})}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx(Z,{variant:"outline",size:"icon",className:"h-8 w-8",disabled:n<=1,onClick:()=>r(m=>m-1),children:a.jsx(nl,{className:"h-4 w-4"})}),a.jsx(Z,{variant:"outline",size:"icon",className:"h-8 w-8",disabled:n>=c||l===0,onClick:()=>r(m=>m+1),children:a.jsx(io,{className:"h-4 w-4"})})]})]})]})}function Wfs(t,e){var r;const n=[];for(const s of t){const i=((r=s.lessonTitle)==null?void 0:r.trim())||e("Lesson"),o=n[n.length-1];(o==null?void 0:o.lessonTitle)===i?o.comments.push(s):n.push({lessonTitle:i,comments:[s]})}return n}const _he=/^[\w-]{11}$/,qfs=new Set(["www.youtube.com","youtube.com","www.youtube-nocookie.com","youtube-nocookie.com","player.vimeo.com"]);function D$t(t){const e=t.trim();if(!e)return null;try{return new URL(e)}catch{try{return new URL(`https://${e}`)}catch{return null}}}function Kfs(t){var i,o;const e=t.hostname.replace(/^www\./,"").toLowerCase();if(!(e==="youtu.be"||e==="youtube.com"||e==="m.youtube.com"||e==="music.youtube.com"||e==="youtube-nocookie.com"))return null;if(e==="youtu.be"){const l=(i=t.pathname.split("/").filter(Boolean)[0])==null?void 0:i.slice(0,11);return l&&_he.test(l)?l:null}const r=t.searchParams.get("v");if(r&&_he.test(r))return r;const s=t.pathname.split("/").filter(Boolean);if(s[0]&&["embed","shorts","live","v"].includes(s[0])){const l=(o=s[1])==null?void 0:o.slice(0,11);return l&&_he.test(l)?l:null}return null}function Yfs(t){const e=t.searchParams.get("start")??t.searchParams.get("t");if(!e)return null;if(/^\d+$/.test(e))return Number(e);const n=e.match(/^(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?$/i);if(!n)return null;const r=Number(n[1]??0),s=Number(n[2]??0),i=Number(n[3]??0),o=r*3600+s*60+i;return o>0?o:null}function Qfs(t){const e=t.hostname.replace(/^www\./,"").toLowerCase();if(e!=="vimeo.com"&&e!=="player.vimeo.com")return null;const n=t.pathname.split("/").filter(Boolean),r=n[0]==="video"?n[1]:n[0];return r&&/^\d+$/.test(r)?r:null}function $N(t){const e=D$t(t);if(!e)return t.trim();const n=Kfs(e);if(n){const s=new URL(`https://www.youtube.com/embed/${n}`),i=Yfs(e);return i&&s.searchParams.set("start",String(i)),s.toString()}const r=Qfs(e);return r?`https://player.vimeo.com/video/${r}`:e.toString()}function $9(t){const e=D$t(t);return e?qfs.has(e.hostname.toLowerCase()):!1}const Zfs=new Set(["attachment","pdf","audio","embed","quiz","question","assignment"]);function Jfs(t){const e=(t.type||"").toLowerCase();if(e==="text")return{kind:"text",html:typeof t.content=="string"?t.content:""};if(Zfs.has(e)){const n=Xfs(t.content);if(n&&typeof n=="object"&&!Array.isArray(n))return{kind:e,...n}}return{kind:"unknown",raw:{type:t.type,content:$$t(t.content)}}}function Xfs(t){if(t&&typeof t=="object")return t;if(typeof t!="string"||!t.trim())return null;try{return JSON.parse(t)}catch{return null}}function $$t(t){if(typeof t=="string")return t;if(t==null)return"";try{return JSON.stringify(t)}catch{return""}}function eps(t){if(t.kind==="text")return{type:"text",content:t.html};if(t.kind==="unknown")return{type:t.raw.type,content:$$t(t.raw.content)};const{kind:e,...n}=t;return e==="embed"&&"url"in n&&typeof n.url=="string"&&(n.url=$N(n.url)),{type:e,content:JSON.stringify(n)}}function ON(t){return(t??[]).map(Jfs)}function O$t(t){return t.map(eps).filter(e=>e.type&&e.content)}function tps(t){for(const e of ON(t))if(!(e.kind!=="embed"||!e.url.trim())&&$9($N(e.url)))return e;return null}function nps(t){let e=!1;return ON(t).filter(n=>!e&&n.kind==="embed"&&n.url.trim()&&$9($N(n.url))?(e=!0,!1):!0)}const mj={text:"Text",attachment:"Attachment",pdf:"PDF",audio:"Audio",embed:"Embed",quiz:"Quiz",question:"Question",assignment:"Assignment"};function h2(t){const e=new Set,n=Array.isArray(t)?t:[];for(const r of n){const s=Number(r);Number.isInteger(s)&&s>=0&&e.add(s)}return[...e].sort((r,s)=>r-s)}function F$t(t){return t==="multiple"}function B$t(t,e){return F$t(e)&&Array.isArray(t.answerIndexes)&&t.answerIndexes.length>0?h2(t.answerIndexes):Number.isInteger(t.answerIndex)&&(t.answerIndex??-1)>=0?[t.answerIndex]:h2(t.answerIndexes)}function JJe(t="single"){return t==="multiple"?{prompt:"",options:["",""],answerIndexes:[]}:{prompt:"",options:["",""],answerIndex:0}}function U$t(t,e){return t.map(n=>{const r=B$t(n,e);return e==="multiple"?{...n,answerIndex:void 0,answerIndexes:r}:{...n,answerIndex:r[0]??0,answerIndexes:void 0}})}function rps(t,e){if(!t.prompt.trim())return!1;const n=t.options??[];if(n.length<2||n.some(s=>!String(s).trim()))return!1;const r=B$t(t,e).filter(s=>s>=0&&s<n.length);return e==="single"?r.length===1:r.length>=1}function sps(t){return{status:t.passed?"passed":"didn't pass",encouragement:t.passed?"Great job!":"Review the answers below, then try again.",score:`${t.scorePercent}%`,accuracy:`${t.correctCount}/${t.totalGradable}`}}function z$t(t){return Array.isArray(t.selectedIndexes)&&t.selectedIndexes.length>0?h2(t.selectedIndexes):Number.isInteger(t.selectedIndex)&&(t.selectedIndex??-1)>=0?[t.selectedIndex]:[]}function ips({open:t,onOpenChange:e,result:n,loading:r}){var l,c;const s=Tn(),i=(n==null?void 0:n.questions)??[],o=((l=n==null?void 0:n.user)==null?void 0:l.name)||s("Member");return a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"flex max-h-[85vh] w-[calc(100vw-2rem)] max-w-4xl rounded-lg flex-col gap-0 overflow-hidden p-0 sm:max-w-4xl",children:[a.jsxs(Vt,{className:"border-b border-border px-5 py-4",children:[a.jsx(Ut,{children:s("Quiz result")}),a.jsx(_n,{className:"sr-only",children:s("Question-by-question review of this learner's quiz attempt.")})]}),r||!n?a.jsx("div",{className:"flex min-h-[320px] items-center justify-center text-muted-foreground",children:a.jsx(Ne,{className:"h-6 w-6 animate-spin"})}):a.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-1 md:grid-cols-[minmax(0,1.6fr)_16rem]",children:[a.jsx("div",{className:"min-h-0 space-y-4 overflow-y-auto p-5",children:i.map((d,u)=>a.jsx(aps,{question:d},u))}),a.jsxs("aside",{className:"flex flex-col border-t border-border bg-muted/20 p-5 md:border-l md:border-t-0",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"font-semibold text-foreground",children:o}),a.jsx("p",{className:"text-xs text-muted-foreground",children:pn(s("Attempts: {count}"),{count:n.attemptCount??1})})]}),a.jsx(OIe,{name:o,picture:(c=n.user)==null?void 0:c.picture})]}),a.jsxs("div",{className:"mt-6",children:[a.jsx("p",{className:"font-semibold text-foreground",children:n.title||s("Quiz")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:n.lessonTitle})]}),a.jsxs("div",{className:"mt-6",children:[a.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:s("Submitted")}),a.jsx("p",{className:"mt-1 text-sm text-foreground",children:L$t(n.submittedAt)})]}),a.jsxs("div",{className:"mt-auto grid grid-cols-2 gap-4 pt-8",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:s("Score")}),a.jsxs("p",{className:"text-2xl font-semibold text-foreground",children:[n.scorePercent,"%"]})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:s("Correct")}),a.jsxs("p",{className:"text-2xl font-semibold text-foreground",children:[n.correctCount,"/",n.totalGradable]})]})]})]})]})]})})}function aps({question:t}){var i;const e=Tn(),n=t.isCorrect,r=new Set(z$t(t)),s=(((i=t.options)==null?void 0:i.length)??0)>0;return a.jsxs("article",{className:"animate-in fade-in-0 slide-in-from-bottom-1 rounded-xl border border-border bg-card p-4 duration-300",children:[a.jsx("p",{className:"font-semibold text-foreground",children:t.prompt}),n!=null?a.jsxs("div",{className:`mt-3 flex items-center gap-2 rounded-md px-3 py-2 text-sm font-medium ${n?"bg-emerald-50 text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-400":"bg-red-50 text-red-700 dark:bg-red-950/40 dark:text-red-400"}`,children:[n?a.jsx(Qn,{className:"h-4 w-4"}):a.jsx(nn,{className:"h-4 w-4"}),e(n?"Correct":"Incorrect")]}):null,s?a.jsx("div",{className:"mt-3 space-y-2",children:t.options.map((o,l)=>{const c=r.has(l);return a.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[c?a.jsx(Qn,{className:"h-4 w-4 text-muted-foreground"}):a.jsx(Ag,{className:"h-4 w-4 text-muted-foreground/35"}),a.jsx("span",{className:c?"font-medium":"text-muted-foreground",children:o})]},l)})}):null,t.explanation?a.jsx("p",{className:"mt-3 rounded-md bg-muted/60 px-3 py-2 text-xs text-foreground/80",children:t.explanation}):null]})}const MH=10;function ops({course:t}){const{community:e}=qe(),[n,r]=y.useState(1),[s,i]=y.useState(""),[o,l]=y.useState(""),[c,d]=y.useState(null),[u,h]=y.useState(null),[m,f]=y.useState(!1);y.useEffect(()=>{const S=window.setTimeout(()=>{l(s.trim()),r(1)},300);return()=>window.clearTimeout(S)},[s]);const{data:p,isLoading:g}=zfs(t.id,t.isAdmin,n,MH,o),v=(p==null?void 0:p.results)??[],b=(p==null?void 0:p.total)??0,x=Math.max(1,Math.ceil(b/MH)),w=b===0?0:(n-1)*MH+1,k=Math.min(n*MH,b);return y.useEffect(()=>{if(!c||!(e!=null&&e.id)){h(null);return}let S=!1;return f(!0),Rmr(e.id,t.id,c).then(C=>{S||h(C.result)}).catch(()=>{S||h(null)}).finally(()=>{S||f(!1)}),()=>{S=!0}},[c,e==null?void 0:e.id,t.id]),a.jsxs("div",{className:"mt-4 space-y-4",children:[a.jsxs("div",{className:"relative",children:[a.jsx(hs,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Oe,{value:s,onChange:S=>i(S.target.value),placeholder:"Search by student or quiz",className:"pl-9"})]}),a.jsxs("div",{className:"overflow-hidden rounded-lg border border-border",children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"border-b border-border bg-muted/40",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Name & quiz"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Date submitted"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Score"}),a.jsx("th",{className:"px-4 py-3 text-left text-xs font-medium uppercase tracking-wide text-muted-foreground",children:"Result"}),a.jsx("th",{className:"px-4 py-3"})]})}),a.jsx("tbody",{children:g?a.jsx("tr",{children:a.jsx("td",{colSpan:5,className:"px-4 py-10 text-center text-muted-foreground",children:a.jsx(Ne,{className:"mx-auto h-5 w-5 animate-spin"})})}):v.length===0?a.jsx("tr",{children:a.jsx("td",{colSpan:5,className:"px-4 py-10 text-center text-muted-foreground",children:o?"No quiz results match that search.":"No quiz results yet."})}):v.map(S=>{var C,j,E;return a.jsxs("tr",{className:"border-b border-border last:border-0",children:[a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(OIe,{name:((C=S.user)==null?void 0:C.name)||"Member",picture:(j=S.user)==null?void 0:j.picture}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"truncate font-semibold text-foreground",children:((E=S.user)==null?void 0:E.name)||"Member"}),a.jsx("p",{className:"truncate text-xs text-muted-foreground",children:S.quizTitle})]})]})}),a.jsx("td",{className:"whitespace-nowrap px-4 py-3 text-muted-foreground",children:L$t(S.submittedAt)}),a.jsxs("td",{className:"px-4 py-3 font-medium text-foreground",children:[S.scorePercent,"%"]}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:`inline-flex rounded-full px-2.5 py-0.5 text-xs font-semibold ${S.passed?"bg-emerald-50 text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-400":"bg-red-50 text-red-700 dark:bg-red-950/40 dark:text-red-400"}`,children:S.passed?"Pass":"Fail"})}),a.jsx("td",{className:"px-4 py-3 text-right",children:a.jsx(Z,{variant:"outline",size:"sm",onClick:()=>d(S.id),children:"View result"})})]},S.id)})})]})}),a.jsxs("div",{className:"flex items-center justify-between border-t border-border px-4 py-3 text-xs text-muted-foreground",children:[a.jsxs("p",{children:["Showing ",w,"-",k," of ",b," results"]}),a.jsxs("div",{className:"flex gap-1",children:[a.jsx(Z,{variant:"outline",size:"icon",className:"h-8 w-8",disabled:n<=1,onClick:()=>r(S=>S-1),children:a.jsx(nl,{className:"h-4 w-4"})}),a.jsx(Z,{variant:"outline",size:"icon",className:"h-8 w-8",disabled:n>=x||b===0,onClick:()=>r(S=>S+1),children:a.jsx(io,{className:"h-4 w-4"})})]})]})]}),a.jsx(ips,{open:!!c,onOpenChange:S=>{S||d(null)},result:u,loading:m})]})}const lps=["USD","INR","EUR","GBP","AUD","CAD","SGD"];function cps(t){return t?t===1?" a month":t===12?" a year":` every ${t} months`:" once"}const dps={name:"",amount:"",tax:"",currency:"USD",interval:1};function ups({enabled:t,onEnabledChange:e,selectedIds:n,onSelectedIdsChange:r,newPlan:s,onNewPlanChange:i,groupName:o,disabled:l}){const{plans:c}=PN(),{isPaymentNotSet:d}=qM(),[u,h]=y.useState(!1),m=c.some(v=>!v.isDeleted&&v.isActive!==!1),f=Number(s==null?void 0:s.amount),p=wJ((s==null?void 0:s.tax)??""),g=v=>s&&i({...s,...v});return a.jsxs("div",{className:"space-y-3 rounded-lg border border-border p-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"course-sell-separately",className:"font-medium",children:"Sell this course"}),a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Members buy a plan to unlock it, without needing a plan for the whole group.",o?` Plans for ${o} still include this course.`:""]})]}),a.jsx(Hs,{id:"course-sell-separately",checked:t,disabled:l,onCheckedChange:e})]}),t?a.jsxs("div",{className:"space-y-3",children:[d?a.jsx(_Ie,{isAdmin:!0,onConfigure:()=>h(!0)}):null,m?a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Plans that include this course"}),a.jsx(d$t,{selectedIds:n,onChange:r}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"A plan can bundle several groups and courses. Members who already hold a selected plan can enroll right away."})]}):null,s?a.jsxs("div",{className:"space-y-3 rounded-md border border-dashed border-border p-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"New plan"}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7","aria-label":"Remove new plan",disabled:l,onClick:()=>i(null),children:a.jsx(nn,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"course-plan-name",children:"Plan name"}),a.jsx(Oe,{id:"course-plan-name",value:s.name,disabled:l,placeholder:"e.g. Course access",onChange:v=>g({name:v.target.value})})]}),a.jsxs("div",{className:"grid grid-cols-[110px_1fr] gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Currency"}),a.jsxs(zn,{value:s.currency,disabled:l,onValueChange:v=>g({currency:v}),children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsx(Fn,{children:lps.map(v=>a.jsx(pt,{value:v,children:v},v))})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"course-plan-amount",children:"Amount"}),a.jsx(Oe,{id:"course-plan-amount",type:"number",min:"1",step:"1",value:s.amount,disabled:l,placeholder:"49",onChange:v=>g({amount:v.target.value.replace(/[.,]/g,"")})})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Payment frequency"}),a.jsxs(zn,{value:String(s.interval),disabled:l,onValueChange:v=>g({interval:Number(v)}),children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"1",children:"Monthly"}),a.jsx(pt,{value:"3",children:"3 months"}),a.jsx(pt,{value:"6",children:"6 months"}),a.jsx(pt,{value:"12",children:"1 year"}),a.jsx(pt,{value:"0",children:"One time"})]})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:"course-plan-tax",children:"Tax (%)"}),a.jsx(n$t,{amount:f,taxPercentage:p??0,currency:s.currency})]}),a.jsx(Oe,{id:"course-plan-tax",inputMode:"decimal",value:s.tax,disabled:l,placeholder:"0",onChange:v=>g({tax:v.target.value})})]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:p===null?"Enter a tax between 0 and 100.":Number.isInteger(f)&&f>0?`Members pay ${s.currency} ${(S9(f*100,p)/100).toFixed(2)}${cps(s.interval)}.`:"Tax is optional and added on top of the amount at checkout."})]}):a.jsxs(Z,{type:"button",variant:"outline",size:"sm",disabled:l,onClick:()=>i({...dps}),children:[a.jsx(Dn,{className:"mr-1.5 h-4 w-4"}),"Create a new plan"]})]}):null,a.jsx(KM,{open:u,onOpenChange:h})]})}const hps=[{value:"published",label:"Open",description:"Anyone can see and enroll in this course."},{value:"closed-free",label:"Closed",description:"Members request enrollment or purchase a linked membership plan to access this course."}];function mps(t,e){if(!e)return t.length===0?{error:"Select a plan or create a new one to sell this course."}:{fields:{subscriptionIds:t}};const n=Number(e.amount);if(!e.name.trim()||!Number.isInteger(n)||n<=0)return{error:"Give the new plan a name and a whole amount greater than zero."};const r=wJ(e.tax);return r===null?{error:"Enter a tax between 0 and 100 with up to two decimals, or leave it blank."}:{fields:{subscriptionIds:t,subscriptionName:e.name.trim(),subscriptionAmount:n*100,subscriptionTaxPercentage:r,subscriptionCurrency:e.currency,subscriptionIsRecurring:e.interval>0,subscriptionRecurringInterval:e.interval}}}function fps({course:t,onCourseChange:e}){var D;const{toast:n}=yt(),r=rn(),{community:s}=qe(),{groups:i,communityDetail:o}=Ln(),l=(o==null?void 0:o.myRole)==="admin",c=t.state==="draft",d=y.useMemo(()=>NIe(i),[i]),[u,h]=y.useState(t.state==="closed-free"?"closed-free":"published"),[m,f]=y.useState(t.visibleToNonMembers),[p,g]=y.useState(((D=t.group)==null?void 0:D.id)??""),[v,b]=y.useState(!1),[x,w]=y.useState(!1),k=t.subscriptionIds??[],S=k.join(","),[C,j]=y.useState(k.length>0),[E,N]=y.useState(k),[A,_]=y.useState(null);y.useEffect(()=>{const I=S?S.split(","):[];N(I),j(I.length>0)},[S]);const T=d.find(I=>I.id===p)??null,R=xAe(T==null?void 0:T.groupType),O=R?"closed-free":u,F=async()=>{if(!(s!=null&&s.id))return;if(!p){n({title:"Select a group",description:"A course must be attached to a group.",variant:"destructive"});return}const I=l?C?mps(E,A):{fields:{subscriptionIds:[]}}:{fields:{}};if("error"in I){n({title:"Check the course price",description:I.error,variant:"destructive"});return}w(!0);try{const P=await kAe(s.id,{title:t.title,description:t.description,state:O,visibleToNonMembers:m,groupId:p,enrollGroupMembers:v,...I.fields},t.id);if(!P.course)throw new Error("No course returned");const M=AEt(P.course);e({...t,state:M.state,visibleToNonMembers:M.visibleToNonMembers,group:M.group}),_(null),await r.invalidateQueries({queryKey:["knowledge-courses",s.id]}),await r.invalidateQueries({queryKey:["member-subscriptions-admin",s.id]}),await r.invalidateQueries({queryKey:["knowledge-subscription-plans",s.id]}),n({title:c?"Course published":"Settings saved"})}catch(P){const M=P instanceof ze?Dt(P.body,P.message):"Something went wrong.";n({title:"Could not save settings",description:M,variant:"destructive"})}finally{w(!1)}};return a.jsxs("div",{className:"mt-4 space-y-4",children:[c?a.jsxs(vI,{children:[a.jsx(t7,{children:"Course is in draft"}),a.jsx(yI,{children:"Only admins can see it. Publish to make it live."})]}):null,a.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Access"}),a.jsxs(Z,{onClick:F,disabled:x||!p,children:[x?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):null,c?"Publish":"Save"]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(_e,{htmlFor:"settings-course-group",children:["Attached group ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsxs(zn,{value:p||void 0,onValueChange:g,disabled:x,children:[a.jsx(On,{id:"settings-course-group",children:a.jsx(Vn,{placeholder:"Select a group"})}),a.jsx(Fn,{children:d.map(I=>a.jsxs(pt,{value:I.id,children:[I.name," · ",CN(I.groupType)]},I.id))})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Learners must join this group before they can enroll in the course."})]}),T?a.jsxs(a.Fragment,{children:[R?a.jsx("p",{className:"text-xs text-muted-foreground",children:"Paid groups force this course onto join through request. Learners must join the group first, then request course enrollment."}):null,a.jsxs("label",{className:"flex items-start gap-3 rounded-lg border border-border p-3",children:[a.jsx(ji,{id:"settings-enroll-group-members",checked:v,disabled:x,onCheckedChange:I=>b(I===!0),className:"mt-0.5"}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:"settings-enroll-group-members",className:"font-medium cursor-pointer",children:"Enroll current members and moderators"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Add people currently in this group (who have joined the community) to the course."})]})]})]}):null,a.jsx(TS,{value:O,onValueChange:I=>h(I),className:"space-y-3",disabled:R,children:hps.map(I=>a.jsxs("label",{htmlFor:`access-${I.value}`,className:`flex gap-3 rounded-lg border p-3 transition-colors ${O===I.value?"border-primary bg-primary/5":"border-border"} ${R?"cursor-not-allowed opacity-80":"cursor-pointer"}`,children:[a.jsx(Ly,{value:I.value,id:`access-${I.value}`,className:"mt-0.5",disabled:R}),a.jsxs("div",{children:[a.jsx(_e,{htmlFor:`access-${I.value}`,className:"font-medium cursor-pointer",children:I.label}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:I.description})]})]},I.value))}),l?a.jsx(ups,{enabled:C,onEnabledChange:j,selectedIds:E,onSelectedIdsChange:N,newPlan:A,onNewPlanChange:_,groupName:T==null?void 0:T.name,disabled:x}):k.length>0&&a.jsxs("p",{className:"rounded-lg border border-border p-3 text-xs text-muted-foreground",children:["This course is sold through ",k.length===1?"a plan":`${k.length} plans`,". Only community admins can change its pricing."]}),a.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border p-3",children:[a.jsxs("div",{children:[a.jsx(_e,{className:"font-medium",children:"Visible to non-enrolled members"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Show this course on the Course page to people who haven't enrolled yet."})]}),a.jsx(Hs,{checked:m,onCheckedChange:f})]})]})]})}function XJe(t){return[...YRe(t).map(e=>e.name),...hP(t).map(e=>e.title)]}function pps({open:t,onOpenChange:e,courseTitle:n,groupedPlans:r,onSubscribed:s}){const{toast:i}=yt(),o=Tn(),[l,c=""]=o("Choose a membership plan that includes {course}.").split("{course}"),{user:d}=jr(),{community:u}=qe(),{isPaymentNotSet:h,isLoading:m,refetch:f}=qM(),[p,g]=y.useState(!1),[v,b]=y.useState(!1),x=(u==null?void 0:u.myRole)==="admin"||(u==null?void 0:u.isByMe)===!0,[w,k]=y.useState(null),[S,C]=y.useState(null),j=h||v;y.useEffect(()=>{t&&(b(!1),f())},[t,f]);const E=cie(r),N=async(_,T)=>{if(!(!(u!=null&&u.id)||!_.id)){k(_.id);try{await cIt({communityId:u.id,communityName:u.name,plan:_,billingDetails:T,user:{name:(d==null?void 0:d.name)??void 0,email:(d==null?void 0:d.email)??void 0,mobile:(d==null?void 0:d.mobile)??void 0},description:`${_.name??"Membership"} — ${n}`}),i({title:a2(_)?o("Subscribed"):o("Payment successful"),description:o("You can start learning now.")}),e(!1),s==null||s()}catch(R){if(uIt(R)){b(!0);return}const O=dIt(R,o("Something went wrong. Please try again."));O&&i({title:o("Checkout failed"),description:O,variant:"destructive"})}finally{k(null),C(null)}}},A=async _=>{if(j){x&&g(!0);return}if(a2(_)){await N(_);return}C(_)};return a.jsxs(a.Fragment,{children:[a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg sm:max-w-md",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:o("Buy access")}),a.jsxs(_n,{children:[l,a.jsx("span",{className:"font-medium text-foreground",children:n}),c]})]}),a.jsx("div",{className:"space-y-2 max-h-[50vh] overflow-y-auto",children:m?a.jsx("div",{className:"flex justify-center py-8",children:a.jsx(Ne,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):j?a.jsx(_Ie,{isAdmin:x,onConfigure:()=>g(!0)}):E.length===0?a.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:o("No membership plans sell this course yet.")}):E.map(_=>a.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-border p-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:_.name??o("Membership plan")}),a.jsx("p",{className:"text-xs text-muted-foreground",children:Ax(_)}),XJe(_).length>0?a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground line-clamp-2",children:[o("Includes")," ",XJe(_).join(", ")]}):null]}),a.jsx(Z,{size:"sm",disabled:w!=null,onClick:()=>void A(_),children:w===_.id?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a2(_)?o("Subscribe free"):a.jsxs(a.Fragment,{children:[a.jsx(Sh,{className:"mr-1.5 h-3.5 w-3.5"}),AN(_)]})})]},_.id))})]})}),a.jsx(r$t,{open:S!=null,onOpenChange:_=>!_&&C(null),planName:S==null?void 0:S.name,user:{name:(d==null?void 0:d.name)??void 0,email:(d==null?void 0:d.email)??void 0,mobile:(d==null?void 0:d.mobile)??void 0},onSubmit:async _=>{S&&await N(S,_)}}),a.jsx(KM,{open:p,onOpenChange:g,purpose:"import",onConfigured:()=>{b(!1),f()}})]})}const eXe=500;function V$t({url:t,title:e,texts:n}){const{groups:r,communityDetail:s}=Ln(),{toast:i}=yt(),o=Tn(),l=y.useMemo(()=>EN(r),[r]),[c,d]=y.useState(!1),[u,h]=y.useState(!1),[m,f]=y.useState(""),[p,g]=y.useState(""),[v,b]=y.useState(0),x=y.useRef(null),w=yse(x),[k,S]=y.useState(!1);y.useEffect(()=>{c&&(g(""),b(0))},[c]),y.useEffect(()=>{var N,A;if(!c)return;const E=((N=s==null?void 0:s.configurables)==null?void 0:N.COMMUNITY_DEFAULT_POST_SECTION)??null;f(((A=JAe(r,E))==null?void 0:A.id)??"")},[c,r,s]);const C=()=>void kN(t).then(E=>i(E?{title:o("Link copied"),description:n.copied}:{title:o("Couldn't copy link"),variant:"destructive"})),j=async()=>{var A;const E=l.find(_=>_.id===m);if(!E)return;const N=(((A=x.current)==null?void 0:A.readMarkdown())??p).trim();S(!0);try{const _=await qAe({title:e,description:(JB(N)?[t,N]:[N,t]).filter(Boolean).join(`

`),groupId:E.groupId,tabId:E.tabId});i(_.inReview?{title:o("Post in review"),description:_.reviewReason||o("An admin will review it before it appears.")}:{title:o("Shared"),description:pn(o("Posted to {channel}"),{channel:E.label})}),d(!1)}catch(_){i({title:n.postFailed,description:_ instanceof ze?Dt(_.body,o("Please try again.")):o("Please try again."),variant:"destructive"})}finally{S(!1)}};return a.jsxs(a.Fragment,{children:[a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsxs(Z,{variant:"outline",size:"sm",className:"h-8 rounded-full px-3 text-xs",children:[a.jsx(kk,{className:"h-3.5 w-3.5"}),o("Share")]})}),a.jsxs(Cr,{align:"end",children:[a.jsxs(ot,{onSelect:C,children:[a.jsx(eu,{className:"mr-2 h-4 w-4"}),o("Copy link")]}),a.jsxs(ot,{onSelect:()=>d(!0),disabled:l.length===0,children:[a.jsx(nI,{className:"mr-2 h-4 w-4"}),o("Post to a channel")]}),a.jsxs(ot,{onSelect:()=>h(!0),children:[a.jsx(_s,{className:"mr-2 h-4 w-4"}),o("Send in a message")]})]})]}),a.jsx(Bt,{open:c,onOpenChange:E=>!k&&d(E),children:a.jsxs(Ft,{className:"max-h-[90dvh] overflow-y-auto sm:max-w-xl",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:o("Post to a channel")}),a.jsx(_n,{className:"break-words [overflow-wrap:anywhere]",children:n.channelDescription})]}),a.jsxs(zn,{value:m,onValueChange:f,children:[a.jsx(On,{"aria-label":o("Channel"),children:a.jsx(Vn,{placeholder:o("Select channel")})}),a.jsx(Fn,{className:"max-h-64",children:l.map(E=>a.jsx(pt,{value:E.id,children:E.label},E.id))})]}),a.jsxs("div",{ref:w.wrapRef,className:"min-w-0 space-y-1.5",children:[w.menu,a.jsx(Du,{ref:x,value:p,onChange:g,...w.editorProps,highlightMentions:!0,deferMarkdownSync:!0,placeholder:o("Add a message to introduce this to your community (optional). Type @ to mention someone."),plainTextPaste:!0,markdownBreaks:!0,maxLength:eXe,onCharacterCountChange:b,className:"min-w-0 max-w-full overflow-hidden",editableClassName:"min-h-[160px] max-h-72"}),a.jsxs("p",{className:"text-right text-xs tabular-nums text-muted-foreground","aria-live":"polite",children:[v,"/",eXe]})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"ghost",disabled:k,onClick:()=>d(!1),children:o("Cancel")}),a.jsxs(Z,{disabled:!m||k,onClick:()=>void j(),children:[k&&a.jsx(Ne,{className:"mr-1.5 h-4 w-4 animate-spin"}),o(k?"Posting…":"Post")]})]})]})}),a.jsx(kPe,{post:null,open:u,onOpenChange:h,subject:{url:t,noun:n.noun,description:n.sendDescription}})]})}function gps({course:t}){const e=Tn();return a.jsx(V$t,{url:fmr(t.id),title:t.title,texts:{copied:e("It opens this course's page."),channelDescription:pn(e("Posts “{title}” as a card members can like and open. Enrolling works as it does on the course page."),{title:t.title}),postFailed:e("Couldn't share the course"),noun:"course",sendDescription:e("Share it in a message. The link opens the course's page.")}})}function vae(t,e=!1,n=!1){const r=[...t].sort((i,o)=>i.index-o.index),s=[];for(const i of r){const o=[...i.lessons].sort((l,c)=>l.index-c.index);for(const l of o)if(e||l.state==="published"){if(!e&&!n&&l.isLocked)continue;s.push({sectionId:i.id,lessonId:l.id})}}return s}function J1e(t,e=!1){return vae(t,e)[0]??null}function H$t(t,e,n){const r=t.find(i=>i.id===e);if(!r)return null;const s=r.lessons.findIndex(i=>i.id===n);return s<0?null:{section:r,lessonIndex:s}}function vps(t,e,n,r=!1){const s=vae(t,r),i=s.findIndex(o=>o.sectionId===e&&o.lessonId===n);return i<0?{prev:null,next:null}:{prev:i>0?s[i-1]:null,next:i<s.length-1?s[i+1]:null}}function yps(t,e,n,r=!1){const s=vae(t,r),i=s.findIndex(o=>o.sectionId===e&&o.lessonId===n);return i<0||s.length===0?null:{current:i+1,total:s.length}}function bps(t,e,n){const r=vae(t,!1,!0),s=r.findIndex(c=>c.sectionId===e&&c.lessonId===n);if(s<0||s>=r.length-1)return null;const i=r[s+1],o=H$t(t,i.sectionId,i.lessonId),l=o==null?void 0:o.section.lessons[o.lessonIndex];return l?{...i,title:l.title,isDripLocked:!!(l.isLocked&&l.lockedReason==="drip")}:null}function xps({description:t}){const e=Tn(),n=y.useRef(null),[r,s]=y.useState(!1),[i,o]=y.useState(!1);return y.useEffect(()=>{s(!1)},[t]),y.useEffect(()=>{const l=n.current;if(!l)return;const c=()=>o(l.scrollHeight>86);if(c(),typeof ResizeObserver>"u")return window.addEventListener("resize",c),()=>window.removeEventListener("resize",c);const d=new ResizeObserver(c);return d.observe(l),()=>d.disconnect()},[t]),a.jsxs("div",{children:[a.jsx("div",{ref:n,className:r?void 0:"max-h-[5.25rem] overflow-hidden",children:a.jsx(Du,{value:t,readOnly:!0,markdownBreaks:!0,className:"text-muted-foreground"})}),i?a.jsx("button",{type:"button",className:"mt-1 text-sm font-medium text-primary hover:underline","aria-expanded":r,onClick:()=>s(l=>!l),children:e(r?"Show less":"Read more")}):null]})}function wps(){const{courseId:t}=So(),e=Nn(),n=rn(),{toast:r}=yt(),s=Tn(),{community:i}=qe(),{communityDetail:o,groups:l,mySubscriptions:c,refetchGroups:d}=Ln(),[u,h]=y.useState("content"),[m,f]=y.useState(null),[p,g]=y.useState(!1),[v,b]=y.useState(!1),[x,w]=y.useState(!1),[k,S]=y.useState(!1),[C,j]=y.useState(!1),[E,N]=y.useState(null),[A,_]=y.useState(!1),[T,R]=y.useState(!1),[O,F]=y.useState(!1),[D,I]=y.useState(!1),{data:P,isLoading:M,isError:z,error:G,refetch:B,isFetching:H}=rPe(t),W=sPe(m??P??null),V=y.useCallback((we,Be)=>f(Ve=>Ve&&Ve.id===we?{...Ve,...Be}:Ve),[]),U=nPe((i==null?void 0:i.id)??"",V),ne=P$t((i==null?void 0:i.id)??"",V),te=W==null?void 0:W.paywall,re=!!(W&&!W.isRealAdmin&&(te!=null&&te.required)&&!te.entitled),fe=!!(te!=null&&te.required&&te.entitled),le=y.useMemo(()=>aIt((te==null?void 0:te.plans)??[]),[te==null?void 0:te.plans]),[q,Y]=xc(),X=q.get("buy")==="1";y.useEffect(()=>{if(!X||!W)return;re&&W.joinStatus!=="joined"&&S(!0);const we=new URLSearchParams(q);we.delete("buy"),Y(we,{replace:!0})},[X,W,re,q,Y]);const Q=l.find(we=>{var Be;return we.id===((Be=W==null?void 0:W.group)==null?void 0:Be.id)}),ie=!!(fe||Q&&(Q.accessSource==="payment"||Q.accessSource==="subscription"||oIt(c,Q.id)));if(jN(o))return a.jsx(Gs,{to:ve.dashboard,replace:!0});const he=async()=>{if(!(i!=null&&i.id)||!t)return;await n.invalidateQueries({queryKey:["knowledge-course-detail",i.id,t]}),await n.invalidateQueries({queryKey:["knowledge-courses",i.id]});const we=await B();we.data&&f(we.data)},ye=async we=>{if(!(!(i!=null&&i.id)||!W)){if(!(we!=null&&we.skipGroupGate)&&!fe&&W.group&&!Mu(W.group)){const Be=l.find(Ve=>{var be;return Ve.id===((be=W.group)==null?void 0:be.id)});N(Be??W.group),j(!0);return}_(!0);try{await NEt(i.id,W.id),W.state==="closed-free"?r({title:s("Request sent"),description:s("An admin will review your enrollment request.")}):r({title:s("Enrolled"),description:s("You can start learning now.")}),await he()}catch(Be){const Ve=bEt(Be);if(Ve){const Ze=l.find(Pe=>Pe.id===Ve.id);N(Ze??Ve),j(!0);return}const be=Be instanceof ze?Dt(Be.body,Be.message):s("Something went wrong.");r({title:s("Could not join course"),description:be,variant:"destructive"})}finally{_(!1)}}},J=()=>{if(W){if(re&&W.joinStatus!=="joined"){S(!0);return}if(!W.isRealAdmin&&!fe&&r0e(W)){const we=l.find(Be=>{var Ve;return Be.id===((Ve=W.group)==null?void 0:Ve.id)});N(we??W.group),j(!0);return}if(W.joinStatus==="joined"){const we=J1e(W.sections);we?e(ve.knowledgeLearn(W.id,we.sectionId,we.lessonId)):r({title:s("No lessons yet"),description:s("Content will appear when lessons are published.")});return}W.joinStatus!=="requested"&&ye()}},K=async()=>{if(!(!(i!=null&&i.id)||!W)){R(!0);try{await umr(i.id,W.id),r({title:s("Course deleted")}),await n.invalidateQueries({queryKey:["knowledge-courses",i.id]}),e(ve.knowledge,{replace:!0})}catch(we){const Be=we instanceof ze?Dt(we.body,we.message):s("Something went wrong.");r({title:s("Could not delete course"),description:Be,variant:"destructive"})}finally{R(!1),b(!1)}}},ce=async()=>{if(!(!(i!=null&&i.id)||!W)){I(!0);try{const we=await pmr(i.id,W.id);if(!we.course)throw new Error("No course returned");r({title:s("Course duplicated"),description:s("The copy was created as a draft.")}),await n.invalidateQueries({queryKey:["knowledge-courses",i.id]}),e(ve.knowledgeCourse(we.course.id))}catch(we){const Be=we instanceof ze?Dt(we.body,we.message):s("Something went wrong.");r({title:s("Could not duplicate course"),description:Be,variant:"destructive"})}finally{I(!1)}}},pe=async()=>{if(!(!(i!=null&&i.id)||!W||ie)){F(!0);try{await vmr(i.id,W.id),r({title:s("Left course")}),await he(),w(!1)}catch(we){const Be=we instanceof ze?Dt(we.body,we.message):s("Something went wrong.");r({title:s("Could not leave course"),description:Be,variant:"destructive"})}finally{F(!1)}}},Ie=()=>W?W.joinStatus==="joined"?s("Continue learning"):W.joinStatus==="requested"?s("Request sent"):re?te!=null&&te.fromPrice?`${s("Buy now")} · ${QRe(te.fromPrice)}`:s("Buy now"):fe?s("Enroll now"):W.state==="closed-free"?s("Send request to enroll"):s("Enroll now"):"";if(M)return a.jsx("div",{className:"flex min-h-[40vh] items-center justify-center",children:a.jsx(Ne,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(z||!W)return a.jsxs("div",{className:"mx-auto max-w-lg py-16 text-center space-y-4",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:s("Course not found")}),a.jsx("p",{className:"text-sm text-muted-foreground",children:dn(G,s("This course may have been removed or you lack access."))}),a.jsxs("div",{className:"flex justify-center gap-2",children:[a.jsxs(Z,{variant:"outline",onClick:()=>B(),disabled:H,children:[a.jsx(Nl,{className:"mr-2 h-4 w-4"}),s("Retry")]}),a.jsx(Z,{asChild:!0,variant:"outline",children:a.jsx(vr,{to:ve.knowledge,children:s("Back to Courses")})})]})]});const Me=!W.isAdmin&&W.isJoined&&W.totalLessons!=null&&W.lessonsCompleted!=null&&W.totalLessons>0;return a.jsxs("div",{className:"mx-auto max-w-4xl space-y-4 pb-12",children:[a.jsx(MIe,{items:[{label:s("Courses"),href:ve.knowledge},{label:W.title}]}),a.jsxs("div",{className:"overflow-hidden rounded-xl border border-border bg-card shadow-sm",children:[a.jsx("div",{className:"aspect-[16/6] bg-primary/10",children:W.banner?a.jsx("img",{src:W.banner,alt:"",className:"h-full w-full object-cover"}):a.jsx("div",{className:"flex h-full items-center justify-center text-4xl font-semibold text-primary/30",children:W.title.charAt(0).toUpperCase()})}),a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3 p-4",children:[a.jsxs("div",{className:"min-w-0 flex-1 basis-full space-y-2 sm:basis-0",children:[a.jsx("h1",{className:"text-xl font-semibold text-foreground",children:W.title}),a.jsxs("div",{className:"flex flex-wrap items-center gap-x-4 gap-y-1.5 text-xs text-muted-foreground",children:[W.author?a.jsxs("span",{className:"inline-flex min-w-0 items-center gap-2",children:[a.jsx(Jd,{src:W.author.picture,name:W.author.name,className:"h-6 w-6 shrink-0 text-[10px]"}),a.jsx("span",{className:"min-w-0 truncate",children:pn(s("By {name}"),{name:W.author.name})})]}):null,a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(Iu,{className:"h-3.5 w-3.5"}),pn(W.lessonCount===1?s("{count} lesson"):s("{count} lessons"),{count:W.lessonCount??0})]}),a.jsxs("span",{className:"inline-flex items-center gap-1",title:s("Total time to complete"),children:[a.jsx(ja,{className:"h-3.5 w-3.5"}),lk(W.durationMinutes)]})]}),W.description?a.jsx(xps,{description:W.description}):null,W.group?a.jsx("p",{className:"text-xs text-muted-foreground",children:pn(s("Attached to {group}"),{group:W.group.name})}):null,Me&&(W.totalLessons??0)>0&&(W.lessonsCompleted??0)>=(W.totalLessons??0)?a.jsx(_$t,{completedAt:W.completedAt,hint:pn(s("{done} of {total} lessons completed"),{done:W.lessonsCompleted??0,total:W.totalLessons??0}),className:"pt-1"}):Me?a.jsxs("div",{className:"max-w-md space-y-1 pt-1",children:[a.jsxs("div",{className:"flex justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:s("Progress")}),a.jsx("span",{children:pn(s("{done}/{total} lessons · {percent}%"),{done:W.lessonsCompleted??"",total:W.totalLessons??"",percent:W.progressPercent??""})})]}),a.jsx(ap,{value:W.progressPercent??0,className:"h-2"})]}):null]}),a.jsxs("div",{className:"flex max-w-full shrink-0 flex-wrap items-center justify-end gap-2",children:[W.state!=="draft"?a.jsxs(a.Fragment,{children:[Z1e(W,!!W.isAdmin)||W.savedByMe?a.jsx(gae,{saved:!!W.savedByMe,saveLabel:s("Save this course"),onToggle:()=>ne(W),className:"shadow-none"}):null,Z1e(W,!!W.isAdmin)?a.jsx(vse,{liked:!!W.likedByMe,count:W.likeCount??0,likeLabel:s("Like this course"),onToggle:()=>U(W),className:"shadow-none"}):null,a.jsx(gps,{course:W})]}):null,W.isAdmin?a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{variant:"outline",size:"icon",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[a.jsxs(ot,{onClick:()=>g(!0),children:[a.jsx(Qs,{className:"mr-2 h-4 w-4"}),s("Edit course")]}),a.jsxs(ot,{disabled:D,onClick:()=>void ce(),children:[D?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Zl,{className:"mr-2 h-4 w-4"}),s("Duplicate course")]}),a.jsx(mi,{}),a.jsxs(ot,{className:"text-destructive",onClick:()=>b(!0),children:[a.jsx(qn,{className:"mr-2 h-4 w-4"}),s("Delete course")]})]})]}):a.jsxs(a.Fragment,{children:[a.jsxs(Z,{onClick:J,disabled:A||W.joinStatus==="requested",children:[A?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):W.joinStatus==="joined"?a.jsx(fm,{className:"mr-2 h-4 w-4"}):null,Ie()]}),W.joinStatus==="joined"?a.jsx(Z,{variant:"outline",size:"icon",disabled:ie,onClick:()=>w(!0),title:s(ie?"Course access is included with your active paid access":"Leave course"),children:a.jsx(sI,{className:"h-4 w-4"})}):null]})]})]}),W.isAdmin?a.jsxs(U0,{value:u,onValueChange:we=>h(we),className:"px-4 pb-4",children:[a.jsxs(nb,{className:"h-auto flex-wrap",children:[a.jsx(Xo,{value:"content",children:s("Content")}),a.jsx(Xo,{value:"settings",children:s("Settings")}),a.jsx(Xo,{value:"members",children:s("Members")}),a.jsx(Xo,{value:"comments",children:s("Comments")}),a.jsx(Xo,{value:"quiz-results",children:s("Quiz results")})]}),a.jsx(pd,{value:"content",children:a.jsx(QJe,{course:W,onCourseChange:we=>f(we)})}),a.jsx(pd,{value:"settings",children:a.jsx(fps,{course:W,onCourseChange:we=>{f(we),he()}})}),a.jsx(pd,{value:"members",children:a.jsx(Bfs,{course:W})}),a.jsx(pd,{value:"comments",children:a.jsx(Gfs,{course:W})}),a.jsx(pd,{value:"quiz-results",children:a.jsx(ops,{course:W})})]}):a.jsx("div",{className:"px-4 pb-4",children:a.jsx(QJe,{course:W,onCourseChange:we=>f(we)})})]}),a.jsx(Lfs,{course:W,open:p,onOpenChange:g,onUpdated:he}),a.jsx(DIe,{open:C,group:E,onOpenChange:j,onJoined:async()=>{d(),await ye({skipGroupGate:!0})},onRequested:()=>{d()},courseMoved:r0e(W)}),a.jsx(pps,{open:k,onOpenChange:S,courseTitle:W.title,groupedPlans:le,onSubscribed:async()=>{var Be;const we=await B();we.data&&f(we.data),((Be=we.data)==null?void 0:Be.joinStatus)!=="joined"&&await ye({skipGroupGate:!0})}}),a.jsx(Kr,{open:v,onOpenChange:b,children:a.jsxs(Or,{className:"w-[calc(100vw-2rem)] rounded-lg",children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:s("Delete course?")}),a.jsx(zr,{children:s("All course content and member progress will be permanently removed.")})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:s("Cancel")}),a.jsx(Yr,{onClick:K,disabled:T,children:T?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):s("Delete")})]})]})}),a.jsx(Kr,{open:x,onOpenChange:w,children:a.jsxs(Or,{className:"w-[calc(100vw-2rem)] rounded-lg",children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:s("Leave course?")}),a.jsx(zr,{children:s("You will lose access to lessons until you enroll again.")})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:s("Cancel")}),a.jsx(Yr,{onClick:pe,disabled:O,children:O?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):s("Leave")})]})]})})]})}function kps({open:t,onOpenChange:e,courseId:n,courseTitle:r,karma:s}){const i=Tn(),o=!!(s!=null&&s.awarded&&s.points>0),[l,c=""]=((s==null?void 0:s.points)===1?i("You received {points} karma point."):i("You received {points} karma points.")).split("{points}");return a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg sm:max-w-md",children:[a.jsxs(Vt,{children:[a.jsx("div",{className:"mx-auto mb-2 flex h-14 w-14 items-center justify-center rounded-full bg-primary/10",children:a.jsx(Yrt,{className:"h-7 w-7 text-primary"})}),a.jsx(Ut,{className:"text-center",children:i("Congratulations!")}),a.jsx(_n,{className:"text-center",children:pn(i("You've successfully completed {course}."),{course:r})})]}),o?a.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-muted/40 px-3 py-3",children:[a.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:a.jsx(Bx,{className:"h-4 w-4"})}),a.jsxs("p",{className:"text-sm text-foreground",children:[l,a.jsx("span",{className:"font-semibold",children:s==null?void 0:s.points}),c]})]}):null,a.jsxs("div",{className:"mt-2 flex flex-col gap-2 sm:flex-row sm:justify-end",children:[a.jsx(Z,{variant:"outline",onClick:()=>e(!1),children:i("Keep reviewing")}),a.jsx(Z,{asChild:!0,children:a.jsx(vr,{to:ve.knowledgeCourse(n),children:i("Back to course")})})]})]})})}const X1e=10,tXe=X1e*1e3;function Sps({progress:t,secondsLeft:e}){const i=2*Math.PI*49;return a.jsxs("div",{className:"relative mx-auto h-[104px] w-[104px]",children:[a.jsxs("svg",{width:104,height:104,className:"-rotate-90","aria-hidden":!0,children:[a.jsx("circle",{cx:104/2,cy:104/2,r:49,className:"fill-none stroke-muted",strokeWidth:6}),a.jsx("circle",{cx:104/2,cy:104/2,r:49,className:"fill-none stroke-primary",strokeWidth:6,strokeLinecap:"round",strokeDasharray:i,strokeDashoffset:i*(1-t)})]}),a.jsx("span",{className:"absolute inset-0 flex items-center justify-center text-[28px] font-semibold tabular-nums tracking-tight text-foreground","aria-live":"polite","aria-atomic":"true",children:e})]})}function Cps({open:t,nextTitle:e,onStay:n,onContinue:r}){const s=Tn(),[i,o]=y.useState(X1e),[l,c]=y.useState(1),d=y.useRef(!1),u=y.useRef(r);u.current=r,y.useEffect(()=>{if(!t)return;d.current=!1,o(X1e),c(1);const p=performance.now();let g=0;const v=b=>{if(d.current)return;const x=Math.max(0,tXe-(b-p));if(c(x/tXe),o(Math.max(0,Math.ceil(x/1e3))),x<=0){d.current=!0,u.current();return}g=window.requestAnimationFrame(v)};return g=window.requestAnimationFrame(v),()=>window.cancelAnimationFrame(g)},[t]);const h=()=>{d.current=!0,n()},m=()=>{d.current=!0,r()},f=i<=0?s("Redirecting now…"):pn(s(i===1?"Redirecting in {count} second":"Redirecting in {count} seconds"),{count:i});return a.jsx(Bt,{open:t,onOpenChange:p=>{p||h()},children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg gap-5 overflow-hidden sm:max-w-[26rem]",children:[a.jsxs(Vt,{className:"sm:text-center",children:[a.jsx("div",{className:ee("mx-auto mb-1 flex h-12 w-12 items-center justify-center rounded-full","bg-emerald-500/10 text-emerald-600","animate-in zoom-in-50 fade-in duration-300"),children:a.jsx(Qn,{className:"h-6 w-6",strokeWidth:2.5})}),a.jsx(Ut,{className:"text-center",children:s("Lesson complete")}),a.jsx(_n,{className:"text-center",children:f})]}),a.jsx(Sps,{progress:l,secondsLeft:i}),a.jsxs("div",{className:"rounded-xl border border-border/80 bg-muted/50 px-4 py-3 text-center",children:[a.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wide text-muted-foreground",children:s("Up next")}),a.jsx("p",{className:"mt-1 truncate text-sm font-medium text-foreground",title:e,children:e})]}),a.jsxs(ir,{className:"gap-2 sm:justify-stretch",children:[a.jsx(Z,{variant:"outline",className:"sm:flex-1",onClick:h,children:s("Stay")}),a.jsxs(Z,{className:"gap-1.5 sm:flex-1",autoFocus:!0,onClick:m,children:[s("Continue"),a.jsx(xa,{className:"h-4 w-4"})]})]})]})})}function jps({open:t,course:e,onEnrolled:n}){var w,k;const{toast:r}=yt(),s=Tn(),{community:i}=qe(),{groups:o,refetchGroups:l}=Ln(),[c,d]=y.useState(!1),[u,h]=y.useState(!1),[m,f]=y.useState(null),p=e.joinStatus==="requested",g=!!(!e.isRealAdmin&&((w=e.paywall)!=null&&w.required)&&!e.paywall.entitled&&!p),v=(k=e.paywall)!=null&&k.fromPrice?QRe(e.paywall.fromPrice):"",b=e.state==="closed-free"||e.state==="closed-paid",x=async S=>{if(i!=null&&i.id){if(!(S!=null&&S.skipGroupGate)&&e.group&&!Mu(e.group)){const C=o.find(j=>{var E;return j.id===((E=e.group)==null?void 0:E.id)});f(C??e.group),h(!0);return}d(!0);try{await NEt(i.id,e.id),r(b?{title:s("Request sent"),description:s("An admin will review your enrollment request.")}:{title:s("Enrolled"),description:s("You can watch this lecture now.")}),await n()}catch(C){const j=bEt(C);if(j){const N=o.find(A=>A.id===j.id);f(N??j),h(!0);return}const E=C instanceof ze?Dt(C.body,C.message):s("Something went wrong.");r({title:s("Could not enroll"),description:E,variant:"destructive"})}finally{d(!1)}}};return a.jsxs(a.Fragment,{children:[a.jsx(Kr,{open:t,children:a.jsxs(Or,{className:"w-[calc(100vw-2rem)] rounded-lg",children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:s("Want to view this lecture?")}),a.jsx(zr,{children:g?pn(s("{course} is a paid course. Buy access to watch this lecture and the rest of the course."),{course:e.title}):p?s("Your enrollment request is waiting for approval. You'll be able to watch this lecture after an admin accepts it."):pn(s("Enroll in {course} to watch this lecture and the rest of the course."),{course:e.title})})]}),a.jsxs(Br,{children:[a.jsx(Z,{asChild:!0,variant:"outline",children:a.jsx(vr,{to:ve.knowledgeCourse(e.id),children:s("Back to course")})}),g?a.jsx(Z,{asChild:!0,children:a.jsx(vr,{to:`${ve.knowledgeCourse(e.id)}?buy=1`,children:v?`${s("Buy now")} · ${v}`:s("Buy now")})}):p?a.jsx(Z,{disabled:!0,children:s("Request sent")}):a.jsxs(Z,{disabled:c,onClick:()=>void x(),children:[c?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):null,s(b?"Send request to enroll":"Enroll to view lecture")]})]})]})}),a.jsx(DIe,{open:u,group:m,onOpenChange:h,onJoined:async()=>{await l(),await x({skipGroupGate:!0})},onRequested:()=>void l()})]})}function Eps({course:t,sectionId:e,lesson:n,onLessonUpdated:r,onProgressChange:s,onCourseCompleted:i,onAdvanceToNext:o}){const l=Tn(),{toast:c}=yt(),{community:d}=qe(),u=Nn(),[h,m]=y.useState(!1),f=vps(t.sections,e,n.id,t.isAdmin);y.useEffect(()=>{const g=v=>{v.key==="ArrowLeft"&&f.prev&&u(ve.knowledgeLearn(t.id,f.prev.sectionId,f.prev.lessonId)),v.key==="ArrowRight"&&f.next&&u(ve.knowledgeLearn(t.id,f.next.sectionId,f.next.lessonId))};return window.addEventListener("keydown",g),()=>window.removeEventListener("keydown",g)},[t.id,f.prev,f.next,u]);const p=async()=>{if(d!=null&&d.id){m(!0);try{const g=n.isCompleted?await Emr(d.id,t.id,e,n.id):await jmr(d.id,t.id,e,n.id),v=!n.isCompleted,b=v&&$mr(t.sections,n.id);if(r({...n,isCompleted:v}),s==null||s(),b){const x=!!(g.karmaAwarded&&(g.karmaPoints??0)>0);i==null||i({awarded:x,points:x?g.karmaPoints??0:0})}else{const x=bps(t.sections,e,n.id);v&&x&&!x.isDripLocked?o==null||o(x):c({title:l(v?"Lesson completed":"Marked incomplete")})}}catch(g){const v=g instanceof ze?Dt(g.body,g.message):l("Something went wrong.");c({title:l("Could not update progress"),description:v,variant:"destructive"})}finally{m(!1)}}};return a.jsxs("footer",{className:"flex h-14 shrink-0 items-center justify-between border-t border-border bg-card px-4",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[f.prev?a.jsx(Z,{variant:"outline",size:"icon",asChild:!0,children:a.jsx(vr,{to:ve.knowledgeLearn(t.id,f.prev.sectionId,f.prev.lessonId),children:a.jsx(nl,{className:"h-4 w-4"})})}):a.jsx(Z,{variant:"outline",size:"icon",disabled:!0,children:a.jsx(nl,{className:"h-4 w-4"})}),f.next?a.jsx(Z,{variant:"outline",size:"icon",asChild:!0,children:a.jsx(vr,{to:ve.knowledgeLearn(t.id,f.next.sectionId,f.next.lessonId),children:a.jsx(io,{className:"h-4 w-4"})})}):a.jsx(Z,{variant:"outline",size:"icon",disabled:!0,children:a.jsx(io,{className:"h-4 w-4"})})]}),a.jsxs(Z,{variant:n.isCompleted?"outline":"default",disabled:h,onClick:p,children:[h?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):null,n.isCompleted?l("Mark incomplete"):l("Mark complete")]})]})}function Nps(t,e){return y.useReducer((n,r)=>e[n][r]??n,t)}var FIe="ScrollArea",[G$t,Sjs]=il(FIe),[Tps,cp]=G$t(FIe),W$t=y.forwardRef((t,e)=>{const{__scopeScrollArea:n,type:r="hover",dir:s,scrollHideDelay:i=600,...o}=t,[l,c]=y.useState(null),[d,u]=y.useState(null),[h,m]=y.useState(null),[f,p]=y.useState(null),[g,v]=y.useState(null),[b,x]=y.useState(0),[w,k]=y.useState(0),[S,C]=y.useState(!1),[j,E]=y.useState(!1),N=Sr(e,_=>c(_)),A=ES(s);return a.jsx(Tps,{scope:n,type:r,dir:A,scrollHideDelay:i,scrollArea:l,viewport:d,onViewportChange:u,content:h,onContentChange:m,scrollbarX:f,onScrollbarXChange:p,scrollbarXEnabled:S,onScrollbarXEnabledChange:C,scrollbarY:g,onScrollbarYChange:v,scrollbarYEnabled:j,onScrollbarYEnabledChange:E,onCornerWidthChange:x,onCornerHeightChange:k,children:a.jsx(Sn.div,{dir:A,...o,ref:N,style:{position:"relative","--radix-scroll-area-corner-width":b+"px","--radix-scroll-area-corner-height":w+"px",...t.style}})})});W$t.displayName=FIe;var q$t="ScrollAreaViewport",K$t=y.forwardRef((t,e)=>{const{__scopeScrollArea:n,children:r,nonce:s,...i}=t,o=cp(q$t,n),l=y.useRef(null),c=Sr(e,l,o.onViewportChange);return a.jsxs(a.Fragment,{children:[a.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}"},nonce:s}),a.jsx(Sn.div,{"data-radix-scroll-area-viewport":"",...i,ref:c,style:{overflowX:o.scrollbarXEnabled?"scroll":"hidden",overflowY:o.scrollbarYEnabled?"scroll":"hidden",...t.style},children:a.jsx("div",{ref:o.onContentChange,style:{minWidth:"100%",display:"table"},children:r})})]})});K$t.displayName=q$t;var ab="ScrollAreaScrollbar",BIe=y.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=cp(ab,t.__scopeScrollArea),{onScrollbarXEnabledChange:i,onScrollbarYEnabledChange:o}=s,l=t.orientation==="horizontal";return y.useEffect(()=>(l?i(!0):o(!0),()=>{l?i(!1):o(!1)}),[l,i,o]),s.type==="hover"?a.jsx(_ps,{...r,ref:e,forceMount:n}):s.type==="scroll"?a.jsx(Aps,{...r,ref:e,forceMount:n}):s.type==="auto"?a.jsx(Y$t,{...r,ref:e,forceMount:n}):s.type==="always"?a.jsx(UIe,{...r,ref:e}):null});BIe.displayName=ab;var _ps=y.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=cp(ab,t.__scopeScrollArea),[i,o]=y.useState(!1);return y.useEffect(()=>{const l=s.scrollArea;let c=0;if(l){const d=()=>{window.clearTimeout(c),o(!0)},u=()=>{c=window.setTimeout(()=>o(!1),s.scrollHideDelay)};return l.addEventListener("pointerenter",d),l.addEventListener("pointerleave",u),()=>{window.clearTimeout(c),l.removeEventListener("pointerenter",d),l.removeEventListener("pointerleave",u)}}},[s.scrollArea,s.scrollHideDelay]),a.jsx(Rl,{present:n||i,children:a.jsx(Y$t,{"data-state":i?"visible":"hidden",...r,ref:e})})}),Aps=y.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=cp(ab,t.__scopeScrollArea),i=t.orientation==="horizontal",o=bae(()=>c("SCROLL_END"),100),[l,c]=Nps("hidden",{hidden:{SCROLL:"scrolling"},scrolling:{SCROLL_END:"idle",POINTER_ENTER:"interacting"},interacting:{SCROLL:"interacting",POINTER_LEAVE:"idle"},idle:{HIDE:"hidden",SCROLL:"scrolling",POINTER_ENTER:"interacting"}});return y.useEffect(()=>{if(l==="idle"){const d=window.setTimeout(()=>c("HIDE"),s.scrollHideDelay);return()=>window.clearTimeout(d)}},[l,s.scrollHideDelay,c]),y.useEffect(()=>{const d=s.viewport,u=i?"scrollLeft":"scrollTop";if(d){let h=d[u];const m=()=>{const f=d[u];h!==f&&(c("SCROLL"),o()),h=f};return d.addEventListener("scroll",m),()=>d.removeEventListener("scroll",m)}},[s.viewport,i,c,o]),a.jsx(Rl,{present:n||l!=="hidden",children:a.jsx(UIe,{"data-state":l==="hidden"?"hidden":"visible",...r,ref:e,onPointerEnter:Kt(t.onPointerEnter,()=>c("POINTER_ENTER")),onPointerLeave:Kt(t.onPointerLeave,()=>c("POINTER_LEAVE"))})})}),Y$t=y.forwardRef((t,e)=>{const n=cp(ab,t.__scopeScrollArea),{forceMount:r,...s}=t,[i,o]=y.useState(!1),l=t.orientation==="horizontal",c=bae(()=>{if(n.viewport){const d=n.viewport.offsetWidth<n.viewport.scrollWidth,u=n.viewport.offsetHeight<n.viewport.scrollHeight;o(l?d:u)}},10);return Z5(n.viewport,c),Z5(n.content,c),a.jsx(Rl,{present:r||i,children:a.jsx(UIe,{"data-state":i?"visible":"hidden",...s,ref:e})})}),UIe=y.forwardRef((t,e)=>{const{orientation:n="vertical",...r}=t,s=cp(ab,t.__scopeScrollArea),i=y.useRef(null),o=y.useRef(0),[l,c]=y.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),d=eOt(l.viewport,l.content),u={...r,sizes:l,onSizesChange:c,hasThumb:d>0&&d<1,onThumbChange:m=>i.current=m,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:m=>o.current=m};function h(m,f){return Dps(m,o.current,l,f)}return n==="horizontal"?a.jsx(Pps,{...u,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const m=s.viewport.scrollLeft,f=nXe(m,l,s.dir);i.current.style.transform=`translate3d(${f}px, 0, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollLeft=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollLeft=h(m,s.dir))}}):n==="vertical"?a.jsx(Rps,{...u,ref:e,onThumbPositionChange:()=>{if(s.viewport&&i.current){const m=s.viewport.scrollTop,f=nXe(m,l);i.current.style.transform=`translate3d(0, ${f}px, 0)`}},onWheelScroll:m=>{s.viewport&&(s.viewport.scrollTop=m)},onDragScroll:m=>{s.viewport&&(s.viewport.scrollTop=h(m))}}):null}),Pps=y.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=cp(ab,t.__scopeScrollArea),[o,l]=y.useState(),c=y.useRef(null),d=Sr(e,c,i.onScrollbarXChange);return y.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(Z$t,{"data-orientation":"horizontal",...s,ref:d,sizes:n,style:{bottom:0,left:i.dir==="rtl"?"var(--radix-scroll-area-corner-width)":0,right:i.dir==="ltr"?"var(--radix-scroll-area-corner-width)":0,"--radix-scroll-area-thumb-width":yae(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.x),onDragScroll:u=>t.onDragScroll(u.x),onWheelScroll:(u,h)=>{if(i.viewport){const m=i.viewport.scrollLeft+u.deltaX;t.onWheelScroll(m),nOt(m,h)&&u.preventDefault()}},onResize:()=>{c.current&&i.viewport&&o&&r({content:i.viewport.scrollWidth,viewport:i.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:MX(o.paddingLeft),paddingEnd:MX(o.paddingRight)}})}})}),Rps=y.forwardRef((t,e)=>{const{sizes:n,onSizesChange:r,...s}=t,i=cp(ab,t.__scopeScrollArea),[o,l]=y.useState(),c=y.useRef(null),d=Sr(e,c,i.onScrollbarYChange);return y.useEffect(()=>{c.current&&l(getComputedStyle(c.current))},[c]),a.jsx(Z$t,{"data-orientation":"vertical",...s,ref:d,sizes:n,style:{top:0,right:i.dir==="ltr"?0:void 0,left:i.dir==="rtl"?0:void 0,bottom:"var(--radix-scroll-area-corner-height)","--radix-scroll-area-thumb-height":yae(n)+"px",...t.style},onThumbPointerDown:u=>t.onThumbPointerDown(u.y),onDragScroll:u=>t.onDragScroll(u.y),onWheelScroll:(u,h)=>{if(i.viewport){const m=i.viewport.scrollTop+u.deltaY;t.onWheelScroll(m),nOt(m,h)&&u.preventDefault()}},onResize:()=>{c.current&&i.viewport&&o&&r({content:i.viewport.scrollHeight,viewport:i.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:MX(o.paddingTop),paddingEnd:MX(o.paddingBottom)}})}})}),[Ips,Q$t]=G$t(ab),Z$t=y.forwardRef((t,e)=>{const{__scopeScrollArea:n,sizes:r,hasThumb:s,onThumbChange:i,onThumbPointerUp:o,onThumbPointerDown:l,onThumbPositionChange:c,onDragScroll:d,onWheelScroll:u,onResize:h,...m}=t,f=cp(ab,n),[p,g]=y.useState(null),v=Sr(e,N=>g(N)),b=y.useRef(null),x=y.useRef(""),w=f.viewport,k=r.content-r.viewport,S=Lo(u),C=Lo(c),j=bae(h,10);function E(N){if(b.current){const A=N.clientX-b.current.left,_=N.clientY-b.current.top;d({x:A,y:_})}}return y.useEffect(()=>{const N=A=>{const _=A.target;(p==null?void 0:p.contains(_))&&S(A,k)};return document.addEventListener("wheel",N,{passive:!1}),()=>document.removeEventListener("wheel",N,{passive:!1})},[w,p,k,S]),y.useEffect(C,[r,C]),Z5(p,j),Z5(f.content,j),a.jsx(Ips,{scope:n,scrollbar:p,hasThumb:s,onThumbChange:Lo(i),onThumbPointerUp:Lo(o),onThumbPositionChange:C,onThumbPointerDown:Lo(l),children:a.jsx(Sn.div,{...m,ref:v,style:{position:"absolute",...m.style},onPointerDown:Kt(t.onPointerDown,N=>{N.button===0&&(N.target.setPointerCapture(N.pointerId),b.current=p.getBoundingClientRect(),x.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect="none",f.viewport&&(f.viewport.style.scrollBehavior="auto"),E(N))}),onPointerMove:Kt(t.onPointerMove,E),onPointerUp:Kt(t.onPointerUp,N=>{const A=N.target;A.hasPointerCapture(N.pointerId)&&A.releasePointerCapture(N.pointerId),document.body.style.webkitUserSelect=x.current,f.viewport&&(f.viewport.style.scrollBehavior=""),b.current=null})})})}),IX="ScrollAreaThumb",J$t=y.forwardRef((t,e)=>{const{forceMount:n,...r}=t,s=Q$t(IX,t.__scopeScrollArea);return a.jsx(Rl,{present:n||s.hasThumb,children:a.jsx(Mps,{ref:e,...r})})}),Mps=y.forwardRef((t,e)=>{const{__scopeScrollArea:n,style:r,...s}=t,i=cp(IX,n),o=Q$t(IX,n),{onThumbPositionChange:l}=o,c=Sr(e,h=>o.onThumbChange(h)),d=y.useRef(void 0),u=bae(()=>{d.current&&(d.current(),d.current=void 0)},100);return y.useEffect(()=>{const h=i.viewport;if(h){const m=()=>{if(u(),!d.current){const f=$ps(h,l);d.current=f,l()}};return l(),h.addEventListener("scroll",m),()=>h.removeEventListener("scroll",m)}},[i.viewport,u,l]),a.jsx(Sn.div,{"data-state":o.hasThumb?"visible":"hidden",...s,ref:c,style:{width:"var(--radix-scroll-area-thumb-width)",height:"var(--radix-scroll-area-thumb-height)",...r},onPointerDownCapture:Kt(t.onPointerDownCapture,h=>{const f=h.target.getBoundingClientRect(),p=h.clientX-f.left,g=h.clientY-f.top;o.onThumbPointerDown({x:p,y:g})}),onPointerUp:Kt(t.onPointerUp,o.onThumbPointerUp)})});J$t.displayName=IX;var zIe="ScrollAreaCorner",X$t=y.forwardRef((t,e)=>{const n=cp(zIe,t.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!=="scroll"&&r?a.jsx(Lps,{...t,ref:e}):null});X$t.displayName=zIe;var Lps=y.forwardRef((t,e)=>{const{__scopeScrollArea:n,...r}=t,s=cp(zIe,n),[i,o]=y.useState(0),[l,c]=y.useState(0),d=!!(i&&l);return Z5(s.scrollbarX,()=>{var h;const u=((h=s.scrollbarX)==null?void 0:h.offsetHeight)||0;s.onCornerHeightChange(u),c(u)}),Z5(s.scrollbarY,()=>{var h;const u=((h=s.scrollbarY)==null?void 0:h.offsetWidth)||0;s.onCornerWidthChange(u),o(u)}),d?a.jsx(Sn.div,{...r,ref:e,style:{width:i,height:l,position:"absolute",right:s.dir==="ltr"?0:void 0,left:s.dir==="rtl"?0:void 0,bottom:0,...t.style}}):null});function MX(t){return t?parseInt(t,10):0}function eOt(t,e){const n=t/e;return isNaN(n)?0:n}function yae(t){const e=eOt(t.viewport,t.content),n=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,r=(t.scrollbar.size-n)*e;return Math.max(r,18)}function Dps(t,e,n,r="ltr"){const s=yae(n),i=s/2,o=e||i,l=s-o,c=n.scrollbar.paddingStart+o,d=n.scrollbar.size-n.scrollbar.paddingEnd-l,u=n.content-n.viewport,h=r==="ltr"?[0,u]:[u*-1,0];return tOt([c,d],h)(t)}function nXe(t,e,n="ltr"){const r=yae(e),s=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,i=e.scrollbar.size-s,o=e.content-e.viewport,l=i-r,c=n==="ltr"?[0,o]:[o*-1,0],d=eF(t,c);return tOt([0,o],[0,l])(d)}function tOt(t,e){return n=>{if(t[0]===t[1]||e[0]===e[1])return e[0];const r=(e[1]-e[0])/(t[1]-t[0]);return e[0]+r*(n-t[0])}}function nOt(t,e){return t>0&&t<e}var $ps=(t,e=()=>{})=>{let n={left:t.scrollLeft,top:t.scrollTop},r=0;return function s(){const i={left:t.scrollLeft,top:t.scrollTop},o=n.left!==i.left,l=n.top!==i.top;(o||l)&&e(),n=i,r=window.requestAnimationFrame(s)}(),()=>window.cancelAnimationFrame(r)};function bae(t,e){const n=Lo(t),r=y.useRef(0);return y.useEffect(()=>()=>window.clearTimeout(r.current),[]),y.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,e)},[n,e])}function Z5(t,e){const n=Lo(e);rl(()=>{let r=0;if(t){const s=new ResizeObserver(()=>{cancelAnimationFrame(r),r=window.requestAnimationFrame(n)});return s.observe(t),()=>{window.cancelAnimationFrame(r),s.unobserve(t)}}},[t,n])}var rOt=W$t,Ops=K$t,Fps=X$t;const sOt=y.forwardRef(({className:t,children:e,...n},r)=>a.jsxs(rOt,{ref:r,className:ee("relative overflow-hidden",t),...n,children:[a.jsx(Ops,{className:"h-full w-full rounded-[inherit]",children:e}),a.jsx(iOt,{}),a.jsx(Fps,{})]}));sOt.displayName=rOt.displayName;const iOt=y.forwardRef(({className:t,orientation:e="vertical",...n},r)=>a.jsx(BIe,{ref:r,orientation:e,className:ee("flex touch-none select-none transition-colors",e==="vertical"&&"h-full w-2.5 border-l border-l-transparent p-[1px]",e==="horizontal"&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",t),...n,children:a.jsx(J$t,{className:"relative flex-1 rounded-full bg-border"})}));iOt.displayName=BIe.displayName;function Bps({course:t,onCourseChange:e,onLessonDeleted:n}){const r=Tn(),[s,i]=y.useState(!1),o=t.isAdmin,l=o?t.sections:t.sections.filter(h=>h.lessons.some(m=>m.state==="published")),c=h=>{e({...t,sections:t.sections.map(m=>m.id===h.id?h:m)})},d=h=>{e({...t,sections:t.sections.filter(m=>m.id!==h)})},u=h=>{e({...t,sections:[...t.sections,h]})};return a.jsxs("div",{className:"flex h-full min-w-0 flex-col overflow-x-hidden border-r border-border bg-card",children:[a.jsx("div",{className:"border-b border-border px-4 py-3",children:a.jsx("h2",{className:"text-sm font-semibold text-foreground",children:r("Table of contents")})}),a.jsx(sOt,{className:"min-w-0 flex-1 [&>[data-radix-scroll-area-viewport]>div]:!block",children:a.jsxs("div",{className:"min-w-0 space-y-2 p-2",children:[l.length===0?a.jsx("p",{className:"px-2 py-6 text-center text-xs text-muted-foreground",children:r(o?"Add a section to start building content.":"No lessons available yet.")}):l.map(h=>a.jsx(I$t,{courseId:t.id,section:h,isAdmin:o,deliveryMode:t.deliveryMode,onSectionChange:c,onSectionDelete:d,onLessonDeleted:n},h.id)),o?a.jsxs(Z,{variant:"outline",size:"sm",className:"mx-2 w-[calc(100%-1rem)] border-dashed",onClick:()=>i(!0),children:[a.jsx(Dn,{className:"mr-2 h-4 w-4"}),r("Add section")]}):null]})}),a.jsx($Ie,{open:s,onOpenChange:i,courseId:t.id,deliveryMode:t.deliveryMode,onSaved:u})]})}function aOt({value:t,onChange:e,placeholder:n,minHeight:r=160}){const s=y.useRef(null);y.useEffect(()=>{s.current&&s.current.innerHTML!==t&&(s.current.innerHTML=t||"")},[t]);const i=y.useRef(null),o=()=>{var h;const u=window.getSelection();u&&u.rangeCount>0&&((h=s.current)!=null&&h.contains(u.anchorNode))&&(i.current=u.getRangeAt(0).cloneRange())},l=(u,h)=>{const m=s.current;if(!m)return;const f=window.getSelection(),p=!!f&&f.rangeCount>0&&m.contains(f.anchorNode);m.focus(),f&&!p&&i.current&&(f.removeAllRanges(),f.addRange(i.current)),document.execCommand(u,!1,h),o(),e(m.innerHTML)},c=()=>{const u=window.prompt("Link URL (https://…)");u&&/^https?:\/\//i.test(u)&&l("createLink",u)},d=[{icon:a.jsx(aee,{className:"h-3.5 w-3.5"}),title:"Bold",onClick:()=>l("bold")},{icon:a.jsx(cee,{className:"h-3.5 w-3.5"}),title:"Italic",onClick:()=>l("italic")},{icon:a.jsx(jSe,{className:"h-3.5 w-3.5"}),title:"Underline",onClick:()=>l("underline")},{icon:a.jsx(MBt,{className:"h-3.5 w-3.5"}),title:"Heading",onClick:()=>l("formatBlock","<h2>")},{icon:a.jsx(rI,{className:"h-3.5 w-3.5"}),title:"Bullet list",onClick:()=>l("insertUnorderedList")},{icon:a.jsx(uee,{className:"h-3.5 w-3.5"}),title:"Numbered list",onClick:()=>l("insertOrderedList")},{icon:a.jsx(Drt,{className:"h-3.5 w-3.5"}),title:"Link",onClick:c}];return a.jsxs("div",{className:"rounded-md border border-border",children:[a.jsx("div",{className:"flex flex-wrap gap-1 border-b border-border bg-muted/40 px-2 py-1.5",children:d.map(u=>a.jsx("button",{type:"button",title:u.title,onMouseDown:h=>h.preventDefault(),onClick:u.onClick,className:"rounded p-1.5 text-muted-foreground hover:bg-muted hover:text-foreground",children:u.icon},u.title))}),a.jsx("div",{ref:s,contentEditable:!0,role:"textbox","aria-multiline":"true","data-placeholder":n,className:"rich-html prose prose-sm dark:prose-invert max-w-none px-3 py-2 text-sm text-foreground outline-none empty:before:text-muted-foreground empty:before:content-[attr(data-placeholder)]",style:{minHeight:r},onInput:()=>s.current&&e(s.current.innerHTML),onKeyUp:o,onMouseUp:o,onBlur:o})]})}function VIe({url:t,height:e,title:n="Embedded content",className:r}){const s=qk($N(t))??"about:blank",i=$9(s);return a.jsx("iframe",{title:n,src:s,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0,referrerPolicy:"strict-origin-when-cross-origin",sandbox:i?void 0:"allow-scripts allow-popups allow-forms allow-presentation",className:ee("w-full rounded-lg border border-border bg-black",r),style:e?{height:`${e}px`}:void 0})}const Ups=Object.keys(mj),zps={text:"Write rich text for this lesson.",attachment:"Upload any file or paste a file URL.",pdf:"Upload a PDF or paste a link. Learners open it from this lesson.",audio:"Upload audio or paste an audio URL.",embed:"Paste a YouTube, Vimeo, or page URL.",quiz:"Choose single or multiple choice, then add questions. Learners get a score after submitting.",question:"A single question, multiple choice or open-ended.",assignment:"Describe the assignment. Learners submit in the lesson discussion."};function Ahe(t){return structuredClone(t)}function oOt(t){return t.replace(/<[^>]+>/g," ").replace(/\s+/g," ").trim()}function rXe(t){switch(t.kind){case"text":return!!oOt(t.html);case"attachment":case"pdf":case"audio":case"embed":return!!t.url.trim();case"quiz":return t.choiceType!=="single"&&t.choiceType!=="multiple"?!1:t.questions.length>0&&t.questions.every(e=>rps(e,t.choiceType));case"question":return!!t.question.prompt.trim();case"assignment":return!!t.instructions.trim();default:return!1}}function Vps(t){var e;switch(t.kind){case"text":return oOt(t.html)||"Empty text";case"attachment":case"pdf":case"audio":return t.name.trim()||t.url.trim()||"No file yet";case"embed":return t.url.trim()||"No URL yet";case"quiz":{const n=t.questions.length,r=(e=t.title)==null?void 0:e.trim(),s=t.choiceType==="multiple"?"Multiple choice":t.choiceType==="single"?"Single choice":null,i=`${n} question${n===1?"":"s"}`;return r&&s?`${r} · ${s} · ${i}`:r?`${r} · ${i}`:s?`${s} · ${i}`:i}case"question":return t.question.prompt.trim()||"Untitled question";case"assignment":return t.instructions.trim()||"No instructions yet";default:return t.raw.type||"Unknown block"}}function Hps(t){return t.kind==="unknown"?null:t.kind}function Gps(){var t,e;return((e=(t=globalThis.crypto)==null?void 0:t.randomUUID)==null?void 0:e.call(t))??`block-${Date.now()}-${Math.random().toString(16).slice(2)}`}function Wps(t){switch(t){case"text":return{kind:"text",html:""};case"attachment":return{kind:"attachment",url:"",name:""};case"pdf":return{kind:"pdf",url:"",name:""};case"audio":return{kind:"audio",url:"",name:""};case"embed":return{kind:"embed",url:""};case"quiz":return{kind:"quiz",title:"",questions:[]};case"question":return{kind:"question",question:{prompt:"",options:[],answerIndex:-1,explanation:""}};case"assignment":return{kind:"assignment",instructions:""}}}function qps(t,e){return ON(t).map((n,r)=>({id:`saved-${e}-${r}`,persisted:!0,data:n}))}function Kps({courseId:t,sectionId:e,lessonId:n,blocks:r,onBlocksSaved:s}){const{toast:i}=yt(),{community:o}=qe(),[l,c]=y.useState([]),[d,u]=y.useState(!1),[h,m]=y.useState(!1),[f,p]=y.useState(null),[g,v]=y.useState(null),b=y.useMemo(()=>JSON.stringify(r??[]),[r]);y.useEffect(()=>{c(qps(JSON.parse(b),n)),m(!1),p(null),v(null)},[n,b]);const x=l.some(R=>R.data.kind==="embed"),w=l.find(R=>R.id===f)??null,k=(R,O)=>{c(F=>{const D=[...F],I=R+O;return I<0||I>=D.length?F:([D[R],D[I]]=[D[I],D[R]],D)}),m(!0)},S=async R=>{if(!(o!=null&&o.id))return!1;u(!0);try{const O=O$t(R.map(F=>F.data));return await TEt(o.id,t,e,n,{blocks:O}),s(O),c(R.map(F=>({...F,persisted:!0}))),m(!1),!0}catch(O){const F=O instanceof ze?Dt(O.body,O.message):"Something went wrong.";return i({title:"Could not save lesson content",description:F,variant:"destructive"}),!1}finally{u(!1)}},C=R=>{c(O=>O.filter(F=>F.id!==R)),m(!0)},j=R=>{if(R.persisted){p(R.id);return}C(R.id)},E=async()=>{const R=f;if(!R)return;const O=l.filter(D=>D.id!==R);await S(O)&&(p(null),i({title:"Block deleted"}))},N=R=>{if(R==="embed"&&x){i({title:"Only one embed per lesson",description:"Delete the existing embed if you want to add a different one."});return}v({mode:"add",kind:R,draft:Wps(R)})},A=R=>{const O=l[R],F=Hps(O.data);if(!F)return;let D=Ahe(O.data);D.kind==="quiz"&&D.choiceType!=="single"&&D.choiceType!=="multiple"&&(D={...D,choiceType:"single",questions:U$t(D.questions,"single")}),v({mode:"edit",index:R,kind:F,draft:D})},_=()=>{if(!(!g||!rXe(g.draft))){if(g.mode==="add")c(R=>[...R,{id:Gps(),persisted:!1,data:Ahe(g.draft)}]);else{const{index:R,draft:O}=g;c(F=>F.map((D,I)=>I===R?{...D,data:Ahe(O)}:D))}m(!0),v(null)}},T=async()=>{await S(l)&&i({title:"Lesson content saved"})};return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsx(_e,{className:"text-base",children:"Content blocks"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsxs(Z,{variant:"outline",size:"sm",children:[a.jsx(Dn,{className:"mr-1.5 h-4 w-4"})," Add block"]})}),a.jsx(Cr,{align:"end",children:Ups.map(R=>{const O=R==="embed"&&x;return a.jsxs(ot,{disabled:O,onSelect:()=>{O||N(R)},children:[mj[R],O?" (1 per lesson)":""]},R)})})]}),a.jsxs(Z,{size:"sm",disabled:!h||d,onClick:()=>void T(),children:[d?a.jsx(Ne,{className:"mr-1.5 h-4 w-4 animate-spin"}):null,"Save content"]})]})]}),l.length===0?a.jsx("p",{className:"rounded-lg border border-dashed border-border p-4 text-sm text-muted-foreground",children:"No content blocks yet. Add text, files, media, embeds or a quiz."}):a.jsx("div",{className:"space-y-2",children:l.map((R,O)=>a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-card px-3 py-2",children:[a.jsxs("button",{type:"button",className:"min-w-0 flex-1 text-left",onClick:()=>A(O),children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:R.data.kind==="unknown"?R.data.raw.type:mj[R.data.kind]}),a.jsx("p",{className:"truncate text-sm text-foreground",children:Vps(R.data)})]}),a.jsxs("span",{className:"flex shrink-0 gap-1",children:[a.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7",title:"Edit",onClick:()=>A(O),children:a.jsx(Qs,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>k(O,-1),children:a.jsx(Zf,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:()=>k(O,1),children:a.jsx(w0,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive",disabled:d,onClick:()=>j(R),children:a.jsx(qn,{className:"h-3.5 w-3.5"})})]})]},R.id))}),a.jsx(Bt,{open:!!g,onOpenChange:R=>!R&&v(null),children:a.jsxs(Ft,{className:(g==null?void 0:g.kind)==="quiz"||(g==null?void 0:g.kind)==="text"?"w-[calc(100vw-2rem)] rounded-lg max-h-[85vh] overflow-y-auto sm:max-w-2xl":"w-[calc(100vw-2rem)] rounded-lg max-h-[85vh] overflow-y-auto",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:g?`${g.mode==="add"?"Add":"Edit"} ${mj[g.kind]}`:"Content block"}),a.jsx(_n,{children:g?zps[g.kind]:"Configure this content block."})]}),g?a.jsx(Yps,{block:g.draft,onChange:R=>v({...g,draft:R})}):null,a.jsxs(ir,{children:[a.jsx(Z,{variant:"outline",onClick:()=>v(null),children:"Cancel"}),a.jsx(Z,{disabled:!g||!rXe(g.draft),onClick:_,children:(g==null?void 0:g.mode)==="edit"?"Save block":`Add ${g?mj[g.kind].toLowerCase():"block"}`})]})]})}),a.jsx(Kr,{open:!!w,onOpenChange:R=>!R&&p(null),children:a.jsxs(Or,{className:"w-[calc(100vw-2rem)] rounded-lg",children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Are you sure you want to delete the block?"}),a.jsxs(zr,{children:["This removes the saved"," ",w?w.data.kind==="unknown"?w.data.raw.type:mj[w.data.kind].toLowerCase():"content"," ","block from this lesson."]})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:d,children:"No"}),a.jsxs(Yr,{disabled:d,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:R=>{R.preventDefault(),E()},children:[d?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Yes"]})]})]})})]})}function Yps({block:t,onChange:e}){switch(t.kind){case"text":return a.jsx(aOt,{value:t.html,minHeight:120,placeholder:"Write content…",onChange:n=>e({...t,html:n})});case"attachment":case"pdf":case"audio":return a.jsx(Qps,{block:t,onChange:e});case"embed":return a.jsxs("div",{className:"space-y-2",children:[a.jsx(Oe,{value:t.url,placeholder:"Paste a YouTube, Vimeo, or page URL",onChange:n=>e({...t,url:n.target.value})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"A normal YouTube link works. After you save, it plays in Video lecture above."}),t.url.trim()&&$9($N(t.url))?a.jsx(VIe,{url:t.url,height:t.height??280,title:"YouTube preview"}):null,a.jsx(Oe,{type:"number",value:t.height??"",placeholder:"Height in px (default 420)",onChange:n=>e({...t,height:n.target.value?Number(n.target.value):void 0})})]});case"quiz":return a.jsxs("div",{className:"space-y-3",children:[a.jsx(Oe,{value:t.title??"",placeholder:"Quiz title (optional)",onChange:n=>e({...t,title:n.target.value})}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(_e,{children:["Question type ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsxs(TS,{value:t.choiceType??"",onValueChange:n=>{const r=n,s=U$t(t.questions.length>0?t.questions:[JJe(r)],r);e({...t,choiceType:r,questions:s})},className:"grid gap-2 sm:grid-cols-2",children:[a.jsxs("label",{htmlFor:"quiz-choice-single",className:`flex cursor-pointer gap-3 rounded-lg border p-3 transition-colors ${t.choiceType==="single"?"border-primary bg-primary/5":"border-border"}`,children:[a.jsx(Ly,{value:"single",id:"quiz-choice-single",className:"mt-0.5"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"Single choice"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Learners pick one correct answer."})]})]}),a.jsxs("label",{htmlFor:"quiz-choice-multiple",className:`flex cursor-pointer gap-3 rounded-lg border p-3 transition-colors ${t.choiceType==="multiple"?"border-primary bg-primary/5":"border-border"}`,children:[a.jsx(Ly,{value:"multiple",id:"quiz-choice-multiple",className:"mt-0.5"}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium",children:"Multiple choice"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Learners select every correct answer."})]})]})]})]}),t.choiceType?a.jsxs(a.Fragment,{children:[t.questions.map((n,r)=>a.jsx(sXe,{question:n,choiceType:t.choiceType??"single",name:`quiz-q-${r}`,onChange:s=>e({...t,questions:t.questions.map((i,o)=>o===r?s:i)}),onRemove:t.questions.length>1?()=>e({...t,questions:t.questions.filter((s,i)=>i!==r)}):void 0},r)),a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>e({...t,questions:[...t.questions,JJe(t.choiceType??"single")]}),children:[a.jsx(Dn,{className:"mr-1.5 h-3.5 w-3.5"})," Add question"]})]}):a.jsx("p",{className:"rounded-md border border-dashed border-border px-3 py-4 text-sm text-muted-foreground",children:"Select single or multiple choice to add questions."})]});case"question":return a.jsx(sXe,{question:t.question,allowOpenEnded:!0,onChange:n=>e({...t,question:n})});case"assignment":return a.jsx(us,{value:t.instructions,rows:4,placeholder:"Assignment instructions… (learners submit via the lesson discussion)",onChange:n=>e({...t,instructions:n.target.value})});default:return a.jsx("p",{className:"text-xs text-muted-foreground",children:"Unsupported block type — kept as-is when saving."})}}function Qps({block:t,onChange:e}){const{toast:n}=yt(),{community:r}=qe(),[s,i]=y.useState(!1),o=t.kind==="pdf"?"application/pdf":t.kind==="audio"?"audio/*":void 0,l=async c=>{if(!(!c||!(r!=null&&r.id))){i(!0);try{const d=await Lmr(r.id,c);e({...t,url:d,name:t.name||c.name})}catch{n({title:"Upload failed",variant:"destructive"})}finally{i(!1)}}};return a.jsxs("div",{className:"space-y-3",children:[a.jsx(Oe,{value:t.name,placeholder:"Display name",onChange:c=>e({...t,name:c.target.value})}),a.jsxs("label",{className:"flex min-h-[140px] cursor-pointer flex-col items-center justify-center gap-2 rounded-md border border-dashed border-border bg-muted/30 px-4 py-6 text-center hover:bg-muted/50",onDragOver:c=>{c.preventDefault()},onDrop:c=>{var d;c.preventDefault(),l((d=c.dataTransfer.files)==null?void 0:d[0])},children:[s?a.jsx(Ne,{className:"h-5 w-5 animate-spin text-muted-foreground"}):a.jsx(kd,{className:"h-5 w-5 text-muted-foreground"}),a.jsx("span",{className:"text-sm text-foreground",children:t.url?"Replace file":`Drop your ${t.kind} here or click to upload`}),a.jsx("span",{className:"text-xs text-muted-foreground",children:t.kind==="pdf"?"PDF files":t.kind==="audio"?"Audio files":"Any file"}),a.jsx("input",{type:"file",accept:o,className:"sr-only",onChange:c=>{var d;return void l((d=c.target.files)==null?void 0:d[0])}})]}),a.jsx(Oe,{value:t.url,placeholder:"Or paste a file URL",onChange:c=>e({...t,url:c.target.value})})]})}function sXe({question:t,onChange:e,onRemove:n,allowOpenEnded:r,choiceType:s="single",name:i}){var h;const o=(((h=t.options)==null?void 0:h.length)??0)>0,l=s==="multiple",c=h2(l?t.answerIndexes:[t.answerIndex]),d=(m,f)=>{if(l){const p=f?h2([...c,m]):c.filter(g=>g!==m);e({...t,answerIndexes:p,answerIndex:void 0});return}e({...t,answerIndex:m,answerIndexes:void 0})},u=m=>{const f=t.options.filter((g,v)=>v!==m),p=h2(c.map(g=>g===m?-1:g>m?g-1:g).filter(g=>g>=0));if(l){e({...t,options:f,answerIndexes:p,answerIndex:void 0});return}e({...t,options:f,answerIndex:p[0]??0,answerIndexes:void 0})};return a.jsxs("div",{className:"space-y-2 rounded-md border border-border/70 p-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Oe,{value:t.prompt,placeholder:"Question prompt",onChange:m=>e({...t,prompt:m.target.value})}),n?a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-destructive",onClick:n,children:a.jsx(qn,{className:"h-3.5 w-3.5"})}):null]}),o?a.jsx("p",{className:"text-xs text-muted-foreground",children:l?"Mark every correct answer.":"Mark the correct answer."}):null,o?t.options.map((m,f)=>a.jsxs("div",{className:"flex items-center gap-2",children:[l?a.jsx(ji,{checked:c.includes(f),onCheckedChange:p=>d(f,p===!0),"aria-label":`Mark option ${f+1} as correct`}):a.jsx("input",{type:"radio",name:i||"quiz-answer",checked:t.answerIndex===f,onChange:()=>d(f,!0),title:"Correct answer"}),a.jsx(Oe,{value:m,placeholder:`Option ${f+1}`,onChange:p=>e({...t,options:t.options.map((g,v)=>v===f?p.target.value:g)})}),t.options.length>2?a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",onClick:()=>u(f),children:a.jsx(qn,{className:"h-3.5 w-3.5"})}):null]},f)):null,a.jsxs("div",{className:"flex flex-wrap gap-2",children:[o?a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>e({...t,options:[...t.options,""]}),children:[a.jsx(Dn,{className:"mr-1 h-3.5 w-3.5"})," Option"]}):null,r?a.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>e(o?{...t,options:[],answerIndex:-1,answerIndexes:void 0}:{...t,options:["",""],answerIndex:0,answerIndexes:void 0}),children:o?"Make open-ended":"Make multiple choice"}):null]}),a.jsx(Oe,{value:t.explanation??"",placeholder:"Explanation shown after answering (optional)",onChange:m=>e({...t,explanation:m.target.value})})]})}function Zps(t,e){const n=t.user;return n&&typeof n=="object"?{id:String(n._id??n.id??""),name:n.name??e("Member"),picture:n.picture??void 0}:{id:typeof n=="string"?n:"",name:e("Member")}}function lOt({courseId:t,sectionId:e,lessonId:n}){const r=Tn(),{toast:s}=yt(),{user:i}=jr(),{community:o}=qe(),l=(o==null?void 0:o.id)??null,[c,d]=y.useState([]),[u,h]=y.useState(!0),[m,f]=y.useState(!1),[p,g]=y.useState(1),[v,b]=y.useState(""),[x,w]=y.useState(!1),[k,S]=y.useState(null),[C,j]=y.useState("");y.useEffect(()=>{if(!l)return;let T=!1;return h(!0),d([]),g(1),DVe(l,t,e,n,1).then(R=>{T||(d(R.comments??[]),f((R.comments??[]).length>=20))}).catch(()=>{}).finally(()=>!T&&h(!1)),()=>{T=!0}},[l,t,e,n]);const E=async()=>{if(!l)return;const T=p+1,R=await DVe(l,t,e,n,T);d(O=>[...O,...R.comments??[]]),g(T),f((R.comments??[]).length>=20)},N=async()=>{const T=v.trim();if(!(!T||!l)){w(!0);try{const R=await _mr(l,t,e,n,{description:T});R.comment&&d(O=>[...O,{...R.comment,user:{id:i==null?void 0:i.id,name:i?`${i.firstName} ${i.lastName}`.trim():r("You")}}]),b("")}catch{s({title:r("Could not post your comment"),variant:"destructive"})}finally{w(!1)}}},A=async T=>{const R=C.trim();if(R)try{await Imr(T,{description:R}),d(O=>O.map(F=>F.id===T?{...F,description:R}:F)),S(null)}catch{s({title:r("Could not update the comment"),variant:"destructive"})}},_=async T=>{try{await Mmr(T),d(R=>R.filter(O=>O.id!==T))}catch{s({title:r("Could not delete the comment"),variant:"destructive"})}};return a.jsxs("section",{className:"space-y-4 border-t border-border pt-6",children:[a.jsxs("h2",{className:"flex items-center gap-2 text-base font-semibold text-foreground",children:[a.jsx(Vi,{className:"h-4 w-4 text-primary"}),r("Discussion")," ",c.length>0?`(${c.length})`:""]}),u?a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"})," ",r("Loading comments…")]}):c.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:r("No comments yet — start the discussion.")}):a.jsx("ul",{className:"space-y-4",children:c.map(T=>{const R=Zps(T,r),O=!!(i!=null&&i.id)&&R.id===(i==null?void 0:i.id);return a.jsxs("li",{className:"flex gap-3",children:[a.jsx("img",{src:o7(R.picture,R.name),alt:"",className:"h-8 w-8 shrink-0 rounded-full object-cover"}),a.jsxs("div",{className:"min-w-0 flex-1 rounded-lg bg-muted/50 px-3 py-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"text-sm font-medium text-foreground",children:R.name}),a.jsx("span",{className:"text-xs text-muted-foreground",children:yc(T.createdAt)}),O&&k!==T.id?a.jsxs("span",{className:"ml-auto flex gap-1",children:[a.jsx("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground",onClick:()=>{S(T.id),j(T.description??"")},children:a.jsx(Qs,{className:"h-3.5 w-3.5"})}),a.jsx("button",{type:"button",className:"rounded p-1 text-muted-foreground hover:bg-muted hover:text-destructive",onClick:()=>void _(T.id),children:a.jsx(qn,{className:"h-3.5 w-3.5"})})]}):null]}),k===T.id?a.jsxs("div",{className:"mt-2 space-y-2",children:[a.jsx(us,{value:C,rows:2,onChange:F=>j(F.target.value)}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Z,{size:"sm",onClick:()=>void A(T.id),children:r("Save")}),a.jsx(Z,{size:"sm",variant:"ghost",onClick:()=>S(null),children:r("Cancel")})]})]}):a.jsx("p",{className:"mt-1 whitespace-pre-wrap text-sm text-foreground/90",children:T.description})]})]},T.id)})}),m?a.jsx(Z,{variant:"ghost",size:"sm",onClick:()=>void E(),children:r("Load more comments")}):null,a.jsxs("div",{className:"flex items-start gap-2",children:[a.jsx(us,{value:v,rows:2,placeholder:r("Add to the discussion…"),onChange:T=>b(T.target.value),onKeyDown:T=>{T.key==="Enter"&&(T.metaKey||T.ctrlKey)&&N()}}),a.jsx(Z,{size:"icon",disabled:x||!v.trim(),onClick:()=>void N(),children:x?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsx(_s,{className:"h-4 w-4"})})]})]})}const Jps=["video/webm;codecs=vp9,opus","video/webm;codecs=vp8,opus","video/webm","video/mp4"];function Xps(){return typeof MediaRecorder>"u"||typeof MediaRecorder.isTypeSupported!="function"?"video/webm":Jps.find(t=>MediaRecorder.isTypeSupported(t))??"video/webm"}function egs(t){return t.toLowerCase().includes("mp4")?"mp4":"webm"}function tgs(t,e=t.type,n=Date.now()){const r=(e||"video/webm").split(";")[0]||"video/webm",s=egs(r);return new File([t],`lecture-clip-${n}.${s}`,{type:r})}function ngs(t){const e=Math.floor(t/60),n=t%60;return`${e}:${n.toString().padStart(2,"0")}`}function iXe(t,e,n){var s;return((s=t.label)==null?void 0:s.trim())||`${n} ${e+1}`}async function aXe(t,e=8e3){t.videoWidth>0&&t.videoHeight>0||await new Promise((n,r)=>{const s=window.setTimeout(()=>r(new Error("Camera or screen preview failed to start.")),e),i=()=>{t.videoWidth<=0||(window.clearTimeout(s),t.removeEventListener("loadeddata",i),n())};t.addEventListener("loadeddata",i)})}async function rgs(t){const e=t.filter(i=>i.readyState==="live");if(e.length===0)return null;if(e.length===1)return{track:e[0],close:()=>{}};const n=new AudioContext;n.state==="suspended"&&await n.resume();const r=n.createMediaStreamDestination();for(const i of e)n.createMediaStreamSource(new MediaStream([i])).connect(r);const s=r.stream.getAudioTracks()[0];return s?{track:s,close:()=>{n.close()}}:(await n.close(),null)}function sgs(t,e,n,r,s,i){const o=Math.min(i,r/2,s/2);t.beginPath(),t.moveTo(e+o,n),t.arcTo(e+r,n,e+r,n+s,o),t.arcTo(e+r,n+s,e,n+s,o),t.arcTo(e,n+s,e,n,o),t.arcTo(e,n,e+r,n,o),t.closePath()}function igs(t){const e=t.fps??30,n=document.createElement("canvas"),r=1920,s=1080,i=t.screenVideo.videoWidth||1280,o=t.screenVideo.videoHeight||720,l=Math.min(1,r/i,s/o);n.width=Math.max(640,Math.round(i*l)),n.height=Math.max(360,Math.round(o*l)),n.style.position="fixed",n.style.left="-9999px",document.body.appendChild(n);const c=n.getContext("2d");if(!c)throw n.remove(),new Error("Could not start screen recording.");const d=()=>{c.fillStyle="#000",c.fillRect(0,0,n.width,n.height),t.screenVideo.readyState>=2&&c.drawImage(t.screenVideo,0,0,n.width,n.height);const m=t.cameraVideo;if(m&&m.readyState>=2&&m.videoWidth>0){const f=Math.round(n.width*.22),p=m.videoWidth/m.videoHeight||16/9,g=Math.round(f/p),v=n.width-f-24,b=n.height-g-24;c.save(),sgs(c,v,b,f,g,16),c.clip(),c.drawImage(m,v,b,f,g),c.restore()}},u=window.setInterval(d,1e3/e),h=n.captureStream(e);return{stream:h,stop:()=>{window.clearInterval(u),h.getTracks().forEach(m=>m.stop()),n.remove()}}}const kb="off",Sb="off";function Cb(t){t==null||t.getTracks().forEach(e=>e.stop())}function ags({open:t,onOpenChange:e,onRecorded:n}){const{toast:r}=yt(),[s,i]=y.useState("live"),[o,l]=y.useState(!1),[c,d]=y.useState(!1),[u,h]=y.useState(!1),[m,f]=y.useState(0),[p,g]=y.useState([]),[v,b]=y.useState([]),[x,w]=y.useState(kb),[k,S]=y.useState(Sb),[C,j]=y.useState(!1),[E,N]=y.useState(null),A=y.useRef(null),_=y.useRef(null),T=y.useRef(null),R=y.useRef(null),O=y.useRef(null),F=y.useRef(null),D=y.useRef([]),I=y.useRef(null),P=y.useRef("video/webm"),M=y.useRef(null),z=y.useRef(null),G=y.useRef(null),B=y.useRef(0),H=x!==kb,W=k!==Sb,V=H||C,U=y.useCallback(async()=>{var Ie;if(!((Ie=navigator.mediaDevices)!=null&&Ie.enumerateDevices))return;const pe=await navigator.mediaDevices.enumerateDevices();g(pe.filter(Me=>Me.kind==="videoinput")),b(pe.filter(Me=>Me.kind==="audioinput"))},[]),ne=(pe,Ie)=>{pe&&(pe.srcObject=Ie,Ie&&pe.play().catch(()=>{}))},te=()=>{var pe,Ie,Me;((pe=F.current)==null?void 0:pe.state)==="recording"&&F.current.stop(),F.current=null,(Ie=M.current)==null||Ie.stop(),M.current=null,(Me=z.current)==null||Me.call(z),z.current=null,G.current&&window.clearInterval(G.current),G.current=null},re=y.useCallback(()=>{te(),Cb(T.current),Cb(R.current),Cb(O.current),T.current=null,R.current=null,O.current=null,ne(A.current,null),ne(_.current,null),d(!1),h(!1),f(0),j(!1),w(kb),S(Sb),i("live"),I.current=null,N(pe=>(pe&&URL.revokeObjectURL(pe),null))},[]),fe=y.useCallback(async pe=>{var Be;const Ie=pe&&pe!==kb?{deviceId:{exact:pe},width:{ideal:1280},height:{ideal:720}}:{width:{ideal:1280},height:{ideal:720}},Me=await navigator.mediaDevices.getUserMedia({video:Ie});Cb(T.current),T.current=Me,ne(A.current,Me);const we=((Be=Me.getVideoTracks()[0])==null?void 0:Be.getSettings().deviceId)||pe||kb;return w(we),Me},[]),le=y.useCallback(async pe=>{var Be;const Ie=pe&&pe!==Sb?{deviceId:{exact:pe}}:!0,Me=await navigator.mediaDevices.getUserMedia({audio:Ie});Cb(R.current),R.current=Me;const we=((Be=Me.getAudioTracks()[0])==null?void 0:Be.getSettings().deviceId)||pe||Sb;return S(we),Me},[]);y.useEffect(()=>{var we,Be;if(!t){re();return}const pe=++B.current;l(!0),i("live"),(async()=>{var Ve;if(!((Ve=navigator.mediaDevices)!=null&&Ve.getUserMedia)){r({title:"Recording not supported",description:"Use the latest Chrome or Edge to record a lecture.",variant:"destructive"});return}try{await fe()}catch{w(kb)}if(pe===B.current){try{await le()}catch{S(Sb)}pe===B.current&&await U()}})().finally(()=>{pe===B.current&&l(!1)});const Me=()=>void U();return(Be=(we=navigator.mediaDevices)==null?void 0:we.addEventListener)==null||Be.call(we,"devicechange",Me),()=>{var Ve,be;(be=(Ve=navigator.mediaDevices)==null?void 0:Ve.removeEventListener)==null||be.call(Ve,"devicechange",Me),B.current+=1,re()}},[t,U,fe,le,re,r]);const q=async pe=>{if(!c){if(pe===kb){Cb(T.current),T.current=null,ne(A.current,null),w(kb);return}try{await fe(pe),await U()}catch{r({title:"Camera unavailable",description:"Allow camera access to include yourself in the lecture.",variant:"destructive"})}}},Y=async pe=>{if(!c){if(pe===Sb){Cb(R.current),R.current=null,S(Sb);return}try{await le(pe),await U()}catch{r({title:"Microphone unavailable",description:"Allow microphone access to record your voice.",variant:"destructive"})}}},X=()=>{Cb(O.current),O.current=null,ne(_.current,null),j(!1)},Q=async()=>{var pe;if(!c){if(C){X();return}try{const Ie=await navigator.mediaDevices.getDisplayMedia({video:{frameRate:30,width:{ideal:1920},height:{ideal:1080}},audio:!0});Cb(O.current),O.current=Ie,ne(_.current,Ie),j(!0),(pe=Ie.getVideoTracks()[0])==null||pe.addEventListener("ended",()=>{var Me;X(),((Me=F.current)==null?void 0:Me.state)==="recording"&&F.current.stop()})}catch{r({title:"Screen share cancelled",description:"Choose a window or screen to include slides in the lecture."})}}},ie=async()=>{var pe,Ie;if(!V){r({title:"Nothing to record",description:"Turn on your camera or share your screen first.",variant:"destructive"});return}h(!0);try{const Me=Xps();P.current=Me,D.current=[],I.current=null;let we;if(C&&_.current){await aXe(_.current),H&&A.current&&await aXe(A.current).catch(()=>{});const Ke=igs({screenVideo:_.current,cameraVideo:H?A.current:null});M.current=Ke,we=Ke.stream}else if(T.current)we=new MediaStream(T.current.getVideoTracks());else throw new Error("No video source");const Be=[...((pe=R.current)==null?void 0:pe.getAudioTracks())??[],...((Ie=O.current)==null?void 0:Ie.getAudioTracks())??[]],Ve=await rgs(Be);z.current=(Ve==null?void 0:Ve.close)??null;const be=new MediaStream([...we.getVideoTracks(),...Ve!=null&&Ve.track?[Ve.track]:[]]);let Ze;try{Ze=new MediaRecorder(be,Me?{mimeType:Me}:void 0)}catch{Ze=new MediaRecorder(be)}Ze.ondataavailable=Ke=>{Ke.data.size>0&&D.current.push(Ke.data)};const Pe=B.current;Ze.onstop=()=>{var De,xt;if(Pe!==B.current)return;(De=M.current)==null||De.stop(),M.current=null,(xt=z.current)==null||xt.call(z),z.current=null;const Ke=new Blob(D.current,{type:P.current||"video/webm"});if(Ke.size<500){r({title:"Recording was empty",description:"Try recording again for a couple of seconds.",variant:"destructive"}),d(!1),i("live");return}I.current=Ke,N(Xe=>(Xe&&URL.revokeObjectURL(Xe),URL.createObjectURL(Ke))),i("review"),d(!1),G.current&&window.clearInterval(G.current),G.current=null},Ze.start(1e3),F.current=Ze,d(!0),f(0),G.current=window.setInterval(()=>f(Ke=>Ke+1),1e3)}catch(Me){te(),r({title:"Could not start recording",description:dn(Me,"Your browser could not record this lecture."),variant:"destructive"})}finally{h(!1)}},he=()=>{const pe=F.current;if((pe==null?void 0:pe.state)==="recording"){try{pe.requestData()}catch{}pe.stop()}},ye=()=>{I.current=null,N(pe=>(pe&&URL.revokeObjectURL(pe),null)),i("live"),f(0),T.current&&ne(A.current,T.current),O.current&&ne(_.current,O.current)},J=()=>{const pe=I.current;if(!pe||pe.size<500){r({title:"Recording was empty",description:"Record again, then use the clip.",variant:"destructive"});return}const Ie=tgs(pe,P.current);n(Ie),e(!1)},K=p.find(pe=>pe.deviceId===x),ce=v.find(pe=>pe.deviceId===k);return a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg gap-0 overflow-hidden p-0 sm:max-w-3xl",onPointerDownOutside:pe=>{(c||u)&&pe.preventDefault()},onEscapeKeyDown:pe=>{(c||u)&&pe.preventDefault()},children:[a.jsx(Vt,{className:"px-5 py-4",children:a.jsx(Ut,{children:"Record video clip"})}),a.jsxs("div",{className:"px-5 pb-4",children:[a.jsx("div",{className:"relative aspect-video overflow-hidden rounded-lg bg-black",children:s==="review"&&E?a.jsx("video",{className:"h-full w-full object-contain",src:E,controls:!0,playsInline:!0}):a.jsxs(a.Fragment,{children:[a.jsx("video",{ref:_,className:ee("absolute inset-0 h-full w-full object-contain",C?"opacity-100":"pointer-events-none opacity-0"),autoPlay:!0,muted:!0,playsInline:!0}),a.jsx("video",{ref:A,className:ee("bg-black object-cover",C?"absolute bottom-16 right-4 z-10 h-28 w-44 rounded-xl shadow-lg ring-2 ring-white/25":"absolute inset-0 h-full w-full object-contain",H?"opacity-100":"pointer-events-none opacity-0"),autoPlay:!0,muted:!0,playsInline:!0}),!V&&!o?a.jsx("div",{className:"absolute inset-0 flex items-center justify-center px-6 text-center text-sm text-white/70",children:"Turn on your camera or share your screen to start recording."}):null,o?a.jsx("div",{className:"absolute inset-0 flex items-center justify-center text-white/70",children:a.jsx(Ne,{className:"h-6 w-6 animate-spin"})}):null,c?a.jsxs("div",{className:"absolute left-3 top-3 z-20 flex items-center gap-2 rounded-full bg-black/70 px-3 py-1 text-xs font-medium text-white",children:[a.jsx("span",{className:"h-2 w-2 animate-pulse rounded-full bg-red-500"}),"Rec ",ngs(m)]}):null,a.jsxs("div",{className:"absolute bottom-4 left-1/2 z-20 flex -translate-x-1/2 items-center gap-1 rounded-full bg-black/75 p-1 shadow-lg backdrop-blur",children:[a.jsx(oXe,{disabled:c,icon:W?Vx:yk,label:W?(ce==null?void 0:ce.label)||"Microphone":"No microphone",onSelect:Y,options:v.map((pe,Ie)=>({id:pe.deviceId,label:iXe(pe,Ie,"Microphone")})),selectedId:k,offId:Sb,offLabel:"No microphone"}),a.jsx(oXe,{disabled:c,icon:H?Ca:S2,label:H?(K==null?void 0:K.label)||"Camera":"No camera",onSelect:q,options:p.map((pe,Ie)=>({id:pe.deviceId,label:iXe(pe,Ie,"Camera")})),selectedId:x,offId:kb,offLabel:"No camera"}),a.jsx("button",{type:"button",disabled:c,onClick:()=>void Q(),title:C?"Stop sharing screen":"Share screen","aria-pressed":C,className:ee("flex h-10 items-center gap-1 rounded-full px-3 text-white transition-colors hover:bg-white/10 disabled:opacity-50",C&&"bg-white/20"),children:a.jsx(JBt,{className:"h-4 w-4"})})]})]})}),C&&H&&s==="live"?a.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Keep this tab open while recording so your camera overlay stays in the video."}):null]}),a.jsx(ir,{className:"border-t border-border px-5 py-4 sm:justify-end",children:s==="review"?a.jsxs(a.Fragment,{children:[a.jsx(Z,{type:"button",variant:"outline",onClick:ye,children:"Retake"}),a.jsx(Z,{type:"button",onClick:J,children:"Use recording"})]}):a.jsxs(a.Fragment,{children:[a.jsx(Z,{type:"button",variant:"outline",disabled:c||u,onClick:()=>e(!1),children:"Cancel"}),c?a.jsxs(Z,{type:"button",variant:"destructive",onClick:he,children:[a.jsx(hee,{className:"h-4 w-4"}),"Stop recording"]}):a.jsxs(Z,{type:"button",disabled:u||o||!V,onClick:()=>void ie(),children:[u?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):null,"Start recording"]})]})})]})})}function oXe({disabled:t,icon:e,label:n,options:r,selectedId:s,offId:i,offLabel:o,onSelect:l}){return a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsxs("button",{type:"button",disabled:t,title:n,className:"flex h-10 items-center gap-1 rounded-full px-3 text-white transition-colors hover:bg-white/10 disabled:opacity-50",children:[a.jsx(e,{className:"h-4 w-4"}),a.jsx(li,{className:"h-3 w-3 opacity-80"})]})}),a.jsxs(Cr,{align:"center",className:"max-h-64 w-64 overflow-auto",children:[a.jsx(ot,{onClick:()=>l(i),children:o}),r.length>0?a.jsx(mi,{}):null,r.map(c=>a.jsx(ot,{className:c.id===s?"font-medium":void 0,onClick:()=>l(c.id),children:c.label},c.id))]})]})}const lXe=1,ogs=1e4;function cXe(t,e="video"){return new Promise(n=>{const r=document.createElement(e);let s=!1;const i=c=>{s||(s=!0,window.clearTimeout(l),r.removeAttribute("src"),r.load(),n(c))},o=()=>{Number.isFinite(r.duration)&&r.duration>0&&i(r.duration)},l=window.setTimeout(()=>i(null),ogs);r.preload="metadata",r.muted=!0,r.addEventListener("loadedmetadata",()=>{if(Number.isFinite(r.duration))return o();r.currentTime=Number.MAX_SAFE_INTEGER}),r.addEventListener("durationchange",o),r.addEventListener("error",()=>i(null)),r.src=t})}async function lgs(t){var e;try{const n=await fetch(`https://vimeo.com/api/oembed.json?url=${encodeURIComponent(`https://vimeo.com/${t}`)}`);if(!n.ok)return null;const r=Number((e=await n.json())==null?void 0:e.duration);return Number.isFinite(r)&&r>0?r:null}catch{return null}}function cOt(t){try{return/(^|\.)youtube(-nocookie)?\.com$/i.test(new URL(t).hostname)}catch{return!1}}function cgs(t){return ON(t).some(e=>e.kind==="embed"&&!!e.url&&cOt($N(e.url)))}const Phe=new Map;function dgs(t){const e=$N(t);if(!$9(e))return Promise.resolve(0);if(cOt(e))return Promise.resolve(null);const n=Phe.get(e);if(n)return n;let r=Promise.resolve(0);try{const s=new URL(e),i=s.pathname.split("/").filter(Boolean).pop()??"";/vimeo\.com$/i.test(s.hostname)&&(r=lgs(i))}catch{r=Promise.resolve(null)}return Phe.set(e,r),r.then(s=>{s===null&&Phe.delete(e)}),r}function ugs(t){return t.reduce((e,n)=>n.kind==="quiz"?e+n.questions.length*lXe:n.kind==="question"?e+lXe:e,0)}function hgs(t,e){return Math.min(rse,Math.ceil(Math.max(0,t)/60)+Math.max(0,e))}async function mgs(t,e){const n=ON(e),r=await Promise.all([t?cXe(t,"video"):0,...n.map(s=>s.kind==="embed"&&s.url?dgs(s.url):s.kind==="audio"&&s.url?cXe(s.url,"audio"):0)]);return r.some(s=>s===null)?null:hgs(r.reduce((s,i)=>s+(i??0),0),ugs(n))}function fgs(t,e){const[n,r]=y.useState(null),s=JSON.stringify(ON(e).map(l=>l.kind==="embed"||l.kind==="audio"?[l.kind,l.url]:l.kind==="quiz"?[l.kind,l.questions.length]:l.kind==="question"?[l.kind]:null)),i=`${t??""}|${s}`;y.useEffect(()=>{let l=!0;return mgs(t,e).then(c=>{l&&r({key:i,minutes:c})}),()=>{l=!1}},[i]);const o=(n==null?void 0:n.key)===i;return{minutes:o?n.minutes:null,calculating:!o}}function pgs({courseId:t,section:e,lesson:n,onLessonUpdated:r}){const{toast:s}=yt(),{community:i}=qe(),[o,l]=y.useState(""),[c,d]=y.useState(!0),[u,h]=y.useState(""),[m,f]=y.useState(null),[p,g]=y.useState(null),v=GB(p),b=fgs(p,n==null?void 0:n.blocks),[x,w]=y.useState(null),[k,S]=y.useState(!1),[C,j]=y.useState(0),[E,N]=y.useState(!1),[A,_]=y.useState(!1),T=y.useRef(null),R=async(K,ce,pe,Ie)=>{const Me=new AbortController;T.current=Me,_(!0);try{return await Smr(K,t,ce,pe,Ie,j,Me.signal)}finally{T.current=null,_(!1)}},[O,F]=y.useState(!1),[D,I]=y.useState(!1),[P,M]=y.useState(!1),[z,G]=y.useState(!1),B=y.useRef(null),H=y.useRef(null),W=y.useRef(null),V=tps(n==null?void 0:n.blocks),U=()=>{W.current&&(URL.revokeObjectURL(W.current),W.current=null)},ne=K=>{if(wse(K))return s({title:"Video too large",description:`Videos can be up to ${dk}.`,variant:"destructive"}),!1;H.current=K,U();const ce=URL.createObjectURL(K);return W.current=ce,f(K),g(ce),S(!1),!0};y.useEffect(()=>{if(!n)return;const K=B.current!==n.id;if(B.current=n.id,l(n.description??""),d(n.commentsEnabled),h(n.durationMinutes?String(n.durationMinutes):""),K){w(null),H.current=null,f(null),U(),g(n.coverMedia??null),S(!1),j(0);return}!H.current&&!W.current&&g(n.coverMedia??null)},[n]),y.useEffect(()=>()=>U(),[]);const te=n==null?void 0:n.id,re=n==null?void 0:n.title,fe=(n==null?void 0:n.autoDurationMinutes)??0,le=p===((n==null?void 0:n.coverMedia)??null),q=i==null?void 0:i.id,Y=e==null?void 0:e.id;if(y.useEffect(()=>{if(!n||!te||!re||!Y||!q||x!==te||b.calculating||m||!le)return;if(b.minutes===null||b.minutes===fe){w(null);return}const K=b.minutes;let ce=!0;return dq(q,t,Y,{title:re,autoDurationMinutes:K},te).then(()=>{ce&&r({...n,autoDurationMinutes:K})}).catch(()=>{}).finally(()=>{ce&&w(null)}),()=>{ce=!1}},[x,b.calculating,b.minutes,fe,m,le,te,re,Y,q,t]),!n||!e)return a.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"Select a lesson from the sidebar to edit its content."});const X=n.state==="published",Q=j$(u)>0;let ie;b.calculating?ie="Calculating the time from this lesson's content…":b.minutes!==null?ie=Q?`Using your time. Calculated from the content: ${lk(b.minutes)}.`:`Calculated from the content: ${lk(b.minutes)}. Type a number to set it yourself.`:cgs(n.blocks)?Q?ie="Using your time. This lesson has a YouTube video, whose length can't be read here.":fe>0?ie=`This lesson has a YouTube video, whose length can't be read here. The time worked out earlier (${lk(fe)}) is kept. Type a number above to change it.`:ie="This lesson has a YouTube video, whose length can't be read here. Type the lesson's time above.":ie="The time could not be calculated from this lesson's content just now. Type one above, or it will be tried again next time.";const he=async()=>{if(i!=null&&i.id){N(!0),j(0);try{let ce=(await dq(i.id,t,e.id,{description:o.trim(),title:n.title,commentsEnabled:c,durationMinutes:j$(u),...b.minutes!==null?{autoDurationMinutes:b.minutes}:{}},n.id)).lesson;const pe=H.current??m;if(pe?(ce=(await R(i.id,e.id,n.id,pe)).lesson??ce,H.current=null,f(null),j(100),ce!=null&&ce.coverMedia&&g(W.current??ce.coverMedia)):k&&n.coverMedia&&(ce=(await Cmr(i.id,t,e.id,n.id)).lesson??ce,S(!1)),!ce)throw new Error("No lesson returned");r({...n,description:ce.description??o.trim(),commentsEnabled:c,durationMinutes:ce.durationMinutes??j$(u),autoDurationMinutes:ce.autoDurationMinutes??b.minutes??n.autoDurationMinutes,coverMedia:ce.coverMedia??(k?null:n.coverMedia),state:ce.state==="draft"?"draft":"published"}),s({title:"Lesson saved"})}catch(K){if(kg(K)){s({title:"Upload cancelled",description:"The video was not uploaded. Click Save to try again."});return}const ce=K instanceof ze?Dt(K.body,K.message):"Something went wrong.";s({title:"Could not save lesson",description:ce,variant:"destructive"})}finally{N(!1),j(0)}}},ye=async()=>{if(i!=null&&i.id){F(!0);try{const K=X?"draft":"published",ce=await dq(i.id,t,e.id,{state:K,title:n.title},n.id);if(!ce.lesson)throw new Error("No lesson returned");r({...n,state:ce.lesson.state==="draft"?"draft":"published"}),s({title:K==="published"?"Lesson published":"Lesson unpublished"})}catch(K){const ce=K instanceof ze?Dt(K.body,K.message):"Something went wrong.";s({title:"Could not update lesson",description:ce,variant:"destructive"})}finally{F(!1)}}},J=async()=>{if(i!=null&&i.id){I(!0);try{const K=O$t(nps(n.blocks));await TEt(i.id,t,e.id,n.id,{blocks:K}),r({...n,blocks:K}),w(n.id),M(!1),s({title:"Embedded video removed"})}catch(K){const ce=K instanceof ze?Dt(K.body,K.message):"Something went wrong.";s({title:"Could not remove embed",description:ce,variant:"destructive"})}finally{I(!1)}}};return a.jsxs("div",{className:"space-y-6 p-4 sm:p-6",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:n.title}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs(Z,{variant:"outline",disabled:E||O,onClick:he,children:[E?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save"]}),a.jsxs(Z,{disabled:E||O,onClick:ye,children:[O?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):null,X?"Unpublish":"Publish"]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(X6,{htmlFor:"lesson-minutes",label:"Time to complete",children:"The time is calculated for you from this lesson's video (uploaded or recorded), its Vimeo links, its audio, and its quizzes (one minute a question). The length of a YouTube video can't be read, so type the time for a lesson that has one. Otherwise type a number only if you want to set it yourself; clear the box to go back to the calculated time. It is shown beside the lesson and adds up to the total on the section and on the course."}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Oe,{id:"lesson-minutes",type:"number",inputMode:"numeric",min:0,max:rse,value:u,placeholder:String(b.minutes??fe),disabled:E,className:"w-28",onChange:K=>h(K.target.value)}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"minutes"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",role:"status",children:ie})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Video lecture"}),p?a.jsxs("div",{className:"relative overflow-hidden rounded-lg border border-border",children:[a.jsx("video",{className:"aspect-video w-full max-h-80 bg-black",controls:!0,playsInline:!0,src:v.src,onError:v.onError},p),a.jsxs(Z,{type:"button",variant:"secondary",size:"sm",className:"absolute left-2 top-2 h-8",onClick:()=>G(!0),children:[a.jsx(Ca,{className:"h-4 w-4"}),"Record"]}),a.jsx(Z,{type:"button",variant:"secondary",size:"icon",className:"absolute right-2 top-2 h-8 w-8",onClick:()=>{H.current=null,f(null),U(),g(null),S(!0)},children:a.jsx(nn,{className:"h-4 w-4"})})]}):V?a.jsxs("div",{className:"relative aspect-video max-h-80 overflow-hidden rounded-lg border border-border bg-black",children:[a.jsx(VIe,{url:V.url,title:"YouTube lecture",className:"absolute inset-0 h-full w-full rounded-none border-0"}),a.jsx(Z,{type:"button",variant:"secondary",size:"icon",className:"absolute right-2 top-2 z-10 h-8 w-8",disabled:D,onClick:()=>M(!0),children:D?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsx(nn,{className:"h-4 w-4"})})]}):a.jsxs("div",{className:"flex aspect-video max-h-52 flex-col items-center justify-center gap-3 rounded-lg border border-dashed border-border bg-muted/30 px-4 text-sm text-muted-foreground",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-2",children:[a.jsxs("label",{className:"inline-flex cursor-pointer items-center gap-2 rounded-md border border-input bg-background px-3 py-2 text-sm font-medium text-foreground hover:bg-accent hover:text-accent-foreground",children:[a.jsx(kd,{className:"h-4 w-4"}),"Upload video lecture",a.jsx("input",{type:"file",accept:"video/*",className:"sr-only",onChange:K=>{var pe;const ce=(pe=K.target.files)==null?void 0:pe[0];K.target.value="",ce&&ne(ce)}})]}),a.jsxs(Z,{type:"button",variant:"outline",onClick:()=>G(!0),children:[a.jsx(Ca,{className:"h-4 w-4"}),"Record video clip"]})]}),a.jsxs("p",{className:"text-center text-xs",children:["Upload up to ",dk,", or record with camera, microphone, and screen share."]})]}),E&&A?a.jsxs("div",{className:"space-y-1.5",role:"status","aria-live":"polite",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs text-muted-foreground",children:[a.jsxs("span",{children:["Uploading the video… ",C,"%"]}),a.jsx("button",{type:"button",onClick:()=>{var K;return(K=T.current)==null?void 0:K.abort()},className:"shrink-0 font-medium text-foreground underline-offset-2 hover:underline",children:"Cancel upload"})]}),a.jsx(ap,{value:C,className:"h-1.5","aria-label":"Video upload progress"})]}):null]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Description"}),a.jsx(aOt,{value:o,placeholder:"Write lesson details here…",onChange:l})]}),a.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border p-3",children:[a.jsxs("div",{children:[a.jsx(_e,{children:"Lesson discussion"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Let learners comment on this lesson."})]}),a.jsx(Hs,{checked:c,onCheckedChange:d})]}),a.jsx(Kps,{courseId:t,sectionId:e.id,lessonId:n.id,blocks:n.blocks??[],onBlocksSaved:K=>{r({...n,blocks:K}),w(n.id)}}),n.commentsEnabled?a.jsx(lOt,{courseId:t,sectionId:e.id,lessonId:n.id}):null,a.jsx(ags,{open:z,onOpenChange:G,onRecorded:K=>{ne(K)&&(async()=>{if(!(!(i!=null&&i.id)||!n||!e)){N(!0),j(0);try{const pe=(await R(i.id,e.id,n.id,K)).lesson;H.current=null,f(null),r({...n,coverMedia:(pe==null?void 0:pe.coverMedia)??n.coverMedia,description:n.description,commentsEnabled:n.commentsEnabled}),s({title:"Lecture uploaded",description:"Your recording is saved on this lesson. Publish it when you're ready."})}catch(ce){if(kg(ce)){s({title:"Upload cancelled",description:"Your recording is still attached. Click Save to upload it."});return}const pe=ce instanceof ze?Dt(ce.body,ce.message):"Something went wrong.";s({title:"Recording attached, upload failed",description:`${pe} Click Save to try again.`,variant:"destructive"})}finally{N(!1),j(0)}}})()}}),a.jsx(Kr,{open:P,onOpenChange:M,children:a.jsxs(Or,{className:"w-[calc(100vw-2rem)] rounded-lg",children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Are you sure you want to delete the block?"}),a.jsx(zr,{children:"This removes the embedded video from this lesson and brings back the upload option."})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:D,children:"No"}),a.jsxs(Yr,{disabled:D,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:K=>{K.preventDefault(),J()},children:[D?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Yes"]})]})]})})]})}function dXe({courseId:t,sectionId:e,lessonId:n,blockIndex:r,title:s,choiceType:i,questions:o,attempt:l,onAttemptSaved:c}){const d=Tn(),{toast:u}=yt(),{community:h}=qe(),[m,f]=y.useState({}),[p,g]=y.useState(!1),[v,b]=y.useState(!1),x=F$t(i);y.useEffect(()=>{g(!1),f({})},[n,r,l==null?void 0:l.id]);const w=((l==null?void 0:l.title)||s||d("Quiz")).trim()||d("Quiz"),k=!!l&&!p,S=o.every((E,N)=>{var A,_;return(((A=E.options)==null?void 0:A.length)??0)===0||(((_=m[N])==null?void 0:_.length)??0)>0}),C=(E,N)=>{f(A=>{const _=A[E]??[];if(!x)return{...A,[E]:[N]};const T=_.includes(N)?_.filter(R=>R!==N):h2([..._,N]);return{...A,[E]:T}})},j=async()=>{if(h!=null&&h.id){b(!0);try{const E=await Tmr(h.id,t,e,n,{blockIndex:r,answers:o.map((N,A)=>{const _=m[A]??[];return{questionIndex:A,optionIndex:_[0]??null,optionIndexes:_}})});c==null||c(E.attempt),g(!1)}catch(E){const N=E instanceof ze?Dt(E.body,E.message):d("Could not save quiz.");u({title:d("Could not submit quiz"),description:N,variant:"destructive"})}finally{b(!1)}}};return o.length===0?null:k&&l?a.jsx(ggs,{attempt:l,heading:w,onRetake:()=>g(!0)}):a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-2xl font-semibold text-foreground",children:w}),x?a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:d("Select all answers that apply.")}):null]}),o.map((E,N)=>a.jsxs("div",{className:"space-y-2",children:[a.jsxs("p",{className:"text-sm font-semibold text-foreground",children:[o.length>1?`${N+1}. `:"",E.prompt]}),(E.options??[]).length>0?a.jsx("div",{className:"space-y-1.5",children:E.options.map((A,_)=>{const T=(m[N]??[]).includes(_);return a.jsxs("button",{type:"button",onClick:()=>C(N,_),className:`flex w-full items-center gap-3 rounded-md border px-3 py-2.5 text-left text-sm transition-colors ${T?"border-primary bg-primary/10":"border-border hover:bg-muted/60"}`,children:[a.jsx("span",{className:`flex h-4 w-4 items-center justify-center border ${x?"rounded-sm":"rounded-full"} ${T?"border-primary bg-primary text-primary-foreground":"border-muted-foreground/40"}`,children:T?a.jsx(Qn,{className:"h-3 w-3"}):null}),A]},_)})}):a.jsx("p",{className:"text-xs text-muted-foreground",children:d("This is an open-ended check — continue when you are ready.")})]},N)),a.jsxs(Z,{size:"sm",disabled:!S||v,onClick:()=>void j(),children:[v?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):null,d("Submit quiz")]})]})}function ggs({attempt:t,heading:e,onRetake:n}){const r=Tn(),s=t.passed,i=t.questions??[],o=sps(t),[l,c=""]=r("You {status} the quiz.").split("{status}");return a.jsxs("div",{className:"space-y-6",children:[a.jsx("h2",{className:"text-2xl font-semibold text-foreground",children:e}),a.jsxs("div",{className:"grid gap-4 rounded-xl border border-border bg-card p-5 sm:grid-cols-[minmax(0,1.4fr)_auto_auto] sm:items-center",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("p",{className:"text-base text-foreground",children:[a.jsx("span",{className:"mr-1","aria-hidden":!0,children:s?"🎉":"😔"}),l,a.jsx("span",{className:s?"font-semibold text-emerald-600":"font-semibold text-destructive",children:r(s?"passed":"didn't pass")}),c]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:r(s?"Great job!":"Review the answers below, then try again.")}),a.jsx(Z,{variant:"outline",size:"sm",className:"mt-3 rounded-full",onClick:n,children:r("Retake quiz")})]}),a.jsx(uXe,{label:r("Score"),value:o.score}),a.jsx(uXe,{label:r("Correct answers"),value:o.accuracy})]}),a.jsx("div",{className:"space-y-6",children:i.map((d,u)=>a.jsx(vgs,{question:d},u))})]})}function uXe({label:t,value:e}){return a.jsxs("div",{className:"min-w-[7rem]",children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:t}),a.jsx("p",{className:"text-2xl font-semibold text-foreground",children:e})]})}function vgs({question:t}){var o,l,c;const e=Tn(),n=new Set(z$t(t)),r=t.isCorrect,s=(((o=t.options)==null?void 0:o.length)??0)>0,i=(((l=t.selectedIndexes)==null?void 0:l.length)??0)>1||(((c=t.correctIndexes)==null?void 0:c.length)??0)>1;return a.jsxs("div",{className:"space-y-3",children:[a.jsx("p",{className:"font-semibold text-foreground",children:t.prompt}),r!=null?a.jsxs("div",{className:`flex items-center gap-2 rounded-md px-3 py-2 text-sm font-medium ${r?"bg-emerald-50 text-emerald-700 dark:bg-emerald-950/40 dark:text-emerald-400":"bg-red-50 text-red-700 dark:bg-red-950/40 dark:text-red-400"}`,children:[r?a.jsx(Qn,{className:"h-4 w-4"}):a.jsx(nn,{className:"h-4 w-4"}),e(r?"Correct":"Incorrect")]}):null,s?a.jsx("div",{className:"space-y-1.5",children:t.options.map((d,u)=>{const h=n.has(u);return a.jsxs("div",{className:"flex items-center gap-2 text-sm text-foreground",children:[h?a.jsx(Qn,{className:"h-4 w-4 text-muted-foreground"}):i?a.jsx(hee,{className:"h-4 w-4 text-muted-foreground/40"}):a.jsx(Ag,{className:"h-4 w-4 text-muted-foreground/40"}),a.jsx("span",{className:h?"font-medium":"text-muted-foreground",children:d})]},u)})}):null,t.explanation?a.jsx("p",{className:"rounded-md bg-muted/60 px-3 py-2 text-xs text-foreground/80",children:t.explanation}):null]})}const dOt="cover";function Rhe(t){return t.key===dOt}function ygs(t,e,n){var i;if(t.kind==="unknown")return t.raw.type||n("Block");const r=n(mj[t.kind]),s=e>1?`${r} ${e}`:r;switch(t.kind){case"quiz":return((i=t.title)==null?void 0:i.trim())||s;case"question":return s;case"attachment":case"pdf":case"audio":{const o=t.name.trim();return o&&o.length<=22?o:s}default:return s}}function bgs(t){const e="h-3.5 w-3.5 shrink-0";switch(t){case"cover":return a.jsx(Ca,{className:e});case"text":return a.jsx(dSe,{className:e});case"attachment":return a.jsx(Ff,{className:e});case"pdf":return a.jsx(Ei,{className:e});case"audio":return a.jsx(ySe,{className:e});case"embed":return a.jsx(QBt,{className:e});case"quiz":return a.jsx(k0,{className:e});case"question":return a.jsx(L8,{className:e});case"assignment":return a.jsx(mO,{className:e});default:return a.jsx(Ei,{className:e})}}function xgs({blocks:t,courseId:e,sectionId:n,lessonId:r,coverMedia:s,attempts:i=[],onAttemptSaved:o}){const l=Tn(),c=ON(t).map((w,k)=>({block:w,blockIndex:k})).filter(({block:w})=>w.kind!=="unknown"),d=new Map,u=c.map(w=>{const k=w.block.kind,S=(d.get(k)??0)+1;return d.set(k,S),{key:String(w.blockIndex),label:ygs(w.block,S,l),block:w.block,blockIndex:w.blockIndex}}),h=GB(s),m=s?[{key:dOt,label:l("Video")},...u]:u,f=`${s?"cover|":""}${u.map(w=>w.key).join(",")}`,[p,g]=y.useState(()=>{var w;return((w=m[0])==null?void 0:w.key)??""});if(y.useEffect(()=>{var w;g(((w=m[0])==null?void 0:w.key)??"")},[r]),y.useEffect(()=>{g(w=>{var k;return m.some(S=>S.key===w)?w:((k=m[0])==null?void 0:k.key)??""})},[f]),m.length===0)return null;const v=m.find(w=>w.key===p)??m[0],b=new Map(i.map(w=>[w.blockIndex,w])),x=w=>Rhe(w)?a.jsx("div",{className:"overflow-hidden rounded-lg border border-border bg-black/5",children:a.jsx("video",{className:"aspect-video w-full max-h-[480px] bg-black",controls:!0,controlsList:"nodownload",src:h.src,onError:h.onError,playsInline:!0})}):a.jsx(wgs,{block:w.block,blockIndex:w.blockIndex,courseId:e,sectionId:n,lessonId:r,attempt:b.get(w.blockIndex)??null,onAttemptSaved:o},`${r}-${w.blockIndex}`);return m.length===1?x(m[0]):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"relative z-10 space-y-2",children:[a.jsx("p",{className:"text-xs font-medium uppercase tracking-wide text-muted-foreground",children:l("In this lesson")}),a.jsx("div",{role:"tablist","aria-label":l("Lesson content"),className:"flex h-auto w-full justify-start gap-1 overflow-x-auto rounded-lg bg-muted/70 p-1",children:m.map(w=>{const k=w.key===v.key,S=!Rhe(w)&&!!b.get(w.blockIndex);return a.jsxs("button",{type:"button",role:"tab","aria-selected":k,title:w.label,onClick:()=>g(w.key),className:ee("inline-flex shrink-0 items-center gap-1.5 rounded-md px-3 py-2 text-xs font-medium text-muted-foreground","transition-all duration-200 ease-out hover:bg-background/70 hover:text-foreground",k&&"bg-primary/10 text-foreground shadow-sm ring-1 ring-primary/25"),children:[bgs(Rhe(w)?"cover":w.block.kind),a.jsx("span",{className:"max-w-[9.5rem] truncate",children:w.label}),S?a.jsx("span",{className:"h-1.5 w-1.5 shrink-0 rounded-full bg-emerald-500","aria-label":l("Completed")}):null]},w.key)})})]}),a.jsx("div",{role:"tabpanel",children:x(v)})]})}function wgs({block:t,blockIndex:e,courseId:n,sectionId:r,lessonId:s,attempt:i,onAttemptSaved:o}){const l=Tn();switch(t.kind){case"text":return a.jsx("div",{className:"rich-html prose prose-sm dark:prose-invert max-w-none text-foreground",dangerouslySetInnerHTML:{__html:EIe(t.html)}});case"attachment":return a.jsx(hXe,{icon:a.jsx(bc,{className:"h-5 w-5"}),name:t.name,url:t.url,action:l("Download")});case"pdf":return a.jsxs("div",{className:"space-y-2",children:[a.jsx(hXe,{icon:a.jsx(Ei,{className:"h-5 w-5"}),name:t.name,url:t.url,action:l("Open PDF")}),qk(t.url)&&a.jsx("iframe",{title:t.name,src:qk(t.url)??void 0,className:"h-[520px] w-full rounded-lg border border-border"})]});case"audio":return a.jsxs("div",{className:"rounded-lg border border-border bg-card p-4",children:[a.jsxs("p",{className:"mb-2 flex items-center gap-2 text-sm font-medium text-foreground",children:[a.jsx(ySe,{className:"h-4 w-4 text-primary"})," ",t.name]}),a.jsx("audio",{controls:!0,className:"w-full",src:NN(t.url)??void 0})]});case"embed":return a.jsx(VIe,{url:t.url,height:t.height??420});case"quiz":return a.jsx(dXe,{courseId:n,sectionId:r,lessonId:s,blockIndex:e,title:t.title,choiceType:t.choiceType,questions:t.questions??[],attempt:i,onAttemptSaved:o});case"question":return a.jsx(dXe,{courseId:n,sectionId:r,lessonId:s,blockIndex:e,title:l("Quick check"),questions:t.question?[t.question]:[],attempt:i,onAttemptSaved:o});case"assignment":return a.jsxs("div",{className:"rounded-lg border border-primary/30 bg-primary/5 p-4",children:[a.jsxs("p",{className:"mb-1 flex items-center gap-2 text-sm font-semibold text-foreground",children:[a.jsx(mO,{className:"h-4 w-4 text-primary"})," ",l("Assignment")]}),a.jsx("p",{className:"whitespace-pre-wrap text-sm text-foreground/90",children:t.instructions}),a.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:l("Submit your work in the lesson discussion below.")})]});default:return null}}function hXe({icon:t,name:e,url:n,action:r}){return a.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-border bg-card p-4",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-3",children:[a.jsx("span",{className:"text-primary",children:t}),a.jsx("span",{className:"truncate text-sm font-medium text-foreground",children:e})]}),a.jsx(Z,{asChild:!0,size:"sm",variant:"outline",children:a.jsx("a",{href:NN(n)??void 0,target:"_blank",rel:"noopener noreferrer",download:!0,children:r})})]})}function kgs({lesson:t,loading:e,courseId:n,sectionId:r,lessonOrdinal:s}){var m;const i=Tn(),{community:o}=qe(),[l,c]=y.useState([]);if(y.useEffect(()=>{if(!(o!=null&&o.id)||!n||!r||!(t!=null&&t.id)){c([]);return}let f=!1;return Nmr(o.id,n,r,t.id).then(p=>{f||c(p.attempts??[])}).catch(()=>{f||c([])}),()=>{f=!0}},[o==null?void 0:o.id,n,r,t==null?void 0:t.id]),e)return a.jsxs("div",{className:"animate-pulse space-y-4 p-6",children:[a.jsx("div",{className:"h-8 w-2/3 rounded bg-muted"}),a.jsx("div",{className:"aspect-video rounded bg-muted"}),a.jsx("div",{className:"h-32 rounded bg-muted"})]});if(!t)return a.jsx("div",{className:"p-6",children:a.jsxs(vI,{children:[a.jsx(t7,{children:i("No lesson selected")}),a.jsx(yI,{children:i("Pick a lesson from the table of contents.")})]})});const d=t.description?EIe(t.description):"",u=(((m=t.blocks)==null?void 0:m.length)??0)>0,h=!!t.coverMedia;return a.jsxs("article",{className:"space-y-6 p-4 sm:p-6",children:[s?a.jsx("p",{className:"text-xs text-muted-foreground",children:pn(i("Lesson {current} of {total}"),{current:s.current,total:s.total})}):null,a.jsx("h1",{className:"text-2xl font-semibold text-foreground",children:t.title}),d?a.jsx("div",{className:"rich-html prose prose-sm dark:prose-invert max-w-none text-foreground [&_iframe]:my-4 [&_iframe]:w-full [&_iframe]:rounded-lg",dangerouslySetInnerHTML:{__html:d}}):!u&&!h?a.jsx("p",{className:"text-sm text-muted-foreground",children:i("This lesson has no written content yet.")}):null,(h||u)&&n&&r?a.jsx(xgs,{blocks:t.blocks??[],coverMedia:t.coverMedia,courseId:n,sectionId:r,lessonId:t.id,attempts:l,onAttemptSaved:f=>c(p=>[...p.filter(v=>v.blockIndex!==f.blockIndex),f])}):null,t.commentsEnabled&&n&&r?a.jsx(lOt,{courseId:n,sectionId:r,lessonId:t.id}):null]})}function Sgs(){var ne,te,re;const t=Tn(),{courseId:e}=So(),n=Nn(),r=rn(),[s]=xc(),{community:i}=qe(),{communityDetail:o,groups:l,refetchGroups:c}=Ln(),d=s.get("section")??void 0,u=s.get("lesson")??void 0,[h,m]=y.useState(null),f=()=>{var fe;return((fe=window.matchMedia)==null?void 0:fe.call(window,"(min-width: 1024px)").matches)??!0},[p,g]=y.useState(f),[v,b]=y.useState(!1),[x,w]=y.useState(!1),[k,S]=y.useState(null),[C,j]=y.useState(null),[E,N]=y.useState(!1),{data:A,isLoading:_,isFetching:T,isError:R,refetch:O}=rPe(e),F=sPe(h??A??null),D=jN(o),I=!!(F&&!F.isRealAdmin&&r0e(F)),P=F!=null&&F.group?l.find(fe=>{var le;return fe.id===((le=F.group)==null?void 0:le.id)})??F.group:null;y.useEffect(()=>{I&&N(!0)},[I,(ne=F==null?void 0:F.group)==null?void 0:ne.id]);const M=y.useMemo(()=>!F||!d?null:F.sections.find(fe=>fe.id===d)??null,[F,d]),z=y.useMemo(()=>!M||!u?null:M.lessons.find(fe=>fe.id===u)??null,[M,u]);y.useEffect(()=>{j(null),f()||g(!1)},[d,u]),y.useEffect(()=>{if(!F||_||T)return;if(d&&u){const le=H$t(F.sections,d,u),q=le==null?void 0:le.section.lessons[le.lessonIndex];if(le&&(F.isAdmin||!(q!=null&&q.isLocked)))return}const fe=J1e(F.sections,F.isAdmin);fe&&e&&n(ve.knowledgeLearn(e,fe.sectionId,fe.lessonId),{replace:!0})},[F,e,_,T,u,n,d]);const G=async()=>{if(!(i!=null&&i.id)||!e)return;await r.invalidateQueries({queryKey:["knowledge-course-detail",i.id,e]});const fe=await O();fe.data&&m(fe.data)},B=fe=>{if(!F||!M)return;const le=F.sections.map(q=>q.id!==M.id?q:{...q,lessons:q.lessons.map(Y=>Y.id===fe.id?fe:Y)});m({...F,sections:le})},H=fe=>{if(fe!==u||!F||!e)return;const le=J1e(F.sections,F.isAdmin);le?n(ve.knowledgeLearn(e,le.sectionId,le.lessonId),{replace:!0}):n(ve.knowledgeCourse(e),{replace:!0})};if(D)return a.jsx(Gs,{to:ve.dashboard,replace:!0});if(_)return a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-background",children:a.jsx(Ne,{className:"h-8 w-8 animate-spin text-muted-foreground"})});if(R||!F)return a.jsxs("div",{className:"flex min-h-screen flex-col items-center justify-center gap-4 bg-background px-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:t("Could not load this course.")}),a.jsx(Z,{asChild:!0,variant:"outline",children:a.jsx(vr,{to:ve.knowledge,children:t("Back to Courses")})})]});const W=!F.isAdmin&&F.isJoined&&z&&d,V=F.isAdmin&&!v,U=!I&&!Umr(F);return a.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[a.jsxs("header",{className:"flex shrink-0 flex-col gap-2 border-b border-border bg-card px-3 py-2 sm:px-4",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Z,{variant:"ghost",size:"icon",className:"shrink-0",asChild:!0,children:a.jsx(vr,{to:ve.knowledgeCourse(F.id),title:t("Back to course overview"),children:a.jsx(no,{className:"h-4 w-4"})})}),a.jsx("h1",{className:"min-w-0 flex-1 truncate text-sm font-semibold text-foreground sm:text-base",children:F.title}),F.isAdmin?a.jsxs(Z,{variant:v?"default":"outline",size:"sm",className:"shrink-0",onClick:()=>b(fe=>!fe),children:[v?a.jsx(Qs,{className:"h-4 w-4"}):a.jsx(Oc,{className:"h-4 w-4"}),t(v?"Edit lesson":"Preview as learner")]}):null,a.jsx(Z,{variant:"ghost",size:"icon",className:"shrink-0 lg:hidden",onClick:()=>g(fe=>!fe),children:p?a.jsx(ULe,{className:"h-4 w-4"}):a.jsx(zLe,{className:"h-4 w-4"})}),a.jsx(Z,{variant:"ghost",size:"icon",className:"hidden shrink-0 lg:inline-flex",onClick:()=>g(fe=>!fe),children:p?a.jsx(ULe,{className:"h-4 w-4"}):a.jsx(zLe,{className:"h-4 w-4"})})]}),a.jsx(MIe,{className:"pl-11",items:[{label:t("Courses"),href:ve.knowledge},{label:F.title,href:ve.knowledgeCourse(F.id)},...z?[{label:z.title}]:[]]})]}),a.jsxs("div",{className:"relative flex min-h-0 flex-1",children:[p?a.jsx("button",{type:"button","aria-label":t("Close table of contents"),className:"absolute inset-0 z-10 bg-black/40 lg:hidden",onClick:()=>g(!1)}):null,p?a.jsx("aside",{className:"w-72 shrink-0 border-r border-border max-lg:absolute max-lg:z-20 max-lg:inset-y-0 max-lg:left-0 max-lg:top-0 max-lg:h-full max-lg:shadow-lg max-lg:max-w-[85vw]",children:a.jsx(Bps,{course:F,onCourseChange:m,onLessonDeleted:H})}):null,a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col",children:[a.jsx("main",{className:"flex-1 overflow-y-auto",children:V?a.jsx(pgs,{courseId:F.id,section:M,lesson:z,onLessonUpdated:B}):I?a.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:pn(t("Join {group} to continue learning."),{group:((te=F.group)==null?void 0:te.name)??t("the course's current group")})}):U?a.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:(re=F.paywall)!=null&&re.required&&!F.paywall.entitled?t("Buy this course to watch the lecture."):t("Enroll in this course to watch the lecture.")}):a.jsx(kgs,{lesson:z,courseId:F.id,sectionId:d,lessonOrdinal:z&&d?yps(F.sections,d,z.id,F.isAdmin):null})}),W&&d&&!U&&!I?a.jsx(Eps,{course:F,sectionId:d,lesson:z,onLessonUpdated:B,onProgressChange:G,onCourseCompleted:fe=>{S(fe??null),w(!0)},onAdvanceToNext:j}):null]})]}),a.jsx(jps,{open:U,course:F,onEnrolled:G}),a.jsx(DIe,{open:E&&I,group:P,onOpenChange:N,onJoined:async()=>{c(),await G()},onRequested:c,courseMoved:!0}),a.jsx(kps,{open:x,onOpenChange:fe=>{w(fe),fe||S(null)},courseId:F.id,courseTitle:F.title,karma:k}),a.jsx(Cps,{open:!!C,nextTitle:(C==null?void 0:C.title)??t("Next lesson"),onStay:()=>j(null),onContinue:()=>{if(!C)return;const fe=C;j(null),window.setTimeout(()=>{n(ve.knowledgeLearn(F.id,fe.sectionId,fe.lessonId))},180)}})]})}function uOt({communityId:t,value:e="",onChange:n,values:r,onValuesChange:s,mode:i,id:o,className:l}){const c=i==="filter"&&r!==void 0,d=c?r:e?[e]:[],u=Tn(),[h,m]=y.useState(!1),[f,p]=y.useState(""),[g,v]=y.useState("");y.useEffect(()=>{const C=window.setTimeout(()=>v(f.trim()),250);return()=>window.clearTimeout(C)},[f]),y.useEffect(()=>{h||p("")},[h]);const b=C0({queryKey:[...dPe(t),g],initialPageParam:1,queryFn:({pageParam:C})=>hyr(t,g,C),getNextPageParam:C=>C.hasMore?C.page+1:void 0,enabled:h&&!!t,staleTime:3e4}),x=y.useMemo(()=>{var D,I;const C=((D=b.data)==null?void 0:D.pages)??[],j=C.flatMap(P=>P.categories),E=f.trim().slice(0,mHe),N=P=>!E||P.toLowerCase().includes(E.toLowerCase());if(i==="filter")return[{value:"",label:u("All categories")},...j.map(P=>({value:P.name,label:Qv(P.name,u),count:P.count}))];const A=(((I=C[0])==null?void 0:I.suggested)??[]).filter(N),_=new Set(A.map(P=>P.toLowerCase())),T=[...A.map(P=>({value:P,label:Qv(P,u)})),...j.filter(P=>!_.has(P.name.toLowerCase())).map(P=>({value:P.name,label:Qv(P.name,u),count:P.count}))],R=T.some(P=>P.value.toLowerCase()===E.toLowerCase()),O=Nyr(E),F=E&&!R?[{value:O,label:pn(u("Add “{name}”"),{name:O}),create:!0}]:[];return[{value:"",label:u("No category")},...T,...F]},[i,b.data,u,f]),w=C=>C.value?d.includes(C.value):d.length===0,k=C=>{if(c){s==null||s(C?d.includes(C)?d.filter(j=>j!==C):[...d,C]:[]);return}n==null||n(C),m(!1)},S=d.length===0?u(i==="filter"?"All categories":"No category"):d.length===1?Qv(d[0],u):pn(u("{name} +{count}"),{name:Qv(d[0],u),count:d.length-1});return a.jsxs(Ni,{open:h,onOpenChange:m,children:[a.jsx(Ti,{asChild:!0,children:a.jsxs("button",{id:o,type:"button",role:"combobox","aria-expanded":h,"aria-label":u(i==="filter"?"Filter by content category":"Content category"),className:ee("flex h-10 w-full items-center justify-between gap-2 rounded-md border border-input bg-background px-3 text-left text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",l),children:[a.jsxs("span",{className:ee("flex min-w-0 items-center gap-2",d.length===0&&"text-muted-foreground"),children:[a.jsx(ka,{className:"h-4 w-4 shrink-0 opacity-70","aria-hidden":!0}),a.jsx("span",{className:"truncate",children:S})]}),a.jsx(li,{className:"h-4 w-4 shrink-0 opacity-50","aria-hidden":!0})]})}),a.jsxs(yi,{align:"start",className:"w-[var(--radix-popover-trigger-width)] min-w-[16rem] p-0",children:[a.jsxs("div",{className:"relative border-b",children:[a.jsx(hs,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground","aria-hidden":!0}),a.jsx("input",{autoFocus:!0,value:f,maxLength:mHe,onChange:C=>p(C.target.value),onKeyDown:C=>{if(C.key!=="Enter")return;C.preventDefault();const j=f.trim().toLowerCase(),E=x.find(N=>!N.create&&N.value&&N.label.toLowerCase().includes(j))??x.find(N=>N.create);E&&k(E.value)},placeholder:u(i==="filter"?"Search categories":"Search or type a new category"),"aria-label":u(i==="filter"?"Search categories":"Search or type a new category"),className:"h-10 w-full bg-transparent pl-9 pr-3 text-sm outline-none placeholder:text-muted-foreground"})]}),a.jsxs("div",{role:"listbox","aria-multiselectable":c||void 0,"aria-label":u("Content categories"),className:"themed-scrollbar max-h-64 overflow-y-auto p-1",children:[x.map(C=>a.jsxs("button",{type:"button",role:"option","aria-selected":!C.create&&w(C),onClick:()=>k(C.value),className:"flex w-full items-center gap-2 rounded-sm px-2 py-1.5 text-left text-sm hover:bg-accent focus-visible:bg-accent focus-visible:outline-none",children:[C.create?a.jsx(Dn,{className:"h-4 w-4 shrink-0 text-primary","aria-hidden":!0}):a.jsx(Qn,{className:ee("h-4 w-4 shrink-0",w(C)?"opacity-100":"opacity-0"),"aria-hidden":!0}),a.jsx("span",{className:ee("min-w-0 flex-1 truncate",C.create&&"font-medium text-primary",!C.value&&"text-muted-foreground"),children:C.label}),C.count!==void 0&&a.jsx("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:C.count})]},`${C.create?"add:":""}${C.value}`)),b.isFetching&&!b.isFetchingNextPage&&a.jsxs("p",{className:"flex items-center gap-2 px-2 py-1.5 text-xs text-muted-foreground",children:[a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}),u("Loading…")]}),b.isError&&a.jsx("p",{className:"px-2 py-1.5 text-xs text-destructive",children:u("Couldn't load categories. Try again.")}),i==="filter"&&!b.isFetching&&!b.isError&&x.length===1&&a.jsx("p",{className:"px-2 py-1.5 text-xs text-muted-foreground",children:u(g?"No categories match.":"No resource has a category yet.")}),b.hasNextPage&&a.jsxs("button",{type:"button",onClick:()=>void b.fetchNextPage(),disabled:b.isFetchingNextPage,className:"mt-1 flex w-full items-center justify-center gap-2 rounded-sm px-2 py-1.5 text-xs font-medium text-primary hover:bg-accent disabled:opacity-60",children:[b.isFetchingNextPage&&a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0}),u("Show more")]})]})]})]})}function Cgs({resource:t}){const e=Tn();return a.jsx(V$t,{url:yyr(t.id),title:t.title,texts:{copied:e("It opens this resource in the Knowledge Hub."),channelDescription:pn(e("Posts “{title}” with a link that opens it in the Knowledge Hub."),{title:t.title}),postFailed:e("Couldn't share the resource"),noun:"resource",sendDescription:e("Share it in a message. The link opens the resource in the Knowledge Hub.")}})}const jgs=5;function Egs(t,e){const n=rn(),r=y.useRef({video:0,audio:0}),s=y.useRef({video:0,audio:0}),i=y.useRef(0),o=y.useCallback(h=>{!t||!e||gyr(t,e,h).then(({progress:m})=>{m.percent<i.current||(i.current=m.percent,VTt(n,t,e,{myProgress:m}))}).catch(()=>{})},[t,e,n]),l=y.useCallback(h=>{const m=Math.round(r.current[h]);m<=s.current[h]||(s.current[h]=m,o(h==="video"?{video:m}:{audio:m}))},[o]),c=y.useCallback((h,m)=>{Number.isFinite(m)&&(r.current[h]=Math.max(r.current[h],Math.min(100,Math.max(0,m))),r.current[h]>=99.5&&(r.current[h]=100),(r.current[h]-s.current[h]>=jgs||r.current[h]===100)&&l(h))},[l]);y.useEffect(()=>{if(e)return r.current={video:0,audio:0},s.current={video:0,audio:0},i.current=0,o({opened:!0}),()=>{l("video"),l("audio")}},[e,o,l]);const d=y.useCallback(h=>{const m=f=>{const{currentTime:p,duration:g}=f.currentTarget;g>0&&c(h,p/g*100)};return{onTimeUpdate:m,onPause:f=>{m(f),l(h)},onEnded:()=>c(h,100)}},[c,l]),u=y.useCallback(h=>o({attachmentUrl:h}),[o]);return{mediaHandlers:d,track:c,reportAttachment:u}}function Ngs(t,e,n){const r=y.useRef(()=>{});return y.useEffect(()=>{if(!e)return;const s=/youtube(-nocookie)?\.com\/embed\//.test(e),i=/player\.vimeo\.com\/video\//.test(e);if(!s&&!i)return;const o=()=>{var h;return(h=t.current)==null?void 0:h.contentWindow},l=h=>{var m;return(m=o())==null?void 0:m.postMessage(JSON.stringify(h),"*")};let c=0;const d=()=>{s&&l({event:"listening",id:1,channel:"widget"}),i&&(l({method:"addEventListener",value:"timeupdate"}),l({method:"addEventListener",value:"ended"}))},u=h=>{var f;if(!o()||h.source!==o())return;let m=null;try{m=typeof h.data=="string"?JSON.parse(h.data):h.data}catch{return}if(!(!m||typeof m!="object"))if(s){const p=m.info;m.event==="onReady"&&d(),typeof(p==null?void 0:p.duration)=="number"&&p.duration>0&&(c=p.duration),(p==null?void 0:p.playerState)===0&&n(100),typeof(p==null?void 0:p.currentTime)=="number"&&c&&n(p.currentTime/c*100)}else{m.event==="ready"&&d(),m.event==="ended"&&n(100);const p=(f=m.data)==null?void 0:f.percent;m.event==="timeupdate"&&typeof p=="number"&&n(p*100)}};return window.addEventListener("message",u),r.current=d,d(),()=>{window.removeEventListener("message",u),r.current=()=>{}}},[t,e,n]),y.useCallback(()=>r.current(),[])}function Tgs(t){const e=Tn(),n=rn(),r=HTt(t),s=y.useCallback((c,d)=>r(c,{savedByMe:d}),[r]),i=y.useCallback((c,d)=>vyr(t,c,d),[t]),o=y.useCallback(c=>{n.setQueriesData({queryKey:["knowledge-hub",t]},d=>{if(!d||typeof d!="object"||!("pages"in d))return d;const u=d;return{...u,pages:u.pages.map(h=>({...h,hasSaved:c}))}}),n.invalidateQueries({queryKey:["knowledge-hub",t],predicate:d=>{var u;return!!((u=d.queryKey[2])!=null&&u.saved)},refetchType:"none"})},[n,t]),l=y.useMemo(()=>({saved:e("Saved"),savedHint:e("Find it any time under Saved in the Knowledge Hub."),saveFailed:e("Couldn't save this resource"),unsaveFailed:e("Couldn't remove it from saved"),tryAgain:e("Please try again.")}),[e]);return A$t({patch:s,save:i,onHasSaved:o,texts:l})}function _gs(t,e){const n=t.map(()=>0),r=t.reduce((o,l)=>o+l,0)||1;let s=0;const i=()=>{const o=n.reduce((c,d)=>c+d,0),l=s===t.length?100:Math.min(99,Math.floor(o/r*100));e({percent:l,done:s,total:t.length})};return i(),{progress:o=>l=>{n[o]=t[o]*Math.max(0,Math.min(100,l))/100,i()},finish:o=>{n[o]=t[o],s+=1,i()}}}const Ags=1920,Pgs=.85;function Rgs(t,e,n){const r=Math.min(1,n/Math.max(t,e));return{width:Math.max(1,Math.round(t*r)),height:Math.max(1,Math.round(e*r))}}async function Igs(t){var e;try{const n=await createImageBitmap(t),{width:r,height:s}=Rgs(n.width,n.height,Ags),i=document.createElement("canvas");i.width=r,i.height=s;const o=i.getContext("2d");if(!o)return t;o.drawImage(n,0,0,r,s),(e=n.close)==null||e.call(n);const l=t.type==="image/png"?"image/png":"image/jpeg",c=await new Promise(u=>i.toBlob(u,l,Pgs));if(!c||c.size>=t.size)return t;const d=t.name.replace(/\.[^./\\]+$/,"")||"cover";return new File([c],`${d}${l==="image/png"?".png":".jpg"}`,{type:l})}catch{return t}}const LX=t=>t.mimeType==="application/pdf"||t.name.toLowerCase().endsWith(".pdf"),Mgs=t=>/wordprocessingml|msword/i.test(t.mimeType)||/\.(doc|docx)$/i.test(t.name),Lgs=t=>/spreadsheetml|ms-excel/i.test(t.mimeType)||/\.(xls|xlsx)$/i.test(t.name),F_=t=>t>=1024*1024?`${(t/(1024*1024)).toFixed(1)} MB`:t>=1024?`${Math.round(t/1024)} KB`:`${t} B`,mXe=()=>`enablejsapi=1&origin=${encodeURIComponent(window.location.origin)}`;function $q(t){if(!t)return null;try{const e=new URL(t),n=e.hostname.toLowerCase();if(n==="youtu.be")return`https://www.youtube-nocookie.com/embed/${e.pathname.slice(1)}?${mXe()}`;if(n.endsWith("youtube.com")){const r=e.pathname.startsWith("/shorts/")?e.pathname.split("/")[2]:e.searchParams.get("v");return r?`https://www.youtube-nocookie.com/embed/${r}?${mXe()}`:null}if(n==="vimeo.com"||n==="www.vimeo.com"){const r=e.pathname.split("/").filter(Boolean)[0];return r?`https://player.vimeo.com/video/${r}`:null}if(n==="player.vimeo.com")return t}catch{return null}return null}function LH(t){const e=y.useMemo(()=>t?URL.createObjectURL(t):"",[t]);return y.useEffect(()=>()=>{e&&URL.revokeObjectURL(e)},[e]),e}function hOt({item:t,onOpen:e,onToggleLike:n,onToggleSave:r}){var i,o,l,c;const s=Tn();return a.jsxs("div",{className:"relative flex",children:[a.jsxs("button",{type:"button",onClick:e,tabIndex:e?void 0:-1,className:"group flex w-full flex-col overflow-hidden rounded-xl border bg-card text-left shadow-sm transition duration-200 hover:-translate-y-0.5 hover:border-primary/30 hover:shadow-md",children:[a.jsxs("div",{className:"relative aspect-[16/9] overflow-hidden bg-muted",children:[t.imageUrl?a.jsx("img",{src:t.imageUrl,alt:"",loading:"lazy",className:"h-full w-full object-cover transition duration-300 group-hover:scale-[1.025]"}):a.jsx("div",{className:"flex h-full w-full items-center justify-center bg-gradient-to-br from-primary/15 via-primary/5 to-muted text-primary/70","data-testid":"default-cover",children:a.jsx(Iu,{className:"h-9 w-9","aria-hidden":!0})}),(t.videoUrl||t.audioUrl||t.category)&&a.jsxs("div",{className:"absolute inset-x-3 bottom-3 flex items-center gap-2",children:[t.videoUrl&&a.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-background/90 shadow",children:a.jsx(fm,{className:"ml-0.5 h-4 w-4 fill-current"})}),t.category&&a.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-background/90 px-2 py-0.5 text-[10px] font-medium leading-4 text-foreground shadow",title:Qv(t.category,s),children:[a.jsx(ka,{className:"h-2.5 w-2.5 shrink-0","aria-hidden":!0}),a.jsx("span",{className:"truncate",children:Qv(t.category,s)})]}),t.audioUrl&&a.jsx("span",{className:"ml-auto shrink-0 rounded-full bg-background/90 p-2 shadow",children:a.jsx(UP,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col p-4",children:[a.jsx("h2",{className:"line-clamp-2 font-semibold leading-snug [overflow-wrap:anywhere] group-hover:text-primary",children:t.title}),a.jsx("p",{className:"mt-2 line-clamp-2 text-sm leading-5 text-muted-foreground [overflow-wrap:anywhere]",children:t.description}),a.jsxs("div",{className:"mt-auto pt-4",children:[t.myProgress&&a.jsx(LIe,{progress:t.myProgress,className:"mb-3"}),a.jsxs("div",{className:"flex min-w-0 items-center gap-2 border-t pt-3 text-xs text-muted-foreground",children:[(i=t.author)!=null&&i.picture?a.jsx("img",{src:t.author.picture,alt:"",className:"h-6 w-6 rounded-full object-cover"}):a.jsx("span",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-primary/10 font-medium text-primary",children:((l=(o=t.author)==null?void 0:o.name)==null?void 0:l[0])||"M"}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:((c=t.author)==null?void 0:c.name)||s("Community member")}),a.jsx("span",{children:h7(new Date(t.createdAt))})]})]})]})]}),(n||r)&&a.jsxs("div",{className:"absolute right-3 top-3 flex items-center gap-1.5",children:[r&&a.jsx(gae,{saved:!!t.savedByMe,saveLabel:s("Save this resource"),onToggle:()=>r(t)}),n&&a.jsx(cPe,{resource:t,onToggle:n})]})]})}function mOt({resource:t,attachmentActions:e,tracking:n}){var p;const r=Tn(),s=t.videoKind==="uploaded"?null:$q(t.videoUrl),i=GB(s?null:t.videoUrl),o=y.useRef(null),l=y.useCallback(g=>n==null?void 0:n.track("video",g),[n]),c=Ngs(o,n?s:null,l),d=!!((p=t.attachments)!=null&&p.length),u=+!!t.videoUrl+ +!!t.audioUrl+Number(d),h=t.videoUrl?s?a.jsx("div",{className:"overflow-hidden rounded-2xl border border-border/70 bg-black shadow-sm",children:a.jsx("iframe",{ref:o,onLoad:c,className:"aspect-video w-full",src:s,title:t.title,allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0})}):a.jsx("div",{className:"overflow-hidden rounded-2xl border border-border/70 bg-black shadow-sm",children:a.jsx("video",{controls:!0,preload:"metadata",playsInline:!0,className:"aspect-video w-full",src:i.src,onError:i.onError,...n==null?void 0:n.mediaHandlers("video"),children:r("Your browser does not support video playback.")})}):null,m=t.audioUrl?a.jsxs("div",{className:"rounded-2xl border border-border/70 bg-gradient-to-br from-muted/50 to-muted/20 p-5 shadow-sm",children:[a.jsxs("div",{className:"mb-4 flex items-center gap-3",children:[a.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-full bg-primary/10 text-primary",children:a.jsx(UP,{className:"h-4 w-4"})}),a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold",children:r("Audio resource")}),a.jsx("p",{className:"text-xs text-muted-foreground",children:r("Listen without leaving the Knowledge Hub")})]})]}),a.jsx("audio",{controls:!0,preload:"metadata",className:"w-full",src:t.audioUrl,...n==null?void 0:n.mediaHandlers("audio"),children:r("Your browser does not support audio playback.")})]}):null,f=d?a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{className:"overflow-hidden rounded-2xl border border-border/70 bg-card",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-border/60 bg-muted/20 px-4 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Ff,{className:"h-4 w-4 text-primary"}),a.jsx("p",{className:"text-sm font-semibold",children:r("Attached files")})]}),a.jsxs("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground",children:[t.attachments.length,"/5"]})]}),t.attachments.map((g,v)=>{const b=LX(g),x=(e==null?void 0:e.viewedUrl)===g.url,w=(e==null?void 0:e.downloadingUrl)===g.url,k=LX(g)?"PDF":Mgs(g)?"DOC":Lgs(g)?"XLS":r("FILE");return a.jsxs("div",{className:`flex items-center gap-3 border-b border-border/60 px-4 py-3 transition-colors last:border-b-0 ${x?"bg-primary/[0.06]":"hover:bg-muted/30"}`,children:[a.jsx("span",{className:"flex h-10 w-10 shrink-0 items-center justify-center rounded-xl bg-primary/10 text-[10px] font-bold text-primary",children:k}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"truncate text-sm font-medium",children:g.name}),a.jsx("p",{className:"text-xs text-muted-foreground",children:F_(g.size)})]}),e&&a.jsxs("div",{className:"flex items-center gap-1",children:[b&&a.jsxs(Z,{variant:x?"secondary":"ghost",size:"sm",onClick:()=>e.onView(g),children:[a.jsx(Oc,{className:"h-4 w-4"}),r(x?"Hide":"View")]}),a.jsxs(Z,{variant:"ghost",size:"sm",disabled:w,onClick:()=>e.onDownload(g),children:[w?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsx(bc,{className:"h-4 w-4"}),r("Download")]})]})]},`${g.url}-${v}`)})]})}):null;return a.jsxs("div",{className:"min-w-0 space-y-7",children:[u>0&&a.jsx("section",{"aria-label":r("Resource media"),className:"min-w-0",children:u>1?a.jsxs(U0,{defaultValue:t.videoUrl?"video":t.audioUrl?"audio":"attachments",children:[a.jsxs(nb,{className:`grid h-11 w-full rounded-xl bg-muted/70 p-1 ${u===3?"grid-cols-3":"grid-cols-2"}`,children:[t.videoUrl&&a.jsxs(Xo,{value:"video",className:"rounded-lg",children:[a.jsx(fm,{className:"mr-2 h-4 w-4"}),r("Video")]}),t.audioUrl&&a.jsxs(Xo,{value:"audio",className:"rounded-lg",children:[a.jsx(UP,{className:"mr-2 h-4 w-4"}),r("Audio")]}),d&&a.jsxs(Xo,{value:"attachments",className:"rounded-lg",children:[a.jsx(Ff,{className:"mr-2 h-4 w-4"}),r("Attachments")," ",a.jsx("span",{className:"ml-1 rounded-full bg-muted px-1.5 text-[10px]",children:t.attachments.length})]})]}),t.videoUrl&&a.jsx(pd,{value:"video",className:"mt-4",children:h}),t.audioUrl&&a.jsx(pd,{value:"audio",className:"mt-4",children:m}),d&&a.jsx(pd,{value:"attachments",className:"mt-4",children:f})]}):a.jsx("div",{className:"animate-in fade-in-0 duration-300",children:h||m||f})}),a.jsxs("section",{className:"min-w-0",children:[a.jsx("p",{className:"mb-3 text-xs font-semibold uppercase tracking-[0.14em] text-muted-foreground",children:r("About this resource")}),a.jsx(Du,{value:t.description,onChange:()=>{},readOnly:!0,className:"min-w-0 break-words leading-7 text-foreground/85 [overflow-wrap:anywhere]"})]})]})}function fOt({resource:t}){var n,r,s,i;const e=Tn();return a.jsxs("div",{className:"flex min-w-0 items-center gap-2.5 text-sm text-muted-foreground",children:[(n=t.author)!=null&&n.picture?a.jsx("img",{src:t.author.picture,alt:"",className:"h-7 w-7 rounded-full border border-background object-cover shadow-sm"}):a.jsx("span",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-primary/10 text-xs font-semibold text-primary",children:((s=(r=t.author)==null?void 0:r.name)==null?void 0:s[0])||"M"}),a.jsx("span",{className:"min-w-0 truncate font-medium text-foreground/80",children:((i=t.author)==null?void 0:i.name)||e("Community member")}),a.jsx("span",{"aria-hidden":!0,children:"·"}),a.jsx("span",{className:"shrink-0",children:h7(new Date(t.createdAt),{addSuffix:!0})})]})}const fXe=t=>t.type==="application/pdf"||t.name.toLowerCase().endsWith(".pdf");function Dgs(t,e){return t.total===0||t.done===t.total?e("Saving your resource…"):t.percent>=99?e("Finishing the upload…"):pn(t.total===1?e("Uploading 1 file · {percent}%"):e("Uploading {count} files · {percent}%"),{count:t.total,percent:t.percent})}function DH({icon:t,name:e,detail:n,onRemove:r,disabled:s}){const i=Tn();return a.jsxs("div",{className:"flex items-center gap-3 rounded-lg border bg-background px-3 py-2",children:[a.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-primary/10 text-primary",children:t}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"truncate text-sm font-medium",children:e}),a.jsx("p",{className:"text-xs text-muted-foreground",children:n})]}),a.jsxs("button",{type:"button",disabled:s,className:"rounded-md p-1 text-muted-foreground hover:bg-muted hover:text-destructive disabled:opacity-50",onClick:r,children:[a.jsx(nn,{className:"h-4 w-4"}),a.jsx("span",{className:"sr-only",children:pn(i("Remove {name}"),{name:e})})]})]})}function pXe({open:t,onOpenChange:e,communityId:n,resource:r}){var is;const s=Tn(),{toast:i}=yt(),{user:o}=jr(),l=rn(),c=y.useRef(null),d=y.useRef(null),u=y.useRef(null),h=y.useRef(null),[m,f]=y.useState("details"),[p,g]=y.useState(""),[v,b]=y.useState(""),[x,w]=y.useState(""),[k,S]=y.useState(""),[C,j]=y.useState(null),[E,N]=y.useState(null),[A,_]=y.useState(null),[T,R]=y.useState(""),[O,F]=y.useState(null),[D,I]=y.useState(null),[P,M]=y.useState(!1),[z,G]=y.useState(null),[B,H]=y.useState(""),[W,V]=y.useState(""),[U,ne]=y.useState("embedded"),[te,re]=y.useState([]),[fe,le]=y.useState([]),[q,Y]=y.useState(null),X=y.useRef(null),Q=y.useRef(!1),ie=()=>{Q.current||(Q.current=!0,i({title:pn(s("Description cannot exceed {max} characters"),{max:ET}),variant:"destructive"}))},he=!!r,{isCommunityAdmin:ye}=Zy(),{communityDetail:J}=Ln(),K=!he&&(ye||(J==null?void 0:J.myRole)==="moderator"),[ce,pe]=y.useState(!0);y.useEffect(()=>{t&&(f("details"),g((r==null?void 0:r.title)||""),b((r==null?void 0:r.description)||""),w((r==null?void 0:r.category)||""),R((r==null?void 0:r.imageUrl)||""),H((r==null?void 0:r.audioUrl)||""),V((r==null?void 0:r.videoUrl)||""),ne((r==null?void 0:r.videoKind)||"embedded"),le(((r==null?void 0:r.attachments)||[]).slice(0,5)),S((r==null?void 0:r.videoKind)==="embedded"?r.videoUrl:""),j(null),N(null),_(null),re([]),F(null),I(null),G(null),Q.current=!1)},[t,r]);const Ie=LH(C),Me=LH(A),we=LH(E),Be=LH(te.find(fXe)),Ve=Ie||T,be=Be||((is=fe.find(LX))==null?void 0:is.url)||"",Ze=fe.length+te.length,Pe=!!(A||W&&U==="uploaded"),[Ke]=y.useState(()=>new Date().toISOString()),De={id:(r==null?void 0:r.id)||"preview",title:p.trim()||s("Your title"),description:v,category:x,imageUrl:Ve,videoUrl:Me||($q(k.trim())?k.trim():"")||W,videoKind:A?"uploaded":k.trim()?"embedded":U,audioUrl:we||B,createdAt:(r==null?void 0:r.createdAt)||Ke,canDelete:!1,canEdit:!1,author:(r==null?void 0:r.author)||(o?{id:o.id,name:`${o.firstName} ${o.lastName}`.trim(),picture:Pk(o,56)}:null),attachments:[...fe,...te.map(ke=>({name:ke.name,url:"",mimeType:ke.type||"application/octet-stream",size:ke.size}))]},xt=jt({mutationFn:async()=>{const ke=C?await Igs(C):null,at=[],Tt=Je=>Je?at.push(Je)-1:-1,An=Tt(ke),Pn=Tt(E),yn=Tt(A),Is=at.length;at.push(...te);let js=!0;const Gt=_gs(at.map(Je=>Je.size),Je=>{js&&Y(Je)}),lr=(Je,Rt)=>Rt(Gt.progress(Je)).then(Qt=>(Gt.finish(Je),Qt)),ct=new AbortController;X.current=ct;const{signal:Bn}=ct,[Ms,Ue,et,Le]=await Promise.all([ke?lr(An,Je=>kyr(n,ke,Je,Bn)):T,E?lr(Pn,Je=>Syr(n,E,Je,Bn)):B,A?lr(yn,Je=>Cyr(n,A,Je,Bn)):"",Promise.all(te.map((Je,Rt)=>lr(Is+Rt,Qt=>jyr(n,Je,Qt,Bn))))]).catch(Je=>{throw js=!1,ct.abort(),Je});X.current=null;const Ye=et||k.trim()||W,st=A?"uploaded":k.trim()?"embedded":U,nt={title:p.trim(),description:v.trim(),imageUrl:Ms,videoUrl:Ye,videoKind:st,audioUrl:Ue,attachments:[...fe,...Le],category:x};return r?wyr(n,r.id,nt):byr(n,{...nt,...K?{notifyMembers:ce}:{}})},onSuccess:ke=>{l.invalidateQueries({queryKey:["knowledge-hub",n]}),l.invalidateQueries({queryKey:dPe(n)}),l.invalidateQueries({queryKey:uPe(n)});const at=!he&&ke&&"notifiedMembers"in ke&&ke.notifiedMembers;i({title:s(he?"Resource updated":"Resource shared"),description:s(he?"Your changes are now live.":at?"It is now available in the Knowledge Hub, and members are being notified.":"It is now available in the Knowledge Hub.")}),g(""),b(""),S(""),j(null),N(null),_(null),e(!1)},onError:ke=>{if(kg(ke)){i({title:s("Upload cancelled"),description:s("Nothing was saved. Your files are still in the form.")});return}i({title:s(he?"Could not update resource":"Could not share resource"),description:dn(ke,s("Please try again.")),variant:"destructive"})},onSettled:()=>{X.current=null,Y(null)}}),Xe=xt.isPending,tt=Xe&&!!q&&q.total>0&&q.done<q.total,$e=()=>{var ke;return(ke=X.current)==null?void 0:ke.abort()};y.useEffect(()=>()=>{var ke;return(ke=X.current)==null?void 0:ke.abort()},[]);const wt=p.trim().length,Ee=v.trim().length,Ge=wt>M3,Pt=Ee>ET,vn=wt>0&&Ee>0&&!Ge&&!Pt&&(!k.trim()||$q(k)),Hn=ke=>{if(ke){if(!ke.type.startsWith("image/")){i({title:s("That file is not an image"),description:s("Choose a PNG, JPG or WebP for the cover."),variant:"destructive"});return}F(ke),I(ke),G(null)}},yr=async ke=>{M(!0);try{const at=await x$t(ke);j(at),F(at),G(ke.id)}catch{i({title:s("Couldn't use that cover"),description:s("Pick another one, or choose a picture of your own."),variant:"destructive"})}finally{M(!1)}},br=()=>{j(null),R(""),F(null),I(null),G(null)},Yt=async()=>{if(O){I(O);return}const ke=NN(T);if(ke){M(!0);try{const at=await fetch(ke);if(!at.ok)throw new Error("cover unavailable");const Tt=await at.blob(),An=new window.File([Tt],"cover",{type:Tt.type||"image/jpeg"});F(An),I(An)}catch{i({title:s("Couldn't open the current cover"),description:s("Choose the image again to crop it."),variant:"destructive"})}finally{M(!1)}}},nr=ke=>{if(ke){if(wse(ke)){i({title:s("Video too large"),description:pn(s("Videos can be up to {limit}."),{limit:dk}),variant:"destructive"});return}_(ke),S(""),V("")}},Kn=ke=>{if(ke){if(!ke.type.startsWith("audio/")){i({title:s("That file is not audio"),description:s("Choose an MP3, M4A, WAV or other audio file."),variant:"destructive"});return}if(Ebr(ke)){i({title:s("Audio too large"),description:pn(s("Audio files can be up to {size} MB."),{size:QZ}),variant:"destructive"});return}N(ke)}},ms=ke=>{const at=Array.from(ke||[]).filter(xHe);at.length&&i({title:at.length===1?s("File too large"):pn(s("{count} files too large"),{count:at.length}),description:at.length===1?pn(s('"{name}" was not added. Files can be up to {limit}.'),{name:at[0].name,limit:jbr(at[0])}):pn(s("{names} were not added. Files can be up to {size} MB ({videoLimit} for a video)."),{names:at.map(Pn=>`"${Pn.name}"`).join(", "),size:QZ,videoLimit:dk}),variant:"destructive"});const Tt=Array.from(ke||[]).filter(Pn=>!xHe(Pn)),An=Math.max(0,5-Ze);Tt.length>An&&i({title:s("Up to 5 attachments"),description:An?pn(s(An===1?"Only the first {count} file was added.":"Only the first {count} files were added."),{count:An}):s("Remove one to add another.")}),re(Pn=>[...Pn,...Tt.slice(0,An)])};return a.jsxs(a.Fragment,{children:[a.jsx(Bt,{open:t,onOpenChange:ke=>{!ke&&Xe||e(ke)},children:a.jsxs(Ft,{onOpenAutoFocus:ke=>{ke.preventDefault(),ke.currentTarget.focus()},className:"flex max-h-[92vh] w-[calc(100vw-2rem)] max-w-2xl flex-col gap-0 overflow-hidden rounded-lg p-0 focus:outline-none",children:[a.jsxs("div",{className:"shrink-0 space-y-4 border-b px-4 py-5 pr-12 sm:px-6",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:s(he?"Edit resource":"Share a resource")}),a.jsx(_n,{children:s(he?"Update your resource. Saved changes will appear immediately.":"Add a cover and a description, then optionally a video, an audio file and files to download.")})]}),a.jsx(U0,{value:m,onValueChange:ke=>f(ke),children:a.jsxs(nb,{className:"grid h-10 w-full grid-cols-2 sm:w-72",children:[a.jsxs(Xo,{value:"details",children:[a.jsx(Qs,{className:"mr-2 h-4 w-4"}),s("Details")]}),a.jsxs(Xo,{value:"preview",children:[a.jsx(Oc,{className:"mr-2 h-4 w-4"}),s("Preview")]})]})})]}),a.jsx("input",{ref:c,hidden:!0,type:"file",accept:"image/png,image/jpeg,image/webp","aria-label":s("Cover image file"),onChange:ke=>{var at;Hn(((at=ke.target.files)==null?void 0:at[0])||null),ke.target.value=""}}),a.jsx("input",{ref:u,hidden:!0,type:"file",accept:"video/mp4,video/webm,video/quicktime","aria-label":s("Video file"),onChange:ke=>{var at;nr(((at=ke.target.files)==null?void 0:at[0])||null),ke.target.value=""}}),a.jsx("input",{ref:d,hidden:!0,type:"file",accept:"audio/*","aria-label":s("Audio file"),onChange:ke=>{var at;Kn(((at=ke.target.files)==null?void 0:at[0])||null),ke.target.value=""}}),a.jsx("input",{ref:h,hidden:!0,type:"file",multiple:!0,"aria-label":s("Attachment files"),onChange:ke=>{ms(ke.target.files),ke.target.value=""}}),a.jsx("div",{className:"themed-scrollbar min-h-0 min-w-0 flex-1 overflow-y-auto overflow-x-hidden",children:m==="details"?a.jsxs("fieldset",{disabled:Xe,className:"min-w-0 space-y-5 px-4 py-5 sm:px-6",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsxs(_e,{className:"flex items-center gap-1.5",children:[s("Cover image")," ",a.jsx("span",{className:"font-normal text-muted-foreground",children:s("(optional)")}),a.jsxs(gn,{label:s("Cover image"),children:[s("The picture on this resource's card in the library. It is not a download. After you pick a picture you choose which part to show, in the card's 16:9 shape, so nothing is cut off in the library. A large photo is resized before it is sent, so it uploads faster; the original on your device is not changed.")," ",s("Without a cover, the card shows a plain one in the community's colour.")]})]}),a.jsxs("button",{type:"button",onClick:()=>{var ke;return(ke=c.current)==null?void 0:ke.click()},className:"group relative flex aspect-[16/9] w-full items-center justify-center overflow-hidden rounded-xl border border-dashed border-border bg-muted/40 transition hover:border-primary/50 hover:bg-muted",children:[Ve?a.jsx("img",{src:Ve,alt:s("Cover preview"),className:"h-full w-full object-cover"}):a.jsxs("div",{className:"px-4 text-center",children:[a.jsx(jy,{className:"mx-auto mb-2 h-7 w-7 text-muted-foreground"}),a.jsx("p",{className:"text-sm font-medium",children:s("Choose a cover image")}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:s("PNG, JPG or WebP · you choose the part to show next")})]}),Ve&&a.jsx("span",{className:"absolute bottom-3 right-3 rounded-md bg-background/90 px-2.5 py-1.5 text-xs font-medium shadow",children:s("Replace cover")})]}),Ve&&a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsx("p",{className:"min-w-0 truncate text-xs text-muted-foreground",children:C?`${C.name} · ${F_(C.size)}`:s("Current cover")}),a.jsxs("div",{className:"flex flex-wrap gap-2",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",disabled:P,onClick:()=>void Yt(),children:[P?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsx(SBt,{className:"h-4 w-4"}),s("Adjust crop")]}),a.jsxs(Z,{type:"button",variant:"ghost",size:"sm",disabled:P,onClick:br,children:[a.jsx(nn,{className:"h-4 w-4"}),s("Remove cover")]})]})]}),a.jsx(IIe,{selectedId:z,disabled:P,onPick:ke=>void yr(ke)})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("div",{className:"flex justify-between gap-3",children:[a.jsxs(_e,{htmlFor:"resource-title",children:[s("Title")," ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsxs("span",{className:ee("shrink-0 text-xs text-muted-foreground",Ge&&"text-destructive"),children:[wt,"/",M3]})]}),a.jsx(Oe,{id:"resource-title",maxLength:M3,"aria-invalid":Ge||void 0,value:p,onChange:ke=>g(ke.target.value.slice(0,M3)),placeholder:s("What will members learn?")}),Ge&&a.jsx("p",{className:"text-xs text-destructive",children:pn(s("Shorten the title to {max} characters or fewer."),{max:M3})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(_e,{htmlFor:"resource-category",className:"flex items-center gap-1.5",children:[s("Content category")," ",a.jsx("span",{className:"font-normal text-muted-foreground",children:s("(optional)")}),a.jsxs(gn,{label:s("Content category"),children:[s("What kind of resource this is, such as a research paper or an opinion piece. Members can filter the Knowledge Hub by it. Pick one, or type your own and choose Add.")," ",s("A new category is saved with capital letters, so “fancy dress” becomes “Fancy Dress”, and one that already exists is reused rather than added twice.")]})]}),a.jsx(uOt,{id:"resource-category",mode:"pick",communityId:n,value:x,onChange:w})]}),a.jsxs("div",{className:"min-w-0 space-y-2",children:[a.jsxs("div",{className:"flex justify-between gap-3",children:[a.jsxs(_e,{children:[s("Description")," ",a.jsx("span",{className:"text-destructive",children:"*"})]}),a.jsxs("span",{className:ee("shrink-0 text-xs text-muted-foreground",Pt&&"text-destructive"),children:[Ee,"/",ET]})]}),a.jsx(Du,{value:v,onChange:b,plainTextPaste:!0,maxLength:ET,onCharacterCountChange:ke=>{ke<ET&&(Q.current=!1)},onLimitExceeded:ie,placeholder:s("Share context, key takeaways, and why this is useful…"),className:"min-w-0 max-w-full overflow-hidden rounded-xl",editorClassName:"break-words [overflow-wrap:anywhere]"}),Pt&&a.jsx("p",{className:"text-xs text-destructive",children:pn(s("Formatting counts toward the limit. Shorten the description to {max} characters or fewer."),{max:ET})})]}),a.jsxs("div",{className:"space-y-4 rounded-xl border bg-muted/20 p-4",children:[a.jsxs("div",{children:[a.jsxs("p",{className:"text-sm font-semibold",children:[s("Media to play")," ",a.jsx("span",{className:"font-normal text-muted-foreground",children:s("(optional)")})]}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:s("Members watch or listen to these inside the resource.")})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(_e,{className:"flex items-center gap-2",children:[a.jsx(b2,{className:"h-4 w-4 text-muted-foreground"}),s("Video")," ",a.jsx("span",{className:"font-normal text-muted-foreground",children:pn(s("· one video, up to {limit}, or a link"),{limit:dk})})]}),Pe?a.jsx(DH,{icon:a.jsx(b2,{className:"h-4 w-4"}),name:(A==null?void 0:A.name)||s("Current uploaded video"),detail:A?F_(A.size):s("Already uploaded"),disabled:Xe,onRemove:()=>{_(null),V("")}}):a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[a.jsxs(Z,{type:"button",variant:"outline",className:"justify-start",onClick:()=>{var ke;return(ke=u.current)==null?void 0:ke.click()},children:[a.jsx(kd,{className:"h-4 w-4"}),s("Upload video")]}),a.jsxs("div",{className:"relative",children:[a.jsx(eu,{className:"absolute left-3 top-3 h-4 w-4 text-muted-foreground"}),a.jsx(Oe,{"aria-label":s("YouTube or Vimeo URL"),className:"pl-9",value:k,onChange:ke=>{S(ke.target.value),V(""),ne("embedded")},placeholder:s("YouTube or Vimeo URL")})]})]}),k&&!$q(k)&&a.jsx("p",{className:"text-xs text-destructive",children:s("Enter a valid YouTube or Vimeo link.")})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs(_e,{className:"flex items-center gap-2",children:[a.jsx(UP,{className:"h-4 w-4 text-muted-foreground"}),s("Audio")," ",a.jsx("span",{className:"font-normal text-muted-foreground",children:s("· one audio file")})]}),E||B?a.jsx(DH,{icon:a.jsx(UP,{className:"h-4 w-4"}),name:(E==null?void 0:E.name)||s("Current audio file"),detail:E?F_(E.size):s("Already uploaded"),disabled:Xe,onRemove:()=>{N(null),H("")}}):a.jsxs(Z,{type:"button",variant:"outline",className:"w-full justify-start sm:w-auto",onClick:()=>{var ke;return(ke=d.current)==null?void 0:ke.click()},children:[a.jsx(kd,{className:"h-4 w-4"}),s("Upload audio")]})]})]}),a.jsxs("div",{className:"space-y-3 rounded-xl border bg-muted/20 p-4",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("p",{className:"flex items-center gap-2 text-sm font-semibold",children:[a.jsx(Ff,{className:"h-4 w-4 text-muted-foreground"}),s("Files to download")," ",a.jsx("span",{className:"font-normal text-muted-foreground",children:s("(optional)")})]}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:pn(s("PDFs, Word, Excel or any other file members can download · {count}/5"),{count:Ze})})]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",disabled:Ze>=5,onClick:()=>{var ke;return(ke=h.current)==null?void 0:ke.click()},children:[a.jsx(Ff,{className:"h-4 w-4"}),s("Add files")]})]}),Ze>0&&a.jsxs("div",{className:"space-y-2",children:[fe.map(ke=>a.jsx(DH,{icon:LX(ke)?a.jsx(Ei,{className:"h-4 w-4"}):a.jsx(FLe,{className:"h-4 w-4"}),name:ke.name,detail:F_(ke.size),disabled:Xe,onRemove:()=>le(at=>at.filter(Tt=>Tt.url!==ke.url))},ke.url)),te.map((ke,at)=>a.jsx(DH,{icon:fXe(ke)?a.jsx(Ei,{className:"h-4 w-4"}):a.jsx(FLe,{className:"h-4 w-4"}),name:ke.name,detail:F_(ke.size),disabled:Xe,onRemove:()=>re(Tt=>Tt.filter((An,Pn)=>Pn!==at))},`${ke.name}-${at}`))]}),qk(be)&&a.jsxs("div",{className:"overflow-hidden rounded-xl border bg-background",children:[a.jsxs("div",{className:"flex items-center gap-2 border-b px-3 py-2 text-xs font-medium text-muted-foreground",children:[a.jsx(Oc,{className:"h-3.5 w-3.5"}),s("PDF preview")]}),a.jsx("iframe",{title:s("PDF attachment preview"),src:qk(be)??void 0,className:"h-64 w-full bg-white"})]})]})]}):a.jsxs("div",{className:"min-w-0 space-y-6 px-4 py-5 sm:px-6",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:s(he?"This is how members will see your resource. Nothing is shared until you save.":"This is how members will see your resource. Nothing is shared until you publish.")}),a.jsxs("section",{className:"space-y-2",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-muted-foreground",children:s("When opened")}),a.jsxs("div",{className:"overflow-hidden rounded-2xl border border-border/70 bg-card",children:[a.jsxs("div",{className:"space-y-3 border-b border-border/70 bg-gradient-to-br from-primary/[0.07] via-card to-card px-4 py-5 sm:px-6",children:[a.jsx("p",{className:"break-words text-xl font-semibold leading-tight tracking-tight [overflow-wrap:anywhere] sm:text-2xl",children:De.title}),a.jsx(fOt,{resource:De})]}),a.jsx("div",{className:"min-w-0 px-4 py-5 sm:px-6",children:a.jsx(mOt,{resource:De})})]})]}),a.jsxs("section",{className:"space-y-2",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-[0.14em] text-muted-foreground",children:s("In the library")}),a.jsx("div",{className:"pointer-events-none max-w-xs","aria-hidden":!0,children:a.jsx(hOt,{item:De})})]})]})}),a.jsxs("div",{className:"shrink-0 space-y-3 border-t bg-muted/20 px-4 py-4 sm:px-6",children:[K&&a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(ji,{id:"kh-notify-members",checked:ce,disabled:Xe,onCheckedChange:ke=>pe(ke===!0)}),a.jsx(_e,{htmlFor:"kh-notify-members",className:"cursor-pointer text-sm font-normal",children:s("Notify members")}),a.jsx(gn,{label:s("Notify members"),children:s("Sends everyone in the community a notification about this resource, in the app and as a push notification on their phone or browser. Members who turned off notifications for this community don't get it.")})]}),q&&a.jsxs("div",{className:"space-y-1.5",role:"status","aria-live":"polite",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3 text-xs text-muted-foreground",children:[a.jsx("span",{children:Dgs(q,s)}),q.total>1&&a.jsx("span",{className:"shrink-0",children:pn(s("{done}/{total} done"),{done:q.done,total:q.total})})]}),a.jsx(ap,{value:q.percent,className:"h-2","aria-label":s("Upload progress")}),a.jsx("p",{className:"text-xs text-muted-foreground",children:s("Keep this window open until it finishes.")})]}),a.jsxs("div",{className:"flex justify-end gap-2",children:[tt?a.jsx(Z,{variant:"ghost",onClick:$e,children:s("Cancel upload")}):a.jsx(Z,{variant:"ghost",disabled:Xe,onClick:()=>e(!1),children:s("Cancel")}),a.jsxs(Z,{disabled:!vn||Xe,onClick:()=>xt.mutate(),children:[Xe&&a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}),s(he?"Save changes":"Publish resource")]})]})]})]})}),a.jsx(Nh,{file:D,aspect:16/9,title:s("Choose what shows on the cover"),onCancel:()=>I(null),onCropped:ke=>{j(ke),I(null)}})]})}function $gs({resource:t,open:e,onOpenChange:n,onDelete:r,onEdit:s,onToggleLike:i,onToggleSave:o}){const l=Tn(),{community:c}=qe(),{toast:d}=yt(),[u,h]=y.useState(null),[m,f]=y.useState(null);y.useEffect(()=>h(null),[t==null?void 0:t.id,e]);const p=Egs((c==null?void 0:c.id)||"",e?t==null?void 0:t.id:null),g=y.useMemo(()=>({mediaHandlers:p.mediaHandlers,track:p.track}),[p.mediaHandlers,p.track]);if(!t)return null;const v=async b=>{const x=NN(b.url),w=t.attachments.findIndex(k=>k.url===b.url&&k.name===b.name);if(!(!x||w<0||!(c!=null&&c.id))){f(b.url);try{const k=URL.createObjectURL(await fyr(c.id,t.id,w));p.reportAttachment(b.url);const S=document.createElement("a");S.href=k,S.download=b.name,document.body.appendChild(S),S.click(),S.remove(),URL.revokeObjectURL(k)}catch(k){k instanceof ze&&k.status===422?(window.open(x,"_blank","noopener,noreferrer"),p.reportAttachment(b.url)):d({title:l("Couldn't download this file"),description:dn(k,l("Please try again.")),variant:"destructive"})}finally{f(null)}}};return a.jsxs(a.Fragment,{children:[a.jsx(Bt,{open:e,onOpenChange:n,children:a.jsxs(Ft,{className:"themed-scrollbar max-h-[92vh] w-[calc(100vw-2rem)] max-w-3xl gap-0 overflow-y-auto overflow-x-hidden rounded-2xl border-border/70 bg-card p-0 shadow-2xl",children:[a.jsxs("div",{className:"min-w-0 border-b border-border/70 bg-gradient-to-br from-primary/[0.07] via-card to-card px-6 py-6 pr-14 sm:px-8 sm:py-7 sm:pr-16",children:[a.jsxs(Vt,{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2 text-xs font-semibold uppercase tracking-[0.14em] text-primary",children:[a.jsx("span",{className:"flex h-7 w-7 items-center justify-center rounded-lg bg-primary/10",children:a.jsx(Iu,{className:"h-3.5 w-3.5"})}),l("Knowledge Hub"),t.category&&a.jsxs("span",{className:"inline-flex min-w-0 items-center gap-1 rounded-full bg-primary/10 px-2 py-0.5 normal-case tracking-normal",children:[a.jsx(ka,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),a.jsx("span",{className:"truncate",children:Qv(t.category,l)})]})]}),a.jsx(Ut,{className:"max-w-2xl break-words text-2xl font-semibold leading-tight tracking-tight [overflow-wrap:anywhere] sm:text-[28px]",children:t.title})]}),a.jsxs("div",{className:"mt-4 flex flex-wrap items-center justify-between gap-x-4 gap-y-3 border-t border-border/60 pt-4",children:[a.jsx(_n,{asChild:!0,children:a.jsx(fOt,{resource:t})}),a.jsxs("div",{className:"flex shrink-0 items-center gap-2",children:[a.jsx(gae,{saved:!!t.savedByMe,saveLabel:l("Save this resource"),onToggle:()=>o(t),className:"shadow-none"}),a.jsx(cPe,{resource:t,onToggle:i,className:"shadow-none"}),a.jsx(Cgs,{resource:t})]})]}),t.myProgress&&a.jsx(LIe,{progress:t.myProgress,detailed:!0,className:"mt-4"})]}),a.jsx("div",{className:"min-w-0 px-6 py-6 sm:px-8 sm:py-7",children:a.jsx(mOt,{resource:t,tracking:g,attachmentActions:{viewedUrl:(u==null?void 0:u.url)??null,downloadingUrl:m,onView:b=>{(u==null?void 0:u.url)!==b.url&&p.reportAttachment(b.url),h(x=>(x==null?void 0:x.url)===b.url?null:b)},onDownload:b=>void v(b)}})}),(t.canEdit||t.canDelete)&&a.jsxs("div",{className:"flex items-center justify-between border-t border-border/70 bg-muted/20 px-6 py-4 sm:px-8",children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:t.canEdit?l("You created this resource."):l("Moderator actions")}),a.jsxs("div",{className:"flex items-center gap-2",children:[t.canEdit&&a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>s(t),children:[a.jsx(Qs,{className:"h-4 w-4"}),l("Edit resource")]}),t.canDelete&&a.jsxs(Z,{variant:"ghost",size:"sm",className:"text-muted-foreground hover:bg-destructive/10 hover:text-destructive",onClick:()=>r(t),children:[a.jsx(qn,{className:"h-4 w-4"}),l("Delete")]})]})]})]})}),a.jsx(Bt,{open:!!u,onOpenChange:b=>{b||h(null)},children:a.jsxs(Ft,{className:"flex h-[88vh] w-[calc(100vw-2rem)] max-w-5xl flex-col gap-0 overflow-hidden rounded-2xl border-border/70 bg-card p-0 shadow-2xl",children:[a.jsxs("div",{className:"flex shrink-0 items-center justify-between gap-4 border-b border-border/70 bg-muted/20 px-6 py-4 pr-14",children:[a.jsxs(Vt,{className:"min-w-0 space-y-1",children:[a.jsx(Ut,{className:"truncate text-base",children:(u==null?void 0:u.name)||l("PDF preview")}),a.jsx(_n,{children:l("PDF preview")})]}),u&&a.jsxs(Z,{variant:"outline",size:"sm",disabled:m===u.url,onClick:()=>void v(u),children:[m===u.url?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsx(bc,{className:"h-4 w-4"}),l("Download")]})]}),u&&(qk(u.url)?a.jsx("iframe",{title:u.name,src:qk(u.url)??void 0,className:"min-h-0 flex-1 w-full bg-white"}):a.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:l("This file can't be previewed. Use Download instead.")}))]})})]})}function Ogs(){var we,Be,Ve;const t=Tn(),{community:e}=qe(),{communityDetail:n}=Ln(),{toast:r}=yt(),s=rn(),[i,o]=y.useState(!1),[l,c]=y.useState(null),[d,u]=y.useState(null),[h,m]=y.useState(null),[f,p]=y.useState(""),[g,v]=y.useState(""),[b,x]=y.useState([]),[w,k]=y.useState({}),[S,C]=y.useState("none"),[j,E]=y.useState([]),[N,A]=y.useState([]),[_,T]=y.useState(!1),[R,O]=y.useState(!1),[F,D]=xc(),I=(e==null?void 0:e.id)||"";y.useEffect(()=>{const be=window.setTimeout(()=>v(f.trim()),350);return()=>window.clearTimeout(be)},[f]);const P=y.useMemo(()=>({q:g||void 0,type:b.length?b:void 0,from:w.from,to:w.to,sort:S==="likes"?"likes":void 0,category:j.length?j:void 0,author:N.length?N.map(be=>be.id):void 0,saved:R||void 0}),[N,j,w,g,b,R,S]),M=C0({queryKey:["knowledge-hub",I,P],initialPageParam:1,queryFn:({pageParam:be})=>uyr(I,P,be),getNextPageParam:(be,Ze)=>be.hasMore?(be.page??Ze.length)+1:void 0,enabled:!!I,placeholderData:Uy}),{hasNextPage:z,isFetchingNextPage:G,fetchNextPage:B}=M,H=jt({mutationFn:be=>xyr(I,be),onSuccess:()=>{m(null),c(null),ce(),s.removeQueries({queryKey:["knowledge-hub",I,"resource"]}),s.invalidateQueries({queryKey:["knowledge-hub",I]}),s.invalidateQueries({queryKey:dPe(I)}),s.invalidateQueries({queryKey:uPe(I)}),r({title:t("Resource deleted")})},onError:be=>r({title:t("Could not delete resource"),description:dn(be,t("Please try again.")),variant:"destructive"})}),W=be=>m(be),V=GTt(I),U=Tgs(I),ne=y.useMemo(()=>{var be;return(((be=M.data)==null?void 0:be.pages)??[]).flatMap(Ze=>Ze.resources??[])},[M.data]),te=(we=M.data)==null?void 0:we.pages[0],re=(te==null?void 0:te.hasResources)??ne.length>0,fe=(te==null?void 0:te.total)??ne.length,le=!!(te!=null&&te.hasSaved);y.useEffect(()=>{R&&te&&!te.hasSaved&&O(!1)},[R,te]);const q=!!(g||b.length||EF(w)||S!=="none"||j.length||N.length),Y=()=>{p(""),v(""),x([]),k({}),C("none"),E([]),A([])},X={audio:t("Audio"),video:t("Video"),attachment:t("Attachments")},Q=[...N.map(be=>({key:`author:${be.id}`,label:pn(t("By {name}"),{name:be.name}),clear:()=>A(Ze=>Ze.filter(Pe=>Pe.id!==be.id))})),...j.map(be=>({key:`category:${be}`,label:Qv(be,t),clear:()=>E(Ze=>Ze.filter(Pe=>Pe!==be))})),...b.map(be=>({key:`type:${be}`,label:X[be],clear:()=>x(Ze=>Ze.filter(Pe=>Pe!==be))}))],ie=F.get("resource"),he=ie?ne.find(be=>be.id===ie):null,ye=lt({queryKey:["knowledge-hub",I,"resource",ie],queryFn:()=>zTt(I,ie),enabled:!!I&&!!ie&&!he&&!M.isLoading,retry:!1}),J=he||(ie&&((Ve=(Be=ye.data)==null?void 0:Be.resource)==null?void 0:Ve.id)===ie?ye.data.resource:null),K=l&&(ne.find(be=>be.id===l.id)??l)||J||null,ce=()=>{if(!F.has("resource"))return;const be=new URLSearchParams(F);be.delete("resource"),D(be,{replace:!0})},pe=ye.error;y.useEffect(()=>{if(!pe)return;const be=pe instanceof ze&&pe.status===404;r({title:t(be?"This resource is no longer available":"Couldn't open that resource"),description:be?t("It may have been deleted. Here is the rest of the library."):dn(pe,t("Please try again.")),variant:be?void 0:"destructive"}),ce()},[pe]);const Ie=()=>{c(null),ce()},Me=be=>{Ie(),u(be)};return jN(n)?a.jsx(Gs,{to:ve.dashboard,replace:!0}):a.jsxs(it.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},className:"space-y-6",children:[a.jsxs("div",{className:"flex flex-wrap items-end justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"mb-1 text-xs font-medium uppercase tracking-[0.16em] text-primary",children:t("Community library")}),a.jsx("h1",{className:"text-2xl font-semibold tracking-tight",children:t("Knowledge Hub")}),a.jsx("p",{className:"mt-1 max-w-xl text-sm text-muted-foreground",children:t("Useful ideas, explainers and media shared by your community.")})]}),a.jsxs(Z,{onClick:()=>o(!0),children:[a.jsx(Dn,{className:"mr-2 h-4 w-4"}),t("Share a resource")]})]}),!M.isLoading&&!M.isError&&re&&a.jsxs("div",{className:"space-y-3 rounded-xl border bg-card p-4 shadow-sm",children:[(le||R)&&a.jsx(R$t,{savedOnly:R,onChange:O,allLabel:t("All resources")}),a.jsxs("div",{className:"flex flex-col gap-3 lg:flex-row",children:[a.jsxs("div",{className:"relative min-w-0 flex-1",children:[a.jsx(hs,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Oe,{value:f,onChange:be=>p(be.target.value),placeholder:t("Search title, description, or author…"),"aria-label":t("Search Knowledge Hub resources"),className:"pl-9 pr-9"}),f&&a.jsx("button",{type:"button",onClick:()=>{p(""),v("")},className:"absolute right-2.5 top-1/2 -translate-y-1/2 rounded p-1 text-muted-foreground hover:bg-muted hover:text-foreground","aria-label":t("Clear search"),children:a.jsx(nn,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"flex flex-wrap gap-3 lg:flex-nowrap",children:[a.jsx(URe,{value:w,onChange:k,className:"w-full sm:w-auto sm:max-w-[22rem]"}),a.jsxs(Ni,{open:_,onOpenChange:T,children:[a.jsx(Ti,{asChild:!0,children:a.jsxs(Z,{type:"button",variant:"outline",className:"relative flex-1 justify-center gap-2 lg:flex-none",children:[a.jsx(ast,{className:"h-4 w-4","aria-hidden":!0}),t("Filters"),Q.length>0&&a.jsx("span",{className:"flex h-5 min-w-[1.25rem] items-center justify-center rounded-full bg-primary px-1.5 text-[11px] font-semibold text-primary-foreground tabular-nums","aria-label":pn(t("{count} applied"),{count:Q.length}),children:Q.length})]})}),a.jsxs(yi,{align:"end",className:"w-[min(22rem,calc(100vw-2rem))] space-y-4",onOpenAutoFocus:be=>{var Ze;be.preventDefault(),(Ze=document.getElementById("knowledge-author-filter"))==null||Ze.focus()},children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(_e,{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[t("Author"),a.jsx(gn,{label:t("Author"),children:t("Shows only the resources one member has shared. The list has everyone who has shared a resource here, with how many each has shared; type a name to find someone. You can combine it with the other filters and the search box.")})]}),a.jsx(T$t,{id:"knowledge-author-filter",communityId:I,value:N,onChange:A})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{className:"text-xs text-muted-foreground",children:t("Content category")}),a.jsx(uOt,{mode:"filter",communityId:I,values:j,onValuesChange:E})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{id:"knowledge-type-filter",className:"text-xs text-muted-foreground",children:t("Content type")}),a.jsx("div",{role:"group","aria-labelledby":"knowledge-type-filter",className:"flex flex-wrap gap-2",children:["audio","video","attachment"].map(be=>{const Ze=b.includes(be);return a.jsxs("button",{type:"button","aria-pressed":Ze,onClick:()=>x(Pe=>Ze?Pe.filter(Ke=>Ke!==be):[...Pe,be]),className:ee("inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-sm transition-colors",Ze?"border-primary bg-primary/10 font-medium text-primary":"border-input text-foreground hover:bg-muted"),children:[Ze&&a.jsx(Qn,{className:"h-3.5 w-3.5","aria-hidden":!0}),X[be]]},be)})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:b.length?t("Showing resources with any of these."):t("All content types")})]})]})]}),a.jsxs(zn,{value:S,onValueChange:be=>C(be),children:[a.jsx(On,{className:"flex-1 lg:w-40 lg:flex-none","aria-label":t("Sort resources"),children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"none",children:t("Default order")}),a.jsx(pt,{value:"newest",children:t("Newest first")}),a.jsx(pt,{value:"likes",children:t("Most liked")})]})]})]})]}),(Q.length>0||q)&&a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[Q.map(be=>a.jsxs("span",{className:"inline-flex max-w-full items-center gap-1 rounded-full border bg-muted/50 py-1 pl-3 pr-1 text-xs font-medium",children:[a.jsx("span",{className:"truncate",children:be.label}),a.jsx("button",{type:"button",onClick:be.clear,className:"rounded-full p-0.5 text-muted-foreground hover:bg-background hover:text-foreground","aria-label":pn(t("Remove filter {name}"),{name:be.label}),children:a.jsx(nn,{className:"h-3.5 w-3.5"})})]},be.key)),q&&a.jsx(Z,{type:"button",variant:"ghost",size:"sm",onClick:Y,className:"h-7 px-2 text-xs",children:t("Clear filters")})]})]}),M.isLoading?a.jsx("div",{className:"grid gap-5 sm:grid-cols-2 lg:grid-cols-3",children:[1,2,3,4,5,6].map(be=>a.jsxs("div",{className:"overflow-hidden rounded-xl border",children:[a.jsx("div",{className:"aspect-[16/9] animate-pulse bg-muted"}),a.jsxs("div",{className:"space-y-2 p-4",children:[a.jsx("div",{className:"h-4 w-4/5 animate-pulse rounded bg-muted"}),a.jsx("div",{className:"h-3 w-2/5 animate-pulse rounded bg-muted"})]})]},be))}):M.isError?a.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-dashed py-16 text-center",children:[a.jsx("p",{className:"font-medium",children:t("Could not load the Knowledge Hub")}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:t("Please check your connection and try again.")}),a.jsxs(Z,{variant:"outline",className:"mt-4",onClick:()=>M.refetch(),children:[a.jsx(Nl,{className:"mr-2 h-4 w-4"}),t("Retry")]})]}):re?ne.length===0?a.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-dashed bg-muted/20 py-14 text-center",children:[a.jsx(hs,{className:"mb-3 h-6 w-6 text-muted-foreground"}),a.jsx("p",{className:"font-medium",children:t("No resources found")}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:t("Try another search term or change the filters.")}),a.jsx(Z,{variant:"outline",className:"mt-4",onClick:Y,children:t("Clear filters")})]}):a.jsx("div",{className:"grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4",children:ne.map(be=>a.jsx(hOt,{item:be,onOpen:()=>c(be),onToggleLike:V,onToggleSave:U},be.id))}):a.jsxs("div",{className:"flex flex-col items-center rounded-xl border border-dashed bg-muted/20 py-16 text-center",children:[a.jsx("div",{className:"mb-4 rounded-full bg-primary/10 p-3",children:a.jsx(Iu,{className:"h-6 w-6 text-primary"})}),a.jsx("p",{className:"font-medium",children:t("Build your community library")}),a.jsx("p",{className:"mt-1 max-w-sm text-sm text-muted-foreground",children:t("Share the first useful guide, talk, or audio resource with everyone.")}),a.jsxs(Z,{className:"mt-5",onClick:()=>o(!0),children:[a.jsx(Dn,{className:"mr-2 h-4 w-4"}),t("Share the first resource")]})]}),!M.isLoading&&!M.isError&&ne.length>0&&a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-center text-xs text-muted-foreground",role:"status",children:pn(t(fe===1?"Showing {shown} of {total} resource":"Showing {shown} of {total} resources"),{shown:ne.length,total:fe})}),a.jsx(Z5e,{hasMore:!!z,loading:G,onLoadMore:()=>void B(),label:"resources"})]}),a.jsx(pXe,{open:i,onOpenChange:o,communityId:I}),a.jsx(pXe,{open:!!d,onOpenChange:be=>{be||u(null)},communityId:I,resource:d}),a.jsx($gs,{resource:K,open:!!K,onOpenChange:be=>!be&&Ie(),onDelete:W,onEdit:Me,onToggleLike:V,onToggleSave:U}),a.jsx(Kr,{open:!!h,onOpenChange:be=>{!be&&!H.isPending&&m(null)},children:a.jsxs(Or,{className:"w-[calc(100vw-2rem)] rounded-lg",children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:t("Delete this resource?")}),a.jsx(zr,{children:pn(t("“{title}” will be permanently removed from the Knowledge Hub. This action cannot be undone."),{title:(h==null?void 0:h.title)??""})})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:H.isPending,children:t("Cancel")}),a.jsxs(Yr,{disabled:H.isPending,onClick:be=>{be.preventDefault(),h&&H.mutate(h.id)},className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:[H.isPending&&a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}),t("Delete resource")]})]})]})})]})}const Oq="/assets/profile-cover-BF-SIXwY.jpg",Fgs=5;function Bgs(t){return t.trim().slice(0,2).toUpperCase()||"?"}function Ugs({user:t,onNavigate:e}){return a.jsx(qd,{userId:t.id,className:"block",children:a.jsxs("div",{className:"flex items-center gap-3 rounded-lg px-2 py-2 transition-colors hover:bg-muted/60",onClick:e,children:[a.jsxs(oo,{className:"h-10 w-10 shrink-0",children:[a.jsx(lo,{src:t.picture??void 0,alt:""}),a.jsx(co,{children:Bgs(t.name)})]}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:t.name}),t.shortBio&&a.jsx("p",{className:"truncate text-xs text-muted-foreground",children:t.shortBio})]})]})})}function pOt({open:t,onOpenChange:e,communityId:n,userId:r,kind:s,total:i}){const[o,l]=y.useState([]),[c,d]=y.useState(0),[u,h]=y.useState(!0),[m,f]=y.useState(!1),[p,g]=y.useState(!1),[v,b]=y.useState(null),x=y.useRef(null),w=y.useRef(null),k=y.useRef(!1),S=y.useRef(0);y.useEffect(()=>{t&&(l([]),d(0),h(!0),g(!1),b(null),k.current=!1,S.current+=1)},[t,n,r,s]);const C=y.useCallback(async()=>{if(!t||!n||!r||k.current||!u)return;k.current=!0;const A=S.current;f(!0),g(!1);try{const _=c+1,T=await Cdr(n,r,s,_,Fgs);if(S.current!==A)return;l(R=>{const O=new Set(R.map(F=>F.id));return[...R,...T.users.filter(F=>!O.has(F.id))]}),b(T.total),d(_),h(T.hasMore&&T.users.length>0)}catch{if(S.current!==A)return;g(!0),h(!1)}finally{S.current===A&&(k.current=!1,f(!1))}},[t,n,r,s,c,u]);y.useEffect(()=>{t&&c===0&&u&&C()},[t,c,u,C]),y.useEffect(()=>{const A=x.current;if(!t||!A||!u||c===0||typeof IntersectionObserver>"u")return;const _=new IntersectionObserver(T=>{T.some(R=>R.isIntersecting)&&C()},{root:w.current,rootMargin:"120px"});return _.observe(A),()=>_.disconnect()},[t,u,c,C]);const j=s==="followers"?"Followers":"Following",E=v??i,N=m&&o.length===0;return a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] max-w-md rounded-lg p-5 sm:p-6",children:[a.jsxs(Vt,{className:"pr-6 text-left",children:[a.jsxs(Ut,{children:[j,typeof E=="number"&&a.jsx("span",{className:"ml-2 text-sm font-normal text-muted-foreground",children:E})]}),a.jsx(_n,{className:"sr-only",children:s==="followers"?"People who follow this member.":"People this member follows."})]}),a.jsx("div",{ref:w,className:"themed-scrollbar max-h-[60vh] min-h-[6rem] overflow-y-auto overscroll-contain pr-1 [scrollbar-gutter:stable]",children:N?a.jsx("div",{className:"space-y-3 p-2",children:Array.from({length:3}).map((A,_)=>a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(sr,{className:"h-10 w-10 rounded-full"}),a.jsxs("div",{className:"flex-1 space-y-1.5",children:[a.jsx(sr,{className:"h-3.5 w-32"}),a.jsx(sr,{className:"h-3 w-20"})]})]},_))}):o.length===0?a.jsxs("div",{className:"flex flex-col items-center gap-2 py-10 text-center",children:[a.jsx(oI,{className:"h-8 w-8 text-muted-foreground"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:p?"This list could not be loaded.":s==="followers"?"No followers yet.":"Not following anyone yet."})]}):a.jsxs("div",{className:"space-y-0.5",children:[o.map(A=>a.jsx(Ugs,{user:A,onNavigate:()=>e(!1)},A.id)),a.jsx("div",{ref:x,"aria-hidden":!0,className:"h-px"}),m&&a.jsxs("div",{className:"flex items-center justify-center gap-2 py-3 text-xs text-muted-foreground",children:[a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"})," Loading more…"]}),p&&a.jsx("p",{className:"py-3 text-center text-xs text-destructive",children:"Some people could not be loaded."})]})})]})})}const gXe=[{id:"posts",label:"Posts"},{id:"reposts",label:"Reposts"},{id:"comments",label:"Comments"},{id:"replies",label:"Replies"},{id:"likes",label:"Post likes"},{id:"all",label:"All activity"}],zgs={comments:["post-comment"],replies:["comment-reply"],likes:["post-like"]};function gOt({communityId:t,userId:e,name:n,isSelf:r}){const s=Tn(),[i,o]=Y2(`profile:activity:${e??""}`,null),l=gXe.find(d=>d.id===i),c=(d,u)=>r?s(d):pn(s(u),{name:n||s("This member")});return l?a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("button",{type:"button",onClick:()=>o(null),className:"flex h-9 w-9 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground","aria-label":s("Back to activity"),children:a.jsx(no,{className:"h-4 w-4"})}),a.jsx("h3",{className:"text-base font-semibold text-foreground",children:s(l.label)})]}),l.id==="posts"&&a.jsx(CF,{communityId:t,userId:e,kind:"posts",emptyLabel:c("You haven't posted yet.","{name} hasn't posted yet.")}),l.id==="reposts"&&a.jsx(CF,{communityId:t,userId:e,kind:"reposts",emptyLabel:c("You haven't reposted anything yet.","{name} hasn't reposted anything yet.")}),(l.id==="comments"||l.id==="replies"||l.id==="likes")&&a.jsx(rwe,{communityId:t,userId:e,activityTypes:zgs[l.id],emptyLabel:l.id==="comments"?c("You haven't commented yet.","{name} hasn't commented yet."):l.id==="replies"?c("You haven't replied to a comment yet.","{name} hasn't replied to a comment yet."):c("You haven't liked a post yet.","{name} hasn't liked a post yet.")}),l.id==="all"&&a.jsx(rwe,{communityId:t,userId:e,emptyLabel:s("No activity yet.")})]}):a.jsxs("div",{className:"overflow-hidden rounded-xl border border-border bg-card",children:[a.jsx("p",{className:"px-4 pb-1 pt-4 text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:s("Activity")}),a.jsx("ul",{className:"divide-y divide-border",children:gXe.map(d=>a.jsx("li",{children:a.jsxs("button",{type:"button",onClick:()=>o(d.id),className:"flex w-full items-center justify-between gap-3 px-4 py-3.5 text-left text-sm font-medium text-foreground transition-colors hover:bg-muted/60 focus-visible:bg-muted/60 focus-visible:outline-none sm:text-base",children:[s(d.label),a.jsx(io,{className:"h-4 w-4 shrink-0 text-muted-foreground","aria-hidden":!0})]})},d.id))})]})}function vOt({fields:t,answers:e}){const n=t.map(r=>({field:r,text:MAe(r,e[r.id])})).filter(r=>r.text);return a.jsx("dl",{className:"space-y-2.5",children:n.map(({field:r,text:s})=>a.jsxs("div",{className:"flex flex-col gap-0.5 text-sm sm:flex-row sm:gap-3",children:[a.jsx("dt",{className:"shrink-0 text-muted-foreground sm:w-40",children:r.label}),a.jsx("dd",{className:"min-w-0 whitespace-pre-line text-foreground [overflow-wrap:anywhere]",children:r.type==="url"&&/^https?:\/\//i.test(String(e[r.id]))?a.jsx("a",{href:String(e[r.id]),target:"_blank",rel:"noopener noreferrer nofollow",className:"text-primary hover:underline",children:s}):a.jsxs("span",{className:"inline-flex max-w-full items-center gap-2",children:[a.jsx(v9,{field:r,value:e[r.id],size:"sm"}),a.jsx("span",{className:"min-w-0",children:s})]})})]},r.id))})}function Vgs({communityId:t,communityName:e}){const{toast:n}=yt(),r=kNt(t),{data:s,values:i,errors:o,locked:l,saving:c}=r,[d,u]=y.useState(!1);if(r.isLoading||!s||s.fields.length===0)return null;const h=s.fields.some(p=>!PS(s.answers[p.id])),m=()=>{r.reset(),u(!0)},f=async()=>{const p=await r.save();p.ok?(n({title:"Details saved",description:"They show in the member directory."}),u(!1)):p.fieldId||n({title:"Couldn't save your details",description:p.message,variant:"destructive"})};return a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[a.jsxs("h3",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[a.jsx(k0,{className:"h-4 w-4 text-primary","aria-hidden":!0}),e?`Your details in ${e}`:"Your community details"]}),a.jsxs(Z,{variant:"outline",size:"sm",onClick:m,children:[a.jsx(Qs,{className:"mr-1.5 h-3.5 w-3.5"})," ",h?"Edit":"Add"]})]}),h?a.jsx(vOt,{fields:s.fields,answers:s.answers}):a.jsx("p",{className:"text-sm text-muted-foreground",children:"Share a few details so members can find you in the directory."}),a.jsx(Bt,{open:d,onOpenChange:p=>!c&&u(p),children:a.jsxs(Ft,{className:"flex max-h-[90vh] w-[calc(100vw-2rem)] max-w-lg flex-col gap-0 overflow-hidden p-0",children:[a.jsxs(Vt,{className:"border-b border-border px-5 py-4 text-left",children:[a.jsxs(Ut,{children:["Your details",e?` in ${e}`:""]}),a.jsx(_n,{children:"Shown in this community's member directory. Fields marked “Only admins see this” stay private to the admins."})]}),a.jsxs("form",{className:"flex min-h-0 flex-1 flex-col",noValidate:!0,onSubmit:p=>{p.preventDefault(),f()},children:[a.jsx("div",{className:"min-h-0 flex-1 overflow-y-auto px-5 py-4",children:a.jsx(iF,{idPrefix:"profile-field",fields:s.fields,values:i,errors:o,lockedIds:l,disabled:c,onChange:r.setValue})}),a.jsxs(ir,{className:"gap-2 border-t border-border px-5 py-3 sm:gap-0",children:[a.jsx(Z,{type:"button",variant:"outline",onClick:()=>u(!1),disabled:c,children:"Cancel"}),a.jsxs(Z,{type:"submit",disabled:c,children:[c?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):null,"Save"]})]})]})]})})]})}function Hgs({communityId:t,userId:e,name:n}){const{data:r}=lt({queryKey:[...Hk(t),"user",e],queryFn:()=>jpr(t,e),staleTime:6e4,retry:!1});return!r||!r.fields.some(s=>!PS(r.answers[s.id]))?null:a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsxs("h3",{className:"mb-3 flex items-center gap-2 text-sm font-semibold text-foreground",children:[a.jsx(k0,{className:"h-4 w-4 text-primary","aria-hidden":!0}),n?`About ${n}`:"Community details"]}),a.jsx(vOt,{fields:r.fields,answers:r.answers})]})}function yOt({userId:t,name:e,self:n=!1}){const{community:r}=qe();return r!=null&&r.id?n?a.jsx(Vgs,{communityId:r.id,communityName:r.name}):t?a.jsx(Hgs,{communityId:r.id,userId:t,name:e}):null:null}const Ggs=[{key:"webLink",label:"Website",icon:Qd},{key:"linkedinLink",label:"LinkedIn",icon:$rt},{key:"twitterLink",label:"Twitter",icon:dst},{key:"instagramLink",label:"Instagram",icon:Mrt},{key:"facebookLink",label:"Facebook",icon:Art},{key:"youtubeLink",label:"YouTube",icon:hst},{key:"dribbbleLink",label:"Dribbble",icon:bo},{key:"behanceLink",label:"Behance",icon:bo},{key:"pintrestLink",label:"Pinterest",icon:bo}];function Wgs(t){return Ggs.map(e=>({...e,url:(t[e.key]||"").trim()})).filter(e=>e.url)}function qgs(){var B,H,W,V;const{userId:t}=So(),e=Nn(),{toast:n}=yt(),{user:r}=jr(),{community:s}=qe(),i=(s==null?void 0:s.id)??null,{communityDetail:o}=Ln(),l=!!(o!=null&&o.isDirectMessageDisabled),c=(r==null?void 0:r.id)??null,d=!!(t&&c&&t===c),[u,h]=Y2("profile:tab","about"),[m,f]=y.useState(!1),[p,g]=y.useState(null),[v,b]=y.useState(!1),[x,w]=y.useState(null),[k,S]=y.useState(!1),[C,j]=y.useState(!1),[E,N]=y.useState(!1),A=async()=>{if(!(!i||!t)){j(!0);try{await Tse(i,t),n({title:"User blocked",description:"You will no longer see their content."}),S(!1),e(ve.community)}catch{n({title:"Couldn't block this user",variant:"destructive"})}finally{j(!1)}}},_=lt({queryKey:["public-profile",t],queryFn:()=>Yjt(t),enabled:!!t}),T=_.data??null,R=lt({queryKey:["follow-counts",i,t],queryFn:()=>Qjt(i,t),enabled:!!(i&&t)}),{earned:O}=qRe(t);y.useEffect(()=>{T&&f(!!T.isFollowedByMe)},[T]),y.useEffect(()=>N(!1),[T==null?void 0:T.banner]);const F=async()=>{if(!i||!t)return;const U=m;f(!U),b(!0);try{U?await ese(i,t):await Xre(i,t),_se(t,!U),R.refetch()}catch{f(U),n({title:"Couldn't update follow",variant:"destructive"})}finally{b(!1)}};if(_.isLoading)return a.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[a.jsx(sr,{className:"h-8 w-40"}),a.jsx(sr,{className:"h-56 w-full rounded-2xl"}),a.jsx(sr,{className:"h-40 w-full rounded-xl"})]});if(!T||T.isProhibited)return a.jsxs("div",{className:"flex flex-col items-center justify-center min-h-[60vh] gap-4",children:[a.jsx("p",{className:"text-lg text-muted-foreground",children:T!=null&&T.isProhibited?"This member is unavailable":"Member not found"}),a.jsxs(Z,{variant:"outline",onClick:()=>e(-1),children:[a.jsx(no,{className:"h-4 w-4 mr-2"})," Go back"]})]});const D=o7(T.picture,T.name),I=Wgs(T),P=((B=R.data)==null?void 0:B.followersCount)??T.followersCount??0,M=((H=R.data)==null?void 0:H.followingCount)??T.followingCount??0,z=(T.additionalMetaDetails??[]).filter(U=>U.label&&U.value),G=[{key:"about",label:"About"},{key:"posts",label:"Posts"},{key:"activity",label:"Activity"},{key:"achievements",label:"Achievements"}];return a.jsxs(it.div,{initial:{opacity:0},animate:{opacity:1},transition:{duration:.3},className:"max-w-4xl mx-auto space-y-6",children:[a.jsxs(Z,{variant:"ghost",size:"sm",onClick:()=>e(-1),className:"text-muted-foreground hover:text-foreground -ml-2",children:[a.jsx(no,{className:"h-4 w-4 mr-1.5"})," Back"]}),a.jsxs(it.div,{initial:{opacity:0,y:12},animate:{opacity:1,y:0},transition:{duration:.4,delay:.1},className:"relative rounded-2xl border border-border bg-card overflow-hidden",children:[a.jsx("div",{className:"relative h-32 bg-gradient-to-r from-primary/20 via-primary/10 to-accent/20",children:a.jsx("img",{src:T.banner&&!E?T.banner:Oq,alt:"Cover",className:"absolute inset-0 w-full h-full object-cover",onError:()=>{T.banner&&N(!0)}})}),a.jsxs("div",{className:"relative px-6 pb-6",children:[a.jsxs("div",{className:"-mt-12 flex flex-wrap items-start gap-4",children:[a.jsxs(oo,{className:"h-24 w-24 ring-4 ring-card shadow-lg",children:[a.jsx(lo,{src:D,alt:T.name}),a.jsx(co,{className:"text-2xl font-bold bg-primary/10 text-primary",children:((V=(W=T.name)==null?void 0:W[0])==null?void 0:V.toUpperCase())||"?"})]}),a.jsxs("div",{className:"flex-1 basis-full sm:basis-0 sm:pt-12 pb-1 min-w-0",children:[a.jsx("h1",{className:"text-xl font-bold text-foreground truncate",children:T.name}),T.title&&a.jsxs("p",{className:"flex min-w-0 items-center gap-1.5 text-sm font-medium text-foreground/80",children:[a.jsx(oee,{className:"h-3.5 w-3.5 shrink-0"}),a.jsx("span",{className:"truncate",children:T.title})]}),(T.userId||T.location)&&a.jsxs("p",{className:"flex flex-wrap items-center gap-x-3 gap-y-0.5 text-sm text-muted-foreground",children:[T.userId&&a.jsxs("span",{className:"truncate",children:["@",T.userId]}),T.location&&a.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[a.jsx(Jf,{className:"h-3.5 w-3.5 shrink-0"}),a.jsx("span",{className:"truncate",children:T.location})]})]}),T.shortBio&&a.jsx("p",{className:"text-sm text-foreground/70 mt-1",children:T.shortBio})]}),a.jsx("div",{className:"flex gap-2 pb-1 shrink-0 w-full sm:w-auto self-end",children:d?a.jsxs(Z,{size:"sm",variant:"outline",onClick:()=>e(ve.profile),children:[a.jsx(iI,{className:"h-4 w-4 mr-1.5"})," Edit profile"]}):a.jsxs(a.Fragment,{children:[!l&&a.jsxs(Z,{size:"sm",variant:"outline",onClick:()=>c0(e,{id:T.id,name:T.name,avatar:T.picture,userId:T.userId,communityId:i??void 0}),children:[a.jsx(wd,{className:"h-4 w-4 mr-1.5"})," Message"]}),a.jsx(Z,{size:"sm",variant:m?"outline":"default",onClick:F,disabled:v,children:m?a.jsxs(a.Fragment,{children:[a.jsx(ESe,{className:"h-4 w-4 mr-1.5"})," Following"]}):a.jsxs(a.Fragment,{children:[a.jsx(Sa,{className:"h-4 w-4 mr-1.5"})," Follow"]})}),a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{size:"sm",variant:"ghost",className:"px-2",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[a.jsxs(ot,{onClick:()=>w({id:T.id,name:T.name}),children:[a.jsx(xd,{className:"mr-2 h-4 w-4"})," Report user"]}),a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>S(!0),children:[a.jsx(mm,{className:"mr-2 h-4 w-4"})," Block user"]})]})]})]})})]}),a.jsxs("div",{className:"mt-5 flex flex-col gap-3 border-t border-border pt-4 sm:flex-row sm:items-center sm:justify-between",children:[a.jsxs("div",{className:"flex gap-4",children:[a.jsxs("button",{type:"button",className:"text-sm transition-colors hover:text-foreground disabled:cursor-default disabled:opacity-100",disabled:P===0,onClick:()=>g("followers"),children:[a.jsx("strong",{className:"text-foreground",children:P})," ",a.jsx("span",{className:"text-muted-foreground",children:"followers"})]}),a.jsxs("button",{type:"button",className:"text-sm transition-colors hover:text-foreground disabled:cursor-default disabled:opacity-100",disabled:M===0,onClick:()=>g("following"),children:[a.jsx("strong",{className:"text-foreground",children:M})," ",a.jsx("span",{className:"text-muted-foreground",children:"following"})]})]}),I.length>0&&a.jsx("div",{className:"flex flex-wrap gap-2",children:I.map(U=>{const ne=U.icon;return a.jsx(uAe,{hint:U.label,children:a.jsx("a",{href:U.url,target:"_blank",rel:"noopener noreferrer","aria-label":U.label,className:"flex h-8 w-8 items-center justify-center rounded-full border border-border text-muted-foreground transition-colors hover:bg-muted hover:text-primary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:a.jsx(ne,{className:"h-4 w-4"})})},U.key)})})]}),a.jsx(pOt,{open:p!==null,onOpenChange:U=>!U&&g(null),communityId:i??null,userId:t??null,kind:p??"followers",total:p==="followers"?P:M})]})]}),a.jsx("div",{className:"flex gap-1 border-b border-border",children:G.map(U=>a.jsxs("button",{onClick:()=>h(U.key),className:ee("px-4 py-2.5 text-sm font-medium transition-all relative",u===U.key?"text-primary":"text-muted-foreground hover:text-foreground"),children:[U.label,u===U.key&&a.jsx(it.div,{layoutId:"member-tab-indicator",className:"absolute bottom-0 left-0 right-0 h-0.5 bg-primary rounded-full",transition:{type:"spring",stiffness:500,damping:35}})]},U.key))}),a.jsxs(it.div,{initial:{opacity:0,y:6},animate:{opacity:1,y:0},transition:{duration:.25},children:[u==="about"&&a.jsxs("div",{className:"space-y-5",children:[T.bio?a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground mb-2",children:"Bio"}),a.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed whitespace-pre-line",children:T.bio})]}):a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5 text-sm text-muted-foreground",children:[T.name," hasn't added a bio yet."]}),T.isProhibited?null:a.jsx(yOt,{userId:t,name:T.name,self:d}),z.length>0&&a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:"Details"}),a.jsx("dl",{className:"space-y-2",children:z.map(U=>a.jsxs("div",{className:"flex gap-3 text-sm",children:[a.jsx("dt",{className:"w-32 shrink-0 text-muted-foreground",children:U.label}),a.jsx("dd",{className:"text-foreground",children:U.value})]},`${U.label}-${U.value}`))})]})]}),u==="posts"&&a.jsx(CF,{communityId:i,userId:t,emptyLabel:`${T.name} hasn't posted yet.`}),u==="activity"&&a.jsx(gOt,{communityId:i,userId:t,name:T.name,isSelf:d}),u==="achievements"&&a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-2",children:[a.jsx(Bx,{className:"h-4 w-4 text-primary"}),"Badges"]}),O.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No badges earned yet."}):a.jsx("div",{className:"flex flex-wrap gap-3",children:O.map(U=>{var ne,te,re;return a.jsxs("div",{title:(ne=U.badge)==null?void 0:ne.description,className:"flex items-center gap-2 rounded-full border border-border bg-muted/30 px-4 py-2 text-sm",children:[a.jsx("span",{className:"text-base leading-none",children:((te=U.badge)==null?void 0:te.icon)||"🏅"}),a.jsx("span",{className:"text-foreground font-medium",children:((re=U.badge)==null?void 0:re.name)||"Badge"})]},U.id)})})]})]},u),a.jsx(n9,{target:x,communityId:i??void 0,onOpenChange:U=>!U&&w(null)}),a.jsx(Kr,{open:k,onOpenChange:S,children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsxs(Ur,{children:["Block ",T.name,"?"]}),a.jsx(zr,{children:"You won't see their posts, comments or messages anymore. You can unblock them later from Settings."})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:C,children:"Cancel"}),a.jsx(Yr,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:C,onClick:U=>{U.preventDefault(),A()},children:C?"Blocking…":"Block user"})]})]})})]})}const Ihe="community-default";function Kgs(){var c;const t=Tn(),{community:e}=qe(),n=(e==null?void 0:e.id)??null,{toast:r}=yt(),s=rn(),i=Jct(n,((c=ro())==null?void 0:c.id)??null),{data:o}=lt({queryKey:i,queryFn:()=>Xct(n),enabled:!!(n&&i[2]),staleTime:5*6e4}),l=jt({mutationFn:d=>Enn(n,d),onSuccess:d=>{s.setQueryData(i,d),r({title:d.language?t("Language updated"):t("Using the community's language"),description:t("Only you see this change.")})},onError:d=>r({title:t("Couldn't change your language"),description:dn(d,t("Please try again.")),variant:"destructive"})});return o!=null&&o.canChoose?a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsxs("h3",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[a.jsx(zBt,{className:"h-4 w-4 text-primary"}),t("Language"),a.jsx(gn,{label:t("Language"),children:t("Menus, buttons and labels are shown in the language you pick here, for you only. Posts, comments and messages stay in the language they were written in. Other members keep the community's language unless they pick their own.")})]}),a.jsx("p",{className:"mb-4 mt-1 text-xs text-muted-foreground",children:t("Choose the language you read this community in.")}),a.jsxs(zn,{value:o.language??Ihe,disabled:l.isPending,onValueChange:d=>l.mutate(d===Ihe?null:d),children:[a.jsx(On,{className:"w-full sm:w-72","aria-label":t("My language"),children:a.jsx(Vn,{})}),a.jsxs(Fn,{className:"max-h-64",children:[a.jsx(pt,{value:Ihe,children:t("Community default")}),o.options.map(d=>a.jsx(pt,{value:d.value,children:d.label},d.value))]})]})]}):null}function Ygs(){var o;const t=Tn(),{toast:e}=yt(),n=rn(),{data:r}=lt({queryKey:["my-profile"],queryFn:lCe,staleTime:15e3}),s=jt({mutationFn:l=>mWt(l),onSuccess:(l,c)=>{n.setQueryData(["my-profile"],d=>d&&{...d,preferences:l.preferences}),n.invalidateQueries({queryKey:["dm-thread"]}),e({title:t(c?"Read receipts turned on":"Read receipts turned off")})},onError:l=>e({title:t("Couldn't update read receipts"),description:dn(l,t("Please try again.")),variant:"destructive"})});if(!r)return null;const i=s.isPending?!!s.variables:!((o=r.preferences)!=null&&o.hideReadReceipts);return a.jsx("div",{className:"rounded-xl border border-border bg-card p-5",children:a.jsxs("div",{className:"flex items-center justify-between gap-4",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("h3",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[a.jsx(lee,{className:"h-4 w-4 text-primary"}),t("Read receipts"),a.jsx(gn,{label:t("Read receipts"),children:t("When this is on, people you message one-to-one see blue ticks once you've read their messages, and you see theirs. Turn it off and neither of you sees them. Group chats always show read receipts.")})]}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:t("Show when you've read direct messages.")})]}),a.jsx(Hs,{checked:i,disabled:s.isPending,onCheckedChange:l=>s.mutate(l),"aria-label":t("Read receipts")})]})})}function Qgs(){const{user:t}=jr(),{community:e}=qe(),n=(e==null?void 0:e.id)??null,r=(t==null?void 0:t.id)??null,s=lt({queryKey:["my-profile"],queryFn:lCe,staleTime:15e3}),i=lt({queryKey:["follow-counts",n,r],queryFn:()=>Qjt(n,r),enabled:!!(n&&r),staleTime:15e3}),{myScore:o}=nse(),{earned:l}=qRe(r),{streak:c}=GRe();return{profile:s.data??null,isLoading:s.isLoading,isError:s.isError,followCounts:i.data??null,myScore:o,earnedBadges:l,streak:c,refetch:s.refetch}}const Uc=t=>encodeURIComponent(t);async function Zgs(t){const e=await ae.get(`/community/${Uc(t)}/earn-rules`);return Array.isArray(e==null?void 0:e.rules)?e.rules:[]}async function Jgs(t,e){await ae.post(`/community/${Uc(t)}/reward-redemptions/${Uc(e)}/cancel`,{})}async function Xgs(t){const e=await ae.get(`/community/${Uc(t)}/admin/rewards/analytics`);return(e==null?void 0:e.analytics)??null}async function evs(t,e){var i;const n=new FormData;n.append("images[]",e,e.name);const r=await Ea(`/community/${Uc(t)}/media/upload?attachmentType=image`,n),s=(i=r==null?void 0:r.publicUrls)==null?void 0:i[0];if(!s)throw new Error("Upload failed");return s}async function bOt(t){const e=await ae.get(`/community/${Uc(t)}/rewards`);return{rewards:Array.isArray(e==null?void 0:e.rewards)?e.rewards:[],balance:(e==null?void 0:e.balance)??{spendable:0,lifetimeEarned:0}}}async function tvs(t,e,n={}){return ae.post(`/community/${Uc(t)}/rewards/${Uc(e)}/redeem`,n)}async function nvs(t){const e=await ae.get(`/community/${Uc(t)}/reward-redemptions/mine`);return Array.isArray(e==null?void 0:e.redemptions)?e.redemptions:[]}async function rvs(t){const e=await ae.get(`/community/${Uc(t)}/admin/rewards`);return Array.isArray(e==null?void 0:e.rewards)?e.rewards:[]}async function svs(t,e){return(await ae.post(`/community/${Uc(t)}/rewards`,e)).reward}async function ivs(t,e,n){return(await ae.post(`/community/${Uc(t)}/rewards/${Uc(e)}`,n)).reward}async function avs(t,e){await ae.delete(`/community/${Uc(t)}/rewards/${Uc(e)}`)}async function ovs(t,e){const r=await ae.get(`/community/${Uc(t)}/admin/reward-redemptions`);return Array.isArray(r==null?void 0:r.redemptions)?r.redemptions:[]}async function lvs(t,e,n,r={}){await ae.post(`/community/${Uc(t)}/admin/reward-redemptions/${Uc(e)}`,{action:n,...r})}const xOt={"posts-created":"Posts created","likes-received":"Likes received","comments-made":"Comments made","replies-made":"Replies made","karma-total":"Total karma points","streak-days":"Streak days reached","rank-top":"Rank within top N","groups-joined":"Groups joined"};function wOt(t,e){return t==="rank-top"?`Reach the top ${e}`:`${xOt[t]} ≥ ${e}`}const cvs={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.06}}},r4={hidden:{opacity:0,y:12},show:{opacity:1,y:0,transition:{duration:.4,ease:"easeOut"}}},dvs={about:"About",posts:"Posts",activity:"Activity",achievements:"Achievements",settings:"Settings"},uvs=[{key:"webLink",label:"Website",icon:Qd},{key:"linkedinLink",label:"LinkedIn",icon:$rt},{key:"twitterLink",label:"Twitter",icon:dst},{key:"instagramLink",label:"Instagram",icon:Mrt},{key:"facebookLink",label:"Facebook",icon:Art},{key:"youtubeLink",label:"YouTube",icon:hst},{key:"dribbbleLink",label:"Dribbble",icon:bo},{key:"behanceLink",label:"Behance",icon:bo},{key:"pintrestLink",label:"Pinterest",icon:bo}];function hvs(t){if(!t)return null;const e=new Date(t);return Number.isNaN(e.getTime())?null:e.toLocaleDateString(void 0,{month:"long",year:"numeric"})}function mvs(t){return t?uvs.map(e=>({...e,url:(t[e.key]||"").trim()})).filter(e=>e.url):[]}function fvs(){var B,H,W,V;const t=Tn(),{toast:e}=yt(),n=rn(),{applyPensilSessionUser:r}=jr(),{community:s}=qe(),i=(s==null?void 0:s.id)??null,{profile:o,isLoading:l,followCounts:c,myScore:d,earnedBadges:u,streak:h}=Qgs(),[m,f]=y.useState(null),p=tv(),[g,v]=Y2("profile:tab","about"),[b,x]=y.useState(!1),[w,k]=y.useState(null),[S,C]=y.useState(null),j=y.useRef(null),E=y.useRef(null),[N,A]=y.useState(null);y.useEffect(()=>{if(!i)return;let U=!1;return bOt(i).then(ne=>{U||A(ne.balance)}).catch(()=>{U||A(null)}),()=>{U=!0}},[i]);const _=y.useMemo(()=>{var re,fe;const U=(re=d==null?void 0:d.breakdown)==null?void 0:re.statistics,ne=((fe=d==null?void 0:d.breakdown)==null?void 0:fe.grandTotal)??(d==null?void 0:d.score)??0,te=(N==null?void 0:N.spendable)??ne;return[{label:t("Posts"),value:(U==null?void 0:U.postCreate)??0,icon:wd},{label:t("Followers"),value:(c==null?void 0:c.followersCount)??0,icon:wr,followList:"followers"},{label:t("Following"),value:(c==null?void 0:c.followingCount)??0,icon:wr,followList:"following"},{label:pn(t("{points} earned"),{points:p}),value:ne,icon:Hg},{label:pn(t("{points} to spend"),{points:p}),value:te,icon:gK}]},[d,c,p,N,t]);if(l||!o)return a.jsx(pvs,{});const T=o7(o.picture,o.name),R=o.banner||Oq,O=hvs(o.createdAt),F=mvs(o),D=((B=d==null?void 0:d.breakdown)==null?void 0:B.grandTotal)??(d==null?void 0:d.score)??0,I=k9(D),P=async U=>{var te;const ne=(te=U.target.files)==null?void 0:te[0];if(U.target.value="",!!ne){k("avatar");try{const re=await uCe(ne),fe=await nd.syncPensilUser({picture:re.picture});r(fe.user),await n.invalidateQueries({queryKey:["my-profile"]}),e({title:t("Profile picture updated")})}catch(re){e({title:t("Couldn't update picture"),description:dn(re,t("Please try again.")),variant:"destructive"})}finally{k(null)}}},M=U=>{var te;const ne=(te=U.target.files)==null?void 0:te[0];U.target.value="",ne&&C(ne)},z=async U=>{C(null),k("cover");try{await fWt(U),await n.invalidateQueries({queryKey:["my-profile"]}),e({title:t("Cover photo updated")})}catch(ne){e({title:t("Couldn't update cover"),description:dn(ne,t("Please try again.")),variant:"destructive"})}finally{k(null)}},G=()=>{navigator.clipboard.writeText(`${window.location.origin}/member/${o.id}`),e({title:t("Link copied!"),description:t("Profile link copied to clipboard.")})};return a.jsxs(it.div,{variants:cvs,initial:"hidden",animate:"show",className:"max-w-4xl mx-auto space-y-6",children:[a.jsxs(it.div,{variants:r4,className:"relative",children:[a.jsxs("div",{className:"h-44 rounded-2xl relative overflow-hidden",children:[a.jsx("img",{src:R,alt:t("Cover"),className:"w-full h-full object-cover",onError:U=>{U.currentTarget.src.endsWith(Oq)||(U.currentTarget.src=Oq)}}),a.jsx("input",{ref:E,type:"file",accept:"image/*",className:"hidden",onChange:M}),a.jsx("button",{onClick:()=>{var U;return(U=E.current)==null?void 0:U.click()},disabled:w==="cover",className:"absolute bottom-3 right-3 bg-background/80 backdrop-blur-sm rounded-full p-2 hover:bg-background transition-colors disabled:opacity-60",children:a.jsx(FP,{className:ee("h-4 w-4 text-foreground",w==="cover"&&"animate-pulse")})})]}),a.jsx("div",{className:"absolute -bottom-14 left-6 flex items-end gap-4",children:a.jsxs("div",{className:"relative",children:[a.jsxs(oo,{className:"h-28 w-28 border-4 border-background shadow-lg",children:[a.jsx(lo,{src:T,alt:o.name}),a.jsx(co,{className:"text-3xl font-bold bg-primary text-primary-foreground",children:((W=(H=o.name)==null?void 0:H[0])==null?void 0:W.toUpperCase())||"U"})]}),a.jsx("input",{ref:j,type:"file",accept:"image/*",className:"hidden",onChange:P}),a.jsx("button",{onClick:()=>{var U;return(U=j.current)==null?void 0:U.click()},disabled:w==="avatar",className:"absolute bottom-1 right-1 bg-primary rounded-full p-1.5 shadow-md hover:bg-primary/90 transition-colors disabled:opacity-60",children:a.jsx(FP,{className:ee("h-3.5 w-3.5 text-primary-foreground",w==="avatar"&&"animate-pulse")})})]})})]}),a.jsxs(it.div,{variants:r4,className:"pt-10 px-1",children:[a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[a.jsxs("div",{className:"min-w-0 space-y-1",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h1",{className:"text-2xl font-bold text-foreground",children:o.name}),((h==null?void 0:h.currentStreak)??0)>0&&a.jsxs(ga,{variant:"secondary",className:"gap-1 text-orange-500 bg-orange-50 border-orange-200",children:[a.jsx(D8,{className:"h-3.5 w-3.5"})," ",h==null?void 0:h.currentStreak]})]}),o.userId&&a.jsxs("p",{className:"text-muted-foreground text-sm",children:["@",o.userId]}),o.title&&a.jsxs("p",{className:"flex items-center gap-1.5 text-sm font-medium text-foreground/80",children:[a.jsx(oee,{className:"h-3.5 w-3.5 shrink-0"}),a.jsx("span",{className:"min-w-0 [overflow-wrap:anywhere]",children:o.title})]}),o.shortBio&&a.jsx("p",{className:"text-sm text-foreground/70",children:o.shortBio}),a.jsxs("div",{className:"flex items-center gap-4 mt-2 text-sm text-muted-foreground flex-wrap",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(Bx,{className:"h-3.5 w-3.5"}),I.badge," ",t(I.title)]}),o.location&&a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(Jf,{className:"h-3.5 w-3.5"}),o.location]}),O&&a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(I8,{className:"h-3.5 w-3.5"}),pn(t("Joined {date}"),{date:O})]})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Z,{variant:"outline",size:"sm",onClick:G,className:"gap-1.5",children:[a.jsx(bo,{className:"h-3.5 w-3.5"})," ",t("Share")]}),a.jsxs(Z,{size:"sm",onClick:()=>x(!0),className:"gap-1.5",children:[a.jsx(iI,{className:"h-3.5 w-3.5"})," ",t("Edit profile")]})]})]}),o.bio&&a.jsx("p",{className:"text-sm text-foreground/80 mt-3 max-w-2xl leading-relaxed whitespace-pre-line",children:o.bio}),a.jsxs("div",{className:"flex items-center gap-4 mt-3 text-sm flex-wrap",children:[F.map(U=>{const ne=U.icon;return a.jsxs("a",{href:U.url,target:"_blank",rel:"noopener noreferrer",title:t(U.label),className:"flex items-center gap-1 text-primary hover:underline",children:[a.jsx(ne,{className:"h-3.5 w-3.5"}),t(U.label)]},U.key)}),o.email&&a.jsxs("span",{className:"flex items-center gap-1 text-muted-foreground",children:[a.jsx(Ii,{className:"h-3.5 w-3.5"}),o.email]})]})]}),a.jsx(it.div,{variants:r4,className:"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-5 gap-3",children:_.map(U=>{const ne=U.icon,te=!!U.followList&&U.value>0,re=te?"button":"div";return a.jsxs(re,{...te?{type:"button",onClick:()=>f(U.followList)}:{},className:ee("rounded-xl border border-border bg-card p-4 text-center hover:shadow-md transition-shadow group w-full",te?"cursor-pointer":"cursor-default"),children:[a.jsx(ne,{className:"h-5 w-5 mx-auto mb-2 text-muted-foreground group-hover:text-primary transition-colors"}),a.jsx("p",{className:ee("text-2xl font-bold text-foreground",te&&"group-hover:text-primary transition-colors"),children:U.value.toLocaleString()}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:U.label})]},U.label)})}),a.jsx(pOt,{open:m!==null,onOpenChange:U=>!U&&f(null),communityId:i,userId:o.id,kind:m??"followers",total:m==="followers"?(c==null?void 0:c.followersCount)??0:(c==null?void 0:c.followingCount)??0}),a.jsxs(it.div,{variants:r4,className:"rounded-xl border border-border bg-card p-5",children:[a.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-2",children:[a.jsx(Bx,{className:"h-4 w-4 text-primary"}),t("Badges & achievements")]}),u.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:t("No badges earned yet — stay active to unlock your first one.")}):a.jsx("div",{className:"flex gap-3 flex-wrap",children:u.map(U=>{var ne,te,re;return a.jsxs("div",{title:(ne=U.badge)==null?void 0:ne.description,className:"flex items-center gap-2 rounded-full border border-border bg-muted/30 px-4 py-2 text-sm hover:bg-muted/60 transition-colors cursor-default",children:[a.jsx("span",{className:"text-base leading-none",children:((te=U.badge)==null?void 0:te.icon)||"🏅"}),a.jsx("span",{className:"text-foreground font-medium",children:((re=U.badge)==null?void 0:re.name)||t("Badge")})]},U.id)})})]}),a.jsx(it.div,{variants:r4,children:a.jsx(U0,{value:g,onValueChange:U=>v(U),children:a.jsx(nb,{className:"w-full justify-start bg-transparent border-b border-border rounded-none h-auto p-0 gap-0",children:["about","posts","activity","achievements","settings"].map(U=>a.jsx(Xo,{value:U,className:ee("flex-1 rounded-none border-b-2 border-transparent px-1 py-3 text-xs capitalize sm:flex-none sm:px-4 sm:text-sm data-[state=active]:border-primary data-[state=active]:bg-transparent data-[state=active]:shadow-none"),children:t(dvs[U])},U))})})}),a.jsxs(it.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{duration:.25},children:[g==="about"&&a.jsxs("div",{className:"space-y-6",children:[a.jsx(gvs,{profile:o}),a.jsx(yOt,{self:!0}),a.jsx(wvs,{statistics:(V=d==null?void 0:d.breakdown)==null?void 0:V.statistics,grandTotal:D,pointsLabel:p})]}),g==="posts"&&a.jsx(CF,{communityId:i,userId:o.id,emptyLabel:t("You haven't posted yet.")}),g==="activity"&&a.jsx(gOt,{communityId:i,userId:o.id,isSelf:!0}),g==="achievements"&&a.jsx(vvs,{earned:u}),g==="settings"&&a.jsx(xvs,{})]},g),a.jsx(Al,{children:b&&a.jsx(yvs,{profile:o,onClose:()=>x(!1),onSaved:async U=>{r(U.user),await n.invalidateQueries({queryKey:["my-profile"]})}})}),a.jsx(Nh,{file:S,aspect:16/4,title:t("Adjust cover photo"),onCancel:()=>C(null),onCropped:z})]})}function pvs(){return a.jsxs("div",{className:"max-w-4xl mx-auto space-y-6",children:[a.jsx(sr,{className:"h-44 w-full rounded-2xl"}),a.jsxs("div",{className:"pt-10 px-1 space-y-3",children:[a.jsx(sr,{className:"h-8 w-56"}),a.jsx(sr,{className:"h-4 w-40"}),a.jsx(sr,{className:"h-4 w-80"})]}),a.jsx("div",{className:"grid grid-cols-4 gap-3",children:[0,1,2,3].map(t=>a.jsx(sr,{className:"h-24 rounded-xl"},t))}),a.jsx(sr,{className:"h-28 rounded-xl"})]})}function gvs({profile:t}){const e=Tn(),n=t.tags??[],r=(t.additionalMetaDetails??[]).filter(i=>i.label&&i.value);return!!t.bio||n.length>0||r.length>0?a.jsxs("div",{className:"space-y-5",children:[t.bio&&a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-2",children:[a.jsx(oee,{className:"h-4 w-4 text-primary"}),e("Bio")]}),a.jsx("p",{className:"text-sm text-foreground/80 leading-relaxed whitespace-pre-line",children:t.bio})]}),n.length>0&&a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-3 flex items-center gap-2",children:[a.jsx(Qd,{className:"h-4 w-4 text-primary"}),e("Interests")]}),a.jsx("div",{className:"flex flex-wrap gap-2",children:n.map(i=>a.jsx(ga,{variant:"secondary",className:"rounded-full px-3 py-1",children:i},i))})]}),r.length>0&&a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground mb-3",children:e("Details")}),a.jsx("dl",{className:"space-y-2",children:r.map(i=>a.jsxs("div",{className:"flex gap-3 text-sm",children:[a.jsx("dt",{className:"w-32 shrink-0 text-muted-foreground",children:i.label}),a.jsx("dd",{className:"text-foreground",children:i.value})]},`${i.label}-${i.value}`))})]})]}):a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5 text-sm text-muted-foreground",children:[e("Add a bio and interests from")," ",a.jsx("span",{className:"font-medium text-foreground",children:e("Edit profile")})," ",e("to fill out your About section.")]})}function vvs({earned:t}){const e=Tn(),{badges:n,isLoading:r}=WRe(),s=new Set(t.map(o=>{var l;return(l=o.badge)==null?void 0:l.id}).filter(Boolean)),i=new Map(t.map(o=>{var l;return[(l=o.badge)==null?void 0:l.id,o.earnedAt]}));return r?a.jsx("div",{className:"grid grid-cols-2 gap-3",children:[0,1,2,3].map(o=>a.jsx(sr,{className:"h-20 rounded-xl"},o))}):n.length===0?a.jsx("div",{className:"rounded-xl border border-border bg-card p-5 text-sm text-muted-foreground",children:e("No achievement badges are configured for this community yet.")}):a.jsx("div",{className:"grid grid-cols-2 gap-3",children:n.map(o=>{const l=s.has(o.id),c=i.get(o.id);return a.jsx("div",{className:ee("rounded-xl border bg-card p-4 transition-shadow hover:shadow-sm",l?"border-primary/30":"border-border opacity-80"),children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:ee("h-10 w-10 rounded-full flex items-center justify-center shrink-0 text-lg",l?"bg-primary/10":"bg-muted"),children:l?o.icon||"🏅":a.jsx(wa,{className:"h-4 w-4 text-muted-foreground"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:o.name}),l&&a.jsx(Qn,{className:"h-4 w-4 text-primary shrink-0"})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:o.description}),a.jsx("p",{className:"text-[10px] text-muted-foreground mt-1",children:l&&c?pn(e("Earned {date}"),{date:new Date(c).toLocaleDateString()}):wOt(o.criteriaType,o.threshold)})]})]})},o.id)})})}const Mhe=[{key:"webLink",label:"Website",placeholder:"https://example.com"},{key:"linkedinLink",label:"LinkedIn",placeholder:"https://linkedin.com/in/…"},{key:"twitterLink",label:"Twitter / X",placeholder:"https://x.com/…"},{key:"instagramLink",label:"Instagram",placeholder:"https://instagram.com/…"},{key:"facebookLink",label:"Facebook",placeholder:"https://facebook.com/…"},{key:"youtubeLink",label:"YouTube",placeholder:"https://youtube.com/@…"},{key:"dribbbleLink",label:"Dribbble",placeholder:"https://dribbble.com/…"},{key:"behanceLink",label:"Behance",placeholder:"https://behance.net/…"},{key:"pintrestLink",label:"Pinterest",placeholder:"https://pinterest.com/…"}];function yvs({profile:t,onClose:e,onSaved:n}){const r=Tn(),{toast:s}=yt(),{community:i}=qe(),o=kNt(i==null?void 0:i.id),[l,c]=y.useState(!1),[d,u]=y.useState(()=>({name:t.name??"",userId:t.userId??"",title:t.title??"",shortBio:t.shortBio??"",bio:t.bio??"",location:t.location??"",...Object.fromEntries(Mhe.map(k=>[k.key,t[k.key]??""]))})),h=(k,S)=>u(C=>({...C,[k]:S})),[m,f]=y.useState(!1),p=async()=>{f(!0);try{const k=await rut(r);h("location",k),s({title:r("Location filled in"),description:r("Check it, then save your profile.")})}catch(k){s({title:r("Couldn't use your location"),description:k instanceof PD?k.message:r("Please type your location."),variant:"destructive"})}finally{f(!1)}},[g,v]=y.useState("idle"),b=d.userId.trim();y.useEffect(()=>{if(!b||b===t.userId){v("idle");return}if(!/^[A-Za-z0-9_][A-Za-z0-9_.]{1,62}[A-Za-z0-9_]$/.test(b)){v("invalid");return}v("checking");let k=!1;const S=setTimeout(async()=>{try{const C=await dCe(b);k||v(C?"available":"taken")}catch{k||v("idle")}},400);return()=>{k=!0,clearTimeout(S)}},[b,t.userId]);const x=l||m||o.saving||!d.name.trim()||g==="checking"||g==="taken"||g==="invalid",w=async()=>{if(c(!0),o.fields.length&&o.dirty){const S=await o.save();if(!S.ok){s({title:r("Couldn't save your profile"),description:S.fieldId?r("Check the highlighted detail, then save again."):S.message,variant:"destructive"}),c(!1);return}}const k={name:d.name.trim(),title:d.title.trim(),shortBio:d.shortBio,bio:d.bio,location:d.location.trim()};b&&b!==t.userId&&(k.userId=b);for(const S of Mhe)k[S.key]=d[S.key].trim();try{const S=await nd.updatePensilProfile(k);await n(S),s({title:r("Profile updated"),description:r("Your changes have been saved.")}),e()}catch(S){s({title:r("Couldn't save profile"),description:dn(S,r("Please try again.")),variant:"destructive"})}finally{c(!1)}};return a.jsx(it.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"fixed inset-0 z-50 flex items-center justify-center bg-black/40 backdrop-blur-sm p-4",onClick:e,children:a.jsxs(it.div,{initial:{scale:.95,opacity:0},animate:{scale:1,opacity:1},exit:{scale:.95,opacity:0},transition:{duration:.2},className:"bg-card rounded-2xl shadow-xl w-full max-w-lg p-6 space-y-4 max-h-[85vh] overflow-y-auto",onClick:k=>k.stopPropagation(),children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:r("Edit profile")}),a.jsx("button",{onClick:e,className:"text-muted-foreground hover:text-foreground",children:a.jsx(nn,{className:"h-5 w-5"})})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:r("Name")}),a.jsx(Oe,{value:d.name,onChange:k=>h("name",k.target.value)})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:r("Username")}),a.jsxs("div",{className:"relative",children:[a.jsx(Oe,{value:d.userId,onChange:k=>h("userId",k.target.value),className:"pl-6"}),a.jsx("span",{className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-muted-foreground text-sm",children:"@"})]}),g==="checking"&&a.jsx("p",{className:"text-[11px] text-muted-foreground mt-1",children:r("Checking availability…")}),g==="available"&&a.jsx("p",{className:"text-[11px] text-emerald-600 mt-1",children:r("Username is available")}),g==="taken"&&a.jsx("p",{className:"text-[11px] text-destructive mt-1",children:r("Username is taken")}),g==="invalid"&&a.jsx("p",{className:"text-[11px] text-destructive mt-1",children:r("3–64 chars: letters, numbers, _ or .")})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"profile-job-title",className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[r("Job title"),a.jsx(gn,{label:r("Job title"),children:r("Your role, such as Head of Sports Science or Team Physiotherapist. It shows under your name in the member directory and on your profile, so members know who to contact.")})]}),a.jsx(Oe,{id:"profile-job-title",value:d.title,onChange:k=>h("title",k.target.value),maxLength:80,placeholder:r("e.g. Head of Sports Science")})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:r("Headline")}),a.jsx(Oe,{value:d.shortBio,onChange:k=>h("shortBio",k.target.value),maxLength:60})]}),a.jsxs("div",{children:[a.jsx("label",{className:"text-xs font-medium text-muted-foreground",children:r("Bio")}),a.jsx(us,{value:d.bio,onChange:k=>h("bio",k.target.value),rows:3})]}),a.jsxs("div",{children:[a.jsxs("label",{htmlFor:"profile-location",className:"flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:[r("Location"),a.jsx(gn,{label:r("Location"),children:r("Type where you are based, or use your current location: your browser asks first, and only the town and country are filled in. Your exact position is never saved. Check it, then save your profile.")})]}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[a.jsx(Oe,{id:"profile-location",value:d.location,onChange:k=>h("location",k.target.value),maxLength:100,placeholder:r("e.g. Stockholm, Sweden"),className:"min-w-0 flex-1"}),Ije()&&a.jsxs(Z,{type:"button",variant:"outline",size:"sm",onClick:p,disabled:m,className:"h-10 shrink-0 gap-1.5",children:[m?a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(Ort,{className:"h-3.5 w-3.5"}),r(m?"Finding you…":"Use my location")]})]})]}),o.fields.length>0&&a.jsxs("div",{className:"space-y-3 border-t border-border pt-3",children:[a.jsxs("p",{className:"flex items-center gap-1.5 text-xs font-semibold text-foreground",children:[i!=null&&i.name?pn(r("Your details in {community}"),{community:i.name}):r("Your community details"),a.jsx(gn,{label:r("Community details"),children:r("Questions this community's admins ask every member. Your answers show in its member directory, except ones marked “Only admins see this”.")})]}),a.jsx(iF,{idPrefix:"edit-profile-field",fields:o.fields,values:o.values,errors:o.errors,lockedIds:o.locked,disabled:l,onChange:o.setValue})]}),a.jsxs("div",{className:"pt-1",children:[a.jsx("p",{className:"text-xs font-semibold text-foreground mb-2",children:r("Social links")}),a.jsx("div",{className:"grid grid-cols-1 gap-2",children:Mhe.map(k=>a.jsxs("div",{children:[a.jsx("label",{className:"text-[11px] font-medium text-muted-foreground",children:r(k.label)}),a.jsx(Oe,{value:d[k.key],onChange:S=>h(k.key,S.target.value),placeholder:k.placeholder})]},k.key))})]})]}),a.jsxs("div",{className:"flex justify-end gap-2 pt-2",children:[a.jsx(Z,{variant:"outline",onClick:e,disabled:l,children:r("Cancel")}),a.jsxs(Z,{onClick:w,disabled:x,className:"gap-1.5",children:[a.jsx(Qn,{className:"h-4 w-4"}),r(l?"Saving…":"Save changes")]})]})]})})}const bvs=[{key:"postComment",label:"Comments on my posts",desc:"When someone comments on your post"},{key:"commentReply",label:"Replies to my comments",desc:"When someone replies to your comment"},{key:"postLike",label:"Likes on my posts",desc:"When someone likes your post"},{key:"commentReaction",label:"Reactions to my comments",desc:"When someone reacts to your comment"},{key:"replyReaction",label:"Reactions to my replies",desc:"When someone reacts to your reply"},{key:"directMessage",label:"Direct messages",desc:"When you receive a direct message"},{key:"mention",label:"Mentions",desc:"When someone @mentions you"}];function xvs(){const t=Tn(),{toast:e}=yt(),n=rn(),{community:r}=qe(),s=(r==null?void 0:r.id)??null,{notificationPreferences:i,notificationPreferencesLoading:o}=Ln(),[l,c]=y.useState(null),[d,u]=y.useState(null);y.useEffect(()=>{i&&c({postComment:i.postComment,commentReply:i.commentReply,postLike:i.postLike,commentReaction:i.commentReaction,replyReaction:i.replyReaction,directMessage:i.directMessage,mention:i.mention})},[i]);const h=async(m,f)=>{if(!s||!l)return;const p=l,g={...l,[m]:f};c(g),u(m);try{const v=await tse(s,g);n.setQueryData(["notification-preferences",s],v)}catch{c(p),e({title:t("Couldn't update preference"),variant:"destructive"})}finally{u(null)}};return o||!l?a.jsx(sr,{className:"h-72 rounded-xl"}):a.jsxs("div",{className:"space-y-4",children:[a.jsx(Kgs,{}),a.jsx(Ygs,{}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsxs("h3",{className:"text-sm font-semibold text-foreground flex items-center gap-2",children:[a.jsx(Lm,{className:"h-4 w-4 text-primary"}),t("Email notifications")]}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1 mb-4",children:t("Choose which activity on your content sends you an email.")}),a.jsx("div",{className:"space-y-4",children:bvs.map(m=>a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:t(m.label)}),a.jsx("p",{className:"text-xs text-muted-foreground",children:t(m.desc)})]}),a.jsx(Hs,{checked:l[m.key],disabled:d===m.key,onCheckedChange:f=>h(m.key,f)})]},m.key))})]})]})}function wvs({statistics:t,grandTotal:e,pointsLabel:n}){const r=Tn(),s=[{label:r("Posts created"),value:(t==null?void 0:t.postCreate)??0},{label:r("Comments made"),value:(t==null?void 0:t.postComment)??0},{label:r("Replies made"),value:(t==null?void 0:t.commentReply)??0},{label:r("Likes given"),value:(t==null?void 0:t.postLike)??0},{label:r("Likes on your posts"),value:(t==null?void 0:t.postLiked)??0},{label:r("Your posts commented"),value:(t==null?void 0:t.postCommented)??0},{label:r("Your replies received"),value:(t==null?void 0:t.commentReplied)??0},{label:r("Followers gained"),value:(t==null?void 0:t.follow)??0},{label:r("Live sessions"),value:((t==null?void 0:t.goingLive)??0)+((t==null?void 0:t.goingLiveInGroup)??0)},{label:r("Admin-assigned"),value:(t==null?void 0:t.adminAssigned)??0}],i=e-s.reduce((l,c)=>l+c.value,0),o=[...s,{label:r("Other"),value:i}].filter(l=>l.value>0);return a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:pn(r("How you earned your {points}"),{points:n})}),a.jsx("span",{className:"text-sm font-bold text-foreground",children:e})]}),o.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:r("No points yet — post, comment and react to start earning.")}):a.jsx("ul",{className:"divide-y divide-border/60",children:o.map(l=>a.jsxs("li",{className:"flex items-center justify-between py-2 text-sm",children:[a.jsx("span",{className:"text-muted-foreground",children:l.label}),a.jsx("span",{className:"font-medium text-foreground",children:l.value})]},l.label))})]})}const kOt=new Intl.NumberFormat("en",{notation:"compact",maximumFractionDigits:1}),$H=3;function kvs({member:t,index:e,isOnline:n,memberFields:r,pointsLabel:s,dmDisabled:i=!1,onOpen:o,onToggleFollow:l,onMessage:c}){var p,g,v,b,x;const d=m5t(r,t.customFields),u=((p=t.interests)==null?void 0:p.filter(w=>w==null?void 0:w.trim()))??[],h=(g=t.shortBio)==null?void 0:g.trim(),m=!!t.isFollowedByMe,f=t.userId?`${t.role} · @${t.userId}`:t.role;return a.jsxs("div",{role:"button",tabIndex:0,onClick:o,onKeyDown:w=>{w.target===w.currentTarget&&(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),o())},className:"flex h-full cursor-pointer flex-col items-center rounded-xl border border-border bg-card p-5 text-center transition-all duration-300 hover:border-primary/20 hover:shadow-md",children:[a.jsxs("div",{className:"relative mb-3",children:[a.jsxs(oo,{className:"h-16 w-16 ring-2 ring-border",children:[a.jsx(lo,{src:t.avatar,alt:t.name}),a.jsx(co,{className:ee("text-lg font-semibold text-primary-foreground",sE[e%sE.length]),children:u5(t.name)})]}),n&&a.jsx("span",{className:"absolute bottom-0 right-0 h-3.5 w-3.5 rounded-full border-2 border-card bg-success",role:"img","aria-label":"Online now"})]}),a.jsx("h3",{className:"max-w-full truncate text-sm font-semibold text-foreground",title:t.name,children:t.name}),d&&a.jsxs("p",{className:"mt-0.5 flex max-w-full items-center justify-center gap-1.5 text-sm font-semibold text-primary",title:`${d.field.label}: ${d.text}`,children:[a.jsx(v9,{field:d.field,value:(v=t.customFields)==null?void 0:v[d.field.id]}),a.jsx("span",{className:"min-w-0 truncate",children:d.text})]}),((b=t.title)==null?void 0:b.trim())&&a.jsx("p",{className:"mt-0.5 line-clamp-2 max-w-full text-sm text-foreground/80 [overflow-wrap:anywhere]",title:t.title,children:t.title}),f&&a.jsx("p",{className:"mt-0.5 max-w-full truncate text-xs text-muted-foreground",title:f,children:f}),a.jsxs("div",{className:"mt-3 flex w-full flex-col items-center gap-2 border-t border-border/60 pt-3",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-x-4 gap-y-1 text-xs text-muted-foreground",children:[((x=t.location)==null?void 0:x.trim())&&a.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[a.jsx(Jf,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),a.jsx("span",{className:"[overflow-wrap:anywhere]",children:t.location})]}),t.country&&t.country!=="—"&&a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{"aria-hidden":!0,children:RRe(t.country)})," ",t.country]}),a.jsxs("span",{className:"flex items-center gap-1 text-primary",title:s,children:[a.jsx(Hg,{className:"h-3 w-3","aria-hidden":!0})," ",kOt.format(t.mpu||0)," ",s]})]}),h&&a.jsx("p",{className:"line-clamp-2 max-w-full text-xs leading-relaxed text-muted-foreground [overflow-wrap:anywhere]",children:h}),u.length>0&&a.jsxs("ul",{className:"flex max-w-full flex-wrap justify-center gap-1.5","aria-label":"Interests",children:[u.slice(0,$H).map((w,k)=>a.jsx("li",{className:"max-w-full truncate rounded-full border border-border bg-background px-2.5 py-0.5 text-[11px] font-medium text-foreground/80",children:w},`${w}-${k}`)),u.length>$H&&a.jsxs("li",{className:"rounded-full border border-border bg-background px-2.5 py-0.5 text-[11px] text-muted-foreground",title:u.slice($H).join(", "),children:["+",u.length-$H]})]})]}),a.jsxs("div",{className:"mt-auto flex items-center gap-4 pt-3 text-xs",children:[a.jsxs("div",{children:[a.jsx("span",{className:"font-semibold text-foreground",children:t.followers}),a.jsx("span",{className:"ml-1 text-muted-foreground",children:"Followers"})]}),a.jsx("div",{className:"h-3 w-px bg-border"}),a.jsxs("div",{children:[a.jsx("span",{className:"font-semibold text-foreground",children:t.following}),a.jsx("span",{className:"ml-1 text-muted-foreground",children:"Following"})]})]}),a.jsxs("div",{className:"mt-4 flex w-full items-center gap-2",children:[a.jsxs("button",{type:"button",onClick:w=>{w.stopPropagation(),l()},className:ee("flex flex-1 items-center justify-center gap-2 rounded-lg px-4 py-2 text-xs font-medium transition-colors",m?"bg-primary text-primary-foreground hover:bg-primary/90":"border border-border text-foreground hover:bg-muted"),children:[m?a.jsx(Qn,{className:"h-3.5 w-3.5"}):a.jsx(Sa,{className:"h-3.5 w-3.5"}),m?"Connected":"Connect"]}),!i&&a.jsxs("button",{type:"button",onClick:w=>{w.stopPropagation(),c()},className:"flex flex-1 items-center justify-center gap-2 rounded-lg border border-border px-4 py-2 text-xs font-medium text-foreground transition-colors hover:bg-muted",children:[a.jsx(wd,{className:"h-3.5 w-3.5"})," Message"]})]})]})}function xae(t,e){const n=new Set((t??[]).map(i=>i.toLowerCase())),r=new Set,s=[];for(const i of e??[]){const o=i.toLowerCase();n.has(o)&&!r.has(o)&&(r.add(o),s.push(i))}return s}function Svs(t){const e=t.shortBio??"",[n,r]=e.split("·").map(s=>s.trim());return{role:n||(t.role!=="Member"?t.role:void 0),club:r||void 0}}function Cvs(t,e){const n=(t.name||"there").split(" ")[0],r=xae(e,t.interests),{role:s,club:i}=Svs(t),o=[];return r.length&&o.push(`Hey ${n}! Looks like we're both into ${r[0]} — what are you working on right now?`),i&&o.push(`Hi ${n}, I'd love to hear how things work at ${i}. Open to a quick chat?`),s&&o.push(`Hey ${n}, always keen to swap notes with a ${s.toLowerCase()} — fancy connecting?`),o.push(`Hi ${n}! 👋 Came across your profile in the community and thought I'd say hello.`),[...new Set(o)].slice(0,3)}function jvs({member:t,me:e,myInterests:n,icebreakers:r,sending:s,onSendIcebreaker:i,onOpenChat:o,onClose:l}){const c=!!t,d=t?xae(n,t.interests):[];return a.jsx(Bt,{open:c,onOpenChange:u=>u?void 0:l(),children:a.jsxs(Ft,{className:"sm:max-w-md text-center",children:[a.jsxs(Vt,{className:"items-center",children:[a.jsxs(Ut,{className:"flex items-center justify-center gap-2 text-xl",children:[a.jsx(xo,{className:"h-5 w-5 text-primary"})," It's a match!"]}),a.jsx(_n,{children:t?a.jsxs(a.Fragment,{children:["You connected with ",a.jsx("span",{className:"font-medium text-foreground",children:t.name}),".",d.length>0&&a.jsxs(a.Fragment,{children:[" You both care about ",a.jsx("span",{className:"font-medium text-foreground",children:d[0]}),"."]})," ","Break the ice 👇"]}):null})]}),t&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-center gap-3 py-2",children:[a.jsxs(oo,{className:"h-16 w-16 ring-2 ring-border",children:[a.jsx(lo,{src:e.avatar,alt:e.name}),a.jsx(co,{children:u5(e.name)})]}),a.jsx(xo,{className:"h-5 w-5 text-primary"}),a.jsxs(oo,{className:"h-16 w-16 ring-2 ring-primary/40",children:[a.jsx(lo,{src:t.avatar,alt:t.name}),a.jsx(co,{children:u5(t.name)})]})]}),a.jsxs("div",{className:"space-y-2 text-left",children:[a.jsx("p",{className:"text-[11px] font-medium uppercase tracking-wider text-muted-foreground",children:"Send an icebreaker"}),r.map(u=>a.jsxs("button",{type:"button",disabled:s,onClick:()=>i(u),className:"group flex w-full items-center gap-2 rounded-lg border border-border bg-card px-3 py-2.5 text-left text-sm text-foreground hover:border-primary/40 hover:bg-muted transition-colors disabled:opacity-60",children:[a.jsx(_s,{className:"h-3.5 w-3.5 shrink-0 text-muted-foreground group-hover:text-primary"}),a.jsx("span",{className:"line-clamp-2",children:u})]},u))]}),a.jsxs("div",{className:"flex items-center justify-center gap-2 pt-1",children:[a.jsxs("button",{type:"button",onClick:o,className:"inline-flex items-center gap-2 rounded-lg border border-border px-4 py-2 text-sm font-medium text-foreground hover:bg-muted transition-colors",children:[a.jsx(wd,{className:"h-4 w-4"})," Write my own"]}),a.jsx("button",{type:"button",onClick:l,className:"inline-flex items-center gap-2 rounded-lg px-4 py-2 text-sm font-medium text-muted-foreground hover:text-foreground transition-colors",children:"Maybe later"})]}),s&&a.jsxs("p",{className:"flex items-center justify-center gap-2 text-xs text-muted-foreground",children:[a.jsx(Ne,{className:"h-3 w-3 animate-spin"})," Sending…"]})]})]})})}const Evs=["Sport & Exercise Science","Nutrition","Sport Psychology","Sports Medicine & Physiotherapy","Strength & Power","Fitness & Exercise Physiology","Recovery and Regeneration","Networking","Leadership","Management","Career Development","Coaching","Education","Communication"],eke=2;function vXe({initial:t,onSave:e,saving:n,min:r=eke,max:s=5,title:i="Set your interests to start matching",description:o=`Pick at least ${r} interests — we use them to match you with the right people.`,ctaLabel:l="Save interests",bordered:c=!0}){const[d,u]=y.useState(t),h=y.useMemo(()=>{const p=new Set;return[...Evs,...t].filter(g=>!g||p.has(g)?!1:(p.add(g),!0))},[t]),m=p=>{u(g=>g.includes(p)?g.filter(v=>v!==p):g.length<s?[...g,p]:g)},f=d.length>=r;return a.jsxs("div",{className:ee("mx-auto max-w-xl text-center",c&&"rounded-2xl border border-border bg-card shadow-sm p-6"),children:[a.jsxs("div",{className:"mb-1 flex items-center justify-center gap-2",children:[a.jsx(xo,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"text-lg font-bold text-foreground",children:i})]}),a.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:o}),a.jsx("div",{className:"flex flex-wrap justify-center gap-2",children:h.map(p=>{const g=d.includes(p);return a.jsx("button",{type:"button",onClick:()=>m(p),"aria-pressed":g,className:ee("rounded-full border px-3.5 py-1.5 text-xs font-medium transition-colors",g?"border-primary bg-primary text-primary-foreground":"border-border bg-background text-foreground hover:bg-muted"),children:p},p)})}),a.jsxs("div",{className:"mt-4 flex flex-col items-center gap-2",children:[a.jsxs("p",{className:ee("text-xs",f?"text-muted-foreground":"text-amber-600"),children:[d.length," selected",!f&&` · pick at least ${r}`,d.length>=s&&" · max reached"]}),a.jsxs("button",{onClick:()=>e(d),disabled:!f||n,className:"inline-flex items-center justify-center gap-2 rounded-lg bg-primary px-5 py-2.5 text-sm font-semibold text-primary-foreground transition-colors hover:bg-primary/90 disabled:opacity-50",children:[n?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):null,l]})]})]})}const Nvs=7*24*60*60*1e3;function SOt(t){if(!t)return!1;const e=new Date(t).getTime();return Number.isFinite(e)&&Date.now()-e<=Nvs}function yXe(t,e){let n=4;return n+=Math.min(xae(e.myInterests,t.interests).length,3)*2,SOt(t.lastActiveAt)&&(n+=1),e.myRole&&t.role.toLowerCase()===e.myRole&&(n+=1),e.onlineSet.has(t.id)&&(n+=1),n}function bXe(t,e){if(t.length===0)return null;const n=t.reduce((s,i)=>s+yXe(i,e),0);let r=Math.random()*n;for(const s of t)if(r-=yXe(s,e),r<=0)return s;return t[t.length-1]}const xXe=60,Tvs=5;function OH(t){return typeof t=="string"?t.trim().toLowerCase():""}function _vs(){const{community:t}=qe(),e=(t==null?void 0:t.id)??null,{user:n}=jr(),r=(n==null?void 0:n.id)??null,s=y.useMemo(()=>(n==null?void 0:n.tags)??[],[n]),{communityDetail:i}=Ln(),o=!!(i!=null&&i.isDirectMessageDisabled),{toast:l}=yt(),c=Nn(),[d,u]=y.useState([]),[h,m]=y.useState(new Set),[f,p]=y.useState(!1),[g,v]=y.useState(null),[b,x]=y.useState(""),[w,k]=y.useState(null),[S,C]=y.useState(null),[j,E]=y.useState(!1),N=y.useRef([]),A=y.useCallback(async()=>{if(!e){u([]),m(new Set);return}p(!0),v(null);try{const[H,W]=await Promise.all([Dy(e,{page:1,limit:xXe}),PNt(e,xXe).catch(()=>({count:0,members:[]}))]),V=R5t(H.users).filter(te=>te.id&&te.id!==r),U=new Set(W.members.map(te=>te.id));u(V),m(U);const ne={myInterests:s,onlineSet:U,myRole:OH(n==null?void 0:n.role)};k(te=>{var re;return te&&V.some(fe=>fe.id===te)?te:((re=bXe(V,ne))==null?void 0:re.id)??null})}catch(H){v(H instanceof ze?H.message:"Failed to load members."),u([])}finally{p(!1)}},[e,r,n,s]);y.useEffect(()=>{A()},[A]);const _=y.useMemo(()=>({myInterests:s,onlineSet:h,myRole:OH(n==null?void 0:n.role)}),[s,h,n]),T=y.useCallback(()=>{if(d.length===0)return;const H=N.current;let W=d.filter(U=>U.id!==w&&!H.includes(U.id));W.length===0&&(W=d.filter(U=>U.id!==w)),W.length===0&&(W=d);const V=bXe(W,_);V&&(k(V.id),N.current=[V.id,...H].slice(0,Tvs))},[d,w,_]),R=y.useCallback(async H=>{if(!e||!H.id)return;const W=!!H.isFollowedByMe;u(V=>V.map(U=>U.id===H.id?{...U,isFollowedByMe:!W,followers:Math.max(0,U.followers+(W?-1:1))}:U));try{W?(await ese(e,H.id),l({title:"Disconnected",description:`You unfollowed ${H.name}.`})):(await Xre(e,H.id),C({...H,isFollowedByMe:!0})),_se(H.id,!W)}catch(V){u(U=>U.map(ne=>ne.id===H.id?{...ne,isFollowedByMe:W,followers:H.followers}:ne)),l({title:"Error",description:V instanceof ze?V.message:"Could not update follow status.",variant:"destructive"})}},[e,l]),O=y.useCallback(H=>{if(o){l({title:"Messages disabled",description:"Direct messages are turned off for this community.",variant:"destructive"});return}c0(c,{id:H.id,name:H.name,avatar:H.avatar,userId:H.userId,communityId:e??void 0})},[o,c,l,e]),F=y.useCallback(H=>c(ve.member(H.id)),[c]),D=y.useMemo(()=>d.find(H=>H.id===w)??null,[d,w]),I=y.useMemo(()=>{var U;if(!D)return[];const H=OH(n==null?void 0:n.role),W=[];for(const ne of xae(s,D.interests).slice(0,2))W.push({label:`Shared interest: ${ne}`,matched:!0,kind:"interest"});return!!H&&OH(D.role)===H&&W.push({label:`Same role: ${D.role}`,matched:!0,kind:"role"}),h.has(D.id)?W.push({label:"Online now",matched:!0,kind:"online"}):SOt(D.lastActiveAt)&&W.push({label:"Active recently",matched:!0,kind:"active"}),W.length===0&&((U=D.interests)!=null&&U.length)&&W.push({label:D.interests[0],matched:!1,kind:"tag"}),W},[D,n,s,h]),P=y.useCallback(H=>Cvs(H,s),[s]),M=y.useCallback(async(H,W)=>{E(!0);try{if(!e)throw new Error("Community is unavailable");await cAe(H.id,W,e),C(null),c0(c,{id:H.id,name:H.name,avatar:H.avatar,userId:H.userId,communityId:e??void 0})}catch(V){l({title:"Couldn't send",description:V instanceof ze?V.message:"Message failed to send.",variant:"destructive"})}finally{E(!1)}},[e,c,l]),z=y.useMemo(()=>({name:(n==null?void 0:n.name)??"You",avatar:(n==null?void 0:n.picture)??""}),[n]),G=y.useMemo(()=>{const H=b.trim().toLowerCase();return[...H?d.filter(V=>V.name.toLowerCase().includes(H)||V.role.toLowerCase().includes(H)||(V.shortBio??"").toLowerCase().includes(H)):d].sort((V,U)=>Number(h.has(U.id))-Number(h.has(V.id)))},[d,b,h]),B=y.useMemo(()=>d.reduce((H,W)=>H+(h.has(W.id)?1:0),0),[d,h]);return{isLoading:f,error:g,members:d,filteredMembers:G,onlineIds:h,onlineCount:B,currentMatch:D,matchReasons:I,searchQuery:b,setSearchQuery:x,dmDisabled:o,shuffle:T,toggleFollow:R,messageMember:O,viewProfile:F,me:z,myInterests:s,celebrateWith:S,closeCelebration:()=>C(null),icebreakersFor:P,sendIcebreaker:M,sendingIcebreaker:j,reload:A}}const Avs={interest:xo,role:oee,online:Ag,active:ja,tag:ka},FH=4;function Pvs(){var z,G,B;const{community:t}=qe(),e=tv(),n=xNt(t==null?void 0:t.id).data??[],{updateProfile:r}=jr(),{toast:s}=yt(),[i,o]=y.useState(!1),[l,c]=y.useState(!1),{isLoading:d,error:u,members:h,filteredMembers:m,onlineIds:f,onlineCount:p,currentMatch:g,matchReasons:v,searchQuery:b,setSearchQuery:x,dmDisabled:w,shuffle:k,toggleFollow:S,messageMember:C,viewProfile:j,reload:E,me:N,myInterests:A,celebrateWith:_,closeCelebration:T,icebreakersFor:R,sendIcebreaker:O,sendingIcebreaker:F}=_vs(),D=A.length>=eke,I=((z=g==null?void 0:g.interests)==null?void 0:z.filter(H=>H==null?void 0:H.trim()))??[],P=g?m5t(n,g.customFields):null,M=async H=>{o(!0);try{await cCe({tags:H}),r({tags:H}),c(!1),s({title:"Interests saved",description:"We'll use these to match you."}),E()}catch(W){s({title:"Couldn't save interests",description:W instanceof ze?W.message:"Please try again.",variant:"destructive"})}finally{o(!1)}};return d&&h.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-24 text-muted-foreground",children:[a.jsx(Ne,{className:"h-6 w-6 animate-spin mb-3"}),a.jsx("p",{className:"text-sm",children:"Finding members to match…"})]}):u&&h.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-24 text-center",children:[a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:u}),a.jsxs("button",{onClick:E,className:"inline-flex items-center gap-2 rounded-lg border border-border px-4 py-2 text-sm font-medium text-foreground hover:bg-muted transition-colors",children:[a.jsx(Nl,{className:"h-4 w-4"})," Try again"]})]}):h.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-24 text-center text-muted-foreground",children:[a.jsx(wr,{className:"h-8 w-8 mb-3 text-primary"}),a.jsx("p",{className:"text-sm",children:"No other members to match with yet."}),a.jsx("p",{className:"text-xs mt-1",children:"Invite people to your community to start networking."})]}):a.jsxs(it.div,{variants:fg.container,initial:"hidden",animate:"show",className:"space-y-8",children:[!D&&a.jsx(it.div,{variants:fg.item,children:a.jsx(vXe,{initial:A,onSave:M,saving:i})}),D&&g&&a.jsxs(it.div,{variants:fg.item,className:"rounded-2xl border border-border bg-card shadow-sm px-4 py-6 sm:px-8 sm:py-8 text-center max-w-2xl mx-auto",children:[a.jsxs(it.div,{initial:{opacity:0,scale:.96},animate:{opacity:1,scale:1},transition:{duration:.25},className:"flex flex-col items-center",children:[a.jsxs("button",{onClick:()=>j(g),className:"relative mb-4 rounded-full",children:[a.jsxs(oo,{className:"h-24 w-24 sm:h-28 sm:w-28 ring-4 ring-muted",children:[a.jsx(lo,{src:g.avatar,alt:g.name}),a.jsx(co,{className:ee("text-xl font-semibold text-primary-foreground",sE[0]),children:u5(g.name)})]}),f.has(g.id)&&a.jsx("span",{className:"absolute bottom-1 right-1 h-4 w-4 rounded-full border-2 border-card bg-success",role:"img","aria-label":"Online now"})]}),a.jsx("button",{onClick:()=>j(g),className:"max-w-full text-xl sm:text-2xl font-bold text-foreground hover:underline [overflow-wrap:anywhere]",children:g.name}),P&&a.jsxs("p",{className:"mt-1 flex max-w-full items-center justify-center gap-2 text-sm sm:text-base font-semibold text-primary",title:`${P.field.label}: ${P.text}`,children:[a.jsx(v9,{field:P.field,value:(G=g.customFields)==null?void 0:G[P.field.id],size:"sm"}),a.jsx("span",{className:"min-w-0 [overflow-wrap:anywhere]",children:P.text})]}),g.title&&a.jsx("p",{className:"mt-1 max-w-full text-sm sm:text-base text-foreground [overflow-wrap:anywhere]",children:g.title}),g.role&&g.role!=="Member"&&a.jsx("p",{className:"mt-0.5 text-xs font-medium text-muted-foreground",children:g.role}),a.jsxs("div",{className:"flex flex-wrap items-center justify-center gap-x-5 gap-y-1 mt-3 text-sm text-muted-foreground",children:[g.location&&a.jsxs("span",{className:"flex min-w-0 items-center gap-1",children:[a.jsx(Jf,{className:"h-3 w-3 shrink-0","aria-hidden":!0}),a.jsx("span",{className:"[overflow-wrap:anywhere]",children:g.location})]}),g.country!=="—"&&a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx("span",{children:RRe(g.country)})," ",g.country]}),a.jsxs("span",{className:"flex items-center gap-1.5 text-primary",title:e,children:[a.jsx(Hg,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",kOt.format(g.mpu||0)," ",e]}),a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx(wr,{className:"h-3.5 w-3.5","aria-hidden":!0})," ",g.followers," ",g.followers===1?"follower":"followers"]})]}),((B=g.shortBio)==null?void 0:B.trim())&&a.jsx("p",{className:"mt-4 max-w-lg text-sm sm:text-base text-muted-foreground leading-relaxed line-clamp-3",children:g.shortBio}),I.length>0&&a.jsxs("ul",{className:"mt-4 flex max-w-lg flex-wrap justify-center gap-2","aria-label":"Interests",children:[I.slice(0,FH).map(H=>a.jsx("li",{className:"rounded-full border border-border bg-card px-3.5 py-1.5 text-sm font-medium text-foreground",children:H},H)),I.length>FH&&a.jsxs("li",{className:"rounded-full border border-border bg-card px-3.5 py-1.5 text-sm text-muted-foreground",title:I.slice(FH).join(", "),children:["+",I.length-FH]})]}),v.length>0&&a.jsxs("div",{className:"mt-5 w-full max-w-lg mx-auto",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground mb-2",children:"Why you're matched"}),a.jsx("div",{className:"flex flex-wrap justify-center gap-2",children:v.map(H=>{const W=Avs[H.kind];return a.jsxs("span",{className:"inline-flex max-w-full items-center gap-1.5 rounded-full border border-border bg-muted px-3 py-1 text-sm font-medium text-muted-foreground",children:[a.jsx(W,{className:ee("h-3.5 w-3.5 shrink-0",H.kind==="online"&&"fill-success text-success"),"aria-hidden":!0}),a.jsx("span",{className:"min-w-0 [overflow-wrap:anywhere]",children:H.label})]},H.label)})})]})]},g.id),a.jsxs("div",{className:"flex flex-col sm:flex-row items-stretch sm:items-center justify-center gap-2 sm:gap-4 mt-6",children:[a.jsxs("button",{onClick:k,className:"inline-flex items-center justify-center gap-2 rounded-lg bg-primary px-6 py-3 text-sm sm:text-base font-semibold text-primary-foreground hover:bg-primary/90 transition-colors shadow-sm",children:[a.jsx(u9t,{className:"h-4 w-4"})," Shuffle & Match"]}),a.jsxs("button",{onClick:()=>S(g),className:ee("inline-flex items-center justify-center gap-2 rounded-lg border px-6 py-3 text-sm sm:text-base font-semibold transition-colors",g.isFollowedByMe?"border-primary bg-primary/10 text-primary":"border-border bg-card text-foreground hover:bg-muted"),children:[g.isFollowedByMe?a.jsx(Qn,{className:"h-4 w-4"}):a.jsx(Sa,{className:"h-4 w-4"}),g.isFollowedByMe?"Connected":"Connect"]}),!w&&a.jsxs("button",{onClick:()=>C(g),className:"inline-flex items-center justify-center gap-2 rounded-lg border border-border bg-card px-6 py-3 text-sm sm:text-base font-semibold text-foreground hover:bg-muted transition-colors",children:[a.jsx(_s,{className:"h-4 w-4"})," Message"]})]})]}),a.jsxs(it.div,{variants:fg.item,className:"flex flex-wrap items-center gap-3",children:[a.jsxs("div",{className:"relative w-full max-w-md flex-1",children:[a.jsx(hs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx("input",{type:"text",placeholder:"Search members by name or role…",value:b,onChange:H=>x(H.target.value),className:"w-full rounded-lg border border-border bg-card pl-10 pr-4 py-2.5 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"})]}),D&&a.jsxs("button",{onClick:()=>c(!0),className:"inline-flex shrink-0 items-center gap-1.5 rounded-lg border border-border bg-card px-3 py-2.5 text-sm font-medium text-foreground hover:bg-muted transition-colors",children:[a.jsx(xo,{className:"h-4 w-4 text-primary"})," Edit interests",a.jsxs("span",{className:"text-xs text-muted-foreground",children:["(",A.length,")"]})]})]}),a.jsxs(it.div,{variants:fg.item,children:[a.jsxs("div",{className:"flex items-center justify-between mb-4",children:[a.jsxs("h2",{className:"font-semibold text-foreground flex items-center gap-2",children:[a.jsx(wr,{className:"h-4 w-4 text-primary"})," Community members"]}),a.jsxs("span",{className:"text-sm text-muted-foreground",children:[m.length," ",m.length===1?"member":"members",p>0&&` · ${p} online`]})]}),m.length===0?a.jsxs("p",{className:"text-sm text-muted-foreground py-8 text-center",children:["No members match “",b,"”."]}):a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4",children:m.map((H,W)=>a.jsx(kvs,{member:H,index:W,isOnline:f.has(H.id),memberFields:n,pointsLabel:e,dmDisabled:w,onOpen:()=>j(H),onToggleFollow:()=>S(H),onMessage:()=>C(H)},H.id))})]}),a.jsx(Bt,{open:l,onOpenChange:c,children:a.jsxs(Ft,{className:"sm:max-w-lg",children:[a.jsx(Vt,{children:a.jsx(Ut,{children:"Your interests"})}),a.jsx(vXe,{initial:A,onSave:M,saving:i,bordered:!1,title:"Update your interests",description:`Pick at least ${eke} — we use them to match you with the right people.`,ctaLabel:"Save changes"})]})}),a.jsx(jvs,{member:_,me:N,myInterests:A,icebreakers:_?R(_):[],sending:F,onSendIcebreaker:H=>_&&O(_,H),onOpenChat:()=>{_&&C(_),T()},onClose:T})]})}const Rvs=()=>{const t=Di();return y.useEffect(()=>{console.error("404 Error: User attempted to access non-existent route:",t.pathname)},[t.pathname]),a.jsx("div",{className:"flex min-h-screen items-center justify-center bg-muted",children:a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"mb-4 text-4xl font-bold",children:"404"}),a.jsx("p",{className:"mb-4 text-xl text-muted-foreground",children:"Oops! Page not found"}),a.jsx("a",{href:"/",className:"text-primary underline hover:text-primary/90",children:"Return to Home"})]})})};function Ivs({post:t,communityId:e,groups:n,onOpenChange:r,onMoved:s}){const{toast:i}=yt(),o=t!==null,[l,c]=y.useState(""),[d,u]=y.useState(""),[h,m]=y.useState(!1),f=y.useMemo(()=>n.filter(b=>b.myRole==="admin"||b.myRole==="moderator"),[n]);y.useEffect(()=>{o&&(c((t==null?void 0:t.groupId)??""),u(""))},[o,t==null?void 0:t.groupId]);const p=f.find(b=>b.id===l)??null,g=(p==null?void 0:p.tabs)??[],v=()=>{!(t!=null&&t.realId)||!e||!l||(m(!0),p0e(e,t.realId,l,d||void 0).then(()=>{i({title:"Post moved",description:"The post has been moved to the selected location."}),r(!1),s==null||s()}).catch(()=>{i({title:"Couldn't move the post",variant:"destructive"})}).finally(()=>m(!1)))};return a.jsx(Bt,{open:o,onOpenChange:b=>!b&&r(!1),children:a.jsxs(Ft,{className:"sm:max-w-md",children:[a.jsx(Vt,{children:a.jsxs(Ut,{className:"flex items-center gap-2",children:[a.jsx(fO,{className:"h-5 w-5 text-primary"}),"Move post"]})}),a.jsxs("div",{className:"space-y-4",children:[f.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"You don't have a group you can move this post into."}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Destination group"}),a.jsxs("select",{value:l,onChange:b=>{c(b.target.value),u("")},className:"w-full rounded-lg border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring/30",children:[a.jsx("option",{value:"",children:"Select a group…"}),f.map(b=>a.jsx("option",{value:b.id,children:b.name},b.id))]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Section ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"(optional)"})]}),a.jsxs("select",{value:d,onChange:b=>u(b.target.value),disabled:!p||g.length===0,className:"w-full rounded-lg border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring/30 disabled:opacity-50",children:[a.jsx("option",{value:"",children:"Group root"}),g.map(b=>a.jsx("option",{value:b.id,children:b.name},b.id))]})]})]}),a.jsxs("div",{className:"flex items-center justify-end gap-2",children:[a.jsx(Z,{variant:"ghost",onClick:()=>r(!1),disabled:h,children:"Cancel"}),a.jsxs(Z,{onClick:v,disabled:h||!l,children:[h&&a.jsx(Ne,{className:"h-4 w-4 mr-1 animate-spin"}),"Move"]})]})]})]})})}const wXe=10;function Mvs({realId:t,currentUserName:e,currentUserAvatar:n,currentUserId:r}){const{toast:s}=yt(),i=rn(),o=XB(),l=()=>i.invalidateQueries({queryKey:["streak"]}),[c,d]=y.useState(null),[u,h]=y.useState(!0),[m,f]=y.useState(null),[p,g]=y.useState(""),[v,b]=y.useState({}),x=y.useRef(0),[w,k]=y.useState(f0e),[S,C]=y.useState(!1),[j,E]=y.useState(null),[N,A]=y.useState(!1),_=y.useRef(1),T=y.useCallback(async()=>{if(!t){f(404),h(!1);return}const X=++x.current;h(!0),f(null);try{const Q=await GZ(t,{limit:wXe,sort:w});if(X!==x.current)return;const ie=Am(Q.post,1);ie.commentsList=fq(Q.post.comments),ie.commentsLoaded=!0,d(ie),C(!!Q.commentsHasMore),E(Q.commentsNextPage??null),_.current=1}catch(Q){if(X!==x.current)return;const ie=Q instanceof ze?Q.status:void 0;f(ie===404?404:ie===403?403:"error"),d(null)}finally{X===x.current&&h(!1)}},[t,w]);y.useEffect(()=>{T()},[T]);const R=y.useCallback(()=>{if(!t)return;const X=Math.min(_.current*wXe,50);GZ(t,{limit:X,sort:w}).then(Q=>{if(x.current===0)return;const ie=Am(Q.post,1);ie.commentsList=fq(Q.post.comments),ie.commentsLoaded=!0,d(ie),C(!!Q.commentsHasMore),E(Q.commentsNextPage??null)}).catch(()=>{})},[t,w]),O=X=>d(Q=>Q&&X(Q)),F=(X,Q)=>O(ie=>({...ie,commentsList:ie.commentsList.map(he=>he.id===X?Q(he):he)})),D=X=>{if(!o()||!c)return;const Q={liked:c.liked,likes:c.likes,reactions:c.reactions},ie=!!(t2(c.reactions)??c.liked),he=X&&!ie?1:!X&&ie?-1:0;O(ye=>({...ye,liked:!!X,likes:Math.max(0,ye.likes+he),reactions:uP(ye.reactions,X)})),c.realId&&(X?YNt(c.realId,X):QNt(c.realId)).then(()=>{X&&l()}).catch(()=>{O(ye=>({...ye,...Q})),s({title:"Couldn't update your reaction",variant:"destructive"})})},I=y.useCallback(async()=>{if(!(!t||!j||N)){A(!0);try{const X=await hq(t,j,w);d(Q=>{if(!Q)return Q;const ie=Q.commentsList,he=new Set(ie.map(K=>K.realId).filter(Boolean)),ye=t_t(ie),J=fq(X.comments).filter(K=>!K.realId||!he.has(K.realId)).map((K,ce)=>({...K,id:ye+ce}));return{...Q,commentsList:[...ie,...J]}}),C(X.hasMore),E(X.nextPage),_.current+=1}catch{s({title:"Couldn't load more comments",variant:"destructive"})}finally{A(!1)}}},[t,j,N,w,s]),P=y.useCallback(X=>{k(Q=>Q===X?Q:X)},[]),M=()=>{if(!c)return;const X=!!(t2(c.reactions)??c.liked);D(X?null:Ese)},z=X=>{c&&D(t2(c.reactions)===X?null:X)},G=()=>{if(!o()||!c)return;const X=!c.saved;O(Q=>({...Q,saved:X})),s({title:X?"Post saved!":"Removed from saved"}),c.realId&&(X?ZNt(c.realId):JNt(c.realId)).catch(()=>{O(Q=>({...Q,saved:!X})),s({title:"Couldn't update saved posts",variant:"destructive"})})},B=()=>{kN(window.location.href).then(X=>{s(X?{title:"Link copied!",description:"Post link copied to clipboard."}:{title:"Couldn't copy link",variant:"destructive"})})},H=X=>{var J;if(!o()||!(c!=null&&c.poll))return;const Q=c.poll.votedOption;if(Q===X||!jj(c.poll))return;const ie=(J=c.poll.options[X])==null?void 0:J.text;if(O(K=>!K.poll||K.poll.votedOption!==Q?K:{...K,poll:Wre(K.poll,X)}),!c.realId||ie==null)return;const he=c.realId,ye=qre(he,X);KAe(he,ie).catch(K=>{ye(),O(ce=>!ce.poll||ce.poll.votedOption!==X?ce:{...ce,poll:gCt(ce.poll,X,Q)}),s({title:Q===null?"Couldn't record your vote":"Couldn't change your vote",description:Dt(K instanceof ze?K.body:null,"Please try again."),variant:"destructive"})})},W=()=>{if(!o())return;const X=p.trim();if(!X||!c)return;const Q=Date.now(),ie=tJ({id:Q,author:e,avatar:n,text:X,authorId:r??void 0});O(he=>({...he,comments:he.comments+1,commentsList:eJ(he.commentsList,ie,w)})),g(""),c.realId&&WZ(c.realId,X).then(()=>(l(),R())).catch(he=>{O(ye=>({...ye,comments:Math.max(0,ye.comments-1),commentsList:ye.commentsList.filter(J=>J.id!==Q)})),s({title:"Couldn't post your comment",description:Dt(he instanceof ze?he.body:he,"Please try again."),variant:"destructive"})})},V=(X,Q)=>{if(!c)return;const ie=X.trim(),he=Q.images.length>0||!!Q.document;if(!ie&&!he)return;const ye=Date.now(),J=tJ({id:ye,author:e,avatar:n,text:ie,authorId:r??void 0});if(O(ce=>({...ce,comments:ce.comments+1,commentsList:eJ(ce.commentsList,J,w)})),g(""),!c.realId)return;const K=c.realId;WZ(K,ie||" ").then(async ce=>{const pe=ce==null?void 0:ce.commentId;pe&&Q.images.length>0&&await eTt(K,pe,Q.images),pe&&Q.document&&await tTt(K,pe,Q.document),l(),R()}).catch(()=>{O(ce=>({...ce,comments:Math.max(0,ce.comments-1),commentsList:ce.commentsList.filter(pe=>pe.id!==ye)})),s({title:"Couldn't post your comment",variant:"destructive"})})},U=X=>{if(!c)return;const Q=c.commentsList.find(he=>he.id===X),ie=c.commentsList.findIndex(he=>he.id===X);Q&&(O(he=>({...he,comments:Math.max(0,he.comments-1),commentsList:he.commentsList.filter(ye=>ye.id!==X)})),s({title:"Comment deleted"}),!(!c.realId||!Q.realId)&&nTt(c.realId,Q.realId).catch(he=>{he instanceof ze&&he.status===404||(O(ye=>{const J=[...ye.commentsList];return J.splice(Math.min(ie,J.length),0,Q),{...ye,comments:ye.comments+1,commentsList:J}}),s({title:"Couldn't delete comment",variant:"destructive"}))}))},ne=(X,Q,ie)=>{const he=Q.trim();if(!c)return;const ye=c.commentsList.find(pe=>pe.id===X);if(!ye)return;const J=ye.images??[],K=!!ie&&ie.length!==J.length;if(!he&&!(ie&&ie.length>0))return;const ce=ye.text;he===ce&&!K||(F(X,pe=>({...pe,text:he,...ie?{images:ie}:{}})),!(!c.realId||!ye.realId)&&XNt(c.realId,ye.realId,he,ie).then(()=>R()).catch(()=>{F(X,pe=>({...pe,text:ce,images:J})),s({title:"Couldn't update comment",variant:"destructive"})}))},te=(X,Q)=>{if(!c)return;const ie=c.commentsList.find(pe=>pe.id===X);if(!ie)return;const he=ie.reactions,ye=he==null?void 0:he.details.find(pe=>pe.isByMe),J=uP(he,(ye==null?void 0:ye.emoji)===Q?null:Q);if(F(X,pe=>({...pe,reactions:J})),!c.realId||!ie.realId)return;((ye==null?void 0:ye.emoji)===Q?sTt(c.realId,ie.realId):rTt(c.realId,ie.realId,Q)).catch(()=>{F(X,pe=>({...pe,reactions:he})),s({title:"Couldn't update reaction",variant:"destructive"})})},re=(X,Q)=>b(ie=>({...ie,[X]:Q}));return{post:c,setPost:d,isLoading:u,errorStatus:m,reload:T,commentText:p,setCommentText:g,submitComment:W,submitRichComment:V,replyDrafts:v,setReplyDraft:re,submitReply:(X,Q,ie=[])=>{if(!c)return;const he=(Q??v[X]??"").trim(),ye=c.commentsList.find(ce=>ce.id===X);if(!he&&ie.length===0||!ye)return;const J=Date.now(),K={id:J,author:e,authorId:r??void 0,avatar:n,text:he,time:"Just now",isByMe:!0};F(X,ce=>({...ce,replies:[...ce.replies??[],K]})),re(X,""),!(!c.realId||!ye.realId)&&iTt(c.realId,ye.realId,he,ie).then(async()=>{l(),await R()}).catch(ce=>{F(X,pe=>({...pe,replies:(pe.replies??[]).filter(Ie=>Ie.id!==J)})),s({title:"Couldn't post your reply",description:Dt(ce instanceof ze?ce.body:ce,"Please try again."),variant:"destructive"})})},commentSort:w,setCommentSort:P,commentsHasMore:S,isLoadingMoreComments:N,loadMoreComments:I,handleLike:M,handleReactToPost:z,handleSave:G,handleShare:B,handleVotePoll:H,deleteComment:U,editComment:ne,reactToComment:te,deleteReply:(X,Q)=>{var ye;if(!c)return;const ie=c.commentsList.find(J=>J.id===X),he=(ye=ie==null?void 0:ie.replies)==null?void 0:ye.find(J=>J.id===Q);!ie||!he||(F(X,J=>({...J,replies:(J.replies??[]).filter(K=>K.id!==Q)})),s({title:"Reply deleted"}),!(!c.realId||!ie.realId||!he.realId)&&oTt(c.realId,ie.realId,he.realId).catch(J=>{J instanceof ze&&J.status===404||(F(X,K=>({...K,replies:[...K.replies??[],he]})),s({title:"Couldn't delete reply",variant:"destructive"}))}))},editReply:(X,Q,ie)=>{var ce;if(!c)return;const he=ie.trim(),ye=c.commentsList.find(pe=>pe.id===X),J=(ce=ye==null?void 0:ye.replies)==null?void 0:ce.find(pe=>pe.id===Q);if(!ye||!J||!he||he===J.text)return;const K=J.text;F(X,pe=>({...pe,replies:(pe.replies??[]).map(Ie=>Ie.id===Q?{...Ie,text:he}:Ie)})),!(!c.realId||!ye.realId||!J.realId)&&aTt(c.realId,ye.realId,J.realId,he).catch(()=>{F(X,pe=>({...pe,replies:(pe.replies??[]).map(Ie=>Ie.id===Q?{...Ie,text:K}:Ie)})),s({title:"Couldn't update reply",variant:"destructive"})})},reactToReply:(X,Q,ie)=>{var Me;if(!c)return;const he=c.commentsList.find(we=>we.id===X),ye=(Me=he==null?void 0:he.replies)==null?void 0:Me.find(we=>we.id===Q);if(!he||!ye)return;const J=ye.reactions,K=J==null?void 0:J.details.find(we=>we.isByMe),ce=(K==null?void 0:K.emoji)===ie,pe=uP(J,ce?null:ie);if(F(X,we=>({...we,replies:(we.replies??[]).map(Be=>Be.id===Q?{...Be,reactions:pe}:Be)})),!c.realId||!he.realId||!ye.realId)return;(ce?cTt(c.realId,he.realId,ye.realId):lTt(c.realId,he.realId,ye.realId,ie)).catch(()=>{F(X,we=>({...we,replies:(we.replies??[]).map(Be=>Be.id===Q?{...Be,reactions:J}:Be)})),s({title:"Couldn't update reaction",variant:"destructive"})})}}}function Lvs(){var Y,X;const{postId:t}=So(),e=Nn(),{toast:n}=yt(),{user:r,isAuthenticated:s}=jr(),{community:i}=qe(),{communityDetail:o,groups:l}=Ln(),{featuredIds:c,toggleFeatured:d}=s9(),u=r?`${r.firstName} ${r.lastName}`:"Guest",h=r?a7(r.firstName,r.lastName,40):"",m=Mvs({realId:t,currentUserName:u,currentUserAvatar:h,currentUserId:(r==null?void 0:r.id)??null}),{post:f}=m,{hash:p,pathname:g,search:v}=Di(),b=y.useRef(null),x=(f==null?void 0:f.commentsList.length)??0;y.useEffect(()=>{if(!p||b.current===p)return;const Q=document.getElementById(decodeURIComponent(p.slice(1)));Q&&(b.current=p,Q.scrollIntoView({behavior:"smooth",block:"center"}))},[p,x]);const w=(i==null?void 0:i.myRole)??(o==null?void 0:o.myRole),k=i9(w,!!((i==null?void 0:i.isByMe)??(o==null?void 0:o.isByMe))),S=f!=null&&f.groupId?(Y=l.find(Q=>Q.id===f.groupId))==null?void 0:Y.myRole:void 0,C=a9(S),[j,E]=y.useState(!1),[N,A]=y.useState(!1),[_,T]=y.useState(!1),[R,O]=y.useState(!1),[F,D]=y.useState(!1),[I,P]=y.useState(null),[M,z]=y.useState(!1),G=new URLSearchParams(v).get("analytics")==="1",B=y.useRef(null);y.useEffect(()=>{!G||!(f!=null&&f.realId)||B.current===f.realId||(B.current=f.realId,(f.isByMe||f.canEdit)&&z(!0))},[G,f==null?void 0:f.realId,f==null?void 0:f.isByMe,f==null?void 0:f.canEdit]);const[H,W]=y.useState(null),V=window.history.length>1,U=()=>e(V?-1:ve.dashboard),{isFollowing:ne,toggleFollow:te,blockAuthor:re}=dAt(()=>e(ve.dashboard)),fe={onToggleFollow:Q=>void te(Q),isFollowing:ne,onBlock:Q=>void re(Q)},le=()=>{if(!(f!=null&&f.realId))return;const Q=!f.isPinned;m.setPost(ie=>ie&&{...ie,isPinned:Q}),n({title:Q?"Post pinned":"Post unpinned"}),(Q?dTt(f.realId):uTt(f.realId)).catch(()=>{m.setPost(ie=>ie&&{...ie,isPinned:!Q}),n({title:"Couldn't update pin",variant:"destructive"})})},q=()=>{f!=null&&f.realId&&(n({title:"Post deleted"}),hTt(f.realId).catch(()=>{}),e(ve.dashboard))};return!s&&(m.errorStatus===404||m.errorStatus===403)?a.jsx(Gs,{to:{pathname:ve.signUp,search:`?redirect=${encodeURIComponent(g)}`},replace:!0}):a.jsx(CPe,{showSidebar:!0,main:a.jsxs(a.Fragment,{children:[a.jsxs("button",{type:"button",onClick:U,className:"group inline-flex items-center gap-2.5 self-start rounded-full border border-border/70 bg-card py-1.5 pl-1.5 pr-4 text-sm font-medium text-muted-foreground shadow-sm transition-all duration-200 hover:border-primary/30 hover:text-foreground hover:shadow-md focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary/40 focus-visible:ring-offset-2 focus-visible:ring-offset-background active:scale-[0.98] motion-reduce:transition-none",children:[a.jsx("span",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-primary/10 text-primary transition-transform duration-200 group-hover:-translate-x-0.5 motion-reduce:transition-none",children:a.jsx(no,{className:"h-4 w-4","aria-hidden":!0})}),V?"Back":"Back to feed"]}),m.isLoading?a.jsx("div",{className:"flex items-center justify-center py-24 text-muted-foreground",children:a.jsx(Ne,{className:"h-5 w-5 animate-spin"})}):m.errorStatus===404?a.jsx(Lhe,{title:"Post not found",body:"This post may have been deleted or moved.",onBack:U}):m.errorStatus===403?a.jsx(Lhe,{title:"You can't view this post",body:"It belongs to a group or community you don't have access to.",onBack:U}):m.errorStatus||!f?a.jsx(Lhe,{title:"Couldn't load this post",body:"Please try again.",onBack:m.reload,backLabel:"Retry"}):a.jsx(PAt,{post:f,variant:"detail",hideMenu:!s,expanded:!0,isCommenting:!1,commentText:"",currentUserName:u,currentUserAvatar:h,canPin:C,canFeature:k,canMove:C,onMove:()=>D(!0),isFeatured:f.realId?c.has(f.realId):!1,isCommentsLoading:!1,onToggleExpand:()=>{},onLike:m.handleLike,onReact:m.handleReactToPost,onViewAnalytics:()=>z(!0),onSave:m.handleSave,onShare:m.handleShare,onSend:()=>T(!0),onRepost:()=>O(!0),onHide:U,onReport:()=>A(!0),onReportUser:()=>f.authorId&&P({id:f.authorId,name:f.author}),onToggleFollow:()=>void te(f),isFollowingAuthor:ne(f.authorId),onBlockAuthor:()=>void re(f),onPin:le,onFeature:()=>d(f),onEdit:()=>E(!0),onDelete:q,onLoadComments:()=>{},onComment:()=>{},onCommentTextChange:()=>{},onSubmitComment:()=>{},onVotePoll:m.handleVotePoll,commentSlot:a.jsx(AAt,{comments:f.commentsList,postId:f.realId,postAuthorId:(X=f.preferences)!=null&&X.hideCreator?void 0:f.authorId,currentUserName:u,currentUserAvatar:h,commentText:m.commentText,onCommentTextChange:m.setCommentText,onSubmitComment:m.submitComment,onSubmitRichComment:m.submitRichComment,replyDrafts:m.replyDrafts,onReplyDraftChange:m.setReplyDraft,onSubmitReply:m.submitReply,onReactComment:m.reactToComment,onDeleteComment:m.deleteComment,onReactReply:m.reactToReply,onDeleteReply:m.deleteReply,onEditReply:m.editReply,onEditComment:m.editComment,onReportComment:s?Q=>{const ie=f.commentsList.find(he=>he.id===Q);ie&&W({content:ie,contentKind:"comment"})}:void 0,onReportReply:s?(Q,ie)=>{var ye,J;const he=(J=(ye=f.commentsList.find(K=>K.id===Q))==null?void 0:ye.replies)==null?void 0:J.find(K=>K.id===ie);he&&W({content:he,contentKind:"reply"})}:void 0,canDeleteAnyComment:f.canDeleteComment,canDeleteAnyReply:f.canDeleteReply,authorActions:s?fe:void 0,sort:m.commentSort,totalComments:f.comments,onSortChange:m.setCommentSort,hasMoreComments:m.commentsHasMore,isLoadingMoreComments:m.isLoadingMoreComments,onLoadMoreComments:()=>void m.loadMoreComments()})}),a.jsx(kPe,{post:f,open:_,onOpenChange:T}),a.jsx(iAt,{post:R?f:null,onOpenChange:Q=>{Q||O(!1)},onReposted:()=>{O(!1),m.setPost(Q=>Q&&{...Q,reposts:(Q.reposts??0)+1,reposted:!0})}}),a.jsx($_t,{realId:j&&f?f.realId??null:null,onOpenChange:Q=>!Q&&E(!1),onSaved:Q=>m.setPost(ie=>{if(!ie)return ie;const he=Am(Q,ie.id);return he.commentsList=ie.commentsList,he.commentsLoaded=ie.commentsLoaded,he})}),a.jsx(O_t,{post:N?f:null,communityId:i==null?void 0:i.id,onOpenChange:Q=>!Q&&A(!1)}),a.jsx(aAt,{postRealId:M?(f==null?void 0:f.realId)??null:null,onOpenChange:Q=>!Q&&z(!1)}),a.jsx(n9,{target:I,communityId:i==null?void 0:i.id,onOpenChange:Q=>!Q&&P(null)}),a.jsx(RAt,{comment:(H==null?void 0:H.content)??null,contentKind:H==null?void 0:H.contentKind,postRealId:f==null?void 0:f.realId,communityId:i==null?void 0:i.id,onOpenChange:Q=>!Q&&W(null)}),a.jsx(Ivs,{post:F?f:null,communityId:i==null?void 0:i.id,groups:l,onOpenChange:Q=>!Q&&D(!1),onMoved:()=>m.reload()})]})})}function Lhe({title:t,body:e,onBack:n,backLabel:r="Back to feed"}){return a.jsxs("div",{className:"flex flex-col items-center gap-3 py-24 text-center",children:[a.jsx("p",{className:"text-sm font-semibold text-foreground",children:t}),a.jsx("p",{className:"text-sm text-muted-foreground",children:e}),a.jsx(Z,{variant:"outline",size:"sm",onClick:n,children:r})]})}const Dvs={course:kE,merchandise:Krt,coupon_external:ka,coupon_internal:ka,event_ticket:VP,custom:xo},kXe={pending:"bg-warning/15 text-warning-foreground border-warning/30",approved:"bg-primary/10 text-primary border-primary/20",fulfilled:"bg-success/15 text-success border-success/30",rejected:"bg-destructive/10 text-destructive border-destructive/30",refunded:"bg-muted text-muted-foreground border-border"},$vs={pending:"We've received your request and will confirm it shortly.",approved:"Approved — your reward is being prepared.",fulfilled:"Fulfilled. Enjoy your reward!",rejected:"This claim was rejected and your points were refunded.",refunded:"Refunded — your points have been returned."};function SXe({value:t}){const[e,n]=y.useState(!1);return a.jsxs("button",{onClick:()=>{var r;(r=navigator.clipboard)==null||r.writeText(t),n(!0),setTimeout(()=>n(!1),1500)},className:"inline-flex items-center gap-1 rounded-md border border-border px-2 py-1 text-xs hover:bg-muted",children:[e?a.jsx(Qn,{className:"h-3 w-3 text-success"}):a.jsx(Zl,{className:"h-3 w-3"})," ",e?"Copied":"Copy"]})}function pC({icon:t,label:e,children:n}){return a.jsxs("div",{className:"flex items-start gap-2.5 text-sm",children:[a.jsx(t,{className:"h-4 w-4 mt-0.5 text-muted-foreground shrink-0"}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:e}),a.jsx("div",{className:"text-foreground",children:n})]})]})}function COt({redemption:t,admin:e=!1,onClose:n,onCancel:r}){const s=tv(),i=t,o=i&&Dvs[i.type??""]||bx,l=i!=null&&i.shippingAddress?Object.values(i.shippingAddress).filter(Boolean).join(", "):null;return a.jsx(Bt,{open:!!i,onOpenChange:c=>c?void 0:n(),children:a.jsx(Ft,{className:"sm:max-w-md",children:i&&a.jsxs(a.Fragment,{children:[a.jsx(Vt,{children:a.jsxs(Ut,{className:"flex items-center gap-2",children:[a.jsx(o,{className:"h-5 w-5 text-primary"})," ",i.title||"Reward"]})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"relative h-32 w-full overflow-hidden rounded-lg bg-gradient-to-br from-muted to-muted/40",children:[a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx(o,{className:"h-8 w-8 text-muted-foreground/40"})}),i.image&&a.jsx("img",{src:i.image,alt:i.title,className:"relative h-full w-full object-cover",onError:c=>{c.currentTarget.style.display="none"}})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:ee("rounded-full border px-2.5 py-0.5 text-[11px] font-semibold capitalize",kXe[i.status]??kXe.pending),children:i.status}),a.jsxs("span",{className:"text-sm font-bold text-primary flex items-center gap-1",children:[a.jsx(gK,{className:"h-3.5 w-3.5"})," ",i.pointsSpent.toLocaleString()," ",s]})]}),!e&&a.jsx("p",{className:"text-sm text-muted-foreground",children:$vs[i.status]}),a.jsxs("div",{className:"space-y-3 border-t border-border pt-3",children:[e&&i.user&&a.jsxs(pC,{icon:bx,label:"Member",children:[i.user.name,i.user.email?` · ${i.user.email}`:""]}),a.jsx(pC,{icon:I8,label:"Claimed",children:new Date(i.createdAt).toLocaleString()}),i.couponCode&&a.jsx(pC,{icon:ka,label:"Coupon code",children:a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-mono font-semibold",children:i.couponCode}),a.jsx(SXe,{value:i.couponCode})]})}),i.ticketCode&&a.jsx(pC,{icon:VP,label:"Ticket code",children:a.jsxs("span",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-mono font-semibold",children:i.ticketCode}),a.jsx(SXe,{value:i.ticketCode})]})}),l&&a.jsx(pC,{icon:Jf,label:"Shipping address",children:l}),i.trackingNote&&a.jsx(pC,{icon:cst,label:"Tracking / note",children:i.trackingNote}),e&&i.adminNote&&a.jsx(pC,{icon:xo,label:"Admin note",children:i.adminNote})]}),r&&i.status==="pending"&&a.jsx(ir,{children:a.jsx("button",{onClick:r,className:"rounded-lg border border-destructive/40 text-destructive px-4 py-2 text-sm font-medium hover:bg-destructive/10",children:"Cancel & refund"})})]})]})})})}function CXe(t){if(!t)return null;const e=new Date(t).getTime()-Date.now();if(!Number.isFinite(e)||e<=0)return null;const n=Math.floor(e/864e5);if(n>0)return`Ends in ${n}d`;const r=Math.floor(e/36e5);return`Ends in ${Math.max(1,r)}h`}const qC=t=>t.toLocaleString("en-US"),tke={course:kE,merchandise:Krt,coupon_external:ka,coupon_internal:ka,event_ticket:VP,custom:xo},jXe={pending:"bg-warning/15 text-warning-foreground border-warning/30",approved:"bg-primary/10 text-primary border-primary/20",fulfilled:"bg-success/15 text-success border-success/30",rejected:"bg-destructive/10 text-destructive border-destructive/30",refunded:"bg-muted text-muted-foreground border-border"};function Ovs(){const t=tv(),{community:e}=qe(),n=(e==null?void 0:e.id)??null,{toast:r}=yt(),[s,i]=y.useState([]),[o,l]=y.useState({spendable:0,lifetimeEarned:0}),[c,d]=y.useState([]),[u,h]=y.useState(!0),[m,f]=y.useState(null),[p,g]=y.useState("rewards"),[v,b]=y.useState("all"),[x,w]=y.useState(!1),[k,S]=y.useState(""),[C,j]=y.useState([]),[E,N]=y.useState(!1),[A,_]=y.useState(null),[T,R]=y.useState(null),[O,F]=y.useState(!1),[D,I]=y.useState({name:"",line1:"",city:"",postalCode:"",country:"",phone:""}),P=(A==null?void 0:A.type)==="merchandise",M=!!(D.name.trim()&&D.line1.trim()&&D.city.trim()&&D.country.trim()),z=y.useCallback(async()=>{if(n){h(!0),f(null);try{const[V,U,ne]=await Promise.all([bOt(n),nvs(n),Zgs(n).catch(()=>[])]);i(V.rewards),l(V.balance),d(U),j(ne)}catch(V){f(V instanceof ze?V.message:"Failed to load rewards.")}finally{h(!1)}}},[n]);y.useEffect(()=>{z()},[z]);const G=y.useMemo(()=>{const V=new Set(s.map(U=>U.category).filter(Boolean));return["all",...Array.from(V)]},[s]),B=y.useMemo(()=>{const V=k.trim().toLowerCase();return s.filter(U=>!(v!=="all"&&U.category!==v||x&&(U.cost>o.spendable||U.soldOut)||V&&!`${U.title} ${U.description}`.toLowerCase().includes(V)))},[s,v,x,o.spendable,k]),H=y.useMemo(()=>s.filter(V=>!V.soldOut&&V.cost<=o.spendable).length,[s,o.spendable]),W=async()=>{if(!(!A||!n)){if(P&&!M){r({title:"Shipping address required",description:"Add where we should ship this.",variant:"destructive"});return}F(!0);try{const V=await tvs(n,A.id,P?{shippingAddress:D}:{});l(V.balance),_(null),I({name:"",line1:"",city:"",postalCode:"",country:"",phone:""}),R(V.redemption),await z()}catch(V){r({title:"Couldn't claim",description:V instanceof ze?V.message:"Something went wrong.",variant:"destructive"})}finally{F(!1)}}};return u?a.jsxs("div",{className:"flex flex-col items-center justify-center py-24 text-muted-foreground",children:[a.jsx(Ne,{className:"h-6 w-6 animate-spin mb-3"}),a.jsx("p",{className:"text-sm",children:"Loading rewards…"})]}):m?a.jsxs("div",{className:"flex flex-col items-center justify-center py-24 text-center",children:[a.jsx("p",{className:"text-sm text-muted-foreground mb-4",children:m}),a.jsxs("button",{onClick:z,className:"inline-flex items-center gap-2 rounded-lg border border-border px-4 py-2 text-sm font-medium hover:bg-muted",children:[a.jsx(Nl,{className:"h-4 w-4"})," Try again"]})]}):a.jsxs(it.div,{initial:{opacity:0},animate:{opacity:1},className:"space-y-6",children:[a.jsxs("div",{className:"rounded-2xl border border-border bg-gradient-to-br from-primary/10 to-card p-5 sm:p-6 flex flex-wrap items-center justify-between gap-4",children:[a.jsxs("div",{children:[a.jsxs("h1",{className:"text-xl font-bold text-foreground flex items-center gap-2",children:[a.jsx(bx,{className:"h-5 w-5 text-primary"})," Rewards"]}),a.jsxs("p",{className:"text-sm text-muted-foreground mt-0.5",children:["Spend your ",t," on exclusive rewards."]}),C.length>0&&a.jsxs("button",{onClick:()=>N(!0),className:"mt-2 inline-flex items-center gap-1.5 rounded-full bg-card border border-border px-3 py-1 text-xs font-medium text-foreground hover:bg-muted",children:[a.jsx(Ey,{className:"h-3.5 w-3.5 text-primary"})," How to earn ",t]})]}),a.jsxs("div",{className:"flex items-center gap-6",children:[a.jsxs("div",{className:"text-right",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-2xl font-bold text-primary",children:[a.jsx(gK,{className:"h-5 w-5"})," ",qC(o.spendable)]}),a.jsxs("p",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:[t," to spend"]})]}),a.jsxs("div",{className:"text-right border-l border-border pl-6",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-lg font-semibold text-foreground",children:[a.jsx(Hg,{className:"h-4 w-4 text-warning"})," ",qC(o.lifetimeEarned)]}),a.jsxs("p",{className:"flex items-center justify-end gap-1 text-[11px] uppercase tracking-wider text-muted-foreground",children:["Earned all-time",a.jsxs(gn,{label:"Earned all-time",children:["Every ",t," point you have earned in this community — the same number the leaderboard, the member directory and your profile show. What you can spend is this minus what you have already redeemed; a cancelled or refunded claim gives its points back."]})]})]})]})]}),p==="rewards"&&H>0&&a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-primary/20 bg-primary/5 px-4 py-2.5 text-sm text-foreground",children:[a.jsx(xo,{className:"h-4 w-4 text-primary shrink-0"}),"You can afford ",a.jsx("span",{className:"font-semibold",children:H})," ",H===1?"reward":"rewards"," right now — treat yourself!"]}),a.jsx("div",{className:"flex items-center gap-2 border-b border-border",children:["rewards","mine"].map(V=>a.jsx("button",{onClick:()=>g(V),className:ee("px-4 py-2 text-sm font-medium -mb-px border-b-2 transition-colors",p===V?"border-primary text-primary":"border-transparent text-muted-foreground hover:text-foreground"),children:V==="rewards"?"Rewards":`My Redemptions${c.length?` (${c.length})`:""}`},V))}),p==="rewards"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[G.map(V=>a.jsx("button",{onClick:()=>b(V),className:ee("rounded-full px-3 py-1 text-xs font-medium border capitalize transition-colors",v===V?"bg-primary text-primary-foreground border-primary":"border-border text-foreground hover:bg-muted"),children:V},V)),a.jsxs("label",{className:"ml-auto flex items-center gap-2 text-xs text-muted-foreground cursor-pointer select-none",children:[a.jsx("input",{type:"checkbox",checked:x,onChange:V=>w(V.target.checked),className:"accent-primary"}),"Affordable only"]})]}),a.jsxs("div",{className:"relative w-full max-w-xs",children:[a.jsx(hs,{className:"absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground"}),a.jsx("input",{type:"text",value:k,onChange:V=>S(V.target.value),placeholder:"Search rewards…",className:"w-full rounded-lg border border-border bg-card pl-9 pr-3 py-2 text-sm placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring"})]}),B.length===0?a.jsx("p",{className:"text-sm text-muted-foreground py-12 text-center",children:"No rewards match."}):a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4",children:B.map(V=>{const U=tke[V.type]??bx,ne=o.spendable>=V.cost,te=V.soldOut||!ne;return a.jsxs("div",{className:ee("group flex flex-col overflow-hidden rounded-xl border bg-card transition-all duration-200 ease-out motion-safe:hover:-translate-y-0.5 hover:shadow-lg",te?"border-border":"border-border hover:border-primary/40"),children:[a.jsxs("div",{className:"relative h-36 overflow-hidden bg-gradient-to-br from-muted to-muted/40",children:[a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx(U,{className:"h-8 w-8 text-muted-foreground/40"})}),V.image&&a.jsx("img",{src:V.image,alt:V.title,loading:"lazy",className:"relative h-full w-full object-cover transition-transform duration-300 ease-out motion-safe:group-hover:scale-[1.03]",onError:re=>{re.currentTarget.style.display="none"}}),a.jsx("span",{className:"absolute top-2 left-2 rounded-full border border-border bg-background/80 px-2 py-0.5 text-[10px] font-medium capitalize backdrop-blur-sm",children:V.category}),V.remaining!=null&&a.jsx("span",{className:ee("absolute top-2 right-2 rounded-full px-2 py-0.5 text-[10px] font-semibold",V.soldOut?"bg-destructive text-destructive-foreground":"bg-background/90 border border-border"),children:V.soldOut?"Sold out":`${V.remaining} left`}),CXe(V.activeTo)&&a.jsxs("span",{className:"absolute bottom-2 left-2 inline-flex items-center gap-1 rounded-full bg-warning/90 text-warning-foreground px-2 py-0.5 text-[10px] font-semibold",children:[a.jsx(ja,{className:"h-3 w-3"})," ",CXe(V.activeTo)]})]}),a.jsxs("div",{className:"flex flex-1 flex-col p-4",children:[a.jsx("h3",{className:"text-sm font-semibold leading-snug text-foreground",children:V.title}),a.jsx("p",{className:"mt-1 line-clamp-2 flex-1 text-xs leading-relaxed text-muted-foreground",children:V.description}),a.jsxs("div",{className:"mt-3 flex items-center justify-between gap-2",children:[a.jsxs("span",{className:"inline-flex items-center gap-1 rounded-md bg-primary/10 px-2 py-1 text-sm font-bold text-primary",children:[a.jsx(gK,{className:"h-3.5 w-3.5"})," ",qC(V.cost)]}),a.jsx("button",{onClick:()=>_(V),disabled:te,className:ee("rounded-lg px-3 py-1.5 text-xs font-semibold transition-colors",te?"cursor-not-allowed bg-muted text-muted-foreground":"bg-primary text-primary-foreground hover:bg-primary/90"),children:V.soldOut?"Sold out":ne?"Claim":`Need ${qC(V.cost-o.spendable)} more`})]})]})]},V.id)})})]}):a.jsx(Fvs,{redemptions:c,onBrowse:()=>g("rewards"),onCancel:async V=>{if(n)try{await Jgs(n,V),r({title:"Claim cancelled",description:"Your points have been refunded."}),await z()}catch(U){r({title:"Couldn't cancel",description:U instanceof ze?U.message:"Try again.",variant:"destructive"})}}}),a.jsx(Bt,{open:E,onOpenChange:V=>V?void 0:N(!1),children:a.jsxs(Ft,{className:"sm:max-w-md",children:[a.jsxs(Vt,{children:[a.jsxs(Ut,{className:"flex items-center gap-2",children:[a.jsx(Ey,{className:"h-5 w-5 text-primary"})," How to earn ",t]}),a.jsx(_n,{children:"Earn points by staying active — then spend them on rewards."})]}),a.jsx("div",{className:"space-y-2",children:C.map(V=>a.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border bg-card px-3 py-2.5",children:[a.jsx("span",{className:"text-sm text-foreground",children:V.label}),a.jsxs("span",{className:"text-sm font-bold text-primary",children:["+",V.points]})]},V.activityType))})]})}),a.jsx(Bt,{open:!!A,onOpenChange:V=>V?void 0:_(null),children:a.jsxs(Ft,{className:"sm:max-w-md",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Claim reward?"}),a.jsx(_n,{children:A&&a.jsxs(a.Fragment,{children:["Redeem ",a.jsx("span",{className:"font-medium text-foreground",children:A.title})," for ",a.jsxs("span",{className:"font-semibold text-primary",children:[qC(A.cost)," ",t]}),". You'll have ",a.jsxs("span",{className:"font-medium text-foreground",children:[qC(Math.max(0,o.spendable-A.cost))," ",t]})," left."]})})]}),P&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Shipping address"}),a.jsx("input",{value:D.name,onChange:V=>I({...D,name:V.target.value}),placeholder:"Full name",className:"w-full rounded-lg border border-border bg-card px-3 py-2 text-sm"}),a.jsx("input",{value:D.line1,onChange:V=>I({...D,line1:V.target.value}),placeholder:"Address",className:"w-full rounded-lg border border-border bg-card px-3 py-2 text-sm"}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx("input",{value:D.city,onChange:V=>I({...D,city:V.target.value}),placeholder:"City",className:"rounded-lg border border-border bg-card px-3 py-2 text-sm"}),a.jsx("input",{value:D.postalCode,onChange:V=>I({...D,postalCode:V.target.value}),placeholder:"Postal code",className:"rounded-lg border border-border bg-card px-3 py-2 text-sm"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[a.jsx("input",{value:D.country,onChange:V=>I({...D,country:V.target.value}),placeholder:"Country",className:"rounded-lg border border-border bg-card px-3 py-2 text-sm"}),a.jsx("input",{value:D.phone,onChange:V=>I({...D,phone:V.target.value}),placeholder:"Phone (optional)",className:"rounded-lg border border-border bg-card px-3 py-2 text-sm"})]})]}),a.jsxs(ir,{children:[a.jsx("button",{onClick:()=>_(null),className:"rounded-lg border border-border px-4 py-2 text-sm font-medium hover:bg-muted",children:"Cancel"}),a.jsxs("button",{onClick:W,disabled:O||P&&!M,className:"inline-flex items-center justify-center gap-2 rounded-lg bg-primary px-4 py-2 text-sm font-semibold text-primary-foreground hover:bg-primary/90 disabled:opacity-60",children:[O?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsx(Qn,{className:"h-4 w-4"})," Confirm claim"]})]})]})}),a.jsx(Bt,{open:!!T,onOpenChange:V=>V?void 0:R(null),children:a.jsx(Ft,{className:"sm:max-w-sm text-center",children:T&&(()=>{const V=T.couponCode||T.ticketCode,U=tke[T.type]??bx;return a.jsxs("div",{className:"flex flex-col items-center px-2 py-2",children:[a.jsxs(it.div,{initial:{scale:.6,opacity:0},animate:{scale:1,opacity:1},transition:{type:"spring",stiffness:260,damping:18},className:"relative mb-4 flex h-16 w-16 items-center justify-center rounded-full bg-primary/15 text-primary",children:[a.jsx(Qn,{className:"h-8 w-8"}),a.jsx(xo,{className:"absolute -right-1 -top-1 h-4 w-4 text-primary"})]}),a.jsx("h3",{className:"text-lg font-bold text-foreground",children:"Reward claimed!"}),a.jsxs("p",{className:"mt-1 flex items-center gap-1.5 text-sm text-muted-foreground",children:[a.jsx(U,{className:"h-3.5 w-3.5"})," ",T.title]}),V?a.jsxs("div",{className:"mt-4 w-full rounded-lg border border-dashed border-primary/40 bg-primary/5 p-3",children:[a.jsx("p",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:"Your code"}),a.jsxs("div",{className:"mt-1 flex items-center justify-center gap-2",children:[a.jsx("span",{className:"font-mono text-base font-bold tracking-wide text-foreground",children:V}),a.jsx("button",{onClick:()=>{var ne;(ne=navigator.clipboard)==null||ne.writeText(V),r({title:"Code copied"})},className:"rounded-md p-1.5 text-muted-foreground hover:bg-muted hover:text-foreground",title:"Copy code",children:a.jsx(Zl,{className:"h-3.5 w-3.5"})})]})]}):a.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:T.status==="fulfilled"?"It's ready — find it in My Redemptions.":"We'll confirm your request shortly. Track it in My Redemptions."}),a.jsxs("div",{className:"mt-5 flex w-full gap-2",children:[a.jsx("button",{onClick:()=>R(null),className:"flex-1 rounded-lg border border-border py-2 text-sm font-medium text-foreground hover:bg-muted",children:"Keep browsing"}),a.jsx("button",{onClick:()=>{R(null),g("mine")},className:"flex-1 rounded-lg bg-primary py-2 text-sm font-semibold text-primary-foreground hover:bg-primary/90",children:"View redemption"})]})]})})()})})]})}function Fvs({redemptions:t,onBrowse:e,onCancel:n}){const[r,s]=y.useState(null),i=tv();return t.length===0?a.jsxs("div",{className:"flex flex-col items-center justify-center py-16 text-center text-muted-foreground",children:[a.jsx(bx,{className:"h-8 w-8 mb-3 text-primary"}),a.jsx("p",{className:"text-sm",children:"You haven't claimed any rewards yet."}),a.jsx("button",{onClick:e,className:"mt-3 rounded-lg bg-primary px-4 py-2 text-sm font-semibold text-primary-foreground hover:bg-primary/90",children:"Browse rewards"})]}):a.jsxs("div",{className:"space-y-3",children:[t.map(o=>{const l=tke[o.type]??bx;return a.jsxs("button",{onClick:()=>s(o),className:"w-full text-left flex items-center gap-4 rounded-xl border border-border bg-card p-4 hover:border-primary/30 hover:shadow-sm transition-all",children:[a.jsxs("div",{className:"relative h-12 w-12 shrink-0 overflow-hidden rounded-lg bg-muted",children:[a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx(l,{className:"h-5 w-5 text-muted-foreground/50"})}),o.image&&a.jsx("img",{src:o.image,alt:o.title,loading:"lazy",className:"relative h-full w-full object-cover",onError:c=>{c.currentTarget.style.display="none"}})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("h4",{className:"text-sm font-semibold text-foreground truncate",children:o.title}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[new Date(o.createdAt).toLocaleDateString()," · ",qC(o.pointsSpent)," ",i]}),o.couponCode&&a.jsxs("p",{className:"text-xs mt-1",children:["Code: ",a.jsx("span",{className:"font-mono font-semibold text-foreground",children:o.couponCode})]}),o.trackingNote&&a.jsx("p",{className:"text-xs mt-1 text-muted-foreground line-clamp-1",children:o.trackingNote})]}),a.jsx("span",{className:ee("shrink-0 rounded-full border px-2.5 py-0.5 text-[11px] font-semibold capitalize",jXe[o.status]??jXe.pending),children:o.status}),a.jsx("span",{className:"text-xs text-muted-foreground shrink-0",children:"View ›"})]},o.id)}),a.jsx(COt,{redemption:r,onClose:()=>s(null),onCancel:r&&r.status==="pending"?()=>{n(r.id),s(null)}:void 0})]})}const Bvs=5,EXe=(t,e)=>`${t} ${e}${t===1?"":"s"}`,Uvs={uploading:{label:"Uploading",tone:"bg-primary/10 text-primary",Icon:kd},processing:{label:"Processing",tone:"bg-primary/10 text-primary",Icon:Ne},completed:{label:"Completed",tone:"bg-emerald-500/10 text-emerald-700 dark:text-emerald-400",Icon:yo},failed:{label:"Failed",tone:"bg-destructive/10 text-destructive",Icon:tS}};function jOt({upload:t,sending:e,fieldLabel:n,onRetry:r,retrying:s,className:i}){const o=e&&!t?e.error?"failed":"uploading":t?QB(t)?"processing":t.status:null;if(!o)return null;const l=Uvs[o],c=(t==null?void 0:t.fileName)||(e==null?void 0:e.fileName)||"CSV",d=t?t.percent:(e==null?void 0:e.percent)??0,u=o==="uploading"||o==="processing";let h;return t?t.status==="pending"?h=`${EXe(t.total,"option")} received. Waiting to start… You can leave this page; we'll notify you when it's finished.`:t.status==="processing"?h=`${t.processed} of ${EXe(t.total,"option")} done (${d}%). You can leave this page; we'll notify you when it's finished.`:t.status==="completed"?h=Ipr(t):h=t.failureReason||"The upload stopped.":h=(e==null?void 0:e.error)||`Sending the file… ${d}%`,a.jsxs("div",{className:ee("rounded-md border border-border bg-card p-3",i),"aria-live":"polite",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[a.jsxs("span",{className:ee("inline-flex shrink-0 items-center gap-1 rounded-full px-2 py-0.5 text-[11px] font-medium",l.tone),children:[a.jsx(l.Icon,{className:ee("h-3 w-3",o==="processing"&&"animate-spin"),"aria-hidden":!0}),l.label]}),a.jsxs("p",{className:"min-w-0 truncate text-sm font-medium text-foreground",title:c,children:[c,n?a.jsxs("span",{className:"font-normal text-muted-foreground",children:[" · ",n]}):null]})]}),o==="failed"&&r?a.jsxs(Z,{type:"button",size:"sm",variant:"outline",className:"h-7",onClick:r,disabled:s,children:[s?a.jsx(Ne,{className:"mr-1 h-3.5 w-3.5 animate-spin"}):a.jsx(tst,{className:"mr-1 h-3.5 w-3.5"})," Retry"]}):null]}),u?a.jsx(ap,{value:d,className:"mt-2 h-2","aria-label":`${l.label} ${c}: ${d}%`}):null,a.jsx("p",{className:ee("mt-1.5 text-xs",o==="failed"?"text-destructive":"text-muted-foreground"),children:h})]})}function zvs({communityId:t,fieldLabels:e}){var i;const n=yNt(t),r=C0({queryKey:[...L1(t),"list"],queryFn:({pageParam:o})=>uNt(t,{page:o,limit:Bvs}),initialPageParam:1,getNextPageParam:o=>o.hasMore?o.page+1:void 0,enabled:!!t,refetchInterval:o=>{var l;return(l=o.state.data)!=null&&l.pages.some(c=>c.imports.some(QB))?vNt*2:!1}}),s=((i=r.data)==null?void 0:i.pages.flatMap(o=>o.imports))??[];return bNt(t,s),s.length?a.jsxs("section",{className:"rounded-lg border border-border bg-card p-4 sm:p-5","aria-label":"Option uploads",children:[a.jsxs("h3",{className:"flex items-center gap-1.5 text-sm font-semibold text-foreground",children:["Option uploads",a.jsx(gn,{label:"Option uploads",children:"Options from a CSV are added in the background once the file has uploaded, so you can leave this page or close the browser. Each logo is copied into your community's storage as it goes. You get a notification when an upload finishes or fails. A failed upload can be retried: it carries on from where it stopped, without adding anything twice."})]}),a.jsx("div",{className:"mt-3 space-y-2",children:s.map(o=>a.jsx(jOt,{upload:o,fieldLabel:e[o.fieldId]??"Deleted field",onRetry:e[o.fieldId]?()=>n.mutate(o.id):void 0,retrying:n.isPending&&n.variables===o.id},o.id))}),r.hasNextPage?a.jsxs(Z,{type:"button",variant:"ghost",size:"sm",className:"mt-2",onClick:()=>void r.fetchNextPage(),disabled:r.isFetchingNextPage,children:[r.isFetchingNextPage?a.jsx(Ne,{className:"mr-1 h-4 w-4 animate-spin"}):null," Show more"]}):null]}):null}const NXe=()=>typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,12)}`,s4=50,Vvs=1024*1024,Hvs={text:["longText","url"],longText:["text","url"],url:["text","longText"],select:["multiSelect"],multiSelect:["select"]},Gvs=["text","number","date","boolean","select","multiSelect"],Dhe=["longText","url"],GT=t=>t.replace(/\s+/g," ").trim().toLowerCase();let Wvs=0;const q$=()=>`opt-${++Wvs}`;function TXe(t,e){if(t)return{label:t.label,type:t.type,description:t.description,placeholder:t.placeholder,options:t.options.filter(r=>r.status==="active").map(r=>({key:q$(),id:r.id,label:r.label,logoUrl:r.logoUrl})),allowMemberOptions:t.allowMemberOptions,memberOptionsNeedApproval:t.memberOptionsNeedApproval,required:t.required??t.onboarding==="required",showInOnboarding:t.showInOnboarding??t.onboarding!=="hidden",visibility:t.visibility,memberCanEdit:t.memberCanEdit,filterable:t.filterable,showInDirectory:t.showInDirectory!==!1,defaultValue:t.defaultValue};const n=(e==null?void 0:e.type)??"text";return{label:(e==null?void 0:e.label)??"",type:n,description:(e==null?void 0:e.description)??"",placeholder:(e==null?void 0:e.placeholder)??"",options:((e==null?void 0:e.options)??[]).map(r=>({key:q$(),label:r})),allowMemberOptions:!1,memberOptionsNeedApproval:!0,required:!1,showInOnboarding:!0,visibility:"members",memberCanEdit:!0,filterable:vA(n)||n==="boolean",showInDirectory:!0,defaultValue:null}}function WT({title:t,hint:e,info:n,children:r}){return a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("p",{className:"flex items-center gap-1.5 text-sm font-medium text-foreground",children:[t,n?a.jsx(gn,{label:t,children:n}):null]}),e?a.jsx("p",{className:"text-xs text-muted-foreground",children:e}):null]}),a.jsx("div",{className:"shrink-0",children:r})]})}function qvs({communityId:t,label:e,logoUrl:n,disabled:r,onChange:s}){const i=y.useRef(null),[o,l]=y.useState(!1),[c,d]=y.useState(!1),u=e.trim()||"this option",h=async p=>{if(p){if(!QVe.includes(p.type)){He.error("Choose a PNG, JPG, WebP or GIF image",{description:"Logos work best square, on a plain or transparent background."});return}if(p.size>_pr){He.error("That image is too large",{description:"Logos can be up to 2 MB."});return}l(!0);try{s(await amr(t,p)),He.success(`Logo added to “${u}”`,{description:"Save the field to keep it."})}catch(g){He.error("Couldn't upload the logo",{description:dn(g,"Please try again.")})}finally{l(!1)}}},m="flex h-9 w-9 shrink-0 items-center justify-center overflow-hidden rounded-md border transition-colors disabled:opacity-50",f=a.jsx("input",{ref:i,type:"file",accept:QVe.join(","),"aria-label":`Upload a logo for ${u}`,className:"hidden",onChange:p=>{var g;h((g=p.target.files)==null?void 0:g[0]),p.target.value=""}});return n?a.jsxs(a.Fragment,{children:[a.jsxs(Ni,{open:c,onOpenChange:d,children:[a.jsx(Ti,{asChild:!0,children:a.jsx("button",{type:"button",disabled:r||o,"aria-label":`Logo for ${u}: change or remove`,title:"Change or remove the logo",className:ee(m,"border-border bg-white p-0.5 hover:ring-2 hover:ring-ring/40"),children:o?a.jsx(Ne,{className:"h-4 w-4 animate-spin text-muted-foreground","aria-hidden":!0}):a.jsx(Gk,{src:n,label:e,size:"md",fallback:!0,className:"h-full w-full ring-0"})})}),a.jsxs(yi,{align:"start",className:"w-44 p-1",children:[a.jsxs("button",{type:"button",onClick:()=>{var p;d(!1),(p=i.current)==null||p.click()},className:"flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm hover:bg-muted",children:[a.jsx(jy,{className:"h-3.5 w-3.5","aria-hidden":!0})," Change logo"]}),a.jsxs("button",{type:"button",onClick:()=>{d(!1),s("")},className:"flex w-full items-center gap-2 rounded-md px-2.5 py-1.5 text-left text-sm text-destructive hover:bg-destructive/10",children:[a.jsx(qn,{className:"h-3.5 w-3.5","aria-hidden":!0})," Remove logo"]})]})]}),f]}):a.jsxs(a.Fragment,{children:[a.jsx("button",{type:"button",disabled:r||o,onClick:()=>{var p;return(p=i.current)==null?void 0:p.click()},"aria-label":`Add a logo for ${u}`,title:"Add a logo",className:ee(m,"border-dashed border-border text-muted-foreground hover:bg-muted hover:text-foreground"),children:o?a.jsx(Ne,{className:"h-4 w-4 animate-spin","aria-hidden":!0}):a.jsx(jy,{className:"h-4 w-4","aria-hidden":!0})}),f]})}function Kvs({open:t,onOpenChange:e,communityId:n,field:r,preset:s,existingLabels:i,onSaved:o}){var Be,Ve;const l=rn(),[c,d]=y.useState(()=>TXe(r,s)),[u,h]=y.useState(""),[m,f]=y.useState(""),[p,g]=y.useState(s4),[v,b]=y.useState({}),[x,w]=y.useState(!1),[k,S]=y.useState(null),[C,j]=y.useState({}),E=y.useRef(null);y.useEffect(()=>{t&&(d(TXe(r,s)),h(""),f(""),g(s4),b({}),S(null),j({}))},[t,r,s]);const N=(be,Ze)=>d(Pe=>({...Pe,[be]:Ze})),A=vA(c.type),_=(r==null?void 0:r.answers)??0,T=!!r&&r.type!==c.type,R=T&&_>0&&!(Hvs[r.type]??[]).includes(c.type),O=y.useMemo(()=>{if(!r||!vA(r.type)||!A)return 0;const be=new Set(c.options.map(Ze=>Ze.id).filter(Boolean));return r.options.filter(Ze=>Ze.status==="active"&&!be.has(Ze.id)).reduce((Ze,Pe)=>Ze+(Pe.answers??0),0)},[r,c.options,A]),F=be=>{d(Ze=>({...Ze,type:be,defaultValue:null,filterable:Dhe.includes(be)?!1:Ze.filterable||vA(be)||be==="boolean",allowMemberOptions:vA(be)?Ze.allowMemberOptions:!1}))},D=()=>{const be=u.replace(/\s+/g," ").trim();if(be){if(c.options.some(Ze=>Ze.label.toLowerCase()===be.toLowerCase())){b(Ze=>({...Ze,options:`“${be}” is already in the list.`}));return}N("options",[...c.options,{key:q$(),label:be}]),h(""),b(({options:Ze,...Pe})=>Pe)}},I=m.trim()!=="",P=y.useMemo(()=>{const be=m.toLowerCase().split(/\s+/).filter(Boolean);return c.options.map((Ze,Pe)=>({option:Ze,index:Pe})).filter(({option:Ze})=>be.every(Pe=>Ze.label.toLowerCase().includes(Pe)))},[c.options,m]),M=P.slice(0,p),z=(r==null?void 0:r.options.filter(be=>be.status==="pending").length)??0,G=Math.max(0,LV-z-c.options.length),[B,H]=y.useState(null),[W,V]=y.useState({importId:null,request:null}),[U,ne]=y.useState(""),te=lt({queryKey:[...L1(n),"field",r==null?void 0:r.id],queryFn:()=>uNt(n,{fieldId:r.id,active:!0,limit:1}),enabled:t&&!!r}),re=W.importId??((Ve=(Be=te.data)==null?void 0:Be.imports[0])==null?void 0:Ve.id)??null,fe=Dpr(n,t?re:null,()=>void Y()),le=yNt(n),q=!!(B&&!B.error)||!!(fe.data&&QB(fe.data));y.useEffect(()=>{t&&(H(null),V({importId:null,request:null}),ne(""))},[t,r]);const Y=async()=>{if(!r)return;let be;try{be=(await lNt(n)).find(Ke=>Ke.id===r.id)}catch{return}if(!be)return;const Ze=new Map(be.options.map(Ke=>[Ke.id,Ke])),Pe=new Map(r.options.map(Ke=>[Ke.id,Ke.logoUrl]));d(Ke=>{const De=new Set(Ke.options.map(Ee=>Ee.id).filter(Boolean)),xt=new Map(Ke.options.filter(Ee=>!Ee.id).map(Ee=>[GT(Ee.label),Ee.key])),Xe=be.options.filter(Ee=>Ee.status==="active"&&!De.has(Ee.id)),tt=new Map(Xe.filter(Ee=>xt.has(GT(Ee.label))).map(Ee=>[xt.get(GT(Ee.label)),Ee])),$e=Ke.options.map(Ee=>{const Ge=tt.get(Ee.key);if(Ge)return{...Ee,id:Ge.id,logoUrl:Ge.logoUrl};const Pt=Ee.id?Ze.get(Ee.id):void 0;return Pt&&Pt.logoUrl!==Pe.get(Ee.id)?{...Ee,logoUrl:Pt.logoUrl}:Ee}),wt=Xe.filter(Ee=>!xt.has(GT(Ee.label)));return{...Ke,options:[...$e,...wt.map(Ee=>({key:q$(),id:Ee.id,label:Ee.label,logoUrl:Ee.logoUrl}))]}}),o(be)},X=async be=>{if(r){V({importId:null,request:be}),H({fileName:be.fileName,percent:0});try{const Ze=await YVe(n,r.id,be,Pe=>H(Ke=>Ke&&{...Ke,percent:Pe}));l.setQueryData([...L1(n),"one",Ze.id],Ze),V({importId:Ze.id,request:be}),H(null),l.invalidateQueries({queryKey:[...L1(n),"list"]})}catch(Ze){const Pe=Ze instanceof ze?Ze.body:void 0;if((Pe==null?void 0:Pe.code)==="IMPORT_IN_PROGRESS"&&Pe.import){V({importId:Pe.import.id,request:null}),H(null),He.error("An upload is already running for this field",{description:"Wait for it to finish, then upload again."});return}H({fileName:be.fileName,percent:0,error:dn(Ze,"The file didn't upload. Check your connection and retry.")})}}},Q=()=>{B!=null&&B.error&&W.request?X(W.request):re&&le.mutate(re)},ie=async be=>{if(!be)return;if(!/\.csv$/i.test(be.name)&&be.type!=="text/csv"){He.error("Choose a .csv file",{description:"Download the template to see the format."});return}if(be.size>Vvs){He.error("That file is too large",{description:"Upload a CSV of up to 1 MB."});return}let Ze;try{Ze=Rpr(await be.text())}catch{He.error("Couldn't read that file",{description:"Save it as a CSV and try again."});return}if(r){const{added:wt}=ZVe(Ze,[],1/0);if(!wt.length){He.error("No options in that file",{description:"Put one option per row in the first column, like the template."});return}b(({options:Ee,...Ge})=>Ge),await X({rows:wt.map(Ee=>Ee.logoUrl?{label:Ee.label,logoUrl:Ee.logoUrl}:Ee.label),fileName:be.name,requestKey:NXe()});return}const Pe=ZVe(Ze,c.options.map(wt=>wt.label),G),Ke={added:Pe.added.length,logos:0,duplicates:Pe.duplicates,tooLong:Pe.tooLong,overLimit:Pe.overLimit,badLogos:Pe.badLogos},De=new Map(c.options.map(wt=>[GT(wt.label),wt])),xt=new Map;for(const wt of Pe.logoUpdates){const Ee=De.get(GT(wt.label));!Ee||Ee.logoUrl===wt.logoUrl?Ke.duplicates++:xt.set(Ee.key,wt.logoUrl)}Ke.logos=xt.size,(xt.size||Ke.added)&&(ne(be.name),d(wt=>({...wt,options:[...wt.options.map(Ee=>xt.has(Ee.key)?{...Ee,logoUrl:xt.get(Ee.key),csvLogo:!0}:Ee),...Pe.added.map(Ee=>({key:q$(),label:Ee.label,logoUrl:Ee.logoUrl,csvLogo:!!Ee.logoUrl}))]})));const Xe=[Ke.duplicates?`${Ke.duplicates} already in the list`:"",Ke.tooLong?`${Ke.tooLong} longer than ${d0e} characters`:"",Ke.overLimit?`${Ke.overLimit} over the ${LV}-option limit`:"",Ke.badLogos?`${Ke.badLogos} logo link${Ke.badLogos===1?" that isn't a web address":"s that aren't web addresses"}`:""].filter(Boolean).join(", "),tt=[Ke.added?`${Ke.added} option${Ke.added===1?"":"s"}`:"",Ke.logos?`${Ke.logos} logo${Ke.logos===1?"":"s"}`:""].filter(Boolean).join(" and ");if(!tt){He.error("No new options in that file",{description:Xe?`Skipped: ${Xe}.`:"Put one option per row in the first column, like the template."});return}b(({options:wt,...Ee})=>Ee);const $e="Save the field to keep them.";He.success(`Added ${tt} from ${be.name}`,{description:Xe?`Skipped: ${Xe}. ${$e}`:$e})},he=(be,Ze)=>{const Pe=[...c.options],[Ke]=Pe.splice(be,1);Pe.splice(be+Ze,0,Ke),N("options",Pe)},ye=()=>{const be={},Ze=c.label.replace(/\s+/g," ").trim();if(Ze?i.some(Pe=>Pe.toLowerCase()===Ze.toLowerCase()&&Pe.toLowerCase()!==(r==null?void 0:r.label.toLowerCase()))&&(be.label="There is already a field with this name."):be.label="Give the field a name.",A){const Pe=c.options.map(Ke=>Ke.label.trim().toLowerCase()).filter(Boolean);new Set(Pe).size!==Pe.length?be.options="Each option can be in the list once.":!Pe.length&&!c.allowMemberOptions&&(be.options="Add at least one option, or let members add their own.")}return b(be),Object.keys(be).length===0},J=(be={})=>({label:c.label,type:c.type,description:c.description,placeholder:c.placeholder,required:c.required,showInOnboarding:c.showInOnboarding,visibility:c.visibility,memberCanEdit:c.memberCanEdit,filterable:Dhe.includes(c.type)?!1:c.filterable,showInDirectory:c.showInDirectory,allowMemberOptions:A&&c.allowMemberOptions,memberOptionsNeedApproval:c.memberOptionsNeedApproval,defaultValue:PS(c.defaultValue)?null:c.defaultValue,...A?{options:c.options.filter(Ze=>Ze.label.trim()).map(({id:Ze,label:Pe,logoUrl:Ke,csvLogo:De})=>({id:Ze,label:Pe,logoUrl:De?"":Ke??""}))}:{},...be}),K=async be=>{const Ze=c.options.filter(Pe=>Pe.csvLogo&&Pe.logoUrl&&Pe.label.trim()).map(Pe=>({label:Pe.label.trim(),logoUrl:Pe.logoUrl}));if(!Ze.length)return!1;try{return await YVe(n,be,{rows:Ze,fileName:U||"CSV logos",requestKey:NXe()}),l.invalidateQueries({queryKey:L1(n)}),!0}catch(Pe){return He.error("Couldn't start copying the logos",{description:`${dn(Pe,"Please try again.")} Open the field and upload the CSV again to add them.`}),!1}},ce=async(be={})=>{if(ye()&&!q){w(!0);try{const{logosNotCopied:Ze,storageFull:Pe,...Ke}=r?await dNt(n,r.id,J(be)):await gpr(n,J(be)),De=gNt({logosNotCopied:Ze,storageFull:Pe}),xt=A?await K(Ke.id):!1;He.success(r?"Field saved":"Field added",{description:`“${Ke.label}” is ready${Ke.active?"":" (switched off)"}.${De?` ${De}`:""}${xt?" Its logos are being copied in the background: you'll get a notification when it's done.":""}`}),o(Ke),e(!1)}catch(Ze){const Pe=Ze instanceof ze?Ze.body:void 0;Ze instanceof ze&&Ze.status===409&&((Pe==null?void 0:Pe.code)==="TYPE_CHANGE_CLEARS_ANSWERS"||(Pe==null?void 0:Pe.code)==="OPTIONS_IN_USE")?S({code:Pe.code,message:Pe.message||"This change clears some answers."}):Ze instanceof ze&&Ze.status===409&&(Pe==null?void 0:Pe.code)==="FIELD_CHANGED"?He.error("Couldn't save the field",{description:dn(Ze,"It changed while you were editing. Open it again and redo your change.")}):Ze instanceof ze&&Ze.status===409?b({label:dn(Ze,"There is already a field with this name.")}):He.error("Couldn't save the field",{description:dn(Ze,"Please try again.")})}finally{w(!1)}}},pe={id:"preview",label:c.label||"Field name",type:c.type,placeholder:c.placeholder,description:c.description,visibility:c.visibility,onboarding:c.showInOnboarding?c.required?"required":"optional":"hidden",required:c.required,showInOnboarding:c.showInOnboarding,memberCanEdit:c.memberCanEdit,filterable:c.filterable,showInDirectory:c.showInDirectory,active:!0,order:0,allowMemberOptions:A&&c.allowMemberOptions,memberOptionsNeedApproval:c.memberOptionsNeedApproval,defaultValue:c.defaultValue,options:c.options.filter(be=>be.label.trim()).map(be=>({id:be.id||be.key,label:be.label,status:"active",logoUrl:be.logoUrl||void 0}))},Ie=pe.options.filter(be=>c.options.some(Ze=>Ze.id===be.id)),Me={...pe,id:"default",onboarding:"optional",required:!1,description:"",allowMemberOptions:!1,options:Ie},we=Gvs.includes(c.type)&&(!A||Ie.length>0);return a.jsxs(a.Fragment,{children:[a.jsx(Bt,{open:t,onOpenChange:be=>{(be||!importing)&&e(be)},children:a.jsxs(Ft,{className:"flex max-h-[90vh] w-[calc(100vw-2rem)] max-w-2xl flex-col gap-0 overflow-hidden p-0",children:[a.jsxs(Vt,{className:"border-b border-border px-5 py-4 text-left",children:[a.jsx(Ut,{children:r?`Edit “${r.label}”`:"Add a member field"}),a.jsxs(_n,{children:["Members fill this in on their profile",c.showInOnboarding?" and when they join":"",". It shows in your member directory."]})]}),a.jsxs("div",{className:"min-h-0 flex-1 space-y-6 overflow-y-auto px-5 py-5",children:[a.jsxs("section",{className:"space-y-4","aria-labelledby":"mf-basics",children:[a.jsx("h3",{id:"mf-basics",className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Basics"}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"mf-label",children:"Field name"}),a.jsx(Oe,{id:"mf-label",value:c.label,maxLength:60,placeholder:"e.g. Department","aria-invalid":!!v.label||void 0,onChange:be=>N("label",be.target.value)}),v.label?a.jsx("p",{role:"alert",className:"text-xs text-destructive",children:v.label}):null]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"mf-type",children:"Type"}),a.jsxs(zn,{value:c.type,onValueChange:be=>F(be),children:[a.jsx(On,{id:"mf-type",children:a.jsx(Vn,{})}),a.jsx(Fn,{children:mNt.map(be=>a.jsxs(pt,{value:be.value,children:[be.label," ",a.jsxs("span",{className:"text-xs text-muted-foreground",children:["· ",be.hint]})]},be.value))})]}),R?a.jsxs("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:["Changing from ",c0e(r.type)," to ",c0e(c.type)," clears the ",_," answer",_===1?"":"s"," members have given."]}):T&&_>0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"Answers members already gave are kept and converted. If some don't fit the new type, you'll be asked before they change."}):null]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(_e,{htmlFor:"mf-description",children:["Help text ",a.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),a.jsx(us,{id:"mf-description",rows:2,maxLength:300,value:c.description,placeholder:"Tell members what to enter, or why you ask",onChange:be=>N("description",be.target.value)})]}),c.type!=="boolean"&&c.type!=="date"?a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(_e,{htmlFor:"mf-placeholder",children:["Placeholder ",a.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),a.jsx(Oe,{id:"mf-placeholder",maxLength:120,value:c.placeholder,placeholder:A?"e.g. Choose your department":"e.g. Head of Sports Science",onChange:be=>N("placeholder",be.target.value)})]}):null]}),A?a.jsxs("section",{className:"space-y-3","aria-labelledby":"mf-options",children:[a.jsxs("h3",{id:"mf-options",className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:["Options",a.jsx(gn,{label:"Option logos",children:"Give an option a logo, like a club's crest or a company's logo, with the image button beside it. Members see it next to the option when they pick, and in the member directory and on profiles. Use a square PNG, JPG, WebP or GIF of up to 2 MB. For a long list, put each logo's web address in the CSV's second column. We copy each linked logo into your community's storage, so it keeps showing even if the original site moves or deletes it."})]}),c.options.length>BZ?a.jsx(Oe,{value:m,onChange:be=>{f(be.target.value),g(s4)},placeholder:`Search the ${c.options.length} options`,"aria-label":"Search options",className:"h-9"}):null,a.jsx("ul",{className:"space-y-2",children:M.map(({option:be,index:Ze})=>a.jsxs("li",{className:"flex items-center gap-2",children:[a.jsx(qvs,{communityId:n,label:be.label,logoUrl:be.logoUrl,disabled:x,onChange:Pe=>N("options",c.options.map(Ke=>Ke.key===be.key?{...Ke,logoUrl:Pe}:Ke))}),a.jsx(Oe,{value:be.label,maxLength:60,"aria-label":`Option ${Ze+1}`,onChange:Pe=>N("options",c.options.map(Ke=>Ke.key===be.key?{...Ke,label:Pe.target.value}:Ke)),className:"h-9 min-w-0 flex-1"}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",disabled:I||Ze===0,title:I?"Clear the search to reorder":void 0,onClick:()=>he(Ze,-1),"aria-label":`Move ${be.label||"option"} up`,children:a.jsx(Zf,{className:"h-4 w-4"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",disabled:I||Ze===c.options.length-1,title:I?"Clear the search to reorder":void 0,onClick:()=>he(Ze,1),"aria-label":`Move ${be.label||"option"} down`,children:a.jsx(w0,{className:"h-4 w-4"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>N("options",c.options.filter(Pe=>Pe.key!==be.key)),"aria-label":`Remove ${be.label||"option"}`,children:a.jsx(nn,{className:"h-4 w-4"})})]},be.key))}),P.length>M.length?a.jsxs(Z,{type:"button",variant:"ghost",size:"sm",className:"h-8 w-full text-xs",onClick:()=>g(be=>be+s4),children:["Show ",Math.min(s4,P.length-M.length)," more (",P.length-M.length," not shown)"]}):null,I&&P.length===0?a.jsxs("p",{className:"text-xs text-muted-foreground",children:["No option matches “",m.trim(),"”."]}):null,a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Oe,{value:u,maxLength:60,placeholder:"Add an option","aria-label":"New option",onChange:be=>h(be.target.value),onKeyDown:be=>{be.key==="Enter"&&(be.preventDefault(),D())},className:"h-9 min-w-0 flex-1"}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-9",onClick:D,disabled:!u.trim(),children:[a.jsx(Dn,{className:"mr-1 h-4 w-4"})," Add"]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-x-3 gap-y-1.5",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-8",onClick:()=>{var be;return(be=E.current)==null?void 0:be.click()},disabled:G===0||q||x,title:G===0?`A field can have up to ${LV} options`:void 0,children:[q?a.jsx(Ne,{className:"mr-1 h-4 w-4 animate-spin"}):a.jsx(kd,{className:"mr-1 h-4 w-4"})," Upload CSV"]}),a.jsx("input",{ref:E,type:"file",accept:".csv,text/csv","aria-label":"Upload options CSV",className:"hidden",onChange:be=>{var Ze;ie((Ze=be.target.files)==null?void 0:Ze[0]),be.target.value=""}}),a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:[a.jsxs("button",{type:"button",onClick:()=>iie("member-field-options-template.csv",Ppr),className:"inline-flex items-center gap-1 text-xs font-medium text-primary hover:underline",children:[a.jsx(bc,{className:"h-3.5 w-3.5","aria-hidden":!0})," Download template"]}),a.jsxs(gn,{label:"Upload options from a CSV",children:[`Put one option per row in the first column, and its logo's web address (optional) in the second. Each logo is copied into your community's storage, so it doesn't depend on the other site. A row naming an option already in the list gives it that logo. A first row named "Option" is skipped, and so are blank rows, options already in the list and options over `,d0e," characters. A field can have up to ",LV," options. ",r?"Once the file has uploaded, the options are added in the background: you can close this or leave the page, and you'll get a notification when it's done. A failed upload can be retried from where it stopped.":"They are added to the list above, where you can edit or remove them, and are kept when you add the field. Their logos are then copied in the background, and you'll get a notification when it's done."]})]})]}),a.jsx(jOt,{upload:W.importId||!B?fe.data:null,sending:B,onRetry:Q,retrying:le.isPending}),v.options?a.jsx("p",{role:"alert",className:"text-xs text-destructive",children:v.options}):null,O>0?a.jsxs("p",{className:"rounded-md bg-destructive/10 px-3 py-2 text-xs text-destructive",children:[O," member",O===1?" has":"s have"," picked an option you removed. Their choice will be cleared when you save."]}):null,a.jsx(WT,{title:"Members can add their own options",hint:"For when the list can't cover everyone, like Skills.",children:a.jsx(Hs,{checked:c.allowMemberOptions,onCheckedChange:be=>N("allowMemberOptions",be),"aria-label":"Members can add their own options"})}),c.allowMemberOptions?a.jsx(WT,{title:"Approve new options first",hint:"A new option shows only to the member who added it until you approve it, under Waiting for approval.",children:a.jsx(Hs,{checked:c.memberOptionsNeedApproval,onCheckedChange:be=>N("memberOptionsNeedApproval",be),"aria-label":"Approve new options first"})}):null]}):null,a.jsxs("section",{className:"space-y-4","aria-labelledby":"mf-rules",children:[a.jsx("h3",{id:"mf-rules",className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Who, when and where"}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("p",{className:"flex items-center gap-1.5 text-sm font-medium text-foreground",children:["Answer",a.jsx(gn,{label:"Optional or required",children:"Required: members must answer it. If it's shown in onboarding, they can't finish joining without it, and once answered it can't be left empty. Optional: members can skip it."})]}),a.jsx("div",{role:"radiogroup","aria-label":"Answer",className:"grid grid-cols-2 rounded-lg border border-border p-0.5",children:[[!1,"Optional"],[!0,"Required"]].map(([be,Ze])=>a.jsx("button",{type:"button",role:"radio","aria-checked":c.required===be,onClick:()=>N("required",be),className:ee("rounded-md px-2 py-1.5 text-sm transition-colors",c.required===be?"bg-primary text-primary-foreground":"text-foreground hover:bg-muted"),children:Ze},Ze))})]}),a.jsx(WT,{title:"Show in onboarding",hint:"Ask it in the step members see right after they join. Off: members fill it in from their profile (Edit Profile) only.",info:"Only members who join after this is turned on are asked. Members who joined before aren't stopped by a new field; they can answer it from Edit Profile.",children:a.jsx(Hs,{checked:c.showInOnboarding,onCheckedChange:be=>N("showInOnboarding",be),"aria-label":"Show in onboarding"})}),r&&!(r.showInOnboarding??r.onboarding!=="hidden")&&c.showInOnboarding?a.jsx("p",{className:"-mt-2 text-xs text-muted-foreground",children:"Members who join from now on are asked. Current members can answer it from Edit Profile."}):null,a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"mf-visibility",children:"Who can see the answers"}),a.jsxs(zn,{value:c.visibility,onValueChange:be=>N("visibility",be),children:[a.jsx(On,{id:"mf-visibility",children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"members",children:"All members"}),a.jsx(pt,{value:"admins",children:"Admins only"})]})]}),c.visibility==="admins"?a.jsx("p",{className:"text-xs text-muted-foreground",children:"Members still see their own answer. It isn't shown or filterable in the directory for other members."}):null]}),a.jsx(WT,{title:"Members can change their answer later",hint:"Off: once answered, only an admin can change it.",children:a.jsx(Hs,{checked:c.memberCanEdit,onCheckedChange:be=>N("memberCanEdit",be),"aria-label":"Members can change their answer later"})}),a.jsx(WT,{title:"Show in the member directory",hint:c.visibility==="admins"?"As its own column in your members table. Members don't see it, since only admins see the answers.":"As its own column in the members table, and on members' cards. Off: answers stay on profiles only.",children:a.jsx(Hs,{checked:c.showInDirectory,onCheckedChange:be=>N("showInDirectory",be),"aria-label":"Show in the member directory"})}),Dhe.includes(c.type)?null:a.jsx(WT,{title:"Show as a directory filter",hint:"Members can narrow the directory by this field.",children:a.jsx(Hs,{checked:c.filterable,onCheckedChange:be=>N("filterable",be),"aria-label":"Show as a directory filter"})})]}),we?a.jsxs("section",{className:"space-y-2","aria-labelledby":"mf-default",children:[a.jsxs("h3",{id:"mf-default",className:"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:["Pre-filled answer ",a.jsx("span",{className:"font-normal normal-case tracking-normal",children:"(optional)"})]}),a.jsx(iF,{idPrefix:"mf-default",fields:[{...Me,label:"Starts as"}],values:{default:c.defaultValue},onChange:(be,Ze)=>N("defaultValue",Ze)})]}):null,a.jsxs("section",{className:"space-y-2 rounded-xl border border-dashed border-border bg-muted/30 p-4","aria-labelledby":"mf-preview",children:[a.jsx("h3",{id:"mf-preview",className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"How members see it"}),a.jsx(iF,{idPrefix:"mf-preview",fields:[pe],values:{preview:C.preview??c.defaultValue},onChange:(be,Ze)=>j({preview:Ze})})]})]}),a.jsxs(ir,{className:"gap-2 border-t border-border px-5 py-3 sm:items-center sm:gap-0",children:[q?a.jsx("p",{className:"text-xs text-muted-foreground sm:mr-auto sm:pr-3",children:"You can save once the upload finishes. Closing doesn't stop it."}):null,a.jsx(Z,{type:"button",variant:"outline",onClick:()=>e(!1),disabled:x,children:q?"Close":"Cancel"}),a.jsxs(Z,{type:"button",onClick:()=>void ce(),disabled:x||q,children:[x?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Qn,{className:"mr-2 h-4 w-4"}),r?"Save field":"Add field"]})]})]})}),a.jsx(Kr,{open:!!k,onOpenChange:be=>!be&&S(null),children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Clear these answers?"}),a.jsxs(zr,{children:[k==null?void 0:k.message," This can't be undone."]})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:"Keep editing"}),a.jsxs(Yr,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:()=>{const be=k==null?void 0:k.code;S(null),ce(be==="TYPE_CHANGE_CLEARS_ANSWERS"?{confirmClearAnswers:!0,confirmRemoveOptions:!0}:{confirmRemoveOptions:!0})},children:[a.jsx(qn,{className:"mr-2 h-4 w-4"})," Save and clear"]})]})]})})]})}const Yvs=[{name:"Department",preset:{label:"Department",type:"select",options:["Engineering","Marketing","Sales","Operations"]}},{name:"Skills",preset:{label:"Skills",type:"multiSelect",options:["Leadership","Data","Design"]}},{name:"Graduation year",preset:{label:"Graduation year",type:"number",placeholder:"e.g. 2024"}},{name:"Open to mentoring",preset:{label:"Open to mentoring",type:"boolean"}}];function vw({children:t,tone:e="muted"}){return a.jsx("span",{className:ee("inline-flex items-center rounded-full px-2 py-0.5 text-[11px] font-medium",e==="primary"&&"bg-primary/10 text-primary",e==="amber"&&"bg-amber-500/10 text-amber-700 dark:text-amber-400",e==="muted"&&"bg-muted text-muted-foreground"),children:t})}function Qvs(){const{community:t}=qe(),e=(t==null?void 0:t.id)??"",n=rn(),r=[...Hk(e),"manage"],s=lt({queryKey:r,queryFn:()=>lNt(e),enabled:!!e}),i=s.data??[],[o,l]=y.useState({open:!1,field:null}),[c,d]=y.useState(null),u=()=>n.invalidateQueries({queryKey:Hk(e)}),h=k=>n.setQueryData(r,S=>(S??[]).map(C=>C.id===k.id?k:C)),m=k=>S=>He.error(k,{description:dn(S,"Please try again.")}),f=jt({mutationFn:k=>dNt(e,k.id,{active:!k.active}),onSuccess:k=>{h(k),He.success(k.active?`“${k.label}” is on`:`“${k.label}” is off`,{description:k.active?"Members see it again.":"Hidden everywhere. Its answers are kept."}),u()},onError:m("Couldn't switch the field")}),p=jt({mutationFn:k=>bpr(e,k),onMutate:k=>{const S=n.getQueryData(r),C=new Map((S??[]).map(j=>[j.id,j]));return n.setQueryData(r,k.map(j=>C.get(j)).filter(Boolean)),{previous:S}},onError:(k,S,C)=>{C!=null&&C.previous&&n.setQueryData(r,C.previous),m("Couldn't change the order")(k)},onSettled:()=>void u()}),g=(k,S)=>{const C=i.map(E=>E.id),[j]=C.splice(k,1);C.splice(k+S,0,j),p.mutate(C)},v=jt({mutationFn:k=>vpr(e,k.id),onSuccess:k=>{He.success("Field duplicated",{description:`“${k.label}” is switched off until you're ready.`}),u()},onError:m("Couldn't duplicate the field")}),b=jt({mutationFn:k=>ypr(e,k.id),onSuccess:(k,S)=>{He.success("Field deleted",{description:`“${S.label}” and its answers were removed.`}),d(null),u()},onError:m("Couldn't delete the field")}),x=jt({mutationFn:({field:k,optionId:S,approve:C})=>C?xpr(e,k.id,S):wpr(e,k.id,S),onSuccess:(k,{approve:S})=>{h(k),He.success(S?"Option approved":"Option rejected",{description:S?"Everyone can now pick it.":"Members who picked it no longer have it."})},onError:m("Couldn't update the option")}),w=i.flatMap(k=>k.options.filter(S=>S.status==="pending").map(S=>({field:k,option:S})));return a.jsxs("div",{className:"space-y-4",children:[a.jsx("div",{className:"rounded-lg border border-border bg-card p-4 sm:p-5",children:a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("h2",{className:"flex items-center gap-1.5 text-base font-semibold text-foreground",children:["Member fields",a.jsx(gn,{label:"Member fields",children:"Ask members for the details that matter in this community, such as Department or Graduation year. Answers show in your member directory, where members can filter by them, and you choose which fields are asked when someone joins. These fields belong to this community only."})]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Details members share in this community's directory."})]}),a.jsxs(Z,{onClick:()=>l({open:!0,field:null}),disabled:!e||i.length>=30,className:"shrink-0",children:[a.jsx(Dn,{className:"mr-2 h-4 w-4"})," Add field"]})]})}),e?a.jsx(zvs,{communityId:e,fieldLabels:Object.fromEntries(i.map(k=>[k.id,k.label]))}):null,w.length>0?a.jsxs("div",{className:"rounded-lg border border-amber-500/30 bg-amber-500/5 p-4",children:[a.jsxs("h3",{className:"text-sm font-semibold text-foreground",children:["Waiting for approval (",w.length,")"]}),a.jsx("p",{className:"mb-3 text-xs text-muted-foreground",children:"Options members added. Only the member who added one sees it until you approve it."}),a.jsx("ul",{className:"divide-y divide-border rounded-md border border-border bg-card",children:w.map(({field:k,option:S})=>a.jsxs("li",{className:"flex flex-wrap items-center justify-between gap-2 px-3 py-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:S.label}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["in ",k.label,S.answers?` · picked by ${S.answers}`:""]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs(Z,{size:"sm",variant:"outline",disabled:x.isPending,onClick:()=>x.mutate({field:k,optionId:S.id,approve:!1}),children:[a.jsx(nn,{className:"mr-1 h-3.5 w-3.5"})," Reject"]}),a.jsxs(Z,{size:"sm",disabled:x.isPending,onClick:()=>x.mutate({field:k,optionId:S.id,approve:!0}),children:[a.jsx(Qn,{className:"mr-1 h-3.5 w-3.5"})," Approve"]})]})]},S.id))})]}):null,s.isLoading?a.jsx("div",{className:"space-y-2","aria-busy":!0,children:[0,1,2].map(k=>a.jsx(sr,{className:"h-16 w-full rounded-lg"},k))}):s.isError?a.jsxs("div",{className:"flex flex-col items-center gap-3 rounded-lg border border-dashed border-border p-8 text-center",children:[a.jsx("p",{className:"text-sm text-foreground",children:"Couldn't load the member fields."}),a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>void s.refetch(),children:[a.jsx(Nl,{className:"mr-2 h-4 w-4"})," Try again"]})]}):i.length===0?a.jsxs("div",{className:"rounded-lg border border-dashed border-border p-6 text-center sm:p-8",children:[a.jsx(WBt,{className:"mx-auto h-8 w-8 text-muted-foreground","aria-hidden":!0}),a.jsx("p",{className:"mt-3 text-sm font-medium text-foreground",children:"No member fields yet"}),a.jsx("p",{className:"mx-auto mt-1 max-w-md text-sm text-muted-foreground",children:"Add the details you'd like members to share. Start from one of these, or create your own."}),a.jsx("div",{className:"mt-4 flex flex-wrap justify-center gap-2",children:Yvs.map(({name:k,preset:S})=>a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>l({open:!0,field:null,preset:S}),children:[a.jsx(Dn,{className:"mr-1 h-3.5 w-3.5"})," ",k]},k))})]}):a.jsx("ul",{className:"space-y-2",children:i.map((k,S)=>a.jsxs("li",{className:ee("flex items-center gap-2 rounded-lg border border-border bg-card p-3 sm:gap-3",!k.active&&"bg-muted/30"),children:[a.jsxs("div",{className:"flex flex-col",children:[a.jsx(Z,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:S===0||p.isPending,onClick:()=>g(S,-1),"aria-label":`Move ${k.label} up`,children:a.jsx(Zf,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{variant:"ghost",size:"icon",className:"h-6 w-6",disabled:S===i.length-1||p.isPending,onClick:()=>g(S,1),"aria-label":`Move ${k.label} down`,children:a.jsx(w0,{className:"h-3.5 w-3.5"})})]}),a.jsxs("button",{type:"button",onClick:()=>l({open:!0,field:k}),className:"min-w-0 flex-1 text-left",children:[a.jsx("p",{className:ee("truncate text-sm font-medium",k.active?"text-foreground":"text-muted-foreground"),children:k.label}),a.jsxs("div",{className:"mt-1 flex flex-wrap gap-1",children:[a.jsx(vw,{children:c0e(k.type)}),a.jsx(vw,{tone:k.required?"primary":"muted",children:k.required?"Required":"Optional"}),a.jsx(vw,{children:k.showInOnboarding?"In onboarding":"Not in onboarding"}),k.visibility==="admins"?a.jsx(vw,{tone:"amber",children:"Admins only"}):null,k.filterable?a.jsx(vw,{children:"Filter"}):null,k.showInDirectory===!1?a.jsx(vw,{children:"Not in directory"}):null,k.memberCanEdit?null:a.jsx(vw,{children:"Locked after joining"}),a.jsxs(vw,{children:[k.answers??0," answered"]})]})]}),a.jsx(Hs,{checked:k.active,disabled:f.isPending,onCheckedChange:()=>f.mutate(k),"aria-label":k.active?`Switch off ${k.label}`:`Switch on ${k.label}`}),a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0","aria-label":`Actions for ${k.label}`,children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[a.jsxs(ot,{onClick:()=>l({open:!0,field:k}),children:[a.jsx(Qs,{className:"mr-2 h-4 w-4"})," Edit"]}),a.jsxs(ot,{disabled:v.isPending||i.length>=30,onClick:()=>v.mutate(k),children:[a.jsx(Zl,{className:"mr-2 h-4 w-4"})," Duplicate"]}),a.jsx(mi,{}),a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>d(k),children:[a.jsx(qn,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})]},k.id))}),i.length>=30?a.jsx("p",{className:"text-xs text-muted-foreground",children:"A community can have up to 30 member fields."}):null,e?a.jsx(Kvs,{open:o.open,onOpenChange:k=>l(S=>({...S,open:k})),communityId:e,field:o.field,preset:o.preset,existingLabels:i.map(k=>k.label),onSaved:()=>void u()}):null,a.jsx(Kr,{open:!!c,onOpenChange:k=>!k&&d(null),children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsxs(Ur,{children:["Delete “",c==null?void 0:c.label,"”?"]}),a.jsxs(zr,{children:[c!=null&&c.answers?`This removes the field and the ${c.answers} answer${c.answers===1?"":"s"} members gave. This can't be undone.`:"This removes the field. No member has answered it yet."," ","To hide it but keep the answers, switch it off instead."]})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:b.isPending,children:"Cancel"}),a.jsxs(Yr,{className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",disabled:b.isPending,onClick:k=>{k.preventDefault(),c&&b.mutate(c)},children:[b.isPending?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(qn,{className:"mr-2 h-4 w-4"}),"Delete field"]})]})]})})]})}var _Xe=1,Zvs=.9,Jvs=.8,Xvs=.17,$he=.1,Ohe=.999,eys=.9999,tys=.99,nys=/[\\\/_+.#"@\[\(\{&]/,rys=/[\\\/_+.#"@\[\(\{&]/g,sys=/[\s-]/,EOt=/[\s-]/g;function nke(t,e,n,r,s,i,o){if(i===e.length)return s===t.length?_Xe:tys;var l=`${s},${i}`;if(o[l]!==void 0)return o[l];for(var c=r.charAt(i),d=n.indexOf(c,s),u=0,h,m,f,p;d>=0;)h=nke(t,e,n,r,d+1,i+1,o),h>u&&(d===s?h*=_Xe:nys.test(t.charAt(d-1))?(h*=Jvs,f=t.slice(s,d-1).match(rys),f&&s>0&&(h*=Math.pow(Ohe,f.length))):sys.test(t.charAt(d-1))?(h*=Zvs,p=t.slice(s,d-1).match(EOt),p&&s>0&&(h*=Math.pow(Ohe,p.length))):(h*=Xvs,s>0&&(h*=Math.pow(Ohe,d-s))),t.charAt(d)!==e.charAt(i)&&(h*=eys)),(h<$he&&n.charAt(d-1)===r.charAt(i+1)||r.charAt(i+1)===r.charAt(i)&&n.charAt(d-1)!==r.charAt(i))&&(m=nke(t,e,n,r,d+1,i+2,o),m*$he>h&&(h=m*$he)),h>u&&(u=h),d=n.indexOf(c,d+1);return o[l]=u,u}function AXe(t){return t.toLowerCase().replace(EOt," ")}function iys(t,e,n){return t=n&&n.length>0?`${t+" "+n.join(" ")}`:t,nke(t,e,AXe(t),AXe(e),0,0,{})}var i4='[cmdk-group=""]',Fhe='[cmdk-group-items=""]',ays='[cmdk-group-heading=""]',NOt='[cmdk-item=""]',PXe=`${NOt}:not([aria-disabled="true"])`,rke="cmdk-item-select",B_="data-value",oys=(t,e,n)=>iys(t,e,n),TOt=y.createContext(void 0),O9=()=>y.useContext(TOt),_Ot=y.createContext(void 0),HIe=()=>y.useContext(_Ot),AOt=y.createContext(void 0),POt=y.forwardRef((t,e)=>{let n=U_(()=>{var B,H;return{search:"",value:(H=(B=t.value)!=null?B:t.defaultValue)!=null?H:"",selectedItemId:void 0,filtered:{count:0,items:new Map,groups:new Set}}}),r=U_(()=>new Set),s=U_(()=>new Map),i=U_(()=>new Map),o=U_(()=>new Set),l=ROt(t),{label:c,children:d,value:u,onValueChange:h,filter:m,shouldFilter:f,loop:p,disablePointerSelection:g=!1,vimBindings:v=!0,...b}=t,x=el(),w=el(),k=el(),S=y.useRef(null),C=yys();bE(()=>{if(u!==void 0){let B=u.trim();n.current.value=B,j.emit()}},[u]),bE(()=>{C(6,R)},[]);let j=y.useMemo(()=>({subscribe:B=>(o.current.add(B),()=>o.current.delete(B)),snapshot:()=>n.current,setState:(B,H,W)=>{var V,U,ne,te;if(!Object.is(n.current[B],H)){if(n.current[B]=H,B==="search")T(),A(),C(1,_);else if(B==="value"){if(document.activeElement.hasAttribute("cmdk-input")||document.activeElement.hasAttribute("cmdk-root")){let re=document.getElementById(k);re?re.focus():(V=document.getElementById(x))==null||V.focus()}if(C(7,()=>{var re;n.current.selectedItemId=(re=O())==null?void 0:re.id,j.emit()}),W||C(5,R),((U=l.current)==null?void 0:U.value)!==void 0){let re=H??"";(te=(ne=l.current).onValueChange)==null||te.call(ne,re);return}}j.emit()}},emit:()=>{o.current.forEach(B=>B())}}),[]),E=y.useMemo(()=>({value:(B,H,W)=>{var V;H!==((V=i.current.get(B))==null?void 0:V.value)&&(i.current.set(B,{value:H,keywords:W}),n.current.filtered.items.set(B,N(H,W)),C(2,()=>{A(),j.emit()}))},item:(B,H)=>(r.current.add(B),H&&(s.current.has(H)?s.current.get(H).add(B):s.current.set(H,new Set([B]))),C(3,()=>{T(),A(),n.current.value||_(),j.emit()}),()=>{i.current.delete(B),r.current.delete(B),n.current.filtered.items.delete(B);let W=O();C(4,()=>{T(),(W==null?void 0:W.getAttribute("id"))===B&&_(),j.emit()})}),group:B=>(s.current.has(B)||s.current.set(B,new Set),()=>{i.current.delete(B),s.current.delete(B)}),filter:()=>l.current.shouldFilter,label:c||t["aria-label"],getDisablePointerSelection:()=>l.current.disablePointerSelection,listId:x,inputId:k,labelId:w,listInnerRef:S}),[]);function N(B,H){var W,V;let U=(V=(W=l.current)==null?void 0:W.filter)!=null?V:oys;return B?U(B,n.current.search,H):0}function A(){if(!n.current.search||l.current.shouldFilter===!1)return;let B=n.current.filtered.items,H=[];n.current.filtered.groups.forEach(V=>{let U=s.current.get(V),ne=0;U.forEach(te=>{let re=B.get(te);ne=Math.max(re,ne)}),H.push([V,ne])});let W=S.current;F().sort((V,U)=>{var ne,te;let re=V.getAttribute("id"),fe=U.getAttribute("id");return((ne=B.get(fe))!=null?ne:0)-((te=B.get(re))!=null?te:0)}).forEach(V=>{let U=V.closest(Fhe);U?U.appendChild(V.parentElement===U?V:V.closest(`${Fhe} > *`)):W.appendChild(V.parentElement===W?V:V.closest(`${Fhe} > *`))}),H.sort((V,U)=>U[1]-V[1]).forEach(V=>{var U;let ne=(U=S.current)==null?void 0:U.querySelector(`${i4}[${B_}="${encodeURIComponent(V[0])}"]`);ne==null||ne.parentElement.appendChild(ne)})}function _(){let B=F().find(W=>W.getAttribute("aria-disabled")!=="true"),H=B==null?void 0:B.getAttribute(B_);j.setState("value",H||void 0)}function T(){var B,H,W,V;if(!n.current.search||l.current.shouldFilter===!1){n.current.filtered.count=r.current.size;return}n.current.filtered.groups=new Set;let U=0;for(let ne of r.current){let te=(H=(B=i.current.get(ne))==null?void 0:B.value)!=null?H:"",re=(V=(W=i.current.get(ne))==null?void 0:W.keywords)!=null?V:[],fe=N(te,re);n.current.filtered.items.set(ne,fe),fe>0&&U++}for(let[ne,te]of s.current)for(let re of te)if(n.current.filtered.items.get(re)>0){n.current.filtered.groups.add(ne);break}n.current.filtered.count=U}function R(){var B,H,W;let V=O();V&&(((B=V.parentElement)==null?void 0:B.firstChild)===V&&((W=(H=V.closest(i4))==null?void 0:H.querySelector(ays))==null||W.scrollIntoView({block:"nearest"})),V.scrollIntoView({block:"nearest"}))}function O(){var B;return(B=S.current)==null?void 0:B.querySelector(`${NOt}[aria-selected="true"]`)}function F(){var B;return Array.from(((B=S.current)==null?void 0:B.querySelectorAll(PXe))||[])}function D(B){let H=F()[B];H&&j.setState("value",H.getAttribute(B_))}function I(B){var H;let W=O(),V=F(),U=V.findIndex(te=>te===W),ne=V[U+B];(H=l.current)!=null&&H.loop&&(ne=U+B<0?V[V.length-1]:U+B===V.length?V[0]:V[U+B]),ne&&j.setState("value",ne.getAttribute(B_))}function P(B){let H=O(),W=H==null?void 0:H.closest(i4),V;for(;W&&!V;)W=B>0?gys(W,i4):vys(W,i4),V=W==null?void 0:W.querySelector(PXe);V?j.setState("value",V.getAttribute(B_)):I(B)}let M=()=>D(F().length-1),z=B=>{B.preventDefault(),B.metaKey?M():B.altKey?P(1):I(1)},G=B=>{B.preventDefault(),B.metaKey?D(0):B.altKey?P(-1):I(-1)};return y.createElement(Sn.div,{ref:e,tabIndex:-1,...b,"cmdk-root":"",onKeyDown:B=>{var H;(H=b.onKeyDown)==null||H.call(b,B);let W=B.nativeEvent.isComposing||B.keyCode===229;if(!(B.defaultPrevented||W))switch(B.key){case"n":case"j":{v&&B.ctrlKey&&z(B);break}case"ArrowDown":{z(B);break}case"p":case"k":{v&&B.ctrlKey&&G(B);break}case"ArrowUp":{G(B);break}case"Home":{B.preventDefault(),D(0);break}case"End":{B.preventDefault(),M();break}case"Enter":{B.preventDefault();let V=O();if(V){let U=new Event(rke);V.dispatchEvent(U)}}}}},y.createElement("label",{"cmdk-label":"",htmlFor:E.inputId,id:E.labelId,style:xys},c),wae(t,B=>y.createElement(_Ot.Provider,{value:j},y.createElement(TOt.Provider,{value:E},B))))}),lys=y.forwardRef((t,e)=>{var n,r;let s=el(),i=y.useRef(null),o=y.useContext(AOt),l=O9(),c=ROt(t),d=(r=(n=c.current)==null?void 0:n.forceMount)!=null?r:o==null?void 0:o.forceMount;bE(()=>{if(!d)return l.item(s,o==null?void 0:o.id)},[d]);let u=IOt(s,i,[t.value,t.children,i],t.keywords),h=HIe(),m=Zk(C=>C.value&&C.value===u.current),f=Zk(C=>d||l.filter()===!1?!0:C.search?C.filtered.items.get(s)>0:!0);y.useEffect(()=>{let C=i.current;if(!(!C||t.disabled))return C.addEventListener(rke,p),()=>C.removeEventListener(rke,p)},[f,t.onSelect,t.disabled]);function p(){var C,j;g(),(j=(C=c.current).onSelect)==null||j.call(C,u.current)}function g(){h.setState("value",u.current,!0)}if(!f)return null;let{disabled:v,value:b,onSelect:x,forceMount:w,keywords:k,...S}=t;return y.createElement(Sn.div,{ref:Gx(i,e),...S,id:s,"cmdk-item":"",role:"option","aria-disabled":!!v,"aria-selected":!!m,"data-disabled":!!v,"data-selected":!!m,onPointerMove:v||l.getDisablePointerSelection()?void 0:g,onClick:v?void 0:p},t.children)}),cys=y.forwardRef((t,e)=>{let{heading:n,children:r,forceMount:s,...i}=t,o=el(),l=y.useRef(null),c=y.useRef(null),d=el(),u=O9(),h=Zk(f=>s||u.filter()===!1?!0:f.search?f.filtered.groups.has(o):!0);bE(()=>u.group(o),[]),IOt(o,l,[t.value,t.heading,c]);let m=y.useMemo(()=>({id:o,forceMount:s}),[s]);return y.createElement(Sn.div,{ref:Gx(l,e),...i,"cmdk-group":"",role:"presentation",hidden:h?void 0:!0},n&&y.createElement("div",{ref:c,"cmdk-group-heading":"","aria-hidden":!0,id:d},n),wae(t,f=>y.createElement("div",{"cmdk-group-items":"",role:"group","aria-labelledby":n?d:void 0},y.createElement(AOt.Provider,{value:m},f))))}),dys=y.forwardRef((t,e)=>{let{alwaysRender:n,...r}=t,s=y.useRef(null),i=Zk(o=>!o.search);return!n&&!i?null:y.createElement(Sn.div,{ref:Gx(s,e),...r,"cmdk-separator":"",role:"separator"})}),uys=y.forwardRef((t,e)=>{let{onValueChange:n,...r}=t,s=t.value!=null,i=HIe(),o=Zk(d=>d.search),l=Zk(d=>d.selectedItemId),c=O9();return y.useEffect(()=>{t.value!=null&&i.setState("search",t.value)},[t.value]),y.createElement(Sn.input,{ref:e,...r,"cmdk-input":"",autoComplete:"off",autoCorrect:"off",spellCheck:!1,"aria-autocomplete":"list",role:"combobox","aria-expanded":!0,"aria-controls":c.listId,"aria-labelledby":c.labelId,"aria-activedescendant":l,id:c.inputId,type:"text",value:s?t.value:o,onChange:d=>{s||i.setState("search",d.target.value),n==null||n(d.target.value)}})}),hys=y.forwardRef((t,e)=>{let{children:n,label:r="Suggestions",...s}=t,i=y.useRef(null),o=y.useRef(null),l=Zk(d=>d.selectedItemId),c=O9();return y.useEffect(()=>{if(o.current&&i.current){let d=o.current,u=i.current,h,m=new ResizeObserver(()=>{h=requestAnimationFrame(()=>{let f=d.offsetHeight;u.style.setProperty("--cmdk-list-height",f.toFixed(1)+"px")})});return m.observe(d),()=>{cancelAnimationFrame(h),m.unobserve(d)}}},[]),y.createElement(Sn.div,{ref:Gx(i,e),...s,"cmdk-list":"",role:"listbox",tabIndex:-1,"aria-activedescendant":l,"aria-label":r,id:c.listId},wae(t,d=>y.createElement("div",{ref:Gx(o,c.listInnerRef),"cmdk-list-sizer":""},d)))}),mys=y.forwardRef((t,e)=>{let{open:n,onOpenChange:r,overlayClassName:s,contentClassName:i,container:o,...l}=t;return y.createElement(ote,{open:n,onOpenChange:r},y.createElement(lte,{container:o},y.createElement(xI,{"cmdk-overlay":"",className:s}),y.createElement(wI,{"aria-label":t.label,"cmdk-dialog":"",className:i},y.createElement(POt,{ref:e,...l}))))}),fys=y.forwardRef((t,e)=>Zk(n=>n.filtered.count===0)?y.createElement(Sn.div,{ref:e,...t,"cmdk-empty":"",role:"presentation"}):null),pys=y.forwardRef((t,e)=>{let{progress:n,children:r,label:s="Loading...",...i}=t;return y.createElement(Sn.div,{ref:e,...i,"cmdk-loading":"",role:"progressbar","aria-valuenow":n,"aria-valuemin":0,"aria-valuemax":100,"aria-label":s},wae(t,o=>y.createElement("div",{"aria-hidden":!0},o)))}),Rh=Object.assign(POt,{List:hys,Item:lys,Input:uys,Group:cys,Separator:dys,Dialog:mys,Empty:fys,Loading:pys});function gys(t,e){let n=t.nextElementSibling;for(;n;){if(n.matches(e))return n;n=n.nextElementSibling}}function vys(t,e){let n=t.previousElementSibling;for(;n;){if(n.matches(e))return n;n=n.previousElementSibling}}function ROt(t){let e=y.useRef(t);return bE(()=>{e.current=t}),e}var bE=typeof window>"u"?y.useEffect:y.useLayoutEffect;function U_(t){let e=y.useRef();return e.current===void 0&&(e.current=t()),e}function Zk(t){let e=HIe(),n=()=>t(e.snapshot());return y.useSyncExternalStore(e.subscribe,n,n)}function IOt(t,e,n,r=[]){let s=y.useRef(),i=O9();return bE(()=>{var o;let l=(()=>{var d;for(let u of n){if(typeof u=="string")return u.trim();if(typeof u=="object"&&"current"in u)return u.current?(d=u.current.textContent)==null?void 0:d.trim():s.current}})(),c=r.map(d=>d.trim());i.value(t,l,c),(o=e.current)==null||o.setAttribute(B_,l),s.current=l}),s}var yys=()=>{let[t,e]=y.useState(),n=U_(()=>new Map);return bE(()=>{n.current.forEach(r=>r()),n.current=new Map},[t]),(r,s)=>{n.current.set(r,s),e({})}};function bys(t){let e=t.type;return typeof e=="function"?e(t.props):"render"in e?e.render(t.props):t}function wae({asChild:t,children:e},n){return t&&y.isValidElement(e)?y.cloneElement(bys(e),{ref:e.ref},n(e.props.children)):n(e)}var xys={position:"absolute",width:"1px",height:"1px",padding:"0",margin:"-1px",overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0"};const MOt=y.forwardRef(({className:t,...e},n)=>a.jsx(Rh,{ref:n,className:ee("flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",t),...e}));MOt.displayName=Rh.displayName;const LOt=y.forwardRef(({className:t,...e},n)=>a.jsxs("div",{className:"flex items-center border-b px-3","cmdk-input-wrapper":"",children:[a.jsx(hs,{className:"mr-2 h-4 w-4 shrink-0 opacity-50"}),a.jsx(Rh.Input,{ref:n,className:ee("flex h-11 w-full rounded-md bg-transparent py-3 text-sm outline-none placeholder:text-muted-foreground disabled:cursor-not-allowed disabled:opacity-50",t),...e})]}));LOt.displayName=Rh.Input.displayName;const DOt=y.forwardRef(({className:t,...e},n)=>a.jsx(Rh.List,{ref:n,className:ee("max-h-[300px] overflow-y-auto overflow-x-hidden",t),...e}));DOt.displayName=Rh.List.displayName;const $Ot=y.forwardRef((t,e)=>a.jsx(Rh.Empty,{ref:e,className:"py-6 text-center text-sm",...t}));$Ot.displayName=Rh.Empty.displayName;const wys=y.forwardRef(({className:t,...e},n)=>a.jsx(Rh.Group,{ref:n,className:ee("overflow-hidden p-1 text-foreground [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground",t),...e}));wys.displayName=Rh.Group.displayName;const kys=y.forwardRef(({className:t,...e},n)=>a.jsx(Rh.Separator,{ref:n,className:ee("-mx-1 h-px bg-border",t),...e}));kys.displayName=Rh.Separator.displayName;const OOt=y.forwardRef(({className:t,...e},n)=>a.jsx(Rh.Item,{ref:n,className:ee("relative flex cursor-default select-none items-center rounded-sm px-2 py-1.5 text-sm outline-none data-[disabled=true]:pointer-events-none data-[selected='true']:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:opacity-50",t),...e}));OOt.displayName=Rh.Item.displayName;const Sys=[["AF","Afghanistan","+93"],["AX","Åland Islands","+358"],["AL","Albania","+355"],["DZ","Algeria","+213"],["AS","American Samoa","+1"],["AD","Andorra","+376"],["AO","Angola","+244"],["AI","Anguilla","+1"],["AG","Antigua and Barbuda","+1"],["AR","Argentina","+54"],["AM","Armenia","+374"],["AW","Aruba","+297"],["AU","Australia","+61"],["AT","Austria","+43"],["AZ","Azerbaijan","+994"],["BS","Bahamas","+1"],["BH","Bahrain","+973"],["BD","Bangladesh","+880"],["BB","Barbados","+1"],["BY","Belarus","+375"],["BE","Belgium","+32"],["BZ","Belize","+501"],["BJ","Benin","+229"],["BM","Bermuda","+1"],["BT","Bhutan","+975"],["BO","Bolivia","+591"],["BQ","Caribbean Netherlands","+599"],["BA","Bosnia and Herzegovina","+387"],["BW","Botswana","+267"],["BR","Brazil","+55"],["IO","British Indian Ocean Territory","+246"],["VG","British Virgin Islands","+1"],["BN","Brunei","+673"],["BG","Bulgaria","+359"],["BF","Burkina Faso","+226"],["BI","Burundi","+257"],["CV","Cabo Verde","+238"],["KH","Cambodia","+855"],["CM","Cameroon","+237"],["CA","Canada","+1"],["KY","Cayman Islands","+1"],["CF","Central African Republic","+236"],["TD","Chad","+235"],["CL","Chile","+56"],["CN","China","+86"],["CX","Christmas Island","+61"],["CC","Cocos (Keeling) Islands","+61"],["CO","Colombia","+57"],["KM","Comoros","+269"],["CG","Congo","+242"],["CD","Congo (DRC)","+243"],["CK","Cook Islands","+682"],["CR","Costa Rica","+506"],["CI","Côte d’Ivoire","+225"],["HR","Croatia","+385"],["CU","Cuba","+53"],["CW","Curaçao","+599"],["CY","Cyprus","+357"],["CZ","Czechia","+420"],["DK","Denmark","+45"],["DJ","Djibouti","+253"],["DM","Dominica","+1"],["DO","Dominican Republic","+1"],["EC","Ecuador","+593"],["EG","Egypt","+20"],["SV","El Salvador","+503"],["GQ","Equatorial Guinea","+240"],["ER","Eritrea","+291"],["EE","Estonia","+372"],["SZ","Eswatini","+268"],["ET","Ethiopia","+251"],["FK","Falkland Islands","+500"],["FO","Faroe Islands","+298"],["FJ","Fiji","+679"],["FI","Finland","+358"],["FR","France","+33"],["GF","French Guiana","+594"],["PF","French Polynesia","+689"],["GA","Gabon","+241"],["GM","Gambia","+220"],["GE","Georgia","+995"],["DE","Germany","+49"],["GH","Ghana","+233"],["GI","Gibraltar","+350"],["GR","Greece","+30"],["GL","Greenland","+299"],["GD","Grenada","+1"],["GP","Guadeloupe","+590"],["GU","Guam","+1"],["GT","Guatemala","+502"],["GG","Guernsey","+44"],["GN","Guinea","+224"],["GW","Guinea-Bissau","+245"],["GY","Guyana","+592"],["HT","Haiti","+509"],["HN","Honduras","+504"],["HK","Hong Kong","+852"],["HU","Hungary","+36"],["IS","Iceland","+354"],["IN","India","+91"],["ID","Indonesia","+62"],["IR","Iran","+98"],["IQ","Iraq","+964"],["IE","Ireland","+353"],["IM","Isle of Man","+44"],["IL","Israel","+972"],["IT","Italy","+39"],["JM","Jamaica","+1"],["JP","Japan","+81"],["JE","Jersey","+44"],["JO","Jordan","+962"],["KZ","Kazakhstan","+7"],["KE","Kenya","+254"],["KI","Kiribati","+686"],["XK","Kosovo","+383"],["KW","Kuwait","+965"],["KG","Kyrgyzstan","+996"],["LA","Laos","+856"],["LV","Latvia","+371"],["LB","Lebanon","+961"],["LS","Lesotho","+266"],["LR","Liberia","+231"],["LY","Libya","+218"],["LI","Liechtenstein","+423"],["LT","Lithuania","+370"],["LU","Luxembourg","+352"],["MO","Macao","+853"],["MG","Madagascar","+261"],["MW","Malawi","+265"],["MY","Malaysia","+60"],["MV","Maldives","+960"],["ML","Mali","+223"],["MT","Malta","+356"],["MH","Marshall Islands","+692"],["MQ","Martinique","+596"],["MR","Mauritania","+222"],["MU","Mauritius","+230"],["YT","Mayotte","+262"],["MX","Mexico","+52"],["FM","Micronesia","+691"],["MD","Moldova","+373"],["MC","Monaco","+377"],["MN","Mongolia","+976"],["ME","Montenegro","+382"],["MS","Montserrat","+1"],["MA","Morocco","+212"],["MZ","Mozambique","+258"],["MM","Myanmar","+95"],["NA","Namibia","+264"],["NR","Nauru","+674"],["NP","Nepal","+977"],["NL","Netherlands","+31"],["NC","New Caledonia","+687"],["NZ","New Zealand","+64"],["NI","Nicaragua","+505"],["NE","Niger","+227"],["NG","Nigeria","+234"],["NU","Niue","+683"],["NF","Norfolk Island","+672"],["KP","North Korea","+850"],["MK","North Macedonia","+389"],["MP","Northern Mariana Islands","+1"],["NO","Norway","+47"],["OM","Oman","+968"],["PK","Pakistan","+92"],["PW","Palau","+680"],["PS","Palestine","+970"],["PA","Panama","+507"],["PG","Papua New Guinea","+675"],["PY","Paraguay","+595"],["PE","Peru","+51"],["PH","Philippines","+63"],["PL","Poland","+48"],["PT","Portugal","+351"],["PR","Puerto Rico","+1"],["QA","Qatar","+974"],["RE","Réunion","+262"],["RO","Romania","+40"],["RU","Russia","+7"],["RW","Rwanda","+250"],["BL","Saint Barthélemy","+590"],["SH","Saint Helena","+290"],["KN","Saint Kitts and Nevis","+1"],["LC","Saint Lucia","+1"],["MF","Saint Martin","+590"],["PM","Saint Pierre and Miquelon","+508"],["VC","Saint Vincent and the Grenadines","+1"],["WS","Samoa","+685"],["SM","San Marino","+378"],["ST","São Tomé and Príncipe","+239"],["SA","Saudi Arabia","+966"],["SN","Senegal","+221"],["RS","Serbia","+381"],["SC","Seychelles","+248"],["SL","Sierra Leone","+232"],["SG","Singapore","+65"],["SX","Sint Maarten","+1"],["SK","Slovakia","+421"],["SI","Slovenia","+386"],["SB","Solomon Islands","+677"],["SO","Somalia","+252"],["ZA","South Africa","+27"],["KR","South Korea","+82"],["SS","South Sudan","+211"],["ES","Spain","+34"],["LK","Sri Lanka","+94"],["SD","Sudan","+249"],["SR","Suriname","+597"],["SJ","Svalbard and Jan Mayen","+47"],["SE","Sweden","+46"],["CH","Switzerland","+41"],["SY","Syria","+963"],["TW","Taiwan","+886"],["TJ","Tajikistan","+992"],["TZ","Tanzania","+255"],["TH","Thailand","+66"],["TL","Timor-Leste","+670"],["TG","Togo","+228"],["TK","Tokelau","+690"],["TO","Tonga","+676"],["TT","Trinidad and Tobago","+1"],["TN","Tunisia","+216"],["TR","Türkiye","+90"],["TM","Turkmenistan","+993"],["TC","Turks and Caicos Islands","+1"],["TV","Tuvalu","+688"],["UG","Uganda","+256"],["UA","Ukraine","+380"],["AE","United Arab Emirates","+971"],["GB","United Kingdom","+44"],["US","United States","+1"],["UY","Uruguay","+598"],["VI","U.S. Virgin Islands","+1"],["UZ","Uzbekistan","+998"],["VU","Vanuatu","+678"],["VA","Vatican City","+39"],["VE","Venezuela","+58"],["VN","Vietnam","+84"],["WF","Wallis and Futuna","+681"],["EH","Western Sahara","+212"],["YE","Yemen","+967"],["ZM","Zambia","+260"],["ZW","Zimbabwe","+263"]],FOt=Sys.map(([t,e,n])=>({iso:t,name:e,dialCode:n})).sort((t,e)=>t.name.localeCompare(e.name)),BOt=t=>FOt.find(e=>e.iso===t);function Cys(t){return`${t.name} ${t.iso} ${t.dialCode} ${t.dialCode.slice(1)}`}function jys({value:t,onChange:e,disabled:n,className:r}){const[s,i]=y.useState(!1),o=BOt(t);return a.jsxs(Ni,{open:s,onOpenChange:i,children:[a.jsx(Ti,{asChild:!0,children:a.jsxs("button",{type:"button",role:"combobox","aria-expanded":s,"aria-label":o?`Country code: ${o.name} ${o.dialCode}`:"Country code",disabled:n,className:ee("flex h-10 shrink-0 items-center gap-1.5 rounded-md border border-input bg-background px-3 text-sm ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-not-allowed disabled:opacity-50",r),children:[o?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"text-xs font-medium text-muted-foreground",children:o.iso}),a.jsx("span",{className:"tabular-nums",children:o.dialCode})]}):a.jsx("span",{className:"text-muted-foreground",children:"Code"}),a.jsx(li,{className:"h-3.5 w-3.5 text-muted-foreground","aria-hidden":!0})]})}),a.jsx(yi,{align:"start",className:"w-[min(18rem,calc(100vw-2rem))] p-0",children:a.jsxs(MOt,{filter:(l,c)=>l.toLowerCase().includes(c.trim().toLowerCase())?1:0,children:[a.jsx(LOt,{placeholder:"Search country or code"}),a.jsxs(DOt,{className:"max-h-64",children:[a.jsx($Ot,{children:"No country matches."}),FOt.map(l=>a.jsxs(OOt,{value:Cys(l),onSelect:()=>{e(l.iso),i(!1)},className:"gap-2",children:[a.jsx(Qn,{className:ee("h-4 w-4 shrink-0",l.iso===t?"opacity-100":"opacity-0"),"aria-hidden":!0}),a.jsx("span",{className:"min-w-0 flex-1 truncate",children:l.name}),a.jsx("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:l.dialCode})]},l.iso))]})]})})]})}async function Eys(t){await ae.post("/verify/email/send-otp",{email:t})}async function Nys(t,e){await ae.post("/verify/email/verify-otp",{email:t,otp:e})}async function Tys(t,e){await ae.post("/verify/mobile/send-otp",{countryCode:t,mobile:e})}async function _ys(t,e){await ae.post("/verify/mobile/verify-otp",{mobile:t,otp:e})}function UOt(){const{applyPensilSessionUser:t}=jr();return async()=>{const e=await nd.refreshSession();t(e.user)}}function zOt({onVerified:t}){const[e,n]=y.useState(""),[r,s]=y.useState(""),[i,o]=y.useState(!1),[l,c]=y.useState(!1),d=UOt(),u=async()=>{c(!0);try{await Eys(e.trim()),o(!0),He.success("Verification code sent to "+e.trim())}catch(m){He.error(Dt(m,"Could not send the code."))}finally{c(!1)}},h=async()=>{c(!0);try{await Nys(e.trim(),r.trim()),await d(),He.success("Email verified!"),t==null||t()}catch(m){He.error(Dt(m,"Could not verify the code."))}finally{c(!1)}};return a.jsxs("div",{className:"space-y-3 rounded-xl border border-border bg-card p-5 shadow-sm",children:[a.jsxs("div",{className:"flex items-center gap-2 font-semibold text-foreground",children:[a.jsx(gO,{className:"h-4 w-4 text-primary"})," Email"]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"gate-verify-email",children:"Email address"}),a.jsx(Oe,{id:"gate-verify-email",type:"email",value:e,disabled:i||l,onChange:m=>n(m.target.value),placeholder:"you@example.com"})]}),i&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"gate-verify-email-otp",children:"Verification code"}),a.jsx(Oe,{id:"gate-verify-email-otp",inputMode:"numeric",value:r,disabled:l,onChange:m=>s(m.target.value),placeholder:"Enter the code"})]}),a.jsx("div",{className:"flex gap-2",children:i?a.jsxs(a.Fragment,{children:[a.jsx(Z,{onClick:h,disabled:l||!r.trim(),children:l?"Verifying…":"Verify"}),a.jsx(Z,{variant:"ghost",disabled:l,onClick:()=>o(!1),children:"Change email"})]}):a.jsx(Z,{onClick:u,disabled:l||!e.trim(),children:l?"Sending…":"Send code"})})]})}function VOt({onVerified:t}){var g;const[e,n]=y.useState("IN"),r=((g=BOt(e))==null?void 0:g.dialCode)??"+91",[s,i]=y.useState(""),[o,l]=y.useState(""),[c,d]=y.useState(!1),[u,h]=y.useState(!1),m=UOt(),f=async()=>{h(!0);try{await Tys(r,s.trim()),d(!0),He.success("Verification code sent via SMS")}catch(v){He.error(Dt(v,"Could not send the code."))}finally{h(!1)}},p=async()=>{h(!0);try{await _ys(s.trim(),o.trim()),await m(),He.success("Mobile verified!"),t==null||t()}catch(v){He.error(Dt(v,"Could not verify the code."))}finally{h(!1)}};return a.jsxs("div",{className:"space-y-3 rounded-xl border border-border bg-card p-5 shadow-sm",children:[a.jsxs("div",{className:"flex items-center gap-2 font-semibold text-foreground",children:[a.jsx(ost,{className:"h-4 w-4 text-primary"})," Mobile"]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"gate-verify-mobile",children:"Mobile number"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(jys,{value:e,onChange:n,disabled:c||u}),a.jsx(Oe,{id:"gate-verify-mobile",inputMode:"tel",value:s,disabled:c||u,onChange:v=>i(v.target.value),placeholder:"Mobile number"})]})]}),c&&a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"gate-verify-mobile-otp",children:"Verification code"}),a.jsx(Oe,{id:"gate-verify-mobile-otp",inputMode:"numeric",value:o,disabled:u,onChange:v=>l(v.target.value),placeholder:"Enter the code"})]}),a.jsx("div",{className:"flex gap-2",children:c?a.jsxs(a.Fragment,{children:[a.jsx(Z,{onClick:p,disabled:u||!o.trim(),children:u?"Verifying…":"Verify"}),a.jsx(Z,{variant:"ghost",disabled:u,onClick:()=>d(!1),children:"Change number"})]}):a.jsx(Z,{onClick:f,disabled:u||!s.trim(),children:u?"Sending…":"Send code"})})]})}function Ays(){var i,o;const{user:t}=jr(),e=(t==null?void 0:t.email)??"",n=!!e,r=(i=t==null?void 0:t.mobile)==null?void 0:i.trim(),s=(o=t==null?void 0:t.countryCode)==null?void 0:o.trim();return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{className:"rounded-lg border border-border bg-card overflow-hidden",children:[a.jsxs("div",{className:"flex items-center gap-2 px-6 py-4 border-b border-border",children:[a.jsx(Sk,{className:"h-5 w-5 text-primary"}),a.jsx("h2",{className:"text-base font-semibold text-foreground",children:"Account verification"})]}),a.jsxs("div",{className:"p-6 space-y-6",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Email"}),a.jsxs("div",{className:"flex items-center justify-between rounded-md border border-border bg-background px-3 py-2",children:[a.jsx("span",{className:"text-sm text-foreground",children:e||"—"}),a.jsx("span",{className:`text-xs font-medium ${n?"text-green-600":"text-destructive"}`,children:n?"Verified":"Unverified"})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{children:"Mobile"}),r?a.jsxs("div",{className:"flex items-center justify-between rounded-md border border-border bg-background px-3 py-2",children:[a.jsxs("span",{className:"text-sm text-foreground",children:[s?`${s} `:"",r]}),a.jsx("span",{className:"text-xs font-medium text-green-600",children:"Verified"})]}):a.jsx("p",{className:"text-sm text-muted-foreground",children:"No mobile number on file."})]})]})]}),a.jsxs("div",{children:[a.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-1",children:[e?"Change":"Add"," verified email"]}),a.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"We'll send a one-time code to the new address; verifying it replaces your current email."}),a.jsx(zOt,{})]}),a.jsxs("div",{children:[a.jsxs("h3",{className:"text-sm font-semibold text-foreground mb-1",children:[r?"Change":"Add"," verified mobile"]}),a.jsx("p",{className:"text-xs text-muted-foreground mb-3",children:"We'll text a one-time code to the new number; verifying it replaces your current mobile."}),a.jsx(VOt,{})]})]})}const Pys=jar,HOt=y.createContext({}),qT=({...t})=>a.jsx(HOt.Provider,{value:{name:t.name},children:a.jsx(_ar,{...t})}),kae=()=>{const t=y.useContext(HOt),e=y.useContext(GOt),{getFieldState:n,formState:r}=Yre(),s=n(t.name,r);if(!t)throw new Error("useFormField should be used within <FormField>");const{id:i}=e;return{id:i,name:t.name,formItemId:`${i}-form-item`,formDescriptionId:`${i}-form-item-description`,formMessageId:`${i}-form-item-message`,...s}},GOt=y.createContext({}),KC=y.forwardRef(({className:t,...e},n)=>{const r=y.useId();return a.jsx(GOt.Provider,{value:{id:r},children:a.jsx("div",{ref:n,className:ee("space-y-2",t),...e})})});KC.displayName="FormItem";const YC=y.forwardRef(({className:t,...e},n)=>{const{error:r,formItemId:s}=kae();return a.jsx(_e,{ref:n,className:ee(r&&"text-destructive",t),htmlFor:s,...e})});YC.displayName="FormLabel";const QC=y.forwardRef(({...t},e)=>{const{error:n,formItemId:r,formDescriptionId:s,formMessageId:i}=kae();return a.jsx(TSe,{ref:e,id:r,"aria-describedby":n?`${s} ${i}`:`${s}`,"aria-invalid":!!n,...t})});QC.displayName="FormControl";const Rys=y.forwardRef(({className:t,...e},n)=>{const{formDescriptionId:r}=kae();return a.jsx("p",{ref:n,id:r,className:ee("text-sm text-muted-foreground",t),...e})});Rys.displayName="FormDescription";const ZC=y.forwardRef(({className:t,children:e,...n},r)=>{const{error:s,formMessageId:i}=kae(),o=s?String(s==null?void 0:s.message):e;return o?a.jsx("p",{ref:r,id:i,className:ee("text-sm font-medium text-destructive",t),...n,children:o}):null});ZC.displayName="FormMessage";const RXe=["Asia/Kolkata","Europe/London","Europe/Paris","Europe/Berlin","Europe/Madrid","Europe/Rome","America/New_York","UTC"],Bhe=(()=>{try{return[...new Set([...Intl.supportedValuesOf("timeZone"),"UTC",...RXe])].sort()}catch{return RXe}})(),Iys=["EN","FR","DE","ES","IT"].map(t=>({label:t,value:t})),Mys=NM({name:wl().trim().min(2,"Name must be at least 2 characters."),address:wl().trim().regex(/^[A-Za-z0-9-]{3,63}$/,"3–63 letters, numbers, or hyphens"),timezone:wl().min(1),language:wl().min(1),privacyPolicyLink:wl().url("Enter a valid URL.").or(lVe("")),termsAndConditionsLink:wl().url("Enter a valid URL.").or(lVe(""))});function kp(t){return typeof t=="string"?t:""}const Fq={file:null,preview:null,removed:!1};function Uhe(t,e){return t.removed?e?t:Fq:t.file?t:{file:null,preview:e||null,removed:!1}}function zhe(t,e){return t.removed?{file:null,preview:e||null,removed:!e}:{file:null,preview:e||t.preview,removed:!1}}function IXe(t,e){return t instanceof ze&&t.status===403?"Only community admins can change this.":dn(t,e)}function MXe({title:t,children:e,defaultOpen:n=!0}){const[r,s]=y.useState(n);return a.jsxs("div",{className:"border-b border-border pb-6 mb-6 last:border-b-0 last:mb-0",children:[a.jsxs("button",{type:"button",onClick:()=>s(i=>!i),className:"flex items-center gap-2 text-base font-semibold text-foreground mb-4",children:[t,a.jsx(li,{className:ee("h-4 w-4 transition-transform",r&&"rotate-180")})]}),r&&a.jsx("div",{className:"space-y-5",children:e})]})}function Vhe({label:t,preview:e,onPick:n,onClear:r}){const s=y.useRef(null),[i,o]=y.useState(null),l=!!e&&i===e;return a.jsxs("div",{className:"relative",children:[a.jsx("button",{type:"button",onClick:()=>{var c;return(c=s.current)==null?void 0:c.click()},className:"w-32 h-32 rounded-lg border-2 border-dashed border-border bg-muted/30 hover:bg-muted/50 transition flex flex-col items-center justify-center text-xs text-muted-foreground text-center px-2 overflow-hidden",children:e&&!l?a.jsx("img",{src:e,alt:t,className:"w-full h-full object-contain",onError:()=>o(e)}):a.jsxs(a.Fragment,{children:[a.jsx(Dn,{className:"h-5 w-5 mb-1"}),a.jsx("span",{children:t}),l&&a.jsx("span",{className:"mt-1 text-[10px] text-destructive",children:"Couldn't load current image"})]})}),e&&a.jsx("button",{type:"button",onClick:()=>{s.current&&(s.current.value=""),r()},className:"absolute -top-2 -right-2 bg-background border border-border rounded-full p-1 shadow",children:a.jsx(nn,{className:"h-3 w-3"})}),a.jsx("input",{ref:s,type:"file",accept:"image/*",className:"hidden",onChange:c=>{var h;const d=(h=c.target.files)==null?void 0:h[0];if(!d)return;const u=new FileReader;u.onload=()=>n(d,u.result),u.readAsDataURL(d)}})]})}function Lys(){const{community:t,setCommunity:e}=qe(),{communityDetail:n,refetchCommunityDetail:r}=Ln(),s=(t==null?void 0:t.id)??null,[i,o]=y.useState(!1),[l,c]=y.useState(Fq),[d,u]=y.useState(Fq),[h,m]=y.useState(Fq),f=jM({resolver:EM(Mys),defaultValues:{name:"",address:"",timezone:"Asia/Kolkata",language:"EN",privacyPolicyLink:"",termsAndConditionsLink:""}}),p=y.useRef("EN"),[g,v]=y.useState(Iys),b=y.useMemo(()=>{const w=n;return{name:kp(w==null?void 0:w.name),address:kp(w==null?void 0:w.address),timezone:kp(w==null?void 0:w.timezone)||"Asia/Kolkata",privacyPolicyLink:kp(w==null?void 0:w.privacyPolicyLink),termsAndConditionsLink:kp(w==null?void 0:w.termsAndConditionsLink),logo:kp(w==null?void 0:w.logo),darkModeLogo:kp(w==null?void 0:w.darkModeLogo),favicon:kp(w==null?void 0:w.favicon)}},[n]);y.useEffect(()=>{let w=!1;async function k(){var C,j;let S="EN";if(s)try{const E=await qj(s,dge),N=(C=E.configurable)==null?void 0:C.configurableValue;typeof N=="string"&&N&&(S=N);const A=(j=E.configurable)==null?void 0:j.configurableOptions;if(Array.isArray(A)&&A.length>0){const _=new Set,T=A.filter(R=>!R||typeof R.value!="string"||_.has(R.value)?!1:(_.add(R.value),!0));T.length>0&&v(T)}}catch{}w||!n||(p.current=S,f.reset({name:b.name,address:b.address,timezone:b.timezone,language:S,privacyPolicyLink:b.privacyPolicyLink,termsAndConditionsLink:b.termsAndConditionsLink}),c(E=>Uhe(E,b.logo)),u(E=>Uhe(E,b.darkModeLogo)),m(E=>Uhe(E,b.favicon)))}return k(),()=>{w=!0}},[s,n]);const x=async w=>{if(!(!s||i)){o(!0);try{let k=(await Yct(s,{name:w.name.trim(),address:w.address.trim(),timezone:w.timezone,privacyPolicyLink:w.privacyPolicyLink||void 0,termsAndConditionsLink:w.termsAndConditionsLink||void 0})).community;if(l.file?k=(await cge(s,l.file,"light")).community:l.removed&&(k=(await TDe(s,"light")).community),d.file?k=(await cge(s,d.file,"dark")).community:d.removed&&(k=(await TDe(s,"dark")).community),h.file?k=(await ynn(s,h.file)).community:h.removed&&(k=(await bnn(s)).community),w.language&&w.language!==p.current)try{await D2(s,dge,w.language),p.current=w.language}catch(E){He.error(IXe(E,"Saved, but language could not be updated"))}e(k),r();const S=k;c(zhe(l,kp(S.logo))),u(zhe(d,kp(S.darkModeLogo))),m(zhe(h,kp(S.favicon))),He.success("Basic info saved");const C=b.address,j=k==null?void 0:k.address;if(j&&C&&j!==C&&window.location.hostname.startsWith(`${C}.`)){const E=window.location.host.replace(`${C}.`,`${j}.`);window.location.assign(`${window.location.protocol}//${E}`);return}}catch(k){He.error(IXe(k,"Failed to save"))}finally{o(!1)}}};return a.jsx(Pys,{...f,children:a.jsxs("form",{onSubmit:f.handleSubmit(x),className:"rounded-lg border border-border bg-card p-6",children:[a.jsx("h1",{className:"text-xl font-semibold text-foreground mb-6",children:"Basic info"}),a.jsxs(MXe,{title:"Community info",children:[a.jsxs("div",{children:[a.jsx(_e,{className:"text-sm font-medium mb-2 block",children:"Community Logo"}),a.jsxs("div",{className:"flex flex-wrap gap-4 items-start lg:flex-nowrap",children:[a.jsx(Vhe,{label:"Select light mode logo",preview:l.preview,onPick:(w,k)=>c({file:w,preview:k,removed:!1}),onClear:()=>c({file:null,preview:null,removed:!0})}),a.jsx(Vhe,{label:"Select dark mode logo",preview:d.preview,onPick:(w,k)=>u({file:w,preview:k,removed:!1}),onClear:()=>u({file:null,preview:null,removed:!0})}),a.jsxs("p",{className:"text-xs text-muted-foreground max-w-sm leading-relaxed basis-full lg:basis-auto",children:["Recommendation: use a square image to fit it perfectly in the logo area. Recommended size 200×200 px.",a.jsx("br",{}),a.jsx("br",{}),"If no logo is uploaded, the SpatialChat Communities logo is shown."]})]})]}),a.jsx(qT,{control:f.control,name:"name",render:({field:w})=>a.jsxs(KC,{children:[a.jsx(YC,{children:"Community name"}),a.jsx(QC,{children:a.jsx(Oe,{...w})}),a.jsx(ZC,{})]})}),a.jsx(qT,{control:f.control,name:"address",render:({field:w})=>a.jsxs(KC,{children:[a.jsx(YC,{children:"Community address"}),a.jsx(QC,{children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Oe,{...w}),a.jsxs("span",{className:"text-sm text-muted-foreground shrink-0",children:[".",oR]})]})}),a.jsx(ZC,{})]})}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-sm font-medium mb-2 block",children:"Favicon"}),a.jsxs("div",{className:"flex gap-4 items-start",children:[a.jsx(Vhe,{label:"Upload favicon",preview:h.preview,onPick:(w,k)=>m({file:w,preview:k,removed:!1}),onClear:()=>m({file:null,preview:null,removed:!0})}),a.jsx("p",{className:"text-xs text-muted-foreground max-w-sm leading-relaxed mt-2",children:"Members see this icon on the browser tab. Size: 32 × 32 px."})]})]}),a.jsx(qT,{control:f.control,name:"timezone",render:({field:w})=>a.jsxs(KC,{children:[a.jsx(YC,{children:"Community timezone"}),a.jsxs(zn,{value:w.value,onValueChange:w.onChange,children:[a.jsx(QC,{children:a.jsx(On,{children:a.jsx(Vn,{})})}),a.jsx(Fn,{children:(w.value&&!Bhe.includes(w.value)?[w.value,...Bhe]:Bhe).map(k=>a.jsx(pt,{value:k,children:k},k))})]}),a.jsx(ZC,{})]})}),a.jsx(qT,{control:f.control,name:"language",render:({field:w})=>a.jsxs(KC,{children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(YC,{children:"Community default language"}),a.jsx(gn,{label:"Community default language",children:"The language everyone sees menus and labels in. Anyone, admins included, can still pick a language for themselves only in their profile → Settings → Language, which changes nothing for anyone else."})]}),a.jsxs(zn,{value:w.value,onValueChange:w.onChange,children:[a.jsx(QC,{children:a.jsx(On,{children:a.jsx(Vn,{})})}),a.jsx(Fn,{children:g.map(k=>a.jsx(pt,{value:k.value,children:k.label},k.value))})]}),a.jsx(ZC,{})]})})]}),a.jsxs(MXe,{title:"Policy links on login screen",defaultOpen:!1,children:[a.jsx(qT,{control:f.control,name:"privacyPolicyLink",render:({field:w})=>a.jsxs(KC,{children:[a.jsx(YC,{children:"Privacy policy link"}),a.jsx(QC,{children:a.jsx(Oe,{placeholder:"Enter here",...w})}),a.jsx(ZC,{})]})}),a.jsx(qT,{control:f.control,name:"termsAndConditionsLink",render:({field:w})=>a.jsxs(KC,{children:[a.jsx(YC,{children:"Terms and conditions link"}),a.jsx(QC,{children:a.jsx(Oe,{placeholder:"Enter here",...w})}),a.jsx(ZC,{})]})})]}),a.jsx("div",{className:"flex justify-end pt-2",children:a.jsxs(Z,{type:"submit",disabled:i||!s,children:[i&&a.jsx(Ne,{className:"h-4 w-4 animate-spin"}),"Save changes"]})})]})})}const Dys=Object.entries(xOt),$ys={name:"",description:"",icon:"🏅",criteriaType:"karma-total",threshold:"10",isEnabled:!0};function Oys(){const{community:t}=qe(),{badges:e,isLoading:n}=WRe(),{toast:r}=yt(),s=rn(),[i,o]=y.useState(null),[l,c]=y.useState(!1),[d,u]=y.useState(null),h=()=>{s.invalidateQueries({queryKey:["badges"]}),s.invalidateQueries({queryKey:["user-badges"]})},m=v=>o({id:v.id,name:v.name,description:v.description,icon:v.icon,criteriaType:v.criteriaType,threshold:String(v.threshold),isEnabled:v.isEnabled}),f=async()=>{if(!i||!(t!=null&&t.id))return;const v=i.name.trim(),b=Number(i.threshold);if(!v){r({title:"Name is required",variant:"destructive"});return}if(!Number.isInteger(b)||b<1){r({title:"Threshold must be a whole number ≥ 1",variant:"destructive"});return}const x={name:v,description:i.description.trim(),icon:i.icon.trim()||"🏅",criteriaType:i.criteriaType,threshold:b,isEnabled:i.isEnabled};c(!0);try{i.id?await aqe(t.id,i.id,x):await r6r(t.id,x),h(),r({title:i.id?"Badge updated":"Badge created"}),o(null)}catch(w){const k=w instanceof ze&&w.status===403?"Only community admins can manage badges.":dn(w,"Failed to save badge");r({title:k,variant:"destructive"})}finally{c(!1)}},p=async v=>{if(t!=null&&t.id)try{await aqe(t.id,v.id,{isEnabled:!v.isEnabled}),h()}catch{r({title:"Couldn't update the badge",variant:"destructive"})}},g=async()=>{if(!(!d||!(t!=null&&t.id)))try{await s6r(t.id,d.id),h(),r({title:"Badge deleted"})}catch{r({title:"Couldn't delete the badge",variant:"destructive"})}finally{u(null)}};return a.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-6 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"font-semibold text-foreground flex items-center gap-2",children:[a.jsx(Bx,{className:"h-4 w-4 text-primary"})," Badges & Rewards"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Members automatically earn these badges when they meet the criteria."})]}),a.jsxs(Z,{size:"sm",onClick:()=>o({...$ys}),children:[a.jsx(Dn,{className:"h-4 w-4 mr-1"})," Add badge"]})]}),n?a.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading badges…"}):e.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No badges yet. Add one to get started."}):a.jsx("div",{className:"space-y-2",children:e.map(v=>a.jsxs("div",{className:ee("flex items-center gap-3 rounded-xl border border-border bg-card p-3",!v.isEnabled&&"opacity-60"),children:[a.jsx("span",{className:"text-2xl shrink-0",children:v.icon}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:v.name}),a.jsxs("p",{className:"text-xs text-muted-foreground truncate",children:[wOt(v.criteriaType,v.threshold),v.description?` · ${v.description}`:""]})]}),a.jsx(Hs,{checked:v.isEnabled,onCheckedChange:()=>p(v)}),a.jsx(Z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>m(v),children:a.jsx(Qs,{className:"h-3.5 w-3.5"})}),a.jsx(Z,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0 text-destructive",onClick:()=>u(v),children:a.jsx(qn,{className:"h-3.5 w-3.5"})})]},v.id))}),a.jsx(Bt,{open:i!==null,onOpenChange:v=>!v&&o(null),children:a.jsxs(Ft,{className:"sm:max-w-[440px]",children:[a.jsx(Vt,{children:a.jsx(Ut,{children:i!=null&&i.id?"Edit badge":"New badge"})}),i&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("div",{className:"w-16",children:[a.jsx(_e,{className:"text-xs",children:"Icon"}),a.jsx(Oe,{value:i.icon,onChange:v=>o({...i,icon:v.target.value}),className:"text-center text-lg",maxLength:4})]}),a.jsxs("div",{className:"flex-1",children:[a.jsx(_e,{className:"text-xs",children:"Name"}),a.jsx(Oe,{value:i.name,onChange:v=>o({...i,name:v.target.value}),placeholder:"Century Club"})]})]}),a.jsxs("div",{children:[a.jsx(_e,{className:"text-xs",children:"Description"}),a.jsx(us,{value:i.description,onChange:v=>o({...i,description:v.target.value}),placeholder:"Received 100 likes",rows:2})]}),a.jsxs("div",{className:"flex gap-3",children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(_e,{className:"text-xs",children:"Criteria"}),a.jsxs(zn,{value:i.criteriaType,onValueChange:v=>o({...i,criteriaType:v}),children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsx(Fn,{children:Dys.map(([v,b])=>a.jsx(pt,{value:v,children:b},v))})]})]}),a.jsxs("div",{className:"w-28",children:[a.jsx(_e,{className:"text-xs",children:"Threshold"}),a.jsx(Oe,{type:"number",min:1,value:i.threshold,onChange:v=>o({...i,threshold:v.target.value})})]})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Hs,{checked:i.isEnabled,onCheckedChange:v=>o({...i,isEnabled:v})}),a.jsx(_e,{className:"text-sm",children:"Enabled"})]})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"outline",onClick:()=>o(null),children:"Cancel"}),a.jsxs(Z,{onClick:f,disabled:l,children:[l&&a.jsx(Ne,{className:"h-4 w-4 mr-1 animate-spin"}),"Save"]})]})]})}),a.jsx(Kr,{open:d!==null,onOpenChange:v=>!v&&u(null),children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsxs(Ur,{children:["Delete “",d==null?void 0:d.name,"”?"]}),a.jsx(zr,{children:"This removes the badge and revokes it from everyone who earned it. This can't be undone."})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:"Cancel"}),a.jsx(Yr,{onClick:g,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}const Fys=["course","coupon_external","coupon_internal","event_ticket","merchandise","custom"],LXe={course:"Course (auto-unlock)",coupon_external:"External coupon (code pool)",coupon_internal:"Internal coupon (generated)",event_ticket:"Event ticket",merchandise:"Merchandise (manual)",custom:"Custom / experience (manual)"},DXe={active:"bg-success/15 text-success border-success/30",draft:"bg-muted text-muted-foreground border-border",archived:"bg-muted text-muted-foreground border-border",pending:"bg-warning/15 text-warning-foreground border-warning/30",approved:"bg-primary/10 text-primary border-primary/20",fulfilled:"bg-success/15 text-success border-success/30",rejected:"bg-destructive/10 text-destructive border-destructive/30",refunded:"bg-muted text-muted-foreground border-border"},Bys={title:"",description:"",image:"",category:"experiences",cost:"1000",type:"custom",stock:"",perUserLimit:"",status:"active",codePool:"",courseId:"",discount:"",groupId:"",eventId:""};function Uys(t){const e=t.fulfillment??{};return{id:t.id,title:t.title,description:t.description??"",image:t.image??"",category:t.category??"experiences",cost:String(t.cost),type:t.type,stock:t.stock==null?"":String(t.stock),perUserLimit:t.perUserLimit==null?"":String(t.perUserLimit),status:t.status,codePool:Array.isArray(e.codePool)?e.codePool.join(`
`):"",courseId:typeof e.courseId=="string"?e.courseId:"",discount:e.discount!=null?String(e.discount):"",groupId:typeof e.groupId=="string"?e.groupId:"",eventId:typeof e.eventId=="string"?e.eventId:""}}function zys(t){const e={};return t.type==="coupon_external"?e.codePool=t.codePool.split(`
`).map(n=>n.trim()).filter(Boolean):t.type==="course"?e.courseId=t.courseId.trim():t.type==="coupon_internal"?(e.discount=Number(t.discount)||0,t.groupId.trim()&&(e.groupId=t.groupId.trim())):t.type==="event_ticket"&&t.eventId.trim()&&(e.eventId=t.eventId.trim()),{title:t.title.trim(),description:t.description.trim(),image:t.image.trim(),category:t.category.trim()||"experiences",cost:Number(t.cost)||0,type:t.type,stock:t.stock.trim()===""?null:Number(t.stock),perUserLimit:t.perUserLimit.trim()===""?null:Number(t.perUserLimit),status:t.status,fulfillment:e}}function Vys(){var W,V;const{community:t}=qe(),e=(t==null?void 0:t.id)??null,{toast:n}=yt(),[r,s]=y.useState([]),[i,o]=y.useState([]),[l,c]=y.useState(!0),[d,u]=y.useState(null),[h,m]=y.useState(!1),[f,p]=y.useState(null),[g,v]=y.useState(null),[b,x]=y.useState(null),[w,k]=y.useState(""),[S,C]=y.useState("open"),[j,E]=y.useState(null),[N,A]=y.useState(null),[_,T]=y.useState(null),[R,O]=y.useState(!1),F=y.useCallback(async()=>{if(e){c(!0);try{const[U,ne,te]=await Promise.all([rvs(e),ovs(e),Xgs(e).catch(()=>null)]);s(U),o(ne),A(te)}catch(U){n({title:U instanceof ze?U.message:"Failed to load rewards",variant:"destructive"})}finally{c(!1)}}},[e,n]);y.useEffect(()=>{F()},[F]);const D=async()=>{if(!(!d||!e)){if(!d.title.trim()||!d.cost){n({title:"Title and cost are required",variant:"destructive"});return}m(!0);try{const U=zys(d);d.id?await ivs(e,d.id,U):await svs(e,U),n({title:d.id?"Reward updated":"Reward created"}),u(null),await F()}catch(U){n({title:U instanceof ze?U.message:"Could not save reward",variant:"destructive"})}finally{m(!1)}}},I=async()=>{if(!(!f||!e))try{await avs(e,f.id),n({title:"Reward deleted"}),p(null),await F()}catch(U){n({title:U instanceof ze?U.message:"Could not delete",variant:"destructive"})}},P=async(U,ne,te={})=>{if(e){v(U.id);try{await lvs(e,U.id,ne,te),n({title:ne==="reject"?"Rejected & refunded":ne==="fulfill"?"Marked fulfilled":"Approved"}),x(null),k(""),await F()}catch(re){n({title:re instanceof ze?re.message:"Action failed",variant:"destructive"})}finally{v(null)}}},M=async U=>{if(!(!e||!d)){O(!0);try{const ne=await evs(e,U);u(te=>te&&{...te,image:ne}),n({title:"Image uploaded"})}catch(ne){n({title:"Upload failed",description:ne instanceof ze?ne.message:"Paste an image URL instead.",variant:"destructive"})}finally{O(!1)}}},z=U=>{var ne;return U.type==="coupon_external"&&Array.isArray((ne=U.fulfillment)==null?void 0:ne.codePool)?U.fulfillment.codePool.length:null},G=i.filter(U=>U.status==="pending"||U.status==="approved").length,B=i.filter(U=>S==="open"?U.status==="pending"||U.status==="approved":S==="fulfilled"?U.status==="fulfilled":S==="refunded"?U.status==="refunded"||U.status==="rejected":!0),H=[{key:"open",label:`Open${G?` (${G})`:""}`},{key:"fulfilled",label:"Fulfilled"},{key:"refunded",label:"Refunded"},{key:"all",label:"All"}];return a.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-6 space-y-5",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"font-semibold text-foreground flex items-center gap-2",children:[a.jsx(bx,{className:"h-4 w-4 text-primary"})," Rewards"]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Create rewards members can claim with points, and manage redemptions."})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Z,{variant:"outline",size:"sm",onClick:F,children:a.jsx(Nl,{className:"h-4 w-4"})}),a.jsxs(Z,{size:"sm",onClick:()=>u({...Bys}),children:[a.jsx(Dn,{className:"h-4 w-4 mr-1"})," Add reward"]})]})]}),l?a.jsx("div",{className:"flex items-center justify-center py-8 text-muted-foreground",children:a.jsx(Ne,{className:"h-5 w-5 animate-spin"})}):a.jsxs(a.Fragment,{children:[N&&a.jsxs("div",{className:"space-y-2",children:[a.jsx("div",{className:"grid grid-cols-2 sm:grid-cols-4 gap-3",children:[{label:"Redemptions",value:N.totalRedemptions},{label:"Pending",value:N.pendingCount},{label:"Points spent",value:N.pointsSpent.toLocaleString()},{label:"Rewards",value:N.rewardCount}].map(U=>a.jsxs("div",{className:"rounded-lg border border-border bg-card p-3 text-center",children:[a.jsxs("p",{className:"text-lg font-bold text-foreground flex items-center justify-center gap-1.5",children:[a.jsx(Fc,{className:"h-4 w-4 text-primary"})," ",U.value]}),a.jsx("p",{className:"text-[11px] uppercase tracking-wider text-muted-foreground",children:U.label})]},U.label))}),(N.lowStock.length>0||N.lowCodes.length>0)&&a.jsxs("div",{className:"rounded-lg border border-warning/30 bg-warning/10 px-3 py-2 text-xs text-warning-foreground flex items-start gap-2",children:[a.jsx(Bf,{className:"h-4 w-4 shrink-0 mt-0.5"}),a.jsxs("div",{children:[N.lowStock.map(U=>a.jsxs("span",{className:"mr-3",children:["⚠ ",U.title,": ",U.remaining," left"]},U.title)),N.lowCodes.map(U=>a.jsxs("span",{className:"mr-3",children:["⚠ ",U.title,": ",U.codesLeft," codes left"]},U.title))]})]}),N.topRewards.length>0&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Most claimed: ",N.topRewards.map(U=>`${U.title} (${U.count})`).join(" · ")]})]}),a.jsxs("div",{className:"space-y-2",children:[r.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground py-4 text-center",children:"No rewards yet — add your first."}),r.map(U=>a.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-card p-3",children:[a.jsxs("div",{className:"relative h-10 w-10 shrink-0 overflow-hidden rounded bg-muted",children:[a.jsx("div",{className:"absolute inset-0 flex items-center justify-center",children:a.jsx(bx,{className:"h-4 w-4 text-muted-foreground/40"})}),U.image&&a.jsx("img",{src:U.image,alt:"",loading:"lazy",className:"relative h-full w-full object-cover",onError:ne=>{ne.currentTarget.style.display="none"}})]}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:U.title}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[LXe[U.type]??U.type," · ",U.cost.toLocaleString()," pts · ",U.stock==null?"∞":`${U.remaining}/${U.stock}`," left",z(U)!=null&&a.jsxs("span",{className:ee("ml-1",z(U)<=3?"text-warning-foreground font-semibold":""),children:[" · ",z(U)," codes"]})]})]}),a.jsx("span",{className:ee("rounded-full border px-2 py-0.5 text-[11px] font-semibold capitalize",DXe[U.status]),children:U.status}),a.jsx("button",{onClick:()=>u(Uys(U)),className:"p-1.5 rounded hover:bg-muted text-muted-foreground",children:a.jsx(Qs,{className:"h-4 w-4"})}),a.jsx("button",{onClick:()=>p(U),className:"p-1.5 rounded hover:bg-muted text-destructive",children:a.jsx(qn,{className:"h-4 w-4"})})]},U.id))]}),a.jsxs("div",{className:"pt-2",children:[a.jsxs("div",{className:"flex items-center justify-between mb-2",children:[a.jsx("h4",{className:"text-sm font-semibold text-foreground",children:"Redemptions"}),a.jsx("div",{className:"flex items-center gap-1.5",children:H.map(U=>a.jsx("button",{onClick:()=>C(U.key),className:ee("rounded-full px-2.5 py-0.5 text-[11px] font-medium border transition-colors",S===U.key?"bg-primary text-primary-foreground border-primary":"border-border text-muted-foreground hover:bg-muted"),children:U.label},U.key))})]}),B.length===0?a.jsx("p",{className:"text-xs text-muted-foreground",children:S==="open"?"Nothing waiting. Manual rewards (merch, experiences) show up here when claimed.":"No redemptions in this view."}):a.jsx("div",{className:"space-y-2",children:B.map(U=>{var te;const ne=U.status==="pending"||U.status==="approved";return a.jsxs("div",{role:"button",tabIndex:0,onClick:()=>E(U),onKeyDown:re=>{re.key==="Enter"&&E(U)},className:"flex items-center gap-3 rounded-lg border border-border bg-card p-3 cursor-pointer hover:border-primary/30 hover:shadow-sm transition-all",children:[a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-foreground truncate",children:U.title}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[((te=U.user)==null?void 0:te.name)??"Member"," · ",U.pointsSpent.toLocaleString()," pts · ",new Date(U.createdAt).toLocaleDateString()]}),U.shippingAddress&&a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5 truncate",children:Object.values(U.shippingAddress).filter(Boolean).join(", ")}),U.trackingNote&&a.jsxs("p",{className:"text-xs text-success mt-0.5 truncate",children:["📦 ",U.trackingNote]})]}),a.jsx("span",{className:ee("rounded-full border px-2 py-0.5 text-[11px] font-semibold capitalize",DXe[U.status]),children:U.status}),ne&&a.jsxs("div",{className:"flex items-center gap-1",onClick:re=>re.stopPropagation(),children:[U.status==="pending"&&a.jsx("button",{disabled:g===U.id,onClick:()=>P(U,"approve"),title:"Approve",className:"p-1.5 rounded hover:bg-muted text-primary",children:a.jsx(Qn,{className:"h-4 w-4"})}),a.jsx("button",{disabled:g===U.id,onClick:()=>{x(U),k("")},title:"Mark fulfilled",className:"p-1.5 rounded hover:bg-muted text-success",children:a.jsx(cst,{className:"h-4 w-4"})}),a.jsx("button",{disabled:g===U.id,onClick:()=>T(U),title:"Reject & refund",className:"p-1.5 rounded hover:bg-muted text-destructive",children:a.jsx(nn,{className:"h-4 w-4"})})]})]},U.id)})})]})]}),a.jsx(Kr,{open:!!_,onOpenChange:U=>U?void 0:T(null),children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Reject & refund?"}),a.jsxs(zr,{children:['"',_==null?void 0:_.title,'" for ',((W=_==null?void 0:_.user)==null?void 0:W.name)??"this member"," will be rejected and their ",_==null?void 0:_.pointsSpent.toLocaleString()," points refunded."]})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:"Keep"}),a.jsx(Yr,{onClick:()=>{const U=_;T(null),U&&P(U,"reject")},children:"Reject & refund"})]})]})}),a.jsx(COt,{redemption:j,admin:!0,onClose:()=>E(null)}),a.jsx(Bt,{open:!!d,onOpenChange:U=>U?void 0:u(null),children:a.jsxs(Ft,{className:"sm:max-w-lg max-h-[85vh] overflow-y-auto",children:[a.jsx(Vt,{children:a.jsx(Ut,{children:d!=null&&d.id?"Edit reward":"New reward"})}),d&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx(_e,{children:"Title"}),a.jsx(Oe,{value:d.title,onChange:U=>u({...d,title:U.target.value})})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Description"}),a.jsx(us,{value:d.description,onChange:U=>u({...d,description:U.target.value}),rows:2})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Image"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Oe,{value:d.image,onChange:U=>u({...d,image:U.target.value}),placeholder:"Paste URL or upload →"}),a.jsxs("label",{className:"shrink-0 inline-flex items-center gap-1 rounded-lg border border-border px-3 py-2 text-xs font-medium cursor-pointer hover:bg-muted",children:[R?a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"}):a.jsx(kd,{className:"h-3.5 w-3.5"})," Upload",a.jsx("input",{type:"file",accept:"image/*",className:"hidden",disabled:R,onChange:U=>{var te;const ne=(te=U.target.files)==null?void 0:te[0];U.target.value="",ne&&M(ne)}})]})]}),d.image&&a.jsx("img",{src:d.image,alt:"",className:"mt-2 h-20 rounded-lg object-cover border border-border"})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(_e,{children:"Cost (points)"}),a.jsx(Oe,{type:"number",value:d.cost,onChange:U=>u({...d,cost:U.target.value})})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Category"}),a.jsx(Oe,{value:d.category,onChange:U=>u({...d,category:U.target.value})})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(_e,{children:"Type"}),a.jsxs(zn,{value:d.type,onValueChange:U=>u({...d,type:U}),children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsx(Fn,{children:Fys.map(U=>a.jsx(pt,{value:U,children:LXe[U]},U))})]})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Status"}),a.jsxs(zn,{value:d.status,onValueChange:U=>u({...d,status:U}),children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsx(Fn,{children:["active","draft","archived"].map(U=>a.jsx(pt,{value:U,children:U},U))})]})]})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(_e,{children:"Stock (blank = ∞)"}),a.jsx(Oe,{type:"number",value:d.stock,onChange:U=>u({...d,stock:U.target.value})})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Per-user limit"}),a.jsx(Oe,{type:"number",value:d.perUserLimit,onChange:U=>u({...d,perUserLimit:U.target.value})})]})]}),d.type==="coupon_external"&&a.jsxs("div",{children:[a.jsx(_e,{children:"Coupon codes (one per line)"}),a.jsx(us,{value:d.codePool,onChange:U=>u({...d,codePool:U.target.value}),rows:4,placeholder:`CODE-1
CODE-2`})]}),d.type==="course"&&a.jsxs("div",{children:[a.jsx(_e,{children:"Course ID to unlock"}),a.jsx(Oe,{value:d.courseId,onChange:U=>u({...d,courseId:U.target.value})})]}),d.type==="coupon_internal"&&a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{children:[a.jsx(_e,{children:"Discount"}),a.jsx(Oe,{type:"number",value:d.discount,onChange:U=>u({...d,discount:U.target.value})})]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Group ID (optional)"}),a.jsx(Oe,{value:d.groupId,onChange:U=>u({...d,groupId:U.target.value})})]})]}),d.type==="event_ticket"&&a.jsxs("div",{children:[a.jsx(_e,{children:"Event ID to register"}),a.jsx(Oe,{value:d.eventId,onChange:U=>u({...d,eventId:U.target.value}),placeholder:"Community event ID"})]})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"outline",onClick:()=>u(null),children:"Cancel"}),a.jsxs(Z,{onClick:D,disabled:h,children:[h&&a.jsx(Ne,{className:"h-4 w-4 mr-1 animate-spin"})," ",d!=null&&d.id?"Save":"Create"]})]})]})}),a.jsx(Kr,{open:!!f,onOpenChange:U=>U?void 0:p(null),children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Delete reward?"}),a.jsxs(zr,{children:['"',f==null?void 0:f.title,'" will be removed from the catalog. Past redemptions are kept.']})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:"Cancel"}),a.jsx(Yr,{onClick:I,children:"Delete"})]})]})}),a.jsx(Bt,{open:!!b,onOpenChange:U=>U?void 0:x(null),children:a.jsxs(Ft,{className:"sm:max-w-md",children:[a.jsx(Vt,{children:a.jsx(Ut,{children:"Mark as fulfilled"})}),b&&a.jsxs("div",{className:"space-y-3",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[b.title," · ",((V=b.user)==null?void 0:V.name)??"Member"]}),b.shippingAddress&&a.jsxs("div",{className:"rounded-lg border border-border bg-muted/40 p-3 text-xs text-foreground",children:[a.jsx("p",{className:"font-medium mb-1",children:"Ship to"}),Object.values(b.shippingAddress).filter(Boolean).join(", ")]}),a.jsxs("div",{children:[a.jsx(_e,{children:"Tracking / note (shown to member)"}),a.jsx(us,{value:w,onChange:U=>k(U.target.value),rows:2,placeholder:"e.g. Shipped via DHL — tracking 1234567890"})]})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"outline",onClick:()=>x(null),children:"Cancel"}),a.jsxs(Z,{onClick:()=>b&&P(b,"fulfill",{trackingNote:w.trim()||void 0}),disabled:g===(b==null?void 0:b.id),children:[g===(b==null?void 0:b.id)&&a.jsx(Ne,{className:"h-4 w-4 mr-1 animate-spin"})," Mark fulfilled"]})]})]})})]})}const Hys={"post-create":{label:"Creating a post",icon:iI,color:"text-amber-600",bg:"bg-amber-500/10"},"post-like":{label:"Liking a post",icon:xx,color:"text-destructive",bg:"bg-destructive/10"},"post-comment":{label:"Commenting on a post",icon:Vi,color:"text-primary",bg:"bg-primary/10"},"comment-reply":{label:"Replying to a comment",icon:bK,color:"text-primary",bg:"bg-primary/10"},"post-liked":{label:"Your post gets liked",icon:xx,color:"text-destructive",bg:"bg-destructive/10"},"post-commented":{label:"Your post gets a comment",icon:Vi,color:"text-primary",bg:"bg-primary/10"},"comment-replied":{label:"Your comment gets a reply",icon:bK,color:"text-primary",bg:"bg-primary/10"},follow:{label:"Gaining a new follower",icon:Sa,color:"text-blue-600",bg:"bg-blue-500/10"},"group:user-joined":{label:"Joining a group",icon:wr,color:"text-emerald-600",bg:"bg-emerald-500/10"},"group:user-requested":{label:"Requesting to join a group",icon:wr,color:"text-emerald-600",bg:"bg-emerald-500/10"},"group:request-accepted":{label:"Join request accepted",icon:wr,color:"text-emerald-600",bg:"bg-emerald-500/10"},"group:going-live":{label:"Going live in a group",icon:wk,color:"text-purple-600",bg:"bg-purple-500/10"},"going-live":{label:"Going live",icon:wk,color:"text-purple-600",bg:"bg-purple-500/10"}};function Gys(t){return t.replace(/[:-]/g," ").replace(/\b\w/g,e=>e.toUpperCase())}function Wys(){const{community:t}=qe(),{communityDetail:e,refetchCommunityDetail:n}=Ln(),r=tv(),{toast:s}=yt(),i=rn(),o=ql(e,"excludeAdminsFromLeaderboard"),[l,c]=y.useState(null),[d,u]=y.useState(!1),h=l??o,m=async D=>{if(t!=null&&t.id){c(D),u(!0);try{await Jee(t.id,"excludeAdminsFromLeaderboard",D),await n(),i.invalidateQueries({queryKey:["leaderboard"]}),i.invalidateQueries({queryKey:["leaderboard-my"]}),s({title:D?"Admins hidden from leaderboard":"Admins shown on leaderboard",description:D?"Admins no longer appear in rankings and aren't ranked themselves.":"Everyone ranks by their real points."})}catch{c(!D),s({title:"Could not update the setting",variant:"destructive"})}finally{u(!1)}}},[f,p]=y.useState(null),[g,v]=y.useState(!1),b=f??r,x=f!==null&&f.trim()!==r,w=(t==null?void 0:t.id)??null,{data:k,isLoading:S}=lt({queryKey:["karma-points",w],queryFn:()=>our(w),enabled:!!w,staleTime:15e3}),[C,j]=y.useState([]),[E,N]=y.useState(!1);y.useEffect(()=>{k&&j(k)},[k]);const A=y.useMemo(()=>k?JSON.stringify(C)!==JSON.stringify(k):!1,[C,k]),_=async()=>{const D=b.trim();if(!D){s({title:"The label can't be empty",variant:"destructive"});return}if(t!=null&&t.id){v(!0);try{await D2(t.id,u5t,D),await n(),p(null),s({title:"Points label updated",description:`Now showing as "${D}" everywhere.`})}catch(I){const P=I instanceof ze&&I.status===403?"Only community admins can change this.":dn(I,"Failed to update the label");s({title:P,variant:"destructive"})}finally{v(!1)}}},T=(D,I)=>{j(P=>P.map(M=>M.activityType===D?{...M,pointsEarned:Math.max(0,M.pointsEarned+I)}:M))},R=D=>{j(I=>I.map(P=>P.activityType===D?{...P,isEnabled:!P.isEnabled}:P))},O=async()=>{if(w){N(!0);try{const D=await lur(w,C.map(I=>({activityType:I.activityType,pointsEarned:I.pointsEarned,isEnabled:I.isEnabled})));j(D),i.setQueryData(["karma-points",w],D),s({title:"Point rules saved"})}catch(D){const I=D instanceof ze&&D.status===403?"Only community admins can change this.":dn(D,"Failed to save point rules");s({title:I,variant:"destructive"})}finally{N(!1)}}},F=r;return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Gamification"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Celebrate engagement and reward your members with gamification."})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-foreground",children:"Points label"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["The name shown for points across the leaderboard, profiles, and stats. Currently:"," ",a.jsx("span",{className:"font-medium text-foreground",children:r}),"."]})]}),a.jsxs("div",{className:"flex flex-col sm:flex-row gap-3 sm:items-center",children:[a.jsx("input",{type:"text",value:b,maxLength:40,onChange:D=>p(D.target.value),placeholder:"e.g. Karma Points, MPU Points, Coins",className:"w-full sm:max-w-xs rounded-lg border border-border bg-card px-4 py-3 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors"}),a.jsxs(Z,{onClick:_,disabled:g||!x,children:[g&&a.jsx(Ne,{className:"h-4 w-4 mr-1.5 animate-spin"}),"Save"]})]})]}),a.jsx("div",{className:"rounded-lg border border-border bg-muted/30 p-6",children:a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-foreground",children:"Exclude admins from leaderboard"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"When on, community admins don't appear in rankings (table, home card and my-rank) and aren't ranked themselves. When off, everyone ranks by their real points."})]}),a.jsx(Hs,{checked:h,disabled:d,onCheckedChange:m,"aria-label":"Exclude admins from leaderboard"})]})}),a.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-6 space-y-4",children:[a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-foreground",children:"Point rules"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Set how many ",F.toLowerCase()," members earn for each activity, and turn activities on or off."]})]}),a.jsxs(Z,{onClick:O,disabled:!A||E,children:[E&&a.jsx(Ne,{className:"h-4 w-4 mr-1.5 animate-spin"}),"Save"]})]}),S?a.jsx("div",{className:"flex items-center justify-center py-10 text-muted-foreground",children:a.jsx(Ne,{className:"h-5 w-5 animate-spin"})}):C.length===0?a.jsx("p",{className:"text-sm text-muted-foreground py-6 text-center",children:"No configurable activities."}):a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:C.map(D=>{const I=Hys[D.activityType],P=(I==null?void 0:I.icon)??iI;return a.jsxs("div",{className:ee("rounded-xl border border-border bg-card p-5 flex items-center gap-4 transition-opacity",!D.isEnabled&&"opacity-60"),children:[a.jsx("div",{className:ee("h-11 w-11 rounded-full flex items-center justify-center shrink-0",(I==null?void 0:I.bg)??"bg-muted",(I==null?void 0:I.color)??"text-muted-foreground"),children:a.jsx(P,{className:"h-5 w-5"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:(I==null?void 0:I.label)??Gys(D.activityType)}),a.jsxs("div",{className:"flex items-center gap-2 mt-1.5",children:[a.jsx("button",{onClick:()=>T(D.activityType,-1),disabled:!D.isEnabled,className:"h-6 w-6 rounded-full border border-border flex items-center justify-center text-muted-foreground hover:bg-muted transition-colors disabled:opacity-40",children:a.jsx(gSe,{className:"h-3 w-3"})}),a.jsxs("span",{className:"text-sm font-bold text-primary min-w-[32px] text-center",children:["+",D.pointsEarned]}),a.jsx("button",{onClick:()=>T(D.activityType,1),disabled:!D.isEnabled,className:"h-6 w-6 rounded-full border border-border flex items-center justify-center text-muted-foreground hover:bg-muted transition-colors disabled:opacity-40",children:a.jsx(Dn,{className:"h-3 w-3"})})]})]}),a.jsx("button",{onClick:()=>R(D.activityType),className:ee("shrink-0 text-xs font-medium rounded-full px-3 py-1.5 border transition-colors",D.isEnabled?"border-primary/30 bg-primary/10 text-primary":"border-border bg-muted text-muted-foreground"),children:D.isEnabled?"On":"Off"})]},D.activityType)})})]}),a.jsx(Oys,{}),a.jsx(Vys,{})]})}const DX=t=>encodeURIComponent(t);async function qys(t){const e=await ae.get(`/community/${DX(t)}/blocked-words`);return{blockedWords:Array.isArray(e==null?void 0:e.blockedWords)?e.blockedWords:[]}}async function Kys(t,e){const n=await ae.post(`/community/${DX(t)}/blocked-words`,{words:e});return{added:Array.isArray(n==null?void 0:n.added)?n.added:[],duplicates:Array.isArray(n==null?void 0:n.duplicates)?n.duplicates:[],invalid:Array.isArray(n==null?void 0:n.invalid)?n.invalid:[]}}async function Yys(t,e){await ae.delete(`/community/${DX(t)}/blocked-words/${DX(e)}`)}function Hhe(t){return["blocked-words",t]}function Qys(t){var i;const e=rn(),n=lt({queryKey:Hhe(t),queryFn:()=>qys(t),enabled:!!t}),r=jt({mutationFn:o=>Kys(t,o),onSuccess:()=>{e.invalidateQueries({queryKey:Hhe(t)})}}),s=jt({mutationFn:o=>Yys(t,o),onSuccess:()=>{e.invalidateQueries({queryKey:Hhe(t)})}});return{words:((i=n.data)==null?void 0:i.blockedWords)??[],isLoading:n.isLoading,isError:n.isError,error:n.error,addWords:r.mutateAsync,removeWord:s.mutateAsync,isAdding:r.isPending,isRemoving:s.isPending,getMutationError:o=>o instanceof ze?o.message:"Something went wrong."}}const ske=t=>encodeURIComponent(t);async function Zys(t,e="all"){const n=e!=="all"?`?status=${encodeURIComponent(e)}`:"",r=await ae.get(`/community/${ske(t)}/content-reports${n}`);return{reports:Array.isArray(r==null?void 0:r.reports)?r.reports:[]}}async function Jys(t,e,n,r){return(await ae.post(`/community/${ske(t)}/content-reports/${ske(e)}/resolve`,{action:n,reason:r})).report}function Xys(t,e){return["content-reports",t,e]}function WOt(t,e="all"){var i;const n=rn(),r=lt({queryKey:Xys(t,e),queryFn:()=>Zys(t,e),enabled:!!t}),s=jt({mutationFn:({reportId:o,action:l,reason:c})=>Jys(t,o,l,c),onSuccess:()=>{n.invalidateQueries({queryKey:["content-reports",t]})}});return{reports:((i=r.data)==null?void 0:i.reports)??[],isLoading:r.isLoading,isError:r.isError,error:r.error,resolveReport:s.mutateAsync,isResolving:s.isPending,getMutationError:o=>o instanceof ze?o.message:"Something went wrong."}}const y8=t=>encodeURIComponent(t);async function ebs(t,e="pending"){const n=await ae.get(`/community/${y8(t)}/posts/pending-review?status=${encodeURIComponent(e)}`);return{posts:Array.isArray(n==null?void 0:n.posts)?n.posts:[]}}async function tbs(t,e){return ae.post(`/community/${y8(t)}/posts/${y8(e)}/moderation/approve`)}async function nbs(t,e,n){return ae.post(`/community/${y8(t)}/posts/${y8(e)}/moderation/reject`,{})}function rbs(t,e){return["pending-posts",t,e]}function qOt(t,e="pending"){var l;const n=rn(),r=lt({queryKey:rbs(t,e),queryFn:()=>ebs(t,e),enabled:!!t}),s=()=>{n.invalidateQueries({queryKey:["pending-posts",t]})},i=jt({mutationFn:c=>tbs(t,c),onSuccess:()=>s()}),o=jt({mutationFn:c=>nbs(t,c),onSuccess:()=>s()});return{posts:((l=r.data)==null?void 0:l.posts)??[],isLoading:r.isLoading,isError:r.isError,error:r.error,refetch:r.refetch,approvePost:i.mutateAsync,rejectPost:o.mutateAsync,isApproving:i.isPending,isRejecting:o.isPending,isModerating:i.isPending||o.isPending,getMutationError:c=>c instanceof ze?c.message:"Something went wrong.",isConflictError:c=>c instanceof ze&&c.status===409}}const KOt=t=>encodeURIComponent(t);async function sbs(t){var n;const e=await ae.get(`/community/${KOt(t)}/post-moderation-settings`);return{enabled:((n=e==null?void 0:e.postSpamModeration)==null?void 0:n.enabled)===!0}}async function ibs(t,e){var r;const n=await ae.put(`/community/${KOt(t)}/post-moderation-settings`,{enabled:e});return{enabled:((r=n==null?void 0:n.postSpamModeration)==null?void 0:r.enabled)===!0}}function abs(t){return["post-spam-moderation-settings",t]}function obs(t){var i;const e=rn(),n=abs(t),r=lt({queryKey:n,queryFn:()=>sbs(t),enabled:!!t}),s=jt({mutationFn:o=>ibs(t,o),onMutate:async o=>{await e.cancelQueries({queryKey:n});const l=e.getQueryData(n);return e.setQueryData(n,{enabled:o}),{previous:l}},onError:(o,l,c)=>{c!=null&&c.previous&&e.setQueryData(n,c.previous)},onSettled:()=>{e.invalidateQueries({queryKey:n})}});return{enabled:((i=r.data)==null?void 0:i.enabled)===!0,isLoading:r.isLoading,isError:r.isError,error:r.error,updateEnabled:s.mutateAsync,isUpdating:s.isPending,getMutationError:o=>o instanceof ze?o.message:"Something went wrong."}}function lbs(t){var e;if(t.contentKind==="post"&&t.contentId)return ve.post(t.contentId);if((t.contentKind==="user"||t.type==="Profile")&&((e=t.reportedUser)!=null&&e.id))return ve.member(t.reportedUser.id);if(t.contentId&&t.type==="Post")return ve.post(t.contentId);if(t.contentLink)try{const n=new URL(t.contentLink,window.location.origin).pathname,r=n.match(/^\/post\/([a-f0-9]{24})$/i);if(r)return ve.post(r[1]);const s=n.match(/^\/member\/([a-f0-9]{24})$/i)||n.match(/^\/user\/([a-f0-9]{24})$/i);if(s)return ve.member(s[1]);if(n.startsWith("/")&&n!=="/")return n}catch{}return null}const cbs={pending:"bg-amber-500/10 text-amber-600 border-amber-500/20",resolved:"bg-emerald-500/10 text-emerald-600 border-emerald-500/20"},dbs={pending_review:"bg-amber-500/10 text-amber-600 border-amber-500/20",rejected:"bg-destructive/10 text-destructive border-destructive/20"},ubs={Post:xd,Comment:Vi,Reply:Vi,DM:Vi,Profile:xd};function hbs(){const t=Nn(),{community:e}=qe(),n=(e==null?void 0:e.id)??null,{words:r,isLoading:s,isError:i,addWords:o,removeWord:l,isAdding:c,isRemoving:d,getMutationError:u}=Qys(n),[h,m]=y.useState(""),[f,p]=y.useState(null),[g,v]=y.useState(""),[b,x]=y.useState("all"),[w,k]=y.useState("pending"),{reports:S,isLoading:C,isError:j,resolveReport:E,isResolving:N,getMutationError:A}=WOt(n,"all"),{posts:_,isLoading:T,isError:R,approvePost:O,rejectPost:F,isModerating:D,refetch:I,getMutationError:P,isConflictError:M}=qOt(n,"all"),{enabled:z,isLoading:G,isError:B,updateEnabled:H,isUpdating:W,getMutationError:V}=obs(n),U=w==="all"?_:_.filter(J=>w==="pending"?J.moderationStatus==="pending_review":J.moderationStatus==="rejected"),ne=_.filter(J=>J.moderationStatus==="pending_review").length,te=_.filter(J=>J.moderationStatus==="rejected").length,re=b==="all"?S:S.filter(J=>J.status===b),fe=S.filter(J=>J.status==="pending").length,le=S.filter(J=>J.status==="resolved").length,q=async()=>{const J=h.split(/[,\n]/).map(K=>K.trim().toLowerCase()).filter(Boolean);if(!(J.length===0||!n))try{const K=await o(J);[...K.duplicates,...K.invalid.map(pe=>pe.word)].length===0&&m(""),K.added.length>0&&He.success(K.added.length===1?`"${K.added[0].word}" added to banned words`:`${K.added.length} words added to banned words`),K.duplicates.length>0&&He.info(`Already banned: ${K.duplicates.join(", ")}`),K.invalid.length>0&&He.error(`Skipped ${K.invalid.map(pe=>`"${pe.word}"`).join(", ")} — ${K.invalid[0].reason}`)}catch(K){He.error(u(K))}},Y=async(J,K)=>{if(n)try{await l(J),He.success(`"${K}" removed from banned words`)}catch(ce){He.error(u(ce))}},X=async(J,K,ce,pe)=>{try{await E({reportId:J,action:K,reason:pe}),He.success(ce)}catch(Ie){He.error(A(Ie))}},Q=async()=>{if(!f||!g.trim())return;const J=f.type==="Reply"?"reply":"comment";try{await E({reportId:f.id,action:"delete_content",reason:g.trim()}),He.success(`Reported ${J} deleted`),p(null),v("")}catch(K){He.error(A(K))}},ie=async J=>{try{await O(J),He.success("Post approved and published")}catch(K){if(M(K)){He.info(P(K)),I();return}He.error(P(K))}},he=async J=>{try{await F(J),He.success("Post rejected")}catch(K){if(M(K)){He.info(P(K)),I();return}He.error(P(K))}},ye=async J=>{try{await H(J),He.success(J?"Suspicious posts will be held for review":"Posts will publish without review")}catch(K){He.error(V(K))}};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsxs("h2",{className:"text-lg font-semibold text-foreground flex items-center gap-2",children:[a.jsx(kSe,{className:"h-5 w-5 text-primary"})," User safety control panel"]}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Manage content moderation, banned words, and user reports."})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-6 space-y-4",children:[a.jsx("div",{className:"flex items-center justify-between",children:a.jsxs("div",{children:[a.jsxs("h3",{className:"font-semibold text-foreground flex items-center gap-2",children:[a.jsx(mm,{className:"h-4 w-4 text-destructive"})," Banned words"]}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Blocked words are enforced on the server when anyone creates or edits posts, comments, replies, chat messages, and events."})]})}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{type:"text",value:h,onChange:J=>m(J.target.value),onKeyDown:J=>J.key==="Enter"&&void q(),placeholder:"crypto, kill, bomb",disabled:!n||c,className:"flex-1 rounded-lg border border-border bg-card px-4 py-2.5 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors disabled:opacity-60"}),a.jsxs("button",{onClick:()=>void q(),disabled:!n||c||!h.trim(),className:"inline-flex items-center gap-1.5 rounded-lg bg-primary px-4 py-2.5 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-60",children:[c?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsx(Dn,{className:"h-4 w-4"}),"Add"]})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Add several at once by separating them with commas — a word with spaces, like",a.jsx("span",{className:"mx-1 font-medium text-foreground",children:"crypto cam"}),", counts as one entry."]}),s?a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"}),"Loading banned words…"]}):i?a.jsx("p",{className:"text-sm text-destructive",children:"Could not load banned words. Please refresh and try again."}):a.jsxs("div",{className:"flex flex-wrap gap-2",children:[r.map(J=>a.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-destructive/10 text-destructive border border-destructive/20 px-3 py-1.5 text-xs font-medium",children:[J.word,a.jsx("button",{onClick:()=>void Y(J.id,J.word),disabled:d,className:"hover:bg-destructive/20 rounded-full p-0.5 transition-colors disabled:opacity-60","aria-label":`Remove ${J.word}`,children:a.jsx(nn,{className:"h-3 w-3"})})]},J.id)),r.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground italic",children:"No banned words configured."})]})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-6 space-y-4",children:[a.jsxs("div",{className:"rounded-lg border border-border bg-card p-4 flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Automatically hold suspicious posts for review"}),a.jsx("p",{className:"text-xs text-muted-foreground mt-1",children:"Flags high-risk and blocked-word posts for admin approval. When off, posts publish without review."}),B&&a.jsx("p",{className:"text-xs text-destructive mt-2",children:"Could not load this setting."})]}),G?a.jsx(Ne,{className:"h-5 w-5 animate-spin text-muted-foreground shrink-0"}):a.jsx(Hs,{checked:z,onCheckedChange:J=>void ye(J),disabled:!n||W||B,"aria-label":"Automatically hold suspicious posts for review"})]}),a.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"font-semibold text-foreground flex items-center gap-2",children:[a.jsx(ja,{className:"h-4 w-4 text-amber-500"})," Posts in review"]}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Posts held for spam or blocked-word checks before they appear in the feed."})]}),a.jsx("div",{className:"flex items-center gap-2",children:["all","pending","rejected"].map(J=>a.jsxs("button",{onClick:()=>k(J),className:ee("rounded-full px-3 py-1 text-xs font-medium transition-colors capitalize",w===J?"bg-primary/10 text-primary":"text-muted-foreground hover:text-foreground"),children:[J==="pending"?"pending":J," ",J==="all"&&`(${_.length})`,J==="pending"&&`(${ne})`,J==="rejected"&&`(${te})`]},J))})]}),T?a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-8 justify-center",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"}),"Loading posts in review…"]}):R?a.jsx("p",{className:"text-sm text-destructive py-4",children:"Could not load posts in review. Please refresh and try again."}):U.length===0?a.jsx("p",{className:"text-sm text-muted-foreground italic py-8 text-center",children:"No posts in review."}):a.jsx("div",{className:"space-y-3",children:U.map(J=>{var Ie,Me,we,Be,Ve;const K=J.moderationStatus??"pending_review",ce=K==="rejected"?"rejected":"pending_review",pe=J.moderationMeta;return a.jsx("div",{className:"rounded-lg border border-border bg-card p-4 hover:shadow-sm transition-shadow",children:a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[a.jsx("div",{className:"h-9 w-9 rounded-full bg-amber-500/10 flex items-center justify-center shrink-0",children:a.jsx(xd,{className:"h-4 w-4 text-amber-600"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("div",{className:"flex items-center gap-2 flex-wrap mb-2",children:a.jsx("span",{className:ee("inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-medium capitalize",dbs[ce]),children:K==="pending_review"?"pending review":K})}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Preview"}),a.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap break-words",children:((Ie=J.preview)==null?void 0:Ie.trim())||((Me=J.title)==null?void 0:Me.trim())||((we=J.description)==null?void 0:we.trim())||"(no text)"})]}),((Be=pe==null?void 0:pe.reason)==null?void 0:Be.trim())&&a.jsxs("div",{className:"space-y-1 mt-2",children:[a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Reason"}),a.jsx("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap break-words",children:pe.reason})]}),(pe==null?void 0:pe.matchedWords)&&pe.matchedWords.length>0&&a.jsxs("div",{className:"space-y-1 mt-2",children:[a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Matched words"}),a.jsx("div",{className:"flex flex-wrap gap-1.5",children:pe.matchedWords.map(be=>a.jsx("span",{className:"inline-flex rounded-full bg-destructive/10 text-destructive border border-destructive/20 px-2 py-0.5 text-[10px] font-medium",children:be},be))})]}),(pe==null?void 0:pe.sources)&&pe.sources.length>0&&a.jsxs("p",{className:"text-[10px] text-muted-foreground mt-2",children:["Sources: ",pe.sources.join(", ")]}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-2",children:["By ",a.jsx("span",{className:"font-medium text-foreground",children:((Ve=J.author)==null?void 0:Ve.name)??"Unknown"})," · ",yc(J.createdAt)]})]})]}),K==="pending_review"&&a.jsxs("div",{className:"flex items-center gap-1.5 shrink-0",children:[a.jsxs("button",{onClick:()=>void ie(J.id),disabled:D,className:"inline-flex items-center gap-1 rounded-md bg-emerald-500/10 text-emerald-600 px-2.5 py-1.5 text-xs font-medium hover:bg-emerald-500/20 disabled:opacity-60",title:"Approve and publish",children:[a.jsx(Qn,{className:"h-3 w-3"})," Approve"]}),a.jsxs("button",{onClick:()=>void he(J.id),disabled:D,className:"inline-flex items-center gap-1 rounded-md bg-destructive/10 text-destructive px-2.5 py-1.5 text-xs font-medium hover:bg-destructive/20 disabled:opacity-60",title:"Reject post",children:[a.jsx(qn,{className:"h-3 w-3"})," Reject"]})]}),K==="rejected"&&a.jsxs("span",{className:"text-xs text-destructive font-medium flex items-center gap-1 shrink-0",children:[a.jsx(mm,{className:"h-3 w-3"})," Rejected"]})]})},J.id)})})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-muted/30 p-6 space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between flex-wrap gap-3",children:[a.jsxs("div",{children:[a.jsxs("h3",{className:"font-semibold text-foreground flex items-center gap-2",children:[a.jsx(Bf,{className:"h-4 w-4 text-amber-500"})," Content reports"]}),a.jsx("p",{className:"text-sm text-muted-foreground mt-0.5",children:"Review member reports submitted from posts and profiles. Admins still receive email notifications too."})]}),a.jsx("div",{className:"flex items-center gap-2",children:["all","pending","resolved"].map(J=>a.jsxs("button",{onClick:()=>x(J),className:ee("rounded-full px-3 py-1 text-xs font-medium transition-colors capitalize",b===J?"bg-primary/10 text-primary":"text-muted-foreground hover:text-foreground"),children:[J," ",J==="all"&&`(${S.length})`,J==="pending"&&`(${fe})`,J==="resolved"&&`(${le})`]},J))})]}),C?a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-8 justify-center",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"}),"Loading reports…"]}):j?a.jsx("p",{className:"text-sm text-destructive py-4",children:"Could not load reports. Please refresh and try again."}):re.length===0?a.jsx("p",{className:"text-sm text-muted-foreground italic py-8 text-center",children:"No reports yet."}):a.jsx("div",{className:"space-y-3",children:re.map(J=>{var pe,Ie;const K=ubs[J.type]||xd,ce=lbs(J);return a.jsx("div",{className:"rounded-lg border border-border bg-card p-4 hover:shadow-sm transition-shadow",children:a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"flex items-start gap-3 flex-1 min-w-0",children:[a.jsx("div",{className:"h-9 w-9 rounded-full bg-amber-500/10 flex items-center justify-center shrink-0",children:a.jsx(K,{className:"h-4 w-4 text-amber-600"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-2 flex-wrap mb-2",children:[a.jsx("span",{className:ee("inline-flex items-center rounded-full border px-2 py-0.5 text-[10px] font-medium",cbs[J.status]),children:J.status}),a.jsx("span",{className:"text-[10px] text-muted-foreground bg-muted rounded-full px-2 py-0.5",children:J.type}),J.resolution&&J.status==="resolved"&&a.jsx("span",{className:"text-[10px] text-muted-foreground bg-muted rounded-full px-2 py-0.5 capitalize",children:J.resolution})]}),a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Reason"}),a.jsx("p",{className:"text-sm text-foreground whitespace-pre-wrap break-words",children:((pe=J.reason)==null?void 0:pe.trim())||"No reason provided"})]}),((Ie=J.content)==null?void 0:Ie.trim())&&a.jsxs("div",{className:"space-y-1 mt-2",children:[a.jsx("p",{className:"text-[11px] font-semibold uppercase tracking-wide text-muted-foreground",children:"Reported content"}),a.jsxs("p",{className:"text-xs text-muted-foreground whitespace-pre-wrap break-words",children:['"',J.content,'"']})]}),a.jsxs("p",{className:"text-xs text-muted-foreground mt-1",children:["Reported by ",a.jsx("span",{className:"font-medium text-foreground",children:J.reporter.name}),J.reportedUser&&a.jsxs(a.Fragment,{children:[" ","· Against ",a.jsx("span",{className:"font-medium text-foreground",children:J.reportedUser.name})]})," ","· ",yc(J.createdAt)]}),ce?a.jsx("button",{type:"button",onClick:()=>t(ce),className:"text-xs text-primary hover:underline mt-1 inline-block text-left",children:"View reported content"}):J.contentLink?a.jsx("span",{className:"text-xs text-muted-foreground mt-1 inline-block truncate max-w-full",children:J.contentLink}):null]})]}),J.status==="pending"&&a.jsx("div",{className:"flex items-center gap-1.5 shrink-0",children:J.type==="Comment"||J.type==="Reply"?a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>void X(J.id,"reject",`Report rejected; ${J.type.toLowerCase()} kept`),disabled:N,className:"inline-flex items-center gap-1 rounded-md bg-muted px-2.5 py-1.5 text-xs font-medium text-foreground hover:bg-muted/80 disabled:opacity-60",title:`Reject report and keep ${J.type.toLowerCase()}`,children:[a.jsx(nn,{className:"h-3 w-3"})," Reject"]}),a.jsxs("button",{onClick:()=>{p(J),v("")},disabled:N,className:"inline-flex items-center gap-1 rounded-md bg-destructive px-2.5 py-1.5 text-xs font-medium text-destructive-foreground hover:bg-destructive/90 disabled:opacity-60",title:`Delete reported ${J.type.toLowerCase()}`,children:[a.jsx(qn,{className:"h-3 w-3"})," Delete ",J.type.toLowerCase()]}),a.jsxs("button",{onClick:()=>{var Me;return void X(J.id,"ban_user",`${((Me=J.reportedUser)==null?void 0:Me.name)??"User"} has been banned`)},disabled:N||!J.reportedUser,className:"inline-flex items-center gap-1 rounded-md bg-primary px-2.5 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-60",title:J.reportedUser?"Ban user":"No reported user linked",children:[a.jsx(mm,{className:"h-3 w-3"})," Ban"]})]}):a.jsxs(a.Fragment,{children:[a.jsxs("button",{onClick:()=>void X(J.id,"approve","Report marked as approved"),disabled:N,className:"inline-flex items-center gap-1 rounded-md bg-emerald-500/10 px-2.5 py-1.5 text-xs font-medium text-emerald-600 hover:bg-emerald-500/20 disabled:opacity-60",title:"Approve content",children:[a.jsx(Qn,{className:"h-3 w-3"})," Approve"]}),J.type==="Post"&&a.jsxs("button",{onClick:()=>void X(J.id,"delete_content","Reported post deleted"),disabled:N,className:"inline-flex items-center gap-1 rounded-md bg-destructive/10 px-2.5 py-1.5 text-xs font-medium text-destructive hover:bg-destructive/20 disabled:opacity-60",title:"Delete reported post",children:[a.jsx(qn,{className:"h-3 w-3"})," Delete"]}),a.jsxs("button",{onClick:()=>{var Me;return void X(J.id,"ban_user",`${((Me=J.reportedUser)==null?void 0:Me.name)??"User"} has been banned`)},disabled:N||!J.reportedUser,className:"inline-flex items-center gap-1 rounded-md bg-primary px-2.5 py-1.5 text-xs font-medium text-primary-foreground hover:bg-primary/90 disabled:opacity-60",title:J.reportedUser?"Ban user":"No reported user linked",children:[a.jsx(mm,{className:"h-3 w-3"})," Ban"]})]})}),J.status==="resolved"&&a.jsxs("div",{className:"max-w-52 shrink-0 text-right text-xs text-muted-foreground",children:[a.jsxs("span",{className:"flex items-center justify-end gap-1 font-medium text-emerald-600",children:[a.jsx(Qn,{className:"h-3 w-3"})," Resolved"]}),J.resolvedBy&&a.jsxs("p",{className:"mt-1",children:["By ",J.resolvedBy.name]}),J.resolutionReason&&a.jsxs("p",{className:"mt-1 whitespace-pre-wrap",children:["Reason: ",J.resolutionReason]})]})]})},J.id)})})]}),a.jsx(Bt,{open:!!f,onOpenChange:J=>{!J&&!N&&(p(null),v(""))},children:a.jsxs(Ft,{className:"sm:max-w-md",children:[a.jsxs(Vt,{children:[a.jsxs(Ut,{children:["Delete reported ",(f==null?void 0:f.type.toLowerCase())??"content","?"]}),a.jsxs(_n,{children:["This permanently deletes this reported ",(f==null?void 0:f.type.toLowerCase())??"content",". Enter the moderation reason for the audit record."]})]}),a.jsx(us,{value:g,onChange:J=>v(J.target.value),placeholder:`Reason for deleting this ${(f==null?void 0:f.type.toLowerCase())??"content"}`,className:"min-h-28 resize-none",maxLength:2e3}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"outline",onClick:()=>p(null),disabled:N,children:"Cancel"}),a.jsx(Z,{variant:"destructive",onClick:()=>void Q(),disabled:N||!g.trim(),children:N?"Deleting…":`Delete ${(f==null?void 0:f.type.toLowerCase())??"content"}`})]})]})})]})}function Ghe(t){return typeof t=="string"?t:""}function mbs(t,e){return t instanceof ze&&t.status===403?"Only community admins can change this.":dn(t,e)}function fbs(){const{settings:t,updateSettings:e,persistSettings:n}=Vnn(),{community:r,setCommunity:s}=qe(),{communityDetail:i,refetchCommunityDetail:o}=Ln(),l=(r==null?void 0:r.id)??null,c=y.useRef(null),[d,u]=y.useState(!1),[h,m]=y.useState(null),[f,p]=y.useState(!1),g=y.useRef(null);y.useEffect(()=>{if(!i||!l||g.current===l)return;const w=i;g.current=l,e({coverImage:Ghe(w.banner)||null,bannerTitle:Ghe(w.bannerTitle),bannerDescription:Ghe(w.bannerDescription),feedLayout:w.expandPostDirectory===!1?"compact":"list"}),m(null),p(!1)},[i,l,e]);const v=w=>{if(!w.type.startsWith("image/")){He.error("Please upload an image file");return}m(w),p(!1);const k=new FileReader;k.onload=S=>{var C;return e({coverImage:(C=S.target)==null?void 0:C.result})},k.readAsDataURL(w)},b=()=>{e({coverImage:null}),m(null),p(!0)},x=async()=>{if(!(!l||d)){u(!0);try{let w=(await vje(l,{bannerTitle:t.bannerTitle,bannerDescription:t.bannerDescription})).community;h?w=(await Qct(l,h)).community:f&&(w=(await Zct(l)).community),await yje(l,"expandPostDirectory",t.feedLayout==="list"),s(w),o(),n(),m(null),p(!1),He.success("Homepage settings saved")}catch(w){He.error(mbs(w,"Failed to save homepage settings"))}finally{u(!1)}}};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Homepage"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Customise your community banner and choose how the homefeed is displayed. Changes apply on the home feed after you save."})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-6 space-y-5",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-foreground",children:"Community banner"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"This banner appears at the top of your community homepage."})]}),a.jsxs("div",{children:[a.jsx("input",{ref:c,type:"file",accept:"image/*",className:"hidden",onChange:w=>{var k;return((k=w.target.files)==null?void 0:k[0])&&v(w.target.files[0])}}),t.coverImage?a.jsxs("div",{className:"relative rounded-xl overflow-hidden border border-border bg-card aspect-[16/6]",children:[a.jsx("img",{src:t.coverImage,alt:"Cover preview",className:"w-full h-full object-cover"}),a.jsx("button",{type:"button",onClick:b,className:"absolute top-3 right-3 h-8 w-8 rounded-full bg-background/90 border border-border flex items-center justify-center text-foreground hover:bg-background transition-colors",children:a.jsx(nn,{className:"h-4 w-4"})}),a.jsxs("button",{type:"button",onClick:()=>{var w;return(w=c.current)==null?void 0:w.click()},className:"absolute bottom-3 right-3 inline-flex items-center gap-1.5 rounded-md bg-background/90 border border-border px-3 py-1.5 text-xs font-medium text-foreground hover:bg-background transition-colors",children:[a.jsx(kd,{className:"h-3.5 w-3.5"})," Replace"]})]}):a.jsxs("button",{type:"button",onClick:()=>{var w;return(w=c.current)==null?void 0:w.click()},className:"w-full rounded-xl border-2 border-dashed border-border bg-card hover:border-primary/40 hover:bg-muted/50 transition-colors aspect-[16/6] flex flex-col items-center justify-center gap-2 text-center px-4",children:[a.jsx("div",{className:"h-11 w-11 rounded-full bg-primary/10 text-primary flex items-center justify-center",children:a.jsx(Jl,{className:"h-5 w-5"})}),a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Upload cover picture"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"16:6 aspect ratio (recommended)"}),a.jsxs("span",{className:"mt-1 inline-flex items-center gap-1.5 text-xs font-medium text-primary",children:[a.jsx(kd,{className:"h-3.5 w-3.5"})," Choose image"]})]})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Banner title"}),a.jsx("input",{type:"text",value:t.bannerTitle,onChange:w=>e({bannerTitle:w.target.value}),placeholder:"Enter here",className:"w-full rounded-lg border border-border bg-card px-4 py-2.5 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"For example: “Welcome to my community”."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Banner description"}),a.jsx("textarea",{value:t.bannerDescription,onChange:w=>e({bannerDescription:w.target.value}),placeholder:"Enter a banner description",rows:4,className:"w-full rounded-lg border border-border bg-card px-4 py-2.5 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors resize-none"})]})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-6 space-y-4",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-foreground",children:"Homefeed layout"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Choose how posts appear on the community homepage."})]}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-3",children:[{id:"list",label:"List view",desc:"Full-width posts stacked vertically.",icon:rI},{id:"compact",label:"Compact view",desc:"Condensed rows for higher density.",icon:dee}].map(w=>{const k=w.icon,S=t.feedLayout===w.id;return a.jsxs("button",{type:"button",onClick:()=>e({feedLayout:w.id}),className:ee("rounded-xl border p-4 text-left transition-all flex items-start gap-3",S?"border-primary bg-primary/5 ring-2 ring-primary/20":"border-border bg-card hover:border-primary/40"),children:[a.jsx("div",{className:ee("h-10 w-10 rounded-lg flex items-center justify-center shrink-0",S?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground"),children:a.jsx(k,{className:"h-5 w-5"})}),a.jsxs("div",{className:"flex-1 min-w-0",children:[a.jsx("p",{className:"text-sm font-semibold text-foreground",children:w.label}),a.jsx("p",{className:"text-xs text-muted-foreground mt-0.5",children:w.desc})]}),a.jsx("div",{className:ee("h-4 w-4 rounded-full border-2 shrink-0 mt-0.5",S?"border-primary bg-primary":"border-border")})]},w.id)})})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs("button",{type:"button",onClick:x,disabled:d||!l,className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-5 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-60",children:[d&&a.jsx(Ne,{className:"h-4 w-4 animate-spin"}),"Save changes"]})})]})}const $Xe=5,pbs=[{configKey:"isLoginRequired",label:"Make login/sign-up mandatory to see the homefeed",kind:"loginRequirement"},{configKey:"needsAdminVerification",label:"Make it a gated community",kind:"v1"}],gbs=[{configKey:"disableEmailLogin",label:"Disable login/sign-up via email",kind:"v2"},{configKey:"disableGoogleLogin",label:"Disable login/sign-up via Google account",kind:"v2"},{configKey:"disableAppleLogin",label:"Disable login/sign-up via Apple",kind:"v2"}];function OXe(t,e){return t instanceof ze&&t.status===403?"Only community admins can change this.":dn(t,e)}function BH({title:t,children:e,defaultOpen:n=!0}){const[r,s]=y.useState(n);return a.jsxs("div",{className:"rounded-lg border border-border bg-card overflow-hidden",children:[a.jsxs("button",{onClick:()=>s(!r),className:"w-full flex items-center justify-between px-5 py-4 hover:bg-muted/50 transition-colors",children:[a.jsx("span",{className:"font-semibold text-foreground",children:t}),a.jsx(li,{className:ee("h-4 w-4 text-muted-foreground transition-transform",r&&"rotate-180")})]}),r&&a.jsx("div",{className:"px-5 pb-5 pt-1 space-y-4",children:e})]})}function FXe({checked:t,onChange:e,label:n,saving:r}){return a.jsxs("label",{className:"flex items-center gap-3 cursor-pointer group",children:[r?a.jsx(Ne,{className:"h-5 w-5 animate-spin text-muted-foreground"}):a.jsx(Hs,{checked:t,onCheckedChange:e}),a.jsx("span",{className:"text-sm text-foreground",children:n})]})}function vbs(){const{community:t}=qe(),{communityDetail:e,refetchCommunityDetail:n,groups:r}=Ln(),s=(t==null?void 0:t.id)??null,[i,o]=y.useState({}),[l,c]=y.useState([]),[d,u]=y.useState([]),[h,m]=y.useState(!1),f=y.useRef(null);y.useEffect(()=>{if(!e||!s||f.current===s)return;f.current=s;const S=e,C=Array.isArray(S.welcomeMessages)?S.welcomeMessages:[];c(C.length?C:[""])},[e,s]);const{data:p}=lt({queryKey:["community-additional-config",s],enabled:!!s,staleTime:6e4,queryFn:()=>Snn(s)});y.useEffect(()=>{var S;(S=p==null?void 0:p.cac)!=null&&S.defaultJoinGroups&&u(p.cac.defaultJoinGroups)},[p]);const g=S=>async C=>{if(!(!s||i[S.configKey])){o(j=>({...j,[S.configKey]:!0}));try{S.kind==="loginRequirement"?await knn(s,C):S.kind==="v1"?await yje(s,S.configKey,C):await Jee(s,S.configKey,C),await n(),He.success("Setting updated")}catch(j){He.error(OXe(j,"Failed to update setting"))}finally{o(j=>({...j,[S.configKey]:!1}))}}},v=(S,C)=>c(j=>j.map((E,N)=>N===S?C:E)),b=S=>c(C=>C.filter((j,E)=>E!==S)),x=()=>c(S=>S.length>=$Xe?S:[...S,""]),w=S=>u(C=>C.includes(S)?C.filter(j=>j!==S):[...C,S]),k=async()=>{if(!(!s||h)){m(!0);try{const S=l.map(C=>C.trim()).filter(Boolean);await wnn(s,S),await Cnn(s,d),await n(),He.success("Onboarding settings saved")}catch(S){He.error(OXe(S,"Failed to save onboarding settings"))}finally{m(!1)}}};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Onboarding"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Configure how new members enter and experience the community. Entry & login toggles save automatically."})]}),a.jsx(BH,{title:"Entry to community",children:a.jsx("div",{className:"space-y-3",children:pbs.map(S=>a.jsx(FXe,{checked:ql(e,S.configKey),onChange:g(S),saving:i[S.configKey],label:S.label},S.configKey))})}),a.jsx(BH,{title:"Register/login",children:a.jsx("div",{className:"space-y-3",children:gbs.map(S=>a.jsx(FXe,{checked:ql(e,S.configKey),onChange:g(S),saving:i[S.configKey],label:S.label},S.configKey))})}),a.jsxs(BH,{title:"Landing on homefeed",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Greet your members with a personalised message."}),a.jsxs("div",{className:"space-y-3",children:[l.map((S,C)=>a.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4 space-y-3",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"text-xs font-semibold text-muted-foreground tracking-wider",children:["MESSAGE ",C+1]}),l.length>1&&a.jsx("button",{onClick:()=>b(C),className:"text-muted-foreground hover:text-destructive transition-colors",children:a.jsx(qn,{className:"h-4 w-4"})})]}),a.jsx("textarea",{value:S,onChange:j=>v(C,j.target.value),rows:4,placeholder:"Enter a welcome message",className:"w-full rounded-lg border border-border bg-card px-4 py-2.5 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors resize-none italic"})]},C)),l.length<$Xe&&a.jsxs("button",{onClick:x,className:"inline-flex items-center gap-1.5 rounded-md border border-border bg-card px-4 py-2 text-sm font-medium text-foreground hover:bg-muted transition-colors",children:[a.jsx(Dn,{className:"h-3.5 w-3.5"})," Add message"]})]})]}),a.jsxs(BH,{title:"Auto-join groups",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"New members will automatically join the selected groups."}),r.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No groups available in this community yet."}):a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-2",children:r.map(S=>{const C=d.includes(S.id);return a.jsxs("label",{className:ee("flex items-center gap-3 rounded-lg border px-3 py-2.5 cursor-pointer transition-colors",C?"border-primary bg-primary/5":"border-border bg-card hover:bg-muted/50"),children:[a.jsx("input",{type:"checkbox",checked:C,onChange:()=>w(S.id),className:"h-4 w-4 rounded border-border text-primary focus:ring-primary/20"}),a.jsx("span",{className:"text-sm text-foreground",children:S.name})]},S.id)})})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs("button",{onClick:k,disabled:h||!s,className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-5 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-60",children:[h&&a.jsx(Ne,{className:"h-4 w-4 animate-spin"}),"Save changes"]})})]})}const{configKey:BXe,label:ybs,hint:bbs,defaultValue:xbs}=Pfr;function wbs(){const{community:t}=qe(),{communityDetail:e,refetchCommunityDetail:n}=Ln(),r=(t==null?void 0:t.id)??null,[s,i]=y.useState(!1),{switchOn:o,included:l}=NAe(),c=async u=>{if(!(!r||s)){i(!0);try{await Jee(r,BXe,u),await n(),He.success(u?"Member analytics tracking turned on":"Member analytics tracking turned off")}catch(h){He.error(GIe(h,"Failed to update setting"))}finally{i(!1)}}},d=a.jsx(kbs,{checked:ql(e,BXe,xbs),onChange:c,saving:s});return a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Choose what Insights records about individual members."}),o&&!l?a.jsxs(a.Fragment,{children:[d,a.jsx(ANt,{feature:"memberAnalytics",embedded:!0})]}):a.jsx(zZ,{feature:"memberAnalytics",embedded:!0,children:d})]})}function kbs({checked:t,onChange:e,saving:n}){return a.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 px-4 py-3 space-y-2",children:[a.jsxs("div",{className:"flex items-center gap-1.5 text-sm font-semibold text-foreground",children:["Member tracking",a.jsx(gn,{label:"Member tracking",children:"Community-wide Insights such as active members, the activity heatmap, top members, post starters, active commenters and the audit trail always work. This switch only adds per-member data: time spent, sessions, page journeys and Look up a user."})]}),a.jsx(YOt,{checked:t,onChange:e,saving:n,label:ybs,hint:bbs})]})}function Whe({title:t,children:e,defaultOpen:n=!0}){const[r,s]=y.useState(n);return a.jsxs("div",{className:"rounded-lg border border-border bg-card overflow-hidden",children:[a.jsxs("button",{onClick:()=>s(!r),className:"w-full flex items-center justify-between px-5 py-4 hover:bg-muted/50 transition-colors",children:[a.jsx("span",{className:"font-semibold text-foreground",children:t}),a.jsx(li,{className:ee("h-4 w-4 text-muted-foreground transition-transform",r&&"rotate-180")})]}),r&&a.jsx("div",{className:"px-5 pb-5 pt-1 space-y-3",children:e})]})}function Sbs(){return a.jsx("span",{className:"ml-2 inline-flex items-center rounded-full bg-amber-100 px-2 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-amber-700 dark:bg-amber-500/15 dark:text-amber-400",children:"Premium"})}function YOt({checked:t,onChange:e,label:n,hint:r,disabled:s,saving:i,locked:o}){return a.jsxs("div",{className:ee("flex items-start gap-3 py-1.5",o&&"opacity-60"),children:[i?a.jsx(Ne,{className:"mt-0.5 h-5 w-5 shrink-0 animate-spin text-muted-foreground"}):a.jsx(Hs,{checked:t,onCheckedChange:e,disabled:s||o,className:"mt-0.5"}),a.jsxs("div",{className:"flex-1",children:[a.jsxs("div",{className:"text-sm text-foreground",children:[n,o&&a.jsx(Sbs,{})]}),r&&a.jsx("div",{className:"text-xs text-muted-foreground mt-0.5",children:r}),o&&a.jsx("div",{className:"text-xs text-amber-600 dark:text-amber-400 mt-0.5",children:"Upgrade your plan to use this setting."})]})]})}function GIe(t,e){return t instanceof ze&&t.status===403?"Only community admins can change this.":dn(t,e)}function Cbs(){const{community:t}=qe(),{communityDetail:e,refetchCommunityDetail:n}=Ln(),{pac:r}=SN(),s=(t==null?void 0:t.id)??null,[i,o]=y.useState({}),l=(c,d)=>async u=>{if(!(!s||i[c])){o(h=>({...h,[c]:!0}));try{d?await yje(s,c,u):await Jee(s,c,u),await n(),He.success("Setting updated")}catch(h){He.error(GIe(h,"Failed to update setting"))}finally{o(h=>({...h,[c]:!1}))}}};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Community experience"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Tailor what members see and how the community behaves. Changes save automatically."})]}),Nnn.map(c=>a.jsx(Whe,{title:c.title,children:c.toggles.map(d=>a.jsx(YOt,{checked:ql(e,d.configKey,d.defaultValue),onChange:l(d.configKey,d.legacy),saving:i[d.configKey],label:d.label,hint:d.hint,locked:l0(r,d.premium)},d.configKey))},c.title)),a.jsx("div",{id:"analytics",className:"scroll-mt-24",children:a.jsx(Whe,{title:"Analytics",children:a.jsx(wbs,{})})}),a.jsx(Whe,{title:"Advanced configurables",children:a.jsx(jbs,{communityId:s})})]})}function jbs({communityId:t}){const{data:e,isLoading:n,refetch:r}=lt({queryKey:["community-configurables",t],enabled:!!t,staleTime:6e4,queryFn:async()=>{var v,b,x;const[f,p,g]=await Promise.all([qj(t,YU).catch(()=>null),qj(t,QU).catch(()=>null),qj(t,Koe).catch(()=>null)]);return{postTimer:((v=f==null?void 0:f.configurable)==null?void 0:v.configurableValue)??"",reportEmail:((b=p==null?void 0:p.configurable)==null?void 0:b.configurableValue)??"",preventProfile:!!((x=g==null?void 0:g.configurable)!=null&&x.configurableValue)}}}),[s,i]=y.useState(""),[o,l]=y.useState(""),[c,d]=y.useState(!1),[u,h]=y.useState(null);y.useEffect(()=>{e&&(i(String(e.postTimer??"")),l(String(e.reportEmail??"")),d(!!e.preventProfile))},[e]);const m=async(f,p,g)=>{if(!(!t||u)){h(f);try{await D2(t,f,p),await r(),He.success(g)}catch(v){He.error(GIe(v,"Failed to update setting"))}finally{h(null)}}};return n?a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-2",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"})," Loading…"]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4 space-y-2",children:[a.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Community post timer limit (in seconds)"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{type:"number",value:s,onChange:f=>i(f.target.value),className:"min-w-0 flex-1 max-w-xs rounded-md border border-border bg-card px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary"}),a.jsxs("button",{disabled:u===YU,onClick:()=>m(YU,Number(s)||0,"Post timer updated"),className:"inline-flex shrink-0 items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-60",children:[u===YU&&a.jsx(Ne,{className:"h-4 w-4 animate-spin"}),"Update"]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Members must wait until the selected time limit has passed to post again."})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4 space-y-2",children:[a.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Community report email"}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx("input",{type:"email",value:o,onChange:f=>l(f.target.value),className:"min-w-0 flex-1 max-w-md rounded-md border border-border bg-card px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary"}),a.jsxs("button",{disabled:u===QU,onClick:()=>m(QU,o.trim(),"Report email updated"),className:"inline-flex shrink-0 items-center gap-1.5 rounded-md bg-primary px-4 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-60",children:[u===QU&&a.jsx(Ne,{className:"h-4 w-4 animate-spin"}),"Update"]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Reports submitted by community members are sent to this email address."})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4 space-y-3",children:[a.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Prevent users from updating their profile"}),a.jsxs("label",{className:"flex items-center gap-3 rounded-md border border-border bg-card px-3 py-2.5 cursor-pointer",children:[a.jsx(ji,{checked:c,disabled:u===Koe,onCheckedChange:f=>{const p=!!f;d(p),m(Koe,p,"Profile update restriction saved")}}),a.jsx("span",{className:"text-sm text-foreground",children:"Restrict users from updating their name and username"})]})]})]})}async function QOt(t){return ae.get(`/community-theme-data/${encodeURIComponent(t)}`)}async function Ebs(t,e){return ae.post(`/community-theme-data/${encodeURIComponent(t)}/toggle`,e)}async function Nbs(){return ae.get("/font-data")}function UXe(t){let e=t.trim();e.startsWith("#")&&(e=e.slice(1));const n=/^([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e);if(!n)throw new Error(`Could not parse hex color: ${t}`);const r=parseInt(n[1],16)/255,s=parseInt(n[2],16)/255,i=parseInt(n[3],16)/255,o=Math.max(r,s,i),l=Math.min(r,s,i),c=(o+l)/2;let d=0,u=0;if(o!==l){const h=o-l;switch(u=c>.5?h/(2-o-l):h/(o+l),o){case r:d=(s-i)/h+(s<i?6:0);break;case s:d=(i-r)/h+2;break;case i:d=(r-s)/h+4;break}d/=6}return{h:Math.round(d*360),s:Math.round(u*100),l:Math.round(c*100)}}const ike="pensil-community-theme-overrides",ake="pensil-community-theme-source",Tbs="#141519",Tf={primaryColor:"#0445FE",onPrimaryColor:"#FFFFFF",darkPrimaryColor:"#0445FE",darkOnPrimaryColor:"#FFFFFF"};function ZOt(t){return t.backgroundColor===Tbs?"dark":"light"}function bg(t){const e=t.trim();if(/^#[0-9a-fA-F]{6}$/.test(e))return e.toUpperCase();if(/^[0-9a-fA-F]{6}$/.test(e))return`#${e.toUpperCase()}`;if(/^#[0-9a-fA-F]{3}$/.test(e)){const n=e.slice(1);return`#${n[0]}${n[0]}${n[1]}${n[1]}${n[2]}${n[2]}`.toUpperCase()}return e}function oke(t){return/^#(?:[0-9a-fA-F]{3}){1,2}$/.test(bg(t))}function oD(t){return typeof t=="string"?t:""}function zXe(t,e,n,r){const s=UXe(e),i=UXe(n),o=`${s.h} ${s.s}% ${s.l}%`,l=`${i.h} ${i.s}% ${i.l}%`,c=r?`${s.h} ${Math.min(s.s,40)}% 20%`:`${s.h} ${Math.min(s.s,40)}% ${Math.min(s.l+45,96)}%`,d=r?`${s.h} ${Math.min(s.s,60)}% 85%`:`${s.h} ${s.s}% ${Math.max(s.l-10,25)}%`;return`
    ${t} {
      --primary: ${o};
      --primary-foreground: ${l};
      --ring: ${o};
      --sidebar-primary: ${o};
      --sidebar-primary-foreground: ${l};
      --sidebar-ring: ${o};
      --accent: ${c};
      --accent-foreground: ${d};
    }
  `}function _bs(t){let e=document.getElementById(ike);e||(e=document.createElement("style"),e.id=ike,document.head.appendChild(e)),e.textContent=zXe(":root",t.primary,t.onPrimary,!1)+zXe(".dark",t.darkPrimary,t.darkOnPrimary,!0)}function Abs(t){const e=(s,i)=>oD(t[s])||i;let n=document.getElementById(ake);n||(n=document.createElement("style"),n.id=ake,document.head.appendChild(n));const r=e("primaryColor",Tf.primaryColor);n.textContent=`
    :root {
      --theme-primary-color: ${r};
      --theme-primary-color-light: ${r}22;
      --theme-dark-primary-color: ${e("darkPrimaryColor",Tf.darkPrimaryColor)};
      --theme-dark-on-primary-color: ${e("darkOnPrimaryColor",Tf.darkOnPrimaryColor)};
      --theme-primary-light-color: ${e("primaryLightColor",`${r}20`)};
      --theme-on-primary-color: ${e("onPrimaryColor",Tf.onPrimaryColor)};
      --theme-background-color: ${e("backgroundColor","#f5f6f8")};
      --theme-on-background-color: ${e("onBackgroundColor","#181818")};
      --theme-surface-color: ${e("surfaceColor","#ffffff")};
      --theme-on-surface-color: ${e("onSurfaceColor","#181818")};
      --theme-default-text-color: ${e("defaultTextColor","#181818")};
      --theme-heading-1-text-color: ${e("heading1TextColor","#181818")};
      --theme-heading-2-text-color: ${e("heading2TextColor","#505050")};
      --theme-subtitle-1-text-color: ${e("subtitle1TextColor","#707070")};
      --theme-subtitle-2-text-color: ${e("subtitle2TextColor","#929292")};
      --theme-disabled-color: ${e("disabledColor","#dddddd")};
      --theme-divider-color: ${e("dividerColor","#bebebe")};
      --theme-border-color: ${e("borderColor","#e5e7eb")};
      --theme-danger-color: ${e("dangerColor","#ff0000")};
      --theme-warning-color: ${e("warningColor","#ff8181")};
      --theme-success-color: ${e("successColor","#00ff00")};
      --theme-info-color: ${e("infoColor","#0000ff")};
    }
  `}function JOt(t,e){Abs(t);try{_bs({primary:oD(t.primaryColor)||Tf.primaryColor,onPrimary:oD(t.onPrimaryColor)||Tf.onPrimaryColor,darkPrimary:oD(t.darkPrimaryColor)||Tf.darkPrimaryColor,darkOnPrimary:oD(t.darkOnPrimaryColor)||Tf.darkOnPrimaryColor})}catch{}if(!Sfr()){const n=e??ZOt(t);document.documentElement.classList.toggle("dark",n==="dark")}}function VXe(){var t,e;(t=document.getElementById(ike))==null||t.remove(),(e=document.getElementById(ake))==null||e.remove()}const XOt=y.createContext(null);function $X(t){return["community-theme",t]}function Pbs({children:t}){var l;const{community:e}=qe(),n=(e==null?void 0:e.id)??null,r=rn(),s=lt({queryKey:$X(n),enabled:!!n,queryFn:()=>QOt(n),staleTime:3e4}),i=y.useCallback(()=>{n&&r.invalidateQueries({queryKey:$X(n)})},[n,r]);y.useEffect(()=>{var c;if(!n){VXe();return}(c=s.data)!=null&&c.themeData&&JOt(s.data.themeData)},[n,(l=s.data)==null?void 0:l.themeData]),y.useEffect(()=>()=>VXe(),[n]);const o=y.useMemo(()=>({refreshTheme:i}),[i]);return a.jsx(XOt.Provider,{value:o,children:t})}function Rbs(){const t=y.useContext(XOt);if(!t)throw new Error("useCommunityTheme must be used within CommunityThemeProvider");return t}function EA(t){return typeof t=="string"?t:""}function HXe(t){return{theme:ZOt(t),primaryColor:bg(EA(t.primaryColor)||Tf.primaryColor),onPrimaryColor:bg(EA(t.onPrimaryColor)||Tf.onPrimaryColor),darkPrimaryColor:bg(EA(t.darkPrimaryColor)||Tf.darkPrimaryColor),darkOnPrimaryColor:bg(EA(t.darkOnPrimaryColor)||Tf.darkOnPrimaryColor)}}function GXe(t,e){return t instanceof ze&&t.status===403?"Only community admins can change this.":dn(t,e)}function Ibs(){var _,T;const{community:t}=qe(),{communityDetail:e,refetchCommunityDetail:n}=Ln(),{refreshTheme:r}=Rbs(),s=rn(),i=(t==null?void 0:t.id)??null,o=y.useRef(!1),l=e==null?void 0:e.configurables,c=EA(l==null?void 0:l[uge]),d=EA(l==null?void 0:l[hge]),u=lt({queryKey:$X(i),enabled:!!i,queryFn:()=>QOt(i),staleTime:3e4}),h=lt({queryKey:["font-data"],queryFn:Nbs,staleTime:1/0}),m=y.useMemo(()=>{var R;return HXe(((R=u.data)==null?void 0:R.themeData)??{})},[(_=u.data)==null?void 0:_.themeData]),[f,p]=y.useState(m),[g,v]=y.useState(c),[b,x]=y.useState(d);y.useEffect(()=>{!u.isSuccess||o.current||p(m)},[u.isSuccess,m,i]),y.useEffect(()=>{o.current=!1},[i]),y.useEffect(()=>{v(c),x(d)},[c,d]);const w=y.useMemo(()=>JSON.stringify(f)!==JSON.stringify(m),[f,m]),k=g!==c||b!==d,S=y.useCallback((R,O)=>{o.current=!0,p(F=>({...F,[R]:O}))},[]),C=y.useCallback(()=>{const R=[["Brand colour (light)",f.primaryColor],["Text on button (light)",f.onPrimaryColor],["Brand colour (dark)",f.darkPrimaryColor],["Text on button (dark)",f.darkOnPrimaryColor]];for(const[O,F]of R)if(!oke(F))return`${O} must be a valid hex colour (e.g. #0445FE).`;return null},[f]),j=jt({mutationFn:async()=>{if(!i)throw new Error("No community selected");const R=C();if(R)throw new Error(R);const O={theme:f.theme,primaryColor:bg(f.primaryColor),onPrimaryColor:bg(f.onPrimaryColor),darkPrimaryColor:bg(f.darkPrimaryColor),darkOnPrimaryColor:bg(f.darkOnPrimaryColor)};return Ebs(i,O)},onSuccess:async R=>{o.current=!1;const O=HXe(R.themeData);p(O),s.setQueryData($X(i),R),JOt(R.themeData,O.theme),r(),i&&await Gxe(i,{customiseCommunity:{communityTheme:!0}}).catch(()=>{})}}),E=jt({mutationFn:async()=>{if(!i)throw new Error("No community selected");if(!g||!b)throw new Error("Select a font before updating.");await D2(i,uge,g),await D2(i,hge,b)},onSuccess:async()=>{await n(),i&&await Gxe(i,{customiseCommunity:{communityFont:!0}}).catch(()=>{})}}),N=y.useCallback(()=>{v(c),x(d)},[c,d]),A=y.useCallback(R=>{v(R.value),x(R.label)},[]);return{communityId:i,isLoading:u.isLoading,isLoadingFonts:h.isLoading,fonts:((T=h.data)==null?void 0:T.fontData)??[],colorDraft:f,setColorField:S,colorsDirty:w,fontLinkDraft:g,fontNameDraft:b,savedFontLink:c,savedFontName:d,fontDirty:k,selectFont:A,resetFontDraft:N,saveColors:j.mutateAsync,saveFont:E.mutateAsync,savingColors:j.isPending,savingFont:E.isPending,colorError:j.error?GXe(j.error,"Failed to save colours"):null,fontError:E.error?GXe(E.error,"Failed to update font"):null,validateColors:C}}function WXe({title:t,children:e,defaultOpen:n=!0}){const[r,s]=y.useState(n);return a.jsxs("div",{className:"rounded-lg border border-border bg-card overflow-hidden",children:[a.jsxs("button",{type:"button",onClick:()=>s(!r),className:"w-full flex items-center justify-between px-5 py-4 hover:bg-muted/50 transition-colors",children:[a.jsx("span",{className:"font-semibold text-foreground",children:t}),a.jsx(li,{className:ee("h-4 w-4 text-muted-foreground transition-transform",r&&"rotate-180")})]}),r&&a.jsx("div",{className:"px-5 pb-5 pt-1 space-y-5",children:e})]})}function UH({label:t,value:e,onChange:n,disabled:r}){const s=y.useRef(null),[i,o]=y.useState(e),l=y.useRef(n);l.current=n;const c=y.useRef(!1);y.useEffect(()=>{c.current||o(e)},[e]),y.useEffect(()=>{const u=s.current;if(!u)return;const h=()=>{c.current=!1,l.current(u.value)};return u.addEventListener("change",h),()=>u.removeEventListener("change",h)},[]);const d=oke(i)?bg(i).toLowerCase():"#0445fe";return a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:t}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("input",{ref:s,type:"color",value:d,disabled:r,onChange:u=>{c.current=!0,o(u.target.value)},className:"sr-only",tabIndex:-1}),a.jsx("button",{type:"button",disabled:r,"aria-label":`Pick ${t}`,onClick:()=>{var u;return(u=s.current)==null?void 0:u.click()},className:"h-10 w-12 shrink-0 rounded-md border border-border shadow-sm cursor-pointer disabled:cursor-not-allowed disabled:opacity-60",style:{backgroundColor:d}}),a.jsx("input",{type:"text",value:i,disabled:r,onChange:u=>o(u.target.value),onBlur:u=>{const h=oke(u.target.value)?bg(u.target.value):u.target.value;o(h),l.current(h)},className:"flex-1 rounded-md border border-border bg-card px-3 py-2 text-sm font-mono uppercase focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary disabled:opacity-60"})]})]})}function Mbs(){const{isLoading:t,isLoadingFonts:e,fonts:n,colorDraft:r,setColorField:s,colorsDirty:i,fontLinkDraft:o,fontNameDraft:l,savedFontLink:c,fontDirty:d,selectFont:u,resetFontDraft:h,saveColors:m,saveFont:f,savingColors:p,savingFont:g,validateColors:v}=Ibs(),b=y.useMemo(()=>n.map(k=>a.jsx(pt,{value:k.value,style:{fontFamily:k.label},children:k.label},k.value)),[n]),x=async()=>{const k=v();if(k){He.error(k);return}try{await m(),He.success("Theme colours updated")}catch(S){He.error(dn(S,"Failed to save colours"))}},w=async()=>{try{await f(),He.success("Community font updated")}catch(k){He.error(dn(k,"Failed to update font"))}};return t?a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-8",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"}),"Loading appearance settings…"]}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Appearance"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Customise the look and feel of your community."})]}),a.jsxs(WXe,{title:"Customise colours",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Default theme"}),a.jsx("div",{className:"grid grid-cols-2 gap-3 max-w-md",children:[{id:"light",label:"Light mode",icon:y9t},{id:"dark",label:"Dark mode",icon:Wrt}].map(k=>{const S=k.icon,C=r.theme===k.id;return a.jsxs("button",{type:"button",disabled:p,onClick:()=>s("theme",k.id),className:ee("flex items-center justify-center gap-2 rounded-lg border px-4 py-3 text-sm font-medium transition-all",C?"border-primary bg-primary/5 text-primary ring-2 ring-primary/20":"border-border bg-card text-foreground hover:border-primary/40"),children:[a.jsx(S,{className:"h-4 w-4"}),k.label]},k.id)})})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4 space-y-4",children:[a.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Light theme colours"}),a.jsx(UH,{label:"Brand colour",value:r.primaryColor,disabled:p,onChange:k=>s("primaryColor",k)}),a.jsx(UH,{label:"Text on button colour",value:r.onPrimaryColor,disabled:p,onChange:k=>s("onPrimaryColor",k)})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-4 space-y-4",children:[a.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Dark theme colours"}),a.jsx(UH,{label:"Brand colour",value:r.darkPrimaryColor,disabled:p,onChange:k=>s("darkPrimaryColor",k)}),a.jsx(UH,{label:"Text on button colour",value:r.darkOnPrimaryColor,disabled:p,onChange:k=>s("darkOnPrimaryColor",k)})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs("button",{type:"button",disabled:p||!i,onClick:x,className:"inline-flex items-center gap-2 rounded-md bg-primary px-5 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-60",children:[p&&a.jsx(Ne,{className:"h-4 w-4 animate-spin"}),"Save changes"]})})]}),a.jsxs(WXe,{title:"Configure font",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Select a font for the community"}),e?a.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground py-2",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"}),"Loading fonts…"]}):a.jsxs(zn,{value:o||void 0,onValueChange:k=>{const S=n.find(C=>C.value===k);S&&u(S)},children:[a.jsx(On,{className:"w-full",children:a.jsx(Vn,{placeholder:l||"Select a font…"})}),a.jsx(Fn,{className:"max-h-72",children:b})]})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsxs("button",{type:"button",disabled:g||!d||!o,onClick:w,className:"inline-flex items-center gap-2 rounded-md bg-primary px-5 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-60",children:[g&&a.jsx(Ne,{className:"h-4 w-4 animate-spin"}),"Update"]}),a.jsx("button",{type:"button",disabled:g||!d&&!c,onClick:h,className:"rounded-md border border-border bg-card px-5 py-2 text-sm font-medium text-foreground hover:bg-muted transition-colors disabled:opacity-60",children:"Reset"})]})]})]})}const Lbs=[{key:"webLink",label:"Website",placeholder:"https://yoursite.com"},{key:"linkedinLink",label:"LinkedIn",placeholder:"https://linkedin.com/in/…"},{key:"twitterLink",label:"Twitter / X",placeholder:"https://x.com/…"},{key:"instagramLink",label:"Instagram",placeholder:"https://instagram.com/…"},{key:"facebookLink",label:"Facebook",placeholder:"https://facebook.com/…"},{key:"youtubeLink",label:"YouTube",placeholder:"https://youtube.com/@…"},{key:"dribbbleLink",label:"Dribbble",placeholder:"https://dribbble.com/…"},{key:"behanceLink",label:"Behance",placeholder:"https://behance.net/…"},{key:"pintrestLink",label:"Pinterest",placeholder:"https://pinterest.com/…"}];function Dbs(){const t=rn(),{data:e,isLoading:n}=lt({queryKey:["my-profile"],queryFn:lCe,staleTime:15e3}),[r,s]=y.useState({}),[i,o]=y.useState(null),[l,c]=y.useState(!1),[d,u]=y.useState(!1),h=y.useRef(null),[m,f]=y.useState("idle"),p=(e==null?void 0:e.userId)??"";y.useEffect(()=>{e&&(s({name:e.name??"",shortBio:e.shortBio??"",userId:e.userId??"",bio:e.bio??"",location:e.location??"",webLink:e.webLink??"",linkedinLink:e.linkedinLink??"",twitterLink:e.twitterLink??"",instagramLink:e.instagramLink??"",facebookLink:e.facebookLink??"",youtubeLink:e.youtubeLink??"",dribbbleLink:e.dribbbleLink??"",behanceLink:e.behanceLink??"",pintrestLink:e.pintrestLink??""}),o(e.picture??null))},[e]),y.useEffect(()=>{const x=(r.userId??"").trim();if(!x||x===p){f("idle");return}f("checking");const w=setTimeout(async()=>{try{const k=await dCe(x);f(k?"ok":"taken")}catch{f("idle")}},400);return()=>clearTimeout(w)},[r.userId,p]);const g=(x,w)=>s(k=>({...k,[x]:w})),v=async x=>{if(!x.type.startsWith("image/")){He.error("Please upload an image file");return}c(!0);try{const w=await uCe(x);o(w.picture??null),await t.invalidateQueries({queryKey:["my-profile"]}),He.success("Profile picture updated")}catch(w){He.error(dn(w,"Failed to upload picture"))}finally{c(!1)}},b=async()=>{var x;if(!((x=r.name)!=null&&x.trim())){He.error("Your name can't be empty");return}if(m==="taken"){He.error("That user ID is already taken");return}u(!0);try{await cCe(r),await t.invalidateQueries({queryKey:["my-profile"]}),f("idle"),He.success("Profile saved")}catch(w){const k=w instanceof ze&&w.status===403?"You don't have permission to update this profile.":dn(w,"Failed to save profile");He.error(k)}finally{u(!1)}};return n?a.jsx("div",{className:"flex items-center justify-center py-20 text-muted-foreground",children:a.jsx(Ne,{className:"h-5 w-5 animate-spin"})}):a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Profile"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Manage how you appear across the community."})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-6 flex flex-col items-center gap-3",children:[a.jsx("input",{ref:h,type:"file",accept:"image/*",className:"hidden",onChange:x=>{var w;return((w=x.target.files)==null?void 0:w[0])&&v(x.target.files[0])}}),a.jsxs("button",{onClick:()=>{var x;return(x=h.current)==null?void 0:x.click()},disabled:l,className:"relative h-24 w-24 rounded-full overflow-hidden border-2 border-border bg-card flex items-center justify-center group",children:[i?a.jsx("img",{src:i,alt:"Profile",className:"h-full w-full object-cover"}):a.jsx(FP,{className:"h-8 w-8 text-muted-foreground"}),a.jsx("div",{className:"absolute inset-0 bg-black/40 opacity-0 group-hover:opacity-100 transition-opacity flex items-center justify-center",children:l?a.jsx(Ne,{className:"h-6 w-6 text-white animate-spin"}):a.jsx(FP,{className:"h-6 w-6 text-white"})})]}),a.jsx("button",{onClick:()=>{var x;return(x=h.current)==null?void 0:x.click()},disabled:l,className:"text-sm font-medium text-primary hover:underline disabled:opacity-50",children:"Set profile picture"})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-card p-6 space-y-5",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Your name"}),a.jsx("input",{type:"text",value:r.name??"",onChange:x=>g("name",x.target.value),className:"w-full rounded-lg border border-border bg-background px-4 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{className:"text-sm font-medium text-foreground",children:["Subtitle ",a.jsx("span",{className:"text-xs text-muted-foreground font-normal",children:"(max. 60 characters)"})]}),a.jsx("input",{type:"text",value:r.shortBio??"",maxLength:60,onChange:x=>g("shortBio",x.target.value),className:"w-full rounded-lg border border-border bg-background px-4 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsxs("label",{className:"text-sm font-medium text-foreground flex items-center gap-2",children:["User ID",m==="checking"&&a.jsx(Ne,{className:"h-4 w-4 animate-spin text-muted-foreground"}),m==="ok"&&a.jsx(yo,{className:"h-4 w-4 text-green-600 fill-green-600/15"}),m==="idle"&&(r.userId??"")===p&&p&&a.jsx(yo,{className:"h-4 w-4 text-green-600 fill-green-600/15"}),m==="taken"&&a.jsx(oh,{className:"h-4 w-4 text-destructive"})]}),a.jsx("input",{type:"text",value:r.userId??"",onChange:x=>g("userId",x.target.value.toLowerCase().replace(/\s+/g,"")),className:"w-full rounded-lg border border-border bg-background px-4 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary"}),m==="taken"&&a.jsx("p",{className:"text-xs text-destructive",children:"This user ID is already taken."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Location"}),a.jsx("input",{type:"text",value:r.location??"",onChange:x=>g("location",x.target.value),placeholder:"City, Country",className:"w-full rounded-lg border border-border bg-background px-4 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary"})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Short bio"}),a.jsx("textarea",{value:r.bio??"",onChange:x=>g("bio",x.target.value),rows:6,className:"w-full rounded-lg border border-border bg-background px-4 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary resize-none"})]})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-card p-6 space-y-5",children:[a.jsx("h3",{className:"font-semibold text-foreground",children:"Social links"}),a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:Lbs.map(x=>a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:x.label}),a.jsx("input",{type:"url",value:r[x.key]??"",onChange:w=>g(x.key,w.target.value),placeholder:x.placeholder,className:"w-full rounded-lg border border-border bg-background px-4 py-2.5 text-sm focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary"})]},x.key))})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs("button",{onClick:b,disabled:d||m==="checking",className:"inline-flex items-center gap-1.5 rounded-md bg-primary px-5 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50",children:[d&&a.jsx(Ne,{className:"h-4 w-4 animate-spin"}),"Save changes"]})})]})}const qXe=[{key:"postComment",label:"Notify me about comments on my posts"},{key:"commentReply",label:"Notify me about replies to my comments"},{key:"postLike",label:"Notify me about likes on my posts"},{key:"commentReaction",label:"Notify me about reactions to my comments"},{key:"replyReaction",label:"Notify me about reactions to my replies"},{key:"directMessage",label:"Notify me about direct messages"},{key:"mention",label:"Notify me about mentions"}],KXe=["all","admin","none"],lke="grid grid-cols-[minmax(0,1fr)_5rem_5rem_5rem_2.25rem] items-center";function $bs(){const{community:t}=qe(),e=t==null?void 0:t.id,{groups:n,groupsLoading:r,notificationPreferences:s,notificationPreferencesLoading:i}=Ln(),o=i||r;return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Notification Centre"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Manage your personal account notification preferences."})]}),o||!s||!e?a.jsxs("div",{className:"space-y-3",children:[a.jsx(sr,{className:"h-72 w-full rounded-lg"}),a.jsx(sr,{className:"h-48 w-full rounded-lg"})]}):a.jsxs(a.Fragment,{children:[a.jsx(Obs,{communityId:e,preferences:s}),a.jsx(Fbs,{communityId:e,groups:n,preferences:s})]})]})}function Obs({communityId:t,preferences:e}){const n=rn(),[r,s]=y.useState(()=>YXe(e));y.useEffect(()=>{s(YXe(e))},[e]);const i=jt({mutationFn:()=>tse(t,r),onSuccess:o=>{n.setQueryData(["notification-preferences",t],o),He.success("Notification preferences updated")},onError:()=>He.error("Couldn't update preferences")});return a.jsxs("div",{className:"rounded-lg border border-border bg-card overflow-hidden",children:[a.jsxs("div",{className:"grid grid-cols-[1fr_auto] gap-4 px-5 py-3 bg-muted/50 border-b border-border",children:[a.jsx("div",{className:"text-sm font-semibold text-foreground",children:"Preferences"}),a.jsx("div",{className:"text-sm font-semibold text-foreground w-28 text-center",children:"Email notification"})]}),qXe.map((o,l)=>a.jsxs("label",{className:ee("grid grid-cols-[1fr_auto] gap-4 items-center px-5 py-3.5 cursor-pointer",l!==qXe.length-1&&"border-b border-border"),children:[a.jsx("span",{className:"text-sm text-foreground",children:o.label}),a.jsx("span",{className:"w-28 flex justify-center",children:a.jsx(ji,{checked:r[o.key],onCheckedChange:c=>s(d=>({...d,[o.key]:!!c}))})})]},o.key)),a.jsx("div",{className:"flex justify-end px-5 py-4 border-t border-border",children:a.jsx("button",{onClick:()=>i.mutate(),disabled:i.isPending,className:"rounded-md bg-primary px-5 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50",children:i.isPending?"Saving…":"Save"})})]})}function YXe(t){return{postComment:t.postComment,commentReply:t.commentReply,postLike:t.postLike,commentReaction:t.commentReaction,replyReaction:t.replyReaction,directMessage:t.directMessage,mention:t.mention}}function Fbs({communityId:t,groups:e,preferences:n}){const r=rn(),s=y.useMemo(()=>e.filter(d=>d.joinStatus==="joined"&&Array.isArray(d.tabs)&&d.tabs.some(u=>u.isJoined||!u.isClosed)),[e]),[i,o]=y.useState(n.tabs??[]);y.useEffect(()=>{o(n.tabs??[])},[n.tabs]);const l=jt({mutationFn:()=>tse(t,{tabs:i}),onSuccess:d=>{r.setQueryData(["notification-preferences",t],d),He.success("Notification preferences updated")},onError:()=>He.error("Couldn't update preferences")}),c=(d,u)=>{o(h=>[...h.filter(f=>f.groupId!==d),...u])};return a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-foreground",children:"Notifications for new posts"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Only groups and channels you are part of are shown. You can control notifications per channel."})]}),a.jsxs("div",{className:"rounded-lg border border-border bg-card overflow-hidden",children:[a.jsxs("div",{className:ee(lke,"px-5 py-3 bg-muted/50 border-b border-border text-xs font-semibold text-foreground"),children:[a.jsx("div",{children:"Groups & channels"}),a.jsx("div",{className:"text-center",children:"All activity"}),a.jsx("div",{className:"text-center",children:"Post by admin"}),a.jsx("div",{className:"text-center",children:"No notifications"}),a.jsx("div",{})]}),s.length>0?s.map(d=>a.jsx(Bbs,{group:d,tabsPreference:i,onChange:u=>c(d.id,u)},d.id)):a.jsx("div",{className:"px-5 py-6 text-center text-sm text-muted-foreground",children:"You haven't joined any group yet. Join a group to enable notifications."})]}),s.length>0&&a.jsx("div",{className:"flex justify-end",children:a.jsx("button",{onClick:()=>l.mutate(),disabled:l.isPending,className:"rounded-md bg-primary px-5 py-2 text-sm font-medium text-primary-foreground hover:bg-primary/90 transition-colors disabled:opacity-50",children:l.isPending?"Saving…":"Save"})})]})}function Bbs({group:t,tabsPreference:e,onChange:n}){const[r,s]=y.useState(!1),[i,o]=y.useState([]),l=y.useMemo(()=>(t.tabs??[]).filter(p=>p.isJoined||!p.isClosed),[t.tabs]);if(y.useEffect(()=>{const p=e.filter(g=>g.groupId===t.id);o(l.map(g=>{const v=p.find(b=>b.tabId===g.id);return{id:g.id,type:v?v.notificationLevel:"all"}}))},[t.id,l]),!l.length)return null;const c=p=>{n(p.map(g=>({groupId:t.id,tabId:g.id,notificationLevel:g.type})))},d=p=>i.length===l.length&&i.length>0&&i.every(g=>g.type===p),u=p=>i.some(g=>g.type===p),h=p=>{if(d(p))o([]),c([]);else{const g=l.map(v=>({id:v.id,type:p}));o(g),c(g)}s(!0)},m=(p,g)=>{const v=i.some(b=>b.id===p.id)?i.map(b=>b.id===p.id?{...b,type:g}:b):[...i,{id:p.id,type:g}];o(v),c(v)},f=p=>{var g;return((g=i.find(v=>v.id===p))==null?void 0:g.type)??""};return a.jsxs("div",{className:"border-b border-border last:border-b-0",children:[a.jsxs("div",{className:ee(lke,"px-5 py-3"),children:[a.jsx("button",{type:"button",className:"text-left text-sm font-semibold text-foreground truncate",onClick:()=>s(p=>!p),children:t.name}),KXe.map(p=>a.jsx("div",{className:"flex justify-center",children:a.jsx(ji,{checked:d(p)?!0:u(p)?"indeterminate":!1,onCheckedChange:()=>h(p)})},p)),a.jsx("button",{type:"button",className:"flex justify-center text-muted-foreground",onClick:()=>s(p=>!p),"aria-label":r?"Collapse":"Expand",children:a.jsx(li,{className:ee("h-4 w-4 transition-transform",r&&"rotate-180")})})]}),r&&l.map(p=>a.jsxs("div",{className:ee(lke,"px-5 py-2.5 bg-muted/20 border-t border-border"),children:[a.jsxs("span",{className:"truncate pl-3 text-sm text-muted-foreground",children:["# ",p.name]}),a.jsx(TS,{className:"contents",value:f(p.id),onValueChange:g=>m(p,g),children:KXe.map(g=>a.jsx("div",{className:"flex justify-center",children:a.jsx(Ly,{value:g})},g))}),a.jsx("div",{})]},p.id))]})}function Ubs(){var f,p;const{community:t}=qe(),{toast:e}=yt(),n=rn(),r=(t==null?void 0:t.id)??null,s=["community-email-preferences",r],[i,o]=y.useState(null),l=lt({queryKey:s,queryFn:()=>cjt(r),enabled:!!r,staleTime:15e3}),c=jt({mutationFn:g=>Oxe(r,g),onSuccess:g=>{n.setQueryData(s,g)},onError:g=>{e({title:"Couldn't save that",description:g instanceof ze?g.message:"Please try again.",variant:"destructive"}),n.invalidateQueries({queryKey:s})},onSettled:()=>o(null)});if(!r)return a.jsx("div",{className:"rounded-lg border border-border bg-card p-8 text-center",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"Open a community to manage its emails."})});if(l.isLoading)return a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-card p-8 text-sm text-muted-foreground",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"})," Loading your email preferences…"]});if(l.isError)return a.jsxs("div",{role:"alert",className:"space-y-3 rounded-lg border border-border bg-card p-8 text-center",children:[a.jsx("p",{className:"text-sm",children:"Could not load your email preferences."}),a.jsx(Z,{variant:"outline",onClick:()=>void l.refetch(),children:"Retry"})]});const d=(f=l.data)==null?void 0:f.preferences,u=((p=l.data)==null?void 0:p.community.name)||(t==null?void 0:t.name)||"this community";if(!d)return null;const h=g=>c.isPending&&i===g,m=(g,v)=>{o(g),c.mutate(v)};return a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{className:"rounded-lg border border-border bg-card",children:[a.jsxs("div",{className:"flex items-start gap-3 border-b border-border p-5",children:[a.jsx(Ii,{className:"mt-0.5 h-5 w-5 shrink-0 text-muted-foreground"}),a.jsxs("div",{children:[a.jsxs("h2",{className:"text-sm font-semibold text-foreground",children:["Emails from ",u]}),a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Choose what this community sends you. These settings only affect"," ",u," — other communities you belong to are not changed."]})]})]}),d.offAll?a.jsxs("div",{className:"space-y-3 p-5",children:[a.jsxs("p",{className:"text-sm text-foreground",children:["You've turned off all emails from ",u,"."]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"You'll still get replies, event reminders and account emails — those are in Notification Centre."}),a.jsx(Z,{disabled:h("all-on"),onClick:()=>m("all-on",{offAll:!1,adminEmails:!0}),children:h("all-on")?"Turning back on…":`Turn emails from ${u} back on`})]}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"divide-y divide-border",children:[a.jsx("p",{className:"bg-muted/30 px-5 py-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Newsletters"}),d.newsletters.length===0?a.jsxs("p",{className:"p-5 text-sm text-muted-foreground",children:[u," doesn't have any newsletters yet."]}):d.newsletters.map(g=>a.jsxs("div",{className:"flex items-center justify-between gap-4 p-5",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx(_e,{htmlFor:`nl-${g.id}`,className:"text-sm text-foreground",children:g.title}),a.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:g.description||"Newsletter"})]}),a.jsx(Hs,{id:`nl-${g.id}`,checked:g.subscribed,disabled:h(g.id),onCheckedChange:v=>m(g.id,{newsletters:{[g.id]:v===!0}})})]},g.id)),a.jsx("p",{className:"bg-muted/30 px-5 py-2 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Campaigns"}),a.jsxs("div",{className:"flex items-center justify-between gap-4 p-5",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx(_e,{htmlFor:"admin-emails",className:"text-sm text-foreground",children:"Email campaigns"}),a.jsxs("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["Announcements, offers and other one-off campaigns from the ",u," ","team. Turn this off and you'll stop receiving them, but you'll keep any newsletters above that you're still subscribed to."]})]}),a.jsx(Hs,{id:"admin-emails",checked:d.adminEmails,disabled:h("admin-emails"),onCheckedChange:g=>m("admin-emails",{adminEmails:g===!0})})]})]}),a.jsxs("div",{className:"border-t border-border p-5",children:[a.jsx(Z,{variant:"outline",className:"h-auto min-h-10 max-w-full whitespace-normal py-2",disabled:h("all-off"),onClick:()=>m("all-off",{offAll:!0,adminEmails:!1}),children:h("all-off")?"Turning off…":`Unsubscribe from all emails from ${u}`}),a.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Replies, event reminders and account emails like login codes are separate — manage those in Notification Centre."})]})]})]})})}function zbs({communityId:t,plans:e,interval:n,currentPlan:r,onChanged:s,purchaseBlocked:i=!1}){const[o,l]=y.useState(!1),c=lt({queryKey:["apple-billing-products",t],queryFn:()=>Wpr(t),retry:!1});async function d(u){if(!o){l(!0);try{await u()}catch(h){He.error(dn(h,"Apple billing is unavailable. Please try again."))}finally{l(!1),s()}}}return a.jsxs("div",{className:"space-y-4",children:[a.jsx("p",{className:"text-sm text-muted-foreground",children:"Subscriptions purchased here are billed by Apple and renew automatically until cancelled in your App Store subscription settings."}),a.jsxs("div",{className:"flex flex-wrap gap-3",children:[a.jsx("button",{className:"text-sm text-primary underline disabled:opacity-50",disabled:o,onClick:()=>void d(async()=>{const u=await Kpr(t);u.failed?He.error("Some purchases could not be restored. Check your account and community, then try again."):u.restored?He.success("Purchases restored"):He.info("No active purchases found for this community.")}),children:"Restore purchases"}),a.jsx("button",{className:"text-sm text-primary underline disabled:opacity-50",disabled:o,onClick:()=>void d(async()=>{await fse().bridge.manageSubscriptions()}),children:"Manage Apple subscription"})]}),c.isPending?a.jsx("p",{role:"status",children:"Loading App Store plans…"}):c.isError?a.jsxs("div",{role:"alert",className:"text-sm",children:[a.jsx("p",{children:"Apple purchases are currently unavailable."}),a.jsx("button",{className:"text-primary underline",onClick:()=>void c.refetch(),children:"Retry"})]}):a.jsx("div",{className:"grid gap-4 sm:grid-cols-3",children:e.filter(u=>(u.interval??"month")===n).map(u=>{var m,f;const h=(m=c.data)==null?void 0:m.find(p=>p.planCode===u.code);return a.jsxs("div",{className:"flex flex-col rounded-xl border border-border bg-card p-5",children:[a.jsx("h4",{className:"font-semibold",children:u.name}),a.jsx("p",{className:"mt-2 text-2xl font-bold",children:h?`${h.displayPrice}/${n==="year"?"yr":"mo"}`:"Unavailable on the App Store"}),u.description&&a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:u.description}),a.jsx("ul",{className:"my-4 space-y-2 text-sm text-muted-foreground",children:(f=u.features)==null?void 0:f.map(p=>a.jsx("li",{children:p},p))}),a.jsx("button",{disabled:o||i||!h||r===u.code,className:"mt-auto rounded-md bg-primary px-3 py-2 text-sm text-primary-foreground disabled:opacity-50",onClick:()=>h&&void d(async()=>{const p=await qpr(t,h.id);p.status==="pending"&&He.info("Purchase is awaiting Apple approval. Restore purchases after approval to refresh your plan."),p.status==="purchased"&&(p.active?He.success("Your plan has been updated"):He.info("Purchase verified. No active subscription is available."))}),children:o?"Please wait…":r===u.code?"Current plan":"Subscribe with Apple"})]},u.code)})})]})}const WIe=t=>`/billing/community/${encodeURIComponent(t)}`,Vbs=t=>ae.get(WIe(t)),Hbs=t=>ae.post(`${WIe(t)}/cancel-renewal`,{}),Gbs=(t,e)=>ae.post(`${WIe(t)}/cancel-checkout`,{attemptId:e});function Bq(t){if(!t)return"—";const e=new Date(t);return Number.isNaN(e.getTime())?"—":e.toLocaleDateString(void 0,{year:"numeric",month:"short",day:"numeric"})}function Wbs({plan:t}){return a.jsxs("div",{className:"rounded-lg border border-border bg-card p-5",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Current plan"}),a.jsxs("div",{className:"mt-1 flex flex-wrap items-center gap-2",children:[a.jsx("span",{className:"text-xl font-semibold text-foreground",children:t.name}),a.jsx("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",children:"Custom agreement"})]}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:t.expiresAt?`Active until ${Bq(t.expiresAt)}`:"Active"})]}),a.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-primary/10 px-2.5 py-1 text-xs font-medium text-primary",children:[a.jsx(vk,{className:"h-3.5 w-3.5"})," Active"]})]}),t.description&&a.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:t.description}),t.features.length>0&&a.jsx("ul",{className:"mt-4 grid gap-2 sm:grid-cols-2",children:t.features.map(e=>a.jsxs("li",{className:"flex items-center gap-2 text-sm text-foreground",children:[a.jsx(Qn,{className:"h-4 w-4 shrink-0 text-primary"})," ",e]},e))}),a.jsxs("p",{className:"mt-4 border-t border-border pt-4 text-sm text-muted-foreground",children:["Your plan is managed by the SpatialChat Communities team. To change or renew it, contact"," ",a.jsx("a",{href:`mailto:${cR}`,className:"font-medium text-primary hover:underline",children:cR}),"."]})]})}function qbs(){var E,N,A,_,T,R,O,F,D,I,P,M,z,G;const{community:t}=qe(),e=t==null?void 0:t.id,{communityDetail:n,refetchCommunityDetail:r}=Ln(),s=FAe(),[i,o]=y.useState("month"),l=lt({queryKey:["community-billing",e],queryFn:()=>Vbs(e),enabled:!!e,retry:!1,refetchOnWindowFocus:"always"}),c=()=>{l.refetch(),r()},d=rn(),u=l.data?`${l.data.planType??""}|${l.data.expiresAt??""}`:null;y.useEffect(()=>{u!==null&&d.invalidateQueries({queryKey:["community-pac",e]})},[u,e,d]);const[h,m]=xc(),f=y.useRef(!1);y.useEffect(()=>{const B=h.get("action"),H=h.get("canceled")==="true";if(f.current||B!=="subscription-success"&&!H)return;f.current=!0,B==="subscription-success"?He.success("Your plan has been updated"):He.info("Checkout was cancelled. No payment was taken."),c();const W=new URLSearchParams(h);W.delete("action"),W.delete("session_id"),W.delete("canceled"),W.get("tab")||W.set("tab","billing"),m(W,{replace:!0})},[c,h,m]);const p=jt({mutationFn:B=>B==="renewal"?Hbs(e):Gbs(e,l.data.pendingAttemptId),onSuccess:c,onError:B=>He.error(dn(B,"We couldn't update your billing. Please try again."))}),g=s?"apple":"stripe",v=!l.data||l.isError||!!(l.data.provider&&l.data.provider!==g&&!l.data.canSwitchProvider),b=v||!!((E=l.data)!=null&&E.pendingProvider&&(s||l.data.pendingProvider!=="stripe")),x={planType:((N=l.data)==null?void 0:N.planType)??(n==null?void 0:n.planType)??null,planExpiryDate:((A=l.data)==null?void 0:A.expiresAt)??(n==null?void 0:n.planExpiryDate)??null,isPlanExpired:(_=l.data)!=null&&_.expiresAt?new Date(l.data.expiresAt).getTime()<=Date.now():!!(n!=null&&n.isPlanExpired)},w=lt({queryKey:["community-plans",e],queryFn:()=>Jjt(e),enabled:!!e,staleTime:5*6e4}),k=y.useMemo(()=>w.data??[],[w.data]),S=k.find(B=>B.code===x.planType)??null,C=k.filter(B=>(B.interval??"month")===i),j=jt({mutationFn:B=>Ddr(e,B),onSuccess:B=>{B?window.location.href=B:He.error("Couldn't start checkout")},onError:B=>{He.error(dn(B,"We couldn't complete that billing change. Please try again.")),c()}});return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Billing & plan"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Manage your community's subscription plan with SpatialChat Communities."})]}),(T=l.data)!=null&&T.managedPlan?a.jsx(Wbs,{plan:l.data.managedPlan}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"rounded-lg border border-border bg-card p-5",children:a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-wider text-muted-foreground",children:"Current plan"}),a.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[a.jsx("span",{className:"text-xl font-semibold text-foreground",children:(S==null?void 0:S.name)??(x.planType?x.planType:"No active plan")}),S&&!s&&a.jsx("span",{className:"rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary",children:u0e(S)})]}),a.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:[x.isPlanExpired?"Expired on ":"Access until ",Bq(x.planExpiryDate)]})]}),x.isPlanExpired?a.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-destructive/10 px-2.5 py-1 text-xs font-medium text-destructive",children:[a.jsx(Bf,{className:"h-3.5 w-3.5"})," Expired"]}):x.planType?a.jsxs("span",{className:"inline-flex items-center gap-1 rounded-full bg-primary/10 px-2.5 py-1 text-xs font-medium text-primary",children:[a.jsx(vk,{className:"h-3.5 w-3.5"})," Active"]}):null]})}),a.jsxs("div",{className:"space-y-2 text-sm text-muted-foreground",children:[l.isPending&&a.jsx("p",{role:"status",children:"Checking subscription status…"}),l.isError&&a.jsxs("p",{role:"alert",children:["Unable to verify billing. ",dn(l.error,"Refresh before purchasing.")]}),((R=l.data)==null?void 0:R.provider)&&a.jsxs("p",{children:["Billed through ",l.data.provider==="apple"?"Apple":"Stripe",". ",l.data.autoRenew?"Automatic renewal is on.":"Automatic renewal is off."]}),((O=l.data)==null?void 0:O.provider)==="stripe"&&l.data.autoRenew&&!x.isPlanExpired&&a.jsxs("p",{children:["To upgrade, cancel the current subscription and start a new one after the paid period ends on ",Bq(l.data.expiresAt),"."]}),((F=l.data)==null?void 0:F.provider)==="stripe"&&l.data.autoRenew===!1&&!x.isPlanExpired&&a.jsxs("p",{children:["This subscription is cancelled. After ",Bq(l.data.expiresAt)," you can start a new subscription."]}),v&&l.data&&a.jsx("p",{children:"To switch billing providers, cancel renewal with your current provider and wait for the subscription to expire."}),((D=l.data)==null?void 0:D.pendingProvider)==="apple"&&a.jsxs("p",{children:["A pending Apple purchase is open."," ",l.data.canCancelCheckout?"Cancel it if the App Store purchase was not completed. Otherwise it releases automatically after 15 minutes.":"Use Restore purchases in the iOS app after approval. An unfinished purchase releases automatically after 15 minutes."]}),((I=l.data)==null?void 0:I.pendingProvider)==="stripe"&&a.jsx("p",{children:"A Stripe checkout is open. Resume checkout or cancel it before choosing another payment provider."}),((P=l.data)==null?void 0:P.provider)==="apple"&&!s&&a.jsx("p",{children:"Manage your Apple subscription in the iOS app or App Store subscription settings."}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2 pt-2",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",onClick:c,disabled:l.isFetching,children:[a.jsx(Nl,{className:ee("h-3.5 w-3.5",l.isFetching&&"animate-spin")}),l.isFetching?"Refreshing…":"Refresh billing"]}),((M=l.data)==null?void 0:M.provider)==="stripe"&&l.data.autoRenew&&a.jsx(Z,{type:"button",variant:"outline",size:"sm",disabled:p.isPending,onClick:()=>{window.confirm("Cancel automatic renewal? Access continues until the paid period ends.")&&p.mutate("renewal")},children:p.isPending&&p.variables==="renewal"?"Cancelling…":"Cancel renewal"}),((z=l.data)==null?void 0:z.canCancelCheckout)&&a.jsx(Z,{type:"button",variant:"outline",size:"sm",disabled:p.isPending,onClick:()=>p.mutate("checkout"),children:p.isPending&&p.variables==="checkout"?"Cancelling…":((G=l.data)==null?void 0:G.pendingProvider)==="apple"?"Cancel pending purchase":"Cancel open checkout"})]})]}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx("h3",{className:"font-semibold text-foreground",children:"Available plans"}),a.jsx("div",{className:"inline-flex rounded-lg border border-border bg-card p-0.5",children:["month","year"].map(B=>a.jsx("button",{onClick:()=>o(B),className:ee("rounded-md px-3 py-1.5 text-sm font-medium transition-colors",i===B?"bg-primary text-primary-foreground":"text-muted-foreground hover:text-foreground"),children:B==="month"?"Monthly":"Annual"},B))})]}),s&&e?a.jsx(zbs,{communityId:e,plans:k,interval:i,currentPlan:x.isPlanExpired?null:x.planType,onChanged:c,purchaseBlocked:b}):w.isLoading?a.jsx("div",{className:"grid gap-4 sm:grid-cols-3",children:Array.from({length:3}).map((B,H)=>a.jsx(sr,{className:"h-52 w-full rounded-xl"},H))}):a.jsxs("div",{className:"grid items-stretch gap-4 sm:grid-cols-3",children:[C.map(B=>{var V;const H=B.code===x.planType&&!x.isPlanExpired,W=!!B.highlight&&!H;return a.jsxs("div",{className:ee("relative flex flex-col rounded-xl border p-5",H?"border-primary ring-1 ring-primary/30 bg-primary/[0.03]":W?"border-primary shadow-md bg-card":"border-border bg-card"),children:[W&&a.jsx("span",{className:"absolute -top-2.5 left-1/2 -translate-x-1/2 rounded-full bg-primary px-2.5 py-0.5 text-[10px] font-semibold uppercase tracking-wide text-primary-foreground",children:"Most popular"}),a.jsx("div",{className:"text-base font-semibold text-foreground",children:B.name}),B.description&&a.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:B.description}),a.jsx("div",{className:"mt-2 flex items-baseline gap-1",children:a.jsx("span",{className:"text-2xl font-bold text-foreground",children:u0e(B)})}),B.interval==="year"&&a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Billed annually"}),(((V=B.features)==null?void 0:V.length)??0)>0&&a.jsx("ul",{className:"mt-4 space-y-2",children:B.features.map(U=>a.jsxs("li",{className:"flex items-start gap-2 text-xs text-muted-foreground",children:[a.jsx(Qn,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-primary"}),a.jsx("span",{children:U})]},U))}),a.jsx("div",{className:"mt-auto pt-5",children:H?a.jsxs("div",{className:"flex items-center justify-center gap-1.5 rounded-md bg-primary/10 py-2 text-sm font-medium text-primary",children:[a.jsx(Qn,{className:"h-4 w-4"})," Current plan"]}):a.jsx("button",{onClick:()=>j.mutate(B.code),disabled:j.isPending||b,className:ee("w-full rounded-md py-2 text-sm font-medium transition-colors disabled:opacity-50",W?"bg-primary text-primary-foreground hover:bg-primary/90":"border border-primary/40 text-primary hover:bg-primary/5"),children:j.isPending&&j.variables===B.code?"Redirecting…":"Upgrade"})})]},B.code)}),C.length===0&&a.jsxs("p",{className:"text-sm text-muted-foreground",children:["No ",i==="month"?"monthly":"annual"," plans available."]})]})]})]})}function Kbs(){var i,o,l,c,d;const{community:t}=qe(),e=t==null?void 0:t.id,n=rn(),r=lt({queryKey:["my-membership",e],queryFn:()=>Odr(e),enabled:!!e,staleTime:3e4}),s=jt({mutationFn:u=>Fdr(e,u),onSuccess:()=>{n.invalidateQueries({queryKey:["my-membership",e]}),n.invalidateQueries({queryKey:["knowledge-my-subscription",e]})}});return{subscriptions:((i=r.data)==null?void 0:i.activeSubscriptions)??((o=r.data)==null?void 0:o.subscriptions)??((l=r.data)!=null&&l.subscription?[r.data.subscription]:[]),inactiveSubscriptions:((c=r.data)==null?void 0:c.inactiveSubscriptions)??[],subscription:((d=r.data)==null?void 0:d.subscription)??null,isLoading:r.isLoading,refetch:r.refetch,cancel:s.mutateAsync,isCancelling:s.isPending,cancellingSubscriptionId:s.variables??null}}function Ybs(t,e){if(!t||!e)return"—";const n=new Date(t),r=new Date(n);return r.setMonth(r.getMonth()+e),r.toLocaleDateString("en-US",{day:"numeric",month:"long",year:"numeric"})}function Qbs(t){if(!t)return null;const e=new Date(t);return Number.isNaN(e.getTime())?null:e.toLocaleDateString("en-US",{day:"numeric",month:"long",year:"numeric"})}function Zbs(t,e,n){return e?"Inactive":t.managedByAccessGroup?"Access pass":n.isRecurring?t.cancelAtPeriodEnd?"Ending":"Active":"One-time"}function Jbs({plan:t}){const e=YRe(t);return e.length===0?null:a.jsxs("div",{className:"mt-4",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Includes"}),a.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:e.map(n=>a.jsx("span",{className:"inline-flex max-w-full truncate rounded-full bg-muted px-2.5 py-1 text-xs text-foreground",children:n.name},n.id))})]})}function QXe(t){const e=t.subscriptionPlan,n=Qbs(t.accessEndsAt);return n||(e!=null&&e.isRecurring?Ybs(t.createdAt??e.createdAt,e.recurringInterval):null)}function Xbs(){var h;const{toast:t}=yt(),{subscriptions:e,inactiveSubscriptions:n,isLoading:r,cancel:s,isCancelling:i,cancellingSubscriptionId:o}=Kbs(),[l,c]=y.useState(null),d=async()=>{if(l)try{await s(l.id),t({title:"Subscription cancelled",description:"You will retain access until the end of your current billing period."}),c(null)}catch(m){t({title:"Could not cancel subscription",description:m instanceof ze?Dt(m.body,m.message):"Try again.",variant:"destructive"})}};if(r)return a.jsx("div",{className:"flex justify-center py-16",children:a.jsx(Ne,{className:"h-6 w-6 animate-spin text-muted-foreground"})});const u=(m,{inactive:f=!1}={})=>m.length===0?a.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:f?"You do not have any inactive memberships.":"You are not subscribed to any active membership plan."}):a.jsx("div",{className:"space-y-4",children:m.map(p=>{const g=p.subscriptionPlan;if(!g)return null;const v=die(g),b=p.managedByAccessGroup?"Complimentary":v>0?AN(g):"Free",x=p.managedByAccessGroup?null:D6r(g),w=QXe(p),k=!f&&(p.hasAccess??p.isActive),S=!!(g.isRecurring&&k&&!p.cancelAtPeriodEnd&&!p.managedByAccessGroup),C=i&&o===p.id,j=$6r(g,{complimentary:!!p.managedByAccessGroup});return a.jsxs("div",{className:f?"rounded-xl border border-border bg-card px-5 py-5":"rounded-xl border border-border bg-card px-5 py-5 shadow-sm",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-4",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("p",{className:"text-base font-semibold text-foreground",children:g.name}),a.jsx("span",{className:f?"rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground":"rounded-full bg-emerald-50 px-2 py-0.5 text-[11px] font-medium text-emerald-700 dark:bg-emerald-950/50 dark:text-emerald-300",children:Zbs(p,f,g)})]}),a.jsx("p",{className:"mt-1.5 text-sm text-muted-foreground",children:j})]}),a.jsxs("div",{className:"text-right",children:[a.jsx("p",{className:"text-lg font-semibold tabular-nums text-foreground",children:b}),x?a.jsx("p",{className:"text-xs text-muted-foreground",children:x}):!p.managedByAccessGroup&&!g.isRecurring&&v>0?a.jsx("p",{className:"text-xs text-muted-foreground",children:"one-time"}):null]})]}),a.jsx(Jbs,{plan:g}),w?a.jsxs("p",{className:"mt-4 text-xs text-muted-foreground",children:[f?"Access ended":p.managedByAccessGroup||p.cancelAtPeriodEnd||!g.isRecurring?"Access until":"Renews on"," ",a.jsx("span",{className:"font-medium text-foreground",children:w})]}):p.managedByAccessGroup&&!f?a.jsx("p",{className:"mt-4 text-xs text-muted-foreground",children:"Permanent access"}):null,f?a.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"This membership no longer grants access."}):p.cancelAtPeriodEnd?a.jsxs("p",{className:"mt-4 text-sm text-muted-foreground",children:["Cancellation is scheduled. Access stays active until ",w??"the end of the billing period","."]}):null,S?a.jsx("div",{className:"mt-5 flex justify-end",children:a.jsx(Z,{variant:"outline",size:"sm",className:"text-destructive hover:bg-destructive/10 hover:text-destructive",onClick:()=>c(p),disabled:i,children:C?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):"Cancel plan"})}):null]},p.id)})});return a.jsxs("div",{className:"rounded-lg border border-border bg-card",children:[a.jsxs("div",{className:"border-b border-border px-6 py-4",children:[a.jsx("h2",{className:"text-lg font-semibold",children:"Memberships"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Your current and previous membership plans."})]}),a.jsx("div",{className:"p-6",children:a.jsxs(U0,{defaultValue:"active",children:[a.jsxs(nb,{className:"grid w-full max-w-sm grid-cols-2",children:[a.jsxs(Xo,{value:"active",children:["Active (",e.length,")"]}),a.jsxs(Xo,{value:"inactive",children:["Inactive (",n.length,")"]})]}),a.jsx(pd,{value:"active",className:"mt-6",children:u(e)}),a.jsx(pd,{value:"inactive",className:"mt-6",children:u(n,{inactive:!0})})]})}),a.jsx(Kr,{open:!!l,onOpenChange:m=>!m&&c(null),children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Cancel your subscription?"}),a.jsxs(zr,{children:["Future renewals for ",((h=l==null?void 0:l.subscriptionPlan)==null?void 0:h.name)??"this plan"," will stop. You will keep access until ",l?QXe(l)??"the end of your current billing period":"the end of your current billing period","."]})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:i,children:"Keep subscription"}),a.jsx(Yr,{disabled:i,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",onClick:m=>{m.preventDefault(),d()},children:i?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):"Cancel my subscription"})]})]})})]})}function exs(){return a.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 text-center",children:[a.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Embedded Channels is a premium feature"}),a.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:"Upgrade your community plan to add custom sidebar channels with embedded HTML content."})]})}function txs({hasAuthToken:t}){const e=[["{{userFullName}}","User full name"],["{{userEmail}}","User email"],["{{userId}}","User ID"],["{{userMobile}}","User mobile"],["{{countryCode}}","Country code"],["{{communityRole}}","Community role"]];return t&&e.push(["{{authToken}}","User auth token"]),a.jsxs("div",{className:"rounded-lg border border-border bg-muted/30 p-3 text-xs text-muted-foreground",children:[a.jsx("p",{className:"mb-2 font-medium text-foreground",children:"Available variables"}),a.jsx("ul",{className:"space-y-1",children:e.map(([n,r])=>a.jsxs("li",{children:[a.jsx("code",{className:"rounded bg-background px-1 py-0.5",children:n})," — ",r]},n))})]})}function nxs(){const{community:t}=qe(),{communityDetail:e}=Ln(),{pac:n}=SN(),r=(t==null?void 0:t.id)??null,s=rn(),i=l0(n,"embedSection"),o=ql(e,"hasAuthTokenEmbedEnabled"),{data:l=[],isLoading:c,refetch:d}=nNt(!0),[u,h]=y.useState("list"),[m,f]=y.useState(null),[p,g]=y.useState(""),[v,b]=y.useState(""),[x,w]=y.useState(!0),[k,S]=y.useState(!1),[C,j]=y.useState(!1),[E,N]=y.useState(null),[A,_]=y.useState(null),T=()=>{s.invalidateQueries({queryKey:["embedded-sections",r]})},R=()=>{f(null),g(""),b(""),w(!0),h("edit")},O=async z=>{if(r){h("edit"),f(z.id),j(!0);try{const G=await Bfr(r,z.id);g(G.name),b(G.embedCode??""),w(G.isActive)}catch{He.error("Failed to load embedded channel"),h("list")}finally{j(!1)}}},F=()=>{h("list"),f(null)},D=async()=>{if(!(!r||k)){if(!p.trim()||p.trim().length<2){He.error("Channel name must be at least 2 characters");return}S(!0);try{if(m)await zfr(r,m,{id:m,name:p.trim(),embedCode:v,isActive:x}),He.success("Embedded channel updated");else{const z=await Ufr(r,{name:p.trim(),embedCode:v,isActive:x});f(z.id),He.success("Embedded channel created")}T(),h("list")}catch(z){const G=z instanceof ze?z.message:"Failed to save embedded channel";He.error(G)}finally{S(!1)}}},I=async()=>{if(!(!r||!E))try{await Vfr(r,E.id),He.success("Embedded channel deleted"),T(),m===E.id&&F()}catch{He.error("Failed to delete embedded channel")}finally{N(null)}},P=async z=>{if(r){_(z.id);try{await Gfr(r,z.id,!z.isActive),T(),await d()}catch{He.error("Failed to update visibility")}finally{_(null)}}},M=async(z,G)=>{if(!r)return;const B=l.findIndex(V=>V.id===G.id);if(B<0)return;const H=[...l],W=z==="up"?B-1:B+1;if(W<0||W>=H.length){He.error(z==="up"?"Already at top":"Already at bottom");return}[H[B],H[W]]=[H[W],H[B]];try{await Hfr(r,H.map(V=>V.id)),T(),await d()}catch{He.error("Failed to update sort order")}};return y.useEffect(()=>{i&&h("list")},[i]),i?a.jsx(exs,{}):u==="edit"?a.jsxs("div",{className:"space-y-5",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("button",{type:"button",onClick:F,className:"inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground",children:[a.jsx(no,{className:"h-4 w-4"}),"Back to Embedded Channels"]}),m?a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>N({id:m,name:p,slug:"",isActive:x}),children:[a.jsx(qn,{className:"mr-2 h-4 w-4"}),"Delete"]}):null]}),C?a.jsx("div",{className:"flex justify-center py-16",children:a.jsx(Ne,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"rounded-lg border border-border bg-card p-5 space-y-4",children:[a.jsxs("div",{children:[a.jsx("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Channel name"}),a.jsx(Oe,{value:p,onChange:z=>g(z.target.value),placeholder:"e.g. Help Center"})]}),a.jsxs("div",{children:[a.jsx("label",{className:"mb-1.5 block text-sm font-medium text-foreground",children:"Embed code"}),a.jsx("textarea",{rows:8,value:v,onChange:z=>b(z.target.value),placeholder:"Paste HTML or iframe embed code",className:"w-full rounded-md border border-input bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring/30"})]}),a.jsx(txs,{hasAuthToken:o}),a.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border px-3 py-2.5",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Visible in sidebar"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Members only see active channels."})]}),a.jsx(Hs,{checked:x,onCheckedChange:w})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(Z,{onClick:D,disabled:k,children:[k&&a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}),m?"Update":"Save"]})})]}),a.jsxs("div",{children:[a.jsx("p",{className:"mb-2 text-sm font-medium text-foreground",children:"Preview"}),a.jsx("div",{className:"overflow-hidden rounded-lg border border-border",children:a.jsx(e$t,{embeddedSection:{name:p||"Preview",embedCode:v},className:"w-full border-0"})})]})]}),a.jsx(Kr,{open:!!E,onOpenChange:z=>!z&&N(null),children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Delete this channel?"}),a.jsx(zr,{children:"This permanently removes the embedded channel from your community."})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:"Cancel"}),a.jsx(Yr,{onClick:I,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]}):a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-base font-semibold text-foreground",children:"Embedded Channels"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Add custom sidebar links that show embedded HTML or external tools inside SpatialChat Communities."})]}),a.jsxs(Z,{onClick:R,children:[a.jsx(Dn,{className:"mr-2 h-4 w-4"}),"Create"]})]}),c?a.jsx("div",{className:"flex justify-center py-16",children:a.jsx(Ne,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):l.length===0?a.jsxs("div",{className:"rounded-lg border border-dashed border-border bg-card p-10 text-center",children:[a.jsx("p",{className:"font-medium text-foreground",children:"No embedded channels yet"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Create one to add a custom page to the community sidebar."})]}):a.jsx("div",{className:"space-y-2",children:l.map(z=>a.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-border bg-card px-4 py-3",children:[a.jsx("button",{type:"button",onClick:()=>O(z),className:"min-w-0 text-left text-sm font-semibold text-foreground hover:text-primary",children:z.name}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"flex items-center gap-2 text-xs text-muted-foreground",children:A===z.id?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsxs(a.Fragment,{children:[a.jsx("span",{children:"Visible"}),a.jsx(ji,{checked:z.isActive,onCheckedChange:()=>P(z)})]})}),a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx("button",{type:"button",className:"rounded-md p-1.5 text-muted-foreground hover:bg-muted hover:text-foreground",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[a.jsx(ot,{onClick:()=>O(z),children:"Edit"}),a.jsxs(ot,{onClick:()=>M("up",z),children:[a.jsx(Zf,{className:"mr-2 h-4 w-4"}),"Move up"]}),a.jsxs(ot,{onClick:()=>M("down",z),children:[a.jsx(w0,{className:"mr-2 h-4 w-4"}),"Move down"]}),a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>N(z),children:[a.jsx(qn,{className:"mr-2 h-4 w-4"}),"Delete"]})]})]})]})]},z.id))}),a.jsx(Kr,{open:!!E,onOpenChange:z=>!z&&N(null),children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsxs(Ur,{children:["Delete ",E==null?void 0:E.name,"?"]}),a.jsx(zr,{children:"This permanently removes the embedded channel from your community."})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:"Cancel"}),a.jsx(Yr,{onClick:I,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}const gf={indexable:"SEO_INDEXABLE",robotsTxt:"SEO_ROBOTS_TXT",googleSiteVerification:"SEO_GOOGLE_SITE_VERIFICATION",globalCanonicalUrl:"SEO_GLOBAL_CANONICAL_URL",headCode:"SEO_HEAD_CODE",jsCode:"SEO_JS_CODE"},ZXe=`User-agent: *
Allow: /

Sitemap: /sitemap.xml`;function a4(t){return typeof t=="string"?t:t==null?"":String(t)}function rxs(t,e){return typeof t=="boolean"?t:typeof t=="string"?t.trim().toLowerCase()!=="false":t==null?e:!!t}function sxs(){const{community:t}=qe(),{communityDetail:e,refetchCommunityDetail:n}=Ln(),r=(e==null?void 0:e.configurables)??{},s={indexable:rxs(r[gf.indexable],!0),robotsTxt:a4(r[gf.robotsTxt]),googleSiteVerification:a4(r[gf.googleSiteVerification]),globalCanonicalUrl:a4(r[gf.globalCanonicalUrl]),headCode:a4(r[gf.headCode]),jsCode:a4(r[gf.jsCode])},i=y.useCallback(async o=>{if(!(t!=null&&t.id))throw new Error("No active community");for(const[l,c]of Object.entries(o))await D2(t.id,l,c);await n()},[t==null?void 0:t.id,n]);return{settings:s,save:i}}async function ixs(t){return(await ae.get(`/community/${encodeURIComponent(t)}/redirects`)).redirects??[]}async function axs(t,e){return(await ae.post(`/community/${encodeURIComponent(t)}/redirects`,e)).redirect}async function oxs(t,e){await ae.delete(`/community/${encodeURIComponent(t)}/redirects/${encodeURIComponent(e)}`)}const Fh="w-full rounded-lg border border-border bg-background px-4 py-2.5 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-primary/20 focus:border-primary transition-colors",JXe={metaTitle:"",metaDescription:"",ogTitle:"",ogDescription:"",ogImage:""},Sp=t=>typeof t=="string"?t:"";function lxs(){const{settings:t,save:e}=sxs(),{community:n}=qe(),{communityDetail:r,refetchCommunityDetail:s}=Ln(),{toast:i}=yt(),[o,l]=y.useState(t),[c,d]=y.useState(JXe),[u,h]=y.useState(JXe),[m,f]=y.useState(!1),[p,g]=y.useState([]),[v,b]=y.useState(!1),[x,w]=y.useState(!1),[k,S]=y.useState(null),[C,j]=y.useState({fromPath:"",toPath:"",type:301});y.useEffect(()=>{l(t)},[t.indexable,t.robotsTxt,t.googleSiteVerification,t.globalCanonicalUrl,t.headCode,t.jsCode]);const E=(I,P)=>l(M=>({...M,[I]:P})),N=(I,P)=>d(M=>({...M,[I]:P}));y.useEffect(()=>{const I=r,P=(I==null?void 0:I.meta)??{},M={metaTitle:Sp(P.title),metaDescription:Sp(P.description),ogTitle:Sp(P.openGraphTitle),ogDescription:Sp(P.openGraphDescription),ogImage:Sp(P.openGraphImage)};d(M),h(M)},[r]);const A=async()=>{if(n!=null&&n.id){b(!0);try{g(await ixs(n.id))}catch(I){const P=dn(I,"Failed to load redirects");i({title:P,variant:"destructive"})}finally{b(!1)}}};y.useEffect(()=>{A()},[n==null?void 0:n.id]);const _=y.useMemo(()=>{const I={};return o.indexable!==t.indexable&&(I[gf.indexable]=o.indexable),o.robotsTxt!==t.robotsTxt&&(I[gf.robotsTxt]=o.robotsTxt),o.googleSiteVerification!==t.googleSiteVerification&&(I[gf.googleSiteVerification]=o.googleSiteVerification.trim()),o.globalCanonicalUrl!==t.globalCanonicalUrl&&(I[gf.globalCanonicalUrl]=o.globalCanonicalUrl.trim()),o.headCode!==t.headCode&&(I[gf.headCode]=o.headCode),o.jsCode!==t.jsCode&&(I[gf.jsCode]=o.jsCode),I},[o,t]),T=y.useMemo(()=>Object.keys(c).some(I=>c[I]!==u[I]),[c,u]),R=Object.keys(_).length>0||T,O=async()=>{if(R){f(!0);try{if(Object.keys(_).length>0&&await e(_),T&&(n!=null&&n.id)){const I=r;await Yct(n.id,{name:Sp(I==null?void 0:I.name),address:Sp(I==null?void 0:I.address),description:Sp(I==null?void 0:I.description)||void 0,timezone:Sp(I==null?void 0:I.timezone)||void 0,privacyPolicyLink:Sp(I==null?void 0:I.privacyPolicyLink)||void 0,termsAndConditionsLink:Sp(I==null?void 0:I.termsAndConditionsLink)||void 0,meta:{title:c.metaTitle||void 0,description:c.metaDescription||void 0,openGraphTitle:c.ogTitle||void 0,openGraphDescription:c.ogDescription||void 0,openGraphImage:c.ogImage||void 0}}),s()}i({title:"SEO settings saved"})}catch(I){const P=I instanceof ze&&I.status===403?"Only community admins can change SEO settings.":dn(I,"Failed to save SEO settings");i({title:P,variant:"destructive"})}finally{f(!1)}}},F=async()=>{if(!(!(n!=null&&n.id)||x)){w(!0);try{await axs(n.id,C),j({fromPath:"",toPath:"",type:301}),await A(),i({title:"Redirect saved"})}catch(I){const P=I instanceof ze&&I.status===403?"Only community admins can change redirects.":dn(I,"Failed to save redirect");i({title:P,variant:"destructive"})}finally{w(!1)}}},D=async I=>{if(!(!(n!=null&&n.id)||k)){S(I);try{await oxs(n.id,I),g(P=>P.filter(M=>M.id!==I)),i({title:"Redirect deleted"})}catch(P){const M=dn(P,"Failed to delete redirect");i({title:M,variant:"destructive"})}finally{S(null)}}};return a.jsxs("div",{className:"space-y-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-lg font-semibold text-foreground",children:"Search engine optimization"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Control how your community appears in search engines and link previews."})]}),a.jsxs("section",{className:"rounded-lg border border-border bg-muted/30 p-6 space-y-4",children:[a.jsx("h3",{className:"font-semibold text-foreground",children:"Meta & social sharing"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"The title and description shown in search results, and the card used when your community link is shared on social platforms."}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Meta title"}),a.jsx("input",{type:"text",maxLength:255,value:c.metaTitle,onChange:I=>N("metaTitle",I.target.value),className:Fh})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Meta description"}),a.jsx("textarea",{maxLength:255,rows:3,value:c.metaDescription,onChange:I=>N("metaDescription",I.target.value),className:ee(Fh,"resize-y")})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Open Graph title"}),a.jsx("input",{type:"text",maxLength:255,value:c.ogTitle,onChange:I=>N("ogTitle",I.target.value),className:Fh})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Open Graph description"}),a.jsx("textarea",{maxLength:255,rows:3,value:c.ogDescription,onChange:I=>N("ogDescription",I.target.value),className:ee(Fh,"resize-y")})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Open Graph image"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Recommended 1200×630 px (1.91:1). Defaults to the community banner when empty."}),a.jsx("input",{type:"url",value:c.ogImage,onChange:I=>N("ogImage",I.target.value),placeholder:"https://example.com/image.jpg",className:Fh})]})]}),a.jsxs("section",{className:"rounded-lg border border-border bg-muted/30 p-6 space-y-4",children:[a.jsx("h3",{className:"font-semibold text-foreground",children:"Indexing"}),a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Let search engines index your site"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Keep this on for your site to appear in search results."})]}),a.jsx("button",{type:"button",role:"switch","aria-checked":o.indexable,onClick:()=>E("indexable",!o.indexable),className:ee("relative h-6 w-11 shrink-0 rounded-full transition-colors",o.indexable?"bg-primary":"bg-muted-foreground/30"),children:a.jsx("span",{className:ee("absolute top-0.5 h-5 w-5 rounded-full bg-white shadow transition-all",o.indexable?"left-[22px]":"left-0.5")})})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"robots.txt"}),a.jsx("textarea",{value:o.robotsTxt,onChange:I=>E("robotsTxt",I.target.value),rows:6,placeholder:ZXe,className:ee(Fh,"font-mono text-xs resize-y")}),a.jsx("button",{type:"button",onClick:()=>E("robotsTxt",ZXe),className:"text-xs font-medium text-primary hover:underline",children:"Reset to default"})]})]}),a.jsxs("section",{className:"rounded-lg border border-border bg-muted/30 p-6 space-y-4",children:[a.jsx("h3",{className:"font-semibold text-foreground",children:"Google site verification"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Verify your site via Google Search Console to access your site's Google search data and submit your sitemap for indexing."}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Google site verification ID"}),a.jsx("input",{type:"text",value:o.googleSiteVerification,onChange:I=>E("googleSiteVerification",I.target.value),placeholder:"e.g. google1234567890abcdef.html or the meta content value",className:Fh})]})]}),a.jsxs("section",{className:"rounded-lg border border-border bg-muted/30 p-6 space-y-4",children:[a.jsx("h3",{className:"font-semibold text-foreground",children:"Global canonical tag URL"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Set a global URL for the site's canonical tag. This tells search engines which URL to index, and avoids duplicate content."}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Global canonical URL"}),a.jsx("input",{type:"url",value:o.globalCanonicalUrl,onChange:I=>E("globalCanonicalUrl",I.target.value),placeholder:"https://your-community-domain.com",className:Fh}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"URL should match your default domain."})]})]}),a.jsxs("section",{className:"rounded-lg border border-border bg-muted/30 p-6 space-y-4",children:[a.jsx("h3",{className:"font-semibold text-foreground",children:"Code snippets"}),a.jsxs("div",{className:"flex items-start gap-2 rounded-md border border-amber-500/30 bg-amber-500/10 p-3 text-xs text-amber-700 dark:text-amber-400",children:[a.jsx(Bf,{className:"h-4 w-4 shrink-0 mt-0.5"}),a.jsx("p",{children:"We recommend restricting snippets to lightweight CSS, custom meta tags, and analytics tracking. Errors here can break your community."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Head code"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Added right before the </head> tag. Ideal for custom CSS and meta tags."}),a.jsx("textarea",{value:o.headCode,onChange:I=>E("headCode",I.target.value),rows:5,className:ee(Fh,"font-mono text-xs resize-y")})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"JavaScript code"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Executed inside a <script> block. Ideal for analytics — exclude the <script> wrapper."}),a.jsx("textarea",{value:o.jsCode,onChange:I=>E("jsCode",I.target.value),rows:5,className:ee(Fh,"font-mono text-xs resize-y")})]})]}),a.jsxs("section",{className:"rounded-lg border border-border bg-muted/30 p-6 space-y-5",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"font-semibold text-foreground",children:"Redirects"}),a.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:"Send old community URLs to their new location with a 301 or 302 redirect."})]}),a.jsxs("div",{className:"grid grid-cols-1 gap-3 md:grid-cols-[1fr_1fr_120px_auto] md:items-end",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Old URL"}),a.jsx("input",{type:"text",value:C.fromPath,onChange:I=>j(P=>({...P,fromPath:I.target.value})),placeholder:"/old-page",className:Fh})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"New URL"}),a.jsx("input",{type:"text",value:C.toPath,onChange:I=>j(P=>({...P,toPath:I.target.value})),placeholder:"/new-page",className:Fh})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx("label",{className:"text-sm font-medium text-foreground",children:"Type"}),a.jsxs("select",{value:C.type,onChange:I=>j(P=>({...P,type:Number(I.target.value)===302?302:301})),className:Fh,children:[a.jsx("option",{value:301,children:"301"}),a.jsx("option",{value:302,children:"302"})]})]}),a.jsxs(Z,{type:"button",onClick:F,disabled:x||!C.fromPath.trim()||!C.toPath.trim(),children:[x?a.jsx(Ne,{className:"h-4 w-4 mr-1.5 animate-spin"}):a.jsx(Dn,{className:"h-4 w-4 mr-1.5"}),"Add"]})]}),a.jsx("div",{className:"overflow-hidden rounded-md border border-border bg-background",children:v?a.jsxs("div",{className:"flex items-center justify-center gap-2 p-6 text-sm text-muted-foreground",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"}),"Loading redirects…"]}):p.length===0?a.jsx("div",{className:"p-6 text-sm text-muted-foreground",children:"No redirects configured."}):a.jsx("div",{className:"divide-y divide-border",children:p.map(I=>a.jsxs("div",{className:"grid grid-cols-[1fr_auto] gap-3 p-4 md:grid-cols-[1fr_1fr_72px_auto] md:items-center",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-xs text-muted-foreground md:hidden",children:"Old URL"}),a.jsx("p",{className:"truncate font-mono text-sm text-foreground",children:I.fromPath})]}),a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-xs text-muted-foreground md:hidden",children:"New URL"}),a.jsx("p",{className:"truncate font-mono text-sm text-foreground",children:I.toPath})]}),a.jsx("div",{className:"text-sm text-muted-foreground",children:I.type}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",onClick:()=>D(I.id),disabled:k===I.id,"aria-label":`Delete redirect ${I.fromPath}`,children:k===I.id?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsx(qn,{className:"h-4 w-4"})})]},I.id))})})]}),a.jsx("div",{className:"flex justify-end",children:a.jsxs(Z,{onClick:O,disabled:!R||m,children:[m&&a.jsx(Ne,{className:"h-4 w-4 mr-1.5 animate-spin"}),"Save changes"]})})]})}const zH="top",XXe="https://app.spatial.chat/s/…";let cxs=0;const dxs=()=>`new-${Date.now().toString(36)}-${++cxs}`;function uxs(t,e,n,r,s){const i=s0e(t,n)+1;if(!e)return r==="menu"?i<s:i<=s;const o=t.map(l=>l.id===e?{...l,parent:n}:l);return[...gA(o,e)].every(l=>{const c=o.find(u=>u.id===l),d=s0e(o,l);return c.type==="menu"?d<s:d<=s})}function hxs(t){var e;if(t instanceof ze&&t.status===422){const n=((e=t.body)==null?void 0:e.errors)??{},r=Object.values(n).flat().find(s=>typeof s=="string");if(r)return`Not saved: ${r}`}return Dt(t instanceof ze?t.body:null,"Couldn't save the change. Try again.")}function mxs({state:t,items:e,limits:n,onClose:r,onSubmit:s}){const[i,o]=y.useState(!1),l=(t==null?void 0:t.mode)==="edit"?e.find(_=>_.id===t.id)??null:null,c=(l==null?void 0:l.type)??((t==null?void 0:t.mode)==="create"?t.type:"link"),[d,u]=y.useState(""),[h,m]=y.useState(""),[f,p]=y.useState(zH),[g,v]=y.useState(!0),[b,x]=y.useState(!1);y.useEffect(()=>{t&&(u((l==null?void 0:l.name)??""),m((l==null?void 0:l.url)??""),p((l?l.parent:t.mode==="create"?t.parent:null)??zH),v((l==null?void 0:l.visible)??!0),x(!1))},[t]);const w=y.useMemo(()=>{const _=l?gA(e,l.id):new Set;return e.filter(T=>T.type==="menu"&&!_.has(T.id)&&uxs(e,(l==null?void 0:l.id)??null,T.id,c,n.maxDepth))},[e,l,c,n.maxDepth]),k=f===zH?null:f,S=d.trim().replace(/\s+/g," "),C=OZ(e,k).filter(_=>_.id!==(l==null?void 0:l.id)),j=S?S.length>n.nameMaxLength?`Use up to ${n.nameMaxLength} characters.`:C.some(_=>_.name.toLowerCase()===S.toLowerCase())?`"${S}" is already in this menu.`:null:"Give it a name.",E=c!=="link"?null:h.trim()?!lfr(h)||h.trim().length>n.urlMaxLength?`Use a SpatialChat space link, like ${XXe}`:C.some(_=>_.url===new URL(h.trim()).toString())?"This link is already in this menu.":null:"Paste the SpatialChat link.",N=async()=>{if(!i){if(j||E)return x(!0);o(!0);try{await s({id:(l==null?void 0:l.id)??dxs(),parent:k,type:c,name:S,...c==="link"?{url:new URL(h.trim()).toString()}:{},visible:g})}finally{o(!1)}}},A=c==="link"?"link":"submenu";return a.jsx(Bt,{open:!!t,onOpenChange:_=>!_&&r(),children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] max-w-md",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:l?`Edit ${A}`:`Add a ${A}`}),a.jsx(_n,{children:c==="link"?"A SpatialChat room members can open from the sidebar.":"A heading in the sidebar that opens to show the rooms you put in it."})]}),a.jsxs("form",{className:"space-y-4",onSubmit:_=>{_.preventDefault(),N()},children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"spatial-room-name",children:"Name"}),a.jsx(Oe,{id:"spatial-room-name",value:d,maxLength:n.nameMaxLength,placeholder:c==="link"?"e.g. Main Meeting Room":"e.g. Custom Rooms",onChange:_=>u(_.target.value),"aria-invalid":b&&!!j,autoFocus:!0}),b&&j&&a.jsx("p",{className:"text-xs text-destructive",children:j})]}),c==="link"&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(_e,{htmlFor:"spatial-room-url",className:"flex items-center gap-1.5",children:["SpatialChat link",a.jsx(gn,{label:"SpatialChat link",children:"Open the space in SpatialChat and copy its address from the browser. It starts with https://app.spatial.chat/s/ — other websites can't be added here."})]}),a.jsx(Oe,{id:"spatial-room-url",type:"url",inputMode:"url",value:h,placeholder:XXe,onChange:_=>m(_.target.value),"aria-invalid":b&&!!E}),b&&E&&a.jsx("p",{className:"text-xs text-destructive",children:E})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"spatial-room-parent",children:"Show in"}),a.jsxs(zn,{value:f,onValueChange:p,children:[a.jsx(On,{id:"spatial-room-parent",children:a.jsx(Vn,{})}),a.jsxs(Fn,{className:"max-h-72",children:[a.jsx(pt,{value:zH,children:"Spatial Room (top level)"}),w.map(_=>a.jsxs(pt,{value:_.id,children:["— ".repeat(s0e(e,_.id)-1),_.name]},_.id))]})]})]}),a.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-md border border-border px-3 py-2.5",children:[a.jsxs(_e,{htmlFor:"spatial-room-visible",className:"flex items-center gap-1.5 font-normal",children:["Visible to members",a.jsxs(gn,{label:"Visible to members",children:["Turn this off to keep the ",A," here without showing it in the sidebar, for example while a room is being set up. Hiding a submenu hides everything in it."]})]}),a.jsx(Hs,{id:"spatial-room-visible",checked:g,onCheckedChange:v})]}),a.jsxs(ir,{className:"gap-2 sm:gap-0",children:[a.jsx(Z,{type:"button",variant:"outline",onClick:r,children:"Cancel"}),a.jsxs(Z,{type:"submit",disabled:i,children:[i&&a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}),l?"Save":`Add ${A}`]})]})]})]})})}function fxs(){var E;const{community:t}=qe(),e=(t==null?void 0:t.id)??null,n=rn(),r=["spatial-room-admin",e],{data:s,isLoading:i,isError:o,refetch:l}=lt({queryKey:r,queryFn:()=>afr(e),enabled:!!e}),[c,d]=y.useState(null),[u,h]=y.useState(null),m=jt({mutationFn:({next:N})=>ofr(e,N),onSuccess:(N,{done:A})=>{n.setQueryData(r,N),n.invalidateQueries({queryKey:OEt(e)}),He.success(A)},onError:N=>He.error(hxs(N))}),f=m.isPending,p=(f?(E=m.variables)==null?void 0:E.next:void 0)??(s==null?void 0:s.items)??[],g=s==null?void 0:s.limits,v=!!(g&&p.length>=g.maxItems),b=async(N,A)=>{if(f)return!1;try{return await m.mutateAsync({next:N,done:A}),!0}catch{return!1}},x=(N,A)=>b(p.map(_=>_.id===N.id?{..._,visible:A}:_),A?`${N.name} is shown to members`:`${N.name} is hidden from members`),w=async N=>{const A=p.find(R=>R.id===N.id);let _;if(!A)_=[...p,N];else if(A.parent===N.parent)_=p.map(R=>R.id===N.id?N:R);else{const R=gA(p,N.id);_=[...p.filter(O=>!R.has(O.id)),...p.filter(O=>R.has(O.id)).map(O=>O.id===N.id?N:O)]}const T=await b(_,A?`${N.name} saved`:`${N.name} added`);return T&&d(null),T},k=(N,A)=>{const _=OZ(p,N.parent),T=_[_.indexOf(N)+A];if(!T)return;const R=p.indexOf(N),O=p.indexOf(T),F=[...p];[F[R],F[O]]=[F[O],F[R]],b(F,`${N.name} moved ${A<0?"up":"down"}`)},S=N=>{const A=gA(p,N.id);h(null),b(p.filter(_=>!A.has(_.id)),`${N.name} deleted`)},C=(N,A)=>OZ(p,N).map((_,T,R)=>{const O=gA(p,_.id).size-1,F=_.type==="menu"&&g&&A+1<=g.maxDepth&&!v,D=_.type==="menu"&&g&&A+1<g.maxDepth&&!v;return a.jsxs("li",{children:[a.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-border bg-card px-3 py-2.5 sm:px-4",style:{marginLeft:`${Math.min(A-1,3)*1.25}rem`},children:[a.jsx("span",{className:"flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-muted text-muted-foreground",children:_.type==="link"?a.jsx(Qd,{className:"h-4 w-4"}):a.jsx(xD,{className:"h-4 w-4"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("p",{className:"flex min-w-0 items-center gap-1.5 text-sm font-medium text-foreground",children:[a.jsx("span",{className:"truncate",title:_.name,children:_.name}),!_.visible&&a.jsxs("span",{className:"inline-flex shrink-0 items-center gap-1 rounded-full bg-muted px-1.5 py-0.5 text-[10px] font-medium text-muted-foreground",children:[a.jsx(BP,{className:"h-3 w-3","aria-hidden":!0})," Hidden"]})]}),a.jsx("p",{className:"truncate text-xs text-muted-foreground",title:_.url,children:_.type==="link"?_.url:O?`Submenu · ${O} ${O===1?"entry":"entries"}`:"Submenu · empty, not shown to members"})]}),a.jsx(Hs,{checked:_.visible,onCheckedChange:I=>void x(_,I),disabled:f,"aria-label":`Show ${_.name} to members`,className:"shrink-0"}),a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx("button",{type:"button",disabled:f,"aria-label":`Actions for ${_.name}`,className:"shrink-0 rounded-md p-1.5 text-muted-foreground hover:bg-muted hover:text-foreground disabled:opacity-50",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[a.jsxs(ot,{onClick:()=>d({mode:"edit",id:_.id}),children:[a.jsx(Qs,{className:"mr-2 h-4 w-4"})," Edit"]}),F&&a.jsxs(ot,{onClick:()=>d({mode:"create",type:"link",parent:_.id}),children:[a.jsx(eu,{className:"mr-2 h-4 w-4"})," Add link inside"]}),D&&a.jsxs(ot,{onClick:()=>d({mode:"create",type:"menu",parent:_.id}),children:[a.jsx(xD,{className:"mr-2 h-4 w-4"})," Add submenu inside"]}),a.jsxs(ot,{disabled:T===0,onClick:()=>k(_,-1),children:[a.jsx(Zf,{className:"mr-2 h-4 w-4"})," Move up"]}),a.jsxs(ot,{disabled:T===R.length-1,onClick:()=>k(_,1),children:[a.jsx(w0,{className:"mr-2 h-4 w-4"})," Move down"]}),a.jsx(mi,{}),a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>h(_),children:[a.jsx(qn,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})]}),_.type==="menu"&&O>0&&a.jsx("ul",{className:"mt-2 space-y-2",children:C(_.id,A+1)})]},_.id)}),j=u?gA(p,u.id).size-1:0;return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsxs("h3",{className:"flex items-center gap-1.5 text-base font-semibold text-foreground",children:["Spatial Room",a.jsxs(gn,{label:"Spatial Room",children:["These rooms appear under Spatial Room in your community's sidebar. Add SpatialChat space links with names members recognise, and group them in submenus (up to ",(g==null?void 0:g.maxDepth)??3," levels). Each change is saved straight away."]})]}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Name your SpatialChat rooms and arrange them in the sidebar."})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[f&&a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-xs text-muted-foreground",role:"status",children:[a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin","aria-hidden":!0})," Saving…"]}),a.jsxs(Z,{variant:"outline",size:"sm",disabled:!g||v||f,onClick:()=>d({mode:"create",type:"menu",parent:null}),children:[a.jsx(xD,{className:"mr-2 h-4 w-4"})," Add submenu"]}),a.jsxs(Z,{size:"sm",disabled:!g||v||f,onClick:()=>d({mode:"create",type:"link",parent:null}),children:[a.jsx(Dn,{className:"mr-2 h-4 w-4"})," Add link"]})]})]}),i?a.jsx("div",{className:"flex justify-center py-16",children:a.jsx(Ne,{className:"h-5 w-5 animate-spin text-muted-foreground","aria-label":"Loading"})}):o||!s?a.jsxs("div",{className:"rounded-lg border border-border bg-card p-8 text-center",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Couldn't load the Spatial Room menu."}),a.jsx(Z,{variant:"outline",size:"sm",className:"mt-3",onClick:()=>void l(),children:"Try again"})]}):s.enabled?a.jsxs(a.Fragment,{children:[s.isDefault&&!f&&a.jsx("p",{className:"rounded-lg border border-border bg-muted/40 px-4 py-3 text-sm text-muted-foreground",children:"Members see the default room below. Your first change here turns it into your own menu."}),p.length===0?a.jsxs("div",{className:"rounded-lg border border-dashed border-border bg-card p-10 text-center",children:[a.jsx("p",{className:"font-medium text-foreground",children:"No rooms yet"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Add a link to a SpatialChat room. Members don't see Spatial Room in the sidebar until there is one."})]}):a.jsx("ul",{className:"space-y-2",children:C(null,1)}),v&&g&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:["The menu holds up to ",g.maxItems," entries. Delete one to add another."]})]}):a.jsx("div",{className:"rounded-lg border border-border bg-card p-8 text-center text-sm text-muted-foreground",children:"Spatial Room isn't available for this community."}),g&&a.jsx(mxs,{state:c,items:p,limits:g,onClose:()=>d(null),onSubmit:w}),a.jsx(Kr,{open:!!u,onOpenChange:N=>!N&&h(null),children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsxs(Ur,{children:["Delete “",u==null?void 0:u.name,"”?"]}),a.jsxs(zr,{children:[j>0?`The ${j} ${j===1?"entry":"entries"} in this submenu will be deleted too. `:"","Members stop seeing it straight away."]})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:"Cancel"}),a.jsx(Yr,{onClick:()=>u&&S(u),className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete"})]})]})})]})}const pxs=[{label:"Basic Info",id:"basic",icon:nS,adminOnly:!0},{label:"Community Experience",id:"experience",icon:vK,adminOnly:!0},{label:"Homepage",id:"homepage",icon:OBt,adminOnly:!0},{label:"Onboarding",id:"onboarding",icon:Sa,adminOnly:!0},{label:"Member Fields",id:"member-fields",icon:k0,adminOnly:!0},{label:"Appearance",id:"appearance",icon:bSe,adminOnly:!0},{label:"Gamification",id:"gamification",icon:Hg,adminOnly:!0},{label:"User Safety",id:"safety",icon:kSe,adminOnly:!0},{label:"Embedded Channels",id:"embedded",icon:qrt,adminOnly:!0},{label:"Spatial Room",id:"spatial-room",icon:e9t,adminOnly:!0},{label:"SEO",id:"seo",icon:Qd,adminOnly:!0},{label:"Billing & Plan",id:"billing",icon:Sh,adminOnly:!0},{label:"Membership",id:"membership",icon:Sh},{label:"Profile",id:"profile",icon:k2},{label:"Verification",id:"verification",icon:Sk},{label:"Notification Centre",id:"notifications",icon:Lm},{label:"Community Emails",id:"community-emails",icon:Ii}],gxs={hidden:{opacity:0},show:{opacity:1,transition:{staggerChildren:.04}}},qhe={hidden:{opacity:0,y:8},show:{opacity:1,y:0}};function vxs(t){switch(t){case"basic":return a.jsx(Lys,{});case"experience":return a.jsx(Cbs,{});case"homepage":return a.jsx(fbs,{});case"onboarding":return a.jsx(vbs,{});case"member-fields":return a.jsx(Qvs,{});case"appearance":return a.jsx(Mbs,{});case"profile":return a.jsx(Dbs,{});case"verification":return a.jsx(Ays,{});case"notifications":return a.jsx($bs,{});case"community-emails":return a.jsx(Ubs,{});case"gamification":return a.jsx(Wys,{});case"safety":return a.jsx(hbs,{});case"embedded":return a.jsx(nxs,{});case"spatial-room":return a.jsx(fxs,{});case"seo":return a.jsx(lxs,{});case"billing":return a.jsx(qbs,{});case"membership":return a.jsx(Xbs,{});default:return a.jsx("div",{className:"rounded-lg border border-border bg-card p-8 text-center",children:a.jsx("p",{className:"text-muted-foreground text-sm",children:"This section is coming soon."})})}}function yxs(){var x,w;const{isAdminView:t}=Zy(),{pac:e}=SN(),{community:n}=qe(),r=Tn(),s=t?(n==null?void 0:n.id)??null:null,{posts:i}=qOt(s,"all"),{reports:o}=WOt(s,"all"),l=i.filter(k=>k.moderationStatus==="pending_review").length+o.filter(k=>k.status==="pending").length,[c]=xc(),d=!!((x=FEt().data)!=null&&x.enabled),u=pxs.filter(k=>(!k.adminOnly||t)&&(k.id!=="spatial-room"||d)),h=c.get("tab"),m=h==="subscription"?"billing":h==="analytics"?"experience":h,[f,p]=y.useState(()=>{var k;return m&&(u.some(S=>S.id===m)||m==="spatial-room")?m:((k=u[0])==null?void 0:k.id)||"sso"}),v=u.map(k=>k.id).includes(f)?f:((w=u[0])==null?void 0:w.id)||"sso",b=y.useRef(!1);return y.useEffect(()=>{if(h!=="analytics"&&(b.current=!1),h!=="analytics"||v!=="experience"||b.current)return;const k=window.requestAnimationFrame(()=>{var S;b.current=!0,(S=document.getElementById("analytics"))==null||S.scrollIntoView({behavior:"smooth",block:"start"})});return()=>window.cancelAnimationFrame(k)},[h,v]),a.jsxs(it.div,{variants:gxs,initial:"hidden",animate:"show",className:"flex flex-col gap-4 lg:flex-row lg:gap-6 min-h-[calc(100vh-120px)]",children:[a.jsx(it.div,{variants:qhe,className:"lg:hidden",children:a.jsxs(zn,{value:v,onValueChange:p,children:[a.jsx(On,{"aria-label":"Settings section",className:"h-11 w-full",children:a.jsx(Vn,{})}),a.jsx(Fn,{className:"max-h-[60vh]",children:u.map(k=>{const S=k.icon;return a.jsx(pt,{value:k.id,children:a.jsxs("span",{className:"flex items-center gap-2.5",children:[a.jsx(S,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),r(k.label),k.feature&&l0(e,k.feature)&&a.jsx(wa,{className:"h-3 w-3 shrink-0 opacity-60","aria-label":r("Paid plan")}),k.id==="safety"&&l>0&&a.jsx("span",{className:"flex h-5 min-w-[1.25rem] items-center justify-center rounded-full bg-destructive px-1.5 text-[10px] font-semibold leading-none text-destructive-foreground tabular-nums",children:o0e(l)})]})},k.id)})})]})}),a.jsxs(it.nav,{variants:qhe,className:"hidden w-56 shrink-0 space-y-1 lg:block",children:[a.jsx("h2",{className:"text-sm font-semibold text-muted-foreground uppercase tracking-wider px-3 mb-3",children:"Settings"}),u.map(k=>{const S=k.icon,C=v===k.id;return a.jsxs("button",{onClick:()=>p(k.id),className:ee("flex items-center gap-3 w-full rounded-lg px-3 py-2.5 text-sm transition-colors text-left",C?"bg-primary/10 text-primary font-medium":"text-muted-foreground hover:text-foreground hover:bg-muted/50"),children:[a.jsx(S,{className:"h-4 w-4 shrink-0"}),a.jsxs("span",{className:"flex min-w-0 flex-1 items-center gap-1.5",children:[a.jsx("span",{className:"truncate",children:r(k.label)}),k.feature&&l0(e,k.feature)&&a.jsx(wa,{className:"h-3 w-3 shrink-0 opacity-60","aria-label":r("Paid plan")})]}),k.id==="safety"&&l>0&&a.jsx("span",{className:"flex h-5 min-w-[1.25rem] shrink-0 items-center justify-center rounded-full bg-destructive px-1.5 text-[10px] font-semibold leading-none text-destructive-foreground tabular-nums","aria-label":`${l} items waiting for review`,children:o0e(l)})]},k.id)})]}),a.jsx(it.div,{variants:qhe,className:"flex-1 min-w-0",children:vxs(v)})]})}function bxs(t=""){const e=new URLSearchParams(t.startsWith("?")?t.slice(1):t);return e.set("tab","billing"),`${ve.settings}?${e.toString()}`}function xxs(){const t=Di();return a.jsx(Gs,{to:bxs(t.search),replace:!0})}const Sae=t=>encodeURIComponent(t);function FN(t){return`/community/${Sae(t)}/migration`}function eet(t,e="imported-community"){const n=String(t||e).trim().toLowerCase().replace(/\s+/g,"-").replace(/[^\w-]+/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"").slice(0,64);return M2.test(n)?n:e}async function wxs(t){var n,r,s,i,o;const e=await ae.get(FN(t));return{catalog:((n=e.data)==null?void 0:n.catalog)??[],connection:((r=e.data)==null?void 0:r.connection)??{connected:!1},testImport:((s=e.data)==null?void 0:s.testImport)??{enabled:!1,dumpReady:!1,sourceCommunityName:null},activeRun:((i=e.data)==null?void 0:i.activeRun)??null,runs:Array.isArray((o=e.data)==null?void 0:o.runs)?e.data.runs:[]}}async function kxs(t,e){var r;return((r=(await ae.put(`${FN(t)}/connection`,e)).data)==null?void 0:r.connection)??{connected:!1}}async function Sxs(t,e="circle"){await ae.delete(`${FN(t)}/connection?sourceType=${encodeURIComponent(e)}`)}async function Cxs(t,e){var r,s,i;const n=await ae.post(`${FN(t)}/runs`,{sourceType:e.sourceType??"circle",name:e.name.trim(),address:e.address.trim().toLowerCase(),description:((r=e.description)==null?void 0:r.trim())||void 0,fromDump:!!e.fromDump});return{run:((s=n.data)==null?void 0:s.run)??null,destinationCommunity:((i=n.data)==null?void 0:i.destinationCommunity)??null}}async function jxs(t,e,n){var s;return((s=(await ae.post(`${FN(t)}/runs/${Sae(e)}/cancel`,{confirmation:n})).data)==null?void 0:s.run)??null}async function Exs(t,e){var r;return((r=(await ae.get(`${FN(t)}/runs/${Sae(e)}`)).data)==null?void 0:r.run)??null}async function tet(t,e){const n=Nd(),r=`${wo.apiBaseUrl.replace(/\/$/,"")}${FN(t)}/runs/${Sae(e)}/report`,s=await fetch(r,{headers:n?{Authorization:`Bearer ${n}`}:{}});if(!s.ok)throw new Error("Could not download the migration report");const o=(s.headers.get("Content-Disposition")||"").match(/filename="([^"]+)"/i),l=(o==null?void 0:o[1])||`pensil-import-report-${e}.html`;return{blob:await s.blob(),filename:l}}function net(t,e){const n=URL.createObjectURL(t),r=document.createElement("a");r.href=n,r.download=e,document.body.appendChild(r),r.click(),r.remove(),URL.revokeObjectURL(n)}function ret(t){if(!t)return"—";const e=new Date(t);return Number.isNaN(e.getTime())?"—":e.toLocaleString()}function Nxs(t){return t==="completed"?"border-success/30 bg-success/10 text-success":t==="failed"?"border-destructive/30 bg-destructive/10 text-destructive":t==="partial"?"border-warning/30 bg-warning/10 text-warning":t==="running"||t==="queued"||t==="awaiting_configuration"?"border-info/30 bg-info/10 text-info":"border-border bg-muted text-muted-foreground"}function Khe(t){let e=0,n=0;for(const s of Object.values(t.counts||{}))e+=((s==null?void 0:s.created)||0)+((s==null?void 0:s.updated)||0),n+=(s==null?void 0:s.failed)||0;if(t.status==="failed"||t.status==="partial")return t.failureReason||(t.status==="partial"?"Partial import — review before use.":"Import failed");if((t.status==="awaiting_configuration"||t.status==="queued"||t.status==="running")&&e===0&&n===0)return"";const r=[];return e>0&&r.push(`${e} added`),n>0&&r.push(`${n} failed`),r.join(" · ")}function Txs(t){var n;const e=(n=t.counts)==null?void 0:n.subscriptionPlans;return((e==null?void 0:e.created)||0)+((e==null?void 0:e.updated)||0)}function set(t){return(t==null?void 0:t.destinationCommunityName)||(t==null?void 0:t.sourceCommunityName)||"the new community"}function _xs(){var xt;const{community:t,setCommunity:e}=qe(),{user:n}=jr(),{toast:r}=yt(),s=t==null?void 0:t.id,i=((xt=n==null?void 0:n.email)==null?void 0:xt.trim())||"your signed-in email",[o,l]=y.useState(null),[c,d]=y.useState(!0),[u,h]=y.useState(""),[m,f]=y.useState(""),[p,g]=y.useState(!1),[v,b]=y.useState(!1),[x,w]=y.useState(!1),[k,S]=y.useState(!1),[C,j]=y.useState(!1),[E,N]=y.useState(!1),[A,_]=y.useState(null),[T,R]=y.useState(null),[O,F]=y.useState(null),[D,I]=y.useState(""),[P,M]=y.useState(""),[z,G]=y.useState("idle"),[B,H]=y.useState(!1),[W,V]=y.useState(!1),[U,ne]=y.useState(!1),[te,re]=y.useState(""),[fe,le]=y.useState(!1),q=(o==null?void 0:o.connection)??{connected:!1},Y=(o==null?void 0:o.testImport)??{enabled:!1,dumpReady:!1,sourceCommunityName:null},X=(o==null?void 0:o.catalog)??[],Q=X.find(Xe=>Xe.id==="circle")??{id:"circle",label:"Circle.so",tokenKind:"Admin API v2",enabled:!0};async function ie(Xe=s){var $e;if(!Xe)return;const tt=await wxs(Xe);l(tt),R(tt.activeRun),($e=tt.activeRun)!=null&&$e.communityId&&F(tt.activeRun.communityId)}y.useEffect(()=>{s&&(d(!0),ie(s).catch(Xe=>{r({title:"Could not load import",description:dn(Xe,"Please refresh and try again."),variant:"destructive"})}).finally(()=>d(!1)))},[s]),y.useEffect(()=>{const Xe=q.sourceCommunityName||Y.sourceCommunityName;Xe&&(I(tt=>tt||Xe),M(tt=>tt||eet(Xe)))},[q.sourceCommunityName,Y.sourceCommunityName]),y.useEffect(()=>{const Xe=P.trim().toLowerCase();if(!Xe){G("idle");return}if(!M2.test(Xe)){G("invalid");return}let tt=!1;G("checking");const $e=window.setTimeout(()=>{qct(Xe).then(wt=>{tt||G(wt.addressAvailable?"available":"taken")}).catch(()=>{tt||G("idle")})},400);return()=>{tt=!0,window.clearTimeout($e)}},[P]);const he=O||(T==null?void 0:T.communityId)||null,ye=s,J=!!(he&&s&&he===s),K=T==null?void 0:T.id,ce=T==null?void 0:T.status;y.useEffect(()=>{if(!ye||!K||ce!=="queued"&&ce!=="running")return;const Xe=window.setInterval(async()=>{var tt,$e,wt;try{const Ee=await Exs(ye,K);if(!Ee)return;if(R(Ee),Ee.communityId&&F(Ee.communityId),l(Ge=>{if(!Ge)return Ge;const Pt=Ge.runs.some(vn=>vn.id===Ee.id)?Ge.runs.map(vn=>vn.id===Ee.id?Ee:vn):[Ee,...Ge.runs];return{...Ge,activeRun:Ee.status==="running"||Ee.status==="queued"?Ee:null,runs:Pt}}),Ee.status==="completed"){r({title:"Import finished",description:`You are the admin of ${set(Ee)}. The report stays in this list so you can download it later.`});const Ge=Ee.communityId||he;if(!!(Ge&&ye===Ge)){try{const vn=await lR(Ge);vn!=null&&vn.community&&e(xm({...vn.community,myRole:"admin",isByMe:!0}))}catch{}try{const vn=await tet(ye,Ee.id);net(vn.blob,vn.filename)}catch{r({title:"Report is ready",description:"Download it from the list below. It is saved in this community.",variant:"destructive"})}if(Txs(Ee)>0)try{const vn=await sIt(Ge);((tt=vn==null?void 0:vn.paymentPreference)==null?void 0:tt.paymentMethod)==="stripe"&&(($e=vn==null?void 0:vn.paymentPreference)==null?void 0:$e.integrationStatus)==="completed"||H(!0)}catch{H(!0)}}}Ee.status==="failed"&&r({title:"Import failed",description:Ee.failureReason||Ee.message,variant:"destructive"}),Ee.status==="partial"&&r({title:(wt=Ee.failureReason)!=null&&wt.includes("cancelled")?"Import cancelled":"Partial import",description:Ee.failureReason||"Review the destination community before use.",variant:"destructive"})}catch{}},2e3);return()=>window.clearInterval(Xe)},[K,ce,he,ye,e,r]);async function pe(Xe){if(Xe.preventDefault(),!!s){b(!0);try{const tt=await kxs(s,{sourceType:"circle",token:u.trim(),headlessToken:m.trim()});h(""),f(""),g(!1),await ie(),tt.sourceCommunityName&&(I(tt.sourceCommunityName),M(eet(tt.sourceCommunityName))),r({title:"Circle tokens saved",description:tt.sourceCommunityName?`Connected to ${tt.sourceCommunityName}. Headless access will be checked during import.`:"Admin v2 was verified. Headless access will be checked during import."})}catch(tt){r({title:"Token was not saved",description:dn(tt,"Circle rejected this token."),variant:"destructive"})}finally{b(!1)}}}async function Ie(){const Xe=ye;if(!(!Xe||!Ve)&&te.trim().toUpperCase()==="CONFIRM"){le(!0);try{const tt=await jxs(Xe,Ve.id,te.trim());ne(!1),re(""),tt&&(R(tt),l($e=>{if(!$e)return $e;const wt=$e.runs.some(Ee=>Ee.id===tt.id)?$e.runs.map(Ee=>Ee.id===tt.id?tt:Ee):[tt,...$e.runs];return{...$e,activeRun:null,runs:wt}})),r({title:"Import cancelled",description:"The destination community may already have imported content. Review it before use."})}catch(tt){r({title:"Could not cancel import",description:tt instanceof ze?Dt(tt.body,tt.message):dn(tt,"Please try again."),variant:"destructive"})}finally{le(!1)}}}async function Me(){if(s)try{await Sxs(s,"circle"),S(!1),await ie(),r({title:"Token removed"})}catch(Xe){r({title:"Could not remove token",description:dn(Xe,"Please try again."),variant:"destructive"})}}const we=P.trim().toLowerCase(),Be=D.trim().length>=2&&M2.test(we)&&z!=="taken"&&z!=="invalid",Ve=T&&(T.status==="queued"||T.status==="running")?T:null,be=!!Ve||!q.connected&&!Y.enabled;async function Ze(){if(!(!s||!Be)){w(!0);try{const{run:Xe,destinationCommunity:tt}=await Cxs(s,{sourceType:"circle",name:D.trim(),address:we,fromDump:E});if(j(!1),tt){const $e=xm(tt);e($e),F($e.id),I(""),M("")}else Xe!=null&&Xe.communityId&&F(Xe.communityId);R(Xe),r({title:"New community created",description:tt?`Importing into ${tt.name}. A report will be ready when it finishes.`:"A report will be available when this run finishes."})}catch(Xe){r({title:"Could not start migration",description:Xe instanceof ze?Dt(Xe.body,Xe.message):dn(Xe,"Please try again."),variant:"destructive"})}finally{w(!1)}}}async function Pe(Xe){const tt=s||Xe.communityId||ye;if(tt){_(Xe.id);try{const{blob:$e,filename:wt}=await tet(tt,Xe.id);net($e,wt)}catch($e){r({title:"Could not download report",description:dn($e,"Please try again."),variant:"destructive"})}finally{_(null)}}}async function Ke(Xe=Ve){const tt=(Xe==null?void 0:Xe.communityId)||he;if(tt)try{const $e=await lR(tt);$e!=null&&$e.community&&e(xm({...$e.community,myRole:"admin",isByMe:!0}))}catch($e){r({title:"Could not open the imported community",description:dn($e,"Please try again."),variant:"destructive"})}}const De=X.filter(Xe=>Xe.id!=="circle");return a.jsxs(it.div,{initial:{opacity:0},animate:{opacity:1},className:"mx-auto max-w-3xl space-y-6 p-6",children:[a.jsx(Bm,{title:"Import",description:"Each import creates a new community on SpatialChat Communities. You can leave this page or open another tab — progress and the finished report stay on Import for you to come back to."}),c?a.jsx("div",{className:"rounded-lg border border-border bg-card p-8 text-sm text-muted-foreground",children:"Loading…"}):a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"rounded-lg border border-border bg-card p-6 space-y-4",children:[a.jsxs("div",{className:"flex items-start justify-between gap-4",children:[a.jsxs("div",{className:"space-y-1",children:[a.jsx("p",{className:"text-xs font-medium uppercase tracking-wider text-muted-foreground",children:"Source"}),a.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:Q.label}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Uses an ",Q.tokenKind," token."]})]}),a.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full border border-border px-2.5 py-1 text-xs text-muted-foreground",children:[a.jsx(efe,{className:"h-3.5 w-3.5"}),"Admin v2"]})]}),q.connected&&!p?a.jsxs("div",{className:"flex flex-col gap-3 rounded-md border border-border bg-muted/40 px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx(r9t,{className:"mt-0.5 h-4 w-4 text-success"}),a.jsxs("div",{children:[a.jsxs("p",{className:"text-sm font-medium",children:["Connected",q.sourceCommunityName?` · ${q.sourceCommunityName}`:""]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Admin token ending ",q.tokenLast4||"••••",q.headlessConnected?` · Headless token ending ${q.headlessTokenLast4||"••••"}`:" · Headless enrichment is not configured",` · saved ${ret(q.connectedAt)}`]})]})]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs(Z,{variant:"ghost",size:"sm",onClick:()=>g(!0),children:[a.jsx(pO,{className:"h-4 w-4"}),"Replace tokens"]}),a.jsxs(Z,{variant:"ghost",size:"sm",onClick:()=>S(!0),children:[a.jsx(qn,{className:"h-4 w-4"}),"Remove tokens"]})]})]}):a.jsxs("form",{onSubmit:pe,className:"space-y-3",children:[a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"circle-admin-token",children:"Admin v2 token"}),a.jsx(Oe,{id:"circle-admin-token",type:"password",autoComplete:"off",placeholder:"Paste token from Circle → Developers → Tokens",value:u,onChange:Xe=>h(Xe.target.value)}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Stored encrypted on the server. It is never shown again and never sent to the SpatialChat Communities frontend after save."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"circle-headless-token",children:"Headless Auth token"}),a.jsx(Oe,{id:"circle-headless-token",type:"password",autoComplete:"off",placeholder:"Paste a Headless Auth token from Circle → Developers → Tokens",value:m,onChange:Xe=>f(Xe.target.value)}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Used server-side for course lesson media and files, and post likers. Circle does not expose member roles."})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs(Z,{type:"submit",disabled:v||u.trim().length<16||m.trim().length<16,children:[v?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsx(pO,{className:"h-4 w-4"}),"Save tokens"]}),q.connected?a.jsx(Z,{type:"button",variant:"ghost",onClick:()=>{h(""),f(""),g(!1)},children:"Cancel"}):null,Q.helpUrl&&a.jsxs("a",{href:Q.helpUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-xs text-muted-foreground hover:text-foreground",children:[a.jsx(L8,{className:"h-3.5 w-3.5"}),"How to create a token"]})]})]})]}),De.length>0&&a.jsx("section",{className:"rounded-lg border border-dashed border-border bg-card/50 px-6 py-4",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"Later sources use the same importer. Nothing else is enabled yet."})}),a.jsxs("section",{className:"rounded-lg border border-border bg-card p-6 space-y-4",children:[a.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:"Create community and import"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Every import creates a new community on SpatialChat Communities. You become its admin. The community you are in now keeps its admins — it is only used to hold the saved token."}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Circle’s API does not return member roles, so every imported member lands as a regular member. Re-assign admins in SpatialChat Communities after import."}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-2 sm:col-span-2",children:[a.jsx(_e,{htmlFor:"import-community-name",children:"New community name"}),a.jsx(Oe,{id:"import-community-name",value:D,onChange:Xe=>I(Xe.target.value),placeholder:"Community name",disabled:be})]}),a.jsxs("div",{className:"space-y-2 sm:col-span-2",children:[a.jsx(_e,{htmlFor:"import-community-address",children:"Address"}),a.jsx(jje,{id:"import-community-address",value:P,onChange:M,disabled:be}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[z==="checking"&&"Checking address…",z==="available"&&"This address is available.",z==="taken"&&"This address is already taken. Choose another.",z==="invalid"&&"Use 3–64 characters: letters, numbers, and hyphens (not at the ends).",z==="idle"&&"This becomes the public subdomain for the new community."]})]})]}),Ve&&a.jsxs("div",{className:"space-y-2 rounded-md border border-border px-4 py-3",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3 text-sm",children:[a.jsx("span",{className:"font-medium",children:Ve.message||"Importing…"}),a.jsxs("span",{className:"text-muted-foreground",children:[Ve.progressPercent,"%"]})]}),a.jsx(ap,{value:Ve.progressPercent,className:"h-2"}),Khe(Ve)?a.jsx("p",{className:"text-xs text-muted-foreground",children:Khe(Ve)}):null,a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>{re(""),ne(!0)},children:[a.jsx(mm,{className:"h-4 w-4"}),"Cancel import"]}),!J&&Ve.communityId?a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>void Ke(Ve),children:["Open ",set(Ve),a.jsx(xa,{className:"h-4 w-4"})]}):null]})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs(Z,{disabled:!q.connected||!!Ve||x||!Be,onClick:()=>{N(!1),j(!0)},children:[x&&!E?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsx(efe,{className:"h-4 w-4"}),"Create community and import"]}),Y.enabled?a.jsxs(Z,{variant:"outline",disabled:!Y.dumpReady||!!Ve||x||!Be,onClick:()=>{N(!0),j(!0)},children:[x&&E?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsx(Xme,{className:"h-4 w-4"}),"Test import"]}):null]}),Y.enabled&&!Y.dumpReady?a.jsxs("p",{className:"text-xs text-muted-foreground",children:["No complete test response dump is available. Set ",a.jsx("code",{children:"TEST_IMPORT_DUMP"})," to the captured",a.jsx("code",{children:" manifest.json"})," and restart the backend."]}):null,Y.dumpReady&&Y.artifactType==="response-cassette"?a.jsx("p",{className:"text-xs text-muted-foreground",children:"Test import will replay the saved Circle responses and archived media without calling Circle."}):null]}),a.jsxs("section",{className:"space-y-3",children:[a.jsx("h2",{className:"text-lg font-semibold tracking-tight",children:"Reports"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"Finished reports are saved in the database. Download them any time from this list."}),((o==null?void 0:o.runs)??[]).length===0?a.jsx("div",{className:"rounded-lg border border-border bg-card p-8 text-center text-sm text-muted-foreground",children:"No migrations yet. After you start an import, progress and the report stay here even if you switch tabs."}):a.jsx("div",{className:"overflow-hidden rounded-lg border border-border bg-card",children:a.jsx("ul",{className:"divide-y divide-border",children:((o==null?void 0:o.runs)??[]).map(Xe=>a.jsxs("li",{className:"flex flex-col gap-3 px-4 py-3 sm:flex-row sm:items-center sm:justify-between",children:[a.jsxs("div",{className:"min-w-0 space-y-1",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx("span",{className:ee("inline-flex rounded-full border px-2 py-0.5 text-xs font-medium capitalize",Nxs(Xe.status)),children:Xe.status}),a.jsx("span",{className:"text-sm font-medium",children:Xe.destinationCommunityName||Xe.sourceCommunityName||"Circle.so"})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[[ret(Xe.startedAt),Khe(Xe)].filter(Boolean).join(" · "),Xe.status==="failed"&&Xe.failureReason?` · ${Xe.failureReason}`:""]}),Xe.responseRecordingStatus==="complete"&&Xe.responseRecordingPath?a.jsxs("p",{className:"break-all font-mono text-xs text-muted-foreground",children:["Mock dump: ",Xe.responseRecordingPath]}):null]}),a.jsxs(Z,{variant:"outline",size:"sm",disabled:!Xe.hasReport||A===Xe.id,onClick:()=>Pe(Xe),children:[A===Xe.id?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):Xe.status==="completed"?a.jsx(yo,{className:"h-4 w-4"}):a.jsx(oBt,{className:"h-4 w-4"}),"Download report"]})]},Xe.id))})})]})]}),a.jsx(Kr,{open:k,onOpenChange:S,children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Remove the saved token?"}),a.jsx(zr,{children:"You will need to paste new Admin v2 and Headless Auth tokens before the next full import. Existing imported content stays in SpatialChat Communities."})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:"Cancel"}),a.jsx(Yr,{onClick:Me,children:"Remove"})]})]})}),a.jsx(Kr,{open:C,onOpenChange:Xe=>{x||j(Xe)},children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:E?"Create a community from the local dump?":"Confirm your Circle admin email"}),a.jsx(zr,{children:E?a.jsxs(a.Fragment,{children:["This creates ",a.jsx("span",{className:"font-medium text-foreground",children:D.trim()||"a new community"}),we?` (${we})`:""," from the local TEST_IMPORT_DUMP file and its .media folder. Circle is not called. The community you are in now is not overwritten. A report is generated when it finishes."]}):a.jsxs(a.Fragment,{children:["Is ",a.jsx("span",{className:"font-semibold text-foreground",children:i})," an admin of the Circle community you are importing?",a.jsx("span",{className:"mt-3 block",children:"This is the SpatialChat Communities account starting the import. Headless (courses, lesson files, and post likes) will run as the Circle member with this same email — not as whoever appears first in Circle’s member list."}),a.jsxs("span",{className:"mt-3 block",children:["Continuing creates ",a.jsx("span",{className:"font-medium text-foreground",children:D.trim()||"a new community"}),we?` (${we})`:""," and starts the import. Circle does not return roles, so imported members join as regular members — re-assign admins after import."]})]})})]}),a.jsxs(Br,{children:[a.jsx(ts,{disabled:x,children:"Cancel"}),a.jsxs(Yr,{onClick:Xe=>{Xe.preventDefault(),Ze()},disabled:x||!Be,children:[x?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):null,"Continue"]})]})]})}),a.jsx(Bt,{open:U,onOpenChange:Xe=>{fe||(ne(Xe),Xe||re(""))},children:a.jsxs(Ft,{children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Cancel this import?"}),a.jsx(_n,{children:"The import will stop immediately. No further Circle API calls will be made with the saved token. The destination community already exists and may contain a partial import — review it before use."})]}),a.jsxs("div",{className:"space-y-2",children:[a.jsx(_e,{htmlFor:"cancel-import-confirm",children:"Type CONFIRM to cancel"}),a.jsx(Oe,{id:"cancel-import-confirm",autoComplete:"off",value:te,onChange:Xe=>re(Xe.target.value),placeholder:"CONFIRM",disabled:fe})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"outline",onClick:()=>{fe||(ne(!1),re(""))},disabled:fe,children:"Keep importing"}),a.jsxs(Z,{variant:"destructive",onClick:()=>void Ie(),disabled:fe||te.trim().toUpperCase()!=="CONFIRM",children:[fe?a.jsx(Ne,{className:"h-4 w-4 animate-spin"}):a.jsx(mm,{className:"h-4 w-4"}),"Stop import"]})]})]})}),a.jsx(Kr,{open:B,onOpenChange:H,children:a.jsxs(Or,{children:[a.jsxs(Fr,{children:[a.jsx(Ur,{children:"Connect Stripe for new purchases"}),a.jsx(zr,{children:"Imported members keep access to paid groups and courses until their Circle paid-through date. Connect Stripe and add this community’s webhook so new members can buy these plans and so billing works after that date."})]}),a.jsxs(Br,{children:[a.jsx(ts,{children:"Later"}),a.jsx(Yr,{onClick:Xe=>{Xe.preventDefault(),H(!1),V(!0)},children:"Open paywall settings"})]})]})}),a.jsx(KM,{open:W,onOpenChange:V,purpose:"import",onConfigured:()=>H(!1)})]})}function Axs(){const t=Nn(),{groups:e}=Ln(),{notifications:n,isLoading:r,markRead:s,markAllRead:i,remove:o}=i2t(!0),l=c=>{s(c.id);const d=lAe(c,e);d?t(d):r2t(c.type)&&He.info("Post not found",{description:"It may have been deleted by the author."})};return a.jsx("div",{className:"py-4",children:r?a.jsx("div",{className:"flex items-center justify-center py-20 text-muted-foreground",children:a.jsx(Ne,{className:"h-5 w-5 animate-spin"})}):a.jsx(l2t,{variant:"page",notifications:n,onItemClick:l,onMarkAllRead:()=>i(),onDelete:c=>o(c.id),onMarkRead:c=>void s(c.id)})})}const Pxs={"01-overview":{width:1240,height:760,markers:[{x:.6,y:48.5,w:21.3,h:38.4},{x:66.6,y:12.7,w:12.8,h:6.3},{x:79.4,y:12.7,w:17.1,h:6.3}]},"02-audience":{width:1240,height:1080,markers:[{x:26.1,y:15.6,w:70.3,h:7.5},{x:85.2,y:8.2,w:11.3,h:4.1},{x:26.1,y:68.8,w:70.3,h:17}]},"03-form-create":{width:1024,height:700,markers:[{x:2,y:22.8,w:62.8,h:17.4},{x:2,y:71.7,w:62.8,h:28.3},{x:68.4,y:19.7,w:30,h:60.8},{x:86.3,y:91.3,w:11.7,h:6.9}]},"04-form-publish":{width:940,height:520,markers:[{x:5.9,y:61.1,w:23.7,h:6.9}]},"05-funnel-form":{width:512,height:684,markers:[{x:4,y:73.1,w:92.2,h:21.4},{x:4,y:84.3,w:91.9,h:10.2}]},"06-funnel-stages":{width:940,height:560,markers:[{x:4.8,y:44.2,w:74.9,h:20.7},{x:75.1,y:26.7,w:12.4,h:7.9}]},"07-newsletter-create":{width:940,height:742,markers:[{x:6,y:32.9,w:31.8,h:25.2},{x:6,y:96.9,w:31.8,h:3.1},{x:51.2,y:60.7,w:36.7,h:30.6}]},"08-campaign-recipients":{width:1240,height:760,markers:[{x:25.2,y:15.1,w:34.5,h:5.3},{x:37.5,y:67.7,w:47.7,h:27.5},{x:92.1,y:14.8,w:5.4,h:5.8}]},"09-sequence-trigger":{width:1240,height:760,markers:[{x:26.1,y:21.7,w:27.4,h:15.4},{x:56.5,y:39.4,w:38.5,h:23.3}]},"10-sequence-steps":{width:940,height:520,markers:[{x:42.5,y:46.4,w:50.6,h:16.4},{x:42.5,y:63.6,w:47.2,h:16.9},{x:83.7,y:22.2,w:9.4,h:8.5}]}},Rxs="/assets/01-overview-BXyuZnoi.webp",Ixs="/assets/02-audience-BS8XxKkW.webp",Mxs="/assets/03-form-create-CXO_hhVk.webp",Lxs="/assets/04-form-publish-CqwC_-ws.webp",Dxs="/assets/05-funnel-form-BGG3yRgx.webp",$xs="/assets/06-funnel-stages-CQr1OK0v.webp",Oxs="/assets/07-newsletter-create-BNjEZxds.webp",Fxs="/assets/08-campaign-recipients-lfx9SJAU.webp",Bxs="/assets/09-sequence-trigger-BWt8sIwp.webp",Uxs="/assets/10-sequence-steps-DL8stolQ.webp",Nv=(t,e,n)=>h4t(Pxs,t,e,n),zxs=[{icon:Sa,title:"People join",lines:["Sign-up page","Form or funnel","You add or import"]},{icon:oI,title:"Audience",lines:["Everyone who opted in","and is still subscribed"]},{icon:_s,title:"You send",lines:["A newsletter issue","or a campaign"]},{icon:Pg,title:"Sequences follow up",lines:["Automatically, on a trigger"]}],Vxs=[{id:"audience",icon:oI,title:"Audience",summary:"Everyone who can receive your email",what:"Your Audience is the people who chose to receive email from this community — both members and outsiders. Every newsletter, campaign and sequence sends to people on this list and nobody else.",when:"Look here first. It tells you who you can actually reach, and why a send went to fewer people than you expected.",steps:["People arrive one of five ways: they joined the community, they used a newsletter sign-up page, they answered a form, you imported them, or you added them by hand.","Each person has a status. Subscribed people receive your email. Pending confirm signed up but haven't clicked the confirmation link yet, so nothing is sent to them. Bounced means the address rejected mail. Unsubscribed opted out.","Use Add person for one address, or import a CSV for many. There is a CSV template on the page."],watchOut:"People opt in themselves — joining the community is not the same as agreeing to email. Importing never adds community members, and never turns email back on for someone who unsubscribed.",ctas:[{label:"Open Audience",to:ve.emailAudience}],figures:[Nv("02-audience",Ixs,{alt:"The Audience page of a new community, with no people in it yet.",caption:"Audience in a brand-new community — empty until someone opts in.",labels:["Filter by type, status or how they signed up, to see who you can actually reach.","Add person adds one address by hand.","Import outsiders takes a CSV. It never adds community members, and never re-subscribes anyone who opted out."]})]},{id:"forms",icon:Ei,title:"Forms and funnels",summary:"Collect answers in exchange for something",what:"A form is a public page that asks questions — not just name and email — and then shows a thank-you, sends people to another page, or delivers a download. A funnel packages the whole journey around one offer: the form that collects the answers, the thank-you or download, and the follow-up emails.",when:"Use a form or funnel when you are offering something specific, like a guide or a free resource. If people only need to join a list, use a newsletter instead.",steps:["Build the form and choose what happens after someone submits it.","Share its public link, or let a funnel present it as part of an offer.","Everyone who submits it joins your Audience with Form as their sign-up source."],ctas:[{label:"Open Forms",to:ve.emailForms},{label:"Open Funnels",to:ve.emailFunnels}],figures:[Nv("03-form-create",Mxs,{alt:"The new form dialog, with setup fields on the left and a live preview on the right.",caption:"Building a form. The preview on the right is what visitors see.",labels:["Name the form, and choose whether it is a standalone landing page or embedded.","Email is always collected. Add your own questions underneath.","The live preview updates as you type.","Create form."]}),Nv("04-form-publish",Lxs,{alt:"A newly created form showing a notice that it is not live until published.",caption:"A new form is a draft — its link will not accept submissions yet.",labels:["Publish form. Until you do, the link and embed take no submissions."]}),Nv("05-funnel-form",Dxs,{alt:"The new funnel dialog with the form dropdown open, listing the form just created.",caption:"A funnel wraps a form in an offer, a thank-you and follow-up emails.",labels:["Pick the form that collects the answers.","The one you just made appears here. The field below it picks a nurture sequence to enrol people into, if you have built one."]}),Nv("06-funnel-stages",$xs,{alt:"A created funnel showing counts for landing, opt-in, thank-you and nurture emails.",caption:"Once live, the funnel counts people at each stage.",labels:["Landing to opt-in to thank-you to nurture emails, with real counts at each step.","Activate makes it live."]})]},{id:"newsletter",icon:vO,title:"Newsletter",summary:"A list people subscribe to, and the issues you send it",what:"A newsletter is two things at once: a public sign-up page people can subscribe on, and the posts — the issues — you publish to the people who did.",when:"Use a newsletter for updates people asked to keep receiving. It is the simplest way to grow an audience, because the sign-up page does the collecting for you.",steps:["Create the newsletter, then publish it. Until it is published its public sign-up page is not live.","Share the sign-up link. Depending on how your community is set up, people may have to click a confirmation link first — those sit at Pending confirm in your Audience, and nothing is sent to them until they do.","Write a post and publish it. Publishing sends that issue to the newsletter's subscribed recipients."],watchOut:"Publishing a post sends it. There is no separate send button, so use Send test first if you want to see it in an inbox before everyone does.",ctas:[{label:"Open Newsletters",to:ve.newsletter}],figures:[Nv("07-newsletter-create",Oxs,{alt:"The new newsletter screen, with details on the left and a preview of the public sign-up page on the right.",caption:"Creating a newsletter also creates its public sign-up page.",labels:["Title and description — these appear on the sign-up page.","Sender identity: the name readers see in their inbox.","The sign-up page people will subscribe on, previewed live."]})]},{id:"campaign",icon:Ii,title:"Campaign",summary:"One email, to a group you choose",what:"A campaign is a single email sent once — an announcement, an invitation, a one-off update. Unlike a newsletter issue, you pick exactly who receives it each time.",when:"Use a campaign when the message is a one-off and the recipients are not simply one newsletter's subscribers.",steps:["The builder has three steps: Template, Design, then Review and send.","On the review step, choose who should receive it: everyone, members only, the members of one space, a role, people with a tag, or your imported contacts. Saved lists you already use appear here too.","Send it now, or schedule it for later."],watchOut:"Anyone who unsubscribed, bounced, or never opted in is left out automatically, so the number sent is often lower than your total membership. That is working correctly.",ctas:[{label:"New campaign",to:ve.emailCampaignCreate}],figures:[Nv("08-campaign-recipients",Fxs,{alt:"The review and send step of the campaign builder with the recipient dropdown open.",caption:"Review and send. This community is new, so nobody has opted in yet — the count under the dropdown would read zero, which is why Audience comes first.",labels:["The three steps: Template, Design, then Review and send.","Choose who receives it — everyone, members only, a space, a role, people with a tag, or imported contacts.","Send now, or switch on Schedule for later."]})]},{id:"sequence",icon:Pg,title:"Sequence",summary:"A series of emails that sends itself",what:"A sequence is a run of emails with waits in between that starts by itself when something happens, and then keeps going without you. A welcome series is the usual first one.",when:"Use a sequence when the same emails should go to everyone who does a particular thing — rather than everyone at the same moment, which is what a campaign does.",steps:["Pick what starts it: someone signing up to a newsletter, confirming their newsletter subscription, opening or clicking one of your campaigns, or having a tag added to them.","Add the steps in order. You can add an email, a wait, a notification to an admin, enrolment into another sequence, or a step that adds or removes a tag.","Activate it. From then on it runs for everyone who sets off the trigger."],ctas:[{label:"Open Sequences",to:ve.emailSequences}],figures:[Nv("09-sequence-trigger",Bxs,{alt:"The sequence builder with the enrolment trigger dropdown open, showing five triggers.",caption:"A new sequence, with the things that can start it.",labels:["The sequence you are building. Create one with New sequence.","The enrolment trigger: signing up to a newsletter, confirming it, opening or clicking a campaign, or a tag being added."]}),Nv("10-sequence-steps",Uxs,{alt:"The sequence builder with one wait step added and the buttons for adding more steps underneath.",caption:"Adding the steps, then switching the sequence on.",labels:["Each step you add appears here, in the order it runs.","Add the steps: an email, a wait, a note to an admin, enrolment into another sequence, or adding or removing a tag.","Activate. From then on it runs by itself."]})]}];function zS({className:t}){const[e,n]=y.useState(!1);return a.jsxs(a.Fragment,{children:[a.jsxs(Z,{variant:"outline",onClick:()=>n(!0),className:t,children:[a.jsx(Iu,{className:"mr-1.5 h-4 w-4"}),"How it works"]}),a.jsx(Hxs,{open:e,onOpenChange:n})]})}function Hxs({open:t,onOpenChange:e}){const n=Nn(),r=s=>{e(!1),n(s)};return a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg flex max-h-[min(90vh,880px)] flex-col gap-0 overflow-hidden p-0 sm:max-w-3xl",children:[a.jsxs(Vt,{className:"shrink-0 border-b border-border px-6 pb-4 pt-6",children:[a.jsx(Ut,{children:"How Email Marketing works"}),a.jsx(_n,{children:"What each part does, when to use it, and how they connect. About two minutes."})]}),a.jsxs("div",{className:"themed-scrollbar min-h-0 flex-1 space-y-4 overflow-y-auto px-6 py-4",children:[a.jsx(f4t,{heading:"However people arrive, every send follows the same path",flow:zxs}),a.jsx(m4t,{figure:Nv("01-overview",Rxs,{alt:"The Email Marketing overview of a new community, with the sidebar menu and the How it works button.",caption:"Everything lives under Email Marketing in the sidebar.",labels:["The whole module: Overview, Campaigns, Newsletters, Sequences, Funnels, Forms, Templates and Audience.","How it works — this guide, available from every page in the section.","New email campaign, once you have people to send to."]})}),a.jsx(p4t,{sections:Vxs,defaultOpen:"audience",onGo:r}),a.jsxs("div",{className:"rounded-lg border border-primary/30 bg-primary/5 p-4",children:[a.jsxs("p",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[a.jsx(ja,{className:"h-4 w-4 text-primary","aria-hidden":"true"}),"New here? Start with a newsletter"]}),a.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:"Create one, publish it, and share its sign-up page. That gives people a way to opt in, which fills your Audience — and everything else sends to that."}),a.jsxs("div",{className:"mt-3 flex flex-wrap gap-2",children:[a.jsxs(Z,{size:"sm",onClick:()=>r(ve.newsletterNew),children:[a.jsx(vO,{className:"mr-1.5 h-3.5 w-3.5"}),"Create a newsletter"]}),a.jsxs(Z,{size:"sm",variant:"outline",onClick:()=>r(ve.emailAudience),children:[a.jsx(oI,{className:"mr-1.5 h-3.5 w-3.5"}),"See my Audience"]}),a.jsxs(Z,{size:"sm",variant:"outline",onClick:()=>r(ve.emailFunnels),children:[a.jsx(Rrt,{className:"mr-1.5 h-3.5 w-3.5"}),"Browse funnels"]})]})]})]})]})})}const Gxs=[wr,Ii,bk,_s],Wxs=[{label:"New broadcast",description:"Send a one-off email",icon:Ii,to:ve.emailCampaignCreate},{label:"Build a sequence",description:"Trigger-based flows",icon:Pg,to:ve.emailSequences},{label:"Create form",description:"Capture new contacts",icon:Ei,to:ve.emailForms},{label:"Browse templates",description:"Start from a design",icon:xo,to:ve.emailTemplates}];function qxs(){const t=Nn(),{campaigns:e}=Jy(),n=e.slice(0,4),r=e.filter(f=>f.status==="sent"||f.status==="sending"),s=r.reduce((f,p)=>f+(p.recipients??0),0),i=r.reduce((f,p)=>f+(p.delivered??0),0),o=f=>i?r.reduce((p,g)=>p+(g.delivered??0)*(g[f]??0),0)/i:null,l=o("openRate"),c=o("clickRate"),d=s?i/s*100:null,u=f=>f===null?"—":`${f.toFixed(1)}%`,h=[{label:"Campaigns sent",value:r.length.toLocaleString(),hint:r.length?"Finished sending":"No sends yet"},{label:"Open rate",value:u(l),hint:l===null?"No delivery data yet":"All campaigns"},{label:"Click rate",value:u(c),hint:c===null?"No delivery data yet":"All campaigns"},{label:"Delivered",value:u(d),hint:s?`of ${s.toLocaleString()} sent`:"No sends yet"}],m=r.slice(0,7).reverse().map(f=>({day:f.title.length>14?`${f.title.slice(0,14)}…`:f.title,current:f.openRate??0,previous:f.clickRate??0}));return a.jsxs(it.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:"mx-auto max-w-6xl space-y-6 lg:p-6",children:[a.jsx(Bm,{title:"Email Marketing",description:"Your audience, campaigns and sequences at a glance.",actions:a.jsxs(a.Fragment,{children:[a.jsx(zS,{}),a.jsxs(Z,{onClick:()=>t(ve.emailCampaignCreate),children:[a.jsx(Dn,{className:"mr-1.5 h-4 w-4"})," New email campaign"]})]})}),a.jsx("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:h.map((f,p)=>a.jsx(it.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},transition:{delay:p*.04},children:a.jsx(sx,{...f,icon:Gxs[p]})},f.label))}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5 shadow-card",children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Campaign performance"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Open vs click rate across your recent sends."})]}),a.jsxs("div",{className:"flex items-center gap-4 text-xs text-muted-foreground",children:[a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"h-2 w-2 rounded-full bg-primary"})," Open rate"]}),a.jsxs("span",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"h-2 w-4 rounded-full border-2 border-dashed border-muted-foreground"})," Click rate"]})]})]}),m.length>=2?a.jsx(kus,{data:m}):a.jsx("p",{className:"py-14 text-center text-sm text-muted-foreground",children:"Send at least two campaigns to see performance trends here."})]}),a.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[a.jsxs("div",{className:"lg:col-span-2 rounded-xl border border-border bg-card shadow-card",children:[a.jsxs("div",{className:"flex items-center justify-between border-b border-border px-5 py-3.5",children:[a.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Recent campaigns"}),a.jsxs(vr,{to:ve.emailCampaigns,className:"flex items-center gap-1 text-xs font-medium text-primary hover:underline",children:["View all ",a.jsx(xa,{className:"h-3.5 w-3.5"})]})]}),a.jsx("ul",{className:"divide-y divide-border",children:n.map(f=>a.jsx("li",{children:a.jsxs(vr,{to:ve.emailCampaignReport(f.id),className:"flex items-center justify-between px-5 py-3 transition-colors hover:bg-muted/60",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:f.title}),a.jsxs("p",{className:"truncate text-xs text-muted-foreground",children:[f.audience," · ",f.recipients.toLocaleString()," recipients"]}),gm(f.sendProgress,f.status)&&a.jsx(sL,{progress:f.sendProgress,status:f.status,className:"mt-2"})]}),a.jsxs("div",{className:"flex shrink-0 items-center gap-4",children:[a.jsxs("span",{className:"hidden text-right text-xs text-muted-foreground sm:block",children:[a.jsxs("span",{className:"block font-medium text-foreground",children:[f.openRate,"%"]})," open"]}),a.jsx(q0,{status:f.status})]})]})},f.id))})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5 shadow-card",children:[a.jsx("h2",{className:"mb-3 text-sm font-semibold text-foreground",children:"Quick actions"}),a.jsx("div",{className:"space-y-2",children:Wxs.map(f=>a.jsxs(vr,{to:f.to,className:"flex items-center gap-3 rounded-lg border border-border bg-surface p-3 transition-all hover:-translate-y-0.5 hover:border-primary/40 hover:bg-accent hover:shadow-card",children:[a.jsx("span",{className:"flex h-9 w-9 items-center justify-center rounded-md bg-primary/10 text-primary",children:a.jsx(f.icon,{className:"h-4.5 w-4.5"})}),a.jsxs("span",{className:"min-w-0",children:[a.jsx("span",{className:"block text-sm font-medium text-foreground",children:f.label}),a.jsx("span",{className:"block text-xs text-muted-foreground",children:f.description})]})]},f.label))})]})]})]})}function ob(){const{community:t}=qe();return(t==null?void 0:t.myRole)==="admin"}const Kxs=[{type:"broadcast",title:"Email broadcast",description:"Send a single email to promote a product, share news, or stay connected.",icon:Ii,iconClass:"bg-info/15 text-info",footnote:"A/B test available"},{type:"sequence",title:"Email sequence",description:"Send a series of emails triggered by what a member does.",icon:Pg,iconClass:"bg-success/15 text-success"}];function Yxs(t){return t?new Date(t).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"}):"—"}function Qxs(){var Q,ie,he,ye;const t=Nn(),{toast:e}=yt(),{community:n}=qe(),r=ob(),{campaigns:s,folders:i,duplicateCampaign:o,deleteCampaign:l,moveCampaign:c,addFolder:d,deleteFolder:u,updateCampaign:h}=Jy(),[m,f]=y.useState("all"),[p,g]=y.useState("all"),[v,b]=y.useState("all"),[x,w]=y.useState(""),[k,S]=y.useState(1),[C,j]=y.useState("createdAt:desc"),[E,N]=y.useState(null),[A,_]=y.useState(!1),[T,R]=y.useState(null),[O,F]=y.useState(null),[D,I]=y.useState(null),[P,M]=y.useState(!1),[z,G]=y.useState(""),[B,H]=y.useState(null),[W,V]=y.useState("none"),U=DNt((n==null?void 0:n.id)??null,{page:k,limit:10,sort:C,search:x,...p!=="all"?{type:p}:{},...v!=="all"?{status:v}:{},...E!==null?{folderId:E}:{}}),ne=y.useMemo(()=>{var J;return(((J=U.data)==null?void 0:J.data)??[]).map(HZ)},[(Q=U.data)==null?void 0:Q.data]),te=((ie=U.data)==null?void 0:ie.total)??ne.length,re=s.find(J=>J.id===O),fe=s.find(J=>J.id===D),le=J=>{var K;return(K=i.find(ce=>ce.id===J))==null?void 0:K.name},q=J=>{w(J),S(1)};async function Y(J,K){try{await J(),e({title:K})}catch{e({title:"Action failed",description:"Please retry after checking your connection.",variant:"destructive",action:a.jsx(Z,{variant:"secondary",size:"sm",onClick:()=>void Y(J,K),children:"Retry"})})}}function X(J){const K=s.find(pe=>pe.id===J),ce=(K==null?void 0:K.recipients)||0;Y(()=>h(J,{status:"sent",delivered:Math.round(ce*.98),sentAt:new Date().toISOString()}),"Campaign sent 🎉")}return r?a.jsxs(it.div,{initial:{opacity:0},animate:{opacity:1},className:"mx-auto max-w-6xl space-y-5 lg:p-6",children:[a.jsx(Bm,{title:"Email Campaigns",description:"Broadcasts and sequences you've created.",actions:a.jsxs(a.Fragment,{children:[a.jsx(zS,{}),a.jsx(Z,{variant:"outline",onClick:()=>t(ve.emailTemplates),children:"Manage templates"}),a.jsxs(Z,{onClick:()=>_(!0),className:"transition-transform active:scale-95",children:[a.jsx(Dn,{className:"mr-1.5 h-4 w-4"})," New email campaign"]})]})}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsx(U0,{value:m,onValueChange:J=>{f(J),J==="folders"&&N(null),S(1)},children:a.jsxs(nb,{children:[a.jsx(Xo,{value:"all",children:"All emails"}),a.jsx(Xo,{value:"folders",children:"Folders"})]})}),m==="all"&&E!==null&&a.jsxs("button",{onClick:()=>N(null),className:"inline-flex items-center gap-1.5 rounded-full bg-accent px-3 py-1 text-xs font-medium text-accent-foreground",children:[a.jsx(BLe,{className:"h-3.5 w-3.5"})," ",le(E)??"Folder",a.jsx(nn,{className:"h-3.5 w-3.5"})]})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card shadow-card",children:[a.jsxs("div",{className:"flex flex-col gap-3 border-b border-border p-4 sm:flex-row sm:items-center sm:justify-between",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(zn,{value:p,onValueChange:J=>{g(J),S(1)},children:[a.jsx(On,{className:"h-9 w-[130px]",children:a.jsx(Vn,{placeholder:"Type"})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"all",children:"All types"}),a.jsx(pt,{value:"broadcast",children:"Broadcast"}),a.jsx(pt,{value:"sequence",children:"Sequence"})]})]}),a.jsxs(zn,{value:v,onValueChange:J=>{b(J),S(1)},children:[a.jsx(On,{className:"h-9 w-[130px]",children:a.jsx(Vn,{placeholder:"Status"})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"all",children:"All statuses"}),a.jsx(pt,{value:"draft",children:"Draft"}),a.jsx(pt,{value:"scheduled",children:"Scheduled"}),a.jsx(pt,{value:"sending",children:"Sending"}),a.jsx(pt,{value:"sent",children:"Sent"})]})]}),a.jsxs(zn,{value:C,onValueChange:J=>{j(J),S(1)},children:[a.jsx(On,{className:"h-9 w-[150px]",children:a.jsx(Vn,{placeholder:"Sort"})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"createdAt:desc",children:"Newest"}),a.jsx(pt,{value:"createdAt:asc",children:"Oldest"}),a.jsx(pt,{value:"title:asc",children:"Title A-Z"}),a.jsx(pt,{value:"title:desc",children:"Title Z-A"})]})]})]}),a.jsxs("div",{className:"relative w-full sm:w-64",children:[a.jsx(hs,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Oe,{value:x,onChange:J=>q(J.target.value),placeholder:"Search…",className:"h-9 pl-9"})]})]}),m==="folders"?a.jsxs("div",{className:"p-4",children:[a.jsxs("div",{className:"mb-3 flex items-center justify-between",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[i.length," folder",i.length===1?"":"s"]}),a.jsxs(Z,{size:"sm",variant:"outline",onClick:()=>M(!0),children:[a.jsx(xD,{className:"mr-1.5 h-4 w-4"})," New folder"]})]}),i.length===0?a.jsx(Df,{icon:NBt,title:"No folders yet",description:"Organise your emails into folders to keep campaigns tidy.",action:a.jsxs(Z,{onClick:()=>M(!0),children:[a.jsx(xD,{className:"mr-1.5 h-4 w-4"})," New folder"]})}):a.jsx("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:i.map(J=>{const K=s.filter(ce=>ce.folderId===J.id).length;return a.jsxs("div",{className:"group flex items-center justify-between rounded-xl border border-border bg-surface p-4 transition-all hover:-translate-y-0.5 hover:shadow-card-hover",children:[a.jsxs("button",{onClick:()=>{N(J.id),f("all")},className:"flex min-w-0 items-center gap-3 text-left",children:[a.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-accent text-accent-foreground",children:a.jsx(BLe,{className:"h-5 w-5"})}),a.jsxs("span",{className:"min-w-0",children:[a.jsx("span",{className:"block truncate text-sm font-semibold text-foreground",children:J.name}),a.jsxs("span",{className:"block text-xs text-muted-foreground",children:[K," campaign",K===1?"":"s"]})]})]}),a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8 opacity-0 group-hover:opacity-100",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[a.jsx(ot,{onClick:()=>{N(J.id),f("all")},children:"Open"}),r&&a.jsxs(a.Fragment,{children:[a.jsx(mi,{}),a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>{u(J.id),e({title:"Folder deleted",description:"Its campaigns were moved out."})},children:[a.jsx(qn,{className:"mr-2 h-4 w-4"})," Delete folder"]})]})]})]})]},J.id)})})]}):U.isLoading?a.jsx(FS,{rows:6,columns:8}):U.isError?a.jsx("div",{className:"p-4",children:a.jsx(BS,{onRetry:()=>void U.refetch()})}):ne.length===0?a.jsx(Df,{icon:Ii,title:"You'll find your emails here",description:"Once you add emails to this folder, you'll be able to see them here.",action:a.jsxs(Z,{onClick:()=>_(!0),children:[a.jsx(Dn,{className:"mr-1.5 h-4 w-4"})," New email campaign"]})}):a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border text-left text-xs uppercase tracking-wide text-muted-foreground",children:[a.jsx("th",{className:"px-5 py-3 font-medium",children:"Campaign"}),a.jsx("th",{className:"px-3 py-3 font-medium",children:"Type"}),a.jsx("th",{className:"px-3 py-3 font-medium",children:"Status"}),a.jsx("th",{className:"px-3 py-3 font-medium text-right",children:"Recipients"}),a.jsx("th",{className:"px-3 py-3 font-medium text-right",children:"Open"}),a.jsx("th",{className:"px-3 py-3 font-medium text-right",children:"Click"}),a.jsx("th",{className:"px-3 py-3 font-medium text-right",children:"Updated"}),a.jsx("th",{className:"px-3 py-3"})]})}),a.jsx("tbody",{children:a.jsx(Al,{initial:!1,children:ne.map(J=>a.jsxs(it.tr,{layout:!0,...rL,onClick:()=>t(ve.emailCampaignReport(J.id)),className:"cursor-pointer border-b border-border transition-colors hover:bg-muted/60",children:[a.jsxs("td",{className:"px-5 py-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"font-medium text-foreground",children:J.title}),J.abTest&&a.jsxs("span",{className:"inline-flex items-center gap-1 rounded bg-accent px-1.5 py-0.5 text-[10px] font-medium text-accent-foreground",children:[a.jsx(Xme,{className:"h-3 w-3"})," A/B"]})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:J.subject||"No subject yet"}),J.status==="scheduled"&&J.scheduledAt&&a.jsxs("p",{className:"mt-0.5 flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(Ux,{className:"h-3 w-3 shrink-0","aria-hidden":"true"}),"Sends ",vd(J.scheduledAt)]}),gm(J.sendProgress,J.status)&&a.jsx(sL,{progress:J.sendProgress,status:J.status,className:"mt-2 max-w-xs"})]}),a.jsx("td",{className:"px-3 py-3 capitalize text-muted-foreground",children:J.type}),a.jsx("td",{className:"px-3 py-3",children:a.jsx(q0,{status:J.status})}),a.jsx("td",{className:"px-3 py-3 text-right tabular-nums text-foreground",children:J.recipients.toLocaleString()}),a.jsx("td",{className:"px-3 py-3 text-right tabular-nums text-foreground",children:J.openRate?`${J.openRate}%`:"—"}),a.jsx("td",{className:"px-3 py-3 text-right tabular-nums text-foreground",children:J.clickRate?`${J.clickRate}%`:"—"}),a.jsx("td",{className:"px-3 py-3 text-right text-muted-foreground",children:Yxs(J.updatedAt)}),a.jsx("td",{className:"px-3 py-3 text-right",onClick:K=>K.stopPropagation(),children:a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[a.jsxs(ot,{onClick:()=>t(ve.emailCampaignReport(J.id)),children:[a.jsx(Fc,{className:"mr-2 h-4 w-4"})," View report"]}),a.jsxs(ot,{onClick:()=>t(`${ve.emailCampaignCreate}?edit=${J.id}`),children:[a.jsx(Qs,{className:"mr-2 h-4 w-4"})," Edit"]}),a.jsxs(ot,{onClick:()=>void Y(()=>o(J.id),"Campaign duplicated"),children:[a.jsx(Zl,{className:"mr-2 h-4 w-4"})," Duplicate"]}),a.jsxs(ot,{onClick:()=>{H(J.id),V(J.folderId??"none")},children:[a.jsx(fO,{className:"mr-2 h-4 w-4"})," Move to folder"]}),r&&J.status==="draft"&&a.jsxs(a.Fragment,{children:[a.jsx(mi,{}),a.jsxs(ot,{onClick:()=>I(J.id),children:[a.jsx(_s,{className:"mr-2 h-4 w-4"})," Send"]})]}),r&&J.status==="scheduled"&&a.jsxs(a.Fragment,{children:[a.jsx(mi,{}),a.jsxs(ot,{onClick:()=>X(J.id),children:[a.jsx(_s,{className:"mr-2 h-4 w-4"})," Send now"]}),a.jsxs(ot,{onClick:()=>void Y(()=>h(J.id,{status:"draft",scheduledAt:void 0}),"Send cancelled"),children:[a.jsx(MA,{className:"mr-2 h-4 w-4"})," Unschedule"]})]}),r&&a.jsxs(a.Fragment,{children:[a.jsx(mi,{}),a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>F(J.id),children:[a.jsx(qn,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})]})})]},J.id))})})]})}),m==="all"&&!U.isLoading&&!U.isError&&a.jsx(US,{page:((he=U.data)==null?void 0:he.page)??k,limit:((ye=U.data)==null?void 0:ye.limit)??10,total:te,onPageChange:S})]}),a.jsx(Bt,{open:A,onOpenChange:J=>{_(J),J||R(null)},children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg max-w-2xl",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"New email campaign"}),a.jsx(_n,{children:"Select the type of campaign you'd like to create."})]}),a.jsx("div",{className:"grid items-stretch gap-4 sm:grid-cols-2",children:Kxs.map(J=>{const K=J.icon,ce=T===J.type;return a.jsxs("button",{type:"button","aria-pressed":ce,onClick:()=>R(J.type),className:ee("flex h-full flex-col items-start rounded-xl border bg-card p-5 text-left transition-all","hover:-translate-y-0.5 hover:border-primary/40 hover:shadow-card-hover","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",ce?"border-primary bg-primary/5 ring-2 ring-primary/30":"border-border"),children:[a.jsx("span",{className:ee("flex h-11 w-11 shrink-0 items-center justify-center rounded-full",J.iconClass),children:a.jsx(K,{className:"h-5 w-5"})}),a.jsx("h3",{className:"mt-3 text-base font-semibold text-foreground",children:J.title}),a.jsx("p",{className:"mt-1 text-sm leading-relaxed text-muted-foreground",children:J.description}),a.jsx("span",{className:"mt-auto pt-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground",children:J.footnote?a.jsxs(a.Fragment,{children:[a.jsx(Xme,{className:"h-3.5 w-3.5"})," ",J.footnote]}):null})]},J.type)})}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"ghost",onClick:()=>_(!1),children:"Cancel"}),a.jsx(Z,{disabled:!T,onClick:()=>t(T==="sequence"?ve.emailSequences:ve.emailCampaignCreate),children:"Continue"})]})]})}),a.jsx(Bt,{open:P,onOpenChange:M,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg",children:[a.jsx(Vt,{children:a.jsx(Ut,{children:"New folder"})}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"foldername",children:"Folder name"}),a.jsx(Oe,{id:"foldername",value:z,onChange:J=>G(J.target.value),placeholder:"e.g. Promotions",autoFocus:!0})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"ghost",onClick:()=>M(!1),children:"Cancel"}),a.jsx(Z,{onClick:()=>{d(z),G(""),M(!1),e({title:"Folder created"})},children:"Create"})]})]})}),a.jsx(Bt,{open:!!B,onOpenChange:J=>!J&&H(null),children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg",children:[a.jsx(Vt,{children:a.jsx(Ut,{children:"Move to folder"})}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Folder"}),a.jsxs(zn,{value:W,onValueChange:V,children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"none",children:"No folder"}),i.map(J=>a.jsx(pt,{value:J.id,children:J.name},J.id))]})]})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"ghost",onClick:()=>H(null),children:"Cancel"}),a.jsx(Z,{onClick:()=>{B&&Y(()=>c(B,W==="none"?null:W),W==="none"?"Removed from folder":`Moved to ${le(W)}`),H(null)},children:"Move"})]})]})}),a.jsx(Cl,{open:!!D,onOpenChange:J=>{J||I(null)},title:"Review before sending?",description:fe?`"${fe.title}" is still a draft. You'll be taken to Review & send to check the recipients, subject and content — nothing is sent until you confirm there.`:"",confirmLabel:"Review & send",destructive:!1,onConfirm:()=>{const J=D;I(null),J&&t(`${ve.emailCampaignCreate}?edit=${J}&step=review`)}}),a.jsx(Cl,{open:!!O,onOpenChange:J=>!J&&F(null),title:"Delete campaign?",description:`"${re==null?void 0:re.title}" will be permanently removed. This can't be undone.`,onConfirm:()=>{O&&Y(()=>l(O),"Campaign deleted"),F(null)}})]}):a.jsx("div",{className:"mx-auto max-w-4xl lg:p-6",children:a.jsx(Df,{icon:Ii,title:"No access",description:"Only community admins can manage email campaigns."})})}const qIe=[{token:"{{first_name}}",key:"first_name",label:"First name",sample:"Alex"},{token:"{{name}}",key:"name",label:"Full name",sample:"Alex Morgan"},{token:"{{email}}",key:"email",label:"Email address",sample:"alex@example.com"},{token:"{{community_name}}",key:"community_name",label:"Community name",sample:"Dev Community"},{token:"{{sender_name}}",key:"sender_name",label:"Sender name",sample:"Dev Community"}],Zxs=Object.fromEntries(qIe.map(t=>[t.key,t.sample])),e6t=/\{\{\s*((?:\\.|\w)+)\s*(?:\|([^}]*?))?\s*\}\}/g;function NA(t,e=Zxs,n=String){return String(t??"").replace(e6t,(r,s,i)=>{const o=e[s.replace(/\\(.)/g,"$1")];return o!==void 0&&o!==""?n(o):i!==void 0?i.trim():""})}const Jxs={P:"p",DIV:"p",H1:"h1",H2:"h2",H3:"h3",H4:"h3",H5:"h3",H6:"h3",BLOCKQUOTE:"p",PRE:"p",ADDRESS:"p",ARTICLE:"p",SECTION:"p",HEADER:"p",FOOTER:"p",TR:"p",DT:"p",DD:"p",FIGCAPTION:"p"},Xxs=new Set(["SCRIPT","STYLE","HEAD","TITLE","META","LINK","TEMPLATE","NOSCRIPT","IFRAME","OBJECT","EMBED","SVG","MATH","IMG","PICTURE","VIDEO","AUDIO","CANVAS","BUTTON","INPUT","SELECT","TEXTAREA"]);function t6t(t){const e=t.style;return t.tagName!=="SPAN"||!(e!=null&&e.length)?!1:Array.from({length:e.length},(n,r)=>e.item(r)).every(n=>n==="color"||n==="background-color")}function J5(t){const e=String(t??"").trim().toLowerCase(),n=e.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/);if(n)return n[1].length===3?`#${[...n[1]].map(i=>i+i).join("")}`:e;const r=e.match(/^rgb\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*\)$/);if(!r)return;const s=r.slice(1).map(Number);if(!s.some(i=>i>255))return`#${s.map(i=>i.toString(16).padStart(2,"0")).join("")}`}const OX="#010203";function iet(t){const e=J5(t);return e===OX?void 0:e}function n6t(t){let e=String(t??"").trim();if(!e||(/^[a-z][a-z\d+.-]*:/i.test(e)||(e=`https://${e}`),!/^https?:\/\//i.test(e)))return"";e=e.replace(/\s/g,"%20").replace(/</g,"%3C").replace(/>/g,"%3E");try{const n=new URL(e);return n.protocol!=="http:"&&n.protocol!=="https:"?"":/^[a-z0-9-]+(\.[a-z0-9-]+)+$/i.test(n.hostname)?e:""}catch{return""}}function aet(t,e){var r;const n=(((r=t.style)==null?void 0:r.textAlign)||t.getAttribute("align")||"").toLowerCase();return n==="center"||n==="right"?n:n?void 0:e}function e0s(t,e,n){const r={...e},s=t.tagName,i=t.style;if((s==="B"||s==="STRONG")&&(r.bold=!0),(s==="I"||s==="EM")&&(r.italic=!0),s==="U"&&(r.underline=!0),s==="A"){const o=t.getAttribute("href")??"",l=/^\s*https?:\/\//i.test(o)?n6t(o):"";l&&(r.href=l)}if(n){const o=i==null?void 0:i.fontWeight;return o&&(r.bold=o==="bold"||o==="bolder"||Number(o)>=600),i!=null&&i.fontStyle&&(r.italic=i.fontStyle==="italic"),/underline/.test((i==null?void 0:i.textDecorationLine)||(i==null?void 0:i.textDecoration)||"")&&(r.underline=!0),r}return s==="FONT"&&t.hasAttribute("color")&&(r.color=iet(t.getAttribute("color"))),t6t(t)&&(i.color&&(r.color=iet(i.color)),i.backgroundColor&&(r.highlight=J5(i.backgroundColor))),r}function t0s(t,e){const n=t.ownerDocument,r=[];if(e.href&&r.push(["a",{href:e.href}]),e.color||e.highlight){const i=[e.color&&`color:${e.color}`,e.highlight&&`background-color:${e.highlight}`].filter(Boolean).join(";");r.push(["span",{style:i}])}e.bold&&r.push(["strong",{}]),e.italic&&r.push(["em",{}]),e.underline&&r.push(["u",{}]);let s=t;for(const[i,o]of r){const l=s.lastChild;if(l instanceof Element&&l.tagName.toLowerCase()===i&&Object.entries(o).every(([d,u])=>l.getAttribute(d)===u))s=l;else{const d=n.createElement(i);for(const[u,h]of Object.entries(o))d.setAttribute(u,h);s.appendChild(d),s=d}}return s}function KIe(t,e=[]){return t.childNodes.forEach(n=>{n.nodeType===Node.TEXT_NODE?e.push(n):n.nodeName!=="UL"&&n.nodeName!=="OL"&&KIe(n,e)}),e}function n0s(t){const e=KIe(t);if(e.length<2)return;const n=[];let r="";for(const i of e)n.push(r.length),r+=i.data;const s=i=>{let o=e.length-1;for(;o>0&&n[o]>i;)o-=1;return o};for(const i of[...r.matchAll(e6t)].reverse()){const o=i.index??0,l=o+i[0].length,c=s(o),d=s(l-1);if(c===d)continue;const u=s(o+i[0].indexOf(i[1]));for(let h=d;h>=c;h-=1){const m=Math.max(o-n[h],0),f=Math.min(l-n[h],e[h].data.length)-m;h===u?e[h].replaceData(m,f,i[0]):e[h].deleteData(m,f)}}e.forEach(i=>{i.data||i.remove()}),t.querySelectorAll("a, span, strong, em, u").forEach(i=>{i.textContent||i.remove()})}function lD(t,e={}){if(t==null||t==="")return"";const n=!!e.pasted,{mapText:r,mapHref:s}=e,i=typeof t=="string"?new DOMParser().parseFromString(t,"text/html").body:t,o=document.implementation.createHTMLDocument(""),l=o.body;let c=l,d=null;const u=(p,g)=>(d=o.createElement(p),g&&d.setAttribute("style",`text-align:${g}`),c.appendChild(d),d),h=p=>d??u(c.tagName==="UL"||c.tagName==="OL"?"li":"p",p),m=(p,g,v)=>{p.childNodes.forEach(b=>{var k;if(b.nodeType===Node.TEXT_NODE){const S=n?(b.nodeValue??"").replace(/[\t\n\r]+/g," "):b.nodeValue??"";if(!S||!d&&!S.trim())return;const C=t0s(h(v),g);((k=C.lastChild)==null?void 0:k.nodeType)===Node.TEXT_NODE?C.lastChild.appendData(S):C.appendChild(o.createTextNode(S));return}if(!(b instanceof Element)||Xxs.has(b.tagName.toUpperCase()))return;const x=b.tagName.toUpperCase();if(x==="BR"){h(v).appendChild(o.createElement("br"));return}if(x==="UL"||x==="OL"){const S=c,C=d,j=o.createElement(x.toLowerCase()),E=S.lastElementChild,N=(C==null?void 0:C.tagName)==="LI"?C:(S.tagName==="UL"||S.tagName==="OL")&&(E==null?void 0:E.tagName)==="LI"?E:S;N.appendChild(j),c=j,d=null,m(b,g,aet(b,v)),j.childNodes.length||j.remove(),c=S,d=N===C?C:null;return}const w=x==="LI"?"li":Jxs[x];if(w){const S=d,C=aet(b,v),j=c.tagName==="UL"||c.tagName==="OL",E=(S==null?void 0:S.tagName)==="LI"&&w!=="li";E?S.childNodes.length?S.appendChild(o.createElement("br")):C&&S.setAttribute("style",`text-align:${C}`):u(j?"li":w==="li"?"p":w,C);const N=d;if(m(b,g,C),E)return;N&&!N.childNodes.length&&N.remove(),d=null;return}m(b,e0s(b,g,n),v)})};m(i,{},void 0);const f=l.querySelectorAll("p, h1, h2, h3, li");return f.forEach(n0s),r&&f.forEach(p=>KIe(p).forEach(g=>{g.data=r(g.data)})),s&&l.querySelectorAll("a").forEach(p=>p.setAttribute("href",s(p.getAttribute("href")??""))),f.forEach(p=>{var v;const g=p.lastChild;(g==null?void 0:g.nodeName)==="BR"&&p.childNodes.length>1&&((v=g.previousSibling)==null?void 0:v.nodeName)!=="BR"&&g.remove(),p.childNodes.length||p.appendChild(o.createElement("br"))}),(l.textContent??"").trim()?l.innerHTML:""}function r0s(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function YIe(t){var n;if((n=t.html)!=null&&n.trim())return t.html;const e=t.text??"";return e.trim()?`<p>${r0s(e)}</p>`:""}function s0s(t){if(!t)return"";const e=new DOMParser().parseFromString(t,"text/html").body;return e.querySelectorAll("br").forEach(n=>n.replaceWith(`
`)),Array.from(e.querySelectorAll("p, h1, h2, h3, li")).map(n=>Array.from(n.childNodes).filter(r=>!/^(UL|OL)$/.test(r.nodeName)).map(r=>r.textContent??"").join("")).join(`
`).trim()}const VH=new Map,r6t=[{name:"Black",value:"#101318"},{name:"Grey",value:"#5c6370"},{name:"Red",value:"#dc2626"},{name:"Orange",value:"#ea580c"},{name:"Green",value:"#16a34a"},{name:"Blue",value:"#0b64f4"},{name:"Purple",value:"#7c3aed"},{name:"Pink",value:"#db2777"}],s6t=[{name:"Yellow",value:"#fef08a"},{name:"Green",value:"#bbf7d0"},{name:"Blue",value:"#bfdbfe"},{name:"Pink",value:"#fbcfe8"},{name:"Orange",value:"#fed7aa"},{name:"Purple",value:"#ddd6fe"},{name:"Grey",value:"#e5e7eb"}],i0s=[{value:"p",label:"Paragraph"},{value:"h1",label:"Heading 1"},{value:"h2",label:"Heading 2"},{value:"h3",label:"Heading 3"}],a0s=new Set(["B","STRONG","I","EM","U","A","FONT"]),i6t={"data-email-rte-ui":""},a6t=t=>t.preventDefault(),o6t=t=>ee("h-7 w-7",t&&"bg-primary/15 text-primary hover:bg-primary/20 hover:text-primary");function o0s(t){t&&t.querySelectorAll("font[color], [style]").forEach(e=>{e.tagName==="FONT"&&J5(e.getAttribute("color"))===OX&&e.removeAttribute("color"),J5(e.style.color)===OX&&e.style.removeProperty("color"),e.getAttribute("style")===""&&e.removeAttribute("style"),(e.tagName==="FONT"||e.tagName==="SPAN")&&!e.attributes.length&&e.replaceWith(...Array.from(e.childNodes))})}function l0s(t){t==null||t.querySelectorAll("[style]").forEach(e=>{var i,o;if(t6t(e))return;const n=(i=r6t.find(l=>l.value===J5(e.style.color)))==null?void 0:i.value,r=(o=s6t.find(l=>l.value===J5(e.style.backgroundColor)))==null?void 0:o.value,s=[n&&`color:${n}`,r&&`background-color:${r}`].filter(Boolean).join(";");if(e.tagName==="SPAN"){s?e.setAttribute("style",s):e.replaceWith(...Array.from(e.childNodes));return}if(Array.from({length:e.style.length},(l,c)=>e.style.item(c)).filter(l=>l!=="text-align").forEach(l=>e.style.removeProperty(l)),e.getAttribute("style")||e.removeAttribute("style"),s&&a0s.has(e.tagName)){const l=document.createElement("span");l.setAttribute("style",s),l.append(...Array.from(e.childNodes)),e.append(l)}})}function l6t({label:t,icon:e,open:n,onOpenChange:r,onReturnFocus:s,className:i,children:o}){const l=y.useRef(!1);return a.jsxs(Ni,{open:n,onOpenChange:r,children:[a.jsx(Ti,{asChild:!0,children:a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:o6t(n),title:t,"aria-label":t,onMouseDown:a6t,children:e})}),a.jsx(yi,{...i6t,align:"start",className:i,onInteractOutside:()=>{l.current=!0},onCloseAutoFocus:c=>{c.preventDefault(),l.current||s(),l.current=!1},children:o})]})}function oet({label:t,icon:e,colors:n,resetLabel:r,onPick:s,onReturnFocus:i}){const[o,l]=y.useState(!1),c=d=>{s(d),l(!1)};return a.jsxs(l6t,{label:t,icon:e,open:o,onOpenChange:l,onReturnFocus:i,className:"w-auto p-2",children:[a.jsx("div",{className:"grid grid-cols-4 gap-1.5",role:"group","aria-label":t,children:n.map(d=>a.jsx("button",{type:"button",title:d.name,"aria-label":d.name,onClick:()=>c(d.value),className:"h-6 w-6 rounded-full border border-border transition-transform hover:scale-110 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1",style:{backgroundColor:d.value}},d.value))}),a.jsx("button",{type:"button",onClick:()=>c(null),className:"mt-2 w-full rounded px-2 py-1 text-left text-xs text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:r})]})}function c0s({api:t}){const e=y.useMemo(()=>({get current(){return t.element()}}),[t]),{formats:n,refresh:r}=X_e(e);y.useEffect(()=>{const A=()=>window.setTimeout(r,0);return document.addEventListener("selectionchange",A),()=>document.removeEventListener("selectionchange",A)},[r]);const s=y.useId(),[i,o]=y.useState(!1),[l,c]=y.useState(""),[d,u]=y.useState(""),[h,m]=y.useState(!1),f=A=>!!n[A],p=f(fs.bulletList)||f(fs.numberedList),g=f(fs.heading1)?"h1":f(fs.heading)?"h2":f(fs.heading3)?"h3":"p",v=(A,_)=>{t.restoreSelection(),document.execCommand(A,!1,_),t.commit(),r()},b=A=>{t.restoreSelection(),document.execCommand("foreColor",!1,A??OX),A||o0s(t.element()),t.commit()},x=A=>{t.restoreSelection();const _=A??"transparent";document.execCommand("styleWithCSS",!1,"true"),document.execCommand("hiliteColor",!1,_)||document.execCommand("backColor",!1,_),document.execCommand("styleWithCSS",!1,"false"),t.commit()},w=A=>{t.restoreSelection(),g!=="p"&&!p&&document.execCommand("formatBlock",!1,"p"),document.execCommand(A,!1),t.commit(),r()},k=()=>{var T,R,O;const A=(T=t.savedRange())==null?void 0:T.startContainer,_=(R=A instanceof Element?A:A==null?void 0:A.parentElement)==null?void 0:R.closest("a");return _&&((O=t.element())!=null&&O.contains(_))?_:null},S=A=>{if(A){const _=k();c((_==null?void 0:_.getAttribute("href"))??""),m(!!_),u("")}o(A)},C=()=>{var T,R;const A=n6t(l);if(!A){u("Enter a valid web address, like https://example.com");return}const _=k();if(_)_.setAttribute("href",A);else{if(t.restoreSelection(),(T=window.getSelection())!=null&&T.isCollapsed){const O=document.createElement("a");O.setAttribute("href",A),O.textContent=A,document.execCommand("insertHTML",!1,O.outerHTML)}else document.execCommand("createLink",!1,A);(R=window.getSelection())==null||R.collapseToEnd()}t.commit(),o(!1)},j=()=>{const A=k();A==null||A.replaceWith(...Array.from(A.childNodes)),t.commit(),o(!1)},E=(A,_,T,R)=>a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:o6t(R),title:A,"aria-label":A,"aria-pressed":R,onMouseDown:a6t,onClick:T,children:_}),N=a.jsx("span",{"aria-hidden":"true",className:"mx-0.5 h-4 w-px self-center bg-border"});return a.jsxs("div",{...i6t,role:"toolbar","aria-label":"Text formatting",className:"flex flex-wrap items-center gap-0.5 border-b border-border p-1",children:[a.jsx("select",{"aria-label":"Text style",value:g,disabled:p,onChange:A=>v("formatBlock",A.target.value),className:"mr-0.5 h-7 w-[5.5rem] flex-none rounded-md border-0 bg-transparent px-1 text-xs text-foreground outline-none hover:bg-muted focus-visible:ring-2 focus-visible:ring-ring disabled:opacity-50",children:i0s.map(A=>a.jsx("option",{value:A.value,children:A.label},A.value))}),E("Bold",a.jsx(aee,{className:"h-4 w-4"}),()=>v("bold"),f(fs.bold)),E("Italic",a.jsx(cee,{className:"h-4 w-4"}),()=>v("italic"),f(fs.italic)),E("Underline",a.jsx(jSe,{className:"h-4 w-4"}),()=>v("underline"),f(fs.underline)),a.jsx(oet,{label:"Text colour",icon:a.jsx(cBt,{className:"h-4 w-4"}),colors:r6t,resetLabel:"Default colour",onPick:b,onReturnFocus:t.restoreSelection}),a.jsx(oet,{label:"Highlight",icon:a.jsx(DBt,{className:"h-4 w-4"}),colors:s6t,resetLabel:"No highlight",onPick:x,onReturnFocus:t.restoreSelection}),E("Align left",a.jsx(dSe,{className:"h-4 w-4"}),()=>v("justifyLeft"),!f(fs.alignCenter)&&!f(fs.alignRight)),E("Align centre",a.jsx(iBt,{className:"h-4 w-4"}),()=>v("justifyCenter"),f(fs.alignCenter)),E("Align right",a.jsx(aBt,{className:"h-4 w-4"}),()=>v("justifyRight"),f(fs.alignRight)),N,E("Bulleted list",a.jsx(rI,{className:"h-4 w-4"}),()=>w("insertUnorderedList"),f(fs.bulletList)),E("Numbered list",a.jsx(uee,{className:"h-4 w-4"}),()=>w("insertOrderedList"),f(fs.numberedList)),N,a.jsxs(l6t,{label:"Link",icon:a.jsx(eu,{className:"h-4 w-4"}),open:i,onOpenChange:S,onReturnFocus:t.restoreSelection,className:"w-64 space-y-2 p-3",children:[a.jsx(_e,{htmlFor:s,children:"Link URL"}),a.jsx(Oe,{id:s,value:l,placeholder:"https://example.com","aria-invalid":!!d,"aria-describedby":d?`${s}-error`:void 0,onChange:A=>{c(A.target.value),u("")},onKeyDown:A=>{A.key==="Enter"&&(A.preventDefault(),C())}}),d&&a.jsx("p",{id:`${s}-error`,role:"alert",className:"text-xs text-destructive",children:d}),a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[h?a.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:j,children:"Remove link"}):a.jsx("span",{}),a.jsx(Z,{type:"button",size:"sm",onClick:C,disabled:!l.trim(),children:h?"Update link":"Add link"})]})]}),E("Clear formatting",a.jsx(est,{className:"h-4 w-4"}),()=>v("removeFormat"))]})}const c6t=y.forwardRef(function({value:e,onChange:n,ariaLabel:r,toolbar:s=!1,group:i,placeholder:o="Write your content here…",className:l},c){const d=y.useRef(null),u=y.useRef(null),h=y.useRef(null),m=y.useRef(n);m.current=n;const[f,p]=y.useState(!e);y.useEffect(()=>{const k=d.current;!k||e===u.current||(u.current=e,k.innerHTML=lD(e),h.current=null,p(!k.innerHTML))},[e]);const g=y.useMemo(()=>({element:()=>d.current,savedRange:()=>h.current,restoreSelection:()=>{const k=d.current;if(!k)return;const S=window.getSelection(),C=!!(S!=null&&S.rangeCount&&k.contains(S.anchorNode));if(k.focus(),!S||C)return;let j=h.current;(!j||!k.contains(j.commonAncestorContainer))&&(j=document.createRange(),j.selectNodeContents(k),j.collapse(!1)),S.removeAllRanges(),S.addRange(j)},commit:()=>{const k=d.current;if(!k)return;l0s(k);const S=lD(k);p(!S),S!==u.current&&(u.current=S,m.current(S))}}),[]),v=y.useMemo(()=>{const k=()=>i&&VH.get(i)||g;return{element:()=>k().element(),savedRange:()=>k().savedRange(),restoreSelection:()=>k().restoreSelection(),commit:()=>k().commit()}},[i,g]);y.useEffect(()=>{if(!s&&!i)return;const k=()=>{var C;const S=window.getSelection();S!=null&&S.rangeCount&&((C=d.current)!=null&&C.contains(S.anchorNode))&&(h.current=S.getRangeAt(0).cloneRange(),i&&VH.set(i,g))};return document.addEventListener("selectionchange",k),()=>{document.removeEventListener("selectionchange",k),i&&VH.get(i)===g&&VH.delete(i)}},[s,i,g]),y.useImperativeHandle(c,()=>({insertText:k=>{v.restoreSelection(),document.execCommand("insertText",!1,k),v.commit()}}),[v]);const b=k=>{k.preventDefault();const S=lD(k.clipboardData.getData("text/html"),{pasted:!0});if(S){const C=new DOMParser().parseFromString(S,"text/html").body,j=C.children.length===1?C.firstElementChild:null;document.execCommand("insertHTML",!1,(j==null?void 0:j.tagName)==="P"&&!j.hasAttribute("style")?j.innerHTML:S)}else document.execCommand("insertText",!1,k.clipboardData.getData("text/plain").replace(/\r\n?/g,`
`));g.commit()},x=k=>{var j,E;const S=d.current;if(!S||document.activeElement===S||(E=(j=k.relatedTarget)==null?void 0:j.closest)!=null&&E.call(j,"[data-email-rte-ui]"))return;const C=lD(S);S.innerHTML!==C&&(S.innerHTML=C,h.current=null)},w=a.jsx("div",{ref:d,contentEditable:!0,role:"textbox","aria-multiline":"true","aria-label":r,"aria-placeholder":o,"data-placeholder":o,"data-empty":f,onInput:g.commit,onPaste:b,onBlur:x,className:ee("rich-html relative min-h-[1.5em] break-words [overflow-wrap:anywhere] [&_font[color='#010203']]:text-inherit","data-[empty=true]:before:pointer-events-none data-[empty=true]:before:absolute data-[empty=true]:before:text-muted-foreground/70 data-[empty=true]:before:content-[attr(data-placeholder)]",l)});return s?a.jsxs("div",{className:"rounded-md border border-input bg-background ring-offset-background focus-within:ring-2 focus-within:ring-ring focus-within:ring-offset-2",children:[a.jsx(c0s,{api:v}),w]}):w});function QIe(t){try{const e=new URL((t??"").trim());return e.protocol==="http:"||e.protocol==="https:"}catch{return!1}}function d0s(t){let e;try{e=new URL((t??"").trim())}catch{return null}const n=e.hostname.replace(/^(www\.|m\.)/,"");let r=null;if(n==="youtu.be")r=e.pathname.split("/")[1];else if(n==="youtube.com"||n==="youtube-nocookie.com"){const[,s,i]=e.pathname.split("/");r=s==="watch"?e.searchParams.get("v"):["shorts","embed","live"].includes(s)?i:null}return r&&/^[\w-]{6,20}$/.test(r)?r:null}function d6t(t){const e=QIe(t)?d0s(t):null;return e?`https://img.youtube.com/vi/${e}/hqdefault.jpg`:null}const u0s=40,h0s=1280,cet=2e4;function m0s(t){if(!Number.isFinite(t)||t<=0)return[1,3,6,0];if(t<2)return[0];const e=Math.max(0,t-.5);return[Math.max(1,t*.1),t*.25,t*.5].map(n=>Math.min(e,n))}function det(t,e,n){return new Promise((r,s)=>{const i=window.setTimeout(()=>{c(),s(new Error(`${e} timed out`))},n),o=()=>{c(),r()},l=()=>{c(),s(new Error("video could not be read"))},c=()=>{window.clearTimeout(i),t.removeEventListener(e,o),t.removeEventListener("error",l)};t.addEventListener(e,o),t.addEventListener("error",l)})}function f0s(t){const e=document.createElement("canvas");e.width=32,e.height=18;const n=e.getContext("2d");if(!n)return 255;n.drawImage(t,0,0,e.width,e.height);const{data:r}=n.getImageData(0,0,e.width,e.height);let s=0;for(let i=0;i<r.length;i+=4)s+=.299*r[i]+.587*r[i+1]+.114*r[i+2];return s/(r.length/4)}async function u6t(t){if(typeof document>"u")return null;let e=null;const n=document.createElement("video");try{if(e=typeof t=="string"?null:URL.createObjectURL(t),n.muted=!0,n.playsInline=!0,n.preload="auto",typeof t=="string"&&(n.crossOrigin="anonymous"),n.src=e??t,await det(n,"loadeddata",cet),!n.videoWidth||!n.videoHeight)return null;const r=Math.min(1,h0s/n.videoWidth),s=document.createElement("canvas");s.width=Math.round(n.videoWidth*r),s.height=Math.round(n.videoHeight*r);const i=s.getContext("2d");if(!i)return null;let o=null;for(const c of m0s(n.duration)){try{Math.abs(n.currentTime-c)>.01&&(n.currentTime=c,await det(n,"seeked",cet/2))}catch{continue}i.drawImage(n,0,0,s.width,s.height);const d=f0s(s);if(!o||d>o.luma){const u=await new Promise(h=>s.toBlob(h,"image/jpeg",.85));u&&(o={luma:d,blob:u})}if(d>=u0s)break}if(!o)return null;const l=typeof t=="string"?"video":t.name.replace(/\.[^.]+$/,"")||"video";return new File([o.blob],`${l}-thumbnail.jpg`,{type:"image/jpeg"})}catch{return null}finally{n.removeAttribute("src");try{n.load()}catch{}e&&URL.revokeObjectURL(e)}}const Uq=new Set,cke=new Set;function h6t(t,e=!0){e!==Uq.has(t)&&(e?Uq.add(t):Uq.delete(t),cke.forEach(n=>n()))}function m6t(t){return y.useSyncExternalStore(e=>(cke.add(e),()=>cke.delete(e)),()=>!!(t&&Uq.has(t)))}function f6t({url:t,thumbnail:e,preparing:n=!1,videoId:r,className:s}){const i=m6t(r),o=n&&!i,l=e||d6t(t);return a.jsxs("div",{className:ee("relative flex items-center justify-center overflow-hidden rounded-md",l?"aspect-video bg-black":o?"h-44 bg-muted":"h-44 bg-[#1f2430]",s),children:[l&&a.jsx("img",{src:l,alt:"",className:"absolute inset-0 h-full w-full object-cover"}),o&&!l?a.jsxs("span",{className:"flex items-center gap-2 text-xs font-medium text-muted-foreground",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"})," Preparing preview…"]}):a.jsx("span",{className:"relative flex h-12 w-12 items-center justify-center rounded-full bg-white/90 shadow-sm",children:a.jsx(fm,{className:"h-5 w-5 text-[#1f2430]"})})]})}const p0s=3;function iL(t){var n;const e=Array.isArray((n=t.data)==null?void 0:n.images)?t.data.images:[];return e.length>=2?e.slice(0,p0s).map(r=>typeof(r==null?void 0:r.url)=="string"?r.url:""):[t.url??""]}function g0s(t,e){const n=iL(t);if(e===1)return{url:n[0]??"",data:void 0};const r=Array.from({length:e},(s,i)=>({url:n[i]??""}));return{url:r[0].url,data:{images:r}}}function v0s(t,e,n){const r=iL(t);if(r.length===1)return{url:n};const s=r.map((i,o)=>({url:o===e?n:i}));return{url:s[0].url,data:{images:s}}}const y0s=[{label:"Square",value:1},{label:"Landscape 4:3",value:4/3},{label:"Wide 16:9",value:16/9},{label:"Portrait 3:4",value:3/4}],b0s=1200,x0s=1024*1024*1024,p6t=[{ext:"mp4",types:["video/mp4"]},{ext:"m4v",types:["video/x-m4v","video/mp4"]},{ext:"mov",types:["video/quicktime"]},{ext:"webm",types:["video/webm"]}],w0s=p6t.flatMap(t=>[`.${t.ext}`,...t.types]).filter((t,e,n)=>n.indexOf(t)===e).join(",");function uet(t){const e=(t.name.split(".").pop()||"").toLowerCase(),n=p6t.find(r=>r.ext===e);return!n||t.type&&!n.types.includes(t.type)&&!t.type.startsWith("video/")?"Use an MP4, MOV, M4V or WebM video.":t.size===0?"This file is empty. Choose another video.":t.size>x0s?"This video is larger than 1 GB. Trim or compress it, then try again.":null}function k0s(t,e=typeof window<"u"?window.location.origin:""){return`${e}${t}`}const S0s=/^\/v\/([A-Za-z0-9]{12})\/?$/;function g6t(t){var e;try{const n=new URL(String(t??"").trim());return/^https?:$/.test(n.protocol)?((e=n.pathname.match(S0s))==null?void 0:e[1])??null:null}catch{return null}}function ly(t){var e;return((e=t.data)==null?void 0:e.videoId)||g6t(t.url)||void 0}const fj=100,C0s=100*1024,j0s=2*1024*1024,E0s=new TextEncoder,o4=t=>E0s.encode(t??"").byteLength;function het(t){if(!Array.isArray(t))return{valid:!1,blockCount:0,contentBytes:0,message:"Campaign content blocks must be a flat array."};if(t.length>fj)return{valid:!1,blockCount:t.length,contentBytes:0,message:`Campaigns can contain at most ${fj} content blocks.`};let e=0;for(let n=0;n<t.length;n+=1){const r=t[n];if(!r||typeof r!="object"||Array.isArray(r))return{valid:!1,blockCount:t.length,contentBytes:e,message:`Content block ${n+1} is invalid.`};const s=o4(r.html);if(s>C0s)return{valid:!1,blockCount:t.length,contentBytes:e,message:`Text block ${n+1} exceeds the 100 KB rich-text limit.`};if(e+=r.html?s:o4(r.text),e+=o4(r.label)+o4(r.left)+o4(r.right),e>j0s)return{valid:!1,blockCount:t.length,contentBytes:e,message:"Campaign rich-text content cannot exceed 2 MB in total."}}return{valid:!0,blockCount:t.length,contentBytes:e}}const N0s=[{type:"heading",icon:IBt,label:"Heading"},{type:"text",icon:ust,label:"Text"},{type:"image",icon:Jl,label:"Image"},{type:"button",icon:XBt,label:"Button"},{type:"video",icon:Ca,label:"Video"},{type:"columns",icon:xBt,label:"Columns"},{type:"divider",icon:gSe,label:"Divider"}];function gC(){return"b_"+(typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10))}function met(t){switch(t){case"heading":return{id:gC(),type:t,text:"New heading"};case"text":return{id:gC(),type:t,text:"Write your content here…",html:""};case"button":return{id:gC(),type:t,label:"Click here",url:"https://pensil.so"};case"image":return{id:gC(),type:t,url:""};case"video":return{id:gC(),type:t,url:""};case"columns":return{id:gC(),type:t,left:"Left column text",right:"Right column text"};case"divider":return{id:gC(),type:t}}}const v6t=t=>({html:t,text:s0s(t)});function T0s({blocks:t,onChange:e,settingsSlot:n}){const{toast:r}=yt(),[s,i]=y.useState(null),[o,l]=y.useState("settings"),[c,d]=y.useState(null),u=y.useRef(null),[h,m]=y.useState("canvas"),f=t.some(S=>S.type==="video"&&!!ly(S)),p=t.find(S=>S.id===s)??null,g=y.useRef({blocks:t,onChange:e});g.current={blocks:t,onChange:e};const v=(S,C)=>g.current.onChange(g.current.blocks.map(j=>j.id===S?{...j,...C}:j));y.useEffect(()=>()=>L0s(),[]);const b=S=>{e(t.filter(C=>C.id!==S)),s===S&&i(null)};function x(S,C){S.preventDefault();const j=S.currentTarget.getBoundingClientRect();d(S.clientY-j.top<j.height/2?C:C+1)}function w(S){S.preventDefault();const C=u.current;if(!C)return;const j=c??t.length,E=[...t];if(C.kind==="new"){if(t.length>=fj){r({title:"Block limit reached",description:`A campaign can contain at most ${fj} content blocks.`,variant:"destructive"}),u.current=null,d(null);return}const N=met(C.type);E.splice(j,0,N),e(E),i(N.id),l("content")}else{const[N]=E.splice(C.index,1);E.splice(C.index<j?j-1:j,0,N),e(E)}u.current=null,d(null)}function k(S){var j;if((j=window.matchMedia)!=null&&j.call(window,"(min-width: 1024px)").matches)return;if(t.length>=fj){r({title:"Block limit reached",description:`A campaign can contain at most ${fj} content blocks.`,variant:"destructive"});return}const C=met(S);e([...t,C]),i(C.id),l("content"),m("canvas")}return a.jsxs("div",{className:"flex flex-1 flex-col overflow-hidden lg:flex-row",children:[f&&a.jsx(O0s,{blocks:t,onChange:e}),a.jsx("div",{className:"grid shrink-0 grid-cols-3 border-b border-border bg-card lg:hidden",role:"tablist","aria-label":"Editor panes",children:[["canvas","Design"],["blocks","Blocks"],["inspector","Settings"]].map(([S,C])=>a.jsx("button",{type:"button",role:"tab","aria-selected":h===S,onClick:()=>m(S),className:ee("py-2.5 text-sm font-medium transition-colors",h===S?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"),children:C},S))}),a.jsxs("aside",{className:ee("shrink-0 overflow-y-auto border-border bg-card p-4 lg:block lg:w-52 lg:flex-none lg:overflow-visible lg:border-r",h==="blocks"?"min-h-0 flex-1":"hidden"),children:[a.jsxs("div",{className:"mb-3 flex items-center gap-1.5",children:[a.jsx("h3",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Blocks"}),a.jsx(gn,{label:"Campaign content limits",side:"right",children:"Campaigns support up to 100 blocks and 2 MB of text content. Hosted images referenced by URL do not use that text allowance."}),a.jsxs("span",{className:"ml-auto text-[11px] text-muted-foreground",children:[t.length,"/",fj]})]}),a.jsx("div",{className:"grid grid-cols-3 gap-2 sm:grid-cols-4 lg:grid-cols-2",children:N0s.map(S=>a.jsxs("div",{draggable:!0,onClick:()=>k(S.type),onDragStart:()=>u.current={kind:"new",type:S.type},onDragEnd:()=>{u.current=null,d(null)},className:"flex cursor-grab flex-col items-center gap-1.5 rounded-lg border border-border bg-surface p-3 text-center transition-colors hover:border-primary/40 hover:bg-accent active:cursor-grabbing",children:[a.jsx(S.icon,{className:"h-4.5 w-4.5 text-muted-foreground"}),a.jsx("span",{className:"text-xs text-foreground",children:S.label})]},S.type))}),a.jsx("p",{className:"mt-3 hidden text-[11px] leading-relaxed text-muted-foreground lg:block",children:"Drag a block onto the canvas, then click it to edit."}),a.jsx("p",{className:"mt-3 text-[11px] leading-relaxed text-muted-foreground lg:hidden",children:"Tap a block to add it to the end of your email, then open Settings to edit it."})]}),a.jsx("main",{className:ee("email-editor-scrollbar min-h-0 flex-1 overflow-y-auto overscroll-contain bg-muted/40 p-3 sm:p-6 lg:block lg:p-8",h!=="canvas"&&"hidden"),onDragOver:S=>S.preventDefault(),onDrop:w,onClick:()=>i(null),children:a.jsxs("div",{className:"mx-auto max-w-[600px] rounded-xl bg-card p-4 shadow-card lg:p-6",children:[t.length===0&&a.jsx("div",{className:ee("flex h-40 items-center justify-center rounded-lg border-2 border-dashed text-sm text-muted-foreground",c!==null?"border-primary bg-primary/5":"border-border"),children:"Drag blocks here to start"}),t.map((S,C)=>a.jsxs("div",{onDragOver:j=>x(j,C),children:[c===C&&a.jsx("div",{className:"my-1 h-0.5 rounded bg-primary"}),a.jsx(_0s,{block:S,selected:s===S.id,onSelect:j=>{j.stopPropagation(),i(S.id),l("content")},onDelete:()=>b(S.id),onText:j=>v(S.id,{text:j}),onPatch:j=>v(S.id,j),onDragStart:()=>u.current={kind:"move",index:C},onDragEnd:()=>{u.current=null,d(null)}})]},S.id)),c===t.length&&t.length>0&&a.jsx("div",{className:"my-1 h-0.5 rounded bg-primary"})]})}),a.jsxs("aside",{className:ee("shrink-0 flex-col border-border bg-card lg:flex lg:w-72 lg:flex-none lg:border-l",h==="inspector"?"flex min-h-0 flex-1":"hidden"),children:[a.jsx("div",{className:"grid grid-cols-2 border-b border-border",children:["content","settings"].map(S=>a.jsx("button",{onClick:()=>l(S),className:ee("py-2.5 text-sm font-medium capitalize transition-colors",o===S?"border-b-2 border-primary text-foreground":"text-muted-foreground hover:text-foreground"),children:S},S))}),a.jsx("div",{className:"email-editor-scrollbar flex-1 space-y-4 overflow-y-auto overscroll-contain p-4",children:o==="settings"?n:p?a.jsx(U0s,{block:p,onChange:S=>v(p.id,S),onDelete:()=>b(p.id)}):a.jsx("p",{className:"pt-6 text-center text-sm text-muted-foreground",children:"Select a block on the canvas to edit it."})})]})]})}function _0s({block:t,selected:e,onSelect:n,onDelete:r,onText:s,onPatch:i,onDragStart:o,onDragEnd:l}){return a.jsxs("div",{onClick:n,onDragEnd:l,className:ee("group relative my-1 rounded-lg border-2 border-transparent p-2 transition-colors hover:border-primary/30",e&&"border-primary bg-primary/[0.03]"),children:[a.jsx("div",{className:"absolute -left-2 top-1/2 z-10 hidden -translate-y-1/2 group-hover:block",children:a.jsx("span",{draggable:!0,onDragStart:o,className:"flex h-6 w-6 cursor-grab items-center justify-center rounded bg-card shadow-sm active:cursor-grabbing",children:a.jsx(PBt,{className:"h-4 w-4 text-muted-foreground"})})}),a.jsx("button",{onClick:c=>{c.stopPropagation(),r()},className:"absolute -right-2 top-1/2 z-10 hidden h-6 w-6 -translate-y-1/2 items-center justify-center rounded bg-card text-destructive shadow-sm group-hover:flex",children:a.jsx(qn,{className:"h-3.5 w-3.5"})}),a.jsx(A0s,{block:t,onText:s,onPatch:i})]})}function A0s({block:t,onText:e,onPatch:n}){var r,s;switch(t.type){case"heading":return a.jsx("h2",{className:"text-center text-xl font-bold text-foreground outline-none focus:ring-2 focus:ring-primary/30",contentEditable:!0,suppressContentEditableWarning:!0,onBlur:i=>e(i.currentTarget.textContent||""),children:t.text});case"text":return a.jsx(c6t,{group:t.id,value:YIe(t),onChange:i=>n(v6t(i)),ariaLabel:"Text block",className:"text-sm leading-relaxed text-muted-foreground outline-none focus:ring-2 focus:ring-primary/30"});case"image":{const i=iL(t);return i.length===1?t.url?a.jsx("img",{src:t.url,alt:"",className:"w-full rounded-md"}):a.jsx("div",{className:"flex h-40 items-center justify-center rounded-lg bg-muted",children:a.jsx(Jl,{className:"h-7 w-7 text-muted-foreground/60"})}):a.jsx("div",{className:ee("grid gap-2",i.length===3?"grid-cols-3":"grid-cols-2"),"aria-label":`${i.length} images side by side`,children:i.map((o,l)=>o?a.jsx("img",{src:o,alt:"",className:"w-full rounded-md"},l):a.jsx("div",{className:"flex h-28 items-center justify-center rounded-lg bg-muted",children:a.jsx(Jl,{className:"h-6 w-6 text-muted-foreground/60"})},l))})}case"button":return a.jsx("div",{className:"flex justify-center",children:a.jsx("span",{className:"rounded-md bg-primary px-5 py-2 text-sm font-medium text-primary-foreground",children:t.label})});case"divider":return a.jsx("hr",{className:"border-border"});case"video":return a.jsx(f6t,{url:t.url,thumbnail:(r=t.data)==null?void 0:r.thumbnail,preparing:!!(ly(t)&&!((s=t.data)!=null&&s.thumbnail)),videoId:ly(t),className:"rounded-lg"});case"columns":return a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx("p",{className:"min-h-[3rem] rounded-md bg-muted/40 p-2 text-sm leading-relaxed text-muted-foreground outline-none focus:ring-2 focus:ring-primary/30",contentEditable:!0,suppressContentEditableWarning:!0,onBlur:i=>n({left:i.currentTarget.textContent||""}),children:t.left}),a.jsx("p",{className:"min-h-[3rem] rounded-md bg-muted/40 p-2 text-sm leading-relaxed text-muted-foreground outline-none focus:ring-2 focus:ring-primary/30",contentEditable:!0,suppressContentEditableWarning:!0,onBlur:i=>n({right:i.currentTarget.textContent||""}),children:t.right})]})}}function P0s({value:t,onChange:e,label:n="Image",cropAspect:r,onCropAspect:s}){const{community:i}=qe(),{toast:o}=yt(),l=y.useRef(null),[c,d]=y.useState(!1),[u,h]=y.useState(null);function m(p){var v;const g=(v=p.target.files)==null?void 0:v[0];if(l.current&&(l.current.value=""),!!g){if(!g.type.startsWith("image/")){o({title:"Not an image",description:"Please choose an image file (PNG, JPG, GIF).",variant:"destructive"});return}if(g.size>5*1024*1024){o({title:"Image too large",description:"Please choose an image under 5 MB.",variant:"destructive"});return}if(!(i!=null&&i.id)){o({title:"No community",description:"Couldn't determine the community to upload to.",variant:"destructive"});return}g.type==="image/gif"?f(g):h(g)}}async function f(p){if(i!=null&&i.id){d(!0);try{const g=await Qre(i.id,p);e(g)}catch{o({title:"Upload failed",description:"Something went wrong. Try again.",variant:"destructive"})}finally{d(!1)}}}return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:n}),a.jsx("input",{ref:l,type:"file",accept:"image/*",className:"hidden",onChange:m,"aria-label":`Upload ${n.toLowerCase()}`}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"w-full",disabled:c,onClick:()=>{var p;return(p=l.current)==null?void 0:p.click()},children:c?a.jsxs(a.Fragment,{children:[a.jsx(Ne,{className:"mr-1.5 h-4 w-4 animate-spin"})," Uploading…"]}):a.jsxs(a.Fragment,{children:[a.jsx(kd,{className:"mr-1.5 h-4 w-4"})," Upload image"]})}),a.jsx(Oe,{value:t??"",onChange:p=>e(p.target.value),placeholder:"or paste an image URL"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Upload a file (under 5 MB) and crop it, or paste a hosted URL."}),a.jsx(Nh,{file:u,aspect:r,aspectOptions:y0s,onAspectChange:s,maxWidth:b0s,keepPng:!0,title:`Crop ${n.toLowerCase()}`,onCancel:()=>h(null),onCropped:p=>{h(null),f(p)}})]})}const R0s=[{count:1,label:"1 image"},{count:2,label:"2 side by side"},{count:3,label:"3 side by side"}];function I0s({block:t,onChange:e}){const n=iL(t),r=y.useRef(t);r.current=t;const[s,i]=y.useState(null),o=s??(n.length>1?1:16/9);return a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(X6,{label:"Layout",children:"Show one picture across the email, or two or three next to each other in one row (at most three, so each stays large enough to see on a phone). Each uploaded picture is cropped first; pick the same shape for every picture in a row so they line up."}),a.jsx("div",{role:"radiogroup","aria-label":"Images per row",className:"grid grid-cols-3 gap-1.5",children:R0s.map(({count:l,label:c})=>{const d=n.length===l;return a.jsxs("button",{type:"button",role:"radio","aria-checked":d,onClick:()=>e(g0s(t,l)),className:ee("flex flex-col items-center gap-1.5 rounded-md border px-1.5 py-2 text-[11px] font-medium leading-tight transition-colors",d?"border-primary bg-primary/5 text-foreground":"border-border text-muted-foreground hover:border-primary/40 hover:text-foreground"),children:[a.jsx("span",{className:"flex h-5 w-full max-w-[3.25rem] gap-0.5","aria-hidden":"true",children:Array.from({length:l},(u,h)=>a.jsx("span",{className:ee("flex-1 rounded-[3px]",d?"bg-primary/60":"bg-muted-foreground/30")},h))}),c]},l)})})]}),n.map((l,c)=>a.jsx(P0s,{label:n.length===1?"Image":`Image ${c+1}`,value:l,onChange:d=>e(v0s(r.current,c,d)),cropAspect:o,onCropAspect:i},`${n.length}-${c}`)),n.length>1&&n.some(l=>!l)&&a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Empty spots are left out of the email."})]})}function y6t({onInsert:t,keepCaret:e=!1}){return a.jsxs("div",{className:"flex flex-wrap items-center gap-1 pt-0.5",children:[a.jsx("span",{className:"text-[11px] text-muted-foreground",children:"Insert:"}),qIe.map(n=>a.jsx("button",{type:"button",title:`Insert ${n.token}`,onMouseDown:e?r=>r.preventDefault():void 0,onClick:()=>t(n.token),className:"rounded border border-border px-1.5 py-0.5 text-[11px] font-medium text-muted-foreground transition-colors hover:border-primary/40 hover:text-foreground",children:n.label},n.token))]})}const dke={phase:"idle"},m2=new Map,uke=new Set;function JC(t,e,n){var r;e.phase==="idle"?m2.delete(t):m2.set(t,{state:e,controller:n??((r=m2.get(t))==null?void 0:r.controller)}),uke.forEach(s=>s())}function M0s(t){return y.useSyncExternalStore(e=>(uke.add(e),()=>uke.delete(e)),()=>{var e;return((e=m2.get(t))==null?void 0:e.state)??dke})}const hke=new Set,b6t=new Set;function ZIe(t,e){h6t(t,!1),hke.forEach(n=>n(t,e))}async function x6t(t,e,n){b6t.add(e);try{const r=await n;if(!r)return!1;const s=await Qre(t,r),i=await ajt(t,e,s);return ZIe(e,i.thumbnailUrl||s),!0}catch{return!1}}function L0s(){m2.forEach(({controller:t})=>t==null?void 0:t.abort())}async function D0s({blockId:t,file:e,communityId:n,apply:r,notify:s}){var c;const i=(c=m2.get(t))==null?void 0:c.state.phase;if(i==="uploading"||i==="linking")return;const o=new AbortController;JC(t,{phase:"uploading",percent:0,file:e},o);const l=u6t(e);try{const d=await wAe(n,"video",e,h=>JC(t,{phase:"uploading",percent:h,file:e}),o.signal);JC(t,{phase:"linking",file:e});const u=await _lr(n,{videoUrl:d,title:e.name});r({url:k0s(u.path),data:{videoId:u.publicId,...u.thumbnailUrl?{thumbnail:u.thumbnailUrl}:{}}}),JC(t,dke),s("Video uploaded","Its SpatialChat Communities link is in the block. The thumbnail appears in a moment."),u.thumbnailUrl||x6t(n,u.publicId,l)}catch(d){if(kg(d)||o.signal.aborted){JC(t,dke);return}JC(t,{phase:"error",message:Dt(d,"The video could not be uploaded. Check your connection and try again."),file:e})}}function $0s({block:t,onChange:e}){var w,k;const{community:n}=qe(),{toast:r}=yt(),s=y.useRef(null),i=M0s(t.id),o=(t.url??"").trim(),l=o!==""&&!QIe(o),c=ly(t),d=m6t(c),u=y.useRef(null),[h,m]=y.useState(!1),[f,p]=y.useState(null);function g(S){var j;const C=(j=S.target.files)==null?void 0:j[0];if(u.current&&(u.current.value=""),!(!C||!c)){if(!C.type.startsWith("image/")){r({title:"Choose an image",description:"Use a JPG, PNG or WebP picture for the thumbnail.",variant:"destructive"});return}if(C.size>5*1024*1024){r({title:"Image too large",description:"Please choose an image under 5 MB.",variant:"destructive"});return}p(C)}}async function v(S){if(!(!c||!(n!=null&&n.id))){m(!0);try{const C=await Qre(n.id,S),j=await ajt(n.id,c,C);ZIe(c,j.thumbnailUrl||C),r({title:"Thumbnail updated",description:"The email shows this picture with a “Watch video” link."})}catch(C){r({title:"Couldn't update the thumbnail",description:Dt(C,"Something went wrong. Try again."),variant:"destructive"})}finally{m(!1)}}}function b(S){var E;const C=(E=S.target.files)==null?void 0:E[0];if(s.current&&(s.current.value=""),!C)return;const j=uet(C);if(j){JC(t.id,{phase:"error",message:j,file:C});return}x(C)}function x(S){n!=null&&n.id&&D0s({blockId:t.id,file:S,communityId:n.id,apply:e,notify:(C,j)=>r({title:C,description:j})})}return a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(X6,{label:"Upload a video",children:"Upload a video (MP4, MOV, M4V or WebM, up to 1 GB) and the email links to its own SpatialChat Communities video page, which anyone can open without logging in. Email apps cannot play video inside a message, so the email shows a picture taken from the video with a “Watch video” link."}),a.jsx("input",{ref:s,type:"file",accept:w0s,className:"hidden",onChange:b,"aria-label":"Upload video file"}),i.phase==="uploading"||i.phase==="linking"?a.jsxs("div",{className:"space-y-1.5 rounded-md border border-border p-2.5",role:"status","aria-live":"polite",children:[a.jsxs("div",{className:"flex items-center justify-between gap-2 text-xs",children:[a.jsx("span",{className:"min-w-0 truncate font-medium text-foreground",children:i.file.name}),a.jsx("span",{className:"shrink-0 text-muted-foreground",children:i.phase==="linking"?"Creating link…":`${i.percent}%`})]}),a.jsx("div",{className:"h-1.5 overflow-hidden rounded-full bg-muted",children:a.jsx("div",{className:"h-full rounded-full bg-primary transition-[width]",style:{width:`${i.phase==="linking"?100:i.percent}%`}})}),i.phase==="uploading"&&a.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"h-7 w-full text-xs",onClick:()=>{var S,C;return(C=(S=m2.get(t.id))==null?void 0:S.controller)==null?void 0:C.abort()},children:"Cancel upload"})]}):a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"w-full",onClick:()=>{var S;return(S=s.current)==null?void 0:S.click()},children:[a.jsx(kd,{className:"mr-1.5 h-4 w-4"})," ",c?"Replace with another video":"Upload video"]}),i.phase==="error"&&a.jsxs("div",{className:"space-y-1.5",role:"alert",children:[a.jsx("p",{className:"text-[11px] font-medium text-destructive",children:i.message}),!uet(i.file)&&a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"h-7 w-full text-xs",onClick:()=>x(i.file),children:"Try again"})]}),c&&i.phase==="idle"&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("p",{className:"text-[11px] text-muted-foreground",children:[(w=t.data)!=null&&w.thumbnail?"Uploaded. ":d?"Uploaded. A thumbnail couldn't be made from this video, so the email shows a play tile — choose a picture below. ":"Uploaded. Making a thumbnail from the video… ",a.jsx("a",{href:o,target:"_blank",rel:"noopener noreferrer",className:"font-medium text-primary underline",children:"Open the video page"})]}),a.jsx("input",{ref:u,type:"file",accept:"image/jpeg,image/png,image/webp",className:"hidden",onChange:g,"aria-label":"Choose thumbnail image"}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-8 flex-1 text-xs",disabled:h,onClick:()=>{var S;return(S=u.current)==null?void 0:S.click()},children:[h?a.jsx(Ne,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}):a.jsx(Jl,{className:"mr-1.5 h-3.5 w-3.5"}),h?"Saving thumbnail…":(k=t.data)!=null&&k.thumbnail?"Change thumbnail":"Choose thumbnail image"]}),a.jsx(gn,{label:"Thumbnail",children:"The picture recipients see in the email, linked to the video. It is taken from the video automatically; to use your own, choose a picture (under 5 MB) and crop it to the 16:9 frame the email shows. Also the way out if none could be made (some formats, such as HEVC .mov, can't be read in every browser)."})]}),a.jsx(Nh,{file:f,aspect:16/9,maxWidth:1280,title:"Crop thumbnail",onCancel:()=>p(null),onCropped:S=>{p(null),v(S)}})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(X6,{label:"Video URL",children:"Or paste a link instead. Email apps cannot play video inside a message, so the video is sent as a picture with a “Watch video” link that opens it in the browser. A YouTube link shows the video's own thumbnail; any other link shows a dark play tile."}),a.jsx(Oe,{value:t.url??"",onChange:S=>{var j;const C=g6t(S.target.value);C&&C===((j=t.data)==null?void 0:j.videoId)?e({url:S.target.value}):e(C?{url:S.target.value,data:{videoId:C}}:c?{url:S.target.value,data:void 0}:{url:S.target.value})},placeholder:"https://","aria-invalid":l,className:ee(l&&"border-destructive focus-visible:ring-destructive")}),l?a.jsx("p",{className:"text-[11px] text-destructive",children:"Enter a full link starting with https:// — without one the video is left out of the email."}):a.jsx("p",{className:"text-[11px] text-muted-foreground",children:o?"Recipients open the video by clicking it.":"Upload a video or paste its link. Without one the video is left out of the email."})]})]})}function O0s({blocks:t,onChange:e}){const{community:n}=qe();return F0s(t,e,n==null?void 0:n.id),null}function F0s(t,e,n){const r=y.useRef({blocks:t,onChange:e});r.current={blocks:t,onChange:e};const s=t.filter(i=>{var o;return i.type==="video"&&ly(i)&&!((o=i.data)!=null&&o.thumbnail)}).map(i=>ly(i)).sort().join(",");y.useEffect(()=>{const i=(o,l)=>{const{blocks:c,onChange:d}=r.current;c.some(u=>{var h;return u.type==="video"&&ly(u)===o&&((h=u.data)==null?void 0:h.thumbnail)!==l})&&d(c.map(u=>u.type==="video"&&ly(u)===o?{...u,data:{...u.data,videoId:o,thumbnail:l}}:u))};return hke.add(i),()=>{hke.delete(i)}},[]),y.useEffect(()=>{if(!s)return;let i=!1,o=0;const l=new Set(s.split(",")),c=h=>{l.delete(h),h6t(h)},d=async()=>{o+=1;for(const h of[...l]){const m=await ojt(h).catch(()=>null);if(i)return;if(!m){c(h);continue}if(m.thumbnailStatus==="ready"&&m.thumbnailUrl){l.delete(h),ZIe(h,m.thumbnailUrl);continue}if(n&&!b6t.has(h)){const f=await x6t(n,h,u6t(m.videoUrl));if(i)return;if(f){l.delete(h);continue}}m.thumbnailStatus==="failed"&&c(h)}i||!l.size||(o<60?u=setTimeout(d,4e3):l.forEach(c))};let u=setTimeout(d,2e3);return()=>{i=!0,clearTimeout(u)}},[s,n])}function B0s({block:t,onChange:e}){const n=y.useRef(null);return a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(X6,{label:"Text",children:["Select text here or on the canvas and use the toolbar to style it — the email is sent with the same formatting. A tag from “Insert” is replaced with each recipient's own detail; add a fallback for anyone missing it, like ",a.jsx("span",{className:"font-mono",children:"{{first_name|there}}"}),"."]}),a.jsx(c6t,{ref:n,toolbar:!0,group:t.id,value:YIe(t),onChange:r=>e(v6t(r)),ariaLabel:"Text",className:"email-editor-scrollbar max-h-72 min-h-[120px] overflow-y-auto overscroll-contain px-3 py-2 text-sm text-foreground outline-none"}),a.jsx(y6t,{keepCaret:!0,onInsert:r=>{var s;return(s=n.current)==null?void 0:s.insertText(r)}})]})}function U0s({block:t,onChange:e,onDelete:n}){return a.jsx(Al,{mode:"wait",children:a.jsxs(it.div,{initial:{opacity:0,x:8},animate:{opacity:1,x:0},className:"space-y-3",children:[a.jsxs("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:[t.type," block"]}),t.type==="heading"&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Text"}),a.jsx(us,{rows:4,value:t.text??"",onChange:r=>e({text:r.target.value})}),a.jsx(y6t,{onInsert:r=>e({text:`${t.text??""}${r}`})})]}),t.type==="text"&&a.jsx(B0s,{block:t,onChange:e}),t.type==="button"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Label"}),a.jsx(Oe,{value:t.label??"",onChange:r=>e({label:r.target.value})})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Link URL"}),a.jsx(Oe,{value:t.url??"",onChange:r=>e({url:r.target.value}),placeholder:"https://"})]})]}),t.type==="image"&&a.jsx(I0s,{block:t,onChange:e},t.id),t.type==="video"&&a.jsx($0s,{block:t,onChange:e}),t.type==="columns"&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Left column"}),a.jsx(us,{rows:3,value:t.left??"",onChange:r=>e({left:r.target.value})})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Right column"}),a.jsx(us,{rows:3,value:t.right??"",onChange:r=>e({right:r.target.value})})]})]}),t.type==="divider"&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"A horizontal divider. No settings."}),a.jsxs(Z,{variant:"outline",size:"sm",className:"w-full text-destructive hover:text-destructive",onClick:n,children:[a.jsx(qn,{className:"mr-1.5 h-4 w-4"})," Delete block"]})]},t.id)})}function z0s({block:t}){const e=y.useMemo(()=>lD(YIe(t),{mapText:NA,mapHref:n=>NA(n,void 0,encodeURIComponent)}),[t.html,t.text]);return a.jsx("div",{className:"rich-html text-sm leading-relaxed text-[#444] [&_a]:text-[hsl(217_91%_50%)] [&_h1]:text-[#101318] [&_h2]:text-[#101318] [&_h3]:text-[#101318]",onClick:n=>{const r=n.target.closest("a");r&&(n.preventDefault(),window.open(r.href,"_blank","noopener,noreferrer"))},dangerouslySetInnerHTML:{__html:e}})}function fet({blocks:t,fromName:e,subject:n}){return a.jsxs("div",{className:"overflow-hidden rounded-lg border border-border bg-white",children:[(n||e)&&a.jsxs("div",{className:"border-b border-border bg-muted/40 px-5 py-3",children:[a.jsxs("p",{className:"text-xs text-muted-foreground",children:["From ",a.jsx("span",{className:"font-medium text-foreground",children:e||L2})]}),a.jsx("p",{className:"truncate text-sm font-semibold text-foreground",children:n?NA(n):"(no subject)"})]}),a.jsx("div",{className:"space-y-3 px-6 py-6 text-[#1a1a1a]",children:t.map(r=>{var s,i,o;switch(r.type){case"heading":return a.jsx("h2",{className:"text-center text-xl font-bold",children:NA(r.text??"")||"Heading"},r.id);case"text":return a.jsx(z0s,{block:r},r.id);case"image":{const l=iL(r);if(l.length>1){const c=l.filter(Boolean);return c.length===0?a.jsx("div",{className:"flex h-28 items-center justify-center rounded-md bg-[#eef0f3]",children:a.jsx(Jl,{className:"h-7 w-7 text-[#9aa]"})},r.id):a.jsx("div",{className:ee("grid gap-2",c.length===3?"grid-cols-3":c.length===2?"grid-cols-2":"grid-cols-1"),children:c.map((d,u)=>a.jsx("img",{src:d,alt:"",className:"w-full rounded-md"},u))},r.id)}return r.url?a.jsx("img",{src:r.url,alt:"",className:"w-full rounded-md"},r.id):a.jsx("div",{className:"flex h-40 items-center justify-center rounded-md bg-[#eef0f3]",children:a.jsx(Jl,{className:"h-7 w-7 text-[#9aa]"})},r.id)}case"button":return a.jsx("div",{className:"flex justify-center py-1",children:a.jsx("span",{className:"rounded-md bg-[hsl(217_91%_50%)] px-5 py-2 text-sm font-medium text-white",children:r.label||"Button"})},r.id);case"divider":return a.jsx("hr",{className:"border-[#e5e7eb]"},r.id);case"video":return QIe(r.url)?a.jsxs("div",{className:"space-y-2 text-center",children:[a.jsx(f6t,{url:r.url,thumbnail:(s=r.data)==null?void 0:s.thumbnail,preparing:!!(ly(r)&&!((i=r.data)!=null&&i.thumbnail)),videoId:ly(r)}),(((o=r.data)==null?void 0:o.thumbnail)||d6t(r.url))&&a.jsx("p",{className:"text-sm font-semibold text-[#101318]",children:"▶ Watch video"})]},r.id):a.jsx("p",{className:"rounded-md border border-dashed border-[#d5d9df] px-3 py-4 text-center text-xs text-[#6b7280]",children:"This video has no link yet, so it will be left out of the email."},r.id);case"columns":return a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsx("p",{className:"text-sm leading-relaxed text-[#444]",children:NA(r.left??"")||"Left column"}),a.jsx("p",{className:"text-sm leading-relaxed text-[#444]",children:NA(r.right??"")||"Right column"})]},r.id);default:return null}})})]})}function V0s(t){return(t||[]).map(e=>{switch(e.type){case"heading":return`<h2>${e.text??""}</h2>`;case"text":return e.html||`<p>${e.text??""}</p>`;case"columns":return`<p>${e.left??""}</p><p>${e.right??""}</p>`;case"button":return`<a href="${e.url??"#"}">${e.label??""}</a>`;case"image":return iL(e).filter(Boolean).map(n=>`<img src="${n}" />`).join("");default:return""}}).join(`
`)}function H0s(t){return t.startsWith("SPAM_PHRASES:")?`Spam-trigger words: ${t.slice(13).split(",").filter(Boolean).join(", ")}`:{SUBJECT_ALL_CAPS:"Subject is in ALL CAPS",EXCESSIVE_PUNCTUATION:"Excessive punctuation (e.g. !! or ??)",EMPTY_SUBJECT:"Subject is empty",LONG_SUBJECT:"Subject is very long (over 90 characters)",MANY_LINKS:"Too many links (over 20)",IMAGE_HEAVY_LOW_TEXT:"Image-heavy with very little text"}[t]??t}const pet={low:{cls:"border-success/20 bg-success/5 text-success",Icon:yo,label:"Looks good"},medium:{cls:"border-warning/20 bg-warning/5 text-warning",Icon:Bf,label:"Could be improved"},high:{cls:"border-destructive/20 bg-destructive/5 text-destructive",Icon:kSe,label:"Likely to hit spam"}};function G0s({communityId:t,subject:e,blocks:n}){const r=Wgr(t),s=V0s(n);if(y.useEffect(()=>{if(!t)return;const l=setTimeout(()=>r.mutate({subject:e,html:s}),500);return()=>clearTimeout(l)},[t,e,s]),r.isPending||!r.data&&!r.isError)return a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-border bg-muted/40 px-3 py-2 text-sm text-muted-foreground",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"})," Checking spam score…"]});if(r.isError||!r.data)return a.jsx("div",{className:"rounded-lg border border-border bg-muted/40 px-3 py-2 text-sm text-muted-foreground",children:"Couldn't check the spam score."});const i=pet[r.data.level]??pet.low,o=r.data.warnings??[];return a.jsxs("div",{className:ee("rounded-lg border px-3 py-2.5",i.cls),children:[a.jsxs("div",{className:"flex items-center gap-2 text-sm font-medium",children:[a.jsx(i.Icon,{className:"h-4 w-4"}),"Spam score ",r.data.score??0,"/100 · ",i.label]}),o.length>0&&a.jsx("ul",{className:"mt-1.5 list-disc space-y-0.5 pl-6 text-xs",children:o.map(l=>a.jsx("li",{children:H0s(l)},l))})]})}function w6t({className:t}){const{toast:e}=yt(),[n,r]=y.useState(null),s=async i=>{if(!await kN(i)){e({title:"Couldn't copy",description:`Type ${i} instead.`,variant:"destructive"});return}r(i),window.setTimeout(()=>r(l=>l===i?null:l),1500)};return a.jsxs("div",{className:ee("rounded-lg border border-border bg-muted/40 p-3",t),children:[a.jsx("p",{className:"text-xs font-medium text-foreground",children:"Personalise this email"}),a.jsx("p",{className:"mt-0.5 text-[11px] leading-relaxed text-muted-foreground",children:"Use these in the title or the body — each recipient sees their own value. Click one to copy it."}),a.jsx("div",{className:"mt-2 flex flex-wrap gap-1.5",children:qIe.map(i=>{const o=n===i.token;return a.jsxs("button",{type:"button",onClick:()=>void s(i.token),title:`${i.label} — e.g. ${i.sample}`,className:ee("inline-flex items-center gap-1 rounded border px-1.5 py-0.5 font-mono text-[11px] transition-colors",o?"border-primary/50 bg-primary/10 text-foreground":"border-border text-muted-foreground hover:border-primary/40 hover:text-foreground"),children:[o?a.jsx(Qn,{className:"h-3 w-3"}):a.jsx(Zl,{className:"h-3 w-3"}),i.token]},i.token)})}),a.jsxs("p",{className:"mt-2 text-[11px] leading-relaxed text-muted-foreground",children:["Add a fallback for anyone missing that detail:"," ",a.jsx("code",{className:"rounded bg-background px-1 py-0.5 font-mono",children:"{{first_name|there}}"})," ","shows ",a.jsx("span",{className:"text-foreground",children:"there"})," when no first name is known."]})]})}function W0s({communityId:t,value:e,onChange:n}){const r=VNt(t),s=r.data??[],i=u=>u.toLowerCase(),o=new Set(e.map(i)),l=new Set(s.map(i)),c=[...s,...e.filter(u=>!l.has(i(u)))],d=u=>n(o.has(i(u))?e.filter(h=>i(h)!==i(u)):[...e,u]);return r.isLoading?a.jsx("p",{className:"text-xs text-muted-foreground",children:"Loading tags…"}):r.isError?a.jsx("p",{className:"text-xs font-medium text-destructive",role:"alert",children:"The tags could not be loaded. Reload the page to try again."}):c.length===0?a.jsxs("p",{className:"rounded-lg border border-dashed border-border px-3 py-2 text-xs text-muted-foreground",children:["Nobody in your audience has a tag yet. Add tags to people in"," ",a.jsx(vr,{to:ve.emailAudience,className:"font-medium text-primary hover:underline",children:"Audience"}),", then pick them here."]}):a.jsxs("div",{className:"space-y-1.5",children:[a.jsx("div",{className:"flex flex-wrap gap-1.5",role:"group","aria-label":"Tags to send to",children:c.map(u=>{const h=o.has(i(u));return a.jsxs("button",{type:"button","aria-pressed":h,onClick:()=>d(u),title:u,className:ee("inline-flex max-w-[14rem] items-center gap-1 rounded-full border px-2.5 py-1 text-xs transition-colors",h?"border-primary bg-primary/10 font-medium text-foreground":"border-border text-muted-foreground hover:border-primary/40 hover:text-foreground"),children:[h&&a.jsx(Qn,{className:"h-3 w-3 shrink-0"}),a.jsx("span",{className:"truncate",children:u})]},u)})}),e.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"Pick at least one tag."})]})}function k6t({open:t,onOpenChange:e,inputId:n,email:r,onEmailChange:s,sending:i,onSend:o}){return a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg max-w-sm",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Send a test email"}),a.jsx(_n,{children:"Saves the draft, then sends one copy to this address. It does not go to the audience."})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:n,children:"Email"}),a.jsx(Oe,{id:n,type:"email",value:r,onChange:l=>s(l.target.value),placeholder:"Your account email"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Leave blank to send to your own account email. Because a test goes out from the live sender, any other address has to be approved for test sends first — ask whoever runs your SpatialChat Communities deployment."})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"ghost",onClick:()=>e(!1),children:"Cancel"}),a.jsx(Z,{disabled:i,onClick:o,children:i?"Sending…":"Send test"})]})]})})}const q0s={Newsletter:"217 91% 50%",Promotion:"38 92% 50%",Onboarding:"152 55% 42%",Events:"280 65% 55%",Text:"215 15% 45%"},K0s=t=>q0s[t??""]??"217 91% 50%";function Yhe(t){return(t??[]).map((e,n)=>({id:String(e._id||e.id||`b${n}`),type:e.type,text:e.text,html:e.html,url:e.url,label:e.label,left:e.left,right:e.right}))}const Qhe=[{key:"template",label:"Template"},{key:"editor",label:"Design"},{key:"review",label:"Review & send"}],Y0s=NM({title:wl().trim().min(1,"Campaign name is required."),subject:wl().trim().min(1,"Subject line is required.").max(80,"Keep the subject under 80 characters."),preview:wl().max(120,"Preview text should be under 120 characters."),fromName:wl().trim().min(1,"From name is required."),audience:wl().trim().min(1,"Choose an audience."),abTest:oVe(),schedule:oVe(),scheduledAt:wl().optional()}).superRefine((t,e)=>{if(t.schedule){if(!t.scheduledAt){e.addIssue({code:fn.custom,message:"Pick a schedule date.",path:["scheduledAt"]});return}new Date(t.scheduledAt).getTime()<=Date.now()&&e.addIssue({code:fn.custom,message:"Schedule time must be in the future.",path:["scheduledAt"]})}}),get=()=>t9(new Date(Date.now()+24*60*60*1e3));function Q0s(){var js;const t=Nn(),{toast:e}=yt(),n=ob(),{community:r}=qe(),{groups:s}=Ln(),{campaigns:i,segments:o,addCampaign:l,updateCampaign:c,sendTestCampaign:d}=Jy(),{data:u=[]}=VAe((r==null?void 0:r.id)??null),h=u.filter(Gt=>Gt.kind!=="newsletter"),[m]=xc(),f=m.get("edit"),p=m.get("from"),g=m.get("step")==="review",v=f||p,b=!!f;y.useEffect(()=>{if(v)return;const Gt=u.find(lr=>lr.id===m.get("template"));(Gt==null?void 0:Gt.kind)==="newsletter"&&(t(ve.emailTemplates,{replace:!0}),e({title:"Choose a newsletter for this template"}))},[u,v,t,m,e]);const{data:x,isLoading:w,isError:k}=$Nt((r==null?void 0:r.id)??null,v),[S,C]=y.useState(v?"editor":"template"),[j,E]=y.useState(v?null:m.get("template")),N=jM({resolver:EM(Y0s),mode:"onChange",defaultValues:{title:"",subject:"",preview:"",fromName:lge(null,r==null?void 0:r.name),audience:"filter:everyone",abTest:!1,schedule:!1,scheduledAt:get()}}),[A,_]=y.useState(()=>structuredClone(ogr)),[T,R]=y.useState(!1),[O,F]=y.useState(!1),[D,I]=y.useState(""),[P,M]=y.useState(!1),[z,G]=y.useState(""),[B,H]=y.useState("admin"),[W,V]=y.useState([]),U=y.useRef(!1),[ne,te]=y.useState(!v),[re,fe]=y.useState(f),[le,q]=y.useState("idle"),[Y,X]=y.useState(""),Q=y.useRef(!1),ie=y.useRef(null),he=y.useRef(""),ye=y.useRef(null),J=y.useRef(!1),K=y.useRef(!1);y.useEffect(()=>{f&&fe(f)},[f]);const ce=x?x.status==="draft"||x.status==="scheduled":!b||!!re,pe=(x==null?void 0:x.status)==="scheduled";function Ie(Gt){var ct;E(Gt);const lr=h.find(Bn=>Bn.id===Gt);(ct=lr==null?void 0:lr.blocks)!=null&&ct.length&&_(Yhe(lr.blocks))}y.useEffect(()=>{var lr,ct,Bn;if(!x||U.current)return;U.current=!0,N.reset({title:b?x.title:HNt(x.title,i.map(Ms=>Ms.title)),subject:x.subject??"",preview:x.preheader??"",fromName:lge(x.fromName,r==null?void 0:r.name),audience:x.audienceFilters?`filter:${x.audienceFilters.kind}`:x.audienceSegmentId?`segment:${String(x.audienceSegmentId)}`:"filter:everyone",abTest:!!x.abTest,schedule:x.status==="scheduled",scheduledAt:x.scheduledAt?t9(new Date(x.scheduledAt)):get()}),_(Yhe(x.blocks)),G(((lr=x.audienceFilters)==null?void 0:lr.spaceId)||""),H(((ct=x.audienceFilters)==null?void 0:ct.role)||"admin");const Gt=x.audienceFilters;V((Bn=Gt==null?void 0:Gt.tags)!=null&&Bn.length?Gt.tags:Gt!=null&&Gt.tag?[Gt.tag]:[]),E(x.templateId||"tpl_text"),C("editor"),te(!0),g&&N.trigger(["title","subject","preview","fromName"]).then(Ms=>{Ms?C("review"):e({title:"Finish the details first",description:"Fill in what's highlighted, then continue to Review & send."})})},[i,N,b,x,g,e]);const Me=y.useRef(!1);y.useEffect(()=>{var ct;if(Me.current||v)return;const Gt=m.get("template");if(!Gt||!h.length)return;const lr=h.find(Bn=>Bn.id===Gt);lr&&(Me.current=!0,E(Gt),(ct=lr.blocks)!=null&&ct.length&&_(Yhe(lr.blocks)))},[h,v]);const[we,Be]=y.useState("desktop"),Ve=N.watch(),{errors:be}=N.formState,Ze=Ve.subject.trim().length,Pe=Ze>=50&&Ze<=60?"Good subject length for most inboxes.":Ze>60?"Subject is getting long; aim for 50–60 characters.":null,Ke=Qhe.findIndex(Gt=>Gt.key===S),De=Ve.audience.startsWith("segment:")?Ve.audience.slice(8):"",xt=o.find(Gt=>Gt.id===De),Xe=y.useMemo(()=>o.filter(Gt=>Gt.id===De),[o,De]),tt=Ve.audience.startsWith("filter:")?Ve.audience.slice(7):null,$e=y.useMemo(()=>tt==="space"?{kind:"space",spaceId:z}:tt==="role"?{kind:"role",role:B}:tt==="tag"?{kind:"tag",tags:W}:{kind:tt||"everyone"},[tt,B,z,W]),[wt,Ee]=y.useState($e);y.useEffect(()=>{const Gt=setTimeout(()=>Ee($e),350);return()=>clearTimeout(Gt)},[$e]);const Ge=!!(tt&&(tt!=="space"||z)&&(tt!=="tag"||W.length>0)),Pt=Rgr((r==null?void 0:r.id)??null,wt,Ge),vn=tt?((js=Pt.data)==null?void 0:js.count)??0:(xt==null?void 0:xt.count)??0,Hn=oF(),yr=lF(),br=a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:"ttl",children:"Campaign name"}),a.jsx(gn,{label:"Campaign name",children:"A name for your own reference, used to find this campaign in the list. Recipients never see it — what they see is the subject line."})]}),a.jsx(Oe,{id:"ttl",...N.register("title"),placeholder:"Internal name"}),be.title&&a.jsx("p",{className:"text-xs font-medium text-destructive",children:be.title.message})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:"subj",children:"Subject line"}),a.jsx(gn,{label:"Subject line",children:"The headline recipients see in their inbox, and the biggest influence on whether they open the email. Keep it short and specific — long subjects get cut off on phones."})]}),a.jsx(Oe,{id:"subj",...N.register("subject"),placeholder:"Your subject…"}),be.subject?a.jsx("p",{className:"text-xs font-medium text-destructive",children:be.subject.message}):Pe&&a.jsx("p",{className:"text-xs text-muted-foreground",children:Pe})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:"prev",children:"Preview text"}),a.jsx(gn,{label:"Preview text",children:"The grey line most inboxes show after the subject. Use it to add a reason to open rather than repeating the subject. Left blank, the inbox shows the first words of your email instead."})]}),a.jsx(Oe,{id:"prev",...N.register("preview"),placeholder:"Shown after the subject"}),be.preview&&a.jsx("p",{className:"text-xs font-medium text-destructive",children:be.preview.message})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:"from",children:"From name"}),a.jsx(gn,{label:"From name",children:"The sender name in the inbox. A name people recognise — your community's — gets opened more often than a generic one. Personalisation tags don't work here."})]}),a.jsx(Oe,{id:"from",...N.register("fromName")}),be.fromName&&a.jsx("p",{className:"text-xs font-medium text-destructive",children:be.fromName.message}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Shown as the sender. Merge tags don’t work here — use a plain name."})]}),a.jsx(w6t,{})]});function Yt(Gt){if(Gt!=="template"&&!j){e({title:"Pick a template first",description:"Choose a design to start the editor."});return}C(Gt)}const nr=(Gt=!0)=>{const lr=het(A);return lr.valid?!0:(Gt&&e({title:"Campaign content is too large",description:lr.message,variant:"destructive"}),!1)},Kn=async()=>await N.trigger(["title","subject","preview","fromName"])&&nr(),ms=(Gt=N.getValues())=>({title:Gt.title.trim()||Gt.subject.trim()||"Untitled email",subject:Gt.subject.trim(),preheader:Gt.preview.trim(),fromName:Gt.fromName.trim(),type:"broadcast",audience:(xt==null?void 0:xt.name)??tt??"Everyone",audienceSegmentId:De||null,audienceFilters:tt?Ge?$e:void 0:null,abTest:Gt.abTest,blocks:A,templateId:h.some(lr=>lr.id===j)?j:null});async function is({navigateAway:Gt=!1,silent:lr=!1}={}){if(J.current)return re;if(ye.current)return ye.current;if(S==="template"&&!re)return null;const ct=het(A);if(!ct.valid){const Qt=ct.message||"Campaign content is invalid.";return X(Qt),q("error"),lr||e({title:"Campaign content is too large",description:Qt,variant:"destructive"}),null}const Bn=N.getValues(),Ms=Bn.title.trim()||Bn.subject.trim()||"Untitled email",Ue=Bn.subject.trim()||Bn.title.trim()||"Untitled email",et=!!(Bn.title.trim()||Bn.subject.trim()),Le=A.some(Qt=>{var Jt,Qe,Lt,Xt,xr;return!!((Jt=Qt.text)!=null&&Jt.trim()||(Qe=Qt.url)!=null&&Qe.trim()||(Lt=Qt.label)!=null&&Lt.trim()||(Xt=Qt.left)!=null&&Xt.trim()||(xr=Qt.right)!=null&&xr.trim())});if(!re&&!et&&!Le)return null;const Ye={...ms(Bn),title:Ms,subject:Ue},st=JSON.stringify({...Ye,blocks:A});if(!Gt&&st===he.current)return re;const nt=!x||x.status==="draft",Je={...Ye,...nt?{status:"draft",recipients:0}:{}},Rt=(async()=>{lr&&q("saving");try{let Qt=re;const Jt=!Qt;if(Qt)await c(Qt,Je);else{const Qe=await l(Je);Qt=Qe.id,fe(Qe.id),K.current=!0,U.current=!0,t(`${ve.emailCampaignCreate}?edit=${Qe.id}`,{replace:!0})}return he.current=st,X(""),Q.current=!1,lr?(q("saved"),Jt&&e({title:"Draft autosaved",description:"We’ll keep saving as you edit."})):e({title:"Draft saved",description:Gt?"Find it under Email Campaigns.":"Your changes are saved."}),Gt&&t(ve.emailCampaigns),Qt}catch(Qt){console.error("campaign draft save failed",Qt);const Jt=Qt instanceof ze?Dt(Qt.body,Z1(Qt.status)):dn(Qt,"We couldn't save your draft. Please try again.");return X(Jt),q("error"),(!lr||!Q.current)&&(Q.current=!0,e({title:"Couldn't save draft",description:Jt,variant:"destructive"})),re}finally{ye.current=null}})();return ye.current=Rt,Rt}async function ke(){await Kn()&&await is({navigateAway:!0,silent:!1})}y.useEffect(()=>{if(S!=="template")return ie.current&&clearTimeout(ie.current),ie.current=setTimeout(()=>{is({silent:!0})},1500),()=>{ie.current&&clearTimeout(ie.current)}},[S,Ve.title,Ve.subject,Ve.preview,Ve.fromName,Ve.audience,Ve.abTest,A,j,re,z,B,W]);async function at(){await Kn()&&f&&(await c(f,ms()),e({title:"Changes saved"}),t(ve.emailCampaignReport(f)))}async function Tt(){ie.current&&(clearTimeout(ie.current),ie.current=null);const Gt=await ye.current;if(!await N.trigger()||!nr())return;if(vn<=0||!N.getValues("audience")||!Ge&&!De){N.setError("audience",{message:"Choose an audience with at least 1 recipient."}),e({title:"Choose an audience",description:"Adjust the filters until at least one person will receive this email.",variant:"destructive"});return}const ct=N.getValues(),Bn={...ms(ct),status:ct.schedule?"scheduled":"sent",recipients:vn,delivered:0,openRate:0,clickRate:0,...ct.schedule?{scheduledAt:new Date(ct.scheduledAt).toISOString()}:{sentAt:new Date().toISOString()}};let Ms=f||Gt||re||"";J.current=!0;try{Ms?(await c(Ms,ms(ct)),await c(Ms,Bn)):Ms=(await l(Bn)).id}catch(Ue){J.current=!1,e({title:ct.schedule?pe?"Couldn't reschedule campaign":"Couldn't schedule campaign":"Couldn't send campaign",description:Ue instanceof ze?Dt(Ue.body,Z1(Ue.status)):dn(Ue,"Please try again."),variant:"destructive"});return}if(ct.schedule){const Ue=vd(ct.scheduledAt);e({title:pe?"Campaign rescheduled ✅":"Campaign scheduled ✅",description:`${vn.toLocaleString()} recipients · sends ${Ue}`}),t(ve.emailCampaigns);return}e({title:"Sending emails…",description:`${vn.toLocaleString()} recipients. Watch progress on the report.`}),t(Ms?ve.emailCampaignReport(Ms):ve.emailCampaigns)}async function An(){const Gt=D.trim();if(await Kn()){M(!0);try{const ct=await is({silent:!0});if(!ct)throw new Error("Could not save the campaign draft.");await d(ct,Gt||void 0),F(!1),e({title:"Test email sent",description:Gt||"Check your account email address."})}catch(ct){e({title:"Test email failed",description:ct instanceof ze?Dt(ct.body,Z1(ct.status)):dn(ct,"Could not send the test copy."),variant:"destructive"})}finally{M(!1)}}}if(v&&k)return a.jsxs("div",{className:"flex h-full min-h-screen flex-col items-center justify-center gap-3 bg-surface p-6",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"This campaign could not be loaded."}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"It may have been deleted, or you may not have access."}),a.jsxs(Z,{variant:"outline",onClick:()=>t(ve.emailCampaigns),children:[a.jsx(no,{className:"mr-1.5 h-4 w-4"})," Back to campaigns"]})]});if(v&&(!ne||w||!x)&&!K.current)return a.jsx("div",{className:"flex h-full min-h-screen items-center justify-center bg-surface",children:a.jsx("p",{className:"text-sm text-muted-foreground",children:"Loading campaign…"})});const Pn=le==="saving"?"Saving…":le==="saved"?"Draft saved":le==="error"?"Save failed":"Autosave on",yn="order-2 ml-auto sm:order-none sm:ml-0",Is="order-3 min-w-0 basis-[calc(33.333%-0.5rem)] grow px-2 sm:order-none sm:min-w-fit sm:basis-auto sm:grow-0 sm:px-3";return a.jsxs("div",{className:ee("flex min-h-screen flex-col bg-surface",S==="editor"&&"h-full"),children:[a.jsxs("header",{className:"sticky top-0 z-20 flex flex-col gap-1 border-b border-border bg-card px-3 py-2",children:[a.jsxs("div",{className:"flex min-w-0 items-center gap-2 pr-24 sm:pr-0",children:[a.jsxs(Z,{variant:"ghost",size:"sm",className:"shrink-0",onClick:()=>t(ve.emailCampaigns),children:[a.jsx(no,{className:"mr-1.5 h-4 w-4"})," Exit"]}),a.jsx("span",{className:"h-4 w-px shrink-0 bg-border"}),a.jsx("span",{className:"min-w-0 truncate text-sm font-medium text-foreground",title:Ve.title||Ve.subject||"Untitled email",children:Ve.title||Ve.subject||"Untitled email"})]}),a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-2 gap-y-2 lg:flex-nowrap lg:gap-y-1.5",children:[a.jsx("nav",{className:"flex min-w-0 items-center gap-0.5","aria-label":"Editor steps",children:Qhe.map((Gt,lr)=>{const ct=Gt.key==="template"||!!j;return a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsxs("button",{type:"button",onClick:async()=>{Gt.key==="review"&&!await Kn()||Yt(Gt.key)},disabled:!ct,className:ee("flex items-center gap-2 rounded-full px-2.5 py-1 text-sm transition-colors",lr===Ke?"bg-accent text-accent-foreground font-medium":"text-muted-foreground hover:bg-muted hover:text-foreground",!ct&&"cursor-not-allowed opacity-50 hover:bg-transparent"),children:[a.jsx(it.span,{animate:{scale:lr===Ke?1.05:1},className:ee("flex h-6 w-6 items-center justify-center rounded-full text-xs font-medium",lr<Ke?"bg-primary text-primary-foreground":lr===Ke?"border-2 border-primary text-primary":"border border-border text-muted-foreground"),children:lr<Ke?a.jsx(Qn,{className:"h-3.5 w-3.5"}):lr+1}),a.jsx("span",{className:ee(lr!==Ke&&"hidden lg:inline"),children:Gt.key==="review"?ce?"Review & send":"Review":Gt.label})]}),lr<Qhe.length-1&&a.jsx("span",{className:"h-px w-3 bg-border lg:w-6"})]},Gt.key)})}),a.jsx("div",{className:"contents sm:ml-auto sm:flex sm:shrink-0 sm:items-center sm:justify-end sm:gap-1",children:S==="template"?a.jsx(Z,{variant:"outline",size:"sm",className:"ml-auto",onClick:()=>{E("tpl_text"),C("editor")},children:"Use the classic editor"}):a.jsxs(a.Fragment,{children:[a.jsxs(Z,{variant:"ghost",size:"sm",className:ee(Is,"border border-border sm:border-0"),onClick:()=>R(!0),children:[a.jsx(Oc,{className:"mr-1.5 h-4 w-4"})," Preview"]}),n&&a.jsxs(Z,{variant:"ghost",size:"sm",className:ee(Is,"border border-border sm:border-0"),onClick:()=>F(!0),children:[a.jsx(_s,{className:"mr-1.5 h-4 w-4"})," Send test"]}),ce&&a.jsx(Z,{variant:"outline",size:"sm",className:Is,onClick:()=>void ke(),children:"Save draft"}),a.jsx("span",{className:ee("absolute right-3 top-[18px] whitespace-nowrap text-xs sm:static",le==="error"?"text-destructive":"text-muted-foreground"),"aria-live":"polite",title:le==="error"?Y:void 0,children:Pn}),S==="editor"?a.jsxs(Z,{size:"sm",className:yn,onClick:()=>C("review"),children:["Next ",a.jsx(xa,{className:"ml-1.5 h-4 w-4"})]}):ce?n&&a.jsx(Z,{size:"sm",className:yn,onClick:Tt,children:Ve.schedule?pe?"Reschedule":"Schedule":"Send"}):a.jsx(Z,{size:"sm",className:yn,onClick:at,children:"Save changes"})]})})]})]}),a.jsxs(Al,{mode:"wait",children:[S==="template"&&a.jsxs(it.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},className:"mx-auto w-full max-w-5xl flex-1 space-y-5 p-3 sm:p-4 lg:p-6",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-foreground",children:"Select a template"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Kajabi-style templates — start from a design or the classic editor."})]}),h.length===0?a.jsx("p",{className:"rounded-lg border border-dashed border-border py-10 text-center text-sm text-muted-foreground",children:"No templates available — use the classic editor to start from scratch."}):a.jsx("div",{className:"grid gap-5 sm:grid-cols-2 lg:grid-cols-3",children:h.map(Gt=>{const lr=K0s(Gt.category);return a.jsxs(it.button,{whileHover:{y:-4},whileTap:{scale:.98},onClick:()=>Ie(Gt.id),className:ee("group overflow-hidden rounded-xl border bg-card text-left shadow-card",j===Gt.id?"border-primary ring-2 ring-primary/20":"border-border"),children:[a.jsx("div",{className:"flex h-40 items-center justify-center",style:{background:`hsl(${lr} / 0.08)`},children:a.jsxs("div",{className:"w-2/3 space-y-2 rounded-md bg-card p-3 shadow-sm",children:[a.jsx("div",{className:"h-2 w-1/2 rounded",style:{background:`hsl(${lr})`}}),a.jsx("div",{className:"h-1.5 w-full rounded bg-muted"}),a.jsx("div",{className:"h-1.5 w-5/6 rounded bg-muted"}),a.jsx("div",{className:"mt-2 h-4 w-16 rounded",style:{background:`hsl(${lr})`}})]})}),a.jsxs("div",{className:"p-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h3",{className:"flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[Gt.name,Gt.lockedUrls&&a.jsx(wa,{className:"h-3 w-3 text-muted-foreground","aria-label":"Links locked"})]}),a.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:Gt.category})]}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:Gt.description})]})]},Gt.id)})}),a.jsx("div",{className:"sticky bottom-0 flex justify-end border-t border-border bg-surface/80 py-3 backdrop-blur",children:a.jsxs(Z,{disabled:!j,onClick:()=>C("editor"),children:["Continue ",a.jsx(xa,{className:"ml-1.5 h-4 w-4"})]})})]},"template"),S==="editor"&&a.jsxs(it.div,{initial:{opacity:0},animate:{opacity:1},exit:{opacity:0},className:"flex flex-1 flex-col overflow-hidden",children:[a.jsx(T0s,{blocks:A,onChange:_,settingsSlot:br}),a.jsxs("footer",{className:"flex items-center justify-between border-t border-border bg-card px-5 py-3",children:[a.jsxs(Z,{variant:"ghost",onClick:()=>C("template"),children:[a.jsx(no,{className:"mr-1.5 h-4 w-4"})," Back"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(Z,{variant:"outline",onClick:()=>R(!0),children:[a.jsx(Oc,{className:"mr-1.5 h-4 w-4"})," Preview"]}),a.jsxs(Z,{onClick:async()=>{await Kn()&&C("review")},children:["Continue ",a.jsx(xa,{className:"ml-1.5 h-4 w-4"})]})]})]})]},"editor"),S==="review"&&a.jsxs(it.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:-8},className:"mx-auto w-full max-w-2xl flex-1 space-y-5 p-3 sm:p-4 lg:p-6",children:[a.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-foreground",children:ce?"Review & send":"Review changes"}),a.jsxs("div",{className:"space-y-4 rounded-xl border border-border bg-card p-5 shadow-card",children:[a.jsx(HH,{label:"Campaign",value:Ve.title||Ve.subject||"Untitled email"}),a.jsx(HH,{label:"Subject",value:Ve.subject||"—"}),a.jsx(HH,{label:"Preview text",value:Ve.preview||"—"}),a.jsx(HH,{label:"From",value:Ve.fromName}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{children:"Who should receive this email?"}),a.jsx(gn,{label:"Who should receive this email",children:"Choose the audience. Anyone who unsubscribed, bounced, or never opted in is left out automatically, so the real number sent can be lower than your total membership."})]}),a.jsxs(zn,{value:Ve.audience,onValueChange:Gt=>N.setValue("audience",Gt,{shouldDirty:!0,shouldValidate:!0}),children:[a.jsx(On,{children:a.jsx(Vn,{placeholder:"Choose who should receive it"})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"filter:everyone",children:"Everyone"}),a.jsx(pt,{value:"filter:members",children:"Members only"}),a.jsx(pt,{value:"filter:space",children:"Members of a space"}),a.jsx(pt,{value:"filter:role",children:"Role"}),a.jsx(pt,{value:"filter:tag",children:"People with a tag"}),tt==="paid"&&a.jsx(pt,{value:"filter:paid",children:"Paid members"}),a.jsx(pt,{value:"filter:imported",children:"Imported contacts"}),Xe.map(Gt=>a.jsxs(pt,{value:`segment:${Gt.id}`,children:["Saved list · ",Gt.name]},Gt.id))]})]}),tt==="space"&&a.jsxs(zn,{value:z||void 0,onValueChange:G,children:[a.jsx(On,{children:a.jsx(Vn,{placeholder:"Choose a space"})}),a.jsx(Fn,{children:s.map(Gt=>a.jsx(pt,{value:Gt.id,children:Gt.name},Gt.id))})]}),tt==="role"&&a.jsxs(zn,{value:B,onValueChange:Gt=>H(Gt),children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"admin",children:"Admins"}),a.jsx(pt,{value:"moderator",children:"Moderators"})]})]}),tt==="tag"&&a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{children:"Tags"}),a.jsx(gn,{label:"Tags",children:'The email goes to everyone who has at least one of the tags you pick. Someone with two of them still gets it once. Who has a tag is worked out when the campaign sends, so people tagged before then are included. Tags are set on people in Audience, or by an "Add tag" step in a workflow or sequence. Only people who agreed to get your emails are sent to, so a tag can reach fewer people than have it.'})]}),a.jsx(W0s,{communityId:(r==null?void 0:r.id)??null,value:W,onChange:V})]}),a.jsxs("p",{className:"flex items-center gap-1.5 text-xs text-muted-foreground","aria-live":"polite",children:[a.jsx(wr,{className:"h-3.5 w-3.5"}),Pt.isFetching&&tt?"Updating count…":`${vn.toLocaleString()} people will get this`]}),be.audience&&a.jsx("p",{className:"text-xs font-medium text-destructive",children:be.audience.message})]}),ce&&a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border p-3",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm text-foreground",children:[a.jsx(Ux,{className:"h-4 w-4 text-muted-foreground"})," Schedule for later",a.jsx(gn,{label:"Schedule for later",children:"Hold the campaign and send it automatically at a time you pick, instead of right now. Useful for hitting a morning inbox. You can change the time or cancel it up until it sends."})]}),a.jsx(Hs,{checked:Ve.schedule,onCheckedChange:Gt=>N.setValue("schedule",Gt,{shouldDirty:!0,shouldValidate:!0})})]}),a.jsx(Al,{children:Ve.schedule&&a.jsxs(it.div,{initial:{opacity:0,height:0},animate:{opacity:1,height:"auto"},exit:{opacity:0,height:0},className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:"scheduledAt",children:"Send date"}),a.jsx(gn,{label:"Send date",children:"When the campaign goes out, in your own timezone. Check the date as well as the time — it defaults to tomorrow. You can change or cancel it any time before it sends."})]}),a.jsx(Oe,{id:"scheduledAt",type:"datetime-local",min:Hn,...N.register("scheduledAt")}),a.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Times are shown in ",yr,". Default is tomorrow."]}),be.scheduledAt&&a.jsx("p",{className:"text-xs font-medium text-destructive",children:be.scheduledAt.message})]})})]})]}),a.jsxs("div",{children:[a.jsxs("div",{className:"mb-2 flex items-center justify-between",children:[a.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Email preview"}),a.jsxs(Z,{variant:"ghost",size:"sm",onClick:()=>R(!0),children:[a.jsx(Oc,{className:"mr-1.5 h-4 w-4"})," Full preview"]})]}),a.jsx(fet,{blocks:A,fromName:Ve.fromName,subject:Ve.subject})]}),a.jsx(G0s,{communityId:(r==null?void 0:r.id)??null,subject:Ve.subject,blocks:A}),a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs(Z,{variant:"ghost",onClick:()=>C("editor"),children:[a.jsx(no,{className:"mr-1.5 h-4 w-4"})," Back"]}),ce?n?a.jsx(Z,{onClick:Tt,className:"transition-transform active:scale-95",children:Ve.schedule?a.jsxs(a.Fragment,{children:[a.jsx(Ux,{className:"mr-1.5 h-4 w-4"})," Schedule"]}):a.jsxs(a.Fragment,{children:[a.jsx(_s,{className:"mr-1.5 h-4 w-4"})," Send now"]})}):null:a.jsxs(Z,{onClick:at,className:"transition-transform active:scale-95",children:[a.jsx(Qn,{className:"mr-1.5 h-4 w-4"})," Save changes"]})]})]},"review")]}),a.jsx(Bt,{open:T,onOpenChange:R,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg max-w-3xl",children:[a.jsx(Vt,{children:a.jsxs("div",{className:"flex items-center justify-between pr-6",children:[a.jsx(Ut,{children:"Email preview"}),a.jsxs("div",{className:"flex items-center gap-1 rounded-lg border border-border p-0.5",children:[a.jsxs("button",{onClick:()=>Be("desktop"),className:ee("flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors",we==="desktop"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),children:[a.jsx(vSe,{className:"h-3.5 w-3.5"})," Desktop"]}),a.jsxs("button",{onClick:()=>Be("mobile"),className:ee("flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xs font-medium transition-colors",we==="mobile"?"bg-accent text-accent-foreground":"text-muted-foreground hover:text-foreground"),children:[a.jsx(ost,{className:"h-3.5 w-3.5"})," Mobile"]})]})]})}),a.jsx("div",{className:"max-h-[70vh] overflow-y-auto rounded-lg bg-muted/40 p-4",children:a.jsx(it.div,{layout:!0,className:ee("mx-auto transition-all",we==="mobile"?"max-w-[360px]":"max-w-full"),children:a.jsx(fet,{blocks:A,fromName:Ve.fromName,subject:Ve.subject})})})]})}),a.jsx(k6t,{open:O,onOpenChange:F,inputId:"campaign-test-email",email:D,onEmailChange:I,sending:P,onSend:()=>void An()})]})}function HH({label:t,value:e}){return a.jsxs("div",{className:"flex items-start justify-between gap-4 border-b border-border pb-3 last:border-0 last:pb-0",children:[a.jsx("span",{className:"text-sm text-muted-foreground",children:t}),a.jsx("span",{className:"text-right text-sm font-medium text-foreground",children:e})]})}const z_=25;function Z0s(t,e){return e?`${t.name} ${t.email}`.toLowerCase().includes(e):!0}function vet({people:t,query:e,empty:n}){const[r,s]=y.useState(1),i=t.filter(c=>Z0s(c,e)),o=Math.max(1,Math.ceil(i.length/z_));if(y.useEffect(()=>{s(1)},[e]),y.useEffect(()=>{r>o&&s(o)},[r,o]),i.length===0)return a.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:e&&t.length>0?"Nobody in this list matches your search.":n});const l=(r-1)*z_;return a.jsxs(a.Fragment,{children:[a.jsx("ul",{className:"divide-y divide-border",children:i.slice(l,l+z_).map(c=>a.jsx("li",{className:"flex items-center justify-between gap-3 py-2.5",children:a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:c.name||c.email}),c.name?a.jsx("p",{className:"truncate text-xs text-muted-foreground",children:c.email}):null]})},c.email))}),i.length>z_&&a.jsx(US,{page:r,limit:z_,total:i.length,onPageChange:s})]})}function Zhe({yesLabel:t,noLabel:e,yes:n,no:r,query:s}){return a.jsxs(U0,{defaultValue:"yes",className:"w-full",children:[a.jsxs(nb,{className:"grid h-auto w-full grid-cols-2",children:[a.jsxs(Xo,{value:"yes",children:[t," (",n.length,")"]}),a.jsxs(Xo,{value:"no",children:[e," (",r.length,")"]})]}),a.jsx(pd,{value:"yes",children:a.jsx(vet,{people:n,query:s,empty:"Nobody in this list yet. Opens and clicks appear after Resend tracking webhooks arrive."})}),a.jsx(pd,{value:"no",children:a.jsx(vet,{people:r,query:s,empty:"Nobody in this list."})})]})}function S6t({engagement:t,noun:e="campaign"}){const[n,r]=y.useState(""),[s,i]=y.useState(null),o=n.trim().toLowerCase(),l=(t==null?void 0:t.opened)??[],c=(t==null?void 0:t.notOpened)??[],d=(t==null?void 0:t.clicked)??[],u=(t==null?void 0:t.notClicked)??[],h=Array.isArray(t==null?void 0:t.links)?t.links:[],m=l.length+c.length+d.length+u.length>0;return!t||!m&&h.length===0?a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5 shadow-card",children:[a.jsx("h2",{className:"mb-1 text-sm font-semibold text-foreground",children:"Who opened and clicked"}),a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Recipient lists appear here after this ",e," has been sent. Opens and clicks come from delivery tracking."]})]}):a.jsxs("div",{className:"space-y-6",children:[t.truncated&&a.jsxs("p",{className:"rounded-lg border border-border bg-muted/40 px-4 py-2.5 text-xs text-muted-foreground",children:["Showing the first ",(l.length+c.length).toLocaleString(),t.totalRecipients?` of ${t.totalRecipients.toLocaleString()}`:""," recipients. Counts in the summary above cover everyone."]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"relative min-w-0 flex-1 sm:max-w-sm",children:[a.jsx(hs,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),a.jsx(Oe,{value:n,onChange:f=>r(f.target.value),placeholder:"Search name or email","aria-label":`Search recipients of this ${e} by name or email`,className:"h-9 pl-8"})]}),a.jsxs(gn,{label:"Recipient search",side:"bottom",children:["Filters every list below at once: who opened, who clicked, and the people under each link. Each list shows ",z_," people per page."]})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 shadow-card sm:p-5",children:[a.jsxs("h2",{className:"mb-4 flex items-center gap-2 text-sm font-semibold text-foreground",children:[a.jsx(zx,{className:"h-4 w-4"})," Who opened"]}),a.jsx(Zhe,{yesLabel:"Opened",noLabel:"Didn't open",yes:l,no:c,query:o})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 shadow-card sm:p-5",children:[a.jsxs("h2",{className:"mb-4 flex items-center gap-2 text-sm font-semibold text-foreground",children:[a.jsx(bk,{className:"h-4 w-4"})," Who clicked"]}),a.jsx(Zhe,{yesLabel:"Clicked a link",noLabel:"Didn't click",yes:d,no:u,query:o})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 shadow-card sm:p-5",children:[a.jsx("h2",{className:"mb-1 text-sm font-semibold text-foreground",children:"Each link"}),a.jsx("p",{className:"mb-4 text-sm text-muted-foreground",children:"Who clicked this URL, and who received the email but did not."}),h.length===0?a.jsxs("p",{className:"text-sm text-muted-foreground",children:["No links in this ",e," yet."]}):a.jsx("div",{className:"divide-y divide-border rounded-lg border border-border",children:h.map(f=>{const p=s===f.url;return a.jsxs("div",{children:[a.jsxs("button",{type:"button",className:"flex w-full items-center gap-3 px-4 py-3 text-left hover:bg-muted/50",onClick:()=>i(p?null:f.url),children:[a.jsx(li,{className:ee("h-4 w-4 shrink-0 text-muted-foreground transition-transform",p&&"rotate-180")}),a.jsx("span",{className:"min-w-0 flex-1 truncate text-sm text-foreground",title:f.url,children:f.url}),a.jsxs("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:[f.clicks," click",f.clicks===1?"":"s"]})]}),p?a.jsx("div",{className:"border-t border-border bg-muted/30 px-4 py-3",children:a.jsx(Zhe,{yesLabel:"Clicked",noLabel:"Didn't click",yes:f.clickers,no:f.nonClickers,query:o})}):null]},f.url)})})]})]})}const zq=25;function yet({source:t,type:e,search:n,empty:r}){var u,h;const{community:s}=qe(),[i,o]=y.useState(1);y.useEffect(()=>o(1),[n]);const l=h0e((s==null?void 0:s.id)??null,t,{type:e,page:i,limit:zq,search:n||void 0}),c=((u=l.data)==null?void 0:u.data)??[],d=((h=l.data)==null?void 0:h.total)??0;return l.isLoading?a.jsxs("p",{className:"flex items-center gap-2 py-6 text-sm text-muted-foreground",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"})," Loading…"]}):l.isError?a.jsx("p",{className:"py-6 text-sm text-muted-foreground",children:"Couldn’t load this list. Refresh and try again."}):c.length===0?a.jsx("p",{className:"py-6 text-center text-sm text-muted-foreground",children:n?"Nobody in this list matches your search.":r}):a.jsxs(a.Fragment,{children:[a.jsx("ul",{className:"divide-y divide-border",children:c.map(m=>a.jsxs("li",{className:"flex flex-col gap-0.5 py-2.5 sm:flex-row sm:items-center sm:justify-between sm:gap-3",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"truncate text-sm font-medium text-foreground",children:m.name||m.email}),m.name&&a.jsx("p",{className:"truncate text-xs text-muted-foreground",children:m.email})]}),a.jsx("p",{className:"text-xs text-muted-foreground sm:max-w-[55%] sm:shrink-0 sm:text-right",children:i5t(m.reason)})]},`${m.email}-${m.reason}`))}),d>zq&&a.jsx(US,{page:i,limit:zq,total:d,onPageChange:o})]})}function C6t({source:t,noun:e="campaign",skipped:n}){var x,w;const{toast:r}=yt(),[s,i]=y.useState(!1);async function o(k){i(!0);try{const S=k==="all"?[...a5t(n),...await Nue(t,"failed"),...await Nue(t,"bounced")]:await Nue(t,k);if(S.length===0){r({title:"Nothing to download",description:"This list is empty."});return}iie(`${e}-${k==="all"?"not-reached":k}.csv`,o5t(S,k==="all")),r({title:"CSV downloaded",description:`${S.length.toLocaleString()} ${S.length===1?"person":"people"} exported.`})}catch{r({title:"Download failed",description:"Could not prepare the CSV. Please try again.",variant:"destructive"})}finally{i(!1)}}const{community:l}=qe(),c=(l==null?void 0:l.id)??null,[d,u]=y.useState(""),[h,m]=y.useState("");y.useEffect(()=>{const k=setTimeout(()=>m(d.trim()),300);return()=>clearTimeout(k)},[d]);const f={page:1,limit:zq},p=h0e(c,t,{type:"failed",...f}),g=h0e(c,t,{type:"bounced",...f}),v=((x=p.data)==null?void 0:x.total)??0,b=((w=g.data)==null?void 0:w.total)??0;return v+b===0?null:a.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 shadow-card sm:p-5",children:[a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs("h2",{className:"flex items-center gap-2 text-sm font-semibold text-foreground",children:[a.jsx(Bf,{className:"h-4 w-4"})," Failed and bounced"]}),a.jsxs(gn,{label:"Failed and bounced",children:[a.jsx("strong",{children:"Failed"})," means the email never left: the email provider refused it, or sending was given up after several tries. ",a.jsx("strong",{children:"Bounced"})," means it was sent, and the recipient's mail server rejected it or the recipient marked it as spam. Bounced and complaining addresses are left out of future sends automatically."]}),a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsxs(Z,{variant:"outline",size:"sm",className:"ml-auto",disabled:s,children:[s?a.jsx(Ne,{className:"mr-1.5 h-4 w-4 animate-spin"}):a.jsx(bc,{className:"mr-1.5 h-4 w-4"}),"Download CSV",a.jsx(li,{className:"ml-1.5 h-3.5 w-3.5"})]})}),a.jsxs(Cr,{align:"end",children:[a.jsxs(ot,{disabled:v===0,onSelect:()=>void o("failed"),children:["Failed (",v.toLocaleString(),")"]}),a.jsxs(ot,{disabled:b===0,onSelect:()=>void o("bounced"),children:["Bounced (",b.toLocaleString(),")"]}),a.jsx(ot,{onSelect:()=>void o("all"),children:"Everything — skipped, failed and bounced"})]})]})]}),a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["People this ",e," did not reach, and why."]}),a.jsxs("div",{className:"relative mt-4 sm:max-w-sm",children:[a.jsx(hs,{className:"pointer-events-none absolute left-2.5 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground"}),a.jsx(Oe,{value:d,onChange:k=>u(k.target.value),placeholder:"Search email","aria-label":`Search failed and bounced recipients of this ${e} by email`,className:"h-9 pl-8"})]}),a.jsxs(U0,{defaultValue:v>0?"failed":"bounced",className:"mt-4",children:[a.jsxs(nb,{children:[a.jsxs(Xo,{value:"failed",children:["Failed (",v.toLocaleString(),")"]}),a.jsxs(Xo,{value:"bounced",children:["Bounced (",b.toLocaleString(),")"]})]}),a.jsx(pd,{value:"failed",children:a.jsx(yet,{source:t,type:"failed",search:h,empty:`No email in this ${e} failed to send.`})}),a.jsx(pd,{value:"bounced",children:a.jsx(yet,{source:t,type:"bounced",search:h,empty:`Nobody bounced or complained for this ${e}.`})})]})]})}const J0s=["SAMPLE","SEND_CAP"],KT=25;function j6t({rows:t,counts:e,noun:n="campaign"}){const r=t??[],[s,i]=y.useState(1),o=(Math.min(s,Math.max(1,Math.ceil(r.length/KT)))-1)*KT,l=J0s.map(d=>({reason:d,count:Number(e==null?void 0:e[d])||0})).filter(d=>d.count>0),c=e?Object.values(e).reduce((d,u)=>d+(Number(u)||0),0):r.length;return!r.length&&!l.length?null:a.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 shadow-card sm:p-5",children:[a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[a.jsxs("h2",{className:"text-sm font-semibold text-foreground",children:["Not sent (",Math.max(c,r.length).toLocaleString(),")"]}),r.length>0&&a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>iie(`${n}-not-sent.csv`,o5t(a5t(r))),children:[a.jsx(bc,{className:"mr-1.5 h-4 w-4"})," Download CSV"]})]}),a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["These addresses were in the audience and were left out of this ",n,"."]}),l.length>0&&a.jsx("ul",{className:"mt-3 space-y-1",children:l.map(({reason:d,count:u})=>a.jsxs("li",{className:"flex items-center justify-between gap-3 text-sm",children:[a.jsx("span",{className:"text-foreground",children:swe(d)}),a.jsx("span",{className:"shrink-0 tabular-nums text-muted-foreground",children:u.toLocaleString()})]},d))}),a.jsx("ul",{className:"mt-3 divide-y divide-border",children:r.slice(o,o+KT).map(d=>a.jsxs("li",{className:"flex flex-col gap-0.5 py-2.5 sm:flex-row sm:items-center sm:justify-between sm:gap-3",children:[a.jsxs("span",{className:"min-w-0",children:[a.jsx("span",{className:"block truncate text-sm text-foreground",children:d.name||d.email||"Unknown address"}),d.name&&a.jsx("span",{className:"block truncate text-xs text-muted-foreground",children:d.email})]}),a.jsx("span",{className:"text-xs text-muted-foreground sm:shrink-0",children:swe(d.reason)})]},`${d.email}-${d.reason}`))}),r.length>KT&&a.jsx(US,{page:o/KT+1,limit:KT,total:r.length,onPageChange:i})]})}class X0s extends y.Component{constructor(){super(...arguments);tn(this,"state",{error:null})}static getDerivedStateFromError(n){return{error:n}}componentDidCatch(n,r){console.error("Campaign report crashed",n,r)}render(){return this.state.error?a.jsxs("div",{className:"mx-auto max-w-5xl space-y-4 lg:p-6",children:[a.jsxs(vr,{to:ve.emailCampaigns,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[a.jsx(no,{className:"h-4 w-4"})," Email Campaigns"]}),a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"Couldn’t load this report"}),a.jsx("p",{className:"text-sm text-muted-foreground",children:"The campaign was sent. Go back to the campaigns list and open the report again."})]}):this.props.children}}function ews(){const{campaignId:t}=So(),e=Nn(),{toast:n}=yt(),r=ob(),{community:s}=qe(),{campaigns:i,duplicateCampaign:o}=Jy(),l=$Nt((s==null?void 0:s.id)??null,t??null),c=i.find(Q=>Q.id===t)??(l.data?HZ(l.data):null),{data:d,isLoading:u,isPending:h,isError:m}=pgr((s==null?void 0:s.id)??null,t??null),[f,p]=y.useState(!1),[g,v]=y.useState(""),b=qgr((s==null?void 0:s.id)??null),x=FNt((s==null?void 0:s.id)??null),w=BNt((s==null?void 0:s.id)??null),k=ONt((s==null?void 0:s.id)??null),[S,C]=y.useState(!1),[j,E]=y.useState(""),[N,A]=y.useState(!1),_=x.isPending||w.isPending||k.isPending;if(!c&&!d)return!(s!=null&&s.id)||u||h||l.isLoading||l.isPending?a.jsxs("div",{className:"mx-auto flex max-w-5xl items-center justify-center gap-2 p-16 text-sm text-muted-foreground",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"})," Loading report…"]}):a.jsxs("div",{className:"mx-auto max-w-5xl lg:p-6",children:[a.jsxs(vr,{to:ve.emailCampaigns,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[a.jsx(no,{className:"h-4 w-4"})," Email Campaigns"]}),a.jsx("p",{className:"mt-10 text-center text-sm text-muted-foreground",children:m||l.isError?"This report couldn’t be loaded. Try again from the campaigns list.":"This campaign no longer exists."})]});const T=c??{id:d.id,title:(d==null?void 0:d.title)||"Campaign",subject:(d==null?void 0:d.subject)||"",type:"broadcast",audience:"—",recipients:(d==null?void 0:d.recipients)??0,delivered:(d==null?void 0:d.delivered)??0,openRate:(d==null?void 0:d.openRate)??0,clickRate:(d==null?void 0:d.clickRate)??0,status:d.status},R=(d==null?void 0:d.status)??T.status,O=Number((d==null?void 0:d.recipients)??T.recipients)||0,F=Number((d==null?void 0:d.delivered)??T.delivered)||0,D=Number((d==null?void 0:d.openRate)??T.openRate)||0,I=Number((d==null?void 0:d.clickRate)??T.clickRate)||0,P=Number((d==null?void 0:d.opened)??Math.round(F*D/100))||0,M=Number((d==null?void 0:d.clicked)??Math.round(F*I/100))||0,z=Number((d==null?void 0:d.bounced)??Math.max(0,O-F))||0,G=Number(d==null?void 0:d.complained)||0,B=Number(d==null?void 0:d.unsubscribed)||0,H=Array.isArray(d==null?void 0:d.topLinks)?d.topLinks:[],W=d==null?void 0:d.provider,V=(d==null?void 0:d.deliveryConfirmed)!==!1,U=Number(W==null?void 0:W.accepted)||0,ne=Number(W==null?void 0:W.failed)||0,te=Array.isArray(W==null?void 0:W.failureReasons)?W.failureReasons:[],re=c==null?void 0:c.scheduledAt,fe=lF();function le(){const Q=re?new Date(re):null;E(Q&&!Number.isNaN(Q.getTime())&&Q.getTime()>Date.now()?t9(Q):oF()),C(!0)}function q(){if(!xPe(j)){n({title:"Pick a future time",description:"The new send time has to be later than right now.",variant:"destructive"});return}x.mutate({campaignId:T.id,body:{scheduledAt:new Date(j).toISOString()}},{onSuccess:()=>{C(!1),n({title:"Campaign rescheduled",description:`Now sends ${vd(j)}.`})},onError:Q=>n({title:"Couldn't reschedule campaign",description:Q instanceof ze?Q.message:"Try again.",variant:"destructive"})})}function Y(){w.mutate(T.id,{onSuccess:()=>n({title:"Send cancelled",description:"The campaign is back in drafts."}),onError:Q=>n({title:"Couldn't cancel the send",description:Q instanceof ze?Q.message:"Try again.",variant:"destructive"})})}function X(){k.mutate({campaignId:T.id,body:{}},{onSuccess:()=>{A(!1),n({title:"Sending emails…",description:"The schedule was cancelled. Watch progress below."})},onError:Q=>n({title:"Couldn't send campaign",description:Q instanceof ze?Q.message:"Try again.",variant:"destructive"})})}return a.jsxs(it.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:"mx-auto max-w-5xl space-y-6 lg:p-6",children:[a.jsxs(vr,{to:ve.emailCampaigns,className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground",children:[a.jsx(no,{className:"h-4 w-4"})," Email Campaigns"]}),a.jsx(Bm,{title:T.title,description:R==="scheduled"&&re?`${T.subject} · Sends ${vd(re)} (${fe})`:T.subject,actions:a.jsxs(a.Fragment,{children:[r&&R==="scheduled"&&a.jsxs(a.Fragment,{children:[a.jsxs(Z,{variant:"outline",disabled:_,onClick:le,children:[a.jsx(Ux,{className:"mr-1.5 h-4 w-4"})," Reschedule"]}),a.jsxs(Z,{variant:"outline",disabled:_,onClick:Y,children:[a.jsx(MA,{className:"mr-1.5 h-4 w-4"})," Unschedule"]}),a.jsxs(Z,{disabled:_,onClick:()=>A(!0),children:[a.jsx(_s,{className:"mr-1.5 h-4 w-4"})," Send now"]})]}),a.jsxs(Z,{variant:"outline",onClick:()=>e(`${ve.emailCampaignCreate}?edit=${T.id}`),children:[a.jsx(Qs,{className:"mr-1.5 h-4 w-4"})," Edit"]}),a.jsxs(Z,{variant:"outline",onClick:()=>{o(T.id),n({title:"Campaign duplicated",description:"Saved as a draft."}),e(ve.emailCampaigns)},children:[a.jsx(Zl,{className:"mr-1.5 h-4 w-4"})," Duplicate"]}),r&&R!=="scheduled"&&a.jsxs(Z,{onClick:()=>e(`${ve.emailCampaignCreate}?from=${T.id}`),children:[a.jsx(_s,{className:"mr-1.5 h-4 w-4"})," Resend"]}),r&&R==="sent"&&a.jsxs(Z,{variant:"outline",onClick:()=>{v(""),p(!0)},children:[a.jsx(Brt,{className:"mr-1.5 h-4 w-4"})," Resend to non-openers"]})]})}),a.jsx(Bt,{open:S,onOpenChange:C,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Reschedule campaign"}),a.jsxs(_n,{children:["Pick a new send time for “",T.title,"”. The campaign stays scheduled — only the time changes."]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"reschedule-at",children:"Send date"}),a.jsx(Oe,{id:"reschedule-at",type:"datetime-local",min:oF(),value:j,onChange:Q=>E(Q.target.value)}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[fe,re?` · currently ${vd(re)}`:""]})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"ghost",onClick:()=>C(!1),children:"Cancel"}),a.jsxs(Z,{disabled:x.isPending,onClick:q,children:[x.isPending&&a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}),"Reschedule"]})]})]})}),a.jsx(Bt,{open:N,onOpenChange:A,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Send this campaign now?"}),a.jsxs(_n,{children:["“",T.title,"” goes out to ",O.toLocaleString()," recipient",O===1?"":"s"," straight away",re?`, instead of ${vd(re)}`:"",". The schedule is cancelled, so it won't send twice. Emails can't be recalled once sent."]})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"ghost",onClick:()=>A(!1),children:"Cancel"}),a.jsxs(Z,{disabled:k.isPending,onClick:X,children:[k.isPending&&a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}),"Send now"]})]})]})}),a.jsx(Bt,{open:f,onOpenChange:p,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Resend to non-openers"}),a.jsxs(_n,{children:["Send a follow-up of “",T.title,"” to everyone who didn't open it. Suppressed and already-opened recipients are skipped automatically."]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(_e,{htmlFor:"resend-subject",children:["New subject ",a.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),a.jsx(Oe,{id:"resend-subject",value:g,onChange:Q=>v(Q.target.value),placeholder:T.subject||"Keep the original subject"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave blank to reuse the original subject."})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"ghost",onClick:()=>p(!1),children:"Cancel"}),a.jsxs(Z,{disabled:b.isPending,onClick:()=>b.mutate({campaignId:T.id,subject:g.trim()||void 0},{onSuccess:Q=>{p(!1),n({title:"Follow-up queued",description:`Resending to ${Q.recipients.toLocaleString()} non-opener${Q.recipients===1?"":"s"}.`})},onError:Q=>n({title:"Couldn't resend",description:Q instanceof ze?Q.message:"Try again.",variant:"destructive"})}),children:[b.isPending&&a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}),"Resend"]})]})]})}),a.jsxs("div",{className:"flex flex-wrap items-center gap-3 text-sm text-muted-foreground",children:[a.jsx(q0,{status:R}),gm(d==null?void 0:d.sendProgress,R)&&a.jsx(Ne,{className:"h-3.5 w-3.5 animate-spin"}),a.jsx("span",{children:"·"}),a.jsx("span",{className:"capitalize",children:T.type}),a.jsx("span",{children:"·"}),a.jsx("span",{children:T.audience})]}),(d==null?void 0:d.sendProgress)&&d.sendProgress.total>0&&a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5 shadow-card",children:[a.jsxs("div",{className:"mb-3 flex items-center justify-between gap-3",children:[a.jsx("h2",{className:"text-sm font-semibold text-foreground",children:gm(d.sendProgress,R)?"Sending emails":"Send complete"}),gm(d.sendProgress,R)&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:[(Number(d.sendProgress.queued)||0).toLocaleString()," remaining"]})]}),a.jsx(sL,{progress:d.sendProgress,status:R,className:"max-w-xl"}),gm(d.sendProgress,R)&&a.jsx("p",{className:"mt-2 text-xs text-muted-foreground",children:"Emails go out in batches. This page updates as each batch is accepted."})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-4 lg:grid-cols-4",children:[V?a.jsx(sx,{label:"Delivered",value:`${F.toLocaleString()}`,hint:`of ${O.toLocaleString()} sent`,icon:_s}):a.jsx(sx,{label:"Accepted",value:`${U.toLocaleString()}`,hint:`of ${O.toLocaleString()} sent · delivery pending`,icon:_s}),a.jsx(sx,{label:"Open rate",value:`${D}%`,hint:`${P.toLocaleString()} opens`,delta:d==null?void 0:d.openRateDelta,icon:zx}),a.jsx(sx,{label:"Click rate",value:`${I}%`,hint:`${M.toLocaleString()} clicks`,delta:d==null?void 0:d.clickRateDelta,icon:bk}),a.jsx(sx,{label:"Bounced",value:z.toLocaleString(),hint:"Hard + soft",icon:Bf})]}),!V&&(U>0||ne>0)&&a.jsxs("div",{className:"rounded-xl border border-info/30 bg-info/5 p-4",children:[a.jsxs("p",{className:"text-sm font-medium text-foreground",children:[U.toLocaleString()," accepted by the email provider"]}),a.jsx("p",{className:"mt-1 text-xs leading-relaxed text-muted-foreground",children:"Opens, clicks and bounces arrive from the provider afterwards and none have reached us for this campaign yet, so those figures stay at zero for now. If they never appear, the webhook endpoint is the thing to check."}),ne>0&&a.jsxs("div",{className:"mt-3 rounded-lg border border-destructive/30 bg-destructive/5 p-3",children:[a.jsxs("p",{className:"text-xs font-medium text-foreground",children:[ne.toLocaleString()," could not be sent"]}),a.jsx("ul",{className:"mt-1.5 space-y-0.5",children:te.map(Q=>a.jsxs("li",{className:"text-xs text-muted-foreground",children:[a.jsx("span",{className:"font-medium text-foreground",children:Q.count.toLocaleString()})," ",Q.reason]},Q.reason))})]})]}),a.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[a.jsxs("div",{className:"lg:col-span-2 rounded-xl border border-border bg-card p-5 shadow-card",children:[a.jsxs("h2",{className:"mb-4 flex items-center gap-2 text-sm font-semibold text-foreground",children:[a.jsx(Fc,{className:"h-4 w-4"})," Engagement funnel"]}),a.jsx("div",{className:"space-y-3",children:[{label:"Delivered",value:F,pct:100,color:"bg-info"},{label:"Opened",value:P,pct:D,color:"bg-primary"},{label:"Clicked",value:M,pct:I,color:"bg-success"}].map(Q=>a.jsxs("div",{children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between text-xs",children:[a.jsx("span",{className:"font-medium text-foreground",children:Q.label}),a.jsxs("span",{className:"text-muted-foreground",children:[Q.value.toLocaleString()," · ",Q.pct,"%"]})]}),a.jsx("div",{className:"h-2.5 w-full overflow-hidden rounded-full bg-muted",children:a.jsx("div",{className:`h-full rounded-full ${Q.color}`,style:{width:`${Math.max(Q.pct,2)}%`}})})]},Q.label))}),a.jsx("h3",{className:"mb-3 mt-6 text-sm font-semibold text-foreground",children:"Top links clicked"}),H.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"No link clicks recorded for this campaign yet."}):a.jsx("table",{className:"w-full text-sm",children:a.jsx("tbody",{className:"divide-y divide-border",children:H.map(Q=>a.jsxs("tr",{children:[a.jsx("td",{className:"max-w-[20rem] truncate py-2.5 text-foreground",title:Q.url,children:Q.url}),a.jsxs("td",{className:"py-2.5 text-right tabular-nums text-muted-foreground",children:[Q.clicks," clicks"]}),a.jsxs("td",{className:"py-2.5 text-right tabular-nums text-muted-foreground",children:[Q.ctr,"% CTR"]})]},Q.url))})})]}),a.jsx("div",{className:"space-y-4",children:a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5 shadow-card",children:[a.jsx("h3",{className:"mb-3 text-sm font-semibold text-foreground",children:"Activity"}),a.jsx("dl",{className:"space-y-3 text-sm",children:[{icon:_s,label:"Sent",value:O.toLocaleString()},{icon:zx,label:"Unique opens",value:P.toLocaleString()},{icon:bk,label:"Unique clicks",value:M.toLocaleString()},{icon:O8,label:"Unsubscribed",value:B.toLocaleString()},{icon:Bf,label:"Spam reports",value:G.toLocaleString()}].map(Q=>a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("dt",{className:"flex items-center gap-2 text-muted-foreground",children:[a.jsx(Q.icon,{className:"h-4 w-4"})," ",Q.label]}),a.jsx("dd",{className:"font-medium tabular-nums text-foreground",children:Q.value})]},Q.label))})]})})]}),a.jsx(j6t,{rows:d==null?void 0:d.notSent,counts:d==null?void 0:d.notSentCounts}),t&&a.jsx(C6t,{source:{campaignId:t},skipped:d==null?void 0:d.notSent}),a.jsx(S6t,{engagement:d==null?void 0:d.engagement})]})}function tws(){return a.jsx(X0s,{children:a.jsx(ews,{})})}const bet=["On Signup Newsletter","On Confirm Newsletter","Opened a campaign","Clicked a campaign","Tag added"],nws="Tag added";let rws=0;const mke=()=>`st_${Date.now().toString(36)}_${++rws}`,GH=t=>{const e=mke();return t==="email"?{id:e,type:t,subject:"",email:"",html:""}:t==="notify_admin"?{id:e,type:t,subject:"",html:""}:t==="enroll_in_sequence"?{id:e,type:t,sequenceId:""}:{id:e,type:"wait",delayValue:1,delayUnit:"days"}},Cp={email:{icon:Ii,className:"bg-primary/10 text-primary",label:"Send email"},wait:{icon:ja,className:"bg-muted text-muted-foreground",label:"Wait"},notify_admin:{icon:Lm,className:"bg-warning/15 text-warning",label:"Notify admin"},enroll_in_sequence:{icon:Pg,className:"bg-info/15 text-info",label:"Enroll in another sequence"},add_tag:{icon:ka,className:"bg-success/10 text-success",label:"Add tag"},remove_tag:{icon:ka,className:"bg-destructive/10 text-destructive",label:"Remove tag"},legacy:{icon:wa,className:"bg-muted text-muted-foreground",label:"From an older automation"}};function sws(){var v;const{toast:t}=yt(),e=ob(),{sequences:n,addSequence:r,updateSequence:s,duplicateSequence:i,deleteSequence:o}=Jy(),[l,c]=y.useState(((v=n[0])==null?void 0:v.id)??""),[d,u]=y.useState(!1),[h,m]=y.useState(""),[f,p]=y.useState(null),g=n.find(b=>b.id===l)??n[0];return a.jsxs(it.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:"mx-auto max-w-6xl space-y-5 lg:p-6",children:[a.jsx(Bm,{title:"Sequences",description:"Automated email series triggered by an event or enrolment.",actions:a.jsxs(a.Fragment,{children:[a.jsx(zS,{}),a.jsxs(Z,{className:"transition-transform active:scale-95",onClick:()=>u(!0),children:[a.jsx(Dn,{className:"mr-1.5 h-4 w-4"})," New sequence"]})]})}),a.jsxs("div",{className:"grid gap-6 lg:grid-cols-5",children:[a.jsx("div",{className:"lg:col-span-2 space-y-2",children:a.jsx(Al,{initial:!1,children:n.map(b=>a.jsxs(it.div,{layout:!0,...rL,onClick:()=>c(b.id),className:ee("group w-full cursor-pointer rounded-xl border bg-card p-4 text-left shadow-card transition-all hover:-translate-y-0.5 hover:shadow-card-hover",l===b.id?"border-primary ring-2 ring-primary/15":"border-border"),children:[a.jsxs("div",{className:"flex items-center justify-between gap-2",children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:b.name}),a.jsxs("div",{className:"flex items-center gap-1",onClick:x=>x.stopPropagation(),children:[a.jsx(q0,{status:b.status}),a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[a.jsxs(ot,{onClick:()=>{i(b.id),t({title:"Sequence duplicated"})},children:[a.jsx(Zl,{className:"mr-2 h-4 w-4"})," Duplicate"]}),e&&a.jsx(ot,{onClick:()=>s(b.id,{status:b.status==="active"?"paused":"active"}),children:b.status==="active"?"Pause":"Activate"}),e&&a.jsxs(a.Fragment,{children:[a.jsx(mi,{}),a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>p(b.id),children:[a.jsx(qn,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})]})]})]}),a.jsxs("p",{className:"mt-1 text-xs text-muted-foreground",children:["Trigger: ",b.trigger]}),a.jsxs("div",{className:"mt-3 flex items-center gap-4 text-xs text-muted-foreground",children:[a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(Ii,{className:"h-3.5 w-3.5"})," ",b.steps," emails"]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(wr,{className:"h-3.5 w-3.5"})," ",b.enrolled.toLocaleString()]}),a.jsxs("span",{className:"flex items-center gap-1",children:[a.jsx(zx,{className:"h-3.5 w-3.5"})," ",b.openRate,"%"]})]})]},b.id))})}),g&&a.jsx(iws,{sequence:g,allSequences:n,canManage:e,onChange:b=>s(g.id,b)},g.id)]}),a.jsx(Bt,{open:d,onOpenChange:u,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg",children:[a.jsx(Vt,{children:a.jsx(Ut,{children:"New sequence"})}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"seqname",children:"Sequence name"}),a.jsx(Oe,{id:"seqname",value:h,onChange:b=>m(b.target.value),placeholder:"e.g. Camp Upsell",autoFocus:!0})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"ghost",onClick:()=>u(!1),children:"Cancel"}),a.jsx(Z,{onClick:async()=>{const b=await r(h);c(b.id),m(""),u(!1),t({title:"Sequence created"})},children:"Create"})]})]})}),a.jsx(Cl,{open:!!f,onOpenChange:b=>!b&&p(null),title:"Delete sequence?",description:"Enrolled contacts will stop receiving these emails.",onConfirm:()=>{f&&(o(f),t({title:"Sequence deleted"})),p(null)}})]})}const xet={add_tag:'Puts this label on the person when they reach this step, for example "vip" after they click a campaign. If they already have it nothing changes. Adding a tag also starts any sequence whose trigger is "Tag added" for that tag.',remove_tag:"Takes this label off the person when they reach this step. If they do not have it the step is skipped. Use it to undo a tag an earlier step or sequence added."};function wet({id:t,label:e,value:n,optional:r=!1,placeholder:s,suggestionsId:i,onCommit:o}){const[l,c]=y.useState(n),[d,u]=y.useState("");y.useEffect(()=>{c(n),u("")},[n]);const h=()=>{const m=pse(l);if(!m&&!r){u(n?`Enter a tag name. "${n}" stays saved until you do.`:"Enter a tag name.");return}u(""),c(m),m!==n&&o(m)};return a.jsxs(a.Fragment,{children:[a.jsx(Oe,{id:t,"aria-label":e,"aria-invalid":!!d,className:"mt-1 h-8",value:l,maxLength:GAe,placeholder:s,list:i,onChange:m=>{c(m.target.value),d&&u("")},onBlur:h,onKeyDown:m=>{if(m.key!=="Enter")return;const f=m.currentTarget;setTimeout(()=>f.blur())}}),d&&a.jsx("p",{role:"alert",className:"mt-1 text-xs text-destructive",children:d})]})}function iws({sequence:t,allSequences:e,canManage:n,onChange:r}){const s=t.stepList??[],{community:i}=qe(),o=VNt(n?(i==null?void 0:i.id)??null:null).data??[],l=`sequence-tags-${t.id}`,[c,d]=y.useState(null),[u,h]=y.useState(null),m=(x=(u==null?void 0:u.tag)??"")=>{if(!u)return;const w=pse(x);if(!w){h({...u,tag:x,error:"Enter a tag name to add this step."});return}g([...s,{id:u.id,type:u.type,tag:w}]),h(null)},f=s.find(x=>x.id===c&&(x.type==="email"||x.type==="notify_admin"))??null,p=e.filter(x=>x.id!==t.id),g=x=>r({stepList:x,steps:x.filter(w=>w.type==="email").length}),v=(x,w)=>g(s.map(k=>k.id===x?{...k,...w}:k)),b=(x,w)=>{const k=x+w;if(k<0||k>=s.length)return;const S=[...s];[S[x],S[k]]=[S[k],S[x]],g(S)};return a.jsxs(it.div,{initial:{opacity:0},animate:{opacity:1},className:"lg:col-span-3 rounded-xl border border-border bg-card p-5 shadow-card",children:[a.jsxs("div",{className:"mb-4 flex items-center justify-between gap-2",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-success/10 text-success",children:a.jsx(Pg,{className:"h-4 w-4"})}),a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold text-foreground",children:t.name}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[s.filter(x=>x.type==="email").length," emails · ",s.length," steps"]})]})]}),n&&a.jsx(Z,{variant:"outline",size:"sm",onClick:()=>r({status:t.status==="active"?"paused":"active"}),children:t.status==="active"?"Pause":"Activate"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{className:"text-xs",children:"Enrolment trigger"}),a.jsx(gn,{label:"Enrolment trigger",children:"What starts this sequence for someone. Each person who does that thing begins at step one and moves through on their own schedule, so people are at different steps at the same time. Changing the trigger does not re-run it for anyone already enrolled."})]}),a.jsxs(zn,{value:t.trigger||void 0,onValueChange:x=>r({trigger:x}),children:[a.jsx(On,{className:"h-9",children:a.jsx(Vn,{placeholder:"Choose a trigger"})}),a.jsxs(Fn,{children:[bet.map(x=>a.jsx(pt,{value:x,children:x},x)),t.trigger&&!bet.includes(t.trigger)&&a.jsx(pt,{value:t.trigger,children:t.trigger})]})]}),t.trigger===nws&&a.jsxs("div",{className:"pt-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:`trigger-tag-${t.id}`,className:"text-xs",children:"Tag (optional)"}),a.jsx(gn,{label:"Trigger tag",children:'Start this sequence only when this tag is added to someone. Leave it empty to start on any tag. Upper and lower case are treated the same, so "VIP" and "vip" match. Tags are added in Audience, or by an "Add tag" step in a sequence or a workflow. Tags already in use are suggested as you type.'})]}),a.jsx(wet,{id:`trigger-tag-${t.id}`,label:"Trigger tag",value:t.triggerTag??"",optional:!0,placeholder:"Any tag",suggestionsId:l,onCommit:x=>r({triggerTag:x})})]})]}),a.jsx("datalist",{id:l,children:o.map(x=>a.jsx("option",{value:x},x))}),a.jsxs("div",{className:"mt-4 space-y-2",children:[s.length===0&&a.jsx("p",{className:"rounded-lg border border-dashed border-border px-3 py-6 text-center text-xs text-muted-foreground",children:"No steps yet — add an email or a wait below."}),a.jsx(Al,{initial:!1,children:s.map((x,w)=>{var k,S;return a.jsxs(it.div,{layout:!0,initial:{opacity:0,y:6},animate:{opacity:1,y:0},exit:{opacity:0,height:0},className:"flex items-start gap-2 rounded-lg border border-border bg-surface p-3",children:[a.jsx("span",{className:ee("mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full",Cp[x.type].className),children:(()=>{const C=Cp[x.type].icon;return a.jsx(C,{className:"h-4 w-4"})})()}),a.jsx("div",{className:"min-w-0 flex-1",children:x.type==="legacy"?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:Cp.legacy.label}),a.jsx("p",{className:"mt-1 text-sm text-foreground",children:x.legacyLabel}),a.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"Conditions are no longer offered. This one still runs and is kept exactly as it was — remove it if you no longer want it."})]}):x.type==="add_tag"||x.type==="remove_tag"?a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:Cp[x.type].label}),a.jsx(gn,{label:Cp[x.type].label,children:xet[x.type]})]}),a.jsx(wet,{id:`step-tag-${x.id}`,label:`${Cp[x.type].label} name`,value:x.tag??"",placeholder:"e.g. vip",suggestionsId:l,onCommit:C=>v(x.id,{tag:C})})]}):x.type==="notify_admin"?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:Cp.notify_admin.label}),a.jsx("p",{className:"mt-1 text-sm font-medium text-foreground",children:((k=x.subject)==null?void 0:k.trim())||"Untitled notification"}),a.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:nHe(x.html)||"Emails the community admins, not the member."}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"mt-2 h-8",onClick:()=>d(x.id),children:[a.jsx(Qs,{className:"mr-1.5 h-3.5 w-3.5"}),(S=x.subject)!=null&&S.trim()||x.html?"Edit notification":"Write notification"]})]}):x.type==="enroll_in_sequence"?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:Cp.enroll_in_sequence.label}),a.jsxs(zn,{value:x.sequenceId||void 0,onValueChange:C=>v(x.id,{sequenceId:C}),children:[a.jsx(On,{className:"mt-1 h-8",children:a.jsx(Vn,{placeholder:"Choose a sequence"})}),a.jsxs(Fn,{children:[p.length===0&&a.jsx(pt,{value:"none",disabled:!0,children:"No other sequences yet"}),p.map(C=>a.jsx(pt,{value:C.id,children:C.name},C.id))]})]}),!x.sequenceId&&a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Pick one, or this step is skipped when saved."})]}):x.type==="email"?a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Send email"}),a.jsx("p",{className:"mt-1 text-sm font-medium text-foreground",children:VZ(x)||"Untitled email"}),a.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:nHe(x.html)||"No body yet — add a subject and body to send a real email."}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"mt-2 h-8",onClick:()=>d(x.id),children:[a.jsx(Qs,{className:"mr-1.5 h-3.5 w-3.5"}),VZ(x)||x.html?"Edit email":"Write email"]})]}):a.jsxs(a.Fragment,{children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:"Wait"}),a.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[a.jsx(Oe,{type:"number",min:1,className:"h-8 w-20",value:x.delayValue??1,onChange:C=>v(x.id,{delayValue:Number(C.target.value)||1})}),a.jsxs(zn,{value:x.delayUnit??"days",onValueChange:C=>v(x.id,{delayUnit:C}),children:[a.jsx(On,{className:"h-8 w-28",children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"hours",children:"hours"}),a.jsx(pt,{value:"days",children:"days"})]})]})]})]})}),a.jsxs("div",{className:"flex flex-col gap-0.5 pt-0.5",children:[a.jsx("button",{onClick:()=>b(w,-1),disabled:w===0,className:"text-muted-foreground hover:text-foreground disabled:opacity-30","aria-label":"Move up",children:a.jsx(Zf,{className:"h-3.5 w-3.5"})}),a.jsx("button",{onClick:()=>b(w,1),disabled:w===s.length-1,className:"text-muted-foreground hover:text-foreground disabled:opacity-30","aria-label":"Move down",children:a.jsx(w0,{className:"h-3.5 w-3.5"})})]}),a.jsx("button",{onClick:()=>g(s.filter(C=>C.id!==x.id)),className:"text-muted-foreground hover:text-destructive","aria-label":"Remove step",children:a.jsx(nn,{className:"h-4 w-4"})})]},x.id)})}),u&&a.jsxs("div",{className:"flex items-start gap-2 rounded-lg border border-dashed border-border bg-surface p-3",children:[a.jsx("span",{className:ee("mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-full",Cp[u.type].className),children:a.jsx(ka,{className:"h-4 w-4"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:"pending-tag",className:"text-xs font-medium text-muted-foreground",children:Cp[u.type].label}),a.jsx(gn,{label:Cp[u.type].label,children:xet[u.type]})]}),a.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[a.jsx(Oe,{id:"pending-tag",autoFocus:!0,className:"h-8",value:u.tag,maxLength:GAe,"aria-invalid":!!u.error,placeholder:"e.g. vip",list:l,onChange:x=>h({...u,tag:x.target.value,error:""}),onKeyDown:x=>{if(x.key!=="Enter")return;const w=x.currentTarget;setTimeout(()=>{w.isConnected&&m(w.value)})}}),a.jsx(Z,{type:"button",size:"sm",className:"h-8 shrink-0",onClick:()=>m(),children:"Add step"})]}),u.error&&a.jsx("p",{role:"alert",className:"mt-1 text-xs text-destructive",children:u.error})]}),a.jsx("button",{onClick:()=>h(null),className:"text-muted-foreground hover:text-destructive","aria-label":"Cancel tag step",children:a.jsx(nn,{className:"h-4 w-4"})})]}),a.jsxs("div",{className:"flex flex-wrap gap-2 pt-1",children:[a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>g([...s,GH("email")]),children:[a.jsx(Ii,{className:"mr-1.5 h-4 w-4"})," Add email"]}),a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>g([...s,GH("wait")]),children:[a.jsx(ja,{className:"mr-1.5 h-4 w-4"})," Add wait"]}),a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>g([...s,GH("notify_admin")]),children:[a.jsx(Lm,{className:"mr-1.5 h-4 w-4"})," Notify admin"]}),a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>g([...s,GH("enroll_in_sequence")]),children:[a.jsx(Pg,{className:"mr-1.5 h-4 w-4"})," Enroll in sequence"]}),a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>h({id:mke(),type:"add_tag",tag:"",error:""}),children:[a.jsx(ka,{className:"mr-1.5 h-4 w-4"})," Add tag"]}),a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>h({id:mke(),type:"remove_tag",tag:"",error:""}),children:[a.jsx(ka,{className:"mr-1.5 h-4 w-4"})," Remove tag"]})]})]}),a.jsx(XDt,{open:!!f,step:f,readOnly:!n,...(f==null?void 0:f.type)==="notify_admin"?{title:"Write admin notification",subjectHint:"Leave empty for a default naming the person and what they did.",description:"This goes to your community admins, not the member. Use {{name}}, {{email}}, {{newsletter}}, {{campaign}} or {{tag}} — anything the activity is not linked to shows as a dash."}:{},onOpenChange:x=>{x||d(null)},onSave:x=>{f&&(v(f.id,x),d(null))}})]})}const aws=".pdf,.doc,.docx,.ppt,.pptx,.xls,.xlsx,.zip,.txt,.csv,.png,.jpg,.jpeg,.webp";function ket(t,e){return aAe(e,t)}function E6t({communityId:t,url:e,fileName:n,onChange:r}){const{toast:s}=yt(),i=y.useRef(null),[o,l]=y.useState(!1),[c,d]=y.useState(!1),u=!!e,h=async m=>{if(!(!m||!t)){l(!0);try{const f=await plr(t,m);r({url:f,fileName:m.name}),d(!1)}catch(f){s({title:dn(f,"Couldn't upload that file"),variant:"destructive"})}finally{l(!1),i.current&&(i.current.value="")}}};return a.jsxs("div",{className:"min-w-0 space-y-2",children:[a.jsx("input",{ref:i,type:"file",accept:aws,className:"hidden",onChange:m=>{var f;return void h((f=m.target.files)==null?void 0:f[0])}}),u?a.jsxs("div",{className:"grid min-w-0 grid-cols-[auto_minmax(0,1fr)_auto_auto] items-center gap-2 rounded-lg border border-border bg-muted/40 px-3 py-2",children:[a.jsx(OLe,{className:"h-4 w-4 shrink-0 text-primary"}),a.jsx("p",{className:"min-w-0 truncate text-sm text-foreground",title:ket(e,n),children:ket(e,n)}),a.jsx(Z,{type:"button",variant:"ghost",size:"sm",className:"shrink-0 px-2",disabled:o,onClick:()=>{var m;return(m=i.current)==null?void 0:m.click()},children:"Replace"}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8 shrink-0",disabled:o,onClick:()=>r({url:"",fileName:""}),children:a.jsx(nn,{className:"h-4 w-4"})})]}):a.jsxs(Z,{type:"button",variant:"outline",className:"w-full justify-start",disabled:!t||o,onClick:()=>{var m;return(m=i.current)==null?void 0:m.click()},children:[o?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(OLe,{className:"mr-2 h-4 w-4"}),o?"Uploading…":"Upload a file"]}),a.jsx("button",{type:"button",className:"text-[11px] font-medium text-primary hover:underline",onClick:()=>d(m=>!m),children:c?"Hide link":"Or paste a link"}),c?a.jsx(Oe,{value:e,onChange:m=>r({url:m.target.value,fileName:""}),placeholder:"https://…/guide.pdf",className:"min-w-0 overflow-hidden text-ellipsis"}):null,!o0(e)&&!o?a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Upload the PDF, doc, or zip they should get after opt-in."}):null]})}const F1="__none__",Cet={name:"",offer:"",thankYouMessage:"",deliveryType:"message",deliveryUrl:"",deliveryFileName:"",formId:F1,sequenceId:F1};function ows(t){return{name:t.name.trim(),offer:t.offer.trim(),thankYouMessage:t.thankYouMessage.trim(),deliveryType:t.deliveryType,deliveryUrl:t.deliveryUrl.trim(),deliveryFileName:t.deliveryFileName.trim(),formId:t.formId===F1?null:t.formId,sequenceId:t.sequenceId===F1?null:t.sequenceId}}function lws(){var _;const{toast:t}=yt(),{community:e}=qe(),n=(e==null?void 0:e.id)??null,r=ob(),s=tvr(n),i=HAe(n),o=evr(n,"sequence"),l=nvr(n),c=rvr(n),d=svr(n),u=ivr(n),h=s.data??[],m=((_=i.data)==null?void 0:_.data)??[],f=o.data??[],[p,g]=y.useState(!1),[v,b]=y.useState(null),[x,w]=y.useState(Cet),[k,S]=y.useState(null),C=()=>{b(null),w(Cet),g(!0)},j=T=>{b(T),w({name:T.name,offer:T.offer||"",thankYouMessage:T.thankYouMessage||"",deliveryType:T.deliveryType||"message",deliveryUrl:T.deliveryUrl||"",deliveryFileName:T.deliveryFileName||"",formId:T.formId||F1,sequenceId:T.sequenceId||F1}),g(!0)},E=l.isPending||c.isPending,N=()=>{if(!x.name.trim()){t({title:"Give the funnel a name",variant:"destructive"});return}if((x.deliveryType==="download"||x.deliveryType==="redirect")&&!o0(x.deliveryUrl)){t({title:"Add the file or page link they should get after opt-in",variant:"destructive"});return}const T=ows({...x,deliveryUrl:o0(x.deliveryUrl),deliveryFileName:x.deliveryType==="download"?x.deliveryFileName:""});v?c.mutate({funnelId:v.id,body:T},{onSuccess:()=>{t({title:"Funnel updated"}),g(!1)},onError:()=>t({title:"Couldn't update funnel",variant:"destructive"})}):l.mutate(T,{onSuccess:()=>{t({title:"Funnel created"}),g(!1)},onError:()=>t({title:"Couldn't create funnel",variant:"destructive"})})},A=!s.isLoading&&h.length===0;return a.jsxs(it.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:"mx-auto max-w-6xl space-y-5 lg:p-6",children:[a.jsx(Bm,{title:"Funnels",description:"The journey after someone wants an offer: landing → form answers → thank-you / download → nurture emails. A newsletter is only for joining the list.",actions:a.jsxs(a.Fragment,{children:[a.jsx(zS,{}),r&&a.jsxs(Z,{className:"transition-transform active:scale-95",onClick:C,children:[a.jsx(Dn,{className:"mr-1.5 h-4 w-4"})," New funnel"]})]})}),s.isLoading?a.jsxs("div",{className:"flex items-center justify-center gap-2 py-16 text-muted-foreground",children:[a.jsx(Ne,{className:"h-5 w-5 animate-spin"})," Loading funnels…"]}):s.isError?a.jsx("div",{className:"rounded-xl border border-destructive/30 bg-destructive/5 p-6 text-center text-sm text-destructive",children:"Couldn't load funnels. Please retry."}):A?a.jsxs("div",{className:"rounded-xl border border-dashed border-border bg-card/50 p-10 text-center",children:[a.jsx(Pg,{className:"mx-auto h-10 w-10 text-muted-foreground"}),a.jsx("h3",{className:"mt-3 text-sm font-semibold text-foreground",children:"No funnels yet"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Package an offer, the form that collects answers, the thank-you, and the follow-up emails."}),r&&a.jsxs(Z,{className:"mt-4",onClick:C,children:[a.jsx(Dn,{className:"mr-1.5 h-4 w-4"})," New funnel"]})]}):a.jsx("div",{className:"space-y-4",children:a.jsx(Al,{initial:!1,children:h.map(T=>{var O;const R=((O=T.stages[0])==null?void 0:O.metric)||1;return a.jsxs(it.div,{layout:!0,...rL,className:"rounded-xl border border-border bg-card p-5 shadow-card transition-shadow hover:shadow-card-hover",children:[a.jsxs("div",{className:"mb-3 flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("div",{children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("h3",{className:"text-base font-semibold text-foreground",children:T.name}),a.jsx(q0,{status:T.status})]}),T.offer&&a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:T.offer}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:T.deliveryType==="download"?"After opt-in: delivers a file":T.deliveryType==="redirect"?"After opt-in: sends them to another page":"After opt-in: shows the thank-you message"})]}),a.jsxs("div",{className:"flex items-center gap-5 text-sm",children:[a.jsxs("span",{className:"flex items-center gap-1.5 text-muted-foreground",children:[a.jsx(HP,{className:"h-4 w-4"})," ",T.conversionRate,"% opt-in"]}),r&&a.jsxs(Z,{variant:T.status==="active"?"outline":"default",size:"sm",onClick:()=>d.mutate({funnelId:T.id},{onSuccess:F=>t({title:F.status==="active"?"Funnel activated":"Funnel paused"})}),children:[a.jsx(yO,{className:"mr-1.5 h-4 w-4"})," ",T.status==="active"?"Pause":"Activate"]}),a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[r&&a.jsxs(ot,{onClick:()=>j(T),children:[a.jsx(Qs,{className:"mr-2 h-4 w-4"})," Edit"]}),r&&a.jsxs(a.Fragment,{children:[a.jsx(mi,{}),a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>S(T.id),children:[a.jsx(qn,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})]})]})]}),a.jsxs("div",{className:"mb-4 flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground",children:[a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(Ei,{className:"h-3.5 w-3.5"})," ",T.formName||a.jsx("em",{className:"not-italic text-amber-600",children:"no form"})]}),T.formId?a.jsxs("a",{href:ve.formPublic(T.formId),target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-primary hover:underline",children:[a.jsx(bo,{className:"h-3 w-3"})," Open landing"]}):null,a.jsx(eu,{className:"h-3 w-3"}),a.jsxs("span",{className:"inline-flex items-center gap-1",children:[a.jsx(Pg,{className:"h-3.5 w-3.5"})," ",T.sequenceName||a.jsx("em",{className:"not-italic text-amber-600",children:"no sequence"})]}),T.linkTag&&a.jsxs("span",{className:"ml-1 rounded-full bg-muted px-2 py-0.5",children:["#",T.linkTag]})]}),a.jsx("div",{className:"flex items-stretch gap-2 overflow-x-auto pb-1",children:T.stages.map((F,D)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("div",{className:"min-w-[150px] rounded-lg border border-border bg-surface p-3",children:[a.jsx("p",{className:"text-xs font-medium text-muted-foreground",children:F.label}),a.jsx("p",{className:"mt-1 text-lg font-semibold text-foreground",children:F.metric.toLocaleString()}),a.jsx("div",{className:"mt-2 h-1.5 w-full overflow-hidden rounded-full bg-muted",children:a.jsx(it.div,{className:"h-full rounded-full bg-primary",initial:{width:0},animate:{width:`${Math.max(F.metric/R*100,3)}%`},transition:{duration:.5,delay:D*.06}})}),a.jsxs("p",{className:"mt-1 text-[11px] text-muted-foreground",children:[F.hint,F.key==="nurture"&&F.detail?` · ${F.detail.active} active`:""]})]}),D<T.stages.length-1&&a.jsx(xa,{className:"h-4 w-4 shrink-0 self-center text-muted-foreground"})]},F.key))})]},T.id)})})}),a.jsx(Bt,{open:p,onOpenChange:g,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg max-h-[90vh] max-w-lg overflow-x-hidden overflow-y-auto",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:v?"Edit funnel":"New funnel"}),a.jsx(_n,{children:"Build the path: offer landing, the form questions, what they receive, then the nurture emails."})]}),a.jsxs("div",{className:"min-w-0 space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:"fname",children:"Funnel name"}),a.jsx(gn,{label:"Funnel name",children:"A funnel joins three things you already made: a form that collects the email, what the person gets straight after, and a sequence that follows up. This name is only for finding it in the list."})]}),a.jsx(Oe,{id:"fname",value:x.name,onChange:T=>w({...x,name:T.target.value}),placeholder:"e.g. Free workshop funnel",autoFocus:!0})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"offer",children:"The offer"}),a.jsx(Oe,{id:"offer",value:x.offer,onChange:T=>w({...x,offer:T.target.value}),placeholder:"e.g. Download the 7-day onboarding checklist"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Shown on the thank-you screen after they opt in. The form keeps its own Headline."})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:"thanks",children:"Thank-you message"}),a.jsx(gn,{label:"Thank-you message",children:"Shown on screen the moment someone signs up. Use it to say what happens next — when the first email arrives, or where to find what they just asked for."})]}),a.jsx(us,{id:"thanks",rows:2,value:x.thankYouMessage,onChange:T=>w({...x,thankYouMessage:T.target.value}),placeholder:"Your checklist is ready. We’ll email the first lesson tomorrow."})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{children:"After they opt in"}),a.jsx(gn,{label:"After they opt in",children:"What the person receives the instant they sign up. Choose deliver a file to hand over a guide or checklist in exchange for the address, or redirect to send them to a page of your own."})]}),a.jsxs(zn,{value:x.deliveryType,onValueChange:T=>w({...x,deliveryType:T}),children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"message",children:"Show the thank-you message"}),a.jsx(pt,{value:"download",children:"Deliver a file or lead magnet"}),a.jsx(pt,{value:"redirect",children:"Send them to another page"})]})]}),x.deliveryType==="download"?a.jsx(E6t,{communityId:n,url:x.deliveryUrl,fileName:x.deliveryFileName,onChange:({url:T,fileName:R})=>w({...x,deliveryUrl:T,deliveryFileName:R})}):x.deliveryType==="redirect"?a.jsx(Oe,{value:x.deliveryUrl,onChange:T=>w({...x,deliveryUrl:T.target.value}),placeholder:"https://yoursite.com/thanks"}):null]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{children:"Form (the questions)"}),a.jsx(gn,{label:"Form",children:"The sign-up form this funnel uses to collect the email address. Build it on the Forms page first — a funnel does not create one for you."})]}),a.jsxs(zn,{value:x.formId,onValueChange:T=>w({...x,formId:T}),children:[a.jsx(On,{children:a.jsx(Vn,{placeholder:"Select a form"})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:F1,children:"None"}),m.map(T=>a.jsx(pt,{value:T.id,children:T.name},T.id))]})]}),m.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"No forms yet — create one on the Forms page first."})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{children:"Nurture sequence"}),a.jsx(gn,{label:"Nurture sequence",children:"The emails that follow automatically after someone signs up, spread over days rather than sent at once. Optional — leave it as None to collect addresses now and email them later."})]}),a.jsxs(zn,{value:x.sequenceId,onValueChange:T=>w({...x,sequenceId:T}),children:[a.jsx(On,{children:a.jsx(Vn,{placeholder:"Select a sequence"})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:F1,children:"None"}),f.map(T=>a.jsx(pt,{value:T.id,children:T.name},T.id))]})]}),f.length===0&&a.jsx("p",{className:"text-xs text-muted-foreground",children:"No sequences yet — build one on the Sequences page first."})]})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"ghost",onClick:()=>g(!1),children:"Cancel"}),a.jsxs(Z,{onClick:N,disabled:E,children:[E&&a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}),v?"Save changes":"Create funnel"]})]})]})}),a.jsx(Cl,{open:!!k,onOpenChange:T=>!T&&S(null),title:"Delete funnel?",description:"This removes the funnel. The linked form and sequence are left intact.",onConfirm:()=>{k&&u.mutate(k,{onSuccess:()=>t({title:"Funnel deleted"})}),S(null)}})]})}const cws={Popup:"bg-purple-500",Inline:"bg-primary","Landing page":"bg-success"},Cae="__none__",FX={name:{label:"Name",hint:"Full name",Icon:k2},phone:{label:"Phone",hint:"Mobile or landline",Icon:rS},company:{label:"Company",hint:"Business or team",Icon:fBt},text:{label:"Short answer",hint:"One-line question",Icon:ust},textarea:{label:"Long answer",hint:"Paragraph",Icon:dSe},select:{label:"Dropdown",hint:"Pick one option",Icon:rI},checkbox:{label:"Checkbox",hint:"Yes / agree",Icon:p9t}},dws=Object.keys(FX),jet=["name","phone","company"];function JIe(t,e=[]){const n=e.filter(s=>s.type===t).length,r=FX[t].label;return{key:t==="name"&&n===0?"name":`${t}_${Math.random().toString(36).slice(2,7)}`,type:t,label:n===0?r:`${r} ${n+1}`,required:t!=="name"&&t!=="checkbox",options:t==="select"?["Option 1","Option 2"]:void 0}}function uws(t){var e;return(e=t.fields)!=null&&e.length?t.fields:t.collectName===!1?[]:[JIe("name")]}function l4(t,e,n){return t.map((r,s)=>s===e?{...r,...n}:r)}function hws(t){return typeof t=="boolean"?t?"Yes":"No":String(t||"—")}function mws({form:t,communityId:e,open:n,onOpenChange:r}){var l,c;const s=Jgr(e,n?(t==null?void 0:t.id)??null:null),i=((l=s.data)==null?void 0:l.submissions)??[],o=((c=s.data)==null?void 0:c.total)??0;return a.jsx(Bt,{open:n,onOpenChange:r,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg max-h-[85vh] max-w-3xl overflow-hidden",children:[a.jsxs(Vt,{children:[a.jsxs(Ut,{children:["Responses",t?` · ${t.name}`:""]}),a.jsx(_n,{children:"Every answer people submitted on this form. New submissions appear here as they come in."})]}),a.jsx("div",{className:"max-h-[60vh] overflow-auto",children:s.isLoading?a.jsxs("div",{className:"flex items-center justify-center gap-2 py-12 text-muted-foreground",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"})," Loading responses…"]}):s.isError?a.jsx("p",{className:"py-8 text-center text-sm text-destructive",children:"Couldn't load responses."}):i.length===0?a.jsx("p",{className:"py-8 text-center text-sm text-muted-foreground",children:"No saved responses yet. New submissions will show the details they filled in."}):a.jsx("div",{className:"space-y-3",children:i.map(d=>a.jsxs("div",{className:"rounded-xl border border-border bg-card p-4",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-2",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-semibold text-foreground",children:d.name||"No name"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:d.email})]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:new Date(d.createdAt).toLocaleString("en-GB",{day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit"})})]}),d.answers.length>0&&a.jsx("dl",{className:"mt-3 grid gap-2 sm:grid-cols-2",children:d.answers.map(u=>a.jsxs("div",{className:"rounded-lg bg-muted/50 px-3 py-2",children:[a.jsx("dt",{className:"text-[11px] font-medium text-muted-foreground",children:u.label}),a.jsx("dd",{className:"mt-0.5 text-sm text-foreground",children:hws(u.value)})]},`${d.id}-${u.key}`))})]},d.id))})}),o>0&&a.jsxs("p",{className:"text-xs text-muted-foreground",children:[o," ",o===1?"response":"responses"]})]})})}function Eet(t,e,n){const r=e+n;if(r<0||r>=t.length)return t;const s=t.slice(),[i]=s.splice(e,1);return s.splice(r,0,i),s}const Net={name:"",type:"Landing page",fields:[JIe("name")],tags:"",newsletterId:Cae,headline:"",subtext:"",buttonText:"Get access",successMessage:"Thanks — check your inbox for next steps.",afterType:"message",afterUrl:"",afterFileName:""};function fws(t){var e,n,r,s,i,o,l,c,d,u;return{name:t.name,type:t.type,fields:uws(t),tags:(t.applyTags||[]).join(", "),newsletterId:t.newsletterId||Cae,headline:((e=t.settings)==null?void 0:e.headline)||"",subtext:((n=t.settings)==null?void 0:n.subtext)||"",buttonText:((r=t.settings)==null?void 0:r.buttonText)||"Get access",successMessage:((s=t.settings)==null?void 0:s.successMessage)||"Thanks — check your inbox for next steps.",afterType:((o=(i=t.settings)==null?void 0:i.afterSubmit)==null?void 0:o.type)||"message",afterUrl:((c=(l=t.settings)==null?void 0:l.afterSubmit)==null?void 0:c.url)||"",afterFileName:((u=(d=t.settings)==null?void 0:d.afterSubmit)==null?void 0:u.fileName)||""}}function pws(t){return{name:t.name.trim(),type:t.type,collectName:t.fields.some(e=>e.type==="name"),fields:t.fields,applyTags:t.tags.split(",").map(e=>e.trim()).filter(Boolean),newsletterId:t.newsletterId===Cae?null:t.newsletterId,settings:{headline:t.headline.trim(),subtext:t.subtext.trim(),buttonText:t.buttonText.trim()||"Get access",successMessage:t.successMessage.trim()||"Thanks — check your inbox for next steps.",afterSubmit:{type:t.afterType,url:t.afterUrl.trim(),fileName:t.afterFileName.trim()}}}}function gws(){var z,G;const{toast:t}=yt(),{community:e}=qe(),n=(e==null?void 0:e.id)??null,r=ob(),s=HAe(n),i=UNt(n),o=Ygr(n),l=Qgr(n),c=Zgr(n),d=Xgr(n),u=((z=s.data)==null?void 0:z.data)??[],h=((G=i.data)==null?void 0:G.data)??[],[m,f]=y.useState(!1),[p,g]=y.useState(null),[v,b]=y.useState(Net),[x,w]=y.useState(null),[k,S]=y.useState(null),[C,j]=y.useState(null),[E,N]=y.useState(!1),[A,_]=y.useState(null),T=B=>`${window.location.origin}${ve.formPublic(B)}`,R=B=>`<iframe src="${T(B)}" width="100%" height="480" frameborder="0" style="border:0;max-width:520px"></iframe>`,O=B=>{if(B.status==="published"){w(B);return}_(B)},F=()=>{g(null),b(Net),N(!1),f(!0)},D=B=>{g(B),b(fws(B)),N(!1),f(!0)},I=o.isPending||l.isPending,P=()=>{if(!v.name.trim()){t({title:"Give the form a name",variant:"destructive"});return}if((v.afterType==="download"||v.afterType==="redirect")&&!o0(v.afterUrl)){t({title:"Add the file or page link they should get after submit",variant:"destructive"});return}const B=pws({...v,afterUrl:o0(v.afterUrl)});p?l.mutate({formId:p.id,body:B},{onSuccess:()=>{t({title:"Form updated"}),f(!1)},onError:()=>t({title:"Couldn't update form",variant:"destructive"})}):o.mutate(B,{onSuccess:()=>{t({title:"Form created"}),f(!1)},onError:()=>t({title:"Couldn't create form",variant:"destructive"})})},M=!s.isLoading&&u.length===0;return a.jsxs(it.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:"mx-auto max-w-6xl space-y-5 lg:p-6",children:[a.jsx(Bm,{title:"Forms",description:"Collect extra answers for a specific offer — not just name and email. Use a newsletter when people only need to join the list.",actions:a.jsxs(a.Fragment,{children:[a.jsx(zS,{}),r&&a.jsxs(Z,{className:"transition-transform active:scale-95",onClick:F,children:[a.jsx(Dn,{className:"mr-1.5 h-4 w-4"})," New form"]})]})}),s.isLoading?a.jsxs("div",{className:"flex items-center justify-center gap-2 py-16 text-muted-foreground",children:[a.jsx(Ne,{className:"h-5 w-5 animate-spin"})," Loading forms…"]}):s.isError?a.jsx("div",{className:"rounded-xl border border-destructive/30 bg-destructive/5 p-6 text-center text-sm text-destructive",children:"Couldn't load forms. Please retry."}):M?a.jsxs("div",{className:"rounded-xl border border-dashed border-border bg-card/50 p-10 text-center",children:[a.jsx(Ei,{className:"mx-auto h-10 w-10 text-muted-foreground"}),a.jsx("h3",{className:"mt-3 text-sm font-semibold text-foreground",children:"No forms yet"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Ask questions, deliver a thank-you or download, and tag the contact for later."}),r&&a.jsxs(Z,{className:"mt-4",onClick:F,children:[a.jsx(Dn,{className:"mr-1.5 h-4 w-4"})," New form"]})]}):a.jsx("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:a.jsx(Al,{initial:!1,children:u.map(B=>{var H,W;return a.jsxs(it.div,{layout:!0,...bus,whileHover:{y:-4},className:"flex flex-col rounded-xl border border-border bg-card p-5 shadow-card transition-shadow hover:shadow-card-hover",children:[a.jsxs("div",{className:"flex items-start justify-between",children:[a.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-lg bg-accent text-accent-foreground",children:a.jsx(Ei,{className:"h-5 w-5"})}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx(q0,{status:B.status}),a.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7",title:"Share & embed","aria-label":`Share ${B.name}`,onClick:()=>O(B),children:a.jsx(kk,{className:"h-4 w-4"})}),a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[r&&a.jsxs(ot,{onClick:()=>D(B),children:[a.jsx(Qs,{className:"mr-2 h-4 w-4"})," Edit"]}),r&&a.jsxs(ot,{onClick:()=>c.mutate({formId:B.id},{onSuccess:V=>t({title:V.status==="published"?"Form published":"Form unpublished"})}),children:[a.jsx(yO,{className:"mr-2 h-4 w-4"})," ",B.status==="published"?"Unpublish":"Publish"]}),a.jsxs(ot,{onClick:()=>S(B),children:[a.jsx(Oc,{className:"mr-2 h-4 w-4"})," Responses"]}),a.jsxs(ot,{onClick:()=>O(B),children:[a.jsx($Le,{className:"mr-2 h-4 w-4"})," Share & embed"]}),r&&a.jsxs(a.Fragment,{children:[a.jsx(mi,{}),a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>j(B.id),children:[a.jsx(qn,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})]})]})]}),a.jsx("h3",{className:"mt-3 text-sm font-semibold text-foreground",children:B.name}),a.jsxs("span",{className:"mt-1 inline-flex w-fit items-center gap-1.5 text-xs text-muted-foreground",children:[a.jsx("span",{className:`h-2 w-2 rounded-full ${cws[B.type]??"bg-muted-foreground"}`})," ",B.type]}),a.jsxs("p",{className:"mt-2 text-xs text-muted-foreground",children:["Email + ",((H=B.fields)==null?void 0:H.length)??(B.collectName?1:0)," extra ",(((W=B.fields)==null?void 0:W.length)??(B.collectName?1:0))===1?"question":"questions"]}),B.applyTags.length>0&&a.jsx("div",{className:"mt-2 flex flex-wrap gap-1",children:B.applyTags.map(V=>a.jsxs("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[11px] text-muted-foreground",children:["#",V]},V))}),B.status!=="published"&&a.jsxs("div",{className:"mt-3 rounded-lg border border-warning/40 bg-warning/10 p-2.5",children:[a.jsxs("p",{className:"text-[11px] leading-relaxed text-foreground",children:[a.jsx("span",{className:"font-semibold",children:"Not live yet."})," ","Its link and embed won't accept submissions until you publish it."]}),r&&a.jsxs(Z,{size:"sm",variant:"outline",className:"mt-2 h-7 w-full text-xs",disabled:c.isPending,onClick:()=>c.mutate({formId:B.id},{onSuccess:()=>t({title:"Form published",description:"It can now collect responses."}),onError:V=>t({title:"Couldn't publish",description:dn(V,"Please try again."),variant:"destructive"})}),children:[a.jsx(yO,{className:"mr-1.5 h-3.5 w-3.5"})," Publish form"]})]}),a.jsxs("div",{className:"mt-4 grid grid-cols-3 gap-2 border-t border-border pt-3 text-center",children:[a.jsxs("div",{children:[a.jsxs("p",{className:"flex items-center justify-center gap-1 text-[11px] text-muted-foreground",children:[a.jsx(Oc,{className:"h-3 w-3"})," Views"]}),a.jsx("p",{className:"text-sm font-semibold text-foreground",children:B.views.toLocaleString()})]}),a.jsxs("div",{children:[a.jsxs("p",{className:"flex items-center justify-center gap-1 text-[11px] text-muted-foreground",children:[a.jsx(yo,{className:"h-3 w-3"})," Subs"]}),a.jsx("p",{className:"text-sm font-semibold text-foreground",children:B.submissions.toLocaleString()})]}),a.jsxs("div",{children:[a.jsxs("p",{className:"flex items-center justify-center gap-1 text-[11px] text-muted-foreground",children:[a.jsx(bk,{className:"h-3 w-3"})," CR"]}),a.jsxs("p",{className:"text-sm font-semibold text-foreground",children:[B.conversionRate,"%"]})]})]}),a.jsxs("div",{className:"mt-4 flex gap-2",children:[r&&a.jsx(Z,{variant:"outline",size:"sm",className:"flex-1",onClick:()=>D(B),children:"Edit"}),a.jsx(Z,{variant:"ghost",size:"sm",className:"flex-1",onClick:()=>S(B),children:"Responses"})]})]},B.id)})})}),a.jsx(Bt,{open:m,onOpenChange:f,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg flex max-h-[92vh] max-w-5xl flex-col overflow-hidden p-0",children:[a.jsxs(Vt,{className:"shrink-0 border-b border-border px-6 py-4",children:[a.jsx(Ut,{children:p?"Edit form":"New form"}),a.jsx(_n,{children:"Add as many short answers, long answers, dropdowns, and checkboxes as you need. The preview on the right updates as you go."})]}),a.jsxs("div",{className:"grid min-h-0 flex-1 grid-cols-1 lg:grid-cols-[1fr_340px]",children:[a.jsxs("div",{className:"space-y-6 overflow-y-auto px-6 py-5",children:[a.jsxs("section",{className:"space-y-3",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"1. Setup"}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:"frmname",children:"Form name"}),a.jsx(gn,{label:"Form name",children:"For your own reference, to find this form in the list. Visitors never see it — they see the headline below."})]}),a.jsx(Oe,{id:"frmname",value:v.name,onChange:B=>b({...v,name:B.target.value}),placeholder:"e.g. Coaching Guide Download",autoFocus:!0})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{children:"Placement"}),a.jsx(gn,{label:"Placement",children:"Where the form lives. A landing page is its own shareable link. Inline and popup are embedded into a site you already run, using the code this page gives you after saving."})]}),a.jsxs(zn,{value:v.type,onValueChange:B=>b({...v,type:B}),children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"Landing page",children:"Landing page — share a standalone form link"}),a.jsx(pt,{value:"Inline",children:"Inline — embed on a site or post"}),a.jsx(pt,{value:"Popup",children:"Popup — overlay on a site"})]})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"headline",children:"Headline"}),a.jsx(Oe,{id:"headline",value:v.headline,onChange:B=>b({...v,headline:B.target.value}),placeholder:"Get the free guide"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"subtext",children:"Details"}),a.jsx(us,{id:"subtext",value:v.subtext,onChange:B=>b({...v,subtext:B.target.value}),placeholder:"A short line about what this form is for.",rows:2})]})]}),a.jsxs("section",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"2. Questions"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Email is always included. Short answer, long answer, dropdown, and checkbox can be added more than once."})]}),a.jsxs("div",{className:"flex items-center gap-2 rounded-lg border border-dashed border-border bg-muted/40 px-3 py-2 text-sm text-muted-foreground",children:[a.jsx(wa,{className:"h-3.5 w-3.5"}),a.jsx(Ii,{className:"h-4 w-4 text-primary"}),a.jsx("span",{className:"font-medium text-foreground",children:"Email"}),a.jsx("span",{className:"ml-auto text-xs",children:"Always required"})]}),a.jsx("div",{className:"space-y-2",children:v.fields.map((B,H)=>{const W=FX[B.type],V=W.Icon;return a.jsxs("div",{className:"space-y-2 rounded-xl border border-border bg-card p-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs("span",{className:"inline-flex items-center gap-1.5 rounded-full bg-muted px-2 py-0.5 text-[11px] font-medium text-muted-foreground",children:[a.jsx(V,{className:"h-3 w-3"})," ",W.label]}),a.jsxs("div",{className:"ml-auto flex items-center gap-0.5",children:[a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",disabled:H===0,onClick:()=>b({...v,fields:Eet(v.fields,H,-1)}),children:a.jsx(M8,{className:"h-4 w-4"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7",disabled:H===v.fields.length-1,onClick:()=>b({...v,fields:Eet(v.fields,H,1)}),children:a.jsx(li,{className:"h-4 w-4"})}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 text-destructive",onClick:()=>b({...v,fields:v.fields.filter((U,ne)=>ne!==H)}),children:a.jsx(qn,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Oe,{value:B.label,onChange:U=>b({...v,fields:l4(v.fields,H,{label:U.target.value})}),placeholder:"Question people will see"}),a.jsxs("label",{className:"flex shrink-0 items-center gap-2 text-xs text-muted-foreground",children:[a.jsx(Hs,{checked:B.required,onCheckedChange:U=>b({...v,fields:l4(v.fields,H,{required:U})})}),"Required"]})]}),B.type==="select"&&a.jsxs("div",{className:"space-y-1.5 rounded-lg bg-muted/40 p-2.5",children:[a.jsx("p",{className:"text-[11px] font-medium text-muted-foreground",children:"Dropdown choices"}),(B.options||[]).map((U,ne)=>a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Oe,{value:U,onChange:te=>{const re=(B.options||[]).map((fe,le)=>le===ne?te.target.value:fe);b({...v,fields:l4(v.fields,H,{options:re})})},placeholder:`Choice ${ne+1}`}),a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-8 w-8",disabled:(B.options||[]).length<=1,onClick:()=>b({...v,fields:l4(v.fields,H,{options:(B.options||[]).filter((te,re)=>re!==ne)})}),children:a.jsx(qn,{className:"h-3.5 w-3.5"})})]},`${B.key}-opt-${ne}`)),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"h-8",onClick:()=>b({...v,fields:l4(v.fields,H,{options:[...B.options||[],`Option ${(B.options||[]).length+1}`]})}),children:[a.jsx(Dn,{className:"mr-1 h-3.5 w-3.5"})," Add choice"]})]})]},B.key)})}),a.jsxs("div",{children:[a.jsx("p",{className:"mb-2 text-xs font-medium text-foreground",children:"Add a question"}),a.jsx("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-4",children:dws.map(B=>{const H=FX[B],W=H.Icon,V=jet.includes(B)&&v.fields.some(U=>U.type===B);return a.jsxs("button",{type:"button",disabled:V,onClick:()=>b({...v,fields:[...v.fields,JIe(B,v.fields)]}),className:"flex flex-col items-start gap-1 rounded-xl border border-border bg-background px-3 py-2.5 text-left transition-colors hover:border-primary/40 hover:bg-primary/5 disabled:cursor-not-allowed disabled:opacity-40",children:[a.jsxs("span",{className:"inline-flex items-center gap-1.5 text-sm font-medium text-foreground",children:[a.jsx(W,{className:"h-3.5 w-3.5 text-primary"})," ",H.label]}),a.jsx("span",{className:"text-[11px] text-muted-foreground",children:V?"Already added":jet.includes(B)?H.hint:"Add again anytime"})]},B)})})]})]}),a.jsxs("section",{className:"space-y-3",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"3. After they submit"}),a.jsxs("div",{className:"grid gap-3 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"btn",children:"Button text"}),a.jsx(Oe,{id:"btn",value:v.buttonText,onChange:B=>b({...v,buttonText:B.target.value})})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"success",children:"Thank-you message"}),a.jsx(Oe,{id:"success",value:v.successMessage,onChange:B=>b({...v,successMessage:B.target.value})})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{children:"What happens next"}),a.jsx(gn,{label:"What happens next",children:"What someone sees the moment they submit. Deliver a file to hand over a guide or freebie in exchange for the sign-up; redirect to send them on to a page of your own."})]}),a.jsxs(zn,{value:v.afterType,onValueChange:B=>b({...v,afterType:B}),children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"message",children:"Show the thank-you message"}),a.jsx(pt,{value:"download",children:"Deliver a file or lead magnet"}),a.jsx(pt,{value:"redirect",children:"Send them to another page"})]})]}),v.afterType==="download"?a.jsx(E6t,{communityId:n,url:v.afterUrl,fileName:v.afterFileName,onChange:({url:B,fileName:H})=>b({...v,afterUrl:B,afterFileName:H})}):v.afterType==="redirect"?a.jsx(Oe,{value:v.afterUrl,onChange:B=>b({...v,afterUrl:B.target.value}),placeholder:"https://yoursite.com/thanks"}):null]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{children:"Also add them to a newsletter"}),a.jsx(gn,{label:"Also add them to a newsletter",children:"Subscribe people to a newsletter as well as capturing them here. They still get a confirmation email and only start receiving issues once they click it, so nobody is added without agreeing."})]}),a.jsxs(zn,{value:v.newsletterId,onValueChange:B=>b({...v,newsletterId:B}),children:[a.jsx(On,{children:a.jsx(Vn,{placeholder:"None"})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:Cae,children:"None — form only"}),h.map(B=>a.jsx(pt,{value:B.id,children:B.title||"Untitled newsletter"},B.id))]})]})]})]})]}),a.jsxs("aside",{className:"overflow-y-auto border-t border-border bg-muted/30 px-5 py-5 lg:border-l lg:border-t-0",children:[a.jsxs("div",{className:"mb-3 flex items-center justify-between gap-2",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-widest text-muted-foreground",children:"Live preview"}),a.jsx("button",{type:"button",className:"text-[11px] font-medium text-primary hover:underline",onClick:()=>N(B=>!B),children:E?"Show form":"Show thank-you"})]}),a.jsx(Vjt,{mode:"preview",type:v.type,headline:v.headline,subtext:v.subtext,buttonText:v.buttonText,fields:v.fields,success:E?{message:v.successMessage,afterSubmit:{type:v.afterType,url:v.afterUrl,fileName:v.afterFileName}}:null})]})]}),a.jsxs(ir,{className:"shrink-0 border-t border-border px-6 py-4",children:[a.jsx(Z,{variant:"ghost",onClick:()=>f(!1),children:"Cancel"}),a.jsxs(Z,{onClick:P,disabled:I,children:[I&&a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}),p?"Save changes":"Create form"]})]})]})}),a.jsx(mws,{form:k,communityId:n,open:!!k,onOpenChange:B=>!B&&S(null)}),a.jsx(Cl,{open:A!==null,onOpenChange:B=>{B||_(null)},title:"Publish this form first?",description:A?`"${A.name}" isn't live yet, so its link and embed won't accept submissions. Publishing makes it collect responses straight away.`:"",confirmLabel:c.isPending?"Publishing…":"Publish & continue",destructive:!1,onConfirm:async()=>{const B=A;if(!B)return;const H=u.find(W=>W.id===B.id)??B;if(H.status==="published"){_(null),w(H);return}try{const W=await c.mutateAsync({formId:B.id});_(null),t({title:"Form published",description:"It can now collect responses."}),w(W??{...B,status:"published"})}catch(W){t({title:"Couldn't publish",description:dn(W,"Please try again."),variant:"destructive"})}}}),a.jsx(Bt,{open:!!x,onOpenChange:B=>!B&&w(null),children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg max-w-lg overflow-hidden",children:[a.jsxs(Vt,{children:[a.jsxs(Ut,{className:"pr-8",children:["Share “",x==null?void 0:x.name,"”"]}),a.jsx(_n,{children:"Share the direct link, or embed the form on your site."})]}),x&&a.jsxs("div",{className:"min-w-0 space-y-4",children:[a.jsxs("div",{className:"min-w-0 space-y-1.5",children:[a.jsx(_e,{children:"Direct link"}),a.jsxs("div",{className:"grid min-w-0 grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-2",children:[a.jsx(Oe,{readOnly:!0,value:T(x.id),className:"min-w-0 overflow-hidden text-ellipsis text-xs"}),a.jsx(Z,{variant:"outline",size:"sm",onClick:()=>{var B;(B=navigator.clipboard)==null||B.writeText(T(x.id)),t({title:"Link copied"})},children:"Copy"}),a.jsx(Z,{variant:"ghost",size:"icon",onClick:()=>window.open(T(x.id),"_blank"),children:a.jsx(bo,{className:"h-4 w-4"})})]})]}),a.jsxs("div",{className:"min-w-0 space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{children:"Embed snippet"}),a.jsx(gn,{label:"Embed snippet",children:"Paste this into your own website's HTML to show the form there. Sign-ups still come back to this community. If you don't run a separate site, use the direct link instead."})]}),a.jsx("pre",{className:"max-w-full overflow-x-auto whitespace-pre-wrap break-all rounded-lg bg-muted p-3 text-xs text-foreground",children:R(x.id)}),a.jsxs(Z,{size:"sm",onClick:()=>{var B;(B=navigator.clipboard)==null||B.writeText(R(x.id)),t({title:"Embed code copied"})},children:[a.jsx($Le,{className:"mr-1.5 h-4 w-4"})," Copy embed code"]})]})]})]})}),a.jsx(Cl,{open:!!C,onOpenChange:B=>!B&&j(null),title:"Delete form?",description:"The form and its public link will stop collecting submissions.",onConfirm:()=>{C&&d.mutate(C,{onSuccess:()=>t({title:"Form deleted"})}),j(null)}})]})}const vws={Newsletter:"217 91% 50%",Promotion:"38 92% 50%",Onboarding:"152 55% 42%",Events:"280 65% 55%",Text:"215 15% 45%"},yws=t=>vws[t??""]??"217 91% 50%";function bws(){const t=Nn(),{community:e}=qe(),{data:n=[],isLoading:r,isError:s,refetch:i}=VAe((e==null?void 0:e.id)??null),{newsletters:o}=Jy(),[l,c]=y.useState(null),[d,u]=y.useState("All"),[h,m]=y.useState(""),f=y.useMemo(()=>["All",...Array.from(new Set(n.map(v=>v.category).filter(Boolean)))],[n]),p=n.filter(v=>d==="All"||v.category===d).filter(v=>v.name.toLowerCase().includes(h.toLowerCase())),g=v=>{if(v.kind==="newsletter"){c(v);return}t(`${ve.emailCampaignCreate}?template=${encodeURIComponent(v.id)}`)};return a.jsxs(it.div,{initial:{opacity:0,y:8},animate:{opacity:1,y:0},className:"mx-auto max-w-6xl space-y-5 lg:p-6",children:[a.jsx(Bm,{title:"Templates",description:"Approved designs for campaigns and newsletter posts.",actions:a.jsxs(a.Fragment,{children:[a.jsx(zS,{}),a.jsxs(Z,{className:"transition-transform active:scale-95",onClick:()=>t(ve.emailCampaignCreate),children:[a.jsx(Dn,{className:"mr-1.5 h-4 w-4"})," Blank campaign"]})]})}),a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[a.jsx("div",{className:"flex flex-wrap gap-1.5",children:f.map(v=>a.jsx("button",{onClick:()=>u(v),className:ee("rounded-full px-3 py-1.5 text-sm transition-colors",d===v?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:bg-accent"),children:v},v))}),a.jsxs("div",{className:"relative w-full sm:w-56",children:[a.jsx(hs,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Oe,{value:h,onChange:v=>m(v.target.value),placeholder:"Search templates…",className:"h-9 pl-9"})]})]}),r?a.jsx("p",{className:"py-16 text-center text-sm text-muted-foreground",children:"Loading templates…"}):s?a.jsxs("div",{role:"alert",className:"py-10 text-center",children:["Could not load templates. ",a.jsx(Z,{variant:"outline",onClick:()=>void i(),children:"Retry"})]}):p.length===0?a.jsx("p",{className:"py-16 text-center text-sm text-muted-foreground",children:"No templates yet. Start a blank campaign, or ask your platform admin to add templates."}):a.jsx(it.div,{layout:!0,className:"grid gap-5 sm:grid-cols-2 lg:grid-cols-3",children:p.map(v=>{const b=yws(v.category);return a.jsxs(it.div,{layout:!0,whileHover:{y:-4},className:"group overflow-hidden rounded-xl border border-border bg-card shadow-card transition-shadow hover:shadow-card-hover",children:[a.jsx("div",{className:"flex h-44 items-center justify-center",style:{background:`hsl(${b} / 0.08)`},children:a.jsxs("div",{className:"w-2/3 space-y-2 rounded-md bg-card p-3 shadow-sm",children:[a.jsx("div",{className:"h-2 w-1/2 rounded",style:{background:`hsl(${b})`}}),a.jsx("div",{className:"h-1.5 w-full rounded bg-muted"}),a.jsx("div",{className:"h-1.5 w-5/6 rounded bg-muted"}),a.jsx("div",{className:"h-16 w-full rounded bg-muted"}),a.jsx("div",{className:"mt-2 h-4 w-16 rounded",style:{background:`hsl(${b})`}})]})}),a.jsxs("div",{className:"p-4",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("h3",{className:"flex items-center gap-1.5 text-sm font-semibold text-foreground",children:[v.name,v.lockedUrls&&a.jsx(wa,{className:"h-3 w-3 text-muted-foreground","aria-label":"Links locked"})]}),a.jsx("span",{className:"rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:v.category})]}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:v.description}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:v.kind==="newsletter"?"Newsletter post":"Campaign"}),a.jsx("div",{className:"mt-3 flex gap-2",children:a.jsx(Z,{size:"sm",className:"flex-1",onClick:()=>g(v),children:"Use template"})})]})]},v.id)})}),a.jsx(Bt,{open:!!l,onOpenChange:v=>!v&&c(null),children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Choose a newsletter"}),a.jsxs(_n,{children:["Start a new post using “",l==null?void 0:l.name,"”. Existing posts will stay unchanged."]})]}),a.jsxs("div",{className:"max-h-64 space-y-2 overflow-y-auto",children:[o.map(v=>a.jsx(Z,{variant:"outline",className:"w-full justify-start",onClick:()=>t(`${ve.newsletterPost(v.id,"new")}?template=${encodeURIComponent(l.id)}`),children:v.title},v.id)),o.length===0&&a.jsx("p",{className:"text-sm text-muted-foreground",children:"Create a newsletter first to use this post template."})]}),a.jsxs(Z,{onClick:()=>t(`${ve.newsletterNew}?template=${encodeURIComponent(l.id)}`),children:[a.jsx(Dn,{className:"mr-1.5 h-4 w-4"})," New newsletter"]})]})})]})}const jb="all",xws=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Tet=64,_et=50;function Jhe(t){const e=new Set;return t.split(/[,;|]/).map(n=>n.trim()).filter(n=>{const r=n.toLowerCase();return!n||e.has(r)?!1:(e.add(r),!0)})}function wws(){const t=new Blob([`name,email,tags
Ada Lovelace,ada@example.com,customers|vip
`],{type:"text/csv"}),e=URL.createObjectURL(t),n=document.createElement("a");n.href=e,n.download="audience-import-template.csv",n.click(),URL.revokeObjectURL(e)}function kws(){var ye,J;const{community:t}=qe(),{toast:e}=yt(),[n,r]=y.useState(1),[s,i]=y.useState(""),[o,l]=y.useState(""),[c,d]=y.useState(jb),[u,h]=y.useState(jb),[m,f]=y.useState(jb),[p,g]=y.useState(null),[v,b]=y.useState(""),x=Lgr((t==null?void 0:t.id)??null),[w,k]=y.useState(!1),[S,C]=y.useState(""),[j,E]=y.useState(""),[N,A]=y.useState(""),[_,T]=y.useState(""),R=Dgr((t==null?void 0:t.id)??null),[O,F]=y.useState(null),[D,I]=y.useState(""),[P,M]=y.useState(""),z=$gr((t==null?void 0:t.id)??null),G=Ogr((t==null?void 0:t.id)??null),B=Fgr((t==null?void 0:t.id)??null),[H,W]=y.useState(""),[V,U]=y.useState(null);y.useEffect(()=>{var ce;const K=(ce=G.data)==null?void 0:ce.optInPromptIntervalDays;W(K==null?"":String(K))},[G.data]),y.useEffect(()=>{const K=setTimeout(()=>l(s.trim()),300);return()=>clearTimeout(K)},[s]),y.useEffect(()=>r(1),[o,c,u,m]);const ne={page:n,limit:25,search:o||void 0,type:c===jb?void 0:c,status:u===jb?void 0:u,source:m===jb?void 0:m},te=Pgr((t==null?void 0:t.id)??null,ne),re=((ye=te.data)==null?void 0:ye.data)??[],fe=((J=te.data)==null?void 0:J.total)??0,le=Math.max(1,Math.ceil(fe/25));async function q(){var K;if(p){U({processed:0,total:null,imported:0});try{const ce=await x.mutateAsync({file:p,tags:Jhe(v),onProgress:U});g(null),e({title:`${ce.imported.toLocaleString()} people imported`,description:[ce.skippedUnsubscribed?`${ce.skippedUnsubscribed} stayed unsubscribed`:"",ce.skippedBlocked?`${ce.skippedBlocked} blocked addresses skipped`:"",ce.skippedMembers?`${ce.skippedMembers} existing members skipped`:"",(K=ce.errors)!=null&&K.length?`${ce.errors.length} rows had an invalid email`:""].filter(Boolean).join(" · ")||void 0})}catch(ce){const pe=(V==null?void 0:V.imported)??0,Ie=dn(ce,"");e({title:"Import stopped",description:Ie||(pe?`${pe.toLocaleString()} were added before it stopped. Re-upload the same file to carry on — nobody is added twice.`:"Check the CSV and try again."),variant:"destructive"})}finally{U(null)}}}function Y(K){k(K),K||(C(""),E(""),A(""),T(""))}async function X(){const K=S.trim(),ce=j.trim();if(!K)return T("Enter a name.");if(!xws.test(ce))return T("Enter a valid email address.");T("");try{const pe=await R.mutateAsync({name:K,email:ce,tags:Jhe(N)});Y(!1),e({title:pe.updated?`${K} was already in your audience`:`${K} was added`,description:pe.updated?"Their name and tags were refreshed.":"They can now receive your campaigns."})}catch(pe){const Ie=dn(pe,"");T(Ie||"That person could not be added. Try again.")}}function Q(K){F(K),I(K?K.tags.join(", "):""),M("")}async function ie(){if(!O)return;const K=Jhe(D),ce=K.find(Ie=>Ie.length>Tet);if(ce)return M(`"${ce.slice(0,20)}…" is too long. A tag can be up to ${Tet} characters.`);if(K.length>_et)return M(`A person can have at most ${_et} tags.`);if(K.join(`
`)===O.tags.join(`
`))return Q(null);M("");const pe=O.name||O.email;try{const Ie=await z.mutateAsync({memberId:O.id,tags:K});Q(null),e({title:`Tags updated for ${pe}`,description:Ie.added.length?`New: ${Ie.added.join(", ")}. Active sequences that start on ${Ie.added.length===1?"this tag":"these tags"} will now run for them.`:void 0})}catch(Ie){M(dn(Ie,"")||"The tags could not be saved. Try again.")}}async function he(){const K=H.trim(),ce=K===""?null:Number(K);if(ce!==null&&(!Number.isFinite(ce)||ce<1||ce>365)){e({title:"Enter between 1 and 365 days",description:"Or leave it empty to ask only once.",variant:"destructive"});return}try{const pe=await B.mutateAsync({optInPromptIntervalDays:ce});e({title:"Saved",description:pe.message})}catch(pe){e({title:"Couldn't save",description:dn(pe,"Please try again."),variant:"destructive"})}}return a.jsxs("div",{className:"space-y-6 lg:p-6",children:[a.jsxs("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-foreground",children:"Audience"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"People who chose to receive email from this community."})]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsx(zS,{className:"h-8 px-3 text-sm"}),a.jsxs(Z,{variant:"outline",size:"sm",onClick:wws,children:[a.jsx(bc,{className:"mr-1.5 h-4 w-4"})," CSV template"]}),a.jsxs(Z,{size:"sm",onClick:()=>Y(!0),children:[a.jsx(Sa,{className:"mr-1.5 h-4 w-4"})," Add person"]})]})]}),a.jsxs("div",{className:"grid gap-3 rounded-xl border border-border bg-card p-4 md:grid-cols-4",children:[a.jsxs("div",{className:"relative md:col-span-1",children:[a.jsx(hs,{className:"absolute left-3 top-2.5 h-4 w-4 text-muted-foreground"}),a.jsx(Oe,{className:"pl-9",value:s,onChange:K=>i(K.target.value),placeholder:"Search name or email"})]}),a.jsxs(zn,{value:c,onValueChange:d,children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:jb,children:"All people"}),a.jsx(pt,{value:"member",children:"Members"}),a.jsx(pt,{value:"outsider",children:"Outsiders"})]})]}),a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsxs(zn,{value:u,onValueChange:h,children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:jb,children:"All statuses"}),a.jsx(pt,{value:"subscribed",children:"Subscribed"}),a.jsx(pt,{value:"pending",children:"Pending confirm"}),a.jsx(pt,{value:"unsubscribed",children:"Unsubscribed"}),a.jsx(pt,{value:"bounced",children:"Bounced"})]})]}),a.jsx(gn,{label:"Status",side:"bottom",children:"Subscribed people receive your email. Pending confirm signed up but haven't clicked the confirmation link yet, so nothing is sent to them. Bounced means the address rejected mail — usually a typo or a closed account. Unsubscribed opted out."})]}),a.jsxs(zn,{value:m,onValueChange:f,children:[a.jsx(On,{children:a.jsx(Vn,{})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:jb,children:"All sign-up sources"}),a.jsx(pt,{value:"joined",children:"Joined community"}),a.jsx(pt,{value:"signup_page",children:"Sign-up page"}),a.jsx(pt,{value:"form",children:"Form"}),a.jsx(pt,{value:"import",children:"Import"}),a.jsx(pt,{value:"admin",children:"Admin"})]})]})]}),a.jsxs("div",{className:"overflow-hidden rounded-xl border border-border bg-card",children:[te.isLoading?a.jsx("p",{className:"p-6 text-sm text-muted-foreground",children:"Loading audience…"}):te.isError?a.jsx("p",{className:"p-6 text-sm text-destructive",children:"The audience could not be loaded."}):re.length===0?a.jsxs("div",{className:"flex flex-col items-center gap-2 p-10 text-center",children:[a.jsx(oI,{className:"h-8 w-8 text-muted-foreground"}),a.jsx("p",{className:"font-medium",children:"No people match these filters"})]}):a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{className:"border-b border-border bg-muted/40 text-left text-xs text-muted-foreground",children:a.jsxs("tr",{children:[a.jsx("th",{className:"px-4 py-3",children:"Name / email"}),a.jsx("th",{className:"px-4 py-3",children:"Type"}),a.jsx("th",{className:"px-4 py-3",children:"Joined via"}),a.jsx("th",{className:"px-4 py-3",children:"Status"}),a.jsx("th",{className:"px-4 py-3",children:"Newsletters"}),a.jsx("th",{className:"px-4 py-3",children:a.jsxs("span",{className:"inline-flex items-center gap-1.5",children:["Tags",a.jsx(gn,{label:"Tags",side:"bottom",children:'Labels you put on a person, such as "customer" or "vip". Use the pencil to add, rename or remove them. A tag that is new to the person starts any active sequence whose trigger is "Tag added" for that tag.'})]})})]})}),a.jsx("tbody",{children:re.map(K=>a.jsxs("tr",{className:"border-b border-border last:border-0",children:[a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("span",{className:"block font-medium text-foreground",children:K.name||K.email}),K.name&&a.jsx("span",{className:"text-xs text-muted-foreground",children:K.email})]}),a.jsx("td",{className:"px-4 py-3",children:K.typeLabel}),a.jsx("td",{className:"px-4 py-3",children:K.sourceLabel}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:K.status==="subscribed"?"text-emerald-600":K.status==="pending"?"text-amber-600":"text-destructive",children:K.statusLabel})}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:K.newsletters.map(ce=>ce.title).join(", ")||"—"}),a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("div",{className:"flex min-w-0 flex-wrap gap-1",children:K.tags.length===0?a.jsx("span",{className:"text-muted-foreground",children:"—"}):K.tags.map(ce=>a.jsx("span",{className:"max-w-[12rem] truncate rounded border border-border bg-muted/40 px-1.5 py-0.5 text-xs text-foreground",title:ce,children:ce},ce))}),a.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0 text-muted-foreground","aria-label":`Edit tags for ${K.name||K.email}`,onClick:()=>Q(K),children:a.jsx(Qs,{className:"h-3.5 w-3.5"})})]})})]},K.id))})]})}),a.jsxs("div",{className:"flex items-center justify-between border-t border-border px-4 py-3 text-sm",children:[a.jsxs("span",{className:"text-muted-foreground",children:[fe.toLocaleString()," people"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Z,{variant:"outline",size:"sm",disabled:n<=1,onClick:()=>r(K=>K-1),children:"Previous"}),a.jsxs("span",{children:[n," / ",le]}),a.jsx(Z,{variant:"outline",size:"sm",disabled:n>=le,onClick:()=>r(K=>K+1),children:"Next"})]})]})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsx("h2",{className:"font-semibold text-foreground",children:"Asking members to opt in"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Members who haven't opted in see a one-line prompt above their feed. It is only ever shown to people who are not already receiving email from you."}),a.jsxs("div",{className:"mt-4 flex flex-wrap items-end gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"audience-ask-interval",children:"Ask again every"}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Oe,{id:"audience-ask-interval",type:"number",min:1,max:365,inputMode:"numeric",className:"w-28",value:H,placeholder:"Never",disabled:G.isLoading,onChange:K=>W(K.target.value)}),a.jsx("span",{className:"text-sm text-muted-foreground",children:"days"})]})]}),a.jsx(Z,{variant:"outline",disabled:B.isPending||G.isLoading,onClick:()=>void he(),children:B.isPending?"Saving…":"Save"})]}),a.jsx("p",{className:"mt-3 text-xs text-muted-foreground",children:H.trim()===""?"Leave this empty to ask each member once, when they join, and never again. This is the default.":`Someone who declines will be asked again after ${H.trim()} day${H.trim()==="1"?"":"s"}, and each time they decline after that.`})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5",children:[a.jsx("h2",{className:"font-semibold text-foreground",children:"Import outsiders"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Imports never add community members and never turn email back on for someone who unsubscribed."}),a.jsxs("div",{className:"mt-4 grid gap-3 md:grid-cols-[1fr_1fr_auto] md:items-end",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"audience-csv",children:"CSV file"}),a.jsx(Oe,{id:"audience-csv",type:"file",accept:".csv,text/csv",onChange:K=>{var ce;return g(((ce=K.target.files)==null?void 0:ce[0])??null)}})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"audience-tags",children:"Tags (optional)"}),a.jsx(Oe,{id:"audience-tags",value:v,onChange:K=>b(K.target.value),placeholder:"customer, vip"})]}),a.jsxs(Z,{disabled:!p||x.isPending,onClick:()=>void q(),children:[a.jsx(kd,{className:"mr-1.5 h-4 w-4"}),x.isPending?"Importing…":"Import"]})]}),x.isPending&&V&&a.jsxs("div",{className:"mt-4 space-y-2",role:"status","aria-live":"polite",children:[a.jsxs("div",{className:"flex items-center justify-between text-xs text-muted-foreground",children:[a.jsx("span",{children:V.processed>0?`${V.processed.toLocaleString()} rows read`:"Reading the file…"}),a.jsxs("span",{children:[V.imported.toLocaleString()," added"]})]}),a.jsx("div",{className:"h-1.5 w-full overflow-hidden rounded-full bg-muted",children:a.jsx("div",{className:ee("h-full rounded-full bg-primary transition-all duration-300",V.total===null&&"w-1/4 animate-pulse"),style:V.total?{width:`${Math.min(100,Math.round(V.processed/V.total*100))}%`}:void 0})}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"The import runs on the server, so you can leave this page — it keeps going. Each batch is saved as it finishes, and re-importing the same file never adds anyone twice."})]})]}),a.jsx(Bt,{open:!!O,onOpenChange:K=>{K||Q(null)},children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg sm:max-w-md",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Edit tags"}),a.jsxs(_n,{children:["Tags for ",(O==null?void 0:O.name)||(O==null?void 0:O.email),". Change, add or delete them here — what you save replaces their current tags."]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:"edit-person-tags",children:"Tags"}),a.jsx(gn,{label:"Editing tags",children:'Separate tags with commas. Adding a tag, or renaming one, counts as a new tag for this person: any active sequence that starts on "Tag added" for it will run for them. Removing a tag, or only changing its capital letters, starts nothing.'})]}),a.jsx(Oe,{id:"edit-person-tags",value:D,onChange:K=>{I(K.target.value),P&&M("")},onKeyDown:K=>{K.key==="Enter"&&ie()},placeholder:"customer, vip","aria-invalid":!!P,autoFocus:!0}),P?a.jsx("p",{className:"text-xs font-medium text-destructive",role:"alert",children:P}):a.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave it empty to remove every tag."})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"outline",onClick:()=>Q(null),children:"Cancel"}),a.jsx(Z,{disabled:z.isPending,onClick:()=>void ie(),children:z.isPending?"Saving…":"Save tags"})]})]})}),a.jsx(Bt,{open:w,onOpenChange:Y,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg sm:max-w-md",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Add a person"}),a.jsx(_n,{children:"Add one contact by hand instead of uploading a CSV. They are added the same way an import adds people, so somebody who unsubscribed cannot be re-subscribed here."})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"add-person-name",children:"Name"}),a.jsx(Oe,{id:"add-person-name",value:S,onChange:K=>C(K.target.value),placeholder:"Ada Lovelace",autoFocus:!0})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"add-person-email",children:"Email"}),a.jsx(Oe,{id:"add-person-email",type:"email",value:j,onChange:K=>E(K.target.value),placeholder:"ada@example.com"})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"add-person-tags",children:"Tags (optional)"}),a.jsx(Oe,{id:"add-person-tags",value:N,onChange:K=>A(K.target.value),placeholder:"customer, vip"})]}),_&&a.jsx("p",{className:"text-xs font-medium text-destructive",role:"alert",children:_})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"outline",onClick:()=>Y(!1),children:"Cancel"}),a.jsx(Z,{disabled:R.isPending,onClick:()=>void X(),children:R.isPending?"Adding…":"Add person"})]})]})})]})}function Sws(){const t=Nn(),{toast:e}=yt(),n=ob(),{newsletters:r,subscribers:s,duplicateNewsletter:i,deleteNewsletter:o}=Jy(),[l,c]=y.useState(""),[d,u]=y.useState(null),h=y.useMemo(()=>r.filter(p=>p.title.toLowerCase().includes(l.toLowerCase())),[r,l]),m=r.find(p=>p.id===d),f=p=>s.filter(g=>g.newsletterId===p&&g.status==="Subscribed").length;return a.jsxs(it.div,{initial:{opacity:0},animate:{opacity:1},className:"mx-auto max-w-6xl space-y-5 lg:p-6",children:[a.jsx(Bm,{title:"Newsletters",description:"Manage your newsletters or create a new one.",actions:a.jsxs(a.Fragment,{children:[a.jsx(zS,{}),a.jsxs(Z,{onClick:()=>t(ve.newsletterNew),className:"transition-transform active:scale-95",children:[a.jsx(Dn,{className:"mr-1.5 h-4 w-4"})," New newsletter"]})]})}),a.jsxs("button",{onClick:()=>e({title:"Manage comments",description:"Moderate comments across your newsletters."}),className:"flex items-center gap-2 text-sm font-medium text-primary hover:underline",children:[a.jsx(Vi,{className:"h-4 w-4"})," Manage comments"]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card shadow-card",children:[a.jsx("div",{className:"border-b border-border p-4",children:a.jsxs("div",{className:"relative w-full",children:[a.jsx(hs,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Oe,{value:l,onChange:p=>c(p.target.value),placeholder:"Search…",className:"h-9 pl-9"})]})}),h.length===0?a.jsx(Df,{icon:vO,title:"No newsletters yet",description:"Create a newsletter to share your knowledge and grow your audience.",action:a.jsxs(Z,{onClick:()=>t(ve.newsletterNew),children:[a.jsx(Dn,{className:"mr-1.5 h-4 w-4"})," New newsletter"]})}):a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border text-left text-xs uppercase tracking-wide text-muted-foreground",children:[a.jsx("th",{className:"px-5 py-3 font-medium",children:"Newsletter"}),a.jsx("th",{className:"px-3 py-3 font-medium",children:"Description"}),a.jsx("th",{className:"px-3 py-3 font-medium text-right",children:"Subscribers"}),a.jsx("th",{className:"px-3 py-3"})]})}),a.jsx("tbody",{children:a.jsx(Al,{initial:!1,children:h.map(p=>a.jsxs(it.tr,{layout:!0,...rL,onClick:()=>t(ve.newsletterDetail(p.id)),className:"cursor-pointer border-b border-border transition-colors hover:bg-muted/60",children:[a.jsx("td",{className:"px-5 py-3",children:a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("span",{className:"flex h-10 w-16 shrink-0 items-center justify-center overflow-hidden rounded-md bg-gradient-to-br from-primary/20 to-accent",children:p.thumbnail?a.jsx("img",{src:p.thumbnail,alt:"",className:"h-full w-full object-cover"}):a.jsx(vO,{className:"h-4 w-4 text-primary"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-medium text-foreground",children:p.title}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:[p.frequency," · ",p.published?"Live":"Unpublished"]})]})]})}),a.jsx("td",{className:"max-w-[280px] px-3 py-3",children:a.jsx("p",{className:"truncate text-muted-foreground",children:p.description||"—"})}),a.jsx("td",{className:"px-3 py-3 text-right tabular-nums text-foreground",children:f(p.id).toLocaleString()}),a.jsx("td",{className:"px-3 py-3 text-right",onClick:g=>g.stopPropagation(),children:a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[a.jsxs(ot,{onClick:()=>t(ve.newsletterDetail(p.id)),children:[a.jsx(Qs,{className:"mr-2 h-4 w-4"})," Manage"]}),a.jsxs(ot,{onClick:()=>window.open(`${window.location.origin}${ve.newsletterSignup(p.id)}`,"_blank","noopener,noreferrer"),children:[a.jsx(bo,{className:"mr-2 h-4 w-4"})," View public page"]}),a.jsxs(ot,{onClick:()=>{var g;(g=navigator.clipboard)==null||g.writeText(`${window.location.origin}${ve.newsletterArchive(p.id)}`),e({title:"Archive link copied",description:p.published?void 0:"The archive is not public until the sign-up page is published."})},children:[a.jsx(eu,{className:"mr-2 h-4 w-4"})," Copy archive link"]}),a.jsxs(ot,{onClick:()=>{i(p.id),e({title:"Newsletter duplicated"})},children:[a.jsx(Zl,{className:"mr-2 h-4 w-4"})," Duplicate"]}),n&&a.jsxs(a.Fragment,{children:[a.jsx(mi,{}),a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>u(p.id),children:[a.jsx(qn,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})]})})]},p.id))})})]})})]}),a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Showing ",h.length," of ",r.length," result",r.length===1?"":"s"]}),a.jsx(Cl,{open:!!d,onOpenChange:p=>!p&&u(null),title:"Delete newsletter?",description:`"${m==null?void 0:m.title}" and all its posts and subscribers will be permanently removed.`,onConfirm:()=>{d&&(o(d),e({title:"Newsletter deleted"})),u(null)}})]})}const XIe=["image/jpeg","image/png","image/webp","image/gif"],Cws=2*1024*1024,N6t=16/9,T6t=1280,fk=500;function jws(t,e){return t.length>fk&&t!==(e??"")}function _6t(t){return XIe.includes(t.type)?t.size>Cws?"Image must be smaller than 2 MB.":null:"Use a JPG, PNG, WebP or GIF image."}function A6t(t){return new Promise((e,n)=>{const r=new FileReader;r.onload=()=>e(String(r.result||"")),r.onerror=()=>n(new Error("Could not read the image")),r.readAsDataURL(t)})}const Ews=NM({title:wl().trim().min(1,"Newsletter title is required."),description:wl().trim().min(1,"Brief description is required.").max(fk,`Keep the description under ${fk} characters.`),thumbnail:wl().optional(),senderName:wl().trim().min(1,"Sender name is required.")});function Nws(){var b;const t=Nn(),[e]=xc(),{toast:n}=yt(),{addNewsletter:r}=Jy(),{community:s}=qe(),i=ggr((s==null?void 0:s.id)??null),o=y.useRef(null),[l,c]=y.useState(""),[d,u]=y.useState(null),h=jM({resolver:EM(Ews),mode:"onChange",defaultValues:{title:"",description:"",thumbnail:"",senderName:lge(null,s==null?void 0:s.name)}}),m=h.watch(),{errors:f}=h.formState;function p(x){if(c(""),!x)return;const w=_6t(x);if(w){c(w);return}u(x)}async function g(x){u(null);try{h.setValue("thumbnail",await A6t(x),{shouldDirty:!0,shouldValidate:!0})}catch{c("Couldn't read the image. Try another one.")}}async function v(x){const w=await r({title:x.title.trim(),description:x.description.trim(),thumbnail:x.thumbnail,senderName:x.senderName.trim()});n({title:"Newsletter created 🎉",description:w.title});const k=e.get("template"),S=new URLSearchParams({tab:"audience",created:"1"});k&&S.set("template",k),t(`${ve.newsletterDetail(w.id)}?${S.toString()}`)}return a.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[a.jsxs("header",{className:"flex items-center justify-between border-b border-border px-5 py-4",children:[a.jsx("h1",{className:"text-lg font-semibold text-foreground",children:"New newsletter"}),a.jsx(Z,{variant:"ghost",size:"icon","aria-label":"Close newsletter creation",onClick:()=>t(ve.newsletter),children:a.jsx(nn,{className:"h-5 w-5"})})]}),a.jsxs("div",{className:"mx-auto grid w-full max-w-7xl flex-1 items-start gap-8 px-4 py-6 sm:px-6 sm:py-8 lg:grid-cols-[minmax(0,0.85fr)_minmax(0,1.15fr)] lg:gap-12 lg:px-8",children:[a.jsxs(it.div,{initial:{opacity:0,x:-8},animate:{opacity:1,x:0},className:"mx-auto min-w-0 w-full max-w-xl space-y-5 rounded-2xl border border-border bg-card p-5 sm:p-6",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-xl font-semibold text-foreground",children:"Newsletter details"}),a.jsx("p",{className:"mt-1 text-sm text-muted-foreground",children:"Add a newsletter to share your knowledge and grow your audience."})]}),a.jsxs("form",{className:"space-y-5",onSubmit:h.handleSubmit(v),children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:"t",children:"Title"}),a.jsx(gn,{label:"Title",children:"The name readers see on the sign-up page and in the archive. Pick something that says what they are subscribing to — it is the first thing they judge before handing over an email address."})]}),a.jsx(Oe,{id:"t",...h.register("title"),placeholder:"Add a title…",autoFocus:!0}),f.title&&a.jsx("p",{className:"text-xs font-medium text-destructive",children:f.title.message})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:"d",children:"Brief description"}),a.jsx(gn,{label:"Brief description",children:"One or two lines on what you will send and how often. Shown on the public sign-up page, where it is the main thing convincing someone to subscribe."})]}),a.jsx(us,{id:"d",rows:4,maxLength:fk,...h.register("description"),placeholder:"What's your newsletter about?"}),a.jsxs("div",{className:"flex items-start justify-between gap-3",children:[f.description?a.jsx("p",{className:"text-xs font-medium text-destructive",children:f.description.message}):a.jsx("span",{}),a.jsxs("p",{className:"shrink-0 text-xs text-muted-foreground","aria-live":"polite",children:[(m.description??"").length,"/",fk]})]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{children:"Thumbnail image (optional)"}),a.jsx(gn,{label:"Thumbnail image",children:"A cover picture for the sign-up page and archive. It does not appear inside the emails you send. After you pick an image you crop it to 16:9, the shape it is shown in, so nothing important gets cut off."})]}),a.jsx("input",{ref:o,type:"file",accept:XIe.join(","),className:"hidden",onChange:x=>{var w;p((w=x.target.files)==null?void 0:w[0]),x.target.value=""}}),a.jsxs("div",{className:"flex flex-wrap items-center gap-4 rounded-xl border border-border p-4",children:[a.jsx("div",{className:"flex aspect-video w-28 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted",children:m.thumbnail?a.jsx("img",{src:m.thumbnail,alt:"",className:"h-full w-full object-cover"}):a.jsx(Jl,{className:"h-6 w-6 text-muted-foreground/60"})}),a.jsxs("div",{className:"min-w-0 flex-1 basis-36 text-sm",children:[a.jsxs("p",{className:"text-muted-foreground",children:["Cropped to 16:9. Recommended ",a.jsx("span",{className:"font-medium text-foreground",children:"1280×720"})]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",className:"mt-2",onClick:()=>{var x;return(x=o.current)==null?void 0:x.click()},children:[a.jsx(Jl,{className:"mr-1.5 h-4 w-4"})," ",m.thumbnail?"Change image":"Select image"]}),l&&a.jsx("p",{className:"mt-1 text-xs font-medium text-destructive",children:l})]})]})]}),a.jsxs("div",{className:"border-t border-border pt-5",children:[a.jsx("p",{className:"text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Sender identity"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"How this newsletter appears in the inbox. Used on every issue."})]}),a.jsxs("div",{className:"grid gap-4 sm:grid-cols-2",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:"sender-name",children:"Sender name"}),a.jsx(gn,{label:"Sender name",children:"The name in the inbox From line. Readers decide whether to open based on whether they recognise it, so use your publication or community name rather than a person's."})]}),a.jsx(Oe,{id:"sender-name",...h.register("senderName"),placeholder:"Your publication name"}),f.senderName&&a.jsx("p",{className:"text-xs font-medium text-destructive",children:f.senderName.message}),a.jsx("p",{className:"text-xs text-muted-foreground",children:'The "From" name readers see.'})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:"sender-email",children:"From email"}),a.jsx(gn,{label:"From email",children:"Set for you and not editable. Email must be sent from a verified address or inboxes treat it as spam. Use Reply-to in settings if replies should reach a different mailbox."})]}),a.jsx(Oe,{id:"sender-email",type:"email",value:((b=i.data)==null?void 0:b.senderEmail)||"",placeholder:"Loading platform sender…",readOnly:!0,disabled:!0}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Managed by SpatialChat and sent from its verified email domain."})]})]}),a.jsx("div",{className:"flex justify-start pt-2",children:a.jsx(Z,{type:"submit",children:"Next"})})]})]}),a.jsxs(it.div,{initial:{opacity:0,x:8},animate:{opacity:1,x:0},className:"mx-auto min-w-0 w-full max-w-xl space-y-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Live preview"}),a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:"Your sign-up page updates as you add your details."})]}),a.jsx(Z_e,{framed:!0,showDecor:!0,title:m.title||"Newsletter title",description:m.description||"Short description that tells what the newsletter is about.",thumbnail:m.thumbnail,children:a.jsx(njt,{})}),a.jsx("p",{className:"mt-3 text-center text-xs text-muted-foreground",children:"Live preview of your sign-up page"})]})]}),a.jsx(Nh,{file:d,aspect:N6t,maxWidth:T6t,title:"Crop thumbnail image",onCancel:()=>u(null),onCropped:x=>void g(x)})]})}function P6t(t,e){return t instanceof ze?Dt(t.body,t.message||e):dn(t,e)}const Tws=8,_ws=4e3,Aws=NM({domain:wl().trim().min(3,"Enter a domain").regex(/^([a-z0-9-]+\.)+[a-z]{2,}$/i,"Enter a valid domain, e.g. mail.yourbrand.com")});function Pws(t){switch(t){case"VERIFIED":return"bg-success/10 text-success border-success/20";case"FAILED":return"bg-destructive/10 text-destructive border-destructive/20";case"DISABLED":return"bg-muted text-muted-foreground border-border";default:return"bg-warning/10 text-warning border-warning/20"}}function Rws(t){return t==="verified"?{cls:"bg-success/10 text-success border-success/20",label:"Verified",Icon:yo}:t==="failed"?{cls:"bg-destructive/10 text-destructive border-destructive/20",label:"Failed",Icon:oh}:t==="temporary_failure"?{cls:"bg-warning/10 text-warning border-warning/20",label:"Retrying",Icon:Bf}:{cls:"bg-warning/10 text-warning border-warning/20",label:"Pending",Icon:ja}}function Aet({value:t}){const{toast:e}=yt();return a.jsx(Z,{type:"button",variant:"ghost",size:"icon",className:"h-7 w-7 shrink-0",onClick:()=>{var n;(n=navigator.clipboard)==null||n.writeText(t),e({title:"Copied"})},"aria-label":"Copy value",children:a.jsx(Zl,{className:"h-3.5 w-3.5"})})}function Iws({communityId:t,canManage:e}){const{toast:n}=yt(),r=avr(t),s=ovr(t),i=lvr(t),l=(r.data??[])[0],[c,d]=y.useState(!1),u=y.useRef(0),h=jM({resolver:EM(Aws),defaultValues:{domain:""}});y.useEffect(()=>{if(!c||!l||i.isPending)return;if(l.status==="VERIFIED"||l.status==="FAILED"||u.current>=Tws){d(!1);return}const p=setTimeout(()=>{u.current+=1,i.mutate(l.id)},_ws);return()=>clearTimeout(p)},[c,l==null?void 0:l.status,l==null?void 0:l.updatedAt,i.isPending]);const m=()=>{l&&(u.current=0,d(!0),i.mutate(l.id,{onError:p=>{d(!1),n({title:"Verification failed",description:p instanceof ze?p.message:"Couldn't reach the provider. Try again.",variant:"destructive"})}}))};if(r.isLoading)return a.jsx(FS,{rows:4,columns:4});if(r.isError)return a.jsx(BS,{onRetry:()=>void r.refetch()});if(!l)return a.jsx("div",{className:"rounded-xl border border-border bg-card p-6 shadow-card",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("div",{className:"rounded-lg bg-primary/10 p-2 text-primary",children:a.jsx(Qd,{className:"h-5 w-5"})}),a.jsxs("div",{className:"flex-1",children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Authenticate your sending domain"}),a.jsxs("p",{className:"mt-1 text-sm text-muted-foreground",children:["Add a domain to send from (e.g. ",a.jsx("span",{className:"font-mono",children:"mail.yourbrand.com"}),"). We'll give you the exact SPF, DKIM and DMARC records to publish, then verify them."]}),e?a.jsxs("form",{className:"mt-4 flex flex-col gap-2 sm:flex-row sm:items-start",onSubmit:h.handleSubmit(p=>s.mutate(p.domain,{onSuccess:()=>{h.reset(),n({title:"Domain added",description:"Publish the DNS records, then verify."})},onError:g=>n({title:"Couldn't add domain",description:g instanceof ze?g.message:"Try again.",variant:"destructive"})})),children:[a.jsxs("div",{className:"flex-1",children:[a.jsx(_e,{htmlFor:"domain",className:"sr-only",children:"Domain"}),a.jsx(Oe,{id:"domain",placeholder:"mail.yourbrand.com",...h.register("domain")}),h.formState.errors.domain&&a.jsx("p",{className:"mt-1 text-xs font-medium text-destructive",children:h.formState.errors.domain.message})]}),a.jsxs(Z,{type:"submit",disabled:s.isPending,children:[s.isPending&&a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}),"Add domain"]})]}):a.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"No sending domain is configured yet."})]})]})});const f=c||i.isPending;return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5 shadow-card",children:[a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx("div",{className:"rounded-lg bg-primary/10 p-2 text-primary",children:a.jsx(Sk,{className:"h-5 w-5"})}),a.jsxs("div",{children:[a.jsx("p",{className:"font-mono text-sm font-medium text-foreground",children:l.domain}),a.jsxs("div",{className:"mt-1 flex items-center gap-2",children:[a.jsx("span",{className:ee("inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium capitalize",Pws(l.status)),children:l.status.toLowerCase()}),l.routingEligible?a.jsx("span",{className:"text-xs text-success",children:"Ready to send"}):l.status!=="PENDING"&&l.ineligibilityReason&&a.jsxs("span",{className:"text-xs text-muted-foreground",children:["Not eligible (",l.ineligibilityReason,")"]})]})]})]}),e&&a.jsxs(Z,{variant:"outline",onClick:m,disabled:f,children:[f?a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}):a.jsx(Nl,{className:"mr-2 h-4 w-4"}),f?"Checking DNS…":"Verify"]})]}),l.lastCheckedAt&&a.jsxs("p",{className:"mt-3 text-xs text-muted-foreground",children:["Last checked ",new Date(l.lastCheckedAt).toLocaleString()]})]}),a.jsxs("div",{className:"overflow-hidden rounded-xl border border-border bg-card shadow-card",children:[a.jsxs("div",{className:"border-b border-border px-5 py-3",children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"DNS records to publish"}),a.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"Add these at your DNS provider, then click Verify. Propagation can take a few minutes."})]}),a.jsx("div",{className:"divide-y divide-border",children:l.requiredDnsRecords.length===0?a.jsx("p",{className:"px-5 py-6 text-center text-sm text-muted-foreground",children:"No DNS records returned by the provider."}):l.requiredDnsRecords.map((p,g)=>{const v=Rws(p.status);return a.jsxs("div",{className:"px-5 py-4",children:[a.jsxs("div",{className:"flex items-center justify-between gap-3",children:[a.jsxs("div",{className:"flex items-center gap-2",children:[p.record&&a.jsx("span",{className:"rounded bg-muted px-1.5 py-0.5 text-xs font-semibold uppercase text-foreground",children:p.record}),a.jsx("span",{className:"rounded border border-border px-1.5 py-0.5 text-xs font-medium text-muted-foreground",children:p.type})]}),a.jsxs("span",{className:ee("inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-xs font-medium",v.cls),children:[a.jsx(v.Icon,{className:"h-3 w-3"})," ",v.label]})]}),a.jsxs("div",{className:"mt-2 grid gap-2 sm:grid-cols-2",children:[a.jsxs("div",{className:"min-w-0",children:[a.jsx("p",{className:"text-xs text-muted-foreground",children:"Name / Host"}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("code",{className:"min-w-0 flex-1 truncate rounded bg-muted px-2 py-1 font-mono text-xs text-foreground",children:p.name}),a.jsx(Aet,{value:p.name})]})]}),a.jsxs("div",{className:"min-w-0",children:[a.jsxs("p",{className:"text-xs text-muted-foreground",children:["Value",p.priority!=null?` · priority ${p.priority}`:""]}),a.jsxs("div",{className:"flex items-center gap-1",children:[a.jsx("code",{className:"min-w-0 flex-1 truncate rounded bg-muted px-2 py-1 font-mono text-xs text-foreground",children:p.value}),a.jsx(Aet,{value:p.value})]})]})]})]},`${p.type}-${p.name}-${g}`)})})]})]})}const Mws=[{key:"overview",label:"Overview",icon:Lrt},{key:"audience",label:"Audience",icon:wr},{key:"engagement",label:"Engagement",icon:iee},{key:"health",label:"Health",icon:LBt,hidden:!0}],Pet=Mws.filter(t=>!("hidden"in t&&t.hidden)),Lws=NM({name:wl().trim().min(1,"Name is required."),email:wl().trim().email("Enter a valid email address.")});function Ret(t){return t?new Date(t).toLocaleDateString("en-GB",{weekday:"short",day:"numeric",month:"short",year:"numeric"}):"—"}function Dws(t){return t&&vd(t)||"—"}function Vq(t){return`${typeof window<"u"?window.location.origin:""}${t}`}const Iet=28*24*60*60*1e3;function Xhe(t,e,n){const r=t?Date.parse(t):NaN;return Number.isFinite(r)&&r>=e&&r<n}function BX(t){return Math.round(t*10)/10}function eme(t){const e=t.reduce((s,i)=>s+(i.delivered||i.recipients||0),0);if(!e)return{delivered:0,openRate:0,clickRate:0};const n=t.reduce((s,i)=>s+(i.openRate||0)/100*(i.delivered||i.recipients||0),0),r=t.reduce((s,i)=>s+(i.clickRate||0)/100*(i.delivered||i.recipients||0),0);return{delivered:e,openRate:BX(n/e*100),clickRate:BX(r/e*100)}}function Met(t,e,n){if(n)return BX(t-e)}function Let({label:t,value:e,hint:n}){const{toast:r}=yt();return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:t}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Oe,{readOnly:!0,value:e,className:"font-mono text-xs"}),a.jsx(Z,{type:"button",variant:"outline",size:"icon",title:"Copy link",onClick:()=>{var s;(s=navigator.clipboard)==null||s.writeText(e),r({title:"Link copied"})},children:a.jsx(Zl,{className:"h-4 w-4"})})]}),n?a.jsx("p",{className:"text-[11px] text-muted-foreground",children:n}):null]})}function $ws(){const{newsletterId:t}=So(),e=Nn(),[n,r]=xc(),s=n.get("template"),{toast:i}=yt(),o=ob(),{newsletters:l,posts:c,subscribers:d,updateNewsletter:u,deleteNewsletter:h,duplicatePost:m,deletePost:f,updatePost:p,addSubscriber:g,unsubscribe:v,removeSubscriber:b}=Jy(),x=l.find(K=>K.id===t),[w,k]=y.useState(()=>Pet.some(K=>K.key===n.get("tab"))?n.get("tab"):"overview"),[S,C]=y.useState(()=>n.get("created")==="1"),[j,E]=y.useState(!1);y.useEffect(()=>{if(!n.has("created")&&!n.has("tab"))return;const K=new URLSearchParams(n);K.delete("created"),K.delete("tab"),r(K,{replace:!0})},[]);const[N,A]=y.useState(!1),[_,T]=y.useState(!1),[R,O]=y.useState(!1),[F,D]=y.useState(null),[I,P]=y.useState(!1),M=K=>()=>{if(x!=null&&x.published){K();return}D(()=>K)},[z,G]=y.useState(!1);if(!x)return a.jsxs("div",{className:"mx-auto max-w-5xl lg:p-6",children:[a.jsx(vr,{to:ve.newsletter,className:"text-sm text-muted-foreground hover:text-foreground",children:"← Newsletters"}),a.jsx("p",{className:"mt-10 text-center text-sm text-muted-foreground",children:"This newsletter no longer exists."})]});const B=c.filter(K=>K.newsletterId===x.id),H=d.filter(K=>K.newsletterId===x.id),W=H.filter(K=>K.status==="Subscribed").length,V=B.filter(K=>K.status==="published"),U=Date.now(),ne=U-Iet,te=U-2*Iet,re=eme(V),fe=eme(V.filter(K=>Xhe(K.publishedAt||K.createdAt,ne,U+1))),le=eme(V.filter(K=>Xhe(K.publishedAt||K.createdAt,te,ne))),q=re.delivered?re.openRate.toFixed(1):"0.0",Y=re.delivered?re.clickRate.toFixed(1):"0.0",X=Met(fe.openRate,le.openRate,le.delivered),Q=Met(fe.clickRate,le.clickRate,le.delivered),ie=H.filter(K=>K.status==="Subscribed"&&Xhe(K.subscribedAt,ne,U+1)).length,he=W-ie,ye=he>0?BX(ie/he*100):void 0,J=re.delivered?"Published issues":"No delivery data yet";return a.jsxs(it.div,{initial:{opacity:0},animate:{opacity:1},className:"mx-auto max-w-6xl space-y-5 lg:p-6",children:[a.jsxs("nav",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[a.jsx(vr,{to:ve.newsletter,className:"hover:text-foreground",children:"Newsletters"}),a.jsx("span",{children:"/"}),a.jsx("span",{className:"text-foreground",children:x.title})]}),a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[a.jsxs("div",{children:[a.jsx("h1",{className:"text-2xl font-semibold tracking-tight text-foreground",children:x.title}),a.jsx("p",{className:"mt-1 max-w-xl text-sm text-muted-foreground",children:x.description})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(Z,{variant:"outline",size:"icon",title:"Preview sign-up page",onClick:M(()=>{window.open(`${window.location.origin}${ve.newsletterSignup(x.id)}`,"_blank","noopener,noreferrer"),i({title:"Opened sign-up page",description:"This is the public subscribe page, not a sent issue."})}),children:a.jsx(Oc,{className:"h-4 w-4"})}),a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{variant:"outline",size:"icon",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[a.jsxs(ot,{onClick:()=>T(!0),children:[a.jsx(w2,{className:"mr-2 h-4 w-4"})," Edit details"]}),a.jsxs(ot,{onClick:()=>O(!0),children:[a.jsx(Qd,{className:"mr-2 h-4 w-4"})," Sign-up page"]}),a.jsxs(ot,{onClick:()=>G(!0),children:[a.jsx(zx,{className:"mr-2 h-4 w-4"})," Welcome email"]}),a.jsxs(ot,{onClick:M(()=>window.open(Vq(ve.newsletterSignup(x.id)),"_blank","noopener,noreferrer")),children:[a.jsx(bo,{className:"mr-2 h-4 w-4"})," View public page"]}),a.jsxs(ot,{onClick:M(()=>{var K;(K=navigator.clipboard)==null||K.writeText(Vq(ve.newsletterArchive(x.id))),i({title:"Archive link copied"})}),children:[a.jsx(eu,{className:"mr-2 h-4 w-4"})," Copy archive link"]}),a.jsxs(ot,{onClick:M(()=>{var K;(K=navigator.clipboard)==null||K.writeText(Vq(ve.newsletterSignup(x.id))),i({title:"Sign-up link copied"})}),children:[a.jsx(Zl,{className:"mr-2 h-4 w-4"})," Copy sign-up link"]}),o&&a.jsxs(a.Fragment,{children:[a.jsx(mi,{}),a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>A(!0),children:[a.jsx(qn,{className:"mr-2 h-4 w-4"})," Delete newsletter"]})]})]})]}),a.jsxs(Z,{onClick:()=>e(s?`${ve.newsletterPost(x.id,"new")}?template=${encodeURIComponent(s)}`:ve.newsletterPost(x.id,"new")),className:"transition-transform active:scale-95",children:[a.jsx(rfe,{className:"mr-1.5 h-4 w-4"})," New post"]})]})]}),a.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-info/30 bg-info/5 px-4 py-2.5 text-sm",children:[a.jsx("span",{className:"text-foreground",children:"Customize the public sign-up page that people see when they join this newsletter."}),a.jsx("button",{type:"button",onClick:()=>O(!0),className:"font-medium text-info hover:underline",children:"Customize page"})]}),a.jsxs("div",{className:"flex items-center justify-between border-b border-border",children:[a.jsx("div",{className:"flex gap-1 overflow-x-auto [scrollbar-width:none] [-ms-overflow-style:none] [&::-webkit-scrollbar]:hidden",children:Pet.map(K=>a.jsxs("button",{onClick:()=>k(K.key),className:ee("relative flex items-center gap-2 whitespace-nowrap px-3 py-2.5 text-sm transition-colors",w===K.key?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[a.jsx(K.icon,{className:"h-4 w-4"})," ",K.label,w===K.key&&a.jsx(it.span,{layoutId:"nlDetailTab",className:"absolute inset-x-0 -bottom-px h-0.5 rounded bg-primary"})]},K.key))}),a.jsx("span",{className:"hidden text-xs text-muted-foreground sm:block",children:"Live from deliveries"})]}),w!=="audience"&&a.jsxs("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-3",children:[a.jsx(sx,{label:"Subscribers",value:W.toLocaleString(),delta:ye,hint:ye!==void 0?"Last 4 weeks":"Active subscribers",icon:wr}),a.jsx(sx,{label:"Open rate",value:`${q}%`,delta:X,hint:J,icon:zx}),a.jsx(sx,{label:"Click rate",value:`${Y}%`,delta:Q,hint:J,icon:bk})]}),w==="overview"&&a.jsx(Ows,{newsletterId:x.id,onNew:()=>e(ve.newsletterPost(x.id,"new")),onOpen:K=>e(ve.newsletterPost(x.id,K)),onDuplicate:K=>m(K),onDelete:f,onPublish:K=>p(K,{status:"published"}),canPublish:o,canDelete:o}),w==="audience"&&a.jsx(Uws,{newsletterId:x.id,subscribers:H,published:x.published,canManageSubscribers:o,onTogglePublished:K=>{u(x.id,{published:K}),i({title:K?"Sign-up page published":"Sign-up page unpublished"})},onManageSignup:()=>O(!0),onAdd:(K,ce)=>g({newsletterId:x.id,name:K,email:ce}),onUnsubscribe:v,onRemove:b}),w==="engagement"&&a.jsx(zws,{newsletterId:x.id,posts:V}),w==="health"&&a.jsx(Vws,{}),a.jsx(Gws,{open:_,onOpenChange:T,newsletter:x,onSave:async K=>{await u(x.id,K),i({title:"Newsletter updated"})}}),a.jsx(Cl,{open:S,onOpenChange:K=>{K||C(!1)},title:"Add people, then publish",description:`"${x.title}" has no subscribers yet. Add community members or import a list below, and publish the sign-up page so visitors can subscribe themselves. Publishing makes the sign-up page and archive public — it does not send anything.`,confirmLabel:j?"Publishing…":"Publish and continue",destructive:!1,onConfirm:async()=>{E(!0);try{await u(x.id,{published:!0}),i({title:"Sign-up page published",description:"Now add people to your audience."}),C(!1)}catch(K){i({title:"Couldn't publish",description:dn(K,"You can publish it from the Audience tab."),variant:"destructive"})}finally{E(!1)}}}),a.jsx(qws,{open:R,onOpenChange:O,newsletter:x,onSave:K=>{u(x.id,K),i({title:"Sign-up page saved"})}}),a.jsx(Cl,{open:F!==null,onOpenChange:K=>{K||D(null)},title:"Publish this newsletter first?",description:`"${x.title}" isn't live yet, so its public pages can't be opened or shared. Publishing makes the sign-up page and archive visible on the web. It does not send anything to subscribers.`,confirmLabel:I?"Publishing…":"Publish",destructive:!1,onConfirm:async()=>{const K=F;P(!0);try{await u(x.id,{published:!0}),D(null),i({title:"Newsletter published",description:"Its sign-up page and archive are live."}),K==null||K()}catch(ce){i({title:"Couldn't publish",description:dn(ce,"Please try again."),variant:"destructive"})}finally{P(!1)}}}),a.jsx(Wws,{open:z,onOpenChange:G,newsletter:x,onSave:K=>{u(x.id,K),i({title:"Welcome email saved"})}}),a.jsx(Cl,{open:N,onOpenChange:A,title:"Delete newsletter?",description:`"${x.title}" and all its posts and subscribers will be permanently removed.`,onConfirm:()=>{h(x.id),i({title:"Newsletter deleted"}),e(ve.newsletter)}})]})}function Ows({newsletterId:t,onNew:e,onOpen:n,onDuplicate:r,onDelete:s,onPublish:i,canPublish:o,canDelete:l}){var j,E,N,A;const{toast:c}=yt(),{community:d}=qe(),[u,h]=y.useState(""),[m,f]=y.useState(1),[p,g]=y.useState("createdAt:desc"),[v,b]=y.useState(null),x=xgr((d==null?void 0:d.id)??null,t,{page:m,limit:10,sort:p,search:u}),w=y.useMemo(()=>{var _;return(((_=x.data)==null?void 0:_.data)??[]).map(m0e)},[(j=x.data)==null?void 0:j.data]),k=((E=x.data)==null?void 0:E.total)??w.length,S=_=>{h(_),f(1)};async function C(_,T){try{await _(),c({title:T})}catch{c({title:"Action failed",description:"Please retry after checking your connection.",variant:"destructive",action:a.jsx(Z,{variant:"secondary",size:"sm",onClick:()=>void C(_,T),children:"Retry"})})}}return a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:["Showing ",w.length," of ",k," post",k===1?"":"s"]}),a.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a.jsxs("div",{className:"relative min-w-[10rem] flex-1 sm:w-56 sm:flex-none",children:[a.jsx(hs,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Oe,{value:u,onChange:_=>S(_.target.value),placeholder:"Search posts…",className:"h-9 pl-9"})]}),a.jsxs(zn,{value:p,onValueChange:_=>{g(_),f(1)},children:[a.jsx(On,{className:"h-9 w-[140px]",children:a.jsx(Vn,{placeholder:"Sort"})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"createdAt:desc",children:"Newest"}),a.jsx(pt,{value:"createdAt:asc",children:"Oldest"}),a.jsx(pt,{value:"title:asc",children:"Title A-Z"}),a.jsx(pt,{value:"title:desc",children:"Title Z-A"})]})]})]})]}),x.isLoading?a.jsx(FS,{rows:5,columns:4}):x.isError?a.jsx(BS,{onRetry:()=>void x.refetch()}):w.length===0?a.jsx(Df,{icon:rfe,title:"No posts yet",description:"Write your first post and send it to your subscribers.",action:a.jsxs(Z,{onClick:e,children:[a.jsx(rfe,{className:"mr-1.5 h-4 w-4"})," New post"]})}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"space-y-2",children:a.jsx(Al,{initial:!1,children:w.map(_=>a.jsxs(it.div,{layout:!0,...rL,className:"group flex items-center justify-between rounded-xl border border-border bg-card p-4 shadow-card transition-shadow hover:shadow-card-hover",children:[a.jsxs("button",{onClick:()=>n(_.id),className:"min-w-0 flex-1 text-left",children:[a.jsx("p",{className:"truncate font-medium text-foreground",children:_.title}),a.jsx("p",{className:"text-xs text-muted-foreground",children:_.status==="published"?`Published ${Ret(_.publishedAt)}`:_.status==="scheduled"?`Scheduled for ${Dws(_.scheduledAt)}`:`Created ${Ret(_.createdAt)}`}),gm(_.sendProgress,_.status)&&a.jsx(sL,{progress:_.sendProgress,status:_.status,className:"mt-2 max-w-xs"})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[_.status==="published"&&!gm(_.sendProgress,_.status)&&a.jsxs("span",{className:"hidden text-right text-xs text-muted-foreground sm:block",children:[a.jsxs("span",{className:"font-medium text-foreground",children:[_.openRate,"%"]})," open"]}),a.jsx(q0,{status:_.status}),a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[a.jsxs(ot,{onClick:()=>n(_.id),children:[a.jsx(Qs,{className:"mr-2 h-4 w-4"})," Edit"]}),a.jsxs(ot,{onClick:()=>{var R;const T=Vq(ve.newsletterPostPublic(t,_.id));(R=navigator.clipboard)==null||R.writeText(T),c({title:"Public post link copied",description:_.status==="published"&&!_.hideFromWeb?void 0:_.hideFromWeb?"This issue is hidden from the web.":"This issue is not live until you publish."})},children:[a.jsx(eu,{className:"mr-2 h-4 w-4"})," Copy public link"]}),o&&_.status!=="published"&&a.jsxs(ot,{onClick:()=>void C(()=>i(_.id),"Sending emails…"),children:[a.jsx(_s,{className:"mr-2 h-4 w-4"})," Publish now"]}),a.jsxs(ot,{onClick:()=>void C(()=>r(_.id),"Post duplicated"),children:[a.jsx(Zl,{className:"mr-2 h-4 w-4"})," Duplicate"]}),l&&a.jsxs(a.Fragment,{children:[a.jsx(mi,{}),a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>b(_.id),children:[a.jsx(qn,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})]})]})]},_.id))})}),a.jsx(US,{page:((N=x.data)==null?void 0:N.page)??m,limit:((A=x.data)==null?void 0:A.limit)??10,total:k,onPageChange:f})]}),a.jsx(Cl,{open:!!v,onOpenChange:_=>!_&&b(null),title:"Delete post?",description:"This post will be permanently removed.",onConfirm:()=>{v&&C(()=>s(v),"Post deleted"),b(null)}})]})}const Fws=`name,email
Rohit,rohit@mailinator.com
Jane Doe,jane@example.com
`;function Bws(){const t=new Blob([Fws],{type:"text/csv;charset=utf-8"}),e=URL.createObjectURL(t),n=document.createElement("a");n.href=e,n.download="newsletter-subscribers-template.csv",n.click(),URL.revokeObjectURL(e)}function Uws({newsletterId:t,subscribers:e,published:n,canManageSubscribers:r,onTogglePublished:s,onManageSignup:i,onAdd:o,onUnsubscribe:l,onRemove:c}){var X,Q,ie,he,ye;const{toast:d}=yt(),{community:u}=qe(),[h,m]=y.useState(""),[f,p]=y.useState(1),[g,v]=y.useState("createdAt:desc"),[b,x]=y.useState("all"),[w,k]=y.useState(!1),[S,C]=y.useState(!1),[j,E]=y.useState(null),[N,A]=y.useState(!1),[_,T]=y.useState(null),[R,O]=y.useState(!1),[F,D]=y.useState(null),[I,P]=y.useState(!1),M=_gr((u==null?void 0:u.id)??null,t),z=Agr((u==null?void 0:u.id)??null,t),G=zNt((u==null?void 0:u.id)??null),B=Egr((u==null?void 0:u.id)??null),H=Ngr((u==null?void 0:u.id)??null,t),W=Tgr((u==null?void 0:u.id)??null,t),V=jM({resolver:EM(Lws),mode:"onChange",defaultValues:{name:"",email:""}}),U=tHe((u==null?void 0:u.id)??null,t,{page:f,limit:10,sort:g,search:h,status:b==="all"?void 0:b}),ne=tHe((u==null?void 0:u.id)??null,t,{page:1,limit:1,status:"pending"}),te=y.useMemo(()=>{var J;return(((J=U.data)==null?void 0:J.data)??[]).map(WNt)},[(X=U.data)==null?void 0:X.data]),re=((Q=U.data)==null?void 0:Q.total)??te.length,fe=te.filter(J=>J.status==="Subscribed").length,le=((ie=ne.data)==null?void 0:ie.total)??0,q=J=>{m(J),p(1)};async function Y(J,K){try{return await J(),d({title:K}),!0}catch(ce){return d({title:"Action failed",description:P6t(ce,"Please retry after checking your connection."),variant:"destructive",action:a.jsx(Z,{variant:"secondary",size:"sm",onClick:()=>void Y(J,K),children:"Retry"})}),!1}}return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between rounded-xl border border-border bg-card p-4 shadow-card",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Sign-up page"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:n?"Live — people can subscribe. They stay Pending until they confirm the email we send them. Publishing this page does not send a newsletter issue.":"Unpublished — not visible"})]}),a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(Z,{variant:"outline",size:"sm",onClick:i,children:"Manage"}),r&&a.jsx(Hs,{checked:n,onCheckedChange:s})]})]}),a.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 shadow-card",children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Members are added when they opt in"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Anyone who joins this community and chooses to receive its emails is subscribed to this newsletter automatically."})]}),r&&le>0&&a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3 rounded-xl border border-warning/30 bg-warning/5 p-4",children:[a.jsxs("div",{children:[a.jsxs("p",{className:"text-sm font-medium text-foreground",children:[le.toLocaleString()," pending ",le===1?"subscriber":"subscribers"]}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"They will not receive published posts until they confirm. Confirm them now, or resend the confirmation email."})]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>P(!0),disabled:W.isPending||H.isPending,children:[W.isPending?a.jsx(Ne,{className:"mr-1.5 h-4 w-4 animate-spin"}):a.jsx(gO,{className:"mr-1.5 h-4 w-4"}),"Resend emails"]}),a.jsxs(Z,{size:"sm",onClick:()=>O(!0),disabled:W.isPending||H.isPending,children:[H.isPending?a.jsx(Ne,{className:"mr-1.5 h-4 w-4 animate-spin"}):a.jsx(vk,{className:"mr-1.5 h-4 w-4"}),"Confirm all"]})]})]}),a.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[a.jsxs("p",{className:"text-sm text-muted-foreground",children:[a.jsx("span",{className:"font-semibold text-foreground",children:fe.toLocaleString()})," active on this page · ",re.toLocaleString()," total",le>0?` · ${le.toLocaleString()} pending`:""]}),a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center justify-end gap-2",children:[a.jsxs("div",{className:"relative w-full min-w-[10rem] flex-1 sm:w-56 sm:flex-none",children:[a.jsx(hs,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Oe,{value:h,onChange:J=>q(J.target.value),placeholder:"Search subscribers…",className:"h-9 pl-9"})]}),a.jsxs(zn,{value:b,onValueChange:J=>{x(J),p(1)},children:[a.jsx(On,{className:"h-9 w-[150px]",children:a.jsx(Vn,{placeholder:"Status"})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:"all",children:"All statuses"}),a.jsx(pt,{value:"pending",children:"Pending"}),a.jsx(pt,{value:"Subscribed",children:"Subscribed"}),a.jsx(pt,{value:"Unsubscribed",children:"Unsubscribed"})]})]}),a.jsxs(zn,{value:g,onValueChange:J=>{v(J),p(1)},children:[a.jsx(On,{className:"h-9 w-[160px]",children:a.jsx(Vn,{placeholder:"Sort"})}),a.jsxs(Fn,{children:[a.jsxs(n0e,{children:[a.jsx(LZ,{children:"Date"}),a.jsx(pt,{value:"createdAt:desc",children:"Newest"}),a.jsx(pt,{value:"createdAt:asc",children:"Oldest"})]}),a.jsxs(n0e,{children:[a.jsx(LZ,{children:"Email"}),a.jsx(pt,{value:"email:asc",children:"Email A-Z"}),a.jsx(pt,{value:"email:desc",children:"Email Z-A"})]})]})]}),a.jsxs(Z,{variant:"outline",className:"shrink-0",onClick:()=>{E(null),C(!0)},children:[a.jsx(kd,{className:"mr-1.5 h-4 w-4"})," Import"]}),a.jsxs(Z,{variant:"outline",className:"shrink-0",onClick:()=>A(!0),children:[a.jsx(wr,{className:"mr-1.5 h-4 w-4"})," Add community members"]}),a.jsxs(Z,{className:"shrink-0",onClick:()=>k(!0),children:[a.jsx(Dn,{className:"mr-1.5 h-4 w-4"})," Add"]})]})]}),a.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card shadow-card",children:U.isLoading?a.jsx(FS,{rows:6,columns:5}):U.isError?a.jsx("div",{className:"p-4",children:a.jsx(BS,{onRetry:()=>void U.refetch()})}):te.length===0?a.jsx(Df,{icon:wr,title:b==="all"?"No subscribers found":`No ${b==="pending"?"pending":b.toLowerCase()} subscribers`,description:b==="all"?"Try a different search or add the first subscriber manually.":"Try a different status filter or search.",action:b==="all"?a.jsxs(Z,{onClick:()=>k(!0),children:[a.jsx(Dn,{className:"mr-1.5 h-4 w-4"})," Add"]}):void 0}):a.jsxs(a.Fragment,{children:[a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border text-left text-xs uppercase tracking-wide text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-3 font-medium",children:"Subscriber"}),a.jsx("th",{className:"px-3 py-3 font-medium",children:"Source"}),a.jsx("th",{className:"px-3 py-3 font-medium",children:"Joined"}),a.jsx("th",{className:"px-3 py-3 font-medium text-right",children:"Status"}),a.jsx("th",{className:"px-3 py-3"})]})}),a.jsx("tbody",{children:a.jsx(Al,{initial:!1,children:te.map(J=>a.jsxs(it.tr,{layout:!0,...rL,className:"border-b border-border transition-colors hover:bg-muted/60",children:[a.jsxs("td",{className:"px-4 py-3",children:[a.jsx("p",{className:"font-medium text-foreground",children:J.name}),a.jsx("p",{className:"text-xs text-muted-foreground",children:J.email})]}),a.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:J.source}),a.jsx("td",{className:"px-3 py-3 text-muted-foreground",children:new Date(J.subscribedAt).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}),a.jsx("td",{className:"px-3 py-3 text-right",children:a.jsx(wus,{status:J.status,reason:J.unsubscribeReason,at:J.unsubscribedAt})}),a.jsx("td",{className:"px-3 py-3 text-right",children:a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-8 w-8",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[r&&J.status==="pending"&&a.jsxs(a.Fragment,{children:[a.jsxs(ot,{onClick:()=>D({id:J.id,email:J.email}),children:[a.jsx(vk,{className:"mr-2 h-4 w-4"})," Confirm now"]}),a.jsxs(ot,{onClick:()=>void Y(async()=>{const K=await B.mutateAsync(J.id);if(K.sent===!1)throw new Error(K.message||"Could not send")},"Confirmation email sent"),children:[a.jsx(gO,{className:"mr-2 h-4 w-4"})," Resend confirmation"]})]}),r&&J.status==="Subscribed"&&a.jsxs(ot,{onClick:()=>void Y(()=>l(J.id),"Unsubscribed"),children:[a.jsx(O8,{className:"mr-2 h-4 w-4"})," Unsubscribe"]}),r&&a.jsxs(a.Fragment,{children:[a.jsx(mi,{}),a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>T(J.id),children:[a.jsx(qn,{className:"mr-2 h-4 w-4"})," Remove"]})]})]})]})})]},J.id))})})]}),a.jsx(US,{page:((he=U.data)==null?void 0:he.page)??f,limit:((ye=U.data)==null?void 0:ye.limit)??10,total:re,onPageChange:p})]})}),a.jsx(Bt,{open:w,onOpenChange:J=>{k(J),J&&V.reset()},children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg",children:[a.jsx(Vt,{children:a.jsx(Ut,{children:"Add subscriber"})}),a.jsxs("form",{className:"space-y-3",onSubmit:V.handleSubmit(async J=>{await Y(()=>o(J.name.trim(),J.email.trim()),"Subscriber added")&&(V.reset(),k(!1))}),children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"sn",children:"Name"}),a.jsx(Oe,{id:"sn",...V.register("name"),placeholder:"Full name",autoFocus:!0}),V.formState.errors.name&&a.jsx("p",{className:"text-xs font-medium text-destructive",children:V.formState.errors.name.message})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"se",children:"Email"}),a.jsx(Oe,{id:"se",type:"email",...V.register("email"),placeholder:"name@club.com"}),V.formState.errors.email&&a.jsx("p",{className:"text-xs font-medium text-destructive",children:V.formState.errors.email.message})]}),a.jsxs(ir,{children:[a.jsx(Z,{type:"button",variant:"ghost",onClick:()=>k(!1),children:"Cancel"}),a.jsx(Z,{type:"submit",children:"Add"})]})]})]})}),a.jsx(Cl,{open:!!_,onOpenChange:J=>!J&&T(null),title:"Remove subscriber?",description:"They will be removed from this newsletter.",onConfirm:()=>{_&&Y(()=>c(_),"Subscriber removed"),T(null)}}),a.jsx(Bt,{open:S,onOpenChange:J=>{C(J),J||E(null)},children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Import subscribers"}),a.jsx(_n,{children:"Upload a CSV with name and email columns. Existing emails on this list are updated."})]}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{className:"rounded-lg border border-border bg-muted/40 px-3 py-2 text-xs text-muted-foreground",children:[a.jsx("p",{className:"font-medium text-foreground",children:"CSV format"}),a.jsx("p",{className:"mt-1 font-mono",children:"name,email"}),a.jsx("p",{className:"font-mono",children:"Rohit,rohit@mailinator.com"})]}),a.jsxs(Z,{type:"button",variant:"outline",size:"sm",onClick:Bws,children:[a.jsx(bc,{className:"mr-1.5 h-4 w-4"})," Download CSV template"]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"subscriber-csv",children:"CSV file"}),a.jsx(Oe,{id:"subscriber-csv",type:"file",accept:".csv,text/csv",onChange:J=>{var K;return E(((K=J.target.files)==null?void 0:K[0])??null)}}),j&&a.jsx("p",{className:"text-xs text-muted-foreground",children:j.name})]})]}),a.jsxs(ir,{children:[a.jsx(Z,{type:"button",variant:"ghost",onClick:()=>C(!1),children:"Cancel"}),a.jsxs(Z,{disabled:!j||M.isPending,onClick:()=>{j&&(async()=>{try{const J=await M.mutateAsync(j);C(!1),E(null),d({title:`${J.imported} subscriber${J.imported===1?"":"s"} imported`,description:J.skipped?`${J.skipped} row${J.skipped===1?"":"s"} skipped.`:void 0})}catch(J){d({title:"Couldn't import CSV",description:J instanceof ze?J.message:"Check the file and try again.",variant:"destructive"})}})()},children:[M.isPending&&a.jsx(Ne,{className:"mr-2 h-4 w-4 animate-spin"}),"Import"]})]})]})}),a.jsx(Cl,{open:N,onOpenChange:A,title:"Add everyone in this community?",description:"People who already unsubscribed from this newsletter are skipped. Members without an email are skipped.",confirmLabel:z.isPending?"Adding…":"Add members",destructive:!1,onConfirm:()=>{(async()=>{try{const J=await z.mutateAsync(void 0);A(!1),d({title:`${J.imported} member${J.imported===1?"":"s"} added`,description:J.skipped?`${J.skipped} skipped (no email or already unsubscribed).`:void 0})}catch(J){d({title:"Couldn't add members",description:J instanceof ze?J.message:"Try again.",variant:"destructive"})}})()}}),a.jsx(Cl,{open:!!F,onOpenChange:J=>!J&&D(null),title:"Attest consent and confirm subscriber?",description:`By continuing, you attest that ${(F==null?void 0:F.email)??"this person"} consented to receive email. They will be marked Subscribed and start receiving published posts.`,confirmLabel:"I attest and confirm",destructive:!1,onConfirm:()=>{if(F){const J=F.id;Y(()=>G.mutateAsync({subscriberId:J,body:{status:"Subscribed",consentAttested:!0}}),"Subscription confirmed")}D(null)}}),a.jsx(Cl,{open:R,onOpenChange:O,title:"Attest consent and confirm subscribers?",description:`By continuing, you attest that all ${le.toLocaleString()} pending ${le===1?"subscriber has":"subscribers have"} consented to receive email. They will be marked Subscribed and start receiving published posts.`,confirmLabel:H.isPending?"Confirming…":"I attest and confirm all",destructive:!1,onConfirm:()=>{(async()=>{try{const J=await H.mutateAsync();O(!1),d({title:`${J.confirmed} ${J.confirmed===1?"subscriber":"subscribers"} confirmed`})}catch(J){d({title:"Couldn't confirm pending subscribers",description:J instanceof ze?J.message:"Try again.",variant:"destructive"})}})()}}),a.jsx(Cl,{open:I,onOpenChange:P,title:"Resend confirmation emails?",description:`We'll email all ${le.toLocaleString()} pending ${le===1?"subscriber":"subscribers"} in batches.`,confirmLabel:W.isPending?"Sending…":"Resend emails",destructive:!1,onConfirm:()=>{(async()=>{try{const J=await W.mutateAsync();P(!1),d({title:`${J.sent} confirmation ${J.sent===1?"email":"emails"} sent`,description:J.failed?`${J.failed} failed to send.`:void 0,variant:J.failed&&!J.sent?"destructive":void 0})}catch(J){d({title:"Couldn't resend confirmation emails",description:J instanceof ze?J.message:"Try again.",variant:"destructive"})}})()}})]})}function zws({newsletterId:t,posts:e}){const{community:n}=qe(),r=[...e].sort((c,d)=>{const u=c.publishedAt?Date.parse(c.publishedAt):Date.parse(c.createdAt),h=d.publishedAt?Date.parse(d.publishedAt):Date.parse(d.createdAt);return(Number.isFinite(h)?h:0)-(Number.isFinite(u)?u:0)}),[s,i]=y.useState({}),o=$fe({queries:r.map(c=>({queryKey:Er.postReport((n==null?void 0:n.id)??null,t,c.id),queryFn:()=>vlr(n.id,t,c.id),enabled:!!(n!=null&&n.id&&t&&c.id),refetchInterval:d=>{var h,m;const u=(h=d.state.data)==null?void 0:h.sendProgress;return u&&u.queued>0?4e3:LNt(((m=d.state.data)==null?void 0:m.publishedAt)??c.publishedAt)}}))});if(e.length===0)return a.jsx(Df,{icon:iee,title:"No engagement data yet",description:"Publish a post to start seeing open and click performance."});const l=[...r].slice(0,12).reverse().map(c=>{var d;return{name:((d=c.title)==null?void 0:d.length)>16?`${c.title.slice(0,16)}…`:c.title,Open:Number(c.openRate)||0,Click:Number(c.clickRate)||0}});return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"rounded-xl border border-border bg-card p-5 shadow-card",children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Open & click rate by issue"}),a.jsx("div",{className:"mt-4 h-64",children:a.jsx(QM,{width:"100%",height:"100%",children:a.jsxs(A3t,{data:l,margin:{top:4,right:8,left:-18,bottom:0},children:[a.jsx(tL,{strokeDasharray:"3 3",stroke:"hsl(var(--border))",vertical:!1}),a.jsx(rb,{dataKey:"name",tick:{fontSize:11},stroke:"hsl(var(--muted-foreground))",interval:0,angle:-18,textAnchor:"end",height:54}),a.jsx(Ug,{tick:{fontSize:11},stroke:"hsl(var(--muted-foreground))",unit:"%"}),a.jsx(bu,{formatter:c=>`${c}%`,contentStyle:{fontSize:12,borderRadius:8,border:"1px solid hsl(var(--border))"}}),a.jsx(o2,{wrapperStyle:{fontSize:12}}),a.jsx(Bg,{dataKey:"Open",fill:"hsl(var(--primary))",radius:[3,3,0,0]}),a.jsx(Bg,{dataKey:"Click",fill:"hsl(var(--info))",radius:[3,3,0,0]})]})})})]}),a.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card shadow-card",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border text-left text-xs uppercase tracking-wide text-muted-foreground",children:[a.jsx("th",{className:"px-5 py-3 font-medium",children:"Post"}),a.jsx("th",{className:"px-3 py-3 font-medium text-right",children:"Recipients"}),a.jsx("th",{className:"px-3 py-3 font-medium text-right",children:"Open rate"}),a.jsx("th",{className:"px-3 py-3 font-medium text-right",children:"Click rate"})]})}),a.jsx("tbody",{className:"divide-y divide-border",children:r.map(c=>a.jsxs("tr",{className:"hover:bg-muted/60",children:[a.jsx("td",{className:"px-5 py-3 font-medium text-foreground",children:c.title}),a.jsx("td",{className:"px-3 py-3 text-right tabular-nums text-muted-foreground",children:(c.recipients||0).toLocaleString()}),a.jsxs("td",{className:"px-3 py-3 text-right tabular-nums text-foreground",children:[(Number(c.openRate)||0).toFixed(1),"%"]}),a.jsxs("td",{className:"px-3 py-3 text-right tabular-nums text-foreground",children:[(Number(c.clickRate)||0).toFixed(1),"%"]})]},c.id))})]})}),a.jsxs("div",{className:"space-y-3",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"Who opened and clicked"}),a.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"Recipients for each published issue — who opened, who didn’t, who clicked which link, and who didn’t click."})]}),r.map((c,d)=>{var h,m,f,p,g;const u=o[d];return a.jsxs("details",{open:d===0,onToggle:v=>{const{open:b}=v.currentTarget;i(x=>({...x,[c.id]:b}))},className:"rounded-xl border border-border bg-card shadow-card",children:[a.jsxs("summary",{className:"flex cursor-pointer list-none items-center justify-between gap-3 px-5 py-4 [&::-webkit-details-marker]:hidden",children:[a.jsxs("span",{className:"min-w-0",children:[a.jsx("span",{className:"block truncate text-sm font-semibold text-foreground",children:c.title}),a.jsxs("span",{className:"mt-0.5 block text-xs text-muted-foreground",children:[(c.recipients||0).toLocaleString()," recipients · ",(Number(c.openRate)||0).toFixed(1),"% open · ",(Number(c.clickRate)||0).toFixed(1),"% click"]}),a.jsx(sL,{progress:((h=u==null?void 0:u.data)==null?void 0:h.sendProgress)??c.sendProgress,status:c.status,className:"mt-2 max-w-xs"})]}),a.jsx("span",{className:"shrink-0 text-xs text-muted-foreground",children:"Show lists"})]}),a.jsxs("div",{className:"border-t border-border px-5 py-4",children:[u!=null&&u.isLoading?a.jsxs("p",{className:"flex items-center gap-2 py-6 text-sm text-muted-foreground",children:[a.jsx(Ne,{className:"h-4 w-4 animate-spin"})," Loading recipients…"]}):u!=null&&u.isError?a.jsx("p",{className:"py-6 text-sm text-muted-foreground",children:"Couldn’t load recipient lists for this issue. Refresh and try again."}):a.jsx(S6t,{engagement:(m=u==null?void 0:u.data)==null?void 0:m.engagement,noun:"issue"}),(s[c.id]??d===0)&&a.jsxs("div",{className:"mt-6 space-y-6",children:[a.jsx(j6t,{rows:(f=u==null?void 0:u.data)==null?void 0:f.notSent,counts:(p=u==null?void 0:u.data)==null?void 0:p.notSentCounts,noun:"issue"}),a.jsx(C6t,{source:{newsletterId:t,postId:c.id},noun:"issue",skipped:(g=u==null?void 0:u.data)==null?void 0:g.notSent})]})]})]},c.id)})]})]})}function Vws(){const{community:t}=qe(),e=ob();return a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{children:[a.jsx("h2",{className:"text-sm font-semibold text-foreground",children:"Sender domain authentication"}),a.jsx("p",{className:"mt-0.5 text-sm text-muted-foreground",children:"Authenticate your domain (SPF, DKIM, DMARC) so your emails reach the inbox."})]}),a.jsx(Iws,{communityId:(t==null?void 0:t.id)??null,canManage:e})]})}const Hws=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function R6t({value:t,onChange:e}){const n=y.useRef(null),[r,s]=y.useState(""),[i,o]=y.useState(null),l=d=>{if(s(""),!d)return;const u=_6t(d);u?s(u):o(d)},c=async d=>{o(null);try{e(await A6t(d))}catch{s("Couldn't read the image. Try another one.")}};return a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Banner image"}),a.jsx("input",{ref:n,type:"file",accept:XIe.join(","),className:"hidden",onChange:d=>{var u;l((u=d.target.files)==null?void 0:u[0]),d.target.value=""}}),a.jsxs("div",{className:"flex items-center gap-4 rounded-xl border border-border p-3",children:[a.jsx("div",{className:"flex aspect-video w-28 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted",children:t?a.jsx("img",{src:t,alt:"",className:"h-full w-full object-cover"}):a.jsx(Jl,{className:"h-5 w-5 text-muted-foreground/60"})}),a.jsxs("div",{className:"min-w-0 text-sm",children:[a.jsxs("p",{className:"text-muted-foreground",children:["Shown on the public sign-up page, cropped to 16:9. ",a.jsx("span",{className:"font-medium text-foreground",children:"1280×720"})]}),a.jsxs("div",{className:"mt-2 flex flex-wrap gap-2",children:[a.jsxs(Z,{type:"button",variant:"outline",size:"sm",onClick:()=>{var d;return(d=n.current)==null?void 0:d.click()},children:[a.jsx(Jl,{className:"mr-1.5 h-4 w-4"})," ",t?"Replace image":"Select image"]}),t?a.jsx(Z,{type:"button",variant:"ghost",size:"sm",onClick:()=>e(""),children:"Remove"}):null]}),r&&a.jsx("p",{className:"mt-1 text-xs font-medium text-destructive",children:r})]})]}),a.jsx(Nh,{file:i,aspect:N6t,maxWidth:T6t,title:"Crop banner image",onCancel:()=>o(null),onCropped:d=>void c(d)})]})}function Gws({open:t,onOpenChange:e,newsletter:n,onSave:r}){const[s,i]=y.useState(n),[o,l]=y.useState(!1),[c,d]=y.useState(""),u=y.useRef(!1);y.useEffect(()=>{t&&!u.current&&(i(n),d("")),u.current=t},[t,n]);const h=s.replyTo.trim()&&!Hws.test(s.replyTo.trim())?"Enter a valid email address.":"",m=jws(s.description,n.description),f=!!s.title.trim()&&!h&&!m;return a.jsx(Bt,{open:t,onOpenChange:p=>{e(p),p&&i(n)},children:a.jsxs(Ft,{className:"max-h-[calc(100dvh-2rem)] w-[calc(100vw-2rem)] max-w-lg grid-rows-[auto_minmax(0,1fr)_auto] gap-0 overflow-hidden p-0",children:[a.jsx(Vt,{className:"shrink-0 border-b border-border px-6 py-5 pr-12",children:a.jsx(Ut,{children:"Newsletter settings"})}),a.jsxs("div",{className:"themed-scrollbar min-h-0 space-y-3 overflow-y-auto overscroll-contain px-6 py-5",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Title"}),a.jsx(Oe,{value:s.title,onChange:p=>i({...s,title:p.target.value})})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Description"}),a.jsx(us,{rows:2,maxLength:Math.max(fk,s.description.length),value:s.description,onChange:p=>i({...s,description:p.target.value})}),a.jsxs("p",{className:ee("text-right text-xs",m?"font-medium text-destructive":"text-muted-foreground"),"aria-live":"polite",children:[m?`Keep the description under ${fk} characters · `:"",s.description.length,"/",fk]})]}),a.jsx(R6t,{value:s.thumbnail,onChange:p=>i({...s,thumbnail:p})}),a.jsx("p",{className:"pt-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Sender identity"}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Sender name"}),a.jsx(Oe,{value:s.senderName,onChange:p=>i({...s,senderName:p.target.value})}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Shown as the sender on every issue. Defaults to your community name."})]}),a.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"From email"}),a.jsx(Oe,{type:"email",value:n.senderEmail,readOnly:!0,disabled:!0}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Managed by SpatialChat and sent from its verified email domain."}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Use an address on a verified sender domain."})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs(_e,{children:["Reply-to ",a.jsx("span",{className:"font-normal text-muted-foreground",children:"(optional)"})]}),a.jsx(Oe,{type:"email",value:s.replyTo,onChange:p=>i({...s,replyTo:p.target.value}),placeholder:"hello@yourbrand.com"}),h&&a.jsx("p",{className:"text-xs font-medium text-destructive",children:h}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Leave blank unless replies should go to another inbox."})]})]}),a.jsx("p",{className:"pt-1 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Compliance"}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Physical mailing address"}),a.jsx(us,{rows:2,value:s.address,onChange:p=>i({...s,address:p.target.value}),placeholder:"Your Brand, 1 Example St, City, Country"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Shown in the email footer to comply with anti-spam law (CAN-SPAM)."})]})]}),a.jsxs(ir,{className:"shrink-0 border-t border-border bg-background px-6 py-4",children:[a.jsx(Z,{variant:"ghost",disabled:o,onClick:()=>e(!1),children:"Cancel"}),a.jsx(Z,{disabled:!f||o,onClick:async()=>{l(!0),d("");try{await r({title:s.title,description:s.description,thumbnail:s.thumbnail,senderName:s.senderName,replyTo:s.replyTo.trim(),address:s.address}),e(!1)}catch(p){d(P6t(p,"Couldn't update the newsletter"))}finally{l(!1)}},children:o?"Saving…":"Save changes"}),c?a.jsx("p",{className:"text-xs font-medium text-destructive sm:mr-auto",children:c}):null]})]})})}function Wws({open:t,onOpenChange:e,newsletter:n,onSave:r}){const s=n.welcomeEmail??{enabled:!1,subject:"",html:""},[i,o]=y.useState(s.enabled),[l,c]=y.useState(s.subject),[d,u]=y.useState(s.html);return y.useEffect(()=>{if(!t)return;const h=n.welcomeEmail??{enabled:!1,subject:"",html:""};o(h.enabled),c(h.subject),u(h.html)},[t,n.welcomeEmail]),a.jsx(Bt,{open:t,onOpenChange:e,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Welcome email"}),a.jsx(_n,{children:"Sent automatically once, the moment a subscriber confirms their subscription."})]}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-border p-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm font-medium text-foreground",children:"Send a welcome email"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Greet new subscribers automatically."})]}),a.jsx(Hs,{checked:i,onCheckedChange:o})]}),a.jsxs("div",{className:ee("space-y-3 transition-opacity",!i&&"opacity-50"),children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Subject"}),a.jsx(Oe,{value:l,onChange:h=>c(h.target.value),placeholder:`Welcome to ${n.title}`,disabled:!i})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Body"}),a.jsx(us,{rows:6,value:d,onChange:h=>u(h.target.value),placeholder:"Thanks for subscribing! Here's what to expect…",disabled:!i}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Plain text or HTML. Leave blank to use a default greeting."})]})]})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"ghost",onClick:()=>e(!1),children:"Cancel"}),a.jsx(Z,{onClick:()=>{r({welcomeEmail:{enabled:i,subject:l.trim(),html:d}}),e(!1)},children:"Save"})]})]})})}function qws({open:t,onOpenChange:e,newsletter:n,onSave:r}){const[s,i]=y.useState(n),o=typeof window<"u"?window.location.origin:"",l=`${o}${ve.newsletterSignup(n.id)}`;return a.jsx(Bt,{open:t,onOpenChange:c=>{e(c),c&&i(n)},children:a.jsxs(Ft,{className:"max-h-[calc(100dvh-2rem)] w-[calc(100vw-2rem)] max-w-lg grid-rows-[auto_minmax(0,1fr)_auto] gap-0 overflow-hidden p-0",children:[a.jsxs(Vt,{className:"shrink-0 border-b border-border px-6 py-5 pr-12",children:[a.jsx(Ut,{children:"Sign-up page"}),a.jsx(_n,{children:"This is the public page where people enter their email to join the list. It is not the newsletter email."})]}),a.jsxs("div",{className:"themed-scrollbar min-h-0 space-y-3 overflow-y-auto overscroll-contain px-6 py-5",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Headline"}),a.jsx(Oe,{value:s.signupHeadline,onChange:c=>i({...s,signupHeadline:c.target.value})})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Sub-text"}),a.jsx(us,{rows:2,value:s.signupSubtext,onChange:c=>i({...s,signupSubtext:c.target.value})})]}),a.jsx(R6t,{value:s.thumbnail,onChange:c=>i({...s,thumbnail:c})}),a.jsx(Let,{label:"Sign-up URL",value:l,hint:"Public page where people subscribe."}),a.jsx(Let,{label:"Archive URL",value:`${o}${ve.newsletterArchive(n.id)}`,hint:"Public list of published issues."}),a.jsxs("div",{children:[a.jsx("p",{className:"mb-1.5 text-xs font-medium text-muted-foreground",children:"Public page preview — visitors see this, it is not sent as email"}),a.jsx("div",{className:"overflow-hidden rounded-lg border border-border",children:a.jsx(Z_e,{compact:!0,title:s.signupHeadline||s.title||"Join our newsletter",headerTitle:s.title,description:s.signupSubtext||s.description,thumbnail:s.thumbnail,children:a.jsx(njt,{})})})]})]}),a.jsxs(ir,{className:"shrink-0 border-t border-border bg-background px-6 py-4",children:[a.jsx(Z,{variant:"ghost",onClick:()=>e(!1),children:"Cancel"}),a.jsx(Z,{onClick:()=>{r({signupHeadline:s.signupHeadline,signupSubtext:s.signupSubtext,thumbnail:s.thumbnail}),e(!1)},children:"Save"})]})]})})}const Det=["image/jpeg","image/png","image/webp","image/gif"],Kws=2*1024*1024;function $et(t){const e=t?new Date(t):new Date(Date.now()+36e5);if(Number.isNaN(e.getTime()))return"";const n=r=>String(r).padStart(2,"0");return`${e.getFullYear()}-${n(e.getMonth()+1)}-${n(e.getDate())}T${n(e.getHours())}:${n(e.getMinutes())}`}const WH="flex-1 sm:flex-none";function Yws(){var c;const{newsletterId:t="",postId:e="new"}=So(),[n]=xc(),{community:r}=qe(),s=Nn(),i=e==="new"?n.get("template"):null,o=VAe(i?(r==null?void 0:r.id)??null:null),l=(c=o.data)==null?void 0:c.find(d=>d.id===i&&d.kind==="newsletter");return i&&(!r||o.isLoading)?a.jsx("p",{className:"p-6 text-muted-foreground",children:"Loading newsletter template…"}):i&&(o.isError||!l)?a.jsxs("div",{role:"alert",className:"space-y-3 p-6",children:[a.jsx("p",{children:o.isError?"Could not load newsletter template.":"This newsletter template is no longer available."}),o.isError&&a.jsx(Z,{variant:"outline",onClick:()=>void o.refetch(),children:"Retry"}),a.jsx(Z,{onClick:()=>s(ve.emailTemplates),children:"Back to templates"})]}):a.jsx(Qws,{initialTemplate:l},`${t}/${e}/${i??""}`)}function Qws({initialTemplate:t}){const{newsletterId:e="",postId:n="new"}=So(),{community:r}=qe(),s=Nn(),{toast:i}=yt(),o=ob(),{newsletters:l,posts:c,subscribers:d,addPost:u,updatePost:h}=Jy(),m=l.find(tt=>tt.id===e),f=n==="new",p=c.find(tt=>tt.id===n),g=y.useRef(f?null:n),v=y.useRef(null),b=y.useRef(null),x=y.useRef(!1),[w,k]=y.useState("post"),[S,C]=y.useState((p==null?void 0:p.title)??(t==null?void 0:t.name)??""),[j,E]=y.useState((p==null?void 0:p.content)??(t==null?void 0:t.content)??""),[N,A]=y.useState((p==null?void 0:p.thumbnail)??""),[_,T]=y.useState((p==null?void 0:p.seoTitle)??""),[R,O]=y.useState((p==null?void 0:p.metaDescription)??""),[F,D]=y.useState(""),[I,P]=y.useState(!1),[M,z]=y.useState(((p==null?void 0:p.tags)??[]).join(", ")),[G,B]=y.useState(((p==null?void 0:p.authors)??[(m==null?void 0:m.senderName)??L2]).join(", ")),[H,W]=y.useState((p==null?void 0:p.hideFromWeb)??!1),[V,U]=y.useState((p==null?void 0:p.status)??"draft");y.useEffect(()=>{!p||x.current||(x.current=!0,C(p.title??""),E(p.content??""),A(p.thumbnail??""),T(p.seoTitle??""),O(p.metaDescription??""),z((p.tags??[]).join(", ")),B((p.authors??[(m==null?void 0:m.senderName)??L2]).join(", ")),W(p.hideFromWeb??!1),U(p.status??"draft"))},[p,m==null?void 0:m.senderName]);const[ne,te]=y.useState(!f),[re,fe]=y.useState(!1),[le,q]=y.useState(!1),[Y,X]=y.useState(""),[Q,ie]=y.useState(!1),[he,ye]=y.useState(!1),[J,K]=y.useState(!1),[ce,pe]=y.useState((p==null?void 0:p.scheduledAt)??null),[Ie,Me]=y.useState(()=>$et(p==null?void 0:p.scheduledAt));if(!m)return a.jsx("div",{className:"p-6 text-center text-sm text-muted-foreground",children:"Newsletter not found."});const we=d.filter(tt=>tt.newsletterId===m.id&&tt.status==="Subscribed").length,Be=`${typeof window<"u"?window.location.origin:""}${ve.newsletterPostPublic(m.id,g.current||n)}`;function Ve(){return{title:S||"Untitled post",content:j,thumbnail:N,seoTitle:_.trim(),metaDescription:R.trim(),tags:M.split(",").map(tt=>tt.trim()).filter(Boolean),authors:G.split(",").map(tt=>tt.trim()).filter(Boolean),hideFromWeb:H}}async function be(tt={}){if(v.current&&await v.current,g.current)await h(g.current,{...Ve(),...tt});else{v.current=u({newsletterId:m.id,status:"draft",...Ve(),...tt}).then($e=>{g.current=$e.id});try{await v.current}finally{v.current=null}}te(!0)}async function Ze(){if(await be(),!!g.current){try{await h(g.current,{status:"published",newsletterId:m.id})}catch(tt){i({title:"Couldn't publish",description:dn(tt,"Please try again."),variant:"destructive"});return}U("published"),te(!0),i({title:"Sending emails…",description:`${we.toLocaleString()} subscribed recipients. Watch progress on the posts list.`}),s(ve.newsletterDetail(m.id))}}async function Pe(){const tt=Y.trim();ie(!0);try{if(await be(),!g.current)return;await Oor(m.id,g.current,tt||void 0),q(!1),i({title:"Test email sent",description:tt||"Check your account email address."})}catch($e){i({title:"Test email failed",description:$e instanceof ze?$e.message:"Could not send the test copy.",variant:"destructive"})}finally{ie(!1)}}async function Ke(){if(!r||!Ie)return;const tt=new Date(Ie);if(Number.isNaN(tt.getTime())){i({title:"Pick a valid date and time",variant:"destructive"});return}if(tt.getTime()<=Date.now()){i({title:"Pick a time in the future",variant:"destructive"});return}K(!0);try{if(await be(),!g.current)return;await For(r.id,g.current,tt.toISOString()),U("scheduled"),pe(tt.toISOString()),ye(!1),i({title:"Issue scheduled",description:`${we.toLocaleString()} subscribers will get it on ${tt.toLocaleString()}.`})}catch($e){i({title:"Could not schedule",description:$e instanceof ze?$e.message:"Please try again.",variant:"destructive"})}finally{K(!1)}}async function De(){if(!(!r||!g.current)){K(!0);try{await Bor(r.id,g.current),U("draft"),pe(null),ye(!1),i({title:"Schedule cancelled",description:"This issue is a draft again."})}catch(tt){i({title:"Could not cancel the schedule",description:tt instanceof ze?tt.message:"Please try again.",variant:"destructive"})}finally{K(!1)}}}const xt=()=>te(!1);async function Xe(tt){if(D(""),!!tt){if(!Det.includes(tt.type)){D("Use a JPG, PNG, WebP or GIF image.");return}if(tt.size>Kws){D("Image must be smaller than 2 MB.");return}if(!(r!=null&&r.id)){D("Couldn't determine the community to upload to.");return}P(!0);try{const $e=await Qre(r.id,tt);A($e),xt(),await be({thumbnail:$e})}catch($e){D($e instanceof ze?$e.message:"Couldn't upload that image. Try again.")}finally{P(!1)}}}return a.jsxs("div",{className:"-mx-3 -mb-6 -mt-3 flex h-[calc(100%+2.25rem)] min-h-0 flex-col bg-background sm:-mx-4 lg:-mx-6",children:[a.jsxs("header",{className:"flex shrink-0 flex-wrap items-center justify-between gap-x-3 gap-y-2 border-b border-border bg-card px-3 py-2 sm:px-5",children:[a.jsxs("div",{className:"flex min-w-0 flex-wrap items-center gap-x-3 gap-y-1",children:[a.jsxs(Z,{variant:"ghost",size:"sm",onClick:async()=>{ne||await be(),s(ve.newsletterDetail(m.id))},children:[a.jsx(nl,{className:"mr-1 h-4 w-4"})," Back"]}),a.jsx(q0,{status:V}),gm(p==null?void 0:p.sendProgress,V)&&a.jsx(sL,{progress:p.sendProgress,status:V,className:"hidden w-52 sm:block"}),a.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(xK,{className:"h-3.5 w-3.5"})," ",ne?"Saved":"Unsaved"]}),V==="scheduled"&&ce&&a.jsxs("span",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[a.jsx(Ux,{className:"h-3.5 w-3.5 shrink-0","aria-hidden":"true"}),"Sends ",vd(ce)]})]}),a.jsxs("div",{className:"flex w-full flex-wrap items-center gap-2 sm:w-auto",children:[a.jsx(Z,{variant:"outline",size:"icon",className:"shrink-0",title:"Preview",onClick:()=>fe(!0),children:a.jsx(Oc,{className:"h-4 w-4"})}),o&&a.jsxs(Z,{variant:"outline",size:"sm",className:WH,onClick:()=>q(!0),children:[a.jsx(_s,{className:"mr-1.5 h-4 w-4"})," Send test"]}),a.jsx(Z,{variant:"outline",size:"sm",className:WH,onClick:async()=>{await be(),i({title:"Draft saved"})},children:"Save draft"}),o&&V!=="published"&&a.jsxs(Z,{variant:"outline",size:"sm",className:WH,onClick:()=>{Me($et(ce)),ye(!0)},children:[a.jsx(Ux,{className:"mr-1.5 h-4 w-4"}),V==="scheduled"?"Reschedule":"Schedule"]}),o&&a.jsx(Z,{size:"sm",className:WH,onClick:Ze,children:"Publish"})]})]}),a.jsx("div",{className:"flex shrink-0 justify-center border-b border-border bg-card",children:a.jsx("div",{className:"flex gap-6",children:["post","settings"].map(tt=>a.jsxs("button",{onClick:()=>k(tt),className:ee("relative py-2 text-sm font-medium capitalize transition-colors",w===tt?"text-foreground":"text-muted-foreground hover:text-foreground"),children:[tt,w===tt&&a.jsx(it.span,{layoutId:"postTab",className:"absolute inset-x-0 -bottom-px h-0.5 rounded bg-foreground"})]},tt))})}),a.jsx("main",{className:"flex min-h-0 flex-1 flex-col",children:w==="post"?a.jsxs(it.div,{initial:{opacity:0},animate:{opacity:1},className:"mx-auto flex min-h-0 w-full max-w-5xl flex-1 flex-col px-3 py-3 sm:px-6",children:[a.jsxs("div",{className:"flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-border bg-card",children:[a.jsx("input",{value:S,onChange:tt=>{C(tt.target.value),xt()},onBlur:()=>be(),placeholder:"Post title",className:"w-full shrink-0 bg-transparent px-5 pb-2 pt-4 text-2xl font-bold text-foreground outline-none placeholder:text-muted-foreground/50"}),a.jsx(Du,{fill:!0,value:j,onChange:tt=>{E(tt),xt()},onBlur:()=>{be()},placeholder:"Write your post — bold, lists, and links are in the toolbar.",className:"min-h-0 flex-1 rounded-none border-0 border-t border-border shadow-none",editorClassName:"px-5 py-4 text-base leading-relaxed"})]}),a.jsx(w6t,{className:"mt-3 shrink-0"})]}):a.jsxs(it.div,{initial:{opacity:0},animate:{opacity:1},className:"mx-auto w-full max-w-5xl space-y-4 overflow-y-auto px-3 py-4 sm:px-6",children:[a.jsxs("div",{className:"grid gap-4 md:grid-cols-2",children:[a.jsxs("div",{className:"rounded-lg border border-border bg-card p-4",children:[a.jsx(_e,{children:"Post thumbnail"}),a.jsx("input",{ref:b,type:"file",accept:Det.join(","),className:"hidden",onChange:tt=>{var $e;return void Xe(($e=tt.target.files)==null?void 0:$e[0])}}),a.jsxs("div",{className:"mt-2 flex items-center gap-4",children:[a.jsx("div",{className:"flex h-20 w-32 shrink-0 items-center justify-center overflow-hidden rounded-lg bg-muted",children:N?a.jsx("img",{src:N,alt:"",className:"h-full w-full object-cover"}):a.jsx(Jl,{className:"h-6 w-6 text-muted-foreground/60"})}),a.jsxs("div",{className:"text-sm",children:[a.jsxs("p",{className:"text-muted-foreground",children:["Recommended ",a.jsx("span",{className:"font-medium text-foreground",children:"1280×720"})]}),a.jsx(Z,{type:"button",variant:"outline",size:"sm",className:"mt-2",disabled:I,onClick:()=>{var tt;return(tt=b.current)==null?void 0:tt.click()},children:I?a.jsxs(a.Fragment,{children:[a.jsx(Ne,{className:"mr-1.5 h-4 w-4 animate-spin"})," Uploading…"]}):a.jsxs(a.Fragment,{children:[a.jsx(Jl,{className:"mr-1.5 h-4 w-4"})," Select image"]})}),F&&a.jsx("p",{className:"mt-1 text-xs font-medium text-destructive",children:F})]})]})]}),a.jsxs("div",{className:"space-y-3 rounded-lg border border-border bg-card p-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Tags"}),a.jsx(Oe,{value:M,onChange:tt=>{z(tt.target.value),xt()},onBlur:()=>be(),placeholder:"training, news"}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Separate tags with commas."})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Authors"}),a.jsx(Oe,{value:G,onChange:tt=>{B(tt.target.value),xt()},onBlur:()=>be(),placeholder:"Author name"})]})]})]}),a.jsxs("div",{className:"flex items-center justify-between gap-3 rounded-lg border border-border bg-card px-4 py-3",children:[a.jsxs("div",{children:[a.jsx("p",{className:"text-sm text-foreground",children:"Hide from web"}),a.jsx("p",{className:"text-xs text-muted-foreground",children:"Removes this post from your publicly visible newsletter feed."})]}),a.jsx(Hs,{checked:H,onCheckedChange:tt=>{W(tt),be({hideFromWeb:tt})}})]}),a.jsxs("div",{className:"space-y-1.5 rounded-lg border border-border bg-card p-4",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{children:"Public post URL"}),a.jsx(gn,{label:"Public post URL",children:"A web page for this issue that anyone can read without subscribing. Share it to let people see a sample before they sign up."})]}),a.jsxs("div",{className:"flex gap-2",children:[a.jsx(Oe,{readOnly:!0,value:Be,className:"font-mono text-xs"}),a.jsx(Z,{type:"button",variant:"outline",size:"icon",title:"Copy link",onClick:()=>{var tt;(tt=navigator.clipboard)==null||tt.writeText(Be),i({title:"Public post link copied",description:V==="published"&&!H?void 0:H?"This issue is hidden from the web.":"This issue is not live until you publish."})},children:a.jsx(Zl,{className:"h-4 w-4"})})]}),a.jsx("p",{className:"text-[11px] text-muted-foreground",children:"Shareable web page for this issue. Live only after you publish and hide-from-web is off."})]}),a.jsxs("div",{className:"grid gap-4 rounded-lg border border-border bg-card p-4 md:grid-cols-2",children:[a.jsx("div",{className:"space-y-1.5 md:col-span-2",children:a.jsx("h3",{className:"text-sm font-semibold text-foreground",children:"SEO and sharing"})}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{children:"SEO title"}),a.jsx(gn,{label:"SEO title",children:"The heading search engines and link previews show for the public page. Leave blank to reuse the post title. Does not change the email subject."})]}),a.jsx(Oe,{value:_,onChange:tt=>{T(tt.target.value),xt()},onBlur:()=>be(),placeholder:S||"Post title"}),a.jsxs("p",{className:ee("text-[11px]",_.length>70?"text-warning":"text-muted-foreground"),children:[_.length,"/70 characters"]})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{children:"Meta description"}),a.jsx(gn,{label:"Meta description",children:"The summary under the link in search results and when the page is shared on social media. One or two sentences works best."})]}),a.jsx(us,{rows:2,value:R,onChange:tt=>{O(tt.target.value),xt()},onBlur:()=>be(),placeholder:"A short summary for search engines and social shares."}),a.jsxs("p",{className:ee("text-[11px]",R.length>160?"text-warning":"text-muted-foreground"),children:[R.length,"/160 characters"]})]})]})]})}),a.jsx(Bt,{open:re,onOpenChange:fe,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg max-w-2xl",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:"Post preview"}),a.jsx(_n,{children:V==="published"&&!H?"This is how the issue looks. Subscribers get this as email when you publish.":"Draft preview — not live on the public page until you publish."})]}),a.jsxs("div",{className:"max-h-[60vh] overflow-y-auto rounded-xl border border-border bg-card p-5",children:[N?a.jsx("img",{src:N,alt:"",className:"mb-4 w-full rounded-lg object-cover"}):null,a.jsx("h3",{className:"text-xl font-bold text-foreground",children:S||"Untitled post"}),G.trim()?a.jsx("p",{className:"mt-1 text-xs text-muted-foreground",children:G}):null,j.trim()?a.jsx(Du,{value:j,readOnly:!0,className:"mt-4"}):a.jsx("p",{className:"mt-4 text-sm text-muted-foreground",children:"No content yet."})]}),a.jsxs(ir,{children:[V==="published"&&!H?a.jsxs(a.Fragment,{children:[a.jsxs(Z,{variant:"outline",onClick:()=>{var tt;(tt=navigator.clipboard)==null||tt.writeText(Be),i({title:"Public post link copied"})},children:[a.jsx(Zl,{className:"mr-1.5 h-4 w-4"})," Copy public link"]}),a.jsx(Z,{variant:"outline",onClick:()=>window.open(Be,"_blank","noopener,noreferrer"),children:"Open public page"})]}):null,a.jsx(Z,{onClick:()=>fe(!1),children:"Close"})]})]})}),a.jsx(k6t,{open:le,onOpenChange:q,inputId:"newsletter-post-test-email",email:Y,onEmailChange:X,sending:Q,onSend:()=>void Pe()}),a.jsx(Bt,{open:he,onOpenChange:ye,children:a.jsxs(Ft,{className:"w-[calc(100vw-2rem)] rounded-lg max-w-sm",children:[a.jsxs(Vt,{children:[a.jsx(Ut,{children:V==="scheduled"?"Reschedule this issue":"Schedule this issue"}),a.jsx(_n,{children:"It publishes and goes out to subscribers automatically at the time you pick."})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsxs("div",{className:"flex items-center gap-1.5",children:[a.jsx(_e,{htmlFor:"schedule-at",children:"Date and time"}),a.jsx(gn,{label:"Date and time",children:"When this issue is published and emailed to subscribers, in your own timezone. You can change or cancel it any time before then."})]}),a.jsx(Oe,{id:"schedule-at",type:"datetime-local",value:Ie,onChange:tt=>Me(tt.target.value)}),a.jsxs("p",{className:"text-[11px] text-muted-foreground",children:["Your local time. ",we.toLocaleString()," subscribers will receive it."]})]}),a.jsxs(ir,{children:[V==="scheduled"?a.jsx(Z,{variant:"ghost",disabled:J,onClick:()=>void De(),children:"Cancel schedule"}):a.jsx(Z,{variant:"ghost",onClick:()=>ye(!1),children:"Cancel"}),a.jsx(Z,{disabled:!Ie||J,onClick:()=>void Ke(),children:J?"Saving…":V==="scheduled"?"Reschedule":"Schedule"})]})]})})]})}const Zws={published:"border-success/30 bg-success/10 text-success",active:"border-success/30 bg-success/10 text-success",draft:"border-muted-foreground/20 bg-muted text-muted-foreground",scheduled:"border-info/30 bg-info/10 text-info",pending_review:"border-warning/30 bg-warning/10 text-warning",pending:"border-warning/30 bg-warning/10 text-warning",rejected:"border-destructive/30 bg-destructive/10 text-destructive",archived:"border-muted-foreground/20 bg-muted text-muted-foreground",deleted:"border-destructive/30 bg-destructive/10 text-destructive"};function Jws(t){return Zws[t==null?void 0:t.toLowerCase()]??"border-border bg-muted text-muted-foreground"}function Xws({status:t}){const e=(t??"").replace(/_/g," ");return a.jsx("span",{className:ee("inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium capitalize",Jws(t)),children:e})}function eMe(){return Svr()}const BN=t=>encodeURIComponent(t);function VS(t){return`/community/${BN(t)}/content`}function tMe(t,e){const n=new URLSearchParams;Object.entries(e).forEach(([s,i])=>{i!=null&&String(i).trim()!==""&&n.set(s,String(i))});const r=n.toString();return r?`${t}?${r}`:t}function I6t(t){return{data:Array.isArray(t.data)?t.data:[],page:t.page??1,limit:t.limit??10,total:t.total??0,message:t.message}}async function e1s(t,e){const n=tMe(`${VS(t)}/media`,{...e}),r=await ae.get(n);return I6t(r)}async function t1s(t){return(await ae.get(`${VS(t)}/media/storage-summary`)).data??{totalBytes:0,totalCount:0,quotaBytes:0,breakdown:[],unsizedCount:0}}async function n1s(t,e){return(await ae.get(`${VS(t)}/media/${BN(e)}`)).data??null}async function r1s(t,e,n=!1){await ae.delete(tMe(`${VS(t)}/media/${BN(e)}`,{force:n?"true":void 0}))}async function s1s(t,e){const n=tMe(`${VS(t)}/posts`,{...e}),r=await ae.get(n);return I6t(r)}async function i1s(t){return(await ae.get(`${VS(t)}/posts/counts`)).data??{all:0,published:0,scheduled:0,pending_review:0,rejected:0}}async function a1s(t,e){var r,s;const n=await ae.post(`${VS(t)}/posts/bulk-delete`,{ids:e});return{deleted:((r=n.data)==null?void 0:r.deleted)??0,failed:((s=n.data)==null?void 0:s.failed)??[]}}async function o1s(t,e,n){return(await ae.post(`${VS(t)}/posts/bulk-move`,{ids:e,space:n})).data??{moved:0}}const F9=t=>`/community/${BN(t)}`;async function l1s(t){const e=await ae.get(`${F9(t)}/topics`);return Array.isArray(e.topics)?e.topics:[]}async function c1s(t,e){return(await ae.post(`${F9(t)}/topic`,e)).topic}async function d1s(t,e,n){return(await ae.patch(`${F9(t)}/topic/${BN(e)}/edit`,n)).updatedTopic}async function u1s(t,e){return(await ae.patch(`${F9(t)}/topic/${BN(e)}/archive`)).archivedTopic}async function h1s(t,e){await ae.patch(`${F9(t)}/topic/${BN(e)}/delete`)}const jae={all:["content","media"],list:(t,e)=>["content","media","list",t,e],summary:t=>["content","media","summary",t],detail:(t,e)=>["content","media","detail",t,e]};function m1s(t,e){return lt({queryKey:jae.list(t,e),queryFn:()=>e1s(t,e),enabled:!!t})}function f1s(t){return lt({queryKey:jae.summary(t),queryFn:()=>t1s(t),enabled:!!t,refetchInterval:e=>{var n;return(((n=e.state.data)==null?void 0:n.unsizedCount)??0)<=0?!1:e.state.dataUpdateCount<20?3e3:!1}})}function p1s(t,e){return lt({queryKey:jae.detail(t,e),queryFn:()=>n1s(t,e),enabled:!!t&&!!e})}function g1s(t){const e=rn();return jt({mutationFn:({mediaId:n,force:r})=>r1s(t,n,r),onSuccess:()=>{e.invalidateQueries({queryKey:jae.all})}})}const Eae={all:["content","posts"],list:(t,e)=>["content","posts","list",t,e],counts:t=>["content","posts","counts",t]};function v1s(t,e){return lt({queryKey:Eae.list(t,e),queryFn:()=>s1s(t,e),enabled:!!t})}function y1s(t){return lt({queryKey:Eae.counts(t),queryFn:()=>i1s(t),enabled:!!t})}function b1s(t){const e=rn();return jt({mutationFn:n=>a1s(t,n),onSuccess:()=>e.invalidateQueries({queryKey:Eae.all})})}function x1s(t){const e=rn();return jt({mutationFn:({ids:n,space:r})=>o1s(t,n,r),onSuccess:()=>e.invalidateQueries({queryKey:Eae.all})})}const B9={all:["content","topics"],list:t=>["content","topics","list",t]};function w1s(t){return lt({queryKey:B9.list(t),queryFn:()=>l1s(t),enabled:!!t})}function k1s(t){const e=rn();return jt({mutationFn:n=>c1s(t,n),onSuccess:()=>e.invalidateQueries({queryKey:B9.all})})}function S1s(t){const e=rn();return jt({mutationFn:({topicId:n,body:r})=>d1s(t,n,r),onSuccess:()=>e.invalidateQueries({queryKey:B9.all})})}function C1s(t){const e=rn();return jt({mutationFn:n=>u1s(t,n),onSuccess:()=>e.invalidateQueries({queryKey:B9.all})})}function j1s(t){const e=rn();return jt({mutationFn:n=>h1s(t,n),onSuccess:()=>e.invalidateQueries({queryKey:B9.all})})}const Oet=[{key:"all",label:"All",value:void 0},{key:"video",label:"Videos",value:"video"},{key:"recording",label:"Recordings",value:"recording"},{key:"audio",label:"Audio",value:"audio"},{key:"image",label:"Images",value:"image"},{key:"file",label:"Files",value:"file"}],B1={video:{label:"Video",icon:b2,dot:"bg-primary"},recording:{label:"Recording",icon:b2,dot:"bg-info"},audio:{label:"Audio",icon:ySe,dot:"bg-warning"},image:{label:"Image",icon:Jl,dot:"bg-success"},file:{label:"File",icon:Ei,dot:"bg-muted-foreground"}},tme=[{key:"newest",label:"Newest",sort:"date",order:"desc"},{key:"oldest",label:"Oldest",sort:"date",order:"asc"},{key:"largest",label:"Largest",sort:"size",order:"desc"},{key:"smallest",label:"Smallest",sort:"size",order:"asc"},{key:"name",label:"Name (A–Z)",sort:"name",order:"asc"}];function K$(t){if(t==null)return"—";if(t<=0)return"0 B";const e=["B","KB","MB","GB","TB"],n=Math.min(e.length-1,Math.floor(Math.log(t)/Math.log(1024)));return`${(t/Math.pow(1024,n)).toFixed(n===0?0:1)} ${e[n]}`}function nMe(t){if(!t)return"—";try{return new Date(t).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}catch{return"—"}}function E1s(t){return B1[t.category]??B1.file}function b8(t){return t.sourceName||t.displayName||t.fileName||"—"}function Hq(t){return t.category==="recording"}function M6t(t){Hq(t)?window.open(t.storageURL,"_blank","noopener,noreferrer"):L6t(t.storageURL,t.fileName)}async function L6t(t,e){try{const n=await fetch(t);if(!n.ok)throw new Error(`HTTP ${n.status}`);const r=await n.blob(),s=URL.createObjectURL(r),i=document.createElement("a");i.href=s,i.download=e||"download",document.body.appendChild(i),i.click(),i.remove(),URL.revokeObjectURL(s)}catch{window.open(t,"_blank","noopener,noreferrer")}}function N1s(){var D,I,P,M,z,G,B;const{communityId:t}=eMe(),{toast:e}=yt(),[n]=xc(),[r,s]=y.useState(()=>{const H=n.get("category");return Oet.some(W=>W.value&&W.value===H)?H??void 0:void 0}),[i,o]=y.useState(""),[l,c]=y.useState(""),[d,u]=y.useState("newest"),[h,m]=y.useState(1),[f,p]=y.useState(null),[g,v]=y.useState(null),[b,x]=y.useState(null),w=H=>Hq(H)?x(H):p(H.id);y.useEffect(()=>{const H=setTimeout(()=>{c(i.trim()),m(1)},350);return()=>clearTimeout(H)},[i]);const k=r==="recording"?tme.filter(H=>H.sort!=="size"):tme,S=k.find(H=>H.key===d)??tme[0],C=y.useMemo(()=>({category:r,search:l||void 0,sort:S.sort,order:S.order,page:h,limit:20}),[r,l,S.sort,S.order,h]),j=m1s(t,C),E=f1s(t),N=g1s(t),A=((D=j.data)==null?void 0:D.data)??[],_=((I=j.data)==null?void 0:I.total)??0,T=((P=E.data)==null?void 0:P.unsizedCount)??0,R=y.useRef(T),O=j.refetch;y.useEffect(()=>{T<R.current&&O(),R.current=T},[T,O]);const F=H=>{N.mutate({mediaId:H.id,force:H.isInUse},{onSuccess:()=>{e({title:"Media deleted"}),v(null),p(null)},onError:()=>{e({title:"Could not delete",description:"Please try again.",variant:"destructive"})}})};return a.jsxs(it.div,{initial:{opacity:0},animate:{opacity:1},className:"mx-auto max-w-6xl space-y-5 lg:p-6",children:[a.jsx(Bm,{title:"Media",description:"All uploaded videos, recordings, audio, images and files across your community."}),a.jsx(T1s,{loading:E.isLoading,totalBytes:((M=E.data)==null?void 0:M.totalBytes)??0,totalCount:((z=E.data)==null?void 0:z.totalCount)??0,quotaBytes:((G=E.data)==null?void 0:G.quotaBytes)??0,breakdown:((B=E.data)==null?void 0:B.breakdown)??[]}),a.jsx("div",{className:"flex flex-wrap items-center gap-1 border-b border-border",children:Oet.map(H=>{const W=r===H.value;return a.jsxs("button",{onClick:()=>{s(H.value),m(1),H.value==="recording"&&S.sort==="size"&&u("newest")},className:ee("relative px-3 py-2 text-sm transition-colors",W?"font-medium text-foreground":"text-muted-foreground hover:text-foreground"),children:[H.label,W&&a.jsx(it.span,{layoutId:"mediaTab",className:"absolute inset-x-2 -bottom-px h-0.5 rounded bg-primary"})]},H.key)})}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(hs,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Oe,{value:i,onChange:H=>o(H.target.value),placeholder:"Search by file name…",className:"pl-9"})]}),a.jsxs(zn,{value:S.key,onValueChange:H=>{u(H),m(1)},children:[a.jsx(On,{className:"w-full sm:w-44",children:a.jsx(Vn,{})}),a.jsx(Fn,{children:k.map(H=>a.jsx(pt,{value:H.key,children:H.label},H.key))})]})]}),r==="recording"&&a.jsxs("p",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:["Recordings of your live calls and meetings, newest first.",a.jsx(gn,{label:"Recordings",children:"Each session's recording is listed here once the meeting ends. The meeting provider deletes its own copy after about 7 days, so a copy is saved to your community's storage automatically. Recordings can be played or downloaded, not deleted. A recording made before this copy existed may show as unavailable."})]}),a.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card shadow-card",children:j.isLoading?a.jsx(FS,{rows:6,columns:5}):j.isError?a.jsx(BS,{onRetry:()=>j.refetch()}):A.length===0&&r==="recording"&&!l?a.jsx(Df,{icon:b2,title:"No recordings yet",description:"Recordings of your live calls and meetings will appear here once a recorded session ends."}):A.length===0?a.jsx(Df,{icon:Jl,title:"No media found",description:l||r?"Try a different search or category.":"Uploaded media across your community will appear here."}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border text-left text-xs uppercase tracking-wide text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-3 font-medium",children:"Name"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Category"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Owner"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Date added"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Size"}),a.jsx("th",{className:"px-4 py-3"})]})}),a.jsx("tbody",{children:A.map(H=>{var V;const W=E1s(H);return a.jsxs("tr",{onClick:()=>w(H),className:"cursor-pointer border-b border-border/60 transition-colors last:border-0 hover:bg-muted/60",children:[a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx(W.icon,{className:"h-4 w-4 shrink-0 text-muted-foreground"}),a.jsx("div",{className:"min-w-0 max-w-[280px]",children:a.jsx("div",{className:"truncate font-medium text-foreground",title:b8(H),children:b8(H)})})]})}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:W.label}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:((V=H.owner)==null?void 0:V.name)??"—"}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:nMe(H.createdAt)}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:K$(H.sizeBytes)}),a.jsx("td",{className:"px-4 py-3 text-right",onClick:U=>U.stopPropagation(),children:a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[a.jsx(ot,{onClick:()=>w(H),children:Hq(H)?a.jsxs(a.Fragment,{children:[a.jsx(fm,{className:"mr-2 h-4 w-4"})," Play"]}):a.jsxs(a.Fragment,{children:[a.jsx(bo,{className:"mr-2 h-4 w-4"})," View details"]})}),a.jsxs(ot,{onClick:()=>M6t(H),children:[a.jsx(bc,{className:"mr-2 h-4 w-4"})," Download"]}),!Hq(H)&&a.jsxs(a.Fragment,{children:[a.jsx(mi,{}),a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>v(H),children:[a.jsx(qn,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})]})})]},H.id)})})]})}),a.jsx(US,{page:h,limit:20,total:_,onPageChange:m})]})}),a.jsx(R1s,{item:b,onOpenChange:H=>!H&&x(null)}),a.jsx(A1s,{communityId:t,mediaId:f,onOpenChange:H=>!H&&p(null),onDelete:H=>v(H)}),a.jsx(Cl,{open:!!g,onOpenChange:H=>!H&&v(null),title:"Delete this asset?",description:g!=null&&g.isInUse?"This asset is still used by one or more posts. Deleting it will break those references. This cannot be undone.":"This will permanently remove the file. This cannot be undone.",confirmLabel:"Delete",onConfirm:()=>g&&F(g)})]})}function T1s({loading:t,totalBytes:e,totalCount:n,quotaBytes:r,breakdown:s}){const i=r>0?r:e||1;return a.jsxs("div",{className:"rounded-xl border border-border bg-card p-4 shadow-card",children:[a.jsxs("div",{className:"flex items-center justify-between",children:[a.jsxs("span",{className:"flex items-center gap-2 text-sm font-medium text-foreground",children:[a.jsx(RBt,{className:"h-4 w-4 text-muted-foreground"}),K$(e)," used",r>0?` of ${K$(r)}`:""]}),a.jsx("span",{className:"text-xs text-muted-foreground",children:t?"…":`${n.toLocaleString()} files`})]}),a.jsx("div",{className:"mt-3 flex h-2.5 w-full overflow-hidden rounded-full bg-muted",children:s.map(o=>a.jsx("div",{className:ee("h-full",(B1[o.category]??B1.file).dot),style:{width:`${Math.max(o.bytes/i*100,o.bytes>0?1:0)}%`}},o.category))}),a.jsxs("div",{className:"mt-3 flex flex-wrap gap-x-4 gap-y-1.5",children:[s.length===0&&a.jsx("span",{className:"text-xs text-muted-foreground",children:"No media uploaded yet."}),s.map(o=>{const l=B1[o.category]??B1.file;return a.jsxs("span",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[a.jsx("span",{className:ee("h-2 w-2 rounded-full",l.dot)}),l.label," · ",K$(o.bytes)]},o.category)})]})]})}const _1s={post:"Post",course:"Course",lesson:"Lesson",profile:"Profile"};function Fet({type:t}){return a.jsx("span",{className:"shrink-0 text-[10px] font-semibold uppercase tracking-wide text-muted-foreground",children:_1s[t]||"File"})}function A1s({communityId:t,mediaId:e,onOpenChange:n,onDelete:r}){var l,c,d;const s=p1s(t,e),i=(l=s.data)==null?void 0:l.media,o=((c=s.data)==null?void 0:c.usedIn)??[];return a.jsx(Bt,{open:!!e,onOpenChange:n,children:a.jsxs(Ft,{className:"themed-scrollbar w-[calc(100vw-2rem)] max-w-2xl max-h-[90vh] overflow-y-auto rounded-lg p-5 sm:p-6",children:[a.jsxs(Vt,{className:"min-w-0 pr-8 text-left",children:[a.jsx(Ut,{className:"truncate",title:i?b8(i):void 0,children:i?b8(i):"Media details"}),a.jsx(_n,{children:i?(B1[i.category]??B1.file).label:"Loading…"})]}),s.isLoading?a.jsx("div",{className:"py-10 text-center text-sm text-muted-foreground",children:"Loading…"}):i?a.jsxs("div",{className:"min-w-0 space-y-4",children:[a.jsx(P1s,{media:i}),a.jsxs("dl",{className:"grid grid-cols-2 gap-x-4 gap-y-2 text-sm",children:[a.jsx("dt",{className:"text-muted-foreground",children:"File name"}),a.jsx("dd",{className:"min-w-0 break-all text-foreground",children:i.fileName||"—"}),a.jsx("dt",{className:"text-muted-foreground",children:"Type"}),a.jsx("dd",{className:"text-foreground",children:i.mediaType}),a.jsx("dt",{className:"text-muted-foreground",children:"Size"}),a.jsx("dd",{className:"text-foreground",children:K$(i.sizeBytes)}),a.jsx("dt",{className:"text-muted-foreground",children:"Owner"}),a.jsx("dd",{className:"text-foreground",children:((d=i.owner)==null?void 0:d.name)??"—"}),a.jsx("dt",{className:"text-muted-foreground",children:"Date added"}),a.jsx("dd",{className:"text-foreground",children:nMe(i.createdAt)})]}),a.jsxs("div",{children:[a.jsx("p",{className:"mb-1.5 text-xs font-semibold uppercase tracking-wide text-muted-foreground",children:"Used in"}),o.length===0?a.jsx("p",{className:"text-sm text-muted-foreground",children:"Not used in a post, course, or profile yet."}):a.jsx("ul",{className:"space-y-1",children:o.map(u=>a.jsx("li",{className:"rounded-md border border-border bg-surface px-2.5 py-1.5 text-sm text-foreground",children:u.href?a.jsxs(vr,{to:u.href,className:"flex min-w-0 items-center gap-2 hover:text-primary",children:[a.jsx(Fet,{type:u.type}),a.jsx("span",{className:"truncate",children:u.title})]}):a.jsxs("span",{className:"flex min-w-0 items-center gap-2",children:[a.jsx(Fet,{type:u.type}),a.jsx("span",{className:"truncate",children:u.title})]})},`${u.type}-${u.id}`))})]}),a.jsxs("div",{className:"flex items-center justify-between gap-2 border-t border-border pt-4",children:[a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>L6t(i.storageURL,i.fileName),children:[a.jsx(bc,{className:"mr-1.5 h-4 w-4"})," Download"]}),a.jsxs(Z,{variant:"ghost",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>r(i),children:[a.jsx(qn,{className:"mr-1.5 h-4 w-4"})," Delete"]})]})]}):a.jsx("div",{className:"py-10 text-center text-sm text-muted-foreground",children:"This asset no longer exists."})]})})}function P1s({media:t}){const[e,n]=y.useState(!1),r=t.storageURL;return e?a.jsx(Bet,{url:r}):t.category==="image"?a.jsx("div",{className:"flex items-center justify-center overflow-hidden rounded-lg border border-border bg-muted/30",children:a.jsx("img",{src:r,alt:t.fileName,onError:()=>n(!0),className:"max-h-[55vh] w-full object-contain"})}):t.category==="video"||t.category==="recording"?a.jsx("video",{src:r,controls:!0,preload:"metadata",onError:()=>n(!0),className:"max-h-[55vh] w-full rounded-lg border border-border bg-black object-contain"}):t.category==="audio"?a.jsx("audio",{src:r,controls:!0,onError:()=>n(!0),className:"w-full"}):a.jsx(Bet,{url:r,label:"Open file",isFile:!0})}function Bet({url:t,label:e="Open original",isFile:n=!1}){return a.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-border bg-muted/30 px-6 py-12 text-center",children:[a.jsx(Ei,{className:"h-8 w-8 text-muted-foreground"}),a.jsx("p",{className:"text-sm font-medium text-foreground",children:n?"No inline preview":"Preview unavailable"}),!n&&a.jsx("p",{className:"max-w-sm text-xs text-muted-foreground",children:"This file couldn't be loaded — it may be private or has moved. You can still open or download it."}),a.jsxs("a",{href:t,target:"_blank",rel:"noopener noreferrer",className:"mt-1 text-xs font-medium text-primary hover:underline",children:[e," ↗"]})]})}function R1s({item:t,onOpenChange:e}){var s;const n=y.useRef(null);t&&(n.current=t);const r=t??n.current;return a.jsx(Bt,{open:!!t,onOpenChange:e,children:a.jsx(Ft,{className:"themed-scrollbar w-[calc(100vw-2rem)] max-w-3xl max-h-[90vh] overflow-y-auto rounded-lg p-5 sm:p-6",children:r&&a.jsxs(a.Fragment,{children:[a.jsxs(Vt,{className:"min-w-0 pr-8 text-left",children:[a.jsx(Ut,{className:"break-words leading-snug",children:b8(r)}),a.jsxs(_n,{children:[((s=r.owner)==null?void 0:s.name)??"—"," · ",nMe(r.createdAt)]})]}),a.jsx(I1s,{item:r},r.id),a.jsx("div",{className:"flex justify-end",children:a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>M6t(r),children:[a.jsx(bc,{className:"mr-1.5 h-4 w-4"})," Download"]})})]})})})}function I1s({item:t}){const[e,n]=y.useState(!1);return e?a.jsxs("div",{className:"flex flex-col items-center justify-center gap-2 rounded-lg border border-dashed border-border bg-muted/30 px-6 py-12 text-center",children:[a.jsx(b2,{className:"h-8 w-8 text-muted-foreground"}),a.jsx("p",{className:"text-sm font-medium text-foreground",children:"This recording file isn't available in storage."}),a.jsx("p",{className:"max-w-sm text-xs text-muted-foreground",children:"It may have expired before a copy was saved. Recordings made from now on are kept automatically."})]}):a.jsx("video",{src:t.storageURL,controls:!0,playsInline:!0,preload:"metadata",onError:()=>n(!0),className:"max-h-[60vh] w-full rounded-lg bg-black"})}const Uet=[{key:"all",label:"All",value:void 0,countKey:"all"},{key:"published",label:"Published",value:"published",countKey:"published"},{key:"scheduled",label:"Scheduled",value:"scheduled",countKey:"scheduled"},{key:"pending_review",label:"Pending review",value:"pending_review",countKey:"pending_review"},{key:"rejected",label:"Rejected",value:"rejected",countKey:"rejected"}],nme=[{key:"newest",label:"Newest",sort:"date",order:"desc"},{key:"oldest",label:"Oldest",sort:"date",order:"asc"},{key:"most_liked",label:"Most liked",sort:"likes",order:"desc"},{key:"most_commented",label:"Most commented",sort:"comments",order:"desc"}],qH="__all__";function M1s(t){if(!t)return"—";try{return new Date(t).toLocaleDateString("en-GB",{day:"numeric",month:"short",year:"numeric"})}catch{return"—"}}function L1s(){var B,H,W;const{communityId:t}=eMe(),{toast:e}=yt(),{groups:n}=Ln(),[r,s]=y.useState("all"),[i,o]=y.useState(qH),[l,c]=y.useState(""),[d,u]=y.useState(""),[h,m]=y.useState("newest"),[f,p]=y.useState(1),[g,v]=y.useState(new Set),[b,x]=y.useState(!1),[w,k]=y.useState(!1),[S,C]=y.useState("");y.useEffect(()=>{const V=setTimeout(()=>{u(l.trim()),p(1)},350);return()=>clearTimeout(V)},[l]);const j=(B=Uet.find(V=>V.key===r))==null?void 0:B.value,E=nme.find(V=>V.key===h)??nme[0],N=y.useMemo(()=>({status:j,space:i===qH?void 0:i,search:d||void 0,sort:E.sort,order:E.order,page:f,limit:20}),[j,i,d,E.sort,E.order,f]),A=v1s(t,N),_=y1s(t),T=b1s(t),R=x1s(t),O=((H=A.data)==null?void 0:H.data)??[],F=((W=A.data)==null?void 0:W.total)??0;y.useEffect(()=>{v(new Set)},[N]);const D=O.length>0&&O.every(V=>g.has(V.id)),I=()=>{v(V=>{const U=new Set(V);return D?O.forEach(ne=>U.delete(ne.id)):O.forEach(ne=>U.add(ne.id)),U})},P=V=>{v(U=>{const ne=new Set(U);return ne.has(V)?ne.delete(V):ne.add(V),ne})},M=[...g],z=()=>{T.mutate(M,{onSuccess:V=>{V.failed.length>0?e({title:`${V.deleted} deleted, ${V.failed.length} failed`,description:"Some posts could not be deleted. Please try again.",variant:"destructive"}):e({title:`${V.deleted} post${V.deleted===1?"":"s"} deleted`}),v(new Set),x(!1)},onError:()=>e({title:"Could not delete posts",variant:"destructive"})})},G=()=>{S&&R.mutate({ids:M,space:S},{onSuccess:V=>{e({title:`${V.moved} post${V.moved===1?"":"s"} moved`}),v(new Set),k(!1),C("")},onError:()=>e({title:"Could not move posts",variant:"destructive"})})};return a.jsxs(it.div,{initial:{opacity:0},animate:{opacity:1},className:"mx-auto max-w-6xl space-y-5 lg:p-6",children:[a.jsx(Bm,{title:"Posts",description:"Every post across all spaces — filter, moderate and bulk-manage."}),a.jsx("div",{className:"flex flex-wrap items-center gap-1 border-b border-border",children:Uet.map(V=>{var te;const U=r===V.key,ne=(te=_.data)==null?void 0:te[V.countKey];return a.jsxs("button",{onClick:()=>{s(V.key),p(1)},className:ee("relative px-3 py-2 text-sm transition-colors",U?"font-medium text-foreground":"text-muted-foreground hover:text-foreground"),children:[V.label,ne!==void 0&&a.jsx("span",{className:"ml-1.5 text-xs text-muted-foreground",children:ne.toLocaleString()}),U&&a.jsx(it.span,{layoutId:"postsTab",className:"absolute inset-x-2 -bottom-px h-0.5 rounded bg-primary"})]},V.key)})}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(hs,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Oe,{value:l,onChange:V=>c(V.target.value),placeholder:"Search post titles…",className:"pl-9"})]}),a.jsxs(zn,{value:i,onValueChange:V=>{o(V),p(1)},children:[a.jsx(On,{className:"w-full sm:w-48",children:a.jsx(Vn,{placeholder:"All spaces"})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:qH,children:"All spaces"}),n.map(V=>a.jsx(pt,{value:V.id,children:V.name},V.id))]})]}),a.jsxs(zn,{value:h,onValueChange:V=>{m(V),p(1)},children:[a.jsx(On,{className:"w-full sm:w-44",children:a.jsx(Vn,{})}),a.jsx(Fn,{children:nme.map(V=>a.jsx(pt,{value:V.key,children:V.label},V.key))})]})]}),M.length>0&&a.jsxs("div",{className:"flex items-center justify-between rounded-lg border border-primary/30 bg-primary/5 px-4 py-2.5 text-sm",children:[a.jsxs("span",{className:"font-medium text-foreground",children:[M.length," selected"]}),a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsxs(Z,{variant:"outline",size:"sm",onClick:()=>{C(""),k(!0)},children:[a.jsx(fO,{className:"mr-1.5 h-4 w-4"})," Move to space"]}),a.jsxs(Z,{variant:"outline",size:"sm",className:"text-destructive hover:text-destructive",onClick:()=>x(!0),children:[a.jsx(qn,{className:"mr-1.5 h-4 w-4"})," Delete"]})]})]}),a.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card shadow-card",children:A.isLoading?a.jsx(FS,{rows:6,columns:5}):A.isError?a.jsx(BS,{onRetry:()=>A.refetch()}):O.length===0?a.jsx(Df,{icon:Ei,title:"No posts found",description:d||i!==qH||j?"Try a different search, space or status.":"Posts across your community will appear here."}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border text-left text-xs uppercase tracking-wide text-muted-foreground",children:[a.jsx("th",{className:"w-10 px-4 py-3",children:a.jsx(ji,{checked:D,onCheckedChange:I,"aria-label":"Select all"})}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Title"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Status"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Author"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Space"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Date"}),a.jsx("th",{className:"px-4 py-3"})]})}),a.jsx("tbody",{children:O.map(V=>{var U,ne;return a.jsxs("tr",{className:"border-b border-border/60 transition-colors last:border-0 hover:bg-muted/60",children:[a.jsx("td",{className:"px-4 py-3",onClick:te=>te.stopPropagation(),children:a.jsx(ji,{checked:g.has(V.id),onCheckedChange:()=>P(V.id),"aria-label":"Select post"})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:"block max-w-[320px] truncate font-medium text-foreground",children:V.title})}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(Xws,{status:V.status})}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:((U=V.author)==null?void 0:U.name)??"—"}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:((ne=V.space)==null?void 0:ne.name)??"—"}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:M1s(V.createdAt)}),a.jsx("td",{className:"px-4 py-3 text-right",onClick:te=>te.stopPropagation(),children:a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[a.jsx(ot,{asChild:!0,children:a.jsxs(vr,{to:ve.post(V.id),children:[a.jsx(bo,{className:"mr-2 h-4 w-4"})," Open post"]})}),a.jsxs(ot,{onClick:()=>{v(new Set([V.id])),C(""),k(!0)},children:[a.jsx(fO,{className:"mr-2 h-4 w-4"})," Move to space"]}),a.jsx(mi,{}),a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>{v(new Set([V.id])),x(!0)},children:[a.jsx(qn,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})})]},V.id)})})]})}),a.jsx(US,{page:f,limit:20,total:F,onPageChange:p})]})}),a.jsx(Cl,{open:b,onOpenChange:x,title:`Delete ${M.length} post${M.length===1?"":"s"}?`,description:"This permanently removes the selected posts and their comments and likes. This cannot be undone.",confirmLabel:"Delete",onConfirm:z}),a.jsx(Bt,{open:w,onOpenChange:k,children:a.jsxs(Ft,{children:[a.jsxs(Vt,{children:[a.jsxs(Ut,{children:["Move ",M.length," post",M.length===1?"":"s"]}),a.jsx(_n,{children:"Choose the destination space."})]}),a.jsxs(zn,{value:S,onValueChange:C,children:[a.jsx(On,{children:a.jsx(Vn,{placeholder:"Select a space"})}),a.jsx(Fn,{children:n.map(V=>a.jsx(pt,{value:V.id,children:V.name},V.id))})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"ghost",onClick:()=>k(!1),children:"Cancel"}),a.jsx(Z,{disabled:!S||R.isPending,onClick:G,children:"Move"})]})]})})]})}const KH="__all__",D1s={open:"Open","closed-free":"Closed · Free","closed-paid":"Closed · Paid",personal:"Personal"};function zet(t){return t&&D1s[t]||t||"—"}function $1s(t){const e=(t.tabs??[]).find(n=>n.emoji&&n.emoji!=="#");return(e==null?void 0:e.emoji)??"#"}function O1s(t){const e=(t.tabs??[]).map(n=>n.postLevel).filter(Boolean);return e.length?e.every(n=>n==="anyone")?"Members":e.every(n=>n==="admin")?"Admins only":"Mixed":"—"}function F1s({private_:t}){return a.jsx("span",{className:ee("inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium",t?"border-warning/30 bg-warning/10 text-warning":"border-success/30 bg-success/10 text-success"),children:t?"Private":"Open"})}function B1s(){const{groups:t,groupsLoading:e,groupsError:n,refetchGroups:r}=Ln(),[s,i]=y.useState(""),[o,l]=y.useState(KH),c=y.useMemo(()=>{const u=new Set;return t.forEach(h=>h.groupType&&u.add(h.groupType)),[...u]},[t]),d=y.useMemo(()=>{const u=s.trim().toLowerCase();return t.filter(h=>!(o!==KH&&h.groupType!==o||u&&!h.name.toLowerCase().includes(u)))},[t,s,o]);return a.jsxs(it.div,{initial:{opacity:0},animate:{opacity:1},className:"mx-auto max-w-6xl space-y-5 lg:p-6",children:[a.jsx(Bm,{title:"Spaces",description:"Your spaces — type, access, membership and who can post."}),a.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row sm:items-center",children:[a.jsxs("div",{className:"relative flex-1",children:[a.jsx(hs,{className:"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground"}),a.jsx(Oe,{value:s,onChange:u=>i(u.target.value),placeholder:"Search spaces…",className:"pl-9"})]}),a.jsxs(zn,{value:o,onValueChange:l,children:[a.jsx(On,{className:"w-full sm:w-48",children:a.jsx(Vn,{placeholder:"All types"})}),a.jsxs(Fn,{children:[a.jsx(pt,{value:KH,children:"All types"}),c.map(u=>a.jsx(pt,{value:u,children:zet(u)},u))]})]})]}),a.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card shadow-card",children:e?a.jsx(FS,{rows:6,columns:5}):n?a.jsx(BS,{onRetry:()=>r()}):d.length===0?a.jsx(Df,{icon:dee,title:"No spaces found",description:s||o!==KH?"Try a different search or type.":"Your community's spaces will appear here."}):a.jsx("div",{className:"overflow-x-auto",children:a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border text-left text-xs uppercase tracking-wide text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-3 font-medium",children:"Space"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Type"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Members"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Sections"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Access"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Who can post"}),a.jsx("th",{className:"px-4 py-3"})]})}),a.jsx("tbody",{children:d.map(u=>{var h;return a.jsxs("tr",{className:"border-b border-border/60 transition-colors last:border-0 hover:bg-muted/60",children:[a.jsx("td",{className:"px-4 py-3",children:a.jsxs("div",{className:"flex items-center gap-2",children:[a.jsx("span",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded bg-muted text-xs",children:$1s(u)}),a.jsx("span",{className:"max-w-[280px] truncate font-medium text-foreground",children:u.name})]})}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:zet(u.groupType)}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:(u.userCount??0).toLocaleString()}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:(u.tabs??[]).length}),a.jsx("td",{className:"px-4 py-3",children:a.jsx(F1s,{private_:!!u.isOnlyVisibleToMembers})}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:O1s(u)}),a.jsx("td",{className:"px-4 py-3 text-right",children:a.jsx(Z,{variant:"ghost",size:"sm",asChild:!0,children:a.jsxs(vr,{to:ve.group(((h=u.meta)==null?void 0:h.slug)??u.id),children:[a.jsx(bo,{className:"mr-1.5 h-4 w-4"})," Open"]})})})]},u.id)})})]})})})]})}const rme=[{bg:"#EEF2FF",text:"#4338CA"},{bg:"#ECFDF5",text:"#047857"},{bg:"#FEF2F2",text:"#B91C1C"},{bg:"#FFFBEB",text:"#B45309"},{bg:"#F0F9FF",text:"#0369A1"},{bg:"#FDF4FF",text:"#A21CAF"},{bg:"#F1F5F9",text:"#334155"}];function U1s({topic:t}){return a.jsx("span",{className:"inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium",style:{backgroundColor:t.bgColor,color:t.textColor},children:t.name})}function z1s(){const{communityId:t}=eMe(),{toast:e}=yt(),n=w1s(t),r=k1s(t),s=S1s(t),i=C1s(t),o=j1s(t),[l,c]=y.useState(!1),[d,u]=y.useState(null),[h,m]=y.useState(""),[f,p]=y.useState(0),[g,v]=y.useState(null),b=n.data??[],x=()=>{u(null),m(""),p(0),c(!0)},w=E=>{u(E),m(E.name);const N=rme.findIndex(A=>A.bg.toLowerCase()===(E.bgColor||"").toLowerCase());p(N>=0?N:0),c(!0)},k=()=>{const E=h.trim();if(!E)return;const N=rme[f],A={name:E,bgColor:N.bg,textColor:N.text};d?s.mutate({topicId:d.id,body:A},{onSuccess:()=>{e({title:"Topic updated"}),c(!1)},onError:()=>e({title:"Could not update topic",variant:"destructive"})}):r.mutate(A,{onSuccess:()=>{e({title:"Topic created"}),c(!1)},onError:()=>e({title:"Could not create topic",variant:"destructive"})})},S=E=>{i.mutate(E.id,{onSuccess:()=>e({title:E.status==="ARCHIVED"?"Topic unarchived":"Topic archived"}),onError:()=>e({title:"Could not update topic",variant:"destructive"})})},C=E=>{o.mutate(E.id,{onSuccess:()=>{e({title:"Topic deleted"}),v(null)},onError:()=>e({title:"Could not delete topic",variant:"destructive"})})},j=r.isPending||s.isPending;return a.jsxs(it.div,{initial:{opacity:0},animate:{opacity:1},className:"mx-auto max-w-5xl space-y-5 lg:p-6",children:[a.jsx(Bm,{title:"Topics",description:"Categorize your content and let members filter spaces by topic.",actions:a.jsxs(Z,{onClick:x,children:[a.jsx(Dn,{className:"mr-1.5 h-4 w-4"})," New topic"]})}),a.jsx("div",{className:"overflow-hidden rounded-xl border border-border bg-card shadow-card",children:n.isLoading?a.jsx(FS,{rows:5,columns:4}):n.isError?a.jsx(BS,{onRetry:()=>n.refetch()}):b.length===0?a.jsx(Df,{icon:CSe,title:"No topics yet",description:"Categorize your content and allow members to filter spaces with the topic navigation bar.",action:a.jsxs(Z,{onClick:x,children:[a.jsx(Dn,{className:"mr-1.5 h-4 w-4"})," New topic"]})}):a.jsxs("table",{className:"w-full text-sm",children:[a.jsx("thead",{children:a.jsxs("tr",{className:"border-b border-border text-left text-xs uppercase tracking-wide text-muted-foreground",children:[a.jsx("th",{className:"px-4 py-3 font-medium",children:"Topic"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Posts"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Status"}),a.jsx("th",{className:"px-4 py-3 font-medium",children:"Created by"}),a.jsx("th",{className:"px-4 py-3"})]})}),a.jsx("tbody",{children:b.map(E=>{var N;return a.jsxs("tr",{className:"border-b border-border/60 transition-colors last:border-0 hover:bg-muted/60",children:[a.jsx("td",{className:"px-4 py-3",children:a.jsx(U1s,{topic:E})}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:E.postCount??0}),a.jsx("td",{className:"px-4 py-3",children:a.jsx("span",{className:ee("inline-flex items-center rounded-full border px-2 py-0.5 text-xs font-medium capitalize",E.status==="ARCHIVED"?"border-muted-foreground/20 bg-muted text-muted-foreground":"border-success/30 bg-success/10 text-success"),children:E.status==="ARCHIVED"?"Archived":"Active"})}),a.jsx("td",{className:"px-4 py-3 text-muted-foreground",children:((N=E.createdBy)==null?void 0:N.name)??"—"}),a.jsx("td",{className:"px-4 py-3 text-right",children:a.jsxs(Tr,{children:[a.jsx(_r,{asChild:!0,children:a.jsx(Z,{variant:"ghost",size:"icon",className:"h-7 w-7",children:a.jsx(Ys,{className:"h-4 w-4"})})}),a.jsxs(Cr,{align:"end",children:[a.jsxs(ot,{onClick:()=>w(E),children:[a.jsx(Qs,{className:"mr-2 h-4 w-4"})," Edit"]}),a.jsx(ot,{onClick:()=>S(E),children:E.status==="ARCHIVED"?a.jsxs(a.Fragment,{children:[a.jsx(krt,{className:"mr-2 h-4 w-4"})," Unarchive"]}):a.jsxs(a.Fragment,{children:[a.jsx(uSe,{className:"mr-2 h-4 w-4"})," Archive"]})}),a.jsx(mi,{}),a.jsxs(ot,{className:"text-destructive focus:text-destructive",onClick:()=>v(E),children:[a.jsx(qn,{className:"mr-2 h-4 w-4"})," Delete"]})]})]})})]},E.id)})})]})}),a.jsx(Bt,{open:l,onOpenChange:c,children:a.jsxs(Ft,{children:[a.jsx(Vt,{children:a.jsx(Ut,{children:d?"Edit topic":"New topic"})}),a.jsxs("div",{className:"space-y-4",children:[a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{htmlFor:"topic-name",children:"Name"}),a.jsx(Oe,{id:"topic-name",value:h,onChange:E=>m(E.target.value),placeholder:"e.g. Announcements",autoFocus:!0})]}),a.jsxs("div",{className:"space-y-1.5",children:[a.jsx(_e,{children:"Colour"}),a.jsx("div",{className:"flex flex-wrap gap-2",children:rme.map((E,N)=>a.jsx("button",{type:"button",onClick:()=>p(N),className:ee("rounded-full px-2.5 py-0.5 text-xs font-medium ring-2 ring-offset-1 transition",f===N?"ring-foreground/40":"ring-transparent"),style:{backgroundColor:E.bg,color:E.text},children:h.trim()||"Topic"},E.bg))})]})]}),a.jsxs(ir,{children:[a.jsx(Z,{variant:"ghost",onClick:()=>c(!1),children:"Cancel"}),a.jsx(Z,{disabled:!h.trim()||j,onClick:k,children:d?"Save":"Create"})]})]})}),a.jsx(Cl,{open:!!g,onOpenChange:E=>!E&&v(null),title:"Delete this topic?",description:"The topic will be removed from your community and unlinked from posts. This cannot be undone.",confirmLabel:"Delete",onConfirm:()=>g&&C(g)})]})}const Vet="pensil-community-font";function Het(t){return typeof t=="string"?t:""}function V1s(){const{communityDetail:t}=Ln(),e=t==null?void 0:t.configurables,n=Het(e==null?void 0:e[uge]),r=Het(e==null?void 0:e[hge]),s=y.useRef(null);return y.useEffect(()=>{var o;if((o=document.getElementById(Vet))==null||o.remove(),!n){s.current&&(document.body.style.fontFamily="",s.current=null);return}const i=document.createElement("link");return i.id=Vet,i.rel="stylesheet",i.href=n,document.head.appendChild(i),r&&(document.body.style.fontFamily=`"${r}", sans-serif`,s.current=r),()=>{i.remove()}},[n,r]),null}function H1s(){var n;const t=ev();if(t.phase==="idle")return null;const e=t.minimized?a.jsx(uks,{}):a.jsx(sks,{});return Vg.createPortal(a.jsxs(a.Fragment,{children:[t.phase==="incoming"&&a.jsx(rks,{}),t.phase==="elsewhere"&&a.jsx(mks,{}),t.phase==="rejoin"&&a.jsx(fks,{}),t.token?a.jsx(G1s,{token:t.token,video:((n=t.call)==null?void 0:n.media)==="video",children:e},t.token):["outgoing","connecting","ended"].includes(t.phase)&&e]}),document.body)}function G1s({token:t,video:e,children:n}){const[r,s]=qgt(),i=y.useRef(!1);return y.useEffect(()=>{s({authToken:t,defaults:{audio:!0,video:e}}).catch(()=>{He.error("Couldn't connect the call")})},[t]),y.useEffect(()=>{if(!(!r||i.current))return i.current=!0,Promise.resolve(r.join()).catch(()=>He.error("Couldn't connect the call")),()=>{Promise.resolve(r.leave()).catch(()=>{})}},[r]),r?a.jsxs(Wgt,{value:r,children:[a.jsx(q1s,{}),a.jsx(K1s,{}),a.jsx(Vwt,{meeting:r}),a.jsx(Y1s,{children:a.jsx(eks,{children:a.jsx(W1s,{children:n})})})]}):a.jsx(a.Fragment,{children:n})}const D6t=y.createContext(!1),W1s=({children:t})=>a.jsx(D6t.Provider,{value:!0,children:t}),$6t=()=>y.useContext(D6t);function q1s(){const{phase:t,call:e,markConnected:n,hangUp:r}=ev(),s=Ns(l=>l.self.roomJoined),i=Ns(l=>l.participants.joined.size),o=y.useRef(!1);return y.useEffect(()=>{s&&n()},[s,n]),y.useEffect(()=>{if(i>0&&(o.current=!0),(e==null?void 0:e.kind)==="group"||t!=="in-call"||!o.current||i>0)return;const l=setTimeout(()=>void r(),2e4);return()=>clearTimeout(l)},[i,t,r,e==null?void 0:e.kind]),null}const Get={audio:"Your browser is blocking the microphone. Allow it for this site (the icon in the address bar) so others can hear you.",video:"Your browser is blocking the camera. Allow it for this site (the icon in the address bar) so others can see you.",screenshare:"Screen sharing was blocked by your browser."},cD=t=>He.error(Get[t]??Get.audio,{id:`call-blocked-${t}`});function K1s(){const{meeting:t}=Vc();return y.useEffect(()=>{const e=({kind:r,message:s})=>{r==="screenshare"&&/cancel/i.test(String(s))||cD(r)},n=t.self;return n.on("mediaPermissionError",e),()=>n.off("mediaPermissionError",e)},[t]),null}const rMe=y.createContext({}),fke=t=>t===void 0||t>=7?"good":t>=4?"fair":"poor";function Y1s({children:t}){const{meeting:e}=Vc(),[n,r]=y.useState({});y.useEffect(()=>{const i=c=>{c.isScreenshare||!c.participantId||r(d=>({...d,[c.participantId]:{...d[c.participantId],[c.kind]:c.score}}))},o=e.self,l=e.participants.joined;return o.on("mediaScoreUpdate",i),l.on("mediaScoreUpdate",i),()=>{o.off("mediaScoreUpdate",i),l.off("mediaScoreUpdate",i)}},[e]);const s=y.useMemo(()=>Object.fromEntries(Object.entries(n).map(([i,o])=>[i,Math.min(...Object.values(o))])),[n]);return a.jsx(rMe.Provider,{value:s,children:t})}function Q1s(t){const e=y.useContext(rMe);return fke(t?e[t]:void 0)}function sMe({participantId:t}){const e=Q1s(t);if(e==="good")return null;const n=e==="poor"?h9t:m9t;return a.jsx("span",{className:ee("absolute left-2 top-2 rounded-full bg-black/60 p-1",e==="poor"?"text-red-400":"text-amber-300"),title:e==="poor"?"Poor connection":"Unstable connection","aria-label":e==="poor"?"Poor connection":"Unstable connection",children:a.jsx(n,{className:"h-3.5 w-3.5"})})}function Z1s(){const{call:t}=ev(),e=y.useContext(rMe),n=Ns(i=>i.self.id),r=Ns(i=>i.participants.joined.toArray()[0]);let s=null;return fke(e[n])==="poor"?s="Your connection is weak — video may freeze":(t==null?void 0:t.kind)!=="group"&&r&&fke(e[r.id])==="poor"&&(s=`${(r.name??"Their").split(" ")[0]}'s connection is weak`),s?a.jsx("div",{className:"pointer-events-none absolute inset-x-0 top-16 flex justify-center",children:a.jsxs("span",{className:"flex items-center gap-1.5 rounded-full bg-black/70 px-3 py-1 text-xs text-amber-200",children:[a.jsx(j9t,{className:"h-3.5 w-3.5"}),s]})}):null}const O6t=y.createContext({supported:!1,open:!1,toggle:()=>{}}),J1s=()=>y.useContext(O6t);function X1s(t){for(const n of Array.from(document.styleSheets))try{const r=t.document.createElement("style");r.textContent=Array.from(n.cssRules).map(s=>s.cssText).join(`
`),t.document.head.appendChild(r)}catch{if(n.href){const r=t.document.createElement("link");r.rel="stylesheet",r.href=n.href,t.document.head.appendChild(r)}}t.document.documentElement.className=document.documentElement.className;const e=document.documentElement.getAttribute("style");e&&t.document.documentElement.setAttribute("style",e),t.document.body.className="m-0 bg-neutral-950"}function eks({children:t}){const e=typeof window<"u"&&"documentPictureInPicture"in window,[n,r]=y.useState(null),s=y.useCallback(async()=>{if(n){n.close();return}try{const l=await window.documentPictureInPicture.requestWindow({width:360,height:300});X1s(l),l.addEventListener("pagehide",()=>r(null)),r(l)}catch{He.error("Couldn't pop out the call")}},[n]);y.useEffect(()=>()=>n==null?void 0:n.close(),[n]);const i=y.useMemo(()=>({supported:e,open:!!n,toggle:()=>void s()}),[e,n,s]);return a.jsxs(O6t.Provider,{value:i,children:[t,n&&Vg.createPortal(a.jsx(tks,{onBack:()=>{window.focus(),n.close()}}),n.document.body)]})}function tks({onBack:t}){const{display:e,hangUp:n}=ev(),r=iMe(),s=Ns(c=>c.participants.joined.toArray().find(d=>d.videoEnabled)??c.participants.joined.toArray()[0]),o=Ns(c=>c.participants.joined.toArray().some(d=>d.videoEnabled))&&(s!=null&&s.videoEnabled)?s.videoTrack:null,l=Ns(c=>c.self.videoEnabled?c.self.videoTrack:null);return a.jsxs("div",{className:"relative flex h-screen w-screen flex-col bg-neutral-950 text-white",children:[a.jsxs("div",{className:"relative min-h-0 flex-1",children:[o?a.jsx(Wet,{track:o,className:"h-full w-full object-cover"}):a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-2",children:[a.jsx(U9,{person:s?{name:s.name,picture:s.picture}:e,size:"md"}),a.jsx("p",{className:"text-sm font-semibold",children:(s==null?void 0:s.name)??e.name})]}),l&&a.jsx(Wet,{track:l,mirrored:!0,className:"absolute bottom-2 right-2 h-20 w-16 rounded-lg border border-white/20 object-cover"}),a.jsx("div",{className:"absolute left-2 top-2 rounded-full bg-black/50 px-2.5 py-0.5 text-xs tabular-nums",children:r})]}),a.jsxs("div",{className:"flex items-center justify-center gap-2 p-2",children:[a.jsx(aMe,{video:!0,size:"sm"}),a.jsx(cm,{onClick:t,label:"Back to the call tab",size:"sm",children:a.jsx(bo,{className:"h-4 w-4"})}),a.jsx(cm,{onClick:()=>void n(),label:"End call",tone:"danger",size:"sm",children:a.jsx(aI,{className:"h-4 w-4"})})]})]})}function Wet({track:t,mirrored:e,className:n}){const r=y.useRef(null);return y.useEffect(()=>{r.current&&(r.current.srcObject=new MediaStream([t]))},[t]),a.jsx("video",{ref:r,autoPlay:!0,playsInline:!0,muted:!0,className:ee(e&&"-scale-x-100",n)})}function U9({person:t,size:e}){const[n,r]=y.useState(!1),s=e==="lg"?"h-28 w-28 text-3xl":e==="md"?"h-16 w-16 text-xl":"h-10 w-10 text-sm",i=((t==null?void 0:t.name)??"?").split(" ").map(o=>o[0]).filter(Boolean).join("").slice(0,2).toUpperCase();return t!=null&&t.picture&&!n?a.jsx("img",{src:t.picture,alt:"",onError:()=>r(!0),className:ee("rounded-full object-cover",s)}):a.jsx("div",{className:ee("flex items-center justify-center rounded-full bg-white/15 font-semibold text-white",s),children:i})}function nks(t){const[,e]=y.useState(0);return y.useEffect(()=>{if(!t)return;const n=setInterval(()=>e(r=>r+1),1e3);return()=>clearInterval(n)},[t]),t?rie((Date.now()-new Date(t).getTime())/1e3):null}function iMe(){const{phase:t,call:e,endedLabel:n}=ev(),r=nks(t==="in-call"?e==null?void 0:e.startedAt:null);return t==="ended"?n??"Call ended":t==="outgoing"?e!=null&&e.id?"Ringing…":"Calling…":t==="connecting"?"Connecting…":t==="in-call"?r??"Connected":""}function cm({onClick:t,label:e,tone:n="neutral",active:r=!0,size:s="lg",children:i,disabled:o}){return a.jsx("button",{type:"button",onClick:t,"aria-label":e,title:e,disabled:o,className:ee("flex shrink-0 items-center justify-center rounded-full transition-colors disabled:opacity-50",s==="lg"?"h-14 w-14":"h-9 w-9",n==="danger"&&"bg-red-600 text-white hover:bg-red-500",n==="accept"&&"bg-emerald-600 text-white hover:bg-emerald-500",n==="neutral"&&(r?"bg-white/15 text-white hover:bg-white/25":"bg-white text-neutral-900 hover:bg-white/90")),children:i})}function rks(){const{call:t,display:e,accept:n,decline:r}=ev();if(!t)return null;const s=t.media==="video",i=t.kind==="group";return a.jsx("div",{className:"fixed inset-0 z-[120] flex items-end justify-center bg-black/40 p-4 sm:items-center",role:"dialog","aria-modal":"true","aria-label":"Incoming call",children:a.jsxs(it.div,{initial:{y:24,scale:.98},animate:{y:0,scale:1},className:"w-full max-w-sm rounded-2xl bg-neutral-900 p-6 text-center text-white shadow-2xl",children:[a.jsxs("div",{className:"relative mx-auto mb-4 h-24 w-24",children:[a.jsx("span",{className:"absolute inset-0 animate-ping rounded-full bg-emerald-500/30"}),a.jsx("div",{className:"relative flex h-24 w-24 items-center justify-center",children:a.jsx(U9,{person:i&&e.picture?e:t.caller,size:"lg"})})]}),a.jsx("p",{className:"text-lg font-semibold",children:t.caller.name??"Someone"}),i&&a.jsxs("p",{className:"mt-0.5 flex items-center justify-center gap-1 text-sm text-white/80",children:[a.jsx(wr,{className:"h-3.5 w-3.5"}),e.name]}),a.jsx("p",{className:"mt-1 text-sm text-white/70",children:`Incoming ${i?"group ":""}${s?"video":"audio"} call…`}),a.jsxs("div",{className:"mt-6 flex items-center justify-center gap-10",children:[a.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[a.jsx(cm,{onClick:()=>void r(),label:"Decline",tone:"danger",children:a.jsx(aI,{className:"h-6 w-6"})}),a.jsx("span",{className:"text-xs text-white/70",children:"Decline"})]}),a.jsxs("div",{className:"flex flex-col items-center gap-1.5",children:[a.jsx(cm,{onClick:()=>void n(),label:"Accept",tone:"accept",children:s?a.jsx(Ca,{className:"h-6 w-6"}):a.jsx(rS,{className:"h-6 w-6"})}),a.jsx("span",{className:"text-xs text-white/70",children:"Accept"})]})]})]})})}function sks(){const{call:t,display:e,phase:n,hangUp:r,setMinimized:s}=ev(),i=$6t(),o=iMe(),[l,c]=y.useState(!1),d=(t==null?void 0:t.media)==="video",u=(t==null?void 0:t.kind)==="group",h=n==="ended";return a.jsxs("div",{className:"fixed inset-0 z-[110] flex flex-col bg-neutral-950 text-white",role:"dialog","aria-label":`Call with ${e.name||"member"}`,children:[a.jsxs("div",{className:"relative min-h-0 flex-1",children:[i&&!h?a.jsx(aks,{display:e,status:o,group:u,video:d,ringing:n==="outgoing"}):a.jsx(Nae,{person:e,status:o,ringing:n==="outgoing"}),i&&!h&&a.jsx(Z1s,{}),a.jsxs("div",{className:"absolute inset-x-0 top-0 flex items-center justify-between p-4",children:[h?a.jsx("span",{}):a.jsx("button",{type:"button",onClick:()=>s(!0),className:"rounded-full bg-black/40 p-2 text-white/90 hover:bg-black/60","aria-label":"Minimise call",title:"Minimise — keep using Pensil",children:a.jsx(Hrt,{className:"h-5 w-5"})}),(d||u)&&i&&!h&&a.jsxs("div",{className:"rounded-full bg-black/40 px-3 py-1 text-sm",children:[a.jsx("span",{className:"font-medium",children:e.name}),a.jsx("span",{className:"ml-2 tabular-nums text-white/70",children:o})]}),i&&!h?a.jsx(iks,{}):a.jsx("span",{className:"w-9"})]})]}),!h&&a.jsxs("div",{className:"flex items-center justify-center gap-4 px-4 pb-8 pt-4",children:[i&&a.jsx(aMe,{video:d,onSettings:()=>c(!0)}),a.jsx(cm,{onClick:()=>void r(),label:n==="outgoing"?"Cancel call":"End call",tone:"danger",children:a.jsx(aI,{className:"h-6 w-6"})})]}),i&&l&&a.jsx(CCt,{open:!0,onClose:()=>c(!1),canUseCamera:d,canUseMic:!0})]})}function iks(){const t=J1s();return t.supported?a.jsx("button",{type:"button",onClick:t.toggle,className:"rounded-full bg-black/40 p-2 text-white/90 hover:bg-black/60","aria-label":t.open?"Close pop-out window":"Pop out the call",title:t.open?"Close pop-out window":"Pop out — keep the call on top of other windows",children:a.jsx(Xrt,{className:"h-5 w-5"})}):a.jsx("span",{className:"w-9"})}function aks({display:t,status:e,group:n,video:r,ringing:s}){const i=Ns(o=>o.self.screenShareEnabled?o.self:o.participants.joined.toArray().find(l=>l.screenShareEnabled));return i?a.jsx(oks,{presenterId:i.id}):n?a.jsx(cks,{display:t,status:e}):r?a.jsx(lks,{display:t,status:e}):a.jsx(Nae,{person:t,status:e,ringing:s})}function oks({presenterId:t}){const{meeting:e}=Vc(),n=Ns(o=>o.self),r=Ns(o=>o.participants.joined.toArray()),s=n.id===t,i=s?n:r.find(o=>o.id===t);return a.jsxs("div",{className:"flex h-full w-full flex-col gap-2 p-3 pt-16",children:[a.jsx("div",{className:"relative min-h-0 flex-1 overflow-hidden rounded-xl bg-black",children:s?a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-3 text-center",children:[a.jsx(rst,{className:"h-10 w-10 text-emerald-400"}),a.jsx("p",{className:"text-lg font-semibold",children:"You're sharing your screen"}),a.jsx("button",{type:"button",onClick:()=>void e.self.disableScreenShare().catch(()=>{}),className:"rounded-full bg-red-600 px-4 py-1.5 text-sm font-semibold hover:bg-red-500",children:"Stop sharing"})]}):i?a.jsxs(a.Fragment,{children:[a.jsx(Hwt,{meeting:e,participant:i,className:"h-full w-full"}),a.jsxs("span",{className:"absolute left-2 top-2 rounded-full bg-black/60 px-2.5 py-0.5 text-xs",children:[(i.name??"Someone").split(" ")[0]," is sharing"]})]}):null}),a.jsx("div",{className:"flex h-24 shrink-0 gap-2 overflow-x-auto",children:[n,...r].map(o=>a.jsxs("div",{className:"relative aspect-video h-full shrink-0 overflow-hidden rounded-lg bg-neutral-800",children:[a.jsxs(by,{meeting:e,participant:o,className:"h-full w-full rounded-none",children:[a.jsx(xM,{participant:o,size:"sm"}),a.jsx($re,{participant:o,meeting:e,size:"sm"})]}),a.jsx(sMe,{participantId:o.id})]},o.id))})]})}function Nae({person:t,status:e,ringing:n}){return a.jsxs("div",{className:"flex h-full flex-col items-center justify-center gap-4 px-6 text-center",children:[a.jsxs("div",{className:"relative",children:[n&&a.jsx("span",{className:"absolute inset-0 animate-ping rounded-full bg-white/10"}),a.jsx("div",{className:"relative",children:a.jsx(U9,{person:t,size:"lg"})})]}),a.jsxs("div",{children:[a.jsx("p",{className:"text-2xl font-semibold",children:(t==null?void 0:t.name)??""}),a.jsx("p",{className:"mt-1 text-sm tabular-nums text-white/70",children:e})]})]})}function lks({display:t,status:e}){const{meeting:n}=Vc(),r=Ns(l=>l.participants.joined.toArray()[0]),s=Ns(l=>{var c;return((c=l.participants.joined.toArray()[0])==null?void 0:c.videoEnabled)??!1}),i=Ns(l=>l.self),o=Ns(l=>l.self.videoEnabled);return r?a.jsxs("div",{className:"relative h-full w-full",children:[s?a.jsx(by,{meeting:n,participant:r,className:"h-full w-full rounded-none"}):a.jsx(Nae,{person:t,status:`${e} · camera off`,ringing:!1}),a.jsx("div",{className:"absolute left-2 top-14",children:a.jsx(sMe,{participantId:r.id})}),a.jsx("div",{className:"absolute bottom-4 right-4 h-36 w-28 overflow-hidden rounded-xl border border-white/20 bg-neutral-800 shadow-lg sm:h-44 sm:w-32",children:o?a.jsx(by,{meeting:n,participant:i,className:"h-full w-full rounded-none"}):a.jsx("div",{className:"flex h-full items-center justify-center text-xs text-white/60",children:"Camera off"})})]}):a.jsxs("div",{className:"relative h-full w-full",children:[o?a.jsx(by,{meeting:n,participant:i,className:"h-full w-full rounded-none"}):null,a.jsxs("div",{className:"pointer-events-none absolute inset-0 flex flex-col items-center justify-center gap-3 bg-black/30 text-center",children:[a.jsx(U9,{person:t,size:"md"}),a.jsx("p",{className:"text-xl font-semibold",children:t.name}),a.jsx("p",{className:"text-sm text-white/80",children:e})]})]})}function cks({display:t,status:e}){const{meeting:n}=Vc(),r=Ns(c=>c.participants.joined.toArray()),s=Ns(c=>c.self),i=Ns(c=>c.participants.lastActiveSpeaker),o=[s,...r];if(!r.length)return a.jsx(Nae,{person:t,status:e==="Connected"?"Waiting for others to join…":e,ringing:!0});const l=o.length<=1?1:o.length<=4?2:o.length<=6?3:4;return a.jsx("div",{className:"h-full w-full p-3 pt-16",children:a.jsx("div",{className:"grid h-full w-full gap-2",style:{gridTemplateColumns:`repeat(${l}, minmax(0, 1fr))`,gridAutoRows:"1fr"},children:o.map(c=>a.jsxs("div",{className:ee("relative min-h-0 overflow-hidden rounded-xl border-2 bg-neutral-800",c.id===i&&c.id!==s.id?"border-emerald-400":"border-transparent"),children:[a.jsxs(by,{meeting:n,participant:c,className:"h-full w-full rounded-none",children:[a.jsx(xM,{participant:c,size:"md"}),a.jsx($re,{participant:c,meeting:n,size:"sm"})]}),a.jsx(sMe,{participantId:c.id})]},c.id))})})}const F6t=()=>{var t;return typeof window<"u"&&!!((t=window.matchMedia)!=null&&t.call(window,"(pointer: coarse)").matches)},dks=()=>{var t;return typeof navigator<"u"&&!!((t=navigator.mediaDevices)!=null&&t.getDisplayMedia)&&!F6t()};function aMe({video:t,onSettings:e,size:n="lg"}){const{meeting:r}=Vc(),{upgradeToVideo:s}=ev(),i=Ns(x=>x.self.audioEnabled),o=Ns(x=>x.self.videoEnabled),l=Ns(x=>x.self.screenShareEnabled),c=n==="lg"?"h-6 w-6":"h-4 w-4",d=F6t(),{devices:u,current:h,setDevice:m}=B_e(d&&t),f=u.video,p=async()=>{const x=f.findIndex(k=>k.deviceId===h.video),w=f[(x+1)%f.length];w&&!await m("video",w.deviceId)&&He.error("Couldn't switch camera")},g=async()=>{try{l?await r.self.disableScreenShare():await r.self.enableScreenShare()}catch{}},v=async()=>{try{i?await r.self.disableAudio():(await r.self.enableAudio(),r.self.audioEnabled||cD("audio"))}catch{cD("audio")}},b=async()=>{try{o?await r.self.disableVideo():(await r.self.enableVideo(),r.self.videoEnabled||cD("video"))}catch{cD("video")}};return a.jsxs(a.Fragment,{children:[a.jsx(cm,{onClick:()=>void v(),label:i?"Mute":"Unmute",active:i,size:n,children:i?a.jsx(Vx,{className:c}):a.jsx(yk,{className:c})}),t?a.jsx(cm,{onClick:()=>void b(),label:o?"Turn camera off":"Turn camera on",active:o,size:n,children:o?a.jsx(Ca,{className:c}):a.jsx(S2,{className:c})}):a.jsx(cm,{onClick:()=>void s(),label:"Switch to video",active:!1,size:n,children:a.jsx(S2,{className:c})}),t&&d&&o&&f.length>1&&a.jsx(cm,{onClick:()=>void p(),label:"Flip camera",size:n,children:a.jsx(b9t,{className:c})}),t&&dks()&&a.jsx(cm,{onClick:()=>void g(),label:l?"Stop sharing your screen":"Share your screen",active:!l,size:n,children:l?a.jsx(c9t,{className:c}):a.jsx(rst,{className:c})}),e&&a.jsx(cm,{onClick:e,label:"Audio and video settings",size:n,children:a.jsx(w2,{className:c})})]})}function uks(){const{call:t,display:e,phase:n,hangUp:r,setMinimized:s}=ev(),i=$6t(),o=iMe(),l=(t==null?void 0:t.media)==="video",c=y.useRef(null);return a.jsx("div",{ref:c,className:"pointer-events-none fixed inset-3 z-[110]",children:a.jsxs(it.div,{drag:!0,dragConstraints:c,dragMomentum:!1,className:"pointer-events-auto absolute bottom-0 right-0 w-64 cursor-grab overflow-hidden rounded-2xl bg-neutral-900 text-white shadow-2xl active:cursor-grabbing",role:"dialog","aria-label":`Call with ${e.name||"member"} (minimised)`,children:[l&&i&&n!=="ended"?a.jsx("div",{className:"h-36 w-full bg-black",children:a.jsx(hks,{})}):null,a.jsxs("div",{className:"flex items-center gap-3 p-3",children:[a.jsx(U9,{person:e,size:"sm"}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"truncate text-sm font-semibold",children:e.name}),a.jsx("p",{className:"truncate text-xs tabular-nums text-white/70",children:o})]})]}),n!=="ended"&&a.jsxs("div",{className:"flex items-center justify-center gap-2 px-3 pb-3",children:[i&&a.jsx(aMe,{video:l,size:"sm"}),a.jsx(cm,{onClick:()=>s(!1),label:"Back to call",size:"sm",children:a.jsx(fSe,{className:"h-4 w-4"})}),a.jsx(cm,{onClick:()=>void r(),label:"End call",tone:"danger",size:"sm",children:a.jsx(aI,{className:"h-4 w-4"})})]})]})})}function hks(){const{meeting:t}=Vc(),e=Ns(s=>s.participants.joined.toArray()[0]),n=Ns(s=>s.self),r=e??n;return a.jsx(by,{meeting:t,participant:r,className:"h-full w-full rounded-none"})}function mks(){const{display:t}=ev();return a.jsxs("div",{className:"fixed bottom-4 right-4 z-[100] flex items-center gap-2 rounded-full bg-neutral-900 px-4 py-2 text-sm text-white shadow-lg",children:[a.jsx(rS,{className:"h-4 w-4 text-emerald-400"}),"On a call with ",t.name||"someone"," in another tab"]})}function fks(){const{display:t,call:e,rejoin:n}=ev(),[r,s]=y.useState(!1);return a.jsxs("div",{className:"fixed bottom-4 right-4 z-[100] flex items-center gap-3 rounded-2xl bg-neutral-900 px-4 py-3 text-sm text-white shadow-lg",children:[a.jsx(rS,{className:"h-4 w-4 text-emerald-400"}),a.jsxs("span",{children:["Your call with ",t.name||"someone"," is still going"]}),a.jsx("button",{type:"button",disabled:r,onClick:()=>{s(!0),n().finally(()=>s(!1))},className:"rounded-full bg-emerald-600 px-3 py-1 font-medium hover:bg-emerald-500",children:"Rejoin"}),a.jsx("button",{type:"button",disabled:r,onClick:()=>{e&&(s(!0),YRt(e.id).catch(()=>{}))},className:"rounded-full bg-white/15 px-3 py-1 font-medium hover:bg-white/25",children:"End"})]})}const nf=t=>typeof t=="string"&&t.trim()?t:void 0;function Eb(t,e){if(!t)return null;if(typeof t=="string")return{id:t};const n=nf(t.id)??nf(t._id);if(!n)return null;const r=nf(t[e]);return{id:n,...r?{[e]:r}:{}}}function pks(t){if(!t||typeof t!="object")return null;const e=t,n=nf(e.title),r=nf(e.description)??nf(e.message);if(!n&&!r)return null;const s=Eb(e.from,"name"),i=e.from&&typeof e.from=="object"?nf(e.from.picture):void 0;return{id:nf(e.id)??nf(e._id)??"",title:n??"New notification",description:r,type:nf(e.type),from:s?{...s,...i?{picture:i}:{}}:null,post:Eb(e.post,"title"),group:Eb(e.group,"name"),tab:Eb(e.tab,"name"),community:Eb(e.community,"name"),knowledgeHubResource:Eb(e.knowledgeHubResource,"title"),course:Eb(e.course,"title"),event:Eb(e.event,"title"),subscriptionPlan:Eb(e.subscriptionPlan,"name"),liveUrl:nf(e.liveUrl)??null,...typeof e.impressionCount=="number"?{impressionCount:e.impressionCount}:{},createdAt:nf(e.createdAt)}}function gks(t=""){return/mention/.test(t)?Crt:/like|reaction/.test(t)?xx:/comment|reply|message/.test(t)?wd:t==="follow"?Sa:t.startsWith("group:")?wr:/live/.test(t)?wk:t==="post-create"?Ei:t==="event-reminder"?Ux:Lm}function vks({notification:t,onOpen:e,onDismiss:n}){var c,d,u,h;const r=((d=(c=t.from)==null?void 0:c.name)==null?void 0:d.trim())||"",s=o7((u=t.from)==null?void 0:u.picture,r),i=gks(t.type),o=a.jsxs(a.Fragment,{children:[a.jsxs("span",{className:"relative shrink-0",children:[a.jsxs(oo,{className:"h-10 w-10",children:[a.jsx(lo,{src:s,alt:""}),a.jsx(co,{children:(h=(r||"?")[0])==null?void 0:h.toUpperCase()})]}),a.jsx("span",{className:"absolute -bottom-1 -right-1 flex h-5 w-5 items-center justify-center rounded-full bg-primary text-primary-foreground ring-2 ring-popover",children:a.jsx(i,{className:"h-3 w-3",strokeWidth:2.5,"aria-hidden":"true"})})]}),a.jsxs("span",{className:"min-w-0 flex-1",children:[a.jsx("span",{className:"block text-sm leading-snug line-clamp-2",children:a.jsx(a2t,{notification:t})}),t.description&&a.jsx("span",{className:"mt-0.5 block text-xs text-muted-foreground line-clamp-1",children:t.description})]})]}),l="flex w-full items-center gap-3 rounded-xl py-3 pl-3.5 pr-10 text-left";return a.jsxs("div",{role:"status",className:"group/toast relative w-full rounded-xl border border-border bg-popover text-popover-foreground shadow-lg shadow-black/10 dark:shadow-black/40",children:[e?a.jsx("button",{type:"button",onClick:()=>{e(),n()},className:ee(l,"transition-colors hover:bg-muted/50 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"),children:o}):a.jsx("div",{className:l,children:o}),a.jsx("button",{type:"button",onClick:n,"aria-label":"Dismiss notification",className:"absolute right-2 top-2 flex h-6 w-6 items-center justify-center rounded-md text-muted-foreground opacity-0 transition-opacity hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring group-hover/toast:opacity-100 [@media(hover:none)]:opacity-100",children:a.jsx(nn,{className:"h-3.5 w-3.5","aria-hidden":"true"})})]})}const yks=30;function qet(t){return(typeof t=="number"&&Number.isInteger(t)&&t>=1&&t<=1440?t:yks)*60*1e3}const bks="event-reminder",B6t=t=>["event-reminders",t];function xks(t){const e=new Date(t);return Qln(e)?`Today at ${fo(e,"h:mm a")}`:fo(e,"EEE d MMM, h:mm a")}const wks=6e3,kks=1e3,Sks="!border-0 !bg-transparent !p-0 !shadow-none";function Cks(){const{socket:t,registered:e}=Qg(),{community:n}=qe(),{forceLogout:r}=jr(),s=(n==null?void 0:n.id)??null,i=rn(),o=Nn(),{groups:l}=Ln(),c=y.useRef(l);c.current=l;const d=y.useRef(o);return d.current=o,y.useEffect(()=>{!e||!s||i.invalidateQueries({queryKey:["community-detail",s]})},[e,s,i]),y.useEffect(()=>{if(!t)return;const u=()=>{He.error("You have been signed out."),r()},h=()=>{r(ve.blocked)},m=E=>{const N=pks(E==null?void 0:E.notification);if((N==null?void 0:N.type)===bks)i.invalidateQueries({queryKey:B6t(s)});else if(N){const A=lAe(N,c.current??[]);He.custom(_=>a.jsx(vks,{notification:N,onOpen:A?()=>d.current(A):void 0,onDismiss:()=>He.dismiss(_)}),{duration:wks,className:Sks})}i.invalidateQueries({queryKey:["user-counters"]}),i.invalidateQueries({queryKey:["notifications"]})},f=E=>{var A;const N=((A=E==null?void 0:E.message)==null?void 0:A.community)||(E==null?void 0:E.communityId);Kb(N,s??"")&&(i.invalidateQueries({queryKey:["direct-messages",s]}),i.invalidateQueries({queryKey:["dm-thread",s]}),i.invalidateQueries({queryKey:["dm-requests",s]}),i.invalidateQueries({queryKey:["user-counters"]}))};let p=0,g=null;const v=()=>{p=Date.now(),i.invalidateQueries({queryKey:["conversations",s]}),i.invalidateQueries({queryKey:["user-counters"]})},b=()=>{const E=kks-(Date.now()-p);E<=0?v():g||(g=setTimeout(()=>{g=null,v()},E))},x=E=>{var A;i.invalidateQueries({queryKey:["live-calls",s]});const N=(A=E==null?void 0:E.liveCall)==null?void 0:A.name;He(N?`Live now: ${N}`:"A live session just started")},w=()=>{i.invalidateQueries({queryKey:["live-calls",s]})},k=E=>{He(E!=null&&E.name?`Recording available: ${E.name}`:"A session recording is available")},S=()=>{i.invalidateQueries({queryKey:["leaderboard-my"]}),i.invalidateQueries({queryKey:["leaderboard"]}),i.invalidateQueries({queryKey:["streak"]})},C=()=>{i.invalidateQueries({queryKey:["community-detail",s]})},j=E=>{!s||(E==null?void 0:E.communityId)!==s||i.invalidateQueries({queryKey:["community-detail",s]})};return t.on("notification",m),t.on("direct-message:new-chat",f),t.on("direct-message:new-request",f),t.on("direct-message:request-resolved",f),t.on("direct-message:notification-count",f),t.on("conversation:new",b),t.on("conversation:notification-count",b),t.on("LOGOUT",u),t.on("user-blocked",h),t.on("live-call:start",x),t.on("live-call:end",w),t.on("live-call:recording-ready",k),t.on("REALTIME:KARMAPOINT_INCREMENT",S),t.on(HVe,j),s&&t.on(`community:${s}:user-count-change`,C),()=>{t.off("notification",m),t.off("direct-message:new-chat",f),t.off("direct-message:new-request",f),t.off("direct-message:request-resolved",f),t.off("direct-message:notification-count",f),t.off("conversation:new",b),t.off("conversation:notification-count",b),g&&clearTimeout(g),t.off("LOGOUT",u),t.off("user-blocked",h),t.off("live-call:start",x),t.off("live-call:end",w),t.off("live-call:recording-ready",k),t.off("REALTIME:KARMAPOINT_INCREMENT",S),t.off(HVe,j),s&&t.off(`community:${s}:user-count-change`,C)}},[t,s,i,r]),null}const jks=15e3,Eks="event-reminder-toast";function Nks(t,e,n){if(n.get(t)===e)return!0;try{return window.localStorage.getItem(t)===e}catch{return!1}}function Tks(t,e,n){n.set(t,e);try{window.localStorage.setItem(t,e)}catch{}}function _ks(){const{user:t}=jr(),{community:e}=qe(),{communityDetail:n}=Ln(),r=Nn(),s=(e==null?void 0:e.id)??null,i=!!(t!=null&&t.id&&s)&&!sF(n),{data:o}=lt({queryKey:B6t(s),enabled:i,queryFn:async()=>{const f=await EPe(s,new Date().toISOString());return{events:(f.events??[]).map(gg),leadMs:qet(f.reminderLeadMinutes)}},refetchInterval:6e4,staleTime:3e4}),l=o==null?void 0:o.events,c=(o==null?void 0:o.leadMs)??qet(),d=t$t(5e3,i),u=y.useRef(new Map),h=y.useRef(new Map),m=y.useRef(r);return m.current=r,y.useEffect(()=>{if(!i||!(t!=null&&t.id)||!l)return;const f=l.filter(p=>p.myRSVPStatus==="going"||p.myRSVPStatus==="maybe");for(const[p,g]of h.current){const v=f.find(b=>b.realId===p);(!v||v.startTime!==g.startTime)&&(He.dismiss(g.id),h.current.delete(p))}for(const p of f){const g=new Date(p.startTime).getTime();if(Number.isNaN(g)||d<g-c||d>=g)continue;const v=`${Eks}:${t.id}:${p.realId}`;if(Nks(v,p.startTime,u.current))continue;Tks(v,p.startTime,u.current);const b=Math.max(1,Math.round((g-d)/6e4)),x=He(`${p.title} starts in ${b} ${b===1?"minute":"minutes"}`,{description:xks(p.startTime),duration:jks,action:{label:"View event",onClick:()=>m.current(Nk(p))},onDismiss:()=>h.current.delete(p.realId),onAutoClose:()=>h.current.delete(p.realId)});h.current.set(p.realId,{id:x,startTime:p.startTime})}},[i,l,c,d,t==null?void 0:t.id]),null}const U6t="pensil.pushPromptDismissed";let sme=null,YH=null;function Aks(){return!!wo.firebase.vapidKey}function UX(){return!Aks()||!Nd()||typeof window>"u"||!("serviceWorker"in navigator)||!("Notification"in window)?"unavailable":Notification.permission==="denied"?"blocked":Notification.permission==="granted"?"enabled":"prompt"}function Pks(){return Uct(U6t)==="1"}function Ket(){zct(U6t,"1")}function Rks(){return UX()!=="enabled"?Promise.resolve():z6t()}async function Iks(){UX()==="prompt"&&await Notification.requestPermission();const t=UX();return t==="enabled"&&await z6t(),t}function z6t(){var r,s;const t=((r=ro())==null?void 0:r.id)??null,e=YH;if(e&&e.userId===t&&(!e.settled||((s=gje())==null?void 0:s.userId)===t))return e.promise;const n={userId:t,settled:!1,promise:Promise.resolve()};return n.promise=Mks().then(()=>{n.settled=!0}).catch(()=>{YH===n&&(YH=null)}),YH=n,n.promise}async function Mks(){var u;const[{initializeApp:t},{getMessaging:e,getToken:n,isSupported:r}]=await Promise.all([wn(()=>import("./index.esm-DkCRNU10.js"),__vite__mapDeps([99,100])),wn(()=>import("./index.esm-BljyuevP.js"),__vite__mapDeps([101,100]))]);if(!await r().catch(()=>!1))return;const s=wo.firebase,i=new URLSearchParams({apiKey:s.apiKey,projectId:s.projectId,messagingSenderId:s.messagingSenderId,appId:s.appId,api:new URL(wo.apiBaseUrl,window.location.origin).href}),o=await navigator.serviceWorker.register(`/firebase-messaging-sw.js?${i.toString()}`);sme||(sme=t({apiKey:s.apiKey,projectId:s.projectId,messagingSenderId:s.messagingSenderId,appId:s.appId}));const l=await n(e(sme),{vapidKey:s.vapidKey,serviceWorkerRegistration:o}),c=(u=ro())==null?void 0:u.id;if(!l||!c)return;const d=gje();(d==null?void 0:d.userId)===c&&d.token===l||(await pWt(l),rnn({userId:c,token:l}))}function Lks(t){return typeof t!="string"?null:/^\/(post\/[a-f0-9]{24}|course\/[a-f0-9]{24}|knowledge-hub\?resource=[a-f0-9]{24}|chat|notifications)$/i.test(t)?t:null}function Dks(){var c;const[t,e]=y.useState(!1),[n,r]=y.useState(!1),s=Nn(),i=((c=jr().user)==null?void 0:c.id)??null;if(y.useEffect(()=>{if(!i){e(!1);return}Rks(),e(UX()==="prompt"&&!Pks())},[i]),y.useEffect(()=>{if(typeof navigator>"u"||!("serviceWorker"in navigator))return;const d=u=>{var f,p;const h=u.data;if((h==null?void 0:h.type)!=="push-click")return;const m=Lks(h.path);m&&(s(m),(p=(f=u.ports)==null?void 0:f[0])==null||p.postMessage({ok:!0}))};return navigator.serviceWorker.addEventListener("message",d),()=>navigator.serviceWorker.removeEventListener("message",d)},[s]),!t)return null;const o=async()=>{r(!0);try{await Iks()}finally{Ket(),e(!1),r(!1)}},l=()=>{Ket(),e(!1)};return a.jsx("div",{role:"dialog","aria-label":"Turn on notifications",className:"fixed bottom-4 right-4 z-50 w-[min(22rem,calc(100vw-2rem))] rounded-xl border border-border bg-card p-4 shadow-lg",children:a.jsxs("div",{className:"flex items-start gap-3",children:[a.jsx("span",{className:"flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-primary/10 text-primary",children:a.jsx(Lm,{className:"h-4 w-4"})}),a.jsxs("div",{className:"min-w-0 flex-1",children:[a.jsx("p",{className:"text-sm font-semibold text-foreground",children:"Turn on notifications?"}),a.jsx("p",{className:"mt-0.5 text-xs text-muted-foreground",children:"Get notified about replies, messages and events even when this tab is closed."}),a.jsxs("div",{className:"mt-3 flex items-center gap-2",children:[a.jsx(Z,{size:"sm",onClick:()=>void o(),disabled:n,children:"Turn on"}),a.jsx(Z,{size:"sm",variant:"ghost",onClick:l,disabled:n,children:"Not now"})]})]}),a.jsx("button",{type:"button",onClick:l,"aria-label":"Dismiss",className:"rounded p-1 text-muted-foreground hover:bg-muted",children:a.jsx(nn,{className:"h-4 w-4"})})]})})}function $ks({children:t}){var h,m;const{user:e}=jr(),{community:n}=qe(),{communityDetail:r,communityDetailLoading:s}=Ln(),i=(h=r??n)==null?void 0:h.platformStatus;if(my({platformStatus:i}))return a.jsx(bje,{communityName:(r==null?void 0:r.name)||(n==null?void 0:n.name),communityLogo:(r==null?void 0:r.logo)||(n==null?void 0:n.logo)});if(!e)return a.jsx(a.Fragment,{children:t});const o=r??null,c=((o==null?void 0:o.myRole)??(n==null?void 0:n.myRole))==="admin",d=!!(o?o.needsAdminVerification:n!=null&&n.needsAdminVerification);if(!c&&d){if(!o)return s?a.jsx(Oks,{}):a.jsx(a.Fragment,{children:t});if(!o.joinVerifiedByAdmin)return a.jsx(Fks,{})}const u=!!((m=o??n)!=null&&m.isMobileAndEmailVerificationRequired);return!c&&u&&e&&(!e.email||!e.mobile)?a.jsx(Bks,{}):a.jsx(a.Fragment,{children:t})}function Oks(){return a.jsxs("div",{className:"flex h-screen flex-col items-center justify-center gap-3 bg-background text-muted-foreground",children:[a.jsx(Ne,{className:"h-6 w-6 animate-spin"}),a.jsx("span",{className:"text-sm",children:"Checking your membership…"})]})}function V6t({children:t}){const{logout:e}=jr(),{community:n}=qe();return a.jsxs("div",{className:"flex min-h-screen flex-col bg-background",children:[a.jsxs("header",{className:"flex items-center justify-between border-b border-border bg-card px-6 py-3",children:[a.jsxs("div",{className:"flex items-center gap-3",children:[a.jsx(bI,{sources:[n==null?void 0:n.logo],className:"h-9 w-9 rounded object-cover"}),a.jsx("span",{className:"text-lg font-bold capitalize text-foreground",children:n==null?void 0:n.name})]}),a.jsx(Z,{variant:"ghost",className:"text-destructive",onClick:e,children:"Log out"})]}),a.jsx("main",{className:"flex flex-1 items-center justify-center p-6",children:t})]})}function Fks(){const{community:t}=qe();return a.jsx(V6t,{children:a.jsxs("div",{className:"flex w-full max-w-md flex-col items-center rounded-2xl border border-border bg-card p-10 text-center shadow-sm",children:[a.jsx(bI,{sources:[t==null?void 0:t.logo],className:"mb-6 w-40 rounded-lg object-cover"}),a.jsx("h1",{className:"text-lg font-bold text-foreground",children:"Your membership is pending"}),a.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:"You'll be notified if your request to join has been approved."})]})})}function Bks(){const{user:t}=jr(),e=!(t!=null&&t.email),n=!(t!=null&&t.mobile);return a.jsx(V6t,{children:a.jsxs("div",{className:"w-full max-w-md space-y-4",children:[a.jsxs("div",{className:"text-center",children:[a.jsx("h1",{className:"text-lg font-bold text-foreground",children:"Verify your contact details"}),a.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["Please verify"," ",e&&n?"both your email and mobile":e?"your email":"your mobile"," ","to gain access to this community."]})]}),e&&a.jsx(zOt,{}),n&&a.jsx(VOt,{})]})})}function Yet(){const t=Di(),e=`${t.pathname.replace(/^\/knowledge/,"/course")}${t.search}${t.hash}`;return a.jsx(Gs,{to:e,replace:!0})}function Uks(){return a.jsxs(nCe,{children:[a.jsx(an,{path:"home",element:a.jsx(bfs,{})}),a.jsx(an,{path:ve.gettingStarted,element:a.jsx(ghs,{})}),a.jsx(an,{path:ve.community,element:a.jsx(I5t,{})}),a.jsx(an,{path:ve.communityMembers,element:a.jsx(PFr,{})}),a.jsx(an,{path:ve.knowledge,element:a.jsx(Ifs,{})}),a.jsx(an,{path:ve.knowledgeHub,element:a.jsx(Ogs,{})}),a.jsx(an,{path:ve.knowledgeCoursePattern,element:a.jsx(wps,{})}),a.jsx(an,{path:ve.networking,element:a.jsx(Pvs,{})}),a.jsx(an,{path:ve.leaderboard,element:a.jsx(z5t,{})}),a.jsx(an,{path:"/settings/subscription",element:a.jsx(xxs,{})}),a.jsx(an,{path:ve.settings,element:a.jsx(yxs,{})}),a.jsx(an,{path:ve.notifications,element:a.jsx(Axs,{})}),a.jsxs(an,{element:a.jsx(yA,{children:a.jsx(zZ,{feature:"bulkEmailing",children:a.jsx(wvr,{children:a.jsx(f4,{})})})}),children:[a.jsx(an,{path:ve.emailMarketing,element:a.jsx(qxs,{})}),a.jsx(an,{path:ve.emailCampaigns,element:a.jsx(Qxs,{})}),a.jsx(an,{path:ve.emailCampaignCreate,element:a.jsx(Q0s,{})}),a.jsx(an,{path:ve.emailCampaignReportPattern,element:a.jsx(tws,{})}),a.jsx(an,{path:ve.emailSequences,element:a.jsx(sws,{})}),a.jsx(an,{path:ve.emailAutomations,element:a.jsx(Gs,{to:ve.emailSequences,replace:!0})}),a.jsx(an,{path:ve.emailFunnels,element:a.jsx(lws,{})}),a.jsx(an,{path:ve.emailForms,element:a.jsx(gws,{})}),a.jsx(an,{path:ve.emailTemplates,element:a.jsx(bws,{})}),a.jsx(an,{path:ve.emailAudience,element:a.jsx(kws,{})}),a.jsx(an,{path:ve.emailContacts,element:a.jsx(Gs,{to:ve.emailAudience,replace:!0})}),a.jsx(an,{path:ve.newsletter,element:a.jsx(Sws,{})}),a.jsx(an,{path:ve.newsletterNew,element:a.jsx(Nws,{})}),a.jsx(an,{path:ve.newsletterDetailPattern,element:a.jsx($ws,{})}),a.jsx(an,{path:ve.newsletterPostPattern,element:a.jsx(Yws,{})})]}),a.jsxs(an,{element:a.jsx(yA,{children:a.jsx(kvr,{children:a.jsx(f4,{})})}),children:[a.jsx(an,{path:ve.content,element:a.jsx(Gs,{to:ve.contentMedia,replace:!0})}),a.jsx(an,{path:ve.contentMedia,element:a.jsx(N1s,{})}),a.jsx(an,{path:ve.contentPosts,element:a.jsx(L1s,{})}),a.jsx(an,{path:ve.contentSpaces,element:a.jsx(B1s,{})}),a.jsx(an,{path:ve.contentTopics,element:a.jsx(z1s,{})})]}),a.jsxs(an,{element:a.jsx(yA,{children:a.jsx(f4,{})}),children:[a.jsx(an,{element:a.jsx(sgr,{}),children:a.jsx(an,{path:ve.import,element:a.jsx(_xs,{})})}),a.jsx(an,{path:ve.insights,element:a.jsx(Nrs,{})})]}),a.jsxs(an,{element:a.jsx(yA,{children:a.jsx(zZ,{feature:"workflows",children:a.jsx(f4,{})})}),children:[a.jsx(an,{path:ve.workflows,element:a.jsx(_ss,{})}),a.jsx(an,{path:ve.workflowTemplates,element:a.jsx(Pss,{})}),a.jsx(an,{path:ve.workflowSelectType,element:a.jsx(Rss,{})})]}),a.jsx(an,{path:ve.engagement,element:a.jsx(LFr,{})}),a.jsx(an,{path:ve.chat,element:a.jsx($4r,{})}),a.jsx(an,{path:ve.saved,element:a.jsx(g0r,{})}),a.jsx(an,{path:ve.groupPattern,element:a.jsx($ms,{})}),a.jsx(an,{path:ve.exploreGroups,element:a.jsx(uhs,{})}),a.jsx(an,{path:ve.calendar,element:a.jsx(B3r,{})}),a.jsx(an,{path:ve.eventDetailPattern,element:a.jsx(SJe,{})}),a.jsx(an,{path:"/event/:eventId",element:a.jsx(eur,{})}),a.jsx(an,{path:"/p/:slug",element:a.jsx(tur,{})}),a.jsx(an,{path:"/g/:slug",element:a.jsx(NVe,{})}),a.jsx(an,{path:"/g/:slug/s/:sectionSlug",element:a.jsx(NVe,{})}),a.jsx(an,{path:"/group/:groupId",element:a.jsx(nur,{})}),a.jsx(an,{path:"/settings/notification",element:a.jsx(EVe,{})}),a.jsx(an,{path:"/settings/notifications",element:a.jsx(EVe,{})}),a.jsx(an,{path:ve.eventBySlugPattern,element:a.jsx(SJe,{})}),a.jsx(an,{path:ve.redemption,element:a.jsx(Ovs,{})}),a.jsx(an,{path:ve.profile,element:a.jsx(fvs,{})}),a.jsx(an,{path:ve.memberPattern,element:a.jsx(qgs,{})}),a.jsx(an,{path:ve.embeddedSectionPattern,element:a.jsx(qus,{})}),a.jsx(an,{path:ve.postPattern,element:a.jsx(Lvs,{})}),a.jsx(an,{path:"*",element:a.jsx(Rvs,{})})]})}function zks(){const t=!!hGt(ve.postPattern);return a.jsx(XT,{allowGuest:t,children:a.jsx(Pan,{children:a.jsx(Jdr,{children:a.jsx($ks,{children:a.jsxs(Pbs,{children:[a.jsx(V1s,{}),a.jsx(Fsr,{children:a.jsx(Jhr,{children:a.jsxs(e4r,{children:[a.jsx(Cks,{}),a.jsx(H1s,{}),a.jsx(_ks,{}),a.jsx(Dks,{}),a.jsxs(nCe,{children:[a.jsx(an,{path:"/knowledge",element:a.jsx(Yet,{})}),a.jsx(an,{path:"/knowledge/*",element:a.jsx(Yet,{})}),a.jsx(an,{path:ve.knowledgeLearnPattern,element:a.jsx(Sgs,{})}),a.jsx(an,{path:ve.meetingPattern,element:a.jsx(jCt,{})}),a.jsx(an,{path:ve.workflowBuilderPattern,element:a.jsx(yA,{children:a.jsx(zZ,{feature:"workflows",children:a.jsx(_us,{})})})}),a.jsx(an,{path:"*",element:a.jsx(rgr,{children:a.jsx(Uks,{})})})]})]})})})]})})})})})}function Vks(){return a.jsxs(nCe,{children:[wdr,a.jsx(an,{path:ve.home,element:a.jsx(trn,{})}),a.jsx(an,{path:ve.communities,element:a.jsx(XT,{children:a.jsx(krn,{})})}),a.jsx(an,{path:ve.communitiesCreate,element:a.jsx(XT,{children:a.jsx(_rn,{})})}),a.jsx(an,{path:ve.communitiesCreateOverview,element:a.jsx(XT,{children:a.jsx(Arn,{})})}),a.jsx(an,{path:ve.communitiesJoin,element:a.jsx(XT,{children:a.jsx(Fsn,{})})}),a.jsx(an,{path:ve.communitiesOnboarding,element:a.jsx(XT,{children:a.jsx(_an,{})})}),a.jsx(an,{path:ve.blocked,element:a.jsx(Aan,{})}),a.jsx(an,{path:ve.protectedWildcard,element:a.jsx(zks,{})})]})}function Hks({children:t}){const e=ldt(),{community:n,setCommunity:r}=qe(),s=y.useRef(n);s.current=n;const i=!!(e&&n&&Xee(n.address,e,n.resolvedFromHost)&&my(n)),[o,l]=y.useState(e?i?"suspended":"loading":"skip");return y.useEffect(()=>{if(!e){l("skip");return}let c=!1;return fdt(e).then(d=>{if(c)return;if(my(d)){r({...d,resolvedFromHost:e}),l("suspended");return}const u=s.current;u&&my(u)&&r({...u,platformStatus:d.platformStatus}),l("ok")}).catch(()=>{c||l("ok")}),()=>{c=!0}},[e,r]),!e||o==="skip"||o==="ok"?a.jsx(a.Fragment,{children:t}):o==="suspended"?a.jsx(bje,{communityName:n==null?void 0:n.name,communityLogo:n==null?void 0:n.logo}):a.jsx(mge,{title:"Opening your community"})}const Gks=new AHt,Wks=()=>a.jsx($Ht,{client:Gks,children:a.jsx(Hnn,{children:a.jsx(znn,{children:a.jsxs(GSe,{children:[a.jsx(nzt,{}),a.jsx(Mzt,{}),a.jsx($Gt,{children:a.jsx(nnn,{children:a.jsx(ann,{children:a.jsxs(Bnn,{children:[a.jsx(mnn,{}),a.jsx(Hks,{children:a.jsx(Vks,{})})]})})})})]})})})});ZFt();Cfr();const Qet=document.getElementById("root");Qet&&xrt(Qet).render(a.jsx(Wks,{}));export{AIn as A,kye as B,hSs as C,ng as D,cSs as E,EAn as F,gSs as G,uvt as H,ySs as I,vSs as J,dSs as K,y as L,B8e as P,se as R,kSs as a,FIn as b,ayt as c,CSs as d,cAn as e,UIn as f,bvt as g,OEe as h,pSs as i,bQ as j,P7 as k,xSs as l,uSs as m,bSs as n,fSs as o,SSs as p,wSs as q,VTn as r,zIn as s,SS as t,OIn as u,UE as v,ivt as w,AI as x,Qy as y,oyt as z};
